From 9ba04fd0d795a96cf5fb00a997a4885b82bbf529 Mon Sep 17 00:00:00 2001 From: coolsnowwolf <“coolsnowwolf@gmail.com”> Date: Thu, 23 Aug 2018 17:40:23 +0800 Subject: [PATCH] sync with OpenWrt v18.06.1 stable new R8.1 version --- config/Config-images.in | 13 +- config/Config-kernel.in | 2 +- feeds.conf.default | 2 +- include/feeds.mk | 17 +- include/image-commands.mk | 8 +- include/image.mk | 1 + include/kernel-build.mk | 2 +- include/kernel-version.mk | 12 +- include/package-ipkg.mk | 2 +- include/package.mk | 9 +- include/prereq-build.mk | 10 +- include/scan.mk | 6 + include/subdir.mk | 1 + include/target.mk | 3 +- include/toplevel.mk | 4 +- include/version.mk | 8 +- package/base-files/Makefile | 8 +- package/base-files/files/etc/banner.failsafe | 4 +- package/base-files/files/etc/init.d/sysctl | 2 +- .../files/etc/sysctl.d/10-default.conf | 5 +- package/base-files/files/lib/functions.sh | 13 +- .../base-files/files/lib/functions/network.sh | 12 +- .../base-files/files/lib/upgrade/common.sh | 12 +- .../base-files/files/lib/upgrade/fwtool.sh | 4 - package/base-files/files/sbin/sysupgrade | 5 +- package/base-files/image-config.in | 16 +- package/boot/at91bootstrap/Makefile | 49 +- package/boot/at91bootstrap/at91bootstrap.mk | 2 +- package/boot/uboot-at91/Makefile | 65 +- package/boot/uboot-envtools/Makefile | 13 +- package/boot/uboot-envtools/files/ar71xx | 1 + package/boot/uboot-envtools/files/ipq40xx | 3 +- package/boot/uboot-envtools/files/mvebu | 4 + .../patches/007-nsa310-uboot-generic.patch | 2 +- .../patches/008-nsa325-uboot-generic.patch | 2 +- .../patches/010-pogoplug_v4.patch | 2 +- .../uboot-kirkwood/patches/110-dockstar.patch | 2 +- .../uboot-kirkwood/patches/120-iconnect.patch | 3 +- .../uboot-kirkwood/patches/130-ib62x0.patch | 3 +- .../patches/140-pogoplug_e02.patch | 2 +- .../patches/150-goflexhome.patch | 3 +- package/boot/uboot-mvebu/Makefile | 3 + .../patches/210-link-libcrypto-static.patch | 14 + package/boot/uboot-mxs/Makefile | 3 + ...image-Support-building-with-LibreSSL.patch | 33 +- .../patches/210-link-libcrypto-static.patch | 14 + .../patches/410-gcc-6-compiler.patch | 306 + .../patches/420-gcc-7-compiler.patch | 287 + .../uboot-oxnas/src/include/configs/ox820.h | 1 + package/boot/uboot-zynq/Makefile | 3 + .../patches/210-link-libcrypto-static.patch | 14 + package/firmware/amd64-microcode/Makefile | 4 +- package/firmware/ath10k-firmware/Makefile | 24 +- package/firmware/intel-microcode/Makefile | 12 +- package/firmware/ipq-wifi/Makefile | 4 +- package/firmware/ipq-wifi/board-rt-acrh17.bin | Bin 12164 -> 0 bytes .../firmware/ipq-wifi/board-zyxel_wre6606.bin | Bin 0 -> 24316 bytes package/firmware/linux-firmware/ti.mk | 13 + .../600-custom-fix-txpower-and-dfs.patch | 41 - package/kernel/ath10k-ct/Makefile | 2 +- .../081-ath10k-calibration-variant.patch | 113 + ...-IEs-for-variant-before-falling-back.patch | 249 + .../kernel/gpio-nct5104d/src/gpio-nct5104d.c | 5 - package/kernel/kmod-sched-cake/Makefile | 7 +- ...eset-g_tx_link_rate-on-showtime-exit.patch | 12 + package/kernel/leds-apu2/src/leds-apu2.c | 12 - package/kernel/linux/Makefile | 2 +- package/kernel/linux/modules/fs.mk | 2 - package/kernel/linux/modules/netdevices.mk | 4 +- package/kernel/linux/modules/other.mk | 9 +- package/kernel/linux/modules/usb.mk | 54 +- package/kernel/mac80211/Makefile | 16 +- .../mac80211/files/lib/wifi/mac80211.sh | 2 +- ...00-use-TXOP_BACKOFF-for-probe-frames.patch | 43 + .../100-remove-cryptoapi-dependencies.patch | 10 +- ...aes-cmac-switch-to-shash-CMAC-driver.patch | 43 +- ...leanup-brcmf_cfg80211_escan-function.patch | 14 +- ...fmac-Remove-brcmf_sdiod_request_data.patch | 4 +- ...replace-old-IO-functions-with-simple.patch | 6 +- ...brcmfmac-Remove-brcmf_sdiod_addrprep.patch | 12 +- ...cmf_bus_preinit-call-just-after-chan.patch | 45 + ...location-of-control-rx-buffer-to-brc.patch | 69 + ...cmf_attach-just-before-calling-brcmf.patch | 106 + ...l-brcmf_usb_up-during-brcmf_bus_prei.patch | 41 + ...move-brcmf_attach-function-in-core.c.patch | 130 + ...emove-brcmf_bus_started-from-bus-api.patch | 190 + ...log-level-for-some-low-level-sdio-fu.patch | 64 + ...duplicate-pointer-variable-from-brcm.patch | 126 + ...17-0001-brcmfmac-reject-too-long-PSK.patch | 27 + ...convert-linux-error-to-firmware-erro.patch | 31 + ...mf_chip_name-to-store-name-in-revinf.patch | 203 + ...-use-brcmf_chip_name-for-consistency.patch | 69 + ...e-struct-brcmf_pub-instance-using-wi.patch | 452 + ...brcmfmac-use-wiphy-debugfs-dir-entry.patch | 349 + ...firmware-filenames-from-basename-map.patch | 286 + ...ass-struct-in-brcmf_fw_get_firmwares.patch | 574 + ...duce-brcmf_fw_alloc_request-function.patch | 328 + ...d-extension-to-.get_fwname-callbacks.patch | 231 + ...get-rid-of-brcmf_fw_map_chip_to_name.patch | 92 + ...ac-get-rid-of-brcmf_fw_get_full_name.patch | 44 + ...erneldoc-for-struct-brcmf_bus-msgbuf.patch | 23 + ...mware-request-processing-if-nvram-lo.patch | 81 + ...mac-add-support-for-BCM4366E-chipset.patch | 48 + ...-check-p2pdev-mac-address-uniqueness.patch | 34 + ...orts-boottime_ns-while-informing-bss.patch | 76 + ...0211_band-directly-to-get-ieee80211-.patch | 43 + ...mac-constify-firmware-mapping-tables.patch | 76 + ...05-brcmfmac-add-hostready-indication.patch | 74 + ...support-for-PCIe-shared-structure-re.patch | 97 + ...upport-for-bcm43364-wireless-chipset.patch | 45 + ...fmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch | 34 + ...tialization-of-struct-cfg80211_infor.patch | 29 + ...ugfs-entry-for-reading-firmware-capa.patch | 75 + ...ALLFFMAC-variable-in-flowring-module.patch | 52 + ...support-for-sysfs-initiated-coredump.patch | 76 + ...e-user-provided-data-for-memdump-bef.patch | 32 + ...-memory-dump-upon-firmware-halt-sign.patch | 38 + ...-memory-dump-on-SDIO-firmware-halt-m.patch | 30 + ...tchdog-before-detach-and-free-everyt.patch | 70 + ...ression-in-parsing-NVRAM-for-multipl.patch | 41 + ..._hw-issue-external-reset-for-QCA955x.patch | 51 +- ...etries-for-powersave-response-frames.patch | 96 - ...ata-bit-in-PS-buffered-frame-release.patch | 8 +- ...ntially-stale-EOSP-status-bit-in-int.patch | 2 +- ...fix-block-ack-window-tracking-issues.patch | 18 +- ...ata-flag-for-buffered-multicast-pack.patch | 4 +- ...trel-reduce-minstrel_mcs_groups-size.patch | 86 +- ...tect-queue-draining-by-rcu_read_lock.patch | 4 +- ...ialize-sinfo-in-cfg80211_get_station.patch | 42 + .../patches/530-ath9k_extra_leds.patch | 12 +- ...xxu-Accept-firmware-signature-0x88e0.patch | 22 - ...nitial-code-to-detect-8188eu-devices.patch | 121 - ...d-initial-code-to-parse-8188eu-efuse.patch | 113 - ...l8xxxu-Detect-8188eu-parts-correctly.patch | 43 - ...xxxu-First-stab-at-rtl8188e_power_on.patch | 105 - ...tl8xxxu-Add-rtl8188e_disabled_to_emu.patch | 40 - ...0007-rtl8xxxu-8188e-Enable-scheduler.patch | 45 - ...8188e_usb_quirk-for-enabling-MAC-TX-.patch | 40 - ...8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch | 34 - ...erved-page-init-parameters-for-8188e.patch | 45 - ...Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch | 24 - ...tl8xxxu-Add-trxff_boundary-for-8188e.patch | 28 - ...specify-firmware-block-size-and-set-.patch | 26 - ...14-rtl8xxxu-Add-8188e-mac-init-table.patch | 57 - ...xxxu-Implement-rtl8188eu_init_phy_bb.patch | 245 - ...xxxu-Implement-rtl8188eu_init_phy_rf.patch | 103 - ...rtl8xxxu-Use-auto-LLT-init-for-8188e.patch | 24 - ...-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch | 25 - ...mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch | 27 - ...xu-Set-transfer-page-size-for-8188eu.patch | 21 - ...xxu-Enable-TX-report-timer-on-8188eu.patch | 22 - ...rtl8xxxu-Setup-interrupts-for-8188eu.patch | 31 - ...esc16-and-32-byte-tx-descriptors-for.patch | 30 - ...use-same-ADDA-on-parameters-as-8723a.patch | 25 - ...d-PHY-IQ-calibration-code-for-8188eu.patch | 521 - ...u-8188eu-uses-the-gen2-thermal-meter.patch | 23 - ...xu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch | 23 - ...u-Implement-rtl8188eu_config_channel.patch | 146 - ...xxu-Use-gen2-H2C-commands-for-8188eu.patch | 25 - ...-Initialize-GPIO-settings-for-8188eu.patch | 40 - ...u-Add-simple-rtl8188eu_rf_on-routine.patch | 34 - ...l8xxxu-Implement-rtl8188e_disable_rf.patch | 44 - ...8188e-efuse-definition-for-power-val.patch | 62 - ...xxxu-Implement-rtl8188e_set_tx_power.patch | 94 - ...nt-rtl8xxxu_fill_txdesc_v3-for-8188e.patch | 145 - ...e-8188eu-registers-and-update-CCK0_A.patch | 87 - ...-register-description-for-REG_FPGA1_.patch | 30 - ...xu-properly-detect-RTL8188EU-devices.patch | 29 - ...nt-8188eu-specific-8051-reset-functi.patch | 43 - ...ble-packet-DMA-aggregation-on-8188eu.patch | 43 - ...set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch | 28 - ...l8xxxu-Fix-rtl8188eu-connection-fail.patch | 27 - ...not-set-auto-rate-fallback-on-8188eu.patch | 93 - ...3-0044-rtl8xxxu-Enable-8188eu-driver.patch | 22 - ...xu-Add-rtl8188etv-to-USB-device-list.patch | 25 - ...dd-sitecom-dongle-to-USB-device-list.patch | 23 - ...xu-Implement-rtl8188eu_active_to_emu.patch | 68 - ...l8xxxu-Implement-rtl8188eu_power_off.patch | 185 - ...8188eu-USB-ID-for-D-Link-USB-GO-N150.patch | 25 - ...YS_FUNC_UPLL-during-power-up-on-8188.patch | 23 - ...nable-of-WEP-TKIP-security-on-8188eu.patch | 25 - ...rrect-power-down-sequence-for-8188eu.patch | 65 - ...-8188eu-REG_GPIO_MUXCFG-on-power-off.patch | 21 - ...le-devices-with-a-smaller-LLT-buffer.patch | 70 - ...loading-of-driver-for-8188eu-devices.patch | 72 - ...re-to-enable-OFDM-paths-for-8188eu-i.patch | 39 - ..._sel-entry-to-struct-rtl8xxxu_rxdesc.patch | 35 - ...-register-wiphy-s-during-module_init.patch | 62 +- ...62-brcmfmac-Disable-power-management.patch | 2 +- ...e-internal-roaming-engine-by-default.patch | 2 +- ...-of-peer_bw_rxnss_override-parameter.patch | 132 + ...dling-for-VHT160-in-recent-firmwares.patch | 50 + ...rolling-support-for-various-chipsets.patch | 643 + package/kernel/mt76/Makefile | 6 +- package/kernel/mwlwifi/Makefile | 17 +- .../files/zzz-default-settings | 2 +- package/libs/libnfnetlink/Makefile | 3 +- package/libs/libnl/Makefile | 3 + package/libs/libubox/Makefile | 6 +- package/libs/libusb/Makefile | 10 +- package/libs/mbedtls/Makefile | 4 +- package/libs/mbedtls/patches/200-config.patch | 180 +- .../patches/300-soversion-compatibility.patch | 34 + package/libs/nghttp2/Makefile | 4 +- package/libs/openssl/Makefile | 4 +- .../libs/openssl/patches/150-no_engines.patch | 2 +- .../openssl/patches/200-parallel_build.patch | 2 +- package/libs/uclient/Makefile | 6 +- package/libs/ustream-ssl/Makefile | 8 +- package/libs/wolfssl/Config.in | 12 + package/libs/wolfssl/Makefile | 33 +- package/libs/zlib/Makefile | 2 - package/network/config/firewall/Makefile | 10 +- .../config/ltq-adsl-app/files/dsl_control | 2 +- .../config/ltq-vdsl-app/files/dsl_control | 3 +- package/network/config/netifd/Makefile | 6 +- package/network/config/qos-scripts/Makefile | 2 +- .../config/qos-scripts/files/usr/bin/qos-stat | 11 +- .../qos-scripts/files/usr/lib/qos/generate.sh | 45 +- package/network/ipv6/ds-lite/Makefile | 2 +- package/network/ipv6/ds-lite/files/dslite.sh | 8 +- package/network/ipv6/map/Makefile | 2 +- package/network/ipv6/map/files/map.sh | 16 +- package/network/ipv6/odhcp6c/Makefile | 8 +- .../network/ipv6/odhcp6c/files/dhcpv6.script | 2 + package/network/ipv6/odhcp6c/files/dhcpv6.sh | 11 +- package/network/services/dnsmasq/Makefile | 18 +- .../services/dnsmasq/files/dnsmasq.init | 32 +- .../services/dnsmasq/patches/240-ubus.patch | 8 +- .../services/dropbear/files/dropbear.init | 5 + .../network/services/hostapd/files/hostapd.sh | 46 +- ...thenticated-encrypted-EAPOL-Key-data.patch | 48 + package/network/services/igmpproxy/Makefile | 2 +- .../services/igmpproxy/files/igmpproxy.init | 2 +- package/network/services/odhcpd/Makefile | 8 +- package/network/services/openvpn/Makefile | 2 +- package/network/services/ppp/Makefile | 10 +- package/network/services/ppp/files/ppp.sh | 9 - .../ppp/patches/500-add-pptp-plugin.patch | 3 +- .../services/ppp/patches/511-syncppp.patch | 214 - package/network/services/samba36/Makefile | 14 + .../services/samba36/files/lib/samba.sh | 89 + .../services/samba36/files/samba.hotplug | 11 + package/network/services/shellsync/Makefile | 34 - .../services/shellsync/src/shellsync.c | 106 - package/network/services/uhttpd/Makefile | 6 +- package/network/services/wireguard/Makefile | 17 +- .../services/wireguard/files/wireguard.sh | 6 + .../wireguard/files/wireguard_watchdog | 60 + .../wireguard/patches/100-portability.patch | 18 - package/network/utils/curl/Makefile | 6 +- ...bedtls-disable-runtime-version-check.patch | 2 +- ..._dont_use_deprecated_sha256_function.patch | 11 - .../curl/patches/400-CVE-2018-0500.patch | 32 + package/network/utils/iftop/Makefile | 6 +- package/network/utils/iperf/Makefile | 4 +- package/network/utils/iproute2/Makefile | 6 +- ...int-fix-hidden-64-bit-type-promotion.patch | 288 + .../patches/009-keep_libmnl_optional.patch | 2 +- .../utils/iproute2/patches/300-ip_tiny.patch | 6 +- .../iproute2/patches/950-add-cake-to-tc.patch | 1122 +- package/network/utils/iptables/Makefile | 1 + .../iptables/patches/600-shared-libext.patch | 10 +- package/network/utils/iwinfo/Makefile | 8 +- .../network/utils/wwan/files/data/1e2d-0053 | 6 + .../network/utils/wwan/files/data/1e2d-005b | 5 + package/network/utils/wwan/files/wwan.sh | 4 +- package/network/utils/wwan/files/wwan.usb | 5 + package/system/ca-certificates/Makefile | 6 +- package/system/mtd/Makefile | 4 +- package/system/mtd/src/trx.c | 49 +- .../Makefile | 21 +- package/system/procd/Makefile | 2 +- package/system/procd/files/procd.sh | 2 +- package/system/rpcd/Makefile | 6 +- package/system/ubox/Makefile | 2 +- package/system/ubox/files/log.init | 2 + package/system/ubus/Makefile | 6 +- package/system/uci/Makefile | 6 +- package/utils/busybox/Makefile | 11 +- package/utils/busybox/files/cron | 8 +- ...de-which-requires-server-ID-to-be-on.patch | 117 + package/utils/mtd-utils/Makefile | 25 +- .../mtd-utils/patches/010-fix-rpmatch.patch | 19 - .../mtd-utils/patches/100-fix_includes.patch | 2 +- .../mtd-utils/patches/130-lzma_jffs2.patch | 66 +- ...rrect-error-number-in-ubi_get_vol_in.patch | 30 + package/utils/px5g/Makefile | 2 +- package/utils/util-linux/Makefile | 5 +- scripts/bundle-libraries.sh | 4 + scripts/download.pl | 11 +- scripts/env | 2 +- scripts/feeds | 22 +- scripts/om-fwupgradecfg-gen.sh | 10 +- target/imagebuilder/files/Makefile | 29 +- target/linux/adm5120/Makefile | 24 - .../adm5120/base-files/etc/board.d/01_leds | 17 - .../adm5120/base-files/etc/config/network | 39 - target/linux/adm5120/base-files/etc/diag.sh | 22 - target/linux/adm5120/base-files/etc/inittab | 5 - .../linux/adm5120/base-files/lib/adm5120.sh | 53 - .../lib/preinit/01_preinit_do_adm5120.sh | 7 - .../lib/preinit/05_set_preinit_iface_adm5120 | 9 - .../base-files/lib/upgrade/platform.sh | 35 - target/linux/adm5120/config-3.18 | 176 - .../files-3.18/arch/mips/adm5120/Kconfig | 197 - .../files-3.18/arch/mips/adm5120/Platform | 19 - .../arch/mips/adm5120/cellvision/Makefile | 4 - .../arch/mips/adm5120/cellvision/cas-771.c | 37 - .../arch/mips/adm5120/cellvision/cellvision.c | 147 - .../arch/mips/adm5120/cellvision/cellvision.h | 28 - .../arch/mips/adm5120/cellvision/nfs-101.c | 47 - .../arch/mips/adm5120/common/Makefile | 8 - .../arch/mips/adm5120/common/adm5120.c | 76 - .../arch/mips/adm5120/common/clock.c | 65 - .../arch/mips/adm5120/common/early-printk.c | 31 - .../arch/mips/adm5120/common/gpio.c | 328 - .../files-3.18/arch/mips/adm5120/common/irq.c | 171 - .../arch/mips/adm5120/common/memory.c | 149 - .../arch/mips/adm5120/common/platform.c | 375 - .../arch/mips/adm5120/common/prom.c | 264 - .../arch/mips/adm5120/common/setup.c | 129 - .../arch/mips/adm5120/compex/Makefile | 5 - .../arch/mips/adm5120/compex/compex.c | 60 - .../arch/mips/adm5120/compex/compex.h | 23 - .../arch/mips/adm5120/compex/np27g.c | 28 - .../arch/mips/adm5120/compex/np28g.c | 63 - .../arch/mips/adm5120/compex/wp54.c | 95 - .../arch/mips/adm5120/edimax/Makefile | 5 - .../arch/mips/adm5120/edimax/br-6104k.c | 36 - .../arch/mips/adm5120/edimax/br-6104kp.c | 39 - .../arch/mips/adm5120/edimax/br-61x4wg.c | 43 - .../arch/mips/adm5120/edimax/br-61xx.c | 84 - .../arch/mips/adm5120/edimax/br-61xx.h | 23 - .../arch/mips/adm5120/generic/Makefile | 1 - .../arch/mips/adm5120/generic/eb-214a.c | 120 - .../arch/mips/adm5120/infineon/Makefile | 6 - .../arch/mips/adm5120/infineon/easy5120-rt.c | 48 - .../mips/adm5120/infineon/easy5120-wvoip.c | 24 - .../mips/adm5120/infineon/easy5120p-ata.c | 22 - .../arch/mips/adm5120/infineon/easy83000.c | 23 - .../arch/mips/adm5120/infineon/infineon.c | 108 - .../arch/mips/adm5120/infineon/infineon.h | 25 - .../arch/mips/adm5120/mikrotik/Makefile | 8 - .../arch/mips/adm5120/mikrotik/rb-11x.c | 35 - .../arch/mips/adm5120/mikrotik/rb-133.c | 40 - .../arch/mips/adm5120/mikrotik/rb-133c.c | 36 - .../arch/mips/adm5120/mikrotik/rb-150.c | 131 - .../arch/mips/adm5120/mikrotik/rb-153.c | 70 - .../arch/mips/adm5120/mikrotik/rb-192.c | 27 - .../arch/mips/adm5120/mikrotik/rb-1xx.c | 149 - .../arch/mips/adm5120/mikrotik/rb-1xx.h | 33 - .../arch/mips/adm5120/motorola/Makefile | 1 - .../arch/mips/adm5120/motorola/pmugw.c | 96 - .../arch/mips/adm5120/osbridge/5gxi.c | 71 - .../arch/mips/adm5120/osbridge/Makefile | 1 - .../arch/mips/adm5120/prom/Makefile | 10 - .../arch/mips/adm5120/prom/admboot.c | 55 - .../arch/mips/adm5120/prom/bootbase.c | 119 - .../files-3.18/arch/mips/adm5120/prom/cfe.c | 69 - .../arch/mips/adm5120/prom/generic.c | 47 - .../arch/mips/adm5120/prom/myloader.c | 68 - .../arch/mips/adm5120/prom/prom_read.h | 50 - .../arch/mips/adm5120/prom/routerboot.c | 121 - .../arch/mips/adm5120/zyxel/Makefile | 4 - .../arch/mips/adm5120/zyxel/p-334wt.c | 34 - .../arch/mips/adm5120/zyxel/p-335.c | 21 - .../arch/mips/adm5120/zyxel/p-33x.c | 85 - .../arch/mips/adm5120/zyxel/p-33x.h | 22 - .../include/asm/mach-adm5120/adm5120_defs.h | 53 - .../include/asm/mach-adm5120/adm5120_info.h | 129 - .../include/asm/mach-adm5120/adm5120_intc.h | 63 - .../include/asm/mach-adm5120/adm5120_mpmc.h | 92 - .../include/asm/mach-adm5120/adm5120_nand.h | 89 - .../asm/mach-adm5120/adm5120_platform.h | 87 - .../include/asm/mach-adm5120/adm5120_switch.h | 300 - .../include/asm/mach-adm5120/adm5120_uart.h | 64 - .../mips/include/asm/mach-adm5120/asm/sizes.h | 56 - .../asm/mach-adm5120/cpu-feature-overrides.h | 71 - .../arch/mips/include/asm/mach-adm5120/gpio.h | 115 - .../arch/mips/include/asm/mach-adm5120/irq.h | 43 - .../include/asm/mach-adm5120/prom/admboot.h | 17 - .../mips/include/asm/mach-adm5120/prom/cfe.h | 18 - .../include/asm/mach-adm5120/prom/generic.h | 18 - .../include/asm/mach-adm5120/prom/myloader.h | 179 - .../asm/mach-adm5120/prom/routerboot.h | 36 - .../include/asm/mach-adm5120/prom/zynos.h | 86 - .../arch/mips/include/asm/mach-adm5120/war.h | 25 - .../files-3.18/arch/mips/pci/pci-adm5120.c | 277 - .../files-3.18/drivers/ata/pata_rb153_cf.c | 267 - .../drivers/leds/ledtrig-adm5120-switch.c | 149 - .../drivers/mtd/maps/adm5120-flash.c | 482 - .../adm5120/files-3.18/drivers/mtd/trxsplit.c | 216 - .../files-3.18/drivers/net/adm5120sw.c | 1219 -- .../files-3.18/drivers/net/adm5120sw.h | 23 - .../files-3.18/drivers/usb/host/adm5120-dbg.c | 836 -- .../files-3.18/drivers/usb/host/adm5120-drv.c | 228 - .../files-3.18/drivers/usb/host/adm5120-hcd.c | 843 -- .../files-3.18/drivers/usb/host/adm5120-hub.c | 430 - .../files-3.18/drivers/usb/host/adm5120-mem.c | 202 - .../files-3.18/drivers/usb/host/adm5120-pm.c | 449 - .../files-3.18/drivers/usb/host/adm5120-q.c | 964 -- .../files-3.18/drivers/usb/host/adm5120.h | 755 -- .../files-3.18/drivers/watchdog/adm5120_wdt.c | 202 - target/linux/adm5120/image/Makefile | 112 - .../linux/adm5120/image/lzma-loader/Makefile | 62 - .../image/lzma-loader/src/LzmaDecode.c | 584 - .../image/lzma-loader/src/LzmaDecode.h | 113 - .../adm5120/image/lzma-loader/src/LzmaTypes.h | 45 - .../adm5120/image/lzma-loader/src/Makefile | 99 - .../adm5120/image/lzma-loader/src/README | 55 - .../adm5120/image/lzma-loader/src/board.c | 185 - .../adm5120/image/lzma-loader/src/config.h | 143 - .../image/lzma-loader/src/decompress.c | 353 - .../adm5120/image/lzma-loader/src/head.S | 209 - .../adm5120/image/lzma-loader/src/loader.lds | 29 - .../image/lzma-loader/src/lzma-data.lds | 8 - .../adm5120/image/lzma-loader/src/printf.c | 350 - .../adm5120/image/lzma-loader/src/printf.h | 18 - target/linux/adm5120/image/rb1xx.mk | 24 - target/linux/adm5120/image/router_be.mk | 48 - target/linux/adm5120/image/router_le.mk | 401 - target/linux/adm5120/modules.mk | 56 - .../adm5120/patches-3.18/001-adm5120.patch | 44 - .../patches-3.18/002-adm5120_flash.patch | 21 - .../patches-3.18/003-adm5120_switch.patch | 23 - .../patches-3.18/005-adm5120_usb.patch | 33 - .../patches-3.18/007-adm5120_pci.patch | 22 - .../009-adm5120_leds_switch_trigger.patch | 22 - .../050-revert_rootfs_splits.patch | 354 - .../patches-3.18/100-rootfs_split.patch | 316 - .../101-cfi_fixup_macronix_bootloc.patch | 84 - .../102-jedec_pmc_39lvxxx_chips.patch | 68 - .../patches-3.18/103-mtd_trxsplit.patch | 23 - .../patches-3.18/120-rb153_cf_driver.patch | 28 - .../patches-3.18/200-amba_pl010_hacks.patch | 354 - .../203-gpio_leds_brightness.patch | 27 - .../patches-3.18/310-adm5120_wdt.patch | 31 - .../adm5120/rb1xx/base-files/sbin/wget2nand | 78 - target/linux/adm5120/rb1xx/config-default | 52 - target/linux/adm5120/rb1xx/profiles/RB1xx.mk | 18 - target/linux/adm5120/rb1xx/target.mk | 8 - target/linux/adm5120/router_be/config-default | 13 - .../adm5120/router_be/profiles/010-Generic.mk | 17 - .../adm5120/router_be/profiles/200-ZyXEL.mk | 27 - target/linux/adm5120/router_be/target.mk | 10 - target/linux/adm5120/router_le/config-3.8 | 0 .../adm5120/router_le/profiles/010-Generic.mk | 28 - .../adm5120/router_le/profiles/Cellvision.mk | 146 - .../adm5120/router_le/profiles/Compex.mk | 37 - .../adm5120/router_le/profiles/Edimax.mk | 47 - .../adm5120/router_le/profiles/Infineon.mk | 27 - .../adm5120/router_le/profiles/Motorola.mk | 16 - .../adm5120/router_le/profiles/Osbridge.mk | 16 - target/linux/adm5120/router_le/target.mk | 10 - target/linux/adm8668/Makefile | 24 - .../adm8668/base-files/etc/config/network | 24 - target/linux/adm8668/base-files/etc/diag.sh | 21 - .../preinit/03_init_hotplug_failsafe_adm8668 | 9 - .../lib/preinit/05_set_preinit_face_adm8668 | 9 - .../base-files/lib/upgrade/platform.sh | 15 - .../adm8668/base-files/sbin/hotplug.failsafe | 4 - target/linux/adm8668/config-3.18 | 104 - .../files-3.18/arch/mips/adm8668/Kconfig | 2 - .../files-3.18/arch/mips/adm8668/Makefile | 6 - .../files-3.18/arch/mips/adm8668/Platform | 6 - .../files-3.18/arch/mips/adm8668/clock.c | 76 - .../arch/mips/adm8668/early_printk.c | 16 - .../files-3.18/arch/mips/adm8668/gpio.c | 123 - .../files-3.18/arch/mips/adm8668/irq.c | 126 - .../files-3.18/arch/mips/adm8668/platform.c | 196 - .../files-3.18/arch/mips/adm8668/prom.c | 95 - .../files-3.18/arch/mips/adm8668/setup.c | 36 - .../files-3.18/arch/mips/adm8668/time.c | 20 - .../files-3.18/arch/mips/adm8668/u-boot.h | 52 - .../mips/include/asm/mach-adm8668/adm8668.h | 69 - .../mips/include/asm/mach-adm8668/asm/sizes.h | 56 - .../arch/mips/include/asm/mach-adm8668/gpio.h | 13 - .../arch/mips/include/asm/mach-adm8668/irq.h | 14 - .../arch/mips/include/asm/mach-adm8668/war.h | 25 - .../files-3.18/arch/mips/pci/pci-adm8668.c | 200 - .../files-3.18/drivers/mtd/maps/adm8668.c | 334 - target/linux/adm8668/image/Makefile | 60 - .../linux/adm8668/image/lzma-loader/Makefile | 41 - .../image/lzma-loader/src/LzmaDecode.c | 590 - .../image/lzma-loader/src/LzmaDecode.h | 131 - .../adm8668/image/lzma-loader/src/Makefile | 47 - .../image/lzma-loader/src/decompress.c | 118 - .../image/lzma-loader/src/include/_exports.h | 18 - .../lzma-loader/src/include/asm/global_data.h | 60 - .../lzma-loader/src/include/asm/u-boot.h | 42 - .../image/lzma-loader/src/include/common.h | 48 - .../image/lzma-loader/src/include/exports.h | 38 - .../image/lzma-loader/src/include/image.h | 157 - .../adm8668/image/lzma-loader/src/lzma.lds.in | 24 - .../adm8668/image/lzma-loader/src/stubs.c | 52 - target/linux/adm8668/image/my-mkimage | 32 - .../patches-3.18/001-adm8668_arch.patch | 48 - .../patches-3.18/002-adm8668_pci.patch | 22 - .../patches-3.18/003-adm8668_nor_map.patch | 22 - .../patches-3.18/004-tulip_pci_split.patch | 452 - .../patches-3.18/005-tulip_platform.patch | 490 - .../patches-3.18/200-amba_pl010_hacks.patch | 377 - .../patches-3.18/201-amba_bus_hacks.patch | 13 - .../linux/adm8668/profiles/100-WRTU54G-TM.mk | 17 - target/linux/apm821xx/config-4.14 | 7 - target/linux/apm821xx/dts/apm82181.dtsi | 2 +- target/linux/apm821xx/image/Makefile | 2 +- ...crypto-crypto4xx-remove-bad-list_del.patch | 32 - ...-remove-unused-definitions-and-write.patch | 2 +- ...-set-CRYPTO_ALG_KERN_DRIVER_ONLY-fla.patch | 2 +- ...-remove-double-assignment-of-pd_uinf.patch | 2 +- ...-enable-AES-RFC3686-ECB-CFB-and-OFB-.patch | 2 +- ...x-refactor-crypto4xx_copy_pkt_to_dst.patch | 2 +- ...-replace-crypto4xx_dev-s-scatter_buf.patch | 8 +- ...-fix-crypto4xx_build_pdr-crypto4xx_b.patch | 84 - ...shuffle-iomap-in-front-of-request_i.patch} | 0 ...-crypto4xx-support-Revision-B-parts.patch} | 0 ...o-crypto4xx-fix-missing-irq-devname.patch} | 0 ...4-crypto-crypto4xx-kill-MODULE_NAME.patch} | 0 ...perform-aead-icv-check-in-the-drive.patch} | 0 ...ng-memory-allocator-instead-of-alloc.patch | 39 + ...crypto4xx-performance-optimizations.patch} | 25 +- ...crypto-crypto4xx-convert-to-skcipher.patch | 578 + ...-0004-crypto-crypto4xx-avoid-VLA-use.patch | 61 + ...crypto-crypto4xx-add-aes-ctr-support.patch | 247 + ...-properly-set-IV-after-de-and-encryp.patch | 71 + ...rypto4xx-extend-aead-fallback-checks.patch | 102 + ...-put-temporary-dst-sg-into-request-c.patch | 157 + ...-dw-dma-hprot-fix-and-equal-priortiy.patch | 25 + .../802-usb-xhci-force-msi-renesas-xhci.patch | 2 +- target/linux/ar7/config-3.18 | 129 - .../001-mips-ar7-fix-serial.patch | 23 - ...re-the-port-type-s-FCR-value-is-used.patch | 48 - .../patches-3.18/100-fix-highmem-offset.patch | 11 - ...R7-allow-NULL-clock-for-clk_get_rate.patch | 45 - target/linux/ar7/patches-3.18/110-flash.patch | 22 - .../160-vlynq_try_remote_first.patch | 300 - .../200-free-mem-below-kernel-offset.patch | 15 - .../patches-3.18/300-add-ac49x-platform.patch | 85 - .../patches-3.18/310-ac49x-prom-support.patch | 20 - .../320-ac49x-mtd-partitions.patch | 35 - .../linux/ar7/patches-3.18/920-ar7part.patch | 118 - .../ar7/patches-3.18/925-actiontec_leds.patch | 95 - .../ar7/patches-3.18/950-cpmac_titan.patch | 52 - .../ar71xx/base-files/etc/board.d/01_leds | 50 +- .../ar71xx/base-files/etc/board.d/02_network | 40 +- target/linux/ar71xx/base-files/etc/diag.sh | 18 +- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 7 +- .../etc/hotplug.d/firmware/11-ath10k-caldata | 15 +- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 3 - .../ar71xx/base-files/etc/init.d/ar71xx_clock | 12 - target/linux/ar71xx/base-files/lib/ar71xx.sh | 59 +- .../lib/preinit/05_set_iface_mac_ar71xx | 4 - .../lib/preinit/05_set_preinit_iface_ar71xx | 2 - .../ar71xx/base-files/lib/upgrade/platform.sh | 42 +- target/linux/ar71xx/config-4.14 | 481 - target/linux/ar71xx/config-4.9 | 8 +- .../arch/mips/ath79/Kconfig.openwrt | 2399 ---- .../files-4.14/arch/mips/ath79/dev-eth.c | 1248 -- .../files-4.14/arch/mips/ath79/mach-a60.c | 183 - .../arch/mips/ath79/mach-alfa-ap120c.c | 148 - .../files-4.14/arch/mips/ath79/mach-ap132.c | 190 - .../files-4.14/arch/mips/ath79/mach-ap152.c | 141 - .../arch/mips/ath79/mach-archer-c7.c | 303 - .../arch/mips/ath79/mach-bhr-4grv2.c | 172 - .../files-4.14/arch/mips/ath79/mach-c60.c | 261 - .../arch/mips/ath79/mach-cf-e316n-v2.c | 768 -- .../files-4.14/arch/mips/ath79/mach-cpe510.c | 184 - .../files-4.14/arch/mips/ath79/mach-cr5000.c | 177 - .../arch/mips/ath79/mach-dap-2695-a1.c | 192 - .../arch/mips/ath79/mach-dgl-5500-a1.c | 151 - .../arch/mips/ath79/mach-dhp-1565-a1.c | 171 - .../arch/mips/ath79/mach-dir-825-c1.c | 242 - .../arch/mips/ath79/mach-dir-869-a1.c | 176 - .../arch/mips/ath79/mach-dlan-pro-1200-ac.c | 191 - .../arch/mips/ath79/mach-dlan-pro-500-wp.c | 204 - .../arch/mips/ath79/mach-domywifi-dw33d.c | 188 - .../files-4.14/arch/mips/ath79/mach-dr344.c | 225 - .../arch/mips/ath79/mach-e1700ac-v2.c | 146 - .../files-4.14/arch/mips/ath79/mach-epg5000.c | 178 - .../files-4.14/arch/mips/ath79/mach-esr1750.c | 177 - .../files-4.14/arch/mips/ath79/mach-esr900.c | 201 - .../arch/mips/ath79/mach-f9k1115v2.c | 190 - .../arch/mips/ath79/mach-gl-ar750s.c | 194 - .../files-4.14/arch/mips/ath79/mach-jwap230.c | 159 - .../files-4.14/arch/mips/ath79/mach-k2t.c | 135 - .../files-4.14/arch/mips/ath79/mach-koala.c | 162 - .../files-4.14/arch/mips/ath79/mach-mr1750.c | 172 - .../files-4.14/arch/mips/ath79/mach-mr900.c | 182 - .../arch/mips/ath79/mach-mynet-n750.c | 227 - .../arch/mips/ath79/mach-mynet-rext.c | 209 - .../files-4.14/arch/mips/ath79/mach-nbg6716.c | 381 - .../files-4.14/arch/mips/ath79/mach-om5p.c | 219 - .../files-4.14/arch/mips/ath79/mach-om5pac.c | 195 - .../arch/mips/ath79/mach-om5pacv2.c | 223 - .../arch/mips/ath79/mach-rambutan.c | 92 - .../files-4.14/arch/mips/ath79/mach-rb2011.c | 398 - .../files-4.14/arch/mips/ath79/mach-rb750.c | 350 - .../files-4.14/arch/mips/ath79/mach-rb91x.c | 344 - .../files-4.14/arch/mips/ath79/mach-rb922.c | 306 - .../files-4.14/arch/mips/ath79/mach-rb95x.c | 321 - .../files-4.14/arch/mips/ath79/mach-rbspi.c | 1125 -- .../files-4.14/arch/mips/ath79/mach-sc1750.c | 146 - .../files-4.14/arch/mips/ath79/mach-sc300m.c | 133 - .../files-4.14/arch/mips/ath79/mach-sc450.c | 150 - .../files-4.14/arch/mips/ath79/mach-sr3200.c | 188 - .../arch/mips/ath79/mach-tew-823dru.c | 182 - .../arch/mips/ath79/mach-tl-wdr4300.c | 207 - .../arch/mips/ath79/mach-tl-wpa8630.c | 173 - .../arch/mips/ath79/mach-tl-wr1041n-v2.c | 158 - .../arch/mips/ath79/mach-tl-wr1043nd-v2.c | 216 - .../arch/mips/ath79/mach-tl-wr1043nd-v4.c | 273 - .../arch/mips/ath79/mach-ubnt-unifiac.c | 180 - .../files-4.14/arch/mips/ath79/mach-ubnt-xm.c | 781 -- .../files-4.14/arch/mips/ath79/mach-wlr8100.c | 196 - .../arch/mips/ath79/mach-wndr4300.c | 211 - .../files-4.14/arch/mips/ath79/mach-wpj342.c | 179 - .../files-4.14/arch/mips/ath79/mach-wpj344.c | 170 - .../files-4.14/arch/mips/ath79/mach-wpj558.c | 171 - .../files-4.14/arch/mips/ath79/mach-wpj563.c | 151 - .../arch/mips/ath79/mach-wzr-450hp2.c | 222 - .../files-4.14/arch/mips/ath79/mach-z1.c | 165 - .../files-4.14/drivers/mtd/nand/ar934x_nfc.c | 1587 --- .../files-4.14/drivers/mtd/nand/rb4xx_nand.c | 392 - .../files-4.14/drivers/mtd/nand/rb750_nand.c | 436 - .../files-4.14/drivers/mtd/nand/rb91x_nand.c | 460 - .../files-4.14/drivers/mtd/tplinkpart.c | 234 - .../files-4.14/drivers/net/dsa/mv88e6063.c | 307 - .../ar71xx/files-4.9/arch/mips/ath79/Makefile | 287 - .../files-4.9/arch/mips/ath79/dev-ap9x-pci.c | 173 - .../files-4.9/arch/mips/ath79/dev-ap9x-pci.h | 55 - .../files-4.9/arch/mips/ath79/dev-dsa.c | 36 - .../files-4.9/arch/mips/ath79/dev-dsa.h | 21 - .../files-4.9/arch/mips/ath79/dev-eth.h | 55 - .../files-4.9/arch/mips/ath79/dev-m25p80.c | 101 - .../files-4.9/arch/mips/ath79/dev-m25p80.h | 17 - .../files-4.9/arch/mips/ath79/dev-nfc.c | 141 - .../files-4.9/arch/mips/ath79/dev-nfc.h | 34 - .../files-4.9/arch/mips/ath79/mach-ac9531.c | 126 - .../arch/mips/ath79/mach-alfa-ap96.c | 132 - .../files-4.9/arch/mips/ath79/mach-alfa-nx.c | 113 - .../files-4.9/arch/mips/ath79/mach-all0258n.c | 88 - .../files-4.9/arch/mips/ath79/mach-all0315n.c | 85 - .../arch/mips/ath79/mach-antminer-s1.c | 98 - .../arch/mips/ath79/mach-antminer-s3.c | 103 - .../arch/mips/ath79/mach-antrouter-r1.c | 98 - .../files-4.9/arch/mips/ath79/mach-ap121f.c | 103 - .../files-4.9/arch/mips/ath79/mach-ap143.c | 142 - .../files-4.9/arch/mips/ath79/mach-ap147.c | 125 - .../files-4.9/arch/mips/ath79/mach-ap531b0.c | 112 - .../files-4.9/arch/mips/ath79/mach-ap90q.c | 201 - .../files-4.9/arch/mips/ath79/mach-ap91-5g.c | 118 - .../files-4.9/arch/mips/ath79/mach-ap96.c | 142 - .../arch/mips/ath79/mach-archer-c25-v1.c | 227 - .../arch/mips/ath79/mach-archer-c59-v1.c | 289 - .../arch/mips/ath79/mach-archer-c60-v1.c | 225 - .../arch/mips/ath79/mach-arduino-yun.c | 157 - .../files-4.9/arch/mips/ath79/mach-aw-nr580.c | 107 - .../arch/mips/ath79/mach-bhu-bxu2000n2-a.c | 120 - .../files-4.9/arch/mips/ath79/mach-bsb.c | 83 - .../files-4.9/arch/mips/ath79/mach-c55.c | 132 - .../files-4.9/arch/mips/ath79/mach-cap324.c | 133 - .../arch/mips/ath79/mach-cap4200ag.c | 131 - .../arch/mips/ath79/mach-carambola2.c | 105 - .../files-4.9/arch/mips/ath79/mach-cpe870.c | 152 - .../files-4.9/arch/mips/ath79/mach-cr3000.c | 161 - .../arch/mips/ath79/mach-dap-1330-a1.c | 146 - .../arch/mips/ath79/mach-dir-505-a1.c | 116 - .../arch/mips/ath79/mach-dir-600-a1.c | 162 - .../arch/mips/ath79/mach-dir-615-c1.c | 135 - .../arch/mips/ath79/mach-dir-615-i1.c | 133 - .../arch/mips/ath79/mach-dir-825-b1.c | 191 - .../arch/mips/ath79/mach-dlan-hotspot.c | 117 - .../files-4.9/arch/mips/ath79/mach-dr531.c | 155 - .../files-4.9/arch/mips/ath79/mach-dragino2.c | 136 - .../files-4.9/arch/mips/ath79/mach-e2100l.c | 126 - .../files-4.9/arch/mips/ath79/mach-e600g-v2.c | 184 - .../files-4.9/arch/mips/ath79/mach-eap120.c | 126 - .../files-4.9/arch/mips/ath79/mach-eap300v2.c | 101 - .../files-4.9/arch/mips/ath79/mach-eap7660d.c | 181 - .../files-4.9/arch/mips/ath79/mach-el-m150.c | 112 - .../files-4.9/arch/mips/ath79/mach-el-mini.c | 86 - .../arch/mips/ath79/mach-ens202ext.c | 124 - .../files-4.9/arch/mips/ath79/mach-ew-balin.c | 110 - .../files-4.9/arch/mips/ath79/mach-ew-dorin.c | 138 - .../arch/mips/ath79/mach-fritz300e.c | 132 - .../arch/mips/ath79/mach-fritz4020.c | 242 - .../files-4.9/arch/mips/ath79/mach-gl-ar150.c | 125 - .../files-4.9/arch/mips/ath79/mach-gl-ar300.c | 103 - .../arch/mips/ath79/mach-gl-ar300m.c | 165 - .../files-4.9/arch/mips/ath79/mach-gl-ar750.c | 146 - .../arch/mips/ath79/mach-gl-ar750s.c | 193 - .../arch/mips/ath79/mach-gl-domino.c | 136 - .../files-4.9/arch/mips/ath79/mach-gl-inet.c | 104 - .../files-4.9/arch/mips/ath79/mach-gl-mifi.c | 114 - .../arch/mips/ath79/mach-gl-usb150.c | 87 - .../arch/mips/ath79/mach-gs-oolite-v1.c | 143 - .../arch/mips/ath79/mach-gs-oolite-v5-2.c | 111 - .../arch/mips/ath79/mach-hiveap-121.c | 153 - .../arch/mips/ath79/mach-hiwifi-hc6361.c | 115 - .../arch/mips/ath79/mach-hornet-ub.c | 142 - .../files-4.9/arch/mips/ath79/mach-ja76pf.c | 190 - .../files-4.9/arch/mips/ath79/mach-jwap003.c | 95 - .../files-4.9/arch/mips/ath79/mach-k2t.c | 136 - .../arch/mips/ath79/mach-lan-turtle.c | 178 - .../files-4.9/arch/mips/ath79/mach-lima.c | 86 - .../arch/mips/ath79/mach-mc-mac1200r.c | 155 - .../files-4.9/arch/mips/ath79/mach-mr12.c | 114 - .../files-4.9/arch/mips/ath79/mach-mr16.c | 118 - .../files-4.9/arch/mips/ath79/mach-mr18.c | 286 - .../files-4.9/arch/mips/ath79/mach-mr600.c | 177 - .../arch/mips/ath79/mach-mynet-n600.c | 202 - .../arch/mips/ath79/mach-mzk-w04nu.c | 124 - .../arch/mips/ath79/mach-mzk-w300nh.c | 115 - .../files-4.9/arch/mips/ath79/mach-n5q.c | 132 - .../files-4.9/arch/mips/ath79/mach-nbg460n.c | 220 - .../files-4.9/arch/mips/ath79/mach-om2p.c | 320 - .../files-4.9/arch/mips/ath79/mach-omy-g1.c | 123 - .../files-4.9/arch/mips/ath79/mach-omy-x1.c | 106 - .../arch/mips/ath79/mach-onion-omega.c | 84 - .../files-4.9/arch/mips/ath79/mach-pb42.c | 83 - .../arch/mips/ath79/mach-pqi-air-pen.c | 99 - .../arch/mips/ath79/mach-qihoo-c301.c | 166 - .../files-4.9/arch/mips/ath79/mach-r36a.c | 140 - .../files-4.9/arch/mips/ath79/mach-r602n.c | 213 - .../files-4.9/arch/mips/ath79/mach-r6100.c | 146 - .../files-4.9/arch/mips/ath79/mach-rb4xx.c | 465 - .../arch/mips/ath79/mach-rbsxtlite.c | 297 - .../files-4.9/arch/mips/ath79/mach-re450.c | 239 - .../arch/mips/ath79/mach-rme-eg200.c | 99 - .../files-4.9/arch/mips/ath79/mach-rut9xx.c | 191 - .../files-4.9/arch/mips/ath79/mach-rw2458n.c | 91 - .../arch/mips/ath79/mach-smart-300.c | 135 - .../files-4.9/arch/mips/ath79/mach-som9331.c | 125 - .../files-4.9/arch/mips/ath79/mach-t830.c | 127 - .../mips/ath79/mach-tellstick-znet-lite.c | 129 - .../arch/mips/ath79/mach-tew-632brp.c | 111 - .../arch/mips/ath79/mach-tew-673gru.c | 198 - .../arch/mips/ath79/mach-tew-712br.c | 153 - .../arch/mips/ath79/mach-tew-732br.c | 127 - .../files-4.9/arch/mips/ath79/mach-tl-mr11u.c | 183 - .../files-4.9/arch/mips/ath79/mach-tl-mr13u.c | 107 - .../arch/mips/ath79/mach-tl-mr3020.c | 126 - .../arch/mips/ath79/mach-tl-mr3x20.c | 147 - .../arch/mips/ath79/mach-tl-mr6400.c | 151 - .../arch/mips/ath79/mach-tl-wa701nd-v2.c | 116 - .../arch/mips/ath79/mach-tl-wa7210n-v2.c | 125 - .../arch/mips/ath79/mach-tl-wa801nd-v3.c | 136 - .../arch/mips/ath79/mach-tl-wa830re-v2.c | 132 - .../arch/mips/ath79/mach-tl-wa901nd-v2.c | 104 - .../arch/mips/ath79/mach-tl-wa901nd-v4.c | 115 - .../arch/mips/ath79/mach-tl-wa901nd.c | 127 - .../arch/mips/ath79/mach-tl-wax50re.c | 445 - .../arch/mips/ath79/mach-tl-wdr3320-v2.c | 146 - .../arch/mips/ath79/mach-tl-wdr3500.c | 169 - .../arch/mips/ath79/mach-tl-wdr6500-v2.c | 142 - .../arch/mips/ath79/mach-tl-wdx6501-v7.c | 138 - .../arch/mips/ath79/mach-tl-wr1043nd.c | 141 - .../arch/mips/ath79/mach-tl-wr2543n.c | 150 - .../arch/mips/ath79/mach-tl-wr703n.c | 118 - .../arch/mips/ath79/mach-tl-wr720n-v3.c | 108 - .../arch/mips/ath79/mach-tl-wr741nd-v4.c | 187 - .../arch/mips/ath79/mach-tl-wr741nd.c | 130 - .../arch/mips/ath79/mach-tl-wr802n.c | 117 - .../arch/mips/ath79/mach-tl-wr810n.c | 149 - .../arch/mips/ath79/mach-tl-wr841n-v8.c | 286 - .../arch/mips/ath79/mach-tl-wr841n-v9.c | 457 - .../arch/mips/ath79/mach-tl-wr841n.c | 140 - .../arch/mips/ath79/mach-tl-wr902ac-v1.c | 145 - .../arch/mips/ath79/mach-tl-wr940n-v4.c | 184 - .../arch/mips/ath79/mach-tl-wr941nd-v6.c | 149 - .../arch/mips/ath79/mach-tl-wr941nd.c | 121 - .../arch/mips/ath79/mach-tl-wr942n-v1.c | 279 - .../files-4.9/arch/mips/ath79/mach-ts-d084.c | 86 - .../files-4.9/arch/mips/ath79/mach-tube2h.c | 129 - .../files-4.9/arch/mips/ath79/mach-ubnt.c | 205 - .../files-4.9/arch/mips/ath79/mach-wam250.c | 122 - .../files-4.9/arch/mips/ath79/mach-weio.c | 140 - .../arch/mips/ath79/mach-whr-hp-g300n.c | 155 - .../arch/mips/ath79/mach-wi2a-ac200i.c | 217 - .../mips/ath79/mach-wifi-pineapple-nano.c | 107 - .../arch/mips/ath79/mach-wlae-ag300n.c | 114 - .../files-4.9/arch/mips/ath79/mach-wndap360.c | 105 - .../files-4.9/arch/mips/ath79/mach-wndr3700.c | 172 - .../arch/mips/ath79/mach-wnr2000-v3.c | 637 - .../arch/mips/ath79/mach-wnr2000-v4.c | 214 - .../files-4.9/arch/mips/ath79/mach-wnr2000.c | 102 - .../files-4.9/arch/mips/ath79/mach-wnr2200.c | 245 - .../files-4.9/arch/mips/ath79/mach-wp543.c | 109 - .../files-4.9/arch/mips/ath79/mach-wpe72.c | 97 - .../files-4.9/arch/mips/ath79/mach-wpj531.c | 143 - .../files-4.9/arch/mips/ath79/mach-wrt160nl.c | 126 - .../files-4.9/arch/mips/ath79/mach-wrt400n.c | 161 - .../arch/mips/ath79/mach-wrtnode2q.c | 126 - .../arch/mips/ath79/mach-wzr-hp-ag300h.c | 202 - .../arch/mips/ath79/mach-wzr-hp-g300nh.c | 279 - .../arch/mips/ath79/mach-wzr-hp-g300nh2.c | 174 - .../arch/mips/ath79/mach-wzr-hp-g450h.c | 169 - .../arch/mips/ath79/mach-zbt-we1526.c | 153 - .../arch/mips/ath79/mach-zcn-1523h.c | 154 - .../files-4.9/arch/mips/ath79/machtypes.h | 378 - .../ar71xx/files-4.9/arch/mips/ath79/nvram.c | 85 - .../ar71xx/files-4.9/arch/mips/ath79/nvram.h | 19 - .../arch/mips/ath79/pci-ath9k-fixup.c | 126 - .../arch/mips/ath79/pci-ath9k-fixup.h | 6 - .../files-4.9/arch/mips/ath79/routerboot.c | 358 - .../files-4.9/arch/mips/ath79/routerboot.h | 89 - .../mips/include/asm/fw/myloader/myloader.h | 34 - .../include/asm/mach-ath79/ag71xx_platform.h | 64 - .../mips/include/asm/mach-ath79/mach-rb750.h | 84 - .../mips/include/asm/mach-ath79/rb4xx_cpld.h | 43 - .../files-4.9/drivers/gpio/gpio-latch.c | 220 - .../files-4.9/drivers/gpio/gpio-nxp-74hc153.c | 243 - .../files-4.9/drivers/leds/leds-nu801.c | 396 - .../files-4.9/drivers/leds/leds-rb750.c | 144 - .../drivers/leds/leds-wndr3700-usb.c | 76 - .../files-4.9/drivers/mtd/cybertan_part.c | 206 - .../net/ethernet/atheros/ag71xx/Kconfig | 33 - .../net/ethernet/atheros/ag71xx/Makefile | 15 - .../net/ethernet/atheros/ag71xx/ag71xx.h | 506 - .../ethernet/atheros/ag71xx/ag71xx_ar7240.c | 1382 -- .../ethernet/atheros/ag71xx/ag71xx_ar8216.c | 44 - .../ethernet/atheros/ag71xx/ag71xx_debugfs.c | 285 - .../ethernet/atheros/ag71xx/ag71xx_ethtool.c | 131 - .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 1479 --- .../net/ethernet/atheros/ag71xx/ag71xx_mdio.c | 320 - .../net/ethernet/atheros/ag71xx/ag71xx_phy.c | 261 - .../files-4.9/drivers/spi/spi-rb4xx-cpld.c | 347 - .../ar71xx/files-4.9/drivers/spi/spi-rb4xx.c | 430 - .../files-4.9/drivers/spi/spi-vsc7385.c | 621 - .../files-4.9/include/linux/leds-nu801.h | 38 - .../files-4.9/include/linux/nxp_74hc153.h | 24 - .../include/linux/platform/ar934x_nfc.h | 39 - .../include/linux/platform_data/gpio-latch.h | 14 - .../include/linux/platform_data/rb91x_nand.h | 16 - .../files-4.9/include/linux/spi/vsc7385.h | 19 - .../arch/mips/ath79/Kconfig.openwrt | 85 +- .../arch/mips/ath79/Makefile | 8 +- .../arch/mips/ath79/dev-ap9x-pci.c | 0 .../arch/mips/ath79/dev-ap9x-pci.h | 0 .../arch/mips/ath79/dev-dsa.c | 0 .../arch/mips/ath79/dev-dsa.h | 0 .../arch/mips/ath79/dev-eth.c | 20 +- .../arch/mips/ath79/dev-eth.h | 0 .../arch/mips/ath79/dev-m25p80.c | 0 .../arch/mips/ath79/dev-m25p80.h | 0 .../arch/mips/ath79/dev-nfc.c | 0 .../arch/mips/ath79/dev-nfc.h | 0 .../arch/mips/ath79/mach-a60.c | 0 .../arch/mips/ath79/mach-alfa-ap120c.c | 0 .../arch/mips/ath79/mach-alfa-ap96.c | 0 .../arch/mips/ath79/mach-alfa-nx.c | 0 .../arch/mips/ath79/mach-all0258n.c | 0 .../arch/mips/ath79/mach-all0315n.c | 0 .../arch/mips/ath79/mach-antminer-s1.c | 0 .../arch/mips/ath79/mach-antminer-s3.c | 0 .../arch/mips/ath79/mach-antrouter-r1.c | 0 .../arch/mips/ath79/mach-ap121f.c | 0 .../arch/mips/ath79/mach-ap132.c | 0 .../arch/mips/ath79/mach-ap143.c | 0 .../arch/mips/ath79/mach-ap147.c | 0 .../arch/mips/ath79/mach-ap152.c | 0 .../arch/mips/ath79/mach-ap531b0.c | 0 .../arch/mips/ath79/mach-ap90q.c | 0 .../arch/mips/ath79/mach-ap91-5g.c | 0 .../arch/mips/ath79/mach-ap96.c | 0 .../arch/mips/ath79/mach-archer-c25-v1.c | 0 .../arch/mips/ath79/mach-archer-c59-v1.c | 0 .../arch/mips/ath79/mach-archer-c60-v1.c | 0 .../arch/mips/ath79/mach-archer-c7-v4.c | 0 .../arch/mips/ath79/mach-archer-c7-v5.c} | 148 +- .../arch/mips/ath79/mach-archer-c7.c | 0 .../arch/mips/ath79/mach-arduino-yun.c | 0 .../arch/mips/ath79/mach-aw-nr580.c | 0 .../arch/mips/ath79/mach-bhr-4grv2.c | 0 .../arch/mips/ath79/mach-bhu-bxu2000n2-a.c | 0 .../arch/mips/ath79/mach-bsb.c | 0 .../arch/mips/ath79/mach-c55.c | 0 .../arch/mips/ath79/mach-c60.c | 0 .../arch/mips/ath79/mach-cap324.c | 0 .../arch/mips/ath79/mach-cap4200ag.c | 0 .../arch/mips/ath79/mach-carambola2.c | 0 .../arch/mips/ath79/mach-cf-e316n-v2.c | 0 .../arch/mips/ath79/mach-cpe510.c | 64 +- .../arch/mips/ath79/mach-cpe870.c | 0 .../arch/mips/ath79/mach-cr3000.c | 0 .../arch/mips/ath79/mach-cr5000.c | 0 .../arch/mips/ath79/mach-dap-1330-a1.c | 0 .../arch/mips/ath79/mach-dap-2695-a1.c | 0 .../arch/mips/ath79/mach-dgl-5500-a1.c | 0 .../arch/mips/ath79/mach-dhp-1565-a1.c | 0 .../arch/mips/ath79/mach-dir-505-a1.c | 0 .../arch/mips/ath79/mach-dir-600-a1.c | 0 .../arch/mips/ath79/mach-dir-615-c1.c | 0 .../arch/mips/ath79/mach-dir-615-i1.c | 0 .../arch/mips/ath79/mach-dir-825-b1.c | 0 .../arch/mips/ath79/mach-dir-825-c1.c | 0 .../arch/mips/ath79/mach-dir-869-a1.c | 0 .../arch/mips/ath79/mach-dlan-hotspot.c | 0 .../arch/mips/ath79/mach-dlan-pro-1200-ac.c | 0 .../arch/mips/ath79/mach-dlan-pro-500-wp.c | 0 .../arch/mips/ath79/mach-domywifi-dw33d.c | 0 .../arch/mips/ath79/mach-dr344.c | 0 .../arch/mips/ath79/mach-dr531.c | 0 .../arch/mips/ath79/mach-dragino2.c | 0 .../arch/mips/ath79/mach-e1700ac-v2.c | 0 .../arch/mips/ath79/mach-e2100l.c | 0 .../files/arch/mips/ath79/mach-e558-v2.c | 170 + .../arch/mips/ath79/mach-e600g-v2.c | 0 .../files/arch/mips/ath79/mach-e750a-v4.c | 122 + .../files/arch/mips/ath79/mach-e750g-v8.c | 151 + .../arch/mips/ath79/mach-eap120.c | 0 .../arch/mips/ath79/mach-eap300v2.c | 0 .../arch/mips/ath79/mach-eap7660d.c | 0 .../arch/mips/ath79/mach-el-m150.c | 0 .../arch/mips/ath79/mach-el-mini.c | 0 .../arch/mips/ath79/mach-ens202ext.c | 0 .../arch/mips/ath79/mach-epg5000.c | 0 .../arch/mips/ath79/mach-esr1750.c | 0 .../arch/mips/ath79/mach-esr900.c | 0 .../arch/mips/ath79/mach-ew-balin.c | 0 .../arch/mips/ath79/mach-ew-dorin.c | 0 .../arch/mips/ath79/mach-f9k1115v2.c | 0 .../arch/mips/ath79/mach-fritz300e.c | 0 .../arch/mips/ath79/mach-fritz4020.c | 0 .../files/arch/mips/ath79/mach-fritz450e.c | 177 + .../arch/mips/ath79/mach-gl-ar150.c | 0 .../arch/mips/ath79/mach-gl-ar300.c | 0 .../arch/mips/ath79/mach-gl-ar300m.c | 0 .../arch/mips/ath79/mach-gl-ar750.c | 0 .../arch/mips/ath79/mach-gl-domino.c | 0 .../arch/mips/ath79/mach-gl-inet.c | 0 .../arch/mips/ath79/mach-gl-mifi.c | 0 .../arch/mips/ath79/mach-gl-usb150.c | 0 .../arch/mips/ath79/mach-gs-oolite-v1.c | 0 .../arch/mips/ath79/mach-gs-oolite-v5-2.c | 0 .../arch/mips/ath79/mach-hiveap-121.c | 0 .../arch/mips/ath79/mach-hiwifi-hc6361.c | 0 .../arch/mips/ath79/mach-hornet-ub.c | 0 .../arch/mips/ath79/mach-ja76pf.c | 0 .../arch/mips/ath79/mach-jwap003.c | 0 .../arch/mips/ath79/mach-jwap230.c | 0 .../arch/mips/ath79/mach-koala.c | 0 .../arch/mips/ath79/mach-lan-turtle.c | 0 .../arch/mips/ath79/mach-lima.c | 0 .../arch/mips/ath79/mach-mc-mac1200r.c | 0 .../arch/mips/ath79/mach-mr12.c | 0 .../arch/mips/ath79/mach-mr16.c | 0 .../arch/mips/ath79/mach-mr1750.c | 0 .../arch/mips/ath79/mach-mr18.c | 0 .../arch/mips/ath79/mach-mr600.c | 0 .../arch/mips/ath79/mach-mr900.c | 0 .../arch/mips/ath79/mach-mynet-n600.c | 0 .../arch/mips/ath79/mach-mynet-n750.c | 0 .../arch/mips/ath79/mach-mynet-rext.c | 0 .../arch/mips/ath79/mach-mzk-w04nu.c | 0 .../arch/mips/ath79/mach-mzk-w300nh.c | 0 .../arch/mips/ath79/mach-n5q.c | 0 .../arch/mips/ath79/mach-nbg460n.c | 0 .../arch/mips/ath79/mach-nbg6716.c | 0 .../arch/mips/ath79/mach-om2p.c | 0 .../arch/mips/ath79/mach-om5p.c | 0 .../arch/mips/ath79/mach-om5pac.c | 0 .../arch/mips/ath79/mach-om5pacv2.c | 0 .../arch/mips/ath79/mach-omy-g1.c | 0 .../arch/mips/ath79/mach-omy-x1.c | 0 .../arch/mips/ath79/mach-onion-omega.c | 0 .../arch/mips/ath79/mach-pb42.c | 0 .../arch/mips/ath79/mach-pqi-air-pen.c | 0 .../arch/mips/ath79/mach-qihoo-c301.c | 0 .../arch/mips/ath79/mach-r36a.c | 0 .../arch/mips/ath79/mach-r602n.c | 0 .../arch/mips/ath79/mach-r6100.c | 0 .../arch/mips/ath79/mach-rambutan.c | 0 .../arch/mips/ath79/mach-rb2011.c | 0 .../arch/mips/ath79/mach-rb4xx.c | 0 .../arch/mips/ath79/mach-rb750.c | 0 .../arch/mips/ath79/mach-rb91x.c | 0 .../arch/mips/ath79/mach-rb922.c | 0 .../arch/mips/ath79/mach-rb95x.c | 0 .../arch/mips/ath79/mach-rbspi.c | 17 +- .../arch/mips/ath79/mach-rbsxtlite.c | 0 .../arch/mips/ath79/mach-re450.c | 0 .../arch/mips/ath79/mach-rme-eg200.c | 0 .../arch/mips/ath79/mach-rut9xx.c | 0 .../arch/mips/ath79/mach-rw2458n.c | 0 .../arch/mips/ath79/mach-sc1750.c | 0 .../arch/mips/ath79/mach-sc300m.c | 0 .../arch/mips/ath79/mach-sc450.c | 0 .../arch/mips/ath79/mach-smart-300.c | 0 .../arch/mips/ath79/mach-som9331.c | 0 .../arch/mips/ath79/mach-sr3200.c | 0 .../arch/mips/ath79/mach-t830.c | 0 .../mips/ath79/mach-tellstick-znet-lite.c | 0 .../arch/mips/ath79/mach-tew-632brp.c | 0 .../arch/mips/ath79/mach-tew-673gru.c | 0 .../arch/mips/ath79/mach-tew-712br.c | 0 .../arch/mips/ath79/mach-tew-732br.c | 0 .../arch/mips/ath79/mach-tew-823dru.c | 0 .../arch/mips/ath79/mach-tl-mr11u.c | 0 .../arch/mips/ath79/mach-tl-mr13u.c | 0 .../arch/mips/ath79/mach-tl-mr3020.c | 0 .../arch/mips/ath79/mach-tl-mr3x20.c | 0 .../arch/mips/ath79/mach-tl-mr6400.c | 0 .../arch/mips/ath79/mach-tl-wa701nd-v2.c | 0 .../arch/mips/ath79/mach-tl-wa7210n-v2.c | 0 .../arch/mips/ath79/mach-tl-wa801nd-v3.c | 0 .../arch/mips/ath79/mach-tl-wa830re-v2.c | 0 .../arch/mips/ath79/mach-tl-wa901nd-v2.c | 0 .../arch/mips/ath79/mach-tl-wa901nd-v4.c | 0 .../arch/mips/ath79/mach-tl-wa901nd.c | 0 .../arch/mips/ath79/mach-tl-wax50re.c | 0 .../arch/mips/ath79/mach-tl-wdr3320-v2.c | 0 .../arch/mips/ath79/mach-tl-wdr3500.c | 0 .../arch/mips/ath79/mach-tl-wdr4300.c | 0 .../arch/mips/ath79/mach-tl-wdr6500-v2.c | 0 .../arch/mips/ath79/mach-tl-wpa8630.c | 0 .../arch/mips/ath79/mach-tl-wr1041n-v2.c | 0 .../arch/mips/ath79/mach-tl-wr1043nd-v2.c | 0 .../arch/mips/ath79/mach-tl-wr1043nd-v4.c | 0 .../arch/mips/ath79/mach-tl-wr1043nd.c | 4 +- .../arch/mips/ath79/mach-tl-wr2543n.c | 0 .../arch/mips/ath79/mach-tl-wr703n.c | 0 .../arch/mips/ath79/mach-tl-wr720n-v3.c | 0 .../arch/mips/ath79/mach-tl-wr741nd-v4.c | 0 .../arch/mips/ath79/mach-tl-wr741nd.c | 0 .../arch/mips/ath79/mach-tl-wr802n.c | 0 .../arch/mips/ath79/mach-tl-wr810n.c | 0 .../arch/mips/ath79/mach-tl-wr841n-v8.c | 0 .../arch/mips/ath79/mach-tl-wr841n-v9.c | 0 .../arch/mips/ath79/mach-tl-wr841n.c | 0 .../arch/mips/ath79/mach-tl-wr902ac-v1.c | 0 .../arch/mips/ath79/mach-tl-wr940n-v4.c | 0 .../arch/mips/ath79/mach-tl-wr941nd-v6.c | 0 .../arch/mips/ath79/mach-tl-wr941nd.c | 0 .../arch/mips/ath79/mach-tl-wr942n-v1.c | 0 .../arch/mips/ath79/mach-ts-d084.c | 0 .../arch/mips/ath79/mach-tube2h.c | 0 .../arch/mips/ath79/mach-ubnt-unifiac.c | 0 .../arch/mips/ath79/mach-ubnt-xm.c | 0 .../arch/mips/ath79/mach-ubnt.c | 0 .../arch/mips/ath79/mach-wam250.c | 0 .../arch/mips/ath79/mach-weio.c | 0 .../arch/mips/ath79/mach-whr-hp-g300n.c | 0 .../arch/mips/ath79/mach-wi2a-ac200i.c | 0 .../mips/ath79/mach-wifi-pineapple-nano.c | 0 .../arch/mips/ath79/mach-wlae-ag300n.c | 0 .../arch/mips/ath79/mach-wlr8100.c | 0 .../arch/mips/ath79/mach-wndap360.c | 0 .../arch/mips/ath79/mach-wndr3700.c | 0 .../arch/mips/ath79/mach-wndr4300.c | 0 .../arch/mips/ath79/mach-wnr2000-v3.c | 0 .../arch/mips/ath79/mach-wnr2000-v4.c | 0 .../arch/mips/ath79/mach-wnr2000.c | 0 .../arch/mips/ath79/mach-wnr2200.c | 0 .../arch/mips/ath79/mach-wp543.c | 0 .../arch/mips/ath79/mach-wpe72.c | 0 .../arch/mips/ath79/mach-wpj342.c | 0 .../arch/mips/ath79/mach-wpj344.c | 0 .../arch/mips/ath79/mach-wpj531.c | 0 .../arch/mips/ath79/mach-wpj558.c | 0 .../arch/mips/ath79/mach-wpj563.c | 0 .../arch/mips/ath79/mach-wrt160nl.c | 0 .../arch/mips/ath79/mach-wrt400n.c | 0 .../arch/mips/ath79/mach-wrtnode2q.c | 0 .../arch/mips/ath79/mach-wzr-450hp2.c | 0 .../arch/mips/ath79/mach-wzr-hp-ag300h.c | 0 .../arch/mips/ath79/mach-wzr-hp-g300nh.c | 0 .../arch/mips/ath79/mach-wzr-hp-g300nh2.c | 0 .../arch/mips/ath79/mach-wzr-hp-g450h.c | 0 .../arch/mips/ath79/mach-z1.c | 0 .../arch/mips/ath79/mach-zbt-we1526.c | 0 .../arch/mips/ath79/mach-zcn-1523h.c | 0 .../arch/mips/ath79/machtypes.h | 11 +- .../arch/mips/ath79/nvram.c | 0 .../arch/mips/ath79/nvram.h | 0 .../arch/mips/ath79/pci-ath9k-fixup.c | 0 .../arch/mips/ath79/pci-ath9k-fixup.h | 0 .../arch/mips/ath79/routerboot.c | 0 .../arch/mips/ath79/routerboot.h | 0 .../mips/include/asm/fw/myloader/myloader.h | 0 .../include/asm/mach-ath79/ag71xx_platform.h | 0 .../mips/include/asm/mach-ath79/mach-rb750.h | 0 .../mips/include/asm/mach-ath79/rb4xx_cpld.h | 0 .../drivers/gpio/gpio-latch.c | 0 .../drivers/gpio/gpio-nxp-74hc153.c | 0 .../drivers/leds/leds-nu801.c | 0 .../drivers/leds/leds-rb750.c | 0 .../drivers/leds/leds-wndr3700-usb.c | 0 .../drivers/mtd/cybertan_part.c | 0 .../drivers/mtd/nand/ar934x_nfc.c | 0 .../drivers/mtd/nand/rb4xx_nand.c | 0 .../drivers/mtd/nand/rb750_nand.c | 0 .../drivers/mtd/nand/rb91x_nand.c | 0 .../drivers/mtd/tplinkpart.c | 0 .../drivers/net/dsa/mv88e6063.c | 0 .../net/ethernet/atheros/ag71xx/Kconfig | 0 .../net/ethernet/atheros/ag71xx/Makefile | 0 .../net/ethernet/atheros/ag71xx/ag71xx.h | 0 .../ethernet/atheros/ag71xx/ag71xx_ar7240.c | 0 .../ethernet/atheros/ag71xx/ag71xx_ar8216.c | 0 .../ethernet/atheros/ag71xx/ag71xx_debugfs.c | 0 .../ethernet/atheros/ag71xx/ag71xx_ethtool.c | 0 .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 0 .../net/ethernet/atheros/ag71xx/ag71xx_mdio.c | 0 .../net/ethernet/atheros/ag71xx/ag71xx_phy.c | 0 .../drivers/spi/spi-rb4xx-cpld.c | 0 .../drivers/spi/spi-rb4xx.c | 0 .../drivers/spi/spi-vsc7385.c | 0 .../include/linux/leds-nu801.h | 0 .../include/linux/nxp_74hc153.h | 0 .../include/linux/platform/ar934x_nfc.h | 0 .../include/linux/platform_data/gpio-latch.h | 0 .../include/linux/platform_data/rb91x_nand.h | 0 .../include/linux/spi/vsc7385.h | 0 target/linux/ar71xx/generic/config-default | 8 +- .../ar71xx/image/generic-legacy-devices.mk | 16 +- target/linux/ar71xx/image/generic-tp-link.mk | 62 +- target/linux/ar71xx/image/generic.mk | 92 +- target/linux/ar71xx/image/legacy.mk | 3 - target/linux/ar71xx/image/mikrotik.mk | 2 +- target/linux/ar71xx/image/tiny-tp-link.mk | 108 +- .../ar71xx/patches-4.14/001-spi-cs-gpio.patch | 20 - .../002-add_back_gpio_function_select.patch | 92 - .../004-register_gpio_driver_earlier.patch | 18 - ...Avoid-using-unitialized-reg-variable.patch | 42 - ...egister-address-in-ath79_ddr_wb_flus.patch | 23 - ...200-MIPS-ath79-fix-ar933x-wmac-reset.patch | 30 - .../201-ar913x_wmac_external_reset.patch | 31 - .../202-MIPS-ath79-ar934x-wmac-revision.patch | 11 - .../203-MIPS-ath79-fix-restart.patch | 20 - .../220-add_cpu_feature_overrides.patch | 28 - ...0-MIPS-add-MIPS_MACHINE_NONAME-macro.patch | 21 - .../310-lib-add-rle-decompression.patch | 124 - .../401-mtd-physmap-add-lock-unlock.patch | 94 - .../402-mtd-SST39VF6401B-support.patch | 29 - ...mtd_fix_cfi_cmdset_0002_status_check.patch | 69 - .../404-mtd-cybertan-trx-parser.patch | 25 - .../405-mtd-tp-link-partition-parser.patch | 25 - ...o-pass-probe-types-via-platform-data.patch | 34 - .../408-mtd-redboot_partition_scan.patch | 44 - .../409-mtd-rb4xx_nand_driver.patch | 21 - .../410-mtd-rb750-nand-driver.patch | 21 - ...mtd-cfi_cmdset_0002-force-word-write.patch | 61 - .../413-mtd-ar934x-nand-driver.patch | 25 - .../414-mtd-rb91x-nand-driver.patch | 21 - .../420-net-ar71xx_mac_driver.patch | 28 - .../423-dsa-add-88e6063-driver.patch | 27 - .../430-drivers-link-spi-before-mtd.patch | 12 - .../432-spi-rb4xx-spi-driver.patch | 25 - .../433-spi-rb4xx-cpld-driver.patch | 26 - .../patches-4.14/435-spi-vsc7385_driver.patch | 24 - .../440-leds-wndr3700-usb-led-driver.patch | 26 - .../441-leds-rb750-led-driver.patch | 23 - ...to-use-OPEN_-DRAIN-SOURCE-flags-with.patch | 45 - ...50-gpio-nxp-74hc153-gpio-chip-driver.patch | 25 - ...x164-improve-platform-device-support.patch | 119 - .../452-gpio-add-gpio-latch-driver.patch | 22 - .../461-spi-ath79-add-fast-flash-read.patch | 60 - ...ath79-swizzle-pci-address-for-ar71xx.patch | 111 - ...490-usb-ehci-add-quirks-for-qca-socs.patch | 103 - .../patches-4.14/500-MIPS-fw-myloader.patch | 22 - ...-mac-argument-to-ath79_register_wmac.patch | 70 - ...IPS-ath79-add-ath79_device_reset_get.patch | 42 - ...ath79-add-ath79_gpio_function_select.patch | 39 - ...6-MIPS-ath79-prom-parse-redboot-args.patch | 42 - ...MIPS-ath79-prom-add-myloader-support.patch | 55 - ...S-ath79-prom-image-command-line-hack.patch | 73 - ...PS-ath79-process-board-kernel-option.patch | 11 - ...S-ath79-init-gpio-pin-of-wmac-device.patch | 14 - .../520-MIPS-ath79-enable-UART-function.patch | 18 - ...S-ath79-enable-UART-for-early_serial.patch | 61 - ...dd-ath79_wmac_register_simple-helper.patch | 21 - .../523-MIPS-ath79-OTP-support.patch | 192 - ...add-ath79_wmac_disable_25ghz-helpers.patch | 31 - ...525-MIPS-ath79-enable-qca-usb-quirks.patch | 101 - ...MIPS-ath79-add-more-register-defines.patch | 456 - .../602-MIPS-ath79-add-openwrt-stuff.patch | 49 - .../603-MIPS-ath79-ap121-fixes.patch | 149 - .../605-MIPS-ath79-db120-fixes.patch | 205 - .../606-MIPS-ath79-pb44-fixes.patch | 145 - .../607-MIPS-ath79-ubnt-xm-fixes.patch | 14 - ...8-MIPS-ath79-ubnt-xm-add-more-boards.patch | 20 - .../609-MIPS-ath79-ap136-fixes.patch | 301 - .../611-MIPS-ath79-wdt-timeout.patch | 25 - .../612-MIPS-ath79-set-buffalo-txgain.patch | 24 - ...ath79_wmac_setup_ext_lna_gpio-helper.patch | 76 - ...PS-ath79-add-support-for-QCA953x-SoC.patch | 696 - ...PS-ath79-add-support-for-QCA956x-SoC.patch | 717 - ...ore-register-defines-for-QCA956x-SoC.patch | 38 - ...0-MIPS-ath79-fix-chained-irq-disable.patch | 106 - ...1-MIPS-ath79-wmac-enable-set-led-pin.patch | 24 - ...MIPS-ath79-gpio-enable-set-direction.patch | 32 - ...40-MIPS-ath79-add-QCA955x-wmac-reset.patch | 82 - .../641-MIPS-ath79-ath9k-exports.patch | 26 - .../patches-4.14/642-MIPS-ath79-no-of.patch | 70 - .../700-MIPS-ath79-add-openwrt-Kconfig.patch | 11 - ...MIPS-ath79-add-routerboard-detection.patch | 34 - ...h79-fixup-routerboot-board-parameter.patch | 43 - ...d-gpio-func-register-for-QCA955x-SoC.patch | 38 - ...0-MIPS-ath79-add-PCI-for-QCA953x-SoC.patch | 44 - ...1-MIPS-ath79-add-PCI-for-QCA9556-SoC.patch | 12 - .../818-MIPS-ath79-add-nu801-led-driver.patch | 26 - ...-MIPS-ath79-add_gpio_function2_setup.patch | 67 - .../900-mdio_bitbang_ignore_ta_value.patch | 32 - ...-prevent-rescheduling-during-command.patch | 61 - .../902-at803x-add-reset-gpio-pdata.patch | 68 - .../910-unaligned_access_hacks.patch | 933 -- ...usb-chipidea-AR933x-platform-support.patch | 128 - ...ore-register-defines-for-QCA956x-SoC.patch | 194 - .../patches-4.14/930-chipidea-pullup.patch | 72 - .../patches-4.14/980-patch-switch-ext.patch | 32 - .../patches-4.14/999-ppp-function.patch | 379 - ...egister-address-in-ath79_ddr_wb_flus.patch | 23 - ...mtd_fix_cfi_cmdset_0002_status_check.patch | 69 - ...o-pass-probe-types-via-platform-data.patch | 4 +- ...mtd-cfi_cmdset_0002-force-word-write.patch | 8 +- .../patches-4.9/500-MIPS-fw-myloader.patch | 2 +- .../902-at803x-add-reset-gpio-pdata.patch | 8 +- .../910-unaligned_access_hacks.patch | 10 +- .../patches-4.9/940-m25p80-add-m25qh64a.patch | 12 - target/linux/arc770/generic/target.mk | 2 +- target/linux/archs38/config-4.14 | 7 - target/linux/armvirt/64/config-default | 3 + target/linux/at91/image/legacy.mk | 2 +- target/linux/ath25/Makefile | 2 +- .../linux/ath25/{config-4.9 => config-4.14} | 17 +- target/linux/ath25/image/Makefile | 4 +- .../107-ar5312_gpio.patch | 8 +- .../108-ar2315_gpio.patch | 8 +- .../110-ar2313_ethernet.patch | 10 +- .../120-spiflash.patch | 6 +- .../130-watchdog.patch | 4 +- .../140-redboot_boardconfig.patch | 0 .../141-redboot_partition_scan.patch | 0 .../142-redboot_various_erase_size_fix.patch | 0 .../210-reset_button.patch | 2 +- .../220-enet_micrel_workaround.patch | 0 .../330-board_leds.patch | 0 target/linux/ath79/Makefile | 19 - .../ath79/base-files/etc/board.d/01_leds | 39 - .../ath79/base-files/etc/board.d/02_network | 76 - target/linux/ath79/base-files/etc/diag.sh | 44 - .../etc/hotplug.d/firmware/10-ath9k-eeprom | 66 - .../etc/hotplug.d/firmware/11-ath10k-caldata | 58 - .../ath79/base-files/lib/upgrade/platform.sh | 20 - target/linux/ath79/dts/ar7100.dtsi | 204 - .../ath79/dts/ar7161_netgear_wndr3800.dts | 192 - target/linux/ath79/dts/ar7240.dtsi | 66 - .../linux/ath79/dts/ar7240_tl-wr740n-v2.dts | 174 - target/linux/ath79/dts/ar7241.dtsi | 78 - .../linux/ath79/dts/ar7241_ubnt_bullet-m.dts | 13 - target/linux/ath79/dts/ar7241_ubnt_nano-m.dts | 9 - .../linux/ath79/dts/ar7241_ubnt_rocket-m.dts | 21 - target/linux/ath79/dts/ar7241_ubnt_unifi.dts | 142 - target/linux/ath79/dts/ar7241_ubnt_xm.dtsi | 153 - target/linux/ath79/dts/ar7242.dtsi | 69 - .../linux/ath79/dts/ar7242_avm_fritz300e.dts | 169 - .../ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts | 127 - target/linux/ath79/dts/ar724x.dtsi | 154 - target/linux/ath79/dts/ar9132.dtsi | 196 - .../linux/ath79/dts/ar9132_tl-wr1043nd-v1.dts | 178 - target/linux/ath79/dts/ar9330.dtsi | 169 - .../linux/ath79/dts/ar9330_glinet_ar150.dts | 168 - target/linux/ath79/dts/ar9331.dtsi | 6 - target/linux/ath79/dts/ar9331_dpt_module.dts | 79 - .../linux/ath79/dts/ar9331_dragino_ms14.dts | 103 - .../dts/ar9331_embeddedwireless_dorin.dts | 130 - target/linux/ath79/dts/ar9331_omega.dts | 79 - target/linux/ath79/dts/ar9331_tl-wr703n.dts | 139 - target/linux/ath79/dts/ar9331_tl_mr3020.dts | 119 - target/linux/ath79/dts/ar9344.dtsi | 32 - target/linux/ath79/dts/ar9344_tl-wdr3600.dts | 9 - target/linux/ath79/dts/ar9344_tl-wdr4300.dts | 9 - target/linux/ath79/dts/ar9344_tl-wdr4300.dtsi | 240 - target/linux/ath79/dts/ar934x.dtsi | 219 - target/linux/ath79/dts/ath79.dtsi | 81 - target/linux/ath79/dts/qca9557.dtsi | 201 - .../ath79/dts/qca9558_openmesh_om5p-ac-v2.dts | 176 - .../files/arch/mips/ath79/pci-ath9k-fixup.c | 126 - .../files/arch/mips/ath79/pci-ath9k-fixup.h | 6 - .../mips/include/asm/fw/myloader/myloader.h | 34 - .../ath79/files/drivers/mtd/tplinkpart.c | 235 - .../ath79/files/drivers/net/dsa/mv88e6063.c | 289 - .../net/ethernet/atheros/ag71xx/Kconfig | 25 - .../net/ethernet/atheros/ag71xx/Makefile | 14 - .../net/ethernet/atheros/ag71xx/ag71xx.h | 453 - .../ethernet/atheros/ag71xx/ag71xx_ar7240.c | 1340 -- .../ethernet/atheros/ag71xx/ag71xx_debugfs.c | 285 - .../ethernet/atheros/ag71xx/ag71xx_ethtool.c | 120 - .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 1614 --- .../net/ethernet/atheros/ag71xx/ag71xx_mdio.c | 218 - .../net/ethernet/atheros/ag71xx/ag71xx_phy.c | 92 - target/linux/ath79/generic/config-default | 16 - .../ath79/generic/profiles/00-default.mk | 16 - target/linux/ath79/generic/target.mk | 8 - target/linux/ath79/image/Makefile | 76 - target/linux/ath79/image/common-tp-link.mk | 84 - target/linux/ath79/image/generic-tp-link.mk | 30 - target/linux/ath79/image/generic-ubnt.mk | 81 - target/linux/ath79/image/generic.mk | 90 - target/linux/ath79/image/lzma-loader/Makefile | 66 - .../ath79/image/lzma-loader/src/LzmaDecode.c | 584 - .../ath79/image/lzma-loader/src/LzmaDecode.h | 113 - .../ath79/image/lzma-loader/src/LzmaTypes.h | 45 - .../ath79/image/lzma-loader/src/Makefile | 107 - .../ath79/image/lzma-loader/src/ar71xx_regs.h | 725 - .../linux/ath79/image/lzma-loader/src/board.c | 56 - .../linux/ath79/image/lzma-loader/src/cache.c | 43 - .../linux/ath79/image/lzma-loader/src/cache.h | 17 - .../ath79/image/lzma-loader/src/cacheops.h | 85 - .../ath79/image/lzma-loader/src/config.h | 31 - .../ath79/image/lzma-loader/src/cp0regdef.h | 39 - .../linux/ath79/image/lzma-loader/src/head.S | 121 - .../ath79/image/lzma-loader/src/loader.c | 264 - .../ath79/image/lzma-loader/src/loader.lds | 35 - .../ath79/image/lzma-loader/src/loader2.lds | 10 - .../ath79/image/lzma-loader/src/lzma-data.lds | 8 - .../ath79/image/lzma-loader/src/printf.c | 350 - .../ath79/image/lzma-loader/src/printf.h | 18 - target/linux/ath79/image/tiny-tp-link.mk | 21 - target/linux/ath79/modules.mk | 16 - ...-serial-drop-QCA-pecific-SoC-symbols.patch | 21 - ...2-watchdog-ath79-fix-maximum-timeout.patch | 32 - ...ds-add-reset-controller-based-driver.patch | 183 - .../0004-phy-add-ath79-usb-phys.patch | 320 - ...005-usb-add-more-OF-quirk-properties.patch | 24 - .../0006-usb-drop-deprecated-symbols.patch | 51 - ...9-intc-add-irq-cascade-driver-for-QC.patch | 130 - ...ip-irq-ath79-cpu-drop-OF-init-helper.patch | 23 - ...-ath79-add-lots-of-missing-registers.patch | 971 -- ...S-ath79-select-the-PINCTRL-subsystem.patch | 20 - ...egister-address-in-ath79_ddr_wb_flus.patch | 27 - ...Avoid-using-unitialized-reg-variable.patch | 42 - .../0013-MIPS-ath79-fix-system-restart.patch | 32 - ...14-MIPS-ath79-finetune-cpu-overrides.patch | 38 - ...ath79-enable-uart-during-early_prink.patch | 71 - ...PS-ath79-add-support-for-QCA953x-SoC.patch | 331 - ...PS-ath79-add-support-for-qca956x-soc.patch | 410 - ...h79-get-PCIe-controller-out-of-reset.patch | 100 - ...pci-ar71xx-driver-into-a-pure-OF-dri.patch | 197 - ...pci-ar724x-driver-into-a-pure-OF-dri.patch | 199 - .../0022-MIPS-ath79-drop-pci.c.patch | 350 - .../0023-MIPS-ath79-drop-mach-files.patch | 742 -- .../0024-GPIO-add-named-gpio-exports.patch | 166 - .../0024-MIPS-ath79-drop-pdata-helpers.patch | 922 -- .../0025-MIPS-ath79-drop-irq.c.patch | 336 - ...-MIPS-ath79-sanitize-Kconfig-symbols.patch | 111 - ...MIPS-ath79-drop-mips_machine-support.patch | 172 - ...elpers-for-setting-clocks-and-expose.patch | 238 - ...legacy-wdt-and-uart-clock-aliases-ou.patch | 110 - ...ass-PLL-base-to-clock-init-functions.patch | 238 - ...specifying-the-reference-clock-in-DT.patch | 225 - ...rt-setting-up-clock-via-DT-on-all-So.patch | 73 - ...9-export-switch-MDIO-reference-clock.patch | 54 - .../0034-MIPS-ath79-ath9k-exports.patch | 27 - .../004-register_gpio_driver_earlier.patch | 18 - .../405-mtd-tp-link-partition-parser.patch | 25 - .../420-net-ar71xx_mac_driver.patch | 28 - .../430-drivers-link-spi-before-mtd.patch | 12 - .../461-spi-ath79-add-fast-flash-read.patch | 60 - ...ath79-swizzle-pci-address-for-ar71xx.patch | 98 - ...490-usb-ehci-add-quirks-for-qca-socs.patch | 103 - .../900-mdio_bitbang_ignore_ta_value.patch | 32 - ...-prevent-rescheduling-during-command.patch | 61 - .../910-unaligned_access_hacks.patch | 900 -- target/linux/ath79/tiny/config-default | 14 - .../linux/ath79/tiny/profiles/00-default.mk | 9 - target/linux/ath79/tiny/target.mk | 6 - target/linux/au1000/Makefile | 32 - target/linux/au1000/au1500/config-default | 5 - .../linux/au1000/au1500/profiles/Atheros.mk | 13 - .../au1000/au1500/profiles/InternetBox.mk | 18 - .../linux/au1000/au1500/profiles/MeshCube.mk | 18 - target/linux/au1000/au1500/target.mk | 7 - target/linux/au1000/au1550/config-default | 4 - .../linux/au1000/au1550/profiles/DBAu1550.mk | 13 - target/linux/au1000/au1550/target.mk | 8 - target/linux/au1000/base-files/etc/diag.sh | 21 - .../au1000/base-files/lib/upgrade/platform.sh | 26 - target/linux/au1000/config-3.18 | 141 - target/linux/au1000/image/Makefile | 74 - target/linux/au1000/modules.mk | 17 - .../patches-3.18/002-openwrt_rootfs.patch | 11 - .../patches-3.18/003-au1000_eth_ioctl.patch | 17 - .../patches-3.18/004-watchdog_low_init.patch | 12 - .../linux/au1000/patches-3.18/006-codec.patch | 26 - target/linux/brcm2708/Makefile | 5 +- .../base-files/etc/board.d/02_network | 3 +- .../lib/preinit/05_set_preinit_iface_brcm2708 | 1 + target/linux/brcm2708/bcm2708/config-4.9 | 6 +- target/linux/brcm2708/bcm2709/config-4.9 | 7 +- target/linux/brcm2708/bcm2710/config-4.9 | 16 +- target/linux/brcm2708/image/Makefile | 18 +- target/linux/brcm2708/image/cmdline.txt | 2 +- ...-dtco-targets-when-filtering-symbols.patch | 2 +- .../950-0031-Add-dwc_otg-driver.patch | 2 +- ...ltime-clock-1-wire-chip-DS1307-and-1.patch | 27 +- ...1-Don-t-use-DT-aliases-for-numbering.patch | 2 +- ...uspending-if-we-re-in-gadget-mode-18.patch | 2 +- ...0195-amba_pl011-Round-input-clock-up.patch | 6 +- ...0-1002-bcm2708-raspberry-pi-3-b-plus.patch | 298 + target/linux/brcm47xx/Makefile | 2 +- .../etc/board.d/{01_detect => 01_network} | 35 +- .../base-files/lib/preinit/01_sysinfo | 12 +- target/linux/brcm47xx/config-4.14 | 7 - target/linux/brcm47xx/config-4.4 | 196 - ...X-Add-support-for-Netgear-WNR1000-V3.patch | 96 + ..._nvram-support-small-0x6000-B-NVRAM-.patch | 24 + ...47XX-Devices-database-update-for-4.x.patch | 48 +- ...7XX-Enable-74K-Core-ExternalSync-for.patch | 76 + .../patches-4.14/820-wgt634u-nvram-fix.patch | 2 +- .../patches-4.14/999-wl_exports.patch | 2 +- ...XX-Add-Luxul-devices-to-the-database.patch | 246 - ...-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch | 86 - .../brcm47xx/patches-4.4/159-cpu_fixes.patch | 468 - .../patches-4.4/160-kmap_coherent.patch | 78 - .../209-b44-register-adm-switch.patch | 121 - .../patches-4.4/210-b44_phy_fix.patch | 54 - .../280-activate_ssb_support_in_usb.patch | 25 - .../patches-4.4/300-fork_cacheflush.patch | 21 - .../patches-4.4/310-no_highpage.patch | 74 - ...47XX-Devices-database-update-for-4.x.patch | 223 - .../400-mtd-bcm47xxpart-get-nvram.patch | 34 - .../patches-4.4/610-pci_ide_fix.patch | 41 - .../patches-4.4/791-tg3-no-pci-sleep.patch | 17 - ...f-serial-flashes-with-smaller-blocks.patch | 73 - .../patches-4.4/820-wgt634u-nvram-fix.patch | 293 - .../patches-4.4/830-huawei_e970_support.patch | 101 - .../patches-4.4/831-old_gpio_wdt.patch | 360 - ...rites-setting-CardBus-bridge-resourc.patch | 30 - ...ch-GPIO-portions-to-use-GPIOLIB_IRQC.patch | 233 - .../patches-4.4/940-bcm47xx-yenta.patch | 46 - .../976-ssb_increase_pci_delay.patch | 11 - .../brcm47xx/patches-4.4/999-wl_exports.patch | 22 - ...X-Add-support-for-Netgear-WNR1000-V3.patch | 96 + ..._nvram-support-small-0x6000-B-NVRAM-.patch | 24 + ...47XX-Devices-database-update-for-4.x.patch | 48 +- .../400-mtd-bcm47xxpart-get-nvram.patch | 4 +- .../patches-4.9/820-wgt634u-nvram-fix.patch | 2 +- .../patches-4.9/830-huawei_e970_support.patch | 4 +- .../brcm47xx/patches-4.9/999-wl_exports.patch | 2 +- .../base-files/etc/board.d/02_network | 10 +- target/linux/brcm63xx/config-4.14 | 7 - target/linux/brcm63xx/config-4.4 | 261 - ...-08-bcm63xx_enet-correct-clock-usage.patch | 101 - ...not-write-to-random-DMA-channel-on-B.patch | 29 - ...tions-use-DT-info-for-parsing-partit.patch | 81 + ...d-get-set-of_node-flash_node-helpers.patch | 78 - ...device-tree-node-directly-from-maste.patch | 74 - ...-mtd-nand-spi-nor-assign-MTD-of_node.patch | 37 - ...-nand-convert-to-nand_set_flash_node.patch | 72 - ...vert-to-spi_nor_-get-set-_flash_node.patch | 79 - ...op-unnecessary-partition-parser-data.patch | 725 - ...op-unnecessary-partition-parser-data.patch | 83 - ...08-mtd-spi-nor-drop-flash_node-field.patch | 57 - ...op-unnecessary-partition-parser-data.patch | 195 - ...t-drop-of_node-partition-parser-data.patch | 61 - ...ssign-parent-for-the-concatenated-MT.patch | 27 - ...pose-master-transfer-size-limitation.patch | 51 - ...gpio-add-a-data-pointer-to-gpio_chip.patch | 121 - ...generic-factor-into-gpio_chip-struct.patch | 2586 ---- ...pis-for-gpiochip_add_data-and-gpioch.patch | 115 - ..._-apis-for-pinctrl_-register-unregis.patch | 108 - ...inctrl_utils_dt_free_map-to-pinctrl_.patch | 59 - ...or-change-return-value-of-read-write.patch | 149 - ...n-amount-of-data-transferred-or-erro.patch | 91 - ...return-amount-of-data-read-written-o.patch | 72 - ...turn-amount-of-data-transferred-or-e.patch | 51 - ...pi-nor-check-return-value-from-write.patch | 118 - ...d-spi-nor-stop-passing-around-retlen.patch | 266 - ...8-08-mtd-spi-nor-simplify-write-loop.patch | 103 - ...000-4.8-09-mtd-spi-nor-add-read-loop.patch | 54 - ...read-in-spi_max_transfer_size-chunks.patch | 26 - ...cm63xx_uart-use-correct-alias-naming.patch | 37 - ...-max_message_size-hook-in-spi_master.patch | 73 - ...ider-max-message-size-in-m25p80_read.patch | 30 - ...ve-WARN_ONCE-message-in-spi_nor_writ.patch | 33 - ...-spi-subsystem-aware-of-message-size.patch | 42 - ...cm63xx-document-device-tree-bindings.patch | 50 - ...support-for-probing-through-devicetr.patch | 98 - ...i-allow-providing-clock-rate-through.patch | 35 - ...-hsspi-document-device-tree-bindings.patch | 51 - ...i-add-support-for-probing-through-de.patch | 76 - ...07-mdio_bus-Issue-GPIO-RESET-to-PHYs.patch | 192 - ...-reset-after-releasing-PHYs-from-res.patch | 43 - ...-signal-source-assignment-for-high-l.patch | 34 - ...us-handle-only-single-PHY-reset-GPIO.patch | 120 - ...mdio_bus-use-devm_gpiod_get_optional.patch | 39 - ...PS-BCM63XX-add-clkdev-lookup-support.patch | 210 - ...vide-periph-clock-as-refclk-for-uart.patch | 84 - ...-use-refclk-for-the-expected-clock-n.patch | 26 - ...rt-allow-naming-clock-in-device-tree.patch | 55 - ...e-the-HSSPI-PLL-HZ-into-its-own-cloc.patch | 62 - ...vide-enet-clocks-as-enet-to-the-ethe.patch | 60 - ...M63XX-split-out-swpkt_sar-usb-clocks.patch | 105 - ...-08-bcm63xx_enet-correct-clock-usage.patch | 101 - ...not-write-to-random-DMA-channel-on-B.patch | 29 - ...63xx_enet-do-not-rely-on-probe-order.patch | 41 - ...-managed-functions-for-clock-ioremap.patch | 150 - ...net-drop-unneeded-NULL-phy_clk-check.patch | 36 - ...bcm63xx_enet-remove-unneeded-include.patch | 22 - ...enet-just-use-enet-as-the-clock-name.patch | 39 - ...-platform-data-for-dma-channel-numbe.patch | 72 - ...x_enet-remove-pointless-mac_id-check.patch | 25 - ...-platform-device-id-directly-for-mii.patch | 46 - ...63XX-add-USB-host-clock-enable-delay.patch | 28 - ...-USB-device-clock-enable-delay-to-cl.patch | 41 - ...e-code-touching-the-USB-private-regi.patch | 151 - ...-OHCI-EHCI-configuration-bits-to-com.patch | 169 - ...roduce-BCM63XX_OHCI-configuration-sy.patch | 62 - ...-support-for-the-on-chip-OHCI-contro.patch | 138 - ...ister-OHCI-controller-if-board-enabl.patch | 36 - ...roduce-BCM63XX_EHCI-configuration-sy.patch | 62 - ...-support-for-the-on-chip-EHCI-contro.patch | 137 - ...ister-EHCI-controller-if-board-enabl.patch | 36 - ...I-controller-does-not-support-overcu.patch | 24 - ...XX-allow-NULL-clock-for-clk_get_rate.patch | 48 - .../120-mtdpart_fixup_generic_partprobe.patch | 13 - .../130-pinctrl-add-bcm63xx-base-code.patch | 226 - ...d-BCM6328-pincontroller-binding-docu.patch | 78 - ...-add-a-pincontrol-driver-for-BCM6328.patch | 495 - ...d-BCM6348-pincontroller-binding-docu.patch | 49 - ...-add-a-pincontrol-driver-for-BCM6348.patch | 432 - ...d-BCM6358-pincontroller-binding-docu.patch | 61 - ...-add-a-pincontrol-driver-for-BCM6358.patch | 436 - ...d-BCM6362-pincontroller-binding-docu.patch | 96 - ...-add-a-pincontrol-driver-for-BCM6362.patch | 733 - ...d-BCM6368-pincontroller-binding-docu.patch | 84 - ...-add-a-pincontrol-driver-for-BCM6368.patch | 620 - ...d-BCM63268-pincontroller-binding-doc.patch | 106 - ...add-a-pincontrol-driver-for-BCM63268.patch | 736 -- ...low-limiting-ports-for-ehci-platform.patch | 66 - ...e-device-registration-code-into-its-.patch | 492 - ...s-a-mac-addresss-allocator-to-board-.patch | 100 - .../patches-4.4/309-cfe_version_mod.patch | 27 - .../310-cfe_simplify_detection.patch | 20 - .../311-bcm63xxpart_use_cfedetection.patch | 51 - ...ort-for-bcm6345-style-periphery-irq-.patch | 455 - ...ort-for-bcm6345-style-external-inter.patch | 394 - ...22-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch | 695 - ...e-up-BCM6358-s-external-interrupts-4.patch | 57 - ...BCM63XX-add-a-new-cpu-variant-helper.patch | 77 - ...MIPS-BCM63XX-define-variant-id-field.patch | 23 - ...MIPS-BCM63XX-detect-BCM6328-variants.patch | 68 - ...MIPS-BCM63XX-detect-BCM6362-variants.patch | 46 - ...MIPS-BCM63XX-detect-BCM6368-variants.patch | 48 - ...-BCM63XX-fix-PCIe-memory-window-size.patch | 20 - ...amically-set-the-pcie-memory-windows.patch | 70 - .../337-MIPS-BCM63XX-widen-cpuid-field.patch | 56 - ...MIPS-BCM63XX-increase-number-of-IRQs.patch | 39 - ...IPS-BCM63XX-add-support-for-BCM63268.patch | 737 -- ...CM63XX-add-pcie-support-for-BCM63268.patch | 55 - ...MIPS-BCM63XX-add-support-for-BCM6318.patch | 697 - ...IPS-BCM63XX-split-PCIe-reset-signals.patch | 156 - ...BCM63XX-add-PCIe-support-for-BCM6318.patch | 333 - ...ect-flash-type-early-and-store-the-r.patch | 74 - ...ixup-mapped-SPI-flash-access-on-boot.patch | 84 - ...-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch | 44 - .../347-MIPS-BCM6318-USB-support.patch | 124 - ...-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch | 71 - ...IPS-BCM63XX-add-BCM63268-USB-support.patch | 117 - ...63XX-support-settings-num-usbh-ports.patch | 108 - .../351-set-board-usbh-ports.patch | 10 - ...ow-building-support-for-more-than-on.patch | 95 - ...ow-board-implementations-to-force-fl.patch | 61 - ...e-fallback-sprom-support-into-its-ow.patch | 188 - ...63XX-use-platform-data-for-the-sprom.patch | 95 - ...BCM63XX-make-fallback-sprom-optional.patch | 140 - ...M63XX-allow-different-types-of-sprom.patch | 66 - ...S-BCM63XX-add-support-for-raw-sproms.patch | 517 - ...-raw-fallback-sproms-for-most-common.patch | 181 - ...o-register-a-fallback-sprom-for-bcma.patch | 128 - ...M63XX-add-BCMA-based-sprom-templates.patch | 303 - ...ow-board-files-to-provide-sprom-fixu.patch | 67 - ...ow-setting-a-pci-bus-device-for-fall.patch | 102 - ...-BCM63XX-add-support-for-loading-DTB.patch | 118 - ...-support-for-matching-the-board_info.patch | 95 - ...ulate-the-compatible-to-board_info-l.patch | 65 - .../371_add_of_node_available_by_alias.patch | 37 - ...egister_pflash_when_available_in_dtb.patch | 21 - ...ister-interrupt-controllers-through-.patch | 45 - ...add-a-simple-GPIO-driver-for-bcm63xx.patch | 178 - ...PS-BCM63XX-switch-to-new-gpio-driver.patch | 216 - ...-register-lookup-for-ephy-reset-gpio.patch | 129 - ...not-register-gpio-controller-if-pres.patch | 35 - ...vide-a-gpio-lookup-for-the-pcmcia-re.patch | 59 - ...bcm63xx_pmcia-use-the-new-named-gpio.patch | 59 - ...d-BCM6318-pincontroller-binding-docu.patch | 96 - ...-add-a-pincontrol-driver-for-BCM6318.patch | 609 - .../383-bcm63xx_select_pinctrl.patch | 65 - ...X-add-clkdev-lookups-for-device-tree.patch | 105 - ...63XX-do-not-register-SPI-controllers.patch | 170 - ...91-MIPS-BCM63XX-do-not-register-uart.patch | 257 - ...MIPS-BCM63XX-remove-leds-and-buttons.patch | 343 - .../patches-4.4/400-bcm963xx_flashmap.patch | 65 - .../401-bcm963xx_real_rootfs_length.patch | 27 - ...402_bcm63xx_enet_vlan_incoming_fixed.patch | 11 - .../403-6358-enet1-external-mii-clk.patch | 22 - ...-move-phy_-dis-connect-into-probe-re.patch | 169 - ...enable-rgmii-clock-on-external-ports.patch | 53 - ...CM63XX-Register-SPI-flash-if-present.patch | 157 - ...w-providing-fixup-data-in-board-data.patch | 72 - ...M63XX-export-the-attached-flash-type.patch | 31 - ...CM63XX-add-a-fixup-for-ath9k-devices.patch | 237 - ...0-BCM63XX-add-endian-check-for-ath9k.patch | 51 - .../421-BCM63XX-add-led-pin-for-ath9k.patch | 51 - ...M63XX-add-a-fixup-for-rt2x00-devices.patch | 185 - .../423-bcm63xx_enet_add_b53_support.patch | 169 - ...4-bcm63xx_enet_no_request_mem_region.patch | 15 - ...-bcm63xxpart_parse_paritions_from_dt.patch | 324 - .../patches-4.4/427-boards_probe_switch.patch | 119 - ...low_better_context_for_board_patches.patch | 56 - .../brcm63xx/patches-4.4/500-board-D4PW.patch | 40 - .../brcm63xx/patches-4.4/501-board-NB4.patch | 81 - .../patches-4.4/502-board-96338W2_E7T.patch | 39 - .../patches-4.4/503-board-CPVA642.patch | 44 - .../504-board_dsl_274xb_rev_c.patch | 41 - .../patches-4.4/505-board_spw500v.patch | 63 - .../patches-4.4/506-board_gw6200_gw6000.patch | 85 - .../patches-4.4/507-board-MAGIC.patch | 58 - .../patches-4.4/508-board_hw553.patch | 51 - .../patches-4.4/509-board_rta1320_16m.patch | 39 - .../patches-4.4/510-board_spw303v.patch | 39 - .../patches-4.4/511-board_V2500V.patch | 92 - .../patches-4.4/512-board_BTV2110.patch | 43 - ...BCM63XX-add-inventel-Livebox-support.patch | 223 - .../patches-4.4/514-board_ct536_ct5621.patch | 53 - .../patches-4.4/515-board_DWV-S0_fixes.patch | 10 - .../patches-4.4/516-board_96348A-122.patch | 49 - .../patches-4.4/519_board_CPVA502plus.patch | 52 - ...63xx-add-support-for-96368MVWG-board.patch | 118 - ...3xx-add-support-for-96368MVNgr-board.patch | 73 - ...CM63XX-add-96328avng-reference-board.patch | 45 - ...CM63XX-add-963281TAN-reference-board.patch | 68 - .../524-board_dsl_274xb_rev_f.patch | 80 - .../patches-4.4/525-board_96348w3.patch | 43 - .../patches-4.4/526-board_CT6373-1.patch | 49 - .../527-board_dva-g3810bn-tl-1.patch | 54 - .../brcm63xx/patches-4.4/528-board_nb6.patch | 56 - .../patches-4.4/529-board_fast2604.patch | 41 - .../patches-4.4/530-board_A4001N1.patch | 68 - .../patches-4.4/531-board_AR-5387un.patch | 97 - .../patches-4.4/532-board_AR-5381u.patch | 79 - .../patches-4.4/533-board_rta770bw.patch | 39 - .../patches-4.4/534-board_hw556.patch | 123 - .../patches-4.4/535-board_rta770w.patch | 44 - .../patches-4.4/536-board_fast2704.patch | 74 - .../patches-4.4/537-board_fast2504n.patch | 66 - .../patches-4.4/555-board_96318ref.patch | 78 - .../patches-4.4/556-board_96318ref_p300.patch | 69 - .../patches-4.4/557-board_bcm963269bhr.patch | 71 - .../patches-4.4/558-board_AR1004G.patch | 48 - .../patches-4.4/559-board_vw6339gu.patch | 70 - .../patches-4.4/560-board_963268gu_p300.patch | 83 - .../patches-4.4/561-board_WAP-5813n.patch | 75 - .../patches-4.4/562-board_VR-3025u.patch | 78 - .../patches-4.4/563-board_VR-3025un.patch | 78 - .../patches-4.4/564-board_P870HW-51a_v2.patch | 67 - .../patches-4.4/565-board_hw520.patch | 55 - .../patches-4.4/566-board_A4001N.patch | 68 - .../patches-4.4/567-board_dsl-2751b_e1.patch | 93 - .../568-board_DGND3700v1_3800B.patch | 49 - .../patches-4.4/569-board_homehub2a.patch | 50 - .../patches-4.4/570-board_HG655b.patch | 71 - .../patches-4.4/571-board_fast2704n.patch | 64 - .../patches-4.4/572-board_VR-3026e.patch | 78 - .../patches-4.4/573-board_R5010UNv2.patch | 69 - .../patches-4.4/574-board_HG622.patch | 71 - .../patches-4.4/575-board_EVG2000.patch | 61 - .../patches-4.4/576-board_AV4202N.patch | 70 - .../patches-4.4/577-board_VH4032N.patch | 63 - .../patches-4.4/578-board_R1000H.patch | 48 - .../patches-4.4/579-board_AR-5315u.patch | 86 - .../patches-4.4/580-board_AD1018.patch | 92 - .../brcm63xx/patches-4.4/800-wl_exports.patch | 25 - .../801-ssb_export_fallback_sprom.patch | 31 - .../802-rtl8367r_fix_RGMII_support.patch | 30 - ...d-unaligned-accesses-failing-on-bcm6.patch | 26 - .../804-bcm63xx_enet_63268_rgmii_ports.patch | 13 - ...ider-max-message-size-in-m25p80_read.patch | 30 - ...-08-bcm63xx_enet-correct-clock-usage.patch | 101 - ...not-write-to-random-DMA-channel-on-B.patch | 29 - ...tions-use-DT-info-for-parsing-partit.patch | 81 + target/linux/cns3xxx/config-4.14 | 7 - .../drivers/net/ethernet/cavium/cns3xxx_eth.c | 11 +- ...-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch | 2 +- ...tcp-allow-drivers-to-tweak-TSQ-logic.patch | 4 +- ...ption-fix-dwm-158-3g-modem-interface.patch | 2 +- ...port-for-host-mode-external-vbus-sup.patch | 109 - ...wc2_vbus_supply_init-fix-error-check.patch | 55 - ...add-of_match_table-with-a-new-DT-bin.patch | 39 + ...add-of_match_table-with-the-new-DT-b.patch | 37 + ...se-DT-info-for-parsing-partitions-wi.patch | 102 + ...nly-allow-one-nat-hook-per-hook-poin.patch | 2 +- ...les-remove-multihook-chains-and-fami.patch | 46 +- ...les-remove-hooks-from-family-definit.patch | 12 +- ...v4.16-netfilter-meta-secpath-support.patch | 6 +- ...bles-add-flow-table-netlink-frontend.patch | 42 +- ...etfilter-flow-table-support-for-IPv6.patch | 4 +- ...les-remove-nhooks-field-from-struct-.patch | 8 +- ...les-fix-a-typo-in-nf_tables_getflowt.patch | 2 +- ...rove-flow-table-Kconfig-dependencies.patch | 2 +- ...les-remove-flag-field-from-struct-nf.patch | 6 +- ...les-no-need-for-struct-nft_af_info-t.patch | 12 +- ...les-remove-struct-nft_af_info-parame.patch | 6 +- ...les-fix-potential-NULL-ptr-deref-in-.patch | 2 +- ...les-add-single-table-list-for-all-fa.patch | 164 +- ...tfilter-exit_net-cleanup-check-added.patch | 10 +- ...nf_tables-get-rid-of-pernet-families.patch | 12 +- ...les-get-rid-of-struct-nft_af_info-ab.patch | 132 +- ...ow_offload-wait-for-garbage-collecto.patch | 2 +- ...tfilter-nf_tables-fix-flowtable-free.patch | 2 +- ...les-allocate-handle-and-delete-objec.patch | 64 +- ...ble-infrastructure-depends-on-NETFIL.patch | 2 +- ...ipv6-make-ip6_dst_mtu_forward-inline.patch | 2 +- ...w_table-move-init-code-to-nf_flow_ta.patch | 4 +- ...w_table-fix-priv-pointer-for-netdev-.patch | 2 +- ...w_table-track-flow-tables-in-nf_flow.patch | 4 +- ...700-1-6-e1000e-Remove-Other-from-EIAC.diff | 66 + ...oid-receiver-overrun-interrupt-bursts.diff | 84 + ...terrupt-re-raising-in-Other-interrupt.diff | 50 + ...-missed-interrupts-following-ICR-read.diff | 131 + ...024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch | 6 +- ...ve-one-locked-operation-in-tcp_wfree.patch | 4 +- ...tsq-add-shortcut-in-tcp_tasklet_func.patch | 6 +- ...cp-tsq-avoid-one-atomic-in-tcp_wfree.patch | 4 +- ...-a-shortcut-in-tcp_small_queue_check.patch | 2 +- ...cp_mtu_probe-is-likely-to-exit-early.patch | 2 +- ...ove-tsq_flags-close-to-sk_wmem_alloc.patch | 14 +- ...-missing-barrier-in-tcp_tasklet_func.patch | 2 +- ...tcp-allow-drivers-to-tweak-TSQ-logic.patch | 4 +- ...or-releasing-multiple-instances-of-a.patch | 75 + ...c_page_frag-to-page_frag_alloc-and-_.patch | 137 + ..._frag-functions-to-__page_frag_cache.patch | 79 + ...50-usb-dwc2-Remove-unnecessary-kfree.patch | 2 +- ...ding-registering-partitions-to-the-p.patch | 168 + ...improve-handling-TRX-partition-size.patch} | 11 +- ...-Move-bcm54xx_auxctl_-read-write-to-.patch | 6 +- ...m-Allow-enabling-or-disabling-of-EEE.patch | 2 +- ...-Add-support-code-for-reading-PHY-co.patch | 2 +- ...90-net-generalize-napi_complete_done.patch | 10 +- ...issing-tunnel-encapsulation-limit-op.patch | 50 + ...ort-ipv6_push_frag_opts-for-tunnelin.patch | 31 + ...add-of_match_table-with-a-new-DT-bin.patch | 47 + ...add-of_match_table-with-the-new-DT-b.patch | 45 + ...se-DT-info-for-parsing-partitions-wi.patch | 102 + target/linux/generic/config-3.18 | 4657 ------- target/linux/generic/config-4.4 | 4857 ------- target/linux/generic/config-4.9 | 2 +- .../files/drivers/net/phy/rtl8366_smi.c | 19 +- .../files/drivers/net/phy/rtl8366_smi.h | 6 +- .../files/include/linux/ar8216_platform.h | 1 - .../generic/files/include/linux/rtl8366.h | 4 +- .../generic/files/include/linux/switch.h | 3 - .../hack-4.14/207-disable-modorder.patch | 4 +- .../211-host_tools_portability.patch | 2 +- .../generic/hack-4.14/220-gc_sections.patch | 2 +- .../650-netfilter-add-xt_OFFLOAD-target.patch | 9 +- ...710-phy-add-mdio_register_board_info.patch | 80 - .../generic/hack-4.14/721-phy_packets.patch | 14 +- .../hack-4.14/773-bgmac-add-srab-switch.patch | 2 +- .../generic/hack-4.14/902-debloat_proc.patch | 42 +- .../hack-4.14/904-debloat_dma_buf.patch | 2 +- ...p-offload-hooks-on-netdev-unregister.patch | 91 + ...-linux-kernel-to-support-shortcut-fe.patch | 145 - ...ridge-APIs-needed-for-network-HW-acc.patch | 74 - ...k-events-support-multiple-registrant.patch | 318 - .../hack-4.9/207-disable-modorder.patch | 4 +- .../hack-4.9/211-host_tools_portability.patch | 2 +- .../generic/hack-4.9/220-gc_sections.patch | 4 +- .../generic/hack-4.9/221-module_exports.patch | 2 +- .../generic/hack-4.9/902-debloat_proc.patch | 2 +- .../pending-3.18/001-mtdsplit_backport.patch | 142 - .../002-phy_drivers_backport.patch | 552 - .../pending-3.18/003-myloader_backport.patch | 11 - .../generic/pending-3.18/020-ssb_update.patch | 134 - .../generic/pending-3.18/021-ssb_sprom.patch | 32 - .../pending-3.18/025-bcma_backport.patch | 286 - .../pending-3.18/026-bcma-from-3.20.patch | 527 - .../pending-3.18/027-bcma-from-4.1.patch | 680 - .../pending-3.18/028-bcma-from-4.2.patch | 86 - .../pending-3.18/029-bcma-from-4.4.patch | 26 - .../030-backport_bcm47xx_nvram.patch | 52 - ...11-Allow-set-network-namespace-by-fd.patch | 21 - .../pending-3.18/031-bcma-from-4.5.patch | 49 - .../pending-3.18/032-bcma-from-4.6.patch | 716 - ...-mtd-bcm47xxpart-backports-from-3.19.patch | 50 - ...-mtd-bcm47xxpart-backports-from-3.20.patch | 95 - ...GD25Q128B_support_backport_from_3.19.patch | 15 - .../044-backport-m25p80-jedec-probe.patch | 39 - .../050-backport_netfilter_rtcache.patch | 509 - ...ting-hash_max-multicast_router-if-in.patch | 99 - .../060-mips_decompressor_memmove.patch | 22 - ...gmac-register-napi-before-the-device.patch | 44 - ...rqs-only-if-there-is-nothing-to-poll.patch | 30 - .../073-bgmac-Clean-warning-messages.patch | 50 - ...ixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch | 76 - ...mac-allow-enabling-on-ARCH_BCM_5301X.patch | 28 - ...76-net-phy-export-fixed_phy_register.patch | 30 - ...scriptor-frame-start-end-definitions.patch | 24 - ...gmac-implement-GRO-and-use-build_skb.patch | 189 - ...mac-implement-scatter-gather-support.patch | 267 - ...gmac-simplify-tx-ring-index-handling.patch | 125 - ...rrupts-disabled-as-long-as-there-is-.patch | 87 - ...received-skb-headroom-to-NET_SKB_PAD.patch | 66 - ...bgmac-simplify-rx-DMA-error-handling.patch | 130 - ...gmac-add-check-for-oversized-packets.patch | 27 - ...ncrease-rx-ring-size-from-511-to-512.patch | 23 - ...7-10-bgmac-simplify-dma-init-cleanup.patch | 184 - .../077-11-bgmac-fix-DMA-rx-corruption.patch | 88 - .../077-12-bgmac-drop-ring-num_slots.patch | 132 - ...enable-Ethernet-core-before-using-it.patch | 31 - ...fix-MAC-soft-reset-bit-for-corerev-4.patch | 34 - ...c-net-fib_trie-when-CONFIG_IP_MULTIP.patch | 46 - ...e-balancing-issue-if-new-node-pushes.patch | 72 - ...usage-stats-to-be-percpu-instead-of-.patch | 200 - ...rie-Make-leaf-and-tnode-more-uniform.patch | 421 - ...node_free-and-leaf_free-into-node_fr.patch | 209 - ...80-05-fib_trie-Merge-leaf-into-tnode.patch | 928 -- ...e-fib_table_lookup-to-avoid-wasting-.patch | 343 - ...0-07-fib_trie-Optimize-fib_find_node.patch | 64 - ...8-fib_trie-Optimize-fib_table_insert.patch | 276 - ...meaning-of-pos-to-represent-unchecke.patch | 346 - ...igned-long-for-anything-dealing-with.patch | 186 - ...Push-rcu_read_lock-unlock-to-callers.patch | 403 - ...e-Move-resize-to-after-inflate-halve.patch | 345 - ...ctions-should_inflate-and-should_hal.patch | 250 - ...signment-of-child-to-parent-down-int.patch | 336 - ...tnode-flushing-down-to-inflate-halve.patch | 237 - ...-halve-nodes-in-a-more-RCU-friendly-.patch | 345 - ...checks-for-index-tnode_child_length-.patch | 95 - ...Add-tracking-value-for-suffix-length.patch | 234 - ...ex-0ul-n-bits-instead-of-index-n-bit.patch | 52 - ...-bug-and-merge-similar-bits-of-infla.patch | 267 - ...ck-to-slen-update-on-inflate-halve-f.patch | 61 - ...llapse-and-should_collapse-to-resize.patch | 206 - ...ty_children-instead-of-counting-empt.patch | 34 - ...b_find_alias-to-file-where-it-is-use.patch | 79 - ...-Various-clean-ups-for-handling-slen.patch | 116 - ...eue-to-die-properly-when-a-PADT-is-r.patch | 89 - ...02-pppoe-Lacks-DST-MAC-address-check.patch | 25 - ...poe-device-in-pppoe_unbind_sock_work.patch | 28 - ..._state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch | 45 - ...ppp-remove-PPPOX_ZOMBIE-socket-state.patch | 51 - ...ry-corruption-in-padt-work-structure.patch | 82 - ...ment-fix-headroom-tests-and-skb-leak.patch | 101 - ...ncrease-headroom-on-received-packets.patch | 54 - .../087-regmap-make-LZO-cache-optional.patch | 67 - ...layfs-fallback-to-readonly-when-full.patch | 109 - ...i-nor-add-support-Spansion_S25FL164K.patch | 10 - ...-if-the-device-is-processing-a-messa.patch | 47 - ...rs-inside-calling-context-for-spi_sy.patch | 184 - ...e-message-pump-in-the-worker-kthread.patch | 83 - ...ility-of-linux-in.h-with-netinet-in..patch | 146 - ...ing_init-new-hook-for-archs-before-m.patch | 182 - .../pending-3.18/102-ehci_hcd_ignore_oc.patch | 82 - ...ame2-and-add-RENAME_WHITEOUT-support.patch | 86 - ...11-jffs2-add-RENAME_EXCHANGE-support.patch | 58 - ...ge_allow_receiption_on_disabled_port.patch | 54 - .../132-mips_inline_dma_ops.patch | 688 - ...-generic-parsing-of-linux-part-probe.patch | 175 - ...part-don-t-fail-because-of-bit-flips.patch | 92 - ...ci-make-USB_XHCI_PLATFORM-selectable.patch | 41 - ...t_for_moving_ndp_to_end_of_ncm_frame.patch | 228 - ...-support-for-Quectel-EC20-Mini-PCIe-.patch | 114 - ...-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch | 96 - .../pending-3.18/200-fix_localversion.patch | 11 - .../pending-3.18/201-extra_optimization.patch | 14 - .../pending-3.18/202-reduce_module_size.patch | 11 - .../203-kallsyms_uncompressed.patch | 108 - .../pending-3.18/204-module_strip.patch | 190 - .../205-backtrace_module_info.patch | 36 - .../210-darwin_scripts_include.patch | 3088 ----- .../212-byteshift_portability.patch | 51 - .../213-x86_vdso_portability.patch | 13 - .../214-spidev_h_portability.patch | 11 - .../pending-3.18/220-gc_sections.patch | 531 - .../pending-3.18/221-module_exports.patch | 88 - .../230-openwrt_lzma_options.patch | 58 - .../pending-3.18/250-netfilter_depends.patch | 18 - .../pending-3.18/251-sound_kconfig.patch | 18 - .../pending-3.18/252-mv_cesa_depends.patch | 10 - .../pending-3.18/253-ssb_b43_default_on.patch | 29 - .../254-textsearch_kconfig_hacks.patch | 23 - .../255-lib80211_kconfig_hacks.patch | 31 - .../256-crypto_add_kconfig_prompts.patch | 47 - .../257-wireless_ext_kconfig_hack.patch | 22 - .../258-netfilter_netlink_kconfig_hack.patch | 11 - .../pending-3.18/259-regmap_dynamic.patch | 87 - .../260-crypto_test_dependencies.patch | 37 - ...t-add-fallback-for-unsupported-libcs.patch | 102 - ...prevent-redefinition-of-struct-ethhd.patch | 55 - .../300-mips_expose_boot_raw.patch | 39 - .../301-mips_image_cmdline_hack.patch | 28 - .../302-mips_no_branch_likely.patch | 11 - .../pending-3.18/304-mips_disable_fpu.patch | 105 - .../pending-3.18/305-mips_module_reloc.patch | 356 - .../306-mips_mem_functions_performance.patch | 83 - .../307-mips_highmem_offset.patch | 17 - .../310-arm_module_unresolved_weak_sym.patch | 13 - .../320-ppc4xx_optimization.patch | 31 - .../321-powerpc_crtsavres_prereq.patch | 10 - ...t-command-line-parameters-from-users.patch | 298 - .../400-mtd-add-rootfs-split-support.patch | 171 - ...for-different-partition-parser-types.patch | 113 - ...arsers-for-rootfs-and-firmware-split.patch | 72 - .../403-mtd-hook-mtdsplit-to-Kbuild.patch | 22 - .../404-mtd-add-more-helper-functions.patch | 101 - ...405-mtd-old-firmware-uimage-splitter.patch | 70 - ...406-mtd-old-rootfs-squashfs-splitter.patch | 76 - ...rward-declaration-of-struct-mtd_info.patch | 18 - .../411-mtd-partial_eraseblock_write.patch | 142 - .../412-mtd-partial_eraseblock_unlock.patch | 18 - .../pending-3.18/420-mtd-redboot_space.patch | 30 - ...30-mtd-add-myloader-partition-parser.patch | 35 - ...check-for-bad-blocks-when-calculatin.patch | 100 - ...bcm47xxpart-detect-T_Meter-partition.patch | 42 - .../pending-3.18/440-block2mtd_init.patch | 107 - .../pending-3.18/441-block2mtd_probe.patch | 110 - ...-to-use-platform-specific-chip-fixup.patch | 37 - ...n-code-of-nand_correct_data-function.patch | 11 - ...mtd-cfi_cmdset_0002-no-erase_suspend.patch | 11 - ...et_0002-add-buffer-write-cmd-timeout.patch | 18 - ...add-support-for-Winbond-W25X05-flash.patch | 20 - ...support-for-the-Macronix-MX25L512E-S.patch | 21 - ...support-for-the-ISSI-SI25CD512-SPI-f.patch | 22 - ...mtd-spi-nor-add-macronix-mx25u25635f.patch | 10 - .../480-mtd-set-rootfs-to-be-root-dev.patch | 26 - ...mtd-device-named-ubi-or-data-on-boot.patch | 76 - ...to-create-ubiblock-device-for-rootfs.patch | 69 - ...ting-ubi0-rootfs-in-init-do_mounts.c.patch | 54 - ...ROOT_DEV-to-ubiblock-rootfs-if-unset.patch | 37 - .../494-mtd-ubi-add-EOF-marker-support.patch | 51 - .../530-jffs2_make_lzma_available.patch | 5142 ------- .../pending-3.18/531-debloat_lzma.patch | 1024 -- .../pending-3.18/532-jffs2_eofdetect.patch | 56 - .../550-ubifs-symlink-xattr-support.patch | 55 - ...fs-fix-default-compression-selection.patch | 29 - .../600-netfilter_conntrack_flush.patch | 86 - ...etfilter_match_bypass_default_checks.patch | 101 - ...netfilter_match_bypass_default_table.patch | 94 - ...netfilter_match_reduce_memory_access.patch | 16 - ...-netfilter_optional_tcp_window_check.patch | 36 - .../616-net_optimize_xfrm_calls.patch | 12 - .../pending-3.18/621-sched_act_connmark.patch | 161 - .../pending-3.18/630-packet_socket_type.patch | 134 - .../640-bridge_no_eap_forward.patch | 23 - .../641-bridge_always_accept_eap.patch | 17 - .../642-bridge_port_isolate.patch | 107 - .../645-bridge_multicast_to_unicast.patch | 390 - .../pending-3.18/650-pppoe_header_pad.patch | 20 - .../651-wireless_mesh_header.patch | 11 - .../653-disable_netlink_trim.patch | 26 - .../pending-3.18/655-increase_skb_pad.patch | 11 - .../656-skb_reduce_truesize-helper.patch | 41 - .../657-qdisc_reduce_truesize.patch | 63 - .../pending-3.18/660-fq_codel_defaults.patch | 13 - .../661-fq_codel_keep_dropped_stats.patch | 10 - .../662-use_fq_codel_by_default.patch | 95 - .../pending-3.18/663-remove_pfifo_fast.patch | 143 - ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 481 - ...urce-specific-default-route-handling.patch | 96 - ...ng-with-source-address-failed-policy.patch | 249 - ...nes-for-_POLICY_FAILED-until-all-cod.patch | 53 - ...T-skip-GRO-for-foreign-MAC-addresses.patch | 160 - .../681-NET-add-of_get_mac_address_mtd.patch | 88 - .../generic/pending-3.18/700-swconfig.patch | 39 - .../pending-3.18/701-phy_extension.patch | 63 - .../702-phy_add_aneg_done_function.patch | 27 - ...detach-callback-to-struct-phy_driver.patch | 27 - ...710-phy-add-mdio_register_board_info.patch | 192 - .../pending-3.18/720-phy_adm6996.patch | 26 - .../pending-3.18/721-phy_packets.patch | 161 - .../pending-3.18/722-phy_mvswitch.patch | 23 - .../generic/pending-3.18/723-phy_ip175c.patch | 23 - .../generic/pending-3.18/724-phy_ar8216.patch | 24 - .../pending-3.18/725-phy_rtl8306.patch | 23 - .../pending-3.18/726-phy_rtl8366.patch | 45 - .../pending-3.18/727-phy-rtl8367.patch | 23 - .../pending-3.18/728-phy-rtl8367b.patch | 23 - .../generic/pending-3.18/729-phy-tantos.patch | 21 - .../generic/pending-3.18/730-phy_b53.patch | 21 - .../732-phy-ar8216-led-support.patch | 13 - .../pending-3.18/733-phy_mvsw61xx.patch | 23 - ...-at803x-allow-to-configure-via-pdata.patch | 180 - ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 96 - .../760-8139cp-fixes-from-4.3.patch | 365 - .../773-bgmac-add-srab-switch.patch | 72 - .../785-hso-support-0af0-9300.patch | 25 - .../810-pci_disable_common_quirks.patch | 51 - .../811-pci_disable_usb_common_quirks.patch | 101 - .../pending-3.18/821-usb-dwc2-dualrole.patch | 146 - .../pending-3.18/831-ledtrig_netdev.patch | 21 - .../pending-3.18/834-ledtrig-libata.patch | 153 - .../generic/pending-3.18/840-rtc7301.patch | 250 - .../pending-3.18/841-rtc_pt7c4338.patch | 247 - .../861-04_spi_gpio_implement_spi_delay.patch | 58 - .../pending-3.18/862-gpio_spi_driver.patch | 373 - .../pending-3.18/870-hifn795x_byteswap.patch | 17 - .../890-8250_optional_sysrq.patch | 24 - .../pending-3.18/901-debloat_sock_diag.patch | 65 - .../pending-3.18/902-debloat_proc.patch | 341 - .../pending-3.18/904-debloat_dma_buf.patch | 44 - .../pending-3.18/910-kobject_uevent.patch | 21 - .../911-kobject_add_broadcast_uevent.patch | 65 - .../921-use_preinit_as_init.patch | 12 - ...ays-create-console-node-in-initramfs.patch | 30 - .../generic/pending-3.18/930-crashlog.patch | 276 - ...e-filenames-from-deps_initramfs-list.patch | 29 - .../980-arm_openwrt_machtypes.patch | 32 - .../generic/pending-3.18/990-gpio_wdt.patch | 360 - .../pending-3.18/995-mangle_bootargs.patch | 58 - ...able_wilink_platform_without_drivers.patch | 15 - .../pending-3.18/999-seccomp_log.patch | 34 - ...problem-with-platfom-data-in-w1-gpio.patch | 38 + ...s-negative-stack-offsets-on-stack-tr.patch | 2 +- ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 2 +- ...-generic-parsing-of-linux-part-probe.patch | 8 +- ...ng-comment-related-to-link-detection.patch | 4 +- .../pending-4.14/201-extra_optimization.patch | 2 +- .../400-mtd-add-rootfs-split-support.patch | 10 +- ...for-different-partition-parser-types.patch | 2 +- ...arsers-for-rootfs-and-firmware-split.patch | 6 +- .../404-mtd-add-more-helper-functions.patch | 4 +- .../411-mtd-partial_eraseblock_write.patch | 2 +- ...check-for-bad-blocks-when-calculatin.patch | 3 +- .../479-mtd-spi-nor-add-eon-en25qh32.patch | 10 - ...mtd-device-named-ubi-or-data-on-boot.patch | 4 +- ...etfilter_match_bypass_default_checks.patch | 6 +- .../pending-4.14/630-packet_socket_type.patch | 6 +- ...w_table-add-hardware-offload-support.patch | 6 +- ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 36 +- ...ng-with-source-address-failed-policy.patch | 20 +- .../pending-4.14/701-phy_extension.patch | 12 +- ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 17 +- .../811-pci_disable_usb_common_quirks.patch | 2 +- .../pending-4.14/834-ledtrig-libata.patch | 2 +- ...y-serial-exar-generalize-rs485-setup.patch | 81 - .../pending-4.4/001-mtdsplit_backport.patch | 153 - .../002-phy_drivers_backport.patch | 640 - .../pending-4.4/003-myloader_backport.patch | 11 - ...dcode-path-to-awk-in-scripts-ld-vers.patch | 24 - .../pending-4.4/020-bcma-from-4.5.patch | 49 - .../pending-4.4/021-bcma-from-4.6.patch | 761 -- .../pending-4.4/022-bcma-from-4.8.patch | 52 - .../pending-4.4/023-bcma-from-4.9.patch | 108 - .../pending-4.4/025-bcma-from-4.11.patch | 85 - .../pending-4.4/026-bcma-from-4.12.patch | 47 - ...kb_cow_head-to-deal-with-cloned-skbs.patch | 40 - ...kb_cow_head-to-deal-with-cloned-skbs.patch | 38 - ...kb_cow_head-to-deal-with-cloned-skbs.patch | 43 - ...l-add-batch-ability-to-fq_codel_drop.patch | 189 - ...odel-add-memory-limitation-per-queue.patch | 182 - ...fq_codel-fix-memory-limitation-drift.patch | 40 - ...35-fq_codel-fix-NET_XMIT_CN-behavior.patch | 70 - ...ude-mtd.h-header-for-struct-mtd_info.patch | 39 - ...h-use-ioremap_cache-instead-of-KSEG0.patch | 138 - ...endency-for-MTD_BCM47XXSFLASH-symbol.patch | 41 - ...h-use-uncached-MMIO-access-for-BCM53.patch | 59 - ...flash-use-platform_-set-get-_drvdata.patch | 63 - ...h-support-reading-flash-out-of-mappi.patch | 81 - ...move-TRX-parsing-code-to-separated-f.patch | 180 - ...support-layouts-with-multiple-TRX-pa.patch | 112 - ...mx25l3205d-mx25l6405d-append-SECT_4K.patch | 27 - ...80-add-support-for-mmap-read-request.patch | 46 - ...nce-error-output-if-MS_SILENT-is-set.patch | 32 - ...ence-early-error-if-MS_SILENT-is-set.patch | 54 - ...i-nor-backport-SPI_NOR_HAS_LOCK-flag.patch | 47 - .../050-backport_netfilter_rtcache.patch | 531 - ...001-ovl-rename-is_merge-to-is_lowest.patch | 72 - ...ds-with-the-ones-from-the-superblock.patch | 336 - ...1-0005-ovl-proper-cleanup-of-workdir.patch | 131 - .../052-01-ubifs-Implement-O_TMPFILE.patch | 99 - ...2-02-ubifs-Implement-RENAME_WHITEOUT.patch | 343 - ...2-03-ubifs-Implement-RENAME_EXCHANGE.patch | 267 - ...fs-Use-move-variable-in-ubifs_rename.patch | 30 - ...imit-and-delta-fields-from-struct-ub.patch | 82 - ...writeback_interval-value-for-wbuf-ti.patch | 66 - .../060-mips_decompressor_memmove.patch | 22 - ...061-softirq-let-ksoftirqd-do-its-job.patch | 83 - ...mtd-nand-Add-Winbond-manufacturer-id.patch | 34 - ...bgmac-clarify-CONFIG_BCMA-dependency.patch | 46 - ...-checking-for-BCM4707-BCM53018-chip-.patch | 106 - ...port-Ethernet-device-on-BCM47094-SoC.patch | 39 - ...fix-MAC-soft-reset-bit-for-corerev-4.patch | 34 - ...device-with-backing-device-structure.patch | 25 - ...c-Add-support-for-ethtool-statistics.patch | 175 - ...gmac-Maintain-some-netdev-statistics.patch | 68 - ...ac-use-phydev-from-struct-net_device.patch | 105 - ...ac-change-bgmac_-prints-to-dev_-prin.patch | 407 - ...t-ethernet-bgmac-add-dma_dev-pointer.patch | 112 - ...ac-move-BCMA-MDIO-Phy-code-into-a-se.patch | 676 - ...ernet-bgmac-convert-to-feature-flags.patch | 384 - ...et-bgmac-Add-platform-device-support.patch | 1260 -- ...ac-Fix-return-value-check-in-bgmac_p.patch | 26 - ...ac-Remove-redundant-dev_err-call-in-.patch | 42 - ...versed-check-for-MII-registration-er.patch | 28 - ...pport-Ethernet-core-on-BCM53573-SoCs.patch | 161 - ...t-clear-when-setting-interface-type-.patch | 31 - ...-bgmac-Fix-errant-feature-flag-check.patch | 33 - ...pelling-mistake-connecton-connection.patch | 25 - ...versed-checks-for-clock-control-flag.patch | 35 - ...rsion-of-alloc_etherdev_mqs-function.patch | 70 - ...te-struct-bgmac-just-once-don-t-copy.patch | 139 - ...truct-bcma_mdio-we-don-t-need-anymor.patch | 274 - ...e-PHY-subsystem-for-initializing-PHY.patch | 53 - ...-master-mode-for-BCM54210E-and-B5021.patch | 50 - ...ET-PHY-adds-driver-for-lantiq-PHY11G.patch | 537 - ...-phy-update-Broadcom-drivers-to-v4.5.patch | 125 - ...-phy-update-Broadcom-drivers-to-v4.6.patch | 123 - ...ick-Broadcom-drivers-updates-from-v4.patch | 315 - ...ick-Broadcom-drivers-updates-from-v4.patch | 283 - ...ick-Broadcom-drivers-updates-from-v4.patch | 37 - ...celerated-read-support-for-spi-flash.patch | 179 - ...spi_flash_read-callback-for-MMIO-bas.patch | 157 - ...core-let-USB-device-know-device-node.patch | 179 - ...usb_alloc_dev-fix-setting-of-portnum.patch | 108 - ...vm_-clk_hw_-register-unregister-APIs.patch | 182 - ...0002-clk-Add-clk_hw-OF-clk-providers.patch | 234 - ...ore-Introduce-a-USB-port-LED-trigger.patch | 465 - ...-Use-proper-LED-API-to-fix-potential.patch | 70 - ...B-ports-from-DT-in-the-usbport-LED-t.patch | 106 - ...-Set-of_node-for-created-LED-devices.patch | 53 - ...leds-gpio-introduce-gpio_blink_set_t.patch | 61 - ...-to-managed-version-of-led_classdev_.patch | 75 - ...-variants-of-LED-registering-functio.patch | 120 - ...-variant-of-LED-registering-function.patch | 60 - ...al-Add-devm-version-of-thermal_zone_.patch | 143 - ...-export-apis-to-get-slope-and-offset.patch | 101 - ...5-add-thermal-driver-for-bcm2835-SoC.patch | 365 - ...roadcom-add-Northstar-thermal-driver.patch | 173 - ...-fix-compilation-of-Northstar-driver.patch | 19 - .../087-regmap-make-LZO-cache-optional.patch | 69 - ...e-IPI-calls-for-CM-indexed-cache-ops.patch | 317 - ...4k-Exclude-sibling-CPUs-in-SMP-calls.patch | 37 - ...appended-dtb-to-the-end-of-the-kerne.patch | 132 - ...e-appended-dtb-address-in-a-variable.patch | 132 - ...ize-calc-when-avoiding-IPIs-for-smal.patch | 38 - .../096-arc-add-model-property-in-dts.patch | 163 - .../097-MIPS-io.h-Define-ioremap_cache.patch | 29 - ...98-usb-dwc2-Remove-unnecessary-kfree.patch | 24 - ...fix-cache-flushing-for-highmem-pages.patch | 31 - .../pending-4.4/102-ehci_hcd_ignore_oc.patch | 82 - ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 86 - .../105-add-linux-spidev-compatible.patch | 15 - ..._value_cansleep-for-setting-chipsele.patch | 21 - ...ame2-and-add-RENAME_WHITEOUT-support.patch | 86 - ...11-jffs2-add-RENAME_EXCHANGE-support.patch | 81 - ...ge_allow_receiption_on_disabled_port.patch | 54 - .../pending-4.4/132-mips_inline_dma_ops.patch | 778 -- ...-generic-parsing-of-linux-part-probe.patch | 183 - ...support-for-ESMT_f25l32qa-and-ESMT_f.patch | 21 - ...dget-udc-net2280-add-usb2380-support.patch | 253 - ...-serial-console-directly-from-ChipCo.patch | 92 - .../pending-4.4/200-fix_localversion.patch | 11 - .../pending-4.4/201-extra_optimization.patch | 18 - .../pending-4.4/202-reduce_module_size.patch | 11 - .../203-kallsyms_uncompressed.patch | 108 - .../pending-4.4/204-module_strip.patch | 193 - .../205-backtrace_module_info.patch | 36 - .../pending-4.4/206-mips-disable-vdso.patch | 21 - ...-mips-vdso-dbg-rebuild-after-genvdso.patch | 29 - .../pending-4.4/208-disable-modorder.patch | 34 - .../210-darwin_scripts_include.patch | 3088 ----- .../pending-4.4/211-sign-file-libressl.patch | 16 - .../212-byteshift_portability.patch | 51 - .../214-spidev_h_portability.patch | 11 - .../generic/pending-4.4/220-gc_sections.patch | 536 - .../pending-4.4/221-module_exports.patch | 88 - .../pending-4.4/222-arm_zimage_none.patch | 133 - .../230-openwrt_lzma_options.patch | 58 - .../pending-4.4/250-netfilter_depends.patch | 18 - .../pending-4.4/251-sound_kconfig.patch | 18 - .../pending-4.4/252-mv_cesa_depends.patch | 10 - .../pending-4.4/253-ssb_b43_default_on.patch | 29 - .../254-textsearch_kconfig_hacks.patch | 23 - .../255-lib80211_kconfig_hacks.patch | 31 - .../256-crypto_add_kconfig_prompts.patch | 47 - .../257-wireless_ext_kconfig_hack.patch | 22 - .../258-netfilter_netlink_kconfig_hack.patch | 11 - .../pending-4.4/259-regmap_dynamic.patch | 90 - .../260-crypto_test_dependencies.patch | 48 - ...t-add-fallback-for-unsupported-libcs.patch | 130 - ...prevent-redefinition-of-struct-ethhd.patch | 55 - .../pending-4.4/280-rfkill-stubs.patch | 79 - .../300-mips_expose_boot_raw.patch | 39 - .../301-mips_image_cmdline_hack.patch | 28 - .../302-mips_no_branch_likely.patch | 11 - .../pending-4.4/304-mips_disable_fpu.patch | 106 - .../pending-4.4/305-mips_module_reloc.patch | 355 - .../306-mips_mem_functions_performance.patch | 83 - .../pending-4.4/307-mips_highmem_offset.patch | 17 - .../pending-4.4/308-mips32r2_tune.patch | 17 - .../310-arm_module_unresolved_weak_sym.patch | 13 - .../pending-4.4/320-ppc4xx_optimization.patch | 31 - .../321-powerpc_crtsavres_prereq.patch | 10 - ...t-command-line-parameters-from-users.patch | 298 - ...31-arc-remove-dependency-on-DEVTMPFS.patch | 31 - .../332-arc-add-OWRTDTB-section.patch | 82 - ...able-unaligned-access-in-kernel-mode.patch | 26 - .../400-mtd-add-rootfs-split-support.patch | 113 - ...for-different-partition-parser-types.patch | 113 - ...arsers-for-rootfs-and-firmware-split.patch | 71 - .../403-mtd-hook-mtdsplit-to-Kbuild.patch | 22 - .../404-mtd-add-more-helper-functions.patch | 101 - ...rward-declaration-of-struct-mtd_info.patch | 18 - .../411-mtd-partial_eraseblock_write.patch | 142 - .../412-mtd-partial_eraseblock_unlock.patch | 18 - .../pending-4.4/420-mtd-redboot_space.patch | 30 - ...30-mtd-add-myloader-partition-parser.patch | 35 - ...check-for-bad-blocks-when-calculatin.patch | 91 - ...bcm47xxpart-detect-T_Meter-partition.patch | 42 - .../pending-4.4/440-block2mtd_init.patch | 108 - .../pending-4.4/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 - ...mtd-spi-nor-add-macronix-mx25u25635f.patch | 10 - .../476-mtd-spi-nor-add-eon-en25q128.patch | 10 - .../477-mtd-add-spi-nor-add-mx25u3235f.patch | 10 - ...479-enable_mtd_has_lock_for_f25l32pa.patch | 22 - .../480-mtd-set-rootfs-to-be-root-dev.patch | 26 - ...mtd-device-named-ubi-or-data-on-boot.patch | 76 - ...to-create-ubiblock-device-for-rootfs.patch | 69 - ...ting-ubi0-rootfs-in-init-do_mounts.c.patch | 54 - ...ROOT_DEV-to-ubiblock-rootfs-if-unset.patch | 37 - .../494-mtd-ubi-add-EOF-marker-support.patch | 51 - .../530-jffs2_make_lzma_available.patch | 5142 ------- .../pending-4.4/531-debloat_lzma.patch | 1024 -- .../pending-4.4/532-jffs2_eofdetect.patch | 56 - ...fs-fix-default-compression-selection.patch | 29 - .../600-netfilter_conntrack_flush.patch | 86 - ...etfilter_match_bypass_default_checks.patch | 101 - ...netfilter_match_bypass_default_table.patch | 111 - ...netfilter_match_reduce_memory_access.patch | 16 - ...-netfilter_optional_tcp_window_check.patch | 36 - .../616-net_optimize_xfrm_calls.patch | 12 - ...del-do-not-defer-queue-length-update.patch | 86 - .../pending-4.4/630-packet_socket_type.patch | 134 - .../640-bridge_no_eap_forward.patch | 23 - .../641-bridge_always_accept_eap.patch | 17 - .../pending-4.4/642-bridge_port_isolate.patch | 107 - .../645-bridge_multicast_to_unicast.patch | 420 - .../651-wireless_mesh_header.patch | 11 - .../653-disable_netlink_trim.patch | 27 - .../pending-4.4/655-increase_skb_pad.patch | 11 - .../pending-4.4/660-fq_codel_defaults.patch | 11 - .../661-fq_codel_keep_dropped_stats.patch | 10 - .../662-use_fq_codel_by_default.patch | 95 - .../pending-4.4/663-remove_pfifo_fast.patch | 142 - ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 496 - ...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 | 128 - .../generic/pending-4.4/700-swconfig.patch | 39 - .../pending-4.4/701-phy_extension.patch | 63 - .../702-phy_add_aneg_done_function.patch | 27 - ...detach-callback-to-struct-phy_driver.patch | 27 - ...710-phy-add-mdio_register_board_info.patch | 193 - .../generic/pending-4.4/720-phy_adm6996.patch | 26 - .../generic/pending-4.4/721-phy_packets.patch | 161 - .../pending-4.4/722-phy_mvswitch.patch | 23 - .../generic/pending-4.4/723-phy_ip175c.patch | 23 - .../generic/pending-4.4/724-phy_ar8216.patch | 24 - .../generic/pending-4.4/725-phy_rtl8306.patch | 23 - .../generic/pending-4.4/726-phy_rtl8366.patch | 45 - .../generic/pending-4.4/727-phy-rtl8367.patch | 23 - .../pending-4.4/728-phy-rtl8367b.patch | 23 - .../generic/pending-4.4/729-phy-tantos.patch | 21 - .../generic/pending-4.4/730-phy_b53.patch | 21 - .../732-phy-ar8216-led-support.patch | 13 - .../pending-4.4/733-phy_mvsw61xx.patch | 23 - ...-at803x-allow-to-configure-via-pdata.patch | 180 - ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 96 - .../736-at803x-fix-reset-handling.patch | 43 - ...equest-reset-GPIO-only-for-AT8030-PH.patch | 42 - ...nly-the-AT8030-needs-a-hardware-rese.patch | 81 - ...et-phy-at803x-add-support-for-AT8032.patch | 65 - .../773-bgmac-add-srab-switch.patch | 88 - .../810-pci_disable_common_quirks.patch | 51 - .../811-pci_disable_usb_common_quirks.patch | 101 - ...ove-annoying-warning-about-bogus-URB.patch | 78 - .../pending-4.4/831-ledtrig_netdev.patch | 21 - .../pending-4.4/834-ledtrig-libata.patch | 153 - .../pending-4.4/835-misc-owl_loader.patch | 31 - .../generic/pending-4.4/840-rtc7301.patch | 250 - .../pending-4.4/841-rtc_pt7c4338.patch | 247 - .../861-04_spi_gpio_implement_spi_delay.patch | 58 - .../pending-4.4/862-gpio_spi_driver.patch | 373 - .../pending-4.4/890-uart_optional_sysrq.patch | 25 - .../pending-4.4/901-debloat_sock_diag.patch | 79 - .../pending-4.4/902-debloat_proc.patch | 385 - .../pending-4.4/904-debloat_dma_buf.patch | 44 - .../pending-4.4/910-kobject_uevent.patch | 21 - .../911-kobject_add_broadcast_uevent.patch | 65 - .../pending-4.4/921-use_preinit_as_init.patch | 12 - ...ays-create-console-node-in-initramfs.patch | 30 - .../generic/pending-4.4/930-crashlog.patch | 317 - ...e-filenames-from-deps_initramfs-list.patch | 29 - .../pending-4.4/995-mangle_bootargs.patch | 58 - ...able_wilink_platform_without_drivers.patch | 15 - ...problem-with-platfom-data-in-w1-gpio.patch | 38 + ...e_mem_map-with-ARCH_PFN_OFFSET-calcu.patch | 2 +- ...-generic-parsing-of-linux-part-probe.patch | 8 +- ...et-phy-at803x-add-support-for-AT8032.patch | 70 + .../pending-4.9/201-extra_optimization.patch | 2 +- .../pending-4.9/305-mips_module_reloc.patch | 11 +- .../pending-4.9/308-mips32r2_tune.patch | 2 +- .../400-mtd-add-rootfs-split-support.patch | 10 +- ...for-different-partition-parser-types.patch | 2 +- ...arsers-for-rootfs-and-firmware-split.patch | 6 +- .../404-mtd-add-more-helper-functions.patch | 4 +- .../411-mtd-partial_eraseblock_write.patch | 2 +- ...check-for-bad-blocks-when-calculatin.patch | 7 +- ...bcm47xxpart-detect-T_Meter-partition.patch | 4 +- .../479-mtd-spi-nor-add-eon-en25qh32.patch | 10 - ...mtd-device-named-ubi-or-data-on-boot.patch | 4 +- ...etfilter_match_bypass_default_checks.patch | 6 +- .../pending-4.9/630-packet_socket_type.patch | 6 +- ...Add-support-for-MAP-E-FMRs-mesh-mode.patch | 24 +- ...ng-with-source-address-failed-policy.patch | 20 +- ...-at803x-allow-to-configure-via-pdata.patch | 12 +- ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 17 +- .../pending-4.9/834-ledtrig-libata.patch | 2 +- .../pending-4.9/890-uart_optional_sysrq.patch | 2 +- target/linux/imx6/config-4.14 | 7 - target/linux/ipq40xx/Makefile | 4 +- .../ipq40xx/base-files/etc/board.d/01_leds | 18 +- .../ipq40xx/base-files/etc/board.d/02_network | 31 +- target/linux/ipq40xx/base-files/etc/diag.sh | 4 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 13 +- .../etc/hotplug.d/net/16_adjust_network | 7 - .../base-files/etc/init.d/adjust_network | 18 - .../ipq40xx/base-files/lib/adjust_network.sh | 86 - .../lib/preinit/05_set_iface_mac_ipq40xx.sh | 6 - .../base-files/lib/upgrade/platform.sh | 168 +- .../arch/arm/boot/dts/qcom-ipq4018-a42.dts | 14 +- .../arm/boot/dts/qcom-ipq4018-jalapeno.dts | 12 +- .../arm/boot/dts/qcom-ipq4018-wre6606.dts | 261 + .../arm/boot/dts/qcom-ipq4019-rt-acrh17.dts | 234 - .../arch/arm/boot/dts/qcom-ipq4028-wpj428.dts | 14 +- .../arm/boot/dts/qcom-ipq4029-gl-b1300.dts | 4 - target/linux/ipq40xx/image/Makefile | 30 +- ...am-Process-multiple-pending-descript.patch | 22 +- ...pport-for-command-descriptor-formati.patch | 2 +- ...-Add-a-NULL-check-for-devm_kasprintf.patch | 26 - .../069-arm-boot-add-dts-files.patch | 2 +- ...dd-quirk-to-autoload-ubi-on-rt-ac58u.patch | 2 +- ...essedma-fixup-ethernet-driver-rx-bug.patch | 144 - ...xq-to-be-adaptive-of-cpus-and-netdev.patch | 223 - ...essedma-disable-default-vlan-tagging.patch | 82 - .../902-essedma-alloc-skb-ip-align.patch | 21 + .../997-device_tree_cmdline.patch | 14 +- target/linux/ipq806x/Makefile | 2 +- .../ipq806x/base-files/etc/board.d/01_leds | 5 + .../ipq806x/base-files/etc/board.d/02_network | 14 +- .../etc/hotplug.d/firmware/11-ath10k-caldata | 2 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 3 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/ipq806x/config-4.14 | 3 +- target/linux/ipq806x/config-4.9 | 492 - .../arch/arm/boot/dts/qcom-ipq8064-d7800.dts | 6 +- .../arch/arm/boot/dts/qcom-ipq8064-r7500.dts | 5 - .../arm/boot/dts/qcom-ipq8064-r7500v2.dts | 5 - .../arm/boot/dts/qcom-ipq8064-wg2600hp.dts} | 196 +- .../arch/arm/boot/dts/qcom-ipq8065-r7800.dts | 13 +- .../arch/arm/boot/dts/qcom-ipq8064-ap148.dts | 250 - .../arch/arm/boot/dts/qcom-ipq8064-c2600.dts | 500 - .../arch/arm/boot/dts/qcom-ipq8064-d7800.dts | 419 - .../arch/arm/boot/dts/qcom-ipq8064-db149.dts | 236 - .../arch/arm/boot/dts/qcom-ipq8064-ea8500.dts | 406 - .../arch/arm/boot/dts/qcom-ipq8064-r7500.dts | 394 - .../arm/boot/dts/qcom-ipq8064-r7500v2.dts | 425 - .../arch/arm/boot/dts/qcom-ipq8064-wpq864.dts | 570 - .../arch/arm/boot/dts/qcom-ipq8064.dtsi | 1333 -- .../arm/boot/dts/qcom-ipq8065-nbg6817.dts | 393 - .../arch/arm/boot/dts/qcom-ipq8065-r7800.dts | 575 - .../arch/arm/boot/dts/qcom-ipq8065-v1.0.dtsi | 1 - .../arch/arm/boot/dts/qcom-ipq8065.dtsi | 164 - target/linux/ipq806x/image/Makefile | 22 +- ...lit-out-register-accessors-for-reuse.patch | 6 +- .../0069-arm-boot-add-dts-files.patch | 3 +- .../105-mtd-nor-add-mx25l25635f.patch | 2 +- ...ings-qcom_adm-Fix-channel-specifiers.patch | 71 - .../0002-dmaengine-Add-ADM-driver.patch | 966 -- ...ke-sure-mode-is-only-determined-once.patch | 208 - ...i-qup-Fix-transaction-done-signaling.patch | 29 - ...i-qup-Fix-DMA-mode-to-work-correctly.patch | 219 - ...qup-Fix-block-mode-to-work-correctly.patch | 310 - ...qup-properly-detect-extra-interrupts.patch | 61 - ...-read-opflags-to-see-if-transaction-.patch | 26 - ...r-spi_qup_io_config-in-two-functions.patch | 202 - ...-io_config-in-mode-specific-function.patch | 391 - ...ock-mode-to-generate-multiple-transa.patch | 268 - ...-spi_qup_prep_sg-to-be-more-take-spe.patch | 73 - ...litple-DMA-transactions-per-spi-xfer.patch | 166 - ...014-spi-qup-Fix-sg-nents-calculation.patch | 86 - ...-qcom-Add-support-for-SMD-RPM-Clocks.patch | 731 - ...-clk-qcom-Add-support-for-RPM-Clocks.patch | 587 - ...k-qcom-clk-rpm-Fix-clk_hw-references.patch | 94 - ...0030-clk-Disable-i2c-device-on-gsbi4.patch | 40 - ...d-add-SMEM-parser-for-QCOM-platforms.patch | 282 - .../0032-phy-add-qcom-dwc3-phy.patch | 617 - ...ically-select-PCI_DOMAINS-if-PCI-is-.patch | 29 - ...Krait-L2-register-accessor-functions.patch | 147 - ...lit-out-register-accessors-for-reuse.patch | 195 - ...pport-for-High-Frequency-PLLs-HFPLLs.patch | 352 - .../0039-clk-qcom-Add-HFPLL-driver.patch | 206 - .../0040-clk-qcom-Add-IPQ806X-s-HFPLLs.patch | 129 - ...lk-qcom-Add-support-for-Krait-clocks.patch | 241 - ...042-clk-qcom-Add-KPSS-ACC-GCC-driver.patch | 209 - ...om-Add-Krait-clock-controller-driver.patch | 436 - .../0044-clk-Add-safe-switch-hook.patch | 160 - ...le-to-register-cpufreq-on-Krait-CPUs.patch | 307 - ...cpufreq-qcom-independent-core-clocks.patch | 66 - ...a-BBT-flag-to-access-bad-block-marke.patch | 72 - ...ow-to-set-regulator-without-opp_list.patch | 27 - ...rt-adjusting-OPP-voltages-at-runtime.patch | 147 - ...ers-to-call-dev_pm_opp_get_-voltage-.patch | 107 - ...per-to-get-an-opp-regulator-for-devi.patch | 52 - ...e-voltage-tolerance-when-adjusting-t.patch | 38 - .../0053-regulator-add-smb208-support.patch | 55 - ...-dt-Handle-OPP-voltage-adjust-events.patch | 144 - ...-dt-Add-L2-frequency-scaling-support.patch | 90 - ...056-cpufreq-dt-Add-missing-rcu-locks.patch | 23 - ...lways-add-factor-clock-for-xo-clocks.patch | 38 - ...le-Add-cpuidle-support-for-QCOM-cpus.patch | 29 - ...arch-arm-force-ZRELADDR-on-arch-qcom.patch | 62 - ...conflicts-with-OpenWrt-auto-mounting.patch | 23 - ...ed-the-enable-regs-and-mask-for-PRNG.patch | 25 - .../0063-1-ipq806x-tsens-driver.patch | 627 - ...sens-support-configurable-interrupts.patch | 462 - .../patches-4.9/0064-clk-clk-rpm-fixes.patch | 93 - .../0065-arm-override-compiler-flags.patch | 21 - ...Mangle-bootloader-s-kernel-arguments.patch | 189 - .../0068-spi-add-gpio-cs-support.patch | 71 - .../0069-arm-boot-add-dts-files.patch | 28 - .../0070-qcom-spm-fix-probe-order.patch | 16 - ...I-qcom-Fixed-IPQ806x-specific-clocks.patch | 95 - ...com-Fixed-IPQ806x-PCIE-reset-changes.patch | 85 - ...qcom-Fixed-IPQ806x-PCIE-init-changes.patch | 127 - ...-PCIE-designware-Fixed-PCI-host-init.patch | 68 - ...rogramming-the-PCIE-iATU-for-IPQ806x.patch | 113 - .../0071-6-PCI-qcom-Force-GEN1-support.patch | 61 - ...7-pcie-Set-PCIE-MRRS-and-MPS-to-256B.patch | 69 - ...qcom-Fixed-pcie_phy_clk-branch-issue.patch | 91 - ...nge-duplicate-pci-reset-to-phy-reset.patch | 25 - ...clock-to-be-enabled-disabled-for-ipq.patch | 166 - ...e-scm_call-to-route-GPIO-irq-to-Apps.patch | 166 - ...ipq806x-usb-Control-USB-master-reset.patch | 71 - ...nd-add-Winbond-manufacturer-and-chip.patch | 38 - .../105-mtd-nor-add-mx25l25635f.patch | 22 - .../310-msm-adhoc-bus-support.patch | 11026 ---------------- .../850-soc-add-qualcomm-syscon.patch | 177 - .../patches-4.9/160-delayed_uart_io.patch | 10 +- .../patches-4.9/600-skb_avoid_dmabounce.patch | 2 +- target/linux/kirkwood/config-4.14 | 7 - target/linux/kirkwood/image/Makefile | 4 +- target/linux/lantiq/Makefile | 2 +- target/linux/lantiq/ase/config-4.9 | 24 + .../lantiq/base-files/etc/board.d/01_leds | 4 - .../lantiq/base-files/etc/board.d/02_network | 11 +- .../etc/hotplug.d/firmware/12-ath9k-eeprom | 24 +- .../lantiq/base-files/lib/upgrade/platform.sh | 8 +- .../{ath79/config-4.14 => lantiq/config-4.9} | 116 +- target/linux/lantiq/falcon/config-4.9 | 10 + .../files-4.14/arch/mips/boot/dts/ACMP252.dts | 2 +- .../arch/mips/boot/dts/ARV4518PWR01.dtsi | 2 +- .../arch/mips/boot/dts/ARV4519PW.dts | 2 +- .../arch/mips/boot/dts/ARV4520PW.dts | 2 +- .../arch/mips/boot/dts/ARV452CQW.dts | 2 +- .../arch/mips/boot/dts/ARV7510PW22.dts | 2 +- .../arch/mips/boot/dts/ARV7518PW.dts | 2 +- .../arch/mips/boot/dts/ARV7519RW22.dts | 4 +- .../arch/mips/boot/dts/ARV752DPW.dts | 2 +- .../arch/mips/boot/dts/ARV752DPW22.dts | 2 +- .../arch/mips/boot/dts/ARV8539PW22.dts | 2 +- .../arch/mips/boot/dts/BTHOMEHUBV3A.dts | 2 +- .../arch/mips/boot/dts/BTHOMEHUBV5A.dts | 2 +- .../arch/mips/boot/dts/EASY80920.dtsi | 2 +- .../mips/boot/dts/FRITZ3370-REV2-HYNIX.dts | 55 - .../mips/boot/dts/FRITZ3370-REV2-MICRON.dts | 53 - .../{FRITZ3370-REV2.dtsi => FRITZ3370.dts} | 129 +- .../arch/mips/boot/dts/GIGASX76X.dts | 2 +- .../files-4.14/arch/mips/boot/dts/H201L.dts | 2 +- .../arch/mips/boot/dts/P2601HNFX.dts | 2 +- .../arch/mips/boot/dts/P2812HNUFX.dtsi | 4 +- .../arch/mips/boot/dts/TDW89X0.dtsi | 4 +- .../arch/mips/boot/dts/VGV7510KW22.dtsi | 2 +- .../arch/mips/boot/dts/VGV7519.dtsi | 4 +- .../files-4.14/arch/mips/boot/dts/VR200v.dts | 4 +- .../files-4.14/arch/mips/boot/dts/WBMR.dts | 2 +- .../files-4.14/arch/mips/boot/dts/WBMR300.dts | 4 +- .../files-4.9/arch/mips/boot/dts/ACMP252.dts | 102 + .../arch/mips/boot/dts/ALL0333CJ.dts | 120 + .../arch/mips/boot/dts/ARV4510PW.dts | 232 + .../arch/mips/boot/dts/ARV4518PWR01.dts | 8 + .../arch/mips/boot/dts/ARV4518PWR01.dtsi | 198 + .../arch/mips/boot/dts/ARV4518PWR01A.dts | 14 + .../arch/mips/boot/dts/ARV4519PW.dts | 195 + .../arch/mips/boot/dts/ARV4520PW.dts | 221 + .../arch/mips/boot/dts/ARV4525PW.dts | 169 + .../arch/mips/boot/dts/ARV452CQW.dts | 237 + .../arch/mips/boot/dts/ARV7506PW11.dts | 165 + .../arch/mips/boot/dts/ARV7510PW22.dts | 196 + .../arch/mips/boot/dts/ARV7518PW.dts | 232 + .../arch/mips/boot/dts/ARV7519PW.dts | 229 + .../arch/mips/boot/dts/ARV7519RW22.dts | 231 + .../arch/mips/boot/dts/ARV7525PW.dts | 155 + .../arch/mips/boot/dts/ARV752DPW.dts | 238 + .../arch/mips/boot/dts/ARV752DPW22.dts | 259 + .../arch/mips/boot/dts/ARV8539PW22.dts | 180 + .../files-4.9/arch/mips/boot/dts/ASL56026.dts | 171 + .../arch/mips/boot/dts/BTHOMEHUBV2B.dts | 262 + .../arch/mips/boot/dts/BTHOMEHUBV3A.dts | 208 + .../arch/mips/boot/dts/BTHOMEHUBV5A.dts | 282 + .../files-4.9/arch/mips/boot/dts/DGN1000B.dts | 171 + .../files-4.9/arch/mips/boot/dts/DGN3500.dts | 8 + .../files-4.9/arch/mips/boot/dts/DGN3500.dtsi | 213 + .../files-4.9/arch/mips/boot/dts/DGN3500B.dts | 8 + .../files-4.9/arch/mips/boot/dts/DM200.dts | 215 + .../arch/mips/boot/dts/EASY50712.dts | 83 + .../arch/mips/boot/dts/EASY50810.dts | 93 + .../arch/mips/boot/dts/EASY80920.dtsi | 298 + .../arch/mips/boot/dts/EASY80920NAND.dts | 68 + .../arch/mips/boot/dts/EASY80920NOR.dts | 43 + .../arch/mips/boot/dts/EASY88388.dts | 106 + .../arch/mips/boot/dts/EASY88444.dts | 80 + .../arch/mips/boot/dts/EASY98000-base.dtsi | 110 + .../arch/mips/boot/dts/EASY98000NAND.dts | 40 + .../arch/mips/boot/dts/EASY98000NOR.dts | 38 + .../arch/mips/boot/dts/EASY98000SFLASH.dts | 16 + .../arch/mips/boot/dts/EASY98020.dts | 95 + .../arch/mips/boot/dts/EASY98020V18.dts | 68 + .../arch/mips/boot/dts/EASY98021.dts | 81 + .../arch/mips/boot/dts/EASY98035SYNCE.dts | 76 + .../arch/mips/boot/dts/EASY98035SYNCE1588.dts | 76 + .../arch/mips/boot/dts/FALCON-MDU.dts | 53 + .../arch/mips/boot/dts/FALCON-SFP.dts | 76 + .../arch/mips/boot/dts/FRITZ3370.dts | 288 + .../arch/mips/boot/dts/FRITZ7320.dts | 161 + .../arch/mips/boot/dts/FRITZ7360SL.dts | 228 + .../arch/mips/boot/dts/GIGASX76X.dts | 122 + .../files-4.9/arch/mips/boot/dts/H201L.dts | 159 + .../arch/mips/boot/dts/P2601HNFX.dts | 190 + .../arch/mips/boot/dts/P2812HNUF1.dts | 72 + .../arch/mips/boot/dts/P2812HNUF3.dts | 66 + .../arch/mips/boot/dts/P2812HNUFX.dtsi | 280 + .../files-4.9/arch/mips/boot/dts/TDW8970.dts | 8 + .../files-4.9/arch/mips/boot/dts/TDW8980.dts | 35 + .../files-4.9/arch/mips/boot/dts/TDW89X0.dtsi | 274 + .../files-4.9/arch/mips/boot/dts/VG3503J.dts | 163 + .../arch/mips/boot/dts/VGV7510KW22.dtsi | 253 + .../arch/mips/boot/dts/VGV7510KW22BRN.dts | 67 + .../arch/mips/boot/dts/VGV7510KW22NOR.dts | 33 + .../files-4.9/arch/mips/boot/dts/VGV7519.dtsi | 298 + .../arch/mips/boot/dts/VGV7519BRN.dts | 73 + .../arch/mips/boot/dts/VGV7519NOR.dts | 32 + .../files-4.9/arch/mips/boot/dts/VR200v.dts | 283 + .../files-4.9/arch/mips/boot/dts/WBMR.dts | 185 + .../files-4.9/arch/mips/boot/dts/WBMR300.dts | 306 + .../arch/mips/boot/dts/amazonse.dtsi | 174 + .../files-4.9/arch/mips/boot/dts/ar9.dtsi | 216 + .../files-4.9/arch/mips/boot/dts/danube.dtsi | 212 + .../arch/mips/boot/dts/falcon-sflash-16M.dtsi | 37 + .../files-4.9/arch/mips/boot/dts/falcon.dtsi | 392 + .../files-4.9/arch/mips/boot/dts/vr9.dtsi | 260 + target/linux/lantiq/image/Makefile | 26 +- ...gpio-stp-xway-Implement-get-callback.patch | 47 + .../0001-MIPS-lantiq-add-pcie-driver.patch | 5520 ++++++++ ...gpio-stp-xway-Implement-get-callback.patch | 47 + .../0004-MIPS-lantiq-add-atm-hack.patch | 500 + ...-MIPS-lantiq-backport-old-timer-code.patch | 1034 ++ .../0018-MTD-nand-lots-of-xrx200-fixes.patch | 122 + ...antiq-handle-NO_XIP-on-cfi0001-flash.patch | 25 + ...25p80-allow-loading-mtd-name-from-OF.patch | 44 + ...ET-PHY-adds-driver-for-lantiq-PHY11G.patch | 294 + ...ET-lantiq-adds-PHY11G-firmware-blobs.patch | 364 + ...0025-NET-MIPS-lantiq-adds-xrx200-net.patch | 3394 +++++ .../0026-NET-multi-phy-support.patch | 53 + ...hy-intel-xway-add-VR9-version-number.patch | 62 + ...-phy-intel-xway-add-VR9-v1.1-phy-ids.patch | 71 + .../0028-NET-lantiq-various-etop-fixes.patch | 880 ++ .../0030-GPIO-add-named-gpio-exports.patch} | 84 +- ...PS-lantiq-add-FALC-ON-i2c-bus-master.patch | 1034 ++ ...iq-wifi-and-ethernet-eeprom-handling.patch | 219 + .../0040-USB-DWC2-enable-usb-power-gpio.patch | 35 + ...42-arch-mips-increase-io_space_limit.patch | 23 + ...-fix-copy-paste-error-in-xrx200_grps.patch | 11 + .../lantiq/patches-4.9/0047-poweroff.patch | 23 + ...0-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch | 87 + ...e-lantiq-settings-match-vendor-drive.patch | 130 + ...PS-lantiq-improve-USB-initialization.patch | 202 + ...dd-support-for-Lantiq-SSC-SPI-contro.patch | 1078 ++ ...ix-platform_no_drv_owner.cocci-warni.patch | 28 + ...antiq-ssc-add-LTQ_-prefix-to-defines.patch | 723 + .../patches-4.9/0101-find_active_root.patch | 93 + .../0151-lantiq-ifxmips_pcie-use-of.patch | 166 + .../lantiq/patches-4.9/0152-lantiq-VPE.patch | 180 + .../0154-lantiq-pci-bar11mask-fix.patch | 22 + .../patches-4.9/0155-lantiq-VPE-nosmp.patch | 14 + .../0160-owrt-lantiq-multiple-flash.patch | 221 + ...q-lock-DMA-register-accesses-for-SMP.patch | 152 + ...-cmdset-0001-disable-buffered-writes.patch | 11 + ...add-gphy-clk-src-device-tree-binding.patch | 30 + .../0302-xrx200-add-sensors-driver.patch | 184 + target/linux/lantiq/xrx200/config-4.9 | 90 + target/linux/lantiq/xway/config-4.9 | 48 + target/linux/lantiq/xway_legacy/config-4.9 | 37 + target/linux/layerscape/armv8_64b/config-4.9 | 3 + .../202-core-linux-support-layerscape.patch | 6 +- .../401-mtd-spi-nor-support-layerscape.patch | 24 +- .../402-mtd-support-layerscape.patch | 2 +- .../702-pci-support-layerscape.patch | 2 +- .../703-phy-support-layerscape.patch | 2 +- .../809-i2c-support-layerscape.patch | 10 +- .../810-iommu-support-layerscape.patch | 8 +- .../817-usb-support-layerscape.patch | 10 +- target/linux/mcs814x/Makefile | 31 - .../mcs814x/base-files/etc/board.d/01_leds | 27 - .../mcs814x/base-files/etc/board.d/02_network | 12 - .../linux/mcs814x/base-files/lib/mcs814x.sh | 33 - .../lib/preinit/01_preinit_do_mcs814x.sh | 9 - target/linux/mcs814x/config-3.18 | 236 - .../arch/arm/boot/dts/dlan-usb-extender.dts | 68 - .../files-3.18/arch/arm/boot/dts/mcs8140.dtsi | 189 - .../files-3.18/arch/arm/boot/dts/rbt-832.dts | 89 - .../files-3.18/arch/arm/mach-mcs814x/Kconfig | 29 - .../files-3.18/arch/arm/mach-mcs814x/Makefile | 5 - .../arch/arm/mach-mcs814x/Makefile.boot | 4 - .../arch/arm/mach-mcs814x/board-mcs8140-dt.c | 45 - .../files-3.18/arch/arm/mach-mcs814x/clock.c | 271 - .../files-3.18/arch/arm/mach-mcs814x/common.c | 166 - .../files-3.18/arch/arm/mach-mcs814x/common.h | 16 - .../arch/arm/mach-mcs814x/include/mach/cpu.h | 16 - .../mach-mcs814x/include/mach/debug-macro.S | 11 - .../mach-mcs814x/include/mach/entry-macro.S | 6 - .../arch/arm/mach-mcs814x/include/mach/gpio.h | 21 - .../arm/mach-mcs814x/include/mach/hardware.h | 16 - .../arch/arm/mach-mcs814x/include/mach/io.h | 27 - .../arch/arm/mach-mcs814x/include/mach/irqs.h | 17 - .../arm/mach-mcs814x/include/mach/mcs814x.h | 53 - .../arm/mach-mcs814x/include/mach/param.h | 15 - .../arm/mach-mcs814x/include/mach/system.h | 18 - .../arm/mach-mcs814x/include/mach/timex.h | 18 - .../mach-mcs814x/include/mach/uncompress.h | 40 - .../files-3.18/arch/arm/mach-mcs814x/irq.c | 94 - .../files-3.18/arch/arm/mach-mcs814x/timer.c | 132 - .../drivers/char/hw_random/mcs814x-rng.c | 121 - .../files-3.18/drivers/gpio/gpio-mcs814x.c | 148 - .../drivers/net/ethernet/mcs8140/Kconfig | 4 - .../drivers/net/ethernet/mcs8140/Makefile | 3 - .../drivers/net/ethernet/mcs8140/nuport_mac.c | 1206 -- .../files-3.18/drivers/net/phy/mcs814x.c | 64 - .../drivers/usb/host/ehci-mcs814x.c | 163 - .../drivers/usb/host/ohci-mcs814x.c | 202 - .../files-3.18/drivers/watchdog/mcs814x_wdt.c | 207 - target/linux/mcs814x/image/Makefile | 60 - target/linux/mcs814x/modules.mk | 20 - .../mcs814x/patches-3.18/001-platform.patch | 64 - .../mcs814x/patches-3.18/003-ethernet.patch | 16 - .../linux/mcs814x/patches-3.18/004-usb.patch | 28 - .../patches-3.18/005-mcs814x_rng.patch | 31 - .../patches-3.18/006-mcs814x_wdt.patch | 25 - .../patches-3.18/008-mcs814x_gpio.patch | 25 - .../011-mcs814x_internal_phy.patch | 20 - ...mtd-cfi_cmdset_0002-force-word-write.patch | 14 - .../patches-3.18/013-ohci_workarounds.patch | 64 - .../mcs814x/patches-3.18/014-debuguart.patch | 41 - target/linux/mcs814x/profiles/000-Generic.mk | 16 - .../mcs814x/profiles/100-dLAN-USB-Extender.mk | 25 - target/linux/mediatek/image/Makefile | 14 +- target/linux/mediatek/mt7622/config-4.14 | 2 +- target/linux/mediatek/mt7622/target.mk | 1 - .../0012-clk-dont-disable-unused-clocks.patch | 2 +- .../patches-4.14/0033-dsa-multi-cpu.patch | 4 +- .../patches-4.14/0052-net-phy-add-FC.patch | 2 +- .../mediatek/patches-4.14/0064-dts.patch | 14 +- ...y-phy-mtk-tphy-add-set_mode-callback.patch | 6 +- ...-use-auto-instead-of-force-to-bypass.patch | 75 - ...low-imod-interval-to-be-configurable.patch | 2 +- .../arch/powerpc/boot/dts/tl-wdr4900-v1.dts | 24 + .../mvebu/base-files/etc/board.d/02_network | 9 - target/linux/mvebu/base-files/lib/mvebu.sh | 9 - target/linux/mvebu/config-4.14 | 1 + target/linux/mvebu/cortexa53/config-default | 1 + target/linux/mvebu/cortexa72/config-default | 1 + .../mvebu/image/armada-3720-db.bootscript | 10 - target/linux/mvebu/image/cortex-a53.mk | 13 - target/linux/mvebu/image/cortex-a72.mk | 26 - ...eeprom-ethtool-access-into-netdev-co.patch | 2 +- ...fp-use-netdev-sfp_bus-for-start-stop.patch | 4 +- ...8-cpufreq-armada-37xx-Fix-clock-leak.patch | 35 + ...ark-allow-to-specify-link-capability.patch | 43 + ...-3720-espressobin-set-max-link-to-ge.patch | 73 + target/linux/mxs/config-4.14 | 6 - target/linux/octeon/config-4.14 | 7 - .../base-files/etc/board.d/02_network | 0 target/linux/octeontx/config-4.14 | 10 +- target/linux/omap/config-4.14 | 1 - target/linux/omap24xx/Makefile | 26 - .../omap24xx/base-files/etc/config/fstab | 13 - .../omap24xx/base-files/etc/config/network | 15 - .../omap24xx/base-files/etc/config/wireless | 20 - .../etc/hotplug.d/firmware/10-bme-pmm-image | 17 - .../etc/hotplug.d/firmware/20-p54spi-eeprom | 32 - .../omap24xx/base-files/etc/init.d/watchdog | 17 - target/linux/omap24xx/base-files/etc/inittab | 5 - .../linux/omap24xx/base-files/etc/pointercal | 1 - .../base-files/lib/firmware/bc4fw.bin | Bin 2034 -> 0 bytes target/linux/omap24xx/config-4.1 | 290 - target/linux/omap24xx/image/Makefile | 27 - target/linux/omap24xx/modules.mk | 83 - target/linux/omap24xx/profiles/100-n810.mk | 31 - .../linux/omap24xx/profiles/110-n810-gui.mk | 22 - .../oxnas/patches-4.14/999-libata-hacks.patch | 4 +- target/linux/pistachio/config-4.14 | 7 - ...or-support-mtd-name-from-device-tree.patch | 4 +- target/linux/ppc40x/Makefile | 26 - .../ppc40x/base-files/lib/preinit/01_sysinfo | 12 - .../ppc40x/base-files/lib/upgrade/platform.sh | 35 - target/linux/ppc40x/config-3.18 | 236 - target/linux/ppc40x/image/Makefile | 72 - target/linux/ppc40x/modules.mk | 41 - .../003-powerpc-add-EBC_BXCR-defines.patch | 27 - .../ppc40x/patches-3.18/004-magicbox.patch | 446 - .../ppc40x/patches-3.18/005-openrb.patch | 447 - .../101-pata-magicbox-cf-driver.patch | 433 - .../110-kilauea_openwrt_flashmap.patch | 55 - .../120-usb-isp116x-hcd-add-of-binding.patch | 290 - ...b-isp116x-hcd-ppc405-register-access.patch | 110 - target/linux/ppc44x/Makefile | 26 - target/linux/ppc44x/base-files/etc/inittab | 4 - target/linux/ppc44x/config-3.18 | 251 - target/linux/ppc44x/image/Makefile | 46 - ...move-incorrect-__init-__exit-markups.patch | 46 - .../patches-3.18/100-openwrt_flashmap.patch | 55 - .../110-openwrt_dts_cmdline.patch | 9 - .../900-bootwrapper-parallel-make-fix.patch | 45 - .../ramips/base-files/etc/board.d/01_leds | 12 +- .../ramips/base-files/etc/board.d/02_network | 21 +- target/linux/ramips/base-files/etc/diag.sh | 6 + .../ramips/base-files/lib/upgrade/platform.sh | 14 + target/linux/ramips/dts/GB-PC1.dts | 3 - target/linux/ramips/dts/GB-PC2.dts | 2 +- target/linux/ramips/dts/K2G.dts | 139 + target/linux/ramips/dts/MIR3G.dts | 21 +- target/linux/ramips/dts/Newifi-D1.dts | 2 +- target/linux/ramips/dts/RBM33G.dts | 156 + target/linux/ramips/dts/TL-WR842NV5.dts | 86 + target/linux/ramips/dts/TL-WR902ACV3.dts | 8 +- target/linux/ramips/dts/WD03.dts | 6 +- target/linux/ramips/dts/WRC-1167GHBK2-S.dts | 144 + target/linux/ramips/dts/mt7620n.dtsi | 14 +- target/linux/ramips/dts/mt7621.dtsi | 19 +- target/linux/ramips/dts/mt7628an.dtsi | 4 +- .../drivers/mmc/host/mtk-mmc/board.h | 84 +- .../files-4.14/drivers/mmc/host/mtk-mmc/dbg.c | 386 +- .../files-4.14/drivers/mmc/host/mtk-mmc/dbg.h | 93 +- .../drivers/mmc/host/mtk-mmc/mt6575_sd.h | 1068 +- .../files-4.14/drivers/mmc/host/mtk-mmc/sd.c | 4227 +++--- .../net/ethernet/{mediatek => mtk}/Kconfig | 0 .../net/ethernet/{mediatek => mtk}/Makefile | 0 .../ethernet/{mediatek => mtk}/esw_rt3050.c | 0 .../ethernet/{mediatek => mtk}/esw_rt3050.h | 0 .../net/ethernet/{mediatek => mtk}/ethtool.c | 0 .../net/ethernet/{mediatek => mtk}/ethtool.h | 0 .../ethernet/{mediatek => mtk}/gsw_mt7620.c | 0 .../ethernet/{mediatek => mtk}/gsw_mt7620.h | 0 .../ethernet/{mediatek => mtk}/gsw_mt7621.c | 0 .../net/ethernet/{mediatek => mtk}/mdio.c | 3 +- .../net/ethernet/{mediatek => mtk}/mdio.h | 0 .../ethernet/{mediatek => mtk}/mdio_mt7620.c | 0 .../ethernet/{mediatek => mtk}/mdio_rt2880.c | 0 .../ethernet/{mediatek => mtk}/mdio_rt2880.h | 0 .../net/ethernet/{mediatek => mtk}/mt7530.c | 0 .../net/ethernet/{mediatek => mtk}/mt7530.h | 0 .../ethernet/{mediatek => mtk}/mtk_debugfs.c | 0 .../ethernet/{mediatek => mtk}/mtk_eth_soc.c | 23 +- .../ethernet/{mediatek => mtk}/mtk_eth_soc.h | 1 + .../ethernet/{mediatek => mtk}/mtk_offload.c | 0 .../ethernet/{mediatek => mtk}/mtk_offload.h | 0 .../ethernet/{mediatek => mtk}/soc_mt7620.c | 0 .../ethernet/{mediatek => mtk}/soc_mt7621.c | 0 .../ethernet/{mediatek => mtk}/soc_rt2880.c | 0 .../ethernet/{mediatek => mtk}/soc_rt3050.c | 0 .../ethernet/{mediatek => mtk}/soc_rt3883.c | 0 target/linux/ramips/image/Makefile | 18 +- .../linux/ramips/image/lzma-loader/Makefile | 3 +- .../ramips/image/lzma-loader/src/Makefile | 31 +- .../image/lzma-loader/src/board-mt7621.c | 39 + .../ramips/image/lzma-loader/src/loader.c | 4 +- .../ramips/image/lzma-loader/src/mt7621.mk | 1 + target/linux/ramips/image/mt7620.mk | 8 + target/linux/ramips/image/mt7621.mk | 45 +- target/linux/ramips/image/mt76x8.mk | 15 +- target/linux/ramips/image/rt305x.mk | 2 +- target/linux/ramips/mt7621/config-4.14 | 3 +- target/linux/ramips/mt7621/target.mk | 2 +- .../0032-USB-dwc2-add-device_reset.patch | 2 +- ...x-cfi-cmdset-0002-erase-status-check.patch | 29 - ...mtd-cfi-cmdset-0002-force-word-write.patch | 2 +- .../0039-mtd-add-mt7621-nand-support.patch | 99 +- ...d-spi-nor-add-w25q256-3b-mode-switch.patch | 12 +- ...spi-nor-w25q256-respect-default-mode.patch | 73 - .../ramips/patches-4.14/0090-ethernet.patch | 41 + .../302-spi-nor-add-gd25q512.patch | 2 +- ...or-enable-4B-opcodes-for-mx66l51235l.patch | 2 +- target/linux/sunxi/config-4.14 | 7 - target/linux/sunxi/cortexa53/config-default | 3 + .../patches-4.9/0053-stmmac-form-4-13.patch | 27 +- target/linux/x86/64/config-default | 2 +- target/linux/x86/Makefile | 2 +- .../linux/x86/base-files/etc/board.d/01_leds | 2 +- .../x86/base-files/etc/board.d/02_network | 2 +- target/linux/x86/config-4.14 | 69 +- target/linux/x86/config-4.9 | 133 +- target/linux/xburst/Makefile | 25 - .../xburst/base-files/etc/board.d/01_system | 12 - .../linux/xburst/base-files/etc/config/fstab | 6 - .../xburst/base-files/etc/config/network | 13 - target/linux/xburst/config-3.18 | 346 - target/linux/xburst/image/Makefile | 46 - target/linux/xburst/image/ubinize.cfg | 14 - target/linux/xburst/modules.mk | 40 - ...e-vid-header-instead-of-the-whole-pa.patch | 20 - ...-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch | 43 - ...-for-subpage-reads-for-NAND_ECC_HW_O.patch | 104 - ...y-activation-of-the-DAC-to-work-arou.patch | 33 - ...it-the-regulator-register-on-startup.patch | 55 - .../006-Add-ili8960-lcd-driver.patch | 309 - ...e-3-wire-spi-mode-for-the-display-fo.patch | 21 - target/linux/xburst/qi_lb60/config-default | 33 - target/linux/xburst/qi_lb60/target.mk | 1 - target/linux/zynq/Makefile | 31 - target/linux/zynq/base-files.mk | 3 - .../zynq/base-files/etc/board.d/02_network | 16 - .../linux/zynq/base-files/etc/config/network | 17 - target/linux/zynq/base-files/etc/inittab | 3 - target/linux/zynq/config-4.4 | 752 -- target/linux/zynq/image/Makefile | 71 - target/linux/zynq/image/mkits.sh | 150 - target/sdk/Makefile | 12 +- toolchain/binutils/Config.in | 5 - toolchain/binutils/Makefile | 7 +- .../300-001_ld_makefile_patch.patch | 22 - .../300-012_check_ldrunpath_length.patch | 20 - ...ibffi-fix-MIPS-softfloat-build-issue.patch | 175 + ...mpilation-when-making-cross-compiler.patch | 73 + toolchain/glibc/common.mk | 6 +- ...ocket.h-fix-SO_PEERSEC-value-on-MIPS.patch | 59 + toolchain/uClibc/common.mk | 4 +- tools/Makefile | 14 +- tools/bison/Makefile | 6 +- .../patches/001-fix-macos-vasnprintf.patch | 25 - .../bison/patches/100-fix-gets-removal.patch | 11 +- tools/cmake/Makefile | 4 +- .../120-curl-fix-libressl-linking.patch | 6 +- .../cmake/patches/140-curl-fix-libressl.patch | 68 + .../patches/150-libarchive-fix-libressl.patch | 37 + .../110-glibc-change-work-around.patch | 104 + tools/firmware-utils/Makefile | 1 + tools/firmware-utils/src/dns313-header.c | 239 + tools/firmware-utils/src/tplink-safeloader.c | 105 +- tools/libressl/Makefile | 4 +- tools/lzma-old/Makefile | 2 + tools/lzma-old/patches/120-add-cflags.patch | 11 + .../010-glibc-change-work-around.patch | 118 + tools/make-ext4fs/Makefile | 8 - .../make-ext4fs/patches/100-add-ldflags.patch | 11 + tools/mm-macros/Makefile | 4 +- tools/mtd-utils/Makefile | 50 +- tools/mtd-utils/patches/100-sscanf_fix.patch | 6 +- tools/mtd-utils/patches/110-portability.patch | 51 +- .../patches/120-include_sysmacros.patch | 25 - tools/mtd-utils/patches/130-lzma_jffs2.patch | 139 +- .../patches/135-mkubifs_optional_lzo.patch | 119 - ...add-ubigen_write_terminator-function.patch | 8 +- .../201-ubinize-add-terminator-support.patch | 23 +- .../310-add-static-linking-option.patch | 43 - .../320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch | 16 +- tools/sed/Makefile | 4 +- tools/squashfs4/Makefile | 2 +- tools/xz/Makefile | 13 +- tools/zlib/Makefile | 41 + .../900-overridable-pc-exec-prefix.patch | 14 + 2891 files changed, 49219 insertions(+), 276422 deletions(-) create mode 100644 package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch create mode 100644 package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch create mode 100644 package/boot/uboot-oxnas/patches/410-gcc-6-compiler.patch create mode 100644 package/boot/uboot-oxnas/patches/420-gcc-7-compiler.patch create mode 100644 package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch delete mode 100644 package/firmware/ipq-wifi/board-rt-acrh17.bin create mode 100644 package/firmware/ipq-wifi/board-zyxel_wre6606.bin delete mode 100644 package/firmware/wireless-regdb/patches/600-custom-fix-txpower-and-dfs.patch create mode 100644 package/kernel/ath10k-ct/patches/081-ath10k-calibration-variant.patch create mode 100644 package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch create mode 100644 package/kernel/lantiq/ltq-vdsl-mei/patches/110-reset-g_tx_link_rate-on-showtime-exit.patch create mode 100644 package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch create mode 100644 package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch create mode 100644 package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch create mode 100644 package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch create mode 100644 package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch create mode 100644 package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch create mode 100644 package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch create mode 100644 package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch create mode 100644 package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch create mode 100644 package/kernel/mac80211/patches/326-v4.17-0001-brcmfmac-reject-too-long-PSK.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0001-brcmfmac-do-not-convert-linux-error-to-firmware-erro.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0002-brcmfmac-use-brcmf_chip_name-to-store-name-in-revinf.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0003-brcmfmac-use-brcmf_chip_name-for-consistency.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0004-brcmfmac-allocate-struct-brcmf_pub-instance-using-wi.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0005-brcmfmac-use-wiphy-debugfs-dir-entry.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0006-brcmfmac-derive-firmware-filenames-from-basename-map.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0007-brcmfmac-pass-struct-in-brcmf_fw_get_firmwares.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0008-brcmfmac-introduce-brcmf_fw_alloc_request-function.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0009-brcmfmac-add-extension-to-.get_fwname-callbacks.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0010-brcmfmac-get-rid-of-brcmf_fw_map_chip_to_name.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0011-brcmfmac-get-rid-of-brcmf_fw_get_full_name.patch create mode 100644 package/kernel/mac80211/patches/327-v4.17-0012-brcmfmac-add-kerneldoc-for-struct-brcmf_bus-msgbuf.patch create mode 100644 package/kernel/mac80211/patches/328-v4.17-0001-brcmfmac-fix-firmware-request-processing-if-nvram-lo.patch create mode 100644 package/kernel/mac80211/patches/329-v4.18-0001-brcmfmac-add-support-for-BCM4366E-chipset.patch create mode 100644 package/kernel/mac80211/patches/330-v4.18-0001-brcmfmac-check-p2pdev-mac-address-uniqueness.patch create mode 100644 package/kernel/mac80211/patches/330-v4.18-0002-brcmfmac-reports-boottime_ns-while-informing-bss.patch create mode 100644 package/kernel/mac80211/patches/330-v4.18-0003-brcmfmac-use-nl80211_band-directly-to-get-ieee80211-.patch create mode 100644 package/kernel/mac80211/patches/330-v4.18-0004-brcmfmac-constify-firmware-mapping-tables.patch create mode 100644 package/kernel/mac80211/patches/330-v4.18-0005-brcmfmac-add-hostready-indication.patch create mode 100644 package/kernel/mac80211/patches/330-v4.18-0006-brcmfmac-coarse-support-for-PCIe-shared-structure-re.patch create mode 100644 package/kernel/mac80211/patches/331-v4.18-0001-brcmfmac-Add-support-for-bcm43364-wireless-chipset.patch create mode 100644 package/kernel/mac80211/patches/332-v4.18-0001-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch create mode 100644 package/kernel/mac80211/patches/333-v4.18-0001-brcmfmac-fix-initialization-of-struct-cfg80211_infor.patch create mode 100644 package/kernel/mac80211/patches/334-v4.18-0001-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch create mode 100644 package/kernel/mac80211/patches/335-v4.18-0001-brcmfmac-move-ALLFFMAC-variable-in-flowring-module.patch create mode 100644 package/kernel/mac80211/patches/335-v4.18-0002-brcmfmac-add-support-for-sysfs-initiated-coredump.patch create mode 100644 package/kernel/mac80211/patches/335-v4.18-0004-brcmfmac-validate-user-provided-data-for-memdump-bef.patch create mode 100644 package/kernel/mac80211/patches/335-v4.18-0005-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch create mode 100644 package/kernel/mac80211/patches/335-v4.18-0006-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch create mode 100644 package/kernel/mac80211/patches/336-v4.18-brcmfmac-stop-watchdog-before-detach-and-free-everyt.patch create mode 100644 package/kernel/mac80211/patches/337-v4.18-brcmfmac-fix-regression-in-parsing-NVRAM-for-multipl.patch delete mode 100644 package/kernel/mac80211/patches/355-ath9k-limit-retries-for-powersave-response-frames.patch create mode 100644 package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch delete mode 100644 package/kernel/mac80211/patches/653-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch delete mode 100644 package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch delete mode 100644 package/kernel/mac80211/patches/653-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch delete mode 100644 package/kernel/mac80211/patches/653-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch delete mode 100644 package/kernel/mac80211/patches/653-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch delete mode 100644 package/kernel/mac80211/patches/653-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch delete mode 100644 package/kernel/mac80211/patches/653-0007-rtl8xxxu-8188e-Enable-scheduler.patch delete mode 100644 package/kernel/mac80211/patches/653-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch delete mode 100644 package/kernel/mac80211/patches/653-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch delete mode 100644 package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch delete mode 100644 package/kernel/mac80211/patches/653-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch delete mode 100644 package/kernel/mac80211/patches/653-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch delete mode 100644 package/kernel/mac80211/patches/653-0014-rtl8xxxu-Add-8188e-mac-init-table.patch delete mode 100644 package/kernel/mac80211/patches/653-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch delete mode 100644 package/kernel/mac80211/patches/653-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch delete mode 100644 package/kernel/mac80211/patches/653-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch delete mode 100644 package/kernel/mac80211/patches/653-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch delete mode 100644 package/kernel/mac80211/patches/653-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch delete mode 100644 package/kernel/mac80211/patches/653-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch delete mode 100644 package/kernel/mac80211/patches/653-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch delete mode 100644 package/kernel/mac80211/patches/653-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch delete mode 100644 package/kernel/mac80211/patches/653-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch delete mode 100644 package/kernel/mac80211/patches/653-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch delete mode 100644 package/kernel/mac80211/patches/653-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch delete mode 100644 package/kernel/mac80211/patches/653-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch delete mode 100644 package/kernel/mac80211/patches/653-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch delete mode 100644 package/kernel/mac80211/patches/653-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch delete mode 100644 package/kernel/mac80211/patches/653-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch delete mode 100644 package/kernel/mac80211/patches/653-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch delete mode 100644 package/kernel/mac80211/patches/653-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch delete mode 100644 package/kernel/mac80211/patches/653-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch delete mode 100644 package/kernel/mac80211/patches/653-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch delete mode 100644 package/kernel/mac80211/patches/653-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0044-rtl8xxxu-Enable-8188eu-driver.patch delete mode 100644 package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch delete mode 100644 package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch delete mode 100644 package/kernel/mac80211/patches/653-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch delete mode 100644 package/kernel/mac80211/patches/653-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch delete mode 100644 package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch delete mode 100644 package/kernel/mac80211/patches/653-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch delete mode 100644 package/kernel/mac80211/patches/653-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch delete mode 100644 package/kernel/mac80211/patches/653-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch delete mode 100644 package/kernel/mac80211/patches/653-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch delete mode 100644 package/kernel/mac80211/patches/653-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch delete mode 100644 package/kernel/mac80211/patches/653-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch delete mode 100644 package/kernel/mac80211/patches/653-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch create mode 100644 package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch create mode 100644 package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch create mode 100644 package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch create mode 100644 package/libs/mbedtls/patches/300-soversion-compatibility.patch mode change 100755 => 100644 package/network/ipv6/ds-lite/files/dslite.sh create mode 100644 package/network/services/hostapd/patches/0001-WPA-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch delete mode 100644 package/network/services/ppp/patches/511-syncppp.patch create mode 100644 package/network/services/samba36/files/lib/samba.sh create mode 100644 package/network/services/samba36/files/samba.hotplug delete mode 100644 package/network/services/shellsync/Makefile delete mode 100644 package/network/services/shellsync/src/shellsync.c create mode 100644 package/network/services/wireguard/files/wireguard_watchdog delete mode 100644 package/network/services/wireguard/patches/100-portability.patch delete mode 100644 package/network/utils/curl/patches/320-mbedtls_dont_use_deprecated_sha256_function.patch create mode 100644 package/network/utils/curl/patches/400-CVE-2018-0500.patch create mode 100644 package/network/utils/iproute2/patches/002-json_print-fix-hidden-64-bit-type-promotion.patch create mode 100644 package/network/utils/wwan/files/data/1e2d-0053 create mode 100644 package/network/utils/wwan/files/data/1e2d-005b rename package/system/{lede-keyring => openwrt-keyring}/Makefile (50%) create mode 100644 package/utils/busybox/patches/400-udhcpc-remove-code-which-requires-server-ID-to-be-on.patch delete mode 100644 package/utils/mtd-utils/patches/010-fix-rpmatch.patch create mode 100644 package/utils/mtd-utils/patches/200-Revert-Return-correct-error-number-in-ubi_get_vol_in.patch delete mode 100644 target/linux/adm5120/Makefile delete mode 100755 target/linux/adm5120/base-files/etc/board.d/01_leds delete mode 100644 target/linux/adm5120/base-files/etc/config/network delete mode 100644 target/linux/adm5120/base-files/etc/diag.sh delete mode 100644 target/linux/adm5120/base-files/etc/inittab delete mode 100755 target/linux/adm5120/base-files/lib/adm5120.sh delete mode 100644 target/linux/adm5120/base-files/lib/preinit/01_preinit_do_adm5120.sh delete mode 100644 target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120 delete mode 100644 target/linux/adm5120/base-files/lib/upgrade/platform.sh delete mode 100644 target/linux/adm5120/config-3.18 delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/Kconfig delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/Platform delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cas-771.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/nfs-101.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/adm5120.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/clock.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/early-printk.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/gpio.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/irq.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/memory.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/platform.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/prom.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/common/setup.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np27g.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np28g.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/wp54.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104k.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104kp.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61x4wg.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/eb-214a.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-rt.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-wvoip.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120p-ata.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy83000.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-11x.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133c.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-150.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-153.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-192.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/pmugw.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/5gxi.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/admboot.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/bootbase.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/cfe.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/generic.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/myloader.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/prom_read.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/routerboot.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/Makefile delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-334wt.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-335.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.c delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_defs.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_info.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_intc.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_mpmc.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_nand.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_platform.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_switch.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_uart.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/asm/sizes.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/cpu-feature-overrides.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/gpio.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/irq.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/admboot.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/cfe.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/generic.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/myloader.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/routerboot.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/zynos.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/war.h delete mode 100644 target/linux/adm5120/files-3.18/arch/mips/pci/pci-adm5120.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/ata/pata_rb153_cf.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/leds/ledtrig-adm5120-switch.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/mtd/maps/adm5120-flash.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/mtd/trxsplit.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/net/adm5120sw.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/net/adm5120sw.h delete mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-dbg.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-drv.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hcd.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hub.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-mem.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-pm.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-q.c delete mode 100644 target/linux/adm5120/files-3.18/drivers/usb/host/adm5120.h delete mode 100644 target/linux/adm5120/files-3.18/drivers/watchdog/adm5120_wdt.c delete mode 100644 target/linux/adm5120/image/Makefile delete mode 100644 target/linux/adm5120/image/lzma-loader/Makefile delete mode 100644 target/linux/adm5120/image/lzma-loader/src/LzmaDecode.c delete mode 100644 target/linux/adm5120/image/lzma-loader/src/LzmaDecode.h delete mode 100644 target/linux/adm5120/image/lzma-loader/src/LzmaTypes.h delete mode 100644 target/linux/adm5120/image/lzma-loader/src/Makefile delete mode 100644 target/linux/adm5120/image/lzma-loader/src/README delete mode 100644 target/linux/adm5120/image/lzma-loader/src/board.c delete mode 100644 target/linux/adm5120/image/lzma-loader/src/config.h delete mode 100644 target/linux/adm5120/image/lzma-loader/src/decompress.c delete mode 100644 target/linux/adm5120/image/lzma-loader/src/head.S delete mode 100644 target/linux/adm5120/image/lzma-loader/src/loader.lds delete mode 100644 target/linux/adm5120/image/lzma-loader/src/lzma-data.lds delete mode 100644 target/linux/adm5120/image/lzma-loader/src/printf.c delete mode 100644 target/linux/adm5120/image/lzma-loader/src/printf.h delete mode 100644 target/linux/adm5120/image/rb1xx.mk delete mode 100644 target/linux/adm5120/image/router_be.mk delete mode 100644 target/linux/adm5120/image/router_le.mk delete mode 100644 target/linux/adm5120/modules.mk delete mode 100644 target/linux/adm5120/patches-3.18/001-adm5120.patch delete mode 100644 target/linux/adm5120/patches-3.18/002-adm5120_flash.patch delete mode 100644 target/linux/adm5120/patches-3.18/003-adm5120_switch.patch delete mode 100644 target/linux/adm5120/patches-3.18/005-adm5120_usb.patch delete mode 100644 target/linux/adm5120/patches-3.18/007-adm5120_pci.patch delete mode 100644 target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch delete mode 100644 target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch delete mode 100644 target/linux/adm5120/patches-3.18/100-rootfs_split.patch delete mode 100644 target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch delete mode 100644 target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch delete mode 100644 target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch delete mode 100644 target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch delete mode 100644 target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch delete mode 100644 target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch delete mode 100644 target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch delete mode 100755 target/linux/adm5120/rb1xx/base-files/sbin/wget2nand delete mode 100644 target/linux/adm5120/rb1xx/config-default delete mode 100644 target/linux/adm5120/rb1xx/profiles/RB1xx.mk delete mode 100644 target/linux/adm5120/rb1xx/target.mk delete mode 100644 target/linux/adm5120/router_be/config-default delete mode 100644 target/linux/adm5120/router_be/profiles/010-Generic.mk delete mode 100644 target/linux/adm5120/router_be/profiles/200-ZyXEL.mk delete mode 100644 target/linux/adm5120/router_be/target.mk delete mode 100644 target/linux/adm5120/router_le/config-3.8 delete mode 100644 target/linux/adm5120/router_le/profiles/010-Generic.mk delete mode 100644 target/linux/adm5120/router_le/profiles/Cellvision.mk delete mode 100644 target/linux/adm5120/router_le/profiles/Compex.mk delete mode 100644 target/linux/adm5120/router_le/profiles/Edimax.mk delete mode 100644 target/linux/adm5120/router_le/profiles/Infineon.mk delete mode 100644 target/linux/adm5120/router_le/profiles/Motorola.mk delete mode 100644 target/linux/adm5120/router_le/profiles/Osbridge.mk delete mode 100644 target/linux/adm5120/router_le/target.mk delete mode 100644 target/linux/adm8668/Makefile delete mode 100644 target/linux/adm8668/base-files/etc/config/network delete mode 100644 target/linux/adm8668/base-files/etc/diag.sh delete mode 100644 target/linux/adm8668/base-files/lib/preinit/03_init_hotplug_failsafe_adm8668 delete mode 100644 target/linux/adm8668/base-files/lib/preinit/05_set_preinit_face_adm8668 delete mode 100644 target/linux/adm8668/base-files/lib/upgrade/platform.sh delete mode 100644 target/linux/adm8668/base-files/sbin/hotplug.failsafe delete mode 100644 target/linux/adm8668/config-3.18 delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/Kconfig delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/Makefile delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/Platform delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/clock.c delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/early_printk.c delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/gpio.c delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/irq.c delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/platform.c delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/prom.c delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/setup.c delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/time.c delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/adm8668/u-boot.h delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/adm8668.h delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/asm/sizes.h delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/gpio.h delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/irq.h delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/war.h delete mode 100644 target/linux/adm8668/files-3.18/arch/mips/pci/pci-adm8668.c delete mode 100644 target/linux/adm8668/files-3.18/drivers/mtd/maps/adm8668.c delete mode 100644 target/linux/adm8668/image/Makefile delete mode 100644 target/linux/adm8668/image/lzma-loader/Makefile delete mode 100644 target/linux/adm8668/image/lzma-loader/src/LzmaDecode.c delete mode 100644 target/linux/adm8668/image/lzma-loader/src/LzmaDecode.h delete mode 100644 target/linux/adm8668/image/lzma-loader/src/Makefile delete mode 100644 target/linux/adm8668/image/lzma-loader/src/decompress.c delete mode 100644 target/linux/adm8668/image/lzma-loader/src/include/_exports.h delete mode 100644 target/linux/adm8668/image/lzma-loader/src/include/asm/global_data.h delete mode 100644 target/linux/adm8668/image/lzma-loader/src/include/asm/u-boot.h delete mode 100644 target/linux/adm8668/image/lzma-loader/src/include/common.h delete mode 100644 target/linux/adm8668/image/lzma-loader/src/include/exports.h delete mode 100644 target/linux/adm8668/image/lzma-loader/src/include/image.h delete mode 100644 target/linux/adm8668/image/lzma-loader/src/lzma.lds.in delete mode 100644 target/linux/adm8668/image/lzma-loader/src/stubs.c delete mode 100755 target/linux/adm8668/image/my-mkimage delete mode 100644 target/linux/adm8668/patches-3.18/001-adm8668_arch.patch delete mode 100644 target/linux/adm8668/patches-3.18/002-adm8668_pci.patch delete mode 100644 target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch delete mode 100644 target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch delete mode 100644 target/linux/adm8668/patches-3.18/005-tulip_platform.patch delete mode 100644 target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch delete mode 100644 target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch delete mode 100644 target/linux/adm8668/profiles/100-WRTU54G-TM.mk delete mode 100644 target/linux/apm821xx/patches-4.14/020-0001-crypto-crypto4xx-remove-bad-list_del.patch delete mode 100644 target/linux/apm821xx/patches-4.14/020-0011-crypto-crypto4xx-fix-crypto4xx_build_pdr-crypto4xx_b.patch rename target/linux/apm821xx/patches-4.14/{120-0001-crypto-crypto4xx-shuffle-iomap-in-front-of-request_i.patch => 021-0001-crypto-crypto4xx-shuffle-iomap-in-front-of-request_i.patch} (100%) rename target/linux/apm821xx/patches-4.14/{120-0002-crypto-crypto4xx-support-Revision-B-parts.patch => 021-0002-crypto-crypto4xx-support-Revision-B-parts.patch} (100%) rename target/linux/apm821xx/patches-4.14/{120-0003-crypto-crypto4xx-fix-missing-irq-devname.patch => 021-0003-crypto-crypto4xx-fix-missing-irq-devname.patch} (100%) rename target/linux/apm821xx/patches-4.14/{120-0004-crypto-crypto4xx-kill-MODULE_NAME.patch => 021-0004-crypto-crypto4xx-kill-MODULE_NAME.patch} (100%) rename target/linux/apm821xx/patches-4.14/{120-0005-crypto-crypto4xx-perform-aead-icv-check-in-the-drive.patch => 021-0005-crypto-crypto4xx-perform-aead-icv-check-in-the-drive.patch} (100%) create mode 100644 target/linux/apm821xx/patches-4.14/022-0001-crypto-Use-zeroing-memory-allocator-instead-of-alloc.patch rename target/linux/apm821xx/patches-4.14/{120-0006-crypto-crypto4xx-performance-optimizations.patch => 022-0002-crypto-crypto4xx-performance-optimizations.patch} (87%) create mode 100644 target/linux/apm821xx/patches-4.14/022-0003-crypto-crypto4xx-convert-to-skcipher.patch create mode 100644 target/linux/apm821xx/patches-4.14/022-0004-crypto-crypto4xx-avoid-VLA-use.patch create mode 100644 target/linux/apm821xx/patches-4.14/022-0005-crypto-crypto4xx-add-aes-ctr-support.patch create mode 100644 target/linux/apm821xx/patches-4.14/022-0006-crypto-crypto4xx-properly-set-IV-after-de-and-encryp.patch create mode 100644 target/linux/apm821xx/patches-4.14/022-0007-crypto-crypto4xx-extend-aead-fallback-checks.patch create mode 100644 target/linux/apm821xx/patches-4.14/022-0008-crypto-crypto4xx-put-temporary-dst-sg-into-request-c.patch create mode 100644 target/linux/apm821xx/patches-4.14/302-dw-dma-hprot-fix-and-equal-priortiy.patch delete mode 100644 target/linux/ar7/config-3.18 delete mode 100644 target/linux/ar7/patches-3.18/001-mips-ar7-fix-serial.patch delete mode 100644 target/linux/ar7/patches-3.18/002-MIPS-AR7-ensure-the-port-type-s-FCR-value-is-used.patch delete mode 100644 target/linux/ar7/patches-3.18/100-fix-highmem-offset.patch delete mode 100644 target/linux/ar7/patches-3.18/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch delete mode 100644 target/linux/ar7/patches-3.18/110-flash.patch delete mode 100644 target/linux/ar7/patches-3.18/160-vlynq_try_remote_first.patch delete mode 100644 target/linux/ar7/patches-3.18/200-free-mem-below-kernel-offset.patch delete mode 100644 target/linux/ar7/patches-3.18/300-add-ac49x-platform.patch delete mode 100644 target/linux/ar7/patches-3.18/310-ac49x-prom-support.patch delete mode 100644 target/linux/ar7/patches-3.18/320-ac49x-mtd-partitions.patch delete mode 100644 target/linux/ar7/patches-3.18/920-ar7part.patch delete mode 100644 target/linux/ar7/patches-3.18/925-actiontec_leds.patch delete mode 100644 target/linux/ar7/patches-3.18/950-cpmac_titan.patch delete mode 100755 target/linux/ar71xx/base-files/etc/init.d/ar71xx_clock delete mode 100644 target/linux/ar71xx/config-4.14 delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/Kconfig.openwrt delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-eth.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-a60.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-alfa-ap120c.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap132.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap152.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c7.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-bhr-4grv2.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-c60.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cf-e316n-v2.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cpe510.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cr5000.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dap-2695-a1.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dgl-5500-a1.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dhp-1565-a1.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-825-c1.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-869-a1.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-pro-1200-ac.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-pro-500-wp.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-domywifi-dw33d.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dr344.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-e1700ac-v2.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-epg5000.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-esr1750.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-esr900.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-f9k1115v2.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar750s.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-jwap230.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-k2t.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-koala.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr1750.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr900.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-n750.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-rext.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-nbg6716.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5p.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5pac.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5pacv2.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rambutan.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb2011.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb750.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb91x.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb922.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb95x.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rbspi.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc1750.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc300m.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc450.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sr3200.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-823dru.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr4300.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wpa8630.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1041n-v2.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd-v2.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd-v4.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt-unifiac.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt-xm.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wlr8100.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wndr4300.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj342.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj344.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj558.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj563.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-450hp2.c delete mode 100644 target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-z1.c delete mode 100644 target/linux/ar71xx/files-4.14/drivers/mtd/nand/ar934x_nfc.c delete mode 100644 target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb4xx_nand.c delete mode 100644 target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb750_nand.c delete mode 100644 target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb91x_nand.c delete mode 100644 target/linux/ar71xx/files-4.14/drivers/mtd/tplinkpart.c delete mode 100644 target/linux/ar71xx/files-4.14/drivers/net/dsa/mv88e6063.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/Makefile delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-ap9x-pci.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-ap9x-pci.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-dsa.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-dsa.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-eth.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-m25p80.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-m25p80.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-nfc.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-nfc.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ac9531.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-ap96.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-nx.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-all0258n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-all0315n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antminer-s1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antminer-s3.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antrouter-r1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap121f.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap143.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap147.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap531b0.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap90q.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap91-5g.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap96.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c25-v1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c59-v1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c60-v1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-arduino-yun.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-aw-nr580.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bhu-bxu2000n2-a.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bsb.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-c55.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cap324.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cap4200ag.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-carambola2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cpe870.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cr3000.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dap-1330-a1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-505-a1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-600-a1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-615-c1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-615-i1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-825-b1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dlan-hotspot.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dr531.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dragino2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e2100l.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e600g-v2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap120.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap300v2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap7660d.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-el-m150.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-el-mini.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ens202ext.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ew-balin.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ew-dorin.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-fritz300e.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-fritz4020.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar150.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar300.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar300m.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar750.c delete mode 100755 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar750s.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-domino.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-inet.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-mifi.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-usb150.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gs-oolite-v1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gs-oolite-v5-2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hiveap-121.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hiwifi-hc6361.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hornet-ub.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ja76pf.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-jwap003.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-k2t.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-lan-turtle.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-lima.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mc-mac1200r.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr12.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr16.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr18.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr600.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mynet-n600.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mzk-w04nu.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mzk-w300nh.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-n5q.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-nbg460n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om2p.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-omy-g1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-omy-x1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-onion-omega.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-pb42.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-pqi-air-pen.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-qihoo-c301.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r36a.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r602n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r6100.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb4xx.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rbsxtlite.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-re450.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rme-eg200.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rut9xx.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rw2458n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-smart-300.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-som9331.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-t830.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tellstick-znet-lite.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-632brp.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-673gru.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-712br.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-732br.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr11u.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr13u.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr3020.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr3x20.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr6400.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa701nd-v2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa7210n-v2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa801nd-v3.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa830re-v2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd-v2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd-v4.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wax50re.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr3320-v2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr3500.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr6500-v2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdx6501-v7.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1043nd.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr2543n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr703n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr720n-v3.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr741nd-v4.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr741nd.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr802n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr810n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n-v8.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n-v9.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr902ac-v1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr940n-v4.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr941nd-v6.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr941nd.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr942n-v1.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ts-d084.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tube2h.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ubnt.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wam250.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-weio.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-whr-hp-g300n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wi2a-ac200i.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wifi-pineapple-nano.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wlae-ag300n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndap360.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndr3700.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000-v3.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000-v4.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2200.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wp543.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpe72.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj531.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrt160nl.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrt400n.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrtnode2q.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-ag300h.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g300nh.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g300nh2.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g450h.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-zbt-we1526.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-zcn-1523h.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/machtypes.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/nvram.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/nvram.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/pci-ath9k-fixup.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/pci-ath9k-fixup.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/routerboot.c delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/ath79/routerboot.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/include/asm/fw/myloader/myloader.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/ag71xx_platform.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/mach-rb750.h delete mode 100644 target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h delete mode 100644 target/linux/ar71xx/files-4.9/drivers/gpio/gpio-latch.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/gpio/gpio-nxp-74hc153.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/leds/leds-nu801.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/leds/leds-rb750.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/leds/leds-wndr3700-usb.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/mtd/cybertan_part.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/Kconfig delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/Makefile delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx.h delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/spi/spi-rb4xx-cpld.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/spi/spi-rb4xx.c delete mode 100644 target/linux/ar71xx/files-4.9/drivers/spi/spi-vsc7385.c delete mode 100644 target/linux/ar71xx/files-4.9/include/linux/leds-nu801.h delete mode 100644 target/linux/ar71xx/files-4.9/include/linux/nxp_74hc153.h delete mode 100644 target/linux/ar71xx/files-4.9/include/linux/platform/ar934x_nfc.h delete mode 100644 target/linux/ar71xx/files-4.9/include/linux/platform_data/gpio-latch.h delete mode 100644 target/linux/ar71xx/files-4.9/include/linux/platform_data/rb91x_nand.h delete mode 100644 target/linux/ar71xx/files-4.9/include/linux/spi/vsc7385.h rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/Kconfig.openwrt (99%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/Makefile (98%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-ap9x-pci.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-ap9x-pci.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-dsa.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-dsa.h (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/dev-eth.c (98%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-eth.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-m25p80.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-m25p80.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-nfc.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/dev-nfc.h (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-a60.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-alfa-ap120c.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-alfa-ap96.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-alfa-nx.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-all0258n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-all0315n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-antminer-s1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-antminer-s3.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-antrouter-r1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ap121f.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-ap132.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ap143.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ap147.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-ap152.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ap531b0.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ap90q.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ap91-5g.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ap96.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-archer-c25-v1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-archer-c59-v1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-archer-c60-v1.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-archer-c7-v4.c (100%) rename target/linux/ar71xx/{files-4.14/arch/mips/ath79/mach-archer-c7-v4.c => files/arch/mips/ath79/mach-archer-c7-v5.c} (55%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-archer-c7.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-arduino-yun.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-aw-nr580.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-bhr-4grv2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-bhu-bxu2000n2-a.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-bsb.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-c55.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-c60.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-cap324.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-cap4200ag.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-carambola2.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-cf-e316n-v2.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-cpe510.c (71%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-cpe870.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-cr3000.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-cr5000.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dap-1330-a1.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-dap-2695-a1.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-dgl-5500-a1.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-dhp-1565-a1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dir-505-a1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dir-600-a1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dir-615-c1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dir-615-i1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dir-825-b1.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-dir-825-c1.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-dir-869-a1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dlan-hotspot.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-dlan-pro-1200-ac.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-dlan-pro-500-wp.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-domywifi-dw33d.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-dr344.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dr531.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-dragino2.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-e1700ac-v2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-e2100l.c (100%) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-e558-v2.c rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-e600g-v2.c (100%) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-e750a-v4.c create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-e750g-v8.c rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-eap120.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-eap300v2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-eap7660d.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-el-m150.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-el-mini.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ens202ext.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-epg5000.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-esr1750.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-esr900.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ew-balin.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ew-dorin.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-f9k1115v2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-fritz300e.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-fritz4020.c (100%) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gl-ar150.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gl-ar300.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gl-ar300m.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gl-ar750.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gl-domino.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gl-inet.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gl-mifi.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gl-usb150.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gs-oolite-v1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-gs-oolite-v5-2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-hiveap-121.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-hiwifi-hc6361.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-hornet-ub.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ja76pf.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-jwap003.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-jwap230.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-koala.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-lan-turtle.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-lima.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-mc-mac1200r.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-mr12.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-mr16.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-mr1750.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-mr18.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-mr600.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-mr900.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-mynet-n600.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-mynet-n750.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-mynet-rext.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-mzk-w04nu.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-mzk-w300nh.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-n5q.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-nbg460n.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-nbg6716.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-om2p.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-om5p.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-om5pac.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-om5pacv2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-omy-g1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-omy-x1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-onion-omega.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-pb42.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-pqi-air-pen.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-qihoo-c301.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-r36a.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-r602n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-r6100.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-rambutan.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-rb2011.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-rb4xx.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-rb750.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-rb91x.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-rb922.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-rb95x.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-rbspi.c (99%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-rbsxtlite.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-re450.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-rme-eg200.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-rut9xx.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-rw2458n.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-sc1750.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-sc300m.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-sc450.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-smart-300.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-som9331.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-sr3200.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-t830.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tellstick-znet-lite.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tew-632brp.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tew-673gru.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tew-712br.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tew-732br.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-tew-823dru.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-mr11u.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-mr13u.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-mr3020.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-mr3x20.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-mr6400.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wa701nd-v2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wa7210n-v2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wa801nd-v3.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wa830re-v2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wa901nd-v2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wa901nd-v4.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wa901nd.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wax50re.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wdr3320-v2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wdr3500.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-tl-wdr4300.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wdr6500-v2.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-tl-wpa8630.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-tl-wr1041n-v2.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-tl-wr1043nd-v2.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-tl-wr1043nd-v4.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr1043nd.c (96%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr2543n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr703n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr720n-v3.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr741nd-v4.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr741nd.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr802n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr810n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr841n-v8.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr841n-v9.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr841n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr902ac-v1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr940n-v4.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr941nd-v6.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr941nd.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tl-wr942n-v1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ts-d084.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-tube2h.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-ubnt-unifiac.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-ubnt-xm.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-ubnt.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wam250.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-weio.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-whr-hp-g300n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wi2a-ac200i.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wifi-pineapple-nano.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wlae-ag300n.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-wlr8100.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wndap360.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wndr3700.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-wndr4300.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wnr2000-v3.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wnr2000-v4.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wnr2000.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wnr2200.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wp543.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wpe72.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-wpj342.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-wpj344.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wpj531.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-wpj558.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-wpj563.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wrt160nl.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wrt400n.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wrtnode2q.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-wzr-450hp2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wzr-hp-ag300h.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wzr-hp-g300nh.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wzr-hp-g300nh2.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-wzr-hp-g450h.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/arch/mips/ath79/mach-z1.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-zbt-we1526.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/mach-zcn-1523h.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/machtypes.h (98%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/nvram.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/nvram.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/pci-ath9k-fixup.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/pci-ath9k-fixup.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/routerboot.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/ath79/routerboot.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/include/asm/fw/myloader/myloader.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/include/asm/mach-ath79/ag71xx_platform.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/include/asm/mach-ath79/mach-rb750.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/gpio/gpio-latch.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/gpio/gpio-nxp-74hc153.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/leds/leds-nu801.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/leds/leds-rb750.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/leds/leds-wndr3700-usb.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/mtd/cybertan_part.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/drivers/mtd/nand/ar934x_nfc.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/drivers/mtd/nand/rb4xx_nand.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/drivers/mtd/nand/rb750_nand.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/drivers/mtd/nand/rb91x_nand.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/drivers/mtd/tplinkpart.c (100%) rename target/linux/ar71xx/{files-4.9 => files}/drivers/net/dsa/mv88e6063.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/Kconfig (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/Makefile (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/ag71xx.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/spi/spi-rb4xx-cpld.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/spi/spi-rb4xx.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/drivers/spi/spi-vsc7385.c (100%) rename target/linux/ar71xx/{files-4.14 => files}/include/linux/leds-nu801.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/include/linux/nxp_74hc153.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/include/linux/platform/ar934x_nfc.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/include/linux/platform_data/gpio-latch.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/include/linux/platform_data/rb91x_nand.h (100%) rename target/linux/ar71xx/{files-4.14 => files}/include/linux/spi/vsc7385.h (100%) delete mode 100644 target/linux/ar71xx/patches-4.14/001-spi-cs-gpio.patch delete mode 100644 target/linux/ar71xx/patches-4.14/002-add_back_gpio_function_select.patch delete mode 100644 target/linux/ar71xx/patches-4.14/004-register_gpio_driver_earlier.patch delete mode 100644 target/linux/ar71xx/patches-4.14/100-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch delete mode 100644 target/linux/ar71xx/patches-4.14/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch delete mode 100644 target/linux/ar71xx/patches-4.14/200-MIPS-ath79-fix-ar933x-wmac-reset.patch delete mode 100644 target/linux/ar71xx/patches-4.14/201-ar913x_wmac_external_reset.patch delete mode 100644 target/linux/ar71xx/patches-4.14/202-MIPS-ath79-ar934x-wmac-revision.patch delete mode 100644 target/linux/ar71xx/patches-4.14/203-MIPS-ath79-fix-restart.patch delete mode 100644 target/linux/ar71xx/patches-4.14/220-add_cpu_feature_overrides.patch delete mode 100644 target/linux/ar71xx/patches-4.14/300-MIPS-add-MIPS_MACHINE_NONAME-macro.patch delete mode 100644 target/linux/ar71xx/patches-4.14/310-lib-add-rle-decompression.patch delete mode 100644 target/linux/ar71xx/patches-4.14/401-mtd-physmap-add-lock-unlock.patch delete mode 100644 target/linux/ar71xx/patches-4.14/402-mtd-SST39VF6401B-support.patch delete mode 100644 target/linux/ar71xx/patches-4.14/403-mtd_fix_cfi_cmdset_0002_status_check.patch delete mode 100644 target/linux/ar71xx/patches-4.14/404-mtd-cybertan-trx-parser.patch delete mode 100644 target/linux/ar71xx/patches-4.14/405-mtd-tp-link-partition-parser.patch delete mode 100644 target/linux/ar71xx/patches-4.14/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch delete mode 100644 target/linux/ar71xx/patches-4.14/408-mtd-redboot_partition_scan.patch delete mode 100644 target/linux/ar71xx/patches-4.14/409-mtd-rb4xx_nand_driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/410-mtd-rb750-nand-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/411-mtd-cfi_cmdset_0002-force-word-write.patch delete mode 100644 target/linux/ar71xx/patches-4.14/413-mtd-ar934x-nand-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/414-mtd-rb91x-nand-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/420-net-ar71xx_mac_driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/423-dsa-add-88e6063-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/430-drivers-link-spi-before-mtd.patch delete mode 100644 target/linux/ar71xx/patches-4.14/432-spi-rb4xx-spi-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/433-spi-rb4xx-cpld-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/435-spi-vsc7385_driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/440-leds-wndr3700-usb-led-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/441-leds-rb750-led-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/442-leds-gpio-allow-to-use-OPEN_-DRAIN-SOURCE-flags-with.patch delete mode 100644 target/linux/ar71xx/patches-4.14/450-gpio-nxp-74hc153-gpio-chip-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/451-gpio-74x164-improve-platform-device-support.patch delete mode 100644 target/linux/ar71xx/patches-4.14/452-gpio-add-gpio-latch-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/461-spi-ath79-add-fast-flash-read.patch delete mode 100644 target/linux/ar71xx/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch delete mode 100644 target/linux/ar71xx/patches-4.14/490-usb-ehci-add-quirks-for-qca-socs.patch delete mode 100644 target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch delete mode 100644 target/linux/ar71xx/patches-4.14/501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch delete mode 100644 target/linux/ar71xx/patches-4.14/504-MIPS-ath79-add-ath79_device_reset_get.patch delete mode 100644 target/linux/ar71xx/patches-4.14/505-MIPS-ath79-add-ath79_gpio_function_select.patch delete mode 100644 target/linux/ar71xx/patches-4.14/506-MIPS-ath79-prom-parse-redboot-args.patch delete mode 100644 target/linux/ar71xx/patches-4.14/507-MIPS-ath79-prom-add-myloader-support.patch delete mode 100644 target/linux/ar71xx/patches-4.14/508-MIPS-ath79-prom-image-command-line-hack.patch delete mode 100644 target/linux/ar71xx/patches-4.14/509-MIPS-ath79-process-board-kernel-option.patch delete mode 100644 target/linux/ar71xx/patches-4.14/510-MIPS-ath79-init-gpio-pin-of-wmac-device.patch delete mode 100644 target/linux/ar71xx/patches-4.14/520-MIPS-ath79-enable-UART-function.patch delete mode 100644 target/linux/ar71xx/patches-4.14/521-MIPS-ath79-enable-UART-for-early_serial.patch delete mode 100644 target/linux/ar71xx/patches-4.14/522-MIPS-ath79-add-ath79_wmac_register_simple-helper.patch delete mode 100644 target/linux/ar71xx/patches-4.14/523-MIPS-ath79-OTP-support.patch delete mode 100644 target/linux/ar71xx/patches-4.14/524-MIPS-ath79-add-ath79_wmac_disable_25ghz-helpers.patch delete mode 100644 target/linux/ar71xx/patches-4.14/525-MIPS-ath79-enable-qca-usb-quirks.patch delete mode 100644 target/linux/ar71xx/patches-4.14/601-MIPS-ath79-add-more-register-defines.patch delete mode 100644 target/linux/ar71xx/patches-4.14/602-MIPS-ath79-add-openwrt-stuff.patch delete mode 100644 target/linux/ar71xx/patches-4.14/603-MIPS-ath79-ap121-fixes.patch delete mode 100644 target/linux/ar71xx/patches-4.14/605-MIPS-ath79-db120-fixes.patch delete mode 100644 target/linux/ar71xx/patches-4.14/606-MIPS-ath79-pb44-fixes.patch delete mode 100644 target/linux/ar71xx/patches-4.14/607-MIPS-ath79-ubnt-xm-fixes.patch delete mode 100644 target/linux/ar71xx/patches-4.14/608-MIPS-ath79-ubnt-xm-add-more-boards.patch delete mode 100644 target/linux/ar71xx/patches-4.14/609-MIPS-ath79-ap136-fixes.patch delete mode 100644 target/linux/ar71xx/patches-4.14/611-MIPS-ath79-wdt-timeout.patch delete mode 100644 target/linux/ar71xx/patches-4.14/612-MIPS-ath79-set-buffalo-txgain.patch delete mode 100644 target/linux/ar71xx/patches-4.14/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch delete mode 100644 target/linux/ar71xx/patches-4.14/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch delete mode 100644 target/linux/ar71xx/patches-4.14/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch delete mode 100644 target/linux/ar71xx/patches-4.14/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch delete mode 100644 target/linux/ar71xx/patches-4.14/630-MIPS-ath79-fix-chained-irq-disable.patch delete mode 100644 target/linux/ar71xx/patches-4.14/631-MIPS-ath79-wmac-enable-set-led-pin.patch delete mode 100644 target/linux/ar71xx/patches-4.14/632-MIPS-ath79-gpio-enable-set-direction.patch delete mode 100644 target/linux/ar71xx/patches-4.14/640-MIPS-ath79-add-QCA955x-wmac-reset.patch delete mode 100644 target/linux/ar71xx/patches-4.14/641-MIPS-ath79-ath9k-exports.patch delete mode 100644 target/linux/ar71xx/patches-4.14/642-MIPS-ath79-no-of.patch delete mode 100644 target/linux/ar71xx/patches-4.14/700-MIPS-ath79-add-openwrt-Kconfig.patch delete mode 100644 target/linux/ar71xx/patches-4.14/701-MIPS-ath79-add-routerboard-detection.patch delete mode 100644 target/linux/ar71xx/patches-4.14/702-MIPS-ath79-fixup-routerboot-board-parameter.patch delete mode 100644 target/linux/ar71xx/patches-4.14/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch delete mode 100644 target/linux/ar71xx/patches-4.14/740-MIPS-ath79-add-PCI-for-QCA953x-SoC.patch delete mode 100644 target/linux/ar71xx/patches-4.14/741-MIPS-ath79-add-PCI-for-QCA9556-SoC.patch delete mode 100644 target/linux/ar71xx/patches-4.14/818-MIPS-ath79-add-nu801-led-driver.patch delete mode 100644 target/linux/ar71xx/patches-4.14/820-MIPS-ath79-add_gpio_function2_setup.patch delete mode 100644 target/linux/ar71xx/patches-4.14/900-mdio_bitbang_ignore_ta_value.patch delete mode 100644 target/linux/ar71xx/patches-4.14/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch delete mode 100644 target/linux/ar71xx/patches-4.14/902-at803x-add-reset-gpio-pdata.patch delete mode 100644 target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch delete mode 100644 target/linux/ar71xx/patches-4.14/920-usb-chipidea-AR933x-platform-support.patch delete mode 100644 target/linux/ar71xx/patches-4.14/921-MIPS-ath79-add-even-more-register-defines-for-QCA956x-SoC.patch delete mode 100644 target/linux/ar71xx/patches-4.14/930-chipidea-pullup.patch delete mode 100644 target/linux/ar71xx/patches-4.14/980-patch-switch-ext.patch delete mode 100644 target/linux/ar71xx/patches-4.14/999-ppp-function.patch delete mode 100644 target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch delete mode 100644 target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch delete mode 100644 target/linux/ar71xx/patches-4.9/940-m25p80-add-m25qh64a.patch rename target/linux/ath25/{config-4.9 => config-4.14} (88%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/107-ar5312_gpio.patch (97%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/108-ar2315_gpio.patch (98%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/110-ar2313_ethernet.patch (99%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/120-spiflash.patch (99%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/130-watchdog.patch (98%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/140-redboot_boardconfig.patch (100%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/141-redboot_partition_scan.patch (100%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/142-redboot_various_erase_size_fix.patch (100%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/210-reset_button.patch (97%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/220-enet_micrel_workaround.patch (100%) rename target/linux/ath25/{patches-4.9 => patches-4.14}/330-board_leds.patch (100%) delete mode 100644 target/linux/ath79/Makefile delete mode 100755 target/linux/ath79/base-files/etc/board.d/01_leds delete mode 100755 target/linux/ath79/base-files/etc/board.d/02_network delete mode 100644 target/linux/ath79/base-files/etc/diag.sh delete mode 100644 target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom delete mode 100644 target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata delete mode 100644 target/linux/ath79/base-files/lib/upgrade/platform.sh delete mode 100644 target/linux/ath79/dts/ar7100.dtsi delete mode 100644 target/linux/ath79/dts/ar7161_netgear_wndr3800.dts delete mode 100644 target/linux/ath79/dts/ar7240.dtsi delete mode 100644 target/linux/ath79/dts/ar7240_tl-wr740n-v2.dts delete mode 100644 target/linux/ath79/dts/ar7241.dtsi delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_nano-m.dts delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_unifi.dts delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_xm.dtsi delete mode 100644 target/linux/ath79/dts/ar7242.dtsi delete mode 100644 target/linux/ath79/dts/ar7242_avm_fritz300e.dts delete mode 100644 target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts delete mode 100644 target/linux/ath79/dts/ar724x.dtsi delete mode 100644 target/linux/ath79/dts/ar9132.dtsi delete mode 100644 target/linux/ath79/dts/ar9132_tl-wr1043nd-v1.dts delete mode 100644 target/linux/ath79/dts/ar9330.dtsi delete mode 100644 target/linux/ath79/dts/ar9330_glinet_ar150.dts delete mode 100644 target/linux/ath79/dts/ar9331.dtsi delete mode 100644 target/linux/ath79/dts/ar9331_dpt_module.dts delete mode 100644 target/linux/ath79/dts/ar9331_dragino_ms14.dts delete mode 100644 target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts delete mode 100644 target/linux/ath79/dts/ar9331_omega.dts delete mode 100644 target/linux/ath79/dts/ar9331_tl-wr703n.dts delete mode 100644 target/linux/ath79/dts/ar9331_tl_mr3020.dts delete mode 100644 target/linux/ath79/dts/ar9344.dtsi delete mode 100644 target/linux/ath79/dts/ar9344_tl-wdr3600.dts delete mode 100644 target/linux/ath79/dts/ar9344_tl-wdr4300.dts delete mode 100644 target/linux/ath79/dts/ar9344_tl-wdr4300.dtsi delete mode 100644 target/linux/ath79/dts/ar934x.dtsi delete mode 100644 target/linux/ath79/dts/ath79.dtsi delete mode 100644 target/linux/ath79/dts/qca9557.dtsi delete mode 100644 target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts delete mode 100644 target/linux/ath79/files/arch/mips/ath79/pci-ath9k-fixup.c delete mode 100644 target/linux/ath79/files/arch/mips/ath79/pci-ath9k-fixup.h delete mode 100644 target/linux/ath79/files/arch/mips/include/asm/fw/myloader/myloader.h delete mode 100644 target/linux/ath79/files/drivers/mtd/tplinkpart.c delete mode 100644 target/linux/ath79/files/drivers/net/dsa/mv88e6063.c delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Kconfig delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c delete mode 100644 target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c delete mode 100644 target/linux/ath79/generic/config-default delete mode 100644 target/linux/ath79/generic/profiles/00-default.mk delete mode 100644 target/linux/ath79/generic/target.mk delete mode 100644 target/linux/ath79/image/Makefile delete mode 100644 target/linux/ath79/image/common-tp-link.mk delete mode 100644 target/linux/ath79/image/generic-tp-link.mk delete mode 100644 target/linux/ath79/image/generic-ubnt.mk delete mode 100644 target/linux/ath79/image/generic.mk delete mode 100644 target/linux/ath79/image/lzma-loader/Makefile delete mode 100644 target/linux/ath79/image/lzma-loader/src/LzmaDecode.c delete mode 100644 target/linux/ath79/image/lzma-loader/src/LzmaDecode.h delete mode 100644 target/linux/ath79/image/lzma-loader/src/LzmaTypes.h delete mode 100644 target/linux/ath79/image/lzma-loader/src/Makefile delete mode 100644 target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h delete mode 100644 target/linux/ath79/image/lzma-loader/src/board.c delete mode 100644 target/linux/ath79/image/lzma-loader/src/cache.c delete mode 100644 target/linux/ath79/image/lzma-loader/src/cache.h delete mode 100644 target/linux/ath79/image/lzma-loader/src/cacheops.h delete mode 100644 target/linux/ath79/image/lzma-loader/src/config.h delete mode 100644 target/linux/ath79/image/lzma-loader/src/cp0regdef.h delete mode 100644 target/linux/ath79/image/lzma-loader/src/head.S delete mode 100644 target/linux/ath79/image/lzma-loader/src/loader.c delete mode 100644 target/linux/ath79/image/lzma-loader/src/loader.lds delete mode 100644 target/linux/ath79/image/lzma-loader/src/loader2.lds delete mode 100644 target/linux/ath79/image/lzma-loader/src/lzma-data.lds delete mode 100644 target/linux/ath79/image/lzma-loader/src/printf.c delete mode 100644 target/linux/ath79/image/lzma-loader/src/printf.h delete mode 100644 target/linux/ath79/image/tiny-tp-link.mk delete mode 100644 target/linux/ath79/modules.mk delete mode 100644 target/linux/ath79/patches-4.14/0001-tty-serial-drop-QCA-pecific-SoC-symbols.patch delete mode 100644 target/linux/ath79/patches-4.14/0002-watchdog-ath79-fix-maximum-timeout.patch delete mode 100644 target/linux/ath79/patches-4.14/0003-leds-add-reset-controller-based-driver.patch delete mode 100644 target/linux/ath79/patches-4.14/0004-phy-add-ath79-usb-phys.patch delete mode 100644 target/linux/ath79/patches-4.14/0005-usb-add-more-OF-quirk-properties.patch delete mode 100644 target/linux/ath79/patches-4.14/0006-usb-drop-deprecated-symbols.patch delete mode 100644 target/linux/ath79/patches-4.14/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch delete mode 100644 target/linux/ath79/patches-4.14/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch delete mode 100644 target/linux/ath79/patches-4.14/0009-MIPS-ath79-add-lots-of-missing-registers.patch delete mode 100644 target/linux/ath79/patches-4.14/0010-MIPS-ath79-select-the-PINCTRL-subsystem.patch delete mode 100644 target/linux/ath79/patches-4.14/0011-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch delete mode 100644 target/linux/ath79/patches-4.14/0012-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch delete mode 100644 target/linux/ath79/patches-4.14/0013-MIPS-ath79-fix-system-restart.patch delete mode 100644 target/linux/ath79/patches-4.14/0014-MIPS-ath79-finetune-cpu-overrides.patch delete mode 100644 target/linux/ath79/patches-4.14/0015-MIPS-ath79-enable-uart-during-early_prink.patch delete mode 100644 target/linux/ath79/patches-4.14/0016-MIPS-ath79-add-support-for-QCA953x-SoC.patch delete mode 100644 target/linux/ath79/patches-4.14/0017-MIPS-ath79-add-support-for-qca956x-soc.patch delete mode 100644 target/linux/ath79/patches-4.14/0019-MIPS-ath79-get-PCIe-controller-out-of-reset.patch delete mode 100644 target/linux/ath79/patches-4.14/0020-MIPS-ath79-turn-pci-ar71xx-driver-into-a-pure-OF-dri.patch delete mode 100644 target/linux/ath79/patches-4.14/0021-MIPS-ath79-turn-pci-ar724x-driver-into-a-pure-OF-dri.patch delete mode 100644 target/linux/ath79/patches-4.14/0022-MIPS-ath79-drop-pci.c.patch delete mode 100644 target/linux/ath79/patches-4.14/0023-MIPS-ath79-drop-mach-files.patch delete mode 100644 target/linux/ath79/patches-4.14/0024-GPIO-add-named-gpio-exports.patch delete mode 100644 target/linux/ath79/patches-4.14/0024-MIPS-ath79-drop-pdata-helpers.patch delete mode 100644 target/linux/ath79/patches-4.14/0025-MIPS-ath79-drop-irq.c.patch delete mode 100644 target/linux/ath79/patches-4.14/0026-MIPS-ath79-sanitize-Kconfig-symbols.patch delete mode 100644 target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-mips_machine-support.patch delete mode 100644 target/linux/ath79/patches-4.14/0028-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch delete mode 100644 target/linux/ath79/patches-4.14/0029-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch delete mode 100644 target/linux/ath79/patches-4.14/0030-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch delete mode 100644 target/linux/ath79/patches-4.14/0031-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch delete mode 100644 target/linux/ath79/patches-4.14/0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch delete mode 100644 target/linux/ath79/patches-4.14/0033-MIPS-ath79-export-switch-MDIO-reference-clock.patch delete mode 100644 target/linux/ath79/patches-4.14/0034-MIPS-ath79-ath9k-exports.patch delete mode 100644 target/linux/ath79/patches-4.14/004-register_gpio_driver_earlier.patch delete mode 100644 target/linux/ath79/patches-4.14/405-mtd-tp-link-partition-parser.patch delete mode 100644 target/linux/ath79/patches-4.14/420-net-ar71xx_mac_driver.patch delete mode 100644 target/linux/ath79/patches-4.14/430-drivers-link-spi-before-mtd.patch delete mode 100644 target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch delete mode 100644 target/linux/ath79/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch delete mode 100644 target/linux/ath79/patches-4.14/490-usb-ehci-add-quirks-for-qca-socs.patch delete mode 100644 target/linux/ath79/patches-4.14/900-mdio_bitbang_ignore_ta_value.patch delete mode 100644 target/linux/ath79/patches-4.14/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch delete mode 100644 target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch delete mode 100644 target/linux/ath79/tiny/config-default delete mode 100644 target/linux/ath79/tiny/profiles/00-default.mk delete mode 100644 target/linux/ath79/tiny/target.mk delete mode 100644 target/linux/au1000/Makefile delete mode 100644 target/linux/au1000/au1500/config-default delete mode 100644 target/linux/au1000/au1500/profiles/Atheros.mk delete mode 100644 target/linux/au1000/au1500/profiles/InternetBox.mk delete mode 100644 target/linux/au1000/au1500/profiles/MeshCube.mk delete mode 100644 target/linux/au1000/au1500/target.mk delete mode 100644 target/linux/au1000/au1550/config-default delete mode 100644 target/linux/au1000/au1550/profiles/DBAu1550.mk delete mode 100644 target/linux/au1000/au1550/target.mk delete mode 100644 target/linux/au1000/base-files/etc/diag.sh delete mode 100644 target/linux/au1000/base-files/lib/upgrade/platform.sh delete mode 100644 target/linux/au1000/config-3.18 delete mode 100644 target/linux/au1000/image/Makefile delete mode 100644 target/linux/au1000/modules.mk delete mode 100644 target/linux/au1000/patches-3.18/002-openwrt_rootfs.patch delete mode 100644 target/linux/au1000/patches-3.18/003-au1000_eth_ioctl.patch delete mode 100644 target/linux/au1000/patches-3.18/004-watchdog_low_init.patch delete mode 100644 target/linux/au1000/patches-3.18/006-codec.patch create mode 100644 target/linux/brcm2708/patches-4.9/950-1002-bcm2708-raspberry-pi-3-b-plus.patch rename target/linux/brcm47xx/base-files/etc/board.d/{01_detect => 01_network} (90%) delete mode 100644 target/linux/brcm47xx/config-4.4 create mode 100644 target/linux/brcm47xx/patches-4.14/032-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch create mode 100644 target/linux/brcm47xx/patches-4.14/033-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch create mode 100644 target/linux/brcm47xx/patches-4.14/330-Revert-MIPS-BCM47XX-Enable-74K-Core-ExternalSync-for.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/160-kmap_coherent.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/209-b44-register-adm-switch.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/210-b44_phy_fix.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/280-activate_ssb_support_in_usb.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/300-fork_cacheflush.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/310-no_highpage.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/610-pci_ide_fix.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/791-tg3-no-pci-sleep.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/800-bcma-add-table-of-serial-flashes-with-smaller-blocks.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/830-huawei_e970_support.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/831-old_gpio_wdt.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/900-ssb-reject-PCI-writes-setting-CardBus-bridge-resourc.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/901-Revert-bcma-switch-GPIO-portions-to-use-GPIOLIB_IRQC.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/940-bcm47xx-yenta.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/976-ssb_increase_pci_delay.patch delete mode 100644 target/linux/brcm47xx/patches-4.4/999-wl_exports.patch create mode 100644 target/linux/brcm47xx/patches-4.9/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch create mode 100644 target/linux/brcm47xx/patches-4.9/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch delete mode 100644 target/linux/brcm63xx/config-4.4 delete mode 100644 target/linux/brcm63xx/patches-4.14/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch delete mode 100644 target/linux/brcm63xx/patches-4.14/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch create mode 100644 target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-01-mtd-add-get-set-of_node-flash_node-helpers.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-02-mtd-ofpart-grab-device-tree-node-directly-from-maste.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-03-mtd-nand-spi-nor-assign-MTD-of_node.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-04-mtd-nand-convert-to-nand_set_flash_node.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-05-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-06-mtd-nand-drop-unnecessary-partition-parser-data.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-07-mtd-spi-nor-drop-unnecessary-partition-parser-data.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-08-mtd-spi-nor-drop-flash_node-field.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-09-mtd-drop-unnecessary-partition-parser-data.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-10-mtd-ofpart-drop-of_node-partition-parser-data.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-11-mtd-physmap_of-assign-parent-for-the-concatenated-MT.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-20-spi-expose-master-transfer-size-limitation.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-30-gpio-add-a-data-pointer-to-gpio_chip.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.5-31-gpio-generic-factor-into-gpio_chip-struct.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.6-01-gpio-Add-devm_-apis-for-gpiochip_add_data-and-gpioch.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.7-01-pinctrl-Add-devm_-apis-for-pinctrl_-register-unregis.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.7-02-pinctrl-Rename-pinctrl_utils_dt_free_map-to-pinctrl_.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-01-mtd-spi-nor-change-return-value-of-read-write.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-02-mtd-m25p80-return-amount-of-data-transferred-or-erro.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-03-mtd-fsl-quadspi-return-amount-of-data-read-written-o.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-05-mtd-nxp-spifi-return-amount-of-data-transferred-or-e.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-06-mtd-spi-nor-check-return-value-from-write.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-07-mtd-spi-nor-stop-passing-around-retlen.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-08-mtd-spi-nor-simplify-write-loop.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-09-mtd-spi-nor-add-read-loop.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-10-mtd-m25p80-read-in-spi_max_transfer_size-chunks.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.8-11-serial-bcm63xx_uart-use-correct-alias-naming.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/000-4.9-01-spi-introduce-max_message_size-hook-in-spi_master.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.11-02-mtd-spi-nor-remove-WARN_ONCE-message-in-spi_nor_writ.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.12-01-spi-bcm63xx-make-spi-subsystem-aware-of-message-size.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.12-02-spi-bcm63xx-document-device-tree-bindings.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.12-03-spi-bcm63xx-add-support-for-probing-through-devicetr.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.12-04-spi-bcm63xx-hsspi-allow-providing-clock-rate-through.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.12-05-spi-bcm63xx-hsspi-document-device-tree-bindings.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.12-07-mdio_bus-Issue-GPIO-RESET-to-PHYs.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.12-08-net-phy-Call-bus-reset-after-releasing-PHYs-from-res.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.13-01-leds-bcm6328-fix-signal-source-assignment-for-high-l.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.13-02-mdio_bus-handle-only-single-PHY-reset-GPIO.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-01-MIPS-BCM63XX-add-clkdev-lookup-support.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-02-MIPS-BCM63XX-provide-periph-clock-as-refclk-for-uart.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-03-tty-bcm63xx_uart-use-refclk-for-the-expected-clock-n.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-04-tty-bcm63xx_uart-allow-naming-clock-in-device-tree.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-05-MIPS-BCM63XX-move-the-HSSPI-PLL-HZ-into-its-own-cloc.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-06-MIPS-BCM63XX-provide-enet-clocks-as-enet-to-the-ethe.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-07-MIPS-BCM63XX-split-out-swpkt_sar-usb-clocks.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-10-bcm63xx_enet-do-not-rely-on-probe-order.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-11-bcm63xx_enet-use-managed-functions-for-clock-ioremap.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-12-bcm63xx_enet-drop-unneeded-NULL-phy_clk-check.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.15-13-bcm63xx_enet-remove-unneeded-include.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.16-01-bcm63xx_enet-just-use-enet-as-the-clock-name.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.16-02-bcm63xx_enet-use-platform-data-for-dma-channel-numbe.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.16-03-bcm63xx_enet-remove-pointless-mac_id-check.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/001-4.16-04-bcm63xx_enet-use-platform-device-id-directly-for-mii.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/100-MIPS-BCM63XX-add-USB-host-clock-enable-delay.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/101-MIPS-BCM63XX-add-USB-device-clock-enable-delay-to-cl.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/102-MIPS-BCM63XX-move-code-touching-the-USB-private-regi.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/104-MIPS-BCM63XX-introduce-BCM63XX_OHCI-configuration-sy.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/105-MIPS-BCM63XX-add-support-for-the-on-chip-OHCI-contro.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/106-MIPS-BCM63XX-register-OHCI-controller-if-board-enabl.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/107-MIPS-BCM63XX-introduce-BCM63XX_EHCI-configuration-sy.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/108-MIPS-BCM63XX-add-support-for-the-on-chip-EHCI-contro.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/109-MIPS-BCM63XX-register-EHCI-controller-if-board-enabl.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/110-MIPS-BCM63XX-EHCI-controller-does-not-support-overcu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/120-mtdpart_fixup_generic_partprobe.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/130-pinctrl-add-bcm63xx-base-code.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/131-Documentation-add-BCM6328-pincontroller-binding-docu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/132-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/133-Documentation-add-BCM6348-pincontroller-binding-docu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/134-pinctrl-add-a-pincontrol-driver-for-BCM6348.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/135-Documentation-add-BCM6358-pincontroller-binding-docu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/136-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/137-Documentation-add-BCM6362-pincontroller-binding-docu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/138-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/139-Documentation-add-BCM6368-pincontroller-binding-docu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/140-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/141-Documentation-add-BCM63268-pincontroller-binding-doc.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/142-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/207-MIPS-BCM63XX-move-device-registration-code-into-its-.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/208-MIPS-BCM63XX-pass-a-mac-addresss-allocator-to-board-.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/309-cfe_version_mod.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/310-cfe_simplify_detection.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/311-bcm63xxpart_use_cfedetection.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/321-irqchip-add-support-for-bcm6345-style-external-inter.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/323-MIPS-BCM63XX-wire-up-BCM6358-s-external-interrupts-4.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/330-MIPS-BCM63XX-add-a-new-cpu-variant-helper.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/331-MIPS-BCM63XX-define-variant-id-field.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/332-MIPS-BCM63XX-detect-BCM6328-variants.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/333-MIPS-BCM63XX-detect-BCM6362-variants.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/334-MIPS-BCM63XX-detect-BCM6368-variants.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/335-MIPS-BCM63XX-fix-PCIe-memory-window-size.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/336-MIPS-BCM63XX-dynamically-set-the-pcie-memory-windows.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/337-MIPS-BCM63XX-widen-cpuid-field.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/338-MIPS-BCM63XX-increase-number-of-IRQs.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/340-MIPS-BCM63XX-add-pcie-support-for-BCM63268.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/342-MIPS-BCM63XX-split-PCIe-reset-signals.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/344-MIPS-BCM63XX-detect-flash-type-early-and-store-the-r.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/345-MIPS-BCM63XX-fixup-mapped-SPI-flash-access-on-boot.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/347-MIPS-BCM6318-USB-support.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/348-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/349-MIPS-BCM63XX-add-BCM63268-USB-support.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/350-MIPS-BCM63XX-support-settings-num-usbh-ports.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/351-set-board-usbh-ports.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/354-MIPS-BCM63XX-allow-building-support-for-more-than-on.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/355-MIPS-BCM63XX-allow-board-implementations-to-force-fl.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/356-MIPS-BCM63XX-move-fallback-sprom-support-into-its-ow.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/358-MIPS-BCM63XX-make-fallback-sprom-optional.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/359-MIPS-BCM63XX-allow-different-types-of-sprom.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/368-MIPS-BCM63XX-add-support-for-matching-the-board_info.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/369-MIPS-BCM63XX-populate-the-compatible-to-board_info-l.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/371_add_of_node_available_by_alias.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/372_dont_register_pflash_when_available_in_dtb.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/373-MIPS-BCM63XX-register-interrupt-controllers-through-.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/380-pcmcia-bcm63xx_pmcia-use-the-new-named-gpio.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/381-Documentation-add-BCM6318-pincontroller-binding-docu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/382-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/383-bcm63xx_select_pinctrl.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/390-MIPS-BCM63XX-do-not-register-SPI-controllers.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/391-MIPS-BCM63XX-do-not-register-uart.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/392-MIPS-BCM63XX-remove-leds-and-buttons.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/400-bcm963xx_flashmap.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/401-bcm963xx_real_rootfs_length.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/402_bcm63xx_enet_vlan_incoming_fixed.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/403-6358-enet1-external-mii-clk.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/415-MIPS-BCM63XX-export-the-attached-flash-type.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/420-BCM63XX-add-endian-check-for-ath9k.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/421-BCM63XX-add-led-pin-for-ath9k.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/423-bcm63xx_enet_add_b53_support.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/424-bcm63xx_enet_no_request_mem_region.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/427-boards_probe_switch.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/499-allow_better_context_for_board_patches.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/500-board-D4PW.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/501-board-NB4.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/502-board-96338W2_E7T.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/503-board-CPVA642.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/504-board_dsl_274xb_rev_c.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/505-board_spw500v.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/506-board_gw6200_gw6000.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/507-board-MAGIC.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/508-board_hw553.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/509-board_rta1320_16m.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/510-board_spw303v.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/511-board_V2500V.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/512-board_BTV2110.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/514-board_ct536_ct5621.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/515-board_DWV-S0_fixes.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/516-board_96348A-122.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/519_board_CPVA502plus.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/520-bcm63xx-add-support-for-96368MVWG-board.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/521-bcm63xx-add-support-for-96368MVNgr-board.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/522-MIPS-BCM63XX-add-96328avng-reference-board.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/523-MIPS-BCM63XX-add-963281TAN-reference-board.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/524-board_dsl_274xb_rev_f.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/525-board_96348w3.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/526-board_CT6373-1.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/527-board_dva-g3810bn-tl-1.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/528-board_nb6.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/529-board_fast2604.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/530-board_A4001N1.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/531-board_AR-5387un.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/532-board_AR-5381u.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/533-board_rta770bw.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/534-board_hw556.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/535-board_rta770w.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/536-board_fast2704.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/537-board_fast2504n.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/555-board_96318ref.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/556-board_96318ref_p300.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/557-board_bcm963269bhr.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/558-board_AR1004G.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/559-board_vw6339gu.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/560-board_963268gu_p300.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/561-board_WAP-5813n.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/562-board_VR-3025u.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/563-board_VR-3025un.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/564-board_P870HW-51a_v2.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/565-board_hw520.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/566-board_A4001N.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/567-board_dsl-2751b_e1.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/568-board_DGND3700v1_3800B.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/569-board_homehub2a.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/570-board_HG655b.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/571-board_fast2704n.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/572-board_VR-3026e.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/573-board_R5010UNv2.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/574-board_HG622.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/575-board_EVG2000.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/576-board_AV4202N.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/577-board_VH4032N.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/578-board_R1000H.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/579-board_AR-5315u.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/800-wl_exports.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/801-ssb_export_fallback_sprom.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/802-rtl8367r_fix_RGMII_support.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/803-jffs2-work-around-unaligned-accesses-failing-on-bcm6.patch delete mode 100644 target/linux/brcm63xx/patches-4.4/804-bcm63xx_enet_63268_rgmii_ports.patch delete mode 100644 target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch delete mode 100644 target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch delete mode 100644 target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch create mode 100644 target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch delete mode 100644 target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch delete mode 100644 target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch create mode 100644 target/linux/generic/backport-4.14/044-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch create mode 100644 target/linux/generic/backport-4.14/045-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch create mode 100644 target/linux/generic/backport-4.14/046-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch create mode 100644 target/linux/generic/backport-4.14/700-1-6-e1000e-Remove-Other-from-EIAC.diff create mode 100644 target/linux/generic/backport-4.14/700-2-6-Partial-revert-e1000e-Avoid-receiver-overrun-interrupt-bursts.diff create mode 100644 target/linux/generic/backport-4.14/700-3-6-e1000e-Fix-queue-interrupt-re-raising-in-Other-interrupt.diff create mode 100644 target/linux/generic/backport-4.14/700-4-6-e1000e-Avoid-missed-interrupts-following-ICR-read.diff create mode 100644 target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch create mode 100644 target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch create mode 100644 target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch create mode 100644 target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch rename target/linux/generic/{pending-4.4/141-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch => backport-4.9/069-v4.18-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch} (83%) create mode 100644 target/linux/generic/backport-4.9/094-v4.12-0001-ip6_tunnel-Fix-missing-tunnel-encapsulation-limit-op.patch create mode 100644 target/linux/generic/backport-4.9/094-v4.12-0002-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch create mode 100644 target/linux/generic/backport-4.9/400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch create mode 100644 target/linux/generic/backport-4.9/401-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch create mode 100644 target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch delete mode 100644 target/linux/generic/config-3.18 delete mode 100644 target/linux/generic/config-4.4 delete mode 100644 target/linux/generic/hack-4.14/710-phy-add-mdio_register_board_info.patch create mode 100644 target/linux/generic/hack-4.14/940-cleanup-offload-hooks-on-netdev-unregister.patch delete mode 100644 target/linux/generic/hack-4.4/950-net-patch-linux-kernel-to-support-shortcut-fe.patch delete mode 100644 target/linux/generic/hack-4.4/951-bridge-Add-new-bridge-APIs-needed-for-network-HW-acc.patch delete mode 100644 target/linux/generic/hack-4.4/952-net-conntrack-events-support-multiple-registrant.patch delete mode 100644 target/linux/generic/pending-3.18/001-mtdsplit_backport.patch delete mode 100644 target/linux/generic/pending-3.18/002-phy_drivers_backport.patch delete mode 100644 target/linux/generic/pending-3.18/003-myloader_backport.patch delete mode 100644 target/linux/generic/pending-3.18/020-ssb_update.patch delete mode 100644 target/linux/generic/pending-3.18/021-ssb_sprom.patch delete mode 100644 target/linux/generic/pending-3.18/025-bcma_backport.patch delete mode 100644 target/linux/generic/pending-3.18/026-bcma-from-3.20.patch delete mode 100644 target/linux/generic/pending-3.18/027-bcma-from-4.1.patch delete mode 100644 target/linux/generic/pending-3.18/028-bcma-from-4.2.patch delete mode 100644 target/linux/generic/pending-3.18/029-bcma-from-4.4.patch delete mode 100644 target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch delete mode 100644 target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch delete mode 100644 target/linux/generic/pending-3.18/031-bcma-from-4.5.patch delete mode 100644 target/linux/generic/pending-3.18/032-bcma-from-4.6.patch delete mode 100644 target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch delete mode 100644 target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch delete mode 100644 target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch delete mode 100644 target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch delete mode 100644 target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch delete mode 100644 target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch delete mode 100644 target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch delete mode 100644 target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch delete mode 100644 target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch delete mode 100644 target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch delete mode 100644 target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch delete mode 100644 target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch delete mode 100644 target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch delete mode 100644 target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch delete mode 100644 target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch delete mode 100644 target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch delete mode 100644 target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch delete mode 100644 target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch delete mode 100644 target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch delete mode 100644 target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch delete mode 100644 target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch delete mode 100644 target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch delete mode 100644 target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch delete mode 100644 target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch delete mode 100644 target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch delete mode 100644 target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch delete mode 100644 target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch delete mode 100644 target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch delete mode 100644 target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch delete mode 100644 target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch delete mode 100644 target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch delete mode 100644 target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch delete mode 100644 target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch delete mode 100644 target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch delete mode 100644 target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch delete mode 100644 target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch delete mode 100644 target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch delete mode 100644 target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch delete mode 100644 target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch delete mode 100644 target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch delete mode 100644 target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch delete mode 100644 target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch delete mode 100644 target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch delete mode 100644 target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch delete mode 100644 target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch delete mode 100644 target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch delete mode 100644 target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch delete mode 100644 target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch delete mode 100644 target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch delete mode 100644 target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch delete mode 100644 target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch delete mode 100644 target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch delete mode 100644 target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch delete mode 100644 target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch delete mode 100644 target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch delete mode 100644 target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch delete mode 100644 target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch delete mode 100644 target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch delete mode 100644 target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch delete mode 100644 target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch delete mode 100644 target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch delete mode 100644 target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch delete mode 100644 target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch delete mode 100644 target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch delete mode 100644 target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch delete mode 100644 target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch delete mode 100644 target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch delete mode 100644 target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch delete mode 100644 target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch delete mode 100644 target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch delete mode 100644 target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch delete mode 100644 target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch delete mode 100644 target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch delete mode 100644 target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch delete mode 100644 target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch delete mode 100644 target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch delete mode 100644 target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch delete mode 100644 target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch delete mode 100644 target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch delete mode 100644 target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch delete mode 100644 target/linux/generic/pending-3.18/200-fix_localversion.patch delete mode 100644 target/linux/generic/pending-3.18/201-extra_optimization.patch delete mode 100644 target/linux/generic/pending-3.18/202-reduce_module_size.patch delete mode 100644 target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch delete mode 100644 target/linux/generic/pending-3.18/204-module_strip.patch delete mode 100644 target/linux/generic/pending-3.18/205-backtrace_module_info.patch delete mode 100644 target/linux/generic/pending-3.18/210-darwin_scripts_include.patch delete mode 100644 target/linux/generic/pending-3.18/212-byteshift_portability.patch delete mode 100644 target/linux/generic/pending-3.18/213-x86_vdso_portability.patch delete mode 100644 target/linux/generic/pending-3.18/214-spidev_h_portability.patch delete mode 100644 target/linux/generic/pending-3.18/220-gc_sections.patch delete mode 100644 target/linux/generic/pending-3.18/221-module_exports.patch delete mode 100644 target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch delete mode 100644 target/linux/generic/pending-3.18/250-netfilter_depends.patch delete mode 100644 target/linux/generic/pending-3.18/251-sound_kconfig.patch delete mode 100644 target/linux/generic/pending-3.18/252-mv_cesa_depends.patch delete mode 100644 target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch delete mode 100644 target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch delete mode 100644 target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch delete mode 100644 target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch delete mode 100644 target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch delete mode 100644 target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch delete mode 100644 target/linux/generic/pending-3.18/259-regmap_dynamic.patch delete mode 100644 target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch delete mode 100644 target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch delete mode 100644 target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch delete mode 100644 target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch delete mode 100644 target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch delete mode 100644 target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch delete mode 100644 target/linux/generic/pending-3.18/304-mips_disable_fpu.patch delete mode 100644 target/linux/generic/pending-3.18/305-mips_module_reloc.patch delete mode 100644 target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch delete mode 100644 target/linux/generic/pending-3.18/307-mips_highmem_offset.patch delete mode 100644 target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch delete mode 100644 target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch delete mode 100644 target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch delete mode 100644 target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch delete mode 100644 target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch delete mode 100644 target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch delete mode 100644 target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch delete mode 100644 target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch delete mode 100644 target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch delete mode 100644 target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch delete mode 100644 target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch delete mode 100644 target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch delete mode 100644 target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch delete mode 100644 target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch delete mode 100644 target/linux/generic/pending-3.18/420-mtd-redboot_space.patch delete mode 100644 target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch delete mode 100644 target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch delete mode 100644 target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch delete mode 100644 target/linux/generic/pending-3.18/440-block2mtd_init.patch delete mode 100644 target/linux/generic/pending-3.18/441-block2mtd_probe.patch delete mode 100644 target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch delete mode 100644 target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch delete mode 100644 target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch delete mode 100644 target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch delete mode 100644 target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch delete mode 100644 target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch delete mode 100644 target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch delete mode 100644 target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch delete mode 100644 target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch delete mode 100644 target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch delete mode 100644 target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch delete mode 100644 target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch delete mode 100644 target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch delete mode 100644 target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch delete mode 100644 target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch delete mode 100644 target/linux/generic/pending-3.18/531-debloat_lzma.patch delete mode 100644 target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch delete mode 100644 target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch delete mode 100644 target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch delete mode 100644 target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch delete mode 100644 target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch delete mode 100644 target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch delete mode 100644 target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch delete mode 100644 target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch delete mode 100644 target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch delete mode 100644 target/linux/generic/pending-3.18/621-sched_act_connmark.patch delete mode 100644 target/linux/generic/pending-3.18/630-packet_socket_type.patch delete mode 100644 target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch delete mode 100644 target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch delete mode 100644 target/linux/generic/pending-3.18/642-bridge_port_isolate.patch delete mode 100644 target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch delete mode 100644 target/linux/generic/pending-3.18/650-pppoe_header_pad.patch delete mode 100644 target/linux/generic/pending-3.18/651-wireless_mesh_header.patch delete mode 100644 target/linux/generic/pending-3.18/653-disable_netlink_trim.patch delete mode 100644 target/linux/generic/pending-3.18/655-increase_skb_pad.patch delete mode 100644 target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch delete mode 100644 target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch delete mode 100644 target/linux/generic/pending-3.18/660-fq_codel_defaults.patch delete mode 100644 target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch delete mode 100644 target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch delete mode 100644 target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch delete mode 100644 target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch delete mode 100644 target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch delete mode 100644 target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch delete mode 100644 target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch delete mode 100644 target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch delete mode 100644 target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch delete mode 100644 target/linux/generic/pending-3.18/700-swconfig.patch delete mode 100644 target/linux/generic/pending-3.18/701-phy_extension.patch delete mode 100644 target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch delete mode 100644 target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch delete mode 100644 target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch delete mode 100644 target/linux/generic/pending-3.18/720-phy_adm6996.patch delete mode 100644 target/linux/generic/pending-3.18/721-phy_packets.patch delete mode 100644 target/linux/generic/pending-3.18/722-phy_mvswitch.patch delete mode 100644 target/linux/generic/pending-3.18/723-phy_ip175c.patch delete mode 100644 target/linux/generic/pending-3.18/724-phy_ar8216.patch delete mode 100644 target/linux/generic/pending-3.18/725-phy_rtl8306.patch delete mode 100644 target/linux/generic/pending-3.18/726-phy_rtl8366.patch delete mode 100644 target/linux/generic/pending-3.18/727-phy-rtl8367.patch delete mode 100644 target/linux/generic/pending-3.18/728-phy-rtl8367b.patch delete mode 100644 target/linux/generic/pending-3.18/729-phy-tantos.patch delete mode 100644 target/linux/generic/pending-3.18/730-phy_b53.patch delete mode 100644 target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch delete mode 100644 target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch delete mode 100644 target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch delete mode 100644 target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch delete mode 100644 target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch delete mode 100644 target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch delete mode 100644 target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch delete mode 100644 target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch delete mode 100644 target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch delete mode 100644 target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch delete mode 100644 target/linux/generic/pending-3.18/831-ledtrig_netdev.patch delete mode 100644 target/linux/generic/pending-3.18/834-ledtrig-libata.patch delete mode 100644 target/linux/generic/pending-3.18/840-rtc7301.patch delete mode 100644 target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch delete mode 100644 target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch delete mode 100644 target/linux/generic/pending-3.18/862-gpio_spi_driver.patch delete mode 100644 target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch delete mode 100644 target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch delete mode 100644 target/linux/generic/pending-3.18/901-debloat_sock_diag.patch delete mode 100644 target/linux/generic/pending-3.18/902-debloat_proc.patch delete mode 100644 target/linux/generic/pending-3.18/904-debloat_dma_buf.patch delete mode 100644 target/linux/generic/pending-3.18/910-kobject_uevent.patch delete mode 100644 target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch delete mode 100644 target/linux/generic/pending-3.18/921-use_preinit_as_init.patch delete mode 100644 target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch delete mode 100644 target/linux/generic/pending-3.18/930-crashlog.patch delete mode 100644 target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch delete mode 100644 target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch delete mode 100644 target/linux/generic/pending-3.18/990-gpio_wdt.patch delete mode 100644 target/linux/generic/pending-3.18/995-mangle_bootargs.patch delete mode 100644 target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch delete mode 100644 target/linux/generic/pending-3.18/999-seccomp_log.patch create mode 100644 target/linux/generic/pending-4.14/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch delete mode 100644 target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch delete mode 100644 target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch delete mode 100644 target/linux/generic/pending-4.4/001-mtdsplit_backport.patch delete mode 100644 target/linux/generic/pending-4.4/002-phy_drivers_backport.patch delete mode 100644 target/linux/generic/pending-4.4/003-myloader_backport.patch delete mode 100644 target/linux/generic/pending-4.4/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch delete mode 100644 target/linux/generic/pending-4.4/020-bcma-from-4.5.patch delete mode 100644 target/linux/generic/pending-4.4/021-bcma-from-4.6.patch delete mode 100644 target/linux/generic/pending-4.4/022-bcma-from-4.8.patch delete mode 100644 target/linux/generic/pending-4.4/023-bcma-from-4.9.patch delete mode 100644 target/linux/generic/pending-4.4/025-bcma-from-4.11.patch delete mode 100644 target/linux/generic/pending-4.4/026-bcma-from-4.12.patch delete mode 100644 target/linux/generic/pending-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch delete mode 100644 target/linux/generic/pending-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch delete mode 100644 target/linux/generic/pending-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch delete mode 100644 target/linux/generic/pending-4.4/032-fq_codel-add-batch-ability-to-fq_codel_drop.patch delete mode 100644 target/linux/generic/pending-4.4/033-fq_codel-add-memory-limitation-per-queue.patch delete mode 100644 target/linux/generic/pending-4.4/034-fq_codel-fix-memory-limitation-drift.patch delete mode 100644 target/linux/generic/pending-4.4/035-fq_codel-fix-NET_XMIT_CN-behavior.patch delete mode 100644 target/linux/generic/pending-4.4/041-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch delete mode 100644 target/linux/generic/pending-4.4/042-0001-mtd-bcm47xxsflash-use-ioremap_cache-instead-of-KSEG0.patch delete mode 100644 target/linux/generic/pending-4.4/042-0002-mtd-add-arch-dependency-for-MTD_BCM47XXSFLASH-symbol.patch delete mode 100644 target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch delete mode 100644 target/linux/generic/pending-4.4/042-0005-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch delete mode 100644 target/linux/generic/pending-4.4/042-0006-mtd-bcm47xxsflash-support-reading-flash-out-of-mappi.patch delete mode 100644 target/linux/generic/pending-4.4/042-0007-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch delete mode 100644 target/linux/generic/pending-4.4/042-0008-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch delete mode 100644 target/linux/generic/pending-4.4/043-mtd-spi-nor-mx25l3205d-mx25l6405d-append-SECT_4K.patch delete mode 100644 target/linux/generic/pending-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch delete mode 100644 target/linux/generic/pending-4.4/046-ubifs-silence-error-output-if-MS_SILENT-is-set.patch delete mode 100644 target/linux/generic/pending-4.4/047-ubifs-silence-early-error-if-MS_SILENT-is-set.patch delete mode 100644 target/linux/generic/pending-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch delete mode 100644 target/linux/generic/pending-4.4/050-backport_netfilter_rtcache.patch delete mode 100644 target/linux/generic/pending-4.4/051-0001-ovl-rename-is_merge-to-is_lowest.patch delete mode 100644 target/linux/generic/pending-4.4/051-0002-ovl-override-creds-with-the-ones-from-the-superblock.patch delete mode 100644 target/linux/generic/pending-4.4/051-0005-ovl-proper-cleanup-of-workdir.patch delete mode 100644 target/linux/generic/pending-4.4/052-01-ubifs-Implement-O_TMPFILE.patch delete mode 100644 target/linux/generic/pending-4.4/052-02-ubifs-Implement-RENAME_WHITEOUT.patch delete mode 100644 target/linux/generic/pending-4.4/052-03-ubifs-Implement-RENAME_EXCHANGE.patch delete mode 100644 target/linux/generic/pending-4.4/052-04-ubifs-Use-move-variable-in-ubifs_rename.patch delete mode 100644 target/linux/generic/pending-4.4/053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch delete mode 100644 target/linux/generic/pending-4.4/053-0002-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch delete mode 100644 target/linux/generic/pending-4.4/060-mips_decompressor_memmove.patch delete mode 100644 target/linux/generic/pending-4.4/061-softirq-let-ksoftirqd-do-its-job.patch delete mode 100644 target/linux/generic/pending-4.4/067-v4.11-mtd-nand-Add-Winbond-manufacturer-id.patch delete mode 100644 target/linux/generic/pending-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch delete mode 100644 target/linux/generic/pending-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch delete mode 100644 target/linux/generic/pending-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch delete mode 100644 target/linux/generic/pending-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch delete mode 100644 target/linux/generic/pending-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch delete mode 100644 target/linux/generic/pending-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch delete mode 100644 target/linux/generic/pending-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch delete mode 100644 target/linux/generic/pending-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch delete mode 100644 target/linux/generic/pending-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch delete mode 100644 target/linux/generic/pending-4.4/072-net-add-devm-version-of-alloc_etherdev_mqs-function.patch delete mode 100644 target/linux/generic/pending-4.4/073-v4.10-0001-net-bgmac-allocate-struct-bgmac-just-once-don-t-copy.patch delete mode 100644 target/linux/generic/pending-4.4/073-v4.10-0002-net-bgmac-drop-struct-bcma_mdio-we-don-t-need-anymor.patch delete mode 100644 target/linux/generic/pending-4.4/073-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch delete mode 100644 target/linux/generic/pending-4.4/073-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch delete mode 100644 target/linux/generic/pending-4.4/074-NET-PHY-adds-driver-for-lantiq-PHY11G.patch delete mode 100644 target/linux/generic/pending-4.4/078-0001-net-phy-update-Broadcom-drivers-to-v4.5.patch delete mode 100644 target/linux/generic/pending-4.4/078-0002-net-phy-update-Broadcom-drivers-to-v4.6.patch delete mode 100644 target/linux/generic/pending-4.4/078-0003-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch delete mode 100644 target/linux/generic/pending-4.4/078-0004-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch delete mode 100644 target/linux/generic/pending-4.4/078-0006-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch delete mode 100644 target/linux/generic/pending-4.4/080-spi-introduce-accelerated-read-support-for-spi-flash.patch delete mode 100644 target/linux/generic/pending-4.4/081-spi-bcm53xx-add-spi_flash_read-callback-for-MMIO-bas.patch delete mode 100644 target/linux/generic/pending-4.4/082-0001-USB-core-let-USB-device-know-device-node.patch delete mode 100644 target/linux/generic/pending-4.4/082-0002-usb-core-usb_alloc_dev-fix-setting-of-portnum.patch delete mode 100644 target/linux/generic/pending-4.4/083-0001-clk-Add-devm_-clk_hw_-register-unregister-APIs.patch delete mode 100644 target/linux/generic/pending-4.4/083-0002-clk-Add-clk_hw-OF-clk-providers.patch delete mode 100644 target/linux/generic/pending-4.4/084-0001-usb-core-Introduce-a-USB-port-LED-trigger.patch delete mode 100644 target/linux/generic/pending-4.4/084-0002-usb-core-usbport-Use-proper-LED-API-to-fix-potential.patch delete mode 100644 target/linux/generic/pending-4.4/084-0003-usb-core-read-USB-ports-from-DT-in-the-usbport-LED-t.patch delete mode 100644 target/linux/generic/pending-4.4/085-0001-leds-leds-gpio-Set-of_node-for-created-LED-devices.patch delete mode 100644 target/linux/generic/pending-4.4/085-0002-leds-gpio-introduce-gpio_blink_set_t.patch delete mode 100644 target/linux/generic/pending-4.4/085-0003-leds-gpio-switch-to-managed-version-of-led_classdev_.patch delete mode 100644 target/linux/generic/pending-4.4/085-0004-leds-core-add-OF-variants-of-LED-registering-functio.patch delete mode 100644 target/linux/generic/pending-4.4/085-0005-leds-gpio-use-OF-variant-of-LED-registering-function.patch delete mode 100644 target/linux/generic/pending-4.4/086-0001-thermal-of-thermal-Add-devm-version-of-thermal_zone_.patch delete mode 100644 target/linux/generic/pending-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch delete mode 100644 target/linux/generic/pending-4.4/086-0003-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch delete mode 100644 target/linux/generic/pending-4.4/086-0004-thermal-broadcom-add-Northstar-thermal-driver.patch delete mode 100644 target/linux/generic/pending-4.4/086-0005-thermal-broadcom-fix-compilation-of-Northstar-driver.patch delete mode 100644 target/linux/generic/pending-4.4/087-regmap-make-LZO-cache-optional.patch delete mode 100644 target/linux/generic/pending-4.4/090-MIPS-c-r4k-Use-IPI-calls-for-CM-indexed-cache-ops.patch delete mode 100644 target/linux/generic/pending-4.4/091-MIPS-c-r4k-Exclude-sibling-CPUs-in-SMP-calls.patch delete mode 100644 target/linux/generic/pending-4.4/092-MIPS-ZBOOT-copy-appended-dtb-to-the-end-of-the-kerne.patch delete mode 100644 target/linux/generic/pending-4.4/093-MIPS-store-the-appended-dtb-address-in-a-variable.patch delete mode 100644 target/linux/generic/pending-4.4/094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch delete mode 100644 target/linux/generic/pending-4.4/096-arc-add-model-property-in-dts.patch delete mode 100644 target/linux/generic/pending-4.4/097-MIPS-io.h-Define-ioremap_cache.patch delete mode 100644 target/linux/generic/pending-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch delete mode 100644 target/linux/generic/pending-4.4/101-MIPS-fix-cache-flushing-for-highmem-pages.patch delete mode 100644 target/linux/generic/pending-4.4/102-ehci_hcd_ignore_oc.patch delete mode 100644 target/linux/generic/pending-4.4/103-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch delete mode 100644 target/linux/generic/pending-4.4/105-add-linux-spidev-compatible.patch delete mode 100644 target/linux/generic/pending-4.4/106-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch delete mode 100644 target/linux/generic/pending-4.4/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch delete mode 100644 target/linux/generic/pending-4.4/111-jffs2-add-RENAME_EXCHANGE-support.patch delete mode 100644 target/linux/generic/pending-4.4/120-bridge_allow_receiption_on_disabled_port.patch delete mode 100644 target/linux/generic/pending-4.4/132-mips_inline_dma_ops.patch delete mode 100644 target/linux/generic/pending-4.4/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch delete mode 100644 target/linux/generic/pending-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch delete mode 100644 target/linux/generic/pending-4.4/160-usb-gadget-udc-net2280-add-usb2380-support.patch delete mode 100644 target/linux/generic/pending-4.4/180-Revert-bcma-init-serial-console-directly-from-ChipCo.patch delete mode 100644 target/linux/generic/pending-4.4/200-fix_localversion.patch delete mode 100644 target/linux/generic/pending-4.4/201-extra_optimization.patch delete mode 100644 target/linux/generic/pending-4.4/202-reduce_module_size.patch delete mode 100644 target/linux/generic/pending-4.4/203-kallsyms_uncompressed.patch delete mode 100644 target/linux/generic/pending-4.4/204-module_strip.patch delete mode 100644 target/linux/generic/pending-4.4/205-backtrace_module_info.patch delete mode 100644 target/linux/generic/pending-4.4/206-mips-disable-vdso.patch delete mode 100644 target/linux/generic/pending-4.4/207-mips-vdso-dbg-rebuild-after-genvdso.patch delete mode 100644 target/linux/generic/pending-4.4/208-disable-modorder.patch delete mode 100644 target/linux/generic/pending-4.4/210-darwin_scripts_include.patch delete mode 100644 target/linux/generic/pending-4.4/211-sign-file-libressl.patch delete mode 100644 target/linux/generic/pending-4.4/212-byteshift_portability.patch delete mode 100644 target/linux/generic/pending-4.4/214-spidev_h_portability.patch delete mode 100644 target/linux/generic/pending-4.4/220-gc_sections.patch delete mode 100644 target/linux/generic/pending-4.4/221-module_exports.patch delete mode 100644 target/linux/generic/pending-4.4/222-arm_zimage_none.patch delete mode 100644 target/linux/generic/pending-4.4/230-openwrt_lzma_options.patch delete mode 100644 target/linux/generic/pending-4.4/250-netfilter_depends.patch delete mode 100644 target/linux/generic/pending-4.4/251-sound_kconfig.patch delete mode 100644 target/linux/generic/pending-4.4/252-mv_cesa_depends.patch delete mode 100644 target/linux/generic/pending-4.4/253-ssb_b43_default_on.patch delete mode 100644 target/linux/generic/pending-4.4/254-textsearch_kconfig_hacks.patch delete mode 100644 target/linux/generic/pending-4.4/255-lib80211_kconfig_hacks.patch delete mode 100644 target/linux/generic/pending-4.4/256-crypto_add_kconfig_prompts.patch delete mode 100644 target/linux/generic/pending-4.4/257-wireless_ext_kconfig_hack.patch delete mode 100644 target/linux/generic/pending-4.4/258-netfilter_netlink_kconfig_hack.patch delete mode 100644 target/linux/generic/pending-4.4/259-regmap_dynamic.patch delete mode 100644 target/linux/generic/pending-4.4/260-crypto_test_dependencies.patch delete mode 100644 target/linux/generic/pending-4.4/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch delete mode 100644 target/linux/generic/pending-4.4/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch delete mode 100644 target/linux/generic/pending-4.4/280-rfkill-stubs.patch delete mode 100644 target/linux/generic/pending-4.4/300-mips_expose_boot_raw.patch delete mode 100644 target/linux/generic/pending-4.4/301-mips_image_cmdline_hack.patch delete mode 100644 target/linux/generic/pending-4.4/302-mips_no_branch_likely.patch delete mode 100644 target/linux/generic/pending-4.4/304-mips_disable_fpu.patch delete mode 100644 target/linux/generic/pending-4.4/305-mips_module_reloc.patch delete mode 100644 target/linux/generic/pending-4.4/306-mips_mem_functions_performance.patch delete mode 100644 target/linux/generic/pending-4.4/307-mips_highmem_offset.patch delete mode 100644 target/linux/generic/pending-4.4/308-mips32r2_tune.patch delete mode 100644 target/linux/generic/pending-4.4/310-arm_module_unresolved_weak_sym.patch delete mode 100644 target/linux/generic/pending-4.4/320-ppc4xx_optimization.patch delete mode 100644 target/linux/generic/pending-4.4/321-powerpc_crtsavres_prereq.patch delete mode 100644 target/linux/generic/pending-4.4/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch delete mode 100644 target/linux/generic/pending-4.4/331-arc-remove-dependency-on-DEVTMPFS.patch delete mode 100644 target/linux/generic/pending-4.4/332-arc-add-OWRTDTB-section.patch delete mode 100644 target/linux/generic/pending-4.4/333-arc-enable-unaligned-access-in-kernel-mode.patch delete mode 100644 target/linux/generic/pending-4.4/400-mtd-add-rootfs-split-support.patch delete mode 100644 target/linux/generic/pending-4.4/401-mtd-add-support-for-different-partition-parser-types.patch delete mode 100644 target/linux/generic/pending-4.4/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch delete mode 100644 target/linux/generic/pending-4.4/403-mtd-hook-mtdsplit-to-Kbuild.patch delete mode 100644 target/linux/generic/pending-4.4/404-mtd-add-more-helper-functions.patch delete mode 100644 target/linux/generic/pending-4.4/410-mtd-move-forward-declaration-of-struct-mtd_info.patch delete mode 100644 target/linux/generic/pending-4.4/411-mtd-partial_eraseblock_write.patch delete mode 100644 target/linux/generic/pending-4.4/412-mtd-partial_eraseblock_unlock.patch delete mode 100644 target/linux/generic/pending-4.4/420-mtd-redboot_space.patch delete mode 100644 target/linux/generic/pending-4.4/430-mtd-add-myloader-partition-parser.patch delete mode 100644 target/linux/generic/pending-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch delete mode 100644 target/linux/generic/pending-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch delete mode 100644 target/linux/generic/pending-4.4/440-block2mtd_init.patch delete mode 100644 target/linux/generic/pending-4.4/441-block2mtd_probe.patch delete mode 100644 target/linux/generic/pending-4.4/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch delete mode 100644 target/linux/generic/pending-4.4/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch delete mode 100644 target/linux/generic/pending-4.4/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch delete mode 100644 target/linux/generic/pending-4.4/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch delete mode 100644 target/linux/generic/pending-4.4/465-m25p80-mx-disable-software-protection.patch delete mode 100644 target/linux/generic/pending-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch delete mode 100644 target/linux/generic/pending-4.4/476-mtd-spi-nor-add-eon-en25q128.patch delete mode 100644 target/linux/generic/pending-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch delete mode 100644 target/linux/generic/pending-4.4/479-enable_mtd_has_lock_for_f25l32pa.patch delete mode 100644 target/linux/generic/pending-4.4/480-mtd-set-rootfs-to-be-root-dev.patch delete mode 100644 target/linux/generic/pending-4.4/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch delete mode 100644 target/linux/generic/pending-4.4/491-ubi-auto-create-ubiblock-device-for-rootfs.patch delete mode 100644 target/linux/generic/pending-4.4/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch delete mode 100644 target/linux/generic/pending-4.4/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch delete mode 100644 target/linux/generic/pending-4.4/494-mtd-ubi-add-EOF-marker-support.patch delete mode 100644 target/linux/generic/pending-4.4/530-jffs2_make_lzma_available.patch delete mode 100644 target/linux/generic/pending-4.4/531-debloat_lzma.patch delete mode 100644 target/linux/generic/pending-4.4/532-jffs2_eofdetect.patch delete mode 100644 target/linux/generic/pending-4.4/551-ubifs-fix-default-compression-selection.patch delete mode 100644 target/linux/generic/pending-4.4/600-netfilter_conntrack_flush.patch delete mode 100644 target/linux/generic/pending-4.4/610-netfilter_match_bypass_default_checks.patch delete mode 100644 target/linux/generic/pending-4.4/611-netfilter_match_bypass_default_table.patch delete mode 100644 target/linux/generic/pending-4.4/612-netfilter_match_reduce_memory_access.patch delete mode 100644 target/linux/generic/pending-4.4/613-netfilter_optional_tcp_window_check.patch delete mode 100644 target/linux/generic/pending-4.4/616-net_optimize_xfrm_calls.patch delete mode 100644 target/linux/generic/pending-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch delete mode 100644 target/linux/generic/pending-4.4/630-packet_socket_type.patch delete mode 100644 target/linux/generic/pending-4.4/640-bridge_no_eap_forward.patch delete mode 100644 target/linux/generic/pending-4.4/641-bridge_always_accept_eap.patch delete mode 100644 target/linux/generic/pending-4.4/642-bridge_port_isolate.patch delete mode 100644 target/linux/generic/pending-4.4/645-bridge_multicast_to_unicast.patch delete mode 100644 target/linux/generic/pending-4.4/651-wireless_mesh_header.patch delete mode 100644 target/linux/generic/pending-4.4/653-disable_netlink_trim.patch delete mode 100644 target/linux/generic/pending-4.4/655-increase_skb_pad.patch delete mode 100644 target/linux/generic/pending-4.4/660-fq_codel_defaults.patch delete mode 100644 target/linux/generic/pending-4.4/661-fq_codel_keep_dropped_stats.patch delete mode 100644 target/linux/generic/pending-4.4/662-use_fq_codel_by_default.patch delete mode 100644 target/linux/generic/pending-4.4/663-remove_pfifo_fast.patch delete mode 100644 target/linux/generic/pending-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch delete mode 100644 target/linux/generic/pending-4.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch delete mode 100644 target/linux/generic/pending-4.4/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch delete mode 100644 target/linux/generic/pending-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch delete mode 100644 target/linux/generic/pending-4.4/681-NET-add-of_get_mac_address_mtd.patch delete mode 100644 target/linux/generic/pending-4.4/700-swconfig.patch delete mode 100644 target/linux/generic/pending-4.4/701-phy_extension.patch delete mode 100644 target/linux/generic/pending-4.4/702-phy_add_aneg_done_function.patch delete mode 100644 target/linux/generic/pending-4.4/703-phy-add-detach-callback-to-struct-phy_driver.patch delete mode 100644 target/linux/generic/pending-4.4/710-phy-add-mdio_register_board_info.patch delete mode 100644 target/linux/generic/pending-4.4/720-phy_adm6996.patch delete mode 100644 target/linux/generic/pending-4.4/721-phy_packets.patch delete mode 100644 target/linux/generic/pending-4.4/722-phy_mvswitch.patch delete mode 100644 target/linux/generic/pending-4.4/723-phy_ip175c.patch delete mode 100644 target/linux/generic/pending-4.4/724-phy_ar8216.patch delete mode 100644 target/linux/generic/pending-4.4/725-phy_rtl8306.patch delete mode 100644 target/linux/generic/pending-4.4/726-phy_rtl8366.patch delete mode 100644 target/linux/generic/pending-4.4/727-phy-rtl8367.patch delete mode 100644 target/linux/generic/pending-4.4/728-phy-rtl8367b.patch delete mode 100644 target/linux/generic/pending-4.4/729-phy-tantos.patch delete mode 100644 target/linux/generic/pending-4.4/730-phy_b53.patch delete mode 100644 target/linux/generic/pending-4.4/732-phy-ar8216-led-support.patch delete mode 100644 target/linux/generic/pending-4.4/733-phy_mvsw61xx.patch delete mode 100644 target/linux/generic/pending-4.4/734-net-phy-at803x-allow-to-configure-via-pdata.patch delete mode 100644 target/linux/generic/pending-4.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch delete mode 100644 target/linux/generic/pending-4.4/736-at803x-fix-reset-handling.patch delete mode 100644 target/linux/generic/pending-4.4/737-net-phy-at803x-Request-reset-GPIO-only-for-AT8030-PH.patch delete mode 100644 target/linux/generic/pending-4.4/738-net-phy-at803x-only-the-AT8030-needs-a-hardware-rese.patch delete mode 100644 target/linux/generic/pending-4.4/739-net-phy-at803x-add-support-for-AT8032.patch delete mode 100644 target/linux/generic/pending-4.4/773-bgmac-add-srab-switch.patch delete mode 100644 target/linux/generic/pending-4.4/810-pci_disable_common_quirks.patch delete mode 100644 target/linux/generic/pending-4.4/811-pci_disable_usb_common_quirks.patch delete mode 100644 target/linux/generic/pending-4.4/821-usb-Remove-annoying-warning-about-bogus-URB.patch delete mode 100644 target/linux/generic/pending-4.4/831-ledtrig_netdev.patch delete mode 100644 target/linux/generic/pending-4.4/834-ledtrig-libata.patch delete mode 100644 target/linux/generic/pending-4.4/835-misc-owl_loader.patch delete mode 100644 target/linux/generic/pending-4.4/840-rtc7301.patch delete mode 100644 target/linux/generic/pending-4.4/841-rtc_pt7c4338.patch delete mode 100644 target/linux/generic/pending-4.4/861-04_spi_gpio_implement_spi_delay.patch delete mode 100644 target/linux/generic/pending-4.4/862-gpio_spi_driver.patch delete mode 100644 target/linux/generic/pending-4.4/890-uart_optional_sysrq.patch delete mode 100644 target/linux/generic/pending-4.4/901-debloat_sock_diag.patch delete mode 100644 target/linux/generic/pending-4.4/902-debloat_proc.patch delete mode 100644 target/linux/generic/pending-4.4/904-debloat_dma_buf.patch delete mode 100644 target/linux/generic/pending-4.4/910-kobject_uevent.patch delete mode 100644 target/linux/generic/pending-4.4/911-kobject_add_broadcast_uevent.patch delete mode 100644 target/linux/generic/pending-4.4/921-use_preinit_as_init.patch delete mode 100644 target/linux/generic/pending-4.4/922-always-create-console-node-in-initramfs.patch delete mode 100644 target/linux/generic/pending-4.4/930-crashlog.patch delete mode 100644 target/linux/generic/pending-4.4/970-remove-unsane-filenames-from-deps_initramfs-list.patch delete mode 100644 target/linux/generic/pending-4.4/995-mangle_bootargs.patch delete mode 100644 target/linux/generic/pending-4.4/998-enable_wilink_platform_without_drivers.patch create mode 100644 target/linux/generic/pending-4.9/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch create mode 100644 target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch delete mode 100644 target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch delete mode 100644 target/linux/ipq40xx/base-files/etc/hotplug.d/net/16_adjust_network delete mode 100755 target/linux/ipq40xx/base-files/etc/init.d/adjust_network delete mode 100644 target/linux/ipq40xx/base-files/lib/adjust_network.sh create mode 100644 target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts delete mode 100644 target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-rt-acrh17.dts delete mode 100644 target/linux/ipq40xx/patches-4.14/050-0006-mtd-nand-qcom-Add-a-NULL-check-for-devm_kasprintf.patch delete mode 100644 target/linux/ipq40xx/patches-4.14/713-0001-essedma-fixup-ethernet-driver-rx-bug.patch delete mode 100644 target/linux/ipq40xx/patches-4.14/713-0002-essedma-refine-txq-to-be-adaptive-of-cpus-and-netdev.patch delete mode 100644 target/linux/ipq40xx/patches-4.14/901-essedma-disable-default-vlan-tagging.patch create mode 100644 target/linux/ipq40xx/patches-4.14/902-essedma-alloc-skb-ip-align.patch rename target/linux/{generic/pending-3.18 => ipq40xx/patches-4.14}/997-device_tree_cmdline.patch (53%) delete mode 100644 target/linux/ipq806x/config-4.9 rename target/linux/ipq806x/{files-4.9/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts => files-4.14/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts} (68%) delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-ap148.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-c2600.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-d7800.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-db149.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-r7800.dts delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-v1.0.dtsi delete mode 100644 target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065.dtsi delete mode 100644 target/linux/ipq806x/patches-4.9/0001-dtbindings-qcom_adm-Fix-channel-specifiers.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0002-dmaengine-Add-ADM-driver.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0003-spi-qup-Make-sure-mode-is-only-determined-once.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0004-spi-qup-Fix-transaction-done-signaling.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0005-spi-qup-Fix-DMA-mode-to-work-correctly.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0006-spi-qup-Fix-block-mode-to-work-correctly.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0007-spi-qup-properly-detect-extra-interrupts.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0008-spi-qup-don-t-re-read-opflags-to-see-if-transaction-.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0009-spi-qup-refactor-spi_qup_io_config-in-two-functions.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0010-spi-qup-call-io_config-in-mode-specific-function.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0011-spi-qup-allow-block-mode-to-generate-multiple-transa.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0012-spi-qup-refactor-spi_qup_prep_sg-to-be-more-take-spe.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0013-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0014-spi-qup-Fix-sg-nents-calculation.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0027-clk-qcom-Add-support-for-SMD-RPM-Clocks.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0028-clk-qcom-Add-support-for-RPM-Clocks.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0029-clk-qcom-clk-rpm-Fix-clk_hw-references.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0030-clk-Disable-i2c-device-on-gsbi4.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0033-ARM-qcom-automatically-select-PCI_DOMAINS-if-PCI-is-.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0034-ARM-Add-Krait-L2-register-accessor-functions.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0035-clk-mux-Split-out-register-accessors-for-reuse.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0038-clk-qcom-Add-support-for-High-Frequency-PLLs-HFPLLs.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0039-clk-qcom-Add-HFPLL-driver.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0040-clk-qcom-Add-IPQ806X-s-HFPLLs.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0041-clk-qcom-Add-support-for-Krait-clocks.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0042-clk-qcom-Add-KPSS-ACC-GCC-driver.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0043-clk-qcom-Add-Krait-clock-controller-driver.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0044-clk-Add-safe-switch-hook.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0045-cpufreq-Add-module-to-register-cpufreq-on-Krait-CPUs.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-independent-core-clocks.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0047-mtd-nand-Create-a-BBT-flag-to-access-bad-block-marke.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0048-PM-OPP-HACK-Allow-to-set-regulator-without-opp_list.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0049-PM-OPP-Support-adjusting-OPP-voltages-at-runtime.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0050-OPP-Allow-notifiers-to-call-dev_pm_opp_get_-voltage-.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0051-PM-OPP-Add-a-helper-to-get-an-opp-regulator-for-devi.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0053-regulator-add-smb208-support.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0054-cpufreq-dt-Handle-OPP-voltage-adjust-events.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0055-cpufreq-dt-Add-L2-frequency-scaling-support.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0056-cpufreq-dt-Add-missing-rcu-locks.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0058-clk-qcom-Always-add-factor-clock-for-xo-clocks.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0059-ARM-cpuidle-Add-cpuidle-support-for-QCOM-cpus.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0061-mtd-rootfs-conflicts-with-OpenWrt-auto-mounting.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0062-ipq806x-gcc-Added-the-enable-regs-and-mask-for-PRNG.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0063-1-ipq806x-tsens-driver.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0063-2-tsens-support-configurable-interrupts.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0064-clk-clk-rpm-fixes.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0065-arm-override-compiler-flags.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0067-generic-Mangle-bootloader-s-kernel-arguments.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0068-spi-add-gpio-cs-support.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0069-arm-boot-add-dts-files.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0070-qcom-spm-fix-probe-order.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-1-PCI-qcom-Fixed-IPQ806x-specific-clocks.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-2-PCI-qcom-Fixed-IPQ806x-PCIE-reset-changes.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-3-PCI-qcom-Fixed-IPQ806x-PCIE-init-changes.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-4-PCIE-designware-Fixed-PCI-host-init.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-5-PCI-qcom-Programming-the-PCIE-iATU-for-IPQ806x.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-6-PCI-qcom-Force-GEN1-support.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-7-pcie-Set-PCIE-MRRS-and-MPS-to-256B.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-8-pcie-qcom-Fixed-pcie_phy_clk-branch-issue.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0071-9-pcie-qcom-change-duplicate-pci-reset-to-phy-reset.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0072-ipq-scm-TZ-don-t-need-clock-to-be-enabled-disabled-for-ipq.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0073-pinctrl-qom-use-scm_call-to-route-GPIO-irq-to-Apps.patch delete mode 100644 target/linux/ipq806x/patches-4.9/0074-ipq806x-usb-Control-USB-master-reset.patch delete mode 100644 target/linux/ipq806x/patches-4.9/104-mtd-nand-add-Winbond-manufacturer-and-chip.patch delete mode 100644 target/linux/ipq806x/patches-4.9/105-mtd-nor-add-mx25l25635f.patch delete mode 100644 target/linux/ipq806x/patches-4.9/310-msm-adhoc-bus-support.patch delete mode 100644 target/linux/ipq806x/patches-4.9/850-soc-add-qualcomm-syscon.patch create mode 100644 target/linux/lantiq/ase/config-4.9 rename target/linux/{ath79/config-4.14 => lantiq/config-4.9} (66%) create mode 100644 target/linux/lantiq/falcon/config-4.9 delete mode 100644 target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-HYNIX.dts delete mode 100644 target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-MICRON.dts rename target/linux/lantiq/files-4.14/arch/mips/boot/dts/{FRITZ3370-REV2.dtsi => FRITZ3370.dts} (78%) create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ACMP252.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ALL0333CJ.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4510PW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01A.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4519PW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4520PW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4525PW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV452CQW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7506PW11.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7510PW22.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7518PW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519PW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519RW22.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7525PW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW22.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV8539PW22.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ASL56026.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV2B.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV3A.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV5A.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN1000B.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500B.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/DM200.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50712.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50810.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NAND.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NOR.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88388.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88444.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000-base.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NAND.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NOR.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000SFLASH.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020V18.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98021.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE1588.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-MDU.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-SFP.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ3370.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7320.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7360SL.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/GIGASX76X.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/H201L.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2601HNFX.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF3.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUFX.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8970.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8980.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW89X0.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VG3503J.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22BRN.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22NOR.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519BRN.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519NOR.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/VR200v.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR300.dts create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/amazonse.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/ar9.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/danube.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon-sflash-16M.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon.dtsi create mode 100644 target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi create mode 100644 target/linux/lantiq/patches-4.14/0002-gpio-stp-xway-Implement-get-callback.patch create mode 100644 target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch create mode 100644 target/linux/lantiq/patches-4.9/0002-gpio-stp-xway-Implement-get-callback.patch create mode 100644 target/linux/lantiq/patches-4.9/0004-MIPS-lantiq-add-atm-hack.patch create mode 100644 target/linux/lantiq/patches-4.9/0008-MIPS-lantiq-backport-old-timer-code.patch create mode 100644 target/linux/lantiq/patches-4.9/0018-MTD-nand-lots-of-xrx200-fixes.patch create mode 100644 target/linux/lantiq/patches-4.9/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch create mode 100644 target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch create mode 100644 target/linux/lantiq/patches-4.9/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch create mode 100644 target/linux/lantiq/patches-4.9/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch create mode 100644 target/linux/lantiq/patches-4.9/0025-NET-MIPS-lantiq-adds-xrx200-net.patch create mode 100644 target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch create mode 100644 target/linux/lantiq/patches-4.9/0027-01-net-phy-intel-xway-add-VR9-version-number.patch create mode 100644 target/linux/lantiq/patches-4.9/0027-02-net-phy-intel-xway-add-VR9-v1.1-phy-ids.patch create mode 100644 target/linux/lantiq/patches-4.9/0028-NET-lantiq-various-etop-fixes.patch rename target/linux/{ipq806x/patches-4.9/0066-GPIO-add-named-gpio-exports.patch => lantiq/patches-4.9/0030-GPIO-add-named-gpio-exports.patch} (90%) create mode 100644 target/linux/lantiq/patches-4.9/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch create mode 100644 target/linux/lantiq/patches-4.9/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch create mode 100644 target/linux/lantiq/patches-4.9/0040-USB-DWC2-enable-usb-power-gpio.patch create mode 100644 target/linux/lantiq/patches-4.9/0042-arch-mips-increase-io_space_limit.patch create mode 100644 target/linux/lantiq/patches-4.9/0044-pinctrl-xway-fix-copy-paste-error-in-xrx200_grps.patch create mode 100644 target/linux/lantiq/patches-4.9/0047-poweroff.patch create mode 100644 target/linux/lantiq/patches-4.9/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch create mode 100644 target/linux/lantiq/patches-4.9/0061-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch create mode 100644 target/linux/lantiq/patches-4.9/0065-MIPS-lantiq-improve-USB-initialization.patch create mode 100644 target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch create mode 100644 target/linux/lantiq/patches-4.9/0091-spi-lantiq-ssc-fix-platform_no_drv_owner.cocci-warni.patch create mode 100644 target/linux/lantiq/patches-4.9/0092-spi-lantiq-ssc-add-LTQ_-prefix-to-defines.patch create mode 100644 target/linux/lantiq/patches-4.9/0101-find_active_root.patch create mode 100644 target/linux/lantiq/patches-4.9/0151-lantiq-ifxmips_pcie-use-of.patch create mode 100644 target/linux/lantiq/patches-4.9/0152-lantiq-VPE.patch create mode 100644 target/linux/lantiq/patches-4.9/0154-lantiq-pci-bar11mask-fix.patch create mode 100644 target/linux/lantiq/patches-4.9/0155-lantiq-VPE-nosmp.patch create mode 100644 target/linux/lantiq/patches-4.9/0160-owrt-lantiq-multiple-flash.patch create mode 100644 target/linux/lantiq/patches-4.9/0170-MIPS-lantiq-lock-DMA-register-accesses-for-SMP.patch create mode 100644 target/linux/lantiq/patches-4.9/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch create mode 100644 target/linux/lantiq/patches-4.9/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch create mode 100644 target/linux/lantiq/patches-4.9/0302-xrx200-add-sensors-driver.patch create mode 100644 target/linux/lantiq/xrx200/config-4.9 create mode 100644 target/linux/lantiq/xway/config-4.9 create mode 100644 target/linux/lantiq/xway_legacy/config-4.9 delete mode 100644 target/linux/mcs814x/Makefile delete mode 100755 target/linux/mcs814x/base-files/etc/board.d/01_leds delete mode 100755 target/linux/mcs814x/base-files/etc/board.d/02_network delete mode 100644 target/linux/mcs814x/base-files/lib/mcs814x.sh delete mode 100755 target/linux/mcs814x/base-files/lib/preinit/01_preinit_do_mcs814x.sh delete mode 100644 target/linux/mcs814x/config-3.18 delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/boot/dts/dlan-usb-extender.dts delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/boot/dts/mcs8140.dtsi delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/boot/dts/rbt-832.dts delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Kconfig delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile.boot delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/board-mcs8140-dt.c delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/clock.c delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.c delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/cpu.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/debug-macro.S delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/entry-macro.S delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/gpio.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/hardware.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/io.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/irqs.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/mcs814x.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/param.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/system.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/timex.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/uncompress.h delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c delete mode 100644 target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/timer.c delete mode 100644 target/linux/mcs814x/files-3.18/drivers/char/hw_random/mcs814x-rng.c delete mode 100644 target/linux/mcs814x/files-3.18/drivers/gpio/gpio-mcs814x.c delete mode 100644 target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Kconfig delete mode 100644 target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Makefile delete mode 100644 target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/nuport_mac.c delete mode 100644 target/linux/mcs814x/files-3.18/drivers/net/phy/mcs814x.c delete mode 100644 target/linux/mcs814x/files-3.18/drivers/usb/host/ehci-mcs814x.c delete mode 100644 target/linux/mcs814x/files-3.18/drivers/usb/host/ohci-mcs814x.c delete mode 100644 target/linux/mcs814x/files-3.18/drivers/watchdog/mcs814x_wdt.c delete mode 100644 target/linux/mcs814x/image/Makefile delete mode 100644 target/linux/mcs814x/modules.mk delete mode 100644 target/linux/mcs814x/patches-3.18/001-platform.patch delete mode 100644 target/linux/mcs814x/patches-3.18/003-ethernet.patch delete mode 100644 target/linux/mcs814x/patches-3.18/004-usb.patch delete mode 100644 target/linux/mcs814x/patches-3.18/005-mcs814x_rng.patch delete mode 100644 target/linux/mcs814x/patches-3.18/006-mcs814x_wdt.patch delete mode 100644 target/linux/mcs814x/patches-3.18/008-mcs814x_gpio.patch delete mode 100644 target/linux/mcs814x/patches-3.18/011-mcs814x_internal_phy.patch delete mode 100644 target/linux/mcs814x/patches-3.18/012-mtd-cfi_cmdset_0002-force-word-write.patch delete mode 100644 target/linux/mcs814x/patches-3.18/013-ohci_workarounds.patch delete mode 100644 target/linux/mcs814x/patches-3.18/014-debuguart.patch delete mode 100644 target/linux/mcs814x/profiles/000-Generic.mk delete mode 100644 target/linux/mcs814x/profiles/100-dLAN-USB-Extender.mk delete mode 100644 target/linux/mediatek/patches-4.14/0177-phy-phy-mtk-tphy-use-auto-instead-of-force-to-bypass.patch delete mode 100644 target/linux/mvebu/image/armada-3720-db.bootscript create mode 100644 target/linux/mvebu/patches-4.14/508-cpufreq-armada-37xx-Fix-clock-leak.patch create mode 100644 target/linux/mvebu/patches-4.14/527-PCI-aardvark-allow-to-specify-link-capability.patch create mode 100644 target/linux/mvebu/patches-4.14/528-arm64-dts-armada-3720-espressobin-set-max-link-to-ge.patch mode change 100644 => 100755 target/linux/octeontx/base-files/etc/board.d/02_network delete mode 100644 target/linux/omap24xx/Makefile delete mode 100644 target/linux/omap24xx/base-files/etc/config/fstab delete mode 100644 target/linux/omap24xx/base-files/etc/config/network delete mode 100644 target/linux/omap24xx/base-files/etc/config/wireless delete mode 100644 target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image delete mode 100644 target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom delete mode 100755 target/linux/omap24xx/base-files/etc/init.d/watchdog delete mode 100644 target/linux/omap24xx/base-files/etc/inittab delete mode 100644 target/linux/omap24xx/base-files/etc/pointercal delete mode 100644 target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin delete mode 100644 target/linux/omap24xx/config-4.1 delete mode 100644 target/linux/omap24xx/image/Makefile delete mode 100644 target/linux/omap24xx/modules.mk delete mode 100644 target/linux/omap24xx/profiles/100-n810.mk delete mode 100644 target/linux/omap24xx/profiles/110-n810-gui.mk delete mode 100644 target/linux/ppc40x/Makefile delete mode 100644 target/linux/ppc40x/base-files/lib/preinit/01_sysinfo delete mode 100644 target/linux/ppc40x/base-files/lib/upgrade/platform.sh delete mode 100644 target/linux/ppc40x/config-3.18 delete mode 100644 target/linux/ppc40x/image/Makefile delete mode 100644 target/linux/ppc40x/modules.mk delete mode 100644 target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch delete mode 100644 target/linux/ppc40x/patches-3.18/004-magicbox.patch delete mode 100644 target/linux/ppc40x/patches-3.18/005-openrb.patch delete mode 100644 target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch delete mode 100644 target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch delete mode 100644 target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch delete mode 100644 target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch delete mode 100644 target/linux/ppc44x/Makefile delete mode 100644 target/linux/ppc44x/base-files/etc/inittab delete mode 100644 target/linux/ppc44x/config-3.18 delete mode 100644 target/linux/ppc44x/image/Makefile delete mode 100644 target/linux/ppc44x/patches-3.18/001-crypto-amcc-remove-incorrect-__init-__exit-markups.patch delete mode 100644 target/linux/ppc44x/patches-3.18/100-openwrt_flashmap.patch delete mode 100644 target/linux/ppc44x/patches-3.18/110-openwrt_dts_cmdline.patch delete mode 100644 target/linux/ppc44x/patches-3.18/900-bootwrapper-parallel-make-fix.patch create mode 100644 target/linux/ramips/dts/K2G.dts create mode 100644 target/linux/ramips/dts/RBM33G.dts create mode 100644 target/linux/ramips/dts/TL-WR842NV5.dts create mode 100644 target/linux/ramips/dts/WRC-1167GHBK2-S.dts rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/Kconfig (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/Makefile (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/esw_rt3050.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/esw_rt3050.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/ethtool.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/ethtool.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/gsw_mt7620.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/gsw_mt7620.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/gsw_mt7621.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mdio.c (98%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mdio.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mdio_mt7620.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mdio_rt2880.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mdio_rt2880.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mt7530.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mt7530.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mtk_debugfs.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mtk_eth_soc.c (98%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mtk_eth_soc.h (99%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mtk_offload.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/mtk_offload.h (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/soc_mt7620.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/soc_mt7621.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/soc_rt2880.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/soc_rt3050.c (100%) rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => mtk}/soc_rt3883.c (100%) create mode 100644 target/linux/ramips/image/lzma-loader/src/board-mt7621.c create mode 100644 target/linux/ramips/image/lzma-loader/src/mt7621.mk delete mode 100644 target/linux/ramips/patches-4.14/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch delete mode 100644 target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch create mode 100644 target/linux/ramips/patches-4.14/0090-ethernet.patch delete mode 100644 target/linux/xburst/Makefile delete mode 100755 target/linux/xburst/base-files/etc/board.d/01_system delete mode 100644 target/linux/xburst/base-files/etc/config/fstab delete mode 100644 target/linux/xburst/base-files/etc/config/network delete mode 100644 target/linux/xburst/config-3.18 delete mode 100644 target/linux/xburst/image/Makefile delete mode 100644 target/linux/xburst/image/ubinize.cfg delete mode 100644 target/linux/xburst/modules.mk delete mode 100644 target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch delete mode 100644 target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch delete mode 100644 target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch delete mode 100644 target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch delete mode 100644 target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch delete mode 100644 target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch delete mode 100644 target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch delete mode 100644 target/linux/xburst/qi_lb60/config-default delete mode 100644 target/linux/xburst/qi_lb60/target.mk delete mode 100644 target/linux/zynq/Makefile delete mode 100644 target/linux/zynq/base-files.mk delete mode 100755 target/linux/zynq/base-files/etc/board.d/02_network delete mode 100644 target/linux/zynq/base-files/etc/config/network delete mode 100644 target/linux/zynq/base-files/etc/inittab delete mode 100644 target/linux/zynq/config-4.4 delete mode 100644 target/linux/zynq/image/Makefile delete mode 100755 target/linux/zynq/image/mkits.sh delete mode 100644 toolchain/binutils/patches/arc-2016.09-release/300-001_ld_makefile_patch.patch delete mode 100644 toolchain/binutils/patches/arc-2016.09-release/300-012_check_ldrunpath_length.patch create mode 100644 toolchain/gcc/patches/7.3.0/931-libffi-fix-MIPS-softfloat-build-issue.patch create mode 100644 toolchain/gcc/patches/7.3.0/960-gotools-fix-compilation-when-making-cross-compiler.patch create mode 100644 toolchain/musl/patches/010-sys-socket.h-fix-SO_PEERSEC-value-on-MIPS.patch delete mode 100644 tools/bison/patches/001-fix-macos-vasnprintf.patch create mode 100644 tools/cmake/patches/140-curl-fix-libressl.patch create mode 100644 tools/cmake/patches/150-libarchive-fix-libressl.patch create mode 100644 tools/findutils/patches/110-glibc-change-work-around.patch create mode 100644 tools/firmware-utils/src/dns313-header.c create mode 100644 tools/lzma-old/patches/120-add-cflags.patch create mode 100644 tools/m4/patches/010-glibc-change-work-around.patch create mode 100644 tools/make-ext4fs/patches/100-add-ldflags.patch delete mode 100644 tools/mtd-utils/patches/120-include_sysmacros.patch delete mode 100644 tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch delete mode 100644 tools/mtd-utils/patches/310-add-static-linking-option.patch create mode 100644 tools/zlib/Makefile create mode 100644 tools/zlib/patches/900-overridable-pc-exec-prefix.patch diff --git a/config/Config-images.in b/config/Config-images.in index 4978cfa4f..90e873edb 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -18,7 +18,6 @@ menu "Target Images" default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx - default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx default TARGET_INITRAMFS_COMPRESSION_NONE depends on TARGET_ROOTFS_INITRAMFS help @@ -70,7 +69,7 @@ menu "Target Images" config TARGET_ROOTFS_TARGZ bool "tar.gz" - default n if USES_TARGZ + default y if USES_TARGZ help Build a compressed tar archive of the root filesystem. @@ -78,7 +77,7 @@ menu "Target Images" menuconfig TARGET_ROOTFS_EXT4FS bool "ext4" - default n if USES_EXT4 + default y if USES_EXT4 help Build an ext4 root filesystem. @@ -227,7 +226,7 @@ menu "Target Images" config GRUB_TIMEOUT string "Seconds to wait before booting the default entry" depends on GRUB_IMAGES - default "0" + default "5" help If you don't know, 5 seconds is a reasonable default. @@ -244,17 +243,15 @@ menu "Target Images" select GRUB_IMAGES select TARGET_IMAGES_PAD select PACKAGE_kmod-e1000 - default y config TARGET_IMAGES_PAD bool "Pad images to filesystem size (for JFFS2)" depends on GRUB_IMAGES - default y config TARGET_IMAGES_GZIP bool "GZip images" depends on TARGET_IMAGES_PAD || TARGET_ROOTFS_EXT4FS || TARGET_x86 - default n + default y comment "Image Options" @@ -268,7 +265,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 90 + default 256 help Select the root filesystem partition size. diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 9b55f1c0d..0cbe5e835 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -67,7 +67,7 @@ config KERNEL_PROFILING config KERNEL_KALLSYMS bool "Compile the kernel with symbol table information" - default n + default y if !SMALL_FLASH help This will give you more information in stack traces from kernel oopses. diff --git a/feeds.conf.default b/feeds.conf.default index 763a26902..3e43e57d8 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ src-git packages https://git.openwrt.org/feed/packages.git;openwrt-18.06 src-git luci https://git.openwrt.org/project/luci.git;openwrt-18.06 src-git routing https://git.openwrt.org/feed/routing.git;openwrt-18.06 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-18.06 +#src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-18.06 diff --git a/include/feeds.mk b/include/feeds.mk index cecd30424..d20cdfe06 100644 --- a/include/feeds.mk +++ b/include/feeds.mk @@ -10,17 +10,11 @@ FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*)) FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n)) -FEEDS_ENABLED:=$(foreach feed,$(FEEDS_AVAILABLE),$(if $(CONFIG_FEED_$(feed)),$(feed))) -FEEDS_DISABLED:=$(filter-out $(FEEDS_ENABLED),$(FEEDS_AVAILABLE)) PACKAGE_SUBDIRS=$(PACKAGE_DIR) ifneq ($(CONFIG_PER_FEED_REPO),) PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base - ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),) - PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED)) - else - PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_ENABLED),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED)) - endif + PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED)) endif opkg_package_files = $(wildcard \ @@ -39,10 +33,11 @@ endef # 1: destination file define FeedSourcesAppend ( \ - echo "src/gz %d_core %U/targets/%S/packages"; \ + echo 'src/gz %d_core %U/targets/%S/packages'; \ $(strip $(if $(CONFIG_PER_FEED_REPO), \ - $(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %d_$(feed) %U/packages/%A/$(feed)";) \ - $(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \ - $(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %d_$(feed) %U/packages/%A/$(feed)";)))) \ + echo 'src/gz %d_base %U/packages/%A/base'; \ + $(foreach feed,$(FEEDS_AVAILABLE), \ + $(if $(CONFIG_FEED_$(feed)), \ + echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \ ) >> $(1) endef diff --git a/include/image-commands.mk b/include/image-commands.mk index a84865539..4d3f025b1 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -60,7 +60,7 @@ endef define Build/netgear-dni $(STAGING_DIR_HOST)/bin/mkdniimg \ - -B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(REVISION) \ + -B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \ $(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \ -r "$(1)" \ -i $@ -o $@.new @@ -135,7 +135,7 @@ define Build/lzma-no-dict endef define Build/gzip - gzip --force -9n -c $@ $(1) > $@.new + gzip -f -9n -c $@ $(1) > $@.new @mv $@.new $@ endef @@ -186,6 +186,10 @@ define Build/append-ubi rm $@.tmp endef +define Build/append-uboot + dd if=$(UBOOT_PATH) >> $@ +endef + define Build/pad-to dd if=$@ of=$@.new bs=$(1) conv=sync mv $@.new $@ diff --git a/include/image.mk b/include/image.mk index d35805400..f2a85f6fe 100644 --- a/include/image.mk +++ b/include/image.mk @@ -393,6 +393,7 @@ endef define Device/Check/Common _PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile)))) + DEVICE_PACKAGES += $$(call extra_packages,$$(DEVICE_PACKAGES)) ifdef TARGET_PER_DEVICE_ROOTFS $$(eval $$(call merge_packages,_PACKAGES,$$(DEVICE_PACKAGES) $$(call DEVICE_EXTRA_PACKAGES,$(1)))) ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(_PACKAGES))) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index c3658c216..b7bcf0e17 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -11,7 +11,7 @@ ifneq ($(DUMP),1) all: compile endif -KERNEL_FILE_DEPENDS=$(BACKPORT_PATCH_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR) +KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR) STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,$(KERNEL_FILE_DEPENDS),))) STAMP_CONFIGURED:=$(LINUX_DIR)/.configured include $(INCLUDE_DIR)/download.mk diff --git a/include/kernel-version.mk b/include/kernel-version.mk index f43344ab8..89ba1bb05 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -2,15 +2,11 @@ LINUX_RELEASE?=1 -LINUX_VERSION-3.18 = .71 -LINUX_VERSION-4.4 = .121 -LINUX_VERSION-4.9 = .107 -LINUX_VERSION-4.14 = .48 +LINUX_VERSION-4.9 = .123 +LINUX_VERSION-4.14 = .66 -LINUX_KERNEL_HASH-3.18.71 = 5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240 -LINUX_KERNEL_HASH-4.4.121 = 44a88268b5088dc326b30c9b9133ac35a9a200b636b7268d08f32abeae6ca729 -LINUX_KERNEL_HASH-4.9.107 = 3ce7f40ecee096cda1d51eb2cada105a39abe8da7b968ef85f52be961f22cad3 -LINUX_KERNEL_HASH-4.14.48 = 80a0608f611fe7a5c54556402cdc2880a21301e1c4e1b19d4c1db82ad2bf22b9 +LINUX_KERNEL_HASH-4.9.123 = 8d12ceab9f8cbfd0555c881b35ed4384cf3ea8e223d894c030b04786005e5071 +LINUX_KERNEL_HASH-4.14.66 = a38061ca4c864d11a72beb3dc5918a99f13372fe9ee35508d004fdfabd460413 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 9e2717e78..c374faa64 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -190,7 +190,7 @@ $(_endef) fi; \ done; $(Package/$(1)/extra_provides) \ ) | sort -u > $(PKG_INFO_DIR)/$(1).provides - $(if $(PROVIDES),@for pkg in $(PROVIDES); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done) + $(if $(PROVIDES),@for pkg in $(filter-out $(1),$(PROVIDES)); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done) $(CheckDependencies) $(RSTRIP) $$(IDIR_$(1)) diff --git a/include/package.mk b/include/package.mk index 78ea5d0ef..2473eecb9 100644 --- a/include/package.mk +++ b/include/package.mk @@ -120,7 +120,12 @@ ifdef USE_GIT_TREE define Build/Prepare/Default mkdir -p $(PKG_BUILD_DIR) ln -s $(CURDIR)/git-src $(PKG_BUILD_DIR)/.git - ( cd $(PKG_BUILD_DIR); git checkout .) + ( cd $(PKG_BUILD_DIR); \ + git checkout .; \ + git submodule update --recursive; \ + git submodule foreach git config --unset core.worktree; \ + git submodule foreach git checkout .; \ + ) endef endif ifdef USE_SOURCE_DIR @@ -223,7 +228,7 @@ define Build/CoreTargets ifneq ($(CONFIG_AUTOREMOVE),) compile: - -touch $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null + -touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \ $(XARGS) rm -rf endif diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 691771634..edd63e9ee 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -76,11 +76,6 @@ else zlib_link_flags := -lz endif -$(eval $(call TestHostCommand,zlib, \ - Please install a static zlib. (Missing libz.a or zlib.h), \ - 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))) - $(eval $(call TestHostCommand,perl-thread-queue, \ Please install the Perl Thread::Queue module, \ perl -MThread::Queue -e 1)) @@ -143,6 +138,11 @@ $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \ wget --version | grep GNU)) +$(eval $(call SetupHostCommand,time,Please install GNU 'time' or BusyBox 'time' that supports -f, \ + gtime --version 2>&1 | grep GNU, \ + time --version 2>&1 | grep GNU, \ + busybox time 2>&1 | grep -- '-f FMT')) + $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) diff --git a/include/scan.mk b/include/scan.mk index 86d9576c8..e6b21b27b 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -12,6 +12,12 @@ OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE) export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) +ifeq ($(SCAN_NAME),target) + SCAN_DEPS=image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk image/*.mk +else + SCAN_DEPS=$(TOPDIR)/include/package*.mk +endif + ifeq ($(IS_TTY),1) define progress printf "\033[M\r$(1)" >&2; diff --git a/include/subdir.mk b/include/subdir.mk index 79a80528a..dde3e50b0 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -43,6 +43,7 @@ log_make = \ $(if $(BUILD_LOG), \ set -o pipefail; \ mkdir -p $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4));) \ + env time -f "time: $(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2)\#%U\#%S\#%e" -- \ $$(SUBMAKE) $(subdir_make_opts) $(if $(3),$(3)-)$(2) \ $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)$(if $(4),/$(4))/$(if $(3),$(3)-)$(2).txt) diff --git a/include/target.mk b/include/target.mk index adf5382e6..181d18926 100644 --- a/include/target.mk +++ b/include/target.mk @@ -56,7 +56,7 @@ else endif endif -ifneq ($(filter 3.18 4.4 4.9,$(KERNEL_PATCHVER)),) +ifneq ($(filter 4.9,$(KERNEL_PATCHVER)),) DEFAULT_PACKAGES.router:=$(filter-out kmod-ipt-offload,$(DEFAULT_PACKAGES.router)) endif @@ -77,7 +77,6 @@ define Profile $(eval $(call ProfileDefault)) $(eval $(call Profile/$(1))) dumpinfo : $(call shexport,Profile/$(1)/Description) - DEFAULT_PACKAGES := $(filter-out $(patsubst -%,%,$(filter -%,$(PACKAGES))),$(DEFAULT_PACKAGES)) PACKAGES := $(filter-out -%,$(PACKAGES)) DUMPINFO += \ echo "Target-Profile: $(1)"; \ diff --git a/include/toplevel.mk b/include/toplevel.mk index 3f5a75003..b57dcd854 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -82,8 +82,8 @@ _ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p)) prepare-tmpinfo: FORCE @+$(MAKE) -r -s staging_dir/host/.prereq-build $(PREP_MK) mkdir -p tmp/info - $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=5 SCAN_EXTRA="" - $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1" + $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA="" + $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1" for type in package target; do \ f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ [ "$$t" -nt "$$f" ] || ./scripts/$${type}-metadata.pl $(_ignore) config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ diff --git a/include/version.mk b/include/version.mk index ab427ecba..552283074 100644 --- a/include/version.mk +++ b/include/version.mk @@ -25,13 +25,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),18.06-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.lede-project.org/snapshots) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/releases/18.06-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) @@ -41,10 +41,10 @@ VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER)) VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt) VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL)) -VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://lede-project.org/) +VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://openwrt.org/) VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL)) -VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),http://bugs.lede-project.org/) +VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),http://bugs.openwrt.org/) VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL)) VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),http://forum.lede-project.org/) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 7fe8642ff..ca1cb47a6 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=190 +PKG_RELEASE:=192 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ @@ -25,9 +25,7 @@ PKG_CONFIG_DEPENDS += \ CONFIG_NAND_SUPPORT \ CONFIG_CLEAN_IPKG \ CONFIG_PER_FEED_REPO \ - CONFIG_PER_FEED_REPO_ADD_DISABLED \ - CONFIG_PER_FEED_REPO_ADD_COMMENTED \ - $(foreach feed,$(FEEDS_INSTALLED),CONFIG_FEED_$(feed)) + $(foreach feed,$(FEEDS_AVAILABLE),CONFIG_FEED_$(feed)) include $(INCLUDE_DIR)/package.mk @@ -39,7 +37,7 @@ endif define Package/base-files SECTION:=base CATEGORY:=Base system - DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:lede-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool + DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool TITLE:=Base filesystem for OpenWrt URL:=http://openwrt.org/ VERSION:=$(PKG_RELEASE)-$(REVISION) diff --git a/package/base-files/files/etc/banner.failsafe b/package/base-files/files/etc/banner.failsafe index 14615e1ef..49855e713 100644 --- a/package/base-files/files/etc/banner.failsafe +++ b/package/base-files/files/etc/banner.failsafe @@ -8,6 +8,8 @@ after mount_root: * /etc/config directory with config files for more help see: -http://wiki.openwrt.org/doc/howto/generic.failsafe +https://openwrt.org/docs/guide-user/troubleshooting/ +- failsafe_and_factory_reset +- root_password_reset ======================================================= diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl index a236a0194..4db56444c 100755 --- a/package/base-files/files/etc/init.d/sysctl +++ b/package/base-files/files/etc/init.d/sysctl @@ -39,6 +39,6 @@ apply_defaults() { start() { apply_defaults for CONF in /etc/sysctl.d/*.conf /etc/sysctl.conf; do - [ -f "$CONF" ] && sysctl -p "$CONF" -e >&- + [ -f "$CONF" ] && sysctl -e -p "$CONF" >&- done } diff --git a/package/base-files/files/etc/sysctl.d/10-default.conf b/package/base-files/files/etc/sysctl.d/10-default.conf index 9ab650924..46d079b36 100644 --- a/package/base-files/files/etc/sysctl.d/10-default.conf +++ b/package/base-files/files/etc/sysctl.d/10-default.conf @@ -5,6 +5,9 @@ kernel.panic=3 kernel.core_pattern=/tmp/%e.%t.%p.%s.core fs.suid_dumpable=2 +fs.protected_hardlinks=1 +fs.protected_symlinks=1 + net.ipv4.conf.default.arp_ignore=1 net.ipv4.conf.all.arp_ignore=1 net.ipv4.ip_forward=1 @@ -20,5 +23,3 @@ net.ipv4.tcp_dsack=1 net.ipv6.conf.default.forwarding=1 net.ipv6.conf.all.forwarding=1 - -net.netfilter.nf_conntrack_helper = 1 diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 197aef10e..318e91856 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -57,16 +57,16 @@ config () { export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1)) name="${name:-cfg$CONFIG_NUM_SECTIONS}" append CONFIG_SECTIONS "$name" - [ -n "$NO_CALLBACK" ] || config_cb "$cfgtype" "$name" export ${NO_EXPORT:+-n} CONFIG_SECTION="$name" - export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_TYPE=$cfgtype" + config_set "$CONFIG_SECTION" "TYPE" "${cfgtype}" + [ -n "$NO_CALLBACK" ] || config_cb "$cfgtype" "$name" } option () { local varname="$1"; shift local value="$*" - export ${NO_EXPORT:+-n} "CONFIG_${CONFIG_SECTION}_${varname}=$value" + config_set "$CONFIG_SECTION" "${varname}" "${value}" [ -n "$NO_CALLBACK" ] || option_cb "$varname" "$*" } @@ -81,7 +81,7 @@ list() { config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value" config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len" append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP" - list_cb "$varname" "$*" + [ -n "$NO_CALLBACK" ] || list_cb "$varname" "$*" } config_unset() { @@ -113,11 +113,8 @@ config_set() { local section="$1" local option="$2" local value="$3" - local old_section="$CONFIG_SECTION" - CONFIG_SECTION="$section" - option "$option" "$value" - CONFIG_SECTION="$old_section" + export ${NO_EXPORT:+-n} "CONFIG_${section}_${option}=${value}" } config_foreach() { diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh index 08cce49df..d7fd2dea5 100644 --- a/package/base-files/files/lib/functions/network.sh +++ b/package/base-files/files/lib/functions/network.sh @@ -6,10 +6,16 @@ __network_ifstatus() { local __tmp - [ -z "$__NETWORK_CACHE" ] && \ - export __NETWORK_CACHE="$(ubus call network.interface dump)" + [ -z "$__NETWORK_CACHE" ] && { + __tmp="$(ubus call network.interface dump 2>&1)" + case "$?" in + 4) : ;; + 0) export __NETWORK_CACHE="$__tmp" ;; + *) echo "$__tmp" >&2 ;; + esac + } - __tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "$__NETWORK_CACHE" -e "$1=@.interface${2:+[@.interface='$2']}$3")" + __tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "${__NETWORK_CACHE:-{}}" -e "$1=@.interface${2:+[@.interface='$2']}$3")" [ -z "$__tmp" ] && \ unset "$1" && \ diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 5f5c9dc8a..38056fd34 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -78,18 +78,18 @@ rootfs_type() { get_image() { # [ ] local from="$1" - local cat="$2" + local cmd="$2" - if [ -z "$cat" ]; then + if [ -z "$cmd" ]; then local magic="$(dd if="$from" bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')" case "$magic" in - 1f8b) cat="zcat";; - 425a) cat="bzcat";; - *) cat="cat";; + 1f8b) cmd="zcat";; + 425a) cmd="bzcat";; + *) cmd="cat";; esac fi - $cat "$from" 2>/dev/null + cat "$from" 2>/dev/null | $cmd } get_magic_word() { diff --git a/package/base-files/files/lib/upgrade/fwtool.sh b/package/base-files/files/lib/upgrade/fwtool.sh index 49f02b7bd..aa2ac79d1 100644 --- a/package/base-files/files/lib/upgrade/fwtool.sh +++ b/package/base-files/files/lib/upgrade/fwtool.sh @@ -1,7 +1,3 @@ -fwtool_pre_upgrade() { - fwtool -q -i /dev/null "$1" -} - fwtool_check_image() { [ $# -gt 1 ] && return 1 diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index bf5428af2..a378b0295 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -137,7 +137,6 @@ add_overlayfiles() { # hooks sysupgrade_image_check="fwtool_check_image platform_check_image" -sysupgrade_pre_upgrade="fwtool_pre_upgrade" if [ $SAVE_OVERLAY = 1 ]; then [ ! -d /overlay/upper/etc ] && { @@ -264,10 +263,8 @@ else rm -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap fi -run_hooks "" $sysupgrade_pre_upgrade - install_bin /sbin/upgraded -v "Commencing upgrade. All shell sessions will be closed now." +v "Commencing upgrade. Closing all shell sessions." COMMAND='. /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2' diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index dbbd60b15..cee8cd54e 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -183,7 +183,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "http://downloads.lede-project.org/snapshots" + default "http://downloads.openwrt.org/releases/18.06-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -268,18 +268,4 @@ menuconfig PER_FEED_REPO If set, a separate repository is generated within bin/*/packages/ for the core packages and each enabled feed. - config PER_FEED_REPO_ADD_DISABLED - bool "Add available but not enabled feeds to opkg.conf" - default y - depends on PER_FEED_REPO - help - Add not installed or disabled feeds from feeds.conf to opkg.conf. - - config PER_FEED_REPO_ADD_COMMENTED - bool "Comment out not enabled feeds" - default !BUILDBOT - depends on PER_FEED_REPO && PER_FEED_REPO_ADD_DISABLED - help - Add not enabled feeds as commented out source lines to opkg.conf. - source "tmp/.config-feeds.in" diff --git a/package/boot/at91bootstrap/Makefile b/package/boot/at91bootstrap/Makefile index e704c357d..22afd1ec4 100644 --- a/package/boot/at91bootstrap/Makefile +++ b/package/boot/at91bootstrap/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=at91bootstrap -PKG_VERSION:=v3.8.8 +PKG_VERSION:=v3.8.10 PKG_RELEASE:= PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/linux4sam/at91bootstrap.git -PKG_SOURCE_VERSION:=3d33a4e0707c61007a5278f6620453502f7500db +PKG_SOURCE_VERSION:=04efa5500d60a0211d14b6ee60df7ce0a828704d PKG_BUILD_DIR = \ $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) @@ -24,51 +24,88 @@ include $(INCLUDE_DIR)/package.mk define AT91Bootstrap/Default BUILD_TARGET:=at91 - BUILD_SUBTARGET:=sama5 HIDDEN:=1 AT91BOOTSTRAP_IMAGE:=at91bootstrap.bin endef define AT91Bootstrap/sama5d2_xplaineddf_uboot TITLE:=AT91Bootstrap for SAMA5D2 Xplained board (SPI Flash) + BUILD_SUBTARGET:=sama5d2 BUILD_DEVICES:=at91-sama5d2_xplained endef define AT91Bootstrap/sama5d2_xplaineddf_qspi_uboot TITLE:=AT91Bootstrap for SAMA5D2 Xplained board (QSPI Flash) + BUILD_SUBTARGET:=sama5d2 BUILD_DEVICES:=at91-sama5d2_xplained endef define AT91Bootstrap/sama5d2_xplainedsd_uboot TITLE:=AT91Bootstrap for SAMA5D2 Xplained board (SDcard/EMMC) + BUILD_SUBTARGET:=sama5d2 BUILD_DEVICES:=at91-sama5d2_xplained endef define AT91Bootstrap/sama5d3_xplainednf_uboot TITLE:=AT91Bootstrap for SAMA5D3 Xplained board (Nand Flash) + BUILD_SUBTARGET:=sama5d3 BUILD_DEVICES:=at91-sama5d3_xplained endef define AT91Bootstrap/sama5d3_xplainedsd_uboot TITLE:=AT91Bootstrap for SAMA5D3 Xplained board (SDcard) + BUILD_SUBTARGET:=sama5d3 BUILD_DEVICES:=at91-sama5d3_xplained endef define AT91Bootstrap/sama5d4_xplainednf_uboot_secure TITLE:=AT91Bootstrap for SAMA5D4 Xplained board (Nand Flash) + BUILD_SUBTARGET:=sama5d4 BUILD_DEVICES:=at91-sama5d4_xplained endef define AT91Bootstrap/sama5d4_xplaineddf_uboot_secure TITLE:=AT91Bootstrap for SAMA5D4 Xplained board (SPI Flash) + BUILD_SUBTARGET:=sama5d4 BUILD_DEVICES:=at91-sama5d4_xplained endef define AT91Bootstrap/sama5d4_xplainedsd_uboot_secure TITLE:=AT91Bootstrap for SAMA5D4 Xplained board (SDcard) + BUILD_SUBTARGET:=sama5d4 BUILD_DEVICES:=at91-sama5d4_xplained endef +define AT91Bootstrap/sama5d27_som1_eksd_uboot + TITLE:=AT91Bootstrap for SAMA5D27 SOM1 Ek (SDcard0) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d27_som1_ek +endef + +define AT91Bootstrap/sama5d27_som1_eksd1_uboot + TITLE:=AT91Bootstrap for SAMA5D27 SOM1 Ek (SDcard1) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d27_som1_ek +endef + +define AT91Bootstrap/sama5d27_som1_ekqspi_uboot + TITLE:=AT91Bootstrap for SAMA5D27 SOM1 Ek (QSPI Flash) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d27_som1_ek +endef + +define AT91Bootstrap/sama5d2_ptc_eknf_uboot + TITLE:=AT91Bootstrap for SAMA5D2 PTC EK (Nand Flash) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d2_ptc_ek +endef + +define AT91Bootstrap/sama5d2_ptc_eksd_uboot + TITLE:=AT91Bootstrap for SAMA5D2 PTC EK (SDCard) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d2_ptc_ek +endef + AT91BOOTSTRAP_TARGETS := \ sama5d2_xplaineddf_uboot \ sama5d2_xplaineddf_qspi_uboot \ @@ -77,7 +114,11 @@ AT91BOOTSTRAP_TARGETS := \ sama5d3_xplainedsd_uboot \ sama5d4_xplainednf_uboot_secure \ sama5d4_xplaineddf_uboot_secure \ - sama5d4_xplainedsd_uboot_secure + sama5d4_xplainedsd_uboot_secure \ + sama5d27_som1_eksd_uboot \ + sama5d27_som1_ekqspi_uboot \ + sama5d2_ptc_eknf_uboot \ + sama5d2_ptc_eksd_uboot define Build/Compile +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ diff --git a/package/boot/at91bootstrap/at91bootstrap.mk b/package/boot/at91bootstrap/at91bootstrap.mk index 92353ff96..60cd8c4d3 100644 --- a/package/boot/at91bootstrap/at91bootstrap.mk +++ b/package/boot/at91bootstrap/at91bootstrap.mk @@ -5,7 +5,7 @@ PKG_FLAGS:=nonshared export GCC_HONOUR_COPTS=s define Package/at91bootstrap/install/default - $(CP) $(PKG_BUILD_DIR)/binaries/*uboot* $(1)/ + $(CP) -avL $(PKG_BUILD_DIR)/binaries/at91bootstrap.bin $(1)/ endef Package/at91bootstrap/install = $(Package/at91bootstrap/install/default) diff --git a/package/boot/uboot-at91/Makefile b/package/boot/uboot-at91/Makefile index cad12ec2f..f0a4ba56c 100644 --- a/package/boot/uboot-at91/Makefile +++ b/package/boot/uboot-at91/Makefile @@ -7,18 +7,21 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2016.05 +PKG_VERSION:=linux4sam_5.8 PKG_RELEASE:=1 -PKG_HASH:=87d02275615aaf0cd007b54cbe9fbadceef2bee7c79e6c323ea1ae8956dcb171 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/linux4sam/u-boot-at91.git +PKG_SOURCE_VERSION:=59f202622154f82e708a6ca2bf86350a5c1b2d33 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk define U-Boot/Default BUILD_TARGET:=at91 HIDDEN:=1 - UBOOT_IMAGE:=u-boot.bin boot.bin + UBOOT_IMAGE:=u-boot.bin endef define U-Boot/at91sam9m10g45ek_nandflash @@ -30,51 +33,77 @@ endef define U-Boot/at91sam9x5ek_nandflash NAME:=AT91SAM9X5-EK board (NandFlash) BUILD_SUBTARGET:=legacy - BUILD_DEVICES:=at91sam9g15ek at91sam9g25ek at91sam9g35ek at91sam9x25ek at91sam9x35ek + BUILD_DEVICES:=at91sam9g15ek at91sam9g25ek \ + at91sam9g35ek at91sam9x25ek \ + at91sam9x35ek endef define U-Boot/sama5d3_xplained_nandflash NAME:=SAMA5D3 Xplained board (NandFlash) - BUILD_SUBTARGET:=sama5 + BUILD_SUBTARGET:=sama5d3 BUILD_DEVICES:=at91-sama5d3_xplained endef define U-Boot/sama5d3_xplained_mmc NAME:=SAMA5D3 Xplained board (SDcard) - BUILD_SUBTARGET:=sama5 + BUILD_SUBTARGET:=sama5d3 BUILD_DEVICES:=at91-sama5d3_xplained endef define U-Boot/sama5d2_xplained_spiflash NAME:=SAMA5D2 Xplained board (SPI Flash) - BUILD_SUBTARGET:=sama5 + BUILD_SUBTARGET:=sama5d2 BUILD_DEVICES:=at91-sama5d2_xplained endef define U-Boot/sama5d2_xplained_mmc NAME:=SAMA5D2 Xplained board (SDcard/EMMC) - BUILD_SUBTARGET:=sama5 + BUILD_SUBTARGET:=sama5d2 BUILD_DEVICES:=at91-sama5d2_xplained endef define U-Boot/sama5d4_xplained_spiflash NAME:=SAMA5D4 Xplained board (SPI Flash) - BUILD_SUBTARGET:=sama5 + BUILD_SUBTARGET:=sama5d4 BUILD_DEVICES:=at91-sama5d4_xplained endef define U-Boot/sama5d4_xplained_mmc NAME:=SAMA5D4 Xplained board (SDcard) - BUILD_SUBTARGET:=sama5 + BUILD_SUBTARGET:=sama5d4 BUILD_DEVICES:=at91-sama5d4_xplained endef define U-Boot/sama5d4_xplained_nandflash NAME:=SAMA5D4 Xplained board (NandFlash) - BUILD_SUBTARGET:=sama5 + BUILD_SUBTARGET:=sama5d4 BUILD_DEVICES:=at91-sama5d4_xplained endef +define U-Boot/sama5d27_som1_ek_mmc + NAME:=SAMA5D27 SOM1 Ek (SDCard) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d27_som1_ek +endef + +define U-Boot/sama5d27_som1_ek_spiflash + NAME:=SAMA5D27 SOM1 Ek (QSPI Flash) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d27_som1_ek +endef + +define U-Boot/sama5d2_ptc_ek_nandflash + NAME:=SAMA5D2 PTC Ek (Nand Flash) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d2_ptc_ek +endef + +define U-Boot/sama5d2_ptc_ek_mmc + NAME:=SAMA5D2 PTC Ek (SDCard) + BUILD_SUBTARGET:=sama5d2 + BUILD_DEVICES:=at91-sama5d2_ptc_ek +endef + UBOOT_TARGETS := \ at91sam9m10g45ek_nandflash \ at91sam9x5ek_nandflash \ @@ -84,12 +113,18 @@ UBOOT_TARGETS := \ sama5d2_xplained_spiflash \ sama5d4_xplained_mmc \ sama5d4_xplained_spiflash \ - sama5d4_xplained_nandflash + sama5d4_xplained_nandflash\ + sama5d27_som1_ek_mmc \ + sama5d27_som1_ek_spiflash \ + sama5d2_ptc_ek_nandflash \ + sama5d2_ptc_ek_mmc define Build/Compile - +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ - CROSS_COMPILE=$(TARGET_CROSS) \ - KCFLAGS="$(filter-out -fstack-protector -mfloat-abi=hard, $(TARGET_CFLAGS)) -mfloat-abi=soft" + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + CROSS_COMPILE=$(TARGET_CROSS) \ + DTC=$(LINUX_DIR)/scripts/dtc/dtc \ + KCFLAGS="$(filter-out -fstack-protector \ + -mfloat-abi=hard, $(TARGET_CFLAGS)) -mfloat-abi=soft" endef $(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 8de6455b1..2f8dd0ae6 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -12,12 +12,13 @@ PKG_DISTNAME:=u-boot PKG_VERSION:=2018.03 PKG_RELEASE:=1 -PKG_BUILD_DIR:=$(BUILD_DIR)/u-boot-$(PKG_VERSION) -PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=\ - http://mirror2.openwrt.org/sources \ - ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd +PKG_SOURCE_PROTO:=git +PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://git.denx.de/u-boot.git +PKG_SOURCE_VERSION:=f95ab1fb6e37f0601f397091bb011edf7a98b890 +PKG_MIRROR_HASH:=b50d8b6fe0d90b92c8c147457b1b4c2ed1cdb03191085cfc57fdad77c0bfffab PKG_BUILD_DEPENDS:=fstools diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx index 516042e91..2d9fcea1a 100644 --- a/package/boot/uboot-envtools/files/ar71xx +++ b/package/boot/uboot-envtools/files/ar71xx @@ -38,6 +38,7 @@ gl-ar750|\ hornet-ub|\ hornet-ub-x2|\ jwap230|\ +koala|\ mr1750|\ mr1750v2|\ mr600|\ diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index 4eae506fb..d475e5662 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -31,7 +31,8 @@ ubootenv_mtdinfo () { } case "$board" in -openmesh,a42) +openmesh,a42 |\ +openmesh,a62) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000" ;; esac diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index 57838118a..7d16a5966 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -29,6 +29,10 @@ armada-385-turris-omnia) armada-xp-linksys-mamba) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" ;; +globalscale,espressobin|\ +marvell,armada8040-mcbin) + ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch b/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch index 2ff916eb8..f90842cad 100644 --- a/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch +++ b/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch @@ -627,7 +627,7 @@ NOTE: this patch is ready for upstream, LEDE-specific parts are in +#define CONFIG_EXTRA_ENV_SETTINGS \ + "console=console=ttyS0,115200\0" \ + "mtdids=nand0=orion_nand\0" \ -+ "mtdparts="CONFIG_MTDPARTS_DEFAULT \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" + +/* diff --git a/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch b/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch index fd6dd6fa3..271442213 100644 --- a/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch +++ b/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch @@ -613,7 +613,7 @@ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "console=console=ttyS0,115200\0" \ + "mtdids=nand0=orion_nand\0" \ -+ "mtdparts="CONFIG_MTDPARTS_DEFAULT \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" + +/* diff --git a/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch b/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch index 50551bad6..1508a98c1 100644 --- a/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch +++ b/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch @@ -1212,7 +1212,7 @@ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "console=console=ttyS0,115200\0" \ + "mtdids=nand0=orion_nand\0" \ -+ "mtdparts="CONFIG_MTDPARTS_DEFAULT \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" + +/* diff --git a/package/boot/uboot-kirkwood/patches/110-dockstar.patch b/package/boot/uboot-kirkwood/patches/110-dockstar.patch index 43dce1a0d..e67a888a4 100644 --- a/package/boot/uboot-kirkwood/patches/110-dockstar.patch +++ b/package/boot/uboot-kirkwood/patches/110-dockstar.patch @@ -39,7 +39,7 @@ - "bootargs_root=ubi.mtd=1 root=ubi0:root rootfstype=ubifs ro\0" + "console=console=ttyS0,115200\0" \ + "mtdids=nand0=orion_nand\0" \ -+ "mtdparts="CONFIG_MTDPARTS_DEFAULT \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" /* diff --git a/package/boot/uboot-kirkwood/patches/120-iconnect.patch b/package/boot/uboot-kirkwood/patches/120-iconnect.patch index d2e89115e..7ff721218 100644 --- a/package/boot/uboot-kirkwood/patches/120-iconnect.patch +++ b/package/boot/uboot-kirkwood/patches/120-iconnect.patch @@ -22,9 +22,10 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ - "mtdparts="CONFIG_MTDPARTS_DEFAULT \ +- "mtdparts="CONFIG_MTDPARTS_DEFAULT \ - "kernel=/boot/uImage\0" \ - "bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0" ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" /* diff --git a/package/boot/uboot-kirkwood/patches/130-ib62x0.patch b/package/boot/uboot-kirkwood/patches/130-ib62x0.patch index ec0792c58..fcb0a88a0 100644 --- a/package/boot/uboot-kirkwood/patches/130-ib62x0.patch +++ b/package/boot/uboot-kirkwood/patches/130-ib62x0.patch @@ -18,10 +18,11 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ - "mtdparts="CONFIG_MTDPARTS_DEFAULT \ +- "mtdparts="CONFIG_MTDPARTS_DEFAULT \ - "kernel=/boot/zImage\0" \ - "fdt=/boot/ib62x0.dtb\0" \ - "bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0" ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" /* diff --git a/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch b/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch index 34379f261..93adad6aa 100644 --- a/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch +++ b/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch @@ -29,7 +29,7 @@ - "ext2load usb 0:1 0x01100000 /uInitrd\0" + "console=console=ttyS0,115200\0" \ + "mtdids=nand0=orion_nand\0" \ -+ "mtdparts="CONFIG_MTDPARTS_DEFAULT \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" /* diff --git a/package/boot/uboot-kirkwood/patches/150-goflexhome.patch b/package/boot/uboot-kirkwood/patches/150-goflexhome.patch index 186e33a0c..540c0f507 100644 --- a/package/boot/uboot-kirkwood/patches/150-goflexhome.patch +++ b/package/boot/uboot-kirkwood/patches/150-goflexhome.patch @@ -14,9 +14,10 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ - "mtdparts="CONFIG_MTDPARTS_DEFAULT \ +- "mtdparts="CONFIG_MTDPARTS_DEFAULT \ - "kernel=/boot/uImage\0" \ - "bootargs_root=ubi.mtd=root root=ubi0:root rootfstype=ubifs ro\0" ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" /* diff --git a/package/boot/uboot-mvebu/Makefile b/package/boot/uboot-mvebu/Makefile index 3005e45c4..61547acb2 100644 --- a/package/boot/uboot-mvebu/Makefile +++ b/package/boot/uboot-mvebu/Makefile @@ -15,6 +15,7 @@ PKG_HASH:=7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk define U-Boot/Default BUILD_TARGET:=mvebu @@ -31,6 +32,8 @@ endef UBOOT_TARGETS:= \ clearfog +Build/Exports:=$(Host/Exports) + define Build/Configure # enable additional options beyond clearfog_defconfig echo CONFIG_NET_RANDOM_ETHADDR=y >> $(PKG_BUILD_DIR)/configs/$(BUILD_VARIANT)_defconfig diff --git a/package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch b/package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch new file mode 100644 index 000000000..ee6c73f46 --- /dev/null +++ b/package/boot/uboot-mvebu/patches/210-link-libcrypto-static.patch @@ -0,0 +1,14 @@ +OpenWrt links the libressl statically against mkimage, make sure all the +needed dependencies are added too. + +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -145,7 +145,7 @@ endif + # MXSImage needs LibSSL + ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),) + HOSTLOADLIBES_mkimage += \ +- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") ++ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto") + + # OS X deprecate openssl in favour of CommonCrypto, supress deprecation + # warnings on those systems diff --git a/package/boot/uboot-mxs/Makefile b/package/boot/uboot-mxs/Makefile index cd752bb81..5636dcfbb 100644 --- a/package/boot/uboot-mxs/Makefile +++ b/package/boot/uboot-mxs/Makefile @@ -15,6 +15,7 @@ PKG_HASH:=6a018fd3caf58f3dcfa23ee989a82bd35df03af71872b9dca8c6d758a0d26c05 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk define U-Boot/Default BUILD_TARGET:=mxs @@ -37,6 +38,8 @@ UBOOT_TARGETS := \ UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE) +Build/Exports:=$(Host/Exports) + define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) diff --git a/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch index c99c53863..aa7285ebc 100644 --- a/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch +++ b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch @@ -1,35 +1,36 @@ -From 74e3ace3495b73f6e592e92eca18175cccdb5a24 Mon Sep 17 00:00:00 2001 +From c5b0bca4c3ca5c3d1d8ee99fdbf3b494a3986dbd Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens -Date: Sat, 17 Feb 2018 15:34:19 +0100 -Subject: [PATCH v2] tools/mxsimage: Support building with LibreSSL +Date: Sun, 18 Mar 2018 16:03:47 +0100 +Subject: [PATCH] tools/mxsimage: Support building with LibreSSL -The mxsimage utility fails to compile against LibreSSL because LibreSSL -says it is OpenSSL 2.0, but it does not support the complete OpenSSL 1.1 -interface. +The mxsimage utility fails to compile against LibreSSL version < 2.7.0 +because LibreSSL says it is OpenSSL 2.0, but it does not support the +complete OpenSSL 1.1 interface. LibreSSL defines OPENSSL_VERSION_NUMBER with 0x20000000L and therefor -claims to have an API compatible with OpenSSL 2.0, but it does not -implement OPENSSL_zalloc() and some other functions in its most recent -version. OpenSSL implements this function since version 1.1.0. +claims to have an API compatible with OpenSSL 2.0, but it implements +EVP_MD_CTX_new(), EVP_MD_CTX_free() and EVP_CIPHER_CTX_reset() only +starting with version 2.7.0, which is not yet released. OpenSSL +implements this function since version 1.1.0. This commit will activate the compatibility code meant for -OpenSSL < 1.1.0 also for all versions of LibreSSL, if some version of -LibreSSL will support these functions in the future the version check -should be adapted. +OpenSSL < 1.1.0 also for LibreSSL version < 2.7.0. Signed-off-by: Hauke Mehrtens +Reviewed-by: Jonathan Gray --- - tools/mxsimage.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + tools/mxsimage.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) --- a/tools/mxsimage.c +++ b/tools/mxsimage.c -@@ -26,7 +26,7 @@ +@@ -26,7 +26,8 @@ * OpenSSL 1.1.0 and newer compatibility functions: * https://wiki.openssl.org/index.php/1.1_API_Changes */ -#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \ ++ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) static void *OPENSSL_zalloc(size_t num) { void *ret = OPENSSL_malloc(num); diff --git a/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch b/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch new file mode 100644 index 000000000..87b70ccea --- /dev/null +++ b/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch @@ -0,0 +1,14 @@ +OpenWrt links the libressl statically against mkimage, make sure all the +needed dependencies are added too. + +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -163,7 +163,7 @@ endif + # MXSImage needs LibSSL + ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),) + HOSTLOADLIBES_mkimage += \ +- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") ++ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto") + + # OS X deprecate openssl in favour of CommonCrypto, supress deprecation + # warnings on those systems diff --git a/package/boot/uboot-oxnas/patches/410-gcc-6-compiler.patch b/package/boot/uboot-oxnas/patches/410-gcc-6-compiler.patch new file mode 100644 index 000000000..00d0657bd --- /dev/null +++ b/package/boot/uboot-oxnas/patches/410-gcc-6-compiler.patch @@ -0,0 +1,306 @@ +From: Hans de Goede +Date: Sat, 7 Feb 2015 21:52:40 +0000 (+0100) +Subject: Add linux/compiler-gcc6.h to fix builds with gcc6 +X-Git-Tag: v2015.04-rc2~31 +X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=478b02f1a7043b673565075ea5016376f3293b23 + +Add linux/compiler-gcc6.h to fix builds with gcc6 + +Add linux/compiler-gcc6/h from the kernel sources at: + +commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b +Author: Steven Noonan +Date: Sat Oct 25 15:09:42 2014 -0700 + + compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles + +Signed-off-by: Hans de Goede +--- + +--- /dev/null ++++ b/include/linux/compiler-gcc6.h +@@ -0,0 +1,284 @@ ++#ifndef __LINUX_COMPILER_H ++#error "Please don't include directly, include instead." ++#endif ++ ++/* ++ * Common definitions for all gcc versions go here. ++ */ ++#define GCC_VERSION (__GNUC__ * 10000 \ ++ + __GNUC_MINOR__ * 100 \ ++ + __GNUC_PATCHLEVEL__) ++ ++/* Optimization barrier */ ++ ++/* The "volatile" is due to gcc bugs */ ++#define barrier() __asm__ __volatile__("": : :"memory") ++/* ++ * This version is i.e. to prevent dead stores elimination on @ptr ++ * where gcc and llvm may behave differently when otherwise using ++ * normal barrier(): while gcc behavior gets along with a normal ++ * barrier(), llvm needs an explicit input variable to be assumed ++ * clobbered. The issue is as follows: while the inline asm might ++ * access any memory it wants, the compiler could have fit all of ++ * @ptr into memory registers instead, and since @ptr never escaped ++ * from that, it proofed that the inline asm wasn't touching any of ++ * it. This version works well with both compilers, i.e. we're telling ++ * the compiler that the inline asm absolutely may see the contents ++ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 ++ */ ++#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") ++ ++/* ++ * This macro obfuscates arithmetic on a variable address so that gcc ++ * shouldn't recognize the original var, and make assumptions about it. ++ * ++ * This is needed because the C standard makes it undefined to do ++ * pointer arithmetic on "objects" outside their boundaries and the ++ * gcc optimizers assume this is the case. In particular they ++ * assume such arithmetic does not wrap. ++ * ++ * A miscompilation has been observed because of this on PPC. ++ * To work around it we hide the relationship of the pointer and the object ++ * using this macro. ++ * ++ * Versions of the ppc64 compiler before 4.1 had a bug where use of ++ * RELOC_HIDE could trash r30. The bug can be worked around by changing ++ * the inline assembly constraint from =g to =r, in this particular ++ * case either is valid. ++ */ ++#define RELOC_HIDE(ptr, off) \ ++({ \ ++ unsigned long __ptr; \ ++ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ ++ (typeof(ptr)) (__ptr + (off)); \ ++}) ++ ++/* Make the optimizer believe the variable can be manipulated arbitrarily. */ ++#define OPTIMIZER_HIDE_VAR(var) \ ++ __asm__ ("" : "=r" (var) : "0" (var)) ++ ++#ifdef __CHECKER__ ++#define __must_be_array(a) 0 ++#else ++/* &a[0] degrades to a pointer: a different type from an array */ ++#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ++#endif ++ ++/* ++ * Force always-inline if the user requests it so via the .config, ++ * or if gcc is too old: ++ */ ++#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ ++ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) ++#define inline inline __attribute__((always_inline)) notrace ++#define __inline__ __inline__ __attribute__((always_inline)) notrace ++#define __inline __inline __attribute__((always_inline)) notrace ++#else ++/* A lot of inline functions can cause havoc with function tracing */ ++#define inline inline notrace ++#define __inline__ __inline__ notrace ++#define __inline __inline notrace ++#endif ++ ++#define __always_inline inline __attribute__((always_inline)) ++#define noinline __attribute__((noinline)) ++ ++#define __deprecated __attribute__((deprecated)) ++#define __packed __attribute__((packed)) ++#define __weak __attribute__((weak)) ++#define __alias(symbol) __attribute__((alias(#symbol))) ++ ++/* ++ * it doesn't make sense on ARM (currently the only user of __naked) ++ * to trace naked functions because then mcount is called without ++ * stack and frame pointer being set up and there is no chance to ++ * restore the lr register to the value before mcount was called. ++ * ++ * The asm() bodies of naked functions often depend on standard calling ++ * conventions, therefore they must be noinline and noclone. ++ * ++ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. ++ * See GCC PR44290. ++ */ ++#define __naked __attribute__((naked)) noinline __noclone notrace ++ ++#define __noreturn __attribute__((noreturn)) ++ ++/* ++ * From the GCC manual: ++ * ++ * Many functions have no effects except the return value and their ++ * return value depends only on the parameters and/or global ++ * variables. Such a function can be subject to common subexpression ++ * elimination and loop optimization just as an arithmetic operator ++ * would be. ++ * [...] ++ */ ++#define __pure __attribute__((pure)) ++#define __aligned(x) __attribute__((aligned(x))) ++#define __printf(a, b) __attribute__((format(printf, a, b))) ++#define __scanf(a, b) __attribute__((format(scanf, a, b))) ++#define __attribute_const__ __attribute__((__const__)) ++#define __maybe_unused __attribute__((unused)) ++#define __always_unused __attribute__((unused)) ++ ++/* gcc version specific checks */ ++ ++#if GCC_VERSION < 30200 ++# error Sorry, your compiler is too old - please upgrade it. ++#endif ++ ++#if GCC_VERSION < 30300 ++# define __used __attribute__((__unused__)) ++#else ++# define __used __attribute__((__used__)) ++#endif ++ ++#ifdef CONFIG_GCOV_KERNEL ++# if GCC_VERSION < 30400 ++# error "GCOV profiling support for gcc versions below 3.4 not included" ++# endif /* __GNUC_MINOR__ */ ++#endif /* CONFIG_GCOV_KERNEL */ ++ ++#if GCC_VERSION >= 30400 ++#define __must_check __attribute__((warn_unused_result)) ++#define __malloc __attribute__((__malloc__)) ++#endif ++ ++#if GCC_VERSION >= 40000 ++ ++/* GCC 4.1.[01] miscompiles __weak */ ++#ifdef __KERNEL__ ++# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 ++# error Your version of gcc miscompiles the __weak directive ++# endif ++#endif ++ ++#define __used __attribute__((__used__)) ++#define __compiler_offsetof(a, b) \ ++ __builtin_offsetof(a, b) ++ ++#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 ++# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) ++#endif ++ ++#if GCC_VERSION >= 40300 ++/* Mark functions as cold. gcc will assume any path leading to a call ++ * to them will be unlikely. This means a lot of manual unlikely()s ++ * are unnecessary now for any paths leading to the usual suspects ++ * like BUG(), printk(), panic() etc. [but let's keep them for now for ++ * older compilers] ++ * ++ * Early snapshots of gcc 4.3 don't support this and we can't detect this ++ * in the preprocessor, but we can live with this because they're unreleased. ++ * Maketime probing would be overkill here. ++ * ++ * gcc also has a __attribute__((__hot__)) to move hot functions into ++ * a special section, but I don't see any sense in this right now in ++ * the kernel context ++ */ ++#define __cold __attribute__((__cold__)) ++ ++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ++ ++#ifndef __CHECKER__ ++# define __compiletime_warning(message) __attribute__((warning(message))) ++# define __compiletime_error(message) __attribute__((error(message))) ++#endif /* __CHECKER__ */ ++#endif /* GCC_VERSION >= 40300 */ ++ ++#if GCC_VERSION >= 40500 ++/* ++ * Mark a position in code as unreachable. This can be used to ++ * suppress control flow warnings after asm blocks that transfer ++ * control elsewhere. ++ * ++ * Early snapshots of gcc 4.5 don't support this and we can't detect ++ * this in the preprocessor, but we can live with this because they're ++ * unreleased. Really, we need to have autoconf for the kernel. ++ */ ++#define unreachable() __builtin_unreachable() ++ ++/* Mark a function definition as prohibited from being cloned. */ ++#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) ++ ++#endif /* GCC_VERSION >= 40500 */ ++ ++#if GCC_VERSION >= 40600 ++/* ++ * When used with Link Time Optimization, gcc can optimize away C functions or ++ * variables which are referenced only from assembly code. __visible tells the ++ * optimizer that something else uses this function or variable, thus preventing ++ * this. ++ */ ++#define __visible __attribute__((externally_visible)) ++#endif ++ ++ ++#if GCC_VERSION >= 40900 && !defined(__CHECKER__) ++/* ++ * __assume_aligned(n, k): Tell the optimizer that the returned ++ * pointer can be assumed to be k modulo n. The second argument is ++ * optional (default 0), so we use a variadic macro to make the ++ * shorthand. ++ * ++ * Beware: Do not apply this to functions which may return ++ * ERR_PTRs. Also, it is probably unwise to apply it to functions ++ * returning extra information in the low bits (but in that case the ++ * compiler should see some alignment anyway, when the return value is ++ * massaged by 'flags = ptr & 3; ptr &= ~3;'). ++ */ ++#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) ++#endif ++ ++/* ++ * GCC 'asm goto' miscompiles certain code sequences: ++ * ++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 ++ * ++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. ++ * ++ * (asm goto is automatically volatile - the naming reflects this.) ++ */ ++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) ++ ++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP ++#if GCC_VERSION >= 40400 ++#define __HAVE_BUILTIN_BSWAP32__ ++#define __HAVE_BUILTIN_BSWAP64__ ++#endif ++#if GCC_VERSION >= 40800 ++#define __HAVE_BUILTIN_BSWAP16__ ++#endif ++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ++ ++#if GCC_VERSION >= 50000 ++#define KASAN_ABI_VERSION 4 ++#elif GCC_VERSION >= 40902 ++#define KASAN_ABI_VERSION 3 ++#endif ++ ++#if GCC_VERSION >= 40902 ++/* ++ * Tell the compiler that address safety instrumentation (KASAN) ++ * should not be applied to that function. ++ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 ++ */ ++#define __no_sanitize_address __attribute__((no_sanitize_address)) ++#endif ++ ++#endif /* gcc version >= 40000 specific checks */ ++ ++#if !defined(__noclone) ++#define __noclone /* not needed */ ++#endif ++ ++#if !defined(__no_sanitize_address) ++#define __no_sanitize_address ++#endif ++ ++/* ++ * A trick to suppress uninitialized variable warning without generating any ++ * code ++ */ ++#define uninitialized_var(x) x = x diff --git a/package/boot/uboot-oxnas/patches/420-gcc-7-compiler.patch b/package/boot/uboot-oxnas/patches/420-gcc-7-compiler.patch new file mode 100644 index 000000000..095162964 --- /dev/null +++ b/package/boot/uboot-oxnas/patches/420-gcc-7-compiler.patch @@ -0,0 +1,287 @@ +--- /dev/null ++++ b/include/linux/compiler-gcc7.h +@@ -0,0 +1,284 @@ ++#ifndef __LINUX_COMPILER_H ++#error "Please don't include directly, include instead." ++#endif ++ ++/* ++ * Common definitions for all gcc versions go here. ++ */ ++#define GCC_VERSION (__GNUC__ * 10000 \ ++ + __GNUC_MINOR__ * 100 \ ++ + __GNUC_PATCHLEVEL__) ++ ++/* Optimization barrier */ ++ ++/* The "volatile" is due to gcc bugs */ ++#define barrier() __asm__ __volatile__("": : :"memory") ++/* ++ * This version is i.e. to prevent dead stores elimination on @ptr ++ * where gcc and llvm may behave differently when otherwise using ++ * normal barrier(): while gcc behavior gets along with a normal ++ * barrier(), llvm needs an explicit input variable to be assumed ++ * clobbered. The issue is as follows: while the inline asm might ++ * access any memory it wants, the compiler could have fit all of ++ * @ptr into memory registers instead, and since @ptr never escaped ++ * from that, it proofed that the inline asm wasn't touching any of ++ * it. This version works well with both compilers, i.e. we're telling ++ * the compiler that the inline asm absolutely may see the contents ++ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 ++ */ ++#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") ++ ++/* ++ * This macro obfuscates arithmetic on a variable address so that gcc ++ * shouldn't recognize the original var, and make assumptions about it. ++ * ++ * This is needed because the C standard makes it undefined to do ++ * pointer arithmetic on "objects" outside their boundaries and the ++ * gcc optimizers assume this is the case. In particular they ++ * assume such arithmetic does not wrap. ++ * ++ * A miscompilation has been observed because of this on PPC. ++ * To work around it we hide the relationship of the pointer and the object ++ * using this macro. ++ * ++ * Versions of the ppc64 compiler before 4.1 had a bug where use of ++ * RELOC_HIDE could trash r30. The bug can be worked around by changing ++ * the inline assembly constraint from =g to =r, in this particular ++ * case either is valid. ++ */ ++#define RELOC_HIDE(ptr, off) \ ++({ \ ++ unsigned long __ptr; \ ++ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ ++ (typeof(ptr)) (__ptr + (off)); \ ++}) ++ ++/* Make the optimizer believe the variable can be manipulated arbitrarily. */ ++#define OPTIMIZER_HIDE_VAR(var) \ ++ __asm__ ("" : "=r" (var) : "0" (var)) ++ ++#ifdef __CHECKER__ ++#define __must_be_array(a) 0 ++#else ++/* &a[0] degrades to a pointer: a different type from an array */ ++#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) ++#endif ++ ++/* ++ * Force always-inline if the user requests it so via the .config, ++ * or if gcc is too old: ++ */ ++#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ ++ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) ++#define inline inline __attribute__((always_inline)) notrace ++#define __inline__ __inline__ __attribute__((always_inline)) notrace ++#define __inline __inline __attribute__((always_inline)) notrace ++#else ++/* A lot of inline functions can cause havoc with function tracing */ ++#define inline inline notrace ++#define __inline__ __inline__ notrace ++#define __inline __inline notrace ++#endif ++ ++#define __always_inline inline __attribute__((always_inline)) ++#define noinline __attribute__((noinline)) ++ ++#define __deprecated __attribute__((deprecated)) ++#define __packed __attribute__((packed)) ++#define __weak __attribute__((weak)) ++#define __alias(symbol) __attribute__((alias(#symbol))) ++ ++/* ++ * it doesn't make sense on ARM (currently the only user of __naked) ++ * to trace naked functions because then mcount is called without ++ * stack and frame pointer being set up and there is no chance to ++ * restore the lr register to the value before mcount was called. ++ * ++ * The asm() bodies of naked functions often depend on standard calling ++ * conventions, therefore they must be noinline and noclone. ++ * ++ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. ++ * See GCC PR44290. ++ */ ++#define __naked __attribute__((naked)) noinline __noclone notrace ++ ++#define __noreturn __attribute__((noreturn)) ++ ++/* ++ * From the GCC manual: ++ * ++ * Many functions have no effects except the return value and their ++ * return value depends only on the parameters and/or global ++ * variables. Such a function can be subject to common subexpression ++ * elimination and loop optimization just as an arithmetic operator ++ * would be. ++ * [...] ++ */ ++#define __pure __attribute__((pure)) ++#define __aligned(x) __attribute__((aligned(x))) ++#define __printf(a, b) __attribute__((format(printf, a, b))) ++#define __scanf(a, b) __attribute__((format(scanf, a, b))) ++#define __attribute_const__ __attribute__((__const__)) ++#define __maybe_unused __attribute__((unused)) ++#define __always_unused __attribute__((unused)) ++ ++/* gcc version specific checks */ ++ ++#if GCC_VERSION < 30200 ++# error Sorry, your compiler is too old - please upgrade it. ++#endif ++ ++#if GCC_VERSION < 30300 ++# define __used __attribute__((__unused__)) ++#else ++# define __used __attribute__((__used__)) ++#endif ++ ++#ifdef CONFIG_GCOV_KERNEL ++# if GCC_VERSION < 30400 ++# error "GCOV profiling support for gcc versions below 3.4 not included" ++# endif /* __GNUC_MINOR__ */ ++#endif /* CONFIG_GCOV_KERNEL */ ++ ++#if GCC_VERSION >= 30400 ++#define __must_check __attribute__((warn_unused_result)) ++#define __malloc __attribute__((__malloc__)) ++#endif ++ ++#if GCC_VERSION >= 40000 ++ ++/* GCC 4.1.[01] miscompiles __weak */ ++#ifdef __KERNEL__ ++# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 ++# error Your version of gcc miscompiles the __weak directive ++# endif ++#endif ++ ++#define __used __attribute__((__used__)) ++#define __compiler_offsetof(a, b) \ ++ __builtin_offsetof(a, b) ++ ++#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 ++# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) ++#endif ++ ++#if GCC_VERSION >= 40300 ++/* Mark functions as cold. gcc will assume any path leading to a call ++ * to them will be unlikely. This means a lot of manual unlikely()s ++ * are unnecessary now for any paths leading to the usual suspects ++ * like BUG(), printk(), panic() etc. [but let's keep them for now for ++ * older compilers] ++ * ++ * Early snapshots of gcc 4.3 don't support this and we can't detect this ++ * in the preprocessor, but we can live with this because they're unreleased. ++ * Maketime probing would be overkill here. ++ * ++ * gcc also has a __attribute__((__hot__)) to move hot functions into ++ * a special section, but I don't see any sense in this right now in ++ * the kernel context ++ */ ++#define __cold __attribute__((__cold__)) ++ ++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ++ ++#ifndef __CHECKER__ ++# define __compiletime_warning(message) __attribute__((warning(message))) ++# define __compiletime_error(message) __attribute__((error(message))) ++#endif /* __CHECKER__ */ ++#endif /* GCC_VERSION >= 40300 */ ++ ++#if GCC_VERSION >= 40500 ++/* ++ * Mark a position in code as unreachable. This can be used to ++ * suppress control flow warnings after asm blocks that transfer ++ * control elsewhere. ++ * ++ * Early snapshots of gcc 4.5 don't support this and we can't detect ++ * this in the preprocessor, but we can live with this because they're ++ * unreleased. Really, we need to have autoconf for the kernel. ++ */ ++#define unreachable() __builtin_unreachable() ++ ++/* Mark a function definition as prohibited from being cloned. */ ++#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) ++ ++#endif /* GCC_VERSION >= 40500 */ ++ ++#if GCC_VERSION >= 40600 ++/* ++ * When used with Link Time Optimization, gcc can optimize away C functions or ++ * variables which are referenced only from assembly code. __visible tells the ++ * optimizer that something else uses this function or variable, thus preventing ++ * this. ++ */ ++#define __visible __attribute__((externally_visible)) ++#endif ++ ++ ++#if GCC_VERSION >= 40900 && !defined(__CHECKER__) ++/* ++ * __assume_aligned(n, k): Tell the optimizer that the returned ++ * pointer can be assumed to be k modulo n. The second argument is ++ * optional (default 0), so we use a variadic macro to make the ++ * shorthand. ++ * ++ * Beware: Do not apply this to functions which may return ++ * ERR_PTRs. Also, it is probably unwise to apply it to functions ++ * returning extra information in the low bits (but in that case the ++ * compiler should see some alignment anyway, when the return value is ++ * massaged by 'flags = ptr & 3; ptr &= ~3;'). ++ */ ++#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) ++#endif ++ ++/* ++ * GCC 'asm goto' miscompiles certain code sequences: ++ * ++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 ++ * ++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. ++ * ++ * (asm goto is automatically volatile - the naming reflects this.) ++ */ ++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) ++ ++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP ++#if GCC_VERSION >= 40400 ++#define __HAVE_BUILTIN_BSWAP32__ ++#define __HAVE_BUILTIN_BSWAP64__ ++#endif ++#if GCC_VERSION >= 40800 ++#define __HAVE_BUILTIN_BSWAP16__ ++#endif ++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ++ ++#if GCC_VERSION >= 50000 ++#define KASAN_ABI_VERSION 4 ++#elif GCC_VERSION >= 40902 ++#define KASAN_ABI_VERSION 3 ++#endif ++ ++#if GCC_VERSION >= 40902 ++/* ++ * Tell the compiler that address safety instrumentation (KASAN) ++ * should not be applied to that function. ++ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 ++ */ ++#define __no_sanitize_address __attribute__((no_sanitize_address)) ++#endif ++ ++#endif /* gcc version >= 40000 specific checks */ ++ ++#if !defined(__noclone) ++#define __noclone /* not needed */ ++#endif ++ ++#if !defined(__no_sanitize_address) ++#define __no_sanitize_address ++#endif ++ ++/* ++ * A trick to suppress uninitialized variable warning without generating any ++ * code ++ */ ++#define uninitialized_var(x) x = x diff --git a/package/boot/uboot-oxnas/src/include/configs/ox820.h b/package/boot/uboot-oxnas/src/include/configs/ox820.h index 85ee3b4cd..9b6522bbe 100644 --- a/package/boot/uboot-oxnas/src/include/configs/ox820.h +++ b/package/boot/uboot-oxnas/src/include/configs/ox820.h @@ -350,6 +350,7 @@ #define CONFIG_CMD_GETTIME #define CONFIG_CMD_BOOTMENU #define CONFIG_CMD_ELF +#define CONFIG_CMD_BOOTZ #define CONFIG_DOS_PARTITION #define CONFIG_EFI_PARTITION diff --git a/package/boot/uboot-zynq/Makefile b/package/boot/uboot-zynq/Makefile index d25ecfb4b..736ebd26d 100644 --- a/package/boot/uboot-zynq/Makefile +++ b/package/boot/uboot-zynq/Makefile @@ -14,6 +14,7 @@ PKG_HASH:=e49337262ecac44dbdeac140f2c6ebd1eba345e0162b0464172e7f05583ed7bb include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk define U-Boot/Default BUILD_TARGET:=zynq @@ -42,4 +43,6 @@ UBOOT_TARGETS := \ zed \ zybo +Build/Exports:=$(Host/Exports) + $(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch new file mode 100644 index 000000000..a260e84e8 --- /dev/null +++ b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch @@ -0,0 +1,14 @@ +OpenWrt links the libressl statically against mkimage, make sure all the +needed dependencies are added too. + +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -128,7 +128,7 @@ endif + # MXSImage needs LibSSL + ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),) + HOSTLOADLIBES_mkimage += \ +- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") ++ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto") + + # OS X deprecate openssl in favour of CommonCrypto, supress deprecation + # warnings on those systems diff --git a/package/firmware/amd64-microcode/Makefile b/package/firmware/amd64-microcode/Makefile index e88b02950..4fd3d0461 100644 --- a/package/firmware/amd64-microcode/Makefile +++ b/package/firmware/amd64-microcode/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=amd64-microcode -PKG_VERSION:=20171205 +PKG_VERSION:=20180524 PKG_RELEASE:=1 PKG_SOURCE:=amd64-microcode_3.$(PKG_VERSION).$(PKG_RELEASE).tar.xz PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/non-free/a/amd64-microcode/ -PKG_HASH:=a38bc072f535a3d3c1bf4e9e545197aa5114e979e94ef7e4a67e615df2f853a7 +PKG_HASH:=7c389c357c242e7161f6872bf4e12011a71e4c0683f06fb1bcfad650a78bf0a9 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-3.$(PKG_VERSION).$(PKG_RELEASE) PKG_LICENSE_FILE:=LICENSE.amd-ucode diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile index c2b400067..6b81e1a00 100644 --- a/package/firmware/ath10k-firmware/Makefile +++ b/package/firmware/ath10k-firmware/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-firmware -PKG_SOURCE_DATE:=2018-05-12 -PKG_SOURCE_VERSION:=952afa4949cb34193040cd4e7441e1aee50ac731 -PKG_MIRROR_HASH:=dd300f3f28b8f8c07c93065fd9dc1c9785ebda8f15398b4d2d33f9418adcaf46 +PKG_SOURCE_DATE:=2018-04-19 +PKG_SOURCE_VERSION:=71e50312b54cc972657a7b08c470088447cb9676 +PKG_MIRROR_HASH:=726e7bce9917532e3b39ced6a17ca2d4c39fdf4c9bec4a3f8f2ea3e5defa6a54 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -433,25 +433,13 @@ define Package/ath10k-firmware-qca988x/install $(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/ $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00037 \ + $(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00033 \ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin endef define Package/ath10k-firmware-qca6174/install - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw2.1 - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA6174/hw2.1/board-2.bin \ - $(1)/lib/firmware/ath10k/QCA6174/hw2.1/ - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA6174/hw2.1/firmware-5.bin_SW_RM.1.1.1-00157-QCARMSWPZ-1 \ - $(1)/lib/firmware/ath10k/QCA6174/hw2.1/firmware-5.bin - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw3.0 - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA6174/hw3.0/board-2.bin \ - $(1)/lib/firmware/ath10k/QCA6174/hw3.0/ - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA6174/hw3.0/4.4.1.c1/firmware-6.bin_RM.4.4.1.c1-00042-QCARMSWP-1 \ - $(1)/lib/firmware/ath10k/QCA6174/hw3.0/firmware-6.bin + $(INSTALL_DIR) $(1)/lib/firmware/ath10k + $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/ endef define Package/ath10k-firmware-qca99x0/install diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile index 1b7288fc1..9571feed9 100644 --- a/package/firmware/intel-microcode/Makefile +++ b/package/firmware/intel-microcode/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=intel-microcode -PKG_VERSION:=20180312 -PKG_RELEASE:=1 +PKG_VERSION:=20180703 +PKG_RELEASE:=2 PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).$(PKG_RELEASE).tar.xz PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/non-free/i/intel-microcode/ -PKG_HASH:=6ccb295d23961c7b96a69280e30fdce939e1d905147b22b8428886b173812d52 +PKG_HASH:=26dfaa47100ce3d06f968edefa7539da10de7b96d5d8e26ee8174a040ee5cdae PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-3.$(PKG_VERSION).$(PKG_RELEASE) PKG_BUILD_DEPENDS:=iucode-tool/host @@ -36,14 +36,14 @@ endef define Build/Compile IUCODE_TOOL=$(STAGING_DIR)/../host/bin/iucode_tool $(MAKE) -C $(PKG_BUILD_DIR) - mkdir $(PKG_BUILD_DIR)/intel-ucode + mkdir $(PKG_BUILD_DIR)/intel-ucode-ipkg $(STAGING_DIR)/../host/bin/iucode_tool -q \ - --write-firmware=$(PKG_BUILD_DIR)/intel-ucode $(PKG_BUILD_DIR)/$(MICROCODE).bin + --write-firmware=$(PKG_BUILD_DIR)/intel-ucode-ipkg $(PKG_BUILD_DIR)/$(MICROCODE).bin endef define Package/intel-microcode/install $(INSTALL_DIR) $(1)/lib/firmware/intel-ucode - $(INSTALL_DATA) $(PKG_BUILD_DIR)/intel-ucode/* $(1)/lib/firmware/intel-ucode + $(INSTALL_DATA) $(PKG_BUILD_DIR)/intel-ucode-ipkg/* $(1)/lib/firmware/intel-ucode endef $(eval $(call BuildPackage,intel-microcode)) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index f398a98c5..1cfcc33de 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -14,7 +14,7 @@ define Build/Compile endef #ALLWIFIBOARDS:= -ALLWIFIBOARDS:=rt-acrh17 +ALLWIFIBOARDS:=zyxel_wre6606 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) define Package/ipq-wifi-default @@ -48,7 +48,7 @@ Don't install it for any other device! PREV_BOARD+=ipq-wifi-$(1) endef +$(eval $(call generate-ipq-wifi-package,zyxel_wre6606,board-zyxel_wre6606.bin,ZyXEL WRE6606)) #$(eval $(call generate-ipq-wifi-package,,,)) -$(eval $(call generate-ipq-wifi-package,rt-acrh17,board-rt-acrh17.bin,ASUS RT-ACRH17/RT-AC82U/RT-AC42U)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/package/firmware/ipq-wifi/board-rt-acrh17.bin b/package/firmware/ipq-wifi/board-rt-acrh17.bin deleted file mode 100644 index 00421bef239e275aaca20449872c07c846fe39eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12164 zcmeHNO-vg{6dr@YB%}$mc7T8x7Mnj)Sd2}9fGNfxg7Fd(L@0HmioZs7D8+>a>WGRc zqJcPwqBLrtB$OgV2|ra7Aq176sz}qO0x3P^#-+C$I7C&&p(UNQyd}Bqux#FWwGK)(RvU7^_lTvF1IF`iYkcl7m2n4{pg-9-C z#*FL7O*sIEMFCg=0JjlpEd9XWc6)uJP^g)q08p#de?ET>G!kF1{KpqrEPG4VM{La| zf#A{lo?VVi;031j=Qg*Gt)2?Nt6>h7m^rfgn#|&y@uUYC9b+8^x&R%x+U^HP=dqT< zp-Bi=4|m=f5ArfAb7e8M8J0R33y;X(|L9SV0ysL$IDD_eW$7GawvChAXRtUtZnIr9 z>y259*xB*k zn^udlI8Esch;g6aODrp+2wV*EgTwv~ZL+0*$+nY_Hrs?s>YniGWXauVx!z7ejoxsAn@|?5-_c|w~vpHuaiVm z-Ijdv*Q;k@C6SSG{1+vQh>*)7WU^ABA89i6lVH#p5(S3JyKJF?YSy-+fU�(S}*uS?(Ut1jbmt70Tx62njwN`=xnC}$}L8jyi9&}yV!Qo{_C zL1oaFTkzKCc5TsMWMm}y|Fq2BwOqeD=E_mqq_s~LZjI~z<-hv&!!s$rhOJzE9wi>7 zO%UL>#wNhHxep{tZV2!Oj{uJVj{uJVj{uLr0Y)H56$HbHQ>s(2h)7kX!Ysm%B~V;> zbKt?8Ys>yL!lq3 zZcid4Jt2|HNfJpzf&;O(dweoX_W1?d75n^llP>}j8IJJ_!U~oQe!I!H+qdg25d_*~ z0Al?h&;X543n2JyPH_c*Bp`?QeJT8cjSRoH!?FhZbv}wGI+5ac%#5^ifDi)F6(4dK zpI?0P3_N}M%q|(7VV({i0x#|#k$4HKaRmYZftS$lHl}Yeu}Dl|+K!Jd!#CIdiN~AC znCPg;*U65`ougLgsLs)6O3KccSDQMzZgt=39~>ULKQT4))6b6=JU_8oTlDO?br1Ch z_Btp{w6m2^dkvJ=8W9L60t5Zn>b6d*yj^SS9_D&xl0Y<(1m%cfzNEXq z{-(d~uYWViOs0RC4H@DXalRxjHa8|cPb|#@)z#Gi%Fb1I4nQhQ6%BQ3%HldEaap9A~itkQf% zqk%H9w& zNn6Bv-NzOS2Y~ypw(G)!h64N6lbS6#-PFhvkT0VFkI|@4l@?4>8|~1Rnc8vy`GN)# zRKpg3FH;k!q=7|*(BSR>z|GCg)fIw%+m4wspx^Z51MAZhtlA~Zq1ff%z>RA(Bluxs z5c5DEkBoNoH7hq|e=s`Gr%@`3^8``j=lj|Y)hae*Cyx(9txh4$PWm1Sh~h}&yaIDDw77|l*49U@oa4&8l?%7Sbjboi;Vrg)^?V7a3_D-wZV+lo^_sZ>Ai~@vvNT29zw%?ESKy8QIY<>fkl| zRo%PTGJtBLl|hQz=XdvJwMEtXmGusn^sa8>)G^CHAFS$0I}p|2Tk&9YlP0c(qhOWX zA5wmn*T%04-gaZSsrN^RW151hG=rPFQ$C4o^sBrv+S;GAC$z?={OlRUamk?%ngZq5 zM;lMB+RLtCmc3snQPCO^aC2X}dp78VNM;oOjrP;Lm9Tj06`7_Lx^u{d-2vm-PJ6wSqT z34D_mE%P#6X;))oem&utkP$O-)G1$Z1#ntt{ z&_;(lY|8&TlRw$Z+~qYR@OlJxU$a*;f+u{WNRvc_;lkxcMiLr3IM|@g$`%n}=#OpC z*ujBsW3z+`17R@4h?o(F#4&0bTJ|37&~zVvT>(Oa+_FpYLcI8154{)xNB}i!&QE`s&d5P>_&KNu5iul4JQB~3e;Ch5K~nfBXe<)T5Fn-?w5KhrrkI36Q&g1t z+WxTx5+=fY#$*H{f&4%;1Ic)n!N^5&`MGEUlJG2nk&2}9Q&Dm!OwWm-Na*K0$B*5b z4(-VF6#kYnb!M@wS^B)p*5(Y?q|_X2+4~eq6iQYQpbiZyz?hjABuZuoP!$RR3IPfM z3IPfM3IPfM3IPg%1%tppUlRwJx~(e&wzhMSY1tYEx>>FsdjtS1o7Dqjk6ta|oo;x$ zn#<)N28|u$=SVj4&N+-P*r2fkeI3b0EFD1nf&&d2JJ8#aY_=XJ^VRN{I|GOk@zLWz z1Z3-QVG1*pxGseDbT{5_V0r@6uZ?MQHwy?^PWqvpubts!AtP~OId7Qrvqfw3>Gm5~wQVe^^Dl{<2+j$EBX*XI{)E~}KQyN(_29~eA0 za$)S+?O)vc@{#=;rmf={7q6VG1jITh>eX&s2_@D*(e!rXDk!o3iN?1ZS3vCt(W-~@ zqw8b`%lk4NTh@%%6_i$KdOkm+yE5^GHT`{=uf1`yUa}ZLNDw~=Wr56>nG6&``6!wR z5?>}VgouzYL=%Cu;^^s1ccK_s;_sIrpYfaK*gGcfj?h)0u$IWCErk z`S|#N>B(&LnJY`7%-rhDEx1-Ui&z7!C*}}XZEI=6@bIuDvlW{;AI3@}8_WxGDVLhG z4MzrWK$L6=n`%QLKp{XOU@rnV=N@wHNzOe~?Dc_zs z#$S7HQYg;72_0Lg??y=f?`>_le=?nIPwGUtX1dw=7E#K5E(%jZ4;Iu@h2Saz&Y3>4tS|gg=EVPq)?(zvVwp!92!=pMwu5Z0=mdgN?jF$rUai-ryXO_% zY5PKV`juWdnYD+v!?%E*)qlF6GqELT8zW!cx9-Pr_1=Xm)?Oc~IGVDTv%|aOM*oK` zJh_jQE^gBncEV>OY+sRcs5kE?iH&|T56R`>t)B`Gu&cdG@Ajjue1-o;dU|_bQDVI!4n^MCe?;kdgZj7kgA0TqU!uB&-N|YgRXgS21&|dnE1nlNWrqc4`XuBx2kWFVUs*b^Yr)qni9a zTCfKWHE{|7CqQ6^2XN@|%l|it`*g8@$FchL(SUdYM|gM`e8Z=2a6&^uxFH2#K|O)P z0yLC~LSWtyc=6)Jw}hCu_j4192Y9NNf?RzW?YH`E;48hy+zjJ1y;7X}x#jCS62IP3 zERKI5lU(~yoM#VtK{(HzZO*kf^6YWW{Sy&<%H^_yynUIFi@$O;S4^fbScdJ!ljF~q ziqMDv&WU%0ocN;S=kCn~C*C;DT$R?i_D1`B^6l}lDbD@W(%dXGigP~;&?pzjM!=Re ZV{1J7>2}AS -Date: Sun, 7 Jan 2018 14:38:36 +0800 -Subject: [PATCH] custom fix txpower and dfs - ---- - db.txt | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/db.txt b/db.txt -index 75dc0a3..24989ad 100644 ---- a/db.txt -+++ b/db.txt -@@ -277,9 +277,9 @@ country CL: DFS-JP - (5735 - 5835 @ 80), (20) - - country CN: DFS-FCC -- (2402 - 2482 @ 40), (20) -- (5170 - 5250 @ 80), (23), AUTO-BW -- (5250 - 5330 @ 80), (23), DFS, AUTO-BW -+ (2402 - 2482 @ 40), (30) -+ (5170 - 5250 @ 80), (30), AUTO-BW -+ (5250 - 5330 @ 80), (30), AUTO-BW - (5735 - 5835 @ 80), (30) - # 60 GHz band channels 1,4: 28dBm, channels 2,3: 44dBm - # ref: http://www.miit.gov.cn/n11293472/n11505629/n11506593/n11960250/n11960606/n11960700/n12330791.files/n12330790.pdf -@@ -1238,9 +1238,9 @@ country UG: DFS-FCC - country US: DFS-FCC - (2402 - 2472 @ 40), (30) - # 5.15 ~ 5.25 GHz: 30 dBm for master mode, 23 dBm for clients -- (5170 - 5250 @ 80), (23), AUTO-BW -- (5250 - 5330 @ 80), (23), DFS, AUTO-BW -- (5490 - 5730 @ 160), (23), DFS -+ (5170 - 5250 @ 80), (30), AUTO-BW -+ (5250 - 5330 @ 80), (30), AUTO-BW -+ (5490 - 5730 @ 160), (30) - (5735 - 5835 @ 80), (30) - # 60g band - # reference: http://cfr.regstoday.com/47cfr15.aspx#47_CFR_15p255 --- -2.7.4 diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index 9c69dee72..097500ebb 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-ct -PKG_RELEASE=2 +PKG_RELEASE=3 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= diff --git a/package/kernel/ath10k-ct/patches/081-ath10k-calibration-variant.patch b/package/kernel/ath10k-ct/patches/081-ath10k-calibration-variant.patch new file mode 100644 index 000000000..d51451b59 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/081-ath10k-calibration-variant.patch @@ -0,0 +1,113 @@ +From d06f26c5c8a41f246a9c40862a77a55725cedbd3 Mon Sep 17 00:00:00 2001 +From: Sven Eckelmann +Date: Fri, 8 Dec 2017 11:37:42 +0100 +Subject: ath10k: search DT for qcom,ath10k-calibration-variant + +Board Data File (BDF) is loaded upon driver boot-up procedure. The right +board data file is identified on QCA4019 using bus, bmi-chip-id and +bmi-board-id. + +The problem, however, can occur when the (default) board data file cannot +fulfill with the vendor requirements and it is necessary to use a different +board data file. + +This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8. +Something similar has to be provided for systems without SMBIOS but with +device trees. No solution was specified by QCA and therefore a new one has +to be found for ath10k. + +The device tree requires addition strings to define the variant name + + wifi@a000000 { + status = "okay"; + qcom,ath10k-calibration-variant = "RT-AC58U"; + }; + + wifi@a800000 { + status = "okay"; + qcom,ath10k-calibration-variant = "RT-AC58U"; + }; + +This would create the boarddata identifiers for the board-2.bin search + + * bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U + * bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U + +Signed-off-by: Sven Eckelmann +Signed-off-by: Kalle Valo + +Origin: upstream, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d06f26c5c8a41f246a9c40862a77a55725cedbd3 +--- + ath10k-4.13/core.c | 40 ++++++++++++++++++++++++++++------ + 1 file changed, 33 insertions(+), 7 deletions(-) + +--- a/ath10k-4.13/core.c ++++ b/ath10k-4.13/core.c +@@ -889,6 +889,28 @@ static int ath10k_core_check_smbios(stru + return 0; + } + ++static int ath10k_core_check_dt(struct ath10k *ar) ++{ ++ struct device_node *node; ++ const char *variant = NULL; ++ ++ node = ar->dev->of_node; ++ if (!node) ++ return -ENOENT; ++ ++ of_property_read_string(node, "qcom,ath10k-calibration-variant", ++ &variant); ++ if (!variant) ++ return -ENODATA; ++ ++ if (strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext)) < 0) ++ ath10k_dbg(ar, ATH10K_DBG_BOOT, ++ "bdf variant string is longer than the buffer can accommodate (variant: %s)\n", ++ variant); ++ ++ return 0; ++} ++ + static int ath10k_download_and_run_otp(struct ath10k *ar) + { + u32 result, address = ar->hw_params.patch_load_addr; +@@ -1522,19 +1544,19 @@ static int ath10k_core_create_board_name + /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ + char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; + ++ if (ar->id.bdf_ext[0] != '\0') ++ scnprintf(variant, sizeof(variant), ",variant=%s", ++ ar->id.bdf_ext); ++ + if (ar->id.bmi_ids_valid) { + scnprintf(name, name_len, +- "bus=%s,bmi-chip-id=%d,bmi-board-id=%d", ++ "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s", + ath10k_bus_str(ar->hif.bus), + ar->id.bmi_chip_id, +- ar->id.bmi_board_id); ++ ar->id.bmi_board_id, variant); + goto out; + } + +- if (ar->id.bdf_ext[0] != '\0') +- scnprintf(variant, sizeof(variant), ",variant=%s", +- ar->id.bdf_ext); +- + scnprintf(name, name_len, + "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s", + ath10k_bus_str(ar->hif.bus), +@@ -2964,7 +2986,11 @@ static int ath10k_core_probe_fw(struct a + + ret = ath10k_core_check_smbios(ar); + if (ret) +- ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n"); ++ ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n"); ++ ++ ret = ath10k_core_check_dt(ar); ++ if (ret) ++ ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n"); + + ret = ath10k_core_fetch_board_file(ar); + if (ret) { diff --git a/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch b/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch new file mode 100644 index 000000000..a82bbda3c --- /dev/null +++ b/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch @@ -0,0 +1,249 @@ +From: Thomas Hebb +Date: Fri, 13 Apr 2018 17:40:26 +0300 +Subject: [PATCH] ath10k: search all IEs for variant before falling back + +commit f2593cb1b291 ("ath10k: Search SMBIOS for OEM board file +extension") added a feature to ath10k that allows Board Data File +(BDF) conflicts between multiple devices that use the same device IDs +but have different calibration requirements to be resolved by allowing +a "variant" string to be stored in SMBIOS [and later device tree, added +by commit d06f26c5c8a4 ("ath10k: search DT for qcom,ath10k-calibration- +variant")] that gets appended to the ID stored in board-2.bin. + +This original patch had a regression, however. Namely that devices with +a variant present in SMBIOS that didn't need custom BDFs could no longer +find the default BDF, which has no variant appended. The patch was +reverted and re-applied with a fix for this issue in commit 1657b8f84ed9 +("search SMBIOS for OEM board file extension"). + +But the fix to fall back to a default BDF introduced another issue: the +driver currently parses IEs in board-2.bin one by one, and for each one +it first checks to see if it matches the ID with the variant appended. +If it doesn't, it checks to see if it matches the "fallback" ID with no +variant. If a matching BDF is found at any point during this search, the +search is terminated and that BDF is used. The issue is that it's very +possible (and is currently the case for board-2.bin files present in the +ath10k-firmware repository) for the default BDF to occur in an earlier +IE than the variant-specific BDF. In this case, the current code will +happily choose the default BDF even though a better-matching BDF is +present later in the file. + +This patch fixes the issue by first searching the entire file for the ID +with variant, and searching for the fallback ID only if that search +fails. It also includes some code cleanup in the area, as +ath10k_core_fetch_board_data_api_n() no longer does its own string +mangling to remove the variant from an ID, instead leaving that job to a +new flag passed to ath10k_core_create_board_name(). + +I've tested this patch on a QCA4019 and verified that the driver behaves +correctly for 1) both fallback and variant BDFs present, 2) only fallback +BDF present, and 3) no matching BDFs present. + +Fixes: 1657b8f84ed9 ("ath10k: search SMBIOS for OEM board file extension") +Signed-off-by: Thomas Hebb +Signed-off-by: Kalle Valo + +Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c8489668065a283d3027e86e877b103a87f99d22 +--- + ath10k-4.13/core.c | 134 ++++++++++++++++++--------------- + 1 file changed, 72 insertions(+), 62 deletions(-) + +--- a/ath10k-4.13/core.c ++++ b/ath10k-4.13/core.c +@@ -1419,14 +1419,61 @@ out: + return ret; + } + ++static int ath10k_core_search_bd(struct ath10k *ar, ++ const char *boardname, ++ const u8 *data, ++ size_t len) ++{ ++ size_t ie_len; ++ struct ath10k_fw_ie *hdr; ++ int ret = -ENOENT, ie_id; ++ ++ while (len > sizeof(struct ath10k_fw_ie)) { ++ hdr = (struct ath10k_fw_ie *)data; ++ ie_id = le32_to_cpu(hdr->id); ++ ie_len = le32_to_cpu(hdr->len); ++ ++ len -= sizeof(*hdr); ++ data = hdr->data; ++ ++ if (len < ALIGN(ie_len, 4)) { ++ ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", ++ ie_id, ie_len, len); ++ return -EINVAL; ++ } ++ ++ switch (ie_id) { ++ case ATH10K_BD_IE_BOARD: ++ ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, ++ boardname); ++ if (ret == -ENOENT) ++ /* no match found, continue */ ++ break; ++ ++ /* either found or error, so stop searching */ ++ goto out; ++ } ++ ++ /* jump over the padding */ ++ ie_len = ALIGN(ie_len, 4); ++ ++ len -= ie_len; ++ data += ie_len; ++ } ++ ++out: ++ /* return result of parse_bd_ie_board() or -ENOENT */ ++ return ret; ++} ++ + static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, + const char *boardname, ++ const char *fallback_boardname, + const char *filename) + { +- size_t len, magic_len, ie_len; +- struct ath10k_fw_ie *hdr; ++ size_t len, magic_len; + const u8 *data; +- int ret, ie_id; ++ int ret; + + ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, + ar->hw_params.fw.dir, +@@ -1464,73 +1511,28 @@ static int ath10k_core_fetch_board_data_ + data += magic_len; + len -= magic_len; + +- while (len > sizeof(struct ath10k_fw_ie)) { +- hdr = (struct ath10k_fw_ie *)data; +- ie_id = le32_to_cpu(hdr->id); +- ie_len = le32_to_cpu(hdr->len); +- +- len -= sizeof(*hdr); +- data = hdr->data; +- +- if (len < ALIGN(ie_len, 4)) { +- ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", +- ie_id, ie_len, len); +- ret = -EINVAL; +- goto err; +- } +- +- switch (ie_id) { +- case ATH10K_BD_IE_BOARD: +- ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, +- boardname); +- if (ret == -ENOENT && ar->id.bdf_ext[0] != '\0') { +- /* try default bdf if variant was not found */ +- char *s, *v = ",variant="; +- char boardname2[100]; +- +- strlcpy(boardname2, boardname, +- sizeof(boardname2)); +- +- s = strstr(boardname2, v); +- if (s) +- *s = '\0'; /* strip ",variant=%s" */ +- +- ret = ath10k_core_parse_bd_ie_board(ar, data, +- ie_len, +- boardname2); +- } +- +- if (ret == -ENOENT) +- /* no match found, continue */ +- break; +- else if (ret) +- /* there was an error, bail out */ +- goto err; +- +- /* board data found */ +- goto out; +- } ++ /* attempt to find boardname in the IE list */ ++ ret = ath10k_core_search_bd(ar, boardname, data, len); + +- /* jump over the padding */ +- ie_len = ALIGN(ie_len, 4); +- +- len -= ie_len; +- data += ie_len; +- } ++ /* if we didn't find it and have a fallback name, try that */ ++ if (ret == -ENOENT && fallback_boardname) ++ ret = ath10k_core_search_bd(ar, fallback_boardname, data, len); + + out: +- if (!ar->normal_mode_fw.board_data || !ar->normal_mode_fw.board_len) { ++ if (ret == -ENOENT) { + ath10k_err(ar, + "failed to fetch board data for %s from %s/%s\n", + boardname, ar->hw_params.fw.dir, filename); + ret = -ENODATA; +- goto err; + } + + /* Save firmware board name so we can display it later. */ + strlcpy(ar->normal_mode_fw.fw_file.fw_board_name, filename, + sizeof(ar->normal_mode_fw.fw_file.fw_board_name)); + ++ if (ret) ++ goto err; ++ + return 0; + + err: +@@ -1539,12 +1541,12 @@ err: + } + + static int ath10k_core_create_board_name(struct ath10k *ar, char *name, +- size_t name_len) ++ size_t name_len, bool with_variant) + { + /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ + char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; + +- if (ar->id.bdf_ext[0] != '\0') ++ if (with_variant && ar->id.bdf_ext[0] != '\0') + scnprintf(variant, sizeof(variant), ",variant=%s", + ar->id.bdf_ext); + +@@ -1570,21 +1572,31 @@ out: + + static int ath10k_core_fetch_board_file(struct ath10k *ar) + { +- char boardname[100]; ++ char boardname[100], fallback_boardname[100]; + int ret; + +- ret = ath10k_core_create_board_name(ar, boardname, sizeof(boardname)); ++ ret = ath10k_core_create_board_name(ar, boardname, ++ sizeof(boardname), true); + if (ret) { + ath10k_err(ar, "failed to create board name: %d", ret); + return ret; + } + ++ ret = ath10k_core_create_board_name(ar, fallback_boardname, ++ sizeof(boardname), false); ++ if (ret) { ++ ath10k_err(ar, "failed to create fallback board name: %d", ret); ++ return ret; ++ } ++ + ar->bd_api = 2; + if (ar->fwcfg.bname[0]) + ret = ath10k_core_fetch_board_data_api_n(ar, boardname, ++ fallback_boardname, + ar->fwcfg.bname); + else + ret = ath10k_core_fetch_board_data_api_n(ar, boardname, ++ fallback_boardname, + ATH10K_BOARD_API2_FILE); + if (!ret) + goto success; diff --git a/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c b/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c index c139cf8d2..8da758056 100644 --- a/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c +++ b/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c @@ -434,11 +434,6 @@ static int __init nct5104d_gpio_init(void) const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); const char *board_name = dmi_get_system_info(DMI_BOARD_NAME); - /* Make sure we only run on PC Engine APU boards */ - if (!board_name || !board_vendor || strcasecmp(board_vendor, "PC Engines") || strncasecmp(board_name, "apu", 3)) { - return -ENODEV; - } - if (nct5104d_find(0x2e, &sio) && nct5104d_find(0x4e, &sio)) return -ENODEV; diff --git a/package/kernel/kmod-sched-cake/Makefile b/package/kernel/kmod-sched-cake/Makefile index 9c5047c7a..6ec9c03bd 100644 --- a/package/kernel/kmod-sched-cake/Makefile +++ b/package/kernel/kmod-sched-cake/Makefile @@ -13,9 +13,10 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git -PKG_SOURCE_DATE:=2018-05-15 -PKG_SOURCE_VERSION:=779e91a91e803cf2b95a6a46de721d3a4fd4dfe6 -PKG_MIRROR_HASH:=2bd1e9aee6d53a2a140ad5ece6d8eeccbfb8ae8c788e84f9dd946e29abb64010 +PKG_SOURCE_DATE:=2018-07-16 +PKG_SOURCE_VERSION:=f39ab9a402ad51d7c17d4cde18ca15b2b7022030 +PKG_MIRROR_HASH:=fc22fc6eb7a24f4595c2777f33758ebcf9a2a404c16d00aa37ae389cd7f9c78f +PKG_MAINTAINER:=Kevin Darbyshire-Bryant include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/lantiq/ltq-vdsl-mei/patches/110-reset-g_tx_link_rate-on-showtime-exit.patch b/package/kernel/lantiq/ltq-vdsl-mei/patches/110-reset-g_tx_link_rate-on-showtime-exit.patch new file mode 100644 index 000000000..c4ca234be --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-mei/patches/110-reset-g_tx_link_rate-on-showtime-exit.patch @@ -0,0 +1,12 @@ +--- a/src/drv_mei_cpe_api_atm_ptm_intern.c ++++ b/src/drv_mei_cpe_api_atm_ptm_intern.c +@@ -124,6 +124,9 @@ IFX_int32_t MEI_InternalXtmSwhowtimeExit + /* Get line number*/ + dslLineNum = pMeiDynCntrl->pMeiDev->meiDrvCntrl.dslLineNum; + ++ g_tx_link_rate[dslLineNum][0] = 0; ++ g_tx_link_rate[dslLineNum][1] = 0; ++ + /* get NULL or function pointer */ + mei_showtime_exit = + (ltq_mei_atm_showtime_exit_t)ppa_callback_get(LTQ_MEI_SHOWTIME_EXIT); diff --git a/package/kernel/leds-apu2/src/leds-apu2.c b/package/kernel/leds-apu2/src/leds-apu2.c index 2fefa857c..ff13b3cde 100644 --- a/package/kernel/leds-apu2/src/leds-apu2.c +++ b/package/kernel/leds-apu2/src/leds-apu2.c @@ -331,18 +331,6 @@ static int __init gpio_apu2_init (void) const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); const char *board_name = dmi_get_system_info(DMI_BOARD_NAME); - /* Match the device name/model */ - if (!board_name \ - || !board_vendor \ - || strcasecmp(board_vendor, "PC Engines") \ - || (strcasecmp(board_name, "apu2") \ - && strcasecmp(board_name, "apu3") \ - && strcasecmp(board_name, "PC Engines apu2") \ - && strcasecmp(board_name, "PC Engines apu3"))) { - err = -ENODEV; - goto exit; - } - pr_info ("%s: load APU2/LED GPIO driver module\n", DEVNAME); err = platform_driver_register (&gpio_apu2_driver); diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile index c2d10ec18..39b9e82c2 100644 --- a/package/kernel/linux/Makefile +++ b/package/kernel/linux/Makefile @@ -14,7 +14,7 @@ PKG_FLAGS:=hold PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/packages SCAN_DEPS=modules/*.mk $(TOPDIR)/target/linux/*/modules.mk $(TOPDIR)/include/netfilter.mk -PKG_LICENSE:=GPLv2 +PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= export SHELL:=/bin/sh diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index 8dca0f96f..19524df73 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -568,5 +568,3 @@ define KernelPackage/fuse/description endef $(eval $(call KernelPackage,fuse)) - - diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index edc982d3c..0da8bcdf5 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -209,7 +209,7 @@ $(eval $(call KernelPackage,switch-ip17xx)) define KernelPackage/switch-rtl8366-smi SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Realtek RTL8366 SMI switch interface support - DEPENDS:=@GPIO_SUPPORT +kmod-swconfig + DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armvirt||TARGET_brcm2708_bcm2708):kmod-of-mdio KCONFIG:=CONFIG_RTL8366_SMI FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366_smi.ko AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi) @@ -828,7 +828,7 @@ $(eval $(call KernelPackage,ifb)) define KernelPackage/dm9000 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Davicom 9000 Ethernet support - DEPENDS:=@PCI_SUPPORT +kmod-mii + DEPENDS:=+kmod-mii KCONFIG:=CONFIG_DM9000 \ CONFIG_DM9000_DEBUGLEVEL=4 \ CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL=y diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 4aee820c9..eb26a8ba0 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -411,7 +411,8 @@ $(eval $(call KernelPackage,rfkill)) define KernelPackage/softdog SUBMENU:=$(OTHER_MENU) TITLE:=Software watchdog driver - KCONFIG:=CONFIG_SOFT_WATCHDOG + KCONFIG:=CONFIG_SOFT_WATCHDOG \ + CONFIG_SOFT_WATCHDOG_PRETIMEOUT=n FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/softdog.ko AUTOLOAD:=$(call AutoLoad,50,softdog,1) endef @@ -707,11 +708,15 @@ define KernelPackage/regmap CONFIG_REGMAP_I2C \ CONFIG_SPI=y FILES:= \ - $(LINUX_DIR)/drivers/base/regmap/regmap-core.ko \ $(LINUX_DIR)/drivers/base/regmap/regmap-i2c.ko \ $(LINUX_DIR)/drivers/base/regmap/regmap-mmio.ko \ $(if $(CONFIG_SPI),$(LINUX_DIR)/drivers/base/regmap/regmap-spi.ko) AUTOLOAD:=$(call AutoLoad,21,regmap-core regmap-i2c regmap-mmio regmap-spi) + ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") + ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"") + FILES += $(LINUX_DIR)/drivers/base/regmap/regmap-core.ko + endif + endif endef define KernelPackage/regmap/description diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index be638520a..0c5bb33f3 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -90,6 +90,25 @@ endef $(eval $(call KernelPackage,usb-phy-qcom-dwc3)) +define KernelPackage/phy-ath79-usb + TITLE:=Support for ATH79 USB PHY + KCONFIG:=CONFIG_PHY_AR7100_USB \ + CONFIG_PHY_AR7200_USB + DEPENDS:=@TARGET_ath79 + HIDDEN:=1 + FILES:=$(LINUX_DIR)/drivers/phy/phy-ar7100-usb.ko \ + $(LINUX_DIR)/drivers/phy/phy-ar7200-usb.ko + AUTOLOAD:=$(call AutoLoad,21,phy-ar7100-usb phy-ar7200-usb,1) + $(call AddDepends/usb) +endef + +define KernelPackage/phy-ath79-usb/description + Support for ATH79 USB transceiver +endef + +$(eval $(call KernelPackage,phy-ath79-usb)) + + define KernelPackage/usb-gadget TITLE:=USB Gadget support KCONFIG:=CONFIG_USB_GADGET @@ -131,7 +150,6 @@ define KernelPackage/usb-gadget-ehci-debug CONFIG_USB_G_DBGP_PRINTK=n DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite +kmod-usb-gadget-serial FILES:=$(LINUX_DIR)/drivers/usb/gadget/legacy/g_dbgp.ko - AUTOLOAD:=$(call AutoLoad,52,g_dbgp) $(call AddDepends/usb) endef @@ -154,7 +172,7 @@ define KernelPackage/usb-gadget-eth $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_ecm_subset.ko \ $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_rndis.ko \ $(LINUX_DIR)/drivers/usb/gadget/legacy/g_ether.ko - AUTOLOAD:=$(call AutoLoad,52,usb_f_ecm g_ether) + AUTOLOAD:=$(call AutoLoad,52,usb_f_ecm) $(call AddDepends/usb) endef @@ -175,7 +193,7 @@ define KernelPackage/usb-gadget-serial $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_obex.ko \ $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_serial.ko \ $(LINUX_DIR)/drivers/usb/gadget/legacy/g_serial.ko - AUTOLOAD:=$(call AutoLoad,52,usb_f_acm g_serial) + AUTOLOAD:=$(call AutoLoad,52,usb_f_acm) $(call AddDepends/usb) endef @@ -192,7 +210,7 @@ define KernelPackage/usb-gadget-mass-storage FILES:= \ $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_mass_storage.ko \ $(LINUX_DIR)/drivers/usb/gadget/legacy/g_mass_storage.ko - AUTOLOAD:=$(call AutoLoad,52,usb_f_mass_storage g_mass_storage) + AUTOLOAD:=$(call AutoLoad,52,usb_f_mass_storage) $(call AddDepends/usb) endef @@ -314,6 +332,7 @@ define KernelPackage/usb2 +TARGET_brcm47xx:kmod-usb-ssb \ +TARGET_bcm53xx:kmod-usb-bcma \ +TARGET_bcm53xx:kmod-phy-bcm-ns-usb2 \ + +TARGET_ath79:kmod-phy-ath79-usb \ +kmod-usb-ehci KCONFIG:=\ CONFIG_USB_EHCI_HCD_PLATFORM \ @@ -1493,7 +1512,7 @@ $(eval $(call KernelPackage,usbip-server)) define KernelPackage/usb-chipidea TITLE:=Host and device support for Chipidea controllers - DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget @TARGET_ar71xx +kmod-usb-ehci +kmod-usb-phy-nop + DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget @TARGET_ar71xx||TARGET_ath79 +kmod-usb-ehci +kmod-usb-phy-nop KCONFIG:= \ CONFIG_EXTCON \ CONFIG_USB_CHIPIDEA \ @@ -1514,6 +1533,31 @@ endef $(eval $(call KernelPackage,usb-chipidea)) + +define KernelPackage/usb-chipidea2 + TITLE:=Host and device support for Chipidea2 controllers + DEPENDS:=+kmod-usb-chipidea + KCONFIG:= \ + CONFIG_EXTCON \ + CONFIG_USB_CHIPIDEA \ + CONFIG_USB_CHIPIDEA_HOST=y \ + CONFIG_USB_CHIPIDEA_UDC=y \ + CONFIG_USB_CHIPIDEA_DEBUG=y + FILES:= \ + $(LINUX_DIR)/drivers/extcon/extcon.ko@lt4.9 \ + $(LINUX_DIR)/drivers/extcon/extcon-core.ko@ge4.9 \ + $(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc_usb2.ko + AUTOLOAD:=$(call AutoLoad,39,ci_hdrc_usb2,1) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-chipidea2/description + Kernel support for USB Chipidea controllers +endef + +$(eval $(call KernelPackage,usb-chipidea2)) + + define KernelPackage/usbmon TITLE:=USB traffic monitor KCONFIG:=CONFIG_USB_MON diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 01a210966..91c08fdb7 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2017-11-01 -PKG_RELEASE:=8 +PKG_RELEASE:=9 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources PKG_HASH:=8437ab7886b988c8152e7a4db30b7f41009e49a3b2cb863edd05da1ecd7eb05a @@ -57,6 +57,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_ATH_DEBUG \ CONFIG_PACKAGE_ATH_DFS \ CONFIG_PACKAGE_ATH_SPECTRAL \ + CONFIG_PACKAGE_ATH_DYNACK \ CONFIG_PACKAGE_B43_DEBUG \ CONFIG_PACKAGE_B43_PIO \ CONFIG_PACKAGE_B43_PHY_G \ @@ -197,6 +198,17 @@ define KernelPackage/ath/config help Say Y to enable access to the FFT/spectral data via debugfs. + config PACKAGE_ATH_DYNACK + bool "Enable Dynack support" + depends on PACKAGE_kmod-ath9k-common + help + Enables support for Dynamic ACK estimation, which allows the fastest possible speed + at any distance automatically by increasing/decreasing the max frame ACK time for + the most remote station detected. It can be enabled by using iw (iw phy0 set distance auto), + or by sending the NL80211_ATTR_WIPHY_DYN_ACK flag to mac80211 driver using netlink. + + Select this option if you want to enable this feature + endif endef @@ -1614,7 +1626,7 @@ config-$(call config_package,ath) += ATH_CARDS ATH_COMMON ATH_REG_DYNAMIC_USER_R 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_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL - +config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK config-$(call config_package,ath9k) += ATH9K config-$(call config_package,ath9k-common) += ATH9K_COMMON config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index dfdac5d9a..6103b5d04 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -111,9 +111,9 @@ detect_mac80211() { set wireless.radio${devidx}.type=mac80211 set wireless.radio${devidx}.channel=${channel} set wireless.radio${devidx}.hwmode=11${mode_band} - set wireless.radio${devidx}.noscan=1 ${dev_id} ${ht_capab} + set wireless.radio${devidx}.disabled=0 set wireless.default_radio${devidx}=wifi-iface set wireless.default_radio${devidx}.device=radio${devidx} diff --git a/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch b/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch new file mode 100644 index 000000000..82a7cb6f4 --- /dev/null +++ b/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch @@ -0,0 +1,43 @@ +From 52a192362932f333a7ebafd581c4d9b81da2fec8 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Mon, 28 May 2018 13:25:06 +0200 +Subject: [PATCH] Revert "rt2800: use TXOP_BACKOFF for probe frames" + +This reverts commit fb47ada8dc3c30c8e7b415da155742b49536c61e. + +In some situations when we set TXOP_BACKOFF, the probe frame is +not sent at all. What it worse then sending probe frame as part +of AMPDU and can degrade 11n performance to 11g rates. + +Cc: stable@vger.kernel.org +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +@@ -372,16 +372,15 @@ static void rt2x00queue_create_tx_descri + + /* + * Determine IFS values +- * - Use TXOP_BACKOFF for probe and management frames except beacons ++ * - Use TXOP_BACKOFF for management frames except beacons + * - Use TXOP_SIFS for fragment bursts + * - Use TXOP_HTTXOP for everything else + * + * Note: rt2800 devices won't use CTS protection (if used) + * for frames not transmitted with TXOP_HTTXOP + */ +- if ((ieee80211_is_mgmt(hdr->frame_control) && +- !ieee80211_is_beacon(hdr->frame_control)) || +- (tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)) ++ if (ieee80211_is_mgmt(hdr->frame_control) && ++ !ieee80211_is_beacon(hdr->frame_control)) + txdesc->u.ht.txop = TXOP_BACKOFF; + else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)) + txdesc->u.ht.txop = TXOP_SIFS; +-- +2.17.1 + diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch index aa44149ae..8d7a39a6d 100644 --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch @@ -173,7 +173,8 @@ #define AES_CCM_H -#include "aead_api.h" -- ++#include + -#define CCM_AAD_LEN 32 - -static inline struct crypto_aead * @@ -201,8 +202,7 @@ - be16_to_cpup((__be16 *)aad), - data, data_len, mic); -} -+#include - +- -static inline void ieee80211_aes_key_free(struct crypto_aead *tfm) -{ - return aead_key_free(tfm); @@ -338,10 +338,10 @@ #define AES_GCM_H -#include "aead_api.h" -- --#define GCM_AAD_LEN 32 +#include +-#define GCM_AAD_LEN 32 +- -static inline int ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, - u8 *j_0, u8 *aad, u8 *data, - size_t data_len, u8 *mic) diff --git a/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch b/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch index f2bee9b05..d138b2c5a 100644 --- a/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch +++ b/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch @@ -20,12 +20,9 @@ Signed-off-by: Felix Fietkau -void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad, - const u8 *data, size_t data_len, u8 *mic) +void gf_mulx(u8 *pad) - { -- SHASH_DESC_ON_STACK(desc, tfm); -- u8 out[AES_BLOCK_SIZE]; ++{ + int i, carry; - -- desc->tfm = tfm; ++ + carry = pad[0] & 0x80; + for (i = 0; i < AES_BLOCK_SIZE - 1; i++) + pad[i] = (pad[i] << 1) | (pad[i + 1] >> 7); @@ -33,20 +30,17 @@ Signed-off-by: Felix Fietkau + if (carry) + pad[AES_BLOCK_SIZE - 1] ^= 0x87; +} - -- crypto_shash_init(desc); -- crypto_shash_update(desc, aad, AAD_LEN); -- crypto_shash_update(desc, data, data_len - CMAC_TLEN); -- crypto_shash_finup(desc, zero, CMAC_TLEN, out); ++ +void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem, + const u8 *addr[], const size_t *len, u8 *mac, + size_t mac_len) -+{ + { +- SHASH_DESC_ON_STACK(desc, tfm); +- u8 out[AES_BLOCK_SIZE]; + u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE]; + const u8 *pos, *end; + size_t i, e, left, total_len; - -- memcpy(mic, out, CMAC_TLEN); ++ + memset(cbc, 0, AES_BLOCK_SIZE); + + total_len = 0; @@ -93,10 +87,14 @@ Signed-off-by: Felix Fietkau + pad[i] ^= cbc[i]; + crypto_cipher_encrypt_one(tfm, pad, pad); + memcpy(mac, pad, mac_len); - } ++} --void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad, -+ +- desc->tfm = tfm; + +- crypto_shash_init(desc); +- crypto_shash_update(desc, aad, AAD_LEN); +- crypto_shash_update(desc, data, data_len - CMAC_TLEN); +- crypto_shash_finup(desc, zero, CMAC_TLEN, out); +void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad, + const u8 *data, size_t data_len, u8 *mic) +{ @@ -111,10 +109,12 @@ Signed-off-by: Felix Fietkau + len[1] = data_len - CMAC_TLEN; + addr[2] = zero; + len[2] = CMAC_TLEN; -+ + +- memcpy(mic, out, CMAC_TLEN); + aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN); -+} -+ + } + +-void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad, +void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad, const u8 *data, size_t data_len, u8 *mic) { @@ -122,8 +122,7 @@ Signed-off-by: Felix Fietkau + const u8 *addr[3]; + size_t len[3]; + u8 zero[CMAC_TLEN_256]; - -- desc->tfm = tfm; ++ + memset(zero, 0, CMAC_TLEN_256); + addr[0] = aad; + len[0] = AAD_LEN; @@ -132,6 +131,8 @@ Signed-off-by: Felix Fietkau + addr[2] = zero; + len[2] = CMAC_TLEN_256; +- desc->tfm = tfm; +- - crypto_shash_init(desc); - crypto_shash_update(desc, aad, AAD_LEN); - crypto_shash_update(desc, data, data_len - CMAC_TLEN_256); diff --git a/package/kernel/mac80211/patches/303-v4.15-0003-brcmfmac-cleanup-brcmf_cfg80211_escan-function.patch b/package/kernel/mac80211/patches/303-v4.15-0003-brcmfmac-cleanup-brcmf_cfg80211_escan-function.patch index ffd2db762..b6f3d0c69 100644 --- a/package/kernel/mac80211/patches/303-v4.15-0003-brcmfmac-cleanup-brcmf_cfg80211_escan-function.patch +++ b/package/kernel/mac80211/patches/303-v4.15-0003-brcmfmac-cleanup-brcmf_cfg80211_escan-function.patch @@ -88,7 +88,7 @@ Signed-off-by: Kalle Valo - spec_scan = true; - } else - brcmf_dbg(SCAN, "Broadcast scan\n"); - +- - passive_scan = cfg->active_scan ? 0 : 1; - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN, - passive_scan); @@ -105,15 +105,17 @@ Signed-off-by: Kalle Valo - ssid_le.SSID); - else - brcmf_err("WLC_SCAN error (%d)\n", err); -+ cfg->escan_info.run = brcmf_run_escan; -+ err = brcmf_p2p_scan_prep(wiphy, request, vif); -+ if (err) -+ goto scan_out; - +- - brcmf_scan_config_mpc(ifp, 1); - goto scan_out; - } - } ++ ++ cfg->escan_info.run = brcmf_run_escan; ++ err = brcmf_p2p_scan_prep(wiphy, request, vif); ++ if (err) ++ goto scan_out; ++ + err = brcmf_do_escan(vif->ifp, request); + if (err) + goto scan_out; diff --git a/package/kernel/mac80211/patches/311-v4.16-0007-brcmfmac-Remove-brcmf_sdiod_request_data.patch b/package/kernel/mac80211/patches/311-v4.16-0007-brcmfmac-Remove-brcmf_sdiod_request_data.patch index beaa4d3a2..552f9fb44 100644 --- a/package/kernel/mac80211/patches/311-v4.16-0007-brcmfmac-Remove-brcmf_sdiod_request_data.patch +++ b/package/kernel/mac80211/patches/311-v4.16-0007-brcmfmac-Remove-brcmf_sdiod_request_data.patch @@ -141,12 +141,12 @@ Signed-off-by: Kalle Valo - func = SDIO_FUNC_0; - else - func = SDIO_FUNC_1; - +- - do { - /* for retry wait for 1 ms till bus get settled down */ - if (retry) - usleep_range(1000, 2000); -- + - ret = brcmf_sdiod_request_data(sdiodev, func, addr, regsz, - data, true); - diff --git a/package/kernel/mac80211/patches/312-v4.16-0004-brcmfmac-Rename-replace-old-IO-functions-with-simple.patch b/package/kernel/mac80211/patches/312-v4.16-0004-brcmfmac-Rename-replace-old-IO-functions-with-simple.patch index 7aa3de929..7c27e1777 100644 --- a/package/kernel/mac80211/patches/312-v4.16-0004-brcmfmac-Rename-replace-old-IO-functions-with-simple.patch +++ b/package/kernel/mac80211/patches/312-v4.16-0004-brcmfmac-Rename-replace-old-IO-functions-with-simple.patch @@ -198,14 +198,14 @@ Signed-off-by: Kalle Valo int retval; - retval = brcmf_sdiod_reg_read(sdiodev, addr, 1, &data); -+ retval = brcmf_sdiod_addrprep(sdiodev, &addr); - +- - if (ret) - *ret = retval; - - return data; -} -- ++ retval = brcmf_sdiod_addrprep(sdiodev, &addr); + -u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) -{ - u32 data; diff --git a/package/kernel/mac80211/patches/312-v4.16-0006-brcmfmac-Remove-brcmf_sdiod_addrprep.patch b/package/kernel/mac80211/patches/312-v4.16-0006-brcmfmac-Remove-brcmf_sdiod_addrprep.patch index 44303fa41..dc598aa47 100644 --- a/package/kernel/mac80211/patches/312-v4.16-0006-brcmfmac-Remove-brcmf_sdiod_addrprep.patch +++ b/package/kernel/mac80211/patches/312-v4.16-0006-brcmfmac-Remove-brcmf_sdiod_addrprep.patch @@ -62,10 +62,10 @@ Signed-off-by: Kalle Valo + if (!err) sdiodev->sbwad = bar0; - } -- + - *addr &= SBSDIO_SB_OFT_ADDR_MASK; - *addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - +- - return 0; + return err; } @@ -99,14 +99,14 @@ Signed-off-by: Kalle Valo + retval = brcmf_sdiod_set_backplane_window(sdiodev, addr); + if (retval) + goto out; -+ -+ addr &= SBSDIO_SB_OFT_ADDR_MASK; -+ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - if (!retval) - sdio_writel(sdiodev->func[1], data, addr, &retval); -+ sdio_writel(sdiodev->func[1], data, addr, &retval); ++ addr &= SBSDIO_SB_OFT_ADDR_MASK; ++ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; ++ sdio_writel(sdiodev->func[1], data, addr, &retval); ++ +out: if (ret) *ret = retval; diff --git a/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch b/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch new file mode 100644 index 000000000..f4d9a84b2 --- /dev/null +++ b/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch @@ -0,0 +1,45 @@ +From da472385a29f1fddcac7cfa0499482704310bd16 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 20 Feb 2018 00:14:18 +0100 +Subject: [PATCH] brcmfmac: move brcmf_bus_preinit() call just after changing + bus state + +Moving the brcmf_bus_preinit() call allows the bus code to do some +required initialization before handling firmware control messages. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 3 --- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ + 2 files changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -369,9 +369,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + + /* Enable tx beamforming, errors can be ignored (not supported) */ + (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1); +- +- /* do bus specific preinit here */ +- err = brcmf_bus_preinit(ifp->drvr->bus_if); + done: + return err; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1091,6 +1091,11 @@ int brcmf_bus_started(struct device *dev + /* signal bus ready */ + brcmf_bus_change_state(bus_if, BRCMF_BUS_UP); + ++ /* do bus specific preinit here */ ++ ret = brcmf_bus_preinit(ifp->drvr->bus_if); ++ if (ret < 0) ++ goto fail; ++ + /* Bus is ready, do any initialization */ + ret = brcmf_c_preinit_dcmds(ifp); + if (ret < 0) diff --git a/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch b/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch new file mode 100644 index 000000000..230e891ce --- /dev/null +++ b/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch @@ -0,0 +1,69 @@ +From 4b5adc736828dc25ca33e263ad8c0b9dcd3bf325 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 20 Feb 2018 00:14:19 +0100 +Subject: [PATCH] brcmfmac: move allocation of control rx buffer to + brcmf_sdio_bus_preinit() + +Allocate the control rx buffer needed for firmware control interface +during brcmf_sdio_bus_preinit(). This relies on common layer setting +struct brcmf_bus::maxctl during brcmf_attach(). By moving the allocation +we can move brcmf_attach() in subsequent change. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 26 ++++++++++------------ + 1 file changed, 12 insertions(+), 14 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -1707,7 +1707,6 @@ brcmf_sdio_read_control(struct brcmf_sdi + int sdret; + + brcmf_dbg(TRACE, "Enter\n"); +- + if (bus->rxblen) + buf = vzalloc(bus->rxblen); + if (!buf) +@@ -3411,6 +3410,18 @@ static int brcmf_sdio_bus_preinit(struct + u32 value; + int err; + ++ /* maxctl provided by common layer */ ++ if (WARN_ON(!bus_if->maxctl)) ++ return -EINVAL; ++ ++ /* Allocate control receive buffer */ ++ bus_if->maxctl += bus->roundup; ++ value = roundup((bus_if->maxctl + SDPCM_HDRLEN), ALIGNMENT); ++ value += bus->head_align; ++ bus->rxbuf = kmalloc(value, GFP_ATOMIC); ++ if (bus->rxbuf) ++ bus->rxblen = value; ++ + /* the commands below use the terms tx and rx from + * a device perspective, ie. bus:txglom affects the + * bus transfers from device to host. +@@ -4209,19 +4220,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + bus->blocksize = bus->sdiodev->func2->cur_blksize; + bus->roundup = min(max_roundup, bus->blocksize); + +- /* Allocate buffers */ +- if (bus->sdiodev->bus_if->maxctl) { +- bus->sdiodev->bus_if->maxctl += bus->roundup; +- bus->rxblen = +- roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN), +- ALIGNMENT) + bus->head_align; +- bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC); +- if (!(bus->rxbuf)) { +- brcmf_err("rxbuf allocation failed\n"); +- goto fail; +- } +- } +- + sdio_claim_host(bus->sdiodev->func1); + + /* Disable F2 to clear any intermediate frame state on the dongle */ diff --git a/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch b/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch new file mode 100644 index 000000000..a8b0171cb --- /dev/null +++ b/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch @@ -0,0 +1,106 @@ +From 262f2b53f67936b59cc8dfc6f3899ab8905bf1ed Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 20 Feb 2018 00:14:20 +0100 +Subject: [PATCH] brcmfmac: call brcmf_attach() just before calling + brcmf_bus_started() + +Now we can move brcmf_attach() until after the firmware has been downloaded +to the device. Make the call just before brcmf_bus_started(). + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 6 ++++ + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 34 +++++++++++----------- + 2 files changed, 23 insertions(+), 17 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1268,6 +1268,12 @@ void brcmf_bus_change_state(struct brcmf + int ifidx; + + brcmf_dbg(TRACE, "%d -> %d\n", bus->state, state); ++ ++ if (!drvr) { ++ brcmf_dbg(INFO, "ignoring transition, bus not attached yet\n"); ++ return; ++ } ++ + bus->state = state; + + if (state == BRCMF_BUS_UP) { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4048,9 +4048,6 @@ static void brcmf_sdio_firmware_callback + if (err) + goto fail; + +- if (!bus_if->drvr) +- return; +- + /* try to download image and nvram to the dongle */ + bus->alp_only = true; + err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len); +@@ -4126,11 +4123,28 @@ static void brcmf_sdio_firmware_callback + + sdio_release_host(sdiodev->func1); + ++ /* Assign bus interface call back */ ++ sdiodev->bus_if->dev = sdiodev->dev; ++ sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; ++ sdiodev->bus_if->chip = bus->ci->chip; ++ sdiodev->bus_if->chiprev = bus->ci->chiprev; ++ ++ /* Attach to the common layer, reserve hdr space */ ++ err = brcmf_attach(sdiodev->dev, sdiodev->settings); ++ if (err != 0) { ++ brcmf_err("brcmf_attach failed\n"); ++ goto fail; ++ } ++ ++ brcmf_sdio_debugfs_create(bus); ++ + err = brcmf_bus_started(dev); + if (err != 0) { + brcmf_err("dongle is not responding\n"); + goto fail; + } ++ ++ /* ready */ + return; + + release: +@@ -4200,22 +4214,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + bus->dpc_triggered = false; + bus->dpc_running = false; + +- /* Assign bus interface call back */ +- bus->sdiodev->bus_if->dev = bus->sdiodev->dev; +- bus->sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; +- bus->sdiodev->bus_if->chip = bus->ci->chip; +- bus->sdiodev->bus_if->chiprev = bus->ci->chiprev; +- + /* default sdio bus header length for tx packet */ + bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN; + +- /* Attach to the common layer, reserve hdr space */ +- ret = brcmf_attach(bus->sdiodev->dev, bus->sdiodev->settings); +- if (ret != 0) { +- brcmf_err("brcmf_attach failed\n"); +- goto fail; +- } +- + /* Query the F2 block size, set roundup accordingly */ + bus->blocksize = bus->sdiodev->func2->cur_blksize; + bus->roundup = min(max_roundup, bus->blocksize); +@@ -4240,7 +4241,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + /* SR state */ + bus->sr_enabled = false; + +- brcmf_sdio_debugfs_create(bus); + brcmf_dbg(INFO, "completed!!\n"); + + ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev, diff --git a/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch b/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch new file mode 100644 index 000000000..00c4141cc --- /dev/null +++ b/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch @@ -0,0 +1,41 @@ +From a7f4a80c0070b673d4a4ce94b99979ea6d0c6296 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 20 Feb 2018 00:14:21 +0100 +Subject: [PATCH] brcmfmac: usb: call brcmf_usb_up() during brcmf_bus_preinit() + +By calling brcmf_usb_up() during brcmf_bus_preinit() it does not need +to be called in brcmf_usb_bus_setup(). + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1146,8 +1146,9 @@ static int brcmf_usb_get_fwname(struct d + } + + static const struct brcmf_bus_ops brcmf_usb_bus_ops = { +- .txdata = brcmf_usb_tx, ++ .preinit = brcmf_usb_up, + .stop = brcmf_usb_down, ++ .txdata = brcmf_usb_tx, + .txctl = brcmf_usb_tx_ctlpkt, + .rxctl = brcmf_usb_rx_ctlpkt, + .wowl_config = brcmf_usb_wowl_config, +@@ -1165,10 +1166,6 @@ static int brcmf_usb_bus_setup(struct br + return ret; + } + +- ret = brcmf_usb_up(devinfo->dev); +- if (ret) +- goto fail; +- + ret = brcmf_bus_started(devinfo->dev); + if (ret) + goto fail; diff --git a/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch b/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch new file mode 100644 index 000000000..086b5fadc --- /dev/null +++ b/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch @@ -0,0 +1,130 @@ +From 0542503c4c164c65cd1567b0f2b3f887af6c81eb Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 20 Feb 2018 00:14:22 +0100 +Subject: [PATCH] brcmfmac: move brcmf_attach() function in core.c + +Moving the function in preparation of subsequent patch. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 98 +++++++++++----------- + 1 file changed, 49 insertions(+), 49 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -992,55 +992,6 @@ static int brcmf_inet6addr_changed(struc + } + #endif + +-int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) +-{ +- struct brcmf_pub *drvr = NULL; +- int ret = 0; +- int i; +- +- brcmf_dbg(TRACE, "Enter\n"); +- +- /* Allocate primary brcmf_info */ +- drvr = kzalloc(sizeof(struct brcmf_pub), GFP_ATOMIC); +- if (!drvr) +- return -ENOMEM; +- +- for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) +- drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; +- +- mutex_init(&drvr->proto_block); +- +- /* Link to bus module */ +- drvr->hdrlen = 0; +- drvr->bus_if = dev_get_drvdata(dev); +- drvr->bus_if->drvr = drvr; +- drvr->settings = settings; +- +- /* attach debug facilities */ +- brcmf_debug_attach(drvr); +- +- /* Attach and link in the protocol */ +- ret = brcmf_proto_attach(drvr); +- if (ret != 0) { +- brcmf_err("brcmf_prot_attach failed\n"); +- goto fail; +- } +- +- /* Attach to events important for core code */ +- brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG, +- brcmf_psm_watchdog_notify); +- +- /* attach firmware event handler */ +- brcmf_fweh_attach(drvr); +- +- return ret; +- +-fail: +- brcmf_detach(dev); +- +- return ret; +-} +- + static int brcmf_revinfo_read(struct seq_file *s, void *data) + { + struct brcmf_bus *bus_if = dev_get_drvdata(s->private); +@@ -1170,6 +1121,55 @@ fail: + + return ret; + } ++ ++int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) ++{ ++ struct brcmf_pub *drvr = NULL; ++ int ret = 0; ++ int i; ++ ++ brcmf_dbg(TRACE, "Enter\n"); ++ ++ /* Allocate primary brcmf_info */ ++ drvr = kzalloc(sizeof(*drvr), GFP_ATOMIC); ++ if (!drvr) ++ return -ENOMEM; ++ ++ for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) ++ drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; ++ ++ mutex_init(&drvr->proto_block); ++ ++ /* Link to bus module */ ++ drvr->hdrlen = 0; ++ drvr->bus_if = dev_get_drvdata(dev); ++ drvr->bus_if->drvr = drvr; ++ drvr->settings = settings; ++ ++ /* attach debug facilities */ ++ brcmf_debug_attach(drvr); ++ ++ /* Attach and link in the protocol */ ++ ret = brcmf_proto_attach(drvr); ++ if (ret != 0) { ++ brcmf_err("brcmf_prot_attach failed\n"); ++ goto fail; ++ } ++ ++ /* Attach to events important for core code */ ++ brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG, ++ brcmf_psm_watchdog_notify); ++ ++ /* attach firmware event handler */ ++ brcmf_fweh_attach(drvr); ++ ++ return ret; ++ ++fail: ++ brcmf_detach(dev); ++ ++ return ret; ++} + + void brcmf_bus_add_txhdrlen(struct device *dev, uint len) + { diff --git a/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch b/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch new file mode 100644 index 000000000..6d23ccdac --- /dev/null +++ b/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch @@ -0,0 +1,190 @@ +From de2a3027f6f15e2f6558dc4d178282ccc1f054db Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 20 Feb 2018 00:14:23 +0100 +Subject: [PATCH] brcmfmac: remove brcmf_bus_started() from bus api + +No longer needed to call this in bus layer so make it static and call +it in the last phase of brcmf_attach() instead. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 1 - + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 14 +++++++---- + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 20 +--------------- + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 10 ++------ + .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 28 ++++------------------ + 5 files changed, 16 insertions(+), 57 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -253,7 +253,6 @@ void brcmf_dev_reset(struct device *dev) + /* Configure the "global" bus state used by upper layers */ + void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state); + +-int brcmf_bus_started(struct device *dev); + s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len); + void brcmf_bus_add_txhdrlen(struct device *dev, uint len); + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1022,11 +1022,10 @@ static int brcmf_revinfo_read(struct seq + return 0; + } + +-int brcmf_bus_started(struct device *dev) ++static int brcmf_bus_started(struct brcmf_pub *drvr) + { + int ret = -1; +- struct brcmf_bus *bus_if = dev_get_drvdata(dev); +- struct brcmf_pub *drvr = bus_if->drvr; ++ struct brcmf_bus *bus_if = drvr->bus_if; + struct brcmf_if *ifp; + struct brcmf_if *p2p_ifp; + +@@ -1043,7 +1042,7 @@ int brcmf_bus_started(struct device *dev + brcmf_bus_change_state(bus_if, BRCMF_BUS_UP); + + /* do bus specific preinit here */ +- ret = brcmf_bus_preinit(ifp->drvr->bus_if); ++ ret = brcmf_bus_preinit(bus_if); + if (ret < 0) + goto fail; + +@@ -1163,7 +1162,12 @@ int brcmf_attach(struct device *dev, str + /* attach firmware event handler */ + brcmf_fweh_attach(drvr); + +- return ret; ++ ret = brcmf_bus_started(drvr); ++ if (ret != 0) { ++ brcmf_err("dongle is not responding: err=%d\n", ret); ++ goto fail; ++ } ++ return 0; + + fail: + brcmf_detach(dev); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1581,24 +1581,6 @@ static void brcmf_pcie_release_resource( + } + + +-static int brcmf_pcie_attach_bus(struct brcmf_pciedev_info *devinfo) +-{ +- int ret; +- +- /* Attach to the common driver interface */ +- ret = brcmf_attach(&devinfo->pdev->dev, devinfo->settings); +- if (ret) { +- brcmf_err("brcmf_attach failed\n"); +- } else { +- ret = brcmf_bus_started(&devinfo->pdev->dev); +- if (ret) +- brcmf_err("dongle is not responding\n"); +- } +- +- return ret; +-} +- +- + static u32 brcmf_pcie_buscore_prep_addr(const struct pci_dev *pdev, u32 addr) + { + u32 ret_addr; +@@ -1735,7 +1717,7 @@ static void brcmf_pcie_setup(struct devi + init_waitqueue_head(&devinfo->mbdata_resp_wait); + + brcmf_pcie_intr_enable(devinfo); +- if (brcmf_pcie_attach_bus(devinfo) == 0) ++ if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0) + return; + + brcmf_pcie_bus_console_read(devinfo); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -3422,6 +3422,8 @@ static int brcmf_sdio_bus_preinit(struct + if (bus->rxbuf) + bus->rxblen = value; + ++ brcmf_sdio_debugfs_create(bus); ++ + /* the commands below use the terms tx and rx from + * a device perspective, ie. bus:txglom affects the + * bus transfers from device to host. +@@ -4136,14 +4138,6 @@ static void brcmf_sdio_firmware_callback + goto fail; + } + +- brcmf_sdio_debugfs_create(bus); +- +- err = brcmf_bus_started(dev); +- if (err != 0) { +- brcmf_err("dongle is not responding\n"); +- goto fail; +- } +- + /* ready */ + return; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1155,27 +1155,6 @@ static const struct brcmf_bus_ops brcmf_ + .get_fwname = brcmf_usb_get_fwname, + }; + +-static int brcmf_usb_bus_setup(struct brcmf_usbdev_info *devinfo) +-{ +- int ret; +- +- /* Attach to the common driver interface */ +- ret = brcmf_attach(devinfo->dev, devinfo->settings); +- if (ret) { +- brcmf_err("brcmf_attach failed\n"); +- return ret; +- } +- +- ret = brcmf_bus_started(devinfo->dev); +- if (ret) +- goto fail; +- +- return 0; +-fail: +- brcmf_detach(devinfo->dev); +- return ret; +-} +- + static void brcmf_usb_probe_phase2(struct device *dev, int ret, + const struct firmware *fw, + void *nvram, u32 nvlen) +@@ -1203,7 +1182,8 @@ static void brcmf_usb_probe_phase2(struc + if (ret) + goto error; + +- ret = brcmf_usb_bus_setup(devinfo); ++ /* Attach to the common driver interface */ ++ ret = brcmf_attach(devinfo->dev, devinfo->settings); + if (ret) + goto error; + +@@ -1253,7 +1233,7 @@ static int brcmf_usb_probe_cb(struct brc + } + + if (!brcmf_usb_dlneeded(devinfo)) { +- ret = brcmf_usb_bus_setup(devinfo); ++ ret = brcmf_attach(devinfo->dev, devinfo->settings); + if (ret) + goto fail; + /* we are done */ +@@ -1456,7 +1436,7 @@ static int brcmf_usb_resume(struct usb_i + + brcmf_dbg(USB, "Enter\n"); + if (!devinfo->wowl_enabled) +- return brcmf_usb_bus_setup(devinfo); ++ return brcmf_attach(devinfo->dev, devinfo->settings); + + devinfo->bus_pub.state = BRCMFMAC_USB_STATE_UP; + brcmf_usb_rx_fill_all(devinfo); diff --git a/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch b/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch new file mode 100644 index 000000000..344826912 --- /dev/null +++ b/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch @@ -0,0 +1,64 @@ +From d678296bfb9a630d0000222fc21f4ed0d0d65332 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 20 Feb 2018 00:14:24 +0100 +Subject: [PATCH] brcmfmac: change log level for some low-level sdio functions + +Reducing the number of trace level messages in sdio code giving +them sdio log level instead. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -1706,7 +1706,7 @@ brcmf_sdio_read_control(struct brcmf_sdi + u8 *buf = NULL, *rbuf; + int sdret; + +- brcmf_dbg(TRACE, "Enter\n"); ++ brcmf_dbg(SDIO, "Enter\n"); + if (bus->rxblen) + buf = vzalloc(bus->rxblen); + if (!buf) +@@ -1809,7 +1809,7 @@ static uint brcmf_sdio_readframes(struct + struct brcmf_sdio_hdrinfo *rd = &bus->cur_read, rd_new; + u8 head_read = 0; + +- brcmf_dbg(TRACE, "Enter\n"); ++ brcmf_dbg(SDIO, "Enter\n"); + + /* Not finished unless we encounter no more frames indication */ + bus->rxpending = true; +@@ -2344,7 +2344,7 @@ static int brcmf_sdio_tx_ctrlframe(struc + struct brcmf_sdio_hdrinfo hd_info = {0}; + int ret; + +- brcmf_dbg(TRACE, "Enter\n"); ++ brcmf_dbg(SDIO, "Enter\n"); + + /* Back the pointer to make room for bus header */ + frame -= bus->tx_hdrlen; +@@ -2520,7 +2520,7 @@ static void brcmf_sdio_dpc(struct brcmf_ + uint framecnt; /* Temporary counter of tx/rx frames */ + int err = 0; + +- brcmf_dbg(TRACE, "Enter\n"); ++ brcmf_dbg(SDIO, "Enter\n"); + + sdio_claim_host(bus->sdiodev->func1); + +@@ -2605,7 +2605,7 @@ static void brcmf_sdio_dpc(struct brcmf_ + + /* Would be active due to wake-wlan in gSPI */ + if (intstatus & I_CHIPACTIVE) { +- brcmf_dbg(INFO, "Dongle reports CHIPACTIVE\n"); ++ brcmf_dbg(SDIO, "Dongle reports CHIPACTIVE\n"); + intstatus &= ~I_CHIPACTIVE; + } + diff --git a/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch b/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch new file mode 100644 index 000000000..39fba211f --- /dev/null +++ b/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch @@ -0,0 +1,126 @@ +From 2d6edad4b2da1991f74e7b02053eeb4a043b887f Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 20 Feb 2018 00:14:25 +0100 +Subject: [PATCH] brcmfmac: remove duplicate pointer variable from + brcmf_sdio_firmware_callback() + +In brcmf_sdio_firmware_callback() two pointer variables were used +pointing to the same construct. Get rid of sdiodev variable. + +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 37 +++++++++++----------- + 1 file changed, 18 insertions(+), 19 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4039,9 +4039,8 @@ static void brcmf_sdio_firmware_callback + void *nvram, u32 nvram_len) + { + struct brcmf_bus *bus_if = dev_get_drvdata(dev); +- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; +- struct brcmf_sdio *bus = sdiodev->bus; +- struct brcmf_sdio_dev *sdiod = bus->sdiodev; ++ struct brcmf_sdio_dev *sdiod = bus_if->bus_priv.sdio; ++ struct brcmf_sdio *bus = sdiod->bus; + struct brcmf_core *core = bus->sdio_core; + u8 saveclk; + +@@ -4061,7 +4060,7 @@ static void brcmf_sdio_firmware_callback + bus->sdcnt.tickcnt = 0; + brcmf_sdio_wd_timer(bus, true); + +- sdio_claim_host(sdiodev->func1); ++ sdio_claim_host(sdiod->func1); + + /* Make sure backplane clock is on, needed to generate F2 interrupt */ + brcmf_sdio_clkctl(bus, CLK_AVAIL, false); +@@ -4069,9 +4068,9 @@ static void brcmf_sdio_firmware_callback + goto release; + + /* Force clocks on backplane to be sure F2 interrupt propagates */ +- saveclk = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err); ++ saveclk = brcmf_sdiod_readb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, &err); + if (!err) { +- brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, ++ brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, + (saveclk | SBSDIO_FORCE_HT), &err); + } + if (err) { +@@ -4083,7 +4082,7 @@ static void brcmf_sdio_firmware_callback + brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailboxdata), + SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, NULL); + +- err = sdio_enable_func(sdiodev->func2); ++ err = sdio_enable_func(sdiod->func2); + + brcmf_dbg(INFO, "enable F2: err=%d\n", err); + +@@ -4095,10 +4094,10 @@ static void brcmf_sdio_firmware_callback + bus->hostintmask, NULL); + + +- brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err); ++ brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 8, &err); + } else { + /* Disable F2 again */ +- sdio_disable_func(sdiodev->func2); ++ sdio_disable_func(sdiod->func2); + goto release; + } + +@@ -4106,7 +4105,7 @@ static void brcmf_sdio_firmware_callback + brcmf_sdio_sr_init(bus); + } else { + /* Restore previous clock setting */ +- brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, ++ brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, + saveclk, &err); + } + +@@ -4114,7 +4113,7 @@ static void brcmf_sdio_firmware_callback + /* Allow full data communication using DPC from now on. */ + brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); + +- err = brcmf_sdiod_intr_register(sdiodev); ++ err = brcmf_sdiod_intr_register(sdiod); + if (err != 0) + brcmf_err("intr register failed:%d\n", err); + } +@@ -4123,16 +4122,16 @@ static void brcmf_sdio_firmware_callback + if (err != 0) + brcmf_sdio_clkctl(bus, CLK_NONE, false); + +- sdio_release_host(sdiodev->func1); ++ sdio_release_host(sdiod->func1); + + /* Assign bus interface call back */ +- sdiodev->bus_if->dev = sdiodev->dev; +- sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; +- sdiodev->bus_if->chip = bus->ci->chip; +- sdiodev->bus_if->chiprev = bus->ci->chiprev; ++ sdiod->bus_if->dev = sdiod->dev; ++ sdiod->bus_if->ops = &brcmf_sdio_bus_ops; ++ sdiod->bus_if->chip = bus->ci->chip; ++ sdiod->bus_if->chiprev = bus->ci->chiprev; + + /* Attach to the common layer, reserve hdr space */ +- err = brcmf_attach(sdiodev->dev, sdiodev->settings); ++ err = brcmf_attach(sdiod->dev, sdiod->settings); + if (err != 0) { + brcmf_err("brcmf_attach failed\n"); + goto fail; +@@ -4142,10 +4141,10 @@ static void brcmf_sdio_firmware_callback + return; + + release: +- sdio_release_host(sdiodev->func1); ++ sdio_release_host(sdiod->func1); + fail: + brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); +- device_release_driver(&sdiodev->func2->dev); ++ device_release_driver(&sdiod->func2->dev); + device_release_driver(dev); + } + diff --git a/package/kernel/mac80211/patches/326-v4.17-0001-brcmfmac-reject-too-long-PSK.patch b/package/kernel/mac80211/patches/326-v4.17-0001-brcmfmac-reject-too-long-PSK.patch new file mode 100644 index 000000000..b83f2fce8 --- /dev/null +++ b/package/kernel/mac80211/patches/326-v4.17-0001-brcmfmac-reject-too-long-PSK.patch @@ -0,0 +1,27 @@ +From 64d1519edc959f5b8f86a66a51c40971c215e4ec Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Mon, 19 Feb 2018 13:30:45 +0100 +Subject: [PATCH] brcmfmac: reject too long PSK + +nl80211 already allows specifying 48 bytes, but brcmfmac +only supports 32. Reject keys that are too long. + +Signed-off-by: Johannes Berg +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -5125,6 +5125,9 @@ static int brcmf_cfg80211_set_pmk(struct + if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X)) + return -EINVAL; + ++ if (conf->pmk_len > BRCMF_WSEC_MAX_PSK_LEN) ++ return -ERANGE; ++ + return brcmf_set_pmk(ifp, conf->pmk, conf->pmk_len); + } + diff --git a/package/kernel/mac80211/patches/327-v4.17-0001-brcmfmac-do-not-convert-linux-error-to-firmware-erro.patch b/package/kernel/mac80211/patches/327-v4.17-0001-brcmfmac-do-not-convert-linux-error-to-firmware-erro.patch new file mode 100644 index 000000000..2e9ec8b96 --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0001-brcmfmac-do-not-convert-linux-error-to-firmware-erro.patch @@ -0,0 +1,31 @@ +From 1170f6d1be6a39e1a115a2c0f50923eb4ce2a7ec Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:20 +0100 +Subject: [PATCH] brcmfmac: do not convert linux error to firmware error string + +In case of a linux error brcmf_fil_cmd_data() blurts an error message +in which the error code is translated to an error string. However, it +maps it to a firmware error string which should not happen. Simply +print only the numeric error code and be done with it. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c +@@ -124,8 +124,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, + data, len, &fwerr); + + if (err) { +- brcmf_dbg(FIL, "Failed: %s (%d)\n", +- brcmf_fil_get_errstr((u32)(-err)), err); ++ brcmf_dbg(FIL, "Failed: error=%d\n", err); + } else if (fwerr < 0) { + brcmf_dbg(FIL, "Firmware error: %s (%d)\n", + brcmf_fil_get_errstr((u32)(-fwerr)), fwerr); diff --git a/package/kernel/mac80211/patches/327-v4.17-0002-brcmfmac-use-brcmf_chip_name-to-store-name-in-revinf.patch b/package/kernel/mac80211/patches/327-v4.17-0002-brcmfmac-use-brcmf_chip_name-to-store-name-in-revinf.patch new file mode 100644 index 000000000..790811957 --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0002-brcmfmac-use-brcmf_chip_name-to-store-name-in-revinf.patch @@ -0,0 +1,203 @@ +From 756a2b390874d274f2f615921318ef0856ff9313 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:21 +0100 +Subject: [PATCH] brcmfmac: use brcmf_chip_name() to store name in revinfo + +The chip id can either be four or five digits. For the chip name either +the hexadecimal value needs to be taken (four digits) or the decimal +value (five digits). The function brcmf_chip_name() does this conversion +so use it to store the name in driver revision info. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 9 +++++---- + .../wireless/broadcom/brcm80211/brcmfmac/chip.h | 3 ++- + .../wireless/broadcom/brcm80211/brcmfmac/common.c | 23 ++++++++++++++++------ + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 10 +--------- + .../wireless/broadcom/brcm80211/brcmfmac/core.h | 3 +-- + 5 files changed, 26 insertions(+), 22 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -464,12 +464,12 @@ static void brcmf_chip_ai_resetcore(stru + ci->ops->read32(ci->ctx, core->wrapbase + BCMA_IOCTL); + } + +-static char *brcmf_chip_name(uint chipid, char *buf, uint len) ++char *brcmf_chip_name(u32 id, u32 rev, char *buf, uint len) + { + const char *fmt; + +- fmt = ((chipid > 0xa000) || (chipid < 0x4000)) ? "%d" : "%x"; +- snprintf(buf, len, fmt, chipid); ++ fmt = ((id > 0xa000) || (id < 0x4000)) ? "BCM%d/%u" : "BCM%x/%u"; ++ snprintf(buf, len, fmt, id, rev); + return buf; + } + +@@ -924,7 +924,8 @@ static int brcmf_chip_recognition(struct + ci->pub.chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT; + socitype = (regdata & CID_TYPE_MASK) >> CID_TYPE_SHIFT; + +- brcmf_chip_name(ci->pub.chip, ci->pub.name, sizeof(ci->pub.name)); ++ brcmf_chip_name(ci->pub.chip, ci->pub.chiprev, ++ ci->pub.name, sizeof(ci->pub.name)); + brcmf_dbg(INFO, "found %s chip: BCM%s, rev=%d\n", + socitype == SOCI_SB ? "SB" : "AXI", ci->pub.name, + ci->pub.chiprev); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +@@ -45,7 +45,7 @@ struct brcmf_chip { + u32 rambase; + u32 ramsize; + u32 srsize; +- char name[8]; ++ char name[12]; + }; + + /** +@@ -93,5 +93,6 @@ void brcmf_chip_resetcore(struct brcmf_c + void brcmf_chip_set_passive(struct brcmf_chip *ci); + bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec); + bool brcmf_chip_sr_capable(struct brcmf_chip *pub); ++char *brcmf_chip_name(u32 chipid, u32 chiprev, char *buf, uint len); + + #endif /* BRCMF_AXIDMP_H */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -30,6 +30,7 @@ + #include "common.h" + #include "of.h" + #include "firmware.h" ++#include "chip.h" + + MODULE_AUTHOR("Broadcom Corporation"); + MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); +@@ -131,14 +132,13 @@ static int brcmf_c_download(struct brcmf + static int brcmf_c_get_clm_name(struct brcmf_if *ifp, u8 *clm_name) + { + struct brcmf_bus *bus = ifp->drvr->bus_if; +- struct brcmf_rev_info *ri = &ifp->drvr->revinfo; + u8 fw_name[BRCMF_FW_NAME_LEN]; + u8 *ptr; + size_t len; + s32 err; + + memset(fw_name, 0, BRCMF_FW_NAME_LEN); +- err = brcmf_bus_get_fwname(bus, ri->chipnum, ri->chiprev, fw_name); ++ err = brcmf_bus_get_fwname(bus, bus->chip, bus->chiprev, fw_name); + if (err) { + brcmf_err("get firmware name failed (%d)\n", err); + goto done; +@@ -238,6 +238,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + { + s8 eventmask[BRCMF_EVENTING_MASK_LEN]; + u8 buf[BRCMF_DCMD_SMLEN]; ++ struct brcmf_bus *bus; + struct brcmf_rev_info_le revinfo; + struct brcmf_rev_info *ri; + char *clmver; +@@ -253,16 +254,18 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + } + memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); + ++ bus = ifp->drvr->bus_if; ++ ri = &ifp->drvr->revinfo; ++ + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, + &revinfo, sizeof(revinfo)); +- ri = &ifp->drvr->revinfo; + if (err < 0) { + brcmf_err("retrieving revision info failed, %d\n", err); ++ strlcpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname)); + } else { + ri->vendorid = le32_to_cpu(revinfo.vendorid); + ri->deviceid = le32_to_cpu(revinfo.deviceid); + ri->radiorev = le32_to_cpu(revinfo.radiorev); +- ri->chiprev = le32_to_cpu(revinfo.chiprev); + ri->corerev = le32_to_cpu(revinfo.corerev); + ri->boardid = le32_to_cpu(revinfo.boardid); + ri->boardvendor = le32_to_cpu(revinfo.boardvendor); +@@ -270,15 +273,23 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + ri->driverrev = le32_to_cpu(revinfo.driverrev); + ri->ucoderev = le32_to_cpu(revinfo.ucoderev); + ri->bus = le32_to_cpu(revinfo.bus); +- ri->chipnum = le32_to_cpu(revinfo.chipnum); + ri->phytype = le32_to_cpu(revinfo.phytype); + ri->phyrev = le32_to_cpu(revinfo.phyrev); + ri->anarev = le32_to_cpu(revinfo.anarev); + ri->chippkg = le32_to_cpu(revinfo.chippkg); + ri->nvramrev = le32_to_cpu(revinfo.nvramrev); ++ ++ if (!bus->chip) { ++ bus->chip = le32_to_cpu(revinfo.chipnum); ++ bus->chiprev = le32_to_cpu(revinfo.chiprev); ++ } + } + ri->result = err; + ++ if (bus->chip) ++ brcmf_chip_name(bus->chip, bus->chiprev, ++ ri->chipname, sizeof(ri->chipname)); ++ + /* Do any CLM downloading */ + err = brcmf_c_process_clm_blob(ifp); + if (err < 0) { +@@ -299,7 +310,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + strsep(&ptr, "\n"); + + /* Print fw version info */ +- brcmf_info("Firmware version = %s\n", buf); ++ brcmf_info("Firmware: %s %s\n", ri->chipname, buf); + + /* locate firmware version number for ethtool */ + ptr = strrchr(buf, ' ') + 1; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1002,8 +1002,7 @@ static int brcmf_revinfo_read(struct seq + seq_printf(s, "vendorid: 0x%04x\n", ri->vendorid); + seq_printf(s, "deviceid: 0x%04x\n", ri->deviceid); + seq_printf(s, "radiorev: %s\n", brcmu_dotrev_str(ri->radiorev, drev)); +- seq_printf(s, "chipnum: %u (%x)\n", ri->chipnum, ri->chipnum); +- seq_printf(s, "chiprev: %u\n", ri->chiprev); ++ seq_printf(s, "chip: %s\n", ri->chipname); + seq_printf(s, "chippkg: %u\n", ri->chippkg); + seq_printf(s, "corerev: %u\n", ri->corerev); + seq_printf(s, "boardid: 0x%04x\n", ri->boardid); +@@ -1053,13 +1052,6 @@ static int brcmf_bus_started(struct brcm + + brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); + +- /* assure we have chipid before feature attach */ +- if (!bus_if->chip) { +- bus_if->chip = drvr->revinfo.chipnum; +- bus_if->chiprev = drvr->revinfo.chiprev; +- brcmf_dbg(INFO, "firmware revinfo: chip %x (%d) rev %d\n", +- bus_if->chip, bus_if->chip, bus_if->chiprev); +- } + brcmf_feat_attach(drvr); + + ret = brcmf_proto_init_done(drvr); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -87,7 +87,6 @@ struct brcmf_rev_info { + u32 vendorid; + u32 deviceid; + u32 radiorev; +- u32 chiprev; + u32 corerev; + u32 boardid; + u32 boardvendor; +@@ -95,7 +94,7 @@ struct brcmf_rev_info { + u32 driverrev; + u32 ucoderev; + u32 bus; +- u32 chipnum; ++ char chipname[12]; + u32 phytype; + u32 phyrev; + u32 anarev; diff --git a/package/kernel/mac80211/patches/327-v4.17-0003-brcmfmac-use-brcmf_chip_name-for-consistency.patch b/package/kernel/mac80211/patches/327-v4.17-0003-brcmfmac-use-brcmf_chip_name-for-consistency.patch new file mode 100644 index 000000000..e3d06f32c --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0003-brcmfmac-use-brcmf_chip_name-for-consistency.patch @@ -0,0 +1,69 @@ +From c88cfa075de356ddf40c668896b2126340f19ba4 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:22 +0100 +Subject: [PATCH] brcmfmac: use brcmf_chip_name() for consistency + +When logging the chip id/revision information make use of +brcmf_chip_name() so it is always the same. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 5 ++--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 7 +++++-- + 2 files changed, 7 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -926,9 +926,8 @@ static int brcmf_chip_recognition(struct + + brcmf_chip_name(ci->pub.chip, ci->pub.chiprev, + ci->pub.name, sizeof(ci->pub.name)); +- brcmf_dbg(INFO, "found %s chip: BCM%s, rev=%d\n", +- socitype == SOCI_SB ? "SB" : "AXI", ci->pub.name, +- ci->pub.chiprev); ++ brcmf_dbg(INFO, "found %s chip: %s\n", ++ socitype == SOCI_SB ? "SB" : "AXI", ci->pub.name); + + if (socitype == SOCI_SB) { + if (ci->pub.chip != BRCM_CC_4329_CHIP_ID) { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -25,6 +25,7 @@ + #include "firmware.h" + #include "core.h" + #include "common.h" ++#include "chip.h" + + #define BRCMF_FW_MAX_NVRAM_SIZE 64000 + #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */ +@@ -567,6 +568,7 @@ int brcmf_fw_map_chip_to_name(u32 chip, + u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], + char nvram_name[BRCMF_FW_NAME_LEN]) + { ++ char chipname[12]; + u32 i; + char end; + +@@ -581,6 +583,8 @@ int brcmf_fw_map_chip_to_name(u32 chip, + return -ENODEV; + } + ++ brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname)); ++ + /* check if firmware path is provided by module parameter */ + if (brcmf_mp_global.firmware_path[0] != '\0') { + strlcpy(fw_name, brcmf_mp_global.firmware_path, +@@ -601,8 +605,7 @@ int brcmf_fw_map_chip_to_name(u32 chip, + if ((nvram_name) && (mapping_table[i].nvram)) + strlcat(nvram_name, mapping_table[i].nvram, BRCMF_FW_NAME_LEN); + +- brcmf_info("using %s for chip %#08x(%d) rev %#08x\n", +- fw_name, chip, chip, chiprev); ++ brcmf_info("using %s for chip %s\n", fw_name, chipname); + + return 0; + } diff --git a/package/kernel/mac80211/patches/327-v4.17-0004-brcmfmac-allocate-struct-brcmf_pub-instance-using-wi.patch b/package/kernel/mac80211/patches/327-v4.17-0004-brcmfmac-allocate-struct-brcmf_pub-instance-using-wi.patch new file mode 100644 index 000000000..42adff61b --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0004-brcmfmac-allocate-struct-brcmf_pub-instance-using-wi.patch @@ -0,0 +1,452 @@ +From 856d5a011c86b59f6564be4508912fb1d866adfc Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:23 +0100 +Subject: [PATCH] brcmfmac: allocate struct brcmf_pub instance using + wiphy_new() + +Rework the driver so the wiphy instance holds the main driver information +in its private buffer. Previously it held struct brcmf_cfg80211_info +instance so a bit of reorg was needed. This was done so that the wiphy +name or its parent device can be shown in debug output. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/btcoex.c | 2 +- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 86 ++++++++++------------ + .../broadcom/brcm80211/brcmfmac/cfg80211.h | 17 +++-- + .../wireless/broadcom/brcm80211/brcmfmac/common.c | 2 + + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 27 +++++-- + .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + + .../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 2 +- + 7 files changed, 76 insertions(+), 61 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c +@@ -462,7 +462,7 @@ static void brcmf_btcoex_dhcp_end(struct + int brcmf_btcoex_set_mode(struct brcmf_cfg80211_vif *vif, + enum brcmf_btcoex_mode mode, u16 duration) + { +- struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy); ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); + struct brcmf_btcoex_info *btci = cfg->btcoex; + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -753,7 +753,7 @@ s32 brcmf_notify_escan_complete(struct b + static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy, + struct wireless_dev *wdev) + { +- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct net_device *ndev = wdev->netdev; + struct brcmf_if *ifp = netdev_priv(ndev); + int ret; +@@ -786,7 +786,7 @@ err_unarm: + static + int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) + { +- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct net_device *ndev = wdev->netdev; + + if (ndev && ndev == cfg_to_ndev(cfg)) +@@ -831,7 +831,7 @@ brcmf_cfg80211_change_iface(struct wiphy + enum nl80211_iftype type, + struct vif_params *params) + { +- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_cfg80211_vif *vif = ifp->vif; + s32 infra = 0; +@@ -2127,17 +2127,15 @@ static s32 + brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, + s32 *dbm) + { +- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); +- struct net_device *ndev = cfg_to_ndev(cfg); +- struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev); + s32 qdbm = 0; + s32 err; + + brcmf_dbg(TRACE, "Enter\n"); +- if (!check_vif_up(ifp->vif)) ++ if (!check_vif_up(vif)) + return -EIO; + +- err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &qdbm); ++ err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm); + if (err) { + brcmf_err("error (%d)\n", err); + goto done; +@@ -3359,7 +3357,7 @@ brcmf_cfg80211_sched_scan_start(struct w + struct cfg80211_sched_scan_request *req) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + + brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n", + req->n_match_sets, req->n_ssids); +@@ -5191,6 +5189,12 @@ static struct cfg80211_ops brcmf_cfg8021 + .del_pmk = brcmf_cfg80211_del_pmk, + }; + ++struct cfg80211_ops *brcmf_cfg80211_get_ops(void) ++{ ++ return kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops), ++ GFP_KERNEL); ++} ++ + struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, + enum nl80211_iftype type) + { +@@ -5898,7 +5902,7 @@ static void brcmf_update_bw40_channel_fl + static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg, + u32 bw_cap[]) + { +- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); ++ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + struct ieee80211_supported_band *band; + struct ieee80211_channel *channel; + struct wiphy *wiphy; +@@ -6013,7 +6017,7 @@ fail_pbuf: + + static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) + { +- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); ++ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + struct ieee80211_supported_band *band; + struct brcmf_fil_bwcap_le band_bwcap; + struct brcmf_chanspec_list *list; +@@ -6198,10 +6202,10 @@ static void brcmf_update_vht_cap(struct + } + } + +-static int brcmf_setup_wiphybands(struct wiphy *wiphy) ++static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg) + { +- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); +- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); ++ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); ++ struct wiphy *wiphy; + u32 nmode = 0; + u32 vhtmode = 0; + u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT }; +@@ -6795,8 +6799,8 @@ static s32 brcmf_translate_country_code( + static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, + struct regulatory_request *req) + { +- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); +- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + struct brcmf_fil_country_le ccreq; + s32 err; + int i; +@@ -6831,7 +6835,7 @@ static void brcmf_cfg80211_reg_notifier( + brcmf_err("Firmware rejected country setting\n"); + return; + } +- brcmf_setup_wiphybands(wiphy); ++ brcmf_setup_wiphybands(cfg); + } + + static void brcmf_free_wiphy(struct wiphy *wiphy) +@@ -6858,17 +6862,15 @@ static void brcmf_free_wiphy(struct wiph + if (wiphy->wowlan != &brcmf_wowlan_support) + kfree(wiphy->wowlan); + #endif +- wiphy_free(wiphy); + } + + struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, +- struct device *busdev, ++ struct cfg80211_ops *ops, + bool p2pdev_forced) + { ++ struct wiphy *wiphy = drvr->wiphy; + struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev; + struct brcmf_cfg80211_info *cfg; +- struct wiphy *wiphy; +- struct cfg80211_ops *ops; + struct brcmf_cfg80211_vif *vif; + struct brcmf_if *ifp; + s32 err = 0; +@@ -6880,26 +6882,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + return NULL; + } + +- ops = kmemdup(&brcmf_cfg80211_ops, sizeof(*ops), GFP_KERNEL); +- if (!ops) +- return NULL; +- +- ifp = netdev_priv(ndev); +-#ifdef CONFIG_PM +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) +- ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; +-#endif +- wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info)); +- if (!wiphy) { ++ cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); ++ if (!cfg) { + brcmf_err("Could not allocate wiphy device\n"); +- goto ops_out; ++ return NULL; + } +- memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN); +- set_wiphy_dev(wiphy, busdev); + +- cfg = wiphy_priv(wiphy); + cfg->wiphy = wiphy; +- cfg->ops = ops; + cfg->pub = drvr; + init_vif_event(&cfg->vif_event); + INIT_LIST_HEAD(&cfg->vif_list); +@@ -6908,6 +6897,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + if (IS_ERR(vif)) + goto wiphy_out; + ++ ifp = netdev_priv(ndev); + vif->ifp = ifp; + vif->wdev.netdev = ndev; + ndev->ieee80211_ptr = &vif->wdev; +@@ -6934,6 +6924,11 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + if (err < 0) + goto priv_out; + ++ /* regulatory notifer below needs access to cfg so ++ * assign it now. ++ */ ++ drvr->config = cfg; ++ + brcmf_dbg(INFO, "Registering custom regulatory\n"); + wiphy->reg_notifier = brcmf_cfg80211_reg_notifier; + wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; +@@ -6947,13 +6942,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + cap = &wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap; + *cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; + } ++#ifdef CONFIG_PM ++ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) ++ ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; ++#endif + err = wiphy_register(wiphy); + if (err < 0) { + brcmf_err("Could not register wiphy device (%d)\n", err); + goto priv_out; + } + +- err = brcmf_setup_wiphybands(wiphy); ++ err = brcmf_setup_wiphybands(cfg); + if (err) { + brcmf_err("Setting wiphy bands failed (%d)\n", err); + goto wiphy_unreg_out; +@@ -6970,12 +6969,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + else + *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; + } +- /* p2p might require that "if-events" get processed by fweh. So +- * activate the already registered event handlers now and activate +- * the rest when initialization has completed. drvr->config needs to +- * be assigned before activating events. +- */ +- drvr->config = cfg; ++ + err = brcmf_fweh_activate_events(ifp); + if (err) { + brcmf_err("FWEH activation failed (%d)\n", err); +@@ -7043,8 +7037,7 @@ priv_out: + ifp->vif = NULL; + wiphy_out: + brcmf_free_wiphy(wiphy); +-ops_out: +- kfree(ops); ++ kfree(cfg); + return NULL; + } + +@@ -7059,4 +7052,5 @@ void brcmf_cfg80211_detach(struct brcmf_ + kfree(cfg->ops); + wl_deinit_priv(cfg); + brcmf_free_wiphy(cfg->wiphy); ++ kfree(cfg); + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +@@ -355,20 +355,24 @@ static inline struct wiphy *cfg_to_wiphy + + static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w) + { +- return (struct brcmf_cfg80211_info *)(wiphy_priv(w)); ++ struct brcmf_pub *drvr = wiphy_priv(w); ++ return drvr->config; + } + + static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd) + { +- return (struct brcmf_cfg80211_info *)(wdev_priv(wd)); ++ return wiphy_to_cfg(wd->wiphy); ++} ++ ++static inline struct brcmf_cfg80211_vif *wdev_to_vif(struct wireless_dev *wdev) ++{ ++ return container_of(wdev, struct brcmf_cfg80211_vif, wdev); + } + + static inline + struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) + { +- struct brcmf_cfg80211_vif *vif; +- vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list); +- return vif->wdev.netdev; ++ return brcmf_get_ifp(cfg->pub, 0)->ndev; + } + + static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev) +@@ -395,11 +399,12 @@ brcmf_cfg80211_connect_info *cfg_to_conn + } + + struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, +- struct device *busdev, ++ struct cfg80211_ops *ops, + bool p2pdev_forced); + void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); + s32 brcmf_cfg80211_up(struct net_device *ndev); + s32 brcmf_cfg80211_down(struct net_device *ndev); ++struct cfg80211_ops *brcmf_cfg80211_get_ops(void); + enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); + + struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -252,6 +252,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + brcmf_err("Retreiving cur_etheraddr failed, %d\n", err); + goto done; + } ++ memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN); + memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); + + bus = ifp->drvr->bus_if; +@@ -279,6 +280,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + ri->chippkg = le32_to_cpu(revinfo.chippkg); + ri->nvramrev = le32_to_cpu(revinfo.nvramrev); + ++ /* use revinfo if not known yet */ + if (!bus->chip) { + bus->chip = le32_to_cpu(revinfo.chipnum); + bus->chiprev = le32_to_cpu(revinfo.chiprev); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1021,7 +1021,7 @@ static int brcmf_revinfo_read(struct seq + return 0; + } + +-static int brcmf_bus_started(struct brcmf_pub *drvr) ++static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops) + { + int ret = -1; + struct brcmf_bus *bus_if = drvr->bus_if; +@@ -1060,7 +1060,7 @@ static int brcmf_bus_started(struct brcm + + brcmf_proto_add_if(drvr, ifp); + +- drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev, ++ drvr->config = brcmf_cfg80211_attach(drvr, ops, + drvr->settings->p2p_enable); + if (drvr->config == NULL) { + ret = -ENOMEM; +@@ -1115,17 +1115,26 @@ fail: + + int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) + { ++ struct wiphy *wiphy; ++ struct cfg80211_ops *ops; + struct brcmf_pub *drvr = NULL; + int ret = 0; + int i; + + brcmf_dbg(TRACE, "Enter\n"); + +- /* Allocate primary brcmf_info */ +- drvr = kzalloc(sizeof(*drvr), GFP_ATOMIC); +- if (!drvr) ++ ops = brcmf_cfg80211_get_ops(); ++ if (!ops) + return -ENOMEM; + ++ wiphy = wiphy_new(ops, sizeof(*drvr)); ++ if (!wiphy) ++ return -ENOMEM; ++ ++ set_wiphy_dev(wiphy, dev); ++ drvr = wiphy_priv(wiphy); ++ drvr->wiphy = wiphy; ++ + for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) + drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; + +@@ -1154,15 +1163,18 @@ int brcmf_attach(struct device *dev, str + /* attach firmware event handler */ + brcmf_fweh_attach(drvr); + +- ret = brcmf_bus_started(drvr); ++ ret = brcmf_bus_started(drvr, ops); + if (ret != 0) { + brcmf_err("dongle is not responding: err=%d\n", ret); + goto fail; + } ++ ++ drvr->config->ops = ops; + return 0; + + fail: + brcmf_detach(dev); ++ kfree(ops); + + return ret; + } +@@ -1220,6 +1232,7 @@ void brcmf_detach(struct device *dev) + brcmf_remove_interface(drvr->iflist[i], false); + + brcmf_cfg80211_detach(drvr->config); ++ drvr->config = NULL; + + brcmf_bus_stop(drvr->bus_if); + +@@ -1227,7 +1240,7 @@ void brcmf_detach(struct device *dev) + + brcmf_debug_detach(drvr); + bus_if->drvr = NULL; +- kfree(drvr); ++ wiphy_free(drvr->wiphy); + } + + s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -107,6 +107,7 @@ struct brcmf_pub { + /* Linkage ponters */ + struct brcmf_bus *bus_if; + struct brcmf_proto *proto; ++ struct wiphy *wiphy; + struct brcmf_cfg80211_info *config; + + /* Internal brcmf items */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -2229,7 +2229,7 @@ fail: + */ + int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) + { +- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_p2p_info *p2p = &cfg->p2p; + struct brcmf_cfg80211_vif *vif; + enum nl80211_iftype iftype; diff --git a/package/kernel/mac80211/patches/327-v4.17-0005-brcmfmac-use-wiphy-debugfs-dir-entry.patch b/package/kernel/mac80211/patches/327-v4.17-0005-brcmfmac-use-wiphy-debugfs-dir-entry.patch new file mode 100644 index 000000000..c5485c390 --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0005-brcmfmac-use-wiphy-debugfs-dir-entry.patch @@ -0,0 +1,349 @@ +From 34789d0cf682c643862792750a06c31ccf016cbc Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:24 +0100 +Subject: [PATCH] brcmfmac: use wiphy debugfs dir entry + +The driver used to create a brcmfmac dir entry at the top level +debugfs mount point. This moves the debugfs entries into the +wiphy debugfs dir entry. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 6 ++++ + .../wireless/broadcom/brcm80211/brcmfmac/common.c | 5 --- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 11 +++--- + .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 42 ++-------------------- + .../wireless/broadcom/brcm80211/brcmfmac/debug.h | 17 --------- + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 3 ++ + .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 7 ++++ + .../broadcom/brcm80211/brcmfmac/fwsignal.c | 11 +++--- + .../broadcom/brcm80211/brcmfmac/fwsignal.h | 1 + + .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 8 +++-- + .../wireless/broadcom/brcm80211/brcmfmac/proto.c | 3 +- + .../wireless/broadcom/brcm80211/brcmfmac/proto.h | 7 ++++ + 12 files changed, 47 insertions(+), 74 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -445,6 +445,11 @@ brcmf_proto_bcdc_init_done(struct brcmf_ + return 0; + } + ++static void brcmf_proto_bcdc_debugfs_create(struct brcmf_pub *drvr) ++{ ++ brcmf_fws_debugfs_create(drvr); ++} ++ + int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) + { + struct brcmf_bcdc *bcdc; +@@ -472,6 +477,7 @@ int brcmf_proto_bcdc_attach(struct brcmf + drvr->proto->del_if = brcmf_proto_bcdc_del_if; + drvr->proto->reset_if = brcmf_proto_bcdc_reset_if; + drvr->proto->init_done = brcmf_proto_bcdc_init_done; ++ drvr->proto->debugfs_create = brcmf_proto_bcdc_debugfs_create; + drvr->proto->pd = bcdc; + + drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -529,9 +529,6 @@ static int __init brcmfmac_module_init(v + { + int err; + +- /* Initialize debug system first */ +- brcmf_debugfs_init(); +- + /* Get the platform data (if available) for our devices */ + err = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe); + if (err == -ENODEV) +@@ -543,7 +540,6 @@ static int __init brcmfmac_module_init(v + /* Continue the initialization by registering the different busses */ + err = brcmf_core_init(); + if (err) { +- brcmf_debugfs_exit(); + if (brcmfmac_pdata) + platform_driver_unregister(&brcmf_pd); + } +@@ -556,7 +552,6 @@ static void __exit brcmfmac_module_exit( + brcmf_core_exit(); + if (brcmfmac_pdata) + platform_driver_unregister(&brcmf_pd); +- brcmf_debugfs_exit(); + } + + module_init(brcmfmac_module_init); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1050,8 +1050,6 @@ static int brcmf_bus_started(struct brcm + if (ret < 0) + goto fail; + +- brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); +- + brcmf_feat_attach(drvr); + + ret = brcmf_proto_init_done(drvr); +@@ -1094,6 +1092,11 @@ static int brcmf_bus_started(struct brcm + #endif + #endif /* CONFIG_INET */ + ++ /* populate debugfs */ ++ brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); ++ brcmf_feat_debugfs_create(drvr); ++ brcmf_proto_debugfs_create(drvr); ++ + return 0; + + fail: +@@ -1146,9 +1149,6 @@ int brcmf_attach(struct device *dev, str + drvr->bus_if->drvr = drvr; + drvr->settings = settings; + +- /* attach debug facilities */ +- brcmf_debug_attach(drvr); +- + /* Attach and link in the protocol */ + ret = brcmf_proto_attach(drvr); + if (ret != 0) { +@@ -1238,7 +1238,6 @@ void brcmf_detach(struct device *dev) + + brcmf_proto_detach(drvr); + +- brcmf_debug_detach(drvr); + bus_if->drvr = NULL; + wiphy_free(drvr->wiphy); + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +@@ -25,8 +25,6 @@ + #include "fweh.h" + #include "debug.h" + +-static struct dentry *root_folder; +- + int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, + size_t len) + { +@@ -54,44 +52,9 @@ int brcmf_debug_create_memdump(struct br + return 0; + } + +-void brcmf_debugfs_init(void) +-{ +- root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL); +- if (IS_ERR(root_folder)) +- root_folder = NULL; +-} +- +-void brcmf_debugfs_exit(void) +-{ +- if (!root_folder) +- return; +- +- debugfs_remove_recursive(root_folder); +- root_folder = NULL; +-} +- +-int brcmf_debug_attach(struct brcmf_pub *drvr) +-{ +- struct device *dev = drvr->bus_if->dev; +- +- if (!root_folder) +- return -ENODEV; +- +- drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder); +- return PTR_ERR_OR_ZERO(drvr->dbgfs_dir); +-} +- +-void brcmf_debug_detach(struct brcmf_pub *drvr) +-{ +- brcmf_fweh_unregister(drvr, BRCMF_E_PSM_WATCHDOG); +- +- if (!IS_ERR_OR_NULL(drvr->dbgfs_dir)) +- debugfs_remove_recursive(drvr->dbgfs_dir); +-} +- + struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) + { +- return drvr->dbgfs_dir; ++ return drvr->wiphy->debugfsdir; + } + + int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, +@@ -99,7 +62,8 @@ int brcmf_debugfs_add_entry(struct brcmf + { + struct dentry *e; + ++ WARN(!drvr->wiphy->debugfsdir, "wiphy not (yet) registered\n"); + e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn, +- drvr->dbgfs_dir, read_fn); ++ drvr->wiphy->debugfsdir, read_fn); + return PTR_ERR_OR_ZERO(e); + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -113,29 +113,12 @@ extern int brcmf_msg_level; + struct brcmf_bus; + struct brcmf_pub; + #ifdef DEBUG +-void brcmf_debugfs_init(void); +-void brcmf_debugfs_exit(void); +-int brcmf_debug_attach(struct brcmf_pub *drvr); +-void brcmf_debug_detach(struct brcmf_pub *drvr); + struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr); + int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, + int (*read_fn)(struct seq_file *seq, void *data)); + int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, + size_t len); + #else +-static inline void brcmf_debugfs_init(void) +-{ +-} +-static inline void brcmf_debugfs_exit(void) +-{ +-} +-static inline int brcmf_debug_attach(struct brcmf_pub *drvr) +-{ +- return 0; +-} +-static inline void brcmf_debug_detach(struct brcmf_pub *drvr) +-{ +-} + static inline + int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, + int (*read_fn)(struct seq_file *seq, void *data)) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -228,7 +228,10 @@ void brcmf_feat_attach(struct brcmf_pub + /* no quirks */ + break; + } ++} + ++void brcmf_feat_debugfs_create(struct brcmf_pub *drvr) ++{ + brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read); + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +@@ -90,6 +90,13 @@ enum brcmf_feat_quirk { + void brcmf_feat_attach(struct brcmf_pub *drvr); + + /** ++ * brcmf_feat_debugfs_create() - create debugfs entries. ++ * ++ * @drvr: driver instance. ++ */ ++void brcmf_feat_debugfs_create(struct brcmf_pub *drvr); ++ ++/** + * brcmf_feat_is_enabled() - query feature. + * + * @ifp: interface instance. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +@@ -2399,10 +2399,6 @@ struct brcmf_fws_info *brcmf_fws_attach( + brcmu_pktq_init(&fws->desc.other.psq, BRCMF_FWS_PSQ_PREC_COUNT, + BRCMF_FWS_PSQ_LEN); + +- /* create debugfs file for statistics */ +- brcmf_debugfs_add_entry(drvr, "fws_stats", +- brcmf_debugfs_fws_stats_read); +- + brcmf_dbg(INFO, "%s bdcv2 tlv signaling [%x]\n", + fws->fw_signals ? "enabled" : "disabled", tlv); + return fws; +@@ -2429,6 +2425,13 @@ void brcmf_fws_detach(struct brcmf_fws_i + kfree(fws); + } + ++void brcmf_fws_debugfs_create(struct brcmf_pub *drvr) ++{ ++ /* create debugfs file for statistics */ ++ brcmf_debugfs_add_entry(drvr, "fws_stats", ++ brcmf_debugfs_fws_stats_read); ++} ++ + bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws) + { + return !fws->avoid_queueing; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h +@@ -20,6 +20,7 @@ + + struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr); + void brcmf_fws_detach(struct brcmf_fws_info *fws); ++void brcmf_fws_debugfs_create(struct brcmf_pub *drvr); + bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws); + bool brcmf_fws_fc_active(struct brcmf_fws_info *fws); + void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -1418,6 +1418,11 @@ static int brcmf_msgbuf_stats_read(struc + } + #endif + ++static void brcmf_msgbuf_debugfs_create(struct brcmf_pub *drvr) ++{ ++ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read); ++} ++ + int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) + { + struct brcmf_bus_msgbuf *if_msgbuf; +@@ -1472,6 +1477,7 @@ int brcmf_proto_msgbuf_attach(struct brc + drvr->proto->delete_peer = brcmf_msgbuf_delete_peer; + drvr->proto->add_tdls_peer = brcmf_msgbuf_add_tdls_peer; + drvr->proto->rxreorder = brcmf_msgbuf_rxreorder; ++ drvr->proto->debugfs_create = brcmf_msgbuf_debugfs_create; + drvr->proto->pd = msgbuf; + + init_waitqueue_head(&msgbuf->ioctl_resp_wait); +@@ -1525,8 +1531,6 @@ int brcmf_proto_msgbuf_attach(struct brc + spin_lock_init(&msgbuf->flowring_work_lock); + INIT_LIST_HEAD(&msgbuf->work_queue); + +- brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read); +- + return 0; + + fail: +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c +@@ -54,7 +54,8 @@ int brcmf_proto_attach(struct brcmf_pub + if (!proto->tx_queue_data || (proto->hdrpull == NULL) || + (proto->query_dcmd == NULL) || (proto->set_dcmd == NULL) || + (proto->configure_addr_mode == NULL) || +- (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL)) { ++ (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL) || ++ (proto->debugfs_create == NULL)) { + brcmf_err("Not all proto handlers have been installed\n"); + goto fail; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h +@@ -48,6 +48,7 @@ struct brcmf_proto { + void (*del_if)(struct brcmf_if *ifp); + void (*reset_if)(struct brcmf_if *ifp); + int (*init_done)(struct brcmf_pub *drvr); ++ void (*debugfs_create)(struct brcmf_pub *drvr); + void *pd; + }; + +@@ -156,4 +157,10 @@ brcmf_proto_init_done(struct brcmf_pub * + return drvr->proto->init_done(drvr); + } + ++static inline void ++brcmf_proto_debugfs_create(struct brcmf_pub *drvr) ++{ ++ drvr->proto->debugfs_create(drvr); ++} ++ + #endif /* BRCMFMAC_PROTO_H */ diff --git a/package/kernel/mac80211/patches/327-v4.17-0006-brcmfmac-derive-firmware-filenames-from-basename-map.patch b/package/kernel/mac80211/patches/327-v4.17-0006-brcmfmac-derive-firmware-filenames-from-basename-map.patch new file mode 100644 index 000000000..0b1ae56bc --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0006-brcmfmac-derive-firmware-filenames-from-basename-map.patch @@ -0,0 +1,286 @@ +From 41f573dbb534f14e62a4a5411f602c970cad1d77 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:25 +0100 +Subject: [PATCH] brcmfmac: derive firmware filenames from basename mapping + +Instead of defining individual filenames for firmware and nvram +use a basename and derive the names from that. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 31 ++++++--- + .../broadcom/brcm80211/brcmfmac/firmware.h | 24 ++----- + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 56 ++++++++--------- + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 73 +++++++++++----------- + .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 10 +-- + 5 files changed, 96 insertions(+), 98 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -563,6 +563,13 @@ int brcmf_fw_get_firmwares(struct device + 0); + } + ++static void brcmf_fw_get_full_name(char fw_name[BRCMF_FW_NAME_LEN], ++ const char *fw_base, const char *extension) ++{ ++ strlcat(fw_name, fw_base, BRCMF_FW_NAME_LEN); ++ strlcat(fw_name, extension, BRCMF_FW_NAME_LEN); ++} ++ + int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, + struct brcmf_firmware_mapping mapping_table[], + u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], +@@ -587,25 +594,31 @@ int brcmf_fw_map_chip_to_name(u32 chip, + + /* check if firmware path is provided by module parameter */ + if (brcmf_mp_global.firmware_path[0] != '\0') { +- strlcpy(fw_name, brcmf_mp_global.firmware_path, +- BRCMF_FW_NAME_LEN); +- if ((nvram_name) && (mapping_table[i].nvram)) ++ if (fw_name) ++ strlcpy(fw_name, brcmf_mp_global.firmware_path, ++ BRCMF_FW_NAME_LEN); ++ if (nvram_name) + strlcpy(nvram_name, brcmf_mp_global.firmware_path, + BRCMF_FW_NAME_LEN); + + end = brcmf_mp_global.firmware_path[ + strlen(brcmf_mp_global.firmware_path) - 1]; + if (end != '/') { +- strlcat(fw_name, "/", BRCMF_FW_NAME_LEN); +- if ((nvram_name) && (mapping_table[i].nvram)) ++ if (fw_name) ++ strlcat(fw_name, "/", BRCMF_FW_NAME_LEN); ++ if (nvram_name) + strlcat(nvram_name, "/", BRCMF_FW_NAME_LEN); + } + } +- strlcat(fw_name, mapping_table[i].fw, BRCMF_FW_NAME_LEN); +- if ((nvram_name) && (mapping_table[i].nvram)) +- strlcat(nvram_name, mapping_table[i].nvram, BRCMF_FW_NAME_LEN); + +- brcmf_info("using %s for chip %s\n", fw_name, chipname); ++ brcmf_info("using %s for chip %s\n", ++ mapping_table[i].fw_base, chipname); ++ if (fw_name) ++ brcmf_fw_get_full_name(fw_name, ++ mapping_table[i].fw_base, ".bin"); ++ if (nvram_name) ++ brcmf_fw_get_full_name(nvram_name, ++ mapping_table[i].fw_base, ".txt"); + + return 0; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h +@@ -38,28 +38,16 @@ + struct brcmf_firmware_mapping { + u32 chipid; + u32 revmask; +- const char *fw; +- const char *nvram; ++ const char *fw_base; + }; + +-#define BRCMF_FW_NVRAM_DEF(fw_nvram_name, fw, nvram) \ +-static const char BRCM_ ## fw_nvram_name ## _FIRMWARE_NAME[] = \ +- BRCMF_FW_DEFAULT_PATH fw; \ +-static const char BRCM_ ## fw_nvram_name ## _NVRAM_NAME[] = \ +- BRCMF_FW_DEFAULT_PATH nvram; \ +-MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw); +- +-#define BRCMF_FW_DEF(fw_name, fw) \ +-static const char BRCM_ ## fw_name ## _FIRMWARE_NAME[] = \ +- BRCMF_FW_DEFAULT_PATH fw; \ +-MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw) \ +- +-#define BRCMF_FW_NVRAM_ENTRY(chipid, mask, name) \ +- { chipid, mask, \ +- BRCM_ ## name ## _FIRMWARE_NAME, BRCM_ ## name ## _NVRAM_NAME } ++#define BRCMF_FW_DEF(fw_name, fw_base) \ ++static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \ ++ BRCMF_FW_DEFAULT_PATH fw_base; \ ++MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".bin") + + #define BRCMF_FW_ENTRY(chipid, mask, name) \ +- { chipid, mask, BRCM_ ## name ## _FIRMWARE_NAME, NULL } ++ { chipid, mask, BRCM_ ## name ## _FIRMWARE_BASENAME } + + int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, + struct brcmf_firmware_mapping mapping_table[], +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -46,36 +46,36 @@ enum brcmf_pcie_state { + BRCMFMAC_PCIE_STATE_UP + }; + +-BRCMF_FW_NVRAM_DEF(43602, "brcmfmac43602-pcie.bin", "brcmfmac43602-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4350, "brcmfmac4350-pcie.bin", "brcmfmac4350-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4350C, "brcmfmac4350c2-pcie.bin", "brcmfmac4350c2-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-pcie.bin", "brcmfmac4356-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(43570, "brcmfmac43570-pcie.bin", "brcmfmac43570-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-pcie.bin", "brcmfmac4358-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4365C, "brcmfmac4365c-pcie.bin", "brcmfmac4365c-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt"); +-BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt"); ++BRCMF_FW_DEF(43602, "brcmfmac43602-pcie"); ++BRCMF_FW_DEF(4350, "brcmfmac4350-pcie"); ++BRCMF_FW_DEF(4350C, "brcmfmac4350c2-pcie"); ++BRCMF_FW_DEF(4356, "brcmfmac4356-pcie"); ++BRCMF_FW_DEF(43570, "brcmfmac43570-pcie"); ++BRCMF_FW_DEF(4358, "brcmfmac4358-pcie"); ++BRCMF_FW_DEF(4359, "brcmfmac4359-pcie"); ++BRCMF_FW_DEF(4365B, "brcmfmac4365b-pcie"); ++BRCMF_FW_DEF(4365C, "brcmfmac4365c-pcie"); ++BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie"); ++BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie"); ++BRCMF_FW_DEF(4371, "brcmfmac4371-pcie"); + + static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43465_CHIP_ID, 0xFFFFFFF0, 4366C), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0x000000FF, 4350C), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFF00, 4350), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43525_CHIP_ID, 0xFFFFFFF0, 4365C), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0x0000000F, 4365B), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFF0, 4365C), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), ++ BRCMF_FW_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602), ++ BRCMF_FW_ENTRY(BRCM_CC_43465_CHIP_ID, 0xFFFFFFF0, 4366C), ++ BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0x000000FF, 4350C), ++ BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFF00, 4350), ++ BRCMF_FW_ENTRY(BRCM_CC_43525_CHIP_ID, 0xFFFFFFF0, 4365C), ++ BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), ++ BRCMF_FW_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570), ++ BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570), ++ BRCMF_FW_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570), ++ BRCMF_FW_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358), ++ BRCMF_FW_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359), ++ BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0x0000000F, 4365B), ++ BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFF0, 4365C), ++ BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B), ++ BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C), ++ BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), + }; + + #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -600,47 +600,44 @@ static const struct sdiod_drive_str sdio + {4, 0x1} + }; + +-BRCMF_FW_NVRAM_DEF(43143, "brcmfmac43143-sdio.bin", "brcmfmac43143-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(43241B0, "brcmfmac43241b0-sdio.bin", +- "brcmfmac43241b0-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(43241B4, "brcmfmac43241b4-sdio.bin", +- "brcmfmac43241b4-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(43241B5, "brcmfmac43241b5-sdio.bin", +- "brcmfmac43241b5-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(43430A0, "brcmfmac43430a0-sdio.bin", "brcmfmac43430a0-sdio.txt"); ++BRCMF_FW_DEF(43143, "brcmfmac43143-sdio"); ++BRCMF_FW_DEF(43241B0, "brcmfmac43241b0-sdio"); ++BRCMF_FW_DEF(43241B4, "brcmfmac43241b4-sdio"); ++BRCMF_FW_DEF(43241B5, "brcmfmac43241b5-sdio"); ++BRCMF_FW_DEF(4329, "brcmfmac4329-sdio"); ++BRCMF_FW_DEF(4330, "brcmfmac4330-sdio"); ++BRCMF_FW_DEF(4334, "brcmfmac4334-sdio"); ++BRCMF_FW_DEF(43340, "brcmfmac43340-sdio"); ++BRCMF_FW_DEF(4335, "brcmfmac4335-sdio"); ++BRCMF_FW_DEF(43362, "brcmfmac43362-sdio"); ++BRCMF_FW_DEF(4339, "brcmfmac4339-sdio"); ++BRCMF_FW_DEF(43430A0, "brcmfmac43430a0-sdio"); + /* Note the names are not postfixed with a1 for backward compatibility */ +-BRCMF_FW_NVRAM_DEF(43430A1, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-sdio.bin", "brcmfmac4356-sdio.txt"); +-BRCMF_FW_NVRAM_DEF(4373, "brcmfmac4373-sdio.bin", "brcmfmac4373-sdio.txt"); ++BRCMF_FW_DEF(43430A1, "brcmfmac43430-sdio"); ++BRCMF_FW_DEF(43455, "brcmfmac43455-sdio"); ++BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); ++BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); ++BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); + + static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), +- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), +- BRCMF_FW_NVRAM_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373) ++ BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), ++ BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), ++ BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), ++ BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5), ++ BRCMF_FW_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329), ++ BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), ++ BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), ++ BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), ++ BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), ++ BRCMF_FW_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), ++ BRCMF_FW_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), ++ BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), ++ BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0), ++ BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1), ++ BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455), ++ BRCMF_FW_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), ++ BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), ++ BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373) + }; + + static void pkt_align(struct sk_buff *p, int len, int align) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -46,11 +46,11 @@ + #define BRCMF_USB_CBCTL_READ 1 + #define BRCMF_USB_MAX_PKT_SIZE 1600 + +-BRCMF_FW_DEF(43143, "brcmfmac43143.bin"); +-BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin"); +-BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin"); +-BRCMF_FW_DEF(43569, "brcmfmac43569.bin"); +-BRCMF_FW_DEF(4373, "brcmfmac4373.bin"); ++BRCMF_FW_DEF(43143, "brcmfmac43143"); ++BRCMF_FW_DEF(43236B, "brcmfmac43236b"); ++BRCMF_FW_DEF(43242A, "brcmfmac43242a"); ++BRCMF_FW_DEF(43569, "brcmfmac43569"); ++BRCMF_FW_DEF(4373, "brcmfmac4373"); + + static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = { + BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), diff --git a/package/kernel/mac80211/patches/327-v4.17-0007-brcmfmac-pass-struct-in-brcmf_fw_get_firmwares.patch b/package/kernel/mac80211/patches/327-v4.17-0007-brcmfmac-pass-struct-in-brcmf_fw_get_firmwares.patch new file mode 100644 index 000000000..a75465a89 --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0007-brcmfmac-pass-struct-in-brcmf_fw_get_firmwares.patch @@ -0,0 +1,574 @@ +From d09ae51a4b676151edaf572bcd5f272b5532639f Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:26 +0100 +Subject: [PATCH] brcmfmac: pass struct in brcmf_fw_get_firmwares() + +Make the function brcmf_fw_get_firmwares() a bit more easy to extend +using a structure to pass the request parameters. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 175 ++++++++++++++------- + .../broadcom/brcm80211/brcmfmac/firmware.h | 43 +++-- + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 38 ++++- + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 32 +++- + .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 43 ++++- + 5 files changed, 245 insertions(+), 86 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -438,18 +438,31 @@ void brcmf_fw_nvram_free(void *nvram) + + struct brcmf_fw { + struct device *dev; +- u16 flags; +- const struct firmware *code; +- const char *nvram_name; +- u16 domain_nr; +- u16 bus_nr; +- void (*done)(struct device *dev, int err, const struct firmware *fw, +- void *nvram_image, u32 nvram_len); ++ struct brcmf_fw_request *req; ++ u32 curpos; ++ void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); + }; + ++static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); ++ ++static void brcmf_fw_free_request(struct brcmf_fw_request *req) ++{ ++ struct brcmf_fw_item *item; ++ int i; ++ ++ for (i = 0, item = &req->items[0]; i < req->n_items; i++, item++) { ++ if (item->type == BRCMF_FW_TYPE_BINARY) ++ release_firmware(item->binary); ++ else if (item->type == BRCMF_FW_TYPE_NVRAM) ++ brcmf_fw_nvram_free(item->nv_data.data); ++ } ++ kfree(req); ++} ++ + static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) + { + struct brcmf_fw *fwctx = ctx; ++ struct brcmf_fw_item *cur; + u32 nvram_length = 0; + void *nvram = NULL; + u8 *data = NULL; +@@ -457,83 +470,150 @@ static void brcmf_fw_request_nvram_done( + bool raw_nvram; + + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); ++ ++ cur = &fwctx->req->items[fwctx->curpos]; ++ + if (fw && fw->data) { + data = (u8 *)fw->data; + data_len = fw->size; + raw_nvram = false; + } else { + data = bcm47xx_nvram_get_contents(&data_len); +- if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) ++ if (!data && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) + goto fail; + raw_nvram = true; + } + + if (data) + nvram = brcmf_fw_nvram_strip(data, data_len, &nvram_length, +- fwctx->domain_nr, fwctx->bus_nr); ++ fwctx->req->domain_nr, ++ fwctx->req->bus_nr); + + if (raw_nvram) + bcm47xx_nvram_release_contents(data); + release_firmware(fw); +- if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) ++ if (!nvram && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) + goto fail; + +- fwctx->done(fwctx->dev, 0, fwctx->code, nvram, nvram_length); +- kfree(fwctx); ++ brcmf_dbg(TRACE, "nvram %p len %d\n", nvram, nvram_length); ++ cur->nv_data.data = nvram; ++ cur->nv_data.len = nvram_length; + return; + + fail: + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); +- release_firmware(fwctx->code); +- fwctx->done(fwctx->dev, -ENOENT, NULL, NULL, 0); ++ fwctx->done(fwctx->dev, -ENOENT, NULL); ++ brcmf_fw_free_request(fwctx->req); + kfree(fwctx); + } + +-static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx) ++static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async) ++{ ++ struct brcmf_fw_item *cur; ++ const struct firmware *fw = NULL; ++ int ret; ++ ++ cur = &fwctx->req->items[fwctx->curpos]; ++ ++ brcmf_dbg(TRACE, "%srequest for %s\n", async ? "async " : "", ++ cur->path); ++ ++ if (async) ++ ret = request_firmware_nowait(THIS_MODULE, true, cur->path, ++ fwctx->dev, GFP_KERNEL, fwctx, ++ brcmf_fw_request_done); ++ else ++ ret = request_firmware(&fw, cur->path, fwctx->dev); ++ ++ if (ret < 0) { ++ brcmf_fw_request_done(NULL, fwctx); ++ } else if (!async && fw) { ++ brcmf_dbg(TRACE, "firmware %s %sfound\n", cur->path, ++ fw ? "" : "not "); ++ if (cur->type == BRCMF_FW_TYPE_BINARY) ++ cur->binary = fw; ++ else if (cur->type == BRCMF_FW_TYPE_NVRAM) ++ brcmf_fw_request_nvram_done(fw, fwctx); ++ else ++ release_firmware(fw); ++ ++ return -EAGAIN; ++ } ++ return 0; ++} ++ ++static void brcmf_fw_request_done(const struct firmware *fw, void *ctx) + { + struct brcmf_fw *fwctx = ctx; ++ struct brcmf_fw_item *cur; + int ret = 0; + +- brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); +- if (!fw) { ++ cur = &fwctx->req->items[fwctx->curpos]; ++ ++ brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path, ++ fw ? "" : "not "); ++ ++ if (fw) { ++ if (cur->type == BRCMF_FW_TYPE_BINARY) ++ cur->binary = fw; ++ else if (cur->type == BRCMF_FW_TYPE_NVRAM) ++ brcmf_fw_request_nvram_done(fw, fwctx); ++ else ++ release_firmware(fw); ++ } else if (cur->type == BRCMF_FW_TYPE_NVRAM) { ++ brcmf_fw_request_nvram_done(NULL, fwctx); ++ } else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) { + ret = -ENOENT; + goto fail; + } +- /* only requested code so done here */ +- if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) +- goto done; +- +- fwctx->code = fw; +- ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name, +- fwctx->dev, GFP_KERNEL, fwctx, +- brcmf_fw_request_nvram_done); + +- /* pass NULL to nvram callback for bcm47xx fallback */ +- if (ret) +- brcmf_fw_request_nvram_done(NULL, fwctx); ++ do { ++ if (++fwctx->curpos == fwctx->req->n_items) { ++ ret = 0; ++ goto done; ++ } ++ ++ ret = brcmf_fw_request_next_item(fwctx, false); ++ } while (ret == -EAGAIN); ++ + return; + + fail: +- brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); ++ brcmf_dbg(TRACE, "failed err=%d: dev=%s, fw=%s\n", ret, ++ dev_name(fwctx->dev), cur->path); ++ brcmf_fw_free_request(fwctx->req); ++ fwctx->req = NULL; + done: +- fwctx->done(fwctx->dev, ret, fw, NULL, 0); ++ fwctx->done(fwctx->dev, ret, fwctx->req); + kfree(fwctx); + } + +-int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, +- const char *code, const char *nvram, +- void (*fw_cb)(struct device *dev, int err, +- const struct firmware *fw, +- void *nvram_image, u32 nvram_len), +- u16 domain_nr, u16 bus_nr) ++static bool brcmf_fw_request_is_valid(struct brcmf_fw_request *req) ++{ ++ struct brcmf_fw_item *item; ++ int i; ++ ++ if (!req->n_items) ++ return false; ++ ++ for (i = 0, item = &req->items[0]; i < req->n_items; i++, item++) { ++ if (!item->path) ++ return false; ++ } ++ return true; ++} ++ ++int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, ++ void (*fw_cb)(struct device *dev, int err, ++ struct brcmf_fw_request *req)) + { + struct brcmf_fw *fwctx; + + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); +- if (!fw_cb || !code) ++ if (!fw_cb) + return -EINVAL; + +- if ((flags & BRCMF_FW_REQUEST_NVRAM) && !nvram) ++ if (!brcmf_fw_request_is_valid(req)) + return -EINVAL; + + fwctx = kzalloc(sizeof(*fwctx), GFP_KERNEL); +@@ -541,26 +621,11 @@ int brcmf_fw_get_firmwares_pcie(struct d + return -ENOMEM; + + fwctx->dev = dev; +- fwctx->flags = flags; ++ fwctx->req = req; + fwctx->done = fw_cb; +- if (flags & BRCMF_FW_REQUEST_NVRAM) +- fwctx->nvram_name = nvram; +- fwctx->domain_nr = domain_nr; +- fwctx->bus_nr = bus_nr; +- +- return request_firmware_nowait(THIS_MODULE, true, code, dev, +- GFP_KERNEL, fwctx, +- brcmf_fw_request_code_done); +-} + +-int brcmf_fw_get_firmwares(struct device *dev, u16 flags, +- const char *code, const char *nvram, +- void (*fw_cb)(struct device *dev, int err, +- const struct firmware *fw, +- void *nvram_image, u32 nvram_len)) +-{ +- return brcmf_fw_get_firmwares_pcie(dev, flags, code, nvram, fw_cb, 0, +- 0); ++ brcmf_fw_request_next_item(fwctx, true); ++ return 0; + } + + static void brcmf_fw_get_full_name(char fw_name[BRCMF_FW_NAME_LEN], +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h +@@ -16,10 +16,7 @@ + #ifndef BRCMFMAC_FIRMWARE_H + #define BRCMFMAC_FIRMWARE_H + +-#define BRCMF_FW_REQUEST 0x000F +-#define BRCMF_FW_REQUEST_NVRAM 0x0001 +-#define BRCMF_FW_REQ_FLAGS 0x00F0 +-#define BRCMF_FW_REQ_NV_OPTIONAL 0x0010 ++#define BRCMF_FW_REQF_OPTIONAL 0x0001 + + #define BRCMF_FW_NAME_LEN 320 + +@@ -54,21 +51,39 @@ int brcmf_fw_map_chip_to_name(u32 chip, + u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], + char nvram_name[BRCMF_FW_NAME_LEN]); + void brcmf_fw_nvram_free(void *nvram); ++ ++enum brcmf_fw_type { ++ BRCMF_FW_TYPE_BINARY, ++ BRCMF_FW_TYPE_NVRAM ++}; ++ ++struct brcmf_fw_item { ++ const char *path; ++ enum brcmf_fw_type type; ++ u16 flags; ++ union { ++ const struct firmware *binary; ++ struct { ++ void *data; ++ u32 len; ++ } nv_data; ++ }; ++}; ++ ++struct brcmf_fw_request { ++ u16 domain_nr; ++ u16 bus_nr; ++ u32 n_items; ++ struct brcmf_fw_item items[0]; ++}; ++ + /* + * Request firmware(s) asynchronously. When the asynchronous request + * fails it will not use the callback, but call device_release_driver() + * instead which will call the driver .remove() callback. + */ +-int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, +- const char *code, const char *nvram, +- void (*fw_cb)(struct device *dev, int err, +- const struct firmware *fw, +- void *nvram_image, u32 nvram_len), +- u16 domain_nr, u16 bus_nr); +-int brcmf_fw_get_firmwares(struct device *dev, u16 flags, +- const char *code, const char *nvram, ++int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, + void (*fw_cb)(struct device *dev, int err, +- const struct firmware *fw, +- void *nvram_image, u32 nvram_len)); ++ struct brcmf_fw_request *req)); + + #endif /* BRCMFMAC_FIRMWARE_H */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1651,15 +1651,19 @@ static const struct brcmf_buscore_ops br + .write32 = brcmf_pcie_buscore_write32, + }; + ++#define BRCMF_PCIE_FW_CODE 0 ++#define BRCMF_PCIE_FW_NVRAM 1 ++ + static void brcmf_pcie_setup(struct device *dev, int ret, +- const struct firmware *fw, +- void *nvram, u32 nvram_len) ++ struct brcmf_fw_request *fwreq) + { ++ const struct firmware *fw; ++ void *nvram; + struct brcmf_bus *bus; + struct brcmf_pciedev *pcie_bus_dev; + struct brcmf_pciedev_info *devinfo; + struct brcmf_commonring **flowrings; +- u32 i; ++ u32 i, nvram_len; + + /* check firmware loading result */ + if (ret) +@@ -1670,6 +1674,11 @@ static void brcmf_pcie_setup(struct devi + devinfo = pcie_bus_dev->devinfo; + brcmf_pcie_attach(devinfo); + ++ fw = fwreq->items[BRCMF_PCIE_FW_CODE].binary; ++ nvram = fwreq->items[BRCMF_PCIE_FW_NVRAM].nv_data.data; ++ nvram_len = fwreq->items[BRCMF_PCIE_FW_NVRAM].nv_data.len; ++ kfree(fwreq); ++ + /* Some of the firmwares have the size of the memory of the device + * defined inside the firmware. This is because part of the memory in + * the device is shared and the devision is determined by FW. Parse +@@ -1730,6 +1739,7 @@ static int + brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) + { + int ret; ++ struct brcmf_fw_request *fwreq; + struct brcmf_pciedev_info *devinfo; + struct brcmf_pciedev *pcie_bus_dev; + struct brcmf_bus *bus; +@@ -1800,12 +1810,26 @@ brcmf_pcie_probe(struct pci_dev *pdev, c + if (ret) + goto fail_bus; + +- ret = brcmf_fw_get_firmwares_pcie(bus->dev, BRCMF_FW_REQUEST_NVRAM | +- BRCMF_FW_REQ_NV_OPTIONAL, +- devinfo->fw_name, devinfo->nvram_name, +- brcmf_pcie_setup, domain_nr, bus_nr); ++ fwreq = kzalloc(sizeof(*fwreq) + 2 * sizeof(struct brcmf_fw_item), ++ GFP_KERNEL); ++ if (!fwreq) { ++ ret = -ENOMEM; ++ goto fail_bus; ++ } ++ ++ fwreq->items[BRCMF_PCIE_FW_CODE].path = devinfo->fw_name; ++ fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; ++ fwreq->items[BRCMF_PCIE_FW_NVRAM].path = devinfo->nvram_name; ++ fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; ++ fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; ++ fwreq->n_items = 2; ++ fwreq->domain_nr = domain_nr; ++ fwreq->bus_nr = bus_nr; ++ ret = brcmf_fw_get_firmwares(bus->dev, fwreq, brcmf_pcie_setup); + if (ret == 0) + return 0; ++ ++ kfree(fwreq); + fail_bus: + kfree(bus->msgbuf); + kfree(bus); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4031,14 +4031,19 @@ static const struct brcmf_bus_ops brcmf_ + .get_fwname = brcmf_sdio_get_fwname, + }; + ++#define BRCMF_SDIO_FW_CODE 0 ++#define BRCMF_SDIO_FW_NVRAM 1 ++ + static void brcmf_sdio_firmware_callback(struct device *dev, int err, +- const struct firmware *code, +- void *nvram, u32 nvram_len) ++ struct brcmf_fw_request *fwreq) + { + struct brcmf_bus *bus_if = dev_get_drvdata(dev); + struct brcmf_sdio_dev *sdiod = bus_if->bus_priv.sdio; + struct brcmf_sdio *bus = sdiod->bus; + struct brcmf_core *core = bus->sdio_core; ++ const struct firmware *code; ++ void *nvram; ++ u32 nvram_len; + u8 saveclk; + + brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); +@@ -4046,6 +4051,11 @@ static void brcmf_sdio_firmware_callback + if (err) + goto fail; + ++ code = fwreq->items[BRCMF_SDIO_FW_CODE].binary; ++ nvram = fwreq->items[BRCMF_SDIO_FW_NVRAM].nv_data.data; ++ nvram_len = fwreq->items[BRCMF_SDIO_FW_NVRAM].nv_data.len; ++ kfree(fwreq); ++ + /* try to download image and nvram to the dongle */ + bus->alp_only = true; + err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len); +@@ -4150,6 +4160,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + int ret; + struct brcmf_sdio *bus; + struct workqueue_struct *wq; ++ struct brcmf_fw_request *fwreq; + + brcmf_dbg(TRACE, "Enter\n"); + +@@ -4240,11 +4251,24 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + if (ret) + goto fail; + +- ret = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM, +- sdiodev->fw_name, sdiodev->nvram_name, ++ fwreq = kzalloc(sizeof(fwreq) + 2 * sizeof(struct brcmf_fw_item), ++ GFP_KERNEL); ++ if (!fwreq) { ++ ret = -ENOMEM; ++ goto fail; ++ } ++ ++ fwreq->items[BRCMF_SDIO_FW_CODE].path = sdiodev->fw_name; ++ fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; ++ fwreq->items[BRCMF_SDIO_FW_NVRAM].path = sdiodev->nvram_name; ++ fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; ++ fwreq->n_items = 2; ++ ++ ret = brcmf_fw_get_firmwares(sdiodev->dev, fwreq, + brcmf_sdio_firmware_callback); + if (ret != 0) { + brcmf_err("async firmware request failed: %d\n", ret); ++ kfree(fwreq); + goto fail; + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1155,18 +1155,23 @@ static const struct brcmf_bus_ops brcmf_ + .get_fwname = brcmf_usb_get_fwname, + }; + ++#define BRCMF_USB_FW_CODE 0 ++ + static void brcmf_usb_probe_phase2(struct device *dev, int ret, +- const struct firmware *fw, +- void *nvram, u32 nvlen) ++ struct brcmf_fw_request *fwreq) + { + struct brcmf_bus *bus = dev_get_drvdata(dev); + struct brcmf_usbdev_info *devinfo = bus->bus_priv.usb->devinfo; ++ const struct firmware *fw; + + if (ret) + goto error; + + brcmf_dbg(USB, "Start fw downloading\n"); + ++ fw = fwreq->items[BRCMF_USB_FW_CODE].binary; ++ kfree(fwreq); ++ + ret = check_file(fw->data); + if (ret < 0) { + brcmf_err("invalid firmware\n"); +@@ -1200,6 +1205,7 @@ static int brcmf_usb_probe_cb(struct brc + struct brcmf_bus *bus = NULL; + struct brcmf_usbdev *bus_pub = NULL; + struct device *dev = devinfo->dev; ++ struct brcmf_fw_request *fwreq; + int ret; + + brcmf_dbg(USB, "Enter\n"); +@@ -1250,11 +1256,22 @@ static int brcmf_usb_probe_cb(struct brc + if (ret) + goto fail; + ++ fwreq = kzalloc(sizeof(*fwreq) + sizeof(struct brcmf_fw_item), ++ GFP_KERNEL); ++ if (!fwreq) { ++ ret = -ENOMEM; ++ goto fail; ++ } ++ ++ fwreq->items[BRCMF_USB_FW_CODE].path = devinfo->fw_name; ++ fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; ++ fwreq->n_items = 1; ++ + /* request firmware here */ +- ret = brcmf_fw_get_firmwares(dev, 0, devinfo->fw_name, NULL, +- brcmf_usb_probe_phase2); ++ ret = brcmf_fw_get_firmwares(dev, fwreq, brcmf_usb_probe_phase2); + if (ret) { + brcmf_err("firmware request failed: %d\n", ret); ++ kfree(fwreq); + goto fail; + } + +@@ -1447,11 +1464,25 @@ static int brcmf_usb_reset_resume(struct + { + struct usb_device *usb = interface_to_usbdev(intf); + struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); ++ struct brcmf_fw_request *fwreq; ++ int ret; + + brcmf_dbg(USB, "Enter\n"); + +- return brcmf_fw_get_firmwares(&usb->dev, 0, devinfo->fw_name, NULL, +- brcmf_usb_probe_phase2); ++ fwreq = kzalloc(sizeof(*fwreq) + sizeof(struct brcmf_fw_item), ++ GFP_KERNEL); ++ if (!fwreq) ++ return -ENOMEM; ++ ++ fwreq->items[BRCMF_USB_FW_CODE].path = devinfo->fw_name; ++ fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; ++ fwreq->n_items = 1; ++ ++ ret = brcmf_fw_get_firmwares(&usb->dev, fwreq, brcmf_usb_probe_phase2); ++ if (ret < 0) ++ kfree(fwreq); ++ ++ return ret; + } + + #define BRCMF_USB_DEVICE(dev_id) \ diff --git a/package/kernel/mac80211/patches/327-v4.17-0008-brcmfmac-introduce-brcmf_fw_alloc_request-function.patch b/package/kernel/mac80211/patches/327-v4.17-0008-brcmfmac-introduce-brcmf_fw_alloc_request-function.patch new file mode 100644 index 000000000..408154ef0 --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0008-brcmfmac-introduce-brcmf_fw_alloc_request-function.patch @@ -0,0 +1,328 @@ +From 2baa3aaee27f137b8db9a9224d0fe9b281d28e34 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:27 +0100 +Subject: [PATCH] brcmfmac: introduce brcmf_fw_alloc_request() function + +The function brcmf_fw_alloc_request() takes a list of required files +and allocated the struct brcmf_fw_request instance accordingly. The +request can be modified by the caller before being passed to the +brcmf_fw_request_firmwares() function. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 58 ++++++++++++++++++++++ + .../broadcom/brcm80211/brcmfmac/firmware.h | 11 ++++ + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 58 ++++++++++++---------- + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 38 ++++++++------ + .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 42 +++++++++------- + 5 files changed, 147 insertions(+), 60 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -688,3 +688,61 @@ int brcmf_fw_map_chip_to_name(u32 chip, + return 0; + } + ++struct brcmf_fw_request * ++brcmf_fw_alloc_request(u32 chip, u32 chiprev, ++ struct brcmf_firmware_mapping mapping_table[], ++ u32 table_size, struct brcmf_fw_name *fwnames, ++ u32 n_fwnames) ++{ ++ struct brcmf_fw_request *fwreq; ++ char chipname[12]; ++ const char *mp_path; ++ u32 i, j; ++ char end; ++ size_t reqsz; ++ ++ for (i = 0; i < table_size; i++) { ++ if (mapping_table[i].chipid == chip && ++ mapping_table[i].revmask & BIT(chiprev)) ++ break; ++ } ++ ++ if (i == table_size) { ++ brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev); ++ return NULL; ++ } ++ ++ reqsz = sizeof(*fwreq) + n_fwnames * sizeof(struct brcmf_fw_item); ++ fwreq = kzalloc(reqsz, GFP_KERNEL); ++ if (!fwreq) ++ return NULL; ++ ++ brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname)); ++ ++ brcmf_info("using %s for chip %s\n", ++ mapping_table[i].fw_base, chipname); ++ ++ mp_path = brcmf_mp_global.firmware_path; ++ end = mp_path[strlen(mp_path) - 1]; ++ fwreq->n_items = n_fwnames; ++ ++ for (j = 0; j < n_fwnames; j++) { ++ fwreq->items[j].path = fwnames[j].path; ++ /* check if firmware path is provided by module parameter */ ++ if (brcmf_mp_global.firmware_path[0] != '\0') { ++ strlcpy(fwnames[j].path, mp_path, ++ BRCMF_FW_NAME_LEN); ++ ++ if (end != '/') { ++ strlcat(fwnames[j].path, "/", ++ BRCMF_FW_NAME_LEN); ++ } ++ } ++ brcmf_fw_get_full_name(fwnames[j].path, ++ mapping_table[i].fw_base, ++ fwnames[j].extension); ++ fwreq->items[j].path = fwnames[j].path; ++ } ++ ++ return fwreq; ++} +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h +@@ -77,6 +77,17 @@ struct brcmf_fw_request { + struct brcmf_fw_item items[0]; + }; + ++struct brcmf_fw_name { ++ const char *extension; ++ char *path; ++}; ++ ++struct brcmf_fw_request * ++brcmf_fw_alloc_request(u32 chip, u32 chiprev, ++ struct brcmf_firmware_mapping mapping_table[], ++ u32 table_size, struct brcmf_fw_name *fwnames, ++ u32 n_fwnames); ++ + /* + * Request firmware(s) asynchronously. When the asynchronous request + * fails it will not use the callback, but call device_release_driver() +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1735,6 +1735,31 @@ fail: + device_release_driver(dev); + } + ++static struct brcmf_fw_request * ++brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) ++{ ++ struct brcmf_fw_request *fwreq; ++ struct brcmf_fw_name fwnames[] = { ++ { ".bin", devinfo->fw_name }, ++ { ".txt", devinfo->nvram_name }, ++ }; ++ ++ fwreq = brcmf_fw_alloc_request(devinfo->ci->chip, devinfo->ci->chiprev, ++ brcmf_pcie_fwnames, ++ ARRAY_SIZE(brcmf_pcie_fwnames), ++ fwnames, ARRAY_SIZE(fwnames)); ++ if (!fwreq) ++ return NULL; ++ ++ fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; ++ fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; ++ fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; ++ fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus); ++ fwreq->bus_nr = devinfo->pdev->bus->number; ++ ++ return fwreq; ++} ++ + static int + brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) + { +@@ -1743,13 +1768,8 @@ brcmf_pcie_probe(struct pci_dev *pdev, c + struct brcmf_pciedev_info *devinfo; + struct brcmf_pciedev *pcie_bus_dev; + struct brcmf_bus *bus; +- u16 domain_nr; +- u16 bus_nr; + +- domain_nr = pci_domain_nr(pdev->bus) + 1; +- bus_nr = pdev->bus->number; +- brcmf_dbg(PCIE, "Enter %x:%x (%d/%d)\n", pdev->vendor, pdev->device, +- domain_nr, bus_nr); ++ brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device); + + ret = -ENOMEM; + devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL); +@@ -1803,33 +1823,19 @@ brcmf_pcie_probe(struct pci_dev *pdev, c + bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot); + dev_set_drvdata(&pdev->dev, bus); + +- ret = brcmf_fw_map_chip_to_name(devinfo->ci->chip, devinfo->ci->chiprev, +- brcmf_pcie_fwnames, +- ARRAY_SIZE(brcmf_pcie_fwnames), +- devinfo->fw_name, devinfo->nvram_name); +- if (ret) +- goto fail_bus; +- +- fwreq = kzalloc(sizeof(*fwreq) + 2 * sizeof(struct brcmf_fw_item), +- GFP_KERNEL); ++ fwreq = brcmf_pcie_prepare_fw_request(devinfo); + if (!fwreq) { + ret = -ENOMEM; + goto fail_bus; + } + +- fwreq->items[BRCMF_PCIE_FW_CODE].path = devinfo->fw_name; +- fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; +- fwreq->items[BRCMF_PCIE_FW_NVRAM].path = devinfo->nvram_name; +- fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; +- fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; +- fwreq->n_items = 2; +- fwreq->domain_nr = domain_nr; +- fwreq->bus_nr = bus_nr; + ret = brcmf_fw_get_firmwares(bus->dev, fwreq, brcmf_pcie_setup); +- if (ret == 0) +- return 0; ++ if (ret < 0) { ++ kfree(fwreq); ++ goto fail_bus; ++ } ++ return 0; + +- kfree(fwreq); + fail_bus: + kfree(bus->msgbuf); + kfree(bus); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4155,6 +4155,28 @@ fail: + device_release_driver(dev); + } + ++static struct brcmf_fw_request * ++brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) ++{ ++ struct brcmf_fw_request *fwreq; ++ struct brcmf_fw_name fwnames[] = { ++ { ".bin", bus->sdiodev->fw_name }, ++ { ".txt", bus->sdiodev->nvram_name }, ++ }; ++ ++ fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev, ++ brcmf_sdio_fwnames, ++ ARRAY_SIZE(brcmf_sdio_fwnames), ++ fwnames, ARRAY_SIZE(fwnames)); ++ if (!fwreq) ++ return NULL; ++ ++ fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; ++ fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; ++ ++ return fwreq; ++} ++ + struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) + { + int ret; +@@ -4244,26 +4266,12 @@ struct brcmf_sdio *brcmf_sdio_probe(stru + + brcmf_dbg(INFO, "completed!!\n"); + +- ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev, +- brcmf_sdio_fwnames, +- ARRAY_SIZE(brcmf_sdio_fwnames), +- sdiodev->fw_name, sdiodev->nvram_name); +- if (ret) +- goto fail; +- +- fwreq = kzalloc(sizeof(fwreq) + 2 * sizeof(struct brcmf_fw_item), +- GFP_KERNEL); ++ fwreq = brcmf_sdio_prepare_fw_request(bus); + if (!fwreq) { + ret = -ENOMEM; + goto fail; + } + +- fwreq->items[BRCMF_SDIO_FW_CODE].path = sdiodev->fw_name; +- fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; +- fwreq->items[BRCMF_SDIO_FW_NVRAM].path = sdiodev->nvram_name; +- fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; +- fwreq->n_items = 2; +- + ret = brcmf_fw_get_firmwares(sdiodev->dev, fwreq, + brcmf_sdio_firmware_callback); + if (ret != 0) { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1200,6 +1200,27 @@ error: + device_release_driver(dev); + } + ++static struct brcmf_fw_request * ++brcmf_usb_prepare_fw_request(struct brcmf_usbdev_info *devinfo) ++{ ++ struct brcmf_fw_request *fwreq; ++ struct brcmf_fw_name fwnames[] = { ++ { ".bin", devinfo->fw_name }, ++ }; ++ ++ fwreq = brcmf_fw_alloc_request(devinfo->bus_pub.devid, ++ devinfo->bus_pub.chiprev, ++ brcmf_usb_fwnames, ++ ARRAY_SIZE(brcmf_usb_fwnames), ++ fwnames, ARRAY_SIZE(fwnames)); ++ if (!fwreq) ++ return NULL; ++ ++ fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; ++ ++ return fwreq; ++} ++ + static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) + { + struct brcmf_bus *bus = NULL; +@@ -1249,24 +1270,12 @@ static int brcmf_usb_probe_cb(struct brc + bus->chip = bus_pub->devid; + bus->chiprev = bus_pub->chiprev; + +- ret = brcmf_fw_map_chip_to_name(bus_pub->devid, bus_pub->chiprev, +- brcmf_usb_fwnames, +- ARRAY_SIZE(brcmf_usb_fwnames), +- devinfo->fw_name, NULL); +- if (ret) +- goto fail; +- +- fwreq = kzalloc(sizeof(*fwreq) + sizeof(struct brcmf_fw_item), +- GFP_KERNEL); ++ fwreq = brcmf_usb_prepare_fw_request(devinfo); + if (!fwreq) { + ret = -ENOMEM; + goto fail; + } + +- fwreq->items[BRCMF_USB_FW_CODE].path = devinfo->fw_name; +- fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; +- fwreq->n_items = 1; +- + /* request firmware here */ + ret = brcmf_fw_get_firmwares(dev, fwreq, brcmf_usb_probe_phase2); + if (ret) { +@@ -1469,15 +1478,10 @@ static int brcmf_usb_reset_resume(struct + + brcmf_dbg(USB, "Enter\n"); + +- fwreq = kzalloc(sizeof(*fwreq) + sizeof(struct brcmf_fw_item), +- GFP_KERNEL); ++ fwreq = brcmf_usb_prepare_fw_request(devinfo); + if (!fwreq) + return -ENOMEM; + +- fwreq->items[BRCMF_USB_FW_CODE].path = devinfo->fw_name; +- fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; +- fwreq->n_items = 1; +- + ret = brcmf_fw_get_firmwares(&usb->dev, fwreq, brcmf_usb_probe_phase2); + if (ret < 0) + kfree(fwreq); diff --git a/package/kernel/mac80211/patches/327-v4.17-0009-brcmfmac-add-extension-to-.get_fwname-callbacks.patch b/package/kernel/mac80211/patches/327-v4.17-0009-brcmfmac-add-extension-to-.get_fwname-callbacks.patch new file mode 100644 index 000000000..391229a86 --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0009-brcmfmac-add-extension-to-.get_fwname-callbacks.patch @@ -0,0 +1,231 @@ +From bf7a7b37f6ef5090a2bae7e7ae23cd26b741cca4 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:28 +0100 +Subject: [PATCH] brcmfmac: add extension to .get_fwname() callbacks + +This changes the bus layer api by having the caller provide an +extension. With this the callback can use brcmf_fw_alloc_request() +to get the needed firmware name. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 6 +-- + .../wireless/broadcom/brcm80211/brcmfmac/common.c | 43 +++------------------- + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 27 +++++++------- + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 26 +++++++------ + .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 27 ++++++++------ + 5 files changed, 51 insertions(+), 78 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -88,7 +88,7 @@ struct brcmf_bus_ops { + void (*wowl_config)(struct device *dev, bool enabled); + size_t (*get_ramsize)(struct device *dev); + int (*get_memdump)(struct device *dev, void *data, size_t len); +- int (*get_fwname)(struct device *dev, uint chip, uint chiprev, ++ int (*get_fwname)(struct device *dev, const char *ext, + unsigned char *fw_name); + }; + +@@ -228,10 +228,10 @@ int brcmf_bus_get_memdump(struct brcmf_b + } + + static inline +-int brcmf_bus_get_fwname(struct brcmf_bus *bus, uint chip, uint chiprev, ++int brcmf_bus_get_fwname(struct brcmf_bus *bus, const char *ext, + unsigned char *fw_name) + { +- return bus->ops->get_fwname(bus->dev, chip, chiprev, fw_name); ++ return bus->ops->get_fwname(bus->dev, ext, fw_name); + } + + /* +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -129,42 +129,9 @@ static int brcmf_c_download(struct brcmf + return err; + } + +-static int brcmf_c_get_clm_name(struct brcmf_if *ifp, u8 *clm_name) +-{ +- struct brcmf_bus *bus = ifp->drvr->bus_if; +- u8 fw_name[BRCMF_FW_NAME_LEN]; +- u8 *ptr; +- size_t len; +- s32 err; +- +- memset(fw_name, 0, BRCMF_FW_NAME_LEN); +- err = brcmf_bus_get_fwname(bus, bus->chip, bus->chiprev, fw_name); +- if (err) { +- brcmf_err("get firmware name failed (%d)\n", err); +- goto done; +- } +- +- /* generate CLM blob file name */ +- ptr = strrchr(fw_name, '.'); +- if (!ptr) { +- err = -ENOENT; +- goto done; +- } +- +- len = ptr - fw_name + 1; +- if (len + strlen(".clm_blob") > BRCMF_FW_NAME_LEN) { +- err = -E2BIG; +- } else { +- strlcpy(clm_name, fw_name, len); +- strlcat(clm_name, ".clm_blob", BRCMF_FW_NAME_LEN); +- } +-done: +- return err; +-} +- + static int brcmf_c_process_clm_blob(struct brcmf_if *ifp) + { +- struct device *dev = ifp->drvr->bus_if->dev; ++ struct brcmf_bus *bus = ifp->drvr->bus_if; + struct brcmf_dload_data_le *chunk_buf; + const struct firmware *clm = NULL; + u8 clm_name[BRCMF_FW_NAME_LEN]; +@@ -177,16 +144,16 @@ static int brcmf_c_process_clm_blob(stru + + brcmf_dbg(TRACE, "Enter\n"); + +- memset(clm_name, 0, BRCMF_FW_NAME_LEN); +- err = brcmf_c_get_clm_name(ifp, clm_name); ++ memset(clm_name, 0, sizeof(clm_name)); ++ err = brcmf_bus_get_fwname(bus, ".clm_blob", clm_name); + if (err) { + brcmf_err("get CLM blob file name failed (%d)\n", err); + return err; + } + +- err = request_firmware(&clm, clm_name, dev); ++ err = request_firmware(&clm, clm_name, bus->dev); + if (err) { +- brcmf_info("no clm_blob available(err=%d), device may have limited channels available\n", ++ brcmf_info("no clm_blob available (err=%d), device may have limited channels available\n", + err); + return 0; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1350,23 +1350,24 @@ static int brcmf_pcie_get_memdump(struct + return 0; + } + +-static int brcmf_pcie_get_fwname(struct device *dev, u32 chip, u32 chiprev, +- u8 *fw_name) ++static ++int brcmf_pcie_get_fwname(struct device *dev, const char *ext, u8 *fw_name) + { + struct brcmf_bus *bus_if = dev_get_drvdata(dev); +- struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; +- struct brcmf_pciedev_info *devinfo = buspub->devinfo; +- int ret = 0; ++ struct brcmf_fw_request *fwreq; ++ struct brcmf_fw_name fwnames[] = { ++ { ext, fw_name }, ++ }; + +- if (devinfo->fw_name[0] != '\0') +- strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); +- else +- ret = brcmf_fw_map_chip_to_name(chip, chiprev, +- brcmf_pcie_fwnames, +- ARRAY_SIZE(brcmf_pcie_fwnames), +- fw_name, NULL); ++ fwreq = brcmf_fw_alloc_request(bus_if->chip, bus_if->chiprev, ++ brcmf_pcie_fwnames, ++ ARRAY_SIZE(brcmf_pcie_fwnames), ++ fwnames, ARRAY_SIZE(fwnames)); ++ if (!fwreq) ++ return -ENOMEM; + +- return ret; ++ kfree(fwreq); ++ return 0; + } + + static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4000,22 +4000,24 @@ brcmf_sdio_watchdog(unsigned long data) + } + } + +-static int brcmf_sdio_get_fwname(struct device *dev, u32 chip, u32 chiprev, +- u8 *fw_name) ++static ++int brcmf_sdio_get_fwname(struct device *dev, const char *ext, u8 *fw_name) + { + struct brcmf_bus *bus_if = dev_get_drvdata(dev); +- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; +- int ret = 0; ++ struct brcmf_fw_request *fwreq; ++ struct brcmf_fw_name fwnames[] = { ++ { ext, fw_name }, ++ }; + +- if (sdiodev->fw_name[0] != '\0') +- strlcpy(fw_name, sdiodev->fw_name, BRCMF_FW_NAME_LEN); +- else +- ret = brcmf_fw_map_chip_to_name(chip, chiprev, +- brcmf_sdio_fwnames, +- ARRAY_SIZE(brcmf_sdio_fwnames), +- fw_name, NULL); ++ fwreq = brcmf_fw_alloc_request(bus_if->chip, bus_if->chiprev, ++ brcmf_sdio_fwnames, ++ ARRAY_SIZE(brcmf_sdio_fwnames), ++ fwnames, ARRAY_SIZE(fwnames)); ++ if (!fwreq) ++ return -ENOMEM; + +- return ret; ++ kfree(fwreq); ++ return 0; + } + + static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1128,21 +1128,24 @@ static void brcmf_usb_wowl_config(struct + device_set_wakeup_enable(devinfo->dev, false); + } + +-static int brcmf_usb_get_fwname(struct device *dev, u32 chip, u32 chiprev, +- u8 *fw_name) ++static ++int brcmf_usb_get_fwname(struct device *dev, const char *ext, u8 *fw_name) + { +- struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); +- int ret = 0; ++ struct brcmf_bus *bus = dev_get_drvdata(dev); ++ struct brcmf_fw_request *fwreq; ++ struct brcmf_fw_name fwnames[] = { ++ { ext, fw_name }, ++ }; + +- if (devinfo->fw_name[0] != '\0') +- strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); +- else +- ret = brcmf_fw_map_chip_to_name(chip, chiprev, +- brcmf_usb_fwnames, +- ARRAY_SIZE(brcmf_usb_fwnames), +- fw_name, NULL); ++ fwreq = brcmf_fw_alloc_request(bus->chip, bus->chiprev, ++ brcmf_usb_fwnames, ++ ARRAY_SIZE(brcmf_usb_fwnames), ++ fwnames, ARRAY_SIZE(fwnames)); ++ if (!fwreq) ++ return -ENOMEM; + +- return ret; ++ kfree(fwreq); ++ return 0; + } + + static const struct brcmf_bus_ops brcmf_usb_bus_ops = { diff --git a/package/kernel/mac80211/patches/327-v4.17-0010-brcmfmac-get-rid-of-brcmf_fw_map_chip_to_name.patch b/package/kernel/mac80211/patches/327-v4.17-0010-brcmfmac-get-rid-of-brcmf_fw_map_chip_to_name.patch new file mode 100644 index 000000000..becf7cf3f --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0010-brcmfmac-get-rid-of-brcmf_fw_map_chip_to_name.patch @@ -0,0 +1,92 @@ +From 18c2b20e276e04476a3350b4a92c1dfad725d45d Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:29 +0100 +Subject: [PATCH] brcmfmac: get rid of brcmf_fw_map_chip_to_name() + +The function is no longer used so removing it. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 53 ---------------------- + .../broadcom/brcm80211/brcmfmac/firmware.h | 4 -- + 2 files changed, 57 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -635,59 +635,6 @@ static void brcmf_fw_get_full_name(char + strlcat(fw_name, extension, BRCMF_FW_NAME_LEN); + } + +-int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, +- struct brcmf_firmware_mapping mapping_table[], +- u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], +- char nvram_name[BRCMF_FW_NAME_LEN]) +-{ +- char chipname[12]; +- u32 i; +- char end; +- +- for (i = 0; i < table_size; i++) { +- if (mapping_table[i].chipid == chip && +- mapping_table[i].revmask & BIT(chiprev)) +- break; +- } +- +- if (i == table_size) { +- brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev); +- return -ENODEV; +- } +- +- brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname)); +- +- /* check if firmware path is provided by module parameter */ +- if (brcmf_mp_global.firmware_path[0] != '\0') { +- if (fw_name) +- strlcpy(fw_name, brcmf_mp_global.firmware_path, +- BRCMF_FW_NAME_LEN); +- if (nvram_name) +- strlcpy(nvram_name, brcmf_mp_global.firmware_path, +- BRCMF_FW_NAME_LEN); +- +- end = brcmf_mp_global.firmware_path[ +- strlen(brcmf_mp_global.firmware_path) - 1]; +- if (end != '/') { +- if (fw_name) +- strlcat(fw_name, "/", BRCMF_FW_NAME_LEN); +- if (nvram_name) +- strlcat(nvram_name, "/", BRCMF_FW_NAME_LEN); +- } +- } +- +- brcmf_info("using %s for chip %s\n", +- mapping_table[i].fw_base, chipname); +- if (fw_name) +- brcmf_fw_get_full_name(fw_name, +- mapping_table[i].fw_base, ".bin"); +- if (nvram_name) +- brcmf_fw_get_full_name(nvram_name, +- mapping_table[i].fw_base, ".txt"); +- +- return 0; +-} +- + struct brcmf_fw_request * + brcmf_fw_alloc_request(u32 chip, u32 chiprev, + struct brcmf_firmware_mapping mapping_table[], +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h +@@ -46,10 +46,6 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw + #define BRCMF_FW_ENTRY(chipid, mask, name) \ + { chipid, mask, BRCM_ ## name ## _FIRMWARE_BASENAME } + +-int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, +- struct brcmf_firmware_mapping mapping_table[], +- u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], +- char nvram_name[BRCMF_FW_NAME_LEN]); + void brcmf_fw_nvram_free(void *nvram); + + enum brcmf_fw_type { diff --git a/package/kernel/mac80211/patches/327-v4.17-0011-brcmfmac-get-rid-of-brcmf_fw_get_full_name.patch b/package/kernel/mac80211/patches/327-v4.17-0011-brcmfmac-get-rid-of-brcmf_fw_get_full_name.patch new file mode 100644 index 000000000..d831f44fc --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0011-brcmfmac-get-rid-of-brcmf_fw_get_full_name.patch @@ -0,0 +1,44 @@ +From bf291b7247e53f52a4236c0b55a5df046d6177df Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:30 +0100 +Subject: [PATCH] brcmfmac: get rid of brcmf_fw_get_full_name() + +The function was pretty minimal and now it is called only from one +place so just get rid of it. + +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 14 ++++---------- + 1 file changed, 4 insertions(+), 10 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -628,13 +628,6 @@ int brcmf_fw_get_firmwares(struct device + return 0; + } + +-static void brcmf_fw_get_full_name(char fw_name[BRCMF_FW_NAME_LEN], +- const char *fw_base, const char *extension) +-{ +- strlcat(fw_name, fw_base, BRCMF_FW_NAME_LEN); +- strlcat(fw_name, extension, BRCMF_FW_NAME_LEN); +-} +- + struct brcmf_fw_request * + brcmf_fw_alloc_request(u32 chip, u32 chiprev, + struct brcmf_firmware_mapping mapping_table[], +@@ -685,9 +678,10 @@ brcmf_fw_alloc_request(u32 chip, u32 chi + BRCMF_FW_NAME_LEN); + } + } +- brcmf_fw_get_full_name(fwnames[j].path, +- mapping_table[i].fw_base, +- fwnames[j].extension); ++ strlcat(fwnames[j].path, mapping_table[i].fw_base, ++ BRCMF_FW_NAME_LEN); ++ strlcat(fwnames[j].path, fwnames[j].extension, ++ BRCMF_FW_NAME_LEN); + fwreq->items[j].path = fwnames[j].path; + } + diff --git a/package/kernel/mac80211/patches/327-v4.17-0012-brcmfmac-add-kerneldoc-for-struct-brcmf_bus-msgbuf.patch b/package/kernel/mac80211/patches/327-v4.17-0012-brcmfmac-add-kerneldoc-for-struct-brcmf_bus-msgbuf.patch new file mode 100644 index 000000000..1c9c99599 --- /dev/null +++ b/package/kernel/mac80211/patches/327-v4.17-0012-brcmfmac-add-kerneldoc-for-struct-brcmf_bus-msgbuf.patch @@ -0,0 +1,23 @@ +From 48eaee3f272a5bfe6986d07c51f6975d3c2f74d1 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 22 Mar 2018 21:28:31 +0100 +Subject: [PATCH] brcmfmac: add kerneldoc for struct brcmf_bus::msgbuf + +This field did not have kerneldoc description so adding it now. + +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -140,6 +140,7 @@ struct brcmf_bus_stats { + * @always_use_fws_queue: bus wants use queue also when fwsignal is inactive. + * @wowl_supported: is wowl supported by bus driver. + * @chiprev: revision of the dongle chip. ++ * @msgbuf: msgbuf protocol parameters provided by bus layer. + */ + struct brcmf_bus { + union { diff --git a/package/kernel/mac80211/patches/328-v4.17-0001-brcmfmac-fix-firmware-request-processing-if-nvram-lo.patch b/package/kernel/mac80211/patches/328-v4.17-0001-brcmfmac-fix-firmware-request-processing-if-nvram-lo.patch new file mode 100644 index 000000000..cd2279dd6 --- /dev/null +++ b/package/kernel/mac80211/patches/328-v4.17-0001-brcmfmac-fix-firmware-request-processing-if-nvram-lo.patch @@ -0,0 +1,81 @@ +From 0b5c0305e57ca940713bcb2b202fd2b412c62f31 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Tue, 3 Apr 2018 10:18:15 +0200 +Subject: [PATCH] brcmfmac: fix firmware request processing if nvram load fails + +When nvram loading fails a double free occurred. Fix this and reorg the +code a little. + +Fixes: d09ae51a4b67 ("brcmfmac: pass struct in brcmf_fw_get_firmwares()") +Reported-by: Dan Carpenter +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 36 ++++++++++++---------- + 1 file changed, 20 insertions(+), 16 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -459,7 +459,7 @@ static void brcmf_fw_free_request(struct + kfree(req); + } + +-static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) ++static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) + { + struct brcmf_fw *fwctx = ctx; + struct brcmf_fw_item *cur; +@@ -498,13 +498,10 @@ static void brcmf_fw_request_nvram_done( + brcmf_dbg(TRACE, "nvram %p len %d\n", nvram, nvram_length); + cur->nv_data.data = nvram; + cur->nv_data.len = nvram_length; +- return; ++ return 0; + + fail: +- brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); +- fwctx->done(fwctx->dev, -ENOENT, NULL); +- brcmf_fw_free_request(fwctx->req); +- kfree(fwctx); ++ return -ENOENT; + } + + static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async) +@@ -553,20 +550,27 @@ static void brcmf_fw_request_done(const + brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path, + fw ? "" : "not "); + +- if (fw) { +- if (cur->type == BRCMF_FW_TYPE_BINARY) +- cur->binary = fw; +- else if (cur->type == BRCMF_FW_TYPE_NVRAM) +- brcmf_fw_request_nvram_done(fw, fwctx); +- else +- release_firmware(fw); +- } else if (cur->type == BRCMF_FW_TYPE_NVRAM) { +- brcmf_fw_request_nvram_done(NULL, fwctx); +- } else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) { ++ if (!fw) + ret = -ENOENT; ++ ++ switch (cur->type) { ++ case BRCMF_FW_TYPE_NVRAM: ++ ret = brcmf_fw_request_nvram_done(fw, fwctx); ++ break; ++ case BRCMF_FW_TYPE_BINARY: ++ cur->binary = fw; ++ break; ++ default: ++ /* something fishy here so bail out early */ ++ brcmf_err("unknown fw type: %d\n", cur->type); ++ release_firmware(fw); ++ ret = -EINVAL; + goto fail; + } + ++ if (ret < 0 && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) ++ goto fail; ++ + do { + if (++fwctx->curpos == fwctx->req->n_items) { + ret = 0; diff --git a/package/kernel/mac80211/patches/329-v4.18-0001-brcmfmac-add-support-for-BCM4366E-chipset.patch b/package/kernel/mac80211/patches/329-v4.18-0001-brcmfmac-add-support-for-BCM4366E-chipset.patch new file mode 100644 index 000000000..e31d69826 --- /dev/null +++ b/package/kernel/mac80211/patches/329-v4.18-0001-brcmfmac-add-support-for-BCM4366E-chipset.patch @@ -0,0 +1,48 @@ +From 1f589e2510d5df1192dca7c089103a2cbd028101 Mon Sep 17 00:00:00 2001 +From: Dan Haab +Date: Tue, 3 Apr 2018 10:21:56 +0200 +Subject: [PATCH] brcmfmac: add support for BCM4366E chipset + +BCM4366E is a wireless chipset with a BCM43664 ChipCommon. It's +supported by the same firmware as 4366c0. + +Signed-off-by: Dan Haab +[arend: rebase patch and remove unnecessary definition] +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + + drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 + + 3 files changed, 3 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -689,6 +689,7 @@ static u32 brcmf_chip_tcm_rambase(struct + case BRCM_CC_43525_CHIP_ID: + case BRCM_CC_4365_CHIP_ID: + case BRCM_CC_4366_CHIP_ID: ++ case BRCM_CC_43664_CHIP_ID: + return 0x200000; + case CY_CC_4373_CHIP_ID: + return 0x160000; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -75,6 +75,7 @@ static struct brcmf_firmware_mapping brc + BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFF0, 4365C), + BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B), + BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C), ++ BRCMF_FW_ENTRY(BRCM_CC_43664_CHIP_ID, 0xFFFFFFF0, 4366C), + BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), + }; + +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -57,6 +57,7 @@ + #define BRCM_CC_43602_CHIP_ID 43602 + #define BRCM_CC_4365_CHIP_ID 0x4365 + #define BRCM_CC_4366_CHIP_ID 0x4366 ++#define BRCM_CC_43664_CHIP_ID 43664 + #define BRCM_CC_4371_CHIP_ID 0x4371 + #define CY_CC_4373_CHIP_ID 0x4373 + diff --git a/package/kernel/mac80211/patches/330-v4.18-0001-brcmfmac-check-p2pdev-mac-address-uniqueness.patch b/package/kernel/mac80211/patches/330-v4.18-0001-brcmfmac-check-p2pdev-mac-address-uniqueness.patch new file mode 100644 index 000000000..909000cc5 --- /dev/null +++ b/package/kernel/mac80211/patches/330-v4.18-0001-brcmfmac-check-p2pdev-mac-address-uniqueness.patch @@ -0,0 +1,34 @@ +From cb746e47837ad0f35c8ae28e9aacc8eb07916d2a Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 26 Apr 2018 12:16:47 +0200 +Subject: [PATCH] brcmfmac: check p2pdev mac address uniqueness + +The mac address for p2pdev must be different from the primary interface +due to firmware requirement. Add an explicit check for this requirement +if user-space provides a mac address. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -2073,6 +2073,13 @@ static struct wireless_dev *brcmf_p2p_cr + } + + pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; ++ ++ /* firmware requires unique mac address for p2pdev interface */ ++ if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) { ++ brcmf_err("discovery vif must be different from primary interface\n"); ++ return ERR_PTR(-EINVAL); ++ } ++ + brcmf_p2p_generate_bss_mac(p2p, addr); + brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr); + diff --git a/package/kernel/mac80211/patches/330-v4.18-0002-brcmfmac-reports-boottime_ns-while-informing-bss.patch b/package/kernel/mac80211/patches/330-v4.18-0002-brcmfmac-reports-boottime_ns-while-informing-bss.patch new file mode 100644 index 000000000..4f59507ca --- /dev/null +++ b/package/kernel/mac80211/patches/330-v4.18-0002-brcmfmac-reports-boottime_ns-while-informing-bss.patch @@ -0,0 +1,76 @@ +From 7742fce4c007141617dab9bcb90034b3c0fe2347 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Thu, 26 Apr 2018 12:18:35 +0200 +Subject: [PATCH] brcmfmac: reports boottime_ns while informing bss + +Provides a timestamp in bss information so user space can see when the +bss info was updated. Since tsf is not available from the dongle events +boottime is reported instead. + +Reported-by: Dmitry Shmidt +Reviewed-by: Arend van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 26 +++++++++++----------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2728,7 +2728,6 @@ static s32 brcmf_inform_single_bss(struc + struct brcmf_bss_info_le *bi) + { + struct wiphy *wiphy = cfg_to_wiphy(cfg); +- struct ieee80211_channel *notify_channel; + struct cfg80211_bss *bss; + struct ieee80211_supported_band *band; + struct brcmu_chan ch; +@@ -2738,7 +2737,7 @@ static s32 brcmf_inform_single_bss(struc + u16 notify_interval; + u8 *notify_ie; + size_t notify_ielen; +- s32 notify_signal; ++ struct cfg80211_inform_bss bss_data = { 0 }; + + if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { + brcmf_err("Bss info is larger than buffer. Discarding\n"); +@@ -2758,27 +2757,28 @@ static s32 brcmf_inform_single_bss(struc + band = wiphy->bands[NL80211_BAND_5GHZ]; + + freq = ieee80211_channel_to_frequency(channel, band->band); +- notify_channel = ieee80211_get_channel(wiphy, freq); ++ bss_data.chan = ieee80211_get_channel(wiphy, freq); ++ bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; ++ bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); + + notify_capability = le16_to_cpu(bi->capability); + notify_interval = le16_to_cpu(bi->beacon_period); + notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); + notify_ielen = le32_to_cpu(bi->ie_length); +- notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; ++ bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100; + + brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID); + brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq); + brcmf_dbg(CONN, "Capability: %X\n", notify_capability); + brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval); +- brcmf_dbg(CONN, "Signal: %d\n", notify_signal); ++ brcmf_dbg(CONN, "Signal: %d\n", bss_data.signal); + +- bss = cfg80211_inform_bss(wiphy, notify_channel, +- CFG80211_BSS_FTYPE_UNKNOWN, +- (const u8 *)bi->BSSID, +- 0, notify_capability, +- notify_interval, notify_ie, +- notify_ielen, notify_signal, +- GFP_KERNEL); ++ bss = cfg80211_inform_bss_data(wiphy, &bss_data, ++ CFG80211_BSS_FTYPE_UNKNOWN, ++ (const u8 *)bi->BSSID, ++ 0, notify_capability, ++ notify_interval, notify_ie, ++ notify_ielen, GFP_KERNEL); + + if (!bss) + return -ENOMEM; diff --git a/package/kernel/mac80211/patches/330-v4.18-0003-brcmfmac-use-nl80211_band-directly-to-get-ieee80211-.patch b/package/kernel/mac80211/patches/330-v4.18-0003-brcmfmac-use-nl80211_band-directly-to-get-ieee80211-.patch new file mode 100644 index 000000000..2d60c0d9e --- /dev/null +++ b/package/kernel/mac80211/patches/330-v4.18-0003-brcmfmac-use-nl80211_band-directly-to-get-ieee80211-.patch @@ -0,0 +1,43 @@ +From aed14219067ab96e5eeb7730e9bceed10d9be989 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Thu, 26 Apr 2018 12:16:48 +0200 +Subject: [PATCH] brcmfmac: use nl80211_band directly to get ieee80211 channel + +The enum nl80211_band used to retrieve wiphy->bands is the same as +wiphy->bands->band which is checked by wiphy_register(). So it can be used +directly as parameter of ieee80211_channel_to_frequency(). + +Reviewed-by: Arend van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2729,7 +2729,7 @@ static s32 brcmf_inform_single_bss(struc + { + struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct cfg80211_bss *bss; +- struct ieee80211_supported_band *band; ++ enum nl80211_band band; + struct brcmu_chan ch; + u16 channel; + u32 freq; +@@ -2752,11 +2752,11 @@ static s32 brcmf_inform_single_bss(struc + channel = bi->ctl_ch; + + if (channel <= CH_MAX_2G_CHANNEL) +- band = wiphy->bands[NL80211_BAND_2GHZ]; ++ band = NL80211_BAND_2GHZ; + else +- band = wiphy->bands[NL80211_BAND_5GHZ]; ++ band = NL80211_BAND_5GHZ; + +- freq = ieee80211_channel_to_frequency(channel, band->band); ++ freq = ieee80211_channel_to_frequency(channel, band); + bss_data.chan = ieee80211_get_channel(wiphy, freq); + bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; + bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); diff --git a/package/kernel/mac80211/patches/330-v4.18-0004-brcmfmac-constify-firmware-mapping-tables.patch b/package/kernel/mac80211/patches/330-v4.18-0004-brcmfmac-constify-firmware-mapping-tables.patch new file mode 100644 index 000000000..df2648374 --- /dev/null +++ b/package/kernel/mac80211/patches/330-v4.18-0004-brcmfmac-constify-firmware-mapping-tables.patch @@ -0,0 +1,76 @@ +From ff68c9f9c06d1fd437c8f90fc05ca28c47f7d85e Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Thu, 26 Apr 2018 12:16:49 +0200 +Subject: [PATCH] brcmfmac: constify firmware mapping tables + +The information in the firmware mapping does not need to be modified +so it can be static const. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -634,7 +634,7 @@ int brcmf_fw_get_firmwares(struct device + + struct brcmf_fw_request * + brcmf_fw_alloc_request(u32 chip, u32 chiprev, +- struct brcmf_firmware_mapping mapping_table[], ++ const struct brcmf_firmware_mapping mapping_table[], + u32 table_size, struct brcmf_fw_name *fwnames, + u32 n_fwnames) + { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h +@@ -80,7 +80,7 @@ struct brcmf_fw_name { + + struct brcmf_fw_request * + brcmf_fw_alloc_request(u32 chip, u32 chiprev, +- struct brcmf_firmware_mapping mapping_table[], ++ const struct brcmf_firmware_mapping mapping_table[], + u32 table_size, struct brcmf_fw_name *fwnames, + u32 n_fwnames); + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -59,7 +59,7 @@ BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie" + BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie"); + BRCMF_FW_DEF(4371, "brcmfmac4371-pcie"); + +-static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { ++static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { + BRCMF_FW_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602), + BRCMF_FW_ENTRY(BRCM_CC_43465_CHIP_ID, 0xFFFFFFF0, 4366C), + BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0x000000FF, 4350C), +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -619,7 +619,7 @@ BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); + BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); + BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); + +-static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { ++static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { + BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), + BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), + BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -52,7 +52,7 @@ BRCMF_FW_DEF(43242A, "brcmfmac43242a"); + BRCMF_FW_DEF(43569, "brcmfmac43569"); + BRCMF_FW_DEF(4373, "brcmfmac4373"); + +-static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = { ++static const struct brcmf_firmware_mapping brcmf_usb_fwnames[] = { + BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), + BRCMF_FW_ENTRY(BRCM_CC_43235_CHIP_ID, 0x00000008, 43236B), + BRCMF_FW_ENTRY(BRCM_CC_43236_CHIP_ID, 0x00000008, 43236B), diff --git a/package/kernel/mac80211/patches/330-v4.18-0005-brcmfmac-add-hostready-indication.patch b/package/kernel/mac80211/patches/330-v4.18-0005-brcmfmac-add-hostready-indication.patch new file mode 100644 index 000000000..e3d4441f7 --- /dev/null +++ b/package/kernel/mac80211/patches/330-v4.18-0005-brcmfmac-add-hostready-indication.patch @@ -0,0 +1,74 @@ +From 84ad327d18debe19b8d509059b61db445d048b02 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Thu, 26 Apr 2018 12:16:50 +0200 +Subject: [PATCH] brcmfmac: add hostready indication + +A hostready signal is introduced to inform firmware through mailbox +doorbell1 when common ring initialized or D3 exited. + +Reviewed-by: Arend van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -105,7 +105,8 @@ static const struct brcmf_firmware_mappi + #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C + #define BRCMF_PCIE_PCIE2REG_CONFIGADDR 0x120 + #define BRCMF_PCIE_PCIE2REG_CONFIGDATA 0x124 +-#define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX 0x140 ++#define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX_0 0x140 ++#define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX_1 0x144 + + #define BRCMF_PCIE2_INTA 0x01 + #define BRCMF_PCIE2_INTB 0x02 +@@ -140,6 +141,7 @@ static const struct brcmf_firmware_mappi + #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF + #define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000 + #define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000 ++#define BRCMF_PCIE_SHARED_HOSTRDY_DB1 0x10000000 + + #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000 + #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000 +@@ -782,6 +784,12 @@ static void brcmf_pcie_intr_enable(struc + BRCMF_PCIE_MB_INT_FN0_1); + } + ++static void brcmf_pcie_hostready(struct brcmf_pciedev_info *devinfo) ++{ ++ if (devinfo->shared.flags & BRCMF_PCIE_SHARED_HOSTRDY_DB1) ++ brcmf_pcie_write_reg32(devinfo, ++ BRCMF_PCIE_PCIE2REG_H2D_MAILBOX_1, 1); ++} + + static irqreturn_t brcmf_pcie_quick_check_isr(int irq, void *arg) + { +@@ -924,7 +932,7 @@ static int brcmf_pcie_ring_mb_ring_bell( + + brcmf_dbg(PCIE, "RING !\n"); + /* Any arbitrary value will do, lets use 1 */ +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1); ++ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX_0, 1); + + return 0; + } +@@ -1728,6 +1736,7 @@ static void brcmf_pcie_setup(struct devi + init_waitqueue_head(&devinfo->mbdata_resp_wait); + + brcmf_pcie_intr_enable(devinfo); ++ brcmf_pcie_hostready(devinfo); + if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0) + return; + +@@ -1950,6 +1959,7 @@ static int brcmf_pcie_pm_leave_D3(struct + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2); + brcmf_bus_change_state(bus, BRCMF_BUS_UP); + brcmf_pcie_intr_enable(devinfo); ++ brcmf_pcie_hostready(devinfo); + return 0; + } + diff --git a/package/kernel/mac80211/patches/330-v4.18-0006-brcmfmac-coarse-support-for-PCIe-shared-structure-re.patch b/package/kernel/mac80211/patches/330-v4.18-0006-brcmfmac-coarse-support-for-PCIe-shared-structure-re.patch new file mode 100644 index 000000000..8750037d8 --- /dev/null +++ b/package/kernel/mac80211/patches/330-v4.18-0006-brcmfmac-coarse-support-for-PCIe-shared-structure-re.patch @@ -0,0 +1,97 @@ +From f56324baf329bc9362a52ad77a4a1a0f3356d1bc Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Thu, 26 Apr 2018 12:16:51 +0200 +Subject: [PATCH] brcmfmac: coarse support for PCIe shared structure rev7 + +Revision 7 of PCIe dongle interface increases the item size of tx and rx +complete rings to accommodate extra payload for new feature. This patch +simply bump up the size of these two rings without adding the support +for utilizing the new space. This makes brcmfmac compatible with rev7 +firmware. + +Reviewed-by: Arend van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 6 ++++-- + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 23 ++++++++++++++++++---- + 2 files changed, 23 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h +@@ -27,8 +27,10 @@ + #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40 + #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE 32 + #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_ITEMSIZE 24 +-#define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE 16 +-#define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE 32 ++#define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE_PRE_V7 16 ++#define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE 24 ++#define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE_PRE_V7 32 ++#define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE 40 + #define BRCMF_H2D_TXFLOWRING_ITEMSIZE 48 + + struct msgbuf_buf_addr { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -136,8 +136,9 @@ static const struct brcmf_firmware_mappi + BRCMF_PCIE_MB_INT_D2H3_DB0 | \ + BRCMF_PCIE_MB_INT_D2H3_DB1) + ++#define BRCMF_PCIE_SHARED_VERSION_7 7 + #define BRCMF_PCIE_MIN_SHARED_VERSION 5 +-#define BRCMF_PCIE_MAX_SHARED_VERSION 6 ++#define BRCMF_PCIE_MAX_SHARED_VERSION BRCMF_PCIE_SHARED_VERSION_7 + #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF + #define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000 + #define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000 +@@ -318,6 +319,14 @@ static const u32 brcmf_ring_max_item[BRC + BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM + }; + ++static const u32 brcmf_ring_itemsize_pre_v7[BRCMF_NROF_COMMON_MSGRINGS] = { ++ BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE, ++ BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE, ++ BRCMF_D2H_MSGRING_CONTROL_COMPLETE_ITEMSIZE, ++ BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE_PRE_V7, ++ BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE_PRE_V7 ++}; ++ + static const u32 brcmf_ring_itemsize[BRCMF_NROF_COMMON_MSGRINGS] = { + BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE, + BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE, +@@ -1007,8 +1016,14 @@ brcmf_pcie_alloc_dma_and_ring(struct brc + struct brcmf_pcie_ringbuf *ring; + u32 size; + u32 addr; ++ const u32 *ring_itemsize_array; ++ ++ if (devinfo->shared.version < BRCMF_PCIE_SHARED_VERSION_7) ++ ring_itemsize_array = brcmf_ring_itemsize_pre_v7; ++ else ++ ring_itemsize_array = brcmf_ring_itemsize; + +- size = brcmf_ring_max_item[ring_id] * brcmf_ring_itemsize[ring_id]; ++ size = brcmf_ring_max_item[ring_id] * ring_itemsize_array[ring_id]; + dma_buf = brcmf_pcie_init_dmabuffer_for_device(devinfo, size, + tcm_ring_phys_addr + BRCMF_RING_MEM_BASE_ADDR_OFFSET, + &dma_handle); +@@ -1018,7 +1033,7 @@ brcmf_pcie_alloc_dma_and_ring(struct brc + addr = tcm_ring_phys_addr + BRCMF_RING_MAX_ITEM_OFFSET; + brcmf_pcie_write_tcm16(devinfo, addr, brcmf_ring_max_item[ring_id]); + addr = tcm_ring_phys_addr + BRCMF_RING_LEN_ITEMS_OFFSET; +- brcmf_pcie_write_tcm16(devinfo, addr, brcmf_ring_itemsize[ring_id]); ++ brcmf_pcie_write_tcm16(devinfo, addr, ring_itemsize_array[ring_id]); + + ring = kzalloc(sizeof(*ring), GFP_KERNEL); + if (!ring) { +@@ -1027,7 +1042,7 @@ brcmf_pcie_alloc_dma_and_ring(struct brc + return NULL; + } + brcmf_commonring_config(&ring->commonring, brcmf_ring_max_item[ring_id], +- brcmf_ring_itemsize[ring_id], dma_buf); ++ ring_itemsize_array[ring_id], dma_buf); + ring->dma_handle = dma_handle; + ring->devinfo = devinfo; + brcmf_commonring_register_cb(&ring->commonring, diff --git a/package/kernel/mac80211/patches/331-v4.18-0001-brcmfmac-Add-support-for-bcm43364-wireless-chipset.patch b/package/kernel/mac80211/patches/331-v4.18-0001-brcmfmac-Add-support-for-bcm43364-wireless-chipset.patch new file mode 100644 index 000000000..13f169be9 --- /dev/null +++ b/package/kernel/mac80211/patches/331-v4.18-0001-brcmfmac-Add-support-for-bcm43364-wireless-chipset.patch @@ -0,0 +1,45 @@ +From 9c4a121e82634aa000a702c98cd6f05b27d6e186 Mon Sep 17 00:00:00 2001 +From: Sean Lanigan +Date: Fri, 4 May 2018 16:48:23 +1000 +Subject: [PATCH] brcmfmac: Add support for bcm43364 wireless chipset + +Add support for the BCM43364 chipset via an SDIO interface, as used in +e.g. the Murata 1FX module. + +The BCM43364 uses the same firmware as the BCM43430 (which is already +included), the only difference is the omission of Bluetooth. + +However, the SDIO_ID for the BCM43364 is 02D0:A9A4, giving it a MODALIAS +of sdio:c00v02D0dA9A4, which doesn't get recognised and hence doesn't +load the brcmfmac module. Adding the 'A9A4' ID in the appropriate place +triggers the brcmfmac driver to load, and then correctly use the +firmware file 'brcmfmac43430-sdio.bin'. + +Signed-off-by: Sean Lanigan +Acked-by: Ulf Hansson +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 + + include/linux/mmc/sdio_ids.h | 1 + + 2 files changed, 2 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +@@ -963,6 +963,7 @@ static const struct sdio_device_id brcmf + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43340), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362), ++ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43364), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430), +--- a/include/linux/mmc/sdio_ids.h ++++ b/include/linux/mmc/sdio_ids.h +@@ -34,6 +34,7 @@ + #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 + #define SDIO_DEVICE_ID_BROADCOM_4339 0x4339 + #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 ++#define SDIO_DEVICE_ID_BROADCOM_43364 0xa9a4 + #define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6 + #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345 + #define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf diff --git a/package/kernel/mac80211/patches/332-v4.18-0001-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch b/package/kernel/mac80211/patches/332-v4.18-0001-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch new file mode 100644 index 000000000..de41e1c45 --- /dev/null +++ b/package/kernel/mac80211/patches/332-v4.18-0001-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch @@ -0,0 +1,34 @@ +From 1204aa17f3b4f63e67ac9b7c9afa9496485969c5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 10 May 2018 15:21:39 +0200 +Subject: [PATCH] brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +brcmfmac is a FullMAC driver and it implements/uses cfg80211 interface +for stations management. At the same time it doesn't receive or pass up +management frames. + +This flag indicates that authenticator doesn't have to subscribe to or +handle management frames. Some authenticators (e.g. hostapd) were +working with brcmfmac thanks to some extra assumptions. This commit +clears up the situation. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6513,6 +6513,7 @@ static int brcmf_setup_wiphy(struct wiph + + wiphy->flags |= WIPHY_FLAG_NETNS_OK | + WIPHY_FLAG_PS_ON_BY_DEFAULT | ++ WIPHY_FLAG_HAVE_AP_SME | + WIPHY_FLAG_OFFCHAN_TX | + WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_TDLS)) diff --git a/package/kernel/mac80211/patches/333-v4.18-0001-brcmfmac-fix-initialization-of-struct-cfg80211_infor.patch b/package/kernel/mac80211/patches/333-v4.18-0001-brcmfmac-fix-initialization-of-struct-cfg80211_infor.patch new file mode 100644 index 000000000..2436bb8a8 --- /dev/null +++ b/package/kernel/mac80211/patches/333-v4.18-0001-brcmfmac-fix-initialization-of-struct-cfg80211_infor.patch @@ -0,0 +1,29 @@ +From 763ece85f45a6b93268e25a0abf02922f911dab4 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Tue, 15 May 2018 11:14:44 +0200 +Subject: [PATCH] brcmfmac: fix initialization of struct cfg80211_inform_bss + variable + +This patch fixes a sparse warning "Using plain integer as NULL pointer" +about cfg80211_inform_bss structure initialization. + +Reported-by: kbuild test robot +Reviewed-by: Arend van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2737,7 +2737,7 @@ static s32 brcmf_inform_single_bss(struc + u16 notify_interval; + u8 *notify_ie; + size_t notify_ielen; +- struct cfg80211_inform_bss bss_data = { 0 }; ++ struct cfg80211_inform_bss bss_data = {}; + + if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { + brcmf_err("Bss info is larger than buffer. Discarding\n"); diff --git a/package/kernel/mac80211/patches/334-v4.18-0001-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch b/package/kernel/mac80211/patches/334-v4.18-0001-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch new file mode 100644 index 000000000..f350d1e81 --- /dev/null +++ b/package/kernel/mac80211/patches/334-v4.18-0001-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch @@ -0,0 +1,75 @@ +From 88001968245c42c26416476bf0ef960442371605 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 14 May 2018 08:48:20 +0200 +Subject: [PATCH] brcmfmac: add debugfs entry for reading firmware capabilities +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows reading all capabilities as reported by a firmware. They are +printed using native (raw) names, just like developers like it the most. +It's how firmware reports support for various features, e.g. supported +modes, supported standards, power saving details, max BSS-es. + +Access to all that info is useful for trying new firmwares, comparing +them and debugging features AKA bugs. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -165,6 +165,41 @@ static void brcmf_feat_firmware_capabili + } + } + ++/** ++ * brcmf_feat_fwcap_debugfs_read() - expose firmware capabilities to debugfs. ++ * ++ * @seq: sequence for debugfs entry. ++ * @data: raw data pointer. ++ */ ++static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private); ++ struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0); ++ char caps[MAX_CAPS_BUFFER_SIZE + 1] = { }; ++ char *tmp; ++ int err; ++ ++ err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); ++ if (err) { ++ brcmf_err("could not get firmware cap (%d)\n", err); ++ return err; ++ } ++ ++ /* Put every capability in a new line */ ++ for (tmp = caps; *tmp; tmp++) { ++ if (*tmp == ' ') ++ *tmp = '\n'; ++ } ++ ++ /* Usually there is a space at the end of capabilities string */ ++ seq_printf(seq, "%s", caps); ++ /* So make sure we don't print two line breaks */ ++ if (tmp > caps && *(tmp - 1) != '\n') ++ seq_printf(seq, "\n"); ++ ++ return 0; ++} ++ + void brcmf_feat_attach(struct brcmf_pub *drvr) + { + struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); +@@ -233,6 +268,7 @@ void brcmf_feat_attach(struct brcmf_pub + void brcmf_feat_debugfs_create(struct brcmf_pub *drvr) + { + brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read); ++ brcmf_debugfs_add_entry(drvr, "fwcap", brcmf_feat_fwcap_debugfs_read); + } + + bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id) diff --git a/package/kernel/mac80211/patches/335-v4.18-0001-brcmfmac-move-ALLFFMAC-variable-in-flowring-module.patch b/package/kernel/mac80211/patches/335-v4.18-0001-brcmfmac-move-ALLFFMAC-variable-in-flowring-module.patch new file mode 100644 index 000000000..f353a60b8 --- /dev/null +++ b/package/kernel/mac80211/patches/335-v4.18-0001-brcmfmac-move-ALLFFMAC-variable-in-flowring-module.patch @@ -0,0 +1,52 @@ +From f8793c26fe586659d6da3fa277e63961a69d314b Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Wed, 16 May 2018 14:11:58 +0200 +Subject: [PATCH] brcmfmac: move ALLFFMAC variable in flowring module + +The only user of ALLFFMAC is the flowring module so no need to +expose it in a header file. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 -- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 -- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 2 ++ + 3 files changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -36,8 +36,6 @@ MODULE_AUTHOR("Broadcom Corporation"); + MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); + MODULE_LICENSE("Dual BSD/GPL"); + +-const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +- + #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 + #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +@@ -19,8 +19,6 @@ + #include + #include "fwil_types.h" + +-extern const u8 ALLFFMAC[ETH_ALEN]; +- + #define BRCMF_FW_ALTPATH_LEN 256 + + /* Definitions for the module global and device specific settings are defined +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +@@ -46,6 +46,8 @@ static const u8 brcmf_flowring_prio2fifo + 3 + }; + ++static const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; ++ + + static bool + brcmf_flowring_is_tdls_mac(struct brcmf_flowring *flow, u8 mac[ETH_ALEN]) diff --git a/package/kernel/mac80211/patches/335-v4.18-0002-brcmfmac-add-support-for-sysfs-initiated-coredump.patch b/package/kernel/mac80211/patches/335-v4.18-0002-brcmfmac-add-support-for-sysfs-initiated-coredump.patch new file mode 100644 index 000000000..86533b95b --- /dev/null +++ b/package/kernel/mac80211/patches/335-v4.18-0002-brcmfmac-add-support-for-sysfs-initiated-coredump.patch @@ -0,0 +1,76 @@ +From 8e072168f75ebce85b96cbcefea2b10ddbd5913f Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Wed, 16 May 2018 14:11:59 +0200 +Subject: [PATCH] brcmfmac: add support for sysfs initiated coredump + +The driver already supports device coredump initiated by firmware +event. Since commit 3c47d19ff4dc ("drivers: base: add coredump driver +ops") it is also possible to initiate it from user-space through +sysfs. This patch adds support for SDIO and PCIe devices. + +[rafal@milecki.pl: use LINUX_VERSION_CODE] +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +Signed-off-by: Rafał Miłecki +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 ++ + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 8 ++++++++ + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + + 4 files changed, 12 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +@@ -1165,6 +1165,9 @@ static struct sdio_driver brcmf_sdmmc_dr + #ifdef CONFIG_PM_SLEEP + .pm = &brcmf_sdio_pm_ops, + #endif /* CONFIG_PM_SLEEP */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) ++ .coredump = brcmf_dev_coredump, ++#endif + }, + }; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -250,6 +250,8 @@ int brcmf_attach(struct device *dev, str + void brcmf_detach(struct device *dev); + /* Indication from bus module that dongle should be reset */ + void brcmf_dev_reset(struct device *dev); ++/* Request from bus module to initiate a coredump */ ++void brcmf_dev_coredump(struct device *dev); + + /* Configure the "global" bus state used by upper layers */ + void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1201,6 +1201,14 @@ void brcmf_dev_reset(struct device *dev) + brcmf_fil_cmd_int_set(drvr->iflist[0], BRCMF_C_TERMINATED, 1); + } + ++void brcmf_dev_coredump(struct device *dev) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ ++ if (brcmf_debug_create_memdump(bus_if, NULL, 0) < 0) ++ brcmf_dbg(TRACE, "failed to create coredump\n"); ++} ++ + void brcmf_detach(struct device *dev) + { + s32 i; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -2044,6 +2044,9 @@ static struct pci_driver brcmf_pciedrvr + #ifdef CONFIG_PM + .driver.pm = &brcmf_pciedrvr_pm, + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) ++ .driver.coredump = brcmf_dev_coredump, ++#endif + }; + + diff --git a/package/kernel/mac80211/patches/335-v4.18-0004-brcmfmac-validate-user-provided-data-for-memdump-bef.patch b/package/kernel/mac80211/patches/335-v4.18-0004-brcmfmac-validate-user-provided-data-for-memdump-bef.patch new file mode 100644 index 000000000..455009ef1 --- /dev/null +++ b/package/kernel/mac80211/patches/335-v4.18-0004-brcmfmac-validate-user-provided-data-for-memdump-bef.patch @@ -0,0 +1,32 @@ +From d2af9b566554e01f9ad67b330ce569dbc130e5d3 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Wed, 16 May 2018 14:12:01 +0200 +Subject: [PATCH] brcmfmac: validate user provided data for memdump before + copying + +In patch "brcmfmac: add support for sysfs initiated coredump", a new +scenario of brcmf_debug_create_memdump was added in which the user of +the function might not necessarily provide prefix data. Hence the +function should not assume the data is always valid and should perform a +check before copying. + +Reviewed-by: Arend van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +@@ -40,7 +40,8 @@ int brcmf_debug_create_memdump(struct br + if (!dump) + return -ENOMEM; + +- memcpy(dump, data, len); ++ if (data && len > 0) ++ memcpy(dump, data, len); + err = brcmf_bus_get_memdump(bus, dump + len, ramsize); + if (err) { + vfree(dump); diff --git a/package/kernel/mac80211/patches/335-v4.18-0005-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch b/package/kernel/mac80211/patches/335-v4.18-0005-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch new file mode 100644 index 000000000..b94e06fa4 --- /dev/null +++ b/package/kernel/mac80211/patches/335-v4.18-0005-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch @@ -0,0 +1,38 @@ +From 8a3ab2f38f1669e3be6433a1f6b82a077b38c4c7 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Wed, 16 May 2018 14:12:02 +0200 +Subject: [PATCH] brcmfmac: trigger memory dump upon firmware halt signal + +PCIe dongle firmware signals a halt/trap through mailbox interrupt. +Trigger a memory dump upon receiving such signal could help to provide +useful information for issue debug. + +Reviewed-by: Arend van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -182,6 +182,7 @@ static const struct brcmf_firmware_mappi + #define BRCMF_D2H_DEV_D3_ACK 0x00000001 + #define BRCMF_D2H_DEV_DS_ENTER_REQ 0x00000002 + #define BRCMF_D2H_DEV_DS_EXIT_NOTE 0x00000004 ++#define BRCMF_D2H_DEV_FWHALT 0x10000000 + + #define BRCMF_H2D_HOST_D3_INFORM 0x00000001 + #define BRCMF_H2D_HOST_DS_ACK 0x00000002 +@@ -717,6 +718,10 @@ static void brcmf_pcie_handle_mb_data(st + devinfo->mbdata_completed = true; + wake_up(&devinfo->mbdata_resp_wait); + } ++ if (dtoh_mb_data & BRCMF_D2H_DEV_FWHALT) { ++ brcmf_dbg(PCIE, "D2H_MB_DATA: FW HALT\n"); ++ brcmf_dev_coredump(&devinfo->pdev->dev); ++ } + } + + diff --git a/package/kernel/mac80211/patches/335-v4.18-0006-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch b/package/kernel/mac80211/patches/335-v4.18-0006-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch new file mode 100644 index 000000000..045e20acf --- /dev/null +++ b/package/kernel/mac80211/patches/335-v4.18-0006-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch @@ -0,0 +1,30 @@ +From b8248236e92790ac635caeb4156e46ea2417e037 Mon Sep 17 00:00:00 2001 +From: Franky Lin +Date: Wed, 16 May 2018 14:12:03 +0200 +Subject: [PATCH] brcmfmac: trigger memory dump on SDIO firmware halt message + +Attempt to dump dongle memory for debug upon receiving firmware halt +message through dongle to host mail box interrupt. + +Reviewed-by: Arend van Spriel +Signed-off-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -1072,8 +1072,10 @@ static u32 brcmf_sdio_hostmail(struct br + bus->sdcnt.f1regdata += 2; + + /* dongle indicates the firmware has halted/crashed */ +- if (hmb_data & HMB_DATA_FWHALT) ++ if (hmb_data & HMB_DATA_FWHALT) { + brcmf_err("mailbox indicates firmware halted\n"); ++ brcmf_dev_coredump(&sdiod->func1->dev); ++ } + + /* Dongle recomposed rx frames, accept them again */ + if (hmb_data & HMB_DATA_NAKHANDLED) { diff --git a/package/kernel/mac80211/patches/336-v4.18-brcmfmac-stop-watchdog-before-detach-and-free-everyt.patch b/package/kernel/mac80211/patches/336-v4.18-brcmfmac-stop-watchdog-before-detach-and-free-everyt.patch new file mode 100644 index 000000000..a478b675c --- /dev/null +++ b/package/kernel/mac80211/patches/336-v4.18-brcmfmac-stop-watchdog-before-detach-and-free-everyt.patch @@ -0,0 +1,70 @@ +From 373c83a801f15b1e3d02d855fad89112bd4ccbe0 Mon Sep 17 00:00:00 2001 +From: Michael Trimarchi +Date: Wed, 30 May 2018 11:06:34 +0200 +Subject: [PATCH] brcmfmac: stop watchdog before detach and free everything + +Using built-in in kernel image without a firmware in filesystem +or in the kernel image can lead to a kernel NULL pointer deference. +Watchdog need to be stopped in brcmf_sdio_remove + +The system is going down NOW! +[ 1348.110759] Unable to handle kernel NULL pointer dereference at virtual address 000002f8 +Sent SIGTERM to all processes +[ 1348.121412] Mem abort info: +[ 1348.126962] ESR = 0x96000004 +[ 1348.130023] Exception class = DABT (current EL), IL = 32 bits +[ 1348.135948] SET = 0, FnV = 0 +[ 1348.138997] EA = 0, S1PTW = 0 +[ 1348.142154] Data abort info: +[ 1348.145045] ISV = 0, ISS = 0x00000004 +[ 1348.148884] CM = 0, WnR = 0 +[ 1348.151861] user pgtable: 4k pages, 48-bit VAs, pgdp = (____ptrval____) +[ 1348.158475] [00000000000002f8] pgd=0000000000000000 +[ 1348.163364] Internal error: Oops: 96000004 [#1] PREEMPT SMP +[ 1348.168927] Modules linked in: ipv6 +[ 1348.172421] CPU: 3 PID: 1421 Comm: brcmf_wdog/mmc0 Not tainted 4.17.0-rc5-next-20180517 #18 +[ 1348.180757] Hardware name: Amarula A64-Relic (DT) +[ 1348.185455] pstate: 60000005 (nZCv daif -PAN -UAO) +[ 1348.190251] pc : brcmf_sdiod_freezer_count+0x0/0x20 +[ 1348.195124] lr : brcmf_sdio_watchdog_thread+0x64/0x290 +[ 1348.200253] sp : ffff00000b85be30 +[ 1348.203561] x29: ffff00000b85be30 x28: 0000000000000000 +[ 1348.208868] x27: ffff00000b6cb918 x26: ffff80003b990638 +[ 1348.214176] x25: ffff0000087b1a20 x24: ffff80003b94f800 +[ 1348.219483] x23: ffff000008e620c8 x22: ffff000008f0b660 +[ 1348.224790] x21: ffff000008c6a858 x20: 00000000fffffe00 +[ 1348.230097] x19: ffff80003b94f800 x18: 0000000000000001 +[ 1348.235404] x17: 0000ffffab2e8a74 x16: ffff0000080d7de8 +[ 1348.240711] x15: 0000000000000000 x14: 0000000000000400 +[ 1348.246018] x13: 0000000000000400 x12: 0000000000000001 +[ 1348.251324] x11: 00000000000002c4 x10: 0000000000000a10 +[ 1348.256631] x9 : ffff00000b85bc40 x8 : ffff80003be11870 +[ 1348.261937] x7 : ffff80003dfc7308 x6 : 000000078ff08b55 +[ 1348.267243] x5 : 00000139e1058400 x4 : 0000000000000000 +[ 1348.272550] x3 : dead000000000100 x2 : 958f2788d6618100 +[ 1348.277856] x1 : 00000000fffffe00 x0 : 0000000000000000 + +Signed-off-by: Michael Trimarchi +Acked-by: Arend van Spriel +Tested-by: Andy Shevchenko +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4297,6 +4297,13 @@ void brcmf_sdio_remove(struct brcmf_sdio + brcmf_dbg(TRACE, "Enter\n"); + + if (bus) { ++ /* Stop watchdog task */ ++ if (bus->watchdog_tsk) { ++ send_sig(SIGTERM, bus->watchdog_tsk, 1); ++ kthread_stop(bus->watchdog_tsk); ++ bus->watchdog_tsk = NULL; ++ } ++ + /* De-register interrupt handler */ + brcmf_sdiod_intr_unregister(bus->sdiodev); + diff --git a/package/kernel/mac80211/patches/337-v4.18-brcmfmac-fix-regression-in-parsing-NVRAM-for-multipl.patch b/package/kernel/mac80211/patches/337-v4.18-brcmfmac-fix-regression-in-parsing-NVRAM-for-multipl.patch new file mode 100644 index 000000000..2e265a2f3 --- /dev/null +++ b/package/kernel/mac80211/patches/337-v4.18-brcmfmac-fix-regression-in-parsing-NVRAM-for-multipl.patch @@ -0,0 +1,41 @@ +From 299b6365a3b7cf7f5ea1c945a420e9ee4841d6f7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 22 Jul 2018 23:46:25 +0200 +Subject: [PATCH] brcmfmac: fix regression in parsing NVRAM for multiple + devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +NVRAM is designed to work with Broadcom's SDK Linux kernel which fakes +PCI domain 0 for all internal MMIO devices. Since official Linux kernel +uses platform devices for that purpose there is a mismatch in numbering +PCI domains. + +There used to be a fix for that problem but it was accidentally dropped +during the last firmware loading rework. That resulted in brcmfmac not +being able to extract device specific NVRAM content and all kind of +calibration problems. + +Reported-by: Aditya Xavier +Fixes: 2baa3aaee27f ("brcmfmac: introduce brcmf_fw_alloc_request() function") +Cc: stable@vger.kernel.org # v4.17+ +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1785,7 +1785,8 @@ brcmf_pcie_prepare_fw_request(struct brc + fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; + fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; + fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; +- fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus); ++ /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ ++ fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1; + fwreq->bus_nr = devinfo->pdev->bus->number; + + return fwreq; diff --git a/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch index 34d7d3b1c..5eb69b898 100644 --- a/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch +++ b/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -29,6 +29,21 @@ Signed-off-by: Felix Fietkau - npend = ath9k_hw_numtxpending(ah, i); - if (npend) - break; +- } +- +- if (ah->external_reset && +- (npend || type == ATH9K_RESET_COLD)) { +- int reset_err = 0; +- +- ath_dbg(ath9k_hw_common(ah), RESET, +- "reset MAC via external reset\n"); +- +- reset_err = ah->external_reset(); +- if (reset_err) { +- ath_err(ath9k_hw_common(ah), +- "External reset failed, err=%d\n", +- reset_err); +- return false; + if (type == ATH9K_RESET_COLD) + return true; + @@ -44,47 +59,35 @@ Signed-off-by: Felix Fietkau + for (i = 0; i < AR_NUM_QCU; i++) { + if (ath9k_hw_numtxpending(ah, i)) + return true; -+ } - } - -- if (ah->external_reset && -- (npend || type == ATH9K_RESET_COLD)) { -- int reset_err = 0; + } ++ } ++ + return false; +} - -- ath_dbg(ath9k_hw_common(ah), RESET, -- "reset MAC via external reset\n"); ++ +static bool ath9k_hw_external_reset(struct ath_hw *ah, int type) +{ + int err; - -- reset_err = ah->external_reset(); -- if (reset_err) { -- ath_err(ath9k_hw_common(ah), -- "External reset failed, err=%d\n", -- reset_err); -- return false; -- } ++ + if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type)) + return true; - -- REG_WRITE(ah, AR_RTC_RESET, 1); ++ + ath_dbg(ath9k_hw_common(ah), RESET, + "reset MAC via external reset\n"); -+ + +- REG_WRITE(ah, AR_RTC_RESET, 1); + err = ah->external_reset(); + if (err) { + ath_err(ath9k_hw_common(ah), + "External reset failed, err=%d\n", err); + return false; -+ } -+ + } + + if (AR_SREV_9550(ah)) { + REG_WRITE(ah, AR_RTC_RESET, 0); + udelay(10); - } - ++ } ++ + REG_WRITE(ah, AR_RTC_RESET, 1); + udelay(10); + diff --git a/package/kernel/mac80211/patches/355-ath9k-limit-retries-for-powersave-response-frames.patch b/package/kernel/mac80211/patches/355-ath9k-limit-retries-for-powersave-response-frames.patch deleted file mode 100644 index 31825b819..000000000 --- a/package/kernel/mac80211/patches/355-ath9k-limit-retries-for-powersave-response-frames.patch +++ /dev/null @@ -1,96 +0,0 @@ -From: Felix Fietkau -Date: Thu, 2 Jul 2015 15:20:56 +0200 -Subject: [PATCH] ath9k: limit retries for powersave response frames - -In some cases, the channel might be busy enough that an ath9k AP's -response to PS-Poll frames might be too slow and the station has already -gone to sleep. To avoid wasting too much airtime on this, limit the -number of retries on such frames and ensure that no sample rate gets -used. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -188,10 +188,25 @@ static void ath_send_bar(struct ath_atx_ - } - - static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, -- struct ath_buf *bf) -+ struct ath_buf *bf, bool ps) - { -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu); -+ -+ if (ps) { -+ /* Clear the first rate to avoid using a sample rate for PS frames */ -+ info->control.rates[0].idx = -1; -+ info->control.rates[0].count = 0; -+ } -+ - ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates, - ARRAY_SIZE(bf->rates)); -+ if (!ps) -+ return; -+ -+ if (bf->rates[0].count > 2) -+ bf->rates[0].count = 2; -+ -+ bf->rates[1].idx = -1; - } - - static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, -@@ -1502,7 +1517,7 @@ ath_tx_form_burst(struct ath_softc *sc, - break; - } - -- ath_set_rates(tid->an->vif, tid->an->sta, bf); -+ ath_set_rates(tid->an->vif, tid->an->sta, bf, false); - } while (1); - } - -@@ -1532,7 +1547,7 @@ static bool ath_tx_sched_aggr(struct ath - return false; - } - -- ath_set_rates(tid->an->vif, tid->an->sta, bf); -+ ath_set_rates(tid->an->vif, tid->an->sta, bf, false); - if (aggr) - aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf); - else -@@ -1690,7 +1705,7 @@ void ath9k_release_buffered_frames(struc - break; - - list_add_tail(&bf->list, &bf_q); -- ath_set_rates(tid->an->vif, tid->an->sta, bf); -+ ath_set_rates(tid->an->vif, tid->an->sta, bf, true); - if (bf_isampdu(bf)) { - ath_tx_addto_baw(sc, tid, bf); - bf->bf_state.bf_type &= ~BUF_AGGR; -@@ -2390,7 +2405,7 @@ int ath_tx_start(struct ieee80211_hw *hw - if (txctl->paprd) - bf->bf_state.bfs_paprd_timestamp = jiffies; - -- ath_set_rates(vif, sta, bf); -+ ath_set_rates(vif, sta, bf, ps_resp); - ath_tx_send_normal(sc, txq, tid, skb); - - out: -@@ -2429,7 +2444,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw - break; - - bf->bf_lastbf = bf; -- ath_set_rates(vif, NULL, bf); -+ ath_set_rates(vif, NULL, bf, false); - ath_buf_set_rate(sc, bf, &info, fi->framelen, false); - duration += info.rates[0].PktDuration; - if (bf_tail) -@@ -2946,7 +2961,7 @@ int ath9k_tx99_send(struct ath_softc *sc - return -EINVAL; - } - -- ath_set_rates(sc->tx99_vif, NULL, bf); -+ ath_set_rates(sc->tx99_vif, NULL, bf, false); - - ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr); - ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum); diff --git a/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch index c9c74bb83..d651e6ce3 100644 --- a/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch +++ b/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch @@ -7,7 +7,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -1674,6 +1674,22 @@ void ath_tx_aggr_wakeup(struct ath_softc +@@ -1659,6 +1659,22 @@ void ath_tx_aggr_wakeup(struct ath_softc } } @@ -30,15 +30,15 @@ Signed-off-by: Felix Fietkau void ath9k_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tids, int nframes, -@@ -1704,6 +1720,7 @@ void ath9k_release_buffered_frames(struc +@@ -1689,6 +1705,7 @@ void ath9k_release_buffered_frames(struc if (!bf) break; + ath9k_set_moredata(sc, bf, true); list_add_tail(&bf->list, &bf_q); - ath_set_rates(tid->an->vif, tid->an->sta, bf, true); + ath_set_rates(tid->an->vif, tid->an->sta, bf); if (bf_isampdu(bf)) { -@@ -1727,6 +1744,9 @@ void ath9k_release_buffered_frames(struc +@@ -1712,6 +1729,9 @@ void ath9k_release_buffered_frames(struc if (list_empty(&bf_q)) return; diff --git a/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch index 1893187e8..319de2a76 100644 --- a/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch +++ b/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -984,7 +984,8 @@ ath_tx_get_tid_subframe(struct ath_softc +@@ -969,7 +969,8 @@ ath_tx_get_tid_subframe(struct ath_softc bf->bf_lastbf = bf; tx_info = IEEE80211_SKB_CB(skb); diff --git a/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch index 59de1dfe1..e25e92dda 100644 --- a/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch +++ b/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, struct ath_txq *txq, struct ath_atx_tid *tid, -@@ -311,7 +311,7 @@ static void ath_tx_flush_tid(struct ath_ +@@ -296,7 +296,7 @@ static void ath_tx_flush_tid(struct ath_ } if (fi->baw_tracked) { @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau sendbar = true; } -@@ -327,10 +327,15 @@ static void ath_tx_flush_tid(struct ath_ +@@ -312,10 +312,15 @@ static void ath_tx_flush_tid(struct ath_ } static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau index = ATH_BA_INDEX(tid->seq_start, seqno); cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); -@@ -351,6 +356,9 @@ static void ath_tx_addto_baw(struct ath_ +@@ -336,6 +341,9 @@ static void ath_tx_addto_baw(struct ath_ u16 seqno = bf->bf_state.seqno; int index, cindex; @@ -57,7 +57,7 @@ Signed-off-by: Felix Fietkau index = ATH_BA_INDEX(tid->seq_start, seqno); cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); __set_bit(cindex, tid->tx_buf); -@@ -627,7 +635,7 @@ static void ath_tx_complete_aggr(struct +@@ -612,7 +620,7 @@ static void ath_tx_complete_aggr(struct * complete the acked-ones/xretried ones; update * block-ack window */ @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { memcpy(tx_info->control.rates, rates, sizeof(rates)); -@@ -657,7 +665,7 @@ static void ath_tx_complete_aggr(struct +@@ -642,7 +650,7 @@ static void ath_tx_complete_aggr(struct * run out of tx buf. */ if (!tbf) { @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, -@@ -1026,11 +1034,14 @@ ath_tx_get_tid_subframe(struct ath_softc +@@ -1011,11 +1019,14 @@ ath_tx_get_tid_subframe(struct ath_softc INIT_LIST_HEAD(&bf_head); list_add(&bf->list, &bf_head); @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau return bf; } -@@ -1088,8 +1099,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s +@@ -1073,8 +1084,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s bf->bf_next = NULL; /* link buffers of this frame to the aggregate */ @@ -100,10 +100,10 @@ Signed-off-by: Felix Fietkau bf->bf_state.ndelim = ndelim; list_add_tail(&bf->list, bf_q); -@@ -1725,10 +1734,8 @@ void ath9k_release_buffered_frames(struc +@@ -1710,10 +1719,8 @@ void ath9k_release_buffered_frames(struc ath9k_set_moredata(sc, bf, true); list_add_tail(&bf->list, &bf_q); - ath_set_rates(tid->an->vif, tid->an->sta, bf, true); + ath_set_rates(tid->an->vif, tid->an->sta, bf); - if (bf_isampdu(bf)) { - ath_tx_addto_baw(sc, tid, bf); + if (bf_isampdu(bf)) diff --git a/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch b/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch index 096eb56a2..0f3120d67 100644 --- a/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch +++ b/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -2451,7 +2451,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw +@@ -2436,7 +2436,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw .txq = sc->beacon.cabq }; struct ath_tx_info info = {}; @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau struct ath_buf *bf_tail = NULL; struct ath_buf *bf; LIST_HEAD(bf_q); -@@ -2495,15 +2494,10 @@ void ath_tx_cabq(struct ieee80211_hw *hw +@@ -2480,15 +2479,10 @@ void ath_tx_cabq(struct ieee80211_hw *hw if (list_empty(&bf_q)) return; diff --git a/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch b/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch index fa51f1be7..02a0ca0a5 100644 --- a/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch +++ b/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch @@ -136,72 +136,82 @@ Signed-off-by: Felix Fietkau - MCS_GROUP(1, 0, BW_20), - MCS_GROUP(2, 0, BW_20), - MCS_GROUP(3, 0, BW_20), -+ MCS_GROUP(1, 0, BW_20, 5), -+ MCS_GROUP(2, 0, BW_20, 4), -+ MCS_GROUP(3, 0, BW_20, 4), - +- - MCS_GROUP(1, 1, BW_20), - MCS_GROUP(2, 1, BW_20), - MCS_GROUP(3, 1, BW_20), -+ MCS_GROUP(1, 1, BW_20, 5), -+ MCS_GROUP(2, 1, BW_20, 4), -+ MCS_GROUP(3, 1, BW_20, 4), - +- - MCS_GROUP(1, 0, BW_40), - MCS_GROUP(2, 0, BW_40), - MCS_GROUP(3, 0, BW_40), -+ MCS_GROUP(1, 0, BW_40, 4), -+ MCS_GROUP(2, 0, BW_40, 4), -+ MCS_GROUP(3, 0, BW_40, 4), - +- - MCS_GROUP(1, 1, BW_40), - MCS_GROUP(2, 1, BW_40), - MCS_GROUP(3, 1, BW_40), -+ MCS_GROUP(1, 1, BW_40, 4), -+ MCS_GROUP(2, 1, BW_40, 4), -+ MCS_GROUP(3, 1, BW_40, 4), - +- - CCK_GROUP, -+ CCK_GROUP(8), - +- - VHT_GROUP(1, 0, BW_20), - VHT_GROUP(2, 0, BW_20), - VHT_GROUP(3, 0, BW_20), -+ VHT_GROUP(1, 0, BW_20, 5), -+ VHT_GROUP(2, 0, BW_20, 4), -+ VHT_GROUP(3, 0, BW_20, 4), - +- - VHT_GROUP(1, 1, BW_20), - VHT_GROUP(2, 1, BW_20), - VHT_GROUP(3, 1, BW_20), -+ VHT_GROUP(1, 1, BW_20, 5), -+ VHT_GROUP(2, 1, BW_20, 4), -+ VHT_GROUP(3, 1, BW_20, 4), - +- - VHT_GROUP(1, 0, BW_40), - VHT_GROUP(2, 0, BW_40), - VHT_GROUP(3, 0, BW_40), -+ VHT_GROUP(1, 0, BW_40, 4), -+ VHT_GROUP(2, 0, BW_40, 4), -+ VHT_GROUP(3, 0, BW_40, 4), - +- - VHT_GROUP(1, 1, BW_40), - VHT_GROUP(2, 1, BW_40), - VHT_GROUP(3, 1, BW_40), -+ VHT_GROUP(1, 1, BW_40, 4), -+ VHT_GROUP(2, 1, BW_40, 4), -+ VHT_GROUP(3, 1, BW_40, 4), - +- - VHT_GROUP(1, 0, BW_80), - VHT_GROUP(2, 0, BW_80), - VHT_GROUP(3, 0, BW_80), -+ VHT_GROUP(1, 0, BW_80, 4), -+ VHT_GROUP(2, 0, BW_80, 4), -+ VHT_GROUP(3, 0, BW_80, 4), - +- - VHT_GROUP(1, 1, BW_80), - VHT_GROUP(2, 1, BW_80), - VHT_GROUP(3, 1, BW_80), ++ MCS_GROUP(1, 0, BW_20, 5), ++ MCS_GROUP(2, 0, BW_20, 4), ++ MCS_GROUP(3, 0, BW_20, 4), ++ ++ MCS_GROUP(1, 1, BW_20, 5), ++ MCS_GROUP(2, 1, BW_20, 4), ++ MCS_GROUP(3, 1, BW_20, 4), ++ ++ MCS_GROUP(1, 0, BW_40, 4), ++ MCS_GROUP(2, 0, BW_40, 4), ++ MCS_GROUP(3, 0, BW_40, 4), ++ ++ MCS_GROUP(1, 1, BW_40, 4), ++ MCS_GROUP(2, 1, BW_40, 4), ++ MCS_GROUP(3, 1, BW_40, 4), ++ ++ CCK_GROUP(8), ++ ++ VHT_GROUP(1, 0, BW_20, 5), ++ VHT_GROUP(2, 0, BW_20, 4), ++ VHT_GROUP(3, 0, BW_20, 4), ++ ++ VHT_GROUP(1, 1, BW_20, 5), ++ VHT_GROUP(2, 1, BW_20, 4), ++ VHT_GROUP(3, 1, BW_20, 4), ++ ++ VHT_GROUP(1, 0, BW_40, 4), ++ VHT_GROUP(2, 0, BW_40, 4), ++ VHT_GROUP(3, 0, BW_40, 4), ++ ++ VHT_GROUP(1, 1, BW_40, 4), ++ VHT_GROUP(2, 1, BW_40, 4), ++ VHT_GROUP(3, 1, BW_40, 4), ++ ++ VHT_GROUP(1, 0, BW_80, 4), ++ VHT_GROUP(2, 0, BW_80, 4), ++ VHT_GROUP(3, 0, BW_80, 4), ++ + VHT_GROUP(1, 1, BW_80, 4), + VHT_GROUP(2, 1, BW_80, 4), + VHT_GROUP(3, 1, BW_80, 4), diff --git a/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch b/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch index 9970574e1..0b599b73a 100644 --- a/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch +++ b/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch @@ -23,7 +23,7 @@ Signed-off-by: Toke Høiland-Jørgensen --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -2930,6 +2930,8 @@ void ath_tx_node_cleanup(struct ath_soft +@@ -2915,6 +2915,8 @@ void ath_tx_node_cleanup(struct ath_soft struct ath_txq *txq; int tidno; @@ -32,7 +32,7 @@ Signed-off-by: Toke Høiland-Jørgensen for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { tid = ath_node_to_tid(an, tidno); txq = tid->txq; -@@ -2947,6 +2949,8 @@ void ath_tx_node_cleanup(struct ath_soft +@@ -2932,6 +2934,8 @@ void ath_tx_node_cleanup(struct ath_soft if (!an->sta) break; /* just one multicast ath_atx_tid */ } diff --git a/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch b/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch new file mode 100644 index 000000000..37323c1f7 --- /dev/null +++ b/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch @@ -0,0 +1,42 @@ +From 4f717a2589be649afddbbd3ac58b67ebfa7426f7 Mon Sep 17 00:00:00 2001 +From: Sven Eckelmann +Date: Wed, 6 Jun 2018 10:18:31 +0200 +Subject: [PATCH v2] cfg80211: initialize sinfo in cfg80211_get_station + +Most of the implementations behind cfg80211_get_station will not initialize +sinfo to zero before manipulating it. For example, the member "filled", +which indicates the filled in parts of this struct, is often only modified +by enabling certain bits in the bitfield while keeping the remaining bits +in their original state. A caller without a preinitialized sinfo.filled can +then no longer decide which parts of sinfo were filled in by +cfg80211_get_station (or actually the underlying implementations). + +cfg80211_get_station must therefore take care that sinfo is initialized to +zero. Otherwise, the caller may tries to read information which was not +filled in and which must therefore also be considered uninitialized. In +batadv_v_elp_get_throughput's case, an invalid "random" expected throughput +may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may +switch to non-optimal neighbors for certain destinations. + +Fixes: 7406353d43c8 ("cfg80211: implement cfg80211_get_station cfg80211 API") +Reported-by: Thomas Lauer +Reported-by: Marcel Schmidt +Cc: b.a.t.m.a.n@lists.open-mesh.org +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.kernel.org/patch/10449857/ +--- + net/wireless/util.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -1749,6 +1749,8 @@ int cfg80211_get_station(struct net_devi + if (!rdev->ops->get_station) + return -EOPNOTSUPP; + ++ memset(sinfo, 0, sizeof(*sinfo)); ++ + return rdev_get_station(rdev, dev, mac_addr, sinfo); + } + EXPORT_SYMBOL(cfg80211_get_station); diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch index 9084ea7db..8ea2f79a2 100644 --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch @@ -103,8 +103,7 @@ + GFP_KERNEL); + if (!led) + return -ENOMEM; - -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); ++ + led->gpio = gpio = (struct gpio_led *) (led + 1); + _name = (char *) (led->gpio + 1); + @@ -117,7 +116,8 @@ + ret = ath_add_led(sc, led); + if (unlikely(ret < 0)) + kfree(led); -+ + +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val); + return ret; } @@ -125,11 +125,11 @@ { - if (!sc->led_registered) - return; -- -- ath_led_brightness(&sc->led_cdev, LED_OFF); -- led_classdev_unregister(&sc->led_cdev); + struct ath_led *led; +- ath_led_brightness(&sc->led_cdev, LED_OFF); +- led_classdev_unregister(&sc->led_cdev); +- - ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); + while (!list_empty(&sc->leds)) { + led = list_first_entry(&sc->leds, struct ath_led, list); diff --git a/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch b/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch deleted file mode 100644 index c9b2e13a9..000000000 --- a/package/kernel/mac80211/patches/653-0001-rtl8xxxu-Accept-firmware-signature-0x88e0.patch +++ /dev/null @@ -1,22 +0,0 @@ -From f15fbdcb03abdf7403e8ebba52791cc596a8a8a6 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 14:08:47 -0400 -Subject: [PATCH] rtl8xxxu: Accept firmware signature 0x88e0 - -rtl8188eu uses firmware signature 0x88e0 - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -2097,6 +2097,7 @@ int rtl8xxxu_load_firmware(struct rtl8xx - switch (signature & 0xfff0) { - case 0x92e0: - case 0x92c0: -+ case 0x88e0: - case 0x88c0: - case 0x5300: - case 0x2300: diff --git a/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch b/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch deleted file mode 100644 index 71f93e955..000000000 --- a/package/kernel/mac80211/patches/653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 6f971392cd52524058f179d7c78464d692fbb018 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 14:23:44 -0400 -Subject: [PATCH] rtl8xxxu: Add initial code to detect 8188eu devices - -So far this just detects the device and tries to load firmware. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/Makefile | 2 +- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 65 ++++++++++++++++++++++ - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 + - 4 files changed, 70 insertions(+), 1 deletion(-) - create mode 100644 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c - ---- a/drivers/net/wireless/realtek/rtl8xxxu/Makefile -+++ b/drivers/net/wireless/realtek/rtl8xxxu/Makefile -@@ -1,4 +1,4 @@ - obj-$(CPTCFG_RTL8XXXU) += rtl8xxxu.o - - rtl8xxxu-y := rtl8xxxu_core.o rtl8xxxu_8192e.o rtl8xxxu_8723b.o \ -- rtl8xxxu_8723a.o rtl8xxxu_8192c.o -+ rtl8xxxu_8723a.o rtl8xxxu_8192c.o rtl8xxxu_8188e.o ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1446,6 +1446,7 @@ void rtl8xxxu_fill_txdesc_v2(struct ieee - bool short_preamble, bool ampdu_enable, - u32 rts_rate); - -+extern struct rtl8xxxu_fileops rtl8188eu_fops; - extern struct rtl8xxxu_fileops rtl8192cu_fops; - extern struct rtl8xxxu_fileops rtl8192eu_fops; - extern struct rtl8xxxu_fileops rtl8723au_fops; ---- /dev/null -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -0,0 +1,65 @@ -+/* -+ * RTL8XXXU mac80211 USB driver - 8188e specific subdriver -+ * -+ * Copyright (c) 2014 - 2016 Jes Sorensen -+ * -+ * Portions, notably calibration code: -+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. -+ * -+ * This driver was written as a replacement for the vendor provided -+ * rtl8723au driver. As the Realtek 8xxx chips are very similar in -+ * their programming interface, I have started adding support for -+ * additional 8xxx chips like the 8192cu, 8188cus, etc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of version 2 of the GNU General Public License 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "rtl8xxxu.h" -+#include "rtl8xxxu_regs.h" -+ -+static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) -+{ -+ return 0; -+} -+ -+static int rtl8188eu_load_firmware(struct rtl8xxxu_priv *priv) -+{ -+ char *fw_name; -+ int ret; -+ -+ fw_name = "rtlwifi/rtl8188eufw.bin"; -+ -+ ret = rtl8xxxu_load_firmware(priv, fw_name); -+ -+ return -EINVAL; -+ return ret; -+} -+ -+struct rtl8xxxu_fileops rtl8188eu_fops = { -+ .parse_efuse = rtl8188eu_parse_efuse, -+ .load_firmware = rtl8188eu_load_firmware, -+ .reset_8051 = rtl8xxxu_reset_8051, -+}; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -54,6 +54,7 @@ MODULE_LICENSE("GPL"); - MODULE_FIRMWARE("rtlwifi/rtl8723aufw_A.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin"); -+MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin"); - MODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin"); -@@ -6212,6 +6213,8 @@ static const struct usb_device_id dev_ta - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0xb720, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8723bu_fops}, - #ifdef CPTCFG_RTL8XXXU_UNTESTED -+{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8188eu_fops}, - /* Still supported by rtlwifi */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch b/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch deleted file mode 100644 index 1905899e7..000000000 --- a/package/kernel/mac80211/patches/653-0003-rtl8xxxu-Add-initial-code-to-parse-8188eu-efuse.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 6d5b4ef30046d74efe773613767d13d9ab95ed3d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 15:19:04 -0400 -Subject: [PATCH] rtl8xxxu: Add initial code to parse 8188eu efuse - -This obtains the MAC address, but work is still needed to handle TX -power settings. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 40 ++++++++++++++++++++++ - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 34 ++++++++++++++++++ - 2 files changed, 74 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -872,6 +872,45 @@ struct rtl8192eu_efuse { - u8 res14[0xc3]; - }; - -+struct rtl8188eu_efuse { -+ __le16 rtl_id; -+ u8 res0[0x0e]; -+ u8 cck_tx_power_index_A[3]; /* 0x10 */ -+ u8 cck_tx_power_index_B[3]; -+ u8 ht40_1s_tx_power_index_A[3]; /* 0x16 */ -+ u8 ht40_1s_tx_power_index_B[3]; -+ u8 res1[0x9c]; -+ u8 channel_plan; /* 0xb8 */ -+ u8 xtal_k; -+ u8 thermal_meter; -+ u8 iqk_lck; -+ u8 res2[5]; -+ u8 rf_board_option; -+ u8 rf_feature_option; -+ u8 rf_bt_setting; -+ u8 eeprom_version; -+ u8 eeprom_customer_id; -+ u8 res3[3]; -+ u8 rf_antenna_option; /* 0xc9 */ -+ u8 res4[6]; -+ u8 vid; /* 0xd0 */ -+ u8 res5[1]; -+ u8 pid; /* 0xd2 */ -+ u8 res6[1]; -+ u8 usb_optional_function; -+ u8 res7[2]; -+ u8 mac_addr[ETH_ALEN]; /* 0xd7 */ -+ u8 res8[2]; -+ u8 vendor_name[7]; -+ u8 res9[2]; -+ u8 device_name[0x0b]; /* 0xe8 */ -+ u8 res10[2]; -+ u8 serial[0x0b]; /* 0xf5 */ -+ u8 res11[0x30]; -+ u8 unknown[0x0d]; /* 0x130 */ -+ u8 res12[0xc3]; -+}; -+ - struct rtl8xxxu_reg8val { - u16 reg; - u8 val; -@@ -1290,6 +1329,7 @@ struct rtl8xxxu_priv { - struct rtl8723bu_efuse efuse8723bu; - struct rtl8192cu_efuse efuse8192; - struct rtl8192eu_efuse efuse8192eu; -+ struct rtl8188eu_efuse efuse8188eu; - } efuse_wifi; - u32 adda_backup[RTL8XXXU_ADDA_REGS]; - u32 mac_backup[RTL8XXXU_MAC_REGS]; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -42,6 +42,40 @@ - - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { -+ struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -+ int i; -+ -+ if (efuse->rtl_id != cpu_to_le16(0x8129)) -+ return -EINVAL; -+ -+ ether_addr_copy(priv->mac_addr, efuse->mac_addr); -+ -+ memcpy(priv->cck_tx_power_index_A, efuse->cck_tx_power_index_A, -+ sizeof(efuse->cck_tx_power_index_A)); -+ memcpy(priv->cck_tx_power_index_B, efuse->cck_tx_power_index_B, -+ sizeof(efuse->cck_tx_power_index_B)); -+ -+ memcpy(priv->ht40_1s_tx_power_index_A, -+ priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_A, -+ sizeof(priv->ht40_1s_tx_power_index_A)); -+ memcpy(priv->ht40_1s_tx_power_index_B, -+ priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, -+ sizeof(priv->ht40_1s_tx_power_index_B)); -+ -+ dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); -+ dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name); -+ dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); -+ -+ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) { -+ unsigned char *raw = priv->efuse_wifi.raw; -+ -+ dev_info(&priv->udev->dev, -+ "%s: dumping efuse (0x%02zx bytes):\n", -+ __func__, sizeof(struct rtl8188eu_efuse)); -+ for (i = 0; i < sizeof(struct rtl8188eu_efuse); i += 8) -+ dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); -+ } -+ - return 0; - } - diff --git a/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch b/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch deleted file mode 100644 index 83220e88f..000000000 --- a/package/kernel/mac80211/patches/653-0004-rtl8xxxu-Detect-8188eu-parts-correctly.patch +++ /dev/null @@ -1,43 +0,0 @@ -From ac5a363d61caee80e7b4464e55ab012a4450ef5d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 15:34:00 -0400 -Subject: [PATCH] rtl8xxxu: Detect 8188eu parts correctly - -8188 parts with chip_cut >= 2 are assumed to be 8188eu. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 22 +++++++++++++++------- - 1 file changed, 15 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -1683,13 +1683,21 @@ static int rtl8xxxu_identify_chip(struct - } - priv->has_wifi = 1; - } else { -- sprintf(priv->chip_name, "8188CU"); -- priv->rf_paths = 1; -- priv->rx_paths = 1; -- priv->tx_paths = 1; -- priv->rtl_chip = RTL8188C; -- priv->usb_interrupts = 1; -- priv->has_wifi = 1; -+ if (priv->chip_cut >= 2) { -+ sprintf(priv->chip_name, "8188EU"); -+ priv->rf_paths = 1; -+ priv->rx_paths = 1; -+ priv->tx_paths = 1; -+ priv->rtl_chip = RTL8188E; -+ } else { -+ sprintf(priv->chip_name, "8188CU"); -+ priv->rf_paths = 1; -+ priv->rx_paths = 1; -+ priv->tx_paths = 1; -+ priv->rtl_chip = RTL8188C; -+ priv->usb_interrupts = 1; -+ priv->has_wifi = 1; -+ } - } - - switch (priv->rtl_chip) { diff --git a/package/kernel/mac80211/patches/653-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch b/package/kernel/mac80211/patches/653-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch deleted file mode 100644 index dbba85b4b..000000000 --- a/package/kernel/mac80211/patches/653-0005-rtl8xxxu-First-stab-at-rtl8188e_power_on.patch +++ /dev/null @@ -1,105 +0,0 @@ -From a7c3d46915bce6d84e61e684e76564b034bdc1a9 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 27 Jun 2016 17:08:30 -0400 -Subject: [PATCH] rtl8xxxu: First stab at rtl8188e_power_on() - -Code based on code from Andrea Merello. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 82 ++++++++++++++++++++++ - 1 file changed, 82 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -92,8 +92,90 @@ static int rtl8188eu_load_firmware(struc - return ret; - } - -+static int rtl8188e_emu_to_active(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ u32 val32; -+ u16 val16; -+ int count, ret = 0; -+ -+ /* wait till 0x04[17] = 1 power ready*/ -+ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -+ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); -+ if (val32 & BIT(17)) -+ break; -+ -+ udelay(10); -+ } -+ -+ if (!count) { -+ ret = -EBUSY; -+ goto exit; -+ } -+ -+ /* reset baseband */ -+ val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); -+ val8 &= ~(SYS_FUNC_BBRSTB | SYS_FUNC_BB_GLB_RSTN); -+ rtl8xxxu_write8(priv, REG_SYS_FUNC, val8); -+ -+ /*0x24[23] = 2b'01 schmit trigger */ -+ val32 = rtl8xxxu_read32(priv, REG_AFE_XTAL_CTRL); -+ val32 |= BIT(23); -+ rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); -+ -+ /* 0x04[15] = 0 disable HWPDN (control by DRV)*/ -+ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -+ val16 &= ~APS_FSMCO_HW_POWERDOWN; -+ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); -+ -+ /*0x04[12:11] = 2b'00 disable WL suspend*/ -+ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -+ val16 &= ~(APS_FSMCO_HW_SUSPEND | APS_FSMCO_PCIE); -+ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); -+ -+ /* set, then poll until 0 */ -+ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); -+ val32 |= APS_FSMCO_MAC_ENABLE; -+ rtl8xxxu_write32(priv, REG_APS_FSMCO, val32); -+ -+ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -+ val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO); -+ if ((val32 & APS_FSMCO_MAC_ENABLE) == 0) { -+ ret = 0; -+ break; -+ } -+ udelay(10); -+ } -+ -+ if (!count) { -+ ret = -EBUSY; -+ goto exit; -+ } -+ -+ /* LDO normal mode*/ -+ val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); -+ val8 &= ~BIT(4); -+ rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); -+ -+exit: -+ return ret; -+} -+ -+static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) -+{ -+ int ret; -+ -+ ret = rtl8188e_emu_to_active(priv); -+ if (ret) -+ goto exit; -+ -+exit: -+ return ret; -+} -+ - struct rtl8xxxu_fileops rtl8188eu_fops = { - .parse_efuse = rtl8188eu_parse_efuse, - .load_firmware = rtl8188eu_load_firmware, -+ .power_on = rtl8188eu_power_on, - .reset_8051 = rtl8xxxu_reset_8051, - }; diff --git a/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch b/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch deleted file mode 100644 index 066f2fe24..000000000 --- a/package/kernel/mac80211/patches/653-0006-rtl8xxxu-Add-rtl8188e_disabled_to_emu.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b7335df2dc1b4c6c69ac6b95910d09a7dd5295a7 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 10:38:52 -0400 -Subject: [PATCH] rtl8xxxu: Add rtl8188e_disabled_to_emu() - -This sequence is found in the vendor driver, but never actually -called. It's unclear if we need it. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -92,6 +92,15 @@ static int rtl8188eu_load_firmware(struc - return ret; - } - -+static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) -+{ -+ u16 val16; -+ -+ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -+ val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN); -+ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); -+} -+ - static int rtl8188e_emu_to_active(struct rtl8xxxu_priv *priv) - { - u8 val8; -@@ -165,6 +174,8 @@ static int rtl8188eu_power_on(struct rtl - { - int ret; - -+ rtl8188e_disabled_to_emu(priv); -+ - ret = rtl8188e_emu_to_active(priv); - if (ret) - goto exit; diff --git a/package/kernel/mac80211/patches/653-0007-rtl8xxxu-8188e-Enable-scheduler.patch b/package/kernel/mac80211/patches/653-0007-rtl8xxxu-8188e-Enable-scheduler.patch deleted file mode 100644 index 99f9152ca..000000000 --- a/package/kernel/mac80211/patches/653-0007-rtl8xxxu-8188e-Enable-scheduler.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 682ffd261c494581b8fdbc81f42035a53c67f5c4 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 11:07:13 -0400 -Subject: [PATCH] rtl8xxxu: 8188e: Enable scheduler - -This enables the schduler, DMA, etc, except for MAC RX/TX which has to -be set after REG_TRXFF_BNDY due to a hardware bug in the 8188e - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -172,6 +172,7 @@ exit: - - static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) - { -+ u16 val16; - int ret; - - rtl8188e_disabled_to_emu(priv); -@@ -180,6 +181,21 @@ static int rtl8188eu_power_on(struct rtl - if (ret) - goto exit; - -+ /* -+ * Enable MAC DMA/WMAC/SCHEDULE/SEC block -+ * Set CR bit10 to enable 32k calibration. -+ * We do not set CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE here -+ * due to a hardware bug in the 88E, requiring those to be -+ * set after REG_TRXFF_BNDY is set. If not the RXFF bundary -+ * will get set to a larger buffer size than the real buffer -+ * size. -+ */ -+ val16 = (CR_HCI_TXDMA_ENABLE | CR_HCI_RXDMA_ENABLE | -+ CR_TXDMA_ENABLE | CR_RXDMA_ENABLE | -+ CR_PROTOCOL_ENABLE | CR_SCHEDULE_ENABLE | -+ CR_SECURITY_ENABLE | CR_CALTIMER_ENABLE); -+ rtl8xxxu_write16(priv, REG_CR, val16); -+ - exit: - return ret; - } diff --git a/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch b/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch deleted file mode 100644 index fa62d6d9b..000000000 --- a/package/kernel/mac80211/patches/653-0008-rtl8xxxu-Add-rtl8188e_usb_quirk-for-enabling-MAC-TX-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 58edb5e9811879e0a8e87f90057f12f615eab2d1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 11:47:10 -0400 -Subject: [PATCH] rtl8xxxu: Add rtl8188e_usb_quirk() for enabling MAC TX/RX - -Due to a bug in the 8188e chips, this has to be done after setting -REG_TRXFF_BNDY. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -200,9 +200,24 @@ exit: - return ret; - } - -+static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) -+{ -+ u16 val16; -+ -+ /* -+ * Technically this is not a USB quirk, but a chip quirk. -+ * This has to be done after REG_TRXFF_BNDY is set, see -+ * rtl8188eu_power_on() for details. -+ */ -+ val16 = rtl8xxxu_read16(priv, REG_CR); -+ val16 |= (CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE); -+ rtl8xxxu_write16(priv, REG_CR, val16); -+} -+ - struct rtl8xxxu_fileops rtl8188eu_fops = { - .parse_efuse = rtl8188eu_parse_efuse, - .load_firmware = rtl8188eu_load_firmware, - .power_on = rtl8188eu_power_on, - .reset_8051 = rtl8xxxu_reset_8051, -+ .usb_quirks = rtl8188e_usb_quirks, - }; diff --git a/package/kernel/mac80211/patches/653-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch b/package/kernel/mac80211/patches/653-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch deleted file mode 100644 index 8a2821640..000000000 --- a/package/kernel/mac80211/patches/653-0009-rtl8xxxu-8188e-add-REG_TXDMA_OFFSET_CHK-quirk.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 3ab047939db70fcae2a7c5993a8feaf3ac413e35 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 11:53:31 -0400 -Subject: [PATCH] rtl8xxxu: 8188e add REG_TXDMA_OFFSET_CHK quirk - -Enable quirk allowing TX DMA to drop redundant data of packet. This is -the same quirk enabled on gen2 parts. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -203,6 +203,7 @@ exit: - static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) - { - u16 val16; -+ u32 val32; - - /* - * Technically this is not a USB quirk, but a chip quirk. -@@ -212,6 +213,10 @@ static void rtl8188e_usb_quirks(struct r - val16 = rtl8xxxu_read16(priv, REG_CR); - val16 |= (CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE); - rtl8xxxu_write16(priv, REG_CR, val16); -+ -+ val32 = rtl8xxxu_read32(priv, REG_TXDMA_OFFSET_CHK); -+ val32 |= TXDMA_OFFSET_DROP_DATA_EN; -+ rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, val32); - } - - struct rtl8xxxu_fileops rtl8188eu_fops = { diff --git a/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch b/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch deleted file mode 100644 index 424b3b313..000000000 --- a/package/kernel/mac80211/patches/653-0010-rtl8xxxu-Add-reserved-page-init-parameters-for-8188e.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 2bfba2657e3f99c6693ea30b60af4eb1d3e3950c Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 12:02:18 -0400 -Subject: [PATCH] rtl8xxxu: Add reserved page init parameters for 8188e - -Signed-off-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 ++++++ - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 4 ++++ - 2 files changed, 10 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -43,6 +43,7 @@ - #define REALTEK_USB_CMD_IDX 0x00 - - #define TX_TOTAL_PAGE_NUM 0xf8 -+#define TX_TOTAL_PAGE_NUM_8188E 0xa8 - #define TX_TOTAL_PAGE_NUM_8192E 0xf3 - #define TX_TOTAL_PAGE_NUM_8723B 0xf7 - /* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */ -@@ -51,6 +52,11 @@ - #define TX_PAGE_NUM_LO_PQ 0x02 - #define TX_PAGE_NUM_NORM_PQ 0x02 - -+#define TX_PAGE_NUM_PUBQ_8188E 0x47 -+#define TX_PAGE_NUM_HI_PQ_8188E 0x29 -+#define TX_PAGE_NUM_LO_PQ_8188E 0x1c -+#define TX_PAGE_NUM_NORM_PQ_8188E 0x1c -+ - #define TX_PAGE_NUM_PUBQ_8192E 0xe7 - #define TX_PAGE_NUM_HI_PQ_8192E 0x08 - #define TX_PAGE_NUM_LO_PQ_8192E 0x0c ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -225,4 +225,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .reset_8051 = rtl8xxxu_reset_8051, - .usb_quirks = rtl8188e_usb_quirks, -+ .total_page_num = TX_TOTAL_PAGE_NUM_8188E, -+ .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, -+ .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, -+ .page_num_norm = TX_PAGE_NUM_NORM_PQ_8188E, - }; diff --git a/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch b/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch deleted file mode 100644 index 5318f32ae..000000000 --- a/package/kernel/mac80211/patches/653-0011-rtl8xxxu-Correct-TX_TOTAL_PAGE_NUM-for-8188eu.patch +++ /dev/null @@ -1,24 +0,0 @@ -From ed4c1c87b4c2653f1528c886591bbddbb68216a1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 8 Aug 2016 15:04:36 -0400 -Subject: [PATCH] rtl8xxxu: Correct TX_TOTAL_PAGE_NUM for 8188eu - -For some reason I had gotten this off-by-one when pulling them number -from the vendor driver. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -43,7 +43,7 @@ - #define REALTEK_USB_CMD_IDX 0x00 - - #define TX_TOTAL_PAGE_NUM 0xf8 --#define TX_TOTAL_PAGE_NUM_8188E 0xa8 -+#define TX_TOTAL_PAGE_NUM_8188E 0xa9 - #define TX_TOTAL_PAGE_NUM_8192E 0xf3 - #define TX_TOTAL_PAGE_NUM_8723B 0xf7 - /* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */ diff --git a/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch b/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch deleted file mode 100644 index 828799ae4..000000000 --- a/package/kernel/mac80211/patches/653-0012-rtl8xxxu-Add-trxff_boundary-for-8188e.patch +++ /dev/null @@ -1,28 +0,0 @@ -From bc55b854b404de79353547013a8f1ae31855f7c5 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 12:08:31 -0400 -Subject: [PATCH] rtl8xxxu: Add trxff_boundary for 8188e - -The 8188e presumably has a 10K buffer, but leave space for TX report -or WOL pattern. - -Signed-off-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -225,6 +225,11 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .reset_8051 = rtl8xxxu_reset_8051, - .usb_quirks = rtl8188e_usb_quirks, -+ /* -+ * Use 9K for 8188e normal chip -+ * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) -+ */ -+ .trxff_boundary = 0x23ff, - .total_page_num = TX_TOTAL_PAGE_NUM_8188E, - .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, - .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, diff --git a/package/kernel/mac80211/patches/653-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch b/package/kernel/mac80211/patches/653-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch deleted file mode 100644 index 5076307a9..000000000 --- a/package/kernel/mac80211/patches/653-0013-rtl8xxxu-8188eu-specify-firmware-block-size-and-set-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 29311af488cc1c1790a9b53c8073442548edd4bf Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 29 Jun 2016 15:03:54 -0400 -Subject: [PATCH] rtl8xxxu: 8188eu specify firmware block size and set - power_off function - -This uses a conservative firmware block size for now. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -223,8 +223,10 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .parse_efuse = rtl8188eu_parse_efuse, - .load_firmware = rtl8188eu_load_firmware, - .power_on = rtl8188eu_power_on, -+ .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, - .usb_quirks = rtl8188e_usb_quirks, -+ .writeN_block_size = 128, - /* - * Use 9K for 8188e normal chip - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Add-8188e-mac-init-table.patch b/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Add-8188e-mac-init-table.patch deleted file mode 100644 index 5360f5928..000000000 --- a/package/kernel/mac80211/patches/653-0014-rtl8xxxu-Add-8188e-mac-init-table.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 96cb7475c4c5750e8dac3dc85638f8438b9bce4e Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 19 Jul 2016 15:04:24 -0400 -Subject: [PATCH] rtl8xxxu: Add 8188e mac init table - -This table was pulled from the vendor driver. - -Signed-off-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 28 ++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -40,6 +40,33 @@ - #include "rtl8xxxu.h" - #include "rtl8xxxu_regs.h" - -+static struct rtl8xxxu_reg8val rtl8188e_mac_init_table[] = { -+ {0x026, 0x41}, {0x027, 0x35}, {0x428, 0x0a}, {0x429, 0x10}, -+ {0x430, 0x00}, {0x431, 0x01}, {0x432, 0x02}, {0x433, 0x04}, -+ {0x434, 0x05}, {0x435, 0x06}, {0x436, 0x07}, {0x437, 0x08}, -+ {0x438, 0x00}, {0x439, 0x00}, {0x43a, 0x01}, {0x43b, 0x02}, -+ {0x43c, 0x04}, {0x43d, 0x05}, {0x43e, 0x06}, {0x43f, 0x07}, -+ {0x440, 0x5d}, {0x441, 0x01}, {0x442, 0x00}, {0x444, 0x15}, -+ {0x445, 0xf0}, {0x446, 0x0f}, {0x447, 0x00}, {0x458, 0x41}, -+ {0x459, 0xa8}, {0x45a, 0x72}, {0x45b, 0xb9}, {0x460, 0x66}, -+ {0x461, 0x66}, {0x480, 0x08}, {0x4c8, 0xff}, {0x4c9, 0x08}, -+ {0x4cc, 0xff}, {0x4cd, 0xff}, {0x4ce, 0x01}, {0x4d3, 0x01}, -+ {0x500, 0x26}, {0x501, 0xa2}, {0x502, 0x2f}, {0x503, 0x00}, -+ {0x504, 0x28}, {0x505, 0xa3}, {0x506, 0x5e}, {0x507, 0x00}, -+ {0x508, 0x2b}, {0x509, 0xa4}, {0x50a, 0x5e}, {0x50b, 0x00}, -+ {0x50c, 0x4f}, {0x50d, 0xa4}, {0x50e, 0x00}, {0x50f, 0x00}, -+ {0x512, 0x1c}, {0x514, 0x0a}, {0x516, 0x0a}, {0x525, 0x4f}, -+ {0x550, 0x10}, {0x551, 0x10}, {0x559, 0x02}, {0x55d, 0xff}, -+ {0x605, 0x30}, {0x608, 0x0e}, {0x609, 0x2a}, {0x620, 0xff}, -+ {0x621, 0xff}, {0x622, 0xff}, {0x623, 0xff}, {0x624, 0xff}, -+ {0x625, 0xff}, {0x626, 0xff}, {0x627, 0xff}, {0x652, 0x20}, -+ {0x63c, 0x0a}, {0x63d, 0x0a}, {0x63e, 0x0e}, {0x63f, 0x0e}, -+ {0x640, 0x40}, {0x66e, 0x05}, {0x700, 0x21}, {0x701, 0x43}, -+ {0x702, 0x65}, {0x703, 0x87}, {0x708, 0x21}, {0x709, 0x43}, -+ {0x70a, 0x65}, {0x70b, 0x87}, -+ {0xffff, 0xff}, -+}; -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -232,6 +259,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) - */ - .trxff_boundary = 0x23ff, -+ .mactable = rtl8188e_mac_init_table, - .total_page_num = TX_TOTAL_PAGE_NUM_8188E, - .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, - .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, diff --git a/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch b/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch deleted file mode 100644 index e7c5b7b65..000000000 --- a/package/kernel/mac80211/patches/653-0015-rtl8xxxu-Implement-rtl8188eu_init_phy_bb.patch +++ /dev/null @@ -1,245 +0,0 @@ -From b6770f88fd208978bd84e7217fee9fedd9b3fa9f Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 19 Jul 2016 16:19:30 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_init_phy_bb() - -This includes adding rtl8188eu_phy_init_table rtl8188e_agc_table, both -extracted from the vendor driver. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 202 +++++++++++++++++++++ - 1 file changed, 202 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -67,6 +67,174 @@ static struct rtl8xxxu_reg8val rtl8188e_ - {0xffff, 0xff}, - }; - -+static struct rtl8xxxu_reg32val rtl8188eu_phy_init_table[] = { -+ {0x800, 0x80040000}, {0x804, 0x00000003}, -+ {0x808, 0x0000fc00}, {0x80c, 0x0000000a}, -+ {0x810, 0x10001331}, {0x814, 0x020c3d10}, -+ {0x818, 0x02200385}, {0x81c, 0x00000000}, -+ {0x820, 0x01000100}, {0x824, 0x00390204}, -+ {0x828, 0x00000000}, {0x82c, 0x00000000}, -+ {0x830, 0x00000000}, {0x834, 0x00000000}, -+ {0x838, 0x00000000}, {0x83c, 0x00000000}, -+ {0x840, 0x00010000}, {0x844, 0x00000000}, -+ {0x848, 0x00000000}, {0x84c, 0x00000000}, -+ {0x850, 0x00000000}, {0x854, 0x00000000}, -+ {0x858, 0x569a11a9}, {0x85c, 0x01000014}, -+ {0x860, 0x66f60110}, {0x864, 0x061f0649}, -+ {0x868, 0x00000000}, {0x86c, 0x27272700}, -+ {0x870, 0x07000760}, {0x874, 0x25004000}, -+ {0x878, 0x00000808}, {0x87c, 0x00000000}, -+ {0x880, 0xb0000c1c}, {0x884, 0x00000001}, -+ {0x888, 0x00000000}, {0x88c, 0xccc000c0}, -+ {0x890, 0x00000800}, {0x894, 0xfffffffe}, -+ {0x898, 0x40302010}, {0x89c, 0x00706050}, -+ {0x900, 0x00000000}, {0x904, 0x00000023}, -+ {0x908, 0x00000000}, {0x90c, 0x81121111}, -+ {0x910, 0x00000002}, {0x914, 0x00000201}, -+ {0xa00, 0x00d047c8}, {0xa04, 0x80ff000c}, -+ {0xa08, 0x8c838300}, {0xa0c, 0x2e7f120f}, -+ {0xa10, 0x9500bb78}, {0xa14, 0x1114d028}, -+ {0xa18, 0x00881117}, {0xa1c, 0x89140f00}, -+ {0xa20, 0x1a1b0000}, {0xa24, 0x090e1317}, -+ {0xa28, 0x00000204}, {0xa2c, 0x00d30000}, -+ {0xa70, 0x101fbf00}, {0xa74, 0x00000007}, -+ {0xa78, 0x00000900}, {0xa7c, 0x225b0606}, -+ {0xa80, 0x218075b1}, {0xb2c, 0x80000000}, -+ {0xc00, 0x48071d40}, {0xc04, 0x03a05611}, -+ {0xc08, 0x000000e4}, {0xc0c, 0x6c6c6c6c}, -+ {0xc10, 0x08800000}, {0xc14, 0x40000100}, -+ {0xc18, 0x08800000}, {0xc1c, 0x40000100}, -+ {0xc20, 0x00000000}, {0xc24, 0x00000000}, -+ {0xc28, 0x00000000}, {0xc2c, 0x00000000}, -+ {0xc30, 0x69e9ac47}, {0xc34, 0x469652af}, -+ {0xc38, 0x49795994}, {0xc3c, 0x0a97971c}, -+ {0xc40, 0x1f7c403f}, {0xc44, 0x000100b7}, -+ {0xc48, 0xec020107}, {0xc4c, 0x007f037f}, -+ {0xc50, 0x69553420}, {0xc54, 0x43bc0094}, -+ {0xc58, 0x00013169}, {0xc5c, 0x00250492}, -+ {0xc60, 0x00000000}, {0xc64, 0x7112848b}, -+ {0xc68, 0x47c00bff}, {0xc6c, 0x00000036}, -+ {0xc70, 0x2c7f000d}, {0xc74, 0x020610db}, -+ {0xc78, 0x0000001f}, {0xc7c, 0x00b91612}, -+ {0xc80, 0x390000e4}, {0xc84, 0x20f60000}, -+ {0xc88, 0x40000100}, {0xc8c, 0x20200000}, -+ {0xc90, 0x00091521}, {0xc94, 0x00000000}, -+ {0xc98, 0x00121820}, {0xc9c, 0x00007f7f}, -+ {0xca0, 0x00000000}, {0xca4, 0x000300a0}, -+ {0xca8, 0x00000000}, {0xcac, 0x00000000}, -+ {0xcb0, 0x00000000}, {0xcb4, 0x00000000}, -+ {0xcb8, 0x00000000}, {0xcbc, 0x28000000}, -+ {0xcc0, 0x00000000}, {0xcc4, 0x00000000}, -+ {0xcc8, 0x00000000}, {0xccc, 0x00000000}, -+ {0xcd0, 0x00000000}, {0xcd4, 0x00000000}, -+ {0xcd8, 0x64b22427}, {0xcdc, 0x00766932}, -+ {0xce0, 0x00222222}, {0xce4, 0x00000000}, -+ {0xce8, 0x37644302}, {0xcec, 0x2f97d40c}, -+ {0xd00, 0x00000740}, {0xd04, 0x00020401}, -+ {0xd08, 0x0000907f}, {0xd0c, 0x20010201}, -+ {0xd10, 0xa0633333}, {0xd14, 0x3333bc43}, -+ {0xd18, 0x7a8f5b6f}, {0xd2c, 0xcc979975}, -+ {0xd30, 0x00000000}, {0xd34, 0x80608000}, -+ {0xd38, 0x00000000}, {0xd3c, 0x00127353}, -+ {0xd40, 0x00000000}, {0xd44, 0x00000000}, -+ {0xd48, 0x00000000}, {0xd4c, 0x00000000}, -+ {0xd50, 0x6437140a}, {0xd54, 0x00000000}, -+ {0xd58, 0x00000282}, {0xd5c, 0x30032064}, -+ {0xd60, 0x4653de68}, {0xd64, 0x04518a3c}, -+ {0xd68, 0x00002101}, {0xd6c, 0x2a201c16}, -+ {0xd70, 0x1812362e}, {0xd74, 0x322c2220}, -+ {0xd78, 0x000e3c24}, {0xe00, 0x2d2d2d2d}, -+ {0xe04, 0x2d2d2d2d}, {0xe08, 0x0390272d}, -+ {0xe10, 0x2d2d2d2d}, {0xe14, 0x2d2d2d2d}, -+ {0xe18, 0x2d2d2d2d}, {0xe1c, 0x2d2d2d2d}, -+ {0xe28, 0x00000000}, {0xe30, 0x1000dc1f}, -+ {0xe34, 0x10008c1f}, {0xe38, 0x02140102}, -+ {0xe3c, 0x681604c2}, {0xe40, 0x01007c00}, -+ {0xe44, 0x01004800}, {0xe48, 0xfb000000}, -+ {0xe4c, 0x000028d1}, {0xe50, 0x1000dc1f}, -+ {0xe54, 0x10008c1f}, {0xe58, 0x02140102}, -+ {0xe5c, 0x28160d05}, {0xe60, 0x00000008}, -+ {0xe68, 0x001b25a4}, {0xe6c, 0x00c00014}, -+ {0xe70, 0x00c00014}, {0xe74, 0x01000014}, -+ {0xe78, 0x01000014}, {0xe7c, 0x01000014}, -+ {0xe80, 0x01000014}, {0xe84, 0x00c00014}, -+ {0xe88, 0x01000014}, {0xe8c, 0x00c00014}, -+ {0xed0, 0x00c00014}, {0xed4, 0x00c00014}, -+ {0xed8, 0x00c00014}, {0xedc, 0x00000014}, -+ {0xee0, 0x00000014}, {0xeec, 0x01c00014}, -+ {0xf14, 0x00000003}, {0xf4c, 0x00000000}, -+ {0xf00, 0x00000300}, -+ {0xffff, 0xffffffff}, -+}; -+ -+static struct rtl8xxxu_reg32val rtl8188e_agc_table[] = { -+ {0xc78, 0xfb000001}, {0xc78, 0xfb010001}, -+ {0xc78, 0xfb020001}, {0xc78, 0xfb030001}, -+ {0xc78, 0xfb040001}, {0xc78, 0xfb050001}, -+ {0xc78, 0xfa060001}, {0xc78, 0xf9070001}, -+ {0xc78, 0xf8080001}, {0xc78, 0xf7090001}, -+ {0xc78, 0xf60a0001}, {0xc78, 0xf50b0001}, -+ {0xc78, 0xf40c0001}, {0xc78, 0xf30d0001}, -+ {0xc78, 0xf20e0001}, {0xc78, 0xf10f0001}, -+ {0xc78, 0xf0100001}, {0xc78, 0xef110001}, -+ {0xc78, 0xee120001}, {0xc78, 0xed130001}, -+ {0xc78, 0xec140001}, {0xc78, 0xeb150001}, -+ {0xc78, 0xea160001}, {0xc78, 0xe9170001}, -+ {0xc78, 0xe8180001}, {0xc78, 0xe7190001}, -+ {0xc78, 0xe61a0001}, {0xc78, 0xe51b0001}, -+ {0xc78, 0xe41c0001}, {0xc78, 0xe31d0001}, -+ {0xc78, 0xe21e0001}, {0xc78, 0xe11f0001}, -+ {0xc78, 0x8a200001}, {0xc78, 0x89210001}, -+ {0xc78, 0x88220001}, {0xc78, 0x87230001}, -+ {0xc78, 0x86240001}, {0xc78, 0x85250001}, -+ {0xc78, 0x84260001}, {0xc78, 0x83270001}, -+ {0xc78, 0x82280001}, {0xc78, 0x6b290001}, -+ {0xc78, 0x6a2a0001}, {0xc78, 0x692b0001}, -+ {0xc78, 0x682c0001}, {0xc78, 0x672d0001}, -+ {0xc78, 0x662e0001}, {0xc78, 0x652f0001}, -+ {0xc78, 0x64300001}, {0xc78, 0x63310001}, -+ {0xc78, 0x62320001}, {0xc78, 0x61330001}, -+ {0xc78, 0x46340001}, {0xc78, 0x45350001}, -+ {0xc78, 0x44360001}, {0xc78, 0x43370001}, -+ {0xc78, 0x42380001}, {0xc78, 0x41390001}, -+ {0xc78, 0x403a0001}, {0xc78, 0x403b0001}, -+ {0xc78, 0x403c0001}, {0xc78, 0x403d0001}, -+ {0xc78, 0x403e0001}, {0xc78, 0x403f0001}, -+ {0xc78, 0xfb400001}, {0xc78, 0xfb410001}, -+ {0xc78, 0xfb420001}, {0xc78, 0xfb430001}, -+ {0xc78, 0xfb440001}, {0xc78, 0xfb450001}, -+ {0xc78, 0xfb460001}, {0xc78, 0xfb470001}, -+ {0xc78, 0xfb480001}, {0xc78, 0xfa490001}, -+ {0xc78, 0xf94a0001}, {0xc78, 0xf84b0001}, -+ {0xc78, 0xf74c0001}, {0xc78, 0xf64d0001}, -+ {0xc78, 0xf54e0001}, {0xc78, 0xf44f0001}, -+ {0xc78, 0xf3500001}, {0xc78, 0xf2510001}, -+ {0xc78, 0xf1520001}, {0xc78, 0xf0530001}, -+ {0xc78, 0xef540001}, {0xc78, 0xee550001}, -+ {0xc78, 0xed560001}, {0xc78, 0xec570001}, -+ {0xc78, 0xeb580001}, {0xc78, 0xea590001}, -+ {0xc78, 0xe95a0001}, {0xc78, 0xe85b0001}, -+ {0xc78, 0xe75c0001}, {0xc78, 0xe65d0001}, -+ {0xc78, 0xe55e0001}, {0xc78, 0xe45f0001}, -+ {0xc78, 0xe3600001}, {0xc78, 0xe2610001}, -+ {0xc78, 0xc3620001}, {0xc78, 0xc2630001}, -+ {0xc78, 0xc1640001}, {0xc78, 0x8b650001}, -+ {0xc78, 0x8a660001}, {0xc78, 0x89670001}, -+ {0xc78, 0x88680001}, {0xc78, 0x87690001}, -+ {0xc78, 0x866a0001}, {0xc78, 0x856b0001}, -+ {0xc78, 0x846c0001}, {0xc78, 0x676d0001}, -+ {0xc78, 0x666e0001}, {0xc78, 0x656f0001}, -+ {0xc78, 0x64700001}, {0xc78, 0x63710001}, -+ {0xc78, 0x62720001}, {0xc78, 0x61730001}, -+ {0xc78, 0x60740001}, {0xc78, 0x46750001}, -+ {0xc78, 0x45760001}, {0xc78, 0x44770001}, -+ {0xc78, 0x43780001}, {0xc78, 0x42790001}, -+ {0xc78, 0x417a0001}, {0xc78, 0x407b0001}, -+ {0xc78, 0x407c0001}, {0xc78, 0x407d0001}, -+ {0xc78, 0x407e0001}, {0xc78, 0x407f0001}, -+ {0xffff, 0xffffffff} -+}; -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -89,6 +257,8 @@ static int rtl8188eu_parse_efuse(struct - priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, - sizeof(priv->ht40_1s_tx_power_index_B)); - -+ priv->xtalk = priv->efuse_wifi.efuse8188eu.xtal_k & 0x3f; -+ - dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); - dev_info(&priv->udev->dev, "Product: %.11s\n", efuse->device_name); - dev_info(&priv->udev->dev, "Serial: %.11s\n", efuse->serial); -@@ -119,6 +289,37 @@ static int rtl8188eu_load_firmware(struc - return ret; - } - -+static void rtl8188eu_init_phy_bb(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ u16 val16; -+ u32 val32; -+ -+ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ val16 |= SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB | SYS_FUNC_DIO_RF; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); -+ -+ /* -+ * Per vendor driver, run power sequence before init of RF -+ */ -+ val8 = RF_ENABLE | RF_RSTB | RF_SDMRSTB; -+ rtl8xxxu_write8(priv, REG_RF_CTRL, val8); -+ -+ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ val16 |= (SYS_FUNC_USBA | SYS_FUNC_USBD | -+ SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB); -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); -+ -+ rtl8xxxu_init_phy_regs(priv, rtl8188eu_phy_init_table); -+ rtl8xxxu_init_phy_regs(priv, rtl8188e_agc_table); -+ -+ val32 = rtl8xxxu_read32(priv, REG_AFE_XTAL_CTRL); -+ val8 = priv->xtalk; -+ val32 &= 0xff8007ff; -+ val32 |= ((val8 | (val8 << 6)) << 11); -+ rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); -+} -+ - static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -252,6 +453,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, -+ .init_phy_bb = rtl8188eu_init_phy_bb, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, - /* diff --git a/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch b/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch deleted file mode 100644 index 89e481cdc..000000000 --- a/package/kernel/mac80211/patches/653-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0c6fa292a9c6d7f1b870c42ed9166674463206f1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 19 Jul 2016 17:12:42 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_init_phy_rf() - -Include the table rtl8188eu_radioa_init_table derived from vendor -driver. The vendor table relies on a hack setting RF6052_REG_RCK1 + -RF6052_REG_RCK2 with delays. This workaround is open coded here -instead of modifying the table parsing code. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 65 ++++++++++++++++++++++ - 1 file changed, 65 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -235,6 +235,54 @@ static struct rtl8xxxu_reg32val rtl8188e - {0xffff, 0xffffffff} - }; - -+static struct rtl8xxxu_rfregval rtl8188eu_radioa_init_table[] = { -+ {0x00, 0x00030000}, {0x08, 0x00084000}, -+ {0x18, 0x00000407}, {0x19, 0x00000012}, -+ {0x1e, 0x00080009}, {0x1f, 0x00000880}, -+ {0x2f, 0x0001a060}, {0x3f, 0x00000000}, -+ {0x42, 0x000060c0}, {0x57, 0x000d0000}, -+ {0x58, 0x000be180}, {0x67, 0x00001552}, -+ {0x83, 0x00000000}, {0xb0, 0x000ff8fc}, -+ {0xb1, 0x00054400}, {0xb2, 0x000ccc19}, -+ {0xb4, 0x00043003}, {0xb6, 0x0004953e}, -+ {0xb7, 0x0001c718}, {0xb8, 0x000060ff}, -+ {0xb9, 0x00080001}, {0xba, 0x00040000}, -+ {0xbb, 0x00000400}, {0xbf, 0x000c0000}, -+ {0xc2, 0x00002400}, {0xc3, 0x00000009}, -+ {0xc4, 0x00040c91}, {0xc5, 0x00099999}, -+ {0xc6, 0x000000a3}, {0xc7, 0x00088820}, -+ {0xc8, 0x00076c06}, {0xc9, 0x00000000}, -+ {0xca, 0x00080000}, {0xdf, 0x00000180}, -+ {0xef, 0x000001a0}, {0x51, 0x0006b27d}, -+ {0x52, 0x0007e49d}, /* Set to 0x0007e4dd for SDIO */ -+ {0x53, 0x00000073}, {0x56, 0x00051ff3}, -+ {0x35, 0x00000086}, {0x35, 0x00000186}, -+ {0x35, 0x00000286}, {0x36, 0x00001c25}, -+ {0x36, 0x00009c25}, {0x36, 0x00011c25}, -+ {0x36, 0x00019c25}, {0xb6, 0x00048538}, -+ {0x18, 0x00000c07}, {0x5a, 0x0004bd00}, -+ {0x19, 0x000739d0}, {0x34, 0x0000adf3}, -+ {0x34, 0x00009df0}, {0x34, 0x00008ded}, -+ {0x34, 0x00007dea}, {0x34, 0x00006de7}, -+ {0x34, 0x000054ee}, {0x34, 0x000044eb}, -+ {0x34, 0x000034e8}, {0x34, 0x0000246b}, -+ {0x34, 0x00001468}, {0x34, 0x0000006d}, -+ {0x00, 0x00030159}, {0x84, 0x00068200}, -+ {0x86, 0x000000ce}, {0x87, 0x00048a00}, -+ {0x8e, 0x00065540}, {0x8f, 0x00088000}, -+ {0xef, 0x000020a0}, {0x3b, 0x000f02b0}, -+ {0x3b, 0x000ef7b0}, {0x3b, 0x000d4fb0}, -+ {0x3b, 0x000cf060}, {0x3b, 0x000b0090}, -+ {0x3b, 0x000a0080}, {0x3b, 0x00090080}, -+ {0x3b, 0x0008f780}, {0x3b, 0x000722b0}, -+ {0x3b, 0x0006f7b0}, {0x3b, 0x00054fb0}, -+ {0x3b, 0x0004f060}, {0x3b, 0x00030090}, -+ {0x3b, 0x00020080}, {0x3b, 0x00010080}, -+ {0x3b, 0x0000f780}, {0xef, 0x000000a0}, -+ {0x00, 0x00010159}, {0x18, 0x0000f407}, -+ {0xff, 0xffffffff} -+}; -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -320,6 +368,22 @@ static void rtl8188eu_init_phy_bb(struct - rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32); - } - -+static int rtl8188eu_init_phy_rf(struct rtl8xxxu_priv *priv) -+{ -+ int ret; -+ -+ ret = rtl8xxxu_init_phy_rf(priv, rtl8188eu_radioa_init_table, RF_A); -+ -+ msleep(100); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK2, 0x80003); -+ msleep(100); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK1, 0x00001); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK2, 0x80000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0x33e60); -+ -+ return ret; -+} -+ - static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -454,6 +518,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, - .init_phy_bb = rtl8188eu_init_phy_bb, -+ .init_phy_rf = rtl8188eu_init_phy_rf, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, - /* diff --git a/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch b/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch deleted file mode 100644 index da306deb1..000000000 --- a/package/kernel/mac80211/patches/653-0017-rtl8xxxu-Use-auto-LLT-init-for-8188e.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 86d5a5f8e59e46c51a76a303f37ad6ce9c97b73e Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 19 Jul 2016 17:27:48 -0400 -Subject: [PATCH] rtl8xxxu: Use auto LLT init for 8188e - -The vendor driver uses IOL to init the LLT table for 8188e. Since we -are trying to avoid dealing with IOL for now, gamble that auto LLT -will work. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -517,6 +517,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8xxxu_reset_8051, -+ .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, - .usb_quirks = rtl8188e_usb_quirks, diff --git a/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch b/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch deleted file mode 100644 index 7d150eb31..000000000 --- a/package/kernel/mac80211/patches/653-0018-rtl8xxxu-Do-not-set-REG_FPGA0_TX_INFO-on-8188eu.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 519d0047f84cdd1050418bb86dd34a0c6df1206a Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 14:32:46 -0400 -Subject: [PATCH] rtl8xxxu: Do not set REG_FPGA0_TX_INFO on 8188eu - -The vendor driver doesn't set this for 8188eu either. It is unclear if -this is only relevant for gen1 parts. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3962,7 +3962,8 @@ static int rtl8xxxu_init_device(struct i - goto exit; - - /* RFSW Control - clear bit 14 ?? */ -- if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E) -+ if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E && -+ priv->rtl_chip != RTL8188E) - rtl8xxxu_write32(priv, REG_FPGA0_TX_INFO, 0x00000003); - - val32 = FPGA0_RF_TRSW | FPGA0_RF_TRSWB | FPGA0_RF_ANTSW | diff --git a/package/kernel/mac80211/patches/653-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch b/package/kernel/mac80211/patches/653-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch deleted file mode 100644 index 0a3bab052..000000000 --- a/package/kernel/mac80211/patches/653-0019-rtl8xxxu-Do-not-mess-with-REG_FPGA0_XA_RF_INT_OE-eit.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a4234121f383eed37e0a5ea8aed56bb75027305c Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 14:38:23 -0400 -Subject: [PATCH] rtl8xxxu: Do not mess with REG_FPGA0_XA_RF_INT_OE either on - 8188eu - -On older devices the vendor driver hard codes a value into -REG_FPGA0_XA_RF_INT_OE for antenna selection. This probably shouldn't -be done in the first place, but more investigation needs to be done to -figure out how this really works. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -3976,7 +3976,7 @@ static int rtl8xxxu_init_device(struct i - rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32); - - /* 0x860[6:5]= 00 - why? - this sets antenna B */ -- if (priv->rtl_chip != RTL8192E) -+ if (priv->rtl_chip != RTL8192E && priv->rtl_chip != RTL8188E) - rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, 0x66f60210); - - if (!macpower) { diff --git a/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch b/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch deleted file mode 100644 index 595d1430f..000000000 --- a/package/kernel/mac80211/patches/653-0020-rtl8xxxu-Set-transfer-page-size-for-8188eu.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 497b244578992c6353d214140f026154e4f4f710 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 15:59:31 -0400 -Subject: [PATCH] rtl8xxxu: Set transfer page size for 8188eu - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -527,6 +527,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) - */ - .trxff_boundary = 0x23ff, -+ .pbp_rx = PBP_PAGE_SIZE_128, -+ .pbp_tx = PBP_PAGE_SIZE_128, - .mactable = rtl8188e_mac_init_table, - .total_page_num = TX_TOTAL_PAGE_NUM_8188E, - .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, diff --git a/package/kernel/mac80211/patches/653-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch b/package/kernel/mac80211/patches/653-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch deleted file mode 100644 index c1bc3fa68..000000000 --- a/package/kernel/mac80211/patches/653-0021-rtl8xxxu-Enable-TX-report-timer-on-8188eu.patch +++ /dev/null @@ -1,22 +0,0 @@ -From a57a3fbb1a22544ce96e4dbe423694e982d54700 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 16:13:06 -0400 -Subject: [PATCH] rtl8xxxu: Enable TX report timer on 8188eu - -The 8188eu uses the same TX report timer as found on the 8723b. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -522,6 +522,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .init_phy_rf = rtl8188eu_init_phy_rf, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, -+ .has_tx_report = 1, - /* - * Use 9K for 8188e normal chip - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/653-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch b/package/kernel/mac80211/patches/653-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch deleted file mode 100644 index 774b2a2bd..000000000 --- a/package/kernel/mac80211/patches/653-0022-rtl8xxxu-Setup-interrupts-for-8188eu.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4c85a1704e555aa04d72e31a4a90b9c4bf01d83b Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 20 Jul 2016 16:59:18 -0400 -Subject: [PATCH] rtl8xxxu: Setup interrupts for 8188eu - -This sets up interrupts for 8188eu, but per vendor driver, it's not -obvious this is really needed for USB devices. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4041,6 +4041,15 @@ static int rtl8xxxu_init_device(struct i - if (priv->rtl_chip == RTL8192E) { - rtl8xxxu_write32(priv, REG_HIMR0, 0x00); - rtl8xxxu_write32(priv, REG_HIMR1, 0x00); -+ } else if (priv->rtl_chip == RTL8188E) { -+ rtl8xxxu_write32(priv, REG_HISR0, 0xffffffff); -+ val32 = IMR0_PSTIMEOUT | IMR0_TBDER | IMR0_CPWM | IMR0_CPWM2; -+ rtl8xxxu_write32(priv, REG_HIMR0, val32); -+ val32 = IMR1_TXERR | IMR1_RXERR | IMR1_TXFOVW | IMR1_RXFOVW; -+ rtl8xxxu_write32(priv, REG_HIMR1, val32); -+ val8 = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); -+ val8 |= USB_SPEC_INT_BULK_SELECT; -+ rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, val8); - } else { - /* - * Enable all interrupts - not obvious USB needs to do this diff --git a/package/kernel/mac80211/patches/653-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch b/package/kernel/mac80211/patches/653-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch deleted file mode 100644 index c46522ecb..000000000 --- a/package/kernel/mac80211/patches/653-0023-rtl8xxxu-Use-rxdesc16-and-32-byte-tx-descriptors-for.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 444b8212457b611f482ee6a5f52e8a14e6881f6e Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 21 Jul 2016 14:52:49 -0400 -Subject: [PATCH] rtl8xxxu: Use rxdesc16 and 32 byte tx descriptors for 8188eu - -The RX descriptor format looks like the gen1 RX descriptor format, so -use that for now. - -The TX descriptor format is different and looks to be some bizarre -hybrid of the gen1 and gen2 formats. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -520,8 +520,11 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, -+ .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, -+ .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), -+ .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .has_tx_report = 1, - /* - * Use 9K for 8188e normal chip diff --git a/package/kernel/mac80211/patches/653-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch b/package/kernel/mac80211/patches/653-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch deleted file mode 100644 index 3177ee35f..000000000 --- a/package/kernel/mac80211/patches/653-0024-rtl8xxxu-8188eu-use-same-ADDA-on-parameters-as-8723a.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 399409ff2196eb6d3f758579b63a1091fff93870 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 21 Jul 2016 15:23:16 -0400 -Subject: [PATCH] rtl8xxxu: 8188eu use same ADDA on parameters as 8723au/8192cu - -For ADDA setup the 8188eu looks to match the gen1 parts. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -526,6 +526,10 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .has_tx_report = 1, -+ .adda_1t_init = 0x0b1b25a0, -+ .adda_1t_path_on = 0x0bdb25a0, -+ .adda_2t_path_on_a = 0x04db25a4, -+ .adda_2t_path_on_b = 0x0b1b25a4, - /* - * Use 9K for 8188e normal chip - * Max RX buffer = 10K - max(TxReportSize(64*8), WOLPattern(16*24)) diff --git a/package/kernel/mac80211/patches/653-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch b/package/kernel/mac80211/patches/653-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch deleted file mode 100644 index ce76a67d9..000000000 --- a/package/kernel/mac80211/patches/653-0025-rtl8xxxu-Add-PHY-IQ-calibration-code-for-8188eu.patch +++ /dev/null @@ -1,521 +0,0 @@ -From 9a3c53da5228607375ab69d6e3cbc375f18a4f82 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Thu, 21 Jul 2016 17:25:56 -0400 -Subject: [PATCH] rtl8xxxu: Add PHY IQ calibration code for 8188eu - -The vendor driver for 8188eu is a bizarre modern style code for path A -and old-style code for path B. Most likely because the 8188eu is a -1T1R part which never gets to the path B code. - -Eventually we should look into unifying all the IQ calibration code. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 489 +++++++++++++++++++++ - 1 file changed, 489 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -384,6 +384,494 @@ static int rtl8188eu_init_phy_rf(struct - return ret; - } - -+static int rtl8188eu_iqk_path_a(struct rtl8xxxu_priv *priv) -+{ -+ u32 reg_eac, reg_e94, reg_e9c; -+ int result = 0; -+ -+ /* Path A IQK setting */ -+ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x10008c1c); -+ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x30008c1c); -+ -+ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x8214032a); -+ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160000); -+ -+ /* LO calibration setting */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x00462911); -+ -+ /* One shot, path A LOK & IQK */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); -+ -+ mdelay(10); -+ -+ /* Check failed */ -+ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); -+ reg_e94 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_A); -+ reg_e9c = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_A); -+ -+ if (!(reg_eac & BIT(28)) && -+ ((reg_e94 & 0x03ff0000) != 0x01420000) && -+ ((reg_e9c & 0x03ff0000) != 0x00420000)) -+ result |= 0x01; -+ -+ return result; -+} -+ -+static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv) -+{ -+ u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32; -+ int result = 0; -+ -+ /* Leave IQK mode */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00); -+ -+ /* Enable path A PA in TX IQK mode */ -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, 0x800a0); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0000f); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf117b); -+ -+ /* PA/PAD control by 0x56, and set = 0x0 */ -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x00980); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_56, 0x51000); -+ -+ /* Enter IQK mode */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); -+ -+ /* TX IQK setting */ -+ rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00); -+ rtl8xxxu_write32(priv, REG_RX_IQK, 0x81004800); -+ -+ /* path-A IQK setting */ -+ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x10008c1c); -+ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x30008c1c); -+ -+ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c1f); -+ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160000); -+ -+ /* LO calibration setting */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a911); -+ -+ /* One shot, path A LOK & IQK */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); -+ -+ mdelay(10); -+ -+ /* Check failed */ -+ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); -+ reg_e94 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_A); -+ reg_e9c = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_A); -+ -+ if (!(reg_eac & BIT(28)) && -+ ((reg_e94 & 0x03ff0000) != 0x01420000) && -+ ((reg_e9c & 0x03ff0000) != 0x00420000)) { -+ result |= 0x01; -+ } else { -+ /* PA/PAD controlled by 0x0 */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x180); -+ goto out; -+ } -+ -+ val32 = 0x80007c00 | -+ (reg_e94 & 0x03ff0000) | ((reg_e9c >> 16) & 0x03ff); -+ rtl8xxxu_write32(priv, REG_TX_IQK, val32); -+ -+ /* Modify RX IQK mode table */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); -+ -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_WE_LUT, 0x800a0); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK_OS, 0x30000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G1, 0x0000f); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_TXPA_G2, 0xf7ffa); -+ -+ /* Enter IQK mode */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); -+ -+ /* IQK setting */ -+ rtl8xxxu_write32(priv, REG_RX_IQK, 0x01004800); -+ -+ /* Path A IQK setting */ -+ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x38008c1c); -+ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x18008c1c); -+ -+ rtl8xxxu_write32(priv, REG_TX_IQK_PI_A, 0x82160c05); -+ rtl8xxxu_write32(priv, REG_RX_IQK_PI_A, 0x28160c1f); -+ -+ /* LO calibration setting */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_RSP, 0x0046a911); -+ -+ /* One shot, path A LOK & IQK */ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000); -+ rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000); -+ -+ mdelay(10); -+ -+ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); -+ reg_ea4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_A_2); -+ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x00000000); -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_UNKNOWN_DF, 0x180); -+ -+ if (!(reg_eac & BIT(27)) && -+ ((reg_ea4 & 0x03ff0000) != 0x01320000) && -+ ((reg_eac & 0x03ff0000) != 0x00360000)) -+ result |= 0x02; -+ else -+ dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n", -+ __func__); -+ -+out: -+ return result; -+} -+ -+static int rtl8188eu_iqk_path_b(struct rtl8xxxu_priv *priv) -+{ -+ u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc; -+ int result = 0; -+ -+ rtl8xxxu_write32(priv, REG_IQK_AGC_CONT, 0x00000002); -+ rtl8xxxu_write32(priv, REG_IQK_AGC_CONT, 0x00000000); -+ -+ mdelay(1); -+ -+ /* Check failed */ -+ reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2); -+ reg_eb4 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); -+ reg_ebc = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); -+ reg_ec4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_B_2); -+ reg_ecc = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_B_2); -+ -+ if (!(reg_eac & BIT(31)) && -+ ((reg_eb4 & 0x03ff0000) != 0x01420000) && -+ ((reg_ebc & 0x03ff0000) != 0x00420000)) -+ result |= 0x01; -+ else -+ dev_warn(&priv->udev->dev, "%s: Path B IQK failed!\n", -+ __func__); -+ -+ if (!(reg_eac & BIT(30)) && -+ ((reg_ec4 & 0x03ff0000) != 0x01320000) && -+ ((reg_ecc & 0x03ff0000) != 0x00360000)) -+ result |= 0x01; -+ else -+ dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n", -+ __func__); -+ -+ return result; -+} -+ -+static void rtl8188eu_phy_iqcalibrate(struct rtl8xxxu_priv *priv, -+ int result[][8], int t) -+{ -+ struct device *dev = &priv->udev->dev; -+ u32 i, val32; -+ int path_a_ok, path_b_ok; -+ int retry = 2; -+ const u32 adda_regs[RTL8XXXU_ADDA_REGS] = { -+ REG_FPGA0_XCD_SWITCH_CTRL, REG_BLUETOOTH, -+ REG_RX_WAIT_CCA, REG_TX_CCK_RFON, -+ REG_TX_CCK_BBON, REG_TX_OFDM_RFON, -+ REG_TX_OFDM_BBON, REG_TX_TO_RX, -+ REG_TX_TO_TX, REG_RX_CCK, -+ REG_RX_OFDM, REG_RX_WAIT_RIFS, -+ REG_RX_TO_RX, REG_STANDBY, -+ REG_SLEEP, REG_PMPD_ANAEN -+ }; -+ const u32 iqk_mac_regs[RTL8XXXU_MAC_REGS] = { -+ REG_TXPAUSE, REG_BEACON_CTRL, -+ REG_BEACON_CTRL_1, REG_GPIO_MUXCFG -+ }; -+ const u32 iqk_bb_regs[RTL8XXXU_BB_REGS] = { -+ REG_OFDM0_TRX_PATH_ENABLE, REG_OFDM0_TR_MUX_PAR, -+ REG_FPGA0_XCD_RF_SW_CTRL, REG_CONFIG_ANT_A, REG_CONFIG_ANT_B, -+ REG_FPGA0_XAB_RF_SW_CTRL, REG_FPGA0_XA_RF_INT_OE, -+ REG_FPGA0_XB_RF_INT_OE, REG_FPGA0_RF_MODE -+ }; -+ -+ /* -+ * Note: IQ calibration must be performed after loading -+ * PHY_REG.txt , and radio_a, radio_b.txt -+ */ -+ -+ if (t == 0) { -+ /* Save ADDA parameters, turn Path A ADDA on */ -+ rtl8xxxu_save_regs(priv, adda_regs, priv->adda_backup, -+ RTL8XXXU_ADDA_REGS); -+ rtl8xxxu_save_mac_regs(priv, iqk_mac_regs, priv->mac_backup); -+ rtl8xxxu_save_regs(priv, iqk_bb_regs, -+ priv->bb_backup, RTL8XXXU_BB_REGS); -+ } -+ -+ rtl8xxxu_path_adda_on(priv, adda_regs, true); -+ -+ if (t == 0) { -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_HSSI_PARM1); -+ if (val32 & FPGA0_HSSI_PARM1_PI) -+ priv->pi_enabled = 1; -+ } -+ -+ if (!priv->pi_enabled) { -+ /* Switch BB to PI mode to do IQ Calibration. */ -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_HSSI_PARM1, 0x01000100); -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_HSSI_PARM1, 0x01000100); -+ } -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); -+ val32 &= ~FPGA_RF_MODE_CCK; -+ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); -+ -+ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, 0x03a05600); -+ rtl8xxxu_write32(priv, REG_OFDM0_TR_MUX_PAR, 0x000800e4); -+ rtl8xxxu_write32(priv, REG_FPGA0_XCD_RF_SW_CTRL, 0x22204000); -+ -+ if (!priv->no_pape) { -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XAB_RF_SW_CTRL); -+ val32 |= (FPGA0_RF_PAPE | -+ (FPGA0_RF_PAPE << FPGA0_RF_BD_CTRL_SHIFT)); -+ rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32); -+ } -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XA_RF_INT_OE); -+ val32 &= ~BIT(10); -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, val32); -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_XB_RF_INT_OE); -+ val32 &= ~BIT(10); -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_RF_INT_OE, val32); -+ -+ if (priv->tx_paths > 1) { -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00010000); -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_LSSI_PARM, 0x00010000); -+ } -+ -+ /* MAC settings */ -+ rtl8xxxu_mac_calibration(priv, iqk_mac_regs, priv->mac_backup); -+ -+ /* Page B init */ -+ rtl8xxxu_write32(priv, REG_CONFIG_ANT_A, 0x0f600000); -+ -+ if (priv->tx_paths > 1) -+ rtl8xxxu_write32(priv, REG_CONFIG_ANT_B, 0x0f600000); -+ -+ /* IQ calibration setting */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); -+ rtl8xxxu_write32(priv, REG_TX_IQK, 0x01007c00); -+ rtl8xxxu_write32(priv, REG_RX_IQK, 0x81004800); -+ -+ for (i = 0; i < retry; i++) { -+ path_a_ok = rtl8188eu_iqk_path_a(priv); -+ if (path_a_ok == 0x01) { -+ val32 = rtl8xxxu_read32(priv, -+ REG_TX_POWER_BEFORE_IQK_A); -+ result[t][0] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, -+ REG_TX_POWER_AFTER_IQK_A); -+ result[t][1] = (val32 >> 16) & 0x3ff; -+ break; -+ } -+ } -+ -+ if (!path_a_ok) -+ dev_dbg(dev, "%s: Path A TX IQK failed!\n", __func__); -+ -+ for (i = 0; i < retry; i++) { -+ path_a_ok = rtl8188eu_rx_iqk_path_a(priv); -+ if (path_a_ok == 0x03) { -+ val32 = rtl8xxxu_read32(priv, -+ REG_RX_POWER_BEFORE_IQK_A_2); -+ result[t][2] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, -+ REG_RX_POWER_AFTER_IQK_A_2); -+ result[t][3] = (val32 >> 16) & 0x3ff; -+ -+ break; -+ } -+ } -+ -+ if (!path_a_ok) -+ dev_dbg(dev, "%s: Path A RX IQK failed!\n", __func__); -+ -+ /* -+ * Path B calibration code in the vendor driver seems to be -+ * old style and not updated for the 8188eu since it's a 1T1R -+ * part. Keeping the code here in sync with the vendor code -+ * to not divert unncessarily, but probably would be good to -+ * look into modernizing all the code including that for the -+ * old gen1 devices -+ */ -+ if (priv->tx_paths > 1) { -+ /* -+ * Path A into standby -+ */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x0); -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00010000); -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0x80800000); -+ -+ /* Turn Path B ADDA on */ -+ rtl8xxxu_path_adda_on(priv, adda_regs, false); -+ -+ for (i = 0; i < retry; i++) { -+ path_b_ok = rtl8188eu_iqk_path_b(priv); -+ if (path_b_ok == 0x03) { -+ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); -+ result[t][4] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); -+ result[t][5] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_B_2); -+ result[t][6] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_B_2); -+ result[t][7] = (val32 >> 16) & 0x3ff; -+ break; -+ } else if (i == (retry - 1) && path_b_ok == 0x01) { -+ /* TX IQK OK */ -+ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_BEFORE_IQK_B); -+ result[t][4] = (val32 >> 16) & 0x3ff; -+ val32 = rtl8xxxu_read32(priv, REG_TX_POWER_AFTER_IQK_B); -+ result[t][5] = (val32 >> 16) & 0x3ff; -+ } -+ } -+ -+ if (!path_b_ok) -+ dev_dbg(dev, "%s: Path B IQK failed!\n", __func__); -+ } -+ -+ /* Back to BB mode, load original value */ -+ rtl8xxxu_write32(priv, REG_FPGA0_IQK, 0); -+ -+ if (t) { -+ if (!priv->pi_enabled) { -+ /* -+ * Switch back BB to SI mode after finishing -+ * IQ Calibration -+ */ -+ val32 = 0x01000000; -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_HSSI_PARM1, val32); -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_HSSI_PARM1, val32); -+ } -+ -+ /* Reload ADDA power saving parameters */ -+ rtl8xxxu_restore_regs(priv, adda_regs, priv->adda_backup, -+ RTL8XXXU_ADDA_REGS); -+ -+ /* Reload MAC parameters */ -+ rtl8xxxu_restore_mac_regs(priv, iqk_mac_regs, priv->mac_backup); -+ -+ /* Reload BB parameters */ -+ rtl8xxxu_restore_regs(priv, iqk_bb_regs, -+ priv->bb_backup, RTL8XXXU_BB_REGS); -+ -+ /* Restore RX initial gain */ -+ rtl8xxxu_write32(priv, REG_FPGA0_XA_LSSI_PARM, 0x00032ed3); -+ -+ if (priv->tx_paths > 1) { -+ rtl8xxxu_write32(priv, REG_FPGA0_XB_LSSI_PARM, -+ 0x00032ed3); -+ } -+ -+ /* Load 0xe30 IQC default value */ -+ rtl8xxxu_write32(priv, REG_TX_IQK_TONE_A, 0x01008c00); -+ rtl8xxxu_write32(priv, REG_RX_IQK_TONE_A, 0x01008c00); -+ } -+} -+ -+static void rtl8188eu_phy_iq_calibrate(struct rtl8xxxu_priv *priv) -+{ -+ struct device *dev = &priv->udev->dev; -+ int result[4][8]; /* last is final result */ -+ int i, candidate; -+ bool path_a_ok, path_b_ok; -+ u32 reg_e94, reg_e9c, reg_ea4, reg_eac; -+ u32 reg_eb4, reg_ebc, reg_ec4, reg_ecc; -+ bool simu; -+ -+ memset(result, 0, sizeof(result)); -+ result[3][0] = 0x100; -+ result[3][2] = 0x100; -+ result[3][4] = 0x100; -+ result[3][6] = 0x100; -+ -+ candidate = -1; -+ -+ path_a_ok = false; -+ path_b_ok = false; -+ -+ for (i = 0; i < 3; i++) { -+ rtl8188eu_phy_iqcalibrate(priv, result, i); -+ -+ if (i == 1) { -+ simu = rtl8xxxu_gen2_simularity_compare(priv, -+ result, 0, 1); -+ if (simu) { -+ candidate = 0; -+ break; -+ } -+ } -+ -+ if (i == 2) { -+ simu = rtl8xxxu_gen2_simularity_compare(priv, -+ result, 0, 2); -+ if (simu) { -+ candidate = 0; -+ break; -+ } -+ -+ simu = rtl8xxxu_gen2_simularity_compare(priv, -+ result, 1, 2); -+ if (simu) -+ candidate = 1; -+ else -+ candidate = 3; -+ } -+ } -+ -+ for (i = 0; i < 4; i++) { -+ reg_e94 = result[i][0]; -+ reg_e9c = result[i][1]; -+ reg_ea4 = result[i][2]; -+ reg_eb4 = result[i][4]; -+ reg_ebc = result[i][5]; -+ reg_ec4 = result[i][6]; -+ } -+ -+ if (candidate >= 0) { -+ reg_e94 = result[candidate][0]; -+ priv->rege94 = reg_e94; -+ reg_e9c = result[candidate][1]; -+ priv->rege9c = reg_e9c; -+ reg_ea4 = result[candidate][2]; -+ reg_eac = result[candidate][3]; -+ reg_eb4 = result[candidate][4]; -+ priv->regeb4 = reg_eb4; -+ reg_ebc = result[candidate][5]; -+ priv->regebc = reg_ebc; -+ reg_ec4 = result[candidate][6]; -+ reg_ecc = result[candidate][7]; -+ dev_dbg(dev, "%s: candidate is %x\n", __func__, candidate); -+ dev_dbg(dev, -+ "%s: e94 =%x e9c=%x ea4=%x eac=%x eb4=%x ebc=%x ec4=%x " -+ "ecc=%x\n ", __func__, reg_e94, reg_e9c, -+ reg_ea4, reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc); -+ path_a_ok = true; -+ path_b_ok = true; -+ } else { -+ reg_e94 = reg_eb4 = priv->rege94 = priv->regeb4 = 0x100; -+ reg_e9c = reg_ebc = priv->rege9c = priv->regebc = 0x0; -+ } -+ -+ if (reg_e94 && candidate >= 0) -+ rtl8xxxu_fill_iqk_matrix_a(priv, path_a_ok, result, -+ candidate, (reg_ea4 == 0)); -+ -+ if (priv->rf_paths > 1 && reg_eb4) -+ rtl8xxxu_fill_iqk_matrix_b(priv, path_b_ok, result, -+ candidate, (reg_ec4 == 0)); -+ -+ rtl8xxxu_save_regs(priv, rtl8xxxu_iqk_phy_iq_bb_reg, -+ priv->bb_recovery_backup, RTL8XXXU_BB_REGS); -+} -+ - static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -520,6 +1008,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, -+ .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/653-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch b/package/kernel/mac80211/patches/653-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch deleted file mode 100644 index 81b1d848a..000000000 --- a/package/kernel/mac80211/patches/653-0026-rtl8xxxu-8188eu-uses-the-gen2-thermal-meter.patch +++ /dev/null @@ -1,23 +0,0 @@ -From e33fed77d7493ef16c3afd32eb0d7c99fc95bfad Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 11:20:00 -0400 -Subject: [PATCH] rtl8xxxu: 8188eu uses the gen2 thermal meter - -Vendor driver writes thermal meter setup to RF register 0x42, hence -the gen2 setup. However the driver doesn't do much with it. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1015,6 +1015,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .has_tx_report = 1, -+ .gen2_thermal_meter = 1, - .adda_1t_init = 0x0b1b25a0, - .adda_1t_path_on = 0x0bdb25a0, - .adda_2t_path_on_a = 0x04db25a4, diff --git a/package/kernel/mac80211/patches/653-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch b/package/kernel/mac80211/patches/653-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch deleted file mode 100644 index 4c242453b..000000000 --- a/package/kernel/mac80211/patches/653-0027-rtl8xxxu-Set-REG_USB_HRPWM-to-0-for-8188eu.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 42808faad1b2cf0366a39074c08dbd181fa51b07 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 11:33:29 -0400 -Subject: [PATCH] rtl8xxxu: Set REG_USB_HRPWM to 0 for 8188eu - -This matches what 8192eu does - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4240,7 +4240,7 @@ static int rtl8xxxu_init_device(struct i - val32 |= FPGA_RF_MODE_CCK; - rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); - } -- } else if (priv->rtl_chip == RTL8192E) { -+ } else if (priv->rtl_chip == RTL8192E || priv->rtl_chip == RTL8188E) { - rtl8xxxu_write8(priv, REG_USB_HRPWM, 0x00); - } - diff --git a/package/kernel/mac80211/patches/653-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch b/package/kernel/mac80211/patches/653-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch deleted file mode 100644 index a397125e8..000000000 --- a/package/kernel/mac80211/patches/653-0028-rtl8xxxu-Implement-rtl8188eu_config_channel.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 9796f3807764567ecde6e3787a66e4b4edbc35df Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 11:40:13 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_config_channel() - -The 8188eu doesn't seem to have REG_FPGA0_ANALOG2, so implement it's -own specific version. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 117 +++++++++++++++++++++ - 1 file changed, 117 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -283,6 +283,122 @@ static struct rtl8xxxu_rfregval rtl8188e - {0xff, 0xffffffff} - }; - -+void rtl8188eu_config_channel(struct ieee80211_hw *hw) -+{ -+ struct rtl8xxxu_priv *priv = hw->priv; -+ u32 val32, rsr; -+ u8 val8, opmode; -+ bool ht = true; -+ int sec_ch_above, channel; -+ int i; -+ -+ opmode = rtl8xxxu_read8(priv, REG_BW_OPMODE); -+ rsr = rtl8xxxu_read32(priv, REG_RESPONSE_RATE_SET); -+ channel = hw->conf.chandef.chan->hw_value; -+ -+ switch (hw->conf.chandef.width) { -+ case NL80211_CHAN_WIDTH_20_NOHT: -+ ht = false; -+ case NL80211_CHAN_WIDTH_20: -+ opmode |= BW_OPMODE_20MHZ; -+ rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); -+ val32 &= ~FPGA_RF_MODE; -+ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA1_RF_MODE); -+ val32 &= ~FPGA_RF_MODE; -+ rtl8xxxu_write32(priv, REG_FPGA1_RF_MODE, val32); -+ break; -+ case NL80211_CHAN_WIDTH_40: -+ if (hw->conf.chandef.center_freq1 > -+ hw->conf.chandef.chan->center_freq) { -+ sec_ch_above = 1; -+ channel += 2; -+ } else { -+ sec_ch_above = 0; -+ channel -= 2; -+ } -+ -+ opmode &= ~BW_OPMODE_20MHZ; -+ rtl8xxxu_write8(priv, REG_BW_OPMODE, opmode); -+ rsr &= ~RSR_RSC_BANDWIDTH_40M; -+ if (sec_ch_above) -+ rsr |= RSR_RSC_UPPER_SUB_CHANNEL; -+ else -+ rsr |= RSR_RSC_LOWER_SUB_CHANNEL; -+ rtl8xxxu_write32(priv, REG_RESPONSE_RATE_SET, rsr); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_RF_MODE); -+ val32 |= FPGA_RF_MODE; -+ rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA1_RF_MODE); -+ val32 |= FPGA_RF_MODE; -+ rtl8xxxu_write32(priv, REG_FPGA1_RF_MODE, val32); -+ -+ /* -+ * Set Control channel to upper or lower. These settings -+ * are required only for 40MHz -+ */ -+ val32 = rtl8xxxu_read32(priv, REG_CCK0_SYSTEM); -+ val32 &= ~CCK0_SIDEBAND; -+ if (!sec_ch_above) -+ val32 |= CCK0_SIDEBAND; -+ rtl8xxxu_write32(priv, REG_CCK0_SYSTEM, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_OFDM1_LSTF); -+ val32 &= ~OFDM_LSTF_PRIME_CH_MASK; /* 0xc00 */ -+ if (sec_ch_above) -+ val32 |= OFDM_LSTF_PRIME_CH_LOW; -+ else -+ val32 |= OFDM_LSTF_PRIME_CH_HIGH; -+ rtl8xxxu_write32(priv, REG_OFDM1_LSTF, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_FPGA0_POWER_SAVE); -+ val32 &= ~(FPGA0_PS_LOWER_CHANNEL | FPGA0_PS_UPPER_CHANNEL); -+ if (sec_ch_above) -+ val32 |= FPGA0_PS_UPPER_CHANNEL; -+ else -+ val32 |= FPGA0_PS_LOWER_CHANNEL; -+ rtl8xxxu_write32(priv, REG_FPGA0_POWER_SAVE, val32); -+ break; -+ -+ default: -+ break; -+ } -+ -+ for (i = RF_A; i < priv->rf_paths; i++) { -+ val32 = rtl8xxxu_read_rfreg(priv, i, RF6052_REG_MODE_AG); -+ val32 &= ~MODE_AG_CHANNEL_MASK; -+ val32 |= channel; -+ rtl8xxxu_write_rfreg(priv, i, RF6052_REG_MODE_AG, val32); -+ } -+ -+ if (ht) -+ val8 = 0x0e; -+ else -+ val8 = 0x0a; -+ -+#if 0 -+ rtl8xxxu_write8(priv, REG_SIFS_CCK + 1, val8); -+ rtl8xxxu_write8(priv, REG_SIFS_OFDM + 1, val8); -+ -+ rtl8xxxu_write16(priv, REG_R2T_SIFS, 0x0808); -+ rtl8xxxu_write16(priv, REG_T2T_SIFS, 0x0a0a); -+#endif -+ -+ for (i = RF_A; i < priv->rf_paths; i++) { -+ val32 = rtl8xxxu_read_rfreg(priv, i, RF6052_REG_MODE_AG); -+ if (hw->conf.chandef.width == NL80211_CHAN_WIDTH_40) -+ val32 &= ~MODE_AG_CHANNEL_20MHZ; -+ else -+ val32 |= MODE_AG_CHANNEL_20MHZ; -+ rtl8xxxu_write_rfreg(priv, i, RF6052_REG_MODE_AG, val32); -+ } -+} -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -1009,6 +1125,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, - .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, -+ .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .usb_quirks = rtl8188e_usb_quirks, - .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/653-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch b/package/kernel/mac80211/patches/653-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch deleted file mode 100644 index cf3cde70b..000000000 --- a/package/kernel/mac80211/patches/653-0029-rtl8xxxu-Use-gen2-H2C-commands-for-8188eu.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4ec1cada65cc1876277f5325b78019667f6e18c4 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 11:44:12 -0400 -Subject: [PATCH] rtl8xxxu: Use gen2 H2C commands for 8188eu - -The 8188eu is a weird hybrid between the old gen1 and newer gen2 -APIs. It uses the newer API for H2C commands, hence use -rtl8xxxu_gen2_update_rate_mask() and rtl8xxxu_gen2_report_connect(). - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1128,6 +1128,8 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .usb_quirks = rtl8188e_usb_quirks, -+ .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, -+ .report_connect = rtl8xxxu_gen2_report_connect, - .writeN_block_size = 128, - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), diff --git a/package/kernel/mac80211/patches/653-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch b/package/kernel/mac80211/patches/653-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch deleted file mode 100644 index 2a5bb00b4..000000000 --- a/package/kernel/mac80211/patches/653-0030-rtl8xxxu-Initialize-GPIO-settings-for-8188eu.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 061838d68d2c20acb5a57fbd92e3ed0ae906142e Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 12:56:30 -0400 -Subject: [PATCH] rtl8xxxu: Initialize GPIO settings for 8188eu - -This matches what the vendor driver does, but is actually opposite of -what it does for 8192eu. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++++++ - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 1 + - 2 files changed, 8 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4210,6 +4210,13 @@ static int rtl8xxxu_init_device(struct i - * Reset USB mode switch setting - */ - rtl8xxxu_write8(priv, REG_ACLK_MON, 0x00); -+ } else if (priv->rtl_chip == RTL8188E) { -+ /* -+ * Init GPIO settings for 8188e -+ */ -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG); -+ val8 &= ~GPIO_MUXCFG_IO_SEL_ENBT; -+ rtl8xxxu_write8(priv, REG_GPIO_MUXCFG, val8); - } - - rtl8723a_phy_lc_calibrate(priv); ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -143,6 +143,7 @@ - #define REG_CAL_TIMER 0x003c - #define REG_ACLK_MON 0x003e - #define REG_GPIO_MUXCFG 0x0040 -+#define GPIO_MUXCFG_IO_SEL_ENBT BIT(5) - #define REG_GPIO_IO_SEL 0x0042 - #define REG_MAC_PINMUX_CFG 0x0043 - #define REG_GPIO_PIN_CTRL 0x0044 diff --git a/package/kernel/mac80211/patches/653-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch b/package/kernel/mac80211/patches/653-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch deleted file mode 100644 index 2803b9747..000000000 --- a/package/kernel/mac80211/patches/653-0031-rtl8xxxu-Add-simple-rtl8188eu_rf_on-routine.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 2024562ed45d905bee00aea923c218c493c09d27 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 13:10:02 -0400 -Subject: [PATCH] rtl8xxxu: Add simple rtl8188eu_rf_on() routine - -It is not obvious from the vendor driver if we need more than this. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1096,6 +1096,11 @@ exit: - return ret; - } - -+static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) -+{ -+ rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); -+} -+ - static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1127,6 +1132,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, - .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, -+ .enable_rf = rtl8188e_enable_rf, - .usb_quirks = rtl8188e_usb_quirks, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, diff --git a/package/kernel/mac80211/patches/653-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch b/package/kernel/mac80211/patches/653-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch deleted file mode 100644 index 1778b1636..000000000 --- a/package/kernel/mac80211/patches/653-0032-rtl8xxxu-Implement-rtl8188e_disable_rf.patch +++ /dev/null @@ -1,44 +0,0 @@ -From f26f81e233f7a9b1bf21aa0de16a8db733c317ec Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 13:17:36 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188e_disable_rf() - -This is partly guessware as there is no straight forward disable RF -routine in the vendor driver. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1101,6 +1101,20 @@ static void rtl8188e_enable_rf(struct rt - rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); - } - -+static void rtl8188e_disable_rf(struct rtl8xxxu_priv *priv) -+{ -+ u32 val32; -+ -+ val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE); -+ val32 &= ~OFDM_RF_PATH_TX_MASK; -+ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, val32); -+ -+ /* Power down RF module */ -+ rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0); -+ if (priv->rf_paths == 2) -+ rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_AC, 0); -+} -+ - static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1133,6 +1147,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, - .enable_rf = rtl8188e_enable_rf, -+ .disable_rf = rtl8188e_disable_rf, - .usb_quirks = rtl8188e_usb_quirks, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, diff --git a/package/kernel/mac80211/patches/653-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch b/package/kernel/mac80211/patches/653-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch deleted file mode 100644 index c6d3d6235..000000000 --- a/package/kernel/mac80211/patches/653-0033-rtl8xxxu-Update-8188e-efuse-definition-for-power-val.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 9067e08ea9ba380340388c3ad4ab85bd54ff4e8d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 16:46:11 -0400 -Subject: [PATCH] rtl8xxxu: Update 8188e efuse definition for power values - -The 8188e uses a similar layout as the 8192e, however it does not have -values for path B. Update struct rtl8188eu_efuse to reflect this and -copy over path A values for path B. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 7 ++----- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 19 +++++++++++-------- - 2 files changed, 13 insertions(+), 13 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -881,11 +881,8 @@ struct rtl8192eu_efuse { - struct rtl8188eu_efuse { - __le16 rtl_id; - u8 res0[0x0e]; -- u8 cck_tx_power_index_A[3]; /* 0x10 */ -- u8 cck_tx_power_index_B[3]; -- u8 ht40_1s_tx_power_index_A[3]; /* 0x16 */ -- u8 ht40_1s_tx_power_index_B[3]; -- u8 res1[0x9c]; -+ struct rtl8192eu_efuse_tx_power tx_power_index_A; /* 0x10 */ -+ u8 res1[0x7e]; /* 0x3a */ - u8 channel_plan; /* 0xb8 */ - u8 xtal_k; - u8 thermal_meter; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -409,17 +409,20 @@ static int rtl8188eu_parse_efuse(struct - - ether_addr_copy(priv->mac_addr, efuse->mac_addr); - -- memcpy(priv->cck_tx_power_index_A, efuse->cck_tx_power_index_A, -- sizeof(efuse->cck_tx_power_index_A)); -- memcpy(priv->cck_tx_power_index_B, efuse->cck_tx_power_index_B, -- sizeof(efuse->cck_tx_power_index_B)); -+ memcpy(priv->cck_tx_power_index_A, efuse->tx_power_index_A.cck_base, -+ sizeof(efuse->tx_power_index_A.cck_base)); -+ /* -+ * Efuse is empty for path B, so copy in values from path A -+ */ -+ memcpy(priv->cck_tx_power_index_B, efuse->tx_power_index_A.cck_base, -+ sizeof(efuse->tx_power_index_A.cck_base)); - - memcpy(priv->ht40_1s_tx_power_index_A, -- priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_A, -- sizeof(priv->ht40_1s_tx_power_index_A)); -+ efuse->tx_power_index_A.ht40_base, -+ sizeof(efuse->tx_power_index_A.ht40_base)); - memcpy(priv->ht40_1s_tx_power_index_B, -- priv->efuse_wifi.efuse8188eu.ht40_1s_tx_power_index_B, -- sizeof(priv->ht40_1s_tx_power_index_B)); -+ efuse->tx_power_index_A.ht40_base, -+ sizeof(efuse->tx_power_index_A.ht40_base)); - - priv->xtalk = priv->efuse_wifi.efuse8188eu.xtal_k & 0x3f; - diff --git a/package/kernel/mac80211/patches/653-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch b/package/kernel/mac80211/patches/653-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch deleted file mode 100644 index 7cc0c1b76..000000000 --- a/package/kernel/mac80211/patches/653-0034-rtl8xxxu-Implement-rtl8188e_set_tx_power.patch +++ /dev/null @@ -1,94 +0,0 @@ -From cd4a93d1532b2f0ffe508f7fb5d464ec49634dcd Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 22 Jul 2016 13:55:24 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188e_set_tx_power() - -This matches the code used to set TX power on 8192eu, except it only -handles path A. - -We should be able to consolidate this code. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 63 ++++++++++++++++++++++ - 1 file changed, 63 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -283,6 +283,68 @@ static struct rtl8xxxu_rfregval rtl8188e - {0xff, 0xffffffff} - }; - -+int rtl8xxxu_8188e_channel_to_group(int channel) -+{ -+ int group; -+ -+ if (channel < 3) -+ group = 0; -+ else if (channel < 6) -+ group = 1; -+ else if (channel < 9) -+ group = 2; -+ else if (channel < 12) -+ group = 3; -+ else if (channel < 14) -+ group = 4; -+ else -+ group = 5; -+ -+ return group; -+} -+ -+static void -+rtl8188e_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40) -+{ -+ u32 val32, ofdm, mcs; -+ u8 cck, ofdmbase, mcsbase; -+ int group, tx_idx; -+ -+ tx_idx = 0; -+ group = rtl8xxxu_8188e_channel_to_group(channel); -+ -+ cck = priv->cck_tx_power_index_A[group]; -+ -+ val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32); -+ val32 &= 0xffff00ff; -+ val32 |= (cck << 8); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_CCK1_MCS32, val32); -+ -+ val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11); -+ val32 &= 0xff; -+ val32 |= ((cck << 8) | (cck << 16) | (cck << 24)); -+ rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32); -+ -+ ofdmbase = priv->ht40_1s_tx_power_index_A[group]; -+ ofdmbase += priv->ofdm_tx_power_diff[tx_idx].a; -+ ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24; -+ -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm); -+ -+ mcsbase = priv->ht40_1s_tx_power_index_A[group]; -+ if (ht40) -+ mcsbase += priv->ht40_tx_power_diff[tx_idx++].a; -+ else -+ mcsbase += priv->ht20_tx_power_diff[tx_idx++].a; -+ mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24; -+ -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS11_MCS08, mcs); -+ rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12, mcs); -+} -+ - void rtl8188eu_config_channel(struct ieee80211_hw *hw) - { - struct rtl8xxxu_priv *priv = hw->priv; -@@ -1152,6 +1214,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .enable_rf = rtl8188e_enable_rf, - .disable_rf = rtl8188e_disable_rf, - .usb_quirks = rtl8188e_usb_quirks, -+ .set_tx_power = rtl8188e_set_tx_power, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, - .writeN_block_size = 128, diff --git a/package/kernel/mac80211/patches/653-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch b/package/kernel/mac80211/patches/653-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch deleted file mode 100644 index 7ceaccb3f..000000000 --- a/package/kernel/mac80211/patches/653-0035-rtl8xxxu-Implement-rtl8xxxu_fill_txdesc_v3-for-8188e.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 3c50918b180d091a49e412742a4f7aa1a89802b1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 26 Jul 2016 14:01:14 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8xxxu_fill_txdesc_v3() for 8188eu - -Getting closer but still no cigar. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 11 +++ - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 78 ++++++++++++++++++++++ - 3 files changed, 90 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -510,6 +510,8 @@ struct rtl8xxxu_txdesc40 { - #define TXDESC_AMPDU_DENSITY_SHIFT 20 - #define TXDESC40_BT_INT BIT(23) - #define TXDESC40_GID_SHIFT 24 -+#define TXDESC_ANTENNA_SELECT_A BIT(24) -+#define TXDESC_ANTENNA_SELECT_B BIT(25) - - /* Word 3 */ - #define TXDESC40_USE_DRIVER_RATE BIT(8) -@@ -554,6 +556,10 @@ struct rtl8xxxu_txdesc40 { - - /* Word 6 */ - #define TXDESC_MAX_AGG_SHIFT 11 -+#define TXDESC_USB_TX_AGG_SHIT 24 -+ -+/* Word 7 */ -+#define TXDESC_ANTENNA_SELECT_C BIT(29) - - /* Word 8 */ - #define TXDESC40_HW_SEQ_ENABLE BIT(15) -@@ -1487,6 +1493,11 @@ void rtl8xxxu_fill_txdesc_v2(struct ieee - struct ieee80211_tx_info *tx_info, - struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, - bool short_preamble, bool ampdu_enable, -+ u32 rts_rate); -+void rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi, -+ bool short_preamble, bool ampdu_enable, - u32 rts_rate); - - extern struct rtl8xxxu_fileops rtl8188eu_fops; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1217,6 +1217,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .set_tx_power = rtl8188e_set_tx_power, - .update_rate_mask = rtl8xxxu_gen2_update_rate_mask, - .report_connect = rtl8xxxu_gen2_report_connect, -+ .fill_txdesc = rtl8xxxu_fill_txdesc_v3, - .writeN_block_size = 128, - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4931,6 +4931,84 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211 - } - } - -+/* -+ * Fill in v3 (gen1) specific TX descriptor bits. -+ * This format is a hybrid between the v1 and v2 formats, only seen -+ * on 8188eu devices so far. -+ */ -+void -+rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, -+ struct ieee80211_tx_info *tx_info, -+ struct rtl8xxxu_txdesc32 *tx_desc, bool sgi, -+ bool short_preamble, bool ampdu_enable, u32 rts_rate) -+{ -+ struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); -+ struct rtl8xxxu_priv *priv = hw->priv; -+ struct device *dev = &priv->udev->dev; -+ u32 rate; -+ u16 rate_flags = tx_info->control.rates[0].flags; -+ u16 seq_number; -+ -+ if (rate_flags & IEEE80211_TX_RC_MCS && -+ !ieee80211_is_mgmt(hdr->frame_control)) -+ rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0; -+ else -+ rate = tx_rate->hw_value; -+ -+ if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX) -+ dev_info(dev, "%s: TX rate: %d, pkt size %d\n", -+ __func__, rate, cpu_to_le16(tx_desc->pkt_size)); -+ -+ seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); -+ -+ tx_desc->txdw5 = cpu_to_le32(rate); -+ -+ /* -+ * Data/RTS rate FB limit -+ */ -+ if (ieee80211_is_data(hdr->frame_control)) -+ tx_desc->txdw5 |= cpu_to_le32(0x0001ff00); -+ -+ tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT); -+ -+ if (ampdu_enable) -+ tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE); -+ else -+ tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK); -+ -+ if (ieee80211_is_mgmt(hdr->frame_control)) { -+ tx_desc->txdw5 = cpu_to_le32(rate); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_USE_DRIVER_RATE); -+ tx_desc->txdw5 |= cpu_to_le32(6 << TXDESC32_RETRY_LIMIT_SHIFT); -+ tx_desc->txdw5 |= cpu_to_le32(TXDESC32_RETRY_LIMIT_ENABLE); -+ } -+ -+ if (ieee80211_is_data_qos(hdr->frame_control)) -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_QOS); -+ -+ if (short_preamble) -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_SHORT_PREAMBLE); -+ -+ if (sgi) -+ tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI); -+ -+ /* -+ * rts_rate is zero if RTS/CTS or CTS to SELF are not enabled -+ */ -+ tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT); -+ if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); -+ } else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE); -+ tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE); -+ } -+ -+ tx_desc->txdw2 |= cpu_to_le32(TXDESC_ANTENNA_SELECT_A | -+ TXDESC_ANTENNA_SELECT_B); -+ tx_desc->txdw7 |= cpu_to_le32(TXDESC_ANTENNA_SELECT_C); -+} -+ - static void rtl8xxxu_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) diff --git a/package/kernel/mac80211/patches/653-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch b/package/kernel/mac80211/patches/653-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch deleted file mode 100644 index e7f97a5b9..000000000 --- a/package/kernel/mac80211/patches/653-0036-rtl8xxxu-Add-some-8188eu-registers-and-update-CCK0_A.patch +++ /dev/null @@ -1,87 +0,0 @@ -From a9f5a167be625cf0cd157aa38f3635b2b1f0cc0f Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 29 Jul 2016 15:25:34 -0400 -Subject: [PATCH] rtl8xxxu: Add some 8188eu registers and update - CCK0_AFE_SETTING bit defines - -CCK0_AFE_SETTING is particular, it has the notion of primary RX antenna -and optional RX antenna. When configuring RX for single antenna, setup -should use the same antenna for default and optional. For AB setup, -use antenna A as default and B as optional. - -In addition add info for 8188eu IOL magic interface used to send -firmware and register init files to the firmware. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 30 ++++++++++++++++++++-- - 1 file changed, 28 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -378,6 +378,11 @@ - #define PBP_PAGE_SIZE_512 0x3 - #define PBP_PAGE_SIZE_1024 0x4 - -+/* 8188eu IOL magic */ -+#define REG_PKT_BUF_ACCESS_CTRL 0x0106 -+#define PKT_BUF_ACCESS_CTRL_TX 0x69 -+#define PKT_BUF_ACCESS_CTRL_RX 0xa5 -+ - #define REG_TRXDMA_CTRL 0x010c - #define TRXDMA_CTRL_RXDMA_AGG_EN BIT(2) - #define TRXDMA_CTRL_VOQ_SHIFT 4 -@@ -449,6 +454,7 @@ - - #define REG_FIFOPAGE 0x0204 - #define REG_TDECTRL 0x0208 -+ - #define REG_TXDMA_OFFSET_CHK 0x020c - #define TXDMA_OFFSET_DROP_DATA_EN BIT(9) - #define REG_TXDMA_STATUS 0x0210 -@@ -938,6 +944,7 @@ - #define REG_FPGA1_RF_MODE 0x0900 - - #define REG_FPGA1_TX_INFO 0x090c -+#define REG_ANT_MAPPING1 0x0914 - #define REG_DPDT_CTRL 0x092c /* 8723BU */ - #define REG_RFE_CTRL_ANTA_SRC 0x0930 /* 8723BU */ - #define REG_RFE_PATH_SELECT 0x0940 /* 8723BU */ -@@ -949,9 +956,25 @@ - - #define REG_CCK0_AFE_SETTING 0x0a04 - #define CCK0_AFE_RX_MASK 0x0f000000 --#define CCK0_AFE_RX_ANT_AB BIT(24) -+#define CCK0_AFE_TX_MASK 0xf0000000 - #define CCK0_AFE_RX_ANT_A 0 --#define CCK0_AFE_RX_ANT_B (BIT(24) | BIT(26)) -+#define CCK0_AFE_RX_ANT_B BIT(26) -+#define CCK0_AFE_RX_ANT_C BIT(27) -+#define CCK0_AFE_RX_ANT_D (BIT(26) | BIT(27)) -+#define CCK0_AFE_RX_ANT_OPTION_A 0 -+#define CCK0_AFE_RX_ANT_OPTION_B BIT(24) -+#define CCK0_AFE_RX_ANT_OPTION_C BIT(25) -+#define CCK0_AFE_RX_ANT_OPTION_D (BIT(24) | BIT(25)) -+#define CCK0_AFE_TX_ANT_A BIT(31) -+#define CCK0_AFE_TX_ANT_B BIT(30) -+ -+#define REG_CCK_ANTDIV_PARA2 0x0a04 -+#define REG_BB_POWER_SAVE4 0x0a74 -+ -+/* 8188eu */ -+#define REG_LNA_SWITCH 0x0b2c -+#define LNA_SWITCH_DISABLE_CSCG BIT(22) -+#define LNA_SWITCH_OUTPUT_CG BIT(31) - - #define REG_CONFIG_ANT_A 0x0b68 - #define REG_CONFIG_ANT_B 0x0b6c -@@ -1004,6 +1027,9 @@ - - #define REG_OFDM0_RX_IQ_EXT_ANTA 0x0ca0 - -+/* 8188eu */ -+#define REG_ANTDIV_PARA1 0x0ca4 -+ - /* 8723bu */ - #define REG_OFDM0_TX_PSDO_NOISE_WEIGHT 0x0ce4 - diff --git a/package/kernel/mac80211/patches/653-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch b/package/kernel/mac80211/patches/653-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch deleted file mode 100644 index bb940db3c..000000000 --- a/package/kernel/mac80211/patches/653-0037-rtl8xxxu-Improve-register-description-for-REG_FPGA1_.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 5731f8a7485120836c42e0dfae61644588ffd119 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 29 Jul 2016 15:57:19 -0400 -Subject: [PATCH] rtl8xxxu: Improve register description for REG_FPGA1_TX_INFO - -This is based on Hal_SetAntenna() from the 8188eu driver - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -944,6 +944,15 @@ - #define REG_FPGA1_RF_MODE 0x0900 - - #define REG_FPGA1_TX_INFO 0x090c -+#define FPGA1_TX_ANT_MASK 0x0000000f -+#define FPGA1_TX_ANT_L_MASK 0x000000f0 -+#define FPGA1_TX_ANT_NON_HT_MASK 0x00000f00 -+#define FPGA1_TX_ANT_HT1_MASK 0x0000f000 -+#define FPGA1_TX_ANT_HT2_MASK 0x000f0000 -+#define FPGA1_TX_ANT_HT_S1_MASK 0x00f00000 -+#define FPGA1_TX_ANT_NON_HT_S1_MASK 0x0f000000 -+#define FPGA1_TX_OFDM_TXSC_MASK 0x30000000 -+ - #define REG_ANT_MAPPING1 0x0914 - #define REG_DPDT_CTRL 0x092c /* 8723BU */ - #define REG_RFE_CTRL_ANTA_SRC 0x0930 /* 8723BU */ diff --git a/package/kernel/mac80211/patches/653-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch b/package/kernel/mac80211/patches/653-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch deleted file mode 100644 index ed3a27be4..000000000 --- a/package/kernel/mac80211/patches/653-0038-rtl8xxxu-properly-detect-RTL8188EU-devices.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 36c071e30dc5759be3e53ac93459c24fb64d41c3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Fri, 29 Jul 2016 18:22:37 +0200 -Subject: [PATCH] rtl8xxxu: properly detect RTL8188EU devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The assumption that all RTL8188EU have chip cut >= C is wrong. -However, RTL8188EU devices can be easily differentiated from RTL8188CU devices -relying on TX report capbility. - -Signed-off-by: Álvaro Fernández Rojas -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -1683,7 +1683,7 @@ static int rtl8xxxu_identify_chip(struct - } - priv->has_wifi = 1; - } else { -- if (priv->chip_cut >= 2) { -+ if (priv->fops->has_tx_report) { - sprintf(priv->chip_name, "8188EU"); - priv->rf_paths = 1; - priv->rx_paths = 1; diff --git a/package/kernel/mac80211/patches/653-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch b/package/kernel/mac80211/patches/653-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch deleted file mode 100644 index 65bab0dee..000000000 --- a/package/kernel/mac80211/patches/653-0039-rtl8xxxu-Implement-8188eu-specific-8051-reset-functi.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 660a287a0a32ce9f8be9b3ad625c597ad1ed38a2 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 10 Aug 2016 15:40:30 -0400 -Subject: [PATCH] rtl8xxxu: Implement 8188eu specific 8051 reset function - -The 8188eu doesn't seem to require the additional hacks used on some -other chips. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -505,6 +505,18 @@ static int rtl8188eu_parse_efuse(struct - return 0; - } - -+void rtl8188eu_reset_8051(struct rtl8xxxu_priv *priv) -+{ -+ u16 sys_func; -+ -+ sys_func = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ sys_func &= ~SYS_FUNC_CPU_ENABLE; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, sys_func); -+ -+ sys_func |= SYS_FUNC_CPU_ENABLE; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, sys_func); -+} -+ - static int rtl8188eu_load_firmware(struct rtl8xxxu_priv *priv) - { - char *fw_name; -@@ -1204,7 +1216,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .load_firmware = rtl8188eu_load_firmware, - .power_on = rtl8188eu_power_on, - .power_off = rtl8xxxu_power_off, -- .reset_8051 = rtl8xxxu_reset_8051, -+ .reset_8051 = rtl8188eu_reset_8051, - .llt_init = rtl8xxxu_auto_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, diff --git a/package/kernel/mac80211/patches/653-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch b/package/kernel/mac80211/patches/653-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch deleted file mode 100644 index ada4f2df5..000000000 --- a/package/kernel/mac80211/patches/653-0040-rtl8xxxu-Disable-packet-DMA-aggregation-on-8188eu.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f435337a2fc97c97476d833700e4a8fd17d99007 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 10 Aug 2016 15:41:13 -0400 -Subject: [PATCH] rtl8xxxu: Disable packet DMA aggregation on 8188eu - -For now disable packet DMA aggregation on the 8188eu, rather then -risking the feature being left on by the init tables. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -461,6 +461,19 @@ void rtl8188eu_config_channel(struct iee - } - } - -+void rtl8188eu_init_aggregation(struct rtl8xxxu_priv *priv) -+{ -+ u8 agg_ctrl, usb_spec; -+ -+ usb_spec = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION); -+ usb_spec &= ~USB_SPEC_USB_AGG_ENABLE; -+ rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, usb_spec); -+ -+ agg_ctrl = rtl8xxxu_read8(priv, REG_TRXDMA_CTRL); -+ agg_ctrl &= ~TRXDMA_CTRL_RXDMA_AGG_EN; -+ rtl8xxxu_write8(priv, REG_TRXDMA_CTRL, agg_ctrl); -+} -+ - static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv) - { - struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu; -@@ -1223,6 +1236,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, - .config_channel = rtl8188eu_config_channel, - .parse_rx_desc = rtl8xxxu_parse_rxdesc16, -+ .init_aggregation = rtl8188eu_init_aggregation, - .enable_rf = rtl8188e_enable_rf, - .disable_rf = rtl8188e_disable_rf, - .usb_quirks = rtl8188e_usb_quirks, diff --git a/package/kernel/mac80211/patches/653-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch b/package/kernel/mac80211/patches/653-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch deleted file mode 100644 index e11260eb8..000000000 --- a/package/kernel/mac80211/patches/653-0041-rtl8xxxu-8188eu-set-REG_OFDM0_XA_AGC_CORE1-to-match-.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4aecb21cdc491804c936a71e98192ba144757ea3 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 10 Aug 2016 16:06:37 -0400 -Subject: [PATCH] rtl8xxxu: 8188eu set REG_OFDM0_XA_AGC_CORE1 to match vendor - driver - -We have no description of this register, so not sure why this differs -from say 8723au. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -5945,7 +5945,10 @@ exit: - rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0xffff); - rtl8xxxu_write16(priv, REG_RXFLTMAP0, 0xffff); - -- rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e); -+ if (priv->rtl_chip == RTL8188E) -+ rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6955341e); -+ else -+ rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e); - - return ret; - diff --git a/package/kernel/mac80211/patches/653-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch b/package/kernel/mac80211/patches/653-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch deleted file mode 100644 index 1a39cc461..000000000 --- a/package/kernel/mac80211/patches/653-0042-rtl8xxxu-Fix-rtl8188eu-connection-fail.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ef6a147ea381e76fa02358aa5b65816121d57a4c Mon Sep 17 00:00:00 2001 -From: Taehee Yoo -Date: Sun, 21 Aug 2016 20:38:22 +0900 -Subject: [PATCH] rtl8xxxu: Fix rtl8188eu connection fail - -rtl8188eu vendor driver's LLT init routine is similar -rtl8xxxu_init_llt_table() than rtl8xxxu_auto_llt_table(). - -So now, rtl8188eu can connect to AP. - -Signed-off-by: Taehee Yoo -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1230,7 +1230,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .power_on = rtl8188eu_power_on, - .power_off = rtl8xxxu_power_off, - .reset_8051 = rtl8188eu_reset_8051, -- .llt_init = rtl8xxxu_auto_llt_table, -+ .llt_init = rtl8xxxu_init_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, - .init_phy_rf = rtl8188eu_init_phy_rf, - .phy_iq_calibrate = rtl8188eu_phy_iq_calibrate, diff --git a/package/kernel/mac80211/patches/653-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch b/package/kernel/mac80211/patches/653-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch deleted file mode 100644 index 1047625de..000000000 --- a/package/kernel/mac80211/patches/653-0043-rtl8xxxu-Do-not-set-auto-rate-fallback-on-8188eu.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 738832d9e91098f5b3ddb4e71fe8e666575c6bdb Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 24 Aug 2016 13:54:00 -0400 -Subject: [PATCH] rtl8xxxu: Do not set auto rate fallback on 8188eu - -Introduce a fileops flag to indicate whether the device has this -feature. - -Reported-by: Taehee Yoo -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 ++++++++++----- - 6 files changed, 15 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1398,6 +1398,7 @@ struct rtl8xxxu_fileops { - u8 has_s0s1:1; - u8 has_tx_report:1; - u8 gen2_thermal_meter:1; -+ u8 has_darfrc:1; - u32 adda_1t_init; - u32 adda_1t_path_on; - u32 adda_2t_path_on_a; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c -@@ -572,6 +572,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = - .rx_agg_buf_size = 16000, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), -+ .has_darfrc = 1, - .adda_1t_init = 0x0b1b25a0, - .adda_1t_path_on = 0x0bdb25a0, - .adda_2t_path_on_a = 0x04db25a4, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c -@@ -1658,6 +1658,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), - .has_s0s1 = 0, - .gen2_thermal_meter = 1, -+ .has_darfrc = 1, - .adda_1t_init = 0x0fc01616, - .adda_1t_path_on = 0x0fc01616, - .adda_2t_path_on_a = 0x0fc01616, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c -@@ -389,6 +389,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = - .rx_agg_buf_size = 16000, - .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), - .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), -+ .has_darfrc = 1, - .adda_1t_init = 0x0b1b25a0, - .adda_1t_path_on = 0x0bdb25a0, - .adda_2t_path_on_a = 0x04db25a4, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c -@@ -1673,6 +1673,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = - .has_s0s1 = 1, - .has_tx_report = 1, - .gen2_thermal_meter = 1, -+ .has_darfrc = 1, - .adda_1t_init = 0x01c00014, - .adda_1t_path_on = 0x01c00014, - .adda_2t_path_on_a = 0x01c00014, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4105,11 +4105,16 @@ static int rtl8xxxu_init_device(struct i - rtl8xxxu_write32(priv, REG_EDCA_VI_PARAM, 0x005ea324); - rtl8xxxu_write32(priv, REG_EDCA_VO_PARAM, 0x002fa226); - -- /* Set data auto rate fallback retry count */ -- rtl8xxxu_write32(priv, REG_DARFRC, 0x00000000); -- rtl8xxxu_write32(priv, REG_DARFRC + 4, 0x10080404); -- rtl8xxxu_write32(priv, REG_RARFRC, 0x04030201); -- rtl8xxxu_write32(priv, REG_RARFRC + 4, 0x08070605); -+ /* -+ * Set data auto rate fallback retry count. -+ * Notably the 8188eu doesn't seem to use this -+ */ -+ if (fops->has_darfrc) { -+ rtl8xxxu_write32(priv, REG_DARFRC, 0x00000000); -+ rtl8xxxu_write32(priv, REG_DARFRC + 4, 0x10080404); -+ rtl8xxxu_write32(priv, REG_RARFRC, 0x04030201); -+ rtl8xxxu_write32(priv, REG_RARFRC + 4, 0x08070605); -+ } - - val8 = rtl8xxxu_read8(priv, REG_FWHW_TXQ_CTRL); - val8 |= FWHW_TXQ_CTRL_AMPDU_RETRY; diff --git a/package/kernel/mac80211/patches/653-0044-rtl8xxxu-Enable-8188eu-driver.patch b/package/kernel/mac80211/patches/653-0044-rtl8xxxu-Enable-8188eu-driver.patch deleted file mode 100644 index 49aba984b..000000000 --- a/package/kernel/mac80211/patches/653-0044-rtl8xxxu-Enable-8188eu-driver.patch +++ /dev/null @@ -1,22 +0,0 @@ -From b7aed472c6639e2a523d0ef90dba61246d7bd9b4 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 25 Jul 2016 12:32:02 -0400 -Subject: [PATCH] rtl8xxxu: Enable 8188eu driver - -This enables the 8188eu driver - this should work by now. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -539,7 +539,6 @@ static int rtl8188eu_load_firmware(struc - - ret = rtl8xxxu_load_firmware(priv, fw_name); - -- return -EINVAL; - return ret; - } - diff --git a/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch b/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch deleted file mode 100644 index be5f72ff4..000000000 --- a/package/kernel/mac80211/patches/653-0045-rtl8xxxu-Add-rtl8188etv-to-USB-device-list.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 13d8b1bb62307242615f1bebd67d165a91b9f7d5 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 26 Aug 2016 10:28:45 -0400 -Subject: [PATCH] rtl8xxxu: Add rtl8188etv to USB device list - -Hans de Goede reported this works for him with two different tablets. - -Reported-by: Hans de Goede -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6326,6 +6326,9 @@ static const struct usb_device_id dev_ta - #ifdef CPTCFG_RTL8XXXU_UNTESTED - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8188eu_fops}, -+/* Tested by Hans de Goede - rtl8188etv */ -+{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x0179, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8188eu_fops}, - /* Still supported by rtlwifi */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch b/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch deleted file mode 100644 index b4898018f..000000000 --- a/package/kernel/mac80211/patches/653-0046-rtl8xxxu-Add-sitecom-dongle-to-USB-device-list.patch +++ /dev/null @@ -1,23 +0,0 @@ -From e7be61a187c902ae296acf70981a899e9e34a885 Mon Sep 17 00:00:00 2001 -From: Andrea Merello -Date: Fri, 26 Aug 2016 19:18:17 +0200 -Subject: [PATCH] rtl8xxxu: Add sitecom dongle to USB device list - -Signed-off-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6329,6 +6329,9 @@ static const struct usb_device_id dev_ta - /* Tested by Hans de Goede - rtl8188etv */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x0179, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8188eu_fops}, -+/* Sitecom rtl8188eus */ -+{USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0076, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8188eu_fops}, - /* Still supported by rtlwifi */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/653-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch b/package/kernel/mac80211/patches/653-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch deleted file mode 100644 index 853f2f9ec..000000000 --- a/package/kernel/mac80211/patches/653-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch +++ /dev/null @@ -1,68 +0,0 @@ -From b3edeceb7c8c3b0eb70b26e3237afa5086afe8ed Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 26 Aug 2016 15:16:32 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_active_to_emu() - -Per the vendor driver's sequence table, this seems to be the correct -way to disable RF on the 8188eu, even if the driver doesn't actually -call the sequence by itself. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 38 ++++++++++++++++++++++ - 1 file changed, 38 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1155,6 +1155,42 @@ exit: - return ret; - } - -+static int rtl8188eu_active_to_emu(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ int count, ret = 0; -+ -+ /* Turn off RF */ -+ rtl8xxxu_write8(priv, REG_RF_CTRL, 0); -+ -+ /* LDO Sleep mode */ -+ val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); -+ val8 |= BIT(4); -+ rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); -+ -+ /* 0x0005[1] = 1 turn off MAC by HW state machine*/ -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ val8 |= BIT(1); -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); -+ -+ for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ if ((val8 & BIT(1)) == 0) -+ break; -+ udelay(10); -+ } -+ -+ if (!count) { -+ dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n", -+ __func__); -+ ret = -EBUSY; -+ goto exit; -+ } -+ -+exit: -+ return ret; -+} -+ - static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1202,6 +1238,8 @@ static void rtl8188e_disable_rf(struct r - rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0); - if (priv->rf_paths == 2) - rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_AC, 0); -+ -+ rtl8188eu_active_to_emu(priv); - } - - static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv) diff --git a/package/kernel/mac80211/patches/653-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch b/package/kernel/mac80211/patches/653-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch deleted file mode 100644 index 69b0f0285..000000000 --- a/package/kernel/mac80211/patches/653-0048-rtl8xxxu-Implement-rtl8188eu_power_off.patch +++ /dev/null @@ -1,185 +0,0 @@ -From 34e65b6f310234cf3e3629bd3d896a4f84df71f4 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Fri, 26 Aug 2016 16:09:00 -0400 -Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_power_off() - -This makes the driver match the poweroff sequence of the vendor driver -and allows the firmware to reload correctly upon rmmod/insmod. -However the device still doesn't receive data upon reloading. - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 136 ++++++++++++++++++++- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 2 + - 2 files changed, 137 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1191,6 +1191,71 @@ exit: - return ret; - } - -+static int rtl8188eu_emu_to_disabled(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ -+ /* 0x04[12:11] = 01 enable WL suspend */ -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 2); -+ val8 &= ~BIT(0); -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 2, val8); -+ -+ val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -+ val8 |= BIT(7); -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); -+ -+ return 0; -+} -+ -+static int rtl8188eu_active_to_lps(struct rtl8xxxu_priv *priv) -+{ -+ struct device *dev = &priv->udev->dev; -+ u8 val8; -+ u16 val16; -+ u32 val32; -+ int retry, retval; -+ -+ rtl8xxxu_write8(priv, REG_TXPAUSE, 0x7f); -+ -+ retry = 100; -+ retval = -EBUSY; -+ /* -+ * Poll 32 bit wide 0x05f8 for 0x00000000 to ensure no TX is pending. -+ */ -+ do { -+ val32 = rtl8xxxu_read32(priv, 0x05f8); -+ if (!val32) { -+ retval = 0; -+ break; -+ } -+ } while (retry--); -+ -+ if (!retry) { -+ dev_warn(dev, "Failed to flush TX queue\n"); -+ retval = -EBUSY; -+ goto out; -+ } -+ -+ /* Disable CCK and OFDM, clock gated */ -+ val8 = rtl8xxxu_read8(priv, REG_SYS_FUNC); -+ val8 &= ~SYS_FUNC_BBRSTB; -+ rtl8xxxu_write8(priv, REG_SYS_FUNC, val8); -+ -+ udelay(2); -+ -+ /* Reset MAC TRX */ -+ val16 = rtl8xxxu_read16(priv, REG_CR); -+ val16 &= ~(CR_MAC_TX_ENABLE | CR_MAC_RX_ENABLE | CR_SECURITY_ENABLE); -+ rtl8xxxu_write16(priv, REG_CR, val16); -+ -+ val8 = rtl8xxxu_read8(priv, REG_DUAL_TSF_RST); -+ val8 |= DUAL_TSF_TX_OK; -+ rtl8xxxu_write8(priv, REG_DUAL_TSF_RST, val8); -+ -+out: -+ return retval; -+} -+ - static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv) - { - u16 val16; -@@ -1221,6 +1286,75 @@ exit: - return ret; - } - -+void rtl8188eu_power_off(struct rtl8xxxu_priv *priv) -+{ -+ u8 val8; -+ u16 val16; -+ -+ rtl8xxxu_flush_fifo(priv); -+ -+ val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL); -+ val8 &= ~TX_REPORT_CTRL_TIMER_ENABLE; -+ rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8); -+ -+ /* Turn off RF */ -+ rtl8xxxu_write8(priv, REG_RF_CTRL, 0x00); -+ -+ rtl8188eu_active_to_lps(priv); -+ -+ /* Reset Firmware if running in RAM */ -+ if (rtl8xxxu_read8(priv, REG_MCU_FW_DL) & MCU_FW_RAM_SEL) -+ rtl8xxxu_firmware_self_reset(priv); -+ -+ /* Reset MCU */ -+ val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); -+ val16 &= ~SYS_FUNC_CPU_ENABLE; -+ rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); -+ -+ /* Reset MCU ready status */ -+ rtl8xxxu_write8(priv, REG_MCU_FW_DL, 0x00); -+ -+ /* 32K_CTRL looks to be very 8188e specific */ -+ val8 = rtl8xxxu_read8(priv, REG_32K_CTRL); -+ val8 &= ~BIT(0); -+ rtl8xxxu_write8(priv, REG_32K_CTRL, val8); -+ -+ rtl8188eu_active_to_emu(priv); -+ rtl8188eu_emu_to_disabled(priv); -+ -+ /* Reset MCU IO Wrapper */ -+ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL + 1); -+ val8 &= ~BIT(3); -+ rtl8xxxu_write8(priv, REG_RSV_CTRL + 1, val8); -+ -+ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL + 1); -+ val8 |= BIT(3); -+ rtl8xxxu_write8(priv, REG_RSV_CTRL + 1, val8); -+ -+ /* Vendor driver refers to GPIO_IN */ -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_PIN_CTRL); -+ /* Vendor driver refers to GPIO_OUT */ -+ rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 1, val8); -+ rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 2, 0xff); -+ -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL); -+ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 << 4); -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL + 1); -+ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 | 0x0f); -+ -+ /* -+ * Set LNA, TRSW, EX_PA Pin to output mode -+ * Referred to as REG_BB_PAD_CTRL in 8188eu vendor driver -+ */ -+ rtl8xxxu_write32(priv, REG_PAD_CTRL1, 0x00080808); -+ -+ rtl8xxxu_write8(priv, REG_RSV_CTRL, 0x00); -+ -+ val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -+ val16 |= APS_FSMCO_ENABLE_POWERDOWN | APS_FSMCO_HW_POWERDOWN; -+ rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); -+} -+ - static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) - { - rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); -@@ -1265,7 +1399,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .parse_efuse = rtl8188eu_parse_efuse, - .load_firmware = rtl8188eu_load_firmware, - .power_on = rtl8188eu_power_on, -- .power_off = rtl8xxxu_power_off, -+ .power_off = rtl8188eu_power_off, - .reset_8051 = rtl8188eu_reset_8051, - .llt_init = rtl8xxxu_init_llt_table, - .init_phy_bb = rtl8188eu_init_phy_bb, ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h -@@ -418,6 +418,8 @@ - #define REG_MBIST_START 0x0174 - #define REG_MBIST_DONE 0x0178 - #define REG_MBIST_FAIL 0x017c -+/* 8188EU */ -+#define REG_32K_CTRL 0x0194 - #define REG_C2HEVT_MSG_NORMAL 0x01a0 - /* 8192EU/8723BU/8812 */ - #define REG_C2HEVT_CMD_ID_8723B 0x01ae diff --git a/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch b/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch deleted file mode 100644 index 669fca670..000000000 --- a/package/kernel/mac80211/patches/653-0049-rtl8xxxu-Add-rtl8188eu-USB-ID-for-D-Link-USB-GO-N150.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5cd16e6a4660c07f01753e460eafdb805e71b9e9 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 29 Aug 2016 12:55:37 -0400 -Subject: [PATCH] rtl8xxxu: Add rtl8188eu USB ID for D-Link USB-GO-N150 - -Received one in the mail yesterday, seems to work like all the other -8188eu dongles I have. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -6332,6 +6332,9 @@ static const struct usb_device_id dev_ta - /* Sitecom rtl8188eus */ - {USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0076, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8188eu_fops}, -+/* D-Link USB-GO-N150 */ -+{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3311, 0xff, 0xff, 0xff), -+ .driver_info = (unsigned long)&rtl8188eu_fops}, - /* Still supported by rtlwifi */ - {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), - .driver_info = (unsigned long)&rtl8192cu_fops}, diff --git a/package/kernel/mac80211/patches/653-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch b/package/kernel/mac80211/patches/653-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch deleted file mode 100644 index 2c7413e35..000000000 --- a/package/kernel/mac80211/patches/653-0050-rtl8xxxu-Clear-SYS_FUNC_UPLL-during-power-up-on-8188.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 59a94447d4a98ab56cefe0b277251c660a333ce0 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 30 Aug 2016 14:33:18 -0400 -Subject: [PATCH] rtl8xxxu: Clear SYS_FUNC_UPLL during power up on 8188eu - -The vendor driver doesn't set this bit during BB config, so avoid -setting it here too. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -561,6 +561,7 @@ static void rtl8188eu_init_phy_bb(struct - val16 = rtl8xxxu_read16(priv, REG_SYS_FUNC); - val16 |= (SYS_FUNC_USBA | SYS_FUNC_USBD | - SYS_FUNC_BB_GLB_RSTN | SYS_FUNC_BBRSTB); -+ val16 &= ~SYS_FUNC_UPLL; - rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); - - rtl8xxxu_init_phy_regs(priv, rtl8188eu_phy_init_table); diff --git a/package/kernel/mac80211/patches/653-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch b/package/kernel/mac80211/patches/653-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch deleted file mode 100644 index 56be43a59..000000000 --- a/package/kernel/mac80211/patches/653-0051-rtl8xxxu-Early-enable-of-WEP-TKIP-security-on-8188eu.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 845f14c57fd50ec7e94f59bb1b5ad0cd1ecdbdd1 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 30 Aug 2016 15:47:05 -0400 -Subject: [PATCH] rtl8xxxu: Early enable of WEP/TKIP security on 8188eu - -This matches action taken in the vendor driver, however it is unclear -why this is done. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1394,6 +1394,9 @@ static void rtl8188e_usb_quirks(struct r - val32 = rtl8xxxu_read32(priv, REG_TXDMA_OFFSET_CHK); - val32 |= TXDMA_OFFSET_DROP_DATA_EN; - rtl8xxxu_write32(priv, REG_TXDMA_OFFSET_CHK, val32); -+ -+ /* Pre-TX enable WEP/TKIP security */ -+ rtl8xxxu_write8(priv, REG_EARLY_MODE_CONTROL_8188E + 3, 0x01); - } - - struct rtl8xxxu_fileops rtl8188eu_fops = { diff --git a/package/kernel/mac80211/patches/653-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch b/package/kernel/mac80211/patches/653-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch deleted file mode 100644 index 603785b5d..000000000 --- a/package/kernel/mac80211/patches/653-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 2764703c3c896d427731391aa978c536aaf4cb91 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 30 Aug 2016 17:23:35 -0400 -Subject: [PATCH] rtl8xxxu: Correct power down sequence for 8188eu - -This matches the vendor driver more correctly - -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 26 ++++++++++++++++------ - 1 file changed, 19 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1083,7 +1083,8 @@ static void rtl8188e_disabled_to_emu(str - u16 val16; - - val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); -- val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN); -+ val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN | -+ APS_FSMCO_HW_POWERDOWN); - rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); - } - -@@ -1196,15 +1197,26 @@ static int rtl8188eu_emu_to_disabled(str - { - u8 val8; - -- /* 0x04[12:11] = 01 enable WL suspend */ -- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 2); -- val8 &= ~BIT(0); -- rtl8xxxu_write8(priv, REG_APS_FSMCO + 2, val8); -+ val8 = rtl8xxxu_read8(priv, REG_AFE_XTAL_CTRL + 2); -+ val8 |= BIT(7); -+ rtl8xxxu_write8(priv, REG_AFE_XTAL_CTRL + 2, val8); - - val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -- val8 |= BIT(7); -+ val8 &= ~(BIT(3) | BIT(4)); -+ val8 |= BIT(3); - rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); - -+ rtl8xxxu_write8(priv, REG_APS_FSMCO + 3, 0x00); -+ -+ val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG + 1); -+ val8 &= ~BIT(4); -+ rtl8xxxu_write8(priv, REG_GPIO_MUXCFG + 1, val8); -+ -+ /* Set USB suspend enable local register 0xfe10[4]=1 */ -+ val8 = rtl8xxxu_read8(priv, 0xfe10); -+ val8 |= BIT(4); -+ rtl8xxxu_write8(priv, 0xfe10, val8); -+ - return 0; - } - -@@ -1339,7 +1351,7 @@ void rtl8188eu_power_off(struct rtl8xxxu - rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 2, 0xff); - - val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL); -- rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 << 4); -+ rtl8xxxu_write8(priv, REG_GPIO_IO_SEL, val8 << 4); - val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL + 1); - rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 | 0x0f); - diff --git a/package/kernel/mac80211/patches/653-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch b/package/kernel/mac80211/patches/653-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch deleted file mode 100644 index 9da901f93..000000000 --- a/package/kernel/mac80211/patches/653-0053-rtl8xxxu-Reset-8188eu-REG_GPIO_MUXCFG-on-power-off.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 89bc2e59923ffc65b4b4fc123ef152c1a9a49639 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 30 Aug 2016 17:30:14 -0400 -Subject: [PATCH] rtl8xxxu: Reset 8188eu REG_GPIO_MUXCFG on power off - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1363,6 +1363,8 @@ void rtl8188eu_power_off(struct rtl8xxxu - - rtl8xxxu_write8(priv, REG_RSV_CTRL, 0x00); - -+ rtl8xxxu_write32(priv, REG_GPIO_MUXCFG, 0x00000000); -+ - val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO); - val16 |= APS_FSMCO_ENABLE_POWERDOWN | APS_FSMCO_HW_POWERDOWN; - rtl8xxxu_write16(priv, REG_APS_FSMCO, val16); diff --git a/package/kernel/mac80211/patches/653-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch b/package/kernel/mac80211/patches/653-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch deleted file mode 100644 index 49a9f8bd8..000000000 --- a/package/kernel/mac80211/patches/653-0054-rtl8xxxu-Handle-devices-with-a-smaller-LLT-buffer.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 5dd3f1799baf4683c0161f7e49d65bee17f3e35d Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 31 Aug 2016 16:31:38 -0400 -Subject: [PATCH] rtl8xxxu: Handle devices with a smaller LLT buffer - -The 8188e (except for I cut parts) seem to have a smaller LLT buffer -than all other known devices. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 11 ++++++++--- - 3 files changed, 10 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1411,6 +1411,7 @@ struct rtl8xxxu_fileops { - u8 page_num_hi; - u8 page_num_lo; - u8 page_num_norm; -+ u8 last_llt_entry; - }; - - extern int rtl8xxxu_debug; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1454,4 +1454,5 @@ struct rtl8xxxu_fileops rtl8188eu_fops = - .page_num_hi = TX_PAGE_NUM_HI_PQ_8188E, - .page_num_lo = TX_PAGE_NUM_LO_PQ_8188E, - .page_num_norm = TX_PAGE_NUM_NORM_PQ_8188E, -+ .last_llt_entry = 176, - }; ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -2485,11 +2485,16 @@ static int rtl8xxxu_llt_write(struct rtl - int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv) - { - int ret; -- int i; -+ int i, last_entry; - u8 last_tx_page; - - last_tx_page = priv->fops->total_page_num; - -+ if (priv->fops->last_llt_entry) -+ last_entry = priv->fops->last_llt_entry; -+ else -+ last_entry = 255; -+ - for (i = 0; i < last_tx_page; i++) { - ret = rtl8xxxu_llt_write(priv, i, i + 1); - if (ret) -@@ -2501,14 +2506,14 @@ int rtl8xxxu_init_llt_table(struct rtl8x - goto exit; - - /* Mark remaining pages as a ring buffer */ -- for (i = last_tx_page + 1; i < 0xff; i++) { -+ for (i = last_tx_page + 1; i < last_entry; i++) { - ret = rtl8xxxu_llt_write(priv, i, (i + 1)); - if (ret) - goto exit; - } - - /* Let last entry point to the start entry of ring buffer */ -- ret = rtl8xxxu_llt_write(priv, 0xff, last_tx_page + 1); -+ ret = rtl8xxxu_llt_write(priv, last_entry, last_tx_page + 1); - if (ret) - goto exit; - diff --git a/package/kernel/mac80211/patches/653-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch b/package/kernel/mac80211/patches/653-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch deleted file mode 100644 index dc0b19161..000000000 --- a/package/kernel/mac80211/patches/653-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 7b4161933d0a409023f5ef70cdc9296ab1cf5430 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Wed, 14 Sep 2016 14:10:42 -0400 -Subject: [PATCH] rtl8xxxu: Fix reloading of driver for 8188eu devices - -For 8188eu, once the MAC is asked to power down by setting -APS_FSMCO_MAC_OFF, there seems to be no way to bring it back to life. - -In addition, only disable RF_ENABLE in RF_CTRL rather than all bits. - -This was spotted by Andrea Merello who noticed that if we dropped the -call to rtl8188eu_active_to_emu() reloading started working. - -Reported-by: Andrea Merello -Signed-off-by: Jes Sorensen ---- - .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 29 +++++----------------- - 1 file changed, 6 insertions(+), 23 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1160,37 +1160,18 @@ exit: - static int rtl8188eu_active_to_emu(struct rtl8xxxu_priv *priv) - { - u8 val8; -- int count, ret = 0; - - /* Turn off RF */ -- rtl8xxxu_write8(priv, REG_RF_CTRL, 0); -+ val8 = rtl8xxxu_read8(priv, REG_RF_CTRL); -+ val8 &= ~RF_ENABLE; -+ rtl8xxxu_write8(priv, REG_RF_CTRL, val8); - - /* LDO Sleep mode */ - val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL); - val8 |= BIT(4); - rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8); - -- /* 0x0005[1] = 1 turn off MAC by HW state machine*/ -- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -- val8 |= BIT(1); -- rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8); -- -- for (count = RTL8XXXU_MAX_REG_POLL; count; count--) { -- val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1); -- if ((val8 & BIT(1)) == 0) -- break; -- udelay(10); -- } -- -- if (!count) { -- dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n", -- __func__); -- ret = -EBUSY; -- goto exit; -- } -- --exit: -- return ret; -+ return 0; - } - - static int rtl8188eu_emu_to_disabled(struct rtl8xxxu_priv *priv) -@@ -1372,6 +1353,8 @@ void rtl8188eu_power_off(struct rtl8xxxu - - static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) - { -+ rtl8xxxu_write8(priv, REG_RF_CTRL, RF_ENABLE | RF_RSTB | RF_SDMRSTB); -+ - rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); - } - diff --git a/package/kernel/mac80211/patches/653-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch b/package/kernel/mac80211/patches/653-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch deleted file mode 100644 index b5c98ddbd..000000000 --- a/package/kernel/mac80211/patches/653-0056-rtl8xxxu-Make-sure-to-enable-OFDM-paths-for-8188eu-i.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ba518f046cc1ce63b6984948b19b4d3903c5c30b Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Mon, 3 Oct 2016 11:46:37 -0400 -Subject: [PATCH] rtl8xxxu: Make sure to enable OFDM paths for 8188eu in - rtl8188e_enable_rf() - -Failure to re-enable OFDM paths results in the dongle only receiving -CCK packets which isn't overly exciting. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c -@@ -1353,8 +1353,22 @@ void rtl8188eu_power_off(struct rtl8xxxu - - static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv) - { -+ u32 val32; -+ - rtl8xxxu_write8(priv, REG_RF_CTRL, RF_ENABLE | RF_RSTB | RF_SDMRSTB); - -+ val32 = rtl8xxxu_read32(priv, REG_OFDM0_TRX_PATH_ENABLE); -+ val32 &= ~(OFDM_RF_PATH_RX_MASK | OFDM_RF_PATH_TX_MASK); -+ if (priv->rx_paths == 2) -+ val32 |= OFDM_RF_PATH_RX_A | OFDM_RF_PATH_RX_B; -+ else -+ val32 |= OFDM_RF_PATH_RX_A; -+ if (priv->tx_paths == 2) -+ val32 |= OFDM_RF_PATH_TX_A | OFDM_RF_PATH_TX_B; -+ else -+ val32 |= OFDM_RF_PATH_TX_A; -+ rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, val32); -+ - rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); - } - diff --git a/package/kernel/mac80211/patches/653-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch b/package/kernel/mac80211/patches/653-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch deleted file mode 100644 index 620783a89..000000000 --- a/package/kernel/mac80211/patches/653-0057-rtl8xxxu-Add-rpt_sel-entry-to-struct-rtl8xxxu_rxdesc.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f670de32e58c1623ee30d7511e62e7b7e2164684 Mon Sep 17 00:00:00 2001 -From: Jes Sorensen -Date: Tue, 4 Oct 2016 12:40:22 -0400 -Subject: [PATCH] rtl8xxxu: Add rpt_sel entry to struct rtl8xxxu_rxdesc16 - -The 8188e supports TX reports which will show up as an RX packet, -similar to how the gen2 parts handle it. - -Signed-off-by: Jes Sorensen ---- - drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -161,7 +161,8 @@ struct rtl8xxxu_rxdesc16 { - u32 htc:1; - u32 eosp:1; - u32 bssidfit:2; -- u32 reserved1:16; -+ u32 rpt_sel:2; /* 8188e */ -+ u32 reserved1:14; - u32 unicastwake:1; - u32 magicwake:1; - -@@ -219,7 +220,8 @@ struct rtl8xxxu_rxdesc16 { - - u32 magicwake:1; - u32 unicastwake:1; -- u32 reserved1:16; -+ u32 reserved1:14; -+ u32 rpt_sel:2; /* 8188e */ - u32 bssidfit:2; - u32 eosp:1; - u32 htc:1; diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch index b7bce637f..65782906a 100644 --- a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1295,6 +1295,7 @@ int __init brcmf_core_init(void) +@@ -1322,6 +1322,7 @@ int __init brcmf_core_init(void) { if (!schedule_work(&brcmf_driver_work)) return -EBUSY; @@ -23,66 +23,44 @@ Signed-off-by: Rafał Miłecki } --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -444,6 +444,7 @@ struct brcmf_fw { - u16 bus_nr; - void (*done)(struct device *dev, int err, const struct firmware *fw, - void *nvram_image, u32 nvram_len); +@@ -441,6 +441,7 @@ struct brcmf_fw { + struct brcmf_fw_request *req; + u32 curpos; + void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); + struct completion *completion; }; - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) -@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done( - goto fail; - - fwctx->done(fwctx->dev, 0, fwctx->code, nvram, nvram_length); -+ if (fwctx->completion) -+ complete(fwctx->completion); - kfree(fwctx); - return; - -@@ -485,6 +488,8 @@ fail: - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); - release_firmware(fwctx->code); - fwctx->done(fwctx->dev, -ENOENT, NULL, NULL, 0); -+ if (fwctx->completion) -+ complete(fwctx->completion); - kfree(fwctx); - } - -@@ -516,6 +521,8 @@ fail: - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); + static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); +@@ -589,6 +590,8 @@ fail: + fwctx->req = NULL; done: - fwctx->done(fwctx->dev, ret, fw, NULL, 0); + fwctx->done(fwctx->dev, ret, fwctx->req); + if (fwctx->completion) + complete(fwctx->completion); kfree(fwctx); } -@@ -527,6 +534,8 @@ int brcmf_fw_get_firmwares_pcie(struct d - u16 domain_nr, u16 bus_nr) +@@ -612,6 +615,8 @@ int brcmf_fw_get_firmwares(struct device + struct brcmf_fw_request *req)) { struct brcmf_fw *fwctx; + struct completion completion; + int err; brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); - if (!fw_cb || !code) -@@ -547,9 +556,17 @@ int brcmf_fw_get_firmwares_pcie(struct d - fwctx->domain_nr = domain_nr; - fwctx->bus_nr = bus_nr; + if (!fw_cb) +@@ -628,7 +633,14 @@ int brcmf_fw_get_firmwares(struct device + fwctx->req = req; + fwctx->done = fw_cb; -- return request_firmware_nowait(THIS_MODULE, true, code, dev, + init_completion(&completion); + fwctx->completion = &completion; + -+ err = request_firmware_nowait(THIS_MODULE, true, code, dev, - GFP_KERNEL, fwctx, - brcmf_fw_request_code_done); -+ if (!err) -+ wait_for_completion_timeout(fwctx->completion, -+ msecs_to_jiffies(5000)); + brcmf_fw_request_next_item(fwctx, true); ++ ++ wait_for_completion_timeout(fwctx->completion, msecs_to_jiffies(5000)); + fwctx->completion = NULL; -+ return err; ++ + return 0; } - int brcmf_fw_get_firmwares(struct device *dev, u16 flags, diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch index c02d00966..9b3605907 100644 --- a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2727,6 +2727,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2725,6 +2725,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch b/package/kernel/mac80211/patches/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch index 0ae012cbe..417b6ec86 100644 --- a/package/kernel/mac80211/patches/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch +++ b/package/kernel/mac80211/patches/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch @@ -9,7 +9,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -71,7 +71,11 @@ static int brcmf_fcmode; +@@ -70,7 +70,11 @@ static int brcmf_fcmode; module_param_named(fcmode, brcmf_fcmode, int, 0); MODULE_PARM_DESC(fcmode, "Mode of firmware signalled flow control"); diff --git a/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch b/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch new file mode 100644 index 000000000..9dceea8f4 --- /dev/null +++ b/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch @@ -0,0 +1,132 @@ +From: Sebastian Gottschall + +current handling of peer_bw_rxnss_override parameter is based on guessing the +VHT160/8080 capability by rx rate. this is wrong and may lead +to a non initialized peer_bw_rxnss_override parameter which is required since +VHT160 operation mode only supports 2x2 chainmasks in addition the original code +initialized the parameter with wrong masked values. +This patch uses the peer phymode and peer nss information for correct +initialisation of the peer_bw_rxnss_override parameter. +if this peer information is not available, we initialize the parameter by +minimum nss which is suggested by QCA as temporary workaround according +to the QCA sourcecodes. + +Signed-off-by: Sebastian Gottschall + +v2: remove debug messages +v3: apply some cosmetics, update documentation +v4: fix compile warning and truncate nss to maximum of 2x2 since current +chipsets only support 2x2 at vht160 +v5: handle maximum nss for chipsets supportig vht160 with 1x1 only +v7: use more simple code variant and take care about hw/sw chainmask +configuration +--- + drivers/net/wireless/ath/ath10k/mac.c | 40 +++++++++++++++------------ + drivers/net/wireless/ath/ath10k/wmi.c | 7 +---- + drivers/net/wireless/ath/ath10k/wmi.h | 14 +++++++++- + 3 files changed, 36 insertions(+), 25 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -2466,7 +2466,7 @@ static void ath10k_peer_assoc_h_vht(stru + const u16 *vht_mcs_mask; + u8 ampdu_factor; + u8 max_nss, vht_mcs; +- int i; ++ int i, nss160; + + if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) + return; +@@ -2526,23 +2526,27 @@ static void ath10k_peer_assoc_h_vht(stru + __le16_to_cpu(vht_cap->vht_mcs.tx_highest); + arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( + __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); ++ arg->peer_bw_rxnss_override = 0; ++ nss160 = 1; /* 1x1 default config for VHT160 */ + +- ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n", +- sta->addr, arg->peer_max_mpdu, arg->peer_flags); +- +- if (arg->peer_vht_rates.rx_max_rate && +- (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK)) { +- switch (arg->peer_vht_rates.rx_max_rate) { +- case 1560: +- /* Must be 2x2 at 160Mhz is all it can do. */ +- arg->peer_bw_rxnss_override = 2; +- break; +- case 780: +- /* Can only do 1x1 at 160Mhz (Long Guard Interval) */ +- arg->peer_bw_rxnss_override = 1; +- break; +- } ++ /* only 4x4 configuration do support 2x2 for VHT160, everything else must use 1x1 */ ++ if (ar->cfg_rx_chainmask == 15) ++ nss160 = arg->peer_num_spatial_streams <= 2 ? arg->peer_num_spatial_streams : 2; ++ ++ /* in case if peer is connected with vht160 or vht80+80, we need to properly adjust rxnss parameters otherwise firmware will raise a assert */ ++ switch(arg->peer_phymode) { ++ case MODE_11AC_VHT80_80: ++ arg->peer_bw_rxnss_override = BW_NSS_FWCONF_80_80(nss160); ++ /* fall through */ ++ case MODE_11AC_VHT160: ++ arg->peer_bw_rxnss_override |= BW_NSS_FWCONF_160(nss160); ++ break; ++ default: ++ break; + } ++ ++ ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x peer_bw_rxnss_override 0x%x\n", ++ sta->addr, arg->peer_max_mpdu, arg->peer_flags, arg->peer_bw_rxnss_override); + } + + static void ath10k_peer_assoc_h_qos(struct ath10k *ar, +@@ -2694,9 +2698,9 @@ static int ath10k_peer_assoc_prepare(str + ath10k_peer_assoc_h_crypto(ar, vif, sta, arg); + ath10k_peer_assoc_h_rates(ar, vif, sta, arg); + ath10k_peer_assoc_h_ht(ar, vif, sta, arg); ++ ath10k_peer_assoc_h_phymode(ar, vif, sta, arg); + ath10k_peer_assoc_h_vht(ar, vif, sta, arg); + ath10k_peer_assoc_h_qos(ar, vif, sta, arg); +- ath10k_peer_assoc_h_phymode(ar, vif, sta, arg); + + return 0; + } +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -6760,12 +6760,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a + struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; + + ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); +- if (arg->peer_bw_rxnss_override) +- cmd->peer_bw_rxnss_override = +- __cpu_to_le32((arg->peer_bw_rxnss_override - 1) | +- BIT(PEER_BW_RXNSS_OVERRIDE_OFFSET)); +- else +- cmd->peer_bw_rxnss_override = 0; ++ cmd->peer_bw_rxnss_override = __cpu_to_le32(arg->peer_bw_rxnss_override); + } + + static int +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -6209,7 +6209,19 @@ struct wmi_10_2_peer_assoc_complete_cmd + __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */ + } __packed; + +-#define PEER_BW_RXNSS_OVERRIDE_OFFSET 31 ++#define BW_NSS_FWCONF_MAP_ENABLE (1 << 31) ++#define BW_NSS_FWCONF_MAP_160MHZ_S (0) ++#define BW_NSS_FWCONF_MAP_160MHZ_M (0x00000007) ++#define BW_NSS_FWCONF_MAP_80_80MHZ_S (3) ++#define BW_NSS_FWCONF_MAP_80_80MHZ_M (0x00000038) ++#define BW_NSS_FWCONF_MAP_M (0x0000003F) ++ ++#define GET_BW_NSS_FWCONF_160(x) ((((x) & BW_NSS_FWCONF_MAP_160MHZ_M) >> BW_NSS_FWCONF_MAP_160MHZ_S) + 1) ++#define GET_BW_NSS_FWCONF_80_80(x) ((((x) & BW_NSS_FWCONF_MAP_80_80MHZ_M) >> BW_NSS_FWCONF_MAP_80_80MHZ_S) + 1) ++ ++/* Values defined to set 160 MHz Bandwidth NSS Mapping into FW*/ ++#define BW_NSS_FWCONF_160(x) (BW_NSS_FWCONF_MAP_ENABLE | (((x - 1) << BW_NSS_FWCONF_MAP_160MHZ_S) & BW_NSS_FWCONF_MAP_160MHZ_M)) ++#define BW_NSS_FWCONF_80_80(x) (BW_NSS_FWCONF_MAP_ENABLE | (((x - 1) << BW_NSS_FWCONF_MAP_80_80MHZ_S) & BW_NSS_FWCONF_MAP_80_80MHZ_M)) + + struct wmi_10_4_peer_assoc_complete_cmd { + struct wmi_10_2_peer_assoc_complete_cmd cmd; diff --git a/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch b/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch new file mode 100644 index 000000000..657b31f5a --- /dev/null +++ b/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch @@ -0,0 +1,50 @@ +From: Sebastian Gottschall + +starting with firmware 10.4.3.4.x series QCA changed the handling of the channel property band_center_freq1 and band_center_freq2 in vht160 operation mode +likelly for backward compatiblity with vht80 only capable clients. +this patch adjusts the handling to get vht160 to work again with official qca firmwares newer than 3.3 +consider that this patch will not work with older firmwares anymore. to avoid undefined behaviour this we disable vht160 capability for outdated firmwares +--- + drivers/net/wireless/ath/ath10k/mac.c | 7 ------- + drivers/net/wireless/ath/ath10k/wmi.c | 11 ++++++++--- + 2 files changed, 8 insertions(+), 10 deletions(-) +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -4415,13 +4415,6 @@ static struct ieee80211_sta_vht_cap ath1 + vht_cap.cap |= val; + } + +- /* Currently the firmware seems to be buggy, don't enable 80+80 +- * mode until that's resolved. +- */ +- if ((ar->vht_cap_info & IEEE80211_VHT_CAP_SHORT_GI_160) && +- (ar->vht_cap_info & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) == 0) +- vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; +- + mcs_map = 0; + for (i = 0; i < 8; i++) { + if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -1660,13 +1660,18 @@ void ath10k_wmi_put_wmi_channel(struct w + flags |= WMI_CHAN_FLAG_HT40_PLUS; + if (arg->chan_radar) + flags |= WMI_CHAN_FLAG_DFS; +- ++ ch->band_center_freq2 = 0; + ch->mhz = __cpu_to_le32(arg->freq); + ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1); + if (arg->mode == MODE_11AC_VHT80_80) + ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq2); +- else +- ch->band_center_freq2 = 0; ++ if (arg->mode == MODE_11AC_VHT160) { ++ if (arg->freq < arg->band_center_freq1) ++ ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 - 40); ++ else ++ ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 + 40); ++ ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq1); ++ } + ch->min_power = arg->min_power; + ch->max_power = arg->max_power; + ch->reg_power = arg->max_reg_power; diff --git a/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch new file mode 100644 index 000000000..ee216529f --- /dev/null +++ b/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -0,0 +1,643 @@ +From: Sebastian Gottschall + +Adds LED and GPIO Control support for 988x, 9887, 9888, 99x0, 9984 based +chipsets with on chipset connected led's using WMI Firmware API. The LED +device will get available named as "ath10k-phyX" at sysfs and can be controlled +with various triggers. adds also debugfs interface for gpio control. + +This patch is specific for OpenWRt base, as is use old backported package +with old wireless source. Support for QCA9984 is removed and a simbol +is added to local-simbol file to export the actually compile the code +with the ATH10K_LEDS simbol. + + +Signed-off-by: Sebastian Gottschall +Reviewed-by: Steve deRosier +[kvalo: major reorg and cleanup] +Signed-off-by: Kalle Valo +Signed-off-by: Ansuel Smith +--- + +v13: + +* only compile tested! + +* fix all checkpatch warnings + +* fix commit log + +* sizeof(struct ath10k_gpiocontrol) -> sizeof(*gpio) + +* unsigned -> unsigned int + +* remove GPIOLIB code, that should be added in a separate patch + +* rename gpio.c to leds.c + +* add leds.h + +* rename some functions: + + ath10k_attach_led() -> ath10k_leds_register() + ath10k_unregister_led() -> ath10k_leds_unregister() + ath10k_reset_led_pin() -> ath10k_leds_start() + +* call ath10k_leds_unregister() before ath10k_thermal_unregister() to preserve ordering + +* call ath10k_leds_start() only from ath10k_core_start() and not from mac.c + +* rename struct ath10k_gpiocontrol as anonymous function under struct + ath10k::leds, no need for memory allocation + +* merge ath10k_add_led() to ath10k_attach_led(), which is it's only caller + +* remove #if IS_ENABLED() checks from most of places, memory savings from those were not worth it + +* Kconfig help text improvement and move it lower in the menu, also don't enable it by default + +* switch to set_brightness_blocking() so that the callback can sleep, + then no need to use ath10k_wmi_cmd_send_nowait() and can take mutex + to access ar->state + +* don't touch ath10k_wmi_pdev_get_temperature() + +* as QCA6174/QCA9377 are not (yet) supported don't add the command to WMI-TLV interface + +* remove debugfs interface, that should be added in another patch + +* cleanup includes + + + drivers/net/wireless/ath/ath10k/Kconfig | 10 +++ + drivers/net/wireless/ath/ath10k/Makefile | 1 + + drivers/net/wireless/ath/ath10k/core.c | 22 +++++++ + drivers/net/wireless/ath/ath10k/core.h | 9 ++- + drivers/net/wireless/ath/ath10k/hw.h | 1 + + drivers/net/wireless/ath/ath10k/leds.c | 103 ++++++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath10k/leds.h | 45 +++++++++++++ + drivers/net/wireless/ath/ath10k/mac.c | 1 + + drivers/net/wireless/ath/ath10k/wmi-ops.h | 32 ++++++++++ + drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 + + drivers/net/wireless/ath/ath10k/wmi.c | 54 ++++++++++++++++ + drivers/net/wireless/ath/ath10k/wmi.h | 35 ++++++++++ + 12 files changed, 314 insertions(+), 1 deletion(-) + create mode 100644 drivers/net/wireless/ath/ath10k/leds.c + create mode 100644 drivers/net/wireless/ath/ath10k/leds.h +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Kconfig +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/Kconfig ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/Kconfig +@@ -56,6 +56,16 @@ config ATH10K_DEBUGFS + + If unsure, say Y to make it easier to debug problems. + ++config ATH10K_LEDS ++ bool "Atheros ath10k LED support" ++ depends on ATH10K ++ select MAC80211_LEDS ++ select LEDS_CLASS ++ select NEW_LEDS ++ default y ++ ---help--- ++ This option is necessary, if you want LED support for chipset connected led pins. If unsure, say N. ++ + config ATH10K_SPECTRAL + bool "Atheros ath10k spectral scan support" + depends on ATH10K_DEBUGFS +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Makefile +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/Makefile ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/Makefile +@@ -18,6 +18,7 @@ ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += + ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o + ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o + ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o ++ath10k_core-$(CPTCFG_ATH10K_LEDS) += leds.o + ath10k_core-$(CPTCFG_MAC80211_DEBUGFS) += debugfs_sta.o + ath10k_core-$(CONFIG_PM) += wow.o + +Index: backports-2017-11-01/local-symbols +=================================================================== +--- backports-2017-11-01.orig/local-symbols ++++ backports-2017-11-01/local-symbols +@@ -143,6 +143,7 @@ ATH10K_USB= + ATH10K_DEBUG= + ATH10K_DEBUGFS= + ATH10K_SPECTRAL= ++ATH10K_LEDS= + ATH10K_TRACING= + ATH10K_DFS_CERTIFIED= + WCN36XX= +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/core.c ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c +@@ -32,6 +32,7 @@ + #include "htt.h" + #include "testmode.h" + #include "wmi-ops.h" ++#include "leds.h" + + unsigned int ath10k_debug_mask; + static unsigned int ath10k_cryptmode_param; +@@ -56,6 +57,7 @@ static const struct ath10k_hw_params ath + .id = QCA988X_HW_2_0_VERSION, + .dev_id = QCA988X_2_0_DEVICE_ID, + .name = "qca988x hw2.0", ++ .led_pin = 1, + .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, +@@ -80,6 +82,7 @@ static const struct ath10k_hw_params ath + .id = QCA9887_HW_1_0_VERSION, + .dev_id = QCA9887_1_0_DEVICE_ID, + .name = "qca9887 hw1.0", ++ .led_pin = 1, + .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, +@@ -199,6 +202,7 @@ static const struct ath10k_hw_params ath + .id = QCA99X0_HW_2_0_DEV_VERSION, + .dev_id = QCA99X0_2_0_DEVICE_ID, + .name = "qca99x0 hw2.0", ++ .led_pin = 17, + .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .otp_exe_param = 0x00000700, +@@ -228,6 +232,7 @@ static const struct ath10k_hw_params ath + .id = QCA9984_HW_1_0_DEV_VERSION, + .dev_id = QCA9984_1_0_DEVICE_ID, + .name = "qca9984/qca9994 hw1.0", ++ .led_pin = 17, + .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, +@@ -262,6 +267,7 @@ static const struct ath10k_hw_params ath + .id = QCA9888_HW_2_0_DEV_VERSION, + .dev_id = QCA9888_2_0_DEVICE_ID, + .name = "qca9888 hw2.0", ++ .led_pin = 17, + .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, +@@ -2254,6 +2260,10 @@ int ath10k_core_start(struct ath10k *ar, + if (status) + goto err_hif_stop; + ++ status = ath10k_leds_start(ar); ++ if (status) ++ goto err_hif_stop; ++ + return 0; + + err_hif_stop: +@@ -2471,9 +2481,18 @@ static void ath10k_core_register_work(st + goto err_spectral_destroy; + } + ++ status = ath10k_leds_register(ar); ++ if (status) { ++ ath10k_err(ar, "could not register leds: %d\n", ++ status); ++ goto err_thermal_unregister; ++ } ++ + set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags); + return; + ++err_thermal_unregister: ++ ath10k_thermal_unregister(ar); + err_spectral_destroy: + ath10k_spectral_destroy(ar); + err_debug_destroy: +@@ -2515,6 +2534,8 @@ void ath10k_core_unregister(struct ath10 + if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) + return; + ++ ath10k_leds_unregister(ar); ++ + ath10k_thermal_unregister(ar); + /* Stop spectral before unregistering from mac80211 to remove the + * relayfs debugfs file cleanly. Otherwise the parent debugfs tree +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/core.h ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #include "htt.h" + #include "htc.h" +@@ -789,7 +790,6 @@ struct ath10k { + u32 low_5ghz_chan; + u32 high_5ghz_chan; + bool ani_enabled; +- + bool p2p; + + struct { +@@ -972,6 +972,13 @@ struct ath10k { + } testmode; + + struct { ++ struct gpio_led wifi_led; ++ struct led_classdev cdev; ++ char label[48]; ++ u32 gpio_state_pin; ++ } leds; ++ ++ struct { + /* protected by data_lock */ + u32 fw_crash_counter; + u32 fw_warm_reset_counter; +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/hw.h +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/hw.h ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/hw.h +@@ -490,6 +490,7 @@ struct ath10k_hw_params { + const char *name; + u32 patch_load_addr; + int uart_pin; ++ int led_pin; + u32 otp_exe_param; + + /* Type of hw cycle counter wraparound logic, for more info +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.c +=================================================================== +--- /dev/null ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.c +@@ -0,0 +1,103 @@ ++/* ++ * Copyright (c) 2005-2011 Atheros Communications Inc. ++ * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. ++ * Copyright (c) 2018 Sebastian Gottschall ++ * Copyright (c) 2018, The Linux Foundation. All rights reserved. ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * 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 "core.h" ++#include "wmi.h" ++#include "wmi-ops.h" ++ ++#include "leds.h" ++ ++static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++{ ++ struct ath10k *ar = container_of(led_cdev, struct ath10k, ++ leds.cdev); ++ struct gpio_led *led = &ar->leds.wifi_led; ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ if (ar->state != ATH10K_STATE_ON) ++ goto out; ++ ++ ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low; ++ ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin); ++ ++out: ++ mutex_unlock(&ar->conf_mutex); ++ ++ return 0; ++} ++ ++int ath10k_leds_start(struct ath10k *ar) ++{ ++ if (ar->hw_params.led_pin == 0) ++ /* leds not supported */ ++ return 0; ++ ++ /* under some circumstances, the gpio pin gets reconfigured ++ * to default state by the firmware, so we need to ++ * reconfigure it this behaviour has only ben seen on ++ * QCA9984 and QCA99XX devices so far ++ */ ++ ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0, ++ WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE); ++ ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1); ++ ++ return 0; ++} ++ ++int ath10k_leds_register(struct ath10k *ar) ++{ ++ int ret; ++ ++ if (ar->hw_params.led_pin == 0) ++ /* leds not supported */ ++ return 0; ++ ++ snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s", ++ wiphy_name(ar->hw->wiphy)); ++ ar->leds.wifi_led.active_low = 1; ++ ar->leds.wifi_led.gpio = ar->hw_params.led_pin; ++ ar->leds.wifi_led.name = ar->leds.label; ++ ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP; ++ ++ ar->leds.cdev.name = ar->leds.label; ++ ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; ++ ++ /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ ++ ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; ++ ++ ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ ++void ath10k_leds_unregister(struct ath10k *ar) ++{ ++ if (ar->hw_params.led_pin == 0) ++ /* leds not supported */ ++ return; ++ ++ led_classdev_unregister(&ar->leds.cdev); ++} ++ +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.h +=================================================================== +--- /dev/null ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.h +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2018, The Linux Foundation. All rights reserved. ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * 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. ++ */ ++#ifndef _LEDS_H_ ++#define _LEDS_H_ ++ ++#include "core.h" ++ ++#ifdef CPTCFG_ATH10K_LEDS ++void ath10k_leds_unregister(struct ath10k *ar); ++int ath10k_leds_start(struct ath10k *ar); ++int ath10k_leds_register(struct ath10k *ar); ++#else ++static inline void ath10k_leds_unregister(struct ath10k *ar) ++{ ++} ++ ++static inline int ath10k_leds_start(struct ath10k *ar) ++{ ++ return 0; ++} ++ ++static inline int ath10k_leds_register(struct ath10k *ar) ++{ ++ return 0; ++} ++ ++#endif ++#endif /* _LEDS_H_ */ +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/mac.c +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/mac.c ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/mac.c +@@ -32,6 +32,7 @@ + #include "wmi-tlv.h" + #include "wmi-ops.h" + #include "wow.h" ++#include "leds.h" + + /*********/ + /* Rates */ +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-ops.h +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi-ops.h ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-ops.h +@@ -197,6 +197,10 @@ struct wmi_ops { + (struct ath10k *ar, + enum wmi_bss_survey_req_type type); + struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value); ++ struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num, ++ u32 input, u32 pull_type, u32 intr_mode); ++ ++ struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set); + }; + + int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); +@@ -951,6 +955,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * + return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); + } + ++static inline int ath10k_wmi_gpio_config(struct ath10k *ar, u32 gpio_num, ++ u32 input, u32 pull_type, u32 intr_mode) ++{ ++ struct sk_buff *skb; ++ ++ if (!ar->wmi.ops->gen_gpio_config) ++ return -EOPNOTSUPP; ++ ++ skb = ar->wmi.ops->gen_gpio_config(ar, gpio_num, input, pull_type, intr_mode); ++ if (IS_ERR(skb)) ++ return PTR_ERR(skb); ++ ++ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_config_cmdid); ++} ++ ++static inline int ath10k_wmi_gpio_output(struct ath10k *ar, u32 gpio_num, u32 set) ++{ ++ struct sk_buff *skb; ++ ++ if (!ar->wmi.ops->gen_gpio_config) ++ return -EOPNOTSUPP; ++ ++ skb = ar->wmi.ops->gen_gpio_output(ar, gpio_num, set); ++ if (IS_ERR(skb)) ++ return PTR_ERR(skb); ++ ++ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_output_cmdid); ++} ++ + static inline int + ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) + { +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-tlv.c +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi-tlv.c ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-tlv.c +@@ -3619,6 +3619,8 @@ static const struct wmi_ops wmi_tlv_ops + .gen_echo = ath10k_wmi_tlv_op_gen_echo, + .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, + .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, ++ /* .gen_gpio_config not implemented */ ++ /* .gen_gpio_output not implemented */ + }; + + static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi.c ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c +@@ -6580,6 +6580,49 @@ ath10k_wmi_op_gen_peer_set_param(struct + return skb; + } + ++static struct sk_buff *ath10k_wmi_op_gen_gpio_config(struct ath10k *ar, ++ u32 gpio_num, u32 input, ++ u32 pull_type, u32 intr_mode) ++{ ++ struct wmi_gpio_config_cmd *cmd; ++ struct sk_buff *skb; ++ ++ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); ++ if (!skb) ++ return ERR_PTR(-ENOMEM); ++ ++ cmd = (struct wmi_gpio_config_cmd *)skb->data; ++ cmd->pull_type = __cpu_to_le32(pull_type); ++ cmd->gpio_num = __cpu_to_le32(gpio_num); ++ cmd->input = __cpu_to_le32(input); ++ cmd->intr_mode = __cpu_to_le32(intr_mode); ++ ++ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_config gpio_num 0x%08x input 0x%08x pull_type 0x%08x intr_mode 0x%08x\n", ++ gpio_num, input, pull_type, intr_mode); ++ ++ return skb; ++} ++ ++static struct sk_buff *ath10k_wmi_op_gen_gpio_output(struct ath10k *ar, ++ u32 gpio_num, u32 set) ++{ ++ struct wmi_gpio_output_cmd *cmd; ++ struct sk_buff *skb; ++ ++ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); ++ if (!skb) ++ return ERR_PTR(-ENOMEM); ++ ++ cmd = (struct wmi_gpio_output_cmd *)skb->data; ++ cmd->gpio_num = __cpu_to_le32(gpio_num); ++ cmd->set = __cpu_to_le32(set); ++ ++ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_output gpio_num 0x%08x set 0x%08x\n", ++ gpio_num, set); ++ ++ return skb; ++} ++ + static struct sk_buff * + ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, + enum wmi_sta_ps_mode psmode) +@@ -8081,6 +8124,9 @@ static const struct wmi_ops wmi_ops = { + .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, + .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, + .gen_echo = ath10k_wmi_op_gen_echo, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, ++ + /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ +@@ -8151,6 +8197,8 @@ static const struct wmi_ops wmi_10_1_ops + .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, + .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, + .gen_echo = ath10k_wmi_op_gen_echo, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, + /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ +@@ -8222,6 +8270,8 @@ static const struct wmi_ops wmi_10_2_ops + .gen_delba_send = ath10k_wmi_op_gen_delba_send, + .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, + .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, + /* .gen_pdev_enable_adaptive_cca not implemented */ + }; + +@@ -8292,6 +8342,8 @@ static const struct wmi_ops wmi_10_2_4_o + .gen_pdev_enable_adaptive_cca = + ath10k_wmi_op_gen_pdev_enable_adaptive_cca, + .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, + /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ +@@ -8367,6 +8419,8 @@ static const struct wmi_ops wmi_10_4_ops + .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, + .gen_echo = ath10k_wmi_op_gen_echo, + .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, + }; + + int ath10k_wmi_attach(struct ath10k *ar) +Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.h +=================================================================== +--- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi.h ++++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.h +@@ -2899,6 +2899,41 @@ enum wmi_10_4_feature_mask { + + }; + ++/* WMI_GPIO_CONFIG_CMDID */ ++enum { ++ WMI_GPIO_PULL_NONE, ++ WMI_GPIO_PULL_UP, ++ WMI_GPIO_PULL_DOWN, ++}; ++ ++enum { ++ WMI_GPIO_INTTYPE_DISABLE, ++ WMI_GPIO_INTTYPE_RISING_EDGE, ++ WMI_GPIO_INTTYPE_FALLING_EDGE, ++ WMI_GPIO_INTTYPE_BOTH_EDGE, ++ WMI_GPIO_INTTYPE_LEVEL_LOW, ++ WMI_GPIO_INTTYPE_LEVEL_HIGH ++}; ++ ++/* WMI_GPIO_CONFIG_CMDID */ ++struct wmi_gpio_config_cmd { ++ __le32 gpio_num; /* GPIO number to be setup */ ++ __le32 input; /* 0 - Output/ 1 - Input */ ++ __le32 pull_type; /* Pull type defined above */ ++ __le32 intr_mode; /* Interrupt mode defined above (Input) */ ++} __packed; ++ ++/* WMI_GPIO_OUTPUT_CMDID */ ++struct wmi_gpio_output_cmd { ++ __le32 gpio_num; /* GPIO number to be setup */ ++ __le32 set; /* Set the GPIO pin*/ ++} __packed; ++ ++/* WMI_GPIO_INPUT_EVENTID */ ++struct wmi_gpio_input_event { ++ __le32 gpio_num; /* GPIO number which changed state */ ++} __packed; ++ + struct wmi_ext_resource_config_10_4_cmd { + /* contains enum wmi_host_platform_type */ + __le32 host_platform_config; diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 7d723b9e6..2906849cf 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-05-15 -PKG_SOURCE_VERSION:=e87f925667a2c68e6a5a1f55e3a92c9e10570e61 -PKG_MIRROR_HASH:=7f6118d033785b509e25540fafd0166076e98b8f1d9baceab4c532e6f9d537b3 +PKG_SOURCE_DATE:=2018-07-13 +PKG_SOURCE_VERSION:=67803752363db5e81c7a74a9491a3041aa776284 +PKG_MIRROR_HASH:=733030674a782d96c5ea2fcbcbc2de5486f645d9fb4a84cfb74246a78b459569 PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index 86228eeb1..9e9824afe 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -15,9 +15,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-03-30 -PKG_SOURCE_VERSION:=fcaea79ad33d6ae3c381d9e96bf77d6870ca8e79 -PKG_MIRROR_HASH:=1c0fa04ca80939038139dd50a50d9dc0d879b7cb594770282e3ec0008a479452 +PKG_SOURCE_DATE:=2018-06-15 +PKG_SOURCE_VERSION:=8683de8e97a31fe01cfd4e63ef6e9867b50aadae +PKG_MIRROR_HASH:=69cd9f7c79564e444edf423133b13dcfbba9f66c051516606049087fa1973a20 PKG_MAINTAINER:=Imre Kaloz PKG_BUILD_PARALLEL:=1 @@ -27,7 +27,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/mwlwifi SUBMENU:=Wireless Drivers - TITLE:=Marvell 88W8864/88W8897/88W8964 wireless driver + TITLE:=Marvell 88W8864/88W8897/88W8964/88W8997 wireless driver DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT @TARGET_mvebu FILES:=$(PKG_BUILD_DIR)/mwlwifi.ko AUTOLOAD:=$(call AutoLoad,50,mwlwifi) @@ -87,7 +87,16 @@ define Package/mwlwifi-firmware-88w8964/install $(call Package/mwlwifi-firmware/install,$(1),88W8964.bin) endef +define Package/mwlwifi-firmware-88w8997 +$(call Package/mwlwifi-firmware-default,88W8997) +endef + +define Package/mwlwifi-firmware-88w8997/install + $(call Package/mwlwifi-firmware/install,$(1),88W8997.bin) +endef + $(eval $(call KernelPackage,mwlwifi)) $(eval $(call BuildPackage,mwlwifi-firmware-88w8864)) $(eval $(call BuildPackage,mwlwifi-firmware-88w8897)) $(eval $(call BuildPackage,mwlwifi-firmware-88w8964)) +$(eval $(call BuildPackage,mwlwifi-firmware-88w8997)) diff --git a/package/lean/default-settings/files/zzz-default-settings b/package/lean/default-settings/files/zzz-default-settings index d6e272537..7376811b3 100755 --- a/package/lean/default-settings/files/zzz-default-settings +++ b/package/lean/default-settings/files/zzz-default-settings @@ -57,7 +57,7 @@ sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh wifi up sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release -echo "DISTRIB_REVISION='R8 By Lean'" >> /etc/openwrt_release +echo "DISTRIB_REVISION='R8.1 By Lean'" >> /etc/openwrt_release sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release echo "DISTRIB_DESCRIPTION='OpenWrt '" >> /etc/openwrt_release diff --git a/package/libs/libnfnetlink/Makefile b/package/libs/libnfnetlink/Makefile index 6d931a4dd..3de556fa8 100644 --- a/package/libs/libnfnetlink/Makefile +++ b/package/libs/libnfnetlink/Makefile @@ -14,8 +14,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://www.netfilter.org/projects/libnfnetlink/files/ \ - ftp://ftp.netfilter.org/pub/libnfnetlink/ \ - http://mirrors.evolva.ro/netfilter.org/libnfnetlink/ + ftp://ftp.netfilter.org/pub/libnfnetlink/ PKG_HASH:=f270e19de9127642d2a11589ef2ec97ef90a649a74f56cf9a96306b04817b51a PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0+ diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile index 67201cc7c..2339a9565 100644 --- a/package/libs/libnl/Makefile +++ b/package/libs/libnl/Makefile @@ -80,6 +80,9 @@ endef TARGET_CFLAGS += -ffunction-sections $(FPIC) +CONFIGURE_ARGS += \ + --disable-debug + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include/libnl3 $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/include/libnl3/* $(1)/usr/include/libnl3/ diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 6b1680534..5a8102a61 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git -PKG_SOURCE_DATE:=2018-04-12 -PKG_SOURCE_VERSION:=6eff829d788b36939325557066f58aafd6a05321 -PKG_MIRROR_HASH:=d0ea16385a133d668d18d793d0bffd867a8c799832a176f0a312c1b473ff918d +PKG_SOURCE_DATE:=2018-07-25 +PKG_SOURCE_VERSION:=c83a84afbef2b24f960ddeda0b5e2ab01fba6981 +PKG_MIRROR_HASH:=4a9594d2ae3706174d182a21fe815f1d18c20beca6593707cc757994975dc670 CMAKE_INSTALL:=1 PKG_LICENSE:=ISC diff --git a/package/libs/libusb/Makefile b/package/libs/libusb/Makefile index 2d1d9c2b5..54008212b 100644 --- a/package/libs/libusb/Makefile +++ b/package/libs/libusb/Makefile @@ -8,12 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libusb -PKG_VERSION:=1.0.21 +PKG_VERSION:=1.0.22 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=@SF/$(PKG_NAME) -PKG_HASH:=7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b +PKG_SOURCE_URL:=\ + https://github.com/libusb/libusb/releases/download/v$(PKG_VERSION) \ + @SF/$(PKG_NAME) +PKG_HASH:=75aeb9d59a4fdb800d329a545c2e6799f732362193b465ea198f2aa275518157 PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=0 @@ -28,7 +30,7 @@ define Package/libusb-1.0 CATEGORY:=Libraries TITLE:=A library for accessing Linux USB devices DEPENDS:=+libpthread +librt - URL:=http://libusb.wiki.sourceforge.net/ + URL:=http://libusb.info/ endef define Package/libusb-1.0/description diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index 8ac4e3b13..4556ad80b 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mbedtls -PKG_VERSION:=2.8.0 +PKG_VERSION:=2.12.0 PKG_RELEASE:=1 PKG_USE_MIPS16:=0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-gpl.tgz PKG_SOURCE_URL:=https://tls.mbed.org/download/ -PKG_HASH:=649eb27187154590edda52943a7f468e740ec08807e5bf68ff45f4e8ffd68923 +PKG_HASH:=8661d19a896a5a7a232ed01ac7f05cf0ec3514798f18076c2c9ef965fbeb5a28 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 70ef95477..ab16d4726 100644 --- a/package/libs/mbedtls/patches/200-config.patch +++ b/package/libs/mbedtls/patches/200-config.patch @@ -1,6 +1,23 @@ --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h -@@ -566,17 +566,17 @@ +@@ -548,14 +548,14 @@ + * + * Enable Output Feedback mode (OFB) for symmetric ciphers. + */ +-#define MBEDTLS_CIPHER_MODE_OFB ++//#define MBEDTLS_CIPHER_MODE_OFB + + /** + * \def MBEDTLS_CIPHER_MODE_XTS + * + * Enable Xor-encrypt-xor with ciphertext stealing mode (XTS) for AES. + */ +-#define MBEDTLS_CIPHER_MODE_XTS ++//#define MBEDTLS_CIPHER_MODE_XTS + + /** + * \def MBEDTLS_CIPHER_NULL_CIPHER +@@ -645,19 +645,19 @@ * * Comment macros to disable the curve and functions for it */ @@ -24,19 +41,21 @@ +//#define MBEDTLS_ECP_DP_BP384R1_ENABLED +//#define MBEDTLS_ECP_DP_BP512R1_ENABLED #define MBEDTLS_ECP_DP_CURVE25519_ENABLED +-#define MBEDTLS_ECP_DP_CURVE448_ENABLED ++//#define MBEDTLS_ECP_DP_CURVE448_ENABLED /** -@@ -601,8 +601,8 @@ - * Requires: MBEDTLS_HMAC_DRBG_C + * \def MBEDTLS_ECP_NIST_OPTIM +@@ -682,7 +682,7 @@ * * Comment this macro to disable deterministic ECDSA. -- */ - #define MBEDTLS_ECDSA_DETERMINISTIC -+ */ + */ +-#define MBEDTLS_ECDSA_DETERMINISTIC ++//#define MBEDTLS_ECDSA_DETERMINISTIC /** * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED -@@ -655,7 +655,7 @@ +@@ -735,7 +735,7 @@ * See dhm.h for more details. * */ @@ -45,17 +64,16 @@ /** * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED -@@ -674,8 +674,8 @@ - * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 +@@ -755,7 +755,7 @@ * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA -- */ - #define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED -+ */ + */ +-#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ++//#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED /** * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED -@@ -700,7 +700,7 @@ +@@ -780,7 +780,7 @@ * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA */ @@ -64,7 +82,7 @@ /** * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -@@ -834,7 +834,7 @@ +@@ -914,7 +914,7 @@ * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 */ @@ -73,7 +91,7 @@ /** * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED -@@ -858,7 +858,7 @@ +@@ -938,7 +938,7 @@ * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 */ @@ -82,7 +100,7 @@ /** * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED -@@ -962,7 +962,7 @@ +@@ -1042,7 +1042,7 @@ * This option is only useful if both MBEDTLS_SHA256_C and * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used. */ @@ -91,7 +109,7 @@ /** * \def MBEDTLS_ENTROPY_NV_SEED -@@ -1057,14 +1057,14 @@ +@@ -1137,14 +1137,14 @@ * Uncomment this macro to disable the use of CRT in RSA. * */ @@ -108,7 +126,7 @@ /** * \def MBEDTLS_SHA256_SMALLER -@@ -1080,7 +1080,7 @@ +@@ -1160,7 +1160,7 @@ * * Uncomment to enable the smaller implementation of SHA256. */ @@ -117,7 +135,7 @@ /** * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES -@@ -1207,7 +1207,7 @@ +@@ -1298,7 +1298,7 @@ * configuration of this extension). * */ @@ -126,17 +144,16 @@ /** * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO -@@ -1381,8 +1381,8 @@ - * callbacks are provided by MBEDTLS_SSL_TICKET_C. +@@ -1473,7 +1473,7 @@ * * Comment this macro to disable support for SSL session tickets -- */ - #define MBEDTLS_SSL_SESSION_TICKETS -+ */ + */ +-#define MBEDTLS_SSL_SESSION_TICKETS ++//#define MBEDTLS_SSL_SESSION_TICKETS /** * \def MBEDTLS_SSL_EXPORT_KEYS -@@ -1412,7 +1412,7 @@ +@@ -1503,7 +1503,7 @@ * * Comment this macro to disable support for truncated HMAC in SSL */ @@ -145,17 +162,16 @@ /** * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT -@@ -1470,8 +1470,8 @@ - * Requires: MBEDTLS_VERSION_C +@@ -1562,7 +1562,7 @@ * * Comment this to disable run-time checking and save ROM space -- */ - #define MBEDTLS_VERSION_FEATURES -+ */ + */ +-#define MBEDTLS_VERSION_FEATURES ++//#define MBEDTLS_VERSION_FEATURES /** * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 -@@ -1801,7 +1801,7 @@ +@@ -1892,7 +1892,7 @@ * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 */ @@ -163,8 +179,8 @@ +//#define MBEDTLS_CAMELLIA_C /** - * \def MBEDTLS_CCM_C -@@ -1815,7 +1815,7 @@ + * \def MBEDTLS_ARIA_C +@@ -1958,7 +1958,7 @@ * This module enables the AES-CCM ciphersuites, if other requisites are * enabled as well. */ @@ -173,16 +189,34 @@ /** * \def MBEDTLS_CERTS_C -@@ -1827,7 +1827,7 @@ +@@ -1970,7 +1970,7 @@ * * This module is used for testing (ssl_client/server). */ -#define MBEDTLS_CERTS_C +//#define MBEDTLS_CERTS_C + /** + * \def MBEDTLS_CHACHA20_C +@@ -1979,7 +1979,7 @@ + * + * Module: library/chacha20.c + */ +-#define MBEDTLS_CHACHA20_C ++//#define MBEDTLS_CHACHA20_C + + /** + * \def MBEDTLS_CHACHAPOLY_C +@@ -1990,7 +1990,7 @@ + * + * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C + */ +-#define MBEDTLS_CHACHAPOLY_C ++//#define MBEDTLS_CHACHAPOLY_C + /** * \def MBEDTLS_CIPHER_C -@@ -1880,7 +1880,7 @@ +@@ -2043,7 +2043,7 @@ * * This module provides debugging functions. */ @@ -191,7 +225,7 @@ /** * \def MBEDTLS_DES_C -@@ -1909,7 +1909,7 @@ +@@ -2072,7 +2072,7 @@ * \warning DES is considered a weak cipher and its use constitutes a * security risk. We recommend considering stronger ciphers instead. */ @@ -200,17 +234,43 @@ /** * \def MBEDTLS_DHM_C -@@ -2070,8 +2070,8 @@ - * Requires: MBEDTLS_MD_C - * - * Uncomment to enable the HMAC_DRBG random number geerator. -- */ - #define MBEDTLS_HMAC_DRBG_C -+ */ +@@ -2235,7 +2235,7 @@ + * This module adds support for the Hashed Message Authentication Code + * (HMAC)-based key derivation function (HKDF). + */ +-#define MBEDTLS_HKDF_C ++//#define MBEDTLS_HKDF_C /** - * \def MBEDTLS_MD_C -@@ -2365,7 +2365,7 @@ + * \def MBEDTLS_HMAC_DRBG_C +@@ -2249,7 +2249,7 @@ + * + * Uncomment to enable the HMAC_DRBG random number geerator. + */ +-#define MBEDTLS_HMAC_DRBG_C ++//#define MBEDTLS_HMAC_DRBG_C + + /** + * \def MBEDTLS_NIST_KW_C +@@ -2545,7 +2545,7 @@ + * + * This module enables abstraction of common (libc) functions. + */ +-#define MBEDTLS_PLATFORM_C ++//#define MBEDTLS_PLATFORM_C + + /** + * \def MBEDTLS_POLY1305_C +@@ -2555,7 +2555,7 @@ + * Module: library/poly1305.c + * Caller: library/chachapoly.c + */ +-#define MBEDTLS_POLY1305_C ++//#define MBEDTLS_POLY1305_C + + /** + * \def MBEDTLS_RIPEMD160_C +@@ -2566,7 +2566,7 @@ * Caller: library/md.c * */ @@ -219,37 +279,25 @@ /** * \def MBEDTLS_RSA_C -@@ -2449,8 +2449,8 @@ - * Caller: - * - * Requires: MBEDTLS_SSL_CACHE_C -- */ - #define MBEDTLS_SSL_CACHE_C -+ */ - - /** - * \def MBEDTLS_SSL_COOKIE_C -@@ -2471,8 +2471,8 @@ - * Caller: +@@ -2673,7 +2673,7 @@ * * Requires: MBEDTLS_CIPHER_C -- */ - #define MBEDTLS_SSL_TICKET_C -+ */ + */ +-#define MBEDTLS_SSL_TICKET_C ++//#define MBEDTLS_SSL_TICKET_C /** * \def MBEDTLS_SSL_CLI_C -@@ -2571,8 +2571,8 @@ - * Module: library/version.c +@@ -2773,7 +2773,7 @@ * * This module provides run-time version information. -- */ - #define MBEDTLS_VERSION_C -+ */ + */ +-#define MBEDTLS_VERSION_C ++//#define MBEDTLS_VERSION_C /** * \def MBEDTLS_X509_USE_C -@@ -2682,7 +2682,7 @@ +@@ -2883,7 +2883,7 @@ * Module: library/xtea.c * Caller: */ diff --git a/package/libs/mbedtls/patches/300-soversion-compatibility.patch b/package/libs/mbedtls/patches/300-soversion-compatibility.patch new file mode 100644 index 000000000..a352b449f --- /dev/null +++ b/package/libs/mbedtls/patches/300-soversion-compatibility.patch @@ -0,0 +1,34 @@ +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -159,7 +159,7 @@ endif(USE_STATIC_MBEDTLS_LIBRARY) + + if(USE_SHARED_MBEDTLS_LIBRARY) + add_library(mbedcrypto SHARED ${src_crypto}) +- set_target_properties(mbedcrypto PROPERTIES VERSION 2.12.0 SOVERSION 3) ++ set_target_properties(mbedcrypto PROPERTIES VERSION 2.12.0 SOVERSION 1) + target_link_libraries(mbedcrypto ${libs}) + + add_library(mbedx509 SHARED ${src_x509}) +@@ -167,7 +167,7 @@ if(USE_SHARED_MBEDTLS_LIBRARY) + target_link_libraries(mbedx509 ${libs} mbedcrypto) + + add_library(mbedtls SHARED ${src_tls}) +- set_target_properties(mbedtls PROPERTIES VERSION 2.12.0 SOVERSION 11) ++ set_target_properties(mbedtls PROPERTIES VERSION 2.12.0 SOVERSION 10) + target_link_libraries(mbedtls ${libs} mbedx509) + + install(TARGETS mbedtls mbedx509 mbedcrypto +--- a/library/Makefile ++++ b/library/Makefile +@@ -35,9 +35,9 @@ LOCAL_CFLAGS += -fPIC -fpic + endif + endif + +-SOEXT_TLS=so.11 ++SOEXT_TLS=so.10 + SOEXT_X509=so.0 +-SOEXT_CRYPTO=so.3 ++SOEXT_CRYPTO=so.1 + + # Set AR_DASH= (empty string) to use an ar implentation that does not accept + # the - prefix for command line options (e.g. llvm-ar) diff --git a/package/libs/nghttp2/Makefile b/package/libs/nghttp2/Makefile index 554d31b2a..8201e59f2 100644 --- a/package/libs/nghttp2/Makefile +++ b/package/libs/nghttp2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nghttp2 -PKG_VERSION:=1.31.1 +PKG_VERSION:=1.32.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/nghttp2/nghttp2/releases/download/v$(PKG_VERSION) -PKG_HASH:=65b9c83ae95a7760a14410aeefa9d441c34453027bc938df7a2272520f32e103 +PKG_HASH:=700a89d59fcc55acc2b18184001bfb3220fa6a6e543486aca35f40801cba6f7d PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile index 8409730d7..b64a51d6d 100644 --- a/package/libs/openssl/Makefile +++ b/package/libs/openssl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openssl PKG_BASE:=1.0.2 -PKG_BUGFIX:=o +PKG_BUGFIX:=p PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX) PKG_RELEASE:=1 PKG_USE_MIPS16:=0 @@ -24,7 +24,7 @@ PKG_SOURCE_URL:= \ http://gd.tuwien.ac.at/infosys/security/openssl/source/ \ http://www.openssl.org/source/ \ http://www.openssl.org/source/old/$(PKG_BASE)/ -PKG_HASH:=ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d +PKG_HASH:=50a98e07b1a89eb8f6a99477f262df71c6fa7bef77df4dc83025a2845c827d00 PKG_LICENSE:=OpenSSL PKG_LICENSE_FILES:=LICENSE diff --git a/package/libs/openssl/patches/150-no_engines.patch b/package/libs/openssl/patches/150-no_engines.patch index 102e7a327..a518a0049 100644 --- a/package/libs/openssl/patches/150-no_engines.patch +++ b/package/libs/openssl/patches/150-no_engines.patch @@ -1,6 +1,6 @@ --- a/Configure +++ b/Configure -@@ -2136,6 +2136,11 @@ EOF +@@ -2144,6 +2144,11 @@ EOF close(OUT); } diff --git a/package/libs/openssl/patches/200-parallel_build.patch b/package/libs/openssl/patches/200-parallel_build.patch index 0616551b6..37134e403 100644 --- a/package/libs/openssl/patches/200-parallel_build.patch +++ b/package/libs/openssl/patches/200-parallel_build.patch @@ -173,7 +173,7 @@ apps: @(cd ..; $(MAKE) DIRS=apps all) -@@ -586,7 +586,7 @@ $(DTLSTEST)$(EXE_EXT): $(DTLSTEST).o ssl +@@ -593,7 +593,7 @@ $(DTLSTEST)$(EXE_EXT): $(DTLSTEST).o ssl # fi dummytest$(EXE_EXT): dummytest.o $(DLIBCRYPTO) diff --git a/package/libs/uclient/Makefile b/package/libs/uclient/Makefile index f0c08a323..888fce3e2 100644 --- a/package/libs/uclient/Makefile +++ b/package/libs/uclient/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uclient.git -PKG_SOURCE_DATE:=2017-11-02 -PKG_SOURCE_VERSION:=4b87d83160fec70d50b7fcd736a8c538c28a016c -PKG_MIRROR_HASH:=4bbb4d5f295ebdcd67fec87a6794168bea2176a42cb2907c47d8566fb33dafb3 +PKG_SOURCE_DATE:=2018-08-03 +PKG_SOURCE_VERSION:=ae1c656ff041c6f1ccb37b070fa261e0d71f2b12 +PKG_MIRROR_HASH:=e88c92f880d3c1cf4162f62c4eeb8986baa8d73772e51eed3a60a8346aeb1b7c CMAKE_INSTALL:=1 PKG_BUILD_DEPENDS:=ustream-ssl diff --git a/package/libs/ustream-ssl/Makefile b/package/libs/ustream-ssl/Makefile index 1a8e0e78b..055a7c969 100644 --- a/package/libs/ustream-ssl/Makefile +++ b/package/libs/ustream-ssl/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ustream-ssl -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustream-ssl.git -PKG_SOURCE_DATE:=2016-07-02 -PKG_SOURCE_VERSION:=ec80adaa1b47f28d426fa19c692011ce60b992d6 -PKG_MIRROR_HASH:=bfbad6b4e8c1e933f0bfaab43cbdd44a536c08128c3a779e6f2395a6a886aab7 +PKG_SOURCE_DATE:=2018-05-22 +PKG_SOURCE_VERSION:=5322f9db23b69fdc2b4760a6cfd67848a11818a4 +PKG_MIRROR_HASH:=c943f6e603b1309b33fd276acddffb33a171b6370455b6c21200897012e42d05 CMAKE_INSTALL:=1 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR) diff --git a/package/libs/wolfssl/Config.in b/package/libs/wolfssl/Config.in index 7e8a4b6ce..9b8891451 100644 --- a/package/libs/wolfssl/Config.in +++ b/package/libs/wolfssl/Config.in @@ -32,10 +32,22 @@ config WOLFSSL_HAS_PSK bool "Include PKS (Pre Share Key) support" default n +config WOLFSSL_HAS_SESSION_TICKET + bool "Include session ticket support" + default n + config WOLFSSL_HAS_DTLS bool "Include DTLS support" default n +config WOLFSSL_HAS_OCSP + bool "Include OSCP support" + default n + +config WOLFSSL_HAS_WPAS + bool "Include wpa_supplicant support" + default n + config WOLFSSL_HAS_ECC25519 bool "Include ECC Curve 22519 support" depends on WOLFSSL_HAS_ECC diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 1d4b7f557..d0bd3b5a3 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wolfssl PKG_VERSION:=3.12.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip PKG_SOURCE_URL:=https://www.wolfssl.com/ @@ -51,7 +51,9 @@ CONFIGURE_ARGS += \ --enable-opensslextra \ --enable-sni \ --enable-stunnel \ - --disable-examples + --disable-examples \ + --disable-leanpsk \ + --disable-leantls \ ifeq ($(CONFIG_IPV6),y) CONFIGURE_ARGS += \ @@ -79,19 +81,25 @@ CONFIGURE_ARGS += \ --enable-supportedcurves endif -ifneq ($(CONFIG_WOLFSSL_HAS_DH),y) +ifeq ($(CONFIG_WOLFSSL_HAS_DH),y) CONFIGURE_ARGS += \ --enable-dh endif -ifeq ($(CONFIG_WOLFSSL_HAS_ARC4),n) +ifneq ($(CONFIG_WOLFSSL_HAS_ARC4),y) CONFIGURE_ARGS += \ --disable-arc4 +else +CONFIGURE_ARGS += \ + --enable-arc4 endif -ifeq ($(CONFIG_WOLFSSL_HAS_DES3),y) +ifneq ($(CONFIG_WOLFSSL_HAS_DES3),y) CONFIGURE_ARGS += \ --disable-des3 +else +CONFIGURE_ARGS += \ + --enable-des3 endif ifeq ($(CONFIG_WOLFSSL_HAS_PSK),y) @@ -99,11 +107,26 @@ CONFIGURE_ARGS += \ --enable-psk endif +ifeq ($(CONFIG_WOLFSSL_HAS_SESSION_TICKET),y) +CONFIGURE_ARGS += \ + --enable-session-ticket +endif + ifeq ($(CONFIG_WOLFSSL_HAS_DTLS),y) CONFIGURE_ARGS += \ --enable-dtls endif +ifeq ($(CONFIG_WOLFSSL_HAS_OCSP),y) +CONFIGURE_ARGS += \ + --enable-ocsp --enable-ocspstapling --enable-ocspstapling2 +endif + +ifeq ($(CONFIG_WOLFSSL_HAS_WPAS),y) +CONFIGURE_ARGS += \ + --enable-wpas --enable-sha512 --enable-fortress --enable-fastmath +endif + ifeq ($(CONFIG_WOLFSSL_HAS_ECC25519),y) CONFIGURE_ARGS += \ --enable-curve25519 diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile index a7c61f7dd..4a2a0e53b 100644 --- a/package/libs/zlib/Makefile +++ b/package/libs/zlib/Makefile @@ -21,7 +21,6 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED -include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -95,6 +94,5 @@ define Package/zlib-dev/install $(1)/usr/lib/pkgconfig/ endef -$(eval $(call HostBuild)) $(eval $(call BuildPackage,zlib)) $(eval $(call BuildPackage,zlib-dev)) diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index 01fea237f..010c5aa34 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git -PKG_SOURCE_DATE:=2018-05-19 -PKG_SOURCE_VERSION:=30463d08056db8f03d17c0569581aef96418c38d -PKG_MIRROR_HASH:=d2abcdef3e543a5dfc72a5f9c42d10c90a95327761d108eedf201bbb45365802 +PKG_SOURCE_DATE:=2018-07-26 +PKG_SOURCE_VERSION:=aa8846bb101054392b81f09bade120c021695892 +PKG_MIRROR_HASH:=cc2ff632744bdefbc64ad11dc18944b44af006c986367a28d6483ade6012effa PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC @@ -40,8 +40,8 @@ define Package/firewall/conffiles /etc/firewall.user endef -TARGET_CFLAGS += -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections +TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections -flto CMAKE_OPTIONS += $(if $(CONFIG_IPV6),,-DDISABLE_IPV6=1) define Package/firewall/install diff --git a/package/network/config/ltq-adsl-app/files/dsl_control b/package/network/config/ltq-adsl-app/files/dsl_control index d93d47808..91fcb46be 100644 --- a/package/network/config/ltq-adsl-app/files/dsl_control +++ b/package/network/config/ltq-adsl-app/files/dsl_control @@ -1,7 +1,7 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2012 OpenWrt.org -START=49 +START=97 USE_PROCD=1 EXTRA_COMMANDS="status lucistat" diff --git a/package/network/config/ltq-vdsl-app/files/dsl_control b/package/network/config/ltq-vdsl-app/files/dsl_control index 818990e57..a00d2bcdb 100644 --- a/package/network/config/ltq-vdsl-app/files/dsl_control +++ b/package/network/config/ltq-vdsl-app/files/dsl_control @@ -1,8 +1,7 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2012 OpenWrt.org -# needs to start before the atm layer which starts at 50 -START=48 +START=97 USE_PROCD=1 EXTRA_COMMANDS="status lucistat" diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 4f431246b..33276a90d 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2018-04-20 -PKG_SOURCE_VERSION:=b3dca7b64d3646a91cc4520652f2e2e144478143 -PKG_MIRROR_HASH:=2f640ab588e9de1c2f469300a6d4b0dacc7b8319ed9d547b657a880b2821903c +PKG_SOURCE_DATE:=2018-07-30 +PKG_SOURCE_VERSION:=a0a1e52eb300b574098ae18fc7e6849ff50c2e5e +PKG_MIRROR_HASH:=f2a556e0de1e04d4e7b6ca30d3e7c65710659201fc81efb10420cd895d72a307 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/config/qos-scripts/Makefile b/package/network/config/qos-scripts/Makefile index 07e68835c..abaeaeb98 100644 --- a/package/network/config/qos-scripts/Makefile +++ b/package/network/config/qos-scripts/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qos-scripts -PKG_VERSION:=1.3.0 +PKG_VERSION:=1.3.1 PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0 diff --git a/package/network/config/qos-scripts/files/usr/bin/qos-stat b/package/network/config/qos-scripts/files/usr/bin/qos-stat index cbbf8e8de..03b737c89 100755 --- a/package/network/config/qos-scripts/files/usr/bin/qos-stat +++ b/package/network/config/qos-scripts/files/usr/bin/qos-stat @@ -14,16 +14,17 @@ get_ifname() { [ "$cfgt" = "interface" ] && config_get "$interface" ifname } -config_cb() { - config_get TYPE "$CONFIG_SECTION" TYPE +qos_set_device() { + config_get TYPE "$1" TYPE [ "interface" = "$TYPE" ] && { - config_get device "$CONFIG_SECTION" ifname - [ -z "$device" ] && device="$(get_ifname ${CONFIG_SECTION})" - config_set "$CONFIG_SECTION" device "$device" + config_get device "$1" ifname + [ -z "$device" ] && device="$(get_ifname $1)" + config_set "$1" device "$device" } } config_load qos +config_foreach qos_set_device print_comments() { echo '' diff --git a/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh b/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh index 9ce4eb41e..48c9f4a9d 100755 --- a/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh +++ b/package/network/config/qos-scripts/files/usr/lib/qos/generate.sh @@ -191,8 +191,6 @@ config_cb() { option_cb() { return 0 } - - # Section start case "$1" in interface) config_set "$2" "classgroup" "Default" @@ -200,43 +198,41 @@ config_cb() { ;; classify|default|reclassify) option_cb() { - append options "$1" + append "CONFIG_${CONFIG_SECTION}_options" "$1" } ;; esac +} - # Section end - config_get TYPE "$CONFIG_SECTION" TYPE +qos_parse_config() { + config_get TYPE "$1" TYPE case "$TYPE" in interface) - config_get_bool enabled "$CONFIG_SECTION" enabled 1 - [ 1 -eq "$enabled" ] || return 0 - config_get classgroup "$CONFIG_SECTION" classgroup - config_set "$CONFIG_SECTION" ifbdev "$C" - C=$(($C+1)) - append INTERFACES "$CONFIG_SECTION" - config_set "$classgroup" enabled 1 - config_get device "$CONFIG_SECTION" device - [ -z "$device" ] && { - device="$(find_ifname ${CONFIG_SECTION})" - config_set "$CONFIG_SECTION" device "$device" + config_get_bool enabled "$1" enabled 1 + [ 1 -eq "$enabled" ] && { + config_get classgroup "$1" classgroup + config_set "$1" ifbdev "$C" + C=$(($C+1)) + append INTERFACES "$1" + config_set "$classgroup" enabled 1 + config_get device "$1" device + [ -z "$device" ] && { + device="$(find_ifname $1)" + config_set "$1" device "$device" + } } ;; - classgroup) append CG "$CONFIG_SECTION";; + classgroup) append CG "$1";; classify|default|reclassify) case "$TYPE" in classify) var="ctrules";; *) var="rules";; esac - config_get target "$CONFIG_SECTION" target - config_set "$CONFIG_SECTION" options "$options" - append "$var" "$CONFIG_SECTION" - unset options + append "$var" "$1" ;; esac } - enum_classes() { local c="0" config_get classes "$1" classes @@ -500,7 +496,10 @@ INTERFACES="" [ -e ./qos.conf ] && { . ./qos.conf config_cb -} || config_load qos +} || { + config_load qos + config_foreach qos_parse_config +} C="0" for iface in $INTERFACES; do diff --git a/package/network/ipv6/ds-lite/Makefile b/package/network/ipv6/ds-lite/Makefile index 58e7156b9..4393d3587 100644 --- a/package/network/ipv6/ds-lite/Makefile +++ b/package/network/ipv6/ds-lite/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ds-lite PKG_VERSION:=7 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/ipv6/ds-lite/files/dslite.sh b/package/network/ipv6/ds-lite/files/dslite.sh old mode 100755 new mode 100644 index 2485a424d..7bd3f2e70 --- a/package/network/ipv6/ds-lite/files/dslite.sh +++ b/package/network/ipv6/ds-lite/files/dslite.sh @@ -15,8 +15,8 @@ proto_dslite_setup() { local link="ds-$cfg" local remoteip6 - local mtu ttl peeraddr ip6addr tunlink zone weakif - json_get_vars mtu ttl peeraddr ip6addr tunlink zone weakif + local mtu ttl peeraddr ip6addr tunlink zone weakif encaplimit + json_get_vars mtu ttl peeraddr ip6addr tunlink zone weakif encaplimit [ -z "$peeraddr" ] && { proto_notify_error "$cfg" "MISSING_ADDRESS" @@ -68,6 +68,9 @@ proto_dslite_setup() { json_add_string local "$ip6addr" json_add_string remote "$peeraddr" [ -n "$tunlink" ] && json_add_string link "$tunlink" + json_add_object "data" + json_add_string encaplimit "${encaplimit:-4}" + json_close_object proto_close_tunnel proto_add_data @@ -97,6 +100,7 @@ proto_dslite_init_config() { proto_config_add_string "tunlink" proto_config_add_int "mtu" proto_config_add_int "ttl" + proto_config_add_string "encaplimit" proto_config_add_string "zone" proto_config_add_string "weakif" } diff --git a/package/network/ipv6/map/Makefile b/package/network/ipv6/map/Makefile index 77967042b..cfb7c4ac3 100644 --- a/package/network/ipv6/map/Makefile +++ b/package/network/ipv6/map/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=map PKG_VERSION:=4 -PKG_RELEASE:=10 +PKG_RELEASE:=11 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/network/ipv6/map/files/map.sh b/package/network/ipv6/map/files/map.sh index 42050183c..5f4add36e 100755 --- a/package/network/ipv6/map/files/map.sh +++ b/package/network/ipv6/map/files/map.sh @@ -28,9 +28,9 @@ proto_map_setup() { # uncomment for legacy MAP0 mode #export LEGACY=1 - local type mtu ttl tunlink zone + local type mtu ttl tunlink zone encaplimit local rule ipaddr ip4prefixlen ip6prefix ip6prefixlen peeraddr ealen psidlen psid offset - json_get_vars type mtu ttl tunlink zone + json_get_vars type mtu ttl tunlink zone encaplimit json_get_vars rule ipaddr ip4prefixlen ip6prefix ip6prefixlen peeraddr ealen psidlen psid offset [ -z "$zone" ] && zone="wan" @@ -84,9 +84,9 @@ proto_map_setup() { json_add_string local $(eval "echo \$RULE_${k}_IPV6ADDR") json_add_string remote $(eval "echo \$RULE_${k}_BR") json_add_string link $(eval "echo \$RULE_${k}_PD6IFACE") - - if [ "$type" = "map-e" ]; then - json_add_object "data" + json_add_object "data" + json_add_string encaplimit "${encaplimit:-4}" + if [ "$type" = "map-e" ]; then json_add_array "fmrs" for i in $(seq $RULE_COUNT); do [ "$(eval "echo \$RULE_${i}_FMR")" != 1 ] && continue @@ -98,8 +98,9 @@ proto_map_setup() { json_close_object done json_close_array - json_close_object - fi + fi + json_close_object + proto_close_tunnel elif [ "$type" = "map-t" -a -f "/proc/net/nat46/control" ]; then @@ -229,6 +230,7 @@ proto_map_init_config() { proto_config_add_int "mtu" proto_config_add_int "ttl" proto_config_add_string "zone" + proto_config_add_string "encaplimit" } [ -n "$INCLUDE_ONLY" ] || { diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile index 70f213471..7f5f745fb 100644 --- a/package/network/ipv6/odhcp6c/Makefile +++ b/package/network/ipv6/odhcp6c/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcp6c -PKG_RELEASE:=11 +PKG_RELEASE:=14 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcp6c.git -PKG_SOURCE_DATE:=2018-05-04 -PKG_SOURCE_VERSION:=474b5a3a9a25f0aa12e69afd72d7661638ad879d -PKG_MIRROR_HASH:=3eff22792c5a0c3450f72d04088e3f31cacba03edac4cc1a00565cf3051e4330 +PKG_SOURCE_DATE:=2018-07-14 +PKG_SOURCE_VERSION:=67ae6a71b5762292e114b281d0e329cc24209ae6 +PKG_MIRROR_HASH:=176b637b3856af0d6bb9c526afbddca4e569ea056fc36fc026345e7e22a6cef5 PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script index 317101396..dcb7a95d9 100755 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.script +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script @@ -170,6 +170,7 @@ setup_interface () { json_add_string tunlink "$INTERFACE" [ -n "$ZONE_MAP" ] || ZONE_MAP=$ZONE [ -n "$ZONE_MAP" ] && json_add_string zone "$ZONE_MAP" + [ -n "$ENCAPLIMIT_MAP" ] && json_add_string encaplimit "$ENCAPLIMIT_MAP" [ -n "$IFACE_MAP_DELEGATE" ] && json_add_boolean delegate "$IFACE_MAP_DELEGATE" json_close_object ubus call network add_dynamic "$(json_dump)" @@ -183,6 +184,7 @@ setup_interface () { json_add_string tunlink "$INTERFACE" [ -n "$ZONE_DSLITE" ] || ZONE_DSLITE=$ZONE [ -n "$ZONE_DSLITE" ] && json_add_string zone "$ZONE_DSLITE" + [ -n "$ENCAPLIMIT_DSLITE" ] && json_add_string encaplimit "$ENCAPLIMIT_DSLITE" [ -n "$IFACE_DSLITE_DELEGATE" ] && json_add_boolean delegate "$IFACE_DSLITE_DELEGATE" json_close_object ubus call network add_dynamic "$(json_dump)" diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh index 919872fe8..7f67f8b1b 100755 --- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh +++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh @@ -16,11 +16,14 @@ proto_dhcpv6_init_config() { proto_config_add_string 'forceprefix:bool' proto_config_add_string 'extendprefix:bool' proto_config_add_string 'norelease:bool' + proto_config_add_string 'noserverunicast:bool' proto_config_add_array 'ip6prefix:list(ip6addr)' proto_config_add_string iface_dslite proto_config_add_string zone_dslite + proto_config_add_string encaplimit_dslite proto_config_add_string iface_map proto_config_add_string zone_map + proto_config_add_string encaplimit_map proto_config_add_string iface_464xlat proto_config_add_string zone_464xlat proto_config_add_string zone @@ -48,8 +51,8 @@ proto_dhcpv6_setup() { local config="$1" local iface="$2" - local reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease ip6prefix ip6prefixes iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass sendopts delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff - json_get_vars reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff + local reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease noserverunicast ip6prefix ip6prefixes iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass sendopts delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite encaplimit_map soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff + json_get_vars reqaddress reqprefix clientid reqopts defaultreqopts noslaaconly forceprefix extendprefix norelease noserverunicast iface_dslite iface_map iface_464xlat ifaceid userclass vendorclass delegate zone_dslite zone_map zone_464xlat zone encaplimit_dslite encaplimit_map soltimeout fakeroutes sourcefilter keep_ra_dnslifetime ra_holdoff json_for_each_item proto_dhcpv6_add_prefix ip6prefix ip6prefixes # Configure @@ -69,6 +72,8 @@ proto_dhcpv6_setup() { [ "$norelease" = "1" ] && append opts "-k" + [ "$noserverunicast" = "1" ] && append opts "-U" + [ -n "$ifaceid" ] && append opts "-i$ifaceid" [ -n "$vendorclass" ] && append opts "-V$vendorclass" @@ -98,6 +103,8 @@ proto_dhcpv6_setup() { [ -n "$zone_map" ] && proto_export "ZONE_MAP=$zone_map" [ -n "$zone_464xlat" ] && proto_export "ZONE_464XLAT=$zone_464xlat" [ -n "$zone" ] && proto_export "ZONE=$zone" + [ -n "$encaplimit_dslite" ] && proto_export "ENCAPLIMIT_DSLITE=$encaplimit_dslite" + [ -n "$encaplimit_map" ] && proto_export "ENCAPLIMIT_MAP=$encaplimit_map" [ "$fakeroutes" != "0" ] && proto_export "FAKE_ROUTES=1" [ "$sourcefilter" = "0" ] && proto_export "NOSOURCEFILTER=1" [ "$extendprefix" = "1" ] && proto_export "EXTENDPREFIX=1" diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 8e5df169a..57d1af629 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq -PKG_VERSION:=2.79 -PKG_RELEASE:=3 +PKG_VERSION:=2.80test3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/ -PKG_HASH:=78ad74f5ca14fd85a8bac93f764cd9d60b27579e90eabd3687ca7b030e67861f +PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases +PKG_HASH:=af9f6fd13e0d6c5a68059bcf8634c2784c0533017fd48fbaf59cd2955342d301 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING @@ -94,22 +94,22 @@ define Package/dnsmasq-full/config config PACKAGE_dnsmasq_full_dhcpv6 bool "Build with DHCPv6 support." depends on IPV6 && PACKAGE_dnsmasq_full_dhcp - default n + default y config PACKAGE_dnsmasq_full_dnssec bool "Build with DNSSEC support." - default n + default y config PACKAGE_dnsmasq_full_auth bool "Build with the facility to act as an authoritative DNS server." - default n + default y config PACKAGE_dnsmasq_full_ipset bool "Build with IPset support." default y config PACKAGE_dnsmasq_full_conntrack bool "Build with Conntrack support." - default n + default y config PACKAGE_dnsmasq_full_noid bool "Build with NO_ID. (hide *.bind pseudo domain)" - default n + default y config PACKAGE_dnsmasq_full_broken_rtc bool "Build with HAVE_BROKEN_RTC." default n diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 1881b2bcd..c1ae0934f 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -844,8 +844,10 @@ dnsmasq_start() config_list_foreach "$cfg" "rev_server" append_rev_server config_list_foreach "$cfg" "address" append_address config_list_foreach "$cfg" "ipset" append_ipset - config_list_foreach "$cfg" "interface" append_interface - config_list_foreach "$cfg" "notinterface" append_notinterface + [ -n "$BOOT" ] || { + config_list_foreach "$cfg" "interface" append_interface + config_list_foreach "$cfg" "notinterface" append_notinterface + } config_list_foreach "$cfg" "addnhosts" append_addnhosts config_list_foreach "$cfg" "bogusnxdomain" append_bogusnxdomain append_parm "$cfg" "leasefile" "--dhcp-leasefile" "/tmp/dhcp.leases" @@ -941,8 +943,9 @@ dnsmasq_start() xappend "--addn-hosts=$(dirname $HOSTFILE)" config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq.d" - [ ! -d "$dnsmasqconfdir" ] && mkdir -p $dnsmasqconfdir xappend "--conf-dir=$dnsmasqconfdir" + dnsmasqconfdir="${dnsmasqconfdir%%,*}" + [ ! -d "$dnsmasqconfdir" ] && mkdir -p $dnsmasqconfdir xappend "--user=dnsmasq" xappend "--group=dnsmasq" echo >> $CONFIGFILE_TMP @@ -966,7 +969,7 @@ dnsmasq_start() config_foreach filter_dnsmasq match dhcp_match_add "$cfg" config_foreach filter_dnsmasq domain dhcp_domain_add "$cfg" config_foreach filter_dnsmasq hostrecord dhcp_hostrecord_add "$cfg" - config_foreach filter_dnsmasq relay dhcp_relay_add "$cfg" + [ -n "$BOOT" ] || config_foreach filter_dnsmasq relay dhcp_relay_add "$cfg" echo >> $CONFIGFILE_TMP config_foreach filter_dnsmasq srvhost dhcp_srv_add "$cfg" @@ -983,13 +986,13 @@ dnsmasq_start() # Enable RA feature for when/if it is constructed, # and RA is selected per interface pool (RA, DHCP, or both), # but no one (should) want RA broadcast in syslog - config_foreach filter_dnsmasq dhcp dhcp_add "$cfg" + [ -n "$BOOT" ] || config_foreach filter_dnsmasq dhcp dhcp_add "$cfg" xappend "--enable-ra" xappend "--quiet-ra" append_bool "$cfg" quietdhcp "--quiet-dhcp6" elif [ "$DNSMASQ_DHCP_VER" -gt 0 ] ; then - config_foreach filter_dnsmasq dhcp dhcp_add "$cfg" + [ -n "$BOOT" ] || config_foreach filter_dnsmasq dhcp dhcp_add "$cfg" fi @@ -1042,10 +1045,23 @@ dnsmasq_stop() rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp } +add_interface_trigger() +{ + local interface ignore + + config_get interface "$1" interface + config_get_bool ignore "$1" ignore 0 + + [ -n "$interface" -a $ignore -eq 0 ] && procd_add_interface_trigger "interface.*" "$interface" /etc/init.d/dnsmasq reload +} + service_triggers() { procd_add_reload_trigger "dhcp" "system" - procd_add_raw_trigger "interface.*" 2000 /etc/init.d/dnsmasq reload + + config_load dhcp + config_foreach add_interface_trigger dhcp + config_foreach add_interface_trigger relay } boot() @@ -1058,8 +1074,6 @@ start_service() { local instance="$1" local instance_found=0 - [ -n "$BOOT" ] && return - . /lib/functions/network.sh config_cb() { diff --git a/package/network/services/dnsmasq/patches/240-ubus.patch b/package/network/services/dnsmasq/patches/240-ubus.patch index 415c7a5e4..2fa9f48d1 100644 --- a/package/network/services/dnsmasq/patches/240-ubus.patch +++ b/package/network/services/dnsmasq/patches/240-ubus.patch @@ -74,7 +74,7 @@ int main (int argc, char **argv) { int bind_fallback = 0; -@@ -928,6 +988,7 @@ int main (int argc, char **argv) +@@ -949,6 +1009,7 @@ int main (int argc, char **argv) set_dbus_listeners(); #endif @@ -82,7 +82,7 @@ #ifdef HAVE_DHCP if (daemon->dhcp || daemon->relay4) { -@@ -1058,6 +1119,8 @@ int main (int argc, char **argv) +@@ -1079,6 +1140,8 @@ int main (int argc, char **argv) check_dbus_listeners(); #endif @@ -104,7 +104,7 @@ mostly_clean : --- a/src/dnsmasq.h +++ b/src/dnsmasq.h -@@ -1415,6 +1415,8 @@ void emit_dbus_signal(int action, struct +@@ -1445,6 +1445,8 @@ void emit_dbus_signal(int action, struct # endif #endif @@ -115,7 +115,7 @@ void ipset_init(void); --- a/src/rfc2131.c +++ b/src/rfc2131.c -@@ -1621,6 +1621,10 @@ static void log_packet(char *type, void +@@ -1636,6 +1636,10 @@ static void log_packet(char *type, void daemon->namebuff, string ? string : "", err ? err : ""); diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init index 222511349..b86e52d8b 100755 --- a/package/network/services/dropbear/files/dropbear.init +++ b/package/network/services/dropbear/files/dropbear.init @@ -148,6 +148,11 @@ service_triggers() procd_add_validation validate_section_dropbear } +shutdown() { + # close all open connections + killall dropbear +} + killclients() { local ignore='' diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 520da5b15..4deb0b97a 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -422,32 +422,38 @@ hostapd_set_bss_options() { set_default ieee80211r 0 if [ "$ieee80211r" -gt "0" ]; then - json_get_vars mobility_domain r0_key_lifetime r1_key_holder \ - reassociation_deadline pmk_r1_push ft_psk_generate_local ft_over_ds - json_get_values r0kh r0kh - json_get_values r1kh r1kh - - set_default mobility_domain "4f57" - set_default r0_key_lifetime 10000 - set_default reassociation_deadline 1000 - set_default pmk_r1_push 0 - set_default ft_psk_generate_local 0 + json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline + + set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)" + set_default ft_psk_generate_local 1 set_default ft_over_ds 1 + set_default reassociation_deadline 1000 append bss_conf "mobility_domain=$mobility_domain" "$N" - append bss_conf "r0_key_lifetime=$r0_key_lifetime" "$N" - [ -n "$r1_key_holder" ] && append bss_conf "r1_key_holder=$r1_key_holder" "$N" - append bss_conf "reassociation_deadline=$reassociation_deadline" "$N" - append bss_conf "pmk_r1_push=$pmk_r1_push" "$N" append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N" append bss_conf "ft_over_ds=$ft_over_ds" "$N" + append bss_conf "reassociation_deadline=$reassociation_deadline" "$N" + [ -n "$nasid" ] || append bss_conf "nas_identifier=${macaddr//\:}" "$N" - for kh in $r0kh; do - append bss_conf "r0kh=${kh//,/ }" "$N" - done - for kh in $r1kh; do - append bss_conf "r1kh=${kh//,/ }" "$N" - done + if [ "$ft_psk_generate_local" -eq "0" ]; then + json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push + json_get_values r0kh r0kh + json_get_values r1kh r1kh + + set_default r0_key_lifetime 10000 + set_default pmk_r1_push 0 + + [ -n "$r1_key_holder" ] && append bss_conf "r1_key_holder=$r1_key_holder" "$N" + append bss_conf "r0_key_lifetime=$r0_key_lifetime" "$N" + append bss_conf "pmk_r1_push=$pmk_r1_push" "$N" + + for kh in $r0kh; do + append bss_conf "r0kh=${kh//,/ }" "$N" + done + for kh in $r1kh; do + append bss_conf "r1kh=${kh//,/ }" "$N" + done + fi fi append bss_conf "wpa_disable_eapol_key_retries=$wpa_disable_eapol_key_retries" "$N" diff --git a/package/network/services/hostapd/patches/0001-WPA-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch b/package/network/services/hostapd/patches/0001-WPA-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch new file mode 100644 index 000000000..1b84f7e86 --- /dev/null +++ b/package/network/services/hostapd/patches/0001-WPA-Ignore-unauthenticated-encrypted-EAPOL-Key-data.patch @@ -0,0 +1,48 @@ +From 3e34cfdff6b192fe337c6fb3f487f73e96582961 Mon Sep 17 00:00:00 2001 +From: Mathy Vanhoef +Date: Sun, 15 Jul 2018 01:25:53 +0200 +Subject: [PATCH] WPA: Ignore unauthenticated encrypted EAPOL-Key data + +Ignore unauthenticated encrypted EAPOL-Key data in supplicant +processing. When using WPA2, these are frames that have the Encrypted +flag set, but not the MIC flag. + +When using WPA2, EAPOL-Key frames that had the Encrypted flag set but +not the MIC flag, had their data field decrypted without first verifying +the MIC. In case the data field was encrypted using RC4 (i.e., when +negotiating TKIP as the pairwise cipher), this meant that +unauthenticated but decrypted data would then be processed. An adversary +could abuse this as a decryption oracle to recover sensitive information +in the data field of EAPOL-Key messages (e.g., the group key). +(CVE-2018-14526) + +Signed-off-by: Mathy Vanhoef +--- + src/rsn_supp/wpa.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c +index 56f3af7..db94a49 100644 +--- a/src/rsn_supp/wpa.c ++++ b/src/rsn_supp/wpa.c +@@ -2215,6 +2215,17 @@ int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr, + + if ((sm->proto == WPA_PROTO_RSN || sm->proto == WPA_PROTO_OSEN) && + (key_info & WPA_KEY_INFO_ENCR_KEY_DATA) && mic_len) { ++ /* ++ * Only decrypt the Key Data field if the frame's authenticity ++ * was verified. When using AES-SIV (FILS), the MIC flag is not ++ * set, so this check should only be performed if mic_len != 0 ++ * which is the case in this code branch. ++ */ ++ if (!(key_info & WPA_KEY_INFO_MIC)) { ++ wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, ++ "WPA: Ignore EAPOL-Key with encrypted but unauthenticated data"); ++ goto out; ++ } + if (wpa_supplicant_decrypt_key_data(sm, key, mic_len, + ver, key_data, + &key_data_len)) +-- +2.7.4 + diff --git a/package/network/services/igmpproxy/Makefile b/package/network/services/igmpproxy/Makefile index b98f3e594..6ac4172c8 100644 --- a/package/network/services/igmpproxy/Makefile +++ b/package/network/services/igmpproxy/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=igmpproxy PKG_VERSION:=0.2.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/pali/igmpproxy/releases/download/${PKG_VERSION}/ diff --git a/package/network/services/igmpproxy/files/igmpproxy.init b/package/network/services/igmpproxy/files/igmpproxy.init index 009bb5d42..0c30895ad 100644 --- a/package/network/services/igmpproxy/files/igmpproxy.init +++ b/package/network/services/igmpproxy/files/igmpproxy.init @@ -114,7 +114,7 @@ start_service() { [ -n "$has_upstream" ] || return procd_open_instance - procd_set_param command $PROG + procd_set_param command $PROG '-n' [ -n "$logopts" ] && procd_append_param command $logopts procd_append_param command $CONFIGFILE procd_set_param file $CONFIGFILE diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index f78fb9485..fa8731491 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcpd PKG_RELEASE:=1 -PKG_VERSION:=1.7 +PKG_VERSION:=1.10 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git -PKG_SOURCE_DATE:=2018-04-23 -PKG_SOURCE_VERSION:=413652910234f44e11d6550abf6871621474b8cb -PKG_MIRROR_HASH:=2245eea8764e40b518e40633eeabd30eb8cc4d01574a351a3d6b0aef27f654ca +PKG_SOURCE_DATE:=2018-07-26 +PKG_SOURCE_VERSION:=44cce3169a961727b1f046b786e7995ffb26a957 +PKG_MIRROR_HASH:=f068ddad6e4c630a5baf7369a6deaebd1ec3f7e5c0aa4826496451da425e40dc PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 diff --git a/package/network/services/openvpn/Makefile b/package/network/services/openvpn/Makefile index 552ed158b..374e14f7b 100644 --- a/package/network/services/openvpn/Makefile +++ b/package/network/services/openvpn/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openvpn PKG_VERSION:=2.4.5 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE_URL:=\ https://build.openvpn.net/downloads/releases/ \ diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 282e8f17f..beeaa53c2 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -17,6 +17,7 @@ PKG_SOURCE_URL:=https://download.samba.org/pub/ppp/ PKG_HASH:=02e0a3dd3e4799e33103f70ec7df75348c8540966ee7c948e4ed8a42bbccfb30 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause +PKG_CPE_ID:=cpe:/a:samba:ppp PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) @@ -35,7 +36,7 @@ endef define Package/ppp $(call Package/ppp/Default) - DEPENDS:=+kmod-ppp +libpthread +shellsync + DEPENDS:=+kmod-ppp TITLE:=PPP daemon VARIANT:=default endef @@ -177,10 +178,15 @@ $(call Build/Configure/Default,, \ UNAME_M="$(ARCH)" \ ) mkdir -p $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux - cp \ + $(CP) \ $(LINUX_DIR)/include/linux/compiler.h \ $(LINUX_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \ $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ + + # Kernel 4.14.9+ only, ignore the exit status of cp in case the file + # doesn't exits + -$(CP) $(LINUX_DIR)/include/linux/compiler_types.h \ + $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ endef TARGET_CFLAGS += -ffunction-sections -fdata-sections diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh index 875714b35..73bc3161c 100755 --- a/package/network/services/ppp/files/ppp.sh +++ b/package/network/services/ppp/files/ppp.sh @@ -223,16 +223,7 @@ proto_pppoe_setup() { json_get_var service service json_get_var host_uniq host_uniq -#By 蝈蝈:并发拨号同步的前期准备 - syncppp_option="" - [ "$(uci get syncdial.config.enabled)" == "1" ] && { - ppp_if_cnt=$(cat /etc/config/network | grep -c "proto 'pppoe'") - syncppp_option="syncppp $ppp_if_cnt" - shellsync $ppp_if_cnt 10 - } - ppp_generic_setup "$config" \ - $syncppp_option \ plugin rp-pppoe.so \ ${ac:+rp_pppoe_ac "$ac"} \ ${service:+rp_pppoe_service "$service"} \ diff --git a/package/network/services/ppp/patches/500-add-pptp-plugin.patch b/package/network/services/ppp/patches/500-add-pptp-plugin.patch index d984e1b16..5ed861d54 100644 --- a/package/network/services/ppp/patches/500-add-pptp-plugin.patch +++ b/package/network/services/ppp/patches/500-add-pptp-plugin.patch @@ -1064,7 +1064,7 @@ + struct in_addr localbind); --- /dev/null +++ b/pppd/plugins/pptp/pptp_ctrl.c -@@ -0,0 +1,1077 @@ +@@ -0,0 +1,1078 @@ +/* pptp_ctrl.c ... handle PPTP control connection. + * C. Scott Ananian + * @@ -1083,6 +1083,7 @@ +#include +#include +#include ++#include "pppd.h" +#include "pptp_msg.h" +#include "pptp_ctrl.h" +#include "pptp_options.h" diff --git a/package/network/services/ppp/patches/511-syncppp.patch b/package/network/services/ppp/patches/511-syncppp.patch deleted file mode 100644 index fe58b8cc8..000000000 --- a/package/network/services/ppp/patches/511-syncppp.patch +++ /dev/null @@ -1,214 +0,0 @@ -diff -Naur ppp-2.4.5.0/pppd/chap-new.c ppp-2.4.5/pppd/chap-new.c ---- ppp-2.4.5.0/pppd/chap-new.c 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/chap-new.c 2012-04-19 20:24:28.000000000 +0800 -@@ -37,6 +37,8 @@ - #include "chap-new.h" - #include "chap-md5.h" - -+#include "syncppp.h" -+ - #ifdef CHAPMS - #include "chap_ms.h" - #define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5) -@@ -481,6 +483,19 @@ - p[2] = len >> 8; - p[3] = len; - -+ if (npppd > 1) { -+ if (syncppp(npppd) < 0) { -+ error("syncppp sync fail"); -+ sem_unlink(SEM_COUNT_NAME); -+ sem_unlink(SEM_BLOCK_NAME); -+ } else { -+ info("syncppp sync succeeded"); -+ } -+ } else { -+ info("syncppp not active"); -+ } -+ -+ - output(0, response, PPP_HDRLEN + len); - } - -diff -Naur ppp-2.4.5.0/pppd/Makefile.linux ppp-2.4.5/pppd/Makefile.linux ---- ppp-2.4.5.0/pppd/Makefile.linux 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/Makefile.linux 2012-04-19 20:01:05.000000000 +0800 -@@ -13,16 +13,16 @@ - - PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap-new.c md5.c ccp.c \ - ecp.c ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c \ -- demand.c utils.c tty.c eap.c chap-md5.c session.c -+ demand.c utils.c tty.c eap.c chap-md5.c session.c syncppp.c - - HEADERS = ccp.h session.h chap-new.h ecp.h fsm.h ipcp.h \ - ipxcp.h lcp.h magic.h md5.h patchlevel.h pathnames.h pppd.h \ -- upap.h eap.h -+ upap.h eap.h syncppp.h - - MANPAGES = pppd.8 - PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap-new.o md5.o ccp.o \ - ecp.o auth.o options.o demand.o utils.o sys-linux.o ipxcp.o tty.o \ -- eap.o chap-md5.o session.o -+ eap.o chap-md5.o session.o syncppp.o - - # - # include dependencies if present -@@ -33,7 +33,7 @@ - # CC = gcc - # - COPTS = -O2 -pipe -Wall -g --LIBS = -+LIBS = -lpthread - - # Uncomment the next 2 lines to include support for Microsoft's - # MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux. -diff -Naur ppp-2.4.5.0/pppd/options.c ppp-2.4.5/pppd/options.c ---- ppp-2.4.5.0/pppd/options.c 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/options.c 2012-04-19 20:24:49.000000000 +0800 -@@ -126,6 +126,7 @@ - bool dryrun; /* print out option values and exit */ - char *domain; /* domain name set by domain option */ - int child_wait = 5; /* # seconds to wait for children at exit */ -+int npppd = 0; /* synchronize between multiple pppd */ - struct userenv *userenv_list; /* user environment variables */ - - #ifdef MAXOCTETS -@@ -311,6 +312,10 @@ - "Set pathname of ipv6-down script", - OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, - -+ { "syncppp", o_int, &npppd, -+ "sync among multiple pppd when sending chap/pap respond", OPT_PRIO }, -+ -+ - #ifdef HAVE_MULTILINK - { "multilink", o_bool, &multilink, - "Enable multilink operation", OPT_PRIO | 1 }, -diff -Naur ppp-2.4.5.0/pppd/pppd.h ppp-2.4.5/pppd/pppd.h ---- ppp-2.4.5.0/pppd/pppd.h 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/pppd.h 2012-04-19 20:25:02.000000000 +0800 -@@ -327,6 +327,7 @@ - extern bool dump_options; /* print out option values */ - extern bool dryrun; /* check everything, print options, exit */ - extern int child_wait; /* # seconds to wait for children at end */ -+extern int npppd; /* synchronize between multiple pppd */ - - #ifdef MAXOCTETS - extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */ -diff -Naur ppp-2.4.5.0/pppd/syncppp.c ppp-2.4.5/pppd/syncppp.c ---- ppp-2.4.5.0/pppd/syncppp.c 1970-01-01 08:00:00.000000000 +0800 -+++ ppp-2.4.5/pppd/syncppp.c 2012-04-18 15:46:59.000000000 +0800 -@@ -0,0 +1,75 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include "pppd.h" -+#include "syncppp.h" -+ -+int syncppp(int nproc) -+{ -+ int flags; -+ int value; -+ sem_t *block; -+ sem_t *count; -+ struct timespec ts; -+ -+ if (nproc <= 1) { -+ error("syncppp: number of pppd should be larger than 1"); -+ return -1; -+ } -+ -+ if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { -+ error("clock_gettime error"); -+ return -1; -+ } -+ ts.tv_sec += SYNCPPP_TIMEOUT; -+ -+ -+ flags = O_RDWR | O_CREAT; -+ block = sem_open(SEM_BLOCK_NAME, flags, 0644, 0); -+ count = sem_open(SEM_COUNT_NAME, flags, 0644, 0); -+ if (block == SEM_FAILED || count == SEM_FAILED) { -+ error("syncppp: sem_open failed"); -+ return -1; -+ } -+ -+ if (sem_post(count) < 0) { -+ error("syncppp: sem_post failed"); -+ return -1; -+ } -+ if (sem_getvalue(count, &value) < 0) { -+ error("syncppp: sem_getvalue failed"); -+ return -1; -+ } -+ info("%d pppd have arrived, waiting for the left %d", value, nproc-value); -+ if (value >= nproc) { -+ while (nproc-1 > 0) { -+ if (sem_post(block) < 0) { -+ error("syncppp: sem_post failed"); -+ return -1; -+ } -+ nproc--; -+ } -+ } else { -+ if (sem_timedwait(block, &ts) < 0) { -+ if (errno == ETIMEDOUT) { -+ error("syncppp: sem_timewait time out"); -+ } else { -+ error("syncppp: sem_timewait error"); -+ } -+ return -1; -+ } -+ -+ } -+ -+ sem_close(count); -+ sem_close(block); -+ -+ sem_unlink(SEM_COUNT_NAME); -+ sem_unlink(SEM_BLOCK_NAME); -+ -+ return 0; -+} -+ -diff -Naur ppp-2.4.5.0/pppd/syncppp.h ppp-2.4.5/pppd/syncppp.h ---- ppp-2.4.5.0/pppd/syncppp.h 1970-01-01 08:00:00.000000000 +0800 -+++ ppp-2.4.5/pppd/syncppp.h 2012-04-18 15:46:59.000000000 +0800 -@@ -0,0 +1,3 @@ -+#define SEM_BLOCK_NAME "block" -+#define SEM_COUNT_NAME "count" -+#define SYNCPPP_TIMEOUT 5 -diff -Naur ppp-2.4.5.0/pppd/upap.c ppp-2.4.5/pppd/upap.c ---- ppp-2.4.5.0/pppd/upap.c 2012-04-18 15:44:46.000000000 +0800 -+++ ppp-2.4.5/pppd/upap.c 2012-04-19 20:26:22.000000000 +0800 -@@ -52,6 +52,8 @@ - #include "pppd.h" - #include "upap.h" - -+#include "syncppp.h" -+ - static const char rcsid[] = RCSID; - - static bool hide_password = 1; -@@ -568,6 +570,18 @@ - PUTCHAR(u->us_passwdlen, outp); - BCOPY(u->us_passwd, outp, u->us_passwdlen); - -+ if (npppd > 1) { -+ if (syncppp(npppd) < 0) { -+ error("syncppp sync fail"); -+ sem_unlink(SEM_COUNT_NAME); -+ sem_unlink(SEM_BLOCK_NAME); -+ } else { -+ info("syncppp sync succeeded"); -+ } -+ } else { -+ info("syncppp not active"); -+ } -+ - output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN); - - TIMEOUT(upap_timeout, u, u->us_timeouttime); diff --git a/package/network/services/samba36/Makefile b/package/network/services/samba36/Makefile index 30e26195f..39bfcc6c4 100644 --- a/package/network/services/samba36/Makefile +++ b/package/network/services/samba36/Makefile @@ -43,6 +43,12 @@ define Package/samba36-server DEPENDS:=+USE_GLIBC:librt $(ICONV_DEPENDS) endef +define Package/samba36-hotplug + $(call Package/samba/Default) + TITLE+= hotplug + DEPENDS:=+block-mount +endef + define Package/samba36-client $(call Package/samba/Default) TITLE+= client @@ -159,6 +165,13 @@ define Package/samba36-server/install $(LN) samba_multicall $(1)/usr/sbin/smbpasswd endef +define Package/samba36-hotplug/install + $(INSTALL_DIR) $(1)/lib/samba + $(INSTALL_DATA) ./files/lib/samba.sh $(1)/lib/samba/samba.sh + $(INSTALL_DIR) $(1)/etc/hotplug.d/block + $(INSTALL_DATA) ./files/samba.hotplug $(1)/etc/hotplug.d/block/60-samba +endef + define Package/samba36-client/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_BIN)/smbclient $(1)/usr/sbin @@ -172,5 +185,6 @@ endef $(eval $(call BuildPackage,samba36-client)) $(eval $(call BuildPackage,samba36-server)) +$(eval $(call BuildPackage,samba36-hotplug)) $(eval $(call BuildPackage,samba36-net)) diff --git a/package/network/services/samba36/files/lib/samba.sh b/package/network/services/samba36/files/lib/samba.sh new file mode 100644 index 000000000..a72a2a193 --- /dev/null +++ b/package/network/services/samba36/files/lib/samba.sh @@ -0,0 +1,89 @@ +#!/bin/sh +# +# Copyright (C) 2018 OpenWrt.org +# Copyright (C) 2018 rosysong@rosinson.com +# + +. /lib/functions.sh + +FLAG_DEV_TYPE= +FLAG_DEV_MOPT= +FLAG_HAS_SECT= + +samba_dev_filter() { # <[path,/dev/]> + case $1 in + ${2}mtdblock*|\ + ${2}ubi*) + FLAG_DEV_TYPE="mtd" + ;; + ${2}loop*|\ + ${2}mmcblk*|\ + ${2}sd*|\ + ${2}hd*|\ + ${2}md*|\ + ${2}nvme*|\ + ${2}vd*|\ + ${2}xvd*) + FLAG_DEV_TYPE="not-mtd" + ;; + *) + [ -b ${2}${1} ] && FLAG_DEV_TYPE="not-mtd" + [ -b /dev/mapper/$1 ] && FLAG_DEV_TYPE="not-mtd" + ;; + esac +} + +samba_cfg_lookup() { #
+ config_get name $1 name + [ "$name" = "$2" ] || return + FLAG_HAS_SECT=y +} + +samba_cfg_delete() { #
+ config_get name $1 name + [ "$name" = "$2" ] || return + uci -q delete samba.$1 +} + +samba_find_mount_point() { # + # search mount point in /proc/mounts + while read l; do + local d=$(echo $l | awk '/^\/dev/ {print $1}') + [ "$d" = "/dev/$1" ] || continue + + FLAG_DEV_MOPT=$(echo $l | awk '/^\/dev/ {print $2}') + break + done < /proc/mounts +} + +_samba_add_section() { # + uci -q batch <<-EOF + add samba sambashare + set samba.@sambashare[-1].browseable='yes' + set samba.@sambashare[-1].name='$1' + set samba.@sambashare[-1].path='$2' + set samba.@sambashare[-1].users='root' + set samba.@sambashare[-1].read_only='no' + set samba.@sambashare[-1].guest_ok='yes' + set samba.@sambashare[-1].create_mask='0755' + set samba.@sambashare[-1].dir_mask='0755' + EOF +} + +samba_add_section() { # [] + FLAG_HAS_SECT= + FLAG_DEV_MOPT= + + config_foreach samba_cfg_lookup sambashare $1 + [ -z "$FLAG_HAS_SECT" ] || return + + samba_find_mount_point $1 + [ -n "$FLAG_DEV_MOPT" ] || return + + [ -n "$2" -a "$2" = "$FLAG_DEV_MOPT" ] || \ + _samba_add_section $1 $FLAG_DEV_MOPT +} + +samba_delete_section() { # + config_foreach samba_cfg_delete sambashare $1 +} diff --git a/package/network/services/samba36/files/samba.hotplug b/package/network/services/samba36/files/samba.hotplug new file mode 100644 index 000000000..9c6dbe5e4 --- /dev/null +++ b/package/network/services/samba36/files/samba.hotplug @@ -0,0 +1,11 @@ +. /lib/samba/samba.sh + +samba_dev_filter $DEVNAME +[ "$FLAG_DEV_TYPE" = "not-mtd" ] || exit + +config_load samba +case $ACTION in + add) samba_add_section $DEVNAME;; + remove) samba_delete_section $DEVNAME;; +esac +uci commit samba diff --git a/package/network/services/shellsync/Makefile b/package/network/services/shellsync/Makefile deleted file mode 100644 index 6dce14b35..000000000 --- a/package/network/services/shellsync/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -include $(TOPDIR)/rules.mk - -PKG_NAME:=shellsync -PKG_VERSION:=0.2 -PKG_RELEASE:=1 - -include $(INCLUDE_DIR)/package.mk - -define Package/shellsync - CATEGORY:=Utilities - TITLE:=shellsync - DEPENDS:=+libpthread -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) - $(CP) ./src/* $(PKG_BUILD_DIR)/ -endef - -define Package/shellsync/description -A tool to sync different shell scripts.Based on syncppp patch by morfast. -endef - -define Build/Compile - $(TARGET_CROSS)gcc -pthread -o $(PKG_BUILD_DIR)/shellsync $(PKG_BUILD_DIR)/shellsync.c -endef - -define Package/shellsync/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/shellsync $(1)/usr/bin -endef - - -$(eval $(call BuildPackage,shellsync)) diff --git a/package/network/services/shellsync/src/shellsync.c b/package/network/services/shellsync/src/shellsync.c deleted file mode 100644 index 4aef1e9ba..000000000 --- a/package/network/services/shellsync/src/shellsync.c +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - > File Name: shellsync.c - > Author: GuoGuo - > Mail: gch981213@gmail.com - > Created Time: 2014年11月06日 星期四 19时15分30秒 - ************************************************************************/ -#include -#include -#include -#include -#include -#include -#define SEM_BLOCK_NAME "SYNCSHELL_block" -#define SEM_COUNT_NAME "SYNCSHELL_count" -int wait_timeout; -int sync_wait(int nproc) -{ - int flags; - int value; - sem_t *block; - sem_t *count; - struct timespec ts; - - if (nproc <= 1) { - printf("sync_wait: number of processes should be larger than 1\n"); - return -1; - } - - if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { - printf("clock_gettime error\n"); - return -1; - } - ts.tv_sec += wait_timeout; - - - flags = O_RDWR | O_CREAT; - block = sem_open(SEM_BLOCK_NAME, flags, 0644, 0); - count = sem_open(SEM_COUNT_NAME, flags, 0644, 0); - if (block == SEM_FAILED || count == SEM_FAILED) { - printf("sync_wait: sem_open failed\n"); - return -1; - } - - if (sem_post(count) < 0) { - printf("sync_wait: sem_post failed\n"); - return -1; - } - if (sem_getvalue(count, &value) < 0) { - printf("sync_wait: sem_getvalue failed\n"); - return -1; - } - printf("%d processes have arrived, waiting for the left %d\n", value, nproc-value); - if (value >= nproc) { - while (nproc-1 > 0) { - if (sem_post(block) < 0) { - printf("sync_wait: sem_post failed\n"); - return -1; - } - nproc--; - } - } else { - if (sem_timedwait(block, &ts) < 0) { - if (errno == ETIMEDOUT) { - printf("sync_wait: sem_timewait time out\n"); - } else { - printf("sync_wait: sem_timewait error\n"); - } - return -1; - } - - } - - sem_close(count); - sem_close(block); - - sem_unlink(SEM_COUNT_NAME); - sem_unlink(SEM_BLOCK_NAME); - - return 0; -} - -int main(int argc,char *argv[]) -{ - if(argc!=3) - { - printf("Usage: shellsync \n"); - } - else - { - int proc_num; - sscanf(argv[1],"%d",&proc_num); - sscanf(argv[2],"%d",&wait_timeout); - if(sync_wait(proc_num)<0) - { - printf("Processes sync failed.\n"); - sem_unlink(SEM_COUNT_NAME); - sem_unlink(SEM_BLOCK_NAME); - return 1; - } - else - { - printf("Processes sync succeed.\n"); - return 0; - } - } -} diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 648916385..0872b22aa 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git -PKG_SOURCE_DATE:=2017-11-04 -PKG_SOURCE_VERSION:=a235636a2687fafb9c474e4b134a59ff66425c92 -PKG_MIRROR_HASH:=626392a485e8ab8085bb55d9424b176be9143529db59a820a7de71061a93a007 +PKG_SOURCE_DATE:=2018-06-26 +PKG_SOURCE_VERSION:=796d42bceed2015bb00309a3bf0f49279b070c19 +PKG_MIRROR_HASH:=b9c79a74a112a5a2551012aa30a072121198f44d308f12948faeb792f0c6410a PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC diff --git a/package/network/services/wireguard/Makefile b/package/network/services/wireguard/Makefile index 9ed24ecaa..a88dca1e7 100644 --- a/package/network/services/wireguard/Makefile +++ b/package/network/services/wireguard/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2016-2017 Jason A. Donenfeld +# Copyright (C) 2016-2018 Jason A. Donenfeld # Copyright (C) 2016 Baptiste Jonglez # Copyright (C) 2016-2017 Dan Luedtke # @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=wireguard -PKG_VERSION:=0.0.20180420 -PKG_RELEASE:=1 +PKG_VERSION:=0.0.20180718 +PKG_RELEASE:=2 PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/ -PKG_HASH:=b58cd2acf9e8d3fe9044c06c0056bd74da1f5673a456f011d36eee3f6fb1da16 +PKG_HASH:=083c093a6948c8d38f92e7ea5533f9ff926019f24dc2612ea974851ed3e24705 PKG_LICENSE:=GPL-2.0 Apache-2.0 PKG_LICENSE_FILES:=COPYING @@ -35,9 +35,8 @@ define Package/wireguard/Default CATEGORY:=Network SUBMENU:=VPN URL:=https://www.wireguard.com - MAINTAINER:=Baptiste Jonglez , \ - Dan Luedtke , \ - Jason A. Donenfeld + MAINTAINER:=Jason A. Donenfeld \ + Kevin Darbyshire-Bryant endef define Package/wireguard/Default/description @@ -60,6 +59,7 @@ include $(INCLUDE_DIR)/package-defaults.mk # Used by Build/Compile/Default MAKE_PATH:=src/tools +MAKE_VARS += PLATFORM=linux define Build/Compile $(MAKE) $(KERNEL_MAKEOPTS) M="$(PKG_BUILD_DIR)/src" modules @@ -84,12 +84,13 @@ define Package/wireguard-tools/description $(call Package/wireguard/Default/description) This package provides the userspace control program for WireGuard, - `wg(8)`, and a netifd protocol helper. + `wg(8)`, a netifd protocol helper, and a re-resolve watchdog script. endef define Package/wireguard-tools/install $(INSTALL_DIR) $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tools/wg $(1)/usr/bin/ + $(INSTALL_BIN) ./files/wireguard_watchdog $(1)/usr/bin/ $(INSTALL_DIR) $(1)/lib/netifd/proto/ $(INSTALL_BIN) ./files/wireguard.sh $(1)/lib/netifd/proto/ endef diff --git a/package/network/services/wireguard/files/wireguard.sh b/package/network/services/wireguard/files/wireguard.sh index 7b18a2e0e..96fa7215f 100644 --- a/package/network/services/wireguard/files/wireguard.sh +++ b/package/network/services/wireguard/files/wireguard.sh @@ -113,6 +113,7 @@ proto_wireguard_setup() { config_get addresses "${config}" "addresses" config_get mtu "${config}" "mtu" config_get fwmark "${config}" "fwmark" + config_get ip6prefix "${config}" "ip6prefix" # create interface ip link del dev "${config}" 2>/dev/null @@ -169,6 +170,11 @@ proto_wireguard_setup() { esac done + # support ip6 prefixes + for prefix in ${ip6prefix}; do + proto_add_ipv6_prefix "$prefix" + done + # endpoint dependency wg show "${config}" endpoints | \ sed -E 's/\[?([0-9.:a-f]+)\]?:([0-9]+)/\1 \2/' | \ diff --git a/package/network/services/wireguard/files/wireguard_watchdog b/package/network/services/wireguard/files/wireguard_watchdog new file mode 100644 index 000000000..5fbbeafec --- /dev/null +++ b/package/network/services/wireguard/files/wireguard_watchdog @@ -0,0 +1,60 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) 2018 Aleksandr V. Piskunov . +# Copyright (C) 2015-2018 Jason A. Donenfeld . All Rights Reserved. +# +# This watchdog script tries to re-resolve hostnames for inactive WireGuard peers. +# Use it for peers with a frequently changing dynamic IP. +# persistent_keepalive must be set, recommended value is 25 seconds. +# +# Run this script from cron every minute: +# echo '* * * * * /usr/bin/wireguard_watchdog' >> /etc/crontabs/root + + +. /lib/functions.sh + +check_peer_activity() { + local cfg=$1 + local iface=$2 + local public_key + local endpoint_host + local endpoint_port + local persistent_keepalive + local last_handshake + local idle_seconds + + config_get public_key "${cfg}" "public_key" + config_get endpoint_host "${cfg}" "endpoint_host" + config_get endpoint_port "${cfg}" "endpoint_port" + persistent_keepalive=`wg show ${iface} persistent-keepalive | grep ${public_key} | awk '{print $2}'` + + # only process peers with endpoints and keepalive set + [ -z ${endpoint_host} ] && return 0; + [ -z ${persistent_keepalive} -o ${persistent_keepalive} = "off" ] && return 0; + + # skip IP addresses + # check taken from packages/net/ddns-scripts/files/dynamic_dns_functions.sh + local IPV4_REGEX="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" + local IPV6_REGEX="\(\([0-9A-Fa-f]\{1,4\}:\)\{1,\}\)\(\([0-9A-Fa-f]\{1,4\}\)\{0,1\}\)\(\(:[0-9A-Fa-f]\{1,4\}\)\{1,\}\)" + local IPV4=$(echo ${endpoint_host} | grep -m 1 -o "$IPV4_REGEX$") # do not detect ip in 0.0.0.0.example.com + local IPV6=$(echo ${endpoint_host} | grep -m 1 -o "$IPV6_REGEX") + [ -n "${IPV4}" -o -n "${IPV6}" ] && return 0; + + # re-resolve endpoint hostname if not responding for too long + last_handshake=`wg show ${iface} latest-handshakes | grep ${public_key} | awk '{print $2}'` + [ -z ${last_handshake} ] && return 0; + idle_seconds=$((`date +%s`-${last_handshake})) + [ ${idle_seconds} -lt 150 ] && return 0; + logger -t "wireguard_monitor" "${iface} endpoint ${endpoint_host}:${endpoint_port} is not responding for ${idle_seconds} seconds, trying to re-resolve hostname" + wg set ${iface} peer ${public_key} endpoint "${endpoint_host}:${endpoint_port}" +} + +# query ubus for all active wireguard interfaces +wg_ifaces=`ubus -S call network.interface dump | jsonfilter -e '@.interface[@.up=true]' | jsonfilter -a -e '@[@.proto="wireguard"].interface' | tr "\n" " "` + +# check every peer in every active wireguard interface +config_load network +for iface in $wg_ifaces; do + config_foreach check_peer_activity "wireguard_${iface}" "${iface}" +done diff --git a/package/network/services/wireguard/patches/100-portability.patch b/package/network/services/wireguard/patches/100-portability.patch deleted file mode 100644 index b26d51ebd..000000000 --- a/package/network/services/wireguard/patches/100-portability.patch +++ /dev/null @@ -1,18 +0,0 @@ -tools: fix portability issue - -Check if the compiler defines __linux__, instead of assuming that the -host OS is the same as the target OS. - -Signed-off-by: Felix Fietkau ---- ---- a/src/tools/Makefile -+++ b/src/tools/Makefile -@@ -43,7 +43,7 @@ CFLAGS += -DRUNSTATEDIR="\"$(RUNSTATEDIR - ifeq ($(DEBUG_TOOLS),y) - CFLAGS += -g - endif --ifeq ($(shell uname -s),Linux) -+ifeq ($(strip $(shell echo __linux__ | $(CC) -E - | grep -v '^\#')),1) - LIBMNL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmnl 2>/dev/null) - LIBMNL_LDLIBS := $(shell $(PKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl) - CFLAGS += $(LIBMNL_CFLAGS) diff --git a/package/network/utils/curl/Makefile b/package/network/utils/curl/Makefile index 307ca9995..db726407b 100644 --- a/package/network/utils/curl/Makefile +++ b/package/network/utils/curl/Makefile @@ -8,15 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=curl -PKG_VERSION:=7.59.0 -PKG_RELEASE:=2 +PKG_VERSION:=7.60.0 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://dl.uxnr.de/mirror/curl/ \ http://curl.mirror.anstey.ca/ \ http://curl.askapache.com/download/ \ https://curl.haxx.se/download/ -PKG_HASH:=e44eaabdf916407585bf5c7939ff1161e6242b6b015d3f2f5b758b2a330461fc +PKG_HASH:=8736ff8ded89ddf7e926eec7b16f82597d029fc1469f3a551f1fafaac164e6a0 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING 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 index aabf274ac..4d34426a3 100644 --- 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 @@ -6,6 +6,6 @@ { - unsigned int version = mbedtls_version_get_number(); + unsigned int version = MBEDTLS_VERSION_NUMBER; - return snprintf(buffer, size, "mbedTLS/%d.%d.%d", version>>24, + return snprintf(buffer, size, "mbedTLS/%u.%u.%u", version>>24, (version>>16)&0xff, (version>>8)&0xff); } diff --git a/package/network/utils/curl/patches/320-mbedtls_dont_use_deprecated_sha256_function.patch b/package/network/utils/curl/patches/320-mbedtls_dont_use_deprecated_sha256_function.patch deleted file mode 100644 index 5c4c18c2a..000000000 --- a/package/network/utils/curl/patches/320-mbedtls_dont_use_deprecated_sha256_function.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/lib/vtls/mbedtls.c -+++ b/lib/vtls/mbedtls.c -@@ -1029,7 +1029,7 @@ static void Curl_mbedtls_sha256sum(const - size_t sha256len UNUSED_PARAM) - { - (void)sha256len; -- mbedtls_sha256(input, inputlen, sha256sum, 0); -+ mbedtls_sha256_ret(input, inputlen, sha256sum, 0); - } - - static void *Curl_mbedtls_get_internals(struct ssl_connect_data *connssl, diff --git a/package/network/utils/curl/patches/400-CVE-2018-0500.patch b/package/network/utils/curl/patches/400-CVE-2018-0500.patch new file mode 100644 index 000000000..9ef4111ae --- /dev/null +++ b/package/network/utils/curl/patches/400-CVE-2018-0500.patch @@ -0,0 +1,32 @@ +From ba1dbd78e5f1ed67c1b8d37ac89d90e5e330b628 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg +Date: Wed, 13 Jun 2018 12:24:40 +0200 +Subject: [PATCH] smtp: use the upload buffer size for scratch buffer malloc + +... not the read buffer size, as that can be set smaller and thus cause +a buffer overflow! CVE-2018-0500 + +Reported-by: Peter Wu +Bug: https://curl.haxx.se/docs/adv_2018-70a2.html +--- + lib/smtp.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/lib/smtp.c ++++ b/lib/smtp.c +@@ -1563,13 +1563,14 @@ CURLcode Curl_smtp_escape_eob(struct con + if(!scratch || data->set.crlf) { + oldscratch = scratch; + +- scratch = newscratch = malloc(2 * data->set.buffer_size); ++ scratch = newscratch = malloc(2 * UPLOAD_BUFSIZE); + if(!newscratch) { + failf(data, "Failed to alloc scratch buffer!"); + + return CURLE_OUT_OF_MEMORY; + } + } ++ DEBUGASSERT(UPLOAD_BUFSIZE >= nread); + + /* Have we already sent part of the EOB? */ + eob_sent = smtp->eob; diff --git a/package/network/utils/iftop/Makefile b/package/network/utils/iftop/Makefile index 8c5b47444..ed22eb81b 100644 --- a/package/network/utils/iftop/Makefile +++ b/package/network/utils/iftop/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://code.blinkace.com/pdw/iftop.git -PKG_SOURCE_DATE:=2017-02-06 -PKG_SOURCE_VERSION:=35af3cf65f17961d173b31fd3b00166ec095c226 -PKG_MIRROR_HASH:=84131e2448ea5aa884d2bd7d58dc81741b5c476b4664a8c2c1eb34f62985804a +PKG_SOURCE_DATE:=2017-03-22 +PKG_SOURCE_VERSION:=949ed0f7e2c54c598868c270b82c2d702131a339 +PKG_MIRROR_HASH:=2ba96d9a2adf4e43aaab439a9ccab8f21b415da48d1c8939f6dcea8e6e11524f 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 2f420a2e2..3f7bfad9c 100644 --- a/package/network/utils/iperf/Makefile +++ b/package/network/utils/iperf/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iperf -PKG_VERSION:=2.0.10 +PKG_VERSION:=2.0.12 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_HASH:=7fe4348dcca313b74e0aa9c34a8ccd713b84a5615b8578f4aa94cedce9891ef2 +PKG_HASH:=367f651fb1264b13f6518e41b8a7e08ce3e41b2a1c80e99ff0347561eed32646 PKG_SOURCE_URL:=@SF/iperf2 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index ef4befaed..54e0fdede 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 -PKG_VERSION:=4.15.0 -PKG_RELEASE:=3 +PKG_VERSION:=4.16.0 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_HASH:=48d4616a99d7b609b7b795c0ae8ec57099fb0271ed89253e8772c02327798355 +PKG_HASH:=0c5c24020fd7349fe25728c5edee9fb6a1bc8a38f08e23be5c57a6301e55ee0a PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iproute2/patches/002-json_print-fix-hidden-64-bit-type-promotion.patch b/package/network/utils/iproute2/patches/002-json_print-fix-hidden-64-bit-type-promotion.patch new file mode 100644 index 000000000..ad9397321 --- /dev/null +++ b/package/network/utils/iproute2/patches/002-json_print-fix-hidden-64-bit-type-promotion.patch @@ -0,0 +1,288 @@ +From 8de9593bb9dc05cb1be593a237682e8707e41aa9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Wed, 25 Apr 2018 16:19:35 +0200 +Subject: [PATCH] json_print: Fix hidden 64-bit type promotion +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +print_uint() will silently promote its variable type to uint64_t, but there +is nothing that ensures that the format string specifier passed along with +it fits (and the function name suggest to pass "%u"). + +Fix this by changing print_uint() to use a native 'unsigned int' type, and +introduce a separate print_u64() function for printing 64-bit values. All +call sites that were actually printing 64-bit values using print_uint() are +converted to use print_u64() instead. + +Since print_int() was already using native int types, just add a +print_s64() to match, but don't convert any call sites. + +Signed-off-by: Toke Høiland-Jørgensen +Signed-off-by: Kevin Darbyshire-Bryant +--- + include/json_print.h | 4 +++- + include/json_writer.h | 12 ++++++---- + ip/ipaddress.c | 62 +++++++++++++++++++++++++-------------------------- + ip/ipmacsec.c | 8 +++---- + ip/ipmroute.c | 6 ++--- + lib/json_print.c | 4 +++- + lib/json_writer.c | 30 +++++++++++++++++++++---- + 7 files changed, 78 insertions(+), 48 deletions(-) + +--- a/include/json_print.h ++++ b/include/json_print.h +@@ -56,10 +56,12 @@ void close_json_array(enum output_type t + print_color_##type_name(t, COLOR_NONE, key, fmt, value); \ + } + _PRINT_FUNC(int, int); ++_PRINT_FUNC(s64, int64_t); + _PRINT_FUNC(bool, bool); + _PRINT_FUNC(null, const char*); + _PRINT_FUNC(string, const char*); +-_PRINT_FUNC(uint, uint64_t); ++_PRINT_FUNC(uint, unsigned int); ++_PRINT_FUNC(u64, uint64_t); + _PRINT_FUNC(hu, unsigned short); + _PRINT_FUNC(hex, unsigned int); + _PRINT_FUNC(0xhex, unsigned int); +--- a/include/json_writer.h ++++ b/include/json_writer.h +@@ -34,9 +34,11 @@ void jsonw_string(json_writer_t *self, c + void jsonw_bool(json_writer_t *self, bool value); + void jsonw_float(json_writer_t *self, double number); + void jsonw_float_fmt(json_writer_t *self, const char *fmt, double num); +-void jsonw_uint(json_writer_t *self, uint64_t number); ++void jsonw_uint(json_writer_t *self, unsigned int number); ++void jsonw_u64(json_writer_t *self, uint64_t number); + void jsonw_hu(json_writer_t *self, unsigned short number); +-void jsonw_int(json_writer_t *self, int64_t number); ++void jsonw_int(json_writer_t *self, int number); ++void jsonw_s64(json_writer_t *self, int64_t number); + void jsonw_null(json_writer_t *self); + void jsonw_lluint(json_writer_t *self, unsigned long long int num); + +@@ -44,9 +46,11 @@ void jsonw_lluint(json_writer_t *self, u + void jsonw_string_field(json_writer_t *self, const char *prop, const char *val); + void jsonw_bool_field(json_writer_t *self, const char *prop, bool value); + void jsonw_float_field(json_writer_t *self, const char *prop, double num); +-void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num); ++void jsonw_uint_field(json_writer_t *self, const char *prop, unsigned int num); ++void jsonw_u64_field(json_writer_t *self, const char *prop, uint64_t num); + void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num); +-void jsonw_int_field(json_writer_t *self, const char *prop, int64_t num); ++void jsonw_int_field(json_writer_t *self, const char *prop, int num); ++void jsonw_s64_field(json_writer_t *self, const char *prop, int64_t num); + void jsonw_null_field(json_writer_t *self, const char *prop); + void jsonw_lluint_field(json_writer_t *self, const char *prop, + unsigned long long int num); +--- a/ip/ipaddress.c ++++ b/ip/ipaddress.c +@@ -555,21 +555,21 @@ static void print_vf_stats64(FILE *fp, s + + /* RX stats */ + open_json_object("rx"); +- print_uint(PRINT_JSON, "bytes", NULL, ++ print_u64(PRINT_JSON, "bytes", NULL, + rta_getattr_u64(vf[IFLA_VF_STATS_RX_BYTES])); +- print_uint(PRINT_JSON, "packets", NULL, ++ print_u64(PRINT_JSON, "packets", NULL, + rta_getattr_u64(vf[IFLA_VF_STATS_RX_PACKETS])); +- print_uint(PRINT_JSON, "multicast", NULL, ++ print_u64(PRINT_JSON, "multicast", NULL, + rta_getattr_u64(vf[IFLA_VF_STATS_MULTICAST])); +- print_uint(PRINT_JSON, "broadcast", NULL, ++ print_u64(PRINT_JSON, "broadcast", NULL, + rta_getattr_u64(vf[IFLA_VF_STATS_BROADCAST])); + close_json_object(); + + /* TX stats */ + open_json_object("tx"); +- print_uint(PRINT_JSON, "tx_bytes", NULL, ++ print_u64(PRINT_JSON, "tx_bytes", NULL, + rta_getattr_u64(vf[IFLA_VF_STATS_TX_BYTES])); +- print_uint(PRINT_JSON, "tx_packets", NULL, ++ print_u64(PRINT_JSON, "tx_packets", NULL, + rta_getattr_u64(vf[IFLA_VF_STATS_TX_PACKETS])); + close_json_object(); + close_json_object(); +@@ -602,50 +602,50 @@ static void print_link_stats64(FILE *fp, + + /* RX stats */ + open_json_object("rx"); +- print_uint(PRINT_JSON, "bytes", NULL, s->rx_bytes); +- print_uint(PRINT_JSON, "packets", NULL, s->rx_packets); +- print_uint(PRINT_JSON, "errors", NULL, s->rx_errors); +- print_uint(PRINT_JSON, "dropped", NULL, s->rx_dropped); +- print_uint(PRINT_JSON, "over_errors", NULL, s->rx_over_errors); +- print_uint(PRINT_JSON, "multicast", NULL, s->multicast); ++ print_u64(PRINT_JSON, "bytes", NULL, s->rx_bytes); ++ print_u64(PRINT_JSON, "packets", NULL, s->rx_packets); ++ print_u64(PRINT_JSON, "errors", NULL, s->rx_errors); ++ print_u64(PRINT_JSON, "dropped", NULL, s->rx_dropped); ++ print_u64(PRINT_JSON, "over_errors", NULL, s->rx_over_errors); ++ print_u64(PRINT_JSON, "multicast", NULL, s->multicast); + if (s->rx_compressed) +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "compressed", + NULL, s->rx_compressed); + + /* RX error stats */ + if (show_stats > 1) { +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "length_errors", + NULL, s->rx_length_errors); +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "crc_errors", + NULL, s->rx_crc_errors); +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "frame_errors", + NULL, s->rx_frame_errors); +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "fifo_errors", + NULL, s->rx_fifo_errors); +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "missed_errors", + NULL, s->rx_missed_errors); + if (s->rx_nohandler) +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "nohandler", NULL, s->rx_nohandler); + } + close_json_object(); + + /* TX stats */ + open_json_object("tx"); +- print_uint(PRINT_JSON, "bytes", NULL, s->tx_bytes); +- print_uint(PRINT_JSON, "packets", NULL, s->tx_packets); +- print_uint(PRINT_JSON, "errors", NULL, s->tx_errors); +- print_uint(PRINT_JSON, "dropped", NULL, s->tx_dropped); +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, "bytes", NULL, s->tx_bytes); ++ print_u64(PRINT_JSON, "packets", NULL, s->tx_packets); ++ print_u64(PRINT_JSON, "errors", NULL, s->tx_errors); ++ print_u64(PRINT_JSON, "dropped", NULL, s->tx_dropped); ++ print_u64(PRINT_JSON, + "carrier_errors", + NULL, s->tx_carrier_errors); +- print_uint(PRINT_JSON, "collisions", NULL, s->collisions); ++ print_u64(PRINT_JSON, "collisions", NULL, s->collisions); + if (s->tx_compressed) + print_uint(PRINT_JSON, + "compressed", +@@ -653,20 +653,20 @@ static void print_link_stats64(FILE *fp, + + /* TX error stats */ + if (show_stats > 1) { +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "aborted_errors", + NULL, s->tx_aborted_errors); +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "fifo_errors", + NULL, s->tx_fifo_errors); +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "window_errors", + NULL, s->tx_window_errors); +- print_uint(PRINT_JSON, ++ print_u64(PRINT_JSON, + "heartbeat_errors", + NULL, s->tx_heartbeat_errors); + if (carrier_changes) +- print_uint(PRINT_JSON, "carrier_changes", NULL, ++ print_u64(PRINT_JSON, "carrier_changes", NULL, + rta_getattr_u32(carrier_changes)); + } + close_json_object(); +--- a/lib/json_print.c ++++ b/lib/json_print.c +@@ -117,8 +117,10 @@ void close_json_array(enum output_type t + } \ + } + _PRINT_FUNC(int, int); ++_PRINT_FUNC(s64, int64_t); + _PRINT_FUNC(hu, unsigned short); +-_PRINT_FUNC(uint, uint64_t); ++_PRINT_FUNC(uint, unsigned int); ++_PRINT_FUNC(u64, uint64_t); + _PRINT_FUNC(lluint, unsigned long long int); + _PRINT_FUNC(float, double); + #undef _PRINT_FUNC +--- a/lib/json_writer.c ++++ b/lib/json_writer.c +@@ -215,7 +215,12 @@ void jsonw_hu(json_writer_t *self, unsig + jsonw_printf(self, "%hu", num); + } + +-void jsonw_uint(json_writer_t *self, uint64_t num) ++void jsonw_uint(json_writer_t *self, unsigned int num) ++{ ++ jsonw_printf(self, "%u", num); ++} ++ ++void jsonw_u64(json_writer_t *self, uint64_t num) + { + jsonw_printf(self, "%"PRIu64, num); + } +@@ -225,7 +230,12 @@ void jsonw_lluint(json_writer_t *self, u + jsonw_printf(self, "%llu", num); + } + +-void jsonw_int(json_writer_t *self, int64_t num) ++void jsonw_int(json_writer_t *self, int num) ++{ ++ jsonw_printf(self, "%d", num); ++} ++ ++void jsonw_s64(json_writer_t *self, int64_t num) + { + jsonw_printf(self, "%"PRId64, num); + } +@@ -258,12 +268,18 @@ void jsonw_float_field_fmt(json_writer_t + jsonw_float_fmt(self, fmt, val); + } + +-void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num) ++void jsonw_uint_field(json_writer_t *self, const char *prop, unsigned int num) + { + jsonw_name(self, prop); + jsonw_uint(self, num); + } + ++void jsonw_u64_field(json_writer_t *self, const char *prop, uint64_t num) ++{ ++ jsonw_name(self, prop); ++ jsonw_u64(self, num); ++} ++ + void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num) + { + jsonw_name(self, prop); +@@ -278,12 +294,18 @@ void jsonw_lluint_field(json_writer_t *s + jsonw_lluint(self, num); + } + +-void jsonw_int_field(json_writer_t *self, const char *prop, int64_t num) ++void jsonw_int_field(json_writer_t *self, const char *prop, int num) + { + jsonw_name(self, prop); + jsonw_int(self, num); + } + ++void jsonw_s64_field(json_writer_t *self, const char *prop, int64_t num) ++{ ++ jsonw_name(self, prop); ++ jsonw_s64(self, num); ++} ++ + void jsonw_null_field(json_writer_t *self, const char *prop) + { + jsonw_name(self, prop); diff --git a/package/network/utils/iproute2/patches/009-keep_libmnl_optional.patch b/package/network/utils/iproute2/patches/009-keep_libmnl_optional.patch index 61f8a695e..697a6471a 100644 --- a/package/network/utils/iproute2/patches/009-keep_libmnl_optional.patch +++ b/package/network/utils/iproute2/patches/009-keep_libmnl_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -293,7 +293,7 @@ check_selinux() +@@ -281,7 +281,7 @@ check_selinux() check_mnl() { diff --git a/package/network/utils/iproute2/patches/300-ip_tiny.patch b/package/network/utils/iproute2/patches/300-ip_tiny.patch index d06e91e37..d8f39d391 100644 --- a/package/network/utils/iproute2/patches/300-ip_tiny.patch +++ b/package/network/utils/iproute2/patches/300-ip_tiny.patch @@ -89,7 +89,7 @@ { "help", do_help }, --- a/lib/utils.c +++ b/lib/utils.c -@@ -885,6 +885,7 @@ const char *rt_addr_n2a_r(int af, int le +@@ -983,6 +983,7 @@ const char *rt_addr_n2a_r(int af, int le return inet_ntop(af, addr, buf, buflen); case AF_MPLS: return mpls_ntop(af, addr, buf, buflen); @@ -97,14 +97,14 @@ case AF_IPX: return ipx_ntop(af, addr, buf, buflen); case AF_DECnet: -@@ -894,6 +895,7 @@ const char *rt_addr_n2a_r(int af, int le +@@ -992,6 +993,7 @@ const char *rt_addr_n2a_r(int af, int le memcpy(dna.a_addr, addr, 2); return dnet_ntop(af, &dna, buf, buflen); } +#endif case AF_PACKET: return ll_addr_n2a(addr, len, ARPHRD_VOID, buf, buflen); - default: + case AF_BRIDGE: --- a/lib/Makefile +++ b/lib/Makefile @@ -3,6 +3,10 @@ include ../config.mk 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 216d7c7ef..05142fa95 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,15 +1,14 @@ -diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h -index 37b5096a..66da5df9 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h -@@ -934,4 +934,75 @@ enum { +@@ -934,4 +934,118 @@ enum { #define TCA_CBS_MAX (__TCA_CBS_MAX - 1) +/* CAKE */ +enum { + TCA_CAKE_UNSPEC, -+ TCA_CAKE_BASE_RATE, ++ TCA_CAKE_PAD, ++ TCA_CAKE_BASE_RATE64, + TCA_CAKE_DIFFSERV_MODE, + TCA_CAKE_ATM, + TCA_CAKE_FLOW_MODE, @@ -24,69 +23,108 @@ index 37b5096a..66da5df9 100644 + TCA_CAKE_MPU, + TCA_CAKE_INGRESS, + TCA_CAKE_ACK_FILTER, ++ TCA_CAKE_SPLIT_GSO, + __TCA_CAKE_MAX +}; +#define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1) + -+struct tc_cake_traffic_stats { -+ __u32 packets; -+ __u32 link_ms; -+ __u64 bytes; ++enum { ++ __TCA_CAKE_STATS_INVALID, ++ TCA_CAKE_STATS_PAD, ++ TCA_CAKE_STATS_CAPACITY_ESTIMATE64, ++ TCA_CAKE_STATS_MEMORY_LIMIT, ++ TCA_CAKE_STATS_MEMORY_USED, ++ TCA_CAKE_STATS_AVG_NETOFF, ++ TCA_CAKE_STATS_MIN_NETLEN, ++ TCA_CAKE_STATS_MAX_NETLEN, ++ TCA_CAKE_STATS_MIN_ADJLEN, ++ TCA_CAKE_STATS_MAX_ADJLEN, ++ TCA_CAKE_STATS_TIN_STATS, ++ TCA_CAKE_STATS_DEFICIT, ++ TCA_CAKE_STATS_COBALT_COUNT, ++ TCA_CAKE_STATS_DROPPING, ++ TCA_CAKE_STATS_DROP_NEXT_US, ++ TCA_CAKE_STATS_P_DROP, ++ TCA_CAKE_STATS_BLUE_TIMER_US, ++ __TCA_CAKE_STATS_MAX +}; ++#define TCA_CAKE_STATS_MAX (__TCA_CAKE_STATS_MAX - 1) + ++enum { ++ __TCA_CAKE_TIN_STATS_INVALID, ++ TCA_CAKE_TIN_STATS_PAD, ++ TCA_CAKE_TIN_STATS_SENT_PACKETS, ++ TCA_CAKE_TIN_STATS_SENT_BYTES64, ++ TCA_CAKE_TIN_STATS_DROPPED_PACKETS, ++ TCA_CAKE_TIN_STATS_DROPPED_BYTES64, ++ TCA_CAKE_TIN_STATS_ACKS_DROPPED_PACKETS, ++ TCA_CAKE_TIN_STATS_ACKS_DROPPED_BYTES64, ++ TCA_CAKE_TIN_STATS_ECN_MARKED_PACKETS, ++ TCA_CAKE_TIN_STATS_ECN_MARKED_BYTES64, ++ TCA_CAKE_TIN_STATS_BACKLOG_PACKETS, ++ TCA_CAKE_TIN_STATS_BACKLOG_BYTES, ++ TCA_CAKE_TIN_STATS_THRESHOLD_RATE64, ++ TCA_CAKE_TIN_STATS_TARGET_US, ++ TCA_CAKE_TIN_STATS_INTERVAL_US, ++ TCA_CAKE_TIN_STATS_WAY_INDIRECT_HITS, ++ TCA_CAKE_TIN_STATS_WAY_MISSES, ++ TCA_CAKE_TIN_STATS_WAY_COLLISIONS, ++ TCA_CAKE_TIN_STATS_PEAK_DELAY_US, ++ TCA_CAKE_TIN_STATS_AVG_DELAY_US, ++ TCA_CAKE_TIN_STATS_BASE_DELAY_US, ++ TCA_CAKE_TIN_STATS_SPARSE_FLOWS, ++ TCA_CAKE_TIN_STATS_BULK_FLOWS, ++ TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS, ++ TCA_CAKE_TIN_STATS_MAX_SKBLEN, ++ TCA_CAKE_TIN_STATS_FLOW_QUANTUM, ++ __TCA_CAKE_TIN_STATS_MAX ++}; ++#define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1) +#define TC_CAKE_MAX_TINS (8) -+struct tc_cake_tin_stats { + -+ __u32 threshold_rate; -+ __u32 target_us; -+ struct tc_cake_traffic_stats sent; -+ struct tc_cake_traffic_stats dropped; -+ struct tc_cake_traffic_stats ecn_marked; -+ struct tc_cake_traffic_stats backlog; -+ __u32 interval_us; -+ __u32 way_indirect_hits; -+ __u32 way_misses; -+ __u32 way_collisions; -+ __u32 peak_delay_us; /* ~= bulk flow delay */ -+ __u32 avge_delay_us; -+ __u32 base_delay_us; /* ~= sparse flows delay */ -+ __u16 sparse_flows; -+ __u16 bulk_flows; -+ __u16 unresponse_flows; -+ __u16 spare; -+ __u32 max_skblen; -+ struct tc_cake_traffic_stats ack_drops; ++enum { ++ CAKE_FLOW_NONE = 0, ++ CAKE_FLOW_SRC_IP, ++ CAKE_FLOW_DST_IP, ++ CAKE_FLOW_HOSTS, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_DST_IP */ ++ CAKE_FLOW_FLOWS, ++ CAKE_FLOW_DUAL_SRC, /* = CAKE_FLOW_SRC_IP | CAKE_FLOW_FLOWS */ ++ CAKE_FLOW_DUAL_DST, /* = CAKE_FLOW_DST_IP | CAKE_FLOW_FLOWS */ ++ CAKE_FLOW_TRIPLE, /* = CAKE_FLOW_HOSTS | CAKE_FLOW_FLOWS */ ++ CAKE_FLOW_MAX, +}; + -+struct tc_cake_xstats { -+ __u16 version; -+ __u16 tin_stats_size; /* == sizeof(struct tc_cake_tin_stats) */ -+ __u32 capacity_estimate; -+ __u32 memory_limit; -+ __u32 memory_used; -+ __u8 tin_cnt; -+ __u8 avg_trnoff; -+ __u16 max_trnlen; -+ __u16 max_adjlen; -+ __u16 min_trnlen; -+ __u16 min_adjlen; -+ -+ __u16 spare1; -+ __u32 spare2; -+ -+ struct tc_cake_tin_stats tin_stats[0]; /* keep last */ ++enum { ++ CAKE_DIFFSERV_DIFFSERV3 = 0, ++ CAKE_DIFFSERV_DIFFSERV4, ++ CAKE_DIFFSERV_DIFFSERV8, ++ CAKE_DIFFSERV_BESTEFFORT, ++ CAKE_DIFFSERV_PRECEDENCE, ++ CAKE_DIFFSERV_MAX +}; ++ ++enum { ++ CAKE_ACK_NONE = 0, ++ CAKE_ACK_FILTER, ++ CAKE_ACK_AGGRESSIVE, ++ CAKE_ACK_MAX ++}; ++ ++enum { ++ CAKE_ATM_NONE = 0, ++ CAKE_ATM_ATM, ++ CAKE_ATM_PTM, ++ CAKE_ATM_MAX ++}; ++ + #endif -diff --git a/man/man8/tc-cake.8 b/man/man8/tc-cake.8 -new file mode 100644 -index 00000000..ff77db8f --- /dev/null +++ b/man/man8/tc-cake.8 -@@ -0,0 +1,678 @@ -+.TH CAKE 8 "23 November 2017" "iproute2" "Linux" +@@ -0,0 +1,632 @@ ++.TH CAKE 8 "19 July 2018" "iproute2" "Linux" +.SH NAME -+CAKE \- COMMON Applications Kept Enhanced (CAKE) ++CAKE \- Common Applications Kept Enhanced (CAKE) +.SH SYNOPSIS +.B tc qdisc ... cake +.br @@ -95,7 +133,7 @@ index 00000000..ff77db8f +RATE | +.BR unlimited* +| -+.BR autorate_ingress ++.BR autorate-ingress +] +.br +[ @@ -125,8 +163,6 @@ index 00000000..ff77db8f +| +.BR diffserv4 +| -+.BR diffserv-llt -+| +.BR diffserv3* +] +.br @@ -237,7 +273,7 @@ index 00000000..ff77db8f +.BR tc(8) +or examples below for details of the RATE value. +.PP -+.B autorate_ingress ++.B autorate-ingress +.br + Automatic capacity estimation based on traffic arriving at this qdisc. +This is most likely to be useful with cellular links, which tend to change @@ -486,7 +522,7 @@ index 00000000..ff77db8f +.br + So named because Jupiter is about 1 light-hour from Earth. Use this to +(almost) completely disable AQM actions. Equivalent to -+.B rtt 1000s. ++.B rtt 3600s. + +.SH FLOW ISOLATION PARAMETERS +With flow isolation enabled, CAKE places packets from different flows into @@ -583,20 +619,6 @@ index 00000000..ff77db8f + Enables legacy interpretation of TOS "Precedence" field. Use of this +preset on the modern Internet is firmly discouraged. +.PP -+.B diffserv-llt -+.br -+ Provides a "Latency-Loss Tradeoff" implementation with five tins: -+.br -+ Low Loss (TOS1, TOS2), 100% threshold, increased Codel target. -+.br -+ Best Effort (general), 100% threshold, normal Codel target & interval. -+.br -+ Low Latency (TOS4, TOS5, VA, EF), 100% threshold, reduced Codel interval. -+.br -+ Bulk (CS1), 6.25% threshold, normal Codel target & interval. -+.br -+ Net Control (CS6, CS7), 6.25% threshold, increased Codel target & interval. -+.PP +.B diffserv4 +.br + Provides a general-purpose Diffserv implementation with four tins: @@ -651,109 +673,79 @@ index 00000000..ff77db8f +.SH EXAMPLES +# tc qdisc delete root dev eth0 +.br -+# tc qdisc add root dev eth0 cake bandwidth 9500Kbit pppoe-ptm ether-vlan ++# tc qdisc add root dev eth0 cake bandwidth 100Mbit ethernet +.br +# tc -s qdisc show dev eth0 +.br -+qdisc cake 8007: root refcnt 6 bandwidth 9500Kbit diffserv3 triple-isolate rtt 100.0ms ptm overhead 34 via-ethernet total_overhead 34 hard_header_len 14 ++qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple-isolate rtt 100.0ms noatm overhead 38 mpu 84 + Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) + backlog 0b 0p requeues 0 -+ memory used: 0b of 4Mb -+ capacity estimate: 9500Kbit -+.br -+ Bulk Best Effort Voice -+.br -+ thresh 593744bit 9500Kbit 2375Kbit -+.br -+ target 30.6ms 5.0ms 7.6ms -+.br -+ interval 125.6ms 100.0ms 102.6ms -+.br -+ pk_delay 0us 0us 0us -+.br -+ av_delay 0us 0us 0us -+.br -+ sp_delay 0us 0us 0us -+.br -+ pkts 0 0 0 -+.br -+ bytes 0 0 0 -+.br -+ way_inds 0 0 0 -+.br -+ way_miss 0 0 0 -+.br -+ way_cols 0 0 0 -+.br -+ drops 0 0 0 -+.br -+ marks 0 0 0 -+.br -+ ack_drop 0 0 0 -+.br -+ sp_flows 0 0 0 -+.br -+ bk_flows 0 0 0 -+.br -+ un_flows 0 0 0 -+.br -+ max_len 0 0 0 -+.br ++ memory used: 0b of 5000000b ++ capacity estimate: 100Mbit ++ min/max network layer size: 65535 / 0 ++ min/max overhead-adjusted size: 65535 / 0 ++ average network hdr offset: 0 ++ ++ Bulk Best Effort Voice ++ thresh 6250Kbit 100Mbit 25Mbit ++ target 5.0ms 5.0ms 5.0ms ++ interval 100.0ms 100.0ms 100.0ms ++ pk_delay 0us 0us 0us ++ av_delay 0us 0us 0us ++ sp_delay 0us 0us 0us ++ pkts 0 0 0 ++ bytes 0 0 0 ++ way_inds 0 0 0 ++ way_miss 0 0 0 ++ way_cols 0 0 0 ++ drops 0 0 0 ++ marks 0 0 0 ++ ack_drop 0 0 0 ++ sp_flows 0 0 0 ++ bk_flows 0 0 0 ++ un_flows 0 0 0 ++ max_len 0 0 0 ++ quantum 300 1514 762 + +After some use: +.br +# tc -s qdisc show dev eth0 + -+qdisc cake 8007: root refcnt 6 bandwidth 9500Kbit diffserv3 triple-isolate rtt 100.0ms ptm overhead 34 via-ethernet total_overhead 34 hard_header_len 14 -+ Sent 110769306 bytes 313857 pkt (dropped 18, overlimits 741791 requeues 0) -+ backlog 0b 0p requeues 0 -+ memory used: 110488b of 4Mb -+ capacity estimate: 9500Kbit -+.br -+ Bulk Best Effort Voice -+.br -+ thresh 593744bit 9500Kbit 2375Kbit -+.br -+ target 30.6ms 5.0ms 7.6ms -+.br -+ interval 125.6ms 100.0ms 102.6ms -+.br -+ pk_delay 16.0ms 545us 15us -+.br -+ av_delay 2.4ms 161us 3us -+.br -+ sp_delay 59us 1us 1us -+.br -+ pkts 32866 195815 85194 -+.br -+ bytes 8132614 69517496 33122156 -+.br -+ way_inds 0 29208 0 -+.br -+ way_miss 7 173 17 -+.br -+ way_cols 0 0 0 -+.br -+ drops 10 7 1 -+.br -+ marks 217 692 300 -+.br -+ ack_drop 0 0 0 -+.br -+ sp_flows 0 0 0 -+.br -+ bk_flows 0 0 1 -+.br -+ un_flows 0 0 0 -+.br -+ max_len 3028 3012 3028 -+.br ++qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple-isolate rtt 100.0ms noatm overhead 38 mpu 84 ++ Sent 44709231 bytes 31931 pkt (dropped 45, overlimits 93782 requeues 0) ++ backlog 33308b 22p requeues 0 ++ memory used: 292352b of 5000000b ++ capacity estimate: 100Mbit ++ min/max network layer size: 28 / 1500 ++ min/max overhead-adjusted size: 84 / 1538 ++ average network hdr offset: 14 ++ ++ Bulk Best Effort Voice ++ thresh 6250Kbit 100Mbit 25Mbit ++ target 5.0ms 5.0ms 5.0ms ++ interval 100.0ms 100.0ms 100.0ms ++ pk_delay 8.7ms 6.9ms 5.0ms ++ av_delay 4.9ms 5.3ms 3.8ms ++ sp_delay 727us 1.4ms 511us ++ pkts 2590 21271 8137 ++ bytes 3081804 30302659 11426206 ++ way_inds 0 46 0 ++ way_miss 3 17 4 ++ way_cols 0 0 0 ++ drops 20 15 10 ++ marks 0 0 0 ++ ack_drop 0 0 0 ++ sp_flows 2 4 1 ++ bk_flows 1 2 1 ++ un_flows 0 0 0 ++ max_len 1514 1514 1514 ++ quantum 300 1514 762 + +.SH SEE ALSO +.BR tc (8), +.BR tc-codel (8), +.BR tc-fq_codel (8), -+.BR tc-red (8) ++.BR tc-htb (8) + +.SH AUTHORS +Cake's principal author is Jonathan Morton, with contributions from @@ -762,61 +754,36 @@ index 00000000..ff77db8f + +This manual page was written by Loganaden Velvindron. Please report corrections +to the Linux Networking mailing list . -diff --git a/tc/Makefile b/tc/Makefile -index 3716dd6a..69f50a6b 100644 +--- a/man/man8/tc.8 ++++ b/man/man8/tc.8 +@@ -776,6 +776,7 @@ was written by Alexey N. Kuznetsov and a + .BR tc-basic (8), + .BR tc-bfifo (8), + .BR tc-bpf (8), ++.BR tc-cake (8), + .BR tc-cbq (8), + .BR tc-cgroup (8), + .BR tc-choke (8), --- a/tc/Makefile +++ b/tc/Makefile -@@ -64,6 +64,7 @@ TCMODULES += em_meta.o - TCMODULES += q_mqprio.o - TCMODULES += q_codel.o +@@ -66,6 +66,7 @@ TCMODULES += q_codel.o TCMODULES += q_fq_codel.o -+TCMODULES += q_cake.o TCMODULES += q_fq.o TCMODULES += q_pie.o ++TCMODULES += q_cake.o TCMODULES += q_hhf.o -diff --git a/tc/q_cake.c b/tc/q_cake.c -new file mode 100644 -index 00000000..44cadb63 + TCMODULES += q_clsact.o + TCMODULES += e_bpf.o --- /dev/null +++ b/tc/q_cake.c -@@ -0,0 +1,770 @@ -+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ +@@ -0,0 +1,790 @@ ++// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause ++ +/* + * Common Applications Kept Enhanced -- CAKE + * + * Copyright (C) 2014-2018 Jonathan Morton + * Copyright (C) 2017-2018 Toke Høiland-Jørgensen -+ * -+ * 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, -+ * without modification. -+ * 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. -+ * 3. The names of the authors may not be used to endorse or promote products -+ * derived from this software without specific prior written permission. -+ * -+ * Alternatively, provided that this notice is retained in full, this -+ * software may be distributed under the terms of the GNU General -+ * Public License ("GPL") version 2, in which case the provisions of the -+ * GPL apply INSTEAD OF those given above. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT -+ * OWNER 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 @@ -829,18 +796,64 @@ index 00000000..44cadb63 +#include +#include +#include ++#include + +#include "utils.h" +#include "tc_util.h" + ++struct cake_preset { ++ char *name; ++ unsigned int target; ++ unsigned int interval; ++}; ++ ++static struct cake_preset presets[] = { ++ {"datacentre", 5, 100}, ++ {"lan", 50, 1000}, ++ {"metro", 500, 10000}, ++ {"regional", 1500, 30000}, ++ {"internet", 5000, 100000}, ++ {"oceanic", 15000, 300000}, ++ {"satellite", 50000, 1000000}, ++ {"interplanetary", 50000000, 1000000000}, ++}; ++ ++static const char * diffserv_names[CAKE_DIFFSERV_MAX] = { ++ [CAKE_DIFFSERV_DIFFSERV3] = "diffserv3", ++ [CAKE_DIFFSERV_DIFFSERV4] = "diffserv4", ++ [CAKE_DIFFSERV_DIFFSERV8] = "diffserv8", ++ [CAKE_DIFFSERV_BESTEFFORT] = "besteffort", ++ [CAKE_DIFFSERV_PRECEDENCE] = "precedence", ++}; ++ ++static const char * flowmode_names[CAKE_FLOW_MAX] = { ++ [CAKE_FLOW_NONE] = "flowblind", ++ [CAKE_FLOW_SRC_IP] = "srchost", ++ [CAKE_FLOW_DST_IP] = "dsthost", ++ [CAKE_FLOW_HOSTS] = "hosts", ++ [CAKE_FLOW_FLOWS] = "flows", ++ [CAKE_FLOW_DUAL_SRC] = "dual-srchost", ++ [CAKE_FLOW_DUAL_DST] = "dual-dsthost", ++ [CAKE_FLOW_TRIPLE] = "triple-isolate", ++}; ++ ++static struct cake_preset *find_preset(char *argv) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(presets); i++) ++ if (!strcmp(argv, presets[i].name)) ++ return &presets[i]; ++ return NULL; ++} ++ +static void explain(void) +{ + fprintf(stderr, -+"Usage: ... cake [ bandwidth RATE | unlimited* | autorate_ingress ]\n" ++"Usage: ... cake [ bandwidth RATE | unlimited* | autorate-ingress ]\n" +" [ rtt TIME | datacentre | lan | metro | regional |\n" +" internet* | oceanic | satellite | interplanetary ]\n" -+" [ besteffort | diffserv8 | diffserv4 | diffserv-llt |\n" -+" diffserv3* ]\n" ++" [ besteffort | diffserv8 | diffserv4 | diffserv3* ]\n" +" [ flowblind | srchost | dsthost | hosts | flows |\n" +" dual-srchost | dual-dsthost | triple-isolate* ]\n" +" [ nat | nonat* ]\n" @@ -855,29 +868,30 @@ index 00000000..44cadb63 +static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv, + struct nlmsghdr *n, const char *dev) +{ -+ int unlimited = 0; -+ unsigned bandwidth = 0; -+ unsigned interval = 0; -+ unsigned target = 0; -+ unsigned diffserv = 0; -+ unsigned memlimit = 0; -+ int overhead = 0; -+ bool overhead_set = false; ++ struct cake_preset *preset, *preset_set = NULL; + bool overhead_override = false; -+ int mpu = 0; -+ int flowmode = -1; -+ int nat = -1; -+ int atm = -1; -+ int autorate = -1; -+ int wash = -1; -+ int ingress = -1; ++ bool overhead_set = false; ++ unsigned int interval = 0; ++ unsigned int diffserv = 0; ++ unsigned int memlimit = 0; ++ unsigned int target = 0; ++ __u64 bandwidth = 0; + int ack_filter = -1; + struct rtattr *tail; ++ int unlimited = 0; ++ int flowmode = -1; ++ int autorate = -1; ++ int ingress = -1; ++ int overhead = 0; ++ int wash = -1; ++ int nat = -1; ++ int atm = -1; ++ int mpu = 0; + + while (argc > 0) { + if (strcmp(*argv, "bandwidth") == 0) { + NEXT_ARG(); -+ if (get_rate(&bandwidth, *argv)) { ++ if (get_rate64(&bandwidth, *argv)) { + fprintf(stderr, "Illegal \"bandwidth\"\n"); + return -1; + } @@ -887,9 +901,8 @@ index 00000000..44cadb63 + bandwidth = 0; + unlimited = 1; + autorate = 0; -+ } else if (strcmp(*argv, "autorate_ingress") == 0) { ++ } else if (strcmp(*argv, "autorate-ingress") == 0) { + autorate = 1; -+ + } else if (strcmp(*argv, "rtt") == 0) { + NEXT_ARG(); + if (get_time(&interval, *argv)) { @@ -897,84 +910,58 @@ index 00000000..44cadb63 + return -1; + } + target = interval / 20; -+ if(!target) ++ if (!target) + target = 1; -+ } else if (strcmp(*argv, "datacentre") == 0) { -+ interval = 100; -+ target = 5; -+ } else if (strcmp(*argv, "lan") == 0) { -+ interval = 1000; -+ target = 50; -+ } else if (strcmp(*argv, "metro") == 0) { -+ interval = 10000; -+ target = 500; -+ } else if (strcmp(*argv, "regional") == 0) { -+ interval = 30000; -+ target = 1500; -+ } else if (strcmp(*argv, "internet") == 0) { -+ interval = 100000; -+ target = 5000; -+ } else if (strcmp(*argv, "oceanic") == 0) { -+ interval = 300000; -+ target = 15000; -+ } else if (strcmp(*argv, "satellite") == 0) { -+ interval = 1000000; -+ target = 50000; -+ } else if (strcmp(*argv, "interplanetary") == 0) { -+ interval = 1000000000; -+ target = 50000000; -+ ++ } else if ((preset = find_preset(*argv))) { ++ if (preset_set) ++ duparg(*argv, preset_set->name); ++ preset_set = preset; ++ target = preset->target; ++ interval = preset->interval; + } else if (strcmp(*argv, "besteffort") == 0) { -+ diffserv = 1; ++ diffserv = CAKE_DIFFSERV_BESTEFFORT; + } else if (strcmp(*argv, "precedence") == 0) { -+ diffserv = 2; ++ diffserv = CAKE_DIFFSERV_PRECEDENCE; + } else if (strcmp(*argv, "diffserv8") == 0) { -+ diffserv = 3; ++ diffserv = CAKE_DIFFSERV_DIFFSERV8; + } else if (strcmp(*argv, "diffserv4") == 0) { -+ diffserv = 4; ++ diffserv = CAKE_DIFFSERV_DIFFSERV4; + } else if (strcmp(*argv, "diffserv") == 0) { -+ diffserv = 4; -+ } else if (strcmp(*argv, "diffserv-llt") == 0) { -+ diffserv = 5; ++ diffserv = CAKE_DIFFSERV_DIFFSERV4; + } else if (strcmp(*argv, "diffserv3") == 0) { -+ diffserv = 6; -+ ++ diffserv = CAKE_DIFFSERV_DIFFSERV3; + } else if (strcmp(*argv, "nowash") == 0) { + wash = 0; + } else if (strcmp(*argv, "wash") == 0) { + wash = 1; -+ + } else if (strcmp(*argv, "flowblind") == 0) { -+ flowmode = 0; ++ flowmode = CAKE_FLOW_NONE; + } else if (strcmp(*argv, "srchost") == 0) { -+ flowmode = 1; ++ flowmode = CAKE_FLOW_SRC_IP; + } else if (strcmp(*argv, "dsthost") == 0) { -+ flowmode = 2; ++ flowmode = CAKE_FLOW_DST_IP; + } else if (strcmp(*argv, "hosts") == 0) { -+ flowmode = 3; ++ flowmode = CAKE_FLOW_HOSTS; + } else if (strcmp(*argv, "flows") == 0) { -+ flowmode = 4; ++ flowmode = CAKE_FLOW_FLOWS; + } else if (strcmp(*argv, "dual-srchost") == 0) { -+ flowmode = 5; ++ flowmode = CAKE_FLOW_DUAL_SRC; + } else if (strcmp(*argv, "dual-dsthost") == 0) { -+ flowmode = 6; ++ flowmode = CAKE_FLOW_DUAL_DST; + } else if (strcmp(*argv, "triple-isolate") == 0) { -+ flowmode = 7; -+ ++ flowmode = CAKE_FLOW_TRIPLE; + } else if (strcmp(*argv, "nat") == 0) { + nat = 1; + } else if (strcmp(*argv, "nonat") == 0) { + nat = 0; -+ + } else if (strcmp(*argv, "ptm") == 0) { -+ atm = 2; ++ atm = CAKE_ATM_PTM; + } else if (strcmp(*argv, "atm") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + } else if (strcmp(*argv, "noatm") == 0) { -+ atm = 0; -+ ++ atm = CAKE_ATM_NONE; + } else if (strcmp(*argv, "raw") == 0) { -+ atm = 0; ++ atm = CAKE_ATM_NONE; + overhead = 0; + overhead_set = true; + overhead_override = true; @@ -984,41 +971,41 @@ index 00000000..44cadb63 + * one whole ATM cell plus ATM framing. + * A safe choice if the actual overhead is unknown. + */ -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead = 48; + overhead_set = true; + + /* Various ADSL framing schemes, all over ATM cells */ + } else if (strcmp(*argv, "ipoa-vcmux") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead += 8; + overhead_set = true; + } else if (strcmp(*argv, "ipoa-llcsnap") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead += 16; + overhead_set = true; + } else if (strcmp(*argv, "bridged-vcmux") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead += 24; + overhead_set = true; + } else if (strcmp(*argv, "bridged-llcsnap") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead += 32; + overhead_set = true; + } else if (strcmp(*argv, "pppoa-vcmux") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead += 10; + overhead_set = true; + } else if (strcmp(*argv, "pppoa-llc") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead += 14; + overhead_set = true; + } else if (strcmp(*argv, "pppoe-vcmux") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead += 32; + overhead_set = true; + } else if (strcmp(*argv, "pppoe-llcsnap") == 0) { -+ atm = 1; ++ atm = CAKE_ATM_ATM; + overhead += 40; + overhead_set = true; + @@ -1030,7 +1017,7 @@ index 00000000..44cadb63 + * + 1B Start of Frame (S) + 1B End of Frame (Ck) + * + 2B TC-CRC (PTM-FCS) = 30B + */ -+ atm = 2; ++ atm = CAKE_ATM_PTM; + overhead += 30; + overhead_set = true; + } else if (strcmp(*argv, "bridged-ptm") == 0) { @@ -1039,10 +1026,9 @@ index 00000000..44cadb63 + * + 1B Start of Frame (S) + 1B End of Frame (Ck) + * + 2B TC-CRC (PTM-FCS) = 22B + */ -+ atm = 2; ++ atm = CAKE_ATM_PTM; + overhead += 22; + overhead_set = true; -+ + } else if (strcmp(*argv, "via-ethernet") == 0) { + /* + * We used to use this flag to manually compensate for @@ -1056,10 +1042,10 @@ index 00000000..44cadb63 + * stats output when the automatic compensation is + * active. + */ -+ + } else if (strcmp(*argv, "ethernet") == 0) { + /* ethernet pre-amble & interframe gap & FCS -+ * you may need to add vlan tag */ ++ * you may need to add vlan tag ++ */ + overhead += 38; + overhead_set = true; + mpu = 84; @@ -1075,49 +1061,50 @@ index 00000000..44cadb63 + * but not interframe gap or preamble. + */ + } else if (strcmp(*argv, "docsis") == 0) { -+ atm = 0; ++ atm = CAKE_ATM_NONE; + overhead += 18; + overhead_set = true; + mpu = 64; -+ + } else if (strcmp(*argv, "overhead") == 0) { -+ char* p = NULL; ++ char *p = NULL; ++ + NEXT_ARG(); + overhead = strtol(*argv, &p, 10); -+ if(!p || *p || !*argv || overhead < -64 || overhead > 256) { -+ fprintf(stderr, "Illegal \"overhead\", valid range is -64 to 256\\n"); ++ if (!p || *p || !*argv || ++ overhead < -64 || overhead > 256) { ++ fprintf(stderr, ++ "Illegal \"overhead\", valid range is -64 to 256\\n"); + return -1; + } + overhead_set = true; + + } else if (strcmp(*argv, "mpu") == 0) { -+ char* p = NULL; ++ char *p = NULL; ++ + NEXT_ARG(); + mpu = strtol(*argv, &p, 10); -+ if(!p || *p || !*argv || mpu < 0 || mpu > 256) { -+ fprintf(stderr, "Illegal \"mpu\", valid range is 0 to 256\\n"); ++ if (!p || *p || !*argv || mpu < 0 || mpu > 256) { ++ fprintf(stderr, ++ "Illegal \"mpu\", valid range is 0 to 256\\n"); + return -1; + } -+ + } else if (strcmp(*argv, "ingress") == 0) { + ingress = 1; + } else if (strcmp(*argv, "egress") == 0) { + ingress = 0; -+ + } else if (strcmp(*argv, "no-ack-filter") == 0) { -+ ack_filter = 0; ++ ack_filter = CAKE_ACK_NONE; + } else if (strcmp(*argv, "ack-filter") == 0) { -+ ack_filter = 0x0200; ++ ack_filter = CAKE_ACK_FILTER; + } else if (strcmp(*argv, "ack-filter-aggressive") == 0) { -+ ack_filter = 0x0600; -+ ++ ack_filter = CAKE_ACK_AGGRESSIVE; + } else if (strcmp(*argv, "memlimit") == 0) { + NEXT_ARG(); -+ if(get_size(&memlimit, *argv)) { -+ fprintf(stderr, "Illegal value for \"memlimit\": \"%s\"\n", *argv); ++ if (get_size(&memlimit, *argv)) { ++ fprintf(stderr, ++ "Illegal value for \"memlimit\": \"%s\"\n", *argv); + return -1; + } -+ + } else if (strcmp(*argv, "help") == 0) { + explain(); + return -1; @@ -1132,17 +1119,22 @@ index 00000000..44cadb63 + tail = NLMSG_TAIL(n); + addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); + if (bandwidth || unlimited) -+ addattr_l(n, 1024, TCA_CAKE_BASE_RATE, &bandwidth, sizeof(bandwidth)); ++ addattr_l(n, 1024, TCA_CAKE_BASE_RATE64, &bandwidth, ++ sizeof(bandwidth)); + if (diffserv) -+ addattr_l(n, 1024, TCA_CAKE_DIFFSERV_MODE, &diffserv, sizeof(diffserv)); ++ addattr_l(n, 1024, TCA_CAKE_DIFFSERV_MODE, &diffserv, ++ sizeof(diffserv)); + if (atm != -1) + addattr_l(n, 1024, TCA_CAKE_ATM, &atm, sizeof(atm)); + if (flowmode != -1) -+ addattr_l(n, 1024, TCA_CAKE_FLOW_MODE, &flowmode, sizeof(flowmode)); ++ addattr_l(n, 1024, TCA_CAKE_FLOW_MODE, &flowmode, ++ sizeof(flowmode)); + if (overhead_set) -+ addattr_l(n, 1024, TCA_CAKE_OVERHEAD, &overhead, sizeof(overhead)); ++ addattr_l(n, 1024, TCA_CAKE_OVERHEAD, &overhead, ++ sizeof(overhead)); + if (overhead_override) { -+ unsigned zero = 0; ++ unsigned int zero = 0; ++ + addattr_l(n, 1024, TCA_CAKE_RAW, &zero, sizeof(zero)); + } + if (mpu > 0) @@ -1152,9 +1144,11 @@ index 00000000..44cadb63 + if (target) + addattr_l(n, 1024, TCA_CAKE_TARGET, &target, sizeof(target)); + if (autorate != -1) -+ addattr_l(n, 1024, TCA_CAKE_AUTORATE, &autorate, sizeof(autorate)); ++ addattr_l(n, 1024, TCA_CAKE_AUTORATE, &autorate, ++ sizeof(autorate)); + if (memlimit) -+ addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit, sizeof(memlimit)); ++ 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) @@ -1162,30 +1156,41 @@ index 00000000..44cadb63 + if (ingress != -1) + addattr_l(n, 1024, TCA_CAKE_INGRESS, &ingress, sizeof(ingress)); + if (ack_filter != -1) -+ addattr_l(n, 1024, TCA_CAKE_ACK_FILTER, &ack_filter, sizeof(ack_filter)); ++ addattr_l(n, 1024, TCA_CAKE_ACK_FILTER, &ack_filter, ++ sizeof(ack_filter)); + + tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; + return 0; +} + ++static void cake_print_mode(unsigned int value, unsigned int max, ++ const char *key, const char **table) ++{ ++ if (value < max && table[value]) { ++ print_string(PRINT_ANY, key, "%s ", table[value]); ++ } else { ++ print_string(PRINT_JSON, key, NULL, "unknown"); ++ print_string(PRINT_FP, NULL, "(?%s?)", key); ++ } ++} + +static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_CAKE_MAX + 1]; -+ unsigned bandwidth = 0; -+ unsigned diffserv = 0; -+ unsigned flowmode = 0; -+ unsigned interval = 0; -+ unsigned memlimit = 0; ++ unsigned int interval = 0; ++ unsigned int memlimit = 0; ++ __u64 bandwidth = 0; ++ int ack_filter = 0; ++ int split_gso = 0; + int overhead = 0; ++ int autorate = 0; ++ int ingress = 0; ++ int wash = 0; + int raw = 0; + int mpu = 0; + int atm = 0; + int nat = 0; -+ int autorate = 0; -+ int wash = 0; -+ int ingress = 0; -+ int ack_filter = 0; ++ + SPRINT_BUF(b1); + SPRINT_BUF(b2); + @@ -1194,89 +1199,47 @@ index 00000000..44cadb63 + + parse_rtattr_nested(tb, TCA_CAKE_MAX, opt); + -+ if (tb[TCA_CAKE_BASE_RATE] && -+ RTA_PAYLOAD(tb[TCA_CAKE_BASE_RATE]) >= sizeof(__u32)) { -+ bandwidth = rta_getattr_u32(tb[TCA_CAKE_BASE_RATE]); -+ if(bandwidth) { ++ if (tb[TCA_CAKE_BASE_RATE64] && ++ RTA_PAYLOAD(tb[TCA_CAKE_BASE_RATE64]) >= sizeof(bandwidth)) { ++ bandwidth = rta_getattr_u64(tb[TCA_CAKE_BASE_RATE64]); ++ if (bandwidth) { + print_uint(PRINT_JSON, "bandwidth", NULL, bandwidth); -+ print_string(PRINT_FP, NULL, "bandwidth %s ", sprint_rate(bandwidth, b1)); ++ print_string(PRINT_FP, NULL, "bandwidth %s ", ++ sprint_rate(bandwidth, b1)); + } else -+ print_string(PRINT_ANY, "bandwidth", "bandwidth %s ", "unlimited"); ++ print_string(PRINT_ANY, "bandwidth", "bandwidth %s ", ++ "unlimited"); + } + if (tb[TCA_CAKE_AUTORATE] && + RTA_PAYLOAD(tb[TCA_CAKE_AUTORATE]) >= sizeof(__u32)) { + autorate = rta_getattr_u32(tb[TCA_CAKE_AUTORATE]); -+ if(autorate == 1) -+ print_string(PRINT_ANY, "autorate", "autorate_%s ", "ingress"); -+ else if(autorate) -+ print_string(PRINT_ANY, "autorate", "(?autorate?) ", "unknown"); ++ if (autorate == 1) ++ print_string(PRINT_ANY, "autorate", "%s ", ++ "autorate-ingress"); ++ else if (autorate) ++ print_string(PRINT_ANY, "autorate", "(?autorate?) ", ++ "unknown"); + } + if (tb[TCA_CAKE_DIFFSERV_MODE] && + RTA_PAYLOAD(tb[TCA_CAKE_DIFFSERV_MODE]) >= sizeof(__u32)) { -+ diffserv = rta_getattr_u32(tb[TCA_CAKE_DIFFSERV_MODE]); -+ switch(diffserv) { -+ case 1: -+ print_string(PRINT_ANY, "diffserv", "%s ", "besteffort"); -+ break; -+ case 2: -+ print_string(PRINT_ANY, "diffserv", "%s ", "precedence"); -+ break; -+ case 3: -+ print_string(PRINT_ANY, "diffserv", "%s ", "diffserv8"); -+ break; -+ case 4: -+ print_string(PRINT_ANY, "diffserv", "%s ", "diffserv4"); -+ break; -+ case 5: -+ print_string(PRINT_ANY, "diffserv", "%s ", "diffserv-llt"); -+ break; -+ case 6: -+ print_string(PRINT_ANY, "diffserv", "%s ", "diffserv3"); -+ break; -+ default: -+ print_string(PRINT_ANY, "diffserv", "(?diffserv?) ", "unknown"); -+ break; -+ }; ++ cake_print_mode(rta_getattr_u32(tb[TCA_CAKE_DIFFSERV_MODE]), ++ CAKE_DIFFSERV_MAX, "diffserv", diffserv_names); + } + if (tb[TCA_CAKE_FLOW_MODE] && + RTA_PAYLOAD(tb[TCA_CAKE_FLOW_MODE]) >= sizeof(__u32)) { -+ flowmode = rta_getattr_u32(tb[TCA_CAKE_FLOW_MODE]); -+ nat = !!(flowmode & 64); -+ flowmode &= ~64; -+ switch(flowmode) { -+ case 0: -+ print_string(PRINT_ANY, "flowmode", "%s ", "flowblind"); -+ break; -+ case 1: -+ print_string(PRINT_ANY, "flowmode", "%s ", "srchost"); -+ break; -+ case 2: -+ print_string(PRINT_ANY, "flowmode", "%s ", "dsthost"); -+ break; -+ case 3: -+ print_string(PRINT_ANY, "flowmode", "%s ", "hosts"); -+ break; -+ case 4: -+ print_string(PRINT_ANY, "flowmode", "%s ", "flows"); -+ break; -+ case 5: -+ print_string(PRINT_ANY, "flowmode", "%s ", "dual-srchost"); -+ break; -+ case 6: -+ print_string(PRINT_ANY, "flowmode", "%s ", "dual-dsthost"); -+ break; -+ case 7: -+ print_string(PRINT_ANY, "flowmode", "%s ", "triple-isolate"); -+ break; -+ default: -+ print_string(PRINT_ANY, "flowmode", "(?flowmode?) ", "unknown"); -+ break; -+ }; -+ -+ if(nat) -+ print_string(PRINT_FP, NULL, "nat ", NULL); -+ print_bool(PRINT_JSON, "nat", NULL, nat); ++ cake_print_mode(rta_getattr_u32(tb[TCA_CAKE_FLOW_MODE]), ++ CAKE_FLOW_MAX, "flowmode", flowmode_names); + } ++ ++ if (tb[TCA_CAKE_NAT] && ++ RTA_PAYLOAD(tb[TCA_CAKE_NAT]) >= sizeof(__u32)) { ++ nat = rta_getattr_u32(tb[TCA_CAKE_NAT]); ++ } ++ ++ if (nat) ++ print_string(PRINT_FP, NULL, "nat ", NULL); ++ print_bool(PRINT_JSON, "nat", NULL, nat); ++ + if (tb[TCA_CAKE_WASH] && + RTA_PAYLOAD(tb[TCA_CAKE_WASH]) >= sizeof(__u32)) { + wash = rta_getattr_u32(tb[TCA_CAKE_WASH]); @@ -1286,8 +1249,8 @@ index 00000000..44cadb63 + atm = rta_getattr_u32(tb[TCA_CAKE_ATM]); + } + if (tb[TCA_CAKE_OVERHEAD] && -+ RTA_PAYLOAD(tb[TCA_CAKE_OVERHEAD]) >= sizeof(__u32)) { -+ overhead = rta_getattr_u32(tb[TCA_CAKE_OVERHEAD]); ++ RTA_PAYLOAD(tb[TCA_CAKE_OVERHEAD]) >= sizeof(__s32)) { ++ overhead = *(__s32 *) RTA_DATA(tb[TCA_CAKE_OVERHEAD]); + } + if (tb[TCA_CAKE_MPU] && + RTA_PAYLOAD(tb[TCA_CAKE_MPU]) >= sizeof(__u32)) { @@ -1301,6 +1264,10 @@ index 00000000..44cadb63 + RTA_PAYLOAD(tb[TCA_CAKE_ACK_FILTER]) >= sizeof(__u32)) { + ack_filter = rta_getattr_u32(tb[TCA_CAKE_ACK_FILTER]); + } ++ if (tb[TCA_CAKE_SPLIT_GSO] && ++ RTA_PAYLOAD(tb[TCA_CAKE_SPLIT_GSO]) >= sizeof(__u32)) { ++ split_gso = rta_getattr_u32(tb[TCA_CAKE_SPLIT_GSO]); ++ } + if (tb[TCA_CAKE_RAW]) { + raw = 1; + } @@ -1317,230 +1284,280 @@ index 00000000..44cadb63 + print_string(PRINT_FP, NULL, "ingress ", NULL); + print_bool(PRINT_JSON, "ingress", NULL, ingress); + -+ if (ack_filter == 0x0600) -+ print_string(PRINT_ANY, "ack-filter", "ack-filter-%s ", "aggressive"); -+ else if (ack_filter) ++ if (ack_filter == CAKE_ACK_AGGRESSIVE) ++ print_string(PRINT_ANY, "ack-filter", "ack-filter-%s ", ++ "aggressive"); ++ else if (ack_filter == CAKE_ACK_FILTER) + print_string(PRINT_ANY, "ack-filter", "ack-filter ", "enabled"); + else + print_string(PRINT_JSON, "ack-filter", NULL, "disabled"); + ++ if (split_gso) ++ print_string(PRINT_FP, NULL, "split-gso ", NULL); ++ print_bool(PRINT_JSON, "split_gso", NULL, split_gso); ++ + if (interval) -+ print_string(PRINT_FP, NULL, "rtt %s ", sprint_time(interval, b2)); ++ print_string(PRINT_FP, NULL, "rtt %s ", ++ sprint_time(interval, b2)); + print_uint(PRINT_JSON, "rtt", NULL, interval); + + if (raw) + print_string(PRINT_FP, NULL, "raw ", NULL); + print_bool(PRINT_JSON, "raw", NULL, raw); + -+ if (atm == 1) ++ if (atm == CAKE_ATM_ATM) + print_string(PRINT_ANY, "atm", "%s ", "atm"); -+ else if (atm == 2) ++ else if (atm == CAKE_ATM_PTM) + print_string(PRINT_ANY, "atm", "%s ", "ptm"); + else if (!raw) + print_string(PRINT_ANY, "atm", "%s ", "noatm"); + -+ print_uint(PRINT_ANY, "overhead", "overhead %d ", overhead); ++ print_int(PRINT_ANY, "overhead", "overhead %d ", overhead); + + if (mpu) -+ print_uint(PRINT_ANY, "mpu", "mpu %d ", mpu); ++ print_uint(PRINT_ANY, "mpu", "mpu %u ", mpu); + + if (memlimit) { + print_uint(PRINT_JSON, "memlimit", NULL, memlimit); -+ print_string(PRINT_FP, NULL, "memlimit %s", sprint_size(memlimit, b1)); ++ print_string(PRINT_FP, NULL, "memlimit %s", ++ sprint_size(memlimit, b1)); + } + + return 0; +} + -+#define FOR_EACH_TIN(xstats, tst, i) \ -+ for(tst = xstats->tin_stats, i = 0; \ -+ i < xstats->tin_cnt; \ -+ i++, tst = ((void *) xstats->tin_stats) + xstats->tin_stats_size * i) -+ -+static void cake_print_json_tin(struct tc_cake_tin_stats *tst) ++static void cake_print_json_tin(struct rtattr **tstat) +{ ++#define PRINT_TSTAT_JSON(type, name, attr) if (tstat[TCA_CAKE_TIN_STATS_ ## attr]) \ ++ print_u64(PRINT_JSON, name, NULL, \ ++ rta_getattr_ ## type((struct rtattr *) \ ++ tstat[TCA_CAKE_TIN_STATS_ ## attr])) ++ + open_json_object(NULL); -+ print_uint(PRINT_JSON, "threshold_rate", NULL, tst->threshold_rate); -+ print_uint(PRINT_JSON, "target", NULL, tst->target_us); -+ print_uint(PRINT_JSON, "interval", NULL, tst->interval_us); -+ print_uint(PRINT_JSON, "peak_delay", NULL, tst->peak_delay_us); -+ print_uint(PRINT_JSON, "average_delay", NULL, tst->avge_delay_us); -+ print_uint(PRINT_JSON, "base_delay", NULL, tst->base_delay_us); -+ print_uint(PRINT_JSON, "sent_packets", NULL, tst->sent.packets); -+ print_uint(PRINT_JSON, "sent_bytes", NULL, tst->sent.bytes); -+ print_uint(PRINT_JSON, "way_indirect_hits", NULL, tst->way_indirect_hits); -+ print_uint(PRINT_JSON, "way_misses", NULL, tst->way_misses); -+ print_uint(PRINT_JSON, "way_collisions", NULL, tst->way_collisions); -+ print_uint(PRINT_JSON, "drops", NULL, tst->dropped.packets); -+ print_uint(PRINT_JSON, "ecn_mark", NULL, tst->ecn_marked.packets); -+ print_uint(PRINT_JSON, "ack_drops", NULL, tst->ack_drops.packets); -+ print_uint(PRINT_JSON, "sparse_flows", NULL, tst->sparse_flows); -+ print_uint(PRINT_JSON, "bulk_flows", NULL, tst->bulk_flows); -+ print_uint(PRINT_JSON, "unresponsive_flows", NULL, tst->unresponse_flows); -+ print_uint(PRINT_JSON, "max_pkt_len", NULL, tst->max_skblen); ++ PRINT_TSTAT_JSON(u64, "threshold_rate", THRESHOLD_RATE64); ++ PRINT_TSTAT_JSON(u64, "sent_bytes", SENT_BYTES64); ++ PRINT_TSTAT_JSON(u32, "backlog_bytes", BACKLOG_BYTES); ++ PRINT_TSTAT_JSON(u32, "target_us", TARGET_US); ++ PRINT_TSTAT_JSON(u32, "interval_us", INTERVAL_US); ++ PRINT_TSTAT_JSON(u32, "peak_delay_us", PEAK_DELAY_US); ++ PRINT_TSTAT_JSON(u32, "avg_delay_us", AVG_DELAY_US); ++ PRINT_TSTAT_JSON(u32, "base_delay_us", BASE_DELAY_US); ++ PRINT_TSTAT_JSON(u32, "sent_packets", SENT_PACKETS); ++ PRINT_TSTAT_JSON(u32, "way_indirect_hits", WAY_INDIRECT_HITS); ++ PRINT_TSTAT_JSON(u32, "way_misses", WAY_MISSES); ++ PRINT_TSTAT_JSON(u32, "way_collisions", WAY_COLLISIONS); ++ PRINT_TSTAT_JSON(u32, "drops", DROPPED_PACKETS); ++ PRINT_TSTAT_JSON(u32, "ecn_mark", ECN_MARKED_PACKETS); ++ PRINT_TSTAT_JSON(u32, "ack_drops", ACKS_DROPPED_PACKETS); ++ PRINT_TSTAT_JSON(u32, "sparse_flows", SPARSE_FLOWS); ++ PRINT_TSTAT_JSON(u32, "bulk_flows", BULK_FLOWS); ++ PRINT_TSTAT_JSON(u32, "unresponsive_flows", UNRESPONSIVE_FLOWS); ++ PRINT_TSTAT_JSON(u32, "max_pkt_len", MAX_SKBLEN); ++ PRINT_TSTAT_JSON(u32, "flow_quantum", FLOW_QUANTUM); + close_json_object(); ++ ++#undef PRINT_TSTAT_JSON +} + +static int cake_print_xstats(struct qdisc_util *qu, FILE *f, + struct rtattr *xstats) +{ -+ struct tc_cake_xstats *stnc; -+ struct tc_cake_tin_stats *tst; ++ struct rtattr *st[TCA_CAKE_STATS_MAX + 1]; + SPRINT_BUF(b1); + int i; + + if (xstats == NULL) + return 0; + -+ if (RTA_PAYLOAD(xstats) < sizeof(*stnc)) -+ return -1; ++#define GET_STAT_U32(attr) rta_getattr_u32(st[TCA_CAKE_STATS_ ## attr]) ++#define GET_STAT_S32(attr) (*(__s32 *)RTA_DATA(st[TCA_CAKE_STATS_ ## attr])) ++#define GET_STAT_U64(attr) rta_getattr_u64(st[TCA_CAKE_STATS_ ## attr]) + -+ stnc = RTA_DATA(xstats); ++ parse_rtattr_nested(st, TCA_CAKE_STATS_MAX, xstats); + -+ if (stnc->version < 0x101 || -+ RTA_PAYLOAD(xstats) < (sizeof(struct tc_cake_xstats) + -+ stnc->tin_stats_size * stnc->tin_cnt)) -+ return -1; ++ if (st[TCA_CAKE_STATS_MEMORY_USED] && ++ st[TCA_CAKE_STATS_MEMORY_LIMIT]) { ++ print_string(PRINT_FP, NULL, " memory used: %s", ++ sprint_size(GET_STAT_U32(MEMORY_USED), b1)); + -+ print_uint(PRINT_JSON, "memory_used", NULL, stnc->memory_used); -+ print_uint(PRINT_JSON, "memory_limit", NULL, stnc->memory_limit); -+ print_uint(PRINT_JSON, "capacity_estimate", NULL, stnc->capacity_estimate); ++ print_string(PRINT_FP, NULL, " of %s\n", ++ sprint_size(GET_STAT_U32(MEMORY_LIMIT), b1)); + -+ print_string(PRINT_FP, NULL, " memory used: %s", -+ sprint_size(stnc->memory_used, b1)); -+ print_string(PRINT_FP, NULL, " of %s\n", -+ sprint_size(stnc->memory_limit, b1)); -+ print_string(PRINT_FP, NULL, " capacity estimate: %s\n", -+ sprint_rate(stnc->capacity_estimate, b1)); -+ -+ print_uint(PRINT_ANY, "min_transport_size", " min/max transport layer size: %10u", -+ stnc->min_trnlen); -+ print_uint(PRINT_ANY, "max_transport_size", " /%8u\n", stnc->max_trnlen); -+ print_uint(PRINT_ANY, "min_adj_size", " min/max overhead-adjusted size: %8u", -+ stnc->min_adjlen); -+ print_uint(PRINT_ANY, "max_adj_size", " /%8u\n", stnc->max_adjlen); -+ print_uint(PRINT_ANY, "avg_hdr_offset", " average transport hdr offset: %10u\n\n", -+ stnc->avg_trnoff); -+ -+ if (is_json_context()) { -+ open_json_array(PRINT_JSON, "tins"); -+ FOR_EACH_TIN(stnc, tst, i) -+ cake_print_json_tin(tst); -+ close_json_array(PRINT_JSON, NULL); -+ return 0; ++ print_uint(PRINT_JSON, "memory_used", NULL, ++ GET_STAT_U32(MEMORY_USED)); ++ print_uint(PRINT_JSON, "memory_limit", NULL, ++ GET_STAT_U32(MEMORY_LIMIT)); + } + ++ if (st[TCA_CAKE_STATS_CAPACITY_ESTIMATE64]) { ++ print_string(PRINT_FP, NULL, " capacity estimate: %s\n", ++ sprint_rate(GET_STAT_U64(CAPACITY_ESTIMATE64), b1)); ++ print_uint(PRINT_JSON, "capacity_estimate", NULL, ++ GET_STAT_U64(CAPACITY_ESTIMATE64)); ++ } + -+ switch(stnc->tin_cnt) { -+ case 3: -+ fprintf(f, " Bulk Best Effort Voice\n"); -+ break; ++ if (st[TCA_CAKE_STATS_MIN_NETLEN] && ++ st[TCA_CAKE_STATS_MAX_NETLEN]) { ++ print_uint(PRINT_ANY, "min_network_size", ++ " min/max network layer size: %12u", ++ GET_STAT_U32(MIN_NETLEN)); ++ print_uint(PRINT_ANY, "max_network_size", ++ " /%8u\n", GET_STAT_U32(MAX_NETLEN)); ++ } + -+ case 4: -+ fprintf(f, " Bulk Best Effort Video Voice\n"); -+ break; ++ if (st[TCA_CAKE_STATS_MIN_ADJLEN] && ++ st[TCA_CAKE_STATS_MAX_ADJLEN]) { ++ print_uint(PRINT_ANY, "min_adj_size", ++ " min/max overhead-adjusted size: %8u", ++ GET_STAT_U32(MIN_ADJLEN)); ++ print_uint(PRINT_ANY, "max_adj_size", ++ " /%8u\n", GET_STAT_U32(MAX_ADJLEN)); ++ } + -+ case 5: -+ fprintf(f, " Low Loss Best Effort Low Delay Bulk Net Control\n"); -+ break; ++ if (st[TCA_CAKE_STATS_AVG_NETOFF]) ++ print_uint(PRINT_ANY, "avg_hdr_offset", ++ " average network hdr offset: %12u\n\n", ++ GET_STAT_U32(AVG_NETOFF)); + -+ default: -+ fprintf(f, " "); -+ for(i=0; i < stnc->tin_cnt; i++) -+ fprintf(f, " Tin %u", i); -+ fprintf(f, "\n"); -+ }; ++ /* class stats */ ++ if (st[TCA_CAKE_STATS_DEFICIT]) ++ print_int(PRINT_ANY, "deficit", " deficit %u", ++ GET_STAT_S32(DEFICIT)); ++ if (st[TCA_CAKE_STATS_COBALT_COUNT]) ++ print_uint(PRINT_ANY, "count", " count %u", ++ GET_STAT_U32(COBALT_COUNT)); + -+ fprintf(f, " thresh "); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12s", sprint_rate(tst->threshold_rate, b1)); -+ fprintf(f, "\n"); ++ if (st[TCA_CAKE_STATS_DROPPING] && GET_STAT_U32(DROPPING)) { ++ print_bool(PRINT_ANY, "dropping", " dropping", true); ++ if (st[TCA_CAKE_STATS_DROP_NEXT_US]) { ++ int drop_next = GET_STAT_S32(DROP_NEXT_US); + -+ fprintf(f, " target "); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12s", sprint_time(tst->target_us, b1)); -+ fprintf(f, "\n"); ++ if (drop_next < 0) { ++ print_string(PRINT_FP, NULL, " drop_next -%s", ++ sprint_time(drop_next, b1)); ++ } else { ++ print_uint(PRINT_JSON, "drop_next", NULL, ++ drop_next); ++ print_string(PRINT_FP, NULL, " drop_next %s", ++ sprint_time(drop_next, b1)); ++ } ++ } ++ } + -+ fprintf(f, " interval"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12s", sprint_time(tst->interval_us, b1)); -+ fprintf(f, "\n"); ++ if (st[TCA_CAKE_STATS_P_DROP]) { ++ print_uint(PRINT_ANY, "blue_prob", " blue_prob %u", ++ GET_STAT_U32(P_DROP)); ++ if (st[TCA_CAKE_STATS_BLUE_TIMER_US]) { ++ int blue_timer = GET_STAT_S32(BLUE_TIMER_US); + -+ fprintf(f, " pk_delay"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12s", sprint_time(tst->peak_delay_us, b1)); -+ fprintf(f, "\n"); ++ if (blue_timer < 0) { ++ print_string(PRINT_FP, NULL, " blue_timer -%s", ++ sprint_time(blue_timer, b1)); ++ } else { ++ print_uint(PRINT_JSON, "blue_timer", NULL, ++ blue_timer); ++ print_string(PRINT_FP, NULL, " blue_timer %s", ++ sprint_time(blue_timer, b1)); ++ } ++ } ++ } + -+ fprintf(f, " av_delay"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12s", sprint_time(tst->avge_delay_us, b1)); -+ fprintf(f, "\n"); ++#undef GET_STAT_U32 ++#undef GET_STAT_S32 ++#undef GET_STAT_U64 + -+ fprintf(f, " sp_delay"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12s", sprint_time(tst->base_delay_us, b1)); -+ fprintf(f, "\n"); ++ if (st[TCA_CAKE_STATS_TIN_STATS]) { ++ struct rtattr *tstat[TC_CAKE_MAX_TINS][TCA_CAKE_TIN_STATS_MAX + 1]; ++ struct rtattr *tins[TC_CAKE_MAX_TINS + 1]; ++ int num_tins = 0; + -+ fprintf(f, " pkts "); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->sent.packets); -+ fprintf(f, "\n"); ++ parse_rtattr_nested(tins, TC_CAKE_MAX_TINS, ++ st[TCA_CAKE_STATS_TIN_STATS]); + -+ fprintf(f, " bytes "); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12llu", tst->sent.bytes); -+ fprintf(f, "\n"); ++ for (i = 1; i <= TC_CAKE_MAX_TINS && tins[i]; i++) { ++ parse_rtattr_nested(tstat[i-1], TCA_CAKE_TIN_STATS_MAX, ++ tins[i]); ++ num_tins++; ++ } + -+ fprintf(f, " way_inds"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->way_indirect_hits); -+ fprintf(f, "\n"); ++ if (!num_tins) ++ return 0; + -+ fprintf(f, " way_miss"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->way_misses); -+ fprintf(f, "\n"); ++ if (is_json_context()) { ++ open_json_array(PRINT_JSON, "tins"); ++ for (i = 0; i < num_tins; i++) ++ cake_print_json_tin(tstat[i]); ++ close_json_array(PRINT_JSON, NULL); + -+ fprintf(f, " way_cols"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->way_collisions); -+ fprintf(f, "\n"); ++ return 0; ++ } + -+ fprintf(f, " drops "); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->dropped.packets); -+ fprintf(f, "\n"); + -+ fprintf(f, " marks "); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->ecn_marked.packets); -+ fprintf(f, "\n"); ++ switch (num_tins) { ++ case 3: ++ fprintf(f, " Bulk Best Effort Voice\n"); ++ break; + -+ fprintf(f, " ack_drop"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->ack_drops.packets); -+ fprintf(f, "\n"); ++ case 4: ++ fprintf(f, " Bulk Best Effort Video Voice\n"); ++ break; + -+ fprintf(f, " sp_flows"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->sparse_flows); -+ fprintf(f, "\n"); ++ default: ++ fprintf(f, " "); ++ for (i = 0; i < num_tins; i++) ++ fprintf(f, " Tin %u", i); ++ fprintf(f, "\n"); ++ }; + -+ fprintf(f, " bk_flows"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->bulk_flows); -+ fprintf(f, "\n"); ++#define GET_TSTAT(i, attr) (tstat[i][TCA_CAKE_TIN_STATS_ ## attr]) ++#define PRINT_TSTAT(name, attr, fmts, val) do { \ ++ if (GET_TSTAT(0, attr)) { \ ++ fprintf(f, name); \ ++ for (i = 0; i < num_tins; i++) \ ++ fprintf(f, " %12" fmts, val); \ ++ fprintf(f, "\n"); \ ++ } \ ++ } while (0) + -+ fprintf(f, " un_flows"); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->unresponse_flows); -+ fprintf(f, "\n"); ++#define SPRINT_TSTAT(pfunc, type, name, attr) PRINT_TSTAT( \ ++ name, attr, "s", sprint_ ## pfunc( \ ++ rta_getattr_ ## type(GET_TSTAT(i, attr)), b1)) + -+ fprintf(f, " max_len "); -+ FOR_EACH_TIN(stnc, tst, i) -+ fprintf(f, " %12u", tst->max_skblen); -+ fprintf(f, "\n"); ++#define PRINT_TSTAT_U32(name, attr) PRINT_TSTAT( \ ++ name, attr, "u", rta_getattr_u32(GET_TSTAT(i, attr))) + ++#define PRINT_TSTAT_U64(name, attr) PRINT_TSTAT( \ ++ name, attr, "llu", rta_getattr_u64(GET_TSTAT(i, attr))) ++ ++ SPRINT_TSTAT(rate, u64, " thresh ", THRESHOLD_RATE64); ++ SPRINT_TSTAT(time, u32, " target ", TARGET_US); ++ SPRINT_TSTAT(time, u32, " interval", INTERVAL_US); ++ SPRINT_TSTAT(time, u32, " pk_delay", PEAK_DELAY_US); ++ SPRINT_TSTAT(time, u32, " av_delay", AVG_DELAY_US); ++ SPRINT_TSTAT(time, u32, " sp_delay", BASE_DELAY_US); ++ SPRINT_TSTAT(size, u32, " backlog ", BACKLOG_BYTES); ++ ++ PRINT_TSTAT_U32(" pkts ", SENT_PACKETS); ++ PRINT_TSTAT_U64(" bytes ", SENT_BYTES64); ++ ++ PRINT_TSTAT_U32(" way_inds", WAY_INDIRECT_HITS); ++ PRINT_TSTAT_U32(" way_miss", WAY_MISSES); ++ PRINT_TSTAT_U32(" way_cols", WAY_COLLISIONS); ++ PRINT_TSTAT_U32(" drops ", DROPPED_PACKETS); ++ PRINT_TSTAT_U32(" marks ", ECN_MARKED_PACKETS); ++ PRINT_TSTAT_U32(" ack_drop", ACKS_DROPPED_PACKETS); ++ PRINT_TSTAT_U32(" sp_flows", SPARSE_FLOWS); ++ PRINT_TSTAT_U32(" bk_flows", BULK_FLOWS); ++ PRINT_TSTAT_U32(" un_flows", UNRESPONSIVE_FLOWS); ++ PRINT_TSTAT_U32(" max_len ", MAX_SKBLEN); ++ PRINT_TSTAT_U32(" quantum ", FLOW_QUANTUM); ++ ++#undef GET_STAT ++#undef PRINT_TSTAT ++#undef SPRINT_TSTAT ++#undef PRINT_TSTAT_U32 ++#undef PRINT_TSTAT_U64 ++ } + return 0; +} + @@ -1550,3 +1567,14 @@ index 00000000..44cadb63 + .print_qopt = cake_print_opt, + .print_xstats = cake_print_xstats, +}; +--- a/tc/q_ingress.c ++++ b/tc/q_ingress.c +@@ -40,7 +40,7 @@ static int ingress_parse_opt(struct qdis + static int ingress_print_opt(struct qdisc_util *qu, FILE *f, + struct rtattr *opt) + { +- fprintf(f, "---------------- "); ++ print_string(PRINT_FP, NULL, "---------------- ", NULL); + return 0; + } + diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index d70dc11d4..1d758ed07 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -18,6 +18,7 @@ PKG_SOURCE_VERSION:=c16bdec15137b241586310d0e61bc88cc3726004 PKG_MIRROR_HASH:=72e4bec94a56dd600097846c773e1074ff705e38f800ef221db646c064371a53 PKG_FIXUP:=autoreconf +PKG_FLAGS:=nonshared PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 diff --git a/package/network/utils/iptables/patches/600-shared-libext.patch b/package/network/utils/iptables/patches/600-shared-libext.patch index a906d4060..6e08416f0 100644 --- a/package/network/utils/iptables/patches/600-shared-libext.patch +++ b/package/network/utils/iptables/patches/600-shared-libext.patch @@ -28,27 +28,27 @@ -libext.a: initext.o ${libext_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; +libiptext.so: initext.o ${libext_objs} -+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD}; ++ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD}); -libext_ebt.a: initextb.o ${libext_ebt_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; +libiptext_ebt.so: initextb.o ${libext_ebt_objs} -+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD}; ++ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD}); -libext_arpt.a: initexta.o ${libext_arpt_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; +libiptext_arpt.so: initexta.o ${libext_arpt_objs} -+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD}; ++ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD}); -libext4.a: initext4.o ${libext4_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; +libiptext4.so: initext4.o ${libext4_objs} -+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD}; ++ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD}); -libext6.a: initext6.o ${libext6_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; +libiptext6.so: initext6.o ${libext6_objs} -+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD}; ++ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD}); initext_func := $(addprefix xt_,${pfx_build_static}) initextb_func := $(addprefix ebt_,${pfb_build_static}) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 2145f7d2a..2448f43bd 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2018-02-15 -PKG_SOURCE_VERSION:=223e09bf3f180797aeea0f6dc1721e5a55215e66 -PKG_MIRROR_HASH:=cbf90b6dcc9765c03814f1c99363efef073c030bc5e5456a0674d2748e2eeed8 +PKG_SOURCE_DATE:=2018-07-24 +PKG_SOURCE_VERSION:=94b1366de313c4d1c0c1ea8f0b859bc44d0b231a +PKG_MIRROR_HASH:=6fe4b76b24b9df0ced458d821df1f84818ca1647ae4d3c4439f486b5d35c986e PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 @@ -32,7 +32,7 @@ define Package/libiwinfo SECTION:=libs CATEGORY:=Libraries TITLE:=Generalized Wireless Information Library (iwinfo) - DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny +libuci + DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny +libuci +libubus ABI_VERSION:=$(PKG_RELEASE) endef diff --git a/package/network/utils/wwan/files/data/1e2d-0053 b/package/network/utils/wwan/files/data/1e2d-0053 new file mode 100644 index 000000000..e83f04c38 --- /dev/null +++ b/package/network/utils/wwan/files/data/1e2d-0053 @@ -0,0 +1,6 @@ +{ + "desc": "Cinterion PH8", + "control": 2, + "data": 3 +} + diff --git a/package/network/utils/wwan/files/data/1e2d-005b b/package/network/utils/wwan/files/data/1e2d-005b new file mode 100644 index 000000000..6678ff080 --- /dev/null +++ b/package/network/utils/wwan/files/data/1e2d-005b @@ -0,0 +1,5 @@ +{ + "desc": "Cinterion ELS61", + "control": 1, + "data": 0 +} diff --git a/package/network/utils/wwan/files/wwan.sh b/package/network/utils/wwan/files/wwan.sh index 2e9d73f1e..303fa9e99 100755 --- a/package/network/utils/wwan/files/wwan.sh +++ b/package/network/utils/wwan/files/wwan.sh @@ -59,7 +59,7 @@ proto_wwan_setup() { json_set_namespace $old_cb [ -n "$control" -a -n "$data" ] && { - ttys=$(ls -d /sys/bus/usb/devices/$devicename/${devicename}*/tty* | sed "s/.*\///g" | tr "\n" " ") + ttys=$(ls -d /sys/bus/usb/devices/$devicename/${devicename}*/tty?* /sys/bus/usb/devices/$devicename/${devicename}*/tty/tty?* | sed "s/.*\///g" | tr "\n" " ") ctl_device=/dev/$(echo $ttys | cut -d" " -f $((control + 1))) dat_device=/dev/$(echo $ttys | cut -d" " -f $((data + 1))) driver=comgt @@ -110,7 +110,7 @@ proto_wwan_teardown() { case $driver in qmi_wwan) proto_qmi_teardown $@ ;; cdc_mbim) proto_mbim_teardown $@ ;; - sierra_net) proto_mbim_teardown $@ ;; + sierra_net) proto_directip_teardown $@ ;; comgt) proto_3g_teardown $@ ;; cdc_ether|*cdc_ncm) proto_ncm_teardown $@ ;; esac diff --git a/package/network/utils/wwan/files/wwan.usb b/package/network/utils/wwan/files/wwan.usb index 507b002d1..b757c1c2a 100644 --- a/package/network/utils/wwan/files/wwan.usb +++ b/package/network/utils/wwan/files/wwan.usb @@ -1,5 +1,10 @@ +#!/bin/sh + [ "$ACTION" = add -a "$DEVTYPE" = usb_device ] || exit 0 +. /lib/functions.sh +. /lib/netifd/netifd-proto.sh + vid=$(cat /sys$DEVPATH/idVendor) pid=$(cat /sys$DEVPATH/idProduct) [ -f "/lib/network/wwan/$vid:$pid" ] || exit 0 diff --git a/package/system/ca-certificates/Makefile b/package/system/ca-certificates/Makefile index 73a267e0b..5ee7a3528 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:=20170717 -PKG_MAINTAINER:=Christian Schoenebeck +PKG_VERSION:=20180409 +PKG_MAINTAINER:= PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/c/ca-certificates -PKG_HASH:=e487639b641fa75445174734dd6e9d600373e3248b3d86a7e3c6d0f6977decd2 +PKG_HASH:=7af6f5bfc619fd29cbf0258c1d95107c38ce840ad6274e343e1e0d971fc72b51 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) PKG_INSTALL:=1 diff --git a/package/system/mtd/Makefile b/package/system/mtd/Makefile index 01277d9f4..65de47f23 100644 --- a/package/system/mtd/Makefile +++ b/package/system/mtd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mtd -PKG_RELEASE:=21 +PKG_RELEASE:=23 PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME) STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS) @@ -17,6 +17,8 @@ STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS) PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:= +PKG_FLAGS:=nonshared + include $(INCLUDE_DIR)/package.mk define Package/mtd diff --git a/package/system/mtd/src/trx.c b/package/system/mtd/src/trx.c index 1f5c52914..aaca232b6 100644 --- a/package/system/mtd/src/trx.c +++ b/package/system/mtd/src/trx.c @@ -46,6 +46,12 @@ struct trx_header { uint32_t offsets[3]; /* Offsets of partitions from start of header */ }; +#define min(x,y) ({ \ + typeof(x) _x = (x); \ + typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x < _y ? _x : _y; }) + #if __BYTE_ORDER == __BIG_ENDIAN #define STORE32_LE(X) ((((X) & 0x000000FF) << 24) | (((X) & 0x0000FF00) << 8) | (((X) & 0x00FF0000) >> 8) | (((X) & 0xFF000000) >> 24)) #elif __BYTE_ORDER == __LITTLE_ENDIAN @@ -156,7 +162,7 @@ mtd_fixtrx(const char *mtd, size_t offset, size_t data_size) int fd; struct trx_header *trx; char *first_block; - char *buf; + char *buf, *to; ssize_t res; size_t block_offset; @@ -201,23 +207,41 @@ mtd_fixtrx(const char *mtd, size_t offset, size_t data_size) exit(1); } - if (trx->len == STORE32_LE(data_size + TRX_CRC32_DATA_OFFSET)) { - if (quiet < 2) - fprintf(stderr, "Header already fixed, exiting\n"); - close(fd); - return 0; - } - buf = malloc(data_size); if (!buf) { perror("malloc"); exit(1); } - res = pread(fd, buf, data_size, data_offset); - if (res != data_size) { - perror("pread"); - exit(1); + to = buf; + while (data_size) { + size_t read_block_offset = data_offset & ~(erasesize - 1); + size_t read_chunk; + + read_chunk = erasesize - (data_offset & (erasesize - 1)); + read_chunk = min(read_chunk, data_size); + + /* Read from good blocks only to match CFE behavior */ + if (!mtd_block_is_bad(fd, read_block_offset)) { + res = pread(fd, to, read_chunk, data_offset); + if (res != read_chunk) { + perror("pread"); + exit(1); + } + to += read_chunk; + } + + data_offset += read_chunk; + data_size -= read_chunk; + } + data_size = to - buf; + + if (trx->len == STORE32_LE(data_size + TRX_CRC32_DATA_OFFSET) && + trx->crc32 == STORE32_LE(crc32buf(buf, data_size))) { + if (quiet < 2) + fprintf(stderr, "Header already fixed, exiting\n"); + close(fd); + return 0; } trx->len = STORE32_LE(data_size + offsetof(struct trx_header, flag_version)); @@ -244,4 +268,3 @@ mtd_fixtrx(const char *mtd, size_t offset, size_t data_size) return 0; } - diff --git a/package/system/lede-keyring/Makefile b/package/system/openwrt-keyring/Makefile similarity index 50% rename from package/system/lede-keyring/Makefile rename to package/system/openwrt-keyring/Makefile index d0961b162..d394eef42 100644 --- a/package/system/lede-keyring/Makefile +++ b/package/system/openwrt-keyring/Makefile @@ -2,36 +2,37 @@ include $(TOPDIR)/rules.mk -PKG_NAME:=lede-keyring +PKG_NAME:=openwrt-keyring PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/keyring.git -PKG_SOURCE_DATE:=2017-01-20 -PKG_SOURCE_VERSION:=a50b7529880988ca96e72dede0279ff139a8ab1a -PKG_MIRROR_HASH:=811ba79ba71925e949d2c690db7d7b031ac1dd965aa831ca9b6d9d70f5657254 +PKG_SOURCE_DATE:=2018-05-18 +PKG_SOURCE_VERSION:=103a32e9f52fd35a428dc08ddbca86fe41dfb918 +PKG_MIRROR_HASH:=58f42796396fee0e4f008d6f5a970a421d023d6c98e71bf53c2778734fa3480b PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk -define Package/lede-keyring +define Package/openwrt-keyring SECTION:=base CATEGORY:=Base system - TITLE:=LEDE Developer Keyring - URL:=http://www.lede-project.org + PROVIDES:=lede-keyring + TITLE:=OpenWrt Developer Keyring + URL:=https://openwrt.org/docs/guide-user/security/signatures endef -define Package/lede-keyring/description +define Package/openwrt-keyring/description The keyring of with the developer using and gpg public keys. endef Build/Compile= -define Package/lede-keyring/install +define Package/openwrt-keyring/install $(INSTALL_DIR) $(1)/etc/opkg/keys/ $(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/* $(1)/etc/opkg/keys/ endef -$(eval $(call BuildPackage,lede-keyring)) +$(eval $(call BuildPackage,openwrt-keyring)) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 31658af34..5971e0293 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -17,7 +17,7 @@ PKG_SOURCE_VERSION:=dfb68f8556df63878add145ad9c656381bc20656 PKG_MIRROR_HASH:=8d2c70fb0264a6548e39acc5ab1c44cec50fc550c4f931760b0796f8893c9b7f CMAKE_INSTALL:=1 -PKG_LICENSE:=GPL-3.0 +PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= PKG_MAINTAINER:=John Crispin diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index c021fc725..7e370c722 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -53,7 +53,7 @@ _procd_call() { } _procd_wrapper() { - procd_lock + procd_lock while [ -n "$1" ]; do eval "$1() { _procd_call _$1 \"\$@\"; }" shift diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 33e21ff02..fee2c5b33 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -12,10 +12,10 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_SOURCE_DATE:=2018-04-20 -PKG_SOURCE_VERSION:=66a9bad1a73bc33c4c5a9a00de8dc8ad35bdfaf1 +PKG_SOURCE_DATE:=2018-08-16 +PKG_SOURCE_VERSION:=41333abee4c57e3de2bcfa08972954e2af20705a PKG_MAINTAINER:=Jo-Philipp Wich -PKG_MIRROR_HASH:=fb8c511d64137b1e539815fdaebf7e5aa05611dfeab6d003823f40512ef90b3c +PKG_MIRROR_HASH:=a6d3c2228836a738919dfbd57a9e3ae5d427d5f94607b7e78b92b03f09f59731 PKG_LICENSE:=ISC PKG_LICENSE_FILES:= diff --git a/package/system/ubox/Makefile b/package/system/ubox/Makefile index 89cc6768f..85dddff85 100644 --- a/package/system/ubox/Makefile +++ b/package/system/ubox/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ubox -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubox.git diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init index 21e078712..ae5dd1f03 100644 --- a/package/system/ubox/files/log.init +++ b/package/system/ubox/files/log.init @@ -55,6 +55,8 @@ start_service_file() } [ -z "${log_file}" ] && return + mkdir -p "$(dirname "${log_file}")" + procd_open_instance procd_set_param command "$PROG" -f -F "$log_file" -p "$pid_file" [ -n "${log_size}" ] && procd_append_param command -S "$log_size" diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 7dc3c92de..09ddd8de9 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2018-01-16 -PKG_SOURCE_VERSION:=5bae22eb5472c9c7cc30caa9a84004bba19940d3 -PKG_MIRROR_HASH:=6f46398279339dcc597965306275fe1272af384f8cb253ee8de2c68e366eed55 +PKG_SOURCE_DATE:=2018-07-26 +PKG_SOURCE_VERSION:=40e0931e70bfe198690a7dac43b32fad06f46ef9 +PKG_MIRROR_HASH:=ddf8a42ff9a88a81b87058887d79a4eea6f2d606a29f168422d41112702793e5 CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index eec45ae94..0f7ef68f1 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE=2018-03-24 -PKG_SOURCE_VERSION:=5d2bf09ec594d97eb9284b8c721dbfe10b81a6f6 -PKG_MIRROR_HASH:=61f8cf52950edae851892ed0914dea8e1ab796bcefc095aa5dab28f672dc3301 +PKG_SOURCE_DATE=2018-08-11 +PKG_SOURCE_VERSION:=4c8b4d6efc8302b508d261573351fffb75bd98c2 +PKG_MIRROR_HASH:=c1f0f565921c71ff9231508c7c249baacad4c3ae1a3fade25c37bcb2bf7a7b5f PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 155fc71d6..28375b87c 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox PKG_VERSION:=1.28.3 -PKG_RELEASE:=1 +PKG_RELEASE:=4 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -47,17 +47,18 @@ define Package/busybox DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter MENU:=1 ALTERNATIVES:=\ - $(call BUSYBOX_IF_ENABLED,KILL, 100:/bin/kill:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,PS, 100:/bin/ps:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,WATCH, 100:/bin/watch:/bin/busybox) \ - $(call BUSYBOX_IF_ENABLED,IP, 100:/sbin/ip:/bin/busybox) \ + $(call BUSYBOX_IF_ENABLED,FLOCK, 100:/usr/bin/flock:/bin/busybox) \ $(call BUSYBOX_IF_ENABLED,FREE, 100:/usr/bin/free:/bin/busybox) \ + $(call BUSYBOX_IF_ENABLED,IP, 100:/sbin/ip:/bin/busybox) \ + $(call BUSYBOX_IF_ENABLED,KILL, 100:/bin/kill:/bin/busybox) \ $(call BUSYBOX_IF_ENABLED,PGREP, 100:/usr/bin/pgrep:/bin/busybox) \ $(call BUSYBOX_IF_ENABLED,PKILL, 100:/usr/bin/pkill:/bin/busybox) \ $(call BUSYBOX_IF_ENABLED,PMAP, 100:/usr/bin/pmap:/bin/busybox) \ + $(call BUSYBOX_IF_ENABLED,PS, 100:/bin/ps:/bin/busybox) \ $(call BUSYBOX_IF_ENABLED,PWDX, 100:/usr/bin/pwdx:/bin/busybox) \ $(call BUSYBOX_IF_ENABLED,TOP, 100:/usr/bin/top:/bin/busybox) \ $(call BUSYBOX_IF_ENABLED,UPTIME, 100:/usr/bin/uptime:/bin/busybox) \ + $(call BUSYBOX_IF_ENABLED,WATCH, 100:/bin/watch:/bin/busybox) \ endef diff --git a/package/utils/busybox/files/cron b/package/utils/busybox/files/cron index a20137427..ca04a0c17 100755 --- a/package/utils/busybox/files/cron +++ b/package/utils/busybox/files/cron @@ -11,7 +11,7 @@ validate_cron_section() { 'cronloglevel:uinteger' } -start_service () { +start_service() { [ -z "$(ls /etc/crontabs/)" ] && return 1 loglevel="$(uci_get "system.@system[0].cronloglevel")" @@ -29,10 +29,12 @@ start_service () { procd_open_instance procd_set_param command "$PROG" -f -c /etc/crontabs -l "${loglevel:-5}" + for crontab in /etc/crontabs/*; do + procd_set_param file "$crontab" + done procd_close_instance } -service_triggers() -{ +service_triggers() { procd_add_validation validate_cron_section } diff --git a/package/utils/busybox/patches/400-udhcpc-remove-code-which-requires-server-ID-to-be-on.patch b/package/utils/busybox/patches/400-udhcpc-remove-code-which-requires-server-ID-to-be-on.patch new file mode 100644 index 000000000..6770391cf --- /dev/null +++ b/package/utils/busybox/patches/400-udhcpc-remove-code-which-requires-server-ID-to-be-on.patch @@ -0,0 +1,117 @@ +From 148788eb0ee96026105755cf3fd1ad3d94f49cd2 Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Thu, 21 Jun 2018 17:36:22 +0200 +Subject: [PATCH] udhcpc: remove code which requires server ID to be on local + network + +This reverts "udhcpc: paranoia when using kernel UDP mode +for sending renew: server ID may be bogus". + +Users complain that they do have servers behind routers +(with DHCP relays). + +function old new delta +send_packet 168 166 -2 +bcast_or_ucast 25 23 -2 +udhcp_send_kernel_packet 301 295 -6 +------------------------------------------------------------------------------ +(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-10) Total: -10 bytes + +Signed-off-by: Denys Vlasenko +--- + networking/udhcp/common.h | 4 +--- + networking/udhcp/d6_dhcpc.c | 4 +--- + networking/udhcp/dhcpc.c | 10 ++-------- + networking/udhcp/dhcpd.c | 4 +--- + networking/udhcp/packet.c | 7 +++---- + 5 files changed, 8 insertions(+), 21 deletions(-) + +--- a/networking/udhcp/common.h ++++ b/networking/udhcp/common.h +@@ -308,9 +308,7 @@ int udhcp_send_raw_packet(struct dhcp_pa + + int udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, + uint32_t source_nip, int source_port, +- uint32_t dest_nip, int dest_port, +- int send_flags +-) FAST_FUNC; ++ uint32_t dest_nip, int dest_port) FAST_FUNC; + + void udhcp_sp_setup(void) FAST_FUNC; + void udhcp_sp_fd_set(struct pollfd *pfds, int extra_fd) FAST_FUNC; +--- a/networking/udhcp/d6_dhcpc.c ++++ b/networking/udhcp/d6_dhcpc.c +@@ -702,15 +702,13 @@ static NOINLINE int send_d6_renew(uint32 + opt_ptr = add_d6_client_options(opt_ptr); + + bb_error_msg("sending %s", "renew"); +- if (server_ipv6) { ++ if (server_ipv6) + return d6_send_kernel_packet( + &packet, (opt_ptr - (uint8_t*) &packet), + our_cur_ipv6, CLIENT_PORT6, + server_ipv6, SERVER_PORT6, + client_config.ifindex +- /* TODO? send_flags: MSG_DONTROUTE (see IPv4 code for reason why) */ + ); +- } + return d6_mcast_from_client_config_ifindex(&packet, opt_ptr); + } + +--- a/networking/udhcp/dhcpc.c ++++ b/networking/udhcp/dhcpc.c +@@ -693,16 +693,10 @@ static int raw_bcast_from_client_config_ + + static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t server) + { +- if (server) { +- /* Without MSG_DONTROUTE, the packet was seen routed over +- * _other interface_ if server ID is bogus (example: 1.1.1.1). +- */ ++ if (server) + return udhcp_send_kernel_packet(packet, + ciaddr, CLIENT_PORT, +- server, SERVER_PORT, +- /*send_flags: "to hosts only on directly connected networks" */ MSG_DONTROUTE +- ); +- } ++ server, SERVER_PORT); + return raw_bcast_from_client_config_ifindex(packet, ciaddr); + } + +--- a/networking/udhcp/dhcpd.c ++++ b/networking/udhcp/dhcpd.c +@@ -588,9 +588,7 @@ static void send_packet_to_relay(struct + + udhcp_send_kernel_packet(dhcp_pkt, + server_config.server_nip, SERVER_PORT, +- dhcp_pkt->gateway_nip, SERVER_PORT, +- /*send_flags:*/ 0 +- ); ++ dhcp_pkt->gateway_nip, SERVER_PORT); + } + + static void send_packet(struct dhcp_packet *dhcp_pkt, int force_broadcast) +--- a/networking/udhcp/packet.c ++++ b/networking/udhcp/packet.c +@@ -189,8 +189,7 @@ int FAST_FUNC udhcp_send_raw_packet(stru + /* Let the kernel do all the work for packet generation */ + int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, + uint32_t source_nip, int source_port, +- uint32_t dest_nip, int dest_port, +- int send_flags) ++ uint32_t dest_nip, int dest_port) + { + struct sockaddr_in sa; + unsigned padding; +@@ -227,8 +226,8 @@ int FAST_FUNC udhcp_send_kernel_packet(s + padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); + if (padding > DHCP_SIZE - 300) + padding = DHCP_SIZE - 300; +- result = send(fd, dhcp_pkt, DHCP_SIZE - padding, send_flags); +- msg = "send"; ++ result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding); ++ msg = "write"; + ret_close: + close(fd); + if (result < 0) { diff --git a/package/utils/mtd-utils/Makefile b/package/utils/mtd-utils/Makefile index 1e3c28115..ca60726d8 100644 --- a/package/utils/mtd-utils/Makefile +++ b/package/utils/mtd-utils/Makefile @@ -8,15 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=1.5.2 +PKG_VERSION:=2.0.2 PKG_RELEASE:=1 -PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git -PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=aea36417067dade75192bafa03af70b6eb2677b1 -PKG_MIRROR_HASH:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/mtd-utils/ +PKG_HASH:=fb3de61be8e932abb424e8ea3c30298f553d5f970ad158a737bb303bbf9660b8 PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared @@ -54,12 +54,15 @@ define Package/nand-utils/description Utilities for NAND devices. endef -MAKE_FLAGS += \ - DESTDIR="$(PKG_INSTALL_DIR)" \ - BUILDDIR="$(PKG_BUILD_DIR)" \ - LDLIBS+="$(LIBGCC_S)" \ - WITHOUT_XATTR=1 \ - WITHOUT_LZO=1 +MAKE_FLAGS += LDLIBS+="$(LIBGCC_S)" + +CONFIGURE_ARGS += \ + --disable-tests \ + --without-xattr \ + --without-lzo + +TARGET_CFLAGS += -ffunction-sections -fdata-sections +TARGET_LDFLAGS += -Wl,--gc-sections define Package/ubi-utils/install $(INSTALL_DIR) $(1)/usr/sbin diff --git a/package/utils/mtd-utils/patches/010-fix-rpmatch.patch b/package/utils/mtd-utils/patches/010-fix-rpmatch.patch deleted file mode 100644 index 8374a26e9..000000000 --- a/package/utils/mtd-utils/patches/010-fix-rpmatch.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/include/common.h -+++ b/include/common.h -@@ -152,10 +152,12 @@ static inline bool prompt(const char *ms - } - - if (strcmp("\n", line) != 0) { -- switch (rpmatch(line)) { -- case 0: ret = false; break; -- case 1: ret = true; break; -- case -1: -+ switch (line[0]) { -+ case 'N': -+ case 'n': ret = false; break; -+ case 'Y': -+ case 'y': ret = true; break; -+ default: - puts("unknown response; please try again"); - continue; - } diff --git a/package/utils/mtd-utils/patches/100-fix_includes.patch b/package/utils/mtd-utils/patches/100-fix_includes.patch index 7dad28b47..cc75052c5 100644 --- a/package/utils/mtd-utils/patches/100-fix_includes.patch +++ b/package/utils/mtd-utils/patches/100-fix_includes.patch @@ -5,6 +5,6 @@ #include #include +#include + #include "libfec.h" /* - * stuff used for testing purposes only diff --git a/package/utils/mtd-utils/patches/130-lzma_jffs2.patch b/package/utils/mtd-utils/patches/130-lzma_jffs2.patch index c6454fed5..d9cbfeebe 100644 --- a/package/utils/mtd-utils/patches/130-lzma_jffs2.patch +++ b/package/utils/mtd-utils/patches/130-lzma_jffs2.patch @@ -1,25 +1,29 @@ ---- a/Makefile -+++ b/Makefile -@@ -3,7 +3,7 @@ +--- a/jffsX-utils/Makemodule.am ++++ b/jffsX-utils/Makemodule.am +@@ -4,11 +4,19 @@ mkfs_jffs2_SOURCES = \ + jffsX-utils/compr_zlib.c \ + jffsX-utils/compr.h \ + jffsX-utils/rbtree.c \ +- jffsX-utils/compr_lzo.c \ ++ jffsX-utils/compr_lzma.c \ ++ jffsX-utils/lzma/LzFind.c \ ++ jffsX-utils/lzma/LzmaEnc.c \ ++ jffsX-utils/lzma/LzmaDec.c \ + jffsX-utils/compr.c \ + jffsX-utils/compr_rtime.c ++ ++if !WITHOUT_LZO ++mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c ++endif ++ + mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +-mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) ++mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) -I./include/linux/lzma - VERSION = 1.5.2 - --CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS) -+CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS) -I./include/linux/lzma - - ifeq ($(WITHOUT_XATTR), 1) - CPPFLAGS += -DWITHOUT_XATTR -@@ -84,7 +84,7 @@ $(BUILDDIR)/include/version.h.tmp: - # - # Utils in top level - # --obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o -+obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o $(if $(WITHOUT_LZO),,compr_lzo.o) compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o compr.o rbtree.o - LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) - LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) - ---- a/compr.c -+++ b/compr.c + jffs2reader_SOURCES = jffsX-utils/jffs2reader.c + jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +--- a/jffsX-utils/compr.c ++++ b/jffsX-utils/compr.c @@ -520,6 +520,9 @@ int jffs2_compressors_init(void) #ifdef CONFIG_JFFS2_LZO jffs2_lzo_init(); @@ -39,8 +43,8 @@ +#endif return 0; } ---- a/compr.h -+++ b/compr.h +--- a/jffsX-utils/compr.h ++++ b/jffsX-utils/compr.h @@ -18,13 +18,14 @@ #define CONFIG_JFFS2_ZLIB @@ -71,7 +75,7 @@ #endif /* __JFFS2_COMPR_H__ */ --- /dev/null -+++ b/compr_lzma.c ++++ b/jffsX-utils/compr_lzma.c @@ -0,0 +1,128 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. @@ -187,7 +191,7 @@ + + ret = lzma_alloc_workspace(&props); + if (ret < 0) -+ return ret; ++ return ret; + + ret = jffs2_register_compressor(&jffs2_lzma_comp); + if (ret) @@ -899,7 +903,7 @@ + +#endif --- /dev/null -+++ b/lzma/LzFind.c ++++ b/jffsX-utils/lzma/LzFind.c @@ -0,0 +1,753 @@ +/* LzFind.c -- Match finder for LZ algorithms +2008-04-04 @@ -1655,7 +1659,7 @@ + } +} --- /dev/null -+++ b/lzma/LzmaDec.c ++++ b/jffsX-utils/lzma/LzmaDec.c @@ -0,0 +1,1014 @@ +/* LzmaDec.c -- LZMA Decoder +2008-04-29 @@ -2672,7 +2676,7 @@ + return res; +} --- /dev/null -+++ b/lzma/LzmaEnc.c ++++ b/jffsX-utils/lzma/LzmaEnc.c @@ -0,0 +1,2335 @@ +/* LzmaEnc.c -- LZMA Encoder +2008-04-28 @@ -5009,9 +5013,9 @@ + LzmaEnc_Destroy(p, alloc, allocBig); + return res; +} ---- a/mkfs.jffs2.c -+++ b/mkfs.jffs2.c -@@ -1659,11 +1659,11 @@ int main(int argc, char **argv) +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -1666,11 +1666,11 @@ int main(int argc, char **argv) } erase_block_size *= units; diff --git a/package/utils/mtd-utils/patches/200-Revert-Return-correct-error-number-in-ubi_get_vol_in.patch b/package/utils/mtd-utils/patches/200-Revert-Return-correct-error-number-in-ubi_get_vol_in.patch new file mode 100644 index 000000000..79695c495 --- /dev/null +++ b/package/utils/mtd-utils/patches/200-Revert-Return-correct-error-number-in-ubi_get_vol_in.patch @@ -0,0 +1,30 @@ +From 7d27becbb355853ba778e8b83fe171eecb8195d2 Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 7 Jun 2018 22:36:19 +0200 +Subject: [PATCH] Revert "Return correct error number in ubi_get_vol_info1" + +This reverts commit dede98ffb706676309488d7cc660f569548d5930. +--- + lib/libubi.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/lib/libubi.c b/lib/libubi.c +index b50e68a..978b433 100644 +--- a/lib/libubi.c ++++ b/lib/libubi.c +@@ -1240,11 +1240,8 @@ int ubi_get_vol_info1(libubi_t desc, int dev_num, int vol_id, + info->dev_num = dev_num; + info->vol_id = vol_id; + +- if (vol_get_major(lib, dev_num, vol_id, &info->major, &info->minor)) { +- if (errno == ENOENT) +- errno = ENODEV; ++ if (vol_get_major(lib, dev_num, vol_id, &info->major, &info->minor)) + return -1; +- } + + ret = vol_read_data(lib->vol_type, dev_num, vol_id, buf, 50); + if (ret < 0) +-- +2.17.1 + diff --git a/package/utils/px5g/Makefile b/package/utils/px5g/Makefile index 4ea495867..da8d56dcc 100644 --- a/package/utils/px5g/Makefile +++ b/package/utils/px5g/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=px5g -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_LICENSE:=LGPL-2.1 PKG_BUILD_DIR:=$(BUILD_DIR)/px5g-$(BUILD_VARIANT) diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 898659306..5d31e6d99 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux PKG_VERSION:=2.32 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.32 @@ -198,6 +198,7 @@ endef define Package/flock $(call Package/util-linux/Default) TITLE:=manage locks from shell scripts + ALTERNATIVES:=200:/usr/bin/flock:/usr/bin/util-linux-flock endef define Package/flock/description @@ -591,7 +592,7 @@ endef define Package/flock/install $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/flock $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/flock $(1)/usr/bin/util-linux-flock endef define Package/fstrim/install diff --git a/scripts/bundle-libraries.sh b/scripts/bundle-libraries.sh index bfe681ad6..620ee01bd 100755 --- a/scripts/bundle-libraries.sh +++ b/scripts/bundle-libraries.sh @@ -87,7 +87,11 @@ _runas_so() { return 0; } + #ifdef __APPLE__ + __attribute__((section("__DATA,__mod_init_func"))) + #else __attribute__((section(".init_array"))) + #endif static void *mangle_arg0_constructor = &mangle_arg0; EOT diff --git a/scripts/download.pl b/scripts/download.pl index 64e29392a..34fd6a6f0 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -191,7 +191,7 @@ foreach my $mirror (@ARGV) { if ($mirror =~ /^\@SF\/(.+)$/) { # give sourceforge a few more tries, because it redirects to different mirrors for (1 .. 5) { - push @mirrors, "http://downloads.sourceforge.net/$1"; + push @mirrors, "https://downloads.sourceforge.net/$1"; } } elsif ($mirror =~ /^\@APACHE\/(.+)$/) { push @mirrors, "https://mirror.netcologne.de/apache.org/$1"; @@ -233,7 +233,6 @@ foreach my $mirror (@ARGV) { push @extra, "$extra[0]/longterm/v$1"; } foreach my $dir (@extra) { - push @mirrors, "http://mirrors.ustc.edu.cn/kernel.org/$dir"; push @mirrors, "https://cdn.kernel.org/pub/$dir"; push @mirrors, "https://mirror.rackspace.com/kernel.org/$dir"; push @mirrors, "http://download.xs4all.nl/ftp.kernel.org/pub/$dir"; @@ -258,10 +257,10 @@ foreach my $mirror (@ARGV) { } } -#push @mirrors, 'http://mirror1.openwrt.org'; -push @mirrors, 'http://sources.lede-project.org'; -push @mirrors, 'http://mirror2.openwrt.org/sources'; -push @mirrors, 'http://downloads.openwrt.org/sources'; +#push @mirrors, 'https://mirror1.openwrt.org'; +push @mirrors, 'https://sources.lede-project.org'; +push @mirrors, 'https://mirror2.openwrt.org/sources'; +push @mirrors, 'https://downloads.openwrt.org/sources'; while (!-f "$target/$filename") { my $mirror = shift @mirrors; diff --git a/scripts/env b/scripts/env index 63e26eb15..84166ae5f 100755 --- a/scripts/env +++ b/scripts/env @@ -104,7 +104,7 @@ env_list() { env_diff() { env_init env_sync_data - git diff --cached --color + git diff --cached --color=auto env_link_config } diff --git a/scripts/feeds b/scripts/feeds index f49cdb3e4..304ef6cba 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -59,7 +59,8 @@ sub parse_config() { my $valid = 1; $line[0] =~ /^src-[\w-]+$/ or $valid = 0; $line[1] =~ /^\w+$/ or $valid = 0; - @src = split /\s+/, $line[2]; + @src = split /\s+/, ($line[2] or ''); + @src = ('') if @src == 0; $valid or die "Syntax error in feeds.conf, line: $line\n"; $name{$line[1]} and die "Duplicate feed name '$line[1]', line: $line\n"; @@ -105,8 +106,8 @@ sub update_index($) -d "./feeds/$name.tmp/info" or mkdir "./feeds/$name.tmp/info" or return 1; system("$mk -s prepare-mk OPENWRT_BUILD= TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\""); - system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"packageinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"package\" SCAN_DEPS=\"$ENV{TOPDIR}/include/package*.mk\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\""); - system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"targetinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"target\" SCAN_DEPS=\"profiles/*.mk $ENV{TOPDIR}/include/target.mk\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" SCAN_MAKEOPTS=\"TARGET_BUILD=1\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\""); + system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"packageinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"package\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\""); + system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"targetinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"target\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" SCAN_MAKEOPTS=\"TARGET_BUILD=1\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\""); system("ln -sf $name.tmp/.packageinfo ./feeds/$name.index"); system("ln -sf $name.tmp/.targetinfo ./feeds/$name.targetindex"); @@ -127,12 +128,17 @@ my %update_method = ( 'init' => "ln -s '%s' '%s'", 'update' => "", 'revision' => "echo -n 'local'"}, + 'src-dummy' => { + 'init' => "true '%s' && mkdir '%s'", + 'update' => "", + 'revision' => "echo -n 'dummy'"}, 'src-git' => { 'init' => "git clone --depth 1 '%s' '%s'", 'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'", 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", 'update' => "git pull --ff", 'update_force' => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)", + 'post_update' => "git submodule update --init --recursive", 'controldir' => ".git", 'revision' => "git rev-parse --short HEAD | tr -d '\n'"}, 'src-git-full' => { @@ -141,6 +147,7 @@ my %update_method = ( 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", 'update' => "git pull --ff", 'update_force' => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)", + 'post_update' => "git submodule update --init --recursive", 'controldir' => ".git", 'revision' => "git rev-parse --short HEAD | tr -d '\n'"}, 'src-gitsvn' => { @@ -197,6 +204,10 @@ sub update_feed_via($$$$$) { } system("cd '$safepath'; $update_cmd") == 0 or return 1; } + if ($m->{'post_update'}) { + my $cmd = $m->{'post_update'}; + system("cd '$safepath'; $cmd") == 0 or return 1; + } return 0; } @@ -813,11 +824,12 @@ sub feed_config() { my $installed = (-f "feeds/$feed->[1].index"); printf "\tconfig FEED_%s\n", $feed->[1]; - printf "\t\tbool \"Enable feed %s\"\n", $feed->[1]; + printf "\t\ttristate \"Enable feed %s\"\n", $feed->[1]; printf "\t\tdepends on PER_FEED_REPO\n"; printf "\t\tdefault y\n" if $installed; printf "\t\thelp\n"; - printf "\t\t Enable the \\\"%s\\\" feed at %s.\n", $feed->[1], $feed->[2][0]; + printf "\t\t Enable the \\\"%s\\\" feed in opkg distfeeds.conf.\n", $feed->[1]; + printf "\t\t Say M to add the feed commented out.\n"; printf "\n"; } diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh index 38e8e3ff3..dad70b2ea 100755 --- a/scripts/om-fwupgradecfg-gen.sh +++ b/scripts/om-fwupgradecfg-gen.sh @@ -7,7 +7,7 @@ # usage() { - echo "Usage: $0 " + echo "Usage: $0 " rm -f $CFG_OUT exit 1 } @@ -44,6 +44,14 @@ case $CE_TYPE in SIZE_FACTOR=1024 SIZE_FORMAT="0x%08x" ;; + A62) + MAX_PART_SIZE=15552 + KERNEL_FLASH_ADDR=0x1a0000 + FLASH_BS=65536 + MD5_SKIP_BLOCKS=4 + SIZE_FACTOR=1024 + SIZE_FORMAT="0x%08x" + ;; *) echo "Error - unsupported ce type: $CE_TYPE" exit 1 diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 95df8bf11..e0c0132b8 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -45,6 +45,14 @@ Building images: make image FILES="" # include extra files from make image BIN_DIR="" # alternative output directory for the images make image EXTRA_IMAGE_NAME="" # Add this to the output image filename (sanitized) + +Print manifest: + List "all" packages which get installed into the image. + You can use the following parameters: + + make manifest PROFILE="" # override the default target profile + make manifest PACKAGES=" [ [ ...]]" # include extra packages + endef $(eval $(call shexport,Helptext)) @@ -108,6 +116,13 @@ _call_image: staging_dir/host/.prereq-build $(MAKE) -s build_image $(MAKE) -s checksum +_call_manifest: FORCE + rm -rf $(TARGET_DIR) + mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(DL_DIR) + $(MAKE) package_reload >/dev/null 2>/dev/null + $(MAKE) package_install >/dev/null 2>/dev/null + $(OPKG) list-installed + package_index: FORCE @echo >&2 @echo Building package index... >&2 @@ -164,7 +179,7 @@ info: PROFILE_FILTER = $(filter DEVICE_$(PROFILE) $(PROFILE),$(PROFILE_NAMES)) -image: +_check_profile: FORCE ifneq ($(PROFILE),) ifeq ($(PROFILE_FILTER),) @echo 'Profile "$(PROFILE)" does not exist!' @@ -172,6 +187,9 @@ ifneq ($(PROFILE),) @exit 1 endif endif + +image: + $(MAKE) -s _check_profile (unset PROFILE FILES PACKAGES MAKEFLAGS; \ $(MAKE) -s _call_image \ $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ @@ -179,4 +197,11 @@ endif $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \ $(if $(BIN_DIR),BIN_DIR="$(BIN_DIR)")) -.SILENT: help info image +manifest: FORCE + $(MAKE) -s _check_profile + (unset PROFILE FILES PACKAGES MAKEFLAGS; \ + $(MAKE) -s _call_manifest \ + $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ + $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)")) + +.SILENT: help info image manifest diff --git a/target/linux/adm5120/Makefile b/target/linux/adm5120/Makefile deleted file mode 100644 index 419c53434..000000000 --- a/target/linux/adm5120/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (C) 2007-2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -BOARD:=adm5120 -BOARDNAME:=Infineon/ADMtek ADM5120 -FEATURES:=low_mem -SUBTARGETS:=router_le router_be rb1xx -INITRAMFS_EXTRA_FILES:= - -KERNEL_PATCHVER:=3.18 - -include $(INCLUDE_DIR)/target.mk - -DEFAULT_PACKAGES += admswconfig wpad-mini kmod-input-core \ - kmod-input-polldev kmod-input-gpio-keys-polled kmod-button-hotplug \ - kmod-leds-gpio kmod-ledtrig-adm5120-switch - -$(eval $(call BuildTarget)) diff --git a/target/linux/adm5120/base-files/etc/board.d/01_leds b/target/linux/adm5120/base-files/etc/board.d/01_leds deleted file mode 100755 index f5cd778ed..000000000 --- a/target/linux/adm5120/base-files/etc/board.d/01_leds +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -. /lib/functions/uci-defaults.sh - -board_config_update - -ucidef_set_led_portstate "lan1" "LAN1" "lan1" "link_act" -ucidef_set_led_portstate "lan2" "LAN2" "lan2" "link_act" -ucidef_set_led_portstate "lan3" "LAN3" "lan3" "link_act" -ucidef_set_led_portstate "lan4" "LAN4" "lan4" "link_act" -ucidef_set_led_portstate "wan" "WAN" "wan" "link_act" - -ucidef_set_led_netdev "wlan" "WLAN" "wlan" "wlan0" - -board_config_flush - -exit 0 diff --git a/target/linux/adm5120/base-files/etc/config/network b/target/linux/adm5120/base-files/etc/config/network deleted file mode 100644 index 87782f478..000000000 --- a/target/linux/adm5120/base-files/etc/config/network +++ /dev/null @@ -1,39 +0,0 @@ -#### VLAN configuration -config switch - option eth0 "0 1 2 3" - option eth1 "4" - - -#### Loopback configuration -config interface loopback - option ifname "lo" - option proto static - option ipaddr 127.0.0.1 - option netmask 255.0.0.0 - - -#### LAN configuration -config interface lan - option type bridge - option ifname "eth0" - option proto static - option ipaddr 192.168.1.1 - option netmask 255.255.255.0 - option ip6assign 60 - - -#### WAN configuration -config interface wan - option ifname "eth1" - option proto dhcp - - -#### WAN6 configuration -config interface wan6 - option ifname "eth1" - option proto dhcpv6 - - -#### Network global configuration -config globals globals - option ula_prefix auto diff --git a/target/linux/adm5120/base-files/etc/diag.sh b/target/linux/adm5120/base-files/etc/diag.sh deleted file mode 100644 index 08952bdaa..000000000 --- a/target/linux/adm5120/base-files/etc/diag.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# Copyright (C) 2007-2013 OpenWrt.org - -. /lib/functions/leds.sh -. /lib/adm5120.sh - -set_state() { - case "$1" in - preinit) - status_led_blink_preinit - ;; - failsafe) - status_led_blink_failsafe - ;; - preinit_regular) - status_led_blink_preinit_regular - ;; - done) - status_led_on - ;; - esac -} diff --git a/target/linux/adm5120/base-files/etc/inittab b/target/linux/adm5120/base-files/etc/inittab deleted file mode 100644 index d81d5d943..000000000 --- a/target/linux/adm5120/base-files/etc/inittab +++ /dev/null @@ -1,5 +0,0 @@ -::sysinit:/etc/init.d/rcS S boot -::shutdown:/etc/init.d/rcS K shutdown -tts/0::askfirst:/usr/libexec/login.sh -ttyAM0::askfirst:/usr/libexec/login.sh -tty1::askfirst:/usr/libexec/login.sh diff --git a/target/linux/adm5120/base-files/lib/adm5120.sh b/target/linux/adm5120/base-files/lib/adm5120.sh deleted file mode 100755 index 496fc06f3..000000000 --- a/target/linux/adm5120/base-files/lib/adm5120.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2007 OpenWrt.org -# -# - -board_name="" -status_led="" -sys_mtd_part="" - -adm5120_detect() { - board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo) - - case "$board_name" in - "Cellvision"*) - status_led="status" - sys_mtd_part="firmware" - ;; - "Compex"*) - status_led="diag" - case "$board_name" in - *-WRT) - sys_mtd_part="trx" - ;; - *) - sys_mtd_part="partition1" - ;; - esac - ;; - "Edimax"*) - status_led="power" - sys_mtd_part="firmware" - ;; - "Infineon"*) - sys_mtd_part="firmware" - ;; - "Mikrotik"*) - status_led="power" - ;; - "ZyXEL"*) - status_led="power" - sys_mtd_part="trx" - ;; - "EB-214A"*) - status_led="power" - sys_mtd_part="firmware" - ;; - *) - ;; - esac -} - -adm5120_detect diff --git a/target/linux/adm5120/base-files/lib/preinit/01_preinit_do_adm5120.sh b/target/linux/adm5120/base-files/lib/preinit/01_preinit_do_adm5120.sh deleted file mode 100644 index 4fca1e71b..000000000 --- a/target/linux/adm5120/base-files/lib/preinit/01_preinit_do_adm5120.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -do_adm5120() { - . /lib/adm5120.sh -} - -boot_hook_add preinit_main do_adm5120 diff --git a/target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120 b/target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120 deleted file mode 100644 index ac2a7cbb6..000000000 --- a/target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120 +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set_preinit_ifname() { - ifname=eth0 -} - -boot_hook_add preinit_main set_preinit_ifname - - diff --git a/target/linux/adm5120/base-files/lib/upgrade/platform.sh b/target/linux/adm5120/base-files/lib/upgrade/platform.sh deleted file mode 100644 index b874a5e99..000000000 --- a/target/linux/adm5120/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2009-2010 OpenWrt.org -# - -. /lib/adm5120.sh - -PART_NAME="firmware" -RAMFS_COPY_DATA=/lib/adm5120.sh - -platform_check_image() { - local magic="$(get_magic_word "$1")" - - [ "$#" -gt 1 ] && return 1 - - case "$board_name" in - "ZyXEL"*|"Compex WP54 family") - # .trx files - [ "$magic" != "4844" ] && { - echo "Invalid image type." - return 1 - } - return 0 - ;; - *) - ;; - esac - - echo "Sysupgrade is not yet supported on $board_name." - return 1 -} - -platform_do_upgrade() { - PART_NAME="$sys_mtd_part" - default_do_upgrade "$ARGV" -} diff --git a/target/linux/adm5120/config-3.18 b/target/linux/adm5120/config-3.18 deleted file mode 100644 index 000424c2e..000000000 --- a/target/linux/adm5120/config-3.18 +++ /dev/null @@ -1,176 +0,0 @@ -CONFIG_ADM5120=y -CONFIG_ADM5120_ENET=y -CONFIG_ADM5120_MACH_5GXI=y -CONFIG_ADM5120_MACH_BR_6104K=y -CONFIG_ADM5120_MACH_BR_6104KP=y -CONFIG_ADM5120_MACH_BR_61X4WG=y -CONFIG_ADM5120_MACH_CAS_771=y -CONFIG_ADM5120_MACH_EASY5120P_ATA=y -CONFIG_ADM5120_MACH_EASY5120_RT=y -CONFIG_ADM5120_MACH_EASY5120_WVOIP=y -CONFIG_ADM5120_MACH_EASY83000=y -CONFIG_ADM5120_MACH_EB_214A=y -CONFIG_ADM5120_MACH_NFS_101=y -CONFIG_ADM5120_MACH_NP27G=y -CONFIG_ADM5120_MACH_NP28G=y -CONFIG_ADM5120_MACH_PMUGW=y -# CONFIG_ADM5120_MACH_RB_11X is not set -# CONFIG_ADM5120_MACH_RB_133 is not set -# CONFIG_ADM5120_MACH_RB_133C is not set -# CONFIG_ADM5120_MACH_RB_150 is not set -# CONFIG_ADM5120_MACH_RB_153 is not set -# CONFIG_ADM5120_MACH_RB_192 is not set -CONFIG_ADM5120_MACH_WP54=y -CONFIG_ADM5120_OEM_CELLVISION=y -CONFIG_ADM5120_OEM_COMPEX=y -CONFIG_ADM5120_OEM_EDIMAX=y -CONFIG_ADM5120_OEM_GENERIC=y -CONFIG_ADM5120_OEM_INFINEON=y -# CONFIG_ADM5120_OEM_MIKROTIK is not set -CONFIG_ADM5120_OEM_MOTOROLA=y -CONFIG_ADM5120_OEM_OSBRIDGE=y -# CONFIG_ADM5120_OEM_ZYXEL is not set -CONFIG_ADM5120_SOC_BGA=y -CONFIG_ADM5120_WDT=y -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -# CONFIG_ARCH_HAS_SG_CHAIN is not set -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARM_AMBA=y -CONFIG_BUILD_BIN2C=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="console=ttyAM0,115200 rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -CONFIG_CPU_MIPSR1=y -CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_R4K_FPU=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_EARLY_PRINTK=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_GPIO_SYSFS=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_BPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_INITRAMFS_SOURCE="" -# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set -CONFIG_IRQ_CPU=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -# CONFIG_LEDS_TRIGGER_ADM5120_SWITCH is not set -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=256 -CONFIG_MIPS=y -# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_MIPS_MACHINE=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MTD_ADM5120=y -CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_TRXSPLIT=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NO_EXCEPT_FILL=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_IOPORT_MAP is not set -CONFIG_PAGEFLAGS_EXTENDED=y -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PERF_USE_VMALLOC=y -# CONFIG_PREEMPT_RCU is not set -# CONFIG_RCU_STALL_COMMON is not set -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL010=y -CONFIG_SERIAL_AMBA_PL010_CONSOLE=y -CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 -# CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIO=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SWAP is not set -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_USB_SUPPORT=y -CONFIG_WATCHDOG_CORE=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/Kconfig b/target/linux/adm5120/files-3.18/arch/mips/adm5120/Kconfig deleted file mode 100644 index be35a8f72..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/Kconfig +++ /dev/null @@ -1,197 +0,0 @@ -if ADM5120 - -menu "ADM5120 Board selection" - -config ADM5120_MACH_CAS_771 - bool "Cellvision CAS-771/771W support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_CELLVISION - default y - -config ADM5120_MACH_NFS_101 - bool "Cellvision NFS-101U/101WU support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_CELLVISION - default y - -config ADM5120_MACH_NP27G - bool "Compex NP27G support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_COMPEX - default y - -config ADM5120_MACH_NP28G - bool "Compex NP28G support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_COMPEX - default y - -config ADM5120_MACH_WP54 - bool "Compex WP54 family support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_COMPEX - default y - -config ADM5120_MACH_EB_214A - bool "EB-214A support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_GENERIC - default y - -config ADM5120_MACH_BR_6104K - bool "Edimax BR-6104K support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_OEM_EDIMAX - default y - -config ADM5120_MACH_BR_6104KP - bool "Edimax BR-6104KP support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_OEM_EDIMAX - default y - -config ADM5120_MACH_BR_61X4WG - bool "Edimax BR-6104WG/6114WG support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_EDIMAX - default y - -config ADM5120_MACH_EASY5120_RT - bool "Infineon EASY 5120-RT Reference Board support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_INFINEON - default y - -config ADM5120_MACH_EASY5120_WVOIP - bool "Infineon EASY 5120-WVoIP Reference Board support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_INFINEON - default y - -config ADM5120_MACH_EASY5120P_ATA - bool "Infineon EASY 5120P-ATA Reference Board support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_OEM_INFINEON - default y - -config ADM5120_MACH_EASY83000 - bool "Infineon EASY 83000 Reference Board support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_OEM_INFINEON - default y - -config ADM5120_MACH_RB_11X - bool "MikroTik RouterBOARD 111/112 support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_MIKROTIK - default y - -config ADM5120_MACH_RB_133 - bool "MikroTik RouterBOARD 133 support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_MIKROTIK - default y - -config ADM5120_MACH_RB_133C - bool "MikroTik RouterBOARD 133C support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_MIKROTIK - default y - -config ADM5120_MACH_RB_150 - bool "MikroTik RouterBOARD 150 support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_OEM_MIKROTIK - default y - -config ADM5120_MACH_RB_153 - bool "MikroTik RouterBOARD 153 support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_MIKROTIK - default y - -config ADM5120_MACH_RB_192 - bool "MikroTik RouterBOARD 192 support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_MIKROTIK - default y - -config ADM5120_MACH_PMUGW - bool "Motorola Powerline MU Gateway" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_MOTOROLA - default y - -config ADM5120_MACH_5GXI - bool "OSBRiDGE 5GXi/5XLi support" - depends on CPU_LITTLE_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_OSBRIDGE - default y - -config ADM5120_MACH_P_334WT - bool "ZyXEL Prestige 334WT" - depends on CPU_BIG_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_ZYXEL - default y - -config ADM5120_MACH_P_335 - bool "ZyXEL Prestige 335/335WT" - depends on CPU_BIG_ENDIAN - select ADM5120_SOC_BGA - select ADM5120_OEM_ZYXEL - default y - -endmenu - -config ADM5120_SOC_BGA - select HW_HAS_PCI - def_bool n - -config ADM5120_OEM_CELLVISION - def_bool n - -config ADM5120_OEM_COMPEX - def_bool n - -config ADM5120_OEM_EDIMAX - def_bool n - -config ADM5120_OEM_GENERIC - def_bool n - -config ADM5120_OEM_INFINEON - def_bool n - -config ADM5120_OEM_MIKROTIK - def_bool n - -config ADM5120_OEM_MOTOROLA - def_bool n - -config ADM5120_OEM_OSBRIDGE - def_bool n - -config ADM5120_OEM_ZYXEL - def_bool n - -config ARM_AMBA - def_bool y - -endif diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/Platform b/target/linux/adm5120/files-3.18/arch/mips/adm5120/Platform deleted file mode 100644 index 0c9edf218..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/Platform +++ /dev/null @@ -1,19 +0,0 @@ -# -# Infineon/ADMtek ADM5120 -# - -platform-$(CONFIG_ADM5120) += adm5120/common/ - -platform-$(CONFIG_ADM5120_OEM_CELLVISION) += adm5120/cellvision/ -platform-$(CONFIG_ADM5120_OEM_COMPEX) += adm5120/compex/ -platform-$(CONFIG_ADM5120_OEM_EDIMAX) += adm5120/edimax/ -platform-$(CONFIG_ADM5120_OEM_GENERIC) += adm5120/generic/ -platform-$(CONFIG_ADM5120_OEM_INFINEON) += adm5120/infineon/ -platform-$(CONFIG_ADM5120_OEM_MIKROTIK) += adm5120/mikrotik/ -platform-$(CONFIG_ADM5120_OEM_MOTOROLA) += adm5120/motorola/ -platform-$(CONFIG_ADM5120_OEM_OSBRIDGE) += adm5120/osbridge/ -platform-$(CONFIG_ADM5120_OEM_ZYXEL) += adm5120/zyxel/ - -cflags-$(CONFIG_ADM5120) += -I$(srctree)/arch/mips/include/asm/mach-adm5120 -libs-$(CONFIG_ADM5120) += arch/mips/adm5120/prom/ -load-$(CONFIG_ADM5120) += 0xffffffff80001000 diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/Makefile deleted file mode 100644 index a949fc9f6..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -obj-y += cellvision.o - -obj-$(CONFIG_ADM5120_MACH_CAS_771) += cas-771.o -obj-$(CONFIG_ADM5120_MACH_NFS_101) += nfs-101.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cas-771.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cas-771.c deleted file mode 100644 index 5033e0246..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cas-771.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Cellvision/SparkLAN CAS-771/771W support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "cellvision.h" - -static struct adm5120_pci_irq cas771_pci_irqs[] __initdata = { - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), - PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1), - PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2) -}; - -static struct gpio_led cas771_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_PIN0, "cam_flash", NULL), - /* GPIO PIN3 is the reset */ - GPIO_LED_STD(ADM5120_GPIO_PIN6, "access", NULL), - GPIO_LED_STD(ADM5120_GPIO_P0L1, "status", NULL), - GPIO_LED_STD(ADM5120_GPIO_P0L2, "diag", NULL), -}; - -static void __init cas771_setup(void) -{ - cas7xx_setup(); - adm5120_add_device_gpio_leds(ARRAY_SIZE(cas771_gpio_leds), - cas771_gpio_leds); - adm5120_pci_set_irq_map(ARRAY_SIZE(cas771_pci_irqs), cas771_pci_irqs); -} - -MIPS_MACHINE(MACH_ADM5120_CAS771, "CAS-771", "Cellvision CAS-771/771W", - cas771_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.c deleted file mode 100644 index a7cedf03b..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Cellvision/SparkLAN boards - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "cellvision.h" - -#include - -#define CELLVISION_GPIO_FLASH_A20 ADM5120_GPIO_PIN5 -#define CELLVISION_GPIO_DEV_MASK (1 << CELLVISION_GPIO_FLASH_A20) - -#define CELLVISION_CONFIG_OFFSET 0x8000 -#define CELLVISION_CONFIG_SIZE 0x1000 - -static struct mtd_partition cas6xx_partitions[] = { - { - .name = "admboot", - .offset = 0, - .size = 32*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "config", - .offset = MTDPART_OFS_APPEND, - .size = 32*1024, - } , { - .name = "nvfs1", - .offset = MTDPART_OFS_APPEND, - .size = 64*1024, - } , { - .name = "nvfs2", - .offset = MTDPART_OFS_APPEND, - .size = 64*1024, - } , { - .name = "firmware", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } -}; - -static struct mtd_partition cas7xx_partitions[] = { - { - .name = "admboot", - .offset = 0, - .size = 32*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "config", - .offset = MTDPART_OFS_APPEND, - .size = 32*1024, - } , { - .name = "nvfs", - .offset = MTDPART_OFS_APPEND, - .size = 128*1024, - } , { - .name = "firmware", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } -}; - -static void switch_bank_gpio5(unsigned bank) -{ - switch (bank) { - case 0: - gpio_set_value(CELLVISION_GPIO_FLASH_A20, 0); - break; - case 1: - gpio_set_value(CELLVISION_GPIO_FLASH_A20, 1); - break; - } -} - -static void __init cellvision_flash_setup(void) -{ - /* setup flash A20 line */ - gpio_request(CELLVISION_GPIO_FLASH_A20, NULL); - gpio_direction_output(CELLVISION_GPIO_FLASH_A20, 0); - - adm5120_flash0_data.switch_bank = switch_bank_gpio5; - adm5120_add_device_flash(0); -} - -void __init cellvision_mac_setup(void) -{ - u8 mac_base[6]; - int err; - - err = admboot_get_mac_base(CELLVISION_CONFIG_OFFSET, - CELLVISION_CONFIG_SIZE, mac_base); - - if ((err) || !is_valid_ether_addr(mac_base)) - random_ether_addr(mac_base); - - adm5120_setup_eth_macs(mac_base); -} - -void __init cas6xx_flash_setup(void) -{ - adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions); - adm5120_flash0_data.parts = cas6xx_partitions; - - cellvision_flash_setup(); -} - -void __init cas7xx_flash_setup(void) -{ - adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions); - adm5120_flash0_data.parts = cas7xx_partitions; - - cellvision_flash_setup(); -} - -void __init cas6xx_setup(void) -{ - cas6xx_flash_setup(); - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - adm5120_add_device_switch(1, NULL); -} - -MIPS_MACHINE(MACH_ADM5120_CAS630, "CAS-630", "Cellvision CAS-630/630W", - cas6xx_setup); -MIPS_MACHINE(MACH_ADM5120_CAS670, "CAS-670", "Cellvision CAS-670/670W", - cas6xx_setup); - -void __init cas7xx_setup(void) -{ - cas7xx_flash_setup(); - cellvision_mac_setup(); - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - adm5120_add_device_switch(1, NULL); -} - -MIPS_MACHINE(MACH_ADM5120_CAS700, "CAS-700", "Cellvision CAS-700/700W", - cas7xx_setup); -MIPS_MACHINE(MACH_ADM5120_CAS790, "CAS-790", "Cellvision CAS-790", - cas7xx_setup); -MIPS_MACHINE(MACH_ADM5120_CAS861, "CAS-861", "Cellvision CAS-861/861W", - cas7xx_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.h deleted file mode 100644 index 2b55ebf76..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/cellvision.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Cellvision/SparkLAN boards - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include - -#include - -#include -#include - -extern void cellvision_mac_setup(void) __init; - -extern void cas6xx_flash_setup(void) __init; -extern void cas7xx_flash_setup(void) __init; -extern void cas6xx_setup(void) __init; -extern void cas7xx_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/nfs-101.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/nfs-101.c deleted file mode 100644 index 7d214c090..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/cellvision/nfs-101.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Cellvision/SparkLAN NFS-101U/WU support - * - * Copyright (C) 2007-2009 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "cellvision.h" - -static struct adm5120_pci_irq nfs101_pci_irqs[] __initdata = { - /* miniPCI slot */ - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), - - /* ALi USB controller */ - PCIIRQ(3, 0, 2, ADM5120_IRQ_PCI2), - PCIIRQ(3, 3, 1, ADM5120_IRQ_PCI1), - - /* NEC USB controller */ - PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1), - PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI2), - PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2), -}; - -static u8 nfs101_vlans[6] __initdata = { - /* FIXME: not tested */ - 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static void __init nfs101_setup(void) -{ - cas6xx_flash_setup(); - cellvision_mac_setup(); - - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - adm5120_add_device_switch(1, nfs101_vlans); - - adm5120_pci_set_irq_map(ARRAY_SIZE(nfs101_pci_irqs), - nfs101_pci_irqs); -} - -MIPS_MACHINE(MACH_ADM5120_NFS101U, "NFS-101U", "Cellvision NFS-101U/101WU", - nfs101_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/Makefile deleted file mode 100644 index 8d302c593..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# Makefile for the Infineon/ADMtek ADM5120 SoC specific parts of the kernel -# - -obj-y := adm5120.o setup.o prom.o irq.o memory.o clock.o \ - gpio.o platform.o - -obj-$(CONFIG_EARLY_PRINTK) += early-printk.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/adm5120.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/adm5120.c deleted file mode 100644 index 28388342c..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/adm5120.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include - -#include - -#include -#include -#include - -unsigned int adm5120_product_code; -unsigned int adm5120_revision; -unsigned int adm5120_package; -unsigned int adm5120_nand_boot; -unsigned long adm5120_speed; - -/* - * CPU settings detection - */ -#define CODE_GET_PC(c) ((c) & CODE_PC_MASK) -#define CODE_GET_REV(c) (((c) >> CODE_REV_SHIFT) & CODE_REV_MASK) -#define CODE_GET_PK(c) (((c) >> CODE_PK_SHIFT) & CODE_PK_MASK) -#define CODE_GET_CLKS(c) (((c) >> CODE_CLKS_SHIFT) & CODE_CLKS_MASK) -#define CODE_GET_NAB(c) (((c) & CODE_NAB) != 0) - -void adm5120_ndelay(u32 ns) -{ - u32 t; - - SW_WRITE_REG(SWITCH_REG_TIMER, TIMER_PERIOD_DEFAULT); - SW_WRITE_REG(SWITCH_REG_TIMER_INT, (TIMER_INT_TOS | TIMER_INT_TOM)); - - t = (ns+640) / 640; - t &= TIMER_PERIOD_MASK; - SW_WRITE_REG(SWITCH_REG_TIMER, t | TIMER_TE); - - /* wait until the timer expires */ - do { - t = SW_READ_REG(SWITCH_REG_TIMER_INT); - } while ((t & TIMER_INT_TOS) == 0); - - /* leave the timer disabled */ - SW_WRITE_REG(SWITCH_REG_TIMER, TIMER_PERIOD_DEFAULT); - SW_WRITE_REG(SWITCH_REG_TIMER_INT, (TIMER_INT_TOS | TIMER_INT_TOM)); -} - -void __init adm5120_soc_init(void) -{ - u32 code; - u32 clks; - - code = SW_READ_REG(SWITCH_REG_CODE); - - adm5120_product_code = CODE_GET_PC(code); - adm5120_revision = CODE_GET_REV(code); - adm5120_package = (CODE_GET_PK(code) == CODE_PK_BGA) ? - ADM5120_PACKAGE_BGA : ADM5120_PACKAGE_PQFP; - adm5120_nand_boot = CODE_GET_NAB(code); - - clks = CODE_GET_CLKS(code); - adm5120_speed = ADM5120_SPEED_175; - if (clks & 1) - adm5120_speed += 25000000; - if (clks & 2) - adm5120_speed += 50000000; -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/clock.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/clock.c deleted file mode 100644 index 52ae64c41..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/clock.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * ADM5120 minimal CLK API implementation - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was based on the CLK API implementation in: - * arch/mips/tx4938/toshiba_rbtx4938/setup.c - * Copyright (C) 2000-2001 Toshiba Corporation - * 2003-2005 (c) MontaVista Software, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include - -#include - -struct clk { - unsigned long rate; -}; - -static struct clk uart_clk = { - .rate = ADM5120_UART_CLOCK -}; - -struct clk *clk_get(struct device *dev, const char *id) -{ - const char *name = dev_name(dev); - - if (!strcmp(name, "apb:uart0") || !strcmp(name, "apb:uart1")) - return &uart_clk; - - return ERR_PTR(-ENOENT); -} -EXPORT_SYMBOL(clk_get); - -int clk_enable(struct clk *clk) -{ - return 0; -} -EXPORT_SYMBOL(clk_enable); - -void clk_disable(struct clk *clk) -{ -} -EXPORT_SYMBOL(clk_disable); - -unsigned long clk_get_rate(struct clk *clk) -{ - return clk->rate; -} -EXPORT_SYMBOL(clk_get_rate); - -void clk_put(struct clk *clk) -{ -} -EXPORT_SYMBOL(clk_put); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/early-printk.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/early-printk.c deleted file mode 100644 index d90071263..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/early-printk.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * ADM5120 specific early printk support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include - -#include -#include -#include - -#define UART_READ(r) \ - __raw_readl((void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))) -#define UART_WRITE(r, v) \ - __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r))) - -void __init prom_putchar(char ch) -{ - while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0) - ; - UART_WRITE(UART_REG_DATA, ch); - while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0) - ; -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/gpio.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/gpio.c deleted file mode 100644 index 461ea15e8..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/gpio.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * ADM5120 generic GPIO API support via GPIOLIB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#define GPIO_REG(r) (void __iomem *)(KSEG1ADDR(ADM5120_SWITCH_BASE) + r) - -struct gpio1_desc { - void __iomem *reg; /* register address */ - u8 iv_shift; /* shift amount for input bit */ - u8 mode_shift; /* shift amount for mode bits */ -}; - -#define GPIO1_DESC(p, l) { \ - .reg = GPIO_REG(SWITCH_REG_PORT0_LED + ((p) * 4)), \ - .iv_shift = LED0_IV_SHIFT + (l), \ - .mode_shift = (l) * 4 \ - } - -static struct gpio1_desc gpio1_table[15] = { - GPIO1_DESC(0, 0), GPIO1_DESC(0, 1), GPIO1_DESC(0, 2), - GPIO1_DESC(1, 0), GPIO1_DESC(1, 1), GPIO1_DESC(1, 2), - GPIO1_DESC(2, 0), GPIO1_DESC(2, 1), GPIO1_DESC(2, 2), - GPIO1_DESC(3, 0), GPIO1_DESC(3, 1), GPIO1_DESC(3, 2), - GPIO1_DESC(4, 0), GPIO1_DESC(4, 1), GPIO1_DESC(4, 2) -}; - -static u32 gpio_conf2; - -int adm5120_gpio_to_irq(unsigned gpio) -{ - int ret; - - switch (gpio) { - case ADM5120_GPIO_PIN2: - ret = ADM5120_IRQ_GPIO2; - break; - case ADM5120_GPIO_PIN4: - ret = ADM5120_IRQ_GPIO4; - break; - default: - ret = -EINVAL; - break; - } - - return ret; -} -EXPORT_SYMBOL(adm5120_gpio_to_irq); - -int adm5120_irq_to_gpio(unsigned irq) -{ - int ret; - - switch (irq) { - case ADM5120_IRQ_GPIO2: - ret = ADM5120_GPIO_PIN2; - break; - case ADM5120_IRQ_GPIO4: - ret = ADM5120_GPIO_PIN4; - break; - default: - ret = -EINVAL; - break; - } - - return ret; -} -EXPORT_SYMBOL(adm5120_irq_to_gpio); - -/* - * Helpers for GPIO lines in GPIO_CONF0 register - */ -#define PIN_IM(p) ((1 << GPIO_CONF0_IM_SHIFT) << p) -#define PIN_IV(p) ((1 << GPIO_CONF0_IV_SHIFT) << p) -#define PIN_OE(p) ((1 << GPIO_CONF0_OE_SHIFT) << p) -#define PIN_OV(p) ((1 << GPIO_CONF0_OV_SHIFT) << p) - -int __adm5120_gpio0_get_value(unsigned offset) -{ - void __iomem **reg; - u32 t; - - reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); - - t = __raw_readl(reg); - if ((t & PIN_IM(offset)) != 0) - t &= PIN_IV(offset); - else - t &= PIN_OV(offset); - - return (t) ? 1 : 0; -} -EXPORT_SYMBOL(__adm5120_gpio0_get_value); - -void __adm5120_gpio0_set_value(unsigned offset, int value) -{ - void __iomem **reg; - u32 t; - - reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); - - t = __raw_readl(reg); - if (value == 0) - t &= ~(PIN_OV(offset)); - else - t |= PIN_OV(offset); - - __raw_writel(t, reg); -} -EXPORT_SYMBOL(__adm5120_gpio0_set_value); - -static int adm5120_gpio0_get_value(struct gpio_chip *chip, unsigned offset) -{ - return __adm5120_gpio0_get_value(offset); -} - -static void adm5120_gpio0_set_value(struct gpio_chip *chip, - unsigned offset, int value) -{ - __adm5120_gpio0_set_value(offset, value); -} - -static int adm5120_gpio0_direction_input(struct gpio_chip *chip, - unsigned offset) -{ - void __iomem **reg; - u32 t; - - reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); - - t = __raw_readl(reg); - t &= ~(PIN_OE(offset)); - t |= PIN_IM(offset); - __raw_writel(t, reg); - - return 0; -} - -static int adm5120_gpio0_direction_output(struct gpio_chip *chip, - unsigned offset, int value) -{ - void __iomem **reg; - u32 t; - - reg = GPIO_REG(SWITCH_REG_GPIO_CONF0); - - t = __raw_readl(reg); - t &= ~(PIN_IM(offset) | PIN_OV(offset)); - t |= PIN_OE(offset); - - if (value) - t |= PIN_OV(offset); - - __raw_writel(t, reg); - - return 0; -} - -static struct gpio_chip adm5120_gpio0_chip = { - .label = "adm5120 gpio0", - .get = adm5120_gpio0_get_value, - .set = adm5120_gpio0_set_value, - .direction_input = adm5120_gpio0_direction_input, - .direction_output = adm5120_gpio0_direction_output, - .base = ADM5120_GPIO_PIN0, - .ngpio = ADM5120_GPIO_PIN7 - ADM5120_GPIO_PIN0 + 1, -}; - -int __adm5120_gpio1_get_value(unsigned offset) -{ - void __iomem **reg; - u32 t, m; - - reg = gpio1_table[offset].reg; - - t = __raw_readl(reg); - m = (t >> gpio1_table[offset].mode_shift) & LED_MODE_MASK; - if (m == LED_MODE_INPUT) - return (t >> gpio1_table[offset].iv_shift) & 1; - - if (m == LED_MODE_OUT_LOW) - return 0; - - return 1; -} -EXPORT_SYMBOL(__adm5120_gpio1_get_value); - -void __adm5120_gpio1_set_value(unsigned offset, int value) -{ - void __iomem **reg; - u32 t, s; - - reg = gpio1_table[offset].reg; - s = gpio1_table[offset].mode_shift; - - t = __raw_readl(reg); - t &= ~(LED_MODE_MASK << s); - - switch (value) { - case ADM5120_GPIO_LOW: - t |= (LED_MODE_OUT_LOW << s); - break; - case ADM5120_GPIO_FLASH: - case ADM5120_GPIO_LINK: - case ADM5120_GPIO_SPEED: - case ADM5120_GPIO_DUPLEX: - case ADM5120_GPIO_ACT: - case ADM5120_GPIO_COLL: - case ADM5120_GPIO_LINK_ACT: - case ADM5120_GPIO_DUPLEX_COLL: - case ADM5120_GPIO_10M_ACT: - case ADM5120_GPIO_100M_ACT: - t |= ((value & LED_MODE_MASK) << s); - break; - default: - t |= (LED_MODE_OUT_HIGH << s); - break; - } - - __raw_writel(t, reg); -} -EXPORT_SYMBOL(__adm5120_gpio1_set_value); - -static int adm5120_gpio1_get_value(struct gpio_chip *chip, unsigned offset) -{ - return __adm5120_gpio1_get_value(offset); -} - -static void adm5120_gpio1_set_value(struct gpio_chip *chip, - unsigned offset, int value) -{ - __adm5120_gpio1_set_value(offset, value); -} - -static int adm5120_gpio1_direction_input(struct gpio_chip *chip, - unsigned offset) -{ - void __iomem **reg; - u32 t; - - reg = gpio1_table[offset].reg; - t = __raw_readl(reg); - t &= ~(LED_MODE_MASK << gpio1_table[offset].mode_shift); - __raw_writel(t, reg); - - return 0; -} - -static int adm5120_gpio1_direction_output(struct gpio_chip *chip, - unsigned offset, int value) -{ - __adm5120_gpio1_set_value(offset, value); - return 0; -} - -static struct gpio_chip adm5120_gpio1_chip = { - .label = "adm5120 gpio1", - .get = adm5120_gpio1_get_value, - .set = adm5120_gpio1_set_value, - .direction_input = adm5120_gpio1_direction_input, - .direction_output = adm5120_gpio1_direction_output, - .base = ADM5120_GPIO_P0L0, - .ngpio = ADM5120_GPIO_P4L2 - ADM5120_GPIO_P0L0 + 1, -}; - -void __init adm5120_gpio_csx0_enable(void) -{ - gpio_conf2 |= GPIO_CONF2_CSX0; - SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2); - - gpio_request(ADM5120_GPIO_PIN1, "CSX0"); -} - -void __init adm5120_gpio_csx1_enable(void) -{ - gpio_conf2 |= GPIO_CONF2_CSX1; - SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2); - - gpio_request(ADM5120_GPIO_PIN3, "CSX1"); -} - -void __init adm5120_gpio_ew_enable(void) -{ - gpio_conf2 |= GPIO_CONF2_EW; - SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2); - - gpio_request(ADM5120_GPIO_PIN0, "EW"); -} - -void __init adm5120_gpio_init(void) -{ - int err; - - SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2); - - if (adm5120_package_pqfp()) - adm5120_gpio0_chip.ngpio = 4; - - err = gpiochip_add(&adm5120_gpio0_chip); - if (err) - panic("cannot add ADM5120 GPIO0 chip, error=%d", err); - - err = gpiochip_add(&adm5120_gpio1_chip); - if (err) - panic("cannot add ADM5120 GPIO1 chip, error=%d", err); - -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/irq.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/irq.c deleted file mode 100644 index a26e65176..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/irq.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * ADM5120 specific interrupt handlers - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -static void adm5120_intc_irq_unmask(struct irq_data *d); -static void adm5120_intc_irq_mask(struct irq_data *d); -static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type); - -static inline void intc_write_reg(unsigned int reg, u32 val) -{ - void __iomem *base = (void __iomem *)KSEG1ADDR(ADM5120_INTC_BASE); - - __raw_writel(val, base + reg); -} - -static inline u32 intc_read_reg(unsigned int reg) -{ - void __iomem *base = (void __iomem *)KSEG1ADDR(ADM5120_INTC_BASE); - - return __raw_readl(base + reg); -} - -static struct irq_chip adm5120_intc_irq_chip = { - .name = "INTC", - .irq_unmask = adm5120_intc_irq_unmask, - .irq_mask = adm5120_intc_irq_mask, - .irq_mask_ack = adm5120_intc_irq_mask, - .irq_set_type = adm5120_intc_irq_set_type -}; - -static struct irqaction adm5120_intc_irq_action = { - .handler = no_action, - .name = "cascade [INTC]" -}; - -static void adm5120_intc_irq_unmask(struct irq_data *d) -{ - intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE)); -} - -static void adm5120_intc_irq_mask(struct irq_data *d) -{ - intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE)); -} - -static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type) -{ - unsigned int irq = d->irq; - unsigned int sense; - unsigned long mode; - int err = 0; - - sense = flow_type & (IRQ_TYPE_SENSE_MASK); - switch (sense) { - case IRQ_TYPE_NONE: - case IRQ_TYPE_LEVEL_HIGH: - break; - case IRQ_TYPE_LEVEL_LOW: - switch (irq) { - case ADM5120_IRQ_GPIO2: - case ADM5120_IRQ_GPIO4: - break; - default: - err = -EINVAL; - break; - } - break; - default: - err = -EINVAL; - break; - } - - if (err) - return err; - - switch (irq) { - case ADM5120_IRQ_GPIO2: - case ADM5120_IRQ_GPIO4: - mode = intc_read_reg(INTC_REG_INT_MODE); - if (sense == IRQ_TYPE_LEVEL_LOW) - mode |= (1 << (irq - ADM5120_INTC_IRQ_BASE)); - else - mode &= ~(1 << (irq - ADM5120_INTC_IRQ_BASE)); - - intc_write_reg(INTC_REG_INT_MODE, mode); - break; - } - - return 0; -} - -static void adm5120_intc_irq_dispatch(void) -{ - unsigned long status; - int irq; - - status = intc_read_reg(INTC_REG_IRQ_STATUS) & INTC_INT_ALL; - if (status) { - irq = ADM5120_INTC_IRQ_BASE + fls(status) - 1; - do_IRQ(irq); - } else - spurious_interrupt(); -} - -asmlinkage void plat_irq_dispatch(void) -{ - unsigned long pending; - - pending = read_c0_status() & read_c0_cause() & ST0_IM; - - if (pending & STATUSF_IP7) - do_IRQ(ADM5120_IRQ_COUNTER); - else if (pending & STATUSF_IP2) - adm5120_intc_irq_dispatch(); - else - spurious_interrupt(); -} - -#define INTC_IRQ_STATUS (IRQ_LEVEL | IRQ_TYPE_LEVEL_HIGH | IRQ_DISABLED) -static void __init adm5120_intc_irq_init(void) -{ - int i; - - /* disable all interrupts */ - intc_write_reg(INTC_REG_IRQ_DISABLE, INTC_INT_ALL); - - /* setup all interrupts to generate IRQ instead of FIQ */ - intc_write_reg(INTC_REG_INT_MODE, 0); - - /* set active level for all external interrupts to HIGH */ - intc_write_reg(INTC_REG_INT_LEVEL, 0); - - /* disable usage of the TEST_SOURCE register */ - intc_write_reg(INTC_REG_IRQ_SOURCE_SELECT, 0); - - for (i = ADM5120_INTC_IRQ_BASE; - i <= ADM5120_INTC_IRQ_BASE + INTC_IRQ_LAST; - i++) { - irq_set_chip_and_handler(i, &adm5120_intc_irq_chip, - handle_level_irq); - } - - setup_irq(ADM5120_IRQ_INTC, &adm5120_intc_irq_action); -} - -void __init arch_init_irq(void) -{ - mips_cpu_irq_init(); - adm5120_intc_irq_init(); -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/memory.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/memory.c deleted file mode 100644 index d07266fa3..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/memory.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#ifdef DEBUG -# define mem_dbg(f, a...) printk(KERN_INFO "mem_detect: " f, ## a) -#else -# define mem_dbg(f, a...) -#endif - -unsigned long adm5120_memsize; - -#define MEM_READL(a) __raw_readl((void __iomem *)(a)) -#define MEM_WRITEL(a, v) __raw_writel((v), (void __iomem *)(a)) - -static int __init mem_check_pattern(u8 *addr, unsigned long offs) -{ - u32 *p1 = (u32 *)addr; - u32 *p2 = (u32 *)(addr+offs); - u32 t, u, v; - - /* save original value */ - t = MEM_READL(p1); - - u = MEM_READL(p2); - if (t != u) - return 0; - - v = 0x55555555; - if (u == v) - v = 0xAAAAAAAA; - - mem_dbg("write 0x%08X to 0x%08lX\n", v, (unsigned long)p1); - - MEM_WRITEL(p1, v); - adm5120_ndelay(1000); - u = MEM_READL(p2); - - mem_dbg("pattern at 0x%08lX is 0x%08X\n", (unsigned long)p2, u); - - /* restore original value */ - MEM_WRITEL(p1, t); - - return (v == u); -} - -static void __init adm5120_detect_memsize(void) -{ - u32 memctrl; - u32 size, maxsize; - u8 *p; - - memctrl = SW_READ_REG(SWITCH_REG_MEMCTRL); - switch (memctrl & MEMCTRL_SDRS_MASK) { - case MEMCTRL_SDRS_4M: - maxsize = 4 << 20; - break; - case MEMCTRL_SDRS_8M: - maxsize = 8 << 20; - break; - case MEMCTRL_SDRS_16M: - maxsize = 16 << 20; - break; - default: - maxsize = 64 << 20; - break; - } - - mem_dbg("checking for %uMB chip in 1st bank\n", maxsize >> 20); - - /* detect size of the 1st SDRAM bank */ - p = (u8 *)KSEG1ADDR(0); - for (size = 2<<20; size <= (maxsize >> 1); size <<= 1) { - if (mem_check_pattern(p, size)) { - /* mirrored address */ - mem_dbg("mirrored data found at offset 0x%08X\n", size); - break; - } - } - - mem_dbg("chip size in 1st bank is %uMB\n", size >> 20); - adm5120_memsize = size; - - if (size != maxsize) - /* 2nd bank is not supported */ - goto out; - - if ((memctrl & MEMCTRL_SDR1_ENABLE) == 0) - /* 2nd bank is disabled */ - goto out; - - /* - * some bootloaders enable 2nd bank, even if the 2nd SDRAM chip - * are missing. - */ - mem_dbg("check presence of 2nd bank\n"); - - p = (u8 *)KSEG1ADDR(maxsize+size-4); - if (mem_check_pattern(p, 0)) - adm5120_memsize += size; - - if (maxsize != size) { - /* adjusting MECTRL register */ - memctrl &= ~(MEMCTRL_SDRS_MASK); - switch (size>>20) { - case 4: - memctrl |= MEMCTRL_SDRS_4M; - break; - case 8: - memctrl |= MEMCTRL_SDRS_8M; - break; - case 16: - memctrl |= MEMCTRL_SDRS_16M; - break; - default: - memctrl |= MEMCTRL_SDRS_64M; - break; - } - SW_WRITE_REG(SWITCH_REG_MEMCTRL, memctrl); - } - -out: - mem_dbg("%dx%uMB memory found\n", (adm5120_memsize == size) ? 1 : 2 , - size>>20); -} - -void __init adm5120_mem_init(void) -{ - adm5120_detect_memsize(); - add_memory_region(0, adm5120_memsize, BOOT_MEM_RAM); -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/platform.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/platform.c deleted file mode 100644 index bdbfbcbae..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/platform.c +++ /dev/null @@ -1,375 +0,0 @@ -/* - * ADM5120 generic platform devices - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#if 1 -/* - * TODO:remove global adm5120_eth* variables when the switch driver will be - * converted into a real platform driver - */ -unsigned int adm5120_eth_num_ports = 6; -EXPORT_SYMBOL_GPL(adm5120_eth_num_ports); - -unsigned char adm5120_eth_macs[6][6] = { - {'\00', 'A', 'D', 'M', '\x51', '\x20' }, - {'\00', 'A', 'D', 'M', '\x51', '\x21' }, - {'\00', 'A', 'D', 'M', '\x51', '\x22' }, - {'\00', 'A', 'D', 'M', '\x51', '\x23' }, - {'\00', 'A', 'D', 'M', '\x51', '\x24' }, - {'\00', 'A', 'D', 'M', '\x51', '\x25' } -}; -EXPORT_SYMBOL_GPL(adm5120_eth_macs); - -unsigned char adm5120_eth_vlans[6] = { - 0x41, 0x42, 0x44, 0x48, 0x50, 0x60 -}; -EXPORT_SYMBOL_GPL(adm5120_eth_vlans); -#endif - -void __init adm5120_setup_eth_macs(u8 *mac_base) -{ - u32 t; - int i, j; - - t = ((u32) mac_base[3] << 16) | ((u32) mac_base[4] << 8) - | ((u32) mac_base[5]); - - for (i = 0; i < ARRAY_SIZE(adm5120_eth_macs); i++) { - for (j = 0; j < 3; j++) - adm5120_eth_macs[i][j] = mac_base[j]; - - adm5120_eth_macs[i][3] = (t >> 16) & 0xff; - adm5120_eth_macs[i][4] = (t >> 8) & 0xff; - adm5120_eth_macs[i][5] = t & 0xff; - - t++; - } -} - -/* - * Built-in ethernet switch - */ -struct resource adm5120_switch_resources[] = { - [0] = { - .start = ADM5120_SWITCH_BASE, - .end = ADM5120_SWITCH_BASE+ADM5120_SWITCH_SIZE-1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = ADM5120_IRQ_SWITCH, - .end = ADM5120_IRQ_SWITCH, - .flags = IORESOURCE_IRQ, - }, -}; - -struct adm5120_switch_platform_data adm5120_switch_data; -struct platform_device adm5120_switch_device = { - .name = "adm5120-switch", - .id = -1, - .num_resources = ARRAY_SIZE(adm5120_switch_resources), - .resource = adm5120_switch_resources, - .dev.platform_data = &adm5120_switch_data, -}; - -void __init adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map) -{ - if (num_ports > 0) - adm5120_eth_num_ports = num_ports; - - if (vlan_map) - memcpy(adm5120_eth_vlans, vlan_map, sizeof(adm5120_eth_vlans)); - - platform_device_register(&adm5120_switch_device); -} - -/* - * USB Host Controller - */ -struct resource adm5120_hcd_resources[] = { - [0] = { - .start = ADM5120_USBC_BASE, - .end = ADM5120_USBC_BASE+ADM5120_USBC_SIZE-1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = ADM5120_IRQ_USBC, - .end = ADM5120_IRQ_USBC, - .flags = IORESOURCE_IRQ, - }, -}; - -static u64 adm5120_hcd_dma_mask = DMA_BIT_MASK(24); -struct platform_device adm5120_hcd_device = { - .name = "adm5120-hcd", - .id = -1, - .num_resources = ARRAY_SIZE(adm5120_hcd_resources), - .resource = adm5120_hcd_resources, - .dev = { - .dma_mask = &adm5120_hcd_dma_mask, - .coherent_dma_mask = DMA_BIT_MASK(24), - } -}; - -void __init adm5120_add_device_usb(void) -{ - platform_device_register(&adm5120_hcd_device); -} - -/* - * NOR flash devices - */ -struct adm5120_flash_platform_data adm5120_flash0_data; -struct platform_device adm5120_flash0_device = { - .name = "adm5120-flash", - .id = 0, - .dev.platform_data = &adm5120_flash0_data, -}; - -struct adm5120_flash_platform_data adm5120_flash1_data; -struct platform_device adm5120_flash1_device = { - .name = "adm5120-flash", - .id = 1, - .dev.platform_data = &adm5120_flash1_data, -}; - -void __init adm5120_add_device_flash(unsigned id) -{ - struct platform_device *pdev; - - switch (id) { - case 0: - pdev = &adm5120_flash0_device; - break; - case 1: - pdev = &adm5120_flash1_device; - break; - default: - pdev = NULL; - break; - } - - if (pdev) - platform_device_register(pdev); -} - -/* - * built-in UARTs - */ -static void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base, - unsigned int mctrl) -{ -} - -struct amba_pl010_data adm5120_uart0_data = { - .set_mctrl = adm5120_uart_set_mctrl -}; - -struct amba_device adm5120_uart0_device = { - .dev = { - .init_name = "apb:uart0", - .platform_data = &adm5120_uart0_data, - }, - .res = { - .start = ADM5120_UART0_BASE, - .end = ADM5120_UART0_BASE + ADM5120_UART_SIZE - 1, - .flags = IORESOURCE_MEM, - }, - .irq = { ADM5120_IRQ_UART0, 0 }, - .periphid = 0x0041010, -}; - -struct amba_pl010_data adm5120_uart1_data = { - .set_mctrl = adm5120_uart_set_mctrl -}; - -struct amba_device adm5120_uart1_device = { - .dev = { - .init_name = "apb:uart1", - .platform_data = &adm5120_uart1_data, - }, - .res = { - .start = ADM5120_UART1_BASE, - .end = ADM5120_UART1_BASE + ADM5120_UART_SIZE - 1, - .flags = IORESOURCE_MEM, - }, - .irq = { ADM5120_IRQ_UART1, 0 }, - .periphid = 0x0041010, -}; - -void __init adm5120_add_device_uart(unsigned id) -{ - struct amba_device *dev; - - switch (id) { - case 0: - dev = &adm5120_uart0_device; - break; - case 1: - dev = &adm5120_uart1_device; - break; - default: - dev = NULL; - break; - } - - if (dev) - amba_device_register(dev, &iomem_resource); -} - -/* - * GPIO buttons - */ -void __init adm5120_register_gpio_buttons(int id, - unsigned poll_interval, - unsigned nbuttons, - struct gpio_keys_button *buttons) -{ - struct platform_device *pdev; - struct gpio_keys_platform_data pdata; - struct gpio_keys_button *p; - int err; - - p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL); - if (!p) - return; - - pdev = platform_device_alloc("gpio-keys-polled", id); - if (!pdev) - goto err_free_buttons; - - memset(&pdata, 0, sizeof(pdata)); - pdata.poll_interval = poll_interval; - pdata.nbuttons = nbuttons; - pdata.buttons = p; - - err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); - if (err) - goto err_put_pdev; - - err = platform_device_add(pdev); - if (err) - goto err_put_pdev; - - return; - -err_put_pdev: - platform_device_put(pdev); - -err_free_buttons: - kfree(p); -} - -/* - * GPIO LEDS - */ -struct gpio_led_platform_data adm5120_gpio_leds_data; -struct platform_device adm5120_gpio_leds_device = { - .name = "leds-gpio", - .id = -1, - .dev.platform_data = &adm5120_gpio_leds_data, -}; - -void __init adm5120_add_device_gpio_leds(unsigned num_leds, - struct gpio_led *leds) -{ - struct gpio_led *p; - - p = kmalloc(num_leds * sizeof(*p), GFP_KERNEL); - if (!p) - return; - - memcpy(p, leds, num_leds * sizeof(*p)); - adm5120_gpio_leds_data.num_leds = num_leds; - adm5120_gpio_leds_data.leds = p; - - platform_device_register(&adm5120_gpio_leds_device); -} - -/* - * NAND flash - */ -struct resource adm5120_nand_resources[] = { - [0] = { - .start = ADM5120_NAND_BASE, - .end = ADM5120_NAND_BASE + ADM5120_NAND_SIZE-1, - .flags = IORESOURCE_MEM, - }, -}; - -static int adm5120_nand_ready(struct mtd_info *mtd) -{ - return ((adm5120_nand_get_status() & ADM5120_NAND_STATUS_READY) != 0); -} - -static void adm5120_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, - unsigned int ctrl) -{ - if (ctrl & NAND_CTRL_CHANGE) { - adm5120_nand_set_cle(ctrl & NAND_CLE); - adm5120_nand_set_ale(ctrl & NAND_ALE); - adm5120_nand_set_cen(ctrl & NAND_NCE); - } - - if (cmd != NAND_CMD_NONE) - NAND_WRITE_REG(NAND_REG_DATA, cmd); -} - -void __init adm5120_add_device_nand(struct platform_nand_data *pdata) -{ - struct platform_device *pdev; - int err; - - pdev = platform_device_alloc("gen_nand", -1); - if (!pdev) - goto err_out; - - err = platform_device_add_resources(pdev, adm5120_nand_resources, - ARRAY_SIZE(adm5120_nand_resources)); - if (err) - goto err_put; - - err = platform_device_add_data(pdev, pdata, sizeof(*pdata)); - if (err) - goto err_put; - - pdata = pdev->dev.platform_data; - pdata->ctrl.dev_ready = adm5120_nand_ready; - pdata->ctrl.cmd_ctrl = adm5120_nand_cmd_ctrl; - - err = platform_device_add(pdev); - if (err) - goto err_put; - - return; - -err_put: - platform_device_put(pdev); -err_out: - return; -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/prom.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/prom.c deleted file mode 100644 index 5c52ea27e..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/prom.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * ADM5120 specific prom routines - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include - -unsigned int adm5120_prom_type = ADM5120_PROM_GENERIC; - -struct board_desc { - unsigned long mach_type; - char *name; -}; - -#define DEFBOARD(n, mt) { .mach_type = (mt), .name = (n)} -static struct board_desc common_boards[] __initdata = { - /* Cellvision/SparkLAN boards */ - DEFBOARD("CAS-630", MACH_ADM5120_CAS630), - DEFBOARD("CAS-670", MACH_ADM5120_CAS670), - DEFBOARD("CAS-700", MACH_ADM5120_CAS700), - DEFBOARD("CAS-771", MACH_ADM5120_CAS771), - DEFBOARD("CAS-790", MACH_ADM5120_CAS790), - DEFBOARD("CAS-861", MACH_ADM5120_CAS861), - DEFBOARD("NFS-101U", MACH_ADM5120_NFS101U), - /* Compex boards */ - DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT), - /* Edimax boards */ - DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K), - DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104KP), - DEFBOARD("BR-6104WG", MACH_ADM5120_BR61X4WG), - DEFBOARD("BR-6114WG", MACH_ADM5120_BR61X4WG), - /* Infineon boards */ - DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA), - DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT), - DEFBOARD("EASY 5120-WVoIP", MACH_ADM5120_EASY5120WVOIP), - DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000), - /* Mikrotik RouterBOARDs */ - DEFBOARD("111", MACH_ADM5120_RB_11X), - DEFBOARD("112", MACH_ADM5120_RB_11X), - DEFBOARD("133", MACH_ADM5120_RB_133), - DEFBOARD("133C", MACH_ADM5120_RB_133C), - DEFBOARD("133C3", MACH_ADM5120_RB_133C), - DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */ - DEFBOARD("153", MACH_ADM5120_RB_153), - DEFBOARD("192", MACH_ADM5120_RB_192), - DEFBOARD("miniROUTER", MACH_ADM5120_RB_150), - /* OSBRiDGE boards */ - DEFBOARD("OSBRiDGE 5GXi", MACH_ADM5120_5GXI), - /* Motorola boards */ - DEFBOARD("Powerline MU Gateway", MACH_ADM5120_PMUGW), - /* Generic EB-214A */ - DEFBOARD("ADM5120", MACH_ADM5120_EB_214A), -}; - -static unsigned long __init find_machtype_byname(char *name) -{ - unsigned long ret; - int i; - - ret = MACH_ADM5120_GENERIC; - if (name == NULL) - goto out; - - if (*name == '\0') - goto out; - - for (i = 0; i < ARRAY_SIZE(common_boards); i++) { - if (strcmp(common_boards[i].name, name) == 0) { - ret = common_boards[i].mach_type; - break; - } - } - -out: - return ret; -} - -static unsigned long __init detect_machtype_routerboot(void) -{ - char *name; - - name = routerboot_get_boardname(); - return find_machtype_byname(name); -} - -static unsigned long __init detect_machtype_generic(void) -{ - char *name; - - name = generic_prom_getenv("board_name"); - return find_machtype_byname(name); -} - -unsigned long __init detect_machtype_cfe(void) -{ - char *name; - - name = cfe_getenv("BOARD_NAME"); - return find_machtype_byname(name); -} - -static struct { - unsigned long mach_type; - u16 vendor_id; - u16 board_id; -} zynos_boards[] __initdata = { -#define ZYNOS_BOARD(vi, bi, mt) \ - {.vendor_id = (vi), .board_id = (bi), .mach_type = (mt)} - -#define ZYXEL_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_ZYXEL, bi, mt) -#define DLINK_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_DLINK, bi, mt) -#define LUCENT_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_LUCENT, bi, mt) - ZYXEL_BOARD(ZYNOS_BOARD_HS100, MACH_ADM5120_HS100), - ZYXEL_BOARD(ZYNOS_BOARD_P334U, MACH_ADM5120_P334U), - ZYXEL_BOARD(ZYNOS_BOARD_P334W, MACH_ADM5120_P334W), - ZYXEL_BOARD(ZYNOS_BOARD_P334WH, MACH_ADM5120_P334WH), - ZYXEL_BOARD(ZYNOS_BOARD_P334WHD, MACH_ADM5120_P334WHD), - ZYXEL_BOARD(ZYNOS_BOARD_P334WT, MACH_ADM5120_P334WT), - ZYXEL_BOARD(ZYNOS_BOARD_P334WT_ALT, MACH_ADM5120_P334WT), - ZYXEL_BOARD(ZYNOS_BOARD_P335, MACH_ADM5120_P335), - ZYXEL_BOARD(ZYNOS_BOARD_P335PLUS, MACH_ADM5120_P335PLUS), - ZYXEL_BOARD(ZYNOS_BOARD_P335U, MACH_ADM5120_P335U) -}; - -static unsigned long __init detect_machtype_bootbase(void) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(zynos_boards); i++) { - if (zynos_boards[i].vendor_id == bootbase_info.vendor_id && - zynos_boards[i].board_id == bootbase_info.board_id) { - return zynos_boards[i].mach_type; - break; - } - } - - printk(KERN_WARNING "Unknown ZyXEL model (%u)\n", - bootbase_info.board_id); - return MACH_ADM5120_GENERIC; -} - -static struct { - unsigned long mach_type; - u16 vid; - u16 did; - u16 svid; - u16 sdid; -} mylo_boards[] __initdata = { -#define MYLO_BOARD(v, d, sv, sd, mt) \ - {.vid = (v), .did = (d), .svid = (sv), .sdid = (sd), .mach_type = (mt)} -#define COMPEX_BOARD(d, mt) \ - MYLO_BOARD(VENID_COMPEX, (d), VENID_COMPEX, (d), (mt)) - - COMPEX_BOARD(DEVID_COMPEX_NP27G, MACH_ADM5120_NP27G), - COMPEX_BOARD(DEVID_COMPEX_NP28G, MACH_ADM5120_NP28G), - COMPEX_BOARD(DEVID_COMPEX_NP28GHS, MACH_ADM5120_NP28GHS), - COMPEX_BOARD(DEVID_COMPEX_WP54G, MACH_ADM5120_WP54), - COMPEX_BOARD(DEVID_COMPEX_WP54Gv1C, MACH_ADM5120_WP54Gv1C), - COMPEX_BOARD(DEVID_COMPEX_WP54AG, MACH_ADM5120_WP54), - COMPEX_BOARD(DEVID_COMPEX_WPP54G, MACH_ADM5120_WP54), - COMPEX_BOARD(DEVID_COMPEX_WPP54AG, MACH_ADM5120_WP54), -}; - -static unsigned long __init detect_machtype_myloader(void) -{ - unsigned long ret; - int i; - - ret = MACH_ADM5120_GENERIC; - for (i = 0; i < ARRAY_SIZE(mylo_boards); i++) { - if (mylo_boards[i].vid == myloader_info.vid && - mylo_boards[i].did == myloader_info.did && - mylo_boards[i].svid == myloader_info.svid && - mylo_boards[i].sdid == myloader_info.sdid) { - ret = mylo_boards[i].mach_type; - break; - } - } - - return ret; -} - -static void __init prom_detect_machtype(void) -{ - if (bootbase_present()) { - adm5120_prom_type = ADM5120_PROM_BOOTBASE; - mips_machtype = detect_machtype_bootbase(); - return; - } - - if (cfe_present()) { - adm5120_prom_type = ADM5120_PROM_CFE; - mips_machtype = detect_machtype_cfe(); - return; - } - - if (myloader_present()) { - adm5120_prom_type = ADM5120_PROM_MYLOADER; - mips_machtype = detect_machtype_myloader(); - return; - } - - if (routerboot_present()) { - adm5120_prom_type = ADM5120_PROM_ROUTERBOOT; - mips_machtype = detect_machtype_routerboot(); - return; - } - - if (generic_prom_present()) { - adm5120_prom_type = ADM5120_PROM_GENERIC; - mips_machtype = detect_machtype_generic(); - return; - } - - mips_machtype = MACH_ADM5120_GENERIC; -} - -#ifdef CONFIG_IMAGE_CMDLINE_HACK -extern char __image_cmdline[]; - -static void __init prom_init_cmdline(void) -{ - char *cmd; - - /* init command line, register a default kernel command line */ - cmd = __image_cmdline; - if (strlen(cmd) > 0) - strlcpy(arcs_cmdline, cmd, sizeof(arcs_cmdline)); - -} -#else -static inline void prom_init_cmdline(void) {} -#endif /* CONFIG_IMAGE_CMDLINE_HACK */ - -void __init prom_init(void) -{ - prom_detect_machtype(); - prom_init_cmdline(); -} - -void __init prom_free_prom_memory(void) -{ - /* We do not have to prom memory to free */ -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/setup.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/setup.c deleted file mode 100644 index c0410afdf..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/common/setup.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * ADM5120 specific setup - * - * Copyright (C) 2007-2009 Gabor Juhos - * - * This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel - * done by Jeroen Vreeken - * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org) - * - * Jeroen's code was based on the Linux 2.4.xx source codes found in various - * tarballs released by Edimax for it's ADM5120 based devices - * Copyright (C) ADMtek Incorporated - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define ADM5120_SYS_TYPE_LEN 64 - -unsigned char adm5120_sys_type[ADM5120_SYS_TYPE_LEN]; -void (*adm5120_board_reset)(void); - -static char *prom_names[ADM5120_PROM_LAST+1] __initdata = { - [ADM5120_PROM_GENERIC] = "Generic", - [ADM5120_PROM_CFE] = "CFE", - [ADM5120_PROM_UBOOT] = "U-Boot", - [ADM5120_PROM_MYLOADER] = "MyLoader", - [ADM5120_PROM_ROUTERBOOT] = "RouterBOOT", - [ADM5120_PROM_BOOTBASE] = "Bootbase" -}; - -static void __init adm5120_report(void) -{ - printk(KERN_INFO "SoC : %s\n", adm5120_sys_type); - printk(KERN_INFO "Bootdev : %s flash\n", - adm5120_nand_boot ? "NAND" : "NOR"); - printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]); -} - -const char *get_system_type(void) -{ - return adm5120_sys_type; -} - -static void adm5120_restart(char *command) -{ - /* TODO: stop switch before reset */ - - if (adm5120_board_reset) - adm5120_board_reset(); - - SW_WRITE_REG(SWITCH_REG_SOFT_RESET, 1); -} - -static void adm5120_halt(void) -{ - local_irq_disable(); - - while (1) { - if (cpu_wait) - cpu_wait(); - } -} - -void __init plat_time_init(void) -{ - mips_hpt_frequency = adm5120_speed / 2; -} - -void __init plat_mem_setup(void) -{ - adm5120_soc_init(); - adm5120_mem_init(); - - sprintf(adm5120_sys_type, "ADM%04X%s rev %u, running at %lu.%03lu MHz", - adm5120_product_code, - adm5120_package_bga() ? "" : "P", - adm5120_revision, - (adm5120_speed / 1000000), (adm5120_speed / 1000) % 1000); - - adm5120_report(); - - _machine_restart = adm5120_restart; - _machine_halt = adm5120_halt; - pm_power_off = adm5120_halt; - - set_io_port_base(KSEG1); -} - -static int __init adm5120_board_setup(void) -{ - adm5120_gpio_init(); - - mips_machine_setup(); - - return 0; -} -arch_initcall(adm5120_board_setup); - -static void __init adm5120_generic_board_setup(void) -{ - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - - adm5120_add_device_flash(0); - adm5120_add_device_switch(6, NULL); -} - -MIPS_MACHINE(MACH_ADM5120_GENERIC, "Generic", "Generic ADM5120 board", - adm5120_generic_board_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/Makefile deleted file mode 100644 index 8c66c171e..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -obj-y += compex.o - -obj-$(CONFIG_ADM5120_MACH_NP27G) += np27g.o -obj-$(CONFIG_ADM5120_MACH_NP28G) += np28g.o -obj-$(CONFIG_ADM5120_MACH_WP54) += wp54.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.c deleted file mode 100644 index 814acfb0c..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Compex boards - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "compex.h" - -#include - -static void switch_bank_gpio5(unsigned bank) -{ - switch (bank) { - case 0: - gpio_set_value(ADM5120_GPIO_PIN5, 0); - break; - case 1: - gpio_set_value(ADM5120_GPIO_PIN5, 1); - break; - } -} - -void __init compex_mac_setup(void) -{ - if (myloader_present()) { - int i; - - for (i = 0; i < 6; i++) { - if (is_valid_ether_addr(myloader_info.macs[i])) - memcpy(adm5120_eth_macs[i], - myloader_info.macs[i], ETH_ALEN); - else - random_ether_addr(adm5120_eth_macs[i]); - } - } else { - u8 mac[ETH_ALEN]; - - random_ether_addr(mac); - adm5120_setup_eth_macs(mac); - } -} - -void __init compex_generic_setup(void) -{ - gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */ - gpio_direction_output(ADM5120_GPIO_PIN5, 0); - - adm5120_flash0_data.switch_bank = switch_bank_gpio5; - adm5120_add_device_flash(0); - - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - - compex_mac_setup(); -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.h deleted file mode 100644 index 124e67697..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/compex.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Compex boards - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include - -#include - -#include -#include - -extern void compex_generic_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np27g.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np27g.c deleted file mode 100644 index 82da46d1c..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np27g.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Compex NP27G board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "compex.h" - -static u8 np27g_vlans[6] __initdata = { - /* FIXME: untested */ - 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 -}; - -static void __init np27g_setup(void) -{ - compex_generic_setup(); - adm5120_add_device_switch(5, np27g_vlans); - adm5120_add_device_usb(); - - /* TODO: add PCI IRQ map */ -} - -MIPS_MACHINE(MACH_ADM5120_NP27G, "NP27G", "Compex NetPassage 27G", np27g_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np28g.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np28g.c deleted file mode 100644 index a54143999..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/np28g.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Compex NP28G board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "compex.h" - -static struct adm5120_pci_irq np28g_pci_irqs[] __initdata = { - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), - PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI0), - PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI1), - PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2) -}; - -static struct gpio_led np28g_gpio_leds[] __initdata = { - GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL), - GPIO_LED_INV(ADM5120_GPIO_PIN3, "power", NULL), - GPIO_LED_INV(ADM5120_GPIO_PIN6, "wan_cond", NULL), - GPIO_LED_INV(ADM5120_GPIO_PIN7, "wifi", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L2, "usb1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L2, "usb2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L2, "usb3", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L2, "usb4", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL), -}; - -static u8 np28g_vlans[6] __initdata = { - 0x50, 0x42, 0x44, 0x48, 0x00, 0x00 -}; - -static void np28g_reset(void) -{ - gpio_set_value(ADM5120_GPIO_PIN4, 0); -} - -static void __init np28g_setup(void) -{ - compex_generic_setup(); - - /* setup reset line */ - gpio_request(ADM5120_GPIO_PIN4, NULL); - gpio_direction_output(ADM5120_GPIO_PIN4, 1); - adm5120_board_reset = np28g_reset; - - adm5120_add_device_switch(4, np28g_vlans); - adm5120_add_device_usb(); - - adm5120_add_device_gpio_leds(ARRAY_SIZE(np28g_gpio_leds), - np28g_gpio_leds); - - adm5120_pci_set_irq_map(ARRAY_SIZE(np28g_pci_irqs), np28g_pci_irqs); -} - -MIPS_MACHINE(MACH_ADM5120_NP28G, "NP28G", "Compex NetPassage 28G", np28g_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/wp54.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/wp54.c deleted file mode 100644 index 8aa35c555..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/compex/wp54.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Compex WP54 board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "compex.h" - -#define WP54_KEYS_POLL_INTERVAL 20 -#define WP54_KEYS_DEBOUNCE_INTERVAL (3 * WP54_KEYS_POLL_INTERVAL) - -static struct mtd_partition wp54g_wrt_partitions[] = { - { - .name = "cfe", - .offset = 0, - .size = 0x050000, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "trx", - .offset = MTDPART_OFS_APPEND, - .size = 0x3A0000, - } , { - .name = "nvram", - .offset = MTDPART_OFS_APPEND, - .size = 0x010000, - } -}; - -static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = { - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), -}; - -static struct gpio_keys_button wp54_gpio_buttons[] __initdata = { - { - .desc = "reset_button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WP54_KEYS_DEBOUNCE_INTERVAL, - .gpio = ADM5120_GPIO_PIN4, - } -}; - -static struct gpio_led wp54_gpio_leds[] __initdata = { - GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL), - GPIO_LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL), - GPIO_LED_INV(ADM5120_GPIO_PIN7, "wan", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL), -}; - -static u8 wp54_vlans[6] __initdata = { - 0x41, 0x42, 0x00, 0x00, 0x00, 0x00 -}; - -static void wp54_reset(void) -{ - gpio_set_value(ADM5120_GPIO_PIN3, 0); -} - -static void __init wp54_setup(void) -{ - compex_generic_setup(); - - /* setup reset line */ - gpio_request(ADM5120_GPIO_PIN3, NULL); - gpio_direction_output(ADM5120_GPIO_PIN3, 1); - adm5120_board_reset = wp54_reset; - - adm5120_add_device_switch(2, wp54_vlans); - adm5120_register_gpio_buttons(-1, WP54_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wp54_gpio_buttons), - wp54_gpio_buttons); - adm5120_add_device_gpio_leds(ARRAY_SIZE(wp54_gpio_leds), - wp54_gpio_leds); - - adm5120_pci_set_irq_map(ARRAY_SIZE(wp54_pci_irqs), wp54_pci_irqs); -} - -MIPS_MACHINE(MACH_ADM5120_WP54, "WP54", "Compex WP54 family", wp54_setup); - -static void __init wp54_wrt_setup(void) -{ - adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions); - adm5120_flash0_data.parts = wp54g_wrt_partitions; - - wp54_setup(); -} - -MIPS_MACHINE(MACH_ADM5120_WP54G_WRT, "WP54G-WRT", "Compex WP54G-WRT", - wp54_wrt_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/Makefile deleted file mode 100644 index 1286ed4c1..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -obj-y := br-61xx.o - -obj-$(CONFIG_ADM5120_MACH_BR_6104K) += br-6104k.o -obj-$(CONFIG_ADM5120_MACH_BR_6104KP) += br-6104kp.o -obj-$(CONFIG_ADM5120_MACH_BR_61X4WG) += br-61x4wg.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104k.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104k.c deleted file mode 100644 index 8b2b44550..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104k.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Edimax BR-6104K board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "br-61xx.h" - -static struct gpio_led br6104k_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL), -}; - -static void __init br6104k_setup(void) -{ - br61xx_generic_setup(); - adm5120_add_device_gpio_leds(ARRAY_SIZE(br6104k_gpio_leds), - br6104k_gpio_leds); -} - -MIPS_MACHINE(MACH_ADM5120_BR6104K, "BR-6104K", "Edimax BR-6104K", - br6104k_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104kp.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104kp.c deleted file mode 100644 index 034575d6b..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-6104kp.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Edimax BR-6104KP board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "br-61xx.h" - -static struct gpio_led br6104kp_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL), - GPIO_LED_INV(ADM5120_GPIO_PIN3, "usb1", NULL), - GPIO_LED_INV(ADM5120_GPIO_PIN1, "usb2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL), -}; - -static void __init br6104kp_setup(void) -{ - br61xx_generic_setup(); - adm5120_add_device_gpio_leds(ARRAY_SIZE(br6104kp_gpio_leds), - br6104kp_gpio_leds); - adm5120_add_device_usb(); -} - -MIPS_MACHINE(MACH_ADM5120_BR6104KP, "BR-6104KP", "Edimax BR-6104KP", - br6104kp_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61x4wg.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61x4wg.c deleted file mode 100644 index 5d5750710..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61x4wg.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Edimax BR-6104Wg/6114WG board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "br-61xx.h" - -static struct adm5120_pci_irq br61x4wg_pci_irqs[] __initdata = { - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), -}; - -static struct gpio_led br61x4wg_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL), - GPIO_LED_STD(ADM5120_GPIO_PIN5, "wlan", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL), -}; - -static void __init br61x4wg_setup(void) -{ - br61xx_generic_setup(); - adm5120_add_device_gpio_leds(ARRAY_SIZE(br61x4wg_gpio_leds), - br61x4wg_gpio_leds); - adm5120_pci_set_irq_map(ARRAY_SIZE(br61x4wg_pci_irqs), - br61x4wg_pci_irqs); -} - -MIPS_MACHINE(MACH_ADM5120_BR61X4WG, "BR-6104WG", "Edimax BR-6104WG/6114WG", - br61x4wg_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.c deleted file mode 100644 index 62a1cee38..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Edimax BR-61xx support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "br-61xx.h" - -#include - -#define BR61XX_CONFIG_OFFSET 0x8000 -#define BR61XX_CONFIG_SIZE 0x1000 - -#define BR61XX_KEYS_POLL_INTERVAL 20 -#define BR61XX_KEYS_DEBOUNCE_INTERVAL (3 * BR61XX_KEYS_POLL_INTERVAL) - -static struct mtd_partition br61xx_partitions[] = { - { - .name = "admboot", - .offset = 0, - .size = 32*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "config", - .offset = MTDPART_OFS_APPEND, - .size = 32*1024, - } , { - .name = "firmware", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } -}; - -static struct gpio_keys_button br61xx_gpio_buttons[] __initdata = { - { - .desc = "reset_button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = BR61XX_KEYS_DEBOUNCE_INTERVAL, - .gpio = ADM5120_GPIO_PIN2, - } -}; - -static u8 br61xx_vlans[6] __initdata = { - 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 -}; - -static void __init br61xx_mac_setup(void) -{ - u8 mac_base[6]; - int err; - - err = admboot_get_mac_base(BR61XX_CONFIG_OFFSET, - BR61XX_CONFIG_SIZE, mac_base); - - if ((err) || !is_valid_ether_addr(mac_base)) - random_ether_addr(mac_base); - - adm5120_setup_eth_macs(mac_base); -} - -void __init br61xx_generic_setup(void) -{ - - adm5120_flash0_data.nr_parts = ARRAY_SIZE(br61xx_partitions); - adm5120_flash0_data.parts = br61xx_partitions; - adm5120_add_device_flash(0); - - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - - adm5120_add_device_switch(5, br61xx_vlans); - - adm5120_register_gpio_buttons(-1, BR61XX_KEYS_POLL_INTERVAL, - ARRAY_SIZE(br61xx_gpio_buttons), - br61xx_gpio_buttons); - - br61xx_mac_setup(); -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.h deleted file mode 100644 index c4a9eced5..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/edimax/br-61xx.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Edimax BR-61xx board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include - -#include - -#include -#include - -extern void __init br61xx_generic_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/Makefile deleted file mode 100644 index 0c032e3a5..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-$(CONFIG_ADM5120_MACH_EB_214A) += eb-214a.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/eb-214a.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/eb-214a.c deleted file mode 100644 index cf491a1ef..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/generic/eb-214a.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * EB-214A board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * Copyright (C) 2010 Cezary Jackiewicz - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - - -#define EB214A_CONFIG_OFFSET 0x4000 - -#define EB214A_KEYS_POLL_INTERVAL 20 -#define EB214A_KEYS_DEBOUNCE_INTERVAL (3 * EB214A_KEYS_POLL_INTERVAL) - -static struct mtd_partition eb214a_partitions[] = { - { - .name = "bootloader", - .offset = 0, - .size = 32*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "config", - .offset = MTDPART_OFS_APPEND, - .size = 32*1024, - } , { - .name = "firmware", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } -}; - -static struct adm5120_pci_irq eb214a_pci_irqs[] __initdata = { - PCIIRQ(4, 0, 1, ADM5120_IRQ_PCI0), - PCIIRQ(4, 1, 2, ADM5120_IRQ_PCI0), - PCIIRQ(4, 2, 3, ADM5120_IRQ_PCI0), -}; - -static struct gpio_led eb214a_gpio_leds[] __initdata = { - GPIO_LED_INV(ADM5120_GPIO_PIN7, "power", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "usb1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L1, "usb2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L2, "usb3", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "usb4", NULL), -}; - -static struct gpio_keys_button eb214a_gpio_buttons[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = EB214A_KEYS_DEBOUNCE_INTERVAL, - .gpio = ADM5120_GPIO_PIN1, - } -}; - -static u8 eb214a_vlans[6] __initdata = { - 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 -}; - -static void __init eb214a_mac_setup(void) -{ - u8 mac_base[6]; - u8 *cfg; - int i; - - cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + EB214A_CONFIG_OFFSET); - for (i = 0; i < 6; i++) - mac_base[i] = cfg[i]; - - if (!is_valid_ether_addr(mac_base)) - random_ether_addr(mac_base); - - adm5120_setup_eth_macs(mac_base); -} - -static void __init eb214a_setup(void) -{ - adm5120_flash0_data.nr_parts = ARRAY_SIZE(eb214a_partitions); - adm5120_flash0_data.parts = eb214a_partitions; - adm5120_add_device_flash(0); - - adm5120_add_device_uart(0); - /* adm5120_add_device_uart(1); */ - - adm5120_add_device_switch(5, eb214a_vlans); - - eb214a_mac_setup(); - - adm5120_register_gpio_buttons(-1, EB214A_KEYS_POLL_INTERVAL, - ARRAY_SIZE(eb214a_gpio_buttons), - eb214a_gpio_buttons); - - adm5120_add_device_gpio_leds(ARRAY_SIZE(eb214a_gpio_leds), - eb214a_gpio_leds); - - adm5120_pci_set_irq_map(ARRAY_SIZE(eb214a_pci_irqs), - eb214a_pci_irqs); - /* adm5120_add_device_usb(); */ -} - -MIPS_MACHINE(MACH_ADM5120_EB_214A, "EB-214A", "Generic EB-214A", eb214a_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/Makefile deleted file mode 100644 index 49453cba9..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -obj-y += infineon.o - -obj-$(CONFIG_ADM5120_MACH_EASY5120_RT) += easy5120-rt.o -obj-$(CONFIG_ADM5120_MACH_EASY5120_WVOIP) += easy5120-wvoip.o -obj-$(CONFIG_ADM5120_MACH_EASY5120P_ATA) += easy5120p-ata.o -obj-$(CONFIG_ADM5120_MACH_EASY83000) += easy83000.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-rt.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-rt.c deleted file mode 100644 index 31eaee772..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-rt.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Infineon EASY 5120-RT Reference Board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "infineon.h" - -static struct gpio_led easy5120_rt_gpio_leds[] __initdata = { - GPIO_LED_INV(ADM5120_GPIO_PIN6, "user", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan0_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan0_led2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_led2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_led2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_led2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL), -}; - -static struct adm5120_pci_irq easy5120_rt_pci_irqs[] __initdata = { - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), -}; - -static u8 easy5120_rt_vlans[6] __initdata = { - 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 -}; - -static void __init easy5120_rt_setup(void) -{ - easy_setup_bga(); - - adm5120_add_device_switch(5, easy5120_rt_vlans); - adm5120_add_device_usb(); - adm5120_add_device_gpio_leds(ARRAY_SIZE(easy5120_rt_gpio_leds), - easy5120_rt_gpio_leds); - adm5120_pci_set_irq_map(ARRAY_SIZE(easy5120_rt_pci_irqs), - easy5120_rt_pci_irqs); -} - -MIPS_MACHINE(MACH_ADM5120_EASY5120RT, "EASY5120-RT", - "Infineon EASY 5120-RT Reference Board", easy5120_rt_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-wvoip.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-wvoip.c deleted file mode 100644 index 0bf404cc2..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120-wvoip.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Infineon EASY 5120-WVoIP Reference Board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "infineon.h" - -static void __init easy5120wvoip_setup(void) -{ - easy_setup_bga(); - adm5120_add_device_switch(6, NULL); - - /* TODO: add VINETIC2 device */ - /* TODO: setup PCI IRQ map */ -} - -MIPS_MACHINE(MACH_ADM5120_EASY5120WVOIP, "EASY5120WVoIP", - "Infineon EASY 5120-WVoIP Reference Board", easy5120wvoip_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120p-ata.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120p-ata.c deleted file mode 100644 index fafe0238b..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy5120p-ata.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Infineon EASY 5120P-ATA Reference Board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "infineon.h" - -static void __init easy5120pata_setup(void) -{ - easy_setup_pqfp(); - - adm5120_add_device_switch(6, NULL); -} - -MIPS_MACHINE(MACH_ADM5120_EASY5120PATA, "EASY5120P-ATA", - "Infineon EASY 5120P-ATA Reference Board", easy5120pata_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy83000.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy83000.c deleted file mode 100644 index 051b85274..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/easy83000.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Infineon EASY 83000 Reference Board support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "infineon.h" - -static void __init easy83000_setup(void) -{ - easy_setup_pqfp(); - adm5120_add_device_switch(6, NULL); - - /* TODO: add VINAX device */ -} - -MIPS_MACHINE(MACH_ADM5120_EASY83000, "EASY8300", - "Infineon EASY 83000 Reference Board", easy83000_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.c deleted file mode 100644 index 5c441da90..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Infineon Reference Boards - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "infineon.h" - -#include - -#define EASY_CONFIG_OFFSET 0x10000 -#define EASY_CONFIG_SIZE 0x1000 - -static struct mtd_partition easy_partitions[] = { - { - .name = "admboot", - .offset = 0, - .size = 64*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "boardcfg", - .offset = MTDPART_OFS_APPEND, - .size = 64*1024, - } , { - .name = "firmware", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } -}; - -static __init void easy_setup_mac(void) -{ - u8 mac_base[6]; - int err; - - err = admboot_get_mac_base(EASY_CONFIG_OFFSET, - EASY_CONFIG_SIZE, mac_base); - - if ((err) || !is_valid_ether_addr(mac_base)) - random_ether_addr(mac_base); - - adm5120_setup_eth_macs(mac_base); -} - -static void switch_bank_gpio3(unsigned bank) -{ - switch (bank) { - case 0: - gpio_set_value(ADM5120_GPIO_PIN3, 0); - break; - case 1: - gpio_set_value(ADM5120_GPIO_PIN3, 1); - break; - } -} - -void __init easy_setup_pqfp(void) -{ - /* setup flash A20 line */ - gpio_request(ADM5120_GPIO_PIN3, NULL); - gpio_direction_output(ADM5120_GPIO_PIN3, 0); - adm5120_flash0_data.switch_bank = switch_bank_gpio3; - - adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions); - adm5120_flash0_data.parts = easy_partitions; - - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - - adm5120_add_device_flash(0); - - easy_setup_mac(); -} - -static void switch_bank_gpio5(unsigned bank) -{ - switch (bank) { - case 0: - gpio_set_value(ADM5120_GPIO_PIN5, 0); - break; - case 1: - gpio_set_value(ADM5120_GPIO_PIN5, 1); - break; - } -} - -void __init easy_setup_bga(void) -{ - /* setup flash A20 line */ - gpio_request(ADM5120_GPIO_PIN5, NULL); - gpio_direction_output(ADM5120_GPIO_PIN5, 0); - adm5120_flash0_data.switch_bank = switch_bank_gpio5; - - adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions); - adm5120_flash0_data.parts = easy_partitions; - - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - - adm5120_add_device_flash(0); - - easy_setup_mac(); -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.h deleted file mode 100644 index a5f28b4fe..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/infineon/infineon.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Infineon Reference Boards - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -extern void easy_setup_pqfp(void) __init; -extern void easy_setup_bga(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/Makefile deleted file mode 100644 index 34ea0a3d8..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -obj-y += rb-1xx.o - -obj-${CONFIG_ADM5120_MACH_RB_11X} += rb-11x.o -obj-${CONFIG_ADM5120_MACH_RB_133} += rb-133.o -obj-${CONFIG_ADM5120_MACH_RB_133C} += rb-133c.o -obj-${CONFIG_ADM5120_MACH_RB_150} += rb-150.o -obj-${CONFIG_ADM5120_MACH_RB_153} += rb-153.o -obj-${CONFIG_ADM5120_MACH_RB_192} += rb-192.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-11x.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-11x.c deleted file mode 100644 index fd768d8ef..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-11x.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Mikrotik RouterBOARD 111/112 support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "rb-1xx.h" - -static struct gpio_led rb11x_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_PIN3, "user", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan_lnkact", NULL), -}; - -static u8 rb11x_vlans[6] __initdata = { - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static void __init rb11x_setup(void) -{ - rb1xx_generic_setup(); - rb1xx_add_device_nand(); - - adm5120_add_device_switch(1, rb11x_vlans); - adm5120_add_device_gpio_leds(ARRAY_SIZE(rb11x_gpio_leds), - rb11x_gpio_leds); -} - -MIPS_MACHINE(MACH_ADM5120_RB_11X, "11x", "Mikrotik RouterBOARD 111/112", - rb11x_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133.c deleted file mode 100644 index 23c57820c..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Mikrotik RouterBOARD 133 support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "rb-1xx.h" - -static struct gpio_led rb133_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_PIN6, "power", NULL), - GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan1_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan1_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan2_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan2_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan3_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan3_lnkact", NULL), -}; - -static u8 rb133_vlans[6] __initdata = { - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static void __init rb133_setup(void) -{ - rb1xx_generic_setup(); - rb1xx_add_device_nand(); - - adm5120_add_device_switch(3, rb133_vlans); - adm5120_add_device_gpio_leds(ARRAY_SIZE(rb133_gpio_leds), - rb133_gpio_leds); -} - -MIPS_MACHINE(MACH_ADM5120_RB_133, "133", "Mikrotik RouterBOARD 133", - rb133_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133c.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133c.c deleted file mode 100644 index 25bab70c0..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-133c.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Mikrotik RouterBOARD 133C support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "rb-1xx.h" - -static struct gpio_led rb133c_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_PIN6, "power", NULL), - GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan1_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan1_lnkact", NULL), -}; - -static u8 rb133c_vlans[6] __initdata = { - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static void __init rb133c_setup(void) -{ - rb1xx_generic_setup(); - rb1xx_add_device_nand(); - - adm5120_add_device_switch(1, rb133c_vlans); - adm5120_add_device_gpio_leds(ARRAY_SIZE(rb133c_gpio_leds), - rb133c_gpio_leds); -} - -MIPS_MACHINE(MACH_ADM5120_RB_133C, "133C", "Mikrotik RouterBOARD 133C", - rb133c_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-150.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-150.c deleted file mode 100644 index 96a8c1b87..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-150.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Mikrotik RouterBOARD 150 support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "rb-1xx.h" - -#define RB150_NAND_BASE 0x1FC80000 -#define RB150_NAND_SIZE 1 - -#define RB150_GPIO_NAND_READY ADM5120_GPIO_PIN0 -#define RB150_GPIO_NAND_NCE ADM5120_GPIO_PIN1 -#define RB150_GPIO_NAND_CLE ADM5120_GPIO_P2L2 -#define RB150_GPIO_NAND_ALE ADM5120_GPIO_P3L2 -#define RB150_GPIO_RESET_BUTTON ADM5120_GPIO_PIN1 /* FIXME */ - -#define RB150_NAND_DELAY 100 - -#define RB150_NAND_WRITE(v) \ - writeb((v), (void __iomem *)KSEG1ADDR(RB150_NAND_BASE)) - -static struct resource rb150_nand_resources[] __initdata = { - [0] = { - .start = RB150_NAND_BASE, - .end = RB150_NAND_BASE + RB150_NAND_SIZE-1, - .flags = IORESOURCE_MEM, - }, -}; - -static struct gpio_led rb150_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_P0L2, "user", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan1_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1_led2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan5_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan5_led2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan4_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan4_led2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_led2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan2_led1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan2_led2", NULL), -}; - -static u8 rb150_vlans[6] __initdata = { - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static int rb150_nand_dev_ready(struct mtd_info *mtd) -{ - return gpio_get_value(RB150_GPIO_NAND_READY); -} - -static void rb150_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, - unsigned int ctrl) -{ - if (ctrl & NAND_CTRL_CHANGE) { - gpio_set_value(RB150_GPIO_NAND_CLE, (ctrl & NAND_CLE) ? 1 : 0); - gpio_set_value(RB150_GPIO_NAND_ALE, (ctrl & NAND_ALE) ? 1 : 0); - gpio_set_value(RB150_GPIO_NAND_NCE, (ctrl & NAND_NCE) ? 0 : 1); - } - - udelay(RB150_NAND_DELAY); - - if (cmd != NAND_CMD_NONE) - RB150_NAND_WRITE(cmd); -} - -static void __init rb150_add_device_nand(void) -{ - struct platform_device *pdev; - int err; - - /* setup GPIO pins for NAND flash chip */ - gpio_request(RB150_GPIO_NAND_READY, "nand-ready"); - gpio_direction_input(RB150_GPIO_NAND_READY); - gpio_request(RB150_GPIO_NAND_NCE, "nand-nce"); - gpio_direction_output(RB150_GPIO_NAND_NCE, 1); - gpio_request(RB150_GPIO_NAND_CLE, "nand-cle"); - gpio_direction_output(RB150_GPIO_NAND_CLE, 0); - gpio_request(RB150_GPIO_NAND_ALE, "nand-ale"); - gpio_direction_output(RB150_GPIO_NAND_ALE, 0); - - pdev = platform_device_alloc("gen_nand", -1); - if (!pdev) - goto err_out; - - err = platform_device_add_resources(pdev, rb150_nand_resources, - ARRAY_SIZE(rb150_nand_resources)); - if (err) - goto err_put; - - - rb1xx_nand_data.ctrl.cmd_ctrl = rb150_nand_cmd_ctrl; - rb1xx_nand_data.ctrl.dev_ready = rb150_nand_dev_ready; - - err = platform_device_add_data(pdev, &rb1xx_nand_data, - sizeof(rb1xx_nand_data)); - if (err) - goto err_put; - - err = platform_device_add(pdev); - if (err) - goto err_put; - - return; - -err_put: - platform_device_put(pdev); -err_out: - return; -} - -static void __init rb150_setup(void) -{ - rb1xx_gpio_buttons[0].gpio = RB150_GPIO_RESET_BUTTON; - rb1xx_generic_setup(); - rb150_add_device_nand(); - - adm5120_add_device_gpio_leds(ARRAY_SIZE(rb150_gpio_leds), - rb150_gpio_leds); - adm5120_add_device_switch(5, rb150_vlans); -} - -MIPS_MACHINE(MACH_ADM5120_RB_150, "miniROUTER", "Mikrotik RouterBOARD 150", - rb150_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-153.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-153.c deleted file mode 100644 index 845668495..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-153.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Mikrotik RouterBOARD 153 support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "rb-1xx.h" - -static struct resource rb153_cf_resources[] __initdata = { - { - .name = "cf_membase", - .start = ADM5120_EXTIO1_BASE, - .end = ADM5120_EXTIO1_BASE + ADM5120_EXTIO1_SIZE-1 , - .flags = IORESOURCE_MEM - }, { - .name = "cf_irq", - .start = ADM5120_IRQ_GPIO4, - .end = ADM5120_IRQ_GPIO4, - .flags = IORESOURCE_IRQ - } -}; - -static struct gpio_led rb153_gpio_leds[] __initdata = { - GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan1_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan5_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan5_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan4_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan4_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan2_speed", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan2_lnkact", NULL), -}; - -static u8 rb153_vlans[6] __initdata = { - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static void __init rb153_add_device_cf(void) -{ - /* enable CSX1:INTX1 on GPIO[3:4] for the CF slot */ - adm5120_gpio_csx1_enable(); - - /* enable the wait state pin GPIO[0] for external I/O control */ - adm5120_gpio_ew_enable(); - - platform_device_register_simple("pata-rb153-cf", -1, - rb153_cf_resources, ARRAY_SIZE(rb153_cf_resources)); -} - -static void __init rb153_setup(void) -{ - rb1xx_generic_setup(); - rb1xx_add_device_nand(); - rb153_add_device_cf(); - - adm5120_add_device_gpio_leds(ARRAY_SIZE(rb153_gpio_leds), - rb153_gpio_leds); - adm5120_add_device_switch(5, rb153_vlans); -} - -MIPS_MACHINE(MACH_ADM5120_RB_153, "150", "Mikrotik RouterBOARD 153", - rb153_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-192.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-192.c deleted file mode 100644 index 904942139..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-192.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Mikrotik RouterBOARD 192 support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "rb-1xx.h" - -static u8 rb192_vlans[6] __initdata = { - 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static void __init rb192_setup(void) -{ - rb1xx_generic_setup(); - rb1xx_add_device_nand(); - - adm5120_add_device_switch(6, rb192_vlans); -} - -MIPS_MACHINE(MACH_ADM5120_RB_192, "192", "Mikrotik RouterBOARD 192", - rb192_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.c deleted file mode 100644 index 8961115c7..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Mikrotik RouterBOARD 1xx series support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * NAND initialization code was based on a driver for Linux 2.6.19+ which - * was derived from the driver for Linux 2.4.xx published by Mikrotik for - * their RouterBoard 1xx and 5xx series boards. - * Copyright (C) 2007 David Goodenough - * Copyright (C) 2007 Florian Fainelli - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "rb-1xx.h" - -#define RB1XX_NAND_CHIP_DELAY 25 - -#define RB1XX_KEYS_POLL_INTERVAL 20 -#define RB1XX_KEYS_DEBOUNCE_INTERVAL (3 * RB1XX_KEYS_POLL_INTERVAL) - -static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = { - PCIIRQ(1, 0, 1, ADM5120_IRQ_PCI0), - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI1), - PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2) -}; - -static struct mtd_partition rb1xx_nor_parts[] = { - { - .name = "booter", - .offset = 0, - .size = 64*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "firmware", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } -}; - -static struct mtd_partition rb1xx_nand_parts[] = { - { - .name = "kernel", - .offset = 0, - .size = 4 * 1024 * 1024, - } , { - .name = "rootfs", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL - } -}; - -/* - * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader - * will not be able to find the kernel that we load. So set the oobinfo - * when creating the partitions - */ -static struct nand_ecclayout rb1xx_nand_ecclayout = { - .eccbytes = 6, - .eccpos = { 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } -}; - -/*--------------------------------------------------------------------------*/ - -static int rb1xx_nand_fixup(struct mtd_info *mtd) -{ - struct nand_chip *chip = mtd->priv; - - if (mtd->writesize == 512) - chip->ecc.layout = &rb1xx_nand_ecclayout; - - return 0; -} - -struct platform_nand_data rb1xx_nand_data __initdata = { - .chip = { - .nr_chips = 1, - .nr_partitions = ARRAY_SIZE(rb1xx_nand_parts), - .partitions = rb1xx_nand_parts, - .chip_delay = RB1XX_NAND_CHIP_DELAY, - .chip_fixup = rb1xx_nand_fixup, - }, -}; - -struct gpio_keys_button rb1xx_gpio_buttons[] __initdata = { - { - .desc = "reset_button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = RB1XX_KEYS_DEBOUNCE_INTERVAL, - .gpio = ADM5120_GPIO_PIN7, - } -}; - -static void __init rb1xx_mac_setup(void) -{ - if (rb_hs.mac_base != NULL && is_valid_ether_addr(rb_hs.mac_base)) { - adm5120_setup_eth_macs(rb_hs.mac_base); - } else { - u8 mac[ETH_ALEN]; - - random_ether_addr(mac); - adm5120_setup_eth_macs(mac); - } -} - -void __init rb1xx_add_device_flash(void) -{ - /* setup data for flash0 device */ - adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_parts); - adm5120_flash0_data.parts = rb1xx_nor_parts; - adm5120_flash0_data.window_size = 128*1024; - - adm5120_add_device_flash(0); -} - -void __init rb1xx_add_device_nand(void) -{ - /* enable NAND flash interface */ - adm5120_nand_enable(); - - /* initialize NAND chip */ - adm5120_nand_set_spn(1); - adm5120_nand_set_wpn(0); - - adm5120_add_device_nand(&rb1xx_nand_data); -} - -void __init rb1xx_generic_setup(void) -{ - if (adm5120_package_bga()) - adm5120_pci_set_irq_map(ARRAY_SIZE(rb1xx_pci_irqs), - rb1xx_pci_irqs); - - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - - adm5120_register_gpio_buttons(-1, RB1XX_KEYS_POLL_INTERVAL, - ARRAY_SIZE(rb1xx_gpio_buttons), - rb1xx_gpio_buttons); - - rb1xx_add_device_flash(); - rb1xx_mac_setup(); -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.h deleted file mode 100644 index 05e68bd0a..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/mikrotik/rb-1xx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Mikrotik RouterBOARD 1xx series support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include - -extern struct platform_nand_data rb1xx_nand_data __initdata; -extern struct gpio_keys_button rb1xx_gpio_buttons[] __initdata; - -extern void rb1xx_add_device_flash(void) __init; -extern void rb1xx_add_device_nand(void) __init; -extern void rb1xx_generic_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/Makefile deleted file mode 100644 index 239d5a088..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-$(CONFIG_ADM5120_MACH_PMUGW) += pmugw.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/pmugw.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/pmugw.c deleted file mode 100644 index 369892fd1..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/motorola/pmugw.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Motorola Powerline MU Gateway board - * - * Copyright (C) 2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#define PMUGW_CONFIG_OFFSET 0x10000 -#define PMUGW_CONFIG_SIZE 0x1000 - -static struct mtd_partition pmugw_partitions[] = { - { - .name = "admboot", - .offset = 0, - .size = 64*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "boardcfg", - .offset = MTDPART_OFS_APPEND, - .size = 64*1024, - } , { - .name = "firmware", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } -}; - -static u8 pmugw_vlans[6] __initdata = { - 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 -}; - -static __init void pmugw_setup_mac(void) -{ - u8 mac_base[6]; - int err; - - err = admboot_get_mac_base(PMUGW_CONFIG_OFFSET, - PMUGW_CONFIG_SIZE, mac_base); - - if ((err) || !is_valid_ether_addr(mac_base)) - random_ether_addr(mac_base); - - adm5120_setup_eth_macs(mac_base); -} - -static void switch_bank_gpio5(unsigned bank) -{ - switch (bank) { - case 0: - gpio_set_value(ADM5120_GPIO_PIN5, 0); - break; - case 1: - gpio_set_value(ADM5120_GPIO_PIN5, 1); - break; - } -} - -void __init pmugw_setup(void) -{ - /* setup flash A20 line */ - gpio_request(ADM5120_GPIO_PIN5, NULL); - gpio_direction_output(ADM5120_GPIO_PIN5, 0); - adm5120_flash0_data.switch_bank = switch_bank_gpio5; - - adm5120_flash0_data.nr_parts = ARRAY_SIZE(pmugw_partitions); - adm5120_flash0_data.parts = pmugw_partitions; - - adm5120_add_device_uart(1); /* ttyAM0 */ - adm5120_add_device_uart(0); /* ttyAM1 */ - - adm5120_add_device_flash(0); - - pmugw_setup_mac(); - adm5120_add_device_switch(5, pmugw_vlans); -} - -MIPS_MACHINE(MACH_ADM5120_PMUGW, "PMUGW", "Motorola Powerline MU Gateway", - pmugw_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/5gxi.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/5gxi.c deleted file mode 100644 index a5c2c3653..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/5gxi.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * OSBRiDGE 5GXi/5XLi board support - * - * Copyright (C) 2009 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -static struct mtd_partition osbridge_5gxi_partitions[] = { - { - .name = "bootloader", - .offset = 0, - .size = 64*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "boardcfg", - .offset = 64*1024, - .size = 64*1024, - } , { - .name = "firmware", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } -}; - -static struct gpio_led osbridge_5gxi_gpio_leds[] __initdata = { - GPIO_LED_INV(ADM5120_GPIO_PIN6, "5gxi:green:user", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "5gxi:yellow:lan", NULL), -}; - -static struct adm5120_pci_irq osbridge_5gxi_pci_irqs[] __initdata = { - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), -}; - -static u8 osbridge_5gxi_vlans[6] __initdata = { - 0x41, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static void __init osbridge_5gxi_setup(void) -{ - adm5120_flash0_data.nr_parts = ARRAY_SIZE(osbridge_5gxi_partitions); - adm5120_flash0_data.parts = osbridge_5gxi_partitions; - - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - - adm5120_add_device_flash(0); - - adm5120_add_device_switch(1, osbridge_5gxi_vlans); - adm5120_add_device_gpio_leds(ARRAY_SIZE(osbridge_5gxi_gpio_leds), - osbridge_5gxi_gpio_leds); - adm5120_pci_set_irq_map(ARRAY_SIZE(osbridge_5gxi_pci_irqs), - osbridge_5gxi_pci_irqs); -} - -MIPS_MACHINE(MACH_ADM5120_5GXI, "5GXi", "OSBRiDGE 5GXi/5XLi board", - osbridge_5gxi_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/Makefile deleted file mode 100644 index 34946c5e5..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/osbridge/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-$(CONFIG_ADM5120_MACH_5GXI) += 5gxi.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/Makefile deleted file mode 100644 index 650be4077..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# -# Makefile for the ADMtek ADM5120 SoC specific parts of the kernel -# - -lib-y += admboot.o -lib-y += bootbase.o -lib-y += cfe.o -lib-y += generic.o -lib-y += myloader.o -lib-y += routerboot.o diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/admboot.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/admboot.c deleted file mode 100644 index b655390c1..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/admboot.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ADMBoot specific prom routines - * - * Copyright (C) 2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include - -#include -#include - -#include -#include -#include "prom_read.h" - -#define ADMBOOT_MAGIC_MAC_BASE 0x636D676D /* 'mgmc' */ -#define ADMBOOT_MAGIC_MAC_BASE_BR6104XX 0x31305348 /* 'HS01' */ - -int __init admboot_get_mac_base(u32 offset, u32 len, u8 *mac) -{ - u8 *cfg; - int i; - - cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + offset); - for (i = 0; i < len; i += 4) { - u32 magic; - - magic = prom_read_le32(cfg + i); - if (magic == ADMBOOT_MAGIC_MAC_BASE) { - int j; - - for (j = 0; j < 6; j++) - mac[j] = cfg[i + 4 + j]; - - return 0; - } - if (magic == ADMBOOT_MAGIC_MAC_BASE_BR6104XX) { - int j; - - for (j = 0; j < 6; j++) - mac[j] = cfg[i + 7 + j]; - - return 0; - } - } - - return -ENXIO; -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/bootbase.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/bootbase.c deleted file mode 100644 index 063281e3f..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/bootbase.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * ZyXEL's Bootbase specific prom routines - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include "prom_read.h" - -#define ZYNOS_INFO_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x3F90) -#define ZYNOS_HDBG_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x4000) -#define BOOTEXT_ADDR_MIN KSEG1ADDR(ADM5120_SRAM0_BASE) -#define BOOTEXT_ADDR_MAX (BOOTEXT_ADDR_MIN + (2*1024*1024)) - -static int bootbase_found; -static struct zynos_board_info *board_info; - -struct bootbase_info bootbase_info; - -static inline int bootbase_dbgarea_present(u8 *data) -{ - u32 t; - - t = prom_read_be32(data+5); - if (t != ZYNOS_MAGIC_DBGAREA1) - return 0; - - t = prom_read_be32(data+9); - if (t != ZYNOS_MAGIC_DBGAREA2) - return 0; - - return 1; -} - -static inline u32 bootbase_get_bootext_addr(void) -{ - return prom_read_be32(&board_info->bootext_addr); -} - -static inline void bootbase_get_mac(u8 *mac) -{ - int i; - - for (i = 0; i < 6; i++) - mac[i] = board_info->mac[i]; -} - -static inline u16 bootbase_get_vendor_id(void) -{ -#define CHECK_VENDOR(n) (strnicmp(board_info->vendor, (n), strlen(n)) == 0) - unsigned char vendor[ZYNOS_NAME_LEN]; - int i; - - for (i = 0; i < ZYNOS_NAME_LEN; i++) - vendor[i] = board_info->vendor[i]; - - if CHECK_VENDOR(ZYNOS_VENDOR_ZYXEL) - return ZYNOS_VENDOR_ID_ZYXEL; - - if CHECK_VENDOR(ZYNOS_VENDOR_DLINK) - return ZYNOS_VENDOR_ID_DLINK; - - if CHECK_VENDOR(ZYNOS_VENDOR_LUCENT) - return ZYNOS_VENDOR_ID_LUCENT; - - if CHECK_VENDOR(ZYNOS_VENDOR_NETGEAR) - return ZYNOS_VENDOR_ID_NETGEAR; - - return ZYNOS_VENDOR_ID_OTHER; -} - -static inline u16 bootbase_get_board_id(void) -{ - return prom_read_be16(&board_info->board_id); -} - -int __init bootbase_present(void) -{ - u32 t; - - if (bootbase_found) - goto out; - - /* check presence of the dbgarea */ - if (bootbase_dbgarea_present((u8 *)ZYNOS_HDBG_ADDR) == 0) - goto out; - - board_info = (struct zynos_board_info *)(ZYNOS_INFO_ADDR); - - /* check for a valid BootExt address */ - t = bootbase_get_bootext_addr(); - if ((t < BOOTEXT_ADDR_MIN) || (t > BOOTEXT_ADDR_MAX)) - goto out; - - bootbase_info.vendor_id = bootbase_get_vendor_id(); - bootbase_info.board_id = bootbase_get_board_id(); - bootbase_get_mac(bootbase_info.mac); - - bootbase_found = 1; - -out: - return bootbase_found; -} - diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/cfe.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/cfe.c deleted file mode 100644 index 5a343cd7e..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/cfe.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Broadcom's CFE specific prom routines - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include - -#include -#include - -#include -#include "prom_read.h" - -/* - * CFE based boards - */ -#define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE -from other bootloaders */ - -static int cfe_found; - -static u32 cfe_handle; -static u32 cfe_entry; -static u32 cfe_seal; - -int __init cfe_present(void) -{ - /* - * This method only works, when we are booted directly from the CFE. - */ - u32 a1 = (u32) fw_arg1; - - if (cfe_found) - return 1; - - cfe_handle = (u32) fw_arg0; - cfe_entry = (u32) fw_arg2; - cfe_seal = (u32) fw_arg3; - - /* Check for CFE by finding the CFE magic number */ - if (cfe_seal != CFE_EPTSEAL) - return 0; - - /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */ - if (a1 != 0) - return 0; - - /* The cfe_handle, and the cfe_entry must be kernel mode addresses */ - if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0)) - return 0; - - cfe_found = 1; - return 1; -} - -char *cfe_getenv(char *envname) -{ - if (cfe_found == 0) - return NULL; - - return NULL; -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/generic.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/generic.c deleted file mode 100644 index 4d4caa847..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/generic.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Generic PROM routines - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include - -#include - -#include - -static int *_prom_argc; -static char **_prom_argv; -static char **_prom_envp; - -char *generic_prom_getenv(char *envname) -{ - char **env; - char *ret; - - ret = NULL; - for (env = _prom_envp; *env != NULL; env++) { - if (strcmp(envname, *env++) == 0) { - ret = *env; - break; - } - } - - return ret; -} - -int generic_prom_present(void) -{ - _prom_argc = (int *)fw_arg0; - _prom_argv = (char **)fw_arg1; - _prom_envp = (char **)fw_arg2; - - return 1; -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/myloader.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/myloader.c deleted file mode 100644 index 5357db511..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/myloader.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Compex's MyLoader specific prom routines - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include "prom_read.h" - -#define SYS_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F000) -#define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800) -#define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000) - -static int myloader_found; - -struct myloader_info myloader_info; - -int __init myloader_present(void) -{ - struct mylo_system_params *sysp; - struct mylo_board_params *boardp; - struct mylo_partition_table *parts; - int i; - - if (myloader_found) - goto out; - - sysp = (struct mylo_system_params *)(SYS_PARAMS_ADDR); - boardp = (struct mylo_board_params *)(BOARD_PARAMS_ADDR); - parts = (struct mylo_partition_table *)(PART_TABLE_ADDR); - - /* Check for some magic numbers */ - if ((le32_to_cpu(sysp->magic) != MYLO_MAGIC_SYS_PARAMS) || - (le32_to_cpu(boardp->magic) != MYLO_MAGIC_BOARD_PARAMS) || - (le32_to_cpu(parts->magic) != MYLO_MAGIC_PARTITIONS)) - goto out; - - myloader_info.vid = le32_to_cpu(sysp->vid); - myloader_info.did = le32_to_cpu(sysp->did); - myloader_info.svid = le32_to_cpu(sysp->svid); - myloader_info.sdid = le32_to_cpu(sysp->sdid); - - for (i = 0; i < MYLO_ETHADDR_COUNT; i++) { - int j; - for (j = 0; j < 6; j++) - myloader_info.macs[i][j] = boardp->addr[i].mac[j]; - } - - myloader_found = 1; - -out: - return myloader_found; -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/prom_read.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/prom_read.h deleted file mode 100644 index 1a6ea110c..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/prom_read.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Generic prom definitions - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _ADM5120_PROM_H_ -#define _ADM5120_PROM_H_ - -/* - * Helper routines - */ -static inline u16 prom_read_le16(void *buf) -{ - u8 *p = buf; - - return ((u16)p[0] + ((u16)p[1] << 8)); -} - -static inline u32 prom_read_le32(void *buf) -{ - u8 *p = buf; - - return ((u32)p[0] + ((u32)p[1] << 8) + ((u32)p[2] << 16) + - ((u32)p[3] << 24)); -} - -static inline u16 prom_read_be16(void *buf) -{ - u8 *p = buf; - - return (((u16)p[0] << 8) + (u16)p[1]); -} - -static inline u32 prom_read_be32(void *buf) -{ - u8 *p = buf; - - return (((u32)p[0] << 24) + ((u32)p[1] << 16) + ((u32)p[2] << 8) + - ((u32)p[3])); -} - -#endif /* _ADM5120_PROM_H_ */ - - diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/routerboot.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/routerboot.c deleted file mode 100644 index d9a06d968..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/prom/routerboot.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Mikrotik's RouterBOOT specific prom routines - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include "prom_read.h" - -struct rb_hard_settings rb_hs; -static int rb_found; - -static int __init routerboot_load_hs(u8 *buf, u16 buflen) -{ - u16 id, len; - - memset(&rb_hs, 0, sizeof(rb_hs)); - - if (buflen < 4) - return -1; - - if (prom_read_le32(buf) != RB_MAGIC_HARD) - return -1; - - /* skip magic value */ - buf += 4; - buflen -= 4; - - while (buflen > 2) { - id = prom_read_le16(buf); - buf += 2; - buflen -= 2; - if (id == RB_ID_TERMINATOR || buflen < 2) - break; - - len = prom_read_le16(buf); - buf += 2; - buflen -= 2; - - if (buflen < len) - break; - - switch (id) { - case RB_ID_BIOS_VERSION: - rb_hs.bios_ver = (char *)buf; - break; - case RB_ID_BOARD_NAME: - rb_hs.name = (char *)buf; - break; - case RB_ID_MEMORY_SIZE: - rb_hs.mem_size = prom_read_le32(buf); - break; - case RB_ID_MAC_ADDRESS_COUNT: - rb_hs.mac_count = prom_read_le32(buf); - break; - case RB_ID_MAC_ADDRESS_PACK: - if ((len / RB_MAC_SIZE) > 0) - rb_hs.mac_base = buf; - break; - } - - buf += len; - buflen -= len; - - } - - return 0; -} - -#define RB_BS_OFFS 0x14 -#define RB_OFFS_MAX (128*1024) - -int __init routerboot_present(void) -{ - struct rb_bios_settings *bs; - u8 *base; - u32 off, len; - - if (rb_found) - goto out; - - base = (u8 *)KSEG1ADDR(ADM5120_SRAM0_BASE); - bs = (struct rb_bios_settings *)(base + RB_BS_OFFS); - - off = prom_read_le32(&bs->hs_offs); - len = prom_read_le32(&bs->hs_size); - if (off > RB_OFFS_MAX) - goto out; - - if (routerboot_load_hs(base+off, len) != 0) - goto out; - - rb_found = 1; - -out: - return rb_found; -} - -char *routerboot_get_boardname(void) -{ - if (rb_found == 0) - return NULL; - - return rb_hs.name; -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/Makefile b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/Makefile deleted file mode 100644 index e8325a1b1..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -obj-y += p-33x.o - -obj-${CONFIG_ADM5120_MACH_P_334WT} += p-334wt.o -obj-${CONFIG_ADM5120_MACH_P_335} += p-335.o \ No newline at end of file diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-334wt.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-334wt.c deleted file mode 100644 index 6cc9aee85..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-334wt.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ZyXEL Prestige P-334WT support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "p-33x.h" - -static struct gpio_led p334wt_gpio_leds[] __initdata = { - GPIO_LED_INV(ADM5120_GPIO_PIN2, "power", NULL), - GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL), - GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL), - GPIO_LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL), - GPIO_LED_INV(ADM5120_GPIO_P2L2, "otist", NULL), - GPIO_LED_INV(ADM5120_GPIO_P1L2, "hidden", NULL), -}; - -static void __init p334wt_setup(void) -{ - p33x_generic_setup(); - adm5120_add_device_gpio_leds(ARRAY_SIZE(p334wt_gpio_leds), - p334wt_gpio_leds); -} - -MIPS_MACHINE(MACH_ADM5120_P334WT, "P-334WT", "ZyXEL Prestige 334WT", - p334wt_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-335.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-335.c deleted file mode 100644 index 6ac2b0915..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-335.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * ZyXEL Prestige P-335/335WT support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "p-33x.h" - -static void __init p335_setup(void) -{ - p33x_generic_setup(); - adm5120_add_device_usb(); -} - -MIPS_MACHINE(MACH_ADM5120_P335, "P-335", "ZyXEL Prestige 335/335WT", - p335_setup); diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.c b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.c deleted file mode 100644 index 2626cf9ee..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ZyXEL Prestige P-33x boards support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "p-33x.h" - -#include - -#define P33X_GPIO_FLASH_A20 ADM5120_GPIO_PIN5 -static struct mtd_partition p33x_partitions[] = { - { - .name = "bootbase", - .offset = 0, - .size = 16*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "rom", - .offset = MTDPART_OFS_APPEND, - .size = 16*1024, - .mask_flags = MTD_WRITEABLE, - } , { - .name = "bootext1", - .offset = MTDPART_OFS_APPEND, - .size = 32*1024, - } , { - .name = "bootext2", - .offset = MTDPART_OFS_APPEND, - .size = 64*1024, - } , { - .name = "trx", - .offset = MTDPART_OFS_APPEND, - .size = MTDPART_SIZ_FULL, - } , { - .name = "firmware", - .offset = 32*1024, - .size = MTDPART_SIZ_FULL, - } -}; - -static struct adm5120_pci_irq p33x_pci_irqs[] __initdata = { - PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0), -}; - -static u8 p33x_vlans[6] __initdata = { - /* FIXME: untested */ - 0x50, 0x48, 0x44, 0x42, 0x41, 0x00 -}; - -static void switch_bank_gpio5(unsigned bank) -{ - switch (bank) { - case 0: - gpio_set_value(P33X_GPIO_FLASH_A20, 0); - break; - case 1: - gpio_set_value(P33X_GPIO_FLASH_A20, 1); - break; - } -} - -void __init p33x_generic_setup(void) -{ - /* setup data for flash0 device */ - gpio_request(P33X_GPIO_FLASH_A20, NULL); /* for flash A20 line */ - gpio_direction_output(P33X_GPIO_FLASH_A20, 0); - adm5120_flash0_data.switch_bank = switch_bank_gpio5; - adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions); - adm5120_flash0_data.parts = p33x_partitions; - adm5120_add_device_flash(0); - - adm5120_add_device_uart(0); - adm5120_add_device_uart(1); - - adm5120_setup_eth_macs(bootbase_info.mac); - adm5120_add_device_switch(6, p33x_vlans); - - adm5120_pci_set_irq_map(ARRAY_SIZE(p33x_pci_irqs), p33x_pci_irqs); -} diff --git a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.h b/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.h deleted file mode 100644 index 8a7340cb5..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/adm5120/zyxel/p-33x.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * ZyXEL Prestige P-33x boards support - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include - -#include - -#include -#include - -extern void p33x_generic_setup(void) __init; diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_defs.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_defs.h deleted file mode 100644 index bf220ff4d..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_defs.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ADM5120 SoC definitions - * - * This file defines some constants specific to the ADM5120 SoC - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ -#ifndef _ASM_MIPS_MACH_ADM5120_DEFS_H -#define _ASM_MIPS_MACH_ADM5120_DEFS_H - -#define ADM5120_SDRAM0_BASE 0x00000000 -#define ADM5120_SDRAM1_BASE 0x01000000 -#define ADM5120_SRAM1_BASE 0x10000000 -#define ADM5120_EXTIO0_BASE 0x10C00000 -#define ADM5120_EXTIO0_SIZE 0x00200000 -#define ADM5120_EXTIO1_BASE 0x10E00000 -#define ADM5120_EXTIO1_SIZE 0x00200000 -#define ADM5120_MPMC_BASE 0x11000000 -#define ADM5120_MPMC_SIZE 0x00200000 -#define ADM5120_USBC_BASE 0x11200000 -#define ADM5120_USBC_SIZE 0x00200000 -#define ADM5120_PCIMEM_BASE 0x11400000 -#define ADM5120_PCIMEM_SIZE 0x00100000 -#define ADM5120_PCIIO_BASE 0x11500000 -#define ADM5120_PCIIO_SIZE 0x000FFFF0 -#define ADM5120_PCICFG_ADDR 0x115FFFF0 -#define ADM5120_PCICFG_DATA 0x115FFFF8 -#define ADM5120_PCICFG_SIZE 0x00000010 -#define ADM5120_SWITCH_BASE 0x12000000 -#define ADM5120_SWITCH_SIZE 0x00200000 -#define ADM5120_INTC_BASE 0x12200000 -#define ADM5120_INTC_SIZE 0x00200000 -#define ADM5120_UART0_BASE 0x12600000 -#define ADM5120_UART1_BASE 0x12800000 -#define ADM5120_UART_SIZE 0x00200000 -#define ADM5120_SRAM0_BASE 0x1FC00000 - -#define ADM5120_NAND_BASE ADM5120_SRAM1_BASE -#define ADM5120_NAND_SIZE 0xB - -#define ADM5120_CLK_175 175000000 -#define ADM5120_CLK_200 200000000 -#define ADM5120_CLK_225 225000000 -#define ADM5120_CLK_250 250000000 - -#define ADM5120_UART_CLOCK 62500000 - -#endif /* _ASM_MIPS_MACH_ADM5120_DEFS_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_info.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_info.h deleted file mode 100644 index 1d34d80ee..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_info.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2007-2009 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _MACH_ADM5120_INFO_H -#define _MACH_ADM5120_INFO_H - -#include - -extern unsigned int adm5120_prom_type; -#define ADM5120_PROM_GENERIC 0 -#define ADM5120_PROM_CFE 1 -#define ADM5120_PROM_MYLOADER 2 -#define ADM5120_PROM_ROUTERBOOT 3 -#define ADM5120_PROM_BOOTBASE 4 -#define ADM5120_PROM_UBOOT 5 -#define ADM5120_PROM_LAST 5 - -extern unsigned int adm5120_product_code; -extern unsigned int adm5120_revision; -extern unsigned int adm5120_nand_boot; - -extern unsigned long adm5120_speed; -#define ADM5120_SPEED_175 175000000 -#define ADM5120_SPEED_200 200000000 -#define ADM5120_SPEED_225 225000000 -#define ADM5120_SPEED_250 250000000 - -extern unsigned int adm5120_package; -#define ADM5120_PACKAGE_PQFP 0 -#define ADM5120_PACKAGE_BGA 1 - -extern unsigned long adm5120_memsize; - -enum { - MACH_ADM5120_GENERIC = 0, /* Generic board */ - MACH_ADM5120_5GXI, /* OSBRiDGE 5GXi/5XLi */ - MACH_ADM5120_BR6104K, /* Edimax BR-6104K */ - MACH_ADM5120_BR6104KP, /* Edimax BR-6104KP */ - MACH_ADM5120_BR61X4WG, /* Edimax BR-6104Wg/BR-6114WG */ - MACH_ADM5120_CAS630, /* Cellvision CAS-630/630W */ - MACH_ADM5120_CAS670, /* Cellvision CAS-670/670W */ - MACH_ADM5120_CAS700, /* Cellvision CAS-700/700W */ - MACH_ADM5120_CAS771, /* Cellvision CAS-771/771W */ - MACH_ADM5120_CAS790, /* Cellvision CAS-790 */ - MACH_ADM5120_CAS861, /* Cellvision CAS-861/861W */ - MACH_ADM5120_EASY5120PATA, /* Infineon EASY 5120P-ATA */ - MACH_ADM5120_EASY5120RT, /* Infineon EASY 5120-RT */ - MACH_ADM5120_EASY5120WVOIP, /* Infineon EASY 5120-WVoIP */ - MACH_ADM5120_EASY83000, /* Infineon EASY-83000 */ - MACH_ADM5120_ES2108, /* ZyXEL Ethernet Switch 2108 */ - MACH_ADM5120_ES2108F, /* ZyXEL Ethernet Switch 2108-F */ - MACH_ADM5120_ES2108G, /* ZyXEL Ethernet Switch 2108-G */ - MACH_ADM5120_ES2108LC, /* ZyXEL Ethernet Switch 2108-LC */ - MACH_ADM5120_ES2108PWR, /* ZyXEL Ethernet Switch 2108-PWR */ - MACH_ADM5120_ES2024A, /* ZyXEL Ethernet Switch 2024A */ - MACH_ADM5120_ES2024PWR, /* ZyXEL Ethernet Switch 2024PWR */ - MACH_ADM5120_HS100, /* ZyXEL HomeSafe 100/100W */ - MACH_ADM5120_NFS101U, /* Cellvision NFS-101U/101WU */ - MACH_ADM5120_NFS202U, /* Cellvision NFS-202U/202WU */ - MACH_ADM5120_NP28G, /* Compex NP28G */ - MACH_ADM5120_NP28GHS, /* Compex NP28G HotSpot */ - MACH_ADM5120_NP27G, /* Compex NP27G */ - MACH_ADM5120_RB_11X, /* Mikrotik RouterBOARD 111/112 */ - MACH_ADM5120_RB_133, /* Mikrotik RouterBOARD 133 */ - MACH_ADM5120_RB_133C, /* Mikrotik RouterBOARD 133c */ - MACH_ADM5120_RB_150, /* Mikrotik RouterBOARD 150 */ - MACH_ADM5120_RB_153, /* Mikrotik RouterBOARD 153 */ - MACH_ADM5120_RB_192, /* Mikrotik RouterBOARD 192 */ - MACH_ADM5120_P334U, /* ZyXEL Prestige 334U */ - MACH_ADM5120_P334W, /* ZyXEL Prestige 334W */ - MACH_ADM5120_P334WH, /* ZyXEL Prestige 334WH */ - MACH_ADM5120_P334WHD, /* ZyXEL Prestige 334WHD */ - MACH_ADM5120_P334WT, /* ZyXEL Prestige 334WT */ - MACH_ADM5120_P335, /* ZyXEL Prestige 335/335WT */ - MACH_ADM5120_P335PLUS, /* ZyXEL Prestige 335Plus */ - MACH_ADM5120_P335U, /* ZyXEL Prestige 335U */ - MACH_ADM5120_PMUGW, /* Motorola Powerline MU Gateway */ - MACH_ADM5120_WP54, /* Compex WP54G/WP54AG/WPP54G/WPP54AG */ - MACH_ADM5120_WP54G_WRT, /* Compex WP54G-WRT */ - MACH_ADM5120_WP54Gv1C, /* Compex WP54G version 1C */ - MACH_ADM5120_EB_214A, /* Generic EB-214A */ -}; - -/* - * TODO:remove adm5120_eth* variables when the switch driver will be - * converted into a real platform driver - */ -extern unsigned int adm5120_eth_num_ports; -extern unsigned char adm5120_eth_macs[6][6]; -extern unsigned char adm5120_eth_vlans[6]; - -extern void adm5120_soc_init(void) __init; -extern void adm5120_mem_init(void) __init; -extern void adm5120_ndelay(u32 ns); - -extern void (*adm5120_board_reset)(void); - -extern void adm5120_gpio_init(void) __init; -extern void adm5120_gpio_csx0_enable(void) __init; -extern void adm5120_gpio_csx1_enable(void) __init; -extern void adm5120_gpio_ew_enable(void) __init; - -static inline int adm5120_package_pqfp(void) -{ - return (adm5120_package == ADM5120_PACKAGE_PQFP); -} - -static inline int adm5120_package_bga(void) -{ - return (adm5120_package == ADM5120_PACKAGE_BGA); -} - -static inline int adm5120_has_pci(void) -{ - return (adm5120_package == ADM5120_PACKAGE_BGA); -} - -static inline int adm5120_has_gmii(void) -{ - return (adm5120_package == ADM5120_PACKAGE_BGA); -} - -#endif /* _MACH_ADM5120_INFO_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_intc.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_intc.h deleted file mode 100644 index 70dd6bbe8..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_intc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * ADM5120 interrupt controller definitions - * - * This header file defines the hardware registers of the ADM5120 SoC - * built-in interrupt controller. - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _MACH_ADM5120_INTC_H -#define _MACH_ADM5120_INTC_H - -/* - * INTC register offsets - */ -#define INTC_REG_IRQ_STATUS 0x00 /* Interrupt status after masking */ -#define INTC_REG_IRQ_RAW_STATUS 0x04 /* Interrupt status before masking */ -#define INTC_REG_IRQ_ENABLE 0x08 /* Used to enable the interrupt sources */ -#define INTC_REG_IRQ_ENABLE_CLEAR 0x0C /* Used to disable the interrupt sources */ -#define INTC_REG_IRQ_DISABLE INTC_REG_IRQ_ENABLE_CLEAR -#define INTC_REG_INT_MODE 0x14 /* The interrupt mode of the sources */ -#define INTC_REG_FIQ_STATUS 0x18 /* FIQ status */ -#define INTC_REG_IRQ_TEST_SOURCE 0x1C -#define INTC_REG_IRQ_SOURCE_SELECT 0x20 -#define INTC_REG_INT_LEVEL 0x24 - -/* - * INTC IRQ numbers - */ -#define INTC_IRQ_TIMER 0 /* built in timer */ -#define INTC_IRQ_UART0 1 /* built-in UART0 */ -#define INTC_IRQ_UART1 2 /* built-in UART1 */ -#define INTC_IRQ_USBC 3 /* USB Host Controller */ -#define INTC_IRQ_GPIO2 4 /* GPIO line 2 */ -#define INTC_IRQ_GPIO4 5 /* GPIO line 4 */ -#define INTC_IRQ_PCI0 6 /* PCI slot 2 */ -#define INTC_IRQ_PCI1 7 /* PCI slot 3 */ -#define INTC_IRQ_PCI2 8 /* PCI slot 4 */ -#define INTC_IRQ_SWITCH 9 /* built-in ethernet switch */ -#define INTC_IRQ_LAST INTC_IRQ_SWITCH -#define INTC_IRQ_COUNT 10 - -/* - * INTC register bits - */ -#define INTC_INT_TIMER (1 << INTC_IRQ_TIMER) -#define INTC_INT_UART0 (1 << INTC_IRQ_UART0) -#define INTC_INT_UART1 (1 << INTC_IRQ_UART1) -#define INTC_INT_USBC (1 << INTC_IRQ_USBC) -#define INTC_INT_INTX0 (1 << INTC_IRQ_INTX0) -#define INTC_INT_INTX1 (1 << INTC_IRQ_INTX1) -#define INTC_INT_PCI0 (1 << INTC_IRQ_PCI0) -#define INTC_INT_PCI1 (1 << INTC_IRQ_PCI1) -#define INTC_INT_PCI2 (1 << INTC_IRQ_PCI2) -#define INTC_INT_SWITCH (1 << INTC_IRQ_SWITCH) -#define INTC_INT_ALL ((1 << INTC_IRQ_COUNT) - 1) - -#endif /* _MACH_ADM5120_INTC_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_mpmc.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_mpmc.h deleted file mode 100644 index c4e9591fb..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_mpmc.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * ADM5120 MPMC (Multiport Memory Controller) register definitions - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _MACH_ADM5120_MPMC_H -#define _MACH_ADM5120_MPMC_H - -#define MPMC_READ_REG(r) __raw_readl( \ - (void __iomem *)KSEG1ADDR(ADM5120_MPMC_BASE) + MPMC_REG_ ## r) -#define MPMC_WRITE_REG(r, v) __raw_writel((v), \ - (void __iomem *)KSEG1ADDR(ADM5120_MPMC_BASE) + MPMC_REG_ ## r) - -#define MPMC_REG_CTRL 0x0000 -#define MPMC_REG_STATUS 0x0004 -#define MPMC_REG_CONF 0x0008 -#define MPMC_REG_DC 0x0020 -#define MPMC_REG_DR 0x0024 -#define MPMC_REG_DRP 0x0030 - -#define MPMC_REG_DC0 0x0100 -#define MPMC_REG_DRC0 0x0104 -#define MPMC_REG_DC1 0x0120 -#define MPMC_REG_DRC1 0x0124 -#define MPMC_REG_DC2 0x0140 -#define MPMC_REG_DRC2 0x0144 -#define MPMC_REG_DC3 0x0160 -#define MPMC_REG_DRC3 0x0164 -#define MPMC_REG_SC0 0x0200 /* for F_CS1_N */ -#define MPMC_REG_SC1 0x0220 /* for F_CS0_N */ -#define MPMC_REG_SC2 0x0240 -#define MPMC_REG_WEN2 0x0244 -#define MPMC_REG_OEN2 0x0248 -#define MPMC_REG_RD2 0x024C -#define MPMC_REG_PG2 0x0250 -#define MPMC_REG_WR2 0x0254 -#define MPMC_REG_TN2 0x0258 -#define MPMC_REG_SC3 0x0260 - -/* Control register bits */ -#define MPMC_CTRL_AM (1 << 1) /* Address Mirror */ -#define MPMC_CTRL_LPM (1 << 2) /* Low Power Mode */ -#define MPMC_CTRL_DWB (1 << 3) /* Drain Write Buffers */ - -/* Status register bits */ -#define MPMC_STATUS_BUSY (1 << 0) /* Busy */ -#define MPMC_STATUS_WBS (1 << 1) /* Write Buffer Status */ -#define MPMC_STATUS_SRA (1 << 2) /* Self-Refresh Acknowledge*/ - -/* Dynamic Control register bits */ -#define MPMC_DC_CE (1 << 0) -#define MPMC_DC_DMC (1 << 1) -#define MPMC_DC_SRR (1 << 2) -#define MPMC_DC_SI_SHIFT 7 -#define MPMC_DC_SI_MASK (3 << 7) -#define MPMC_DC_SI_NORMAL (0 << 7) -#define MPMC_DC_SI_MODE (1 << 7) -#define MPMC_DC_SI_PALL (2 << 7) -#define MPMC_DC_SI_NOP (3 << 7) - -#define SRAM_REG_CONF 0x00 -#define SRAM_REG_WWE 0x04 -#define SRAM_REG_WOE 0x08 -#define SRAM_REG_WRD 0x0C -#define SRAM_REG_WPG 0x10 -#define SRAM_REG_WWR 0x14 -#define SRAM_REG_WTR 0x18 - -/* Dynamic Configuration register bits */ -#define DC_BE (1 << 19) /* buffer enable */ -#define DC_RW_SHIFT 28 /* shift for number of rows */ -#define DC_RW_MASK 0x03 -#define DC_NB_SHIFT 26 /* shift for number of banks */ -#define DC_NB_MASK 0x01 -#define DC_CW_SHIFT 22 /* shift for number of columns */ -#define DC_CW_MASK 0x07 -#define DC_DW_SHIFT 7 /* shift for device width */ -#define DC_DW_MASK 0x03 - -/* Static Configuration register bits */ -#define SC_MW_MASK 0x03 /* memory width mask */ -#define SC_MW_8 0x00 /* 8 bit memory width */ -#define SC_MW_16 0x01 /* 16 bit memory width */ -#define SC_MW_32 0x02 /* 32 bit memory width */ - -#endif /* _MACH_ADM5120_MPMC_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_nand.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_nand.h deleted file mode 100644 index 1e2f3bd15..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_nand.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * ADM5120 NAND interface definitions - * - * This header file defines the hardware registers of the ADM5120 SoC - * built-in NAND interface. - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * NAND interface routines was based on a driver for Linux 2.6.19+ which - * was derived from the driver for Linux 2.4.xx published by Mikrotik for - * their RouterBoard 1xx and 5xx series boards. - * Copyright (C) 2007 David Goodenough - * Copyright (C) 2007 Florian Fainelli - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _MACH_ADM5120_NAND_H -#define _MACH_ADM5120_NAND_H - -#include -#include - -#include -#include - -/* NAND control registers */ -#define NAND_REG_DATA 0x0 /* data register */ -#define NAND_REG_SET_CEn 0x1 /* CE# low */ -#define NAND_REG_CLR_CEn 0x2 /* CE# high */ -#define NAND_REG_CLR_CLE 0x3 /* CLE low */ -#define NAND_REG_SET_CLE 0x4 /* CLE high */ -#define NAND_REG_CLR_ALE 0x5 /* ALE low */ -#define NAND_REG_SET_ALE 0x6 /* ALE high */ -#define NAND_REG_SET_SPn 0x7 /* SP# low (use spare area) */ -#define NAND_REG_CLR_SPn 0x8 /* SP# high (do not use spare area) */ -#define NAND_REG_SET_WPn 0x9 /* WP# low */ -#define NAND_REG_CLR_WPn 0xA /* WP# high */ -#define NAND_REG_STATUS 0xB /* Status register */ - -#define ADM5120_NAND_STATUS_READY 0x80 - -#define NAND_READ_REG(r) \ - readb((void __iomem *)KSEG1ADDR(ADM5120_NAND_BASE) + (r)) -#define NAND_WRITE_REG(r, v) \ - writeb((v), (void __iomem *)KSEG1ADDR(ADM5120_NAND_BASE) + (r)) - -/*-------------------------------------------------------------------------*/ - -static inline void adm5120_nand_enable(void) -{ - SW_WRITE_REG(SWITCH_REG_BW_CNTL1, BW_CNTL1_NAND_ENABLE); - SW_WRITE_REG(SWITCH_REG_BOOT_DONE, 1); -} - -static inline void adm5120_nand_set_wpn(unsigned int set) -{ - NAND_WRITE_REG((set) ? NAND_REG_SET_WPn : NAND_REG_CLR_WPn, 1); -} - -static inline void adm5120_nand_set_spn(unsigned int set) -{ - NAND_WRITE_REG((set) ? NAND_REG_SET_SPn : NAND_REG_CLR_SPn, 1); -} - -static inline void adm5120_nand_set_cle(unsigned int set) -{ - NAND_WRITE_REG((set) ? NAND_REG_SET_CLE : NAND_REG_CLR_CLE, 1); -} - -static inline void adm5120_nand_set_ale(unsigned int set) -{ - NAND_WRITE_REG((set) ? NAND_REG_SET_ALE : NAND_REG_CLR_ALE, 1); -} - -static inline void adm5120_nand_set_cen(unsigned int set) -{ - NAND_WRITE_REG((set) ? NAND_REG_SET_CEn : NAND_REG_CLR_CEn, 1); -} - -static inline u8 adm5120_nand_get_status(void) -{ - return NAND_READ_REG(NAND_REG_STATUS); -} - -#endif /* _MACH_ADM5120_NAND_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_platform.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_platform.h deleted file mode 100644 index ed73b5329..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_platform.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * ADM5120 specific platform definitions - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _ASM_MIPS_MACH_ADM5120_PLATFORM_H -#define _ASM_MIPS_MACH_ADM5120_PLATFORM_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct adm5120_flash_platform_data { - void (*set_vpp)(struct map_info *, int); - void (*switch_bank)(unsigned); - u32 window_size; - unsigned int nr_parts; - struct mtd_partition *parts; -}; - -struct adm5120_switch_platform_data { - /* TODO: not yet implemented */ -}; - -struct adm5120_pci_irq { - u8 slot; - u8 func; - u8 pin; - unsigned irq; -}; - -#define PCIIRQ(s, f, p, i) {.slot = (s), .func = (f), .pin = (p), .irq = (i)} - -#ifdef CONFIG_PCI -extern void adm5120_pci_set_irq_map(unsigned int nr_irqs, - struct adm5120_pci_irq *map) __init; -#else -static inline void adm5120_pci_set_irq_map(unsigned int nr_irqs, - struct adm5120_pci_irq *map) -{ -} -#endif - -extern void adm5120_setup_eth_macs(u8 *mac_base) __init; - -extern struct adm5120_flash_platform_data adm5120_flash0_data; -extern struct adm5120_flash_platform_data adm5120_flash1_data; - -extern void adm5120_add_device_flash(unsigned id) __init; -extern void adm5120_add_device_usb(void) __init; -extern void adm5120_add_device_uart(unsigned id) __init; -extern void adm5120_add_device_nand(struct platform_nand_data *pdata) __init; -extern void adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map) __init; -extern void adm5120_register_gpio_buttons(int id, - unsigned poll_interval, - unsigned nbuttons, - struct gpio_keys_button *buttons); - -#define GPIO_LED_DEF(g, n, t, a) { \ - .name = (n), \ - .default_trigger = (t), \ - .gpio = (g), \ - .active_low = (a) \ -} - -#define GPIO_LED_STD(g, n, t) GPIO_LED_DEF((g), (n), (t), 0) -#define GPIO_LED_INV(g, n, t) GPIO_LED_DEF((g), (n), (t), 1) - -extern void adm5120_add_device_gpio_leds(unsigned num_leds, - struct gpio_led *leds) __init; - -#endif /* _ASM_MIPS_MACH_ADM5120_PLATFORM_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_switch.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_switch.h deleted file mode 100644 index 91adc5bae..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_switch.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - * ADM5120 ethernet switch definitions - * - * This header file defines the hardware registers of the ADM5120 SoC - * built-in Ethernet switch. - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _MACH_ADM5120_SWITCH_H -#define _MACH_ADM5120_SWITCH_H - -#ifndef BIT -# define BIT(at) (1 << (at)) -#endif -#define BITMASK(len) (BIT(len)-1) - -#define SW_READ_REG(r) __raw_readl( \ - (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE) + r) -#define SW_WRITE_REG(r, v) __raw_writel((v), \ - (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE) + r) - -/* Switch register offsets */ -#define SWITCH_REG_CODE 0x0000 -#define SWITCH_REG_SOFT_RESET 0x0004 /* Soft Reset */ -#define SWITCH_REG_BOOT_DONE 0x0008 /* Boot Done */ -#define SWITCH_REG_SW_RESET 0x000C /* Switch Reset */ -#define SWITCH_REG_PHY_STATUS 0x0014 /* PHY Status */ -#define SWITCH_REG_MEMCTRL 0x001C /* Memory Control */ -#define SWITCH_REG_CPUP_CONF 0x0024 /* CPU Port Configuration */ -#define SWITCH_REG_PORT_CONF0 0x0028 /* Port Configuration 0 */ -#define SWITCH_REG_PORT_CONF1 0x002C /* Port Configuration 1 */ -#define SWITCH_REG_PORT_CONF2 0x0030 /* Port Configuration 2 */ -#define SWITCH_REG_VLAN_G1 0x0040 /* VLAN group 1 */ -#define SWITCH_REG_VLAN_G2 0x0044 /* VLAN group 2 */ -#define SWITCH_REG_SEND_TRIG 0x0048 /* Send Trigger */ -#define SWITCH_REG_MAC_WT0 0x0058 /* MAC Write Address 0 */ -#define SWITCH_REG_MAC_WT1 0x005C /* MAC Write Address 1 */ -#define SWITCH_REG_BW_CNTL0 0x0060 /* Bandwidth Control 0 */ -#define SWITCH_REG_BW_CNTL1 0x0064 /* Bandwidth Control 1 */ -#define SWITCH_REG_PHY_CNTL0 0x0068 /* PHY Control 0 */ -#define SWITCH_REG_PHY_CNTL1 0x006C /* PHY Control 1 */ -#define SWITCH_REG_PORT_TH 0x0078 /* Port Threshold */ -#define SWITCH_REG_PHY_CNTL2 0x007C /* PHY Control 2 */ -#define SWITCH_REG_PHY_CNTL3 0x0080 /* PHY Control 3 */ -#define SWITCH_REG_PRI_CNTL 0x0084 /* Priority Control */ -#define SWITCH_REG_PHY_CNTL4 0x00A0 /* PHY Control 4 */ -#define SWITCH_REG_EMPTY_CNT 0x00A4 /* Empty Count */ -#define SWITCH_REG_PORT_CNTLS 0x00A8 /* Port Control Select */ -#define SWITCH_REG_PORT_CNTL 0x00AC /* Port Control */ -#define SWITCH_REG_INT_STATUS 0x00B0 /* Interrupt Status */ -#define SWITCH_REG_INT_MASK 0x00B4 /* Interrupt Mask */ -#define SWITCH_REG_GPIO_CONF0 0x00B8 /* GPIO Configuration 0 */ -#define SWITCH_REG_GPIO_CONF2 0x00BC /* GPIO Configuration 1 */ -#define SWITCH_REG_WDOG0 0x00C0 /* Watchdog 0 */ -#define SWITCH_REG_WDOG1 0x00C4 /* Watchdog 1 */ - -#define SWITCH_REG_SHDA 0x00D0 /* Send High Descriptors Address */ -#define SWITCH_REG_SLDA 0x00D4 /* Send Low Descriptors Address */ -#define SWITCH_REG_RHDA 0x00D8 /* Receive High Descriptor Address */ -#define SWITCH_REG_RLDA 0x00DC /* Receive Low Descriptor Address */ -#define SWITCH_REG_SHWA 0x00E0 /* Send High Working Address */ -#define SWITCH_REG_SLWA 0x00E4 /* Send Low Working Address */ -#define SWITCH_REG_RHWA 0x00E8 /* Receive High Working Address */ -#define SWITCH_REG_RLWA 0x00EC /* Receive Low Working Address */ - -#define SWITCH_REG_TIMER_INT 0x00F0 /* Timer */ -#define SWITCH_REG_TIMER 0x00F4 /* Timer Interrupt */ - -#define SWITCH_REG_PORT0_LED 0x0100 -#define SWITCH_REG_PORT1_LED 0x0104 -#define SWITCH_REG_PORT2_LED 0x0108 -#define SWITCH_REG_PORT3_LED 0x010C -#define SWITCH_REG_PORT4_LED 0x0110 - -/* CODE register bits */ -#define CODE_PC_MASK BITMASK(16) /* Product Code */ -#define CODE_REV_SHIFT 16 -#define CODE_REV_MASK BITMASK(4) /* Product Revision */ -#define CODE_CLKS_SHIFT 20 -#define CODE_CLKS_MASK BITMASK(2) /* Clock Speed */ -#define CODE_CLKS_175 0 /* 175 MHz */ -#define CODE_CLKS_200 1 /* 200 MHz */ -#define CODE_CLKS_225 2 /* 225 MHz */ -#define CODE_CLKS_250 3 /* 250 MHz */ -#define CODE_NAB BIT(24) /* NAND boot */ -#define CODE_PK_MASK BITMASK(1) /* Package type */ -#define CODE_PK_SHIFT 29 -#define CODE_PK_BGA 0 /* BGA package */ -#define CODE_PK_PQFP 1 /* PQFP package */ - -/* MEMCTRL register bits */ -#define MEMCTRL_SDRS_MASK BITMASK(3) /* SDRAM bank size */ -#define MEMCTRL_SDRS_4M 0x01 -#define MEMCTRL_SDRS_8M 0x02 -#define MEMCTRL_SDRS_16M 0x03 -#define MEMCTRL_SDRS_64M 0x04 -#define MEMCTRL_SDRS_128M 0x05 -#define MEMCTRL_SDR1_ENABLE BIT(5) /* enable SDRAM bank 1 */ - -#define MEMCTRL_SRS0_SHIFT 8 /* shift for SRAM0 size */ -#define MEMCTRL_SRS1_SHIFT 16 /* shift for SRAM1 size */ -#define MEMCTRL_SRS_MASK BITMASK(3) /* SRAM size mask */ -#define MEMCTRL_SRS_DISABLED 0x00 /* Disabled */ -#define MEMCTRL_SRS_512K 0x01 /* 512KB*/ -#define MEMCTRL_SRS_1M 0x02 /* 1MB */ -#define MEMCTRL_SRS_2M 0x03 /* 2MB */ -#define MEMCTRL_SRS_4M 0x04 /* 4MB */ - -/* Port bits used in various registers */ -#define SWITCH_PORT_PHY0 BIT(0) -#define SWITCH_PORT_PHY1 BIT(1) -#define SWITCH_PORT_PHY2 BIT(2) -#define SWITCH_PORT_PHY3 BIT(3) -#define SWITCH_PORT_PHY4 BIT(4) -#define SWITCH_PORT_MII BIT(5) -#define SWITCH_PORT_CPU BIT(6) - -/* Port bit shorthands */ -#define SWITCH_PORTS_PHY 0x1F /* phy ports */ -#define SWITCH_PORTS_NOCPU 0x3F /* physical ports */ -#define SWITCH_PORTS_ALL 0x7F /* all ports */ - -/* CPUP_CONF register bits */ -#define CPUP_CONF_DCPUP BIT(0) /* Disable CPU port */ -#define CPUP_CONF_CRCP BIT(1) /* CRC padding from CPU */ -#define CPUP_CONF_BTM BIT(2) /* Bridge Testing Mode */ -#define CPUP_CONF_DUNP_SHIFT 9 /* Disable Unknown Packets for portX */ -#define CPUP_CONF_DMCP_SHIFT 16 /* Disable Mcast Packets form portX */ -#define CPUP_CONF_DBCP_SHIFT 24 /* Disable Bcast Packets form portX */ - -/* PORT_CONF0 register bits */ -#define PORT_CONF0_DP_SHIFT 0 /* Disable Port */ -#define PORT_CONF0_EMCP_SHIFT 8 /* Enable All MC Packets */ -#define PORT_CONF0_BP_SHIFT 16 /* Enable Back Pressure */ - -/* PORT_CONF1 register bits */ -#define PORT_CONF1_DISL_SHIFT 0 /* Disable Learning */ -#define PORT_CONF1_BS_SHIFT 6 /* Blocking State */ -#define PORT_CONF1_BM_SHIFT 12 /* Blocking Mode */ - -/* SEND_TRIG register bits */ -#define SEND_TRIG_STL BIT(0) /* Send Trigger Low */ -#define SEND_TRIG_STH BIT(1) /* Send Trigger High */ - -/* MAC_WT0 register bits */ -#define MAC_WT0_MAWC BIT(0) /* MAC address write command */ -#define MAC_WT0_MWD_SHIFT 1 -#define MAC_WT0_MWD BIT(1) /* MAC write done */ -#define MAC_WT0_WFB BIT(2) /* Write Filter Bit */ -#define MAC_WT0_WVN_SHIFT 3 /* Write Vlan Number shift */ -#define MAC_WT0_WVE BIT(6) /* Write VLAN enable */ -#define MAC_WT0_WPMN_SHIFT 7 -#define MAC_WT0_WAF_SHIFT 13 /* Write Age Field shift */ -#define MAC_WT0_WAF_EMPTY 0 -#define MAC_WT0_WAF_STATIC 7 /* age: static */ -#define MAC_WT0_MAC0_SHIFT 16 -#define MAC_WT0_MAC1_SHIFT 24 - -/* MAC_WT1 register bits */ -#define MAC_WT1_MAC2_SHIFT 0 -#define MAC_WT1_MAC3_SHIFT 8 -#define MAC_WT1_MAC4_SHIFT 16 -#define MAC_WT1_MAC5_SHIFT 24 - -/* BW_CNTL0/BW_CNTL1 register bits */ -#define BW_CNTL_DISABLE 0x00 -#define BW_CNTL_64K 0x01 -#define BW_CNTL_128K 0x02 -#define BW_CNTL_256K 0x03 -#define BW_CNTL_512K 0x04 -#define BW_CNTL_1M 0x05 -#define BW_CNTL_4M 0x06 -#define BW_CNTL_10M 0x07 - -#define P4TBC_SHIFT 0 -#define P4RBC_SHIFT 4 -#define P5TBC_SHIFT 8 -#define P5RBC_SHIFT 12 - -#define BW_CNTL1_NAND_ENABLE 0x100 - -/* PHY_CNTL0 register bits */ -#define PHY_CNTL0_PHYA_MASK BITMASK(5) -#define PHY_CNTL0_PHYR_MASK BITMASK(5) -#define PHY_CNTL0_PHYR_SHIFT 8 -#define PHY_CNTL0_WC BIT(13) /* Write Command */ -#define PHY_CNTL0_RC BIT(14) /* Read Command */ -#define PHY_CNTL0_WTD_MASK BIT(16) /* Read Command */ -#define PHY_CNTL0_WTD_SHIFT 16 - -/* PHY_CNTL1 register bits */ -#define PHY_CNTL1_WOD BIT(0) /* Write Operation Done */ -#define PHY_CNTL1_ROD BIT(1) /* Read Operation Done */ -#define PHY_CNTL1_RD_MASK BITMASK(16) -#define PHY_CNTL1_RD_SHIFT 16 - -/* PHY_CNTL2 register bits */ -#define PHY_CNTL2_ANE_SHIFT 0 /* Auto Negotiation Enable */ -#define PHY_CNTL2_SC_SHIFT 5 /* Speed Control */ -#define PHY_CNTL2_DC_SHIFT 10 /* Duplex Control */ -#define PHY_CNTL2_FNCV_SHIFT 15 /* Recommended FC Value */ -#define PHY_CNTL2_PHYR_SHIFT 20 /* PHY reset */ -#define PHY_CNTL2_AMDIX_SHIFT 25 /* Auto MDIX enable */ -/* PHY_CNTL2_RMAE is bad in datasheet */ -#define PHY_CNTL2_RMAE BIT(31) /* Recommended MCC Average enable */ - -/* PHY_CNTL3 register bits */ -#define PHY_CNTL3_RNT BIT(10) /* Recommend Normal Threshold */ - -/* PORT_TH register bits */ -#define PORT_TH_PPT_MASK BITMASK(8) /* Per Port Threshold */ -#define PORT_TH_CPUT_SHIFT 8 /* CPU Port Buffer Threshold */ -#define PORT_TH_CPUT_MASK BITMASK(8) -#define PORT_TH_CPUHT_SHIFT 16 /* CPU Hold Threshold */ -#define PORT_TH_CPUHT_MASK BITMASK(8) -#define PORT_TH_CPURT_SHIFT 24 /* CPU Release Threshold */ -#define PORT_TH_CPURT_MASK BITMASK(8) - -/* EMPTY_CNT register bits */ -#define EMPTY_CNT_EBGB_MASK BITMASK(9) /* Empty Blocks in the Global Buffer */ - -/* GPIO_CONF0 register bits */ -#define GPIO_CONF0_MASK BITMASK(8) -#define GPIO_CONF0_IM_SHIFT 0 -#define GPIO_CONF0_IV_SHIFT 8 -#define GPIO_CONF0_OE_SHIFT 16 -#define GPIO_CONF0_OV_SHIFT 24 -#define GPIO_CONF0_IM_MASK (0xFF << GPIO_CONF0_IM_SHIFT) -#define GPIO_CONF0_IV_MASK (0xFF << GPIO_CONF0_IV_SHIFT) -#define GPIO_CONF0_OE_MASK (0xFF << GPIO_CONF0_OE_SHIFT) -#define GPIO_CONF0_OV_MASK (0xFF << GPIO_CONF0_OV_SHIFT) - -/* GPIO_CONF2 register bits */ -#define GPIO_CONF2_CSX0 BIT(4) /* enable CSX0:INTX0 on GPIO 1:2 */ -#define GPIO_CONF2_CSX1 BIT(5) /* enable CSX1:INTX1 on GPIO 3:4 */ -#define GPIO_CONF2_EW BIT(6) /* enable wait state pin for CSX0/1 */ - -/* INT_STATUS/INT_MASK register bits */ -#define SWITCH_INT_SHD BIT(0) /* Send High Done */ -#define SWITCH_INT_SLD BIT(1) /* Send Low Done */ -#define SWITCH_INT_RHD BIT(2) /* Receive High Done */ -#define SWITCH_INT_RLD BIT(3) /* Receive Low Done */ -#define SWITCH_INT_HDF BIT(4) /* High Descriptor Full */ -#define SWITCH_INT_LDF BIT(5) /* Low Descriptor Full */ -#define SWITCH_INT_P0QF BIT(6) /* Port0 Queue Full */ -#define SWITCH_INT_P1QF BIT(7) /* Port1 Queue Full */ -#define SWITCH_INT_P2QF BIT(8) /* Port2 Queue Full */ -#define SWITCH_INT_P3QF BIT(9) /* Port3 Queue Full */ -#define SWITCH_INT_P4QF BIT(10) /* Port4 Queue Full */ -#define SWITCH_INT_P5QF BIT(11) /* Port5 Queue Full */ -#define SWITCH_INT_CPQF BIT(13) /* CPU Queue Full */ -#define SWITCH_INT_GQF BIT(14) /* Global Queue Full */ -#define SWITCH_INT_MD BIT(15) /* Must Drop */ -#define SWITCH_INT_BCS BIT(16) /* BC Storm */ -#define SWITCH_INT_PSC BIT(18) /* Port Status Change */ -#define SWITCH_INT_ID BIT(19) /* Intruder Detected */ -#define SWITCH_INT_W0TE BIT(20) /* Watchdog 0 Timer Expired */ -#define SWITCH_INT_W1TE BIT(21) /* Watchdog 1 Timer Expired */ -#define SWITCH_INT_RDE BIT(22) /* Receive Descriptor Error */ -#define SWITCH_INT_SDE BIT(23) /* Send Descriptor Error */ -#define SWITCH_INT_CPUH BIT(24) /* CPU Hold */ - -/* TIMER_INT register bits */ -#define TIMER_INT_TOS BIT(0) /* time-out status */ -#define TIMER_INT_TOM BIT(16) /* mask time-out interrupt */ - -/* TIMER register bits */ -#define TIMER_PERIOD_MASK BITMASK(16) /* mask for timer period */ -#define TIMER_PERIOD_DEFAULT 0xFFFF /* default timer period */ -#define TIMER_TE BIT(16) /* timer enable bit */ - -/* PORTx_LED register bits */ -#define LED_MODE_MASK BITMASK(4) -#define LED_MODE_INPUT 0 -#define LED_MODE_FLASH 1 -#define LED_MODE_OUT_HIGH 2 -#define LED_MODE_OUT_LOW 3 -#define LED_MODE_LINK 4 -#define LED_MODE_SPEED 5 -#define LED_MODE_DUPLEX 6 -#define LED_MODE_ACT 7 -#define LED_MODE_COLL 8 -#define LED_MODE_LINK_ACT 9 -#define LED_MODE_DUPLEX_COLL 10 -#define LED_MODE_10M_ACT 11 -#define LED_MODE_100M_ACT 12 -#define LED0_MODE_SHIFT 0 /* LED0 mode shift */ -#define LED1_MODE_SHIFT 4 /* LED1 mode shift */ -#define LED2_MODE_SHIFT 8 /* LED2 mode shift */ -#define LED0_IV_SHIFT 12 /* LED0 input value shift */ -#define LED1_IV_SHIFT 13 /* LED1 input value shift */ -#define LED2_IV_SHIFT 14 /* LED2 input value shift */ - -#endif /* _MACH_ADM5120_SWITCH_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_uart.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_uart.h deleted file mode 100644 index 81d3067da..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/adm5120_uart.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * ADM5120 UART definitions - * - * This header file defines the hardware registers of the ADM5120 SoC - * built-in UARTs. - * - * Copyright (C) 2007 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _MACH_ADM5120_UART_H -#define _MACH_ADM5120_UART_H - -#define UART_BAUDDIV(clk, baud) ((clk/(16 * (baud)))-1) - -#define UART_REG_DATA 0x00 -#define UART_REG_RSR 0x04 -#define UART_REG_ECR UART_REG_RSR -#define UART_REG_LCRH 0x08 -#define UART_REG_LCRM 0x0C -#define UART_REG_LCRL 0x10 -#define UART_REG_CTRL 0x14 -#define UART_REG_FLAG 0x18 - -/* Receive Status Register bits */ -#define UART_RSR_FE (1 << 0) -#define UART_RSR_PE (1 << 1) -#define UART_RSR_BE (1 << 2) -#define UART_RSR_OE (1 << 3) -#define UART_RSR_ERR (UART_RSR_FE | UART_RSR_PE | UART_RSR_BE) - -#define UART_ECR_ALL 0xFF - -/* Line Control High register bits */ -#define UART_LCRH_BRK (1 << 0) /* send break */ -#define UART_LCRH_PEN (1 << 1) /* parity enable */ -#define UART_LCRH_EPS (1 << 2) /* even parity select */ -#define UART_LCRH_STP1 (0 << 3) /* one stop bits select */ -#define UART_LCRH_STP2 (1 << 3) /* two stop bits select */ -#define UART_LCRH_FEN (1 << 4) /* FIFO enable */ - -#define UART_LCRH_WLEN5 (0 << 5) -#define UART_LCRH_WLEN6 (1 << 5) -#define UART_LCRH_WLEN7 (2 << 5) -#define UART_LCRH_WLEN8 (3 << 5) - -/* Control register bits */ -#define UART_CTRL_EN (1 << 0) - -/* Flag register bits */ -#define UART_FLAG_CTS (1 << 0) -#define UART_FLAG_DSR (1 << 1) -#define UART_FLAG_DCD (1 << 2) -#define UART_FLAG_BUSY (1 << 3) -#define UART_FLAG_RXFE (1 << 4) -#define UART_FLAG_TXFF (1 << 5) -#define UART_FLAG_RXFF (1 << 6) -#define UART_FLAG_TXFE (1 << 7) - -#endif /* _MACH_ADM5120_UART_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/asm/sizes.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/asm/sizes.h deleted file mode 100644 index 503843db1..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/asm/sizes.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/* DO NOT EDIT!! - this file automatically generated - * from .s file by awk -f s2h.awk - */ -/* Size definitions - * Copyright (C) ARM Limited 1998. All rights reserved. - */ - -#ifndef __sizes_h -#define __sizes_h 1 - -/* handy sizes */ -#define SZ_16 0x00000010 -#define SZ_256 0x00000100 -#define SZ_512 0x00000200 - -#define SZ_1K 0x00000400 -#define SZ_4K 0x00001000 -#define SZ_8K 0x00002000 -#define SZ_16K 0x00004000 -#define SZ_64K 0x00010000 -#define SZ_128K 0x00020000 -#define SZ_256K 0x00040000 -#define SZ_512K 0x00080000 - -#define SZ_1M 0x00100000 -#define SZ_2M 0x00200000 -#define SZ_4M 0x00400000 -#define SZ_8M 0x00800000 -#define SZ_16M 0x01000000 -#define SZ_32M 0x02000000 -#define SZ_64M 0x04000000 -#define SZ_128M 0x08000000 -#define SZ_256M 0x10000000 -#define SZ_512M 0x20000000 - -#define SZ_1G 0x40000000 -#define SZ_2G 0x80000000 - -#endif - -/* END */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/cpu-feature-overrides.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/cpu-feature-overrides.h deleted file mode 100644 index c6310cc6e..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/cpu-feature-overrides.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * ADM5120 specific CPU feature overrides - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: include/asm-mips/cpu-features.h - * Copyright (C) 2003, 2004 Ralf Baechle - * Copyright (C) 2004 Maciej W. Rozycki - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ -#ifndef __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H -#define __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H - -/* - * The ADM5120 SOC has a built-in MIPS 4Kc core. - */ -#define cpu_has_tlb 1 -#define cpu_has_4kex 1 -#define cpu_has_3k_cache 0 -#define cpu_has_4k_cache 1 -#define cpu_has_tx39_cache 0 -#define cpu_has_sb1_cache 0 -#define cpu_has_fpu 0 -#define cpu_has_32fpr 0 -#define cpu_has_counter 1 -#define cpu_has_watch 1 -#define cpu_has_divec 1 -/* #define cpu_has_vce ? */ -/* #define cpu_has_cache_cdex_p ? */ -/* #define cpu_has_cache_cdex_s ? */ -#define cpu_has_prefetch 1 -/* #define cpu_has_mcheck ? */ -#define cpu_has_ejtag 1 -#define cpu_has_llsc 1 - -#define cpu_has_mips16 0 -#define cpu_has_mdmx 0 -#define cpu_has_mips3d 0 -#define cpu_has_smartmips 0 - -/* #define cpu_has_vtag_icache ? */ -/* #define cpu_has_dc_aliases ? */ -/* #define cpu_has_ic_fills_f_dc ? */ -/* #define cpu_has_pindexed_dcache ? */ - -/* #define cpu_icache_snoops_remote_store ? */ - -#define cpu_has_mips32r1 1 -#define cpu_has_mips32r2 0 -#define cpu_has_mips64r1 0 -#define cpu_has_mips64r2 0 - -#define cpu_has_dsp 0 -#define cpu_has_mipsmt 0 - -/* #define cpu_has_nofpuex ? */ -#define cpu_has_64bits 0 -#define cpu_has_64bit_zero_reg 0 -#define cpu_has_64bit_gp_regs 0 -#define cpu_has_64bit_addresses 0 - -/* #define cpu_has_inclusive_pcaches ? */ - -#define cpu_dcache_line_size() 16 -#define cpu_icache_line_size() 16 - -#endif /* __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/gpio.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/gpio.h deleted file mode 100644 index 7ba7efca1..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/gpio.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * ADM5120 GPIO wrappers for arch-neutral GPIO calls - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _ASM_MIPS_MACH_ADM5120_GPIO_H -#define _ASM_MIPS_MACH_ADM5120_GPIO_H - -#define ARCH_NR_GPIOS 64 - -#include - -#include - -#define ADM5120_GPIO_PIN0 0 -#define ADM5120_GPIO_PIN1 1 -#define ADM5120_GPIO_PIN2 2 -#define ADM5120_GPIO_PIN3 3 -#define ADM5120_GPIO_PIN4 4 -#define ADM5120_GPIO_PIN5 5 -#define ADM5120_GPIO_PIN6 6 -#define ADM5120_GPIO_PIN7 7 -#define ADM5120_GPIO_P0L0 8 -#define ADM5120_GPIO_P0L1 9 -#define ADM5120_GPIO_P0L2 10 -#define ADM5120_GPIO_P1L0 11 -#define ADM5120_GPIO_P1L1 12 -#define ADM5120_GPIO_P1L2 13 -#define ADM5120_GPIO_P2L0 14 -#define ADM5120_GPIO_P2L1 15 -#define ADM5120_GPIO_P2L2 16 -#define ADM5120_GPIO_P3L0 17 -#define ADM5120_GPIO_P3L1 18 -#define ADM5120_GPIO_P3L2 19 -#define ADM5120_GPIO_P4L0 20 -#define ADM5120_GPIO_P4L1 21 -#define ADM5120_GPIO_P4L2 22 -#define ADM5120_GPIO_MAX 22 -#define ADM5120_GPIO_COUNT ADM5120_GPIO_MAX+1 - -#define ADM5120_GPIO_LOW 0 -#define ADM5120_GPIO_HIGH 1 - -#define ADM5120_GPIO_SWITCH 0x10 -#define ADM5120_GPIO_FLASH (ADM5120_GPIO_SWITCH | LED_MODE_FLASH) -#define ADM5120_GPIO_LINK (ADM5120_GPIO_SWITCH | LED_MODE_LINK) -#define ADM5120_GPIO_SPEED (ADM5120_GPIO_SWITCH | LED_MODE_SPEED) -#define ADM5120_GPIO_DUPLEX (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX) -#define ADM5120_GPIO_ACT (ADM5120_GPIO_SWITCH | LED_MODE_ACT) -#define ADM5120_GPIO_COLL (ADM5120_GPIO_SWITCH | LED_MODE_COLL) -#define ADM5120_GPIO_LINK_ACT (ADM5120_GPIO_SWITCH | LED_MODE_LINK_ACT) -#define ADM5120_GPIO_DUPLEX_COLL (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX_COLL) -#define ADM5120_GPIO_10M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_10M_ACT) -#define ADM5120_GPIO_100M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_100M_ACT) - -extern int __adm5120_gpio0_get_value(unsigned gpio); -extern void __adm5120_gpio0_set_value(unsigned gpio, int value); -extern int __adm5120_gpio1_get_value(unsigned gpio); -extern void __adm5120_gpio1_set_value(unsigned gpio, int value); -extern int adm5120_gpio_to_irq(unsigned gpio); -extern int adm5120_irq_to_gpio(unsigned irq); - -static inline int gpio_get_value(unsigned gpio) -{ - int ret; - - switch (gpio) { - case ADM5120_GPIO_PIN0 ... ADM5120_GPIO_PIN7: - ret = __adm5120_gpio0_get_value(gpio); - break; - case ADM5120_GPIO_P0L0 ... ADM5120_GPIO_P4L2: - ret = __adm5120_gpio1_get_value(gpio - ADM5120_GPIO_P0L0); - break; - default: - ret = __gpio_get_value(gpio); - break; - } - - return ret; -} - -static inline void gpio_set_value(unsigned gpio, int value) -{ - switch (gpio) { - case ADM5120_GPIO_PIN0 ... ADM5120_GPIO_PIN7: - __adm5120_gpio0_set_value(gpio, value); - break; - case ADM5120_GPIO_P0L0 ... ADM5120_GPIO_P4L2: - __adm5120_gpio1_set_value(gpio - ADM5120_GPIO_P0L0, value); - break; - default: - __gpio_set_value(gpio, value); - break; - } -} - -static inline int gpio_to_irq(unsigned gpio) -{ - return adm5120_gpio_to_irq(gpio); -} - -static inline int irq_to_gpio(unsigned irq) -{ - return adm5120_irq_to_gpio(irq); -} - -#define gpio_cansleep __gpio_cansleep - -#endif /* _ASM_MIPS_MACH_ADM5120_GPIO_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/irq.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/irq.h deleted file mode 100644 index b0350c8b8..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/irq.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ADM5120 specific IRQ numbers - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ -#ifndef _ASM_MIPS_MACH_ADM5120_IRQ_H -#define _ASM_MIPS_MACH_ADM5120_IRQ_H - -#define MIPS_CPU_IRQ_BASE 0 -#define NR_IRQS 24 - -#include_next - -#include - -#define NO_IRQ (-1) - -#define MIPS_CPU_IRQ_COUNT 8 -#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x)) - -#define ADM5120_INTC_IRQ_BASE (MIPS_CPU_IRQ_BASE + MIPS_CPU_IRQ_COUNT) -#define ADM5120_INTC_IRQ(x) (ADM5120_INTC_IRQ_BASE + (x)) - -#define ADM5120_IRQ_INTC MIPS_CPU_IRQ(2) -#define ADM5120_IRQ_COUNTER MIPS_CPU_IRQ(7) - -#define ADM5120_IRQ_TIMER ADM5120_INTC_IRQ(INTC_IRQ_TIMER) -#define ADM5120_IRQ_UART0 ADM5120_INTC_IRQ(INTC_IRQ_UART0) -#define ADM5120_IRQ_UART1 ADM5120_INTC_IRQ(INTC_IRQ_UART1) -#define ADM5120_IRQ_USBC ADM5120_INTC_IRQ(INTC_IRQ_USBC) -#define ADM5120_IRQ_GPIO2 ADM5120_INTC_IRQ(INTC_IRQ_GPIO2) -#define ADM5120_IRQ_GPIO4 ADM5120_INTC_IRQ(INTC_IRQ_GPIO4) -#define ADM5120_IRQ_PCI0 ADM5120_INTC_IRQ(INTC_IRQ_PCI0) -#define ADM5120_IRQ_PCI1 ADM5120_INTC_IRQ(INTC_IRQ_PCI1) -#define ADM5120_IRQ_PCI2 ADM5120_INTC_IRQ(INTC_IRQ_PCI2) -#define ADM5120_IRQ_SWITCH ADM5120_INTC_IRQ(INTC_IRQ_SWITCH) - -#endif /* _ASM_MIPS_MACH_ADM5120_IRQ_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/admboot.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/admboot.h deleted file mode 100644 index fa42bf714..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/admboot.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * ADMBoot specific definitions - * - * Copyright (C) 2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _ADMBOOT_H -#define _ADMBOOT_H - -extern int admboot_get_mac_base(u32 offset, u32 len, u8 *mac) __init; - -#endif /* _ADMBOOT_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/cfe.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/cfe.h deleted file mode 100644 index 0cb3eee70..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/cfe.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Broadcom's CFE definitions - * - * Copyright (C) 2006-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _PROM_CFE_H_ -#define _PROM_CFE_H_ - -extern int cfe_present(void) __init; -extern char *cfe_getenv(char *); - -#endif /*_PROM_CFE_H_*/ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/generic.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/generic.h deleted file mode 100644 index 778df2467..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/generic.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Generic prom definitions - * - * Copyright (C) 2006-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _PROM_GENERIC_H_ -#define _PROM_GENERIC_H_ - -extern int generic_prom_present(void) __init; -extern char *generic_prom_getenv(char *); - -#endif /*_PROM_GENERIC_H_*/ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/myloader.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/myloader.h deleted file mode 100644 index ea8db81ed..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/myloader.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Compex's MyLoader specific definitions - * - * Copyright (C) 2006-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _MYLOADER_H_ -#define _MYLOADER_H_ - -/* - * Firmware file format: - * - *
- * [] - * ... - * [] - * - * [] - * ... - * [] - * - * - */ - -/* Myloader specific magic numbers */ -#define MYLO_MAGIC_FIRMWARE 0x4C594D00 -#define MYLO_MAGIC_20021103 0x20021103 -#define MYLO_MAGIC_20021107 0x20021107 - -#define MYLO_MAGIC_SYS_PARAMS MYLO_MAGIC_20021107 -#define MYLO_MAGIC_PARTITIONS MYLO_MAGIC_20021103 -#define MYLO_MAGIC_BOARD_PARAMS MYLO_MAGIC_20021103 - -/* - * Addresses of the data structures provided by MyLoader - */ -#define MYLO_MIPS_SYS_PARAMS 0x80000800 /* System Parameters */ -#define MYLO_MIPS_BOARD_PARAMS 0x80000A00 /* Board Parameters */ -#define MYLO_MIPS_PARTITIONS 0x80000C00 /* Partition Table */ -#define MYLO_MIPS_BOOT_PARAMS 0x80000E00 /* Boot Parameters */ - -/* Vendor ID's (seems to be same as the PCI vendor ID's) */ -#define VENID_COMPEX 0x11F6 - -/* Devices based on the ADM5120 */ -#define DEVID_COMPEX_NP27G 0x0078 -#define DEVID_COMPEX_NP28G 0x044C -#define DEVID_COMPEX_NP28GHS 0x044E -#define DEVID_COMPEX_WP54Gv1C 0x0514 -#define DEVID_COMPEX_WP54G 0x0515 -#define DEVID_COMPEX_WP54AG 0x0546 -#define DEVID_COMPEX_WPP54AG 0x0550 -#define DEVID_COMPEX_WPP54G 0x0555 - -/* Devices based on the IXP422 */ -#define DEVID_COMPEX_WP18 0x047E -#define DEVID_COMPEX_NP18A 0x0489 - -/* Other devices */ -#define DEVID_COMPEX_NP26G8M 0x03E8 -#define DEVID_COMPEX_NP26G16M 0x03E9 - -struct mylo_fw_header { - uint32_t magic; /* must be MYLO_MAGIC_FIRMWARE */ - uint32_t crc; /* CRC of the whole firmware */ - uint32_t res0; /* unknown/unused */ - uint32_t res1; /* unknown/unused */ - uint16_t vid; /* vendor ID */ - uint16_t did; /* device ID */ - uint16_t svid; /* sub vendor ID */ - uint16_t sdid; /* sub device ID */ - uint32_t rev; /* device revision */ - uint32_t fwhi; /* FIXME: firmware version high? */ - uint32_t fwlo; /* FIXME: firmware version low? */ - uint32_t flags; /* firmware flags */ -}; - -#define FW_FLAG_BOARD_PARAMS_WP 0x01 /* board parameters are write protected */ -#define FW_FLAG_BOOT_SECTOR_WE 0x02 /* enable of write boot sectors (below 64K) */ - -struct mylo_fw_blockdesc { - uint32_t type; /* block type */ - uint32_t addr; /* relative address to flash start */ - uint32_t dlen; /* size of block data in bytes */ - uint32_t blen; /* total size of block in bytes */ -}; - -#define FW_DESC_TYPE_UNUSED 0 -#define FW_DESC_TYPE_USED 1 - -struct mylo_partition { - uint16_t flags; /* partition flags */ - uint16_t type; /* type of the partition */ - uint32_t addr; /* relative address of the partition from the - flash start */ - uint32_t size; /* size of the partition in bytes */ - uint32_t param; /* if this is the active partition, the - MyLoader load code to this address */ -}; - -#define PARTITION_FLAG_ACTIVE 0x8000 /* this is the active partition, - * MyLoader loads firmware from here */ -#define PARTITION_FLAG_ISRAM 0x2000 /* FIXME: this is a RAM partition? */ -#define PARTIIION_FLAG_RAMLOAD 0x1000 /* FIXME: load this partition into the RAM? */ -#define PARTITION_FLAG_PRELOAD 0x0800 /* the partition data preloaded to RAM - * before decompression */ -#define PARTITION_FLAG_HAVEHDR 0x0002 /* the partition data have a header */ - -#define PARTITION_TYPE_FREE 0 -#define PARTITION_TYPE_USED 1 - -#define MYLO_MAX_PARTITIONS 8 /* maximum number of partitions in the - partition table */ - -struct mylo_partition_table { - uint32_t magic; /* must be MYLO_MAGIC_PARTITIONS */ - uint32_t res0; /* unknown/unused */ - uint32_t res1; /* unknown/unused */ - uint32_t res2; /* unknown/unused */ - struct mylo_partition partitions[MYLO_MAX_PARTITIONS]; -}; - -struct mylo_partition_header { - uint32_t len; /* length of the partition data */ - uint32_t crc; /* CRC value of the partition data */ -}; - -struct mylo_system_params { - uint32_t magic; /* must be MYLO_MAGIC_SYS_PARAMS */ - uint32_t res0; - uint32_t res1; - uint32_t mylo_ver; - uint16_t vid; /* Vendor ID */ - uint16_t did; /* Device ID */ - uint16_t svid; /* Sub Vendor ID */ - uint16_t sdid; /* Sub Device ID */ - uint32_t rev; /* device revision */ - uint32_t fwhi; - uint32_t fwlo; - uint32_t tftp_addr; - uint32_t prog_start; - uint32_t flash_size; /* Size of boot FLASH in bytes */ - uint32_t dram_size; /* Size of onboard RAM in bytes */ -}; - - -struct mylo_eth_addr { - uint8_t mac[6]; - uint8_t csum[2]; -}; - -#define MYLO_ETHADDR_COUNT 8 /* maximum number of ethernet address - in the board parameters */ - -struct mylo_board_params { - uint32_t magic; /* must be MYLO_MAGIC_BOARD_PARAMS */ - uint32_t res0; - uint32_t res1; - uint32_t res2; - struct mylo_eth_addr addr[MYLO_ETHADDR_COUNT]; -}; - -struct myloader_info { - u32 vid; - u32 did; - u32 svid; - u32 sdid; - uint8_t macs[MYLO_ETHADDR_COUNT][6]; -}; - -extern struct myloader_info myloader_info; -extern int myloader_present(void) __init; - -#endif /* _MYLOADER_H_*/ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/routerboot.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/routerboot.h deleted file mode 100644 index 91ac05a63..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/routerboot.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Mikrotik's RouterBOOT definitions - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _PROM_ROUTERBOOT_H_ -#define _PROM_ROUTERBOOT_H_ - -struct rb_bios_settings { - u32 hs_offs; /* hard settings offset */ - u32 hs_size; /* hard settings size */ - u32 fw_offs; /* firmware offset */ - u32 ss_offs; /* soft settings offset */ - u32 ss_size; /* soft settings size */ -}; - -struct rb_hard_settings { - char *name; /* board name */ - char *bios_ver; /* BIOS version */ - u32 mem_size; /* memory size in bytes */ - u32 mac_count; /* number of mac addresses */ - u8 *mac_base; /* mac address base */ -}; - -extern int routerboot_present(void) __init; -extern char *routerboot_get_boardname(void); - -extern struct rb_hard_settings rb_hs; - -#endif /* _PROM_ROUTERBOOT_H_ */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/zynos.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/zynos.h deleted file mode 100644 index d1e3e5b94..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/prom/zynos.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * ZyNOS (ZyXEL's Networking OS) definitions - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _ZYNOS_H -#define _ZYNOS_H - -#define ZYNOS_NAME_LEN 32 -#define ZYNOS_FEAT_BYTES 22 -#define ZYNOS_MAC_LEN 6 - -struct zynos_board_info { - unsigned char vendor[ZYNOS_NAME_LEN]; - unsigned char product[ZYNOS_NAME_LEN]; - u32 bootext_addr; - u32 res0; - u16 board_id; - u8 res1[6]; - u8 feat_other[ZYNOS_FEAT_BYTES]; - u8 feat_main; - u8 res2; - u8 mac[ZYNOS_MAC_LEN]; - u8 country; - u8 dbgflag; -} __attribute__ ((packed)); - -/* - * Vendor IDs - */ -#define ZYNOS_VENDOR_ID_ZYXEL 0 -#define ZYNOS_VENDOR_ID_NETGEAR 1 -#define ZYNOS_VENDOR_ID_DLINK 2 -#define ZYNOS_VENDOR_ID_OTHER 3 -#define ZYNOS_VENDOR_ID_LUCENT 4 - -/* - * Vendor names - */ -#define ZYNOS_VENDOR_DLINK "D-Link" -#define ZYNOS_VENDOR_LUCENT "LUCENT" -#define ZYNOS_VENDOR_NETGEAR "NetGear" -#define ZYNOS_VENDOR_ZYXEL "ZyXEL" - -/* - * Board IDs (big-endian) - */ -#define ZYNOS_BOARD_ES2108 0x00F2 /* Ethernet Switch 2108 */ -#define ZYNOS_BOARD_ES2108F 0x01AF /* Ethernet Switch 2108-F */ -#define ZYNOS_BOARD_ES2108G 0x00F3 /* Ethernet Switch 2108-G */ -#define ZYNOS_BOARD_ES2108LC 0x00FC /* Ethernet Switch 2108-LC */ -#define ZYNOS_BOARD_ES2108PWR 0x00F4 /* Ethernet Switch 2108PWR */ -#define ZYNOS_BOARD_HS100 0x9FF1 /* HomeSafe 100/100W */ -#define ZYNOS_BOARD_P334 0x9FF5 /* Prestige 334 */ -#define ZYNOS_BOARD_P334U 0x9FDD /* Prestige 334U */ -#define ZYNOS_BOARD_P334W 0x9FF3 /* Prestige 334W */ -#define ZYNOS_BOARD_P334WH 0x00E0 /* Prestige 334WH */ -#define ZYNOS_BOARD_P334WHD 0x00E1 /* Prestige 334WHD */ -#define ZYNOS_BOARD_P334WT 0x9FEF /* Prestige 334WT */ -#define ZYNOS_BOARD_P334WT_ALT 0x9F02 /* Prestige 334WT alternative*/ -#define ZYNOS_BOARD_P335 0x9FED /* Prestige 335/335WT */ -#define ZYNOS_BOARD_P335PLUS 0x0025 /* Prestige 335Plus */ -#define ZYNOS_BOARD_P335U 0x9FDC /* Prestige 335U */ - -/* - * Some magic numbers (big-endian) - */ -#define ZYNOS_MAGIC_DBGAREA1 0x48646267 /* "Hdbg" */ -#define ZYNOS_MAGIC_DBGAREA2 0x61726561 /* "area" */ - -struct bootbase_info { - u16 vendor_id; - u16 board_id; - u8 mac[6]; -}; - -extern struct bootbase_info bootbase_info; -extern int bootbase_present(void) __init; - -#endif /* _ZYNOS_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/war.h b/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/war.h deleted file mode 100644 index 87c35f375..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/include/asm/mach-adm5120/war.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 2002, 2004, 2007 by Ralf Baechle - */ -#ifndef __ASM_MIPS_MACH_ADM5120_WAR_H -#define __ASM_MIPS_MACH_ADM5120_WAR_H - -#define R4600_V1_INDEX_ICACHEOP_WAR 0 -#define R4600_V1_HIT_CACHEOP_WAR 0 -#define R4600_V2_HIT_CACHEOP_WAR 0 -#define R5432_CP0_INTERRUPT_WAR 0 -#define BCM1250_M3_WAR 0 -#define SIBYTE_1956_WAR 0 -#define MIPS4K_ICACHE_REFILL_WAR 0 -#define MIPS_CACHE_SYNC_WAR 0 -#define TX49XX_ICACHE_INDEX_INV_WAR 0 -#define RM9000_CDEX_SMP_WAR 0 -#define ICACHE_REFILLS_WORKAROUND_WAR 0 -#define R10000_LLSC_WAR 0 -#define MIPS34K_MISSED_ITLB_WAR 0 - -#endif /* __ASM_MIPS_MACH_ADM5120_WAR_H */ diff --git a/target/linux/adm5120/files-3.18/arch/mips/pci/pci-adm5120.c b/target/linux/adm5120/files-3.18/arch/mips/pci/pci-adm5120.c deleted file mode 100644 index f8d359806..000000000 --- a/target/linux/adm5120/files-3.18/arch/mips/pci/pci-adm5120.c +++ /dev/null @@ -1,277 +0,0 @@ -/* - * ADM5120 PCI Host Controller driver - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel - * done by Jeroen Vreeken - * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org) - * - * Jeroen's code was based on the Linux 2.4.xx source codes found in various - * tarballs released by Edimax for it's ADM5120 based devices - * Copyright (C) ADMtek Incorporated - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -#undef DEBUG - -#ifdef DEBUG -#define DBG(f, a...) printk(KERN_DEBUG f, ## a) -#else -#define DBG(f, a...) do {} while (0) -#endif - -#define PCI_ENABLE 0x80000000 - -/* -------------------------------------------------------------------------*/ - -static unsigned int adm5120_pci_nr_irqs __initdata; -static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata; - -static DEFINE_SPINLOCK(pci_lock); - -/* -------------------------------------------------------------------------*/ - -static inline void write_cfgaddr(u32 addr) -{ - __raw_writel((addr | PCI_ENABLE), - (void __iomem *)(KSEG1ADDR(ADM5120_PCICFG_ADDR))); -} - -static inline void write_cfgdata(u32 data) -{ - __raw_writel(data, (void __iomem *)KSEG1ADDR(ADM5120_PCICFG_DATA)); -} - -static inline u32 read_cfgdata(void) -{ - return __raw_readl((void __iomem *)KSEG1ADDR(ADM5120_PCICFG_DATA)); -} - -static inline u32 mkaddr(struct pci_bus *bus, unsigned int devfn, int where) -{ - return ((bus->number & 0xFF) << 16) | ((devfn & 0xFF) << 8) | \ - (where & 0xFC); -} - -/* -------------------------------------------------------------------------*/ - -static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, - int size, u32 *val) -{ - unsigned long flags; - u32 data; - - spin_lock_irqsave(&pci_lock, flags); - - write_cfgaddr(mkaddr(bus, devfn, where)); - data = read_cfgdata(); - - DBG("PCI: cfg_read %02u.%02u.%01u/%02X:%01d, cfg:0x%08X", - bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), - where, size, data); - - switch (size) { - case 1: - if (where & 1) - data >>= 8; - if (where & 2) - data >>= 16; - data &= 0xFF; - break; - case 2: - if (where & 2) - data >>= 16; - data &= 0xFFFF; - break; - } - - *val = data; - DBG(", 0x%08X returned\n", data); - - spin_unlock_irqrestore(&pci_lock, flags); - - return PCIBIOS_SUCCESSFUL; -} - -static int pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, - int size, u32 val) -{ - unsigned long flags; - u32 data; - int s; - - spin_lock_irqsave(&pci_lock, flags); - - write_cfgaddr(mkaddr(bus, devfn, where)); - data = read_cfgdata(); - - DBG("PCI: cfg_write %02u.%02u.%01u/%02X:%01d, cfg:0x%08X", - bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), - where, size, data); - - switch (size) { - case 1: - s = ((where & 3) << 3); - data &= ~(0xFF << s); - data |= ((val & 0xFF) << s); - break; - case 2: - s = ((where & 2) << 4); - data &= ~(0xFFFF << s); - data |= ((val & 0xFFFF) << s); - break; - case 4: - data = val; - break; - } - - write_cfgdata(data); - DBG(", 0x%08X written\n", data); - - spin_unlock_irqrestore(&pci_lock, flags); - - return PCIBIOS_SUCCESSFUL; -} - -struct pci_ops adm5120_pci_ops = { - .read = pci_config_read, - .write = pci_config_write, -}; - -/* -------------------------------------------------------------------------*/ - -static void adm5120_pci_fixup(struct pci_dev *dev) -{ - if (dev->devfn != 0) - return; - - /* setup COMMAND register */ - pci_write_config_word(dev, PCI_COMMAND, - (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER)); - - /* setup CACHE_LINE_SIZE register */ - pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 4); - - /* setup BARS */ - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0); - pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0); -} - -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_ADM5120, - adm5120_pci_fixup); - -/* -------------------------------------------------------------------------*/ - -void __init adm5120_pci_set_irq_map(unsigned int nr_irqs, - struct adm5120_pci_irq *map) -{ - adm5120_pci_nr_irqs = nr_irqs; - adm5120_pci_irq_map = map; -} - -int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -{ - int irq = -1; - int i; - - if ((!adm5120_pci_nr_irqs) || (!adm5120_pci_irq_map)) { - printk(KERN_ALERT "PCI: pci_irq_map is not initialized\n"); - goto out; - } - - if (slot < 1 || slot > 4) { - printk(KERN_ALERT "PCI: slot number %u is not supported\n", - slot); - goto out; - } - - for (i = 0; i < adm5120_pci_nr_irqs; i++) { - if ((adm5120_pci_irq_map[i].slot == slot) - && (adm5120_pci_irq_map[i].func == PCI_FUNC(dev->devfn)) - && (adm5120_pci_irq_map[i].pin == pin)) { - irq = adm5120_pci_irq_map[i].irq; - break; - } - } - - if (irq < 0) { - printk(KERN_ALERT "PCI: no irq found for %s pin:%u\n", - pci_name((struct pci_dev *)dev), pin); - } else { - printk(KERN_INFO "PCI: mapping irq for %s pin:%u, irq:%d\n", - pci_name((struct pci_dev *)dev), pin, irq); - } - -out: - return irq; -} - -int pcibios_plat_dev_init(struct pci_dev *dev) -{ - return 0; -} - -/* -------------------------------------------------------------------------*/ - -static struct resource pci_io_resource = { - .name = "ADM5120 PCI I/O", - .start = ADM5120_PCIIO_BASE, - .end = ADM5120_PCICFG_ADDR-1, - .flags = IORESOURCE_IO -}; - -static struct resource pci_mem_resource = { - .name = "ADM5120 PCI MEM", - .start = ADM5120_PCIMEM_BASE, - .end = ADM5120_PCIIO_BASE-1, - .flags = IORESOURCE_MEM -}; - -static struct pci_controller adm5120_controller = { - .pci_ops = &adm5120_pci_ops, - .io_resource = &pci_io_resource, - .mem_resource = &pci_mem_resource, -}; - -static int __init adm5120_pci_setup(void) -{ - if (adm5120_package_pqfp()) { - printk(KERN_INFO "PCI: not available on ADM5120P\n"); - return -1; - } - - /* Avoid ISA compat ranges. */ - PCIBIOS_MIN_IO = 0x00000000; - PCIBIOS_MIN_MEM = 0x00000000; - - /* Set I/O resource limits. */ - ioport_resource.end = 0x1fffffff; - iomem_resource.end = 0xffffffff; - - register_pci_controller(&adm5120_controller); - return 0; -} - -arch_initcall(adm5120_pci_setup); diff --git a/target/linux/adm5120/files-3.18/drivers/ata/pata_rb153_cf.c b/target/linux/adm5120/files-3.18/drivers/ata/pata_rb153_cf.c deleted file mode 100644 index 92a4d1390..000000000 --- a/target/linux/adm5120/files-3.18/drivers/ata/pata_rb153_cf.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * A low-level PATA driver to handle a Compact Flash connected on the - * Mikrotik's RouterBoard 153 board. - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was based on: drivers/ata/pata_ixp4xx_cf.c - * Copyright (C) 2006-07 Tower Technologies - * Author: Alessandro Zummo - * - * Also was based on the driver for Linux 2.4.xx published by Mikrotik for - * their RouterBoard 1xx and 5xx series devices. The original Mikrotik code - * seems not to have a license. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define DRV_NAME "pata-rb153-cf" -#define DRV_VERSION "0.5.0" -#define DRV_DESC "PATA driver for RouterBOARD 153 Compact Flash" - -#define RB153_CF_MAXPORTS 1 -#define RB153_CF_IO_DELAY 100 - -#define RB153_CF_REG_CMD 0x0800 -#define RB153_CF_REG_CTRL 0x080E -#define RB153_CF_REG_DATA 0x0C00 - -struct rb153_cf_info { - void __iomem *iobase; - unsigned int gpio_line; - int frozen; - unsigned int irq; -}; - -static inline void rb153_pata_finish_io(struct ata_port *ap) -{ - struct rb153_cf_info *info = ap->host->private_data; - - /* FIXME: Keep previous delay. If this is merely a fence then - * ata_sff_sync might be sufficient. */ - ata_sff_dma_pause(ap); - ndelay(RB153_CF_IO_DELAY); - - irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); -} - -static void rb153_pata_exec_command(struct ata_port *ap, - const struct ata_taskfile *tf) -{ - writeb(tf->command, ap->ioaddr.command_addr); - rb153_pata_finish_io(ap); -} - -static unsigned int rb153_pata_data_xfer(struct ata_device *adev, - unsigned char *buf, - unsigned int buflen, - int write_data) -{ - void __iomem *ioaddr = adev->link->ap->ioaddr.data_addr; - unsigned int t; - - t = buflen; - if (write_data) { - for (; t > 0; t--, buf++) - writeb(*buf, ioaddr); - } else { - for (; t > 0; t--, buf++) - *buf = readb(ioaddr); - } - - rb153_pata_finish_io(adev->link->ap); - return buflen; -} - -static void rb153_pata_freeze(struct ata_port *ap) -{ - struct rb153_cf_info *info = ap->host->private_data; - - info->frozen = 1; -} - -static void rb153_pata_thaw(struct ata_port *ap) -{ - struct rb153_cf_info *info = ap->host->private_data; - - info->frozen = 0; -} - -static irqreturn_t rb153_pata_irq_handler(int irq, void *dev_instance) -{ - struct ata_host *ah = dev_instance; - struct rb153_cf_info *info = ah->private_data; - - if (gpio_get_value(info->gpio_line)) { - irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); - if (!info->frozen) - ata_sff_interrupt(irq, dev_instance); - } else { - irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); - } - - return IRQ_HANDLED; -} - -static struct ata_port_operations rb153_pata_port_ops = { - .inherits = &ata_sff_port_ops, - .sff_exec_command = rb153_pata_exec_command, - .sff_data_xfer = rb153_pata_data_xfer, - .freeze = rb153_pata_freeze, - .thaw = rb153_pata_thaw, -}; - -static struct scsi_host_template rb153_pata_sht = { - ATA_PIO_SHT(DRV_NAME), -}; - -static void rb153_pata_setup_port(struct ata_host *ah) -{ - struct rb153_cf_info *info = ah->private_data; - struct ata_port *ap; - - ap = ah->ports[0]; - - ap->ops = &rb153_pata_port_ops; - ap->pio_mask = 0x1f; /* PIO4 */ - - ap->ioaddr.cmd_addr = info->iobase + RB153_CF_REG_CMD; - ap->ioaddr.ctl_addr = info->iobase + RB153_CF_REG_CTRL; - ap->ioaddr.altstatus_addr = info->iobase + RB153_CF_REG_CTRL; - - ata_sff_std_ports(&ap->ioaddr); - - ap->ioaddr.data_addr = info->iobase + RB153_CF_REG_DATA; -} - -static int rb153_pata_driver_probe(struct platform_device *pdev) -{ - unsigned int irq; - int gpio; - struct resource *res; - struct ata_host *ah; - struct rb153_cf_info *info; - int ret; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "no IOMEM resource found\n"); - return -EINVAL; - } - - irq = platform_get_irq(pdev, 0); - if (irq <= 0) { - dev_err(&pdev->dev, "no IRQ resource found\n"); - return -ENOENT; - } - - gpio = irq_to_gpio(irq); - if (gpio < 0) { - dev_err(&pdev->dev, "no GPIO found for irq%d\n", irq); - return -ENOENT; - } - - ret = gpio_request(gpio, DRV_NAME); - if (ret) { - dev_err(&pdev->dev, "GPIO request failed\n"); - return ret; - } - - ah = ata_host_alloc(&pdev->dev, RB153_CF_MAXPORTS); - if (!ah) - return -ENOMEM; - - platform_set_drvdata(pdev, ah); - - info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - ah->private_data = info; - info->gpio_line = gpio; - info->irq = irq; - - info->iobase = devm_ioremap_nocache(&pdev->dev, res->start, - res->end - res->start + 1); - if (!info->iobase) - return -ENOMEM; - - ret = gpio_direction_input(gpio); - if (ret) { - dev_err(&pdev->dev, "unable to set GPIO direction, err=%d\n", - ret); - goto err_free_gpio; - } - - rb153_pata_setup_port(ah); - - ret = ata_host_activate(ah, irq, rb153_pata_irq_handler, - IRQF_TRIGGER_LOW, &rb153_pata_sht); - if (ret) - goto err_free_gpio; - - return 0; - -err_free_gpio: - gpio_free(gpio); - - return ret; -} - -static int rb153_pata_driver_remove(struct platform_device *pdev) -{ - struct ata_host *ah = platform_get_drvdata(pdev); - struct rb153_cf_info *info = ah->private_data; - - ata_host_detach(ah); - gpio_free(info->gpio_line); - - return 0; -} - -static struct platform_driver rb153_pata_platform_driver = { - .probe = rb153_pata_driver_probe, - .remove = rb153_pata_driver_remove, - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, -}; - -/* ------------------------------------------------------------------------ */ - -#define DRV_INFO DRV_DESC " version " DRV_VERSION - -static int __init rb153_pata_module_init(void) -{ - printk(KERN_INFO DRV_INFO "\n"); - - return platform_driver_register(&rb153_pata_platform_driver); -} - -static void __exit rb153_pata_module_exit(void) -{ - platform_driver_unregister(&rb153_pata_platform_driver); -} - -MODULE_AUTHOR("Gabor Juhos "); -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); -MODULE_LICENSE("GPL v2"); - -module_init(rb153_pata_module_init); -module_exit(rb153_pata_module_exit); diff --git a/target/linux/adm5120/files-3.18/drivers/leds/ledtrig-adm5120-switch.c b/target/linux/adm5120/files-3.18/drivers/leds/ledtrig-adm5120-switch.c deleted file mode 100644 index 23a54a0b9..000000000 --- a/target/linux/adm5120/files-3.18/drivers/leds/ledtrig-adm5120-switch.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * LED ADM5120 Switch Port State Trigger - * - * Copyright (C) 2007 Bernhard Held - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was based on: drivers/leds/ledtrig-timer.c - * Copyright 2005-2006 Openedhand Ltd. - * Author: Richard Purdie - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#include -#include -#include -#include - -#include - -#include "leds.h" - -#define DRV_NAME "port_state" -#define DRV_DESC "LED ADM5120 Switch Port State Trigger" - -struct port_state { - char *name; - unsigned int value; -}; - -#define PORT_STATE(n, v) {.name = (n), .value = (v)} - -static struct port_state port_states[] = { - PORT_STATE("off", LED_OFF), - PORT_STATE("on", LED_FULL), - PORT_STATE("flash", ADM5120_GPIO_FLASH), - PORT_STATE("link", ADM5120_GPIO_LINK), - PORT_STATE("speed", ADM5120_GPIO_SPEED), - PORT_STATE("duplex", ADM5120_GPIO_DUPLEX), - PORT_STATE("act", ADM5120_GPIO_ACT), - PORT_STATE("coll", ADM5120_GPIO_COLL), - PORT_STATE("link_act", ADM5120_GPIO_LINK_ACT), - PORT_STATE("duplex_coll", ADM5120_GPIO_DUPLEX_COLL), - PORT_STATE("10M_act", ADM5120_GPIO_10M_ACT), - PORT_STATE("100M_act", ADM5120_GPIO_100M_ACT), -}; - -static ssize_t led_port_state_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - struct port_state *state = led_cdev->trigger_data; - int len = 0; - int i; - - *buf = '\0'; - for (i = 0; i < ARRAY_SIZE(port_states); i++) { - if (&port_states[i] == state) - len += sprintf(buf+len, "[%s] ", port_states[i].name); - else - len += sprintf(buf+len, "%s ", port_states[i].name); - } - len += sprintf(buf+len, "\n"); - - return len; -} - -static ssize_t led_port_state_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t size) -{ - struct led_classdev *led_cdev = dev_get_drvdata(dev); - size_t len; - int i; - - for (i = 0; i < ARRAY_SIZE(port_states); i++) { - len = strlen(port_states[i].name); - if (strncmp(port_states[i].name, buf, len) != 0) - continue; - - if (buf[len] != '\0' && buf[len] != '\n') - continue; - - led_cdev->trigger_data = &port_states[i]; - led_set_brightness(led_cdev, port_states[i].value); - return size; - } - - return -EINVAL; -} - -static DEVICE_ATTR(port_state, 0644, led_port_state_show, - led_port_state_store); - -static void adm5120_switch_trig_activate(struct led_classdev *led_cdev) -{ - struct port_state *state = port_states; - int rc; - - led_cdev->trigger_data = state; - - rc = device_create_file(led_cdev->dev, &dev_attr_port_state); - if (rc) - goto err; - - led_set_brightness(led_cdev, state->value); - - return; -err: - led_cdev->trigger_data = NULL; -} - -static void adm5120_switch_trig_deactivate(struct led_classdev *led_cdev) -{ - struct port_state *state = led_cdev->trigger_data; - - if (!state) - return; - - device_remove_file(led_cdev->dev, &dev_attr_port_state); - -} - -static struct led_trigger adm5120_switch_led_trigger = { - .name = DRV_NAME, - .activate = adm5120_switch_trig_activate, - .deactivate = adm5120_switch_trig_deactivate, -}; - -static int __init adm5120_switch_trig_init(void) -{ - led_trigger_register(&adm5120_switch_led_trigger); - return 0; -} - -static void __exit adm5120_switch_trig_exit(void) -{ - led_trigger_unregister(&adm5120_switch_led_trigger); -} - -module_init(adm5120_switch_trig_init); -module_exit(adm5120_switch_trig_exit); - -MODULE_AUTHOR("Bernhard Held , " - "Gabor Juhos "); -MODULE_DESCRIPTION(DRV_DESC); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/adm5120/files-3.18/drivers/mtd/maps/adm5120-flash.c b/target/linux/adm5120/files-3.18/drivers/mtd/maps/adm5120-flash.c deleted file mode 100644 index f6a86f489..000000000 --- a/target/linux/adm5120/files-3.18/drivers/mtd/maps/adm5120-flash.c +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Platform driver for NOR flash devices on ADM5120 based boards - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: drivers/mtd/map/physmap.c - * Copyright (C) 2003 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#define DRV_NAME "adm5120-flash" -#define DRV_DESC "ADM5120 flash MAP driver" -#define MAX_PARSED_PARTS 8 - -#ifdef ADM5120_FLASH_DEBUG -#define MAP_DBG(m, f, a...) printk(KERN_INFO "%s: " f, (m->name) , ## a) -#else -#define MAP_DBG(m, f, a...) do {} while (0) -#endif -#define MAP_ERR(m, f, a...) printk(KERN_ERR "%s: " f, (m->name) , ## a) -#define MAP_INFO(m, f, a...) printk(KERN_INFO "%s: " f, (m->name) , ## a) - -struct adm5120_map_info { - struct map_info map; - void (*switch_bank)(unsigned); - unsigned long window_size; -}; - -struct adm5120_flash_info { - struct mtd_info *mtd; - struct resource *res; - struct platform_device *dev; - struct adm5120_map_info amap; -}; - -struct flash_desc { - u32 phys; - u32 srs_shift; -}; - -/* - * Globals - */ -static DEFINE_SPINLOCK(adm5120_flash_spin); -#define FLASH_LOCK() spin_lock(&adm5120_flash_spin) -#define FLASH_UNLOCK() spin_unlock(&adm5120_flash_spin) - -static u32 flash_bankwidths[4] = { 1, 2, 4, 0 }; - -static u32 flash_sizes[8] = { - 0, 512*1024, 1024*1024, 2*1024*1024, - 4*1024*1024, 0, 0, 0 -}; - -static struct flash_desc flash_descs[2] = { - { - .phys = ADM5120_SRAM0_BASE, - .srs_shift = MEMCTRL_SRS0_SHIFT, - }, { - .phys = ADM5120_SRAM1_BASE, - .srs_shift = MEMCTRL_SRS1_SHIFT, - } -}; - -static const char const *probe_types[] = { - "cfi_probe", - "jedec_probe", - "map_rom", - NULL -}; - -static const char const *parse_types[] = { - "cmdlinepart", -#ifdef CONFIG_MTD_REDBOOT_PARTS - "RedBoot", -#endif -#ifdef CONFIG_MTD_MYLOADER_PARTS - "MyLoader", -#endif - NULL, -}; - -#define BANK_SIZE (2<<20) -#define BANK_SIZE_MAX (4<<20) -#define BANK_OFFS_MASK (BANK_SIZE-1) -#define BANK_START_MASK (~BANK_OFFS_MASK) - -static inline struct adm5120_map_info *map_to_amap(struct map_info *map) -{ - return (struct adm5120_map_info *)map; -} - -static void adm5120_flash_switchbank(struct map_info *map, - unsigned long ofs) -{ - struct adm5120_map_info *amap = map_to_amap(map); - unsigned bank; - - if (amap->switch_bank == NULL) - return; - - bank = (ofs & BANK_START_MASK) >> 21; - if (bank > 1) - BUG(); - - MAP_DBG(map, "switching to bank %u, ofs=%lX\n", bank, ofs); - amap->switch_bank(bank); -} - -static map_word adm5120_flash_read(struct map_info *map, unsigned long ofs) -{ - struct adm5120_map_info *amap = map_to_amap(map); - map_word ret; - - MAP_DBG(map, "reading from ofs %lX\n", ofs); - - if (ofs >= amap->window_size) - return map_word_ff(map); - - FLASH_LOCK(); - adm5120_flash_switchbank(map, ofs); - ret = inline_map_read(map, (ofs & (amap->window_size-1))); - FLASH_UNLOCK(); - - return ret; -} - -static void adm5120_flash_write(struct map_info *map, const map_word datum, - unsigned long ofs) -{ - struct adm5120_map_info *amap = map_to_amap(map); - - MAP_DBG(map, "writing to ofs %lX\n", ofs); - - if (ofs > amap->window_size) - return; - - FLASH_LOCK(); - adm5120_flash_switchbank(map, ofs); - inline_map_write(map, datum, (ofs & (amap->window_size-1))); - FLASH_UNLOCK(); -} - -static void adm5120_flash_copy_from(struct map_info *map, void *to, - unsigned long from, ssize_t len) -{ - struct adm5120_map_info *amap = map_to_amap(map); - char *p; - ssize_t t; - - MAP_DBG(map, "copy_from, to=%lX, from=%lX, len=%lX\n", - (unsigned long)to, from, (unsigned long)len); - - if (from > amap->window_size) - return; - - p = (char *)to; - while (len > 0) { - t = len; - if ((from < BANK_SIZE) && ((from+len) > BANK_SIZE)) - t = BANK_SIZE-from; - - FLASH_LOCK(); - MAP_DBG(map, "copying %lu byte(s) from %lX to %lX\n", - (unsigned long)t, (from & (amap->window_size-1)), - (unsigned long)p); - adm5120_flash_switchbank(map, from); - inline_map_copy_from(map, p, (from & (amap->window_size-1)), t); - FLASH_UNLOCK(); - p += t; - from += t; - len -= t; - } -} - -static int adm5120_flash_initres(struct adm5120_flash_info *info) -{ - struct map_info *map = &info->amap.map; - int err = 0; - - info->res = request_mem_region(map->phys, info->amap.window_size, - map->name); - if (info->res == NULL) { - MAP_ERR(map, "could not reserve memory region\n"); - err = -ENOMEM; - goto out; - } - - map->virt = ioremap_nocache(map->phys, info->amap.window_size); - if (map->virt == NULL) { - MAP_ERR(map, "failed to ioremap flash region\n"); - err = -ENOMEM; - goto out; - } - -out: - return err; -} - -static int adm5120_flash_initinfo(struct adm5120_flash_info *info, - struct platform_device *dev) -{ - struct map_info *map = &info->amap.map; - struct adm5120_flash_platform_data *pdata = dev->dev.platform_data; - struct flash_desc *fdesc; - u32 t = 0; - - map->name = dev_name(&dev->dev); - - if (dev->id > 1) { - MAP_ERR(map, "invalid flash id\n"); - goto err_out; - } - - fdesc = &flash_descs[dev->id]; - - if (pdata) - info->amap.window_size = pdata->window_size; - - if (info->amap.window_size == 0) { - /* get memory window size */ - t = SW_READ_REG(SWITCH_REG_MEMCTRL) >> fdesc->srs_shift; - t &= MEMCTRL_SRS_MASK; - info->amap.window_size = flash_sizes[t]; - } - - if (info->amap.window_size == 0) { - MAP_ERR(map, "unable to determine window size\n"); - goto err_out; - } - - /* get flash bus width */ - switch (dev->id) { - case 0: - t = MPMC_READ_REG(SC1) & SC_MW_MASK; - break; - case 1: - t = MPMC_READ_REG(SC0) & SC_MW_MASK; - break; - } - map->bankwidth = flash_bankwidths[t]; - if (map->bankwidth == 0) { - MAP_ERR(map, "invalid bus width detected\n"); - goto err_out; - } - - map->phys = fdesc->phys; - map->size = BANK_SIZE_MAX; - - simple_map_init(map); - map->read = adm5120_flash_read; - map->write = adm5120_flash_write; - map->copy_from = adm5120_flash_copy_from; - - if (pdata) { - map->set_vpp = pdata->set_vpp; - info->amap.switch_bank = pdata->switch_bank; - } - - info->dev = dev; - - MAP_INFO(map, "probing at 0x%lX, size:%ldKiB, width:%d bits\n", - (unsigned long)map->phys, - (unsigned long)info->amap.window_size >> 10, - map->bankwidth*8); - - return 0; - -err_out: - return -ENODEV; -} - -static void adm5120_flash_initbanks(struct adm5120_flash_info *info) -{ - struct map_info *map = &info->amap.map; - - if (info->mtd->size <= BANK_SIZE) - /* no bank switching needed */ - return; - - if (info->amap.switch_bank) { - info->amap.window_size = info->mtd->size; - return; - } - - MAP_ERR(map, "reduce visibility from %ldKiB to %ldKiB\n", - (unsigned long)map->size >> 10, - (unsigned long)info->mtd->size >> 10); - - info->mtd->size = info->amap.window_size; -} - -static int adm5120_flash_remove(struct platform_device *dev) -{ - struct adm5120_flash_info *info; - - info = platform_get_drvdata(dev); - if (info == NULL) - return 0; - - platform_set_drvdata(dev, NULL); - - if (info->mtd != NULL) { - mtd_device_unregister(info->mtd); - map_destroy(info->mtd); - } - - if (info->amap.map.virt != NULL) - iounmap(info->amap.map.virt); - - if (info->res != NULL) { - release_resource(info->res); - kfree(info->res); - } - - return 0; -} - -static int adm5120_flash_probe(struct platform_device *dev) -{ - struct adm5120_flash_platform_data *pdata; - struct adm5120_flash_info *info; - struct map_info *map; - const char **probe_type; - int err; - - pdata = dev->dev.platform_data; - if (!pdata) { - dev_err(&dev->dev, "no platform data\n"); - return -EINVAL; - } - - info = kzalloc(sizeof(*info), GFP_KERNEL); - if (info == NULL) { - err = -ENOMEM; - goto err_out; - } - - platform_set_drvdata(dev, info); - - err = adm5120_flash_initinfo(info, dev); - if (err) - goto err_out; - - err = adm5120_flash_initres(info); - if (err) - goto err_out; - - map = &info->amap.map; - for (probe_type = probe_types; info->mtd == NULL && *probe_type != NULL; - probe_type++) - info->mtd = do_map_probe(*probe_type, map); - - if (info->mtd == NULL) { - MAP_ERR(map, "map_probe failed\n"); - err = -ENXIO; - goto err_out; - } - - adm5120_flash_initbanks(info); - - if (info->mtd->size < info->amap.window_size) { - /* readjust resources */ - iounmap(map->virt); - release_resource(info->res); - kfree(info->res); - - info->amap.window_size = info->mtd->size; - map->size = info->mtd->size; - MAP_INFO(map, "reducing map size to %ldKiB\n", - (unsigned long)map->size >> 10); - err = adm5120_flash_initres(info); - if (err) - goto err_out; - } - - MAP_INFO(map, "found at 0x%lX, size:%ldKiB, width:%d bits\n", - (unsigned long)map->phys, (unsigned long)info->mtd->size >> 10, - map->bankwidth*8); - - info->mtd->owner = THIS_MODULE; - - err = mtd_device_parse_register(info->mtd, parse_types, 0, - pdata->parts, pdata->nr_parts); - if (err) - goto err_out; - - return 0; - -err_out: - adm5120_flash_remove(dev); - return err; -} - -#ifdef CONFIG_PM -static int adm5120_flash_suspend(struct platform_device *dev, - pm_message_t state) -{ - struct adm5120_flash_info *info = platform_get_drvdata(dev); - int ret = 0; - - if (info) - ret = info->mtd->suspend(info->mtd); - - return ret; -} - -static int adm5120_flash_resume(struct platform_device *dev) -{ - struct adm5120_flash_info *info = platform_get_drvdata(dev); - - if (info) - info->mtd->resume(info->mtd); - - return 0; -} - -static void adm5120_flash_shutdown(struct platform_device *dev) -{ - struct adm5120_flash_info *info = platform_get_drvdata(dev); - - if (info && info->mtd->suspend(info->mtd) == 0) - info->mtd->resume(info->mtd); -} -#endif - -static struct platform_driver adm5120_flash_driver = { - .probe = adm5120_flash_probe, - .remove = adm5120_flash_remove, -#ifdef CONFIG_PM - .suspend = adm5120_flash_suspend, - .resume = adm5120_flash_resume, - .shutdown = adm5120_flash_shutdown, -#endif - .driver = { - .name = DRV_NAME, - }, -}; - -static int __init adm5120_flash_init(void) -{ - int err; - - err = platform_driver_register(&adm5120_flash_driver); - - return err; -} - -static void __exit adm5120_flash_exit(void) -{ - platform_driver_unregister(&adm5120_flash_driver); -} - -module_init(adm5120_flash_init); -module_exit(adm5120_flash_exit); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_DESCRIPTION(DRV_DESC); diff --git a/target/linux/adm5120/files-3.18/drivers/mtd/trxsplit.c b/target/linux/adm5120/files-3.18/drivers/mtd/trxsplit.c deleted file mode 100644 index 76cbdc749..000000000 --- a/target/linux/adm5120/files-3.18/drivers/mtd/trxsplit.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (C) Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#define PFX "trxsplit: " - -#define TRX_MAGIC 0x30524448 /* "HDR0" */ -#define TRX_VERSION 1 -#define TRX_MAX_LEN 0x3A0000 -#define TRX_NO_HEADER 0x1 /* do not write TRX header */ -#define TRX_GZ_FILES 0x2 /* contains individual gzip files */ -#define TRX_MAX_OFFSET 3 -#define TRX_MIN_KERNEL_SIZE (256 * 1024) - -struct trx_header { - u32 magic; /* "HDR0" */ - u32 len; /* Length of file including header */ - u32 crc32; /* 32-bit CRC from flag_version to end of file */ - u32 flag_version; /* 0:15 flags, 16:31 version */ - u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions */ -}; - -#define TRX_ALIGN 0x1000 - -static int trx_nr_parts; -static unsigned long trx_offset; -static struct mtd_info *trx_mtd; -static struct mtd_partition trx_parts[TRX_MAX_OFFSET]; -static struct trx_header trx_hdr; - -static int trxsplit_refresh_partitions(struct mtd_info *mtd); - -static int trxsplit_checktrx(struct mtd_info *mtd, unsigned long offset) -{ - size_t retlen; - int err; - - err = mtd_read(mtd, offset, sizeof(trx_hdr), &retlen, (void *)&trx_hdr); - if (err) { - printk(KERN_ALERT PFX "unable to read from '%s'\n", mtd->name); - goto err_out; - } - - if (retlen != sizeof(trx_hdr)) { - printk(KERN_ALERT PFX "reading failed on '%s'\n", mtd->name); - goto err_out; - } - - trx_hdr.magic = le32_to_cpu(trx_hdr.magic); - trx_hdr.len = le32_to_cpu(trx_hdr.len); - trx_hdr.crc32 = le32_to_cpu(trx_hdr.crc32); - trx_hdr.flag_version = le32_to_cpu(trx_hdr.flag_version); - trx_hdr.offsets[0] = le32_to_cpu(trx_hdr.offsets[0]); - trx_hdr.offsets[1] = le32_to_cpu(trx_hdr.offsets[1]); - trx_hdr.offsets[2] = le32_to_cpu(trx_hdr.offsets[2]); - - /* sanity checks */ - if (trx_hdr.magic != TRX_MAGIC) - goto err_out; - - if (trx_hdr.len > mtd->size - offset) - goto err_out; - - /* TODO: add crc32 checking too? */ - - return 0; - -err_out: - return -1; -} - -static void trxsplit_findtrx(struct mtd_info *mtd) -{ - unsigned long offset; - int err; - - printk(KERN_INFO PFX "searching TRX header in '%s'\n", mtd->name); - - err = 0; - for (offset = 0; offset < mtd->size; offset += TRX_ALIGN) { - err = trxsplit_checktrx(mtd, offset); - if (err == 0) - break; - } - - if (err) - return; - - printk(KERN_INFO PFX "TRX header found at 0x%lX\n", offset); - - trx_mtd = mtd; - trx_offset = offset; -} - -static void trxsplit_create_partitions(struct mtd_info *mtd) -{ - struct mtd_partition *part = trx_parts; - int err; - int i; - - for (i = 0; i < TRX_MAX_OFFSET; i++) { - part = &trx_parts[i]; - if (trx_hdr.offsets[i] == 0) - continue; - part->offset = trx_offset + trx_hdr.offsets[i]; - trx_nr_parts++; - } - - for (i = 0; i < trx_nr_parts-1; i++) - trx_parts[i].size = trx_parts[i+1].offset - trx_parts[i].offset; - - trx_parts[i].size = mtd->size - trx_parts[i].offset; - - i = 0; - part = &trx_parts[i]; - if (part->size < TRX_MIN_KERNEL_SIZE) { - part->name = "loader"; - i++; - } - - part = &trx_parts[i]; - part->name = "kernel"; - i++; - - part = &trx_parts[i]; - part->name = "rootfs"; - - err = mtd_device_register(mtd, trx_parts, trx_nr_parts); - if (err) { - printk(KERN_ALERT PFX "adding TRX partitions failed\n"); - return; - } - - mtd->refresh_device = trxsplit_refresh_partitions; -} - -static int trxsplit_refresh_partitions(struct mtd_info *mtd) -{ - printk(KERN_INFO PFX "refreshing TRX partitions in '%s' (%d,%d)\n", - mtd->name, MTD_BLOCK_MAJOR, mtd->index); - - /* remove old partitions */ - mtd_device_unregister(mtd); - - trxsplit_findtrx(mtd); - if (!trx_mtd) - goto err; - - trxsplit_create_partitions(trx_mtd); - return 1; - -err: - return 0; -} - -static void __init trxsplit_add_mtd(struct mtd_info *mtd) -{ - if (mtd->type != MTD_NORFLASH) { - printk(KERN_INFO PFX "'%s' is not a NOR flash, skipped\n", - mtd->name); - return; - } - - if (!trx_mtd) - trxsplit_findtrx(mtd); -} - -static void __init trxsplit_remove_mtd(struct mtd_info *mtd) -{ - /* nothing to do */ -} - -static struct mtd_notifier trxsplit_notifier __initdata = { - .add = trxsplit_add_mtd, - .remove = trxsplit_remove_mtd, -}; - -static void __init trxsplit_scan(void) -{ - register_mtd_user(&trxsplit_notifier); - unregister_mtd_user(&trxsplit_notifier); -} - -static int __init trxsplit_init(void) -{ - trxsplit_scan(); - - if (trx_mtd) { - printk(KERN_INFO PFX "creating TRX partitions in '%s' " - "(%d,%d)\n", trx_mtd->name, MTD_BLOCK_MAJOR, - trx_mtd->index); - trxsplit_create_partitions(trx_mtd); - } - - return 0; -} - -late_initcall(trxsplit_init); diff --git a/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.c b/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.c deleted file mode 100644 index 7fbabb00e..000000000 --- a/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.c +++ /dev/null @@ -1,1219 +0,0 @@ -/* - * ADM5120 built-in ethernet switch driver - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This code was based on a driver for Linux 2.6.xx by Jeroen Vreeken. - * Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005 - * NAPI extension for the Jeroen's driver - * Copyright Thomas Langer (Thomas.Langer@infineon.com), 2007 - * Copyright Friedrich Beckmann (Friedrich.Beckmann@infineon.com), 2007 - * Inspiration for the Jeroen's driver came from the ADMtek 2.4 driver. - * Copyright ADMtek Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include "adm5120sw.h" -#include - -#define DRV_NAME "adm5120-switch" -#define DRV_DESC "ADM5120 built-in ethernet switch driver" -#define DRV_VERSION "0.1.1" - -#define CONFIG_ADM5120_SWITCH_NAPI 1 -#undef CONFIG_ADM5120_SWITCH_DEBUG - -/* ------------------------------------------------------------------------ */ - -#ifdef CONFIG_ADM5120_SWITCH_DEBUG -#define SW_DBG(f, a...) printk(KERN_DEBUG "%s: " f, DRV_NAME , ## a) -#else -#define SW_DBG(f, a...) do {} while (0) -#endif -#define SW_ERR(f, a...) printk(KERN_ERR "%s: " f, DRV_NAME , ## a) -#define SW_INFO(f, a...) printk(KERN_INFO "%s: " f, DRV_NAME , ## a) - -#define SWITCH_NUM_PORTS 6 -#define ETH_CSUM_LEN 4 - -#define RX_MAX_PKTLEN 1550 -#define RX_RING_SIZE 64 - -#define TX_RING_SIZE 32 -#define TX_QUEUE_LEN 28 /* Limit ring entries actually used. */ -#define TX_TIMEOUT (HZ * 400) - -#define RX_DESCS_SIZE (RX_RING_SIZE * sizeof(struct dma_desc *)) -#define RX_SKBS_SIZE (RX_RING_SIZE * sizeof(struct sk_buff *)) -#define TX_DESCS_SIZE (TX_RING_SIZE * sizeof(struct dma_desc *)) -#define TX_SKBS_SIZE (TX_RING_SIZE * sizeof(struct sk_buff *)) - -#define SKB_ALLOC_LEN (RX_MAX_PKTLEN + 32) -#define SKB_RESERVE_LEN (NET_IP_ALIGN + NET_SKB_PAD) - -#define SWITCH_INTS_HIGH (SWITCH_INT_SHD | SWITCH_INT_RHD | SWITCH_INT_HDF) -#define SWITCH_INTS_LOW (SWITCH_INT_SLD | SWITCH_INT_RLD | SWITCH_INT_LDF) -#define SWITCH_INTS_ERR (SWITCH_INT_RDE | SWITCH_INT_SDE | SWITCH_INT_CPUH) -#define SWITCH_INTS_Q (SWITCH_INT_P0QF | SWITCH_INT_P1QF | SWITCH_INT_P2QF | \ - SWITCH_INT_P3QF | SWITCH_INT_P4QF | SWITCH_INT_P5QF | \ - SWITCH_INT_CPQF | SWITCH_INT_GQF) - -#define SWITCH_INTS_ALL (SWITCH_INTS_HIGH | SWITCH_INTS_LOW | \ - SWITCH_INTS_ERR | SWITCH_INTS_Q | \ - SWITCH_INT_MD | SWITCH_INT_PSC) - -#define SWITCH_INTS_USED (SWITCH_INTS_LOW | SWITCH_INT_PSC) -#define SWITCH_INTS_POLL (SWITCH_INT_RLD | SWITCH_INT_LDF | SWITCH_INT_SLD) - -/* ------------------------------------------------------------------------ */ - -struct adm5120_if_priv { - struct net_device *dev; - - unsigned int vlan_no; - unsigned int port_mask; - -#ifdef CONFIG_ADM5120_SWITCH_NAPI - struct napi_struct napi; -#endif -}; - -struct dma_desc { - __u32 buf1; -#define DESC_OWN (1UL << 31) /* Owned by the switch */ -#define DESC_EOR (1UL << 28) /* End of Ring */ -#define DESC_ADDR_MASK 0x1FFFFFF -#define DESC_ADDR(x) ((__u32)(x) & DESC_ADDR_MASK) - __u32 buf2; -#define DESC_BUF2_EN (1UL << 31) /* Buffer 2 enable */ - __u32 buflen; - __u32 misc; -/* definitions for tx/rx descriptors */ -#define DESC_PKTLEN_SHIFT 16 -#define DESC_PKTLEN_MASK 0x7FF -/* tx descriptor specific part */ -#define DESC_CSUM (1UL << 31) /* Append checksum */ -#define DESC_DSTPORT_SHIFT 8 -#define DESC_DSTPORT_MASK 0x3F -#define DESC_VLAN_MASK 0x3F -/* rx descriptor specific part */ -#define DESC_SRCPORT_SHIFT 12 -#define DESC_SRCPORT_MASK 0x7 -#define DESC_DA_MASK 0x3 -#define DESC_DA_SHIFT 4 -#define DESC_IPCSUM_FAIL (1UL << 3) /* IP checksum fail */ -#define DESC_VLAN_TAG (1UL << 2) /* VLAN tag present */ -#define DESC_TYPE_MASK 0x3 /* mask for Packet type */ -#define DESC_TYPE_IP 0x0 /* IP packet */ -#define DESC_TYPE_PPPoE 0x1 /* PPPoE packet */ -} __attribute__ ((aligned(16))); - -/* ------------------------------------------------------------------------ */ - -static int adm5120_nrdevs; - -static struct net_device *adm5120_devs[SWITCH_NUM_PORTS]; -/* Lookup table port -> device */ -static struct net_device *adm5120_port[SWITCH_NUM_PORTS]; - -static struct dma_desc *txl_descs; -static struct dma_desc *rxl_descs; - -static dma_addr_t txl_descs_dma; -static dma_addr_t rxl_descs_dma; - -static struct sk_buff **txl_skbuff; -static struct sk_buff **rxl_skbuff; - -static unsigned int cur_rxl, dirty_rxl; /* producer/consumer ring indices */ -static unsigned int cur_txl, dirty_txl; - -static unsigned int sw_used; - -static DEFINE_SPINLOCK(tx_lock); - -/* ------------------------------------------------------------------------ */ - -static inline u32 sw_read_reg(u32 reg) -{ - return __raw_readl((void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE)+reg); -} - -static inline void sw_write_reg(u32 reg, u32 val) -{ - __raw_writel(val, (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE)+reg); -} - -static inline void sw_int_mask(u32 mask) -{ - u32 t; - - t = sw_read_reg(SWITCH_REG_INT_MASK); - t |= mask; - sw_write_reg(SWITCH_REG_INT_MASK, t); -} - -static inline void sw_int_unmask(u32 mask) -{ - u32 t; - - t = sw_read_reg(SWITCH_REG_INT_MASK); - t &= ~mask; - sw_write_reg(SWITCH_REG_INT_MASK, t); -} - -static inline void sw_int_ack(u32 mask) -{ - sw_write_reg(SWITCH_REG_INT_STATUS, mask); -} - -static inline u32 sw_int_status(void) -{ - u32 t; - - t = sw_read_reg(SWITCH_REG_INT_STATUS); - t &= ~sw_read_reg(SWITCH_REG_INT_MASK); - return t; -} - -static inline u32 desc_get_srcport(struct dma_desc *desc) -{ - return (desc->misc >> DESC_SRCPORT_SHIFT) & DESC_SRCPORT_MASK; -} - -static inline u32 desc_get_pktlen(struct dma_desc *desc) -{ - return (desc->misc >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK; -} - -static inline int desc_ipcsum_fail(struct dma_desc *desc) -{ - return ((desc->misc & DESC_IPCSUM_FAIL) != 0); -} - -/* ------------------------------------------------------------------------ */ - -#ifdef CONFIG_ADM5120_SWITCH_DEBUG -static void sw_dump_desc(char *label, struct dma_desc *desc, int tx) -{ - u32 t; - - SW_DBG("%s %s desc/%p\n", label, tx ? "tx" : "rx", desc); - - t = desc->buf1; - SW_DBG(" buf1 %08X addr=%08X; len=%08X %s%s\n", t, - t & DESC_ADDR_MASK, - desc->buflen, - (t & DESC_OWN) ? "SWITCH" : "CPU", - (t & DESC_EOR) ? " RE" : ""); - - t = desc->buf2; - SW_DBG(" buf2 %08X addr=%08X%s\n", desc->buf2, - t & DESC_ADDR_MASK, - (t & DESC_BUF2_EN) ? " EN" : ""); - - t = desc->misc; - if (tx) - SW_DBG(" misc %08X%s pktlen=%04X ports=%02X vlan=%02X\n", t, - (t & DESC_CSUM) ? " CSUM" : "", - (t >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK, - (t >> DESC_DSTPORT_SHIFT) & DESC_DSTPORT_MASK, - t & DESC_VLAN_MASK); - else - SW_DBG(" misc %08X pktlen=%04X port=%d DA=%d%s%s type=%d\n", - t, - (t >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK, - (t >> DESC_SRCPORT_SHIFT) & DESC_SRCPORT_MASK, - (t >> DESC_DA_SHIFT) & DESC_DA_MASK, - (t & DESC_IPCSUM_FAIL) ? " IPCF" : "", - (t & DESC_VLAN_TAG) ? " VLAN" : "", - (t & DESC_TYPE_MASK)); -} - -static void sw_dump_intr_mask(char *label, u32 mask) -{ - SW_DBG("%s %08X%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", - label, mask, - (mask & SWITCH_INT_SHD) ? " SHD" : "", - (mask & SWITCH_INT_SLD) ? " SLD" : "", - (mask & SWITCH_INT_RHD) ? " RHD" : "", - (mask & SWITCH_INT_RLD) ? " RLD" : "", - (mask & SWITCH_INT_HDF) ? " HDF" : "", - (mask & SWITCH_INT_LDF) ? " LDF" : "", - (mask & SWITCH_INT_P0QF) ? " P0QF" : "", - (mask & SWITCH_INT_P1QF) ? " P1QF" : "", - (mask & SWITCH_INT_P2QF) ? " P2QF" : "", - (mask & SWITCH_INT_P3QF) ? " P3QF" : "", - (mask & SWITCH_INT_P4QF) ? " P4QF" : "", - (mask & SWITCH_INT_CPQF) ? " CPQF" : "", - (mask & SWITCH_INT_GQF) ? " GQF" : "", - (mask & SWITCH_INT_MD) ? " MD" : "", - (mask & SWITCH_INT_BCS) ? " BCS" : "", - (mask & SWITCH_INT_PSC) ? " PSC" : "", - (mask & SWITCH_INT_ID) ? " ID" : "", - (mask & SWITCH_INT_W0TE) ? " W0TE" : "", - (mask & SWITCH_INT_W1TE) ? " W1TE" : "", - (mask & SWITCH_INT_RDE) ? " RDE" : "", - (mask & SWITCH_INT_SDE) ? " SDE" : "", - (mask & SWITCH_INT_CPUH) ? " CPUH" : ""); -} - -static void sw_dump_regs(void) -{ - u32 t; - - t = sw_read_reg(SWITCH_REG_PHY_STATUS); - SW_DBG("phy_status: %08X\n", t); - - t = sw_read_reg(SWITCH_REG_CPUP_CONF); - SW_DBG("cpup_conf: %08X%s%s%s\n", t, - (t & CPUP_CONF_DCPUP) ? " DCPUP" : "", - (t & CPUP_CONF_CRCP) ? " CRCP" : "", - (t & CPUP_CONF_BTM) ? " BTM" : ""); - - t = sw_read_reg(SWITCH_REG_PORT_CONF0); - SW_DBG("port_conf0: %08X\n", t); - t = sw_read_reg(SWITCH_REG_PORT_CONF1); - SW_DBG("port_conf1: %08X\n", t); - t = sw_read_reg(SWITCH_REG_PORT_CONF2); - SW_DBG("port_conf2: %08X\n", t); - - t = sw_read_reg(SWITCH_REG_VLAN_G1); - SW_DBG("vlan g1: %08X\n", t); - t = sw_read_reg(SWITCH_REG_VLAN_G2); - SW_DBG("vlan g2: %08X\n", t); - - t = sw_read_reg(SWITCH_REG_BW_CNTL0); - SW_DBG("bw_cntl0: %08X\n", t); - t = sw_read_reg(SWITCH_REG_BW_CNTL1); - SW_DBG("bw_cntl1: %08X\n", t); - - t = sw_read_reg(SWITCH_REG_PHY_CNTL0); - SW_DBG("phy_cntl0: %08X\n", t); - t = sw_read_reg(SWITCH_REG_PHY_CNTL1); - SW_DBG("phy_cntl1: %08X\n", t); - t = sw_read_reg(SWITCH_REG_PHY_CNTL2); - SW_DBG("phy_cntl2: %08X\n", t); - t = sw_read_reg(SWITCH_REG_PHY_CNTL3); - SW_DBG("phy_cntl3: %08X\n", t); - t = sw_read_reg(SWITCH_REG_PHY_CNTL4); - SW_DBG("phy_cntl4: %08X\n", t); - - t = sw_read_reg(SWITCH_REG_INT_STATUS); - sw_dump_intr_mask("int_status: ", t); - - t = sw_read_reg(SWITCH_REG_INT_MASK); - sw_dump_intr_mask("int_mask: ", t); - - t = sw_read_reg(SWITCH_REG_SHDA); - SW_DBG("shda: %08X\n", t); - t = sw_read_reg(SWITCH_REG_SLDA); - SW_DBG("slda: %08X\n", t); - t = sw_read_reg(SWITCH_REG_RHDA); - SW_DBG("rhda: %08X\n", t); - t = sw_read_reg(SWITCH_REG_RLDA); - SW_DBG("rlda: %08X\n", t); -} -#else -static inline void sw_dump_desc(char *label, struct dma_desc *desc, int tx) {} -static void sw_dump_intr_mask(char *label, u32 mask) {} -static inline void sw_dump_regs(void) {} -#endif /* CONFIG_ADM5120_SWITCH_DEBUG */ - -/* ------------------------------------------------------------------------ */ - -static inline void adm5120_rx_dma_update(struct dma_desc *desc, - struct sk_buff *skb, int end) -{ - desc->misc = 0; - desc->buf2 = 0; - desc->buflen = RX_MAX_PKTLEN; - desc->buf1 = DESC_ADDR(skb->data) | - DESC_OWN | (end ? DESC_EOR : 0); -} - -static void adm5120_switch_rx_refill(void) -{ - unsigned int entry; - - for (; cur_rxl - dirty_rxl > 0; dirty_rxl++) { - struct dma_desc *desc; - struct sk_buff *skb; - - entry = dirty_rxl % RX_RING_SIZE; - desc = &rxl_descs[entry]; - - skb = rxl_skbuff[entry]; - if (skb == NULL) { - skb = alloc_skb(SKB_ALLOC_LEN, GFP_ATOMIC); - if (skb) { - skb_reserve(skb, SKB_RESERVE_LEN); - rxl_skbuff[entry] = skb; - } else { - SW_ERR("no memory for skb\n"); - desc->buflen = 0; - desc->buf2 = 0; - desc->misc = 0; - desc->buf1 = (desc->buf1 & DESC_EOR) | DESC_OWN; - break; - } - } - - desc->buf2 = 0; - desc->buflen = RX_MAX_PKTLEN; - desc->misc = 0; - desc->buf1 = (desc->buf1 & DESC_EOR) | DESC_OWN | - DESC_ADDR(skb->data); - } -} - -static int adm5120_switch_rx(int limit) -{ - unsigned int done = 0; - - SW_DBG("rx start, limit=%d, cur_rxl=%u, dirty_rxl=%u\n", - limit, cur_rxl, dirty_rxl); - - while (done < limit) { - int entry = cur_rxl % RX_RING_SIZE; - struct dma_desc *desc = &rxl_descs[entry]; - struct net_device *rdev; - unsigned int port; - - if (desc->buf1 & DESC_OWN) - break; - - if (dirty_rxl + RX_RING_SIZE == cur_rxl) - break; - - port = desc_get_srcport(desc); - rdev = adm5120_port[port]; - - SW_DBG("rx descriptor %u, desc=%p, skb=%p\n", entry, desc, - rxl_skbuff[entry]); - - if ((rdev) && netif_running(rdev)) { - struct sk_buff *skb = rxl_skbuff[entry]; - int pktlen; - - pktlen = desc_get_pktlen(desc); - pktlen -= ETH_CSUM_LEN; - - if ((pktlen == 0) || desc_ipcsum_fail(desc)) { - rdev->stats.rx_errors++; - if (pktlen == 0) - rdev->stats.rx_length_errors++; - if (desc_ipcsum_fail(desc)) - rdev->stats.rx_crc_errors++; - SW_DBG("rx error, recycling skb %u\n", entry); - } else { - skb_put(skb, pktlen); - - skb->dev = rdev; - skb->protocol = eth_type_trans(skb, rdev); - skb->ip_summed = CHECKSUM_UNNECESSARY; - - dma_cache_wback_inv((unsigned long)skb->data, - skb->len); - -#ifdef CONFIG_ADM5120_SWITCH_NAPI - netif_receive_skb(skb); -#else - netif_rx(skb); -#endif - - rdev->last_rx = jiffies; - rdev->stats.rx_packets++; - rdev->stats.rx_bytes += pktlen; - - rxl_skbuff[entry] = NULL; - done++; - } - } else { - SW_DBG("no rx device, recycling skb %u\n", entry); - } - - cur_rxl++; - if (cur_rxl - dirty_rxl > RX_RING_SIZE / 4) - adm5120_switch_rx_refill(); - } - - adm5120_switch_rx_refill(); - - SW_DBG("rx finished, cur_rxl=%u, dirty_rxl=%u, processed %d\n", - cur_rxl, dirty_rxl, done); - - return done; -} - -static void adm5120_switch_tx(void) -{ - unsigned int entry; - - spin_lock(&tx_lock); - entry = dirty_txl % TX_RING_SIZE; - while (dirty_txl != cur_txl) { - struct dma_desc *desc = &txl_descs[entry]; - struct sk_buff *skb = txl_skbuff[entry]; - - if (desc->buf1 & DESC_OWN) - break; - - if (netif_running(skb->dev)) { - skb->dev->stats.tx_bytes += skb->len; - skb->dev->stats.tx_packets++; - } - - dev_kfree_skb_irq(skb); - txl_skbuff[entry] = NULL; - entry = (++dirty_txl) % TX_RING_SIZE; - } - - if ((cur_txl - dirty_txl) < TX_QUEUE_LEN - 4) { - int i; - for (i = 0; i < SWITCH_NUM_PORTS; i++) { - if (!adm5120_devs[i]) - continue; - netif_wake_queue(adm5120_devs[i]); - } - } - spin_unlock(&tx_lock); -} - -#ifdef CONFIG_ADM5120_SWITCH_NAPI -static int adm5120_if_poll(struct napi_struct *napi, int limit) -{ - struct adm5120_if_priv *priv = container_of(napi, - struct adm5120_if_priv, napi); - struct net_device *dev __maybe_unused = priv->dev; - int done; - u32 status; - - sw_int_ack(SWITCH_INTS_POLL); - - SW_DBG("%s: processing TX ring\n", dev->name); - adm5120_switch_tx(); - - SW_DBG("%s: processing RX ring\n", dev->name); - done = adm5120_switch_rx(limit); - - status = sw_int_status() & SWITCH_INTS_POLL; - if ((done < limit) && (!status)) { - SW_DBG("disable polling mode for %s\n", dev->name); - napi_complete(napi); - sw_int_unmask(SWITCH_INTS_POLL); - return 0; - } - - SW_DBG("%s still in polling mode, done=%d, status=%x\n", - dev->name, done, status); - return 1; -} -#endif /* CONFIG_ADM5120_SWITCH_NAPI */ - - -static irqreturn_t adm5120_switch_irq(int irq, void *dev_id) -{ - u32 status; - - status = sw_int_status(); - status &= SWITCH_INTS_ALL; - if (!status) - return IRQ_NONE; - -#ifdef CONFIG_ADM5120_SWITCH_NAPI - sw_int_ack(status & ~SWITCH_INTS_POLL); - - if (status & SWITCH_INTS_POLL) { - struct net_device *dev = dev_id; - struct adm5120_if_priv *priv = netdev_priv(dev); - - sw_dump_intr_mask("poll ints", status); - SW_DBG("enable polling mode for %s\n", dev->name); - sw_int_mask(SWITCH_INTS_POLL); - napi_schedule(&priv->napi); - } -#else - sw_int_ack(status); - - if (status & (SWITCH_INT_RLD | SWITCH_INT_LDF)) - adm5120_switch_rx(RX_RING_SIZE); - - if (status & SWITCH_INT_SLD) - adm5120_switch_tx(); -#endif - - return IRQ_HANDLED; -} - -static void adm5120_set_bw(char *matrix) -{ - unsigned long val; - - /* Port 0 to 3 are set using the bandwidth control 0 register */ - val = matrix[0] + (matrix[1]<<8) + (matrix[2]<<16) + (matrix[3]<<24); - sw_write_reg(SWITCH_REG_BW_CNTL0, val); - - /* Port 4 and 5 are set using the bandwidth control 1 register */ - val = matrix[4]; - if (matrix[5] == 1) - sw_write_reg(SWITCH_REG_BW_CNTL1, val | 0x80000000); - else - sw_write_reg(SWITCH_REG_BW_CNTL1, val & ~0x8000000); - - SW_DBG("D: ctl0 0x%ux, ctl1 0x%ux\n", sw_read_reg(SWITCH_REG_BW_CNTL0), - sw_read_reg(SWITCH_REG_BW_CNTL1)); -} - -static void adm5120_switch_tx_ring_reset(struct dma_desc *desc, - struct sk_buff **skbl, int num) -{ - memset(desc, 0, num * sizeof(*desc)); - desc[num-1].buf1 |= DESC_EOR; - memset(skbl, 0, sizeof(struct skb *) * num); - - cur_txl = 0; - dirty_txl = 0; -} - -static void adm5120_switch_rx_ring_reset(struct dma_desc *desc, - struct sk_buff **skbl, int num) -{ - int i; - - memset(desc, 0, num * sizeof(*desc)); - for (i = 0; i < num; i++) { - skbl[i] = dev_alloc_skb(SKB_ALLOC_LEN); - if (!skbl[i]) { - i = num; - break; - } - skb_reserve(skbl[i], SKB_RESERVE_LEN); - adm5120_rx_dma_update(&desc[i], skbl[i], (num - 1 == i)); - } - - cur_rxl = 0; - dirty_rxl = 0; -} - -static int adm5120_switch_tx_ring_alloc(void) -{ - int err; - - txl_descs = dma_alloc_coherent(NULL, TX_DESCS_SIZE, &txl_descs_dma, - GFP_ATOMIC); - if (!txl_descs) { - err = -ENOMEM; - goto err; - } - - txl_skbuff = kzalloc(TX_SKBS_SIZE, GFP_KERNEL); - if (!txl_skbuff) { - err = -ENOMEM; - goto err; - } - - return 0; - -err: - return err; -} - -static void adm5120_switch_tx_ring_free(void) -{ - int i; - - if (txl_skbuff) { - for (i = 0; i < TX_RING_SIZE; i++) - if (txl_skbuff[i]) - kfree_skb(txl_skbuff[i]); - kfree(txl_skbuff); - } - - if (txl_descs) - dma_free_coherent(NULL, TX_DESCS_SIZE, txl_descs, - txl_descs_dma); -} - -static int adm5120_switch_rx_ring_alloc(void) -{ - int err; - int i; - - /* init RX ring */ - rxl_descs = dma_alloc_coherent(NULL, RX_DESCS_SIZE, &rxl_descs_dma, - GFP_ATOMIC); - if (!rxl_descs) { - err = -ENOMEM; - goto err; - } - - rxl_skbuff = kzalloc(RX_SKBS_SIZE, GFP_KERNEL); - if (!rxl_skbuff) { - err = -ENOMEM; - goto err; - } - - for (i = 0; i < RX_RING_SIZE; i++) { - struct sk_buff *skb; - skb = alloc_skb(SKB_ALLOC_LEN, GFP_ATOMIC); - if (!skb) { - err = -ENOMEM; - goto err; - } - rxl_skbuff[i] = skb; - skb_reserve(skb, SKB_RESERVE_LEN); - } - - return 0; - -err: - return err; -} - -static void adm5120_switch_rx_ring_free(void) -{ - int i; - - if (rxl_skbuff) { - for (i = 0; i < RX_RING_SIZE; i++) - if (rxl_skbuff[i]) - kfree_skb(rxl_skbuff[i]); - kfree(rxl_skbuff); - } - - if (rxl_descs) - dma_free_coherent(NULL, RX_DESCS_SIZE, rxl_descs, - rxl_descs_dma); -} - -static void adm5120_write_mac(struct net_device *dev) -{ - struct adm5120_if_priv *priv = netdev_priv(dev); - unsigned char *mac = dev->dev_addr; - u32 t; - - t = mac[2] | (mac[3] << MAC_WT1_MAC3_SHIFT) | - (mac[4] << MAC_WT1_MAC4_SHIFT) | (mac[5] << MAC_WT1_MAC5_SHIFT); - sw_write_reg(SWITCH_REG_MAC_WT1, t); - - t = (mac[0] << MAC_WT0_MAC0_SHIFT) | (mac[1] << MAC_WT0_MAC1_SHIFT) | - MAC_WT0_MAWC | MAC_WT0_WVE | (priv->vlan_no<<3); - - sw_write_reg(SWITCH_REG_MAC_WT0, t); - - while (!(sw_read_reg(SWITCH_REG_MAC_WT0) & MAC_WT0_MWD)) - ; -} - -static void adm5120_set_vlan(char *matrix) -{ - unsigned long val; - int vlan_port, port; - - val = matrix[0] + (matrix[1]<<8) + (matrix[2]<<16) + (matrix[3]<<24); - sw_write_reg(SWITCH_REG_VLAN_G1, val); - val = matrix[4] + (matrix[5]<<8); - sw_write_reg(SWITCH_REG_VLAN_G2, val); - - /* Now set/update the port vs. device lookup table */ - for (port = 0; port < SWITCH_NUM_PORTS; port++) { - for (vlan_port = 0; vlan_port < SWITCH_NUM_PORTS && !(matrix[vlan_port] & (0x00000001 << port)); vlan_port++) - ; - if (vlan_port < SWITCH_NUM_PORTS) - adm5120_port[port] = adm5120_devs[vlan_port]; - else - adm5120_port[port] = NULL; - } -} - -static void adm5120_switch_set_vlan_mac(unsigned int vlan, unsigned char *mac) -{ - u32 t; - - t = mac[2] | (mac[3] << MAC_WT1_MAC3_SHIFT) - | (mac[4] << MAC_WT1_MAC4_SHIFT) - | (mac[5] << MAC_WT1_MAC5_SHIFT); - sw_write_reg(SWITCH_REG_MAC_WT1, t); - - t = (mac[0] << MAC_WT0_MAC0_SHIFT) | (mac[1] << MAC_WT0_MAC1_SHIFT) | - MAC_WT0_MAWC | MAC_WT0_WVE | (vlan << MAC_WT0_WVN_SHIFT) | - (MAC_WT0_WAF_STATIC << MAC_WT0_WAF_SHIFT); - sw_write_reg(SWITCH_REG_MAC_WT0, t); - - do { - t = sw_read_reg(SWITCH_REG_MAC_WT0); - } while ((t & MAC_WT0_MWD) == 0); -} - -static void adm5120_switch_set_vlan_ports(unsigned int vlan, u32 ports) -{ - unsigned int reg; - u32 t; - - if (vlan < 4) - reg = SWITCH_REG_VLAN_G1; - else { - vlan -= 4; - reg = SWITCH_REG_VLAN_G2; - } - - t = sw_read_reg(reg); - t &= ~(0xFF << (vlan*8)); - t |= (ports << (vlan*8)); - sw_write_reg(reg, t); -} - -/* ------------------------------------------------------------------------ */ - -#ifdef CONFIG_ADM5120_SWITCH_NAPI -static inline void adm5120_if_napi_enable(struct net_device *dev) -{ - struct adm5120_if_priv *priv = netdev_priv(dev); - napi_enable(&priv->napi); -} - -static inline void adm5120_if_napi_disable(struct net_device *dev) -{ - struct adm5120_if_priv *priv = netdev_priv(dev); - napi_disable(&priv->napi); -} -#else -static inline void adm5120_if_napi_enable(struct net_device *dev) {} -static inline void adm5120_if_napi_disable(struct net_device *dev) {} -#endif /* CONFIG_ADM5120_SWITCH_NAPI */ - -static int adm5120_if_open(struct net_device *dev) -{ - u32 t; - int err; - int i; - - adm5120_if_napi_enable(dev); - - err = request_irq(dev->irq, adm5120_switch_irq, IRQF_SHARED, - dev->name, dev); - if (err) { - SW_ERR("unable to get irq for %s\n", dev->name); - goto err; - } - - if (!sw_used++) - /* enable interrupts on first open */ - sw_int_unmask(SWITCH_INTS_USED); - - /* enable (additional) port */ - t = sw_read_reg(SWITCH_REG_PORT_CONF0); - for (i = 0; i < SWITCH_NUM_PORTS; i++) { - if (dev == adm5120_devs[i]) - t &= ~adm5120_eth_vlans[i]; - } - sw_write_reg(SWITCH_REG_PORT_CONF0, t); - - netif_start_queue(dev); - - return 0; - -err: - adm5120_if_napi_disable(dev); - return err; -} - -static int adm5120_if_stop(struct net_device *dev) -{ - u32 t; - int i; - - netif_stop_queue(dev); - adm5120_if_napi_disable(dev); - - /* disable port if not assigned to other devices */ - t = sw_read_reg(SWITCH_REG_PORT_CONF0); - t |= SWITCH_PORTS_NOCPU; - for (i = 0; i < SWITCH_NUM_PORTS; i++) { - if ((dev != adm5120_devs[i]) && netif_running(adm5120_devs[i])) - t &= ~adm5120_eth_vlans[i]; - } - sw_write_reg(SWITCH_REG_PORT_CONF0, t); - - if (!--sw_used) - sw_int_mask(SWITCH_INTS_USED); - - free_irq(dev->irq, dev); - - return 0; -} - -static int adm5120_if_hard_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct dma_desc *desc; - struct adm5120_if_priv *priv = netdev_priv(dev); - unsigned int entry; - unsigned long data; - int i; - - /* lock switch irq */ - spin_lock_irq(&tx_lock); - - /* calculate the next TX descriptor entry. */ - entry = cur_txl % TX_RING_SIZE; - - desc = &txl_descs[entry]; - if (desc->buf1 & DESC_OWN) { - /* We want to write a packet but the TX queue is still - * occupied by the DMA. We are faster than the DMA... */ - SW_DBG("%s unable to transmit, packet dopped\n", dev->name); - dev_kfree_skb(skb); - dev->stats.tx_dropped++; - return 0; - } - - txl_skbuff[entry] = skb; - data = (desc->buf1 & DESC_EOR); - data |= DESC_ADDR(skb->data); - - desc->misc = - ((skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len) << DESC_PKTLEN_SHIFT) | - (0x1 << priv->vlan_no); - - desc->buflen = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; - - desc->buf1 = data | DESC_OWN; - sw_write_reg(SWITCH_REG_SEND_TRIG, SEND_TRIG_STL); - - cur_txl++; - if (cur_txl == dirty_txl + TX_QUEUE_LEN) { - for (i = 0; i < SWITCH_NUM_PORTS; i++) { - if (!adm5120_devs[i]) - continue; - netif_stop_queue(adm5120_devs[i]); - } - } - - dev->trans_start = jiffies; - - spin_unlock_irq(&tx_lock); - - return 0; -} - -static void adm5120_if_tx_timeout(struct net_device *dev) -{ - SW_INFO("TX timeout on %s\n", dev->name); -} - -static void adm5120_if_set_rx_mode(struct net_device *dev) -{ - struct adm5120_if_priv *priv = netdev_priv(dev); - u32 ports; - u32 t; - - ports = adm5120_eth_vlans[priv->vlan_no] & SWITCH_PORTS_NOCPU; - - t = sw_read_reg(SWITCH_REG_CPUP_CONF); - if (dev->flags & IFF_PROMISC) - /* enable unknown packets */ - t &= ~(ports << CPUP_CONF_DUNP_SHIFT); - else - /* disable unknown packets */ - t |= (ports << CPUP_CONF_DUNP_SHIFT); - - if (dev->flags & IFF_PROMISC || dev->flags & IFF_ALLMULTI || - netdev_mc_count(dev)) - /* enable multicast packets */ - t &= ~(ports << CPUP_CONF_DMCP_SHIFT); - else - /* disable multicast packets */ - t |= (ports << CPUP_CONF_DMCP_SHIFT); - - /* If there is any port configured to be in promiscuous mode, then the */ - /* Bridge Test Mode has to be activated. This will result in */ - /* transporting also packets learned in another VLAN to be forwarded */ - /* to the CPU. */ - /* The difficult scenario is when we want to build a bridge on the CPU.*/ - /* Assume we have port0 and the CPU port in VLAN0 and port1 and the */ - /* CPU port in VLAN1. Now we build a bridge on the CPU between */ - /* VLAN0 and VLAN1. Both ports of the VLANs are set in promisc mode. */ - /* Now assume a packet with ethernet source address 99 enters port 0 */ - /* It will be forwarded to the CPU because it is unknown. Then the */ - /* bridge in the CPU will send it to VLAN1 and it goes out at port 1. */ - /* When now a packet with ethernet destination address 99 comes in at */ - /* port 1 in VLAN1, then the switch has learned that this address is */ - /* located at port 0 in VLAN0. Therefore the switch will drop */ - /* this packet. In order to avoid this and to send the packet still */ - /* to the CPU, the Bridge Test Mode has to be activated. */ - - /* Check if there is any vlan in promisc mode. */ - if (~t & (SWITCH_PORTS_NOCPU << CPUP_CONF_DUNP_SHIFT)) - t |= CPUP_CONF_BTM; /* Enable Bridge Testing Mode */ - else - t &= ~CPUP_CONF_BTM; /* Disable Bridge Testing Mode */ - - sw_write_reg(SWITCH_REG_CPUP_CONF, t); - -} - -static int adm5120_if_set_mac_address(struct net_device *dev, void *p) -{ - int ret; - - ret = eth_mac_addr(dev, p); - if (ret) - return ret; - - adm5120_write_mac(dev); - return 0; -} - -static int adm5120_if_do_ioctl(struct net_device *dev, struct ifreq *rq, - int cmd) -{ - int err; - struct adm5120_sw_info info; - struct adm5120_if_priv *priv = netdev_priv(dev); - - switch (cmd) { - case SIOCGADMINFO: - info.magic = 0x5120; - info.ports = adm5120_nrdevs; - info.vlan = priv->vlan_no; - err = copy_to_user(rq->ifr_data, &info, sizeof(info)); - if (err) - return -EFAULT; - break; - case SIOCSMATRIX: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - err = copy_from_user(adm5120_eth_vlans, rq->ifr_data, - sizeof(adm5120_eth_vlans)); - if (err) - return -EFAULT; - adm5120_set_vlan(adm5120_eth_vlans); - break; - case SIOCGMATRIX: - err = copy_to_user(rq->ifr_data, adm5120_eth_vlans, - sizeof(adm5120_eth_vlans)); - if (err) - return -EFAULT; - break; - default: - return -EOPNOTSUPP; - } - return 0; -} - -static const struct net_device_ops adm5120sw_netdev_ops = { - .ndo_open = adm5120_if_open, - .ndo_stop = adm5120_if_stop, - .ndo_start_xmit = adm5120_if_hard_start_xmit, - .ndo_set_rx_mode = adm5120_if_set_rx_mode, - .ndo_do_ioctl = adm5120_if_do_ioctl, - .ndo_tx_timeout = adm5120_if_tx_timeout, - .ndo_validate_addr = eth_validate_addr, - .ndo_change_mtu = eth_change_mtu, - .ndo_set_mac_address = adm5120_if_set_mac_address, -}; - -static struct net_device *adm5120_if_alloc(void) -{ - struct net_device *dev; - struct adm5120_if_priv *priv; - - dev = alloc_etherdev(sizeof(*priv)); - if (!dev) - return NULL; - - priv = netdev_priv(dev); - priv->dev = dev; - - dev->irq = ADM5120_IRQ_SWITCH; - dev->netdev_ops = &adm5120sw_netdev_ops; - dev->watchdog_timeo = TX_TIMEOUT; - -#ifdef CONFIG_ADM5120_SWITCH_NAPI - netif_napi_add(dev, &priv->napi, adm5120_if_poll, 64); -#endif - - return dev; -} - -/* ------------------------------------------------------------------------ */ - -static void adm5120_switch_cleanup(void) -{ - int i; - - /* disable interrupts */ - sw_int_mask(SWITCH_INTS_ALL); - - for (i = 0; i < SWITCH_NUM_PORTS; i++) { - struct net_device *dev = adm5120_devs[i]; - if (dev) { - unregister_netdev(dev); - free_netdev(dev); - } - } - - adm5120_switch_tx_ring_free(); - adm5120_switch_rx_ring_free(); -} - -static int adm5120_switch_probe(struct platform_device *pdev) -{ - u32 t; - int i, err; - - adm5120_nrdevs = adm5120_eth_num_ports; - - t = CPUP_CONF_DCPUP | CPUP_CONF_CRCP | - SWITCH_PORTS_NOCPU << CPUP_CONF_DUNP_SHIFT | - SWITCH_PORTS_NOCPU << CPUP_CONF_DMCP_SHIFT ; - sw_write_reg(SWITCH_REG_CPUP_CONF, t); - - t = (SWITCH_PORTS_NOCPU << PORT_CONF0_EMCP_SHIFT) | - (SWITCH_PORTS_NOCPU << PORT_CONF0_BP_SHIFT) | - (SWITCH_PORTS_NOCPU); - sw_write_reg(SWITCH_REG_PORT_CONF0, t); - - /* setup ports to Autoneg/100M/Full duplex/Auto MDIX */ - t = SWITCH_PORTS_PHY | - (SWITCH_PORTS_PHY << PHY_CNTL2_SC_SHIFT) | - (SWITCH_PORTS_PHY << PHY_CNTL2_DC_SHIFT) | - (SWITCH_PORTS_PHY << PHY_CNTL2_PHYR_SHIFT) | - (SWITCH_PORTS_PHY << PHY_CNTL2_AMDIX_SHIFT) | - PHY_CNTL2_RMAE; - sw_write_reg(SWITCH_REG_PHY_CNTL2, t); - - t = sw_read_reg(SWITCH_REG_PHY_CNTL3); - t |= PHY_CNTL3_RNT; - sw_write_reg(SWITCH_REG_PHY_CNTL3, t); - - /* Force all the packets from all ports are low priority */ - sw_write_reg(SWITCH_REG_PRI_CNTL, 0); - - sw_int_mask(SWITCH_INTS_ALL); - sw_int_ack(SWITCH_INTS_ALL); - - err = adm5120_switch_rx_ring_alloc(); - if (err) - goto err; - - err = adm5120_switch_tx_ring_alloc(); - if (err) - goto err; - - adm5120_switch_tx_ring_reset(txl_descs, txl_skbuff, TX_RING_SIZE); - adm5120_switch_rx_ring_reset(rxl_descs, rxl_skbuff, RX_RING_SIZE); - - sw_write_reg(SWITCH_REG_SHDA, 0); - sw_write_reg(SWITCH_REG_SLDA, KSEG1ADDR(txl_descs)); - sw_write_reg(SWITCH_REG_RHDA, 0); - sw_write_reg(SWITCH_REG_RLDA, KSEG1ADDR(rxl_descs)); - - for (i = 0; i < SWITCH_NUM_PORTS; i++) { - struct net_device *dev; - struct adm5120_if_priv *priv; - - dev = adm5120_if_alloc(); - if (!dev) { - err = -ENOMEM; - goto err; - } - - adm5120_devs[i] = dev; - priv = netdev_priv(dev); - - priv->vlan_no = i; - priv->port_mask = adm5120_eth_vlans[i]; - - memcpy(dev->dev_addr, adm5120_eth_macs[i], 6); - adm5120_write_mac(dev); - - err = register_netdev(dev); - if (err) { - SW_INFO("%s register failed, error=%d\n", - dev->name, err); - goto err; - } - } - - /* setup vlan/port mapping after devs are filled up */ - adm5120_set_vlan(adm5120_eth_vlans); - - /* enable CPU port */ - t = sw_read_reg(SWITCH_REG_CPUP_CONF); - t &= ~CPUP_CONF_DCPUP; - sw_write_reg(SWITCH_REG_CPUP_CONF, t); - - return 0; - -err: - adm5120_switch_cleanup(); - - SW_ERR("init failed\n"); - return err; -} - -static int adm5120_switch_remove(struct platform_device *pdev) -{ - adm5120_switch_cleanup(); - return 0; -} - -static struct platform_driver adm5120_switch_driver = { - .probe = adm5120_switch_probe, - .remove = adm5120_switch_remove, - .driver = { - .name = DRV_NAME, - }, -}; - -/* -------------------------------------------------------------------------- */ - -static int __init adm5120_switch_mod_init(void) -{ - int err; - - pr_info(DRV_DESC " version " DRV_VERSION "\n"); - err = platform_driver_register(&adm5120_switch_driver); - - return err; -} - -static void __exit adm5120_switch_mod_exit(void) -{ - platform_driver_unregister(&adm5120_switch_driver); -} - -module_init(adm5120_switch_mod_init); -module_exit(adm5120_switch_mod_exit); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); diff --git a/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.h b/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.h deleted file mode 100644 index fa9e50335..000000000 --- a/target/linux/adm5120/files-3.18/drivers/net/adm5120sw.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Defines for ADM5120 built in ethernet switch driver - * - * Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005 - * - * Values come from ADM5120 datasheet and original ADMtek 2.4 driver, - * Copyright ADMtek Inc. - */ - -#ifndef _INCLUDE_ADM5120SW_H_ -#define _INCLUDE_ADM5120SW_H_ - -#define SIOCSMATRIX SIOCDEVPRIVATE -#define SIOCGMATRIX (SIOCDEVPRIVATE + 1) -#define SIOCGADMINFO (SIOCDEVPRIVATE + 2) - -struct adm5120_sw_info { - u16 magic; - u16 ports; - u16 vlan; -}; - -#endif /* _INCLUDE_ADM5120SW_H_ */ diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-dbg.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-dbg.c deleted file mode 100644 index 2d5dc2a5a..000000000 --- a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-dbg.c +++ /dev/null @@ -1,836 +0,0 @@ -/* - * ADM5120 HCD (Host Controller Driver) for USB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: drivers/usb/host/ohci-dbg.c - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2002 David Brownell - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -/*-------------------------------------------------------------------------*/ - -static inline char *ed_typestring(int ed_type) -{ - switch (ed_type) { - case PIPE_CONTROL: - return "ctrl"; - case PIPE_BULK: - return "bulk"; - case PIPE_INTERRUPT: - return "intr"; - case PIPE_ISOCHRONOUS: - return "isoc"; - } - return "(bad ed_type)"; -} - -static inline char *ed_statestring(int state) -{ - switch (state) { - case ED_IDLE: - return "IDLE"; - case ED_UNLINK: - return "UNLINK"; - case ED_OPER: - return "OPER"; - } - return "?STATE"; -} - -static inline char *pipestring(int pipe) -{ - return ed_typestring(usb_pipetype(pipe)); -} - -static inline char *td_pidstring(u32 info) -{ - switch (info & TD_DP) { - case TD_DP_SETUP: - return "SETUP"; - case TD_DP_IN: - return "IN"; - case TD_DP_OUT: - return "OUT"; - } - return "?PID"; -} - -static inline char *td_togglestring(u32 info) -{ - switch (info & TD_T) { - case TD_T_DATA0: - return "DATA0"; - case TD_T_DATA1: - return "DATA1"; - case TD_T_CARRY: - return "CARRY"; - } - return "?TOGGLE"; -} - -/*-------------------------------------------------------------------------*/ - -#ifdef DEBUG - -/* debug| print the main components of an URB - * small: 0) header + data packets 1) just header - */ -static void __attribute__((unused)) -urb_print(struct admhcd *ahcd, struct urb *urb, char *str, int small, int status) -{ - unsigned int pipe = urb->pipe; - - if (!urb->dev || !urb->dev->bus) { - admhc_dbg(ahcd, "%s URB: no dev", str); - return; - } - -#ifndef ADMHC_VERBOSE_DEBUG - if (status != 0) -#endif - admhc_dbg(ahcd, "URB-%s %p dev=%d ep=%d%s-%s flags=%x len=%d/%d " - "stat=%d\n", - str, - urb, - usb_pipedevice(pipe), - usb_pipeendpoint(pipe), - usb_pipeout(pipe) ? "out" : "in", - pipestring(pipe), - urb->transfer_flags, - urb->actual_length, - urb->transfer_buffer_length, - status); - -#ifdef ADMHC_VERBOSE_DEBUG - if (!small) { - int i, len; - - if (usb_pipecontrol(pipe)) { - admhc_dbg(ahcd, "setup(8):"); - for (i = 0; i < 8 ; i++) - printk(KERN_INFO" %02x", ((__u8 *)urb->setup_packet)[i]); - printk(KERN_INFO "\n"); - } - if (urb->transfer_buffer_length > 0 && urb->transfer_buffer) { - admhc_dbg(ahcd, "data(%d/%d):", - urb->actual_length, - urb->transfer_buffer_length); - len = usb_pipeout(pipe) ? - urb->transfer_buffer_length : urb->actual_length; - for (i = 0; i < 16 && i < len; i++) - printk(KERN_INFO " %02x", ((__u8 *)urb->transfer_buffer)[i]); - printk(KERN_INFO "%s stat:%d\n", i < len ? "..." : "", status); - } - } -#endif /* ADMHC_VERBOSE_DEBUG */ -} - -#define admhc_dbg_sw(ahcd, next, size, format, arg...) \ - do { \ - if (next) { \ - unsigned s_len; \ - s_len = scnprintf(*next, *size, format, ## arg); \ - *size -= s_len; *next += s_len; \ - } else \ - admhc_dbg(ahcd, format, ## arg); \ - } while (0); - - -static void admhc_dump_intr_mask(struct admhcd *ahcd, char *label, u32 mask, - char **next, unsigned *size) -{ - admhc_dbg_sw(ahcd, next, size, "%s 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", - label, - mask, - (mask & ADMHC_INTR_INTA) ? " INTA" : "", - (mask & ADMHC_INTR_FATI) ? " FATI" : "", - (mask & ADMHC_INTR_SWI) ? " SWI" : "", - (mask & ADMHC_INTR_TDC) ? " TDC" : "", - (mask & ADMHC_INTR_FNO) ? " FNO" : "", - (mask & ADMHC_INTR_SO) ? " SO" : "", - (mask & ADMHC_INTR_INSM) ? " INSM" : "", - (mask & ADMHC_INTR_BABI) ? " BABI" : "", - (mask & ADMHC_INTR_7) ? " !7!" : "", - (mask & ADMHC_INTR_6) ? " !6!" : "", - (mask & ADMHC_INTR_RESI) ? " RESI" : "", - (mask & ADMHC_INTR_SOFI) ? " SOFI" : "" - ); -} - -static void maybe_print_eds(struct admhcd *ahcd, char *label, u32 value, - char **next, unsigned *size) -{ - if (value) - admhc_dbg_sw(ahcd, next, size, "%s %08x\n", label, value); -} - -static char *buss2string(int state) -{ - switch (state) { - case ADMHC_BUSS_RESET: - return "reset"; - case ADMHC_BUSS_RESUME: - return "resume"; - case ADMHC_BUSS_OPER: - return "operational"; - case ADMHC_BUSS_SUSPEND: - return "suspend"; - } - return "?state"; -} - -static void -admhc_dump_status(struct admhcd *ahcd, char **next, unsigned *size) -{ - struct admhcd_regs __iomem *regs = ahcd->regs; - u32 temp; - - temp = admhc_readl(ahcd, ®s->gencontrol); - admhc_dbg_sw(ahcd, next, size, - "gencontrol 0x%08x%s%s%s%s\n", - temp, - (temp & ADMHC_CTRL_UHFE) ? " UHFE" : "", - (temp & ADMHC_CTRL_SIR) ? " SIR" : "", - (temp & ADMHC_CTRL_DMAA) ? " DMAA" : "", - (temp & ADMHC_CTRL_SR) ? " SR" : "" - ); - - temp = admhc_readl(ahcd, ®s->host_control); - admhc_dbg_sw(ahcd, next, size, - "host_control 0x%08x BUSS=%s%s\n", - temp, - buss2string(temp & ADMHC_HC_BUSS), - (temp & ADMHC_HC_DMAE) ? " DMAE" : "" - ); - - admhc_dump_intr_mask(ahcd, "int_status", - admhc_readl(ahcd, ®s->int_status), - next, size); - admhc_dump_intr_mask(ahcd, "int_enable", - admhc_readl(ahcd, ®s->int_enable), - next, size); - - maybe_print_eds(ahcd, "hosthead", - admhc_readl(ahcd, ®s->hosthead), next, size); -} - -#define dbg_port_sw(hc, num, value, next, size) \ - admhc_dbg_sw(hc, next, size, \ - "portstatus [%d] " \ - "0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \ - num, temp, \ - (temp & ADMHC_PS_PRSC) ? " PRSC" : "", \ - (temp & ADMHC_PS_OCIC) ? " OCIC" : "", \ - (temp & ADMHC_PS_PSSC) ? " PSSC" : "", \ - (temp & ADMHC_PS_PESC) ? " PESC" : "", \ - (temp & ADMHC_PS_CSC) ? " CSC" : "", \ - \ - (temp & ADMHC_PS_LSDA) ? " LSDA" : "", \ - (temp & ADMHC_PS_PPS) ? " PPS" : "", \ - (temp & ADMHC_PS_PRS) ? " PRS" : "", \ - (temp & ADMHC_PS_POCI) ? " POCI" : "", \ - (temp & ADMHC_PS_PSS) ? " PSS" : "", \ - \ - (temp & ADMHC_PS_PES) ? " PES" : "", \ - (temp & ADMHC_PS_CCS) ? " CCS" : "" \ - ); - - -static void -admhc_dump_roothub( - struct admhcd *ahcd, - int verbose, - char **next, - unsigned *size) -{ - u32 temp, i; - - temp = admhc_read_rhdesc(ahcd); - if (temp == ~(u32)0) - return; - - if (verbose) { - admhc_dbg_sw(ahcd, next, size, - "rhdesc %08x%s%s%s%s%s%s PPCM=%02x%s%s%s%s NUMP=%d(%d)\n", - temp, - (temp & ADMHC_RH_CRWE) ? " CRWE" : "", - (temp & ADMHC_RH_OCIC) ? " OCIC" : "", - (temp & ADMHC_RH_LPSC) ? " LPSC" : "", - (temp & ADMHC_RH_LPSC) ? " DRWE" : "", - (temp & ADMHC_RH_LPSC) ? " OCI" : "", - (temp & ADMHC_RH_LPSC) ? " LPS" : "", - ((temp & ADMHC_RH_PPCM) >> 16), - (temp & ADMHC_RH_NOCP) ? " NOCP" : "", - (temp & ADMHC_RH_OCPM) ? " OCPM" : "", - (temp & ADMHC_RH_NPS) ? " NPS" : "", - (temp & ADMHC_RH_PSM) ? " PSM" : "", - (temp & ADMHC_RH_NUMP), ahcd->num_ports - ); - } - - for (i = 0; i < ahcd->num_ports; i++) { - temp = admhc_read_portstatus(ahcd, i); - dbg_port_sw(ahcd, i, temp, next, size); - } -} - -static void admhc_dump(struct admhcd *ahcd, int verbose) -{ - admhc_dbg(ahcd, "ADMHC ahcd state\n"); - - /* dumps some of the state we know about */ - admhc_dump_status(ahcd, NULL, NULL); - admhc_dbg(ahcd, "current frame #%04x\n", - admhc_frame_no(ahcd)); - - admhc_dump_roothub(ahcd, verbose, NULL, NULL); -} - -static const char data0[] = "DATA0"; -static const char data1[] = "DATA1"; - -static void admhc_dump_td(const struct admhcd *ahcd, const char *label, - const struct td *td) -{ - u32 tmp; - - admhc_dbg(ahcd, "%s td %p; urb %p index %d; hwNextTD %08x\n", - label, td, - td->urb, td->index, - hc32_to_cpup(ahcd, &td->hwNextTD)); - - tmp = hc32_to_cpup(ahcd, &td->hwINFO); - admhc_dbg(ahcd, " status %08x%s CC=%x EC=%d %s %s ISI=%x FN=%x\n", - tmp, - (tmp & TD_OWN) ? " OWN" : "", - TD_CC_GET(tmp), - TD_EC_GET(tmp), - td_togglestring(tmp), - td_pidstring(tmp), - TD_ISI_GET(tmp), - TD_FN_GET(tmp)); - - tmp = hc32_to_cpup(ahcd, &td->hwCBL); - admhc_dbg(ahcd, " dbp %08x; cbl %08x; LEN=%d%s\n", - hc32_to_cpup(ahcd, &td->hwDBP), - tmp, - TD_BL_GET(tmp), - (tmp & TD_IE) ? " IE" : ""); -} - -/* caller MUST own hcd spinlock if verbose is set! */ -static void __attribute__((unused)) -admhc_dump_ed(const struct admhcd *ahcd, const char *label, - const struct ed *ed, int verbose) -{ - u32 tmp = hc32_to_cpu(ahcd, ed->hwINFO); - - admhc_dbg(ahcd, "%s ed %p %s type %s; next ed %08x\n", - label, - ed, ed_statestring(ed->state), ed_typestring(ed->type), - hc32_to_cpup(ahcd, &ed->hwNextED)); - - admhc_dbg(ahcd, " info %08x MAX=%d%s%s%s%s EP=%d DEV=%d\n", tmp, - ED_MPS_GET(tmp), - (tmp & ED_ISO) ? " ISO" : "", - (tmp & ED_SKIP) ? " SKIP" : "", - (tmp & ED_SPEED_FULL) ? " FULL" : " LOW", - (tmp & ED_INT) ? " INT" : "", - ED_EN_GET(tmp), - ED_FA_GET(tmp)); - - tmp = hc32_to_cpup(ahcd, &ed->hwHeadP); - admhc_dbg(ahcd, " tds: head %08x tail %08x %s%s%s\n", - tmp & TD_MASK, - hc32_to_cpup(ahcd, &ed->hwTailP), - (tmp & ED_C) ? data1 : data0, - (tmp & ED_H) ? " HALT" : "", - verbose ? " td list follows" : " (not listing)"); - - if (verbose) { - struct list_head *tmp; - - /* use ed->td_list because HC concurrently modifies - * hwNextTD as it accumulates ed_donelist. - */ - list_for_each(tmp, &ed->td_list) { - struct td *td; - td = list_entry(tmp, struct td, td_list); - admhc_dump_td(ahcd, " ->", td); - } - } -} - -#else /* ifdef DEBUG */ - -static inline void urb_print(struct admhcd *ahcd, struct urb * urb, char * str, - int small, int status) {} -static inline void admhc_dump_ed(const struct admhcd *ahcd, const char *label, - const struct ed *ed, int verbose) {} -static inline void admhc_dump_td(const struct admhcd *ahcd, const char *label, - const struct td *td) {} -static inline void admhc_dump(struct admhcd *ahcd, int verbose) {} - -#undef ADMHC_VERBOSE_DEBUG - -#endif /* DEBUG */ - -/*-------------------------------------------------------------------------*/ - -#ifdef STUB_DEBUG_FILES - -static inline void create_debug_files(struct admhcd *bus) { } -static inline void remove_debug_files(struct admhcd *bus) { } - -#else - -static int debug_async_open(struct inode *, struct file *); -static int debug_periodic_open(struct inode *, struct file *); -static int debug_registers_open(struct inode *, struct file *); -static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*); -static int debug_close(struct inode *, struct file *); - -static const struct file_operations debug_async_fops = { - .owner = THIS_MODULE, - .open = debug_async_open, - .read = debug_output, - .release = debug_close, - .llseek = default_llseek, -}; -static const struct file_operations debug_periodic_fops = { - .owner = THIS_MODULE, - .open = debug_periodic_open, - .read = debug_output, - .release = debug_close, - .llseek = default_llseek, -}; -static const struct file_operations debug_registers_fops = { - .owner = THIS_MODULE, - .open = debug_registers_open, - .read = debug_output, - .release = debug_close, - .llseek = default_llseek, -}; - -static struct dentry *admhc_debug_root; - -struct debug_buffer { - ssize_t (*fill_func)(struct debug_buffer *); /* fill method */ - struct admhcd *ahcd; - struct mutex mutex; /* protect filling of buffer */ - size_t count; /* number of characters filled into buffer */ - char *page; -}; - -static ssize_t -show_list(struct admhcd *ahcd, char *buf, size_t count, struct ed *ed) -{ - unsigned temp; - unsigned size = count; - - if (!ed) - return 0; - - /* dump a snapshot of the bulk or control schedule */ - while (ed) { - u32 info = hc32_to_cpu(ahcd, ed->hwINFO); - u32 headp = hc32_to_cpu(ahcd, ed->hwHeadP); - u32 tailp = hc32_to_cpu(ahcd, ed->hwTailP); - struct list_head *entry; - struct td *td; - - temp = scnprintf(buf, size, - "ed/%p %s %s %cs dev%d ep%d %s%smax %d %08x%s%s %s" - " h:%08x t:%08x", - ed, - ed_statestring(ed->state), - ed_typestring(ed->type), - (info & ED_SPEED_FULL) ? 'f' : 'l', - info & ED_FA_MASK, - (info >> ED_EN_SHIFT) & ED_EN_MASK, - (info & ED_INT) ? "INT " : "", - (info & ED_ISO) ? "ISO " : "", - (info >> ED_MPS_SHIFT) & ED_MPS_MASK , - info, - (info & ED_SKIP) ? " S" : "", - (headp & ED_H) ? " H" : "", - (headp & ED_C) ? data1 : data0, - headp & ED_MASK, tailp); - size -= temp; - buf += temp; - - list_for_each(entry, &ed->td_list) { - u32 dbp, cbl; - - td = list_entry(entry, struct td, td_list); - info = hc32_to_cpup(ahcd, &td->hwINFO); - dbp = hc32_to_cpup(ahcd, &td->hwDBP); - cbl = hc32_to_cpup(ahcd, &td->hwCBL); - - temp = scnprintf(buf, size, - "\n\ttd/%p %s %d %s%scc=%x urb %p (%08x,%08x)", - td, - td_pidstring(info), - TD_BL_GET(cbl), - (info & TD_OWN) ? "" : "DONE ", - (cbl & TD_IE) ? "IE " : "", - TD_CC_GET(info), td->urb, info, cbl); - size -= temp; - buf += temp; - } - - temp = scnprintf(buf, size, "\n"); - size -= temp; - buf += temp; - - ed = ed->ed_next; - } - - return count - size; -} - -static ssize_t fill_async_buffer(struct debug_buffer *buf) -{ - struct admhcd *ahcd; - size_t temp; - unsigned long flags; - - ahcd = buf->ahcd; - - spin_lock_irqsave(&ahcd->lock, flags); - temp = show_list(ahcd, buf->page, PAGE_SIZE, ahcd->ed_head); - spin_unlock_irqrestore(&ahcd->lock, flags); - - return temp; -} - - -#define DBG_SCHED_LIMIT 64 - -static ssize_t fill_periodic_buffer(struct debug_buffer *buf) -{ - struct admhcd *ahcd; - struct ed **seen, *ed; - unsigned long flags; - unsigned temp, size, seen_count; - char *next; - unsigned i; - - seen = kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC); - if (!seen) - return 0; - seen_count = 0; - - ahcd = buf->ahcd; - next = buf->page; - size = PAGE_SIZE; - - temp = scnprintf(next, size, "size = %d\n", NUM_INTS); - size -= temp; - next += temp; - - /* dump a snapshot of the periodic schedule (and load) */ - spin_lock_irqsave(&ahcd->lock, flags); - for (i = 0; i < NUM_INTS; i++) { - ed = ahcd->periodic[i]; - if (!ed) - continue; - - temp = scnprintf(next, size, "%2d [%3d]:", i, ahcd->load[i]); - size -= temp; - next += temp; - - do { - temp = scnprintf(next, size, " ed%d/%p", - ed->interval, ed); - size -= temp; - next += temp; - for (temp = 0; temp < seen_count; temp++) { - if (seen[temp] == ed) - break; - } - - /* show more info the first time around */ - if (temp == seen_count) { - u32 info = hc32_to_cpu(ahcd, ed->hwINFO); - struct list_head *entry; - unsigned qlen = 0; - - /* qlen measured here in TDs, not urbs */ - list_for_each(entry, &ed->td_list) - qlen++; - temp = scnprintf(next, size, - " (%cs dev%d ep%d%s qlen %u" - " max %d %08x%s%s)", - (info & ED_SPEED_FULL) ? 'f' : 'l', - ED_FA_GET(info), - ED_EN_GET(info), - (info & ED_ISO) ? "iso" : "int", - qlen, - ED_MPS_GET(info), - info, - (info & ED_SKIP) ? " K" : "", - (ed->hwHeadP & - cpu_to_hc32(ahcd, ED_H)) ? - " H" : ""); - size -= temp; - next += temp; - - if (seen_count < DBG_SCHED_LIMIT) - seen[seen_count++] = ed; - - ed = ed->ed_next; - - } else { - /* we've seen it and what's after */ - temp = 0; - ed = NULL; - } - - } while (ed); - - temp = scnprintf(next, size, "\n"); - size -= temp; - next += temp; - } - spin_unlock_irqrestore(&ahcd->lock, flags); - kfree(seen); - - return PAGE_SIZE - size; -} - - -#undef DBG_SCHED_LIMIT - -static ssize_t fill_registers_buffer(struct debug_buffer *buf) -{ - struct usb_hcd *hcd; - struct admhcd *ahcd; - struct admhcd_regs __iomem *regs; - unsigned long flags; - unsigned temp, size; - char *next; - u32 rdata; - - ahcd = buf->ahcd; - hcd = admhc_to_hcd(ahcd); - regs = ahcd->regs; - next = buf->page; - size = PAGE_SIZE; - - spin_lock_irqsave(&ahcd->lock, flags); - - /* dump driver info, then registers in spec order */ - - admhc_dbg_sw(ahcd, &next, &size, - "bus %s, device %s\n" - "%s\n" - "%s\n", - hcd->self.controller->bus->name, - dev_name(hcd->self.controller), - hcd->product_desc, - hcd_name); - - if (!HCD_HW_ACCESSIBLE(hcd)) { - size -= scnprintf(next, size, - "SUSPENDED (no register access)\n"); - goto done; - } - - admhc_dump_status(ahcd, &next, &size); - - /* other registers mostly affect frame timings */ - rdata = admhc_readl(ahcd, ®s->fminterval); - temp = scnprintf(next, size, - "fmintvl 0x%08x %sFSLDP=0x%04x FI=0x%04x\n", - rdata, (rdata & ADMHC_SFI_FIT) ? "FIT " : "", - (rdata >> ADMHC_SFI_FSLDP_SHIFT) & ADMHC_SFI_FSLDP_MASK, - rdata & ADMHC_SFI_FI_MASK); - size -= temp; - next += temp; - - rdata = admhc_readl(ahcd, ®s->fmnumber); - temp = scnprintf(next, size, "fmnumber 0x%08x %sFR=0x%04x FN=%04x\n", - rdata, (rdata & ADMHC_SFN_FRT) ? "FRT " : "", - (rdata >> ADMHC_SFN_FR_SHIFT) & ADMHC_SFN_FR_MASK, - rdata & ADMHC_SFN_FN_MASK); - size -= temp; - next += temp; - - /* TODO: use predefined bitmask */ - rdata = admhc_readl(ahcd, ®s->lsthresh); - temp = scnprintf(next, size, "lsthresh 0x%04x\n", - rdata & 0x3fff); - size -= temp; - next += temp; - - temp = scnprintf(next, size, "hub poll timer: %s\n", - admhcd_to_hcd(ahcd)->poll_rh ? "ON" : "OFF"); - size -= temp; - next += temp; - - /* roothub */ - admhc_dump_roothub(ahcd, 1, &next, &size); - -done: - spin_unlock_irqrestore(&ahcd->lock, flags); - return PAGE_SIZE - size; -} - - -static struct debug_buffer *alloc_buffer(struct admhcd *ahcd, - ssize_t (*fill_func)(struct debug_buffer *)) -{ - struct debug_buffer *buf; - - buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL); - - if (buf) { - buf->ahcd = ahcd; - buf->fill_func = fill_func; - mutex_init(&buf->mutex); - } - - return buf; -} - -static int fill_buffer(struct debug_buffer *buf) -{ - int ret = 0; - - if (!buf->page) - buf->page = (char *)get_zeroed_page(GFP_KERNEL); - - if (!buf->page) { - ret = -ENOMEM; - goto out; - } - - ret = buf->fill_func(buf); - - if (ret >= 0) { - buf->count = ret; - ret = 0; - } - -out: - return ret; -} - -static ssize_t debug_output(struct file *file, char __user *user_buf, - size_t len, loff_t *offset) -{ - struct debug_buffer *buf = file->private_data; - int ret = 0; - - mutex_lock(&buf->mutex); - if (buf->count == 0) { - ret = fill_buffer(buf); - if (ret != 0) { - mutex_unlock(&buf->mutex); - goto out; - } - } - mutex_unlock(&buf->mutex); - - ret = simple_read_from_buffer(user_buf, len, offset, - buf->page, buf->count); - -out: - return ret; -} - -static int debug_close(struct inode *inode, struct file *file) -{ - struct debug_buffer *buf = file->private_data; - - if (buf) { - if (buf->page) - free_page((unsigned long)buf->page); - kfree(buf); - } - - return 0; -} - -static int debug_async_open(struct inode *inode, struct file *file) -{ - file->private_data = alloc_buffer(inode->i_private, fill_async_buffer); - - return file->private_data ? 0 : -ENOMEM; -} - -static int debug_periodic_open(struct inode *inode, struct file *file) -{ - file->private_data = alloc_buffer(inode->i_private, - fill_periodic_buffer); - - return file->private_data ? 0 : -ENOMEM; -} - -static int debug_registers_open(struct inode *inode, struct file *file) -{ - file->private_data = alloc_buffer(inode->i_private, - fill_registers_buffer); - - return file->private_data ? 0 : -ENOMEM; -} - -static inline void create_debug_files(struct admhcd *ahcd) -{ - struct usb_bus *bus = &admhcd_to_hcd(ahcd)->self; - - ahcd->debug_dir = debugfs_create_dir(bus->bus_name, admhc_debug_root); - if (!ahcd->debug_dir) - goto dir_error; - - ahcd->debug_async = debugfs_create_file("async", S_IRUGO, - ahcd->debug_dir, ahcd, - &debug_async_fops); - if (!ahcd->debug_async) - goto async_error; - - ahcd->debug_periodic = debugfs_create_file("periodic", S_IRUGO, - ahcd->debug_dir, ahcd, - &debug_periodic_fops); - if (!ahcd->debug_periodic) - goto periodic_error; - - ahcd->debug_registers = debugfs_create_file("registers", S_IRUGO, - ahcd->debug_dir, ahcd, - &debug_registers_fops); - if (!ahcd->debug_registers) - goto registers_error; - - admhc_dbg(ahcd, "created debug files\n"); - return; - -registers_error: - debugfs_remove(ahcd->debug_periodic); -periodic_error: - debugfs_remove(ahcd->debug_async); -async_error: - debugfs_remove(ahcd->debug_dir); -dir_error: - ahcd->debug_periodic = NULL; - ahcd->debug_async = NULL; - ahcd->debug_dir = NULL; -} - -static inline void remove_debug_files(struct admhcd *ahcd) -{ - debugfs_remove(ahcd->debug_registers); - debugfs_remove(ahcd->debug_periodic); - debugfs_remove(ahcd->debug_async); - debugfs_remove(ahcd->debug_dir); -} - -#endif - -/*-------------------------------------------------------------------------*/ diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-drv.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-drv.c deleted file mode 100644 index 798fd2208..000000000 --- a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-drv.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * ADM5120 HCD (Host Controller Driver) for USB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: drivers/usb/host/ohci-au1xxx.c - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2002 David Brownell - * (C) Copyright 2002 Hewlett-Packard Company - * - * Written by Christopher Hoover - * Based on fragments of previous driver by Russell King et al. - * - * Modified for LH7A404 from ahcd-sa1111.c - * by Durgesh Pattamatta - * Modified for AMD Alchemy Au1xxx - * by Matt Porter - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include - -#include -#include - -#ifdef DEBUG -#define HCD_DBG(f, a...) printk(KERN_DEBUG "%s: " f, hcd_name, ## a) -#else -#define HCD_DBG(f, a...) do {} while (0) -#endif -#define HCD_ERR(f, a...) printk(KERN_ERR "%s: " f, hcd_name, ## a) -#define HCD_INFO(f, a...) printk(KERN_INFO "%s: " f, hcd_name, ## a) - -/*-------------------------------------------------------------------------*/ - -static int admhc_adm5120_probe(const struct hc_driver *driver, - struct platform_device *dev) -{ - int retval; - struct usb_hcd *hcd; - int irq; - struct resource *regs; - - /* sanity checks */ - regs = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!regs) { - HCD_DBG("no IOMEM resource found\n"); - return -ENODEV; - } - - irq = platform_get_irq(dev, 0); - if (irq < 0) { - HCD_DBG("no IRQ resource found\n"); - return -ENODEV; - } - - hcd = usb_create_hcd(driver, &dev->dev, "ADM5120"); - if (!hcd) - return -ENOMEM; - - hcd->rsrc_start = regs->start; - hcd->rsrc_len = regs->end - regs->start + 1; - - if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { - HCD_DBG("request_mem_region failed\n"); - retval = -EBUSY; - goto err_dev; - } - - hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); - if (!hcd->regs) { - HCD_DBG("ioremap failed\n"); - retval = -ENOMEM; - goto err_mem; - } - - admhc_hcd_init(hcd_to_admhcd(hcd)); - - retval = usb_add_hcd(hcd, irq, 0); - if (retval) - goto err_io; - - return 0; - -err_io: - iounmap(hcd->regs); -err_mem: - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); -err_dev: - usb_put_hcd(hcd); - return retval; -} - - -/* may be called without controller electrically present */ -/* may be called with controller, bus, and devices active */ - -static void admhc_adm5120_remove(struct usb_hcd *hcd, - struct platform_device *dev) -{ - usb_remove_hcd(hcd); - iounmap(hcd->regs); - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); - usb_put_hcd(hcd); -} - -static int admhc_adm5120_start(struct usb_hcd *hcd) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - int ret; - - ret = admhc_init(ahcd); - if (ret < 0) { - HCD_ERR("unable to init %s\n", hcd->self.bus_name); - goto err; - } - - ret = admhc_run(ahcd); - if (ret < 0) { - HCD_ERR("unable to run %s\n", hcd->self.bus_name); - goto err_stop; - } - - return 0; - -err_stop: - admhc_stop(hcd); -err: - return ret; -} - -static const struct hc_driver adm5120_hc_driver = { - .description = hcd_name, - .product_desc = "ADM5120 built-in USB 1.1 Host Controller", - .hcd_priv_size = sizeof(struct admhcd), - - /* - * generic hardware linkage - */ - .irq = admhc_irq, - .flags = HCD_USB11 | HCD_MEMORY, - - /* - * basic lifecycle operations - */ - .start = admhc_adm5120_start, - .stop = admhc_stop, - .shutdown = admhc_shutdown, - - /* - * managing i/o requests and associated device resources - */ - .urb_enqueue = admhc_urb_enqueue, - .urb_dequeue = admhc_urb_dequeue, - .endpoint_disable = admhc_endpoint_disable, - - /* - * scheduling support - */ - .get_frame_number = admhc_get_frame_number, - - /* - * root hub support - */ - .hub_status_data = admhc_hub_status_data, - .hub_control = admhc_hub_control, -#ifdef CONFIG_PM - .bus_suspend = admhc_bus_suspend, - .bus_resume = admhc_bus_resume, -#endif - .start_port_reset = admhc_start_port_reset, -}; - -static int usb_hcd_adm5120_probe(struct platform_device *pdev) -{ - int ret; - - ret = admhc_adm5120_probe(&adm5120_hc_driver, pdev); - - return ret; -} - -static int usb_hcd_adm5120_remove(struct platform_device *pdev) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); - - admhc_adm5120_remove(hcd, pdev); - - return 0; -} - -#ifdef CONFIG_PM -/* TODO */ -static int usb_hcd_adm5120_suspend(struct platform_device *dev) -{ - struct usb_hcd *hcd = platform_get_drvdata(dev); - - return 0; -} - -static int usb_hcd_adm5120_resume(struct platform_device *dev) -{ - struct usb_hcd *hcd = platform_get_drvdata(dev); - - return 0; -} -#else -#define usb_hcd_adm5120_suspend NULL -#define usb_hcd_adm5120_resume NULL -#endif /* CONFIG_PM */ - -static struct platform_driver usb_hcd_adm5120_driver = { - .probe = usb_hcd_adm5120_probe, - .remove = usb_hcd_adm5120_remove, - .shutdown = usb_hcd_platform_shutdown, - .suspend = usb_hcd_adm5120_suspend, - .resume = usb_hcd_adm5120_resume, - .driver = { - .name = "adm5120-hcd", - .owner = THIS_MODULE, - }, -}; - diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hcd.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hcd.c deleted file mode 100644 index f721ec1ff..000000000 --- a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hcd.c +++ /dev/null @@ -1,843 +0,0 @@ -/* - * ADM5120 HCD (Host Controller Driver) for USB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: drivers/usb/host/ohci-hcd.c - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2004 David Brownell - * - * [ Initialisation is based on Linus' ] - * [ uhci code and gregs ahcd fragments ] - * [ (C) Copyright 1999 Linus Torvalds ] - * [ (C) Copyright 1999 Gregory P. Smith] - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define DRIVER_VERSION "0.27.0" -#define DRIVER_AUTHOR "Gabor Juhos " -#define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver" - -/*-------------------------------------------------------------------------*/ - -#undef ADMHC_VERBOSE_DEBUG /* not always helpful */ - -/* For initializing controller (mask in an HCFS mode too) */ -#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR - -#define ADMHC_INTR_INIT \ - (ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \ - | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI) - -/*-------------------------------------------------------------------------*/ - -static const char hcd_name[] = "admhc-hcd"; - -#define STATECHANGE_DELAY msecs_to_jiffies(300) - -#include "adm5120.h" - -static void admhc_dump(struct admhcd *ahcd, int verbose); -static int admhc_init(struct admhcd *ahcd); -static void admhc_stop(struct usb_hcd *hcd); - -#include "adm5120-dbg.c" -#include "adm5120-mem.c" -#include "adm5120-pm.c" -#include "adm5120-hub.c" -#include "adm5120-q.c" - -/*-------------------------------------------------------------------------*/ - -/* - * queue up an urb for anything except the root hub - */ -static int admhc_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, - gfp_t mem_flags) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - struct ed *ed; - struct urb_priv *urb_priv; - unsigned int pipe = urb->pipe; - int td_cnt = 0; - unsigned long flags; - int ret = 0; - -#ifdef ADMHC_VERBOSE_DEBUG - spin_lock_irqsave(&ahcd->lock, flags); - urb_print(ahcd, urb, "ENQEUE", usb_pipein(pipe), -EINPROGRESS); - spin_unlock_irqrestore(&ahcd->lock, flags); -#endif - - /* every endpoint has an ed, locate and maybe (re)initialize it */ - ed = ed_get(ahcd, urb->ep, urb->dev, pipe, urb->interval); - if (!ed) - return -ENOMEM; - - /* for the private part of the URB we need the number of TDs */ - switch (ed->type) { - case PIPE_CONTROL: - if (urb->transfer_buffer_length > TD_DATALEN_MAX) - /* td_submit_urb() doesn't yet handle these */ - return -EMSGSIZE; - - /* 1 TD for setup, 1 for ACK, plus ... */ - td_cnt = 2; - /* FALLTHROUGH */ - case PIPE_BULK: - /* one TD for every 4096 Bytes (can be up to 8K) */ - td_cnt += urb->transfer_buffer_length / TD_DATALEN_MAX; - /* ... and for any remaining bytes ... */ - if ((urb->transfer_buffer_length % TD_DATALEN_MAX) != 0) - td_cnt++; - /* ... and maybe a zero length packet to wrap it up */ - if (td_cnt == 0) - td_cnt++; - else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0 - && (urb->transfer_buffer_length - % usb_maxpacket(urb->dev, pipe, - usb_pipeout(pipe))) == 0) - td_cnt++; - break; - case PIPE_INTERRUPT: - /* - * for Interrupt IN/OUT transactions, each ED contains - * only 1 TD. - * TODO: check transfer_buffer_length? - */ - td_cnt = 1; - break; - case PIPE_ISOCHRONOUS: - /* number of packets from URB */ - td_cnt = urb->number_of_packets; - break; - } - - urb_priv = urb_priv_alloc(ahcd, td_cnt, mem_flags); - if (!urb_priv) - return -ENOMEM; - - urb_priv->ed = ed; - - spin_lock_irqsave(&ahcd->lock, flags); - /* don't submit to a dead HC */ - if (!HCD_HW_ACCESSIBLE(hcd)) { - ret = -ENODEV; - goto fail; - } - if (!HC_IS_RUNNING(hcd->state)) { - ret = -ENODEV; - goto fail; - } - - ret = usb_hcd_link_urb_to_ep(hcd, urb); - if (ret) - goto fail; - - /* schedule the ed if needed */ - if (ed->state == ED_IDLE) { - ret = ed_schedule(ahcd, ed); - if (ret < 0) { - usb_hcd_unlink_urb_from_ep(hcd, urb); - goto fail; - } - if (ed->type == PIPE_ISOCHRONOUS) { - u16 frame = admhc_frame_no(ahcd); - - /* delay a few frames before the first TD */ - frame += max_t (u16, 8, ed->interval); - frame &= ~(ed->interval - 1); - frame |= ed->branch; - urb->start_frame = frame; - - /* yes, only URB_ISO_ASAP is supported, and - * urb->start_frame is never used as input. - */ - } - } else if (ed->type == PIPE_ISOCHRONOUS) - urb->start_frame = ed->last_iso + ed->interval; - - /* fill the TDs and link them to the ed; and - * enable that part of the schedule, if needed - * and update count of queued periodic urbs - */ - urb->hcpriv = urb_priv; - td_submit_urb(ahcd, urb); - -#ifdef ADMHC_VERBOSE_DEBUG - admhc_dump_ed(ahcd, "admhc_urb_enqueue", urb_priv->ed, 1); -#endif - -fail: - if (ret) - urb_priv_free(ahcd, urb_priv); - - spin_unlock_irqrestore(&ahcd->lock, flags); - return ret; -} - -/* - * decouple the URB from the HC queues (TDs, urb_priv); - * reporting is always done - * asynchronously, and we might be dealing with an urb that's - * partially transferred, or an ED with other urbs being unlinked. - */ -static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, - int status) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - unsigned long flags; - int ret; - - spin_lock_irqsave(&ahcd->lock, flags); - -#ifdef ADMHC_VERBOSE_DEBUG - urb_print(ahcd, urb, "DEQUEUE", 1, status); -#endif - ret = usb_hcd_check_unlink_urb(hcd, urb, status); - if (ret) { - /* Do nothing */ - ; - } else if (HC_IS_RUNNING(hcd->state)) { - struct urb_priv *urb_priv; - - /* Unless an IRQ completed the unlink while it was being - * handed to us, flag it for unlink and giveback, and force - * some upcoming INTR_SF to call finish_unlinks() - */ - urb_priv = urb->hcpriv; - if (urb_priv) { - if (urb_priv->ed->state == ED_OPER) - start_ed_unlink(ahcd, urb_priv->ed); - } - } else { - /* - * with HC dead, we won't respect hc queue pointers - * any more ... just clean up every urb's memory. - */ - if (urb->hcpriv) - finish_urb(ahcd, urb, status); - } - spin_unlock_irqrestore(&ahcd->lock, flags); - - return ret; -} - -/*-------------------------------------------------------------------------*/ - -/* frees config/altsetting state for endpoints, - * including ED memory, dummy TD, and bulk/intr data toggle - */ - -static void admhc_endpoint_disable(struct usb_hcd *hcd, - struct usb_host_endpoint *ep) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - unsigned long flags; - struct ed *ed = ep->hcpriv; - unsigned limit = 1000; - - /* ASSERT: any requests/urbs are being unlinked */ - /* ASSERT: nobody can be submitting urbs for this any more */ - - if (!ed) - return; - -#ifdef ADMHC_VERBOSE_DEBUG - spin_lock_irqsave(&ahcd->lock, flags); - admhc_dump_ed(ahcd, "EP-DISABLE", ed, 1); - spin_unlock_irqrestore(&ahcd->lock, flags); -#endif - -rescan: - spin_lock_irqsave(&ahcd->lock, flags); - - if (!HC_IS_RUNNING(hcd->state)) { -sanitize: - ed->state = ED_IDLE; - finish_unlinks(ahcd, 0); - } - - switch (ed->state) { - case ED_UNLINK: /* wait for hw to finish? */ - /* major IRQ delivery trouble loses INTR_SOFI too... */ - if (limit-- == 0) { - admhc_warn(ahcd, "IRQ INTR_SOFI lossage\n"); - goto sanitize; - } - spin_unlock_irqrestore(&ahcd->lock, flags); - schedule_timeout_uninterruptible(1); - goto rescan; - case ED_IDLE: /* fully unlinked */ - if (list_empty(&ed->td_list)) { - td_free(ahcd, ed->dummy); - ed_free(ahcd, ed); - break; - } - /* else FALL THROUGH */ - default: - /* caller was supposed to have unlinked any requests; - * that's not our job. can't recover; must leak ed. - */ - admhc_err(ahcd, "leak ed %p (#%02x) state %d%s\n", - ed, ep->desc.bEndpointAddress, ed->state, - list_empty(&ed->td_list) ? "" : " (has tds)"); - td_free(ahcd, ed->dummy); - break; - } - - ep->hcpriv = NULL; - - spin_unlock_irqrestore(&ahcd->lock, flags); -} - -static int admhc_get_frame_number(struct usb_hcd *hcd) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - - return admhc_frame_no(ahcd); -} - -static void admhc_usb_reset(struct admhcd *ahcd) -{ -#if 0 - ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control); - ahcd->hc_control &= OHCI_CTRL_RWC; - admhc_writel(ahcd, ahcd->hc_control, &ahcd->regs->control); -#else - /* FIXME */ - ahcd->host_control = ADMHC_BUSS_RESET; - admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control); -#endif -} - -/* admhc_shutdown forcibly disables IRQs and DMA, helping kexec and - * other cases where the next software may expect clean state from the - * "firmware". this is bus-neutral, unlike shutdown() methods. - */ -static void -admhc_shutdown(struct usb_hcd *hcd) -{ - struct admhcd *ahcd; - - ahcd = hcd_to_admhcd(hcd); - admhc_intr_disable(ahcd, ADMHC_INTR_MIE); - admhc_dma_disable(ahcd); - admhc_usb_reset(ahcd); - /* flush the writes */ - admhc_writel_flush(ahcd); -} - -/*-------------------------------------------------------------------------* - * HC functions - *-------------------------------------------------------------------------*/ - -static void admhc_eds_cleanup(struct admhcd *ahcd) -{ - if (ahcd->ed_tails[PIPE_INTERRUPT]) { - ed_free(ahcd, ahcd->ed_tails[PIPE_INTERRUPT]); - ahcd->ed_tails[PIPE_INTERRUPT] = NULL; - } - - if (ahcd->ed_tails[PIPE_ISOCHRONOUS]) { - ed_free(ahcd, ahcd->ed_tails[PIPE_ISOCHRONOUS]); - ahcd->ed_tails[PIPE_ISOCHRONOUS] = NULL; - } - - if (ahcd->ed_tails[PIPE_CONTROL]) { - ed_free(ahcd, ahcd->ed_tails[PIPE_CONTROL]); - ahcd->ed_tails[PIPE_CONTROL] = NULL; - } - - if (ahcd->ed_tails[PIPE_BULK]) { - ed_free(ahcd, ahcd->ed_tails[PIPE_BULK]); - ahcd->ed_tails[PIPE_BULK] = NULL; - } - - ahcd->ed_head = NULL; -} - -#define ED_DUMMY_INFO (ED_SPEED_FULL | ED_SKIP) - -static int admhc_eds_init(struct admhcd *ahcd) -{ - struct ed *ed; - - ed = ed_create(ahcd, PIPE_INTERRUPT, ED_DUMMY_INFO); - if (!ed) - goto err; - - ahcd->ed_tails[PIPE_INTERRUPT] = ed; - - ed = ed_create(ahcd, PIPE_ISOCHRONOUS, ED_DUMMY_INFO); - if (!ed) - goto err; - - ahcd->ed_tails[PIPE_ISOCHRONOUS] = ed; - ed->ed_prev = ahcd->ed_tails[PIPE_INTERRUPT]; - ahcd->ed_tails[PIPE_INTERRUPT]->ed_next = ed; - ahcd->ed_tails[PIPE_INTERRUPT]->hwNextED = cpu_to_hc32(ahcd, ed->dma); - - ed = ed_create(ahcd, PIPE_CONTROL, ED_DUMMY_INFO); - if (!ed) - goto err; - - ahcd->ed_tails[PIPE_CONTROL] = ed; - ed->ed_prev = ahcd->ed_tails[PIPE_ISOCHRONOUS]; - ahcd->ed_tails[PIPE_ISOCHRONOUS]->ed_next = ed; - ahcd->ed_tails[PIPE_ISOCHRONOUS]->hwNextED = cpu_to_hc32(ahcd, ed->dma); - - ed = ed_create(ahcd, PIPE_BULK, ED_DUMMY_INFO); - if (!ed) - goto err; - - ahcd->ed_tails[PIPE_BULK] = ed; - ed->ed_prev = ahcd->ed_tails[PIPE_CONTROL]; - ahcd->ed_tails[PIPE_CONTROL]->ed_next = ed; - ahcd->ed_tails[PIPE_CONTROL]->hwNextED = cpu_to_hc32(ahcd, ed->dma); - - ahcd->ed_head = ahcd->ed_tails[PIPE_INTERRUPT]; - -#ifdef ADMHC_VERBOSE_DEBUG - admhc_dump_ed(ahcd, "ed intr", ahcd->ed_tails[PIPE_INTERRUPT], 1); - admhc_dump_ed(ahcd, "ed isoc", ahcd->ed_tails[PIPE_ISOCHRONOUS], 1); - admhc_dump_ed(ahcd, "ed ctrl", ahcd->ed_tails[PIPE_CONTROL], 1); - admhc_dump_ed(ahcd, "ed bulk", ahcd->ed_tails[PIPE_BULK], 1); -#endif - - return 0; - -err: - admhc_eds_cleanup(ahcd); - return -ENOMEM; -} - -/* init memory, and kick BIOS/SMM off */ - -static int admhc_init(struct admhcd *ahcd) -{ - struct usb_hcd *hcd = admhcd_to_hcd(ahcd); - int ret; - - admhc_disable(ahcd); - ahcd->regs = hcd->regs; - - /* Disable HC interrupts */ - admhc_intr_disable(ahcd, ADMHC_INTR_MIE); - - /* Read the number of ports unless overridden */ - if (ahcd->num_ports == 0) - ahcd->num_ports = admhc_read_rhdesc(ahcd) & ADMHC_RH_NUMP; - - ret = admhc_mem_init(ahcd); - if (ret) - goto err; - - /* init dummy endpoints */ - ret = admhc_eds_init(ahcd); - if (ret) - goto err; - - create_debug_files(ahcd); - - return 0; - -err: - admhc_stop(hcd); - return ret; -} - -/*-------------------------------------------------------------------------*/ - -/* Start an OHCI controller, set the BUS operational - * resets USB and controller - * enable interrupts - */ -static int admhc_run(struct admhcd *ahcd) -{ - u32 val; - int first = ahcd->fminterval == 0; - struct usb_hcd *hcd = admhcd_to_hcd(ahcd); - - admhc_disable(ahcd); - - /* boot firmware should have set this up (5.1.1.3.1) */ - if (first) { - val = admhc_readl(ahcd, &ahcd->regs->fminterval); - ahcd->fminterval = val & ADMHC_SFI_FI_MASK; - if (ahcd->fminterval != FI) - admhc_dbg(ahcd, "fminterval delta %d\n", - ahcd->fminterval - FI); - ahcd->fminterval |= - (FSLDP(ahcd->fminterval) << ADMHC_SFI_FSLDP_SHIFT); - /* also: power/overcurrent flags in rhdesc */ - } - -#if 0 /* TODO: not applicable */ - /* Reset USB nearly "by the book". RemoteWakeupConnected has - * to be checked in case boot firmware (BIOS/SMM/...) has set up - * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM). - * If the bus glue detected wakeup capability then it should - * already be enabled; if so we'll just enable it again. - */ - if ((ahcd->hc_control & OHCI_CTRL_RWC) != 0) - device_set_wakeup_capable(hcd->self.controller, 1); -#endif - - switch (ahcd->host_control & ADMHC_HC_BUSS) { - case ADMHC_BUSS_OPER: - val = 0; - break; - case ADMHC_BUSS_SUSPEND: - /* FALLTHROUGH ? */ - case ADMHC_BUSS_RESUME: - ahcd->host_control = ADMHC_BUSS_RESUME; - val = 10 /* msec wait */; - break; - /* case ADMHC_BUSS_RESET: */ - default: - ahcd->host_control = ADMHC_BUSS_RESET; - val = 50 /* msec wait */; - break; - } - admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control); - - /* flush the writes */ - admhc_writel_flush(ahcd); - - msleep(val); - val = admhc_read_rhdesc(ahcd); - if (!(val & ADMHC_RH_NPS)) { - /* power down each port */ - for (val = 0; val < ahcd->num_ports; val++) - admhc_write_portstatus(ahcd, val, ADMHC_PS_CPP); - } - /* flush those writes */ - admhc_writel_flush(ahcd); - - /* 2msec timelimit here means no irqs/preempt */ - spin_lock_irq(&ahcd->lock); - - admhc_writel(ahcd, ADMHC_CTRL_SR, &ahcd->regs->gencontrol); - val = 30; /* ... allow extra time */ - while ((admhc_readl(ahcd, &ahcd->regs->gencontrol) & ADMHC_CTRL_SR) != 0) { - if (--val == 0) { - spin_unlock_irq(&ahcd->lock); - admhc_err(ahcd, "USB HC reset timed out!\n"); - return -1; - } - udelay(1); - } - - /* enable HOST mode, before access any host specific register */ - admhc_writel(ahcd, ADMHC_CTRL_UHFE, &ahcd->regs->gencontrol); - - /* Tell the controller where the descriptor list is */ - admhc_writel(ahcd, (u32)ahcd->ed_head->dma, &ahcd->regs->hosthead); - - periodic_reinit(ahcd); - - /* use rhsc irqs after khubd is fully initialized */ - set_bit(HCD_FLAG_POLL_RH, &hcd->flags); - hcd->uses_new_polling = 1; - -#if 0 - /* wake on ConnectStatusChange, matching external hubs */ - admhc_writel(ahcd, RH_HS_DRWE, &ahcd->regs->roothub.status); -#else - /* FIXME roothub_write_status (ahcd, ADMHC_RH_DRWE); */ -#endif - - /* Choose the interrupts we care about now, others later on demand */ - admhc_intr_ack(ahcd, ~0); - admhc_intr_enable(ahcd, ADMHC_INTR_INIT); - - admhc_writel(ahcd, ADMHC_RH_NPS | ADMHC_RH_LPSC, &ahcd->regs->rhdesc); - - /* flush those writes */ - admhc_writel_flush(ahcd); - - /* start controller operations */ - ahcd->host_control = ADMHC_BUSS_OPER; - admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control); - - val = 20; - while ((admhc_readl(ahcd, &ahcd->regs->host_control) - & ADMHC_HC_BUSS) != ADMHC_BUSS_OPER) { - if (--val == 0) { - spin_unlock_irq(&ahcd->lock); - admhc_err(ahcd, "unable to setup operational mode!\n"); - return -1; - } - mdelay(1); - } - - hcd->state = HC_STATE_RUNNING; - - ahcd->next_statechange = jiffies + STATECHANGE_DELAY; - -#if 0 - /* FIXME: enabling DMA is always failed here for an unknown reason */ - admhc_dma_enable(ahcd); - - val = 200; - while ((admhc_readl(ahcd, &ahcd->regs->host_control) - & ADMHC_HC_DMAE) != ADMHC_HC_DMAE) { - if (--val == 0) { - spin_unlock_irq(&ahcd->lock); - admhc_err(ahcd, "unable to enable DMA!\n"); - admhc_dump(ahcd, 1); - return -1; - } - mdelay(1); - } - -#endif - - spin_unlock_irq(&ahcd->lock); - - mdelay(ADMHC_POTPGT); - - return 0; -} - -/*-------------------------------------------------------------------------*/ - -/* an interrupt happens */ - -static irqreturn_t admhc_irq(struct usb_hcd *hcd) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - struct admhcd_regs __iomem *regs = ahcd->regs; - u32 ints; - - ints = admhc_readl(ahcd, ®s->int_status); - if ((ints & ADMHC_INTR_INTA) == 0) { - /* no unmasked interrupt status is set */ - return IRQ_NONE; - } - - ints &= admhc_readl(ahcd, ®s->int_enable); - - if (ints & ADMHC_INTR_FATI) { - /* e.g. due to PCI Master/Target Abort */ - admhc_disable(ahcd); - admhc_err(ahcd, "Fatal Error, controller disabled\n"); - admhc_dump(ahcd, 1); - admhc_usb_reset(ahcd); - } - - if (ints & ADMHC_INTR_BABI) { - admhc_intr_disable(ahcd, ADMHC_INTR_BABI); - admhc_intr_ack(ahcd, ADMHC_INTR_BABI); - admhc_err(ahcd, "Babble Detected\n"); - } - - if (ints & ADMHC_INTR_INSM) { - admhc_vdbg(ahcd, "Root Hub Status Change\n"); - ahcd->next_statechange = jiffies + STATECHANGE_DELAY; - admhc_intr_ack(ahcd, ADMHC_INTR_RESI | ADMHC_INTR_INSM); - - /* NOTE: Vendors didn't always make the same implementation - * choices for RHSC. Many followed the spec; RHSC triggers - * on an edge, like setting and maybe clearing a port status - * change bit. With others it's level-triggered, active - * until khubd clears all the port status change bits. We'll - * always disable it here and rely on polling until khubd - * re-enables it. - */ - admhc_intr_disable(ahcd, ADMHC_INTR_INSM); - usb_hcd_poll_rh_status(hcd); - } else if (ints & ADMHC_INTR_RESI) { - /* For connect and disconnect events, we expect the controller - * to turn on RHSC along with RD. But for remote wakeup events - * this might not happen. - */ - admhc_vdbg(ahcd, "Resume Detect\n"); - admhc_intr_ack(ahcd, ADMHC_INTR_RESI); - set_bit(HCD_FLAG_POLL_RH, &hcd->flags); - if (ahcd->autostop) { - spin_lock(&ahcd->lock); - admhc_rh_resume(ahcd); - spin_unlock(&ahcd->lock); - } else - usb_hcd_resume_root_hub(hcd); - } - - if (ints & ADMHC_INTR_TDC) { - admhc_vdbg(ahcd, "Transfer Descriptor Complete\n"); - admhc_intr_ack(ahcd, ADMHC_INTR_TDC); - if (HC_IS_RUNNING(hcd->state)) - admhc_intr_disable(ahcd, ADMHC_INTR_TDC); - spin_lock(&ahcd->lock); - admhc_td_complete(ahcd); - spin_unlock(&ahcd->lock); - if (HC_IS_RUNNING(hcd->state)) - admhc_intr_enable(ahcd, ADMHC_INTR_TDC); - } - - if (ints & ADMHC_INTR_SO) { - /* could track INTR_SO to reduce available PCI/... bandwidth */ - admhc_vdbg(ahcd, "Schedule Overrun\n"); - } - -#if 1 - spin_lock(&ahcd->lock); - if (ahcd->ed_rm_list) - finish_unlinks(ahcd, admhc_frame_no(ahcd)); - - if ((ints & ADMHC_INTR_SOFI) != 0 && !ahcd->ed_rm_list - && HC_IS_RUNNING(hcd->state)) - admhc_intr_disable(ahcd, ADMHC_INTR_SOFI); - spin_unlock(&ahcd->lock); -#else - if (ints & ADMHC_INTR_SOFI) { - admhc_vdbg(ahcd, "Start Of Frame\n"); - spin_lock(&ahcd->lock); - - /* handle any pending ED removes */ - finish_unlinks(ahcd, admhc_frameno(ahcd)); - - /* leaving INTR_SOFI enabled when there's still unlinking - * to be done in the (next frame). - */ - if ((ahcd->ed_rm_list == NULL) || - HC_IS_RUNNING(hcd->state) == 0) - /* - * disable INTR_SOFI if there are no unlinking to be - * done (in the next frame) - */ - admhc_intr_disable(ahcd, ADMHC_INTR_SOFI); - - spin_unlock(&ahcd->lock); - } -#endif - - if (HC_IS_RUNNING(hcd->state)) { - admhc_intr_ack(ahcd, ints); - admhc_intr_enable(ahcd, ADMHC_INTR_MIE); - admhc_writel_flush(ahcd); - } - - return IRQ_HANDLED; -} - -/*-------------------------------------------------------------------------*/ - -static void admhc_stop(struct usb_hcd *hcd) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - - admhc_dump(ahcd, 1); - - flush_scheduled_work(); - - admhc_usb_reset(ahcd); - admhc_intr_disable(ahcd, ADMHC_INTR_MIE); - - free_irq(hcd->irq, hcd); - hcd->irq = -1; - - remove_debug_files(ahcd); - admhc_eds_cleanup(ahcd); - admhc_mem_cleanup(ahcd); -} - -/*-------------------------------------------------------------------------*/ - -#ifdef CONFIG_ADM5120 -#include "adm5120-drv.c" -#define PLATFORM_DRIVER usb_hcd_adm5120_driver -#endif - -#if !defined(PLATFORM_DRIVER) -#error "missing bus glue for admhc-hcd" -#endif - -#define DRIVER_INFO DRIVER_DESC " version " DRIVER_VERSION - -static int __init admhc_hcd_mod_init(void) -{ - int ret = 0; - - if (usb_disabled()) - return -ENODEV; - - pr_info("%s: " DRIVER_INFO "\n", hcd_name); - pr_info("%s: block sizes: ed %Zd td %Zd\n", hcd_name, - sizeof(struct ed), sizeof(struct td)); - set_bit(USB_OHCI_LOADED, &usb_hcds_loaded); - -#ifdef DEBUG - admhc_debug_root = debugfs_create_dir("admhc", usb_debug_root); - if (!admhc_debug_root) { - ret = -ENOENT; - goto error_debug; - } -#endif - -#ifdef PLATFORM_DRIVER - ret = platform_driver_register(&PLATFORM_DRIVER); - if (ret < 0) - goto error_platform; -#endif - - return ret; - -#ifdef PLATFORM_DRIVER - platform_driver_unregister(&PLATFORM_DRIVER); -error_platform: -#endif - -#ifdef DEBUG - debugfs_remove(admhc_debug_root); - admhc_debug_root = NULL; -error_debug: -#endif - clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); - return ret; -} -module_init(admhc_hcd_mod_init); - -static void __exit admhc_hcd_mod_exit(void) -{ - platform_driver_unregister(&PLATFORM_DRIVER); -#ifdef DEBUG - debugfs_remove(admhc_debug_root); -#endif - clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); -} -module_exit(admhc_hcd_mod_exit); - -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_INFO); -MODULE_VERSION(DRIVER_VERSION); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hub.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hub.c deleted file mode 100644 index 8cabaf902..000000000 --- a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-hub.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * ADM5120 HCD (Host Controller Driver) for USB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: drivers/usb/host/ohci-hub.c - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2004 David Brownell - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -/*-------------------------------------------------------------------------*/ - -/* - * ADM5120 Root Hub ... the nonsharable stuff - */ - -#define dbg_port(hc, label, num, value) \ - admhc_dbg(hc, \ - "%s port%d " \ - "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \ - label, num, value, \ - (value & ADMHC_PS_PRSC) ? " PRSC" : "", \ - (value & ADMHC_PS_OCIC) ? " OCIC" : "", \ - (value & ADMHC_PS_PSSC) ? " PSSC" : "", \ - (value & ADMHC_PS_PESC) ? " PESC" : "", \ - (value & ADMHC_PS_CSC) ? " CSC" : "", \ - \ - (value & ADMHC_PS_LSDA) ? " LSDA" : "", \ - (value & ADMHC_PS_PPS) ? " PPS" : "", \ - (value & ADMHC_PS_PRS) ? " PRS" : "", \ - (value & ADMHC_PS_POCI) ? " POCI" : "", \ - (value & ADMHC_PS_PSS) ? " PSS" : "", \ - \ - (value & ADMHC_PS_PES) ? " PES" : "", \ - (value & ADMHC_PS_CCS) ? " CCS" : "" \ - ); - -#define dbg_port_write(hc, label, num, value) \ - admhc_dbg(hc, \ - "%s port%d " \ - "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \ - label, num, value, \ - (value & ADMHC_PS_PRSC) ? " PRSC" : "", \ - (value & ADMHC_PS_OCIC) ? " OCIC" : "", \ - (value & ADMHC_PS_PSSC) ? " PSSC" : "", \ - (value & ADMHC_PS_PESC) ? " PESC" : "", \ - (value & ADMHC_PS_CSC) ? " CSC" : "", \ - \ - (value & ADMHC_PS_CPP) ? " CPP" : "", \ - (value & ADMHC_PS_SPP) ? " SPP" : "", \ - (value & ADMHC_PS_SPR) ? " SPR" : "", \ - (value & ADMHC_PS_CPS) ? " CPS" : "", \ - (value & ADMHC_PS_SPS) ? " SPS" : "", \ - \ - (value & ADMHC_PS_SPE) ? " SPE" : "", \ - (value & ADMHC_PS_CPE) ? " CPE" : "" \ - ); - -/*-------------------------------------------------------------------------*/ - -/* build "status change" packet (one or two bytes) from HC registers */ - -static int -admhc_hub_status_data(struct usb_hcd *hcd, char *buf) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - int i, changed = 0, length = 1; - int any_connected = 0; - unsigned long flags; - u32 status; - - spin_lock_irqsave(&ahcd->lock, flags); - if (!HCD_HW_ACCESSIBLE(hcd)) - goto done; - - /* init status */ - status = admhc_read_rhdesc(ahcd); - if (status & (ADMHC_RH_LPSC | ADMHC_RH_OCIC)) - buf[0] = changed = 1; - else - buf[0] = 0; - if (ahcd->num_ports > 7) { - buf[1] = 0; - length++; - } - - /* look at each port */ - for (i = 0; i < ahcd->num_ports; i++) { - status = admhc_read_portstatus(ahcd, i); - - /* can't autostop if ports are connected */ - any_connected |= (status & ADMHC_PS_CCS); - - if (status & (ADMHC_PS_CSC | ADMHC_PS_PESC | ADMHC_PS_PSSC - | ADMHC_PS_OCIC | ADMHC_PS_PRSC)) { - changed = 1; - if (i < 7) - buf[0] |= 1 << (i + 1); - else - buf[1] |= 1 << (i - 7); - } - } - - if (admhc_root_hub_state_changes(ahcd, changed, - any_connected)) - set_bit(HCD_FLAG_POLL_RH, &hcd->flags); - else - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); - -done: - spin_unlock_irqrestore(&ahcd->lock, flags); - - return changed ? length : 0; -} - -/*-------------------------------------------------------------------------*/ - -static int admhc_get_hub_descriptor(struct admhcd *ahcd, char *buf) -{ - struct usb_hub_descriptor *desc = (struct usb_hub_descriptor *)buf; - u32 rh = admhc_read_rhdesc(ahcd); - u16 temp; - - desc->bDescriptorType = USB_DT_HUB; /* Hub-descriptor */ - desc->bPwrOn2PwrGood = ADMHC_POTPGT/2; /* use default value */ - desc->bHubContrCurrent = 0x00; /* 0mA */ - - desc->bNbrPorts = ahcd->num_ports; - temp = 1 + (ahcd->num_ports / 8); - desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp; - - /* FIXME */ - temp = 0; - if (rh & ADMHC_RH_NPS) /* no power switching? */ - temp |= 0x0002; - if (rh & ADMHC_RH_PSM) /* per-port power switching? */ - temp |= 0x0001; - if (rh & ADMHC_RH_NOCP) /* no overcurrent reporting? */ - temp |= 0x0010; - else if (rh & ADMHC_RH_OCPM) /* per-port overcurrent reporting? */ - temp |= 0x0008; - desc->wHubCharacteristics = (__force __u16)cpu_to_hc16(ahcd, temp); - - /* ports removable, and usb 1.0 legacy PortPwrCtrlMask */ - desc->u.hs.DeviceRemovable[0] = 0; - desc->u.hs.DeviceRemovable[0] = ~0; - - return 0; -} - -static int admhc_get_hub_status(struct admhcd *ahcd, char *buf) -{ - struct usb_hub_status *hs = (struct usb_hub_status *)buf; - u32 t = admhc_read_rhdesc(ahcd); - u16 status, change; - - status = 0; - status |= (t & ADMHC_RH_LPS) ? HUB_STATUS_LOCAL_POWER : 0; - status |= (t & ADMHC_RH_OCI) ? HUB_STATUS_OVERCURRENT : 0; - - change = 0; - change |= (t & ADMHC_RH_LPSC) ? HUB_CHANGE_LOCAL_POWER : 0; - change |= (t & ADMHC_RH_OCIC) ? HUB_CHANGE_OVERCURRENT : 0; - - hs->wHubStatus = (__force __u16)cpu_to_hc16(ahcd, status); - hs->wHubChange = (__force __u16)cpu_to_hc16(ahcd, change); - - return 0; -} - -static int admhc_get_port_status(struct admhcd *ahcd, unsigned port, char *buf) -{ - struct usb_port_status *ps = (struct usb_port_status *)buf; - u32 t = admhc_read_portstatus(ahcd, port); - u16 status, change; - - status = 0; - status |= (t & ADMHC_PS_CCS) ? USB_PORT_STAT_CONNECTION : 0; - status |= (t & ADMHC_PS_PES) ? USB_PORT_STAT_ENABLE : 0; - status |= (t & ADMHC_PS_PSS) ? USB_PORT_STAT_SUSPEND : 0; - status |= (t & ADMHC_PS_POCI) ? USB_PORT_STAT_OVERCURRENT : 0; - status |= (t & ADMHC_PS_PRS) ? USB_PORT_STAT_RESET : 0; - status |= (t & ADMHC_PS_PPS) ? USB_PORT_STAT_POWER : 0; - status |= (t & ADMHC_PS_LSDA) ? USB_PORT_STAT_LOW_SPEED : 0; - - change = 0; - change |= (t & ADMHC_PS_CSC) ? USB_PORT_STAT_C_CONNECTION : 0; - change |= (t & ADMHC_PS_PESC) ? USB_PORT_STAT_C_ENABLE : 0; - change |= (t & ADMHC_PS_PSSC) ? USB_PORT_STAT_C_SUSPEND : 0; - change |= (t & ADMHC_PS_OCIC) ? USB_PORT_STAT_C_OVERCURRENT : 0; - change |= (t & ADMHC_PS_PRSC) ? USB_PORT_STAT_C_RESET : 0; - - ps->wPortStatus = (__force __u16)cpu_to_hc16(ahcd, status); - ps->wPortChange = (__force __u16)cpu_to_hc16(ahcd, change); - - return 0; -} - -/*-------------------------------------------------------------------------*/ - -#ifdef CONFIG_USB_OTG - -static int admhc_start_port_reset(struct usb_hcd *hcd, unsigned port) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - u32 status; - - if (!port) - return -EINVAL; - port--; - - /* start port reset before HNP protocol times out */ - status = admhc_read_portstatus(ahcd, port); - if (!(status & ADMHC_PS_CCS)) - return -ENODEV; - - /* khubd will finish the reset later */ - admhc_write_portstatus(ahcd, port, ADMHC_PS_PRS); - return 0; -} - -static void start_hnp(struct admhcd *ahcd); - -#else - -#define admhc_start_port_reset NULL - -#endif - -/*-------------------------------------------------------------------------*/ - - -/* See usb 7.1.7.5: root hubs must issue at least 50 msec reset signaling, - * not necessarily continuous ... to guard against resume signaling. - * The short timeout is safe for non-root hubs, and is backward-compatible - * with earlier Linux hosts. - */ -#ifdef CONFIG_USB_SUSPEND -#define PORT_RESET_MSEC 50 -#else -#define PORT_RESET_MSEC 10 -#endif - -/* this timer value might be vendor-specific ... */ -#define PORT_RESET_HW_MSEC 10 - -/* wrap-aware logic morphed from */ -#define tick_before(t1, t2) ((s16)(((s16)(t1)) - ((s16)(t2))) < 0) - -/* called from some task, normally khubd */ -static inline int admhc_port_reset(struct admhcd *ahcd, unsigned port) -{ - u32 t; - - admhc_vdbg(ahcd, "reset port%d\n", port); - t = admhc_read_portstatus(ahcd, port); - if (!(t & ADMHC_PS_CCS)) - return -ENODEV; - - admhc_write_portstatus(ahcd, port, ADMHC_PS_SPR); - mdelay(10); - admhc_write_portstatus(ahcd, port, (ADMHC_PS_SPE | ADMHC_PS_CSC)); - mdelay(100); - - return 0; -} - -static inline int admhc_port_enable(struct admhcd *ahcd, unsigned port) -{ - u32 t; - - admhc_vdbg(ahcd, "enable port%d\n", port); - t = admhc_read_portstatus(ahcd, port); - if (!(t & ADMHC_PS_CCS)) - return -ENODEV; - - admhc_write_portstatus(ahcd, port, ADMHC_PS_SPE); - - return 0; -} - -static inline int admhc_port_disable(struct admhcd *ahcd, unsigned port) -{ - u32 t; - - admhc_vdbg(ahcd, "disable port%d\n", port); - t = admhc_read_portstatus(ahcd, port); - if (!(t & ADMHC_PS_CCS)) - return -ENODEV; - - admhc_write_portstatus(ahcd, port, ADMHC_PS_CPE); - - return 0; -} - -static inline int admhc_port_write(struct admhcd *ahcd, unsigned port, - u32 val) -{ -#ifdef ADMHC_VERBOSE_DEBUG - dbg_port_write(ahcd, "write", port, val); -#endif - admhc_write_portstatus(ahcd, port, val); - - return 0; -} - -static int admhc_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, - u16 wIndex, char *buf, u16 wLength) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - int ports = ahcd->num_ports; - int ret = 0; - - if (unlikely(!HCD_HW_ACCESSIBLE(hcd))) - return -ESHUTDOWN; - - switch (typeReq) { - case ClearHubFeature: - switch (wValue) { - case C_HUB_OVER_CURRENT: -#if 0 /* FIXME */ - admhc_writel(ahcd, ADMHC_RH_OCIC, - &ahcd->regs->roothub.status); -#endif - case C_HUB_LOCAL_POWER: - break; - default: - goto error; - } - break; - case ClearPortFeature: - if (!wIndex || wIndex > ports) - goto error; - wIndex--; - - switch (wValue) { - case USB_PORT_FEAT_ENABLE: - ret = admhc_port_disable(ahcd, wIndex); - break; - case USB_PORT_FEAT_SUSPEND: - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CPS); - break; - case USB_PORT_FEAT_POWER: - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CPP); - break; - case USB_PORT_FEAT_C_CONNECTION: - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CSC); - break; - case USB_PORT_FEAT_C_ENABLE: - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PESC); - break; - case USB_PORT_FEAT_C_SUSPEND: - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PSSC); - break; - case USB_PORT_FEAT_C_OVER_CURRENT: - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_OCIC); - break; - case USB_PORT_FEAT_C_RESET: - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PRSC); - break; - default: - goto error; - } - break; - case GetHubDescriptor: - ret = admhc_get_hub_descriptor(ahcd, buf); - break; - case GetHubStatus: - ret = admhc_get_hub_status(ahcd, buf); - break; - case GetPortStatus: - if (!wIndex || wIndex > ports) - goto error; - wIndex--; - - ret = admhc_get_port_status(ahcd, wIndex, buf); - break; - case SetHubFeature: - switch (wValue) { - case C_HUB_OVER_CURRENT: - /* FIXME: this can be cleared, yes? */ - case C_HUB_LOCAL_POWER: - break; - default: - goto error; - } - break; - case SetPortFeature: - if (!wIndex || wIndex > ports) - goto error; - wIndex--; - - switch (wValue) { - case USB_PORT_FEAT_ENABLE: - ret = admhc_port_enable(ahcd, wIndex); - break; - case USB_PORT_FEAT_RESET: - ret = admhc_port_reset(ahcd, wIndex); - break; - case USB_PORT_FEAT_SUSPEND: -#ifdef CONFIG_USB_OTG - if (hcd->self.otg_port == (wIndex + 1) - && hcd->self.b_hnp_enable) - start_hnp(ahcd); - else -#endif - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_SPS); - break; - case USB_PORT_FEAT_POWER: - ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_SPP); - break; - default: - goto error; - } - break; - - default: -error: - /* "protocol stall" on error */ - ret = -EPIPE; - } - - return ret; -} - diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-mem.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-mem.c deleted file mode 100644 index 79fff70e2..000000000 --- a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-mem.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * ADM5120 HCD (Host Controller Driver) for USB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: drivers/usb/host/ohci-mem.c - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2002 David Brownell - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -/*-------------------------------------------------------------------------*/ - -/* - * OHCI deals with three types of memory: - * - data used only by the HCD ... kmalloc is fine - * - async and periodic schedules, shared by HC and HCD ... these - * need to use dma_pool or dma_alloc_coherent - * - driver buffers, read/written by HC ... the hcd glue or the - * device driver provides us with dma addresses - * - * There's also "register" data, which is memory mapped. - * No memory seen by this driver (or any HCD) may be paged out. - */ - -/*-------------------------------------------------------------------------*/ - -static void admhc_hcd_init(struct admhcd *ahcd) -{ - ahcd->next_statechange = jiffies; - spin_lock_init(&ahcd->lock); - INIT_LIST_HEAD(&ahcd->pending); -} - -/*-------------------------------------------------------------------------*/ - -static int admhc_mem_init(struct admhcd *ahcd) -{ - ahcd->td_cache = dma_pool_create("admhc_td", - admhcd_to_hcd(ahcd)->self.controller, - sizeof(struct td), - TD_ALIGN, /* byte alignment */ - 0 /* no page-crossing issues */ - ); - if (!ahcd->td_cache) - goto err; - - ahcd->ed_cache = dma_pool_create("admhc_ed", - admhcd_to_hcd(ahcd)->self.controller, - sizeof(struct ed), - ED_ALIGN, /* byte alignment */ - 0 /* no page-crossing issues */ - ); - if (!ahcd->ed_cache) - goto err_td_cache; - - return 0; - -err_td_cache: - dma_pool_destroy(ahcd->td_cache); - ahcd->td_cache = NULL; -err: - return -ENOMEM; -} - -static void admhc_mem_cleanup(struct admhcd *ahcd) -{ - if (ahcd->td_cache) { - dma_pool_destroy(ahcd->td_cache); - ahcd->td_cache = NULL; - } - - if (ahcd->ed_cache) { - dma_pool_destroy(ahcd->ed_cache); - ahcd->ed_cache = NULL; - } -} - -/*-------------------------------------------------------------------------*/ - -/* ahcd "done list" processing needs this mapping */ -static inline struct td *dma_to_td(struct admhcd *ahcd, dma_addr_t td_dma) -{ - struct td *td; - - td_dma &= TD_MASK; - td = ahcd->td_hash[TD_HASH_FUNC(td_dma)]; - while (td && td->td_dma != td_dma) - td = td->td_hash; - - return td; -} - -/* TDs ... */ -static struct td *td_alloc(struct admhcd *ahcd, gfp_t mem_flags) -{ - dma_addr_t dma; - struct td *td; - - td = dma_pool_alloc(ahcd->td_cache, mem_flags, &dma); - if (!td) - return NULL; - - /* in case ahcd fetches it, make it look dead */ - memset(td, 0, sizeof *td); - td->hwNextTD = cpu_to_hc32(ahcd, dma); - td->td_dma = dma; - /* hashed in td_fill */ - - return td; -} - -static void td_free(struct admhcd *ahcd, struct td *td) -{ - struct td **prev = &ahcd->td_hash[TD_HASH_FUNC(td->td_dma)]; - - while (*prev && *prev != td) - prev = &(*prev)->td_hash; - if (*prev) - *prev = td->td_hash; -#if 0 - /* TODO: remove */ - else if ((td->hwINFO & cpu_to_hc32(ahcd, TD_DONE)) != 0) - admhc_dbg(ahcd, "no hash for td %p\n", td); -#else - else if ((td->flags & TD_FLAG_DONE) != 0) - admhc_dbg(ahcd, "no hash for td %p\n", td); -#endif - dma_pool_free(ahcd->td_cache, td, td->td_dma); -} - -/*-------------------------------------------------------------------------*/ - -/* EDs ... */ -static struct ed *ed_alloc(struct admhcd *ahcd, gfp_t mem_flags) -{ - dma_addr_t dma; - struct ed *ed; - - ed = dma_pool_alloc(ahcd->ed_cache, mem_flags, &dma); - if (!ed) - return NULL; - - memset(ed, 0, sizeof(*ed)); - ed->dma = dma; - - INIT_LIST_HEAD(&ed->td_list); - INIT_LIST_HEAD(&ed->urb_list); - - return ed; -} - -static void ed_free(struct admhcd *ahcd, struct ed *ed) -{ - dma_pool_free(ahcd->ed_cache, ed, ed->dma); -} - -/*-------------------------------------------------------------------------*/ - -/* URB priv ... */ -static void urb_priv_free(struct admhcd *ahcd, struct urb_priv *urb_priv) -{ - int i; - - for (i = 0; i < urb_priv->td_cnt; i++) - if (urb_priv->td[i]) - td_free(ahcd, urb_priv->td[i]); - - list_del(&urb_priv->pending); - kfree(urb_priv); -} - -static struct urb_priv *urb_priv_alloc(struct admhcd *ahcd, int num_tds, - gfp_t mem_flags) -{ - struct urb_priv *priv; - - /* allocate the private part of the URB */ - priv = kzalloc(sizeof(*priv) + sizeof(struct td) * num_tds, mem_flags); - if (!priv) - goto err; - - /* allocate the TDs (deferring hash chain updates) */ - for (priv->td_cnt = 0; priv->td_cnt < num_tds; priv->td_cnt++) { - priv->td[priv->td_cnt] = td_alloc(ahcd, mem_flags); - if (priv->td[priv->td_cnt] == NULL) - goto err_free; - } - - INIT_LIST_HEAD(&priv->pending); - - return priv; - -err_free: - urb_priv_free(ahcd, priv); -err: - return NULL; -} diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-pm.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-pm.c deleted file mode 100644 index 7d7fc2438..000000000 --- a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-pm.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * ADM5120 HCD (Host Controller Driver) for USB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from fragments of the OHCI driver. - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2004 David Brownell - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#define OHCI_SCHED_ENABLES \ - (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) - -#ifdef CONFIG_PM -static int admhc_restart(struct admhcd *ahcd); - -static int admhc_rh_suspend(struct admhcd *ahcd, int autostop) -__releases(ahcd->lock) -__acquires(ahcd->lock) -{ - int status = 0; - - ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control); - switch (ahcd->hc_control & OHCI_CTRL_HCFS) { - case OHCI_USB_RESUME: - admhc_dbg(ahcd, "resume/suspend?\n"); - ahcd->hc_control &= ~OHCI_CTRL_HCFS; - ahcd->hc_control |= OHCI_USB_RESET; - admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); - (void) admhc_readl(ahcd, &ahcd->regs->control); - /* FALL THROUGH */ - case OHCI_USB_RESET: - status = -EBUSY; - admhc_dbg(ahcd, "needs reinit!\n"); - goto done; - case OHCI_USB_SUSPEND: - if (!ahcd->autostop) { - admhc_dbg(ahcd, "already suspended\n"); - goto done; - } - } - admhc_dbg(ahcd, "%s root hub\n", - autostop ? "auto-stop" : "suspend"); - - /* First stop any processing */ - if (!autostop && (ahcd->hc_control & OHCI_SCHED_ENABLES)) { - ahcd->hc_control &= ~OHCI_SCHED_ENABLES; - admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); - ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control); - admhc_writel(ahcd, OHCI_INTR_SF, &ahcd->regs->intrstatus); - - /* sched disables take effect on the next frame, - * then the last WDH could take 6+ msec - */ - admhc_dbg(ahcd, "stopping schedules ...\n"); - ahcd->autostop = 0; - spin_unlock_irq (&ahcd->lock); - msleep (8); - spin_lock_irq(&ahcd->lock); - } - dl_done_list (ahcd); - finish_unlinks (ahcd, admhc_frame_no(ahcd)); - - /* maybe resume can wake root hub */ - if (device_may_wakeup(&admhcd_to_hcd(ahcd)->self.root_hub->dev) || - autostop) - ahcd->hc_control |= OHCI_CTRL_RWE; - else { - admhc_writel(ahcd, OHCI_INTR_RHSC, &ahcd->regs->intrdisable); - ahcd->hc_control &= ~OHCI_CTRL_RWE; - } - - /* Suspend hub ... this is the "global (to this bus) suspend" mode, - * which doesn't imply ports will first be individually suspended. - */ - ahcd->hc_control &= ~OHCI_CTRL_HCFS; - ahcd->hc_control |= OHCI_USB_SUSPEND; - admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); - (void) admhc_readl(ahcd, &ahcd->regs->control); - - /* no resumes until devices finish suspending */ - if (!autostop) { - ahcd->next_statechange = jiffies + msecs_to_jiffies (5); - ahcd->autostop = 0; - } - -done: - return status; -} - -static inline struct ed *find_head(struct ed *ed) -{ - /* for bulk and control lists */ - while (ed->ed_prev) - ed = ed->ed_prev; - return ed; -} - -/* caller has locked the root hub */ -static int admhc_rh_resume(struct admhcd *ahcd) -__releases(ahcd->lock) -__acquires(ahcd->lock) -{ - struct usb_hcd *hcd = admhcd_to_hcd (ahcd); - u32 temp, enables; - int status = -EINPROGRESS; - int autostopped = ahcd->autostop; - - ahcd->autostop = 0; - ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control); - - if (ahcd->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { - /* this can happen after resuming a swsusp snapshot */ - if (hcd->state == HC_STATE_RESUMING) { - admhc_dbg(ahcd, "BIOS/SMM active, control %03x\n", - ahcd->hc_control); - status = -EBUSY; - /* this happens when pmcore resumes HC then root */ - } else { - admhc_dbg(ahcd, "duplicate resume\n"); - status = 0; - } - } else switch (ahcd->hc_control & OHCI_CTRL_HCFS) { - case OHCI_USB_SUSPEND: - ahcd->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES); - ahcd->hc_control |= OHCI_USB_RESUME; - admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); - (void) admhc_readl(ahcd, &ahcd->regs->control); - admhc_dbg(ahcd, "%s root hub\n", - autostopped ? "auto-start" : "resume"); - break; - case OHCI_USB_RESUME: - /* HCFS changes sometime after INTR_RD */ - admhc_dbg(ahcd, "%swakeup root hub\n", - autostopped ? "auto-" : ""); - break; - case OHCI_USB_OPER: - /* this can happen after resuming a swsusp snapshot */ - admhc_dbg(ahcd, "snapshot resume? reinit\n"); - status = -EBUSY; - break; - default: /* RESET, we lost power */ - admhc_dbg(ahcd, "lost power\n"); - status = -EBUSY; - } - if (status == -EBUSY) { - if (!autostopped) { - spin_unlock_irq (&ahcd->lock); - (void) ahcd_init (ahcd); - status = admhc_restart (ahcd); - spin_lock_irq(&ahcd->lock); - } - return status; - } - if (status != -EINPROGRESS) - return status; - if (autostopped) - goto skip_resume; - spin_unlock_irq (&ahcd->lock); - - /* Some controllers (lucent erratum) need extra-long delays */ - msleep (20 /* usb 11.5.1.10 */ + 12 /* 32 msec counter */ + 1); - - temp = admhc_readl(ahcd, &ahcd->regs->control); - temp &= OHCI_CTRL_HCFS; - if (temp != OHCI_USB_RESUME) { - admhc_err (ahcd, "controller won't resume\n"); - spin_lock_irq(&ahcd->lock); - return -EBUSY; - } - - /* disable old schedule state, reinit from scratch */ - admhc_writel(ahcd, 0, &ahcd->regs->ed_controlhead); - admhc_writel(ahcd, 0, &ahcd->regs->ed_controlcurrent); - admhc_writel(ahcd, 0, &ahcd->regs->ed_bulkhead); - admhc_writel(ahcd, 0, &ahcd->regs->ed_bulkcurrent); - admhc_writel(ahcd, 0, &ahcd->regs->ed_periodcurrent); - admhc_writel(ahcd, (u32) ahcd->hcca_dma, &ahcd->ahcd->regs->hcca); - - /* Sometimes PCI D3 suspend trashes frame timings ... */ - periodic_reinit(ahcd); - - /* the following code is executed with ahcd->lock held and - * irqs disabled if and only if autostopped is true - */ - -skip_resume: - /* interrupts might have been disabled */ - admhc_writel(ahcd, OHCI_INTR_INIT, &ahcd->regs->int_enable); - if (ahcd->ed_rm_list) - admhc_writel(ahcd, OHCI_INTR_SF, &ahcd->regs->int_enable); - - /* Then re-enable operations */ - admhc_writel(ahcd, OHCI_USB_OPER, &ahcd->regs->control); - (void) admhc_readl(ahcd, &ahcd->regs->control); - if (!autostopped) - msleep (3); - - temp = ahcd->hc_control; - temp &= OHCI_CTRL_RWC; - temp |= OHCI_CONTROL_INIT | OHCI_USB_OPER; - ahcd->hc_control = temp; - admhc_writel(ahcd, temp, &ahcd->regs->control); - (void) admhc_readl(ahcd, &ahcd->regs->control); - - /* TRSMRCY */ - if (!autostopped) { - msleep (10); - spin_lock_irq(&ahcd->lock); - } - /* now ahcd->lock is always held and irqs are always disabled */ - - /* keep it alive for more than ~5x suspend + resume costs */ - ahcd->next_statechange = jiffies + STATECHANGE_DELAY; - - /* maybe turn schedules back on */ - enables = 0; - temp = 0; - if (!ahcd->ed_rm_list) { - if (ahcd->ed_controltail) { - admhc_writel(ahcd, - find_head (ahcd->ed_controltail)->dma, - &ahcd->regs->ed_controlhead); - enables |= OHCI_CTRL_CLE; - temp |= OHCI_CLF; - } - if (ahcd->ed_bulktail) { - admhc_writel(ahcd, find_head (ahcd->ed_bulktail)->dma, - &ahcd->regs->ed_bulkhead); - enables |= OHCI_CTRL_BLE; - temp |= OHCI_BLF; - } - } - if (hcd->self.bandwidth_isoc_reqs || hcd->self.bandwidth_int_reqs) - enables |= OHCI_CTRL_PLE|OHCI_CTRL_IE; - if (enables) { - admhc_dbg(ahcd, "restarting schedules ... %08x\n", enables); - ahcd->hc_control |= enables; - admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control); - if (temp) - admhc_writel(ahcd, temp, &ahcd->regs->cmdstatus); - (void) admhc_readl(ahcd, &ahcd->regs->control); - } - - return 0; -} - -static int admhc_bus_suspend(struct usb_hcd *hcd) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - int rc; - - spin_lock_irq(&ahcd->lock); - - if (unlikely(!HCD_HW_ACCESSIBLE(hcd))) - rc = -ESHUTDOWN; - else - rc = admhc_rh_suspend(ahcd, 0); - spin_unlock_irq(&ahcd->lock); - return rc; -} - -static int admhc_bus_resume(struct usb_hcd *hcd) -{ - struct admhcd *ahcd = hcd_to_admhcd(hcd); - int rc; - - if (time_before(jiffies, ahcd->next_statechange)) - msleep(5); - - spin_lock_irq(&ahcd->lock); - - if (unlikely(!HCD_HW_ACCESSIBLE(hcd))) - rc = -ESHUTDOWN; - else - rc = admhc_rh_resume(ahcd); - spin_unlock_irq(&ahcd->lock); - - /* poll until we know a device is connected or we autostop */ - if (rc == 0) - usb_hcd_poll_rh_status(hcd); - return rc; -} - -/* Carry out polling-, autostop-, and autoresume-related state changes */ -static int admhc_root_hub_state_changes(struct admhcd *ahcd, int changed, - int any_connected) -{ - int poll_rh = 1; - - switch (ahcd->hc_control & OHCI_CTRL_HCFS) { - - case OHCI_USB_OPER: - /* keep on polling until we know a device is connected - * and RHSC is enabled */ - if (!ahcd->autostop) { - if (any_connected || - !device_may_wakeup(&admhcd_to_hcd(ahcd) - ->self.root_hub->dev)) { - if (admhc_readl(ahcd, &ahcd->regs->int_enable) & - OHCI_INTR_RHSC) - poll_rh = 0; - } else { - ahcd->autostop = 1; - ahcd->next_statechange = jiffies + HZ; - } - - /* if no devices have been attached for one second, autostop */ - } else { - if (changed || any_connected) { - ahcd->autostop = 0; - ahcd->next_statechange = jiffies + - STATECHANGE_DELAY; - } else if (time_after_eq(jiffies, - ahcd->next_statechange) - && !ahcd->ed_rm_list - && !(ahcd->hc_control & - OHCI_SCHED_ENABLES)) { - ahcd_rh_suspend(ahcd, 1); - } - } - break; - - /* if there is a port change, autostart or ask to be resumed */ - case OHCI_USB_SUSPEND: - case OHCI_USB_RESUME: - if (changed) { - if (ahcd->autostop) - admhc_rh_resume(ahcd); - else - usb_hcd_resume_root_hub(admhcd_to_hcd(ahcd)); - } else { - /* everything is idle, no need for polling */ - poll_rh = 0; - } - break; - } - return poll_rh; -} - -/*-------------------------------------------------------------------------*/ - -/* must not be called from interrupt context */ -static int admhc_restart(struct admhcd *ahcd) -{ - int temp; - int i; - struct urb_priv *priv; - - /* mark any devices gone, so they do nothing till khubd disconnects. - * recycle any "live" eds/tds (and urbs) right away. - * later, khubd disconnect processing will recycle the other state, - * (either as disconnect/reconnect, or maybe someday as a reset). - */ - spin_lock_irq(&ahcd->lock); - admhc_disable(ahcd); - usb_root_hub_lost_power(admhcd_to_hcd(ahcd)->self.root_hub); - if (!list_empty(&ahcd->pending)) - admhc_dbg(ahcd, "abort schedule...\n"); - list_for_each_entry(priv, &ahcd->pending, pending) { - struct urb *urb = priv->td[0]->urb; - struct ed *ed = priv->ed; - - switch (ed->state) { - case ED_OPER: - ed->state = ED_UNLINK; - ed->hwINFO |= cpu_to_hc32(ahcd, ED_DEQUEUE); - ed_deschedule (ahcd, ed); - - ed->ed_next = ahcd->ed_rm_list; - ed->ed_prev = NULL; - ahcd->ed_rm_list = ed; - /* FALLTHROUGH */ - case ED_UNLINK: - break; - default: - admhc_dbg(ahcd, "bogus ed %p state %d\n", - ed, ed->state); - } - - if (!urb->unlinked) - urb->unlinked = -ESHUTDOWN; - } - finish_unlinks(ahcd, 0); - spin_unlock_irq(&ahcd->lock); - - /* paranoia, in case that didn't work: */ - - /* empty the interrupt branches */ - for (i = 0; i < NUM_INTS; i++) ahcd->load[i] = 0; - for (i = 0; i < NUM_INTS; i++) ahcd->hcca->int_table[i] = 0; - - /* no EDs to remove */ - ahcd->ed_rm_list = NULL; - - /* empty control and bulk lists */ - ahcd->ed_controltail = NULL; - ahcd->ed_bulktail = NULL; - - if ((temp = admhc_run(ahcd)) < 0) { - admhc_err(ahcd, "can't restart, %d\n", temp); - return temp; - } else { - /* here we "know" root ports should always stay powered, - * and that if we try to turn them back on the root hub - * will respond to CSC processing. - */ - i = ahcd->num_ports; - while (i--) - admhc_writel(ahcd, RH_PS_PSS, - &ahcd->regs->portstatus[i]); - admhc_dbg(ahcd, "restart complete\n"); - } - return 0; -} - -#else /* CONFIG_PM */ - -static inline int admhc_rh_resume(struct admhcd *ahcd) -{ - return 0; -} - -/* Carry out polling-related state changes. - * autostop isn't used when CONFIG_PM is turned off. - */ -static int admhc_root_hub_state_changes(struct admhcd *ahcd, int changed, - int any_connected) -{ - /* If INSM is enabled, don't poll */ - if (admhc_readl(ahcd, &ahcd->regs->int_enable) & ADMHC_INTR_INSM) - return 0; - - /* If no status changes are pending, enable status-change interrupts */ - if (!changed) { - admhc_intr_enable(ahcd, ADMHC_INTR_INSM); - return 0; - } - - return 1; -} - -#endif /* CONFIG_PM */ - diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-q.c b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-q.c deleted file mode 100644 index cd9c8920a..000000000 --- a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120-q.c +++ /dev/null @@ -1,964 +0,0 @@ -/* - * ADM5120 HCD (Host Controller Driver) for USB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: drivers/usb/host/ohci-q.c - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2002 David Brownell - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include - -/*-------------------------------------------------------------------------*/ - -/* - * URB goes back to driver, and isn't reissued. - * It's completely gone from HC data structures. - * PRECONDITION: ahcd lock held, irqs blocked. - */ -static void -finish_urb(struct admhcd *ahcd, struct urb *urb, int status) -__releases(ahcd->lock) -__acquires(ahcd->lock) -{ - urb_priv_free(ahcd, urb->hcpriv); - - if (likely(status == -EINPROGRESS)) - status = 0; - - switch (usb_pipetype(urb->pipe)) { - case PIPE_ISOCHRONOUS: - admhcd_to_hcd(ahcd)->self.bandwidth_isoc_reqs--; - break; - case PIPE_INTERRUPT: - admhcd_to_hcd(ahcd)->self.bandwidth_int_reqs--; - break; - } - -#ifdef ADMHC_VERBOSE_DEBUG - urb_print(ahcd, urb, "RET", usb_pipeout(urb->pipe), status); -#endif - - /* urb->complete() can reenter this HCD */ - usb_hcd_unlink_urb_from_ep(admhcd_to_hcd(ahcd), urb); - spin_unlock(&ahcd->lock); - usb_hcd_giveback_urb(admhcd_to_hcd(ahcd), urb, status); - spin_lock(&ahcd->lock); -} - - -/*-------------------------------------------------------------------------* - * ED handling functions - *-------------------------------------------------------------------------*/ - -#if 0 /* FIXME */ -/* search for the right schedule branch to use for a periodic ed. - * does some load balancing; returns the branch, or negative errno. - */ -static int balance(struct admhcd *ahcd, int interval, int load) -{ - int i, branch = -ENOSPC; - - /* iso periods can be huge; iso tds specify frame numbers */ - if (interval > NUM_INTS) - interval = NUM_INTS; - - /* search for the least loaded schedule branch of that period - * that has enough bandwidth left unreserved. - */ - for (i = 0; i < interval ; i++) { - if (branch < 0 || ahcd->load[branch] > ahcd->load[i]) { - int j; - - /* usb 1.1 says 90% of one frame */ - for (j = i; j < NUM_INTS; j += interval) { - if ((ahcd->load[j] + load) > 900) - break; - } - if (j < NUM_INTS) - continue; - branch = i; - } - } - return branch; -} -#endif - -/*-------------------------------------------------------------------------*/ - -#if 0 /* FIXME */ -/* both iso and interrupt requests have periods; this routine puts them - * into the schedule tree in the apppropriate place. most iso devices use - * 1msec periods, but that's not required. - */ -static void periodic_link(struct admhcd *ahcd, struct ed *ed) -{ - unsigned i; - - admhc_vdbg(ahcd, "link %sed %p branch %d [%dus.], interval %d\n", - (ed->hwINFO & cpu_to_hc32(ahcd, ED_ISO)) ? "iso " : "", - ed, ed->branch, ed->load, ed->interval); - - for (i = ed->branch; i < NUM_INTS; i += ed->interval) { - struct ed **prev = &ahcd->periodic[i]; - __hc32 *prev_p = &ahcd->hcca->int_table[i]; - struct ed *here = *prev; - - /* sorting each branch by period (slow before fast) - * lets us share the faster parts of the tree. - * (plus maybe: put interrupt eds before iso) - */ - while (here && ed != here) { - if (ed->interval > here->interval) - break; - prev = &here->ed_next; - prev_p = &here->hwNextED; - here = *prev; - } - if (ed != here) { - ed->ed_next = here; - if (here) - ed->hwNextED = *prev_p; - wmb(); - *prev = ed; - *prev_p = cpu_to_hc32(ahcd, ed->dma); - wmb(); - } - ahcd->load[i] += ed->load; - } - admhcd_to_hcd(ahcd)->self.bandwidth_allocated += ed->load / ed->interval; -} -#endif - -/* link an ed into the HC chain */ - -static int ed_schedule(struct admhcd *ahcd, struct ed *ed) -{ - struct ed *old_tail; - - if (admhcd_to_hcd(ahcd)->state == HC_STATE_QUIESCING) - return -EAGAIN; - - ed->state = ED_OPER; - - old_tail = ahcd->ed_tails[ed->type]; - - ed->ed_next = old_tail->ed_next; - if (ed->ed_next) { - ed->ed_next->ed_prev = ed; - ed->hwNextED = cpu_to_hc32(ahcd, ed->ed_next->dma); - } - ed->ed_prev = old_tail; - - old_tail->ed_next = ed; - old_tail->hwNextED = cpu_to_hc32(ahcd, ed->dma); - - ahcd->ed_tails[ed->type] = ed; - - admhc_dma_enable(ahcd); - - return 0; -} - -/*-------------------------------------------------------------------------*/ - -#if 0 /* FIXME */ -/* scan the periodic table to find and unlink this ED */ -static void periodic_unlink(struct admhcd *ahcd, struct ed *ed) -{ - int i; - - for (i = ed->branch; i < NUM_INTS; i += ed->interval) { - struct ed *temp; - struct ed **prev = &ahcd->periodic[i]; - __hc32 *prev_p = &ahcd->hcca->int_table[i]; - - while (*prev && (temp = *prev) != ed) { - prev_p = &temp->hwNextED; - prev = &temp->ed_next; - } - if (*prev) { - *prev_p = ed->hwNextED; - *prev = ed->ed_next; - } - ahcd->load[i] -= ed->load; - } - - admhcd_to_hcd(ahcd)->self.bandwidth_allocated -= ed->load / ed->interval; - admhc_vdbg(ahcd, "unlink %sed %p branch %d [%dus.], interval %d\n", - (ed->hwINFO & cpu_to_hc32(ahcd, ED_ISO)) ? "iso " : "", - ed, ed->branch, ed->load, ed->interval); -} -#endif - -/* unlink an ed from the HC chain. - * just the link to the ed is unlinked. - * the link from the ed still points to another operational ed or 0 - * so the HC can eventually finish the processing of the unlinked ed - * (assuming it already started that, which needn't be true). - * - * ED_UNLINK is a transient state: the HC may still see this ED, but soon - * it won't. ED_SKIP means the HC will finish its current transaction, - * but won't start anything new. The TD queue may still grow; device - * drivers don't know about this HCD-internal state. - * - * When the HC can't see the ED, something changes ED_UNLINK to one of: - * - * - ED_OPER: when there's any request queued, the ED gets rescheduled - * immediately. HC should be working on them. - * - * - ED_IDLE: when there's no TD queue. there's no reason for the HC - * to care about this ED; safe to disable the endpoint. - * - * When finish_unlinks() runs later, after SOF interrupt, it will often - * complete one or more URB unlinks before making that state change. - */ -static void ed_deschedule(struct admhcd *ahcd, struct ed *ed) -{ - -#ifdef ADMHC_VERBOSE_DEBUG - admhc_dump_ed(ahcd, "ED-DESCHED", ed, 1); -#endif - - ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP); - wmb(); - ed->state = ED_UNLINK; - - /* remove this ED from the HC list */ - ed->ed_prev->hwNextED = ed->hwNextED; - - /* and remove it from our list also */ - ed->ed_prev->ed_next = ed->ed_next; - - if (ed->ed_next) - ed->ed_next->ed_prev = ed->ed_prev; - - if (ahcd->ed_tails[ed->type] == ed) - ahcd->ed_tails[ed->type] = ed->ed_prev; -} - -/*-------------------------------------------------------------------------*/ - -static struct ed *ed_create(struct admhcd *ahcd, unsigned int type, u32 info) -{ - struct ed *ed; - struct td *td; - - ed = ed_alloc(ahcd, GFP_ATOMIC); - if (!ed) - goto err; - - /* dummy td; end of td list for this ed */ - td = td_alloc(ahcd, GFP_ATOMIC); - if (!td) - goto err_free_ed; - - switch (type) { - case PIPE_INTERRUPT: - info |= ED_INT; - break; - case PIPE_ISOCHRONOUS: - info |= ED_ISO; - break; - } - - ed->dummy = td; - ed->state = ED_IDLE; - ed->type = type; - - ed->hwINFO = cpu_to_hc32(ahcd, info); - ed->hwTailP = cpu_to_hc32(ahcd, td->td_dma); - ed->hwHeadP = ed->hwTailP; /* ED_C, ED_H zeroed */ - - return ed; - -err_free_ed: - ed_free(ahcd, ed); -err: - return NULL; -} - -/* get and maybe (re)init an endpoint. init _should_ be done only as part - * of enumeration, usb_set_configuration() or usb_set_interface(). - */ -static struct ed *ed_get(struct admhcd *ahcd, struct usb_host_endpoint *ep, - struct usb_device *udev, unsigned int pipe, int interval) -{ - struct ed *ed; - unsigned long flags; - - spin_lock_irqsave(&ahcd->lock, flags); - - ed = ep->hcpriv; - if (!ed) { - u32 info; - - /* FIXME: usbcore changes dev->devnum before SET_ADDRESS - * succeeds ... otherwise we wouldn't need "pipe". - */ - info = usb_pipedevice(pipe); - info |= (ep->desc.bEndpointAddress & ~USB_DIR_IN) << ED_EN_SHIFT; - info |= le16_to_cpu(ep->desc.wMaxPacketSize) << ED_MPS_SHIFT; - if (udev->speed == USB_SPEED_FULL) - info |= ED_SPEED_FULL; - - ed = ed_create(ahcd, usb_pipetype(pipe), info); - if (ed) - ep->hcpriv = ed; - } - - spin_unlock_irqrestore(&ahcd->lock, flags); - - return ed; -} - -/*-------------------------------------------------------------------------*/ - -/* request unlinking of an endpoint from an operational HC. - * put the ep on the rm_list - * real work is done at the next start frame (SOFI) hardware interrupt - * caller guarantees HCD is running, so hardware access is safe, - * and that ed->state is ED_OPER - */ -static void start_ed_unlink(struct admhcd *ahcd, struct ed *ed) -{ - -#ifdef ADMHC_VERBOSE_DEBUG - admhc_dump_ed(ahcd, "ED-UNLINK", ed, 1); -#endif - - ed->hwINFO |= cpu_to_hc32(ahcd, ED_DEQUEUE); - ed_deschedule(ahcd, ed); - - /* add this ED into the remove list */ - ed->ed_rm_next = ahcd->ed_rm_list; - ahcd->ed_rm_list = ed; - - /* enable SOF interrupt */ - admhc_intr_ack(ahcd, ADMHC_INTR_SOFI); - admhc_intr_enable(ahcd, ADMHC_INTR_SOFI); - /* flush those writes */ - admhc_writel_flush(ahcd); - - /* SOF interrupt might get delayed; record the frame counter value that - * indicates when the HC isn't looking at it, so concurrent unlinks - * behave. frame_no wraps every 2^16 msec, and changes right before - * SOF is triggered. - */ - ed->tick = admhc_frame_no(ahcd) + 1; -} - -/*-------------------------------------------------------------------------* - * TD handling functions - *-------------------------------------------------------------------------*/ - -/* enqueue next TD for this URB (OHCI spec 5.2.8.2) */ - -static void -td_fill(struct admhcd *ahcd, u32 info, dma_addr_t data, int len, - struct urb *urb, int index) -{ - struct td *td, *td_pt; - struct urb_priv *urb_priv = urb->hcpriv; - int hash; - u32 cbl = 0; - -#if 1 - if (index == (urb_priv->td_cnt - 1) && - ((urb->transfer_flags & URB_NO_INTERRUPT) == 0)) - cbl |= TD_IE; -#else - if (index == (urb_priv->td_cnt - 1)) - cbl |= TD_IE; -#endif - - /* use this td as the next dummy */ - td_pt = urb_priv->td[index]; - - /* fill the old dummy TD */ - td = urb_priv->td[index] = urb_priv->ed->dummy; - urb_priv->ed->dummy = td_pt; - - td->ed = urb_priv->ed; - td->next_dl_td = NULL; - td->index = index; - td->urb = urb; - td->data_dma = data; - if (!len) - data = 0; - - if (data) - cbl |= (len & TD_BL_MASK); - - info |= TD_OWN; - - /* setup hardware specific fields */ - td->hwINFO = cpu_to_hc32(ahcd, info); - td->hwDBP = cpu_to_hc32(ahcd, data); - td->hwCBL = cpu_to_hc32(ahcd, cbl); - td->hwNextTD = cpu_to_hc32(ahcd, td_pt->td_dma); - - /* append to queue */ - list_add_tail(&td->td_list, &td->ed->td_list); - - /* hash it for later reverse mapping */ - hash = TD_HASH_FUNC(td->td_dma); - td->td_hash = ahcd->td_hash[hash]; - ahcd->td_hash[hash] = td; - - /* HC might read the TD (or cachelines) right away ... */ - wmb(); - td->ed->hwTailP = td->hwNextTD; -} - -/*-------------------------------------------------------------------------*/ - -/* Prepare all TDs of a transfer, and queue them onto the ED. - * Caller guarantees HC is active. - * Usually the ED is already on the schedule, so TDs might be - * processed as soon as they're queued. - */ -static void td_submit_urb(struct admhcd *ahcd, struct urb *urb) -{ - struct urb_priv *urb_priv = urb->hcpriv; - dma_addr_t data; - int data_len = urb->transfer_buffer_length; - int cnt = 0; - u32 info = 0; - int is_out = usb_pipeout(urb->pipe); - u32 toggle = 0; - - /* OHCI handles the bulk/interrupt data toggles itself. We just - * use the device toggle bits for resetting, and rely on the fact - * that resetting toggle is meaningless if the endpoint is active. - */ - - if (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), is_out)) { - toggle = TD_T_CARRY; - } else { - toggle = TD_T_DATA0; - usb_settoggle(urb->dev, usb_pipeendpoint (urb->pipe), - is_out, 1); - } - - urb_priv->td_idx = 0; - list_add(&urb_priv->pending, &ahcd->pending); - - if (data_len) - data = urb->transfer_dma; - else - data = 0; - - /* NOTE: TD_CC is set so we can tell which TDs the HC processed by - * using TD_CC_GET, as well as by seeing them on the done list. - * (CC = NotAccessed ... 0x0F, or 0x0E in PSWs for ISO.) - */ - switch (urb_priv->ed->type) { - case PIPE_INTERRUPT: - info = is_out - ? TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_OUT - : TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_IN; - - /* setup service interval and starting frame number */ - info |= (urb->start_frame & TD_FN_MASK); - info |= (urb->interval & TD_ISI_MASK) << TD_ISI_SHIFT; - - td_fill(ahcd, info, data, data_len, urb, cnt); - cnt++; - - admhcd_to_hcd(ahcd)->self.bandwidth_int_reqs++; - break; - - case PIPE_BULK: - info = is_out - ? TD_SCC_NOTACCESSED | TD_DP_OUT - : TD_SCC_NOTACCESSED | TD_DP_IN; - - /* TDs _could_ transfer up to 8K each */ - while (data_len > TD_DATALEN_MAX) { - td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle), - data, TD_DATALEN_MAX, urb, cnt); - data += TD_DATALEN_MAX; - data_len -= TD_DATALEN_MAX; - cnt++; - } - - td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle), data, - data_len, urb, cnt); - cnt++; - - if ((urb->transfer_flags & URB_ZERO_PACKET) - && (cnt < urb_priv->td_cnt)) { - td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle), - 0, 0, urb, cnt); - cnt++; - } - break; - - /* control manages DATA0/DATA1 toggle per-request; SETUP resets it, - * any DATA phase works normally, and the STATUS ack is special. - */ - case PIPE_CONTROL: - /* fill a TD for the setup */ - info = TD_SCC_NOTACCESSED | TD_DP_SETUP | TD_T_DATA0; - td_fill(ahcd, info, urb->setup_dma, 8, urb, cnt++); - - if (data_len > 0) { - /* fill a TD for the data */ - info = TD_SCC_NOTACCESSED | TD_T_DATA1; - info |= is_out ? TD_DP_OUT : TD_DP_IN; - /* NOTE: mishandles transfers >8K, some >4K */ - td_fill(ahcd, info, data, data_len, urb, cnt++); - } - - /* fill a TD for the ACK */ - info = (is_out || data_len == 0) - ? TD_SCC_NOTACCESSED | TD_DP_IN | TD_T_DATA1 - : TD_SCC_NOTACCESSED | TD_DP_OUT | TD_T_DATA1; - td_fill(ahcd, info, data, 0, urb, cnt++); - - break; - - /* ISO has no retransmit, so no toggle; - * Each TD could handle multiple consecutive frames (interval 1); - * we could often reduce the number of TDs here. - */ - case PIPE_ISOCHRONOUS: - info = is_out - ? TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_OUT - : TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_IN; - - for (cnt = 0; cnt < urb->number_of_packets; cnt++) { - int frame = urb->start_frame; - - frame += cnt * urb->interval; - frame &= TD_FN_MASK; - td_fill(ahcd, info | frame, - data + urb->iso_frame_desc[cnt].offset, - urb->iso_frame_desc[cnt].length, urb, cnt); - } - admhcd_to_hcd(ahcd)->self.bandwidth_isoc_reqs++; - break; - } - - if (urb_priv->td_cnt != cnt) - admhc_err(ahcd, "bad number of tds created for urb %p\n", urb); -} - -/*-------------------------------------------------------------------------* - * Done List handling functions - *-------------------------------------------------------------------------*/ - -/* calculate transfer length/status and update the urb */ -static int td_done(struct admhcd *ahcd, struct urb *urb, struct td *td) -{ - struct urb_priv *urb_priv = urb->hcpriv; - u32 info; - u32 bl; - u32 tdDBP; - int type = usb_pipetype(urb->pipe); - int cc; - int status = -EINPROGRESS; - - info = hc32_to_cpup(ahcd, &td->hwINFO); - tdDBP = hc32_to_cpup(ahcd, &td->hwDBP); - bl = TD_BL_GET(hc32_to_cpup(ahcd, &td->hwCBL)); - cc = TD_CC_GET(info); - - /* ISO ... drivers see per-TD length/status */ - if (type == PIPE_ISOCHRONOUS) { - /* TODO */ - int dlen = 0; - - /* NOTE: assumes FC in tdINFO == 0, and that - * only the first of 0..MAXPSW psws is used. - */ - if (info & TD_CC) /* hc didn't touch? */ - return status; - - if (usb_pipeout(urb->pipe)) - dlen = urb->iso_frame_desc[td->index].length; - else { - /* short reads are always OK for ISO */ - if (cc == TD_CC_DATAUNDERRUN) - cc = TD_CC_NOERROR; - dlen = tdDBP - td->data_dma + bl; - } - - urb->actual_length += dlen; - urb->iso_frame_desc[td->index].actual_length = dlen; - urb->iso_frame_desc[td->index].status = cc_to_error[cc]; - - if (cc != TD_CC_NOERROR) - admhc_vdbg(ahcd, - "urb %p iso td %p (%d) len %d cc %d\n", - urb, td, 1 + td->index, dlen, cc); - - /* BULK, INT, CONTROL ... drivers see aggregate length/status, - * except that "setup" bytes aren't counted and "short" transfers - * might not be reported as errors. - */ - } else { - /* update packet status if needed (short is normally ok) */ - if (cc == TD_CC_DATAUNDERRUN - && !(urb->transfer_flags & URB_SHORT_NOT_OK)) - cc = TD_CC_NOERROR; - - if (cc != TD_CC_NOERROR && cc < TD_CC_HCD0) - status = cc_to_error[cc]; - - - /* count all non-empty packets except control SETUP packet */ - if ((type != PIPE_CONTROL || td->index != 0) && tdDBP != 0) - urb->actual_length += tdDBP - td->data_dma + bl; - - if (cc != TD_CC_NOERROR && cc < TD_CC_HCD0) - admhc_vdbg(ahcd, - "urb %p td %p (%d) cc %d, len=%d/%d\n", - urb, td, td->index, cc, - urb->actual_length, - urb->transfer_buffer_length); - } - - list_del(&td->td_list); - urb_priv->td_idx++; - - return status; -} - -/*-------------------------------------------------------------------------*/ - -static void ed_halted(struct admhcd *ahcd, struct td *td, int cc) -{ - struct urb *urb = td->urb; - struct urb_priv *urb_priv = urb->hcpriv; - struct ed *ed = td->ed; - struct list_head *tmp = td->td_list.next; - __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C); - - admhc_dump_ed(ahcd, "ed halted", td->ed, 1); - /* clear ed halt; this is the td that caused it, but keep it inactive - * until its urb->complete() has a chance to clean up. - */ - ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP); - wmb(); - ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H); - - /* Get rid of all later tds from this urb. We don't have - * to be careful: no errors and nothing was transferred. - * Also patch the ed so it looks as if those tds completed normally. - */ - while (tmp != &ed->td_list) { - struct td *next; - - next = list_entry(tmp, struct td, td_list); - tmp = next->td_list.next; - - if (next->urb != urb) - break; - - /* NOTE: if multi-td control DATA segments get supported, - * this urb had one of them, this td wasn't the last td - * in that segment (TD_R clear), this ed halted because - * of a short read, _and_ URB_SHORT_NOT_OK is clear ... - * then we need to leave the control STATUS packet queued - * and clear ED_SKIP. - */ - list_del(&next->td_list); - urb_priv->td_cnt++; - ed->hwHeadP = next->hwNextTD | toggle; - } - - /* help for troubleshooting: report anything that - * looks odd ... that doesn't include protocol stalls - * (or maybe some other things) - */ - switch (cc) { - case TD_CC_DATAUNDERRUN: - if ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0) - break; - /* fallthrough */ - case TD_CC_STALL: - if (usb_pipecontrol(urb->pipe)) - break; - /* fallthrough */ - default: - admhc_dbg(ahcd, - "urb %p path %s ep%d%s %08x cc %d --> status %d\n", - urb, urb->dev->devpath, - usb_pipeendpoint (urb->pipe), - usb_pipein(urb->pipe) ? "in" : "out", - hc32_to_cpu(ahcd, td->hwINFO), - cc, cc_to_error[cc]); - } -} - -/*-------------------------------------------------------------------------*/ - -/* there are some urbs/eds to unlink; called in_irq(), with HCD locked */ -static void -finish_unlinks(struct admhcd *ahcd, u16 tick) -{ - struct ed *ed, **last; - -rescan_all: - for (last = &ahcd->ed_rm_list, ed = *last; ed != NULL; ed = *last) { - struct list_head *entry, *tmp; - int completed, modified; - __hc32 *prev; - - /* only take off EDs that the HC isn't using, accounting for - * frame counter wraps and EDs with partially retired TDs - */ - if (likely(HC_IS_RUNNING(admhcd_to_hcd(ahcd)->state))) { - if (tick_before(tick, ed->tick)) { -skip_ed: - last = &ed->ed_rm_next; - continue; - } -#if 0 - if (!list_empty(&ed->td_list)) { - struct td *td; - u32 head; - - td = list_entry(ed->td_list.next, struct td, - td_list); - head = hc32_to_cpu(ahcd, ed->hwHeadP) & - TD_MASK; - - /* INTR_WDH may need to clean up first */ - if (td->td_dma != head) - goto skip_ed; - } -#endif - } - - /* reentrancy: if we drop the schedule lock, someone might - * have modified this list. normally it's just prepending - * entries (which we'd ignore), but paranoia won't hurt. - */ - *last = ed->ed_rm_next; - ed->ed_rm_next = NULL; - modified = 0; - - /* unlink urbs as requested, but rescan the list after - * we call a completion since it might have unlinked - * another (earlier) urb - * - * When we get here, the HC doesn't see this ed. But it - * must not be rescheduled until all completed URBs have - * been given back to the driver. - */ -rescan_this: - completed = 0; - prev = &ed->hwHeadP; - list_for_each_safe(entry, tmp, &ed->td_list) { - struct td *td; - struct urb *urb; - struct urb_priv *urb_priv; - __hc32 savebits; - u32 tdINFO; - int status; - - td = list_entry(entry, struct td, td_list); - urb = td->urb; - urb_priv = td->urb->hcpriv; - - if (!urb->unlinked) { - prev = &td->hwNextTD; - continue; - } - - if ((urb_priv) == NULL) - continue; - - /* patch pointer hc uses */ - savebits = *prev & ~cpu_to_hc32(ahcd, TD_MASK); - *prev = td->hwNextTD | savebits; - /* If this was unlinked, the TD may not have been - * retired ... so manually save dhe data toggle. - * The controller ignores the value we save for - * control and ISO endpoints. - */ - tdINFO = hc32_to_cpup(ahcd, &td->hwINFO); - if ((tdINFO & TD_T) == TD_T_DATA0) - ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_C); - else if ((tdINFO & TD_T) == TD_T_DATA1) - ed->hwHeadP |= cpu_to_hc32(ahcd, ED_C); - - /* HC may have partly processed this TD */ -#ifdef ADMHC_VERBOSE_DEBUG - urb_print(ahcd, urb, "PARTIAL", 0); -#endif - status = td_done(ahcd, urb, td); - - /* if URB is done, clean up */ - if (urb_priv->td_idx == urb_priv->td_cnt) { - modified = completed = 1; - finish_urb(ahcd, urb, status); - } - } - if (completed && !list_empty(&ed->td_list)) - goto rescan_this; - - /* ED's now officially unlinked, hc doesn't see */ - ed->state = ED_IDLE; - ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H); - ed->hwNextED = 0; - wmb(); - ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP | ED_DEQUEUE); - - /* but if there's work queued, reschedule */ - if (!list_empty(&ed->td_list)) { - if (HC_IS_RUNNING(admhcd_to_hcd(ahcd)->state)) - ed_schedule(ahcd, ed); - } - - if (modified) - goto rescan_all; - } -} - -/*-------------------------------------------------------------------------*/ -/* - * Process normal completions (error or success) and clean the schedules. - * - * This is the main path for handing urbs back to drivers. The only other - * normal path is finish_unlinks(), which unlinks URBs using ed_rm_list, - * instead of scanning the (re-reversed) donelist as this does. - */ - -static void ed_unhalt(struct admhcd *ahcd, struct ed *ed, struct urb *urb) -{ - struct list_head *entry, *tmp; - __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C); - -#ifdef ADMHC_VERBOSE_DEBUG - admhc_dump_ed(ahcd, "UNHALT", ed, 0); -#endif - /* clear ed halt; this is the td that caused it, but keep it inactive - * until its urb->complete() has a chance to clean up. - */ - ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP); - wmb(); - ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H); - - list_for_each_safe(entry, tmp, &ed->td_list) { - struct td *td = list_entry(entry, struct td, td_list); - __hc32 info; - - if (td->urb != urb) - break; - - info = td->hwINFO; - info &= ~cpu_to_hc32(ahcd, TD_CC | TD_OWN); - td->hwINFO = info; - - ed->hwHeadP = td->hwNextTD | toggle; - wmb(); - } - -} - -static void ed_intr_refill(struct admhcd *ahcd, struct ed *ed) -{ - __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C); - - ed->hwHeadP = ed->hwTailP | toggle; -} - - -static inline int is_ed_halted(struct admhcd *ahcd, struct ed *ed) -{ - return ((hc32_to_cpup(ahcd, &ed->hwHeadP) & ED_H) == ED_H); -} - -static inline int is_td_halted(struct admhcd *ahcd, struct ed *ed, - struct td *td) -{ - return ((hc32_to_cpup(ahcd, &ed->hwHeadP) & TD_MASK) == - (hc32_to_cpup(ahcd, &td->hwNextTD) & TD_MASK)); -} - -static void ed_update(struct admhcd *ahcd, struct ed *ed) -{ - struct list_head *entry, *tmp; - -#ifdef ADMHC_VERBOSE_DEBUG - admhc_dump_ed(ahcd, "UPDATE", ed, 1); -#endif - - list_for_each_safe(entry, tmp, &ed->td_list) { - struct td *td = list_entry(entry, struct td, td_list); - struct urb *urb = td->urb; - struct urb_priv *urb_priv = urb->hcpriv; - int status; - - if (hc32_to_cpup(ahcd, &td->hwINFO) & TD_OWN) - break; - - /* update URB's length and status from TD */ - status = td_done(ahcd, urb, td); - if (is_ed_halted(ahcd, ed) && is_td_halted(ahcd, ed, td)) - ed_unhalt(ahcd, ed, urb); - - if (ed->type == PIPE_INTERRUPT) - ed_intr_refill(ahcd, ed); - - /* If all this urb's TDs are done, call complete() */ - if (urb_priv->td_idx == urb_priv->td_cnt) - finish_urb(ahcd, urb, status); - - /* clean schedule: unlink EDs that are no longer busy */ - if (list_empty(&ed->td_list)) { - if (ed->state == ED_OPER) - start_ed_unlink(ahcd, ed); - - /* ... reenabling halted EDs only after fault cleanup */ - } else if ((ed->hwINFO & cpu_to_hc32(ahcd, - ED_SKIP | ED_DEQUEUE)) - == cpu_to_hc32(ahcd, ED_SKIP)) { - td = list_entry(ed->td_list.next, struct td, td_list); -#if 0 - if (!(td->hwINFO & cpu_to_hc32(ahcd, TD_DONE))) { - ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP); - /* ... hc may need waking-up */ - switch (ed->type) { - case PIPE_CONTROL: - admhc_writel(ahcd, OHCI_CLF, - &ahcd->regs->cmdstatus); - break; - case PIPE_BULK: - admhc_writel(ahcd, OHCI_BLF, - &ahcd->regs->cmdstatus); - break; - } - } -#else - if ((td->hwINFO & cpu_to_hc32(ahcd, TD_OWN))) - ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP); -#endif - } - - } -} - -/* there are some tds completed; called in_irq(), with HCD locked */ -static void admhc_td_complete(struct admhcd *ahcd) -{ - struct ed *ed; - - for (ed = ahcd->ed_head; ed; ed = ed->ed_next) { - if (ed->state != ED_OPER) - continue; - - ed_update(ahcd, ed); - } -} diff --git a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120.h b/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120.h deleted file mode 100644 index e47aac8e7..000000000 --- a/target/linux/adm5120/files-3.18/drivers/usb/host/adm5120.h +++ /dev/null @@ -1,755 +0,0 @@ -/* - * ADM5120 HCD (Host Controller Driver) for USB - * - * Copyright (C) 2007-2008 Gabor Juhos - * - * This file was derived from: drivers/usb/host/ohci.h - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2002 David Brownell - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -/* - * __hc32 and __hc16 are "Host Controller" types, they may be equivalent to - * __leXX (normally) or __beXX (given OHCI_BIG_ENDIAN), depending on the - * host controller implementation. - */ -typedef __u32 __bitwise __hc32; -typedef __u16 __bitwise __hc16; - -/* - * OHCI Endpoint Descriptor (ED) ... holds TD queue - * See OHCI spec, section 4.2 - * - * This is a "Queue Head" for those transfers, which is why - * both EHCI and UHCI call similar structures a "QH". - */ - -#define TD_DATALEN_MAX 4096 - -#define ED_ALIGN 16 -#define ED_MASK ((u32)~(ED_ALIGN-1)) /* strip hw status in low addr bits */ - -struct ed { - /* first fields are hardware-specified */ - __hc32 hwINFO; /* endpoint config bitmap */ - /* info bits defined by hcd */ -#define ED_DEQUEUE (1 << 27) - /* info bits defined by the hardware */ -#define ED_MPS_SHIFT 16 -#define ED_MPS_MASK ((1 << 11)-1) -#define ED_MPS_GET(x) (((x) >> ED_MPS_SHIFT) & ED_MPS_MASK) -#define ED_ISO (1 << 15) /* isochronous endpoint */ -#define ED_SKIP (1 << 14) -#define ED_SPEED_FULL (1 << 13) /* fullspeed device */ -#define ED_INT (1 << 11) /* interrupt endpoint */ -#define ED_EN_SHIFT 7 /* endpoint shift */ -#define ED_EN_MASK ((1 << 4)-1) /* endpoint mask */ -#define ED_EN_GET(x) (((x) >> ED_EN_SHIFT) & ED_EN_MASK) -#define ED_FA_MASK ((1 << 7)-1) /* function address mask */ -#define ED_FA_GET(x) ((x) & ED_FA_MASK) - __hc32 hwTailP; /* tail of TD list */ - __hc32 hwHeadP; /* head of TD list (hc r/w) */ -#define ED_C (0x02) /* toggle carry */ -#define ED_H (0x01) /* halted */ - __hc32 hwNextED; /* next ED in list */ - - /* rest are purely for the driver's use */ - dma_addr_t dma; /* addr of ED */ - struct td *dummy; /* next TD to activate */ - - struct list_head urb_list; /* list of our URBs */ - - /* host's view of schedule */ - struct ed *ed_next; /* on schedule list */ - struct ed *ed_prev; /* for non-interrupt EDs */ - struct ed *ed_rm_next; /* on rm list */ - struct list_head td_list; /* "shadow list" of our TDs */ - - /* create --> IDLE --> OPER --> ... --> IDLE --> destroy - * usually: OPER --> UNLINK --> (IDLE | OPER) --> ... - */ - u8 state; /* ED_{IDLE,UNLINK,OPER} */ -#define ED_IDLE 0x00 /* NOT linked to HC */ -#define ED_UNLINK 0x01 /* being unlinked from hc */ -#define ED_OPER 0x02 /* IS linked to hc */ - - u8 type; /* PIPE_{BULK,...} */ - - /* periodic scheduling params (for intr and iso) */ - u8 branch; - u16 interval; - u16 load; - u16 last_iso; /* iso only */ - - /* HC may see EDs on rm_list until next frame (frame_no == tick) */ - u16 tick; -} __attribute__ ((aligned(ED_ALIGN))); - -/* - * OHCI Transfer Descriptor (TD) ... one per transfer segment - * See OHCI spec, sections 4.3.1 (general = control/bulk/interrupt) - * and 4.3.2 (iso) - */ - -#define TD_ALIGN 32 -#define TD_MASK ((u32)~(TD_ALIGN-1)) /* strip hw status in low addr bits */ - -struct td { - /* first fields are hardware-specified */ - __hc32 hwINFO; /* transfer info bitmask */ - - /* hwINFO bits */ -#define TD_OWN (1 << 31) /* owner of the descriptor */ -#define TD_CC_SHIFT 27 /* condition code */ -#define TD_CC_MASK 0xf -#define TD_CC (TD_CC_MASK << TD_CC_SHIFT) -#define TD_CC_GET(x) (((x) >> TD_CC_SHIFT) & TD_CC_MASK) - -#define TD_EC_SHIFT 25 /* error count */ -#define TD_EC_MASK 0x3 -#define TD_EC (TD_EC_MASK << TD_EC_SHIFT) -#define TD_EC_GET(x) ((x >> TD_EC_SHIFT) & TD_EC_MASK) -#define TD_T_SHIFT 23 /* data toggle state */ -#define TD_T_MASK 0x3 -#define TD_T (TD_T_MASK << TD_T_SHIFT) -#define TD_T_DATA0 (0x2 << TD_T_SHIFT) /* DATA0 */ -#define TD_T_DATA1 (0x3 << TD_T_SHIFT) /* DATA1 */ -#define TD_T_CARRY (0x0 << TD_T_SHIFT) /* uses ED_C */ -#define TD_T_GET(x) (((x) >> TD_T_SHIFT) & TD_T_MASK) -#define TD_DP_SHIFT 21 /* direction/pid */ -#define TD_DP_MASK 0x3 -#define TD_DP (TD_DP_MASK << TD_DP_SHIFT) -#define TD_DP_GET (((x) >> TD_DP_SHIFT) & TD_DP_MASK) -#define TD_DP_SETUP (0x0 << TD_DP_SHIFT) /* SETUP pid */ -#define TD_DP_OUT (0x1 << TD_DP_SHIFT) /* OUT pid */ -#define TD_DP_IN (0x2 << TD_DP_SHIFT) /* IN pid */ -#define TD_ISI_SHIFT 8 /* Interrupt Service Interval */ -#define TD_ISI_MASK 0x3f -#define TD_ISI_GET(x) (((x) >> TD_ISI_SHIFT) & TD_ISI_MASK) -#define TD_FN_MASK 0x3f /* frame number */ -#define TD_FN_GET(x) ((x) & TD_FN_MASK) - - __hc32 hwDBP; /* Data Buffer Pointer (or 0) */ - __hc32 hwCBL; /* Controller/Buffer Length */ - - /* hwCBL bits */ -#define TD_BL_MASK 0xffff /* buffer length */ -#define TD_BL_GET(x) ((x) & TD_BL_MASK) -#define TD_IE (1 << 16) /* interrupt enable */ - __hc32 hwNextTD; /* Next TD Pointer */ - - /* rest are purely for the driver's use */ - __u8 index; - struct ed *ed; - struct td *td_hash; /* dma-->td hashtable */ - struct td *next_dl_td; - struct urb *urb; - - dma_addr_t td_dma; /* addr of this TD */ - dma_addr_t data_dma; /* addr of data it points to */ - - struct list_head td_list; /* "shadow list", TDs on same ED */ - - u32 flags; -#define TD_FLAG_DONE (1 << 17) /* retired to done list */ -#define TD_FLAG_ISO (1 << 16) /* copy of ED_ISO */ -} __attribute__ ((aligned(TD_ALIGN))); /* c/b/i need 16; only iso needs 32 */ - -/* - * Hardware transfer status codes -- CC from td->hwINFO - */ -#define TD_CC_NOERROR 0x00 -#define TD_CC_CRC 0x01 -#define TD_CC_BITSTUFFING 0x02 -#define TD_CC_DATATOGGLEM 0x03 -#define TD_CC_STALL 0x04 -#define TD_CC_DEVNOTRESP 0x05 -#define TD_CC_PIDCHECKFAIL 0x06 -#define TD_CC_UNEXPECTEDPID 0x07 -#define TD_CC_DATAOVERRUN 0x08 -#define TD_CC_DATAUNDERRUN 0x09 - /* 0x0A, 0x0B reserved for hardware */ -#define TD_CC_BUFFEROVERRUN 0x0C -#define TD_CC_BUFFERUNDERRUN 0x0D - /* 0x0E, 0x0F reserved for HCD */ -#define TD_CC_HCD0 0x0E -#define TD_CC_NOTACCESSED 0x0F - -/* - * preshifted status codes - */ -#define TD_SCC_NOTACCESSED (TD_CC_NOTACCESSED << TD_CC_SHIFT) - - -/* map OHCI TD status codes (CC) to errno values */ -static const int cc_to_error[16] = { - /* No Error */ 0, - /* CRC Error */ -EILSEQ, - /* Bit Stuff */ -EPROTO, - /* Data Togg */ -EILSEQ, - /* Stall */ -EPIPE, - /* DevNotResp */ -ETIME, - /* PIDCheck */ -EPROTO, - /* UnExpPID */ -EPROTO, - /* DataOver */ -EOVERFLOW, - /* DataUnder */ -EREMOTEIO, - /* (for hw) */ -EIO, - /* (for hw) */ -EIO, - /* BufferOver */ -ECOMM, - /* BuffUnder */ -ENOSR, - /* (for HCD) */ -EALREADY, - /* (for HCD) */ -EALREADY -}; - -#define NUM_INTS 32 - -/* - * This is the structure of the OHCI controller's memory mapped I/O region. - * You must use readl() and writel() (in ) to access these fields!! - * Layout is in section 7 (and appendix B) of the spec. - */ -struct admhcd_regs { - __hc32 gencontrol; /* General Control */ - __hc32 int_status; /* Interrupt Status */ - __hc32 int_enable; /* Interrupt Enable */ - __hc32 reserved00; - __hc32 host_control; /* Host General Control */ - __hc32 reserved01; - __hc32 fminterval; /* Frame Interval */ - __hc32 fmnumber; /* Frame Number */ - __hc32 reserved02; - __hc32 reserved03; - __hc32 reserved04; - __hc32 reserved05; - __hc32 reserved06; - __hc32 reserved07; - __hc32 reserved08; - __hc32 reserved09; - __hc32 reserved10; - __hc32 reserved11; - __hc32 reserved12; - __hc32 reserved13; - __hc32 reserved14; - __hc32 reserved15; - __hc32 reserved16; - __hc32 reserved17; - __hc32 reserved18; - __hc32 reserved19; - __hc32 reserved20; - __hc32 reserved21; - __hc32 lsthresh; /* Low Speed Threshold */ - __hc32 rhdesc; /* Root Hub Descriptor */ -#define MAX_ROOT_PORTS 2 - __hc32 portstatus[MAX_ROOT_PORTS]; /* Port Status */ - __hc32 hosthead; /* Host Descriptor Head */ -} __attribute__ ((aligned(32))); - -/* - * General Control register bits - */ -#define ADMHC_CTRL_UHFE (1 << 0) /* USB Host Function Enable */ -#define ADMHC_CTRL_SIR (1 << 1) /* Software Interrupt request */ -#define ADMHC_CTRL_DMAA (1 << 2) /* DMA Arbitration Control */ -#define ADMHC_CTRL_SR (1 << 3) /* Software Reset */ - -/* - * Host General Control register bits - */ -#define ADMHC_HC_BUSS 0x3 /* USB bus state */ -#define ADMHC_BUSS_RESET 0x0 -#define ADMHC_BUSS_RESUME 0x1 -#define ADMHC_BUSS_OPER 0x2 -#define ADMHC_BUSS_SUSPEND 0x3 -#define ADMHC_HC_DMAE (1 << 2) /* DMA enable */ - -/* - * Interrupt Status/Enable register bits - */ -#define ADMHC_INTR_SOFI (1 << 4) /* start of frame */ -#define ADMHC_INTR_RESI (1 << 5) /* resume detected */ -#define ADMHC_INTR_6 (1 << 6) /* unknown */ -#define ADMHC_INTR_7 (1 << 7) /* unknown */ -#define ADMHC_INTR_BABI (1 << 8) /* babble detected */ -#define ADMHC_INTR_INSM (1 << 9) /* root hub status change */ -#define ADMHC_INTR_SO (1 << 10) /* scheduling overrun */ -#define ADMHC_INTR_FNO (1 << 11) /* frame number overflow */ -#define ADMHC_INTR_TDC (1 << 20) /* transfer descriptor completed */ -#define ADMHC_INTR_SWI (1 << 29) /* software interrupt */ -#define ADMHC_INTR_FATI (1 << 30) /* fatal error */ -#define ADMHC_INTR_INTA (1 << 31) /* interrupt active */ - -#define ADMHC_INTR_MIE (1 << 31) /* master interrupt enable */ - -/* - * SOF Frame Interval register bits - */ -#define ADMHC_SFI_FI_MASK ((1 << 14)-1) /* Frame Interval value */ -#define ADMHC_SFI_FSLDP_SHIFT 16 -#define ADMHC_SFI_FSLDP_MASK ((1 << 15)-1) -#define ADMHC_SFI_FIT (1 << 31) /* Frame Interval Toggle */ - -/* - * SOF Frame Number register bits - */ -#define ADMHC_SFN_FN_MASK ((1 << 16)-1) /* Frame Number Mask */ -#define ADMHC_SFN_FR_SHIFT 16 /* Frame Remaining Shift */ -#define ADMHC_SFN_FR_MASK ((1 << 14)-1) /* Frame Remaining Mask */ -#define ADMHC_SFN_FRT (1 << 31) /* Frame Remaining Toggle */ - -/* - * Root Hub Descriptor register bits - */ -#define ADMHC_RH_NUMP 0xff /* number of ports */ -#define ADMHC_RH_PSM (1 << 8) /* power switching mode */ -#define ADMHC_RH_NPS (1 << 9) /* no power switching */ -#define ADMHC_RH_OCPM (1 << 10) /* over current protection mode */ -#define ADMHC_RH_NOCP (1 << 11) /* no over current protection */ -#define ADMHC_RH_PPCM (0xff << 16) /* port power control */ - -#define ADMHC_RH_LPS (1 << 24) /* local power switch */ -#define ADMHC_RH_OCI (1 << 25) /* over current indicator */ - -/* status change bits */ -#define ADMHC_RH_LPSC (1 << 26) /* local power switch change */ -#define ADMHC_RH_OCIC (1 << 27) /* over current indicator change */ - -#define ADMHC_RH_DRWE (1 << 28) /* device remote wakeup enable */ -#define ADMHC_RH_CRWE (1 << 29) /* clear remote wakeup enable */ - -#define ADMHC_RH_CGP (1 << 24) /* clear global power */ -#define ADMHC_RH_SGP (1 << 26) /* set global power */ - -/* - * Port Status register bits - */ -#define ADMHC_PS_CCS (1 << 0) /* current connect status */ -#define ADMHC_PS_PES (1 << 1) /* port enable status */ -#define ADMHC_PS_PSS (1 << 2) /* port suspend status */ -#define ADMHC_PS_POCI (1 << 3) /* port over current indicator */ -#define ADMHC_PS_PRS (1 << 4) /* port reset status */ -#define ADMHC_PS_PPS (1 << 8) /* port power status */ -#define ADMHC_PS_LSDA (1 << 9) /* low speed device attached */ - -/* status change bits */ -#define ADMHC_PS_CSC (1 << 16) /* connect status change */ -#define ADMHC_PS_PESC (1 << 17) /* port enable status change */ -#define ADMHC_PS_PSSC (1 << 18) /* port suspend status change */ -#define ADMHC_PS_OCIC (1 << 19) /* over current indicator change */ -#define ADMHC_PS_PRSC (1 << 20) /* port reset status change */ - -/* port feature bits */ -#define ADMHC_PS_CPE (1 << 0) /* clear port enable */ -#define ADMHC_PS_SPE (1 << 1) /* set port enable */ -#define ADMHC_PS_SPS (1 << 2) /* set port suspend */ -#define ADMHC_PS_CPS (1 << 3) /* clear suspend status */ -#define ADMHC_PS_SPR (1 << 4) /* set port reset */ -#define ADMHC_PS_SPP (1 << 8) /* set port power */ -#define ADMHC_PS_CPP (1 << 9) /* clear port power */ - -/* - * the POTPGT value is not defined in the ADMHC, so define a dummy value - */ -#define ADMHC_POTPGT 2 /* in ms */ - -/* hcd-private per-urb state */ -struct urb_priv { - struct ed *ed; - struct list_head pending; /* URBs on the same ED */ - - u32 td_cnt; /* # tds in this request */ - u32 td_idx; /* index of the current td */ - struct td *td[0]; /* all TDs in this request */ -}; - -#define TD_HASH_SIZE 64 /* power'o'two */ -/* sizeof (struct td) ~= 64 == 2^6 ... */ -#define TD_HASH_FUNC(td_dma) ((td_dma ^ (td_dma >> 6)) % TD_HASH_SIZE) - -/* - * This is the full ADMHCD controller description - * - * Note how the "proper" USB information is just - * a subset of what the full implementation needs. (Linus) - */ - -struct admhcd { - spinlock_t lock; - - /* - * I/O memory used to communicate with the HC (dma-consistent) - */ - struct admhcd_regs __iomem *regs; - - /* - * hcd adds to schedule for a live hc any time, but removals finish - * only at the start of the next frame. - */ - - struct ed *ed_head; - struct ed *ed_tails[4]; - - struct ed *ed_rm_list; /* to be removed */ - - struct ed *periodic[NUM_INTS]; /* shadow int_table */ - -#if 0 /* TODO: remove? */ - /* - * OTG controllers and transceivers need software interaction; - * other external transceivers should be software-transparent - */ - struct otg_transceiver *transceiver; - void (*start_hnp)(struct admhcd *ahcd); -#endif - - /* - * memory management for queue data structures - */ - struct dma_pool *td_cache; - struct dma_pool *ed_cache; - struct td *td_hash[TD_HASH_SIZE]; - struct list_head pending; - - /* - * driver state - */ - int num_ports; - int load[NUM_INTS]; - u32 host_control; /* copy of the host_control reg */ - unsigned long next_statechange; /* suspend/resume */ - u32 fminterval; /* saved register */ - unsigned autostop:1; /* rh auto stopping/stopped */ - - unsigned long flags; /* for HC bugs */ -#define OHCI_QUIRK_AMD756 0x01 /* erratum #4 */ -#define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */ -#define OHCI_QUIRK_INITRESET 0x04 /* SiS, OPTi, ... */ -#define OHCI_QUIRK_BE_DESC 0x08 /* BE descriptors */ -#define OHCI_QUIRK_BE_MMIO 0x10 /* BE registers */ -#define OHCI_QUIRK_ZFMICRO 0x20 /* Compaq ZFMicro chipset*/ - /* there are also chip quirks/bugs in init logic */ - -#ifdef DEBUG - struct dentry *debug_dir; - struct dentry *debug_async; - struct dentry *debug_periodic; - struct dentry *debug_registers; -#endif -}; - -/* convert between an hcd pointer and the corresponding ahcd_hcd */ -static inline struct admhcd *hcd_to_admhcd(struct usb_hcd *hcd) -{ - return (struct admhcd *)(hcd->hcd_priv); -} -static inline struct usb_hcd *admhcd_to_hcd(const struct admhcd *ahcd) -{ - return container_of((void *)ahcd, struct usb_hcd, hcd_priv); -} - -/*-------------------------------------------------------------------------*/ - -#ifndef DEBUG -#define STUB_DEBUG_FILES -#endif /* DEBUG */ - -#ifdef DEBUG -# define admhc_dbg(ahcd, fmt, args...) \ - printk(KERN_DEBUG "adm5120-hcd: " fmt, ## args) -#else -# define admhc_dbg(ahcd, fmt, args...) do { } while (0) -#endif - -#define admhc_err(ahcd, fmt, args...) \ - printk(KERN_ERR "adm5120-hcd: " fmt, ## args) -#define admhc_info(ahcd, fmt, args...) \ - printk(KERN_INFO "adm5120-hcd: " fmt, ## args) -#define admhc_warn(ahcd, fmt, args...) \ - printk(KERN_WARNING "adm5120-hcd: " fmt, ## args) - -#ifdef ADMHC_VERBOSE_DEBUG -# define admhc_vdbg admhc_dbg -#else -# define admhc_vdbg(ahcd, fmt, args...) do { } while (0) -#endif - -/*-------------------------------------------------------------------------*/ - -/* - * While most USB host controllers implement their registers and - * in-memory communication descriptors in little-endian format, - * a minority (notably the IBM STB04XXX and the Motorola MPC5200 - * processors) implement them in big endian format. - * - * In addition some more exotic implementations like the Toshiba - * Spider (aka SCC) cell southbridge are "mixed" endian, that is, - * they have a different endianness for registers vs. in-memory - * descriptors. - * - * This attempts to support either format at compile time without a - * runtime penalty, or both formats with the additional overhead - * of checking a flag bit. - * - * That leads to some tricky Kconfig rules howevber. There are - * different defaults based on some arch/ppc platforms, though - * the basic rules are: - * - * Controller type Kconfig options needed - * --------------- ---------------------- - * little endian CONFIG_USB_ADMHC_LITTLE_ENDIAN - * - * fully big endian CONFIG_USB_ADMHC_BIG_ENDIAN_DESC _and_ - * CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO - * - * mixed endian CONFIG_USB_ADMHC_LITTLE_ENDIAN _and_ - * CONFIG_USB_OHCI_BIG_ENDIAN_{MMIO,DESC} - * - * (If you have a mixed endian controller, you -must- also define - * CONFIG_USB_ADMHC_LITTLE_ENDIAN or things will not work when building - * both your mixed endian and a fully big endian controller support in - * the same kernel image). - */ - -#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_DESC -#ifdef CONFIG_USB_ADMHC_LITTLE_ENDIAN -#define big_endian_desc(ahcd) (ahcd->flags & OHCI_QUIRK_BE_DESC) -#else -#define big_endian_desc(ahcd) 1 /* only big endian */ -#endif -#else -#define big_endian_desc(ahcd) 0 /* only little endian */ -#endif - -#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO -#ifdef CONFIG_USB_ADMHC_LITTLE_ENDIAN -#define big_endian_mmio(ahcd) (ahcd->flags & OHCI_QUIRK_BE_MMIO) -#else -#define big_endian_mmio(ahcd) 1 /* only big endian */ -#endif -#else -#define big_endian_mmio(ahcd) 0 /* only little endian */ -#endif - -/* - * Big-endian read/write functions are arch-specific. - * Other arches can be added if/when they're needed. - * - */ -static inline unsigned int admhc_readl(const struct admhcd *ahcd, - __hc32 __iomem *regs) -{ -#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO - return big_endian_mmio(ahcd) ? - readl_be(regs) : - readl(regs); -#else - return readl(regs); -#endif -} - -static inline void admhc_writel(const struct admhcd *ahcd, - const unsigned int val, __hc32 __iomem *regs) -{ -#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO - big_endian_mmio(ahcd) ? - writel_be(val, regs) : - writel(val, regs); -#else - writel(val, regs); -#endif -} - -static inline void admhc_writel_flush(const struct admhcd *ahcd) -{ -#if 0 - /* TODO: remove? */ - (void) admhc_readl(ahcd, &ahcd->regs->gencontrol); -#endif -} - - -/*-------------------------------------------------------------------------*/ - -/* cpu to ahcd */ -static inline __hc16 cpu_to_hc16(const struct admhcd *ahcd, const u16 x) -{ - return big_endian_desc(ahcd) ? - (__force __hc16)cpu_to_be16(x) : - (__force __hc16)cpu_to_le16(x); -} - -static inline __hc16 cpu_to_hc16p(const struct admhcd *ahcd, const u16 *x) -{ - return big_endian_desc(ahcd) ? - cpu_to_be16p(x) : - cpu_to_le16p(x); -} - -static inline __hc32 cpu_to_hc32(const struct admhcd *ahcd, const u32 x) -{ - return big_endian_desc(ahcd) ? - (__force __hc32)cpu_to_be32(x) : - (__force __hc32)cpu_to_le32(x); -} - -static inline __hc32 cpu_to_hc32p(const struct admhcd *ahcd, const u32 *x) -{ - return big_endian_desc(ahcd) ? - cpu_to_be32p(x) : - cpu_to_le32p(x); -} - -/* ahcd to cpu */ -static inline u16 hc16_to_cpu(const struct admhcd *ahcd, const __hc16 x) -{ - return big_endian_desc(ahcd) ? - be16_to_cpu((__force __be16)x) : - le16_to_cpu((__force __le16)x); -} - -static inline u16 hc16_to_cpup(const struct admhcd *ahcd, const __hc16 *x) -{ - return big_endian_desc(ahcd) ? - be16_to_cpup((__force __be16 *)x) : - le16_to_cpup((__force __le16 *)x); -} - -static inline u32 hc32_to_cpu(const struct admhcd *ahcd, const __hc32 x) -{ - return big_endian_desc(ahcd) ? - be32_to_cpu((__force __be32)x) : - le32_to_cpu((__force __le32)x); -} - -static inline u32 hc32_to_cpup(const struct admhcd *ahcd, const __hc32 *x) -{ - return big_endian_desc(ahcd) ? - be32_to_cpup((__force __be32 *)x) : - le32_to_cpup((__force __le32 *)x); -} - -/*-------------------------------------------------------------------------*/ - -static inline u16 admhc_frame_no(const struct admhcd *ahcd) -{ - u32 t; - - t = admhc_readl(ahcd, &ahcd->regs->fmnumber) & ADMHC_SFN_FN_MASK; - return (u16)t; -} - -static inline u16 admhc_frame_remain(const struct admhcd *ahcd) -{ - u32 t; - - t = admhc_readl(ahcd, &ahcd->regs->fmnumber) >> ADMHC_SFN_FR_SHIFT; - t &= ADMHC_SFN_FR_MASK; - return (u16)t; -} - -/*-------------------------------------------------------------------------*/ - -static inline void admhc_disable(struct admhcd *ahcd) -{ - admhcd_to_hcd(ahcd)->state = HC_STATE_HALT; -} - -#define FI 0x2edf /* 12000 bits per frame (-1) */ -#define FSLDP(fi) (0x7fff & ((6 * ((fi) - 1200)) / 7)) -#define FIT ADMHC_SFI_FIT -#define LSTHRESH 0x628 /* lowspeed bit threshold */ - -static inline void periodic_reinit(struct admhcd *ahcd) -{ -#if 0 - u32 fi = ahcd->fminterval & ADMHC_SFI_FI_MASK; - u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT; - - /* TODO: adjust FSLargestDataPacket value too? */ - admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval, - &ahcd->regs->fminterval); -#else - u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT; - - /* TODO: adjust FSLargestDataPacket value too? */ - admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval, - &ahcd->regs->fminterval); -#endif -} - -static inline u32 admhc_read_rhdesc(struct admhcd *ahcd) -{ - return admhc_readl(ahcd, &ahcd->regs->rhdesc); -} - -static inline u32 admhc_read_portstatus(struct admhcd *ahcd, int port) -{ - return admhc_readl(ahcd, &ahcd->regs->portstatus[port]); -} - -static inline void admhc_write_portstatus(struct admhcd *ahcd, int port, - u32 value) -{ - admhc_writel(ahcd, value, &ahcd->regs->portstatus[port]); -} - -static inline void roothub_write_status(struct admhcd *ahcd, u32 value) -{ - /* FIXME: read-only bits must be masked out */ - admhc_writel(ahcd, value, &ahcd->regs->rhdesc); -} - -static inline void admhc_intr_disable(struct admhcd *ahcd, u32 ints) -{ - u32 t; - - t = admhc_readl(ahcd, &ahcd->regs->int_enable); - t &= ~(ints); - admhc_writel(ahcd, t, &ahcd->regs->int_enable); - /* TODO: flush writes ?*/ -} - -static inline void admhc_intr_enable(struct admhcd *ahcd, u32 ints) -{ - u32 t; - - t = admhc_readl(ahcd, &ahcd->regs->int_enable); - t |= ints; - admhc_writel(ahcd, t, &ahcd->regs->int_enable); - /* TODO: flush writes ?*/ -} - -static inline void admhc_intr_ack(struct admhcd *ahcd, u32 ints) -{ - admhc_writel(ahcd, ints, &ahcd->regs->int_status); -} - -static inline void admhc_dma_enable(struct admhcd *ahcd) -{ - u32 t; - - t = admhc_readl(ahcd, &ahcd->regs->host_control); - if (t & ADMHC_HC_DMAE) - return; - - t |= ADMHC_HC_DMAE; - admhc_writel(ahcd, t, &ahcd->regs->host_control); - admhc_vdbg(ahcd, "DMA enabled\n"); -} - -static inline void admhc_dma_disable(struct admhcd *ahcd) -{ - u32 t; - - t = admhc_readl(ahcd, &ahcd->regs->host_control); - if (!(t & ADMHC_HC_DMAE)) - return; - - t &= ~ADMHC_HC_DMAE; - admhc_writel(ahcd, t, &ahcd->regs->host_control); - admhc_vdbg(ahcd, "DMA disabled\n"); -} diff --git a/target/linux/adm5120/files-3.18/drivers/watchdog/adm5120_wdt.c b/target/linux/adm5120/files-3.18/drivers/watchdog/adm5120_wdt.c deleted file mode 100644 index d5d63b27a..000000000 --- a/target/linux/adm5120/files-3.18/drivers/watchdog/adm5120_wdt.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * ADM5120_WDT 0.01: Infineon ADM5120 SoC watchdog driver - * Copyright (c) Ondrej Zajicek , 2007 - * - * based on - * - * RC32434_WDT 0.01: IDT Interprise 79RC32434 watchdog driver - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#define DEFAULT_TIMEOUT 15 /* (secs) Default is 15 seconds */ -#define MAX_TIMEOUT 327 -/* Max is 327 seconds, counter is 15-bit integer, step is 10 ms */ - -#define NAME "adm5120_wdt" -#define VERSION "0.1" - -static int expect_close; -static int access; -static unsigned int timeout = DEFAULT_TIMEOUT; - -static int nowayout = WATCHDOG_NOWAYOUT; -module_param(nowayout, int, 0); -MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); -MODULE_LICENSE("GPL"); - - -static inline void wdt_set_timeout(void) -{ - u32 val = (1 << 31) | (((timeout * 100) & 0x7FFF) << 16); - SW_WRITE_REG(SWITCH_REG_WDOG0, val); -} - -/* - It looks like WDOG0-register-write don't modify counter, - but WDOG0-register-read resets counter. -*/ - -static inline void wdt_reset_counter(void) -{ - SW_READ_REG(SWITCH_REG_WDOG0); -} - -static inline void wdt_disable(void) -{ - SW_WRITE_REG(SWITCH_REG_WDOG0, 0x7FFF0000); -} - - - -static int wdt_open(struct inode *inode, struct file *file) -{ - /* Allow only one person to hold it open */ - if (access) - return -EBUSY; - - if (nowayout) - __module_get(THIS_MODULE); - - /* Activate timer */ - wdt_reset_counter(); - wdt_set_timeout(); - printk(KERN_INFO NAME ": enabling watchdog timer\n"); - access = 1; - return 0; -} - -static int wdt_release(struct inode *inode, struct file *file) -{ - /* - * Shut off the timer. - * Lock it in if it's a module and we set nowayout - */ - if (expect_close && (nowayout == 0)) { - wdt_disable(); - printk(KERN_INFO NAME ": disabling watchdog timer\n"); - module_put(THIS_MODULE); - } else - printk(KERN_CRIT NAME ": device closed unexpectedly. WDT will not stop!\n"); - - access = 0; - return 0; -} - -static ssize_t wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) -{ - /* Refresh the timer. */ - if (len) { - if (!nowayout) { - size_t i; - - /* In case it was set long ago */ - expect_close = 0; - - for (i = 0; i != len; i++) { - char c; - if (get_user(c, data + i)) - return -EFAULT; - if (c == 'V') - expect_close = 1; - } - } - wdt_reset_counter(); - return len; - } - return 0; -} - -static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - int new_timeout; - static struct watchdog_info ident = { - .options = WDIOF_SETTIMEOUT | - WDIOF_KEEPALIVEPING | - WDIOF_MAGICCLOSE, - .firmware_version = 0, - .identity = "ADM5120_WDT Watchdog", - }; - switch (cmd) { - default: - return -ENOTTY; - case WDIOC_GETSUPPORT: - if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) - return -EFAULT; - return 0; - case WDIOC_GETSTATUS: - case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *)arg); - case WDIOC_KEEPALIVE: - wdt_reset_counter(); - return 0; - case WDIOC_SETTIMEOUT: - if (get_user(new_timeout, (int *)arg)) - return -EFAULT; - if (new_timeout < 1) - return -EINVAL; - if (new_timeout > MAX_TIMEOUT) - return -EINVAL; - timeout = new_timeout; - wdt_set_timeout(); - /* Fall */ - case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); - } -} - -static const struct file_operations wdt_fops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .write = wdt_write, - .unlocked_ioctl = wdt_ioctl, - .open = wdt_open, - .release = wdt_release, -}; - -static struct miscdevice wdt_miscdev = { - .minor = WATCHDOG_MINOR, - .name = "watchdog", - .fops = &wdt_fops, -}; - -static char banner[] __initdata = KERN_INFO NAME ": Watchdog Timer version " VERSION "\n"; - -static int __init watchdog_init(void) -{ - int ret; - - ret = misc_register(&wdt_miscdev); - - if (ret) - return ret; - - wdt_disable(); - printk(banner); - - return 0; -} - -static void __exit watchdog_exit(void) -{ - misc_deregister(&wdt_miscdev); -} - -module_init(watchdog_init); -module_exit(watchdog_exit); diff --git a/target/linux/adm5120/image/Makefile b/target/linux/adm5120/image/Makefile deleted file mode 100644 index 4ca4d4856..000000000 --- a/target/linux/adm5120/image/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -# -# Copyright (C) 2006-2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR) -JFFS2BLOCK := $(KDIR)/jffs2.block -JFFS2MARK := $(KDIR)/jffs2.mark - -define imgname -$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(1)) -endef - -VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux -fs_squash:=squashfs-only -fs_all:=all -fs_4k:=4k -fs_64k:=64k -fs_128k:=128k - -define Build/Clean - $(LOADER_MAKE) clean -endef - -define Image/Prepare - cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma - rm -f $(JFFS2BLOCK) - touch $(JFFS2BLOCK) - $(call prepare_generic_squashfs,$(JFFS2BLOCK)) - rm -f $(JFFS2MARK) - touch $(JFFS2MARK) - $(call add_jffs2_mark,$(JFFS2MARK)) -endef - -define Image/Build/Loader - $(LOADER_MAKE) LOADER=loader-$(1).$(2) LOADER_DATA="" \ - LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \ - CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \ - compile loader.$(2) -endef - -define Image/Build/LZMAKernel - $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \ - LOADER=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-ramfs.$(2) \ - LOADER_DATA=$(KDIR)/vmlinux.lzma \ - LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \ - CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \ - compile loader.$(2) -endef - -define Image/Build/LZMAKernel/Generic - $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0) -endef - -define Image/Build/LZMAKernel/Admboot - $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1)) -endef - -define Image/Build/LZMAKernel/Cellvision - $(call Image/Build/LZMAKernel,$(1),$(3),0x80500000,0x6D8,y,$(2)) -endef - -define Image/Build/LZMAKernel/KArgs - $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1)) -endef - -define trxalign/jffs2-128k --a 0x20000 -f $(KDIR)/root.jffs2-128k -endef - -define trxalign/jffs2-64k --a 0x10000 -f $(KDIR)/root.jffs2-64k -endef - -define trxalign/squashfs --a 1024 -f $(KDIR)/root.squashfs -a 0x10000 -A $(JFFS2BLOCK) -endef - -define Image/Build/TRX - $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \ - $(call trxalign/$(2)) -endef - -define Image/Build/TRXNoloader - $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \ - $(call trxalign/$(2)) -endef - -include $(SUBTARGET).mk - -define Image/Build - $(call Image/Build/Profile/$(PROFILE),$(1)) -endef - -define Image/Build/Initramfs - $(call Image/Build/Profile/$(PROFILE),Initramfs) -endef - -define Image/BuildKernel - cp $(KDIR)/vmlinux.elf $(VMLINUX).elf - cp $(KDIR)/vmlinux $(VMLINUX).bin -ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) - cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf - cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin -endif -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/adm5120/image/lzma-loader/Makefile b/target/linux/adm5120/image/lzma-loader/Makefile deleted file mode 100644 index 36dfd09ea..000000000 --- a/target/linux/adm5120/image/lzma-loader/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# -# Copyright (C) 2006 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -LOADER := loader.bin -LOADER_NAME := $(basename $(notdir $(LOADER))) -LOADER_DATA := -TARGET_DIR := - -ifeq ($(TARGET_DIR),) -TARGET_DIR := $(KDIR) -endif - -LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin -LOADER_GZ := $(TARGET_DIR)/$(LOADER_NAME).gz -LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf - -LZMA_STARTUP_ORG:= 0 -LZMA_TEXT_START := 0x80300000 - -PKG_NAME := lzma-loader -PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME) - -.PHONY : loader-compile loader.bin loader.elf loader.gz - -$(PKG_BUILD_DIR)/.prepared: - mkdir $(PKG_BUILD_DIR) - $(CP) ./src/* $(PKG_BUILD_DIR)/ - touch $@ - -loader-compile: $(PKG_BUILD_DIR)/.prepared - $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \ - LZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG) \ - LZMA_TEXT_START=$(LZMA_TEXT_START) \ - LOADER_DATA=$(LOADER_DATA) \ - CONFIG_BOARD=$(CONFIG_BOARD) \ - CONFIG_PASS_KARGS=$(CONFIG_PASS_KARGS) \ - clean all - -loader.gz: $(PKG_BUILD_DIR)/loader.bin - gzip -nc9 $< > $(LOADER_GZ) - -loader.elf: $(PKG_BUILD_DIR)/loader.elf - $(CP) $< $(LOADER_ELF) - -loader.bin: $(PKG_BUILD_DIR)/loader.bin - $(CP) $< $(LOADER_BIN) - -download: -prepare: $(PKG_BUILD_DIR)/.prepared -compile: loader-compile - -install: - -clean: - rm -rf $(PKG_BUILD_DIR) - diff --git a/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.c b/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.c deleted file mode 100644 index cb8345377..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.c +++ /dev/null @@ -1,584 +0,0 @@ -/* - LzmaDecode.c - LZMA Decoder (optimized for Speed version) - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this Code, expressly permits you to - statically or dynamically link your Code (or bind by name) to the - interfaces of this file without subjecting your linked Code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#include "LzmaDecode.h" - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 - -#define RC_READ_BYTE (*Buffer++) - -#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ - { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} - -#ifdef _LZMA_IN_CB - -#define RC_TEST { if (Buffer == BufferLim) \ - { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ - BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} - -#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 - -#else - -#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } - -#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 - -#endif - -#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } - -#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) -#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; -#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; - -#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ - { UpdateBit0(p); mi <<= 1; A0; } else \ - { UpdateBit1(p); mi = (mi + mi) + 1; A1; } - -#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) - -#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ - { int i = numLevels; res = 1; \ - do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ - res -= (1 << numLevels); } - - -#define kNumPosBitsMax 4 -#define kNumPosStatesMax (1 << kNumPosBitsMax) - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define LenChoice 0 -#define LenChoice2 (LenChoice + 1) -#define LenLow (LenChoice2 + 1) -#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) - - -#define kNumStates 12 -#define kNumLitStates 7 - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#define kNumPosSlotBits 6 -#define kNumLenToPosStates 4 - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) - -#define kMatchMinLen 2 - -#define IsMatch 0 -#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -#define IsRepG0 (IsRep + kNumStates) -#define IsRepG1 (IsRepG0 + kNumStates) -#define IsRepG2 (IsRepG1 + kNumStates) -#define IsRep0Long (IsRepG2 + kNumStates) -#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -#define LenCoder (Align + kAlignTableSize) -#define RepLenCoder (LenCoder + kNumLenProbs) -#define Literal (RepLenCoder + kNumLenProbs) - -#if Literal != LZMA_BASE_SIZE -StopCompilingDueBUG -#endif - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) -{ - unsigned char prop0; - if (size < LZMA_PROPERTIES_SIZE) - return LZMA_RESULT_DATA_ERROR; - prop0 = propsData[0]; - if (prop0 >= (9 * 5 * 5)) - return LZMA_RESULT_DATA_ERROR; - { - for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); - for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); - propsRes->lc = prop0; - /* - unsigned char remainder = (unsigned char)(prop0 / 9); - propsRes->lc = prop0 % 9; - propsRes->pb = remainder / 5; - propsRes->lp = remainder % 5; - */ - } - - #ifdef _LZMA_OUT_READ - { - int i; - propsRes->DictionarySize = 0; - for (i = 0; i < 4; i++) - propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); - if (propsRes->DictionarySize == 0) - propsRes->DictionarySize = 1; - } - #endif - return LZMA_RESULT_OK; -} - -#define kLzmaStreamWasFinishedId (-1) - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *InCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) -{ - CProb *p = vs->Probs; - SizeT nowPos = 0; - Byte previousByte = 0; - UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; - UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; - int lc = vs->Properties.lc; - - #ifdef _LZMA_OUT_READ - - UInt32 Range = vs->Range; - UInt32 Code = vs->Code; - #ifdef _LZMA_IN_CB - const Byte *Buffer = vs->Buffer; - const Byte *BufferLim = vs->BufferLim; - #else - const Byte *Buffer = inStream; - const Byte *BufferLim = inStream + inSize; - #endif - int state = vs->State; - UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; - int len = vs->RemainLen; - UInt32 globalPos = vs->GlobalPos; - UInt32 distanceLimit = vs->DistanceLimit; - - Byte *dictionary = vs->Dictionary; - UInt32 dictionarySize = vs->Properties.DictionarySize; - UInt32 dictionaryPos = vs->DictionaryPos; - - Byte tempDictionary[4]; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - if (len == kLzmaStreamWasFinishedId) - return LZMA_RESULT_OK; - - if (dictionarySize == 0) - { - dictionary = tempDictionary; - dictionarySize = 1; - tempDictionary[0] = vs->TempDictionary[0]; - } - - if (len == kLzmaNeedInitId) - { - { - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - UInt32 i; - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - rep0 = rep1 = rep2 = rep3 = 1; - state = 0; - globalPos = 0; - distanceLimit = 0; - dictionaryPos = 0; - dictionary[dictionarySize - 1] = 0; - #ifdef _LZMA_IN_CB - RC_INIT; - #else - RC_INIT(inStream, inSize); - #endif - } - len = 0; - } - while(len != 0 && nowPos < outSize) - { - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - len--; - } - if (dictionaryPos == 0) - previousByte = dictionary[dictionarySize - 1]; - else - previousByte = dictionary[dictionaryPos - 1]; - - #else /* if !_LZMA_OUT_READ */ - - int state = 0; - UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; - int len = 0; - const Byte *Buffer; - const Byte *BufferLim; - UInt32 Range; - UInt32 Code; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - - { - UInt32 i; - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - } - - #ifdef _LZMA_IN_CB - RC_INIT; - #else - RC_INIT(inStream, inSize); - #endif - - #endif /* _LZMA_OUT_READ */ - - while(nowPos < outSize) - { - CProb *prob; - UInt32 bound; - int posState = (int)( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & posStateMask); - - prob = p + IsMatch + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - int symbol = 1; - UpdateBit0(prob) - prob = p + Literal + (LZMA_LIT_SIZE * - ((( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & literalPosMask) << lc) + (previousByte >> (8 - lc)))); - - if (state >= kNumLitStates) - { - int matchByte; - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - matchByte = dictionary[pos]; - #else - matchByte = outStream[nowPos - rep0]; - #endif - do - { - int bit; - CProb *probLit; - matchByte <<= 1; - bit = (matchByte & 0x100); - probLit = prob + 0x100 + bit + symbol; - RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) - } - while (symbol < 0x100); - } - while (symbol < 0x100) - { - CProb *probLit = prob + symbol; - RC_GET_BIT(probLit, symbol) - } - previousByte = (Byte)symbol; - - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #endif - if (state < 4) state = 0; - else if (state < 10) state -= 3; - else state -= 6; - } - else - { - UpdateBit1(prob); - prob = p + IsRep + state; - IfBit0(prob) - { - UpdateBit0(prob); - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - state = state < kNumLitStates ? 0 : 3; - prob = p + LenCoder; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG0 + state; - IfBit0(prob) - { - UpdateBit0(prob); - prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - #ifdef _LZMA_OUT_READ - UInt32 pos; - #endif - UpdateBit0(prob); - - #ifdef _LZMA_OUT_READ - if (distanceLimit == 0) - #else - if (nowPos == 0) - #endif - return LZMA_RESULT_DATA_ERROR; - - state = state < kNumLitStates ? 9 : 11; - #ifdef _LZMA_OUT_READ - pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - #endif - - continue; - } - else - { - UpdateBit1(prob); - } - } - else - { - UInt32 distance; - UpdateBit1(prob); - prob = p + IsRepG1 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep1; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG2 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep2; - } - else - { - UpdateBit1(prob); - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - state = state < kNumLitStates ? 8 : 11; - prob = p + RepLenCoder; - } - { - int numBits, offset; - CProb *probLen = prob + LenChoice; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - numBits = kLenNumLowBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenChoice2; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - numBits = kLenNumMidBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - numBits = kLenNumHighBits; - } - } - RangeDecoderBitTreeDecode(probLen, numBits, len); - len += offset; - } - - if (state < 4) - { - int posSlot; - state += kNumLitStates; - prob = p + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << - kNumPosSlotBits); - RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); - if (posSlot >= kStartPosModelIndex) - { - int numDirectBits = ((posSlot >> 1) - 1); - rep0 = (2 | ((UInt32)posSlot & 1)); - if (posSlot < kEndPosModelIndex) - { - rep0 <<= numDirectBits; - prob = p + SpecPos + rep0 - posSlot - 1; - } - else - { - numDirectBits -= kNumAlignBits; - do - { - RC_NORMALIZE - Range >>= 1; - rep0 <<= 1; - if (Code >= Range) - { - Code -= Range; - rep0 |= 1; - } - } - while (--numDirectBits != 0); - prob = p + Align; - rep0 <<= kNumAlignBits; - numDirectBits = kNumAlignBits; - } - { - int i = 1; - int mi = 1; - do - { - CProb *prob3 = prob + mi; - RC_GET_BIT2(prob3, mi, ; , rep0 |= i); - i <<= 1; - } - while(--numDirectBits != 0); - } - } - else - rep0 = posSlot; - if (++rep0 == (UInt32)(0)) - { - /* it's for stream version */ - len = kLzmaStreamWasFinishedId; - break; - } - } - - len += kMatchMinLen; - #ifdef _LZMA_OUT_READ - if (rep0 > distanceLimit) - #else - if (rep0 > nowPos) - #endif - return LZMA_RESULT_DATA_ERROR; - - #ifdef _LZMA_OUT_READ - if (dictionarySize - distanceLimit > (UInt32)len) - distanceLimit += len; - else - distanceLimit = dictionarySize; - #endif - - do - { - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - len--; - outStream[nowPos++] = previousByte; - } - while(len != 0 && nowPos < outSize); - } - } - RC_NORMALIZE; - - #ifdef _LZMA_OUT_READ - vs->Range = Range; - vs->Code = Code; - vs->DictionaryPos = dictionaryPos; - vs->GlobalPos = globalPos + (UInt32)nowPos; - vs->DistanceLimit = distanceLimit; - vs->Reps[0] = rep0; - vs->Reps[1] = rep1; - vs->Reps[2] = rep2; - vs->Reps[3] = rep3; - vs->State = state; - vs->RemainLen = len; - vs->TempDictionary[0] = tempDictionary[0]; - #endif - - #ifdef _LZMA_IN_CB - vs->Buffer = Buffer; - vs->BufferLim = BufferLim; - #else - *inSizeProcessed = (SizeT)(Buffer - inStream); - #endif - *outSizeProcessed = nowPos; - return LZMA_RESULT_OK; -} diff --git a/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.h b/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.h deleted file mode 100644 index 2870eeb9c..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/LzmaDecode.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - LzmaDecode.h - LZMA Decoder interface - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to the - interfaces of this file without subjecting your linked code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#ifndef __LZMADECODE_H -#define __LZMADECODE_H - -#include "LzmaTypes.h" - -/* #define _LZMA_IN_CB */ -/* Use callback for input data */ - -/* #define _LZMA_OUT_READ */ -/* Use read function for output data */ - -/* #define _LZMA_PROB32 */ -/* It can increase speed on some 32-bit CPUs, - but memory usage will be doubled in that case */ - -/* #define _LZMA_LOC_OPT */ -/* Enable local speed optimizations inside code */ - -#ifdef _LZMA_PROB32 -#define CProb UInt32 -#else -#define CProb UInt16 -#endif - -#define LZMA_RESULT_OK 0 -#define LZMA_RESULT_DATA_ERROR 1 - -#ifdef _LZMA_IN_CB -typedef struct _ILzmaInCallback -{ - int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); -} ILzmaInCallback; -#endif - -#define LZMA_BASE_SIZE 1846 -#define LZMA_LIT_SIZE 768 - -#define LZMA_PROPERTIES_SIZE 5 - -typedef struct _CLzmaProperties -{ - int lc; - int lp; - int pb; - #ifdef _LZMA_OUT_READ - UInt32 DictionarySize; - #endif -}CLzmaProperties; - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); - -#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) - -#define kLzmaNeedInitId (-2) - -typedef struct _CLzmaDecoderState -{ - CLzmaProperties Properties; - CProb *Probs; - - #ifdef _LZMA_IN_CB - const unsigned char *Buffer; - const unsigned char *BufferLim; - #endif - - #ifdef _LZMA_OUT_READ - unsigned char *Dictionary; - UInt32 Range; - UInt32 Code; - UInt32 DictionaryPos; - UInt32 GlobalPos; - UInt32 DistanceLimit; - UInt32 Reps[4]; - int State; - int RemainLen; - unsigned char TempDictionary[4]; - #endif -} CLzmaDecoderState; - -#ifdef _LZMA_OUT_READ -#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } -#endif - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *inCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); - -#endif diff --git a/target/linux/adm5120/image/lzma-loader/src/LzmaTypes.h b/target/linux/adm5120/image/lzma-loader/src/LzmaTypes.h deleted file mode 100644 index 9c2729075..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/LzmaTypes.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -LzmaTypes.h - -Types for LZMA Decoder - -This file written and distributed to public domain by Igor Pavlov. -This file is part of LZMA SDK 4.40 (2006-05-01) -*/ - -#ifndef __LZMATYPES_H -#define __LZMATYPES_H - -#ifndef _7ZIP_BYTE_DEFINED -#define _7ZIP_BYTE_DEFINED -typedef unsigned char Byte; -#endif - -#ifndef _7ZIP_UINT16_DEFINED -#define _7ZIP_UINT16_DEFINED -typedef unsigned short UInt16; -#endif - -#ifndef _7ZIP_UINT32_DEFINED -#define _7ZIP_UINT32_DEFINED -#ifdef _LZMA_UINT32_IS_ULONG -typedef unsigned long UInt32; -#else -typedef unsigned int UInt32; -#endif -#endif - -/* #define _LZMA_NO_SYSTEM_SIZE_T */ -/* You can use it, if you don't want */ - -#ifndef _7ZIP_SIZET_DEFINED -#define _7ZIP_SIZET_DEFINED -#ifdef _LZMA_NO_SYSTEM_SIZE_T -typedef UInt32 SizeT; -#else -#include -typedef size_t SizeT; -#endif -#endif - -#endif diff --git a/target/linux/adm5120/image/lzma-loader/src/Makefile b/target/linux/adm5120/image/lzma-loader/src/Makefile deleted file mode 100644 index f23d040cd..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -# -# Makefile for Broadcom BCM947XX boards -# -# Copyright 2001-2003, Broadcom Corporation -# All Rights Reserved. -# -# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -# -# Copyright 2004 Manuel Novoa III -# Modified to support bzip'd kernels. -# Of course, it would be better to integrate bunzip capability into CFE. -# -# Copyright 2005 Oleg I. Vdovikin -# Cleaned up, modified for lzma support, removed from kernel -# -# Copyright 2007 Gabor Juhos -# Modified to support user defined entry point address. -# Added support for make targets with different names -# - -LOADADDR := 0x80001000 -LZMA_TEXT_START := 0x80500000 -LZMA_STARTUP_ORG:= 0 -LOADER_DATA := -CONFIG_PASS_KARGS := -CONFIG_BOARD := - -CC := $(CROSS_COMPILE)gcc -LD := $(CROSS_COMPILE)ld -OBJCOPY := $(CROSS_COMPILE)objcopy -OBJDUMP := $(CROSS_COMPILE)objdump - -BIN_FLAGS := -O binary -R .reginfo -R .note -R .comment -R .mdebug -S - -CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \ - -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \ - -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding \ - -fhonour-copts \ - -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -CFLAGS += -DLOADADDR=$(LOADADDR) -D_LZMA_PROB32 - -ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DLZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG) - -LDFLAGS = -static --gc-sections -no-warn-mismatch -LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START) - -O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32) - -OBJECTS := head.o decompress.o board.o printf.o LzmaDecode.o - -ifneq ($(strip $(LOADER_DATA)),) -OBJECTS += data.o -CFLAGS += -DLZMA_WRAPPER=1 -else -CFLAGS += -D_LZMA_IN_CB -endif - -ifneq ($(strip $(CONFIG_PASS_KARGS)),) -CFLAGS += -DCONFIG_PASS_KARGS -endif - -BOARD_DEF := $(strip $(CONFIG_BOARD)) -BOARD_DEF := $(shell echo $(BOARD_DEF) | tr a-z A-Z | tr -d -) -ifneq ($(BOARD_DEF),) -CFLAGS += -DCONFIG_BOARD_$(BOARD_DEF) -endif - -all: loader.bin - -# Don't build dependencies, this may die if $(CC) isn't gcc -dep: - -install: - -%.o : %.c - $(CC) $(CFLAGS) -c -o $@ $< - -%.o : %.S - $(CC) $(ASFLAGS) -c -o $@ $< - -data.o: $(LOADER_DATA) - $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $< - -loader.bin: loader.elf - $(OBJCOPY) $(BIN_FLAGS) $< $@ - -loader.elf: $(OBJECTS) - $(LD) $(LDFLAGS) -o $@ $(OBJECTS) - -mrproper: clean - -clean: - rm -f *.elf *.bin *.o - - - diff --git a/target/linux/adm5120/image/lzma-loader/src/README b/target/linux/adm5120/image/lzma-loader/src/README deleted file mode 100644 index 16649e950..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/README +++ /dev/null @@ -1,55 +0,0 @@ -/* - * LZMA compressed kernel decompressor for bcm947xx boards - * - * Copyright (C) 2005 by Oleg I. Vdovikin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -The code is intended to decompress kernel, being compressed using lzma utility -build using 7zip LZMA SDK. This utility is located in the LZMA_Alone directory - -decompressor code expects that your .trx file consist of three partitions: - -1) decompressor itself (this is gziped code which pmon/cfe will extract and run -on boot-up instead of real kernel) -2) LZMA compressed kernel (both streamed and regular modes are supported now) -3) Root filesystem - -Please be sure to apply the following patch for use this new trx layout (it will -allow using both new and old trx files for root filesystem lookup code) - ---- linuz/arch/mips/brcm-boards/bcm947xx/setup.c 2005-01-23 19:24:27.503322896 +0300 -+++ linux/arch/mips/brcm-boards/bcm947xx/setup.c 2005-01-23 19:29:05.237100944 +0300 -@@ -221,7 +221,9 @@ - /* Try looking at TRX header for rootfs offset */ - if (le32_to_cpu(trx->magic) == TRX_MAGIC) { - bcm947xx_parts[1].offset = off; -- if (le32_to_cpu(trx->offsets[1]) > off) -+ if (le32_to_cpu(trx->offsets[2]) > off) -+ off = le32_to_cpu(trx->offsets[2]); -+ else if (le32_to_cpu(trx->offsets[1]) > off) - off = le32_to_cpu(trx->offsets[1]); - continue; - } - - -Revision history: - 0.02 Initial release - 0.03 Added Mineharu Takahara patch to pass actual - output size to decoder (stream mode compressed input is not - a requirement anymore) - 0.04 Reordered functions using lds script diff --git a/target/linux/adm5120/image/lzma-loader/src/board.c b/target/linux/adm5120/image/lzma-loader/src/board.c deleted file mode 100644 index 5ebdbc3b1..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/board.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * ADM5120 specific board support for LZMA decompressor - * - * Copyright (C) 2007-2008 OpenWrt.org - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" -#include - -#define READREG(r) *(volatile unsigned int *)(r) -#define WRITEREG(r,v) *(volatile unsigned int *)(r) = v - -/* - * INTC definitions - */ -#define INTC_BASE 0xB2200000 - -/* INTC registers */ -#define INTC_REG_IRQ_DISABLE 0x0C - -/* - * UART definitions - */ -#define UART0_BASE 0xB2600000 -#define UART1_BASE 0xB2800000 -/* UART registers */ -#define UART_REG_DATA 0x00 /* Data register */ -#define UART_REG_ECR 0x04 /* Error Clear register */ -#define UART_REG_LCRH 0x08 /* Line Control High register */ -#define UART_REG_LCRM 0x0C /* Line Control Middle register */ -#define UART_REG_LCRL 0x10 /* Line Control Low register */ -#define UART_REG_CTRL 0x14 /* Control register */ -#define UART_REG_FLAG 0x18 /* Flag register */ - -/* Control register bits */ -#define UART_CTRL_EN ( 1 << 0 ) /* UART enable */ - -/* Line Control High register bits */ -#define UART_LCRH_FEN ( 1 << 4 ) /* FIFO enable */ - -/* Flag register bits */ -#define UART_FLAG_CTS ( 1 << 0 ) -#define UART_FLAG_DSR ( 1 << 1 ) -#define UART_FLAG_DCD ( 1 << 2 ) -#define UART_FLAG_BUSY ( 1 << 3 ) -#define UART_FLAG_RXFE ( 1 << 4 ) /* RX FIFO empty */ -#define UART_FLAG_TXFF ( 1 << 5 ) /* TX FIFO full */ -#define UART_FLAG_RXFF ( 1 << 6 ) /* RX FIFO full */ -#define UART_FLAG_TXFE ( 1 << 7 ) /* TX FIFO empty */ - -/* - * SWITCH definitions - */ -#define SWITCH_BASE 0xB2000000 - -#define SWITCH_REG_CPUP_CONF 0x0024 -#define SWITCH_REG_PORT_CONF0 0x0028 - -#define SWITCH_REG_GPIO_CONF0 0x00B8 -#define SWITCH_REG_GPIO_CONF2 0x00BC - -#define SWITCH_REG_PORT0_LED 0x0100 -#define SWITCH_REG_PORT1_LED 0x0104 -#define SWITCH_REG_PORT2_LED 0x0108 -#define SWITCH_REG_PORT3_LED 0x010C -#define SWITCH_REG_PORT4_LED 0x0110 - -#define SWITCH_PORTS_HW 0x3F /* Hardware Ports */ - -/* CPUP_CONF register bits */ -#define CPUP_CONF_DCPUP ( 1 << 0 ) /* Disable CPU port */ - -/* PORT_CONF0 register bits */ -#define PORT_CONF0_DP_SHIFT 0 /* disable port shift*/ - - -/* - * UART routines - */ - -#if defined(CONFIG_USE_UART0) -# define UART_READ(r) READREG(UART0_BASE+(r)) -# define UART_WRITE(r,v) WRITEREG(UART0_BASE+(r),(v)) -#else -# define UART_READ(r) READREG(UART1_BASE+(r)) -# define UART_WRITE(r,v) WRITEREG(UART1_BASE+(r),(v)) -#endif - -static void uart_init(void) -{ -#if 0 - unsigned int t; - - /* disable uart */ - UART_WRITE(UART_REG_CTRL, 0); - - /* keep current baud rate */ - t = UART_READ(UART_REG_LCRM); - UART_WRITE(UART_REG_LCRM, t); - t = UART_READ(UART_REG_LCRL); - UART_WRITE(UART_REG_LCRL, t); - - /* keep data, stop, and parity bits, but disable FIFO */ - t = UART_READ(UART_REG_LCRH); - t &= ~(UART_LCRH_FEN); - UART_WRITE(UART_REG_LCRH, t ); - - /* clear error bits */ - UART_WRITE(UART_REG_ECR, 0xFF); - - /* enable uart, and disable interrupts */ - UART_WRITE(UART_REG_CTRL, UART_CTRL_EN); -#endif -} - -/* - * INTC routines - */ - -#define INTC_READ(r) READREG(INTC_BASE+(r)) -#define INTC_WRITE(r,v) WRITEREG(INTC_BASE+(r),v) - -static void intc_init(void) -{ - INTC_WRITE(INTC_REG_IRQ_DISABLE, 0xFFFFFFFF); -} - -/* - * SWITCH routines - */ - -#define SWITCH_READ(r) READREG(SWITCH_BASE+(r)) -#define SWITCH_WRITE(r,v) WRITEREG(SWITCH_BASE+(r),v) - -static void switch_init(void) -{ - /* disable PHYS ports */ - SWITCH_WRITE(SWITCH_REG_PORT_CONF0, - (SWITCH_PORTS_HW << PORT_CONF0_DP_SHIFT)); - - /* disable CPU port */ - SWITCH_WRITE(SWITCH_REG_CPUP_CONF, CPUP_CONF_DCPUP); - - /* disable GPIO lines */ - SWITCH_WRITE(SWITCH_REG_GPIO_CONF0, 0); - SWITCH_WRITE(SWITCH_REG_GPIO_CONF2, 0); - - /* disable LED lines */ - SWITCH_WRITE(SWITCH_REG_PORT0_LED, 0); - SWITCH_WRITE(SWITCH_REG_PORT1_LED, 0); - SWITCH_WRITE(SWITCH_REG_PORT2_LED, 0); - SWITCH_WRITE(SWITCH_REG_PORT3_LED, 0); - SWITCH_WRITE(SWITCH_REG_PORT4_LED, 0); -} - -void board_putc(int ch) -{ - while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); - - UART_WRITE(UART_REG_DATA, ch); - - while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); -} - -void board_init(void) -{ - intc_init(); - switch_init(); - uart_init(); -} diff --git a/target/linux/adm5120/image/lzma-loader/src/config.h b/target/linux/adm5120/image/lzma-loader/src/config.h deleted file mode 100644 index e5511d16f..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/config.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -#define FLASH_2M (2<<20) -#define FLASH_4M (4<<20) - -/* - * Cellvision/SparkLAN boards - */ - -#if defined(CONFIG_BOARD_CAS630) -# define CONFIG_BOARD_NAME "CAS-630" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_CAS670) -# define CONFIG_BOARD_NAME "CAS-670" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_CAS700) -# define CONFIG_BOARD_NAME "CAS-700" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_CAS790) -# define CONFIG_BOARD_NAME "CAS-790" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_CAS771) -# define CONFIG_BOARD_NAME "CAS-771" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_CAS861) -# define CONFIG_BOARD_NAME "CAS-861" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_NFS101U) -# define CONFIG_BOARD_NAME "NFS-101U" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_NFS202U) -# define CONFIG_BOARD_NAME "NFS-202U" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -/* - * Compex boards - */ -#if defined(CONFIG_BOARD_WP54GWRT) -# define CONFIG_BOARD_NAME "WP54G-WRT" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -/* - * Edimax boards - */ -#if defined(CONFIG_BOARD_BR6104K) -# define CONFIG_BOARD_NAME "BR-6104K" -# define CONFIG_FLASH_SIZE FLASH_2M -#endif - -#if defined(CONFIG_BOARD_BR6104KP) -# define CONFIG_BOARD_NAME "BR-6104KP" -# define CONFIG_FLASH_SIZE FLASH_2M -#endif - -#if defined(CONFIG_BOARD_BR6104WG) -# define CONFIG_BOARD_NAME "BR-6104WG" -# define CONFIG_FLASH_SIZE FLASH_2M -#endif - -/* - * Infineon boards - */ -#if defined(CONFIG_BOARD_EASY5120PATA) -# define CONFIG_BOARD_NAME "EASY 5120P-ATA" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_EASY5120RT) -# define CONFIG_BOARD_NAME "EASY 5120-RT" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_EASY5120WVOIP) -# define CONFIG_BOARD_NAME "EASY 5120-WVOIP" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_EASY83000) -# define CONFIG_BOARD_NAME "EASY 83000" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -/* - * Motorola boards - */ -#if defined(CONFIG_BOARD_POWERLINEMUGW) -# define CONFIG_BOARD_NAME "Powerline MU Gateway" -# define CONFIG_USE_UART1 1 -#endif - -/* - * OSBRiDGE boards - */ -#if defined(CONFIG_BOARD_5GXI) -# define CONFIG_BOARD_NAME "OSBRiDGE 5GXi" -#endif - -/* - * ZyXEL boards - */ -#if defined(CONFIG_BOARD_P334WT) -# define CONFIG_BOARD_NAME "P-334WT" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -#if defined(CONFIG_BOARD_P335) -# define CONFIG_BOARD_NAME "P-335" -# define CONFIG_FLASH_SIZE FLASH_4M -#endif - -/* - * Default values - */ -#ifndef CONFIG_BOARD_NAME -# define CONFIG_BOARD_NAME "ADM5120" -#endif - -#ifndef CONFIG_FLASH_SIZE -# define CONFIG_FLASH_SIZE FLASH_2M -#endif - -#if !defined(CONFIG_USE_UART0) && !defined(CONFIG_USE_UART1) -# define CONFIG_USE_UART0 -#endif - -#endif /* _CONFIG_H_ */ diff --git a/target/linux/adm5120/image/lzma-loader/src/decompress.c b/target/linux/adm5120/image/lzma-loader/src/decompress.c deleted file mode 100644 index cd4b8fa60..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/decompress.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - * - * LZMA compressed kernel decompressor for ADM5120 boards - * - * Copyright (C) 2005 by Oleg I. Vdovikin - * Copyright (C) 2007-2008 OpenWrt.org - * Copyright (C) 2007-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * - * Please note, this was code based on the bunzip2 decompressor code - * by Manuel Novoa III (mjn3@codepoet.org), although the only thing left - * is an idea and part of original vendor code - * - * - * 12-Mar-2005 Mineharu Takahara - * pass actual output size to decoder (stream mode - * compressed input is not a requirement anymore) - * - * 24-Apr-2005 Oleg I. Vdovikin - * reordered functions using lds script, removed forward decl - * - * 24-Mar-2007 Gabor Juhos - * pass original values of the a0,a1,a2,a3 registers to the kernel - * - * 19-May-2007 Gabor Juhos - * endiannes related cleanups - * add support for decompressing an embedded kernel - * - */ - -#include - -#include "config.h" -#include "printf.h" -#include "LzmaDecode.h" - -#define ADM5120_FLASH_START 0x1fc00000 /* Flash start */ -#define ADM5120_FLASH_END 0x1fe00000 /* Flash end */ - -#define KSEG0 0x80000000 -#define KSEG1 0xa0000000 - -#define KSEG1ADDR(a) ((((unsigned)(a)) & 0x1fffffffU) | KSEG1) - -#define Index_Invalidate_I 0x00 -#define Index_Writeback_Inv_D 0x01 - -#define cache_unroll(base,op) \ - __asm__ __volatile__( \ - ".set noreorder;\n" \ - ".set mips3;\n" \ - "cache %1, (%0);\n" \ - ".set mips0;\n" \ - ".set reorder\n" \ - : \ - : "r" (base), \ - "i" (op)); - -#ifdef LZMA_DEBUG -# define DBG(f, a...) printf(f, ## a) -#else -# define DBG(f, a...) do {} while (0) -#endif - -static __inline__ void blast_icache(unsigned long size, unsigned long lsize) -{ - unsigned long start = KSEG0; - unsigned long end = (start + size); - - while(start < end) { - cache_unroll(start,Index_Invalidate_I); - start += lsize; - } -} - -static __inline__ void blast_dcache(unsigned long size, unsigned long lsize) -{ - unsigned long start = KSEG0; - unsigned long end = (start + size); - - while(start < end) { - cache_unroll(start,Index_Writeback_Inv_D); - start += lsize; - } -} - -#define TRX_MAGIC 0x30524448 /* "HDR0" */ -#define TRX_ALIGN 0x1000 - -struct trx_header { - unsigned int magic; /* "HDR0" */ - unsigned int len; /* Length of file including header */ - unsigned int crc32; /* 32-bit CRC from flag_version to end of file */ - unsigned int flag_version; /* 0:15 flags, 16:31 version */ - unsigned int offsets[3]; /* Offsets of partitions from start of header */ -}; - -struct env_var { - char *name; - char *value; -}; - -/* beyound the image end, size not known in advance */ -extern unsigned char workspace[]; -extern void board_init(void); - -static CLzmaDecoderState lzma_state; - -typedef void (*kernel_entry)(unsigned long reg_a0, unsigned long reg_a1, - unsigned long reg_a2, unsigned long reg_a3); - -static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream, - UInt32 outSize); - -#ifdef CONFIG_PASS_KARGS -#define ENVV(n,v) {.name = (n), .value = (v)} -struct env_var env_vars[] = { - ENVV("board_name", CONFIG_BOARD_NAME), - ENVV(NULL, NULL) -}; -#endif - -static void halt(void) -{ - printf("\nSystem halted!\n"); - for(;;); -} - -#if (LZMA_WRAPPER) -extern unsigned char _lzma_data_start[]; -extern unsigned char _lzma_data_end[]; - -unsigned char *data; -unsigned long datalen; - -static __inline__ unsigned char get_byte(void) -{ - datalen--; - return *data++; -} - -static void decompress_init(void) -{ - data = _lzma_data_start; - datalen = _lzma_data_end - _lzma_data_start; -} - -static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream, - SizeT outSize) -{ - SizeT ip, op; - - return LzmaDecode(vs, data, datalen, &ip, outStream, outSize, &op); -} -#endif /* LZMA_WRAPPER */ - -#if !(LZMA_WRAPPER) - -#define FLASH_BANK_SIZE (2<<20) - -static unsigned char *flash_base = (unsigned char *) KSEG1ADDR(ADM5120_FLASH_START); -static unsigned long flash_ofs = 0; -static unsigned long flash_max = 0; -static unsigned long flash_ofs_mask = (FLASH_BANK_SIZE-1); - -static __inline__ unsigned char get_byte(void) -{ - return *(flash_base+flash_ofs++); -} - -static int lzma_read_byte(void *object, const unsigned char **buffer, - SizeT *bufferSize) -{ - unsigned long len; - - if (flash_ofs >= flash_max) - return LZMA_RESULT_DATA_ERROR; - - len = flash_max-flash_ofs; - -#if (CONFIG_FLASH_SIZE > FLASH_BANK_SIZE) - if (flash_ofs < FLASH_BANK_SIZE) { - /* switch to bank 0 */ - DBG("lzma_read_byte: switch to bank 0\n"); - - if (len > FLASH_BANK_SIZE-flash_ofs) - len = FLASH_BANK_SIZE-flash_ofs; - } else { - /* switch to bank 1 */ - DBG("lzma_read_byte: switch to bank 1\n"); - } -#endif - DBG("lzma_read_byte: ofs=%08X, len=%08X\n", flash_ofs, len); - - *buffer = flash_base+(flash_ofs & flash_ofs_mask); - *bufferSize = len; - flash_ofs += len; - - return LZMA_RESULT_OK; -} - -static ILzmaInCallback lzma_callback = { - .Read = lzma_read_byte, -}; - -static __inline__ unsigned int read_le32(void *buf) -{ - unsigned char *p = buf; - - return ((unsigned int)p[0] + ((unsigned int)p[1] << 8) + - ((unsigned int)p[2] << 16) +((unsigned int)p[3] << 24)); -} - -static void decompress_init(void) -{ - struct trx_header *hdr = NULL; - unsigned long kofs,klen; - - printf("Looking for TRX header... "); - /* look for trx header, 32-bit data access */ - for (flash_ofs = 0; flash_ofs < FLASH_BANK_SIZE; flash_ofs += TRX_ALIGN) { - if (read_le32(&flash_base[flash_ofs]) == TRX_MAGIC) { - hdr = (struct trx_header *)&flash_base[flash_ofs]; - break; - } - } - - if (hdr == NULL) { - printf("not found!\n"); - /* no compressed kernel found, halting */ - halt(); - } - - /* compressed kernel is in the partition 0 or 1 */ - kofs = read_le32(&hdr->offsets[1]); - if (kofs == 0 || kofs > 65536) { - klen = kofs-read_le32(&hdr->offsets[0]); - kofs = read_le32(&hdr->offsets[0]); - } else { - klen = read_le32(&hdr->offsets[2]); - if (klen > kofs) - klen -= kofs; - else - klen = read_le32(&hdr->len)-kofs; - } - - printf("found at %08X, kernel:%08X len:%08X\n", flash_ofs, - kofs, klen); - - flash_ofs += kofs; - flash_max = flash_ofs+klen; -} - -static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream, - SizeT outSize) -{ - SizeT op; - -#if 0 - vs->Buffer = data; - vs->BufferLim = datalen; -#endif - - return LzmaDecode(vs, &lzma_callback, outStream, outSize, &op); -} -#endif /* !(LZMA_WRAPPER) */ - -/* should be the first function */ -void decompress_entry(unsigned long reg_a0, unsigned long reg_a1, - unsigned long reg_a2, unsigned long reg_a3, - unsigned long icache_size, unsigned long icache_lsize, - unsigned long dcache_size, unsigned long dcache_lsize) -{ - unsigned char props[LZMA_PROPERTIES_SIZE]; - unsigned int i; /* temp value */ - SizeT osize; /* uncompressed size */ - int res; - - board_init(); - - printf("\n\nLZMA loader for " CONFIG_BOARD_NAME - ", Copyright (C) 2007-2008 OpenWrt.org\n\n"); - - decompress_init(); - - /* lzma args */ - for (i = 0; i < LZMA_PROPERTIES_SIZE; i++) - props[i] = get_byte(); - - /* skip rest of the LZMA coder property */ - /* read the lower half of uncompressed size in the header */ - osize = ((SizeT)get_byte()) + - ((SizeT)get_byte() << 8) + - ((SizeT)get_byte() << 16) + - ((SizeT)get_byte() << 24); - - /* skip rest of the header (upper half of uncompressed size) */ - for (i = 0; i < 4; i++) - get_byte(); - - res = LzmaDecodeProperties(&lzma_state.Properties, props, - LZMA_PROPERTIES_SIZE); - if (res != LZMA_RESULT_OK) { - printf("Incorrect LZMA stream properties!\n"); - halt(); - } - - printf("decompressing kernel... "); - - lzma_state.Probs = (CProb *)workspace; - res = decompress_data(&lzma_state, (unsigned char *)LOADADDR, osize); - - if (res != LZMA_RESULT_OK) { - printf("failed, "); - switch (res) { - case LZMA_RESULT_DATA_ERROR: - printf("data error!\n"); - break; - default: - printf("unknown error %d!\n", res); - } - halt(); - } else - printf("done!\n"); - - blast_dcache(dcache_size, dcache_lsize); - blast_icache(icache_size, icache_lsize); - - printf("launching kernel...\n\n"); - -#ifdef CONFIG_PASS_KARGS - reg_a0 = 0; - reg_a1 = 0; - reg_a2 = (unsigned long)env_vars; - reg_a3 = 0; -#endif - /* Jump to load address */ - ((kernel_entry) LOADADDR)(reg_a0, reg_a1, reg_a2, reg_a3); -} diff --git a/target/linux/adm5120/image/lzma-loader/src/head.S b/target/linux/adm5120/image/lzma-loader/src/head.S deleted file mode 100644 index 9f82fabdc..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/head.S +++ /dev/null @@ -1,209 +0,0 @@ -/* Copyright 2007 Gabor Juhos */ -/* keep original values of the a0,a1,a2,a3 registers */ -/* modifed to support user defined entry point address */ -/* Copyright 2005 Oleg I. Vdovikin (oleg@cs.msu.su) */ -/* cache manipulation adapted from Broadcom code */ -/* idea taken from original bunzip2 decompressor code */ -/* Copyright 2004 Manuel Novoa III (mjn3@codepoet.org) */ -/* Licensed under the linux kernel's version of the GPL.*/ - -#include -#include - -#define KSEG0 0x80000000 - -#define C0_STATUS $12 -#define C0_CAUSE $13 -#define C0_CONFIG $16 -#define C0_WATCHLO $18 -#define C0_WATCHHI $19 -#define C0_TAGLO $28 -#define C0_TAGHI $29 - -#define CONF1_DA_SHIFT 7 /* D$ associativity */ -#define CONF1_DA_MASK 0x00000380 -#define CONF1_DA_BASE 1 -#define CONF1_DL_SHIFT 10 /* D$ line size */ -#define CONF1_DL_MASK 0x00001c00 -#define CONF1_DL_BASE 2 -#define CONF1_DS_SHIFT 13 /* D$ sets/way */ -#define CONF1_DS_MASK 0x0000e000 -#define CONF1_DS_BASE 64 -#define CONF1_IA_SHIFT 16 /* I$ associativity */ -#define CONF1_IA_MASK 0x00070000 -#define CONF1_IA_BASE 1 -#define CONF1_IL_SHIFT 19 /* I$ line size */ -#define CONF1_IL_MASK 0x00380000 -#define CONF1_IL_BASE 2 -#define CONF1_IS_SHIFT 22 /* Instruction cache sets/way */ -#define CONF1_IS_MASK 0x01c00000 -#define CONF1_IS_BASE 64 - -#define Index_Invalidate_I 0x00 -#define Index_Writeback_Inv_D 0x01 - - .text - -#if (LZMA_STARTUP_ORG) - .set noreorder - - b startup - nop - - .org LZMA_STARTUP_ORG -#endif - -LEAF(startup) - .set noreorder - .set mips32 - - mtc0 zero, C0_WATCHLO # clear watch registers - mtc0 zero, C0_WATCHHI - - mtc0 zero, C0_CAUSE # clear before writing status register - - mfc0 t0, C0_STATUS # get status register - li t1, ~(0xFF01) - and t0, t1 # mask interrupts - mtc0 t0, C0_STATUS # set up status register - - move t1, ra # save return address - la t0, __reloc_label # get linked address of label - bal __reloc_label # branch and link to label to - nop # get actual address -__reloc_label: - subu t0, ra, t0 # get reloc_delta - move ra, t1 # restore return address - - beqz t0, __reloc_end # if delta is 0 we are in the right place - nop - - /* Copy our code to the right place */ - la t1, _code_start # get linked address of _code_start - la t2, _code_end # get linked address of _code_end - addu t0, t0, t1 # calculate actual address of _code_start - -__reloc_copy: - lw t3, 0(t0) - sw t3, 0(t1) - add t1, 4 - blt t1, t2, __reloc_copy - add t0, 4 - -__reloc_end: - - /* At this point we need to invalidate dcache and */ - /* icache before jumping to new code */ - -1: /* Get cache sizes */ - .set mips32 - mfc0 s0,C0_CONFIG,1 - .set mips0 - - li s1,CONF1_DL_MASK - and s1,s0 - beq s1,zero,nodc - nop - - srl s1,CONF1_DL_SHIFT - li t0,CONF1_DL_BASE - sll s1,t0,s1 /* s1 has D$ cache line size */ - - li s2,CONF1_DA_MASK - and s2,s0 - srl s2,CONF1_DA_SHIFT - addiu s2,CONF1_DA_BASE /* s2 now has D$ associativity */ - - li t0,CONF1_DS_MASK - and t0,s0 - srl t0,CONF1_DS_SHIFT - li s3,CONF1_DS_BASE - sll s3,s3,t0 /* s3 has D$ sets per way */ - - multu s2,s3 /* sets/way * associativity */ - mflo t0 /* total cache lines */ - - multu s1,t0 /* D$ linesize * lines */ - mflo s2 /* s2 is now D$ size in bytes */ - - /* Initilize the D$: */ - mtc0 zero,C0_TAGLO - mtc0 zero,C0_TAGHI - - li t0,KSEG0 /* Just an address for the first $ line */ - addu t1,t0,s2 /* + size of cache == end */ - - .set mips3 -1: cache Index_Writeback_Inv_D,0(t0) - .set mips0 - bne t0,t1,1b - addu t0,s1 - -nodc: - /* Now we get to do it all again for the I$ */ - - move s3,zero /* just in case there is no icache */ - move s4,zero - - li t0,CONF1_IL_MASK - and t0,s0 - beq t0,zero,noic - nop - - srl t0,CONF1_IL_SHIFT - li s3,CONF1_IL_BASE - sll s3,t0 /* s3 has I$ cache line size */ - - li t0,CONF1_IA_MASK - and t0,s0 - srl t0,CONF1_IA_SHIFT - addiu s4,t0,CONF1_IA_BASE /* s4 now has I$ associativity */ - - li t0,CONF1_IS_MASK - and t0,s0 - srl t0,CONF1_IS_SHIFT - li s5,CONF1_IS_BASE - sll s5,t0 /* s5 has I$ sets per way */ - - multu s4,s5 /* sets/way * associativity */ - mflo t0 /* s4 is now total cache lines */ - - multu s3,t0 /* I$ linesize * lines */ - mflo s4 /* s4 is cache size in bytes */ - - /* Initilize the I$: */ - mtc0 zero,C0_TAGLO - mtc0 zero,C0_TAGHI - - li t0,KSEG0 /* Just an address for the first $ line */ - addu t1,t0,s4 /* + size of cache == end */ - - .set mips3 -1: cache Index_Invalidate_I,0(t0) - .set mips0 - bne t0,t1,1b - addu t0,s3 - -noic: - /* Setup new "C" stack */ - la sp, _stack - - addiu sp, -32 /* reserve stack for parameters */ -#if 0 - sw a0, 0(sp) - sw a1, 4(sp) - sw a2, 8(sp) - sw a3, 12(sp) -#endif - sw s4, 16(sp) /* icache size */ - sw s3, 20(sp) /* icache line size */ - sw s2, 24(sp) /* dcache size */ - sw s1, 28(sp) /* dcache line size */ - - /* jump to the decompressor routine */ - la t0, decompress_entry - jr t0 - nop - - .set reorder -END(startup) diff --git a/target/linux/adm5120/image/lzma-loader/src/loader.lds b/target/linux/adm5120/image/lzma-loader/src/loader.lds deleted file mode 100644 index bae70fb6e..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/loader.lds +++ /dev/null @@ -1,29 +0,0 @@ -OUTPUT_ARCH(mips) -SECTIONS { - .text : { - _code_start = .; - *(.text) - *(.text.*) - *(.rodata) - *(.rodata.*) - . = ALIGN(16); - *(.data.lzma) - } - - .data : { - *(.data) - *(.data.*) - } - _code_end = .; - - .bss : { - *(.bss) - *(.bss.*) - } - - . = ALIGN(16); - . = . + 8192; - _stack = .; - - workspace = .; -} diff --git a/target/linux/adm5120/image/lzma-loader/src/lzma-data.lds b/target/linux/adm5120/image/lzma-loader/src/lzma-data.lds deleted file mode 100644 index abf756ba1..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/lzma-data.lds +++ /dev/null @@ -1,8 +0,0 @@ -OUTPUT_ARCH(mips) -SECTIONS { - .data.lzma : { - _lzma_data_start = .; - *(.data) - _lzma_data_end = .; - } -} diff --git a/target/linux/adm5120/image/lzma-loader/src/printf.c b/target/linux/adm5120/image/lzma-loader/src/printf.c deleted file mode 100644 index 7bb5a86e1..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/printf.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (C) 2001 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ - -#include "printf.h" - -extern void board_putc(int ch); - -/* this is the maximum width for a variable */ -#define LP_MAX_BUF 256 - -/* macros */ -#define IsDigit(x) ( ((x) >= '0') && ((x) <= '9') ) -#define Ctod(x) ( (x) - '0') - -/* forward declaration */ -static int PrintChar(char *, char, int, int); -static int PrintString(char *, char *, int, int); -static int PrintNum(char *, unsigned long, int, int, int, int, char, int); - -/* private variable */ -static const char theFatalMsg[] = "fatal error in lp_Print!"; - -/* -*- - * A low level printf() function. - */ -static void -lp_Print(void (*output)(void *, char *, int), - void * arg, - char *fmt, - va_list ap) -{ - -#define OUTPUT(arg, s, l) \ - { if (((l) < 0) || ((l) > LP_MAX_BUF)) { \ - (*output)(arg, (char*)theFatalMsg, sizeof(theFatalMsg)-1); for(;;); \ - } else { \ - (*output)(arg, s, l); \ - } \ - } - - char buf[LP_MAX_BUF]; - - char c; - char *s; - long int num; - - int longFlag; - int negFlag; - int width; - int prec; - int ladjust; - char padc; - - int length; - - for(;;) { - { - /* scan for the next '%' */ - char *fmtStart = fmt; - while ( (*fmt != '\0') && (*fmt != '%')) { - fmt ++; - } - - /* flush the string found so far */ - OUTPUT(arg, fmtStart, fmt-fmtStart); - - /* are we hitting the end? */ - if (*fmt == '\0') break; - } - - /* we found a '%' */ - fmt ++; - - /* check for long */ - if (*fmt == 'l') { - longFlag = 1; - fmt ++; - } else { - longFlag = 0; - } - - /* check for other prefixes */ - width = 0; - prec = -1; - ladjust = 0; - padc = ' '; - - if (*fmt == '-') { - ladjust = 1; - fmt ++; - } - - if (*fmt == '0') { - padc = '0'; - fmt++; - } - - if (IsDigit(*fmt)) { - while (IsDigit(*fmt)) { - width = 10 * width + Ctod(*fmt++); - } - } - - if (*fmt == '.') { - fmt ++; - if (IsDigit(*fmt)) { - prec = 0; - while (IsDigit(*fmt)) { - prec = prec*10 + Ctod(*fmt++); - } - } - } - - - /* check format flag */ - negFlag = 0; - switch (*fmt) { - case 'b': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 2, 0, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'd': - case 'D': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - if (num < 0) { - num = - num; - negFlag = 1; - } - length = PrintNum(buf, num, 10, negFlag, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'o': - case 'O': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 8, 0, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'u': - case 'U': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 10, 0, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'x': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'X': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 1); - OUTPUT(arg, buf, length); - break; - - case 'c': - c = (char)va_arg(ap, int); - length = PrintChar(buf, c, width, ladjust); - OUTPUT(arg, buf, length); - break; - - case 's': - s = (char*)va_arg(ap, char *); - length = PrintString(buf, s, width, ladjust); - OUTPUT(arg, buf, length); - break; - - case '\0': - fmt --; - break; - - default: - /* output this char as it is */ - OUTPUT(arg, fmt, 1); - } /* switch (*fmt) */ - - fmt ++; - } /* for(;;) */ - - /* special termination call */ - OUTPUT(arg, "\0", 1); -} - - -/* --------------- local help functions --------------------- */ -static int -PrintChar(char * buf, char c, int length, int ladjust) -{ - int i; - - if (length < 1) length = 1; - if (ladjust) { - *buf = c; - for (i=1; i< length; i++) buf[i] = ' '; - } else { - for (i=0; i< length-1; i++) buf[i] = ' '; - buf[length - 1] = c; - } - return length; -} - -static int -PrintString(char * buf, char* s, int length, int ladjust) -{ - int i; - int len=0; - char* s1 = s; - while (*s1++) len++; - if (length < len) length = len; - - if (ladjust) { - for (i=0; i< len; i++) buf[i] = s[i]; - for (i=len; i< length; i++) buf[i] = ' '; - } else { - for (i=0; i< length-len; i++) buf[i] = ' '; - for (i=length-len; i < length; i++) buf[i] = s[i-length+len]; - } - return length; -} - -static int -PrintNum(char * buf, unsigned long u, int base, int negFlag, - int length, int ladjust, char padc, int upcase) -{ - /* algorithm : - * 1. prints the number from left to right in reverse form. - * 2. fill the remaining spaces with padc if length is longer than - * the actual length - * TRICKY : if left adjusted, no "0" padding. - * if negtive, insert "0" padding between "0" and number. - * 3. if (!ladjust) we reverse the whole string including paddings - * 4. otherwise we only reverse the actual string representing the num. - */ - - int actualLength =0; - char *p = buf; - int i; - - do { - int tmp = u %base; - if (tmp <= 9) { - *p++ = '0' + tmp; - } else if (upcase) { - *p++ = 'A' + tmp - 10; - } else { - *p++ = 'a' + tmp - 10; - } - u /= base; - } while (u != 0); - - if (negFlag) { - *p++ = '-'; - } - - /* figure out actual length and adjust the maximum length */ - actualLength = p - buf; - if (length < actualLength) length = actualLength; - - /* add padding */ - if (ladjust) { - padc = ' '; - } - if (negFlag && !ladjust && (padc == '0')) { - for (i = actualLength-1; i< length-1; i++) buf[i] = padc; - buf[length -1] = '-'; - } else { - for (i = actualLength; i< length; i++) buf[i] = padc; - } - - - /* prepare to reverse the string */ - { - int begin = 0; - int end; - if (ladjust) { - end = actualLength - 1; - } else { - end = length -1; - } - - while (end > begin) { - char tmp = buf[begin]; - buf[begin] = buf[end]; - buf[end] = tmp; - begin ++; - end --; - } - } - - /* adjust the string pointer */ - return length; -} - -static void printf_output(void *arg, char *s, int l) -{ - int i; - - // special termination call - if ((l==1) && (s[0] == '\0')) return; - - for (i=0; i< l; i++) { - board_putc(s[i]); - if (s[i] == '\n') board_putc('\r'); - } -} - -void printf(char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - lp_Print(printf_output, 0, fmt, ap); - va_end(ap); -} diff --git a/target/linux/adm5120/image/lzma-loader/src/printf.h b/target/linux/adm5120/image/lzma-loader/src/printf.h deleted file mode 100644 index 9b1c1df23..000000000 --- a/target/linux/adm5120/image/lzma-loader/src/printf.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2001 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ - -#ifndef _printf_h_ -#define _printf_h_ - -#include -void printf(char *fmt, ...); - -#endif /* _printf_h_ */ diff --git a/target/linux/adm5120/image/rb1xx.mk b/target/linux/adm5120/image/rb1xx.mk deleted file mode 100644 index 35529585a..000000000 --- a/target/linux/adm5120/image/rb1xx.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (C) 2007,2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - - -define Image/cmdline/yaffs2 - root=/dev/mtdblock3 rootfstype=yaffs2 -endef - -define Image/BuildKernel/RouterBoard - $(CP) $(KDIR)/vmlinux-initramfs.elf $(call imgname,kernel-initramfs,rb1xx) - $(STAGING_DIR_HOST)/bin/patch-cmdline $(call imgname,kernel-initramfs,rb1xx) \ - '$(strip $(call Image/cmdline/yaffs2))' -endef - -ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) - define Image/BuildKernel - $(call Image/BuildKernel/RouterBoard) - endef -endif - diff --git a/target/linux/adm5120/image/router_be.mk b/target/linux/adm5120/image/router_be.mk deleted file mode 100644 index 5a166722f..000000000 --- a/target/linux/adm5120/image/router_be.mk +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright (C) 2007,2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Image/Build/ZyXEL - $(call Image/Build/Loader,$(2),bin,0x80500000,0,y,$(2)) - $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) - $(STAGING_DIR_HOST)/bin/mkzynfw -B $(2) \ - -b $(KDIR)/loader-$(2).bin \ - -r $(call imgname,$(1),$(2)).trx:0x10000 \ - -o $(call imgname,$(1),$(2))-webui.bin -endef - -define Image/Build/Template/ZyXEL - $(call Image/Build/ZyXEL,$(1),$(2)) -endef - -define Image/Build/Template/ZyXEL/squashfs - $(call Image/Build/Template/ZyXEL,squashfs,$(1)) -endef - -define Image/Build/Template/ZyXEL/jffs2 - $(call Image/Build/Template/ZyXEL,jffs2,$(1)) -endef - -define Image/Build/Template/ZyXEL/Initramfs - $(call Image/Build/LZMAKernel/KArgs,$(1),bin) -endef - -# -# Profiles -# -define Image/Build/Profile/P334WT - $(call Image/Build/Template/ZyXEL/$(1),p-334wt) -endef - -define Image/Build/Profile/P335WT - $(call Image/Build/Template/ZyXEL/$(1),p-335wt) -endef - -define Image/Build/Profile/Generic - $(call Image/Build/Profile/P334WT,$(1)) - $(call Image/Build/Profile/P335WT,$(1)) -endef - diff --git a/target/linux/adm5120/image/router_le.mk b/target/linux/adm5120/image/router_le.mk deleted file mode 100644 index 1e3d7f722..000000000 --- a/target/linux/adm5120/image/router_le.mk +++ /dev/null @@ -1,401 +0,0 @@ -# -# Copyright (C) 2007-2009 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define trxedimax/jffs2-128k --a 0x20000 -f $(KDIR)/root.jffs2-128k -endef - -define trxedimax/jffs2-64k --a 0x10000 -f $(KDIR)/root.jffs2-64k -endef - -define trxedimax/squashfs --a 1024 -f $(KDIR)/root.squashfs -endef - -define Image/Build/TRXEdimax - $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \ - $(call trxedimax/$(2)) -endef - -define Image/Build/Compex - $(call Image/Build/Loader,$(2),gz,0x80500000,0,y,$(2)) - $(call Image/Build/TRX,$(call imgname,$(1),$(2)).trx,$(1),$(KDIR)/loader-$(2).gz) -endef - -define Image/Build/Edimax - $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2)) - $(call Image/Build/TRXEdimax,$(call imgname,$(1),$(2)).trx,$(1)) - $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d -w \ - -r $(KDIR)/loader-$(2).gz::0x1000 \ - -x $(call imgname,$(1),$(2)).trx:0x10000 \ - -x $(JFFS2MARK):0x10000 \ - $(call imgname,$(1),$(2))-webui.bin - $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d \ - -r $(KDIR)/loader-$(2).gz::0x1000 \ - -x $(call imgname,$(1),$(2)).trx:0x10000 \ - -x $(JFFS2MARK):0x10000 \ - $(call imgname,$(1),$(2))-xmodem.bin - rm -f $(call imgname,$(1),$(2)).trx -endef - -define Image/Build/Osbridge - $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2)) - $(call Image/Build/TRXEdimax,$(call imgname,$(1),$(2)).trx,$(1)) - $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d \ - -r $(KDIR)/loader-$(2).gz::0x1000 \ - -x $(call imgname,$(1),$(2)).trx:0x10000 \ - -x $(JFFS2MARK):0x10000 \ - $(call imgname,$(1),$(2))-firmware.bin - $(STAGING_DIR_HOST)/bin/osbridge-crc \ - -i $(call imgname,$(1),$(2))-firmware.bin \ - -o $(call imgname,$(1),$(2))-temp.bin - $(STAGING_DIR_HOST)/bin/pc1crypt \ - -i $(call imgname,$(1),$(2))-temp.bin \ - -o $(call imgname,$(1),$(2))-webui.bin - rm -f $(call imgname,$(1),$(2))-temp.bin - rm -f $(call imgname,$(1),$(2)).trx -endef - -define Image/Build/Infineon - $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2)) - $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) - dd if=$(KDIR)/loader-$(2).gz of=$(call imgname,$(1),$(2)).img bs=64k conv=sync - cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2)).img -endef - -define Image/Build/Cellvision - $(call Image/Build/Loader,$(2),bin,0x80500000,0x6D8,y,$(3)) - mkdir -p $(BIN_DIR)/tmp - cp $(KDIR)/loader-$(2).bin $(BIN_DIR)/tmp/vmlinux.bin - gzip -9n $(BIN_DIR)/tmp/vmlinux.bin - dd if=$(BIN_DIR)/tmp/vmlinux.bin.gz of=$(call imgname,$(1),$(2))-xmodem.bin bs=64k conv=sync - rm -rf $(BIN_DIR)/tmp - $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) - cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2))-xmodem.bin - $(STAGING_DIR_HOST)/bin/mkcasfw -B $(2) -d \ - -K $(call imgname,$(1),$(2))-xmodem.bin \ - $(call imgname,$(1),$(2))-webui.bin -endef - -define Image/Build/Cellvision2 - # only for CAS-700/771/790/861 - $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(3)) - $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) - dd if=$(KDIR)/loader-$(2).gz of=$(call imgname,$(1),$(2)).bin bs=64k conv=sync - cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2)).bin - echo -ne '\x14\x07\x24\x06$(2)' | dd bs=14 count=1 conv=sync >> $(call imgname,$(1),$(2)).bin - echo -ne 'OpenWrt\x00\x00\x00' >> $(call imgname,$(1),$(2)).bin -endef - -define Image/Build/MyLoader - $(call Image/Build/Loader,$(2),gz,0x80500000,0) - $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1)) - $(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) \ - -p0x20000:0x10000:ahp:0x80001000 \ - -p0x30000:0 \ - -b0x20000:0x10000:h:$(KDIR)/loader-$(2).gz \ - -b0x30000:0::$(call imgname,$(1),$(2)).trx \ - $(call imgname,$(1),$(2)).bin -endef - -# -# Cellvision CAS-630/630W, CAS-670/670W, NFS-101U/101WU, NFS-202U/202WU -# -define Image/Build/Template/Cellvision - $(call Image/Build/Cellvision,$(1),$(2),$(3)) -endef - -define Image/Build/Template/Cellvision/squashfs - $(call Image/Build/Template/Cellvision,squashfs,$(1),$(2)) -endef - -define Image/Build/Template/Cellvision/jffs2-64k - $(call Image/Build/Template/Cellvision,jffs2-64k,$(1),$(2)) -endef - -# -# Cellvision CAS-700/700W, CAS-771/771W, CAS-790, CAS-861/861W -# -define Image/Build/Template/Cellvision2 - $(call Image/Build/Cellvision2,$(1),$(2),$(3)) -endef - -define Image/Build/Template/Cellvision2/squashfs - $(call Image/Build/Template/Cellvision2,squashfs,$(1),$(2)) -endef - -define Image/Build/Template/Cellvision2/jffs2-64k - $(call Image/Build/Template/Cellvision2,jffs2-64k,$(1),$(2)) -endef - -define Image/Build/Template/Cellvision2/Initramfs - $(call Image/Build/LZMAKernel/Cellvision,$(1),$(2),gz) -endef - -# -# Compex NP27G, NP28G, WP54G, WP54AG, WPP54G, WPP54AG -# -define Image/Build/Template/Compex - $(call Image/Build/MyLoader,$(1),$(2)) -endef - -define Image/Build/Template/Compex/squashfs - $(call Image/Build/Template/Compex,squashfs,$(1)) -endef - -define Image/Build/Template/Compex/jffs2-64k - $(call Image/Build/Template/Compex,jffs2-64k,$(1)) -endef - -define Image/Build/Template/Compex/Initramfs - $(call Image/Build/LZMAKernel/Generic,$(1),bin) -endef - -# -# Compex WP54G-WRT -# -define Image/Build/Template/WP54GWRT - $(call Image/Build/Compex,$(1),wp54g-wrt) -endef - -define Image/Build/Template/WP54GWRT/squashfs - $(call Image/Build/Template/WP54GWRT,squashfs) -endef - -define Image/Build/Template/WP54GWRT/jffs2-64k - $(call Image/Build/Template/WP54GWRT,jffs2-64k) -endef - -define Image/Build/Template/WP54GWRT/Initramfs - $(call Image/Build/LZMAKernel/KArgs,wp54g-wrt,bin) -endef - -# -# Edimax BR-6104K, BR-6104KP, BR-6104Wg, BR-6114WG -# -define Image/Build/Template/Edimax - $(call Image/Build/Edimax,$(1),$(2)) -endef - -define Image/Build/Template/Edimax/squashfs - $(call Image/Build/Template/Edimax,squashfs,$(1)) -endef - -define Image/Build/Template/Edimax/Initramfs - $(call Image/Build/LZMAKernel/Admboot,$(1),gz) -endef - -# -# Infineon EASY 5120, EASY 83000 -# -define Image/Build/Template/Infineon - $(call Image/Build/Infineon,$(1),$(2)) -endef - -define Image/Build/Template/Infineon/squashfs - $(call Image/Build/Template/Infineon,squashfs,$(1)) -endef - -define Image/Build/Template/Infineon/jffs2-64k - $(call Image/Build/Template/Infineon,jffs2-64k,$(1)) -endef - -define Image/Build/Template/Infineon/Initramfs - $(call Image/Build/LZMAKernel/Admboot,$(1),gz) -endef - -# -# Generic EB-214A -# -define Image/Build/Template/Edimax/Initramfs - $(call Image/Build/LZMAKernel/Admboot,eb-214a,bin) -endef - - -# -# Mikrotik RouterBOARD 1xx -# -define Image/Build/Template/Mikrotik/Initramfs - $(CP) $(KDIR)/vmlinux.elf $(call imgname,netboot,rb1xx) -endef - -# -# OSBRiDGE 5GXi/5XLi -# -define Image/Build/Template/Osbridge - $(call Image/Build/Osbridge,$(1),$(2)) -endef - -define Image/Build/Template/Osbridge/squashfs - $(call Image/Build/Template/Osbridge,squashfs,$(1)) -endef - -define Image/Build/Template/Osbridge/Initramfs - $(call Image/Build/LZMAKernel/Admboot,$(1),gz) -endef - -# -# Profiles -# -define Image/Build/Profile/CAS630 - $(call Image/Build/Template/Cellvision/$(1),cas-630,cas-630) -endef - -define Image/Build/Profile/CAS630W - $(call Image/Build/Template/Cellvision/$(1),cas-630w,cas-630) -endef - -define Image/Build/Profile/CAS670 - $(call Image/Build/Template/Cellvision/$(1),cas-670,cas-670) -endef - -define Image/Build/Profile/CAS670W - $(call Image/Build/Template/Cellvision/$(1),cas-670w,cas-670) -endef - -define Image/Build/Profile/NFS101U - $(call Image/Build/Template/Cellvision/$(1),nfs-101u,nfs-101u) - $(call Image/Build/Template/Cellvision/$(1),dn-7013,nfs-101u) - $(call Image/Build/Template/Cellvision/$(1),dns-120,nfs-101u) - $(call Image/Build/Template/Cellvision/$(1),mu-5000fs,nfs-101u) - $(call Image/Build/Template/Cellvision/$(1),tn-u100,nfs-101u) - $(call Image/Build/Template/Cellvision/$(1),cg-nsadp,nfs-101u) -endef - -define Image/Build/Profile/NFS101WU - $(call Image/Build/Template/Cellvision/$(1),nfs-101wu,nfs-101u) - $(call Image/Build/Template/Cellvision/$(1),dns-g120,nfs-101u) -endef - -define Image/Build/Profile/CAS700 - $(call Image/Build/Template/Cellvision2/$(1),cas-700,cas-700) -endef - -define Image/Build/Profile/CAS700W - $(call Image/Build/Template/Cellvision2/$(1),cas-700w,cas-700) -endef - -define Image/Build/Profile/CAS771 - $(call Image/Build/Template/Cellvision2/$(1),cas-771,cas-771) -endef - -define Image/Build/Profile/CAS771W - $(call Image/Build/Template/Cellvision2/$(1),cas-771w,cas-771) -endef - -define Image/Build/Profile/CAS790 - $(call Image/Build/Template/Cellvision2/$(1),cas-790,cas-790) -endef - -define Image/Build/Profile/CAS861 - $(call Image/Build/Template/Cellvision2/$(1),cas-861,cas-861) -endef - -define Image/Build/Profile/CAS861W - $(call Image/Build/Template/Cellvision2/$(1),cas-861w,cas-861) -endef - -define Image/Build/Profile/NP27G - $(call Image/Build/Template/Compex/$(1),np27g) -endef - -define Image/Build/Profile/NP28G - $(call Image/Build/Template/Compex/$(1),np28g) -endef - -define Image/Build/Profile/WP54 - $(call Image/Build/Template/Compex/$(1),wp54g) - $(call Image/Build/Template/Compex/$(1),wp54ag) - $(call Image/Build/Template/Compex/$(1),wpp54g) - $(call Image/Build/Template/Compex/$(1),wpp54ag) - $(call Image/Build/Template/WP54GWRT/$(1)) -endef - -define Image/Build/Profile/BR6104K - $(call Image/Build/Template/Edimax/$(1),br-6104k) -endef - -define Image/Build/Profile/BR6104KP - $(call Image/Build/Template/Edimax/$(1),br-6104kp) -endef - -define Image/Build/Profile/BR6104WG - $(call Image/Build/Template/Edimax/$(1),br-6104wg) -endef - -define Image/Build/Profile/BR6114WG - $(call Image/Build/Template/Edimax/$(1),br-6114wg) -endef - -define Image/Build/Profile/EASY83000 - $(call Image/Build/Template/Infineon/$(1),easy-83000) -endef - -define Image/Build/Profile/EASY5120RT - $(call Image/Build/Template/Infineon/$(1),easy-5120-rt) -endef - -define Image/Build/Profile/EASY5120PATA - $(call Image/Build/Template/Infineon/$(1),easy-5120p-ata) -endef - -define Image/Build/Profile/PMUGW - $(call Image/Build/Template/Infineon/$(1),powerline-mugw) -endef - -define Image/Build/Profile/5GXI - $(call Image/Build/Template/Osbridge/$(1),5gxi) -endef - -define Image/Build/Profile/RouterBoard - $(call Image/Build/Template/Mikrotik/$(1)) -endef - -ifeq ($(CONFIG_BROKEN),y) - define Image/Build/Experimental - # Cellvison - $(call Image/Build/Profile/CAS630,$(1)) - $(call Image/Build/Profile/CAS630W,$(1)) - $(call Image/Build/Profile/CAS670,$(1)) - $(call Image/Build/Profile/CAS670W,$(1)) - $(call Image/Build/Profile/CAS700,$(1)) - $(call Image/Build/Profile/CAS700W,$(1)) - $(call Image/Build/Profile/CAS771,$(1)) - $(call Image/Build/Profile/CAS771W,$(1)) - $(call Image/Build/Profile/CAS861,$(1)) - $(call Image/Build/Profile/CAS861W,$(1)) - # Motorola - $(call Image/Build/Profile/PMUGW,$(1)) - # OSBRiDGE - $(call Image/Build/Profile/5GXI,$(1)) - endef -endif - -define Image/Build/Profile/Generic - # Cellvision - $(call Image/Build/Profile/NFS101U,$(1)) - $(call Image/Build/Profile/NFS101WU,$(1)) - # Compex - $(call Image/Build/Profile/WP54,$(1)) - $(call Image/Build/Profile/NP27G,$(1)) - $(call Image/Build/Profile/NP28G,$(1)) - # Edimax - $(call Image/Build/Profile/BR6104K,$(1)) - $(call Image/Build/Profile/BR6104KP,$(1)) - $(call Image/Build/Profile/BR6104WG,$(1)) - $(call Image/Build/Profile/BR6114WG,$(1)) - $(call Image/Build/Profile/EB214A,$(1)) - # Infineon - $(call Image/Build/Profile/EASY83000,$(1)) - $(call Image/Build/Profile/EASY5120RT,$(1)) - $(call Image/Build/Profile/EASY5120PATA,$(1)) - # Mikrotik - $(call Image/Build/Profile/RB1xx/$(1)) - - $(call Image/Build/Experimental,$(1)) -endef diff --git a/target/linux/adm5120/modules.mk b/target/linux/adm5120/modules.mk deleted file mode 100644 index 3ad454073..000000000 --- a/target/linux/adm5120/modules.mk +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define KernelPackage/ledtrig-adm5120-switch - SUBMENU:=$(OTHER_MENU) - TITLE:=LED ADM5120 Switch Port Status Trigger - DEPENDS:=@TARGET_adm5120 - KCONFIG:=CONFIG_LEDS_TRIGGER_ADM5120_SWITCH - FILES:=$(LINUX_DIR)/drivers/leds/ledtrig-adm5120-switch.ko - AUTOLOAD:=$(call AutoLoad,50,ledtrig-adm5120-switch) -endef - -define KernelPackage/ledtrig-adm5120-switch/description - Kernel module to allow LEDs to be controlled by the port states - of the ADM5120 built-in ethernet switch. -endef - -$(eval $(call KernelPackage,ledtrig-adm5120-switch)) - - -define KernelPackage/pata-rb153-cf - SUBMENU:=$(BLOCK_MENU) - TITLE:=RouterBOARD 153 CF Slot support - DEPENDS:=@TARGET_adm5120_rb1xx - KCONFIG:=CONFIG_PATA_RB153_CF - FILES:=$(LINUX_DIR)/drivers/ata/pata_rb153_cf.ko - AUTOLOAD:=$(call AutoLoad,30,pata_rb153_cf,1) - $(call AddDepends/ata) -endef - -define KernelPackage/pata-rb153-cf/description - Kernel support for the RouterBoard 153 CF slot. -endef - -$(eval $(call KernelPackage,pata-rb153-cf,1)) - - -define KernelPackage/usb-adm5120 - SUBMENU:=$(USB_MENU) - TITLE:=Support for the ADM5120 HCD controller - DEPENDS:=@TARGET_adm5120 - KCONFIG:=CONFIG_USB_ADM5120_HCD - FILES:=$(LINUX_DIR)/drivers/usb/host/adm5120-hcd.ko - AUTOLOAD:=$(call AutoLoad,50,adm5120-hcd,1) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-adm5120/description - Kernel support for the ADM5120 HCD USB controller -endef - -$(eval $(call KernelPackage,usb-adm5120)) diff --git a/target/linux/adm5120/patches-3.18/001-adm5120.patch b/target/linux/adm5120/patches-3.18/001-adm5120.patch deleted file mode 100644 index 3e0e3ff8a..000000000 --- a/target/linux/adm5120/patches-3.18/001-adm5120.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -60,6 +60,24 @@ choice - prompt "System type" - default SGI_IP22 - -+config ADM5120 -+ bool "Infineon/ADMtek ADM5120 SoC based machines" -+ select BOOT_RAW -+ select NO_EXCEPT_FILL -+ select CEVT_R4K -+ select CSRC_R4K -+ select SYS_HAS_CPU_MIPS32_R1 -+ select SYS_HAS_EARLY_PRINTK -+ select DMA_NONCOHERENT -+ select IRQ_CPU -+ select SYS_SUPPORTS_LITTLE_ENDIAN -+ select SYS_SUPPORTS_BIG_ENDIAN -+ select SYS_SUPPORTS_32BIT_KERNEL -+ select ARCH_REQUIRE_GPIOLIB -+ select SWAP_IO_SPACE if CPU_BIG_ENDIAN -+ select MIPS_MACHINE -+ select HAVE_CLK -+ - config MIPS_ALCHEMY - bool "Alchemy processor based machines" - select 64BIT_PHYS_ADDR -@@ -834,6 +852,7 @@ config MIPS_PARAVIRT - - endchoice - -+source "arch/mips/adm5120/Kconfig" - source "arch/mips/alchemy/Kconfig" - source "arch/mips/ath79/Kconfig" - source "arch/mips/bcm47xx/Kconfig" ---- a/arch/mips/Kbuild.platforms -+++ b/arch/mips/Kbuild.platforms -@@ -1,5 +1,6 @@ - # All platforms listed in alphabetic order - -+platforms += adm5120 - platforms += alchemy - platforms += ar7 - platforms += ath79 diff --git a/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch b/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch deleted file mode 100644 index 8936af13e..000000000 --- a/target/linux/adm5120/patches-3.18/002-adm5120_flash.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/mtd/maps/Kconfig -+++ b/drivers/mtd/maps/Kconfig -@@ -399,4 +399,8 @@ config MTD_LATCH_ADDR - - If compiled as a module, it will be called latch-addr-flash. - -+config MTD_ADM5120 -+ tristate "Map driver for ADM5120 based boards" -+ depends on ADM5120 -+ - endmenu ---- a/drivers/mtd/maps/Makefile -+++ b/drivers/mtd/maps/Makefile -@@ -30,6 +30,7 @@ obj-$(CONFIG_MTD_SUN_UFLASH) += sun_ufla - obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o - obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o - obj-$(CONFIG_MTD_PCI) += pci.o -+obj-$(CONFIG_MTD_ADM5120) += adm5120-flash.o - obj-$(CONFIG_MTD_IMPA7) += impa7.o - obj-$(CONFIG_MTD_UCLINUX) += uclinux.o - obj-$(CONFIG_MTD_NETtel) += nettel.o diff --git a/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch b/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch deleted file mode 100644 index 416488c0e..000000000 --- a/target/linux/adm5120/patches-3.18/003-adm5120_switch.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/Kconfig -+++ b/drivers/net/Kconfig -@@ -263,6 +263,10 @@ source "drivers/net/dsa/Kconfig" - - source "drivers/net/ethernet/Kconfig" - -+config ADM5120_ENET -+ tristate "ADM5120 Ethernet switch support" -+ depends on ADM5120 -+ - source "drivers/net/fddi/Kconfig" - - source "drivers/net/hippi/Kconfig" ---- a/drivers/net/Makefile -+++ b/drivers/net/Makefile -@@ -34,6 +34,7 @@ obj-$(CONFIG_CAN) += can/ - obj-$(CONFIG_ETRAX_ETHERNET) += cris/ - obj-$(CONFIG_NET_DSA) += dsa/ - obj-$(CONFIG_ETHERNET) += ethernet/ -+obj-$(CONFIG_ADM5120_ENET) += adm5120sw.o - obj-$(CONFIG_FDDI) += fddi/ - obj-$(CONFIG_HIPPI) += hippi/ - obj-$(CONFIG_HAMRADIO) += hamradio/ diff --git a/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch b/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch deleted file mode 100644 index 139e223c0..000000000 --- a/target/linux/adm5120/patches-3.18/005-adm5120_usb.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/drivers/usb/Makefile -+++ b/drivers/usb/Makefile -@@ -12,6 +12,7 @@ obj-$(CONFIG_USB_DWC2) += dwc2/ - obj-$(CONFIG_USB_MON) += mon/ - - obj-$(CONFIG_PCI) += host/ -+obj-$(CONFIG_USB_ADM5120_HCD) += host/ - obj-$(CONFIG_USB_EHCI_HCD) += host/ - obj-$(CONFIG_USB_ISP116X_HCD) += host/ - obj-$(CONFIG_USB_OHCI_HCD) += host/ ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -3,6 +3,10 @@ - # - comment "USB Host Controller Drivers" - -+config USB_ADM5120_HCD -+ tristate "ADM5120 HCD support (EXPERIMENTAL)" -+ depends on USB && ADM5120 && EXPERIMENTAL -+ - config USB_C67X00_HCD - tristate "Cypress C67x00 HCD support" - help ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -31,6 +31,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o - obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o - obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o - -+obj-$(CONFIG_USB_ADM5120_HCD) += adm5120-hcd.o - obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o - obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o - obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o diff --git a/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch b/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch deleted file mode 100644 index a5a0abf43..000000000 --- a/target/linux/adm5120/patches-3.18/007-adm5120_pci.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/arch/mips/pci/Makefile -+++ b/arch/mips/pci/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o - obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o - obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \ - ops-bcm63xx.o -+obj-$(CONFIG_ADM5120) += pci-adm5120.o - obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o - obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o - obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o ---- a/include/linux/pci_ids.h -+++ b/include/linux/pci_ids.h -@@ -1820,6 +1820,9 @@ - - #define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */ - -+#define PCI_VENDOR_ID_ADMTEK 0x1317 -+#define PCI_DEVICE_ID_ADMTEK_ADM5120 0x5120 -+ - #define PCI_VENDOR_ID_SIIG 0x131f - #define PCI_SUBVENDOR_ID_SIIG 0x131f - #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 diff --git a/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch b/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch deleted file mode 100644 index f6dbdfc87..000000000 --- a/target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -508,4 +508,12 @@ config LEDS_VERSATILE - comment "LED Triggers" - source "drivers/leds/trigger/Kconfig" - -+config LEDS_TRIGGER_ADM5120_SWITCH -+ tristate "LED ADM5120 Switch Port Status Trigger" -+ depends on LEDS_TRIGGERS && ADM5120 -+ help -+ This allows LEDs to be controlled by the port states of -+ the ADM5120 built-in Ethernet Switch -+ If unsure, say N. -+ - endif # NEW_LEDS ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -63,3 +63,4 @@ obj-$(CONFIG_LEDS_DAC124S085) += leds-d - # LED Triggers - obj-$(CONFIG_LEDS_TRIGGERS) += trigger/ - obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o -+obj-$(CONFIG_LEDS_TRIGGER_ADM5120_SWITCH) += ledtrig-adm5120-switch.o diff --git a/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch b/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch deleted file mode 100644 index 606225936..000000000 --- a/target/linux/adm5120/patches-3.18/050-revert_rootfs_splits.patch +++ /dev/null @@ -1,354 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -30,11 +30,9 @@ - #include - #include - #include --#include - #include - - #include "mtdcore.h" --#include "mtdsplit/mtdsplit.h" - - #define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ - -@@ -50,14 +48,13 @@ struct mtd_part { - struct list_head list; - }; - --static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); -- - /* - * Given a pointer to the MTD object in the mtd_part structure, we can retrieve - * the pointer to that structure with this macro. - */ - #define PART(x) ((struct mtd_part *)(x)) - -+ - /* - * MTD methods which simply translate the effective address and pass through - * to the _real_ device. -@@ -521,12 +518,14 @@ static struct mtd_part *allocate_partiti - if (slave->offset == MTDPART_OFS_APPEND) - slave->offset = cur_offset; - if (slave->offset == MTDPART_OFS_NXTBLK) { -- /* Round up to next erasesize */ -- slave->offset = mtd_roundup_to_eb(cur_offset, master); -- if (slave->offset != cur_offset) -+ slave->offset = cur_offset; -+ if (mtd_mod_by_eb(cur_offset, master) != 0) { -+ /* Round up to next erasesize */ -+ slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; - printk(KERN_NOTICE "Moving partition %d: " - "0x%012llx -> 0x%012llx\n", partno, - (unsigned long long)cur_offset, (unsigned long long)slave->offset); -+ } - } - if (slave->offset == MTDPART_OFS_RETAIN) { - slave->offset = cur_offset; -@@ -627,10 +626,8 @@ out_register: - return slave; - } - -- --static int --__mtd_add_partition(struct mtd_info *master, const char *name, -- long long offset, long long length, bool dup_check) -+int mtd_add_partition(struct mtd_info *master, const char *name, -+ long long offset, long long length) - { - struct mtd_partition part; - struct mtd_part *p, *new; -@@ -662,24 +659,21 @@ __mtd_add_partition(struct mtd_info *mas - end = offset + length; - - mutex_lock(&mtd_partitions_mutex); -- if (dup_check) { -- list_for_each_entry(p, &mtd_partitions, list) -- if (p->master == master) { -- if ((start >= p->offset) && -- (start < (p->offset + p->mtd.size))) -- goto err_inv; -- -- if ((end >= p->offset) && -- (end < (p->offset + p->mtd.size))) -- goto err_inv; -- } -- } -+ list_for_each_entry(p, &mtd_partitions, list) -+ if (p->master == master) { -+ if ((start >= p->offset) && -+ (start < (p->offset + p->mtd.size))) -+ goto err_inv; -+ -+ if ((end >= p->offset) && -+ (end < (p->offset + p->mtd.size))) -+ goto err_inv; -+ } - - list_add(&new->list, &mtd_partitions); - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&new->mtd); -- mtd_partition_split(master, new); - - return ret; - err_inv: -@@ -689,12 +683,6 @@ err_inv: - } - EXPORT_SYMBOL_GPL(mtd_add_partition); - --int mtd_add_partition(struct mtd_info *master, const char *name, -- long long offset, long long length) --{ -- return __mtd_add_partition(master, name, offset, length, true); --} -- - int mtd_del_partition(struct mtd_info *master, int partno) - { - struct mtd_part *slave, *next; -@@ -718,166 +706,6 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - --static int --run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) --{ -- struct mtd_partition *parts; -- int nr_parts; -- int i; -- -- nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, &parts, -- NULL); -- if (nr_parts <= 0) -- return nr_parts; -- -- if (WARN_ON(!parts)) -- return 0; -- -- for (i = 0; i < nr_parts; i++) { -- /* adjust partition offsets */ -- parts[i].offset += slave->offset; -- -- __mtd_add_partition(slave->master, -- parts[i].name, -- parts[i].offset, -- parts[i].size, -- false); -- } -- -- kfree(parts); -- -- return nr_parts; --} -- --static inline unsigned long --mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) --{ -- unsigned long mask = mtd->erasesize - 1; -- -- len += offset & mask; -- len = (len + mask) & ~mask; -- len -= offset & mask; -- return len; --} -- --static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) --{ -- size_t squashfs_len; -- int len, ret; -- -- ret = mtd_get_squashfs_len(master, offset, &squashfs_len); -- if (ret) -- return ret; -- -- len = mtd_pad_erasesize(master, offset, squashfs_len); -- *split_offset = offset + len; -- -- return 0; --} -- --static void split_rootfs_data(struct mtd_info *master, struct mtd_part *part) --{ -- unsigned int split_offset = 0; -- unsigned int split_size; -- int ret; -- -- ret = split_squashfs(master, part->offset, &split_offset); -- if (ret) -- return; -- -- if (split_offset <= 0) -- return; -- -- if (config_enabled(CONFIG_MTD_SPLIT_SQUASHFS_ROOT)) -- pr_err("Dedicated partitioner didn't create \"rootfs_data\" partition, please fill a bug report!\n"); -- else -- pr_warn("Support for built-in \"rootfs_data\" splitter will be removed, please use CONFIG_MTD_SPLIT_SQUASHFS_ROOT\n"); -- -- split_size = part->mtd.size - (split_offset - part->offset); -- printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=0x%x, len=0x%x\n", -- ROOTFS_SPLIT_NAME, split_offset, split_size); -- -- __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset, -- split_size, false); --} -- --#define UBOOT_MAGIC 0x27051956 -- --static void split_uimage(struct mtd_info *master, struct mtd_part *part) --{ -- struct { -- __be32 magic; -- __be32 pad[2]; -- __be32 size; -- } hdr; -- size_t len; -- -- if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr)) -- return; -- -- if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC)) -- return; -- -- len = be32_to_cpu(hdr.size) + 0x40; -- len = mtd_pad_erasesize(master, part->offset, len); -- if (len + master->erasesize > part->mtd.size) -- return; -- -- if (config_enabled(CONFIG_MTD_SPLIT_UIMAGE_FW)) -- pr_err("Dedicated partitioner didn't split firmware partition, please fill a bug report!\n"); -- else -- pr_warn("Support for built-in firmware splitter will be removed, please use CONFIG_MTD_SPLIT_UIMAGE_FW\n"); -- -- __mtd_add_partition(master, "rootfs", part->offset + len, -- part->mtd.size - len, false); --} -- --#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME --#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME --#else --#define SPLIT_FIRMWARE_NAME "unused" --#endif -- --static void split_firmware(struct mtd_info *master, struct mtd_part *part) --{ -- int ret; -- -- ret = run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); -- if (ret > 0) -- return; -- -- if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT)) -- split_uimage(master, part); --} -- --void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -- int offset, int size) --{ --} -- --static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) --{ -- static int rootfs_found = 0; -- -- if (rootfs_found) -- return; -- -- if (!strcmp(part->mtd.name, "rootfs")) { -- int num = run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -- -- if (num <= 0 && config_enabled(CONFIG_MTD_ROOTFS_SPLIT)) -- split_rootfs_data(master, part); -- -- rootfs_found = 1; -- } -- -- if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && -- config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) -- split_firmware(master, part); -- -- arch_split_mtd_part(master, part->mtd.name, part->offset, -- part->mtd.size); --} - /* - * This function, given a master MTD object and a partition table, creates - * and registers slave MTD objects which are bound to the master according to -@@ -907,7 +735,6 @@ int add_mtd_partitions(struct mtd_info * - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&slave->mtd); -- mtd_partition_split(master, slave); - - cur_offset = slave->offset + slave->mtd.size; - } -@@ -937,30 +764,6 @@ static struct mtd_part_parser *get_parti - - #define put_partition_parser(p) do { module_put((p)->owner); } while (0) - --static struct mtd_part_parser * --get_partition_parser_by_type(enum mtd_parser_type type, -- struct mtd_part_parser *start) --{ -- struct mtd_part_parser *p, *ret = NULL; -- -- spin_lock(&part_parser_lock); -- -- p = list_prepare_entry(start, &part_parsers, list); -- if (start) -- put_partition_parser(start); -- -- list_for_each_entry_continue(p, &part_parsers, list) { -- if (p->type == type && try_module_get(p->owner)) { -- ret = p; -- break; -- } -- } -- -- spin_unlock(&part_parser_lock); -- -- return ret; --} -- - void register_mtd_parser(struct mtd_part_parser *p) - { - spin_lock(&part_parser_lock); -@@ -1076,38 +879,6 @@ int parse_mtd_partitions(struct mtd_info - return ret; - } - --int parse_mtd_partitions_by_type(struct mtd_info *master, -- enum mtd_parser_type type, -- struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) --{ -- struct mtd_part_parser *prev = NULL; -- int ret = 0; -- -- while (1) { -- struct mtd_part_parser *parser; -- -- parser = get_partition_parser_by_type(type, prev); -- if (!parser) -- break; -- -- ret = (*parser->parse_fn)(master, pparts, data); -- -- if (ret > 0) { -- put_partition_parser(parser); -- printk(KERN_NOTICE -- "%d %s partitions found on MTD device %s\n", -- ret, parser->name, master->name); -- break; -- } -- -- prev = parser; -- } -- -- return ret; --} --EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); -- - int mtd_is_partition(const struct mtd_info *mtd) - { - struct mtd_part *part; diff --git a/target/linux/adm5120/patches-3.18/100-rootfs_split.patch b/target/linux/adm5120/patches-3.18/100-rootfs_split.patch deleted file mode 100644 index dfc0e83a0..000000000 --- a/target/linux/adm5120/patches-3.18/100-rootfs_split.patch +++ /dev/null @@ -1,316 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -52,6 +52,14 @@ config MTD_TESTS - WARNING: some of the tests will ERASE entire MTD device which they - test. Do not use these tests unless you really know what you do. - -+config MTD_ROOTFS_ROOT_DEV -+ bool "Automatically set 'rootfs' partition to be root filesystem" -+ default y -+ -+config MTD_ROOTFS_SPLIT -+ bool "Automatically split 'rootfs' partition for squashfs" -+ default y -+ - config MTD_REDBOOT_PARTS - tristate "RedBoot partition table parsing" - ---help--- ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -30,6 +30,8 @@ - #include - #include - #include -+#include -+#include - #include - - #include "mtdcore.h" -@@ -53,7 +55,7 @@ struct mtd_part { - * the pointer to that structure with this macro. - */ - #define PART(x) ((struct mtd_part *)(x)) -- -+#define IS_PART(mtd) (mtd->_read == part_read) - - /* - * MTD methods which simply translate the effective address and pass through -@@ -706,6 +708,144 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+#ifdef CONFIG_MTD_ROOTFS_SPLIT -+#define ROOTFS_SPLIT_NAME "rootfs_data" -+#define ROOTFS_REMOVED_NAME "" -+ -+struct squashfs_super_block { -+ __le32 s_magic; -+ __le32 pad0[9]; -+ __le64 bytes_used; -+}; -+ -+ -+static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) -+{ -+ struct squashfs_super_block sb; -+ int len, ret; -+ -+ ret = mtd_read(master, offset, sizeof(sb), &len, (void *) &sb); -+ if (ret || (len != sizeof(sb))) { -+ printk(KERN_ALERT "split_squashfs: error occured while reading " -+ "from \"%s\"\n", master->name); -+ return -EINVAL; -+ } -+ -+ if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) { -+ printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n", -+ master->name); -+ *split_offset = 0; -+ return 0; -+ } -+ -+ if (le64_to_cpu((sb.bytes_used)) <= 0) { -+ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", -+ master->name); -+ *split_offset = 0; -+ return 0; -+ } -+ -+ len = (u32) le64_to_cpu(sb.bytes_used); -+ len += (offset & 0x000fffff); -+ len += (master->erasesize - 1); -+ len &= ~(master->erasesize - 1); -+ len -= (offset & 0x000fffff); -+ *split_offset = offset + len; -+ -+ return 0; -+} -+ -+static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part) -+{ -+ struct mtd_partition dpart; -+ struct mtd_part *slave = NULL; -+ struct mtd_part *spart; -+ int ret, split_offset = 0; -+ -+ spart = PART(rpart); -+ ret = split_squashfs(master, spart->offset, &split_offset); -+ if (ret) -+ return ret; -+ -+ if (split_offset <= 0) -+ return 0; -+ -+ memcpy(&dpart, part, sizeof(dpart)); -+ dpart.name = ROOTFS_SPLIT_NAME; -+ -+ dpart.size = rpart->size - (split_offset - spart->offset); -+ dpart.offset = split_offset; -+ -+ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n", -+ ROOTFS_SPLIT_NAME, dpart.offset, dpart.size); -+ -+ slave = allocate_partition(master, &dpart, 0, split_offset); -+ if (IS_ERR(slave)) -+ return PTR_ERR(slave); -+ mutex_lock(&mtd_partitions_mutex); -+ list_add(&slave->list, &mtd_partitions); -+ mutex_unlock(&mtd_partitions_mutex); -+ -+ add_mtd_device(&slave->mtd); -+ -+ rpart->split = &slave->mtd; -+ -+ return 0; -+} -+ -+static int refresh_rootfs_split(struct mtd_info *mtd) -+{ -+ struct mtd_partition tpart; -+ struct mtd_part *part; -+ char *name; -+ //int index = 0; -+ int offset, size; -+ int ret; -+ -+ part = PART(mtd); -+ -+ /* check for the new squashfs offset first */ -+ ret = split_squashfs(part->master, part->offset, &offset); -+ if (ret) -+ return ret; -+ -+ if ((offset > 0) && !mtd->split) { -+ printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name); -+ /* if we don't have a rootfs split partition, create a new one */ -+ tpart.name = (char *) mtd->name; -+ tpart.size = mtd->size; -+ tpart.offset = part->offset; -+ -+ return split_rootfs_data(part->master, &part->mtd, &tpart); -+ } else if ((offset > 0) && mtd->split) { -+ /* update the offsets of the existing partition */ -+ size = mtd->size + part->offset - offset; -+ -+ part = PART(mtd->split); -+ part->offset = offset; -+ part->mtd.size = size; -+ printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n", -+ __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"), -+ (u32) part->offset, (u32) part->mtd.size); -+ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); -+ strcpy(name, ROOTFS_SPLIT_NAME); -+ part->mtd.name = name; -+ } else if ((offset <= 0) && mtd->split) { -+ printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name); -+ -+ /* mark existing partition as removed */ -+ part = PART(mtd->split); -+ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); -+ strcpy(name, ROOTFS_REMOVED_NAME); -+ part->mtd.name = name; -+ part->offset = 0; -+ part->mtd.size = 0; -+ } -+ -+ return 0; -+} -+#endif /* CONFIG_MTD_ROOTFS_SPLIT */ -+ - /* - * This function, given a master MTD object and a partition table, creates - * and registers slave MTD objects which are bound to the master according to -@@ -722,6 +862,9 @@ int add_mtd_partitions(struct mtd_info * - struct mtd_part *slave; - uint64_t cur_offset = 0; - int i; -+#ifdef CONFIG_MTD_ROOTFS_SPLIT -+ int ret; -+#endif - - printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); - -@@ -736,12 +879,53 @@ int add_mtd_partitions(struct mtd_info * - - add_mtd_device(&slave->mtd); - -+ if (!strcmp(parts[i].name, "rootfs")) { -+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV -+ if (ROOT_DEV == 0) { -+ printk(KERN_NOTICE "mtd: partition \"rootfs\" " -+ "set to be root filesystem\n"); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index); -+ } -+#endif -+#ifdef CONFIG_MTD_ROOTFS_SPLIT -+ ret = split_rootfs_data(master, &slave->mtd, &parts[i]); -+ /* if (ret == 0) -+ * j++; */ -+#endif -+ } -+ - cur_offset = slave->offset + slave->mtd.size; - } - - return 0; - } - -+int mtd_device_refresh(struct mtd_info *mtd) -+{ -+ int ret = 0; -+ -+ if (IS_PART(mtd)) { -+ struct mtd_part *part; -+ struct mtd_info *master; -+ -+ part = PART(mtd); -+ master = part->master; -+ if (master->refresh_device) -+ ret = master->refresh_device(master); -+ } -+ -+ if (!ret && mtd->refresh_device) -+ ret = mtd->refresh_device(mtd); -+ -+#ifdef CONFIG_MTD_ROOTFS_SPLIT -+ if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs")) -+ refresh_rootfs_split(mtd); -+#endif -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(mtd_device_refresh); -+ - static DEFINE_SPINLOCK(part_parser_lock); - static LIST_HEAD(part_parsers); - ---- a/drivers/mtd/mtdchar.c -+++ b/drivers/mtd/mtdchar.c -@@ -1008,6 +1008,12 @@ static int mtdchar_ioctl(struct file *fi - break; - } - -+ case MTDREFRESH: -+ { -+ ret = mtd_device_refresh(mtd); -+ break; -+ } -+ - default: - ret = -ENOTTY; - } ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -115,6 +115,7 @@ struct nand_ecclayout { - - struct module; /* only needed for owner field in mtd_info */ - -+struct mtd_info; - struct mtd_info { - u_char type; - uint32_t flags; -@@ -231,6 +232,9 @@ struct mtd_info { - int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); - int (*_suspend) (struct mtd_info *mtd); - void (*_resume) (struct mtd_info *mtd); -+ int (*refresh_device)(struct mtd_info *mtd); -+ struct mtd_info *split; -+ - /* - * If the driver is something smart, like UBI, it may need to maintain - * its own reference counting. The below functions are only for driver. -@@ -397,6 +401,7 @@ extern int mtd_device_parse_register(str - int defnr_parts); - #define mtd_device_register(master, parts, nr_parts) \ - mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) -+extern int mtd_device_refresh(struct mtd_info *master); - extern int mtd_device_unregister(struct mtd_info *master); - extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); - extern int __get_mtd_device(struct mtd_info *mtd); ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -37,12 +37,14 @@ - */ - struct mtd_info; - -+struct mtd_partition; - struct mtd_partition { - const char *name; /* identifier string */ - uint64_t size; /* partition size */ - uint64_t offset; /* offset within the master MTD space */ - uint32_t mask_flags; /* master MTD flags to mask out for this partition */ - struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */ -+ int (*refresh_partition)(struct mtd_info *); - }; - - #define MTDPART_OFS_RETAIN (-3) ---- a/include/uapi/mtd/mtd-abi.h -+++ b/include/uapi/mtd/mtd-abi.h -@@ -203,6 +203,7 @@ struct otp_info { - * without OOB, e.g., NOR flash. - */ - #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) -+#define MTDREFRESH _IO('M', 50) - - /* - * Obsolete legacy interface. Keep it in order not to break userspace diff --git a/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch b/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch deleted file mode 100644 index a0caa680b..000000000 --- a/target/linux/adm5120/patches-3.18/101-cfi_fixup_macronix_bootloc.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -49,6 +49,12 @@ - #define SST49LF008A 0x005a - #define AT49BV6416 0x00d6 - -+/* Macronix */ -+#define MX29LV160B 0x2249 /* MX29LV160 Bottom-boot chip */ -+#define MX29LV160T 0x22C4 /* MX29LV160 Top-boot chip */ -+#define MX29LV320B 0x22A8 /* MX29LV320 Bottom-boot chip */ -+#define MX29LV320T 0x22A7 /* MX29LV320 Top-boot chip */ -+ - static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); - static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); - static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); -@@ -374,6 +380,41 @@ static struct cfi_fixup cfi_nopri_fixup_ - { 0, 0, NULL } - }; - -+#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC -+/* -+ * Some Macronix chips has no/bad bootblock information in the CFI table -+ */ -+static void fixup_macronix_bootloc(struct mtd_info *mtd) -+{ -+ struct map_info *map = mtd->priv; -+ struct cfi_private *cfi = map->fldrv_priv; -+ struct cfi_pri_amdstd *extp = cfi->cmdset_priv; -+ __u8 t; -+ -+ switch (cfi->id) { -+ /* TODO: put affected chip ids here */ -+ case MX29LV160B: -+ case MX29LV320B: -+ t = 2; /* Bottom boot */ -+ break; -+ case MX29LV160T: -+ case MX29LV320T: -+ t = 3; /* Top boot */ -+ break; -+ default: -+ return; -+ } -+ -+ if (extp->TopBottom == t) -+ /* boot location detected by the CFI layer is correct */ -+ return; -+ -+ extp->TopBottom = t; -+ printk("%s: Macronix chip detected, id:0x%04X, boot location forced " -+ "to %s\n", map->name, cfi->id, (t == 2) ? "bottom" : "top"); -+} -+#endif /* CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC */ -+ - static struct cfi_fixup cfi_fixup_table[] = { - { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri }, - #ifdef AMD_BOOTLOC_BUG -@@ -416,6 +457,9 @@ static struct cfi_fixup fixup_table[] = - */ - { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_erase_chip }, - { CFI_MFR_ATMEL, AT49BV6416, fixup_use_atmel_lock }, -+#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC -+ { CFI_MFR_MACRONIX, CFI_ID_ANY, fixup_macronix_bootloc }, -+#endif - { 0, 0, NULL } - }; - ---- a/drivers/mtd/chips/Kconfig -+++ b/drivers/mtd/chips/Kconfig -@@ -188,6 +188,14 @@ config MTD_CFI_AMDSTD - provides support for command set 0002, used on chips including - the AMD Am29LV320. - -+config MTD_CFI_FIXUP_MACRONIX_BOOTLOC -+ bool "Fix boot-block location for Macronix flash chips" -+ depends on MTD_CFI_AMDSTD -+ help -+ Some Macronix flash chips have no/wrong boot-block location in the -+ CFI table, and the driver may detect the type incorrectly. Select -+ this if your board has such chip. -+ - config MTD_CFI_STAA - tristate "Support for CFI command set 0020 (ST (Advanced Architecture) chips)" - depends on MTD_GEN_PROBE diff --git a/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch b/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch deleted file mode 100644 index 00148fa60..000000000 --- a/target/linux/adm5120/patches-3.18/102-jedec_pmc_39lvxxx_chips.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- a/drivers/mtd/chips/jedec_probe.c -+++ b/drivers/mtd/chips/jedec_probe.c -@@ -115,6 +115,10 @@ - #define UPD29F064115 0x221C - - /* PMC */ -+#define PM39LV512 0x001B -+#define PM39LV010 0x001C -+#define PM39LV020 0x003D -+#define PM39LV040 0x003E - #define PM49FL002 0x006D - #define PM49FL004 0x006E - #define PM49FL008 0x006A -@@ -1259,6 +1263,54 @@ static const struct amd_flash_info jedec - ERASEINFO(0x02000,2), - ERASEINFO(0x04000,1), - } -+ }, { -+ .mfr_id = CFI_MFR_PMC, -+ .dev_id = PM39LV512, -+ .name = "PMC Pm39LV512", -+ .devtypes = CFI_DEVICETYPE_X8, -+ .uaddr = MTD_UADDR_0x0555_0x02AA, -+ .dev_size = SIZE_64KiB, -+ .cmd_set = P_ID_AMD_STD, -+ .nr_regions = 1, -+ .regions = { -+ ERASEINFO(0x01000,16), -+ } -+ }, { -+ .mfr_id = CFI_MFR_PMC, -+ .dev_id = PM39LV010, -+ .name = "PMC Pm39LV010", -+ .devtypes = CFI_DEVICETYPE_X8, -+ .uaddr = MTD_UADDR_0x0555_0x02AA, -+ .dev_size = SIZE_128KiB, -+ .cmd_set = P_ID_AMD_STD, -+ .nr_regions = 1, -+ .regions = { -+ ERASEINFO(0x01000,32), -+ } -+ }, { -+ .mfr_id = CFI_MFR_PMC, -+ .dev_id = PM39LV020, -+ .name = "PMC Pm39LV020", -+ .devtypes = CFI_DEVICETYPE_X8, -+ .uaddr = MTD_UADDR_0x0555_0x02AA, -+ .dev_size = SIZE_256KiB, -+ .cmd_set = P_ID_AMD_STD, -+ .nr_regions = 1, -+ .regions = { -+ ERASEINFO(0x01000,64), -+ } -+ }, { -+ .mfr_id = CFI_MFR_PMC, -+ .dev_id = PM39LV040, -+ .name = "PMC Pm39LV040", -+ .devtypes = CFI_DEVICETYPE_X8, -+ .uaddr = MTD_UADDR_0x0555_0x02AA, -+ .dev_size = SIZE_512KiB, -+ .cmd_set = P_ID_AMD_STD, -+ .nr_regions = 1, -+ .regions = { -+ ERASEINFO(0x01000,128), -+ } - }, { - .mfr_id = CFI_MFR_PMC, - .dev_id = PM49FL002, diff --git a/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch b/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch deleted file mode 100644 index 62667769c..000000000 --- a/target/linux/adm5120/patches-3.18/103-mtd_trxsplit.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -60,6 +60,10 @@ config MTD_ROOTFS_SPLIT - bool "Automatically split 'rootfs' partition for squashfs" - default y - -+config MTD_TRXSPLIT -+ bool "Automatically find and split TRX partitions" -+ default n -+ - config MTD_REDBOOT_PARTS - tristate "RedBoot partition table parsing" - ---help--- ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o -+obj-$(CONFIG_MTD_TRXSPLIT) += trxsplit.o - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch b/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch deleted file mode 100644 index c5d4d3a57..000000000 --- a/target/linux/adm5120/patches-3.18/120-rb153_cf_driver.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/ata/Makefile -+++ b/drivers/ata/Makefile -@@ -98,6 +98,7 @@ obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia - obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o - obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o - obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o -+obj-$(CONFIG_PATA_RB153_CF) += pata_rb153_cf.o - obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o - obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o - obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o ---- a/drivers/ata/Kconfig -+++ b/drivers/ata/Kconfig -@@ -955,6 +955,15 @@ config PATA_QDI - help - Support for QDI 6500 and 6580 PATA controllers on VESA local bus. - -+config PATA_RB153_CF -+ tristate "RouterBOARD 153 Compact Flash support" -+ depends on ADM5120_MACH_RB_153 -+ help -+ This option enables support for a Compact Flash connected on -+ the RouterBOARD 153. -+ -+ If unsure, say N. -+ - config PATA_RB532 - tristate "RouterBoard 532 PATA CompactFlash support" - depends on MIKROTIK_RB532 diff --git a/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch b/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch deleted file mode 100644 index 8eee7a10f..000000000 --- a/target/linux/adm5120/patches-3.18/200-amba_pl010_hacks.patch +++ /dev/null @@ -1,354 +0,0 @@ ---- a/drivers/tty/serial/amba-pl010.c -+++ b/drivers/tty/serial/amba-pl010.c -@@ -48,11 +48,9 @@ - #include - #include - --#define UART_NR 8 -- - #define SERIAL_AMBA_MAJOR 204 - #define SERIAL_AMBA_MINOR 16 --#define SERIAL_AMBA_NR UART_NR -+#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS - - #define AMBA_ISR_PASS_LIMIT 256 - -@@ -78,9 +76,9 @@ static void pl010_stop_tx(struct uart_po - struct uart_amba_port *uap = (struct uart_amba_port *)port; - unsigned int cr; - -- cr = readb(uap->port.membase + UART010_CR); -+ cr = __raw_readl(uap->port.membase + UART010_CR); - cr &= ~UART010_CR_TIE; -- writel(cr, uap->port.membase + UART010_CR); -+ __raw_writel(cr, uap->port.membase + UART010_CR); - } - - static void pl010_start_tx(struct uart_port *port) -@@ -88,9 +86,9 @@ static void pl010_start_tx(struct uart_p - struct uart_amba_port *uap = (struct uart_amba_port *)port; - unsigned int cr; - -- cr = readb(uap->port.membase + UART010_CR); -+ cr = __raw_readl(uap->port.membase + UART010_CR); - cr |= UART010_CR_TIE; -- writel(cr, uap->port.membase + UART010_CR); -+ __raw_writel(cr, uap->port.membase + UART010_CR); - } - - static void pl010_stop_rx(struct uart_port *port) -@@ -98,9 +96,9 @@ static void pl010_stop_rx(struct uart_po - struct uart_amba_port *uap = (struct uart_amba_port *)port; - unsigned int cr; - -- cr = readb(uap->port.membase + UART010_CR); -+ cr = __raw_readl(uap->port.membase + UART010_CR); - cr &= ~(UART010_CR_RIE | UART010_CR_RTIE); -- writel(cr, uap->port.membase + UART010_CR); -+ __raw_writel(cr, uap->port.membase + UART010_CR); - } - - static void pl010_enable_ms(struct uart_port *port) -@@ -108,18 +106,18 @@ static void pl010_enable_ms(struct uart_ - struct uart_amba_port *uap = (struct uart_amba_port *)port; - unsigned int cr; - -- cr = readb(uap->port.membase + UART010_CR); -+ cr = __raw_readl(uap->port.membase + UART010_CR); - cr |= UART010_CR_MSIE; -- writel(cr, uap->port.membase + UART010_CR); -+ __raw_writel(cr, uap->port.membase + UART010_CR); - } - - static void pl010_rx_chars(struct uart_amba_port *uap) - { - unsigned int status, ch, flag, rsr, max_count = 256; - -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - while (UART_RX_DATA(status) && max_count--) { -- ch = readb(uap->port.membase + UART01x_DR); -+ ch = __raw_readl(uap->port.membase + UART01x_DR); - flag = TTY_NORMAL; - - uap->port.icount.rx++; -@@ -128,9 +126,9 @@ static void pl010_rx_chars(struct uart_a - * Note that the error handling code is - * out of the main execution path - */ -- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; -+ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; - if (unlikely(rsr & UART01x_RSR_ANY)) { -- writel(0, uap->port.membase + UART01x_ECR); -+ __raw_writel(0, uap->port.membase + UART01x_ECR); - - if (rsr & UART01x_RSR_BE) { - rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); -@@ -160,7 +158,7 @@ static void pl010_rx_chars(struct uart_a - uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); - - ignore_char: -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - } - spin_unlock(&uap->port.lock); - tty_flip_buffer_push(&uap->port.state->port); -@@ -173,7 +171,7 @@ static void pl010_tx_chars(struct uart_a - int count; - - if (uap->port.x_char) { -- writel(uap->port.x_char, uap->port.membase + UART01x_DR); -+ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR); - uap->port.icount.tx++; - uap->port.x_char = 0; - return; -@@ -185,7 +183,7 @@ static void pl010_tx_chars(struct uart_a - - count = uap->port.fifosize >> 1; - do { -- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); -+ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); - xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); - uap->port.icount.tx++; - if (uart_circ_empty(xmit)) -@@ -203,9 +201,9 @@ static void pl010_modem_status(struct ua - { - unsigned int status, delta; - -- writel(0, uap->port.membase + UART010_ICR); -+ __raw_writel(0, uap->port.membase + UART010_ICR); - -- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; -+ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; - - delta = status ^ uap->old_status; - uap->old_status = status; -@@ -233,7 +231,7 @@ static irqreturn_t pl010_int(int irq, vo - - spin_lock(&uap->port.lock); - -- status = readb(uap->port.membase + UART010_IIR); -+ status = __raw_readl(uap->port.membase + UART010_IIR); - if (status) { - do { - if (status & (UART010_IIR_RTIS | UART010_IIR_RIS)) -@@ -246,7 +244,7 @@ static irqreturn_t pl010_int(int irq, vo - if (pass_counter-- == 0) - break; - -- status = readb(uap->port.membase + UART010_IIR); -+ status = __raw_readl(uap->port.membase + UART010_IIR); - } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS | - UART010_IIR_TIS)); - handled = 1; -@@ -260,7 +258,7 @@ static irqreturn_t pl010_int(int irq, vo - static unsigned int pl010_tx_empty(struct uart_port *port) - { - struct uart_amba_port *uap = (struct uart_amba_port *)port; -- unsigned int status = readb(uap->port.membase + UART01x_FR); -+ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR); - return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT; - } - -@@ -270,7 +268,7 @@ static unsigned int pl010_get_mctrl(stru - unsigned int result = 0; - unsigned int status; - -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - if (status & UART01x_FR_DCD) - result |= TIOCM_CAR; - if (status & UART01x_FR_DSR) -@@ -296,12 +294,12 @@ static void pl010_break_ctl(struct uart_ - unsigned int lcr_h; - - spin_lock_irqsave(&uap->port.lock, flags); -- lcr_h = readb(uap->port.membase + UART010_LCRH); -+ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); - if (break_state == -1) - lcr_h |= UART01x_LCRH_BRK; - else - lcr_h &= ~UART01x_LCRH_BRK; -- writel(lcr_h, uap->port.membase + UART010_LCRH); -+ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); - spin_unlock_irqrestore(&uap->port.lock, flags); - } - -@@ -329,12 +327,12 @@ static int pl010_startup(struct uart_por - /* - * initialise the old status of the modem signals - */ -- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; -+ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; - - /* - * Finally, enable interrupts - */ -- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, -+ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, - uap->port.membase + UART010_CR); - - return 0; -@@ -357,10 +355,10 @@ static void pl010_shutdown(struct uart_p - /* - * disable all interrupts, disable the port - */ -- writel(0, uap->port.membase + UART010_CR); -+ __raw_writel(0, uap->port.membase + UART010_CR); - - /* disable break condition and fifos */ -- writel(readb(uap->port.membase + UART010_LCRH) & -+ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) & - ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN), - uap->port.membase + UART010_LCRH); - -@@ -382,7 +380,7 @@ pl010_set_termios(struct uart_port *port - /* - * Ask the core to calculate the divisor for us. - */ -- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); -+ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); - quot = uart_get_divisor(port, baud); - - switch (termios->c_cflag & CSIZE) { -@@ -445,25 +443,25 @@ pl010_set_termios(struct uart_port *port - uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; - - /* first, disable everything */ -- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; -+ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; - - if (UART_ENABLE_MS(port, termios->c_cflag)) - old_cr |= UART010_CR_MSIE; - -- writel(0, uap->port.membase + UART010_CR); -+ __raw_writel(0, uap->port.membase + UART010_CR); - - /* Set baud rate */ - quot -= 1; -- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); -- writel(quot & 0xff, uap->port.membase + UART010_LCRL); -+ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); -+ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL); - - /* - * ----------v----------v----------v----------v----- - * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L - * ----------^----------^----------^----------^----- - */ -- writel(lcr_h, uap->port.membase + UART010_LCRH); -- writel(old_cr, uap->port.membase + UART010_CR); -+ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); -+ __raw_writel(old_cr, uap->port.membase + UART010_CR); - - spin_unlock_irqrestore(&uap->port.lock, flags); - } -@@ -545,7 +543,7 @@ static struct uart_ops amba_pl010_pops = - .verify_port = pl010_verify_port, - }; - --static struct uart_amba_port *amba_ports[UART_NR]; -+static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR]; - - #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE - -@@ -555,10 +553,10 @@ static void pl010_console_putchar(struct - unsigned int status; - - do { -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - barrier(); - } while (!UART_TX_READY(status)); -- writel(ch, uap->port.membase + UART01x_DR); -+ __raw_writel(ch, uap->port.membase + UART01x_DR); - } - - static void -@@ -572,8 +570,8 @@ pl010_console_write(struct console *co, - /* - * First save the CR then disable the interrupts - */ -- old_cr = readb(uap->port.membase + UART010_CR); -- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); -+ old_cr = __raw_readl(uap->port.membase + UART010_CR); -+ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); - - uart_console_write(&uap->port, s, count, pl010_console_putchar); - -@@ -582,10 +580,10 @@ pl010_console_write(struct console *co, - * and restore the TCR - */ - do { -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - barrier(); - } while (status & UART01x_FR_BUSY); -- writel(old_cr, uap->port.membase + UART010_CR); -+ __raw_writel(old_cr, uap->port.membase + UART010_CR); - - clk_disable(uap->clk); - } -@@ -594,9 +592,9 @@ static void __init - pl010_console_get_options(struct uart_amba_port *uap, int *baud, - int *parity, int *bits) - { -- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { -+ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { - unsigned int lcr_h, quot; -- lcr_h = readb(uap->port.membase + UART010_LCRH); -+ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); - - *parity = 'n'; - if (lcr_h & UART01x_LCRH_PEN) { -@@ -611,8 +609,8 @@ pl010_console_get_options(struct uart_am - else - *bits = 8; - -- quot = readb(uap->port.membase + UART010_LCRL) | -- readb(uap->port.membase + UART010_LCRM) << 8; -+ quot = __raw_readl(uap->port.membase + UART010_LCRL) | -+ __raw_readl(uap->port.membase + UART010_LCRM) << 8; - *baud = uap->port.uartclk / (16 * (quot + 1)); - } - } -@@ -631,7 +629,7 @@ static int __init pl010_console_setup(st - * if so, search for the first available port that does have - * console support. - */ -- if (co->index >= UART_NR) -+ if (co->index >= SERIAL_AMBA_NR) - co->index = 0; - uap = amba_ports[co->index]; - if (!uap) -@@ -673,7 +671,7 @@ static struct uart_driver amba_reg = { - .dev_name = "ttyAM", - .major = SERIAL_AMBA_MAJOR, - .minor = SERIAL_AMBA_MINOR, -- .nr = UART_NR, -+ .nr = SERIAL_AMBA_NR, - .cons = AMBA_CONSOLE, - }; - ---- a/drivers/tty/serial/Kconfig -+++ b/drivers/tty/serial/Kconfig -@@ -25,10 +25,18 @@ config SERIAL_AMBA_PL010 - help - This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have - an Integrator/AP or Integrator/PP2 platform, or if you have a -- Cirrus Logic EP93xx CPU, say Y or M here. -+ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here. - - If unsure, say N. - -+config SERIAL_AMBA_PL010_NUMPORTS -+ int "Maximum number of AMBA PL010 serial ports" -+ depends on SERIAL_AMBA_PL010 -+ default "8" -+ ---help--- -+ Set this to the number of serial ports you want the AMBA PL010 driver -+ to support. -+ - config SERIAL_AMBA_PL010_CONSOLE - bool "Support for console on AMBA serial port" - depends on SERIAL_AMBA_PL010=y diff --git a/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch b/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch deleted file mode 100644 index 5345022da..000000000 --- a/target/linux/adm5120/patches-3.18/203-gpio_leds_brightness.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -55,13 +55,17 @@ static void gpio_led_set(struct led_clas - container_of(led_cdev, struct gpio_led_data, cdev); - int level; - -- if (value == LED_OFF) -- level = 0; -- else -- level = 1; -- -- if (led_dat->active_low) -- level = !level; -+ switch (value) { -+ case LED_OFF: -+ level = led_dat->active_low ? 1 : 0; -+ break; -+ case LED_FULL: -+ level = led_dat->active_low ? 0 : 1; -+ break; -+ default: -+ level = value; -+ break; -+ } - - /* Setting GPIOs with I2C/etc requires a task context, and we don't - * seem to have a reliable way to know if we're already in one; so diff --git a/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch b/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch deleted file mode 100644 index 4b6db8b8d..000000000 --- a/target/linux/adm5120/patches-3.18/310-adm5120_wdt.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -1116,6 +1116,18 @@ config RC32434_WDT - To compile this driver as a module, choose M here: the - module will be called rc32434_wdt. - -+config ADM5120_WDT -+ tristate "Infineon ADM5120 SoC hardware watchdog" -+ depends on WATCHDOG && ADM5120 -+ help -+ This is a driver for hardware watchdog integrated in Infineon -+ ADM5120 SoC. This watchdog simply watches your kernel to make sure -+ it doesn't freeze, and if it does, it reboots your computer after a -+ certain amount of time. -+ -+ To compile this driver as a module, choose M here: the module will be -+ called adm5120_wdt. -+ - config INDYDOG - tristate "Indy/I2 Hardware Watchdog" - depends on SGI_HAS_INDYDOG ---- a/drivers/watchdog/Makefile -+++ b/drivers/watchdog/Makefile -@@ -131,6 +131,7 @@ obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o - obj-$(CONFIG_BCM47XX_WDT) += bcm47xx_wdt.o - obj-$(CONFIG_BCM63XX_WDT) += bcm63xx_wdt.o - obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o -+obj-$(CONFIG_ADM5120_WDT) += adm5120_wdt.o - obj-$(CONFIG_INDYDOG) += indydog.o - obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o - obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o diff --git a/target/linux/adm5120/rb1xx/base-files/sbin/wget2nand b/target/linux/adm5120/rb1xx/base-files/sbin/wget2nand deleted file mode 100755 index f7e0a092c..000000000 --- a/target/linux/adm5120/rb1xx/base-files/sbin/wget2nand +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -# wget2nand -# This script can be used to download a TGZ file from your build system which -# contains the files to be installed on the NAND flash on your RB1xx card. -# The one parameter is the URL of the TGZ file to be downloaded. -# Licence GPL V2 -# Author david.goodenough@linkchoose.co.uk -# Based on cf2nand from RB532 support -. /lib/functions.sh - -[ -d /tmp/wget2nand-rootfs ] && { - echo "/tmp/wget2nand-rootfs already exists" - exit 1 -} - -[ -d /tmp/wget2nand-kernel ] && { - echo "/tmp/wget2nand-kernel already exists" - exit 1 -} - -# need to find the wget server from the command line -url=$1 -[ -z "$url" ] && { - echo "No URL specified for image TGZ" - echo "Usage : $0 URL" - exit 1 -} - -# first get an address for br-lan using udhcpc -killall udhcpc -/sbin/udhcpc -i br-lan - -mtd_kernel="$(find_mtd_part 'kernel')" -mtd_rootfs="$(find_mtd_part 'rootfs')" -[ -z "$mtd_kernel" -o -z "$mtd_rootfs" ] && { - echo "Cannot find NAND Flash partitions" - exit 1 -} - -echo "Erasing filesystem..." -mtd erase kernel 2>/dev/null >/dev/null -mtd erase rootfs 2>/dev/null >/dev/null - -echo "Mounting $mtd_rootfs as new root and $mtd_kernel as kernel partition" - -mkdir /tmp/wget2nand-rootfs -mkdir /tmp/wget2nand-kernel -mount -t yaffs2 "$mtd_rootfs" /tmp/wget2nand-rootfs -mount -t yaffs2 "$mtd_kernel" /tmp/wget2nand-kernel - -echo "Erasing existing files..." -rm -rf /tmp/wget2nand-rootfs/* - -echo "Copying filesystem..." -( wget -O - $url/openwrt-adm5120-rb1xx-rootfs.tar.gz) | ( cd /tmp/wget2nand-rootfs/; tar xvz ) -# RouterBOOT is looking for a kernel named "kernel" -wget -O /tmp/wget2nand-kernel/kernel $url/openwrt-adm5120-rb1xx-vmlinux.elf - -chmod +x /tmp/wget2nand-kernel/kernel - -# make sure everything is written before we unmount the partitions -echo "chmod ugo+x /" > /tmp/wget2nand-rootfs/etc/uci-defaults/set_root_permission -sync -ls /tmp/wget2nand-kernel/ -ls /tmp/wget2nand-rootfs/ -# use kexec if present -[ -x /usr/sbin/kexec ] && { - kexec -l /tmp/wget2nand-kernel/kernel --command-line="$(cat /proc/cmdline) rootfstype=yaffs2 root=$mtd_kernel" - kexec -e -} -# unmount the partitions and remove the directories into which they were mounted -umount /tmp/wget2nand-kernel -umount /tmp/wget2nand-rootfs -rmdir /tmp/wget2nand-kernel -rmdir /tmp/wget2nand-rootfs - -# all done -echo "Image written, you can now reboot. Remember to change the boot source to Boot from Nand" diff --git a/target/linux/adm5120/rb1xx/config-default b/target/linux/adm5120/rb1xx/config-default deleted file mode 100644 index 37db0b32a..000000000 --- a/target/linux/adm5120/rb1xx/config-default +++ /dev/null @@ -1,52 +0,0 @@ -# CONFIG_ADM5120_MACH_5GXI is not set -# CONFIG_ADM5120_MACH_BR_6104K is not set -# CONFIG_ADM5120_MACH_BR_6104KP is not set -# CONFIG_ADM5120_MACH_BR_61X4WG is not set -# CONFIG_ADM5120_MACH_CAS_771 is not set -# CONFIG_ADM5120_MACH_EASY5120P_ATA is not set -# CONFIG_ADM5120_MACH_EASY5120_RT is not set -# CONFIG_ADM5120_MACH_EASY5120_WVOIP is not set -# CONFIG_ADM5120_MACH_EASY83000 is not set -# CONFIG_ADM5120_MACH_EB_214A is not set -# CONFIG_ADM5120_MACH_NFS_101 is not set -# CONFIG_ADM5120_MACH_NP27G is not set -# CONFIG_ADM5120_MACH_NP28G is not set -# CONFIG_ADM5120_MACH_PMUGW is not set -CONFIG_ADM5120_MACH_RB_11X=y -CONFIG_ADM5120_MACH_RB_133=y -CONFIG_ADM5120_MACH_RB_133C=y -CONFIG_ADM5120_MACH_RB_150=y -CONFIG_ADM5120_MACH_RB_153=y -CONFIG_ADM5120_MACH_RB_192=y -# CONFIG_ADM5120_MACH_WP54 is not set -# CONFIG_ADM5120_OEM_CELLVISION is not set -# CONFIG_ADM5120_OEM_COMPEX is not set -# CONFIG_ADM5120_OEM_EDIMAX is not set -# CONFIG_ADM5120_OEM_GENERIC is not set -# CONFIG_ADM5120_OEM_INFINEON is not set -CONFIG_ADM5120_OEM_MIKROTIK=y -# CONFIG_ADM5120_OEM_MOTOROLA is not set -# CONFIG_ADM5120_OEM_OSBRIDGE is not set -CONFIG_CMDLINE="console=ttyAM0,115200 rootfstype=yaffs2" -# CONFIG_JFFS2_FS is not set -# CONFIG_MTD_MYLOADER_PARTS is not set -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_NAND_PLATFORM=y -# CONFIG_MTD_ROOTFS_SPLIT is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_TRXSPLIT is not set -# CONFIG_OVERLAYFS_FS is not set -# CONFIG_PATA_RB153_CF is not set -# CONFIG_SQUASHFS is not set -CONFIG_YAFFS_9BYTE_TAGS=y -# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set -CONFIG_YAFFS_AUTO_YAFFS2=y -# CONFIG_YAFFS_DISABLE_BACKGROUND is not set -# CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING is not set -CONFIG_YAFFS_DISABLE_TAGS_ECC=y -# CONFIG_YAFFS_EMPTY_LOST_AND_FOUND is not set -CONFIG_YAFFS_FS=y -CONFIG_YAFFS_XATTR=y -CONFIG_YAFFS_YAFFS1=y -CONFIG_YAFFS_YAFFS2=y diff --git a/target/linux/adm5120/rb1xx/profiles/RB1xx.mk b/target/linux/adm5120/rb1xx/profiles/RB1xx.mk deleted file mode 100644 index b9da1640d..000000000 --- a/target/linux/adm5120/rb1xx/profiles/RB1xx.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/RouterBoard - NAME:=Mikrotik RouterBoard 1xx family - PACKAGES:=kmod-ath5k kmod-pata-rb153-cf -endef - -define Profile/RouterBoard/Description - Package set compatible with the RouterBoard RB1xx devices. Contains RouterOS to OpenWrt\\\ - installation scripts. -endef - -$(eval $(call Profile,RouterBoard)) diff --git a/target/linux/adm5120/rb1xx/target.mk b/target/linux/adm5120/rb1xx/target.mk deleted file mode 100644 index 9aa64bc22..000000000 --- a/target/linux/adm5120/rb1xx/target.mk +++ /dev/null @@ -1,8 +0,0 @@ -ARCH:=mipsel -SUBTARGET:=rb1xx -BOARDNAME:=MikroTik RB-1xx boards -FEATURES+=tgz broken - -define Target/Description - Build firmware images for Mikrotik RB-1xx series. -endef diff --git a/target/linux/adm5120/router_be/config-default b/target/linux/adm5120/router_be/config-default deleted file mode 100644 index c3b9e369d..000000000 --- a/target/linux/adm5120/router_be/config-default +++ /dev/null @@ -1,13 +0,0 @@ -CONFIG_ADM5120_MACH_P_334WT=y -CONFIG_ADM5120_MACH_P_335=y -# CONFIG_ADM5120_OEM_CELLVISION is not set -# CONFIG_ADM5120_OEM_COMPEX is not set -# CONFIG_ADM5120_OEM_EDIMAX is not set -# CONFIG_ADM5120_OEM_GENERIC is not set -# CONFIG_ADM5120_OEM_INFINEON is not set -# CONFIG_ADM5120_OEM_MOTOROLA is not set -# CONFIG_ADM5120_OEM_OSBRIDGE is not set -CONFIG_ADM5120_OEM_ZYXEL=y -CONFIG_CPU_BIG_ENDIAN=y -# CONFIG_CPU_LITTLE_ENDIAN is not set -CONFIG_SWAP_IO_SPACE=y diff --git a/target/linux/adm5120/router_be/profiles/010-Generic.mk b/target/linux/adm5120/router_be/profiles/010-Generic.mk deleted file mode 100644 index 1d477319d..000000000 --- a/target/linux/adm5120/router_be/profiles/010-Generic.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Generic - NAME:=Generic (default) - PACKAGES:= -endef - -define Profile/Generic/Description - Generic package set compatible with most boards. -endef -$(eval $(call Profile,Generic)) - diff --git a/target/linux/adm5120/router_be/profiles/200-ZyXEL.mk b/target/linux/adm5120/router_be/profiles/200-ZyXEL.mk deleted file mode 100644 index 19ac9f5e9..000000000 --- a/target/linux/adm5120/router_be/profiles/200-ZyXEL.mk +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/P334WT - NAME:=ZyXEL Prestige 334WT - PACKAGES:=kmod-acx-mac80211 -endef - -define Profile/P334WT/Description - Package set optimized for the ZyXEL Prestige 334WT board. -endef - -define Profile/P335WT - NAME:=ZyXEL Prestige 335WT - PACKAGES:=kmod-acx-mac80211 kmod-usb-core kmod-usb-adm5120 -endef - -define Profile/P335WT/Description - Package set optimized for the ZyXEL Prestige 335WT board. -endef - -$(eval $(call Profile,P334WT)) -$(eval $(call Profile,P335WT)) diff --git a/target/linux/adm5120/router_be/target.mk b/target/linux/adm5120/router_be/target.mk deleted file mode 100644 index f9119c51c..000000000 --- a/target/linux/adm5120/router_be/target.mk +++ /dev/null @@ -1,10 +0,0 @@ -ARCH:=mips -SUBTARGET:=router_be -BOARDNAME:=Big Endian -FEATURES+=squashfs - -define Target/Description - Build firmware images for Infineon/ADMTek ADM5120 based boards - running in big-endian mode (e.g : ZyXEL Prestige 335WT ...) -endef - diff --git a/target/linux/adm5120/router_le/config-3.8 b/target/linux/adm5120/router_le/config-3.8 deleted file mode 100644 index e69de29bb..000000000 diff --git a/target/linux/adm5120/router_le/profiles/010-Generic.mk b/target/linux/adm5120/router_le/profiles/010-Generic.mk deleted file mode 100644 index 6c3e5f30e..000000000 --- a/target/linux/adm5120/router_le/profiles/010-Generic.mk +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Generic - NAME:=Generic (default) - PACKAGES:= -endef - -define Profile/Generic/Description - Generic package set compatible with most boards. -endef - -define Profile/EB-214A - NAME:=Generic EB-214A - PACKAGES:=-wpad-mini -admswconfig -kmod-usb-adm5120 -kmod-ledtrig-adm5120-switch -dnsmasq kmod-usb-uhci kmod-usb2 -endef - -define Profile/EB-214A/Description - Package set optimized for generic EB-214A boards. -endef - -$(eval $(call Profile,Generic)) -$(eval $(call Profile,EB-214A)) - diff --git a/target/linux/adm5120/router_le/profiles/Cellvision.mk b/target/linux/adm5120/router_le/profiles/Cellvision.mk deleted file mode 100644 index 4093b4f49..000000000 --- a/target/linux/adm5120/router_le/profiles/Cellvision.mk +++ /dev/null @@ -1,146 +0,0 @@ -# -# Copyright (C) 2007-2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/CAS630 - NAME:=Cellvision CAS-630 IP camera (Experimental) - # TODO: add default packages - PACKAGES:=-wpad-mini -endef - -define Profile/CAS630/Description - Package set optimized for the Cellvision CAS-630 device. -endef - -define Profile/CAS630W - NAME:=Cellvision CAS-630W IP camera (Experimental) - # TODO: add default packages - PACKAGES:=-wpad-mini -endef - -define Profile/CAS630W/Description - Package set optimized for the Cellvision CAS-630W device. -endef - -define Profile/CAS670 - NAME:=Cellvision CAS-670 IP camera (Experimental) - # TODO: add default packages - PACKAGES:=-wpad-mini -endef - -define Profile/CAS670/Description - Package set optimized for the Cellvision CAS-670 device. -endef - -define Profile/CAS670W - NAME:=Cellvision CAS-670W IP camera (Experimental) - # TODO: add default packages - PACKAGES:=-wpad-mini -endef - -define Profile/CAS670W/Description - Package set optimized for the Cellvision CAS-670 device. -endef - -define Profile/CAS700 - NAME:=Cellvision CAS-700 IP camera (Experimental) - # TODO: add default packages - PACKAGES:=-wpad-mini -endef - -define Profile/CAS700/Description - Package set optimized for the Cellvision CAS-700 device. -endef - -define Profile/CAS700W - NAME:=Cellvision CAS-700W IP camera (Experimental) - # TODO: add default packages - PACKAGES:=-wpad-mini -endef - -define Profile/CAS700W/Description - Package set optimized for the Cellvision CAS-700W device. -endef - -define Profile/CAS771 - NAME:=Cellvision CAS-771 IP camera (Experimental) - PACKAGES:=-wpad-mini kmod-video-cpia2 kmod-usb-ohci kmod-usb2 kmod-usb-audio -endef - -define Profile/CAS771/Description - Package set optimized for the Cellvision CAS-771 device. -endef - -define Profile/CAS771W - NAME:=Cellvision CAS-771W IP camera (Experimental) - PACKAGES:=-wpad-mini kmod-video-cpia2 kmod-usb-ohci kmod-usb2 kmod-usb-audio kmod-rt2500-pci -endef - -define Profile/CAS771W/Description - Package set optimized for the Cellvision CAS-771W device. -endef - -define Profile/CAS790 - NAME:=Cellvision CAS-790 IP camera (Experimental) - # TODO: add default packages - PACKAGES:=-wpad-mini -endef - -define Profile/CAS790/Description - Package set optimized for the Cellvision CAS-790 device. -endef - -define Profile/CAS861 - NAME:=Cellvision CAS-861 IP camera (Experimental) - # TODO: add default packages - PACKAGES:=-wpad-mini -endef - -define Profile/CAS861/Description - Package set optimized for the Cellvision CAS-861 device. -endef - -define Profile/CAS861W - NAME:=Cellvision CAS-861W IP camera (Experimental) - PACKAGES:=kmod-rt2500-pci -endef - -define Profile/CAS861W/Description - Package set optimized for the Cellvision CAS-861W device. -endef - -define Profile/NFS101U - NAME:=Cellvision NFS-101U Network File Server (Experimental) - PACKAGES:=-wpad-mini kmod-usb-ohci kmod-usb2 -endef - -define Profile/NFS101U/Description - Package set optimized for the Cellvision NFS-101U device. -endef - -define Profile/NFS101WU - NAME:=Cellvision NFS-101WU Network File Server (Experimental) - PACKAGES:=-wpad-mini kmod-usb-ohci kmod-usb2 -endef - -define Profile/NFS101WU/Description - Package set optimized for the Cellvision NFS-101WU device. -endef - -$(eval $(call Profile,CAS630)) -$(eval $(call Profile,CAS630W)) -$(eval $(call Profile,CAS670)) -$(eval $(call Profile,CAS670W)) -$(eval $(call Profile,CAS700)) -$(eval $(call Profile,CAS700W)) -$(eval $(call Profile,CAS771)) -$(eval $(call Profile,CAS771W)) -$(eval $(call Profile,CAS790)) -$(eval $(call Profile,CAS861)) -$(eval $(call Profile,CAS861W)) -$(eval $(call Profile,NFS101U)) -$(eval $(call Profile,NFS101WU)) - diff --git a/target/linux/adm5120/router_le/profiles/Compex.mk b/target/linux/adm5120/router_le/profiles/Compex.mk deleted file mode 100644 index 79d1f3f91..000000000 --- a/target/linux/adm5120/router_le/profiles/Compex.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/NP27G - NAME:=Compex NP27G - PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-adm5120 -endef - -define Profile/NP27G/Description - Package set optimized for the Compex NP27G. -endef - -define Profile/NP28G - NAME:=Compex NP28G - PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-uhci kmod-usb2 -endef - -define Profile/NP28G/Description - Package set optimized for the Compex NP28G. -endef - -define Profile/WP54 - NAME:=Compex WP54 family - PACKAGES:=kmod-ath5k -endef - -define Profile/WP54/Description - Package set optimized for the Compex WP54 family. -endef - -$(eval $(call Profile,NP27G)) -$(eval $(call Profile,NP28G)) -$(eval $(call Profile,WP54)) diff --git a/target/linux/adm5120/router_le/profiles/Edimax.mk b/target/linux/adm5120/router_le/profiles/Edimax.mk deleted file mode 100644 index 55c295875..000000000 --- a/target/linux/adm5120/router_le/profiles/Edimax.mk +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (C) 2007,2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/BR6104K - NAME:=Edimax BR-6104K (Unofficial) - PACKAGES:=-wpad-mini -endef - -define Profile/BR6104K/Description - Package set optimized for the Edimax BR-6104K -endef - -define Profile/BR6104KP - NAME:=Edimax BR-6104KP (Unofficial) - PACKAGES:=-wpad-mini kmod-usb-core kmod-usb-adm5120 -endef - -define Profile/BR6104KP/Description - Package set optimized for the Edimax BR-6104KP -endef - -define Profile/BR6104WG - NAME:=Edimax BR-6104Wg (Unofficial, No WiFi) - PACKAGES:=-wpad-mini -endef - -define Profile/BR6104WG/Description - Package set optimized for the Edimax BR-6104Wg -endef - -define Profile/BR6114WG - NAME:=Edimax BR-6114WG (Unofficial, No WiFi) - PACKAGES:=-wpad-mini -endef - -define Profile/BR6114WG/Description - Package set optimized for the Edimax BR-6114WG -endef - -$(eval $(call Profile,BR6104K)) -$(eval $(call Profile,BR6104KP)) -$(eval $(call Profile,BR6104WG)) -$(eval $(call Profile,BR6114WG)) diff --git a/target/linux/adm5120/router_le/profiles/Infineon.mk b/target/linux/adm5120/router_le/profiles/Infineon.mk deleted file mode 100644 index d650406b7..000000000 --- a/target/linux/adm5120/router_le/profiles/Infineon.mk +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (C) 2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/EASY5120RT - NAME:=Infineon EASY 5120-RT Reference Board - PACKAGES:=kmod-usb-core kmod-usb-adm5120 -endef - -define Profile/EASY5120RT/Description - Package set optimized for the Infineon EASY 5120-RT Reference Board -endef - -$(eval $(call Profile,EASY5120RT)) - -define Profile/EASY5120PATA - NAME:=Infineon EASY 5120P-ATA Reference Board -endef - -define Profile/EASY5120RT/Description - Package set optimized for the Infineon EASY 5120P-ATA Reference Board -endef - -$(eval $(call Profile,EASY5120PATA)) diff --git a/target/linux/adm5120/router_le/profiles/Motorola.mk b/target/linux/adm5120/router_le/profiles/Motorola.mk deleted file mode 100644 index e640b81a1..000000000 --- a/target/linux/adm5120/router_le/profiles/Motorola.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (C) 2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/PMUGW - NAME:=Motorola Powerline MU Gateway (EXPERIMENTAL) -endef - -define Profile/PMUGW/Description - Package set optimized for the Motorola Powerline MU Gateway board -endef - -$(eval $(call Profile,PMUGW)) diff --git a/target/linux/adm5120/router_le/profiles/Osbridge.mk b/target/linux/adm5120/router_le/profiles/Osbridge.mk deleted file mode 100644 index 459d524ba..000000000 --- a/target/linux/adm5120/router_le/profiles/Osbridge.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (C) 2007-2009 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/5GXI - NAME:=Osbridge 5GXi/5XLi (Unofficial) -endef - -define Profile/5GXI/Description - Package set optimized for the OSBRiDGE 5GXi/5XLi boards. -endef - -$(eval $(call Profile,5GXI)) diff --git a/target/linux/adm5120/router_le/target.mk b/target/linux/adm5120/router_le/target.mk deleted file mode 100644 index ea2a66c5f..000000000 --- a/target/linux/adm5120/router_le/target.mk +++ /dev/null @@ -1,10 +0,0 @@ -ARCH:=mipsel -SUBTARGET:=router_le -BOARDNAME:=Little Endian -FEATURES+=squashfs tgz - -define Target/Description - Build firmware images for Infineon/ADMtek ADM5120 based boards - running in little-endian mode (e.g: RouterBoard RB1xx, Compex WP54x ...) -endef - diff --git a/target/linux/adm8668/Makefile b/target/linux/adm8668/Makefile deleted file mode 100644 index ddca8d4a2..000000000 --- a/target/linux/adm8668/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=mipsel -BOARD:=adm8668 -BOARDNAME:=Infineon WildPass ADM8668 -FEATURES:=squashfs usb pci -MAINTAINER:=Florian Fainelli - -KERNEL_PATCHVER:=3.18 - -define Target/Description - Build firmware images for Infineon WildPass (ADM8668) based routers - (e.g. T-Mobile branded Linksys WRTU54G-TM) -endef - -include $(INCLUDE_DIR)/target.mk - -$(eval $(call BuildTarget)) diff --git a/target/linux/adm8668/base-files/etc/config/network b/target/linux/adm8668/base-files/etc/config/network deleted file mode 100644 index 5967cdd06..000000000 --- a/target/linux/adm8668/base-files/etc/config/network +++ /dev/null @@ -1,24 +0,0 @@ -config interface loopback - option ifname lo - option proto static - option ipaddr 127.0.0.1 - option netmask 255.0.0.0 - -config interface lan - option ifname eth0 - option type bridge - option proto static - option ipaddr 192.168.1.1 - option netmask 255.255.255.0 - option ip6assign 60 - -config interface wan - option ifname eth1 - option proto dhcp - -config interface wan6 - option ifname eth1 - option proto dhcpv6 - -config globals globals - option ula_prefix auto diff --git a/target/linux/adm8668/base-files/etc/diag.sh b/target/linux/adm8668/base-files/etc/diag.sh deleted file mode 100644 index edcc7536a..000000000 --- a/target/linux/adm8668/base-files/etc/diag.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Copyright (C) 2010 OpenWrt.org - -set_led() { - local state="$1" - [ -f "/proc/adm8668/sesled" ] && echo "$state" > "/proc/adm8668/sesled" -} - -set_state() { - case "$1" in - preinit) - set_led 1 - ;; - failsafe) - set_led 2 - ;; - done) - set_led 0 - ;; - esac -} diff --git a/target/linux/adm8668/base-files/lib/preinit/03_init_hotplug_failsafe_adm8668 b/target/linux/adm8668/base-files/lib/preinit/03_init_hotplug_failsafe_adm8668 deleted file mode 100644 index b0f4a4efa..000000000 --- a/target/linux/adm8668/base-files/lib/preinit/03_init_hotplug_failsafe_adm8668 +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -init_hotplug_failsafe() { - echo '/sbin/hotplug.failsafe' > /proc/sys/kernel/hotplug -} - -boot_hook_add preinit_main init_hotplug_failsafe - - diff --git a/target/linux/adm8668/base-files/lib/preinit/05_set_preinit_face_adm8668 b/target/linux/adm8668/base-files/lib/preinit/05_set_preinit_face_adm8668 deleted file mode 100644 index ac2a7cbb6..000000000 --- a/target/linux/adm8668/base-files/lib/preinit/05_set_preinit_face_adm8668 +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set_preinit_ifname() { - ifname=eth0 -} - -boot_hook_add preinit_main set_preinit_ifname - - diff --git a/target/linux/adm8668/base-files/lib/upgrade/platform.sh b/target/linux/adm8668/base-files/lib/upgrade/platform.sh deleted file mode 100644 index 98e47ade3..000000000 --- a/target/linux/adm8668/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,15 +0,0 @@ -PART_NAME=linux -platform_check_image() { - [ "$#" -gt 1 ] && return 1 - - case "$(get_magic_word "$1")" in - # u-boot - 2705) return 0;; - *) - echo "Invalid image type. Please use only u-boot files" - return 1 - ;; - esac -} - -# use default for platform_do_upgrade() diff --git a/target/linux/adm8668/base-files/sbin/hotplug.failsafe b/target/linux/adm8668/base-files/sbin/hotplug.failsafe deleted file mode 100644 index 0544339de..000000000 --- a/target/linux/adm8668/base-files/sbin/hotplug.failsafe +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -case "$1" in - button) kill -USR1 1;; -esac diff --git a/target/linux/adm8668/config-3.18 b/target/linux/adm8668/config-3.18 deleted file mode 100644 index 0c24c1786..000000000 --- a/target/linux/adm8668/config-3.18 +++ /dev/null @@ -1,104 +0,0 @@ -CONFIG_ADM8668=y -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM_AMBA=y -# CONFIG_ARM_SP805_WATCHDOG is not set -CONFIG_CEVT_R4K=y -CONFIG_CEVT_R4K_LIB=y -CONFIG_CMDLINE="console=ttyS0 earlyprintk" -CONFIG_CMDLINE_BOOL=y -CONFIG_CMDLINE_OVERRIDE=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -CONFIG_CPU_MIPSR1=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CSRC_R4K=y -CONFIG_CSRC_R4K_LIB=y -# CONFIG_DE2104X is not set -# CONFIG_DE4X5 is not set -CONFIG_DECOMPRESS_LZMA=y -# CONFIG_DM9102 is not set -CONFIG_DMA_NONCOHERENT=y -CONFIG_EARLY_PRINTK=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_GPIO=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_SYSFS=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_GENERIC_HARDIRQS=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IRQ_WORK=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HW_HAS_PCI=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQ_CPU=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_MIPS=y -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -CONFIG_MIPS_MT_DISABLED=y -CONFIG_MTD_ADM8668_NOR=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_TULIP=y -CONFIG_NO_EXCEPT_FILL=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -CONFIG_PERF_USE_VMALLOC=y -# CONFIG_PREEMPT_RCU is not set -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL010=y -CONFIG_SERIAL_AMBA_PL010_CONSOLE=y -CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2 -CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS" -# CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SWAP_IO_SPACE=y -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_TULIP=y -CONFIG_TULIP_NAPI=y -# CONFIG_TULIP_NAPI_HW_MITIGATION is not set -# CONFIG_TULIP_PCI is not set -CONFIG_TULIP_PLATFORM=y -# CONFIG_ULI526X is not set -CONFIG_USB_ARCH_HAS_XHCI=y -# CONFIG_USB_HCD_BCMA is not set -# CONFIG_USB_HCD_SSB is not set -CONFIG_USB_SUPPORT=y -# CONFIG_WINBOND_840 is not set -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Kconfig b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Kconfig deleted file mode 100644 index 2e7281ff0..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Kconfig +++ /dev/null @@ -1,2 +0,0 @@ -config ARM_AMBA - def_bool y diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Makefile b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Makefile deleted file mode 100644 index 515c3a499..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# -# something witty --neutronscott -# - -obj-y := irq.o prom.o platform.o gpio.o \ - setup.o clock.o time.o early_printk.o \ diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Platform b/target/linux/adm8668/files-3.18/arch/mips/adm8668/Platform deleted file mode 100644 index c70cd270b..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/Platform +++ /dev/null @@ -1,6 +0,0 @@ -# -# Infineon ADM8668 WildPass -# -platform-$(CONFIG_ADM8668) += adm8668/ -cflags-$(CONFIG_ADM8668) += -I$(srctree)/arch/mips/include/asm/mach-adm8668 -load-$(CONFIG_ADM8668) += 0xffffffff80002000 diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/clock.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/clock.c deleted file mode 100644 index 1e010fcc8..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/clock.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * ADM8668 minimal clock support - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under the terms of the GPLv2 - */ - -#include -#include -#include -#include -#include - -#include - -struct clk { - unsigned long rate; -}; - -static struct clk uart_clk = { - .rate = 62500000, -}; - -static struct clk sys_clk; - -struct clk *clk_get(struct device *dev, const char *id) -{ - const char *lookup = id; - - if (dev) - lookup = dev_name(dev); - - if (!strcmp(lookup, "apb:uart0")) - return &uart_clk; - if (!strcmp(lookup, "sys")) - return &sys_clk; - - return ERR_PTR(-ENOENT); -} -EXPORT_SYMBOL(clk_get); - -int clk_enable(struct clk *clk) -{ - return 0; -} -EXPORT_SYMBOL(clk_enable); - -void clk_disable(struct clk *clk) -{ -} -EXPORT_SYMBOL(clk_disable); - -unsigned long clk_get_rate(struct clk *clk) -{ - return clk->rate; -} -EXPORT_SYMBOL(clk_get_rate); - -void clk_put(struct clk *clk) -{ -} -EXPORT_SYMBOL(clk_put); - -void __init adm8668_init_clocks(void) -{ - u32 adj; - - /* adjustable clock selection - * CR3 bit 14~11, 0000 -> 175MHz, 0001 -> 180MHz, etc... - */ - adj = (ADM8668_CONFIG_REG(ADM8668_CR3) >> 11) & 0xf; - sys_clk.rate = 175000000 + (adj * 5000000); - - pr_info("ADM8668 CPU clock: %lu MHz\n", sys_clk.rate / 1000000); -} diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/early_printk.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/early_printk.c deleted file mode 100644 index 03dd72aa8..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/early_printk.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include - -#define UART_READ(r) \ - __raw_readl((void __iomem *)(KSEG1ADDR(ADM8668_UART0_BASE) + (r))) - -#define UART_WRITE(v, r) \ - __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM8668_UART0_BASE) + (r))) - -void prom_putchar(char c) -{ - UART_WRITE(c, UART01x_DR); - while ((UART_READ(UART01x_FR) & UART01x_FR_TXFF) != 0) - ; -} diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/gpio.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/gpio.c deleted file mode 100644 index fb39f7f58..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/gpio.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Infineon/ADMTek ADM8668 WildPass GPIO support - * - * Copyright (C) 2012 Florian Fainelli - * - * Licensed under the terms of GPLv2. - * - */ -#include -#include -#include - -#include - -#define GPIO_MASK 0x3f - -#define GPIO_IN_OFS 0 -#define GPIO_OUT_OFS 6 -#define GPIO_OE_OFS 12 - -struct adm8668_gpio_chip { - void __iomem *base; - struct gpio_chip chip; -}; - -static int adm8668_gpio_dir_out(struct gpio_chip *chip, - unsigned offset, int value) -{ - struct adm8668_gpio_chip *c = - container_of(chip, struct adm8668_gpio_chip, chip); - u32 mask; - - /* clear input, set output enable and output value */ - mask = __raw_readl(c->base); - mask &= ~(1 << offset); - mask |= (1 << (offset + GPIO_OE_OFS)); - if (value) - mask |= (1 << (offset + GPIO_OUT_OFS)); - else - mask &= ~(1 << (offset + GPIO_OUT_OFS)); - __raw_writel(mask, c->base); - - return 0; -} - -static int adm8668_gpio_dir_in(struct gpio_chip *chip, - unsigned offset) -{ - struct adm8668_gpio_chip *c = - container_of(chip, struct adm8668_gpio_chip, chip); - u32 mask; - - mask = __raw_readl(c->base); - mask &= ~(((1 << (offset + GPIO_OE_OFS)) | (1 << (offset + GPIO_OUT_OFS)))); - mask |= (1 << offset); - __raw_writel(mask, c->base); - - return 0; -} - -static void adm8668_gpio_set(struct gpio_chip *chip, - unsigned offset, int value) -{ - struct adm8668_gpio_chip *c = - container_of(chip, struct adm8668_gpio_chip, chip); - u32 mask; - - mask = __raw_readl(c->base); - if (value) - mask |= (1 << (offset + GPIO_OUT_OFS)); - else - mask &= ~(1 << (offset + GPIO_OUT_OFS)); - __raw_writel(mask, c->base); -} - -static int adm8668_gpio_get(struct gpio_chip *chip, - unsigned offset) -{ - struct adm8668_gpio_chip *c = - container_of(chip, struct adm8668_gpio_chip, chip); - u32 value; - - value = __raw_readl(c->base) & GPIO_MASK; - - return value & (1 << offset); -} - -static struct adm8668_gpio_chip adm8668_gpio_cpu = { - .base = (void __iomem *)KSEG1ADDR(ADM8668_CONFIG_BASE + CRGPIO_REG), - .chip = { - .label = "adm8668-cpu-gpio", - .direction_output = adm8668_gpio_dir_out, - .direction_input = adm8668_gpio_dir_in, - .set = adm8668_gpio_set, - .get = adm8668_gpio_get, - .ngpio = 6, - }, -}; - -static struct adm8668_gpio_chip adm8668_gpio_wlan = { - .base = (void __iomem *)KSEG1ADDR(ADM8668_WLAN_BASE + GPIO_REG), - .chip = { - .label = "adm8668-wlan-gpio", - .direction_output = adm8668_gpio_dir_out, - .direction_input = adm8668_gpio_dir_in, - .set = adm8668_gpio_set, - .get = adm8668_gpio_get, - .ngpio = 6, - .base = 6, - }, -}; - -static int __init adm8668_gpio_init(void) -{ - int ret; - - ret = gpiochip_add(&adm8668_gpio_cpu.chip); - if (ret) - return ret; - - return gpiochip_add(&adm8668_gpio_wlan.chip); -} -arch_initcall(adm8668_gpio_init); diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/irq.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/irq.c deleted file mode 100644 index 9d3b2b9b8..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/irq.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2010 Scott Nicholas - * Copyright (C) 2012 Florian Fainelli - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* interrupt controller */ -#define IRQ_STATUS_REG 0x00 /* Read */ -#define IRQ_ENABLE_REG 0x08 /* Read/Write */ -#define IRQ_DISABLE_REG 0x0C /* Write */ - -#define IRQ_MASK 0xffff - -static inline void intc_write_reg(u32 val, unsigned int reg) -{ - void __iomem *base = (void __iomem *)KSEG1ADDR(ADM8668_INTC_BASE); - - __raw_writel(val, base + reg); -} - -static inline u32 intc_read_reg(unsigned int reg) -{ - void __iomem *base = (void __iomem *)KSEG1ADDR(ADM8668_INTC_BASE); - - return __raw_readl(base + reg); -} - -static void adm8668_irq_cascade(void) -{ - int irq; - u32 intsrc; - - intsrc = intc_read_reg(IRQ_STATUS_REG) & IRQ_MASK; - if (intsrc) { - irq = fls(intsrc) - 1; - do_IRQ(irq); - } else - spurious_interrupt(); -} - -/* - * System irq dispatch - */ -void plat_irq_dispatch(void) -{ - unsigned int pending; - - pending = read_c0_cause() & read_c0_status() & ST0_IM; - - /* timer interrupt, that we renumbered */ - if (pending & STATUSF_IP7) - do_IRQ(MIPS_CPU_IRQ_BASE + 7); - else if (pending & STATUSF_IP2) - adm8668_irq_cascade(); - else - spurious_interrupt(); -} - -/* - * enable 8668 irq - */ -static void enable_adm8668_irq(struct irq_data *d) -{ - intc_write_reg((1 << d->irq), IRQ_ENABLE_REG); -} - - -static void ack_adm8668_irq(struct irq_data *d) -{ - intc_write_reg((1 << d->irq), IRQ_DISABLE_REG); -} - -/* - * system irq type - */ - -static struct irq_chip adm8668_irq_type = { - .name = "adm8668", - .irq_ack = ack_adm8668_irq, - .irq_mask = ack_adm8668_irq, - .irq_unmask = enable_adm8668_irq -}; - -/* - * irq init - */ -static void __init init_adm8668_irqs(void) -{ - int i; - - /* disable all interrupts for the moment */ - intc_write_reg(IRQ_MASK, IRQ_DISABLE_REG); - - for (i = 0; i <= ADM8668_IRQ_MAX; i++) - irq_set_chip_and_handler(i, &adm8668_irq_type, - handle_level_irq); - - /* hw0 is where our interrupts are uh.. interrupted at. */ - set_c0_status(IE_IRQ0); -} - -/* - * system init - */ -void __init arch_init_irq(void) -{ - mips_cpu_irq_init(); - init_adm8668_irqs(); -} diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/platform.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/platform.c deleted file mode 100644 index 9e40691f9..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/platform.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (C) 2010 Scott Nicholas - * Copyright (C) 2012 Florian Fainelli - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define ADM8868_UBOOT_ENV 0x20000 -#define ADM8868_UBOOT_WAN_MAC 0x5ac -#define ADM8868_UBOOT_LAN_MAC 0x404 - -static void adm8668_uart_set_mctrl(struct amba_device *dev, - void __iomem *base, - unsigned int mcrtl) -{ -} - -static struct amba_pl010_data adm8668_uart0_data = { - .set_mctrl = adm8668_uart_set_mctrl, -}; - -static struct amba_device adm8668_uart0_device = { - .dev = { - .init_name = "apb:uart0", - .platform_data = &adm8668_uart0_data, - }, - .res = { - .start = ADM8668_UART0_BASE, - .end = ADM8668_UART0_BASE + 0xF, - .flags = IORESOURCE_MEM, - }, - .irq = { - ADM8668_UART0_IRQ, - -1 - }, - .periphid = 0x0041010, -}; - -static struct resource eth0_resources[] = { - { - .start = ADM8668_LAN_BASE, - .end = ADM8668_LAN_BASE + 256, - .flags = IORESOURCE_MEM, - }, - { - .start = ADM8668_LAN_IRQ, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct tulip_platform_data eth0_pdata = { - .chip_id = ADM8668, -}; - -static struct platform_device adm8668_eth0_device = { - .name = "tulip", - .id = 0, - .resource = eth0_resources, - .num_resources = ARRAY_SIZE(eth0_resources), - .dev.platform_data = ð0_pdata, -}; - -static struct resource eth1_resources[] = { - { - .start = ADM8668_WAN_BASE, - .end = ADM8668_WAN_BASE + 256, - .flags = IORESOURCE_MEM, - }, - { - .start = ADM8668_WAN_IRQ, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct tulip_platform_data eth1_pdata = { - .chip_id = ADM8668, -}; - -static struct platform_device adm8668_eth1_device = { - .name = "tulip", - .id = 1, - .resource = eth1_resources, - .num_resources = ARRAY_SIZE(eth1_resources), - .dev.platform_data = ð1_pdata, -}; - -static struct resource usb_resources[] = { - { - .start = ADM8668_USB_BASE, - .end = ADM8668_USB_BASE + 0x1FFFFF, - .flags = IORESOURCE_MEM, - }, - { - .start = ADM8668_USB_IRQ, - .end = ADM8668_USB_IRQ, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct usb_ehci_pdata usb_pdata = { - .caps_offset = 0x100, - .has_tt = 1, -}; - -static struct platform_device adm8668_usb_device = { - .name = "ehci-platform", - .id = -1, - .resource = usb_resources, - .num_resources = ARRAY_SIZE(usb_resources), - .dev.platform_data = &usb_pdata, -}; - -static struct platform_device *adm8668_devs[] = { - &adm8668_eth0_device, - &adm8668_eth1_device, - &adm8668_usb_device, -}; - -static void adm8668_fetch_mac(int unit) -{ - u8 *mac; - u32 offset; - struct tulip_platform_data *pdata; - - switch (unit) { - case -1: - case 0: - offset = ADM8868_UBOOT_LAN_MAC; - pdata = ð0_pdata; - break; - case 1: - offset = ADM8868_UBOOT_WAN_MAC; - pdata = ð1_pdata; - break; - default: - pr_err("unsupported ethernet unit: %d\n", unit); - return; - } - - mac = (u8 *)(KSEG1ADDR(ADM8668_SMEM1_BASE) + ADM8868_UBOOT_ENV + offset); - - memcpy(pdata->mac, mac, sizeof(pdata->mac)); -} - -static void adm8668_ehci_workaround(void) -{ - u32 chipid; - - chipid = ADM8668_CONFIG_REG(ADM8668_CR0); - ADM8668_CONFIG_REG(ADM8668_CR66) = 0x0C1600D9; - - if (chipid == 0x86880001) - return; - - ADM8668_CONFIG_REG(ADM8668_CR66) &= ~(3 << 20); - ADM8668_CONFIG_REG(ADM8668_CR66) |= (1 << 20); - pr_info("ADM8668: applied USB workaround\n"); -} - - -int __init adm8668_devs_register(void) -{ - int ret; - - ret = amba_device_register(&adm8668_uart0_device, &iomem_resource); - if (ret) - panic("failed to register AMBA UART"); - - adm8668_fetch_mac(0); - adm8668_fetch_mac(1); - adm8668_ehci_workaround(); - - return platform_add_devices(adm8668_devs, ARRAY_SIZE(adm8668_devs)); -} -arch_initcall(adm8668_devs_register); diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/prom.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/prom.c deleted file mode 100644 index cb97bb30a..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/prom.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2010 Scott Nicholas - * - * based on work of rb532 prom.c - * Copyright (C) 2003, Peter Sadik - * Copyright (C) 2005-2006, P.Christeas - * Copyright (C) 2007, Gabor Juhos - * Felix Fietkau - * Florian Fainelli - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "u-boot.h" - -register volatile struct global_data *gd asm ("k0"); - -void __init prom_free_prom_memory(void) -{ - /* No prom memory to free */ -} - -static inline int match_tag(char *arg, const char *tag) -{ - return strncmp(arg, tag, strlen(tag)) == 0; -} - -static inline unsigned long tag2ul(char *arg, const char *tag) -{ - char *num; - - num = arg + strlen(tag); - return simple_strtoul(num, 0, 10); -} - -void __init prom_setup_cmdline(void) -{ - char *cp; - int prom_argc; - char **prom_argv; - int i; - - prom_argc = fw_arg0; - prom_argv = (char **)KSEG0ADDR(fw_arg1); - - cp = &(arcs_cmdline[0]); - for (i = 1; i < prom_argc; i++) { - prom_argv[i] = (char *)KSEG0ADDR(prom_argv[i]); - - /* default bootargs has "console=/dev/ttyS0" yet console won't - * show up at all if you include the '/dev/' nowadays ... */ - if (match_tag(prom_argv[i], "console=/dev/")) { - char *ptr = prom_argv[i] + strlen("console=/dev/"); - - strcpy(cp, "console="); - cp += strlen("console="); - strcpy(cp, ptr); - cp += strlen(ptr); - *cp++ = ' '; - continue; - } - strcpy(cp, prom_argv[i]); - cp += strlen(prom_argv[i]); - *cp++ = ' '; - } - if (prom_argc > 1) - --cp; /* trailing space */ - - *cp = '\0'; -} - -void __init prom_init(void) -{ - bd_t *bd = gd->bd; - int memsize; - - memsize = bd->bi_memsize; - printk("Board info:\n"); - printk(" RAM size: %d MB\n", (int)memsize/(1024*1024)); - printk(" NOR start: %#lx\n", bd->bi_flashstart); - printk(" NOR size: %#lx\n", bd->bi_flashsize); - - prom_setup_cmdline(); - add_memory_region(0, memsize, BOOT_MEM_RAM); -} diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/setup.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/setup.c deleted file mode 100644 index b33c483d2..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/setup.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include - -#include -#include - -static void adm8668_restart(char *cmd) -{ - int i; - - /* the real deal */ - for (i = 0; i < 1000; i++) - ; - ADM8668_CONFIG_REG(ADM8668_CR1) = 1; -} - -void __init plat_mem_setup(void) -{ - _machine_restart = adm8668_restart; -} - -const char *get_system_type(void) -{ - unsigned long chipid = ADM8668_CONFIG_REG(ADM8668_CR0); - int product, revision; - static char ret[32]; - - product = chipid >> 16; - revision = chipid & 0xffff; - - /* i getting fancy :\ */ - snprintf(ret, sizeof(ret), "ADM%xr%x", product, revision); - - return ret; -} - diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/time.c b/target/linux/adm8668/files-3.18/arch/mips/adm8668/time.c deleted file mode 100644 index 87bdd6696..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/time.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -#include -#include - -void __init plat_time_init(void) -{ - struct clk *sys_clk; - - adm8668_init_clocks(); - - sys_clk = clk_get(NULL, "sys"); - if (IS_ERR(sys_clk)) - panic("unable to get system clock\n"); - - mips_hpt_frequency = clk_get_rate(sys_clk) / 2; -} - diff --git a/target/linux/adm8668/files-3.18/arch/mips/adm8668/u-boot.h b/target/linux/adm8668/files-3.18/arch/mips/adm8668/u-boot.h deleted file mode 100644 index d9d226889..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/adm8668/u-boot.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright 2003 - * Wolfgang Denk, DENX Software Engineering, - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#ifndef _U_BOOT_H_ -#define _U_BOOT_H_ 1 - -typedef struct bd_info { - int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ - unsigned char bi_enetaddr[6]; /* Ethernet adress */ - unsigned long bi_arch_number; /* unique id for this board */ - unsigned long bi_boot_params; /* where this board expects params */ - unsigned long bi_memstart; /* start of DRAM memory */ - unsigned long bi_memsize; /* size of DRAM memory in bytes */ - unsigned long bi_flashstart; /* start of FLASH memory */ - unsigned long bi_flashsize; /* size of FLASH memory */ - unsigned long bi_flashoffset; /* reserved area for startup monitor */ -} bd_t; - -struct global_data { - bd_t *bd; /* board data... */ - unsigned long flags; - unsigned long baudrate; - unsigned long have_console; /* serial_init() was called */ - unsigned long ram_size; /* RAM size */ - unsigned long reloc_off; /* Relocation Offset */ - unsigned long env_addr; /* Address of Environment struct */ - unsigned long env_valid; /* Checksum of Environment valid? */ - void **jt; /* jump table */ -}; - -#endif /* _U_BOOT_H_ */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/adm8668.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/adm8668.h deleted file mode 100644 index 8a16863c0..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/adm8668.h +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************ - * - * Copyright (c) 2005 - * Infineon Technologies AG - * St. Martin Strasse 53; 81669 Muenchen; Germany - * - ************************************************************************/ - -#ifndef __ADM8668_H__ -#define __ADM8668_H__ - -/*======================= Physical Memory Map ============================*/ -#define ADM8668_SDRAM_BASE 0 -#define ADM8668_SMEM1_BASE 0x10000000 -#define ADM8668_MPMC_BASE 0x11000000 -#define ADM8668_USB_BASE 0x11200000 -#define ADM8668_CONFIG_BASE 0x11400000 -#define ADM8668_WAN_BASE 0x11600000 -#define ADM8668_WLAN_BASE 0x11800000 -#define ADM8668_LAN_BASE 0x11A00000 -#define ADM8668_INTC_BASE 0x1E000000 -#define ADM8668_TMR_BASE 0x1E200000 -#define ADM8668_UART0_BASE 0x1E400000 -#define ADM8668_SMEM0_BASE 0x1FC00000 -#define ADM8668_NAND_BASE 0x1FFFFF00 - -#define ADM8668_PCICFG_BASE 0x12200000 -#define ADM8668_PCIDAT_BASE 0x12400000 - -/* interrupt levels */ -#define ADM8668_SWI_IRQ 1 -#define ADM8668_COMMS_RX_IRQ 2 -#define ADM8668_COMMS_TX_IRQ 3 -#define ADM8668_TIMER0_IRQ 4 -#define ADM8668_TIMER1_IRQ 5 -#define ADM8668_UART0_IRQ 6 -#define ADM8668_LAN_IRQ 7 -#define ADM8668_WAN_IRQ 8 -#define ADM8668_WLAN_IRQ 9 -#define ADM8668_GPIO_IRQ 10 -#define ADM8668_IDE_IRQ 11 -#define ADM8668_PCI2_IRQ 12 -#define ADM8668_PCI1_IRQ 13 -#define ADM8668_PCI0_IRQ 14 -#define ADM8668_USB_IRQ 15 -#define ADM8668_IRQ_MAX ADM8668_USB_IRQ - -/* register access macros */ -#define ADM8668_CONFIG_REG(_reg) \ - (*((volatile unsigned int *)(KSEG1ADDR(ADM8668_CONFIG_BASE + (_reg))))) - -/* lan registers */ -#define NETCSR6 0x30 -#define NETCSR7 0x38 -#define NETCSR37 0xF8 - -/* known/used CPU configuration registers */ -#define ADM8668_CR0 0x00 -#define ADM8668_CR1 0x04 -#define ADM8668_CR3 0x0C -#define ADM8668_CR66 0x108 - -/** For GPIO control **/ -#define GPIO_REG 0x5C /* on WLAN */ -#define CRGPIO_REG 0x20 /* on CPU */ - -void adm8668_init_clocks(void); - -#endif /* __ADM8668_H__ */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/asm/sizes.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/asm/sizes.h deleted file mode 100644 index 503843db1..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/asm/sizes.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/* DO NOT EDIT!! - this file automatically generated - * from .s file by awk -f s2h.awk - */ -/* Size definitions - * Copyright (C) ARM Limited 1998. All rights reserved. - */ - -#ifndef __sizes_h -#define __sizes_h 1 - -/* handy sizes */ -#define SZ_16 0x00000010 -#define SZ_256 0x00000100 -#define SZ_512 0x00000200 - -#define SZ_1K 0x00000400 -#define SZ_4K 0x00001000 -#define SZ_8K 0x00002000 -#define SZ_16K 0x00004000 -#define SZ_64K 0x00010000 -#define SZ_128K 0x00020000 -#define SZ_256K 0x00040000 -#define SZ_512K 0x00080000 - -#define SZ_1M 0x00100000 -#define SZ_2M 0x00200000 -#define SZ_4M 0x00400000 -#define SZ_8M 0x00800000 -#define SZ_16M 0x01000000 -#define SZ_32M 0x02000000 -#define SZ_64M 0x04000000 -#define SZ_128M 0x08000000 -#define SZ_256M 0x10000000 -#define SZ_512M 0x20000000 - -#define SZ_1G 0x40000000 -#define SZ_2G 0x80000000 - -#endif - -/* END */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/gpio.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/gpio.h deleted file mode 100644 index b0473fc4b..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/gpio.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __ADM8668_GPIO_H__ -#define __ADM8668_GPIO_H__ - -#define gpio_to_irq(gpio) -1 - -#define gpio_get_value __gpio_get_value -#define gpio_set_value __gpio_set_value - -#define gpio_cansleep __gpio_cansleep - -#include - -#endif diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/irq.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/irq.h deleted file mode 100644 index ea859f03a..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/irq.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 2003 by Ralf Baechle - */ -#ifndef __ASM_MACH_ADM8668_IRQ_H -#define __ASM_MACH_ADM8668_IRQ_H - -#define NR_IRQS 32 -#define MIPS_CPU_IRQ_BASE 16 - -#endif /* __ASM_MACH_ADM8668_IRQ_H */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/war.h b/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/war.h deleted file mode 100644 index 7180043d3..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/include/asm/mach-adm8668/war.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 2002, 2004, 2007 by Ralf Baechle - */ -#ifndef __ASM_MIPS_MACH_ADM8668_WAR_H -#define __ASM_MIPS_MACH_ADM8668_WAR_H - -#define R4600_V1_INDEX_ICACHEOP_WAR 0 -#define R4600_V1_HIT_CACHEOP_WAR 0 -#define R4600_V2_HIT_CACHEOP_WAR 0 -#define R5432_CP0_INTERRUPT_WAR 0 -#define BCM1250_M3_WAR 0 -#define SIBYTE_1956_WAR 0 -#define MIPS4K_ICACHE_REFILL_WAR 0 -#define MIPS_CACHE_SYNC_WAR 0 -#define TX49XX_ICACHE_INDEX_INV_WAR 0 -#define RM9000_CDEX_SMP_WAR 0 -#define ICACHE_REFILLS_WORKAROUND_WAR 0 -#define R10000_LLSC_WAR 0 -#define MIPS34K_MISSED_ITLB_WAR 0 - -#endif /* __ASM_MIPS_MACH_ADM8668_WAR_H */ diff --git a/target/linux/adm8668/files-3.18/arch/mips/pci/pci-adm8668.c b/target/linux/adm8668/files-3.18/arch/mips/pci/pci-adm8668.c deleted file mode 100644 index 5cfa54604..000000000 --- a/target/linux/adm8668/files-3.18/arch/mips/pci/pci-adm8668.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2010 Scott Nicholas - * Copyright (C) 2012 Florian Fainelli - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Note that this controller is identical to the ADM5120 one - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -static DEFINE_SPINLOCK(pci_lock); - -#define PCI_ENABLE 0x80000000 -#define ADMPCI_IO_BASE 0x12600000 -#define ADMPCI_IO_SIZE 0x1fffff -#define ADMPCI_MEM_BASE 0x16000000 -#define ADMPCI_MEM_SIZE 0x7ffffff - -static inline void write_cfgaddr(u32 addr) -{ - __raw_writel((addr | PCI_ENABLE), - (void __iomem *)KSEG1ADDR(ADM8668_PCICFG_BASE)); -} - -static inline void write_cfgdata(u32 data) -{ - __raw_writel(data, (void __iomem *)KSEG1ADDR(ADM8668_PCIDAT_BASE)); -} - -static inline u32 read_cfgdata(void) -{ - return __raw_readl((void __iomem *)KSEG1ADDR(ADM8668_PCIDAT_BASE)); -} - -static inline u32 mkaddr(struct pci_bus *bus, unsigned int devfn, int where) -{ - return ((bus->number & 0xff) << 16) | ((devfn & 0xff) << 8) | - (where & 0xfc); -} - -static int pci_read_config(struct pci_bus *bus, unsigned int devfn, - int where, int size, u32 *val) -{ - unsigned long flags; - u32 data; - - spin_lock_irqsave(&pci_lock, flags); - write_cfgaddr(mkaddr(bus, devfn, where)); - data = read_cfgdata(); - - switch (size) { - case 1: - if (where & 1) - data >>= 8; - if (where & 2) - data >>= 16; - data &= 0xff; - break; - case 2: - if (where & 2) - data >>= 16; - data &= 0xffff; - break; - } - - *val = data; - - spin_unlock_irqrestore(&pci_lock, flags); - - return PCIBIOS_SUCCESSFUL; -} - -static int pci_write_config(struct pci_bus *bus, unsigned int devfn, - int where, int size, u32 val) -{ - unsigned long flags; - u32 data; - int s; - - spin_lock_irqsave(&pci_lock, flags); - - write_cfgaddr(mkaddr(bus, devfn, where)); - data = read_cfgdata(); - - switch (size) { - case 1: - s = ((where & 3) << 3); - data &= ~(0xff << s); - data |= ((val & 0xff) << s); - break; - case 2: - s = ((where & 2) << 4); - data &= ~(0xffff << s); - data |= ((val & 0xffff) << s); - break; - case 4: - data = val; - break; - } - - write_cfgdata(data); - - spin_unlock_irqrestore(&pci_lock, flags); - - return PCIBIOS_SUCCESSFUL; -} - -struct pci_ops adm8668_pci_ops = { - .read = pci_read_config, - .write = pci_write_config -}; - - -struct resource pciioport_resource = { - .name = "adm8668_pci", - .start = ADMPCI_IO_BASE, - .end = ADMPCI_IO_BASE + ADMPCI_IO_SIZE, - .flags = IORESOURCE_IO -}; - -struct resource pciiomem_resource = { - .name = "adm8668_pci", - .start = ADMPCI_MEM_BASE, - .end = ADMPCI_MEM_BASE + ADMPCI_MEM_SIZE, - .flags = IORESOURCE_MEM -}; - -struct pci_controller adm8668_pci_controller = { - .pci_ops = &adm8668_pci_ops, - .io_resource = &pciioport_resource, - .mem_resource = &pciiomem_resource, -}; - -int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -{ - switch (slot) { - case 1: - return 14; - case 2: - return 13; - case 3: - return 12; - default: - return dev->irq; - } -} - -int pcibios_plat_dev_init(struct pci_dev *dev) -{ - return 0; -} - -static void adm8668_pci_fixup(struct pci_dev *dev) -{ - if (dev->devfn != 0) - return; - - pr_info("PCI: fixing up ADM8668 controller\n"); - - /* setup COMMAND register */ - pci_write_config_word(dev, PCI_COMMAND, - (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER)); - - /* setup CACHE_LINE_SIZE register */ - pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 4); - - /* setup BARS */ - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0); - pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0); -} -DECLARE_PCI_FIXUP_HEADER(0x1317, 0x8688, adm8668_pci_fixup); - -static int __init adm8668_pci_init(void) -{ - void __iomem *io_map_base; - - ioport_resource.start = ADMPCI_IO_BASE; - ioport_resource.end = ADMPCI_IO_BASE + ADMPCI_IO_SIZE; - - io_map_base = ioremap(ADMPCI_IO_BASE, ADMPCI_IO_SIZE); - if (!io_map_base) - printk("io_map_base didn't work.\n"); - - adm8668_pci_controller.io_map_base = (unsigned long)io_map_base; - register_pci_controller(&adm8668_pci_controller); - - return 0; -} -arch_initcall(adm8668_pci_init); diff --git a/target/linux/adm8668/files-3.18/drivers/mtd/maps/adm8668.c b/target/linux/adm8668/files-3.18/drivers/mtd/maps/adm8668.c deleted file mode 100644 index 7e51d5828..000000000 --- a/target/linux/adm8668/files-3.18/drivers/mtd/maps/adm8668.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (C) 2010 Scott Nicholas - * Copyright (C) 2006 Felix Fietkau - * Copyright (C) 2005 Waldemar Brodkorb - * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org) - * - * original functions for finding root filesystem from Mike Baker - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * Copyright 2004, Broadcom Corporation - * All Rights Reserved. - * - * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY - * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM - * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. - * - * Flash mapping for adm8668 boards - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define WINDOW_ADDR 0x10000000 -#define WINDOW_SIZE 0x800000 -#define BANKWIDTH 2 - -/* first a little bit about the headers i need.. */ - -/* just interested in part of the full struct */ -struct squashfs_super_block { - __le32 s_magic; - __le32 pad0[9]; /* it's not really padding */ - __le64 bytes_used; -}; - -#define IH_MAGIC 0x56190527 /* Image Magic Number */ -struct uboot_header { - uint32_t ih_magic; /* Image Header Magic Number */ - uint32_t ih_hcrc; /* Image Header CRC Checksum */ - uint32_t ih_time; /* Image Creation Timestamp */ - uint32_t ih_size; /* Image Data Size */ - uint32_t ih_load; /* Data Load Address */ - uint32_t ih_ep; /* Entry Point Address */ - uint32_t ih_dcrc; /* Image Data CRC Checksum */ - uint8_t ih_os; /* Operating System */ - uint8_t ih_arch; /* CPU architecture */ - uint8_t ih_type; /* Image Type */ - uint8_t ih_comp; /* Compression Type */ - char ih_name[32]; /* image name */ -}; - -/************************************************/ - -static struct mtd_info *adm8668_mtd; - -struct map_info adm8668_map = { - name: "adm8668-nor", - size: WINDOW_SIZE, - phys: WINDOW_ADDR, - bankwidth: BANKWIDTH, -}; - -/* - * Copied from mtdblock.c - * - * Cache stuff... - * - * Since typical flash erasable sectors are much larger than what Linux's - * buffer cache can handle, we must implement read-modify-write on flash - * sectors for each block write requests. To avoid over-erasing flash sectors - * and to speed things up, we locally cache a whole flash sector while it is - * being written to until a different sector is required. - */ - -static void erase_callback(struct erase_info *done) -{ - wait_queue_head_t *wait_q = (wait_queue_head_t *)done->priv; - wake_up(wait_q); -} - -static int erase_write (struct mtd_info *mtd, unsigned long pos, - int len, const char *buf) -{ - struct erase_info erase; - DECLARE_WAITQUEUE(wait, current); - wait_queue_head_t wait_q; - size_t retlen; - int ret; - - /* - * First, let's erase the flash block. - */ - - init_waitqueue_head(&wait_q); - erase.mtd = mtd; - erase.callback = erase_callback; - erase.addr = pos; - erase.len = len; - erase.priv = (u_long)&wait_q; - - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(&wait_q, &wait); - - ret = mtd->_erase(mtd, &erase); - if (ret) { - set_current_state(TASK_RUNNING); - remove_wait_queue(&wait_q, &wait); - printk (KERN_WARNING "erase of region [0x%lx, 0x%x] " - "on \"%s\" failed\n", - pos, len, mtd->name); - return ret; - } - - schedule(); /* Wait for erase to finish. */ - remove_wait_queue(&wait_q, &wait); - - /* - * Next, write data to flash. - */ - - ret = mtd->_write (mtd, pos, len, &retlen, buf); - if (ret) - return ret; - if (retlen != len) - return -EIO; - return 0; -} - -/* decent defaults in case... shrug */ -static struct mtd_partition adm8668_parts[] = { - { name: "linux", offset: 0x40000, size: WINDOW_SIZE-0x40000, }, - { name: "rootfs", offset: 0xe0000, size: 0x140000, }, - { name: "uboot_env", offset: 0x20000, size: 0x20000, }, - { name: NULL, }, -}; - -/* in case i wanna change stuff later, and to clarify the math section... */ -#define PART_LINUX 0 -#define PART_ROOTFS 1 -#define NR_PARTS 3 - -static int __init -init_mtd_partitions(struct mtd_info *mtd, size_t size) -{ - struct uboot_header uhdr; - int off, blocksize; - size_t len, linux_len; - struct squashfs_super_block shdr; - - blocksize = mtd->erasesize; - if (blocksize < 0x10000) - blocksize = 0x10000; - - /* now find squashfs */ - memset(&shdr, 0xe5, sizeof(shdr)); - for (off = adm8668_parts[PART_LINUX].offset; off < size; off += blocksize) { - /* - * Read into buffer - */ - if (mtd->_read(mtd, off, sizeof(shdr), &len, (char *)&shdr) || - len != sizeof(shdr)) - continue; - - if (shdr.s_magic == SQUASHFS_MAGIC) { - uint32_t fs_size = (uint32_t)shdr.bytes_used; - - printk(KERN_INFO "%s: Filesystem type: squashfs, size=%dkB\n", - mtd->name, fs_size>>10); - - /* Update rootfs based on the superblock info, and - * stretch to end of MTD. rootfs_split will split it */ - adm8668_parts[PART_ROOTFS].offset = off; - adm8668_parts[PART_ROOTFS].size = mtd->size - - adm8668_parts[PART_ROOTFS].offset; - - /* kernel ends where rootfs starts - * but we'll keep it full-length for upgrades */ - linux_len = adm8668_parts[PART_LINUX+1].offset - - adm8668_parts[PART_LINUX].offset; -#if 1 - adm8668_parts[PART_LINUX].size = mtd->size - - adm8668_parts[PART_LINUX].offset; -#else - adm8668_parts[PART_LINUX].size = linux_len; -#endif - goto found; - } - } - - printk(KERN_NOTICE - "%s: Couldn't find root filesystem\n", - mtd->name); - return NR_PARTS; - - found: - if (mtd->_read(mtd, adm8668_parts[PART_LINUX].offset, sizeof(uhdr), &len, (char *)&uhdr) || - len != sizeof(uhdr)) - return NR_PARTS; - - /* that's odd. how'd ya boot it then */ - if (uhdr.ih_magic != IH_MAGIC) - return NR_PARTS; - - if (be32_to_cpu(uhdr.ih_size) != (linux_len - sizeof(uhdr))) { - unsigned char *block, *data; - unsigned int offset; - - offset = adm8668_parts[PART_LINUX].offset + - sizeof(struct uboot_header); - data = (unsigned char *)(WINDOW_ADDR | 0xA0000000 | offset); - - printk(KERN_NOTICE "Updating U-boot image:\n"); - printk(KERN_NOTICE " old: [size: %8d crc32: 0x%08x]\n", - be32_to_cpu(uhdr.ih_size), be32_to_cpu(uhdr.ih_dcrc)); - - /* Update the data length & crc32 */ - uhdr.ih_size = cpu_to_be32(linux_len - sizeof(uhdr)); - uhdr.ih_dcrc = crc32_le(~0, data, linux_len - sizeof(uhdr)) ^ (~0); - uhdr.ih_dcrc = cpu_to_be32(uhdr.ih_dcrc); - - printk(KERN_NOTICE " new: [size: %8d crc32: 0x%08x]\n", - be32_to_cpu(uhdr.ih_size), be32_to_cpu(uhdr.ih_dcrc)); - - /* update header's crc... */ - uhdr.ih_hcrc = 0; - uhdr.ih_hcrc = crc32_le(~0, (unsigned char *)&uhdr, - sizeof(uhdr)) ^ (~0); - uhdr.ih_hcrc = cpu_to_be32(uhdr.ih_hcrc); - - /* read first eraseblock from the image */ - block = kmalloc(mtd->erasesize, GFP_KERNEL); - if (mtd->_read(mtd, adm8668_parts[PART_LINUX].offset, mtd->erasesize, &len, block) || len != mtd->erasesize) { - printk("Error copying first eraseblock\n"); - return 0; - } - - /* Write updated header to the flash */ - memcpy(block, &uhdr, sizeof(uhdr)); - if (mtd->_unlock) - mtd->_unlock(mtd, off, mtd->erasesize); - erase_write(mtd, adm8668_parts[PART_LINUX].offset, mtd->erasesize, block); - if (mtd->_sync) - mtd->_sync(mtd); - kfree(block); - printk(KERN_NOTICE "Done\n"); - } - - return NR_PARTS; -} - -int __init init_adm8668_map(void) -{ - int nr_parts, ret; - - adm8668_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); - - if (!adm8668_map.virt) { - printk(KERN_ERR "Failed to ioremap\n"); - return -EIO; - } - - simple_map_init(&adm8668_map); - if (!(adm8668_mtd = do_map_probe("cfi_probe", &adm8668_map))) { - printk(KERN_ERR "cfi_probe failed\n"); - iounmap((void *)adm8668_map.virt); - return -ENXIO; - } - - adm8668_mtd->owner = THIS_MODULE; - - nr_parts = init_mtd_partitions(adm8668_mtd, adm8668_mtd->size); - ret = mtd_device_register(adm8668_mtd, adm8668_parts, nr_parts); - if (ret) { - printk(KERN_ERR "Flash: mtd_device_register failed\n"); - goto fail; - } - - return 0; - - fail: - if (adm8668_mtd) - map_destroy(adm8668_mtd); - if (adm8668_map.virt) - iounmap((void *) adm8668_map.virt); - adm8668_map.virt = 0; - return ret; -} - -void __exit cleanup_adm8668_map(void) -{ - mtd_device_unregister(adm8668_mtd); - map_destroy(adm8668_mtd); - iounmap((void *) adm8668_map.virt); - adm8668_map.virt = 0; -} - -module_init(init_adm8668_map); -module_exit(cleanup_adm8668_map); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Scott Nicholas "); -MODULE_DESCRIPTION("MTD map driver for ADM8668 NOR Flash"); diff --git a/target/linux/adm8668/image/Makefile b/target/linux/adm8668/image/Makefile deleted file mode 100644 index 597b8f74a..000000000 --- a/target/linux/adm8668/image/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux -UIMAGE:=$(IMG_PREFIX)-uImage - -define kernel_entry --a 0x80002000 -e 0x80002000 -endef - - -define CompressGzip - gzip -9n -c $(1) > $(2) -endef - -define MkImage - mkimage -A mips -O linux -T kernel $(call kernel_entry) -C $(1) $(2) \ - -n "ADM8668 Linux Kernel(2.4.31)" \ - -d $(3) $(4) -endef - -define Build/Clean - $(MAKE) -C lzma-loader clean -endef - -define Image/Prepare - cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma - $(MAKE) -C lzma-loader \ - KDIR="$(KDIR)" \ - clean compile - rm -f $(KDIR)/fs_mark - touch $(KDIR)/fs_mark - $(call prepare_generic_squashfs,$(KDIR)/fs_mark) -endef - -define Image/Build - ./my-mkimage $(KDIR)/loader.bin $(KDIR)/root.squashfs \ - $(KDIR)/fs_mark $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin -endef - -define Image/BuildKernel - cp $(KDIR)/vmlinux.elf $(VMLINUX).elf - cp $(KDIR)/vmlinux $(VMLINUX).bin - $(call CompressGzip,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.gz) - $(call MkImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(BIN_DIR)/$(UIMAGE)-gzip.bin) -ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) - cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf - cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin - $(call CompressGzip,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.gz) - $(call MkImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(BIN_DIR)/$(UIMAGE)-initramfs-gzip.bin) -endif -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/adm8668/image/lzma-loader/Makefile b/target/linux/adm8668/image/lzma-loader/Makefile deleted file mode 100644 index f6bc7cef3..000000000 --- a/target/linux/adm8668/image/lzma-loader/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME := loader -PKG_VERSION := 0.05 - -PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)-$(PKG_VERSION)$(LOADER_TYPE) - -$(PKG_BUILD_DIR)/.prepared: - mkdir $(PKG_BUILD_DIR) - $(CP) ./src/* $(PKG_BUILD_DIR)/ - touch $@ - -$(PKG_BUILD_DIR)/lzma.elf: $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/vmlinux.lzma - PATH="$(TARGET_PATH)" $(MAKE) -C $(PKG_BUILD_DIR) \ - CC="$(TARGET_CC)" CROSS_COMPILE="$(TARGET_CROSS)" - -$(PKG_BUILD_DIR)/vmlinux.lzma: $(KDIR)/vmlinux.lzma - $(CP) $< $@ - -$(KDIR)/loader$(LOADER_TYPE).elf: $(PKG_BUILD_DIR)/lzma.elf - $(CP) $< $@ - -$(KDIR)/loader$(LOADER_TYPE).bin: $(PKG_BUILD_DIR)/lzma.bin - $(CP) $< $@ - -download: -prepare: $(PKG_BUILD_DIR)/.prepared -compile: $(KDIR)/loader$(LOADER_TYPE).elf $(KDIR)/loader$(LOADER_TYPE).bin -install: - -clean: - rm -rf $(PKG_BUILD_DIR) - rm -f $(KDIR)/loader.elf - rm -f $(KDIR)/loader.bin diff --git a/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.c b/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.c deleted file mode 100644 index 8c863efe5..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.c +++ /dev/null @@ -1,590 +0,0 @@ -/* - LzmaDecode.c - LZMA Decoder (optimized for Speed version) - - LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this Code, expressly permits you to - statically or dynamically link your Code (or bind by name) to the - interfaces of this file without subjecting your linked Code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#include "LzmaDecode.h" - -#ifndef Byte -#define Byte unsigned char -#endif - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 - -#define RC_READ_BYTE (*Buffer++) - -#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ - { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} - -#ifdef _LZMA_IN_CB - -#define RC_TEST { if (Buffer == BufferLim) \ - { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ - BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} - -#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 - -#else - -#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } - -#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 - -#endif - -#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } - -#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) -#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; -#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; - -#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ - { UpdateBit0(p); mi <<= 1; A0; } else \ - { UpdateBit1(p); mi = (mi + mi) + 1; A1; } - -#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) - -#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ - { int i = numLevels; res = 1; \ - do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ - res -= (1 << numLevels); } - - -#define kNumPosBitsMax 4 -#define kNumPosStatesMax (1 << kNumPosBitsMax) - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define LenChoice 0 -#define LenChoice2 (LenChoice + 1) -#define LenLow (LenChoice2 + 1) -#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) - - -#define kNumStates 12 -#define kNumLitStates 7 - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#define kNumPosSlotBits 6 -#define kNumLenToPosStates 4 - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) - -#define kMatchMinLen 2 - -#define IsMatch 0 -#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -#define IsRepG0 (IsRep + kNumStates) -#define IsRepG1 (IsRepG0 + kNumStates) -#define IsRepG2 (IsRepG1 + kNumStates) -#define IsRep0Long (IsRepG2 + kNumStates) -#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -#define LenCoder (Align + kAlignTableSize) -#define RepLenCoder (LenCoder + kNumLenProbs) -#define Literal (RepLenCoder + kNumLenProbs) - -#if Literal != LZMA_BASE_SIZE -StopCompilingDueBUG -#endif - -#if 0 -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) -{ - unsigned char prop0; - if (size < LZMA_PROPERTIES_SIZE) - return LZMA_RESULT_DATA_ERROR; - prop0 = propsData[0]; - if (prop0 >= (9 * 5 * 5)) - return LZMA_RESULT_DATA_ERROR; - { - for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); - for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); - propsRes->lc = prop0; - /* - unsigned char remainder = (unsigned char)(prop0 / 9); - propsRes->lc = prop0 % 9; - propsRes->pb = remainder / 5; - propsRes->lp = remainder % 5; - */ - } - - #ifdef _LZMA_OUT_READ - { - int i; - propsRes->DictionarySize = 0; - for (i = 0; i < 4; i++) - propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); - if (propsRes->DictionarySize == 0) - propsRes->DictionarySize = 1; - } - #endif - return LZMA_RESULT_OK; -} -#endif - -#define kLzmaStreamWasFinishedId (-1) - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *InCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) -{ - CProb *p = vs->Probs; - SizeT nowPos = 0; - Byte previousByte = 0; - UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; - UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; - int lc = vs->Properties.lc; - - #ifdef _LZMA_OUT_READ - - UInt32 Range = vs->Range; - UInt32 Code = vs->Code; - #ifdef _LZMA_IN_CB - const Byte *Buffer = vs->Buffer; - const Byte *BufferLim = vs->BufferLim; - #else - const Byte *Buffer = inStream; - const Byte *BufferLim = inStream + inSize; - #endif - int state = vs->State; - UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; - int len = vs->RemainLen; - UInt32 globalPos = vs->GlobalPos; - UInt32 distanceLimit = vs->DistanceLimit; - - Byte *dictionary = vs->Dictionary; - UInt32 dictionarySize = vs->Properties.DictionarySize; - UInt32 dictionaryPos = vs->DictionaryPos; - - Byte tempDictionary[4]; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - if (len == kLzmaStreamWasFinishedId) - return LZMA_RESULT_OK; - - if (dictionarySize == 0) - { - dictionary = tempDictionary; - dictionarySize = 1; - tempDictionary[0] = vs->TempDictionary[0]; - } - - if (len == kLzmaNeedInitId) - { - { - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - UInt32 i; - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - rep0 = rep1 = rep2 = rep3 = 1; - state = 0; - globalPos = 0; - distanceLimit = 0; - dictionaryPos = 0; - dictionary[dictionarySize - 1] = 0; - #ifdef _LZMA_IN_CB - RC_INIT; - #else - RC_INIT(inStream, inSize); - #endif - } - len = 0; - } - while(len != 0 && nowPos < outSize) - { - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - len--; - } - if (dictionaryPos == 0) - previousByte = dictionary[dictionarySize - 1]; - else - previousByte = dictionary[dictionaryPos - 1]; - - #else /* if !_LZMA_OUT_READ */ - - int state = 0; - UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; - int len = 0; - const Byte *Buffer; - const Byte *BufferLim; - UInt32 Range; - UInt32 Code; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - - { - UInt32 i; - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - } - - #ifdef _LZMA_IN_CB - RC_INIT; - #else - RC_INIT(inStream, inSize); - #endif - - #endif /* _LZMA_OUT_READ */ - - while(nowPos < outSize) - { - CProb *prob; - UInt32 bound; - int posState = (int)( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & posStateMask); - - prob = p + IsMatch + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - int symbol = 1; - UpdateBit0(prob) - prob = p + Literal + (LZMA_LIT_SIZE * - ((( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & literalPosMask) << lc) + (previousByte >> (8 - lc)))); - - if (state >= kNumLitStates) - { - int matchByte; - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - matchByte = dictionary[pos]; - #else - matchByte = outStream[nowPos - rep0]; - #endif - do - { - int bit; - CProb *probLit; - matchByte <<= 1; - bit = (matchByte & 0x100); - probLit = prob + 0x100 + bit + symbol; - RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) - } - while (symbol < 0x100); - } - while (symbol < 0x100) - { - CProb *probLit = prob + symbol; - RC_GET_BIT(probLit, symbol) - } - previousByte = (Byte)symbol; - - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #endif - if (state < 4) state = 0; - else if (state < 10) state -= 3; - else state -= 6; - } - else - { - UpdateBit1(prob); - prob = p + IsRep + state; - IfBit0(prob) - { - UpdateBit0(prob); - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - state = state < kNumLitStates ? 0 : 3; - prob = p + LenCoder; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG0 + state; - IfBit0(prob) - { - UpdateBit0(prob); - prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - #ifdef _LZMA_OUT_READ - UInt32 pos; - #endif - UpdateBit0(prob); - - #ifdef _LZMA_OUT_READ - if (distanceLimit == 0) - #else - if (nowPos == 0) - #endif - return LZMA_RESULT_DATA_ERROR; - - state = state < kNumLitStates ? 9 : 11; - #ifdef _LZMA_OUT_READ - pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - #endif - - continue; - } - else - { - UpdateBit1(prob); - } - } - else - { - UInt32 distance; - UpdateBit1(prob); - prob = p + IsRepG1 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep1; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG2 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep2; - } - else - { - UpdateBit1(prob); - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - state = state < kNumLitStates ? 8 : 11; - prob = p + RepLenCoder; - } - { - int numBits, offset; - CProb *probLen = prob + LenChoice; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - numBits = kLenNumLowBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenChoice2; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - numBits = kLenNumMidBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - numBits = kLenNumHighBits; - } - } - RangeDecoderBitTreeDecode(probLen, numBits, len); - len += offset; - } - - if (state < 4) - { - int posSlot; - state += kNumLitStates; - prob = p + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << - kNumPosSlotBits); - RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); - if (posSlot >= kStartPosModelIndex) - { - int numDirectBits = ((posSlot >> 1) - 1); - rep0 = (2 | ((UInt32)posSlot & 1)); - if (posSlot < kEndPosModelIndex) - { - rep0 <<= numDirectBits; - prob = p + SpecPos + rep0 - posSlot - 1; - } - else - { - numDirectBits -= kNumAlignBits; - do - { - RC_NORMALIZE - Range >>= 1; - rep0 <<= 1; - if (Code >= Range) - { - Code -= Range; - rep0 |= 1; - } - } - while (--numDirectBits != 0); - prob = p + Align; - rep0 <<= kNumAlignBits; - numDirectBits = kNumAlignBits; - } - { - int i = 1; - int mi = 1; - do - { - CProb *prob3 = prob + mi; - RC_GET_BIT2(prob3, mi, ; , rep0 |= i); - i <<= 1; - } - while(--numDirectBits != 0); - } - } - else - rep0 = posSlot; - if (++rep0 == (UInt32)(0)) - { - /* it's for stream version */ - len = kLzmaStreamWasFinishedId; - break; - } - } - - len += kMatchMinLen; - #ifdef _LZMA_OUT_READ - if (rep0 > distanceLimit) - #else - if (rep0 > nowPos) - #endif - return LZMA_RESULT_DATA_ERROR; - - #ifdef _LZMA_OUT_READ - if (dictionarySize - distanceLimit > (UInt32)len) - distanceLimit += len; - else - distanceLimit = dictionarySize; - #endif - - do - { - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - len--; - outStream[nowPos++] = previousByte; - } - while(len != 0 && nowPos < outSize); - } - } - RC_NORMALIZE; - - #ifdef _LZMA_OUT_READ - vs->Range = Range; - vs->Code = Code; - vs->DictionaryPos = dictionaryPos; - vs->GlobalPos = globalPos + (UInt32)nowPos; - vs->DistanceLimit = distanceLimit; - vs->Reps[0] = rep0; - vs->Reps[1] = rep1; - vs->Reps[2] = rep2; - vs->Reps[3] = rep3; - vs->State = state; - vs->RemainLen = len; - vs->TempDictionary[0] = tempDictionary[0]; - #endif - - #ifdef _LZMA_IN_CB - vs->Buffer = Buffer; - vs->BufferLim = BufferLim; - #else - *inSizeProcessed = (SizeT)(Buffer - inStream); - #endif - *outSizeProcessed = nowPos; - return LZMA_RESULT_OK; -} diff --git a/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.h b/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.h deleted file mode 100644 index abc02d7ed..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/LzmaDecode.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - LzmaDecode.h - LZMA Decoder interface - - LZMA SDK 4.21 Copyright (c) 1999-2005 Igor Pavlov (2005-06-08) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to the - interfaces of this file without subjecting your linked code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#ifndef __LZMADECODE_H -#define __LZMADECODE_H - -/* #define _LZMA_IN_CB */ -/* Use callback for input data */ - -/* #define _LZMA_OUT_READ */ -/* Use read function for output data */ - -/* #define _LZMA_PROB32 */ -/* It can increase speed on some 32-bit CPUs, - but memory usage will be doubled in that case */ - -/* #define _LZMA_LOC_OPT */ -/* Enable local speed optimizations inside code */ - -/* #define _LZMA_SYSTEM_SIZE_T */ -/* Use system's size_t. You can use it to enable 64-bit sizes supporting*/ - -#ifndef UInt32 -#ifdef _LZMA_UINT32_IS_ULONG -#define UInt32 unsigned long -#else -#define UInt32 unsigned int -#endif -#endif - -#ifndef SizeT -#ifdef _LZMA_SYSTEM_SIZE_T -#include -#define SizeT size_t -#else -#define SizeT UInt32 -#endif -#endif - -#ifdef _LZMA_PROB32 -#define CProb UInt32 -#else -#define CProb unsigned short -#endif - -#define LZMA_RESULT_OK 0 -#define LZMA_RESULT_DATA_ERROR 1 - -#ifdef _LZMA_IN_CB -typedef struct _ILzmaInCallback -{ - int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); -} ILzmaInCallback; -#endif - -#define LZMA_BASE_SIZE 1846 -#define LZMA_LIT_SIZE 768 - -#define LZMA_PROPERTIES_SIZE 5 - -typedef struct _CLzmaProperties -{ - int lc; - int lp; - int pb; - #ifdef _LZMA_OUT_READ - UInt32 DictionarySize; - #endif -}CLzmaProperties; - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); - -#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) - -#define kLzmaNeedInitId (-2) - -typedef struct _CLzmaDecoderState -{ - CLzmaProperties Properties; - CProb *Probs; - - #ifdef _LZMA_IN_CB - const unsigned char *Buffer; - const unsigned char *BufferLim; - #endif - - #ifdef _LZMA_OUT_READ - unsigned char *Dictionary; - UInt32 Range; - UInt32 Code; - UInt32 DictionaryPos; - UInt32 GlobalPos; - UInt32 DistanceLimit; - UInt32 Reps[4]; - int State; - int RemainLen; - unsigned char TempDictionary[4]; - #endif -} CLzmaDecoderState; - -#ifdef _LZMA_OUT_READ -#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } -#endif - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *inCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); - -#endif diff --git a/target/linux/adm8668/image/lzma-loader/src/Makefile b/target/linux/adm8668/image/lzma-loader/src/Makefile deleted file mode 100644 index 998e39081..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -RAMSTART = 0x80000000 -RAMSIZE = 0x00800000 # 8MB -LOADADDR = 0x80400000 # RAM start + 4M -KERNEL_ENTRY = 0x80002000 - -CROSS_COMPILE = mipsel-openwrt-linux- - -OBJCOPY:= $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S -CFLAGS := -I./include -fno-builtin -Os -G 0 -ffunction-sections -mno-abicalls -fno-pic -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -Wall -DRAMSTART=${RAMSTART} -DRAMSIZE=${RAMSIZE} -DKERNEL_ENTRY=${KERNEL_ENTRY} - -.c.o: - $(CC) $(CFLAGS) -c $< -o $*.o - -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld -OBJDUMP = $(CROSS_COMPILE)objdump - -O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32) - -# Drop some uninteresting sections in the kernel. -# This is only relevant for ELF kernels but doesn't hurt a.out -drop-sections = .reginfo .mdebug .comment -strip-flags = $(addprefix --remove-section=,$(drop-sections)) - -all : lzma.elf lzma.bin - -lzma.lds: lzma.lds.in - sed -e 's,@LOADADDR@,$(LOADADDR),g' $< >$@ - -kernel.o: vmlinux.lzma lzma.lds - $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $< - -lzma.bin: lzma.elf - $(OBJCOPY) $< $@ - -lzma.elf: decompress.o stubs.o LzmaDecode.o kernel.o lzma.lds - $(LD) -T lzma.lds -o $@ $^ -#-s ^ - -clean: - rm -f *.o lzma.elf lzma.bin *.tmp *.lds diff --git a/target/linux/adm8668/image/lzma-loader/src/decompress.c b/target/linux/adm8668/image/lzma-loader/src/decompress.c deleted file mode 100644 index f328058a1..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/decompress.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * LZMA compressed kernel decompressor for bcm947xx boards - * - * Copyright (C) 2005 by Oleg I. Vdovikin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * - * Please note, this was code based on the bunzip2 decompressor code - * by Manuel Novoa III (mjn3@codepoet.org), although the only thing left - * is an idea and part of original vendor code - * - * - * 12-Mar-2005 Mineharu Takahara - * pass actual output size to decoder (stream mode - * compressed input is not a requirement anymore) - * - * 24-Apr-2005 Oleg I. Vdovikin - * reordered functions using lds script, removed forward decl - * - * ??-Nov-2005 Mike Baker - * reorder the script as an lzma wrapper; do not depend on flash access - */ - -#include "LzmaDecode.h" -#include - -#define KSEG0ADDR(addr) (0x80000000|addr) - -register volatile gd_t *gd asm ("k0"); -unsigned char *data; - -static __inline__ unsigned char get_byte() -{ - unsigned char *buffer; - - buffer = data; - data++; - - return *buffer; -} - -/* This puts lzma workspace 128k below RAM end. - * That should be enough for both lzma and stack - */ -static char *buffer = (char *)(RAMSTART + RAMSIZE - 0x00020000); -extern char _binary_vmlinux_lzma_start[]; -extern char _binary_vmlinux_lzma_end[]; -extern char lzma_start[]; -extern char lzma_end[]; - -/* should be the first function */ -void entry(unsigned int arg0, unsigned int arg1, - unsigned int arg2, unsigned int arg3) -{ - unsigned int i; /* temp value */ - unsigned int isize; /* compressed size */ - unsigned int osize; /* uncompressed size */ - int argc = arg0; - char **argv = (char **)arg1; - char **envp = (char **)arg2; - - CLzmaDecoderState vs; - - data = (unsigned char *)_binary_vmlinux_lzma_start; - isize = _binary_vmlinux_lzma_end - _binary_vmlinux_lzma_start + 1; - - puts("\nLZMA kernel loader\n"); - - printf("lzma data @ %#x - %#x\n", _binary_vmlinux_lzma_start, _binary_vmlinux_lzma_end); - printf("load addr @ %#x\n\n", KERNEL_ENTRY); - printf("jump table @ %#x\n", gd->jt[3]); - - /* lzma args */ - i = get_byte(); - vs.Properties.lc = i % 9, i = i / 9; - vs.Properties.lp = i % 5, vs.Properties.pb = i / 5; - - vs.Probs = (CProb *)buffer; - - /* skip rest of the LZMA coder property */ - data += 4; - - /* read the lower half of uncompressed size in the header */ - osize = ((unsigned int)get_byte()) + - ((unsigned int)get_byte() << 8) + - ((unsigned int)get_byte() << 16) + - ((unsigned int)get_byte() << 24); - - /* skip rest of the header (upper half of uncompressed size) */ - data += 4; - - /* decompress kernel */ - puts("\nDecompressing kernel..."); - if ((i = LzmaDecode(&vs, - (unsigned char*)data, isize, &isize, - (unsigned char*)KERNEL_ENTRY, osize, &osize)) == LZMA_RESULT_OK) - { - puts("success!\n"); - - /* Jump to load address */ -// ((void (*)(int a0, int a1, int a2, int a3))KERNEL_ENTRY)(0,0,0,0); - ((void (*)(int a0, int a1, int a2, int a3))KERNEL_ENTRY)(arg0, arg1, arg2, arg3); - } - puts("failure!\n"); -} diff --git a/target/linux/adm8668/image/lzma-loader/src/include/_exports.h b/target/linux/adm8668/image/lzma-loader/src/include/_exports.h deleted file mode 100644 index 61dcaaf33..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/include/_exports.h +++ /dev/null @@ -1,18 +0,0 @@ -EXPORT_FUNC(get_version) -EXPORT_FUNC(getc) -EXPORT_FUNC(tstc) -EXPORT_FUNC(putc) -EXPORT_FUNC(puts) -EXPORT_FUNC(printf) -EXPORT_FUNC(install_hdlr) -EXPORT_FUNC(free_hdlr) -EXPORT_FUNC(malloc) -EXPORT_FUNC(free) -EXPORT_FUNC(udelay) -EXPORT_FUNC(get_timer) -EXPORT_FUNC(vprintf) -EXPORT_FUNC(do_reset) -#if (CONFIG_COMMANDS & CFG_CMD_I2C) -EXPORT_FUNC(i2c_write) -EXPORT_FUNC(i2c_read) -#endif /* CFG_CMD_I2C */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/asm/global_data.h b/target/linux/adm8668/image/lzma-loader/src/include/asm/global_data.h deleted file mode 100644 index a024194ba..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/include/asm/global_data.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (C) Copyright 2002-2003 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#ifndef __ASM_GBL_DATA_H -#define __ASM_GBL_DATA_H - -#include - -/* - * The following data structure is placed in some memory wich is - * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or - * some locked parts of the data cache) to allow for a minimum set of - * global variables during system initialization (until we have set - * up the memory controller so that we can use RAM). - * - * Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t) - */ - -typedef struct global_data { - bd_t *bd; - unsigned long flags; - unsigned long baudrate; - unsigned long have_console; /* serial_init() was called */ - unsigned long ram_size; /* RAM size */ - unsigned long reloc_off; /* Relocation Offset */ - unsigned long env_addr; /* Address of Environment struct */ - unsigned long env_valid; /* Checksum of Environment valid? */ - void **jt; /* jump table */ -} gd_t; - -/* - * Global Data Flags - */ -#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ -#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ -#define GD_FLG_SILENT 0x00004 /* Silent mode */ - -#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0") - -#endif /* __ASM_GBL_DATA_H */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/asm/u-boot.h b/target/linux/adm8668/image/lzma-loader/src/include/asm/u-boot.h deleted file mode 100644 index 0de0b4da8..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/include/asm/u-boot.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (C) Copyright 2003 - * Wolfgang Denk, DENX Software Engineering, - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#ifndef _U_BOOT_H_ -#define _U_BOOT_H_ 1 - -typedef struct bd_info { - int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ - unsigned char bi_enetaddr[6]; /* Ethernet adress */ - unsigned long bi_arch_number; /* unique id for this board */ - unsigned long bi_boot_params; /* where this board expects params */ - unsigned long bi_memstart; /* start of DRAM memory */ - unsigned long bi_memsize; /* size of DRAM memory in bytes */ - unsigned long bi_flashstart; /* start of FLASH memory */ - unsigned long bi_flashsize; /* size of FLASH memory */ - unsigned long bi_flashoffset; /* reserved area for startup monitor */ -} bd_t; -#define bi_env_data bi_env->data -#define bi_env_crc bi_env->crc - -#endif /* _U_BOOT_H_ */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/common.h b/target/linux/adm8668/image/lzma-loader/src/include/common.h deleted file mode 100644 index 5d957af6a..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/include/common.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#ifndef __COMMON_H_ -#define __COMMON_H_ 1 - -#undef _LINUX_CONFIG_H -#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */ - -typedef unsigned char uchar; -typedef volatile unsigned long vu_long; -typedef volatile unsigned short vu_short; -typedef volatile unsigned char vu_char; - -#include -#include -#include -#include -#include -#include - -typedef void (interrupt_handler_t)(void *); - -#include /* boot information for Linux kernel */ -#include /* global data used for startup functions */ - - -#endif /* __COMMON_H_ */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/exports.h b/target/linux/adm8668/image/lzma-loader/src/include/exports.h deleted file mode 100644 index 4cdc36e37..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/include/exports.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __EXPORTS_H__ -#define __EXPORTS_H__ -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#ifndef __ASSEMBLY__ - -#include - -/* These are declarations of exported functions available in C code */ -unsigned long get_version(void); -int getc(void); -int tstc(void); -void putc(const char); -void puts(const char*); -void printf(const char* fmt, ...); -void install_hdlr(int, interrupt_handler_t*, void*); -void free_hdlr(int); -void *malloc(size_t); -void free(void*); -void udelay(unsigned long); -unsigned long get_timer(unsigned long); -void vprintf(const char *, va_list); -void do_reset (void); - -void app_startup(char **); - -#endif /* ifndef __ASSEMBLY__ */ - -enum { -#define EXPORT_FUNC(x) XF_ ## x , -#include <_exports.h> -#undef EXPORT_FUNC - - XF_MAX -}; - -#define XF_VERSION 2 - -#endif /* __EXPORTS_H__ */ diff --git a/target/linux/adm8668/image/lzma-loader/src/include/image.h b/target/linux/adm8668/image/lzma-loader/src/include/image.h deleted file mode 100644 index 69c73b71d..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/include/image.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * (C) Copyright 2000 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#ifndef __IMAGE_H__ -#define __IMAGE_H__ - -/* - * Operating System Codes - */ -#define IH_OS_INVALID 0 /* Invalid OS */ -#define IH_OS_OPENBSD 1 /* OpenBSD */ -#define IH_OS_NETBSD 2 /* NetBSD */ -#define IH_OS_FREEBSD 3 /* FreeBSD */ -#define IH_OS_4_4BSD 4 /* 4.4BSD */ -#define IH_OS_LINUX 5 /* Linux */ -#define IH_OS_SVR4 6 /* SVR4 */ -#define IH_OS_ESIX 7 /* Esix */ -#define IH_OS_SOLARIS 8 /* Solaris */ -#define IH_OS_IRIX 9 /* Irix */ -#define IH_OS_SCO 10 /* SCO */ -#define IH_OS_DELL 11 /* Dell */ -#define IH_OS_NCR 12 /* NCR */ -#define IH_OS_LYNXOS 13 /* LynxOS */ -#define IH_OS_VXWORKS 14 /* VxWorks */ -#define IH_OS_PSOS 15 /* pSOS */ -#define IH_OS_QNX 16 /* QNX */ -#define IH_OS_U_BOOT 17 /* Firmware */ -#define IH_OS_RTEMS 18 /* RTEMS */ -#define IH_OS_ARTOS 19 /* ARTOS */ -#define IH_OS_UNITY 20 /* Unity OS */ - -/* - * CPU Architecture Codes (supported by Linux) - */ -#define IH_CPU_INVALID 0 /* Invalid CPU */ -#define IH_CPU_ALPHA 1 /* Alpha */ -#define IH_CPU_ARM 2 /* ARM */ -#define IH_CPU_I386 3 /* Intel x86 */ -#define IH_CPU_IA64 4 /* IA64 */ -#define IH_CPU_MIPS 5 /* MIPS */ -#define IH_CPU_MIPS64 6 /* MIPS 64 Bit */ -#define IH_CPU_PPC 7 /* PowerPC */ -#define IH_CPU_S390 8 /* IBM S390 */ -#define IH_CPU_SH 9 /* SuperH */ -#define IH_CPU_SPARC 10 /* Sparc */ -#define IH_CPU_SPARC64 11 /* Sparc 64 Bit */ -#define IH_CPU_M68K 12 /* M68K */ -#define IH_CPU_NIOS 13 /* Nios-32 */ -#define IH_CPU_MICROBLAZE 14 /* MicroBlaze */ -#define IH_CPU_NIOS2 15 /* Nios-II */ - -/* - * Image Types - * - * "Standalone Programs" are directly runnable in the environment - * provided by U-Boot; it is expected that (if they behave - * well) you can continue to work in U-Boot after return from - * the Standalone Program. - * "OS Kernel Images" are usually images of some Embedded OS which - * will take over control completely. Usually these programs - * will install their own set of exception handlers, device - * drivers, set up the MMU, etc. - this means, that you cannot - * expect to re-enter U-Boot except by resetting the CPU. - * "RAMDisk Images" are more or less just data blocks, and their - * parameters (address, size) are passed to an OS kernel that is - * being started. - * "Multi-File Images" contain several images, typically an OS - * (Linux) kernel image and one or more data images like - * RAMDisks. This construct is useful for instance when you want - * to boot over the network using BOOTP etc., where the boot - * server provides just a single image file, but you want to get - * for instance an OS kernel and a RAMDisk image. - * - * "Multi-File Images" start with a list of image sizes, each - * image size (in bytes) specified by an "uint32_t" in network - * byte order. This list is terminated by an "(uint32_t)0". - * Immediately after the terminating 0 follow the images, one by - * one, all aligned on "uint32_t" boundaries (size rounded up to - * a multiple of 4 bytes - except for the last file). - * - * "Firmware Images" are binary images containing firmware (like - * U-Boot or FPGA images) which usually will be programmed to - * flash memory. - * - * "Script files" are command sequences that will be executed by - * U-Boot's command interpreter; this feature is especially - * useful when you configure U-Boot to use a real shell (hush) - * as command interpreter (=> Shell Scripts). - */ - -#define IH_TYPE_INVALID 0 /* Invalid Image */ -#define IH_TYPE_STANDALONE 1 /* Standalone Program */ -#define IH_TYPE_KERNEL 2 /* OS Kernel Image */ -#define IH_TYPE_RAMDISK 3 /* RAMDisk Image */ -#define IH_TYPE_MULTI 4 /* Multi-File Image */ -#define IH_TYPE_FIRMWARE 5 /* Firmware Image */ -#define IH_TYPE_SCRIPT 6 /* Script file */ -#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */ - -/* - * Compression Types - */ -#define IH_COMP_NONE 0 /* No Compression Used */ -#define IH_COMP_GZIP 1 /* gzip Compression Used */ -#define IH_COMP_BZIP2 2 /* bzip2 Compression Used */ - -#define IH_MAGIC 0x27051956 /* Image Magic Number */ -#define IH_NMLEN 32 /* Image Name Length */ - -#define IH_NAMEMAGIC 0x86680001 /* Name Magic Number */ -#define IH_SIZEMAX 5800000 /* Max image size */ -/* - * all data in network byte order (aka natural aka bigendian) - */ - -typedef struct image_header { - uint32_t ih_magic; /* Image Header Magic Number */ - uint32_t ih_hcrc; /* Image Header CRC Checksum */ - uint32_t ih_time; /* Image Creation Timestamp */ - uint32_t ih_size; /* Image Data Size */ - uint32_t ih_load; /* Data Load Address */ - uint32_t ih_ep; /* Entry Point Address */ - uint32_t ih_dcrc; /* Image Data CRC Checksum */ - uint8_t ih_os; /* Operating System */ - uint8_t ih_arch; /* CPU architecture */ - uint8_t ih_type; /* Image Type */ - uint8_t ih_comp; /* Compression Type */ -#ifdef NEW_IMAGE_HEADER - uint32_t ih_namemagic; /* image name CRC */ - uint8_t ih_name[IH_NMLEN-4]; /* image name */ -#else - uint8_t ih_name[IH_NMLEN]; /* Image Name */ -#endif -} image_header_t; - - -#endif /* __IMAGE_H__ */ diff --git a/target/linux/adm8668/image/lzma-loader/src/lzma.lds.in b/target/linux/adm8668/image/lzma-loader/src/lzma.lds.in deleted file mode 100644 index d6c60ca0d..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/lzma.lds.in +++ /dev/null @@ -1,24 +0,0 @@ -OUTPUT_ARCH(mips) -ENTRY(entry) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = @LOADADDR@; - .text : - { - _ftext = . ; - *(.text.entry) - *(.text) - lzma_start = .; - kernel.o - lzma_end = .; - *(.rodata) - } =0 - - .reginfo : { *(.reginfo) } - - .bss : - { - *(.bss) - } -} diff --git a/target/linux/adm8668/image/lzma-loader/src/stubs.c b/target/linux/adm8668/image/lzma-loader/src/stubs.c deleted file mode 100644 index 468e5a1fd..000000000 --- a/target/linux/adm8668/image/lzma-loader/src/stubs.c +++ /dev/null @@ -1,52 +0,0 @@ -#include - -#ifndef GCC_VERSION -#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#endif /* GCC_VERSION */ - -/* - * k0 ($26) holds the pointer to the global_data; t9 ($25) is a call- - * clobbered register that is also used to set gp ($26). Note that the - * jr instruction also executes the instruction immediately following - * it; however, GCC/mips generates an additional `nop' after each asm - * statement - */ -#define EXPORT_FUNC(x) \ - asm volatile ( \ -" .globl " #x "\n" \ -#x ":\n" \ -" lw $25, %0($26)\n" \ -" lw $25, %1($25)\n" \ -" jr $25\n" \ - : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9"); - -/* This function is necessary to prevent the compiler from - * generating prologue/epilogue, preparing stack frame etc. - * The stub functions are special, they do not use the stack - * frame passed to them, but pass it intact to the actual - * implementation. On the other hand, asm() statements with - * arguments can be used only inside the functions (gcc limitation) - */ -#if GCC_VERSION < 3004 -static -#endif /* GCC_VERSION */ -void __attribute__((unused)) dummy(void) -{ -#include <_exports.h> -} - -#if 0 -extern unsigned long __bss_start, _end; - -void app_startup(char **argv) -{ - unsigned long * cp = &__bss_start; - - /* Zero out BSS */ - while (cp < &_end) { - *cp++ = 0; - } -} -#endif - -#undef EXPORT_FUNC diff --git a/target/linux/adm8668/image/my-mkimage b/target/linux/adm8668/image/my-mkimage deleted file mode 100755 index 7ed6666e7..000000000 --- a/target/linux/adm8668/image/my-mkimage +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# my-mkimage -# This will pad given files to 64k boundaries to make a single u-boot image. -# we have to be fancy because u-boot mkimage is going to add 64 byte header, ... -# and i only know basic arithmetic.. ;) -# -# Copyright (C) 2010 Scott Nicholas -[ $# -lt 2 ] && { - echo usage: $0 loader.bin [rootfs.squashfs [fs_mark [...]]] output.bin -} - -OLDSIZE=$(stat -c%s $1) -NEWSIZE=$(((OLDSIZE / 65536 + 1) * 65536 - 64)) - -dd if=$1 of=vmlinuz.tmp bs=$NEWSIZE conv=sync >/dev/null 2>&1 -shift -appends=$(($# - 1)) -echo -while [ $appends -gt 0 ]; do - dd if=$1 of=temp bs=64k conv=sync >/dev/null 2>&1 - printf "### '%s' starts at 0x%x\n" "`basename $1`" "$((NEWSIZE+64))" - cat temp >>vmlinuz.tmp - shift - appends=$((appends-1)) - NEWSIZE=$(stat -c%s vmlinuz.tmp) -done -echo -../../../../staging_dir/host/bin/mkimage -A mips -O linux -T kernel \ --C none -a 0x80400000 -e 0x80400000 -n "ADM8668 Linux Kernel(2.4.31)" \ --d vmlinuz.tmp $1 - -rm temp vmlinuz.tmp diff --git a/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch b/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch deleted file mode 100644 index 80e9ed1bb..000000000 --- a/target/linux/adm8668/patches-3.18/001-adm8668_arch.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/arch/mips/Kbuild.platforms -+++ b/arch/mips/Kbuild.platforms -@@ -30,6 +30,7 @@ platforms += sibyte - platforms += sni - platforms += txx9 - platforms += vr41xx -+platforms += adm8668 - - # include the platform specific files - include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms)) ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -136,6 +136,27 @@ config BCM47XX - help - Support for BCM47XX based boards - -+config ADM8668 -+ bool "WildPass ADM8668" -+ select SYS_HAS_CPU_MIPS32_R1 -+ select BOOT_RAW -+ select NO_EXCEPT_FILL -+ select IRQ_CPU -+ select CEVT_R4K -+ select CSRC_R4K -+ select HW_HAS_PCI -+ select PCI -+ select SYS_SUPPORTS_LITTLE_ENDIAN -+ select SYS_SUPPORTS_32BIT_KERNEL -+ select DMA_NONCOHERENT -+ select SWAP_IO_SPACE -+ select SYS_HAS_EARLY_PRINTK -+ select ARCH_REQUIRE_GPIOLIB -+ select HAVE_CLK -+ help -+ ADM8668 board support by neutronscott -+ Scott Nicholas -+ - config BCM63XX - bool "Broadcom BCM63XX based boards" - select BOOT_RAW -@@ -834,6 +855,7 @@ config MIPS_PARAVIRT - - endchoice - -+source "arch/mips/adm8668/Kconfig" - source "arch/mips/alchemy/Kconfig" - source "arch/mips/ath79/Kconfig" - source "arch/mips/bcm47xx/Kconfig" diff --git a/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch b/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch deleted file mode 100644 index 70ee00db5..000000000 --- a/target/linux/adm8668/patches-3.18/002-adm8668_pci.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/arch/mips/pci/Makefile -+++ b/arch/mips/pci/Makefile -@@ -58,6 +58,7 @@ obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32 - obj-$(CONFIG_CAVIUM_OCTEON_SOC) += pci-octeon.o pcie-octeon.o - obj-$(CONFIG_CPU_XLR) += pci-xlr.o - obj-$(CONFIG_CPU_XLP) += pci-xlp.o -+obj-$(CONFIG_ADM8668) += pci-adm8668.o - - ifdef CONFIG_PCI_MSI - obj-$(CONFIG_CAVIUM_OCTEON_SOC) += msi-octeon.o ---- a/include/linux/pci_ids.h -+++ b/include/linux/pci_ids.h -@@ -1820,6 +1820,9 @@ - - #define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */ - -+#define PCI_VENDOR_ADMTEK 0x1317 -+#define PCI_DEVICE_ID_ADM8668 0x8688 -+ - #define PCI_VENDOR_ID_SIIG 0x131f - #define PCI_SUBVENDOR_ID_SIIG 0x131f - #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 diff --git a/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch b/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch deleted file mode 100644 index f7883cdb2..000000000 --- a/target/linux/adm8668/patches-3.18/003-adm8668_nor_map.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/drivers/mtd/maps/Kconfig -+++ b/drivers/mtd/maps/Kconfig -@@ -97,6 +97,12 @@ config MSP_FLASH_MAP_LIMIT - default "0x02000000" - depends on MSP_FLASH_MAP_LIMIT_32M - -+config MTD_ADM8668_NOR -+ tristate "ADM8668 NOR mapping" -+ depends on ADM8668 && MTD_CFI -+ help -+ mapping driver for ADM8668 NOR -+ - config MTD_SUN_UFLASH - tristate "Sun Microsystems userflash support" - depends on SPARC && MTD_CFI && PCI ---- a/drivers/mtd/maps/Makefile -+++ b/drivers/mtd/maps/Makefile -@@ -43,3 +43,4 @@ obj-$(CONFIG_MTD_VMU) += vmu-flash.o - obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o - obj-$(CONFIG_MTD_LATCH_ADDR) += latch-addr-flash.o - obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o -+obj-$(CONFIG_MTD_ADM8668_NOR) += adm8668.o diff --git a/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch b/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch deleted file mode 100644 index e57bdb73c..000000000 --- a/target/linux/adm8668/patches-3.18/004-tulip_pci_split.patch +++ /dev/null @@ -1,452 +0,0 @@ ---- a/drivers/net/ethernet/dec/tulip/tulip_core.c -+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c -@@ -207,6 +207,7 @@ struct tulip_chip_table tulip_tbl[] = { - }; - - -+#ifdef CONFIG_TULIP_PCI - static const struct pci_device_id tulip_pci_tbl[] = { - { 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 }, - { 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 }, -@@ -250,7 +251,7 @@ static const struct pci_device_id tulip_ - { } /* terminate list */ - }; - MODULE_DEVICE_TABLE(pci, tulip_pci_tbl); -- -+#endif - - /* A full-duplex map for media types. */ - const char tulip_media_cap[32] = -@@ -268,11 +269,14 @@ static void tulip_down(struct net_device - static struct net_device_stats *tulip_get_stats(struct net_device *dev); - static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); - static void set_rx_mode(struct net_device *dev); -+#ifdef CONFIG_TULIP_PCI - static void tulip_set_wolopts(struct pci_dev *pdev, u32 wolopts); -+#endif - #ifdef CONFIG_NET_POLL_CONTROLLER - static void poll_tulip(struct net_device *dev); - #endif - -+#ifdef CONFIG_TULIP_PCI - static void tulip_set_power_state (struct tulip_private *tp, - int sleep, int snooze) - { -@@ -289,7 +293,7 @@ static void tulip_set_power_state (struc - } - - } -- -+#endif - - static void tulip_up(struct net_device *dev) - { -@@ -303,6 +307,7 @@ static void tulip_up(struct net_device * - napi_enable(&tp->napi); - #endif - -+#ifdef CONFIG_TULIP_PCI - /* Wake the chip from sleep/snooze mode. */ - tulip_set_power_state (tp, 0, 0); - -@@ -310,6 +315,7 @@ static void tulip_up(struct net_device * - pci_enable_wake(tp->pdev, PCI_D3hot, 0); - pci_enable_wake(tp->pdev, PCI_D3cold, 0); - tulip_set_wolopts(tp->pdev, 0); -+#endif - - /* On some chip revs we must set the MII/SYM port before the reset!? */ - if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii)) -@@ -317,18 +323,22 @@ static void tulip_up(struct net_device * - - /* Reset the chip, holding bit 0 set at least 50 PCI cycles. */ - iowrite32(0x00000001, ioaddr + CSR0); -+#ifdef CONFIG_TULIP_PCI - pci_read_config_dword(tp->pdev, PCI_COMMAND, ®); /* flush write */ -+#endif - udelay(100); - - /* Deassert reset. - Wait the specified 50 PCI cycles after a reset by initializing - Tx and Rx queues and the address filter list. */ - iowrite32(tp->csr0, ioaddr + CSR0); -+#ifdef CONFIG_TULIP_PCI - pci_read_config_dword(tp->pdev, PCI_COMMAND, ®); /* flush write */ -+#endif - udelay(100); - - if (tulip_debug > 1) -- netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->pdev->irq); -+ netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->irq); - - iowrite32(tp->rx_ring_dma, ioaddr + CSR3); - iowrite32(tp->tx_ring_dma, ioaddr + CSR4); -@@ -362,9 +372,11 @@ static void tulip_up(struct net_device * - *setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1]; - *setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2]; - -+#ifdef CONFIG_TULIP_PCI - mapping = pci_map_single(tp->pdev, tp->setup_frame, - sizeof(tp->setup_frame), - PCI_DMA_TODEVICE); -+#endif - tp->tx_buffers[tp->cur_tx].skb = NULL; - tp->tx_buffers[tp->cur_tx].mapping = mapping; - -@@ -520,7 +532,7 @@ tulip_open(struct net_device *dev) - - tulip_init_ring (dev); - -- retval = request_irq(tp->pdev->irq, tulip_interrupt, IRQF_SHARED, -+ retval = request_irq(tp->irq, tulip_interrupt, IRQF_SHARED, - dev->name, dev); - if (retval) - goto free_ring; -@@ -644,8 +656,10 @@ static void tulip_init_ring(struct net_d - tp->rx_buffers[i].skb = skb; - if (skb == NULL) - break; -+#ifdef CONFIG_TULIP_PCI - mapping = pci_map_single(tp->pdev, skb->data, - PKT_BUF_SZ, PCI_DMA_FROMDEVICE); -+#endif - tp->rx_buffers[i].mapping = mapping; - tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */ - tp->rx_ring[i].buffer1 = cpu_to_le32(mapping); -@@ -678,8 +692,10 @@ tulip_start_xmit(struct sk_buff *skb, st - entry = tp->cur_tx % TX_RING_SIZE; - - tp->tx_buffers[entry].skb = skb; -+#ifdef CONFIG_TULIP_PCI - mapping = pci_map_single(tp->pdev, skb->data, - skb->len, PCI_DMA_TODEVICE); -+#endif - tp->tx_buffers[entry].mapping = mapping; - tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping); - -@@ -730,16 +746,19 @@ static void tulip_clean_tx_ring(struct t - if (tp->tx_buffers[entry].skb == NULL) { - /* test because dummy frames not mapped */ - if (tp->tx_buffers[entry].mapping) -+#ifdef CONFIG_TULIP_PCI - pci_unmap_single(tp->pdev, - tp->tx_buffers[entry].mapping, - sizeof(tp->setup_frame), - PCI_DMA_TODEVICE); -+#endif - continue; - } -- -+#ifdef CONFIG_TULIP_PCI - pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping, - tp->tx_buffers[entry].skb->len, - PCI_DMA_TODEVICE); -+#endif - - /* Free the original skb. */ - dev_kfree_skb_irq(tp->tx_buffers[entry].skb); -@@ -790,7 +809,9 @@ static void tulip_down (struct net_devic - dev->if_port = tp->saved_if_port; - - /* Leave the driver in snooze, not sleep, mode. */ -+#ifdef CONFIG_TULIP_PCI - tulip_set_power_state (tp, 0, 1); -+#endif - } - - static void tulip_free_ring (struct net_device *dev) -@@ -811,8 +832,10 @@ static void tulip_free_ring (struct net_ - /* An invalid address. */ - tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0); - if (skb) { -+#ifdef CONFIG_TULIP_PCI - pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); -+#endif - dev_kfree_skb (skb); - } - } -@@ -821,8 +844,10 @@ static void tulip_free_ring (struct net_ - struct sk_buff *skb = tp->tx_buffers[i].skb; - - if (skb != NULL) { -+#ifdef CONFIG_TULIP_PCI - pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping, - skb->len, PCI_DMA_TODEVICE); -+#endif - dev_kfree_skb (skb); - } - tp->tx_buffers[i].skb = NULL; -@@ -843,7 +868,7 @@ static int tulip_close (struct net_devic - netdev_dbg(dev, "Shutting down ethercard, status was %02x\n", - ioread32 (ioaddr + CSR5)); - -- free_irq (tp->pdev->irq, dev); -+ free_irq (tp->irq, dev); - - tulip_free_ring (dev); - -@@ -874,7 +899,9 @@ static void tulip_get_drvinfo(struct net - struct tulip_private *np = netdev_priv(dev); - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); -+#ifdef CONFIG_TULIP_PCI - strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); -+#endif - } - - -@@ -887,7 +914,9 @@ static int tulip_ethtool_set_wol(struct - return -EOPNOTSUPP; - - tp->wolinfo.wolopts = wolinfo->wolopts; -- device_set_wakeup_enable(&tp->pdev->dev, tp->wolinfo.wolopts); -+#ifdef CONFIG_TULIP_PCI -+ device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts); -+#endif - return 0; - } - -@@ -1165,9 +1194,11 @@ static void set_rx_mode(struct net_devic - - tp->tx_buffers[entry].skb = NULL; - tp->tx_buffers[entry].mapping = -+#ifdef CONFIG_TULIP_PCI - pci_map_single(tp->pdev, tp->setup_frame, - sizeof(tp->setup_frame), - PCI_DMA_TODEVICE); -+#endif - /* Put the setup frame on the Tx list. */ - if (entry == TX_RING_SIZE-1) - tx_flags |= DESC_RING_WRAP; /* Wrap ring. */ -@@ -1264,19 +1295,22 @@ out: - netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n", - cache, csr0); - } --#endif - - /* - * Chips that have the MRM/reserved bit quirk and the burst quirk. That - * is the DM910X and the on chip ULi devices - */ -+#endif - -+#ifdef CONFIG_TULIP_PCI - static int tulip_uli_dm_quirk(struct pci_dev *pdev) - { - if (pdev->vendor == 0x1282 && pdev->device == 0x9102) - return 1; - return 0; - } -+#endif -+ - - static const struct net_device_ops tulip_netdev_ops = { - .ndo_open = tulip_open, -@@ -1294,6 +1328,7 @@ static const struct net_device_ops tulip - #endif - }; - -+#ifdef CONFIG_TULIP_PCI - const struct pci_device_id early_486_chipsets[] = { - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82424) }, - { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496) }, -@@ -1471,6 +1506,8 @@ static int tulip_init_one(struct pci_dev - } - } - tp->pdev = pdev; -+ tp->kdev = &pdev->dev; -+ tp->irq = irq; - tp->base_addr = ioaddr; - tp->revision = pdev->revision; - tp->csr0 = csr0; -@@ -1801,6 +1838,7 @@ err_out_free_netdev: - } - - -+#ifdef CONFIG_TULIP_PCI - /* set the registers according to the given wolopts */ - static void tulip_set_wolopts (struct pci_dev *pdev, u32 wolopts) - { -@@ -1829,6 +1867,7 @@ static void tulip_set_wolopts (struct pc - iowrite32(tmp, ioaddr + CSR13); - } - } -+#endif - - #ifdef CONFIG_PM - -@@ -1943,6 +1982,7 @@ static void tulip_remove_one(struct pci_ - - /* pci_power_off (pdev, -1); */ - } -+#endif /* CONFIG_TULIP_PCI */ - - #ifdef CONFIG_NET_POLL_CONTROLLER - /* -@@ -1964,7 +2004,8 @@ static void poll_tulip (struct net_devic - } - #endif - --static struct pci_driver tulip_driver = { -+#ifdef CONFIG_TULIP_PCI -+static struct pci_driver tulip_pci_driver = { - .name = DRV_NAME, - .id_table = tulip_pci_tbl, - .probe = tulip_init_one, -@@ -1974,10 +2015,12 @@ static struct pci_driver tulip_driver = - .resume = tulip_resume, - #endif /* CONFIG_PM */ - }; -+#endif - - - static int __init tulip_init (void) - { -+ int ret = 0; - #ifdef MODULE - pr_info("%s", version); - #endif -@@ -1987,13 +2030,18 @@ static int __init tulip_init (void) - tulip_max_interrupt_work = max_interrupt_work; - - /* probe for and init boards */ -- return pci_register_driver(&tulip_driver); -+#ifdef CONFIG_TULIP_PCI -+ ret = pci_register_driver(&tulip_pci_driver); -+#endif -+ return ret; - } - - - static void __exit tulip_cleanup (void) - { -- pci_unregister_driver (&tulip_driver); -+#ifdef CONFIG_TULIP_PCI -+ pci_unregister_driver (&tulip_pci_driver); -+#endif - } - - ---- a/drivers/net/ethernet/dec/tulip/interrupt.c -+++ b/drivers/net/ethernet/dec/tulip/interrupt.c -@@ -73,10 +73,11 @@ int tulip_refill_rx(struct net_device *d - netdev_alloc_skb(dev, PKT_BUF_SZ); - if (skb == NULL) - break; -- -+#ifdef CONFIG_TULIP_PCI - mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); -- if (dma_mapping_error(&tp->pdev->dev, mapping)) { -+#endif -+ if (dma_mapping_error(tp->kdev, mapping)) { - dev_kfree_skb(skb); - tp->rx_buffers[entry].skb = NULL; - break; -@@ -210,9 +211,11 @@ int tulip_poll(struct napi_struct *napi, - if (pkt_len < tulip_rx_copybreak && - (skb = netdev_alloc_skb(dev, pkt_len + 2)) != NULL) { - skb_reserve(skb, 2); /* 16 byte align the IP header */ -+#ifdef CONFIG_TULIP_PCI - pci_dma_sync_single_for_cpu(tp->pdev, - tp->rx_buffers[entry].mapping, - pkt_len, PCI_DMA_FROMDEVICE); -+#endif - #if ! defined(__alpha__) - skb_copy_to_linear_data(skb, tp->rx_buffers[entry].skb->data, - pkt_len); -@@ -222,9 +225,11 @@ int tulip_poll(struct napi_struct *napi, - tp->rx_buffers[entry].skb->data, - pkt_len); - #endif -+#ifdef CONFIG_TULIP_PCI - pci_dma_sync_single_for_device(tp->pdev, - tp->rx_buffers[entry].mapping, - pkt_len, PCI_DMA_FROMDEVICE); -+#endif - } else { /* Pass up the skb already on the Rx ring. */ - char *temp = skb_put(skb = tp->rx_buffers[entry].skb, - pkt_len); -@@ -239,9 +244,10 @@ int tulip_poll(struct napi_struct *napi, - skb->head, temp); - } - #endif -- -+#ifdef CONFIG_TULIP_PCI - pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping, - PKT_BUF_SZ, PCI_DMA_FROMDEVICE); -+#endif - - tp->rx_buffers[entry].skb = NULL; - tp->rx_buffers[entry].mapping = 0; -@@ -597,10 +603,12 @@ irqreturn_t tulip_interrupt(int irq, voi - if (tp->tx_buffers[entry].skb == NULL) { - /* test because dummy frames not mapped */ - if (tp->tx_buffers[entry].mapping) -+#ifdef CONFIG_TULIP_PCI - pci_unmap_single(tp->pdev, - tp->tx_buffers[entry].mapping, - sizeof(tp->setup_frame), - PCI_DMA_TODEVICE); -+#endif - continue; - } - -@@ -628,10 +636,11 @@ irqreturn_t tulip_interrupt(int irq, voi - dev->stats.collisions += (status >> 3) & 15; - dev->stats.tx_packets++; - } -- -+#ifdef CONFIG_TULIP_PCI - pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping, - tp->tx_buffers[entry].skb->len, - PCI_DMA_TODEVICE); -+#endif - - /* Free the original skb. */ - dev_kfree_skb_irq(tp->tx_buffers[entry].skb); ---- a/drivers/net/ethernet/dec/tulip/Kconfig -+++ b/drivers/net/ethernet/dec/tulip/Kconfig -@@ -40,8 +40,12 @@ config DE2104X_DSL - Default is 0, and range is 0 to 31. - - config TULIP -+ tristate -+ -+config TULIP_PCI - tristate "DECchip Tulip (dc2114x) PCI support" - depends on PCI -+ select TULIP - select CRC32 - ---help--- - This driver is developed for the SMC EtherPower series Ethernet -@@ -58,7 +62,7 @@ config TULIP - - config TULIP_MWI - bool "New bus configuration" -- depends on TULIP -+ depends on TULIP_PCI - ---help--- - This configures your Tulip card specifically for the card and - system cache line size type you are using. -@@ -69,7 +73,7 @@ config TULIP_MWI - - config TULIP_MMIO - bool "Use PCI shared mem for NIC registers" -- depends on TULIP -+ depends on TULIP_PCI - ---help--- - Use PCI shared memory for the NIC registers, rather than going through - the Tulip's PIO (programmed I/O ports). Faster, but could produce ---- a/drivers/net/ethernet/dec/tulip/tulip.h -+++ b/drivers/net/ethernet/dec/tulip/tulip.h -@@ -447,6 +447,8 @@ struct tulip_private { - int cur_index; /* Current media index. */ - int saved_if_port; - struct pci_dev *pdev; -+ struct device *kdev; -+ int irq; - int ttimer; - int susp_rx; - unsigned long nir; diff --git a/target/linux/adm8668/patches-3.18/005-tulip_platform.patch b/target/linux/adm8668/patches-3.18/005-tulip_platform.patch deleted file mode 100644 index bddc572c6..000000000 --- a/target/linux/adm8668/patches-3.18/005-tulip_platform.patch +++ /dev/null @@ -1,490 +0,0 @@ ---- a/drivers/net/ethernet/dec/tulip/Kconfig -+++ b/drivers/net/ethernet/dec/tulip/Kconfig -@@ -60,6 +60,14 @@ config TULIP_PCI - To compile this driver as a module, choose M here. The module will - be called tulip. - -+config TULIP_PLATFORM -+ tristate "DECchip Tulip (dc2114x) Platform support" -+ depends on HAS_IOMEM -+ select TULIP -+ select CRC32 -+ ---help--- -+ This driver is for the platform variant. -+ - config TULIP_MWI - bool "New bus configuration" - depends on TULIP_PCI ---- a/drivers/net/ethernet/dec/tulip/tulip_core.c -+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c -@@ -27,6 +27,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -204,6 +206,9 @@ struct tulip_chip_table tulip_tbl[] = { - { "Conexant LANfinity", 256, 0x0001ebef, - HAS_MII | HAS_ACPI, tulip_timer, tulip_media_task }, - -+ { "Infineon ADM8668", 256, 0x0001a451, -+ MC_HASH_ONLY | COMET_MAC_ADDR, tulip_timer, tulip_media_task, }, -+ - }; - - -@@ -377,6 +382,11 @@ static void tulip_up(struct net_device * - sizeof(tp->setup_frame), - PCI_DMA_TODEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ mapping = dma_map_single(&tp->pldev->dev, tp->setup_frame, -+ sizeof(tp->setup_frame), -+ DMA_TO_DEVICE); -+#endif - tp->tx_buffers[tp->cur_tx].skb = NULL; - tp->tx_buffers[tp->cur_tx].mapping = mapping; - -@@ -396,6 +406,7 @@ static void tulip_up(struct net_device * - i = 0; - if (tp->mtable == NULL) - goto media_picked; -+ - if (dev->if_port) { - int looking_for = tulip_media_cap[dev->if_port] & MediaIsMII ? 11 : - (dev->if_port == 12 ? 0 : dev->if_port); -@@ -489,6 +500,10 @@ media_picked: - iowrite32(ioread32(ioaddr + 0x88) | 1, ioaddr + 0x88); - dev->if_port = tp->mii_cnt ? 11 : 0; - tp->csr6 = 0x00040000; -+ } else if (tp->chip_id == ADM8668) { -+ /* Enable automatic Tx underrun recovery. */ -+ iowrite32(ioread32(ioaddr + 0x88) | 1, ioaddr + 0x88); -+ tp->csr6 = 0x00040000; - } else if (tp->chip_id == AX88140) { - tp->csr6 = tp->mii_cnt ? 0x00040100 : 0x00000100; - } else -@@ -660,6 +675,10 @@ static void tulip_init_ring(struct net_d - mapping = pci_map_single(tp->pdev, skb->data, - PKT_BUF_SZ, PCI_DMA_FROMDEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ mapping = dma_map_single(&tp->pldev->dev, skb->data, -+ PKT_BUF_SZ, DMA_FROM_DEVICE); -+#endif - tp->rx_buffers[i].mapping = mapping; - tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */ - tp->rx_ring[i].buffer1 = cpu_to_le32(mapping); -@@ -696,6 +715,11 @@ tulip_start_xmit(struct sk_buff *skb, st - mapping = pci_map_single(tp->pdev, skb->data, - skb->len, PCI_DMA_TODEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ mapping = dma_map_single(&tp->pldev->dev, skb->data, -+ skb->len, -+ DMA_TO_DEVICE); -+#endif - tp->tx_buffers[entry].mapping = mapping; - tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping); - -@@ -752,6 +776,13 @@ static void tulip_clean_tx_ring(struct t - sizeof(tp->setup_frame), - PCI_DMA_TODEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ dma_unmap_single(&tp->pldev->dev, -+ tp->tx_buffers[entry].mapping, -+ sizeof(tp->setup_frame), -+ DMA_TO_DEVICE); -+#endif -+ - continue; - } - #ifdef CONFIG_TULIP_PCI -@@ -759,6 +790,11 @@ static void tulip_clean_tx_ring(struct t - tp->tx_buffers[entry].skb->len, - PCI_DMA_TODEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[entry].mapping, -+ tp->tx_buffers[entry].skb->len, -+ DMA_TO_DEVICE); -+#endif - - /* Free the original skb. */ - dev_kfree_skb_irq(tp->tx_buffers[entry].skb); -@@ -836,6 +872,10 @@ static void tulip_free_ring (struct net_ - pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ dma_unmap_single(&tp->pldev->dev, mapping, PKT_BUF_SZ, -+ DMA_FROM_DEVICE); -+#endif - dev_kfree_skb (skb); - } - } -@@ -848,6 +888,10 @@ static void tulip_free_ring (struct net_ - pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping, - skb->len, PCI_DMA_TODEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[i].mapping, -+ skb->len, DMA_TO_DEVICE); -+#endif - dev_kfree_skb (skb); - } - tp->tx_buffers[i].skb = NULL; -@@ -902,6 +946,9 @@ static void tulip_get_drvinfo(struct net - #ifdef CONFIG_TULIP_PCI - strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info)); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ strlcpy(info->bus_info, "platform", sizeof(info->bus_info)); -+#endif - } - - -@@ -917,6 +964,9 @@ static int tulip_ethtool_set_wol(struct - #ifdef CONFIG_TULIP_PCI - device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ device_set_wakeup_enable(&tp->pldev->dev, tp->wolinfo.wolopts); -+#endif - return 0; - } - -@@ -1192,13 +1242,20 @@ static void set_rx_mode(struct net_devic - - } - -+#ifdef CONFIG_TULIP_PCI - tp->tx_buffers[entry].skb = NULL; - tp->tx_buffers[entry].mapping = --#ifdef CONFIG_TULIP_PCI - pci_map_single(tp->pdev, tp->setup_frame, - sizeof(tp->setup_frame), - PCI_DMA_TODEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ tp->tx_buffers[entry].skb = NULL; -+ tp->tx_buffers[entry].mapping = -+ dma_map_single(&tp->pldev->dev, tp->setup_frame, -+ sizeof(tp->setup_frame), -+ DMA_TO_DEVICE); -+#endif - /* Put the setup frame on the Tx list. */ - if (entry == TX_RING_SIZE-1) - tx_flags |= DESC_RING_WRAP; /* Wrap ring. */ -@@ -1218,6 +1275,9 @@ static void set_rx_mode(struct net_devic - spin_unlock_irqrestore(&tp->lock, flags); - } - -+ if (tp->chip_id == ADM8668) -+ csr6 |= (1 << 9); /* force 100Mbps full duplex */ -+ - iowrite32(csr6, ioaddr + CSR6); - } - -@@ -1984,6 +2044,126 @@ static void tulip_remove_one(struct pci_ - } - #endif /* CONFIG_TULIP_PCI */ - -+#ifdef CONFIG_TULIP_PLATFORM -+static int tulip_probe(struct platform_device *pdev) -+{ -+ struct tulip_private *tp; -+ struct tulip_platform_data *pdata; -+ struct net_device *dev; -+ struct resource *res; -+ void __iomem *ioaddr; -+ int irq; -+ -+ if (pdev->id < 0 || pdev->id >= MAX_UNITS) -+ return -EINVAL; -+ -+ if (!(res = platform_get_resource(pdev, IORESOURCE_IRQ, 0))) -+ return -ENODEV; -+ irq = res->start; -+ if (!(res = platform_get_resource(pdev, IORESOURCE_MEM, 0))) -+ return -ENODEV; -+ if (!(ioaddr = ioremap(res->start, res->end - res->start))) -+ return -ENODEV; -+ -+ pdata = pdev->dev.platform_data; -+ if (!pdata) -+ return -ENODEV; -+ -+ if (!(dev = alloc_etherdev(sizeof (*tp)))) -+ return -ENOMEM; -+ -+ /* setup net dev */ -+ dev->base_addr = (unsigned long)res->start; -+ dev->irq = irq; -+ SET_NETDEV_DEV(dev, &pdev->dev); -+ -+ /* tulip private struct */ -+ tp = netdev_priv(dev); -+ tp->dev = dev; -+ tp->base_addr = ioaddr; -+ tp->csr0 = 0; -+ tp->pldev = pdev; -+ tp->kdev = &pdev->dev; -+ tp->irq = irq; -+ tp->rx_ring = dma_alloc_coherent(&pdev->dev, -+ sizeof(struct tulip_rx_desc) * RX_RING_SIZE + -+ sizeof(struct tulip_tx_desc) * TX_RING_SIZE, -+ &tp->rx_ring_dma, GFP_KERNEL); -+ if (!tp->rx_ring) -+ return -ENODEV; -+ tp->tx_ring = (struct tulip_tx_desc *)(tp->rx_ring + RX_RING_SIZE); -+ tp->tx_ring_dma = tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * RX_RING_SIZE; -+ -+ tp->chip_id = pdata->chip_id; -+ tp->flags = tulip_tbl[tp->chip_id].flags; -+ -+ spin_lock_init(&tp->lock); -+ spin_lock_init(&tp->mii_lock); -+ -+ init_timer(&tp->timer); -+ tp->timer.data = (unsigned long)dev; -+ tp->timer.function = tulip_tbl[tp->chip_id].media_timer; -+ -+ INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task); -+ -+ /* Stop the chip's Tx and Rx processes. */ -+ tulip_stop_rxtx(tp); -+ -+ /* Clear the missed-packet counter. */ -+ ioread32(ioaddr + CSR8); -+ -+ if (!is_valid_ether_addr(pdata->mac)) { -+ dev_info(&pdev->dev, "generating random ethernet MAC\n"); -+ random_ether_addr(dev->dev_addr); -+ } else -+ memcpy(dev->dev_addr, pdata->mac, ETH_ALEN); -+ -+ /* The Tulip-specific entries in the device structure. */ -+ dev->netdev_ops = &tulip_netdev_ops; -+ dev->watchdog_timeo = TX_TIMEOUT; -+ netif_napi_add(dev, &tp->napi, tulip_poll, 16); -+ dev->ethtool_ops = &ops; -+ -+ if (register_netdev(dev)) -+ goto err_out_free_ring; -+ -+ dev_info(&dev->dev, -+ "tulip_platform (%s) at MMIO %#lx %pM, IRQ %d\n", -+ tulip_tbl[tp->chip_id].chip_name, -+ (unsigned long)dev->base_addr, dev->dev_addr, irq); -+ -+ platform_set_drvdata(pdev, dev); -+ return 0; -+ -+err_out_free_ring: -+ dma_free_coherent(&pdev->dev, -+ sizeof (struct tulip_rx_desc) * RX_RING_SIZE + -+ sizeof (struct tulip_tx_desc) * TX_RING_SIZE, -+ tp->rx_ring, tp->rx_ring_dma); -+ return -ENODEV; -+} -+ -+static int tulip_remove(struct platform_device *pdev) -+{ -+ struct net_device *dev = platform_get_drvdata (pdev); -+ struct tulip_private *tp; -+ -+ if (!dev) -+ return -ENODEV; -+ -+ tp = netdev_priv(dev); -+ unregister_netdev(dev); -+ dma_free_coherent(&pdev->dev, -+ sizeof (struct tulip_rx_desc) * RX_RING_SIZE + -+ sizeof (struct tulip_tx_desc) * TX_RING_SIZE, -+ tp->rx_ring, tp->rx_ring_dma); -+ iounmap(tp->base_addr); -+ free_netdev(dev); -+ platform_set_drvdata(pdev, NULL); -+ return 0; -+} -+#endif -+ - #ifdef CONFIG_NET_POLL_CONTROLLER - /* - * Polling 'interrupt' - used by things like netconsole to send skbs -@@ -2017,6 +2197,17 @@ static struct pci_driver tulip_pci_drive - }; - #endif - -+#ifdef CONFIG_TULIP_PLATFORM -+static struct platform_driver tulip_platform_driver = { -+ .probe = tulip_probe, -+ .remove = tulip_remove, -+ .driver = { -+ .owner = THIS_MODULE, -+ .name = DRV_NAME, -+ }, -+}; -+#endif -+ - - static int __init tulip_init (void) - { -@@ -2033,6 +2224,9 @@ static int __init tulip_init (void) - #ifdef CONFIG_TULIP_PCI - ret = pci_register_driver(&tulip_pci_driver); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ ret = platform_driver_register(&tulip_platform_driver); -+#endif - return ret; - } - -@@ -2042,6 +2236,9 @@ static void __exit tulip_cleanup (void) - #ifdef CONFIG_TULIP_PCI - pci_unregister_driver (&tulip_pci_driver); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ platform_driver_unregister (&tulip_platform_driver); -+#endif - } - - ---- a/drivers/net/ethernet/dec/tulip/tulip.h -+++ b/drivers/net/ethernet/dec/tulip/tulip.h -@@ -21,6 +21,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -69,28 +71,6 @@ enum tbl_flag { - }; - - --/* chip types. careful! order is VERY IMPORTANT here, as these -- * are used throughout the driver as indices into arrays */ --/* Note 21142 == 21143. */ --enum chips { -- DC21040 = 0, -- DC21041 = 1, -- DC21140 = 2, -- DC21142 = 3, DC21143 = 3, -- LC82C168, -- MX98713, -- MX98715, -- MX98725, -- AX88140, -- PNIC2, -- COMET, -- COMPEX9881, -- I21145, -- DM910X, -- CONEXANT, --}; -- -- - enum MediaIs { - MediaIsFD = 1, - MediaAlwaysFD = 2, -@@ -446,7 +426,12 @@ struct tulip_private { - struct mediatable *mtable; - int cur_index; /* Current media index. */ - int saved_if_port; -+#ifdef CONFIG_TULIP_PCI - struct pci_dev *pdev; -+#endif -+#ifdef CONFIG_TULIP_PLATFORM -+ struct platform_device *pldev; -+#endif - struct device *kdev; - int irq; - int ttimer; ---- a/drivers/net/ethernet/dec/tulip/interrupt.c -+++ b/drivers/net/ethernet/dec/tulip/interrupt.c -@@ -77,6 +77,10 @@ int tulip_refill_rx(struct net_device *d - mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, - PCI_DMA_FROMDEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ mapping = dma_map_single(&tp->pldev->dev, skb->data, PKT_BUF_SZ, -+ DMA_FROM_DEVICE); -+#endif - if (dma_mapping_error(tp->kdev, mapping)) { - dev_kfree_skb(skb); - tp->rx_buffers[entry].skb = NULL; -@@ -204,8 +208,7 @@ int tulip_poll(struct napi_struct *napi, - dev->stats.rx_fifo_errors++; - } - } else { -- struct sk_buff *skb; -- -+ struct sk_buff *skb; - /* Check if the packet is long enough to accept without copying - to a minimally-sized skbuff. */ - if (pkt_len < tulip_rx_copybreak && -@@ -248,6 +251,10 @@ int tulip_poll(struct napi_struct *napi, - pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping, - PKT_BUF_SZ, PCI_DMA_FROMDEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ dma_unmap_single(&tp->pldev->dev, tp->rx_buffers[entry].mapping, -+ PKT_BUF_SZ, DMA_FROM_DEVICE); -+#endif - - tp->rx_buffers[entry].skb = NULL; - tp->rx_buffers[entry].mapping = 0; -@@ -641,6 +648,11 @@ irqreturn_t tulip_interrupt(int irq, voi - tp->tx_buffers[entry].skb->len, - PCI_DMA_TODEVICE); - #endif -+#ifdef CONFIG_TULIP_PLATFORM -+ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[entry].mapping, -+ tp->tx_buffers[entry].skb->len, -+ DMA_TO_DEVICE); -+#endif - - /* Free the original skb. */ - dev_kfree_skb_irq(tp->tx_buffers[entry].skb); ---- /dev/null -+++ b/include/linux/platform_data/tulip.h -@@ -0,0 +1,31 @@ -+#ifndef _LINUX_TULIP_PDATA_H -+#define _LINUX_TULIP_PDATA_H -+ -+/* chip types. careful! order is VERY IMPORTANT here, as these -+ * are used throughout the driver as indices into arrays */ -+/* Note 21142 == 21143. */ -+enum chips { -+ DC21040 = 0, -+ DC21041 = 1, -+ DC21140 = 2, -+ DC21142 = 3, DC21143 = 3, -+ LC82C168, -+ MX98713, -+ MX98715, -+ MX98725, -+ AX88140, -+ PNIC2, -+ COMET, -+ COMPEX9881, -+ I21145, -+ DM910X, -+ CONEXANT, -+ ADM8668, -+}; -+ -+struct tulip_platform_data { -+ u8 mac[6]; -+ enum chips chip_id; -+}; -+ -+#endif diff --git a/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch b/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch deleted file mode 100644 index 66f4f2590..000000000 --- a/target/linux/adm8668/patches-3.18/200-amba_pl010_hacks.patch +++ /dev/null @@ -1,377 +0,0 @@ ---- a/drivers/tty/serial/amba-pl010.c -+++ b/drivers/tty/serial/amba-pl010.c -@@ -48,11 +48,10 @@ - #include - #include - --#define UART_NR 8 -- - #define SERIAL_AMBA_MAJOR 204 - #define SERIAL_AMBA_MINOR 16 --#define SERIAL_AMBA_NR UART_NR -+#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS -+#define SERIAL_AMBA_NAME CONFIG_SERIAL_AMBA_PL010_PORTNAME - - #define AMBA_ISR_PASS_LIMIT 256 - -@@ -78,9 +77,9 @@ static void pl010_stop_tx(struct uart_po - struct uart_amba_port *uap = (struct uart_amba_port *)port; - unsigned int cr; - -- cr = readb(uap->port.membase + UART010_CR); -+ cr = __raw_readl(uap->port.membase + UART010_CR); - cr &= ~UART010_CR_TIE; -- writel(cr, uap->port.membase + UART010_CR); -+ __raw_writel(cr, uap->port.membase + UART010_CR); - } - - static void pl010_start_tx(struct uart_port *port) -@@ -88,9 +87,9 @@ static void pl010_start_tx(struct uart_p - struct uart_amba_port *uap = (struct uart_amba_port *)port; - unsigned int cr; - -- cr = readb(uap->port.membase + UART010_CR); -+ cr = __raw_readl(uap->port.membase + UART010_CR); - cr |= UART010_CR_TIE; -- writel(cr, uap->port.membase + UART010_CR); -+ __raw_writel(cr, uap->port.membase + UART010_CR); - } - - static void pl010_stop_rx(struct uart_port *port) -@@ -98,9 +97,9 @@ static void pl010_stop_rx(struct uart_po - struct uart_amba_port *uap = (struct uart_amba_port *)port; - unsigned int cr; - -- cr = readb(uap->port.membase + UART010_CR); -+ cr = __raw_readl(uap->port.membase + UART010_CR); - cr &= ~(UART010_CR_RIE | UART010_CR_RTIE); -- writel(cr, uap->port.membase + UART010_CR); -+ __raw_writel(cr, uap->port.membase + UART010_CR); - } - - static void pl010_enable_ms(struct uart_port *port) -@@ -108,18 +107,18 @@ static void pl010_enable_ms(struct uart_ - struct uart_amba_port *uap = (struct uart_amba_port *)port; - unsigned int cr; - -- cr = readb(uap->port.membase + UART010_CR); -+ cr = __raw_readl(uap->port.membase + UART010_CR); - cr |= UART010_CR_MSIE; -- writel(cr, uap->port.membase + UART010_CR); -+ __raw_writel(cr, uap->port.membase + UART010_CR); - } - - static void pl010_rx_chars(struct uart_amba_port *uap) - { - unsigned int status, ch, flag, rsr, max_count = 256; - -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - while (UART_RX_DATA(status) && max_count--) { -- ch = readb(uap->port.membase + UART01x_DR); -+ ch = __raw_readl(uap->port.membase + UART01x_DR); - flag = TTY_NORMAL; - - uap->port.icount.rx++; -@@ -128,9 +127,9 @@ static void pl010_rx_chars(struct uart_a - * Note that the error handling code is - * out of the main execution path - */ -- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; -+ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; - if (unlikely(rsr & UART01x_RSR_ANY)) { -- writel(0, uap->port.membase + UART01x_ECR); -+ __raw_writel(0, uap->port.membase + UART01x_ECR); - - if (rsr & UART01x_RSR_BE) { - rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); -@@ -160,7 +159,7 @@ static void pl010_rx_chars(struct uart_a - uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); - - ignore_char: -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - } - spin_unlock(&uap->port.lock); - tty_flip_buffer_push(&uap->port.state->port); -@@ -173,7 +172,7 @@ static void pl010_tx_chars(struct uart_a - int count; - - if (uap->port.x_char) { -- writel(uap->port.x_char, uap->port.membase + UART01x_DR); -+ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR); - uap->port.icount.tx++; - uap->port.x_char = 0; - return; -@@ -185,7 +184,7 @@ static void pl010_tx_chars(struct uart_a - - count = uap->port.fifosize >> 1; - do { -- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); -+ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR); - xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); - uap->port.icount.tx++; - if (uart_circ_empty(xmit)) -@@ -203,9 +202,9 @@ static void pl010_modem_status(struct ua - { - unsigned int status, delta; - -- writel(0, uap->port.membase + UART010_ICR); -+ __raw_writel(0, uap->port.membase + UART010_ICR); - -- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; -+ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; - - delta = status ^ uap->old_status; - uap->old_status = status; -@@ -233,7 +232,7 @@ static irqreturn_t pl010_int(int irq, vo - - spin_lock(&uap->port.lock); - -- status = readb(uap->port.membase + UART010_IIR); -+ status = __raw_readl(uap->port.membase + UART010_IIR); - if (status) { - do { - if (status & (UART010_IIR_RTIS | UART010_IIR_RIS)) -@@ -246,7 +245,7 @@ static irqreturn_t pl010_int(int irq, vo - if (pass_counter-- == 0) - break; - -- status = readb(uap->port.membase + UART010_IIR); -+ status = __raw_readl(uap->port.membase + UART010_IIR); - } while (status & (UART010_IIR_RTIS | UART010_IIR_RIS | - UART010_IIR_TIS)); - handled = 1; -@@ -260,7 +259,7 @@ static irqreturn_t pl010_int(int irq, vo - static unsigned int pl010_tx_empty(struct uart_port *port) - { - struct uart_amba_port *uap = (struct uart_amba_port *)port; -- unsigned int status = readb(uap->port.membase + UART01x_FR); -+ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR); - return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT; - } - -@@ -270,7 +269,7 @@ static unsigned int pl010_get_mctrl(stru - unsigned int result = 0; - unsigned int status; - -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - if (status & UART01x_FR_DCD) - result |= TIOCM_CAR; - if (status & UART01x_FR_DSR) -@@ -296,12 +295,12 @@ static void pl010_break_ctl(struct uart_ - unsigned int lcr_h; - - spin_lock_irqsave(&uap->port.lock, flags); -- lcr_h = readb(uap->port.membase + UART010_LCRH); -+ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); - if (break_state == -1) - lcr_h |= UART01x_LCRH_BRK; - else - lcr_h &= ~UART01x_LCRH_BRK; -- writel(lcr_h, uap->port.membase + UART010_LCRH); -+ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); - spin_unlock_irqrestore(&uap->port.lock, flags); - } - -@@ -329,12 +328,12 @@ static int pl010_startup(struct uart_por - /* - * initialise the old status of the modem signals - */ -- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; -+ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY; - - /* - * Finally, enable interrupts - */ -- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, -+ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE, - uap->port.membase + UART010_CR); - - return 0; -@@ -357,10 +356,10 @@ static void pl010_shutdown(struct uart_p - /* - * disable all interrupts, disable the port - */ -- writel(0, uap->port.membase + UART010_CR); -+ __raw_writel(0, uap->port.membase + UART010_CR); - - /* disable break condition and fifos */ -- writel(readb(uap->port.membase + UART010_LCRH) & -+ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) & - ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN), - uap->port.membase + UART010_LCRH); - -@@ -382,7 +381,7 @@ pl010_set_termios(struct uart_port *port - /* - * Ask the core to calculate the divisor for us. - */ -- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); -+ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); - quot = uart_get_divisor(port, baud); - - switch (termios->c_cflag & CSIZE) { -@@ -445,25 +444,25 @@ pl010_set_termios(struct uart_port *port - uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX; - - /* first, disable everything */ -- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; -+ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE; - - if (UART_ENABLE_MS(port, termios->c_cflag)) - old_cr |= UART010_CR_MSIE; - -- writel(0, uap->port.membase + UART010_CR); -+ __raw_writel(0, uap->port.membase + UART010_CR); - - /* Set baud rate */ - quot -= 1; -- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); -- writel(quot & 0xff, uap->port.membase + UART010_LCRL); -+ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM); -+ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL); - - /* - * ----------v----------v----------v----------v----- - * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L - * ----------^----------^----------^----------^----- - */ -- writel(lcr_h, uap->port.membase + UART010_LCRH); -- writel(old_cr, uap->port.membase + UART010_CR); -+ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH); -+ __raw_writel(old_cr, uap->port.membase + UART010_CR); - - spin_unlock_irqrestore(&uap->port.lock, flags); - } -@@ -545,7 +544,7 @@ static struct uart_ops amba_pl010_pops = - .verify_port = pl010_verify_port, - }; - --static struct uart_amba_port *amba_ports[UART_NR]; -+static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR]; - - #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE - -@@ -555,10 +554,10 @@ static void pl010_console_putchar(struct - unsigned int status; - - do { -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - barrier(); - } while (!UART_TX_READY(status)); -- writel(ch, uap->port.membase + UART01x_DR); -+ __raw_writel(ch, uap->port.membase + UART01x_DR); - } - - static void -@@ -572,8 +571,8 @@ pl010_console_write(struct console *co, - /* - * First save the CR then disable the interrupts - */ -- old_cr = readb(uap->port.membase + UART010_CR); -- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); -+ old_cr = __raw_readl(uap->port.membase + UART010_CR); -+ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR); - - uart_console_write(&uap->port, s, count, pl010_console_putchar); - -@@ -582,10 +581,10 @@ pl010_console_write(struct console *co, - * and restore the TCR - */ - do { -- status = readb(uap->port.membase + UART01x_FR); -+ status = __raw_readl(uap->port.membase + UART01x_FR); - barrier(); - } while (status & UART01x_FR_BUSY); -- writel(old_cr, uap->port.membase + UART010_CR); -+ __raw_writel(old_cr, uap->port.membase + UART010_CR); - - clk_disable(uap->clk); - } -@@ -594,9 +593,9 @@ static void __init - pl010_console_get_options(struct uart_amba_port *uap, int *baud, - int *parity, int *bits) - { -- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { -+ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) { - unsigned int lcr_h, quot; -- lcr_h = readb(uap->port.membase + UART010_LCRH); -+ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH); - - *parity = 'n'; - if (lcr_h & UART01x_LCRH_PEN) { -@@ -611,8 +610,8 @@ pl010_console_get_options(struct uart_am - else - *bits = 8; - -- quot = readb(uap->port.membase + UART010_LCRL) | -- readb(uap->port.membase + UART010_LCRM) << 8; -+ quot = __raw_readl(uap->port.membase + UART010_LCRL) | -+ __raw_readl(uap->port.membase + UART010_LCRM) << 8; - *baud = uap->port.uartclk / (16 * (quot + 1)); - } - } -@@ -631,7 +630,7 @@ static int __init pl010_console_setup(st - * if so, search for the first available port that does have - * console support. - */ -- if (co->index >= UART_NR) -+ if (co->index >= SERIAL_AMBA_NR) - co->index = 0; - uap = amba_ports[co->index]; - if (!uap) -@@ -653,7 +652,7 @@ static int __init pl010_console_setup(st - - static struct uart_driver amba_reg; - static struct console amba_console = { -- .name = "ttyAM", -+ .name = SERIAL_AMBA_NAME, - .write = pl010_console_write, - .device = uart_console_device, - .setup = pl010_console_setup, -@@ -669,11 +668,11 @@ static struct console amba_console = { - - static struct uart_driver amba_reg = { - .owner = THIS_MODULE, -- .driver_name = "ttyAM", -- .dev_name = "ttyAM", -+ .driver_name = SERIAL_AMBA_NAME, -+ .dev_name = SERIAL_AMBA_NAME, - .major = SERIAL_AMBA_MAJOR, - .minor = SERIAL_AMBA_MINOR, -- .nr = UART_NR, -+ .nr = SERIAL_AMBA_NR, - .cons = AMBA_CONSOLE, - }; - ---- a/drivers/tty/serial/Kconfig -+++ b/drivers/tty/serial/Kconfig -@@ -25,10 +25,25 @@ config SERIAL_AMBA_PL010 - help - This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have - an Integrator/AP or Integrator/PP2 platform, or if you have a -- Cirrus Logic EP93xx CPU, say Y or M here. -+ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here. - - If unsure, say N. - -+config SERIAL_AMBA_PL010_NUMPORTS -+ int "Maximum number of AMBA PL010 serial ports" -+ depends on SERIAL_AMBA_PL010 -+ default "8" -+ ---help--- -+ Set this to the number of serial ports you want the AMBA PL010 driver -+ to support. -+ -+config SERIAL_AMBA_PL010_PORTNAME -+ string "Name of the AMBA PL010 serial ports" -+ depends on SERIAL_AMBA_PL010 -+ default "ttyAM" -+ ---help--- -+ ::: To be written ::: -+ - config SERIAL_AMBA_PL010_CONSOLE - bool "Support for console on AMBA serial port" - depends on SERIAL_AMBA_PL010=y diff --git a/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch b/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch deleted file mode 100644 index c79721aa9..000000000 --- a/target/linux/adm8668/patches-3.18/201-amba_bus_hacks.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/amba/bus.c -+++ b/drivers/amba/bus.c -@@ -21,6 +21,10 @@ - - #include - -+#ifndef NO_IRQ -+#define NO_IRQ (-1) -+#endif -+ - #define to_amba_driver(d) container_of(d, struct amba_driver, drv) - - static const struct amba_id * diff --git a/target/linux/adm8668/profiles/100-WRTU54G-TM.mk b/target/linux/adm8668/profiles/100-WRTU54G-TM.mk deleted file mode 100644 index 3ff030706..000000000 --- a/target/linux/adm8668/profiles/100-WRTU54G-TM.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (C) 2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/WRTU54G-TM - NAME:=Linksys WRTU54G T-Mobile (Default) - PACKAGES:=kmod-rt61-pci kmod-usb2 wpad-mini -endef - -define Profile/WRTU54G-TM/Description - Package set compatible with the Linksys WRTU54G T-Mobile -endef -$(eval $(call Profile,WRTU54G-TM)) - diff --git a/target/linux/apm821xx/config-4.14 b/target/linux/apm821xx/config-4.14 index feaba21eb..c756c8a4f 100644 --- a/target/linux/apm821xx/config-4.14 +++ b/target/linux/apm821xx/config-4.14 @@ -38,7 +38,6 @@ CONFIG_ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT=y CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y CONFIG_AUDIT_ARCH=y @@ -91,9 +90,6 @@ CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_WORKQUEUE=y CONFIG_DECOMPRESS_GZIP=y # CONFIG_DEFAULT_UIMAGE is not set -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y # CONFIG_E200 is not set CONFIG_EARLY_PRINTK=y @@ -102,14 +98,12 @@ CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y # CONFIG_EIGER is not set # CONFIG_EPAPR_BOOT is not set -CONFIG_EXPORTFS=y CONFIG_EXTRA_TARGETS="uImage" CONFIG_FIXED_PHY=y # CONFIG_FORCE_SMP is not set CONFIG_FREEZER=y # CONFIG_FSL_LBC is not set # CONFIG_FSL_ULI1575 is not set -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -353,7 +347,6 @@ CONFIG_SWPHY=y CONFIG_SYSCTL_EXCEPTION_TRACE=y # CONFIG_TAISHAN is not set CONFIG_TASK_SIZE=0xc0000000 -CONFIG_THIN_ARCHIVES=y CONFIG_THREAD_SHIFT=13 CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TINY_SRCU=y diff --git a/target/linux/apm821xx/dts/apm82181.dtsi b/target/linux/apm821xx/dts/apm82181.dtsi index cc48d200d..be8ace920 100644 --- a/target/linux/apm821xx/dts/apm82181.dtsi +++ b/target/linux/apm821xx/dts/apm82181.dtsi @@ -248,7 +248,7 @@ }; USBOTG0: usbotg@bff80000 { - compatible = "amcc,usb-otg-405ex"; + compatible = "amcc,dwc-otg"; reg = <4 0xbff80000 0x10000>; interrupt-parent = <&USBOTG0>; interrupts = <0 1 2>; diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 094c9e47d..1e94a4091 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -74,7 +74,7 @@ endef define Device/meraki_mr24 DEVICE_TITLE := Cisco Meraki MR24 - DEVICE_PACKAGES := kmod-spi-gpio + DEVICE_PACKAGES := kmod-spi-gpio -swconfig BOARD_NAME := mr24 DEVICE_DTS := meraki-mr24 BLOCKSIZE := 63k diff --git a/target/linux/apm821xx/patches-4.14/020-0001-crypto-crypto4xx-remove-bad-list_del.patch b/target/linux/apm821xx/patches-4.14/020-0001-crypto-crypto4xx-remove-bad-list_del.patch deleted file mode 100644 index 8df0937e4..000000000 --- a/target/linux/apm821xx/patches-4.14/020-0001-crypto-crypto4xx-remove-bad-list_del.patch +++ /dev/null @@ -1,32 +0,0 @@ -From a728a196d253530f17da5c86dc7dfbe58c5f7094 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Fri, 25 Aug 2017 15:47:14 +0200 -Subject: [PATCH 01/25] crypto: crypto4xx - remove bad list_del - -alg entries are only added to the list, after the registration -was successful. If the registration failed, it was never added -to the list in the first place. - -Signed-off-by: Christian Lamparter -Signed-off-by: Herbert Xu ---- - drivers/crypto/amcc/crypto4xx_core.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - ---- a/drivers/crypto/amcc/crypto4xx_core.c -+++ b/drivers/crypto/amcc/crypto4xx_core.c -@@ -1033,12 +1033,10 @@ int crypto4xx_register_alg(struct crypto - break; - } - -- if (rc) { -- list_del(&alg->entry); -+ if (rc) - kfree(alg); -- } else { -+ else - list_add_tail(&alg->entry, &sec_dev->alg_list); -- } - } - - return 0; diff --git a/target/linux/apm821xx/patches-4.14/020-0002-crypto-crypto4xx-remove-unused-definitions-and-write.patch b/target/linux/apm821xx/patches-4.14/020-0002-crypto-crypto4xx-remove-unused-definitions-and-write.patch index 598324634..466f0a0a7 100644 --- a/target/linux/apm821xx/patches-4.14/020-0002-crypto-crypto4xx-remove-unused-definitions-and-write.patch +++ b/target/linux/apm821xx/patches-4.14/020-0002-crypto-crypto4xx-remove-unused-definitions-and-write.patch @@ -67,7 +67,7 @@ Signed-off-by: Herbert Xu --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c -@@ -962,7 +962,7 @@ u32 crypto4xx_build_pd(struct crypto_asy +@@ -964,7 +964,7 @@ u32 crypto4xx_build_pd(struct crypto_asy sa->sa_command_1.bf.hash_crypto_offset = 0; pd->pd_ctl.w = ctx->pd_ctl; diff --git a/target/linux/apm821xx/patches-4.14/020-0003-crypto-crypto4xx-set-CRYPTO_ALG_KERN_DRIVER_ONLY-fla.patch b/target/linux/apm821xx/patches-4.14/020-0003-crypto-crypto4xx-set-CRYPTO_ALG_KERN_DRIVER_ONLY-fla.patch index e50a41828..c195b88c2 100644 --- a/target/linux/apm821xx/patches-4.14/020-0003-crypto-crypto4xx-set-CRYPTO_ALG_KERN_DRIVER_ONLY-fla.patch +++ b/target/linux/apm821xx/patches-4.14/020-0003-crypto-crypto4xx-set-CRYPTO_ALG_KERN_DRIVER_ONLY-fla.patch @@ -18,7 +18,7 @@ Signed-off-by: Herbert Xu --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c -@@ -1114,7 +1114,9 @@ struct crypto4xx_alg_common crypto4xx_al +@@ -1116,7 +1116,9 @@ struct crypto4xx_alg_common crypto4xx_al .cra_name = "cbc(aes)", .cra_driver_name = "cbc-aes-ppc4xx", .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, diff --git a/target/linux/apm821xx/patches-4.14/020-0005-crypto-crypto4xx-remove-double-assignment-of-pd_uinf.patch b/target/linux/apm821xx/patches-4.14/020-0005-crypto-crypto4xx-remove-double-assignment-of-pd_uinf.patch index 4fc361757..03c402d97 100644 --- a/target/linux/apm821xx/patches-4.14/020-0005-crypto-crypto4xx-remove-double-assignment-of-pd_uinf.patch +++ b/target/linux/apm821xx/patches-4.14/020-0005-crypto-crypto4xx-remove-double-assignment-of-pd_uinf.patch @@ -14,7 +14,7 @@ Signed-off-by: Herbert Xu --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c -@@ -1079,7 +1079,6 @@ static void crypto4xx_bh_tasklet_cb(unsi +@@ -1081,7 +1081,6 @@ static void crypto4xx_bh_tasklet_cb(unsi pd->pd_ctl.bf.pe_done = 0; crypto4xx_pd_done(core_dev->dev, tail); crypto4xx_put_pd_to_pdr(core_dev->dev, tail); diff --git a/target/linux/apm821xx/patches-4.14/020-0008-crypto-crypto4xx-enable-AES-RFC3686-ECB-CFB-and-OFB-.patch b/target/linux/apm821xx/patches-4.14/020-0008-crypto-crypto4xx-enable-AES-RFC3686-ECB-CFB-and-OFB-.patch index 9977c60d2..d19a41ec1 100644 --- a/target/linux/apm821xx/patches-4.14/020-0008-crypto-crypto4xx-enable-AES-RFC3686-ECB-CFB-and-OFB-.patch +++ b/target/linux/apm821xx/patches-4.14/020-0008-crypto-crypto4xx-enable-AES-RFC3686-ECB-CFB-and-OFB-.patch @@ -109,7 +109,7 @@ Signed-off-by: Herbert Xu #include #include "crypto4xx_reg_def.h" #include "crypto4xx_core.h" -@@ -1133,6 +1134,103 @@ struct crypto4xx_alg_common crypto4xx_al +@@ -1135,6 +1136,103 @@ struct crypto4xx_alg_common crypto4xx_al } } }}, diff --git a/target/linux/apm821xx/patches-4.14/020-0009-crypto-crypto4xx-refactor-crypto4xx_copy_pkt_to_dst.patch b/target/linux/apm821xx/patches-4.14/020-0009-crypto-crypto4xx-refactor-crypto4xx_copy_pkt_to_dst.patch index c6ccade8c..e74ed7f56 100644 --- a/target/linux/apm821xx/patches-4.14/020-0009-crypto-crypto4xx-refactor-crypto4xx_copy_pkt_to_dst.patch +++ b/target/linux/apm821xx/patches-4.14/020-0009-crypto-crypto4xx-refactor-crypto4xx_copy_pkt_to_dst.patch @@ -27,7 +27,7 @@ Signed-off-by: Herbert Xu #include "crypto4xx_reg_def.h" #include "crypto4xx_core.h" #include "crypto4xx_sa.h" -@@ -481,111 +482,44 @@ static inline struct ce_sd *crypto4xx_ge +@@ -483,111 +484,44 @@ static inline struct ce_sd *crypto4xx_ge return (struct ce_sd *)(dev->sdr + sizeof(struct ce_sd) * idx); } diff --git a/target/linux/apm821xx/patches-4.14/020-0010-crypto-crypto4xx-replace-crypto4xx_dev-s-scatter_buf.patch b/target/linux/apm821xx/patches-4.14/020-0010-crypto-crypto4xx-replace-crypto4xx_dev-s-scatter_buf.patch index 90a6dab2d..5ca3faa4d 100644 --- a/target/linux/apm821xx/patches-4.14/020-0010-crypto-crypto4xx-replace-crypto4xx_dev-s-scatter_buf.patch +++ b/target/linux/apm821xx/patches-4.14/020-0010-crypto-crypto4xx-replace-crypto4xx_dev-s-scatter_buf.patch @@ -17,7 +17,7 @@ Signed-off-by: Herbert Xu --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c -@@ -394,10 +394,9 @@ static u32 crypto4xx_build_sdr(struct cr +@@ -396,10 +396,9 @@ static u32 crypto4xx_build_sdr(struct cr if (!dev->sdr) return -ENOMEM; @@ -29,7 +29,7 @@ Signed-off-by: Herbert Xu &dev->scatter_buffer_pa, GFP_ATOMIC); if (!dev->scatter_buffer_va) { dma_free_coherent(dev->core_dev->device, -@@ -410,7 +409,7 @@ static u32 crypto4xx_build_sdr(struct cr +@@ -412,7 +411,7 @@ static u32 crypto4xx_build_sdr(struct cr for (i = 0; i < PPC4XX_NUM_SD; i++) { sd_array[i].ptr = dev->scatter_buffer_pa + @@ -38,9 +38,9 @@ Signed-off-by: Herbert Xu } return 0; -@@ -425,7 +424,7 @@ static void crypto4xx_destroy_sdr(struct +@@ -427,7 +426,7 @@ static void crypto4xx_destroy_sdr(struct - if (dev->scatter_buffer_va != NULL) + if (dev->scatter_buffer_va) dma_free_coherent(dev->core_dev->device, - dev->scatter_buffer_size * PPC4XX_NUM_SD, + PPC4XX_SD_BUFFER_SIZE * PPC4XX_NUM_SD, diff --git a/target/linux/apm821xx/patches-4.14/020-0011-crypto-crypto4xx-fix-crypto4xx_build_pdr-crypto4xx_b.patch b/target/linux/apm821xx/patches-4.14/020-0011-crypto-crypto4xx-fix-crypto4xx_build_pdr-crypto4xx_b.patch deleted file mode 100644 index 837fbdc54..000000000 --- a/target/linux/apm821xx/patches-4.14/020-0011-crypto-crypto4xx-fix-crypto4xx_build_pdr-crypto4xx_b.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 5d59ad6eea82ef8df92b4109615a0dde9d8093e9 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Fri, 25 Aug 2017 15:47:24 +0200 -Subject: [PATCH 11/25] crypto: crypto4xx - fix crypto4xx_build_pdr, - crypto4xx_build_sdr leak - -If one of the later memory allocations in rypto4xx_build_pdr() -fails: dev->pdr (and/or) dev->pdr_uinfo wouldn't be freed. - -crypto4xx_build_sdr() has the same issue with dev->sdr. - -Signed-off-by: Christian Lamparter -Signed-off-by: Herbert Xu ---- - drivers/crypto/amcc/crypto4xx_core.c | 17 +++++++++-------- - 1 file changed, 9 insertions(+), 8 deletions(-) - ---- a/drivers/crypto/amcc/crypto4xx_core.c -+++ b/drivers/crypto/amcc/crypto4xx_core.c -@@ -209,7 +209,7 @@ static u32 crypto4xx_build_pdr(struct cr - dev->pdr_pa); - return -ENOMEM; - } -- memset(dev->pdr, 0, sizeof(struct ce_pd) * PPC4XX_NUM_PD); -+ memset(dev->pdr, 0, sizeof(struct ce_pd) * PPC4XX_NUM_PD); - dev->shadow_sa_pool = dma_alloc_coherent(dev->core_dev->device, - 256 * PPC4XX_NUM_PD, - &dev->shadow_sa_pool_pa, -@@ -242,13 +242,15 @@ static u32 crypto4xx_build_pdr(struct cr - - static void crypto4xx_destroy_pdr(struct crypto4xx_device *dev) - { -- if (dev->pdr != NULL) -+ if (dev->pdr) - dma_free_coherent(dev->core_dev->device, - sizeof(struct ce_pd) * PPC4XX_NUM_PD, - dev->pdr, dev->pdr_pa); -+ - if (dev->shadow_sa_pool) - dma_free_coherent(dev->core_dev->device, 256 * PPC4XX_NUM_PD, - dev->shadow_sa_pool, dev->shadow_sa_pool_pa); -+ - if (dev->shadow_sr_pool) - dma_free_coherent(dev->core_dev->device, - sizeof(struct sa_state_record) * PPC4XX_NUM_PD, -@@ -417,12 +419,12 @@ static u32 crypto4xx_build_sdr(struct cr - - static void crypto4xx_destroy_sdr(struct crypto4xx_device *dev) - { -- if (dev->sdr != NULL) -+ if (dev->sdr) - dma_free_coherent(dev->core_dev->device, - sizeof(struct ce_sd) * PPC4XX_NUM_SD, - dev->sdr, dev->sdr_pa); - -- if (dev->scatter_buffer_va != NULL) -+ if (dev->scatter_buffer_va) - dma_free_coherent(dev->core_dev->device, - PPC4XX_SD_BUFFER_SIZE * PPC4XX_NUM_SD, - dev->scatter_buffer_va, -@@ -1223,7 +1225,7 @@ static int crypto4xx_probe(struct platfo - - rc = crypto4xx_build_gdr(core_dev->dev); - if (rc) -- goto err_build_gdr; -+ goto err_build_pdr; - - rc = crypto4xx_build_sdr(core_dev->dev); - if (rc) -@@ -1266,12 +1268,11 @@ err_iomap: - err_request_irq: - irq_dispose_mapping(core_dev->irq); - tasklet_kill(&core_dev->tasklet); -- crypto4xx_destroy_sdr(core_dev->dev); - err_build_sdr: -+ crypto4xx_destroy_sdr(core_dev->dev); - crypto4xx_destroy_gdr(core_dev->dev); --err_build_gdr: -- crypto4xx_destroy_pdr(core_dev->dev); - err_build_pdr: -+ crypto4xx_destroy_pdr(core_dev->dev); - kfree(core_dev->dev); - err_alloc_dev: - kfree(core_dev); diff --git a/target/linux/apm821xx/patches-4.14/120-0001-crypto-crypto4xx-shuffle-iomap-in-front-of-request_i.patch b/target/linux/apm821xx/patches-4.14/021-0001-crypto-crypto4xx-shuffle-iomap-in-front-of-request_i.patch similarity index 100% rename from target/linux/apm821xx/patches-4.14/120-0001-crypto-crypto4xx-shuffle-iomap-in-front-of-request_i.patch rename to target/linux/apm821xx/patches-4.14/021-0001-crypto-crypto4xx-shuffle-iomap-in-front-of-request_i.patch diff --git a/target/linux/apm821xx/patches-4.14/120-0002-crypto-crypto4xx-support-Revision-B-parts.patch b/target/linux/apm821xx/patches-4.14/021-0002-crypto-crypto4xx-support-Revision-B-parts.patch similarity index 100% rename from target/linux/apm821xx/patches-4.14/120-0002-crypto-crypto4xx-support-Revision-B-parts.patch rename to target/linux/apm821xx/patches-4.14/021-0002-crypto-crypto4xx-support-Revision-B-parts.patch diff --git a/target/linux/apm821xx/patches-4.14/120-0003-crypto-crypto4xx-fix-missing-irq-devname.patch b/target/linux/apm821xx/patches-4.14/021-0003-crypto-crypto4xx-fix-missing-irq-devname.patch similarity index 100% rename from target/linux/apm821xx/patches-4.14/120-0003-crypto-crypto4xx-fix-missing-irq-devname.patch rename to target/linux/apm821xx/patches-4.14/021-0003-crypto-crypto4xx-fix-missing-irq-devname.patch diff --git a/target/linux/apm821xx/patches-4.14/120-0004-crypto-crypto4xx-kill-MODULE_NAME.patch b/target/linux/apm821xx/patches-4.14/021-0004-crypto-crypto4xx-kill-MODULE_NAME.patch similarity index 100% rename from target/linux/apm821xx/patches-4.14/120-0004-crypto-crypto4xx-kill-MODULE_NAME.patch rename to target/linux/apm821xx/patches-4.14/021-0004-crypto-crypto4xx-kill-MODULE_NAME.patch diff --git a/target/linux/apm821xx/patches-4.14/120-0005-crypto-crypto4xx-perform-aead-icv-check-in-the-drive.patch b/target/linux/apm821xx/patches-4.14/021-0005-crypto-crypto4xx-perform-aead-icv-check-in-the-drive.patch similarity index 100% rename from target/linux/apm821xx/patches-4.14/120-0005-crypto-crypto4xx-perform-aead-icv-check-in-the-drive.patch rename to target/linux/apm821xx/patches-4.14/021-0005-crypto-crypto4xx-perform-aead-icv-check-in-the-drive.patch diff --git a/target/linux/apm821xx/patches-4.14/022-0001-crypto-Use-zeroing-memory-allocator-instead-of-alloc.patch b/target/linux/apm821xx/patches-4.14/022-0001-crypto-Use-zeroing-memory-allocator-instead-of-alloc.patch new file mode 100644 index 000000000..57823fad0 --- /dev/null +++ b/target/linux/apm821xx/patches-4.14/022-0001-crypto-Use-zeroing-memory-allocator-instead-of-alloc.patch @@ -0,0 +1,39 @@ +From 75d68369b544acc5d14c18a827654dfff248d09d Mon Sep 17 00:00:00 2001 +From: Himanshu Jha +Date: Sun, 31 Dec 2017 17:54:23 +0530 +Subject: [PATCH 1/8] crypto: Use zeroing memory allocator instead of + allocator/memset + +Use dma_zalloc_coherent for allocating zeroed +memory and remove unnecessary memset function. + +Done using Coccinelle. +Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci +0-day tested with no failures. + +Signed-off-by: Himanshu Jha +Signed-off-by: Herbert Xu +--- + drivers/crypto/amcc/crypto4xx_core.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +--- a/drivers/crypto/amcc/crypto4xx_core.c ++++ b/drivers/crypto/amcc/crypto4xx_core.c +@@ -282,14 +282,12 @@ static u32 crypto4xx_put_pd_to_pdr(struc + */ + static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev) + { +- dev->gdr = dma_alloc_coherent(dev->core_dev->device, +- sizeof(struct ce_gd) * PPC4XX_NUM_GD, +- &dev->gdr_pa, GFP_ATOMIC); ++ dev->gdr = dma_zalloc_coherent(dev->core_dev->device, ++ sizeof(struct ce_gd) * PPC4XX_NUM_GD, ++ &dev->gdr_pa, GFP_ATOMIC); + if (!dev->gdr) + return -ENOMEM; + +- memset(dev->gdr, 0, sizeof(struct ce_gd) * PPC4XX_NUM_GD); +- + return 0; + } + diff --git a/target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch b/target/linux/apm821xx/patches-4.14/022-0002-crypto-crypto4xx-performance-optimizations.patch similarity index 87% rename from target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch rename to target/linux/apm821xx/patches-4.14/022-0002-crypto-crypto4xx-performance-optimizations.patch index 0475fdaf8..f1035be52 100644 --- a/target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch +++ b/target/linux/apm821xx/patches-4.14/022-0002-crypto-crypto4xx-performance-optimizations.patch @@ -1,13 +1,14 @@ -From 30afcbb01a750a1ef0cee8a0861a347912c2e4fb Mon Sep 17 00:00:00 2001 +From a8d79d7bfb14f471914017103ee2329a74e5e89d Mon Sep 17 00:00:00 2001 From: Christian Lamparter -Date: Thu, 21 Dec 2017 16:00:01 +0100 -Subject: [PATCH 6/6] crypto: crypto4xx - performance optimizations +Date: Thu, 19 Apr 2018 18:41:51 +0200 +Subject: crypto: crypto4xx - performance optimizations This patch provides a cheap 2MiB/s+ (~ 6%) performance improvement over the current code. This is because the compiler can now optimize several endian swap memcpy. Signed-off-by: Christian Lamparter +Signed-off-by: Herbert Xu --- drivers/crypto/amcc/crypto4xx_alg.c | 32 +++++++++++++++++++------------- drivers/crypto/amcc/crypto4xx_core.c | 22 +++++++++++----------- @@ -70,7 +71,7 @@ Signed-off-by: Christian Lamparter /** --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c -@@ -582,7 +582,7 @@ static void crypto4xx_aead_done(struct c +@@ -580,7 +580,7 @@ static void crypto4xx_aead_done(struct c struct scatterlist *dst = pd_uinfo->dest_va; size_t cp_len = crypto_aead_authsize( crypto_aead_reqtfm(aead_req)); @@ -79,7 +80,7 @@ Signed-off-by: Christian Lamparter int err = 0; if (pd_uinfo->using_sd) { -@@ -597,7 +597,7 @@ static void crypto4xx_aead_done(struct c +@@ -595,7 +595,7 @@ static void crypto4xx_aead_done(struct c if (pd_uinfo->sa_va->sa_command_0.bf.dir == DIR_OUTBOUND) { /* append icv at the end */ crypto4xx_memcpy_from_le32(icv, pd_uinfo->sr_va->save_digest, @@ -88,7 +89,7 @@ Signed-off-by: Christian Lamparter scatterwalk_map_and_copy(icv, dst, aead_req->cryptlen, cp_len, 1); -@@ -607,7 +607,7 @@ static void crypto4xx_aead_done(struct c +@@ -605,7 +605,7 @@ static void crypto4xx_aead_done(struct c aead_req->assoclen + aead_req->cryptlen - cp_len, cp_len, 0); @@ -97,18 +98,18 @@ Signed-off-by: Christian Lamparter if (crypto_memneq(icv, pd_uinfo->sr_va->save_digest, cp_len)) err = -EBADMSG; -@@ -1124,8 +1124,8 @@ static struct crypto4xx_alg_common crypt +@@ -1122,8 +1122,8 @@ static struct crypto4xx_alg_common crypt .max_keysize = AES_MAX_KEY_SIZE, .ivsize = AES_IV_SIZE, .setkey = crypto4xx_setkey_aes_cbc, - .encrypt = crypto4xx_encrypt, - .decrypt = crypto4xx_decrypt, -+ .encrypt = crypto4xx_encrypt_iv, -+ .decrypt = crypto4xx_decrypt_iv, ++ .encrypt = crypto4xx_encrypt_iv, ++ .decrypt = crypto4xx_decrypt_iv, } } }}, -@@ -1148,8 +1148,8 @@ static struct crypto4xx_alg_common crypt +@@ -1146,8 +1146,8 @@ static struct crypto4xx_alg_common crypt .max_keysize = AES_MAX_KEY_SIZE, .ivsize = AES_IV_SIZE, .setkey = crypto4xx_setkey_aes_cfb, @@ -119,7 +120,7 @@ Signed-off-by: Christian Lamparter } } } }, -@@ -1197,8 +1197,8 @@ static struct crypto4xx_alg_common crypt +@@ -1195,8 +1195,8 @@ static struct crypto4xx_alg_common crypt .min_keysize = AES_MIN_KEY_SIZE, .max_keysize = AES_MAX_KEY_SIZE, .setkey = crypto4xx_setkey_aes_ecb, @@ -130,7 +131,7 @@ Signed-off-by: Christian Lamparter } } } }, -@@ -1221,8 +1221,8 @@ static struct crypto4xx_alg_common crypt +@@ -1219,8 +1219,8 @@ static struct crypto4xx_alg_common crypt .max_keysize = AES_MAX_KEY_SIZE, .ivsize = AES_IV_SIZE, .setkey = crypto4xx_setkey_aes_ofb, diff --git a/target/linux/apm821xx/patches-4.14/022-0003-crypto-crypto4xx-convert-to-skcipher.patch b/target/linux/apm821xx/patches-4.14/022-0003-crypto-crypto4xx-convert-to-skcipher.patch new file mode 100644 index 000000000..291c4ef46 --- /dev/null +++ b/target/linux/apm821xx/patches-4.14/022-0003-crypto-crypto4xx-convert-to-skcipher.patch @@ -0,0 +1,578 @@ +From ce05ffe10457bda487fa049016a6ba79934bdece Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 19 Apr 2018 18:41:52 +0200 +Subject: [PATCH 3/8] crypto: crypto4xx - convert to skcipher + +The ablkcipher APIs have been effectively deprecated since [1]. +This patch converts the crypto4xx driver to the new skcipher APIs. + +[1] + +Signed-off-by: Christian Lamparter +Signed-off-by: Herbert Xu +--- + drivers/crypto/amcc/crypto4xx_alg.c | 60 ++++--- + drivers/crypto/amcc/crypto4xx_core.c | 255 +++++++++++++-------------- + drivers/crypto/amcc/crypto4xx_core.h | 25 +-- + 3 files changed, 163 insertions(+), 177 deletions(-) + +--- a/drivers/crypto/amcc/crypto4xx_alg.c ++++ b/drivers/crypto/amcc/crypto4xx_alg.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include "crypto4xx_reg_def.h" + #include "crypto4xx_core.h" + #include "crypto4xx_sa.h" +@@ -74,36 +75,37 @@ static void set_dynamic_sa_command_1(str + sa->sa_command_1.bf.copy_hdr = cp_hdr; + } + +-static inline int crypto4xx_crypt(struct ablkcipher_request *req, ++static inline int crypto4xx_crypt(struct skcipher_request *req, + const unsigned int ivlen, bool decrypt) + { +- struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req); ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher); + __le32 iv[ivlen]; + + if (ivlen) +- crypto4xx_memcpy_to_le32(iv, req->info, ivlen); ++ crypto4xx_memcpy_to_le32(iv, req->iv, ivlen); + + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, +- req->nbytes, iv, ivlen, decrypt ? ctx->sa_in : ctx->sa_out, ++ req->cryptlen, iv, ivlen, decrypt ? ctx->sa_in : ctx->sa_out, + ctx->sa_len, 0); + } + +-int crypto4xx_encrypt_noiv(struct ablkcipher_request *req) ++int crypto4xx_encrypt_noiv(struct skcipher_request *req) + { + return crypto4xx_crypt(req, 0, false); + } + +-int crypto4xx_encrypt_iv(struct ablkcipher_request *req) ++int crypto4xx_encrypt_iv(struct skcipher_request *req) + { + return crypto4xx_crypt(req, AES_IV_SIZE, false); + } + +-int crypto4xx_decrypt_noiv(struct ablkcipher_request *req) ++int crypto4xx_decrypt_noiv(struct skcipher_request *req) + { + return crypto4xx_crypt(req, 0, true); + } + +-int crypto4xx_decrypt_iv(struct ablkcipher_request *req) ++int crypto4xx_decrypt_iv(struct skcipher_request *req) + { + return crypto4xx_crypt(req, AES_IV_SIZE, true); + } +@@ -111,20 +113,19 @@ int crypto4xx_decrypt_iv(struct ablkciph + /** + * AES Functions + */ +-static int crypto4xx_setkey_aes(struct crypto_ablkcipher *cipher, ++static int crypto4xx_setkey_aes(struct crypto_skcipher *cipher, + const u8 *key, + unsigned int keylen, + unsigned char cm, + u8 fb) + { +- struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher); +- struct crypto4xx_ctx *ctx = crypto_tfm_ctx(tfm); ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher); + struct dynamic_sa_ctl *sa; + int rc; + + if (keylen != AES_KEYSIZE_256 && + keylen != AES_KEYSIZE_192 && keylen != AES_KEYSIZE_128) { +- crypto_ablkcipher_set_flags(cipher, ++ crypto_skcipher_set_flags(cipher, + CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } +@@ -164,39 +165,38 @@ static int crypto4xx_setkey_aes(struct c + return 0; + } + +-int crypto4xx_setkey_aes_cbc(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_aes_cbc(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen) + { + return crypto4xx_setkey_aes(cipher, key, keylen, CRYPTO_MODE_CBC, + CRYPTO_FEEDBACK_MODE_NO_FB); + } + +-int crypto4xx_setkey_aes_cfb(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_aes_cfb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen) + { + return crypto4xx_setkey_aes(cipher, key, keylen, CRYPTO_MODE_CFB, + CRYPTO_FEEDBACK_MODE_128BIT_CFB); + } + +-int crypto4xx_setkey_aes_ecb(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_aes_ecb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen) + { + return crypto4xx_setkey_aes(cipher, key, keylen, CRYPTO_MODE_ECB, + CRYPTO_FEEDBACK_MODE_NO_FB); + } + +-int crypto4xx_setkey_aes_ofb(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_aes_ofb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen) + { + return crypto4xx_setkey_aes(cipher, key, keylen, CRYPTO_MODE_OFB, + CRYPTO_FEEDBACK_MODE_64BIT_OFB); + } + +-int crypto4xx_setkey_rfc3686(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_rfc3686(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen) + { +- struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher); +- struct crypto4xx_ctx *ctx = crypto_tfm_ctx(tfm); ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher); + int rc; + + rc = crypto4xx_setkey_aes(cipher, key, keylen - CTR_RFC3686_NONCE_SIZE, +@@ -210,31 +210,33 @@ int crypto4xx_setkey_rfc3686(struct cryp + return 0; + } + +-int crypto4xx_rfc3686_encrypt(struct ablkcipher_request *req) ++int crypto4xx_rfc3686_encrypt(struct skcipher_request *req) + { +- struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req); ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher); + __le32 iv[AES_IV_SIZE / 4] = { + ctx->iv_nonce, +- cpu_to_le32p((u32 *) req->info), +- cpu_to_le32p((u32 *) (req->info + 4)), ++ cpu_to_le32p((u32 *) req->iv), ++ cpu_to_le32p((u32 *) (req->iv + 4)), + cpu_to_le32(1) }; + + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, +- req->nbytes, iv, AES_IV_SIZE, ++ req->cryptlen, iv, AES_IV_SIZE, + ctx->sa_out, ctx->sa_len, 0); + } + +-int crypto4xx_rfc3686_decrypt(struct ablkcipher_request *req) ++int crypto4xx_rfc3686_decrypt(struct skcipher_request *req) + { +- struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req); ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher); + __le32 iv[AES_IV_SIZE / 4] = { + ctx->iv_nonce, +- cpu_to_le32p((u32 *) req->info), +- cpu_to_le32p((u32 *) (req->info + 4)), ++ cpu_to_le32p((u32 *) req->iv), ++ cpu_to_le32p((u32 *) (req->iv + 4)), + cpu_to_le32(1) }; + + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, +- req->nbytes, iv, AES_IV_SIZE, ++ req->cryptlen, iv, AES_IV_SIZE, + ctx->sa_out, ctx->sa_len, 0); + } + +--- a/drivers/crypto/amcc/crypto4xx_core.c ++++ b/drivers/crypto/amcc/crypto4xx_core.c +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + #include + #include + #include "crypto4xx_reg_def.h" +@@ -526,21 +527,19 @@ static void crypto4xx_ret_sg_desc(struct + } + } + +-static void crypto4xx_ablkcipher_done(struct crypto4xx_device *dev, ++static void crypto4xx_cipher_done(struct crypto4xx_device *dev, + struct pd_uinfo *pd_uinfo, + struct ce_pd *pd) + { +- struct crypto4xx_ctx *ctx; +- struct ablkcipher_request *ablk_req; ++ struct skcipher_request *req; + struct scatterlist *dst; + dma_addr_t addr; + +- ablk_req = ablkcipher_request_cast(pd_uinfo->async_req); +- ctx = crypto_tfm_ctx(ablk_req->base.tfm); ++ req = skcipher_request_cast(pd_uinfo->async_req); + + if (pd_uinfo->using_sd) { +- crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo, ablk_req->nbytes, +- ablk_req->dst); ++ crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo, ++ req->cryptlen, req->dst); + } else { + dst = pd_uinfo->dest_va; + addr = dma_map_page(dev->core_dev->device, sg_page(dst), +@@ -549,8 +548,8 @@ static void crypto4xx_ablkcipher_done(st + crypto4xx_ret_sg_desc(dev, pd_uinfo); + + if (pd_uinfo->state & PD_ENTRY_BUSY) +- ablkcipher_request_complete(ablk_req, -EINPROGRESS); +- ablkcipher_request_complete(ablk_req, 0); ++ skcipher_request_complete(req, -EINPROGRESS); ++ skcipher_request_complete(req, 0); + } + + static void crypto4xx_ahash_done(struct crypto4xx_device *dev, +@@ -641,8 +640,8 @@ static void crypto4xx_pd_done(struct cry + struct pd_uinfo *pd_uinfo = &dev->pdr_uinfo[idx]; + + switch (crypto_tfm_alg_type(pd_uinfo->async_req->tfm)) { +- case CRYPTO_ALG_TYPE_ABLKCIPHER: +- crypto4xx_ablkcipher_done(dev, pd_uinfo, pd); ++ case CRYPTO_ALG_TYPE_SKCIPHER: ++ crypto4xx_cipher_done(dev, pd_uinfo, pd); + break; + case CRYPTO_ALG_TYPE_AEAD: + crypto4xx_aead_done(dev, pd_uinfo, pd); +@@ -936,15 +935,14 @@ static void crypto4xx_ctx_init(struct cr + ctx->sa_len = 0; + } + +-static int crypto4xx_ablk_init(struct crypto_tfm *tfm) ++static int crypto4xx_sk_init(struct crypto_skcipher *sk) + { +- struct crypto_alg *alg = tfm->__crt_alg; ++ struct skcipher_alg *alg = crypto_skcipher_alg(sk); + struct crypto4xx_alg *amcc_alg; +- struct crypto4xx_ctx *ctx = crypto_tfm_ctx(tfm); ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(sk); + + amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.cipher); + crypto4xx_ctx_init(amcc_alg, ctx); +- tfm->crt_ablkcipher.reqsize = sizeof(struct crypto4xx_ctx); + return 0; + } + +@@ -953,9 +951,11 @@ static void crypto4xx_common_exit(struct + crypto4xx_free_sa(ctx); + } + +-static void crypto4xx_ablk_exit(struct crypto_tfm *tfm) ++static void crypto4xx_sk_exit(struct crypto_skcipher *sk) + { +- crypto4xx_common_exit(crypto_tfm_ctx(tfm)); ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(sk); ++ ++ crypto4xx_common_exit(ctx); + } + + static int crypto4xx_aead_init(struct crypto_aead *tfm) +@@ -1012,7 +1012,7 @@ static int crypto4xx_register_alg(struct + break; + + default: +- rc = crypto_register_alg(&alg->alg.u.cipher); ++ rc = crypto_register_skcipher(&alg->alg.u.cipher); + break; + } + +@@ -1041,7 +1041,7 @@ static void crypto4xx_unregister_alg(str + break; + + default: +- crypto_unregister_alg(&alg->alg.u.cipher); ++ crypto_unregister_skcipher(&alg->alg.u.cipher); + } + kfree(alg); + } +@@ -1103,126 +1103,109 @@ static irqreturn_t crypto4xx_ce_interrup + */ + static struct crypto4xx_alg_common crypto4xx_alg[] = { + /* Crypto AES modes */ +- { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = { +- .cra_name = "cbc(aes)", +- .cra_driver_name = "cbc-aes-ppc4xx", +- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, +- .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | +- CRYPTO_ALG_ASYNC | +- CRYPTO_ALG_KERN_DRIVER_ONLY, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct crypto4xx_ctx), +- .cra_type = &crypto_ablkcipher_type, +- .cra_init = crypto4xx_ablk_init, +- .cra_exit = crypto4xx_ablk_exit, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .ablkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE, +- .ivsize = AES_IV_SIZE, +- .setkey = crypto4xx_setkey_aes_cbc, +- .encrypt = crypto4xx_encrypt_iv, +- .decrypt = crypto4xx_decrypt_iv, +- } +- } +- }}, +- { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = { +- .cra_name = "cfb(aes)", +- .cra_driver_name = "cfb-aes-ppc4xx", +- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, +- .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | +- CRYPTO_ALG_ASYNC | +- CRYPTO_ALG_KERN_DRIVER_ONLY, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct crypto4xx_ctx), +- .cra_type = &crypto_ablkcipher_type, +- .cra_init = crypto4xx_ablk_init, +- .cra_exit = crypto4xx_ablk_exit, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .ablkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE, +- .ivsize = AES_IV_SIZE, +- .setkey = crypto4xx_setkey_aes_cfb, +- .encrypt = crypto4xx_encrypt_iv, +- .decrypt = crypto4xx_decrypt_iv, +- } +- } ++ { .type = CRYPTO_ALG_TYPE_SKCIPHER, .u.cipher = { ++ .base = { ++ .cra_name = "cbc(aes)", ++ .cra_driver_name = "cbc-aes-ppc4xx", ++ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, ++ .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | ++ CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct crypto4xx_ctx), ++ .cra_module = THIS_MODULE, ++ }, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_IV_SIZE, ++ .setkey = crypto4xx_setkey_aes_cbc, ++ .encrypt = crypto4xx_encrypt_iv, ++ .decrypt = crypto4xx_decrypt_iv, ++ .init = crypto4xx_sk_init, ++ .exit = crypto4xx_sk_exit, + } }, +- { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = { +- .cra_name = "rfc3686(ctr(aes))", +- .cra_driver_name = "rfc3686-ctr-aes-ppc4xx", +- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, +- .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | +- CRYPTO_ALG_ASYNC | +- CRYPTO_ALG_KERN_DRIVER_ONLY, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct crypto4xx_ctx), +- .cra_type = &crypto_ablkcipher_type, +- .cra_init = crypto4xx_ablk_init, +- .cra_exit = crypto4xx_ablk_exit, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .ablkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE + +- CTR_RFC3686_NONCE_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE + +- CTR_RFC3686_NONCE_SIZE, +- .ivsize = CTR_RFC3686_IV_SIZE, +- .setkey = crypto4xx_setkey_rfc3686, +- .encrypt = crypto4xx_rfc3686_encrypt, +- .decrypt = crypto4xx_rfc3686_decrypt, +- } +- } ++ { .type = CRYPTO_ALG_TYPE_SKCIPHER, .u.cipher = { ++ .base = { ++ .cra_name = "cfb(aes)", ++ .cra_driver_name = "cfb-aes-ppc4xx", ++ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, ++ .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | ++ CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct crypto4xx_ctx), ++ .cra_module = THIS_MODULE, ++ }, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_IV_SIZE, ++ .setkey = crypto4xx_setkey_aes_cfb, ++ .encrypt = crypto4xx_encrypt_iv, ++ .decrypt = crypto4xx_decrypt_iv, ++ .init = crypto4xx_sk_init, ++ .exit = crypto4xx_sk_exit, + } }, +- { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = { +- .cra_name = "ecb(aes)", +- .cra_driver_name = "ecb-aes-ppc4xx", +- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, +- .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | +- CRYPTO_ALG_ASYNC | +- CRYPTO_ALG_KERN_DRIVER_ONLY, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct crypto4xx_ctx), +- .cra_type = &crypto_ablkcipher_type, +- .cra_init = crypto4xx_ablk_init, +- .cra_exit = crypto4xx_ablk_exit, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .ablkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE, +- .setkey = crypto4xx_setkey_aes_ecb, +- .encrypt = crypto4xx_encrypt_noiv, +- .decrypt = crypto4xx_decrypt_noiv, +- } +- } ++ { .type = CRYPTO_ALG_TYPE_SKCIPHER, .u.cipher = { ++ .base = { ++ .cra_name = "rfc3686(ctr(aes))", ++ .cra_driver_name = "rfc3686-ctr-aes-ppc4xx", ++ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, ++ .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | ++ CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct crypto4xx_ctx), ++ .cra_module = THIS_MODULE, ++ }, ++ .min_keysize = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, ++ .ivsize = CTR_RFC3686_IV_SIZE, ++ .setkey = crypto4xx_setkey_rfc3686, ++ .encrypt = crypto4xx_rfc3686_encrypt, ++ .decrypt = crypto4xx_rfc3686_decrypt, ++ .init = crypto4xx_sk_init, ++ .exit = crypto4xx_sk_exit, + } }, +- { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = { +- .cra_name = "ofb(aes)", +- .cra_driver_name = "ofb-aes-ppc4xx", +- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, +- .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | +- CRYPTO_ALG_ASYNC | +- CRYPTO_ALG_KERN_DRIVER_ONLY, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct crypto4xx_ctx), +- .cra_type = &crypto_ablkcipher_type, +- .cra_init = crypto4xx_ablk_init, +- .cra_exit = crypto4xx_ablk_exit, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .ablkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE, +- .ivsize = AES_IV_SIZE, +- .setkey = crypto4xx_setkey_aes_ofb, +- .encrypt = crypto4xx_encrypt_iv, +- .decrypt = crypto4xx_decrypt_iv, +- } +- } ++ { .type = CRYPTO_ALG_TYPE_SKCIPHER, .u.cipher = { ++ .base = { ++ .cra_name = "ecb(aes)", ++ .cra_driver_name = "ecb-aes-ppc4xx", ++ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, ++ .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | ++ CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct crypto4xx_ctx), ++ .cra_module = THIS_MODULE, ++ }, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .setkey = crypto4xx_setkey_aes_ecb, ++ .encrypt = crypto4xx_encrypt_noiv, ++ .decrypt = crypto4xx_decrypt_noiv, ++ .init = crypto4xx_sk_init, ++ .exit = crypto4xx_sk_exit, ++ } }, ++ { .type = CRYPTO_ALG_TYPE_SKCIPHER, .u.cipher = { ++ .base = { ++ .cra_name = "ofb(aes)", ++ .cra_driver_name = "ofb-aes-ppc4xx", ++ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, ++ .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | ++ CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct crypto4xx_ctx), ++ .cra_module = THIS_MODULE, ++ }, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_IV_SIZE, ++ .setkey = crypto4xx_setkey_aes_ofb, ++ .encrypt = crypto4xx_encrypt_iv, ++ .decrypt = crypto4xx_decrypt_iv, ++ .init = crypto4xx_sk_init, ++ .exit = crypto4xx_sk_exit, + } }, + + /* AEAD */ +--- a/drivers/crypto/amcc/crypto4xx_core.h ++++ b/drivers/crypto/amcc/crypto4xx_core.h +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include "crypto4xx_reg_def.h" + #include "crypto4xx_sa.h" + +@@ -134,7 +135,7 @@ struct crypto4xx_ctx { + struct crypto4xx_alg_common { + u32 type; + union { +- struct crypto_alg cipher; ++ struct skcipher_alg cipher; + struct ahash_alg hash; + struct aead_alg aead; + } u; +@@ -158,22 +159,22 @@ int crypto4xx_build_pd(struct crypto_asy + const struct dynamic_sa_ctl *sa, + const unsigned int sa_len, + const unsigned int assoclen); +-int crypto4xx_setkey_aes_cbc(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_aes_cbc(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); +-int crypto4xx_setkey_aes_cfb(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_aes_cfb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); +-int crypto4xx_setkey_aes_ecb(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_aes_ecb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); +-int crypto4xx_setkey_aes_ofb(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_aes_ofb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); +-int crypto4xx_setkey_rfc3686(struct crypto_ablkcipher *cipher, ++int crypto4xx_setkey_rfc3686(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); +-int crypto4xx_encrypt_iv(struct ablkcipher_request *req); +-int crypto4xx_decrypt_iv(struct ablkcipher_request *req); +-int crypto4xx_encrypt_noiv(struct ablkcipher_request *req); +-int crypto4xx_decrypt_noiv(struct ablkcipher_request *req); +-int crypto4xx_rfc3686_encrypt(struct ablkcipher_request *req); +-int crypto4xx_rfc3686_decrypt(struct ablkcipher_request *req); ++int crypto4xx_encrypt_iv(struct skcipher_request *req); ++int crypto4xx_decrypt_iv(struct skcipher_request *req); ++int crypto4xx_encrypt_noiv(struct skcipher_request *req); ++int crypto4xx_decrypt_noiv(struct skcipher_request *req); ++int crypto4xx_rfc3686_encrypt(struct skcipher_request *req); ++int crypto4xx_rfc3686_decrypt(struct skcipher_request *req); + int crypto4xx_sha1_alg_init(struct crypto_tfm *tfm); + int crypto4xx_hash_digest(struct ahash_request *req); + int crypto4xx_hash_final(struct ahash_request *req); diff --git a/target/linux/apm821xx/patches-4.14/022-0004-crypto-crypto4xx-avoid-VLA-use.patch b/target/linux/apm821xx/patches-4.14/022-0004-crypto-crypto4xx-avoid-VLA-use.patch new file mode 100644 index 000000000..a3e1b8c7d --- /dev/null +++ b/target/linux/apm821xx/patches-4.14/022-0004-crypto-crypto4xx-avoid-VLA-use.patch @@ -0,0 +1,61 @@ +From c4e90650ff0cbf123ec9cfc32026fa0fb2931658 Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 19 Apr 2018 18:41:53 +0200 +Subject: [PATCH 4/8] crypto: crypto4xx - avoid VLA use + +This patch fixes some of the -Wvla warnings. + +crypto4xx_alg.c:83:19: warning: Variable length array is used. +crypto4xx_alg.c:273:56: warning: Variable length array is used. +crypto4xx_alg.c:380:32: warning: Variable length array is used. + +Signed-off-by: Christian Lamparter +Signed-off-by: Herbert Xu +--- + drivers/crypto/amcc/crypto4xx_alg.c | 14 ++++---------- + 1 file changed, 4 insertions(+), 10 deletions(-) + +--- a/drivers/crypto/amcc/crypto4xx_alg.c ++++ b/drivers/crypto/amcc/crypto4xx_alg.c +@@ -80,7 +80,7 @@ static inline int crypto4xx_crypt(struct + { + struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req); + struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher); +- __le32 iv[ivlen]; ++ __le32 iv[AES_IV_SIZE]; + + if (ivlen) + crypto4xx_memcpy_to_le32(iv, req->iv, ivlen); +@@ -270,13 +270,7 @@ static inline bool crypto4xx_aead_need_f + static int crypto4xx_aead_fallback(struct aead_request *req, + struct crypto4xx_ctx *ctx, bool do_decrypt) + { +- char aead_req_data[sizeof(struct aead_request) + +- crypto_aead_reqsize(ctx->sw_cipher.aead)] +- __aligned(__alignof__(struct aead_request)); +- +- struct aead_request *subreq = (void *) aead_req_data; +- +- memset(subreq, 0, sizeof(aead_req_data)); ++ struct aead_request *subreq = aead_request_ctx(req); + + aead_request_set_tfm(subreq, ctx->sw_cipher.aead); + aead_request_set_callback(subreq, req->base.flags, +@@ -377,7 +371,7 @@ static int crypto4xx_crypt_aes_ccm(struc + struct crypto_aead *aead = crypto_aead_reqtfm(req); + unsigned int len = req->cryptlen; + __le32 iv[16]; +- u32 tmp_sa[ctx->sa_len * 4]; ++ u32 tmp_sa[SA_AES128_CCM_LEN + 4]; + struct dynamic_sa_ctl *sa = (struct dynamic_sa_ctl *)tmp_sa; + + if (crypto4xx_aead_need_fallback(req, true, decrypt)) +@@ -386,7 +380,7 @@ static int crypto4xx_crypt_aes_ccm(struc + if (decrypt) + len -= crypto_aead_authsize(aead); + +- memcpy(tmp_sa, decrypt ? ctx->sa_in : ctx->sa_out, sizeof(tmp_sa)); ++ memcpy(tmp_sa, decrypt ? ctx->sa_in : ctx->sa_out, ctx->sa_len * 4); + sa->sa_command_0.bf.digest_len = crypto_aead_authsize(aead) >> 2; + + if (req->iv[0] == 1) { diff --git a/target/linux/apm821xx/patches-4.14/022-0005-crypto-crypto4xx-add-aes-ctr-support.patch b/target/linux/apm821xx/patches-4.14/022-0005-crypto-crypto4xx-add-aes-ctr-support.patch new file mode 100644 index 000000000..e93a3d916 --- /dev/null +++ b/target/linux/apm821xx/patches-4.14/022-0005-crypto-crypto4xx-add-aes-ctr-support.patch @@ -0,0 +1,247 @@ +From 98e87e3d933b8e504ea41b8857c038d2cd06cddc Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 19 Apr 2018 18:41:54 +0200 +Subject: [PATCH 5/8] crypto: crypto4xx - add aes-ctr support + +This patch adds support for the aes-ctr skcipher. + +name : ctr(aes) +driver : ctr-aes-ppc4xx +module : crypto4xx +priority : 300 +refcnt : 1 +selftest : passed +internal : no +type : skcipher +async : yes +blocksize : 16 +min keysize : 16 +max keysize : 32 +ivsize : 16 +chunksize : 16 +walksize : 16 + +The hardware uses only the last 32-bits as the counter while the +kernel tests (aes_ctr_enc_tv_template[4] for example) expect that +the whole IV is a counter. To make this work, the driver will +fallback if the counter is going to overlow. + +The aead's crypto4xx_setup_fallback() function is renamed to +crypto4xx_aead_setup_fallback. + +Signed-off-by: Christian Lamparter +Signed-off-by: Herbert Xu +--- + drivers/crypto/amcc/crypto4xx_alg.c | 91 ++++++++++++++++++++++++++-- + drivers/crypto/amcc/crypto4xx_core.c | 37 +++++++++++ + drivers/crypto/amcc/crypto4xx_core.h | 5 ++ + 3 files changed, 127 insertions(+), 6 deletions(-) + +--- a/drivers/crypto/amcc/crypto4xx_alg.c ++++ b/drivers/crypto/amcc/crypto4xx_alg.c +@@ -240,6 +240,85 @@ int crypto4xx_rfc3686_decrypt(struct skc + ctx->sa_out, ctx->sa_len, 0); + } + ++static int ++crypto4xx_ctr_crypt(struct skcipher_request *req, bool encrypt) ++{ ++ struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req); ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher); ++ size_t iv_len = crypto_skcipher_ivsize(cipher); ++ unsigned int counter = be32_to_cpup((__be32 *)(req->iv + iv_len - 4)); ++ unsigned int nblks = ALIGN(req->cryptlen, AES_BLOCK_SIZE) / ++ AES_BLOCK_SIZE; ++ ++ /* ++ * The hardware uses only the last 32-bits as the counter while the ++ * kernel tests (aes_ctr_enc_tv_template[4] for example) expect that ++ * the whole IV is a counter. So fallback if the counter is going to ++ * overlow. ++ */ ++ if (counter + nblks < counter) { ++ struct skcipher_request *subreq = skcipher_request_ctx(req); ++ int ret; ++ ++ skcipher_request_set_tfm(subreq, ctx->sw_cipher.cipher); ++ skcipher_request_set_callback(subreq, req->base.flags, ++ NULL, NULL); ++ skcipher_request_set_crypt(subreq, req->src, req->dst, ++ req->cryptlen, req->iv); ++ ret = encrypt ? crypto_skcipher_encrypt(subreq) ++ : crypto_skcipher_decrypt(subreq); ++ skcipher_request_zero(subreq); ++ return ret; ++ } ++ ++ return encrypt ? crypto4xx_encrypt_iv(req) ++ : crypto4xx_decrypt_iv(req); ++} ++ ++static int crypto4xx_sk_setup_fallback(struct crypto4xx_ctx *ctx, ++ struct crypto_skcipher *cipher, ++ const u8 *key, ++ unsigned int keylen) ++{ ++ int rc; ++ ++ crypto_skcipher_clear_flags(ctx->sw_cipher.cipher, ++ CRYPTO_TFM_REQ_MASK); ++ crypto_skcipher_set_flags(ctx->sw_cipher.cipher, ++ crypto_skcipher_get_flags(cipher) & CRYPTO_TFM_REQ_MASK); ++ rc = crypto_skcipher_setkey(ctx->sw_cipher.cipher, key, keylen); ++ crypto_skcipher_clear_flags(cipher, CRYPTO_TFM_RES_MASK); ++ crypto_skcipher_set_flags(cipher, ++ crypto_skcipher_get_flags(ctx->sw_cipher.cipher) & ++ CRYPTO_TFM_RES_MASK); ++ ++ return rc; ++} ++ ++int crypto4xx_setkey_aes_ctr(struct crypto_skcipher *cipher, ++ const u8 *key, unsigned int keylen) ++{ ++ struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher); ++ int rc; ++ ++ rc = crypto4xx_sk_setup_fallback(ctx, cipher, key, keylen); ++ if (rc) ++ return rc; ++ ++ return crypto4xx_setkey_aes(cipher, key, keylen, ++ CRYPTO_MODE_CTR, CRYPTO_FEEDBACK_MODE_NO_FB); ++} ++ ++int crypto4xx_encrypt_ctr(struct skcipher_request *req) ++{ ++ return crypto4xx_ctr_crypt(req, true); ++} ++ ++int crypto4xx_decrypt_ctr(struct skcipher_request *req) ++{ ++ return crypto4xx_ctr_crypt(req, false); ++} ++ + static inline bool crypto4xx_aead_need_fallback(struct aead_request *req, + bool is_ccm, bool decrypt) + { +@@ -282,10 +361,10 @@ static int crypto4xx_aead_fallback(struc + crypto_aead_encrypt(subreq); + } + +-static int crypto4xx_setup_fallback(struct crypto4xx_ctx *ctx, +- struct crypto_aead *cipher, +- const u8 *key, +- unsigned int keylen) ++static int crypto4xx_aead_setup_fallback(struct crypto4xx_ctx *ctx, ++ struct crypto_aead *cipher, ++ const u8 *key, ++ unsigned int keylen) + { + int rc; + +@@ -313,7 +392,7 @@ int crypto4xx_setkey_aes_ccm(struct cryp + struct dynamic_sa_ctl *sa; + int rc = 0; + +- rc = crypto4xx_setup_fallback(ctx, cipher, key, keylen); ++ rc = crypto4xx_aead_setup_fallback(ctx, cipher, key, keylen); + if (rc) + return rc; + +@@ -472,7 +551,7 @@ int crypto4xx_setkey_aes_gcm(struct cryp + return -EINVAL; + } + +- rc = crypto4xx_setup_fallback(ctx, cipher, key, keylen); ++ rc = crypto4xx_aead_setup_fallback(ctx, cipher, key, keylen); + if (rc) + return rc; + +--- a/drivers/crypto/amcc/crypto4xx_core.c ++++ b/drivers/crypto/amcc/crypto4xx_core.c +@@ -941,6 +941,19 @@ static int crypto4xx_sk_init(struct cryp + struct crypto4xx_alg *amcc_alg; + struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(sk); + ++ if (alg->base.cra_flags & CRYPTO_ALG_NEED_FALLBACK) { ++ ctx->sw_cipher.cipher = ++ crypto_alloc_skcipher(alg->base.cra_name, 0, ++ CRYPTO_ALG_NEED_FALLBACK | ++ CRYPTO_ALG_ASYNC); ++ if (IS_ERR(ctx->sw_cipher.cipher)) ++ return PTR_ERR(ctx->sw_cipher.cipher); ++ ++ crypto_skcipher_set_reqsize(sk, ++ sizeof(struct skcipher_request) + 32 + ++ crypto_skcipher_reqsize(ctx->sw_cipher.cipher)); ++ } ++ + amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.cipher); + crypto4xx_ctx_init(amcc_alg, ctx); + return 0; +@@ -956,6 +969,8 @@ static void crypto4xx_sk_exit(struct cry + struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(sk); + + crypto4xx_common_exit(ctx); ++ if (ctx->sw_cipher.cipher) ++ crypto_free_skcipher(ctx->sw_cipher.cipher); + } + + static int crypto4xx_aead_init(struct crypto_aead *tfm) +@@ -1145,6 +1160,28 @@ static struct crypto4xx_alg_common crypt + .init = crypto4xx_sk_init, + .exit = crypto4xx_sk_exit, + } }, ++ { .type = CRYPTO_ALG_TYPE_SKCIPHER, .u.cipher = { ++ .base = { ++ .cra_name = "ctr(aes)", ++ .cra_driver_name = "ctr-aes-ppc4xx", ++ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY, ++ .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | ++ CRYPTO_ALG_NEED_FALLBACK | ++ CRYPTO_ALG_ASYNC | ++ CRYPTO_ALG_KERN_DRIVER_ONLY, ++ .cra_blocksize = AES_BLOCK_SIZE, ++ .cra_ctxsize = sizeof(struct crypto4xx_ctx), ++ .cra_module = THIS_MODULE, ++ }, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_IV_SIZE, ++ .setkey = crypto4xx_setkey_aes_ctr, ++ .encrypt = crypto4xx_encrypt_ctr, ++ .decrypt = crypto4xx_decrypt_ctr, ++ .init = crypto4xx_sk_init, ++ .exit = crypto4xx_sk_exit, ++ } }, + { .type = CRYPTO_ALG_TYPE_SKCIPHER, .u.cipher = { + .base = { + .cra_name = "rfc3686(ctr(aes))", +--- a/drivers/crypto/amcc/crypto4xx_core.h ++++ b/drivers/crypto/amcc/crypto4xx_core.h +@@ -128,6 +128,7 @@ struct crypto4xx_ctx { + __le32 iv_nonce; + u32 sa_len; + union { ++ struct crypto_skcipher *cipher; + struct crypto_aead *aead; + } sw_cipher; + }; +@@ -163,12 +164,16 @@ int crypto4xx_setkey_aes_cbc(struct cryp + const u8 *key, unsigned int keylen); + int crypto4xx_setkey_aes_cfb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); ++int crypto4xx_setkey_aes_ctr(struct crypto_skcipher *cipher, ++ const u8 *key, unsigned int keylen); + int crypto4xx_setkey_aes_ecb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); + int crypto4xx_setkey_aes_ofb(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); + int crypto4xx_setkey_rfc3686(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); ++int crypto4xx_encrypt_ctr(struct skcipher_request *req); ++int crypto4xx_decrypt_ctr(struct skcipher_request *req); + int crypto4xx_encrypt_iv(struct skcipher_request *req); + int crypto4xx_decrypt_iv(struct skcipher_request *req); + int crypto4xx_encrypt_noiv(struct skcipher_request *req); diff --git a/target/linux/apm821xx/patches-4.14/022-0006-crypto-crypto4xx-properly-set-IV-after-de-and-encryp.patch b/target/linux/apm821xx/patches-4.14/022-0006-crypto-crypto4xx-properly-set-IV-after-de-and-encryp.patch new file mode 100644 index 000000000..1467f368b --- /dev/null +++ b/target/linux/apm821xx/patches-4.14/022-0006-crypto-crypto4xx-properly-set-IV-after-de-and-encryp.patch @@ -0,0 +1,71 @@ +From fc340115ffb8235c1bbd200c28855e6373d0dd1a Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 19 Apr 2018 18:41:55 +0200 +Subject: [PATCH 6/8] crypto: crypto4xx - properly set IV after de- and encrypt + +This patch fixes cts(cbc(aes)) test when cbc-aes-ppc4xx is used. +alg: skcipher: Test 1 failed (invalid result) on encryption for cts(cbc-aes-ppc4xx) +00000000: 4b 10 75 fc 2f 14 1b 6a 27 35 37 33 d1 b7 70 05 +00000010: 97 +alg: skcipher: Failed to load transform for cts(cbc(aes)): -2 + +The CTS cipher mode expect the IV (req->iv) of skcipher_request +to contain the last ciphertext block after the {en,de}crypt +operation is complete. + +Fix this issue for the AMCC Crypto4xx hardware engine. +The tcrypt test case for cts(cbc(aes)) is now correctly passed. + +name : cts(cbc(aes)) +driver : cts(cbc-aes-ppc4xx) +module : cts +priority : 300 +refcnt : 1 +selftest : passed +internal : no +type : skcipher +async : yes +blocksize : 16 +min keysize : 16 +max keysize : 32 +ivsize : 16 +chunksize : 16 +walksize : 16 + +Signed-off-by: Christian Lamparter +Signed-off-by: Herbert Xu +--- + drivers/crypto/amcc/crypto4xx_alg.c | 3 ++- + drivers/crypto/amcc/crypto4xx_core.c | 9 +++++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +--- a/drivers/crypto/amcc/crypto4xx_alg.c ++++ b/drivers/crypto/amcc/crypto4xx_alg.c +@@ -141,7 +141,8 @@ static int crypto4xx_setkey_aes(struct c + /* Setup SA */ + sa = ctx->sa_in; + +- set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, SA_NOT_SAVE_IV, ++ set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, (cm == CRYPTO_MODE_CBC ? ++ SA_SAVE_IV : SA_NOT_SAVE_IV), + SA_LOAD_HASH_FROM_SA, SA_LOAD_IV_FROM_STATE, + SA_NO_HEADER_PROC, SA_HASH_ALG_NULL, + SA_CIPHER_ALG_AES, SA_PAD_TYPE_ZERO, +--- a/drivers/crypto/amcc/crypto4xx_core.c ++++ b/drivers/crypto/amcc/crypto4xx_core.c +@@ -545,6 +545,15 @@ static void crypto4xx_cipher_done(struct + addr = dma_map_page(dev->core_dev->device, sg_page(dst), + dst->offset, dst->length, DMA_FROM_DEVICE); + } ++ ++ if (pd_uinfo->sa_va->sa_command_0.bf.save_iv == SA_SAVE_IV) { ++ struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req); ++ ++ crypto4xx_memcpy_from_le32((u32 *)req->iv, ++ pd_uinfo->sr_va->save_iv, ++ crypto_skcipher_ivsize(skcipher)); ++ } ++ + crypto4xx_ret_sg_desc(dev, pd_uinfo); + + if (pd_uinfo->state & PD_ENTRY_BUSY) diff --git a/target/linux/apm821xx/patches-4.14/022-0007-crypto-crypto4xx-extend-aead-fallback-checks.patch b/target/linux/apm821xx/patches-4.14/022-0007-crypto-crypto4xx-extend-aead-fallback-checks.patch new file mode 100644 index 000000000..37aefc241 --- /dev/null +++ b/target/linux/apm821xx/patches-4.14/022-0007-crypto-crypto4xx-extend-aead-fallback-checks.patch @@ -0,0 +1,102 @@ +From 584201f1895d915c1aa523bc86afdc126e94beca Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 19 Apr 2018 18:41:56 +0200 +Subject: [PATCH 7/8] crypto: crypto4xx - extend aead fallback checks + +1020 bytes is the limit for associated data. Any more +and it will no longer fit into hash_crypto_offset anymore. + +The hardware will not process aead requests with plaintext +that have less than AES_BLOCK_SIZE bytes. When decrypting +aead requests the authsize has to be taken in account as +well, as it is part of the cryptlen. Otherwise the hardware +will think it has been misconfigured and will return: + +aead return err status = 0x98 + +For rtc4543(gcm(aes)), the hardware has a dedicated GMAC +mode as part of the hash function set. + +Signed-off-by: Christian Lamparter +Signed-off-by: Herbert Xu +--- + drivers/crypto/amcc/crypto4xx_alg.c | 30 +++++++++++++++-------------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +--- a/drivers/crypto/amcc/crypto4xx_alg.c ++++ b/drivers/crypto/amcc/crypto4xx_alg.c +@@ -321,6 +321,7 @@ int crypto4xx_decrypt_ctr(struct skciphe + } + + static inline bool crypto4xx_aead_need_fallback(struct aead_request *req, ++ unsigned int len, + bool is_ccm, bool decrypt) + { + struct crypto_aead *aead = crypto_aead_reqtfm(req); +@@ -330,14 +331,14 @@ static inline bool crypto4xx_aead_need_f + return true; + + /* +- * hardware does not handle cases where cryptlen +- * is less than a block ++ * hardware does not handle cases where plaintext ++ * is less than a block. + */ +- if (req->cryptlen < AES_BLOCK_SIZE) ++ if (len < AES_BLOCK_SIZE) + return true; + +- /* assoc len needs to be a multiple of 4 */ +- if (req->assoclen & 0x3) ++ /* assoc len needs to be a multiple of 4 and <= 1020 */ ++ if (req->assoclen & 0x3 || req->assoclen > 1020) + return true; + + /* CCM supports only counter field length of 2 and 4 bytes */ +@@ -449,17 +450,17 @@ static int crypto4xx_crypt_aes_ccm(struc + { + struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm); + struct crypto_aead *aead = crypto_aead_reqtfm(req); +- unsigned int len = req->cryptlen; + __le32 iv[16]; + u32 tmp_sa[SA_AES128_CCM_LEN + 4]; + struct dynamic_sa_ctl *sa = (struct dynamic_sa_ctl *)tmp_sa; +- +- if (crypto4xx_aead_need_fallback(req, true, decrypt)) +- return crypto4xx_aead_fallback(req, ctx, decrypt); ++ unsigned int len = req->cryptlen; + + if (decrypt) + len -= crypto_aead_authsize(aead); + ++ if (crypto4xx_aead_need_fallback(req, len, true, decrypt)) ++ return crypto4xx_aead_fallback(req, ctx, decrypt); ++ + memcpy(tmp_sa, decrypt ? ctx->sa_in : ctx->sa_out, ctx->sa_len * 4); + sa->sa_command_0.bf.digest_len = crypto_aead_authsize(aead) >> 2; + +@@ -605,18 +606,19 @@ static inline int crypto4xx_crypt_aes_gc + bool decrypt) + { + struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm); +- unsigned int len = req->cryptlen; ++ struct crypto4xx_aead_reqctx *rctx = aead_request_ctx(req); + __le32 iv[4]; ++ unsigned int len = req->cryptlen; ++ ++ if (decrypt) ++ len -= crypto_aead_authsize(crypto_aead_reqtfm(req)); + +- if (crypto4xx_aead_need_fallback(req, false, decrypt)) ++ if (crypto4xx_aead_need_fallback(req, len, false, decrypt)) + return crypto4xx_aead_fallback(req, ctx, decrypt); + + crypto4xx_memcpy_to_le32(iv, req->iv, GCM_AES_IV_SIZE); + iv[3] = cpu_to_le32(1); + +- if (decrypt) +- len -= crypto_aead_authsize(crypto_aead_reqtfm(req)); +- + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, + len, iv, sizeof(iv), + decrypt ? ctx->sa_in : ctx->sa_out, diff --git a/target/linux/apm821xx/patches-4.14/022-0008-crypto-crypto4xx-put-temporary-dst-sg-into-request-c.patch b/target/linux/apm821xx/patches-4.14/022-0008-crypto-crypto4xx-put-temporary-dst-sg-into-request-c.patch new file mode 100644 index 000000000..b83cacc98 --- /dev/null +++ b/target/linux/apm821xx/patches-4.14/022-0008-crypto-crypto4xx-put-temporary-dst-sg-into-request-c.patch @@ -0,0 +1,157 @@ +From 658c9d2b9f374c835d0348d852a3f002196628d0 Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 19 Apr 2018 18:41:57 +0200 +Subject: [PATCH 8/8] crypto: crypto4xx - put temporary dst sg into request ctx + +This patch fixes a crash that happens when testing rfc4543(gcm(aes)) + +Unable to handle kernel paging request for data at address 0xf59b3420 +Faulting instruction address: 0xc0012994 +Oops: Kernel access of bad area, sig: 11 [#1] +BE PowerPC 44x Platform +Modules linked in: tcrypt(+) crypto4xx [...] +CPU: 0 PID: 0 Comm: swapper Tainted: G O 4.17.0-rc1+ #23 +NIP: c0012994 LR: d3077934 CTR: 06026d49 +REGS: cfff7e30 TRAP: 0300 Tainted: G O (4.17.0-rc1+) +MSR: 00029000 CR: 44744822 XER: 00000000 +DEAR: f59b3420 ESR: 00000000 +NIP [c0012994] __dma_sync+0x58/0x10c +LR [d3077934] crypto4xx_bh_tasklet_cb+0x188/0x3c8 [crypto4xx] + +__dma_sync was fed the temporary _dst that crypto4xx_build_pd() +had in it's function stack. This clearly never worked. +This patch therefore overhauls the code from the original driver +and puts the temporary dst sg list into aead's request context. + +Fixes: a0aae821ba3d3 ("crypto: crypto4xx - prepare for AEAD support") +Signed-off-by: Christian Lamparter +Signed-off-by: Herbert Xu +--- + drivers/crypto/amcc/crypto4xx_alg.c | 15 ++++++++------- + drivers/crypto/amcc/crypto4xx_core.c | 10 +++++----- + drivers/crypto/amcc/crypto4xx_core.h | 7 ++++++- + 3 files changed, 19 insertions(+), 13 deletions(-) + +--- a/drivers/crypto/amcc/crypto4xx_alg.c ++++ b/drivers/crypto/amcc/crypto4xx_alg.c +@@ -87,7 +87,7 @@ static inline int crypto4xx_crypt(struct + + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, + req->cryptlen, iv, ivlen, decrypt ? ctx->sa_in : ctx->sa_out, +- ctx->sa_len, 0); ++ ctx->sa_len, 0, NULL); + } + + int crypto4xx_encrypt_noiv(struct skcipher_request *req) +@@ -223,7 +223,7 @@ int crypto4xx_rfc3686_encrypt(struct skc + + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, + req->cryptlen, iv, AES_IV_SIZE, +- ctx->sa_out, ctx->sa_len, 0); ++ ctx->sa_out, ctx->sa_len, 0, NULL); + } + + int crypto4xx_rfc3686_decrypt(struct skcipher_request *req) +@@ -238,7 +238,7 @@ int crypto4xx_rfc3686_decrypt(struct skc + + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, + req->cryptlen, iv, AES_IV_SIZE, +- ctx->sa_out, ctx->sa_len, 0); ++ ctx->sa_out, ctx->sa_len, 0, NULL); + } + + static int +@@ -449,6 +449,7 @@ int crypto4xx_setkey_aes_ccm(struct cryp + static int crypto4xx_crypt_aes_ccm(struct aead_request *req, bool decrypt) + { + struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm); ++ struct crypto4xx_aead_reqctx *rctx = aead_request_ctx(req); + struct crypto_aead *aead = crypto_aead_reqtfm(req); + __le32 iv[16]; + u32 tmp_sa[SA_AES128_CCM_LEN + 4]; +@@ -474,7 +475,7 @@ static int crypto4xx_crypt_aes_ccm(struc + + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, + len, iv, sizeof(iv), +- sa, ctx->sa_len, req->assoclen); ++ sa, ctx->sa_len, req->assoclen, rctx->dst); + } + + int crypto4xx_encrypt_aes_ccm(struct aead_request *req) +@@ -622,7 +623,7 @@ static inline int crypto4xx_crypt_aes_gc + return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst, + len, iv, sizeof(iv), + decrypt ? ctx->sa_in : ctx->sa_out, +- ctx->sa_len, req->assoclen); ++ ctx->sa_len, req->assoclen, rctx->dst); + } + + int crypto4xx_encrypt_aes_gcm(struct aead_request *req) +@@ -707,7 +708,7 @@ int crypto4xx_hash_update(struct ahash_r + + return crypto4xx_build_pd(&req->base, ctx, req->src, &dst, + req->nbytes, NULL, 0, ctx->sa_in, +- ctx->sa_len, 0); ++ ctx->sa_len, 0, NULL); + } + + int crypto4xx_hash_final(struct ahash_request *req) +@@ -726,7 +727,7 @@ int crypto4xx_hash_digest(struct ahash_r + + return crypto4xx_build_pd(&req->base, ctx, req->src, &dst, + req->nbytes, NULL, 0, ctx->sa_in, +- ctx->sa_len, 0); ++ ctx->sa_len, 0, NULL); + } + + /** +--- a/drivers/crypto/amcc/crypto4xx_core.c ++++ b/drivers/crypto/amcc/crypto4xx_core.c +@@ -695,9 +695,9 @@ int crypto4xx_build_pd(struct crypto_asy + const __le32 *iv, const u32 iv_len, + const struct dynamic_sa_ctl *req_sa, + const unsigned int sa_len, +- const unsigned int assoclen) ++ const unsigned int assoclen, ++ struct scatterlist *_dst) + { +- struct scatterlist _dst[2]; + struct crypto4xx_device *dev = ctx->dev; + struct dynamic_sa_ctl *sa; + struct ce_gd *gd; +@@ -996,9 +996,9 @@ static int crypto4xx_aead_init(struct cr + + amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.aead); + crypto4xx_ctx_init(amcc_alg, ctx); +- crypto_aead_set_reqsize(tfm, sizeof(struct aead_request) + +- max(sizeof(struct crypto4xx_ctx), 32 + +- crypto_aead_reqsize(ctx->sw_cipher.aead))); ++ crypto_aead_set_reqsize(tfm, max(sizeof(struct aead_request) + 32 + ++ crypto_aead_reqsize(ctx->sw_cipher.aead), ++ sizeof(struct crypto4xx_aead_reqctx))); + return 0; + } + +--- a/drivers/crypto/amcc/crypto4xx_core.h ++++ b/drivers/crypto/amcc/crypto4xx_core.h +@@ -133,6 +133,10 @@ struct crypto4xx_ctx { + } sw_cipher; + }; + ++struct crypto4xx_aead_reqctx { ++ struct scatterlist dst[2]; ++}; ++ + struct crypto4xx_alg_common { + u32 type; + union { +@@ -159,7 +163,8 @@ int crypto4xx_build_pd(struct crypto_asy + const __le32 *iv, const u32 iv_len, + const struct dynamic_sa_ctl *sa, + const unsigned int sa_len, +- const unsigned int assoclen); ++ const unsigned int assoclen, ++ struct scatterlist *dst_tmp); + int crypto4xx_setkey_aes_cbc(struct crypto_skcipher *cipher, + const u8 *key, unsigned int keylen); + int crypto4xx_setkey_aes_cfb(struct crypto_skcipher *cipher, diff --git a/target/linux/apm821xx/patches-4.14/302-dw-dma-hprot-fix-and-equal-priortiy.patch b/target/linux/apm821xx/patches-4.14/302-dw-dma-hprot-fix-and-equal-priortiy.patch new file mode 100644 index 000000000..c6e4331aa --- /dev/null +++ b/target/linux/apm821xx/patches-4.14/302-dw-dma-hprot-fix-and-equal-priortiy.patch @@ -0,0 +1,25 @@ +--- a/drivers/dma/dw/core.c ++++ b/drivers/dma/dw/core.c +@@ -167,6 +167,8 @@ static void dwc_initialize_chan_dw(struc + cfghi |= DWC_CFGH_DST_PER(dwc->dws.dst_id); + cfghi |= DWC_CFGH_SRC_PER(dwc->dws.src_id); + ++ cfghi |= DWC_CFGH_PROTCTL(3); /* bufferable + privileged access */ ++ + /* Set polarity of handshake interface */ + cfglo |= hs_polarity ? DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL : 0; + +@@ -1293,11 +1295,8 @@ int dw_dma_probe(struct dw_dma_chip *chi + else + list_add(&dwc->chan.device_node, &dw->dma.channels); + +- /* 7 is highest priority & 0 is lowest. */ +- if (pdata->chan_priority == CHAN_PRIORITY_ASCENDING) +- dwc->priority = pdata->nr_channels - i - 1; +- else +- dwc->priority = i; ++ /* set all channels to the same priority */ ++ dwc->priority = pdata->nr_channels - 1; + + dwc->ch_regs = &__dw_regs(dw)->CHAN[i]; + spin_lock_init(&dwc->lock); diff --git a/target/linux/apm821xx/patches-4.14/802-usb-xhci-force-msi-renesas-xhci.patch b/target/linux/apm821xx/patches-4.14/802-usb-xhci-force-msi-renesas-xhci.patch index 3545b99aa..1e781b5da 100644 --- a/target/linux/apm821xx/patches-4.14/802-usb-xhci-force-msi-renesas-xhci.patch +++ b/target/linux/apm821xx/patches-4.14/802-usb-xhci-force-msi-renesas-xhci.patch @@ -44,7 +44,7 @@ produce a noisy warning. hcd->msi_enabled = 1; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1850,6 +1850,7 @@ struct xhci_hcd { +@@ -1854,6 +1854,7 @@ struct xhci_hcd { /* support xHCI 0.96 spec USB2 software LPM */ unsigned sw_lpm_support:1; /* support xHCI 1.0 spec USB2 hardware LPM */ diff --git a/target/linux/ar7/config-3.18 b/target/linux/ar7/config-3.18 deleted file mode 100644 index a91d45e8d..000000000 --- a/target/linux/ar7/config-3.18 +++ /dev/null @@ -1,129 +0,0 @@ -CONFIG_ADM6996_PHY=y -CONFIG_AR7=y -CONFIG_AR7_TI=y -# CONFIG_AR7_TYPE_AC49X is not set -CONFIG_AR7_TYPE_TI=y -CONFIG_AR7_WDT=y -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_BOOT_ELF32=y -CONFIG_CEVT_R4K=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -CONFIG_CPMAC=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -CONFIG_CPU_MIPSR1=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_R4K_FPU=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_EARLY_PRINTK=y -CONFIG_ETHERNET_PACKET_MANGLE=y -CONFIG_FIXED_PHY=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_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_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HW_RANDOM=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IP17XX_PHY=y -CONFIG_IRQ_CPU=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_KALLSYMS=y -CONFIG_LEDS_GPIO=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -CONFIG_MDIO_BOARDINFO=y -CONFIG_MIPS=y -# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -CONFIG_MIPS_MT_DISABLED=y -CONFIG_MODULES_USE_ELF_REL=y -# CONFIG_MTD_AC49X_PARTS is not set -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_PHYSMAP=y -CONFIG_MVSWITCH_PHY=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NO_EXCEPT_FILL=y -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PHYLIB=y -# CONFIG_PREEMPT_RCU is not set -# CONFIG_RCU_STALL_COMMON is not set -# CONFIG_SCSI_DMA is not set -CONFIG_SWAP_IO_SPACE=y -CONFIG_SWCONFIG=y -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_SYS_SUPPORTS_ZBOOT=y -CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_VLYNQ=y -# CONFIG_VLYNQ_DEBUG is not set -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/ar7/patches-3.18/001-mips-ar7-fix-serial.patch b/target/linux/ar7/patches-3.18/001-mips-ar7-fix-serial.patch deleted file mode 100644 index 689635226..000000000 --- a/target/linux/ar7/patches-3.18/001-mips-ar7-fix-serial.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 443ab715a40881d6c9ba11b027ba154bac904cb0 Mon Sep 17 00:00:00 2001 -From: Oswald Buddenhagen -Date: Sat, 10 May 2014 23:19:08 +0200 -Subject: [PATCH] MIPS/AR7: ensure that serial ports are properly set up - -without UPF_FIXED_TYPE, the data from the PORT_AR7 uart_config entry is -never copied, resulting in a dead port. - -Signed-off-by: Oswald Buddenhagen ---- - arch/mips/ar7/platform.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/mips/ar7/platform.c -+++ b/arch/mips/ar7/platform.c -@@ -581,6 +581,7 @@ static int __init ar7_register_uarts(voi - uart_port.type = PORT_AR7; - uart_port.uartclk = clk_get_rate(bus_clk) / 2; - uart_port.iotype = UPIO_MEM32; -+ uart_port.flags = UPF_FIXED_TYPE; - uart_port.regshift = 2; - - uart_port.line = 0; diff --git a/target/linux/ar7/patches-3.18/002-MIPS-AR7-ensure-the-port-type-s-FCR-value-is-used.patch b/target/linux/ar7/patches-3.18/002-MIPS-AR7-ensure-the-port-type-s-FCR-value-is-used.patch deleted file mode 100644 index f6a875486..000000000 --- a/target/linux/ar7/patches-3.18/002-MIPS-AR7-ensure-the-port-type-s-FCR-value-is-used.patch +++ /dev/null @@ -1,48 +0,0 @@ -From ee6c9d41de084b2cefd90e5e0c9f30a35f6d3967 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 29 Oct 2017 15:50:42 +0100 -Subject: [PATCH RFC 3/3] MIPS: AR7: ensure the port type's FCR value is used - -Since commit aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt -trigger I/F of FIFO buffers"), the port's default FCR value isn't used -in serial8250_do_set_termios anymore, but copied over once in -serial8250_config_port and then modified as needed. - -Unfortunately, serial8250_config_port will never be called if the port -is shared between kernel and userspace, and the port's flag doesn't have -UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well. - -This causes garbled output from userspace: - -[ 5.220000] random: procd urandom read with 49 bits of entropy available -ers - [kee - -Fix this by forcing it to be configured on boot, resulting in the -expected output: - -[ 5.250000] random: procd urandom read with 50 bits of entropy available -Press the [f] key and hit [enter] to enter failsafe mode -Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level - -Fixes: aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers") -Signed-off-by: Jonas Gorski ---- -I'm not sure if this is just AR7's issue, or if this points to a general -issue for UARTs used as kernel console and login console with the "fixed" -commit. - - arch/mips/ar7/platform.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/ar7/platform.c -+++ b/arch/mips/ar7/platform.c -@@ -581,7 +581,7 @@ static int __init ar7_register_uarts(voi - uart_port.type = PORT_AR7; - uart_port.uartclk = clk_get_rate(bus_clk) / 2; - uart_port.iotype = UPIO_MEM32; -- uart_port.flags = UPF_FIXED_TYPE; -+ uart_port.flags = UPF_FIXED_TYPE | UPF_BOOT_AUTOCONF; - uart_port.regshift = 2; - - uart_port.line = 0; diff --git a/target/linux/ar7/patches-3.18/100-fix-highmem-offset.patch b/target/linux/ar7/patches-3.18/100-fix-highmem-offset.patch deleted file mode 100644 index f1a754978..000000000 --- a/target/linux/ar7/patches-3.18/100-fix-highmem-offset.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/mips/include/asm/mach-ar7/spaces.h -+++ b/arch/mips/include/asm/mach-ar7/spaces.h -@@ -20,6 +20,8 @@ - #define UNCAC_BASE _AC(0xb4000000, UL) /* 0xa0000000 + PHYS_OFFSET */ - #define IO_BASE UNCAC_BASE - -+#define HIGHMEM_START _AC(0x20000000, UL) -+ - #include - - #endif /* __ASM_AR7_SPACES_H */ diff --git a/target/linux/ar7/patches-3.18/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch b/target/linux/ar7/patches-3.18/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch deleted file mode 100644 index 74ac0d148..000000000 --- a/target/linux/ar7/patches-3.18/101-MIPS-AR7-allow-NULL-clock-for-clk_get_rate.patch +++ /dev/null @@ -1,45 +0,0 @@ -From patchwork Tue Jul 18 10:17:26 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [5/9] MIPS: AR7: allow NULL clock for clk_get_rate -X-Patchwork-Submitter: Jonas Gorski -X-Patchwork-Id: 16775 -Message-Id: <20170718101730.2541-6-jonas.gorski@gmail.com> -To: unlisted-recipients:; (no To-header on input) -Cc: Ralf Baechle , - Paul Gortmaker , - James Hogan , - linux-mips@linux-mips.org, linux-kernel@vger.kernel.org -Date: Tue, 18 Jul 2017 12:17:26 +0200 -From: Jonas Gorski -List-Id: linux-mips - -Make the behaviour of clk_get_rate consistent with common clk's -clk_get_rate by accepting NULL clocks as parameter. Some device -drivers rely on this, and will cause an OOPS otherwise. - -Fixes: 780019ddf02f ("MIPS: AR7: Implement clock API") -Cc: Ralf Baechle -Cc: Paul Gortmaker -Cc: James Hogan -Cc: linux-mips@linux-mips.org -Cc: linux-kernel@vger.kernel.org -Reported-by: Mathias Kresin -Signed-off-by: Jonas Gorski ---- - arch/mips/ar7/clock.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/arch/mips/ar7/clock.c -+++ b/arch/mips/ar7/clock.c -@@ -430,6 +430,9 @@ EXPORT_SYMBOL(clk_disable); - - unsigned long clk_get_rate(struct clk *clk) - { -+ if (!clk) -+ return 0; -+ - return clk->rate; - } - EXPORT_SYMBOL(clk_get_rate); diff --git a/target/linux/ar7/patches-3.18/110-flash.patch b/target/linux/ar7/patches-3.18/110-flash.patch deleted file mode 100644 index e4aeffd3e..000000000 --- a/target/linux/ar7/patches-3.18/110-flash.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -12,7 +12,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o - obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o - obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o - obj-$(CONFIG_MTD_AFS_PARTS) += afs.o --obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o -+obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o titanpart.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o ---- a/arch/mips/ar7/platform.c -+++ b/arch/mips/ar7/platform.c -@@ -199,7 +199,7 @@ static struct resource physmap_flash_res - .name = "mem", - .flags = IORESOURCE_MEM, - .start = 0x10000000, -- .end = 0x107fffff, -+ .end = 0x11ffffff, - }; - - static const char *ar7_probe_types[] = { "ar7part", NULL }; diff --git a/target/linux/ar7/patches-3.18/160-vlynq_try_remote_first.patch b/target/linux/ar7/patches-3.18/160-vlynq_try_remote_first.patch deleted file mode 100644 index 1d1310d82..000000000 --- a/target/linux/ar7/patches-3.18/160-vlynq_try_remote_first.patch +++ /dev/null @@ -1,300 +0,0 @@ ---- a/drivers/vlynq/vlynq.c -+++ b/drivers/vlynq/vlynq.c -@@ -119,20 +119,40 @@ static int vlynq_linked(struct vlynq_dev - return 0; - } - -+static volatile int vlynq_delay_value_new = 0; -+ -+static void vlynq_delay_wait(u32 count) -+{ -+ /* Code adopted from original vlynq driver */ -+ int i = 0; -+ volatile int *ptr = &vlynq_delay_value_new; -+ *ptr = 0; -+ -+ /* We are assuming that the each cycle takes about -+ * 23 assembly instructions. */ -+ for(i = 0; i < (count + 23)/23; i++) -+ *ptr = *ptr + 1; -+} -+ - static void vlynq_reset(struct vlynq_device *dev) - { -+ u32 rtm = readl(&dev->local->revision); -+ -+ rtm = rtm < 0x00010205 || readl(&dev->local->status) & 0x800 == 0 ? -+ 0 : 0x600000; -+ - writel(readl(&dev->local->control) | VLYNQ_CTRL_RESET, - &dev->local->control); - - /* Wait for the devices to finish resetting */ -- msleep(5); -+ vlynq_delay_wait(0xffffff); - - /* Remove reset bit */ -- writel(readl(&dev->local->control) & ~VLYNQ_CTRL_RESET, -+ writel(readl(&dev->local->control) & ~VLYNQ_CTRL_RESET | rtm, - &dev->local->control); - - /* Give some time for the devices to settle */ -- msleep(5); -+ vlynq_delay_wait(0xffffff); - } - - static void vlynq_irq_unmask(struct irq_data *d) -@@ -379,6 +399,61 @@ void vlynq_unregister_driver(struct vlyn - } - EXPORT_SYMBOL(vlynq_unregister_driver); - -+enum vlynq_clk_src { -+ vlynq_clk_external, -+ vlynq_clk_local, -+ vlynq_clk_remote, -+ vlynq_clk_invalid, -+}; -+ -+static int __vlynq_set_clocks(struct vlynq_device *dev, -+ enum vlynq_clk_src clk_dir, -+ int lclk_div, int rclk_div) -+{ -+ u32 reg; -+ -+ if (clk_dir == vlynq_clk_invalid) { -+ printk(KERN_ERR "%s: attempt to set invalid clocking\n", -+ dev_name(&dev->dev)); -+ return -EINVAL; -+ } -+ -+ reg = readl(&dev->local->control); -+ if (readl(&dev->local->revision) < 0x00010205) { -+ if (clk_dir & vlynq_clk_local) -+ reg |= VLYNQ_CTRL_CLOCK_INT; -+ else -+ reg &= ~VLYNQ_CTRL_CLOCK_INT; -+ } -+ reg &= ~VLYNQ_CTRL_CLOCK_MASK; -+ reg |= VLYNQ_CTRL_CLOCK_DIV(lclk_div); -+ writel(reg, &dev->local->control); -+ -+ if (!vlynq_linked(dev)) -+ return -ENODEV; -+ -+ printk(KERN_INFO "%s: local VLYNQ protocol rev. is 0x%08x\n", -+ dev_name(&dev->dev), readl(&dev->local->revision)); -+ printk(KERN_INFO "%s: remote VLYNQ protocol rev. is 0x%08x\n", -+ dev_name(&dev->dev), readl(&dev->remote->revision)); -+ -+ reg = readl(&dev->remote->control); -+ if (readl(&dev->remote->revision) < 0x00010205) { -+ if (clk_dir & vlynq_clk_remote) -+ reg |= VLYNQ_CTRL_CLOCK_INT; -+ else -+ reg &= ~VLYNQ_CTRL_CLOCK_INT; -+ } -+ reg &= ~VLYNQ_CTRL_CLOCK_MASK; -+ reg |= VLYNQ_CTRL_CLOCK_DIV(rclk_div); -+ writel(reg, &dev->remote->control); -+ -+ if (!vlynq_linked(dev)) -+ return -ENODEV; -+ -+ return 0; -+} -+ - /* - * A VLYNQ remote device can clock the VLYNQ bus master - * using a dedicated clock line. In that case, both the -@@ -392,29 +467,16 @@ static int __vlynq_try_remote(struct vly - int i; - - vlynq_reset(dev); -- for (i = dev->dev_id ? vlynq_rdiv2 : vlynq_rdiv8; dev->dev_id ? -- i <= vlynq_rdiv8 : i >= vlynq_rdiv2; -- dev->dev_id ? i++ : i--) { -+ for (i = 0; i <= 7; i++) { - - if (!vlynq_linked(dev)) - break; - -- writel((readl(&dev->remote->control) & -- ~VLYNQ_CTRL_CLOCK_MASK) | -- VLYNQ_CTRL_CLOCK_INT | -- VLYNQ_CTRL_CLOCK_DIV(i - vlynq_rdiv1), -- &dev->remote->control); -- writel((readl(&dev->local->control) -- & ~(VLYNQ_CTRL_CLOCK_INT | -- VLYNQ_CTRL_CLOCK_MASK)) | -- VLYNQ_CTRL_CLOCK_DIV(i - vlynq_rdiv1), -- &dev->local->control); -- -- if (vlynq_linked(dev)) { -- printk(KERN_DEBUG -- "%s: using remote clock divisor %d\n", -- dev_name(&dev->dev), i - vlynq_rdiv1 + 1); -- dev->divisor = i; -+ if (!__vlynq_set_clocks(dev, vlynq_clk_remote, i, i)) { -+ printk(KERN_INFO -+ "%s: using remote clock divisor %d\n", -+ dev_name(&dev->dev), i + 1); -+ dev->divisor = i + vlynq_rdiv1; - return 0; - } else { - vlynq_reset(dev); -@@ -433,25 +495,17 @@ static int __vlynq_try_remote(struct vly - */ - static int __vlynq_try_local(struct vlynq_device *dev) - { -- int i; -+ int i, dir = !dev->dev_id; - - vlynq_reset(dev); - -- for (i = dev->dev_id ? vlynq_ldiv2 : vlynq_ldiv8; dev->dev_id ? -- i <= vlynq_ldiv8 : i >= vlynq_ldiv2; -- dev->dev_id ? i++ : i--) { -- -- writel((readl(&dev->local->control) & -- ~VLYNQ_CTRL_CLOCK_MASK) | -- VLYNQ_CTRL_CLOCK_INT | -- VLYNQ_CTRL_CLOCK_DIV(i - vlynq_ldiv1), -- &dev->local->control); -- -- if (vlynq_linked(dev)) { -- printk(KERN_DEBUG -- "%s: using local clock divisor %d\n", -- dev_name(&dev->dev), i - vlynq_ldiv1 + 1); -- dev->divisor = i; -+ for (i = dir ? 7 : 0; dir ? i >= 0 : i <= 7; dir ? i-- : i++) { -+ -+ if (!__vlynq_set_clocks(dev, vlynq_clk_local, i, 0)) { -+ printk(KERN_INFO -+ "%s: using local clock divisor %d\n", -+ dev_name(&dev->dev), i + 1); -+ dev->divisor = i + vlynq_ldiv1; - return 0; - } else { - vlynq_reset(dev); -@@ -473,18 +527,10 @@ static int __vlynq_try_external(struct v - if (!vlynq_linked(dev)) - return -ENODEV; - -- writel((readl(&dev->remote->control) & -- ~VLYNQ_CTRL_CLOCK_INT), -- &dev->remote->control); -- -- writel((readl(&dev->local->control) & -- ~VLYNQ_CTRL_CLOCK_INT), -- &dev->local->control); -- -- if (vlynq_linked(dev)) { -- printk(KERN_DEBUG "%s: using external clock\n", -- dev_name(&dev->dev)); -- dev->divisor = vlynq_div_external; -+ if (!__vlynq_set_clocks(dev, vlynq_clk_external, 0, 0)) { -+ printk(KERN_INFO "%s: using external clock\n", -+ dev_name(&dev->dev)); -+ dev->divisor = vlynq_div_external; - return 0; - } - -@@ -501,24 +547,16 @@ static int __vlynq_enable_device(struct - return result; - - switch (dev->divisor) { -- case vlynq_div_external: - case vlynq_div_auto: - /* When the device is brought from reset it should have clock - * generation negotiated by hardware. - * Check which device is generating clocks and perform setup - * accordingly */ -- if (vlynq_linked(dev) && readl(&dev->remote->control) & -- VLYNQ_CTRL_CLOCK_INT) { -- if (!__vlynq_try_remote(dev) || -- !__vlynq_try_local(dev) || -- !__vlynq_try_external(dev)) -- return 0; -- } else { -- if (!__vlynq_try_external(dev) || -- !__vlynq_try_local(dev) || -- !__vlynq_try_remote(dev)) -- return 0; -- } -+ if (!__vlynq_try_remote(dev) || !__vlynq_try_local(dev)) -+ return 0; -+ case vlynq_div_external: -+ if (!__vlynq_try_external(dev)) -+ return 0; - break; - case vlynq_ldiv1: - case vlynq_ldiv2: -@@ -528,15 +566,12 @@ static int __vlynq_enable_device(struct - case vlynq_ldiv6: - case vlynq_ldiv7: - case vlynq_ldiv8: -- writel(VLYNQ_CTRL_CLOCK_INT | -- VLYNQ_CTRL_CLOCK_DIV(dev->divisor - -- vlynq_ldiv1), &dev->local->control); -- writel(0, &dev->remote->control); -- if (vlynq_linked(dev)) { -- printk(KERN_DEBUG -- "%s: using local clock divisor %d\n", -- dev_name(&dev->dev), -- dev->divisor - vlynq_ldiv1 + 1); -+ if (!__vlynq_set_clocks(dev, vlynq_clk_local, dev->divisor - -+ vlynq_ldiv1, 0)) { -+ printk(KERN_INFO -+ "%s: using local clock divisor %d\n", -+ dev_name(&dev->dev), -+ dev->divisor - vlynq_ldiv1 + 1); - return 0; - } - break; -@@ -548,20 +583,17 @@ static int __vlynq_enable_device(struct - case vlynq_rdiv6: - case vlynq_rdiv7: - case vlynq_rdiv8: -- writel(0, &dev->local->control); -- writel(VLYNQ_CTRL_CLOCK_INT | -- VLYNQ_CTRL_CLOCK_DIV(dev->divisor - -- vlynq_rdiv1), &dev->remote->control); -- if (vlynq_linked(dev)) { -- printk(KERN_DEBUG -- "%s: using remote clock divisor %d\n", -- dev_name(&dev->dev), -- dev->divisor - vlynq_rdiv1 + 1); -+ if (!__vlynq_set_clocks(dev, vlynq_clk_remote, 0, -+ dev->divisor - vlynq_rdiv1)) { -+ printk(KERN_INFO -+ "%s: using remote clock divisor %d\n", -+ dev_name(&dev->dev), -+ dev->divisor - vlynq_rdiv1 + 1); - return 0; - } - break; - } -- -+ vlynq_reset(dev); - ops->off(dev); - return -ENODEV; - } -@@ -732,14 +764,14 @@ static int vlynq_probe(struct platform_d - platform_set_drvdata(pdev, dev); - - printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n", -- dev_name(&dev->dev), (void *)dev->regs_start, dev->irq, -- (void *)dev->mem_start); -+ dev_name(&dev->dev), (void *)dev->regs_start, -+ dev->irq, (void *)dev->mem_start); - - dev->dev_id = 0; - dev->divisor = vlynq_div_auto; -- result = __vlynq_enable_device(dev); -- if (result == 0) { -+ if (!__vlynq_enable_device(dev)) { - dev->dev_id = readl(&dev->remote->chip); -+ vlynq_reset(dev); - ((struct plat_vlynq_ops *)(dev->dev.platform_data))->off(dev); - } - if (dev->dev_id) diff --git a/target/linux/ar7/patches-3.18/200-free-mem-below-kernel-offset.patch b/target/linux/ar7/patches-3.18/200-free-mem-below-kernel-offset.patch deleted file mode 100644 index 4011942d7..000000000 --- a/target/linux/ar7/patches-3.18/200-free-mem-below-kernel-offset.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/arch/mips/ar7/memory.c -+++ b/arch/mips/ar7/memory.c -@@ -66,5 +66,11 @@ void __init prom_meminit(void) - - void __init prom_free_prom_memory(void) - { -- /* Nothing to free */ -+ /* adapted from arch/mips/txx9/generic/setup.c */ -+ unsigned long saddr = PHYS_OFFSET + PAGE_SIZE; -+ unsigned long eaddr = __pa_symbol(&_text); -+ -+ /* free memory between prom-record and kernel _text base */ -+ if (saddr < eaddr) -+ free_init_pages("prom memory", saddr, eaddr); - } diff --git a/target/linux/ar7/patches-3.18/300-add-ac49x-platform.patch b/target/linux/ar7/patches-3.18/300-add-ac49x-platform.patch deleted file mode 100644 index ccdc84d30..000000000 --- a/target/linux/ar7/patches-3.18/300-add-ac49x-platform.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- a/arch/mips/ar7/Platform -+++ b/arch/mips/ar7/Platform -@@ -3,4 +3,9 @@ - # - platform-$(CONFIG_AR7) += ar7/ - cflags-$(CONFIG_AR7) += -I$(srctree)/arch/mips/include/asm/mach-ar7 --load-$(CONFIG_AR7) += 0xffffffff94100000 -+load-$(CONFIG_AR7_TI) += 0xffffffff94100000 -+ -+# -+# AudioCodes AC49x -+# -+load-$(CONFIG_AR7_AC49X) += 0xffffffff945ca000 ---- a/arch/mips/ar7/setup.c -+++ b/arch/mips/ar7/setup.c -@@ -69,6 +69,10 @@ const char *get_system_type(void) - return "TI AR7 (TNETV1056)"; - case TITAN_CHIP_1060: - return "TI AR7 (TNETV1060)"; -+ case TITAN_CHIP_AC495: -+ return "AudioCodes AC495"; -+ case TITAN_CHIP_AC496: -+ return "AudioCodes AC496"; - } - default: - return "TI AR7 (unknown)"; ---- a/arch/mips/include/asm/mach-ar7/ar7.h -+++ b/arch/mips/include/asm/mach-ar7/ar7.h -@@ -92,6 +92,8 @@ - #define TITAN_CHIP_1055 0x0e - #define TITAN_CHIP_1056 0x0d - #define TITAN_CHIP_1060 0x07 -+#define TITAN_CHIP_AC495 0x00 -+#define TITAN_CHIP_AC496 0x02 - - /* Interrupts */ - #define AR7_IRQ_UART0 15 ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -94,7 +94,7 @@ config AR7 - select HAVE_CLK - help - Support for the Texas Instruments AR7 System-on-a-Chip -- family: TNETD7100, 7200 and 7300. -+ family: TI TNETD7100, 7200, 7300 and AudioCodes AC49x. - - config ATH79 - bool "Atheros AR71XX/AR724X/AR913X based boards" -@@ -835,6 +835,7 @@ config MIPS_PARAVIRT - endchoice - - source "arch/mips/alchemy/Kconfig" -+source "arch/mips/ar7/Kconfig" - source "arch/mips/ath79/Kconfig" - source "arch/mips/bcm47xx/Kconfig" - source "arch/mips/bcm63xx/Kconfig" ---- /dev/null -+++ b/arch/mips/ar7/Kconfig -@@ -0,0 +1,26 @@ -+if AR7 -+ -+config AR7_TI -+ bool -+ -+config AR7_AC49X -+ bool -+ -+choice -+ prompt "AR7 SoC family selection" -+ default AR7_TYPE_TI -+ depends on AR7 -+ help -+ Select AR7 MIPS SoC implementation. -+ -+ config AR7_TYPE_TI -+ bool "Texas Instruments AR7" -+ select AR7_TI -+ -+ config AR7_TYPE_AC49X -+ bool "AudioCodes AC49X" -+ select AR7_AC49X -+ -+endchoice -+ -+endif diff --git a/target/linux/ar7/patches-3.18/310-ac49x-prom-support.patch b/target/linux/ar7/patches-3.18/310-ac49x-prom-support.patch deleted file mode 100644 index dddf22106..000000000 --- a/target/linux/ar7/patches-3.18/310-ac49x-prom-support.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/arch/mips/ar7/prom.c -+++ b/arch/mips/ar7/prom.c -@@ -70,6 +70,7 @@ struct psbl_rec { - }; - - static const char psp_env_version[] __initconst = "TIENV0.8"; -+static const char psp_env_version_ac49x[] __initconst = "MaxENV0.2"; - - struct psp_env_chunk { - u8 num; -@@ -186,7 +187,8 @@ static void __init ar7_init_env(struct e - struct psbl_rec *psbl = (struct psbl_rec *)(KSEG1ADDR(0x14000300)); - void *psp_env = (void *)KSEG1ADDR(psbl->env_base); - -- if (strcmp(psp_env, psp_env_version) == 0) { -+ if (strcmp(psp_env, psp_env_version) == 0 || -+ strcmp(psp_env, psp_env_version_ac49x) == 0) { - parse_psp_env(psp_env); - } else { - for (i = 0; i < MAX_ENTRY; i++, env++) diff --git a/target/linux/ar7/patches-3.18/320-ac49x-mtd-partitions.patch b/target/linux/ar7/patches-3.18/320-ac49x-mtd-partitions.patch deleted file mode 100644 index 53ac07273..000000000 --- a/target/linux/ar7/patches-3.18/320-ac49x-mtd-partitions.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -164,6 +164,11 @@ config MTD_OF_PARTS - the partition map from the children of the flash node, - as described in Documentation/devicetree/booting-without-of.txt. - -+config MTD_AC49X_PARTS -+ tristate "AudioCodes AC49X partitioning support" -+ ---help--- -+ AudioCodes AC49X partitioning support -+ - config MTD_AR7_PARTS - tristate "TI AR7 partitioning support" - ---help--- ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -11,6 +11,7 @@ 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 -+obj-$(CONFIG_MTD_AC49X_PARTS) += ac49xpart.o - obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o titanpart.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o ---- a/arch/mips/ar7/platform.c -+++ b/arch/mips/ar7/platform.c -@@ -202,7 +202,7 @@ static struct resource physmap_flash_res - .end = 0x11ffffff, - }; - --static const char *ar7_probe_types[] = { "ar7part", NULL }; -+static const char *ar7_probe_types[] = { "ac49xpart", "ar7part", NULL }; - - static struct physmap_flash_data physmap_flash_data = { - .width = 2, diff --git a/target/linux/ar7/patches-3.18/920-ar7part.patch b/target/linux/ar7/patches-3.18/920-ar7part.patch deleted file mode 100644 index 9948858d0..000000000 --- a/target/linux/ar7/patches-3.18/920-ar7part.patch +++ /dev/null @@ -1,118 +0,0 @@ ---- a/drivers/mtd/ar7part.c -+++ b/drivers/mtd/ar7part.c -@@ -30,11 +30,14 @@ - - #include - -+#include -+ - #define AR7_PARTS 4 - #define ROOT_OFFSET 0xe0000 - - #define LOADER_MAGIC1 le32_to_cpu(0xfeedfa42) - #define LOADER_MAGIC2 le32_to_cpu(0xfeed1281) -+#define LOADER_MAGIC3 le32_to_cpu(0x434d4d4c) - - struct ar7_bin_rec { - unsigned int checksum; -@@ -42,12 +45,16 @@ struct ar7_bin_rec { - unsigned int address; - }; - -+int create_titan_partitions(struct mtd_info *master, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data); -+ - static int create_mtd_partitions(struct mtd_info *master, - struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct ar7_bin_rec header; -- unsigned int offset; -+ unsigned int offset, mtd_start, mtd_end; - size_t len; - unsigned int pre_size = master->erasesize, post_size = 0; - unsigned int root_offset = ROOT_OFFSET; -@@ -55,6 +62,16 @@ static int create_mtd_partitions(struct - int retries = 10; - struct mtd_partition *ar7_parts; - -+ const char *prom_str = prom_getenv("ProductID"); -+ char mtd_name[] = "mtd1"; -+ if(prom_str && -+ (strcmp(prom_str, "CYWL")==0 || -+ strcmp(prom_str, "CYWM")==0 || -+ strcmp(prom_str, "CYLM")==0 || -+ strcmp(prom_str, "CYLL")==0)){ -+ return create_titan_partitions(master, pparts, data); -+ } -+ - ar7_parts = kzalloc(sizeof(*ar7_parts) * AR7_PARTS, GFP_KERNEL); - if (!ar7_parts) - return -ENOMEM; -@@ -83,34 +100,39 @@ static int create_mtd_partitions(struct - - pre_size = offset; - -- if (!ar7_parts[1].offset) { -- ar7_parts[1].offset = master->size - master->erasesize; -- post_size = master->erasesize; -- } -- - switch (header.checksum) { -- case LOADER_MAGIC1: -- while (header.length) { -- offset += sizeof(header) + header.length; -- mtd_read(master, offset, sizeof(header), &len, -- (uint8_t *)&header); -- } -- root_offset = offset + sizeof(header) + 4; -- break; - case LOADER_MAGIC2: -+ for (retries = 0; retries <= 9; retries++) { -+ mtd_name[3] = '0' + retries; -+ prom_str = prom_getenv(mtd_name); -+ if (prom_str == NULL) -+ continue; -+ sscanf(prom_str, "%i,%i", &mtd_start, &mtd_end); -+ if (pre_size == (mtd_start & 0x1ffffff)) { -+ ar7_parts[1].offset = mtd_end &= 0x1ffffff; -+ ar7_parts[1].size = post_size = master->size - mtd_end; -+ break; -+ } -+ } -+ case LOADER_MAGIC1: -+ root_offset = (header.checksum == LOADER_MAGIC1) ? 4 : 0; - while (header.length) { - offset += sizeof(header) + header.length; - mtd_read(master, offset, sizeof(header), &len, - (uint8_t *)&header); - } -- root_offset = offset + sizeof(header) + 4 + 0xff; -- root_offset &= ~(uint32_t)0xff; -+ root_offset += offset + sizeof(header); - break; - default: - printk(KERN_WARNING "Unknown magic: %08x\n", header.checksum); - break; - } - -+ if (!ar7_parts[1].offset) { -+ post_size = master->erasesize; -+ ar7_parts[1].offset = master->size - post_size; -+ } -+ - mtd_read(master, root_offset, sizeof(header), &len, (u8 *)&header); - if (header.checksum != SQUASHFS_MAGIC) { - root_offset += master->erasesize - 1; ---- a/drivers/mtd/titanpart.c -+++ b/drivers/mtd/titanpart.c -@@ -149,7 +149,7 @@ static void titan_add_partition(char * e - } - int create_titan_partitions(struct mtd_info *master, - struct mtd_partition **pparts, -- unsigned long origin) -+ struct mtd_part_parser_data *data) - { - struct nsp_img_hdr_head hdr; - struct nsp_img_hdr_section_info sect_info; diff --git a/target/linux/ar7/patches-3.18/925-actiontec_leds.patch b/target/linux/ar7/patches-3.18/925-actiontec_leds.patch deleted file mode 100644 index 41af2cb54..000000000 --- a/target/linux/ar7/patches-3.18/925-actiontec_leds.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/arch/mips/ar7/platform.c -+++ b/arch/mips/ar7/platform.c -@@ -465,31 +465,22 @@ static struct gpio_led fb_fon_leds[] = { - }, - }; - --static struct gpio_led gt701_leds[] = { -+static struct gpio_led actiontec_leds[] = { - { - .name = "inet:green", - .gpio = 13, -- .active_low = 1, -- }, -- { -- .name = "usb", -- .gpio = 12, -- .active_low = 1, - }, - { - .name = "inet:red", - .gpio = 9, -- .active_low = 1, - }, - { -- .name = "power:red", -+ .name = "power:green", - .gpio = 7, -- .active_low = 1, - }, - { -- .name = "power:green", -+ .name = "power:red", - .gpio = 8, -- .active_low = 1, - .default_trigger = "default-on", - }, - { -@@ -497,6 +488,44 @@ static struct gpio_led gt701_leds[] = { - .gpio = 10, - .active_low = 1, - }, -+ { -+ .name = "wifi", -+ .gpio = 6, -+ .active_low = 1, -+ }, -+ { -+ .name = "wifi:red", -+ .gpio = 3, -+ }, -+ { -+ .name = "standby", -+ .gpio = 4, -+ }, -+ { -+ .name = "wps", -+ .gpio = 16, -+ .active_low = 1, -+ }, -+ { -+ .name = "usb", -+ .gpio = 12, -+ .active_low = 1, -+ }, -+ { -+ .name = "voip", -+ .gpio = 15, -+ .active_low = 1, -+ }, -+ { -+ .name = "line1", -+ .gpio = 23, -+ .active_low = 1, -+ }, -+ { -+ .name = "line2", -+ .gpio = 25, -+ .active_low = 1, -+ }, - }; - - static struct gpio_led_platform_data ar7_led_data; -@@ -540,9 +569,9 @@ static void __init detect_leds(void) - } else if (strstr(prid, "CYWM") || strstr(prid, "CYWL")) { - ar7_led_data.num_leds = ARRAY_SIZE(titan_leds); - ar7_led_data.leds = titan_leds; -- } else if (strstr(prid, "GT701")) { -- ar7_led_data.num_leds = ARRAY_SIZE(gt701_leds); -- ar7_led_data.leds = gt701_leds; -+ } else if (strstr(prid, "GT7") || strstr(prid, "PK5000")) { -+ ar7_led_data.num_leds = ARRAY_SIZE(actiontec_leds); -+ ar7_led_data.leds = actiontec_leds; - } - } - diff --git a/target/linux/ar7/patches-3.18/950-cpmac_titan.patch b/target/linux/ar7/patches-3.18/950-cpmac_titan.patch deleted file mode 100644 index 3cabae067..000000000 --- a/target/linux/ar7/patches-3.18/950-cpmac_titan.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/drivers/net/ethernet/ti/cpmac.c -+++ b/drivers/net/ethernet/ti/cpmac.c -@@ -1147,6 +1147,8 @@ static int cpmac_probe(struct platform_d - goto out; - } - -+ ar7_device_reset(pdata->reset_bit); -+ - dev->irq = platform_get_irq_byname(pdev, "irq"); - - dev->netdev_ops = &cpmac_netdev_ops; -@@ -1228,7 +1230,7 @@ int cpmac_init(void) - cpmac_mii->reset = cpmac_mdio_reset; - cpmac_mii->irq = mii_irqs; - -- cpmac_mii->priv = ioremap(AR7_REGS_MDIO, 256); -+ cpmac_mii->priv = ioremap(ar7_is_titan() ? TITAN_REGS_MDIO : AR7_REGS_MDIO, 256); - - if (!cpmac_mii->priv) { - pr_err("Can't ioremap mdio registers\n"); -@@ -1239,10 +1241,16 @@ int cpmac_init(void) - /* FIXME: unhardcode gpio&reset bits */ - ar7_gpio_disable(26); - ar7_gpio_disable(27); -- ar7_device_reset(AR7_RESET_BIT_CPMAC_LO); -- ar7_device_reset(AR7_RESET_BIT_CPMAC_HI); -+ -+ if (!ar7_is_titan()) { -+ ar7_device_reset(AR7_RESET_BIT_CPMAC_LO); -+ ar7_device_reset(AR7_RESET_BIT_CPMAC_HI); -+ } - ar7_device_reset(AR7_RESET_BIT_EPHY); - -+ if (ar7_is_titan()) -+ ar7_device_reset(TITAN_RESET_BIT_EPHY1); -+ - cpmac_mii->reset(cpmac_mii); - - for (i = 0; i < 300; i++) { -@@ -1259,7 +1267,11 @@ int cpmac_init(void) - mask = 0; - } - -- cpmac_mii->phy_mask = ~(mask | 0x80000000); -+ if (ar7_is_titan()) -+ cpmac_mii->phy_mask = ~(mask | 0x80000000 | 0x40000000); -+ else -+ cpmac_mii->phy_mask = ~(mask | 0x80000000); -+ - snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "cpmac-1"); - - res = mdiobus_register(cpmac_mii); 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 f09cbebf7..858d67500 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -60,29 +60,14 @@ ap147-010) ucidef_set_led_switch "lan4" "LAN4" "ap147:green:lan4" "switch0" "0x02" ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "ap147:green:wlan-2g" "phy0tpt" ;; -ac9531-010) - ucidef_set_led_netdev "wan" "WAN" "ac9531:green:wan" "eth1" - ucidef_set_led_switch "lan1" "LAN1" "ac9531:green:lan1" "switch0" "0x02" - ucidef_set_led_switch "lan2" "LAN2" "ac9531:green:lan2" "switch0" "0x04" - ucidef_set_led_switch "lan3" "LAN3" "ac9531:green:lan3" "switch0" "0x08" - ucidef_set_led_switch "lan4" "LAN4" "ac9531:green:lan4" "switch0" "0x10" - ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "ac9531:green:wlan-2g" "phy1tpt" - ;; -ac9531-020) - ucidef_set_led_netdev "wan" "WAN" "ac9531:green:wan" "eth1" - ucidef_set_led_switch "lan1" "LAN1" "ac9531:green:lan1" "switch0" "0x10" - ucidef_set_led_switch "lan2" "LAN2" "ac9531:green:lan2" "switch0" "0x08" - ucidef_set_led_switch "lan3" "LAN3" "ac9531:green:lan3" "switch0" "0x04" - ucidef_set_led_switch "lan4" "LAN4" "ac9531:green:lan4" "switch0" "0x02" - ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "ac9531:green:wlan-2g" "phy1tpt" - ;; ap90q|\ cpe505n|\ cpe830|\ cpe870|\ dr531|\ e600g-v2|\ -e600gac-v2) +e600gac-v2|\ +e750a-v4) ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0" ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth1" @@ -251,16 +236,25 @@ cf-e530n) ucidef_set_led_netdev "wan" "WAN" "$board:blue:wan" "eth1" ;; cpe210|\ +cpe210-v2|\ 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" ucidef_set_led_rssi "rssilow" "RSSILOW" "tp-link:green:link1" "wlan0" "1" "100" "0" "13" ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "tp-link:green:link2" "wlan0" "26" "100" "-25" "13" ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "tp-link:green:link3" "wlan0" "51" "100" "-50" "13" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "76" "100" "-75" "13" + + case "$board" in + cpe210-v2) + ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan0" "eth0" + ;; + *) + ucidef_set_led_switch "lan0" "LAN0" "tp-link:green:lan0" "switch0" "0x20" + ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10" + ;; + esac ;; cr3000) ucidef_set_led_netdev "wan" "WAN" "pcs:blue:wan" "eth1" @@ -379,6 +373,10 @@ e1700ac-v2) ucidef_set_led_usbdev "usb" "USB" "$board:green:usb" "1-1" ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:green:wlan2g" "phy1tpt" ;; +e558-v2|\ +e750g-v8) + ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt" + ;; esr900) ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "engenius:blue:wlan-2g" "phy0tpt" ucidef_set_led_wlan "wlan5g" "WLAN 5 GHz" "engenius:blue:wlan-5g" "phy1tpt" @@ -393,6 +391,10 @@ fritz4020) ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0" ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt" ;; +fritz450e) + ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0" + ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt" + ;; gl-ar300m) ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt" ;; @@ -400,10 +402,6 @@ gl-ar750) ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:white:wlan2g" "phy1tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:white:wlan5g" "phy0tpt" ;; -gl-ar750s) - ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:green:wlan2g" "phy1tpt" - ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:green:wlan5g" "phy0tpt" - ;; gl-mifi) ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt" ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0" @@ -443,11 +441,6 @@ koala) ucidef_set_led_wlan "wlan2g" "WLAN 2.4GHz" "$board:yellow:wlan2" "phy1tpt" ucidef_set_led_wlan "wlan5g" "WLAN 5GHz" "$board:red:wlan58" "phy0tpt" ;; -k2t) - ucidef_set_led_switch "blue" "WAN(blue)" "$board:blue:lan" "switch0" "0x10" - ucidef_set_led_default "yellow" "STATUS(yellow)" "$board:yellow:lan" "1" - ucidef_set_led_default "red" "RUNNING(red)" "$board:red:lan" "0" - ;; lan-turtle) ucidef_set_led_netdev "wan" "WAN" "$board:orange:system" "eth1" ;; @@ -870,7 +863,6 @@ tl-wdr4900-v2) ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:blue:wlan2g" "phy0tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "tp-link:blue:wlan5g" "phy1tpt" ;; -tl-wdx6501-v7|\ tl-wdr6500-v2|\ tl-wr741nd) ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1" 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 ad85cc885..b0076366b 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -74,12 +74,14 @@ ar71xx_setup_interfaces() cap4200ag|\ cf-e380ac-v1|\ cf-e380ac-v2|\ + cpe210-v2|\ dr342|\ eap120|\ eap300v2|\ eap7660d|\ el-mini|\ fritz300e|\ + fritz450e|\ gl-usb150|\ hiveap-121|\ koala|\ @@ -199,10 +201,6 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan" ;; - k2t) - ucidef_add_switch "switch0" \ - "0@eth0" "3:lan:1" "5:lan:2" "4:wan" - ;; ap132|\ ap136|\ ap152|\ @@ -233,16 +231,6 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1" ;; - ac9531-010) - ucidef_set_interface_lan "eth1" - ucidef_add_switch "switch0" \ - "0@eth0" "1:wan:4" "2:lan:3" "3:lan:2" "4:lan:1" - ;; - ac9531-020) - ucidef_set_interface_wan "eth1" - ucidef_add_switch "switch0" \ - "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" - ;; ap143|\ rb-433|\ rb-433u) @@ -329,7 +317,7 @@ ar71xx_setup_interfaces() rb-941-2nd) ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:wan:1" - ;; + ;; db120|\ rb-2011il|\ rb-2011ils|\ @@ -359,7 +347,6 @@ ar71xx_setup_interfaces() omy-g1|\ r6100|\ smart-300|\ - tl-wdx6501-v7|\ tl-wdr6500-v2|\ tl-wr940n-v4|\ tl-wr940n-v6|\ @@ -393,11 +380,17 @@ ar71xx_setup_interfaces() ucidef_add_switch_attr "switch0" "enable" "false" ;; e1700ac-v2|\ + e750g-v8|\ unifiac-pro|\ xd3200) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:wan" ;; + e558-v2) + ucidef_set_interfaces_lan_wan "eth1.1" "eth0.2" + ucidef_add_switch "switch0" \ + "0@eth1" "4:lan" "5:lan" "6@eth0" "3:wan" + ;; ebr-2310-c1) ucidef_set_interfaces_lan_wan "eth0.1" "eth1" ucidef_add_switch "switch0" \ @@ -418,7 +411,7 @@ ar71xx_setup_interfaces() "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" ;; ew-balin) - ucidef_set_interface "usb2" ifname "usb0" protocol "static" + ucidef_set_interface_raw "usb2" "usb0" "static" ucidef_add_switch "switch0" \ "0@eth0" "5:lan:4" "4:lan:5" "3:wan" ;; @@ -449,10 +442,6 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth1" "1:lan" "2:lan" ;; - gl-ar750s) - ucidef_add_switch "switch0" \ - "0@eth0" "2:lan:2" "3:lan:1" "1:wan" - ;; jwap230) ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2" ucidef_add_switch "switch0" \ @@ -489,7 +478,7 @@ ar71xx_setup_interfaces() ;; tellstick-znet-lite) ucidef_set_interface_wan "eth0" - ucidef_set_interface "wlan" ifname "wlan0" protocol "dhcp" + ucidef_set_interface_raw "wlan" "wlan0" "dhcp" ;; tl-mr3420-v2|\ tl-wr841n-v8|\ @@ -501,6 +490,7 @@ ar71xx_setup_interfaces() "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; archer-c7-v4|\ + archer-c7-v5|\ tl-wdr4300|\ tl-wr1041n-v2) ucidef_add_switch "switch0" \ @@ -520,7 +510,7 @@ ar71xx_setup_interfaces() ;; tl-wr841n-v1|\ tl-wr941nd) - ucidef_set_interface "eth" ifname "eth0" + ucidef_set_interface_raw "eth" "eth0" ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; tl-wr741nd|\ @@ -586,10 +576,6 @@ ar71xx_setup_macs() local wan_mac="" case $board in - k2t) - lan_mac=$(head -c400 $(find_mtd_chardev config) | grep -o wan_mac.* | cut -d\" -f3) - wan_mac=$(macaddr_add "$lan_mac" 1) - ;; dgl-5500-a1|\ dir-825-c1) wan_mac=$(mtd_get_mac_ascii nvram "wan_mac") diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 7258361ac..4eb2abb26 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -24,7 +24,10 @@ get_status_led() { antminer-s3|\ antminer-r1|\ e1700ac-v2|\ + e558-v2|\ e600gac-v2|\ + e750a-v4|\ + e750g-v8|\ eap120|\ minibox-v1|\ packet-squirrel|\ @@ -57,10 +60,6 @@ get_status_led() { ap147-010) status_led="ap147:green:status" ;; - ac9531-020|\ - ac9531-010) - status_led="ac9531:green:status" - ;; ap135-020) status_led="ap135:green:status" ;; @@ -70,8 +69,10 @@ get_status_led() { archer-c60-v1|\ archer-c60-v2|\ archer-c7-v4|\ + archer-c7-v5|\ fritz300e|\ fritz4020|\ + fritz450e|\ gl-usb150|\ mr12|\ mr16|\ @@ -268,9 +269,6 @@ get_status_led() { koala) status_led="$board:blue:sys" ;; - k2t) - status_led="$board:red:lan" - ;; lan-turtle) status_led="$board:orange:system" ;; @@ -379,7 +377,8 @@ get_status_led() { rb-962uigs-5hact2hnt|\ rb-lhg-5nd|\ rb-map-2nd|\ - rb-mapl-2nd) + rb-mapl-2nd|\ + rb-wap-2nd) status_led="rb:green:user" ;; rb-951ui-2hnd) @@ -388,7 +387,8 @@ get_status_led() { rb-912uag-2hpnd|\ rb-912uag-5hpnd|\ rb-sxt2n|\ - rb-sxt5n) + rb-sxt5n|\ + rb-wapg-5hact2hnd) status_led="rb:green:power" ;; re355|\ diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 6a120b363..94bce7d33 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -75,13 +75,10 @@ case "$FIRMWARE" in ath9k_eeprom_extract "art" 4096 2048 ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0) +1) ;; - fritz4020) + fritz4020|\ + fritz450e) ath9k_eeprom_extract_reverse "urlader" 5441 1088 ;; - k2t) - ath9k_eeprom_extract "art" 4096 2048 - ath9k_patch_firmware_mac $(macaddr_add $(head -c400 $(find_mtd_chardev config) | grep -o wan_mac.* | cut -d\" -f3) +3) - ;; mr18) . /lib/upgrade/nand.sh 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 index 3ed710f90..53f53775f 100644 --- 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 @@ -65,17 +65,11 @@ case "$FIRMWARE" in ath10kcal_extract "art" 20480 2116 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) ;; - archer-c7-v4) + archer-c7-v4|\ + archer-c7-v5) ath10kcal_extract "art" 20480 2116 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1) ;; - ap147-010|\ - ac9531-010|\ - ac9531-020|\ - ap152) - ath10kcal_extract "art" 20480 2116 - ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) - ;; cf-e355ac-v1|\ cf-e380ac-v1|\ cf-e380ac-v2|\ @@ -106,7 +100,6 @@ case "$FIRMWARE" in ath10kcal_extract "caldata" 20480 2116 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) ;; - gl-ar750s|\ gl-ar750|\ tl-wpa8630) ath10kcal_extract "art" 20480 2116 @@ -172,14 +165,12 @@ case "$FIRMWARE" in ;; "ath10k/pre-cal-pci-0000:00:00.0.bin") case $board in - tl-wdx6501-v7|\ archer-c58-v1|\ archer-c59-v1|\ archer-c60-v1|\ archer-c60-v2|\ cf-e355ac-v2|\ - cf-e375ac|\ - k2t) + cf-e375ac) ath10kcal_extract "art" 20480 12064 ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 3e77a3524..a763938ec 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -18,9 +18,6 @@ case "$board" in archer-c60-v2) echo $(macaddr_add $(mtd_get_mac_binary mac 8) $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress ;; - k2t) - echo $(macaddr_add $(head -c400 $(find_mtd_chardev config) | grep -o wan_mac.* | cut -d\" -f3) +$((2+$PHYNBR))) > /sys${DEVPATH}/macaddress - ;; *) ;; esac diff --git a/target/linux/ar71xx/base-files/etc/init.d/ar71xx_clock b/target/linux/ar71xx/base-files/etc/init.d/ar71xx_clock deleted file mode 100755 index 99308ae7c..000000000 --- a/target/linux/ar71xx/base-files/etc/init.d/ar71xx_clock +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2017 lean - -START=99 - -start() -{ - a=$(cat /tmp/sysinfo/model) - b=$(dmesg | awk -F 'CPU:|MHz' '/Clocks:/{print $2+0}') - c=${a}" CPU:"${b}Mhz - echo -n $c > /tmp/sysinfo/model -} \ No newline at end of file diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index ead1e5a4d..3af2eee2b 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -333,9 +333,6 @@ tplink_board_detect() { "640000"*) model="TP-Link TL-MR6400" ;; - "65010007") - model="TP-Link TL-WDX6501" - ;; "65000002") model="TP-Link TL-WDR6500" ;; @@ -374,7 +371,7 @@ tplink_pharos_get_model_string() { } tplink_pharos_board_detect() { - local model_string="$(tplink_pharos_get_model_string | tr -d '\r')" + local model_string="$1" local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS" local model="${1%%\(*}" @@ -382,6 +379,14 @@ tplink_pharos_board_detect() { AR71XX_MODEL="TP-Link $model v$2" } +tplink_pharos_v2_get_model_string() { + local part + part=$(find_mtd_part 'product-info') + [ -z "$part" ] && return 1 + + dd if=$part bs=1 skip=4360 count=64 2>/dev/null | tr -d '\r\0' | head -n 1 +} + ar71xx_board_detect() { local machine local name @@ -458,12 +463,6 @@ ar71xx_board_detect() { *"AP147-010 reference board") name="ap147-010" ;; - *"AC9531-010 reference board") - name="ac9531-010" - ;; - *"AC9531-020 reference board") - name="ac9531-020" - ;; *"AP152 reference board") name="ap152" ;; @@ -485,6 +484,9 @@ ar71xx_board_detect() { *"Archer C7 v4") name="archer-c7-v4" ;; + *"Archer C7 v5") + name="archer-c7-v5" + ;; *"Archer C58 v1") name="archer-c58-v1" ;; @@ -569,14 +571,18 @@ ar71xx_board_detect() { ;; *"CPE210/220") name="cpe210" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" + ;; + *"CPE210 v2") + name="cpe210-v2" + tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" ;; *"CPE505N") name="cpe505n" ;; *"CPE510/520") name="cpe510" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" ;; *"CPE830") name="cpe830" @@ -669,15 +675,24 @@ ar71xx_board_detect() { *"E2100L") name="e2100l" ;; + *"E558 v2") + name="e558-v2" + ;; *"E600G v2") name="e600g-v2" ;; *"E600GAC v2") name="e600gac-v2" ;; + *"E750A v4") + name="e750a-v4" + ;; + *"E750G v8") + name="e750g-v8" + ;; *"EAP120") name="eap120" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" ;; *"EAP300 v2") name="eap300v2" @@ -724,6 +739,9 @@ ar71xx_board_detect() { *"FRITZ!WLAN Repeater 300E") name="fritz300e" ;; + *"FRITZ!WLAN Repeater 450E") + name="fritz450e" + ;; *"GL-AR150") name="gl-ar150" ;; @@ -736,9 +754,6 @@ ar71xx_board_detect() { *"GL-AR750") name="gl-ar750" ;; - *"GL-AR750S") - name="gl-ar750s" - ;; *"GL-CONNECT INET v1") name="gl-inet" @@ -780,11 +795,6 @@ ar71xx_board_detect() { *"Koala") name="koala" ;; - *"K2T A1/A2/A3 board") - #fixup: update the machine name - machine=$(echo -n "$machine" | sed "s,A1/A2/A3,$(head -c400 $(find_mtd_chardev config) | grep -o hw_ver.* | cut -d\" -f3),") - name="k2t" - ;; *"LAN Turtle") name="lan-turtle" ;; @@ -1243,9 +1253,6 @@ ar71xx_board_detect() { *"TL-WDR4900 v2") name="tl-wdr4900-v2" ;; - *"TL-WDX6501 v7") - name="tl-wdx6501-v7" - ;; *"TL-WDR6500 v2") name="tl-wdr6500-v2" ;; @@ -1378,11 +1385,11 @@ ar71xx_board_detect() { ;; *"WBS210") name="wbs210" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" ;; *"WBS510") name="wbs510" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" ;; "WeIO"*) name="weio" diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx index dc69970c8..7d3e82813 100644 --- a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx +++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx @@ -34,10 +34,6 @@ preinit_set_mac_address() { dir-615-i1) fetch_mac_from_mtd nvram sys_lan_mac sys_wan_mac ;; - k2t) - mac_wan=$(head -c400 $(find_mtd_chardev config) | grep -o wan_mac.* | cut -d\" -f3) - [ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan" - ;; mr18|\ z1) mac_lan=$(mtd_get_mac_binary_ubi board-config 102) 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 f82e68452..909e61509 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 @@ -12,8 +12,6 @@ set_preinit_iface() { alfa-nx|\ ap135-020|\ ap136-020|\ - ac9531-010 |\ - ac9531-020 |\ ap147-010|\ archer-c5|\ archer-c7|\ diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 48f49655c..ca1270b7f 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -97,10 +97,11 @@ tplink_pharos_check_support_list() { local image="$1" local offset="$2" local model="$3" + local trargs="$4" # Here $image is given to dd directly instead of using get_image; # otherwise the skip will take almost a second (as dd can't seek) - dd if="$image" bs=1 skip=$offset count=1024 2>/dev/null | ( + dd if="$image" bs=1 skip=$offset count=1024 2>/dev/null | tr -d "$trargs" | ( while IFS= read -r line; do [ "$line" = "$model" ] && exit 0 done @@ -110,17 +111,19 @@ tplink_pharos_check_support_list() { } tplink_pharos_check_image() { - local magic_long="$(get_magic_long "$1")" - [ "$magic_long" != "7f454c46" ] && { - echo "Invalid image magic '$magic_long'" + local image_magic="$(get_magic_long "$1")" + local board_magic="$2" + [ "$image_magic" != "$board_magic" ] && { + echo "Invalid image magic '$image_magic'. Expected '$board_magic'." return 1 } - local model_string="$(tplink_pharos_get_model_string)" + local model_string="$3" + local trargs="$4" # New images have the support list at 7802888, old ones at 1511432 - tplink_pharos_check_support_list "$1" 7802888 "$model_string" || \ - tplink_pharos_check_support_list "$1" 1511432 "$model_string" || { + tplink_pharos_check_support_list "$1" 7802888 "$model_string" "$trargs" || \ + tplink_pharos_check_support_list "$1" 1511432 "$model_string" "$trargs" || { echo "Unsupported image (model not in support-list)" return 1 } @@ -212,6 +215,7 @@ platform_check_image() { archer-c60-v1|\ archer-c60-v2|\ archer-c7-v4|\ + archer-c7-v5|\ bullet-m|\ c-55|\ carambola2|\ @@ -246,8 +250,11 @@ platform_check_image() { dr531|\ dragino2|\ e1700ac-v2|\ + e558-v2|\ e600g-v2|\ e600gac-v2|\ + e750a-v4|\ + e750g-v8|\ ebr-2310-c1|\ ens202ext|\ epg5000|\ @@ -260,7 +267,6 @@ platform_check_image() { gl-ar300m|\ gl-ar300|\ gl-ar750|\ - gl-ar750s|\ gl-domino|\ gl-mifi|\ gl-usb150|\ @@ -334,9 +340,6 @@ platform_check_image() { ap136-010|\ ap136-020|\ ap147-010|\ - ac9531-010|\ - ac9531-020|\ - ap143|\ ap152|\ ap91-5g|\ ap96|\ @@ -455,7 +458,6 @@ platform_check_image() { tl-wdr3500|\ tl-wdr4300|\ tl-wdr4900-v2|\ - tl-wdx6501-v7|\ tl-wdr6500-v2|\ tl-wpa8630|\ tl-wr1041n-v2|\ @@ -493,7 +495,6 @@ platform_check_image() { local magic_ver="0100" case "$board" in - tl-wdx6501-v7|\ tl-wdr6500-v2) magic_ver="0200" ;; @@ -583,7 +584,11 @@ platform_check_image() { eap120|\ wbs210|\ wbs510) - tplink_pharos_check_image "$1" && return 0 + tplink_pharos_check_image "$1" "7f454c46" "$(tplink_pharos_get_model_string)" '' && return 0 + return 1 + ;; + cpe210-v2) + tplink_pharos_check_image "$1" "01000000" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0 return 1 ;; a40|\ @@ -637,14 +642,6 @@ platform_check_image() { cybertan_check_image "$1" && return 0 return 1 ;; - k2t) - [ "$magic_long" != "27051956" ] && { - echo "Invalid image type." - return 1 - } - - return 0 - ;; nbg6616|\ uap-pro|\ unifi-outdoor-plus) @@ -702,6 +699,7 @@ platform_check_image() { # these boards use metadata images fritz300e|\ fritz4020|\ + fritz450e|\ koala|\ rb-750-r2|\ rb-750p-pbr2|\ diff --git a/target/linux/ar71xx/config-4.14 b/target/linux/ar71xx/config-4.14 deleted file mode 100644 index fa53b4d75..000000000 --- a/target/linux/ar71xx/config-4.14 +++ /dev/null @@ -1,481 +0,0 @@ -CONFIG_AG71XX=y -CONFIG_AG71XX_AR8216_SUPPORT=y -# CONFIG_AG71XX_DEBUG is not set -# CONFIG_AG71XX_DEBUG_FS is not set -CONFIG_AR8216_PHY=y -CONFIG_AR8216_PHY_LEDS=y -CONFIG_ARCH_BINFMT_ELF_STATE=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set -CONFIG_ARCH_HAS_RESET_CONTROLLER=y -# CONFIG_ARCH_HAS_SG_CHAIN is not set -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_AT803X_PHY=y -CONFIG_ATH79=y -# CONFIG_ATH79_DEV_AP9X_PCI is not set -# CONFIG_ATH79_DEV_DSA is not set -# CONFIG_ATH79_DEV_ETH is not set -# CONFIG_ATH79_DEV_GPIO_BUTTONS is not set -# CONFIG_ATH79_DEV_LEDS_GPIO is not set -# CONFIG_ATH79_DEV_M25P80 is not set -# CONFIG_ATH79_DEV_SPI is not set -# CONFIG_ATH79_DEV_USB is not set -# CONFIG_ATH79_MACH_A60 is not set -# CONFIG_ATH79_MACH_ALFA_AP120C is not set -# CONFIG_ATH79_MACH_ALFA_AP96 is not set -# 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_ANTMINER_S1 is not set -# CONFIG_ATH79_MACH_ANTMINER_S3 is not set -# CONFIG_ATH79_MACH_ANTROUTER_R1 is not set -# CONFIG_ATH79_MACH_AP121 is not set -# CONFIG_ATH79_MACH_AP121F is not set -# CONFIG_ATH79_MACH_AP132 is not set -# CONFIG_ATH79_MACH_AP136 is not set -# CONFIG_ATH79_MACH_AP143 is not set -# CONFIG_ATH79_MACH_AP147 is not set -# CONFIG_ATH79_MACH_AP152 is not set -# CONFIG_ATH79_MACH_AP531B0 is not set -# CONFIG_ATH79_MACH_AP81 is not set -# CONFIG_ATH79_MACH_AP90Q is not set -# CONFIG_ATH79_MACH_AP91_5G is not set -# CONFIG_ATH79_MACH_AP96 is not set -# CONFIG_ATH79_MACH_ARCHER_C25_V1 is not set -# CONFIG_ATH79_MACH_ARCHER_C58_V1 is not set -# CONFIG_ATH79_MACH_ARCHER_C59_V1 is not set -# CONFIG_ATH79_MACH_ARCHER_C60_V1 is not set -# CONFIG_ATH79_MACH_ARCHER_C60_V2 is not set -# CONFIG_ATH79_MACH_ARCHER_C7 is not set -# CONFIG_ATH79_MACH_ARDUINO_YUN is not set -# CONFIG_ATH79_MACH_AW_NR580 is not set -# CONFIG_ATH79_MACH_BHR_4GRV2 is not set -# CONFIG_ATH79_MACH_BHU_BXU2000N2_A is not set -# CONFIG_ATH79_MACH_BSB is not set -# CONFIG_ATH79_MACH_C55 is not set -# CONFIG_ATH79_MACH_C60 is not set -# CONFIG_ATH79_MACH_CAP324 is not set -# CONFIG_ATH79_MACH_CAP4200AG is not set -# CONFIG_ATH79_MACH_CARAMBOLA2 is not set -# CONFIG_ATH79_MACH_CF_E316N_V2 is not set -# CONFIG_ATH79_MACH_CF_E320N_V2 is not set -# CONFIG_ATH79_MACH_CF_E355AC is not set -# CONFIG_ATH79_MACH_CF_E375AC is not set -# CONFIG_ATH79_MACH_CF_E380AC_V1 is not set -# CONFIG_ATH79_MACH_CF_E380AC_V2 is not set -# CONFIG_ATH79_MACH_CF_E520N is not set -# CONFIG_ATH79_MACH_CF_E530N is not set -# CONFIG_ATH79_MACH_CPE505N is not set -# CONFIG_ATH79_MACH_CPE510 is not set -# CONFIG_ATH79_MACH_CPE830 is not set -# CONFIG_ATH79_MACH_CPE870 is not set -# CONFIG_ATH79_MACH_CR3000 is not set -# CONFIG_ATH79_MACH_CR5000 is not set -# CONFIG_ATH79_MACH_DAP_1330_A1 is not set -# CONFIG_ATH79_MACH_DAP_2695_A1 is not set -# CONFIG_ATH79_MACH_DB120 is not set -# CONFIG_ATH79_MACH_DGL_5500_A1 is not set -# CONFIG_ATH79_MACH_DHP_1565_A1 is not set -# CONFIG_ATH79_MACH_DIR_505_A1 is not set -# CONFIG_ATH79_MACH_DIR_600_A1 is not set -# CONFIG_ATH79_MACH_DIR_615_C1 is not set -# CONFIG_ATH79_MACH_DIR_615_I1 is not set -# CONFIG_ATH79_MACH_DIR_825_B1 is not set -# CONFIG_ATH79_MACH_DIR_825_C1 is not set -# CONFIG_ATH79_MACH_DIR_869_A1 is not set -# CONFIG_ATH79_MACH_DLAN_HOTSPOT is not set -# CONFIG_ATH79_MACH_DLAN_PRO_1200_AC is not set -# CONFIG_ATH79_MACH_DLAN_PRO_500_WP is not set -# CONFIG_ATH79_MACH_DOMYWIFI_DW33D is not set -# CONFIG_ATH79_MACH_DR342 is not set -# CONFIG_ATH79_MACH_DR344 is not set -# CONFIG_ATH79_MACH_DR531 is not set -# CONFIG_ATH79_MACH_DRAGINO2 is not set -# CONFIG_ATH79_MACH_E1700AC_V2 is not set -# CONFIG_ATH79_MACH_E2100L is not set -# CONFIG_ATH79_MACH_E600G_V2 is not set -# CONFIG_ATH79_MACH_EAP120 is not set -# CONFIG_ATH79_MACH_EAP300V2 is not set -# CONFIG_ATH79_MACH_EAP7660D is not set -# CONFIG_ATH79_MACH_EL_M150 is not set -# CONFIG_ATH79_MACH_EL_MINI is not set -# CONFIG_ATH79_MACH_ENS202EXT is not set -# CONFIG_ATH79_MACH_EPG5000 is not set -# CONFIG_ATH79_MACH_ESR1750 is not set -# CONFIG_ATH79_MACH_ESR900 is not set -# CONFIG_ATH79_MACH_EW_BALIN is not set -# CONFIG_ATH79_MACH_EW_DORIN is not set -# CONFIG_ATH79_MACH_F9K1115V2 is not set -# CONFIG_ATH79_MACH_FRITZ300E is not set -# CONFIG_ATH79_MACH_FRITZ4020 is not set -# CONFIG_ATH79_MACH_GL_AR150 is not set -# CONFIG_ATH79_MACH_GL_AR300 is not set -# CONFIG_ATH79_MACH_GL_AR300M is not set -# CONFIG_ATH79_MACH_GL_AR750 is not set -# CONFIG_ATH79_MACH_GL_AR750S is not set -# CONFIG_ATH79_MACH_GL_DOMINO is not set -# CONFIG_ATH79_MACH_GL_INET is not set -# CONFIG_ATH79_MACH_GL_MIFI is not set -# CONFIG_ATH79_MACH_GL_USB150 is not set -# CONFIG_ATH79_MACH_GS_OOLITE_V1 is not set -# CONFIG_ATH79_MACH_GS_OOLITE_V5_2 is not set -# CONFIG_ATH79_MACH_HIVEAP_121 is not set -# CONFIG_ATH79_MACH_HIWIFI_HC6361 is not set -# CONFIG_ATH79_MACH_HORNET_UB is not set -# CONFIG_ATH79_MACH_JA76PF is not set -# CONFIG_ATH79_MACH_JWAP003 is not set -# CONFIG_ATH79_MACH_JWAP230 is not set -# CONFIG_ATH79_MACH_KOALA is not set -# CONFIG_ATH79_MACH_K2T is not set -# CONFIG_ATH79_MACH_LAN_TURTLE is not set -# CONFIG_ATH79_MACH_LIMA is not set -# CONFIG_ATH79_MACH_MC_MAC1200R is not set -# CONFIG_ATH79_MACH_MR12 is not set -# CONFIG_ATH79_MACH_MR16 is not set -# CONFIG_ATH79_MACH_MR1750 is not set -# CONFIG_ATH79_MACH_MR18 is not set -# CONFIG_ATH79_MACH_MR600 is not set -# CONFIG_ATH79_MACH_MR900 is not set -# CONFIG_ATH79_MACH_MYNET_N600 is not set -# CONFIG_ATH79_MACH_MYNET_N750 is not set -# CONFIG_ATH79_MACH_MYNET_REXT is not set -# CONFIG_ATH79_MACH_MZK_W04NU is not set -# CONFIG_ATH79_MACH_MZK_W300NH is not set -# CONFIG_ATH79_MACH_N5Q is not set -# CONFIG_ATH79_MACH_NBG460N is not set -# CONFIG_ATH79_MACH_NBG6716 is not set -# CONFIG_ATH79_MACH_OM2P is not set -# CONFIG_ATH79_MACH_OM5P is not set -# CONFIG_ATH79_MACH_OM5P_AC is not set -# CONFIG_ATH79_MACH_OM5P_ACv2 is not set -# CONFIG_ATH79_MACH_OMY_G1 is not set -# CONFIG_ATH79_MACH_OMY_X1 is not set -# CONFIG_ATH79_MACH_ONION_OMEGA is not set -# CONFIG_ATH79_MACH_PB42 is not set -# CONFIG_ATH79_MACH_PB44 is not set -# CONFIG_ATH79_MACH_PQI_AIR_PEN is not set -# CONFIG_ATH79_MACH_QIHOO_C301 is not set -# CONFIG_ATH79_MACH_R36A is not set -# CONFIG_ATH79_MACH_R602N is not set -# CONFIG_ATH79_MACH_R6100 is not set -# CONFIG_ATH79_MACH_RAMBUTAN is not set -# CONFIG_ATH79_MACH_RB2011 is not set -# CONFIG_ATH79_MACH_RB4XX is not set -# CONFIG_ATH79_MACH_RB750 is not set -# CONFIG_ATH79_MACH_RB91X is not set -# CONFIG_ATH79_MACH_RB922 is not set -# CONFIG_ATH79_MACH_RB95X is not set -# CONFIG_ATH79_MACH_RBSPI is not set -# CONFIG_ATH79_MACH_RBSXTLITE is not set -# CONFIG_ATH79_MACH_RE355 is not set -# CONFIG_ATH79_MACH_RE450 is not set -# CONFIG_ATH79_MACH_RME_EG200 is not set -# CONFIG_ATH79_MACH_RUT9XX is not set -# CONFIG_ATH79_MACH_RW2458N is not set -# CONFIG_ATH79_MACH_SC1750 is not set -# CONFIG_ATH79_MACH_SC300M is not set -# CONFIG_ATH79_MACH_SC450 is not set -# CONFIG_ATH79_MACH_SMART_300 is not set -# CONFIG_ATH79_MACH_SOM9331 is not set -# CONFIG_ATH79_MACH_SR3200 is not set -# CONFIG_ATH79_MACH_T830 is not set -# CONFIG_ATH79_MACH_TELLSTICK_ZNET_LITE is not set -# CONFIG_ATH79_MACH_TEW_632BRP is not set -# CONFIG_ATH79_MACH_TEW_673GRU is not set -# CONFIG_ATH79_MACH_TEW_712BR is not set -# CONFIG_ATH79_MACH_TEW_732BR is not set -# CONFIG_ATH79_MACH_TEW_823DRU is not set -# CONFIG_ATH79_MACH_TL_MR11U is not set -# CONFIG_ATH79_MACH_TL_MR13U is not set -# CONFIG_ATH79_MACH_TL_MR3020 is not set -# CONFIG_ATH79_MACH_TL_MR3X20 is not set -# CONFIG_ATH79_MACH_TL_MR6400 is not set -# CONFIG_ATH79_MACH_TL_WA701ND_V2 is not set -# CONFIG_ATH79_MACH_TL_WA7210N_V2 is not set -# CONFIG_ATH79_MACH_TL_WA801ND_V3 is not set -# CONFIG_ATH79_MACH_TL_WA830RE_V2 is not set -# CONFIG_ATH79_MACH_TL_WA850RE_V2 is not set -# CONFIG_ATH79_MACH_TL_WA855RE_V1 is not set -# CONFIG_ATH79_MACH_TL_WA901ND is not set -# CONFIG_ATH79_MACH_TL_WA901ND_V2 is not set -# CONFIG_ATH79_MACH_TL_WA901ND_V4 is not set -# CONFIG_ATH79_MACH_TL_WAX50RE is not set -# CONFIG_ATH79_MACH_TL_WDR3320_V2 is not set -# CONFIG_ATH79_MACH_TL_WDR3500 is not set -# CONFIG_ATH79_MACH_TL_WDR4300 is not set -# CONFIG_ATH79_MACH_TL_WDR6500_V2 is not set -# CONFIG_ATH79_MACH_TL_WPA8630 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_V2 is not set -# CONFIG_ATH79_MACH_TL_WR1043ND_V4 is not set -# CONFIG_ATH79_MACH_TL_WR1043N_V5 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 -# CONFIG_ATH79_MACH_TL_WR741ND is not set -# CONFIG_ATH79_MACH_TL_WR741ND_V4 is not set -# CONFIG_ATH79_MACH_TL_WR802N_V1 is not set -# CONFIG_ATH79_MACH_TL_WR802N_V2 is not set -# CONFIG_ATH79_MACH_TL_WR810N is not set -# CONFIG_ATH79_MACH_TL_WR810N_V2 is not set -# CONFIG_ATH79_MACH_TL_WR840N_V2 is not set -# CONFIG_ATH79_MACH_TL_WR841N_V1 is not set -# CONFIG_ATH79_MACH_TL_WR841N_V8 is not set -# CONFIG_ATH79_MACH_TL_WR841N_V9 is not set -# CONFIG_ATH79_MACH_TL_WR902AC_V1 is not set -# CONFIG_ATH79_MACH_TL_WR940N_V4 is not set -# CONFIG_ATH79_MACH_TL_WR941ND is not set -# CONFIG_ATH79_MACH_TL_WR941ND_V6 is not set -# CONFIG_ATH79_MACH_TL_WR942N_V1 is not set -# CONFIG_ATH79_MACH_TS_D084 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 -# CONFIG_ATH79_MACH_UBNT_XM is not set -# CONFIG_ATH79_MACH_WAM250 is not set -# CONFIG_ATH79_MACH_WEIO is not set -# CONFIG_ATH79_MACH_WHR_HP_G300N is not set -# CONFIG_ATH79_MACH_WI2A_AC200I is not set -# CONFIG_ATH79_MACH_WIFI_PINEAPPLE_NANO is not set -# CONFIG_ATH79_MACH_WLAE_AG300N is not set -# CONFIG_ATH79_MACH_WLR8100 is not set -# CONFIG_ATH79_MACH_WNDAP360 is not set -# CONFIG_ATH79_MACH_WNDR3700 is not set -# CONFIG_ATH79_MACH_WNDR4300 is not set -# CONFIG_ATH79_MACH_WNR2000 is not set -# CONFIG_ATH79_MACH_WNR2000_V3 is not set -# CONFIG_ATH79_MACH_WNR2000_V4 is not set -# CONFIG_ATH79_MACH_WNR2200 is not set -# CONFIG_ATH79_MACH_WP543 is not set -# CONFIG_ATH79_MACH_WPE72 is not set -# CONFIG_ATH79_MACH_WPJ342 is not set -# CONFIG_ATH79_MACH_WPJ344 is not set -# CONFIG_ATH79_MACH_WPJ531 is not set -# CONFIG_ATH79_MACH_WPJ558 is not set -# CONFIG_ATH79_MACH_WPJ563 is not set -# CONFIG_ATH79_MACH_WRT160NL is not set -# CONFIG_ATH79_MACH_WRT400N is not set -# CONFIG_ATH79_MACH_WRTNODE2Q is not set -# CONFIG_ATH79_MACH_WZR_450HP2 is not set -# CONFIG_ATH79_MACH_WZR_HP_AG300H is not set -# CONFIG_ATH79_MACH_WZR_HP_G300NH is not set -# CONFIG_ATH79_MACH_WZR_HP_G300NH2 is not set -# CONFIG_ATH79_MACH_WZR_HP_G450H is not set -# CONFIG_ATH79_MACH_XD3200 is not set -# CONFIG_ATH79_MACH_Z1 is not set -# CONFIG_ATH79_MACH_ZBT_WE1526 is not set -# CONFIG_ATH79_MACH_ZCN_1523H is not set -# CONFIG_ATH79_NVRAM is not set -# CONFIG_ATH79_PCI_ATH9K_FIXUP is not set -# CONFIG_ATH79_ROUTERBOOT is not set -CONFIG_ATH79_WDT=y -CONFIG_CEVT_R4K=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="rootfstype=squashfs noinitrd" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -CONFIG_COMMON_CLK=y -# CONFIG_COMMON_CLK_BOSTON is not set -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_RIXI=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_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_EARLY_PRINTK=y -CONFIG_ETHERNET_PACKET_MANGLE=y -CONFIG_FIXED_PHY=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_74X164=y -CONFIG_GPIO_ATH79=y -CONFIG_GPIO_GENERIC=y -# CONFIG_GPIO_LATCH is not set -CONFIG_GPIO_NXP_74HC153=y -CONFIG_GPIO_PCF857X=y -CONFIG_GPIO_SYSFS=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -# CONFIG_HAVE_ARCH_BITREVERSE is not set -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_CBPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_KVM=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HZ_PERIODIC=y -CONFIG_I2C=y -CONFIG_I2C_ALGOBIT=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_GPIO=y -CONFIG_IMAGE_CMDLINE_HACK=y -CONFIG_INITRAMFS_ROOT_GID=0 -CONFIG_INITRAMFS_ROOT_UID=0 -CONFIG_INITRAMFS_SOURCE="../../root" -CONFIG_INTEL_XWAY_PHY=y -CONFIG_IP17XX_PHY=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MIPS_CPU=y -CONFIG_IRQ_WORK=y -CONFIG_LEDS_GPIO=y -CONFIG_MARVELL_PHY=y -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_BOARDINFO=y -CONFIG_MDIO_GPIO=y -CONFIG_MICREL_PHY=y -CONFIG_MIPS=y -CONFIG_MIPS_ASID_BITS=8 -CONFIG_MIPS_ASID_SHIFT=0 -CONFIG_MIPS_CLOCK_VSYSCALL=y -# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set -CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y -# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_MIPS_MACHINE=y -CONFIG_MIPS_SPRAM=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_GEOMETRY=y -# CONFIG_MTD_CFI_I2 is not set -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_CYBERTAN_PARTS=y -CONFIG_MTD_M25P80=y -# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set -CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_PHYSMAP=y -CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPLIT_EVA_FW=y -CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_LZMA_FW=y -CONFIG_MTD_SPLIT_MINOR_FW=y -CONFIG_MTD_SPLIT_SEAMA_FW=y -CONFIG_MTD_SPLIT_TPLINK_FW=y -CONFIG_MTD_SPLIT_UIMAGE_FW=y -CONFIG_MTD_SPLIT_WRGG_FW=y -CONFIG_MTD_TPLINK_PARTS=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_MV88E6060=y -CONFIG_NET_DSA_MV88E6063=y -CONFIG_NET_DSA_TAG_TRAILER=y -CONFIG_NET_SWITCHDEV=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -# CONFIG_NO_IOPORT_MAP is not set -# CONFIG_OF is not set -# CONFIG_PCI_AR724X is not set -CONFIG_PCI_DRIVERS_LEGACY=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_RATIONAL=y -# CONFIG_RCU_STALL_COMMON is not set -CONFIG_RTL8306_PHY=y -CONFIG_RTL8366RB_PHY=y -CONFIG_RTL8366S_PHY=y -CONFIG_RTL8366_SMI=y -CONFIG_RTL8367_PHY=y -# CONFIG_SCHED_INFO is not set -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250_FSL is not set -CONFIG_SERIAL_8250_NR_UARTS=1 -CONFIG_SERIAL_8250_RUNTIME_UARTS=1 -# CONFIG_SOC_AR71XX is not set -# CONFIG_SOC_AR724X is not set -# CONFIG_SOC_AR913X is not set -# CONFIG_SOC_AR933X is not set -# CONFIG_SOC_AR934X is not set -# CONFIG_SOC_QCA953X is not set -# CONFIG_SOC_QCA955X is not set -# CONFIG_SOC_QCA956X is not set -CONFIG_SPI=y -CONFIG_SPI_ATH79=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -CONFIG_SPI_MASTER=y -# CONFIG_SPI_RB4XX is not set -# CONFIG_SPI_VSC7385 is not set -CONFIG_SRCU=y -CONFIG_SWCONFIG=y -CONFIG_SWCONFIG_LEDS=y -CONFIG_SWPHY=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_HAS_CPU_MIPS32_R2=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_SYS_SUPPORTS_MIPS16=y -CONFIG_SYS_SUPPORTS_ZBOOT=y -CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_USB_SUPPORT=y diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9 index 554a140b9..8aa0b41ae 100644 --- a/target/linux/ar71xx/config-4.9 +++ b/target/linux/ar71xx/config-4.9 @@ -29,7 +29,6 @@ CONFIG_ATH79=y # CONFIG_ATH79_DEV_SPI is not set # CONFIG_ATH79_DEV_USB is not set # CONFIG_ATH79_MACH_A60 is not set -# CONFIG_ATH79_MACH_AC9531 is not set # CONFIG_ATH79_MACH_ALFA_AP120C is not set # CONFIG_ATH79_MACH_ALFA_AP96 is not set # CONFIG_ATH79_MACH_ALFA_NX is not set @@ -102,7 +101,10 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_DRAGINO2 is not set # CONFIG_ATH79_MACH_E1700AC_V2 is not set # CONFIG_ATH79_MACH_E2100L is not set +# CONFIG_ATH79_MACH_E558_V2 is not set # CONFIG_ATH79_MACH_E600G_V2 is not set +# CONFIG_ATH79_MACH_E750A_V4 is not set +# CONFIG_ATH79_MACH_E750G_V8 is not set # CONFIG_ATH79_MACH_EAP120 is not set # CONFIG_ATH79_MACH_EAP300V2 is not set # CONFIG_ATH79_MACH_EAP7660D is not set @@ -117,11 +119,11 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_F9K1115V2 is not set # CONFIG_ATH79_MACH_FRITZ300E is not set # CONFIG_ATH79_MACH_FRITZ4020 is not set +# CONFIG_ATH79_MACH_FRITZ450E is not set # CONFIG_ATH79_MACH_GL_AR150 is not set # CONFIG_ATH79_MACH_GL_AR300 is not set # CONFIG_ATH79_MACH_GL_AR300M is not set # CONFIG_ATH79_MACH_GL_AR750 is not set -# CONFIG_ATH79_MACH_GL_AR750S is not set # CONFIG_ATH79_MACH_GL_DOMINO is not set # CONFIG_ATH79_MACH_GL_INET is not set # CONFIG_ATH79_MACH_GL_MIFI is not set @@ -135,7 +137,6 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_JWAP003 is not set # CONFIG_ATH79_MACH_JWAP230 is not set # CONFIG_ATH79_MACH_KOALA is not set -# CONFIG_ATH79_MACH_K2T is not set # CONFIG_ATH79_MACH_LAN_TURTLE is not set # CONFIG_ATH79_MACH_LIMA is not set # CONFIG_ATH79_MACH_MC_MAC1200R is not set @@ -213,7 +214,6 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_TL_WDR3500 is not set # CONFIG_ATH79_MACH_TL_WDR4300 is not set # CONFIG_ATH79_MACH_TL_WDR6500_V2 is not set -# CONFIG_ATH79_MACH_TL_WDX6501_V7 is not set # CONFIG_ATH79_MACH_TL_WPA8630 is not set # CONFIG_ATH79_MACH_TL_WR1041N_V2 is not set # CONFIG_ATH79_MACH_TL_WR1043ND is not set diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files-4.14/arch/mips/ath79/Kconfig.openwrt deleted file mode 100644 index 99726691f..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/Kconfig.openwrt +++ /dev/null @@ -1,2399 +0,0 @@ -config ATH79_MACH_A60 - bool "OpenMesh A40/A60 board support" - select SOC_QCA955X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - select ATH79_DEV_USB - -config ATH79_MACH_WI2A_AC200I - bool "Nokia WI2A-AC200i support" - select SOC_QCA955X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_NFC - select ATH79_DEV_WMAC - select ATH79_DEV_USB - -config ATH79_MACH_ALFA_AP120C - bool "ALFA Network AP120C board support" - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - -config ATH79_MACH_AP121F - bool "ALFA Network AP121F support" - select SOC_AR933X - 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_ALFA_AP96 - bool "ALFA Network AP96 board support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - -config ATH79_MACH_HORNET_UB - bool "ALFA Network Hornet-UB board support" - select SOC_AR933X - 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_ALFA_NX - bool "ALFA Network N2/N5 board support" - select SOC_AR724X - 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 - -config ATH79_MACH_TUBE2H - bool "ALFA Network Tube2H board support" - select SOC_AR933X - 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_SC1750 - bool "Abicom SC1750 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_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_SC300M - bool "Abicom SC300M 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_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_SC450 - bool "Abicom SC450 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_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_ALL0258N - bool "Allnet ALL0258N support" - select SOC_AR724X - 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 - -config ATH79_MACH_ALL0315N - bool "Allnet ALL0315N support" - select SOC_AR724X - 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 - -config ATH79_MACH_ANTMINER_S1 - bool "Bitmain Antminer S1 support" - select SOC_AR933X - 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_ANTMINER_S3 - bool "Bitmain Antminer S3 support" - select SOC_AR933X - 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_ANTROUTER_R1 - bool "Bitmain Antrouter R1 support" - select SOC_AR933X - 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_ARDUINO_YUN - bool "Arduino Yun" - select SOC_AR933X - 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_AP132 - bool "Atheros AP132 reference board" - select SOC_QCA955X - 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_AP143 - bool "Atheros AP143 reference board" - select SOC_QCA953X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_SPI - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_DEV_ETH - select ATH79_DEV_M25P80 - -config ATH79_MACH_AP147 - bool "Atheros AP147 reference board" - select SOC_QCA953X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_DEV_AP9X_PCI if PCI - -config ATH79_MACH_AP152 - bool "Atheros AP152 reference board" - select SOC_QCA956X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_DEV_AP9X_PCI if PCI - -config ATH79_MACH_AP531B0 - bool "Rockeetech AP531B0 support" - select SOC_QCA953X - 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_SPI - select ATH79_DEV_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_AP90Q - bool "YunCore AP80Q/AP90Q support" - select SOC_QCA953X - 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_AP91_5G - bool "ALFA Network AP91-5G support" - select SOC_AR724X - 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 - -config ATH79_MACH_AP96 - bool "Atheros AP96 board support" - select SOC_AR71XX - 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 - -config ATH79_MACH_PB42 - bool "Atheros PB42 board support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_M25P80 - -config ATH79_MACH_C55 - bool "AirTight Networks C-55 support" - select SOC_AR934X - 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_C60 - bool "AirTight Networks C-60 support" - select SOC_AR934X - 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 - select ATH79_DEV_NFC - select ATH79_DEV_USB - -config ATH79_MACH_AW_NR580 - bool "AzureWave AW-NR580 board support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - -config ATH79_MACH_F9K1115V2 - bool "Belkin AC1750DB board support" - select SOC_QCA955X - 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_EPG5000 - bool "EnGenius EPG5000 board support" - select SOC_QCA955X - 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_ESR1750 - bool "EnGenius ESR1750 board support" - select SOC_QCA955X - 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_PQI_AIR_PEN - bool "PQI Air Pen" - select SOC_AR933X - 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_SOM9331 - bool "SOM9331 support" - select SOC_AR933X - 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_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 - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - -config ATH79_MACH_WHR_HP_G300N - bool "Buffalo WHR-HP-G300N board support" - select SOC_AR724X - 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 - -config ATH79_MACH_WLAE_AG300N - bool "Buffalo WLAE-AG300N board support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - -config ATH79_MACH_WLR8100 - bool "Sitecom WLR-8100 board support" - select SOC_QCA955X - 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_WZR_HP_AG300H - bool "Buffalo WZR-HP-AG300H board support" - select SOC_AR71XX - 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 - -config ATH79_MACH_WZR_HP_G300NH - bool "Buffalo WZR-HP-G300NH board support" - select SOC_AR913X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select RTL8366_SMI - -config ATH79_MACH_WZR_HP_G300NH2 - bool "Buffalo WZR-HP-G300NH2 board support" - select SOC_AR724X - 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 - -config ATH79_MACH_WZR_HP_G450H - bool "Buffalo WZR-HP-G450H board support" - select SOC_AR724X - select ATH79_DEV_ETH - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - -config ATH79_MACH_WZR_450HP2 - bool "Buffalo WZR-450HP2 board support" - select SOC_QCA955X - 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_WP543 - bool "Compex WP543/WPJ543 board support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select MYLOADER - -config ATH79_MACH_WPE72 - bool "Compex WPE72/WPE72NX board support" - select SOC_AR724X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select MYLOADER - -config ATH79_MACH_WPJ342 - bool "Compex WPJ342 board support" - select SOC_AR934X - 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_WPJ344 - bool "Compex WPJ344 board support" - select SOC_AR934X - 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_WPJ531 - bool "Compex WPJ531 board support" - select SOC_QCA953X - 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_WPJ558 - bool "Compex WPJ558 board support" - select SOC_QCA955X - 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_WPJ563 - bool "Compex WPJ563 board 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_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 - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - select ATH79_DEV_USB - -config ATH79_MACH_DHP_1565_A1 - bool "D-Link DHP-1565 rev. A1 board support" - select SOC_AR934X - 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_DIR_505_A1 - bool "D-Link DIR-505-A1 support" - select SOC_AR933X - 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_DIR_600_A1 - bool "D-Link DIR-600 A1/DIR-615 E1/DIR-615 E4 support" - select SOC_AR724X - 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_NVRAM - -config ATH79_MACH_DIR_615_C1 - bool "D-Link DIR-615 rev. C1 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_WMAC - select ATH79_NVRAM - -config ATH79_MACH_DIR_615_I1 - bool "D-Link DIR-615 rev. I1 support" - select SOC_AR934X - 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_DIR_825_B1 - bool "D-Link DIR-825 rev. B1 board support" - select SOC_AR71XX - 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 - -config ATH79_MACH_DIR_825_C1 - bool "D-Link DIR-825 rev. C1/DIR-835 rev. A1 board support" - select SOC_AR934X - 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_DIR_869_A1 - bool "D-Link DIR-869 rev. A1" - 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 - select ATH79_NVRAM - -config ATH79_MACH_DLAN_HOTSPOT - bool "devolo dLAN Hotspot support" - select SOC_AR933X - 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_DLAN_PRO_500_WP - bool "devolo dLAN pro 500 Wireless+ support" - select SOC_AR934X - 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_WMAC - select ATH79_DEV_USB - -config ATH79_MACH_DLAN_PRO_1200_AC - bool "devolo dLAN pro 1200+ WiFi ac support" - select SOC_AR934X - select ATH79_DEV_AP9X_PCI if PCI - 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_WMAC - select ATH79_DEV_NFC - select ATH79_DEV_USB - -config ATH79_MACH_DOMYWIFI_DW33D - bool "DomyWifi DW33D 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_NFC - select ATH79_DEV_WMAC - select ATH79_DEV_USB - -config ATH79_MACH_DR342 - bool "Wallys DR342 board support" - select SOC_AR934X - 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_DR344 - bool "Wallys DR344 board support" - select SOC_AR934X - 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_DR531 - bool "Wallys DR531 board support" - select SOC_QCA953X - 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_DRAGINO2 - bool "DRAGINO V2 support" - select SOC_AR933X - select ATH79_DEV_M25P80 - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_WMAC - select ATH79_DEV_ETH - select ATH79_DEV_USB - -config ATH79_MACH_E1700AC_V2 - bool "Qxwlan E1700AC v2 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_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_E600G_V2 - bool "Qxwlan E600G/E600GAC v2 support" - select SOC_QCA953X - 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_ESR900 - bool "EnGenius ESR900 board support" - select SOC_QCA955X - 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_EW_BALIN - bool "embedded wireless Balin Platform support" - select SOC_AR934X - select ATH79_DEV_M25P80 - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_WMAC - select ATH79_DEV_ETH - select ATH79_DEV_USB - select ATH79_DEV_AP9X_PCI if PCI - -config ATH79_MACH_EW_DORIN - bool "embedded wireless Dorin Platform support" - select SOC_AR933X - select ATH79_DEV_M25P80 - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_WMAC - select ATH79_DEV_ETH - -config ATH79_MACH_EL_M150 - bool "EasyLink EL-M150 support" - select SOC_AR933X - 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_EL_MINI - bool "EasyLink EL-MINI support" - select SOC_AR933X - 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_GL_AR150 - bool "GL AR150 support" - select SOC_AR933X - 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_GL_AR300 - bool "GL_AR300 support" - select SOC_AR934X - 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_GL_AR300M - bool "GL_AR300M support" - select SOC_QCA953X - 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_GL_AR750 - bool "GL.iNet GL-AR750 support" - select SOC_QCA953X - 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_GL_AR750S - bool "GL.iNet GL-AR750S 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_GL_DOMINO - bool "DOMINO support" - select SOC_AR933X - 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_GL_MIFI - bool "GL MIFI support" - select SOC_AR933X - 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_GL_INET - bool "GL-INET support" - select SOC_AR933X - 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_GL_USB150 - bool "GL.iNet GL-USB150 support" - select SOC_AR933X - 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_EAP120 - bool "TP-LINK EAP120 support" - select SOC_AR934X - 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_ENS202EXT - bool "EnGenius ENS202EXT support" - select SOC_AR934X - 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_EAP300V2 - bool "EnGenius EAP300 v2 support" - select SOC_AR934X - 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_GS_OOLITE_V1 - bool "GainStrong Oolite/Minibox V1.0 support" - select SOC_AR933X - select ARH79_DEV_ETH - select ARH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_GS_OOLITE_V5_2 - bool "GainStrong Oolite V5.2 support" - select SOC_QCA953X - 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_HIVEAP_121 - bool "Aerohive HiveAP-121 support" - select SOC_AR934X - 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_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_HIWIFI_HC6361 - bool "HiWiFi HC6361 board support" - select SOC_AR933X - 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_JA76PF - bool "jjPlus JA76PF board support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - -config ATH79_MACH_JWAP003 - bool "jjPlus JWAP003 board support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - -config ATH79_MACH_JWAP230 - bool "jjPlus JWAP230 board support" - select SOC_QCA955X - select ATH79_DEV_ETH - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_KOALA - bool "OCEDO Koala board support" - select SOC_QCA955X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_ETH - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - -config ATH79_MACH_K2T - bool "Phicomm K2T A1/A2/A3 board" - select SOC_QCA956X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_DEV_AP9X_PCI if PCI - -config ATH79_MACH_WAM250 - bool "Samsung WAM250 support" - select SOC_AR934X - 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_WIFI_PINEAPPLE_NANO - bool "Hak5 WiFi Pineapple NANO support" - select SOC_AR933X - 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_WRT160NL - bool "Linksys WRT160NL 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_WRT400N - bool "Linksys WRT400N board support" - select SOC_AR71XX - 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 - -config ATH79_MACH_WRTNODE2Q - bool "WRTnode2Q board support" - select SOC_QCA953X - 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_R36A - bool "ALFA Network R36A support" - select SOC_QCA953X - 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_R602N - bool "P&W R602N support" - select SOC_QCA953X - 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_R6100 - bool "NETGEAR R6100 board support" - select SOC_AR934X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_MC_MAC1200R - bool "MERCURY MAC1200R board support" - select SOC_AR934X - 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_RB4XX - bool "MikroTik RouterBOARD 4xx series support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_USB - -config ATH79_MACH_RB750 - bool "MikroTik RouterBOARD 750 support" - select SOC_AR724X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_USB - select ATH79_ROUTERBOOT - -config ATH79_MACH_RB91X - bool "MikroTik RouterBOARD 91X support" - select SOC_AR934X - select ATH79_DEV_ETH - select ATH79_DEV_SPI - select ATH79_DEV_WMAC - select ATH79_DEV_USB - select ATH79_ROUTERBOOT - -config ATH79_MACH_RB922 - bool "MikroTik RouterBOARD 922 support" - select SOC_QCA955X - select ATH79_DEV_ETH - select ATH79_DEV_M25P80 - select ATH79_DEV_NFC - select ATH79_DEV_USB - select ATH79_ROUTERBOOT - select RLE_DECOMPRESS - -config ATH79_MACH_RB95X - bool "MikroTik RouterBOARD 95X support" - select SOC_AR934X - select ATH79_DEV_ETH - select ATH79_DEV_NFC - select ATH79_DEV_WMAC - select ATH79_DEV_USB - select ATH79_ROUTERBOOT - -config ATH79_MACH_RB2011 - bool "MikroTik RouterBOARD 2011 support" - select SOC_AR934X - select ATH79_DEV_ETH - select ATH79_DEV_M25P80 - select ATH79_DEV_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_ROUTERBOOT - -config ATH79_MACH_RBSPI - bool "MikroTik RouterBOARD SPI-NOR support" - select SOC_AR934X - select SOC_QCA953X - select SOC_QCA955X - 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_ROUTERBOOT - help - Say 'Y' here if you want your kernel to support the - MikroTik ROuterBOARD 911-2Hn (911 Lite2) - MikroTik ROuterBOARD 911-5Hn (911 Lite5) - MikroTik RouterBOARD mAP - MikroTik RouterBOARD mAP lite - MikroTik RouterBOARD hAP lite - MikroTik RouterBOARD hAP - MikroTik RouterBOARD hAP ac - MikroTik RouterBOARD hAP ac lite - MikroTik RouterBOARD hEX PoE lite - MikroTik RouterBOARD hEX lite - MikroTik RouterBOARD Powerbox - MikroTik RouterBOARD LHG 5 - MikroTik RouterBOARD cAP (EXPERIMENTAL) - MikroTik RouterBOARD wAP - -config ATH79_MACH_RBSXTLITE - bool "MikroTik RouterBOARD SXT Lite" - select SOC_AR934X - select ATH79_DEV_ETH - select ATH79_DEV_NFC - select ATH79_DEV_WMAC - select ATH79_ROUTERBOOT - -config ATH79_MACH_SMART_300 - bool "NC-LINK SMART-300 board support" - select SOC_AR934X - 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_T830 - bool "YunCore T830 support" - select SOC_QCA953X - select ARH79_DEV_ETH - select ARH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_TELLSTICK_ZNET_LITE - bool "TellStick ZNet Lite" - select SOC_AR933X - 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_WNDAP360 - bool "NETGEAR WNDAP360 board support" - select SOC_AR71XX - 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 - -config ATH79_MACH_WNDR3700 - bool "NETGEAR WNDR3700 board support" - select SOC_AR71XX - 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 - -config ATH79_MACH_WNDR4300 - bool "NETGEAR WNDR3700v4/WNDR4300 board support" - select SOC_AR934X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_WNR2000 - bool "NETGEAR WNR2000 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_WMAC - -config ATH79_MACH_WNR2000_V3 - bool "NETGEAR WNR2000 V3/WNR612 v2/WNR1000 v2/WPN824N board support" - select SOC_AR724X - 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 - -config ATH79_MACH_WNR2200 - bool "NETGEAR WNR2200 board support" - select SOC_AR724X - 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 - -config ATH79_MACH_WNR2000_V4 - bool "NETGEAR WNR2000 V4" - select SOC_AR934X - 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_OM2P - bool "OpenMesh OM2P board support" - select SOC_AR724X - select SOC_AR933X - select SOC_QCA953X - 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_OM5P - bool "OpenMesh OM5P board support" - select SOC_AR934X - 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_OM5P_AC - bool "OpenMesh OM5P-AC board support" - select SOC_QCA955X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - -config ATH79_MACH_OM5P_ACv2 - bool "OpenMesh OM5P-ACv2 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_OMY_G1 - bool "OMYlink OMY G1 support" - select SOC_AR934X - 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_OMY_X1 - bool "OMYlink OMY X1 support" - select SOC_AR934X - 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_ONION_OMEGA - bool "ONION OMEGA support" - select SOC_AR933X - 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_MR12 - bool "Meraki MR12 board support" - select SOC_AR724X - 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_MR16 - bool "Meraki MR16 board support" - select SOC_AR71XX - 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_MR18 - bool "Meraki MR18 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_NFC - select ATH79_DEV_WMAC - select LEDS_NU801 - -config ATH79_MACH_MR600 - bool "OpenMesh MR600 board support" - select SOC_AR934X - 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_MZK_W04NU - bool "Planex MZK-W04NU 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 - -config ATH79_MACH_MZK_W300NH - bool "Planex MZK-W300NH 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_WMAC - -config ATH79_MACH_RE355 - bool "TP-LINK RE355 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_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_RME_EG200 - bool "eTactica EG200 board supprt" - select SOC_AR933X - 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_RUT9XX - bool "Teltonika RUT900 series support" - select SOC_AR934X - 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 GPIO_PCA953X - -config ATH79_MACH_RW2458N - bool "Redwave RW2458N board support" - select SOC_AR724X - 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 - -config ATH79_MACH_CAP324 - bool "PowerCloud CAP324 support" - select SOC_AR934X - 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_CAP4200AG - bool "Senao CAP4200AG support" - select SOC_AR934X - 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_CR3000 - bool "PowerCloud CR3000 support" - select SOC_AR934X - 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_CR5000 - bool "PowerCloud CR5000 support" - select SOC_AR934X - 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_MR1750 - bool "OpenMesh MR1750 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_MR900 - bool "OpenMesh MR900 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_EAP7660D - bool "Senao EAP7660D support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - -config ATH79_MACH_BSB - bool "Smart Electronics Black Swift board" - select SOC_AR933X - 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_ARCHER_C25_V1 - bool "TP-LINK Archer C25 v1 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_ARCHER_C58_V1 - bool "TP-LINK Archer C58 v1 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_ARCHER_C59_V1 - bool "TP-LINK Archer C59 v1 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_ARCHER_C60_V1 - bool "TP-LINK Archer C60 v1 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_ARCHER_C60_V2 - bool "TP-LINK Archer C60 v2 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_ARCHER_C7 - bool "TP-LINK Archer C5/C7/TL-WDR4900 v2 board support" - select SOC_QCA955X - 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_CPE505N - bool "P&W CPE505N support" - select SOC_QCA953X - 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_CPE510 - bool "TP-LINK CPE510 support" - select SOC_AR934X - 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_CPE830 - bool "YunCore CPE830 support" - select SOC_QCA953X - 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_CPE870 - bool "YunCore CPE870 support" - select SOC_AR934X - 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_MR11U - bool "TP-LINK TL-MR11U/TL-MR3040 support" - select SOC_AR933X - 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_MR13U - bool "TP-LINK TL-MR13U support" - select SOC_AR933X - 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_MR3020 - bool "TP-LINK TL-MR3020 support" - select SOC_AR933X - 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_MR3X20 - bool "TP-LINK TL-MR3220/3420 support" - select SOC_AR724X - 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 - -config ATH79_MACH_TL_MR6400 - bool "TP-LINK TL-MR6400 support" - select SOC_QCA953X - 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_WAX50RE - bool "TP-LINK TL-WA750/850RE support" - select SOC_AR934X - 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_WA701ND_V2 - bool "TP-LINK TL-WA701ND v2 support" - select SOC_AR933X - 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_WA7210N_V2 - bool "TP-LINK TL-WA7210N v2 support" - select SOC_AR724X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - -config ATH79_MACH_TL_WA801ND_V3 - bool "TP-LINK TL-WA801ND v3 support" - select SOC_QCA953X - 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_WA830RE_V2 - bool "TP-LINK TL-WA830RE v2 support" - select SOC_AR934X - 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_WA850RE_V2 - bool "TP-LINK TL-WA850RE v2 support" - select SOC_QCA953X - 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_WA855RE_V1 - bool "TP-LINK TL-WA855RE V1 support" - select SOC_QCA953X - 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_WA901ND - bool "TP-LINK TL-WA901ND/TL-WA7510N support" - select SOC_AR724X - 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 - -config ATH79_MACH_TL_WA901ND_V2 - bool "TP-LINK TL-WA901ND v2 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_WMAC - -config ATH79_MACH_TL_WA901ND_V4 - bool "TP-LINK TL-WA901ND 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_WDR3320_V2 - bool "TP-LINK TL-WDR3320 v2 board support" - select SOC_AR934X - 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_WDR3500 - bool "TP-LINK TL-WDR3500 board support" - select SOC_AR934X - 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_WDR4300 - bool "TP-LINK TL-WDR3600/4300/4310 board support" - select SOC_AR934X - 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_WDR6500_V2 - bool "TP-LINK TL-WDR6500 v2 board 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_WR703N - bool "TP-LINK TL-WR703N/TL-WR710N/TL-MR10U support" - select SOC_AR933X - 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_WR720N_V3 - bool "TP-LINK TL-WR720N v3/v4 support" - select SOC_AR933X - 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_WR741ND - bool "TP-LINK TL-WR741ND support" - select SOC_AR724X - 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 - -config ATH79_MACH_TL_WR741ND_V4 - bool "TP-LINK TL-WR741ND v4/TL-MR3220 v2 support" - select SOC_AR933X - 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_WR802N_V1 - bool "TP-LINK TL-WR802N v1 support" - select SOC_QCA953X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - -config ATH79_MACH_TL_WR802N_V2 - bool "TP-LINK TL-WR802N v2 support" - select SOC_QCA953X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - -config ATH79_MACH_TL_WR810N - bool "TP-LINK TL-WR810N support" - select SOC_QCA953X - 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_WR810N_V2 - bool "TP-LINK TL-WR810N v2 support" - select SOC_QCA953X - 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_WR840N_V2 - bool "TP-LINK TL-WR840N v2/v3 support" - select SOC_QCA953X - 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_WR841N_V1 - bool "TP-LINK TL-WR841N v1 support" - select SOC_AR71XX - select ATH79_DEV_DSA - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - -config ATH79_MACH_TL_WR841N_V8 - bool "TP-LINK TL-WR841N/ND v8/TL-MR3420 v2 support" - select SOC_AR934X - 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_WR841N_V9 - bool "TP-LINK TL-WR841N/ND v9/TL-WR842N/ND v3/TL-WR740N/ND v6 support" - select SOC_QCA953X - 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_WR902AC_V1 - bool "TP-LINK TL-WR902AC v1 support" - select SOC_QCA953X - 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_WR941ND - bool "TP-LINK TL-WR941ND support" - select SOC_AR913X - select ATH79_DEV_DSA - 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_WR941ND_V6 - bool "TP-LINK TL-WR941ND v6 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_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_WR942N_V1 - bool "TP-LINK TL-WR942N v1 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_USB - select ATH79_DEV_WMAC - select ATH79_NVRAM - -config ATH79_MACH_TL_WR1041N_V2 - bool "TP-LINK TL-WR1041N v2 support" - select SOC_AR934X - 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_WR1043N_V5 - bool "TP-LINK TL-WR1043N v5 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_WR1043ND - bool "TP-LINK TL-WR1043ND 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 - -config ATH79_MACH_TL_WR1043ND_V2 - bool "TP-LINK TL-WR1043ND v2 support" - select SOC_QCA955X - 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_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 - 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 - -config ATH79_MACH_TS_D084 - bool "PISEN TS-D084 support" - select SOC_AR933X - 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_TEW_632BRP - bool "TRENDnet TEW-632BRP 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_WMAC - select ATH79_NVRAM - -config ATH79_MACH_TEW_673GRU - bool "TRENDnet TEW-673GRU support" - select SOC_AR71XX - 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 - -config ATH79_MACH_TEW_712BR - bool "TRENDnet TEW-712BR support" - select SOC_AR933X - 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_TEW_732BR - bool "TRENDnet TEW-732BR support" - select SOC_AR934X - 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_TEW_823DRU - bool "TRENDnet TEW-823DRU support" - select SOC_QCA955X - 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_UBNT - bool "Ubiquiti AR71xx based boards support" - select SOC_AR71XX - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - -config ATH79_MACH_UBNT_UNIFIAC - bool "Ubiquiti UniFi AC (LITE/LR/MESH/PRO) 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 - select ATH79_DEV_USB - -config ATH79_MACH_WEIO - bool "WeIO board" - select SOC_AR933X - 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_MYNET_N600 - bool "WD My Net N600 board support" - select SOC_AR934X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - select ATH79_NVRAM - -config ATH79_MACH_MYNET_N750 - bool "WD My Net N750 board support" - select SOC_AR934X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - select ATH79_NVRAM - -config ATH79_MACH_MYNET_REXT - bool "WD My Net Wi-Fi Range Extender board support" - select SOC_AR934X - 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 - select ATH79_NVRAM - -config ATH79_MACH_Z1 - bool "Meraki Z1 board support" - select SOC_AR934X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select LEDS_NU801 - -config ATH79_MACH_ZBT_WE1526 - bool "Zbtlink ZBT-WE1526 board support" - select SOC_QCA953X - 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_ZCN_1523H - bool "Zcomax ZCN-1523H support" - select SOC_AR724X - 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 - -config ATH79_MACH_N5Q - bool "ALFA Network N5Q support" - select SOC_AR934X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_WMAC - -config ATH79_MACH_NBG460N - bool "Zyxel NBG460N/550N/550NH 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_WMAC - -config ATH79_MACH_NBG6716 - bool "Zyxel NBG6616/NBG6716 board support" - select SOC_QCA955X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_NVRAM - -config ATH79_MACH_CARAMBOLA2 - bool "8devices Carambola2 board" - select SOC_AR933X - 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_LAN_TURTLE - bool "Hak5 LAN Turtle and Packet Squirrel support" - select SOC_AR933X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - -config ATH79_MACH_LIMA - bool "8devices Lima board" - select SOC_QCA953X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_M25P80 - select ATH79_DEV_SPI - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_DEV_ETH - -config ATH79_MACH_RAMBUTAN - bool "8devices Rambutan board" - select SOC_QCA955X - select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_CF_E316N_V2 - bool "COMFAST CF-E316N v2 support" - select SOC_AR934X - 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_CF_E320N_V2 - bool "COMFAST CF-E320N v2 support" - select SOC_QCA953X - 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_CF_E355AC - bool "COMFAST CF-E355AC v1/v2 support" - select SOC_QCA953X - 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_CF_E375AC - bool "COMFAST CF-E375AC 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_CF_E380AC_V1 - bool "COMFAST CF-E380AC v1 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_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_CF_E380AC_V2 - bool "COMFAST CF-E380AC v2 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_USB - select ATH79_DEV_WMAC - -config ATH79_MACH_CF_E520N - bool "COMFAST CF-E520N support" - select SOC_QCA953X - 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_CF_E530N - bool "COMFAST CF-E530N support" - select SOC_QCA953X - 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_BHU_BXU2000N2_A - bool "BHU BXU2000n-2 rev. A support" - select SOC_AR934X - 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_QIHOO_C301 - bool "Qihoo 360 C301 board support" - select SOC_AR934X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - select ATH79_DEV_USB - select ATH79_NVRAM - -config ATH79_MACH_DAP_1330_A1 - bool "D-Link DAP-1330 rev. A1 support" - select SOC_QCA953X - 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_DAP_2695_A1 - bool "D-Link DAP-2695 rev. A1 support" - select SOC_QCA955X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_WMAC - select ATH79_NVRAM - -config ATH79_MACH_TL_WPA8630 - bool "TP-Link TL-WPA8630 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_FRITZ300E - bool "AVM FRITZ!WLAN Repeater 300E support" - select SOC_AR724X - 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 - -config ATH79_MACH_FRITZ4020 - bool "AVM FRITZ!Box 4020 support" - select SOC_QCA956X - select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_USB - select ATH79_DEV_M25P80 diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-eth.c deleted file mode 100644 index b46bab788..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-eth.c +++ /dev/null @@ -1,1248 +0,0 @@ -/* - * Atheros AR71xx SoC platform devices - * - * Copyright (C) 2010-2011 Jaiganesh Narayanan - * Copyright (C) 2008-2012 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Parts of this file are based on Atheros 2.6.15 BSP - * Parts of this file are based on Atheros 2.6.31 BSP - * - * 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 "common.h" -#include "dev-eth.h" - -unsigned char ath79_mac_base[ETH_ALEN] __initdata; - -static struct resource ath79_mdio0_resources[] = { - { - .name = "mdio_base", - .flags = IORESOURCE_MEM, - .start = AR71XX_GE0_BASE, - .end = AR71XX_GE0_BASE + 0x200 - 1, - } -}; - -struct ag71xx_mdio_platform_data ath79_mdio0_data; - -struct platform_device ath79_mdio0_device = { - .name = "ag71xx-mdio", - .id = 0, - .resource = ath79_mdio0_resources, - .num_resources = ARRAY_SIZE(ath79_mdio0_resources), - .dev = { - .platform_data = &ath79_mdio0_data, - }, -}; - -static struct resource ath79_mdio1_resources[] = { - { - .name = "mdio_base", - .flags = IORESOURCE_MEM, - .start = AR71XX_GE1_BASE, - .end = AR71XX_GE1_BASE + 0x200 - 1, - } -}; - -struct ag71xx_mdio_platform_data ath79_mdio1_data; - -struct platform_device ath79_mdio1_device = { - .name = "ag71xx-mdio", - .id = 1, - .resource = ath79_mdio1_resources, - .num_resources = ARRAY_SIZE(ath79_mdio1_resources), - .dev = { - .platform_data = &ath79_mdio1_data, - }, -}; - -static void ath79_set_pll(u32 cfg_reg, u32 pll_reg, u32 pll_val, u32 shift) -{ - void __iomem *base; - u32 t; - - base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); - - t = __raw_readl(base + cfg_reg); - t &= ~(3 << shift); - t |= (2 << shift); - __raw_writel(t, base + cfg_reg); - udelay(100); - - __raw_writel(pll_val, base + pll_reg); - - t |= (3 << shift); - __raw_writel(t, base + cfg_reg); - udelay(100); - - t &= ~(3 << shift); - __raw_writel(t, base + cfg_reg); - udelay(100); - - printk(KERN_DEBUG "ar71xx: pll_reg %#x: %#x\n", - (unsigned int)(base + pll_reg), __raw_readl(base + pll_reg)); - - iounmap(base); -} - -static void __init ath79_mii_ctrl_set_if(unsigned int reg, - unsigned int mii_if) -{ - void __iomem *base; - u32 t; - - base = ioremap(AR71XX_MII_BASE, AR71XX_MII_SIZE); - - t = __raw_readl(base + reg); - t &= ~(AR71XX_MII_CTRL_IF_MASK); - t |= (mii_if & AR71XX_MII_CTRL_IF_MASK); - __raw_writel(t, base + reg); - - iounmap(base); -} - -static void ath79_mii_ctrl_set_speed(unsigned int reg, unsigned int speed) -{ - void __iomem *base; - unsigned int mii_speed; - u32 t; - - switch (speed) { - case SPEED_10: - mii_speed = AR71XX_MII_CTRL_SPEED_10; - break; - case SPEED_100: - mii_speed = AR71XX_MII_CTRL_SPEED_100; - break; - case SPEED_1000: - mii_speed = AR71XX_MII_CTRL_SPEED_1000; - break; - default: - BUG(); - } - - base = ioremap(AR71XX_MII_BASE, AR71XX_MII_SIZE); - - t = __raw_readl(base + reg); - t &= ~(AR71XX_MII_CTRL_SPEED_MASK << AR71XX_MII_CTRL_SPEED_SHIFT); - t |= mii_speed << AR71XX_MII_CTRL_SPEED_SHIFT; - __raw_writel(t, base + reg); - - iounmap(base); -} - -static unsigned long ar934x_get_mdio_ref_clock(void) -{ - void __iomem *base; - unsigned long ret; - u32 t; - - base = ioremap(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); - - ret = 0; - t = __raw_readl(base + AR934X_PLL_SWITCH_CLOCK_CONTROL_REG); - if (t & AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL) { - ret = 100 * 1000 * 1000; - } else { - struct clk *clk; - - clk = clk_get(NULL, "ref"); - if (!IS_ERR(clk)) - ret = clk_get_rate(clk); - } - - iounmap(base); - - return ret; -} - -void __init ath79_register_mdio(unsigned int id, u32 phy_mask) -{ - struct platform_device *mdio_dev; - struct ag71xx_mdio_platform_data *mdio_data; - unsigned int max_id; - - if (ath79_soc == ATH79_SOC_AR9341 || - ath79_soc == ATH79_SOC_AR9342 || - ath79_soc == ATH79_SOC_AR9344 || - ath79_soc == ATH79_SOC_QCA9556 || - ath79_soc == ATH79_SOC_QCA9558 || - ath79_soc == ATH79_SOC_QCA956X) - max_id = 1; - else - max_id = 0; - - if (id > max_id) { - printk(KERN_ERR "ar71xx: invalid MDIO id %u\n", id); - return; - } - - switch (ath79_soc) { - case ATH79_SOC_AR7241: - case ATH79_SOC_AR9330: - case ATH79_SOC_AR9331: - case ATH79_SOC_QCA9533: - case ATH79_SOC_TP9343: - mdio_dev = &ath79_mdio1_device; - mdio_data = &ath79_mdio1_data; - break; - - case ATH79_SOC_AR9341: - case ATH79_SOC_AR9342: - case ATH79_SOC_AR9344: - case ATH79_SOC_QCA9556: - case ATH79_SOC_QCA9558: - case ATH79_SOC_QCA956X: - if (id == 0) { - mdio_dev = &ath79_mdio0_device; - mdio_data = &ath79_mdio0_data; - } else { - mdio_dev = &ath79_mdio1_device; - mdio_data = &ath79_mdio1_data; - } - break; - - case ATH79_SOC_AR7242: - ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, - AR7242_PLL_REG_ETH0_INT_CLOCK, 0x62000000, - AR71XX_ETH0_PLL_SHIFT); - /* fall through */ - default: - mdio_dev = &ath79_mdio0_device; - mdio_data = &ath79_mdio0_data; - break; - } - - mdio_data->phy_mask = phy_mask; - - switch (ath79_soc) { - case ATH79_SOC_AR7240: - mdio_data->is_ar7240 = 1; - /* fall through */ - case ATH79_SOC_AR7241: - mdio_data->builtin_switch = 1; - break; - - case ATH79_SOC_AR9330: - mdio_data->is_ar9330 = 1; - /* fall through */ - case ATH79_SOC_AR9331: - mdio_data->builtin_switch = 1; - break; - - case ATH79_SOC_AR9341: - case ATH79_SOC_AR9342: - case ATH79_SOC_AR9344: - if (id == 1) { - mdio_data->builtin_switch = 1; - mdio_data->ref_clock = ar934x_get_mdio_ref_clock(); - mdio_data->mdio_clock = 6250000; - } - mdio_data->is_ar934x = 1; - break; - - case ATH79_SOC_QCA9533: - case ATH79_SOC_TP9343: - mdio_data->builtin_switch = 1; - break; - - case ATH79_SOC_QCA9556: - case ATH79_SOC_QCA9558: - mdio_data->is_ar934x = 1; - break; - - case ATH79_SOC_QCA956X: - if (id == 1) - mdio_data->builtin_switch = 1; - mdio_data->is_ar934x = 1; - break; - - default: - break; - } - - platform_device_register(mdio_dev); -} - -struct ath79_eth_pll_data ath79_eth0_pll_data; -struct ath79_eth_pll_data ath79_eth1_pll_data; - -static u32 ath79_get_eth_pll(unsigned int mac, int speed) -{ - struct ath79_eth_pll_data *pll_data; - u32 pll_val; - - switch (mac) { - case 0: - pll_data = &ath79_eth0_pll_data; - break; - case 1: - pll_data = &ath79_eth1_pll_data; - break; - default: - BUG(); - } - - switch (speed) { - case SPEED_10: - pll_val = pll_data->pll_10; - break; - case SPEED_100: - pll_val = pll_data->pll_100; - break; - case SPEED_1000: - pll_val = pll_data->pll_1000; - break; - default: - BUG(); - } - - return pll_val; -} - -static void ath79_set_speed_ge0(int speed) -{ - u32 val = ath79_get_eth_pll(0, speed); - - ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, AR71XX_PLL_REG_ETH0_INT_CLOCK, - val, AR71XX_ETH0_PLL_SHIFT); - ath79_mii_ctrl_set_speed(AR71XX_MII_REG_MII0_CTRL, speed); -} - -static void ath79_set_speed_ge1(int speed) -{ - u32 val = ath79_get_eth_pll(1, speed); - - ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, AR71XX_PLL_REG_ETH1_INT_CLOCK, - val, AR71XX_ETH1_PLL_SHIFT); - ath79_mii_ctrl_set_speed(AR71XX_MII_REG_MII1_CTRL, speed); -} - -static void ar7242_set_speed_ge0(int speed) -{ - u32 val = ath79_get_eth_pll(0, speed); - void __iomem *base; - - base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); - __raw_writel(val, base + AR7242_PLL_REG_ETH0_INT_CLOCK); - iounmap(base); -} - -static void ar91xx_set_speed_ge0(int speed) -{ - u32 val = ath79_get_eth_pll(0, speed); - - ath79_set_pll(AR913X_PLL_REG_ETH_CONFIG, AR913X_PLL_REG_ETH0_INT_CLOCK, - val, AR913X_ETH0_PLL_SHIFT); - ath79_mii_ctrl_set_speed(AR71XX_MII_REG_MII0_CTRL, speed); -} - -static void ar91xx_set_speed_ge1(int speed) -{ - u32 val = ath79_get_eth_pll(1, speed); - - ath79_set_pll(AR913X_PLL_REG_ETH_CONFIG, AR913X_PLL_REG_ETH1_INT_CLOCK, - val, AR913X_ETH1_PLL_SHIFT); - ath79_mii_ctrl_set_speed(AR71XX_MII_REG_MII1_CTRL, speed); -} - -static void ar934x_set_speed_ge0(int speed) -{ - void __iomem *base; - u32 val = ath79_get_eth_pll(0, speed); - - base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); - __raw_writel(val, base + AR934X_PLL_ETH_XMII_CONTROL_REG); - iounmap(base); -} - -static void qca955x_set_speed_xmii(int speed) -{ - void __iomem *base; - u32 val = ath79_get_eth_pll(0, speed); - - base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); - __raw_writel(val, base + QCA955X_PLL_ETH_XMII_CONTROL_REG); - iounmap(base); -} - -static void qca955x_set_speed_sgmii(int speed) -{ - void __iomem *base; - u32 val = ath79_get_eth_pll(1, speed); - - base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); - __raw_writel(val, base + QCA955X_PLL_ETH_SGMII_CONTROL_REG); - iounmap(base); -} - -static void qca956x_set_speed_sgmii(int speed) -{ - void __iomem *base; - u32 val = ath79_get_eth_pll(0, speed); - - base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); - __raw_writel(val, base + QCA955X_PLL_ETH_SGMII_CONTROL_REG); - iounmap(base); -} - -static void ath79_set_speed_dummy(int speed) -{ -} - -static void ath79_ddr_flush_ge0(void) -{ - ath79_ddr_wb_flush(0); -} - -static void ath79_ddr_flush_ge1(void) -{ - ath79_ddr_wb_flush(1); -} - -static struct resource ath79_eth0_resources[] = { - { - .name = "mac_base", - .flags = IORESOURCE_MEM, - .start = AR71XX_GE0_BASE, - .end = AR71XX_GE0_BASE + 0x200 - 1, - }, { - .name = "mac_irq", - .flags = IORESOURCE_IRQ, - .start = ATH79_CPU_IRQ(4), - .end = ATH79_CPU_IRQ(4), - }, -}; - -struct ag71xx_platform_data ath79_eth0_data = { - .reset_bit = AR71XX_RESET_GE0_MAC, -}; - -struct platform_device ath79_eth0_device = { - .name = "ag71xx", - .id = 0, - .resource = ath79_eth0_resources, - .num_resources = ARRAY_SIZE(ath79_eth0_resources), - .dev = { - .platform_data = &ath79_eth0_data, - }, -}; - -static struct resource ath79_eth1_resources[] = { - { - .name = "mac_base", - .flags = IORESOURCE_MEM, - .start = AR71XX_GE1_BASE, - .end = AR71XX_GE1_BASE + 0x200 - 1, - }, { - .name = "mac_irq", - .flags = IORESOURCE_IRQ, - .start = ATH79_CPU_IRQ(5), - .end = ATH79_CPU_IRQ(5), - }, -}; - -struct ag71xx_platform_data ath79_eth1_data = { - .reset_bit = AR71XX_RESET_GE1_MAC, -}; - -struct platform_device ath79_eth1_device = { - .name = "ag71xx", - .id = 1, - .resource = ath79_eth1_resources, - .num_resources = ARRAY_SIZE(ath79_eth1_resources), - .dev = { - .platform_data = &ath79_eth1_data, - }, -}; - -struct ag71xx_switch_platform_data ath79_switch_data; - -#define AR71XX_PLL_VAL_1000 0x00110000 -#define AR71XX_PLL_VAL_100 0x00001099 -#define AR71XX_PLL_VAL_10 0x00991099 - -#define AR724X_PLL_VAL_1000 0x00110000 -#define AR724X_PLL_VAL_100 0x00001099 -#define AR724X_PLL_VAL_10 0x00991099 - -#define AR7242_PLL_VAL_1000 0x16000000 -#define AR7242_PLL_VAL_100 0x00000101 -#define AR7242_PLL_VAL_10 0x00001616 - -#define AR913X_PLL_VAL_1000 0x1a000000 -#define AR913X_PLL_VAL_100 0x13000a44 -#define AR913X_PLL_VAL_10 0x00441099 - -#define AR933X_PLL_VAL_1000 0x00110000 -#define AR933X_PLL_VAL_100 0x00001099 -#define AR933X_PLL_VAL_10 0x00991099 - -#define AR934X_PLL_VAL_1000 0x16000000 -#define AR934X_PLL_VAL_100 0x00000101 -#define AR934X_PLL_VAL_10 0x00001616 - -#define QCA956X_PLL_VAL_1000 0x03000000 -#define QCA956X_PLL_VAL_100 0x00000101 -#define QCA956X_PLL_VAL_10 0x00001919 - -static void __init ath79_init_eth_pll_data(unsigned int id) -{ - struct ath79_eth_pll_data *pll_data; - u32 pll_10, pll_100, pll_1000; - - switch (id) { - case 0: - pll_data = &ath79_eth0_pll_data; - break; - case 1: - pll_data = &ath79_eth1_pll_data; - break; - default: - BUG(); - } - - switch (ath79_soc) { - case ATH79_SOC_AR7130: - case ATH79_SOC_AR7141: - case ATH79_SOC_AR7161: - pll_10 = AR71XX_PLL_VAL_10; - pll_100 = AR71XX_PLL_VAL_100; - pll_1000 = AR71XX_PLL_VAL_1000; - break; - - case ATH79_SOC_AR7240: - case ATH79_SOC_AR7241: - pll_10 = AR724X_PLL_VAL_10; - pll_100 = AR724X_PLL_VAL_100; - pll_1000 = AR724X_PLL_VAL_1000; - break; - - case ATH79_SOC_AR7242: - pll_10 = AR7242_PLL_VAL_10; - pll_100 = AR7242_PLL_VAL_100; - pll_1000 = AR7242_PLL_VAL_1000; - break; - - case ATH79_SOC_AR9130: - case ATH79_SOC_AR9132: - pll_10 = AR913X_PLL_VAL_10; - pll_100 = AR913X_PLL_VAL_100; - pll_1000 = AR913X_PLL_VAL_1000; - break; - - case ATH79_SOC_AR9330: - case ATH79_SOC_AR9331: - pll_10 = AR933X_PLL_VAL_10; - pll_100 = AR933X_PLL_VAL_100; - pll_1000 = AR933X_PLL_VAL_1000; - break; - - case ATH79_SOC_AR9341: - case ATH79_SOC_AR9342: - case ATH79_SOC_AR9344: - case ATH79_SOC_QCA9533: - case ATH79_SOC_QCA9556: - case ATH79_SOC_QCA9558: - case ATH79_SOC_TP9343: - pll_10 = AR934X_PLL_VAL_10; - pll_100 = AR934X_PLL_VAL_100; - pll_1000 = AR934X_PLL_VAL_1000; - break; - - case ATH79_SOC_QCA956X: - pll_10 = QCA956X_PLL_VAL_10; - pll_100 = QCA956X_PLL_VAL_100; - pll_1000 = QCA956X_PLL_VAL_1000; - break; - - default: - BUG(); - } - - if (!pll_data->pll_10) - pll_data->pll_10 = pll_10; - - if (!pll_data->pll_100) - pll_data->pll_100 = pll_100; - - if (!pll_data->pll_1000) - pll_data->pll_1000 = pll_1000; -} - -static int __init ath79_setup_phy_if_mode(unsigned int id, - struct ag71xx_platform_data *pdata) -{ - unsigned int mii_if; - - switch (id) { - case 0: - switch (ath79_soc) { - case ATH79_SOC_AR7130: - case ATH79_SOC_AR7141: - case ATH79_SOC_AR7161: - case ATH79_SOC_AR9130: - case ATH79_SOC_AR9132: - switch (pdata->phy_if_mode) { - case PHY_INTERFACE_MODE_MII: - mii_if = AR71XX_MII0_CTRL_IF_MII; - break; - case PHY_INTERFACE_MODE_GMII: - mii_if = AR71XX_MII0_CTRL_IF_GMII; - break; - case PHY_INTERFACE_MODE_RGMII: - mii_if = AR71XX_MII0_CTRL_IF_RGMII; - break; - case PHY_INTERFACE_MODE_RMII: - mii_if = AR71XX_MII0_CTRL_IF_RMII; - break; - default: - return -EINVAL; - } - ath79_mii_ctrl_set_if(AR71XX_MII_REG_MII0_CTRL, mii_if); - break; - - case ATH79_SOC_AR7240: - case ATH79_SOC_AR7241: - case ATH79_SOC_AR9330: - case ATH79_SOC_AR9331: - case ATH79_SOC_QCA9533: - case ATH79_SOC_TP9343: - pdata->phy_if_mode = PHY_INTERFACE_MODE_MII; - break; - - case ATH79_SOC_AR7242: - /* FIXME */ - - case ATH79_SOC_AR9341: - case ATH79_SOC_AR9342: - case ATH79_SOC_AR9344: - switch (pdata->phy_if_mode) { - case PHY_INTERFACE_MODE_MII: - case PHY_INTERFACE_MODE_GMII: - case PHY_INTERFACE_MODE_RGMII: - case PHY_INTERFACE_MODE_RMII: - break; - default: - return -EINVAL; - } - break; - - case ATH79_SOC_QCA9556: - case ATH79_SOC_QCA9558: - case ATH79_SOC_QCA956X: - switch (pdata->phy_if_mode) { - case PHY_INTERFACE_MODE_MII: - case PHY_INTERFACE_MODE_RGMII: - case PHY_INTERFACE_MODE_SGMII: - break; - default: - return -EINVAL; - } - break; - - default: - BUG(); - } - break; - case 1: - switch (ath79_soc) { - case ATH79_SOC_AR7130: - case ATH79_SOC_AR7141: - case ATH79_SOC_AR7161: - case ATH79_SOC_AR9130: - case ATH79_SOC_AR9132: - switch (pdata->phy_if_mode) { - case PHY_INTERFACE_MODE_RMII: - mii_if = AR71XX_MII1_CTRL_IF_RMII; - break; - case PHY_INTERFACE_MODE_RGMII: - mii_if = AR71XX_MII1_CTRL_IF_RGMII; - break; - default: - return -EINVAL; - } - ath79_mii_ctrl_set_if(AR71XX_MII_REG_MII1_CTRL, mii_if); - break; - - case ATH79_SOC_AR7240: - case ATH79_SOC_AR7241: - case ATH79_SOC_AR9330: - case ATH79_SOC_AR9331: - case ATH79_SOC_TP9343: - pdata->phy_if_mode = PHY_INTERFACE_MODE_GMII; - break; - - case ATH79_SOC_AR7242: - /* FIXME */ - - case ATH79_SOC_AR9341: - case ATH79_SOC_AR9342: - case ATH79_SOC_AR9344: - case ATH79_SOC_QCA9533: - case ATH79_SOC_QCA956X: - switch (pdata->phy_if_mode) { - case PHY_INTERFACE_MODE_MII: - case PHY_INTERFACE_MODE_GMII: - break; - default: - return -EINVAL; - } - break; - - case ATH79_SOC_QCA9556: - case ATH79_SOC_QCA9558: - switch (pdata->phy_if_mode) { - case PHY_INTERFACE_MODE_MII: - case PHY_INTERFACE_MODE_RGMII: - case PHY_INTERFACE_MODE_SGMII: - break; - default: - return -EINVAL; - } - break; - - default: - BUG(); - } - break; - } - - return 0; -} - -void __init ath79_setup_ar933x_phy4_switch(bool mac, bool mdio) -{ - void __iomem *base; - u32 t; - - base = ioremap(AR933X_GMAC_BASE, AR933X_GMAC_SIZE); - - t = __raw_readl(base + AR933X_GMAC_REG_ETH_CFG); - t &= ~(AR933X_ETH_CFG_SW_PHY_SWAP | AR933X_ETH_CFG_SW_PHY_ADDR_SWAP); - if (mac) - t |= AR933X_ETH_CFG_SW_PHY_SWAP; - if (mdio) - t |= AR933X_ETH_CFG_SW_PHY_ADDR_SWAP; - __raw_writel(t, base + AR933X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -void __init ath79_setup_ar934x_eth_cfg(u32 mask) -{ - void __iomem *base; - u32 t; - - base = ioremap(AR934X_GMAC_BASE, AR934X_GMAC_SIZE); - - t = __raw_readl(base + AR934X_GMAC_REG_ETH_CFG); - - t &= ~(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_MII_GMAC0 | - AR934X_ETH_CFG_GMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE | - AR934X_ETH_CFG_SW_PHY_SWAP); - - t |= mask; - - __raw_writel(t, base + AR934X_GMAC_REG_ETH_CFG); - /* flush write */ - __raw_readl(base + AR934X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -void __init ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, - unsigned int rxdv) -{ - void __iomem *base; - u32 t; - - rxd &= AR934X_ETH_CFG_RXD_DELAY_MASK; - rxdv &= AR934X_ETH_CFG_RDV_DELAY_MASK; - - base = ioremap(AR934X_GMAC_BASE, AR934X_GMAC_SIZE); - - t = __raw_readl(base + AR934X_GMAC_REG_ETH_CFG); - - t &= ~(AR934X_ETH_CFG_RXD_DELAY_MASK << AR934X_ETH_CFG_RXD_DELAY_SHIFT | - AR934X_ETH_CFG_RDV_DELAY_MASK << AR934X_ETH_CFG_RDV_DELAY_SHIFT); - - t |= (rxd << AR934X_ETH_CFG_RXD_DELAY_SHIFT | - rxdv << AR934X_ETH_CFG_RDV_DELAY_SHIFT); - - __raw_writel(t, base + AR934X_GMAC_REG_ETH_CFG); - /* flush write */ - __raw_readl(base + AR934X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -void __init ath79_setup_qca955x_eth_cfg(u32 mask) -{ - void __iomem *base; - u32 t; - - base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); - - t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG); - - t &= ~(QCA955X_ETH_CFG_RGMII_EN | QCA955X_ETH_CFG_GE0_SGMII); - - t |= mask; - - __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -void __init ath79_setup_qca956x_eth_cfg(u32 mask) -{ - void __iomem *base; - u32 t; - - base = ioremap(QCA956X_GMAC_BASE, QCA956X_GMAC_SIZE); - - t = __raw_readl(base + QCA956X_GMAC_REG_ETH_CFG); - - t &= ~(QCA956X_ETH_CFG_SW_ONLY_MODE | - QCA956X_ETH_CFG_SW_PHY_SWAP); - - t |= mask; - - __raw_writel(t, base + QCA956X_GMAC_REG_ETH_CFG); - /* flush write */ - __raw_readl(base + QCA956X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -static int ath79_eth_instance __initdata; -void __init ath79_register_eth(unsigned int id) -{ - struct platform_device *pdev; - struct ag71xx_platform_data *pdata; - int err; - - if (id > 1) { - printk(KERN_ERR "ar71xx: invalid ethernet id %d\n", id); - return; - } - - ath79_init_eth_pll_data(id); - - if (id == 0) - pdev = &ath79_eth0_device; - else - pdev = &ath79_eth1_device; - - pdata = pdev->dev.platform_data; - - pdata->max_frame_len = 1540; - pdata->desc_pktlen_mask = 0xfff; - - err = ath79_setup_phy_if_mode(id, pdata); - if (err) { - printk(KERN_ERR - "ar71xx: invalid PHY interface mode for GE%u\n", id); - return; - } - - if (id == 0) - pdata->ddr_flush = ath79_ddr_flush_ge0; - else - pdata->ddr_flush = ath79_ddr_flush_ge1; - - switch (ath79_soc) { - case ATH79_SOC_AR7130: - if (id == 0) - pdata->set_speed = ath79_set_speed_ge0; - else - pdata->set_speed = ath79_set_speed_ge1; - break; - - case ATH79_SOC_AR7141: - case ATH79_SOC_AR7161: - if (id == 0) - pdata->set_speed = ath79_set_speed_ge0; - else - pdata->set_speed = ath79_set_speed_ge1; - pdata->has_gbit = 1; - break; - - case ATH79_SOC_AR7242: - if (id == 0) { - pdata->reset_bit |= AR724X_RESET_GE0_MDIO | - AR71XX_RESET_GE0_PHY; - pdata->set_speed = ar7242_set_speed_ge0; - } else { - pdata->reset_bit |= AR724X_RESET_GE1_MDIO | - AR71XX_RESET_GE1_PHY; - pdata->set_speed = ath79_set_speed_dummy; - } - pdata->has_gbit = 1; - pdata->is_ar724x = 1; - break; - - case ATH79_SOC_AR7241: - if (id == 0) - pdata->reset_bit |= AR724X_RESET_GE0_MDIO; - else - pdata->reset_bit |= AR724X_RESET_GE1_MDIO; - /* fall through */ - case ATH79_SOC_AR7240: - if (id == 0) { - pdata->reset_bit |= AR71XX_RESET_GE0_PHY; - pdata->set_speed = ath79_set_speed_dummy; - - pdata->phy_mask = BIT(4); - } else { - pdata->reset_bit |= AR71XX_RESET_GE1_PHY; - pdata->set_speed = ath79_set_speed_dummy; - - pdata->speed = SPEED_1000; - pdata->duplex = DUPLEX_FULL; - pdata->switch_data = &ath79_switch_data; - pdata->use_flow_control = 1; - - ath79_switch_data.phy_poll_mask |= BIT(4); - } - pdata->has_gbit = 1; - pdata->is_ar724x = 1; - if (ath79_soc == ATH79_SOC_AR7240) - pdata->is_ar7240 = 1; - break; - - case ATH79_SOC_AR9132: - pdata->has_gbit = 1; - /* fall through */ - case ATH79_SOC_AR9130: - if (id == 0) - pdata->set_speed = ar91xx_set_speed_ge0; - else - pdata->set_speed = ar91xx_set_speed_ge1; - pdata->is_ar91xx = 1; - break; - - case ATH79_SOC_AR9330: - case ATH79_SOC_AR9331: - if (id == 0) { - pdata->reset_bit = AR933X_RESET_GE0_MAC | - AR933X_RESET_GE0_MDIO; - pdata->set_speed = ath79_set_speed_dummy; - - pdata->phy_mask = BIT(4); - } else { - pdata->reset_bit = AR933X_RESET_GE1_MAC | - AR933X_RESET_GE1_MDIO; - pdata->set_speed = ath79_set_speed_dummy; - - pdata->speed = SPEED_1000; - pdata->has_gbit = 1; - pdata->duplex = DUPLEX_FULL; - pdata->switch_data = &ath79_switch_data; - pdata->use_flow_control = 1; - - ath79_switch_data.phy_poll_mask |= BIT(4); - } - - pdata->is_ar724x = 1; - break; - - case ATH79_SOC_AR9341: - case ATH79_SOC_AR9342: - case ATH79_SOC_AR9344: - case ATH79_SOC_QCA9533: - if (id == 0) { - pdata->reset_bit = AR934X_RESET_GE0_MAC | - AR934X_RESET_GE0_MDIO; - pdata->set_speed = ar934x_set_speed_ge0; - - if (ath79_soc == ATH79_SOC_QCA9533) - pdata->disable_inline_checksum_engine = 1; - } else { - pdata->reset_bit = AR934X_RESET_GE1_MAC | - AR934X_RESET_GE1_MDIO; - pdata->set_speed = ath79_set_speed_dummy; - - pdata->switch_data = &ath79_switch_data; - - /* reset the built-in switch */ - ath79_device_reset_set(AR934X_RESET_ETH_SWITCH); - ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH); - } - - pdata->has_gbit = 1; - pdata->is_ar724x = 1; - - pdata->max_frame_len = SZ_16K - 1; - pdata->desc_pktlen_mask = SZ_16K - 1; - break; - - case ATH79_SOC_TP9343: - if (id == 0) { - pdata->reset_bit = AR933X_RESET_GE0_MAC | - AR933X_RESET_GE0_MDIO; - pdata->set_speed = ath79_set_speed_dummy; - - if (!pdata->phy_mask) - pdata->phy_mask = BIT(4); - } else { - pdata->reset_bit = AR933X_RESET_GE1_MAC | - AR933X_RESET_GE1_MDIO; - pdata->set_speed = ath79_set_speed_dummy; - - pdata->speed = SPEED_1000; - pdata->duplex = DUPLEX_FULL; - pdata->switch_data = &ath79_switch_data; - pdata->use_flow_control = 1; - - ath79_switch_data.phy_poll_mask |= BIT(4); - } - - pdata->has_gbit = 1; - pdata->is_ar724x = 1; - break; - - case ATH79_SOC_QCA9556: - case ATH79_SOC_QCA9558: - if (id == 0) { - pdata->reset_bit = QCA955X_RESET_GE0_MAC | - QCA955X_RESET_GE0_MDIO; - pdata->set_speed = qca955x_set_speed_xmii; - } else { - pdata->reset_bit = QCA955X_RESET_GE1_MAC | - QCA955X_RESET_GE1_MDIO; - pdata->set_speed = qca955x_set_speed_sgmii; - } - - pdata->has_gbit = 1; - pdata->is_ar724x = 1; - - /* - * Limit the maximum frame length to 4095 bytes. - * Although the documentation says that the hardware - * limit is 16383 bytes but that does not work in - * practice. It seems that the hardware only updates - * the lowest 12 bits of the packet length field - * in the RX descriptor. - */ - pdata->max_frame_len = SZ_4K - 1; - pdata->desc_pktlen_mask = SZ_16K - 1; - break; - - case ATH79_SOC_QCA956X: - if (id == 0) { - pdata->reset_bit = QCA955X_RESET_GE0_MAC | - QCA955X_RESET_GE0_MDIO; - - if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) - pdata->set_speed = qca956x_set_speed_sgmii; - else - pdata->set_speed = ar934x_set_speed_ge0; - - pdata->disable_inline_checksum_engine = 1; - } else { - pdata->reset_bit = QCA955X_RESET_GE1_MAC | - QCA955X_RESET_GE1_MDIO; - - pdata->set_speed = ath79_set_speed_dummy; - - pdata->switch_data = &ath79_switch_data; - - pdata->speed = SPEED_1000; - pdata->duplex = DUPLEX_FULL; - pdata->use_flow_control = 1; - - /* reset the built-in switch */ - ath79_device_reset_set(AR934X_RESET_ETH_SWITCH); - ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH); - } - - pdata->has_gbit = 1; - pdata->is_ar724x = 1; - break; - - default: - BUG(); - } - - switch (pdata->phy_if_mode) { - case PHY_INTERFACE_MODE_GMII: - case PHY_INTERFACE_MODE_RGMII: - case PHY_INTERFACE_MODE_SGMII: - if (!pdata->has_gbit) { - printk(KERN_ERR "ar71xx: no gbit available on eth%d\n", - id); - return; - } - /* fallthrough */ - default: - break; - } - - if (!is_valid_ether_addr(pdata->mac_addr)) { - random_ether_addr(pdata->mac_addr); - printk(KERN_DEBUG - "ar71xx: using random MAC address for eth%d\n", - ath79_eth_instance); - } - - if (pdata->mii_bus_dev == NULL) { - switch (ath79_soc) { - case ATH79_SOC_AR9341: - case ATH79_SOC_AR9342: - case ATH79_SOC_AR9344: - if (id == 0) - pdata->mii_bus_dev = &ath79_mdio0_device.dev; - else - pdata->mii_bus_dev = &ath79_mdio1_device.dev; - break; - - case ATH79_SOC_AR7241: - case ATH79_SOC_AR9330: - case ATH79_SOC_AR9331: - case ATH79_SOC_QCA9533: - case ATH79_SOC_TP9343: - pdata->mii_bus_dev = &ath79_mdio1_device.dev; - break; - - case ATH79_SOC_QCA9556: - case ATH79_SOC_QCA9558: - /* don't assign any MDIO device by default */ - break; - - case ATH79_SOC_QCA956X: - if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII) - pdata->mii_bus_dev = &ath79_mdio1_device.dev; - break; - - default: - pdata->mii_bus_dev = &ath79_mdio0_device.dev; - break; - } - } - - /* Reset the device */ - ath79_device_reset_set(pdata->reset_bit); - msleep(100); - - ath79_device_reset_clear(pdata->reset_bit); - msleep(100); - - platform_device_register(pdev); - ath79_eth_instance++; -} - -void __init ath79_set_mac_base(unsigned char *mac) -{ - memcpy(ath79_mac_base, mac, ETH_ALEN); -} - -void __init ath79_parse_ascii_mac(char *mac_str, u8 *mac) -{ - int t; - - t = sscanf(mac_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", - &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]); - - if (t != ETH_ALEN) - t = sscanf(mac_str, "%02hhx.%02hhx.%02hhx.%02hhx.%02hhx.%02hhx", - &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]); - - if (t != ETH_ALEN || !is_valid_ether_addr(mac)) { - memset(mac, 0, ETH_ALEN); - printk(KERN_DEBUG "ar71xx: invalid mac address \"%s\"\n", - mac_str); - } -} - -void __init ath79_extract_mac_reverse(u8 *ptr, u8 *out) -{ - int i; - - for (i = 0; i < ETH_ALEN; i++) { - out[i] = ptr[ETH_ALEN-i-1]; - } -} - -static void __init ath79_set_mac_base_ascii(char *str) -{ - u8 mac[ETH_ALEN]; - - ath79_parse_ascii_mac(str, mac); - ath79_set_mac_base(mac); -} - -static int __init ath79_ethaddr_setup(char *str) -{ - ath79_set_mac_base_ascii(str); - return 1; -} -__setup("ethaddr=", ath79_ethaddr_setup); - -static int __init ath79_kmac_setup(char *str) -{ - ath79_set_mac_base_ascii(str); - return 1; -} -__setup("kmac=", ath79_kmac_setup); - -void __init ath79_init_mac(unsigned char *dst, const unsigned char *src, - int offset) -{ - int t; - - if (!dst) - return; - - if (!src || !is_valid_ether_addr(src)) { - memset(dst, '\0', ETH_ALEN); - return; - } - - t = (((u32) src[3]) << 16) + (((u32) src[4]) << 8) + ((u32) src[5]); - t += offset; - - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - dst[3] = (t >> 16) & 0xff; - dst[4] = (t >> 8) & 0xff; - dst[5] = t & 0xff; -} - -void __init ath79_init_local_mac(unsigned char *dst, const unsigned char *src) -{ - int i; - - if (!dst) - return; - - if (!src || !is_valid_ether_addr(src)) { - memset(dst, '\0', ETH_ALEN); - return; - } - - for (i = 0; i < ETH_ALEN; i++) - dst[i] = src[i]; - dst[0] |= 0x02; -} diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-a60.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-a60.c deleted file mode 100644 index be41081fc..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-a60.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * OpenMesh A60 support - * - * Copyright (C) 2013 Marek Lindner - * Copyright (C) 2014-2017 Sven Eckelmann - * - * 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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-gpio-buttons.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-usb.h" - -#define A60_GPIO_LED_RED 22 -#define A60_GPIO_LED_GREEN 23 -#define A60_GPIO_LED_BLUE 13 - -#define A60_GPIO_BTN_RESET 17 - -#define A60_KEYS_POLL_INTERVAL 20 /* msecs */ -#define A60_KEYS_DEBOUNCE_INTERVAL (3 * A60_KEYS_POLL_INTERVAL) - -#define A60_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led a40_leds_gpio[] __initdata = { - { - .name = "a40:red:status", - .gpio = A60_GPIO_LED_RED, - }, { - .name = "a40:green:status", - .gpio = A60_GPIO_LED_GREEN, - }, { - .name = "a40:blue:status", - .gpio = A60_GPIO_LED_BLUE, - } -}; - -static struct gpio_led a60_leds_gpio[] __initdata = { - { - .name = "a60:red:status", - .gpio = A60_GPIO_LED_RED, - }, { - .name = "a60:green:status", - .gpio = A60_GPIO_LED_GREEN, - }, { - .name = "a60:blue:status", - .gpio = A60_GPIO_LED_BLUE, - } -}; - -static struct gpio_keys_button a60_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = A60_KEYS_DEBOUNCE_INTERVAL, - .gpio = A60_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct at803x_platform_data a60_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info a60_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "a60_1", - .mdio_addr = 1, - .platform_data = &a60_at803x_data, - }, - { - .bus_id = "ag71xx-mdio.0", - .modalias = "a60_2", - .mdio_addr = 2, - .platform_data = &a60_at803x_data, - }, -}; - -static void __init a60_setup_qca955x_eth_cfg(u32 mask, - unsigned int rxd, - unsigned int rxdv, - unsigned int txd, - unsigned int txe) -{ - void __iomem *base; - u32 t; - - base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); - - t = mask; - t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; - t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; - t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; - t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; - - __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -static void __init a60_setup_common(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - ath79_register_usb(); - - ath79_register_m25p80(NULL); - ath79_register_gpio_keys_polled(-1, A60_KEYS_POLL_INTERVAL, - ARRAY_SIZE(a60_gpio_keys), - a60_gpio_keys); - - ath79_init_mac(mac, art, 0x02); - ath79_register_wmac(art + A60_WMAC_CALDATA_OFFSET, mac); - - a60_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(a60_mdio0_info, ARRAY_SIZE(a60_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0x00); - ath79_init_mac(ath79_eth1_data.mac_addr, art, 0x01); - - /* GMAC0 is connected to the PHY1 */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_data.phy_mask = BIT(1); - ath79_eth0_pll_data.pll_1000 = 0x82000101; - ath79_eth0_pll_data.pll_100 = 0x80000101; - ath79_eth0_pll_data.pll_10 = 0x80001313; - ath79_register_eth(0); - - /* GMAC1 is connected to MDIO1 in SGMII mode */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth1_data.phy_mask = BIT(2); - ath79_eth1_pll_data.pll_1000 = 0x03000101; - ath79_eth1_pll_data.pll_100 = 0x80000101; - ath79_eth1_pll_data.pll_10 = 0x80001313; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_register_eth(1); - - ath79_register_pci(); -} - -static void __init a40_setup(void) -{ - ath79_register_leds_gpio(-1, ARRAY_SIZE(a40_leds_gpio), a40_leds_gpio); - a60_setup_common(); -} - -MIPS_MACHINE(ATH79_MACH_A40, "A40", "OpenMesh A40", a40_setup); - -static void __init a60_setup(void) -{ - ath79_register_leds_gpio(-1, ARRAY_SIZE(a60_leds_gpio), a60_leds_gpio); - a60_setup_common(); -} - -MIPS_MACHINE(ATH79_MACH_A60, "A60", "OpenMesh A60", a60_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-alfa-ap120c.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-alfa-ap120c.c deleted file mode 100644 index b53d24b42..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-alfa-ap120c.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * ALFA Network AP120C board support - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2016 Luka Perkov - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-ap9x-pci.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define ALFA_AP120C_GPIO_LED 0 - -#define ALFA_AP120C_GPIO_BUTTON_WIFI 16 - -#define ALFA_AP120C_GPIO_WATCH_DOG 20 - -#define ALFA_AP120C_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ALFA_AP120C_KEYS_DEBOUNCE_INTERVAL (3 * ALFA_AP120C_KEYS_POLL_INTERVAL) - -#define ALFA_AP120C_MAC_OFFSET 0x1002 -#define ALFA_AP120C_CAL0_OFFSET 0x1000 - -static struct gpio_keys_button alfa_ap120c_gpio_keys[] __initdata = { - { - .desc = "Wireless button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = ALFA_AP120C_KEYS_DEBOUNCE_INTERVAL, - .gpio = ALFA_AP120C_GPIO_BUTTON_WIFI, - .active_low = 1, - } -}; - -static struct gpio_led alfa_ap120c_leds_gpio[] __initdata = { - { - .name = "ap120c:red:wlan", - .gpio = ALFA_AP120C_GPIO_LED, - .active_low = 0, - } -}; - -static struct ar8327_pad_cfg ap120c_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data ap120c_ar8327_data = { - .pad0_cfg = &ap120c_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info ap120c_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "ap120c", - .mdio_addr = 0, - .platform_data = &ap120c_ar8327_data, - }, -}; - -static struct flash_platform_data flash __initdata = { NULL, NULL, 0 }; - -#define ALFA_AP120C_LAN_PHYMASK BIT(5) -#define ALFA_AP120C_MDIO_PHYMASK ALFA_AP120C_LAN_PHYMASK - -static void __init alfa_ap120c_init(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 mac[ETH_ALEN]; - - struct ath9k_platform_data *pdata; - - ath79_register_leds_gpio(-1, ARRAY_SIZE(alfa_ap120c_leds_gpio), - alfa_ap120c_leds_gpio); - ath79_register_gpio_keys_polled(-1, ALFA_AP120C_KEYS_POLL_INTERVAL, - ARRAY_SIZE(alfa_ap120c_gpio_keys), - alfa_ap120c_gpio_keys); - - ath79_gpio_function_enable(AR71XX_GPIO_FUNC_SPI_CS1_EN | - AR71XX_GPIO_FUNC_SPI_CS2_EN); - - ath79_register_m25p80_multi(&flash); - - ath79_init_mac(mac, art + ALFA_AP120C_MAC_OFFSET, 1); - ath79_register_wmac(art + ALFA_AP120C_CAL0_OFFSET, mac); - - ath79_init_mac(mac, art + ALFA_AP120C_MAC_OFFSET, 2); - ap91_pci_init(NULL, mac); - pdata = ap9x_pci_get_wmac_data(0); - if (!pdata) { - pr_err("ap120c: unable to get address of wlan data\n"); - return; - } - pdata->use_eeprom = true; - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - BIT(15) | BIT(17) | BIT(19) | BIT(21)); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + ALFA_AP120C_MAC_OFFSET, 0); - - mdiobus_register_board_info(ap120c_mdio0_info, ARRAY_SIZE(ap120c_mdio0_info)); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = ALFA_AP120C_LAN_PHYMASK; - - ath79_eth0_pll_data.pll_1000 = 0x42000000; - ath79_eth0_pll_data.pll_10 = 0x00001313; - - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_ALFA_AP120C, "ALFA-AP120C", "ALFA Network AP120C", - alfa_ap120c_init); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap132.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap132.c deleted file mode 100644 index ae3097692..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap132.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Atheros AP132 reference board support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012 Gabor Juhos - * Copyright (c) 2013 Embedded Wireless GmbH - * - * 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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define AP132_GPIO_LED_USB 4 -#define AP132_GPIO_LED_WLAN_5G 12 -#define AP132_GPIO_LED_WLAN_2G 13 -#define AP132_GPIO_LED_STATUS_RED 14 -#define AP132_GPIO_LED_WPS_RED 15 - -#define AP132_GPIO_BTN_WPS 16 - -#define AP132_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP132_KEYS_DEBOUNCE_INTERVAL (3 * AP132_KEYS_POLL_INTERVAL) - -#define AP132_MAC0_OFFSET 0 -#define AP132_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led ap132_leds_gpio[] __initdata = { - { - .name = "ap132:red:status", - .gpio = AP132_GPIO_LED_STATUS_RED, - .active_low = 1, - }, - { - .name = "ap132:red:wps", - .gpio = AP132_GPIO_LED_WPS_RED, - .active_low = 1, - }, - { - .name = "ap132:red:wlan-2g", - .gpio = AP132_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "ap132:red:usb", - .gpio = AP132_GPIO_LED_USB, - .active_low = 1, - } -}; - -static struct gpio_keys_button ap132_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AP132_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP132_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg ap132_ar8327_pad0_cfg; - -static struct ar8327_platform_data ap132_ar8327_data = { - .pad0_cfg = &ap132_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info ap132_mdio1_info[] = { - { - .bus_id = "ag71xx-mdio.1", - .modalias = "ap132", - .mdio_addr = 0, - .platform_data = &ap132_ar8327_data, - }, -}; - -static void __init ap132_mdio_setup(void) -{ - void __iomem *base; - u32 t; - -#define GPIO_IN_ENABLE3_ADDRESS 0x0050 -#define GPIO_IN_ENABLE3_MII_GE1_MDI_MASK 0x00ff0000 -#define GPIO_IN_ENABLE3_MII_GE1_MDI_LSB 16 -#define GPIO_IN_ENABLE3_MII_GE1_MDI_SET(x) (((x) << GPIO_IN_ENABLE3_MII_GE1_MDI_LSB) & GPIO_IN_ENABLE3_MII_GE1_MDI_MASK) -#define GPIO_OUT_FUNCTION4_ADDRESS 0x003c -#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK 0xff000000 -#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_LSB 24 -#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_SET(x) (((x) << GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_LSB) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK) -#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK 0x0000ff00 -#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_LSB 8 -#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_SET(x) (((x) << GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_LSB) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK) - - base = ioremap(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE); - - t = __raw_readl(base + GPIO_IN_ENABLE3_ADDRESS); - t &= ~GPIO_IN_ENABLE3_MII_GE1_MDI_MASK; - t |= GPIO_IN_ENABLE3_MII_GE1_MDI_SET(19); - __raw_writel(t, base + GPIO_IN_ENABLE3_ADDRESS); - - - __raw_writel(__raw_readl(base + AR71XX_GPIO_REG_OE) & ~(1 << 19), base + AR71XX_GPIO_REG_OE); - - __raw_writel(__raw_readl(base + AR71XX_GPIO_REG_OE) & ~(1 << 17), base + AR71XX_GPIO_REG_OE); - - - t = __raw_readl(base + GPIO_OUT_FUNCTION4_ADDRESS); - t &= ~(GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK | GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK); - t |= GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_SET(0x20) | GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_SET(0x21); - __raw_writel(t, base + GPIO_OUT_FUNCTION4_ADDRESS); - - iounmap(base); - -} - -static void __init ap132_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap132_leds_gpio), - ap132_leds_gpio); - ath79_register_gpio_keys_polled(-1, AP132_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap132_gpio_keys), - ap132_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(art + AP132_WMAC_CALDATA_OFFSET, NULL); - - /* GMAC0 of the AR8327 switch is connected to GMAC1 via SGMII */ - ap132_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_SGMII; - ap132_ar8327_pad0_cfg.sgmii_delay_en = true; - - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ap132_mdio_setup(); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth1_data.mac_addr, art + AP132_MAC0_OFFSET, 0); - - mdiobus_register_board_info(ap132_mdio1_info, - ARRAY_SIZE(ap132_mdio1_info)); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_mask = BIT(0); - ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; - - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_AP132, "AP132", - "Atheros AP132 reference board", - ap132_setup); - diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap152.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap152.c deleted file mode 100644 index 9b7b68243..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap152.c +++ /dev/null @@ -1,141 +0,0 @@ - -/* - * Qualcomm Atheros AP152 reference board support - * - * Copyright (c) 2015 Qualcomm Atheros - * Copyright (c) 2012 Gabor Juhos - * - * 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 "common.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" - -#define AP152_GPIO_LED_USB0 7 -#define AP152_GPIO_LED_USB1 8 - -#define AP152_GPIO_BTN_RESET 2 -#define AP152_GPIO_BTN_WPS 1 -#define AP152_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP152_KEYS_DEBOUNCE_INTERVAL (3 * AP152_KEYS_POLL_INTERVAL) - -#define AP152_MAC0_OFFSET 0 -#define AP152_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led ap152_leds_gpio[] __initdata = { - { - .name = "ap152:green:usb0", - .gpio = AP152_GPIO_LED_USB0, - .active_low = 1, - }, - { - .name = "ap152:green:usb1", - .gpio = AP152_GPIO_LED_USB1, - .active_low = 1, - }, -}; - -static struct gpio_keys_button ap152_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AP152_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP152_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AP152_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP152_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg ap152_ar8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data ap152_ar8337_data = { - .pad0_cfg = &ap152_ar8337_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info ap152_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "ap152", - .mdio_addr = 0, - .platform_data = &ap152_ar8337_data, - }, -}; - -static void __init ap152_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap152_leds_gpio), - ap152_leds_gpio); - ath79_register_gpio_keys_polled(-1, AP152_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap152_gpio_keys), - ap152_gpio_keys); - - ath79_register_usb(); - - platform_device_register(&ath79_mdio0_device); - - mdiobus_register_board_info(ap152_mdio0_info, - ARRAY_SIZE(ap152_mdio0_info)); - - ath79_register_wmac(art + AP152_WMAC_CALDATA_OFFSET, NULL); - ath79_register_pci(); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + AP152_MAC0_OFFSET, 0); - - /* GMAC0 is connected to an AR8337 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_AP152, "AP152", "Qualcomm Atheros AP152 reference board", - ap152_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c7.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c7.c deleted file mode 100644 index 2127d5a96..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c7.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * TP-LINK Archer C5/C7/TL-WDR4900 v2 board support - * - * Copyright (c) 2013 Gabor Juhos - * Copyright (c) 2014 施康成 - * Copyright (c) 2014 Imre Kaloz - * - * 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define ARCHER_C7_GPIO_LED_WLAN2G 12 -#define ARCHER_C7_GPIO_LED_SYSTEM 14 -#define ARCHER_C7_GPIO_LED_QSS 15 -#define ARCHER_C7_GPIO_LED_WLAN5G 17 -#define ARCHER_C7_GPIO_LED_USB1 18 -#define ARCHER_C7_GPIO_LED_USB2 19 - -#define ARCHER_C7_GPIO_BTN_RFKILL 13 -#define ARCHER_C7_V2_GPIO_BTN_RFKILL 23 -#define ARCHER_C7_GPIO_BTN_RESET 16 - -#define ARCHER_C7_GPIO_USB1_POWER 22 -#define ARCHER_C7_GPIO_USB2_POWER 21 - -#define ARCHER_C7_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ARCHER_C7_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C7_KEYS_POLL_INTERVAL) - -#define ARCHER_C7_WMAC_CALDATA_OFFSET 0x1000 -#define ARCHER_C7_PCIE_CALDATA_OFFSET 0x5000 - -static const char *archer_c7_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data archer_c7_flash_data = { - .part_probes = archer_c7_part_probes, -}; - -static struct gpio_led archer_c7_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:qss", - .gpio = ARCHER_C7_GPIO_LED_QSS, - .active_low = 1, - }, - { - .name = "tp-link:blue:system", - .gpio = ARCHER_C7_GPIO_LED_SYSTEM, - .active_low = 1, - }, - { - .name = "tp-link:blue:wlan2g", - .gpio = ARCHER_C7_GPIO_LED_WLAN2G, - .active_low = 1, - }, - { - .name = "tp-link:blue:wlan5g", - .gpio = ARCHER_C7_GPIO_LED_WLAN5G, - .active_low = 1, - }, - { - .name = "tp-link:green:usb1", - .gpio = ARCHER_C7_GPIO_LED_USB1, - .active_low = 1, - }, - { - .name = "tp-link:green:usb2", - .gpio = ARCHER_C7_GPIO_LED_USB2, - .active_low = 1, - }, -}; - -static struct gpio_keys_button archer_c7_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C7_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "RFKILL switch", - .type = EV_SW, - .code = KEY_RFKILL, - .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C7_GPIO_BTN_RFKILL, - }, -}; - -static struct gpio_keys_button archer_c7_v2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C7_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "RFKILL switch", - .type = EV_SW, - .code = KEY_RFKILL, - .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C7_V2_GPIO_BTN_RFKILL, - }, -}; - -static const struct ar8327_led_info archer_c7_leds_ar8327[] = { - AR8327_LED_INFO(PHY0_0, HW, "tp-link:blue:wan"), - AR8327_LED_INFO(PHY1_0, HW, "tp-link:blue:lan1"), - AR8327_LED_INFO(PHY2_0, HW, "tp-link:blue:lan2"), - AR8327_LED_INFO(PHY3_0, HW, "tp-link:blue:lan3"), - AR8327_LED_INFO(PHY4_0, HW, "tp-link:blue:lan4"), -}; - -/* GMAC0 of the AR8327 switch is connected to the QCA9558 SoC via SGMII */ -static struct ar8327_pad_cfg archer_c7_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -/* GMAC6 of the AR8327 switch is connected to the QCA9558 SoC via RGMII */ -static struct ar8327_pad_cfg archer_c7_ar8327_pad6_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg archer_c7_ar8327_led_cfg = { - .led_ctrl0 = 0xc737c737, - .led_ctrl1 = 0x00000000, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x0030c300, - .open_drain = false, -}; - -static struct ar8327_platform_data archer_c7_ar8327_data = { - .pad0_cfg = &archer_c7_ar8327_pad0_cfg, - .pad6_cfg = &archer_c7_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &archer_c7_ar8327_led_cfg, - .num_leds = ARRAY_SIZE(archer_c7_leds_ar8327), - .leds = archer_c7_leds_ar8327, -}; - -static struct mdio_board_info archer_c7_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "archer_c7", - .mdio_addr = 0, - .platform_data = &archer_c7_ar8327_data, - }, -}; - -static void __init common_setup(bool pcie_slot) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&archer_c7_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_leds_gpio), - archer_c7_leds_gpio); - - ath79_init_mac(tmpmac, mac, -1); - ath79_register_wmac(art + ARCHER_C7_WMAC_CALDATA_OFFSET, tmpmac); - - if (pcie_slot) { - ath79_register_pci(); - } else { - ath79_init_mac(tmpmac, mac, -1); - ap9x_pci_setup_wmac_led_pin(0, 0); - ap91_pci_init(art + ARCHER_C7_PCIE_CALDATA_OFFSET, tmpmac); - } - - mdiobus_register_board_info(archer_c7_mdio0_info, - ARRAY_SIZE(archer_c7_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x56000000; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_eth(1); - - gpio_request_one(ARCHER_C7_GPIO_USB1_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB1 power"); - gpio_request_one(ARCHER_C7_GPIO_USB2_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB2 power"); - ath79_register_usb(); -} - -static void __init archer_c5_setup(void) -{ - ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c7_gpio_keys), - archer_c7_gpio_keys); - common_setup(true); -} - -MIPS_MACHINE(ATH79_MACH_ARCHER_C5, "ARCHER-C5", "TP-LINK Archer C5", - archer_c5_setup); - -static void __init archer_c7_setup(void) -{ - ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c7_gpio_keys), - archer_c7_gpio_keys); - common_setup(true); -} - -MIPS_MACHINE(ATH79_MACH_ARCHER_C7, "ARCHER-C7", "TP-LINK Archer C7", - archer_c7_setup); - -static void __init archer_c7_v2_setup(void) -{ - ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c7_v2_gpio_keys), - archer_c7_v2_gpio_keys); - common_setup(true); -} - -MIPS_MACHINE(ATH79_MACH_ARCHER_C7_V2, "ARCHER-C7-V2", "TP-LINK Archer C7", - archer_c7_v2_setup); - -static void __init tl_wdr4900_v2_setup(void) -{ - ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c7_gpio_keys), - archer_c7_gpio_keys); - common_setup(false); -} - -MIPS_MACHINE(ATH79_MACH_TL_WDR4900_V2, "TL-WDR4900-v2", "TP-LINK TL-WDR4900 v2", - tl_wdr4900_v2_setup) - diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-bhr-4grv2.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-bhr-4grv2.c deleted file mode 100644 index 978ef8204..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-bhr-4grv2.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Buffalo BHR-4GRV2 board support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * Copyright (c) 2016 FUKAUMI Naoki - * - * Based on mach-ap136.c and mach-wzr-450hp2.c - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -#define BHR_4GRV2_GPIO_LED_VPN_RED 3 -#define BHR_4GRV2_GPIO_LED_VPN_GREEN 18 -#define BHR_4GRV2_GPIO_LED_POWER_GREEN 19 -#define BHR_4GRV2_GPIO_LED_DIAG_RED 20 - -#define BHR_4GRV2_GPIO_BTN_RESET 17 -#define BHR_4GRV2_GPIO_BTN_ECO 21 - -#define BHR_4GRV2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define BHR_4GRV2_KEYS_DEBOUNCE_INTERVAL (3 * BHR_4GRV2_KEYS_POLL_INTERVAL) -#define BHR_4GRV2_MAC0_OFFSET 0 -#define BHR_4GRV2_MAC1_OFFSET 6 - -static struct gpio_led bhr_4grv2_leds_gpio[] __initdata = { - { - .name = "buffalo:red:vpn", - .gpio = BHR_4GRV2_GPIO_LED_VPN_RED, - .active_low = 1, - }, - { - .name = "buffalo:green:vpn", - .gpio = BHR_4GRV2_GPIO_LED_VPN_GREEN, - .active_low = 1, - }, - { - .name = "buffalo:green:power", - .gpio = BHR_4GRV2_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, - { - .name = "buffalo:red:diag", - .gpio = BHR_4GRV2_GPIO_LED_DIAG_RED, - .active_low = 1, - } -}; - -static struct gpio_keys_button bhr_4grv2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = BHR_4GRV2_KEYS_DEBOUNCE_INTERVAL, - .gpio = BHR_4GRV2_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "ECO button", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = BHR_4GRV2_KEYS_DEBOUNCE_INTERVAL, - .gpio = BHR_4GRV2_GPIO_BTN_ECO, - .active_low = 1, - }, -}; - -/* GMAC0 of the AR8327 switch is connected to GMAC1 via SGMII */ -static struct ar8327_pad_cfg bhr_4grv2_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -/* GMAC6 of the AR8327 switch is connected to GMAC0 via RGMII */ -static struct ar8327_pad_cfg bhr_4grv2_ar8327_pad6_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data bhr_4grv2_ar8327_data = { - .pad0_cfg = &bhr_4grv2_ar8327_pad0_cfg, - .pad6_cfg = &bhr_4grv2_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info bhr_4grv2_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "bhr_4grv2", - .mdio_addr = 0, - .platform_data = &bhr_4grv2_ar8327_data, - }, -}; - -static void __init bhr_4grv2_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(bhr_4grv2_leds_gpio), - bhr_4grv2_leds_gpio); - ath79_register_gpio_keys_polled(-1, BHR_4GRV2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(bhr_4grv2_gpio_keys), - bhr_4grv2_gpio_keys); - - mdiobus_register_board_info(bhr_4grv2_mdio0_info, - ARRAY_SIZE(bhr_4grv2_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - /* GMAC0 is connected to the RGMII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x56000000; - - ath79_init_mac(ath79_eth0_data.mac_addr, art + BHR_4GRV2_MAC0_OFFSET, 0); - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_init_mac(ath79_eth1_data.mac_addr, art + BHR_4GRV2_MAC1_OFFSET, 0); - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_BHR_4GRV2, "BHR-4GRV2", - "Buffalo BHR-4GRV2", bhr_4grv2_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-c60.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-c60.c deleted file mode 100644 index 661a5d567..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-c60.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * AirTight Networks C-60 board support - * - * Copyright (C) 2016 Christian Lamparter - * - * Based on AirTight Networks C-55 board support - * - * Copyright (C) 2014-2015 Chris Blake - * - * 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 "common.h" -#include "pci.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-spi.h" -#include "dev-wmac.h" -#include "dev-usb.h" -#include "dev-nfc.h" -#include "machtypes.h" - -#define C60_GPIO_LED_PWR_AMBER 11 -#define C60_GPIO_LED_WLAN2_GREEN 12 -#define C60_GPIO_LED_WLAN2_AMBER 13 -#define C60_GPIO_LED_PWR_GREEN 16 - -#define C60_GPIO_BTN_RESET 17 - -/* GPIOs of the AR9300 PCIe chip */ -#define C60_GPIO_WMAC_LED_WLAN1_AMBER 0 -#define C60_GPIO_WMAC_LED_WLAN1_GREEN 3 - -#define C60_KEYS_POLL_INTERVAL 20 /* msecs */ -#define C60_KEYS_DEBOUNCE_INTERVAL (3 * C60_KEYS_POLL_INTERVAL) - -#define C60_ART_ADDR 0x1f7f0000 -#define C60_ART_SIZE 0xffff -#define C60_MAC_OFFSET 0 -#define C60_WMAC_CALDATA_OFFSET 0x1000 -#define C60_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led c60_leds_gpio[] __initdata = { - { - .name = "c-60:amber:pwr", - .gpio = C60_GPIO_LED_PWR_AMBER, - .active_low = 1, - }, - { - .name = "c-60:green:pwr", - .gpio = C60_GPIO_LED_PWR_GREEN, - .active_low = 1, - }, - { - .name = "c-60:green:wlan2", - .gpio = C60_GPIO_LED_WLAN2_GREEN, - .active_low = 1, - }, - { - .name = "c-60:amber:wlan2", - .gpio = C60_GPIO_LED_WLAN2_AMBER, - .active_low = 1, - }, -}; - -static struct gpio_keys_button c60_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = C60_KEYS_DEBOUNCE_INTERVAL, - .gpio = C60_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg c60_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data c60_ar8327_data = { - .pad0_cfg = &c60_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - } -}; - -static struct mdio_board_info c60_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "c60", - .mdio_addr = 0, - .platform_data = &c60_ar8327_data, - }, -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -static struct nand_ecclayout c60_nand_ecclayout = { - .eccbytes = 7, - .eccpos = { 4, 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 3 }, { 6, 2 }, { 11, 2 }, } -}; - -#else - -static int c60_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 4; - oobregion->length = 1; - return 0; - case 1: - oobregion->offset = 8; - oobregion->length = 3; - return 0; - case 2: - oobregion->offset = 13; - oobregion->length = 3; - return 0; - default: - return -ERANGE; - } -} - -static int c60_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 0; - oobregion->length = 3; - return 0; - case 1: - oobregion->offset = 6; - oobregion->length = 2; - return 0; - case 2: - oobregion->offset = 11; - oobregion->length = 2; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops c60_nand_ecclayout_ops = { - .ecc = c60_ooblayout_ecc, - .free = c60_ooblayout_free, -}; -#endif /* < 4.6 */ - -static int c60_nand_scan_fixup(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct nand_chip *chip = mtd->priv; -#else - struct nand_chip *chip = mtd_to_nand(mtd); -#endif - - chip->ecc.size = 512; - chip->ecc.strength = 4; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - chip->ecc.layout = &c60_nand_ecclayout; -#else - mtd_set_ooblayout(mtd, &c60_nand_ecclayout_ops); -#endif - return 0; -} - -static struct gpio_led c60_wmac0_leds_gpio[] = { - { - .name = "c-60:amber:wlan1", - .gpio = C60_GPIO_WMAC_LED_WLAN1_AMBER, - .active_low = 1, - }, - { - .name = "c-60:green:wlan1", - .gpio = C60_GPIO_WMAC_LED_WLAN1_GREEN, - .active_low = 1, - }, -}; - -static void __init c60_setup(void) -{ - u8 tmpmac[6]; - u8 *art = (u8 *) KSEG1ADDR(C60_ART_ADDR); - - /* NAND */ - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_SOFT_BCH); - ath79_nfc_set_scan_fixup(c60_nand_scan_fixup); - ath79_register_nfc(); - - /* SPI Storage*/ - ath79_register_m25p80(NULL); - - /* AR8327 Switch Ethernet */ - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - mdiobus_register_board_info(c60_mdio0_info, - ARRAY_SIZE(c60_mdio0_info)); - - ath79_register_mdio(0, 0x0); - - /* GMAC0 is connected to an AR8327N switch */ - ath79_init_mac(ath79_eth0_data.mac_addr, art + C60_MAC_OFFSET, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); - - /* LEDs & GPIO */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(c60_leds_gpio), - c60_leds_gpio); - ath79_register_gpio_keys_polled(-1, C60_KEYS_POLL_INTERVAL, - ARRAY_SIZE(c60_gpio_keys), - c60_gpio_keys); - ap9x_pci_setup_wmac_leds(0, c60_wmac0_leds_gpio, - ARRAY_SIZE(c60_wmac0_leds_gpio)); - /* USB */ - ath79_register_usb(); - - /* WiFi */ - ath79_init_mac(tmpmac, art + C60_MAC_OFFSET, 1); - ap91_pci_init(art + C60_PCIE_CALDATA_OFFSET, tmpmac); - ath79_init_mac(tmpmac, art + C60_MAC_OFFSET, 2); - ath79_register_wmac(art + C60_WMAC_CALDATA_OFFSET, tmpmac); -} -MIPS_MACHINE(ATH79_MACH_C60, "C-60", "AirTight Networks C-60", - c60_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cf-e316n-v2.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cf-e316n-v2.c deleted file mode 100644 index cde91dc74..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cf-e316n-v2.c +++ /dev/null @@ -1,768 +0,0 @@ -/* - * Support for COMFAST boards: - * - CF-E316N v2 (AR9341) - * - CF-E320N v2 (QCA9531) - * - CF-E355AC v1 (QCA9531 + QCA9882) - * - CF-E355AC v2 (QCA9531 + QCA9886) - * - CF-E375AC (QCA9563 + QCA9886 + QCA8337) - * - CF-E380AC v1/v2 (QCA9558) - * - CF-E385AC (QCA9558 + QCA9984 + QCA8337) - * - CF-E520N/CF-E530N (QCA9531) - * - * Copyright (C) 2016 Piotr Dymacz - * Copyright (C) 2016 Gareth Parker - * Copyright (C) 2015 Paul Fertser - * - * 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 "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 "pci.h" - -#define CF_EXXXN_KEYS_POLL_INTERVAL 20 -#define CF_EXXXN_KEYS_DEBOUNCE_INTERVAL (3 * CF_EXXXN_KEYS_POLL_INTERVAL) - -/* CF-E316N v2 */ -#define CF_E316N_V2_GPIO_LED_DIAG_B 0 -#define CF_E316N_V2_GPIO_LED_DIAG_R 2 -#define CF_E316N_V2_GPIO_LED_DIAG_G 3 -#define CF_E316N_V2_GPIO_LED_WLAN 12 -#define CF_E316N_V2_GPIO_LED_WAN 17 -#define CF_E316N_V2_GPIO_LED_LAN 19 - -#define CF_E316N_V2_GPIO_EXT_WDT 16 - -#define CF_E316N_V2_GPIO_EXTERNAL_PA0 13 -#define CF_E316N_V2_GPIO_EXTERNAL_PA1 14 - -#define CF_E316N_V2_GPIO_BTN_RESET 20 - -static struct gpio_led cf_e316n_v2_leds_gpio[] __initdata = { - { - .name = "cf-e316n-v2:blue:diag", - .gpio = CF_E316N_V2_GPIO_LED_DIAG_B, - .active_low = 0, - }, { - .name = "cf-e316n-v2:red:diag", - .gpio = CF_E316N_V2_GPIO_LED_DIAG_R, - .active_low = 0, - }, { - .name = "cf-e316n-v2:green:diag", - .gpio = CF_E316N_V2_GPIO_LED_DIAG_G, - .active_low = 0, - }, { - .name = "cf-e316n-v2:blue:wlan", - .gpio = CF_E316N_V2_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "cf-e316n-v2:blue:wan", - .gpio = CF_E316N_V2_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "cf-e316n-v2:blue:lan", - .gpio = CF_E316N_V2_GPIO_LED_LAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button cf_e316n_v2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, - .gpio = CF_E316N_V2_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -/* CF-E320N v2 */ -#define CF_E320N_V2_GPIO_LED_WLAN 0 -#define CF_E320N_V2_GPIO_LED_WAN 2 -#define CF_E320N_V2_GPIO_LED_LAN 3 - -#define CF_E320N_V2_GPIO_HEADER_J9_1 14 -#define CF_E320N_V2_GPIO_HEADER_J9_2 12 -#define CF_E320N_V2_GPIO_HEADER_J9_3 11 -#define CF_E320N_V2_GPIO_HEADER_J9_4 16 - -#define CF_E320N_V2_GPIO_EXT_WDT 13 - -#define CF_E320N_V2_GPIO_BTN_RESET 17 - -static struct gpio_led cf_e320n_v2_leds_gpio[] __initdata = { - { - .name = "cf-e320n-v2:green:lan", - .gpio = CF_E320N_V2_GPIO_LED_LAN, - .active_low = 0, - }, { - .name = "cf-e320n-v2:red:wan", - .gpio = CF_E320N_V2_GPIO_LED_WAN, - .active_low = 0, - }, { - .name = "cf-e320n-v2:blue:wlan", - .gpio = CF_E320N_V2_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button cf_e320n_v2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, - .gpio = CF_E320N_V2_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -/* CF-E355AC v1/v2 */ -#define CF_E355AC_GPIO_LED_LAN 3 -#define CF_E355AC_GPIO_LED_WLAN2G 0 -#define CF_E355AC_GPIO_LED_WLAN5G 2 - -#define CF_E355AC_GPIO_EXT_WDT 13 - -#define CF_E355AC_GPIO_BTN_RESET 17 - -static struct gpio_led cf_e355ac_v1_leds_gpio[] __initdata = { - { - .name = "cf-e355ac-v1:green:lan", - .gpio = CF_E355AC_GPIO_LED_LAN, - .active_low = 0, - }, { - .name = "cf-e355ac-v1:blue:wlan2g", - .gpio = CF_E355AC_GPIO_LED_WLAN2G, - .active_low = 0, - }, { - .name = "cf-e355ac-v1:red:wlan5g", - .gpio = CF_E355AC_GPIO_LED_WLAN5G, - .active_low = 0, - }, -}; - -static struct gpio_led cf_e355ac_v2_leds_gpio[] __initdata = { - { - .name = "cf-e355ac-v2:green:lan", - .gpio = CF_E355AC_GPIO_LED_LAN, - .active_low = 0, - }, { - .name = "cf-e355ac-v2:blue:wlan2g", - .gpio = CF_E355AC_GPIO_LED_WLAN2G, - .active_low = 0, - }, { - .name = "cf-e355ac-v2:red:wlan5g", - .gpio = CF_E355AC_GPIO_LED_WLAN5G, - .active_low = 0, - }, -}; - -static struct gpio_keys_button cf_e355ac_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, - .gpio = CF_E355AC_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -/* CF-E375AC */ -#define CF_E375AC_GPIO_LED_LAN 17 -#define CF_E375AC_GPIO_LED_WLAN2G 16 -#define CF_E375AC_GPIO_LED_WLAN5G 15 - -#define CF_E375AC_GPIO_EXT_WDT 6 - -#define CF_E375AC_GPIO_BTN_RESET 2 - -static struct gpio_led cf_e375ac_leds_gpio[] __initdata = { - { - .name = "cf-e375ac:green:lan", - .gpio = CF_E375AC_GPIO_LED_LAN, - .active_low = 0, - }, { - .name = "cf-e375ac:red:wlan5g", - .gpio = CF_E375AC_GPIO_LED_WLAN5G, - .active_low = 0, - }, { - .name = "cf-e375ac:blue:wlan2g", - .gpio = CF_E375AC_GPIO_LED_WLAN2G, - .active_low = 0, - }, -}; - -static struct gpio_keys_button cf_e375ac_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, - .gpio = CF_E375AC_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg cf_e375ac_ar8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data cf_e375ac_ar8337_data = { - .pad0_cfg = &cf_e375ac_ar8337_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info cf_e375ac_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "cf_e375ac", - .mdio_addr = 0, - .platform_data = &cf_e375ac_ar8337_data, - }, -}; - -/* CF-E380AC v1/v2, CF-E385AC */ -#define CF_E38XAC_GPIO_LED_LAN 0 -#define CF_E38XAC_GPIO_LED_WLAN2G 2 -#define CF_E38XAC_GPIO_LED_WLAN5G 3 - -#define CF_E38XAC_GPIO_EXT_WDT 17 - -#define CF_E38XAC_GPIO_BTN_RESET 19 - -static struct gpio_led cf_e380ac_v1_leds_gpio[] __initdata = { - { - .name = "cf-e380ac-v1:green:lan", - .gpio = CF_E38XAC_GPIO_LED_LAN, - .active_low = 0, - }, { - .name = "cf-e380ac-v1:blue:wlan2g", - .gpio = CF_E38XAC_GPIO_LED_WLAN2G, - .active_low = 0, - }, { - .name = "cf-e380ac-v1:red:wlan5g", - .gpio = CF_E38XAC_GPIO_LED_WLAN5G, - .active_low = 0, - }, -}; - -static struct gpio_led cf_e380ac_v2_leds_gpio[] __initdata = { - { - .name = "cf-e380ac-v2:green:lan", - .gpio = CF_E38XAC_GPIO_LED_LAN, - .active_low = 0, - }, { - .name = "cf-e380ac-v2:blue:wlan2g", - .gpio = CF_E38XAC_GPIO_LED_WLAN2G, - .active_low = 0, - }, { - .name = "cf-e380ac-v2:red:wlan5g", - .gpio = CF_E38XAC_GPIO_LED_WLAN5G, - .active_low = 0, - }, -}; - -static struct gpio_led cf_e385ac_leds_gpio[] __initdata = { - { - .name = "cf-e385ac:green:lan", - .gpio = CF_E38XAC_GPIO_LED_LAN, - .active_low = 0, - }, { - .name = "cf-e385ac:blue:wlan2g", - .gpio = CF_E38XAC_GPIO_LED_WLAN2G, - .active_low = 0, - }, { - .name = "cf-e385ac:red:wlan5g", - .gpio = CF_E38XAC_GPIO_LED_WLAN5G, - .active_low = 0, - }, -}; - -static struct gpio_keys_button cf_e38xac_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, - .gpio = CF_E38XAC_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct at803x_platform_data cf_e380ac_v1v2_at803x_data = { - .disable_smarteee = 1, -}; - -static struct mdio_board_info cf_e380ac_v1v2_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "cf_e380ac_v1v2", - .mdio_addr = 0, - .platform_data = &cf_e380ac_v1v2_at803x_data, - }, -}; - -/* CF-E520N/CF-E530N */ -#define CF_E5X0N_GPIO_LED_WAN 11 -#define CF_E5X0N_GPIO_BTN_RESET 17 - -static struct gpio_led cf_e520n_leds_gpio[] __initdata = { - { - .name = "cf-e520n:blue:wan", - .gpio = CF_E5X0N_GPIO_LED_WAN, - .active_low = 1, - } -}; - -static struct gpio_led cf_e530n_leds_gpio[] __initdata = { - { - .name = "cf-e530n:blue:wan", - .gpio = CF_E5X0N_GPIO_LED_WAN, - .active_low = 1, - } -}; - -/* - * Some COMFAST devices include external hardware watchdog chip, - * Pericon Technology PT7A7514, connected to a selected GPIO - * and WiSoC RESET_L input. Watchdog time-out is ~1.6 s. - */ -#define CF_EXXXN_EXT_WDT_TIMEOUT_MS 500 - -static struct timer_list gpio_wdt_timer; - -static void gpio_wdt_toggle(unsigned long gpio) -{ - static int state; - - state = !state; - gpio_set_value(gpio, state); - - mod_timer(&gpio_wdt_timer, - jiffies + msecs_to_jiffies(CF_EXXXN_EXT_WDT_TIMEOUT_MS)); -} - -static void __init cf_exxxn_common_setup(unsigned long art_ofs, int gpio_wdt) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f001000 + art_ofs); - - if (gpio_wdt > -1) { - gpio_request_one(gpio_wdt, GPIOF_OUT_INIT_HIGH, - "PT7A7514 watchdog"); - - setup_timer(&gpio_wdt_timer, gpio_wdt_toggle, gpio_wdt); - gpio_wdt_toggle(gpio_wdt); - } - - ath79_register_m25p80(NULL); - - ath79_register_wmac(art, NULL); - - ath79_register_usb(); -} - -static void __init cf_e316n_v2_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f010000); - - cf_exxxn_common_setup(0x10000, CF_E316N_V2_GPIO_EXT_WDT); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - /* GMAC0 is connected to the PHY0 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2); - ath79_register_eth(1); - - /* Enable 2x Skyworks SE2576L WLAN power amplifiers */ - gpio_request_one(CF_E316N_V2_GPIO_EXTERNAL_PA0, GPIOF_OUT_INIT_HIGH, - "WLAN PA0"); - gpio_request_one(CF_E316N_V2_GPIO_EXTERNAL_PA1, GPIOF_OUT_INIT_HIGH, - "WLAN PA1"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e316n_v2_leds_gpio), - cf_e316n_v2_leds_gpio); - - ath79_register_gpio_keys_polled(1, CF_EXXXN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cf_e316n_v2_gpio_keys), - cf_e316n_v2_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_CF_E316N_V2, "CF-E316N-V2", "COMFAST CF-E316N v2", - cf_e316n_v2_setup); - -static void __init cf_exxxn_qca953x_eth_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f010000); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask |= BIT(4); - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2); - ath79_register_eth(1); - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); -} - -static void __init cf_e320n_v2_setup(void) -{ - cf_exxxn_common_setup(0x10000, CF_E320N_V2_GPIO_EXT_WDT); - - cf_exxxn_qca953x_eth_setup(); - - /* Disable JTAG (enables GPIO0-3) */ - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_LAN, true); - ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_WAN, true); - ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_WLAN, true); - - ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_LAN, 0); - ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_WAN, 0); - ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_WLAN, 0); - - /* Enable GPIO function for GPIOs in J9 header */ - ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_1, 0); - ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_2, 0); - ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_3, 0); - ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_4, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e320n_v2_leds_gpio), - cf_e320n_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cf_e320n_v2_gpio_keys), - cf_e320n_v2_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_CF_E320N_V2, "CF-E320N-V2", "COMFAST CF-E320N v2", - cf_e320n_v2_setup); - -static void __init cf_e355ac_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f010000); - - /* Disable JTAG, enabling GPIOs 0-3 */ - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, 0); - - cf_exxxn_common_setup(0x10000, CF_E355AC_GPIO_EXT_WDT); - - cf_exxxn_qca953x_eth_setup(); - - ath79_gpio_output_select(CF_E355AC_GPIO_LED_LAN, 0); - ath79_gpio_output_select(CF_E355AC_GPIO_LED_WLAN2G, 0); - ath79_gpio_output_select(CF_E355AC_GPIO_LED_WLAN5G, 0); - - ap91_pci_init(art + 0x5000, NULL); - - ath79_register_gpio_keys_polled(1, CF_EXXXN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cf_e355ac_gpio_keys), - cf_e355ac_gpio_keys); -} - -static void __init cf_e355ac_v1_setup(void) -{ - cf_e355ac_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e355ac_v1_leds_gpio), - cf_e355ac_v1_leds_gpio); -} - -static void __init cf_e355ac_v2_setup(void) -{ - cf_e355ac_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e355ac_v2_leds_gpio), - cf_e355ac_v2_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_CF_E355AC, "CF-E355AC-V1", "COMFAST CF-E355AC v1", - cf_e355ac_v1_setup); - -MIPS_MACHINE(ATH79_MACH_CF_E355AC_V2, "CF-E355AC-V2", "COMFAST CF-E355AC v2", - cf_e355ac_v2_setup); - -static void __init cf_e375ac_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f040000); - - /* Disable JTAG, enabling GPIOs 0-3 */ - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, 0); - - cf_exxxn_common_setup(0x40000, CF_E375AC_GPIO_EXT_WDT); - - ath79_gpio_output_select(CF_E375AC_GPIO_LED_LAN, 0); - ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN2G, 0); - ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN5G, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e375ac_leds_gpio), - cf_e375ac_leds_gpio); - - ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cf_e375ac_gpio_keys), - cf_e375ac_gpio_keys); - - platform_device_register(&ath79_mdio0_device); - - mdiobus_register_board_info(cf_e375ac_mdio0_info, - ARRAY_SIZE(cf_e375ac_mdio0_info)); - - /* GMAC0 is connected to an AR8337 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_CF_E375AC, "CF-E375AC", "COMFAST CF-E375AC", - cf_e375ac_setup); - -static void __init cf_e38xac_common_setup(unsigned long art_ofs) -{ - cf_exxxn_common_setup(art_ofs, CF_E38XAC_GPIO_EXT_WDT); - - ath79_register_pci(); - - /* Disable JTAG (enables GPIO0-3) */ - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_gpio_direction_select(CF_E38XAC_GPIO_LED_LAN, true); - ath79_gpio_direction_select(CF_E38XAC_GPIO_LED_WLAN2G, true); - ath79_gpio_direction_select(CF_E38XAC_GPIO_LED_WLAN5G, true); - - ath79_gpio_output_select(CF_E38XAC_GPIO_LED_LAN, 0); - ath79_gpio_output_select(CF_E38XAC_GPIO_LED_WLAN2G, 0); - ath79_gpio_output_select(CF_E38XAC_GPIO_LED_WLAN5G, 0); - - /* For J7-4 */ - ath79_gpio_function_disable(AR934X_GPIO_FUNC_CLK_OBS4_EN); - - ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cf_e38xac_gpio_keys), - cf_e38xac_gpio_keys); -} - -static void __init cf_e380ac_v1v2_common_setup(unsigned long art_ofs) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f000000 + art_ofs); - - cf_e38xac_common_setup(art_ofs); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(cf_e380ac_v1v2_mdio0_info, - ARRAY_SIZE(cf_e380ac_v1v2_mdio0_info)); - - /* LAN */ - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_pll_data.pll_1000 = 0xbe000000; - ath79_eth0_pll_data.pll_100 = 0xb0000101; - ath79_eth0_pll_data.pll_10 = 0xb0001313; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); -} - -static void __init cf_e380ac_v1_setup(void) -{ - cf_e380ac_v1v2_common_setup(0x20000); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e380ac_v1_leds_gpio), - cf_e380ac_v1_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_CF_E380AC_V1, "CF-E380AC-V1", "COMFAST CF-E380AC v1", - cf_e380ac_v1_setup); - -static void __init cf_e380ac_v2_setup(void) -{ - cf_e380ac_v1v2_common_setup(0x40000); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e380ac_v2_leds_gpio), - cf_e380ac_v2_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_CF_E380AC_V2, "CF-E380AC-V2", "COMFAST CF-E380AC v2", - cf_e380ac_v2_setup); - -/* QCA8337 GMAC0 is connected with QCA9558 over RGMII */ -static struct ar8327_pad_cfg cf_e385ac_qca8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL1, -}; - -/* QCA8337 GMAC6 is connected with QCA9558 over SGMII */ -static struct ar8327_pad_cfg cf_e385ac_qca8337_pad6_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, -}; - -static struct ar8327_platform_data cf_e385ac_qca8337_data = { - .pad0_cfg = &cf_e385ac_qca8337_pad0_cfg, - .pad6_cfg = &cf_e385ac_qca8337_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info cf_e385ac_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "cf_e385ac", - .mdio_addr = 0, - .platform_data = &cf_e385ac_qca8337_data, - }, -}; - -static void __init cf_e385ac_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f040000); - - cf_e38xac_common_setup(0x40000); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e385ac_leds_gpio), - cf_e385ac_leds_gpio); - - mdiobus_register_board_info(cf_e385ac_mdio0_info, - ARRAY_SIZE(cf_e385ac_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - /* QCA9558 GMAC0 is connected to RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x96000000; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); - - /* QCA9558 GMAC1 is connected to SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_CF_E385AC, "CF-E385AC", "COMFAST CF-E385AC", - cf_e385ac_setup); - -static void __init cf_e5x0n_gpio_setup(void) -{ - ath79_gpio_direction_select(CF_E5X0N_GPIO_LED_WAN, true); - - ath79_gpio_output_select(CF_E5X0N_GPIO_LED_WAN, 0); - - ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cf_e320n_v2_gpio_keys), - cf_e320n_v2_gpio_keys); -} - -static void __init cf_e520n_setup(void) -{ - cf_exxxn_common_setup(0x10000, -1); - - cf_exxxn_qca953x_eth_setup(); - - cf_e5x0n_gpio_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e520n_leds_gpio), - cf_e520n_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_CF_E520N, "CF-E520N", "COMFAST CF-E520N", - cf_e520n_setup); - -static void __init cf_e530n_setup(void) -{ - cf_exxxn_common_setup(0x10000, -1); - - cf_exxxn_qca953x_eth_setup(); - - cf_e5x0n_gpio_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e530n_leds_gpio), - cf_e530n_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_CF_E530N, "CF-E530N", "COMFAST CF-E530N", - cf_e530n_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cpe510.c deleted file mode 100644 index d2dbed1fe..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cpe510.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * TP-LINK CPE210/220/510/520 board support - * - * Copyright (C) 2014 Matthias Schiffer - * - * 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 CPE510_GPIO_LED_LAN0 11 -#define CPE510_GPIO_LED_LAN1 12 -#define CPE510_GPIO_LED_L1 13 -#define CPE510_GPIO_LED_L2 14 -#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 - -#define CPE510_GPIO_BTN_RESET 4 - -#define CPE510_KEYS_POLL_INTERVAL 20 /* msecs */ -#define CPE510_KEYS_DEBOUNCE_INTERVAL (3 * CPE510_KEYS_POLL_INTERVAL) - - -static struct gpio_led cpe510_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 = CPE510_GPIO_LED_L4, - .active_low = 1, - }, -}; - -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", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CPE510_KEYS_DEBOUNCE_INTERVAL, - .gpio = CPE510_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init cpe_setup(u8 *mac) -{ - /* Disable JTAG, enabling GPIOs 0-3 */ - /* Configure OBS4 line, for GPIO 4*/ - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, - AR934X_GPIO_FUNC_CLK_OBS4_EN); - - ath79_register_gpio_keys_polled(1, CPE510_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cpe510_gpio_keys), - cpe510_gpio_keys); - - ath79_wmac_set_ext_lna_gpio(0, CPE510_GPIO_EXTERNAL_LNA0); - ath79_wmac_set_ext_lna_gpio(1, CPE510_GPIO_EXTERNAL_LNA1); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); -} - - -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); -} - -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); -} - -MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220", - cpe210_setup); - -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-4.14/arch/mips/ath79/mach-cr5000.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cr5000.c deleted file mode 100644 index 536ceeebf..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cr5000.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * PowerCloud CR5000 support - * - * Copyright (c) 2011 Qualcomm Atheros - * Copyright (c) 2011-2012 Gabor Juhos - * Copyright (c) 2012-2013 PowerCloud Systems - * Copyright (c) 2015 Daniel Dickinson - * - * 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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define CR5000_GPIO_LED_WLAN_2G 14 -#define CR5000_GPIO_LED_WPS 12 -#define CR5000_GPIO_LED_POWER_AMBER 4 -/* GPIO2 has to have JTAG disabled as it is also to - * power led - */ -#define CR5000_GPIO_LED_POWER_ENABLE 2 -#define CR5000_GPIO_BTN_WPS 16 -#define CR5000_GPIO_BTN_RESET 17 - -#define CR5000_KEYS_POLL_INTERVAL 20 /* msecs */ -#define CR5000_KEYS_DEBOUNCE_INTERVAL (3 * CR5000_KEYS_POLL_INTERVAL) - -#define CR5000_MAC0_OFFSET 0 -#define CR5000_WMAC_CALDATA_OFFSET 0x1000 -#define CR5000_WMAC_MAC_OFFSET 0x1002 -#define CR5000_PCIE_CALDATA_OFFSET 0x5000 -#define CR5000_PCIE_MAC_OFFSET 0x5002 - -static struct gpio_led cr5000_leds_gpio[] __initdata = { - { - .name = "pcs:amber:power", - .gpio = CR5000_GPIO_LED_POWER_AMBER, - .active_low = 1, - }, - { - .name = "pcs:white:wps", - .gpio = CR5000_GPIO_LED_WPS, - .active_low = 1, - }, - { - .name = "pcs:blue:wlan", - .gpio = CR5000_GPIO_LED_WLAN_2G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button cr5000_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = CR5000_KEYS_DEBOUNCE_INTERVAL, - .gpio = CR5000_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = CR5000_KEYS_DEBOUNCE_INTERVAL, - .gpio = CR5000_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg cr5000_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg cr5000_ar8327_led_cfg = { - .led_ctrl0 = 0x00000000, - .led_ctrl1 = 0xc737c737, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x00c30c00, - .open_drain = true, -}; - -static struct ar8327_platform_data cr5000_ar8327_data = { - .pad0_cfg = &cr5000_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &cr5000_ar8327_led_cfg, -}; - -static struct mdio_board_info cr5000_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "cr5000", - .mdio_addr = 0, - .platform_data = &cr5000_ar8327_data, - }, -}; - -static void __init cr5000_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - gpio_request_one(CR5000_GPIO_LED_POWER_ENABLE, - GPIOF_OUT_INIT_LOW, "Power LED enable"); - ath79_gpio_output_select(CR5000_GPIO_LED_POWER_AMBER, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(CR5000_GPIO_LED_WLAN_2G, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(CR5000_GPIO_LED_WPS, AR934X_GPIO_OUT_GPIO); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cr5000_leds_gpio), - cr5000_leds_gpio); - ath79_register_gpio_keys_polled(-1, CR5000_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cr5000_gpio_keys), - cr5000_gpio_keys); - ath79_register_usb(); - ath79_register_wmac(art + CR5000_WMAC_CALDATA_OFFSET, art + CR5000_WMAC_MAC_OFFSET); - ap94_pci_init(NULL, NULL, NULL, art + CR5000_PCIE_MAC_OFFSET); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + CR5000_MAC0_OFFSET, 0); - - mdiobus_register_board_info(cr5000_mdio0_info, - ARRAY_SIZE(cr5000_mdio0_info)); - - /* GMAC0 is connected to an AR8327 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_CR5000, "CR5000", "PowerCloud CR5000", - cr5000_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dap-2695-a1.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dap-2695-a1.c deleted file mode 100644 index 1715a647e..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dap-2695-a1.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * D-Link DAP-2695 rev. A1 support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * Copyright (c) 2016 Stijn Tintel - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define DAP2695_GPIO_LED_GREEN_POWER 23 -#define DAP2695_GPIO_LED_RED_POWER 14 -#define DAP2695_GPIO_LED_WLAN_2G 13 - -#define DAP2695_GPIO_BTN_RESET 17 - -#define DAP2695_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DAP2695_KEYS_DEBOUNCE_INTERVAL (3 * DAP2695_KEYS_POLL_INTERVAL) - -#define DAP2695_NVRAM_ADDR 0x1f040000 -#define DAP2695_NVRAM_SIZE 0x10000 - -#define DAP2695_MAC0_OFFSET 1 -#define DAP2695_MAC1_OFFSET 2 -#define DAP2695_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led dap2695_leds_gpio[] __initdata = { - { - .name = "d-link:green:power", - .gpio = DAP2695_GPIO_LED_GREEN_POWER, - .active_low = 1, - }, - { - .name = "d-link:red:power", - .gpio = DAP2695_GPIO_LED_RED_POWER, - .active_low = 1, - }, - { - .name = "d-link:green:wlan2g", - .gpio = DAP2695_GPIO_LED_WLAN_2G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button dap2695_gpio_keys[] __initdata = { - { - .desc = "Soft reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DAP2695_KEYS_DEBOUNCE_INTERVAL, - .gpio = DAP2695_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg dap2695_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, - .mac06_exchange_dis = true, -}; - -static struct ar8327_pad_cfg dap2695_ar8327_pad6_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data dap2695_ar8327_data = { - .pad0_cfg = &dap2695_ar8327_pad0_cfg, - .pad6_cfg = &dap2695_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info dap2695_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dap2695", - .mdio_addr = 0, - .platform_data = &dap2695_ar8327_data, - }, -}; - -static struct flash_platform_data dap2695_flash_data = { - .type = "mx25l12805d", -}; - -static void dap2695_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(DAP2695_NVRAM_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, DAP2695_NVRAM_SIZE, - name, mac); - if (err) - pr_err("no MAC address found for %s\n", name); -} - -static void __init dap2695_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 mac0[ETH_ALEN], mac1[ETH_ALEN], wmac0[ETH_ALEN]; - - dap2695_get_mac("lanmac=", mac0); - dap2695_get_mac("wanmac=", mac1); - dap2695_get_mac("wlanmac=", wmac0); - - ath79_register_m25p80(&dap2695_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dap2695_leds_gpio), - dap2695_leds_gpio); - ath79_register_gpio_keys_polled(-1, DAP2695_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dap2695_gpio_keys), - dap2695_gpio_keys); - - ath79_register_wmac(art + DAP2695_WMAC_CALDATA_OFFSET, wmac0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(dap2695_mdio0_info, - ARRAY_SIZE(dap2695_mdio0_info)); - - /* GMAC0 is connected to the RGMII interface */ - ath79_init_mac(ath79_eth0_data.mac_addr, mac0, DAP2695_MAC0_OFFSET); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x56000000; - - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_init_mac(ath79_eth1_data.mac_addr, mac1, DAP2695_MAC1_OFFSET); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_register_eth(1); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_DAP_2695_A1, "DAP-2695-A1", - "D-Link DAP-2695 rev. A1", - dap2695_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dgl-5500-a1.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dgl-5500-a1.c deleted file mode 100644 index 0a4250254..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dgl-5500-a1.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * D-Link DGL-5500 board support - * - * Copyright (C) 2014 Gabor Juhos - * Copyright (C) 2014 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 "common.h" -#include "pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DGL_5500_A1_GPIO_LED_POWER_ORANGE 14 -#define DGL_5500_A1_GPIO_LED_POWER_GREEN 19 -#define DGL_5500_A1_GPIO_LED_PLANET_GREEN 22 -#define DGL_5500_A1_GPIO_LED_PLANET_ORANGE 23 - -#define DGL_5500_A1_GPIO_BTN_WPS 16 -#define DGL_5500_A1_GPIO_BTN_RESET 17 - -#define DGL_5500_A1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DGL_5500_A1_KEYS_DEBOUNCE_INTERVAL \ - (3 * DGL_5500_A1_KEYS_POLL_INTERVAL) - -#define DGL_5500_A1_WMAC_CALDATA_OFFSET 0x1000 - -#define DGL_5500_A1_LAN_MAC_OFFSET 0x04 -#define DGL_5500_A1_WAN_MAC_OFFSET 0x16 - -static struct gpio_led dgl_5500_a1_leds_gpio[] __initdata = { - { - .name = "d-link:green:power", - .gpio = DGL_5500_A1_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, - { - .name = "d-link:orange:power", - .gpio = DGL_5500_A1_GPIO_LED_POWER_ORANGE, - .active_low = 1, - }, - { - .name = "d-link:green:planet", - .gpio = DGL_5500_A1_GPIO_LED_PLANET_GREEN, - .active_low = 1, - }, - { - .name = "d-link:orange:planet", - .gpio = DGL_5500_A1_GPIO_LED_PLANET_ORANGE, - .active_low = 1, - }, -}; - -static struct gpio_keys_button dgl_5500_a1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DGL_5500_A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DGL_5500_A1_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DGL_5500_A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DGL_5500_A1_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg dgl_5500_a1_ar8327_pad0_cfg = { - /* Use the SGMII interface for the GMAC0 of the AR8327 switch */ - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data dgl_5500_a1_ar8327_data = { - .pad0_cfg = &dgl_5500_a1_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info dgl_5500_a1_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dgl_5500_a1", - .mdio_addr = 0, - .platform_data = &dgl_5500_a1_ar8327_data, - }, -}; - -static void __init dgl_5500_a1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1ffe0000); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 lan_mac[ETH_ALEN]; - - ath79_parse_ascii_mac(mac + DGL_5500_A1_LAN_MAC_OFFSET, lan_mac); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dgl_5500_a1_leds_gpio), - dgl_5500_a1_leds_gpio); - ath79_register_gpio_keys_polled(-1, DGL_5500_A1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dgl_5500_a1_gpio_keys), - dgl_5500_a1_gpio_keys); - - ath79_register_wmac(art + DGL_5500_A1_WMAC_CALDATA_OFFSET, lan_mac); - - ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(dgl_5500_a1_mdio0_info, - ARRAY_SIZE(dgl_5500_a1_mdio0_info)); - - ath79_init_mac(ath79_eth1_data.mac_addr, lan_mac, 0); - - /* GMAC1 is connected to an AR8327N switch via the SMGII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.phy_mask = BIT(0); - ath79_eth1_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_register_eth(1); - - ath79_register_usb(); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_DGL_5500_A1, "DGL-5500-A1", "D-Link DGL-5500 rev. A1", - dgl_5500_a1_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dhp-1565-a1.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dhp-1565-a1.c deleted file mode 100644 index e7d26468d..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dhp-1565-a1.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * D-Link DHP-1565 rev. A1 board support - * - * Copyright (C) 2014 Jacek Kikiewicz - * - * 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DHP1565A1_GPIO_LED_BLUE_USB 11 -#define DHP1565A1_GPIO_LED_AMBER_POWER 14 -#define DHP1565A1_GPIO_LED_BLUE_POWER 22 -#define DHP1565A1_GPIO_LED_BLUE_WPS 15 -#define DHP1565A1_GPIO_LED_AMBER_PLANET 19 -#define DHP1565A1_GPIO_LED_BLUE_PLANET 18 -#define DHP1565A1_GPIO_LED_WLAN_2G 13 - -#define DHP1565A1_GPIO_WAN_LED_ENABLE 20 - -#define DHP1565A1_GPIO_BTN_RESET 17 -#define DHP1565A1_GPIO_BTN_WPS 16 - -#define DHP1565A1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DHP1565A1_KEYS_DEBOUNCE_INTERVAL (3 * DHP1565A1_KEYS_POLL_INTERVAL) - -#define DHP1565A1_MAC0_OFFSET 0xFFA0 -#define DHP1565A1_MAC1_OFFSET 0xFFB4 -#define DHP1565A1_WMAC0_OFFSET 0x5 -#define DHP1565A1_WMAC_CALDATA_OFFSET 0x1000 -#define DHP1565A1_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led dhp1565a1_leds_gpio[] __initdata = { - { - .name = "d-link:amber:power", - .gpio = DHP1565A1_GPIO_LED_AMBER_POWER, - .active_low = 1, - }, - { - .name = "d-link:green:power", - .gpio = DHP1565A1_GPIO_LED_BLUE_POWER, - .active_low = 1, - }, - { - .name = "d-link:amber:planet", - .gpio = DHP1565A1_GPIO_LED_AMBER_PLANET, - .active_low = 1, - }, - { - .name = "d-link:green:planet", - .gpio = DHP1565A1_GPIO_LED_BLUE_PLANET, - .active_low = 1, - }, -}; - -static struct gpio_keys_button dhp1565a1_gpio_keys[] __initdata = { - { - .desc = "Soft reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DHP1565A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DHP1565A1_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DHP1565A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DHP1565A1_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg dhp1565a1_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data dhp1565a1_ar8327_data = { - .pad0_cfg = &dhp1565a1_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info dhp1565a1_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dhp1565a1", - .mdio_addr = 0, - .platform_data = &dhp1565a1_ar8327_data, - }, -}; - -static void __init dhp1565a1_generic_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1ffe0000); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 mac0[ETH_ALEN], mac1[ETH_ALEN]; - u8 wmac0[ETH_ALEN]; - - ath79_parse_ascii_mac(mac + DHP1565A1_MAC0_OFFSET, mac0); - ath79_parse_ascii_mac(mac + DHP1565A1_MAC1_OFFSET, mac1); - - ath79_register_m25p80(NULL); - - ath79_register_gpio_keys_polled(-1, DHP1565A1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dhp1565a1_gpio_keys), - dhp1565a1_gpio_keys); - - ath79_init_mac(wmac0, mac0, 0); - ath79_register_wmac(art + DHP1565A1_WMAC_CALDATA_OFFSET, wmac0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - mdiobus_register_board_info(dhp1565a1_mdio0_info, - ARRAY_SIZE(dhp1565a1_mdio0_info)); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac0, 1); - - /* GMAC0 is connected to an AR8327N switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); - - ath79_register_usb(); -} - -static void __init dhp1565a1_setup(void) -{ - ath79_register_leds_gpio(-1, ARRAY_SIZE(dhp1565a1_leds_gpio), - dhp1565a1_leds_gpio); - - dhp1565a1_generic_setup(); -} - -MIPS_MACHINE(ATH79_MACH_DHP_1565_A1, "DHP-1565-A1", - "D-Link DHP-1565 rev. A1", - dhp1565a1_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-825-c1.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-825-c1.c deleted file mode 100644 index 627ae245e..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-825-c1.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * D-Link DIR-825 rev. C1 board support - * - * Copyright (C) 2013 Alexander Stadler - * - * 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DIR825C1_GPIO_LED_BLUE_USB 11 -#define DIR825C1_GPIO_LED_AMBER_POWER 14 -#define DIR825C1_GPIO_LED_BLUE_POWER 22 -#define DIR825C1_GPIO_LED_BLUE_WPS 15 -#define DIR825C1_GPIO_LED_AMBER_PLANET 19 -#define DIR825C1_GPIO_LED_BLUE_PLANET 18 -#define DIR825C1_GPIO_LED_WLAN_2G 13 - -#define DIR825C1_GPIO_WAN_LED_ENABLE 20 - -#define DIR825C1_GPIO_BTN_RESET 17 -#define DIR825C1_GPIO_BTN_WPS 16 - -#define DIR825C1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DIR825C1_KEYS_DEBOUNCE_INTERVAL (3 * DIR825C1_KEYS_POLL_INTERVAL) - -#define DIR825C1_MAC0_OFFSET 0x4 -#define DIR825C1_MAC1_OFFSET 0x18 -#define DIR825C1_WMAC_CALDATA_OFFSET 0x1000 -#define DIR825C1_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led dir825c1_leds_gpio[] __initdata = { - { - .name = "d-link:blue:usb", - .gpio = DIR825C1_GPIO_LED_BLUE_USB, - .active_low = 1, - }, - { - .name = "d-link:amber:power", - .gpio = DIR825C1_GPIO_LED_AMBER_POWER, - .active_low = 1, - }, - { - .name = "d-link:blue:power", - .gpio = DIR825C1_GPIO_LED_BLUE_POWER, - .active_low = 1, - }, - { - .name = "d-link:blue:wps", - .gpio = DIR825C1_GPIO_LED_BLUE_WPS, - .active_low = 1, - }, - { - .name = "d-link:amber:planet", - .gpio = DIR825C1_GPIO_LED_AMBER_PLANET, - .active_low = 1, - }, - { - .name = "d-link:blue:wlan2g", - .gpio = DIR825C1_GPIO_LED_WLAN_2G, - .active_low = 1, - }, -}; - -static struct gpio_led dir835a1_leds_gpio[] __initdata = { - { - .name = "d-link:amber:power", - .gpio = DIR825C1_GPIO_LED_AMBER_POWER, - .active_low = 1, - }, - { - .name = "d-link:green:power", - .gpio = DIR825C1_GPIO_LED_BLUE_POWER, - .active_low = 1, - }, - { - .name = "d-link:blue:wps", - .gpio = DIR825C1_GPIO_LED_BLUE_WPS, - .active_low = 1, - }, - { - .name = "d-link:amber:planet", - .gpio = DIR825C1_GPIO_LED_AMBER_PLANET, - .active_low = 1, - }, - { - .name = "d-link:green:planet", - .gpio = DIR825C1_GPIO_LED_BLUE_PLANET, - .active_low = 1, - }, -}; - -static struct gpio_keys_button dir825c1_gpio_keys[] __initdata = { - { - .desc = "Soft reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DIR825C1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR825C1_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DIR825C1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR825C1_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg dir825c1_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg dir825c1_ar8327_led_cfg = { - .led_ctrl0 = 0x00000000, - .led_ctrl1 = 0xc737c737, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x00c30c00, - .open_drain = true, -}; - -static struct ar8327_platform_data dir825c1_ar8327_data = { - .pad0_cfg = &dir825c1_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &dir825c1_ar8327_led_cfg, -}; - -static struct mdio_board_info dir825c1_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dir825c1", - .mdio_addr = 0, - .platform_data = &dir825c1_ar8327_data, - }, -}; - -static void __init dir825c1_generic_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1ffe0000); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 mac0[ETH_ALEN], mac1[ETH_ALEN]; - u8 wmac0[ETH_ALEN], wmac1[ETH_ALEN]; - - ath79_parse_ascii_mac(mac + DIR825C1_MAC0_OFFSET, mac0); - ath79_parse_ascii_mac(mac + DIR825C1_MAC1_OFFSET, mac1); - - ath79_register_m25p80(NULL); - - ath79_register_gpio_keys_polled(-1, DIR825C1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dir825c1_gpio_keys), - dir825c1_gpio_keys); - - ath79_init_mac(wmac0, mac0, 0); - ath79_register_wmac(art + DIR825C1_WMAC_CALDATA_OFFSET, wmac0); - - ath79_init_mac(wmac1, mac1, 1); - ap91_pci_init(art + DIR825C1_PCIE_CALDATA_OFFSET, wmac1); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - mdiobus_register_board_info(dir825c1_mdio0_info, - ARRAY_SIZE(dir825c1_mdio0_info)); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac0, 0); - - /* GMAC0 is connected to an AR8327N switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); - - ath79_register_usb(); -} - -static void __init dir825c1_setup(void) -{ - ath79_gpio_output_select(DIR825C1_GPIO_LED_BLUE_USB, - AR934X_GPIO_OUT_GPIO); - - gpio_request_one(DIR825C1_GPIO_WAN_LED_ENABLE, - GPIOF_OUT_INIT_LOW, "WAN LED enable"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dir825c1_leds_gpio), - dir825c1_leds_gpio); - - ap9x_pci_setup_wmac_led_pin(0, 0); - - dir825c1_generic_setup(); -} - -static void __init dir835a1_setup(void) -{ - dir825c1_ar8327_data.led_cfg = NULL; - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dir835a1_leds_gpio), - dir835a1_leds_gpio); - - dir825c1_generic_setup(); -} - -MIPS_MACHINE(ATH79_MACH_DIR_825_C1, "DIR-825-C1", - "D-Link DIR-825 rev. C1", - dir825c1_setup); - -MIPS_MACHINE(ATH79_MACH_DIR_835_A1, "DIR-835-A1", - "D-Link DIR-835 rev. A1", - dir835a1_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-869-a1.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-869-a1.c deleted file mode 100644 index 4d6d91794..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-869-a1.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * D-Link DIR-869 A1 support - * - * Copyright (C) 2015-2016 P. Wassi - * Copyright (C) 2016 Matthias Schiffer - * - * Derived from: mach-ubnt-unifiac.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 "machtypes.h" -#include "nvram.h" - - -#define DIR869A1_GPIO_BTN_RESET 1 -#define DIR869A1_GPIO_BTN_WPS 2 -#define DIR869A1_GPIO_SWITCH_MODE 8 - -#define DIR869A1_GPIO_ENABLE_SWITCH 11 - -#define DIR869A1_GPIO_LED_ORANGE 15 -#define DIR869A1_GPIO_LED_WHITE 16 - -#define DIR869A1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DIR869A1_KEYS_DEBOUNCE_INTERVAL (3 * DIR869A1_KEYS_POLL_INTERVAL) - - -#define DIR869A1_DEVDATA_ADDR 0x1f050000 -#define DIR869A1_DEVDATA_SIZE 0x10000 - -#define DIR869A1_EEPROM_ADDR 0x1fff0000 -#define DIR869A1_WMAC_CALDATA_OFFSET 0x1000 -#define DIR869A1_PCI_CALDATA_OFFSET 0x5000 - - -static struct gpio_led dir869a1_leds_gpio[] __initdata = { - { - .name = "d-link:white:status", - .gpio = DIR869A1_GPIO_LED_WHITE, - .active_low = 1, - }, - { - .name = "d-link:orange:status", - .gpio = DIR869A1_GPIO_LED_ORANGE, - .active_low = 1, - }, -}; - -static struct gpio_keys_button dir869a1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DIR869A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR869A1_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DIR869A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR869A1_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "mode", - .type = EV_SW, - .code = BTN_0, - .debounce_interval = DIR869A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR869A1_GPIO_SWITCH_MODE, - .active_low = 0, - }, -}; - - -static struct ar8327_pad_cfg dir869a1_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data dir869a1_ar8327_data = { - .pad0_cfg = &dir869a1_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - - -static struct mdio_board_info dir869a1_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dir869a1", - .mdio_addr = 0, - .platform_data = &dir869a1_ar8327_data, - }, -}; - - -static void dir869a1_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(DIR869A1_DEVDATA_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, DIR869A1_DEVDATA_SIZE, - name, mac); - if (err) - pr_err("no MAC address found for %s\n", name); -} - -static void __init dir869a1_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(DIR869A1_EEPROM_ADDR); - u8 wlan24mac[ETH_ALEN] = {}, wlan5mac[ETH_ALEN] = {}; - - ath79_register_m25p80(NULL); - - gpio_request_one(DIR869A1_GPIO_ENABLE_SWITCH, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "Switch power"); - - dir869a1_get_mac("lanmac=", ath79_eth0_data.mac_addr); - 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(dir869a1_mdio0_info, - ARRAY_SIZE(dir869a1_mdio0_info)); - - ath79_register_mdio(0, 0); - ath79_register_eth(0); - - dir869a1_get_mac("wlan24mac=", wlan24mac); - ath79_register_wmac(eeprom + DIR869A1_WMAC_CALDATA_OFFSET, wlan24mac); - - dir869a1_get_mac("wlan5mac=", wlan5mac); - ap91_pci_init(eeprom + DIR869A1_PCI_CALDATA_OFFSET, wlan5mac); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dir869a1_leds_gpio), - dir869a1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DIR869A1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dir869a1_gpio_keys), - dir869a1_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_DIR_869_A1, "DIR-869-A1", "D-Link DIR-869 rev. A1", - dir869a1_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-pro-1200-ac.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-pro-1200-ac.c deleted file mode 100644 index 0dffc21a0..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-pro-1200-ac.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * devolo dLAN pro 500 Wireless+ support - * - * Copyright (c) 2013-2015 devolo AG - * Copyright (c) 2011-2012 Gabor Juhos - * - * 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 "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-nfc.h" -#include "dev-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DLAN_PRO_1200_AC_GPIO_DLAN_POWER_ENABLE 13 -#define DLAN_PRO_1200_AC_GPIO_WLAN_POWER_ENABLE 21 -#define DLAN_PRO_1200_AC_GPIO_LED_WLAN 12 -#define DLAN_PRO_1200_AC_GPIO_LED_DLAN 14 -#define DLAN_PRO_1200_AC_GPIO_LED_DLAN_ERR 15 - -#define DLAN_PRO_1200_AC_GPIO_BTN_WLAN 20 -#define DLAN_PRO_1200_AC_GPIO_BTN_DLAN 22 -#define DLAN_PRO_1200_AC_GPIO_BTN_RESET 4 -#define DLAN_PRO_1200_AC_GPIO_DLAN_IND 17 -#define DLAN_PRO_1200_AC_GPIO_DLAN_ERR_IND 16 - -#define DLAN_PRO_1200_AC_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DLAN_PRO_1200_AC_KEYS_DEBOUNCE_INTERVAL (3 * DLAN_PRO_1200_AC_KEYS_POLL_INTERVAL) - -#define DLAN_PRO_1200_AC_ART_ADDRESS 0x1fff0000 -#define DLAN_PRO_1200_AC_CALDATA_OFFSET 0x1000 -#define DLAN_PRO_1200_AC_WIFIMAC_OFFSET 0x1002 -#define DLAN_PRO_1200_AC_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led dlan_pro_1200_ac_leds_gpio[] __initdata = { - { - .name = "devolo:status:wlan", - .gpio = DLAN_PRO_1200_AC_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "devolo:status:dlan", - .gpio = DLAN_PRO_1200_AC_GPIO_LED_DLAN, - .active_low = 1, - }, - { - .name = "devolo:error:dlan", - .gpio = DLAN_PRO_1200_AC_GPIO_LED_DLAN_ERR, - .active_low = 0, - } -}; - -static struct gpio_keys_button dlan_pro_1200_ac_gpio_keys[] __initdata = { - { - .desc = "dLAN button", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = DLAN_PRO_1200_AC_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_PRO_1200_AC_GPIO_BTN_DLAN, - .active_low = 1, - }, - { - .desc = "WLAN button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DLAN_PRO_1200_AC_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_PRO_1200_AC_GPIO_BTN_WLAN, - .active_low = 0, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DLAN_PRO_1200_AC_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_PRO_1200_AC_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct ar8327_pad_cfg dlan_pro_1200_ac_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = false, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, - .mac06_exchange_dis = true, -}; - -static struct ar8327_pad_cfg dlan_pro_1200_ac_ar8327_pad5_cfg = { - .mode = 0, - .txclk_delay_en = 0, - .rxclk_delay_en = 0, - .txclk_delay_sel = 0, - .rxclk_delay_sel = 0, -}; - -static struct ar8327_platform_data dlan_pro_1200_ac_ar8327_data = { - .pad0_cfg = &dlan_pro_1200_ac_ar8327_pad0_cfg, - .pad5_cfg = &dlan_pro_1200_ac_ar8327_pad5_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info dlan_pro_1200_ac_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dlan_pro_1200_ac", - .mdio_addr = 0, - .platform_data = &dlan_pro_1200_ac_ar8327_data, - }, -}; - -static void __init dlan_pro_1200_ac_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(DLAN_PRO_1200_AC_ART_ADDRESS); - u8 *cal = art + DLAN_PRO_1200_AC_CALDATA_OFFSET; - u8 *wifi_mac = art + DLAN_PRO_1200_AC_WIFIMAC_OFFSET; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dlan_pro_1200_ac_leds_gpio), - dlan_pro_1200_ac_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DLAN_PRO_1200_AC_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dlan_pro_1200_ac_gpio_keys), - dlan_pro_1200_ac_gpio_keys); - - /* dLAN power must be enabled from user-space as soon as the boot-from-host daemon is running */ - gpio_request_one(DLAN_PRO_1200_AC_GPIO_DLAN_POWER_ENABLE, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "dLAN power"); - - /* WLAN power is turned on initially to allow the PCI bus scan to succeed */ - gpio_request_one(DLAN_PRO_1200_AC_GPIO_WLAN_POWER_ENABLE, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "WLAN power"); - - ath79_register_wmac(cal, wifi_mac); - ap91_pci_init(art + DLAN_PRO_1200_AC_PCIE_CALDATA_OFFSET, NULL); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, wifi_mac, 2); - - mdiobus_register_board_info(dlan_pro_1200_ac_mdio0_info, - ARRAY_SIZE(dlan_pro_1200_ac_mdio0_info)); - - /* GMAC0 is connected to an AR8337 */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x02000000; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_DLAN_PRO_1200_AC, "dLAN-pro-1200-ac", "devolo dLAN pro 1200+ WiFi ac", - dlan_pro_1200_ac_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-pro-500-wp.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-pro-500-wp.c deleted file mode 100644 index a6a85ebe3..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-pro-500-wp.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * devolo dLAN pro 500 Wireless+ support - * - * Copyright (c) 2013-2015 devolo AG - * Copyright (c) 2011-2012 Gabor Juhos - * - * 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 "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-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DLAN_PRO_500_WP_GPIO_DLAN_POWER_ENABLE 13 -#define DLAN_PRO_500_WP_GPIO_DLAN_LED_ENABLE 17 -#define DLAN_PRO_500_WP_GPIO_LED_WLAN_5G 11 -#define DLAN_PRO_500_WP_GPIO_LED_WLAN_2G 12 -#define DLAN_PRO_500_WP_GPIO_LED_STATUS 16 -#define DLAN_PRO_500_WP_GPIO_LED_ETH 14 - -#define DLAN_PRO_500_WP_GPIO_BTN_WPS 20 -#define DLAN_PRO_500_WP_GPIO_BTN_WLAN 22 -#define DLAN_PRO_500_WP_GPIO_BTN_DLAN 21 -#define DLAN_PRO_500_WP_GPIO_BTN_RESET 4 - -#define DLAN_PRO_500_WP_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DLAN_PRO_500_WP_KEYS_DEBOUNCE_INTERVAL (3 * DLAN_PRO_500_WP_KEYS_POLL_INTERVAL) - -#define DLAN_PRO_500_WP_ART_ADDRESS 0x1fff0000 -#define DLAN_PRO_500_WP_CALDATA_OFFSET 0x1000 -#define DLAN_PRO_500_WP_MAC_ADDRESS_OFFSET 0x1002 -#define DLAN_PRO_500_WP_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led dlan_pro_500_wp_leds_gpio[] __initdata = { - { - .name = "devolo:green:status", - .gpio = DLAN_PRO_500_WP_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "devolo:green:eth", - .gpio = DLAN_PRO_500_WP_GPIO_LED_ETH, - .active_low = 1, - }, - { - .name = "devolo:blue:wlan-5g", - .gpio = DLAN_PRO_500_WP_GPIO_LED_WLAN_5G, - .active_low = 1, - }, - { - .name = "devolo:green:wlan-2g", - .gpio = DLAN_PRO_500_WP_GPIO_LED_WLAN_2G, - .active_low = 1, - } -}; - -static struct gpio_keys_button dlan_pro_500_wp_gpio_keys[] __initdata = { - { - .desc = "dLAN button", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = DLAN_PRO_500_WP_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_PRO_500_WP_GPIO_BTN_DLAN, - .active_low = 0, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DLAN_PRO_500_WP_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_PRO_500_WP_GPIO_BTN_WPS, - .active_low = 0, - }, - { - .desc = "WLAN button", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = DLAN_PRO_500_WP_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_PRO_500_WP_GPIO_BTN_WLAN, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DLAN_PRO_500_WP_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_PRO_500_WP_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct ar8327_pad_cfg dlan_pro_500_wp_ar8327_pad0_cfg = { - .mode = AR8327_PAD_PHY_RGMII, - .txclk_delay_en = false, - .rxclk_delay_en = false, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL0, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, -}; - -static struct ar8327_led_cfg dlan_pro_500_wp_ar8327_led_cfg = { - .led_ctrl0 = 0x00000000, - .led_ctrl1 = 0xc737c737, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x00c30c00, - .open_drain = true, -}; - -static struct ar8327_platform_data dlan_pro_500_wp_ar8327_data = { - .pad0_cfg = &dlan_pro_500_wp_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 0, - .rxpause = 0, - }, - .led_cfg = &dlan_pro_500_wp_ar8327_led_cfg, -}; - -static struct mdio_board_info dlan_pro_500_wp_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dlan_pro_500_wp", - .mdio_addr = 0, - .platform_data = &dlan_pro_500_wp_ar8327_data, - }, -}; - -static void __init dlan_pro_500_wp_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(DLAN_PRO_500_WP_ART_ADDRESS); - u8 *cal = art + DLAN_PRO_500_WP_CALDATA_OFFSET; - u8 *wifi_mac = art + DLAN_PRO_500_WP_MAC_ADDRESS_OFFSET; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dlan_pro_500_wp_leds_gpio), - dlan_pro_500_wp_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DLAN_PRO_500_WP_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dlan_pro_500_wp_gpio_keys), - dlan_pro_500_wp_gpio_keys); - - gpio_request_one(DLAN_PRO_500_WP_GPIO_DLAN_POWER_ENABLE, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "PLC power"); - gpio_request_one(DLAN_PRO_500_WP_GPIO_DLAN_LED_ENABLE, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "PLC LEDs"); - - ath79_register_wmac(cal, wifi_mac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - ath79_register_mdio(1, 0x0); - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(dlan_pro_500_wp_mdio0_info, - ARRAY_SIZE(dlan_pro_500_wp_mdio0_info)); - - /* GMAC0 is connected to a AR7400 PLC in PHY mode */ - ath79_init_mac(ath79_eth0_data.mac_addr, wifi_mac, 2); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_pll_data.pll_1000 = 0x0e000000; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_init_mac(ath79_eth1_data.mac_addr, wifi_mac, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_DLAN_PRO_500_WP, "dLAN-pro-500-wp", "devolo dLAN pro 500 Wireless+", - dlan_pro_500_wp_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-domywifi-dw33d.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-domywifi-dw33d.c deleted file mode 100644 index 414742062..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-domywifi-dw33d.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * DomyWifi DW33D support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DW33D_GPIO_LED_MMC 4 -#define DW33D_GPIO_LED_WLAN_2G 13 -#define DW33D_GPIO_LED_STATUS 14 -#define DW33D_GPIO_LED_USB 15 -#define DW33D_GPIO_LED_INTERNET 22 - -#define DW33D_GPIO_BTN_RESET 17 - -#define DW33D_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DW33D_KEYS_DEBOUNCE_INTERVAL (3 * DW33D_KEYS_POLL_INTERVAL) - -#define DW33D_MAC0_OFFSET 0 -#define DW33D_MAC1_OFFSET 6 -#define DW33D_WMAC_OFFSET 12 -#define DW33D_WMAC_CALDATA_OFFSET 0x1000 -#define DW33D_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led dw33d_leds_gpio[] __initdata = { - { - .name = "dw33d:blue:status", - .gpio = DW33D_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "dw33d:blue:mmc", - .gpio = DW33D_GPIO_LED_MMC, - .active_low = 1, - }, - { - .name = "dw33d:blue:usb", - .gpio = DW33D_GPIO_LED_USB, - .active_low = 1, - }, - { - .name = "dw33d:blue:wlan-2g", - .gpio = DW33D_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "dw33d:blue:internet", - .gpio = DW33D_GPIO_LED_INTERNET, - .active_low = 1, - } -}; - -static struct gpio_keys_button dw33d_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DW33D_KEYS_DEBOUNCE_INTERVAL, - .gpio = DW33D_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -/* GMAC6 of the QCA8337 switch is connected to the QCA9558 SoC via SGMII */ -static struct ar8327_pad_cfg dw33d_qca8337_pad6_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -/* GMAC0 of the QCA8337 switch is connected to the QCA9558 SoC via RGMII */ -static struct ar8327_pad_cfg dw33d_qca8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data dw33d_qca8337_data = { - .pad0_cfg = &dw33d_qca8337_pad0_cfg, - .pad6_cfg = &dw33d_qca8337_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info dw33d_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dw33d", - .mdio_addr = 0, - .platform_data = &dw33d_qca8337_data, - }, -}; - -static void __init dw33d_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dw33d_leds_gpio), - dw33d_leds_gpio); - ath79_register_gpio_keys_polled(-1, DW33D_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dw33d_gpio_keys), - dw33d_gpio_keys); - - ath79_register_usb(); - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW); - ath79_register_nfc(); - ath79_register_pci(); - - ath79_register_wmac(art + DW33D_WMAC_CALDATA_OFFSET, art + DW33D_WMAC_OFFSET); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + DW33D_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art + DW33D_MAC1_OFFSET, 0); - - mdiobus_register_board_info(dw33d_mdio0_info, - ARRAY_SIZE(dw33d_mdio0_info)); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x56000000; - - ath79_register_eth(0); - - /* GMAC1 is connected tot eh SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_DOMYWIFI_DW33D, "DW33D", - "DomyWifi DW33D", - dw33d_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dr344.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dr344.c deleted file mode 100644 index c0ae52f96..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dr344.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Wallys DR342/DR344 boards support - * - * Copyright (c) 2011 Qualcomm Atheros - * Copyright (c) 2011-2012 Gabor Juhos - * Copyright (c) 2015 Philippe Duchein - * Copyright (c) 2017 Piotr Dymacz - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-usb.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DR34X_GPIO_LED_SIG1 12 -#define DR34X_GPIO_LED_SIG2 13 -#define DR34X_GPIO_LED_SIG3 14 -#define DR34X_GPIO_LED_SIG4 15 -#define DR34X_GPIO_LED_STATUS 11 -#define DR344_GPIO_LED_LAN 17 -#define DR344_GPIO_EXTERNAL_LNA0 18 -#define DR344_GPIO_EXTERNAL_LNA1 19 - -#define DR34X_GPIO_BTN_RESET 16 - -#define DR344_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DR344_KEYS_DEBOUNCE_INTERVAL (3 * DR344_KEYS_POLL_INTERVAL) - -#define DR34X_MAC0_OFFSET 0 -#define DR34X_MAC1_OFFSET 8 -#define DR34X_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led dr342_leds_gpio[] __initdata = { - { - .name = "dr342:green:status", - .gpio = DR34X_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "dr342:green:sig1", - .gpio = DR34X_GPIO_LED_SIG1, - .active_low = 1, - }, - { - .name = "dr342:green:sig2", - .gpio = DR34X_GPIO_LED_SIG2, - .active_low = 1, - }, - { - .name = "dr342:green:sig3", - .gpio = DR34X_GPIO_LED_SIG3, - .active_low = 1, - }, - { - .name = "dr342:green:sig4", - .gpio = DR34X_GPIO_LED_SIG4, - .active_low = 1, - } -}; - -static struct gpio_led dr344_leds_gpio[] __initdata = { - { - .name = "dr344:green:lan", - .gpio = DR344_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "dr344:green:status", - .gpio = DR34X_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "dr344:green:sig1", - .gpio = DR34X_GPIO_LED_SIG1, - .active_low = 1, - }, - { - .name = "dr344:green:sig2", - .gpio = DR34X_GPIO_LED_SIG2, - .active_low = 1, - }, - { - .name = "dr344:green:sig3", - .gpio = DR34X_GPIO_LED_SIG3, - .active_low = 1, - }, - { - .name = "dr344:green:sig4", - .gpio = DR34X_GPIO_LED_SIG4, - .active_low = 1, - } -}; - -static struct gpio_keys_button dr34x_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DR344_KEYS_DEBOUNCE_INTERVAL, - .gpio = DR34X_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct at803x_platform_data dr34x_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info dr34x_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "dr34x", - .mdio_addr = 0, - .platform_data = &dr34x_at803x_data, - }, -}; - -static void __init dr34x_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f03f810); - - ath79_register_m25p80(NULL); - - ath79_gpio_direction_select(DR34X_GPIO_LED_STATUS, true); - gpio_set_value(DR34X_GPIO_LED_STATUS, 1); - ath79_gpio_output_select(DR34X_GPIO_LED_STATUS, 0); - - ath79_register_gpio_keys_polled(-1, DR344_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dr34x_gpio_keys), - dr34x_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(art + DR34X_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - - mdiobus_register_board_info(dr34x_mdio0_info, - ARRAY_SIZE(dr34x_mdio0_info)); - - ath79_register_mdio(0, 0x0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - /* GMAC0 is connected to an AR8035 Gbps PHY */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x02000000; - ath79_eth0_pll_data.pll_100 = 0x0101; - ath79_eth0_pll_data.pll_10 = 0x1313; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac + DR34X_MAC0_OFFSET, 0); - ath79_register_eth(0); -} - -static void __init dr342_setup(void) -{ - dr34x_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dr342_leds_gpio), - dr342_leds_gpio); -} - -static void __init dr344_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f03f810); - - dr34x_setup(); - - ath79_gpio_direction_select(DR344_GPIO_LED_LAN, true); - gpio_set_value(DR344_GPIO_LED_LAN, 1); - ath79_gpio_output_select(DR344_GPIO_LED_LAN, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dr344_leds_gpio), - dr344_leds_gpio); - - ath79_wmac_set_ext_lna_gpio(0, DR344_GPIO_EXTERNAL_LNA0); - ath79_wmac_set_ext_lna_gpio(1, DR344_GPIO_EXTERNAL_LNA1); - - ath79_register_mdio(1, 0x0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_init_mac(ath79_eth1_data.mac_addr, mac + DR34X_MAC1_OFFSET, 0); - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_DR342, "DR342", "Wallys DR342", dr342_setup); -MIPS_MACHINE(ATH79_MACH_DR344, "DR344", "Wallys DR344", dr344_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-e1700ac-v2.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-e1700ac-v2.c deleted file mode 100644 index b0b825280..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-e1700ac-v2.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Qxwlan E1700AC v2 board support - * - * Copyright (C) 2017 Peng Zhang - * Copyright (C) 2018 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 "common.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" -#include "pci.h" - -#define E1700AC_V2_GPIO_LED_SYS 1 -#define E1700AC_V2_GPIO_LED_USB 7 -#define E1700AC_V2_GPIO_LED_WLAN2G 19 - -#define E1700AC_V2_GPIO_BTN_SW1 2 -#define E1700AC_V2_GPIO_BTN_RESET 11 - -#define E1700AC_V2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define E1700AC_V2_KEYS_DEBOUNCE_INTERVAL \ - (3 * E1700AC_V2_KEYS_POLL_INTERVAL) - -static struct gpio_led e1700ac_v2_leds_gpio[] __initdata = { - { - .name = "e1700ac-v2:green:system", - .gpio = E1700AC_V2_GPIO_LED_SYS, - .active_low = 1, - }, { - .name = "e1700ac-v2:green:usb", - .gpio = E1700AC_V2_GPIO_LED_USB, - .active_low = 1, - }, { - .name = "e1700ac-v2:green:wlan2g", - .gpio = E1700AC_V2_GPIO_LED_WLAN2G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button e1700ac_v2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = E1700AC_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = E1700AC_V2_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "sw1", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = E1700AC_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = E1700AC_V2_GPIO_BTN_SW1, - .active_low = 1, - }, -}; - -static const struct ar8327_led_info e1700ac_v2_leds_qca8334[] = { - AR8327_LED_INFO(PHY1_0, HW, "e1700ac-v2:green:lan"), - AR8327_LED_INFO(PHY2_0, HW, "e1700ac-v2:green:wan"), -}; - -/* Blink rate: 1 Gbps -> 8 hz, 100 Mbs -> 4 Hz, 10 Mbps -> 2 Hz */ -static struct ar8327_led_cfg e1700ac_v2_qca8334_led_cfg = { - .led_ctrl0 = 0xcf37cf37, - .led_ctrl1 = 0xcf37cf37, - .led_ctrl2 = 0xcf37cf37, - .led_ctrl3 = 0x0, - .open_drain = true, -}; - -static struct ar8327_pad_cfg e1700ac_v2_qca8334_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data e1700ac_v2_qca8334_data = { - .pad0_cfg = &e1700ac_v2_qca8334_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &e1700ac_v2_qca8334_led_cfg, - .leds = e1700ac_v2_leds_qca8334, - .num_leds = ARRAY_SIZE(e1700ac_v2_leds_qca8334), -}; - -static struct mdio_board_info e1700ac_v2_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "e1700ac_v2", - .mdio_addr = 0, - .platform_data = &e1700ac_v2_qca8334_data, - }, -}; - -static void __init e1700ac_v2_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f050400); - u8 *art = (u8 *) KSEG1ADDR(0x1f061000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(e1700ac_v2_leds_gpio), - e1700ac_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, E1700AC_V2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(e1700ac_v2_gpio_keys), - e1700ac_v2_gpio_keys); - - ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(e1700ac_v2_mdio0_info, - ARRAY_SIZE(e1700ac_v2_mdio0_info)); - - /* GMAC0 is connected to QCA8334 switch */ - ath79_eth0_data.duplex = DUPLEX_FULL; - 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_pll_data.pll_1000 = 0x03000101; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); - - ath79_register_pci(); - ath79_register_usb(); - ath79_register_wmac(art, NULL); -} - -MIPS_MACHINE(ATH79_MACH_E1700AC_V2, "E1700AC-V2", "Qxwlan E1700AC v2", - e1700ac_v2_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-epg5000.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-epg5000.c deleted file mode 100644 index c7ceecbc9..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-epg5000.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * EnGenius EPG5000 board support - * - * Copyright (c) 2014 Jon Suphammer - * Copyright (c) 2015 Christian Beier - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define EPG5000_GPIO_LED_WLAN_5G 23 -#define EPG5000_GPIO_LED_WLAN_2G 13 -#define EPG5000_GPIO_LED_POWER_AMBER 2 -#define EPG5000_GPIO_LED_WPS_AMBER 22 -#define EPG5000_GPIO_LED_WPS_BLUE 19 - -#define EPG5000_GPIO_BTN_WPS 16 -#define EPG5000_GPIO_BTN_RESET 17 - -#define EPG5000_KEYS_POLL_INTERVAL 20 /* msecs */ -#define EPG5000_KEYS_DEBOUNCE_INTERVAL (3 * EPG5000_KEYS_POLL_INTERVAL) - -#define EPG5000_CALDATA_ADDR 0x1fff0000 -#define EPG5000_WMAC_CALDATA_OFFSET 0x1000 -#define EPG5000_PCIE_CALDATA_OFFSET 0x5000 - -#define EPG5000_NVRAM_ADDR 0x1f030000 -#define EPG5000_NVRAM_SIZE 0x10000 - -static struct gpio_led epg5000_leds_gpio[] __initdata = { - { - .name = "epg5000:amber:power", - .gpio = EPG5000_GPIO_LED_POWER_AMBER, - .active_low = 1, - }, - { - .name = "epg5000:blue:wps", - .gpio = EPG5000_GPIO_LED_WPS_BLUE, - .active_low = 1, - }, - { - .name = "epg5000:amber:wps", - .gpio = EPG5000_GPIO_LED_WPS_AMBER, - .active_low = 1, - }, - { - .name = "epg5000:blue:wlan-2g", - .gpio = EPG5000_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "epg5000:blue:wlan-5g", - .gpio = EPG5000_GPIO_LED_WLAN_5G, - .active_low = 1, - } -}; - -static struct gpio_keys_button epg5000_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = EPG5000_KEYS_DEBOUNCE_INTERVAL, - .gpio = EPG5000_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = EPG5000_KEYS_DEBOUNCE_INTERVAL, - .gpio = EPG5000_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg epg5000_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL2, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data epg5000_ar8327_data = { - .pad0_cfg = &epg5000_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info epg5000_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "epg5000", - .mdio_addr = 0, - .platform_data = &epg5000_ar8327_data, - }, -}; - -static int epg5000_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(EPG5000_NVRAM_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, EPG5000_NVRAM_SIZE, - name, mac); - if (err) { - pr_err("no MAC address found for %s\n", name); - return false; - } - - return true; -} - -static void __init epg5000_setup(void) -{ - u8 *caldata = (u8 *) KSEG1ADDR(EPG5000_CALDATA_ADDR); - u8 mac1[ETH_ALEN]; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(epg5000_leds_gpio), - epg5000_leds_gpio); - ath79_register_gpio_keys_polled(-1, EPG5000_KEYS_POLL_INTERVAL, - ARRAY_SIZE(epg5000_gpio_keys), - epg5000_gpio_keys); - - ath79_register_usb(); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(epg5000_mdio0_info, - ARRAY_SIZE(epg5000_mdio0_info)); - - /* GMAC0 is connected to an QCA8327N switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - if (epg5000_get_mac("ethaddr=", mac1)) - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - - ath79_eth0_pll_data.pll_1000 = 0xa6000000; - ath79_register_eth(0); - - ath79_register_wmac(caldata + EPG5000_WMAC_CALDATA_OFFSET, mac1); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_EPG5000, "EPG5000", - "EnGenius EPG5000", - epg5000_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-esr1750.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-esr1750.c deleted file mode 100644 index 9fbd46b64..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-esr1750.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * EnGenius ESR1750 board support - * - * Copyright (c) 2014 Jon Suphammer - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define ESR1750_GPIO_LED_WLAN_5G 23 -#define ESR1750_GPIO_LED_WLAN_2G 13 -#define ESR1750_GPIO_LED_POWER_AMBER 2 -#define ESR1750_GPIO_LED_WPS_AMBER 22 -#define ESR1750_GPIO_LED_WPS_BLUE 19 - -#define ESR1750_GPIO_BTN_WPS 16 -#define ESR1750_GPIO_BTN_RESET 17 - -#define ESR1750_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ESR1750_KEYS_DEBOUNCE_INTERVAL (3 * ESR1750_KEYS_POLL_INTERVAL) - -#define ESR1750_CALDATA_ADDR 0x1fff0000 -#define ESR1750_WMAC_CALDATA_OFFSET 0x1000 -#define ESR1750_PCIE_CALDATA_OFFSET 0x5000 - -#define ESR1750_NVRAM_ADDR 0x1f030000 -#define ESR1750_NVRAM_SIZE 0x10000 - -static struct gpio_led esr1750_leds_gpio[] __initdata = { - { - .name = "esr1750:amber:power", - .gpio = ESR1750_GPIO_LED_POWER_AMBER, - .active_low = 1, - }, - { - .name = "esr1750:blue:wps", - .gpio = ESR1750_GPIO_LED_WPS_BLUE, - .active_low = 1, - }, - { - .name = "esr1750:amber:wps", - .gpio = ESR1750_GPIO_LED_WPS_AMBER, - .active_low = 1, - }, - { - .name = "esr1750:blue:wlan-2g", - .gpio = ESR1750_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "esr1750:blue:wlan-5g", - .gpio = ESR1750_GPIO_LED_WLAN_5G, - .active_low = 1, - } -}; - -static struct gpio_keys_button esr1750_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = ESR1750_KEYS_DEBOUNCE_INTERVAL, - .gpio = ESR1750_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ESR1750_KEYS_DEBOUNCE_INTERVAL, - .gpio = ESR1750_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg esr1750_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL2, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data esr1750_ar8327_data = { - .pad0_cfg = &esr1750_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info esr1750_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "esr1750", - .mdio_addr = 0, - .platform_data = &esr1750_ar8327_data, - }, -}; - -static int esr1750_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(ESR1750_NVRAM_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, ESR1750_NVRAM_SIZE, - name, mac); - if (err) { - pr_err("no MAC address found for %s\n", name); - return false; - } - - return true; -} - -static void __init esr1750_setup(void) -{ - u8 *caldata = (u8 *) KSEG1ADDR(ESR1750_CALDATA_ADDR); - u8 mac1[ETH_ALEN]; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(esr1750_leds_gpio), - esr1750_leds_gpio); - ath79_register_gpio_keys_polled(-1, ESR1750_KEYS_POLL_INTERVAL, - ARRAY_SIZE(esr1750_gpio_keys), - esr1750_gpio_keys); - - ath79_register_usb(); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(esr1750_mdio0_info, - ARRAY_SIZE(esr1750_mdio0_info)); - - /* GMAC0 is connected to an QCA8327N switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - if (esr1750_get_mac("ethaddr=", mac1)) - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - - ath79_eth0_pll_data.pll_1000 = 0xa6000000; - ath79_register_eth(0); - - ath79_register_wmac(caldata + ESR1750_WMAC_CALDATA_OFFSET, mac1); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_ESR1750, "ESR1750", - "EnGenius ESR1750", - esr1750_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-esr900.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-esr900.c deleted file mode 100644 index 85f512f84..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-esr900.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * EnGenius ESR900 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. - */ - -#define pr_fmt(fmt) "esr900: " fmt - -#include -#include - -#include - -#include "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define ESR900_GPIO_LED_POWER 2 -#define ESR900_GPIO_LED_WLAN_2G 13 -#define ESR900_GPIO_LED_WPS_BLUE 19 -#define ESR900_GPIO_LED_WPS_AMBER 22 -#define ESR900_GPIO_LED_WLAN_5G 23 - -#define ESR900_GPIO_BTN_WPS 16 -#define ESR900_GPIO_BTN_RESET 17 - -#define ESR900_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ESR900_KEYS_DEBOUNCE_INTERVAL (3 * ESR900_KEYS_POLL_INTERVAL) - -#define ESR900_CALDATA_ADDR 0x1fff0000 -#define ESR900_WMAC_CALDATA_OFFSET 0x1000 -#define ESR900_PCIE_CALDATA_OFFSET 0x5000 - -#define ESR900_CONFIG_ADDR 0x1f030000 -#define ESR900_CONFIG_SIZE 0x10000 - -#define ESR900_LAN_PHYMASK BIT(0) -#define ESR900_WAN_PHYMASK BIT(5) -#define ESR900_MDIO_MASK (~(ESR900_LAN_PHYMASK | ESR900_WAN_PHYMASK)) - -static struct gpio_led esr900_leds_gpio[] __initdata = { - { - .name = "engenius:amber:power", - .gpio = ESR900_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "engenius:blue:wlan-2g", - .gpio = ESR900_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "engenius:blue:wps", - .gpio = ESR900_GPIO_LED_WPS_BLUE, - .active_low = 1, - }, - { - .name = "engenius:amber:wps", - .gpio = ESR900_GPIO_LED_WPS_AMBER, - .active_low = 1, - }, - { - .name = "engenius:blue:wlan-5g", - .gpio = ESR900_GPIO_LED_WLAN_5G, - .active_low = 1, - } -}; - -static struct gpio_keys_button esr900_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = ESR900_KEYS_DEBOUNCE_INTERVAL, - .gpio = ESR900_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ESR900_KEYS_DEBOUNCE_INTERVAL, - .gpio = ESR900_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg esr900_ar8327_pad0_cfg = { - /* GMAC0 of the AR8337 switch is connected to GMAC0 via RGMII */ - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_pad_cfg esr900_ar8327_pad6_cfg = { - /* GMAC6 of the AR8337 switch is connected to GMAC1 via SGMII */ - .mode = AR8327_PAD_MAC_SGMII, - .rxclk_delay_en = true, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, -}; - -static struct ar8327_platform_data esr900_ar8327_data = { - .pad0_cfg = &esr900_ar8327_pad0_cfg, - .pad6_cfg = &esr900_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info esr900_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "esr900", - .mdio_addr = 0, - .platform_data = &esr900_ar8327_data, - }, -}; - -static void __init esr900_setup(void) -{ - const char *config = (char *) KSEG1ADDR(ESR900_CONFIG_ADDR); - u8 *art = (u8 *) KSEG1ADDR(ESR900_CALDATA_ADDR); - u8 lan_mac[ETH_ALEN]; - u8 wlan0_mac[ETH_ALEN]; - u8 wlan1_mac[ETH_ALEN]; - - if (ath79_nvram_parse_mac_addr(config, ESR900_CONFIG_SIZE, - "ethaddr=", lan_mac) == 0) { - ath79_init_local_mac(ath79_eth0_data.mac_addr, lan_mac); - ath79_init_mac(wlan0_mac, lan_mac, 0); - ath79_init_mac(wlan1_mac, lan_mac, 1); - } else { - pr_err("could not find ethaddr in u-boot environment\n"); - } - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(esr900_leds_gpio), - esr900_leds_gpio); - ath79_register_gpio_keys_polled(-1, ESR900_KEYS_POLL_INTERVAL, - ARRAY_SIZE(esr900_gpio_keys), - esr900_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(art + ESR900_WMAC_CALDATA_OFFSET, wlan0_mac); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(esr900_mdio0_info, - ARRAY_SIZE(esr900_mdio0_info)); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = ESR900_LAN_PHYMASK; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_eth0_pll_data.pll_1000 = 0xa6000000; - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_eth1_pll_data.pll_1000 = 0x03000101; - ath79_register_eth(1); - - ap91_pci_init(art + ESR900_PCIE_CALDATA_OFFSET, wlan1_mac); -} - -MIPS_MACHINE(ATH79_MACH_ESR900, "ESR900", "EnGenius ESR900", esr900_setup); - diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-f9k1115v2.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-f9k1115v2.c deleted file mode 100644 index 88c695a35..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-f9k1115v2.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Belkin AC1750DB (F9K1115V2) board support - * - * Copyright (C) 2014 Gabor Juhos - * Copyright (C) 2014 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 "common.h" -#include "pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define F9K1115V2_GPIO_LED_USB2 4 -#define F9K1115V2_GPIO_LED_WPS_AMBER 14 -#define F9K1115V2_GPIO_LED_STATUS_AMBER 15 -#define F9K1115V2_GPIO_LED_WPS_BLUE 19 -#define F9K1115V2_GPIO_LED_STATUS_BLUE 20 - -#define F9K1115V2_GPIO_BTN_WPS 16 -#define F9K1115V2_GPIO_BTN_RESET 17 - -#define F9K1115V2_GPIO_USB2_POWER 21 - -#define F9K1115V2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define F9K1115V2_KEYS_DEBOUNCE_INTERVAL (3 * F9K1115V2_KEYS_POLL_INTERVAL) - -#define F9K1115V2_WAN_MAC_OFFSET 0 -#define F9K1115V2_LAN_MAC_OFFSET 6 -#define F9K1115V2_WMAC_CALDATA_OFFSET 0x1000 -#define F9K1115V2_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led f9k1115v2_leds_gpio[] __initdata = { - { - .name = "belkin:amber:status", - .gpio = F9K1115V2_GPIO_LED_STATUS_AMBER, - .active_low = 1, - }, - { - .name = "belkin:blue:status", - .gpio = F9K1115V2_GPIO_LED_STATUS_BLUE, - .active_low = 1, - }, - { - .name = "belkin:blue:wps", - .gpio = F9K1115V2_GPIO_LED_WPS_BLUE, - .active_low = 1, - }, - { - .name = "belkin:amber:wps", - .gpio = F9K1115V2_GPIO_LED_WPS_AMBER, - .active_low = 1, - }, - { - .name = "belkin:green:usb2", - .gpio = F9K1115V2_GPIO_LED_USB2, - .active_low = 1, - }, -}; - -static struct gpio_keys_button f9k1115v2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = F9K1115V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = F9K1115V2_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = F9K1115V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = F9K1115V2_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg f9k1115v2_ar8327_pad0_cfg = { - /* Use the RGMII interface for the GMAC0 of the AR8337 switch */ - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_pad_cfg f9k1115v2_ar8327_pad6_cfg = { - /* Use the SGMII interface for the GMAC6 of the AR8337 switch */ - .mode = AR8327_PAD_MAC_SGMII, - .rxclk_delay_en = true, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, -}; - -static struct ar8327_platform_data f9k1115v2_ar8327_data = { - .pad0_cfg = &f9k1115v2_ar8327_pad0_cfg, - .pad6_cfg = &f9k1115v2_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info f9k1115v2_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "f9k1115v2", - .mdio_addr = 0, - .platform_data = &f9k1115v2_ar8327_data, - }, -}; - -static void __init f9k1115v2_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(f9k1115v2_leds_gpio), - f9k1115v2_leds_gpio); - ath79_register_gpio_keys_polled(-1, F9K1115V2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(f9k1115v2_gpio_keys), - f9k1115v2_gpio_keys); - - ath79_register_wmac(art + F9K1115V2_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(f9k1115v2_mdio0_info, - ARRAY_SIZE(f9k1115v2_mdio0_info)); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_init_mac(ath79_eth0_data.mac_addr, - art + F9K1115V2_WAN_MAC_OFFSET, 0); - - ath79_init_mac(ath79_eth1_data.mac_addr, - art + F9K1115V2_LAN_MAC_OFFSET, 0); - - ath79_eth0_pll_data.pll_1000 = 0xa6000000; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); - - ath79_register_pci(); - - ath79_register_usb(); - gpio_request_one(F9K1115V2_GPIO_USB2_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB2 power"); -} - -MIPS_MACHINE(ATH79_MACH_F9K1115V2, "F9K1115V2", "Belkin AC1750DB", - f9k1115v2_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar750s.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar750s.c deleted file mode 100644 index 503636eb0..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar750s.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * GL.iNet GL-AR750S board support - * - * Copyright (C) 2018 luochongjun - * - * 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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "dev-usb.h" -#include "machtypes.h" - - -#define GL_AR750S_KEYS_POLL_INTERVAL 20 -#define GL_AR750S_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR750S_KEYS_POLL_INTERVAL) - - -#define GL_AR750S_GPIO_LED_WLAN2G 19 -#define GL_AR750S_GPIO_LED_WLAN5G 20 -#define GL_AR750S_GPIO_LED_POWER 1 -#define GL_AR750S_GPIO_USB_POWER 7 - -#define GL_AR750S_GPIO_BTN_RESET 2 -#define GL_AR750S_GPIO_BTN_RIGHT 8 - -#define GL_AR750S_MAC0_OFFSET 0x0000 -#define GL_AR750S_WMAC_CALDATA_OFFSET 0x1000 -#define GL_AR750S_PCI_CALDATA_OFFSET 0x5000 - -#define GL_AR750S_GPIO_I2C_SDA 5 -#define GL_AR750S_GPIO_I2C_SCL 21 - - - -static struct spi_board_info gl_ar750s_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = NULL, - }, -}; - -static struct ath79_spi_platform_data gl_ar750s_spi_data = { - .bus_num = 0, - .num_chipselect = 2, -}; - -static struct gpio_led gl_ar750s_leds_gpio[] __initdata = { - { - .name = "gl-ar750s:green:power", - .gpio = GL_AR750S_GPIO_LED_POWER, - .default_state = LEDS_GPIO_DEFSTATE_KEEP, - .active_low = 1, - },{ - .name = "gl-ar750s:green:usbpower", - .gpio = GL_AR750S_GPIO_USB_POWER, - .active_low = 1, - },{ - .name = "gl-ar750s:green:wlan2g", - .gpio = GL_AR750S_GPIO_LED_WLAN2G, - .active_low = 1, - },{ - .name = "gl-ar750s:green:wlan5g", - .gpio = GL_AR750S_GPIO_LED_WLAN5G, - .active_low = 0, - } -}; - -static struct gpio_keys_button gl_ar750s_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_AR750S_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR750S_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "right", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = GL_AR750S_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR750S_GPIO_BTN_RIGHT, - .active_low = 1, - }, -}; - -static struct i2c_gpio_platform_data gl_ar750s_i2c_gpio_data = { - .sda_pin = GL_AR750S_GPIO_I2C_SDA, - .scl_pin = GL_AR750S_GPIO_I2C_SCL, -}; - -static struct platform_device gl_ar750s_i2c_gpio_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &gl_ar750s_i2c_gpio_data, - } - -}; - -static struct ar8327_pad_cfg gl_ar750s_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data gl_ar750s_ar8327_data = { - .pad0_cfg = &gl_ar750s_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - - -static struct mdio_board_info gl_ar750s_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "gl_ar750s", - .mdio_addr = 0, - .platform_data = &gl_ar750s_ar8327_data, - }, -}; - -static void __init gl_ar750s_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1f050000); - - ath79_register_spi(&gl_ar750s_spi_data, gl_ar750s_spi_info, 1); - - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + GL_AR750S_MAC0_OFFSET, 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(gl_ar750s_mdio0_info, - ARRAY_SIZE(gl_ar750s_mdio0_info)); - - ath79_register_mdio(0, 0x00); - ath79_register_eth(0); - - - ath79_register_usb(); - - - ath79_register_wmac(eeprom + GL_AR750S_WMAC_CALDATA_OFFSET, NULL); - - - ap91_pci_init(eeprom + GL_AR750S_PCI_CALDATA_OFFSET, NULL); - - platform_device_register(&gl_ar750s_i2c_gpio_device); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar750s_leds_gpio), - gl_ar750s_leds_gpio); - - ath79_register_gpio_keys_polled(-1, GL_AR750S_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_ar750s_gpio_keys), - gl_ar750s_gpio_keys); -} - - -MIPS_MACHINE(ATH79_MACH_GL_AR750S, "GL-AR750S", "GL-AR750S", - gl_ar750s_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-jwap230.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-jwap230.c deleted file mode 100644 index 820d3eeab..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-jwap230.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * jjPlus JWAP230 board support - * - * Copyright (C) 2016 Piotr Dymacz - * - * Based on mach-wpj558.c and mach-tl-wr1043nd-v2.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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define JWAP230_GPIO_LED_LED1 23 -#define JWAP230_GPIO_LED_LED2 22 -#define JWAP230_GPIO_LED_LED3 21 - -#define JWAP230_MAC0_OFFSET 0x0 -#define JWAP230_MAC1_OFFSET 0x6 -#define JWAP230_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led jwap230_leds_gpio[] __initdata = { - { - .name = "jwap230:green:led1", - .gpio = JWAP230_GPIO_LED_LED1, - .active_low = 1, - }, - { - .name = "jwap230:green:led2", - .gpio = JWAP230_GPIO_LED_LED2, - .active_low = 1, - }, - { - .name = "jwap230:green:led3", - .gpio = JWAP230_GPIO_LED_LED3, - .active_low = 1, - } -}; - -static const struct ar8327_led_info jwap230_leds_qca8337[] = { - AR8327_LED_INFO(PHY0_0, HW, "jwap230:green:lan"), - AR8327_LED_INFO(PHY4_0, HW, "jwap230:green:wan"), -}; - -/* Blink rate: 1 Gbps -> 8 hz, 100 Mbs -> 4 Hz, 10 Mbps -> 2 Hz */ -static struct ar8327_led_cfg jwap230_qca8337_led_cfg = { - .led_ctrl0 = 0xcf37cf37, - .led_ctrl1 = 0xcf37cf37, - .led_ctrl2 = 0xcf37cf37, - .led_ctrl3 = 0x0, - .open_drain = true, -}; - -/* QCA8337 GMAC0 is connected with QCA9558 over RGMII */ -static struct ar8327_pad_cfg jwap230_qca8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, - .mac06_exchange_dis = true, -}; - -/* QCA8337 GMAC6 is connected with QCA9558 over SGMII */ -static struct ar8327_pad_cfg jwap230_qca8337_pad6_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, -}; - -static struct ar8327_platform_data jwap230_qca8337_data = { - .pad0_cfg = &jwap230_qca8337_pad0_cfg, - .pad6_cfg = &jwap230_qca8337_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &jwap230_qca8337_led_cfg, - .num_leds = ARRAY_SIZE(jwap230_leds_qca8337), - .leds = jwap230_leds_qca8337, -}; - -static struct mdio_board_info jwap230_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "jwap230", - .mdio_addr = 0, - .platform_data = &jwap230_qca8337_data, - }, -}; - -static void __init jwap230_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(jwap230_leds_gpio), - jwap230_leds_gpio); - - mdiobus_register_board_info(jwap230_mdio0_info, - ARRAY_SIZE(jwap230_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - /* QCA9558 GMAC0 is connected to RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0xa6000000; - - ath79_init_mac(ath79_eth0_data.mac_addr, art + JWAP230_MAC0_OFFSET, 0); - ath79_register_eth(0); - - /* QCA9558 GMAC1 is connected to SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_init_mac(ath79_eth1_data.mac_addr, art + JWAP230_MAC1_OFFSET, 0); - ath79_register_eth(1); - - ath79_register_wmac(art + JWAP230_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_JWAP230, "JWAP230", "jjPlus JWAP230", jwap230_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-k2t.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-k2t.c deleted file mode 100644 index c8cbba4dd..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-k2t.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Phicomm K2T A1/A2/A3 reference board support - * - * Copyright (c) 2018 Chen Minqiang - * - * 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 "common.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" - -#define K2T_GPIO_LED_BLUE 6 -#define K2T_GPIO_LED_RED 7 -#define K2T_GPIO_LED_YELLOW 8 - -#define K2T_GPIO_BTN_RESET 2 -#define K2T_KEYS_POLL_INTERVAL 20 /* msecs */ -#define K2T_KEYS_DEBOUNCE_INTERVAL (3 * K2T_KEYS_POLL_INTERVAL) - -#define K2T_MAC0_OFFSET 0 - -static struct gpio_led k2t_leds_gpio[] __initdata = { - { - .name = "k2t:blue:lan", - .gpio = K2T_GPIO_LED_BLUE, - .active_low = 1, - }, - { - .name = "k2t:red:lan", - .gpio = K2T_GPIO_LED_RED, - .active_low = 0, - }, - { - .name = "k2t:yellow:lan", - .gpio = K2T_GPIO_LED_YELLOW, - .active_low = 1, - }, -}; - -static struct gpio_keys_button k2t_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = K2T_KEYS_DEBOUNCE_INTERVAL, - .gpio = K2T_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg k2t_ar8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data k2t_ar8337_data = { - .pad0_cfg = &k2t_ar8337_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info k2t_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "k2t", - .mdio_addr = 0, - .platform_data = &k2t_ar8337_data, - }, -}; - -static void __init k2t_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(k2t_leds_gpio), - k2t_leds_gpio); - ath79_register_gpio_keys_polled(-1, K2T_KEYS_POLL_INTERVAL, - ARRAY_SIZE(k2t_gpio_keys), - k2t_gpio_keys); - - ath79_register_usb(); - - platform_device_register(&ath79_mdio0_device); - - mdiobus_register_board_info(k2t_mdio0_info, - ARRAY_SIZE(k2t_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + K2T_MAC0_OFFSET, 0); - - /* GMAC0 is connected to an AR8337 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); - - ath79_register_wmac_simple(); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_K2T, "K2T", "Phicomm K2T A1/A2/A3 board",k2t_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-koala.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-koala.c deleted file mode 100644 index 53171d95a..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-koala.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * OCEDO Koala board support - * Based on the MR1750 machine file - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Marek Lindner - * Copyright (c) 2018 David Bauer - * - * 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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define KOALA_GPIO_LED_POWER 22 -#define KOALA_GPIO_LED_WLAN_5G 13 -#define KOALA_GPIO_LED_WLAN_2G 23 -#define KOALA_GPIO_LED_WLAN_SYS 19 - -#define KOALA_GPIO_BTN_RESET 17 - -#define KOALA_KEYS_POLL_INTERVAL 20 /* msecs */ -#define KOALA_KEYS_DEBOUNCE_INTERVAL (3 * KOALA_KEYS_POLL_INTERVAL) - -#define KOALA_LAN_MAC_OFFSET 0 -#define KOALA_WIFI2G_MAC_OFFSET 0x06 -#define KOALA_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led koala_leds_gpio[] __initdata = { - { - .name = "koala:green:power", - .gpio = KOALA_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "koala:red:wlan58", - .gpio = KOALA_GPIO_LED_WLAN_5G, - .active_low = 1, - }, - { - .name = "koala:yellow:wlan2", - .gpio = KOALA_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "koala:blue:sys", - .gpio = KOALA_GPIO_LED_WLAN_SYS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button koala_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = KOALA_KEYS_DEBOUNCE_INTERVAL, - .gpio = KOALA_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct at803x_platform_data koala_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 0, - .fixup_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info koala_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "koala", - .mdio_addr = 5, - .platform_data = &koala_at803x_data, - }, -}; - -static void __init koala_setup_qca955x_eth_cfg(u32 mask, - unsigned int rxd, - unsigned int rxdv, - unsigned int txd, - unsigned int txe) -{ - void __iomem *base; - u32 t; - - base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); - - t = mask; - t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; - t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; - t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; - t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; - - __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -static void __init koala_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - ath79_eth0_pll_data.pll_1000 = 0xae000000; - ath79_eth0_pll_data.pll_100 = 0xa0000101; - ath79_eth0_pll_data.pll_10 = 0xa0001313; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(koala_leds_gpio), - koala_leds_gpio); - ath79_register_gpio_keys_polled(-1, KOALA_KEYS_POLL_INTERVAL, - ARRAY_SIZE(koala_gpio_keys), - koala_gpio_keys); - - ath79_init_mac(mac, art + KOALA_WIFI2G_MAC_OFFSET, 0); - ath79_register_wmac(art + KOALA_WMAC_CALDATA_OFFSET, mac); - ath79_register_pci(); - - koala_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(koala_mdio0_info, - ARRAY_SIZE(koala_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + KOALA_LAN_MAC_OFFSET, 0); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(5); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_KOALA, "KOALA", "OCEDO Koala", koala_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr1750.c deleted file mode 100644 index 0b92154ae..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr1750.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * MR1750 board support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Marek Lindner - * - * 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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define MR1750_GPIO_LED_LAN 12 -#define MR1750_GPIO_LED_WLAN_2G 13 -#define MR1750_GPIO_LED_STATUS_GREEN 19 -#define MR1750_GPIO_LED_STATUS_RED 21 -#define MR1750_GPIO_LED_POWER 22 -#define MR1750_GPIO_LED_WLAN_5G 23 - -#define MR1750_GPIO_BTN_RESET 17 - -#define MR1750_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MR1750_KEYS_DEBOUNCE_INTERVAL (3 * MR1750_KEYS_POLL_INTERVAL) - -#define MR1750_MAC0_OFFSET 0 -#define MR1750_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led mr1750_leds_gpio[] __initdata = { - { - .name = "mr1750:blue:power", - .gpio = MR1750_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "mr1750:blue:wan", - .gpio = MR1750_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "mr1750:blue:wlan24", - .gpio = MR1750_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "mr1750:blue:wlan58", - .gpio = MR1750_GPIO_LED_WLAN_5G, - .active_low = 1, - }, - { - .name = "mr1750:green:status", - .gpio = MR1750_GPIO_LED_STATUS_GREEN, - .active_low = 1, - }, - { - .name = "mr1750:red:status", - .gpio = MR1750_GPIO_LED_STATUS_RED, - .active_low = 1, - }, -}; - -static struct gpio_keys_button mr1750_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MR1750_KEYS_DEBOUNCE_INTERVAL, - .gpio = MR1750_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct at803x_platform_data mr1750_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 0, - .fixup_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info mr1750_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "mr1750", - .mdio_addr = 5, - .platform_data = &mr1750_at803x_data, - }, -}; - -static void __init mr1750_setup_qca955x_eth_cfg(u32 mask, - unsigned int rxd, - unsigned int rxdv, - unsigned int txd, - unsigned int txe) -{ - void __iomem *base; - u32 t; - - base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); - - t = mask; - t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; - t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; - t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; - t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; - - __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -static void __init mr1750_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - ath79_eth0_pll_data.pll_1000 = 0xae000000; - ath79_eth0_pll_data.pll_100 = 0xa0000101; - ath79_eth0_pll_data.pll_10 = 0xa0001313; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(mr1750_leds_gpio), - mr1750_leds_gpio); - ath79_register_gpio_keys_polled(-1, MR1750_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mr1750_gpio_keys), - mr1750_gpio_keys); - - ath79_init_mac(mac, art + MR1750_MAC0_OFFSET, 1); - ath79_register_wmac(art + MR1750_WMAC_CALDATA_OFFSET, mac); - ath79_register_pci(); - - mr1750_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(mr1750_mdio0_info, - ARRAY_SIZE(mr1750_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + MR1750_MAC0_OFFSET, 0); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(5); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_MR1750, "MR1750", "OpenMesh MR1750", mr1750_setup); -MIPS_MACHINE(ATH79_MACH_MR1750V2, "MR1750v2", "OpenMesh MR1750v2", mr1750_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr900.c deleted file mode 100644 index 6fe6764c1..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr900.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * MR900 board support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Marek Lindner - * - * 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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define MR900_GPIO_LED_LAN 12 -#define MR900_GPIO_LED_WLAN_2G 13 -#define MR900_GPIO_LED_STATUS_GREEN 19 -#define MR900_GPIO_LED_STATUS_RED 21 -#define MR900_GPIO_LED_POWER 22 -#define MR900_GPIO_LED_WLAN_5G 23 - -#define MR900_GPIO_BTN_RESET 17 - -#define MR900_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MR900_KEYS_DEBOUNCE_INTERVAL (3 * MR900_KEYS_POLL_INTERVAL) - -#define MR900_MAC0_OFFSET 0 -#define MR900_WMAC_CALDATA_OFFSET 0x1000 -#define MR900_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led mr900_leds_gpio[] __initdata = { - { - .name = "mr900:blue:power", - .gpio = MR900_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "mr900:blue:wan", - .gpio = MR900_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "mr900:blue:wlan24", - .gpio = MR900_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "mr900:blue:wlan58", - .gpio = MR900_GPIO_LED_WLAN_5G, - .active_low = 1, - }, - { - .name = "mr900:green:status", - .gpio = MR900_GPIO_LED_STATUS_GREEN, - .active_low = 1, - }, - { - .name = "mr900:red:status", - .gpio = MR900_GPIO_LED_STATUS_RED, - .active_low = 1, - }, -}; - -static struct gpio_keys_button mr900_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MR900_KEYS_DEBOUNCE_INTERVAL, - .gpio = MR900_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct at803x_platform_data mr900_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 0, - .fixup_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info mr900_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "mr900", - .mdio_addr = 5, - .platform_data = &mr900_at803x_data, - }, -}; - -static void __init mr900_setup_qca955x_eth_cfg(u32 mask, - unsigned int rxd, - unsigned int rxdv, - unsigned int txd, - unsigned int txe) -{ - void __iomem *base; - u32 t; - - base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); - - t = mask; - t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; - t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; - t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; - t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; - - __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -static void __init mr900_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6], pcie_mac[6]; - struct ath9k_platform_data *pdata; - - ath79_eth0_pll_data.pll_1000 = 0xae000000; - ath79_eth0_pll_data.pll_100 = 0xa0000101; - ath79_eth0_pll_data.pll_10 = 0xa0001313; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(mr900_leds_gpio), - mr900_leds_gpio); - ath79_register_gpio_keys_polled(-1, MR900_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mr900_gpio_keys), - mr900_gpio_keys); - - ath79_init_mac(mac, art + MR900_MAC0_OFFSET, 1); - ath79_register_wmac(art + MR900_WMAC_CALDATA_OFFSET, mac); - ath79_init_mac(pcie_mac, art + MR900_MAC0_OFFSET, 16); - ap91_pci_init(art + MR900_PCIE_CALDATA_OFFSET, pcie_mac); - pdata = ap9x_pci_get_wmac_data(0); - if (!pdata) { - pr_err("mr900: unable to get address of wlan data\n"); - return; - } - pdata->use_eeprom = true; - - mr900_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(mr900_mdio0_info, - ARRAY_SIZE(mr900_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + MR900_MAC0_OFFSET, 0); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(5); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_MR900, "MR900", "OpenMesh MR900", mr900_setup); -MIPS_MACHINE(ATH79_MACH_MR900v2, "MR900v2", "OpenMesh MR900v2", mr900_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-n750.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-n750.c deleted file mode 100644 index 713f354fe..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-n750.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * WD My Net N750 board support - * - * Copyright (C) 2013 Felix Kaechele - * Copyright (C) 2013 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - - -/* - * Taken from GPL bootloader source: - * board/ar7240/db12x/alpha_gpio.c - */ -#define MYNET_N750_GPIO_LED_WIFI 11 -#define MYNET_N750_GPIO_LED_INTERNET 12 -#define MYNET_N750_GPIO_LED_WPS 13 -#define MYNET_N750_GPIO_LED_POWER 14 - -#define MYNET_N750_GPIO_BTN_RESET 17 -#define MYNET_N750_GPIO_BTN_WPS 19 - -#define MYNET_N750_GPIO_EXTERNAL_LNA0 15 -#define MYNET_N750_GPIO_EXTERNAL_LNA1 18 - -#define MYNET_N750_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MYNET_N750_KEYS_DEBOUNCE_INTERVAL (3 * MYNET_N750_KEYS_POLL_INTERVAL) - -#define MYNET_N750_WMAC_CALDATA_OFFSET 0x1000 -#define MYNET_N750_PCIE_CALDATA_OFFSET 0x5000 - -#define MYNET_N750_NVRAM_ADDR 0x1f058010 -#define MYNET_N750_NVRAM_SIZE 0x7ff0 - -static struct gpio_led mynet_n750_leds_gpio[] __initdata = { - { - .name = "wd:blue:power", - .gpio = MYNET_N750_GPIO_LED_POWER, - .active_low = 0, - }, - { - .name = "wd:blue:wps", - .gpio = MYNET_N750_GPIO_LED_WPS, - .active_low = 0, - }, - { - .name = "wd:blue:wireless", - .gpio = MYNET_N750_GPIO_LED_WIFI, - .active_low = 0, - }, - { - .name = "wd:blue:internet", - .gpio = MYNET_N750_GPIO_LED_INTERNET, - .active_low = 0, - }, -}; - -static struct gpio_keys_button mynet_n750_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MYNET_N750_KEYS_DEBOUNCE_INTERVAL, - .gpio = MYNET_N750_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = MYNET_N750_KEYS_DEBOUNCE_INTERVAL, - .gpio = MYNET_N750_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static const struct ar8327_led_info mynet_n750_leds_ar8327[] = { - AR8327_LED_INFO(PHY0_0, HW, "wd:green:lan1"), - AR8327_LED_INFO(PHY1_0, HW, "wd:green:lan2"), - AR8327_LED_INFO(PHY2_0, HW, "wd:green:lan3"), - AR8327_LED_INFO(PHY3_0, HW, "wd:green:lan4"), - AR8327_LED_INFO(PHY4_0, HW, "wd:green:wan"), - AR8327_LED_INFO(PHY0_1, HW, "wd:yellow:lan1"), - AR8327_LED_INFO(PHY1_1, HW, "wd:yellow:lan2"), - AR8327_LED_INFO(PHY2_1, HW, "wd:yellow:lan3"), - AR8327_LED_INFO(PHY3_1, HW, "wd:yellow:lan4"), - AR8327_LED_INFO(PHY4_1, HW, "wd:yellow:wan"), -}; - -static struct ar8327_pad_cfg mynet_n750_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg mynet_n750_ar8327_led_cfg = { - .led_ctrl0 = 0xcc35cc35, - .led_ctrl1 = 0xca35ca35, - .led_ctrl2 = 0xc935c935, - .led_ctrl3 = 0x03ffff00, - .open_drain = false, -}; - -static struct ar8327_platform_data mynet_n750_ar8327_data = { - .pad0_cfg = &mynet_n750_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &mynet_n750_ar8327_led_cfg, - .num_leds = ARRAY_SIZE(mynet_n750_leds_ar8327), - .leds = mynet_n750_leds_ar8327, -}; - -static struct mdio_board_info mynet_n750_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "mynet_n750", - .mdio_addr = 0, - .platform_data = &mynet_n750_ar8327_data, - }, -}; - -static void mynet_n750_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(MYNET_N750_NVRAM_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, MYNET_N750_NVRAM_SIZE, - name, mac); - if (err) - pr_err("no MAC address found for %s\n", name); -} - -/* - * The bootloader on this board powers down all PHYs on the switch - * before booting the kernel. We bring all PHYs back up so that they are - * discoverable by the mdio bus scan and the switch is detected - * correctly. - */ -static void mynet_n750_mdio_fixup(struct mii_bus *bus) -{ - int i; - - for (i = 0; i < 5; i++) - bus->write(bus, i, MII_BMCR, - (BMCR_RESET | BMCR_ANENABLE | BMCR_SPEED1000)); - - mdelay(1000); -} - -static void __init mynet_n750_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(mynet_n750_leds_gpio), - mynet_n750_leds_gpio); - ath79_register_gpio_keys_polled(-1, MYNET_N750_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mynet_n750_gpio_keys), - mynet_n750_gpio_keys); - /* - * Control signal for external LNAs 0 and 1 - * Taken from GPL bootloader source: - * board/ar7240/db12x/alpha_gpio.c - */ - ath79_wmac_set_ext_lna_gpio(0, MYNET_N750_GPIO_EXTERNAL_LNA0); - ath79_wmac_set_ext_lna_gpio(1, MYNET_N750_GPIO_EXTERNAL_LNA1); - - mynet_n750_get_mac("wlan24mac=", tmpmac); - ath79_register_wmac(art + MYNET_N750_WMAC_CALDATA_OFFSET, tmpmac); - - mynet_n750_get_mac("wlan5mac=", tmpmac); - ap91_pci_init(art + MYNET_N750_PCIE_CALDATA_OFFSET, tmpmac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - mdiobus_register_board_info(mynet_n750_mdio0_info, - ARRAY_SIZE(mynet_n750_mdio0_info)); - - ath79_mdio0_data.reset = mynet_n750_mdio_fixup; - ath79_register_mdio(0, 0x0); - - mynet_n750_get_mac("lanmac=", ath79_eth0_data.mac_addr); - - /* GMAC0 is connected to an AR8327N switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_MYNET_N750, "MYNET-N750", "WD My Net N750", - mynet_n750_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-rext.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-rext.c deleted file mode 100644 index e202f0fc6..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-rext.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * WD My Net WI-FI Range Extender (Codename:Starfish db12x) board support - * - * Copyright (C) 2013 Christian Lamparter - * - * 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define MYNET_REXT_GPIO_LED_POWER 11 -#define MYNET_REXT_GPIO_LED_ETHERNET 12 -#define MYNET_REXT_GPIO_LED_WIFI 19 - -#define MYNET_REXT_GPIO_LED_RF_QTY1 20 -#define MYNET_REXT_GPIO_LED_RF_QTY2 21 -#define MYNET_REXT_GPIO_LED_RF_QTY3 22 - -#define MYNET_REXT_GPIO_BTN_RESET 13 -#define MYNET_REXT_GPIO_BTN_WPS 15 -#define MYNET_REXT_GPIO_SW_RF 14 - -#define MYNET_REXT_GPIO_PHY_SWRST 16 /* disables Ethernet PHY */ -#define MYNET_REXT_GPIO_PHY_INT 17 -#define MYNET_REXT_GPIO_18 18 - -#define MYNET_REXT_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MYNET_REXT_KEYS_DEBOUNCE_INTERVAL (3 * MYNET_REXT_KEYS_POLL_INTERVAL) - -#define MYNET_REXT_WMAC_CALDATA_OFFSET 0x1000 - -#define MYNET_REXT_NVRAM_ADDR 0x1f7e0010 -#define MYNET_REXT_NVRAM_SIZE 0xfff0 - -#define MYNET_REXT_ART_ADDR 0x1f7f0000 - -static const char *mynet_rext_part_probes[] = { - "cybertan", - NULL, -}; - -static struct flash_platform_data mynet_rext_flash_data = { - .type = "s25fl064k", - .part_probes = mynet_rext_part_probes, -}; - -static struct gpio_led mynet_rext_leds_gpio[] __initdata = { - { - .name = "wd:blue:power", - .gpio = MYNET_REXT_GPIO_LED_POWER, - .active_low = 0, - }, - { - .name = "wd:blue:wireless", - .gpio = MYNET_REXT_GPIO_LED_WIFI, - .active_low = 1, - }, - { - .name = "wd:blue:ethernet", - .gpio = MYNET_REXT_GPIO_LED_ETHERNET, - .active_low = 1, - }, - { - .name = "wd:blue:quality1", - .gpio = MYNET_REXT_GPIO_LED_RF_QTY1, - .active_low = 1, - }, - { - .name = "wd:blue:quality2", - .gpio = MYNET_REXT_GPIO_LED_RF_QTY2, - .active_low = 1, - }, - { - .name = "wd:blue:quality3", - .gpio = MYNET_REXT_GPIO_LED_RF_QTY3, - .active_low = 1, - }, -}; - -static struct gpio_keys_button mynet_rext_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MYNET_REXT_KEYS_DEBOUNCE_INTERVAL, - .gpio = MYNET_REXT_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = MYNET_REXT_KEYS_DEBOUNCE_INTERVAL, - .gpio = MYNET_REXT_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "RF Band switch", - .type = EV_SW, - .code = BTN_1, - .debounce_interval = MYNET_REXT_KEYS_DEBOUNCE_INTERVAL, - .gpio = MYNET_REXT_GPIO_SW_RF, - }, -}; - -static struct at803x_platform_data mynet_rext_at803x_data = { - .disable_smarteee = 0, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 0, - .fixup_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info mynet_rext_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "mynet_rext", - .mdio_addr = 4, - .platform_data = &mynet_rext_at803x_data, - }, -}; - -static void mynet_rext_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(MYNET_REXT_NVRAM_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, MYNET_REXT_NVRAM_SIZE, - name, mac); - if (err) - pr_err("no MAC address found for %s\n", name); -} - -static void __init mynet_rext_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(MYNET_REXT_ART_ADDR); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&mynet_rext_flash_data); - - /* GPIO configuration from drivers/char/GPIO8.c */ - - ath79_gpio_output_select(MYNET_REXT_GPIO_LED_POWER, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_REXT_GPIO_LED_WIFI, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_REXT_GPIO_LED_RF_QTY1, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_REXT_GPIO_LED_RF_QTY2, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_REXT_GPIO_LED_RF_QTY3, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_REXT_GPIO_LED_ETHERNET, - AR934X_GPIO_OUT_GPIO); - ath79_register_leds_gpio(-1, ARRAY_SIZE(mynet_rext_leds_gpio), - mynet_rext_leds_gpio); - - ath79_register_gpio_keys_polled(-1, MYNET_REXT_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mynet_rext_gpio_keys), - mynet_rext_gpio_keys); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_RXD_DELAY | - AR934X_ETH_CFG_RDV_DELAY); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(mynet_rext_mdio0_info, - ARRAY_SIZE(mynet_rext_mdio0_info)); - - /* LAN */ - mynet_rext_get_mac("et0macaddr=", ath79_eth0_data.mac_addr); - - /* GMAC0 is connected to an external PHY on Port 4 */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_pll_data.pll_10 = 0x00001313; /* athrs_mac.c */ - ath79_eth0_pll_data.pll_1000 = 0x0e000000; /* athrs_mac.c */ - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_register_eth(0); - - /* WLAN */ - mynet_rext_get_mac("wl0_hwaddr=", tmpmac); - ap91_pci_init(art + MYNET_REXT_WMAC_CALDATA_OFFSET, tmpmac); -} - -MIPS_MACHINE(ATH79_MACH_MYNET_REXT, "MYNET-REXT", - "WD My Net Wi-Fi Range Extender", mynet_rext_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-nbg6716.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-nbg6716.c deleted file mode 100644 index bb4c19269..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-nbg6716.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * ZyXEL NBG6716/NBG6616 board support - * - * Based on the Qualcomm Atheros AP135/AP136 reference board support code - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * Copyright (c) 2013 Andre Valentin - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-nfc.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define NBG6716_GPIO_LED_INTERNET 18 -#define NBG6716_GPIO_LED_POWER 15 -#define NBG6716_GPIO_LED_USB1 4 -#define NBG6716_GPIO_LED_USB2 13 -#define NBG6716_GPIO_LED_WIFI2G 19 -#define NBG6716_GPIO_LED_WIFI5G 17 -#define NBG6716_GPIO_LED_WPS 21 - -#define NBG6716_GPIO_BTN_RESET 23 -#define NBG6716_GPIO_BTN_RFKILL 1 -#define NBG6716_GPIO_BTN_USB1 0 -#define NBG6716_GPIO_BTN_USB2 14 -#define NBG6716_GPIO_BTN_WPS 22 - -#define NBG6716_GPIO_USB_POWER 16 - -#define NBG6716_KEYS_POLL_INTERVAL 20 /* msecs */ -#define NBG6716_KEYS_DEBOUNCE_INTERVAL (3 * NBG6716_KEYS_POLL_INTERVAL) - -#define NBG6716_MAC0_OFFSET 0 -#define NBG6716_MAC1_OFFSET 6 -#define NBG6716_WMAC_CALDATA_OFFSET 0x1000 -#define NBG6716_PCIE_CALDATA_OFFSET 0x5000 - -/* NBG6616 has a different GPIO usage as it does not have USB Buttons */ -#define NBG6616_GPIO_LED_USB0 14 -#define NBG6616_GPIO_LED_USB1 21 -#define NBG6616_GPIO_LED_WPS 0 - -static struct gpio_led nbg6716_leds_gpio[] __initdata = { - { - .name = "nbg6716:white:internet", - .gpio = NBG6716_GPIO_LED_INTERNET, - .active_low = 1, - }, - { - .name = "nbg6716:white:power", - .gpio = NBG6716_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "nbg6716:white:usb1", - .gpio = NBG6716_GPIO_LED_USB1, - .active_low = 1, - }, - { - .name = "nbg6716:white:usb2", - .gpio = NBG6716_GPIO_LED_USB2, - .active_low = 1, - }, - { - .name = "nbg6716:white:wifi2g", - .gpio = NBG6716_GPIO_LED_WIFI2G, - .active_low = 1, - }, - { - .name = "nbg6716:white:wifi5g", - .gpio = NBG6716_GPIO_LED_WIFI5G, - .active_low = 1, - }, - { - .name = "nbg6716:white:wps", - .gpio = NBG6716_GPIO_LED_WPS, - .active_low = 1, - } -}; - -static struct gpio_keys_button nbg6716_gpio_keys[] __initdata = { - { - .desc = "RESET button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG6716_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "RFKILL button", - .type = EV_SW, - .code = KEY_RFKILL, - .debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG6716_GPIO_BTN_RFKILL, - .active_low = 0, - }, - { - .desc = "USB1 eject button", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG6716_GPIO_BTN_USB1, - .active_low = 1, - }, - { - .desc = "USB2 eject button", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG6716_GPIO_BTN_USB2, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG6716_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - - - -static struct gpio_led nbg6616_leds_gpio[] __initdata = { - { - .name = "nbg6616:green:power", - .gpio = NBG6716_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "nbg6616:green:usb2", - .gpio = NBG6616_GPIO_LED_USB0, - .active_low = 1, - }, - { - .name = "nbg6616:green:usb1", - .gpio = NBG6616_GPIO_LED_USB1, - .active_low = 1, - }, - { - .name = "nbg6616:green:wifi2g", - .gpio = NBG6716_GPIO_LED_WIFI2G, - .active_low = 1, - }, - { - .name = "nbg6616:green:wifi5g", - .gpio = NBG6716_GPIO_LED_WIFI5G, - .active_low = 1, - }, - { - .name = "nbg6616:green:wps", - .gpio = NBG6616_GPIO_LED_WPS, - .active_low = 1, - } -}; - -static struct gpio_keys_button nbg6616_gpio_keys[] __initdata = { - { - .desc = "RESET button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG6716_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG6716_GPIO_BTN_RFKILL, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = NBG6716_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG6716_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - - -static struct ar8327_pad_cfg nbg6716_ar8327_pad0_cfg; -static struct ar8327_pad_cfg nbg6716_ar8327_pad6_cfg; -static struct ar8327_led_cfg nbg6716_ar8327_led_cfg; - -static struct ar8327_platform_data nbg6716_ar8327_data = { - .pad0_cfg = &nbg6716_ar8327_pad0_cfg, - .pad6_cfg = &nbg6716_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &nbg6716_ar8327_led_cfg -}; - -static struct mdio_board_info nbg6716_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "nbg6716", - .mdio_addr = 0, - .platform_data = &nbg6716_ar8327_data, - }, -}; - -static void nbg6716_get_mac(void* nvram_addr, const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(nvram_addr); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, 0x10000, - name, mac); - if (err) - pr_err("no MAC address found for %s\n", name); -} - -static void __init nbg6716_common_setup(u32 leds_num, struct gpio_led* leds, - u32 keys_num, - struct gpio_keys_button* keys, - void* art_addr, void* nvram) -{ - u8 *art = (u8 *) KSEG1ADDR(art_addr); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, leds_num, leds); - ath79_register_gpio_keys_polled(-1, NBG6716_KEYS_POLL_INTERVAL, - keys_num, keys); - - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW); - ath79_register_nfc(); - - gpio_request_one(NBG6716_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - ath79_register_usb(); - - nbg6716_get_mac(nvram, "ethaddr=", tmpmac); - - ath79_register_pci(); - - ath79_register_wmac(art + NBG6716_WMAC_CALDATA_OFFSET, tmpmac); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, tmpmac, 2); - ath79_init_mac(ath79_eth1_data.mac_addr, tmpmac, 3); - - mdiobus_register_board_info(nbg6716_mdio0_info, - ARRAY_SIZE(nbg6716_mdio0_info)); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); -} - -static void __init nbg6716_010_setup(void) -{ - /* GMAC0 of the AR8337 switch is connected to GMAC0 via RGMII */ - nbg6716_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_RGMII; - nbg6716_ar8327_pad0_cfg.txclk_delay_en = true; - nbg6716_ar8327_pad0_cfg.rxclk_delay_en = true; - nbg6716_ar8327_pad0_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1; - nbg6716_ar8327_pad0_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2; - - /* GMAC6 of the AR8337 switch is connected to GMAC1 via SGMII */ - nbg6716_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_SGMII; - nbg6716_ar8327_pad6_cfg.rxclk_delay_en = true; - nbg6716_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL0; - - ath79_eth0_pll_data.pll_1000 = 0xa6000000; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - nbg6716_ar8327_led_cfg.open_drain = 0; - nbg6716_ar8327_led_cfg.led_ctrl0 = 0xffb7ffb7; - nbg6716_ar8327_led_cfg.led_ctrl1 = 0xffb7ffb7; - nbg6716_ar8327_led_cfg.led_ctrl2 = 0xffb7ffb7; - nbg6716_ar8327_led_cfg.led_ctrl3 = 0x03ffff00; - - nbg6716_common_setup(ARRAY_SIZE(nbg6716_leds_gpio), nbg6716_leds_gpio, - ARRAY_SIZE(nbg6716_gpio_keys), nbg6716_gpio_keys, - (void*) 0x1f050000, (void*) 0x1f040000); -} - -static void __init nbg6616_010_setup(void) -{ - /* GMAC0 of the AR8337 switch is connected to GMAC0 via RGMII */ - nbg6716_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_RGMII; - nbg6716_ar8327_pad0_cfg.txclk_delay_en = true; - nbg6716_ar8327_pad0_cfg.rxclk_delay_en = true; - nbg6716_ar8327_pad0_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1; - nbg6716_ar8327_pad0_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2; - - /* GMAC6 of the AR8337 switch is connected to GMAC1 via SGMII */ - nbg6716_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_SGMII; - nbg6716_ar8327_pad6_cfg.rxclk_delay_en = true; - nbg6716_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL0; - - ath79_eth0_pll_data.pll_1000 = 0xa6000000; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - nbg6716_ar8327_led_cfg.open_drain = 0; - nbg6716_ar8327_led_cfg.led_ctrl0 = 0xffb7ffb7; - nbg6716_ar8327_led_cfg.led_ctrl1 = 0xffb7ffb7; - nbg6716_ar8327_led_cfg.led_ctrl2 = 0xffb7ffb7; - nbg6716_ar8327_led_cfg.led_ctrl3 = 0x03ffff00; - - - nbg6716_common_setup(ARRAY_SIZE(nbg6616_leds_gpio), nbg6616_leds_gpio, - ARRAY_SIZE(nbg6616_gpio_keys), nbg6616_gpio_keys, - (void*) 0x1f040000, (void*) 0x1f030000); -} - - -MIPS_MACHINE(ATH79_MACH_NBG6716, "NBG6716", - "Zyxel NBG6716", - nbg6716_010_setup); - -MIPS_MACHINE(ATH79_MACH_NBG6616, "NBG6616", - "Zyxel NBG6616", - nbg6616_010_setup); - diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5p.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5p.c deleted file mode 100644 index 3d30dd467..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5p.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * OpenMesh OM5P support - * - * Copyright (C) 2013 Marek Lindner - * Copyright (C) 2014 Sven Eckelmann - * - * 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 "machtypes.h" - -#define OM5P_GPIO_LED_POWER 13 -#define OM5P_GPIO_LED_GREEN 16 -#define OM5P_GPIO_LED_RED 19 -#define OM5P_GPIO_LED_YELLOW 17 -#define OM5P_GPIO_LED_LAN 14 -#define OM5P_GPIO_LED_WAN 15 -#define OM5P_GPIO_BTN_RESET 4 -#define OM5P_GPIO_I2C_SCL 20 -#define OM5P_GPIO_I2C_SDA 21 - -#define OM5P_KEYS_POLL_INTERVAL 20 /* msecs */ -#define OM5P_KEYS_DEBOUNCE_INTERVAL (3 * OM5P_KEYS_POLL_INTERVAL) - -#define OM5P_WMAC_CALDATA_OFFSET 0x1000 -#define OM5P_PCI_CALDATA_OFFSET 0x5000 - -static struct gpio_led om5p_leds_gpio[] __initdata = { - { - .name = "om5p:blue:power", - .gpio = OM5P_GPIO_LED_POWER, - .active_low = 1, - }, { - .name = "om5p:red:wifi", - .gpio = OM5P_GPIO_LED_RED, - .active_low = 1, - }, { - .name = "om5p:yellow:wifi", - .gpio = OM5P_GPIO_LED_YELLOW, - .active_low = 1, - }, { - .name = "om5p:green:wifi", - .gpio = OM5P_GPIO_LED_GREEN, - .active_low = 1, - }, { - .name = "om5p:blue:lan", - .gpio = OM5P_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "om5p:blue:wan", - .gpio = OM5P_GPIO_LED_WAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button om5p_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = OM5P_KEYS_DEBOUNCE_INTERVAL, - .gpio = OM5P_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct flash_platform_data om5p_flash_data = { - .type = "mx25l12805d", -}; - -static void __init om5p_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - /* make lan / wan leds software controllable */ - ath79_gpio_output_select(OM5P_GPIO_LED_LAN, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(OM5P_GPIO_LED_WAN, AR934X_GPIO_OUT_GPIO); - - ath79_register_m25p80(&om5p_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(om5p_leds_gpio), - om5p_leds_gpio); - ath79_register_gpio_keys_polled(-1, OM5P_KEYS_POLL_INTERVAL, - ARRAY_SIZE(om5p_gpio_keys), - om5p_gpio_keys); - - ath79_init_mac(mac, art, 2); - ath79_register_wmac(art + OM5P_WMAC_CALDATA_OFFSET, mac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art, 1); - - /* GMAC0 is connected to the PHY0 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_OM5P, "OM5P", "OpenMesh OM5P", om5p_setup); - -static struct i2c_gpio_platform_data om5pan_i2c_device_platdata = { - .sda_pin = OM5P_GPIO_I2C_SDA, - .scl_pin = OM5P_GPIO_I2C_SCL, - .udelay = 10, - .sda_is_open_drain = 1, - .scl_is_open_drain = 1, -}; - -static struct platform_device om5pan_i2c_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &om5pan_i2c_device_platdata, - }, -}; - -static struct i2c_board_info om5pan_i2c_devs[] __initdata = { - { - I2C_BOARD_INFO("tmp423", 0x4c), - }, -}; - -static struct at803x_platform_data om5p_an_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info om5p_an_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = " om5p_an", - .mdio_addr = 7, - .platform_data = &om5p_an_at803x_data, - }, -}; - -static void __init om5p_an_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - /* temperature sensor */ - platform_device_register(&om5pan_i2c_device); - i2c_register_board_info(0, om5pan_i2c_devs, - ARRAY_SIZE(om5pan_i2c_devs)); - - /* make lan / wan leds software controllable */ - ath79_gpio_output_select(OM5P_GPIO_LED_LAN, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(OM5P_GPIO_LED_WAN, AR934X_GPIO_OUT_GPIO); - - ath79_register_m25p80(&om5p_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(om5p_leds_gpio), - om5p_leds_gpio); - - ath79_init_mac(mac, art, 0x02); - ath79_register_wmac(art + OM5P_WMAC_CALDATA_OFFSET, mac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - ath79_setup_ar934x_eth_rx_delay(2, 2); - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - mdiobus_register_board_info(om5p_an_mdio0_info, - ARRAY_SIZE(om5p_an_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0x00); - ath79_init_mac(ath79_eth1_data.mac_addr, art, 0x01); - - /* GMAC0 is connected to the PHY7 */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_data.phy_mask = BIT(7); - ath79_eth0_pll_data.pll_1000 = 0x02000000; - ath79_eth0_pll_data.pll_100 = 0x00000101; - ath79_eth0_pll_data.pll_10 = 0x00001313; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(1); - - ath79_init_mac(mac, art, 0x10); - ap91_pci_init(art + OM5P_PCI_CALDATA_OFFSET, mac); -} - -MIPS_MACHINE(ATH79_MACH_OM5P_AN, "OM5P-AN", "OpenMesh OM5P AN", om5p_an_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5pac.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5pac.c deleted file mode 100644 index ad4f18c74..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5pac.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * OpenMesh OM5P-AC support - * - * Copyright (C) 2013 Marek Lindner - * Copyright (C) 2014 Sven Eckelmann - * - * 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-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define OM5PAC_GPIO_LED_POWER 18 -#define OM5PAC_GPIO_LED_GREEN 21 -#define OM5PAC_GPIO_LED_RED 23 -#define OM5PAC_GPIO_LED_YELLOW 22 -#define OM5PAC_GPIO_LED_LAN 20 -#define OM5PAC_GPIO_LED_WAN 19 -#define OM5PAC_GPIO_I2C_SCL 12 -#define OM5PAC_GPIO_I2C_SDA 11 - -#define OM5PAC_KEYS_POLL_INTERVAL 20 /* msecs */ -#define OM5PAC_KEYS_DEBOUNCE_INTERVAL (3 * OM5PAC_KEYS_POLL_INTERVAL) - -#define OM5PAC_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led om5pac_leds_gpio[] __initdata = { - { - .name = "om5pac:blue:power", - .gpio = OM5PAC_GPIO_LED_POWER, - .active_low = 1, - }, { - .name = "om5pac:red:wifi", - .gpio = OM5PAC_GPIO_LED_RED, - .active_low = 1, - }, { - .name = "om5pac:yellow:wifi", - .gpio = OM5PAC_GPIO_LED_YELLOW, - .active_low = 1, - }, { - .name = "om5pac:green:wifi", - .gpio = OM5PAC_GPIO_LED_GREEN, - .active_low = 1, - }, { - .name = "om5pac:blue:lan", - .gpio = OM5PAC_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "om5pac:blue:wan", - .gpio = OM5PAC_GPIO_LED_WAN, - .active_low = 1, - } -}; - -static struct flash_platform_data om5pac_flash_data = { - .type = "mx25l12805d", -}; - -static struct i2c_gpio_platform_data om5pac_i2c_device_platdata = { - .sda_pin = OM5PAC_GPIO_I2C_SDA, - .scl_pin = OM5PAC_GPIO_I2C_SCL, - .udelay = 10, - .sda_is_open_drain = 1, - .scl_is_open_drain = 1, -}; - -static struct platform_device om5pac_i2c_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &om5pac_i2c_device_platdata, - }, -}; - -static struct i2c_board_info om5pac_i2c_devs[] __initdata = { - { - I2C_BOARD_INFO("tmp423", 0x4c), - }, -}; - -static struct at803x_platform_data om5pac_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info om5pac_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "om5pac_1", - .mdio_addr = 1, - .platform_data = &om5pac_at803x_data, - }, - { - .bus_id = "ag71xx-mdio.0", - .modalias = "om5pac_2", - .mdio_addr = 2, - .platform_data = &om5pac_at803x_data, - }, -}; - -static void __init om5p_ac_setup_qca955x_eth_cfg(u32 mask, - unsigned int rxd, - unsigned int rxdv, - unsigned int txd, - unsigned int txe) -{ - void __iomem *base; - u32 t; - - base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); - - t = mask; - t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; - t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; - t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; - t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; - - __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -static void __init om5p_ac_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - /* temperature sensor */ - platform_device_register(&om5pac_i2c_device); - i2c_register_board_info(0, om5pac_i2c_devs, - ARRAY_SIZE(om5pac_i2c_devs)); - - ath79_gpio_output_select(OM5PAC_GPIO_LED_WAN, QCA955X_GPIO_OUT_GPIO); - - ath79_register_m25p80(&om5pac_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(om5pac_leds_gpio), - om5pac_leds_gpio); - - ath79_init_mac(mac, art, 0x02); - ath79_register_wmac(art + OM5PAC_WMAC_CALDATA_OFFSET, mac); - - om5p_ac_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0); - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(om5pac_mdio0_info, - ARRAY_SIZE(om5pac_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0x00); - ath79_init_mac(ath79_eth1_data.mac_addr, art, 0x01); - - /* GMAC0 is connected to the PHY1 */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_data.phy_mask = BIT(1); - ath79_eth0_pll_data.pll_1000 = 0x82000101; - ath79_eth0_pll_data.pll_100 = 0x80000101; - ath79_eth0_pll_data.pll_10 = 0x80001313; - ath79_register_eth(0); - - /* GMAC1 is connected to MDIO1 in SGMII mode */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth1_data.phy_mask = BIT(2); - ath79_eth1_pll_data.pll_1000 = 0x03000101; - ath79_eth1_pll_data.pll_100 = 0x80000101; - ath79_eth1_pll_data.pll_10 = 0x80001313; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_register_eth(1); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_OM5P_AC, "OM5P-AC", "OpenMesh OM5P AC", om5p_ac_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5pacv2.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5pacv2.c deleted file mode 100644 index 6dba514be..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om5pacv2.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * OpenMesh OM5P-ACv2 support - * - * Copyright (C) 2013 Marek Lindner - * Copyright (C) 2014-2016 Sven Eckelmann - * Copyright (C) 2015 Open-Mesh - Jim Collar - * - * 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 -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) -#include -#else -#include -#endif -#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 "machtypes.h" -#include "pci.h" - -#define OM5PACV2_GPIO_LED_POWER 14 -#define OM5PACV2_GPIO_LED_GREEN 13 -#define OM5PACV2_GPIO_LED_RED 23 -#define OM5PACV2_GPIO_LED_YELLOW 15 -#define OM5PACV2_GPIO_BTN_RESET 1 -#define OM5PACV2_GPIO_I2C_SCL 18 -#define OM5PACV2_GPIO_I2C_SDA 19 -#define OM5PACV2_GPIO_PA_DCDC 2 -#define OM5PACV2_GPIO_PA_HIGH 16 - -#define OM5PACV2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define OM5PACV2_KEYS_DEBOUNCE_INTERVAL (3 * OM5PACV2_KEYS_POLL_INTERVAL) - -#define OM5PACV2_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led om5pacv2_leds_gpio[] __initdata = { - { - .name = "om5pac:blue:power", - .gpio = OM5PACV2_GPIO_LED_POWER, - .active_low = 1, - }, { - .name = "om5pac:red:wifi", - .gpio = OM5PACV2_GPIO_LED_RED, - .active_low = 1, - }, { - .name = "om5pac:yellow:wifi", - .gpio = OM5PACV2_GPIO_LED_YELLOW, - .active_low = 1, - }, { - .name = "om5pac:green:wifi", - .gpio = OM5PACV2_GPIO_LED_GREEN, - .active_low = 1, - } -}; - -static struct gpio_keys_button om5pacv2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = OM5PACV2_KEYS_DEBOUNCE_INTERVAL, - .gpio = OM5PACV2_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct i2c_gpio_platform_data om5pacv2_i2c_device_platdata = { - .sda_pin = OM5PACV2_GPIO_I2C_SDA, - .scl_pin = OM5PACV2_GPIO_I2C_SCL, - .udelay = 10, - .sda_is_open_drain = 1, - .scl_is_open_drain = 1, -}; - -static struct platform_device om5pacv2_i2c_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &om5pacv2_i2c_device_platdata, - }, -}; - -static struct i2c_board_info om5pacv2_i2c_devs[] __initdata = { - { - I2C_BOARD_INFO("tmp423", 0x4e), - }, -}; - -static struct flash_platform_data om5pacv2_flash_data = { - .type = "mx25l12805d", -}; - -static struct at803x_platform_data om5pacv2_an_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 1, -}; - -static struct at803x_platform_data om5pacv2_an_at8031_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info om5pacv2_an_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "ag71xx-mdio", - .mdio_addr = 4, - .platform_data = &om5pacv2_an_at803x_data, - }, - { - .bus_id = "ag71xx-mdio.1", - .modalias = "ag71xx-mdio", - .mdio_addr = 1, - .platform_data = &om5pacv2_an_at8031_data, - }, -}; - -static void __init om5p_acv2_setup_qca955x_eth_cfg(u32 mask, - unsigned int rxd, - unsigned int rxdv, - unsigned int txd, - unsigned int txe) -{ - void __iomem *base; - u32 t; - - base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); - - t = mask; - t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT; - t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT; - t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT; - t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT; - - __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); - - iounmap(base); -} - -static void __init om5p_acv2_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - /* power amplifier high power, 4.2V at RFFM4203/4503 instead of 3.3 */ - ath79_gpio_function_enable(QCA955X_GPIO_FUNC_JTAG_DISABLE); - ath79_gpio_output_select(OM5PACV2_GPIO_PA_DCDC, QCA955X_GPIO_OUT_GPIO); - ath79_gpio_output_select(OM5PACV2_GPIO_PA_HIGH, QCA955X_GPIO_OUT_GPIO); - gpio_request_one(OM5PACV2_GPIO_PA_DCDC, GPIOF_OUT_INIT_HIGH, - "PA DC/DC"); - gpio_request_one(OM5PACV2_GPIO_PA_HIGH, GPIOF_OUT_INIT_HIGH, "PA HIGH"); - - /* temperature sensor */ - platform_device_register(&om5pacv2_i2c_device); - i2c_register_board_info(0, om5pacv2_i2c_devs, - ARRAY_SIZE(om5pacv2_i2c_devs)); - - ath79_register_m25p80(&om5pacv2_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(om5pacv2_leds_gpio), - om5pacv2_leds_gpio); - ath79_register_gpio_keys_polled(-1, OM5PACV2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(om5pacv2_gpio_keys), - om5pacv2_gpio_keys); - - ath79_init_mac(mac, art, 0x02); - ath79_register_wmac(art + OM5PACV2_WMAC_CALDATA_OFFSET, mac); - - om5p_acv2_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 2, 2, 0, 0); - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - mdiobus_register_board_info(om5pacv2_an_mdio0_info, - ARRAY_SIZE(om5pacv2_an_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0x00); - ath79_init_mac(ath79_eth1_data.mac_addr, art, 0x01); - - /* GMAC0 is connected to the PHY4 */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_pll_data.pll_1000 = 0x82000101; - ath79_eth0_pll_data.pll_100 = 0x80000101; - ath79_eth0_pll_data.pll_10 = 0x80001313; - ath79_register_eth(0); - - /* GMAC1 is connected to MDIO1 in SGMII mode */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_eth1_data.phy_mask = BIT(1); - ath79_eth1_pll_data.pll_1000 = 0x03000101; - ath79_eth1_pll_data.pll_100 = 0x80000101; - ath79_eth1_pll_data.pll_10 = 0x80001313; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_register_eth(1); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_OM5P_ACv2, "OM5P-ACv2", "OpenMesh OM5P ACv2", om5p_acv2_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rambutan.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rambutan.c deleted file mode 100644 index 8cf8dab4d..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rambutan.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 8devices Rambutan board support - * - * Copyright (C) 2017 Mantas Pucka - * - * 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-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -static struct at803x_platform_data rambutan_ar8032_data = { - .has_reset_gpio = 1, - .reset_gpio = 17, -}; - -static struct mdio_board_info rambutan_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "rambutan_1", - .mdio_addr = 0, - .platform_data = &rambutan_ar8032_data, - }, -}; - -static struct at803x_platform_data rambutan_ar8033_data = { - .has_reset_gpio = 1, - .reset_gpio = 23, -}; - -static struct mdio_board_info rambutan_mdio1_info[] = { - { - .bus_id = "ag71xx-mdio.1", - .modalias = "rambutan_2", - .mdio_addr = 0, - .platform_data = &rambutan_ar8033_data, - }, -}; - -static void __init rambutan_setup(void) -{ - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW); - ath79_register_nfc(); - ath79_register_usb(); - ath79_register_pci(); - ath79_register_wmac_simple(); - - mdiobus_register_board_info(rambutan_mdio0_info, - ARRAY_SIZE(rambutan_mdio0_info)); - mdiobus_register_board_info(rambutan_mdio1_info, - ARRAY_SIZE(rambutan_mdio1_info)); - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_register_eth(0); - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.phy_mask = BIT(0); - ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_eth1_pll_data.pll_1000 = 0x17000000; - ath79_eth1_pll_data.pll_10 = 0x1313; - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_RAMBUTAN, "RAMBUTAN", "8devices Rambutan board", - rambutan_setup); - diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb2011.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb2011.c deleted file mode 100644 index 230d0e091..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb2011.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - * MikroTik RouterBOARD 2011 support - * - * Copyright (C) 2012 Stijn Tintel - * 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. - */ - -#define pr_fmt(fmt) "rb2011: " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "common.h" -#include "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "routerboot.h" - -#define RB2011_GPIO_NAND_NCE 14 -#define RB2011_GPIO_SFP_LOS 21 - -#define RB_ROUTERBOOT_OFFSET 0x0000 -#define RB_ROUTERBOOT_MIN_SIZE 0xb000 -#define RB_HARD_CFG_SIZE 0x1000 -#define RB_BIOS_OFFSET 0xd000 -#define RB_BIOS_SIZE 0x1000 -#define RB_SOFT_CFG_OFFSET 0xf000 -#define RB_SOFT_CFG_SIZE 0x1000 - -#define RB_ART_SIZE 0x10000 - -#define RB2011_FLAG_SFP BIT(0) -#define RB2011_FLAG_USB BIT(1) -#define RB2011_FLAG_WLAN BIT(2) - -static struct mtd_partition rb2011_spi_partitions[] = { - { - .name = "routerboot", - .offset = RB_ROUTERBOOT_OFFSET, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "hard_config", - .size = RB_HARD_CFG_SIZE, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "bios", - .offset = RB_BIOS_OFFSET, - .size = RB_BIOS_SIZE, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "soft_config", - .size = RB_SOFT_CFG_SIZE, - } -}; - -static void __init rb2011_init_partitions(const struct rb_info *info) -{ - rb2011_spi_partitions[0].size = info->hard_cfg_offs; - rb2011_spi_partitions[1].offset = info->hard_cfg_offs; - rb2011_spi_partitions[3].offset = info->soft_cfg_offs; -} - -static struct mtd_partition rb2011_nand_partitions[] = { - { - .name = "booter", - .offset = 0, - .size = (256 * 1024), - .mask_flags = MTD_WRITEABLE, - }, - { - .name = "kernel", - .offset = (256 * 1024), - .size = (4 * 1024 * 1024) - (256 * 1024), - }, - { - .name = "ubi", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL, - }, -}; - -static struct flash_platform_data rb2011_spi_flash_data = { - .parts = rb2011_spi_partitions, - .nr_parts = ARRAY_SIZE(rb2011_spi_partitions), -}; - -static struct ar8327_pad_cfg rb2011_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL3, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, -}; - -static struct ar8327_pad_cfg rb2011_ar8327_pad6_cfg; -static struct ar8327_sgmii_cfg rb2011_ar8327_sgmii_cfg; - -static struct ar8327_led_cfg rb2011_ar8327_led_cfg = { - .led_ctrl0 = 0xc731c731, - .led_ctrl1 = 0x00000000, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x0030c300, - .open_drain = false, -}; - -static const struct ar8327_led_info rb2011_ar8327_leds[] = { - AR8327_LED_INFO(PHY0_0, HW, "rb:green:eth1"), - AR8327_LED_INFO(PHY1_0, HW, "rb:green:eth2"), - AR8327_LED_INFO(PHY2_0, HW, "rb:green:eth3"), - AR8327_LED_INFO(PHY3_0, HW, "rb:green:eth4"), - AR8327_LED_INFO(PHY4_0, HW, "rb:green:eth5"), - AR8327_LED_INFO(PHY0_1, SW, "rb:green:eth6"), - AR8327_LED_INFO(PHY1_1, SW, "rb:green:eth7"), - AR8327_LED_INFO(PHY2_1, SW, "rb:green:eth8"), - AR8327_LED_INFO(PHY3_1, SW, "rb:green:eth9"), - AR8327_LED_INFO(PHY4_1, SW, "rb:green:eth10"), - AR8327_LED_INFO(PHY4_2, SW, "rb:green:usr"), -}; - -static struct ar8327_platform_data rb2011_ar8327_data = { - .pad0_cfg = &rb2011_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &rb2011_ar8327_led_cfg, - .num_leds = ARRAY_SIZE(rb2011_ar8327_leds), - .leds = rb2011_ar8327_leds, -}; - -static struct mdio_board_info rb2011_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "rb2011", - .mdio_addr = 0, - .platform_data = &rb2011_ar8327_data, - }, -}; - -static void __init rb2011_wlan_init(void) -{ - char *art_buf; - u8 wlan_mac[ETH_ALEN]; - - art_buf = rb_get_wlan_data(); - if (art_buf == NULL) - return; - - ath79_init_mac(wlan_mac, ath79_mac_base, 11); - ath79_register_wmac(art_buf + 0x1000, wlan_mac); - - kfree(art_buf); -} - -static void rb2011_nand_select_chip(int chip_no) -{ - switch (chip_no) { - case 0: - gpio_set_value(RB2011_GPIO_NAND_NCE, 0); - break; - default: - gpio_set_value(RB2011_GPIO_NAND_NCE, 1); - break; - } - ndelay(500); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -static struct nand_ecclayout rb2011_nand_ecclayout = { - .eccbytes = 6, - .eccpos = { 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } -}; - -#else - -static int rb2011_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 8; - oobregion->length = 3; - return 0; - case 1: - oobregion->offset = 13; - oobregion->length = 3; - return 0; - default: - return -ERANGE; - } -} - -static int rb2011_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 0; - oobregion->length = 4; - return 0; - case 1: - oobregion->offset = 4; - oobregion->length = 1; - return 0; - case 2: - oobregion->offset = 6; - oobregion->length = 2; - return 0; - case 3: - oobregion->offset = 11; - oobregion->length = 2; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops rb2011_nand_ecclayout_ops = { - .ecc = rb2011_ooblayout_ecc, - .free = rb2011_ooblayout_free, -}; -#endif /* < 4.6 */ - -static int rb2011_nand_scan_fixup(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct nand_chip *chip = mtd->priv; -#endif - - if (mtd->writesize == 512) { - /* - * Use the OLD Yaffs-1 OOB layout, otherwise RouterBoot - * will not be able to find the kernel that we load. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - chip->ecc.layout = &rb2011_nand_ecclayout; -#else - mtd_set_ooblayout(mtd, &rb2011_nand_ecclayout_ops); -#endif - } - - return 0; -} - -static void __init rb2011_nand_init(void) -{ - gpio_request_one(RB2011_GPIO_NAND_NCE, GPIOF_OUT_INIT_HIGH, "NAND nCE"); - - ath79_nfc_set_scan_fixup(rb2011_nand_scan_fixup); - ath79_nfc_set_parts(rb2011_nand_partitions, - ARRAY_SIZE(rb2011_nand_partitions)); - ath79_nfc_set_select_chip(rb2011_nand_select_chip); - ath79_nfc_set_swap_dma(true); - ath79_register_nfc(); -} - -static int rb2011_get_port_link(unsigned port) -{ - if (port != 6) - return -EINVAL; - - /* The Loss of signal line is active low */ - return !gpio_get_value(RB2011_GPIO_SFP_LOS); -} - -static void __init rb2011_sfp_init(void) -{ - gpio_request_one(RB2011_GPIO_SFP_LOS, GPIOF_IN, "SFP LOS"); - - rb2011_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_SGMII; - - rb2011_ar8327_data.pad6_cfg = &rb2011_ar8327_pad6_cfg; - - rb2011_ar8327_sgmii_cfg.sgmii_ctrl = 0xc70167d0; - rb2011_ar8327_sgmii_cfg.serdes_aen = true; - - rb2011_ar8327_data.sgmii_cfg = &rb2011_ar8327_sgmii_cfg; - - rb2011_ar8327_data.port6_cfg.force_link = 1; - rb2011_ar8327_data.port6_cfg.speed = AR8327_PORT_SPEED_1000; - rb2011_ar8327_data.port6_cfg.duplex = 1; - - rb2011_ar8327_data.get_port_link = rb2011_get_port_link; -} - -static int __init rb2011_setup(u32 flags) -{ - const struct rb_info *info; - char buf[64]; - - info = rb_init_info((void *) KSEG1ADDR(0x1f000000), 0x10000); - if (!info) - return -ENODEV; - - scnprintf(buf, sizeof(buf), "Mikrotik RouterBOARD %s", - (info->board_name) ? info->board_name : ""); - mips_set_machine_name(buf); - - rb2011_init_partitions(info); - - ath79_register_m25p80(&rb2011_spi_flash_data); - rb2011_nand_init(); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_RXD_DELAY | - AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(rb2011_mdio0_info, - ARRAY_SIZE(rb2011_mdio0_info)); - - /* GMAC0 is connected to an ar8327 switch */ - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x6f000000; - - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 5); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); - - if (flags & RB2011_FLAG_SFP) - rb2011_sfp_init(); - - if (flags & RB2011_FLAG_WLAN) - rb2011_wlan_init(); - - if (flags & RB2011_FLAG_USB) - ath79_register_usb(); - - return 0; -} - -static void __init rb2011l_setup(void) -{ - rb2011_setup(0); -} - -MIPS_MACHINE_NONAME(ATH79_MACH_RB_2011L, "2011L", rb2011l_setup); - -static void __init rb2011us_setup(void) -{ - rb2011_setup(RB2011_FLAG_SFP | RB2011_FLAG_USB); -} - -MIPS_MACHINE_NONAME(ATH79_MACH_RB_2011US, "2011US", rb2011us_setup); - -static void __init rb2011r5_setup(void) -{ - rb2011_setup(RB2011_FLAG_SFP | RB2011_FLAG_USB | RB2011_FLAG_WLAN); -} - -MIPS_MACHINE_NONAME(ATH79_MACH_RB_2011R5, "2011r5", rb2011r5_setup); - -static void __init rb2011g_setup(void) -{ - rb2011_setup(RB2011_FLAG_SFP | - RB2011_FLAG_USB | - RB2011_FLAG_WLAN); -} - -MIPS_MACHINE_NONAME(ATH79_MACH_RB_2011G, "2011G", rb2011g_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb750.c deleted file mode 100644 index f552e63af..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb750.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * MikroTik RouterBOARD 750/750GL support - * - * Copyright (C) 2010-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 -#include - -#include -#include -#include -#include - -#include "common.h" -#include "dev-ap9x-pci.h" -#include "dev-usb.h" -#include "dev-eth.h" -#include "machtypes.h" -#include "routerboot.h" - -static struct rb750_led_data rb750_leds[] = { - { - .name = "rb750:green:act", - .mask = RB750_LED_ACT, - .active_low = 1, - }, { - .name = "rb750:green:port1", - .mask = RB750_LED_PORT5, - .active_low = 1, - }, { - .name = "rb750:green:port2", - .mask = RB750_LED_PORT4, - .active_low = 1, - }, { - .name = "rb750:green:port3", - .mask = RB750_LED_PORT3, - .active_low = 1, - }, { - .name = "rb750:green:port4", - .mask = RB750_LED_PORT2, - .active_low = 1, - }, { - .name = "rb750:green:port5", - .mask = RB750_LED_PORT1, - .active_low = 1, - } -}; - -static struct rb750_led_data rb750gr3_leds[] = { - { - .name = "rb750:green:act", - .mask = RB7XX_LED_ACT, - .active_low = 1, - }, -}; - -static struct rb750_led_platform_data rb750_leds_data; -static struct platform_device rb750_leds_device = { - .name = "leds-rb750", - .dev = { - .platform_data = &rb750_leds_data, - } -}; - -static struct rb7xx_nand_platform_data rb750_nand_data; -static struct platform_device rb750_nand_device = { - .name = "rb750-nand", - .id = -1, - .dev = { - .platform_data = &rb750_nand_data, - } -}; - -static void rb750_latch_change(u32 mask_clr, u32 mask_set) -{ - static DEFINE_SPINLOCK(lock); - static u32 latch_set = RB750_LED_BITS | RB750_LVC573_LE; - static u32 latch_oe; - static u32 latch_clr; - unsigned long flags; - u32 t; - - spin_lock_irqsave(&lock, flags); - - if ((mask_clr & BIT(31)) != 0 && - (latch_set & RB750_LVC573_LE) == 0) { - goto unlock; - } - - latch_set = (latch_set | mask_set) & ~mask_clr; - latch_clr = (latch_clr | mask_clr) & ~mask_set; - - if (latch_oe == 0) - latch_oe = __raw_readl(ath79_gpio_base + AR71XX_GPIO_REG_OE); - - if (likely(latch_set & RB750_LVC573_LE)) { - void __iomem *base = ath79_gpio_base; - - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - t |= mask_clr | latch_oe | mask_set; - - __raw_writel(t, base + AR71XX_GPIO_REG_OE); - __raw_writel(latch_clr, base + AR71XX_GPIO_REG_CLEAR); - __raw_writel(latch_set, base + AR71XX_GPIO_REG_SET); - } else if (mask_clr & RB750_LVC573_LE) { - void __iomem *base = ath79_gpio_base; - - latch_oe = __raw_readl(base + AR71XX_GPIO_REG_OE); - __raw_writel(RB750_LVC573_LE, base + AR71XX_GPIO_REG_CLEAR); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_CLEAR); - } - -unlock: - spin_unlock_irqrestore(&lock, flags); -} - -static void rb750_nand_enable_pins(void) -{ - rb750_latch_change(RB750_LVC573_LE, 0); - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE, - AR724X_GPIO_FUNC_SPI_EN); -} - -static void rb750_nand_disable_pins(void) -{ - ath79_gpio_function_setup(AR724X_GPIO_FUNC_SPI_EN, - AR724X_GPIO_FUNC_JTAG_DISABLE); - rb750_latch_change(0, RB750_LVC573_LE); -} - -static void __init rb750_setup(void) -{ - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - - ath79_register_mdio(0, 0x0); - - /* LAN ports */ - ath79_register_eth(1); - - /* WAN port */ - ath79_register_eth(0); - - rb750_leds_data.num_leds = ARRAY_SIZE(rb750_leds); - rb750_leds_data.leds = rb750_leds; - rb750_leds_data.latch_change = rb750_latch_change; - platform_device_register(&rb750_leds_device); - - rb750_nand_data.nce_line = RB750_NAND_NCE; - rb750_nand_data.enable_pins = rb750_nand_enable_pins; - rb750_nand_data.disable_pins = rb750_nand_disable_pins; - rb750_nand_data.latch_change = rb750_latch_change; - platform_device_register(&rb750_nand_device); - - /* USB */ - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_RB_750, "750i", "MikroTik RouterBOARD 750", - rb750_setup); - -static struct ar8327_pad_cfg rb750gr3_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data rb750gr3_ar8327_data = { - .pad0_cfg = &rb750gr3_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - } -}; - -static struct mdio_board_info rb750g3_mdio_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "rb750g3", - .mdio_addr = 0, - .platform_data = &rb750gr3_ar8327_data, - }, -}; - -static void rb750gr3_nand_enable_pins(void) -{ - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE, - AR724X_GPIO_FUNC_SPI_EN | - AR724X_GPIO_FUNC_SPI_CS_EN2); -} - -static void rb750gr3_nand_disable_pins(void) -{ - ath79_gpio_function_setup(AR724X_GPIO_FUNC_SPI_EN | - AR724X_GPIO_FUNC_SPI_CS_EN2, - AR724X_GPIO_FUNC_JTAG_DISABLE); -} - -static void rb750gr3_latch_change(u32 mask_clr, u32 mask_set) -{ - static DEFINE_SPINLOCK(lock); - static u32 latch_set = RB7XX_LED_ACT; - static u32 latch_clr; - void __iomem *base = ath79_gpio_base; - unsigned long flags; - u32 t; - - spin_lock_irqsave(&lock, flags); - - latch_set = (latch_set | mask_set) & ~mask_clr; - latch_clr = (latch_clr | mask_clr) & ~mask_set; - - mask_set = latch_set & (RB7XX_USB_POWERON | RB7XX_MONITOR); - mask_clr = latch_clr & (RB7XX_USB_POWERON | RB7XX_MONITOR); - - if ((latch_set ^ RB7XX_LED_ACT) & RB7XX_LED_ACT) { - /* enable output mode */ - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - t |= RB7XX_LED_ACT; - __raw_writel(t, base + AR71XX_GPIO_REG_OE); - - mask_clr |= RB7XX_LED_ACT; - } else { - /* disable output mode */ - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - t &= ~RB7XX_LED_ACT; - __raw_writel(t, base + AR71XX_GPIO_REG_OE); - } - - __raw_writel(mask_set, base + AR71XX_GPIO_REG_SET); - __raw_writel(mask_clr, base + AR71XX_GPIO_REG_CLEAR); - - spin_unlock_irqrestore(&lock, flags); -} - -static void __init rb750gr3_setup(void) -{ - ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(rb750g3_mdio_info, - ARRAY_SIZE(rb750g3_mdio_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_pll_data.pll_1000 = 0x62000000; - - ath79_register_eth(0); - - rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds); - rb750_leds_data.leds = rb750gr3_leds; - rb750_leds_data.latch_change = rb750gr3_latch_change; - platform_device_register(&rb750_leds_device); - - rb750_nand_data.nce_line = RB7XX_NAND_NCE; - rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins; - rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins; - rb750_nand_data.latch_change = rb750gr3_latch_change; - platform_device_register(&rb750_nand_device); -} - -MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL", - rb750gr3_setup); - -#define RB751_HARDCONFIG 0x1f00b000 -#define RB751_HARDCONFIG_SIZE 0x1000 - -static void __init rb751_wlan_setup(void) -{ - u8 *hardconfig = (u8 *) KSEG1ADDR(RB751_HARDCONFIG); - struct ath9k_platform_data *wmac_data; - u16 tag_len; - u8 *tag; - u16 mac_len; - u8 *mac; - int err; - - wmac_data = ap9x_pci_get_wmac_data(0); - if (!wmac_data) { - pr_err("rb75x: unable to get address of wlan data\n"); - return; - } - - ap9x_pci_setup_wmac_led_pin(0, 9); - - err = routerboot_find_tag(hardconfig, RB751_HARDCONFIG_SIZE, - RB_ID_WLAN_DATA, &tag, &tag_len); - if (err) { - pr_err("rb75x: no calibration data found\n"); - return; - } - - err = rle_decode(tag, tag_len, (unsigned char *) wmac_data->eeprom_data, - sizeof(wmac_data->eeprom_data), NULL, NULL); - if (err) { - pr_err("rb75x: unable to decode wlan eeprom data\n"); - return; - } - - err = routerboot_find_tag(hardconfig, RB751_HARDCONFIG_SIZE, - RB_ID_MAC_ADDRESS_PACK, &mac, &mac_len); - if (err) { - pr_err("rb75x: no mac address found\n"); - return; - } - - ap91_pci_init(NULL, mac); -} - -static void __init rb751_setup(void) -{ - rb750_setup(); - ath79_register_usb(); - rb751_wlan_setup(); -} - -MIPS_MACHINE(ATH79_MACH_RB_751, "751", "MikroTik RouterBOARD 751", - rb751_setup); - -static void __init rb751g_setup(void) -{ - rb750gr3_setup(); - ath79_register_usb(); - rb751_wlan_setup(); -} - -MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G", - rb751g_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb91x.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb91x.c deleted file mode 100644 index 2dacc0986..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb91x.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * MikroTik RouterBOARD 91X support - * - * Copyright (C) 2013 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. - */ - -#define pr_fmt(fmt) "rb91x: " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "common.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" -#include "routerboot.h" - -#define RB_ROUTERBOOT_OFFSET 0x0000 -#define RB_ROUTERBOOT_MIN_SIZE 0xb000 -#define RB_HARD_CFG_SIZE 0x1000 -#define RB_BIOS_OFFSET 0xd000 -#define RB_BIOS_SIZE 0x1000 -#define RB_SOFT_CFG_OFFSET 0xf000 -#define RB_SOFT_CFG_SIZE 0x1000 - -#define RB91X_FLAG_USB BIT(0) -#define RB91X_FLAG_PCIE BIT(1) - -#define RB91X_LATCH_GPIO_BASE 32 -#define RB91X_LATCH_GPIO(_x) (RB91X_LATCH_GPIO_BASE + (_x)) - -#define RB91X_SSR_GPIO_BASE (RB91X_LATCH_GPIO_BASE + AR934X_GPIO_COUNT) -#define RB91X_SSR_GPIO(_x) (RB91X_SSR_GPIO_BASE + (_x)) - -#define RB91X_SSR_BIT_LED1 0 -#define RB91X_SSR_BIT_LED2 1 -#define RB91X_SSR_BIT_LED3 2 -#define RB91X_SSR_BIT_LED4 3 -#define RB91X_SSR_BIT_LED5 4 -#define RB91X_SSR_BIT_5 5 -#define RB91X_SSR_BIT_USB_POWER 6 -#define RB91X_SSR_BIT_PCIE_POWER 7 - -#define RB91X_GPIO_SSR_STROBE RB91X_LATCH_GPIO(0) -#define RB91X_GPIO_LED_POWER RB91X_LATCH_GPIO(1) -#define RB91X_GPIO_LED_USER RB91X_LATCH_GPIO(2) -#define RB91X_GPIO_NAND_READ RB91X_LATCH_GPIO(3) -#define RB91X_GPIO_NAND_RDY RB91X_LATCH_GPIO(4) -#define RB91X_GPIO_NLE RB91X_LATCH_GPIO(11) -#define RB91X_GPIO_NAND_NRW RB91X_LATCH_GPIO(12) -#define RB91X_GPIO_NAND_NCE RB91X_LATCH_GPIO(13) -#define RB91X_GPIO_NAND_CLE RB91X_LATCH_GPIO(14) -#define RB91X_GPIO_NAND_ALE RB91X_LATCH_GPIO(15) - -#define RB91X_GPIO_LED_1 RB91X_SSR_GPIO(RB91X_SSR_BIT_LED1) -#define RB91X_GPIO_LED_2 RB91X_SSR_GPIO(RB91X_SSR_BIT_LED2) -#define RB91X_GPIO_LED_3 RB91X_SSR_GPIO(RB91X_SSR_BIT_LED3) -#define RB91X_GPIO_LED_4 RB91X_SSR_GPIO(RB91X_SSR_BIT_LED4) -#define RB91X_GPIO_LED_5 RB91X_SSR_GPIO(RB91X_SSR_BIT_LED5) -#define RB91X_GPIO_USB_POWER RB91X_SSR_GPIO(RB91X_SSR_BIT_USB_POWER) -#define RB91X_GPIO_PCIE_POWER RB91X_SSR_GPIO(RB91X_SSR_BIT_PCIE_POWER) - -struct rb_board_info { - const char *name; - u32 flags; -}; - -static struct mtd_partition rb711gr100_spi_partitions[] = { - { - .name = "routerboot", - .offset = RB_ROUTERBOOT_OFFSET, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "hard_config", - .size = RB_HARD_CFG_SIZE, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "bios", - .offset = RB_BIOS_OFFSET, - .size = RB_BIOS_SIZE, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "soft_config", - .size = RB_SOFT_CFG_SIZE, - } -}; - -static struct flash_platform_data rb711gr100_spi_flash_data = { - .parts = rb711gr100_spi_partitions, - .nr_parts = ARRAY_SIZE(rb711gr100_spi_partitions), -}; - -static int rb711gr100_gpio_latch_gpios[AR934X_GPIO_COUNT] __initdata = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 -}; - -static struct gpio_latch_platform_data rb711gr100_gpio_latch_data __initdata = { - .base = RB91X_LATCH_GPIO_BASE, - .num_gpios = ARRAY_SIZE(rb711gr100_gpio_latch_gpios), - .gpios = rb711gr100_gpio_latch_gpios, - .le_gpio_index = 11, - .le_active_low = true, -}; - -static struct rb91x_nand_platform_data rb711gr100_nand_data __initdata = { - .gpio_nce = RB91X_GPIO_NAND_NCE, - .gpio_ale = RB91X_GPIO_NAND_ALE, - .gpio_cle = RB91X_GPIO_NAND_CLE, - .gpio_rdy = RB91X_GPIO_NAND_RDY, - .gpio_read = RB91X_GPIO_NAND_READ, - .gpio_nrw = RB91X_GPIO_NAND_NRW, - .gpio_nle = RB91X_GPIO_NLE, -}; - -static u8 rb711gr100_ssr_initdata[] = { - BIT(RB91X_SSR_BIT_PCIE_POWER) | - BIT(RB91X_SSR_BIT_USB_POWER) | - BIT(RB91X_SSR_BIT_5) -}; - -static struct gen_74x164_chip_platform_data rb711gr100_ssr_data = { - .base = RB91X_SSR_GPIO_BASE, - .num_registers = ARRAY_SIZE(rb711gr100_ssr_initdata), - .init_data = rb711gr100_ssr_initdata, -}; - -static struct spi_board_info rb711gr100_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &rb711gr100_spi_flash_data, - }, { - .bus_num = 0, - .chip_select = 1, - .max_speed_hz = 10000000, - .modalias = "74x164", - .platform_data = &rb711gr100_ssr_data, - } -}; - -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 = { - { - .name = "rb:green:led1", - .gpio = RB91X_GPIO_LED_1, - .active_low = 0, - }, - { - .name = "rb:green:led2", - .gpio = RB91X_GPIO_LED_2, - .active_low = 0, - }, - { - .name = "rb:green:led3", - .gpio = RB91X_GPIO_LED_3, - .active_low = 0, - }, - { - .name = "rb:green:led4", - .gpio = RB91X_GPIO_LED_4, - .active_low = 0, - }, - { - .name = "rb:green:led5", - .gpio = RB91X_GPIO_LED_5, - .active_low = 0, - }, - { - .name = "rb:green:user", - .gpio = RB91X_GPIO_LED_USER, - .active_low = 0, - }, - { - .name = "rb:green:power", - .gpio = RB91X_GPIO_LED_POWER, - .active_low = 0, - .default_state = LEDS_GPIO_DEFSTATE_KEEP, - }, -}; - -static struct at803x_platform_data rb91x_at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 1, -}; - -static struct mdio_board_info rb91x_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "rb91x", - .mdio_addr = 0, - .platform_data = &rb91x_at803x_data, - }, -}; - -static void __init rb711gr100_init_partitions(const struct rb_info *info) -{ - rb711gr100_spi_partitions[0].size = info->hard_cfg_offs; - rb711gr100_spi_partitions[1].offset = info->hard_cfg_offs; - - rb711gr100_spi_partitions[3].offset = info->soft_cfg_offs; -} - -void __init rb711gr100_wlan_init(void) -{ - char *caldata; - u8 wlan_mac[ETH_ALEN]; - - caldata = rb_get_wlan_data(); - if (caldata == NULL) - return; - - ath79_init_mac(wlan_mac, ath79_mac_base, 1); - ath79_register_wmac(caldata + 0x1000, wlan_mac); - - kfree(caldata); -} - -#define RB_BOARD_INFO(_name, _flags) \ - { \ - .name = (_name), \ - .flags = (_flags), \ - } - -static const struct rb_board_info rb711gr100_boards[] __initconst = { - RB_BOARD_INFO("911G-2HPnD", 0), - RB_BOARD_INFO("911G-5HPnD", 0), - RB_BOARD_INFO("912UAG-2HPnD", RB91X_FLAG_USB | RB91X_FLAG_PCIE), - RB_BOARD_INFO("912UAG-5HPnD", RB91X_FLAG_USB | RB91X_FLAG_PCIE), -}; - -static u32 rb711gr100_get_flags(const struct rb_info *info) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(rb711gr100_boards); i++) { - const struct rb_board_info *bi; - - bi = &rb711gr100_boards[i]; - if (strcmp(info->board_name, bi->name) == 0) - return bi->flags; - } - - return 0; -} - -static void __init rb711gr100_setup(void) -{ - const struct rb_info *info; - char buf[64]; - u32 flags; - - info = rb_init_info((void *) KSEG1ADDR(0x1f000000), 0x10000); - if (!info) - return; - - scnprintf(buf, sizeof(buf), "Mikrotik RouterBOARD %s", - (info->board_name) ? info->board_name : ""); - mips_set_machine_name(buf); - - rb711gr100_init_partitions(info); - ath79_register_spi(&rb711gr100_spi_data, rb711gr100_spi_info, - ARRAY_SIZE(rb711gr100_spi_info)); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_RXD_DELAY | - AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(rb91x_mdio0_info, - ARRAY_SIZE(rb91x_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_pll_data.pll_1000 = 0x02000000; - - ath79_register_eth(0); - - rb711gr100_wlan_init(); - - platform_device_register_data(NULL, "rb91x-nand", -1, - &rb711gr100_nand_data, - sizeof(rb711gr100_nand_data)); - - platform_device_register_data(NULL, "gpio-latch", -1, - &rb711gr100_gpio_latch_data, - sizeof(rb711gr100_gpio_latch_data)); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rb711gr100_leds), - rb711gr100_leds); - - flags = rb711gr100_get_flags(info); - - if (flags & RB91X_FLAG_USB) - ath79_register_usb(); - - if (flags & RB91X_FLAG_PCIE) - ath79_register_pci(); - -} - -MIPS_MACHINE_NONAME(ATH79_MACH_RB_711GR100, "711Gr100", rb711gr100_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb922.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb922.c deleted file mode 100644 index c0e90d1ad..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb922.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * MikroTik RouterBOARD 91X support - * - * Copyright (C) 2015 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "common.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-spi.h" -#include "machtypes.h" -#include "pci.h" -#include "routerboot.h" - -#define RB922_GPIO_LED_USR 12 -#define RB922_GPIO_USB_POWER 13 -#define RB922_GPIO_FAN_CTRL 14 -#define RB922_GPIO_BTN_RESET 20 -#define RB922_GPIO_NAND_NCE 23 - -#define RB922_PHY_ADDR 4 - -#define RB922_KEYS_POLL_INTERVAL 20 /* msecs */ -#define RB922_KEYS_DEBOUNCE_INTERVAL (3 * RB922_KEYS_POLL_INTERVAL) - -#define RB_ROUTERBOOT_OFFSET 0x0000 -#define RB_ROUTERBOOT_MIN_SIZE 0xb000 -#define RB_HARD_CFG_SIZE 0x1000 -#define RB_BIOS_OFFSET 0xd000 -#define RB_BIOS_SIZE 0x1000 -#define RB_SOFT_CFG_OFFSET 0xf000 -#define RB_SOFT_CFG_SIZE 0x1000 - -static struct mtd_partition rb922gs_spi_partitions[] = { - { - .name = "routerboot", - .offset = RB_ROUTERBOOT_OFFSET, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "hard_config", - .size = RB_HARD_CFG_SIZE, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "bios", - .offset = RB_BIOS_OFFSET, - .size = RB_BIOS_SIZE, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "soft_config", - .size = RB_SOFT_CFG_SIZE, - } -}; - -static struct flash_platform_data rb922gs_spi_flash_data = { - .parts = rb922gs_spi_partitions, - .nr_parts = ARRAY_SIZE(rb922gs_spi_partitions), -}; - -static struct gpio_led rb922gs_leds[] __initdata = { - { - .name = "rb:green:user", - .gpio = RB922_GPIO_LED_USR, - .active_low = 1, - }, -}; - -static struct gpio_keys_button rb922gs_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = RB922_KEYS_DEBOUNCE_INTERVAL, - .gpio = RB922_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct at803x_platform_data rb922gs_at803x_data = { - .disable_smarteee = 1, -}; - -static struct mdio_board_info rb922gs_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "rb922gs", - .mdio_addr = RB922_PHY_ADDR, - .platform_data = &rb922gs_at803x_data, - }, -}; - -static void __init rb922gs_init_partitions(const struct rb_info *info) -{ - rb922gs_spi_partitions[0].size = info->hard_cfg_offs; - rb922gs_spi_partitions[1].offset = info->hard_cfg_offs; - rb922gs_spi_partitions[3].offset = info->soft_cfg_offs; -} - -static void rb922gs_nand_select_chip(int chip_no) -{ - switch (chip_no) { - case 0: - gpio_set_value(RB922_GPIO_NAND_NCE, 0); - break; - default: - gpio_set_value(RB922_GPIO_NAND_NCE, 1); - break; - } - ndelay(500); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -static struct nand_ecclayout rb922gs_nand_ecclayout = { - .eccbytes = 6, - .eccpos = { 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } -}; - -#else - -static int rb922gs_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 8; - oobregion->length = 3; - return 0; - case 1: - oobregion->offset = 13; - oobregion->length = 3; - return 0; - default: - return -ERANGE; - } -} - -static int rb922gs_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 0; - oobregion->length = 4; - return 0; - case 1: - oobregion->offset = 4; - oobregion->length = 1; - return 0; - case 2: - oobregion->offset = 6; - oobregion->length = 2; - return 0; - case 3: - oobregion->offset = 11; - oobregion->length = 2; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops rb922gs_nand_ecclayout_ops = { - .ecc = rb922gs_ooblayout_ecc, - .free = rb922gs_ooblayout_free, -}; -#endif /* < 4.6 */ - -static int rb922gs_nand_scan_fixup(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct nand_chip *chip = mtd->priv; -#else - struct nand_chip *chip = mtd_to_nand(mtd); -#endif /* < 4.6.0 */ - - if (mtd->writesize == 512) { - /* - * Use the OLD Yaffs-1 OOB layout, otherwise RouterBoot - * will not be able to find the kernel that we load. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - chip->ecc.layout = &rb922gs_nand_ecclayout; -#else - mtd_set_ooblayout(mtd, &rb922gs_nand_ecclayout_ops); -#endif - } - - chip->options = NAND_NO_SUBPAGE_WRITE; - - return 0; -} - -static struct mtd_partition rb922gs_nand_partitions[] = { - { - .name = "booter", - .offset = 0, - .size = (256 * 1024), - .mask_flags = MTD_WRITEABLE, - }, - { - .name = "kernel", - .offset = (256 * 1024), - .size = (4 * 1024 * 1024) - (256 * 1024), - }, - { - .name = "ubi", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL, - }, -}; - -static void __init rb922gs_nand_init(void) -{ - gpio_request_one(RB922_GPIO_NAND_NCE, GPIOF_OUT_INIT_HIGH, "NAND nCE"); - - ath79_nfc_set_scan_fixup(rb922gs_nand_scan_fixup); - ath79_nfc_set_parts(rb922gs_nand_partitions, - ARRAY_SIZE(rb922gs_nand_partitions)); - ath79_nfc_set_select_chip(rb922gs_nand_select_chip); - ath79_nfc_set_swap_dma(true); - ath79_register_nfc(); -} - -static void __init rb922gs_setup(void) -{ - const struct rb_info *info; - char buf[64]; - - info = rb_init_info((void *) KSEG1ADDR(0x1f000000), 0x10000); - if (!info) - return; - - scnprintf(buf, sizeof(buf), "MikroTik RouterBOARD %s", - (info->board_name) ? info->board_name : ""); - mips_set_machine_name(buf); - - rb922gs_init_partitions(info); - ath79_register_m25p80(&rb922gs_spi_flash_data); - - rb922gs_nand_init(); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(rb922gs_mdio0_info, - ARRAY_SIZE(rb922gs_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(RB922_PHY_ADDR); - if (strcmp(info->board_name, "921GS-5HPacD r2") == 0) { - ath79_eth0_pll_data.pll_10 = 0xa0001313; - ath79_eth0_pll_data.pll_100 = 0xa0000101; - ath79_eth0_pll_data.pll_1000 = 0x8f000000; - } - else { - ath79_eth0_pll_data.pll_10 = 0x81001313; - ath79_eth0_pll_data.pll_100 = 0x81000101; - ath79_eth0_pll_data.pll_1000 = 0x8f000000; - } - - ath79_register_eth(0); - - ath79_register_pci(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(rb922gs_leds), rb922gs_leds); - ath79_register_gpio_keys_polled(-1, RB922_KEYS_POLL_INTERVAL, - ARRAY_SIZE(rb922gs_gpio_keys), - rb922gs_gpio_keys); - - /* NOTE: - * This only supports the RB911G-5HPacD board for now. For other boards - * more devices must be registered based on the hardware options which - * can be found in the hardware configuration of RouterBOOT. - */ -} - -MIPS_MACHINE_NONAME(ATH79_MACH_RB_922GS, "922gs", rb922gs_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb95x.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb95x.c deleted file mode 100644 index 308de29eb..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb95x.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * MikroTik RouterBOARD 95X support - * - * Copyright (C) 2012 Stijn Tintel - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2013 Kamil Trzcinski - * - * 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) "rb95x: " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "common.h" -#include "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "routerboot.h" -#include "dev-leds-gpio.h" - -#define RB95X_GPIO_NAND_NCE 14 - -static struct mtd_partition rb95x_nand_partitions[] = { - { - .name = "booter", - .offset = 0, - .size = (256 * 1024), - .mask_flags = MTD_WRITEABLE, - }, - { - .name = "kernel", - .offset = (256 * 1024), - .size = (4 * 1024 * 1024) - (256 * 1024), - }, - { - .name = "ubi", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL, - }, -}; - -static struct gpio_led rb951ui_leds_gpio[] __initdata = { - { - .name = "rb:green:wlan", - .gpio = 11, - .active_low = 1, - }, { - .name = "rb:green:act", - .gpio = 3, - .active_low = 1, - }, { - .name = "rb:green:port1", - .gpio = 13, - .active_low = 1, - }, { - .name = "rb:green:port2", - .gpio = 12, - .active_low = 1, - }, { - .name = "rb:green:port3", - .gpio = 4, - .active_low = 1, - }, { - .name = "rb:green:port4", - .gpio = 21, - .active_low = 1, - }, { - .name = "rb:green:port5", - .gpio = 16, - .active_low = 1, - } -}; - -static struct ar8327_pad_cfg rb95x_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data rb95x_ar8327_data = { - .pad0_cfg = &rb95x_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - } -}; - -static struct mdio_board_info rb95x_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "rb95x", - .mdio_addr = 0, - .platform_data = &rb95x_ar8327_data, - }, -}; - -void __init rb95x_wlan_init(void) -{ - char *art_buf; - u8 wlan_mac[ETH_ALEN]; - - art_buf = rb_get_wlan_data(); - if (art_buf == NULL) - return; - - ath79_init_mac(wlan_mac, ath79_mac_base, 11); - ath79_register_wmac(art_buf + 0x1000, wlan_mac); - - kfree(art_buf); -} - -static void rb95x_nand_select_chip(int chip_no) -{ - switch (chip_no) { - case 0: - gpio_set_value(RB95X_GPIO_NAND_NCE, 0); - break; - default: - gpio_set_value(RB95X_GPIO_NAND_NCE, 1); - break; - } - ndelay(500); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -static struct nand_ecclayout rb95x_nand_ecclayout = { - .eccbytes = 6, - .eccpos = { 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } -}; - -#else - -static int rb95x_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 8; - oobregion->length = 3; - return 0; - case 1: - oobregion->offset = 13; - oobregion->length = 3; - return 0; - default: - return -ERANGE; - } -} - -static int rb95x_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 0; - oobregion->length = 4; - return 0; - case 1: - oobregion->offset = 4; - oobregion->length = 1; - return 0; - case 2: - oobregion->offset = 6; - oobregion->length = 2; - return 0; - case 3: - oobregion->offset = 11; - oobregion->length = 2; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops rb95x_nand_ecclayout_ops = { - .ecc = rb95x_ooblayout_ecc, - .free = rb95x_ooblayout_free, -}; -#endif /* < 4.6 */ - -static int rb95x_nand_scan_fixup(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct nand_chip *chip = mtd->priv; -#else - struct nand_chip *chip = mtd_to_nand(mtd); -#endif /* < 4.6.0 */ - - if (mtd->writesize == 512) { - /* - * Use the OLD Yaffs-1 OOB layout, otherwise RouterBoot - * will not be able to find the kernel that we load. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - chip->ecc.layout = &rb95x_nand_ecclayout; -#else - mtd_set_ooblayout(mtd, &rb95x_nand_ecclayout_ops); -#endif - } - - chip->options = NAND_NO_SUBPAGE_WRITE; - - return 0; -} - -void __init rb95x_nand_init(void) -{ - gpio_request_one(RB95X_GPIO_NAND_NCE, GPIOF_OUT_INIT_HIGH, "NAND nCE"); - - ath79_nfc_set_scan_fixup(rb95x_nand_scan_fixup); - ath79_nfc_set_parts(rb95x_nand_partitions, - ARRAY_SIZE(rb95x_nand_partitions)); - ath79_nfc_set_select_chip(rb95x_nand_select_chip); - ath79_nfc_set_swap_dma(true); - ath79_register_nfc(); -} - -static int __init rb95x_setup(void) -{ - const struct rb_info *info; - - info = rb_init_info((void *)(KSEG1ADDR(AR71XX_SPI_BASE)), 0x10000); - if (!info) - return -EINVAL; - - rb95x_nand_init(); - - return 0; -} - -static void __init rb951g_setup(void) -{ - if (rb95x_setup()) - return; - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(rb95x_mdio0_info, - ARRAY_SIZE(rb95x_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - - ath79_register_eth(0); - - rb95x_wlan_init(); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_RB_951G, "951G", "MikroTik RouterBOARD 951G-2HnD", - rb951g_setup); - -static void __init rb951ui_setup(void) -{ - if (rb95x_setup()) - return; - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - gpio_request_one(20, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - gpio_request_one(2, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "POE power"); - - rb95x_wlan_init(); - ath79_register_usb(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rb951ui_leds_gpio), - rb951ui_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_RB_951U, "951HnD", "MikroTik RouterBOARD 951Ui-2HnD", - rb951ui_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rbspi.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rbspi.c deleted file mode 100644 index ff5cf9503..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rbspi.c +++ /dev/null @@ -1,1125 +0,0 @@ -/* - * MikroTik SPI-NOR RouterBOARDs support - * - * - MikroTik RouterBOARD mAP 2nD - * - MikroTik RouterBOARD mAP L-2nD - * - MikroTik RouterBOARD 911-2Hn (911 Lite2) - * - MikroTik RouterBOARD 911-5Hn (911 Lite5) - * - MikroTik RouterBOARD 941L-2nD - * - MikroTik RouterBOARD 951Ui-2nD - * - MikroTik RouterBOARD 952Ui-5ac2nD - * - MikroTik RouterBOARD 962UiGS-5HacT2HnT - * - MikroTik RouterBOARD 750UP r2 - * - MikroTik RouterBOARD 750P-PBr2 - * - MikroTik RouterBOARD 750 r2 - * - MikroTik RouterBOARD LHG 5nD - * - MikroTik RouterBOARD wAP2nD - * - MikroTik RouterBOARD wAP G-5HacT2HnDwAP (wAP AC) - * - * Preliminary support for the following hardware - * - MikroTik RouterBOARD cAP2nD - * Furthermore, the cAP lite (cAPL2nD) appears to feature the exact same - * hardware as the mAP L-2nD. It is unknown if they share the same board - * identifier. - * - * Copyright (C) 2017 Thibaut VARENE - * Copyright (C) 2016 David Hutchison - * Copyright (C) 2017 Ryan Mounce - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "common.h" -#include "dev-eth.h" -#include "dev-spi.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" -#include "pci.h" -#include "routerboot.h" - -#define RBSPI_KEYS_POLL_INTERVAL 20 /* msecs */ -#define RBSPI_KEYS_DEBOUNCE_INTERVAL (3 * RBSPI_KEYS_POLL_INTERVAL) - -#define RBSPI_HAS_USB BIT(0) -#define RBSPI_HAS_WLAN0 BIT(1) -#define RBSPI_HAS_WLAN1 BIT(2) -#define RBSPI_HAS_WAN4 BIT(3) /* has WAN port on PHY4 */ -#define RBSPI_HAS_SSR BIT(4) /* has an SSR on SPI bus 0 */ -#define RBSPI_HAS_POE BIT(5) -#define RBSPI_HAS_MDIO1 BIT(6) -#define RBSPI_HAS_PCI BIT(7) - -#define RB_ROUTERBOOT_OFFSET 0x0000 -#define RB_BIOS_SIZE 0x1000 -#define RB_SOFT_CFG_SIZE 0x1000 - -/* Flash partitions indexes */ -enum { - RBSPI_PART_RBOOT, - RBSPI_PART_HCONF, - RBSPI_PART_BIOS, - RBSPI_PART_RBOOT2, - RBSPI_PART_SCONF, - RBSPI_PART_FIRMW, - RBSPI_PARTS -}; - -static struct mtd_partition rbspi_spi_partitions[RBSPI_PARTS]; - -/* - * Setup the SPI flash partition table based on initial parsing. - * The kernel can be at any aligned position and have any size. - */ -static void __init rbspi_init_partitions(const struct rb_info *info) -{ - struct mtd_partition *parts = rbspi_spi_partitions; - memset(parts, 0x0, sizeof(*parts)); - - parts[RBSPI_PART_RBOOT].name = "routerboot"; - parts[RBSPI_PART_RBOOT].offset = RB_ROUTERBOOT_OFFSET; - parts[RBSPI_PART_RBOOT].size = info->hard_cfg_offs; - parts[RBSPI_PART_RBOOT].mask_flags = MTD_WRITEABLE; - - parts[RBSPI_PART_HCONF].name = "hard_config"; - parts[RBSPI_PART_HCONF].offset = info->hard_cfg_offs; - parts[RBSPI_PART_HCONF].size = info->hard_cfg_size; - parts[RBSPI_PART_HCONF].mask_flags = MTD_WRITEABLE; - - parts[RBSPI_PART_BIOS].name = "bios"; - parts[RBSPI_PART_BIOS].offset = info->hard_cfg_offs - + info->hard_cfg_size; - parts[RBSPI_PART_BIOS].size = RB_BIOS_SIZE; - parts[RBSPI_PART_BIOS].mask_flags = MTD_WRITEABLE; - - parts[RBSPI_PART_RBOOT2].name = "routerboot2"; - parts[RBSPI_PART_RBOOT2].offset = parts[RBSPI_PART_BIOS].offset - + RB_BIOS_SIZE; - parts[RBSPI_PART_RBOOT2].size = info->soft_cfg_offs - - parts[RBSPI_PART_RBOOT2].offset; - parts[RBSPI_PART_RBOOT2].mask_flags = MTD_WRITEABLE; - - parts[RBSPI_PART_SCONF].name = "soft_config"; - parts[RBSPI_PART_SCONF].offset = info->soft_cfg_offs; - parts[RBSPI_PART_SCONF].size = RB_SOFT_CFG_SIZE; - - parts[RBSPI_PART_FIRMW].name = "firmware"; - parts[RBSPI_PART_FIRMW].offset = parts[RBSPI_PART_SCONF].offset - + parts[RBSPI_PART_SCONF].size; - parts[RBSPI_PART_FIRMW].size = MTDPART_SIZ_FULL; -} - -static struct flash_platform_data rbspi_spi_flash_data = { - .parts = rbspi_spi_partitions, - .nr_parts = ARRAY_SIZE(rbspi_spi_partitions), -}; - -/* - * Several boards only have a single reset button, use a common - * structure for that. - */ -static struct gpio_keys_button rbspi_gpio_keys_reset[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = RBSPI_KEYS_DEBOUNCE_INTERVAL, - .gpio = -ENOENT, /* filled dynamically */ - .active_low = 1, - }, -}; - -/* RB mAP L-2nD gpios */ -#define RBMAPL_GPIO_LED_POWER 17 -#define RBMAPL_GPIO_LED_USER 14 -#define RBMAPL_GPIO_LED_ETH 4 -#define RBMAPL_GPIO_LED_WLAN 11 -#define RBMAPL_GPIO_BTN_RESET 16 - -static struct gpio_led rbmapl_leds[] __initdata = { - { - .name = "rb:green:power", - .gpio = RBMAPL_GPIO_LED_POWER, - .active_low = 0, - .default_state = LEDS_GPIO_DEFSTATE_ON, - }, { - .name = "rb:green:user", - .gpio = RBMAPL_GPIO_LED_USER, - .active_low = 0, - }, { - .name = "rb:green:eth", - .gpio = RBMAPL_GPIO_LED_ETH, - .active_low = 0, - }, { - .name = "rb:green:wlan", - .gpio = RBMAPL_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -/* RB 941L-2nD gpios */ -#define RBHAPL_GPIO_LED_USER 14 -#define RBHAPL_GPIO_BTN_RESET 16 - -static struct gpio_led rbhapl_leds[] __initdata = { - { - .name = "rb:green:user", - .gpio = RBHAPL_GPIO_LED_USER, - .active_low = 1, - }, -}; - -/* common RB SSRs */ -#define RBSPI_SSR_GPIO_BASE 40 -#define RBSPI_SSR_GPIO(bit) (RBSPI_SSR_GPIO_BASE + (bit)) - -/* RB 951Ui-2nD gpios */ -#define RB952_SSR_BIT_LED_LAN1 0 -#define RB952_SSR_BIT_LED_LAN2 1 -#define RB952_SSR_BIT_LED_LAN3 2 -#define RB952_SSR_BIT_LED_LAN4 3 -#define RB952_SSR_BIT_LED_LAN5 4 -#define RB952_SSR_BIT_USB_POWER 5 -#define RB952_SSR_BIT_LED_WLAN 6 -#define RB952_GPIO_SSR_CS 11 -#define RB952_GPIO_LED_USER 4 -#define RB952_GPIO_POE_POWER 14 -#define RB952_GPIO_POE_STATUS 12 -#define RB952_GPIO_BTN_RESET 16 -#define RB952_GPIO_USB_POWER RBSPI_SSR_GPIO(RB952_SSR_BIT_USB_POWER) -#define RB952_GPIO_LED_LAN1 RBSPI_SSR_GPIO(RB952_SSR_BIT_LED_LAN1) -#define RB952_GPIO_LED_LAN2 RBSPI_SSR_GPIO(RB952_SSR_BIT_LED_LAN2) -#define RB952_GPIO_LED_LAN3 RBSPI_SSR_GPIO(RB952_SSR_BIT_LED_LAN3) -#define RB952_GPIO_LED_LAN4 RBSPI_SSR_GPIO(RB952_SSR_BIT_LED_LAN4) -#define RB952_GPIO_LED_LAN5 RBSPI_SSR_GPIO(RB952_SSR_BIT_LED_LAN5) -#define RB952_GPIO_LED_WLAN RBSPI_SSR_GPIO(RB952_SSR_BIT_LED_WLAN) - -static struct gpio_led rb952_leds[] __initdata = { - { - .name = "rb:green:user", - .gpio = RB952_GPIO_LED_USER, - .active_low = 0, - }, { - .name = "rb:blue:wlan", - .gpio = RB952_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "rb:green:port1", - .gpio = RB952_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "rb:green:port2", - .gpio = RB952_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "rb:green:port3", - .gpio = RB952_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "rb:green:port4", - .gpio = RB952_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "rb:green:port5", - .gpio = RB952_GPIO_LED_LAN5, - .active_low = 1, - }, -}; - - -/* RB 962UiGS-5HacT2HnT gpios */ -#define RB962_GPIO_POE_STATUS 2 -#define RB962_GPIO_POE_POWER 3 -#define RB962_GPIO_LED_USER 12 -#define RB962_GPIO_USB_POWER 13 -#define RB962_GPIO_BTN_RESET 20 - -static struct gpio_led rb962_leds_gpio[] __initdata = { - { - .name = "rb:green:user", - .gpio = RB962_GPIO_LED_USER, - .active_low = 1, - }, -}; - -static const struct ar8327_led_info rb962_leds_ar8327[] = { - AR8327_LED_INFO(PHY0_0, HW, "rb:green:port1"), - AR8327_LED_INFO(PHY1_0, HW, "rb:green:port2"), - AR8327_LED_INFO(PHY2_0, HW, "rb:green:port3"), - AR8327_LED_INFO(PHY3_0, HW, "rb:green:port4"), - AR8327_LED_INFO(PHY4_0, HW, "rb:green:port5"), -}; - -static struct ar8327_pad_cfg rb962_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, - .mac06_exchange_dis = true, -}; - -static struct ar8327_pad_cfg rb962_ar8327_pad6_cfg = { - /* Use SGMII interface for GMAC6 of the AR8337 switch */ - .mode = AR8327_PAD_MAC_SGMII, - .rxclk_delay_en = true, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, -}; - -static struct ar8327_led_cfg rb962_ar8327_led_cfg = { - .led_ctrl0 = 0xc737c737, - .led_ctrl1 = 0x00000000, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x0030c300, - .open_drain = false, -}; - -static struct ar8327_platform_data rb962_ar8327_data = { - .pad0_cfg = &rb962_ar8327_pad0_cfg, - .pad6_cfg = &rb962_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &rb962_ar8327_led_cfg, - .num_leds = ARRAY_SIZE(rb962_leds_ar8327), - .leds = rb962_leds_ar8327, -}; - -static struct mdio_board_info rb962_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "rb962", - .mdio_addr = 0, - .platform_data = &rb962_ar8327_data, - }, -}; - -/* RB wAP-2nD gpios */ -#define RBWAP_GPIO_LED_USER 14 -#define RBWAP_GPIO_LED_WLAN 11 -#define RBWAP_GPIO_BTN_RESET 16 - -static struct gpio_led rbwap_leds[] __initdata = { - { - .name = "rb:green:user", - .gpio = RBWAP_GPIO_LED_USER, - .active_low = 1, - }, { - .name = "rb:green:wlan", - .gpio = RBWAP_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -/* RB cAP-2nD gpios */ -#define RBCAP_GPIO_LED_1 14 -#define RBCAP_GPIO_LED_2 12 -#define RBCAP_GPIO_LED_3 11 -#define RBCAP_GPIO_LED_4 4 -#define RBCAP_GPIO_LED_ALL 13 - -static struct gpio_led rbcap_leds[] __initdata = { - { - .name = "rb:green:rssi1", - .gpio = RBCAP_GPIO_LED_1, - .active_low = 1, - }, { - .name = "rb:green:rssi2", - .gpio = RBCAP_GPIO_LED_2, - .active_low = 1, - }, { - .name = "rb:green:rssi3", - .gpio = RBCAP_GPIO_LED_3, - .active_low = 1, - }, { - .name = "rb:green:rssi4", - .gpio = RBCAP_GPIO_LED_4, - .active_low = 1, - }, -}; - -/* RB mAP-2nD gpios */ -#define RBMAP_SSR_BIT_LED_LAN1 0 -#define RBMAP_SSR_BIT_LED_LAN2 1 -#define RBMAP_SSR_BIT_LED_POEO 2 -#define RBMAP_SSR_BIT_LED_USER 3 -#define RBMAP_SSR_BIT_LED_WLAN 4 -#define RBMAP_SSR_BIT_USB_POWER 5 -#define RBMAP_SSR_BIT_LED_APCAP 6 -#define RBMAP_GPIO_BTN_RESET 16 -#define RBMAP_GPIO_SSR_CS 11 -#define RBMAP_GPIO_LED_POWER 4 -#define RBMAP_GPIO_POE_POWER 14 -#define RBMAP_GPIO_POE_STATUS 12 -#define RBMAP_GPIO_USB_POWER RBSPI_SSR_GPIO(RBMAP_SSR_BIT_USB_POWER) -#define RBMAP_GPIO_LED_LAN1 RBSPI_SSR_GPIO(RBMAP_SSR_BIT_LED_LAN1) -#define RBMAP_GPIO_LED_LAN2 RBSPI_SSR_GPIO(RBMAP_SSR_BIT_LED_LAN2) -#define RBMAP_GPIO_LED_POEO RBSPI_SSR_GPIO(RBMAP_SSR_BIT_LED_POEO) -#define RBMAP_GPIO_LED_USER RBSPI_SSR_GPIO(RBMAP_SSR_BIT_LED_USER) -#define RBMAP_GPIO_LED_WLAN RBSPI_SSR_GPIO(RBMAP_SSR_BIT_LED_WLAN) -#define RBMAP_GPIO_LED_APCAP RBSPI_SSR_GPIO(RBMAP_SSR_BIT_LED_APCAP) - -static struct gpio_led rbmap_leds[] __initdata = { - { - .name = "rb:green:power", - .gpio = RBMAP_GPIO_LED_POWER, - .active_low = 1, - .default_state = LEDS_GPIO_DEFSTATE_ON, - }, { - .name = "rb:green:eth1", - .gpio = RBMAP_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "rb:green:eth2", - .gpio = RBMAP_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "rb:red:poe_out", - .gpio = RBMAP_GPIO_LED_POEO, - .active_low = 1, - }, { - .name = "rb:green:user", - .gpio = RBMAP_GPIO_LED_USER, - .active_low = 1, - }, { - .name = "rb:green:wlan", - .gpio = RBMAP_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "rb:green:ap_cap", - .gpio = RBMAP_GPIO_LED_APCAP, - .active_low = 1, - }, -}; - -/* RB LHG 5nD gpios */ -#define RBLHG_GPIO_LED_0 13 -#define RBLHG_GPIO_LED_1 12 -#define RBLHG_GPIO_LED_2 4 -#define RBLHG_GPIO_LED_3 21 -#define RBLHG_GPIO_LED_4 18 -#define RBLHG_GPIO_LED_ETH 14 -#define RBLHG_GPIO_LED_POWER 11 -#define RBLHG_GPIO_LED_USER 20 -#define RBLHG_GPIO_BTN_RESET 15 - -static struct gpio_led rblhg_leds[] __initdata = { - { - .name = "rb:green:rssi0", - .gpio = RBLHG_GPIO_LED_0, - .active_low = 1, - }, { - .name = "rb:green:rssi1", - .gpio = RBLHG_GPIO_LED_1, - .active_low = 1, - }, { - .name = "rb:green:rssi2", - .gpio = RBLHG_GPIO_LED_2, - .active_low = 1, - }, { - .name = "rb:green:rssi3", - .gpio = RBLHG_GPIO_LED_3, - .active_low = 1, - }, { - .name = "rb:green:rssi4", - .gpio = RBLHG_GPIO_LED_4, - .active_low = 1, - }, { - .name = "rb:green:eth", - .gpio = RBLHG_GPIO_LED_ETH, - .active_low = 1, - }, { - .name = "rb:green:user", - .gpio = RBLHG_GPIO_LED_USER, - .active_low = 1, - }, { - .name = "rb:blue:power", - .gpio = RBLHG_GPIO_LED_POWER, - .active_low = 0, - .default_state = LEDS_GPIO_DEFSTATE_ON, - }, -}; - -/* RB w APG-5HacT2HnD (wAP AC) gpios*/ -#define RBWAPGSC_LED1 1 -#define RBWAPGSC_LED2 8 -#define RBWAPGSC_LED3 9 -#define RBWAPGSC_POWERLED 16 -#define RBWAPGSC_GPIO_BTN_RESET 1 -#define RBWAPGSC_GPIO_MDIO_MDC 12 -#define RBWAPGSC_GPIO_MDIO_DATA 11 -#define RBWAPGSC_MDIO_PHYADDR 0 - -static struct gpio_led rbwapgsc_leds[] __initdata = { - { - .name = "rb:green:led1", - .gpio = RBWAPGSC_LED1, - .active_low = 1, - },{ - .name = "rb:blue:power", - .gpio = RBWAPGSC_POWERLED, - .active_low = 1, - }, -}; - -static struct mdio_gpio_platform_data rbwapgsc_mdio_data = { - .mdc = RBWAPGSC_GPIO_MDIO_MDC, - .mdio = RBWAPGSC_GPIO_MDIO_DATA, - .phy_mask = ~BIT(RBWAPGSC_MDIO_PHYADDR), -}; - -static struct platform_device rbwapgsc_phy_device = { - .name = "mdio-gpio", - .id = 1, - .dev = { - .platform_data = &rbwapgsc_mdio_data - }, -}; - -/* RB911L GPIOs */ -#define RB911L_GPIO_BTN_RESET 15 -#define RB911L_GPIO_LED_1 13 -#define RB911L_GPIO_LED_2 12 -#define RB911L_GPIO_LED_3 4 -#define RB911L_GPIO_LED_4 21 -#define RB911L_GPIO_LED_5 18 -#define RB911L_GPIO_LED_ETH 20 -#define RB911L_GPIO_LED_POWER 11 -#define RB911L_GPIO_LED_USER 3 -#define RB911L_GPIO_PIN_HOLE 14 /* for reference */ - -static struct gpio_led rb911l_leds[] __initdata = { - { - .name = "rb:green:eth", - .gpio = RB911L_GPIO_LED_ETH, - .active_low = 1, - }, { - .name = "rb:green:led1", - .gpio = RB911L_GPIO_LED_1, - .active_low = 1, - }, { - .name = "rb:green:led2", - .gpio = RB911L_GPIO_LED_2, - .active_low = 1, - }, { - .name = "rb:green:led3", - .gpio = RB911L_GPIO_LED_3, - .active_low = 1, - }, { - .name = "rb:green:led4", - .gpio = RB911L_GPIO_LED_4, - .active_low = 1, - }, { - .name = "rb:green:led5", - .gpio = RB911L_GPIO_LED_5, - .active_low = 1, - }, { - .name = "rb:green:power", - .gpio = RB911L_GPIO_LED_POWER, - .default_state = LEDS_GPIO_DEFSTATE_ON, - .open_drain = 1, - }, { - .name = "rb:green:user", - .gpio = RB911L_GPIO_LED_USER, - .active_low = 1, - .open_drain = 1, - }, -}; - -static struct gen_74x164_chip_platform_data rbspi_ssr_data = { - .base = RBSPI_SSR_GPIO_BASE, - .num_registers = 1, -}; - -/* the spi-ath79 driver can only natively handle CS0. Other CS are bit-banged */ -static int rbspi_spi_cs_gpios[] = { - -ENOENT, /* CS0 is always -ENOENT: natively handled */ - -ENOENT, /* CS1 can be updated by the code as necessary */ -}; - -static struct ath79_spi_platform_data rbspi_ath79_spi_data = { - .bus_num = 0, - .cs_gpios = rbspi_spi_cs_gpios, -}; - -/* - * Global spi_board_info: devices that don't have an SSR only have the SPI NOR - * flash on bus0 CS0, while devices that have an SSR add it on the same bus CS1 - */ -static struct spi_board_info rbspi_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &rbspi_spi_flash_data, - }, { - .bus_num = 0, - .chip_select = 1, - .max_speed_hz = 25000000, - .modalias = "74x164", - .platform_data = &rbspi_ssr_data, - } -}; - -void __init rbspi_wlan_init(u16 id, int wmac_offset) -{ - char *art_buf; - u8 wlan_mac[ETH_ALEN]; - - art_buf = rb_get_ext_wlan_data(id); - if (!art_buf) - return; - - ath79_init_mac(wlan_mac, ath79_mac_base, wmac_offset); - ath79_register_wmac(art_buf + 0x1000, wlan_mac); - - kfree(art_buf); -} - -#define RBSPI_MACH_BUFLEN 64 -/* - * Common platform init routine for all SPI NOR devices. - */ -static __init const struct rb_info *rbspi_platform_setup(void) -{ - const struct rb_info *info; - char buf[RBSPI_MACH_BUFLEN] = "MikroTik "; - char *str; - int len = RBSPI_MACH_BUFLEN - strlen(buf) - 1; - - info = rb_init_info((void *)(KSEG1ADDR(AR71XX_SPI_BASE)), 0x20000); - if (!info) - return NULL; - - if (info->board_name) { - str = "RouterBOARD "; - if (strncmp(info->board_name, str, strlen(str))) { - strncat(buf, str, len); - len -= strlen(str); - } - strncat(buf, info->board_name, len); - } - else - strncat(buf, "UNKNOWN", len); - - mips_set_machine_name(buf); - - /* fix partitions based on flash parsing */ - rbspi_init_partitions(info); - - return info; -} - -/* - * Common peripherals init routine for all SPI NOR devices. - * Sets SPI and USB. - */ -static void __init rbspi_peripherals_setup(u32 flags) -{ - unsigned spi_n; - - if (flags & RBSPI_HAS_SSR) - spi_n = ARRAY_SIZE(rbspi_spi_info); - else - spi_n = 1; /* only one device on bus0 */ - - rbspi_ath79_spi_data.num_chipselect = spi_n; - rbspi_ath79_spi_data.cs_gpios = rbspi_spi_cs_gpios; - ath79_register_spi(&rbspi_ath79_spi_data, rbspi_spi_info, spi_n); - - if (flags & RBSPI_HAS_USB) - ath79_register_usb(); - - if (flags & RBSPI_HAS_PCI) - ath79_register_pci(); -} - -/* - * Common network init routine for all SPI NOR devices. - * Sets LAN/WAN/WLAN. - */ -static void __init rbspi_network_setup(u32 flags, int gmac1_offset, - int wmac0_offset, int wmac1_offset) -{ - /* for QCA953x that will init mdio1_device/data */ - ath79_register_mdio(0, 0x0); - if (flags & RBSPI_HAS_MDIO1) - ath79_register_mdio(1, 0x0); - - if (flags & RBSPI_HAS_WAN4) { - ath79_setup_ar934x_eth_cfg(0); - - /* set switch to oper mode 1, PHY4 connected to CPU */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask |= BIT(4); - - /* init GMAC0 connected to PHY4 at 100M */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_register_eth(0); - } else { - /* set the SoC to SW_ONLY_MODE, which connects all PHYs - * to the internal switch. - * We hijack ath79_setup_ar934x_eth_cfg() to set the switch in - * the QCA953x, this works because this configuration bit is - * the same as the AR934x. There's no equivalent function for - * QCA953x for now. */ - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - } - - /* init GMAC1 */ - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, gmac1_offset); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - if (flags & RBSPI_HAS_WLAN0) - rbspi_wlan_init(0, wmac0_offset); - - if (flags & RBSPI_HAS_WLAN1) - rbspi_wlan_init(1, wmac1_offset); -} - -static __init void rbspi_register_reset_button(int gpio) -{ - rbspi_gpio_keys_reset[0].gpio = gpio; - ath79_register_gpio_keys_polled(-1, RBSPI_KEYS_POLL_INTERVAL, - ARRAY_SIZE(rbspi_gpio_keys_reset), - rbspi_gpio_keys_reset); -} - -/* - * Init the mAP lite hardware (QCA953x). - * The mAP L-2nD (mAP lite) has a single ethernet port, connected to PHY0. - * Trying to use GMAC0 in direct mode was unsucessful, so we're - * using SW_ONLY_MODE, which connects PHY0 to MAC1 on the internal - * switch, which is connected to GMAC1 on the SoC. GMAC0 is unused. - */ -static void __init rbmapl_setup(void) -{ - u32 flags = RBSPI_HAS_WLAN0; - - if (!rbspi_platform_setup()) - return; - - rbspi_peripherals_setup(flags); - - /* GMAC1 is HW MAC, WLAN0 MAC is HW MAC + 1 */ - rbspi_network_setup(flags, 0, 1, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rbmapl_leds), rbmapl_leds); - - /* mAP lite has a single reset button as gpio 16 */ - rbspi_register_reset_button(RBMAPL_GPIO_BTN_RESET); - - /* clear internal multiplexing */ - ath79_gpio_output_select(RBMAPL_GPIO_LED_ETH, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(RBMAPL_GPIO_LED_POWER, AR934X_GPIO_OUT_GPIO); -} - -/* - * Init the hAP lite hardware (QCA953x). - * The 941-2nD (hAP lite) has 4 ethernet ports, with port 2-4 - * being assigned to LAN on the casing, and port 1 being assigned - * to "internet" (WAN) on the casing. Port 1 is connected to PHY3. - * Since WAN is neither PHY0 nor PHY4, we cannot use GMAC0 with this device. - */ -static void __init rbhapl_setup(void) -{ - u32 flags = RBSPI_HAS_WLAN0; - - if (!rbspi_platform_setup()) - return; - - rbspi_peripherals_setup(flags); - - /* GMAC1 is HW MAC, WLAN0 MAC is HW MAC + 4 */ - rbspi_network_setup(flags, 0, 4, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rbhapl_leds), rbhapl_leds); - - /* hAP lite has a single reset button as gpio 16 */ - rbspi_register_reset_button(RBHAPL_GPIO_BTN_RESET); -} - -/* - * The hAP, hAP ac lite, hEX lite and hEX PoE lite share the same platform - */ -static void __init rbspi_952_750r2_setup(u32 flags) -{ - if (flags & RBSPI_HAS_SSR) - rbspi_spi_cs_gpios[1] = RB952_GPIO_SSR_CS; - - rbspi_peripherals_setup(flags); - - /* - * GMAC1 is HW MAC + 1, WLAN0 MAC IS HW MAC + 5 (hAP), - * WLAN1 MAC IS HW MAC + 6 (hAP ac lite) - */ - rbspi_network_setup(flags, 1, 5, 6); - - if (flags & RBSPI_HAS_USB) - gpio_request_one(RB952_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - if (flags & RBSPI_HAS_POE) - gpio_request_one(RB952_GPIO_POE_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "POE power"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rb952_leds), rb952_leds); - - /* These devices have a single reset button as gpio 16 */ - rbspi_register_reset_button(RB952_GPIO_BTN_RESET); -} - -/* - * Init the hAP (ac lite) hardware (QCA953x). - * The 951Ui-2nD (hAP) has 5 ethernet ports, with ports 2-5 being assigned - * to LAN on the casing, and port 1 being assigned to "internet" (WAN). - * Port 1 is connected to PHY4 (the ports are labelled in reverse physical - * number), so the SoC can be set to connect GMAC0 to PHY4 and GMAC1 to the - * internal switch for the LAN ports. - * The device also has USB, PoE output and an SSR used for LED multiplexing. - * The 952Ui-5ac2nD (hAP ac lite) is nearly identical to the hAP, it adds a - * QCA9887 5GHz radio via PCI and moves 2.4GHz from WLAN0 to WLAN1. - */ -static void __init rb952_setup(void) -{ - u32 flags = RBSPI_HAS_WAN4 | RBSPI_HAS_USB | - RBSPI_HAS_SSR | RBSPI_HAS_POE; - - if (!rbspi_platform_setup()) - return; - - /* differentiate the hAP from the hAP ac lite */ - if (strstr(mips_get_machine_name(), "952Ui-5ac2nD")) - flags |= RBSPI_HAS_WLAN1 | RBSPI_HAS_PCI; - else - flags |= RBSPI_HAS_WLAN0; - - rbspi_952_750r2_setup(flags); -} - -/* - * Init the hEX (PoE) lite hardware (QCA953x). - * The 750UP r2 (hEX PoE lite) is nearly identical to the hAP, only without - * WLAN. The 750 r2 (hEX lite) is nearly identical to the 750UP r2, only - * without USB and POE. The 750P Pbr2 (Powerbox) is nearly identical to hEX PoE - * lite, only without USB. It shares the same bootloader board identifier. - */ -static void __init rb750upr2_setup(void) -{ - u32 flags = RBSPI_HAS_WAN4 | RBSPI_HAS_SSR; - - if (!rbspi_platform_setup()) - return; - - /* differentiate the hEX lite from the hEX PoE lite */ - if (strstr(mips_get_machine_name(), "750UP r2")) - flags |= RBSPI_HAS_USB | RBSPI_HAS_POE; - - /* differentiate the Powerbox from the hEX lite */ - else if (strstr(mips_get_machine_name(), "750P r2")) - flags |= RBSPI_HAS_POE; - - rbspi_952_750r2_setup(flags); -} - -/* - * Init the hAP ac / 962UiGS-5HacT2HnT hardware (QCA9558). - * The hAP ac has 5 ethernet ports provided by an AR8337 switch. Port 1 is - * assigned to WAN, ports 2-5 are assigned to LAN. Port 0 is connected to the - * SoC, ports 1-5 of the switch are connected to physical ports 1-5 in order. - * The SFP cage is not assigned by default on RouterOS. Extra work is required - * to support this interface as it is directly connected to the SoC (eth1). - * Wireless is provided by a 2.4GHz radio on the SoC (WLAN1) and a 5GHz radio - * attached via PCI (QCA9880). Red and green WLAN LEDs are populated however - * they are not attached to GPIOs, extra work is required to support these. - * PoE and USB output power control is supported. - */ -static void __init rb962_setup(void) -{ - u32 flags = RBSPI_HAS_USB | RBSPI_HAS_POE | RBSPI_HAS_PCI; - - if (!rbspi_platform_setup()) - return; - - rbspi_peripherals_setup(flags); - - /* Do not call rbspi_network_setup as we have a discrete switch chip */ - ath79_eth0_pll_data.pll_1000 = 0xae000000; - ath79_eth0_pll_data.pll_100 = 0xa0000101; - ath79_eth0_pll_data.pll_10 = 0xa0001313; - - ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(rb962_mdio0_info, - ARRAY_SIZE(rb962_mdio0_info)); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_register_eth(0); - - /* WLAN1 MAC is HW MAC + 7 */ - rbspi_wlan_init(1, 7); - - if (flags & RBSPI_HAS_USB) - gpio_request_one(RB962_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - /* PoE output GPIO is inverted, set GPIOF_ACTIVE_LOW for consistency */ - if (flags & RBSPI_HAS_POE) - gpio_request_one(RB962_GPIO_POE_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_ACTIVE_LOW | - GPIOF_EXPORT_DIR_FIXED, - "POE power"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rb962_leds_gpio), - rb962_leds_gpio); - - /* This device has a single reset button as gpio 20 */ - rbspi_register_reset_button(RB962_GPIO_BTN_RESET); -} - -/* - * Init the LHG hardware (AR9344). - * The LHG 5nD has a single ethernet port connected to PHY0. - * Wireless is provided via 5GHz WLAN1. - */ -static void __init rblhg_setup(void) -{ - u32 flags = RBSPI_HAS_WLAN1 | RBSPI_HAS_MDIO1; - - if (!rbspi_platform_setup()) - return; - - rbspi_peripherals_setup(flags); - - /* GMAC1 is HW MAC, WLAN1 MAC is HW MAC + 1 */ - rbspi_network_setup(flags, 0, 0, 1); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rblhg_leds), rblhg_leds); - - rbspi_register_reset_button(RBLHG_GPIO_BTN_RESET); -} - -/* - * Init the wAP hardware. - * The wAP 2nD has a single ethernet port. - */ -static void __init rbwap_setup(void) -{ - u32 flags = RBSPI_HAS_WLAN0; - - if (!rbspi_platform_setup()) - return; - - rbspi_peripherals_setup(flags); - - /* GMAC1 is HW MAC, WLAN0 MAC is HW MAC + 1 */ - rbspi_network_setup(flags, 0, 1, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rbwap_leds), rbwap_leds); - - /* wAP has a single reset button as GPIO 16 */ - rbspi_register_reset_button(RBWAP_GPIO_BTN_RESET); -} - -/* - * Init the cAP hardware (EXPERIMENTAL). - * The cAP 2nD has a single ethernet port, and a global LED switch. - */ -static void __init rbcap_setup(void) -{ - u32 flags = RBSPI_HAS_WLAN0; - - if (!rbspi_platform_setup()) - return; - - rbspi_peripherals_setup(flags); - - /* GMAC1 is HW MAC, WLAN0 MAC is HW MAC + 1 */ - rbspi_network_setup(flags, 0, 1, 0); - - gpio_request_one(RBCAP_GPIO_LED_ALL, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "LEDs enable"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rbcap_leds), rbcap_leds); -} - -/* - * Init the mAP hardware. - * The mAP 2nD has two ethernet ports, PoE output, SSR for LED - * multiplexing and USB port. - */ -static void __init rbmap_setup(void) -{ - u32 flags = RBSPI_HAS_USB | RBSPI_HAS_WLAN0 | - RBSPI_HAS_SSR | RBSPI_HAS_POE; - - if (!rbspi_platform_setup()) - return; - - rbspi_spi_cs_gpios[1] = RBMAP_GPIO_SSR_CS; - rbspi_peripherals_setup(flags); - - /* GMAC1 is HW MAC, WLAN0 MAC is HW MAC + 2 */ - rbspi_network_setup(flags, 0, 2, 0); - - if (flags & RBSPI_HAS_POE) - gpio_request_one(RBMAP_GPIO_POE_POWER, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "POE power"); - - /* USB power GPIO is inverted, set GPIOF_ACTIVE_LOW for consistency */ - if (flags & RBSPI_HAS_USB) - gpio_request_one(RBMAP_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_ACTIVE_LOW | - GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rbmap_leds), rbmap_leds); - - /* mAP 2nD has a single reset button as gpio 16 */ - rbspi_register_reset_button(RBMAP_GPIO_BTN_RESET); -} - -/* - * Init the wAPGSC (RB wAPG-5HacT2HnD // wAP AC) hardware. - * The wAPGSC has one Ethernet port via AR8033 with PoE input, dual radio (SoC - * 2.4 GHz and external QCA9880) and a ZT2046Q temperature and voltage sensor - * (currently not supported). - */ -static void __init rbwapgsc_setup(void) -{ - u32 flags = RBSPI_HAS_PCI; - - if (!rbspi_platform_setup()) - return; - - rbspi_peripherals_setup(flags); - - platform_device_register(&rbwapgsc_phy_device); - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0); - ath79_eth1_data.mii_bus_dev = &rbwapgsc_phy_device.dev; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.phy_mask = BIT(RBWAPGSC_MDIO_PHYADDR); - ath79_eth1_pll_data.pll_1000 = 0x03000101; - ath79_eth1_pll_data.pll_100 = 0x80000101; - ath79_eth1_pll_data.pll_10 = 0x80001313; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_register_eth(1); - - rbspi_wlan_init(1, 2); - - rbspi_register_reset_button(RBWAPGSC_GPIO_BTN_RESET); - - ath79_gpio_function_enable(QCA955X_GPIO_FUNC_JTAG_DISABLE| - QCA955X_GPIO_REG_OUT_FUNC4| - QCA955X_GPIO_REG_OUT_FUNC3); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rbwapgsc_leds), - rbwapgsc_leds); -} - -/* - * Setup the 911L hardware (AR9344). - */ -static void __init rb911l_setup(void) -{ - const struct rb_info *info; - - info = rbspi_platform_setup(); - if (!info) - return; - - if (!rb_has_hw_option(info, RB_HW_OPT_NO_NAND)) { - /* - * Old hardware revisions might be equipped with a NAND flash - * chip instead of the 16MiB SPI NOR device. Those boards are - * not supported at the moment, so throw a warning and skip - * the peripheral setup to avoid messing up the data in the - * flash chip. - */ - WARN(1, "The NAND flash on this board is not supported.\n"); - } else { - rbspi_peripherals_setup(0); - } - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0); - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); - - rbspi_wlan_init(0, 1); - - rbspi_register_reset_button(RB911L_GPIO_BTN_RESET); - - /* Make the eth LED controllable by software. */ - ath79_gpio_output_select(RB911L_GPIO_LED_ETH, AR934X_GPIO_OUT_GPIO); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rb911l_leds), rb911l_leds); -} - -MIPS_MACHINE_NONAME(ATH79_MACH_RB_MAPL, "map-hb", rbmapl_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_941, "H951L", rbhapl_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_911L, "911L", rb911l_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_952, "952-hb", rb952_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_962, "962", rb962_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_750UPR2, "750-hb", rb750upr2_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_LHG5, "lhg", rblhg_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_WAP, "wap-hb", rbwap_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_CAP, "cap-hb", rbcap_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_MAP, "map2-hb", rbmap_setup); -MIPS_MACHINE_NONAME(ATH79_MACH_RB_WAPAC, "wapg-sc", rbwapgsc_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc1750.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc1750.c deleted file mode 100644 index f8eab9734..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc1750.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Abicom International Scorpion SC1750 support. - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * Copyright (c) 2017 Conor O'Gorman - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define SC1750_GPIO_LED_POWER 11 -#define SC1750_GPIO_LED_ERR1 12 -#define SC1750_GPIO_LED_WLAN 13 -#define SC1750_GPIO_LED_ERR2 14 -#define SC1750_GPIO_LED_OK3 15 -#define SC1750_GPIO_LED_ERR3 16 -#define SC1750_GPIO_BTN_RESET 4 - -#define SC1750_KEYS_POLL_INTERVAL 20 /* msecs */ -#define SC1750_KEYS_DEBOUNCE_INTERVAL (3 * SC1750_KEYS_POLL_INTERVAL) - -#define SC1750_MAC0_OFFSET 0 -#define SC1750_MAC1_OFFSET 6 -#define SC1750_WMAC_CALDATA_OFFSET 0x1000 -#define SC1750_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led sc1750_leds_gpio[] __initdata = { - { - .name = "sc1750:green:power", - .gpio = SC1750_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "sc1750:red:power", - .gpio = SC1750_GPIO_LED_ERR1, - .active_low = 1, - }, - { - .name = "sc1750:green:wlan", - .gpio = SC1750_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "sc1750:red:wlan", - .gpio = SC1750_GPIO_LED_ERR2, - .active_low = 1, - } -}; - -static struct gpio_keys_button sc1750_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = SC1750_KEYS_DEBOUNCE_INTERVAL, - .gpio = SC1750_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static struct at803x_platform_data at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 0, - .enable_rgmii_tx_delay = 0, -}; - -static struct mdio_board_info sc1750_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "sc1750", - .mdio_addr = 1, - .platform_data = &at803x_data, - }, -}; - -static void __init sc1750_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(sc1750_leds_gpio), - sc1750_leds_gpio); - ath79_register_gpio_keys_polled(-1, SC1750_KEYS_POLL_INTERVAL, - ARRAY_SIZE(sc1750_gpio_keys), - sc1750_gpio_keys); - - ath79_register_usb(); - ath79_register_nfc(); - - ath79_register_wmac(art + SC1750_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_mdio(0, 0); - mdiobus_register_board_info(sc1750_mdio0_info, - ARRAY_SIZE(sc1750_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + SC1750_MAC0_OFFSET, 0); - - ath79_eth0_pll_data.pll_1000 = 0xa6000101; - ath79_eth0_pll_data.pll_100 = 0xa4000101; - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = 0xF; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_SC1750, "SC1750", "Abicom SC1750", sc1750_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc300m.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc300m.c deleted file mode 100644 index f9013e3b9..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc300m.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Abicom International Scorpion SC300M Module support. - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * Copyright (c) 2017 Conor O'Gorman - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define SC300M_GPIO_LED_WLAN 0 -#define SC300M_GPIO_LED_POWER 1 - -#define SC300M_GPIO_BTN_RESET 17 - -#define SC300M_KEYS_POLL_INTERVAL 20 /* msecs */ -#define SC300M_KEYS_DEBOUNCE_INTERVAL (3 * SC300M_KEYS_POLL_INTERVAL) - -#define SC300M_MAC0_OFFSET 0 -#define SC300M_MAC1_OFFSET 6 -#define SC300M_WMAC_CALDATA_OFFSET 0x1000 -#define SC300M_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led sc300m_leds_gpio[] __initdata = { - { - .name = "sc300m:blue:wlan", - .gpio = SC300M_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "sc300m:blue:power", - .gpio = SC300M_GPIO_LED_POWER, - .active_low = 1, - } -}; - -static struct gpio_keys_button sc300m_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = SC300M_KEYS_DEBOUNCE_INTERVAL, - .gpio = SC300M_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct at803x_platform_data at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 0, - .enable_rgmii_tx_delay = 0, -}; - -static struct mdio_board_info sc300m_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "sc300m", - .mdio_addr = 1, - .platform_data = &at803x_data, - }, -}; - -static void __init sc300m_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(sc300m_leds_gpio), - sc300m_leds_gpio); - ath79_register_gpio_keys_polled(-1, SC300M_KEYS_POLL_INTERVAL, - ARRAY_SIZE(sc300m_gpio_keys), - sc300m_gpio_keys); - - ath79_register_usb(); - ath79_register_nfc(); - - ath79_register_wmac(art + SC300M_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_mdio(0, 0); - mdiobus_register_board_info(sc300m_mdio0_info, - ARRAY_SIZE(sc300m_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + SC300M_MAC0_OFFSET, 0); - - ath79_eth0_pll_data.pll_1000 = 0xa6000101; - ath79_eth0_pll_data.pll_100 = 0xa4000101; - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = 0xF; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_SC300M, "SC300M", "Abicom SC300M", sc300m_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc450.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc450.c deleted file mode 100644 index f45abc6a6..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sc450.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Abicom International Scorpion SC450 support. - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * Copyright (c) 2017 Conor O'Gorman - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define SC450_GPIO_LED_POWER 13 -#define SC450_GPIO_LED_ERR1 14 -#define SC450_GPIO_LED_ERR2 15 -#define SC450_GPIO_LED_WLAN 16 -#define SC450_GPIO_BTN_RESET 17 -#define SC450_GPIO_WP 18 -#define SC450_GPIO_POE 19 -#define SC450_GPIO_RX_LOS 20 -#define SC450_GPIO_MOD_GND 21 -#define SC450_GPIO_MOD_SCL 22 -#define SC450_GPIO_MOD_SDA 23 - -#define SC450_KEYS_POLL_INTERVAL 20 /* msecs */ -#define SC450_KEYS_DEBOUNCE_INTERVAL (3 * SC450_KEYS_POLL_INTERVAL) - -#define SC450_MAC0_OFFSET 0 -#define SC450_MAC1_OFFSET 6 -#define SC450_WMAC_CALDATA_OFFSET 0x1000 -#define SC450_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led sc450_leds_gpio[] __initdata = { - { - .name = "sc450:green:power", - .gpio = SC450_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "sc450:red:power", - .gpio = SC450_GPIO_LED_ERR1, - .active_low = 1, - }, - { - .name = "sc450:green:wlan", - .gpio = SC450_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "sc450:red:wlan", - .gpio = SC450_GPIO_LED_ERR2, - .active_low = 1, - } -}; - -static struct gpio_keys_button sc450_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = SC450_KEYS_DEBOUNCE_INTERVAL, - .gpio = SC450_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct at803x_platform_data at803x_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 0, - .enable_rgmii_tx_delay = 0, -}; - -static struct mdio_board_info sc450_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "sc450", - .mdio_addr = 1, - .platform_data = &at803x_data, - }, -}; - -static void __init sc450_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(sc450_leds_gpio), - sc450_leds_gpio); - ath79_register_gpio_keys_polled(-1, SC450_KEYS_POLL_INTERVAL, - ARRAY_SIZE(sc450_gpio_keys), - sc450_gpio_keys); - - ath79_register_usb(); - ath79_register_nfc(); - - ath79_register_wmac(art + SC450_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_mdio(0, 0); - mdiobus_register_board_info(sc450_mdio0_info, - ARRAY_SIZE(sc450_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + SC450_MAC0_OFFSET, 0); - - ath79_eth0_pll_data.pll_1000 = 0xa6000101; - ath79_eth0_pll_data.pll_100 = 0xa4000101; - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = 0xF; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_SC450, "SC450", "Abicom SC450", sc450_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sr3200.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sr3200.c deleted file mode 100644 index b59f65d9f..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-sr3200.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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", - .modalias = "sr3200_xd3200", - .mdio_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-4.14/arch/mips/ath79/mach-tew-823dru.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-823dru.c deleted file mode 100644 index 480811f44..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-823dru.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * TRENDnet TEW-823DRU board support - * - * Copyright (C) 2015 Cezary Jackiewicz - * Copyright (C) 2014 Gabor Juhos - * Copyright (C) 2014 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 "common.h" -#include "pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TEW_823DRU_GPIO_LED_POWER_ORANGE 14 -#define TEW_823DRU_GPIO_LED_POWER_GREEN 19 -#define TEW_823DRU_GPIO_LED_PLANET_GREEN 22 -#define TEW_823DRU_GPIO_LED_PLANET_ORANGE 23 - -#define TEW_823DRU_GPIO_BTN_WPS 16 -#define TEW_823DRU_GPIO_BTN_RESET 17 - -#define TEW_823DRU_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TEW_823DRU_KEYS_DEBOUNCE_INTERVAL \ - (3 * TEW_823DRU_KEYS_POLL_INTERVAL) - -#define TEW_823DRU_WMAC_CALDATA_OFFSET 0x1000 - -#define TEW_823DRU_LAN_MAC_OFFSET 0x04 -#define TEW_823DRU_WAN_MAC_OFFSET 0x18 - -static struct gpio_led tew_823dru_leds_gpio[] __initdata = { - { - .name = "trendnet:green:power", - .gpio = TEW_823DRU_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, - { - .name = "trendnet:orange:power", - .gpio = TEW_823DRU_GPIO_LED_POWER_ORANGE, - .active_low = 1, - }, - { - .name = "trendnet:green:planet", - .gpio = TEW_823DRU_GPIO_LED_PLANET_GREEN, - .active_low = 1, - }, - { - .name = "trendnet:orange:planet", - .gpio = TEW_823DRU_GPIO_LED_PLANET_ORANGE, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tew_823dru_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TEW_823DRU_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW_823DRU_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TEW_823DRU_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW_823DRU_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -/* GMAC0 of the AR8327 switch is connected to the QCA9558 SoC via SGMII */ -static struct ar8327_pad_cfg tew_823dru_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -/* GMAC6 of the AR8327 switch is connected to the QCA9558 SoC via RGMII */ -static struct ar8327_pad_cfg tew_823dru_ar8327_pad6_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data tew_823dru_ar8327_data = { - .pad0_cfg = &tew_823dru_ar8327_pad0_cfg, - .pad6_cfg = &tew_823dru_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info tew_823dru_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "tew_823dru", - .mdio_addr = 0, - .platform_data = &tew_823dru_ar8327_data, - }, -}; - -static void __init tew_823dru_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1ffe0000); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 lan_mac[ETH_ALEN]; - u8 wan_mac[ETH_ALEN]; - - ath79_parse_ascii_mac(mac + TEW_823DRU_LAN_MAC_OFFSET, lan_mac); - ath79_parse_ascii_mac(mac + TEW_823DRU_WAN_MAC_OFFSET, wan_mac); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tew_823dru_leds_gpio), - tew_823dru_leds_gpio); - ath79_register_gpio_keys_polled(-1, TEW_823DRU_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tew_823dru_gpio_keys), - tew_823dru_gpio_keys); - - ath79_register_wmac(art + TEW_823DRU_WMAC_CALDATA_OFFSET, lan_mac); - - ath79_init_mac(ath79_eth1_data.mac_addr, lan_mac, 0); - ath79_init_mac(ath79_eth0_data.mac_addr, wan_mac, 0); - - - mdiobus_register_board_info(tew_823dru_mdio0_info, - ARRAY_SIZE(tew_823dru_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x56000000; - - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_register_eth(1); - - ath79_register_usb(); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_TEW_823DRU, "TEW-823DRU", "TRENDnet TEW-823DRU", - tew_823dru_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr4300.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr4300.c deleted file mode 100644 index 88780ae02..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr4300.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * TP-LINK TL-WDR4300 board 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 - -#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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WDR4300_GPIO_LED_USB1 11 -#define WDR4300_GPIO_LED_USB2 12 -#define WDR4300_GPIO_LED_WLAN2G 13 -#define WDR4300_GPIO_LED_SYSTEM 14 -#define WDR4300_GPIO_LED_QSS 15 - -#define WDR4300_GPIO_BTN_WPS 16 -#define WDR4300_GPIO_BTN_RFKILL 17 - -#define WDR4300_GPIO_EXTERNAL_LNA0 18 -#define WDR4300_GPIO_EXTERNAL_LNA1 19 - -#define WDR4300_GPIO_USB1_POWER 22 -#define WDR4300_GPIO_USB2_POWER 21 - -#define WDR4300_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WDR4300_KEYS_DEBOUNCE_INTERVAL (3 * WDR4300_KEYS_POLL_INTERVAL) - -#define WDR4300_MAC0_OFFSET 0 -#define WDR4300_MAC1_OFFSET 6 -#define WDR4300_WMAC_CALDATA_OFFSET 0x1000 -#define WDR4300_PCIE_CALDATA_OFFSET 0x5000 - -static const char *wdr4300_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data wdr4300_flash_data = { - .part_probes = wdr4300_part_probes, -}; - -static struct gpio_led wdr4300_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:qss", - .gpio = WDR4300_GPIO_LED_QSS, - .active_low = 1, - }, - { - .name = "tp-link:blue:system", - .gpio = WDR4300_GPIO_LED_SYSTEM, - .active_low = 1, - }, - { - .name = "tp-link:green:usb1", - .gpio = WDR4300_GPIO_LED_USB1, - .active_low = 1, - }, - { - .name = "tp-link:green:usb2", - .gpio = WDR4300_GPIO_LED_USB2, - .active_low = 1, - }, - { - .name = "tp-link:blue:wlan2g", - .gpio = WDR4300_GPIO_LED_WLAN2G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wdr4300_gpio_keys[] __initdata = { - { - .desc = "QSS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WDR4300_KEYS_DEBOUNCE_INTERVAL, - .gpio = WDR4300_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "RFKILL switch", - .type = EV_SW, - .code = KEY_RFKILL, - .debounce_interval = WDR4300_KEYS_DEBOUNCE_INTERVAL, - .gpio = WDR4300_GPIO_BTN_RFKILL, - .active_low = 1, - }, -}; - -static const struct ar8327_led_info wdr4300_leds_ar8327[] = { - AR8327_LED_INFO(PHY0_0, HW, "tp-link:blue:wan"), - AR8327_LED_INFO(PHY1_0, HW, "tp-link:blue:lan1"), - AR8327_LED_INFO(PHY2_0, HW, "tp-link:blue:lan2"), - AR8327_LED_INFO(PHY3_0, HW, "tp-link:blue:lan3"), - AR8327_LED_INFO(PHY4_0, HW, "tp-link:blue:lan4"), -}; - -static struct ar8327_pad_cfg wdr4300_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg wdr4300_ar8327_led_cfg = { - .led_ctrl0 = 0xc737c737, - .led_ctrl1 = 0x00000000, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x0030c300, - .open_drain = false, -}; - -static struct ar8327_platform_data wdr4300_ar8327_data = { - .pad0_cfg = &wdr4300_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &wdr4300_ar8327_led_cfg, - .num_leds = ARRAY_SIZE(wdr4300_leds_ar8327), - .leds = wdr4300_leds_ar8327, -}; - -static struct mdio_board_info wdr4300_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "wdr4300", - .mdio_addr = 0, - .platform_data = &wdr4300_ar8327_data, - }, -}; - -static void __init wdr4300_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&wdr4300_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(wdr4300_leds_gpio), - wdr4300_leds_gpio); - ath79_register_gpio_keys_polled(-1, WDR4300_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wdr4300_gpio_keys), - wdr4300_gpio_keys); - - ath79_wmac_set_ext_lna_gpio(0, WDR4300_GPIO_EXTERNAL_LNA0); - ath79_wmac_set_ext_lna_gpio(1, WDR4300_GPIO_EXTERNAL_LNA1); - - ath79_init_mac(tmpmac, mac, -1); - ath79_register_wmac(art + WDR4300_WMAC_CALDATA_OFFSET, tmpmac); - - ath79_init_mac(tmpmac, mac, 0); - ap9x_pci_setup_wmac_led_pin(0, 0); - ap91_pci_init(art + WDR4300_PCIE_CALDATA_OFFSET, tmpmac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - mdiobus_register_board_info(wdr4300_mdio0_info, - ARRAY_SIZE(wdr4300_mdio0_info)); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -2); - - /* GMAC0 is connected to an AR8327N switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); - - gpio_request_one(WDR4300_GPIO_USB1_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB1 power"); - gpio_request_one(WDR4300_GPIO_USB2_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB2 power"); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_TL_WDR4300, "TL-WDR4300", - "TP-LINK TL-WDR3600/4300/4310", - wdr4300_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wpa8630.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wpa8630.c deleted file mode 100644 index b3907d9bf..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wpa8630.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * TP-Link TL-WPA8630 board support - * - * Copyright (C) 2016 Henryk Heisig - * - * 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-m25p80.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-wmac.h" - -#define TL_WPA8630_KEYS_POLL_INTERVAL 20 -#define TL_WPA8630_KEYS_DEBOUNCE_INTERVAL (3 * TL_WPA8630_KEYS_POLL_INTERVAL) - -#define TL_WPA8630_GPIO_LED_POWER 1 -#define TL_WPA8630_GPIO_LED_LAN 5 -#define TL_WPA8630_GPIO_LED_WLAN 19 -#define TL_WPA8630_GPIO_LED_WLAN5 21 - -#define TL_WPA8630_GPIO_BTN_RESET 2 -#define TL_WPA8630_GPIO_BTN_RFKILL 8 -#define TL_WPA8630_GPIO_BTN_LED 6 -#define TL_WPA8630_GPIO_BTN_PAIR 7 - -#define TL_WPA8630_MAC0_OFFSET 0x0000 -#define TL_WPA8630_WMAC_CALDATA_OFFSET 0x1000 -#define TL_WPA8630_PCI_CALDATA_OFFSET 0x5000 - -static const char *tl_wpa8630_part_probes[] = { - "tp-link-64k", - NULL, -}; - -static struct flash_platform_data tl_wpa8630_flash_data = { - .part_probes = tl_wpa8630_part_probes, - .type = "s25fl064k", -}; - -static struct gpio_led tl_wpa8630_leds_gpio[] __initdata = { - { - .name = "tl-wpa8630:green:power", - .gpio = TL_WPA8630_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "tl-wpa8630:green:lan", - .gpio = TL_WPA8630_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "tl-wpa8630:green:wlan", - .gpio = TL_WPA8630_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "tl-wpa8630:green:wlan5", - .gpio = TL_WPA8630_GPIO_LED_WLAN5, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wpa8630_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WPA8630_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WPA8630_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WPA8630_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WPA8630_GPIO_BTN_RFKILL, - .active_low = 1, - }, - { - .desc = "LED", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = TL_WPA8630_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WPA8630_GPIO_BTN_LED, - .active_low = 1, - }, - { - .desc = "Pair", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = TL_WPA8630_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WPA8630_GPIO_BTN_PAIR, - .active_low = 1, - }, -}; - -/* GMAC0 of the QCA8337 switch is connected to the QCA9563 SoC via SGMII */ -static struct ar8327_pad_cfg tl_wpa8630_qca8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data tl_wpa8630_qca8337_data = { - .pad0_cfg = &tl_wpa8630_qca8337_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info tl_wpa8630_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "tl_wpa8630", - .mdio_addr = 0, - .platform_data = &tl_wpa8630_qca8337_data, - }, -}; - -static void __init tl_wpa8630_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f00fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&tl_wpa8630_flash_data); - - ath79_init_mac(ath79_eth0_data.mac_addr, - art + TL_WPA8630_MAC0_OFFSET, 0); - - platform_device_register(&ath79_mdio0_device); - - mdiobus_register_board_info(tl_wpa8630_mdio0_info, - ARRAY_SIZE(tl_wpa8630_mdio0_info)); - - /* GMAC0 is connected to an AR8337 switch */ - 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(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - ath79_register_eth(0); - - ath79_register_wmac(art + TL_WPA8630_WMAC_CALDATA_OFFSET, mac); - - ap91_pci_init(art + TL_WPA8630_PCI_CALDATA_OFFSET, NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wpa8630_leds_gpio), - tl_wpa8630_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WPA8630_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wpa8630_gpio_keys), - tl_wpa8630_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WPA8630, "TL-WPA8630", "TP-LINK TL-WPA8630", - tl_wpa8630_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1041n-v2.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1041n-v2.c deleted file mode 100644 index a69963110..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1041n-v2.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * TP-LINK TL-WR1041 v2 board support - * - * Copyright (C) 2010-2012 Gabor Juhos - * Copyright (C) 2011-2012 Anan Huang - * - * 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-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TL_WR1041NV2_GPIO_BTN_RESET 14 -#define TL_WR1041NV2_GPIO_LED_WPS 13 -#define TL_WR1041NV2_GPIO_LED_WLAN 11 - -#define TL_WR1041NV2_GPIO_LED_SYSTEM 12 - -#define TL_WR1041NV2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR1041NV2_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR1041NV2_KEYS_POLL_INTERVAL) - -#define TL_WR1041NV2_PCIE_CALDATA_OFFSET 0x5000 - -static const char *tl_wr1041nv2_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr1041nv2_flash_data = { - .part_probes = tl_wr1041nv2_part_probes, -}; - -static struct gpio_led tl_wr1041nv2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:system", - .gpio = TL_WR1041NV2_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:wps", - .gpio = TL_WR1041NV2_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR1041NV2_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_wr1041nv2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR1041NV2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR1041NV2_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static const struct ar8327_led_info tl_wr1041n_leds_ar8327[] = { - AR8327_LED_INFO(PHY0_0, HW, "tp-link:green:wan"), - AR8327_LED_INFO(PHY1_0, HW, "tp-link:green:lan1"), - AR8327_LED_INFO(PHY2_0, HW, "tp-link:green:lan2"), - AR8327_LED_INFO(PHY3_0, HW, "tp-link:green:lan3"), - AR8327_LED_INFO(PHY4_0, HW, "tp-link:green:lan4"), -}; - -static struct ar8327_led_cfg wr1041n_v2_ar8327_led_cfg = { - .led_ctrl0 = 0xcf35cf35, /* LED0: blink at 10/100/1000M */ - .led_ctrl1 = 0xcf35cf35, /* LED1: blink at 10/100/1000M: anyway, no LED1 on tl-wr1041n */ - .led_ctrl2 = 0xcf35cf35, /* LED2: blink at 10/100/1000M: anyway, no LED2 on tl-wr1041n */ - .led_ctrl3 = 0x03ffff00, /* Pattern enabled for LED 0-2 of port 1-3 */ - .open_drain = true, -}; - -static struct ar8327_pad_cfg db120_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data db120_ar8327_data = { - .pad0_cfg = &db120_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &wr1041n_v2_ar8327_led_cfg, - .num_leds = ARRAY_SIZE(tl_wr1041n_leds_ar8327), - .leds = tl_wr1041n_leds_ar8327 -}; - -static struct mdio_board_info db120_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "tl_wr1041nv2", - .mdio_addr = 0, - .platform_data = &db120_ar8327_data, - }, -}; - -static void __init tl_wr1041nv2_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&tl_wr1041nv2_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1041nv2_leds_gpio), - tl_wr1041nv2_leds_gpio); - ath79_register_gpio_keys_polled(-1, TL_WR1041NV2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr1041nv2_gpio_keys), - tl_wr1041nv2_gpio_keys); - ath79_register_wmac(ee, mac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - - mdiobus_register_board_info(db120_mdio0_info, - ARRAY_SIZE(db120_mdio0_info)); - - /* GMAC0 is connected to an AR8327 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR1041N_V2, "TL-WR1041N-v2", - "TP-LINK TL-WR1041N v2", tl_wr1041nv2_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd-v2.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd-v2.c deleted file mode 100644 index 319225e09..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd-v2.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * TP-LINK TL-WR1043ND v2 board support - * - * Copyright (c) 2013 Gabor Juhos - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TL_WR1043_V2_GPIO_LED_WLAN 12 -#define TL_WR1043_V2_GPIO_LED_USB 15 -#define TL_WR1043_V2_GPIO_LED_WPS 18 -#define TL_WR1043_V2_GPIO_LED_SYSTEM 19 - -#define TL_WR1043_V2_GPIO_BTN_RESET 16 -#define TL_WR1043_V2_GPIO_BTN_RFKILL 17 - -#define TL_WR1043_V2_GPIO_USB_POWER 21 - -#define TL_WR1043_V2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR1043_V2_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR1043_V2_KEYS_POLL_INTERVAL) - -#define TL_WR1043_V2_WMAC_CALDATA_OFFSET 0x1000 - -static const char *wr1043nd_v2_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data wr1043nd_v2_flash_data = { - .part_probes = wr1043nd_v2_part_probes, -}; - -static struct gpio_led tl_wr1043_v2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:wps", - .gpio = TL_WR1043_V2_GPIO_LED_WPS, - .active_low = 1, - }, - { - .name = "tp-link:green:system", - .gpio = TL_WR1043_V2_GPIO_LED_SYSTEM, - .active_low = 1, - }, - { - .name = "tp-link:green:wlan", - .gpio = TL_WR1043_V2_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "tp-link:green:usb", - .gpio = TL_WR1043_V2_GPIO_LED_USB, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr1043_v2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR1043_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR1043_V2_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WR1043_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR1043_V2_GPIO_BTN_RFKILL, - .active_low = 1, - }, -}; - -static const struct ar8327_led_info tl_wr1043_leds_ar8327[] = { - AR8327_LED_INFO(PHY0_0, HW, "tp-link:green:lan4"), - AR8327_LED_INFO(PHY1_0, HW, "tp-link:green:lan3"), - AR8327_LED_INFO(PHY2_0, HW, "tp-link:green:lan2"), - AR8327_LED_INFO(PHY3_0, HW, "tp-link:green:lan1"), - AR8327_LED_INFO(PHY4_0, HW, "tp-link:green:wan"), -}; - -/* GMAC0 of the AR8327 switch is connected to the QCA9558 SoC via SGMII */ -static struct ar8327_pad_cfg wr1043nd_v2_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -/* GMAC6 of the AR8327 switch is connected to the QCA9558 SoC via RGMII */ -static struct ar8327_pad_cfg wr1043nd_v2_ar8327_pad6_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg wr1043nd_v2_ar8327_led_cfg = { - .led_ctrl0 = 0xcc35cc35, - .led_ctrl1 = 0xca35ca35, - .led_ctrl2 = 0xc935c935, - .led_ctrl3 = 0x03ffff00, - .open_drain = true, -}; - -static struct ar8327_platform_data wr1043nd_v2_ar8327_data = { - .pad0_cfg = &wr1043nd_v2_ar8327_pad0_cfg, - .pad6_cfg = &wr1043nd_v2_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &wr1043nd_v2_ar8327_led_cfg, - .num_leds = ARRAY_SIZE(tl_wr1043_leds_ar8327), - .leds = tl_wr1043_leds_ar8327, -}; - -static struct mdio_board_info wr1043nd_v2_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "tl_wr1043_v2", - .mdio_addr = 0, - .platform_data = &wr1043nd_v2_ar8327_data, - }, -}; - -static void __init tl_wr1043nd_v2_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&wr1043nd_v2_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043_v2_leds_gpio), - tl_wr1043_v2_leds_gpio); - ath79_register_gpio_keys_polled(-1, TL_WR1043_V2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr1043_v2_gpio_keys), - tl_wr1043_v2_gpio_keys); - - ath79_register_wmac(art + TL_WR1043_V2_WMAC_CALDATA_OFFSET, mac); - - mdiobus_register_board_info(wr1043nd_v2_mdio0_info, - ARRAY_SIZE(wr1043nd_v2_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x56000000; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_eth(1); - - ath79_register_usb(); - - gpio_request_one(TL_WR1043_V2_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR1043ND_V2, "TL-WR1043ND-v2", - "TP-LINK TL-WR1043ND v2", tl_wr1043nd_v2_setup); - diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd-v4.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd-v4.c deleted file mode 100644 index 2b1c755a0..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd-v4.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * 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 - * Copyright (C) 2017 Tim Thorpe - * - * 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 0x1ff50008 - -#define TL_WR1043_V4_EEPROM_ADDR 0x1fff0000 -#define TL_WR1043_V4_WMAC_CALDATA_OFFSET 0x1000 - -#define TL_WR1043N_V5_MAC_LOCATION 0x1ff00008 - -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", - .modalias = "tl_wr1043nd_v4", - .mdio_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); - -static struct gpio_led tl_wr1043n_v5_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: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, - }, -}; - -/* The 1043Nv5 is identical to the 1043NDv4, - * only missing the usb and small firmware layout changes */ -static void __init tl_wr1043nv5_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(TL_WR1043_V4_EEPROM_ADDR); - u8 *mac = (u8 *) KSEG1ADDR(TL_WR1043N_V5_MAC_LOCATION); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043n_v5_leds_gpio), - tl_wr1043n_v5_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); - - platform_device_register(&ath79_mdio0_device); - - mdiobus_register_board_info(tl_wr1043nd_v4_mdio0_info, - ARRAY_SIZE(tl_wr1043nd_v4_mdio0_info)); - - ath79_register_wmac(art + TL_WR1043_V4_WMAC_CALDATA_OFFSET, mac); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - /* GMAC0 is connected to an AR8337 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR1043N_V5, "TL-WR1043N-v5", "TP-LINK TL-WR1043N v5", - tl_wr1043nv5_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt-unifiac.c deleted file mode 100644 index 17efb7561..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt-unifiac.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Ubiquiti UniFi AC (LITE) board support - * - * Copyright (C) 2015-2016 P. Wassi - * - * Derived from: mach-ubnt-xm.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" - - -#define UNIFIAC_KEYS_POLL_INTERVAL 20 -#define UNIFIAC_KEYS_DEBOUNCE_INTERVAL (3 * UNIFIAC_KEYS_POLL_INTERVAL) - -#define UNIFIAC_GPIO_LED_WHITE 7 -#define UNIFIAC_GPIO_LED_BLUE 8 - -#define UNIFIAC_GPIO_BTN_RESET 2 - -#define UNIFIAC_MAC0_OFFSET 0x0000 -#define UNIFIAC_WMAC_CALDATA_OFFSET 0x1000 -#define UNIFIAC_PCI_CALDATA_OFFSET 0x5000 - - -static struct flash_platform_data ubnt_unifiac_flash_data = { - /* mx25l12805d and mx25l12835f have the same JEDEC ID */ - .type = "mx25l12805d", -}; - -static struct gpio_led ubnt_unifiac_leds_gpio[] __initdata = { - { - .name = "ubnt:white:dome", - .gpio = UNIFIAC_GPIO_LED_WHITE, - .active_low = 0, - }, { - .name = "ubnt:blue:dome", - .gpio = UNIFIAC_GPIO_LED_BLUE, - .active_low = 0, - } -}; - -static struct gpio_keys_button ubnt_unifiac_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = UNIFIAC_KEYS_DEBOUNCE_INTERVAL, - .gpio = UNIFIAC_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init ubnt_unifiac_lite_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&ubnt_unifiac_flash_data); - - - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + UNIFIAC_MAC0_OFFSET, 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(4); - ath79_eth0_pll_data.pll_10 = 0x00001313; - - ath79_register_mdio(0, ~BIT(4)); - ath79_register_eth(0); - - - ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL); - - - ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL); - - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), - ubnt_unifiac_leds_gpio); - - ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_unifiac_gpio_keys), - ubnt_unifiac_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_LITE, "UBNT-UF-AC-LITE", - "Ubiquiti UniFi-AC-LITE/MESH", ubnt_unifiac_lite_setup); - -static struct ar8327_pad_cfg ubnt_unifiac_pro_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data ubnt_unifiac_pro_ar8327_data = { - .pad0_cfg = &ubnt_unifiac_pro_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - - -static struct mdio_board_info ubnt_unifiac_pro_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "ubnt_unifiac_pro", - .mdio_addr = 0, - .platform_data = &ubnt_unifiac_pro_ar8327_data, - }, -}; - -static void __init ubnt_unifiac_pro_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&ubnt_unifiac_flash_data); - - - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + UNIFIAC_MAC0_OFFSET, 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(ubnt_unifiac_pro_mdio0_info, - ARRAY_SIZE(ubnt_unifiac_pro_mdio0_info)); - - ath79_register_mdio(0, 0x00); - ath79_register_eth(0); - - - ath79_register_usb(); - - - ath79_register_wmac(eeprom + UNIFIAC_WMAC_CALDATA_OFFSET, NULL); - - - ap91_pci_init(eeprom + UNIFIAC_PCI_CALDATA_OFFSET, NULL); - - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifiac_leds_gpio), - ubnt_unifiac_leds_gpio); - - ath79_register_gpio_keys_polled(-1, UNIFIAC_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_unifiac_gpio_keys), - ubnt_unifiac_gpio_keys); -} - - -MIPS_MACHINE(ATH79_MACH_UBNT_UNIFIAC_PRO, "UBNT-UF-AC-PRO", - "Ubiquiti UniFi-AC-PRO", ubnt_unifiac_pro_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt-xm.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt-xm.c deleted file mode 100644 index b21f07b83..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt-xm.c +++ /dev/null @@ -1,781 +0,0 @@ -/* - * Ubiquiti Networks XM (rev 1.0) board support - * - * Copyright (C) 2011 René Bolldorf - * - * Derived from: mach-pb44.c - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#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-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define UBNT_XM_GPIO_LED_L1 0 -#define UBNT_XM_GPIO_LED_L2 1 -#define UBNT_XM_GPIO_LED_L3 11 -#define UBNT_XM_GPIO_LED_L4 7 - -#define UBNT_XM_GPIO_BTN_RESET 12 - -#define UBNT_XM_KEYS_POLL_INTERVAL 20 -#define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL) - -#define UBNT_XM_EEPROM_ADDR 0x1fff1000 - -static struct gpio_led ubnt_xm_leds_gpio[] __initdata = { - { - .name = "ubnt:red:link1", - .gpio = UBNT_XM_GPIO_LED_L1, - .active_low = 0, - }, { - .name = "ubnt:orange:link2", - .gpio = UBNT_XM_GPIO_LED_L2, - .active_low = 0, - }, { - .name = "ubnt:green:link3", - .gpio = UBNT_XM_GPIO_LED_L3, - .active_low = 0, - }, { - .name = "ubnt:green:link4", - .gpio = UBNT_XM_GPIO_LED_L4, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ubnt_xm_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, - .gpio = UBNT_XM_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -#define UBNT_M_WAN_PHYMASK BIT(4) - -static void __init ubnt_xm_init(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(UBNT_XM_EEPROM_ADDR); - u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio), - ubnt_xm_leds_gpio); - - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); - - ath79_register_m25p80(NULL); - ap91_pci_init(eeprom, NULL); - - ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_eth1_data.speed = SPEED_100; - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_XM, - "UBNT-XM", - "Ubiquiti Networks XM (rev 1.0) board", - ubnt_xm_init); - -MIPS_MACHINE(ATH79_MACH_UBNT_BULLET_M, "UBNT-BM", "Ubiquiti Bullet M", - ubnt_xm_init); - -static void __init ubnt_rocket_m_setup(void) -{ - ubnt_xm_init(); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M, "UBNT-RM", "Ubiquiti Rocket M", - ubnt_rocket_m_setup); - -static void __init ubnt_nano_m_setup(void) -{ - ubnt_xm_init(); - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M, "UBNT-NM", "Ubiquiti Nanostation M", - ubnt_nano_m_setup); - -static struct gpio_led ubnt_airrouter_leds_gpio[] __initdata = { - { - .name = "ubnt:green:globe", - .gpio = 0, - .active_low = 1, - }, { - .name = "ubnt:green:power", - .gpio = 11, - .active_low = 1, - .default_state = LEDS_GPIO_DEFSTATE_ON, - } -}; - -static void __init ubnt_airrouter_setup(void) -{ - u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(NULL); - ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_local_mac(ath79_eth1_data.mac_addr, mac1); - - ath79_register_eth(1); - ath79_register_eth(0); - ath79_register_usb(); - - ap91_pci_init(ee, NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airrouter_leds_gpio), - ubnt_airrouter_leds_gpio); - - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_AIRROUTER, "UBNT-AR", "Ubiquiti AirRouter", - ubnt_airrouter_setup); - -static struct gpio_led ubnt_unifi_leds_gpio[] __initdata = { - { - .name = "ubnt:orange:dome", - .gpio = 1, - .active_low = 0, - }, { - .name = "ubnt:green:dome", - .gpio = 0, - .active_low = 0, - } -}; - -static struct gpio_led ubnt_unifi_outdoor_leds_gpio[] __initdata = { - { - .name = "ubnt:orange:front", - .gpio = 1, - .active_low = 0, - }, { - .name = "ubnt:green:front", - .gpio = 0, - .active_low = 0, - } -}; - -static struct gpio_led ubnt_unifi_outdoor_plus_leds_gpio[] __initdata = { - { - .name = "ubnt:white:front", - .gpio = 1, - .active_low = 0, - }, { - .name = "ubnt:blue:front", - .gpio = 0, - .active_low = 0, - } -}; - - -static void __init ubnt_unifi_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(0, ~UBNT_M_WAN_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); - - ap91_pci_init(ee, NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_leds_gpio), - ubnt_unifi_leds_gpio); - - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI, "UBNT-UF", "Ubiquiti UniFi", - ubnt_unifi_setup); - - -#define UBNT_UNIFIOD_PRI_PHYMASK BIT(4) -#define UBNT_UNIFIOD_2ND_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3)) - -static void __init ubnt_unifi_outdoor_setup(void) -{ - u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK | - UBNT_UNIFIOD_2ND_PHYMASK)); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); - ath79_register_eth(0); - ath79_register_eth(1); - - ap91_pci_init(ee, NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_leds_gpio), - ubnt_unifi_outdoor_leds_gpio); - - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR, "UBNT-U20", - "Ubiquiti UniFiAP Outdoor", - ubnt_unifi_outdoor_setup); - - -static void __init ubnt_unifi_outdoor_plus_setup(void) -{ - u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(0, ~(UBNT_UNIFIOD_PRI_PHYMASK | - UBNT_UNIFIOD_2ND_PHYMASK)); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); - ath79_register_eth(0); - ath79_register_eth(1); - - ap9x_pci_get_wmac_data(0)->ubnt_hsr = true; - ap91_pci_init(ee, NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_unifi_outdoor_plus_leds_gpio), - ubnt_unifi_outdoor_plus_leds_gpio); - - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, "UBNT-UOP", - "Ubiquiti UniFiAP Outdoor+", - ubnt_unifi_outdoor_plus_setup); - - -static struct gpio_led ubnt_uap_pro_gpio_leds[] __initdata = { - { - .name = "ubnt:white:dome", - .gpio = 12, - }, { - .name = "ubnt:blue:dome", - .gpio = 13, - } -}; - -static struct gpio_keys_button uap_pro_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, - .gpio = 17, - .active_low = 1, - } -}; - -static struct ar8327_pad_cfg uap_pro_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data uap_pro_ar8327_data = { - .pad0_cfg = &uap_pro_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info uap_pro_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "uap_pro", - .mdio_addr = 0, - .platform_data = &uap_pro_ar8327_data, - }, -}; - -#define UAP_PRO_MAC0_OFFSET 0x0000 -#define UAP_PRO_MAC1_OFFSET 0x0006 -#define UAP_PRO_WMAC_CALDATA_OFFSET 0x1000 -#define UAP_PRO_PCI_CALDATA_OFFSET 0x5000 - -static void __init ubnt_uap_pro_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_uap_pro_gpio_leds), - ubnt_uap_pro_gpio_leds); - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(uap_pro_gpio_keys), - uap_pro_gpio_keys); - - ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); - ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); - - ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(uap_pro_mdio0_info, - ARRAY_SIZE(uap_pro_mdio0_info)); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + UAP_PRO_MAC0_OFFSET, 0); - - /* GMAC0 is connected to an AR8327 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO, "UAP-PRO", "Ubiquiti UniFi AP Pro", - ubnt_uap_pro_setup); - -#define UBNT_XW_GPIO_LED_L1 11 -#define UBNT_XW_GPIO_LED_L2 16 -#define UBNT_XW_GPIO_LED_L3 13 -#define UBNT_XW_GPIO_LED_L4 14 - -static struct gpio_led ubnt_xw_leds_gpio[] __initdata = { - { - .name = "ubnt:red:link1", - .gpio = UBNT_XW_GPIO_LED_L1, - .active_low = 1, - }, { - .name = "ubnt:orange:link2", - .gpio = UBNT_XW_GPIO_LED_L2, - .active_low = 1, - }, { - .name = "ubnt:green:link3", - .gpio = UBNT_XW_GPIO_LED_L3, - .active_low = 1, - }, { - .name = "ubnt:green:link4", - .gpio = UBNT_XW_GPIO_LED_L4, - .active_low = 1, - }, -}; - -#define UBNT_ROCKET_TI_GPIO_LED_L1 16 -#define UBNT_ROCKET_TI_GPIO_LED_L2 17 -#define UBNT_ROCKET_TI_GPIO_LED_L3 18 -#define UBNT_ROCKET_TI_GPIO_LED_L4 19 -#define UBNT_ROCKET_TI_GPIO_LED_L5 20 -#define UBNT_ROCKET_TI_GPIO_LED_L6 21 -static struct gpio_led ubnt_rocket_ti_leds_gpio[] __initdata = { - { - .name = "ubnt:green:link1", - .gpio = UBNT_ROCKET_TI_GPIO_LED_L1, - .active_low = 1, - }, { - .name = "ubnt:green:link2", - .gpio = UBNT_ROCKET_TI_GPIO_LED_L2, - .active_low = 1, - }, { - .name = "ubnt:green:link3", - .gpio = UBNT_ROCKET_TI_GPIO_LED_L3, - .active_low = 1, - }, { - .name = "ubnt:green:link4", - .gpio = UBNT_ROCKET_TI_GPIO_LED_L4, - .active_low = 0, - }, { - .name = "ubnt:green:link5", - .gpio = UBNT_ROCKET_TI_GPIO_LED_L5, - .active_low = 0, - }, { - .name = "ubnt:green:link6", - .gpio = UBNT_ROCKET_TI_GPIO_LED_L6, - .active_low = 0, - }, -}; - -static void __init ubnt_xw_init(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio), - ubnt_xw_leds_gpio); - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); - - ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); - ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); - - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 | AR934X_ETH_CFG_MII_GMAC0_SLAVE); - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + UAP_PRO_MAC0_OFFSET, 0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; -} - -static void __init ubnt_nano_m_xw_setup(void) -{ - ubnt_xw_init(); - - /* GMAC0 is connected to an AR8326 switch */ - ath79_register_mdio(0, ~(BIT(0) | BIT(1) | BIT(5))); - ath79_eth0_data.phy_mask = (BIT(0) | BIT(1) | BIT(5)); - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_register_eth(0); -} - -static struct at803x_platform_data ubnt_loco_m_xw_at803x_data = { - .has_reset_gpio = 1, - .reset_gpio = 0, -}; - -static struct mdio_board_info ubnt_loco_m_xw_mdio_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "ubnt_loco_m_xw", - .mdio_addr = 1, - .platform_data = &ubnt_loco_m_xw_at803x_data, - }, -}; - -static void __init ubnt_loco_m_xw_setup(void) -{ - ubnt_xw_init(); - - mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info, - ARRAY_SIZE(ubnt_loco_m_xw_mdio_info)); - - ath79_register_mdio(0, ~BIT(1)); - ath79_eth0_data.phy_mask = BIT(1); - ath79_register_eth(0); -} - -#define UBNT_LBE_M5_GPIO_LED_LAN 13 -#define UBNT_LBE_M5_GPIO_LED_WLAN 14 -#define UBNT_LBE_M5_GPIO_LED_SYS 16 - -static struct gpio_led ubnt_lbe_m5_leds_gpio[] __initdata = { - { - .name = "ubnt:green:lan", - .gpio = UBNT_LBE_M5_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "ubnt:green:wlan", - .gpio = UBNT_LBE_M5_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "ubnt:green:sys", - .gpio = UBNT_LBE_M5_GPIO_LED_SYS, - .active_low = 1, - }, -}; - -static void __init ubnt_lbe_m5_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); - ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_lbe_m5_leds_gpio), - ubnt_lbe_m5_leds_gpio); - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 | - AR934X_ETH_CFG_MII_GMAC0_SLAVE); - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + UAP_PRO_MAC0_OFFSET, 0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - gpio_request_one(0, GPIOF_OUT_INIT_LOW | GPIOF_ACTIVE_LOW | - GPIOF_EXPORT_DIR_FIXED, "SPI nWP"); - - mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info, - ARRAY_SIZE(ubnt_loco_m_xw_mdio_info)); - - ath79_register_mdio(0, ~BIT(1)); - ath79_eth0_data.phy_mask = BIT(1); - ath79_register_eth(0); -} - -static void __init ubnt_rocket_m_xw_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio), - ubnt_xw_leds_gpio); - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); - - ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); - ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + UAP_PRO_MAC0_OFFSET, 0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_mdio(0, ~BIT(4)); - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); -} - -static struct at803x_platform_data ubnt_rocket_m_ti_at803_data = { - .disable_smarteee = 1, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 1, -}; -static struct mdio_board_info ubnt_rocket_m_ti_mdio_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "ubnt_rocket_m_ti", - .mdio_addr = 4, - .platform_data = &ubnt_rocket_m_ti_at803_data, - }, -}; - -static void __init ubnt_rocket_m_ti_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rocket_ti_leds_gpio), - ubnt_rocket_ti_leds_gpio); - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_xm_gpio_keys), - ubnt_xm_gpio_keys); - - ap91_pci_init(eeprom + 0x1000, NULL); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - ath79_setup_ar934x_eth_rx_delay(3, 3); - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + UAP_PRO_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, - eeprom + UAP_PRO_MAC1_OFFSET, 0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; - - mdiobus_register_board_info(ubnt_rocket_m_ti_mdio_info, - ARRAY_SIZE(ubnt_rocket_m_ti_mdio_info)); - ath79_register_mdio(0, 0x0); - - - ath79_eth0_data.phy_mask = BIT(4); - /* read out from vendor */ - ath79_eth0_pll_data.pll_1000 = 0x2000000; - ath79_eth0_pll_data.pll_10 = 0x1313; - ath79_register_eth(0); - - ath79_register_mdio(1, 0x0); - ath79_eth1_data.phy_mask = BIT(3); - ath79_register_eth(1); -} - - -MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW", - ubnt_nano_m_xw_setup); - -MIPS_MACHINE(ATH79_MACH_UBNT_LBE_M5, "UBNT-LBE-M5", "Ubiquiti Litebeam M5", - ubnt_lbe_m5_setup); - -MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW", - ubnt_loco_m_xw_setup); - -MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_XW, "UBNT-RM-XW", "Ubiquiti Rocket M XW", - ubnt_rocket_m_xw_setup); - -MIPS_MACHINE(ATH79_MACH_UBNT_ROCKET_M_TI, "UBNT-RM-TI", "Ubiquiti Rocket M TI", - ubnt_rocket_m_ti_setup); - -static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = { - { - .name = "ubnt:blue:wlan", - .gpio = 0, - }, { - .name = "ubnt:white:status", - .gpio = 1, - }, -}; - -static struct gpio_keys_button airgateway_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, - .gpio = 12, - .active_low = 1, - } -}; - -static void __init ubnt_airgateway_setup(void) -{ - u32 t; - u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); - t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN; - ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t); - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds), - ubnt_airgateway_gpio_leds); - - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(airgateway_gpio_keys), - airgateway_gpio_keys); - - ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0); - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - - ath79_register_mdio(0, 0x0); - - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_register_wmac(ee, NULL); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway", - ubnt_airgateway_setup); - -static struct gpio_led ubnt_airgateway_pro_gpio_leds[] __initdata = { - { - .name = "ubnt:blue:wlan", - .gpio = 13, - }, { - .name = "ubnt:white:status", - .gpio = 17, - }, -}; - - -static struct gpio_keys_button airgateway_pro_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = UBNT_XM_KEYS_DEBOUNCE_INTERVAL, - .gpio = 12, - .active_low = 1, - } -}; - -static void __init ubnt_airgateway_pro_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_pro_gpio_leds), - ubnt_airgateway_pro_gpio_leds); - - ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, - ARRAY_SIZE(airgateway_pro_gpio_keys), - airgateway_pro_gpio_keys); - - ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); - ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); - - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - - /* GMAC0 is left unused in this configuration */ - - /* GMAC1 is connected to MAC0 on the internal switch */ - /* The PoE/WAN port connects to port 5 on the internal switch */ - /* The LAN port connects to port 4 on the internal switch */ - ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - -} - -MIPS_MACHINE(ATH79_MACH_UBNT_AIRGWP, "UBNT-AGWP", "Ubiquiti AirGateway Pro", - ubnt_airgateway_pro_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wlr8100.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wlr8100.c deleted file mode 100644 index 9fc95ab5f..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wlr8100.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Sitecom X8 AC1750 WLR-8100 board support - * - * Based on the Qualcomm Atheros AP135/AP136 reference board support code - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WLR8100_GPIO_LED_USB 4 -#define WLR8100_GPIO_LED_WLAN_5G 12 -#define WLR8100_GPIO_LED_WLAN_2G 13 -#define WLR8100_GPIO_LED_STATUS_RED 14 -#define WLR8100_GPIO_LED_WPS_RED 15 -#define WLR8100_GPIO_LED_STATUS_AMBER 19 -#define WLR8100_GPIO_LED_WPS_GREEN 20 - -#define WLR8100_GPIO_BTN_WPS 16 -#define WLR8100_GPIO_BTN_RFKILL 21 - -#define WLR8100_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WLR8100_KEYS_DEBOUNCE_INTERVAL (3 * WLR8100_KEYS_POLL_INTERVAL) - -static struct gpio_led wlr8100_leds_gpio[] __initdata = { - { - .name = "wlr8100:amber:status", - .gpio = WLR8100_GPIO_LED_STATUS_AMBER, - .active_low = 1, - }, - { - .name = "wlr8100:red:status", - .gpio = WLR8100_GPIO_LED_STATUS_RED, - .active_low = 1, - }, - { - .name = "wlr8100:green:wps", - .gpio = WLR8100_GPIO_LED_WPS_GREEN, - .active_low = 1, - }, - { - .name = "wlr8100:red:wps", - .gpio = WLR8100_GPIO_LED_WPS_RED, - .active_low = 1, - }, - { - .name = "wlr8100:red:wlan-2g", - .gpio = WLR8100_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "wlr8100:red:usb", - .gpio = WLR8100_GPIO_LED_USB, - .active_low = 1, - } -}; - -static struct gpio_keys_button wlr8100_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WLR8100_KEYS_DEBOUNCE_INTERVAL, - .gpio = WLR8100_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WLR8100_KEYS_DEBOUNCE_INTERVAL, - .gpio = WLR8100_GPIO_BTN_RFKILL, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg wlr8100_ar8327_pad0_cfg; -static struct ar8327_pad_cfg wlr8100_ar8327_pad6_cfg; - -static struct ar8327_platform_data wlr8100_ar8327_data = { - .pad0_cfg = &wlr8100_ar8327_pad0_cfg, - .pad6_cfg = &wlr8100_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info wlr8100_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "wlr8100", - .mdio_addr = 0, - .platform_data = &wlr8100_ar8327_data, - }, -}; - -static void __init wlr8100_common_setup(void) -{ - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wlr8100_leds_gpio), - wlr8100_leds_gpio); - ath79_register_gpio_keys_polled(-1, WLR8100_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wlr8100_gpio_keys), - wlr8100_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac_simple(); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - ath79_register_mdio(0, 0x0); - - mdiobus_register_board_info(wlr8100_mdio0_info, - ARRAY_SIZE(wlr8100_mdio0_info)); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); - - /* GMAC1 is connected tot eh SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); -} - -static void __init wlr8100_010_setup(void) -{ - /* GMAC0 of the AR8337 switch is connected to GMAC0 via RGMII */ - wlr8100_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_RGMII; - wlr8100_ar8327_pad0_cfg.txclk_delay_en = true; - wlr8100_ar8327_pad0_cfg.rxclk_delay_en = true; - wlr8100_ar8327_pad0_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1; - wlr8100_ar8327_pad0_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2; - - /* GMAC6 of the AR8337 switch is connected to GMAC1 via SGMII */ - wlr8100_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_SGMII; - wlr8100_ar8327_pad6_cfg.rxclk_delay_en = true; - wlr8100_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL0; - - ath79_eth0_pll_data.pll_1000 = 0xa6000000; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - wlr8100_common_setup(); - ap91_pci_init_simple(); -} - -MIPS_MACHINE(ATH79_MACH_WLR8100, "WLR8100", - "Sitecom WLR-8100", - wlr8100_010_setup); - diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wndr4300.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wndr4300.c deleted file mode 100644 index 66ddb00f1..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wndr4300.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * NETGEAR WNDR3700v4/WNDR4300 board support - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2014 Ralph Perlich - * - * 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-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -/* AR9344 GPIOs */ -#define WNDR4300_GPIO_LED_POWER_GREEN 0 -#define WNDR4300_GPIO_LED_POWER_AMBER 2 -#define WNDR4300_GPIO_LED_USB 13 -#define WNDR4300_GPIO_LED_WAN_GREEN 1 -#define WNDR4300_GPIO_LED_WAN_AMBER 3 -#define WNDR4300_GPIO_LED_WLAN2G 11 -#define WNDR4300_GPIO_LED_WLAN5G 14 -#define WNDR4300_GPIO_LED_WPS_GREEN 16 -#define WNDR4300_GPIO_LED_WPS_AMBER 17 - -#define WNDR4300_GPIO_BTN_RESET 21 -#define WNDR4300_GPIO_BTN_WIRELESS 15 -#define WNDR4300_GPIO_BTN_WPS 12 - -/* AR9580 GPIOs */ -#define WNDR4300_GPIO_USB_5V 0 - -#define WNDR4300_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WNDR4300_KEYS_DEBOUNCE_INTERVAL (3 * WNDR4300_KEYS_POLL_INTERVAL) - -static struct gpio_led wndr4300_leds_gpio[] __initdata = { - { - .name = "netgear:green:power", - .gpio = WNDR4300_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, - { - .name = "netgear:amber:power", - .gpio = WNDR4300_GPIO_LED_POWER_AMBER, - .active_low = 1, - }, - { - .name = "netgear:green:wan", - .gpio = WNDR4300_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, - { - .name = "netgear:amber:wan", - .gpio = WNDR4300_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, - { - .name = "netgear:green:usb", - .gpio = WNDR4300_GPIO_LED_USB, - .active_low = 1, - }, - { - .name = "netgear:green:wps", - .gpio = WNDR4300_GPIO_LED_WPS_GREEN, - .active_low = 1, - }, - { - .name = "netgear:amber:wps", - .gpio = WNDR4300_GPIO_LED_WPS_AMBER, - .active_low = 1, - }, - { - .name = "netgear:green:wlan2g", - .gpio = WNDR4300_GPIO_LED_WLAN2G, - .active_low = 1, - }, - { - .name = "netgear:blue:wlan5g", - .gpio = WNDR4300_GPIO_LED_WLAN5G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wndr4300_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNDR4300_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNDR4300_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WNDR4300_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNDR4300_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Wireless button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WNDR4300_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNDR4300_GPIO_BTN_WIRELESS, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg wndr4300_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg wndr4300_ar8327_led_cfg = { - .led_ctrl0 = 0xcc35cc35, - .led_ctrl1 = 0xcb37cb37, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x00f3cf00, - .open_drain = true, -}; - -static struct ar8327_platform_data wndr4300_ar8327_data = { - .pad0_cfg = &wndr4300_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &wndr4300_ar8327_led_cfg, -}; - -static struct mdio_board_info wndr4300_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "wndr4300", - .mdio_addr = 0, - .platform_data = &wndr4300_ar8327_data, - }, -}; - -static void __init wndr4300_setup(void) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(wndr4300_leds_gpio); i++) - ath79_gpio_output_select(wndr4300_leds_gpio[i].gpio, - AR934X_GPIO_OUT_GPIO); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wndr4300_leds_gpio), - wndr4300_leds_gpio); - ath79_register_gpio_keys_polled(-1, WNDR4300_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wndr4300_gpio_keys), - wndr4300_gpio_keys); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - mdiobus_register_board_info(wndr4300_mdio0_info, - ARRAY_SIZE(wndr4300_mdio0_info)); - - ath79_register_mdio(0, 0x0); - - /* GMAC0 is connected to an AR8327N switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); - - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW); - ath79_register_nfc(); - ath79_register_usb(); - - ath79_register_wmac_simple(); - - /* enable power for the USB port */ - ap9x_pci_setup_wmac_gpio(0, BIT(WNDR4300_GPIO_USB_5V), - BIT(WNDR4300_GPIO_USB_5V)); - - ap91_pci_init_simple(); -} - -MIPS_MACHINE(ATH79_MACH_WNDR3700_V4, "WNDR3700_V4", "NETGEAR WNDR3700v4", - wndr4300_setup); -MIPS_MACHINE(ATH79_MACH_WNDR4300, "WNDR4300", "NETGEAR WNDR4300", - wndr4300_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj342.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj342.c deleted file mode 100644 index bd6bcd971..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj342.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Compex WPJ342 board support - * - * Copyright (c) 2011 Qualcomm Atheros - * Copyright (c) 2011-2012 Gabor Juhos - * - * 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 "pci.h" -#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-nfc.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WPJ342_GPIO_LED_STATUS 11 -#define WPJ342_GPIO_LED_SIG1 14 -#define WPJ342_GPIO_LED_SIG2 13 -#define WPJ342_GPIO_LED_SIG3 12 -#define WPJ342_GPIO_LED_SIG4 11 -#define WPJ342_GPIO_BUZZER 15 - -#define WPJ342_GPIO_BTN_RESET 17 - -#define WPJ342_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WPJ342_KEYS_DEBOUNCE_INTERVAL (3 * WPJ342_KEYS_POLL_INTERVAL) - -#define WPJ342_MAC0_OFFSET 0x10 -#define WPJ342_MAC1_OFFSET 0x18 -#define WPJ342_WMAC_CALDATA_OFFSET 0x1000 -#define WPJ342_PCIE_CALDATA_OFFSET 0x5000 - -#define WPJ342_ART_SIZE 0x8000 - -static struct gpio_led wpj342_leds_gpio[] __initdata = { - { - .name = "wpj342:red:sig1", - .gpio = WPJ342_GPIO_LED_SIG1, - .active_low = 1, - }, - { - .name = "wpj342:yellow:sig2", - .gpio = WPJ342_GPIO_LED_SIG2, - .active_low = 1, - }, - { - .name = "wpj342:green:sig3", - .gpio = WPJ342_GPIO_LED_SIG3, - .active_low = 1, - }, - { - .name = "wpj342:green:sig4", - .gpio = WPJ342_GPIO_LED_SIG4, - .active_low = 1, - }, - { - .name = "wpj342:buzzer", - .gpio = WPJ342_GPIO_BUZZER, - .active_low = 0, - } -}; - -static struct gpio_keys_button wpj342_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WPJ342_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPJ342_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg wpj342_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg wpj342_ar8327_led_cfg = { - .led_ctrl0 = 0x00000000, - .led_ctrl1 = 0xc737c737, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x00c30c00, - .open_drain = true, -}; - -static struct ar8327_platform_data wpj342_ar8327_data = { - .pad0_cfg = &wpj342_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &wpj342_ar8327_led_cfg, -}; - -static struct mdio_board_info wpj342_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "wpj342", - .mdio_addr = 0, - .platform_data = &wpj342_ar8327_data, - }, -}; - - -static void __init wpj342_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000); - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(wpj342_leds_gpio), - wpj342_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WPJ342_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wpj342_gpio_keys), - wpj342_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(art + WPJ342_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - - mdiobus_register_board_info(wpj342_mdio0_info, - ARRAY_SIZE(wpj342_mdio0_info)); - - ath79_register_mdio(1, 0x0); - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ342_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac + WPJ342_MAC1_OFFSET, 0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0); - - /* GMAC0 is connected to an AR8236 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_WPJ342, "WPJ342", "Compex WPJ342", wpj342_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj344.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj344.c deleted file mode 100644 index 38c7e1640..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj344.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Compex WPJ344 board support - * - * Copyright (c) 2011 Qualcomm Atheros - * Copyright (c) 2011-2012 Gabor Juhos - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-usb.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WPJ344_GPIO_LED_SIG1 15 -#define WPJ344_GPIO_LED_SIG2 20 -#define WPJ344_GPIO_LED_SIG3 21 -#define WPJ344_GPIO_LED_SIG4 22 -#define WPJ344_GPIO_LED_STATUS 14 - -#define WPJ344_GPIO_BTN_RESET 12 - -#define WPJ344_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WPJ344_KEYS_DEBOUNCE_INTERVAL (3 * WPJ344_KEYS_POLL_INTERVAL) - -#define WPJ344_MAC0_OFFSET 0x10 -#define WPJ344_MAC1_OFFSET 0x18 -#define WPJ344_WMAC_CALDATA_OFFSET 0x1000 -#define WPJ344_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led wpj344_leds_gpio[] __initdata = { - { - .name = "wpj344:green:status", - .gpio = WPJ344_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "wpj344:red:sig1", - .gpio = WPJ344_GPIO_LED_SIG1, - .active_low = 1, - }, - { - .name = "wpj344:yellow:sig2", - .gpio = WPJ344_GPIO_LED_SIG2, - .active_low = 1, - }, - { - .name = "wpj344:green:sig3", - .gpio = WPJ344_GPIO_LED_SIG3, - .active_low = 1, - }, - { - .name = "wpj344:green:sig4", - .gpio = WPJ344_GPIO_LED_SIG4, - .active_low = 1, - } -}; - -static struct gpio_keys_button wpj344_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WPJ344_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPJ344_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg wpj344_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, - .mac06_exchange_dis = true, -}; - -static struct ar8327_led_cfg wpj344_ar8327_led_cfg = { - .led_ctrl0 = 0x00000000, - .led_ctrl1 = 0xc737c737, - .led_ctrl2 = 0x00000000, - .led_ctrl3 = 0x00c30c00, - .open_drain = true, -}; - -static struct ar8327_platform_data wpj344_ar8327_data = { - .pad0_cfg = &wpj344_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &wpj344_ar8327_led_cfg, -}; - -static struct mdio_board_info wpj344_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "wpj344", - .mdio_addr = 0, - .platform_data = &wpj344_ar8327_data, - }, -}; - -static void __init wpj344_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000); - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(wpj344_leds_gpio), - wpj344_leds_gpio); - ath79_register_gpio_keys_polled(-1, WPJ344_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wpj344_gpio_keys), - wpj344_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(art + WPJ344_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - - mdiobus_register_board_info(wpj344_mdio0_info, - ARRAY_SIZE(wpj344_mdio0_info)); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ344_MAC0_OFFSET, 0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - /* GMAC0 is connected to an AR8327 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_WPJ344, "WPJ344", "Compex WPJ344", wpj344_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj558.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj558.c deleted file mode 100644 index 0f923b481..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj558.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Compex WPJ558 board support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * - * 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 "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-usb.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WPJ558_GPIO_LED_SIG1 14 -#define WPJ558_GPIO_LED_SIG2 15 -#define WPJ558_GPIO_LED_SIG3 22 -#define WPJ558_GPIO_LED_SIG4 23 -#define WPJ558_GPIO_BUZZER 4 - -#define WPJ558_GPIO_BTN_RESET 17 - -#define WPJ558_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WPJ558_KEYS_DEBOUNCE_INTERVAL (3 * WPJ558_KEYS_POLL_INTERVAL) - -#define WPJ558_MAC_OFFSET 0x10 -#define WPJ558_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led wpj558_leds_gpio[] __initdata = { - { - .name = "wpj558:red:sig1", - .gpio = WPJ558_GPIO_LED_SIG1, - .active_low = 1, - }, - { - .name = "wpj558:yellow:sig2", - .gpio = WPJ558_GPIO_LED_SIG2, - .active_low = 1, - }, - { - .name = "wpj558:green:sig3", - .gpio = WPJ558_GPIO_LED_SIG3, - .active_low = 1, - }, - { - .name = "wpj558:green:sig4", - .gpio = WPJ558_GPIO_LED_SIG4, - .active_low = 1, - }, - { - .name = "wpj558:buzzer", - .gpio = WPJ558_GPIO_BUZZER, - .active_low = 0, - } -}; - -static struct gpio_keys_button wpj558_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WPJ558_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPJ558_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg wpj558_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_pad_cfg wpj558_ar8327_pad6_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data wpj558_ar8327_data = { - .pad0_cfg = &wpj558_ar8327_pad0_cfg, - .pad6_cfg = &wpj558_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info wpj558_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "wpj558", - .mdio_addr = 0, - .platform_data = &wpj558_ar8327_data, - }, -}; - -static void __init wpj558_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000); - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(wpj558_leds_gpio), - wpj558_leds_gpio); - ath79_register_gpio_keys_polled(-1, WPJ558_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wpj558_gpio_keys), - wpj558_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(art + WPJ558_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - - mdiobus_register_board_info(wpj558_mdio0_info, - ARRAY_SIZE(wpj558_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ558_MAC_OFFSET, 0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - /* GMAC0 is connected to an AR8327 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x56000000; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_WPJ558, "WPJ558", "Compex WPJ558", wpj558_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj563.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj563.c deleted file mode 100644 index d4152c309..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj563.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Compex WPJ563 board support - * - * Copyright (c) 2015 Qualcomm Atheros - * Copyright (c) 2012 Gabor Juhos - * - * 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 "common.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" - -#define WPJ563_GPIO_LED_SIG1 1 -#define WPJ563_GPIO_LED_SIG2 5 -#define WPJ563_GPIO_LED_SIG3 6 -#define WPJ563_GPIO_LED_SIG4 7 -#define WPJ563_GPIO_BUZZER 19 - -#define WPJ563_GPIO_BTN_RESET 2 -#define WPJ563_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WPJ563_KEYS_DEBOUNCE_INTERVAL (3 * WPJ563_KEYS_POLL_INTERVAL) - -#define WPJ563_MAC0_OFFSET 0x10 -#define WPJ563_MAC1_OFFSET 0x18 -#define WPJ563_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led WPJ563_leds_gpio[] __initdata = { - { - .name = "wpj563:green:sig1", - .gpio = WPJ563_GPIO_LED_SIG1, - .active_low = 1, - }, - { - .name = "wpj563:green:sig2", - .gpio = WPJ563_GPIO_LED_SIG2, - .active_low = 1, - }, - { - .name = "wpj563:green:sig3", - .gpio = WPJ563_GPIO_LED_SIG3, - .active_low = 1, - }, - { - .name = "wpj563:green:sig4", - .gpio = WPJ563_GPIO_LED_SIG4, - .active_low = 1, - }, - { - .name = "wpj563:buzzer", - .gpio = WPJ563_GPIO_BUZZER, - .active_low = 0, - } -}; - -static struct gpio_keys_button WPJ563_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WPJ563_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPJ563_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg WPJ563_ar8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data WPJ563_ar8337_data = { - .pad0_cfg = &WPJ563_ar8337_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info WPJ563_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "WPJ563", - .mdio_addr = 0, - .platform_data = &WPJ563_ar8337_data, - }, -}; - -static void __init WPJ563_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(WPJ563_leds_gpio), - WPJ563_leds_gpio); - ath79_register_gpio_keys_polled(-1, WPJ563_KEYS_POLL_INTERVAL, - ARRAY_SIZE(WPJ563_gpio_keys), - WPJ563_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(art + WPJ563_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - - mdiobus_register_board_info(WPJ563_mdio0_info, - ARRAY_SIZE(WPJ563_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ563_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac + WPJ563_MAC1_OFFSET, 0); - - /* GMAC0 is connected to an QCA8334 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_WPJ563, "WPJ563", "Compex WPJ563", WPJ563_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-450hp2.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-450hp2.c deleted file mode 100644 index 6fa431cbf..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-450hp2.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Buffalo WZR-450HP2 board support - * - * Copyright (c) 2013 Gabor Juhos - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WZR_450HP2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WZR_450HP2_KEYS_DEBOUNCE_INTERVAL (3 * WZR_450HP2_KEYS_POLL_INTERVAL) - -#define WZR_450HP2_WMAC_CALDATA_OFFSET 0x1000 - -static struct mtd_partition wzrhpg450h_partitions[] = { - { - .name = "u-boot", - .offset = 0, - .size = 0x0040000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "u-boot-env", - .offset = 0x0040000, - .size = 0x0010000, - }, { - .name = "ART", - .offset = 0x0ff0000, - .size = 0x0010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x0050000, - .size = 0x0f90000, - }, { - .name = "user_property", - .offset = 0x0fe0000, - .size = 0x0010000, - } -}; - -static struct flash_platform_data wzr_450hp2_flash_data = { - .parts = wzrhpg450h_partitions, - .nr_parts = ARRAY_SIZE(wzrhpg450h_partitions), -}; - -static struct gpio_led wzr_450hp2_leds_gpio[] __initdata = { - { - .name = "buffalo:green:wps", - .gpio = 3, - .active_low = 1, - }, - { - .name = "buffalo:green:system", - .gpio = 20, - .active_low = 1, - }, - { - .name = "buffalo:green:wlan", - .gpio = 18, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wzr_450hp2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WZR_450HP2_KEYS_DEBOUNCE_INTERVAL, - .gpio = 17, - .active_low = 1, - }, - { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WZR_450HP2_KEYS_DEBOUNCE_INTERVAL, - .gpio = 21, - .active_low = 1, - }, -}; - -static const struct ar8327_led_info wzr_450hp2_leds_ar8327[] = { - AR8327_LED_INFO(PHY0_0, HW, "buffalo:green:lan1"), - AR8327_LED_INFO(PHY1_0, HW, "buffalo:green:lan2"), - AR8327_LED_INFO(PHY2_0, HW, "buffalo:green:lan3"), - AR8327_LED_INFO(PHY3_0, HW, "buffalo:green:lan4"), - AR8327_LED_INFO(PHY4_0, HW, "buffalo:green:wan"), -}; - -/* GMAC0 of the AR8327 switch is connected to the QCA9558 SoC via SGMII */ -static struct ar8327_pad_cfg wzr_450hp2_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -/* GMAC6 of the AR8327 switch is connected to the QCA9558 SoC via RGMII */ -static struct ar8327_pad_cfg wzr_450hp2_ar8327_pad6_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_led_cfg wzr_450hp2_ar8327_led_cfg = { - .led_ctrl0 = 0xcc35cc35, - .led_ctrl1 = 0xca35ca35, - .led_ctrl2 = 0xc935c935, - .led_ctrl3 = 0x03ffff00, - .open_drain = true, -}; - -static struct ar8327_platform_data wzr_450hp2_ar8327_data = { - .pad0_cfg = &wzr_450hp2_ar8327_pad0_cfg, - .pad6_cfg = &wzr_450hp2_ar8327_pad6_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .port6_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, - .led_cfg = &wzr_450hp2_ar8327_led_cfg, - .num_leds = ARRAY_SIZE(wzr_450hp2_leds_ar8327), - .leds = wzr_450hp2_leds_ar8327, -}; - -static struct mdio_board_info wzr_450hp2_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "wzr_450hp2", - .mdio_addr = 0, - .platform_data = &wzr_450hp2_ar8327_data, - }, -}; - -static void __init wzr_450hp2_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac_wan = art; - u8 *mac_lan = mac_wan + ETH_ALEN; - - ath79_register_m25p80(&wzr_450hp2_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wzr_450hp2_leds_gpio), - wzr_450hp2_leds_gpio); - ath79_register_gpio_keys_polled(-1, WZR_450HP2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wzr_450hp2_gpio_keys), - wzr_450hp2_gpio_keys); - - ath79_register_wmac(art + WZR_450HP2_WMAC_CALDATA_OFFSET, mac_lan); - - mdiobus_register_board_info(wzr_450hp2_mdio0_info, - ARRAY_SIZE(wzr_450hp2_mdio0_info)); - ath79_register_mdio(0, 0x0); - - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); - - /* GMAC0 is connected to the RMGII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x56000000; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac_wan, 0); - ath79_register_eth(0); - - /* GMAC1 is connected to the SGMII interface */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_pll_data.pll_1000 = 0x03000101; - - ath79_init_mac(ath79_eth1_data.mac_addr, mac_lan, 0); - ath79_register_eth(1); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_WZR_450HP2, "WZR-450HP2", - "Buffalo WZR-450HP2", wzr_450hp2_setup); - diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-z1.c b/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-z1.c deleted file mode 100644 index 7756b8773..000000000 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-z1.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Cisco Meraki Z1 board support - * - * Copyright (C) 2016 Chris Blake - * Copyright (C) 2016 Christian Lamparter - * - * Based on Cisco Meraki GPL Release r23-20150601 Z1 Device Config - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "dev-ap9x-pci.h" -#include "machtypes.h" - -#define Z1_GPIO_LED_POWER_ORANGE 17 - -#define Z1_GPIO_NU801_CKI 14 -#define Z1_GPIO_NU801_SDI 15 - -#define Z1_GPIO_XLNA0 18 -#define Z1_GPIO_XLNA1 19 - -#define Z1_GPIO_BTN_RESET 12 -#define Z1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define Z1_KEYS_DEBOUNCE_INTERVAL (3 * Z1_KEYS_POLL_INTERVAL) - -#define Z1_ETH_SWITCH_PHY 0 - -static struct gpio_led Z1_leds_gpio[] __initdata = { - { - .name = "z1:orange:power", - .gpio = Z1_GPIO_LED_POWER_ORANGE, - .active_low = 1, - }, -}; - -static struct gpio_keys_button Z1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = Z1_KEYS_DEBOUNCE_INTERVAL, - .gpio = Z1_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct led_nu801_template tricolor_led_template = { - .device_name = "z1", - .name = "tricolor", - .num_leds = 1, - .cki = Z1_GPIO_NU801_CKI, - .sdi = Z1_GPIO_NU801_SDI, - .lei = -1, - .ndelay = 500, - .init_brightness = { - LED_OFF, - LED_OFF, - LED_OFF, - }, - .default_trigger = "none", -}; - -static struct led_nu801_platform_data tricolor_led_data = { - .num_controllers = 1, - .template = &tricolor_led_template, -}; - -static struct platform_device tricolor_leds = { - .name = "leds-nu801", - .id = -1, - .dev.platform_data = &tricolor_led_data, -}; - -static struct ar8327_pad_cfg z1_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_RGMII, - .txclk_delay_en = true, - .rxclk_delay_en = true, - .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, - .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, -}; - -static struct ar8327_platform_data z1_ar8327_data = { - .pad0_cfg = &z1_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info z1_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .modalias = "z1", - .mdio_addr = Z1_ETH_SWITCH_PHY, - .platform_data = &z1_ar8327_data, - }, -}; - -static void __init z1_setup(void) -{ - /* NAND */ - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_SOFT_BCH); - ath79_register_nfc(); - - /* Eth Config */ - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - /* MDIO Interface */ - ath79_register_mdio(1, 0x0); - ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(z1_mdio0_info, - ARRAY_SIZE(z1_mdio0_info)); - - /* GMAC0 is connected to an AR8327 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(Z1_ETH_SWITCH_PHY); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); - - /* XLNA */ - ath79_wmac_set_ext_lna_gpio(0, Z1_GPIO_XLNA0); - ath79_wmac_set_ext_lna_gpio(1, Z1_GPIO_XLNA1); - - /* LEDs and Buttons */ - platform_device_register(&tricolor_leds); - ath79_register_leds_gpio(-1, ARRAY_SIZE(Z1_leds_gpio), - Z1_leds_gpio); - ath79_register_gpio_keys_polled(-1, Z1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(Z1_gpio_keys), - Z1_gpio_keys); - - /* USB */ - ath79_register_usb(); - - /* Wireless */ - ath79_register_wmac_simple(); - ap91_pci_init_simple(); -} -MIPS_MACHINE(ATH79_MACH_Z1, "Z1", "Meraki Z1", z1_setup); diff --git a/target/linux/ar71xx/files-4.14/drivers/mtd/nand/ar934x_nfc.c b/target/linux/ar71xx/files-4.14/drivers/mtd/nand/ar934x_nfc.c deleted file mode 100644 index 0b6ba1fce..000000000 --- a/target/linux/ar71xx/files-4.14/drivers/mtd/nand/ar934x_nfc.c +++ /dev/null @@ -1,1587 +0,0 @@ -/* - * Driver for the built-in NAND controller of the Atheros AR934x SoCs - * - * Copyright (C) 2011-2013 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define AR934X_NFC_REG_CMD 0x00 -#define AR934X_NFC_REG_CTRL 0x04 -#define AR934X_NFC_REG_STATUS 0x08 -#define AR934X_NFC_REG_INT_MASK 0x0c -#define AR934X_NFC_REG_INT_STATUS 0x10 -#define AR934X_NFC_REG_ECC_CTRL 0x14 -#define AR934X_NFC_REG_ECC_OFFSET 0x18 -#define AR934X_NFC_REG_ADDR0_0 0x1c -#define AR934X_NFC_REG_ADDR0_1 0x24 -#define AR934X_NFC_REG_ADDR1_0 0x20 -#define AR934X_NFC_REG_ADDR1_1 0x28 -#define AR934X_NFC_REG_SPARE_SIZE 0x30 -#define AR934X_NFC_REG_PROTECT 0x38 -#define AR934X_NFC_REG_LOOKUP_EN 0x40 -#define AR934X_NFC_REG_LOOKUP(_x) (0x44 + (_i) * 4) -#define AR934X_NFC_REG_DMA_ADDR 0x64 -#define AR934X_NFC_REG_DMA_COUNT 0x68 -#define AR934X_NFC_REG_DMA_CTRL 0x6c -#define AR934X_NFC_REG_MEM_CTRL 0x80 -#define AR934X_NFC_REG_DATA_SIZE 0x84 -#define AR934X_NFC_REG_READ_STATUS 0x88 -#define AR934X_NFC_REG_TIME_SEQ 0x8c -#define AR934X_NFC_REG_TIMINGS_ASYN 0x90 -#define AR934X_NFC_REG_TIMINGS_SYN 0x94 -#define AR934X_NFC_REG_FIFO_DATA 0x98 -#define AR934X_NFC_REG_TIME_MODE 0x9c -#define AR934X_NFC_REG_DMA_ADDR_OFFS 0xa0 -#define AR934X_NFC_REG_FIFO_INIT 0xb0 -#define AR934X_NFC_REG_GEN_SEQ_CTRL 0xb4 - -#define AR934X_NFC_CMD_CMD_SEQ_S 0 -#define AR934X_NFC_CMD_CMD_SEQ_M 0x3f -#define AR934X_NFC_CMD_SEQ_1C 0x00 -#define AR934X_NFC_CMD_SEQ_ERASE 0x0e -#define AR934X_NFC_CMD_SEQ_12 0x0c -#define AR934X_NFC_CMD_SEQ_1C1AXR 0x21 -#define AR934X_NFC_CMD_SEQ_S 0x24 -#define AR934X_NFC_CMD_SEQ_1C3AXR 0x27 -#define AR934X_NFC_CMD_SEQ_1C5A1CXR 0x2a -#define AR934X_NFC_CMD_SEQ_18 0x32 -#define AR934X_NFC_CMD_INPUT_SEL_SIU 0 -#define AR934X_NFC_CMD_INPUT_SEL_DMA BIT(6) -#define AR934X_NFC_CMD_ADDR_SEL_0 0 -#define AR934X_NFC_CMD_ADDR_SEL_1 BIT(7) -#define AR934X_NFC_CMD_CMD0_S 8 -#define AR934X_NFC_CMD_CMD0_M 0xff -#define AR934X_NFC_CMD_CMD1_S 16 -#define AR934X_NFC_CMD_CMD1_M 0xff -#define AR934X_NFC_CMD_CMD2_S 24 -#define AR934X_NFC_CMD_CMD2_M 0xff - -#define AR934X_NFC_CTRL_ADDR_CYCLE0_M 0x7 -#define AR934X_NFC_CTRL_ADDR_CYCLE0_S 0 -#define AR934X_NFC_CTRL_SPARE_EN BIT(3) -#define AR934X_NFC_CTRL_INT_EN BIT(4) -#define AR934X_NFC_CTRL_ECC_EN BIT(5) -#define AR934X_NFC_CTRL_BLOCK_SIZE_S 6 -#define AR934X_NFC_CTRL_BLOCK_SIZE_M 0x3 -#define AR934X_NFC_CTRL_BLOCK_SIZE_32 0 -#define AR934X_NFC_CTRL_BLOCK_SIZE_64 1 -#define AR934X_NFC_CTRL_BLOCK_SIZE_128 2 -#define AR934X_NFC_CTRL_BLOCK_SIZE_256 3 -#define AR934X_NFC_CTRL_PAGE_SIZE_S 8 -#define AR934X_NFC_CTRL_PAGE_SIZE_M 0x7 -#define AR934X_NFC_CTRL_PAGE_SIZE_256 0 -#define AR934X_NFC_CTRL_PAGE_SIZE_512 1 -#define AR934X_NFC_CTRL_PAGE_SIZE_1024 2 -#define AR934X_NFC_CTRL_PAGE_SIZE_2048 3 -#define AR934X_NFC_CTRL_PAGE_SIZE_4096 4 -#define AR934X_NFC_CTRL_PAGE_SIZE_8192 5 -#define AR934X_NFC_CTRL_PAGE_SIZE_16384 6 -#define AR934X_NFC_CTRL_CUSTOM_SIZE_EN BIT(11) -#define AR934X_NFC_CTRL_IO_WIDTH_8BITS 0 -#define AR934X_NFC_CTRL_IO_WIDTH_16BITS BIT(12) -#define AR934X_NFC_CTRL_LOOKUP_EN BIT(13) -#define AR934X_NFC_CTRL_PROT_EN BIT(14) -#define AR934X_NFC_CTRL_WORK_MODE_ASYNC 0 -#define AR934X_NFC_CTRL_WORK_MODE_SYNC BIT(15) -#define AR934X_NFC_CTRL_ADDR0_AUTO_INC BIT(16) -#define AR934X_NFC_CTRL_ADDR1_AUTO_INC BIT(17) -#define AR934X_NFC_CTRL_ADDR_CYCLE1_M 0x7 -#define AR934X_NFC_CTRL_ADDR_CYCLE1_S 18 -#define AR934X_NFC_CTRL_SMALL_PAGE BIT(21) - -#define AR934X_NFC_DMA_CTRL_DMA_START BIT(7) -#define AR934X_NFC_DMA_CTRL_DMA_DIR_WRITE 0 -#define AR934X_NFC_DMA_CTRL_DMA_DIR_READ BIT(6) -#define AR934X_NFC_DMA_CTRL_DMA_MODE_SG BIT(5) -#define AR934X_NFC_DMA_CTRL_DMA_BURST_S 2 -#define AR934X_NFC_DMA_CTRL_DMA_BURST_0 0 -#define AR934X_NFC_DMA_CTRL_DMA_BURST_1 1 -#define AR934X_NFC_DMA_CTRL_DMA_BURST_2 2 -#define AR934X_NFC_DMA_CTRL_DMA_BURST_3 3 -#define AR934X_NFC_DMA_CTRL_DMA_BURST_4 4 -#define AR934X_NFC_DMA_CTRL_DMA_BURST_5 5 -#define AR934X_NFC_DMA_CTRL_ERR_FLAG BIT(1) -#define AR934X_NFC_DMA_CTRL_DMA_READY BIT(0) - -#define AR934X_NFC_INT_DEV_RDY(_x) BIT(4 + (_x)) -#define AR934X_NFC_INT_CMD_END BIT(1) - -#define AR934X_NFC_ECC_CTRL_ERR_THRES_S 8 -#define AR934X_NFC_ECC_CTRL_ERR_THRES_M 0x1f -#define AR934X_NFC_ECC_CTRL_ECC_CAP_S 5 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_M 0x7 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_2 0 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_4 1 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_6 2 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_8 3 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_10 4 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_12 5 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_14 6 -#define AR934X_NFC_ECC_CTRL_ECC_CAP_16 7 -#define AR934X_NFC_ECC_CTRL_ERR_OVER BIT(2) -#define AR934X_NFC_ECC_CTRL_ERR_UNCORRECT BIT(1) -#define AR934X_NFC_ECC_CTRL_ERR_CORRECT BIT(0) - -#define AR934X_NFC_ECC_OFFS_OFSET_M 0xffff - -/* default timing values */ -#define AR934X_NFC_TIME_SEQ_DEFAULT 0x7fff -#define AR934X_NFC_TIMINGS_ASYN_DEFAULT 0x22 -#define AR934X_NFC_TIMINGS_SYN_DEFAULT 0xf - -#define AR934X_NFC_ID_BUF_SIZE 8 -#define AR934X_NFC_DEV_READY_TIMEOUT 25 /* msecs */ -#define AR934X_NFC_DMA_READY_TIMEOUT 25 /* msecs */ -#define AR934X_NFC_DONE_TIMEOUT 1000 -#define AR934X_NFC_DMA_RETRIES 20 - -#define AR934X_NFC_USE_IRQ true -#define AR934X_NFC_IRQ_MASK AR934X_NFC_INT_DEV_RDY(0) - -#define AR934X_NFC_GENSEQ_SMALL_PAGE_READ 0x30043 - -#undef AR934X_NFC_DEBUG_DATA -#undef AR934X_NFC_DEBUG - -struct ar934x_nfc; - -static inline __attribute__ ((format (printf, 2, 3))) -void _nfc_dbg(struct ar934x_nfc *nfc, const char *fmt, ...) -{ -} - -#ifdef AR934X_NFC_DEBUG -#define nfc_dbg(_nfc, fmt, ...) \ - dev_info((_nfc)->parent, fmt, ##__VA_ARGS__) -#else -#define nfc_dbg(_nfc, fmt, ...) \ - _nfc_dbg((_nfc), fmt, ##__VA_ARGS__) -#endif /* AR934X_NFC_DEBUG */ - -#ifdef AR934X_NFC_DEBUG_DATA -static void -nfc_debug_data(const char *label, void *data, int len) -{ - print_hex_dump(KERN_WARNING, label, DUMP_PREFIX_OFFSET, 16, 1, - data, len, 0); -} -#else -static inline void -nfc_debug_data(const char *label, void *data, int len) {} -#endif /* AR934X_NFC_DEBUG_DATA */ - -struct ar934x_nfc { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct mtd_info mtd; -#endif - struct nand_chip nand_chip; - struct device *parent; - void __iomem *base; - void (*select_chip)(int chip_no); - bool swap_dma; - int irq; - wait_queue_head_t irq_waitq; - - bool spurious_irq_expected; - u32 irq_status; - - u32 ctrl_reg; - u32 ecc_ctrl_reg; - u32 ecc_offset_reg; - u32 ecc_thres; - u32 ecc_oob_pos; - - bool small_page; - unsigned int addr_count0; - unsigned int addr_count1; - - u8 *buf; - dma_addr_t buf_dma; - unsigned int buf_size; - int buf_index; - - bool read_id; - - int erase1_page_addr; - - int rndout_page_addr; - int rndout_read_cmd; - - int seqin_page_addr; - int seqin_column; - int seqin_read_cmd; -}; - -static void ar934x_nfc_restart(struct ar934x_nfc *nfc); - -static inline bool -is_all_ff(u8 *buf, int len) -{ - while (len--) - if (buf[len] != 0xff) - return false; - - return true; -} - -static inline void -ar934x_nfc_wr(struct ar934x_nfc *nfc, unsigned reg, u32 val) -{ - __raw_writel(val, nfc->base + reg); -} - -static inline u32 -ar934x_nfc_rr(struct ar934x_nfc *nfc, unsigned reg) -{ - return __raw_readl(nfc->base + reg); -} - -static inline struct ar934x_nfc_platform_data * -ar934x_nfc_get_platform_data(struct ar934x_nfc *nfc) -{ - return nfc->parent->platform_data; -} - -static inline struct -ar934x_nfc *mtd_to_ar934x_nfc(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - return container_of(mtd, struct ar934x_nfc, mtd); -#else - struct nand_chip *chip = mtd_to_nand(mtd); - - return container_of(chip, struct ar934x_nfc, nand_chip); -#endif -} - -static struct mtd_info *ar934x_nfc_to_mtd(struct ar934x_nfc *nfc) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - return &nfc->mtd; -#else - return nand_to_mtd(&nfc->nand_chip); -#endif -} - -static inline bool ar934x_nfc_use_irq(struct ar934x_nfc *nfc) -{ - return AR934X_NFC_USE_IRQ; -} - -static inline void ar934x_nfc_write_cmd_reg(struct ar934x_nfc *nfc, u32 cmd_reg) -{ - wmb(); - - ar934x_nfc_wr(nfc, AR934X_NFC_REG_CMD, cmd_reg); - /* flush write */ - ar934x_nfc_rr(nfc, AR934X_NFC_REG_CMD); -} - -static bool -__ar934x_nfc_dev_ready(struct ar934x_nfc *nfc) -{ - u32 status; - - status = ar934x_nfc_rr(nfc, AR934X_NFC_REG_STATUS); - return (status & 0xff) == 0xff; -} - -static inline bool -__ar934x_nfc_is_dma_ready(struct ar934x_nfc *nfc) -{ - u32 status; - - status = ar934x_nfc_rr(nfc, AR934X_NFC_REG_DMA_CTRL); - return (status & AR934X_NFC_DMA_CTRL_DMA_READY) != 0; -} - -static int -ar934x_nfc_wait_dev_ready(struct ar934x_nfc *nfc) -{ - unsigned long timeout; - - timeout = jiffies + msecs_to_jiffies(AR934X_NFC_DEV_READY_TIMEOUT); - do { - if (__ar934x_nfc_dev_ready(nfc)) - return 0; - } while time_before(jiffies, timeout); - - nfc_dbg(nfc, "timeout waiting for device ready, status:%08x int:%08x\n", - ar934x_nfc_rr(nfc, AR934X_NFC_REG_STATUS), - ar934x_nfc_rr(nfc, AR934X_NFC_REG_INT_STATUS)); - return -ETIMEDOUT; -} - -static int -ar934x_nfc_wait_dma_ready(struct ar934x_nfc *nfc) -{ - unsigned long timeout; - - timeout = jiffies + msecs_to_jiffies(AR934X_NFC_DMA_READY_TIMEOUT); - do { - if (__ar934x_nfc_is_dma_ready(nfc)) - return 0; - } while time_before(jiffies, timeout); - - nfc_dbg(nfc, "timeout waiting for DMA ready, dma_ctrl:%08x\n", - ar934x_nfc_rr(nfc, AR934X_NFC_REG_DMA_CTRL)); - return -ETIMEDOUT; -} - -static int -ar934x_nfc_wait_irq(struct ar934x_nfc *nfc) -{ - long timeout; - int ret; - - timeout = wait_event_timeout(nfc->irq_waitq, - (nfc->irq_status & AR934X_NFC_IRQ_MASK) != 0, - msecs_to_jiffies(AR934X_NFC_DEV_READY_TIMEOUT)); - - ret = 0; - if (!timeout) { - ar934x_nfc_wr(nfc, AR934X_NFC_REG_INT_MASK, 0); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_INT_STATUS, 0); - /* flush write */ - ar934x_nfc_rr(nfc, AR934X_NFC_REG_INT_STATUS); - - nfc_dbg(nfc, - "timeout waiting for interrupt, status:%08x\n", - nfc->irq_status); - ret = -ETIMEDOUT; - } - - nfc->irq_status = 0; - return ret; -} - -static int -ar934x_nfc_wait_done(struct ar934x_nfc *nfc) -{ - int ret; - - if (ar934x_nfc_use_irq(nfc)) - ret = ar934x_nfc_wait_irq(nfc); - else - ret = ar934x_nfc_wait_dev_ready(nfc); - - if (ret) - return ret; - - return ar934x_nfc_wait_dma_ready(nfc); -} - -static int -ar934x_nfc_alloc_buf(struct ar934x_nfc *nfc, unsigned size) -{ - nfc->buf = dma_alloc_coherent(nfc->parent, size, - &nfc->buf_dma, GFP_KERNEL); - if (nfc->buf == NULL) { - dev_err(nfc->parent, "no memory for DMA buffer\n"); - return -ENOMEM; - } - - nfc->buf_size = size; - nfc_dbg(nfc, "buf:%p size:%u\n", nfc->buf, nfc->buf_size); - - return 0; -} - -static void -ar934x_nfc_free_buf(struct ar934x_nfc *nfc) -{ - dma_free_coherent(nfc->parent, nfc->buf_size, nfc->buf, nfc->buf_dma); -} - -static void -ar934x_nfc_get_addr(struct ar934x_nfc *nfc, int column, int page_addr, - u32 *addr0, u32 *addr1) -{ - u32 a0, a1; - - a0 = 0; - a1 = 0; - - if (column == -1) { - /* ERASE1 */ - a0 = (page_addr & 0xffff) << 16; - a1 = (page_addr >> 16) & 0xf; - } else if (page_addr != -1) { - /* SEQIN, READ0, etc.. */ - - /* TODO: handle 16bit bus width */ - if (nfc->small_page) { - a0 = column & 0xff; - a0 |= (page_addr & 0xff) << 8; - a0 |= ((page_addr >> 8) & 0xff) << 16; - a0 |= ((page_addr >> 16) & 0xff) << 24; - } else { - a0 = column & 0x0FFF; - a0 |= (page_addr & 0xffff) << 16; - - if (nfc->addr_count0 > 4) - a1 = (page_addr >> 16) & 0xf; - } - } - - *addr0 = a0; - *addr1 = a1; -} - -static void -ar934x_nfc_send_cmd(struct ar934x_nfc *nfc, unsigned command) -{ - u32 cmd_reg; - - cmd_reg = AR934X_NFC_CMD_INPUT_SEL_SIU | AR934X_NFC_CMD_ADDR_SEL_0 | - AR934X_NFC_CMD_SEQ_1C; - cmd_reg |= (command & AR934X_NFC_CMD_CMD0_M) << AR934X_NFC_CMD_CMD0_S; - - ar934x_nfc_wr(nfc, AR934X_NFC_REG_INT_STATUS, 0); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_CTRL, nfc->ctrl_reg); - - ar934x_nfc_write_cmd_reg(nfc, cmd_reg); - ar934x_nfc_wait_dev_ready(nfc); -} - -static int -ar934x_nfc_do_rw_command(struct ar934x_nfc *nfc, int column, int page_addr, - int len, u32 cmd_reg, u32 ctrl_reg, bool write) -{ - u32 addr0, addr1; - u32 dma_ctrl; - int dir; - int err; - int retries = 0; - - WARN_ON(len & 3); - - if (WARN_ON(len > nfc->buf_size)) - dev_err(nfc->parent, "len=%d > buf_size=%d", len, nfc->buf_size); - - if (write) { - dma_ctrl = AR934X_NFC_DMA_CTRL_DMA_DIR_WRITE; - dir = DMA_TO_DEVICE; - } else { - dma_ctrl = AR934X_NFC_DMA_CTRL_DMA_DIR_READ; - dir = DMA_FROM_DEVICE; - } - - ar934x_nfc_get_addr(nfc, column, page_addr, &addr0, &addr1); - - dma_ctrl |= AR934X_NFC_DMA_CTRL_DMA_START | - (AR934X_NFC_DMA_CTRL_DMA_BURST_3 << - AR934X_NFC_DMA_CTRL_DMA_BURST_S); - - cmd_reg |= AR934X_NFC_CMD_INPUT_SEL_DMA | AR934X_NFC_CMD_ADDR_SEL_0; - ctrl_reg |= AR934X_NFC_CTRL_INT_EN; - - nfc_dbg(nfc, "%s a0:%08x a1:%08x len:%x cmd:%08x dma:%08x ctrl:%08x\n", - (write) ? "write" : "read", - addr0, addr1, len, cmd_reg, dma_ctrl, ctrl_reg); - -retry: - ar934x_nfc_wr(nfc, AR934X_NFC_REG_INT_STATUS, 0); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_ADDR0_0, addr0); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_ADDR0_1, addr1); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_DMA_ADDR, nfc->buf_dma); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_DMA_COUNT, len); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_DATA_SIZE, len); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_CTRL, ctrl_reg); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_DMA_CTRL, dma_ctrl); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_ECC_CTRL, nfc->ecc_ctrl_reg); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_ECC_OFFSET, nfc->ecc_offset_reg); - - if (ar934x_nfc_use_irq(nfc)) { - ar934x_nfc_wr(nfc, AR934X_NFC_REG_INT_MASK, AR934X_NFC_IRQ_MASK); - /* flush write */ - ar934x_nfc_rr(nfc, AR934X_NFC_REG_INT_MASK); - } - - ar934x_nfc_write_cmd_reg(nfc, cmd_reg); - err = ar934x_nfc_wait_done(nfc); - if (err) { - dev_dbg(nfc->parent, "%s operation stuck at page %d\n", - (write) ? "write" : "read", page_addr); - - ar934x_nfc_restart(nfc); - if (retries++ < AR934X_NFC_DMA_RETRIES) - goto retry; - - dev_err(nfc->parent, "%s operation failed on page %d\n", - (write) ? "write" : "read", page_addr); - } - - return err; -} - -static int -ar934x_nfc_send_readid(struct ar934x_nfc *nfc, unsigned command) -{ - u32 cmd_reg; - int err; - - nfc_dbg(nfc, "readid, cmd:%02x\n", command); - - cmd_reg = AR934X_NFC_CMD_SEQ_1C1AXR; - cmd_reg |= (command & AR934X_NFC_CMD_CMD0_M) << AR934X_NFC_CMD_CMD0_S; - - err = ar934x_nfc_do_rw_command(nfc, -1, -1, AR934X_NFC_ID_BUF_SIZE, - cmd_reg, nfc->ctrl_reg, false); - - nfc_debug_data("[id] ", nfc->buf, AR934X_NFC_ID_BUF_SIZE); - - return err; -} - -static int -ar934x_nfc_send_read(struct ar934x_nfc *nfc, unsigned command, int column, - int page_addr, int len) -{ - u32 cmd_reg; - int err; - - nfc_dbg(nfc, "read, column=%d page=%d len=%d\n", - column, page_addr, len); - - cmd_reg = (command & AR934X_NFC_CMD_CMD0_M) << AR934X_NFC_CMD_CMD0_S; - - if (nfc->small_page) { - cmd_reg |= AR934X_NFC_CMD_SEQ_18; - } else { - cmd_reg |= NAND_CMD_READSTART << AR934X_NFC_CMD_CMD1_S; - cmd_reg |= AR934X_NFC_CMD_SEQ_1C5A1CXR; - } - - err = ar934x_nfc_do_rw_command(nfc, column, page_addr, len, - cmd_reg, nfc->ctrl_reg, false); - - nfc_debug_data("[data] ", nfc->buf, len); - - return err; -} - -static void -ar934x_nfc_send_erase(struct ar934x_nfc *nfc, unsigned command, int column, - int page_addr) -{ - u32 addr0, addr1; - u32 ctrl_reg; - u32 cmd_reg; - - ar934x_nfc_get_addr(nfc, column, page_addr, &addr0, &addr1); - - ctrl_reg = nfc->ctrl_reg; - if (nfc->small_page) { - /* override number of address cycles for the erase command */ - ctrl_reg &= ~(AR934X_NFC_CTRL_ADDR_CYCLE0_M << - AR934X_NFC_CTRL_ADDR_CYCLE0_S); - ctrl_reg &= ~(AR934X_NFC_CTRL_ADDR_CYCLE1_M << - AR934X_NFC_CTRL_ADDR_CYCLE1_S); - ctrl_reg &= ~(AR934X_NFC_CTRL_SMALL_PAGE); - ctrl_reg |= (nfc->addr_count0 + 1) << - AR934X_NFC_CTRL_ADDR_CYCLE0_S; - } - - cmd_reg = NAND_CMD_ERASE1 << AR934X_NFC_CMD_CMD0_S; - cmd_reg |= command << AR934X_NFC_CMD_CMD1_S; - cmd_reg |= AR934X_NFC_CMD_SEQ_ERASE; - - nfc_dbg(nfc, "erase page %d, a0:%08x a1:%08x cmd:%08x ctrl:%08x\n", - page_addr, addr0, addr1, cmd_reg, ctrl_reg); - - ar934x_nfc_wr(nfc, AR934X_NFC_REG_INT_STATUS, 0); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_CTRL, ctrl_reg); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_ADDR0_0, addr0); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_ADDR0_1, addr1); - - ar934x_nfc_write_cmd_reg(nfc, cmd_reg); - ar934x_nfc_wait_dev_ready(nfc); -} - -static int -ar934x_nfc_send_write(struct ar934x_nfc *nfc, unsigned command, int column, - int page_addr, int len) -{ - u32 cmd_reg; - - nfc_dbg(nfc, "write, column=%d page=%d len=%d\n", - column, page_addr, len); - - nfc_debug_data("[data] ", nfc->buf, len); - - cmd_reg = NAND_CMD_SEQIN << AR934X_NFC_CMD_CMD0_S; - cmd_reg |= command << AR934X_NFC_CMD_CMD1_S; - cmd_reg |= AR934X_NFC_CMD_SEQ_12; - - return ar934x_nfc_do_rw_command(nfc, column, page_addr, len, - cmd_reg, nfc->ctrl_reg, true); -} - -static void -ar934x_nfc_read_status(struct ar934x_nfc *nfc) -{ - u32 cmd_reg; - u32 status; - - cmd_reg = NAND_CMD_STATUS << AR934X_NFC_CMD_CMD0_S; - cmd_reg |= AR934X_NFC_CMD_SEQ_S; - - ar934x_nfc_wr(nfc, AR934X_NFC_REG_INT_STATUS, 0); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_CTRL, nfc->ctrl_reg); - - ar934x_nfc_write_cmd_reg(nfc, cmd_reg); - ar934x_nfc_wait_dev_ready(nfc); - - status = ar934x_nfc_rr(nfc, AR934X_NFC_REG_READ_STATUS); - - nfc_dbg(nfc, "read status, cmd:%08x status:%02x\n", - cmd_reg, (status & 0xff)); - - if (nfc->swap_dma) - nfc->buf[0 ^ 3] = status; - else - nfc->buf[0] = status; -} - -static void -ar934x_nfc_cmdfunc(struct mtd_info *mtd, unsigned int command, int column, - int page_addr) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - struct nand_chip *nand = &nfc->nand_chip; - - nfc->read_id = false; - if (command != NAND_CMD_PAGEPROG) - nfc->buf_index = 0; - - switch (command) { - case NAND_CMD_RESET: - ar934x_nfc_send_cmd(nfc, command); - break; - - case NAND_CMD_READID: - nfc->read_id = true; - ar934x_nfc_send_readid(nfc, command); - break; - - case NAND_CMD_READ0: - case NAND_CMD_READ1: - if (nfc->small_page) { - ar934x_nfc_send_read(nfc, command, column, page_addr, - mtd->writesize + mtd->oobsize); - } else { - ar934x_nfc_send_read(nfc, command, 0, page_addr, - mtd->writesize + mtd->oobsize); - nfc->buf_index = column; - nfc->rndout_page_addr = page_addr; - nfc->rndout_read_cmd = command; - } - break; - - case NAND_CMD_READOOB: - if (nfc->small_page) - ar934x_nfc_send_read(nfc, NAND_CMD_READOOB, - column, page_addr, - mtd->oobsize); - else - ar934x_nfc_send_read(nfc, NAND_CMD_READ0, - mtd->writesize, page_addr, - mtd->oobsize); - break; - - case NAND_CMD_RNDOUT: - if (WARN_ON(nfc->small_page)) - break; - - /* emulate subpage read */ - ar934x_nfc_send_read(nfc, nfc->rndout_read_cmd, 0, - nfc->rndout_page_addr, - mtd->writesize + mtd->oobsize); - nfc->buf_index = column; - break; - - case NAND_CMD_ERASE1: - nfc->erase1_page_addr = page_addr; - break; - - case NAND_CMD_ERASE2: - ar934x_nfc_send_erase(nfc, command, -1, nfc->erase1_page_addr); - break; - - case NAND_CMD_STATUS: - ar934x_nfc_read_status(nfc); - break; - - case NAND_CMD_SEQIN: - if (nfc->small_page) { - /* output read command */ - if (column >= mtd->writesize) { - column -= mtd->writesize; - nfc->seqin_read_cmd = NAND_CMD_READOOB; - } else if (column < 256) { - nfc->seqin_read_cmd = NAND_CMD_READ0; - } else { - column -= 256; - nfc->seqin_read_cmd = NAND_CMD_READ1; - } - } else { - nfc->seqin_read_cmd = NAND_CMD_READ0; - } - nfc->seqin_column = column; - nfc->seqin_page_addr = page_addr; - break; - - case NAND_CMD_PAGEPROG: - if (nand->ecc.mode == NAND_ECC_HW) { - /* the data is already written */ - break; - } - - if (nfc->small_page) - ar934x_nfc_send_cmd(nfc, nfc->seqin_read_cmd); - - ar934x_nfc_send_write(nfc, command, nfc->seqin_column, - nfc->seqin_page_addr, - nfc->buf_index); - break; - - default: - dev_err(nfc->parent, - "unsupported command: %x, column:%d page_addr=%d\n", - command, column, page_addr); - break; - } -} - -static int -ar934x_nfc_dev_ready(struct mtd_info *mtd) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - - return __ar934x_nfc_dev_ready(nfc); -} - -static void -ar934x_nfc_select_chip(struct mtd_info *mtd, int chip_no) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - - if (nfc->select_chip) - nfc->select_chip(chip_no); -} - -static u8 -ar934x_nfc_read_byte(struct mtd_info *mtd) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - u8 data; - - WARN_ON(nfc->buf_index >= nfc->buf_size); - - if (nfc->swap_dma || nfc->read_id) - data = nfc->buf[nfc->buf_index ^ 3]; - else - data = nfc->buf[nfc->buf_index]; - - nfc->buf_index++; - - return data; -} - -static void -ar934x_nfc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - int i; - - WARN_ON(nfc->buf_index + len > nfc->buf_size); - - if (nfc->swap_dma) { - for (i = 0; i < len; i++) { - nfc->buf[nfc->buf_index ^ 3] = buf[i]; - nfc->buf_index++; - } - } else { - for (i = 0; i < len; i++) { - nfc->buf[nfc->buf_index] = buf[i]; - nfc->buf_index++; - } - } -} - -static void -ar934x_nfc_read_buf(struct mtd_info *mtd, u8 *buf, int len) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - int buf_index; - int i; - - WARN_ON(nfc->buf_index + len > nfc->buf_size); - - buf_index = nfc->buf_index; - - if (nfc->swap_dma || nfc->read_id) { - for (i = 0; i < len; i++) { - buf[i] = nfc->buf[buf_index ^ 3]; - buf_index++; - } - } else { - for (i = 0; i < len; i++) { - buf[i] = nfc->buf[buf_index]; - buf_index++; - } - } - - nfc->buf_index = buf_index; -} - -static inline void -ar934x_nfc_enable_hwecc(struct ar934x_nfc *nfc) -{ - nfc->ctrl_reg |= AR934X_NFC_CTRL_ECC_EN; - nfc->ctrl_reg &= ~AR934X_NFC_CTRL_CUSTOM_SIZE_EN; -} - -static inline void -ar934x_nfc_disable_hwecc(struct ar934x_nfc *nfc) -{ - nfc->ctrl_reg &= ~AR934X_NFC_CTRL_ECC_EN; - nfc->ctrl_reg |= AR934X_NFC_CTRL_CUSTOM_SIZE_EN; -} - -static int -ar934x_nfc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, - int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - int err; - - nfc_dbg(nfc, "read_oob: page:%d\n", page); - - err = ar934x_nfc_send_read(nfc, NAND_CMD_READ0, mtd->writesize, page, - mtd->oobsize); - if (err) - return err; - - memcpy(chip->oob_poi, nfc->buf, mtd->oobsize); - - return 0; -} - -static int -ar934x_nfc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, - int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - - nfc_dbg(nfc, "write_oob: page:%d\n", page); - - memcpy(nfc->buf, chip->oob_poi, mtd->oobsize); - - return ar934x_nfc_send_write(nfc, NAND_CMD_PAGEPROG, mtd->writesize, - page, mtd->oobsize); -} - -static int -ar934x_nfc_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, - u8 *buf, int oob_required, int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - int len; - int err; - - nfc_dbg(nfc, "read_page_raw: page:%d oob:%d\n", page, oob_required); - - len = mtd->writesize; - if (oob_required) - len += mtd->oobsize; - - err = ar934x_nfc_send_read(nfc, NAND_CMD_READ0, 0, page, len); - if (err) - return err; - - memcpy(buf, nfc->buf, mtd->writesize); - - if (oob_required) - memcpy(chip->oob_poi, &nfc->buf[mtd->writesize], mtd->oobsize); - - return 0; -} - -static int -ar934x_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip, - u8 *buf, int oob_required, int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - u32 ecc_ctrl; - int max_bitflips = 0; - bool ecc_failed; - bool ecc_corrected; - int err; - - nfc_dbg(nfc, "read_page: page:%d oob:%d\n", page, oob_required); - - ar934x_nfc_enable_hwecc(nfc); - err = ar934x_nfc_send_read(nfc, NAND_CMD_READ0, 0, page, - mtd->writesize); - ar934x_nfc_disable_hwecc(nfc); - - if (err) - return err; - - /* TODO: optimize to avoid memcpy */ - memcpy(buf, nfc->buf, mtd->writesize); - - /* read the ECC status */ - ecc_ctrl = ar934x_nfc_rr(nfc, AR934X_NFC_REG_ECC_CTRL); - ecc_failed = ecc_ctrl & AR934X_NFC_ECC_CTRL_ERR_UNCORRECT; - ecc_corrected = ecc_ctrl & AR934X_NFC_ECC_CTRL_ERR_CORRECT; - - if (oob_required || ecc_failed) { - err = ar934x_nfc_send_read(nfc, NAND_CMD_READ0, mtd->writesize, - page, mtd->oobsize); - if (err) - return err; - - if (oob_required) - memcpy(chip->oob_poi, nfc->buf, mtd->oobsize); - } - - if (ecc_failed) { - /* - * The hardware ECC engine reports uncorrectable errors - * on empty pages. Check the ECC bytes and the data. If - * both contains 0xff bytes only, dont report a failure. - * - * TODO: prebuild a buffer with 0xff bytes and use memcmp - * for better performance? - */ - if (!is_all_ff(&nfc->buf[nfc->ecc_oob_pos], chip->ecc.total) || - !is_all_ff(buf, mtd->writesize)) - mtd->ecc_stats.failed++; - } else if (ecc_corrected) { - /* - * The hardware does not report the exact count of the - * corrected bitflips, use assumptions based on the - * threshold. - */ - if (ecc_ctrl & AR934X_NFC_ECC_CTRL_ERR_OVER) { - /* - * The number of corrected bitflips exceeds the - * threshold. Assume the maximum. - */ - max_bitflips = chip->ecc.strength * chip->ecc.steps; - } else { - max_bitflips = nfc->ecc_thres * chip->ecc.steps; - } - - mtd->ecc_stats.corrected += max_bitflips; - } - - return max_bitflips; -} - -static int -ar934x_nfc_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, - const u8 *buf, int oob_required, int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - int len; - - nfc_dbg(nfc, "write_page_raw: page:%d oob:%d\n", page, oob_required); - - memcpy(nfc->buf, buf, mtd->writesize); - len = mtd->writesize; - - if (oob_required) { - memcpy(&nfc->buf[mtd->writesize], chip->oob_poi, mtd->oobsize); - len += mtd->oobsize; - } - - return ar934x_nfc_send_write(nfc, NAND_CMD_PAGEPROG, 0, page, len); -} - -static int -ar934x_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip, - const u8 *buf, int oob_required, int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - int err; - - nfc_dbg(nfc, "write_page: page:%d oob:%d\n", page, oob_required); - - /* write OOB first */ - if (oob_required && - !is_all_ff(chip->oob_poi, mtd->oobsize)) { - err = ar934x_nfc_write_oob(mtd, chip, page); - if (err) - return err; - } - - /* TODO: optimize to avoid memcopy */ - memcpy(nfc->buf, buf, mtd->writesize); - - ar934x_nfc_enable_hwecc(nfc); - err = ar934x_nfc_send_write(nfc, NAND_CMD_PAGEPROG, 0, page, - mtd->writesize); - ar934x_nfc_disable_hwecc(nfc); - - return err; -} - -static void -ar934x_nfc_hw_init(struct ar934x_nfc *nfc) -{ - struct ar934x_nfc_platform_data *pdata; - - pdata = ar934x_nfc_get_platform_data(nfc); - if (pdata->hw_reset) { - pdata->hw_reset(true); - pdata->hw_reset(false); - } - - /* - * setup timings - * TODO: make it configurable via platform data - */ - ar934x_nfc_wr(nfc, AR934X_NFC_REG_TIME_SEQ, - AR934X_NFC_TIME_SEQ_DEFAULT); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_TIMINGS_ASYN, - AR934X_NFC_TIMINGS_ASYN_DEFAULT); - ar934x_nfc_wr(nfc, AR934X_NFC_REG_TIMINGS_SYN, - AR934X_NFC_TIMINGS_SYN_DEFAULT); - - /* disable WP on all chips, and select chip 0 */ - ar934x_nfc_wr(nfc, AR934X_NFC_REG_MEM_CTRL, 0xff00); - - ar934x_nfc_wr(nfc, AR934X_NFC_REG_DMA_ADDR_OFFS, 0); - - /* initialize Control register */ - nfc->ctrl_reg = AR934X_NFC_CTRL_CUSTOM_SIZE_EN; - ar934x_nfc_wr(nfc, AR934X_NFC_REG_CTRL, nfc->ctrl_reg); - - if (nfc->small_page) { - /* Setup generic sequence register for small page reads. */ - ar934x_nfc_wr(nfc, AR934X_NFC_REG_GEN_SEQ_CTRL, - AR934X_NFC_GENSEQ_SMALL_PAGE_READ); - } -} - -static void -ar934x_nfc_restart(struct ar934x_nfc *nfc) -{ - u32 ctrl_reg; - - if (nfc->select_chip) - nfc->select_chip(-1); - - ctrl_reg = nfc->ctrl_reg; - ar934x_nfc_hw_init(nfc); - nfc->ctrl_reg = ctrl_reg; - - if (nfc->select_chip) - nfc->select_chip(0); - - ar934x_nfc_send_cmd(nfc, NAND_CMD_RESET); -} - -static irqreturn_t -ar934x_nfc_irq_handler(int irq, void *data) -{ - struct ar934x_nfc *nfc = data; - u32 status; - - status = ar934x_nfc_rr(nfc, AR934X_NFC_REG_INT_STATUS); - - ar934x_nfc_wr(nfc, AR934X_NFC_REG_INT_STATUS, 0); - /* flush write */ - ar934x_nfc_rr(nfc, AR934X_NFC_REG_INT_STATUS); - - status &= ar934x_nfc_rr(nfc, AR934X_NFC_REG_INT_MASK); - if (status) { - nfc_dbg(nfc, "got IRQ, status:%08x\n", status); - - nfc->irq_status = status; - nfc->spurious_irq_expected = true; - wake_up(&nfc->irq_waitq); - } else { - if (nfc->spurious_irq_expected) { - nfc->spurious_irq_expected = false; - } else { - dev_warn(nfc->parent, "spurious interrupt\n"); - } - } - - return IRQ_HANDLED; -} - -static int -ar934x_nfc_init_tail(struct mtd_info *mtd) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - struct nand_chip *chip = &nfc->nand_chip; - u32 ctrl; - u32 t; - int err; - - switch (mtd->oobsize) { - case 16: - case 64: - case 128: - ar934x_nfc_wr(nfc, AR934X_NFC_REG_SPARE_SIZE, mtd->oobsize); - break; - - default: - dev_err(nfc->parent, "unsupported OOB size: %d bytes\n", - mtd->oobsize); - return -ENXIO; - } - - ctrl = AR934X_NFC_CTRL_CUSTOM_SIZE_EN; - - switch (mtd->erasesize / mtd->writesize) { - case 32: - t = AR934X_NFC_CTRL_BLOCK_SIZE_32; - break; - - case 64: - t = AR934X_NFC_CTRL_BLOCK_SIZE_64; - break; - - case 128: - t = AR934X_NFC_CTRL_BLOCK_SIZE_128; - break; - - case 256: - t = AR934X_NFC_CTRL_BLOCK_SIZE_256; - break; - - default: - dev_err(nfc->parent, "unsupported block size: %u\n", - mtd->erasesize / mtd->writesize); - return -ENXIO; - } - - ctrl |= t << AR934X_NFC_CTRL_BLOCK_SIZE_S; - - switch (mtd->writesize) { - case 256: - nfc->small_page = 1; - t = AR934X_NFC_CTRL_PAGE_SIZE_256; - break; - - case 512: - nfc->small_page = 1; - t = AR934X_NFC_CTRL_PAGE_SIZE_512; - break; - - case 1024: - t = AR934X_NFC_CTRL_PAGE_SIZE_1024; - break; - - case 2048: - t = AR934X_NFC_CTRL_PAGE_SIZE_2048; - break; - - case 4096: - t = AR934X_NFC_CTRL_PAGE_SIZE_4096; - break; - - case 8192: - t = AR934X_NFC_CTRL_PAGE_SIZE_8192; - break; - - case 16384: - t = AR934X_NFC_CTRL_PAGE_SIZE_16384; - break; - - default: - dev_err(nfc->parent, "unsupported write size: %d bytes\n", - mtd->writesize); - return -ENXIO; - } - - ctrl |= t << AR934X_NFC_CTRL_PAGE_SIZE_S; - - if (nfc->small_page) { - ctrl |= AR934X_NFC_CTRL_SMALL_PAGE; - - if (chip->chipsize > (32 << 20)) { - nfc->addr_count0 = 4; - nfc->addr_count1 = 3; - } else if (chip->chipsize > (2 << 16)) { - nfc->addr_count0 = 3; - nfc->addr_count1 = 2; - } else { - nfc->addr_count0 = 2; - nfc->addr_count1 = 1; - } - } else { - if (chip->chipsize > (128 << 20)) { - nfc->addr_count0 = 5; - nfc->addr_count1 = 3; - } else if (chip->chipsize > (8 << 16)) { - nfc->addr_count0 = 4; - nfc->addr_count1 = 2; - } else { - nfc->addr_count0 = 3; - nfc->addr_count1 = 1; - } - } - - ctrl |= nfc->addr_count0 << AR934X_NFC_CTRL_ADDR_CYCLE0_S; - ctrl |= nfc->addr_count1 << AR934X_NFC_CTRL_ADDR_CYCLE1_S; - - nfc->ctrl_reg = ctrl; - ar934x_nfc_wr(nfc, AR934X_NFC_REG_CTRL, nfc->ctrl_reg); - - ar934x_nfc_free_buf(nfc); - err = ar934x_nfc_alloc_buf(nfc, mtd->writesize + mtd->oobsize); - - return err; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -static struct nand_ecclayout ar934x_nfc_oob_64_hwecc = { - .eccbytes = 28, - .eccpos = { - 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, - }, - .oobfree = { - { - .offset = 4, - .length = 16, - }, - { - .offset = 48, - .length = 16, - }, - }, -}; - -#else - -static int ar934x_nfc_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - if (section) - return -ERANGE; - - oobregion->offset = 20; - oobregion->length = 28; - - return 0; -} - -static int ar934x_nfc_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 4; - oobregion->length = 16; - return 0; - case 1: - oobregion->offset = 48; - oobregion->length = 16; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops ar934x_nfc_ecclayout_ops = { - .ecc = ar934x_nfc_ooblayout_ecc, - .free = ar934x_nfc_ooblayout_free, -}; -#endif /* < 4.6 */ - -static int -ar934x_nfc_setup_hwecc(struct ar934x_nfc *nfc) -{ - struct nand_chip *nand = &nfc->nand_chip; - struct mtd_info *mtd = ar934x_nfc_to_mtd(nfc); - u32 ecc_cap; - u32 ecc_thres; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) - struct mtd_oob_region oobregion; -#endif - - if (!IS_ENABLED(CONFIG_MTD_NAND_AR934X_HW_ECC)) { - dev_err(nfc->parent, "hardware ECC support is disabled\n"); - return -EINVAL; - } - - switch (mtd->writesize) { - case 2048: - /* - * Writing a subpage separately is not supported, because - * the controller only does ECC on full-page accesses. - */ - nand->options = NAND_NO_SUBPAGE_WRITE; - - nand->ecc.size = 512; - nand->ecc.bytes = 7; - nand->ecc.strength = 4; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - nand->ecc.layout = &ar934x_nfc_oob_64_hwecc; -#else - mtd_set_ooblayout(mtd, &ar934x_nfc_ecclayout_ops); -#endif - break; - - default: - dev_err(nfc->parent, - "hardware ECC is not available for %d byte pages\n", - mtd->writesize); - return -EINVAL; - } - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - BUG_ON(!nand->ecc.layout); -#else - BUG_ON(!mtd->ooblayout->ecc); -#endif - - switch (nand->ecc.strength) { - case 4: - ecc_cap = AR934X_NFC_ECC_CTRL_ECC_CAP_4; - ecc_thres = 4; - break; - - default: - dev_err(nfc->parent, "unsupported ECC strength %u\n", - nand->ecc.strength); - return -EINVAL; - } - - nfc->ecc_thres = ecc_thres; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - nfc->ecc_oob_pos = nand->ecc.layout->eccpos[0]; -#else - mtd->ooblayout->ecc(mtd, 0, &oobregion); - nfc->ecc_oob_pos = oobregion.offset; -#endif - - nfc->ecc_ctrl_reg = ecc_cap << AR934X_NFC_ECC_CTRL_ECC_CAP_S; - nfc->ecc_ctrl_reg |= ecc_thres << AR934X_NFC_ECC_CTRL_ERR_THRES_S; - - nfc->ecc_offset_reg = mtd->writesize + nfc->ecc_oob_pos; - - nand->ecc.mode = NAND_ECC_HW; - nand->ecc.read_page = ar934x_nfc_read_page; - nand->ecc.read_page_raw = ar934x_nfc_read_page_raw; - nand->ecc.write_page = ar934x_nfc_write_page; - nand->ecc.write_page_raw = ar934x_nfc_write_page_raw; - nand->ecc.read_oob = ar934x_nfc_read_oob; - nand->ecc.write_oob = ar934x_nfc_write_oob; - - return 0; -} - -static int -ar934x_nfc_probe(struct platform_device *pdev) -{ - static const char *part_probes[] = { "cmdlinepart", NULL, }; - struct ar934x_nfc_platform_data *pdata; - struct ar934x_nfc *nfc; - struct resource *res; - struct mtd_info *mtd; - struct nand_chip *nand; - struct mtd_part_parser_data ppdata; - int ret; - - pdata = pdev->dev.platform_data; - if (pdata == NULL) { - dev_err(&pdev->dev, "no platform data defined\n"); - return -EINVAL; - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "failed to get I/O memory\n"); - return -EINVAL; - } - - nfc = devm_kzalloc(&pdev->dev, sizeof(struct ar934x_nfc), GFP_KERNEL); - if (!nfc) { - dev_err(&pdev->dev, "failed to allocate driver data\n"); - return -ENOMEM; - } - - nfc->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(nfc->base)) { - dev_err(&pdev->dev, "failed to remap I/O memory\n"); - return PTR_ERR(nfc->base); - } - - nfc->irq = platform_get_irq(pdev, 0); - if (nfc->irq < 0) { - dev_err(&pdev->dev, "no IRQ resource specified\n"); - return -EINVAL; - } - - init_waitqueue_head(&nfc->irq_waitq); - ret = request_irq(nfc->irq, ar934x_nfc_irq_handler, 0, - dev_name(&pdev->dev), nfc); - if (ret) { - dev_err(&pdev->dev, "requast_irq failed, err:%d\n", ret); - return ret; - } - - nfc->parent = &pdev->dev; - nfc->select_chip = pdata->select_chip; - nfc->swap_dma = pdata->swap_dma; - - nand = &nfc->nand_chip; - mtd = ar934x_nfc_to_mtd(nfc); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - mtd->priv = nand; -#endif - mtd->owner = THIS_MODULE; - if (pdata->name) - mtd->name = pdata->name; - else - mtd->name = dev_name(&pdev->dev); - - nand->chip_delay = 25; - - nand->dev_ready = ar934x_nfc_dev_ready; - nand->cmdfunc = ar934x_nfc_cmdfunc; - nand->read_byte = ar934x_nfc_read_byte; - nand->write_buf = ar934x_nfc_write_buf; - nand->read_buf = ar934x_nfc_read_buf; - nand->select_chip = ar934x_nfc_select_chip; - - ret = ar934x_nfc_alloc_buf(nfc, AR934X_NFC_ID_BUF_SIZE); - if (ret) - goto err_free_irq; - - platform_set_drvdata(pdev, nfc); - - ar934x_nfc_hw_init(nfc); - - ret = nand_scan_ident(mtd, 1, NULL); - if (ret) { - dev_err(&pdev->dev, "nand_scan_ident failed, err:%d\n", ret); - goto err_free_buf; - } - - ret = ar934x_nfc_init_tail(mtd); - if (ret) { - dev_err(&pdev->dev, "init tail failed, err:%d\n", ret); - goto err_free_buf; - } - - if (pdata->scan_fixup) { - ret = pdata->scan_fixup(mtd); - if (ret) - goto err_free_buf; - } - - switch (pdata->ecc_mode) { - case AR934X_NFC_ECC_SOFT: - nand->ecc.mode = NAND_ECC_SOFT; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) - nand->ecc.algo = NAND_ECC_HAMMING; -#endif - break; - - case AR934X_NFC_ECC_SOFT_BCH: -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - nand->ecc.mode = NAND_ECC_SOFT_BCH; -#else - nand->ecc.mode = NAND_ECC_SOFT; - nand->ecc.algo = NAND_ECC_BCH; -#endif - break; - - case AR934X_NFC_ECC_HW: - ret = ar934x_nfc_setup_hwecc(nfc); - if (ret) - goto err_free_buf; - - break; - - default: - dev_err(nfc->parent, "unknown ECC mode %d\n", pdata->ecc_mode); - return -EINVAL; - } - - ret = nand_scan_tail(mtd); - if (ret) { - dev_err(&pdev->dev, "scan tail failed, err:%d\n", ret); - goto err_free_buf; - } - - memset(&ppdata, '\0', sizeof(ppdata)); - ret = mtd_device_parse_register(mtd, part_probes, &ppdata, - pdata->parts, pdata->nr_parts); - if (ret) { - dev_err(&pdev->dev, "unable to register mtd, err:%d\n", ret); - goto err_free_buf; - } - - return 0; - -err_free_buf: - ar934x_nfc_free_buf(nfc); -err_free_irq: - free_irq(nfc->irq, nfc); - return ret; -} - -static int -ar934x_nfc_remove(struct platform_device *pdev) -{ - struct ar934x_nfc *nfc; - struct mtd_info *mtd; - - nfc = platform_get_drvdata(pdev); - if (nfc) { - mtd = ar934x_nfc_to_mtd(nfc); - nand_release(mtd); - ar934x_nfc_free_buf(nfc); - free_irq(nfc->irq, nfc); - } - - return 0; -} - -static struct platform_driver ar934x_nfc_driver = { - .probe = ar934x_nfc_probe, - .remove = ar934x_nfc_remove, - .driver = { - .name = AR934X_NFC_DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -module_platform_driver(ar934x_nfc_driver); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_DESCRIPTION("Atheros AR934x NAND Flash Controller driver"); -MODULE_ALIAS("platform:" AR934X_NFC_DRIVER_NAME); diff --git a/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb4xx_nand.c b/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb4xx_nand.c deleted file mode 100644 index 262e3fa09..000000000 --- a/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb4xx_nand.c +++ /dev/null @@ -1,392 +0,0 @@ -/* - * NAND flash driver for the MikroTik RouterBoard 4xx series - * - * Copyright (C) 2008-2011 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * This file was based on the driver for Linux 2.6.22 published by - * MikroTik for their RouterBoard 4xx series devices. - * - * 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 DRV_NAME "rb4xx-nand" -#define DRV_VERSION "0.2.0" -#define DRV_DESC "NAND flash driver for RouterBoard 4xx series" - -#define RB4XX_NAND_GPIO_READY 5 -#define RB4XX_NAND_GPIO_ALE 37 -#define RB4XX_NAND_GPIO_CLE 38 -#define RB4XX_NAND_GPIO_NCE 39 - -struct rb4xx_nand_info { - struct nand_chip chip; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct mtd_info mtd; -#endif -}; - -static inline struct rb4xx_nand_info *mtd_to_rbinfo(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - return container_of(mtd, struct rb4xx_nand_info, mtd); -#else - struct nand_chip *chip = mtd_to_nand(mtd); - - return container_of(chip, struct rb4xx_nand_info, chip); -#endif -} - -static struct mtd_info *rbinfo_to_mtd(struct rb4xx_nand_info *nfc) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - return &nfc->mtd; -#else - return nand_to_mtd(&nfc->chip); -#endif -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -/* - * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader - * will not be able to find the kernel that we load. - */ -static struct nand_ecclayout rb4xx_nand_ecclayout = { - .eccbytes = 6, - .eccpos = { 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } -}; - -#else - -static int rb4xx_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 8; - oobregion->length = 3; - return 0; - case 1: - oobregion->offset = 13; - oobregion->length = 3; - return 0; - default: - return -ERANGE; - } -} - -static int rb4xx_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 0; - oobregion->length = 4; - return 0; - case 1: - oobregion->offset = 4; - oobregion->length = 1; - return 0; - case 2: - oobregion->offset = 6; - oobregion->length = 2; - return 0; - case 3: - oobregion->offset = 11; - oobregion->length = 2; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops rb4xx_nand_ecclayout_ops = { - .ecc = rb4xx_ooblayout_ecc, - .free = rb4xx_ooblayout_free, -}; -#endif /* < 4.6 */ - -static struct mtd_partition rb4xx_nand_partitions[] = { - { - .name = "booter", - .offset = 0, - .size = (256 * 1024), - .mask_flags = MTD_WRITEABLE, - }, - { - .name = "kernel", - .offset = (256 * 1024), - .size = (4 * 1024 * 1024) - (256 * 1024), - }, - { - .name = "ubi", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL, - }, -}; - -static int rb4xx_nand_dev_ready(struct mtd_info *mtd) -{ - return gpio_get_value_cansleep(RB4XX_NAND_GPIO_READY); -} - -static void rb4xx_nand_write_cmd(unsigned char cmd) -{ - unsigned char data = cmd; - int err; - - err = rb4xx_cpld_write(&data, 1); - if (err) - pr_err("rb4xx_nand: write cmd failed, err=%d\n", err); -} - -static void rb4xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, - unsigned int ctrl) -{ - if (ctrl & NAND_CTRL_CHANGE) { - gpio_set_value_cansleep(RB4XX_NAND_GPIO_CLE, - (ctrl & NAND_CLE) ? 1 : 0); - gpio_set_value_cansleep(RB4XX_NAND_GPIO_ALE, - (ctrl & NAND_ALE) ? 1 : 0); - gpio_set_value_cansleep(RB4XX_NAND_GPIO_NCE, - (ctrl & NAND_NCE) ? 0 : 1); - } - - if (cmd != NAND_CMD_NONE) - rb4xx_nand_write_cmd(cmd); -} - -static unsigned char rb4xx_nand_read_byte(struct mtd_info *mtd) -{ - unsigned char data = 0; - int err; - - err = rb4xx_cpld_read(&data, 1); - if (err) { - pr_err("rb4xx_nand: read data failed, err=%d\n", err); - data = 0xff; - } - - return data; -} - -static void rb4xx_nand_write_buf(struct mtd_info *mtd, const unsigned char *buf, - int len) -{ - int err; - - err = rb4xx_cpld_write(buf, len); - if (err) - pr_err("rb4xx_nand: write buf failed, err=%d\n", err); -} - -static void rb4xx_nand_read_buf(struct mtd_info *mtd, unsigned char *buf, - int len) -{ - int err; - - err = rb4xx_cpld_read(buf, len); - if (err) - pr_err("rb4xx_nand: read buf failed, err=%d\n", err); -} - -static int rb4xx_nand_probe(struct platform_device *pdev) -{ - struct rb4xx_nand_info *info; - struct mtd_info *mtd; - int ret; - - printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n"); - - ret = gpio_request(RB4XX_NAND_GPIO_READY, "NAND RDY"); - if (ret) { - dev_err(&pdev->dev, "unable to request gpio %d\n", - RB4XX_NAND_GPIO_READY); - goto err; - } - - ret = gpio_direction_input(RB4XX_NAND_GPIO_READY); - if (ret) { - dev_err(&pdev->dev, "unable to set input mode on gpio %d\n", - RB4XX_NAND_GPIO_READY); - goto err_free_gpio_ready; - } - - ret = gpio_request(RB4XX_NAND_GPIO_ALE, "NAND ALE"); - if (ret) { - dev_err(&pdev->dev, "unable to request gpio %d\n", - RB4XX_NAND_GPIO_ALE); - goto err_free_gpio_ready; - } - - ret = gpio_direction_output(RB4XX_NAND_GPIO_ALE, 0); - if (ret) { - dev_err(&pdev->dev, "unable to set output mode on gpio %d\n", - RB4XX_NAND_GPIO_ALE); - goto err_free_gpio_ale; - } - - ret = gpio_request(RB4XX_NAND_GPIO_CLE, "NAND CLE"); - if (ret) { - dev_err(&pdev->dev, "unable to request gpio %d\n", - RB4XX_NAND_GPIO_CLE); - goto err_free_gpio_ale; - } - - ret = gpio_direction_output(RB4XX_NAND_GPIO_CLE, 0); - if (ret) { - dev_err(&pdev->dev, "unable to set output mode on gpio %d\n", - RB4XX_NAND_GPIO_CLE); - goto err_free_gpio_cle; - } - - ret = gpio_request(RB4XX_NAND_GPIO_NCE, "NAND NCE"); - if (ret) { - dev_err(&pdev->dev, "unable to request gpio %d\n", - RB4XX_NAND_GPIO_NCE); - goto err_free_gpio_cle; - } - - ret = gpio_direction_output(RB4XX_NAND_GPIO_NCE, 1); - if (ret) { - dev_err(&pdev->dev, "unable to set output mode on gpio %d\n", - RB4XX_NAND_GPIO_ALE); - goto err_free_gpio_nce; - } - - info = kzalloc(sizeof(*info), GFP_KERNEL); - if (!info) { - dev_err(&pdev->dev, "rb4xx-nand: no memory for private data\n"); - ret = -ENOMEM; - goto err_free_gpio_nce; - } - - info->chip.priv = &info; - mtd = rbinfo_to_mtd(info); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - mtd->priv = &info->chip; -#endif - mtd->owner = THIS_MODULE; - - info->chip.cmd_ctrl = rb4xx_nand_cmd_ctrl; - info->chip.dev_ready = rb4xx_nand_dev_ready; - info->chip.read_byte = rb4xx_nand_read_byte; - info->chip.write_buf = rb4xx_nand_write_buf; - info->chip.read_buf = rb4xx_nand_read_buf; - - info->chip.chip_delay = 25; - info->chip.ecc.mode = NAND_ECC_SOFT; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) - info->chip.ecc.algo = NAND_ECC_HAMMING; -#endif - info->chip.options = NAND_NO_SUBPAGE_WRITE; - - platform_set_drvdata(pdev, info); - - ret = nand_scan_ident(mtd, 1, NULL); - if (ret) { - ret = -ENXIO; - goto err_free_info; - } - - if (mtd->writesize == 512) -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - info->chip.ecc.layout = &rb4xx_nand_ecclayout; -#else - mtd_set_ooblayout(mtd, &rb4xx_nand_ecclayout_ops); -#endif - - ret = nand_scan_tail(mtd); - if (ret) { - return -ENXIO; - goto err_set_drvdata; - } - - mtd_device_register(mtd, rb4xx_nand_partitions, - ARRAY_SIZE(rb4xx_nand_partitions)); - if (ret) - goto err_release_nand; - - return 0; - -err_release_nand: - nand_release(mtd); -err_set_drvdata: - platform_set_drvdata(pdev, NULL); -err_free_info: - kfree(info); -err_free_gpio_nce: - gpio_free(RB4XX_NAND_GPIO_NCE); -err_free_gpio_cle: - gpio_free(RB4XX_NAND_GPIO_CLE); -err_free_gpio_ale: - gpio_free(RB4XX_NAND_GPIO_ALE); -err_free_gpio_ready: - gpio_free(RB4XX_NAND_GPIO_READY); -err: - return ret; -} - -static int rb4xx_nand_remove(struct platform_device *pdev) -{ - struct rb4xx_nand_info *info = platform_get_drvdata(pdev); - - nand_release(rbinfo_to_mtd(info)); - platform_set_drvdata(pdev, NULL); - kfree(info); - gpio_free(RB4XX_NAND_GPIO_NCE); - gpio_free(RB4XX_NAND_GPIO_CLE); - gpio_free(RB4XX_NAND_GPIO_ALE); - gpio_free(RB4XX_NAND_GPIO_READY); - - return 0; -} - -static struct platform_driver rb4xx_nand_driver = { - .probe = rb4xx_nand_probe, - .remove = rb4xx_nand_remove, - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init rb4xx_nand_init(void) -{ - return platform_driver_register(&rb4xx_nand_driver); -} - -static void __exit rb4xx_nand_exit(void) -{ - platform_driver_unregister(&rb4xx_nand_driver); -} - -module_init(rb4xx_nand_init); -module_exit(rb4xx_nand_exit); - -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_AUTHOR("Imre Kaloz "); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb750_nand.c b/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb750_nand.c deleted file mode 100644 index d12be8852..000000000 --- a/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb750_nand.c +++ /dev/null @@ -1,436 +0,0 @@ -/* - * NAND flash driver for the MikroTik RouterBOARD 750 - * - * Copyright (C) 2010-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 -#include -#include - -#include -#include -#include - -#define DRV_NAME "rb750-nand" -#define DRV_VERSION "0.1.0" -#define DRV_DESC "NAND flash driver for the RouterBOARD 750" - -#define RB750_NAND_IO0 BIT(RB750_GPIO_NAND_IO0) -#define RB750_NAND_ALE BIT(RB750_GPIO_NAND_ALE) -#define RB750_NAND_CLE BIT(RB750_GPIO_NAND_CLE) -#define RB750_NAND_NRE BIT(RB750_GPIO_NAND_NRE) -#define RB750_NAND_NWE BIT(RB750_GPIO_NAND_NWE) -#define RB750_NAND_RDY BIT(RB750_GPIO_NAND_RDY) - -#define RB750_NAND_DATA_SHIFT 1 -#define RB750_NAND_DATA_BITS (0xff << RB750_NAND_DATA_SHIFT) -#define RB750_NAND_INPUT_BITS (RB750_NAND_DATA_BITS | RB750_NAND_RDY) -#define RB750_NAND_OUTPUT_BITS (RB750_NAND_ALE | RB750_NAND_CLE | \ - RB750_NAND_NRE | RB750_NAND_NWE) - -struct rb750_nand_info { - struct nand_chip chip; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct mtd_info mtd; -#endif - struct rb7xx_nand_platform_data *pdata; -}; - -static inline struct rb750_nand_info *mtd_to_rbinfo(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - return container_of(mtd, struct rb750_nand_info, mtd); -#else - struct nand_chip *chip = mtd_to_nand(mtd); - - return container_of(chip, struct rb750_nand_info, chip); -#endif -} - -static struct mtd_info *rbinfo_to_mtd(struct rb750_nand_info *nfc) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - return &nfc->mtd; -#else - return nand_to_mtd(&nfc->chip); -#endif -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -/* - * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader - * will not be able to find the kernel that we load. - */ -static struct nand_ecclayout rb750_nand_ecclayout = { - .eccbytes = 6, - .eccpos = { 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } -}; - -#else - -static int rb750_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 8; - oobregion->length = 3; - return 0; - case 1: - oobregion->offset = 13; - oobregion->length = 3; - return 0; - default: - return -ERANGE; - } -} - -static int rb750_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 0; - oobregion->length = 4; - return 0; - case 1: - oobregion->offset = 4; - oobregion->length = 1; - return 0; - case 2: - oobregion->offset = 6; - oobregion->length = 2; - return 0; - case 3: - oobregion->offset = 11; - oobregion->length = 2; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops rb750_nand_ecclayout_ops = { - .ecc = rb750_ooblayout_ecc, - .free = rb750_ooblayout_free, -}; -#endif /* < 4.6 */ - -static struct mtd_partition rb750_nand_partitions[] = { - { - .name = "booter", - .offset = 0, - .size = (256 * 1024), - .mask_flags = MTD_WRITEABLE, - }, { - .name = "kernel", - .offset = (256 * 1024), - .size = (4 * 1024 * 1024) - (256 * 1024), - }, { - .name = "ubi", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL, - }, -}; - -static void rb750_nand_write(const u8 *buf, unsigned len) -{ - void __iomem *base = ath79_gpio_base; - u32 out; - u32 t; - unsigned i; - - /* set data lines to output mode */ - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - __raw_writel(t | RB750_NAND_DATA_BITS, base + AR71XX_GPIO_REG_OE); - - out = __raw_readl(base + AR71XX_GPIO_REG_OUT); - out &= ~(RB750_NAND_DATA_BITS | RB750_NAND_NWE); - for (i = 0; i != len; i++) { - u32 data; - - data = buf[i]; - data <<= RB750_NAND_DATA_SHIFT; - data |= out; - __raw_writel(data, base + AR71XX_GPIO_REG_OUT); - - __raw_writel(data | RB750_NAND_NWE, base + AR71XX_GPIO_REG_OUT); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_OUT); - } - - /* set data lines to input mode */ - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - __raw_writel(t & ~RB750_NAND_DATA_BITS, base + AR71XX_GPIO_REG_OE); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_OE); -} - -static void rb750_nand_read(u8 *read_buf, unsigned len) -{ - void __iomem *base = ath79_gpio_base; - unsigned i; - - for (i = 0; i < len; i++) { - u8 data; - - /* activate RE line */ - __raw_writel(RB750_NAND_NRE, base + AR71XX_GPIO_REG_CLEAR); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_CLEAR); - - /* read input lines */ - data = __raw_readl(base + AR71XX_GPIO_REG_IN) >> - RB750_NAND_DATA_SHIFT; - - /* deactivate RE line */ - __raw_writel(RB750_NAND_NRE, base + AR71XX_GPIO_REG_SET); - - read_buf[i] = data; - } -} - -static void rb750_nand_select_chip(struct mtd_info *mtd, int chip) -{ - struct rb750_nand_info *rbinfo = mtd_to_rbinfo(mtd); - void __iomem *base = ath79_gpio_base; - u32 t; - - if (chip >= 0) { - rbinfo->pdata->enable_pins(); - - /* set input mode for data lines */ - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - __raw_writel(t & ~RB750_NAND_INPUT_BITS, - base + AR71XX_GPIO_REG_OE); - - /* deactivate RE and WE lines */ - __raw_writel(RB750_NAND_NRE | RB750_NAND_NWE, - base + AR71XX_GPIO_REG_SET); - /* flush write */ - (void) __raw_readl(base + AR71XX_GPIO_REG_SET); - - /* activate CE line */ - __raw_writel(rbinfo->pdata->nce_line, - base + AR71XX_GPIO_REG_CLEAR); - } else { - /* deactivate CE line */ - __raw_writel(rbinfo->pdata->nce_line, - base + AR71XX_GPIO_REG_SET); - /* flush write */ - (void) __raw_readl(base + AR71XX_GPIO_REG_SET); - - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - __raw_writel(t | RB750_NAND_IO0 | RB750_NAND_RDY, - base + AR71XX_GPIO_REG_OE); - - rbinfo->pdata->disable_pins(); - } -} - -static int rb750_nand_dev_ready(struct mtd_info *mtd) -{ - void __iomem *base = ath79_gpio_base; - - return !!(__raw_readl(base + AR71XX_GPIO_REG_IN) & RB750_NAND_RDY); -} - -static void rb750_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, - unsigned int ctrl) -{ - if (ctrl & NAND_CTRL_CHANGE) { - void __iomem *base = ath79_gpio_base; - u32 t; - - t = __raw_readl(base + AR71XX_GPIO_REG_OUT); - - t &= ~(RB750_NAND_CLE | RB750_NAND_ALE); - t |= (ctrl & NAND_CLE) ? RB750_NAND_CLE : 0; - t |= (ctrl & NAND_ALE) ? RB750_NAND_ALE : 0; - - __raw_writel(t, base + AR71XX_GPIO_REG_OUT); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_OUT); - } - - if (cmd != NAND_CMD_NONE) { - u8 t = cmd; - rb750_nand_write(&t, 1); - } -} - -static u8 rb750_nand_read_byte(struct mtd_info *mtd) -{ - u8 data = 0; - rb750_nand_read(&data, 1); - return data; -} - -static void rb750_nand_read_buf(struct mtd_info *mtd, u8 *buf, int len) -{ - rb750_nand_read(buf, len); -} - -static void rb750_nand_write_buf(struct mtd_info *mtd, const u8 *buf, int len) -{ - rb750_nand_write(buf, len); -} - -static void __init rb750_nand_gpio_init(struct rb750_nand_info *info) -{ - void __iomem *base = ath79_gpio_base; - u32 out; - u32 t; - - out = __raw_readl(base + AR71XX_GPIO_REG_OUT); - - /* setup output levels */ - __raw_writel(RB750_NAND_NCE | RB750_NAND_NRE | RB750_NAND_NWE, - base + AR71XX_GPIO_REG_SET); - - __raw_writel(RB750_NAND_ALE | RB750_NAND_CLE, - base + AR71XX_GPIO_REG_CLEAR); - - /* setup input lines */ - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - __raw_writel(t & ~(RB750_NAND_INPUT_BITS), base + AR71XX_GPIO_REG_OE); - - /* setup output lines */ - t = __raw_readl(base + AR71XX_GPIO_REG_OE); - t |= RB750_NAND_OUTPUT_BITS; - t |= info->pdata->nce_line; - __raw_writel(t, base + AR71XX_GPIO_REG_OE); - - info->pdata->latch_change(~out & RB750_NAND_IO0, out & RB750_NAND_IO0); -} - -static int rb750_nand_probe(struct platform_device *pdev) -{ - struct rb750_nand_info *info; - struct rb7xx_nand_platform_data *pdata; - struct mtd_info *mtd; - int ret; - - printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n"); - - pdata = pdev->dev.platform_data; - if (!pdata) - return -EINVAL; - - info = kzalloc(sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - info->chip.priv = &info; - - mtd = rbinfo_to_mtd(info); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - mtd->priv = &info->chip; -#endif - mtd->owner = THIS_MODULE; - - info->chip.select_chip = rb750_nand_select_chip; - info->chip.cmd_ctrl = rb750_nand_cmd_ctrl; - info->chip.dev_ready = rb750_nand_dev_ready; - info->chip.read_byte = rb750_nand_read_byte; - info->chip.write_buf = rb750_nand_write_buf; - info->chip.read_buf = rb750_nand_read_buf; - - info->chip.chip_delay = 25; - info->chip.ecc.mode = NAND_ECC_SOFT; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) - info->chip.ecc.algo = NAND_ECC_HAMMING; -#endif - info->chip.options = NAND_NO_SUBPAGE_WRITE; - - info->pdata = pdata; - - platform_set_drvdata(pdev, info); - - rb750_nand_gpio_init(info); - - ret = nand_scan_ident(mtd, 1, NULL); - if (ret) { - ret = -ENXIO; - goto err_free_info; - } - - if (mtd->writesize == 512) -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - info->chip.ecc.layout = &rb750_nand_ecclayout; -#else - mtd_set_ooblayout(mtd, &rb750_nand_ecclayout_ops); -#endif - - ret = nand_scan_tail(mtd); - if (ret) { - return -ENXIO; - goto err_set_drvdata; - } - - ret = mtd_device_register(mtd, rb750_nand_partitions, - ARRAY_SIZE(rb750_nand_partitions)); - if (ret) - goto err_release_nand; - - return 0; - -err_release_nand: - nand_release(mtd); -err_set_drvdata: - platform_set_drvdata(pdev, NULL); -err_free_info: - kfree(info); - return ret; -} - -static int rb750_nand_remove(struct platform_device *pdev) -{ - struct rb750_nand_info *info = platform_get_drvdata(pdev); - - nand_release(rbinfo_to_mtd(info)); - platform_set_drvdata(pdev, NULL); - kfree(info); - - return 0; -} - -static struct platform_driver rb750_nand_driver = { - .probe = rb750_nand_probe, - .remove = rb750_nand_remove, - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init rb750_nand_init(void) -{ - return platform_driver_register(&rb750_nand_driver); -} - -static void __exit rb750_nand_exit(void) -{ - platform_driver_unregister(&rb750_nand_driver); -} - -module_init(rb750_nand_init); -module_exit(rb750_nand_exit); - -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb91x_nand.c b/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb91x_nand.c deleted file mode 100644 index ac50b87fd..000000000 --- a/target/linux/ar71xx/files-4.14/drivers/mtd/nand/rb91x_nand.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - * NAND flash driver for the MikroTik RouterBOARD 91x series - * - * Copyright (C) 2013-2014 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define DRV_DESC "NAND flash driver for the RouterBOARD 91x series" - -#define RB91X_NAND_NRWE BIT(12) - -#define RB91X_NAND_DATA_BITS (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) |\ - BIT(13) | BIT(14) | BIT(15)) - -#define RB91X_NAND_INPUT_BITS (RB91X_NAND_DATA_BITS | RB91X_NAND_RDY) -#define RB91X_NAND_OUTPUT_BITS (RB91X_NAND_DATA_BITS | RB91X_NAND_NRWE) - -#define RB91X_NAND_LOW_DATA_MASK 0x1f -#define RB91X_NAND_HIGH_DATA_MASK 0xe0 -#define RB91X_NAND_HIGH_DATA_SHIFT 8 - -struct rb91x_nand_info { - struct nand_chip chip; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct mtd_info mtd; -#endif - struct device *dev; - - int gpio_nce; - int gpio_ale; - int gpio_cle; - int gpio_rdy; - int gpio_read; - int gpio_nrw; - int gpio_nle; -}; - -static inline struct rb91x_nand_info *mtd_to_rbinfo(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - return container_of(mtd, struct rb91x_nand_info, mtd); -#else - struct nand_chip *chip = mtd_to_nand(mtd); - - return container_of(chip, struct rb91x_nand_info, chip); -#endif -} - -static struct mtd_info *rbinfo_to_mtd(struct rb91x_nand_info *nfc) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - return &nfc->mtd; -#else - return nand_to_mtd(&nfc->chip); -#endif -} - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -/* - * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader - * will not be able to find the kernel that we load. - */ -static struct nand_ecclayout rb91x_nand_ecclayout = { - .eccbytes = 6, - .eccpos = { 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } -}; - -#else - -static int rb91x_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 8; - oobregion->length = 3; - return 0; - case 1: - oobregion->offset = 13; - oobregion->length = 3; - return 0; - default: - return -ERANGE; - } -} - -static int rb91x_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 0; - oobregion->length = 4; - return 0; - case 1: - oobregion->offset = 4; - oobregion->length = 1; - return 0; - case 2: - oobregion->offset = 6; - oobregion->length = 2; - return 0; - case 3: - oobregion->offset = 11; - oobregion->length = 2; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops rb91x_nand_ecclayout_ops = { - .ecc = rb91x_ooblayout_ecc, - .free = rb91x_ooblayout_free, -}; -#endif /* < 4.6 */ - -static struct mtd_partition rb91x_nand_partitions[] = { - { - .name = "booter", - .offset = 0, - .size = (256 * 1024), - .mask_flags = MTD_WRITEABLE, - }, { - .name = "kernel", - .offset = (256 * 1024), - .size = (4 * 1024 * 1024) - (256 * 1024), - }, { - .name = "ubi", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL, - }, -}; - -static void rb91x_nand_write(struct rb91x_nand_info *rbni, - const u8 *buf, - unsigned len) -{ - void __iomem *base = ath79_gpio_base; - u32 oe_reg; - u32 out_reg; - u32 out; - unsigned i; - - /* enable the latch */ - gpio_set_value_cansleep(rbni->gpio_nle, 0); - - oe_reg = __raw_readl(base + AR71XX_GPIO_REG_OE); - out_reg = __raw_readl(base + AR71XX_GPIO_REG_OUT); - - /* set data lines to output mode */ - __raw_writel(oe_reg & ~(RB91X_NAND_DATA_BITS | RB91X_NAND_NRWE), - base + AR71XX_GPIO_REG_OE); - - out = out_reg & ~(RB91X_NAND_DATA_BITS | RB91X_NAND_NRWE); - for (i = 0; i != len; i++) { - u32 data; - - data = (buf[i] & RB91X_NAND_HIGH_DATA_MASK) << - RB91X_NAND_HIGH_DATA_SHIFT; - data |= buf[i] & RB91X_NAND_LOW_DATA_MASK; - data |= out; - __raw_writel(data, base + AR71XX_GPIO_REG_OUT); - - /* deactivate WE line */ - data |= RB91X_NAND_NRWE; - __raw_writel(data, base + AR71XX_GPIO_REG_OUT); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_OUT); - } - - /* restore registers */ - __raw_writel(out_reg, base + AR71XX_GPIO_REG_OUT); - __raw_writel(oe_reg, base + AR71XX_GPIO_REG_OE); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_OUT); - - /* disable the latch */ - gpio_set_value_cansleep(rbni->gpio_nle, 1); -} - -static void rb91x_nand_read(struct rb91x_nand_info *rbni, - u8 *read_buf, - unsigned len) -{ - void __iomem *base = ath79_gpio_base; - u32 oe_reg; - u32 out_reg; - unsigned i; - - /* enable read mode */ - gpio_set_value_cansleep(rbni->gpio_read, 1); - - /* enable latch */ - gpio_set_value_cansleep(rbni->gpio_nle, 0); - - /* save registers */ - oe_reg = __raw_readl(base + AR71XX_GPIO_REG_OE); - out_reg = __raw_readl(base + AR71XX_GPIO_REG_OUT); - - /* set data lines to input mode */ - __raw_writel(oe_reg | RB91X_NAND_DATA_BITS, - base + AR71XX_GPIO_REG_OE); - - for (i = 0; i < len; i++) { - u32 in; - u8 data; - - /* activate RE line */ - __raw_writel(RB91X_NAND_NRWE, base + AR71XX_GPIO_REG_CLEAR); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_CLEAR); - - /* read input lines */ - in = __raw_readl(base + AR71XX_GPIO_REG_IN); - - /* deactivate RE line */ - __raw_writel(RB91X_NAND_NRWE, base + AR71XX_GPIO_REG_SET); - - data = (in & RB91X_NAND_LOW_DATA_MASK); - data |= (in >> RB91X_NAND_HIGH_DATA_SHIFT) & - RB91X_NAND_HIGH_DATA_MASK; - - read_buf[i] = data; - } - - /* restore registers */ - __raw_writel(out_reg, base + AR71XX_GPIO_REG_OUT); - __raw_writel(oe_reg, base + AR71XX_GPIO_REG_OE); - /* flush write */ - __raw_readl(base + AR71XX_GPIO_REG_OUT); - - /* disable latch */ - gpio_set_value_cansleep(rbni->gpio_nle, 1); - - /* disable read mode */ - gpio_set_value_cansleep(rbni->gpio_read, 0); -} - -static int rb91x_nand_dev_ready(struct mtd_info *mtd) -{ - struct rb91x_nand_info *rbni = mtd_to_rbinfo(mtd); - - return gpio_get_value_cansleep(rbni->gpio_rdy); -} - -static void rb91x_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, - unsigned int ctrl) -{ - struct rb91x_nand_info *rbni = mtd_to_rbinfo(mtd); - - if (ctrl & NAND_CTRL_CHANGE) { - gpio_set_value_cansleep(rbni->gpio_cle, - (ctrl & NAND_CLE) ? 1 : 0); - gpio_set_value_cansleep(rbni->gpio_ale, - (ctrl & NAND_ALE) ? 1 : 0); - gpio_set_value_cansleep(rbni->gpio_nce, - (ctrl & NAND_NCE) ? 0 : 1); - } - - if (cmd != NAND_CMD_NONE) { - u8 t = cmd; - - rb91x_nand_write(rbni, &t, 1); - } -} - -static u8 rb91x_nand_read_byte(struct mtd_info *mtd) -{ - struct rb91x_nand_info *rbni = mtd_to_rbinfo(mtd); - u8 data = 0xff; - - rb91x_nand_read(rbni, &data, 1); - - return data; -} - -static void rb91x_nand_read_buf(struct mtd_info *mtd, u8 *buf, int len) -{ - struct rb91x_nand_info *rbni = mtd_to_rbinfo(mtd); - - rb91x_nand_read(rbni, buf, len); -} - -static void rb91x_nand_write_buf(struct mtd_info *mtd, const u8 *buf, int len) -{ - struct rb91x_nand_info *rbni = mtd_to_rbinfo(mtd); - - rb91x_nand_write(rbni, buf, len); -} - -static int rb91x_nand_gpio_init(struct rb91x_nand_info *info) -{ - int ret; - - /* - * Ensure that the LATCH is disabled before initializing - * control lines. - */ - ret = devm_gpio_request_one(info->dev, info->gpio_nle, - GPIOF_OUT_INIT_HIGH, "LATCH enable"); - if (ret) - return ret; - - ret = devm_gpio_request_one(info->dev, info->gpio_nce, - GPIOF_OUT_INIT_HIGH, "NAND nCE"); - if (ret) - return ret; - - ret = devm_gpio_request_one(info->dev, info->gpio_nrw, - GPIOF_OUT_INIT_HIGH, "NAND nRW"); - if (ret) - return ret; - - ret = devm_gpio_request_one(info->dev, info->gpio_cle, - GPIOF_OUT_INIT_LOW, "NAND CLE"); - if (ret) - return ret; - - ret = devm_gpio_request_one(info->dev, info->gpio_ale, - GPIOF_OUT_INIT_LOW, "NAND ALE"); - if (ret) - return ret; - - ret = devm_gpio_request_one(info->dev, info->gpio_read, - GPIOF_OUT_INIT_LOW, "NAND READ"); - if (ret) - return ret; - - ret = devm_gpio_request_one(info->dev, info->gpio_rdy, - GPIOF_IN, "NAND RDY"); - return ret; -} - -static int rb91x_nand_probe(struct platform_device *pdev) -{ - struct rb91x_nand_info *rbni; - struct rb91x_nand_platform_data *pdata; - struct mtd_info *mtd; - int ret; - - pr_info(DRV_DESC "\n"); - - pdata = dev_get_platdata(&pdev->dev); - if (!pdata) - return -EINVAL; - - rbni = devm_kzalloc(&pdev->dev, sizeof(*rbni), GFP_KERNEL); - if (!rbni) - return -ENOMEM; - - rbni->dev = &pdev->dev; - rbni->gpio_nce = pdata->gpio_nce; - rbni->gpio_ale = pdata->gpio_ale; - rbni->gpio_cle = pdata->gpio_cle; - rbni->gpio_read = pdata->gpio_read; - rbni->gpio_nrw = pdata->gpio_nrw; - rbni->gpio_rdy = pdata->gpio_rdy; - rbni->gpio_nle = pdata->gpio_nle; - - rbni->chip.priv = &rbni; - mtd = rbinfo_to_mtd(rbni); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - mtd->priv = &rbni->chip; -#endif - mtd->owner = THIS_MODULE; - - rbni->chip.cmd_ctrl = rb91x_nand_cmd_ctrl; - rbni->chip.dev_ready = rb91x_nand_dev_ready; - rbni->chip.read_byte = rb91x_nand_read_byte; - rbni->chip.write_buf = rb91x_nand_write_buf; - rbni->chip.read_buf = rb91x_nand_read_buf; - - rbni->chip.chip_delay = 25; - rbni->chip.ecc.mode = NAND_ECC_SOFT; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) - rbni->chip.ecc.algo = NAND_ECC_HAMMING; -#endif - rbni->chip.options = NAND_NO_SUBPAGE_WRITE; - - platform_set_drvdata(pdev, rbni); - - ret = rb91x_nand_gpio_init(rbni); - if (ret) - return ret; - - ret = nand_scan_ident(mtd, 1, NULL); - if (ret) - return ret; - - if (mtd->writesize == 512) -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - rbni->chip.ecc.layout = &rb91x_nand_ecclayout; -#else - mtd_set_ooblayout(mtd, &rb91x_nand_ecclayout_ops); -#endif - - ret = nand_scan_tail(mtd); - if (ret) - return ret; - - ret = mtd_device_register(mtd, rb91x_nand_partitions, - ARRAY_SIZE(rb91x_nand_partitions)); - if (ret) - goto err_release_nand; - - return 0; - -err_release_nand: - nand_release(mtd); - return ret; -} - -static int rb91x_nand_remove(struct platform_device *pdev) -{ - struct rb91x_nand_info *info = platform_get_drvdata(pdev); - - nand_release(rbinfo_to_mtd(info)); - - return 0; -} - -static struct platform_driver rb91x_nand_driver = { - .probe = rb91x_nand_probe, - .remove = rb91x_nand_remove, - .driver = { - .name = RB91X_NAND_DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -module_platform_driver(rb91x_nand_driver); - -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ar71xx/files-4.14/drivers/mtd/tplinkpart.c b/target/linux/ar71xx/files-4.14/drivers/mtd/tplinkpart.c deleted file mode 100644 index a53dcb138..000000000 --- a/target/linux/ar71xx/files-4.14/drivers/mtd/tplinkpart.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * 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. - * - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#define TPLINK_NUM_PARTS 5 -#define TPLINK_HEADER_V1 0x01000000 -#define TPLINK_HEADER_V2 0x02000000 -#define MD5SUM_LEN 16 - -#define TPLINK_ART_LEN 0x10000 -#define TPLINK_KERNEL_OFFS 0x20000 -#define TPLINK_64K_KERNEL_OFFS 0x10000 - -struct tplink_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 */ - uint8_t pad[360]; -} __attribute__ ((packed)); - -static struct tplink_fw_header * -tplink_read_header(struct mtd_info *mtd, size_t offset) -{ - struct tplink_fw_header *header; - size_t header_len; - size_t retlen; - int ret; - u32 t; - - header = vmalloc(sizeof(*header)); - if (!header) - goto err; - - header_len = sizeof(struct tplink_fw_header); - ret = mtd_read(mtd, offset, header_len, &retlen, - (unsigned char *) header); - if (ret) - goto err_free_header; - - if (retlen != header_len) - goto err_free_header; - - /* sanity checks */ - t = be32_to_cpu(header->version); - if ((t != TPLINK_HEADER_V1) && (t != TPLINK_HEADER_V2)) - goto err_free_header; - - t = be32_to_cpu(header->kernel_ofs); - if (t != header_len) - goto err_free_header; - - return header; - -err_free_header: - vfree(header); -err: - return NULL; -} - -static int tplink_check_rootfs_magic(struct mtd_info *mtd, size_t offset) -{ - u32 magic; - size_t retlen; - int ret; - - ret = mtd_read(mtd, offset, sizeof(magic), &retlen, - (unsigned char *) &magic); - if (ret) - return ret; - - if (retlen != sizeof(magic)) - return -EIO; - - if (le32_to_cpu(magic) != SQUASHFS_MAGIC && - magic != 0x19852003) - return -EINVAL; - - return 0; -} - -static int tplink_parse_partitions_offset(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data, - size_t offset) -{ - struct mtd_partition *parts; - struct tplink_fw_header *header; - int nr_parts; - size_t art_offset; - size_t rootfs_offset; - size_t squashfs_offset; - int ret; - - nr_parts = TPLINK_NUM_PARTS; - parts = kzalloc(nr_parts * sizeof(struct mtd_partition), GFP_KERNEL); - if (!parts) { - ret = -ENOMEM; - goto err; - } - - header = tplink_read_header(master, offset); - if (!header) { - pr_notice("%s: no TP-Link header found\n", master->name); - ret = -ENODEV; - goto err_free_parts; - } - - squashfs_offset = offset + sizeof(struct tplink_fw_header) + - be32_to_cpu(header->kernel_len); - - ret = tplink_check_rootfs_magic(master, squashfs_offset); - if (ret == 0) - rootfs_offset = squashfs_offset; - else - rootfs_offset = offset + be32_to_cpu(header->rootfs_ofs); - - art_offset = master->size - TPLINK_ART_LEN; - - parts[0].name = "u-boot"; - parts[0].offset = 0; - parts[0].size = offset; - - parts[1].name = "kernel"; - parts[1].offset = offset; - parts[1].size = rootfs_offset - offset; - - parts[2].name = "rootfs"; - parts[2].offset = rootfs_offset; - parts[2].size = art_offset - rootfs_offset; - - parts[3].name = "art"; - parts[3].offset = art_offset; - parts[3].size = TPLINK_ART_LEN; - parts[3].mask_flags = MTD_WRITEABLE; - - parts[4].name = "firmware"; - parts[4].offset = offset; - parts[4].size = art_offset - offset; - - vfree(header); - - *pparts = parts; - return nr_parts; - -err_free_parts: - kfree(parts); -err: - *pparts = NULL; - return ret; -} - -static int tplink_parse_partitions(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data) -{ - return tplink_parse_partitions_offset(master, pparts, data, - TPLINK_KERNEL_OFFS); -} - -static int tplink_parse_64k_partitions(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data) -{ - return tplink_parse_partitions_offset(master, pparts, data, - TPLINK_64K_KERNEL_OFFS); -} - -static struct mtd_part_parser tplink_parser = { - .owner = THIS_MODULE, - .parse_fn = tplink_parse_partitions, - .name = "tp-link", -}; - -static struct mtd_part_parser tplink_64k_parser = { - .owner = THIS_MODULE, - .parse_fn = tplink_parse_64k_partitions, - .name = "tp-link-64k", -}; - -static int __init tplink_parser_init(void) -{ - register_mtd_parser(&tplink_parser); - register_mtd_parser(&tplink_64k_parser); - - return 0; -} - -module_init(tplink_parser_init); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Gabor Juhos "); diff --git a/target/linux/ar71xx/files-4.14/drivers/net/dsa/mv88e6063.c b/target/linux/ar71xx/files-4.14/drivers/net/dsa/mv88e6063.c deleted file mode 100644 index 9be8bf5e1..000000000 --- a/target/linux/ar71xx/files-4.14/drivers/net/dsa/mv88e6063.c +++ /dev/null @@ -1,307 +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 -#include -#include - -#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) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev); - return mdiobus_read(bus, addr, reg); -#else - struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->dev); - return mdiobus_read(bus, addr, reg); -#endif -} - -#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) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev); - return mdiobus_write(bus, addr, reg, val); -#else - struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->dev); - return mdiobus_write(bus, addr, reg, val); -#endif -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) -static enum dsa_tag_protocol mv88e6063_get_tag_protocol(struct dsa_switch *ds) -{ - return DSA_TAG_PROTO_TRAILER; -} -#endif - -#define REG_WRITE(addr, reg, val) \ - ({ \ - int __ret; \ - \ - __ret = reg_write(ds, addr, reg, val); \ - if (__ret < 0) \ - return __ret; \ - }) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static char *mv88e6063_drv_probe(struct device *host_dev, int sw_addr) -#else -static const char *mv88e6063_drv_probe(struct device *dsa_dev, - struct device *host_dev, int sw_addr, - void **_priv) -#endif -{ - struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev); - int ret; - - if (!bus) - return NULL; - - 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) ? -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - ds->phys_port_mask : -#else - ds->enabled_port_mask : -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - (1 << ds->dst->cpu_port))); -#else - (1 << ds->dst->cpu_dp->index))); -#endif - - /* - * 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); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0) -static struct dsa_switch_driver mv88e6063_switch_ops = { -#else -static struct dsa_switch_ops mv88e6063_switch_ops = { -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0) - .tag_protocol = htons(ETH_P_TRAILER), -#else - .get_tag_protocol = mv88e6063_get_tag_protocol, -#endif - .probe = mv88e6063_drv_probe, - .setup = mv88e6063_setup, - .set_addr = mv88e6063_set_addr, - .phy_read = mv88e6063_phy_read, - .phy_write = mv88e6063_phy_write, -}; - -#if LINUX_VERSION_CODE > KERNEL_VERSION(4,9,0) -static struct dsa_switch_driver mv88e6063_switch_drv = { - .ops = &mv88e6063_switch_ops, -}; -#endif - -static int __init mv88e6063_init(void) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - register_switch_driver(&mv88e6063_switch_ops); -#else - register_switch_driver(&mv88e6063_switch_drv); -#endif - return 0; -} -module_init(mv88e6063_init); - -static void __exit mv88e6063_cleanup(void) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - unregister_switch_driver(&mv88e6063_switch_ops); -#else - unregister_switch_driver(&mv88e6063_switch_drv); -#endif -} -module_exit(mv88e6063_cleanup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/Makefile b/target/linux/ar71xx/files-4.9/arch/mips/ath79/Makefile deleted file mode 100644 index 15b11c4f5..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/Makefile +++ /dev/null @@ -1,287 +0,0 @@ -# -# Makefile for the Atheros AR71XX/AR724X/AR913X specific parts of the kernel -# -# Copyright (C) 2008-2011 Gabor Juhos -# Copyright (C) 2008 Imre Kaloz -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. - -obj-y := prom.o setup.o irq.o common.o clock.o gpio.o - -obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -obj-$(CONFIG_PCI) += pci.o - -# -# Devices -# -obj-y += dev-common.o -obj-$(CONFIG_ATH79_DEV_AP9X_PCI) += dev-ap9x-pci.o -obj-$(CONFIG_ATH79_DEV_DSA) += dev-dsa.o -obj-$(CONFIG_ATH79_DEV_ETH) += dev-eth.o -obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o -obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev-leds-gpio.o -obj-$(CONFIG_ATH79_DEV_M25P80) += dev-m25p80.o -obj-$(CONFIG_ATH79_DEV_NFC) += dev-nfc.o -obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o -obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o -obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o - -# -# Miscellaneous objects -# -obj-$(CONFIG_ATH79_NVRAM) += nvram.o -obj-$(CONFIG_ATH79_PCI_ATH9K_FIXUP) += pci-ath9k-fixup.o -obj-$(CONFIG_ATH79_ROUTERBOOT) += routerboot.o - -# -# Machines -# -obj-$(CONFIG_ATH79_MACH_A60) += mach-a60.o -obj-$(CONFIG_ATH79_MACH_WI2A_AC200I) += mach-wi2a-ac200i.o -obj-$(CONFIG_ATH79_MACH_ALFA_AP120C) += mach-alfa-ap120c.o -obj-$(CONFIG_ATH79_MACH_ALFA_AP96) += mach-alfa-ap96.o -obj-$(CONFIG_ATH79_MACH_ALFA_NX) += mach-alfa-nx.o -obj-$(CONFIG_ATH79_MACH_ALL0258N) += mach-all0258n.o -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_AP121) += mach-ap121.o -obj-$(CONFIG_ATH79_MACH_AP121F) += mach-ap121f.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_AC9531) += mach-ac9531.o -obj-$(CONFIG_ATH79_MACH_AP152) += mach-ap152.o -obj-$(CONFIG_ATH79_MACH_AP531B0) += mach-ap531b0.o -obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o -obj-$(CONFIG_ATH79_MACH_AP91_5G) += mach-ap91-5g.o -obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o -obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1) += mach-archer-c25-v1.o -obj-$(CONFIG_ATH79_MACH_ARCHER_C58_V1) += mach-archer-c59-v1.o -obj-$(CONFIG_ATH79_MACH_ARCHER_C59_V1) += mach-archer-c59-v1.o -obj-$(CONFIG_ATH79_MACH_ARCHER_C60_V1) += mach-archer-c60-v1.o -obj-$(CONFIG_ATH79_MACH_ARCHER_C60_V2) += mach-archer-c60-v1.o -obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7.o -obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7-v4.o -obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN) += mach-arduino-yun.o -obj-$(CONFIG_ATH79_MACH_AW_NR580) += mach-aw-nr580.o -obj-$(CONFIG_ATH79_MACH_BHR_4GRV2) += mach-bhr-4grv2.o -obj-$(CONFIG_ATH79_MACH_BHU_BXU2000N2_A) += mach-bhu-bxu2000n2-a.o -obj-$(CONFIG_ATH79_MACH_BSB) += mach-bsb.o -obj-$(CONFIG_ATH79_MACH_C55) += mach-c55.o -obj-$(CONFIG_ATH79_MACH_C60) += mach-c60.o -obj-$(CONFIG_ATH79_MACH_CAP324) += mach-cap324.o -obj-$(CONFIG_ATH79_MACH_CAP4200AG) += mach-cap4200ag.o -obj-$(CONFIG_ATH79_MACH_CARAMBOLA2) += mach-carambola2.o -obj-$(CONFIG_ATH79_MACH_CF_E316N_V2) += mach-cf-e316n-v2.o -obj-$(CONFIG_ATH79_MACH_CF_E320N_V2) += mach-cf-e316n-v2.o -obj-$(CONFIG_ATH79_MACH_CF_E355AC) += mach-cf-e316n-v2.o -obj-$(CONFIG_ATH79_MACH_CF_E375AC) += mach-cf-e316n-v2.o -obj-$(CONFIG_ATH79_MACH_CF_E380AC_V1) += mach-cf-e316n-v2.o -obj-$(CONFIG_ATH79_MACH_CF_E380AC_V2) += mach-cf-e316n-v2.o -obj-$(CONFIG_ATH79_MACH_CF_E520N) += mach-cf-e316n-v2.o -obj-$(CONFIG_ATH79_MACH_CF_E530N) += mach-cf-e316n-v2.o -obj-$(CONFIG_ATH79_MACH_CPE505N) += mach-r602n.o -obj-$(CONFIG_ATH79_MACH_CPE510) += mach-cpe510.o -obj-$(CONFIG_ATH79_MACH_CPE830) += mach-ap90q.o -obj-$(CONFIG_ATH79_MACH_CPE870) += mach-cpe870.o -obj-$(CONFIG_ATH79_MACH_CR3000) += mach-cr3000.o -obj-$(CONFIG_ATH79_MACH_CR5000) += mach-cr5000.o -obj-$(CONFIG_ATH79_MACH_DAP_1330_A1) += mach-dap-1330-a1.o -obj-$(CONFIG_ATH79_MACH_DAP_2695_A1) += mach-dap-2695-a1.o -obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o -obj-$(CONFIG_ATH79_MACH_DGL_5500_A1) += mach-dgl-5500-a1.o -obj-$(CONFIG_ATH79_MACH_DHP_1565_A1) += mach-dhp-1565-a1.o -obj-$(CONFIG_ATH79_MACH_DIR_505_A1) += mach-dir-505-a1.o -obj-$(CONFIG_ATH79_MACH_DIR_600_A1) += mach-dir-600-a1.o -obj-$(CONFIG_ATH79_MACH_DIR_615_C1) += mach-dir-615-c1.o -obj-$(CONFIG_ATH79_MACH_DIR_615_I1) += mach-dir-615-i1.o -obj-$(CONFIG_ATH79_MACH_DIR_825_B1) += mach-dir-825-b1.o -obj-$(CONFIG_ATH79_MACH_DIR_825_C1) += mach-dir-825-c1.o -obj-$(CONFIG_ATH79_MACH_DIR_869_A1) += mach-dir-869-a1.o -obj-$(CONFIG_ATH79_MACH_DLAN_HOTSPOT) += mach-dlan-hotspot.o -obj-$(CONFIG_ATH79_MACH_DLAN_PRO_1200_AC) += mach-dlan-pro-1200-ac.o -obj-$(CONFIG_ATH79_MACH_DLAN_PRO_500_WP) += mach-dlan-pro-500-wp.o -obj-$(CONFIG_ATH79_MACH_DOMYWIFI_DW33D) += mach-domywifi-dw33d.o -obj-$(CONFIG_ATH79_MACH_DR342) += mach-dr344.o -obj-$(CONFIG_ATH79_MACH_DR344) += mach-dr344.o -obj-$(CONFIG_ATH79_MACH_DR531) += mach-dr531.o -obj-$(CONFIG_ATH79_MACH_DRAGINO2) += mach-dragino2.o -obj-$(CONFIG_ATH79_MACH_E1700AC_V2) += mach-e1700ac-v2.o -obj-$(CONFIG_ATH79_MACH_E600G_V2) += mach-e600g-v2.o -obj-$(CONFIG_ATH79_MACH_EAP120) += mach-eap120.o -obj-$(CONFIG_ATH79_MACH_EAP300V2) += mach-eap300v2.o -obj-$(CONFIG_ATH79_MACH_EAP7660D) += mach-eap7660d.o -obj-$(CONFIG_ATH79_MACH_EL_M150) += mach-el-m150.o -obj-$(CONFIG_ATH79_MACH_EL_MINI) += mach-el-mini.o -obj-$(CONFIG_ATH79_MACH_ENS202EXT) += mach-ens202ext.o -obj-$(CONFIG_ATH79_MACH_EPG5000) += mach-epg5000.o -obj-$(CONFIG_ATH79_MACH_ESR1750) += mach-esr1750.o -obj-$(CONFIG_ATH79_MACH_ESR900) += mach-esr900.o -obj-$(CONFIG_ATH79_MACH_EW_BALIN) += mach-ew-balin.o -obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.o -obj-$(CONFIG_ATH79_MACH_F9K1115V2) += mach-f9k1115v2.o -obj-$(CONFIG_ATH79_MACH_FRITZ300E) += mach-fritz300e.o -obj-$(CONFIG_ATH79_MACH_FRITZ4020) += mach-fritz4020.o -obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o -obj-$(CONFIG_ATH79_MACH_GL_AR300) += mach-gl-ar300.o -obj-$(CONFIG_ATH79_MACH_GL_AR300M) += mach-gl-ar300m.o -obj-$(CONFIG_ATH79_MACH_GL_AR750) += mach-gl-ar750.o -obj-$(CONFIG_ATH79_MACH_GL_AR750S) += mach-gl-ar750s.o -obj-$(CONFIG_ATH79_MACH_GL_DOMINO) += mach-gl-domino.o -obj-$(CONFIG_ATH79_MACH_GL_INET) += mach-gl-inet.o -obj-$(CONFIG_ATH79_MACH_GL_MIFI) += mach-gl-mifi.o -obj-$(CONFIG_ATH79_MACH_GL_USB150) += mach-gl-usb150.o -obj-$(CONFIG_ATH79_MACH_GS_OOLITE_V1) += mach-gs-oolite-v1.o -obj-$(CONFIG_ATH79_MACH_GS_OOLITE_V5_2) += mach-gs-oolite-v5-2.o -obj-$(CONFIG_ATH79_MACH_HIVEAP_121) += mach-hiveap-121.o -obj-$(CONFIG_ATH79_MACH_HIWIFI_HC6361) += mach-hiwifi-hc6361.o -obj-$(CONFIG_ATH79_MACH_HORNET_UB) += mach-hornet-ub.o -obj-$(CONFIG_ATH79_MACH_JA76PF) += mach-ja76pf.o -obj-$(CONFIG_ATH79_MACH_JWAP003) += mach-jwap003.o -obj-$(CONFIG_ATH79_MACH_JWAP230) += mach-jwap230.o -obj-$(CONFIG_ATH79_MACH_KOALA) += mach-koala.o -obj-$(CONFIG_ATH79_MACH_K2T) += mach-k2t.o -obj-$(CONFIG_ATH79_MACH_LAN_TURTLE) += mach-lan-turtle.o -obj-$(CONFIG_ATH79_MACH_LIMA) += mach-lima.o -obj-$(CONFIG_ATH79_MACH_MC_MAC1200R) += mach-mc-mac1200r.o -obj-$(CONFIG_ATH79_MACH_MR12) += mach-mr12.o -obj-$(CONFIG_ATH79_MACH_MR16) += mach-mr16.o -obj-$(CONFIG_ATH79_MACH_MR1750) += mach-mr1750.o -obj-$(CONFIG_ATH79_MACH_MR18) += mach-mr18.o -obj-$(CONFIG_ATH79_MACH_MR600) += mach-mr600.o -obj-$(CONFIG_ATH79_MACH_MR900) += mach-mr900.o -obj-$(CONFIG_ATH79_MACH_MYNET_N600) += mach-mynet-n600.o -obj-$(CONFIG_ATH79_MACH_MYNET_N750) += mach-mynet-n750.o -obj-$(CONFIG_ATH79_MACH_MYNET_REXT) += mach-mynet-rext.o -obj-$(CONFIG_ATH79_MACH_MZK_W04NU) += mach-mzk-w04nu.o -obj-$(CONFIG_ATH79_MACH_MZK_W300NH) += mach-mzk-w300nh.o -obj-$(CONFIG_ATH79_MACH_N5Q) += mach-n5q.o -obj-$(CONFIG_ATH79_MACH_NBG460N) += mach-nbg460n.o -obj-$(CONFIG_ATH79_MACH_NBG6716) += mach-nbg6716.o -obj-$(CONFIG_ATH79_MACH_RAMBUTAN) += mach-rambutan.o -obj-$(CONFIG_ATH79_MACH_OM2P) += mach-om2p.o -obj-$(CONFIG_ATH79_MACH_OM5P) += mach-om5p.o -obj-$(CONFIG_ATH79_MACH_OM5P_AC) += mach-om5pac.o -obj-$(CONFIG_ATH79_MACH_OM5P_ACv2) += mach-om5pacv2.o -obj-$(CONFIG_ATH79_MACH_OMY_G1) += mach-omy-g1.o -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_PQI_AIR_PEN) += mach-pqi-air-pen.o -obj-$(CONFIG_ATH79_MACH_QIHOO_C301) += mach-qihoo-c301.o -obj-$(CONFIG_ATH79_MACH_R36A) += mach-r36a.o -obj-$(CONFIG_ATH79_MACH_R602N) += mach-r602n.o -obj-$(CONFIG_ATH79_MACH_R6100) += mach-r6100.o -obj-$(CONFIG_ATH79_MACH_RB2011) += mach-rb2011.o -obj-$(CONFIG_ATH79_MACH_RB4XX) += mach-rb4xx.o -obj-$(CONFIG_ATH79_MACH_RB750) += mach-rb750.o -obj-$(CONFIG_ATH79_MACH_RB91X) += mach-rb91x.o -obj-$(CONFIG_ATH79_MACH_RB922) += mach-rb922.o -obj-$(CONFIG_ATH79_MACH_RB941) += mach-rb941.o -obj-$(CONFIG_ATH79_MACH_RB95X) += mach-rb95x.o -obj-$(CONFIG_ATH79_MACH_RBSPI) += mach-rbspi.o -obj-$(CONFIG_ATH79_MACH_RBSXTLITE) += mach-rbsxtlite.o -obj-$(CONFIG_ATH79_MACH_RE355) += mach-re450.o -obj-$(CONFIG_ATH79_MACH_RE450) += mach-re450.o -obj-$(CONFIG_ATH79_MACH_RME_EG200) += mach-rme-eg200.o -obj-$(CONFIG_ATH79_MACH_RUT9XX) += mach-rut9xx.o -obj-$(CONFIG_ATH79_MACH_RW2458N) += mach-rw2458n.o -obj-$(CONFIG_ATH79_MACH_SC1750) += mach-sc1750.o -obj-$(CONFIG_ATH79_MACH_SC300M) += mach-sc300m.o -obj-$(CONFIG_ATH79_MACH_SC450) += mach-sc450.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_T830) += mach-t830.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 -obj-$(CONFIG_ATH79_MACH_TEW_712BR) += mach-tew-712br.o -obj-$(CONFIG_ATH79_MACH_TEW_732BR) += mach-tew-732br.o -obj-$(CONFIG_ATH79_MACH_TEW_823DRU) += mach-tew-823dru.o -obj-$(CONFIG_ATH79_MACH_TL_MR11U) += mach-tl-mr11u.o -obj-$(CONFIG_ATH79_MACH_TL_MR13U) += mach-tl-mr13u.o -obj-$(CONFIG_ATH79_MACH_TL_MR3020) += mach-tl-mr3020.o -obj-$(CONFIG_ATH79_MACH_TL_MR3X20) += mach-tl-mr3x20.o -obj-$(CONFIG_ATH79_MACH_TL_MR6400) += mach-tl-mr6400.o -obj-$(CONFIG_ATH79_MACH_TL_WA701ND_V2) += mach-tl-wa701nd-v2.o -obj-$(CONFIG_ATH79_MACH_TL_WA7210N_V2) += mach-tl-wa7210n-v2.o -obj-$(CONFIG_ATH79_MACH_TL_WA801ND_V3) += mach-tl-wa801nd-v3.o -obj-$(CONFIG_ATH79_MACH_TL_WA830RE_V2) += mach-tl-wa830re-v2.o -obj-$(CONFIG_ATH79_MACH_TL_WA850RE_V2) += mach-tl-wax50re.o -obj-$(CONFIG_ATH79_MACH_TL_WA855RE_V1) += mach-tl-wax50re.o -obj-$(CONFIG_ATH79_MACH_TL_WA901ND) += mach-tl-wa901nd.o -obj-$(CONFIG_ATH79_MACH_TL_WA901ND_V2) += mach-tl-wa901nd-v2.o -obj-$(CONFIG_ATH79_MACH_TL_WA901ND_V4) += mach-tl-wa901nd-v4.o -obj-$(CONFIG_ATH79_MACH_TL_WAX50RE) += mach-tl-wax50re.o -obj-$(CONFIG_ATH79_MACH_TL_WDR3320_V2) += mach-tl-wdr3320-v2.o -obj-$(CONFIG_ATH79_MACH_TL_WDR3500) += mach-tl-wdr3500.o -obj-$(CONFIG_ATH79_MACH_TL_WDR4300) += mach-tl-wdr4300.o -obj-$(CONFIG_ATH79_MACH_TL_WDR6500_V2) += mach-tl-wdr6500-v2.o -obj-$(CONFIG_ATH79_MACH_TL_WDX6501_V7) += mach-tl-wdx6501-v7.o -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 -obj-$(CONFIG_ATH79_MACH_TL_WR741ND) += mach-tl-wr741nd.o -obj-$(CONFIG_ATH79_MACH_TL_WR741ND_V4) += mach-tl-wr741nd-v4.o -obj-$(CONFIG_ATH79_MACH_TL_WR802N_V1) += mach-tl-wr802n.o -obj-$(CONFIG_ATH79_MACH_TL_WR802N_V2) += mach-tl-wr802n.o -obj-$(CONFIG_ATH79_MACH_TL_WR810N) += mach-tl-wr810n.o -obj-$(CONFIG_ATH79_MACH_TL_WR810N_V2) += mach-tl-wr810n.o -obj-$(CONFIG_ATH79_MACH_TL_WR840N_V2) += mach-tl-wr841n-v9.o -obj-$(CONFIG_ATH79_MACH_TL_WR841N_V1) += mach-tl-wr841n.o -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_WR902AC_V1) += mach-tl-wr902ac-v1.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_TL_WR942N_V1) += mach-tl-wr942n-v1.o -obj-$(CONFIG_ATH79_MACH_TS_D084) += mach-ts-d084.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 -obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o -obj-$(CONFIG_ATH79_MACH_WAM250) += mach-wam250.o -obj-$(CONFIG_ATH79_MACH_WEIO) += mach-weio.o -obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N) += mach-whr-hp-g300n.o -obj-$(CONFIG_ATH79_MACH_WIFI_PINEAPPLE_NANO) += mach-wifi-pineapple-nano.o -obj-$(CONFIG_ATH79_MACH_WLAE_AG300N) += mach-wlae-ag300n.o -obj-$(CONFIG_ATH79_MACH_WLR8100) += mach-wlr8100.o -obj-$(CONFIG_ATH79_MACH_WNDAP360) += mach-wndap360.o -obj-$(CONFIG_ATH79_MACH_WNDR3700) += mach-wndr3700.o -obj-$(CONFIG_ATH79_MACH_WNDR4300) += mach-wndr4300.o -obj-$(CONFIG_ATH79_MACH_WNR2000) += mach-wnr2000.o -obj-$(CONFIG_ATH79_MACH_WNR2000_V3) += mach-wnr2000-v3.o -obj-$(CONFIG_ATH79_MACH_WNR2000_V4) += mach-wnr2000-v4.o -obj-$(CONFIG_ATH79_MACH_WNR2200) += mach-wnr2200.o -obj-$(CONFIG_ATH79_MACH_WP543) += mach-wp543.o -obj-$(CONFIG_ATH79_MACH_WPE72) += mach-wpe72.o -obj-$(CONFIG_ATH79_MACH_WPJ342) += mach-wpj342.o -obj-$(CONFIG_ATH79_MACH_WPJ344) += mach-wpj344.o -obj-$(CONFIG_ATH79_MACH_WPJ531) += mach-wpj531.o -obj-$(CONFIG_ATH79_MACH_WPJ558) += mach-wpj558.o -obj-$(CONFIG_ATH79_MACH_WPJ563) += mach-wpj563.o -obj-$(CONFIG_ATH79_MACH_WRT160NL) += mach-wrt160nl.o -obj-$(CONFIG_ATH79_MACH_WRT400N) += mach-wrt400n.o -obj-$(CONFIG_ATH79_MACH_WRTNODE2Q) += mach-wrtnode2q.o -obj-$(CONFIG_ATH79_MACH_WZR_450HP2) += mach-wzr-450hp2.o -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-4.9/arch/mips/ath79/dev-ap9x-pci.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-ap9x-pci.c deleted file mode 100644 index 483aed78e..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-ap9x-pci.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Atheros AP9X reference board PCI initialization - * - * 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 -#include - -#include - -#include "dev-ap9x-pci.h" -#include "pci-ath9k-fixup.h" -#include "pci.h" - -static struct ath9k_platform_data ap9x_wmac0_data = { - .led_pin = -1, -}; -static struct ath9k_platform_data ap9x_wmac1_data = { - .led_pin = -1, -}; -static char ap9x_wmac0_mac[6]; -static char ap9x_wmac1_mac[6]; - -__init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin) -{ - switch (wmac) { - case 0: - ap9x_wmac0_data.led_pin = pin; - break; - case 1: - ap9x_wmac1_data.led_pin = pin; - break; - } -} - -__init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) -{ - switch (wmac) { - case 0: - return &ap9x_wmac0_data; - - case 1: - return &ap9x_wmac1_data; - } - - return NULL; -} - -__init void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val) -{ - switch (wmac) { - case 0: - ap9x_wmac0_data.gpio_mask = mask; - ap9x_wmac0_data.gpio_val = val; - break; - case 1: - ap9x_wmac1_data.gpio_mask = mask; - ap9x_wmac1_data.gpio_val = val; - break; - } -} - -__init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, - int num_leds) -{ - switch (wmac) { - case 0: - ap9x_wmac0_data.leds = leds; - ap9x_wmac0_data.num_leds = num_leds; - break; - case 1: - ap9x_wmac1_data.leds = leds; - ap9x_wmac1_data.num_leds = num_leds; - break; - } -} - -__init void ap9x_pci_setup_wmac_btns(unsigned wmac, - struct gpio_keys_button *btns, - unsigned num_btns, unsigned poll_interval) -{ - struct ath9k_platform_data *ap9x_wmac_data; - - if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac))) - return; - - ap9x_wmac_data->btns = btns; - ap9x_wmac_data->num_btns = num_btns; - ap9x_wmac_data->btn_poll_interval = poll_interval; -} - -static int ap91_pci_plat_dev_init(struct pci_dev *dev) -{ - switch (PCI_SLOT(dev->devfn)) { - case 0: - dev->dev.platform_data = &ap9x_wmac0_data; - break; - } - - return 0; -} - -__init void ap91_pci_init(u8 *cal_data, u8 *mac_addr) -{ - if (cal_data) - memcpy(ap9x_wmac0_data.eeprom_data, cal_data, - sizeof(ap9x_wmac0_data.eeprom_data)); - - if (mac_addr) { - memcpy(ap9x_wmac0_mac, mac_addr, sizeof(ap9x_wmac0_mac)); - ap9x_wmac0_data.macaddr = ap9x_wmac0_mac; - } - - ath79_pci_set_plat_dev_init(ap91_pci_plat_dev_init); - ath79_register_pci(); - - pci_enable_ath9k_fixup(0, ap9x_wmac0_data.eeprom_data); -} - -__init void ap91_pci_init_simple(void) -{ - ap91_pci_init(NULL, NULL); - ap9x_wmac0_data.eeprom_name = "pci_wmac0.eeprom"; -} - -static int ap94_pci_plat_dev_init(struct pci_dev *dev) -{ - switch (PCI_SLOT(dev->devfn)) { - case 17: - dev->dev.platform_data = &ap9x_wmac0_data; - break; - - case 18: - dev->dev.platform_data = &ap9x_wmac1_data; - break; - } - - return 0; -} - -__init void ap94_pci_init(u8 *cal_data0, u8 *mac_addr0, - u8 *cal_data1, u8 *mac_addr1) -{ - if (cal_data0) - memcpy(ap9x_wmac0_data.eeprom_data, cal_data0, - sizeof(ap9x_wmac0_data.eeprom_data)); - - if (cal_data1) - memcpy(ap9x_wmac1_data.eeprom_data, cal_data1, - sizeof(ap9x_wmac1_data.eeprom_data)); - - if (mac_addr0) { - memcpy(ap9x_wmac0_mac, mac_addr0, sizeof(ap9x_wmac0_mac)); - ap9x_wmac0_data.macaddr = ap9x_wmac0_mac; - } - - if (mac_addr1) { - memcpy(ap9x_wmac1_mac, mac_addr1, sizeof(ap9x_wmac1_mac)); - ap9x_wmac1_data.macaddr = ap9x_wmac1_mac; - } - - ath79_pci_set_plat_dev_init(ap94_pci_plat_dev_init); - ath79_register_pci(); - - pci_enable_ath9k_fixup(17, ap9x_wmac0_data.eeprom_data); - pci_enable_ath9k_fixup(18, ap9x_wmac1_data.eeprom_data); -} diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-ap9x-pci.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-ap9x-pci.h deleted file mode 100644 index d2a045fc1..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-ap9x-pci.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Atheros AP9X reference board PCI initialization - * - * 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. - */ - -#ifndef _ATH79_DEV_AP9X_PCI_H -#define _ATH79_DEV_AP9X_PCI_H - -struct gpio_led; -struct gpio_keys_button; -struct ath9k_platform_data; - -#if defined(CONFIG_ATH79_DEV_AP9X_PCI) -void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin); -void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val); -void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, - int num_leds); -void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns, - unsigned num_btns, unsigned poll_interval); -struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac); - -void ap91_pci_init(u8 *cal_data, u8 *mac_addr); -void ap91_pci_init_simple(void); -void ap94_pci_init(u8 *cal_data0, u8 *mac_addr0, - u8 *cal_data1, u8 *mac_addr1); - -#else -static inline void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin) {} -static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac, - u32 mask, u32 val) {} -static inline void ap9x_pci_setup_wmac_leds(unsigned wmac, - struct gpio_led *leds, - int num_leds) {} -static inline void ap9x_pci_setup_wmac_btns(unsigned wmac, - struct gpio_keys_button *btns, - unsigned num_btns, - unsigned poll_interval) {} -static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) -{ - return NULL; -} - -static inline void ap91_pci_init(u8 *cal_data, u8 *mac_addr) {} -static inline void ap91_pci_init_simple(void) {} -static inline void ap94_pci_init(u8 *cal_data0, u8 *mac_addr0, - u8 *cal_data1, u8 *mac_addr1) {} -#endif - -#endif /* _ATH79_DEV_AP9X_PCI_H */ - diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-dsa.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-dsa.c deleted file mode 100644 index 4ade218f7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-dsa.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Atheros AR71xx DSA switch device 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 "dev-dsa.h" - -static struct platform_device ar71xx_dsa_switch_device = { - .name = "dsa", - .id = 0, -}; - -void __init ath79_register_dsa(struct device *netdev, - struct device *miidev, - struct dsa_platform_data *d) -{ - int i; - - d->netdev = netdev; - for (i = 0; i < d->nr_chips; i++) - d->chip[i].host_dev = miidev; - - ar71xx_dsa_switch_device.dev.platform_data = d; - platform_device_register(&ar71xx_dsa_switch_device); -} diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-dsa.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-dsa.h deleted file mode 100644 index 3730202e8..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-dsa.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Atheros AR71xx DSA switch device 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 _ATH79_DEV_DSA_H -#define _ATH79_DEV_DSA_H - -#include - -void ath79_register_dsa(struct device *netdev, - struct device *miidev, - struct dsa_platform_data *d); - -#endif /* _ATH79_DEV_DSA_H */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-eth.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-eth.h deleted file mode 100644 index 4d78260fb..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-eth.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Atheros AR71xx SoC device definitions - * - * 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. - */ - -#ifndef _ATH79_DEV_ETH_H -#define _ATH79_DEV_ETH_H - -#include - -struct platform_device; - -extern unsigned char ath79_mac_base[] __initdata; -void ath79_parse_ascii_mac(char *mac_str, u8 *mac); -void ath79_extract_mac_reverse(u8 *ptr, u8 *out); -void ath79_init_mac(unsigned char *dst, const unsigned char *src, - int offset); -void ath79_init_local_mac(unsigned char *dst, const unsigned char *src); - -struct ath79_eth_pll_data { - u32 pll_10; - u32 pll_100; - u32 pll_1000; -}; - -extern struct ath79_eth_pll_data ath79_eth0_pll_data; -extern struct ath79_eth_pll_data ath79_eth1_pll_data; - -extern struct ag71xx_platform_data ath79_eth0_data; -extern struct ag71xx_platform_data ath79_eth1_data; -extern struct platform_device ath79_eth0_device; -extern struct platform_device ath79_eth1_device; -void ath79_register_eth(unsigned int id); - -extern struct ag71xx_switch_platform_data ath79_switch_data; - -extern struct ag71xx_mdio_platform_data ath79_mdio0_data; -extern struct ag71xx_mdio_platform_data ath79_mdio1_data; -extern struct platform_device ath79_mdio0_device; -extern struct platform_device ath79_mdio1_device; -void ath79_register_mdio(unsigned int id, u32 phy_mask); - -void ath79_setup_ar933x_phy4_switch(bool mac, bool mdio); -void ath79_setup_ar934x_eth_cfg(u32 mask); -void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv); -void ath79_setup_qca955x_eth_cfg(u32 mask); -void ath79_setup_qca956x_eth_cfg(u32 mask); - -#endif /* _ATH79_DEV_ETH_H */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-m25p80.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-m25p80.c deleted file mode 100644 index e53d97dcb..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-m25p80.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 -#include -#include -#include -#include - -#include "dev-spi.h" -#include "dev-m25p80.h" - -static struct spi_board_info ath79_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - }, - { - .bus_num = 0, - .chip_select = 1, - .max_speed_hz = 25000000, - .modalias = "m25p80", - } -}; - -static struct ath79_spi_platform_data ath79_spi_data; - -void __init ath79_register_m25p80(struct flash_platform_data *pdata) -{ - ath79_spi_data.bus_num = 0; - ath79_spi_data.num_chipselect = 1; - ath79_spi_info[0].platform_data = pdata; - ath79_register_spi(&ath79_spi_data, ath79_spi_info, 1); -} - -static struct flash_platform_data *multi_pdata; - -static struct mtd_info *concat_devs[2] = { NULL, NULL }; -static struct work_struct mtd_concat_work; - -static void mtd_concat_add_work(struct work_struct *work) -{ - struct mtd_info *mtd; - - mtd = mtd_concat_create(concat_devs, ARRAY_SIZE(concat_devs), "flash"); - - mtd_device_register(mtd, multi_pdata->parts, multi_pdata->nr_parts); -} - -static void mtd_concat_add(struct mtd_info *mtd) -{ - static bool registered = false; - - if (registered) - return; - - if (!strcmp(mtd->name, "spi0.0")) - concat_devs[0] = mtd; - else if (!strcmp(mtd->name, "spi0.1")) - concat_devs[1] = mtd; - else - return; - - if (!concat_devs[0] || !concat_devs[1]) - return; - - registered = true; - INIT_WORK(&mtd_concat_work, mtd_concat_add_work); - schedule_work(&mtd_concat_work); -} - -static void mtd_concat_remove(struct mtd_info *mtd) -{ -} - -static void add_mtd_concat_notifier(void) -{ - static struct mtd_notifier not = { - .add = mtd_concat_add, - .remove = mtd_concat_remove, - }; - - register_mtd_user(¬); -} - -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_register_spi(&ath79_spi_data, ath79_spi_info, 2); -} diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-m25p80.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-m25p80.h deleted file mode 100644 index 637b41a7d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-m25p80.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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. - */ - -#ifndef _ATH79_DEV_M25P80_H -#define _ATH79_DEV_M25P80_H - -#include - -void ath79_register_m25p80(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-4.9/arch/mips/ath79/dev-nfc.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-nfc.c deleted file mode 100644 index 9b5256ecc..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-nfc.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Atheros AR934X SoCs built-in NAND flash controller support - * - * Copyright (C) 2011-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 -#include - -#include -#include - -#include "dev-nfc.h" - -static struct resource ath79_nfc_resources[2]; -static u64 ar934x_nfc_dmamask = DMA_BIT_MASK(32); -static struct ar934x_nfc_platform_data ath79_nfc_data; - -static struct platform_device ath79_nfc_device = { - .name = AR934X_NFC_DRIVER_NAME, - .id = -1, - .resource = ath79_nfc_resources, - .num_resources = ARRAY_SIZE(ath79_nfc_resources), - .dev = { - .dma_mask = &ar934x_nfc_dmamask, - .coherent_dma_mask = DMA_BIT_MASK(32), - .platform_data = &ath79_nfc_data, - }, -}; - -static void __init ath79_nfc_init_resource(struct resource res[2], - unsigned long base, - unsigned long size, - int irq) -{ - memset(res, 0, sizeof(struct resource) * 2); - - res[0].flags = IORESOURCE_MEM; - res[0].start = base; - res[0].end = base + size - 1; - - res[1].flags = IORESOURCE_IRQ; - res[1].start = irq; - res[1].end = irq; -} - -static void ar934x_nfc_hw_reset(bool active) -{ - if (active) { - ath79_device_reset_set(AR934X_RESET_NANDF); - udelay(100); - - ath79_device_reset_set(AR934X_RESET_ETH_SWITCH_ANALOG); - udelay(250); - } else { - ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH_ANALOG); - udelay(250); - - ath79_device_reset_clear(AR934X_RESET_NANDF); - udelay(100); - } -} - -static void ar934x_nfc_setup(void) -{ - ath79_nfc_data.hw_reset = ar934x_nfc_hw_reset; - - ath79_nfc_init_resource(ath79_nfc_resources, - AR934X_NFC_BASE, AR934X_NFC_SIZE, - ATH79_MISC_IRQ(21)); - - platform_device_register(&ath79_nfc_device); -} - -static void qca955x_nfc_hw_reset(bool active) -{ - if (active) { - ath79_device_reset_set(QCA955X_RESET_NANDF); - udelay(250); - } else { - ath79_device_reset_clear(QCA955X_RESET_NANDF); - udelay(100); - } -} - -static void qca955x_nfc_setup(void) -{ - ath79_nfc_data.hw_reset = qca955x_nfc_hw_reset; - - ath79_nfc_init_resource(ath79_nfc_resources, - QCA955X_NFC_BASE, QCA955X_NFC_SIZE, - ATH79_MISC_IRQ(21)); - - platform_device_register(&ath79_nfc_device); -} - -void __init ath79_nfc_set_select_chip(void (*f)(int chip_no)) -{ - ath79_nfc_data.select_chip = f; -} - -void __init ath79_nfc_set_scan_fixup(int (*f)(struct mtd_info *mtd)) -{ - ath79_nfc_data.scan_fixup = f; -} - -void __init ath79_nfc_set_swap_dma(bool enable) -{ - ath79_nfc_data.swap_dma = enable; -} - -void __init ath79_nfc_set_ecc_mode(enum ar934x_nfc_ecc_mode mode) -{ - ath79_nfc_data.ecc_mode = mode; -} - -void __init ath79_nfc_set_parts(struct mtd_partition *parts, int nr_parts) -{ - ath79_nfc_data.parts = parts; - ath79_nfc_data.nr_parts = nr_parts; -} - -void __init ath79_register_nfc(void) -{ - if (soc_is_ar934x()) - ar934x_nfc_setup(); - else if (soc_is_qca955x()) - qca955x_nfc_setup(); - else - BUG(); -} diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-nfc.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-nfc.h deleted file mode 100644 index 3a1c88fe9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-nfc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Atheros AR934X SoCs built-in NAND Flash Controller support - * - * Copyright (C) 2011-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. - */ - -#ifndef _ATH79_DEV_NFC_H -#define _ATH79_DEV_NFC_H - -struct mtd_partition; -enum ar934x_nfc_ecc_mode; - -#ifdef CONFIG_ATH79_DEV_NFC -void ath79_nfc_set_parts(struct mtd_partition *parts, int nr_parts); -void ath79_nfc_set_select_chip(void (*f)(int chip_no)); -void ath79_nfc_set_scan_fixup(int (*f)(struct mtd_info *mtd)); -void ath79_nfc_set_swap_dma(bool enable); -void ath79_nfc_set_ecc_mode(enum ar934x_nfc_ecc_mode mode); -void ath79_register_nfc(void); -#else -static inline void ath79_nfc_set_parts(struct mtd_partition *parts, - int nr_parts) {} -static inline void ath79_nfc_set_select_chip(void (*f)(int chip_no)) {} -static inline void ath79_nfc_set_scan_fixup(int (*f)(struct mtd_info *mtd)) {} -static inline void ath79_nfc_set_swap_dma(bool enable) {} -static inline void ath79_nfc_set_ecc_mode(enum ar934x_nfc_ecc_mode mode) {} -static inline void ath79_register_nfc(void) {} -#endif - -#endif /* _ATH79_DEV_NFC_H */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ac9531.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ac9531.c deleted file mode 100644 index 5c9ac0ba4..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ac9531.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Atheros AC9531 reference board support - * - * Copyright (C) 2014 Matthias Schiffer - * Copyright (C) 2015 Sven Eckelmann - * - * 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-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" -#include "pci.h" - -#define AC9531_GPIO_LED_WAN 4 -#define AC9531_GPIO_LED_LAN1 11 -#define AC9531_GPIO_LED_LAN2 14 -#define AC9531_GPIO_LED_LAN3 15 -#define AC9531_GPIO_LED_LAN4 16 -#define AC9531_GPIO_LED_STATUS 13 -#define AC9531_GPIO_LED_WLAN_2G 12 - -#define AC9531_GPIO_BTN_RESET 17 - -#define AC9531_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AC9531_KEYS_DEBOUNCE_INTERVAL (3 * AC9531_KEYS_POLL_INTERVAL) - -#define AC9531_MAC0_OFFSET 0x1000 - -static struct gpio_led ac9531_leds_gpio[] __initdata = { - { - .name = "ac9531:green:status", - .gpio = AC9531_GPIO_LED_STATUS, - .active_low = 1, - }, { - .name = "ac9531:green:wlan-2g", - .gpio = AC9531_GPIO_LED_WLAN_2G, - .active_low = 1, - }, { - .name = "ac9531:green:lan1", - .gpio = AC9531_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "ac9531:green:lan2", - .gpio = AC9531_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "ac9531:green:lan3", - .gpio = AC9531_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "ac9531:green:lan4", - .gpio = AC9531_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "ac9531:green:wan", - .gpio = AC9531_GPIO_LED_WAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button ac9531_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AC9531_KEYS_DEBOUNCE_INTERVAL, - .gpio = AC9531_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init ac9531_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(ac9531_leds_gpio), - ac9531_leds_gpio); - ath79_register_gpio_keys_polled(-1, AC9531_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ac9531_gpio_keys), - ac9531_gpio_keys); - - ath79_register_usb(); - - ath79_register_pci(); - - ath79_register_wmac(art + AC9531_MAC0_OFFSET, NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, art, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, art, 1); - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_AC9531_010, "AC9531-010", "Atheros AC9531-010 reference board", ac9531_setup); -MIPS_MACHINE(ATH79_MACH_AC9531_020, "AC9531-020", "Atheros AC9531-020 reference board", ac9531_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-ap96.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-ap96.c deleted file mode 100644 index 531e5fb18..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-ap96.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * ALFA Network AP96 board 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 - -#include -#include - -#include "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "pci.h" - -#define ALFA_AP96_GPIO_PCIE_RESET 2 -#define ALFA_AP96_GPIO_SIM_DETECT 3 -#define ALFA_AP96_GPIO_MICROSD_CD 4 -#define ALFA_AP96_GPIO_PCIE_W_DISABLE 5 - -#define ALFA_AP96_GPIO_BUTTON_RESET 11 - -#define ALFA_AP96_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ALFA_AP96_KEYS_DEBOUNCE_INTERVAL (3 * ALFA_AP96_KEYS_POLL_INTERVAL) - -static struct gpio_keys_button alfa_ap96_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ALFA_AP96_KEYS_DEBOUNCE_INTERVAL, - .gpio = ALFA_AP96_GPIO_BUTTON_RESET, - .active_low = 1, - } -}; - -static struct mmc_spi_platform_data alfa_ap96_mmc_data = { - .flags = MMC_SPI_USE_CD_GPIO, - .cd_gpio = ALFA_AP96_GPIO_MICROSD_CD, - .cd_debounce = 1, - .caps = MMC_CAP_NEEDS_POLL, - .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, -}; - -static struct spi_board_info alfa_ap96_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - }, { - .bus_num = 0, - .chip_select = 1, - .max_speed_hz = 25000000, - .modalias = "mmc_spi", - .platform_data = &alfa_ap96_mmc_data, - }, { - .bus_num = 0, - .chip_select = 2, - .max_speed_hz = 6250000, - .modalias = "rtc-pcf2123", - }, -}; - -static struct ath79_spi_platform_data alfa_ap96_spi_data = { - .bus_num = 0, - .num_chipselect = 3, -}; - -static void __init alfa_ap96_gpio_setup(void) -{ - ath79_gpio_function_enable(AR71XX_GPIO_FUNC_SPI_CS1_EN | - AR71XX_GPIO_FUNC_SPI_CS2_EN); - - gpio_request(ALFA_AP96_GPIO_MICROSD_CD, "microSD CD"); - gpio_direction_input(ALFA_AP96_GPIO_MICROSD_CD); - gpio_request(ALFA_AP96_GPIO_PCIE_RESET, "PCIe reset"); - gpio_direction_output(ALFA_AP96_GPIO_PCIE_RESET, 1); - gpio_request(ALFA_AP96_GPIO_PCIE_W_DISABLE, "PCIe write disable"); - gpio_direction_output(ALFA_AP96_GPIO_PCIE_W_DISABLE, 1); -} - -#define ALFA_AP96_WAN_PHYMASK BIT(4) -#define ALFA_AP96_LAN_PHYMASK BIT(5) -#define ALFA_AP96_MDIO_PHYMASK (ALFA_AP96_LAN_PHYMASK | ALFA_AP96_WAN_PHYMASK) - -static void __init alfa_ap96_init(void) -{ - alfa_ap96_gpio_setup(); - - ath79_register_mdio(0, ~ALFA_AP96_MDIO_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = ALFA_AP96_WAN_PHYMASK; - ath79_eth1_pll_data.pll_1000 = 0x110000; - - ath79_register_eth(0); - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = ALFA_AP96_LAN_PHYMASK; - ath79_eth1_pll_data.pll_1000 = 0x110000; - - ath79_register_eth(1); - - ath79_register_pci(); - ath79_register_spi(&alfa_ap96_spi_data, alfa_ap96_spi_info, - ARRAY_SIZE(alfa_ap96_spi_info)); - - ath79_register_gpio_keys_polled(-1, ALFA_AP96_KEYS_POLL_INTERVAL, - ARRAY_SIZE(alfa_ap96_gpio_keys), - alfa_ap96_gpio_keys); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_ALFA_AP96, "ALFA-AP96", "ALFA Network AP96", - alfa_ap96_init); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-nx.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-nx.c deleted file mode 100644 index a515f4f54..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-nx.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * ALFA Network N2/N5 board support - * - * Copyright (C) 2011-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 "common.h" -#include "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -#define ALFA_NX_GPIO_LED_2 17 -#define ALFA_NX_GPIO_LED_3 16 -#define ALFA_NX_GPIO_LED_5 12 -#define ALFA_NX_GPIO_LED_6 8 -#define ALFA_NX_GPIO_LED_7 6 -#define ALFA_NX_GPIO_LED_8 7 - -#define ALFA_NX_GPIO_BTN_RESET 11 - -#define ALFA_NX_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ALFA_NX_KEYS_DEBOUNCE_INTERVAL (3 * ALFA_NX_KEYS_POLL_INTERVAL) - -#define ALFA_NX_MAC0_OFFSET 0 -#define ALFA_NX_MAC1_OFFSET 6 -#define ALFA_NX_CALDATA_OFFSET 0x1000 - -static struct gpio_keys_button alfa_nx_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ALFA_NX_KEYS_DEBOUNCE_INTERVAL, - .gpio = ALFA_NX_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct gpio_led alfa_nx_leds_gpio[] __initdata = { - { - .name = "alfa:green:led_2", - .gpio = ALFA_NX_GPIO_LED_2, - .active_low = 1, - }, { - .name = "alfa:green:led_3", - .gpio = ALFA_NX_GPIO_LED_3, - .active_low = 1, - }, { - .name = "alfa:red:led_5", - .gpio = ALFA_NX_GPIO_LED_5, - .active_low = 1, - }, { - .name = "alfa:amber:led_6", - .gpio = ALFA_NX_GPIO_LED_6, - .active_low = 1, - }, { - .name = "alfa:green:led_7", - .gpio = ALFA_NX_GPIO_LED_7, - .active_low = 1, - }, { - .name = "alfa:green:led_8", - .gpio = ALFA_NX_GPIO_LED_8, - .active_low = 1, - } -}; - -static void __init alfa_nx_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE, - AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(0, ARRAY_SIZE(alfa_nx_leds_gpio), - alfa_nx_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ALFA_NX_KEYS_POLL_INTERVAL, - ARRAY_SIZE(alfa_nx_gpio_keys), - alfa_nx_gpio_keys); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, - art + ALFA_NX_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, - art + ALFA_NX_MAC1_OFFSET, 0); - - /* WAN port */ - ath79_register_eth(0); - /* LAN port */ - ath79_register_eth(1); - - ap91_pci_init(art + ALFA_NX_CALDATA_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_ALFA_NX, "ALFA-NX", "ALFA Network N2/N5", - alfa_nx_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-all0258n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-all0258n.c deleted file mode 100644 index 2495bcba7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-all0258n.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Allnet ALL0258N support - * - * Copyright (C) 2011 Daniel Golle - * - * 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-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -/* found via /sys/gpio/... try and error */ -#define ALL0258N_GPIO_BTN_RESET 1 -#define ALL0258N_GPIO_LED_RSSIHIGH 13 -#define ALL0258N_GPIO_LED_RSSIMEDIUM 15 -#define ALL0258N_GPIO_LED_RSSILOW 14 - -/* defaults taken from others machs */ -#define ALL0258N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ALL0258N_KEYS_DEBOUNCE_INTERVAL (3 * ALL0258N_KEYS_POLL_INTERVAL) - -/* showed up in the original firmware's bootlog */ -#define ALL0258N_SEC_PHYMASK BIT(3) - -static struct gpio_led all0258n_leds_gpio[] __initdata = { - { - .name = "all0258n:green:rssihigh", - .gpio = ALL0258N_GPIO_LED_RSSIHIGH, - .active_low = 1, - }, { - .name = "all0258n:yellow:rssimedium", - .gpio = ALL0258N_GPIO_LED_RSSIMEDIUM, - .active_low = 1, - }, { - .name = "all0258n:red:rssilow", - .gpio = ALL0258N_GPIO_LED_RSSILOW, - .active_low = 1, - } -}; - -static struct gpio_keys_button all0258n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ALL0258N_KEYS_DEBOUNCE_INTERVAL, - .gpio = ALL0258N_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init all0258n_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f7f0000); - u8 *ee = (u8 *) KSEG1ADDR(0x1f7f1000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(all0258n_leds_gpio), - all0258n_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ALL0258N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(all0258n_gpio_keys), - all0258n_gpio_keys); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - ath79_eth1_data.phy_mask = ALL0258N_SEC_PHYMASK; - - ath79_register_mdio(0, 0x0); - - ath79_register_eth(0); - ath79_register_eth(1); - - ap91_pci_init(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_ALL0258N, "ALL0258N", "Allnet ALL0258N", - all0258n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-all0315n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-all0315n.c deleted file mode 100644 index 387ee7f9e..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-all0315n.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Allnet ALL0315N support - * - * Copyright (C) 2012 Daniel Golle - * - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-m25p80.h" -#include "dev-leds-gpio.h" -#include "machtypes.h" -#include "pci.h" - -#define ALL0315N_GPIO_BTN_RESET 0 -#define ALL0315N_GPIO_LED_RSSIHIGH 14 -#define ALL0315N_GPIO_LED_RSSIMEDIUM 15 -#define ALL0315N_GPIO_LED_RSSILOW 16 - -#define ALL0315N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ALL0315N_KEYS_DEBOUNCE_INTERVAL (3 * ALL0315N_KEYS_POLL_INTERVAL) - -static struct gpio_led all0315n_leds_gpio[] __initdata = { - { - .name = "all0315n:green:rssihigh", - .gpio = ALL0315N_GPIO_LED_RSSIHIGH, - .active_low = 1, - }, { - .name = "all0315n:yellow:rssimedium", - .gpio = ALL0315N_GPIO_LED_RSSIMEDIUM, - .active_low = 1, - }, { - .name = "all0315n:red:rssilow", - .gpio = ALL0315N_GPIO_LED_RSSILOW, - .active_low = 1, - } -}; - -static struct gpio_keys_button all0315n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ALL0315N_KEYS_DEBOUNCE_INTERVAL, - .gpio = ALL0315N_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init all0315n_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1ffc0000); - u8 *ee = (u8 *) KSEG1ADDR(0x1ffc1000); - - ath79_register_m25p80(NULL); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(all0315n_leds_gpio), - all0315n_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ALL0315N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(all0315n_gpio_keys), - all0315n_gpio_keys); - - ap9x_pci_setup_wmac_led_pin(0, 1); - ap91_pci_init(ee, NULL); -} - -MIPS_MACHINE(ATH79_MACH_ALL0315N, "ALL0315N", "Allnet ALL0315N", - all0315n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antminer-s1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antminer-s1.c deleted file mode 100644 index 0a81227b5..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antminer-s1.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Bitmain Antminer S1 board support - * - * Copyright (C) 2015 L. D. Pinney - * - * 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 "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" -#include "dev-usb.h" - -#define ANTMINER_S1_GPIO_BTN_RESET 11 - -#define ANTMINER_S1_GPIO_LED_SYSTEM 23 -#define ANTMINER_S1_GPIO_LED_WLAN 0 -#define ANTMINER_S1_GPIO_USB_POWER 26 - -#define ANTMINER_S1_KEYSPOLL_INTERVAL 20 /* msecs */ -#define ANTMINER_S1_KEYSDEBOUNCE_INTERVAL (3 * ANTMINER_S1_KEYSPOLL_INTERVAL) - -static const char *ANTMINER_S1_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data ANTMINER_S1_flash_data = { - .part_probes = ANTMINER_S1_part_probes, -}; - -static struct gpio_led ANTMINER_S1_leds_gpio[] __initdata = { - { - .name = "antminer-s1:green:system", - .gpio = ANTMINER_S1_GPIO_LED_SYSTEM, - .active_low = 0, - },{ - .name = "antminer-s1:green:wlan", - .gpio = ANTMINER_S1_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ANTMINER_S1_GPIO_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ANTMINER_S1_KEYSDEBOUNCE_INTERVAL, - .gpio = ANTMINER_S1_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static void __init antminer_s1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ANTMINER_S1_leds_gpio), - ANTMINER_S1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ANTMINER_S1_KEYSPOLL_INTERVAL, - ARRAY_SIZE(ANTMINER_S1_GPIO_keys), - ANTMINER_S1_GPIO_keys); - - gpio_request_one(ANTMINER_S1_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_register_m25p80(&ANTMINER_S1_flash_data); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_ANTMINER_S1, "ANTMINER-S1", - "Antminer-S1", antminer_s1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antminer-s3.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antminer-s3.c deleted file mode 100644 index b77a6ccc4..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antminer-s3.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Bitmain Antminer S3 board support - * - * Copyright (C) 2015 L. D. Pinney - * - * 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 "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" -#include "dev-usb.h" - -#define ANTMINER_S3_GPIO_LED_WLAN 0 -#define ANTMINER_S3_GPIO_LED_SYSTEM 17 -#define ANTMINER_S3_GPIO_LED_LAN 22 -#define ANTMINER_S3_GPIO_USB_POWER 26 - -#define ANTMINER_S3_GPIO_BTN_RESET 11 - -#define ANTMINER_S3_KEYSPOLL_INTERVAL 88 /* msecs */ -#define ANTMINER_S3_KEYSDEBOUNCE_INTERVAL (3 * ANTMINER_S3_KEYSPOLL_INTERVAL) - -static const char *ANTMINER_S3_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data ANTMINER_S3_flash_data = { - .part_probes = ANTMINER_S3_part_probes, -}; - -static struct gpio_led ANTMINER_S3_leds_gpio[] __initdata = { - { - .name = "antminer-s3:green:wlan", - .gpio = ANTMINER_S3_GPIO_LED_WLAN, - .active_low = 0, - },{ - .name = "antminer-s3:green:system", - .gpio = ANTMINER_S3_GPIO_LED_SYSTEM, - .active_low = 0, - },{ - .name = "antminer-s3:yellow:lan", - .gpio = ANTMINER_S3_GPIO_LED_LAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ANTMINER_S3_GPIO_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ANTMINER_S3_KEYSDEBOUNCE_INTERVAL, - .gpio = ANTMINER_S3_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static void __init antminer_s3_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ANTMINER_S3_leds_gpio), - ANTMINER_S3_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ANTMINER_S3_KEYSPOLL_INTERVAL, - ARRAY_SIZE(ANTMINER_S3_GPIO_keys), - ANTMINER_S3_GPIO_keys); - - gpio_request_one(ANTMINER_S3_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_register_m25p80(&ANTMINER_S3_flash_data); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_ANTMINER_S3, "ANTMINER-S3", - "Antminer-S3", antminer_s3_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antrouter-r1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antrouter-r1.c deleted file mode 100644 index a8f7b5d68..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-antrouter-r1.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Bitmain Antrouter R1 board support - * - * Copyright (C) 2015 L. D. Pinney - * - * 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 "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" -#include "dev-usb.h" - -#define ANTROUTER_R1_GPIO_BTN_RESET 11 - -#define ANTROUTER_R1_GPIO_LED_WLAN 0 -#define ANTROUTER_R1_GPIO_LED_BTC 22 -#define ANTROUTER_R1_GPIO_USB_POWER 18 - -#define ANTROUTER_R1_KEYSPOLL_INTERVAL 44 /* msecs */ -#define ANTROUTER_R1_KEYSDEBOUNCE_INTERVAL (4 * ANTROUTER_R1_KEYSPOLL_INTERVAL) - -static const char *ANTROUTER_R1_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data ANTROUTER_R1_flash_data = { - .part_probes = ANTROUTER_R1_part_probes, -}; - -static struct gpio_led ANTROUTER_R1_leds_gpio[] __initdata = { - { - .name = "antrouter-r1:green:wlan", - .gpio = ANTROUTER_R1_GPIO_LED_WLAN, - .active_low = 0, - },{ - .name = "antrouter-r1:green:system", - .gpio = ANTROUTER_R1_GPIO_LED_BTC, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ANTROUTER_R1_GPIO_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ANTROUTER_R1_KEYSDEBOUNCE_INTERVAL, - .gpio = ANTROUTER_R1_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static void __init antrouter_r1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ANTROUTER_R1_leds_gpio), - ANTROUTER_R1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ANTROUTER_R1_KEYSPOLL_INTERVAL, - ARRAY_SIZE(ANTROUTER_R1_GPIO_keys), - ANTROUTER_R1_GPIO_keys); - - gpio_request_one(ANTROUTER_R1_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_register_m25p80(&ANTROUTER_R1_flash_data); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_ANTROUTER_R1, "ANTROUTER-R1", - "Antrouter-R1", antrouter_r1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap121f.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap121f.c deleted file mode 100644 index 955b7faf6..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap121f.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * ALFA Network AP121F board support - * - * Copyright (C) 2017 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 "common.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 AP121F_GPIO_LED_LAN 17 -#define AP121F_GPIO_LED_VPN 27 -#define AP121F_GPIO_LED_WLAN 0 - -#define AP121F_GPIO_MICROSD_EN 26 - -#define AP121F_GPIO_BTN_RESET 12 -#define AP121F_GPIO_BTN_SWITCH 21 - -#define AP121F_KEYS_POLL_INTERVAL 20 -#define AP121F_KEYS_DEBOUNCE_INTERVAL (3 * AP121F_KEYS_POLL_INTERVAL) - -#define AP121F_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led ap121f_leds_gpio[] __initdata = { - { - .name = "ap121f:green:lan", - .gpio = AP121F_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "ap121f:green:vpn", - .gpio = AP121F_GPIO_LED_VPN, - .active_low = 1, - }, { - .name = "ap121f:green:wlan", - .gpio = AP121F_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ap121f_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AP121F_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP121F_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "switch", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = AP121F_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP121F_GPIO_BTN_SWITCH, - .active_low = 0, - }, -}; - -static void __init ap121f_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f040000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - /* LAN */ - ath79_register_mdio(0, 0x0); - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121f_leds_gpio), - ap121f_leds_gpio); - - ath79_register_gpio_keys_polled(-1, AP121F_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap121f_gpio_keys), - ap121f_gpio_keys); - - gpio_request_one(AP121F_GPIO_MICROSD_EN, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "microSD enable"); - - ath79_register_wmac(art + AP121F_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_AP121F, "AP121F", "ALFA Network AP121F", ap121f_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap143.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap143.c deleted file mode 100644 index 098420b92..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap143.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Atheros AP143 reference board support - * - * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved. - * Copyright (c) 2012 Gabor Juhos - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define AP143_GPIO_LED_WLAN 12 -#define AP143_GPIO_LED_WPS 13 -#define AP143_GPIO_LED_STATUS 13 - -#define AP143_GPIO_LED_WAN 4 -#define AP143_GPIO_LED_LAN1 16 -#define AP143_GPIO_LED_LAN2 15 -#define AP143_GPIO_LED_LAN3 14 -#define AP143_GPIO_LED_LAN4 11 - -#define AP143_GPIO_BTN_WPS 17 - -#define AP143_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP143_KEYS_DEBOUNCE_INTERVAL (3 * AP143_KEYS_POLL_INTERVAL) - -#define AP143_MAC0_OFFSET 0 -#define AP143_MAC1_OFFSET 6 -#define AP143_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led ap143_leds_gpio[] __initdata = { - { - .name = "ap143:green:status", - .gpio = AP143_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "ap143:green:wlan", - .gpio = AP143_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button ap143_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AP143_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP143_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static void __init ap143_gpio_led_setup(void) -{ - ath79_gpio_direction_select(AP143_GPIO_LED_WAN, true); - ath79_gpio_direction_select(AP143_GPIO_LED_LAN1, true); - ath79_gpio_direction_select(AP143_GPIO_LED_LAN2, true); - ath79_gpio_direction_select(AP143_GPIO_LED_LAN3, true); - ath79_gpio_direction_select(AP143_GPIO_LED_LAN4, true); - - ath79_gpio_output_select(AP143_GPIO_LED_WAN, - QCA953X_GPIO_OUT_MUX_LED_LINK5); - ath79_gpio_output_select(AP143_GPIO_LED_LAN1, - QCA953X_GPIO_OUT_MUX_LED_LINK1); - ath79_gpio_output_select(AP143_GPIO_LED_LAN2, - QCA953X_GPIO_OUT_MUX_LED_LINK2); - ath79_gpio_output_select(AP143_GPIO_LED_LAN3, - QCA953X_GPIO_OUT_MUX_LED_LINK3); - ath79_gpio_output_select(AP143_GPIO_LED_LAN4, - QCA953X_GPIO_OUT_MUX_LED_LINK4); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap143_leds_gpio), - ap143_leds_gpio); - ath79_register_gpio_keys_polled(-1, AP143_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap143_gpio_keys), - ap143_gpio_keys); -} - -static void __init ap143_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ap143_gpio_led_setup(); - - ath79_register_usb(); - - ath79_wmac_set_led_pin(AP143_GPIO_LED_WLAN); - ath79_register_wmac(art + AP143_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + AP143_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art + AP143_MAC1_OFFSET, 0); - - /* WAN port */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(4); - ath79_register_eth(0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_AP143, "AP143", "Qualcomm Atheros AP143 reference board", - ap143_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap147.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap147.c deleted file mode 100644 index 7b45da471..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap147.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Atheros AP147 reference board support - * - * Copyright (C) 2014 Matthias Schiffer - * Copyright (C) 2015 Sven Eckelmann - * - * 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-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" -#include "pci.h" - -#define AP147_GPIO_LED_WAN 4 -#define AP147_GPIO_LED_LAN1 16 -#define AP147_GPIO_LED_LAN2 15 -#define AP147_GPIO_LED_LAN3 14 -#define AP147_GPIO_LED_LAN4 11 -#define AP147_GPIO_LED_STATUS 13 -#define AP147_GPIO_LED_WLAN_2G 12 - -#define AP147_GPIO_BTN_WPS 17 - -#define AP147_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP147_KEYS_DEBOUNCE_INTERVAL (3 * AP147_KEYS_POLL_INTERVAL) - -#define AP147_MAC0_OFFSET 0x1000 - -static struct gpio_led ap147_leds_gpio[] __initdata = { - { - .name = "ap147:green:status", - .gpio = AP147_GPIO_LED_STATUS, - .active_low = 1, - }, { - .name = "ap147:green:wlan-2g", - .gpio = AP147_GPIO_LED_WLAN_2G, - .active_low = 1, - }, { - .name = "ap147:green:lan1", - .gpio = AP147_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "ap147:green:lan2", - .gpio = AP147_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "ap147:green:lan3", - .gpio = AP147_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "ap147:green:lan4", - .gpio = AP147_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "ap147:green:wan", - .gpio = AP147_GPIO_LED_WAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button ap147_gpio_keys[] __initdata = { - { - .desc = "wps button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AP147_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP147_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static void __init ap147_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap147_leds_gpio), - ap147_leds_gpio); - ath79_register_gpio_keys_polled(-1, AP147_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap147_gpio_keys), - ap147_gpio_keys); - - ath79_register_usb(); - - ath79_register_pci(); - - ath79_register_wmac(art + AP147_MAC0_OFFSET, NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, art, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, art, 1); - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_AP147_010, "AP147-010", "Atheros AP147-010 reference board", ap147_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap531b0.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap531b0.c deleted file mode 100644 index 3cb269795..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap531b0.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Rockeetech AP531B0 11ng wireless AP board support - * - * Copyright (C) 2013 Gabor Juhos - * Copyright (C) 2016 Shuanglin Liu - * - * 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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-ap9x-pci.h" - -#define AP531B0_GPIO_LED_WLAN 12 -#define AP531B0_GPIO_LED_STATUS 11 - -#define AP531B0_GPIO_RST_BTN 17 - -#define AP531B0_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP531B0_KEYS_DEBOUNCE_INTERVAL (3 * AP531B0_KEYS_POLL_INTERVAL) - -#define AP531B0_WMAC_CALDATA_OFFSET 0x1000 - - -static struct gpio_led ap531b0_leds_gpio[] __initdata = { - { - .name = "ap531b0:green:status", - .gpio = AP531B0_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "ap531b0:green:wlan", - .gpio = AP531B0_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button ap531b0_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AP531B0_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP531B0_GPIO_RST_BTN, - .active_low = 1, - }, -}; - - -static void __init ap531b0_gpio_led_setup(void) -{ - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap531b0_leds_gpio), - ap531b0_leds_gpio); - - ath79_register_gpio_keys_polled(-1, AP531B0_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap531b0_gpio_keys), - ap531b0_gpio_keys); -} - -static void __init ap531b0_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *pmac; - - ath79_register_m25p80(NULL); - ap531b0_gpio_led_setup(); - ath79_register_usb(); - ath79_register_pci(); - - ath79_register_mdio(0, 0x0); - - pmac = art + AP531B0_WMAC_CALDATA_OFFSET + 2; - ath79_init_mac(ath79_eth0_data.mac_addr, pmac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, pmac, 2); - - ath79_register_wmac(art + AP531B0_WMAC_CALDATA_OFFSET, pmac); - - /* WAN port */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(4); - ath79_register_eth(0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_AP531B0, "AP531B0", "Rockeetech AP531B0", - ap531b0_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap90q.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap90q.c deleted file mode 100644 index 99fceca3a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap90q.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Support for YunCore boards: - * - AP80Q/AP90Q - * - CPE830 - * - * 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 "common.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" - -/* AP90Q */ -#define AP90Q_GPIO_LED_WAN 4 -#define AP90Q_GPIO_LED_WLAN 12 -#define AP90Q_GPIO_LED_LAN 16 - -#define AP90Q_GPIO_BTN_RESET 17 - -#define AP90Q_KEYS_POLL_INTERVAL 20 -#define AP90Q_KEYS_DEBOUNCE_INTERVAL (3 * AP90Q_KEYS_POLL_INTERVAL) - -static struct gpio_led ap90q_leds_gpio[] __initdata = { - { - .name = "ap90q:green:lan", - .gpio = AP90Q_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "ap90q:green:wan", - .gpio = AP90Q_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "ap90q:green:wlan", - .gpio = AP90Q_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button ap90q_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AP90Q_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP90Q_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -/* CPE830 */ -#define CPE830_GPIO_LED_LINK4 0 -#define CPE830_GPIO_LED_LINK1 1 -#define CPE830_GPIO_LED_LINK2 2 -#define CPE830_GPIO_LED_LINK3 3 -#define CPE830_GPIO_LED_WAN 4 -#define CPE830_GPIO_LED_WLAN 12 -#define CPE830_GPIO_LED_LAN 16 - -#define CPE830_GPIO_BTN_RESET 17 - -static struct gpio_led cpe830_leds_gpio[] __initdata = { - { - .name = "cpe830:green:lan", - .gpio = CPE830_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "cpe830:green:wan", - .gpio = CPE830_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "cpe830:green:wlan", - .gpio = CPE830_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "cpe830:green:link1", - .gpio = CPE830_GPIO_LED_LINK1, - .active_low = 1, - }, - { - .name = "cpe830:green:link2", - .gpio = CPE830_GPIO_LED_LINK2, - .active_low = 1, - }, - { - .name = "cpe830:green:link3", - .gpio = CPE830_GPIO_LED_LINK3, - .active_low = 1, - }, - { - .name = "cpe830:green:link4", - .gpio = CPE830_GPIO_LED_LINK4, - .active_low = 1, - }, -}; - -static void __init ap90q_cpe830_common_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff1000); - u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask |= BIT(4); - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - ath79_register_eth(1); - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); - - ath79_register_wmac(art, NULL); - - /* For LED on GPIO4 */ - ath79_gpio_function_disable(AR934X_GPIO_FUNC_CLK_OBS4_EN); - - ath79_gpio_direction_select(AP90Q_GPIO_LED_LAN, true); - ath79_gpio_direction_select(AP90Q_GPIO_LED_WAN, true); - ath79_gpio_direction_select(AP90Q_GPIO_LED_WLAN, true); - - /* Mute LEDs on boot */ - gpio_set_value(AP90Q_GPIO_LED_LAN, 1); - gpio_set_value(AP90Q_GPIO_LED_WAN, 1); - - ath79_gpio_output_select(AP90Q_GPIO_LED_LAN, 0); - ath79_gpio_output_select(AP90Q_GPIO_LED_WAN, 0); - ath79_gpio_output_select(AP90Q_GPIO_LED_WLAN, 0); - - ath79_register_gpio_keys_polled(-1, AP90Q_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap90q_gpio_keys), - ap90q_gpio_keys); -} - -static void __init ap90q_setup(void) -{ - ap90q_cpe830_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap90q_leds_gpio), - ap90q_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_AP90Q, "AP90Q", "YunCore AP80Q/AP90Q", ap90q_setup); - -static void __init cpe830_setup(void) -{ - ap90q_cpe830_common_setup(); - - ath79_gpio_direction_select(CPE830_GPIO_LED_LINK1, true); - ath79_gpio_direction_select(CPE830_GPIO_LED_LINK2, true); - ath79_gpio_direction_select(CPE830_GPIO_LED_LINK3, true); - ath79_gpio_direction_select(CPE830_GPIO_LED_LINK4, true); - - /* Mute LEDs on boot */ - gpio_set_value(CPE830_GPIO_LED_LINK1, 1); - gpio_set_value(CPE830_GPIO_LED_LINK2, 1); - gpio_set_value(CPE830_GPIO_LED_LINK3, 1); - gpio_set_value(CPE830_GPIO_LED_LINK4, 1); - - ath79_gpio_output_select(CPE830_GPIO_LED_LINK1, 0); - ath79_gpio_output_select(CPE830_GPIO_LED_LINK2, 0); - ath79_gpio_output_select(CPE830_GPIO_LED_LINK3, 0); - ath79_gpio_output_select(CPE830_GPIO_LED_LINK4, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe830_leds_gpio), - cpe830_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_CPE830, "CPE830", "YunCore CPE830", cpe830_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap91-5g.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap91-5g.c deleted file mode 100644 index 64b943038..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap91-5g.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * ALFA Network AP91-5G board support - * - * Copyright (C) 2018 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 "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 "machtypes.h" - -#define AP91_5G_GPIO_LED_LAN 17 -#define AP91_5G_GPIO_LED_SIGNAL1 12 -#define AP91_5G_GPIO_LED_SIGNAL2 8 -#define AP91_5G_GPIO_LED_SIGNAL3 6 -#define AP91_5G_GPIO_LED_SIGNAL4 7 - -#define AP91_5G_GPIO_WDT_EN 1 -#define AP91_5G_GPIO_WDT_IN 0 - -#define AP91_5G_GPIO_BTN_RESET 11 - -#define AP91_5G_KEYS_POLL_INTERVAL 20 -#define AP91_5G_KEYS_DEBOUNCE_INTERVAL (3 * AP91_5G_KEYS_POLL_INTERVAL) - -#define AP91_5G_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led ap91_5g_leds_gpio[] __initdata = { - { - .name = "ap91-5g:green:lan", - .gpio = AP91_5G_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "ap91-5g:red:signal1", - .gpio = AP91_5G_GPIO_LED_SIGNAL1, - .active_low = 1, - }, { - .name = "ap91-5g:orange:signal2", - .gpio = AP91_5G_GPIO_LED_SIGNAL2, - .active_low = 1, - }, { - .name = "ap91-5g:green:signal3", - .gpio = AP91_5G_GPIO_LED_SIGNAL3, - .active_low = 1, - }, { - .name = "ap91-5g:green:signal4", - .gpio = AP91_5G_GPIO_LED_SIGNAL4, - .active_low = 1, - }, -}; - -static struct gpio_keys_button ap91_5g_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AP91_5G_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP91_5G_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init ap91_5g_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE, - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - gpio_set_value(AP91_5G_GPIO_LED_LAN, 1); - gpio_set_value(AP91_5G_GPIO_LED_SIGNAL3, 1); - gpio_set_value(AP91_5G_GPIO_LED_SIGNAL4, 1); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap91_5g_leds_gpio), - ap91_5g_leds_gpio); - - ath79_register_gpio_keys_polled(-1, AP91_5G_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap91_5g_gpio_keys), - ap91_5g_gpio_keys); - - gpio_request_one(AP91_5G_GPIO_WDT_IN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "WDT input"); - - gpio_request_one(AP91_5G_GPIO_WDT_EN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "WDT enable"); - - ap91_pci_init(art + AP91_5G_WMAC_CALDATA_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_AP91_5G, "AP91-5G", "ALFA Network AP91-5G", - ap91_5g_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap96.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap96.c deleted file mode 100644 index 35120d3e2..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap96.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Atheros AP96 board support - * - * Copyright (C) 2009 Marco Porsch - * Copyright (C) 2009-2012 Gabor Juhos - * Copyright (C) 2010 Atheros Communications - * - * 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 "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 "machtypes.h" - -#define AP96_GPIO_LED_12_GREEN 0 -#define AP96_GPIO_LED_3_GREEN 1 -#define AP96_GPIO_LED_2_GREEN 2 -#define AP96_GPIO_LED_WPS_GREEN 4 -#define AP96_GPIO_LED_5_GREEN 5 -#define AP96_GPIO_LED_4_ORANGE 6 - -/* Reset button - next to the power connector */ -#define AP96_GPIO_BTN_RESET 3 -/* WPS button - next to a led on right */ -#define AP96_GPIO_BTN_WPS 8 - -#define AP96_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AP96_KEYS_DEBOUNCE_INTERVAL (3 * AP96_KEYS_POLL_INTERVAL) - -#define AP96_WMAC0_MAC_OFFSET 0x120c -#define AP96_WMAC1_MAC_OFFSET 0x520c -#define AP96_CALDATA0_OFFSET 0x1000 -#define AP96_CALDATA1_OFFSET 0x5000 - -/* - * AP96 has 12 unlabeled leds in the front; these are numbered from 1 to 12 - * below (from left to right on the board). Led 1 seems to be on whenever the - * board is powered. Led 11 shows LAN link activity actity. Led 3 is orange; - * others are green. - * - * In addition, there is one led next to a button on the right side for WPS. - */ -static struct gpio_led ap96_leds_gpio[] __initdata = { - { - .name = "ap96:green:led2", - .gpio = AP96_GPIO_LED_2_GREEN, - .active_low = 1, - }, { - .name = "ap96:green:led3", - .gpio = AP96_GPIO_LED_3_GREEN, - .active_low = 1, - }, { - .name = "ap96:orange:led4", - .gpio = AP96_GPIO_LED_4_ORANGE, - .active_low = 1, - }, { - .name = "ap96:green:led5", - .gpio = AP96_GPIO_LED_5_GREEN, - .active_low = 1, - }, { - .name = "ap96:green:led12", - .gpio = AP96_GPIO_LED_12_GREEN, - .active_low = 1, - }, { /* next to a button on right */ - .name = "ap96:green:wps", - .gpio = AP96_GPIO_LED_WPS_GREEN, - .active_low = 1, - } -}; - -static struct gpio_keys_button ap96_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AP96_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP96_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AP96_KEYS_DEBOUNCE_INTERVAL, - .gpio = AP96_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -#define AP96_WAN_PHYMASK 0x10 -#define AP96_LAN_PHYMASK 0x0f - -static void __init ap96_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_mdio(0, ~(AP96_WAN_PHYMASK | AP96_LAN_PHYMASK)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = AP96_LAN_PHYMASK; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - - ath79_init_mac(ath79_eth1_data.mac_addr, art, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = AP96_WAN_PHYMASK; - - ath79_eth1_pll_data.pll_1000 = 0x1f000000; - - ath79_register_eth(1); - - ath79_register_usb(); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap96_leds_gpio), - ap96_leds_gpio); - - ath79_register_gpio_keys_polled(-1, AP96_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap96_gpio_keys), - ap96_gpio_keys); - - ap94_pci_init(art + AP96_CALDATA0_OFFSET, - art + AP96_WMAC0_MAC_OFFSET, - art + AP96_CALDATA1_OFFSET, - art + AP96_WMAC1_MAC_OFFSET); -} - -MIPS_MACHINE(ATH79_MACH_AP96, "AP96", "Atheros AP96", ap96_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c25-v1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c25-v1.c deleted file mode 100644 index c6c646322..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c25-v1.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * TP-Link Archer C25 v1 board support - * - * Copyright (C) 2017 Ludwig Thomeczek - * based on mach-archer-c60/C59-v1.c - * Copyright (C) 2016 Henryk Heisig - * - * 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 "common.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include -#include - -#define ARCHER_C25_GPIO_SHIFT_OE 21 /* OE, Output Enable */ -#define ARCHER_C25_GPIO_SHIFT_SER 14 /* DS, Data Serial Input */ -#define ARCHER_C25_GPIO_SHIFT_SRCLK 15 /* SHCP, Shift Reg Clock Input */ -#define ARCHER_C25_GPIO_SHIFT_SRCLR 19 /* MR, Master Reset */ -#define ARCHER_C25_GPIO_SHIFT_RCLK 16 /* STCP, Storage Reg Clock Input */ - -#define ARCHER_C25_74HC_GPIO_BASE 32 -#define ARCHER_C25_74HC_GPIO_LED_WAN_AMBER (ARCHER_C25_74HC_GPIO_BASE + 4) -#define ARCHER_C25_74HC_GPIO_LED_WAN_GREEN (ARCHER_C25_74HC_GPIO_BASE + 5) -#define ARCHER_C25_74HC_GPIO_LED_WLAN2 (ARCHER_C25_74HC_GPIO_BASE + 6) -#define ARCHER_C25_74HC_GPIO_LED_WLAN5 (ARCHER_C25_74HC_GPIO_BASE + 7) -#define ARCHER_C25_74HC_GPIO_LED_LAN1 (ARCHER_C25_74HC_GPIO_BASE + 0) -#define ARCHER_C25_74HC_GPIO_LED_LAN2 (ARCHER_C25_74HC_GPIO_BASE + 1) -#define ARCHER_C25_74HC_GPIO_LED_LAN3 (ARCHER_C25_74HC_GPIO_BASE + 2) -#define ARCHER_C25_74HC_GPIO_LED_LAN4 (ARCHER_C25_74HC_GPIO_BASE + 3) - -#define ARCHER_C25_V1_SSR_BIT_0 0 -#define ARCHER_C25_V1_SSR_BIT_1 1 -#define ARCHER_C25_V1_SSR_BIT_2 2 -#define ARCHER_C25_V1_SSR_BIT_3 3 -#define ARCHER_C25_V1_SSR_BIT_4 4 -#define ARCHER_C25_V1_SSR_BIT_5 5 -#define ARCHER_C25_V1_SSR_BIT_6 6 -#define ARCHER_C25_V1_SSR_BIT_7 7 - - -#define ARCHER_C25_V1_KEYS_POLL_INTERVAL 20 -#define ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL \ - (3 * ARCHER_C25_V1_KEYS_POLL_INTERVAL) - -#define ARCHER_C25_V1_GPIO_BTN_RESET 1 -#define ARCHER_C25_V1_GPIO_BTN_RFKILL 22 - -#define ARCHER_C25_V1_GPIO_LED_POWER 17 -#define ARCHER_C25_V1_GPIO_LED_WPS 2 - -#define ARCHER_C25_V1_WMAC_CALDATA_OFFSET 0x1000 - -static struct spi_gpio_platform_data archer_c25_v1_spi_data = { - .sck = ARCHER_C25_GPIO_SHIFT_SRCLK, - .miso = SPI_GPIO_NO_MISO, - .mosi = ARCHER_C25_GPIO_SHIFT_SER, - .num_chipselect = 1, -}; - -static u8 archer_c25_v1_ssr_initdata[] = { - BIT(ARCHER_C25_V1_SSR_BIT_7) | - BIT(ARCHER_C25_V1_SSR_BIT_6) | - BIT(ARCHER_C25_V1_SSR_BIT_5) | - BIT(ARCHER_C25_V1_SSR_BIT_4) | - BIT(ARCHER_C25_V1_SSR_BIT_3) | - BIT(ARCHER_C25_V1_SSR_BIT_2) | - BIT(ARCHER_C25_V1_SSR_BIT_1) -}; - -static struct gen_74x164_chip_platform_data archer_c25_v1_ssr_data = { - .base = ARCHER_C25_74HC_GPIO_BASE, - .num_registers = ARRAY_SIZE(archer_c25_v1_ssr_initdata), - .init_data = archer_c25_v1_ssr_initdata, -}; - -static struct platform_device archer_c25_v1_spi_device = { - .name = "spi_gpio", - .id = 1, - .dev = { - .platform_data = &archer_c25_v1_spi_data, - }, -}; - -static struct spi_board_info archer_c25_v1_spi_info[] = { - { - .bus_num = 1, - .chip_select = 0, - .max_speed_hz = 10000000, - .modalias = "74x164", - .platform_data = &archer_c25_v1_ssr_data, - .controller_data = (void *) ARCHER_C25_GPIO_SHIFT_RCLK, - }, -}; - -static struct gpio_led archer_c25_v1_leds_gpio[] __initdata = { - { - .name = "archer-c25-v1:green:power", - .gpio = ARCHER_C25_V1_GPIO_LED_POWER, - .active_low = 1, - }, { - .name = "archer-c25-v1:green:wps", - .gpio = ARCHER_C25_V1_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "archer-c25-v1:green:wlan2g", - .gpio = ARCHER_C25_74HC_GPIO_LED_WLAN2, - .active_low = 1, - }, { - .name = "archer-c25-v1:green:wlan5g", - .gpio = ARCHER_C25_74HC_GPIO_LED_WLAN5, - .active_low = 1, - }, { - .name = "archer-c25-v1:green:lan1", - .gpio = ARCHER_C25_74HC_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "archer-c25-v1:green:lan2", - .gpio = ARCHER_C25_74HC_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "archer-c25-v1:green:lan3", - .gpio = ARCHER_C25_74HC_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "archer-c25-v1:green:lan4", - .gpio = ARCHER_C25_74HC_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "archer-c25-v1:green:wan", - .gpio = ARCHER_C25_74HC_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "archer-c25-v1:amber:wan", - .gpio = ARCHER_C25_74HC_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, -}; - -static struct gpio_keys_button archer_c25_v1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C25_V1_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = ARCHER_C25_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C25_V1_GPIO_BTN_RFKILL, - .active_low = 1, - }, -}; - -static void __init archer_c25_v1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f7e0008); - u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000); - - ath79_register_m25p80(NULL); - - spi_register_board_info(archer_c25_v1_spi_info, - ARRAY_SIZE(archer_c25_v1_spi_info)); - - platform_device_register(&archer_c25_v1_spi_device); - - gpio_request_one(ARCHER_C25_GPIO_SHIFT_OE, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "LED control"); - - gpio_request_one(ARCHER_C25_GPIO_SHIFT_SRCLR, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "LED reset"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c25_v1_leds_gpio), - archer_c25_v1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ARCHER_C25_V1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c25_v1_gpio_keys), - archer_c25_v1_gpio_keys); - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - - /* WAN port */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(4); - ath79_register_eth(0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - ath79_register_wmac(art + ARCHER_C25_V1_WMAC_CALDATA_OFFSET, mac); - ap91_pci_init(NULL, NULL); -} - -MIPS_MACHINE(ATH79_MACH_ARCHER_C25_V1, "ARCHER-C25-V1", "TP-LINK Archer C25 v1", - archer_c25_v1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c59-v1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c59-v1.c deleted file mode 100644 index c500c91a1..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c59-v1.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * TP-Link Archer C58/C59 v1 board support - * - * Copyright (C) 2017 Henryk Heisig - * - * 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 "common.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" - -#define ARCHER_C59_V1_KEYS_POLL_INTERVAL 20 -#define ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C59_V1_KEYS_POLL_INTERVAL) - -#define ARCHER_C59_V1_GPIO_BTN_RESET 21 -#define ARCHER_C59_V1_GPIO_BTN_RFKILL 2 -#define ARCHER_C59_V1_GPIO_BTN_WPS 1 - -#define ARCHER_C59_V1_GPIO_USB_POWER 22 - -#define ARCHER_C59_GPIO_SHIFT_OE 16 -#define ARCHER_C59_GPIO_SHIFT_SER 17 -#define ARCHER_C59_GPIO_SHIFT_SRCLK 18 -#define ARCHER_C59_GPIO_SHIFT_SRCLR 19 -#define ARCHER_C59_GPIO_SHIFT_RCLK 20 - -#define ARCHER_C59_74HC_GPIO_BASE 32 -#define ARCHER_C59_74HC_GPIO_LED_POWER (ARCHER_C59_74HC_GPIO_BASE + 0) -#define ARCHER_C59_74HC_GPIO_LED_WLAN2 (ARCHER_C59_74HC_GPIO_BASE + 1) -#define ARCHER_C59_74HC_GPIO_LED_WLAN5 (ARCHER_C59_74HC_GPIO_BASE + 2) -#define ARCHER_C59_74HC_GPIO_LED_LAN (ARCHER_C59_74HC_GPIO_BASE + 3) -#define ARCHER_C59_74HC_GPIO_LED_WAN_GREEN (ARCHER_C59_74HC_GPIO_BASE + 4) -#define ARCHER_C59_74HC_GPIO_LED_WAN_AMBER (ARCHER_C59_74HC_GPIO_BASE + 5) -#define ARCHER_C59_74HC_GPIO_LED_WPS (ARCHER_C59_74HC_GPIO_BASE + 6) -#define ARCHER_C59_74HC_GPIO_LED_USB (ARCHER_C59_74HC_GPIO_BASE + 7) - -#define ARCHER_C59_V1_SSR_BIT_0 0 -#define ARCHER_C59_V1_SSR_BIT_1 1 -#define ARCHER_C59_V1_SSR_BIT_2 2 -#define ARCHER_C59_V1_SSR_BIT_3 3 -#define ARCHER_C59_V1_SSR_BIT_4 4 -#define ARCHER_C59_V1_SSR_BIT_5 5 -#define ARCHER_C59_V1_SSR_BIT_6 6 -#define ARCHER_C59_V1_SSR_BIT_7 7 - -#define ARCHER_C59_V1_WMAC_CALDATA_OFFSET 0x1000 -#define ARCHER_C59_V1_PCI_CALDATA_OFFSET 0x5000 - -static struct gpio_led archer_c58_v1_leds_gpio[] __initdata = { - { - .name = "archer-c58-v1:green:power", - .gpio = ARCHER_C59_74HC_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "archer-c58-v1:green:wlan2g", - .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN2, - .active_low = 1, - }, - { - .name = "archer-c58-v1:green:wlan5g", - .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN5, - .active_low = 1, - }, - { - .name = "archer-c58-v1:green:lan", - .gpio = ARCHER_C59_74HC_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "archer-c58-v1:green:wan", - .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, - { - .name = "archer-c58-v1:amber:wan", - .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, - { - .name = "archer-c58-v1:green:wps", - .gpio = ARCHER_C59_74HC_GPIO_LED_WPS, - .active_low = 1, - }, -}; - -static struct gpio_led archer_c59_v1_leds_gpio[] __initdata = { - { - .name = "archer-c59-v1:green:power", - .gpio = ARCHER_C59_74HC_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "archer-c59-v1:green:wlan2g", - .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN2, - .active_low = 1, - }, - { - .name = "archer-c59-v1:green:wlan5g", - .gpio = ARCHER_C59_74HC_GPIO_LED_WLAN5, - .active_low = 1, - }, - { - .name = "archer-c59-v1:green:lan", - .gpio = ARCHER_C59_74HC_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "archer-c59-v1:green:wan", - .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, - { - .name = "archer-c59-v1:amber:wan", - .gpio = ARCHER_C59_74HC_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, - { - .name = "archer-c59-v1:green:wps", - .gpio = ARCHER_C59_74HC_GPIO_LED_WPS, - .active_low = 1, - }, - { - .name = "archer-c59-v1:green:usb", - .gpio = ARCHER_C59_74HC_GPIO_LED_USB, - .active_low = 1, - }, -}; - -static struct gpio_keys_button archer_c59_v1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C59_V1_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C59_V1_GPIO_BTN_RFKILL, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = ARCHER_C59_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C59_V1_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static struct spi_gpio_platform_data archer_c59_v1_spi_data = { - .sck = ARCHER_C59_GPIO_SHIFT_SRCLK, - .miso = SPI_GPIO_NO_MISO, - .mosi = ARCHER_C59_GPIO_SHIFT_SER, - .num_chipselect = 1, -}; - -static u8 archer_c59_v1_ssr_initdata[] = { - BIT(ARCHER_C59_V1_SSR_BIT_7) | - BIT(ARCHER_C59_V1_SSR_BIT_6) | - BIT(ARCHER_C59_V1_SSR_BIT_5) | - BIT(ARCHER_C59_V1_SSR_BIT_4) | - BIT(ARCHER_C59_V1_SSR_BIT_3) | - BIT(ARCHER_C59_V1_SSR_BIT_2) | - BIT(ARCHER_C59_V1_SSR_BIT_1) -}; - -static struct gen_74x164_chip_platform_data archer_c59_v1_ssr_data = { - .base = ARCHER_C59_74HC_GPIO_BASE, - .num_registers = ARRAY_SIZE(archer_c59_v1_ssr_initdata), - .init_data = archer_c59_v1_ssr_initdata, -}; - -static struct platform_device archer_c59_v1_spi_device = { - .name = "spi_gpio", - .id = 1, - .dev = { - .platform_data = &archer_c59_v1_spi_data, - }, -}; - -static struct spi_board_info archer_c59_v1_spi_info[] = { - { - .bus_num = 1, - .chip_select = 0, - .max_speed_hz = 10000000, - .modalias = "74x164", - .platform_data = &archer_c59_v1_ssr_data, - .controller_data = (void *) ARCHER_C59_GPIO_SHIFT_RCLK, - }, -}; - -static void __init archer_c5x_v1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f010008); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - spi_register_board_info(archer_c59_v1_spi_info, - ARRAY_SIZE(archer_c59_v1_spi_info)); - platform_device_register(&archer_c59_v1_spi_device); - - ath79_register_gpio_keys_polled(-1, ARCHER_C59_V1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c59_v1_gpio_keys), - archer_c59_v1_gpio_keys); - - ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP | - QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP); - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - /* WAN port */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - ath79_register_eth(0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(0); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - ath79_register_wmac(art + ARCHER_C59_V1_WMAC_CALDATA_OFFSET, mac); - ap91_pci_init(art + ARCHER_C59_V1_PCI_CALDATA_OFFSET, NULL); - - ath79_register_usb(); - gpio_request_one(ARCHER_C59_V1_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - gpio_request_one(ARCHER_C59_GPIO_SHIFT_OE, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "LED control"); - gpio_request_one(ARCHER_C59_GPIO_SHIFT_SRCLR, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "LED reset"); -} - -static void __init archer_c58_v1_setup(void) -{ - archer_c5x_v1_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c58_v1_leds_gpio), - archer_c58_v1_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_ARCHER_C58_V1, "ARCHER-C58-V1", - "TP-LINK Archer C58 v1", archer_c58_v1_setup); - -static void __init archer_c59_v1_setup(void) -{ - archer_c5x_v1_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c59_v1_leds_gpio), - archer_c59_v1_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_ARCHER_C59_V1, "ARCHER-C59-V1", - "TP-LINK Archer C59 v1", archer_c59_v1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c60-v1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c60-v1.c deleted file mode 100644 index 88f4f081a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c60-v1.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * TP-Link Archer C60 v1 board support - * - * Copyright (C) 2017 Henryk Heisig - * - * 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 "common.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" - -#define ARCHER_C60_V1_GPIO_LED_LAN 2 -#define ARCHER_C60_V1_GPIO_LED_POWER 16 -#define ARCHER_C60_V1_GPIO_LED_WLAN2 17 -#define ARCHER_C60_V1_GPIO_LED_WLAN5 18 -#define ARCHER_C60_V1_GPIO_LED_WPS 19 -#define ARCHER_C60_V1_GPIO_LED_WAN_GREEN 20 -#define ARCHER_C60_V1_GPIO_LED_WAN_AMBER 22 - - -#define ARCHER_C60_V1_KEYS_POLL_INTERVAL 20 -#define ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C60_V1_KEYS_POLL_INTERVAL) - -#define ARCHER_C60_V1_GPIO_BTN_RESET 21 -#define ARCHER_C60_V1_GPIO_BTN_RFKILL 1 - - - -#define ARCHER_C60_V1_WMAC_CALDATA_OFFSET 0x1000 -#define ARCHER_C60_V1_PCI_CALDATA_OFFSET 0x5000 - -static struct gpio_led archer_c60_v1_leds_gpio[] __initdata = { - { - .name = "archer-c60-v1:green:power", - .gpio = ARCHER_C60_V1_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "archer-c60-v1:green:wlan2g", - .gpio = ARCHER_C60_V1_GPIO_LED_WLAN2, - .active_low = 1, - }, - { - .name = "archer-c60-v1:green:wlan5g", - .gpio = ARCHER_C60_V1_GPIO_LED_WLAN5, - .active_low = 1, - }, - { - .name = "archer-c60-v1:green:lan", - .gpio = ARCHER_C60_V1_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "archer-c60-v1:green:wan", - .gpio = ARCHER_C60_V1_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, - { - .name = "archer-c60-v1:amber:wan", - .gpio = ARCHER_C60_V1_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, - { - .name = "archer-c60-v1:green:wps", - .gpio = ARCHER_C60_V1_GPIO_LED_WPS, - .active_low = 1, - }, -}; - -static struct gpio_led archer_c60_v2_leds_gpio[] __initdata = { - { - .name = "archer-c60-v2:green:power", - .gpio = ARCHER_C60_V1_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "archer-c60-v2:green:wlan2g", - .gpio = ARCHER_C60_V1_GPIO_LED_WLAN2, - .active_low = 1, - }, - { - .name = "archer-c60-v2:green:wlan5g", - .gpio = ARCHER_C60_V1_GPIO_LED_WLAN5, - .active_low = 1, - }, - { - .name = "archer-c60-v2:green:lan", - .gpio = ARCHER_C60_V1_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "archer-c60-v2:green:wan", - .gpio = ARCHER_C60_V1_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, - { - .name = "archer-c60-v2:amber:wan", - .gpio = ARCHER_C60_V1_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, - { - .name = "archer-c60-v2:green:wps", - .gpio = ARCHER_C60_V1_GPIO_LED_WPS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button archer_c60_v1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C60_V1_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = ARCHER_C60_V1_GPIO_BTN_RFKILL, - .active_low = 1, - }, -}; - -static void __init archer_c60_v1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f010008); - u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c60_v1_leds_gpio), - archer_c60_v1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ARCHER_C60_V1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c60_v1_gpio_keys), - archer_c60_v1_gpio_keys); - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - - /* WAN port */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(4); - ath79_register_eth(0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - ath79_register_wmac(art + ARCHER_C60_V1_WMAC_CALDATA_OFFSET, mac); - ap91_pci_init(art + ARCHER_C60_V1_PCI_CALDATA_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_ARCHER_C60_V1, "ARCHER-C60-V1", - "TP-LINK Archer C60 v1", archer_c60_v1_setup); - -static void __init archer_c60_v2_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fb08); - u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c60_v2_leds_gpio), - archer_c60_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ARCHER_C60_V1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c60_v1_gpio_keys), - archer_c60_v1_gpio_keys); - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - - /* WAN port */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(4); - ath79_register_eth(0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - ath79_register_wmac(art + ARCHER_C60_V1_WMAC_CALDATA_OFFSET, mac); - ap91_pci_init(art + ARCHER_C60_V1_PCI_CALDATA_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_ARCHER_C60_V2, "ARCHER-C60-V2", - "TP-LINK Archer C60 v2", archer_c60_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-arduino-yun.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-arduino-yun.c deleted file mode 100644 index 5873248ed..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-arduino-yun.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Arduino Yun support - * - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2015 Hauke Mehrtens - * - * 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 "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include -#include -#include -#include "common.h" - -// Uncomment to have reset on gpio18 instead of gipo7 -#define DS2_B - -#define DS_GPIO_LED_WLAN 0 -#define DS_GPIO_LED_USB 1 - -#define DS_GPIO_OE 21 -#define DS_GPIO_AVR_RESET 18 - -// Maintained to have the console in the previous version of DS2 working -#define DS_GPIO_AVR_RESET_DS2 7 - -#define DS_GPIO_OE2 22 -#define DS_GPIO_UART_ENA 23 -#define DS_GPIO_CONF_BTN 20 - -#define DS_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DS_KEYS_DEBOUNCE_INTERVAL (3 * DS_KEYS_POLL_INTERVAL) - -#define DS_MAC0_OFFSET 0x0000 -#define DS_MAC1_OFFSET 0x0006 -#define DS_CALDATA_OFFSET 0x1000 -#define DS_WMAC_MAC_OFFSET 0x1002 - - -static struct gpio_led ds_leds_gpio[] __initdata = { - { - .name = "arduino:white:usb", - .gpio = DS_GPIO_LED_USB, - .active_low = 0, - }, - { - .name = "arduino:blue:wlan", - .gpio = DS_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ds_gpio_keys[] __initdata = { - { - .desc = "configuration button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DS_KEYS_DEBOUNCE_INTERVAL, - .gpio = DS_GPIO_CONF_BTN, - .active_low = 1, - }, -}; - -static void __init ds_common_setup(void) -{ - static u8 mac[6]; - - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - ath79_register_m25p80(NULL); - - if (ar93xx_wmac_read_mac_address(mac)) { - ath79_register_wmac(NULL, NULL); - } else { - ath79_register_wmac(art + DS_CALDATA_OFFSET, - art + DS_WMAC_MAC_OFFSET); - memcpy(mac, art + DS_WMAC_MAC_OFFSET, sizeof(mac)); - } - - mac[3] |= 0x08; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - mac[3] &= 0xF7; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_mdio(0, 0x0); - - /* LAN ports */ - ath79_register_eth(1); - - /* WAN port */ - ath79_register_eth(0); -} - -static void __init ds_setup(void) -{ - u32 t; - - ds_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ds_leds_gpio), - ds_leds_gpio); - ath79_register_gpio_keys_polled(-1, DS_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ds_gpio_keys), - ds_gpio_keys); - ath79_register_usb(); - - /* use the swtich_led directly form sysfs */ - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - //Disable the Function for some pins to have GPIO functionality active - // GPIO6-7-8 and GPIO11 - ath79_gpio_function_setup(AR933X_GPIO_FUNC_JTAG_DISABLE | AR933X_GPIO_FUNC_I2S_MCK_EN, 0); - - ath79_gpio_function2_setup(AR933X_GPIO_FUNC2_JUMPSTART_DISABLE, 0); - - printk("Setting DogStick2 GPIO\n"); - - t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); - t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN; - ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t); - - // Put the avr reset to high - if (gpio_request_one(DS_GPIO_AVR_RESET_DS2, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-1") != 0) - printk("Error setting GPIO OE\n"); - gpio_unexport(DS_GPIO_AVR_RESET_DS2); - gpio_free(DS_GPIO_AVR_RESET_DS2); - - // enable OE of level shifter - if (gpio_request_one(DS_GPIO_OE, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-1") != 0) - printk("Error setting GPIO OE\n"); - - if (gpio_request_one(DS_GPIO_UART_ENA, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "UART-ENA") != 0) - printk("Error setting GPIO Uart Enable\n"); - - // enable OE of level shifter - if (gpio_request_one(DS_GPIO_OE2, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-2") != 0) - printk("Error setting GPIO OE2\n"); -} - -MIPS_MACHINE(ATH79_MACH_ARDUINO_YUN, "Yun", "Arduino Yun", ds_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-aw-nr580.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-aw-nr580.c deleted file mode 100644 index 281129b78..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-aw-nr580.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * AzureWave AW-NR580 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 "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "machtypes.h" -#include "pci.h" - -#define AW_NR580_GPIO_LED_READY_RED 0 -#define AW_NR580_GPIO_LED_WLAN 1 -#define AW_NR580_GPIO_LED_READY_GREEN 2 -#define AW_NR580_GPIO_LED_WPS_GREEN 4 -#define AW_NR580_GPIO_LED_WPS_AMBER 5 - -#define AW_NR580_GPIO_BTN_WPS 3 -#define AW_NR580_GPIO_BTN_RESET 11 - -#define AW_NR580_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AW_NR580_KEYS_DEBOUNCE_INTERVAL (3 * AW_NR580_KEYS_POLL_INTERVAL) - -static struct gpio_led aw_nr580_leds_gpio[] __initdata = { - { - .name = "aw-nr580:red:ready", - .gpio = AW_NR580_GPIO_LED_READY_RED, - .active_low = 0, - }, { - .name = "aw-nr580:green:ready", - .gpio = AW_NR580_GPIO_LED_READY_GREEN, - .active_low = 0, - }, { - .name = "aw-nr580:green:wps", - .gpio = AW_NR580_GPIO_LED_WPS_GREEN, - .active_low = 0, - }, { - .name = "aw-nr580:amber:wps", - .gpio = AW_NR580_GPIO_LED_WPS_AMBER, - .active_low = 0, - }, { - .name = "aw-nr580:green:wlan", - .gpio = AW_NR580_GPIO_LED_WLAN, - .active_low = 0, - } -}; - -static struct gpio_keys_button aw_nr580_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL, - .gpio = AW_NR580_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL, - .gpio = AW_NR580_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static const char *aw_nr580_part_probes[] = { - "RedBoot", - NULL, -}; - -static struct flash_platform_data aw_nr580_flash_data = { - .part_probes = aw_nr580_part_probes, -}; - -static void __init aw_nr580_setup(void) -{ - ath79_register_mdio(0, 0x0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - - ath79_register_pci(); - - ath79_register_m25p80(&aw_nr580_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio), - aw_nr580_leds_gpio); - - ath79_register_gpio_keys_polled(-1, AW_NR580_KEYS_POLL_INTERVAL, - ARRAY_SIZE(aw_nr580_gpio_keys), - aw_nr580_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_AW_NR580, "AW-NR580", "AzureWave AW-NR580", - aw_nr580_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bhu-bxu2000n2-a.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bhu-bxu2000n2-a.c deleted file mode 100644 index 8d7c6112d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bhu-bxu2000n2-a.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * BHU BXU2000n-2 A1 board support - * - * Copyright (C) 2013 Terry Yang - * - * 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-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define BHU_BXU2000N2_A1_GPIO_LED_WLAN 13 -#define BHU_BXU2000N2_A1_GPIO_LED_WAN 19 -#define BHU_BXU2000N2_A1_GPIO_LED_LAN 21 -#define BHU_BXU2000N2_A1_GPIO_LED_SYSTEM 14 - -#define BHU_BXU2000N2_A1_GPIO_BTN_RESET 17 - -#define BHU_BXU2000N2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL \ - (3 * BHU_BXU2000N2_KEYS_POLL_INTERVAL) - -static const char *bhu_bxu2000n2_part_probes[] = { - "cmdlinepart", - NULL, -}; - -static struct flash_platform_data bhu_bxu2000n2_flash_data = { - .part_probes = bhu_bxu2000n2_part_probes, -}; - -static struct gpio_led bhu_bxu2000n2_a1_leds_gpio[] __initdata = { - { - .name = "bhu:green:status", - .gpio = BHU_BXU2000N2_A1_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "bhu:green:lan", - .gpio = BHU_BXU2000N2_A1_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "bhu:green:wan", - .gpio = BHU_BXU2000N2_A1_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "bhu:green:wlan", - .gpio = BHU_BXU2000N2_A1_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button bhu_bxu2000n2_a1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL, - .gpio = BHU_BXU2000N2_A1_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init bhu_ap123_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&bhu_bxu2000n2_flash_data); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - - /* GMAC0 is connected to the PHY4 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch. Only use PHY3 */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.phy_mask = BIT(3); - ath79_register_eth(1); - - ath79_register_wmac(ee, ee+2); -} - -static void __init bhu_bxu2000n2_a1_setup(void) -{ - bhu_ap123_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxu2000n2_a1_leds_gpio), - bhu_bxu2000n2_a1_leds_gpio); - - ath79_register_gpio_keys_polled(1, BHU_BXU2000N2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(bhu_bxu2000n2_a1_gpio_keys), - bhu_bxu2000n2_a1_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_BHU_BXU2000N2_A1, "BXU2000n-2-A1", - "BHU BXU2000n-2 rev. A1", - bhu_bxu2000n2_a1_setup); - diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bsb.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bsb.c deleted file mode 100644 index 9f9be02eb..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bsb.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Smart Electronics Black Swift board support - * - * Copyright (C) 2014 Dmitriy Zherebkov dzh@black-swift.com - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define BSB_GPIO_LED_SYS 27 - -#define BSB_GPIO_BTN_RESET 11 - -#define BSB_KEYS_POLL_INTERVAL 20 /* msecs */ -#define BSB_KEYS_DEBOUNCE_INTERVAL (3 * BSB_KEYS_POLL_INTERVAL) - -#define BSB_MAC_OFFSET 0x0000 -#define BSB_CALDATA_OFFSET 0x1000 - -static struct gpio_led bsb_leds_gpio[] __initdata = { - { - .name = "bsb:red:sys", - .gpio = BSB_GPIO_LED_SYS, - .active_low = 1, - } -}; - -static struct gpio_keys_button bsb_gpio_keys[] __initdata = { - { - .desc = "reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = BSB_KEYS_DEBOUNCE_INTERVAL, - .gpio = BSB_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init bsb_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false,false); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(bsb_leds_gpio), - bsb_leds_gpio); - ath79_register_gpio_keys_polled(-1, BSB_KEYS_POLL_INTERVAL, - ARRAY_SIZE(bsb_gpio_keys), - bsb_gpio_keys); - - ath79_register_usb(); - - ath79_register_m25p80(NULL); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + BSB_MAC_OFFSET, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, art + BSB_MAC_OFFSET, 2); - - ath79_register_mdio(0, 0x0); - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(art + BSB_CALDATA_OFFSET, - art + BSB_MAC_OFFSET); -} - -MIPS_MACHINE(ATH79_MACH_BSB, "BSB", "Smart Electronics Black Swift board", - bsb_setup); - diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-c55.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-c55.c deleted file mode 100644 index 8aa5ecb6a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-c55.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * AirTight Networks C-55 board support - * - * Copyright (C) 2014-2015 Chris Blake - * - * Based on Senao CAP4200AG board 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 - -#include - -#include "common.h" -#include "pci.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-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define C55_GPIO_LED_PWR_GREEN 12 -#define C55_GPIO_LED_PWR_AMBER 13 -#define C55_GPIO_LED_LAN_GREEN 14 -#define C55_GPIO_LED_LAN_AMBER 15 -#define C55_GPIO_LED_WLAN_GREEN 18 -#define C55_GPIO_LED_WLAN_AMBER 19 - -#define C55_GPIO_BTN_RESET 17 - -#define C55_KEYS_POLL_INTERVAL 20 /* msecs */ -#define C55_KEYS_DEBOUNCE_INTERVAL (3 * C55_KEYS_POLL_INTERVAL) - -#define C55_MAC_OFFSET 0 -#define C55_WMAC_CALDATA_OFFSET 0x1000 -#define C55_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led c55_leds_gpio[] __initdata = { - { - .name = "c-55:green:pwr", - .gpio = C55_GPIO_LED_PWR_GREEN, - .active_low = 1, - }, - { - .name = "c-55:amber:pwr", - .gpio = C55_GPIO_LED_PWR_AMBER, - .active_low = 1, - }, - { - .name = "c-55:green:lan", - .gpio = C55_GPIO_LED_LAN_GREEN, - .active_low = 1, - }, - { - .name = "c-55:amber:lan", - .gpio = C55_GPIO_LED_LAN_AMBER, - .active_low = 1, - }, - { - .name = "c-55:green:wlan", - .gpio = C55_GPIO_LED_WLAN_GREEN, - .active_low = 1, - }, - { - .name = "c-55:amber:wlan", - .gpio = C55_GPIO_LED_WLAN_AMBER, - .active_low = 1, - }, -}; - -static struct gpio_keys_button c55_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = C55_KEYS_DEBOUNCE_INTERVAL, - .gpio = C55_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init c55_setup(void) -{ - /* SPI Storage*/ - ath79_register_m25p80(NULL); - - /* MDIO Interface */ - ath79_register_mdio(0, 0x0); - - /* AR8035-A Ethernet */ - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - ath79_init_mac(ath79_eth0_data.mac_addr, NULL, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); - - /* LEDs & GPIO */ - ath79_gpio_output_select(C55_GPIO_LED_LAN_GREEN, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(C55_GPIO_LED_LAN_AMBER, - AR934X_GPIO_OUT_GPIO); - ath79_register_leds_gpio(-1, ARRAY_SIZE(c55_leds_gpio), - c55_leds_gpio); - ath79_register_gpio_keys_polled(-1, C55_KEYS_POLL_INTERVAL, - ARRAY_SIZE(c55_gpio_keys), - c55_gpio_keys); - - /* WiFi */ - ath79_wmac_disable_2ghz(); - ath79_register_wmac_simple(); - ap91_pci_init_simple(); - -} -MIPS_MACHINE(ATH79_MACH_C55, "C-55", "AirTight Networks C-55", - c55_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cap324.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cap324.c deleted file mode 100644 index 2a6aed5b4..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cap324.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * PowerCloud Systems CAP324 board support - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2012-2013 PowerCloud Systems - * Copyright (C) 2015 Daniel Dickinson - * - * 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define CAP324_GPIO_LED_POWER_GREEN 12 -#define CAP324_GPIO_LED_POWER_AMBER 13 -#define CAP324_GPIO_LED_LAN_GREEN 14 -#define CAP324_GPIO_LED_LAN_AMBER 15 -#define CAP324_GPIO_LED_WLAN_GREEN 18 -#define CAP324_GPIO_LED_WLAN_AMBER 19 - -#define CAP324_GPIO_BTN_RESET 17 - -#define CAP324_KEYS_POLL_INTERVAL 20 /* msecs */ -#define CAP324_KEYS_DEBOUNCE_INTERVAL (3 * CAP324_KEYS_POLL_INTERVAL) - -#define CAP324_MAC_OFFSET 0 -#define CAP324_WMAC_CALDATA_OFFSET 0x1000 -#define CAP324_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led cap324_leds_gpio[] __initdata = { - { - .name = "pcs:green:power", - .gpio = CAP324_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, - { - .name = "pcs:amber:power", - .gpio = CAP324_GPIO_LED_POWER_AMBER, - .active_low = 1, - }, - { - .name = "pcs:green:lan", - .gpio = CAP324_GPIO_LED_LAN_GREEN, - .active_low = 1, - }, - { - .name = "pcs:amber:lan", - .gpio = CAP324_GPIO_LED_LAN_AMBER, - .active_low = 1, - }, - { - .name = "pcs:green:wlan", - .gpio = CAP324_GPIO_LED_WLAN_GREEN, - .active_low = 1, - }, - { - .name = "pcs:amber:wlan", - .gpio = CAP324_GPIO_LED_WLAN_AMBER, - .active_low = 1, - }, -}; - -static struct gpio_keys_button cap324_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CAP324_KEYS_DEBOUNCE_INTERVAL, - .gpio = CAP324_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init cap324_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - ath79_gpio_output_select(CAP324_GPIO_LED_LAN_GREEN, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(CAP324_GPIO_LED_LAN_AMBER, - AR934X_GPIO_OUT_GPIO); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cap324_leds_gpio), - cap324_leds_gpio); - ath79_register_gpio_keys_polled(-1, CAP324_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cap324_gpio_keys), - cap324_gpio_keys); - - ath79_init_mac(mac, art + CAP324_MAC_OFFSET, -1); - ath79_wmac_disable_2ghz(); - ath79_register_wmac(art + CAP324_WMAC_CALDATA_OFFSET, mac); - - ath79_init_mac(mac, art + CAP324_MAC_OFFSET, -2); - ap91_pci_init(art + CAP324_PCIE_CALDATA_OFFSET, mac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, - art + CAP324_MAC_OFFSET, -2); - - /* GMAC0 is connected to an external PHY */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_CAP324, "CAP324", "PowerCloud CAP324", - cap324_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cap4200ag.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cap4200ag.c deleted file mode 100644 index 18944c40f..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cap4200ag.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Senao CAP4200AG board 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define CAP4200AG_GPIO_LED_PWR_GREEN 12 -#define CAP4200AG_GPIO_LED_PWR_AMBER 13 -#define CAP4200AG_GPIO_LED_LAN_GREEN 14 -#define CAP4200AG_GPIO_LED_LAN_AMBER 15 -#define CAP4200AG_GPIO_LED_WLAN_GREEN 18 -#define CAP4200AG_GPIO_LED_WLAN_AMBER 19 - -#define CAP4200AG_GPIO_BTN_RESET 17 - -#define CAP4200AG_KEYS_POLL_INTERVAL 20 /* msecs */ -#define CAP4200AG_KEYS_DEBOUNCE_INTERVAL (3 * CAP4200AG_KEYS_POLL_INTERVAL) - -#define CAP4200AG_MAC_OFFSET 0 -#define CAP4200AG_WMAC_CALDATA_OFFSET 0x1000 -#define CAP4200AG_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led cap4200ag_leds_gpio[] __initdata = { - { - .name = "senao:green:pwr", - .gpio = CAP4200AG_GPIO_LED_PWR_GREEN, - .active_low = 1, - }, - { - .name = "senao:amber:pwr", - .gpio = CAP4200AG_GPIO_LED_PWR_AMBER, - .active_low = 1, - }, - { - .name = "senao:green:lan", - .gpio = CAP4200AG_GPIO_LED_LAN_GREEN, - .active_low = 1, - }, - { - .name = "senao:amber:lan", - .gpio = CAP4200AG_GPIO_LED_LAN_AMBER, - .active_low = 1, - }, - { - .name = "senao:green:wlan", - .gpio = CAP4200AG_GPIO_LED_WLAN_GREEN, - .active_low = 1, - }, - { - .name = "senao:amber:wlan", - .gpio = CAP4200AG_GPIO_LED_WLAN_AMBER, - .active_low = 1, - }, -}; - -static struct gpio_keys_button cap4200ag_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CAP4200AG_KEYS_DEBOUNCE_INTERVAL, - .gpio = CAP4200AG_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init cap4200ag_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - ath79_gpio_output_select(CAP4200AG_GPIO_LED_LAN_GREEN, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(CAP4200AG_GPIO_LED_LAN_AMBER, - AR934X_GPIO_OUT_GPIO); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cap4200ag_leds_gpio), - cap4200ag_leds_gpio); - ath79_register_gpio_keys_polled(-1, CAP4200AG_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cap4200ag_gpio_keys), - cap4200ag_gpio_keys); - - ath79_init_mac(mac, art + CAP4200AG_MAC_OFFSET, -1); - ath79_wmac_disable_2ghz(); - ath79_register_wmac(art + CAP4200AG_WMAC_CALDATA_OFFSET, mac); - - ath79_init_mac(mac, art + CAP4200AG_MAC_OFFSET, -2); - ap91_pci_init(art + CAP4200AG_PCIE_CALDATA_OFFSET, mac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, - art + CAP4200AG_MAC_OFFSET, -2); - - /* GMAC0 is connected to an external PHY */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_CAP4200AG, "CAP4200AG", "Senao CAP4200AG", - cap4200ag_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-carambola2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-carambola2.c deleted file mode 100644 index babe10114..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-carambola2.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 8devices Carambola2 board support - * - * Copyright (C) 2013 Darius Augulis - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define CARAMBOLA2_GPIO_LED_WLAN 0 -#define CARAMBOLA2_GPIO_LED_ETH0 14 -#define CARAMBOLA2_GPIO_LED_ETH1 13 - -#define CARAMBOLA2_GPIO_BTN_JUMPSTART 11 - -#define CARAMBOLA2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define CARAMBOLA2_KEYS_DEBOUNCE_INTERVAL (3 * CARAMBOLA2_KEYS_POLL_INTERVAL) - -#define CARAMBOLA2_MAC0_OFFSET 0x0000 -#define CARAMBOLA2_MAC1_OFFSET 0x0006 -#define CARAMBOLA2_CALDATA_OFFSET 0x1000 -#define CARAMBOLA2_WMAC_MAC_OFFSET 0x1002 - -static struct gpio_led carambola2_leds_gpio[] __initdata = { - { - .name = "carambola2:green:wlan", - .gpio = CARAMBOLA2_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "carambola2:orange:eth0", - .gpio = CARAMBOLA2_GPIO_LED_ETH0, - .active_low = 0, - }, { - .name = "carambola2:orange:eth1", - .gpio = CARAMBOLA2_GPIO_LED_ETH1, - .active_low = 0, - } -}; - -static struct gpio_keys_button carambola2_gpio_keys[] __initdata = { - { - .desc = "jumpstart button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = CARAMBOLA2_KEYS_DEBOUNCE_INTERVAL, - .gpio = CARAMBOLA2_GPIO_BTN_JUMPSTART, - .active_low = 1, - }, -}; - -static void __init carambola2_common_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - ath79_register_wmac(art + CARAMBOLA2_CALDATA_OFFSET, - art + CARAMBOLA2_WMAC_MAC_OFFSET); - - ath79_setup_ar933x_phy4_switch(true, true); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + CARAMBOLA2_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art + CARAMBOLA2_MAC1_OFFSET, 0); - - ath79_register_mdio(0, 0x0); - - /* LAN ports */ - ath79_register_eth(1); - - /* WAN port */ - ath79_register_eth(0); -} - -static void __init carambola2_setup(void) -{ - carambola2_common_setup(); - - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(carambola2_leds_gpio), - carambola2_leds_gpio); - ath79_register_gpio_keys_polled(-1, CARAMBOLA2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(carambola2_gpio_keys), - carambola2_gpio_keys); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_CARAMBOLA2, "CARAMBOLA2", "8devices Carambola2 board", - carambola2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cpe870.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cpe870.c deleted file mode 100644 index 284cdc71c..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cpe870.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * YunCore CPE870 board support - * - * 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 "common.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 CPE870_GPIO_LED_LINK1 0 -#define CPE870_GPIO_LED_LINK2 1 -#define CPE870_GPIO_LED_LINK3 2 -#define CPE870_GPIO_LED_LINK4 3 -#define CPE870_GPIO_LED_WLAN 13 -#define CPE870_GPIO_LED_WAN 19 -#define CPE870_GPIO_LED_LAN 20 - -#define CPE870_GPIO_BTN_RESET 16 - -#define CPE870_KEYS_POLL_INTERVAL 20 -#define CPE870_KEYS_DEBOUNCE_INTERVAL (3 * CPE870_KEYS_POLL_INTERVAL) - -static struct gpio_led cpe870_leds_gpio[] __initdata = { - { - .name = "cpe870:green:lan", - .gpio = CPE870_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "cpe870:green:wan", - .gpio = CPE870_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "cpe870:green:wlan", - .gpio = CPE870_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "cpe870:green:link1", - .gpio = CPE870_GPIO_LED_LINK1, - .active_low = 1, - }, - { - .name = "cpe870:green:link2", - .gpio = CPE870_GPIO_LED_LINK2, - .active_low = 1, - }, - { - .name = "cpe870:green:link3", - .gpio = CPE870_GPIO_LED_LINK3, - .active_low = 1, - }, - { - .name = "cpe870:green:link4", - .gpio = CPE870_GPIO_LED_LINK4, - .active_low = 1, - }, -}; - -static struct gpio_keys_button cpe870_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = CPE870_KEYS_DEBOUNCE_INTERVAL, - .gpio = CPE870_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init cpe870_gpio_setup(void) -{ - /* Disable JTAG (enables GPIO0-3) */ - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_gpio_direction_select(CPE870_GPIO_LED_LINK1, true); - ath79_gpio_direction_select(CPE870_GPIO_LED_LINK2, true); - ath79_gpio_direction_select(CPE870_GPIO_LED_LINK3, true); - ath79_gpio_direction_select(CPE870_GPIO_LED_LINK4, true); - - /* Mute LEDs on boot */ - gpio_set_value(CPE870_GPIO_LED_LAN, 1); - gpio_set_value(CPE870_GPIO_LED_WAN, 1); - gpio_set_value(CPE870_GPIO_LED_LINK1, 1); - gpio_set_value(CPE870_GPIO_LED_LINK2, 1); - gpio_set_value(CPE870_GPIO_LED_LINK3, 1); - gpio_set_value(CPE870_GPIO_LED_LINK4, 1); - - ath79_gpio_output_select(CPE870_GPIO_LED_LINK1, 0); - ath79_gpio_output_select(CPE870_GPIO_LED_LINK2, 0); - ath79_gpio_output_select(CPE870_GPIO_LED_LINK3, 0); - ath79_gpio_output_select(CPE870_GPIO_LED_LINK4, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe870_leds_gpio), - cpe870_leds_gpio); - - ath79_register_gpio_keys_polled(-1, CPE870_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cpe870_gpio_keys), - cpe870_gpio_keys); -} - -static void __init cpe870_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff1000); - u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - cpe870_gpio_setup(); - - ath79_register_mdio(1, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - ath79_register_eth(1); - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); - - ath79_register_wmac(art, NULL); -} - -MIPS_MACHINE(ATH79_MACH_CPE870, "CPE870", "YunCore CPE870", cpe870_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cr3000.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cr3000.c deleted file mode 100644 index b351ae59c..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cr3000.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * PowerCloud Systems CR3000 support - * - * Copyright (c) 2011 Qualcomm Atheros - * Copyright (c) 2011-2012 Gabor Juhos - * Copyright (c) 2012-2013 PowerCloud Systems - * Copyright (c) 2015 Daniel Dickinson - * - * 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-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define CR3000_GPIO_LED_WLAN_2G 13 -#define CR3000_GPIO_LED_POWER_AMBER 15 -#define CR3000_GPIO_LED_WAN 18 -#define CR3000_GPIO_LED_LAN1 19 -#define CR3000_GPIO_LED_LAN2 20 -#define CR3000_GPIO_LED_LAN3 21 -#define CR3000_GPIO_LED_LAN4 22 - -#define CR3000_GPIO_BTN_WPS 16 -#define CR3000_GPIO_BTN_RESET 17 - -#define CR3000_KEYS_POLL_INTERVAL 20 /* msecs */ -#define CR3000_KEYS_DEBOUNCE_INTERVAL (3 * CR3000_KEYS_POLL_INTERVAL) - -#define CR3000_MAC0_OFFSET 0 -#define CR3000_MAC1_OFFSET 6 -#define CR3000_WMAC_CALDATA_OFFSET 0x1000 -#define CR3000_WMAC_MAC_OFFSET 0x1002 -#define CR3000_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led cr3000_leds_gpio[] __initdata = { - { - .name = "pcs:amber:power", - .gpio = CR3000_GPIO_LED_POWER_AMBER, - .active_low = 1, - }, - { - .name = "pcs:blue:wlan", - .gpio = CR3000_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { - .name = "pcs:blue:wan", - .gpio = CR3000_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "pcs:blue:lan1", - .gpio = CR3000_GPIO_LED_LAN1, - .active_low = 1, - }, - { - .name = "pcs:blue:lan2", - .gpio = CR3000_GPIO_LED_LAN2, - .active_low = 1, - }, - { - .name = "pcs:blue:lan3", - .gpio = CR3000_GPIO_LED_LAN3, - .active_low = 1, - }, - { - .name = "pcs:blue:lan4", - .gpio = CR3000_GPIO_LED_LAN4, - .active_low = 1, - }, -}; - -static struct gpio_keys_button cr3000_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = CR3000_KEYS_DEBOUNCE_INTERVAL, - .gpio = CR3000_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = CR3000_KEYS_DEBOUNCE_INTERVAL, - .gpio = CR3000_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init cr3000_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cr3000_leds_gpio), - cr3000_leds_gpio); - - ath79_register_gpio_keys_polled(-1, CR3000_KEYS_POLL_INTERVAL, - ARRAY_SIZE(cr3000_gpio_keys), - cr3000_gpio_keys); - - /* WLAN 2GHz onboard */ - ath79_register_wmac(art + CR3000_WMAC_CALDATA_OFFSET, art + CR3000_WMAC_MAC_OFFSET); - - ath79_register_mdio(1, 0x0); - ath79_register_mdio(0, 0x0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - /* Lan 4-port switch attached to GMAC1 internal switch */ - ath79_init_mac(ath79_eth1_data.mac_addr, art + CR3000_MAC0_OFFSET, 0); - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_register_eth(1); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + CR3000_MAC1_OFFSET, 0); - - /* WAN Fast Ethernet interface attached to GMAC0 */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_CR3000, "CR3000", "PowerCloud CR3000", - cr3000_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dap-1330-a1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dap-1330-a1.c deleted file mode 100644 index 9c50bc7e9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dap-1330-a1.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * D-Link DAP-1330 - * - * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved. - * Copyright (c) 2017 Nicolò Veronese - * Copyright (c) 2017 Federico Cappon - * - * 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 "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" -#include "nvram.h" - -#include -#include -#include -#include -#include - -#define DAP_1330_GPIO_LED_GREEN_POWER 13 -#define DAP_1330_GPIO_LED_RED_POWER 3 -#define DAP_1330_GPIO_LED_GREEN_WIFI 14 -#define DAP_1330_GPIO_LED_RED_WIFI 11 -#define DAP_1330_GPIO_LED_SIGNAL1 15 -#define DAP_1330_GPIO_LED_SIGNAL2 16 - -#define DAP_1330_GPIO_BTN_WPS 2 -#define DAP_1330_GPIO_BTN_RESET 17 - -#define DAP_1330_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DAP_1330_KEYS_DEBOUNCE_INTERVAL (3 * DAP_1330_KEYS_POLL_INTERVAL) - -#define DAP1330_MAC_ADDR 0x1f020001 - -#define DAP1330_WMAC_CALDATA_ADDR 0x1f010000 -#define DAP_1330_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led dap_1330_leds_gpio[] __initdata = { - { - .name = "d-link:green:power", - .gpio = DAP_1330_GPIO_LED_GREEN_POWER, - .active_low = 1, - }, - { - .name = "d-link:red:power", - .gpio = DAP_1330_GPIO_LED_RED_POWER, - .active_low = 1, - }, - { - .name = "d-link:green:wifi", - .gpio = DAP_1330_GPIO_LED_GREEN_WIFI, - .active_low = 1, - }, - { - .name = "d-link:red:wifi", - .gpio = DAP_1330_GPIO_LED_RED_WIFI, - .active_low = 1, - }, - { - .name = "d-link:green:signal1", - .gpio = DAP_1330_GPIO_LED_SIGNAL1, - .active_low = 1, - }, - { - .name = "d-link:green:signal2", - .gpio = DAP_1330_GPIO_LED_SIGNAL2, - .active_low = 1, - } -}; - -static struct gpio_keys_button dap_1330_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DAP_1330_KEYS_DEBOUNCE_INTERVAL, - .gpio = DAP_1330_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DAP_1330_KEYS_DEBOUNCE_INTERVAL, - .gpio = DAP_1330_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init dap_1330_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(DAP1330_WMAC_CALDATA_ADDR); - u8 *mac_ptr = (u8 *) KSEG1ADDR(DAP1330_MAC_ADDR); - u8 mac[ETH_ALEN]; - - ath79_parse_ascii_mac((char *) mac_ptr, mac); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dap_1330_leds_gpio), - dap_1330_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DAP_1330_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dap_1330_gpio_keys), - dap_1330_gpio_keys); - - ath79_register_wmac(art + DAP_1330_WMAC_CALDATA_OFFSET, mac); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_DAP_1330_A1, "DAP-1330-A1", - "D-Link DAP-1330 Rev. A1", dap_1330_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-505-a1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-505-a1.c deleted file mode 100644 index 1367b64a8..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-505-a1.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * DLink DIR-505 A1 board support - * - * Copyright (C) 2013 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 "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 "dev-usb.h" -#include "machtypes.h" - -#define DIR_505A1_GPIO_BTN_WPS 11 /* verify */ -#define DIR_505A1_GPIO_BTN_RESET 12 /* verify */ - -#define DIR_505A1_GPIO_LED_RED 26 /* unused, fyi */ -#define DIR_505A1_GPIO_LED_GREEN 27 - -#define DIR_505A1_GPIO_WAN_LED_ENABLE 1 - -#define DIR_505A1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DIR_505A1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_505A1_KEYS_POLL_INTERVAL) - -#define DIR_505A1_ART_ADDRESS 0x1f010000 -#define DIR_505A1_CALDATA_OFFSET 0x1000 - -#define DIR_505A1_MAC_PART_ADDRESS 0x1f020000 -#define DIR_505A1_LAN_MAC_OFFSET 0x04 -#define DIR_505A1_WAN_MAC_OFFSET 0x16 - -static struct gpio_led dir_505_a1_leds_gpio[] __initdata = { - { - .name = "d-link:green:power", - .gpio = DIR_505A1_GPIO_LED_GREEN, - .active_low = 1, - }, { - .name = "d-link:red:status", - .gpio = DIR_505A1_GPIO_LED_RED, - .active_low = 1, - }, -}; - -static struct gpio_keys_button dir_505_a1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DIR_505A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR_505A1_GPIO_BTN_RESET, - .active_low = 0, - }, { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DIR_505A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR_505A1_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static void __init dir_505_a1_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(DIR_505A1_ART_ADDRESS); - u8 *mac = (u8 *) KSEG1ADDR(DIR_505A1_MAC_PART_ADDRESS); - u8 lan_mac[ETH_ALEN]; - u8 wan_mac[ETH_ALEN]; - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - gpio_request_one(DIR_505A1_GPIO_WAN_LED_ENABLE, - GPIOF_OUT_INIT_LOW, "WAN LED enable"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dir_505_a1_leds_gpio), - dir_505_a1_leds_gpio); - - ath79_register_gpio_keys_polled(1, DIR_505A1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dir_505_a1_gpio_keys), - dir_505_a1_gpio_keys); - - ath79_register_m25p80(NULL); - - ath79_register_usb(); - - ath79_parse_ascii_mac(mac + DIR_505A1_LAN_MAC_OFFSET, lan_mac); - ath79_parse_ascii_mac(mac + DIR_505A1_WAN_MAC_OFFSET, wan_mac); - - ath79_init_mac(ath79_eth0_data.mac_addr, wan_mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, lan_mac, 0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_register_wmac(art + DIR_505A1_CALDATA_OFFSET, lan_mac); -} - -MIPS_MACHINE(ATH79_MACH_DIR_505_A1, "DIR-505-A1", - "D-Link DIR-505 rev. A1", dir_505_a1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-600-a1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-600-a1.c deleted file mode 100644 index 5e6134de7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-600-a1.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * D-Link DIR-600 rev. A1 board support - * - * Copyright (C) 2010-2012 Gabor Juhos - * Copyright (C) 2012 Vadim Girlin - * - * 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 "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 "machtypes.h" -#include "nvram.h" - -#define DIR_600_A1_GPIO_LED_WPS 0 -#define DIR_600_A1_GPIO_LED_POWER_AMBER 1 -#define DIR_600_A1_GPIO_LED_POWER_GREEN 6 -#define DIR_600_A1_GPIO_LED_LAN1 13 -#define DIR_600_A1_GPIO_LED_LAN2 14 -#define DIR_600_A1_GPIO_LED_LAN3 15 -#define DIR_600_A1_GPIO_LED_LAN4 16 -#define DIR_600_A1_GPIO_LED_WAN_AMBER 7 -#define DIR_600_A1_GPIO_LED_WAN_GREEN 17 - -#define DIR_600_A1_GPIO_BTN_RESET 8 -#define DIR_600_A1_GPIO_BTN_WPS 12 - -#define DIR_600_A1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DIR_600_A1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_600_A1_KEYS_POLL_INTERVAL) - -#define DIR_600_A1_NVRAM_ADDR 0x1f030000 -#define DIR_600_A1_NVRAM_SIZE 0x10000 - -static struct gpio_led dir_600_a1_leds_gpio[] __initdata = { - { - .name = "d-link:green:power", - .gpio = DIR_600_A1_GPIO_LED_POWER_GREEN, - }, { - .name = "d-link:amber:power", - .gpio = DIR_600_A1_GPIO_LED_POWER_AMBER, - }, { - .name = "d-link:amber:wan", - .gpio = DIR_600_A1_GPIO_LED_WAN_AMBER, - }, { - .name = "d-link:green:wan", - .gpio = DIR_600_A1_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "d-link:green:lan1", - .gpio = DIR_600_A1_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "d-link:green:lan2", - .gpio = DIR_600_A1_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "d-link:green:lan3", - .gpio = DIR_600_A1_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "d-link:green:lan4", - .gpio = DIR_600_A1_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "d-link:blue:wps", - .gpio = DIR_600_A1_GPIO_LED_WPS, - .active_low = 1, - } -}; - -static struct gpio_keys_button dir_600_a1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DIR_600_A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR_600_A1_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DIR_600_A1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR_600_A1_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static void __init dir_600_a1_setup(void) -{ - const char *nvram = (char *) KSEG1ADDR(DIR_600_A1_NVRAM_ADDR); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - u8 mac_buff[6]; - u8 *mac = NULL; - - if (ath79_nvram_parse_mac_addr(nvram, DIR_600_A1_NVRAM_SIZE, - "lan_mac=", mac_buff) == 0) { - ath79_init_mac(ath79_eth0_data.mac_addr, mac_buff, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac_buff, 1); - mac = mac_buff; - } - - ath79_register_m25p80(NULL); - - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dir_600_a1_leds_gpio), - dir_600_a1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DIR_600_A1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dir_600_a1_gpio_keys), - dir_600_a1_gpio_keys); - - 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); - - /* LAN ports */ - ath79_register_eth(1); - - /* WAN port */ - ath79_register_eth(0); - - ap91_pci_init(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_DIR_600_A1, "DIR-600-A1", "D-Link DIR-600 rev. A1", - dir_600_a1_setup); - -MIPS_MACHINE(ATH79_MACH_EBR_2310_C1, "EBR-2310-C1", "D-Link EBR-2310 rev. C1", - dir_600_a1_setup); - -static void __init dir_615_e1_setup(void) -{ - dir_600_a1_setup(); -} - -MIPS_MACHINE(ATH79_MACH_DIR_615_E1, "DIR-615-E1", "D-Link DIR-615 rev. E1", - dir_615_e1_setup); - -static void __init dir_615_e4_setup(void) -{ - dir_600_a1_setup(); - ap9x_pci_setup_wmac_led_pin(0, 1); -} - -MIPS_MACHINE(ATH79_MACH_DIR_615_E4, "DIR-615-E4", "D-Link DIR-615 rev. E4", - dir_615_e4_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-615-c1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-615-c1.c deleted file mode 100644 index e55a43f9c..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-615-c1.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * D-Link DIR-615 rev C1 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 "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 "nvram.h" - -#define DIR_615C1_GPIO_LED_ORANGE_STATUS 1 /* ORANGE:STATUS:TRICOLOR */ -#define DIR_615C1_GPIO_LED_BLUE_WPS 3 /* BLUE:WPS */ -#define DIR_615C1_GPIO_LED_GREEN_WAN 4 /* GREEN:WAN:TRICOLOR */ -#define DIR_615C1_GPIO_LED_GREEN_WANCPU 5 /* GREEN:WAN:CPU:TRICOLOR */ -#define DIR_615C1_GPIO_LED_GREEN_WLAN 6 /* GREEN:WLAN */ -#define DIR_615C1_GPIO_LED_GREEN_STATUS 14 /* GREEN:STATUS:TRICOLOR */ -#define DIR_615C1_GPIO_LED_ORANGE_WAN 15 /* ORANGE:WAN:TRICOLOR */ - -/* buttons may need refinement */ - -#define DIR_615C1_GPIO_BTN_WPS 12 -#define DIR_615C1_GPIO_BTN_RESET 21 - -#define DIR_615C1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DIR_615C1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_615C1_KEYS_POLL_INTERVAL) - -#define DIR_615C1_CONFIG_ADDR 0x1f020000 -#define DIR_615C1_CONFIG_SIZE 0x10000 - -#define DIR_615C1_WLAN_MAC_ADDR 0x1f3fffb4 - -static struct gpio_led dir_615c1_leds_gpio[] __initdata = { - { - .name = "d-link:orange:status", - .gpio = DIR_615C1_GPIO_LED_ORANGE_STATUS, - .active_low = 1, - }, { - .name = "d-link:blue:wps", - .gpio = DIR_615C1_GPIO_LED_BLUE_WPS, - .active_low = 1, - }, { - .name = "d-link:green:wan", - .gpio = DIR_615C1_GPIO_LED_GREEN_WAN, - .active_low = 1, - }, { - .name = "d-link:green:wancpu", - .gpio = DIR_615C1_GPIO_LED_GREEN_WANCPU, - .active_low = 1, - }, { - .name = "d-link:green:wlan", - .gpio = DIR_615C1_GPIO_LED_GREEN_WLAN, - .active_low = 1, - }, { - .name = "d-link:green:status", - .gpio = DIR_615C1_GPIO_LED_GREEN_STATUS, - .active_low = 1, - }, { - .name = "d-link:orange:wan", - .gpio = DIR_615C1_GPIO_LED_ORANGE_WAN, - .active_low = 1, - } - -}; - -static struct gpio_keys_button dir_615c1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DIR_615C1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR_615C1_GPIO_BTN_RESET, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DIR_615C1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR_615C1_GPIO_BTN_WPS, - } -}; - -#define DIR_615C1_LAN_PHYMASK BIT(0) -#define DIR_615C1_WAN_PHYMASK BIT(4) -#define DIR_615C1_MDIO_MASK (~(DIR_615C1_LAN_PHYMASK | \ - DIR_615C1_WAN_PHYMASK)) - -static void __init dir_615c1_setup(void) -{ - const char *config = (char *) KSEG1ADDR(DIR_615C1_CONFIG_ADDR); - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - u8 mac[ETH_ALEN], wlan_mac[ETH_ALEN]; - - if (ath79_nvram_parse_mac_addr(config, DIR_615C1_CONFIG_SIZE, - "lan_mac=", mac) == 0) { - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - } - - ath79_parse_ascii_mac((char *) KSEG1ADDR(DIR_615C1_WLAN_MAC_ADDR), wlan_mac); - - ath79_register_mdio(0, DIR_615C1_MDIO_MASK); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth0_data.phy_mask = DIR_615C1_LAN_PHYMASK; - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.phy_mask = DIR_615C1_WAN_PHYMASK; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dir_615c1_leds_gpio), - dir_615c1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DIR_615C1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dir_615c1_gpio_keys), - dir_615c1_gpio_keys); - - ath79_register_wmac(eeprom, wlan_mac); -} - -MIPS_MACHINE(ATH79_MACH_DIR_615_C1, "DIR-615-C1", "D-Link DIR-615 rev. C1", - dir_615c1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-615-i1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-615-i1.c deleted file mode 100644 index 64fe438dc..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-615-i1.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * D-Link DIR-615 rev. I1 board support - * Copyright (C) 2013-2015 Jaehoon You - * - * based on the DIR-600 rev. A1 board support code - * Copyright (C) 2010-2012 Gabor Juhos - * Copyright (C) 2012 Vadim Girlin - * - * based on the TP-LINK TL-WR841N/ND v8/TL-MR3420 v2 board support code - * 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 "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 DIR_615_I1_GPIO_LED_WPS 15 -#define DIR_615_I1_GPIO_LED_POWER_AMBER 14 -#define DIR_615_I1_GPIO_LED_POWER_GREEN 4 -#define DIR_615_I1_GPIO_LED_WAN_AMBER 22 -#define DIR_615_I1_GPIO_LED_WAN_GREEN 12 -#define DIR_615_I1_GPIO_LED_WLAN_GREEN 13 - -#define DIR_615_I1_GPIO_BTN_WPS 16 -#define DIR_615_I1_GPIO_BTN_RESET 17 - -#define DIR_615_I1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DIR_615_I1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_615_I1_KEYS_POLL_INTERVAL) - -#define DIR_615_I1_LAN_PHYMASK BIT(0) -#define DIR_615_I1_WAN_PHYMASK BIT(4) -#define DIR_615_I1_WLAN_MAC_ADDR 0x1fffffb4 - -static struct gpio_led dir_615_i1_leds_gpio[] __initdata = { - { - .name = "d-link:green:power", - .gpio = DIR_615_I1_GPIO_LED_POWER_GREEN, - }, { - .name = "d-link:amber:power", - .gpio = DIR_615_I1_GPIO_LED_POWER_AMBER, - }, { - .name = "d-link:amber:wan", - .gpio = DIR_615_I1_GPIO_LED_WAN_AMBER, - }, { - .name = "d-link:green:wan", - .gpio = DIR_615_I1_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "d-link:green:wlan", - .gpio = DIR_615_I1_GPIO_LED_WLAN_GREEN, - .active_low = 1, - }, { - .name = "d-link:blue:wps", - .gpio = DIR_615_I1_GPIO_LED_WPS, - .active_low = 1, - } -}; - -static struct gpio_keys_button dir_615_i1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DIR_615_I1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR_615_I1_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DIR_615_I1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR_615_I1_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static void __init dir_615_i1_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - u8 mac[ETH_ALEN]; - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, ~(DIR_615_I1_WAN_PHYMASK)); - - ath79_parse_ascii_mac((char *) KSEG1ADDR(DIR_615_I1_WLAN_MAC_ADDR), mac); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - - /* GMAC0 is connected to the PHY0 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = DIR_615_I1_WAN_PHYMASK; - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_mask = DIR_615_I1_LAN_PHYMASK; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_m25p80(NULL); - - /* Disable JTAG, enabling GPIOs 0-3 */ - /* Configure OBS4 line, for GPIO 4*/ - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, - AR934X_GPIO_FUNC_CLK_OBS4_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dir_615_i1_leds_gpio), - dir_615_i1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DIR_615_I1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dir_615_i1_gpio_keys), - dir_615_i1_gpio_keys); - - ath79_register_wmac(eeprom, mac); -} - -MIPS_MACHINE(ATH79_MACH_DIR_615_I1, "DIR-615-I1", "D-Link DIR-615 rev. I1", - dir_615_i1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-825-b1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-825-b1.c deleted file mode 100644 index 9b82990b1..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-825-b1.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * D-Link DIR-825 rev. B1 board support - * - * Copyright (C) 2009-2011 Lukas Kuna, Evkanet, s.r.o. - * - * based on mach-wndr3700.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 "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" - -#define DIR825B1_GPIO_LED_BLUE_USB 0 -#define DIR825B1_GPIO_LED_ORANGE_POWER 1 -#define DIR825B1_GPIO_LED_BLUE_POWER 2 -#define DIR825B1_GPIO_LED_BLUE_WPS 4 -#define DIR825B1_GPIO_LED_ORANGE_PLANET 6 -#define DIR825B1_GPIO_LED_BLUE_PLANET 11 - -#define DIR825B1_GPIO_BTN_RESET 3 -#define DIR825B1_GPIO_BTN_WPS 8 - -#define DIR825B1_GPIO_RTL8366_SDA 5 -#define DIR825B1_GPIO_RTL8366_SCK 7 - -#define DIR825B1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DIR825B1_KEYS_DEBOUNCE_INTERVAL (3 * DIR825B1_KEYS_POLL_INTERVAL) - -#define DIR825B1_CAL0_OFFSET 0x1000 -#define DIR825B1_CAL1_OFFSET 0x5000 -#define DIR825B1_MAC0_OFFSET 0xffa0 -#define DIR825B1_MAC1_OFFSET 0xffb4 - -#define DIR825B1_CAL_LOCATION_0 0x1f660000 -#define DIR825B1_CAL_LOCATION_1 0x1f7f0000 - -static struct gpio_led dir825b1_leds_gpio[] __initdata = { - { - .name = "d-link:blue:usb", - .gpio = DIR825B1_GPIO_LED_BLUE_USB, - .active_low = 1, - }, { - .name = "d-link:orange:power", - .gpio = DIR825B1_GPIO_LED_ORANGE_POWER, - .active_low = 1, - }, { - .name = "d-link:blue:power", - .gpio = DIR825B1_GPIO_LED_BLUE_POWER, - .active_low = 1, - }, { - .name = "d-link:blue:wps", - .gpio = DIR825B1_GPIO_LED_BLUE_WPS, - .active_low = 1, - }, { - .name = "d-link:orange:planet", - .gpio = DIR825B1_GPIO_LED_ORANGE_PLANET, - .active_low = 1, - }, { - .name = "d-link:blue:planet", - .gpio = DIR825B1_GPIO_LED_BLUE_PLANET, - .active_low = 1, - } -}; - -static struct gpio_keys_button dir825b1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DIR825B1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR825B1_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DIR825B1_KEYS_DEBOUNCE_INTERVAL, - .gpio = DIR825B1_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static struct rtl8366_initval dir825b1_rtl8366s_initvals[] = { - { .reg = 0x06, .val = 0x0108 }, -}; - -static struct rtl8366_platform_data dir825b1_rtl8366s_data = { - .gpio_sda = DIR825B1_GPIO_RTL8366_SDA, - .gpio_sck = DIR825B1_GPIO_RTL8366_SCK, - .num_initvals = ARRAY_SIZE(dir825b1_rtl8366s_initvals), - .initvals = dir825b1_rtl8366s_initvals, -}; - -static struct platform_device dir825b1_rtl8366s_device = { - .name = RTL8366S_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &dir825b1_rtl8366s_data, - } -}; - -static bool __init dir825b1_is_caldata_valid(u8 *p) -{ - u16 *magic0, *magic1; - - magic0 = (u16 *)(p + DIR825B1_CAL0_OFFSET); - magic1 = (u16 *)(p + DIR825B1_CAL1_OFFSET); - - return (*magic0 == 0xa55a && *magic1 == 0xa55a); -} - -static void __init dir825b1_wlan_init(void) -{ - u8 *caldata; - u8 mac0[ETH_ALEN], mac1[ETH_ALEN]; - u8 wmac0[ETH_ALEN], wmac1[ETH_ALEN]; - - caldata = (u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_0); - if (!dir825b1_is_caldata_valid(caldata)) { - caldata = (u8 *)KSEG1ADDR(DIR825B1_CAL_LOCATION_1); - if (!dir825b1_is_caldata_valid(caldata)) { - pr_err("no calibration data found\n"); - return; - } - } - - ath79_parse_ascii_mac(caldata + DIR825B1_MAC0_OFFSET, mac0); - ath79_parse_ascii_mac(caldata + DIR825B1_MAC1_OFFSET, mac1); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac0, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 0); - ath79_init_mac(wmac0, mac0, 0); - ath79_init_mac(wmac1, mac1, 1); - - ap9x_pci_setup_wmac_led_pin(0, 5); - ap9x_pci_setup_wmac_led_pin(1, 5); - - ap94_pci_init(caldata + DIR825B1_CAL0_OFFSET, wmac0, - caldata + DIR825B1_CAL1_OFFSET, wmac1); -} - -static void __init dir825b1_setup(void) -{ - dir825b1_wlan_init(); - - ath79_register_mdio(0, 0x0); - - ath79_eth0_data.mii_bus_dev = &dir825b1_rtl8366s_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_pll_data.pll_1000 = 0x11110000; - - ath79_eth1_data.mii_bus_dev = &dir825b1_rtl8366s_device.dev; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = 0x10; - ath79_eth1_pll_data.pll_1000 = 0x11110000; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dir825b1_leds_gpio), - dir825b1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DIR825B1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dir825b1_gpio_keys), - dir825b1_gpio_keys); - - ath79_register_usb(); - - platform_device_register(&dir825b1_rtl8366s_device); -} - -MIPS_MACHINE(ATH79_MACH_DIR_825_B1, "DIR-825-B1", "D-Link DIR-825 rev. B1", - dir825b1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dlan-hotspot.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dlan-hotspot.c deleted file mode 100644 index 3ae46514f..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dlan-hotspot.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * devolo dLAN Hotspot board support - * - * Copyright (C) 2015 Torsten Schnuis - * Copyright (C) 2015 devolo AG - * - * 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 "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 DLAN_HOTSPOT_GPIO_LED_WIFI 0 - -#define DLAN_HOTSPOT_GPIO_BTN_RESET 11 -#define DLAN_HOTSPOT_GPIO_BTN_PLC_PAIRING 12 -#define DLAN_HOTSPOT_GPIO_BTN_WIFI 21 - -#define DLAN_HOTSPOT_GPIO_PLC_POWER 22 -#define DLAN_HOTSPOT_GPIO_PLC_RESET 20 -#define DLAN_HOTSPOT_GPIO_PLC_DISABLE_LEDS 18 - -#define DLAN_HOTSPOT_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DLAN_HOTSPOT_KEYS_DEBOUNCE_INTERVAL (3 * DLAN_HOTSPOT_KEYS_POLL_INTERVAL) - -#define DLAN_HOTSPOT_ART_ADDRESS 0x1fff0000 -#define DLAN_HOTSPOT_CALDATA_OFFSET 0x00001000 -#define DLAN_HOTSPOT_MAC_ADDRESS_OFFSET 0x00001002 - -static struct gpio_led dlan_hotspot_leds_gpio[] __initdata = { - { - .name = "devolo:green:wifi", - .gpio = DLAN_HOTSPOT_GPIO_LED_WIFI, - .active_low = 0, - } -}; - -static struct gpio_keys_button dlan_hotspot_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DLAN_HOTSPOT_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_HOTSPOT_GPIO_BTN_RESET, - .active_low = 0, - }, - { - .desc = "Pairing button", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = DLAN_HOTSPOT_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_HOTSPOT_GPIO_BTN_PLC_PAIRING, - .active_low = 0, - }, - { - .desc = "WLAN button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DLAN_HOTSPOT_KEYS_DEBOUNCE_INTERVAL, - .gpio = DLAN_HOTSPOT_GPIO_BTN_WIFI, - .active_low = 0, - } -}; - -static void __init dlan_hotspot_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(DLAN_HOTSPOT_ART_ADDRESS); - u8 *cal = art + DLAN_HOTSPOT_CALDATA_OFFSET; - u8 *wifi_mac = art + DLAN_HOTSPOT_MAC_ADDRESS_OFFSET; - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dlan_hotspot_leds_gpio), - dlan_hotspot_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DLAN_HOTSPOT_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dlan_hotspot_gpio_keys), - dlan_hotspot_gpio_keys); - - gpio_request_one(DLAN_HOTSPOT_GPIO_PLC_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "PLC power"); - gpio_request_one(DLAN_HOTSPOT_GPIO_PLC_RESET, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "PLC reset"); - gpio_request_one(DLAN_HOTSPOT_GPIO_PLC_DISABLE_LEDS, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "PLC LEDs"); - - ath79_register_usb(); - - ath79_register_m25p80(NULL); - - ath79_init_mac(ath79_eth0_data.mac_addr, wifi_mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, wifi_mac, 2); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(cal, wifi_mac); -} - -MIPS_MACHINE(ATH79_MACH_DLAN_HOTSPOT, "dLAN-Hotspot", - "dLAN Hotspot", dlan_hotspot_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dr531.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dr531.c deleted file mode 100644 index b638a9001..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dr531.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Wallys DR531 board support - * - * Copyright (C) 2016 Piotr Dymacz - * - * Based on mach-wpj531.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 "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" -#include "pci.h" - -#define DR531_GPIO_BUZZER 4 -#define DR531_GPIO_LED_WAN 11 -#define DR531_GPIO_LED_LAN 14 -#define DR531_GPIO_LED_SIG1 12 -#define DR531_GPIO_LED_SIG2 16 -#define DR531_GPIO_LED_SIG3 15 -#define DR531_GPIO_LED_SIG4 13 - -#define DR531_GPIO_BTN_RESET 17 - -#define DR531_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DR531_KEYS_DEBOUNCE_INTERVAL (3 * DR531_KEYS_POLL_INTERVAL) - -#define DR531_MAC0_OFFSET 0x0 -#define DR531_MAC1_OFFSET 0x8 -#define DR531_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led dr531_leds_gpio[] __initdata = { - { - .name = "dr531:green:wan", - .gpio = DR531_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "dr531:green:lan", - .gpio = DR531_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "dr531:green:sig1", - .gpio = DR531_GPIO_LED_SIG1, - .active_low = 1, - }, - { - .name = "dr531:green:sig2", - .gpio = DR531_GPIO_LED_SIG2, - .active_low = 1, - }, - { - .name = "dr531:green:sig3", - .gpio = DR531_GPIO_LED_SIG3, - .active_low = 1, - }, - { - .name = "dr531:green:sig4", - .gpio = DR531_GPIO_LED_SIG4, - .active_low = 1, - }, - { - .name = "dr531:buzzer", - .gpio = DR531_GPIO_BUZZER, - .active_low = 0, - } -}; - -static struct gpio_keys_button dr531_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DR531_KEYS_DEBOUNCE_INTERVAL, - .gpio = DR531_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init dr531_gpio_setup(void) -{ - ath79_gpio_direction_select(DR531_GPIO_BUZZER, true); - ath79_gpio_direction_select(DR531_GPIO_LED_WAN, true); - ath79_gpio_direction_select(DR531_GPIO_LED_LAN, true); - ath79_gpio_direction_select(DR531_GPIO_LED_SIG1, true); - ath79_gpio_direction_select(DR531_GPIO_LED_SIG2, true); - ath79_gpio_direction_select(DR531_GPIO_LED_SIG3, true); - ath79_gpio_direction_select(DR531_GPIO_LED_SIG4, true); - - ath79_gpio_output_select(DR531_GPIO_BUZZER, 0); - ath79_gpio_output_select(DR531_GPIO_LED_WAN, 0); - ath79_gpio_output_select(DR531_GPIO_LED_LAN, 0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dr531_leds_gpio), - dr531_leds_gpio); - - ath79_register_gpio_keys_polled(-1, DR531_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dr531_gpio_keys), - dr531_gpio_keys); -} - -static void __init dr531_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f03f810); - - ath79_register_m25p80(NULL); - - dr531_gpio_setup(); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac + DR531_MAC1_OFFSET, 0); - ath79_register_eth(0); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, mac + DR531_MAC0_OFFSET, 0); - ath79_register_eth(1); - - ath79_register_wmac(art + DR531_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_DR531, "DR531", "Wallys DR531", dr531_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dragino2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dragino2.c deleted file mode 100644 index 95bd6f41a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dragino2.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * DRAGINO V2 board support, based on Atheros AP121 board support - * - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2012 Elektra Wagenrad - * Copyright (C) 2014 Vittorio Gambaletta - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DRAGINO2_GPIO_LED_WLAN 0 -#define DRAGINO2_GPIO_LED_LAN 13 -#define DRAGINO2_GPIO_LED_WAN 17 - -/* - * The following GPIO is named "SYS" on newer revisions of the the board. - * It was previously used to indicate USB activity, even though it was - * named "Router". - */ - -#define DRAGINO2_GPIO_LED_SYS 28 -#define DRAGINO2_GPIO_BTN_JUMPSTART 11 -#define DRAGINO2_GPIO_BTN_RESET 12 - -#define DRAGINO2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DRAGINO2_KEYS_DEBOUNCE_INTERVAL (3 * DRAGINO2_KEYS_POLL_INTERVAL) - -#define DRAGINO2_MAC0_OFFSET 0x0000 -#define DRAGINO2_MAC1_OFFSET 0x0006 -#define DRAGINO2_CALDATA_OFFSET 0x1000 -#define DRAGINO2_WMAC_MAC_OFFSET 0x1002 - -static struct gpio_led dragino2_leds_gpio[] __initdata = { - { - .name = "dragino2:red:wlan", - .gpio = DRAGINO2_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "dragino2:red:wan", - .gpio = DRAGINO2_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "dragino2:red:lan", - .gpio = DRAGINO2_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "dragino2:red:system", - .gpio = DRAGINO2_GPIO_LED_SYS, - .active_low = 0, - }, -}; - -static struct gpio_keys_button dragino2_gpio_keys[] __initdata = { - { - .desc = "jumpstart button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DRAGINO2_KEYS_DEBOUNCE_INTERVAL, - .gpio = DRAGINO2_GPIO_BTN_JUMPSTART, - .active_low = 1, - }, - { - .desc = "reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DRAGINO2_KEYS_DEBOUNCE_INTERVAL, - .gpio = DRAGINO2_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init dragino2_common_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - ath79_register_wmac(art + DRAGINO2_CALDATA_OFFSET, - art + DRAGINO2_WMAC_MAC_OFFSET); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + DRAGINO2_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art + DRAGINO2_MAC1_OFFSET, 0); - - ath79_register_mdio(0, 0x0); - - /* Enable GPIO13, GPIO14, GPIO15, GPIO16 and GPIO17 */ - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - /* LAN port */ - ath79_register_eth(1); - - /* WAN port */ - ath79_register_eth(0); - - /* Enable GPIO26 and GPIO27 */ - ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, - ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP) | - AR933X_BOOTSTRAP_MDIO_GPIO_EN); -} - -static void __init dragino2_setup(void) -{ - dragino2_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dragino2_leds_gpio), - dragino2_leds_gpio); - ath79_register_gpio_keys_polled(-1, DRAGINO2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dragino2_gpio_keys), - dragino2_gpio_keys); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_DRAGINO2, "DRAGINO2", "Dragino Dragino v2", - dragino2_setup); - diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e2100l.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e2100l.c deleted file mode 100644 index c09083460..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e2100l.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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-4.9/arch/mips/ath79/mach-e600g-v2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e600g-v2.c deleted file mode 100644 index 29411dea8..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e600g-v2.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Qxwlan E600G/E600GAC v2 board support - * - * Copyright (C) 2017 Peng Zhang - * Copyright (C) 2018 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 "common.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" -#include "pci.h" - -#define E600G_V2_GPIO_LED_LAN 16 -#define E600G_V2_GPIO_LED_SYS 13 -#define E600G_V2_GPIO_LED_WAN_B 4 -#define E600G_V2_GPIO_LED_WAN_G 15 - -#define E600GAC_V2_GPIO_LED_CTRL_B 14 -#define E600GAC_V2_GPIO_LED_CTRL_G 11 -#define E600GAC_V2_GPIO_LED_CTRL_R 12 -#define E600GAC_V2_GPIO_LED_LAN 16 -#define E600GAC_V2_GPIO_LED_SYS 13 -#define E600GAC_V2_GPIO_LED_WAN_G 15 -#define E600GAC_V2_GPIO_LED_WAN_O 4 - -#define E600G_V2_GPIO_BTN_RESET 17 -#define E600GAC_V2_GPIO_BTN_WPS 1 - -#define E600G_V2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define E600G_V2_KEYS_DEBOUNCE_INTERVAL (3 * E600G_V2_KEYS_POLL_INTERVAL) - -static struct gpio_led e600g_v2_leds_gpio[] __initdata = { - { - .name = "e600g-v2:blue:system", - .gpio = E600G_V2_GPIO_LED_SYS, - .active_low = 1, - }, { - .name = "e600g-v2:blue:wan", - .gpio = E600G_V2_GPIO_LED_WAN_B, - .active_low = 1, - }, { - .name = "e600g-v2:green:lan", - .gpio = E600G_V2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "e600g-v2:green:wan", - .gpio = E600G_V2_GPIO_LED_WAN_G, - .active_low = 1, - }, -}; - -static struct gpio_led e600gac_v2_leds_gpio[] __initdata = { - { - .name = "e600gac-v2:blue:control", - .gpio = E600GAC_V2_GPIO_LED_CTRL_B, - .active_low = 1, - }, { - .name = "e600gac-v2:green:control", - .gpio = E600GAC_V2_GPIO_LED_CTRL_G, - .active_low = 1, - }, { - .name = "e600gac-v2:red:control", - .gpio = E600GAC_V2_GPIO_LED_CTRL_R, - .active_low = 1, - }, { - .name = "e600gac-v2:green:system", - .gpio = E600GAC_V2_GPIO_LED_SYS, - .active_low = 1, - }, { - .name = "e600gac-v2:orange:wan", - .gpio = E600GAC_V2_GPIO_LED_WAN_O, - .active_low = 1, - }, { - .name = "e600gac-v2:green:lan", - .gpio = E600GAC_V2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "e600gac-v2:green:wan", - .gpio = E600GAC_V2_GPIO_LED_WAN_G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button e600g_v2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = E600G_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = E600G_V2_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct gpio_keys_button e600gac_v2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = E600G_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = E600G_V2_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = E600G_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = E600GAC_V2_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static void __init e600g_v2_common_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f050400); - u8 *art = (u8 *) KSEG1ADDR(0x1f061000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = 0xfe; - - /* LAN */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - /* WAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.phy_mask = BIT(0); - ath79_eth1_data.speed = SPEED_1000; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_eth(1); - - ath79_register_pci(); - ath79_register_usb(); - ath79_register_wmac(art, NULL); -} - -static void __init e600g_v2_setup(void) -{ - e600g_v2_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(e600g_v2_leds_gpio), - e600g_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, E600G_V2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(e600g_v2_gpio_keys), - e600g_v2_gpio_keys); -} - -static void __init e600gac_v2_setup(void) -{ - e600g_v2_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(e600gac_v2_leds_gpio), - e600gac_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, E600G_V2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(e600gac_v2_gpio_keys), - e600gac_v2_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_E600G_V2, "E600G-V2", "Qxwlan E600G v2", - e600g_v2_setup); - -MIPS_MACHINE(ATH79_MACH_E600GAC_V2, "E600GAC-V2", "Qxwlan E600GAC v2", - e600gac_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap120.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap120.c deleted file mode 100644 index 130c7706a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap120.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * TP-LINK EAP120 board support - * - * Copyright (C) 2016 Henryk Heisig - * - * 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-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "machtypes.h" - - -#define EAP120_GPIO_LED_RED 12 -#define EAP120_GPIO_LED_YEL 13 -#define EAP120_GPIO_LED_GRN 15 -#define EAP120_GPIO_BTN_RESET 4 - -#define EAP120_KEYS_POLL_INTERVAL 20 /* msecs */ -#define EAP120_KEYS_DEBOUNCE_INTERVAL (3 * EAP120_KEYS_POLL_INTERVAL) - -#define EAP120_GPIO_SMI_MDIO 16 -#define EAP120_GPIO_SMI_MDC 17 - -#define EAP120_LAN_PHYADDR 4 - -static struct gpio_led eap120_leds_gpio[] __initdata = { - { - .name = "eap120:red:system", - .gpio = EAP120_GPIO_LED_RED, - .active_low = 1, - }, { - .name = "eap120:yellow:system", - .gpio = EAP120_GPIO_LED_YEL, - .active_low = 1, - }, { - .name = "eap120:green:system", - .gpio = EAP120_GPIO_LED_GRN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button eap120_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = EAP120_KEYS_DEBOUNCE_INTERVAL, - .gpio = EAP120_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct mdio_gpio_platform_data eap120_mdio = { - .mdc = EAP120_GPIO_SMI_MDC, - .mdio = EAP120_GPIO_SMI_MDIO, - .phy_mask = ~BIT(EAP120_LAN_PHYADDR), -}; - -static struct at803x_platform_data eap120_ar8035_data = { - .disable_smarteee = 0, - .enable_rgmii_rx_delay = 1, - .enable_rgmii_tx_delay = 0, - .fixup_rgmii_tx_delay = 1, -}; - -static struct platform_device eap120_phy_device = { - .name = "mdio-gpio", - .id = 0, - .dev = { - .platform_data = &eap120_mdio, &eap120_ar8035_data - }, -}; - -static void __init eap_setup(u8 *mac) -{ - ath79_register_leds_gpio(-1, ARRAY_SIZE(eap120_leds_gpio), - eap120_leds_gpio); - - ath79_register_gpio_keys_polled(1, EAP120_KEYS_POLL_INTERVAL, - ARRAY_SIZE(eap120_gpio_keys), - eap120_gpio_keys); - - ath79_register_m25p80(NULL); - - /* MDIO Interface */ - platform_device_register(&eap120_phy_device); - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); - - /* 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 = &eap120_phy_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(EAP120_LAN_PHYADDR); - ath79_eth0_pll_data.pll_1000 = 0x0e000000; - ath79_eth0_pll_data.pll_100 = 0x00000101; - ath79_eth0_pll_data.pll_10 = 0x00001313; - ath79_register_eth(0); -} - -static void __init eap120_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f030008); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - eap_setup(mac); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_EAP120, "EAP120", "TP-LINK EAP120", - eap120_setup); - diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap300v2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap300v2.c deleted file mode 100644 index ba577e251..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap300v2.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * EnGenius EAP300 v2 board support - * - * Copyright (C) 2014 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 "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 EAP300V2_GPIO_LED_POWER 0 -#define EAP300V2_GPIO_LED_LAN 16 -#define EAP300V2_GPIO_LED_WLAN 17 - -#define EAP300V2_GPIO_BTN_RESET 1 - -#define EAP300V2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define EAP300V2_KEYS_DEBOUNCE_INTERVAL (3 * EAP300V2_KEYS_POLL_INTERVAL) - -static struct gpio_led eap300v2_leds_gpio[] __initdata = { - { - .name = "engenius:blue:power", - .gpio = EAP300V2_GPIO_LED_POWER, - .active_low = 1, - }, { - .name = "engenius:blue:lan", - .gpio = EAP300V2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "engenius:blue:wlan", - .gpio = EAP300V2_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button eap300v2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = EAP300V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = EAP300V2_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -#define EAP300V2_ART_MAC_OFFSET 2 - -#define EAP300V2_LAN_PHYMASK BIT(0) - -static void __init eap300v2_setup(void) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff1000); - - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_gpio_output_select(EAP300V2_GPIO_LED_POWER, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(EAP300V2_GPIO_LED_LAN, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(EAP300V2_GPIO_LED_WLAN, AR934X_GPIO_OUT_GPIO); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(eap300v2_leds_gpio), - eap300v2_leds_gpio); - ath79_register_gpio_keys_polled(-1, EAP300V2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(eap300v2_gpio_keys), - eap300v2_gpio_keys); - - ath79_register_m25p80(NULL); - ath79_register_wmac(art, NULL); - ath79_register_mdio(1, 0x0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_init_mac(ath79_eth0_data.mac_addr, - art + EAP300V2_ART_MAC_OFFSET, 0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = EAP300V2_LAN_PHYMASK; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = EAP300V2_LAN_PHYMASK; - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_EAP300V2, "EAP300V2", "EnGenius EAP300 v2", - eap300v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap7660d.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap7660d.c deleted file mode 100644 index 787e6275d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-eap7660d.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Senao EAP7660D board support - * - * Copyright (C) 2010 Daniel Golle - * Copyright (C) 2008 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 "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" - -#define EAP7660D_KEYS_POLL_INTERVAL 20 /* msecs */ -#define EAP7660D_KEYS_DEBOUNCE_INTERVAL (3 * EAP7660D_KEYS_POLL_INTERVAL) - -#define EAP7660D_GPIO_DS4 7 -#define EAP7660D_GPIO_DS5 2 -#define EAP7660D_GPIO_DS7 0 -#define EAP7660D_GPIO_DS8 4 -#define EAP7660D_GPIO_SW1 3 -#define EAP7660D_GPIO_SW3 8 -#define EAP7660D_PHYMASK BIT(20) -#define EAP7660D_BOARDCONFIG 0x1F7F0000 -#define EAP7660D_GBIC_MAC_OFFSET 0x1000 -#define EAP7660D_WMAC0_MAC_OFFSET 0x1010 -#define EAP7660D_WMAC1_MAC_OFFSET 0x1016 -#define EAP7660D_WMAC0_CALDATA_OFFSET 0x2000 -#define EAP7660D_WMAC1_CALDATA_OFFSET 0x3000 - -#ifdef CONFIG_PCI -static struct ath5k_platform_data eap7660d_wmac0_data; -static struct ath5k_platform_data eap7660d_wmac1_data; -static char eap7660d_wmac0_mac[6]; -static char eap7660d_wmac1_mac[6]; -static u16 eap7660d_wmac0_eeprom[ATH5K_PLAT_EEP_MAX_WORDS]; -static u16 eap7660d_wmac1_eeprom[ATH5K_PLAT_EEP_MAX_WORDS]; - -static int eap7660d_pci_plat_dev_init(struct pci_dev *dev) -{ - switch (PCI_SLOT(dev->devfn)) { - case 17: - dev->dev.platform_data = &eap7660d_wmac0_data; - break; - - case 18: - dev->dev.platform_data = &eap7660d_wmac1_data; - break; - } - - return 0; -} - -void __init eap7660d_pci_init(u8 *cal_data0, u8 *mac_addr0, - u8 *cal_data1, u8 *mac_addr1) -{ - if (cal_data0 && *cal_data0 == 0xa55a) { - memcpy(eap7660d_wmac0_eeprom, cal_data0, - ATH5K_PLAT_EEP_MAX_WORDS); - eap7660d_wmac0_data.eeprom_data = eap7660d_wmac0_eeprom; - } - - if (cal_data1 && *cal_data1 == 0xa55a) { - memcpy(eap7660d_wmac1_eeprom, cal_data1, - ATH5K_PLAT_EEP_MAX_WORDS); - eap7660d_wmac1_data.eeprom_data = eap7660d_wmac1_eeprom; - } - - if (mac_addr0) { - memcpy(eap7660d_wmac0_mac, mac_addr0, - sizeof(eap7660d_wmac0_mac)); - eap7660d_wmac0_data.macaddr = eap7660d_wmac0_mac; - } - - if (mac_addr1) { - memcpy(eap7660d_wmac1_mac, mac_addr1, - sizeof(eap7660d_wmac1_mac)); - eap7660d_wmac1_data.macaddr = eap7660d_wmac1_mac; - } - - ath79_pci_set_plat_dev_init(eap7660d_pci_plat_dev_init); - ath79_register_pci(); -} -#else -static inline void eap7660d_pci_init(u8 *cal_data0, u8 *mac_addr0, - u8 *cal_data1, u8 *mac_addr1) -{ -} -#endif /* CONFIG_PCI */ - -static struct gpio_led eap7660d_leds_gpio[] __initdata = { - { - .name = "eap7660d:green:ds8", - .gpio = EAP7660D_GPIO_DS8, - .active_low = 0, - }, - { - .name = "eap7660d:green:ds5", - .gpio = EAP7660D_GPIO_DS5, - .active_low = 0, - }, - { - .name = "eap7660d:green:ds7", - .gpio = EAP7660D_GPIO_DS7, - .active_low = 0, - }, - { - .name = "eap7660d:green:ds4", - .gpio = EAP7660D_GPIO_DS4, - .active_low = 0, - } -}; - -static struct gpio_keys_button eap7660d_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = EAP7660D_KEYS_DEBOUNCE_INTERVAL, - .gpio = EAP7660D_GPIO_SW1, - .active_low = 1, - }, - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = EAP7660D_KEYS_DEBOUNCE_INTERVAL, - .gpio = EAP7660D_GPIO_SW3, - .active_low = 1, - } -}; - -static const char *eap7660d_part_probes[] = { - "RedBoot", - NULL, -}; - -static struct flash_platform_data eap7660d_flash_data = { - .part_probes = eap7660d_part_probes, -}; - -static void __init eap7660d_setup(void) -{ - u8 *boardconfig = (u8 *) KSEG1ADDR(EAP7660D_BOARDCONFIG); - - ath79_register_mdio(0, ~EAP7660D_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, - boardconfig + EAP7660D_GBIC_MAC_OFFSET, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = EAP7660D_PHYMASK; - ath79_register_eth(0); - ath79_register_m25p80(&eap7660d_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(eap7660d_leds_gpio), - eap7660d_leds_gpio); - ath79_register_gpio_keys_polled(-1, EAP7660D_KEYS_POLL_INTERVAL, - ARRAY_SIZE(eap7660d_gpio_keys), - eap7660d_gpio_keys); - eap7660d_pci_init(boardconfig + EAP7660D_WMAC0_CALDATA_OFFSET, - boardconfig + EAP7660D_WMAC0_MAC_OFFSET, - boardconfig + EAP7660D_WMAC1_CALDATA_OFFSET, - boardconfig + EAP7660D_WMAC1_MAC_OFFSET); -}; - -MIPS_MACHINE(ATH79_MACH_EAP7660D, "EAP7660D", "Senao EAP7660D", - eap7660d_setup); - -MIPS_MACHINE(ATH79_MACH_ALL0305, "ALL0305", "Allnet ALL0305", - eap7660d_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-el-m150.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-el-m150.c deleted file mode 100644 index b95d6c2f6..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-el-m150.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Easy-Link EL-M150 board support - * - * Copyright (C) 2012 huangfc - * Copyright (C) 2012 HYS <550663898@qq.com> - * - * 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 "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" -#include "dev-usb.h" - -#define EL_M150_GPIO_BTN6 6 -#define EL_M150_GPIO_BTN7 7 -#define EL_M150_GPIO_BTN_RESET 11 - -#define EL_M150_GPIO_LED_SYSTEM 27 -#define EL_M150_GPIO_USB_POWER 8 - -#define EL_M150_KEYS_POLL_INTERVAL 20 /* msecs */ -#define EL_M150_KEYS_DEBOUNCE_INTERVAL (3 * EL_M150_KEYS_POLL_INTERVAL) - -static const char *EL_M150_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data EL_M150_flash_data = { - .part_probes = EL_M150_part_probes, -}; - -static struct gpio_led EL_M150_leds_gpio[] __initdata = { - { - .name = "easylink:green:system", - .gpio = EL_M150_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button EL_M150_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL, - .gpio = EL_M150_GPIO_BTN_RESET, - .active_low = 0, - }, - { - .desc = "BTN_6", - .type = EV_KEY, - .code = BTN_6, - .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL, - .gpio = EL_M150_GPIO_BTN6, - .active_low = 1, - }, - { - .desc = "BTN_7", - .type = EV_KEY, - .code = BTN_7, - .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL, - .gpio = EL_M150_GPIO_BTN7, - .active_low = 1, - }, -}; - -static void __init el_m150_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(EL_M150_leds_gpio), - EL_M150_leds_gpio); - - ath79_register_gpio_keys_polled(-1, EL_M150_KEYS_POLL_INTERVAL, - ARRAY_SIZE(EL_M150_gpio_keys), - EL_M150_gpio_keys); - - gpio_request_one(EL_M150_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_register_m25p80(&EL_M150_flash_data); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_EL_M150, "EL-M150", - "EasyLink EL-M150", el_m150_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-el-mini.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-el-mini.c deleted file mode 100644 index 9879b18f7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-el-mini.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Easy-Link EL-MINI board support - * - * Copyright (C) 2012 huangfc - * Copyright (C) 2011 hys <550663898@qq.com> - * - * 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 "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 MINI_GPIO_LED_SYSTEM 27 -#define MINI_GPIO_BTN_RESET 11 - -#define MINI_GPIO_USB_POWER 8 - -#define MINI_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MINI_KEYS_DEBOUNCE_INTERVAL (3 * MINI_KEYS_POLL_INTERVAL) - -static const char *mini_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data mini_flash_data = { - .part_probes = mini_part_probes, -}; - -static struct gpio_led mini_leds_gpio[] __initdata = { - { - .name = "easylink:green:system", - .gpio = MINI_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button mini_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MINI_KEYS_DEBOUNCE_INTERVAL, - .gpio = MINI_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init el_mini_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&mini_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(mini_leds_gpio), - mini_leds_gpio); - ath79_register_gpio_keys_polled(-1, MINI_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mini_gpio_keys), - mini_gpio_keys); - - gpio_request_one(MINI_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_EL_MINI, "EL-MINI", "EasyLink EL-MINI", - el_mini_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ens202ext.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ens202ext.c deleted file mode 100644 index 07dbc2e69..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ens202ext.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * EnGenius ENS202EXT board support - * - * Copyright (C) 2017 Marty Plummer - * - * 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-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define ENS202_GPIO_LED_WLAN4 0 -#define ENS202_GPIO_LED_POWER 14 -#define ENS202_GPIO_LED_WLAN2 16 -#define ENS202_GPIO_LED_WLAN3 17 -#define ENS202_GPIO_LED_WLAN1 18 - -#define ENS202_GPIO_BTN_RESET 1 - -#define ENS202_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ENS202_KEYS_DEBOUNCE_INTERVAL (3 * ENS202_KEYS_POLL_INTERVAL) - -static struct gpio_led ens202_leds_gpio[] __initdata = { - { - .name = "engenius:amber:wlan1", - .gpio = ENS202_GPIO_LED_WLAN1, - .active_low = 1, - }, { - .name = "engenius:red:wlan2", - .gpio = ENS202_GPIO_LED_WLAN2, - .active_low = 1, - }, { - .name = "engenius:amber:wlan3", - .gpio = ENS202_GPIO_LED_WLAN3, - .active_low = 1, - }, { - .name = "engenius:green:wlan4", - .gpio = ENS202_GPIO_LED_WLAN4, - .active_low = 1, - }, { - .name = "engenius:amber:power", - .gpio = ENS202_GPIO_LED_POWER, - .active_low = 1, - } -}; - -static struct gpio_keys_button ens202_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ENS202_KEYS_DEBOUNCE_INTERVAL, - .gpio = ENS202_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init ens202_setup(void) -{ - const char *nvram = (char *) KSEG1ADDR(0x1f040000); - u8 mac_buff[6]; - u8 *mac = NULL; - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - if (ath79_nvram_parse_mac_addr(nvram, 0x10000, - "ethaddr=", mac_buff) == 0) { - ath79_init_mac(ath79_eth0_data.mac_addr, mac_buff, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac_buff, 1); - mac = mac_buff; - } - - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_gpio_output_select(ENS202_GPIO_LED_POWER, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(ENS202_GPIO_LED_WLAN1, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(ENS202_GPIO_LED_WLAN2, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(ENS202_GPIO_LED_WLAN3, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(ENS202_GPIO_LED_WLAN4, AR934X_GPIO_OUT_GPIO); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ens202_leds_gpio), - ens202_leds_gpio); - ath79_register_gpio_keys_polled(-1, ENS202_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ens202_gpio_keys), - ens202_gpio_keys); - - ath79_register_m25p80(NULL); - - ath79_register_wmac(art + 0x1000, NULL); - - ath79_register_mdio(1, 0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_ENS202EXT, "ENS202EXT", "EnGenius ENS202EXT", - ens202_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ew-balin.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ew-balin.c deleted file mode 100644 index 2e82ffdaa..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ew-balin.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * EW Balin board support - * (based on Atheros DB120 reference board support) - * - * Copyright (c) 2011 Qualcomm Atheros - * Copyright (c) 2011-2012 Gabor Juhos - * Copyright (C) 2017 Embedded Wireless GmbH www.80211.de - * - * 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define BALIN_GPIO_LED_STATUS 14 - -#define BALIN_GPIO_BTN_WPS 18 - -#define BALIN_KEYS_POLL_INTERVAL 20 /* msecs */ -#define BALIN_KEYS_DEBOUNCE_INTERVAL (3 * BALIN_KEYS_POLL_INTERVAL) - -#define BALIN_CALDATA_OFFSET 0x1000 -#define BALIN_WMAC_MAC_OFFSET (BALIN_CALDATA_OFFSET + 0x02) - -static struct gpio_led balin_leds_gpio[] __initdata = { - { - .name = "balin:green:status", - .gpio = BALIN_GPIO_LED_STATUS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button balin_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = BALIN_KEYS_DEBOUNCE_INTERVAL, - .gpio = BALIN_GPIO_BTN_WPS, - .active_low = 0, - }, -}; - - -static void __init balin_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - static u8 mac[6]; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(balin_leds_gpio), - balin_leds_gpio); - - ath79_register_gpio_keys_polled(-1, BALIN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(balin_gpio_keys), - balin_gpio_keys); - - ath79_register_usb(); - - ath79_register_wmac(art + BALIN_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - - /* GMAC1 is connected to the internal switch */ - memcpy(mac, art + BALIN_WMAC_MAC_OFFSET, sizeof(mac)); - mac[3] |= 0x40; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_EW_BALIN, "EW-BALIN", "EmbWir-Balin", - balin_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ew-dorin.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ew-dorin.c deleted file mode 100644 index 575a976ae..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ew-dorin.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * EW Dorin board support - * (based on Atheros Ref. Design AP121) - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2012-2017 Embedded Wireless GmbH www.80211.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 "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define DORIN_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DORIN_KEYS_DEBOUNCE_INTERVAL (3 * DORIN_KEYS_POLL_INTERVAL) - -#define DORIN_CALDATA_OFFSET 0x1000 -#define DORIN_WMAC_MAC_OFFSET 0x1002 - -#define DORIN_GPIO_LED_STATUS 21 - -#define DORIN_GPIO_BTN_JUMPSTART 11 -#define DORIN_GPIO_BTN_RESET 6 - -static struct gpio_led dorin_leds_gpio[] __initdata = { - { - .name = "dorin:green:status", - .gpio = DORIN_GPIO_LED_STATUS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button dorin_gpio_keys[] __initdata = { - { - .desc = "jumpstart button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DORIN_KEYS_DEBOUNCE_INTERVAL, - .gpio = DORIN_GPIO_BTN_JUMPSTART, - .active_low = 1, - }, - { - .desc = "reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DORIN_KEYS_DEBOUNCE_INTERVAL, - .gpio = DORIN_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init ew_dorin_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - static u8 mac[6]; - - ath79_register_m25p80(NULL); - - ath79_register_usb(); - - if (ar93xx_wmac_read_mac_address(mac)) { - ath79_register_wmac(NULL, NULL); - } else { - ath79_register_wmac(art + DORIN_CALDATA_OFFSET, - art + DORIN_WMAC_MAC_OFFSET); - memcpy(mac, art + DORIN_WMAC_MAC_OFFSET, sizeof(mac)); - } - - mac[3] |= 0x40; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - ath79_register_mdio(0, 0x0); - - /* LAN ports */ - ath79_register_eth(1); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dorin_leds_gpio), - dorin_leds_gpio); - ath79_register_gpio_keys_polled(-1, DORIN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dorin_gpio_keys), - dorin_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_EW_DORIN, "EW-DORIN", "EmbWir-Dorin", - ew_dorin_setup); - - -static void __init ew_dorin_router_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - static u8 mac[6]; - - ath79_register_m25p80(NULL); - - ath79_register_usb(); - - if (ar93xx_wmac_read_mac_address(mac)) { - ath79_register_wmac(NULL, NULL); - } else { - ath79_register_wmac(art + DORIN_CALDATA_OFFSET, - art + DORIN_WMAC_MAC_OFFSET); - memcpy(mac, art + DORIN_WMAC_MAC_OFFSET, sizeof(mac)); - } - - mac[3] |= 0x40; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - mac[3] &= 0x3F; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_setup_ar933x_phy4_switch(true, true); - - ath79_register_mdio(0, 0x0); - - /* LAN ports */ - ath79_register_eth(1); - - /* WAN port */ - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(dorin_leds_gpio), - dorin_leds_gpio); - ath79_register_gpio_keys_polled(-1, DORIN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(dorin_gpio_keys), - dorin_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_EW_DORIN_ROUTER, "EW-DORIN-ROUTER", - "EmbWir-Dorin-Router", ew_dorin_router_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-fritz300e.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-fritz300e.c deleted file mode 100644 index 43af71a0a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-fritz300e.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * AVM FRITZ!WLAN Repeater 300E board support - * - * Copyright (C) 2017 Mathias Kresin - * - * 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 "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -#define FRITZ300E_KEYS_POLL_INTERVAL 20 /* msecs */ -#define FRITZ300E_KEYS_DEBOUNCE_INTERVAL (3 * FRITZ300E_KEYS_POLL_INTERVAL) - -static struct mtd_partition fritz300e_flash_partitions[] = { - { - .name = "urloader", - .offset = 0, - .size = 0x0020000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x0020000, - .size = 0x0ee0000, - }, { - .name = "tffs (1)", - .offset = 0x0f00000, - .size = 0x0080000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "tffs (2)", - .offset = 0x0f80000, - .size = 0x0080000, - .mask_flags = MTD_WRITEABLE, - } -}; - -static struct flash_platform_data fritz300e_flash_data = { - .parts = fritz300e_flash_partitions, - .nr_parts = ARRAY_SIZE(fritz300e_flash_partitions), -}; - -static struct gpio_led fritz300e_leds_gpio[] __initdata = { - { - .name = "fritz300e:green:power", - .gpio = 13, - .active_low = 1, - }, { - .name = "fritz300e:green:lan", - .gpio = 15, - .active_low = 1, - }, { - .name = "fritz300e:green:wlan", - .gpio = 16, - .active_low = 1, - } -}; - -static struct gpio_led fritz300e_wmac_leds_gpio[] = { - { - .name = "fritz300e:green:rssi0", - .gpio = 10, - .active_low = 1, - }, { - .name = "fritz300e:green:rssi1", - .gpio = 4, - .active_low = 1, - }, { - .name = "fritz300e:green:rssi2", - .gpio = 6, - .active_low = 1, - }, { - .name = "fritz300e:green:rssi3", - .gpio = 7, - .active_low = 1, - }, { - .name = "fritz300e:green:rssi4", - .gpio = 5, - .active_low = 1, - } -}; - -static struct gpio_keys_button fritz300e_gpio_keys[] __initdata = { - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = FRITZ300E_KEYS_DEBOUNCE_INTERVAL, - .gpio = 12, - .active_low = 1, - }, -}; - -static void __init fritz300e_setup(void) -{ - /* get the Lantiq PEF7071V phy out of reset */ - gpio_request_one(11, GPIOF_OUT_INIT_HIGH, "phy reset"); - - ath79_register_m25p80(&fritz300e_flash_data); - - ath79_register_mdio(0, ~(BIT(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_leds_gpio(-1, ARRAY_SIZE(fritz300e_leds_gpio), - fritz300e_leds_gpio); - ath79_register_gpio_keys_polled(-1, FRITZ300E_KEYS_POLL_INTERVAL, - ARRAY_SIZE(fritz300e_gpio_keys), - fritz300e_gpio_keys); - - ap9x_pci_setup_wmac_leds(0, fritz300e_wmac_leds_gpio, - ARRAY_SIZE(fritz300e_wmac_leds_gpio)); - ap91_pci_init_simple(); -} - -MIPS_MACHINE(ATH79_MACH_FRITZ300E, "FRITZ300E", - "AVM FRITZ!WLAN Repeater 300E", fritz300e_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-fritz4020.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-fritz4020.c deleted file mode 100644 index ed7f9a8b3..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-fritz4020.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * AVM FRITZ!Box 4020 board support - * - * Copyright (C) 2018 David Bauer - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - - -#define FRITZ4020_GPIO_SHIFT_SER 19 /* DS, Data Serial Input */ -#define FRITZ4020_GPIO_SHIFT_SRCLK 20 /* SHCP, Shift Reg Clock Input */ - -#define FRITZ4020_SSR_BIT_0 0 -#define FRITZ4020_SSR_BIT_1 1 -#define FRITZ4020_SSR_BIT_2 2 -#define FRITZ4020_SSR_BIT_3 3 -#define FRITZ4020_SSR_BIT_4 4 -#define FRITZ4020_SSR_BIT_5 5 -#define FRITZ4020_SSR_BIT_6 6 -#define FRITZ4020_SSR_BIT_7 7 - -#define FRITZ4020_74HC_GPIO_BASE 32 -#define FRITZ4020_74HC_GPIO_LED_LAN (FRITZ4020_74HC_GPIO_BASE + 0) -#define FRITZ4020_74HC_GPIO_LED_INFO_RED (FRITZ4020_74HC_GPIO_BASE + 1) -#define FRITZ4020_74HC_GPIO_LED_POWER (FRITZ4020_74HC_GPIO_BASE + 2) -#define FRITZ4020_74HC_GPIO_LED_WLAN (FRITZ4020_74HC_GPIO_BASE + 3) -#define FRITZ4020_74HC_GPIO_LED_WAN (FRITZ4020_74HC_GPIO_BASE + 4) -#define FRITZ4020_74HC_GPIO_USB_RST (FRITZ4020_74HC_GPIO_BASE + 5) -#define FRITZ4020_74HC_GPIO_LED_INFO (FRITZ4020_74HC_GPIO_BASE + 6) - - -#define FRITZ4020_GPIO_BTN_WPS 2 -#define FRITZ4020_GPIO_BTN_WLAN 21 -#define FRITZ4020_KEYS_POLL_INTERVAL 20 /* msecs */ -#define FRITZ4020_KEYS_DEBOUNCE_INTERVAL (3 * FRITZ4020_KEYS_POLL_INTERVAL) - -#define FRTIZ4020_OFFSET_URLADER_WIFI_MAC_REVERSE 0x1979 - - -static struct spi_gpio_platform_data fritz4020_spi_data = { - .sck = FRITZ4020_GPIO_SHIFT_SRCLK, - .miso = SPI_GPIO_NO_MISO, - .mosi = FRITZ4020_GPIO_SHIFT_SER, - .num_chipselect = 1, -}; - -static u8 fritz4020_ssr_initdata[] = { - BIT(FRITZ4020_SSR_BIT_7) | - BIT(FRITZ4020_SSR_BIT_6) | - BIT(FRITZ4020_SSR_BIT_5) | - BIT(FRITZ4020_SSR_BIT_4) | - BIT(FRITZ4020_SSR_BIT_3) | - BIT(FRITZ4020_SSR_BIT_2) | - BIT(FRITZ4020_SSR_BIT_1) -}; - -static struct gen_74x164_chip_platform_data fritz4020_ssr_data = { - .base = FRITZ4020_74HC_GPIO_BASE, - .num_registers = ARRAY_SIZE(fritz4020_ssr_initdata), - .init_data = fritz4020_ssr_initdata, -}; - -static struct platform_device fritz4020_spi_device = { - .name = "spi_gpio", - .id = 1, - .dev = { - .platform_data = &fritz4020_spi_data, - }, -}; - -static struct spi_board_info fritz4020_spi_info[] = { - { - .bus_num = 1, - .chip_select = 0, - .max_speed_hz = 10000000, - .modalias = "74x164", - .platform_data = &fritz4020_ssr_data, - .controller_data = (void *) 0x0, - }, -}; - -static struct mtd_partition fritz4020_flash_partitions[] = { - { - .name = "urlader", - .offset = 0, - .size = 0x0020000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x0020000, - .size = 0x0EE0000, - }, { - .name = "tffs (1)", - .offset = 0x0f00000, - .size = 0x0080000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "tffs (2)", - .offset = 0x0f80000, - .size = 0x0080000, - .mask_flags = MTD_WRITEABLE, - } -}; - -static struct flash_platform_data fritz4020_flash_data = { - .parts = fritz4020_flash_partitions, - .nr_parts = ARRAY_SIZE(fritz4020_flash_partitions), -}; - -static struct gpio_led fritz4020_leds_gpio[] __initdata = { - { - .name = "fritz4020:green:lan", - .gpio = FRITZ4020_74HC_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "fritz4020:green:info", - .gpio = FRITZ4020_74HC_GPIO_LED_INFO, - .active_low = 1, - }, { - .name = "fritz4020:red:info", - .gpio = FRITZ4020_74HC_GPIO_LED_INFO_RED, - .active_low = 1, - }, { - .name = "fritz4020:green:power", - .gpio = FRITZ4020_74HC_GPIO_LED_POWER, - .active_low = 1, - }, { - .name = "fritz4020:green:wlan", - .gpio = FRITZ4020_74HC_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "fritz4020:green:wan", - .gpio = FRITZ4020_74HC_GPIO_LED_WAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button fritz4020_gpio_keys[] __initdata = { - { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = FRITZ4020_KEYS_DEBOUNCE_INTERVAL, - .gpio = FRITZ4020_GPIO_BTN_WLAN, - .active_low = 0, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = FRITZ4020_KEYS_DEBOUNCE_INTERVAL, - .gpio = FRITZ4020_GPIO_BTN_WPS, - .active_low = 0, - }, -}; - -static void __init fritz4020_setup(void) { - u8 *urlader = (u8 *) KSEG1ADDR(0x1f000000); - u8 wifi_mac[ETH_ALEN]; - - ath79_register_m25p80(&fritz4020_flash_data); - - /* Initialize ethernet */ - ath79_extract_mac_reverse(urlader + FRTIZ4020_OFFSET_URLADER_WIFI_MAC_REVERSE, wifi_mac); - ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP | - QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP); - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - ath79_init_mac(ath79_eth0_data.mac_addr, wifi_mac, -1); - ath79_init_mac(ath79_eth1_data.mac_addr, wifi_mac, -2); - - /* WAN port */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - ath79_register_eth(0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(0); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - /* Initialize 2.4GHz WiFi */ - ath79_register_wmac_simple(); - - /* Activate USB Power */ - gpio_request_one(FRITZ4020_74HC_GPIO_USB_RST, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - /* Initialize USB port */ - ath79_register_usb(); - - /* Register LED shift-register */ - spi_register_board_info(fritz4020_spi_info, - ARRAY_SIZE(fritz4020_spi_info)); - platform_device_register(&fritz4020_spi_device); - - /* Register GPIO buttons */ - ath79_register_gpio_keys_polled(-1, FRITZ4020_KEYS_POLL_INTERVAL, - ARRAY_SIZE(fritz4020_gpio_keys), - fritz4020_gpio_keys); - - /* Register LEDs */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(fritz4020_leds_gpio), - fritz4020_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_FRITZ4020, "FRITZ4020", - "AVM FRITZ!Box 4020", fritz4020_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar150.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar150.c deleted file mode 100644 index 9febc7a83..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar150.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * GL_ar150 board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2013 alzhao - * Copyright (C) 2014 Michel Stempin - * - * 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 "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 GL_AR150_GPIO_LED_WLAN 0 -#define GL_AR150_GPIO_LED_LAN 13 -#define GL_AR150_GPIO_LED_WAN 15 - -#define GL_AR150_GPIO_BIN_USB 6 -#define GL_AR150_GPIO_BTN_MANUAL 7 -#define GL_AR150_GPIO_BTN_AUTO 8 -#define GL_AR150_GPIO_BTN_RESET 11 - -#define GL_AR150_KEYS_POLL_INTERVAL 20 /* msecs */ -#define GL_AR150_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR150_KEYS_POLL_INTERVAL) - -#define GL_AR150_MAC0_OFFSET 0x0000 -#define GL_AR150_MAC1_OFFSET 0x0000 -#define GL_AR150_CALDATA_OFFSET 0x1000 -#define GL_AR150_WMAC_MAC_OFFSET 0x0000 - -static struct gpio_led gl_ar150_leds_gpio[] __initdata = { - { - .name = "gl-ar150:orange:wlan", - .gpio = GL_AR150_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "gl-ar150:green:lan", - .gpio = GL_AR150_GPIO_LED_LAN, - .active_low = 0, - }, - { - .name = "gl-ar150:green:wan", - .gpio = GL_AR150_GPIO_LED_WAN, - .active_low = 0, - .default_state = 1, - }, -}; - -static struct gpio_keys_button gl_ar150_gpio_keys[] __initdata = { - { - .desc = "BTN_7", - .type = EV_KEY, - .code = BTN_7, - .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR150_GPIO_BTN_MANUAL, - .active_low = 0, - }, - { - .desc = "BTN_8", - .type = EV_KEY, - .code = BTN_8, - .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR150_GPIO_BTN_AUTO, - .active_low = 0, - }, - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_AR150_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR150_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static void __init gl_ar150_setup(void) -{ - - /* ART base address */ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - /* register flash. */ - ath79_register_m25p80(NULL); - - /* register gpio LEDs and keys */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar150_leds_gpio), - gl_ar150_leds_gpio); - ath79_register_gpio_keys_polled(-1, GL_AR150_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_ar150_gpio_keys), - gl_ar150_gpio_keys); - - /* enable usb */ - gpio_request_one(GL_AR150_GPIO_BIN_USB, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - /* register eth0 as WAN, eth1 as LAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, art+GL_AR150_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art+GL_AR150_MAC1_OFFSET, 0); - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - /* register wireless mac with cal data */ - ath79_register_wmac(art + GL_AR150_CALDATA_OFFSET, art + GL_AR150_WMAC_MAC_OFFSET); -} - -MIPS_MACHINE(ATH79_MACH_GL_AR150, "GL-AR150", "GL.iNet GL-AR150", gl_ar150_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar300.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar300.c deleted file mode 100644 index 1708d696b..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar300.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Domino board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2013 alzhao - * Copyright (C) 2014 Michel Stempin - * - * 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 "common.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 GL_AR300_GPIO_LED_WLAN 13 -#define GL_AR300_GPIO_LED_WAN 14 -#define GL_AR300_GPIO_BTN_RESET 16 - - -#define GL_AR300_KEYS_POLL_INTERVAL 20 /* msecs */ -#define GL_AR300_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR300_KEYS_POLL_INTERVAL) - -#define GL_AR300_MAC0_OFFSET 0x0000 -#define GL_AR300_MAC1_OFFSET 0x0000 -#define GL_AR300_CALDATA_OFFSET 0x1000 -#define GL_AR300_WMAC_MAC_OFFSET 0x0000 - -static struct gpio_led gl_ar300_leds_gpio[] __initdata = { - { - .name = "gl-ar300:wlan", - .gpio = GL_AR300_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "gl-ar300:wan", - .gpio = GL_AR300_GPIO_LED_WAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button gl_ar300_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_AR300_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR300_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init gl_ar300_setup(void) -{ - - /* ART base address */ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - /* register flash. */ - ath79_register_m25p80(NULL); - - /* register gpio LEDs and keys */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar300_leds_gpio), - gl_ar300_leds_gpio); - ath79_register_gpio_keys_polled(-1, GL_AR300_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_ar300_gpio_keys), - gl_ar300_gpio_keys); - - /* enable usb */ - ath79_register_usb(); - ath79_register_mdio(1, 0x0); - - /* register eth0 as WAN, eth1 as LAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, art+GL_AR300_MAC0_OFFSET, 0); - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - ath79_init_mac(ath79_eth1_data.mac_addr, art+GL_AR300_MAC1_OFFSET, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - /* register wireless mac with cal data */ - ath79_register_wmac(art + GL_AR300_CALDATA_OFFSET, art + GL_AR300_WMAC_MAC_OFFSET); -} - -MIPS_MACHINE(ATH79_MACH_GL_AR300, "GL-AR300", "GL.iNet GL-AR300", gl_ar300_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar300m.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar300m.c deleted file mode 100644 index 2a2d2702b..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar300m.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * GLI AR300M(D) board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2013 alzhao - * Copyright (C) 2014 Michel Stempin - * - * 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-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-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define GL_AR300M_GPIO_LED_USB 2 -#define GL_AR300M_GPIO_LED_WLAN 14 -#define GL_AR300M_GPIO_LED_LAN 13 -#define GL_AR300M_GPIO_LED_SYSTEM 12 -#define GL_AR300M_GPIO_BTN_RESET 3 -#define GL_AR300M_GPIO_BTN_LEFT 0 -#define GL_AR300M_GPIO_BTN_RIGHT 1 - -#define GL_AR300M_KEYS_POLL_INTERVAL 20 /* msecs */ -#define GL_AR300M_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR300M_KEYS_POLL_INTERVAL) - -#define GL_AR300M_MAC0_OFFSET 0 -#define GL_AR300M_MAC1_OFFSET 6 -#define GL_AR300M_WMAC_CALDATA_OFFSET 0x1000 -#define GL_AR300M_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led gl_ar300m_leds_gpio[] __initdata = { - { - .name = "gl-ar300m:green:usb", - .gpio = GL_AR300M_GPIO_LED_USB, - .active_low = 0, - .default_state = 1, - }, - { - .name = "gl-ar300m:green:wlan", - .gpio = GL_AR300M_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "gl-ar300m:green:lan", - .gpio = GL_AR300M_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "gl-ar300m:green:system", - .gpio = GL_AR300M_GPIO_LED_SYSTEM, - .active_low = 1, - .default_state = 1, - }, -}; - -static struct gpio_keys_button gl_ar300m_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR300M_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "button right", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR300M_GPIO_BTN_LEFT, - .active_low = 0, - }, - { - .desc = "button left", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR300M_GPIO_BTN_RIGHT, - .active_low = 0, - }, -}; - -static struct spi_board_info gl_ar300m_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = NULL, - }, - { - .bus_num = 0, - .chip_select = 1, - .max_speed_hz = 25000000, - .modalias = "ath79-spinand", - .platform_data = NULL, - } -}; - -static struct ath79_spi_platform_data gl_ar300m_spi_data = { - .bus_num = 0, - .num_chipselect = 2, -}; - -static void __init gl_ar300m_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - ath79_register_spi(&gl_ar300m_spi_data, gl_ar300m_spi_info, 2); - - /* register gpio LEDs and keys */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar300m_leds_gpio), - gl_ar300m_leds_gpio); - ath79_register_gpio_keys_polled(-1, GL_AR300M_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_ar300m_gpio_keys), - gl_ar300m_gpio_keys); - - ath79_register_mdio(0, 0x0); - - /* WAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, art + GL_AR300M_MAC0_OFFSET, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(4); - ath79_register_eth(0); - - /* LAN */ - ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_AR300M_MAC1_OFFSET, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - ath79_init_mac(tmpmac, art + GL_AR300M_WMAC_CALDATA_OFFSET + 2, 0); - ath79_register_wmac(art + GL_AR300M_WMAC_CALDATA_OFFSET, tmpmac); - - /* enable usb */ - ath79_register_usb(); - /* enable pci */ - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_GL_AR300M, "GL-AR300M", "GL.iNet GL-AR300M", gl_ar300m_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar750.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar750.c deleted file mode 100644 index 9ee6e29c0..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar750.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * GL.iNet GL-AR750 board support - * - * Copyright (C) 2018 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 GL_AR750_GPIO_LED_POWER 12 -#define GL_AR750_GPIO_LED_WLAN2G 14 -#define GL_AR750_GPIO_LED_WLAN5G 13 - -#define GL_AR750_GPIO_BTN_RESET 3 -#define GL_AR750_GPIO_BTN_SW1 0 - -#define GL_AR750_GPIO_I2C_SCL 16 -#define GL_AR750_GPIO_I2C_SDA 17 - -#define GL_AR750_GPIO_USB_POWER 2 - -#define GL_AR750_KEYS_POLL_INTERVAL 20 -#define GL_AR750_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR750_KEYS_POLL_INTERVAL) - -#define GL_AR750_MAC0_OFFSET 0 -#define GL_AR750_WMAC2G_CALDATA_OFFSET 0x1000 -#define GL_AR750_WMAC5G_CALDATA_OFFSET 0x5000 - -static struct gpio_led gl_ar750_leds_gpio[] __initdata = { - { - .name = "gl-ar750:white:power", - .gpio = GL_AR750_GPIO_LED_POWER, - .default_state = LEDS_GPIO_DEFSTATE_KEEP, - .active_low = 1, - }, { - .name = "gl-ar750:white:wlan2g", - .gpio = GL_AR750_GPIO_LED_WLAN2G, - .active_low = 1, - }, { - .name = "gl-ar750:white:wlan5g", - .gpio = GL_AR750_GPIO_LED_WLAN5G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button gl_ar750_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_AR750_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR750_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "sw1", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = GL_AR750_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR750_GPIO_BTN_SW1, - .active_low = 1, - }, -}; - -static struct i2c_gpio_platform_data gl_ar750_i2c_gpio_data = { - .sda_pin = GL_AR750_GPIO_I2C_SDA, - .scl_pin = GL_AR750_GPIO_I2C_SCL, -}; - -static struct platform_device gl_ar750_i2c_gpio = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &gl_ar750_i2c_gpio_data, - }, -}; - -static void __init gl_ar750_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f050000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = 0xfc; - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, art + GL_AR750_MAC0_OFFSET, 0); - ath79_register_eth(0); - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_AR750_MAC0_OFFSET, 1); - ath79_register_eth(1); - - /* Disable JTAG (enables GPIO0-3) */ - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar750_leds_gpio), - gl_ar750_leds_gpio); - - ath79_register_gpio_keys_polled(-1, GL_AR750_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_ar750_gpio_keys), - gl_ar750_gpio_keys); - - gpio_request_one(GL_AR750_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - platform_device_register(&gl_ar750_i2c_gpio); - - ath79_register_usb(); - - ath79_register_wmac(art + GL_AR750_WMAC2G_CALDATA_OFFSET, NULL); - - ap91_pci_init(art + GL_AR750_WMAC5G_CALDATA_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_GL_AR750, "GL-AR750", "GL.iNet GL-AR750", - gl_ar750_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar750s.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar750s.c deleted file mode 100755 index b556f9b0b..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-ar750s.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * GL.iNet GL-AR750S board support - * - * Copyright (C) 2018 luochongjun - * - * 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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "dev-usb.h" -#include "machtypes.h" - - -#define GL_AR750S_KEYS_POLL_INTERVAL 20 -#define GL_AR750S_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR750S_KEYS_POLL_INTERVAL) - - -#define GL_AR750S_GPIO_LED_WLAN2G 19 -#define GL_AR750S_GPIO_LED_WLAN5G 20 -#define GL_AR750S_GPIO_LED_POWER 1 -#define GL_AR750S_GPIO_USB_POWER 7 - -#define GL_AR750S_GPIO_BTN_RESET 2 -#define GL_AR750S_GPIO_BTN_RIGHT 8 - -#define GL_AR750S_MAC0_OFFSET 0x0000 -#define GL_AR750S_WMAC_CALDATA_OFFSET 0x1000 -#define GL_AR750S_PCI_CALDATA_OFFSET 0x5000 - -#define GL_AR750S_GPIO_I2C_SDA 5 -#define GL_AR750S_GPIO_I2C_SCL 21 - - - -static struct spi_board_info gl_ar750s_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = NULL, - }, -}; - -static struct ath79_spi_platform_data gl_ar750s_spi_data = { - .bus_num = 0, - .num_chipselect = 2, -}; - -static struct gpio_led gl_ar750s_leds_gpio[] __initdata = { - { - .name = "gl-ar750s:green:power", - .gpio = GL_AR750S_GPIO_LED_POWER, - .default_state = LEDS_GPIO_DEFSTATE_KEEP, - .active_low = 1, - },{ - .name = "gl-ar750s:green:usbpower", - .gpio = GL_AR750S_GPIO_USB_POWER, - .active_low = 1, - },{ - .name = "gl-ar750s:green:wlan2g", - .gpio = GL_AR750S_GPIO_LED_WLAN2G, - .active_low = 1, - },{ - .name = "gl-ar750s:green:wlan5g", - .gpio = GL_AR750S_GPIO_LED_WLAN5G, - .active_low = 0, - } -}; - -static struct gpio_keys_button gl_ar750s_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_AR750S_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR750S_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "right", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = GL_AR750S_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR750S_GPIO_BTN_RIGHT, - .active_low = 1, - }, -}; - -static struct i2c_gpio_platform_data gl_ar750s_i2c_gpio_data = { - .sda_pin = GL_AR750S_GPIO_I2C_SDA, - .scl_pin = GL_AR750S_GPIO_I2C_SCL, -}; - -static struct platform_device gl_ar750s_i2c_gpio_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &gl_ar750s_i2c_gpio_data, - } - -}; - -static struct ar8327_pad_cfg gl_ar750s_ar8327_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data gl_ar750s_ar8327_data = { - .pad0_cfg = &gl_ar750s_ar8327_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - - -static struct mdio_board_info gl_ar750s_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .phy_addr = 0, - .platform_data = &gl_ar750s_ar8327_data, - }, -}; - -static void __init gl_ar750s_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1f050000); - - ath79_register_spi(&gl_ar750s_spi_data, gl_ar750s_spi_info, 1); - - ath79_init_mac(ath79_eth0_data.mac_addr, - eeprom + GL_AR750S_MAC0_OFFSET, 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(gl_ar750s_mdio0_info, - ARRAY_SIZE(gl_ar750s_mdio0_info)); - - ath79_register_mdio(0, 0x00); - ath79_register_eth(0); - - - ath79_register_usb(); - - - ath79_register_wmac(eeprom + GL_AR750S_WMAC_CALDATA_OFFSET, NULL); - - - ap91_pci_init(eeprom + GL_AR750S_PCI_CALDATA_OFFSET, NULL); - - platform_device_register(&gl_ar750s_i2c_gpio_device); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar750s_leds_gpio), - gl_ar750s_leds_gpio); - - ath79_register_gpio_keys_polled(-1, GL_AR750S_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_ar750s_gpio_keys), - gl_ar750s_gpio_keys); -} - - -MIPS_MACHINE(ATH79_MACH_GL_AR750S, "GL-AR750S", "GL-AR750S", - gl_ar750s_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-domino.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-domino.c deleted file mode 100644 index 4ff8ff637..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-domino.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Domino board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2013 alzhao - * Copyright (C) 2014 Michel Stempin - * - * 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 "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 DOMINO_GPIO_LED_WLAN 0 -#define DOMINO_GPIO_LED_WAN 17 -#define DOMINO_GPIO_LED_USB 1 -#define DOMINO_GPIO_LED_LAN1 13 -#define DOMINO_GPIO_LED_LAN2 14 -#define DOMINO_GPIO_LED_LAN3 15 -#define DOMINO_GPIO_LED_LAN4 16 -#define DOMINO_GPIO_LED_SYS 27 -#define DOMINO_GPIO_LED_WPS 26 -#define DOMINO_GPIO_USB_POWER 6 - -#define DOMINO_GPIO_BTN_RESET 11 -#define DOMINO_GPIO_BTN_WPS 20 - -#define DOMINO_KEYS_POLL_INTERVAL 20 /* msecs */ -#define DOMINO_KEYS_DEBOUNCE_INTERVAL (3 * DOMINO_KEYS_POLL_INTERVAL) - -#define DOMINO_MAC0_OFFSET 0x0000 -#define DOMINO_MAC1_OFFSET 0x0000 -#define DOMINO_CALDATA_OFFSET 0x1000 -#define DOMINO_WMAC_MAC_OFFSET 0x0000 - -static struct gpio_led domino_leds_gpio[] __initdata = { - { - .name = "gl-domino:blue:wlan", - .gpio = DOMINO_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "gl-domino:red:wan", - .gpio = DOMINO_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "gl-domino:white:usb", - .gpio = DOMINO_GPIO_LED_USB, - .active_low = 0, - }, - { - .name = "gl-domino:green:lan1", - .gpio = DOMINO_GPIO_LED_LAN1, - .active_low = 0, - }, - { - .name = "gl-domino:yellow:wps", - .gpio = DOMINO_GPIO_LED_WPS, - .active_low = 1, - }, - { - .name = "gl-domino:orange:sys", - .gpio = DOMINO_GPIO_LED_SYS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button domino_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = DOMINO_KEYS_DEBOUNCE_INTERVAL, - .gpio = DOMINO_GPIO_BTN_RESET, - .active_low = 0, - }, - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = DOMINO_KEYS_DEBOUNCE_INTERVAL, - .gpio = DOMINO_GPIO_BTN_WPS, - .active_low = 0, - } -}; - -static void __init domino_setup(void) -{ - - /* ART base address */ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - /* register flash. */ - ath79_register_m25p80(NULL); - - /* register gpio LEDs and keys */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(domino_leds_gpio), - domino_leds_gpio); - ath79_register_gpio_keys_polled(-1, DOMINO_KEYS_POLL_INTERVAL, - ARRAY_SIZE(domino_gpio_keys), - domino_gpio_keys); - - gpio_request_one(DOMINO_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - /* enable usb */ - ath79_register_usb(); - - /* register eth0 as WAN, eth1 as LAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, art+DOMINO_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art+DOMINO_MAC1_OFFSET, 0); - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - /* register wireless mac with cal data */ - ath79_register_wmac(art + DOMINO_CALDATA_OFFSET, art + DOMINO_WMAC_MAC_OFFSET); -} - -MIPS_MACHINE(ATH79_MACH_GL_DOMINO, "DOMINO", "Domino Pi", domino_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-inet.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-inet.c deleted file mode 100644 index 6f603d957..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-inet.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * GL-CONNECT iNet board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2013 alzhao - * Copyright (C) 2014 Michel Stempin - * - * 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 "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 GL_INET_GPIO_LED_WLAN 0 -#define GL_INET_GPIO_LED_LAN 13 -#define GL_INET_GPIO_BTN_RESET 11 - -#define GL_INET_KEYS_POLL_INTERVAL 20 /* msecs */ -#define GL_INET_KEYS_DEBOUNCE_INTERVAL (3 * GL_INET_KEYS_POLL_INTERVAL) - -static const char * gl_inet_part_probes[] = { - "tp-link", /* dont change, this will use tplink parser */ - NULL , -}; - -static struct flash_platform_data gl_inet_flash_data = { - .part_probes = gl_inet_part_probes, -}; - -static struct gpio_led gl_inet_leds_gpio[] __initdata = { - { - .name = "gl-inet:red:wlan", - .gpio = GL_INET_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "gl-inet:green:lan", - .gpio = GL_INET_GPIO_LED_LAN, - .active_low = 0, - .default_state = 1, - }, -}; - -static struct gpio_keys_button gl_inet_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_INET_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_INET_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init gl_inet_setup(void) -{ - /* get the mac address which is stored in the 1st 64k uboot MTD */ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - - /* get the art address, which is the last 64K. By using - 0x1fff1000, it doesn't matter it is 4M, 8M or 16M flash */ - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - /* register flash. MTD will use tp-link parser to parser MTD */ - ath79_register_m25p80(&gl_inet_flash_data); - - /* register gpio LEDs and keys */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_inet_leds_gpio), - gl_inet_leds_gpio); - ath79_register_gpio_keys_polled(-1, GL_INET_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_inet_gpio_keys), - gl_inet_gpio_keys); - - /* enable usb */ - ath79_register_usb(); - - /* register eth0 as WAN, eth1 as LAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_eth(1); - - /* register wireless mac with cal data */ - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_GL_INET, "GL-INET", "GL-CONNECT INET v1", - gl_inet_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-mifi.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-mifi.c deleted file mode 100644 index a5c68ed65..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-mifi.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Mifi board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2013 alzhao - * Copyright (C) 2014 Michel Stempin - * - * 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 "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 GL_MIFI_GPIO_LED_WAN 27 -#define GL_MIFI_GPIO_LED_LAN 16 -#define GL_MIFI_GPIO_LED_WLAN 1 -#define GL_MIFI_GPIO_LED_NET 0 -#define GL_MIFI_GPIO_LED_3GCONTROL 7 - -#define GL_MIFI_GPIO_BTN_RESET 11 - -#define GL_MIFI_KEYS_POLL_INTERVAL 20 /* msecs */ -#define GL_MIFI_KEYS_DEBOUNCE_INTERVAL (3 * GL_MIFI_KEYS_POLL_INTERVAL) - -#define GL_MIFI_MAC0_OFFSET 0x0000 -#define GL_MIFI_MAC1_OFFSET 0x0000 -#define GL_MIFI_CALDATA_OFFSET 0x1000 -#define GL_MIFI_WMAC_MAC_OFFSET 0x0000 - -static struct gpio_led gl_mifi_leds_gpio[] __initdata = { - { - .name = "gl-mifi:green:wan", - .gpio = GL_MIFI_GPIO_LED_WAN, - .active_low = 0, - }, - { - .name = "gl-mifi:green:lan", - .gpio = GL_MIFI_GPIO_LED_LAN, - .active_low = 0, - }, - { - .name = "gl-mifi:green:wlan", - .gpio = GL_MIFI_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "gl-mifi:green:net", - .gpio = GL_MIFI_GPIO_LED_NET, - .active_low = 0, - }, - { - .name = "gl-mifi:green:3gcontrol", - .gpio = GL_MIFI_GPIO_LED_3GCONTROL, - .active_low = 0, - } -}; - -static struct gpio_keys_button gl_mifi_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_MIFI_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_MIFI_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static void __init gl_mifi_setup(void) -{ - - /* ART base address */ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - /* register flash. */ - ath79_register_m25p80(NULL); - - /* register gpio LEDs and keys */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_mifi_leds_gpio), - gl_mifi_leds_gpio); - ath79_register_gpio_keys_polled(-1, GL_MIFI_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_mifi_gpio_keys), - gl_mifi_gpio_keys); - - /* enable usb */ - ath79_register_usb(); - - /* register eth0 as WAN, eth1 as LAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, art+GL_MIFI_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art+GL_MIFI_MAC1_OFFSET, 0); - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - /* register wireless mac with cal data */ - ath79_register_wmac(art + GL_MIFI_CALDATA_OFFSET, art + GL_MIFI_WMAC_MAC_OFFSET); -} - -MIPS_MACHINE(ATH79_MACH_GL_MIFI, "GL-MIFI", "GL.iNet GL-MIFI", gl_mifi_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-usb150.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-usb150.c deleted file mode 100644 index 6cc27e1ad..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gl-usb150.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * GL.iNet GL-USB150 board support - * - * Copyright (C) 2017 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 "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 GL_USB150_GPIO_LED_POWER 13 -#define GL_USB150_GPIO_LED_WLAN 0 -#define GL_USB150_GPIO_LAN_RESET 7 -#define GL_USB150_GPIO_BTN_RESET 11 - -#define GL_USB150_KEYS_POLL_INTERVAL 20 -#define GL_USB150_KEYS_DEBOUNCE_INTERVAL \ - (3 * GL_USB150_KEYS_POLL_INTERVAL) - -#define GL_USB150_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led gl_usb150_leds_gpio[] __initdata = { - { - .name = "gl-usb150:green:power", - .gpio = GL_USB150_GPIO_LED_POWER, - .active_low = 0, - }, { - .name = "gl-usb150:green:wlan", - .gpio = GL_USB150_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button gl_usb150_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_USB150_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_USB150_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static void __init gl_usb150_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - /* LAN (PHY4 connected with Realtek RTL8152B) */ - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_usb150_leds_gpio), - gl_usb150_leds_gpio); - - ath79_register_gpio_keys_polled(-1, GL_USB150_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_usb150_gpio_keys), - gl_usb150_gpio_keys); - - gpio_request_one(GL_USB150_GPIO_LAN_RESET, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "LAN reset"); - - ath79_register_wmac(art + GL_USB150_WMAC_CALDATA_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_GL_USB150, "GL-USB150", "GL.iNet GL-USB150", - gl_usb150_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gs-oolite-v1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gs-oolite-v1.c deleted file mode 100644 index d424e0f11..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gs-oolite-v1.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * GainStrong Oolite/MiniBox V1.0 boards support - * - * - * 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 "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" -#include "dev-usb.h" - -#define GS_MINIBOX_V1_GPIO_BTN_RESET 11 -#define GS_MINIBOX_V1_GPIO_LED_SYSTEM 1 - -#define GS_OOLITE_V1_GPIO_BTN6 6 -#define GS_OOLITE_V1_GPIO_BTN7 7 -#define GS_OOLITE_V1_GPIO_BTN_RESET 11 -#define GS_OOLITE_V1_GPIO_LED_SYSTEM 27 - -#define GS_KEYS_POLL_INTERVAL 20 /* msecs */ -#define GS_KEYS_DEBOUNCE_INTERVAL (3 * GS_KEYS_POLL_INTERVAL) - -static const char *gs_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data gs_flash_data = { - .part_probes = gs_part_probes, -}; - -static struct gpio_led gs_minibox_v1_leds_gpio[] __initdata = { - { - .name = "minibox-v1:green:system", - .gpio = GS_MINIBOX_V1_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_led gs_oolite_v1_leds_gpio[] __initdata = { - { - .name = "oolite-v1:red:system", - .gpio = GS_OOLITE_V1_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button gs_minibox_v1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, - .gpio = GS_MINIBOX_V1_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static struct gpio_keys_button gs_oolite_v1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, - .gpio = GS_OOLITE_V1_GPIO_BTN_RESET, - .active_low = 0, - }, { - .desc = "BTN_6", - .type = EV_KEY, - .code = BTN_6, - .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, - .gpio = GS_OOLITE_V1_GPIO_BTN6, - .active_low = 0, - }, { - .desc = "BTN_7", - .type = EV_KEY, - .code = BTN_7, - .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, - .gpio = GS_OOLITE_V1_GPIO_BTN7, - .active_low = 0, - }, -}; - -static void __init gs_common_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff1000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - - ath79_register_usb(); - - ath79_register_m25p80(&gs_flash_data); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_register_wmac(art, mac); -} - -static void __init gs_minibox_v1_setup(void) -{ - gs_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_minibox_v1_leds_gpio), - gs_minibox_v1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, GS_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gs_minibox_v1_gpio_keys), - gs_minibox_v1_gpio_keys); -} - -static void __init gs_oolite_v1_setup(void) -{ - gs_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_oolite_v1_leds_gpio), - gs_oolite_v1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, GS_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gs_oolite_v1_gpio_keys), - gs_oolite_v1_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_GS_MINIBOX_V1, "MINIBOX-V1", "GainStrong MiniBox V1.0", - gs_minibox_v1_setup); - -MIPS_MACHINE(ATH79_MACH_GS_OOLITE_V1, "OOLITE-V1", "GainStrong Oolite V1.0", - gs_oolite_v1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gs-oolite-v5-2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gs-oolite-v5-2.c deleted file mode 100644 index 64dc4f334..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-gs-oolite-v5-2.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * GainStrong Oolite V5.2 module and development board support - * - * Copyright (C) 2018 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 "common.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" -#include "pci.h" - -#define GS_OOLITE_V5_2_DEV_GPIO_BTN_RESET 17 -#define GS_OOLITE_V5_2_DEV_GPIO_LED_SYSTEM 13 - -#define GS_KEYS_POLL_INTERVAL 20 /* msec */ -#define GS_KEYS_DEBOUNCE_INTERVAL (3 * GS_KEYS_POLL_INTERVAL) - -#define GS_OOLITE_V5_2_WMAC_CALDATA_OFFSET 0x1000 - -static const char *gs_oolite_v5_2_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data gs_oolite_v5_2_flash_data = { - .part_probes = gs_oolite_v5_2_part_probes, -}; - -static struct gpio_led gs_oolite_v5_2_dev_gpio_leds[] __initdata = { - { - .name = "oolite-v5.2-dev:blue:system", - .gpio = GS_OOLITE_V5_2_DEV_GPIO_LED_SYSTEM, - .active_low = 0, - }, -}; - -static struct gpio_keys_button gs_oolite_v5_2_dev_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, - .gpio = GS_OOLITE_V5_2_DEV_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init gs_oolite_v5_2_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&gs_oolite_v5_2_flash_data); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask |= BIT(4); - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_init_mac(ath79_eth1_data.mac_addr, art + 6, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); - ath79_register_eth(0); - - ath79_register_pci(); - ath79_register_usb(); - ath79_register_wmac(art + GS_OOLITE_V5_2_WMAC_CALDATA_OFFSET, NULL); -} - -static void __init gs_oolite_v5_2_dev_setup(void) -{ - gs_oolite_v5_2_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_oolite_v5_2_dev_gpio_leds), - gs_oolite_v5_2_dev_gpio_leds); - - ath79_register_gpio_keys_polled(-1, GS_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gs_oolite_v5_2_dev_gpio_keys), - gs_oolite_v5_2_dev_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_GS_OOLITE_V5_2, "OOLITE-V5-2", - "GainStrong Oolite V5.2", gs_oolite_v5_2_setup); - -MIPS_MACHINE(ATH79_MACH_GS_OOLITE_V5_2_DEV, "OOLITE-V5-2-DEV", - "GainStrong Oolite V5.2-Dev", gs_oolite_v5_2_dev_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hiveap-121.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hiveap-121.c deleted file mode 100644 index 363d73dd5..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hiveap-121.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Aerohive HiveAP 121 board support - * - * Copyright (C) 2017 Chris Blake - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "dev-ap9x-pci.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -#define HIVEAP_121_GPIO_LED_ORANGE 14 -#define HIVEAP_121_GPIO_LED_WHITE 21 -#define HIVEAP_121_GPIO_I2C_SCL 12 -#define HIVEAP_121_GPIO_I2C_SDA 13 -#define HIVEAP_121_GPIO_XLNA0 20 -#define HIVEAP_121_GPIO_XLNA1 19 -#define HIVEAP_121_GPIO_USB_POWER 15 - -#define HIVEAP_121_GPIO_BTN_RESET 4 -#define HIVEAP_121_KEYS_POLL_INTERVAL 20 /* msecs */ -#define HIVEAP_121_KEYS_DEBOUNCE_INTERVAL \ - (3 * HIVEAP_121_KEYS_POLL_INTERVAL) - -#define HIVEAP_121_MAC_OFFSET 0x90000 - -#define HIVEAP_121_LAN_PHYADDR 0 - -static struct gpio_led hiveap_121_leds_gpio[] __initdata = { - { - .name = "hiveap-121:orange:power", - .gpio = HIVEAP_121_GPIO_LED_ORANGE, - .active_low = 1, - }, { - .name = "hiveap-121:white:power", - .gpio = HIVEAP_121_GPIO_LED_WHITE, - .active_low = 1, - } -}; - -static struct gpio_keys_button hiveap_121_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = HIVEAP_121_KEYS_DEBOUNCE_INTERVAL, - .gpio = HIVEAP_121_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct i2c_gpio_platform_data hiveap_121_i2c_gpio_data = { - .sda_pin = HIVEAP_121_GPIO_I2C_SDA, - .scl_pin = HIVEAP_121_GPIO_I2C_SCL, -}; - -static struct platform_device hiveap_121_i2c_gpio_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &hiveap_121_i2c_gpio_data, - } -}; - -static struct i2c_board_info tpm_i2c_info[] __initdata = { - { - I2C_BOARD_INFO("tpm_i2c_atmel", 0x29), - } -}; - -static void __init hiveap_121_setup(void) -{ - u8 *base = (u8 *) KSEG1ADDR(0x1f000000); - u8 wlan0_mac[ETH_ALEN]; - u8 wlan1_mac[ETH_ALEN]; - - /* NAND */ - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW); - ath79_register_nfc(); - - /* SPI */ - ath79_register_m25p80(NULL); - - /* MDIO Interface */ - ath79_register_mdio(0, 0x0); - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_RXD_DELAY | - AR934X_ETH_CFG_RDV_DELAY); - - /* GMAC0 is connected to the RGMII interface to an Atheros AR8035-A */ - ath79_init_mac(ath79_eth0_data.mac_addr, - base + HIVEAP_121_MAC_OFFSET, 0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(HIVEAP_121_LAN_PHYADDR); - ath79_eth0_pll_data.pll_1000 = 0x0e000000; - ath79_eth0_pll_data.pll_100 = 0x00000101; - ath79_eth0_pll_data.pll_10 = 0x00001313; - ath79_register_eth(0); - - /* i2c */ - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - platform_device_register(&hiveap_121_i2c_gpio_device); - - /* TPM */ - i2c_register_board_info(0, tpm_i2c_info, ARRAY_SIZE(tpm_i2c_info)); - - /* LEDs and Buttons */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(hiveap_121_leds_gpio), - hiveap_121_leds_gpio); - ath79_register_gpio_keys_polled(-1, HIVEAP_121_KEYS_POLL_INTERVAL, - ARRAY_SIZE(hiveap_121_gpio_keys), - hiveap_121_gpio_keys); - - /* USB */ - gpio_request_one(HIVEAP_121_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - /* XLNA - SoC Wireless */ - ath79_wmac_set_ext_lna_gpio(0, HIVEAP_121_GPIO_XLNA0); - ath79_wmac_set_ext_lna_gpio(1, HIVEAP_121_GPIO_XLNA1); - - /* SoC Wireless */ - ath79_init_mac(wlan0_mac, base + HIVEAP_121_MAC_OFFSET, 1); - ath79_register_wmac(NULL, wlan0_mac); /* Caldata in OTP */ - - /* PCIe Wireless */ - ath79_init_mac(wlan1_mac, base + HIVEAP_121_MAC_OFFSET, 2); - ap91_pci_init(NULL, wlan1_mac); /* Caldata in OTP */ -} - -MIPS_MACHINE(ATH79_MACH_HIVEAP_121, "HiveAP-121", "Aerohive HiveAP-121", - hiveap_121_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hiwifi-hc6361.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hiwifi-hc6361.c deleted file mode 100644 index 6600595c0..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hiwifi-hc6361.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * HiWiFi HC6361 board support - * - * Copyright (C) 2012-2013 eric - * Copyright (C) 2014 Yousong Zhou - * - * 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-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define HIWIFI_HC6361_GPIO_LED_WLAN_2P4 0 /* 2.4G WLAN LED */ -#define HIWIFI_HC6361_GPIO_LED_SYSTEM 1 /* System LED */ -#define HIWIFI_HC6361_GPIO_LED_INTERNET 27 /* Internet LED */ - -#define HIWIFI_HC6361_GPIO_USBPOWER 20 /* USB power control */ -#define HIWIFI_HC6361_GPIO_BTN_RST 11 /* Reset button */ - -#define HIWIFI_HC6361_KEYS_POLL_INTERVAL 20 /* msecs */ -#define HIWIFI_HC6361_KEYS_DEBOUNCE_INTERVAL \ - (3 * HIWIFI_HC6361_KEYS_POLL_INTERVAL) - -static struct gpio_led hiwifi_leds_gpio[] __initdata = { - { - .name = "hiwifi:blue:wlan-2p4", - .gpio = HIWIFI_HC6361_GPIO_LED_WLAN_2P4, - .active_low = 1, - }, { - .name = "hiwifi:blue:system", - .gpio = HIWIFI_HC6361_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "hiwifi:blue:internet", - .gpio = HIWIFI_HC6361_GPIO_LED_INTERNET, - .active_low = 1, - } -}; - -static struct gpio_keys_button hiwifi_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = HIWIFI_HC6361_KEYS_DEBOUNCE_INTERVAL, - .gpio = HIWIFI_HC6361_GPIO_BTN_RST, - .active_low = 1, - } -}; - -static void __init get_mac_from_bdinfo(u8 *mac, void *bdinfo) -{ - if (sscanf(bdinfo, "fac_mac = %2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", - &mac[0], &mac[1], &mac[2], &mac[3], - &mac[4], &mac[5]) == 6) { - return; - } - - printk(KERN_WARNING "Parsing MAC address failed.\n"); - memcpy(mac, "\x00\xba\xbe\x00\x00\x00", 6); -} - -static void __init hiwifi_hc6361_setup(void) -{ - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - u8 mac[6]; - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_m25p80(NULL); - ath79_gpio_function_enable( - AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(hiwifi_leds_gpio), - hiwifi_leds_gpio); - ath79_register_gpio_keys_polled(-1, HIWIFI_HC6361_KEYS_POLL_INTERVAL, - ARRAY_SIZE(hiwifi_gpio_keys), - hiwifi_gpio_keys); - gpio_request_one(HIWIFI_HC6361_GPIO_USBPOWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - get_mac_from_bdinfo(mac, (void *) KSEG1ADDR(0x1f010180)); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - ath79_register_mdio(0, 0x0); - - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_HIWIFI_HC6361, "HiWiFi-HC6361", - "HiWiFi HC6361", hiwifi_hc6361_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hornet-ub.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hornet-ub.c deleted file mode 100644 index 1d2142458..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-hornet-ub.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ALFA NETWORK Hornet-UB board support - * - * Copyright (C) 2011-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 "common.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 HORNET_UB_GPIO_LED_WLAN 0 -#define HORNET_UB_GPIO_LED_USB 1 -#define HORNET_UB_GPIO_LED_LAN 13 -#define HORNET_UB_GPIO_LED_WAN 17 -#define HORNET_UB_GPIO_LED_WPS 27 -#define HORNET_UB_GPIO_EXT_LNA 28 - -#define HORNET_UB_GPIO_BTN_RESET 12 -#define HORNET_UB_GPIO_BTN_WPS 11 - -#define HORNET_UB_GPIO_USB_POWER 26 - -#define HORNET_UB_KEYS_POLL_INTERVAL 20 /* msecs */ -#define HORNET_UB_KEYS_DEBOUNCE_INTERVAL (3 * HORNET_UB_KEYS_POLL_INTERVAL) - -#define HORNET_UB_MAC0_OFFSET 0x0000 -#define HORNET_UB_MAC1_OFFSET 0x0006 -#define HORNET_UB_CALDATA_OFFSET 0x1000 - -static struct gpio_led hornet_ub_leds_gpio[] __initdata = { - { - .name = "alfa:blue:lan", - .gpio = HORNET_UB_GPIO_LED_LAN, - .active_low = 0, - }, - { - .name = "alfa:blue:usb", - .gpio = HORNET_UB_GPIO_LED_USB, - .active_low = 0, - }, - { - .name = "alfa:blue:wan", - .gpio = HORNET_UB_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "alfa:blue:wlan", - .gpio = HORNET_UB_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "alfa:blue:wps", - .gpio = HORNET_UB_GPIO_LED_WPS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button hornet_ub_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = HORNET_UB_KEYS_DEBOUNCE_INTERVAL, - .gpio = HORNET_UB_GPIO_BTN_WPS, - .active_low = 0, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = HORNET_UB_KEYS_DEBOUNCE_INTERVAL, - .gpio = HORNET_UB_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init hornet_ub_gpio_setup(void) -{ - u32 t; - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); - t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN; - ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t); - - gpio_request_one(HORNET_UB_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - gpio_request_one(HORNET_UB_GPIO_EXT_LNA, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "external LNA0"); - -} - -static void __init hornet_ub_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - hornet_ub_gpio_setup(); - - ath79_register_m25p80(NULL); - ath79_register_leds_gpio(-1, ARRAY_SIZE(hornet_ub_leds_gpio), - hornet_ub_leds_gpio); - ath79_register_gpio_keys_polled(-1, HORNET_UB_KEYS_POLL_INTERVAL, - ARRAY_SIZE(hornet_ub_gpio_keys), - hornet_ub_gpio_keys); - - ath79_init_mac(ath79_eth1_data.mac_addr, - art + HORNET_UB_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth0_data.mac_addr, - art + HORNET_UB_MAC1_OFFSET, 0); - - ath79_register_mdio(0, 0x0); - - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_register_wmac(art + HORNET_UB_CALDATA_OFFSET, NULL); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_HORNET_UB, "HORNET-UB", "ALFA NETWORK Hornet-UB", - hornet_ub_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ja76pf.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ja76pf.c deleted file mode 100644 index d1fe0f8a2..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ja76pf.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * jjPlus JA76PF board support - */ - -#include -#include -#include - -#include - -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "pci.h" - -#define JA76PF_KEYS_POLL_INTERVAL 20 /* msecs */ -#define JA76PF_KEYS_DEBOUNCE_INTERVAL (3 * JA76PF_KEYS_POLL_INTERVAL) - -#define JA76PF_GPIO_I2C_SCL 0 -#define JA76PF_GPIO_I2C_SDA 1 -#define JA76PF_GPIO_LED_1 5 -#define JA76PF_GPIO_LED_2 4 -#define JA76PF_GPIO_LED_3 3 -#define JA76PF_GPIO_BTN_RESET 11 - -static struct gpio_led ja76pf_leds_gpio[] __initdata = { - { - .name = "jjplus:green:led1", - .gpio = JA76PF_GPIO_LED_1, - .active_low = 1, - }, { - .name = "jjplus:green:led2", - .gpio = JA76PF_GPIO_LED_2, - .active_low = 1, - }, { - .name = "jjplus:green:led3", - .gpio = JA76PF_GPIO_LED_3, - .active_low = 1, - } -}; - -static struct gpio_keys_button ja76pf_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = JA76PF_KEYS_DEBOUNCE_INTERVAL, - .gpio = JA76PF_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct i2c_gpio_platform_data ja76pf_i2c_gpio_data = { - .sda_pin = JA76PF_GPIO_I2C_SDA, - .scl_pin = JA76PF_GPIO_I2C_SCL, -}; - -static struct platform_device ja76pf_i2c_gpio_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &ja76pf_i2c_gpio_data, - } -}; - -static const char *ja76pf_part_probes[] = { - "RedBoot", - NULL, -}; - -static struct flash_platform_data ja76pf_flash_data = { - .part_probes = ja76pf_part_probes, -}; - -#define JA76PF_WAN_PHYMASK (1 << 4) -#define JA76PF_LAN_PHYMASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 < 3)) -#define JA76PF_MDIO_PHYMASK (JA76PF_LAN_PHYMASK | JA76PF_WAN_PHYMASK) - -static void __init ja76pf_init(void) -{ - ath79_register_m25p80(&ja76pf_flash_data); - - ath79_register_mdio(0, ~JA76PF_MDIO_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = JA76PF_LAN_PHYMASK; - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = JA76PF_WAN_PHYMASK; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - ath79_register_eth(1); - - platform_device_register(&ja76pf_i2c_gpio_device); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ja76pf_leds_gpio), - ja76pf_leds_gpio); - - ath79_register_gpio_keys_polled(-1, JA76PF_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ja76pf_gpio_keys), - ja76pf_gpio_keys); - - ath79_register_usb(); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_JA76PF, "JA76PF", "jjPlus JA76PF", ja76pf_init); - -#define JA76PF2_GPIO_LED_D2 5 -#define JA76PF2_GPIO_LED_D3 4 -#define JA76PF2_GPIO_LED_D4 3 -#define JA76PF2_GPIO_BTN_RESET 7 -#define JA76PF2_GPIO_BTN_WPS 8 - -static struct gpio_led ja76pf2_leds_gpio[] __initdata = { - { - .name = "jjplus:green:led1", - .gpio = JA76PF2_GPIO_LED_D2, - .active_low = 1, - }, { - .name = "jjplus:green:led2", - .gpio = JA76PF2_GPIO_LED_D3, - .active_low = 0, - }, { - .name = "jjplus:green:led3", - .gpio = JA76PF2_GPIO_LED_D4, - .active_low = 0, - } -}; - -static struct gpio_keys_button ja76pf2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = JA76PF_KEYS_DEBOUNCE_INTERVAL, - .gpio = JA76PF2_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = JA76PF_KEYS_DEBOUNCE_INTERVAL, - .gpio = JA76PF2_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -#define JA76PF2_LAN_PHYMASK BIT(0) -#define JA76PF2_WAN_PHYMASK BIT(4) -#define JA76PF2_MDIO_PHYMASK (JA76PF2_LAN_PHYMASK | JA76PF2_WAN_PHYMASK) - -static void __init ja76pf2_init(void) -{ - ath79_register_m25p80(&ja76pf_flash_data); - - ath79_register_mdio(0, ~JA76PF2_MDIO_PHYMASK); - - /* MAC0 is connected to the CPU port of the AR8316 switch */ - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - - /* MAC1 is connected to the PHY4 of the AR8316 switch */ - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = BIT(4); - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ja76pf2_leds_gpio), - ja76pf2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, JA76PF_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ja76pf2_gpio_keys), - ja76pf2_gpio_keys); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_JA76PF2, "JA76PF2", "jjPlus JA76PF2", ja76pf2_init); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-jwap003.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-jwap003.c deleted file mode 100644 index a3c93ccd9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-jwap003.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * jjPlus JWAP003 board support - * - */ - -#include -#include -#include - -#include - -#include "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-gpio-buttons.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "pci.h" - -#define JWAP003_KEYS_POLL_INTERVAL 20 /* msecs */ -#define JWAP003_KEYS_DEBOUNCE_INTERVAL (3 * JWAP003_KEYS_POLL_INTERVAL) - -#define JWAP003_GPIO_WPS 11 -#define JWAP003_GPIO_I2C_SCL 0 -#define JWAP003_GPIO_I2C_SDA 1 - -static struct gpio_keys_button jwap003_gpio_keys[] __initdata = { - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = JWAP003_KEYS_DEBOUNCE_INTERVAL, - .gpio = JWAP003_GPIO_WPS, - .active_low = 1, - } -}; - -static struct i2c_gpio_platform_data jwap003_i2c_gpio_data = { - .sda_pin = JWAP003_GPIO_I2C_SDA, - .scl_pin = JWAP003_GPIO_I2C_SCL, -}; - -static struct platform_device jwap003_i2c_gpio_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &jwap003_i2c_gpio_data, - } -}; - -static const char *jwap003_part_probes[] = { - "RedBoot", - NULL, -}; - -static struct flash_platform_data jwap003_flash_data = { - .part_probes = jwap003_part_probes, -}; - -#define JWAP003_WAN_PHYMASK BIT(0) -#define JWAP003_LAN_PHYMASK BIT(4) - -static void __init jwap003_init(void) -{ - ath79_register_m25p80(&jwap003_flash_data); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth0_data.phy_mask = JWAP003_WAN_PHYMASK; - 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, ath79_mac_base, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.phy_mask = JWAP003_LAN_PHYMASK; - ath79_eth1_data.speed = SPEED_100; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - ath79_register_eth(1); - - platform_device_register(&jwap003_i2c_gpio_device); - - ath79_register_usb(); - - ath79_register_gpio_keys_polled(-1, JWAP003_KEYS_POLL_INTERVAL, - ARRAY_SIZE(jwap003_gpio_keys), - jwap003_gpio_keys); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_JWAP003, "JWAP003", "jjPlus JWAP003", jwap003_init); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-k2t.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-k2t.c deleted file mode 100644 index 868e83e20..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-k2t.c +++ /dev/null @@ -1,136 +0,0 @@ - -/* - * Phicomm K2T A1/A2/A3 reference board support - * - * Copyright (c) 2018 Chen Minqiang - * - * 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 "common.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" -#include "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" - -#define K2T_GPIO_LED_BLUE 6 -#define K2T_GPIO_LED_RED 7 -#define K2T_GPIO_LED_YELLOW 8 - -#define K2T_GPIO_BTN_RESET 2 -#define K2T_KEYS_POLL_INTERVAL 20 /* msecs */ -#define K2T_KEYS_DEBOUNCE_INTERVAL (3 * K2T_KEYS_POLL_INTERVAL) - -#define K2T_MAC0_OFFSET 0 - -static struct gpio_led k2t_leds_gpio[] __initdata = { - { - .name = "k2t:blue:lan", - .gpio = K2T_GPIO_LED_BLUE, - .active_low = 1, - }, - { - .name = "k2t:red:lan", - .gpio = K2T_GPIO_LED_RED, - .active_low = 0, - }, - { - .name = "k2t:yellow:lan", - .gpio = K2T_GPIO_LED_YELLOW, - .active_low = 1, - }, -}; - -static struct gpio_keys_button k2t_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = K2T_KEYS_DEBOUNCE_INTERVAL, - .gpio = K2T_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct ar8327_pad_cfg k2t_ar8337_pad0_cfg = { - .mode = AR8327_PAD_MAC_SGMII, - .sgmii_delay_en = true, -}; - -static struct ar8327_platform_data k2t_ar8337_data = { - .pad0_cfg = &k2t_ar8337_pad0_cfg, - .port0_cfg = { - .force_link = 1, - .speed = AR8327_PORT_SPEED_1000, - .duplex = 1, - .txpause = 1, - .rxpause = 1, - }, -}; - -static struct mdio_board_info k2t_mdio0_info[] = { - { - .bus_id = "ag71xx-mdio.0", - .phy_addr = 0, - .platform_data = &k2t_ar8337_data, - }, -}; - -static void __init k2t_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(k2t_leds_gpio), - k2t_leds_gpio); - ath79_register_gpio_keys_polled(-1, K2T_KEYS_POLL_INTERVAL, - ARRAY_SIZE(k2t_gpio_keys), - k2t_gpio_keys); - - ath79_register_usb(); - - platform_device_register(&ath79_mdio0_device); - - mdiobus_register_board_info(k2t_mdio0_info, - ARRAY_SIZE(k2t_mdio0_info)); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + K2T_MAC0_OFFSET, 0); - - /* GMAC0 is connected to an AR8337 switch */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - - ath79_register_eth(0); - - ath79_register_wmac_simple(); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_K2T, "K2T", "Phicomm K2T A1/A2/A3 board", - k2t_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-lan-turtle.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-lan-turtle.c deleted file mode 100644 index d2faa2c74..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-lan-turtle.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Hak5 LAN Turtle and Packet Squirrel boards support - * - * Copyright (C) 2018 Sebastian Kinne - * Copyright (C) 2018 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" - -#define LAN_TURTLE_GPIO_BTN_RESET 11 -#define LAN_TURTLE_GPIO_LED_SYS 13 - -#define PACKET_SQUIRREL_GPIO_BTN_SW1 18 -#define PACKET_SQUIRREL_GPIO_BTN_SW2 20 -#define PACKET_SQUIRREL_GPIO_BTN_SW3 21 -#define PACKET_SQUIRREL_GPIO_BTN_SW4 24 -#define PACKET_SQUIRREL_GPIO_BTN_RESET 11 -#define PACKET_SQUIRREL_GPIO_LED_B 23 -#define PACKET_SQUIRREL_GPIO_LED_G 22 -#define PACKET_SQUIRREL_GPIO_LED_R 19 - -#define HAK5_KEYS_POLL_INTERVAL 20 /* msecs */ -#define HAK5_KEYS_DEBOUNCE_INTERVAL (3 * HAK5_KEYS_POLL_INTERVAL) - -static const char *hak5_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data hak5_flash_data = { - .part_probes = hak5_part_probes, -}; - -/* LAN Turtle */ -static struct gpio_led lan_turtle_leds_gpio[] __initdata = { - { - .name = "lan-turtle:orange:system", - .gpio = LAN_TURTLE_GPIO_LED_SYS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button lan_turtle_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, - .gpio = LAN_TURTLE_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -/* Packet Squirrel */ -static struct gpio_led packet_squirrel_leds_gpio[] __initdata = { - { - .name = "packet-squirrel:blue:system", - .gpio = PACKET_SQUIRREL_GPIO_LED_B, - .active_low = 1, - }, { - .name = "packet-squirrel:green:system", - .gpio = PACKET_SQUIRREL_GPIO_LED_G, - .active_low = 1, - }, { - .name = "packet-squirrel:red:system", - .gpio = PACKET_SQUIRREL_GPIO_LED_R, - .active_low = 1, - }, -}; - -static struct gpio_keys_button packet_squirrel_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, - .gpio = PACKET_SQUIRREL_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "sw1", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, - .gpio = PACKET_SQUIRREL_GPIO_BTN_SW1, - .active_low = 1, - }, { - .desc = "sw2", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, - .gpio = PACKET_SQUIRREL_GPIO_BTN_SW2, - .active_low = 1, - }, { - .desc = "sw3", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, - .gpio = PACKET_SQUIRREL_GPIO_BTN_SW3, - .active_low = 1, - }, { - .desc = "sw4", - .type = EV_KEY, - .code = BTN_3, - .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, - .gpio = PACKET_SQUIRREL_GPIO_BTN_SW4, - .active_low = 1, - }, -}; - -static void __init hak5_common_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - - ath79_register_m25p80(&hak5_flash_data); - - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy_poll_mask = 0xfe; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - ath79_register_eth(1); - - ath79_register_usb(); - - /* GPIO11/12 */ - ath79_gpio_function_disable(AR933X_GPIO_FUNC_UART_RTS_CTS_EN); -} - -static void __init lan_turtle_setup(void) -{ - hak5_common_setup(); - - /* GPIO13 */ - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(lan_turtle_leds_gpio), - lan_turtle_leds_gpio); - - ath79_register_gpio_keys_polled(-1, HAK5_KEYS_POLL_INTERVAL, - ARRAY_SIZE(lan_turtle_gpio_keys), - lan_turtle_gpio_keys); -} - -static void __init packet_squirrel_setup(void) -{ - hak5_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(packet_squirrel_leds_gpio), - packet_squirrel_leds_gpio); - - ath79_register_gpio_keys_polled(-1, HAK5_KEYS_POLL_INTERVAL, - ARRAY_SIZE(packet_squirrel_gpio_keys), - packet_squirrel_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_LAN_TURTLE, "LAN-TURTLE", - "Hak5 LAN Turtle", lan_turtle_setup); - -MIPS_MACHINE(ATH79_MACH_PACKET_SQUIRREL, "PACKET-SQUIRREL", - "Hak5 Packet Squirrel", packet_squirrel_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-lima.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-lima.c deleted file mode 100644 index 986742968..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-lima.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 8devices Lima board support - * - * Copyright (C) 2016 Mantas Pucka - * Copyright (C) 2017 Karol Dudek - * - * 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define LIMA_GPIO_BTN_1_DEFAULT 16 -#define LIMA_KEYS_POLL_INTERVAL 20 /* msecs */ -#define LIMA_KEYS_DEBOUNCE_INTERVAL (3 * LIMA_KEYS_POLL_INTERVAL) - -#define LIMA_ETH_PHYS (BIT(0) | BIT(1)) - -#define LIMA_MAC0_OFFSET 0x0000 -#define LIMA_MAC1_OFFSET 0x0006 - -#define LIMA_CALDATA_OFFSET 0x1000 - -static struct gpio_keys_button lima_gpio_keys[] __initdata = { - { - .desc = "button1", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = LIMA_KEYS_DEBOUNCE_INTERVAL, - .gpio = LIMA_GPIO_BTN_1_DEFAULT, - .active_low = 1, - } -}; - -static void __init lima_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f080000); - - ath79_register_m25p80(NULL); - - ath79_register_gpio_keys_polled(-1, LIMA_KEYS_POLL_INTERVAL, - ARRAY_SIZE(lima_gpio_keys), - lima_gpio_keys); - - ath79_setup_ar933x_phy4_switch(true, true); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + LIMA_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art + LIMA_MAC1_OFFSET, 0); - - ath79_register_mdio(0, ~LIMA_ETH_PHYS); - - ath79_switch_data.phy4_mii_en = 1; - - ath79_switch_data.phy_poll_mask |= BIT(0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_mask = BIT(1); - ath79_register_eth(1); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(0); - ath79_register_eth(0); - - ath79_register_wmac(art + LIMA_CALDATA_OFFSET, NULL); - ath79_register_usb(); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_LIMA, "LIMA", "8devices Lima board", lima_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mc-mac1200r.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mc-mac1200r.c deleted file mode 100644 index 70051cff4..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mc-mac1200r.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * MERCURY MAC1200R board support - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2013 Gui Iribarren - * - * 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 "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-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define MAC1200R_GPIO_LED_WLAN2G 13 -#define MAC1200R_GPIO_LED_WLAN5G 17 -#define MAC1200R_GPIO_LED_SYSTEM 14 -#define MAC1200R_GPIO_LED_WPS 11 -#define MAC1200R_GPIO_LED_WAN 12 -#define MAC1200R_GPIO_LED_LAN1 15 -#define MAC1200R_GPIO_LED_LAN2 21 -#define MAC1200R_GPIO_LED_LAN3 22 -#define MAC1200R_GPIO_LED_LAN4 20 - -#define MAC1200R_GPIO_BTN_WPS 16 - -#define MAC1200R_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MAC1200R_KEYS_DEBOUNCE_INTERVAL (3 * MAC1200R_KEYS_POLL_INTERVAL) - -#define MAC1200R_MAC0_OFFSET 0 -#define MAC1200R_MAC1_OFFSET 6 -#define MAC1200R_WMAC_CALDATA_OFFSET 0x1000 -#define MAC1200R_PCIE_CALDATA_OFFSET 0x5000 - -static const char *mac1200r_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data mac1200r_flash_data = { - .part_probes = mac1200r_part_probes, -}; - -static struct gpio_led mac1200r_leds_gpio[] __initdata = { - { - .name = "mercury:green:wps", - .gpio = MAC1200R_GPIO_LED_WPS, - .active_low = 1, - }, - { - .name = "mercury:green:system", - .gpio = MAC1200R_GPIO_LED_SYSTEM, - .active_low = 1, - }, - { - .name = "mercury:green:wlan2g", - .gpio = MAC1200R_GPIO_LED_WLAN2G, - .active_low = 1, - }, - { - .name = "mercury:green:wlan5g", - .gpio = MAC1200R_GPIO_LED_WLAN5G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button mac1200r_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MAC1200R_KEYS_DEBOUNCE_INTERVAL, - .gpio = MAC1200R_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - - -static void __init mac1200r_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&mac1200r_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(mac1200r_leds_gpio), - mac1200r_leds_gpio); - - ath79_register_gpio_keys_polled(-1, MAC1200R_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mac1200r_gpio_keys), - mac1200r_gpio_keys); - - ath79_init_mac(tmpmac, mac, 0); - ath79_wmac_disable_5ghz(); - ath79_register_wmac(art + MAC1200R_WMAC_CALDATA_OFFSET, tmpmac); - - ath79_init_mac(tmpmac, mac, 1); - ap91_pci_init(art + MAC1200R_PCIE_CALDATA_OFFSET, tmpmac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - - /* LAN */ - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - - ath79_register_eth(1); - - /* WAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 2); - - /* GMAC0 is connected to the PHY4 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - - ath79_register_eth(0); - - ath79_gpio_output_select(MAC1200R_GPIO_LED_LAN1, - AR934X_GPIO_OUT_LED_LINK3); - ath79_gpio_output_select(MAC1200R_GPIO_LED_LAN2, - AR934X_GPIO_OUT_LED_LINK2); - ath79_gpio_output_select(MAC1200R_GPIO_LED_LAN3, - AR934X_GPIO_OUT_LED_LINK1); - ath79_gpio_output_select(MAC1200R_GPIO_LED_LAN4, - AR934X_GPIO_OUT_LED_LINK0); - ath79_gpio_output_select(MAC1200R_GPIO_LED_WAN, - AR934X_GPIO_OUT_LED_LINK4); -} - -MIPS_MACHINE(ATH79_MACH_MC_MAC1200R, "MC-MAC1200R", - "MERCURY MAC1200R", - mac1200r_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr12.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr12.c deleted file mode 100644 index 5a337e5c9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr12.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Cisco Meraki MR12 board support - * - * Copyright (C) 2014-2015 Chris Blake - * - * Based on Atheros AP96 board support configuration - * - * Copyright (C) 2009 Marco Porsch - * Copyright (C) 2009-2012 Gabor Juhos - * Copyright (C) 2010 Atheros Communications - * - * 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 "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -#define MR12_GPIO_LED_W4_GREEN 14 -#define MR12_GPIO_LED_W3_GREEN 13 -#define MR12_GPIO_LED_W2_GREEN 12 -#define MR12_GPIO_LED_W1_GREEN 11 - -#define MR12_GPIO_LED_WAN 15 - -#define MR12_GPIO_LED_POWER_ORANGE 16 -#define MR12_GPIO_LED_POWER_GREEN 17 - -#define MR12_GPIO_BTN_RESET 8 -#define MR12_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MR12_KEYS_DEBOUNCE_INTERVAL (3 * MR12_KEYS_POLL_INTERVAL) - -#define MR12_WAN_PHYMASK BIT(4) - -#define MR12_CALDATA0_OFFSET 0x21000 - -static struct gpio_led MR12_leds_gpio[] __initdata = { - { - .name = "mr12:green:wan", - .gpio = MR12_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "mr12:orange:power", - .gpio = MR12_GPIO_LED_POWER_ORANGE, - .active_low = 1, - }, { - .name = "mr12:green:power", - .gpio = MR12_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, { - .name = "mr12:green:wifi4", - .gpio = MR12_GPIO_LED_W4_GREEN, - .active_low = 1, - }, { - .name = "mr12:green:wifi3", - .gpio = MR12_GPIO_LED_W3_GREEN, - .active_low = 1, - }, { - .name = "mr12:green:wifi2", - .gpio = MR12_GPIO_LED_W2_GREEN, - .active_low = 1, - }, { - .name = "mr12:green:wifi1", - .gpio = MR12_GPIO_LED_W1_GREEN, - .active_low = 1, - } -}; - -static struct gpio_keys_button MR12_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MR12_KEYS_DEBOUNCE_INTERVAL, - .gpio = MR12_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init MR12_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0xbffd0000); - u8 wlan_mac[ETH_ALEN]; - - ath79_register_mdio(0,0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = MR12_WAN_PHYMASK; - ath79_register_eth(0); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(MR12_leds_gpio), - MR12_leds_gpio); - ath79_register_gpio_keys_polled(-1, MR12_KEYS_POLL_INTERVAL, - ARRAY_SIZE(MR12_gpio_keys), - MR12_gpio_keys); - - ath79_init_mac(wlan_mac, mac, 1); - ap91_pci_init(mac + MR12_CALDATA0_OFFSET, wlan_mac); -} - -MIPS_MACHINE(ATH79_MACH_MR12, "MR12", "Meraki MR12", MR12_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr16.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr16.c deleted file mode 100644 index 9da21eab5..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr16.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Cisco Meraki MR16 board support - * - * Copyright (C) 2015 Chris Blake - * - * Based on Atheros AP96 board support configuration - * - * Copyright (C) 2009 Marco Porsch - * Copyright (C) 2009-2012 Gabor Juhos - * Copyright (C) 2010 Atheros Communications - * - * 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 "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -#define MR16_GPIO_LED_W4_GREEN 3 -#define MR16_GPIO_LED_W3_GREEN 2 -#define MR16_GPIO_LED_W2_GREEN 1 -#define MR16_GPIO_LED_W1_GREEN 0 - -#define MR16_GPIO_LED_WAN 4 - -#define MR16_GPIO_LED_POWER_ORANGE 5 -#define MR16_GPIO_LED_POWER_GREEN 6 - -#define MR16_GPIO_BTN_RESET 7 -#define MR16_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MR16_KEYS_DEBOUNCE_INTERVAL (3 * MR16_KEYS_POLL_INTERVAL) - -#define MR16_WAN_PHYMASK BIT(0) - -#define MR16_CALDATA0_OFFSET 0x21000 -#define MR16_CALDATA1_OFFSET 0x25000 - -static struct gpio_led MR16_leds_gpio[] __initdata = { - { - .name = "mr16:green:wan", - .gpio = MR16_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "mr16:orange:power", - .gpio = MR16_GPIO_LED_POWER_ORANGE, - .active_low = 1, - }, { - .name = "mr16:green:power", - .gpio = MR16_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, { - .name = "mr16:green:wifi4", - .gpio = MR16_GPIO_LED_W4_GREEN, - .active_low = 1, - }, { - .name = "mr16:green:wifi3", - .gpio = MR16_GPIO_LED_W3_GREEN, - .active_low = 1, - }, { - .name = "mr16:green:wifi2", - .gpio = MR16_GPIO_LED_W2_GREEN, - .active_low = 1, - }, { - .name = "mr16:green:wifi1", - .gpio = MR16_GPIO_LED_W1_GREEN, - .active_low = 1, - } -}; - -static struct gpio_keys_button MR16_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MR16_KEYS_DEBOUNCE_INTERVAL, - .gpio = MR16_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init MR16_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0xbffd0000); - u8 wlan0_mac[ETH_ALEN]; - u8 wlan1_mac[ETH_ALEN]; - - ath79_register_mdio(0,0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = MR16_WAN_PHYMASK; - ath79_register_eth(0); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(MR16_leds_gpio), - MR16_leds_gpio); - ath79_register_gpio_keys_polled(-1, MR16_KEYS_POLL_INTERVAL, - ARRAY_SIZE(MR16_gpio_keys), - MR16_gpio_keys); - - ath79_init_mac(wlan0_mac, mac, 1); - ath79_init_mac(wlan1_mac, mac, 2); - ap94_pci_init(mac + MR16_CALDATA0_OFFSET, wlan0_mac, - mac + MR16_CALDATA1_OFFSET, wlan1_mac); -} - -MIPS_MACHINE(ATH79_MACH_MR16, "MR16", "Meraki MR16", MR16_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr18.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr18.c deleted file mode 100644 index 2d2fb6e84..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr18.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Cisco Meraki MR18 board support - * - * Copyright (C) 2015 Chris Blake - * Copyright (C) 2015 Christian Lamparter - * Copyright (C) 2015 Thomas Hebb - * - * Based on Cisco Meraki GPL Release r23-20150601 MR18 Device Config - * - * 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 "common.h" -#include "dev-eth.h" -#include "pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-nfc.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define MR18_GPIO_LED_POWER_WHITE 18 -#define MR18_GPIO_LED_POWER_ORANGE 21 - -#define MR18_GPIO_BTN_RESET 17 -#define MR18_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MR18_KEYS_DEBOUNCE_INTERVAL (3 * MR18_KEYS_POLL_INTERVAL) - -#define MR18_WAN_PHYADDR 3 - -/* used for eth calibration */ -#define MR18_OTP_BASE (AR71XX_APB_BASE + 0x130000) -#define MR18_OTP_SIZE (0x2000) /* just a guess */ -#define MR18_OTP_MEM_0_REG (0x0000) -#define MR18_OTP_INTF2_REG (0x1008) -#define MR18_OTP_STATUS0_REG (0x1018) -#define MR18_OTP_STATUS0_EFUSE_VALID BIT(2) - -#define MR18_OTP_STATUS1_REG (0x101c) -#define MR18_OTP_LDO_CTRL_REG (0x1024) -#define MR18_OTP_LDO_STATUS_REG (0x102c) -#define MR18_OTP_LDO_STATUS_POWER_ON BIT(0) - -static struct gpio_led MR18_leds_gpio[] __initdata = { - { - .name = "mr18:white:power", - .gpio = MR18_GPIO_LED_POWER_WHITE, - .active_low = 1, - }, { - .name = "mr18:orange:power", - .gpio = MR18_GPIO_LED_POWER_ORANGE, - .active_low = 0, - }, -}; - -static struct gpio_keys_button MR18_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MR18_KEYS_DEBOUNCE_INTERVAL, - .gpio = MR18_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct led_nu801_template tricolor_led_template = { - .device_name = "mr18", - .name = "tricolor", - .num_leds = 1, - .cki = 11, - .sdi = 12, - .lei = -1, - .ndelay = 500, - .init_brightness = { - LED_OFF, - LED_OFF, - LED_OFF, - }, - .default_trigger = "none", - .led_colors = { "red", "green", "blue" }, -}; - -static struct led_nu801_platform_data tricolor_led_data = { - .num_controllers = 1, - .template = &tricolor_led_template, -}; - -static struct platform_device tricolor_leds = { - .name = "leds-nu801", - .id = -1, - .dev.platform_data = &tricolor_led_data, -}; - -static int mr18_extract_sgmii_res_cal(void) -{ - void __iomem *base; - unsigned int reversed_sgmii_value; - - unsigned int otp_value, otp_per_val, rbias_per, read_data; - unsigned int rbias_pos_or_neg; - unsigned int sgmii_res_cal_value; - int res_cal_val; - - base = ioremap_nocache(MR18_OTP_BASE, MR18_OTP_SIZE); - if (!base) - return -EIO; - - __raw_writel(0x7d, base + MR18_OTP_INTF2_REG); - __raw_writel(0x00, base + MR18_OTP_LDO_CTRL_REG); - - while (__raw_readl(base + MR18_OTP_LDO_STATUS_REG) & - MR18_OTP_LDO_STATUS_POWER_ON); - - __raw_readl(base + MR18_OTP_MEM_0_REG + 4); - - while (!(__raw_readl(base + MR18_OTP_STATUS0_REG) & - MR18_OTP_STATUS0_EFUSE_VALID)); - - read_data = __raw_readl(base + MR18_OTP_STATUS1_REG); - - iounmap(base); - - if (!(read_data & 0x1fff)) - return -ENODEV; - - if (read_data & 0x00001000) - otp_value = (read_data & 0xfc0) >> 6; - else - otp_value = read_data & 0x3f; - - if (otp_value > 31) { - otp_per_val = 63 - otp_value; - rbias_pos_or_neg = 1; - } else { - otp_per_val = otp_value; - rbias_pos_or_neg = 0; - } - - rbias_per = otp_per_val * 15; - - if (rbias_pos_or_neg == 1) - res_cal_val = (rbias_per + 34) / 21; - else if (rbias_per > 34) - res_cal_val = -((rbias_per - 34) / 21); - else - res_cal_val = (34 - rbias_per) / 21; - - sgmii_res_cal_value = (8 + res_cal_val) & 0xf; - - reversed_sgmii_value = (sgmii_res_cal_value & 8) >> 3; - reversed_sgmii_value |= (sgmii_res_cal_value & 4) >> 1; - reversed_sgmii_value |= (sgmii_res_cal_value & 2) << 1; - reversed_sgmii_value |= (sgmii_res_cal_value & 1) << 3; - printk(KERN_INFO "SGMII cal value = 0x%x\n", reversed_sgmii_value); - return reversed_sgmii_value; -} - -static void mr18_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value) -{ - void __iomem *ethbase, *pllbase; - u32 t; - - ethbase = ioremap_nocache(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE); - pllbase = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); - - /* To Check the locking of the SGMII PLL */ - t = __raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES); - t &= ~(QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK << - QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT); - t |= (sgmii_value & QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK) << - QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT; - __raw_writel(t, ethbase + QCA955X_GMAC_REG_SGMII_SERDES); - - __raw_writel(QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT | - QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK | - QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL, - pllbase + QCA955X_PLL_ETH_SGMII_SERDES_REG); - - ath79_device_reset_clear(QCA955X_RESET_SGMII_ANALOG); - ath79_device_reset_clear(QCA955X_RESET_SGMII); - - while (!(__raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES) & - QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS)); - - iounmap(ethbase); - iounmap(pllbase); -} - -static struct ath9k_platform_data pci_main_wifi_data = { - .led_pin = -1, -}; -static struct ath9k_platform_data pci_scan_wifi_data = { - .led_pin = -1, -}; - -static int mr18_dual_pci_plat_dev_init(struct pci_dev *dev) -{ - /* The PCIE devices are attached to different busses but they - * both share the same slot number. Checking the PCI_SLOT vals - * does not work. - */ - switch (dev->bus->number) { - case 0: - dev->dev.platform_data = &pci_main_wifi_data; - break; - case 1: - dev->dev.platform_data = &pci_scan_wifi_data; - break; - } - - return 0; -} - -static void __init mr18_setup(void) -{ - int res; - - /* NAND */ - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_SOFT_BCH); - ath79_register_nfc(); - - /* even though, the PHY is connected via RGMII, - * the SGMII/SERDES PLLs need to be calibrated and locked. - * Or else, the PHY won't be working for this platfrom. - * - * Figuring this out took such a long time, that we want to - * point this quirk out, before someone wants to remove it. - */ - res = mr18_extract_sgmii_res_cal(); - if (res >= 0) { - /* Setup SoC Eth Config */ - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN | - (3 << QCA955X_ETH_CFG_RXD_DELAY_SHIFT) | - (3 << QCA955X_ETH_CFG_RDV_DELAY_SHIFT)); - - /* MDIO Interface */ - ath79_register_mdio(0, 0x0); - - mr18_setup_qca955x_eth_serdes_cal(res); - - /* GMAC0 is connected to an Atheros AR8035-A */ - ath79_init_mac(ath79_eth0_data.mac_addr, NULL, 0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(MR18_WAN_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); - } else { - printk(KERN_ERR "failed to read EFUSE for ethernet cal\n"); - } - - /* LEDs and Buttons */ - platform_device_register(&tricolor_leds); - ath79_register_leds_gpio(-1, ARRAY_SIZE(MR18_leds_gpio), - MR18_leds_gpio); - ath79_register_gpio_keys_polled(-1, MR18_KEYS_POLL_INTERVAL, - ARRAY_SIZE(MR18_gpio_keys), - MR18_gpio_keys); - - /* Clear RTC reset (Needed by SoC WiFi) */ - ath79_device_reset_clear(QCA955X_RESET_RTC); - - /* WiFi */ - ath79_register_wmac_simple(); - - pci_main_wifi_data.eeprom_name = "pci_wmac0.eeprom"; - pci_scan_wifi_data.eeprom_name = "pci_wmac1.eeprom"; - ath79_pci_set_plat_dev_init(mr18_dual_pci_plat_dev_init); - ath79_register_pci(); -} -MIPS_MACHINE(ATH79_MACH_MR18, "MR18", "Meraki MR18", mr18_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr600.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr600.c deleted file mode 100644 index 701330ceb..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr600.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * OpenMesh OM2P board support - * - * Copyright (C) 2012 Marek Lindner - * - * 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 "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-spi.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define MR600_GPIO_LED_WLAN58 12 -#define MR600_GPIO_LED_WPS 13 -#define MR600_GPIO_LED_POWER 14 - -#define MR600V2_GPIO_LED_WLAN58_RED 12 -#define MR600V2_GPIO_LED_WPS 13 -#define MR600V2_GPIO_LED_POWER 14 -#define MR600V2_GPIO_LED_WLAN24_GREEN 18 -#define MR600V2_GPIO_LED_WLAN24_YELLOW 19 -#define MR600V2_GPIO_LED_WLAN24_RED 20 -#define MR600V2_GPIO_LED_WLAN58_GREEN 21 -#define MR600V2_GPIO_LED_WLAN58_YELLOW 22 - -#define MR600_GPIO_BTN_RESET 17 - -#define MR600_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MR600_KEYS_DEBOUNCE_INTERVAL (3 * MR600_KEYS_POLL_INTERVAL) - -#define MR600_MAC_OFFSET 0 -#define MR600_WMAC_CALDATA_OFFSET 0x1000 -#define MR600_PCIE_CALDATA_OFFSET 0x5000 - -static struct gpio_led mr600_leds_gpio[] __initdata = { - { - .name = "mr600:orange:power", - .gpio = MR600_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "mr600:blue:wps", - .gpio = MR600_GPIO_LED_WPS, - .active_low = 1, - }, - { - .name = "mr600:green:wlan58", - .gpio = MR600_GPIO_LED_WLAN58, - .active_low = 1, - }, -}; - -static struct gpio_led mr600v2_leds_gpio[] __initdata = { - { - .name = "mr600:blue:power", - .gpio = MR600V2_GPIO_LED_POWER, - .active_low = 1, - }, - { - .name = "mr600:blue:wps", - .gpio = MR600V2_GPIO_LED_WPS, - .active_low = 1, - }, - { - .name = "mr600:red:wlan24", - .gpio = MR600V2_GPIO_LED_WLAN24_RED, - .active_low = 1, - }, - { - .name = "mr600:yellow:wlan24", - .gpio = MR600V2_GPIO_LED_WLAN24_YELLOW, - .active_low = 1, - }, - { - .name = "mr600:green:wlan24", - .gpio = MR600V2_GPIO_LED_WLAN24_GREEN, - .active_low = 1, - }, - { - .name = "mr600:red:wlan58", - .gpio = MR600V2_GPIO_LED_WLAN58_RED, - .active_low = 1, - }, - { - .name = "mr600:yellow:wlan58", - .gpio = MR600V2_GPIO_LED_WLAN58_YELLOW, - .active_low = 1, - }, - { - .name = "mr600:green:wlan58", - .gpio = MR600V2_GPIO_LED_WLAN58_GREEN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button mr600_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MR600_KEYS_DEBOUNCE_INTERVAL, - .gpio = MR600_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init mr600_base_setup(unsigned num_leds, struct gpio_led *leds) -{ - u8 *art = (u8 *)KSEG1ADDR(0x1fff0000); - u8 mac[6]; - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, num_leds, leds); - ath79_register_gpio_keys_polled(-1, MR600_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mr600_gpio_keys), - mr600_gpio_keys); - - ath79_init_mac(mac, art + MR600_MAC_OFFSET, 1); - ath79_register_wmac(art + MR600_WMAC_CALDATA_OFFSET, mac); - - ath79_init_mac(mac, art + MR600_MAC_OFFSET, 8); - ap91_pci_init(art + MR600_PCIE_CALDATA_OFFSET, mac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | - AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + MR600_MAC_OFFSET, 0); - - /* GMAC0 is connected to an external PHY */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x06000000; - ath79_register_eth(0); -} - -static void __init mr600_setup(void) -{ - mr600_base_setup(ARRAY_SIZE(mr600_leds_gpio), mr600_leds_gpio); - ap9x_pci_setup_wmac_led_pin(0, 0); -} - -MIPS_MACHINE(ATH79_MACH_MR600, "MR600", "OpenMesh MR600", mr600_setup); - -static void __init mr600v2_setup(void) -{ - mr600_base_setup(ARRAY_SIZE(mr600v2_leds_gpio), mr600v2_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_MR600V2, "MR600v2", "OpenMesh MR600v2", mr600v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mynet-n600.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mynet-n600.c deleted file mode 100644 index a87413d20..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mynet-n600.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * WD My Net N600 board support - * - * Copyright (C) 2013 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define MYNET_N600_GPIO_LED_WIFI 0 -#define MYNET_N600_GPIO_LED_POWER 11 -#define MYNET_N600_GPIO_LED_INTERNET 12 -#define MYNET_N600_GPIO_LED_WPS 13 - -#define MYNET_N600_GPIO_LED_LAN1 4 -#define MYNET_N600_GPIO_LED_LAN2 3 -#define MYNET_N600_GPIO_LED_LAN3 2 -#define MYNET_N600_GPIO_LED_LAN4 1 - -#define MYNET_N600_GPIO_BTN_RESET 16 -#define MYNET_N600_GPIO_BTN_WPS 17 - -#define MYNET_N600_GPIO_EXTERNAL_LNA0 14 -#define MYNET_N600_GPIO_EXTERNAL_LNA1 15 - -#define MYNET_N600_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MYNET_N600_KEYS_DEBOUNCE_INTERVAL (3 * MYNET_N600_KEYS_POLL_INTERVAL) - -#define MYNET_N600_MAC0_OFFSET 0 -#define MYNET_N600_MAC1_OFFSET 6 -#define MYNET_N600_WMAC_CALDATA_OFFSET 0x1000 -#define MYNET_N600_PCIE_CALDATA_OFFSET 0x5000 - -#define MYNET_N600_NVRAM_ADDR 0x1f058010 -#define MYNET_N600_NVRAM_SIZE 0x7ff0 - -static struct gpio_led mynet_n600_leds_gpio[] __initdata = { - { - .name = "wd:blue:power", - .gpio = MYNET_N600_GPIO_LED_POWER, - .active_low = 0, - }, - { - .name = "wd:blue:wps", - .gpio = MYNET_N600_GPIO_LED_WPS, - .active_low = 0, - }, - { - .name = "wd:blue:wireless", - .gpio = MYNET_N600_GPIO_LED_WIFI, - .active_low = 0, - }, - { - .name = "wd:blue:internet", - .gpio = MYNET_N600_GPIO_LED_INTERNET, - .active_low = 0, - }, - { - .name = "wd:green:lan1", - .gpio = MYNET_N600_GPIO_LED_LAN1, - .active_low = 1, - }, - { - .name = "wd:green:lan2", - .gpio = MYNET_N600_GPIO_LED_LAN2, - .active_low = 1, - }, - { - .name = "wd:green:lan3", - .gpio = MYNET_N600_GPIO_LED_LAN3, - .active_low = 1, - }, - { - .name = "wd:green:lan4", - .gpio = MYNET_N600_GPIO_LED_LAN4, - .active_low = 1, - }, -}; - -static struct gpio_keys_button mynet_n600_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MYNET_N600_KEYS_DEBOUNCE_INTERVAL, - .gpio = MYNET_N600_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = MYNET_N600_KEYS_DEBOUNCE_INTERVAL, - .gpio = MYNET_N600_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static void mynet_n600_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(MYNET_N600_NVRAM_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, MYNET_N600_NVRAM_SIZE, - name, mac); - if (err) - pr_err("no MAC address found for %s\n", name); -} - -#define MYNET_N600_WAN_PHY_MASK BIT(0) - -static void __init mynet_n600_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(NULL); - - ath79_gpio_output_select(MYNET_N600_GPIO_LED_LAN1, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_N600_GPIO_LED_LAN2, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_N600_GPIO_LED_LAN3, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_N600_GPIO_LED_LAN4, - AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(MYNET_N600_GPIO_LED_INTERNET, - AR934X_GPIO_OUT_GPIO); - ath79_register_leds_gpio(-1, ARRAY_SIZE(mynet_n600_leds_gpio), - mynet_n600_leds_gpio); - - ath79_register_gpio_keys_polled(-1, MYNET_N600_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mynet_n600_gpio_keys), - mynet_n600_gpio_keys); - - /* - * Control signal for external LNAs 0 and 1 - * Taken from GPL bootloader source: - * board/ar7240/db12x/alpha_gpio.c - */ - ath79_wmac_set_ext_lna_gpio(0, MYNET_N600_GPIO_EXTERNAL_LNA0); - ath79_wmac_set_ext_lna_gpio(1, MYNET_N600_GPIO_EXTERNAL_LNA1); - - mynet_n600_get_mac("wlan24mac=", tmpmac); - ath79_register_wmac(art + MYNET_N600_WMAC_CALDATA_OFFSET, tmpmac); - - mynet_n600_get_mac("wlan5mac=", tmpmac); - ap91_pci_init(art + MYNET_N600_PCIE_CALDATA_OFFSET, tmpmac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE | - AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - /* LAN */ - mynet_n600_get_mac("lanmac=", ath79_eth1_data.mac_addr); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - - ath79_register_eth(1); - - /* WAN */ - mynet_n600_get_mac("wanmac=", ath79_eth0_data.mac_addr); - - /* GMAC0 is connected to the PHY4 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = MYNET_N600_WAN_PHY_MASK; - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = MYNET_N600_WAN_PHY_MASK; - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - - ath79_register_eth(0); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_MYNET_N600, "MYNET-N600", "WD My Net N600", - mynet_n600_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mzk-w04nu.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mzk-w04nu.c deleted file mode 100644 index c2460ce33..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mzk-w04nu.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Planex MZK-W04NU 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 "machtypes.h" - -#define MZK_W04NU_GPIO_LED_USB 0 -#define MZK_W04NU_GPIO_LED_STATUS 1 -#define MZK_W04NU_GPIO_LED_WPS 3 -#define MZK_W04NU_GPIO_LED_WLAN 6 -#define MZK_W04NU_GPIO_LED_AP 15 -#define MZK_W04NU_GPIO_LED_ROUTER 16 - -#define MZK_W04NU_GPIO_BTN_APROUTER 5 -#define MZK_W04NU_GPIO_BTN_WPS 12 -#define MZK_W04NU_GPIO_BTN_RESET 21 - -#define MZK_W04NU_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MZK_W04NU_KEYS_DEBOUNCE_INTERVAL (3 * MZK_W04NU_KEYS_POLL_INTERVAL) - -static struct gpio_led mzk_w04nu_leds_gpio[] __initdata = { - { - .name = "planex:green:status", - .gpio = MZK_W04NU_GPIO_LED_STATUS, - .active_low = 1, - }, { - .name = "planex:blue:wps", - .gpio = MZK_W04NU_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "planex:green:wlan", - .gpio = MZK_W04NU_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "planex:green:usb", - .gpio = MZK_W04NU_GPIO_LED_USB, - .active_low = 1, - }, { - .name = "planex:green:ap", - .gpio = MZK_W04NU_GPIO_LED_AP, - .active_low = 1, - }, { - .name = "planex:green:router", - .gpio = MZK_W04NU_GPIO_LED_ROUTER, - .active_low = 1, - } -}; - -static struct gpio_keys_button mzk_w04nu_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MZK_W04NU_KEYS_DEBOUNCE_INTERVAL, - .gpio = MZK_W04NU_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = MZK_W04NU_KEYS_DEBOUNCE_INTERVAL, - .gpio = MZK_W04NU_GPIO_BTN_WPS, - .active_low = 1, - }, { - .desc = "aprouter", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = MZK_W04NU_KEYS_DEBOUNCE_INTERVAL, - .gpio = MZK_W04NU_GPIO_BTN_APROUTER, - .active_low = 0, - } -}; - -#define MZK_W04NU_WAN_PHYMASK BIT(4) -#define MZK_W04NU_MDIO_MASK (~MZK_W04NU_WAN_PHYMASK) - -static void __init mzk_w04nu_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_mdio(0, MZK_W04NU_MDIO_MASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, eeprom, 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, eeprom, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.phy_mask = MZK_W04NU_WAN_PHYMASK; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(mzk_w04nu_leds_gpio), - mzk_w04nu_leds_gpio); - - ath79_register_gpio_keys_polled(-1, MZK_W04NU_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mzk_w04nu_gpio_keys), - mzk_w04nu_gpio_keys); - ath79_register_usb(); - - ath79_register_wmac(eeprom, NULL); -} - -MIPS_MACHINE(ATH79_MACH_MZK_W04NU, "MZK-W04NU", "Planex MZK-W04NU", - mzk_w04nu_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mzk-w300nh.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mzk-w300nh.c deleted file mode 100644 index 8c4036528..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mzk-w300nh.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Planex MZK-W300NH 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 "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 MZK_W300NH_GPIO_LED_STATUS 1 -#define MZK_W300NH_GPIO_LED_WPS 3 -#define MZK_W300NH_GPIO_LED_WLAN 6 -#define MZK_W300NH_GPIO_LED_AP_GREEN 15 -#define MZK_W300NH_GPIO_LED_AP_AMBER 16 - -#define MZK_W300NH_GPIO_BTN_APROUTER 5 -#define MZK_W300NH_GPIO_BTN_WPS 12 -#define MZK_W300NH_GPIO_BTN_RESET 21 - -#define MZK_W300NH_KEYS_POLL_INTERVAL 20 /* msecs */ -#define MZK_W300NH_KEYS_DEBOUNCE_INTERVAL (3 * MZK_W300NH_KEYS_POLL_INTERVAL) - -static struct gpio_led mzk_w300nh_leds_gpio[] __initdata = { - { - .name = "planex:green:status", - .gpio = MZK_W300NH_GPIO_LED_STATUS, - .active_low = 1, - }, { - .name = "planex:blue:wps", - .gpio = MZK_W300NH_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "planex:green:wlan", - .gpio = MZK_W300NH_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "planex:green:aprouter", - .gpio = MZK_W300NH_GPIO_LED_AP_GREEN, - }, { - .name = "planex:amber:aprouter", - .gpio = MZK_W300NH_GPIO_LED_AP_AMBER, - } -}; - -static struct gpio_keys_button mzk_w300nh_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = MZK_W300NH_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = MZK_W300NH_GPIO_BTN_WPS, - .active_low = 1, - }, { - .desc = "aprouter", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = MZK_W300NH_GPIO_BTN_APROUTER, - .active_low = 0, - } -}; - -#define MZK_W300NH_WAN_PHYMASK BIT(4) -#define MZK_W300NH_MDIO_MASK (~MZK_W300NH_WAN_PHYMASK) - -static void __init mzk_w300nh_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_mdio(0, MZK_W300NH_MDIO_MASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, eeprom, 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, eeprom, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.phy_mask = MZK_W300NH_WAN_PHYMASK; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(mzk_w300nh_leds_gpio), - mzk_w300nh_leds_gpio); - - ath79_register_gpio_keys_polled(-1, MZK_W300NH_KEYS_POLL_INTERVAL, - ARRAY_SIZE(mzk_w300nh_gpio_keys), - mzk_w300nh_gpio_keys); - ath79_register_wmac(eeprom, NULL); -} - -MIPS_MACHINE(ATH79_MACH_MZK_W300NH, "MZK-W300NH", "Planex MZK-W300NH", - mzk_w300nh_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-n5q.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-n5q.c deleted file mode 100644 index 895fc3293..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-n5q.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * ALFA Network N5Q board support - * - * Copyright (C) 2018 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 "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 N5Q_GPIO_LED_LAN 19 -#define N5Q_GPIO_LED_SIGNAL1 0 -#define N5Q_GPIO_LED_SIGNAL2 1 -#define N5Q_GPIO_LED_SIGNAL3 2 -#define N5Q_GPIO_LED_SIGNAL4 3 -#define N5Q_GPIO_LED_WAN 18 -#define N5Q_GPIO_LED_WLAN 12 - -#define N5Q_GPIO_WDT_EN 16 -#define N5Q_GPIO_WDT_IN 17 - -#define N5Q_GPIO_BTN_RESET 11 - -#define N5Q_MAC0_OFFSET 0 -#define N5Q_MAC1_OFFSET 6 -#define N5Q_WMAC_CALDATA_OFFSET 0x1000 - -#define N5Q_KEYS_POLL_INTERVAL 20 -#define N5Q_KEYS_DEBOUNCE_INTERVAL (3 * N5Q_KEYS_POLL_INTERVAL) - -static struct gpio_led n5q_leds_gpio[] __initdata = { - { - .name = "n5q:green:lan", - .gpio = N5Q_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "n5q:red:signal1", - .gpio = N5Q_GPIO_LED_SIGNAL1, - .active_low = 1, - }, { - .name = "n5q:orange:signal2", - .gpio = N5Q_GPIO_LED_SIGNAL2, - .active_low = 1, - }, { - .name = "n5q:green:signal3", - .gpio = N5Q_GPIO_LED_SIGNAL3, - .active_low = 1, - }, { - .name = "n5q:green:signal4", - .gpio = N5Q_GPIO_LED_SIGNAL4, - .active_low = 1, - }, { - .name = "n5q:green:wan", - .gpio = N5Q_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "n5q:green:wlan", - .gpio = N5Q_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button n5q_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = N5Q_KEYS_DEBOUNCE_INTERVAL, - .gpio = N5Q_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init n5q_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f070000); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(1, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = 0xf7; - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_init_mac(ath79_eth1_data.mac_addr, art + N5Q_MAC1_OFFSET, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, art + N5Q_MAC0_OFFSET, 0); - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(n5q_leds_gpio), - n5q_leds_gpio); - - ath79_register_gpio_keys_polled(-1, N5Q_KEYS_POLL_INTERVAL, - ARRAY_SIZE(n5q_gpio_keys), - n5q_gpio_keys); - - gpio_request_one(N5Q_GPIO_WDT_IN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "WDT input"); - - gpio_request_one(N5Q_GPIO_WDT_EN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "WDT enable"); - - ath79_register_wmac(art + N5Q_WMAC_CALDATA_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_N5Q, "N5Q", "ALFA Network N5Q", n5q_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-nbg460n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-nbg460n.c deleted file mode 100644 index ca007779e..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-nbg460n.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Zyxel NBG 460N/550N/550NH board support - * - * Copyright (C) 2010 Michael Kurz - * - * based on mach-tl-wr1043nd.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 "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-wmac.h" -#include "machtypes.h" - -/* LEDs */ -#define NBG460N_GPIO_LED_WPS 3 -#define NBG460N_GPIO_LED_WAN 6 -#define NBG460N_GPIO_LED_POWER 14 -#define NBG460N_GPIO_LED_WLAN 15 - -/* Buttons */ -#define NBG460N_GPIO_BTN_WPS 12 -#define NBG460N_GPIO_BTN_RESET 21 - -#define NBG460N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define NBG460N_KEYS_DEBOUNCE_INTERVAL (3 * NBG460N_KEYS_POLL_INTERVAL) - -/* RTC chip PCF8563 I2C interface */ -#define NBG460N_GPIO_PCF8563_SDA 8 -#define NBG460N_GPIO_PCF8563_SCK 7 - -/* Switch configuration I2C interface */ -#define NBG460N_GPIO_RTL8366_SDA 16 -#define NBG460N_GPIO_RTL8366_SCK 18 - -static struct mtd_partition nbg460n_partitions[] = { - { - .name = "Bootbase", - .offset = 0, - .size = 0x010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "U-Boot Config", - .offset = 0x010000, - .size = 0x030000, - }, { - .name = "U-Boot", - .offset = 0x040000, - .size = 0x030000, - }, { - .name = "linux", - .offset = 0x070000, - .size = 0x0e0000, - }, { - .name = "rootfs", - .offset = 0x150000, - .size = 0x2a0000, - }, { - .name = "CalibData", - .offset = 0x3f0000, - .size = 0x010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x070000, - .size = 0x380000, - } -}; - -static struct flash_platform_data nbg460n_flash_data = { - .parts = nbg460n_partitions, - .nr_parts = ARRAY_SIZE(nbg460n_partitions), -}; - -static struct gpio_led nbg460n_leds_gpio[] __initdata = { - { - .name = "nbg460n:green:power", - .gpio = NBG460N_GPIO_LED_POWER, - .active_low = 0, - .default_trigger = "default-on", - }, { - .name = "nbg460n:green:wps", - .gpio = NBG460N_GPIO_LED_WPS, - .active_low = 0, - }, { - .name = "nbg460n:green:wlan", - .gpio = NBG460N_GPIO_LED_WLAN, - .active_low = 0, - }, { - /* Not really for controlling the LED, - when set low the LED blinks uncontrollable */ - .name = "nbg460n:green:wan", - .gpio = NBG460N_GPIO_LED_WAN, - .active_low = 0, - } -}; - -static struct gpio_keys_button nbg460n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = NBG460N_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG460N_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = NBG460N_KEYS_DEBOUNCE_INTERVAL, - .gpio = NBG460N_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static struct i2c_gpio_platform_data nbg460n_i2c_device_platdata = { - .sda_pin = NBG460N_GPIO_PCF8563_SDA, - .scl_pin = NBG460N_GPIO_PCF8563_SCK, - .udelay = 10, -}; - -static struct platform_device nbg460n_i2c_device = { - .name = "i2c-gpio", - .id = -1, - .num_resources = 0, - .resource = NULL, - .dev = { - .platform_data = &nbg460n_i2c_device_platdata, - }, -}; - -static struct i2c_board_info nbg460n_i2c_devs[] __initdata = { - { - I2C_BOARD_INFO("pcf8563", 0x51), - }, -}; - -static void nbg460n_i2c_init(void) -{ - /* The gpio interface */ - platform_device_register(&nbg460n_i2c_device); - /* I2C devices */ - i2c_register_board_info(0, nbg460n_i2c_devs, - ARRAY_SIZE(nbg460n_i2c_devs)); -} - - -static struct rtl8366_platform_data nbg460n_rtl8366s_data = { - .gpio_sda = NBG460N_GPIO_RTL8366_SDA, - .gpio_sck = NBG460N_GPIO_RTL8366_SCK, -}; - -static struct platform_device nbg460n_rtl8366s_device = { - .name = RTL8366S_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &nbg460n_rtl8366s_data, - } -}; - -static void __init nbg460n_setup(void) -{ - /* end of bootloader sector contains mac address */ - u8 *mac = (u8 *) KSEG1ADDR(0x1fc0fff8); - /* last sector contains wlan calib data */ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - /* LAN Port */ - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.mii_bus_dev = &nbg460n_rtl8366s_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - - /* WAN Port */ - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - ath79_eth1_data.mii_bus_dev = &nbg460n_rtl8366s_device.dev; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = 0x10; - - ath79_register_eth(0); - ath79_register_eth(1); - - /* register the switch phy */ - platform_device_register(&nbg460n_rtl8366s_device); - - /* register flash */ - ath79_register_m25p80(&nbg460n_flash_data); - - ath79_register_wmac(eeprom, mac); - - /* register RTC chip */ - nbg460n_i2c_init(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(nbg460n_leds_gpio), - nbg460n_leds_gpio); - - ath79_register_gpio_keys_polled(-1, NBG460N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(nbg460n_gpio_keys), - nbg460n_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_NBG460N, "NBG460N", "Zyxel NBG460N/550N/550NH", - nbg460n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om2p.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om2p.c deleted file mode 100644 index c888f7d1a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om2p.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - * OpenMesh OM2P support - * - * Copyright (C) 2011 Marek Lindner - * - * 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-wmac.h" -#include "machtypes.h" - -#define OM2P_GPIO_LED_POWER 0 -#define OM2P_GPIO_LED_GREEN 13 -#define OM2P_GPIO_LED_RED 14 -#define OM2P_GPIO_LED_YELLOW 15 -#define OM2P_GPIO_LED_LAN 16 -#define OM2P_GPIO_LED_WAN 17 -#define OM2P_GPIO_BTN_RESET 1 - -#define OM2P_KEYS_POLL_INTERVAL 20 /* msecs */ -#define OM2P_KEYS_DEBOUNCE_INTERVAL (3 * OM2P_KEYS_POLL_INTERVAL) - -#define OM2P_WAN_PHYMASK BIT(4) - -#define OM2P_LC_GPIO_LED_POWER 1 -#define OM2P_LC_GPIO_LED_GREEN 15 -#define OM2P_LC_GPIO_LED_RED 16 -#define OM2P_LC_GPIO_LED_YELLOW 0 -#define OM2P_LC_GPIO_LED_LAN 13 -#define OM2P_LC_GPIO_LED_WAN 17 -#define OM2P_LC_GPIO_BTN_RESET 12 - -#define OM2Pv4_GPIO_LED_POWER 0 -#define OM2Pv4_GPIO_LED_GREEN 2 -#define OM2Pv4_GPIO_LED_RED 4 -#define OM2Pv4_GPIO_LED_YELLOW 3 -#define OM2Pv4_GPIO_LED_LAN 14 -#define OM2Pv4_GPIO_LED_WAN 13 -#define OM2Pv4_GPIO_BTN_RESET 1 - -#define OM2P_WMAC_CALDATA_OFFSET 0x1000 - -static struct flash_platform_data om2p_flash_data = { - .type = "s25sl12800", - .name = "ar7240-nor0", -}; - -static struct gpio_led om2p_leds_gpio[] __initdata = { - { - .name = "om2p:blue:power", - .gpio = OM2P_GPIO_LED_POWER, - .active_low = 1, - }, { - .name = "om2p:red:wifi", - .gpio = OM2P_GPIO_LED_RED, - .active_low = 1, - }, { - .name = "om2p:yellow:wifi", - .gpio = OM2P_GPIO_LED_YELLOW, - .active_low = 1, - }, { - .name = "om2p:green:wifi", - .gpio = OM2P_GPIO_LED_GREEN, - .active_low = 1, - }, { - .name = "om2p:blue:lan", - .gpio = OM2P_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "om2p:blue:wan", - .gpio = OM2P_GPIO_LED_WAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button om2p_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = OM2P_KEYS_DEBOUNCE_INTERVAL, - .gpio = OM2P_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init om2p_setup(void) -{ - u8 *mac1 = (u8 *)KSEG1ADDR(0x1ffc0000); - u8 *mac2 = (u8 *)KSEG1ADDR(0x1ffc0000 + ETH_ALEN); - u8 *ee = (u8 *)KSEG1ADDR(0x1ffc1000); - - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_m25p80(&om2p_flash_data); - - ath79_register_mdio(0, ~OM2P_WAN_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); - - ath79_register_eth(0); - ath79_register_eth(1); - - ap91_pci_init(ee, NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(om2p_leds_gpio), - om2p_leds_gpio); - - ath79_register_gpio_keys_polled(-1, OM2P_KEYS_POLL_INTERVAL, - ARRAY_SIZE(om2p_gpio_keys), - om2p_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_OM2P, "OM2P", "OpenMesh OM2P", om2p_setup); - - -static struct flash_platform_data om2p_lc_flash_data = { - .type = "s25sl12800", -}; - -static void __init om2p_lc_setup(void) -{ - u8 *mac1 = (u8 *)KSEG1ADDR(0x1ffc0000); - u8 *mac2 = (u8 *)KSEG1ADDR(0x1ffc0000 + ETH_ALEN); - u8 *art = (u8 *)KSEG1ADDR(0x1ffc1000); - u32 t; - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); - t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN; - ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t); - - ath79_register_m25p80(&om2p_lc_flash_data); - - om2p_leds_gpio[0].gpio = OM2P_LC_GPIO_LED_POWER; - om2p_leds_gpio[1].gpio = OM2P_LC_GPIO_LED_RED; - om2p_leds_gpio[2].gpio = OM2P_LC_GPIO_LED_YELLOW; - om2p_leds_gpio[3].gpio = OM2P_LC_GPIO_LED_GREEN; - om2p_leds_gpio[4].gpio = OM2P_LC_GPIO_LED_LAN; - om2p_leds_gpio[5].gpio = OM2P_LC_GPIO_LED_WAN; - ath79_register_leds_gpio(-1, ARRAY_SIZE(om2p_leds_gpio), - om2p_leds_gpio); - - om2p_gpio_keys[0].gpio = OM2P_LC_GPIO_BTN_RESET; - ath79_register_gpio_keys_polled(-1, OM2P_KEYS_POLL_INTERVAL, - ARRAY_SIZE(om2p_gpio_keys), - om2p_gpio_keys); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); - - ath79_register_mdio(0, 0x0); - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(art, NULL); -} - -MIPS_MACHINE(ATH79_MACH_OM2P_LC, "OM2P-LC", "OpenMesh OM2P LC", om2p_lc_setup); -MIPS_MACHINE(ATH79_MACH_OM2Pv2, "OM2Pv2", "OpenMesh OM2Pv2", om2p_lc_setup); - -static void __init om2p_hs_setup(void) -{ - u8 *mac1 = (u8 *)KSEG1ADDR(0x1ffc0000); - u8 *mac2 = (u8 *)KSEG1ADDR(0x1ffc0000 + ETH_ALEN); - u8 *art = (u8 *)KSEG1ADDR(0x1ffc1000); - - /* make lan / wan leds software controllable */ - ath79_gpio_output_select(OM2P_GPIO_LED_LAN, AR934X_GPIO_OUT_GPIO); - ath79_gpio_output_select(OM2P_GPIO_LED_WAN, AR934X_GPIO_OUT_GPIO); - - /* enable reset button */ - ath79_gpio_output_select(OM2P_GPIO_BTN_RESET, AR934X_GPIO_OUT_GPIO); - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - om2p_leds_gpio[4].gpio = OM2P_GPIO_LED_WAN; - om2p_leds_gpio[5].gpio = OM2P_GPIO_LED_LAN; - - ath79_register_m25p80(&om2p_lc_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(om2p_leds_gpio), - om2p_leds_gpio); - ath79_register_gpio_keys_polled(-1, OM2P_KEYS_POLL_INTERVAL, - ARRAY_SIZE(om2p_gpio_keys), - om2p_gpio_keys); - - ath79_register_wmac(art, NULL); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); - - /* GMAC0 is connected to the PHY0 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_OM2P_HS, "OM2P-HS", "OpenMesh OM2P HS", om2p_hs_setup); -MIPS_MACHINE(ATH79_MACH_OM2P_HSv2, "OM2P-HSv2", "OpenMesh OM2P HSv2", om2p_hs_setup); -MIPS_MACHINE(ATH79_MACH_OM2P_HSv3, "OM2P-HSv3", "OpenMesh OM2P HSv3", om2p_hs_setup); - -static struct flash_platform_data om2pv4_flash_data = { - .type = "s25sl12800", -}; - -static struct gpio_led om2pv4_leds_gpio[] __initdata = { - { - .name = "om2p:blue:power", - .gpio = OM2Pv4_GPIO_LED_POWER, - .active_low = 1, - }, { - .name = "om2p:red:wifi", - .gpio = OM2Pv4_GPIO_LED_RED, - .active_low = 1, - }, { - .name = "om2p:yellow:wifi", - .gpio = OM2Pv4_GPIO_LED_YELLOW, - .active_low = 1, - }, { - .name = "om2p:green:wifi", - .gpio = OM2Pv4_GPIO_LED_GREEN, - .active_low = 1, - }, { - .name = "om2p:blue:lan", - .gpio = OM2Pv4_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "om2p:blue:wan", - .gpio = OM2Pv4_GPIO_LED_WAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button om2pv4_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = OM2P_KEYS_DEBOUNCE_INTERVAL, - .gpio = OM2Pv4_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init om2pv4_setup(void) -{ - u8 *mac1 = (u8 *)KSEG1ADDR(0x1ffc0000); - u8 *mac2 = (u8 *)KSEG1ADDR(0x1ffc0000 + ETH_ALEN); - u8 *art = (u8 *)KSEG1ADDR(0x1ffc0000); - u8 wmac[6]; - - ath79_register_m25p80(&om2pv4_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(om2pv4_leds_gpio), - om2pv4_leds_gpio); - ath79_register_gpio_keys_polled(-1, OM2P_KEYS_POLL_INTERVAL, - ARRAY_SIZE(om2pv4_gpio_keys), - om2pv4_gpio_keys); - - ath79_init_mac(wmac, art, 0x02); - ath79_register_wmac(art + OM2P_WMAC_CALDATA_OFFSET, wmac); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); - ath79_register_eth(0); - - /* WAN */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_OM2Pv4, "OM2Pv4", "OpenMesh OM2Pv4", om2pv4_setup); -MIPS_MACHINE(ATH79_MACH_OM2P_HSv4, "OM2P-HSv4", "OpenMesh OM2P HSv4", om2pv4_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-omy-g1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-omy-g1.c deleted file mode 100644 index 25ca27cba..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-omy-g1.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * OMYlink OMY-G1 board support - * - * Copyright (C) 2016 L. D. Pinney - * - * 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-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define OMY_G1_GPIO_LED_WLAN 13 -#define OMY_G1_GPIO_LED_WAN 18 -#define OMY_G1_GPIO_LED_LAN 19 - -#define OMY_G1_GPIO_USB_POWER 4 - -#define OMY_G1_GPIO_BTN_RESET 17 - -#define OMY_G1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define OMY_G1_KEYS_DEBOUNCE_INTERVAL (3 * OMY_G1_KEYS_POLL_INTERVAL) - -static const char *omy_g1_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data omy_g1_flash_data = { - .part_probes = omy_g1_part_probes, -}; - -static struct gpio_led omy_g1_leds_gpio[] __initdata = { - { - .name = "omy:green:wlan", - .gpio = OMY_G1_GPIO_LED_WLAN, - .active_low = 1, - },{ - .name = "omy:green:wan", - .gpio = OMY_G1_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "omy:green:lan", - .gpio = OMY_G1_GPIO_LED_LAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button omy_g1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = OMY_G1_KEYS_DEBOUNCE_INTERVAL, - .gpio = OMY_G1_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init omy_g1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, - AR934X_GPIO_FUNC_CLK_OBS4_EN); - - ath79_register_m25p80(&omy_g1_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(omy_g1_leds_gpio), - omy_g1_leds_gpio); - - ath79_register_gpio_keys_polled(1, OMY_G1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(omy_g1_gpio_keys), - omy_g1_gpio_keys); - - ath79_gpio_output_select(OMY_G1_GPIO_USB_POWER, - AR934X_GPIO_OUT_GPIO); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); - - ath79_gpio_output_select(OMY_G1_GPIO_USB_POWER, - AR934X_GPIO_OUT_GPIO); - - gpio_request_one(OMY_G1_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_OMY_G1, "OMY-G1", "OMYlink OMY-G1", - omy_g1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-omy-x1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-omy-x1.c deleted file mode 100644 index c99e3d745..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-omy-x1.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * OMYlink OMY-X1 board support - * - * Copyright (C) 2016 L. D. Pinney - * - * 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 OMY_X1_GPIO_LED_POWER 19 -#define OMY_X1_GPIO_LED_WAN 22 - -#define OMY_X1_GPIO_BTN_RESET 17 - -#define OMY_X1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define OMY_X1_KEYS_DEBOUNCE_INTERVAL (3 * OMY_X1_KEYS_POLL_INTERVAL) - -static const char *omy_x1_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data omy_x1_flash_data = { - .part_probes = omy_x1_part_probes, -}; - -static struct gpio_led omy_x1_leds_gpio[] __initdata = { - { - .name = "omy:green:wan", - .gpio = OMY_X1_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "omy:green:power", - .gpio = OMY_X1_GPIO_LED_POWER, - .active_low = 1, - }, -}; - -static struct gpio_keys_button omy_x1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = OMY_X1_KEYS_DEBOUNCE_INTERVAL, - .gpio = OMY_X1_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init omy_x1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, - AR934X_GPIO_FUNC_CLK_OBS4_EN); - - ath79_register_m25p80(&omy_x1_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(omy_x1_leds_gpio), - omy_x1_leds_gpio); - - ath79_register_gpio_keys_polled(1, OMY_X1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(omy_x1_gpio_keys), - omy_x1_gpio_keys); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); - -} - -MIPS_MACHINE(ATH79_MACH_OMY_X1, "OMY-X1", "OMYlink OMY-X1", - omy_x1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-onion-omega.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-onion-omega.c deleted file mode 100644 index c73984037..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-onion-omega.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Onion Omega board support - * - * Copyright (C) 2015 Boken Lin - * - * 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 "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 OMEGA_GPIO_LED_SYSTEM 27 -#define OMEGA_GPIO_BTN_RESET 11 - -#define OMEGA_GPIO_USB_POWER 8 - -#define OMEGA_KEYS_POLL_INTERVAL 20 /* msecs */ -#define OMEGA_KEYS_DEBOUNCE_INTERVAL (3 * OMEGA_KEYS_POLL_INTERVAL) - -static const char *omega_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data omega_flash_data = { - .part_probes = omega_part_probes, -}; - -static struct gpio_led omega_leds_gpio[] __initdata = { - { - .name = "onion:amber:system", - .gpio = OMEGA_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button omega_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = OMEGA_KEYS_DEBOUNCE_INTERVAL, - .gpio = OMEGA_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init onion_omega_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&omega_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(omega_leds_gpio), - omega_leds_gpio); - ath79_register_gpio_keys_polled(-1, OMEGA_KEYS_POLL_INTERVAL, - ARRAY_SIZE(omega_gpio_keys), - omega_gpio_keys); - - gpio_request_one(OMEGA_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_ONION_OMEGA, "ONION-OMEGA", "Onion Omega", onion_omega_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-pb42.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-pb42.c deleted file mode 100644 index 3a350e90a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-pb42.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Atheros PB42 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 "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "pci.h" - -#define PB42_KEYS_POLL_INTERVAL 20 /* msecs */ -#define PB42_KEYS_DEBOUNCE_INTERVAL (3 * PB42_KEYS_POLL_INTERVAL) - -#define PB42_GPIO_BTN_SW4 8 -#define PB42_GPIO_BTN_SW5 3 - -static struct gpio_keys_button pb42_gpio_keys[] __initdata = { - { - .desc = "sw4", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = PB42_KEYS_DEBOUNCE_INTERVAL, - .gpio = PB42_GPIO_BTN_SW4, - .active_low = 1, - }, { - .desc = "sw5", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = PB42_KEYS_DEBOUNCE_INTERVAL, - .gpio = PB42_GPIO_BTN_SW5, - .active_low = 1, - } -}; - -static const char *pb42_part_probes[] = { - "RedBoot", - NULL, -}; - -static struct flash_platform_data pb42_flash_data = { - .part_probes = pb42_part_probes, -}; - -#define PB42_WAN_PHYMASK BIT(20) -#define PB42_LAN_PHYMASK (BIT(16) | BIT(17) | BIT(18) | BIT(19)) -#define PB42_MDIO_PHYMASK (PB42_LAN_PHYMASK | PB42_WAN_PHYMASK) - -static void __init pb42_init(void) -{ - ath79_register_m25p80(&pb42_flash_data); - - ath79_register_mdio(0, ~PB42_MDIO_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = PB42_WAN_PHYMASK; - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.speed = SPEED_100; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_gpio_keys_polled(-1, PB42_KEYS_POLL_INTERVAL, - ARRAY_SIZE(pb42_gpio_keys), - pb42_gpio_keys); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_PB42, "PB42", "Atheros PB42", pb42_init); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-pqi-air-pen.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-pqi-air-pen.c deleted file mode 100644 index 56769bfb6..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-pqi-air-pen.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * PQI Air Pen stick support - * - * Copyright (C) 2016 YuheiOKAWA - * - * 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 "common.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 PQI_AIR_PEN_GPIO_LED_WLAN 0 -#define PQI_AIR_PEN_GPIO_LED_WPS 23 - -#define PQI_AIR_PEN_GPIO_BTN_WPS 22 -#define PQI_AIR_PEN_GPIO_BTN_RESET 12 - -#define PQI_AIR_PEN_KEYS_POLL_INTERVAL 20 /* msecs */ -#define PQI_AIR_PEN_KEYS_DEBOUNCE_INTERVAL (3 * PQI_AIR_PEN_KEYS_POLL_INTERVAL) - -#define PQI_AIR_PEN_WMAC_CALDATA_OFFSET 0x1000 -#define PQI_AIR_PEN_LAN_MAC_OFFSET 0x1002 -#define PQI_AIR_PEN_WMAC_MAC_OFFSET 0x1002 - -static struct gpio_led pqi_air_pen_leds_gpio[] __initdata = { - { - .name = "pqi-air-pen:blue:wlan", - .gpio = PQI_AIR_PEN_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "pqi-air-pen:blue:wps", - .gpio = PQI_AIR_PEN_GPIO_LED_WPS, - .active_low = 0, - }, -}; - -static struct gpio_keys_button pqi_air_pen_gpio_keys[] __initdata = { - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = PQI_AIR_PEN_KEYS_DEBOUNCE_INTERVAL, - .gpio = PQI_AIR_PEN_GPIO_BTN_WPS, - .active_low = 0, - }, - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = PQI_AIR_PEN_KEYS_DEBOUNCE_INTERVAL, - .gpio = PQI_AIR_PEN_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static void __init pqi_air_pen_setup(void) -{ - /* ART base address */ - u8 *art = (u8 *) KSEG1ADDR(0x9f050000); - - /* register flash. */ - ath79_register_m25p80(NULL); - - /* register wireless mac with cal data */ - ath79_register_wmac(art + PQI_AIR_PEN_WMAC_CALDATA_OFFSET, art + PQI_AIR_PEN_WMAC_MAC_OFFSET); - - /* false PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - /* register gpio LEDs and keys */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(pqi_air_pen_leds_gpio), - pqi_air_pen_leds_gpio); - ath79_register_gpio_keys_polled(-1, PQI_AIR_PEN_KEYS_POLL_INTERVAL, - ARRAY_SIZE(pqi_air_pen_gpio_keys), - pqi_air_pen_gpio_keys); - - /* enable usb */ - ath79_register_usb(); - - /* register eth0 as LAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, art + PQI_AIR_PEN_LAN_MAC_OFFSET, 0); - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_PQI_AIR_PEN, "PQI-AIR-PEN", "PQI Air Pen",pqi_air_pen_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-qihoo-c301.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-qihoo-c301.c deleted file mode 100644 index a682f35e2..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-qihoo-c301.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Qihoo 360 C301 board support - * - * Copyright (C) 2013 Gabor Juhos - * Copyright (C) 2014 Weijie Gao - * - * 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 "pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "nvram.h" - -#define QIHOO_C301_GPIO_LED_STATUS_GREEN 0 -#define QIHOO_C301_GPIO_LED_STATUS_RED 11 - -#define QIHOO_C301_GPIO_LED_WAN 1 -#define QIHOO_C301_GPIO_LED_LAN1 2 -#define QIHOO_C301_GPIO_LED_LAN2 3 -#define QIHOO_C301_GPIO_ETH_LEN_EN 18 - -#define QIHOO_C301_GPIO_BTN_RESET 16 - -#define QIHOO_C301_GPIO_USB_POWER 19 - -#define QIHOO_C301_GPIO_SPI_CS1 12 - -#define QIHOO_C301_GPIO_EXTERNAL_LNA0 14 -#define QIHOO_C301_GPIO_EXTERNAL_LNA1 15 - -#define QIHOO_C301_KEYS_POLL_INTERVAL 20 /* msecs */ -#define QIHOO_C301_KEYS_DEBOUNCE_INTERVAL \ - (3 * QIHOO_C301_KEYS_POLL_INTERVAL) - -#define QIHOO_C301_WMAC_CALDATA_OFFSET 0x1000 - -#define QIHOO_C301_NVRAM_ADDR 0x1f058010 -#define QIHOO_C301_NVRAM_SIZE 0x7ff0 - -static struct gpio_led qihoo_c301_leds_gpio[] __initdata = { - { - .name = "qihoo:green:status", - .gpio = QIHOO_C301_GPIO_LED_STATUS_GREEN, - .active_low = 1, - }, - { - .name = "qihoo:red:status", - .gpio = QIHOO_C301_GPIO_LED_STATUS_RED, - .active_low = 1, - }, -}; - -static struct gpio_keys_button qihoo_c301_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = QIHOO_C301_KEYS_DEBOUNCE_INTERVAL, - .gpio = QIHOO_C301_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct flash_platform_data flash __initdata = {NULL, NULL, 0}; - -static void qihoo_c301_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(QIHOO_C301_NVRAM_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, QIHOO_C301_NVRAM_SIZE, - name, mac); - if (err) - pr_err("no MAC address found for %s\n", name); -} - -static void __init qihoo_c301_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80_multi(&flash); - - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_gpio_output_select(QIHOO_C301_GPIO_LED_WAN, - AR934X_GPIO_OUT_LED_LINK4); - ath79_gpio_output_select(QIHOO_C301_GPIO_LED_LAN1, - AR934X_GPIO_OUT_LED_LINK1); - ath79_gpio_output_select(QIHOO_C301_GPIO_LED_LAN2, - AR934X_GPIO_OUT_LED_LINK2); - - ath79_gpio_output_select(QIHOO_C301_GPIO_SPI_CS1, - AR934X_GPIO_OUT_SPI_CS1); - - gpio_request_one(QIHOO_C301_GPIO_ETH_LEN_EN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "Ethernet LED enable"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(qihoo_c301_leds_gpio), - qihoo_c301_leds_gpio); - - ath79_register_gpio_keys_polled(-1, QIHOO_C301_KEYS_POLL_INTERVAL, - ARRAY_SIZE(qihoo_c301_gpio_keys), - qihoo_c301_gpio_keys); - - ath79_wmac_set_ext_lna_gpio(0, QIHOO_C301_GPIO_EXTERNAL_LNA0); - ath79_wmac_set_ext_lna_gpio(1, QIHOO_C301_GPIO_EXTERNAL_LNA1); - - qihoo_c301_get_mac("wlan24mac=", tmpmac); - ath79_register_wmac(art + QIHOO_C301_WMAC_CALDATA_OFFSET, tmpmac); - - ath79_register_pci(); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE | - AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - /* LAN */ - qihoo_c301_get_mac("lanmac=", ath79_eth1_data.mac_addr); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - - ath79_register_eth(1); - - /* WAN */ - qihoo_c301_get_mac("wanmac=", ath79_eth0_data.mac_addr); - - /* GMAC0 is connected to the PHY4 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - - ath79_register_eth(0); - - gpio_request_one(QIHOO_C301_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_QIHOO_C301, "QIHOO-C301", "Qihoo 360 C301", - qihoo_c301_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r36a.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r36a.c deleted file mode 100644 index b3493e2c4..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r36a.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * ALFA Network R36A board support - * - * Copyright (C) 2018 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 "common.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 R36A_GPIO_LED_LAN 4 -#define R36A_GPIO_LED_STATUS 14 -#define R36A_GPIO_LED_USB 12 -#define R36A_GPIO_LED_WAN 16 -#define R36A_GPIO_LED_WLAN 15 - -#define R36A_GPIO_WDT_EN 1 -#define R36A_GPIO_WDT_IN 0 -#define R36A_GPIO_USB_PWR 3 - -#define R36A_GPIO_BTN_RESET 2 -#define R36A_GPIO_BTN_RFKILL 17 - -#define R36A_KEYS_POLL_INTERVAL 20 -#define R36A_KEYS_DEBOUNCE_INTERVAL (3 * R36A_KEYS_POLL_INTERVAL) - -#define R36A_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led r36a_leds_gpio[] __initdata = { - { - .name = "r36a:blue:lan", - .gpio = R36A_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "r36a:blue:status", - .gpio = R36A_GPIO_LED_STATUS, - .active_low = 1, - }, { - .name = "r36a:blue:usb", - .gpio = R36A_GPIO_LED_USB, - .active_low = 1, - }, { - .name = "r36a:blue:wan", - .gpio = R36A_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "r36a:blue:wlan", - .gpio = R36A_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button r36a_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = R36A_KEYS_DEBOUNCE_INTERVAL, - .gpio = R36A_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "rfkill", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = R36A_KEYS_DEBOUNCE_INTERVAL, - .gpio = R36A_GPIO_BTN_RFKILL, - .active_low = 1, - }, -}; - -static void __init r36a_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f070000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = 0xf7; - - /* LAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); - ath79_register_eth(0); - - /* WAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_init_mac(ath79_eth1_data.mac_addr, art, 1); - ath79_register_eth(1); - - /* Disable JTAG (enables GPIO0-3) */ - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(r36a_leds_gpio), - r36a_leds_gpio); - - ath79_register_gpio_keys_polled(-1, R36A_KEYS_POLL_INTERVAL, - ARRAY_SIZE(r36a_gpio_keys), - r36a_gpio_keys); - - gpio_request_one(R36A_GPIO_WDT_IN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "WDT input"); - - gpio_request_one(R36A_GPIO_WDT_EN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "WDT enable"); - - gpio_request_one(R36A_GPIO_USB_PWR, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - ath79_register_wmac(art + R36A_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_R36A, "R36A", "ALFA Network R36A", r36a_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r602n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r602n.c deleted file mode 100644 index 4aef0a932..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r602n.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * P&W (Shenzhen Progress&Win Technologies) R602N and CPE505N boards support - * - * Copyright (C) 2017 Piotr Dymacz - * - * Based on mach-zbt-we1526.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 "common.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 PW_GPIO_BTN_RESET 17 - -#define PW_KEYS_POLL_INTERVAL 20 /* msecs */ -#define PW_KEYS_DEBOUNCE_INTERVAL (3 * PW_KEYS_POLL_INTERVAL) - -#define PW_MAC0_OFFSET 0x0 -#define PW_MAC1_OFFSET 0x6 -#define PW_WMAC_CALDATA_OFFSET 0x1000 - -/* CPE505N GPIO LEDs */ -#define CPE505N_GPIO_LED_DIAG 12 -#define CPE505N_GPIO_LED_LAN 11 -#define CPE505N_GPIO_LED_STATUS 14 -#define CPE505N_GPIO_LED_WAN 4 -#define CPE505N_GPIO_LED_WLAN 15 - -static struct gpio_led cpe505n_leds_gpio[] __initdata = { - { - .name = "cpe505n:red:diag", - .gpio = CPE505N_GPIO_LED_DIAG, - .active_low = 1, - }, { - .name = "cpe505n:green:lan", - .gpio = CPE505N_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "cpe505n:green:status", - .gpio = CPE505N_GPIO_LED_STATUS, - .active_low = 1, - }, { - .name = "cpe505n:green:wan", - .gpio = CPE505N_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "cpe505n:blue:wlan", - .gpio = CPE505N_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static void __init cpe505n_gpio_setup(void) -{ - /* For LED on GPIO4 */ - ath79_gpio_function_disable(AR934X_GPIO_FUNC_CLK_OBS4_EN); - ath79_gpio_output_select(CPE505N_GPIO_LED_WAN, 0); - - ath79_gpio_direction_select(CPE505N_GPIO_LED_DIAG, true); - ath79_gpio_direction_select(CPE505N_GPIO_LED_LAN, true); - ath79_gpio_direction_select(CPE505N_GPIO_LED_STATUS, true); - ath79_gpio_direction_select(CPE505N_GPIO_LED_WAN, true); - ath79_gpio_direction_select(CPE505N_GPIO_LED_WLAN, true); - - /* Mute LEDs */ - gpio_set_value(CPE505N_GPIO_LED_DIAG, 1); - gpio_set_value(CPE505N_GPIO_LED_LAN, 1); - gpio_set_value(CPE505N_GPIO_LED_STATUS, 1); - gpio_set_value(CPE505N_GPIO_LED_WAN, 1); - gpio_set_value(CPE505N_GPIO_LED_WLAN, 1); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe505n_leds_gpio), - cpe505n_leds_gpio); -} - -/* R602N GPIO LEDs */ -#define R602N_GPIO_LED_LAN1 16 -#define R602N_GPIO_LED_LAN2 15 -#define R602N_GPIO_LED_LAN3 14 -#define R602N_GPIO_LED_LAN4 11 -#define R602N_GPIO_LED_WAN 4 -#define R602N_GPIO_LED_WLAN 12 - -static struct gpio_led r602n_leds_gpio[] __initdata = { - { - .name = "r602n:green:lan1", - .gpio = R602N_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "r602n:green:lan2", - .gpio = R602N_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "r602n:green:lan3", - .gpio = R602N_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "r602n:green:lan4", - .gpio = R602N_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "r602n:green:wan", - .gpio = R602N_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "r602n:green:wlan", - .gpio = R602N_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static void __init r602n_gpio_setup(void) -{ - /* For LED on GPIO4 */ - ath79_gpio_function_disable(AR934X_GPIO_FUNC_CLK_OBS4_EN); - ath79_gpio_output_select(R602N_GPIO_LED_WAN, 0); - - ath79_gpio_direction_select(R602N_GPIO_LED_LAN1, true); - ath79_gpio_direction_select(R602N_GPIO_LED_LAN2, true); - ath79_gpio_direction_select(R602N_GPIO_LED_LAN3, true); - ath79_gpio_direction_select(R602N_GPIO_LED_LAN4, true); - ath79_gpio_direction_select(R602N_GPIO_LED_WAN, true); - ath79_gpio_direction_select(R602N_GPIO_LED_WLAN, true); - - /* Mute LEDs */ - gpio_set_value(R602N_GPIO_LED_LAN1, 1); - gpio_set_value(R602N_GPIO_LED_LAN2, 1); - gpio_set_value(R602N_GPIO_LED_LAN3, 1); - gpio_set_value(R602N_GPIO_LED_LAN4, 1); - gpio_set_value(R602N_GPIO_LED_WAN, 1); - gpio_set_value(R602N_GPIO_LED_WLAN, 1); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(r602n_leds_gpio), - r602n_leds_gpio); -} - -static struct gpio_keys_button pw_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = PW_KEYS_DEBOUNCE_INTERVAL, - .gpio = PW_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init r602n_cpe505n_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, art + PW_MAC1_OFFSET, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, art + PW_MAC0_OFFSET, 0); - ath79_register_eth(0); - - ath79_register_wmac(art + PW_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_gpio_keys_polled(-1, PW_KEYS_POLL_INTERVAL, - ARRAY_SIZE(pw_gpio_keys), - pw_gpio_keys); -} - -static void __init cpe505n_setup(void) -{ - r602n_cpe505n_setup(); - - cpe505n_gpio_setup(); -} - -static void __init r602n_setup(void) -{ - r602n_cpe505n_setup(); - - r602n_gpio_setup(); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_CPE505N, "CPE505N", "P&W CPE505N", cpe505n_setup); -MIPS_MACHINE(ATH79_MACH_R602N, "R602N", "P&W R602N", r602n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r6100.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r6100.c deleted file mode 100644 index c1f0e2c40..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-r6100.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * NETGEAR R6100 board support - * - * Copyright (C) 2014 Gabor Juhos - * Copyright (C) 2014 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 "common.h" -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define R6100_GPIO_LED_WLAN 0 -#define R6100_GPIO_LED_USB 11 -#define R6100_GPIO_LED_WAN_GREEN 13 -#define R6100_GPIO_LED_POWER_AMBER 14 -#define R6100_GPIO_LED_WAN_AMBER 15 -#define R6100_GPIO_LED_POWER_GREEN 17 - -#define R6100_GPIO_BTN_WIRELESS 1 -#define R6100_GPIO_BTN_WPS 3 -#define R6100_GPIO_BTN_RESET 12 - -#define R6100_GPIO_USB_POWER 16 - -#define R6100_KEYS_POLL_INTERVAL 20 /* msecs */ -#define R6100_KEYS_DEBOUNCE_INTERVAL (3 * R6100_KEYS_POLL_INTERVAL) - -static struct gpio_led r6100_leds_gpio[] __initdata = { - { - .name = "netgear:green:power", - .gpio = R6100_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, - { - .name = "netgear:amber:power", - .gpio = R6100_GPIO_LED_POWER_AMBER, - .active_low = 1, - }, - { - .name = "netgear:green:wan", - .gpio = R6100_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, - { - .name = "netgear:amber:wan", - .gpio = R6100_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, - { - .name = "netgear:blue:usb", - .gpio = R6100_GPIO_LED_USB, - .active_low = 1, - }, - { - .name = "netgear:blue:wlan", - .gpio = R6100_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button r6100_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL, - .gpio = R6100_GPIO_BTN_RESET, - .active_low = 0, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL, - .gpio = R6100_GPIO_BTN_WPS, - .active_low = 0, - }, - { - .desc = "RFKILL switch", - .type = EV_SW, - .code = KEY_RFKILL, - .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL, - .gpio = R6100_GPIO_BTN_WIRELESS, - .active_low = 0, - }, -}; - -static void __init r6100_setup(void) -{ - ath79_register_leds_gpio(-1, ARRAY_SIZE(r6100_leds_gpio), - r6100_leds_gpio); - ath79_register_gpio_keys_polled(-1, R6100_KEYS_POLL_INTERVAL, - ARRAY_SIZE(r6100_gpio_keys), - r6100_gpio_keys); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - /* GMAC0 is connected to the PHY0 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - gpio_request_one(R6100_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW); - ath79_register_nfc(); - - ath79_register_usb(); - - ath79_register_wmac_simple(); - - ap91_pci_init_simple(); -} - -MIPS_MACHINE(ATH79_MACH_R6100, "R6100", "NETGEAR R6100", - r6100_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb4xx.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb4xx.c deleted file mode 100644 index 722993ff9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb4xx.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * MikroTik RouterBOARD 4xx series 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 -#include - -#include "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "pci.h" - -#define RB4XX_GPIO_USER_LED 4 -#define RB4XX_GPIO_RESET_SWITCH 7 - -#define RB4XX_GPIO_CPLD_BASE 32 -#define RB4XX_GPIO_CPLD_LED1 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED1) -#define RB4XX_GPIO_CPLD_LED2 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED2) -#define RB4XX_GPIO_CPLD_LED3 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED3) -#define RB4XX_GPIO_CPLD_LED4 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED4) -#define RB4XX_GPIO_CPLD_LED5 (RB4XX_GPIO_CPLD_BASE + CPLD_GPIO_nLED5) - -#define RB4XX_KEYS_POLL_INTERVAL 20 /* msecs */ -#define RB4XX_KEYS_DEBOUNCE_INTERVAL (3 * RB4XX_KEYS_POLL_INTERVAL) - -static struct gpio_led rb4xx_leds_gpio[] __initdata = { - { - .name = "rb4xx:yellow:user", - .gpio = RB4XX_GPIO_USER_LED, - .active_low = 0, - }, { - .name = "rb4xx:green:led1", - .gpio = RB4XX_GPIO_CPLD_LED1, - .active_low = 1, - }, { - .name = "rb4xx:green:led2", - .gpio = RB4XX_GPIO_CPLD_LED2, - .active_low = 1, - }, { - .name = "rb4xx:green:led3", - .gpio = RB4XX_GPIO_CPLD_LED3, - .active_low = 1, - }, { - .name = "rb4xx:green:led4", - .gpio = RB4XX_GPIO_CPLD_LED4, - .active_low = 1, - }, { - .name = "rb4xx:green:led5", - .gpio = RB4XX_GPIO_CPLD_LED5, - .active_low = 0, - }, -}; - -static struct gpio_keys_button rb4xx_gpio_keys[] __initdata = { - { - .desc = "reset_switch", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = RB4XX_KEYS_DEBOUNCE_INTERVAL, - .gpio = RB4XX_GPIO_RESET_SWITCH, - .active_low = 1, - } -}; - -static struct platform_device rb4xx_nand_device = { - .name = "rb4xx-nand", - .id = -1, -}; - -static struct ath79_pci_irq rb4xx_pci_irqs[] __initdata = { - { - .slot = 17, - .pin = 1, - .irq = ATH79_PCI_IRQ(2), - }, { - .slot = 18, - .pin = 1, - .irq = ATH79_PCI_IRQ(0), - }, { - .slot = 18, - .pin = 2, - .irq = ATH79_PCI_IRQ(1), - }, { - .slot = 19, - .pin = 1, - .irq = ATH79_PCI_IRQ(1), - }, { - .slot = 19, - .pin = 2, - .irq = ATH79_PCI_IRQ(2), - }, { - .slot = 20, - .pin = 1, - .irq = ATH79_PCI_IRQ(2), - }, { - .slot = 20, - .pin = 2, - .irq = ATH79_PCI_IRQ(0), - }, { - .slot = 21, - .pin = 1, - .irq = ATH79_PCI_IRQ(0), - }, { - .slot = 22, - .pin = 1, - .irq = ATH79_PCI_IRQ(1), - }, { - .slot = 22, - .pin = 2, - .irq = ATH79_PCI_IRQ(2), - }, { - .slot = 23, - .pin = 1, - .irq = ATH79_PCI_IRQ(2), - }, { - .slot = 23, - .pin = 2, - .irq = ATH79_PCI_IRQ(0), - } -}; - -static struct mtd_partition rb4xx_partitions[] = { - { - .name = "routerboot", - .offset = 0, - .size = 0x0b000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "hard_config", - .offset = 0x0b000, - .size = 0x01000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "bios", - .offset = 0x0d000, - .size = 0x02000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "soft_config", - .offset = 0x0f000, - .size = 0x01000, - } -}; - -static struct flash_platform_data rb4xx_flash_data = { - .type = "pm25lv512", - .parts = rb4xx_partitions, - .nr_parts = ARRAY_SIZE(rb4xx_partitions), -}; - -static struct rb4xx_cpld_platform_data rb4xx_cpld_data = { - .gpio_base = RB4XX_GPIO_CPLD_BASE, -}; - -static struct mmc_spi_platform_data rb4xx_mmc_data = { - .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, -}; - -static struct spi_board_info rb4xx_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = &rb4xx_flash_data, - }, { - .bus_num = 0, - .chip_select = 1, - .max_speed_hz = 25000000, - .modalias = "spi-rb4xx-cpld", - .platform_data = &rb4xx_cpld_data, - } -}; - -static struct spi_board_info rb4xx_microsd_info[] = { - { - .bus_num = 0, - .chip_select = 2, - .max_speed_hz = 25000000, - .modalias = "mmc_spi", - .platform_data = &rb4xx_mmc_data, - } -}; - - -static struct resource rb4xx_spi_resources[] = { - { - .start = AR71XX_SPI_BASE, - .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device rb4xx_spi_device = { - .name = "rb4xx-spi", - .id = -1, - .resource = rb4xx_spi_resources, - .num_resources = ARRAY_SIZE(rb4xx_spi_resources), -}; - -static void __init rb4xx_generic_setup(void) -{ - ath79_gpio_function_enable(AR71XX_GPIO_FUNC_SPI_CS1_EN | - AR71XX_GPIO_FUNC_SPI_CS2_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio), - rb4xx_leds_gpio); - - ath79_register_gpio_keys_polled(-1, RB4XX_KEYS_POLL_INTERVAL, - ARRAY_SIZE(rb4xx_gpio_keys), - rb4xx_gpio_keys); - - spi_register_board_info(rb4xx_spi_info, ARRAY_SIZE(rb4xx_spi_info)); - platform_device_register(&rb4xx_spi_device); - platform_device_register(&rb4xx_nand_device); -} - -static void __init rb411_setup(void) -{ - rb4xx_generic_setup(); - spi_register_board_info(rb4xx_microsd_info, - ARRAY_SIZE(rb4xx_microsd_info)); - - ath79_register_mdio(0, 0xfffffffc); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = 0x00000003; - - ath79_register_eth(0); - - ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_RB_411, "411", "MikroTik RouterBOARD 411/A/AH", - rb411_setup); - -static void __init rb411u_setup(void) -{ - rb411_setup(); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_RB_411U, "411U", "MikroTik RouterBOARD 411U", - rb411u_setup); - -#define RB433_LAN_PHYMASK BIT(0) -#define RB433_WAN_PHYMASK BIT(4) -#define RB433_MDIO_PHYMASK (RB433_LAN_PHYMASK | RB433_WAN_PHYMASK) - -static void __init rb433_setup(void) -{ - rb4xx_generic_setup(); - spi_register_board_info(rb4xx_microsd_info, - ARRAY_SIZE(rb4xx_microsd_info)); - - ath79_register_mdio(0, ~RB433_MDIO_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 1); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = RB433_LAN_PHYMASK; - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.phy_mask = RB433_WAN_PHYMASK; - - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_RB_433, "433", "MikroTik RouterBOARD 433/AH", - rb433_setup); - -static void __init rb433u_setup(void) -{ - rb433_setup(); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_RB_433U, "433U", "MikroTik RouterBOARD 433UAH", - rb433u_setup); - -static void __init rb435g_setup(void) -{ - rb4xx_generic_setup(); - - spi_register_board_info(rb4xx_microsd_info, - ARRAY_SIZE(rb4xx_microsd_info)); - - ath79_register_mdio(0, ~RB433_MDIO_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 1); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = RB433_LAN_PHYMASK; - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = RB433_WAN_PHYMASK; - - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs); - ath79_register_pci(); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_RB_435G, "435G", "MikroTik RouterBOARD 435G", - rb435g_setup); - -#define RB450_LAN_PHYMASK BIT(0) -#define RB450_WAN_PHYMASK BIT(4) -#define RB450_MDIO_PHYMASK (RB450_LAN_PHYMASK | RB450_WAN_PHYMASK) - -static void __init rb450_generic_setup(int gige) -{ - rb4xx_generic_setup(); - ath79_register_mdio(0, ~RB450_MDIO_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 1); - ath79_eth0_data.phy_if_mode = (gige) ? - PHY_INTERFACE_MODE_RGMII : PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = RB450_LAN_PHYMASK; - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0); - ath79_eth1_data.phy_if_mode = (gige) ? - PHY_INTERFACE_MODE_RGMII : PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.phy_mask = RB450_WAN_PHYMASK; - - ath79_register_eth(1); - ath79_register_eth(0); -} - -static void __init rb450_setup(void) -{ - rb450_generic_setup(0); -} - -MIPS_MACHINE(ATH79_MACH_RB_450, "450", "MikroTik RouterBOARD 450", - rb450_setup); - -static void __init rb450g_setup(void) -{ - rb450_generic_setup(1); - spi_register_board_info(rb4xx_microsd_info, - ARRAY_SIZE(rb4xx_microsd_info)); -} - -MIPS_MACHINE(ATH79_MACH_RB_450G, "450G", "MikroTik RouterBOARD 450G", - rb450g_setup); - -static void __init rb493_setup(void) -{ - rb4xx_generic_setup(); - - ath79_register_mdio(0, 0x3fffff00); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.phy_mask = 0x00000001; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_RB_493, "493", "MikroTik RouterBOARD 493/AH", - rb493_setup); - -#define RB493G_GPIO_MDIO_MDC 7 -#define RB493G_GPIO_MDIO_DATA 8 - -#define RB493G_MDIO_PHYMASK BIT(0) - -static struct mdio_gpio_platform_data rb493g_mdio_data = { - .mdc = RB493G_GPIO_MDIO_MDC, - .mdio = RB493G_GPIO_MDIO_DATA, - - .phy_mask = ~RB493G_MDIO_PHYMASK, -}; - -static struct platform_device rb493g_mdio_device = { - .name = "mdio-gpio", - .id = -1, - .dev = { - .platform_data = &rb493g_mdio_data, - }, -}; - -static void __init rb493g_setup(void) -{ - ath79_gpio_function_enable(AR71XX_GPIO_FUNC_SPI_CS1_EN | - AR71XX_GPIO_FUNC_SPI_CS2_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio), - rb4xx_leds_gpio); - - spi_register_board_info(rb4xx_spi_info, ARRAY_SIZE(rb4xx_spi_info)); - spi_register_board_info(rb4xx_microsd_info, - ARRAY_SIZE(rb4xx_microsd_info)); - - platform_device_register(&rb4xx_spi_device); - platform_device_register(&rb4xx_nand_device); - - ath79_register_mdio(0, ~RB493G_MDIO_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = RB493G_MDIO_PHYMASK; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.mii_bus_dev = &rb493g_mdio_device.dev; - ath79_eth1_data.phy_mask = RB493G_MDIO_PHYMASK; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - platform_device_register(&rb493g_mdio_device); - - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_register_usb(); - - ath79_pci_set_irq_map(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_RB_493G, "493G", "MikroTik RouterBOARD 493G", - rb493g_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rbsxtlite.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rbsxtlite.c deleted file mode 100644 index d2edfc9c7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rbsxtlite.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * MikroTik RouterBOARD SXT Lite support - * - * Copyright (C) 2012 Stijn Tintel - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2013 Vyacheslav Adamanov - * - * 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) "sxtlite: " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "common.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-wmac.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "routerboot.h" -#include - -#define SXTLITE_GPIO_NAND_NCE 14 -#define SXTLITE_GPIO_LED_USER 3 -#define SXTLITE_GPIO_LED_1 13 -#define SXTLITE_GPIO_LED_2 12 -#define SXTLITE_GPIO_LED_3 4 -#define SXTLITE_GPIO_LED_4 21 -#define SXTLITE_GPIO_LED_5 18 -#define SXTLITE_GPIO_LED_POWER 11 - -#define SXTLITE_GPIO_BUZZER 19 - -#define SXTLITE_GPIO_BTN_RESET 15 - -#define SXTLITE_KEYS_POLL_INTERVAL 20 -#define SXTLITE_KEYS_DEBOUNCE_INTERVAL (3 * SXTLITE_KEYS_POLL_INTERVAL) - -static struct mtd_partition rbsxtlite_nand_partitions[] = { - { - .name = "booter", - .offset = 0, - .size = (256 * 1024), - .mask_flags = MTD_WRITEABLE, - }, - { - .name = "kernel", - .offset = (256 * 1024), - .size = (4 * 1024 * 1024) - (256 * 1024), - }, - { - .name = "ubi", - .offset = MTDPART_OFS_NXTBLK, - .size = MTDPART_SIZ_FULL, - }, -}; - -static struct gpio_led rbsxtlite_leds_gpio[] __initdata = { - { - .name = "rb:green:user", - .gpio = SXTLITE_GPIO_LED_USER, - .active_low = 1, - }, - { - .name = "rb:green:led1", - .gpio = SXTLITE_GPIO_LED_1, - .active_low = 1, - }, - { - .name = "rb:green:led2", - .gpio = SXTLITE_GPIO_LED_2, - .active_low = 1, - }, - { - .name = "rb:green:led3", - .gpio = SXTLITE_GPIO_LED_3, - .active_low = 1, - }, - { - .name = "rb:green:led4", - .gpio = SXTLITE_GPIO_LED_4, - .active_low = 1, - }, - { - .name = "rb:green:led5", - .gpio = SXTLITE_GPIO_LED_5, - .active_low = 1, - }, - { - .name = "rb:green:power", - .gpio = SXTLITE_GPIO_LED_POWER, - .default_state = LEDS_GPIO_DEFSTATE_KEEP, - }, -}; - -static struct gpio_keys_button rbsxtlite_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = SXTLITE_KEYS_DEBOUNCE_INTERVAL, - .gpio = SXTLITE_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static int __init rbsxtlite_rbinfo_init(void) -{ - const struct rb_info *info; - - info = rb_init_info((void *)(KSEG1ADDR(AR71XX_SPI_BASE)), 0x10000); - if (!info) - return -EINVAL; - return 0; - -} - -void __init rbsxtlite_wlan_init(void) -{ - char *art_buf; - u8 wlan_mac[ETH_ALEN]; - - art_buf = rb_get_wlan_data(); - if (art_buf == NULL) - return; - - ath79_init_mac(wlan_mac, ath79_mac_base, 1); - ath79_register_wmac(art_buf + 0x1000, wlan_mac); - - kfree(art_buf); -} - -static void rbsxtlite_nand_select_chip(int chip_no) -{ - switch (chip_no) { - case 0: - gpio_set_value(SXTLITE_GPIO_NAND_NCE, 0); - break; - default: - gpio_set_value(SXTLITE_GPIO_NAND_NCE, 1); - break; - } - ndelay(500); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) -static struct nand_ecclayout rbsxtlite_nand_ecclayout = { - .eccbytes = 6, - .eccpos = { 8, 9, 10, 13, 14, 15 }, - .oobavail = 9, - .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } -}; - -#else - -static int rbsxtlite_ooblayout_ecc(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 8; - oobregion->length = 3; - return 0; - case 1: - oobregion->offset = 13; - oobregion->length = 3; - return 0; - default: - return -ERANGE; - } -} - -static int rbsxtlite_ooblayout_free(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobregion) -{ - switch (section) { - case 0: - oobregion->offset = 0; - oobregion->length = 4; - return 0; - case 1: - oobregion->offset = 4; - oobregion->length = 1; - return 0; - case 2: - oobregion->offset = 6; - oobregion->length = 2; - return 0; - case 3: - oobregion->offset = 11; - oobregion->length = 2; - return 0; - default: - return -ERANGE; - } -} - -static const struct mtd_ooblayout_ops rbsxtlite_nand_ecclayout_ops = { - .ecc = rbsxtlite_ooblayout_ecc, - .free = rbsxtlite_ooblayout_free, -}; -#endif /* < 4.6 */ - -static int rbsxtlite_nand_scan_fixup(struct mtd_info *mtd) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - struct nand_chip *chip = mtd->priv; -#endif - - if (mtd->writesize == 512) { - /* - * Use the OLD Yaffs-1 OOB layout, otherwise RouterBoot - * will not be able to find the kernel that we load. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - chip->ecc.layout = &rbsxtlite_nand_ecclayout; -#else - mtd_set_ooblayout(mtd, &rbsxtlite_nand_ecclayout_ops); -#endif - } - - return 0; -} - -void __init rbsxtlite_gpio_init(void) -{ - gpio_request_one(SXTLITE_GPIO_NAND_NCE, GPIOF_OUT_INIT_HIGH, "NAND nCE"); -} - -void __init rbsxtlite_nand_init(void) -{ - ath79_nfc_set_scan_fixup(rbsxtlite_nand_scan_fixup); - ath79_nfc_set_parts(rbsxtlite_nand_partitions, - ARRAY_SIZE(rbsxtlite_nand_partitions)); - ath79_nfc_set_select_chip(rbsxtlite_nand_select_chip); - ath79_nfc_set_swap_dma(true); - ath79_register_nfc(); -} - - -static void __init rbsxtlite_setup(void) -{ - if(rbsxtlite_rbinfo_init()) - return; - rbsxtlite_nand_init(); - rbsxtlite_wlan_init(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rbsxtlite_leds_gpio), - rbsxtlite_leds_gpio); - ath79_register_gpio_keys_polled(-1, SXTLITE_KEYS_POLL_INTERVAL, - ARRAY_SIZE(rbsxtlite_gpio_keys), - rbsxtlite_gpio_keys); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - - /* GMAC0 is left unused */ - - /* GMAC1 is connected to MAC0 on the internal switch */ - /* The ethernet port connects to PHY P0, which connects to MAC1 - on the internal switch */ - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - -} - - -MIPS_MACHINE(ATH79_MACH_RB_SXTLITE2ND, "sxt2n", "MikroTik RouterBOARD SXT Lite2", - rbsxtlite_setup); - -MIPS_MACHINE(ATH79_MACH_RB_SXTLITE5ND, "sxt5n", "MikroTik RouterBOARD SXT Lite5", - rbsxtlite_setup); - diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-re450.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-re450.c deleted file mode 100644 index 991aa1c9a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-re450.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * TP-LINK RE355/RE450 board support - * - * Copyright (c) 2013 Gabor Juhos - * Copyright (c) 2016 Tal Keren - * Copyright (c) 2018 Henryk Heisig - * - * 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 re355_leds_gpio[] __initdata = { - { - .name = "re355:blue:power", - .gpio = RE450_GPIO_LED_SYSTEM, - .active_low = 1, - }, - { - .name = "re355:blue:wlan2g", - .gpio = RE450_GPIO_LED_WLAN2G, - .active_low = 1, - }, - { - .name = "re355:blue:wlan5g", - .gpio = RE450_GPIO_LED_WLAN5G, - .active_low = 1, - }, - { - .name = "re355:blue:wps", - .gpio = RE450_GPIO_LED_JUMPSTART, - }, - { - .name = "re355:red:wps", - .gpio = RE450_GPIO_LED_JUMPSTART_RED, - }, - { - .name = "re355:green:lan_data", - .gpio = RE450_GPIO_LED_LAN_DATA, - .active_low = 1, - }, - { - .name = "re355:green:lan_link", - .gpio = RE450_GPIO_LED_LAN_LINK, - .active_low = 1, - }, -}; - -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 rex5x_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_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); -} - -static void __init re355_setup(void) -{ - rex5x_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(re355_leds_gpio), - re355_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_RE355, "RE355", "TP-LINK RE355", - re355_setup) - -static void __init re450_setup(void) -{ - rex5x_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(re450_leds_gpio), - re450_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_RE450, "RE450", "TP-LINK RE450", - re450_setup) diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rme-eg200.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rme-eg200.c deleted file mode 100644 index 332b0780d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rme-eg200.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * eTactica EG-200 board, based on 8devices Carambola2 module - * - * Copyright (C) 2015 Karl Palsson - * - * 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 "common.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 RME_EG200_GPIO_LED_WLAN 0 -#define RME_EG200_GPIO_LED_ETH0 13 -#define RME_EG200_GPIO_LED_ETACTICA 15 -#define RME_EG200_GPIO_LED_MODBUS 16 - -#define RME_EG200_GPIO_BTN_RESTORE 11 - -#define RME_EG200_KEYS_POLL_INTERVAL 20 /* msecs */ -#define RME_EG200_KEYS_DEBOUNCE_INTERVAL (3 * RME_EG200_KEYS_POLL_INTERVAL) - -#define RME_EG200_MAC0_OFFSET 0x0000 -#define RME_EG200_CALDATA_OFFSET 0x1000 -#define RME_EG200_WMAC_MAC_OFFSET 0x1002 - -static struct gpio_led rme_eg200_leds_gpio[] __initdata = { - { - .name = "eg200:red:wlan", - .gpio = RME_EG200_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "eg200:red:eth0", - .gpio = RME_EG200_GPIO_LED_ETH0, - .active_low = 1, - }, { - .name = "eg200:red:etactica", - .gpio = RME_EG200_GPIO_LED_ETACTICA, - .active_low = 0, - }, { - .name = "eg200:red:modbus", - .gpio = RME_EG200_GPIO_LED_MODBUS, - .active_low = 0, - } -}; - -static struct gpio_keys_button rme_eg200_keys[] __initdata = { - { - .desc = "restore button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = RME_EG200_KEYS_DEBOUNCE_INTERVAL, - .gpio = RME_EG200_GPIO_BTN_RESTORE, - .active_low = 1, - }, -}; - -static void __init rme_eg200_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - ath79_register_wmac(art + RME_EG200_CALDATA_OFFSET, - art + RME_EG200_WMAC_MAC_OFFSET); - - ath79_setup_ar933x_phy4_switch(true, true); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + RME_EG200_MAC0_OFFSET, 0); - - ath79_register_mdio(0, 0x0); - - /* WAN port */ - ath79_register_eth(0); - - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rme_eg200_leds_gpio), - rme_eg200_leds_gpio); - ath79_register_gpio_keys_polled(-1, RME_EG200_KEYS_POLL_INTERVAL, - ARRAY_SIZE(rme_eg200_keys), - rme_eg200_keys); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_RME_EG200, "RME-EG200", "eTactica EG-200", - rme_eg200_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rut9xx.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rut9xx.c deleted file mode 100644 index 43a2a78c6..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rut9xx.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Teltonika RUT900 series boards support - * - * Copyright (C) 2018 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 -#include - -#include "common.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 RUT9XX_GPIO_LED_LAN1 14 -#define RUT9XX_GPIO_LED_LAN2 13 -#define RUT9XX_GPIO_LED_LAN3 22 -#define RUT9XX_GPIO_LED_WAN 1 - -#define RUT9XX_PCA9539_GPIO_BASE 32 -#define RUT9XX_PCA9539_GPIO_SIGNAL1 (0 + RUT9XX_PCA9539_GPIO_BASE) -#define RUT9XX_PCA9539_GPIO_SIGNAL2 (1 + RUT9XX_PCA9539_GPIO_BASE) -#define RUT9XX_PCA9539_GPIO_SIGNAL3 (2 + RUT9XX_PCA9539_GPIO_BASE) -#define RUT9XX_PCA9539_GPIO_SIGNAL4 (3 + RUT9XX_PCA9539_GPIO_BASE) -#define RUT9XX_PCA9539_GPIO_SIGNAL5 (4 + RUT9XX_PCA9539_GPIO_BASE) -#define RUT9XX_PCA9539_GPIO_STATUS_R (5 + RUT9XX_PCA9539_GPIO_BASE) -#define RUT9XX_PCA9539_GPIO_STATUS_G (6 + RUT9XX_PCA9539_GPIO_BASE) - -#define RUT9XX_GPIO_BTN_RESET 15 - -#define RUT9XX_GPIO_I2C_SCK 16 -#define RUT9XX_GPIO_I2C_SDA 17 - -#define RUT9XX_GPIO_EXT_LNA0 2 - -#define RUT9XX_WMAC_CALDATA_OFFSET 0x1000 - -#define RUT9XX_KEYS_POLL_INTERVAL 20 -#define RUT9XX_KEYS_DEBOUNCE_INTERVAL (3 * RUT9XX_KEYS_POLL_INTERVAL) - -static struct gpio_led rut900_leds_gpio[] __initdata = { - { - .name = "rut900:green:lan1", - .gpio = RUT9XX_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "rut900:green:lan2", - .gpio = RUT9XX_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "rut900:green:lan3", - .gpio = RUT9XX_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "rut900:green:signal1", - .gpio = RUT9XX_PCA9539_GPIO_SIGNAL1, - .active_low = 0, - }, { - .name = "rut900:green:signal2", - .gpio = RUT9XX_PCA9539_GPIO_SIGNAL2, - .active_low = 0, - }, { - .name = "rut900:green:signal3", - .gpio = RUT9XX_PCA9539_GPIO_SIGNAL3, - .active_low = 0, - }, { - .name = "rut900:green:signal4", - .gpio = RUT9XX_PCA9539_GPIO_SIGNAL4, - .active_low = 0, - }, { - .name = "rut900:green:signal5", - .gpio = RUT9XX_PCA9539_GPIO_SIGNAL5, - .active_low = 0, - }, { - .name = "rut900:green:status", - .gpio = RUT9XX_PCA9539_GPIO_STATUS_G, - .active_low = 0, - }, { - .name = "rut900:green:wan", - .gpio = RUT9XX_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "rut900:red:status", - .gpio = RUT9XX_PCA9539_GPIO_STATUS_R, - .active_low = 0, - }, -}; - -static struct gpio_keys_button rut900_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = RUT9XX_KEYS_DEBOUNCE_INTERVAL, - .gpio = RUT9XX_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct i2c_gpio_platform_data rut900_i2c_gpio_data = { - .sda_pin = RUT9XX_GPIO_I2C_SDA, - .scl_pin = RUT9XX_GPIO_I2C_SCK, - .udelay = 10, -}; - -static struct platform_device rut900_i2c_device = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &rut900_i2c_gpio_data, - }, -}; - -static struct pca953x_platform_data rut9xx_pca9539_data = { - .gpio_base = RUT9XX_PCA9539_GPIO_BASE, - .irq_base = -1, -}; - -static struct i2c_board_info rut900_i2c_devs[] __initdata = { - { - I2C_BOARD_INFO("pca9539", 0x74), - .platform_data = &rut9xx_pca9539_data, - }, -}; - -static void __init rut900_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f030000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f020000); - u8 wlan_mac[ETH_ALEN]; - - ath79_register_m25p80(NULL); - - ath79_register_mdio(1, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = 0xf1; - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - platform_device_register(&rut900_i2c_device); - i2c_register_board_info(0, rut900_i2c_devs, - ARRAY_SIZE(rut900_i2c_devs)); - - /* Disable JTAG (enables GPIO0-3) */ - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rut900_leds_gpio), - rut900_leds_gpio); - - ath79_register_gpio_keys_polled(-1, RUT9XX_KEYS_POLL_INTERVAL, - ARRAY_SIZE(rut900_gpio_keys), - rut900_gpio_keys); - - ath79_wmac_set_ext_lna_gpio(0, RUT9XX_GPIO_EXT_LNA0); - - ath79_init_mac(wlan_mac, mac, 2); - ath79_register_wmac(art + RUT9XX_WMAC_CALDATA_OFFSET, wlan_mac); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_RUT9XX, "RUT900", "Teltonika RUT900", rut900_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rw2458n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rw2458n.c deleted file mode 100644 index bb7c2475b..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rw2458n.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Redwave RW2458N support - * - * Copyright (C) 2011-2013 Cezary Jackiewicz - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include - -#include "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "pci.h" - -#define RW2458N_GPIO_LED_D3 1 -#define RW2458N_GPIO_LED_D4 0 -#define RW2458N_GPIO_LED_D5 11 -#define RW2458N_GPIO_LED_D6 7 -#define RW2458N_GPIO_BTN_RESET 12 - -#define RW2458N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define RW2458N_KEYS_DEBOUNCE_INTERVAL (3 * RW2458N_KEYS_POLL_INTERVAL) - -static struct gpio_keys_button rw2458n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = RW2458N_KEYS_DEBOUNCE_INTERVAL, - .gpio = RW2458N_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -#define RW2458N_WAN_PHYMASK BIT(4) - -static struct gpio_led rw2458n_leds_gpio[] __initdata = { - { - .name = "rw2458n:green:d3", - .gpio = RW2458N_GPIO_LED_D3, - .active_low = 1, - }, { - .name = "rw2458n:green:d4", - .gpio = RW2458N_GPIO_LED_D4, - .active_low = 1, - }, { - .name = "rw2458n:green:d5", - .gpio = RW2458N_GPIO_LED_D5, - .active_low = 1, - }, { - .name = "rw2458n:green:d6", - .gpio = RW2458N_GPIO_LED_D6, - .active_low = 1, - } -}; - -static void __init rw2458n_setup(void) -{ - u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(0, ~RW2458N_WAN_PHYMASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0); - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(rw2458n_leds_gpio), - rw2458n_leds_gpio); - - ath79_register_gpio_keys_polled(-1, RW2458N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(rw2458n_gpio_keys), - rw2458n_gpio_keys); - ath79_register_usb(); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_RW2458N, "RW2458N", "Redwave RW2458N", - rw2458n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-smart-300.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-smart-300.c deleted file mode 100644 index 2520e960d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-smart-300.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * NC-LINK SMART-300 board support - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2014 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 "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 SMART_300_GPIO_LED_WLAN 13 -#define SMART_300_GPIO_LED_WAN 18 -#define SMART_300_GPIO_LED_LAN4 19 -#define SMART_300_GPIO_LED_LAN3 12 -#define SMART_300_GPIO_LED_LAN2 21 -#define SMART_300_GPIO_LED_LAN1 20 -#define SMART_300_GPIO_LED_SYSTEM 15 -#define SMART_300_GPIO_LED_POWER 14 - -#define SMART_300_GPIO_BTN_RESET 17 -#define SMART_300_GPIO_SW_RFKILL 16 - -#define SMART_300_KEYS_POLL_INTERVAL 20 /* msecs */ -#define SMART_300_KEYS_DEBOUNCE_INTERVAL (3 * SMART_300_KEYS_POLL_INTERVAL) - -#define SMART_300_GPIO_MASK 0x007fffff - -static const char *smart_300_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data smart_300_flash_data = { - .part_probes = smart_300_part_probes, -}; - -static struct gpio_led smart_300_leds_gpio[] __initdata = { - { - .name = "nc-link:green:lan1", - .gpio = SMART_300_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "nc-link:green:lan2", - .gpio = SMART_300_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "nc-link:green:lan3", - .gpio = SMART_300_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "nc-link:green:lan4", - .gpio = SMART_300_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "nc-link:green:system", - .gpio = SMART_300_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "nc-link:green:wan", - .gpio = SMART_300_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "nc-link:green:wlan", - .gpio = SMART_300_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button smart_300_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = SMART_300_KEYS_DEBOUNCE_INTERVAL, - .gpio = SMART_300_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init smart_300_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(smart_300_leds_gpio), - smart_300_leds_gpio); - - ath79_register_gpio_keys_polled(1, SMART_300_KEYS_POLL_INTERVAL, - ARRAY_SIZE(smart_300_gpio_keys), - smart_300_gpio_keys); - - ath79_register_m25p80(&smart_300_flash_data); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - - /* GMAC0 is connected to the PHY0 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); - - gpio_request(SMART_300_GPIO_LED_POWER, "power"); - gpio_direction_output(SMART_300_GPIO_LED_POWER, GPIOF_OUT_INIT_LOW); -} - -MIPS_MACHINE(ATH79_MACH_SMART_300, "SMART-300", "NC-LINK SMART-300", - smart_300_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-som9331.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-som9331.c deleted file mode 100644 index eef5bcedc..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-som9331.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * OpenEmbed SOM9331 board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * - * 5/27/2016 - Modified by Allan Nick Pedrana - * - * 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 "common.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 SOM9331_GPIO_LED_WLAN 27 -#define SOM9331_GPIO_LED_SYSTEM 0 -#define SOM9331_GPIO_LED_2 13 -#define SOM9331_GPIO_LED_3 14 -#define SOM9331_GPIO_LED_5 16 -#define SOM9331_GPIO_LED_WAN SOM9331_GPIO_LED_2 -#define SOM9331_GPIO_LED_LAN1 SOM9331_GPIO_LED_3 -#define SOM9331_GPIO_LED_LAN2 SOM9331_GPIO_LED_5 -#define SOM9331_GPIO_BTN_RESET 11 - -#define SOM9331_KEYS_POLL_INTERVAL 20 /* msecs */ -#define SOM9331_KEYS_DEBOUNCE_INTERVAL (3 * SOM9331_KEYS_POLL_INTERVAL) - -static const char *som9331_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data som9331_flash_data = { - .part_probes = som9331_part_probes, -}; - -static struct gpio_led som9331_leds_gpio[] __initdata = { - { - .name = "som9331:red:wlan", - .gpio = SOM9331_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "som9331:orange:wan", - .gpio = SOM9331_GPIO_LED_WAN, - .active_low = 0, - }, - { - .name = "som9331:orange:lan1", - .gpio = SOM9331_GPIO_LED_LAN1, - .active_low = 0, - }, - { - .name = "som9331:orange:lan2", - .gpio = SOM9331_GPIO_LED_LAN2, - .active_low = 0, - }, - { - .name = "som9331:blue:system", - .gpio = SOM9331_GPIO_LED_SYSTEM, - .active_low = 0, - }, -}; - -static struct gpio_keys_button som9331_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = SOM9331_KEYS_DEBOUNCE_INTERVAL, - .gpio = SOM9331_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init som9331_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_setup_ar933x_phy4_switch(true, true); - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_m25p80(&som9331_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(som9331_leds_gpio), - som9331_leds_gpio); - ath79_register_gpio_keys_polled(-1, SOM9331_KEYS_POLL_INTERVAL, - ARRAY_SIZE(som9331_gpio_keys), - som9331_gpio_keys); - - ath79_register_usb(); - - 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); - - /* LAN ports */ - ath79_register_eth(1); - - /* WAN port */ - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_SOM9331, "SOM9331", "OpenEmbed SOM9331", som9331_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-t830.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-t830.c deleted file mode 100644 index ffdb2ca53..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-t830.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * YunCore T830 board support - * - * Copyright (C) 2018 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 "common.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 T830_GPIO_LED_LAN1 16 -#define T830_GPIO_LED_LAN2 15 -#define T830_GPIO_LED_LAN3 14 -#define T830_GPIO_LED_LAN4 11 -#define T830_GPIO_LED_USB 13 -#define T830_GPIO_LED_WAN 4 -#define T830_GPIO_LED_WLAN 12 - -#define T830_GPIO_BTN_RESET 17 - -#define T830_KEYS_POLL_INTERVAL 20 /* msec */ -#define T830_KEYS_DEBOUNCE_INTERVAL (3 * T830_KEYS_POLL_INTERVAL) - -#define T830_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led t830_gpio_leds[] __initdata = { - { - .name = "t830:green:lan1", - .gpio = T830_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "t830:green:lan2", - .gpio = T830_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "t830:green:lan3", - .gpio = T830_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "t830:green:lan4", - .gpio = T830_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "t830:green:usb", - .gpio = T830_GPIO_LED_USB, - .active_low = 1, - .default_state = LEDS_GPIO_DEFSTATE_KEEP, - }, { - .name = "t830:green:wan", - .gpio = T830_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "t830:green:wlan", - .gpio = T830_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button t830_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = T830_KEYS_DEBOUNCE_INTERVAL, - .gpio = T830_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init t830_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff1000); - u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask |= BIT(4); - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_init_mac(ath79_eth1_data.mac_addr, mac + 6, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_register_eth(0); - - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, - AR934X_GPIO_FUNC_CLK_OBS4_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(t830_gpio_leds), - t830_gpio_leds); - - ath79_register_gpio_keys_polled(-1, T830_KEYS_POLL_INTERVAL, - ARRAY_SIZE(t830_gpio_keys), - t830_gpio_keys); - - ath79_register_usb(); - ath79_register_wmac(art, NULL); -} - -MIPS_MACHINE(ATH79_MACH_T830, "T830", "YunCore T830", t830_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tellstick-znet-lite.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tellstick-znet-lite.c deleted file mode 100644 index 0950d9a99..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tellstick-znet-lite.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Telldus TellStick ZNet Lite board support - * - * Copyright (C) 2016 Micke Prag - * - * 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 "common.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 TELLSTICK_GPIO_LED_SYSTEM 27 -#define TELLSTICK_GPIO_LED_BLUE 0 -#define TELLSTICK_GPIO_LED_RED 14 -#define TELLSTICK_GPIO_LED_GREEN 15 -#define TELLSTICK_GPIO_LED_LAN_GREEN 16 -#define TELLSTICK_GPIO_LED_LAN_ORANGE 17 - -#define TELLSTICK_GPIO_BTN_RESET 11 - -#define TELLSTICK_GPIO_RF433_RESET 13 - -#define TELLSTICK_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TELLSTICK_KEYS_DEBOUNCE_INTERVAL (3 * TELLSTICK_KEYS_POLL_INTERVAL) - -static const char *tellstick_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tellstick_flash_data = { - .part_probes = tellstick_part_probes, -}; - -static struct gpio_led tellstick_leds_gpio[] __initdata = { - { - .name = "tellstick:white:system", - .gpio = TELLSTICK_GPIO_LED_SYSTEM, - .active_low = 0, - }, - { - .name = "tellstick:blue:status", - .gpio = TELLSTICK_GPIO_LED_BLUE, - .active_low = 0, - }, - { - .name = "tellstick:red:status", - .gpio = TELLSTICK_GPIO_LED_RED, - .active_low = 0, - }, - { - .name = "tellstick:green:status", - .gpio = TELLSTICK_GPIO_LED_GREEN, - .active_low = 0, - }, - { - .name = "tellstick:green:lan", - .gpio = TELLSTICK_GPIO_LED_LAN_GREEN, - .active_low = 0, - }, - { - .name = "tellstick:orange:lan", - .gpio = TELLSTICK_GPIO_LED_LAN_ORANGE, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tellstick_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TELLSTICK_KEYS_DEBOUNCE_INTERVAL, - .gpio = TELLSTICK_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init tellstick_znet_lite_setup(void) -{ - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - u8 mac[ETH_ALEN]; - memcpy(&mac, (u8 *) KSEG1ADDR(0x1f01fc00), sizeof(mac)); - - ath79_gpio_function_disable( - AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN - ); - - ath79_register_m25p80(&tellstick_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tellstick_leds_gpio), - tellstick_leds_gpio); - ath79_register_gpio_keys_polled(-1, TELLSTICK_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tellstick_gpio_keys), - tellstick_gpio_keys); - - gpio_request_one(TELLSTICK_GPIO_RF433_RESET, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "rf433 reset"); - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, (u8 *)mac, 0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - - // wlan0 mac needs to be different then eth0 - mac[3] += 1; - ath79_register_wmac(ee, (u8 *)mac); -} - -MIPS_MACHINE(ATH79_MACH_TELLSTICK_ZNET_LITE, "TELLSTICK-ZNET-LITE", "Telldus TellStick ZNet Lite", - tellstick_znet_lite_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-632brp.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-632brp.c deleted file mode 100644 index 855664e56..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-632brp.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * TrendNET TEW-632BRP 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 "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 "nvram.h" - -#define TEW_632BRP_GPIO_LED_STATUS 1 -#define TEW_632BRP_GPIO_LED_WPS 3 -#define TEW_632BRP_GPIO_LED_WLAN 6 -#define TEW_632BRP_GPIO_BTN_WPS 12 -#define TEW_632BRP_GPIO_BTN_RESET 21 - -#define TEW_632BRP_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TEW_632BRP_KEYS_DEBOUNCE_INTERVAL (3 * TEW_632BRP_KEYS_POLL_INTERVAL) - -#define TEW_632BRP_CONFIG_ADDR 0x1f020000 -#define TEW_632BRP_CONFIG_SIZE 0x10000 - -static struct gpio_led tew_632brp_leds_gpio[] __initdata = { - { - .name = "tew-632brp:green:status", - .gpio = TEW_632BRP_GPIO_LED_STATUS, - .active_low = 1, - }, { - .name = "tew-632brp:blue:wps", - .gpio = TEW_632BRP_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "tew-632brp:green:wlan", - .gpio = TEW_632BRP_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button tew_632brp_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TEW_632BRP_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW_632BRP_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TEW_632BRP_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW_632BRP_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -#define TEW_632BRP_LAN_PHYMASK BIT(0) -#define TEW_632BRP_WAN_PHYMASK BIT(4) -#define TEW_632BRP_MDIO_MASK (~(TEW_632BRP_LAN_PHYMASK | \ - TEW_632BRP_WAN_PHYMASK)) - -static void __init tew_632brp_setup(void) -{ - const char *config = (char *) KSEG1ADDR(TEW_632BRP_CONFIG_ADDR); - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - u8 mac[6]; - u8 *wlan_mac = NULL; - - if (ath79_nvram_parse_mac_addr(config, TEW_632BRP_CONFIG_SIZE, - "lan_mac=", mac) == 0) { - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - wlan_mac = mac; - } - - ath79_register_mdio(0, TEW_632BRP_MDIO_MASK); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth0_data.phy_mask = TEW_632BRP_LAN_PHYMASK; - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.phy_mask = TEW_632BRP_WAN_PHYMASK; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tew_632brp_leds_gpio), - tew_632brp_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TEW_632BRP_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tew_632brp_gpio_keys), - tew_632brp_gpio_keys); - - ath79_register_wmac(eeprom, wlan_mac); -} - -MIPS_MACHINE(ATH79_MACH_TEW_632BRP, "TEW-632BRP", "TRENDnet TEW-632BRP", - tew_632brp_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-673gru.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-673gru.c deleted file mode 100644 index 80a5443c7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-673gru.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * TRENDnet TEW-673GRU board 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 "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 "machtypes.h" - -#define TEW673GRU_GPIO_LCD_SCK 0 -#define TEW673GRU_GPIO_LCD_MOSI 1 -#define TEW673GRU_GPIO_LCD_MISO 2 -#define TEW673GRU_GPIO_LCD_CS 6 - -#define TEW673GRU_GPIO_LED_WPS 9 - -#define TEW673GRU_GPIO_BTN_RESET 3 -#define TEW673GRU_GPIO_BTN_WPS 8 - -#define TEW673GRU_GPIO_RTL8366_SDA 5 -#define TEW673GRU_GPIO_RTL8366_SCK 7 - -#define TEW673GRU_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TEW673GRU_KEYS_DEBOUNCE_INTERVAL (3 * TEW673GRU_KEYS_POLL_INTERVAL) - -#define TEW673GRU_CAL0_OFFSET 0x1000 -#define TEW673GRU_CAL1_OFFSET 0x5000 -#define TEW673GRU_MAC0_OFFSET 0xffa0 -#define TEW673GRU_MAC1_OFFSET 0xffb4 - -#define TEW673GRU_CAL_LOCATION_0 0x1f660000 -#define TEW673GRU_CAL_LOCATION_1 0x1f7f0000 - -static struct gpio_led tew673gru_leds_gpio[] __initdata = { - { - .name = "trendnet:blue:wps", - .gpio = TEW673GRU_GPIO_LED_WPS, - .active_low = 1, - } -}; - -static struct gpio_keys_button tew673gru_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TEW673GRU_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW673GRU_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TEW673GRU_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW673GRU_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static struct rtl8366_initval tew673gru_rtl8366s_initvals[] = { - { .reg = 0x06, .val = 0x0108 }, -}; - -static struct rtl8366_platform_data tew673gru_rtl8366s_data = { - .gpio_sda = TEW673GRU_GPIO_RTL8366_SDA, - .gpio_sck = TEW673GRU_GPIO_RTL8366_SCK, - .num_initvals = ARRAY_SIZE(tew673gru_rtl8366s_initvals), - .initvals = tew673gru_rtl8366s_initvals, -}; - -static struct platform_device tew673gru_rtl8366s_device = { - .name = RTL8366S_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &tew673gru_rtl8366s_data, - } -}; - -static struct spi_board_info tew673gru_spi_info[] = { - { - .bus_num = 1, - .chip_select = 0, - .max_speed_hz = 400000, - .modalias = "spidev", - .mode = SPI_MODE_2, - .controller_data = (void *) TEW673GRU_GPIO_LCD_CS, - }, -}; - -static struct spi_gpio_platform_data tew673gru_spi_data = { - .sck = TEW673GRU_GPIO_LCD_SCK, - .miso = TEW673GRU_GPIO_LCD_MISO, - .mosi = TEW673GRU_GPIO_LCD_MOSI, - .num_chipselect = 1, -}; - -static struct platform_device tew673gru_spi_device = { - .name = "spi_gpio", - .id = 1, - .dev = { - .platform_data = &tew673gru_spi_data, - }, -}; - -static bool __init tew673gru_is_caldata_valid(u8 *p) -{ - u16 *magic0, *magic1; - - magic0 = (u16 *)(p + TEW673GRU_CAL0_OFFSET); - magic1 = (u16 *)(p + TEW673GRU_CAL1_OFFSET); - - return (*magic0 == 0xa55a && *magic1 == 0xa55a); -} - -static void __init tew673gru_wlan_init(void) -{ - u8 mac1[ETH_ALEN], mac2[ETH_ALEN]; - u8 *caldata; - - caldata = (u8 *) KSEG1ADDR(TEW673GRU_CAL_LOCATION_0); - if (!tew673gru_is_caldata_valid(caldata)) { - caldata = (u8 *)KSEG1ADDR(TEW673GRU_CAL_LOCATION_1); - if (!tew673gru_is_caldata_valid(caldata)) { - pr_err("no calibration data found\n"); - return; - } - } - - ath79_parse_ascii_mac(caldata + TEW673GRU_MAC0_OFFSET, mac1); - ath79_parse_ascii_mac(caldata + TEW673GRU_MAC1_OFFSET, mac2); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 2); - ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 3); - - ap9x_pci_setup_wmac_led_pin(0, 5); - ap9x_pci_setup_wmac_led_pin(1, 5); - - ap94_pci_init(caldata + TEW673GRU_CAL0_OFFSET, mac1, - caldata + TEW673GRU_CAL1_OFFSET, mac2); -} - -static void __init tew673gru_setup(void) -{ - tew673gru_wlan_init(); - - ath79_register_mdio(0, 0x0); - - ath79_eth0_data.mii_bus_dev = &tew673gru_rtl8366s_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_pll_data.pll_1000 = 0x11110000; - - ath79_eth1_data.mii_bus_dev = &tew673gru_rtl8366s_device.dev; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = 0x10; - ath79_eth1_pll_data.pll_1000 = 0x11110000; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tew673gru_leds_gpio), - tew673gru_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TEW673GRU_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tew673gru_gpio_keys), - tew673gru_gpio_keys); - - ath79_register_usb(); - - platform_device_register(&tew673gru_rtl8366s_device); - - spi_register_board_info(tew673gru_spi_info, - ARRAY_SIZE(tew673gru_spi_info)); - platform_device_register(&tew673gru_spi_device); -} - -MIPS_MACHINE(ATH79_MACH_TEW_673GRU, "TEW-673GRU", "TRENDnet TEW-673GRU", - tew673gru_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-712br.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-712br.c deleted file mode 100644 index 304b99488..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-712br.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * TRENDnet TEW-712BR board 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 "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 TEW_712BR_GPIO_BTN_WPS 11 -#define TEW_712BR_GPIO_BTN_RESET 12 - -#define TEW_712BR_GPIO_LED_LAN1 13 -#define TEW_712BR_GPIO_LED_LAN2 14 -#define TEW_712BR_GPIO_LED_LAN3 15 -#define TEW_712BR_GPIO_LED_LAN4 16 -#define TEW_712BR_GPIO_LED_POWER_GREEN 20 -#define TEW_712BR_GPIO_LED_POWER_ORANGE 27 -#define TEW_712BR_GPIO_LED_WAN_GREEN 17 -#define TEW_712BR_GPIO_LED_WAN_ORANGE 23 -#define TEW_712BR_GPIO_LED_WLAN 0 -#define TEW_712BR_GPIO_LED_WPS 26 - -#define TEW_712BR_GPIO_WAN_LED_ENABLE 1 - -#define TEW_712BR_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TEW_712BR_KEYS_DEBOUNCE_INTERVAL (3 * TEW_712BR_KEYS_POLL_INTERVAL) - -#define TEW_712BR_ART_ADDRESS 0x1f010000 -#define TEW_712BR_CALDATA_OFFSET 0x1000 - -#define TEW_712BR_MAC_PART_ADDRESS 0x1f020000 -#define TEW_712BR_LAN_MAC_OFFSET 0x04 -#define TEW_712BR_WAN_MAC_OFFSET 0x16 - -static struct gpio_led tew_712br_leds_gpio[] __initdata = { - { - .name = "trendnet:green:lan1", - .gpio = TEW_712BR_GPIO_LED_LAN1, - .active_low = 0, - }, { - .name = "trendnet:green:lan2", - .gpio = TEW_712BR_GPIO_LED_LAN2, - .active_low = 0, - }, { - .name = "trendnet:green:lan3", - .gpio = TEW_712BR_GPIO_LED_LAN3, - .active_low = 0, - }, { - .name = "trendnet:green:lan4", - .gpio = TEW_712BR_GPIO_LED_LAN4, - .active_low = 0, - }, { - .name = "trendnet:blue:wps", - .gpio = TEW_712BR_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "trendnet:green:power", - .gpio = TEW_712BR_GPIO_LED_POWER_GREEN, - .active_low = 0, - }, { - .name = "trendnet:orange:power", - .gpio = TEW_712BR_GPIO_LED_POWER_ORANGE, - .active_low = 0, - }, { - .name = "trendnet:green:wan", - .gpio = TEW_712BR_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "trendnet:orange:wan", - .gpio = TEW_712BR_GPIO_LED_WAN_ORANGE, - .active_low = 0, - }, { - .name = "trendnet:green:wlan", - .gpio = TEW_712BR_GPIO_LED_WLAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tew_712br_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TEW_712BR_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW_712BR_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TEW_712BR_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW_712BR_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static void __init tew_712br_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(TEW_712BR_ART_ADDRESS); - u8 *mac = (u8 *) KSEG1ADDR(TEW_712BR_MAC_PART_ADDRESS); - u8 lan_mac[ETH_ALEN]; - u8 wan_mac[ETH_ALEN]; - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - gpio_request_one(TEW_712BR_GPIO_WAN_LED_ENABLE, - GPIOF_OUT_INIT_LOW, "WAN LED enable"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tew_712br_leds_gpio), - tew_712br_leds_gpio); - - ath79_register_gpio_keys_polled(1, TEW_712BR_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tew_712br_gpio_keys), - tew_712br_gpio_keys); - - ath79_register_m25p80(NULL); - - ath79_parse_ascii_mac(mac + TEW_712BR_LAN_MAC_OFFSET, lan_mac); - ath79_parse_ascii_mac(mac + TEW_712BR_WAN_MAC_OFFSET, wan_mac); - - ath79_init_mac(ath79_eth0_data.mac_addr, wan_mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, lan_mac, 0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_register_wmac(art + TEW_712BR_CALDATA_OFFSET, wan_mac); -} - -MIPS_MACHINE(ATH79_MACH_TEW_712BR, "TEW-712BR", - "TRENDnet TEW-712BR", tew_712br_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-732br.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-732br.c deleted file mode 100644 index 1f26f6f4b..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-732br.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * TRENDnet TEW-732BR board support - * - * Copyright (C) 2013 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 "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 TEW_732BR_GPIO_BTN_WPS 16 -#define TEW_732BR_GPIO_BTN_RESET 17 - -#define TEW_732BR_GPIO_LED_POWER_GREEN 4 -#define TEW_732BR_GPIO_LED_POWER_AMBER 14 -#define TEW_732BR_GPIO_LED_PLANET_GREEN 12 -#define TEW_732BR_GPIO_LED_PLANET_AMBER 22 - -#define TEW_732BR_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TEW_732BR_KEYS_DEBOUNCE_INTERVAL (3 * TEW_732BR_KEYS_POLL_INTERVAL) - -#define TEW_732BR_ART_ADDRESS 0x1fff0000 -#define TEW_732BR_CALDATA_OFFSET 0x1000 -#define TEW_732BR_LAN_MAC_OFFSET 0xffa0 -#define TEW_732BR_WAN_MAC_OFFSET 0xffb4 - -static struct gpio_led tew_732br_leds_gpio[] __initdata = { - { - .name = "trendnet:green:power", - .gpio = TEW_732BR_GPIO_LED_POWER_GREEN, - .active_low = 0, - }, - { - .name = "trendnet:amber:power", - .gpio = TEW_732BR_GPIO_LED_POWER_AMBER, - .active_low = 0, - }, - { - .name = "trendnet:green:wan", - .gpio = TEW_732BR_GPIO_LED_PLANET_GREEN, - .active_low = 1, - }, - { - .name = "trendnet:amber:wan", - .gpio = TEW_732BR_GPIO_LED_PLANET_AMBER, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tew_732br_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TEW_732BR_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW_732BR_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TEW_732BR_KEYS_DEBOUNCE_INTERVAL, - .gpio = TEW_732BR_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static void __init tew_732br_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(TEW_732BR_ART_ADDRESS); - u8 lan_mac[ETH_ALEN]; - u8 wan_mac[ETH_ALEN]; - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tew_732br_leds_gpio), - tew_732br_leds_gpio); - - ath79_register_gpio_keys_polled(1, TEW_732BR_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tew_732br_gpio_keys), - tew_732br_gpio_keys); - - ath79_register_m25p80(NULL); - - ath79_parse_ascii_mac(art + TEW_732BR_LAN_MAC_OFFSET, lan_mac); - ath79_parse_ascii_mac(art + TEW_732BR_WAN_MAC_OFFSET, wan_mac); - - ath79_register_wmac(art + TEW_732BR_CALDATA_OFFSET, lan_mac); - - ath79_register_mdio(1, 0x0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - /* LAN: GMAC1 is connected to the internal switch */ - ath79_init_mac(ath79_eth1_data.mac_addr, lan_mac, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - - ath79_register_eth(1); - - /* WAN: GMAC0 is connected to the PHY4 of the internal switch */ - ath79_init_mac(ath79_eth0_data.mac_addr, wan_mac, 0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_TEW_732BR, "TEW-732BR", "TRENDnet TEW-732BR", - tew_732br_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr11u.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr11u.c deleted file mode 100644 index 74ccf639e..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr11u.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * TP-LINK TL-MR11U/TL-MR3040 board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-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 "common.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 TL_MR11U_GPIO_LED_3G 27 -#define TL_MR11U_GPIO_LED_WLAN 26 -#define TL_MR11U_GPIO_LED_LAN 17 - -#define TL_MR11U_GPIO_BTN_WPS 20 -#define TL_MR11U_GPIO_BTN_RESET 11 - -#define TL_MR11U_GPIO_USB_POWER 8 -#define TL_MR3040_GPIO_USB_POWER 18 - -#define TL_MR3040_V2_GPIO_BTN_SW1 19 -#define TL_MR3040_V2_GPIO_BTN_SW2 20 - -#define TL_MR11U_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_MR11U_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR11U_KEYS_POLL_INTERVAL) - -static const char *tl_mr11u_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_mr11u_flash_data = { - .part_probes = tl_mr11u_part_probes, -}; - -static struct gpio_led tl_mr11u_leds_gpio[] __initdata = { - { - .name = "tp-link:green:3g", - .gpio = TL_MR11U_GPIO_LED_3G, - .active_low = 1, - }, - { - .name = "tp-link:green:wlan", - .gpio = TL_MR11U_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "tp-link:green:lan", - .gpio = TL_MR11U_GPIO_LED_LAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_mr11u_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_MR11U_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR11U_GPIO_BTN_RESET, - .active_low = 0, - }, - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_MR11U_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR11U_GPIO_BTN_WPS, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tl_mr3040_v2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_MR11U_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR11U_GPIO_BTN_RESET, - .active_low = 0, - }, - { - .desc = "sw1", - .type = EV_SW, - .code = BTN_0, - .debounce_interval = TL_MR11U_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3040_V2_GPIO_BTN_SW1, - .active_low = 0, - }, - { - .desc = "sw2", - .type = EV_SW, - .code = BTN_1, - .debounce_interval = TL_MR11U_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3040_V2_GPIO_BTN_SW2, - .active_low = 0, - } -}; - -static void __init common_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* Disable hardware control LAN1 and LAN2 LEDs, enabling GPIO14 and GPIO15 */ - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_m25p80(&tl_mr11u_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr11u_leds_gpio), - tl_mr11u_leds_gpio); - - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -static void __init tl_mr11u_setup(void) -{ - common_setup(); - - ath79_register_gpio_keys_polled(-1, TL_MR11U_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_mr11u_gpio_keys), - tl_mr11u_gpio_keys); - gpio_request_one(TL_MR11U_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR11U, "TL-MR11U", "TP-LINK TL-MR11U", - tl_mr11u_setup); - -static void __init tl_mr3040_setup(void) -{ - common_setup(); - - ath79_register_gpio_keys_polled(-1, TL_MR11U_KEYS_POLL_INTERVAL, - 1, tl_mr11u_gpio_keys); - gpio_request_one(TL_MR3040_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR3040, "TL-MR3040", "TP-LINK TL-MR3040", - tl_mr3040_setup); - -static void __init tl_mr3040_v2_setup(void) -{ - common_setup(); - - ath79_register_gpio_keys_polled(-1, TL_MR11U_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_mr3040_v2_gpio_keys), - tl_mr3040_v2_gpio_keys); - gpio_request_one(TL_MR3040_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR3040_V2, "TL-MR3040-v2", "TP-LINK TL-MR3040 v2", - tl_mr3040_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr13u.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr13u.c deleted file mode 100644 index 84b693784..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr13u.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * TP-LINK TL-MR13U board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-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 "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 TL_MR13U_GPIO_LED_SYSTEM 27 - -#define TL_MR13U_GPIO_BTN_RESET 11 -#define TL_MR13U_GPIO_BTN_SW1 6 -#define TL_MR13U_GPIO_BTN_SW2 7 - -#define TL_MR13U_GPIO_USB_POWER 18 - -#define TL_MR13U_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_MR13U_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR13U_KEYS_POLL_INTERVAL) - -static const char *tl_mr13u_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_mr13u_flash_data = { - .part_probes = tl_mr13u_part_probes, -}; - -static struct gpio_led tl_mr13u_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:system", - .gpio = TL_MR13U_GPIO_LED_SYSTEM, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tl_mr13u_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_MR13U_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR13U_GPIO_BTN_RESET, - .active_low = 0, - }, - { - .desc = "sw1", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = TL_MR13U_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR13U_GPIO_BTN_SW1, - .active_low = 0, - }, - { - .desc = "sw2", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = TL_MR13U_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR13U_GPIO_BTN_SW2, - .active_low = 0, - }, -}; - -static void __init tl_mr13u_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_m25p80(&tl_mr13u_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr13u_leds_gpio), - tl_mr13u_leds_gpio); - ath79_register_gpio_keys_polled(-1, TL_MR13U_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_mr13u_gpio_keys), - tl_mr13u_gpio_keys); - - gpio_request_one(TL_MR13U_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR13U, "TL-MR13U", "TP-LINK TL-MR13U v1", - tl_mr13u_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr3020.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr3020.c deleted file mode 100644 index 0a9dfbc8a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr3020.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * TP-LINK TL-MR3020 board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-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 "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 TL_MR3020_GPIO_LED_3G 27 -#define TL_MR3020_GPIO_LED_WLAN 0 -#define TL_MR3020_GPIO_LED_LAN 17 -#define TL_MR3020_GPIO_LED_WPS 26 - -#define TL_MR3020_GPIO_BTN_WPS 11 -#define TL_MR3020_GPIO_BTN_SW1 18 -#define TL_MR3020_GPIO_BTN_SW2 20 - -#define TL_MR3020_GPIO_USB_POWER 8 - -#define TL_MR3020_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_MR3020_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR3020_KEYS_POLL_INTERVAL) - -static const char *tl_mr3020_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_mr3020_flash_data = { - .part_probes = tl_mr3020_part_probes, -}; - -static struct gpio_led tl_mr3020_leds_gpio[] __initdata = { - { - .name = "tp-link:green:3g", - .gpio = TL_MR3020_GPIO_LED_3G, - .active_low = 1, - }, - { - .name = "tp-link:green:wlan", - .gpio = TL_MR3020_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "tp-link:green:lan", - .gpio = TL_MR3020_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "tp-link:green:wps", - .gpio = TL_MR3020_GPIO_LED_WPS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_mr3020_gpio_keys[] __initdata = { - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_MR3020_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3020_GPIO_BTN_WPS, - .active_low = 0, - }, - { - .desc = "sw1", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = TL_MR3020_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3020_GPIO_BTN_SW1, - .active_low = 0, - }, - { - .desc = "sw2", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = TL_MR3020_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3020_GPIO_BTN_SW2, - .active_low = 0, - } -}; - -static void __init tl_mr3020_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_m25p80(&tl_mr3020_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr3020_leds_gpio), - tl_mr3020_leds_gpio); - ath79_register_gpio_keys_polled(-1, TL_MR3020_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_mr3020_gpio_keys), - tl_mr3020_gpio_keys); - - gpio_request_one(TL_MR3020_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR3020, "TL-MR3020", "TP-LINK TL-MR3020", - tl_mr3020_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr3x20.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr3x20.c deleted file mode 100644 index 5924ac504..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr3x20.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * TP-LINK TL-MR3220/3420 board support - * - * Copyright (C) 2010-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 "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" - -#define TL_MR3X20_GPIO_LED_QSS 0 -#define TL_MR3X20_GPIO_LED_SYSTEM 1 -#define TL_MR3X20_GPIO_LED_3G 8 - -#define TL_MR3X20_GPIO_BTN_RESET 11 -#define TL_MR3X20_GPIO_BTN_QSS 12 - -#define TL_MR3X20_GPIO_USB_POWER 6 - -#define TL_MR3X20_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_MR3X20_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR3X20_KEYS_POLL_INTERVAL) - -static const char *tl_mr3x20_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_mr3x20_flash_data = { - .part_probes = tl_mr3x20_part_probes, -}; - -static struct gpio_led tl_mr3x20_leds_gpio[] __initdata = { - { - .name = "tp-link:green:system", - .gpio = TL_MR3X20_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_MR3X20_GPIO_LED_QSS, - .active_low = 1, - }, { - .name = "tp-link:green:3g", - .gpio = TL_MR3X20_GPIO_LED_3G, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_mr3x20_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_MR3X20_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3X20_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "qss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_MR3X20_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3X20_GPIO_BTN_QSS, - .active_low = 1, - } -}; - -static void __init tl_ap99_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&tl_mr3x20_flash_data); - - ath79_register_gpio_keys_polled(-1, TL_MR3X20_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_mr3x20_gpio_keys), - tl_mr3x20_gpio_keys); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - - /* LAN ports */ - ath79_register_eth(1); - /* WAN port */ - ath79_register_eth(0); - - ap91_pci_init(ee, mac); -} - -static void __init tl_mr3x20_usb_setup(void) -{ - /* enable power for the USB port */ - gpio_request_one(TL_MR3X20_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); -} - -static void __init tl_mr3220_setup(void) -{ - tl_ap99_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr3x20_leds_gpio), - tl_mr3x20_leds_gpio); - ap9x_pci_setup_wmac_led_pin(0, 1); - tl_mr3x20_usb_setup(); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR3220, "TL-MR3220", "TP-LINK TL-MR3220", - tl_mr3220_setup); - -static void __init tl_mr3420_setup(void) -{ - tl_ap99_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr3x20_leds_gpio), - tl_mr3x20_leds_gpio); - ap9x_pci_setup_wmac_led_pin(0, 0); - tl_mr3x20_usb_setup(); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR3420, "TL-MR3420", "TP-LINK TL-MR3420", - tl_mr3420_setup); - -static void __init tl_wr841n_v7_setup(void) -{ - tl_ap99_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr3x20_leds_gpio) - 1, - tl_mr3x20_leds_gpio); - ap9x_pci_setup_wmac_led_pin(0, 0); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR841N_V7, "TL-WR841N-v7", - "TP-LINK TL-WR841N/ND v7", tl_wr841n_v7_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr6400.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr6400.c deleted file mode 100644 index be49c89ca..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-mr6400.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * TP-LINK TL-MR6400 board support - * - * Copyright (C) 2017 Filip Moc - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE. - */ - -#include -#include - -#include - -#include "common.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TL_MR6400_GPIO_LTE_POWER 4 -#define TL_MR6400_GPIO_BTN_RESET 12 /* SW2 */ -#define TL_MR6400_GPIO_BTN_RFKILL 14 /* SW3 */ -#define TL_MR6400_GPIO_LED_WAN 0 /* D12 */ -#define TL_MR6400_GPIO_LED_4G 1 /* D11 */ -#define TL_MR6400_GPIO_LED_WPS 3 /* D5 */ -#define TL_MR6400_GPIO_LED_WLAN 11 /* D3 */ -#define TL_MR6400_GPIO_LED_POWER 13 /* D2 */ -#define TL_MR6400_GPIO_LED_LAN 16 /* D4 */ - -#define TL_MR6400_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_MR6400_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR6400_KEYS_POLL_INTERVAL) - -#define TL_MR6400_WMAC_CALDATA_OFFSET 0x1000 - -static const char *tl_mr6400_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_mr6400_flash_data = { - .part_probes = tl_mr6400_part_probes, - .type = "w25q64", -}; - -static struct gpio_led tl_mr6400_leds_gpio[] __initdata = { - { - .name = "tp-link:white:wan", - .gpio = TL_MR6400_GPIO_LED_WAN, - .active_low = 0, - }, - { - .name = "tp-link:white:4g", - .gpio = TL_MR6400_GPIO_LED_4G, - .active_low = 0, - }, - { - .name = "tp-link:white:wps", - .gpio = TL_MR6400_GPIO_LED_WPS, - .active_low = 0, - }, - { - .name = "tp-link:white:wlan", - .gpio = TL_MR6400_GPIO_LED_WLAN, - .active_low = 0, - }, - { - .name = "tp-link:white:power", - .gpio = TL_MR6400_GPIO_LED_POWER, - .active_low = 0, - }, - { - .name = "tp-link:white:lan", - .gpio = TL_MR6400_GPIO_LED_LAN, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tl_mr6400_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_MR6400_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR6400_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "rfkill", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_MR6400_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR6400_GPIO_BTN_RFKILL, - .active_low = 1, - }, -}; - -static void __init tl_mr6400_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&tl_mr6400_flash_data); - - ath79_register_mdio(0, 0x0); - - /* LAN1, LAN2, LAN3 */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask |= BIT(0); - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - ath79_register_eth(1); - - /* LAN4 / WAN */ - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - ath79_register_wmac(art + TL_MR6400_WMAC_CALDATA_OFFSET, mac); - - ath79_register_leds_gpio(-1, - ARRAY_SIZE(tl_mr6400_leds_gpio), - tl_mr6400_leds_gpio); - - ath79_register_gpio_keys_polled(-1, - TL_MR6400_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_mr6400_gpio_keys), - tl_mr6400_gpio_keys); - - gpio_request_one(TL_MR6400_GPIO_LTE_POWER, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED | GPIOF_ACTIVE_LOW, - "LTE power"); - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR6400, "TL-MR6400", "TP-LINK TL-MR6400", - tl_mr6400_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa701nd-v2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa701nd-v2.c deleted file mode 100644 index aab92b30d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa701nd-v2.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * TP-LINK TL-WA701ND v2 board support - * - * Copyright (C) 2015 Luigi Tarenga - * - * 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 "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 TL_WA701NDV2_GPIO_LED_WLAN 0 -#define TL_WA701NDV2_GPIO_LED_QSS 1 -#define TL_WA701NDV2_GPIO_LED_LAN 17 -#define TL_WA701NDV2_GPIO_LED_SYSTEM 27 - -#define TL_WA701NDV2_GPIO_BTN_RESET 11 -#define TL_WA701NDV2_GPIO_BTN_QSS 26 - -#define TL_WA701NDV2_GPIO_USB_POWER 8 - -#define TL_WA701NDV2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA701NDV2_KEYS_POLL_INTERVAL) - -static const char *tl_wa701ndv2_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wa701ndv2_flash_data = { - .part_probes = tl_wa701ndv2_part_probes, -}; - -static struct gpio_led tl_wa701ndv2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:wlan", - .gpio = TL_WA701NDV2_GPIO_LED_WLAN, - .active_low = 0, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WA701NDV2_GPIO_LED_QSS, - .active_low = 0, - }, { - .name = "tp-link:green:lan", - .gpio = TL_WA701NDV2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WA701NDV2_GPIO_LED_SYSTEM, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_wa701ndv2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA701NDV2_GPIO_BTN_RESET, - .active_low = 0, - } , { - .desc = "qss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA701NDV2_GPIO_BTN_QSS, - .active_low = 0, - } - -}; - -static void __init tl_wa701ndv2_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa701ndv2_leds_gpio), - tl_wa701ndv2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WA701NDV2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wa701ndv2_gpio_keys), - tl_wa701ndv2_gpio_keys); - - gpio_request_one(TL_WA701NDV2_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_register_m25p80(&tl_wa701ndv2_flash_data); - 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_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA701ND_V2, "TL-WA701ND-v2", - "TP-LINK TL-WA701ND v2", tl_wa701ndv2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa7210n-v2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa7210n-v2.c deleted file mode 100644 index 276353a6c..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa7210n-v2.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * TP-LINK TL-WA7210N v2.1 board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2014 Nicolas Braud-Santoni - * Copyright (C) 2014 Alexander List - * Copyright (C) 2015 Hendrik Frenzel - * - * rebased on TL-WA7510Nv1 support, - * Copyright (C) 2012 Stefan Helmert - * - * 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 "dev-dsa.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" - -#include "common.h" - -#define TL_WA7210N_V2_GPIO_BTN_RESET 11 -#define TL_WA7210N_V2_KEYS_POLL_INT 20 -#define TL_WA7210N_V2_KEYS_DEBOUNCE_INT (3 * TL_WA7210N_V2_KEYS_POLL_INT) - -#define TL_WA7210N_V2_GPIO_LED_LAN 17 -#define TL_WA7210N_V2_GPIO_LED_SIG1 0 -#define TL_WA7210N_V2_GPIO_LED_SIG2 1 -#define TL_WA7210N_V2_GPIO_LED_SIG3 27 -#define TL_WA7210N_V2_GPIO_LED_SIG4 26 - -#define TL_WA7210N_V2_GPIO_LNA_EN 28 - -static const char *tl_wa7210n_v2_part_probes[] = { - "tp-link", - NULL, -}; - -static struct gpio_keys_button tl_wa7210n_v2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WA7210N_V2_KEYS_DEBOUNCE_INT, - .gpio = TL_WA7210N_V2_GPIO_BTN_RESET, - .active_low = 0, - }, -}; - -static struct gpio_led tl_wa7210n_v2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan", - .gpio = TL_WA7210N_V2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:green:signal1", - .gpio = TL_WA7210N_V2_GPIO_LED_SIG1, - .active_low = 0, - }, { - .name = "tp-link:green:signal2", - .gpio = TL_WA7210N_V2_GPIO_LED_SIG2, - .active_low = 0, - }, { - .name = "tp-link:green:signal3", - .gpio = TL_WA7210N_V2_GPIO_LED_SIG3, - .active_low = 1, - }, { - .name = "tp-link:green:signal4", - .gpio = TL_WA7210N_V2_GPIO_LED_SIG4, - .active_low = 1, - }, -}; - -static struct flash_platform_data tl_wa7210n_v2_flash_data = { - .part_probes = tl_wa7210n_v2_part_probes, -}; - -static void __init tl_wa7210n_v2_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_gpio_keys_polled(-1, TL_WA7210N_V2_KEYS_POLL_INT, - ARRAY_SIZE(tl_wa7210n_v2_gpio_keys), - tl_wa7210n_v2_gpio_keys); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa7210n_v2_leds_gpio), - tl_wa7210n_v2_leds_gpio); - - ath79_gpio_function_enable(TL_WA7210N_V2_GPIO_LNA_EN); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_mdio(0, 0x0); - - ath79_register_wmac(ee, mac); - - ath79_register_m25p80(&tl_wa7210n_v2_flash_data); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA7210N_V2, "TL-WA7210N-v2", "TP-LINK TL-WA7210N v2", - tl_wa7210n_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa801nd-v3.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa801nd-v3.c deleted file mode 100644 index 054c14ee7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa801nd-v3.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * TP-LINK TL-WA801ND v3 adapted from TP-LINK TL-WR841N/ND v9 - * - * Copyright (C) 2014 Matthias Schiffer - * Copyright (C) 2016 Tiziano Bacocco - * - * 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_WA801NDV3_GPIO_LED_WLAN 12 -#define TL_WA801NDV3_GPIO_LED_SYSTEM 13 -#define TL_WA801NDV3_GPIO_LED_SECURITY_RED 11 -#define TL_WA801NDV3_GPIO_LED_SECURITY_GREEN 15 -#define TL_WA801NDV3_GPIO_LED_LAN 3 - -#define TL_WA801NDV3_GPIO_BTN_RESET 2 -#define TL_WA801NDV3_GPIO_BTN_WIFI 1 - -#define TL_WA801NDV3_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA801NDV3_KEYS_POLL_INTERVAL) - -static const char *tl_wa801n_v3_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wa801n_v3_flash_data = { - .part_probes = tl_wa801n_v3_part_probes, -}; - -static struct gpio_led tl_wa801n_v3_leds_gpio[] __initdata = { - { - .name = "tp-link:green:system", - .gpio = TL_WA801NDV3_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:lan", - .gpio = TL_WA801NDV3_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WA801NDV3_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "tp-link:red:security", - .gpio = TL_WA801NDV3_GPIO_LED_SECURITY_RED, - .active_low = 0, - }, { - .name = "tp-link:green:security", - .gpio = TL_WA801NDV3_GPIO_LED_SECURITY_GREEN, - .active_low = 0, - } - -}; - -static struct gpio_keys_button tl_wa801n_v3_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA801NDV3_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "WIFI button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WA801NDV3_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA801NDV3_GPIO_BTN_WIFI, - .active_low = 1, - } -}; - - -static void __init tl_ap143_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&tl_wa801n_v3_flash_data); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - ath79_init_mac(tmpmac, mac, 0); - ath79_register_wmac(ee, tmpmac); -} - -static void __init tl_wa801n_v3_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa801n_v3_leds_gpio), - tl_wa801n_v3_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WA801NDV3_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wa801n_v3_gpio_keys), - tl_wa801n_v3_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA801ND_V3, "TL-WA801ND-v3", "TP-LINK TL-WA801ND v3", - tl_wa801n_v3_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa830re-v2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa830re-v2.c deleted file mode 100644 index 1c74fed98..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa830re-v2.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * TP-LINK TL-WA830RE v2 board support - * - * Copyright (C) 2014 Fredrik Jonson - * - * 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-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TL_WA830REV2_GPIO_LED_WLAN 13 -#define TL_WA830REV2_GPIO_LED_QSS 15 -#define TL_WA830REV2_GPIO_LED_LAN 18 -#define TL_WA830REV2_GPIO_LED_SYSTEM 14 - -#define TL_WA830REV2_GPIO_BTN_RESET 17 -#define TL_WA830REV2_GPIO_SW_RFKILL 16 /* WPS for MR3420 v2 */ - -#define TL_WA830REV2_GPIO_USB_POWER 4 - -#define TL_WA830REV2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WA830REV2_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA830REV2_KEYS_POLL_INTERVAL) - -static const char *tl_wa830re_v2_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wa830re_v2_flash_data = { - .part_probes = tl_wa830re_v2_part_probes, -}; - -static struct gpio_led tl_wa830re_v2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:qss", - .gpio = TL_WA830REV2_GPIO_LED_QSS, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WA830REV2_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:lan", - .gpio = TL_WA830REV2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WA830REV2_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wa830re_v2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WA830REV2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA830REV2_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "RFKILL switch", - .type = EV_SW, - .code = KEY_RFKILL, - .debounce_interval = TL_WA830REV2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA830REV2_GPIO_SW_RFKILL, - .active_low = 0, - } -}; - -static void __init tl_ap123_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* Disable JTAG, enabling GPIOs 0-3 */ - /* Configure OBS4 line, for GPIO 4*/ - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, - AR934X_GPIO_FUNC_CLK_OBS4_EN); - - /* config gpio4 as normal gpio function */ - ath79_gpio_output_select(TL_WA830REV2_GPIO_USB_POWER, - AR934X_GPIO_OUT_GPIO); - - ath79_register_m25p80(&tl_wa830re_v2_flash_data); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - /* GMAC0 is connected to the PHY0 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -static void __init tl_wa830re_v2_setup(void) -{ - tl_ap123_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa830re_v2_leds_gpio) - 1, - tl_wa830re_v2_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WA830REV2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wa830re_v2_gpio_keys), - tl_wa830re_v2_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA830RE_V2, "TL-WA830RE-v2", "TP-LINK TL-WA830RE v2", - tl_wa830re_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd-v2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd-v2.c deleted file mode 100644 index b4fb2a9f9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd-v2.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * TP-LINK TL-WA901N/ND v2 board support - * - * Copyright (C) 2009-2012 Gabor Juhos - * Copyright (C) 2010 Pieter Hollants - * Copyright (C) 2011 Jonathan Bennett - * - * 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 "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TL_WA901ND_V2_GPIO_LED_QSS 4 -#define TL_WA901ND_V2_GPIO_LED_SYSTEM 2 -#define TL_WA901ND_V2_GPIO_LED_WLAN 9 - -#define TL_WA901ND_V2_GPIO_BTN_RESET 3 -#define TL_WA901ND_V2_GPIO_BTN_QSS 7 - -#define TL_WA901ND_V2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL \ - (3 * TL_WA901ND_V2_KEYS_POLL_INTERVAL) - -static const char *tl_wa901nd_v2_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wa901nd_v2_flash_data = { - .part_probes = tl_wa901nd_v2_part_probes, -}; - -static struct gpio_led tl_wa901nd_v2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:system", - .gpio = TL_WA901ND_V2_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WA901ND_V2_GPIO_LED_QSS, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WA901ND_V2_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_wa901nd_v2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA901ND_V2_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "qss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA901ND_V2_GPIO_BTN_QSS, - .active_low = 1, - } -}; - -static void __init tl_wa901nd_v2_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = 0x00001000; - ath79_register_mdio(0, 0x0); - - ath79_eth0_data.reset_bit = AR71XX_RESET_GE0_MAC | - AR71XX_RESET_GE0_PHY; - ath79_register_eth(0); - - ath79_register_m25p80(&tl_wa901nd_v2_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_v2_leds_gpio), - tl_wa901nd_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WA901ND_V2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wa901nd_v2_gpio_keys), - tl_wa901nd_v2_gpio_keys); - - ath79_register_wmac(eeprom, mac); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V2, "TL-WA901ND-v2", - "TP-LINK TL-WA901ND v2", tl_wa901nd_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd-v4.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd-v4.c deleted file mode 100644 index ffbcd6fe4..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd-v4.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * TP-LINK TL-WA901ND v4, v5 board - * - * Copyright (C) 2015 Matthias Schiffer - * Copyright (C) 2016 Tiziano Bacocco - * - * 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_WA901ND_V4_GPIO_LED_QSS 3 -#define TL_WA901ND_V4_GPIO_LED_LAN 7 -#define TL_WA901ND_V4_GPIO_LED_WLAN 8 -#define TL_WA901ND_V4_GPIO_LED_SYSTEM 18 - -#define TL_WA901ND_V4_GPIO_BTN_RESET 1 - -#define TL_WA901ND_V4_KEYS_POLL_INTERVAL 20 -#define TL_WA901ND_V4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA901ND_V4_KEYS_POLL_INTERVAL) - - -static struct gpio_led TL_WA901ND_V4_leds_gpio[] __initdata = { - { - .name = "tp-link:green:qss", - .gpio = TL_WA901ND_V4_GPIO_LED_QSS, - .active_low = 1, - }, - { - .name = "tp-link:green:lan", - .gpio = TL_WA901ND_V4_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "tp-link:green:wlan", - .gpio = TL_WA901ND_V4_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "tp-link:green:system", - .gpio = TL_WA901ND_V4_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button TL_WA901ND_V4_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WA901ND_V4_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA901ND_V4_GPIO_BTN_RESET, - .active_low = 1, - } -}; - - -static const char *tl_wa901nd_v4_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wa901nd_v4_flash_data = { - .part_probes = tl_wa901nd_v4_part_probes, -}; - - -static void __init TL_WA901ND_V4_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&tl_wa901nd_v4_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(TL_WA901ND_V4_leds_gpio), - TL_WA901ND_V4_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WA901ND_V4_KEYS_POLL_INTERVAL, - ARRAY_SIZE(TL_WA901ND_V4_gpio_keys), - TL_WA901ND_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_WA901ND_V4, "TL-WA901ND-v4", "TP-LINK TL-WA901ND v4", - TL_WA901ND_V4_setup); - -MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V5, "TL-WA901ND-v5", "TP-LINK TL-WA901ND v5", - TL_WA901ND_V4_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd.c deleted file mode 100644 index 957b92cba..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wa901nd.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * TP-LINK TL-WA901N/ND v1, TL-WA7510N v1 board support - * - * Copyright (C) 2009-2012 Gabor Juhos - * Copyright (C) 2010 Pieter Hollants - * Copyright (C) 2012 Stefan Helmert - * - * 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 "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 "machtypes.h" -#include "pci.h" - -#define TL_WA901ND_GPIO_LED_QSS 0 -#define TL_WA901ND_GPIO_LED_SYSTEM 1 -#define TL_WA901ND_GPIO_LED_LAN 13 - -#define TL_WA901ND_GPIO_BTN_RESET 11 -#define TL_WA901ND_GPIO_BTN_QSS 12 - -#define TL_WA901ND_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WA901ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA901ND_KEYS_POLL_INTERVAL) - -static const char *tl_wa901nd_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wa901nd_flash_data = { - .part_probes = tl_wa901nd_part_probes, -}; - -static struct gpio_led tl_wa901nd_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan", - .gpio = TL_WA901ND_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WA901ND_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WA901ND_GPIO_LED_QSS, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_wa901nd_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WA901ND_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA901ND_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "qss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WA901ND_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA901ND_GPIO_BTN_QSS, - .active_low = 1, - } -}; - -static void __init common_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - - /* - * ath79_eth0 would be the WAN port, but is not connected. - * ath79_eth1 connects to the internal switch chip, however - * we have a single LAN port only. - */ - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_mdio(0, 0x0); - ath79_register_eth(1); - - ath79_register_m25p80(&tl_wa901nd_flash_data); -} - -static void __init tl_wa901nd_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_leds_gpio), - tl_wa901nd_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WA901ND_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wa901nd_gpio_keys), - tl_wa901nd_gpio_keys); - - ap91_pci_init(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA901ND, "TL-WA901ND", "TP-LINK TL-WA901ND", - tl_wa901nd_setup); - -static void __init tl_wa7510n_v1_setup(void) -{ - common_setup(); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA7510N_V1, "TL-WA7510N", "TP-LINK TL-WA7510N v1", - tl_wa7510n_v1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wax50re.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wax50re.c deleted file mode 100644 index 955628fec..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wax50re.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Support for TP-Link boards: - * - TL-WA750RE v1 - * - TL-WA801ND v2 - * - TL-WA850RE v1/v2 - * - TL-WA855RE v1 - * - TL-WA901ND v3 - * - * Copyright (C) 2013 Martijn Zilverschoon - * Copyright (C) 2013 Jiri Pirko - * Copyright (C) 2017 Piotr Dymacz - * Copyright (C) 2017 Federico Cappon - * Copyright (C) 2017 Nicolò Veronese - * - * 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_WAX50RE_GPIO_LED_LAN 20 -#define TL_WAX50RE_GPIO_LED_WLAN 13 -#define TL_WAX50RE_GPIO_LED_RE 15 -#define TL_WAX50RE_GPIO_LED_SIGNAL1 0 -#define TL_WAX50RE_GPIO_LED_SIGNAL2 1 -#define TL_WAX50RE_GPIO_LED_SIGNAL3 2 -#define TL_WAX50RE_GPIO_LED_SIGNAL4 3 -#define TL_WAX50RE_GPIO_LED_SIGNAL5 4 - -#define TL_WA850RE_V2_GPIO_LED_LAN 14 -#define TL_WA850RE_V2_GPIO_LED_RE 12 -#define TL_WA850RE_V2_GPIO_LED_SIGNAL1 0 -#define TL_WA850RE_V2_GPIO_LED_SIGNAL2 1 -#define TL_WA850RE_V2_GPIO_LED_SIGNAL3 2 -#define TL_WA850RE_V2_GPIO_LED_SIGNAL4 3 -#define TL_WA850RE_V2_GPIO_LED_SIGNAL5 4 -#define TL_WA850RE_V2_GPIO_LED_WLAN 13 - -#define TL_WA850RE_V2_GPIO_ENABLE_LEDS 15 - -#define TL_WA855REV1_GPIO_LED_RED 11 -#define TL_WA855REV1_GPIO_LED_GREEN 12 - -#define TL_WA860RE_GPIO_LED_WLAN_ORANGE 0 -#define TL_WA860RE_GPIO_LED_WLAN_GREEN 2 -#define TL_WA860RE_GPIO_LED_POWER_ORANGE 12 -#define TL_WA860RE_GPIO_LED_POWER_GREEN 14 -#define TL_WA860RE_GPIO_LED_LAN 20 - -#define TL_WA801ND_V2_GPIO_LED_LAN 18 -#define TL_WA801ND_V2_GPIO_LED_SYSTEM 14 - -#define TL_WAX50RE_GPIO_BTN_RESET 17 -#define TL_WAX50RE_GPIO_BTN_WPS 16 - -#define TL_WA860RE_GPIO_BTN_RESET 17 -#define TL_WA860RE_GPIO_BTN_WPS 16 -#define TL_WA860RE_GPIO_BTN_ONOFF 11 - -#define TL_WAX50RE_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL (3 * TL_WAX50RE_KEYS_POLL_INTERVAL) - -static const char *tl_wax50re_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wax50re_flash_data = { - .part_probes = tl_wax50re_part_probes, -}; - -static struct gpio_led tl_wa750re_leds_gpio[] __initdata = { - { - .name = "tp-link:orange:lan", - .gpio = TL_WAX50RE_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:orange:wlan", - .gpio = TL_WAX50RE_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "tp-link:orange:re", - .gpio = TL_WAX50RE_GPIO_LED_RE, - .active_low = 1, - }, { - .name = "tp-link:orange:signal1", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL1, - .active_low = 1, - }, { - .name = "tp-link:orange:signal2", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL2, - .active_low = 1, - }, { - .name = "tp-link:orange:signal3", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL3, - .active_low = 1, - }, { - .name = "tp-link:orange:signal4", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL4, - .active_low = 1, - }, { - .name = "tp-link:orange:signal5", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL5, - .active_low = 1, - }, -}; - -static struct gpio_led tl_wa850re_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:lan", - .gpio = TL_WAX50RE_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:blue:wlan", - .gpio = TL_WAX50RE_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "tp-link:blue:re", - .gpio = TL_WAX50RE_GPIO_LED_RE, - .active_low = 1, - }, { - .name = "tp-link:blue:signal1", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL1, - .active_low = 1, - }, { - .name = "tp-link:blue:signal2", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL2, - .active_low = 1, - }, { - .name = "tp-link:blue:signal3", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL3, - .active_low = 1, - }, { - .name = "tp-link:blue:signal4", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL4, - .active_low = 1, - }, { - .name = "tp-link:blue:signal5", - .gpio = TL_WAX50RE_GPIO_LED_SIGNAL5, - .active_low = 1, - }, -}; - -static struct gpio_led tl_wa850re_v2_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:lan", - .gpio = TL_WA850RE_V2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:blue:re", - .gpio = TL_WA850RE_V2_GPIO_LED_RE, - .active_low = 1, - }, { - .name = "tp-link:blue:signal1", - .gpio = TL_WA850RE_V2_GPIO_LED_SIGNAL1, - .active_low = 1, - }, { - .name = "tp-link:blue:signal2", - .gpio = TL_WA850RE_V2_GPIO_LED_SIGNAL2, - .active_low = 1, - }, { - .name = "tp-link:blue:signal3", - .gpio = TL_WA850RE_V2_GPIO_LED_SIGNAL3, - .active_low = 1, - }, { - .name = "tp-link:blue:signal4", - .gpio = TL_WA850RE_V2_GPIO_LED_SIGNAL4, - .active_low = 1, - }, { - .name = "tp-link:blue:signal5", - .gpio = TL_WA850RE_V2_GPIO_LED_SIGNAL5, - .active_low = 1, - }, { - .name = "tp-link:blue:wlan", - .gpio = TL_WA850RE_V2_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_led tl_wa855re_v1_leds_gpio[] __initdata = { - { - .name = "tp-link:green:power", - .gpio = TL_WA855REV1_GPIO_LED_GREEN, - .active_low = 0, - }, { - .name = "tp-link:red:power", - .gpio = TL_WA855REV1_GPIO_LED_RED, - .active_low = 0, - }, -}; - -static struct gpio_led tl_wa860re_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan", - .gpio = TL_WA860RE_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:green:power", - .gpio = TL_WA860RE_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, { - .name = "tp-link:orange:power", - .gpio = TL_WA860RE_GPIO_LED_POWER_ORANGE, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WA860RE_GPIO_LED_WLAN_GREEN, - .active_low = 1, - }, { - .name = "tp-link:orange:wlan", - .gpio = TL_WA860RE_GPIO_LED_WLAN_ORANGE, - .active_low = 1, - }, -}; - - -static struct gpio_keys_button tl_wax50re_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WAX50RE_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "WPS", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WAX50RE_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wa860re_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA860RE_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "WPS", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA860RE_GPIO_BTN_WPS, - .active_low = 1, - }, { - .desc = "ONOFF", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WA860RE_GPIO_BTN_ONOFF, - .active_low = 1, - }, -}; - -static struct gpio_led tl_wa801nd_v2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan", - .gpio = TL_WA801ND_V2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WAX50RE_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WAX50RE_GPIO_LED_RE, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WA801ND_V2_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static void __init tl_ap123_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&tl_wax50re_flash_data); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -static void __init tl_ap143_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f3c0008); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -2); - ath79_register_eth(0); - - ath79_init_mac(tmpmac, mac, 0); - ath79_register_wmac(ee, mac); -} - -static void __init tl_wa750re_setup(void) -{ - tl_ap123_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa750re_leds_gpio), - tl_wa750re_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wax50re_gpio_keys), - tl_wax50re_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA750RE, "TL-WA750RE", "TP-LINK TL-WA750RE", - tl_wa750re_setup); - -static void __init tl_wa801nd_v2_setup(void) -{ - tl_ap123_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa801nd_v2_leds_gpio), - tl_wa801nd_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wax50re_gpio_keys), - tl_wax50re_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA801ND_V2, "TL-WA801ND-v2", "TP-LINK TL-WA801ND v2", - tl_wa801nd_v2_setup); - -static void __init tl_wa850re_setup(void) -{ - tl_ap123_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa850re_leds_gpio), - tl_wa850re_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wax50re_gpio_keys), - tl_wax50re_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA850RE, "TL-WA850RE", "TP-LINK TL-WA850RE", - tl_wa850re_setup); - -static void __init tl_wa850re_v2_setup(void) -{ - tl_ap143_setup(); - - /* For GPIO 0~4 */ - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, - AR934X_GPIO_FUNC_CLK_OBS4_EN); - - /* Allow to enable/disable all LEDs from userspace */ - gpio_request_one(TL_WA850RE_V2_GPIO_ENABLE_LEDS, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "LEDs enable"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa850re_v2_leds_gpio), - tl_wa850re_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wax50re_gpio_keys), - tl_wax50re_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA850RE_V2, "TL-WA850RE-V2", - "TP-LINK TL-WA850RE v2", tl_wa850re_v2_setup); - -static void __init tl_wa855re_v1_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa855re_v1_leds_gpio), - tl_wa855re_v1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wax50re_gpio_keys), - tl_wax50re_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA855RE_V1, "TL-WA855RE-v1", "TP-LINK TL-WA855RE v1", - tl_wa855re_v1_setup); - -static void __init tl_wa860re_setup(void) -{ - tl_ap123_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa860re_leds_gpio), - tl_wa860re_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wa860re_gpio_keys), - tl_wa860re_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA860RE, "TL-WA860RE", "TP-LINK TL-WA860RE", - tl_wa860re_setup); - -static void __init tl_wa901nd_v3_setup(void) -{ - tl_ap123_setup(); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa801nd_v2_leds_gpio), - tl_wa801nd_v2_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WAX50RE_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wax50re_gpio_keys) - 1, - tl_wax50re_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V3, "TL-WA901ND-v3", "TP-LINK TL-WA901ND v3", - tl_wa901nd_v3_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr3320-v2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr3320-v2.c deleted file mode 100644 index 3e452f2a4..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr3320-v2.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * TP-LINK TL-WDR3320 v2 board support - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2015 Weijie Gao - * - * 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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WDR3320_GPIO_LED_WLAN5G 12 -#define WDR3320_GPIO_LED_SYSTEM 14 -#define WDR3320_GPIO_LED_QSS 15 -#define WDR3320_GPIO_LED_WAN 4 -#define WDR3320_GPIO_LED_LAN1 18 -#define WDR3320_GPIO_LED_LAN2 20 -#define WDR3320_GPIO_LED_LAN3 21 -#define WDR3320_GPIO_LED_LAN4 22 - -#define WDR3320_GPIO_BTN_RESET 16 - -#define WDR3320_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WDR3320_KEYS_DEBOUNCE_INTERVAL (3 * WDR3320_KEYS_POLL_INTERVAL) - -#define WDR3320_WMAC_CALDATA_OFFSET 0x1000 -#define WDR3320_PCIE_CALDATA_OFFSET 0x5000 - -static const char *wdr3320_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data wdr3320_flash_data = { - .part_probes = wdr3320_part_probes, -}; - -static struct gpio_led wdr3320_leds_gpio[] __initdata = { - { - .name = "tp-link:green:qss", - .gpio = WDR3320_GPIO_LED_QSS, - .active_low = 1, - }, - { - .name = "tp-link:green:system", - .gpio = WDR3320_GPIO_LED_SYSTEM, - .active_low = 1, - }, - { - .name = "tp-link:green:wlan5g", - .gpio = WDR3320_GPIO_LED_WLAN5G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wdr3320_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WDR3320_KEYS_DEBOUNCE_INTERVAL, - .gpio = WDR3320_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init wdr3320_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&wdr3320_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(wdr3320_leds_gpio), - wdr3320_leds_gpio); - ath79_register_gpio_keys_polled(-1, WDR3320_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wdr3320_gpio_keys), - wdr3320_gpio_keys); - - ath79_init_mac(tmpmac, mac, 0); - ath79_register_wmac(art + WDR3320_WMAC_CALDATA_OFFSET, tmpmac); - - ath79_init_mac(tmpmac, mac, -1); - ap9x_pci_setup_wmac_led_pin(0, 0); - ap91_pci_init(art + WDR3320_PCIE_CALDATA_OFFSET, tmpmac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - - /* LAN */ - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - - ath79_register_eth(1); - - /* WAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - - /* GMAC0 is connected to the PHY4 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - - ath79_register_eth(0); - - ath79_register_usb(); - - ath79_gpio_output_select(WDR3320_GPIO_LED_LAN1, - AR934X_GPIO_OUT_LED_LINK0); - ath79_gpio_output_select(WDR3320_GPIO_LED_LAN2, - AR934X_GPIO_OUT_LED_LINK1); - ath79_gpio_output_select(WDR3320_GPIO_LED_LAN3, - AR934X_GPIO_OUT_LED_LINK2); - ath79_gpio_output_select(WDR3320_GPIO_LED_LAN4, - AR934X_GPIO_OUT_LED_LINK3); - ath79_gpio_output_select(WDR3320_GPIO_LED_WAN, - AR934X_GPIO_OUT_LED_LINK4); -} - -MIPS_MACHINE(ATH79_MACH_TL_WDR3320_V2, "TL-WDR3320-v2", - "TP-LINK TL-WDR3320 v2", - wdr3320_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr3500.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr3500.c deleted file mode 100644 index 452c20b77..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr3500.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * TP-LINK TL-WDR3500 board support - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2013 Gui Iribarren - * - * 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 "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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WDR3500_GPIO_LED_USB 11 -#define WDR3500_GPIO_LED_WLAN2G 13 -#define WDR3500_GPIO_LED_SYSTEM 14 -#define WDR3500_GPIO_LED_QSS 15 -#define WDR3500_GPIO_LED_WAN 18 -#define WDR3500_GPIO_LED_LAN1 19 -#define WDR3500_GPIO_LED_LAN2 20 -#define WDR3500_GPIO_LED_LAN3 21 -#define WDR3500_GPIO_LED_LAN4 22 - -#define WDR3500_GPIO_BTN_WPS 16 -#define WDR3500_GPIO_BTN_RFKILL 17 - -#define WDR3500_GPIO_USB_POWER 12 - -#define WDR3500_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WDR3500_KEYS_DEBOUNCE_INTERVAL (3 * WDR3500_KEYS_POLL_INTERVAL) - -#define WDR3500_MAC0_OFFSET 0 -#define WDR3500_MAC1_OFFSET 6 -#define WDR3500_WMAC_CALDATA_OFFSET 0x1000 -#define WDR3500_PCIE_CALDATA_OFFSET 0x5000 - -static const char *wdr3500_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data wdr3500_flash_data = { - .part_probes = wdr3500_part_probes, -}; - -static struct gpio_led wdr3500_leds_gpio[] __initdata = { - { - .name = "tp-link:green:qss", - .gpio = WDR3500_GPIO_LED_QSS, - .active_low = 1, - }, - { - .name = "tp-link:green:system", - .gpio = WDR3500_GPIO_LED_SYSTEM, - .active_low = 1, - }, - { - .name = "tp-link:green:usb", - .gpio = WDR3500_GPIO_LED_USB, - .active_low = 1, - }, - { - .name = "tp-link:green:wlan2g", - .gpio = WDR3500_GPIO_LED_WLAN2G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wdr3500_gpio_keys[] __initdata = { - { - .desc = "QSS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WDR3500_KEYS_DEBOUNCE_INTERVAL, - .gpio = WDR3500_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "RFKILL switch", - .type = EV_SW, - .code = KEY_RFKILL, - .debounce_interval = WDR3500_KEYS_DEBOUNCE_INTERVAL, - .gpio = WDR3500_GPIO_BTN_RFKILL, - }, -}; - - -static void __init wdr3500_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&wdr3500_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(wdr3500_leds_gpio), - wdr3500_leds_gpio); - ath79_register_gpio_keys_polled(-1, WDR3500_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wdr3500_gpio_keys), - wdr3500_gpio_keys); - - ath79_init_mac(tmpmac, mac, 0); - ath79_register_wmac(art + WDR3500_WMAC_CALDATA_OFFSET, tmpmac); - - ath79_init_mac(tmpmac, mac, 1); - ap9x_pci_setup_wmac_led_pin(0, 0); - ap91_pci_init(art + WDR3500_PCIE_CALDATA_OFFSET, tmpmac); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_register_mdio(1, 0x0); - - /* LAN */ - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - - ath79_register_eth(1); - - /* WAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 2); - - /* GMAC0 is connected to the PHY4 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - - ath79_register_eth(0); - - gpio_request_one(WDR3500_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_gpio_output_select(WDR3500_GPIO_LED_LAN1, - AR934X_GPIO_OUT_LED_LINK3); - ath79_gpio_output_select(WDR3500_GPIO_LED_LAN2, - AR934X_GPIO_OUT_LED_LINK2); - ath79_gpio_output_select(WDR3500_GPIO_LED_LAN3, - AR934X_GPIO_OUT_LED_LINK1); - ath79_gpio_output_select(WDR3500_GPIO_LED_LAN4, - AR934X_GPIO_OUT_LED_LINK0); - ath79_gpio_output_select(WDR3500_GPIO_LED_WAN, - AR934X_GPIO_OUT_LED_LINK4); -} - -MIPS_MACHINE(ATH79_MACH_TL_WDR3500, "TL-WDR3500", - "TP-LINK TL-WDR3500", - wdr3500_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr6500-v2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr6500-v2.c deleted file mode 100644 index 1e7247764..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr6500-v2.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * TP-LINK TL-WDR6500 v2 - * - * Copyright (C) 2015 Weijie Gao - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-ap9x-pci.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" -#include "pci.h" - -#define TL_WDR6500_V2_GPIO_LED_SYS 21 -#define TL_WDR6500_V2_GPIO_LED_WAN 18 -#define TL_WDR6500_V2_GPIO_LED_LAN1 17 -#define TL_WDR6500_V2_GPIO_LED_LAN2 16 -#define TL_WDR6500_V2_GPIO_LED_LAN3 15 -#define TL_WDR6500_V2_GPIO_LED_LAN4 14 - -#define TL_WDR6500_V2_GPIO_BTN_RESET 1 - -#define TL_WDR6500_V2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WDR6500_V2_KEYS_DEBOUNCE_INTERVAL (3 * TL_WDR6500_V2_KEYS_POLL_INTERVAL) - -#define TL_WDR6500_V2_WMAC_CALDATA_OFFSET 0x1000 -#define TL_WDR6500_V2_PCIE_CALDATA_OFFSET 0x5000 - -static const char *tl_wdr6500_v2_part_probes[] = { - "tp-link-64k", - NULL, -}; - -static struct flash_platform_data tl_wdr6500_v2_flash_data = { - .part_probes = tl_wdr6500_v2_part_probes, -}; - -static struct gpio_led tl_wdr6500_v2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WDR6500_V2_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WDR6500_V2_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WDR6500_V2_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WDR6500_V2_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WDR6500_V2_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "tp-link:white:system", - .gpio = TL_WDR6500_V2_GPIO_LED_SYS, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tl_wdr6500_v2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WDR6500_V2_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WDR6500_V2_GPIO_BTN_RESET, - .active_low = 1, - } -}; - - -static void __init tl_ap151_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f00fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&tl_wdr6500_v2_flash_data); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(1, 0x0); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - /* LAN */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.speed = SPEED_1000; - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_eth(1); - - ath79_init_mac(tmpmac, mac, -1); - ath79_register_wmac(ee + TL_WDR6500_V2_WMAC_CALDATA_OFFSET, tmpmac); - - ath79_register_pci(); - - ath79_register_usb(); -} - -static void __init tl_wdr6500_v2_setup(void) -{ - tl_ap151_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wdr6500_v2_leds_gpio), - tl_wdr6500_v2_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WDR6500_V2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wdr6500_v2_gpio_keys), - tl_wdr6500_v2_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WDR6500_V2, "TL-WDR6500-v2", "TP-LINK TL-WDR6500 v2", - tl_wdr6500_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdx6501-v7.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdx6501-v7.c deleted file mode 100644 index 4b9a8d4fb..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdx6501-v7.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * TP-LINK TL-WDX6501 v7 - * - * Copyright (C) 2015 Weijie Gao - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-ap9x-pci.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" -#include "pci.h" - -#define TL_WDX6501_V7_GPIO_LED_SYS 21 -#define TL_WDX6501_V7_GPIO_LED_WAN 18 -#define TL_WDX6501_V7_GPIO_LED_LAN1 17 -#define TL_WDX6501_V7_GPIO_LED_LAN2 16 -#define TL_WDX6501_V7_GPIO_LED_LAN3 15 -#define TL_WDX6501_V7_GPIO_LED_LAN4 14 - -#define TL_WDX6501_V7_GPIO_BTN_RESET 1 - -#define TL_WDX6501_V7_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WDX6501_V7_KEYS_DEBOUNCE_INTERVAL (3 * TL_WDX6501_V7_KEYS_POLL_INTERVAL) - -#define TL_WDX6501_V7_MAC0_OFFSET 0 -#define TL_WDX6501_V7_WMAC_CALDATA_OFFSET 0x1000 -#define TL_WDX6501_V7_PCIE_CALDATA_OFFSET 0x2000 - -static const char *tl_wdx6501_v7_part_probes[] = { - "tp-link-64k", - NULL, -}; - -static struct flash_platform_data tl_wdx6501_v7_flash_data = { - .part_probes = tl_wdx6501_v7_part_probes, -}; - -static struct gpio_led tl_wdx6501_v7_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WDX6501_V7_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WDX6501_V7_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WDX6501_V7_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WDX6501_V7_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WDX6501_V7_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "tp-link:white:system", - .gpio = TL_WDX6501_V7_GPIO_LED_SYS, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tl_wdx6501_v7_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WDX6501_V7_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WDX6501_V7_GPIO_BTN_RESET, - .active_low = 1, - } -}; - - -static void __init tl_ap151_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&tl_wdx6501_v7_flash_data); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(1, 0x0); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_init_mac(ath79_eth0_data.mac_addr, art + TL_WDX6501_V7_MAC0_OFFSET, 0); - ath79_register_eth(0); - - /* LAN */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.speed = SPEED_1000; - ath79_init_mac(ath79_eth1_data.mac_addr, art + TL_WDX6501_V7_MAC0_OFFSET, -1); - ath79_register_eth(1); - - ath79_register_wmac(art + TL_WDX6501_V7_WMAC_CALDATA_OFFSET, NULL); - - ap91_pci_init(art + TL_WDX6501_V7_PCIE_CALDATA_OFFSET, NULL); -} - -static void __init tl_wdx6501_v7_setup(void) -{ - tl_ap151_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wdx6501_v7_leds_gpio), - tl_wdx6501_v7_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WDX6501_V7_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wdx6501_v7_gpio_keys), - tl_wdx6501_v7_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WDX6501_V7, "TL-WDX6501-v7", "TP-LINK TL-WDX6501 v7", - tl_wdx6501_v7_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1043nd.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1043nd.c deleted file mode 100644 index 4e4b85d73..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1043nd.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * TP-LINK TL-WR1043N/ND 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 - -#include -#include - -#include "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TL_WR1043ND_GPIO_LED_USB 1 -#define TL_WR1043ND_GPIO_LED_SYSTEM 2 -#define TL_WR1043ND_GPIO_LED_QSS 5 -#define TL_WR1043ND_GPIO_LED_WLAN 9 - -#define TL_WR1043ND_GPIO_BTN_RESET 3 -#define TL_WR1043ND_GPIO_BTN_QSS 7 - -#define TL_WR1043ND_GPIO_RTL8366_SDA 18 -#define TL_WR1043ND_GPIO_RTL8366_SCK 19 - -#define TL_WR1043ND_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR1043ND_KEYS_POLL_INTERVAL) - -static const char *tl_wr1043nd_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr1043nd_flash_data = { - .part_probes = tl_wr1043nd_part_probes, -}; - -static struct gpio_led tl_wr1043nd_leds_gpio[] __initdata = { - { - .name = "tp-link:green:usb", - .gpio = TL_WR1043ND_GPIO_LED_USB, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WR1043ND_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR1043ND_GPIO_LED_QSS, - .active_low = 0, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR1043ND_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_wr1043nd_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR1043ND_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "qss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR1043ND_GPIO_BTN_QSS, - .active_low = 1, - } -}; - -static void tl_wr1043nd_rtl8366rb_hw_reset(struct rtl8366_smi *smi, bool active) -{ - if (active) - ath79_device_reset_set(AR71XX_RESET_GE0_PHY); - else - ath79_device_reset_clear(AR71XX_RESET_GE0_PHY); -} - -static struct rtl8366_platform_data tl_wr1043nd_rtl8366rb_data = { - .gpio_sda = TL_WR1043ND_GPIO_RTL8366_SDA, - .gpio_sck = TL_WR1043ND_GPIO_RTL8366_SCK, - .hw_reset = tl_wr1043nd_rtl8366rb_hw_reset, -}; - -static struct platform_device tl_wr1043nd_rtl8366rb_device = { - .name = RTL8366RB_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &tl_wr1043nd_rtl8366rb_data, - } -}; - -static void __init tl_wr1043nd_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - tl_wr1043nd_rtl8366rb_hw_reset(NULL, true); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.mii_bus_dev = &tl_wr1043nd_rtl8366rb_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_pll_data.pll_1000 = 0x1a000000; - - ath79_register_eth(0); - - ath79_register_usb(); - - ath79_register_m25p80(&tl_wr1043nd_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_leds_gpio), - tl_wr1043nd_leds_gpio); - - platform_device_register(&tl_wr1043nd_rtl8366rb_device); - - ath79_register_gpio_keys_polled(-1, TL_WR1043ND_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr1043nd_gpio_keys), - tl_wr1043nd_gpio_keys); - - ath79_register_wmac(eeprom, mac); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR1043ND, "TL-WR1043ND", "TP-LINK TL-WR1043ND", - tl_wr1043nd_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr2543n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr2543n.c deleted file mode 100644 index 141914aa2..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr2543n.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * TP-LINK TL-WR2543N/ND board support - * - * Copyright (C) 2011-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 "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" - -#define TL_WR2543N_GPIO_LED_WPS 0 -#define TL_WR2543N_GPIO_LED_USB 8 - -/* The WLAN LEDs use GPIOs on the discrete AR9380 wmac */ -#define TL_WR2543N_GPIO_WMAC_LED_WLAN2G 0 -#define TL_WR2543N_GPIO_WMAC_LED_WLAN5G 1 - -#define TL_WR2543N_GPIO_BTN_RESET 11 -#define TL_WR2543N_GPIO_BTN_WPS 12 - -#define TL_WR2543N_GPIO_RTL8367_SDA 1 -#define TL_WR2543N_GPIO_RTL8367_SCK 6 - -#define TL_WR2543N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR2543N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR2543N_KEYS_POLL_INTERVAL) - -static const char *tl_wr2543n_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr2543n_flash_data = { - .part_probes = tl_wr2543n_part_probes, -}; - -static struct gpio_led tl_wr2543n_leds_gpio[] __initdata = { - { - .name = "tp-link:green:usb", - .gpio = TL_WR2543N_GPIO_LED_USB, - .active_low = 1, - }, { - .name = "tp-link:green:wps", - .gpio = TL_WR2543N_GPIO_LED_WPS, - .active_low = 1, - } -}; - -static struct gpio_led tl_wr2543n_wmac_leds_gpio[] = { - { - .name = "tp-link:green:wlan2g", - .gpio = TL_WR2543N_GPIO_WMAC_LED_WLAN2G, - .active_low = 1, - }, - { - .name = "tp-link:green:wlan5g", - .gpio = TL_WR2543N_GPIO_WMAC_LED_WLAN5G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr2543n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR2543N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR2543N_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR2543N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR2543N_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static struct rtl8367_extif_config tl_wr2543n_rtl8367_extif0_cfg = { - .mode = RTL8367_EXTIF_MODE_RGMII, - .txdelay = 1, - .rxdelay = 0, - .ability = { - .force_mode = 1, - .txpause = 1, - .rxpause = 1, - .link = 1, - .duplex = 1, - .speed = RTL8367_PORT_SPEED_1000, - }, -}; - -static struct rtl8367_platform_data tl_wr2543n_rtl8367_data = { - .gpio_sda = TL_WR2543N_GPIO_RTL8367_SDA, - .gpio_sck = TL_WR2543N_GPIO_RTL8367_SCK, - .extif0_cfg = &tl_wr2543n_rtl8367_extif0_cfg, -}; - -static struct platform_device tl_wr2543n_rtl8367_device = { - .name = RTL8367_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &tl_wr2543n_rtl8367_data, - } -}; - -static void __init tl_wr2543n_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&tl_wr2543n_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr2543n_leds_gpio), - tl_wr2543n_leds_gpio); - ath79_register_gpio_keys_polled(-1, TL_WR2543N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr2543n_gpio_keys), - tl_wr2543n_gpio_keys); - ath79_register_usb(); - - ap9x_pci_setup_wmac_leds(0, tl_wr2543n_wmac_leds_gpio, - ARRAY_SIZE(tl_wr2543n_wmac_leds_gpio)); - ap91_pci_init(eeprom, mac); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1); - ath79_eth0_data.mii_bus_dev = &tl_wr2543n_rtl8367_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_pll_data.pll_1000 = 0x1a000000; - - ath79_register_eth(0); - - platform_device_register(&tl_wr2543n_rtl8367_device); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR2543N, "TL-WR2543N", "TP-LINK TL-WR2543N/ND", - tl_wr2543n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr703n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr703n.c deleted file mode 100644 index 1d8d01cc6..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr703n.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * TP-LINK TL-WR703N/TL-MR10U board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-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 "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 TL_WR703N_GPIO_LED_SYSTEM 27 -#define TL_WR703N_GPIO_BTN_RESET 11 - -#define TL_WR703N_GPIO_USB_POWER 8 - -#define TL_MR10U_GPIO_USB_POWER 18 - -#define TL_WR703N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR703N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR703N_KEYS_POLL_INTERVAL) - -static const char *tl_wr703n_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr703n_flash_data = { - .part_probes = tl_wr703n_part_probes, -}; - -static struct gpio_led tl_wr703n_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:system", - .gpio = TL_WR703N_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr703n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR703N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR703N_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init common_setup(unsigned usb_power_gpio, bool sec_ethernet) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_m25p80(&tl_wr703n_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr703n_leds_gpio), - tl_wr703n_leds_gpio); - ath79_register_gpio_keys_polled(-1, TL_WR703N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr703n_gpio_keys), - tl_wr703n_gpio_keys); - - gpio_request_one(usb_power_gpio, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - - if (sec_ethernet) - { - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - ath79_register_eth(1); - } - - ath79_register_wmac(ee, mac); -} - -static void __init tl_mr10u_setup(void) -{ - common_setup(TL_MR10U_GPIO_USB_POWER, false); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR10U, "TL-MR10U", "TP-LINK TL-MR10U", - tl_mr10u_setup); - -static void __init tl_wr703n_setup(void) -{ - common_setup(TL_WR703N_GPIO_USB_POWER, false); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR703N, "TL-WR703N", "TP-LINK TL-WR703N v1", - tl_wr703n_setup); - -static void __init tl_wr710n_setup(void) -{ - common_setup(TL_WR703N_GPIO_USB_POWER, true); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR710N, "TL-WR710N", "TP-LINK TL-WR710N v1", - tl_wr710n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr720n-v3.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr720n-v3.c deleted file mode 100644 index 2bb3b44a7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr720n-v3.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * TP-LINK TL-WR720N board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-2012 Gabor Juhos - * Copyright (C) 2013 yousong - * - * 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 "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 TL_WR720N_GPIO_LED_SYSTEM 27 -#define TL_WR720N_GPIO_BTN_RESET 11 -#define TL_WR720N_GPIO_BTN_SW1 18 -#define TL_WR720N_GPIO_BTN_SW2 20 - -#define TL_WR720N_GPIO_USB_POWER 8 - -#define TL_WR720N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR720N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR720N_KEYS_POLL_INTERVAL) - -static const char *tl_wr720n_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr720n_flash_data = { - .part_probes = tl_wr720n_part_probes, -}; - -static struct gpio_led tl_wr720n_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:system", - .gpio = TL_WR720N_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr720n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR720N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR720N_GPIO_BTN_RESET, - .active_low = 0, - }, { - .desc = "sw1", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = TL_WR720N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR720N_GPIO_BTN_SW1, - .active_low = 0, - }, { - .desc = "sw2", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = TL_WR720N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR720N_GPIO_BTN_SW2, - .active_low = 0, - } -}; - -static void __init tl_wr720n_v3_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_m25p80(&tl_wr720n_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr720n_leds_gpio), - tl_wr720n_leds_gpio); - ath79_register_gpio_keys_polled(-1, TL_WR720N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr720n_gpio_keys), - tl_wr720n_gpio_keys); - - gpio_request_one(TL_WR720N_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR720N_V3, "TL-WR720N-v3", "TP-LINK TL-WR720N v3/v4", - tl_wr720n_v3_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr741nd-v4.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr741nd-v4.c deleted file mode 100644 index 851b7624f..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr741nd-v4.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * TP-LINK TL-WR741ND v4/TL-MR3220 v2 board support - * - * Copyright (C) 2011-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 "common.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 TL_WR741NDV4_GPIO_BTN_RESET 11 -#define TL_WR741NDV4_GPIO_BTN_WPS 26 - -#define TL_WR741NDV4_GPIO_LED_WLAN 0 -#define TL_WR741NDV4_GPIO_LED_QSS 1 -#define TL_WR741NDV4_GPIO_LED_WAN 13 -#define TL_WR741NDV4_GPIO_LED_LAN1 14 -#define TL_WR741NDV4_GPIO_LED_LAN2 15 -#define TL_WR741NDV4_GPIO_LED_LAN3 16 -#define TL_WR741NDV4_GPIO_LED_LAN4 17 -#define TL_WR741NDV4_GPIO_LED_SYSTEM 27 - -#define TL_MR3220V2_GPIO_BTN_WPS 11 -#define TL_MR3220V2_GPIO_BTN_WIFI 24 - -#define TL_MR3220V2_GPIO_LED_3G 26 -#define TL_MR3220V2_GPIO_USB_POWER 8 - -#define TL_WR741NDV4_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR741NDV4_KEYS_POLL_INTERVAL) - -static const char *tl_wr741ndv4_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr741ndv4_flash_data = { - .part_probes = tl_wr741ndv4_part_probes, -}; - -static struct gpio_led tl_wr741ndv4_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WR741NDV4_GPIO_LED_LAN1, - .active_low = 0, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WR741NDV4_GPIO_LED_LAN2, - .active_low = 0, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WR741NDV4_GPIO_LED_LAN3, - .active_low = 0, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WR741NDV4_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR741NDV4_GPIO_LED_QSS, - .active_low = 0, - }, { - .name = "tp-link:green:system", - .gpio = TL_WR741NDV4_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR741NDV4_GPIO_LED_WAN, - .active_low = 0, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR741NDV4_GPIO_LED_WLAN, - .active_low = 0, - }, { - /* the 3G LED is only present on the MR3220 v2 */ - .name = "tp-link:green:3g", - .gpio = TL_MR3220V2_GPIO_LED_3G, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tl_wr741ndv4_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR741NDV4_GPIO_BTN_RESET, - .active_low = 0, - }, { - .desc = "WPS", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR741NDV4_GPIO_BTN_WPS, - .active_low = 0, - } -}; - -static struct gpio_keys_button tl_mr3220v2_gpio_keys[] __initdata = { - { - .desc = "WPS", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3220V2_GPIO_BTN_WPS, - .active_low = 0, - }, { - .desc = "WIFI button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WR741NDV4_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_MR3220V2_GPIO_BTN_WIFI, - .active_low = 0, - } -}; - -static void __init tl_ap121_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_setup_ar933x_phy4_switch(true, true); - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_m25p80(&tl_wr741ndv4_flash_data); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(1); - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -static void __init tl_wr741ndv4_setup(void) -{ - tl_ap121_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr741ndv4_leds_gpio) - 1, - tl_wr741ndv4_leds_gpio); - ath79_register_gpio_keys_polled(1, TL_WR741NDV4_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr741ndv4_gpio_keys), - tl_wr741ndv4_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR741ND_V4, "TL-WR741ND-v4", - "TP-LINK TL-WR741ND v4", tl_wr741ndv4_setup); - -static void __init tl_mr3220v2_setup(void) -{ - tl_ap121_setup(); - - gpio_request_one(TL_MR3220V2_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr741ndv4_leds_gpio), - tl_wr741ndv4_leds_gpio); - ath79_register_gpio_keys_polled(1, TL_WR741NDV4_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_mr3220v2_gpio_keys), - tl_mr3220v2_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR3220_V2, "TL-MR3220-v2", - "TP-LINK TL-MR3220 v2", tl_mr3220v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr741nd.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr741nd.c deleted file mode 100644 index 5931654bb..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr741nd.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * TP-LINK TL-WR741ND 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 - -#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 "machtypes.h" - -#define TL_WR741ND_GPIO_LED_QSS 0 -#define TL_WR741ND_GPIO_LED_SYSTEM 1 -#define TL_WR741ND_GPIO_LED_LAN1 13 -#define TL_WR741ND_GPIO_LED_LAN2 14 -#define TL_WR741ND_GPIO_LED_LAN3 15 -#define TL_WR741ND_GPIO_LED_LAN4 16 -#define TL_WR741ND_GPIO_LED_WAN 17 - -#define TL_WR741ND_GPIO_BTN_RESET 11 -#define TL_WR741ND_GPIO_BTN_QSS 12 - -#define TL_WR741ND_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR741ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR741ND_KEYS_POLL_INTERVAL) - -static const char *tl_wr741nd_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr741nd_flash_data = { - .part_probes = tl_wr741nd_part_probes, -}; - -static struct gpio_led tl_wr741nd_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WR741ND_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WR741ND_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WR741ND_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WR741ND_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR741ND_GPIO_LED_QSS, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WR741ND_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR741ND_GPIO_LED_WAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr741nd_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR741ND_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR741ND_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "qss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR741ND_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR741ND_GPIO_BTN_QSS, - .active_low = 1, - } -}; - -static void __init tl_wr741nd_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&tl_wr741nd_flash_data); - - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr741nd_leds_gpio), - tl_wr741nd_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WR741ND_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr741nd_gpio_keys), - tl_wr741nd_gpio_keys); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); - - ath79_register_mdio(0, 0x0); - - /* LAN ports */ - ath79_register_eth(1); - - /* WAN port */ - ath79_register_eth(0); - - ap9x_pci_setup_wmac_led_pin(0, 1); - ap91_pci_init(ee, mac); -} -MIPS_MACHINE(ATH79_MACH_TL_WR741ND, "TL-WR741ND", "TP-LINK TL-WR741ND", - tl_wr741nd_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr802n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr802n.c deleted file mode 100644 index ece38f900..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr802n.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * TP-LINK TL-WR802N v1, v2 - * - * Copyright (C) 2015 Rick Pannen > - * Copyright (C) 2016 Thomas Roberts > - * - * 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_WR802N_GPIO_LED_SYSTEM 13 -#define TL_WR802N_GPIO_BTN_RESET 11 - -#define TL_WR802N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR802N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR802N_KEYS_POLL_INTERVAL) - -static const char *tl_wr802n_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr802n_flash_data = { - .part_probes = tl_wr802n_part_probes, -}; - -static struct gpio_led tl_wr802n_v1_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:system", - .gpio = TL_WR802N_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_led tl_wr802n_v2_leds_gpio[] __initdata = { - { - .name = "tl-wr802n-v2:green:system", - .gpio = TL_WR802N_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr802n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR802N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR802N_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init tl_ap143_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&tl_wr802n_flash_data); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - ath79_init_mac(tmpmac, mac, 0); - ath79_register_wmac(ee, tmpmac); - - ath79_register_gpio_keys_polled(1, TL_WR802N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr802n_gpio_keys), - tl_wr802n_gpio_keys); -} - -static void __init tl_wr802n_v1_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr802n_v1_leds_gpio), - tl_wr802n_v1_leds_gpio); -} - -static void __init tl_wr802n_v2_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr802n_v2_leds_gpio), - tl_wr802n_v2_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR802N_V1, "TL-WR802N-v1", "TP-LINK TL-WR802N v1", - tl_wr802n_v1_setup); - -MIPS_MACHINE(ATH79_MACH_TL_WR802N_V2, "TL-WR802N-v2", "TP-LINK TL-WR802N v2", - tl_wr802n_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr810n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr810n.c deleted file mode 100644 index 588bb9d86..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr810n.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * TP-LINK TL-WR810N board support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012 Gabor Juhos - * Copyright (c) 2016 Jens Steinhauser - * - * 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 "common.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TL_WR810N_GPIO_SWITCH_B1 0 -#define TL_WR810N_GPIO_SWITCH_B0 1 -#define TL_WR810N_GPIO_USB_POWER 11 -#define TL_WR810N_GPIO_BTN_RESET 12 -#define TL_WR810N_GPIO_LED_SYSTEM 13 - -#define TL_WR810N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR810N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR810N_KEYS_POLL_INTERVAL) - -#define TL_WR810N_WMAC_CALDATA_OFFSET 0x1000 - -static const char *tl_wr810n_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr810n_flash_data = { - .part_probes = tl_wr810n_part_probes, -}; - -static struct gpio_led tl_wr810n_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:system", - .gpio = TL_WR810N_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr810n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR810N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR810N_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "switch_b0", - .type = EV_SW, - .code = BTN_0, - .debounce_interval = TL_WR810N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR810N_GPIO_SWITCH_B0, - .active_low = 0, - }, - { - .desc = "switch_b1", - .type = EV_SW, - .code = BTN_1, - .debounce_interval = TL_WR810N_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR810N_GPIO_SWITCH_B1, - .active_low = 0, - }, -}; - -static void __init tl_ap143_setup(int lan_mac_offset) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&tl_wr810n_flash_data); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* WAN */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - /* LAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.speed = SPEED_1000; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, lan_mac_offset); - ath79_register_eth(1); - - ath79_register_wmac(art + TL_WR810N_WMAC_CALDATA_OFFSET, mac); - - ath79_register_leds_gpio(-1, - ARRAY_SIZE(tl_wr810n_leds_gpio), - tl_wr810n_leds_gpio); - ath79_register_gpio_keys_polled(-1, - TL_WR810N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr810n_gpio_keys), - tl_wr810n_gpio_keys); -} - -static void __init tl_wr810n_setup(void) -{ - tl_ap143_setup(-1); - - gpio_request_one(TL_WR810N_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); -} - -static void __init tl_wr810n_v2_setup(void) -{ - tl_ap143_setup(0); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR810N, "TL-WR810N", "TP-LINK TL-WR810N", - tl_wr810n_setup); - -MIPS_MACHINE(ATH79_MACH_TL_WR810N_V2, "TL-WR810N-v2", "TP-LINK TL-WR810N v2", - tl_wr810n_v2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n-v8.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n-v8.c deleted file mode 100644 index 73cfdd9cc..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n-v8.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * TP-LINK TL-WR841N/ND v8/TL-MR3420 v2 board 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 "common.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 TL_WR841NV8_GPIO_LED_WLAN 13 -#define TL_WR841NV8_GPIO_LED_QSS 15 -#define TL_WR841NV8_GPIO_LED_WAN 18 -#define TL_WR841NV8_GPIO_LED_LAN1 19 -#define TL_WR841NV8_GPIO_LED_LAN2 20 -#define TL_WR841NV8_GPIO_LED_LAN3 21 -#define TL_WR841NV8_GPIO_LED_LAN4 12 -#define TL_WR841NV8_GPIO_LED_SYSTEM 14 - -#define TL_WR841NV8_GPIO_BTN_RESET 17 -#define TL_WR841NV8_GPIO_SW_RFKILL 16 /* WPS for MR3420 v2 */ - -#define TL_MR3420V2_GPIO_LED_3G 11 -#define TL_MR3420V2_GPIO_USB_POWER 4 - -#define TL_WR941NDV5_GPIO_LED_WLAN 13 -#define TL_WR941NDV5_GPIO_LED_QSS 15 -#define TL_WR941NDV5_GPIO_LED_WAN 18 -#define TL_WR941NDV5_GPIO_LED_LAN1 19 -#define TL_WR941NDV5_GPIO_LED_LAN2 20 -#define TL_WR941NDV5_GPIO_LED_LAN3 2 -#define TL_WR941NDV5_GPIO_LED_LAN4 3 -#define TL_WR941NDV5_GPIO_LED_SYSTEM 14 - -#define TL_WR841NV8_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR841NV8_KEYS_POLL_INTERVAL) - -static const char *tl_wr841n_v8_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr841n_v8_flash_data = { - .part_probes = tl_wr841n_v8_part_probes, -}; - -static struct gpio_led tl_wr841n_v8_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WR841NV8_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WR841NV8_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WR841NV8_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WR841NV8_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR841NV8_GPIO_LED_QSS, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WR841NV8_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR841NV8_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR841NV8_GPIO_LED_WLAN, - .active_low = 1, - }, { - /* the 3G LED is only present on the MR3420 v2 */ - .name = "tp-link:green:3g", - .gpio = TL_MR3420V2_GPIO_LED_3G, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr841n_v8_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR841NV8_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "RFKILL switch", - .type = EV_SW, - .code = KEY_RFKILL, - .debounce_interval = TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR841NV8_GPIO_SW_RFKILL, - .active_low = 0, - } -}; - -static struct gpio_keys_button tl_mr3420v2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR841NV8_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "WPS", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR841NV8_GPIO_SW_RFKILL, - .active_low = 0, - } -}; - -static struct gpio_led tl_wr941nd_v5_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WR941NDV5_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WR941NDV5_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WR941NDV5_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WR941NDV5_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR941NDV5_GPIO_LED_QSS, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WR941NDV5_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR941NDV5_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR941NDV5_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static void __init tl_ap123_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* Disable JTAG, enabling GPIOs 0-3 */ - /* Configure OBS4 line, for GPIO 4*/ - ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, - AR934X_GPIO_FUNC_CLK_OBS4_EN); - - /* config gpio4 as normal gpio function */ - ath79_gpio_output_select(TL_MR3420V2_GPIO_USB_POWER, - AR934X_GPIO_OUT_GPIO); - - ath79_register_m25p80(&tl_wr841n_v8_flash_data); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - - /* GMAC0 is connected to the PHY0 of the internal switch */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - ath79_register_wmac(ee, mac); -} - -static void __init tl_wr841n_v8_setup(void) -{ - tl_ap123_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v8_leds_gpio) - 1, - tl_wr841n_v8_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr841n_v8_gpio_keys), - tl_wr841n_v8_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR841N_V8, "TL-WR841N-v8", "TP-LINK TL-WR841N/ND v8", - tl_wr841n_v8_setup); - - -static void __init tl_wr842n_v2_setup(void) -{ - tl_ap123_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v8_leds_gpio), - tl_wr841n_v8_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr841n_v8_gpio_keys), - tl_wr841n_v8_gpio_keys); - - gpio_request_one(TL_MR3420V2_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR842N_V2, "TL-WR842N-v2", "TP-LINK TL-WR842N/ND v2", - tl_wr842n_v2_setup); - -static void __init tl_mr3420v2_setup(void) -{ - tl_ap123_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v8_leds_gpio), - tl_wr841n_v8_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_mr3420v2_gpio_keys), - tl_mr3420v2_gpio_keys); - - /* enable power for the USB port */ - gpio_request_one(TL_MR3420V2_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_TL_MR3420_V2, "TL-MR3420-v2", "TP-LINK TL-MR3420 v2", - tl_mr3420v2_setup); - - -static void __init tl_wr941nd_v5_setup(void) -{ - tl_ap123_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_v5_leds_gpio), - tl_wr941nd_v5_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr841n_v8_gpio_keys), - tl_wr841n_v8_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR941ND_V5, "TL-WR941ND-v5", "TP-LINK TL-WR941N/ND v5", - tl_wr941nd_v5_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n-v9.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n-v9.c deleted file mode 100644 index 304d8ff6e..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n-v9.c +++ /dev/null @@ -1,457 +0,0 @@ -/* - * TP-LINK TL-WR840N v2/v3 / TL-WR841N/ND v9/v11 / TL-WR842N/ND v3 - * - * Copyright (C) 2014 Matthias Schiffer - * Copyright (C) 2016 Cezary Jackiewicz - * Copyright (C) 2016 Stijn Segers - * Copyright (C) 2017 Vaclav Svoboda - * Copyright (C) 2017 Andrey Polischuk - * - * 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-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define TL_WR840NV2_GPIO_LED_SYSTEM 15 -#define TL_WR840NV2_GPIO_LED_WLAN 13 -#define TL_WR840NV2_GPIO_LED_WPS 3 -#define TL_WR840NV2_GPIO_LED_WAN 4 -#define TL_WR840NV2_GPIO_LED_LAN 16 - -#define TL_WR840NV2_GPIO_BTN_RESET 12 - -#define TL_WR841NV9_GPIO_LED_WLAN 13 -#define TL_WR841NV9_GPIO_LED_QSS 3 -#define TL_WR841NV9_GPIO_LED_WAN 4 -#define TL_WR841NV9_GPIO_LED_LAN1 16 -#define TL_WR841NV9_GPIO_LED_LAN2 15 -#define TL_WR841NV9_GPIO_LED_LAN3 14 -#define TL_WR841NV9_GPIO_LED_LAN4 11 - -#define TL_WR841NV9_GPIO_BTN_RESET 12 -#define TL_WR841NV9_GPIO_BTN_WIFI 17 - -#define TL_WR841NV11_GPIO_LED_SYSTEM 1 -#define TL_WR841NV11_GPIO_LED_QSS 3 -#define TL_WR841NV11_GPIO_LED_WAN 4 -#define TL_WR841NV11_GPIO_LED_WAN_STATUS 2 -#define TL_WR841NV11_GPIO_LED_WLAN 13 -#define TL_WR841NV11_GPIO_LED_LAN1 16 -#define TL_WR841NV11_GPIO_LED_LAN2 15 -#define TL_WR841NV11_GPIO_LED_LAN3 14 -#define TL_WR841NV11_GPIO_LED_LAN4 11 - -#define TL_WR841NV11_GPIO_BTN_RESET 12 -#define TL_WR841NV11_GPIO_BTN_WIFI 17 - -#define TL_WR842NV3_GPIO_LED_SYSTEM 2 -#define TL_WR842NV3_GPIO_LED_WLAN 3 -#define TL_WR842NV3_GPIO_LED_WAN_RED 4 -#define TL_WR842NV3_GPIO_LED_WAN_GREEN 11 -#define TL_WR842NV3_GPIO_LED_LAN1 12 -#define TL_WR842NV3_GPIO_LED_LAN2 13 -#define TL_WR842NV3_GPIO_LED_LAN3 14 -#define TL_WR842NV3_GPIO_LED_LAN4 15 -#define TL_WR842NV3_GPIO_LED_3G 16 -#define TL_WR842NV3_GPIO_LED_WPS 17 - -#define TL_WR842NV3_GPIO_BTN_RESET 1 -#define TL_WR842NV3_GPIO_BTN_WIFI 0 - -#define TL_WR740NV6_GPIO_LED_SYSTEM 1 -#define TL_WR740NV6_GPIO_LED_QSS 3 -#define TL_WR740NV6_GPIO_LED_WAN_ORANGE 2 -#define TL_WR740NV6_GPIO_LED_WAN_GREEN 4 -#define TL_WR740NV6_GPIO_LED_LAN1 16 -#define TL_WR740NV6_GPIO_LED_LAN2 15 -#define TL_WR740NV6_GPIO_LED_LAN3 14 -#define TL_WR740NV6_GPIO_LED_LAN4 11 -#define TL_WR740NV6_GPIO_LED_WLAN 13 - -#define TL_WR740NV6_GPIO_BTN_RESET 12 -#define TL_WR740NV6_GPIO_BTN_WIFI 17 - -#define TL_WR841NV9_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR841NV9_KEYS_POLL_INTERVAL) - -static const char *tl_wr841n_v9_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr841n_v9_flash_data = { - .part_probes = tl_wr841n_v9_part_probes, -}; - -static struct gpio_led tl_wr840n_v2_leds_gpio[] __initdata = { - { - .name = "tp-link:green:system", - .gpio = TL_WR840NV2_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:lan", - .gpio = TL_WR840NV2_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "tp-link:green:wps", - .gpio = TL_WR840NV2_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR840NV2_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR840NV2_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr840n_v2_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR840NV2_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct gpio_led tl_wr841n_v9_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WR841NV9_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WR841NV9_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WR841NV9_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WR841NV9_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR841NV9_GPIO_LED_QSS, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR841NV9_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR841NV9_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr841n_v9_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR841NV9_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "WIFI button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR841NV9_GPIO_BTN_WIFI, - .active_low = 1, - } -}; - -static struct gpio_led tl_wr841n_v11_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WR841NV9_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WR841NV9_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WR841NV9_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WR841NV9_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR841NV9_GPIO_LED_QSS, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WR841NV11_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR841NV9_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "tp-link:green:wan_status", - .gpio = TL_WR841NV11_GPIO_LED_WAN_STATUS, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR841NV9_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_led tl_wr842n_v3_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WR842NV3_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WR842NV3_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WR842NV3_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WR842NV3_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR842NV3_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "tp-link:red:wan", - .gpio = TL_WR842NV3_GPIO_LED_WAN_RED, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR842NV3_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WR842NV3_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:3g", - .gpio = TL_WR842NV3_GPIO_LED_3G, - .active_low = 1, - }, { - .name = "tp-link:green:wps", - .gpio = TL_WR842NV3_GPIO_LED_WPS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr842n_v3_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR842NV3_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "WIFI button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR842NV3_GPIO_BTN_WIFI, - .active_low = 1, - } -}; - -static struct gpio_led tl_wr740n_v6_leds_gpio[] __initdata = { - { - .name = "tp-link:green:lan1", - .gpio = TL_WR740NV6_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tp-link:green:lan2", - .gpio = TL_WR740NV6_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tp-link:green:lan3", - .gpio = TL_WR740NV6_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tp-link:green:lan4", - .gpio = TL_WR740NV6_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tp-link:green:system", - .gpio = TL_WR740NV6_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR740NV6_GPIO_LED_QSS, - .active_low = 1, - }, { - .name = "tp-link:green:wan", - .gpio = TL_WR740NV6_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "tp-link:orange:wan", - .gpio = TL_WR740NV6_GPIO_LED_WAN_ORANGE, - .active_low = 1, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR740NV6_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr740n_v6_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR740NV6_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "WIFI button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WR841NV9_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR740NV6_GPIO_BTN_WIFI, - .active_low = 1, - } -}; - -static void __init tl_ap143_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - u8 tmpmac[ETH_ALEN]; - - ath79_register_m25p80(&tl_wr841n_v9_flash_data); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - ath79_init_mac(tmpmac, mac, 0); - ath79_register_wmac(ee, tmpmac); -} - - -static void __init tl_wr840n_v2_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr840n_v2_leds_gpio), - tl_wr840n_v2_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr840n_v2_gpio_keys), - tl_wr840n_v2_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR840N_V2, "TL-WR840N-v2", "TP-LINK TL-WR840N v2", - tl_wr840n_v2_setup); - -MIPS_MACHINE(ATH79_MACH_TL_WR840N_V3, "TL-WR840N-v3", "TP-LINK TL-WR840N v3", - tl_wr840n_v2_setup); - -static void __init tl_wr841n_v9_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v9_leds_gpio), - tl_wr841n_v9_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr841n_v9_gpio_keys), - tl_wr841n_v9_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR841N_V9, "TL-WR841N-v9", "TP-LINK TL-WR841N/ND v9", - tl_wr841n_v9_setup); - -static void __init tl_wr841n_v11_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v11_leds_gpio), - tl_wr841n_v11_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr841n_v9_gpio_keys), - tl_wr841n_v9_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR841N_V11, "TL-WR841N-v11", "TP-LINK TL-WR841N/ND v11", - tl_wr841n_v11_setup); - -static void __init tl_wr842n_v3_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr842n_v3_leds_gpio), - tl_wr842n_v3_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr842n_v3_gpio_keys), - tl_wr842n_v3_gpio_keys); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR842N_V3, "TL-WR842N-v3", "TP-LINK TL-WR842N/ND v3", - tl_wr842n_v3_setup); - -static void __init tl_wr740n_v6_setup(void) -{ - tl_ap143_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr740n_v6_leds_gpio), - tl_wr740n_v6_leds_gpio); - - ath79_register_gpio_keys_polled(1, TL_WR841NV9_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr740n_v6_gpio_keys), - tl_wr740n_v6_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR740N_V6, "TL-WR740N-v6", "TP-LINK TL-WR740N/ND v6", - tl_wr740n_v6_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n.c deleted file mode 100644 index 11f853f05..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr841n.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * TP-LINK TL-WR841N/ND v1 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 -#include - -#include - -#include "dev-dsa.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "pci.h" - -#define TL_WR841ND_V1_GPIO_LED_SYSTEM 2 -#define TL_WR841ND_V1_GPIO_LED_QSS_GREEN 4 -#define TL_WR841ND_V1_GPIO_LED_QSS_RED 5 - -#define TL_WR841ND_V1_GPIO_BTN_RESET 3 -#define TL_WR841ND_V1_GPIO_BTN_QSS 7 - -#define TL_WR841ND_V1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR841ND_V1_KEYS_DEBOUNCE_INTERVAL \ - (3 * TL_WR841ND_V1_KEYS_POLL_INTERVAL) - -static struct mtd_partition tl_wr841n_v1_partitions[] = { - { - .name = "redboot", - .offset = 0, - .size = 0x020000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "kernel", - .offset = 0x020000, - .size = 0x140000, - }, { - .name = "rootfs", - .offset = 0x160000, - .size = 0x280000, - }, { - .name = "config", - .offset = 0x3e0000, - .size = 0x020000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x020000, - .size = 0x3c0000, - } -}; - -static struct flash_platform_data tl_wr841n_v1_flash_data = { - .parts = tl_wr841n_v1_partitions, - .nr_parts = ARRAY_SIZE(tl_wr841n_v1_partitions), -}; - -static struct gpio_led tl_wr841n_v1_leds_gpio[] __initdata = { - { - .name = "tp-link:green:system", - .gpio = TL_WR841ND_V1_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:red:qss", - .gpio = TL_WR841ND_V1_GPIO_LED_QSS_RED, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR841ND_V1_GPIO_LED_QSS_GREEN, - } -}; - -static struct gpio_keys_button tl_wr841n_v1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR841ND_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR841ND_V1_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "qss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR841ND_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR841ND_V1_GPIO_BTN_QSS, - .active_low = 1, - } -}; - -static struct dsa_chip_data tl_wr841n_v1_dsa_chip = { - .port_names[0] = "wan", - .port_names[1] = "lan1", - .port_names[2] = "lan2", - .port_names[3] = "lan3", - .port_names[4] = "lan4", - .port_names[5] = "cpu", -}; - -static struct dsa_platform_data tl_wr841n_v1_dsa_data = { - .nr_chips = 1, - .chip = &tl_wr841n_v1_dsa_chip, -}; - -static void __init tl_wr841n_v1_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - ath79_register_dsa(&ath79_eth0_device.dev, &ath79_mdio0_device.dev, - &tl_wr841n_v1_dsa_data); - - ath79_register_m25p80(&tl_wr841n_v1_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v1_leds_gpio), - tl_wr841n_v1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WR841ND_V1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr841n_v1_gpio_keys), - tl_wr841n_v1_gpio_keys); - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR841N_V1, "TL-WR841N-v1.5", "TP-LINK TL-WR841N v1", - tl_wr841n_v1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr902ac-v1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr902ac-v1.c deleted file mode 100644 index 8d2cea828..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr902ac-v1.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * TP-Link TL-WR902AC v1 board support - * - * Copyright (C) 2017 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 "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 TL_WR902AC_V1_GPIO_LED_INTERNET 12 -#define TL_WR902AC_V1_GPIO_LED_LAN 15 -#define TL_WR902AC_V1_GPIO_LED_POWER 13 -#define TL_WR902AC_V1_GPIO_LED_USB 4 -#define TL_WR902AC_V1_GPIO_LED_WLAN2G 11 -#define TL_WR902AC_V1_GPIO_LED_WPS 0 - -#define TL_WR902AC_V1_GPIO_BTN_RESET 3 -#define TL_WR902AC_V1_GPIO_BTN_SW1 17 -#define TL_WR902AC_V1_GPIO_BTN_SW2 14 -#define TL_WR902AC_V1_GPIO_BTN_WPS 2 - -#define TL_WR902AC_V1_GPIO_USB_POWER 1 - -#define TL_WR902AC_V1_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR902AC_V1_KEYS_DEBOUNCE_INTERVAL \ - (3 * TL_WR902AC_V1_KEYS_POLL_INTERVAL) - -static struct gpio_led tl_wr902ac_v1_leds_gpio[] __initdata = { - { - .name = "tl-wr902ac-v1:green:internet", - .gpio = TL_WR902AC_V1_GPIO_LED_INTERNET, - .active_low = 1, - }, { - .name = "tl-wr902ac-v1:green:lan", - .gpio = TL_WR902AC_V1_GPIO_LED_LAN, - .active_low = 0, - }, { - .name = "tl-wr902ac-v1:green:power", - .gpio = TL_WR902AC_V1_GPIO_LED_POWER, - .active_low = 0, - }, { - .name = "tl-wr902ac-v1:green:usb", - .gpio = TL_WR902AC_V1_GPIO_LED_USB, - .active_low = 0, - }, { - .name = "tl-wr902ac-v1:green:wlan2g", - .gpio = TL_WR902AC_V1_GPIO_LED_WLAN2G, - .active_low = 1, - }, { - .name = "tl-wr902ac-v1:green:wps", - .gpio = TL_WR902AC_V1_GPIO_LED_WPS, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_wr902ac_v1_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR902AC_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR902AC_V1_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "sw1", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = TL_WR902AC_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR902AC_V1_GPIO_BTN_SW1, - .active_low = 1, - }, { - .desc = "sw2", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = TL_WR902AC_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR902AC_V1_GPIO_BTN_SW2, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR902AC_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR902AC_V1_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static void __init tl_wr902ac_v1_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f750008); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr902ac_v1_leds_gpio), - tl_wr902ac_v1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WR902AC_V1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr902ac_v1_gpio_keys), - tl_wr902ac_v1_gpio_keys); - - gpio_request_one(TL_WR902AC_V1_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - ath79_register_usb(); - - ath79_register_wmac(art + 0x1000, mac); - - ap91_pci_init(art + 0x5000, NULL); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR902AC_V1, "TL-WR902AC-V1", "TP-LINK TL-WR902AC v1", - tl_wr902ac_v1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr940n-v4.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr940n-v4.c deleted file mode 100644 index b530622d9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr940n-v4.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * TP-LINK TL-WR940N v4 and v6 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 -/* WR940N v6 specific GPIO*/ -#define TL_WR940N_V6_GPIO_LED_DIAG_ORANGE 15 -#define TL_WR940N_V6_GPIO_LED_WAN_BLUE 14 - -#define TL_WR940N_V4_GPIO_BTN_RESET 1 -#define TL_WR940N_V4_GPIO_BTN_RFKILL 2 - -#define TL_WR940N_KEYS_POLL_INTERVAL 20 -#define TL_WR940N_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR940N_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_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_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR940N_V4_GPIO_BTN_RFKILL, - .active_low = 1, - } -}; - -static struct gpio_led tl_wr940n_v6_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:wan", - .gpio = TL_WR940N_V6_GPIO_LED_WAN_BLUE, - .active_low = 1, - }, - { - .name = "tp-link:orange:diag", - .gpio = TL_WR940N_V6_GPIO_LED_DIAG_ORANGE, - .active_low = 0, - }, -}; - - -static const char *tl_wr940n_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr940n_flash_data = { - .part_probes = tl_wr940n_part_probes, -}; - - -static void __init tl_wr940n_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&tl_wr940n_flash_data); - - 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); - -} - -static void __init tl_wr940n_v4_setup(void) -{ - tl_wr940n_setup(); - - 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_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr940n_v4_gpio_keys), - tl_wr940n_v4_gpio_keys); -} - -static void __init tl_wr940n_v6_setup(void) -{ - tl_wr940n_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr940n_v6_leds_gpio), - tl_wr940n_v6_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WR940N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr940n_v4_gpio_keys), - tl_wr940n_v4_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR940N_V4, "TL-WR940N-v4", "TP-LINK TL-WR940N v4", - tl_wr940n_v4_setup); -MIPS_MACHINE(ATH79_MACH_TL_WR940N_V6, "TL-WR940N-v6", "TP-LINK TL-WR940N v6", - tl_wr940n_v6_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr941nd-v6.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr941nd-v6.c deleted file mode 100644 index 8c788e284..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr941nd-v6.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * TP-LINK TL-WR941N/ND v6 board support - * - * Copyright (C) 2015 Matthias Schiffer - * - * 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_WR941ND_V6_GPIO_LED_QSS 3 -#define TL_WR941ND_V6_GPIO_LED_WAN 14 -#define TL_WR941ND_V6_GPIO_LED_WAN_RED 15 -#define TL_WR941ND_V6_GPIO_LED_LAN1 7 -#define TL_WR941ND_V6_GPIO_LED_LAN2 6 -#define TL_WR941ND_V6_GPIO_LED_LAN3 5 -#define TL_WR941ND_V6_GPIO_LED_LAN4 4 -#define TL_WR941ND_V6_GPIO_LED_WLAN 8 -#define TL_WR941ND_V6_GPIO_LED_SYSTEM 18 - -#define TL_WR941ND_V6_GPIO_BTN_RESET 1 -#define TL_WR941ND_V6_GPIO_BTN_RFKILL 2 - -#define TL_WR941ND_V6_KEYS_POLL_INTERVAL 20 -#define TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR941ND_V6_KEYS_POLL_INTERVAL) - - -static struct gpio_led tl_wr941nd_v6_leds_gpio[] __initdata = { - { - .name = "tp-link:blue:qss", - .gpio = TL_WR941ND_V6_GPIO_LED_QSS, - .active_low = 1, - }, - { - .name = "tp-link:blue:wan", - .gpio = TL_WR941ND_V6_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "tp-link:red:wan", - .gpio = TL_WR941ND_V6_GPIO_LED_WAN_RED, - .active_low = 0, - }, - { - .name = "tp-link:blue:lan1", - .gpio = TL_WR941ND_V6_GPIO_LED_LAN1, - .active_low = 1, - }, - { - .name = "tp-link:blue:lan2", - .gpio = TL_WR941ND_V6_GPIO_LED_LAN2, - .active_low = 1, - }, - { - .name = "tp-link:blue:lan3", - .gpio = TL_WR941ND_V6_GPIO_LED_LAN3, - .active_low = 1, - }, - { - .name = "tp-link:blue:lan4", - .gpio = TL_WR941ND_V6_GPIO_LED_LAN4, - .active_low = 1, - }, - { - .name = "tp-link:blue:wlan", - .gpio = TL_WR941ND_V6_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "tp-link:blue:system", - .gpio = TL_WR941ND_V6_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr941nd_v6_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR941ND_V6_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR941ND_V6_GPIO_BTN_RFKILL, - .active_low = 1, - } -}; - - -static const char *tl_wr941n_v6_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr941n_v6_flash_data = { - .part_probes = tl_wr941n_v6_part_probes, -}; - - -static void __init tl_wr941nd_v6_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(&tl_wr941n_v6_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_v6_leds_gpio), - tl_wr941nd_v6_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WR941ND_V6_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr941nd_v6_gpio_keys), - tl_wr941nd_v6_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_WR941ND_V6, "TL-WR941ND-v6", "TP-LINK TL-WR941N/ND v6", - tl_wr941nd_v6_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr941nd.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr941nd.c deleted file mode 100644 index 1ddeec730..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr941nd.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * TP-LINK TL-WR941ND 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 - -#include "dev-dsa.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_WR941ND_GPIO_LED_SYSTEM 2 -#define TL_WR941ND_GPIO_LED_QSS_RED 4 -#define TL_WR941ND_GPIO_LED_QSS_GREEN 5 -#define TL_WR941ND_GPIO_LED_WLAN 9 - -#define TL_WR941ND_GPIO_BTN_RESET 3 -#define TL_WR941ND_GPIO_BTN_QSS 7 - -#define TL_WR941ND_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TL_WR941ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR941ND_KEYS_POLL_INTERVAL) - -static const char *tl_wr941nd_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data tl_wr941nd_flash_data = { - .part_probes = tl_wr941nd_part_probes, -}; - -static struct gpio_led tl_wr941nd_leds_gpio[] __initdata = { - { - .name = "tp-link:green:system", - .gpio = TL_WR941ND_GPIO_LED_SYSTEM, - .active_low = 1, - }, { - .name = "tp-link:red:qss", - .gpio = TL_WR941ND_GPIO_LED_QSS_RED, - }, { - .name = "tp-link:green:qss", - .gpio = TL_WR941ND_GPIO_LED_QSS_GREEN, - }, { - .name = "tp-link:green:wlan", - .gpio = TL_WR941ND_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button tl_wr941nd_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR941ND_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR941ND_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "qss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = TL_WR941ND_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR941ND_GPIO_BTN_QSS, - .active_low = 1, - } -}; - -static struct dsa_chip_data tl_wr941nd_dsa_chip = { - .port_names[0] = "wan", - .port_names[1] = "lan1", - .port_names[2] = "lan2", - .port_names[3] = "lan3", - .port_names[4] = "lan4", - .port_names[5] = "cpu", -}; - -static struct dsa_platform_data tl_wr941nd_dsa_data = { - .nr_chips = 1, - .chip = &tl_wr941nd_dsa_chip, -}; - -static void __init tl_wr941nd_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - ath79_register_dsa(&ath79_eth0_device.dev, &ath79_mdio0_device.dev, - &tl_wr941nd_dsa_data); - - ath79_register_m25p80(&tl_wr941nd_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_leds_gpio), - tl_wr941nd_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WR941ND_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr941nd_gpio_keys), - tl_wr941nd_gpio_keys); - ath79_register_wmac(eeprom, mac); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR941ND, "TL-WR941ND", "TP-LINK TL-WR941ND", - tl_wr941nd_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr942n-v1.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr942n-v1.c deleted file mode 100644 index 32e2bc952..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr942n-v1.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * TP-Link TL-WR942N(RU) v1 board support - * - * Copyright (C) 2017 Sergey Studzinski - * Thanks to Henryk Heisig - * - * 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 "common.h" -#include "dev-m25p80.h" -#include "machtypes.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "nvram.h" - -#define TL_WR942N_V1_KEYS_POLL_INTERVAL 20 -#define TL_WR942N_V1_KEYS_DEBOUNCE_INTERVAL \ - (3 * TL_WR942N_V1_KEYS_POLL_INTERVAL) - -#define TL_WR942N_V1_GPIO_BTN_RESET 1 -#define TL_WR942N_V1_GPIO_BTN_RFKILL 2 - -#define TL_WR942N_V1_GPIO_UART_TX 4 -#define TL_WR942N_V1_GPIO_UART_RX 5 - -#define TL_WR942N_V1_GPIO_LED_USB2 14 -#define TL_WR942N_V1_GPIO_LED_USB1 15 - -#define TL_WR942N_V1_GPIO_SHIFT_OE 16 -#define TL_WR942N_V1_GPIO_SHIFT_SER 17 -#define TL_WR942N_V1_GPIO_SHIFT_SRCLK 18 -#define TL_WR942N_V1_GPIO_SHIFT_SRCLR 19 -#define TL_WR942N_V1_GPIO_SHIFT_RCLK 20 -#define TL_WR942N_V1_GPIO_LED_WPS 21 -#define TL_WR942N_V1_GPIO_LED_STATUS 22 - -#define TL_WR942N_V1_74HC_GPIO_BASE 32 -#define TL_WR942N_V1_74HC_GPIO_LED_LAN4 (TL_WR942N_V1_74HC_GPIO_BASE + 0) -#define TL_WR942N_V1_74HC_GPIO_LED_LAN3 (TL_WR942N_V1_74HC_GPIO_BASE + 1) -#define TL_WR942N_V1_74HC_GPIO_LED_LAN2 (TL_WR942N_V1_74HC_GPIO_BASE + 2) -#define TL_WR942N_V1_74HC_GPIO_LED_LAN1 (TL_WR942N_V1_74HC_GPIO_BASE + 3) -#define TL_WR942N_V1_74HC_GPIO_LED_WAN_GREEN (TL_WR942N_V1_74HC_GPIO_BASE + 4) -#define TL_WR942N_V1_74HC_GPIO_LED_WAN_AMBER (TL_WR942N_V1_74HC_GPIO_BASE + 5) -#define TL_WR942N_V1_74HC_GPIO_LED_WLAN (TL_WR942N_V1_74HC_GPIO_BASE + 6) -#define TL_WR942N_V1_74HC_GPIO_HUB_RESET (TL_WR942N_V1_74HC_GPIO_BASE + 7) /* from u-boot sources */ - -#define TL_WR942N_V1_SSR_BIT_0 0 -#define TL_WR942N_V1_SSR_BIT_1 1 -#define TL_WR942N_V1_SSR_BIT_2 2 -#define TL_WR942N_V1_SSR_BIT_3 3 -#define TL_WR942N_V1_SSR_BIT_4 4 -#define TL_WR942N_V1_SSR_BIT_5 5 -#define TL_WR942N_V1_SSR_BIT_6 6 -#define TL_WR942N_V1_SSR_BIT_7 7 - -#define TL_WR942N_V1_WMAC_CALDATA_OFFSET 0x1000 -#define TL_WR942N_V1_DEFAULT_MAC_ADDR 0x1fe40008 -#define TL_WR942N_V1_DEFAULT_MAC_SIZE 0x200 - -#define GPIO_IN_ENABLE0_UART_SIN_LSB 8 -#define GPIO_IN_ENABLE0_UART_SIN_MASK 0x0000ff00 - -static struct gpio_led tl_wr942n_v1_leds_gpio[] __initdata = { - { - .name = "tl-wr942n-v1:green:status", - .gpio = TL_WR942N_V1_GPIO_LED_STATUS, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:wlan", - .gpio = TL_WR942N_V1_74HC_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:lan1", - .gpio = TL_WR942N_V1_74HC_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:lan2", - .gpio = TL_WR942N_V1_74HC_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:lan3", - .gpio = TL_WR942N_V1_74HC_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:lan4", - .gpio = TL_WR942N_V1_74HC_GPIO_LED_LAN4, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:wan", - .gpio = TL_WR942N_V1_74HC_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:amber:wan", - .gpio = TL_WR942N_V1_74HC_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:wps", - .gpio = TL_WR942N_V1_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:usb1", - .gpio = TL_WR942N_V1_GPIO_LED_USB1, - .active_low = 1, - }, { - .name = "tl-wr942n-v1:green:usb2", - .gpio = TL_WR942N_V1_GPIO_LED_USB2, - .active_low = 1, - }, -}; - -static struct gpio_keys_button tl_wr942n_v1_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TL_WR942N_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR942N_V1_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "RFKILL button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = TL_WR942N_V1_KEYS_DEBOUNCE_INTERVAL, - .gpio = TL_WR942N_V1_GPIO_BTN_RFKILL, - .active_low = 1, - }, -}; - -static struct spi_gpio_platform_data tl_wr942n_v1_spi_data = { - .sck = TL_WR942N_V1_GPIO_SHIFT_SRCLK, - .miso = SPI_GPIO_NO_MISO, - .mosi = TL_WR942N_V1_GPIO_SHIFT_SER, - .num_chipselect = 1, -}; - -static u8 tl_wr942n_v1_ssr_initdata[] = { - BIT(TL_WR942N_V1_SSR_BIT_7) | - BIT(TL_WR942N_V1_SSR_BIT_6) | - BIT(TL_WR942N_V1_SSR_BIT_5) | - BIT(TL_WR942N_V1_SSR_BIT_4) | - BIT(TL_WR942N_V1_SSR_BIT_3) | - BIT(TL_WR942N_V1_SSR_BIT_2) | - BIT(TL_WR942N_V1_SSR_BIT_1) | - BIT(TL_WR942N_V1_SSR_BIT_0) -}; - -static struct gen_74x164_chip_platform_data tl_wr942n_v1_ssr_data = { - .base = TL_WR942N_V1_74HC_GPIO_BASE, - .num_registers = ARRAY_SIZE(tl_wr942n_v1_ssr_initdata), - .init_data = tl_wr942n_v1_ssr_initdata, -}; - -static struct platform_device tl_wr942n_v1_spi_device = { - .name = "spi_gpio", - .id = 1, - .dev = { - .platform_data = &tl_wr942n_v1_spi_data, - }, -}; - -static struct spi_board_info tl_wr942n_v1_spi_info[] = { - { - .bus_num = 1, - .chip_select = 0, - .max_speed_hz = 10000000, - .modalias = "74x164", - .platform_data = &tl_wr942n_v1_ssr_data, - .controller_data = (void *) TL_WR942N_V1_GPIO_SHIFT_RCLK, - }, -}; - -static void tl_wr942n_v1_get_mac(const char *name, char *mac) -{ - u8 *nvram = (u8 *) KSEG1ADDR(TL_WR942N_V1_DEFAULT_MAC_ADDR); - int err; - - err = ath79_nvram_parse_mac_addr(nvram, TL_WR942N_V1_DEFAULT_MAC_SIZE, - name, mac); - - if (err) - pr_err("no MAC address found for %s\n", name); -} - -static void __init tl_wr942n_v1_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - void __iomem *base; - u32 t; - - ath79_register_m25p80(NULL); - - spi_register_board_info(tl_wr942n_v1_spi_info, - ARRAY_SIZE(tl_wr942n_v1_spi_info)); - platform_device_register(&tl_wr942n_v1_spi_device); - - /* Check inherited UART RX GPIO definition */ - base = ioremap(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE); - - t = __raw_readl(base + QCA956X_GPIO_REG_IN_ENABLE0); - if (((t & GPIO_IN_ENABLE0_UART_SIN_MASK) - >> GPIO_IN_ENABLE0_UART_SIN_LSB) == TL_WR942N_V1_GPIO_LED_USB1) { - pr_warn("Active UART detected on USBLED's GPIOs!\n"); - - tl_wr942n_v1_leds_gpio[9].gpio = TL_WR942N_V1_GPIO_UART_TX; - tl_wr942n_v1_leds_gpio[10].gpio = TL_WR942N_V1_GPIO_UART_RX; - } - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr942n_v1_leds_gpio), - tl_wr942n_v1_leds_gpio); - - ath79_register_gpio_keys_polled(-1, TL_WR942N_V1_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tl_wr942n_v1_gpio_keys), - tl_wr942n_v1_gpio_keys); - - tl_wr942n_v1_get_mac("MAC:", tmpmac); - - /* swap PHYs */ - ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP | - QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP); - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - /* WAN port */ - ath79_init_mac(ath79_eth0_data.mac_addr, tmpmac, 1); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - - /* swaped PHYs */ - ath79_eth0_data.phy_mask = BIT(0); - ath79_register_eth(0); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_init_mac(ath79_eth1_data.mac_addr, tmpmac, 0); - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - /* swaped PHYs */ - ath79_switch_data.phy_poll_mask |= BIT(0); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - ath79_register_wmac(art + TL_WR942N_V1_WMAC_CALDATA_OFFSET, tmpmac); - - ath79_register_usb(); - - gpio_request_one(TL_WR942N_V1_74HC_GPIO_HUB_RESET, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - - gpio_request_one(TL_WR942N_V1_GPIO_SHIFT_OE, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "LED control"); - - gpio_request_one(TL_WR942N_V1_GPIO_SHIFT_SRCLR, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "LED reset"); -} - -MIPS_MACHINE(ATH79_MACH_TL_WR942N_V1, "TL-WR942N-V1", "TP-LINK TL-WR942N v1", - tl_wr942n_v1_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ts-d084.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ts-d084.c deleted file mode 100644 index 38786fded..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ts-d084.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * PISEN TS-D084 board support - * Based on TP-LINK TL-WR703N/TL-MR10U board support - * - * Copyright (C) 2011 dongyuqi <729650915@qq.com> - * Copyright (C) 2011-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 "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 TS_D084_GPIO_LED_SYSTEM 0 -#define TS_D084_GPIO_BTN_RESET 12 - - -#define TS_D084_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TS_D084_KEYS_DEBOUNCE_INTERVAL (3 * TS_D084_KEYS_POLL_INTERVAL) - -static const char *ts_d084_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data ts_d084_flash_data = { - .part_probes = ts_d084_part_probes, -}; - -static struct gpio_led ts_d084_leds_gpio[] __initdata = { - { - .name = "ts-d084:blue:system", - .gpio = TS_D084_GPIO_LED_SYSTEM, - .active_low = 0, - }, -}; - -static struct gpio_keys_button ts_d084_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TS_D084_KEYS_DEBOUNCE_INTERVAL, - .gpio = TS_D084_GPIO_BTN_RESET, - .active_low = 0, - } -}; - -static void __init ts_d084_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_m25p80(&ts_d084_flash_data); - ath79_register_leds_gpio(-1, ARRAY_SIZE(ts_d084_leds_gpio), - ts_d084_leds_gpio); - ath79_register_gpio_keys_polled(-1, TS_D084_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ts_d084_gpio_keys), - ts_d084_gpio_keys); - - ath79_register_usb(); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); - - ath79_register_wmac(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_TS_D084, "TS-D084", "PISEN TS-D084", - ts_d084_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tube2h.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tube2h.c deleted file mode 100644 index 06b361653..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tube2h.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * ALFA NETWORK Tube2H board support - * - * Copyright (C) 2014 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 "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 TUBE2H_GPIO_LED_SIGNAL4 0 -#define TUBE2H_GPIO_LED_SIGNAL3 1 -#define TUBE2H_GPIO_LED_SIGNAL2 13 -#define TUBE2H_GPIO_LED_LAN 17 -#define TUBE2H_GPIO_LED_SIGNAL1 27 -#define TUBE2H_GPIO_EXT_LNA 28 - -#define TUBE2H_GPIO_WDT_EN 22 -#define TUBE2H_GPIO_WDT_IN 18 - -#define TUBE2H_GPIO_BTN_RESET 12 - -#define TUBE2H_KEYS_POLL_INTERVAL 20 /* msecs */ -#define TUBE2H_KEYS_DEBOUNCE_INTERVAL (3 * TUBE2H_KEYS_POLL_INTERVAL) - -#define TUBE2H_ART_ADDRESS 0x1fff0000 -#define TUBE2H_LAN_MAC_OFFSET 0x06 -#define TUBE2H_CALDATA_OFFSET 0x1000 - -static struct gpio_led tube2h_leds_gpio[] __initdata = { - { - .name = "alfa:blue:lan", - .gpio = TUBE2H_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "alfa:red:signal1", - .gpio = TUBE2H_GPIO_LED_SIGNAL1, - .active_low = 1, - }, - { - .name = "alfa:orange:signal2", - .gpio = TUBE2H_GPIO_LED_SIGNAL2, - .active_low = 0, - }, - { - .name = "alfa:green:signal3", - .gpio = TUBE2H_GPIO_LED_SIGNAL3, - .active_low = 0, - }, - { - .name = "alfa:green:signal4", - .gpio = TUBE2H_GPIO_LED_SIGNAL4, - .active_low = 0, - }, -}; - -static struct gpio_keys_button tube2h_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = TUBE2H_KEYS_DEBOUNCE_INTERVAL, - .gpio = TUBE2H_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init tube2h_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(TUBE2H_ART_ADDRESS); - u32 t; - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_JTAG_DISABLE | - AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - /* Ensure that GPIO26 and GPIO27 are controllable by software */ - t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); - t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN; - ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t); - - gpio_request_one(TUBE2H_GPIO_EXT_LNA, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "external LNA0"); - - gpio_request_one(TUBE2H_GPIO_WDT_IN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "WDT input"); - - gpio_request_one(TUBE2H_GPIO_WDT_EN, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "WDT enable"); - - ath79_register_wmac(art + TUBE2H_CALDATA_OFFSET, NULL); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(tube2h_leds_gpio), - tube2h_leds_gpio); - ath79_register_gpio_keys_polled(-1, TUBE2H_KEYS_POLL_INTERVAL, - ARRAY_SIZE(tube2h_gpio_keys), - tube2h_gpio_keys); - - ath79_init_mac(ath79_eth0_data.mac_addr, - art + TUBE2H_LAN_MAC_OFFSET, 0); - ath79_register_mdio(0, 0x0); - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_TUBE2H, "TUBE2H", "ALFA NETWORK Tube2H", - tube2h_setup); - diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ubnt.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ubnt.c deleted file mode 100644 index e49ac23fd..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ubnt.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Ubiquiti RouterStation support - * - * Copyright (C) 2008-2012 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * Copyright (C) 2008 Ubiquiti - * - * 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 "machtypes.h" -#include "pci.h" - -#define UBNT_RS_GPIO_LED_RF 2 -#define UBNT_RS_GPIO_SW4 8 - -#define UBNT_LS_SR71_GPIO_LED_D25 0 -#define UBNT_LS_SR71_GPIO_LED_D26 1 -#define UBNT_LS_SR71_GPIO_LED_D24 2 -#define UBNT_LS_SR71_GPIO_LED_D23 4 -#define UBNT_LS_SR71_GPIO_LED_D22 5 -#define UBNT_LS_SR71_GPIO_LED_D27 6 -#define UBNT_LS_SR71_GPIO_LED_D28 7 - -#define UBNT_KEYS_POLL_INTERVAL 20 /* msecs */ -#define UBNT_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_KEYS_POLL_INTERVAL) - -static struct gpio_led ubnt_rs_leds_gpio[] __initdata = { - { - .name = "ubnt:green:rf", - .gpio = UBNT_RS_GPIO_LED_RF, - .active_low = 0, - } -}; - -static struct gpio_led ubnt_ls_sr71_leds_gpio[] __initdata = { - { - .name = "ubnt:green:d22", - .gpio = UBNT_LS_SR71_GPIO_LED_D22, - .active_low = 0, - }, { - .name = "ubnt:green:d23", - .gpio = UBNT_LS_SR71_GPIO_LED_D23, - .active_low = 0, - }, { - .name = "ubnt:green:d24", - .gpio = UBNT_LS_SR71_GPIO_LED_D24, - .active_low = 0, - }, { - .name = "ubnt:red:d25", - .gpio = UBNT_LS_SR71_GPIO_LED_D25, - .active_low = 0, - }, { - .name = "ubnt:red:d26", - .gpio = UBNT_LS_SR71_GPIO_LED_D26, - .active_low = 0, - }, { - .name = "ubnt:green:d27", - .gpio = UBNT_LS_SR71_GPIO_LED_D27, - .active_low = 0, - }, { - .name = "ubnt:green:d28", - .gpio = UBNT_LS_SR71_GPIO_LED_D28, - .active_low = 0, - } -}; - -static struct gpio_keys_button ubnt_gpio_keys[] __initdata = { - { - .desc = "sw4", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = UBNT_KEYS_DEBOUNCE_INTERVAL, - .gpio = UBNT_RS_GPIO_SW4, - .active_low = 1, - } -}; - -static const char *ubnt_part_probes[] = { - "RedBoot", - NULL, -}; - -static struct flash_platform_data ubnt_flash_data = { - .part_probes = ubnt_part_probes, -}; - -static void __init ubnt_generic_setup(void) -{ - ath79_register_m25p80(&ubnt_flash_data); - - ath79_register_gpio_keys_polled(-1, UBNT_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ubnt_gpio_keys), - ubnt_gpio_keys); - ath79_register_pci(); -} - -#define UBNT_RS_WAN_PHYMASK BIT(20) -#define UBNT_RS_LAN_PHYMASK (BIT(16) | BIT(17) | BIT(18) | BIT(19)) - -static void __init ubnt_rs_setup(void) -{ - ubnt_generic_setup(); - - ath79_register_mdio(0, ~(UBNT_RS_WAN_PHYMASK | UBNT_RS_LAN_PHYMASK)); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = UBNT_RS_WAN_PHYMASK; - - /* - * There is Secondary MAC address duplicate problem with some - * UBNT HW batches. Do not increase Secondary MAC address by 1 - * but do workaround with 'Locally Administrated' bit. - */ - ath79_init_local_mac(ath79_eth1_data.mac_addr, ath79_mac_base); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth1_data.speed = SPEED_100; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_usb(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rs_leds_gpio), - ubnt_rs_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_RS, "UBNT-RS", "Ubiquiti RouterStation", - ubnt_rs_setup); - -#define UBNT_RSPRO_WAN_PHYMASK BIT(4) -#define UBNT_RSPRO_LAN_PHYMASK (BIT(0) | BIT(1) | BIT(2) | BIT(3)) - -static void __init ubnt_rspro_setup(void) -{ - ubnt_generic_setup(); - - ath79_register_mdio(0, ~(UBNT_RSPRO_WAN_PHYMASK | - UBNT_RSPRO_LAN_PHYMASK)); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = UBNT_RSPRO_WAN_PHYMASK; - - /* - * There is Secondary MAC address duplicate problem with some - * UBNT HW batches. Do not increase Secondary MAC address by 1 - * but do workaround with 'Locally Administrated' bit. - */ - ath79_init_local_mac(ath79_eth1_data.mac_addr, ath79_mac_base); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = UBNT_RSPRO_LAN_PHYMASK; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_usb(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_rs_leds_gpio), - ubnt_rs_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_RSPRO, "UBNT-RSPRO", "Ubiquiti RouterStation Pro", - ubnt_rspro_setup); - -static void __init ubnt_lsx_setup(void) -{ - ubnt_generic_setup(); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_LSX, "UBNT-LSX", "Ubiquiti LSX", ubnt_lsx_setup); - -#define UBNT_LSSR71_PHY_MASK BIT(1) - -static void __init ubnt_lssr71_setup(void) -{ - ubnt_generic_setup(); - - ath79_register_mdio(0, ~UBNT_LSSR71_PHY_MASK); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = UBNT_LSSR71_PHY_MASK; - - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_ls_sr71_leds_gpio), - ubnt_ls_sr71_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_UBNT_LSSR71, "UBNT-LS-SR71", "Ubiquiti LS-SR71", - ubnt_lssr71_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wam250.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wam250.c deleted file mode 100644 index 31817bddf..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wam250.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Samsung WAM250 board support - * - * Copyright (C) 2018 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 "common.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 WAM250_GPIO_LED_LAN 13 -#define WAM250_GPIO_LED_POWER 15 -#define WAM250_GPIO_LED_REPEATER 14 -#define WAM250_GPIO_LED_WLAN 12 - -#define WAM250_GPIO_BTN_RESET 17 -#define WAM250_GPIO_BTN_SPKADD 1 - -#define WAM250_GPIO_EXT_LNA 19 - -#define WAM250_MAC_OFFSET 2 - -#define WAM250_KEYS_POLL_INTERVAL 20 -#define WAM250_KEYS_DEBOUNCE_INTERVAL (3 * WAM250_KEYS_POLL_INTERVAL) - -static struct gpio_led wam250_leds_gpio[] __initdata = { - { - .name = "wam250:white:lan", - .gpio = WAM250_GPIO_LED_LAN, - .active_low = 1, - }, { - .name = "wam250:white:power", - .gpio = WAM250_GPIO_LED_POWER, - .default_state = LEDS_GPIO_DEFSTATE_KEEP, - .active_low = 1, - }, { - .name = "wam250:white:repeater", - .gpio = WAM250_GPIO_LED_REPEATER, - .active_low = 1, - }, { - .name = "wam250:white:wlan", - .gpio = WAM250_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wam250_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WAM250_KEYS_DEBOUNCE_INTERVAL, - .gpio = WAM250_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WAM250_KEYS_DEBOUNCE_INTERVAL, - .gpio = WAM250_GPIO_BTN_SPKADD, - .active_low = 1, - }, -}; - -static void __init wam250_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(NULL); - - ath79_register_mdio(1, 0x0); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); - - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = 0xfd; - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.phy_mask = BIT(1); - ath79_init_mac(ath79_eth1_data.mac_addr, art + WAM250_MAC_OFFSET, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(0); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, art + WAM250_MAC_OFFSET, 1); - ath79_register_eth(0); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wam250_leds_gpio), - wam250_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WAM250_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wam250_gpio_keys), - wam250_gpio_keys); - - ath79_wmac_set_ext_lna_gpio(0, WAM250_GPIO_EXT_LNA); - - ath79_register_usb(); - ath79_register_wmac(art, NULL); -} - -MIPS_MACHINE(ATH79_MACH_WAM250, "WAM250", "Samsung WAM250", wam250_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-weio.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-weio.c deleted file mode 100644 index 3973ada7c..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-weio.c +++ /dev/null @@ -1,140 +0,0 @@ -/** - * WEIO Web Of Things Platform - * - * Copyright (C) 2013 Drasko DRASKOVIC and Uros PETREVSKI - * - * ## ## ######## #### ####### - * ## ## ## ## ## ## ## - * ## ## ## ## ## ## ## - * ## ## ## ###### ## ## ## - * ## ## ## ## ## ## ## - * ## ## ## ## ## ## ## - * ### ### ######## #### ####### - * - * Web Of Things Platform - * - * 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. - * - * Authors : - * Drasko DRASKOVIC - * Uros PETREVSKI - */ - -#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-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WEIO_GPIO_LED_STA 1 -#define WEIO_GPIO_LED_AP 16 - -#define WEIO_GPIO_BTN_AP 20 -#define WEIO_GPIO_BTN_RESET 23 - -#define WEIO_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WEIO_KEYS_DEBOUNCE_INTERVAL (3 * WEIO_KEYS_POLL_INTERVAL) - -#define WEIO_MAC0_OFFSET 0x0000 -#define WEIO_MAC1_OFFSET 0x0006 -#define WEIO_CALDATA_OFFSET 0x1000 -#define WEIO_WMAC_MAC_OFFSET 0x1002 - -static struct gpio_led weio_leds_gpio[] __initdata = { - { - .name = "weio:green:sta", - .gpio = WEIO_GPIO_LED_STA, - .active_low = 1, - .default_state = LEDS_GPIO_DEFSTATE_ON, - }, - { - .name = "weio:green:ap", - .gpio = WEIO_GPIO_LED_AP, - .active_low = 1, - .default_state = LEDS_GPIO_DEFSTATE_ON, - } -}; - -static struct gpio_keys_button weio_gpio_keys[] __initdata = { - { - .desc = "ap button", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL, - .gpio = WEIO_GPIO_BTN_AP, - .active_low = 1, - }, - { - .desc = "soft-reset button", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL, - .gpio = WEIO_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct i2c_gpio_platform_data weio_i2c_gpio_data = { - .sda_pin = 18, - .scl_pin = 19, -}; - -static struct platform_device weio_i2c_gpio = { - .name = "i2c-gpio", - .id = 0, - .dev = { - .platform_data = &weio_i2c_gpio_data, - }, -}; - -static void __init weio_common_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - ath79_register_wmac(art + WEIO_CALDATA_OFFSET, art + WEIO_WMAC_MAC_OFFSET); -} - -static void __init weio_setup(void) -{ - weio_common_setup(); - - ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - platform_device_register(&weio_i2c_gpio); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(weio_leds_gpio), - weio_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WEIO_KEYS_POLL_INTERVAL, - ARRAY_SIZE(weio_gpio_keys), - weio_gpio_keys); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_WEIO, "WEIO", "WeIO board", weio_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-whr-hp-g300n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-whr-hp-g300n.c deleted file mode 100644 index 48f49ad0f..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-whr-hp-g300n.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Buffalo WHR-HP-G300N board support - * - * based on ... - * - * TP-LINK TL-WR741ND board support - * - * Copyright (C) 2009-2010 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#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 "machtypes.h" - -#define WHRHPG300N_GPIO_LED_SECURITY 0 -#define WHRHPG300N_GPIO_LED_DIAG 1 -#define WHRHPG300N_GPIO_LED_ROUTER 6 - -#define WHRHPG300N_GPIO_BTN_ROUTER_ON 7 -#define WHRHPG300N_GPIO_BTN_ROUTER_AUTO 8 -#define WHRHPG300N_GPIO_BTN_RESET 11 -#define WHRHPG300N_GPIO_BTN_AOSS 12 -#define WHRHPG300N_GPIO_LED_LAN1 13 -#define WHRHPG300N_GPIO_LED_LAN2 14 -#define WHRHPG300N_GPIO_LED_LAN3 15 -#define WHRHPG300N_GPIO_LED_LAN4 16 -#define WHRHPG300N_GPIO_LED_WAN 17 - -#define WHRHPG300N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WHRHPG300N_KEYS_DEBOUNCE_INTERVAL (3 * WHRHPG300N_KEYS_POLL_INTERVAL) - -#define WHRHPG300N_MAC_OFFSET 0x20c - -static struct gpio_led whrhpg300n_leds_gpio[] __initdata = { - { - .name = "buffalo:orange:security", - .gpio = WHRHPG300N_GPIO_LED_SECURITY, - .active_low = 1, - }, { - .name = "buffalo:red:diag", - .gpio = WHRHPG300N_GPIO_LED_DIAG, - .active_low = 1, - }, { - .name = "buffalo:green:router", - .gpio = WHRHPG300N_GPIO_LED_ROUTER, - .active_low = 1, - }, { - .name = "buffalo:green:wan", - .gpio = WHRHPG300N_GPIO_LED_WAN, - .active_low = 1, - }, { - .name = "buffalo:green:lan1", - .gpio = WHRHPG300N_GPIO_LED_LAN1, - .active_low = 1, - }, { - .name = "buffalo:green:lan2", - .gpio = WHRHPG300N_GPIO_LED_LAN2, - .active_low = 1, - }, { - .name = "buffalo:green:lan3", - .gpio = WHRHPG300N_GPIO_LED_LAN3, - .active_low = 1, - }, { - .name = "buffalo:green:lan4", - .gpio = WHRHPG300N_GPIO_LED_LAN4, - .active_low = 1, - } -}; - -static struct gpio_keys_button whrhpg300n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WHRHPG300N_KEYS_DEBOUNCE_INTERVAL, - .gpio = WHRHPG300N_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "aoss/wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .gpio = WHRHPG300N_GPIO_BTN_AOSS, - .debounce_interval = WHRHPG300N_KEYS_DEBOUNCE_INTERVAL, - .active_low = 1, - }, { - .desc = "router_on", - .type = EV_KEY, - .code = BTN_2, - .gpio = WHRHPG300N_GPIO_BTN_ROUTER_ON, - .debounce_interval = WHRHPG300N_KEYS_DEBOUNCE_INTERVAL, - .active_low = 1, - }, { - .desc = "router_auto", - .type = EV_KEY, - .code = BTN_3, - .gpio = WHRHPG300N_GPIO_BTN_ROUTER_AUTO, - .debounce_interval = WHRHPG300N_KEYS_DEBOUNCE_INTERVAL, - .active_low = 1, - } -}; - -static void __init whrhpg300n_setup(void) -{ - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - u8 *mac = (u8 *) KSEG1ADDR(ee + WHRHPG300N_MAC_OFFSET); - - ath79_register_m25p80(NULL); - - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(whrhpg300n_leds_gpio), - whrhpg300n_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WHRHPG300N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(whrhpg300n_gpio_keys), - whrhpg300n_gpio_keys); - - 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); - - /* LAN ports */ - ath79_register_eth(1); - /* WAN port */ - ath79_register_eth(0); - - ap9x_pci_setup_wmac_led_pin(0, 1); - - ap91_pci_init(ee, mac); -} - -MIPS_MACHINE(ATH79_MACH_WHR_HP_G300N, "WHR-HP-G300N", "Buffalo WHR-HP-G300N", - whrhpg300n_setup); - -MIPS_MACHINE(ATH79_MACH_WHR_G301N, "WHR-G301N", "Buffalo WHR-G301N", - whrhpg300n_setup); - -MIPS_MACHINE(ATH79_MACH_WHR_HP_GN, "WHR-HP-GN", "Buffalo WHR-HP-GN", - whrhpg300n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wi2a-ac200i.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wi2a-ac200i.c deleted file mode 100644 index 85e0c8fea..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wi2a-ac200i.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Nokia WI2A-AC200i support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012-2013 Gabor Juhos - * Copyright (c) 2017 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. - * - */ - -#include -#include -#include -#include - -#include -#include - -#include "common.h" -#include "pci.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-nfc.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define AC200I_GPIO_BTN_RESET 17 - -#define AC200I_KEYS_POLL_INTERVAL 20 /* msecs */ -#define AC200I_KEYS_DEBOUNCE_INTERVAL (3 * AC200I_KEYS_POLL_INTERVAL) - -#define AC200I_MAC_ADDR 0x1f040249 -#define AC200I_MAC1_OFFSET 6 -#define AC200I_WMAC_CALDATA_ADDR 0x1f061000 - -static struct gpio_led ac200i_leds_gpio[] __initdata = { - { - .name = "nokia:red:wlan-2g", - .gpio = 0, - .active_low = 1, - }, - { - .name = "nokia:green:power", - .gpio = 1, - .active_low = 1, - }, - { - .name = "nokia:green:wlan-2g", - .gpio = 2, - .active_low = 1, - }, - { - .name = "nokia:green:ctrl", - .gpio = 3, - .active_low = 1, - }, - { - .name = "nokia:green:eth", - .gpio = 4, - .active_low = 1, - }, - { - .name = "nokia:red:power", - .gpio = 13, - .active_low = 1, - }, - { - .name = "nokia:red:eth", - .gpio = 14, - .active_low = 1, - }, - { - .name = "nokia:red:wlan-5g", - .gpio = 18, - .active_low = 1, - }, - { - .name = "nokia:green:wlan-5g", - .gpio = 19, - .active_low = 1, - }, - { - .name = "nokia:red:ctrl", - .gpio = 20, - .active_low = 1, - }, -}; - -static struct gpio_keys_button ac200i_gpio_keys[] __initdata = { - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = AC200I_KEYS_DEBOUNCE_INTERVAL, - .gpio = AC200I_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static struct mtd_partition ac200i_nand_partitions[] = { - { - .name = "cfg", - .offset = 0x0100000, - .size = 0x1800000, - .mask_flags = MTD_WRITEABLE, - }, - { - .name = "kernel", - .offset = 0x2000000, - .size = 0x0400000, - }, - { - .name = "ubi", - .offset = 0x2400000, - .size = 0x2000000, - }, - { - .name = "kernel", - .offset = 0x5000000, - .size = 0x0400000, - }, - { - .name = "ubi", - .offset = 0x5400000, - .size = 0x2000000, - }, -}; - -static const char *boot_getenv(const char *key) -{ - const char *start = (const char *) KSEG1ADDR(0x1f070000); - const char *end = start + 0x20000; - const char *addr; - - for (addr = start + 4; - *addr && *addr != 0xff && addr < end && - strnlen(addr, end - addr) < end - addr; - addr += strnlen(addr, end - addr) + 1) { - const char *val; - - val = strchr(addr, '='); - if (!val) - continue; - - if (strncmp(addr, key, val - addr)) - continue; - - return val + 1; - } - return NULL; -} - -static void __init ac200i_setup(void) -{ - const char *img; - u8 *wmac = (u8 *) KSEG1ADDR(AC200I_WMAC_CALDATA_ADDR); - u8 *mac_addr = (u8 *) KSEG1ADDR(AC200I_MAC_ADDR); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ac200i_leds_gpio), - ac200i_leds_gpio); - ath79_register_gpio_keys_polled(-1, AC200I_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ac200i_gpio_keys), - ac200i_gpio_keys); - - ath79_register_usb(); - ath79_nfc_set_parts(ac200i_nand_partitions, - ARRAY_SIZE(ac200i_nand_partitions)); - ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW); - ath79_register_nfc(); - - ath79_register_wmac(wmac, NULL); - - ath79_register_mdio(0, 0x0); - ath79_init_mac(ath79_eth0_data.mac_addr, mac_addr, 0); - - /* GMAC0 is connected to the SGMII interface */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; - ath79_eth0_pll_data.pll_1000 = 0x03000101; - ath79_eth0_pll_data.pll_100 = 0x80000101; - ath79_eth0_pll_data.pll_10 = 0x80001313; - - img = boot_getenv("dualPartition"); - if (img && !strcmp(img, "imgA")) { - ac200i_nand_partitions[3].name = "kernel_alt"; - ac200i_nand_partitions[4].name = "ubi_alt"; - } else { - ac200i_nand_partitions[1].name = "kernel_alt"; - ac200i_nand_partitions[2].name = "ubi_alt"; - } - - ath79_register_eth(0); - - ath79_register_pci(); -} - -MIPS_MACHINE(ATH79_MACH_WI2A_AC200I, "WI2A-AC200i", - "Nokia WI2A-AC200i", - ac200i_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wifi-pineapple-nano.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wifi-pineapple-nano.c deleted file mode 100644 index 645f367f6..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wifi-pineapple-nano.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Hak5 WiFi Pineapple NANO board support - * - * Copyright (C) 2018 Sebastian Kinne - * Copyright (C) 2018 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 "common.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 WIFI_PINEAPPLE_NANO_GPIO_LED_SYSTEM 18 - -#define WIFI_PINEAPPLE_NANO_GPIO_BTN_RESET 12 -#define WIFI_PINEAPPLE_NANO_GPIO_SD_DET 19 -#define WIFI_PINEAPPLE_NANO_GPIO_USB_ALARM 20 -#define WIFI_PINEAPPLE_NANO_GPIO_USB_POWER 23 - -#define HAK5_KEYS_POLL_INTERVAL 20 /* msecs */ -#define HAK5_KEYS_DEBOUNCE_INTERVAL (3 * HAK5_KEYS_POLL_INTERVAL) - -#define WIFI_PINEAPPLE_NANO_MAC1_OFFSET 0x0006 -#define WIFI_PINEAPPLE_NANO_CALDATA_OFFSET 0x1000 - -static const char *hak5_part_probes[] = { - "tp-link", - NULL, -}; - -static struct flash_platform_data hak5_flash_data = { - .part_probes = hak5_part_probes, -}; - -static struct gpio_led wifi_pineapple_nano_leds_gpio[] __initdata = { - { - .name = "wifi-pineapple-nano:blue:system", - .gpio = WIFI_PINEAPPLE_NANO_GPIO_LED_SYSTEM, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wifi_pineapple_nano_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, - .gpio = WIFI_PINEAPPLE_NANO_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static void __init wifi_pineapple_nano_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(&hak5_flash_data); - - ath79_setup_ar933x_phy4_switch(false, false); - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, - art + WIFI_PINEAPPLE_NANO_MAC1_OFFSET, 0); - ath79_register_eth(0); - - /* GPIO11/12 */ - ath79_gpio_function_disable(AR933X_GPIO_FUNC_UART_RTS_CTS_EN); - - gpio_request_one(WIFI_PINEAPPLE_NANO_GPIO_SD_DET, - GPIOF_IN | GPIOF_EXPORT_DIR_FIXED | GPIOF_ACTIVE_LOW, - "SD card present"); - - gpio_request_one(WIFI_PINEAPPLE_NANO_GPIO_USB_ALARM, - GPIOF_IN | GPIOF_EXPORT_DIR_FIXED | GPIOF_ACTIVE_LOW, - "USB alarm"); - - gpio_request_one(WIFI_PINEAPPLE_NANO_GPIO_USB_POWER, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED | - GPIOF_ACTIVE_LOW, "USB power"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wifi_pineapple_nano_leds_gpio), - wifi_pineapple_nano_leds_gpio); - - ath79_register_gpio_keys_polled(-1, HAK5_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wifi_pineapple_nano_gpio_keys), - wifi_pineapple_nano_gpio_keys); - - ath79_register_usb(); - ath79_register_wmac(art + WIFI_PINEAPPLE_NANO_CALDATA_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_WIFI_PINEAPPLE_NANO, "WIFI-PINEAPPLE-NANO", - "Hak5 WiFi Pineapple NANO", wifi_pineapple_nano_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wlae-ag300n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wlae-ag300n.c deleted file mode 100644 index 11006fd1b..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wlae-ag300n.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Buffalo WLAE-AG300N board support - */ - -#include -#include -#include - -#include - -#include "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" - -#define WLAEAG300N_MAC_OFFSET 0x20c -#define WLAEAG300N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WLAEAG300N_KEYS_DEBOUNCE_INTERVAL (3 * WLAEAG300N_KEYS_POLL_INTERVAL) - - -static struct gpio_led wlaeag300n_leds_gpio[] __initdata = { - /* - * Note: Writing 1 into GPIO 13 will power down the device. - */ - { - .name = "buffalo:green:wireless", - .gpio = 14, - .active_low = 1, - }, { - .name = "buffalo:red:wireless", - .gpio = 15, - .active_low = 1, - }, { - .name = "buffalo:green:status", - .gpio = 16, - .active_low = 1, - }, { - .name = "buffalo:red:status", - .gpio = 17, - .active_low = 1, - } -}; - - -static struct gpio_keys_button wlaeag300n_gpio_keys[] __initdata = { - { - .desc = "function", - .type = EV_KEY, - .code = KEY_MODE, - .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL, - .gpio = 0, - .active_low = 1, - }, { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL, - .gpio = 1, - .active_low = 1, - }, { - .desc = "power", - .type = EV_KEY, - .code = KEY_POWER, - .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL, - .gpio = 11, - .active_low = 1, - }, { - .desc = "aoss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL, - .gpio = 12, - .active_low = 1, - } -}; - -static void __init wlaeag300n_setup(void) -{ - u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1fff1000); - u8 *mac1 = eeprom1 + WLAEAG300N_MAC_OFFSET; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 1); - - ath79_register_mdio(0, ~(BIT(0) | BIT(4))); - - 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_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = BIT(4); - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wlaeag300n_leds_gpio), - wlaeag300n_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WLAEAG300N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wlaeag300n_gpio_keys), - wlaeag300n_gpio_keys); - - ath79_register_m25p80(NULL); - - ap91_pci_init(eeprom1, mac1); -} - -MIPS_MACHINE(ATH79_MACH_WLAE_AG300N, "WLAE-AG300N", - "Buffalo WLAE-AG300N", wlaeag300n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndap360.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndap360.c deleted file mode 100644 index eae1c383e..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndap360.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Netgear WNDAP360 board support (proper leds / button support missing) - * - * Based on AP96 - * Copyright (C) 2013 Jacek Kikiewicz - * Copyright (C) 2009 Marco Porsch - * Copyright (C) 2009-2012 Gabor Juhos - * Copyright (C) 2010 Atheros Communications - * - * 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 "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -#define WNDAP360_GPIO_LED_POWER_ORANGE 0 -#define WNDAP360_GPIO_LED_POWER_GREEN 2 - -/* Reset button - next to the power connector */ -#define WNDAP360_GPIO_BTN_RESET 8 - -#define WNDAP360_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WNDAP360_KEYS_DEBOUNCE_INTERVAL (3 * WNDAP360_KEYS_POLL_INTERVAL) - -#define WNDAP360_WMAC0_MAC_OFFSET 0x120c -#define WNDAP360_WMAC1_MAC_OFFSET 0x520c -#define WNDAP360_CALDATA0_OFFSET 0x1000 -#define WNDAP360_CALDATA1_OFFSET 0x5000 - -/* - * WNDAP360 this still uses leds definitions from AP96 - * - */ -static struct gpio_led wndap360_leds_gpio[] __initdata = { - { - .name = "netgear:green:power", - .gpio = WNDAP360_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, { - .name = "netgear:orange:power", - .gpio = WNDAP360_GPIO_LED_POWER_ORANGE, - .active_low = 1, - } -}; - -static struct gpio_keys_button wndap360_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNDAP360_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNDAP360_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -#define WNDAP360_LAN_PHYMASK 0x0f - -static void __init wndap360_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_mdio(0, ~(WNDAP360_LAN_PHYMASK)); - - /* Reusing wifi MAC with offset of 1 as eth0 MAC */ - ath79_init_mac(ath79_eth0_data.mac_addr, - art + WNDAP360_WMAC0_MAC_OFFSET, 1); - ath79_eth0_pll_data.pll_1000 = 0x11110000; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.phy_mask = WNDAP360_LAN_PHYMASK; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_register_eth(0); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wndap360_leds_gpio), - wndap360_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WNDAP360_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wndap360_gpio_keys), - wndap360_gpio_keys); - - ap9x_pci_setup_wmac_led_pin(0, 5); - ap9x_pci_setup_wmac_led_pin(1, 5); - - ap94_pci_init(art + WNDAP360_CALDATA0_OFFSET, - art + WNDAP360_WMAC0_MAC_OFFSET, - art + WNDAP360_CALDATA1_OFFSET, - art + WNDAP360_WMAC1_MAC_OFFSET); -} - -MIPS_MACHINE(ATH79_MACH_WNDAP360, "WNDAP360", "NETGEAR WNDAP360", wndap360_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndr3700.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndr3700.c deleted file mode 100644 index b9132fc36..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndr3700.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Netgear WNDR3700 board support - * - * Copyright (C) 2009 Marco Porsch - * 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 -#include -#include -#include - -#include - -#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 "machtypes.h" - -#define WNDR3700_GPIO_LED_WPS_ORANGE 0 -#define WNDR3700_GPIO_LED_POWER_ORANGE 1 -#define WNDR3700_GPIO_LED_POWER_GREEN 2 -#define WNDR3700_GPIO_LED_WPS_GREEN 4 -#define WNDR3700_GPIO_LED_WAN_GREEN 6 - -#define WNDR3700_GPIO_BTN_WPS 3 -#define WNDR3700_GPIO_BTN_RESET 8 -#define WNDR3700_GPIO_BTN_RFKILL 11 - -#define WNDR3700_GPIO_RTL8366_SDA 5 -#define WNDR3700_GPIO_RTL8366_SCK 7 - -#define WNDR3700_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WNDR3700_KEYS_DEBOUNCE_INTERVAL (3 * WNDR3700_KEYS_POLL_INTERVAL) - -#define WNDR3700_ETH0_MAC_OFFSET 0 -#define WNDR3700_ETH1_MAC_OFFSET 0x6 - -#define WNDR3700_WMAC0_MAC_OFFSET 0 -#define WNDR3700_WMAC1_MAC_OFFSET 0xc -#define WNDR3700_CALDATA0_OFFSET 0x1000 -#define WNDR3700_CALDATA1_OFFSET 0x5000 - -static struct gpio_led wndr3700_leds_gpio[] __initdata = { - { - .name = "netgear:green:power", - .gpio = WNDR3700_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, { - .name = "netgear:orange:power", - .gpio = WNDR3700_GPIO_LED_POWER_ORANGE, - .active_low = 1, - }, { - .name = "netgear:green:wps", - .gpio = WNDR3700_GPIO_LED_WPS_GREEN, - .active_low = 1, - }, { - .name = "netgear:orange:wps", - .gpio = WNDR3700_GPIO_LED_WPS_ORANGE, - .active_low = 1, - }, { - .name = "netgear:green:wan", - .gpio = WNDR3700_GPIO_LED_WAN_GREEN, - .active_low = 1, - } -}; - -static struct gpio_keys_button wndr3700_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNDR3700_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNDR3700_GPIO_BTN_WPS, - .active_low = 1, - }, { - .desc = "rfkill", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WNDR3700_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNDR3700_GPIO_BTN_RFKILL, - .active_low = 1, - } -}; - -static struct rtl8366_platform_data wndr3700_rtl8366s_data = { - .gpio_sda = WNDR3700_GPIO_RTL8366_SDA, - .gpio_sck = WNDR3700_GPIO_RTL8366_SCK, -}; - -static struct platform_device wndr3700_rtl8366s_device = { - .name = RTL8366S_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &wndr3700_rtl8366s_data, - } -}; - -static void __init wndr3700_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - /* - * The eth0 and wmac0 interfaces share the same MAC address which - * can lead to problems if operated unbridged. Set the locally - * administered bit on the eth0 MAC to make it unique. - */ - ath79_init_local_mac(ath79_eth0_data.mac_addr, - art + WNDR3700_ETH0_MAC_OFFSET); - ath79_eth0_pll_data.pll_1000 = 0x11110000; - ath79_eth0_data.mii_bus_dev = &wndr3700_rtl8366s_device.dev; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_init_mac(ath79_eth1_data.mac_addr, - art + WNDR3700_ETH1_MAC_OFFSET, 0); - ath79_eth1_pll_data.pll_1000 = 0x11110000; - ath79_eth1_data.mii_bus_dev = &wndr3700_rtl8366s_device.dev; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = 0x10; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_usb(); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio), - wndr3700_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WNDR3700_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wndr3700_gpio_keys), - wndr3700_gpio_keys); - - platform_device_register(&wndr3700_rtl8366s_device); - platform_device_register_simple("wndr3700-led-usb", -1, NULL, 0); - - ap9x_pci_setup_wmac_led_pin(0, 5); - ap9x_pci_setup_wmac_led_pin(1, 5); - - /* 2.4 GHz uses the first fixed antenna group (1, 0, 1, 0) */ - ap9x_pci_setup_wmac_gpio(0, (0xf << 6), (0xa << 6)); - - /* 5 GHz uses the second fixed antenna group (0, 1, 1, 0) */ - ap9x_pci_setup_wmac_gpio(1, (0xf << 6), (0x6 << 6)); - - ap94_pci_init(art + WNDR3700_CALDATA0_OFFSET, - art + WNDR3700_WMAC0_MAC_OFFSET, - art + WNDR3700_CALDATA1_OFFSET, - art + WNDR3700_WMAC1_MAC_OFFSET); -} - -MIPS_MACHINE(ATH79_MACH_WNDR3700, "WNDR3700", - "NETGEAR WNDR3700/WNDR3800/WNDRMAC", - wndr3700_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000-v3.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000-v3.c deleted file mode 100644 index 6c18dc6d9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000-v3.c +++ /dev/null @@ -1,637 +0,0 @@ -/* - * NETGEAR WNR2000v3/WNR612v2/WNR1000v2/WPN824N board support - * - * Copyright (C) 2015 Hartmut Knaack - * Copyright (C) 2013 Mathieu Olivari - * Copyright (C) 2008-2009 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * Copyright (C) 2008-2009 Andy Boyett - * - * 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 /* for max() macro */ -#include /* PLATFORM_DEVID_AUTO is defined here */ - -#include -#include /* needed to disable switch LEDs */ -#include "common.h" /* needed to disable switch LEDs */ - -#include "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -/* WNR2000v3 - connected through AR7241 */ -#define WNR2000V3_GPIO_LED_WAN_GREEN 0 -#define WNR2000V3_GPIO_LED_LAN1_AMBER 1 -#define WNR2000V3_GPIO_LED_LAN2_AMBER 6 -#define WNR2000V3_GPIO_LED_WPS_GREEN 7 -#define WNR2000V3_GPIO_LED_LAN3_AMBER 8 -#define WNR2000V3_GPIO_BTN_WPS 11 -#define WNR2000V3_GPIO_LED_LAN4_AMBER 12 -#define WNR2000V3_GPIO_LED_LAN1_GREEN 13 -#define WNR2000V3_GPIO_LED_LAN2_GREEN 14 -#define WNR2000V3_GPIO_LED_LAN3_GREEN 15 -#define WNR2000V3_GPIO_LED_LAN4_GREEN 16 -#define WNR2000V3_GPIO_LED_WAN_AMBER 17 - -/* WNR2000v3 - connected through AR9287 */ -#define WNR2000V3_GPIO_WMAC_LED_WLAN_BLUE 1 -#define WNR2000V3_GPIO_WMAC_LED_TEST_AMBER 2 -#define WNR2000V3_GPIO_WMAC_LED_POWER_GREEN 3 -#define WNR2000V3_GPIO_WMAC_BTN_RESET 8 -#define WNR2000V3_GPIO_WMAC_BTN_RFKILL 9 - -/* WNR612v2 - connected through AR7241 */ -#define WNR612V2_GPIO_LED_POWER_GREEN 11 -#define WNR612V2_GPIO_LED_LAN1_GREEN 13 -#define WNR612V2_GPIO_LED_LAN2_GREEN 14 -#define WNR612V2_GPIO_LED_WAN_GREEN 17 - -/* WNR612v2 - connected through AR9285 */ -#define WNR612V2_GPIO_WMAC_LED_WLAN_GREEN 1 -#define WNR612V2_GPIO_WMAC_BTN_RESET 7 - -/* WNR1000v2 - connected through AR7240 */ -#define WNR1000V2_GPIO_LED_WAN_AMBER 0 -#define WNR1000V2_GPIO_LED_TEST_AMBER 1 -#define WNR1000V2_GPIO_LED_LAN1_AMBER 6 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WNR1000V2_GPIO_LED_LAN2_AMBER 7 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WNR1000V2_GPIO_LED_LAN3_AMBER 8 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WNR1000V2_GPIO_LED_POWER_GREEN 11 -#define WNR1000V2_GPIO_LED_LAN4_AMBER 12 -#define WNR1000V2_GPIO_LED_LAN1_GREEN 13 /* AR724X_..._ETH_SWITCH_LED0 */ -#define WNR1000V2_GPIO_LED_LAN2_GREEN 14 /* AR724X_..._ETH_SWITCH_LED1 */ -#define WNR1000V2_GPIO_LED_LAN3_GREEN 15 /* AR724X_..._ETH_SWITCH_LED2 */ -#define WNR1000V2_GPIO_LED_LAN4_GREEN 16 /* AR724X_..._ETH_SWITCH_LED3 */ -#define WNR1000V2_GPIO_LED_WAN_GREEN 17 /* AR724X_..._ETH_SWITCH_LED4 */ - -/* WNR1000v2 - connected through AR9285 */ -#define WNR1000V2_GPIO_WMAC_LED_WLAN_BLUE 1 -#define WNR1000V2_GPIO_WMAC_LED_WPS_GREEN 5 -#define WNR1000V2_GPIO_WMAC_BTN_WPS 6 -#define WNR1000V2_GPIO_WMAC_BTN_RESET 7 -#define WNR1000V2_GPIO_WMAC_BTN_RFKILL 8 - -/* WPN824N - connected through AR7240 */ -#define WPN824N_GPIO_LED_WAN_AMBER 0 -#define WPN824N_GPIO_LED_STATUS_AMBER 1 -#define WPN824N_GPIO_LED_LAN1_AMBER 6 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WPN824N_GPIO_LED_LAN2_AMBER 7 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WPN824N_GPIO_LED_LAN3_AMBER 8 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WPN824N_GPIO_LED_LAN4_AMBER 12 -#define WPN824N_GPIO_LED_LAN1_GREEN 13 -#define WPN824N_GPIO_LED_LAN2_GREEN 14 -#define WPN824N_GPIO_LED_LAN3_GREEN 15 /* AR724X_GPIO_FUNC_CLK_OBS3_EN */ -#define WPN824N_GPIO_LED_LAN4_GREEN 16 -#define WPN824N_GPIO_LED_WAN_GREEN 17 - -/* WPN824N - connected through AR9285 */ -#define WPN824N_WGPIO_LED_PWR_GREEN 0 -#define WPN824N_WGPIO_LED_WLAN_BLUE 1 -#define WPN824N_WGPIO_LED_WPS1_BLUE 5 -#define WPN824N_WGPIO_LED_WPS2_BLUE 9 -#define WPN824N_WGPIO_LED_TEST_AMBER 10 -#define WPN824N_WGPIO_BTN_WPS 6 -#define WPN824N_WGPIO_BTN_RESET 7 -#define WPN824N_WGPIO_BTN_WLAN 8 - -#define WNR2000V3_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WNR2000V3_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000V3_KEYS_POLL_INTERVAL) - -/* ART offsets for: WNR2000v3, WNR612v2, WNR1000v2 */ -#define WNR2000V3_MAC0_OFFSET 0 -#define WNR2000V3_MAC1_OFFSET 6 -#define WNR2000V3_PCIE_CALDATA_OFFSET 0x1000 -#define WNR2000V3_WMAC_OFFSET 0x108c /* wireless MAC is inside ART */ - -static struct gpio_led wnr2000v3_leds_gpio[] __initdata = { - { - .name = "netgear:green:wan", - .gpio = WNR2000V3_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "netgear:amber:lan1", - .gpio = WNR2000V3_GPIO_LED_LAN1_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan2", - .gpio = WNR2000V3_GPIO_LED_LAN2_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan3", - .gpio = WNR2000V3_GPIO_LED_LAN3_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan4", - .gpio = WNR2000V3_GPIO_LED_LAN4_AMBER, - .active_low = 1, - }, { - .name = "netgear:green:wps", - .gpio = WNR2000V3_GPIO_LED_WPS_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan1", - .gpio = WNR2000V3_GPIO_LED_LAN1_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan2", - .gpio = WNR2000V3_GPIO_LED_LAN2_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan3", - .gpio = WNR2000V3_GPIO_LED_LAN3_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan4", - .gpio = WNR2000V3_GPIO_LED_LAN4_GREEN, - .active_low = 1, - }, { - .name = "netgear:amber:wan", - .gpio = WNR2000V3_GPIO_LED_WAN_AMBER, - .active_low = 1, - } -}; - -static struct gpio_led wnr2000v3_wmac_leds_gpio[] = { - { - .name = "netgear:green:power", - .gpio = WNR2000V3_GPIO_WMAC_LED_POWER_GREEN, - .active_low = 1, - .default_state = LEDS_GPIO_DEFSTATE_ON, - }, { - .name = "netgear:amber:test", - .gpio = WNR2000V3_GPIO_WMAC_LED_TEST_AMBER, - .active_low = 1, - }, { - .name = "netgear:blue:wlan", - .gpio = WNR2000V3_GPIO_WMAC_LED_WLAN_BLUE, - .active_low = 1, - } -}; - -static struct gpio_led wnr612v2_leds_gpio[] __initdata = { - { - .name = "netgear:green:power", - .gpio = WNR612V2_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan1", - .gpio = WNR612V2_GPIO_LED_LAN1_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan2", - .gpio = WNR612V2_GPIO_LED_LAN2_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:wan", - .gpio = WNR612V2_GPIO_LED_WAN_GREEN, - .active_low = 1, - } -}; - -static struct gpio_led wnr612v2_wmac_leds_gpio[] __initdata = { - { - .name = "netgear:green:wlan", - .gpio = WNR612V2_GPIO_WMAC_LED_WLAN_GREEN, - .active_low = 1, - } -}; - -static struct gpio_led wnr1000v2_leds_gpio[] __initdata = { - { - .name = "netgear:amber:lan1", - .gpio = WNR1000V2_GPIO_LED_LAN1_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan2", - .gpio = WNR1000V2_GPIO_LED_LAN2_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan3", - .gpio = WNR1000V2_GPIO_LED_LAN3_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan4", - .gpio = WNR1000V2_GPIO_LED_LAN4_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:test", - .gpio = WNR1000V2_GPIO_LED_TEST_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:wan", - .gpio = WNR1000V2_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, { - .name = "netgear:green:lan1", - .gpio = WNR1000V2_GPIO_LED_LAN1_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan2", - .gpio = WNR1000V2_GPIO_LED_LAN2_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan3", - .gpio = WNR1000V2_GPIO_LED_LAN3_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan4", - .gpio = WNR1000V2_GPIO_LED_LAN4_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:power", - .gpio = WNR1000V2_GPIO_LED_POWER_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:wan", - .gpio = WNR1000V2_GPIO_LED_WAN_GREEN, - .active_low = 1, - } -}; - -static struct gpio_led wnr1000v2_wmac_leds_gpio[] = { - { - .name = "netgear:green:wps", - .gpio = WNR1000V2_GPIO_WMAC_LED_WPS_GREEN, - .active_low = 1, - }, { - .name = "netgear:blue:wlan", - .gpio = WNR1000V2_GPIO_WMAC_LED_WLAN_BLUE, - .active_low = 1, - } -}; - -static struct gpio_led wpn824n_leds_gpio[] __initdata = { - { - .name = "netgear:amber:wan", - .gpio = WPN824N_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:status", - .gpio = WPN824N_GPIO_LED_STATUS_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan1", - .gpio = WPN824N_GPIO_LED_LAN1_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan2", - .gpio = WPN824N_GPIO_LED_LAN2_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan3", - .gpio = WPN824N_GPIO_LED_LAN3_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan4", - .gpio = WPN824N_GPIO_LED_LAN4_AMBER, - .active_low = 1, - }, { - .name = "netgear:green:lan1", - .gpio = WPN824N_GPIO_LED_LAN1_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan2", - .gpio = WPN824N_GPIO_LED_LAN2_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan3", - .gpio = WPN824N_GPIO_LED_LAN3_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan4", - .gpio = WPN824N_GPIO_LED_LAN4_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:wan", - .gpio = WPN824N_GPIO_LED_WAN_GREEN, - .active_low = 1, - } -}; - -static struct gpio_led wpn824n_wmac_leds_gpio[] = { - { - .name = "netgear:green:power", - .gpio = WPN824N_WGPIO_LED_PWR_GREEN, - .active_low = 1, - }, { - .name = "netgear:blue:wps1", - .gpio = WPN824N_WGPIO_LED_WPS1_BLUE, - .active_low = 1, - }, { - .name = "netgear:blue:wps2", - .gpio = WPN824N_WGPIO_LED_WPS2_BLUE, - .active_low = 1, - }, { - .name = "netgear:amber:test", - .gpio = WPN824N_WGPIO_LED_TEST_AMBER, - .active_low = 1, - }, { - .name = "netgear:blue:wlan", - .gpio = WPN824N_WGPIO_LED_WLAN_BLUE, - .active_low = 1, - } -}; - -static struct gpio_keys_button wnr2000v3_keys_gpio[] __initdata = { - { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2000V3_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static struct gpio_keys_button wnr2000v3_wmac_keys_gpio[] = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2000V3_GPIO_WMAC_BTN_RESET, - .active_low = 1, - }, { - .desc = "rfkill", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2000V3_GPIO_WMAC_BTN_RFKILL, - .active_low = 1, - } -}; - -static struct gpio_keys_button wnr612v2_wmac_keys_gpio[] = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR612V2_GPIO_WMAC_BTN_RESET, - .active_low = 1, - } -}; - -static struct gpio_keys_button wnr1000v2_wmac_keys_gpio[] = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR1000V2_GPIO_WMAC_BTN_RESET, - .active_low = 1, - }, { - .desc = "rfkill", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR1000V2_GPIO_WMAC_BTN_RFKILL, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR1000V2_GPIO_WMAC_BTN_WPS, - .active_low = 1, - } -}; - -static struct gpio_keys_button wpn824n_wmac_keys_gpio[] = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPN824N_WGPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "rfkill", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPN824N_WGPIO_BTN_WLAN, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPN824N_WGPIO_BTN_WPS, - .active_low = 1, - } -}; - -/* - * For WNR2000v3 ART flash area used for WLAN MAC is usually empty (0xff) - * so ath9k driver uses random MAC instead each time module is loaded. - * To fix that, assign permanent WLAN MAC equal to ethN's MAC plus 1, - * so network interfaces get sequential addresses. - * If ART wireless MAC address field has been filled by user, use it. - */ -static void __init wnr_get_wmac(u8 *wmac_gen_addr, int mac0_art_offset, - int mac1_art_offset, int wmac_art_offset) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *eth0_mac_addr = (u8 *) (art + mac0_art_offset); - u8 *eth1_mac_addr = (u8 *) (art + mac1_art_offset); - u8 *wlan_mac_addr = (u8 *) (art + wmac_art_offset); - - /* only 0xff if all bits are set - address is invalid, empty area */ - if ((wlan_mac_addr[0] & wlan_mac_addr[1] & wlan_mac_addr[2] & - wlan_mac_addr[3] & wlan_mac_addr[4] & wlan_mac_addr[5]) == 0xff) { - memcpy(wmac_gen_addr, eth0_mac_addr, 5); - wmac_gen_addr[5] = max(eth0_mac_addr[5], eth1_mac_addr[5]) + 1; - - /* Avoid potential conflict in case max(0xff,0x00)+1==0x00 */ - if (!wmac_gen_addr[5]) - wmac_gen_addr[5] = 1; - } else - memcpy(wmac_gen_addr, wlan_mac_addr, 6); -} - -static void __init wnr_common_setup(u8 *wmac_addr) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2000V3_MAC0_OFFSET, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2000V3_MAC1_OFFSET, 0); - 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(NULL); - ap91_pci_init(art + WNR2000V3_PCIE_CALDATA_OFFSET, wmac_addr); -} - -static void __init wnr2000v3_setup(void) -{ - u8 wlan_mac_addr[6]; - - /* - * Disable JTAG to use all AR724X GPIO LEDs. - * Also disable CLKs and bit 20 as u-boot does. - * Finally, allow OS to control all link LEDs. - */ - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE | - AR724X_GPIO_FUNC_UART_EN, - AR724X_GPIO_FUNC_CLK_OBS1_EN | - AR724X_GPIO_FUNC_CLK_OBS2_EN | - AR724X_GPIO_FUNC_CLK_OBS3_EN | - AR724X_GPIO_FUNC_CLK_OBS4_EN | - AR724X_GPIO_FUNC_CLK_OBS5_EN | - AR724X_GPIO_FUNC_GE0_MII_CLK_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN | - BIT(20)); - - wnr_get_wmac(wlan_mac_addr, WNR2000V3_MAC0_OFFSET, - WNR2000V3_MAC1_OFFSET, WNR2000V3_WMAC_OFFSET); - - wnr_common_setup(wlan_mac_addr); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2000v3_leds_gpio), - wnr2000v3_leds_gpio); - - /* Do not use id=-1, we can have more GPIO key-polled devices */ - ath79_register_gpio_keys_polled(PLATFORM_DEVID_AUTO, - WNR2000V3_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wnr2000v3_keys_gpio), - wnr2000v3_keys_gpio); - - ap9x_pci_setup_wmac_leds(0, wnr2000v3_wmac_leds_gpio, - ARRAY_SIZE(wnr2000v3_wmac_leds_gpio)); - - ap9x_pci_setup_wmac_btns(0, wnr2000v3_wmac_keys_gpio, - ARRAY_SIZE(wnr2000v3_wmac_keys_gpio), - WNR2000V3_KEYS_POLL_INTERVAL); -} - -MIPS_MACHINE(ATH79_MACH_WNR2000_V3, "WNR2000V3", "NETGEAR WNR2000 V3", wnr2000v3_setup); - -static void __init wnr612v2_setup(void) -{ - u8 wlan_mac_addr[6]; - - /* - * Disable JTAG and CLKs. Allow OS to control all link LEDs. - * Note: U-Boot for WNR612v2 sets undocumented bit 15 but - * we leave it for now. - */ - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE | - AR724X_GPIO_FUNC_UART_EN, - AR724X_GPIO_FUNC_CLK_OBS1_EN | - AR724X_GPIO_FUNC_CLK_OBS2_EN | - AR724X_GPIO_FUNC_CLK_OBS3_EN | - AR724X_GPIO_FUNC_CLK_OBS4_EN | - AR724X_GPIO_FUNC_CLK_OBS5_EN | - AR724X_GPIO_FUNC_GE0_MII_CLK_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - wnr_get_wmac(wlan_mac_addr, WNR2000V3_MAC0_OFFSET, - WNR2000V3_MAC1_OFFSET, WNR2000V3_WMAC_OFFSET); - - wnr_common_setup(wlan_mac_addr); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr612v2_leds_gpio), - wnr612v2_leds_gpio); - - ap9x_pci_setup_wmac_leds(0, wnr612v2_wmac_leds_gpio, - ARRAY_SIZE(wnr612v2_leds_gpio)); - - ap9x_pci_setup_wmac_btns(0, wnr612v2_wmac_keys_gpio, - ARRAY_SIZE(wnr612v2_wmac_keys_gpio), - WNR2000V3_KEYS_POLL_INTERVAL); -} - -MIPS_MACHINE(ATH79_MACH_WNR612_V2, "WNR612V2", "NETGEAR WNR612 V2", wnr612v2_setup); - -static void __init wnr1000v2_setup(void) -{ - u8 wlan_mac_addr[6]; - - /* - * Disable JTAG and CLKs. Allow OS to control all link LEDs. - * Note: U-Boot for WNR1000v2 sets undocumented bit 15 but - * we leave it for now. - */ - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE | - AR724X_GPIO_FUNC_UART_EN, - AR724X_GPIO_FUNC_CLK_OBS1_EN | - AR724X_GPIO_FUNC_CLK_OBS2_EN | - AR724X_GPIO_FUNC_CLK_OBS3_EN | - AR724X_GPIO_FUNC_CLK_OBS4_EN | - AR724X_GPIO_FUNC_CLK_OBS5_EN | - AR724X_GPIO_FUNC_GE0_MII_CLK_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - wnr_get_wmac(wlan_mac_addr, WNR2000V3_MAC0_OFFSET, - WNR2000V3_MAC1_OFFSET, WNR2000V3_WMAC_OFFSET); - - wnr_common_setup(wlan_mac_addr); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr1000v2_leds_gpio), - wnr1000v2_leds_gpio); - - ap9x_pci_setup_wmac_leds(0, wnr1000v2_wmac_leds_gpio, - ARRAY_SIZE(wnr1000v2_wmac_leds_gpio)); - - /* All 3 buttons are connected to wireless chip */ - ap9x_pci_setup_wmac_btns(0, wnr1000v2_wmac_keys_gpio, - ARRAY_SIZE(wnr1000v2_wmac_keys_gpio), - WNR2000V3_KEYS_POLL_INTERVAL); -} - -MIPS_MACHINE(ATH79_MACH_WNR1000_V2, "WNR1000V2", "NETGEAR WNR1000 V2", wnr1000v2_setup); - -static void __init wpn824n_setup(void) -{ - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE, - AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN | - AR724X_GPIO_FUNC_CLK_OBS3_EN); - - wnr_common_setup(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wpn824n_leds_gpio), - wpn824n_leds_gpio); - - ap9x_pci_setup_wmac_leds(0, wpn824n_wmac_leds_gpio, - ARRAY_SIZE(wpn824n_wmac_leds_gpio)); - ap9x_pci_setup_wmac_btns(0, wpn824n_wmac_keys_gpio, - ARRAY_SIZE(wpn824n_wmac_keys_gpio), - WNR2000V3_KEYS_POLL_INTERVAL); -} - -MIPS_MACHINE(ATH79_MACH_WPN824N, "WPN824N", "NETGEAR WPN824N", wpn824n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000-v4.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000-v4.c deleted file mode 100644 index c5159a30c..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000-v4.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * NETGEAR WNR2000v4 board support - * - * Copyright (C) 2015 Michael Bazzinotti - * Copyright (C) 2014 Michaël Burtin - * Copyright (C) 2013 Mathieu Olivari - * Copyright (C) 2008-2009 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * Copyright (C) 2008-2009 Andy Boyett - * - * 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 "common.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" - -/* AR9341 GPIOs */ -#define WNR2000V4_GPIO_LED_PWR_GREEN 0 -#define WNR2000V4_GPIO_LED_PWR_AMBER 1 -#define WNR2000V4_GPIO_LED_WPS 2 -#define WNR2000V4_GPIO_LED_WLAN 12 -#define WNR2000V4_GPIO_LED_LAN1_GREEN 13 -#define WNR2000V4_GPIO_LED_LAN2_GREEN 14 -#define WNR2000V4_GPIO_LED_LAN3_GREEN 15 -#define WNR2000V4_GPIO_LED_LAN4_GREEN 16 -#define WNR2000V4_GPIO_LED_LAN1_AMBER 18 -#define WNR2000V4_GPIO_LED_LAN2_AMBER 19 -#define WNR2000V4_GPIO_LED_LAN3_AMBER 20 -#define WNR2000V4_GPIO_LED_LAN4_AMBER 21 -#define WNR2000V4_GPIO_LED_WAN_GREEN 17 -#define WNR2000V4_GPIO_LED_WAN_AMBER 22 -/* Buttons */ -#define WNR2000V4_GPIO_BTN_WPS 3 -#define WNR2000V4_GPIO_BTN_RESET 4 -#define WNR2000V4_GPIO_BTN_WLAN 11 -#define WNR2000V4_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WNR2000V4_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000V4_KEYS_POLL_INTERVAL) - - -/* ART offsets */ -#define WNR2000V4_MAC0_OFFSET 0 /* WAN/WLAN0 MAC */ -#define WNR2000V4_MAC1_OFFSET 6 /* Eth-switch0 MAC */ - -static struct gpio_led wnr2000v4_leds_gpio[] __initdata = { - { - .name = "netgear:green:power", - .gpio = WNR2000V4_GPIO_LED_PWR_GREEN, - .active_low = 1, - .default_trigger = "default-on", - }, - { - .name = "netgear:amber:status", - .gpio = WNR2000V4_GPIO_LED_PWR_AMBER, - .active_low = 1, - }, - { - .name = "netgear:green:wan", - .gpio = WNR2000V4_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, - { - .name = "netgear:amber:wan", - .gpio = WNR2000V4_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, - { - .name = "netgear:blue:wlan", - .gpio = WNR2000V4_GPIO_LED_WLAN, - .active_low = 1, - }, - /* LAN LEDS */ - { - .name = "netgear:green:lan1", - .gpio = WNR2000V4_GPIO_LED_LAN1_GREEN, - .active_low = 1, - }, - { - .name = "netgear:green:lan2", - .gpio = WNR2000V4_GPIO_LED_LAN2_GREEN, - .active_low = 1, - }, - { - .name = "netgear:green:lan3", - .gpio = WNR2000V4_GPIO_LED_LAN3_GREEN, - .active_low = 1, - }, - { - .name = "netgear:green:lan4", - .gpio = WNR2000V4_GPIO_LED_LAN4_GREEN, - .active_low = 1, - }, - { - .name = "netgear:amber:lan1", - .gpio = WNR2000V4_GPIO_LED_LAN1_AMBER, - .active_low = 1, - }, - { - .name = "netgear:amber:lan2", - .gpio = WNR2000V4_GPIO_LED_LAN2_AMBER, - .active_low = 1, - }, - { - .name = "netgear:amber:lan3", - .gpio = WNR2000V4_GPIO_LED_LAN3_AMBER, - .active_low = 1, - }, - { - .name = "netgear:amber:lan4", - .gpio = WNR2000V4_GPIO_LED_LAN4_AMBER, - .active_low = 1, - }, - { - .name = "netgear:green:wps", - .gpio = WNR2000V4_GPIO_LED_WPS, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wnr2000v4_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WNR2000V4_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2000V4_GPIO_BTN_WPS, - .active_low = 1, - }, - { - .desc = "Reset button", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNR2000V4_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2000V4_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "WLAN button", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WNR2000V4_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2000V4_GPIO_BTN_WLAN, - .active_low = 1, - }, -}; - -static void __init wnr_common_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_mdio(1, 0x0); - - ath79_register_usb(); - - ath79_register_m25p80(NULL); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - - ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2000V4_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2000V4_MAC1_OFFSET, 0); - - /* GMAC0 is connected to the PHY0 of the internal switch, GE0 */ - ath79_switch_data.phy4_mii_en = 1; - ath79_switch_data.phy_poll_mask = BIT(4); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - ath79_register_eth(0); - - /* GMAC1 is connected to the internal switch, GE1 */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); - - ath79_register_wmac(ee, art); -} - -static void __init wnr2000v4_setup(void) -{ - int i; - - wnr_common_setup(); - - /* Ensure no LED has an internal MUX signal, otherwise - control of LED could be lost... This is especially important - for most green LEDS (Eth,WAN).. who arrive in this function with - MUX signals set. */ - for (i = 0; i < ARRAY_SIZE(wnr2000v4_leds_gpio); i++) - ath79_gpio_output_select(wnr2000v4_leds_gpio[i].gpio, - AR934X_GPIO_OUT_GPIO); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2000v4_leds_gpio), - wnr2000v4_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WNR2000V4_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wnr2000v4_gpio_keys), - wnr2000v4_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_WNR2000_V4, "WNR2000V4", "NETGEAR WNR2000 V4", wnr2000v4_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000.c deleted file mode 100644 index 6e3becab3..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2000.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * NETGEAR WNR2000 board support - * - * Copyright (C) 2008-2009 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * Copyright (C) 2008-2009 Andy Boyett - * - * 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 "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 WNR2000_GPIO_LED_PWR_GREEN 14 -#define WNR2000_GPIO_LED_PWR_AMBER 7 -#define WNR2000_GPIO_LED_WPS 4 -#define WNR2000_GPIO_LED_WLAN 6 -#define WNR2000_GPIO_BTN_RESET 21 -#define WNR2000_GPIO_BTN_WPS 8 - -#define WNR2000_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WNR2000_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000_KEYS_POLL_INTERVAL) - -static struct gpio_led wnr2000_leds_gpio[] __initdata = { - { - .name = "netgear:green:power", - .gpio = WNR2000_GPIO_LED_PWR_GREEN, - .active_low = 1, - }, { - .name = "netgear:amber:power", - .gpio = WNR2000_GPIO_LED_PWR_AMBER, - .active_low = 1, - }, { - .name = "netgear:green:wps", - .gpio = WNR2000_GPIO_LED_WPS, - .active_low = 1, - }, { - .name = "netgear:blue:wlan", - .gpio = WNR2000_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button wnr2000_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNR2000_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2000_GPIO_BTN_RESET, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WNR2000_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2000_GPIO_BTN_WPS, - } -}; - -static void __init wnr2000_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, eeprom, 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, eeprom, 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); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2000_leds_gpio), - wnr2000_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WNR2000_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wnr2000_gpio_keys), - wnr2000_gpio_keys); - - ath79_register_wmac(eeprom, NULL); -} - -MIPS_MACHINE(ATH79_MACH_WNR2000, "WNR2000", "NETGEAR WNR2000", wnr2000_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2200.c deleted file mode 100644 index 54217220f..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wnr2200.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * NETGEAR WNR2200 board support - * - * Copyright (C) 2013 Aidan Kissane - * - * 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 /* for max() macro */ - -#include -#include /* needed to disable switch LEDs */ -#include "common.h" /* needed to disable switch LEDs */ - -#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 "machtypes.h" - -/* WNR2200 - connected through AR7241 */ -#define WNR2200_GPIO_LED_LAN2_AMBER 0 -#define WNR2200_GPIO_LED_LAN4_AMBER 1 -#define WNR2200_GPIO_LED_LAN1_AMBER 6 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WNR2200_GPIO_LED_WPS_GREEN 7 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WNR2200_GPIO_LED_USB_GREEN 8 /* AR724X_GPIO_FUNC_JTAG_DISABLE */ -#define WNR2200_GPIO_LED_LAN3_AMBER 11 -#define WNR2200_GPIO_LED_WAN_AMBER 12 -#define WNR2200_GPIO_LED_LAN1_GREEN 13 /* AR724X_..._ETH_SWITCH_LED0 */ -#define WNR2200_GPIO_LED_LAN2_GREEN 14 /* AR724X_..._ETH_SWITCH_LED1 */ -#define WNR2200_GPIO_LED_LAN3_GREEN 15 /* AR724X_..._ETH_SWITCH_LED2 */ -#define WNR2200_GPIO_LED_LAN4_GREEN 16 /* AR724X_..._ETH_SWITCH_LED3 */ -#define WNR2200_GPIO_LED_WAN_GREEN 17 /* AR724X_..._ETH_SWITCH_LED4 */ - -/* WNR2200 - connected through AR9287 */ -#define WNR2200_GPIO_WMAC_LED_WLAN_BLUE 0 -#define WNR2200_GPIO_WMAC_LED_TEST_AMBER 1 -#define WNR2200_GPIO_WMAC_LED_POWER_GREEN 2 -#define WNR2200_GPIO_WMAC_BTN_RFKILL 3 -#define WNR2200_GPIO_WMAC_USB_5V 4 -#define WNR2200_GPIO_WMAC_BTN_WPS 5 -#define WNR2200_GPIO_WMAC_BTN_RESET 6 - -#define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WNR2200_KEYS_DEBOUNCE_INTERVAL (3 * WNR2200_KEYS_POLL_INTERVAL) - -#define WNR2200_MAC0_OFFSET 0 -#define WNR2200_MAC1_OFFSET 6 -#define WNR2200_PCIE_CALDATA_OFFSET 0x1000 -#define WNR2200_WMAC_OFFSET 0x108c /* wireless MAC is inside ART */ - -static struct gpio_led wnr2200_leds_gpio[] __initdata = { - { - .name = "netgear:amber:lan1", - .gpio = WNR2200_GPIO_LED_LAN1_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan2", - .gpio = WNR2200_GPIO_LED_LAN2_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan3", - .gpio = WNR2200_GPIO_LED_LAN3_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:lan4", - .gpio = WNR2200_GPIO_LED_LAN4_AMBER, - .active_low = 1, - }, { - .name = "netgear:amber:wan", - .gpio = WNR2200_GPIO_LED_WAN_AMBER, - .active_low = 1, - }, { - .name = "netgear:green:lan1", - .gpio = WNR2200_GPIO_LED_LAN1_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan2", - .gpio = WNR2200_GPIO_LED_LAN2_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan3", - .gpio = WNR2200_GPIO_LED_LAN3_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan4", - .gpio = WNR2200_GPIO_LED_LAN4_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:usb", - .gpio = WNR2200_GPIO_LED_USB_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:wan", - .gpio = WNR2200_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:wps", - .gpio = WNR2200_GPIO_LED_WPS_GREEN, - .active_low = 1, - } -}; - -static struct gpio_led wnr2200_wmac_leds_gpio[] = { - { - .name = "netgear:amber:test", - .gpio = WNR2200_GPIO_WMAC_LED_TEST_AMBER, - .active_low = 1, - }, { - .name = "netgear:green:power", - .gpio = WNR2200_GPIO_WMAC_LED_POWER_GREEN, - .active_low = 1, - .default_state = LEDS_GPIO_DEFSTATE_ON, - }, { - .name = "netgear:blue:wlan", - .gpio = WNR2200_GPIO_WMAC_LED_WLAN_BLUE, - .active_low = 1, - } -}; - -static struct gpio_keys_button wnr2200_wmac_keys_gpio[] = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2200_GPIO_WMAC_BTN_RESET, - .active_low = 1, - }, { - .desc = "rfkill", - .type = EV_KEY, - .code = KEY_RFKILL, - .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2200_GPIO_WMAC_BTN_RFKILL, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WNR2200_KEYS_DEBOUNCE_INTERVAL, - .gpio = WNR2200_GPIO_WMAC_BTN_WPS, - .active_low = 1, - } -}; - -/* - * For WNR2200 ART flash area used for WLAN MAC is usually empty (0xff) - * so ath9k driver uses random MAC instead each time module is loaded. - * OpenWrt's original fix was to copy eth1 address to WLAN interface. - * New solution does not duplicate hardware addresses and is taken from - * WNR2000v3 code. It assigns permanent WLAN MAC equal to ethN's MAC - * plus 1, so network interfaces get sequential addresses. - * If ART wireless MAC address field has been filled by user, use it. - */ -static void __init wnr2200_get_wmac(u8 *wmac_gen_addr, int mac0_art_offset, - int mac1_art_offset, int wmac_art_offset) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *eth0_mac_addr = (u8 *) (art + mac0_art_offset); - u8 *eth1_mac_addr = (u8 *) (art + mac1_art_offset); - u8 *wlan_mac_addr = (u8 *) (art + wmac_art_offset); - - /* only 0xff if all bits are set - address is invalid, empty area */ - if ((wlan_mac_addr[0] & wlan_mac_addr[1] & wlan_mac_addr[2] & - wlan_mac_addr[3] & wlan_mac_addr[4] & wlan_mac_addr[5]) == 0xff) { - memcpy(wmac_gen_addr, eth0_mac_addr, 5); - wmac_gen_addr[5] = max(eth0_mac_addr[5], eth1_mac_addr[5]) + 1; - - /* Avoid potential conflict in case max(0xff,0x00)+1==0x00 */ - if (!wmac_gen_addr[5]) - wmac_gen_addr[5] = 1; - } else - memcpy(wmac_gen_addr, wlan_mac_addr, 6); -} - -static void __init wnr2200_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 wlan_mac_addr[6]; - - /* - * Disable JTAG to use all AR724X GPIO LEDs. Disable CLKs. - * Allow OS to control all link LEDs. - */ - ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE | - AR724X_GPIO_FUNC_UART_EN, - AR724X_GPIO_FUNC_CLK_OBS1_EN | - AR724X_GPIO_FUNC_CLK_OBS2_EN | - AR724X_GPIO_FUNC_CLK_OBS3_EN | - AR724X_GPIO_FUNC_CLK_OBS4_EN | - AR724X_GPIO_FUNC_CLK_OBS5_EN | - AR724X_GPIO_FUNC_GE0_MII_CLK_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + WNR2200_MAC0_OFFSET, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_init_mac(ath79_eth1_data.mac_addr, art + WNR2200_MAC1_OFFSET, 0); - 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(NULL); - - wnr2200_get_wmac(wlan_mac_addr, WNR2200_MAC0_OFFSET, - WNR2200_MAC1_OFFSET, WNR2200_WMAC_OFFSET); - ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, wlan_mac_addr); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio), - wnr2200_leds_gpio); - - ap9x_pci_setup_wmac_leds(0, wnr2200_wmac_leds_gpio, - ARRAY_SIZE(wnr2200_wmac_leds_gpio)); - - /* All 3 buttons are connected to wireless chip */ - ap9x_pci_setup_wmac_btns(0, wnr2200_wmac_keys_gpio, - ARRAY_SIZE(wnr2200_wmac_keys_gpio), - WNR2200_KEYS_POLL_INTERVAL); - - /* enable power for the USB port */ - ap9x_pci_setup_wmac_gpio(0, BIT(WNR2200_GPIO_WMAC_USB_5V), - BIT(WNR2200_GPIO_WMAC_USB_5V)); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_WNR2200, "WNR2200", "NETGEAR WNR2200", wnr2200_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wp543.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wp543.c deleted file mode 100644 index dc4aee0c1..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wp543.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Compex WP543/WPJ543 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 "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" -#include "pci.h" - -#define WP543_GPIO_SW6 2 -#define WP543_GPIO_LED_1 3 -#define WP543_GPIO_LED_2 4 -#define WP543_GPIO_LED_WLAN 5 -#define WP543_GPIO_LED_CONN 6 -#define WP543_GPIO_LED_DIAG 7 -#define WP543_GPIO_SW4 8 - -#define WP543_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WP543_KEYS_DEBOUNCE_INTERVAL (3 * WP543_KEYS_POLL_INTERVAL) - -static struct gpio_led wp543_leds_gpio[] __initdata = { - { - .name = "wp543:green:led1", - .gpio = WP543_GPIO_LED_1, - .active_low = 1, - }, { - .name = "wp543:green:led2", - .gpio = WP543_GPIO_LED_2, - .active_low = 1, - }, { - .name = "wp543:green:wlan", - .gpio = WP543_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "wp543:green:conn", - .gpio = WP543_GPIO_LED_CONN, - .active_low = 1, - }, { - .name = "wp543:green:diag", - .gpio = WP543_GPIO_LED_DIAG, - .active_low = 1, - } -}; - -static struct gpio_keys_button wp543_gpio_keys[] __initdata = { - { - .desc = "sw6", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL, - .gpio = WP543_GPIO_SW6, - .active_low = 1, - }, { - .desc = "sw4", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL, - .gpio = WP543_GPIO_SW4, - .active_low = 1, - } -}; - -static const char *wp543_part_probes[] = { - "MyLoader", - NULL, -}; - -static struct flash_platform_data wp543_flash_data = { - .part_probes = wp543_part_probes, -}; - -static void __init wp543_setup(void) -{ - ath79_register_m25p80(&wp543_flash_data); - - ath79_register_mdio(0, 0xfffffff0); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = 0x0f; - ath79_eth0_data.reset_bit = AR71XX_RESET_GE0_MAC | - AR71XX_RESET_GE0_PHY; - ath79_register_eth(0); - - ath79_register_usb(); - ath79_register_pci(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio), - wp543_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WP543_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wp543_gpio_keys), - wp543_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_WP543, "WP543", "Compex WP543", wp543_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpe72.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpe72.c deleted file mode 100644 index 945248427..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpe72.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Compex WPE72 board support - * - * Copyright (C) 2012 Johnathan Boyce - * - * 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 "machtypes.h" -#include "pci.h" - -#define WPE72_GPIO_RESET 12 -#define WPE72_GPIO_LED_DIAG 13 -#define WPE72_GPIO_LED_1 14 -#define WPE72_GPIO_LED_2 15 -#define WPE72_GPIO_LED_3 16 -#define WPE72_GPIO_LED_4 17 - -#define WPE72_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WPE72_KEYS_DEBOUNCE_INTERVAL (3 * WPE72_KEYS_POLL_INTERVAL) - -static struct gpio_led wpe72_leds_gpio[] __initdata = { - { - .name = "wpe72:green:led1", - .gpio = WPE72_GPIO_LED_1, - .active_low = 1, - }, { - .name = "wpe72:green:led2", - .gpio = WPE72_GPIO_LED_2, - .active_low = 1, - }, { - .name = "wpe72:green:led3", - .gpio = WPE72_GPIO_LED_3, - .active_low = 1, - }, { - .name = "wpe72:green:led4", - .gpio = WPE72_GPIO_LED_4, - .active_low = 1, - }, { - .name = "wpe72:green:diag", - .gpio = WPE72_GPIO_LED_DIAG, - .active_low = 1, - } -}; - -static struct gpio_keys_button wpe72_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WPE72_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPE72_GPIO_RESET, - .active_low = 1, - } -}; - -static const char *wpe72_part_probes[] = { - "MyLoader", - NULL, -}; - -static struct flash_platform_data wpe72_flash_data = { - .part_probes = wpe72_part_probes, -}; - -static void __init wpe72_setup(void) -{ - ath79_register_m25p80(&wpe72_flash_data); - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_usb(); - ath79_register_pci(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wpe72_leds_gpio), - wpe72_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WPE72_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wpe72_gpio_keys), - wpe72_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_WPE72, "WPE72", "Compex WPE72", wpe72_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj531.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj531.c deleted file mode 100644 index df817dac9..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj531.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Compex WPJ531 board support - * - * Copyright (c) 2012 Qualcomm Atheros - * Copyright (c) 2012 Gabor Juhos - * - * 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 "pci.h" -#include "common.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-eth.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" - -#define WPJ531_GPIO_LED_SIG1 13 -#define WPJ531_GPIO_LED_SIG2 14 -#define WPJ531_GPIO_LED_SIG3 15 -#define WPJ531_GPIO_LED_SIG4 16 -#define WPJ531_GPIO_BUZZER 4 - -#define WPJ531_GPIO_BTN_RESET 17 - -#define WPJ531_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WPJ531_KEYS_DEBOUNCE_INTERVAL (3 * WPJ531_KEYS_POLL_INTERVAL) - -#define WPJ531_MAC0_OFFSET 0x10 -#define WPJ531_MAC1_OFFSET 0x18 -#define WPJ531_WMAC_CALDATA_OFFSET 0x1000 -#define WPJ531_PCIE_CALDATA_OFFSET 0x5000 - -#define WPJ531_ART_SIZE 0x8000 - -static struct gpio_led wpj531_leds_gpio[] __initdata = { - { - .name = "wpj531:red:sig1", - .gpio = WPJ531_GPIO_LED_SIG1, - .active_low = 1, - }, - { - .name = "wpj531:yellow:sig2", - .gpio = WPJ531_GPIO_LED_SIG2, - .active_low = 1, - }, - { - .name = "wpj531:green:sig3", - .gpio = WPJ531_GPIO_LED_SIG3, - .active_low = 1, - }, - { - .name = "wpj531:green:sig4", - .gpio = WPJ531_GPIO_LED_SIG4, - .active_low = 1, - }, - { - .name = "wpj531:buzzer", - .gpio = WPJ531_GPIO_BUZZER, - .active_low = 0, - } -}; - -static struct gpio_keys_button wpj531_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WPJ531_KEYS_DEBOUNCE_INTERVAL, - .gpio = WPJ531_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init common_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.phy_mask = BIT(4); - ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ531_MAC0_OFFSET, 0); - ath79_register_eth(0); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, mac + WPJ531_MAC1_OFFSET, 0); - ath79_register_eth(1); - - ath79_register_wmac(art + WPJ531_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_pci(); - ath79_register_usb(); -} - -static void __init wpj531_setup(void) -{ - common_setup(); - - ath79_register_leds_gpio(-1, - ARRAY_SIZE(wpj531_leds_gpio), - wpj531_leds_gpio); - - ath79_register_gpio_keys_polled(-1, - WPJ531_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wpj531_gpio_keys), - wpj531_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_WPJ531, "WPJ531", "Compex WPJ531", wpj531_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrt160nl.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrt160nl.c deleted file mode 100644 index ede3c214c..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrt160nl.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Linksys WRT160NL 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 WRT160NL_GPIO_LED_POWER 14 -#define WRT160NL_GPIO_LED_WPS_AMBER 9 -#define WRT160NL_GPIO_LED_WPS_BLUE 8 -#define WRT160NL_GPIO_LED_WLAN 6 - -#define WRT160NL_GPIO_BTN_WPS 7 -#define WRT160NL_GPIO_BTN_RESET 21 - -#define WRT160NL_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WRT160NL_KEYS_DEBOUNCE_INTERVAL (3 * WRT160NL_KEYS_POLL_INTERVAL) - -#define WRT160NL_NVRAM_ADDR 0x1f7e0000 -#define WRT160NL_NVRAM_SIZE 0x10000 - -static const char *wrt160nl_part_probes[] = { - "cybertan", - NULL, -}; - -static struct flash_platform_data wrt160nl_flash_data = { - .part_probes = wrt160nl_part_probes, -}; - -static struct gpio_led wrt160nl_leds_gpio[] __initdata = { - { - .name = "wrt160nl:blue:power", - .gpio = WRT160NL_GPIO_LED_POWER, - .active_low = 1, - .default_trigger = "default-on", - }, { - .name = "wrt160nl:amber:wps", - .gpio = WRT160NL_GPIO_LED_WPS_AMBER, - .active_low = 1, - }, { - .name = "wrt160nl:blue:wps", - .gpio = WRT160NL_GPIO_LED_WPS_BLUE, - .active_low = 1, - }, { - .name = "wrt160nl:blue:wlan", - .gpio = WRT160NL_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button wrt160nl_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WRT160NL_KEYS_DEBOUNCE_INTERVAL, - .gpio = WRT160NL_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wps", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WRT160NL_KEYS_DEBOUNCE_INTERVAL, - .gpio = WRT160NL_GPIO_BTN_WPS, - .active_low = 1, - } -}; - -static void __init wrt160nl_setup(void) -{ - const char *nvram = (char *) KSEG1ADDR(WRT160NL_NVRAM_ADDR); - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - u8 mac[6]; - - if (ath79_nvram_parse_mac_addr(nvram, WRT160NL_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(&wrt160nl_flash_data); - - ath79_register_usb(); - - if (ath79_nvram_parse_mac_addr(nvram, WRT160NL_NVRAM_SIZE, - "wl0_hwaddr=", mac) == 0) - ath79_register_wmac(eeprom, mac); - else - ath79_register_wmac(eeprom, NULL); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wrt160nl_leds_gpio), - wrt160nl_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WRT160NL_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wrt160nl_gpio_keys), - wrt160nl_gpio_keys); -} - -MIPS_MACHINE(ATH79_MACH_WRT160NL, "WRT160NL", "Linksys WRT160NL", - wrt160nl_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrt400n.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrt400n.c deleted file mode 100644 index 6c4c1cb0d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrt400n.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Linksys WRT400N board support - * - * Copyright (C) 2009-2012 Gabor Juhos - * Copyright (C) 2009 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 "dev-ap9x-pci.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "machtypes.h" - -#define WRT400N_GPIO_LED_POWER 1 -#define WRT400N_GPIO_LED_WPS_BLUE 4 -#define WRT400N_GPIO_LED_WPS_AMBER 5 -#define WRT400N_GPIO_LED_WLAN 6 - -#define WRT400N_GPIO_BTN_RESET 8 -#define WRT400N_GPIO_BTN_WLSEC 3 - -#define WRT400N_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WRT400N_KEYS_DEBOUNE_INTERVAL (3 * WRT400N_KEYS_POLL_INTERVAL) - -#define WRT400N_MAC_ADDR_OFFSET 0x120c -#define WRT400N_CALDATA0_OFFSET 0x1000 -#define WRT400N_CALDATA1_OFFSET 0x5000 - -static struct mtd_partition wrt400n_partitions[] = { - { - .name = "uboot", - .offset = 0, - .size = 0x030000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "env", - .offset = 0x030000, - .size = 0x010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "linux", - .offset = 0x040000, - .size = 0x140000, - }, { - .name = "rootfs", - .offset = 0x180000, - .size = 0x630000, - }, { - .name = "nvram", - .offset = 0x7b0000, - .size = 0x010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "factory", - .offset = 0x7c0000, - .size = 0x010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "language", - .offset = 0x7d0000, - .size = 0x020000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "caldata", - .offset = 0x7f0000, - .size = 0x010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x040000, - .size = 0x770000, - } -}; - -static struct flash_platform_data wrt400n_flash_data = { - .parts = wrt400n_partitions, - .nr_parts = ARRAY_SIZE(wrt400n_partitions), -}; - -static struct gpio_led wrt400n_leds_gpio[] __initdata = { - { - .name = "wrt400n:blue:wps", - .gpio = WRT400N_GPIO_LED_WPS_BLUE, - .active_low = 1, - }, { - .name = "wrt400n:amber:wps", - .gpio = WRT400N_GPIO_LED_WPS_AMBER, - .active_low = 1, - }, { - .name = "wrt400n:blue:wlan", - .gpio = WRT400N_GPIO_LED_WLAN, - .active_low = 1, - }, { - .name = "wrt400n:blue:power", - .gpio = WRT400N_GPIO_LED_POWER, - .active_low = 0, - .default_trigger = "default-on", - } -}; - -static struct gpio_keys_button wrt400n_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WRT400N_KEYS_DEBOUNE_INTERVAL, - .gpio = WRT400N_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "wlsec", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WRT400N_KEYS_DEBOUNE_INTERVAL, - .gpio = WRT400N_GPIO_BTN_WLSEC, - .active_low = 1, - } -}; - -static void __init wrt400n_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = art + WRT400N_MAC_ADDR_OFFSET; - - ath79_register_mdio(0, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2); - 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(&wrt400n_flash_data); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wrt400n_leds_gpio), - wrt400n_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WRT400N_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wrt400n_gpio_keys), - wrt400n_gpio_keys); - - ap94_pci_init(art + WRT400N_CALDATA0_OFFSET, NULL, - art + WRT400N_CALDATA1_OFFSET, NULL); -} - -MIPS_MACHINE(ATH79_MACH_WRT400N, "WRT400N", "Linksys WRT400N", wrt400n_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrtnode2q.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrtnode2q.c deleted file mode 100644 index 150a28b0d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wrtnode2q.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * WRTnode2Q board support - * - * Copyright (c) 2013 The Linux Foundation. All rights reserved. - * Copyright (c) 2012 Gabor Juhos - * Copyright (c) 2015 Kelei - * - * 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 "common.h" -#include "dev-eth.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-spi.h" -#include "dev-usb.h" -#include "dev-wmac.h" -#include "machtypes.h" -#include "pci.h" - -#define WRTNODE2Q_GPIO_LED_WLAN 12 -#define WRTNODE2Q_GPIO_LED_WPS 13 -#define WRTNODE2Q_GPIO_LED_STATUS 13 - -#define WRTNODE2Q_GPIO_LED_WAN 4 -#define WRTNODE2Q_GPIO_LED_LAN1 16 -#define WRTNODE2Q_GPIO_LED_LAN2 15 -#define WRTNODE2Q_GPIO_LED_LAN3 14 -#define WRTNODE2Q_GPIO_LED_LAN4 11 - -#define WRTNODE2Q_GPIO_BTN_WPS 17 - -#define WRTNODE2Q_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WRTNODE2Q_KEYS_DEBOUNCE_INTERVAL (3 * WRTNODE2Q_KEYS_POLL_INTERVAL) - -#define WRTNODE2Q_MAC0_OFFSET 0 -#define WRTNODE2Q_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led wrtnode2q_leds_gpio[] __initdata = { - { - .name = "wrtnode2q:green:status", - .gpio = WRTNODE2Q_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "wrtnode2q:green:wlan", - .gpio = WRTNODE2Q_GPIO_LED_WLAN, - .active_low = 1, - } -}; - -static struct gpio_keys_button wrtnode2q_gpio_keys[] __initdata = { - { - .desc = "WPS button", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WRTNODE2Q_KEYS_DEBOUNCE_INTERVAL, - .gpio = WRTNODE2Q_GPIO_BTN_WPS, - .active_low = 1, - }, -}; - -static void __init wrtnode2q_gpio_led_setup(void) -{ - ath79_register_leds_gpio(-1, ARRAY_SIZE(wrtnode2q_leds_gpio), - wrtnode2q_leds_gpio); - ath79_register_gpio_keys_polled(-1, WRTNODE2Q_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wrtnode2q_gpio_keys), - wrtnode2q_gpio_keys); -} - -static void __init wrtnode2q_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1f040000); - - ath79_register_m25p80(NULL); - - wrtnode2q_gpio_led_setup(); - - ath79_register_pci(); - ath79_register_usb(); - - ath79_register_wmac(art + WRTNODE2Q_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_mdio(0, 0x0); - ath79_register_mdio(1, 0x0); - - ath79_init_mac(ath79_eth0_data.mac_addr, art + WRTNODE2Q_MAC0_OFFSET, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, art + WRTNODE2Q_MAC0_OFFSET, 1); - - /* LAN ports */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - /* WAN port */ - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(4); - ath79_register_eth(0); -} - -MIPS_MACHINE(ATH79_MACH_WRTNODE2Q, "WRTNODE2Q", "WRTnode2Q board", - wrtnode2q_setup); \ No newline at end of file diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-ag300h.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-ag300h.c deleted file mode 100644 index a9ed3fdd4..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-ag300h.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Buffalo WZR-HP-AG300H board support - * - * Copyright (C) 2011 Felix Fietkau - * - * 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 "dev-eth.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-m25p80.h" -#include "dev-usb.h" -#include "machtypes.h" - -#define WZRHPAG300H_MAC_OFFSET 0x20c -#define WZRHPAG300H_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WZRHPAG300H_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPAG300H_KEYS_POLL_INTERVAL) - -static struct mtd_partition wzrhpag300h_flash_partitions[] = { - { - .name = "u-boot", - .offset = 0, - .size = 0x0040000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "u-boot-env", - .offset = 0x0040000, - .size = 0x0010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "art", - .offset = 0x0050000, - .size = 0x0010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x0060000, - .size = 0x1f90000, - }, { - .name = "user_property", - .offset = 0x1ff0000, - .size = 0x0010000, - .mask_flags = MTD_WRITEABLE, - } -}; - -static struct flash_platform_data wzrhpag300h_flash_data = { - .parts = wzrhpag300h_flash_partitions, - .nr_parts = ARRAY_SIZE(wzrhpag300h_flash_partitions), -}; - -static struct gpio_led wzrhpag300h_leds_gpio[] __initdata = { - { - .name = "buffalo:red:diag", - .gpio = 1, - .active_low = 1, - }, -}; - -static struct gpio_led wzrhpag300h_wmac0_leds_gpio[] = { - { - .name = "buffalo:amber:band2g", - .gpio = 1, - .active_low = 1, - }, - { - .name = "buffalo:green:usb", - .gpio = 3, - .active_low = 1, - }, - { - .name = "buffalo:green:band2g", - .gpio = 5, - .active_low = 1, - }, -}; - -static struct gpio_led wzrhpag300h_wmac1_leds_gpio[] = { - { - .name = "buffalo:green:band5g", - .gpio = 1, - .active_low = 1, - }, - { - .name = "buffalo:green:router", - .gpio = 3, - .active_low = 1, - }, - { - .name = "buffalo:blue:movie_engine", - .gpio = 4, - .active_low = 1, - }, - { - .name = "buffalo:amber:band5g", - .gpio = 5, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wzrhpag300h_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WZRHPAG300H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 11, - .active_low = 1, - }, { - .desc = "usb", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = WZRHPAG300H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 3, - .active_low = 1, - }, { - .desc = "aoss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WZRHPAG300H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 5, - .active_low = 1, - }, { - .desc = "router_auto", - .type = EV_SW, - .code = BTN_6, - .debounce_interval = WZRHPAG300H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 6, - .active_low = 1, - }, { - .desc = "router_off", - .type = EV_SW, - .code = BTN_5, - .debounce_interval = WZRHPAG300H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 7, - .active_low = 1, - }, { - .desc = "movie_engine", - .type = EV_SW, - .code = BTN_7, - .debounce_interval = WZRHPAG300H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 8, - .active_low = 1, - } -}; - -static void __init wzrhpag300h_setup(void) -{ - u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1f051000); - u8 *eeprom2 = (u8 *) KSEG1ADDR(0x1f055000); - u8 *mac1 = eeprom1 + WZRHPAG300H_MAC_OFFSET; - u8 *mac2 = eeprom2 + WZRHPAG300H_MAC_OFFSET; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 1); - - ath79_register_mdio(0, ~(BIT(0) | BIT(4))); - - 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_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = BIT(4); - - ath79_register_eth(0); - ath79_register_eth(1); - - gpio_request_one(2, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wzrhpag300h_leds_gpio), - wzrhpag300h_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WZRHPAG300H_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wzrhpag300h_gpio_keys), - wzrhpag300h_gpio_keys); - - ath79_register_m25p80_multi(&wzrhpag300h_flash_data); - - ap94_pci_init(eeprom1, mac1, eeprom2, mac2); - - ap9x_pci_setup_wmac_leds(0, wzrhpag300h_wmac0_leds_gpio, - ARRAY_SIZE(wzrhpag300h_wmac0_leds_gpio)); - ap9x_pci_setup_wmac_leds(1, wzrhpag300h_wmac1_leds_gpio, - ARRAY_SIZE(wzrhpag300h_wmac1_leds_gpio)); -} - -MIPS_MACHINE(ATH79_MACH_WZR_HP_AG300H, "WZR-HP-AG300H", - "Buffalo WZR-HP-AG300H/WZR-600DHP", wzrhpag300h_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g300nh.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g300nh.c deleted file mode 100644 index 0a3eba9f7..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g300nh.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Buffalo WZR-HP-G300NH board support - * - * Copyright (C) 2010-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 - -#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 WZRHPG300NH_GPIO_LED_USB 0 -#define WZRHPG300NH_GPIO_LED_DIAG 1 -#define WZRHPG300NH_GPIO_LED_WIRELESS 6 -#define WZRHPG300NH_GPIO_LED_SECURITY 17 -#define WZRHPG300NH_GPIO_LED_ROUTER 18 - -#define WZRHPG300NH_GPIO_RTL8366_SDA 19 -#define WZRHPG300NH_GPIO_RTL8366_SCK 20 - -#define WZRHPG300NH_GPIO_74HC153_S0 9 -#define WZRHPG300NH_GPIO_74HC153_S1 11 -#define WZRHPG300NH_GPIO_74HC153_1Y 12 -#define WZRHPG300NH_GPIO_74HC153_2Y 14 - -#define WZRHPG300NH_GPIO_EXP_BASE 32 -#define WZRHPG300NH_GPIO_BTN_AOSS (WZRHPG300NH_GPIO_EXP_BASE + 0) -#define WZRHPG300NH_GPIO_BTN_RESET (WZRHPG300NH_GPIO_EXP_BASE + 1) -#define WZRHPG300NH_GPIO_BTN_ROUTER_ON (WZRHPG300NH_GPIO_EXP_BASE + 2) -#define WZRHPG300NH_GPIO_BTN_QOS_ON (WZRHPG300NH_GPIO_EXP_BASE + 3) -#define WZRHPG300NH_GPIO_BTN_USB (WZRHPG300NH_GPIO_EXP_BASE + 5) -#define WZRHPG300NH_GPIO_BTN_ROUTER_AUTO (WZRHPG300NH_GPIO_EXP_BASE + 6) -#define WZRHPG300NH_GPIO_BTN_QOS_OFF (WZRHPG300NH_GPIO_EXP_BASE + 7) - -#define WZRHPG300NH_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG300NH_KEYS_POLL_INTERVAL) - -#define WZRHPG300NH_MAC_OFFSET 0x20c - -static struct mtd_partition wzrhpg300nh_flash_partitions[] = { - { - .name = "u-boot", - .offset = 0, - .size = 0x0040000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "u-boot-env", - .offset = 0x0040000, - .size = 0x0020000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x0060000, - .size = 0x1f60000, - }, { - .name = "user_property", - .offset = 0x1fc0000, - .size = 0x0020000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "art", - .offset = 0x1fe0000, - .size = 0x0020000, - .mask_flags = MTD_WRITEABLE, - } -}; - -static struct physmap_flash_data wzrhpg300nh_flash_data = { - .width = 2, - .parts = wzrhpg300nh_flash_partitions, - .nr_parts = ARRAY_SIZE(wzrhpg300nh_flash_partitions), -}; - -#define WZRHPG300NH_FLASH_BASE 0x1e000000 -#define WZRHPG300NH_FLASH_SIZE (32 * 1024 * 1024) - -static struct resource wzrhpg300nh_flash_resources[] = { - [0] = { - .start = WZRHPG300NH_FLASH_BASE, - .end = WZRHPG300NH_FLASH_BASE + WZRHPG300NH_FLASH_SIZE - 1, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device wzrhpg300nh_flash_device = { - .name = "physmap-flash", - .id = -1, - .resource = wzrhpg300nh_flash_resources, - .num_resources = ARRAY_SIZE(wzrhpg300nh_flash_resources), - .dev = { - .platform_data = &wzrhpg300nh_flash_data, - } -}; - -static struct gpio_led wzrhpg300nh_leds_gpio[] __initdata = { - { - .name = "buffalo:orange:security", - .gpio = WZRHPG300NH_GPIO_LED_SECURITY, - .active_low = 1, - }, { - .name = "buffalo:green:wireless", - .gpio = WZRHPG300NH_GPIO_LED_WIRELESS, - .active_low = 1, - }, { - .name = "buffalo:green:router", - .gpio = WZRHPG300NH_GPIO_LED_ROUTER, - .active_low = 1, - }, { - .name = "buffalo:red:diag", - .gpio = WZRHPG300NH_GPIO_LED_DIAG, - .active_low = 1, - }, { - .name = "buffalo:blue:usb", - .gpio = WZRHPG300NH_GPIO_LED_USB, - .active_low = 1, - } -}; - -static struct gpio_keys_button wzrhpg300nh_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = WZRHPG300NH_GPIO_BTN_RESET, - .active_low = 1, - }, { - .desc = "aoss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = WZRHPG300NH_GPIO_BTN_AOSS, - .active_low = 1, - }, { - .desc = "usb", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = WZRHPG300NH_GPIO_BTN_USB, - .active_low = 1, - }, { - .desc = "qos_on", - .type = EV_KEY, - .code = BTN_3, - .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = WZRHPG300NH_GPIO_BTN_QOS_ON, - .active_low = 0, - }, { - .desc = "qos_off", - .type = EV_KEY, - .code = BTN_4, - .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = WZRHPG300NH_GPIO_BTN_QOS_OFF, - .active_low = 0, - }, { - .desc = "router_on", - .type = EV_KEY, - .code = BTN_5, - .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = WZRHPG300NH_GPIO_BTN_ROUTER_ON, - .active_low = 0, - }, { - .desc = "router_auto", - .type = EV_KEY, - .code = BTN_6, - .debounce_interval = WZRHPG300NH_KEYS_DEBOUNCE_INTERVAL, - .gpio = WZRHPG300NH_GPIO_BTN_ROUTER_AUTO, - .active_low = 0, - } -}; - -static struct nxp_74hc153_platform_data wzrhpg300nh_74hc153_data = { - .gpio_base = WZRHPG300NH_GPIO_EXP_BASE, - .gpio_pin_s0 = WZRHPG300NH_GPIO_74HC153_S0, - .gpio_pin_s1 = WZRHPG300NH_GPIO_74HC153_S1, - .gpio_pin_1y = WZRHPG300NH_GPIO_74HC153_1Y, - .gpio_pin_2y = WZRHPG300NH_GPIO_74HC153_2Y, -}; - -static struct platform_device wzrhpg300nh_74hc153_device = { - .name = NXP_74HC153_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &wzrhpg300nh_74hc153_data, - } -}; - -static struct rtl8366_platform_data wzrhpg300nh_rtl8366_data = { - .gpio_sda = WZRHPG300NH_GPIO_RTL8366_SDA, - .gpio_sck = WZRHPG300NH_GPIO_RTL8366_SCK, -}; - -static struct platform_device wzrhpg300nh_rtl8366s_device = { - .name = RTL8366S_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &wzrhpg300nh_rtl8366_data, - } -}; - -static struct platform_device wzrhpg300nh_rtl8366rb_device = { - .name = RTL8366RB_DRIVER_NAME, - .id = -1, - .dev = { - .platform_data = &wzrhpg300nh_rtl8366_data, - } -}; - -static void __init wzrhpg300nh_setup(void) -{ - u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - u8 *mac = eeprom + WZRHPG300NH_MAC_OFFSET; - bool hasrtl8366rb = false; - - ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); - ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); - - if (rtl8366_smi_detect(&wzrhpg300nh_rtl8366_data) == RTL8366_TYPE_RB) - hasrtl8366rb = true; - - if (hasrtl8366rb) { - ath79_eth0_pll_data.pll_1000 = 0x1f000000; - ath79_eth0_data.mii_bus_dev = &wzrhpg300nh_rtl8366rb_device.dev; - ath79_eth1_pll_data.pll_1000 = 0x100; - ath79_eth1_data.mii_bus_dev = &wzrhpg300nh_rtl8366rb_device.dev; - } else { - ath79_eth0_pll_data.pll_1000 = 0x1e000100; - ath79_eth0_data.mii_bus_dev = &wzrhpg300nh_rtl8366s_device.dev; - ath79_eth1_pll_data.pll_1000 = 0x1e000100; - ath79_eth1_data.mii_bus_dev = &wzrhpg300nh_rtl8366s_device.dev; - } - - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth0_data.speed = SPEED_1000; - ath79_eth0_data.duplex = DUPLEX_FULL; - - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ath79_eth1_data.phy_mask = 0x10; - - ath79_register_eth(0); - ath79_register_eth(1); - - ath79_register_usb(); - ath79_register_wmac(eeprom, NULL); - - platform_device_register(&wzrhpg300nh_74hc153_device); - platform_device_register(&wzrhpg300nh_flash_device); - - if (hasrtl8366rb) - platform_device_register(&wzrhpg300nh_rtl8366rb_device); - else - platform_device_register(&wzrhpg300nh_rtl8366s_device); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wzrhpg300nh_leds_gpio), - wzrhpg300nh_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WZRHPG300NH_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wzrhpg300nh_gpio_keys), - wzrhpg300nh_gpio_keys); - -} - -MIPS_MACHINE(ATH79_MACH_WZR_HP_G300NH, "WZR-HP-G300NH", - "Buffalo WZR-HP-G300NH", wzrhpg300nh_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g300nh2.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g300nh2.c deleted file mode 100644 index c44a9cf77..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g300nh2.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Buffalo WZR-HP-G300NH2 board support - * - * Copyright (C) 2011 Felix Fietkau - * Copyright (C) 2011 Mark Deneen - * - * 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 "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 "machtypes.h" - -#define WZRHPG300NH2_MAC_OFFSET 0x20c -#define WZRHPG300NH2_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG300NH2_KEYS_POLL_INTERVAL) - -static struct mtd_partition wzrhpg300nh2_flash_partitions[] = { - { - .name = "u-boot", - .offset = 0, - .size = 0x0040000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "u-boot-env", - .offset = 0x0040000, - .size = 0x0010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "art", - .offset = 0x0050000, - .size = 0x0010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x0060000, - .size = 0x1f90000, - }, { - .name = "user_property", - .offset = 0x1ff0000, - .size = 0x0010000, - .mask_flags = MTD_WRITEABLE, - } -}; - -static struct flash_platform_data wzrhpg300nh2_flash_data = { - .parts = wzrhpg300nh2_flash_partitions, - .nr_parts = ARRAY_SIZE(wzrhpg300nh2_flash_partitions), -}; - -static struct gpio_led wzrhpg300nh2_leds_gpio[] __initdata = { - { - .name = "buffalo:red:diag", - .gpio = 16, - .active_low = 1, - }, -}; - -static struct gpio_led wzrhpg300nh2_wmac_leds_gpio[] = { - { - .name = "buffalo:blue:usb", - .gpio = 4, - .active_low = 1, - }, - { - .name = "buffalo:green:wireless", - .gpio = 5, - .active_low = 1, - }, - { - .name = "buffalo:orange:security", - .gpio = 6, - .active_low = 1, - }, - { - .name = "buffalo:green:router", - .gpio = 7, - .active_low = 1, - }, - { - .name = "buffalo:blue:movie_engine_on", - .gpio = 8, - .active_low = 1, - }, - { - .name = "buffalo:blue:movie_engine_off", - .gpio = 9, - .active_low = 1, - }, -}; - -/* The AOSS button is wmac gpio 12 */ -static struct gpio_keys_button wzrhpg300nh2_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL, - .gpio = 1, - .active_low = 1, - }, { - .desc = "usb", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL, - .gpio = 7, - .active_low = 1, - }, { - .desc = "qos", - .type = EV_KEY, - .code = BTN_3, - .debounce_interval = WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL, - .gpio = 11, - .active_low = 0, - }, { - .desc = "router_on", - .type = EV_KEY, - .code = BTN_5, - .debounce_interval = WZRHPG300NH2_KEYS_DEBOUNCE_INTERVAL, - .gpio = 8, - .active_low = 0, - }, -}; - -static void __init wzrhpg300nh2_setup(void) -{ - - u8 *eeprom = (u8 *) KSEG1ADDR(0x1f051000); - u8 *mac0 = eeprom + WZRHPG300NH2_MAC_OFFSET; - /* There is an eth1 but it is not connected to the switch */ - - ath79_register_m25p80_multi(&wzrhpg300nh2_flash_data); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac0, 0); - ath79_register_mdio(0, ~(BIT(0))); - - ath79_init_mac(ath79_eth0_data.mac_addr, mac0, 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); - - /* gpio13 is usb power. Turn it on. */ - gpio_request_one(13, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(wzrhpg300nh2_leds_gpio), - wzrhpg300nh2_leds_gpio); - ath79_register_gpio_keys_polled(-1, WZRHPG300NH2_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wzrhpg300nh2_gpio_keys), - wzrhpg300nh2_gpio_keys); - ap9x_pci_setup_wmac_leds(0, wzrhpg300nh2_wmac_leds_gpio, - ARRAY_SIZE(wzrhpg300nh2_wmac_leds_gpio)); - - ap91_pci_init(eeprom, mac0); -} - -MIPS_MACHINE(ATH79_MACH_WZR_HP_G300NH2, "WZR-HP-G300NH2", - "Buffalo WZR-HP-G300NH2", wzrhpg300nh2_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g450h.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g450h.c deleted file mode 100644 index 5d235c49f..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-hp-g450h.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Buffalo WZR-HP-G450G board support - * - * Copyright (C) 2011 Felix Fietkau - * 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 "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "dev-usb.h" -#include "machtypes.h" - -#define WZRHPG450H_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WZRHPG450H_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG450H_KEYS_POLL_INTERVAL) - -static struct mtd_partition wzrhpg450h_partitions[] = { - { - .name = "u-boot", - .offset = 0, - .size = 0x0040000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "u-boot-env", - .offset = 0x0040000, - .size = 0x0010000, - }, { - .name = "ART", - .offset = 0x0050000, - .size = 0x0010000, - .mask_flags = MTD_WRITEABLE, - }, { - .name = "firmware", - .offset = 0x0060000, - .size = 0x1f80000, - }, { - .name = "user_property", - .offset = 0x1fe0000, - .size = 0x0020000, - } -}; - -static struct flash_platform_data wzrhpg450h_flash_data = { - .parts = wzrhpg450h_partitions, - .nr_parts = ARRAY_SIZE(wzrhpg450h_partitions), -}; - -static struct gpio_led wzrhpg450h_leds_gpio[] __initdata = { - { - .name = "buffalo:red:diag", - .gpio = 14, - .active_low = 1, - }, - { - .name = "buffalo:orange:security", - .gpio = 13, - .active_low = 1, - }, -}; - - -static struct gpio_led wzrhpg450h_wmac_leds_gpio[] = { - { - .name = "buffalo:blue:movie_engine", - .gpio = 13, - .active_low = 1, - }, - { - .name = "buffalo:green:router", - .gpio = 14, - .active_low = 1, - }, - { - .name = "buffalo:green:wireless", - .gpio = 15, - .active_low = 1, - }, -}; - -static struct gpio_keys_button wzrhpg450h_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 6, - .active_low = 1, - }, { - .desc = "usb", - .type = EV_KEY, - .code = BTN_2, - .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 1, - .active_low = 1, - }, { - .desc = "aoss", - .type = EV_KEY, - .code = KEY_WPS_BUTTON, - .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 8, - .active_low = 1, - }, { - .desc = "movie_engine", - .type = EV_KEY, - .code = BTN_6, - .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 7, - .active_low = 0, - }, { - .desc = "router_off", - .type = EV_KEY, - .code = BTN_5, - .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, - .gpio = 12, - .active_low = 0, - } -}; - - -static void __init wzrhpg450h_init(void) -{ - u8 *ee = (u8 *) KSEG1ADDR(0x1f051000); - u8 *mac = (u8 *) ee + 2; - - ath79_register_m25p80_multi(&wzrhpg450h_flash_data); - - 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_leds_gpio(-1, ARRAY_SIZE(wzrhpg450h_leds_gpio), - wzrhpg450h_leds_gpio); - - ath79_register_gpio_keys_polled(-1, WZRHPG450H_KEYS_POLL_INTERVAL, - ARRAY_SIZE(wzrhpg450h_gpio_keys), - wzrhpg450h_gpio_keys); - - ath79_register_eth(0); - - gpio_request_one(16, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); - ath79_register_usb(); - - ap91_pci_init(ee, NULL); - ap9x_pci_get_wmac_data(0)->tx_gain_buffalo = true; - ap9x_pci_get_wmac_data(1)->tx_gain_buffalo = true; - ap9x_pci_setup_wmac_leds(0, wzrhpg450h_wmac_leds_gpio, - ARRAY_SIZE(wzrhpg450h_wmac_leds_gpio)); -} - -MIPS_MACHINE(ATH79_MACH_WZR_HP_G450H, "WZR-HP-G450H", "Buffalo WZR-HP-G450H", - wzrhpg450h_init); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-zbt-we1526.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-zbt-we1526.c deleted file mode 100644 index 42bad1190..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-zbt-we1526.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Zbtlink ZBT-WE1526 board support - * - * Copyright (C) 2016 Piotr Dymacz - * - * Based on mach-dr531.c and mach-tl-wr841n-v9.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 "common.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 ZBT_WE1526_GPIO_LED_STATUS 13 -#define ZBT_WE1526_GPIO_LED_LAN1 16 -#define ZBT_WE1526_GPIO_LED_LAN2 15 -#define ZBT_WE1526_GPIO_LED_LAN3 14 -#define ZBT_WE1526_GPIO_LED_LAN4 11 -#define ZBT_WE1526_GPIO_LED_WAN 4 -#define ZBT_WE1526_GPIO_LED_WLAN 12 - -#define ZBT_WE1526_GPIO_BTN_RESET 17 - -#define ZBT_WE1526_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ZBT_WE1526_KEYS_DEBOUNCE_INTERVAL \ - (3 * ZBT_WE1526_KEYS_POLL_INTERVAL) - -#define ZBT_WE1526_MAC0_OFFSET 0x0 -#define ZBT_WE1526_MAC1_OFFSET 0x6 -#define ZBT_WE1526_WMAC_CALDATA_OFFSET 0x1000 - -static struct gpio_led zbt_we1526_leds_gpio[] __initdata = { - { - .name = "zbt-we1526:green:status", - .gpio = ZBT_WE1526_GPIO_LED_STATUS, - .active_low = 1, - }, - { - .name = "zbt-we1526:green:lan1", - .gpio = ZBT_WE1526_GPIO_LED_LAN1, - .active_low = 1, - }, - { - .name = "zbt-we1526:green:lan2", - .gpio = ZBT_WE1526_GPIO_LED_LAN2, - .active_low = 1, - }, - { - .name = "zbt-we1526:green:lan3", - .gpio = ZBT_WE1526_GPIO_LED_LAN3, - .active_low = 1, - }, - { - .name = "zbt-we1526:green:lan4", - .gpio = ZBT_WE1526_GPIO_LED_LAN4, - .active_low = 1, - }, - { - .name = "zbt-we1526:green:wan", - .gpio = ZBT_WE1526_GPIO_LED_WAN, - .active_low = 1, - }, - { - .name = "zbt-we1526:green:wlan", - .gpio = ZBT_WE1526_GPIO_LED_WLAN, - .active_low = 1, - }, -}; - -static struct gpio_keys_button zbt_we1526_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ZBT_WE1526_KEYS_DEBOUNCE_INTERVAL, - .gpio = ZBT_WE1526_GPIO_BTN_RESET, - .active_low = 1, - }, -}; - -static void __init zbt_we1526_gpio_setup(void) -{ - /* For LED on GPIO4 */ - ath79_gpio_function_disable(AR934X_GPIO_FUNC_CLK_OBS4_EN); - ath79_gpio_output_select(ZBT_WE1526_GPIO_LED_WAN, 0); - - ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_STATUS, true); - ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_LAN1, true); - ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_LAN2, true); - ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_LAN3, true); - ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_LAN4, true); - ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_WAN, true); - ath79_gpio_direction_select(ZBT_WE1526_GPIO_LED_WLAN, true); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(zbt_we1526_leds_gpio), - zbt_we1526_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ZBT_WE1526_KEYS_POLL_INTERVAL, - ARRAY_SIZE(zbt_we1526_gpio_keys), - zbt_we1526_gpio_keys); -} - -static void __init zbt_we1526_setup(void) -{ - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - - ath79_register_m25p80(NULL); - - zbt_we1526_gpio_setup(); - - ath79_setup_ar933x_phy4_switch(false, false); - - ath79_register_mdio(0, 0x0); - - /* LAN */ - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_init_mac(ath79_eth1_data.mac_addr, - art + ZBT_WE1526_MAC0_OFFSET, 0); - ath79_register_eth(1); - - /* WAN */ - ath79_switch_data.phy4_mii_en = 1; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.phy_mask = BIT(4); - ath79_eth0_data.speed = SPEED_100; - ath79_init_mac(ath79_eth0_data.mac_addr, - art + ZBT_WE1526_MAC1_OFFSET, 0); - ath79_register_eth(0); - - ath79_register_wmac(art + ZBT_WE1526_WMAC_CALDATA_OFFSET, NULL); - - ath79_register_usb(); -} - -MIPS_MACHINE(ATH79_MACH_ZBT_WE1526, "ZBT-WE1526", "Zbtlink ZBT-WE1526", - zbt_we1526_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-zcn-1523h.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-zcn-1523h.c deleted file mode 100644 index bc79ab995..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-zcn-1523h.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Zcomax ZCN-1523H-2-8/5-16 board support - * - * Copyright (C) 2010-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 "common.h" -#include "dev-eth.h" -#include "dev-m25p80.h" -#include "dev-ap9x-pci.h" -#include "dev-gpio-buttons.h" -#include "dev-leds-gpio.h" -#include "machtypes.h" - -#define ZCN_1523H_GPIO_BTN_RESET 0 -#define ZCN_1523H_GPIO_LED_INIT 11 -#define ZCN_1523H_GPIO_LED_LAN1 17 - -#define ZCN_1523H_2_GPIO_LED_WEAK 13 -#define ZCN_1523H_2_GPIO_LED_MEDIUM 14 -#define ZCN_1523H_2_GPIO_LED_STRONG 15 - -#define ZCN_1523H_5_GPIO_LAN2_POWER 1 -#define ZCN_1523H_5_GPIO_LED_LAN2 13 -#define ZCN_1523H_5_GPIO_LED_WEAK 14 -#define ZCN_1523H_5_GPIO_LED_MEDIUM 15 -#define ZCN_1523H_5_GPIO_LED_STRONG 16 - -#define ZCN_1523H_KEYS_POLL_INTERVAL 20 /* msecs */ -#define ZCN_1523H_KEYS_DEBOUNCE_INTERVAL (3 * ZCN_1523H_KEYS_POLL_INTERVAL) - -static struct gpio_keys_button zcn_1523h_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = ZCN_1523H_KEYS_DEBOUNCE_INTERVAL, - .gpio = ZCN_1523H_GPIO_BTN_RESET, - .active_low = 1, - } -}; - -static struct gpio_led zcn_1523h_leds_gpio[] __initdata = { - { - .name = "zcn-1523h:amber:init", - .gpio = ZCN_1523H_GPIO_LED_INIT, - .active_low = 1, - }, { - .name = "zcn-1523h:green:lan1", - .gpio = ZCN_1523H_GPIO_LED_LAN1, - .active_low = 1, - } -}; - -static struct gpio_led zcn_1523h_2_leds_gpio[] __initdata = { - { - .name = "zcn-1523h:red:weak", - .gpio = ZCN_1523H_2_GPIO_LED_WEAK, - .active_low = 1, - }, { - .name = "zcn-1523h:amber:medium", - .gpio = ZCN_1523H_2_GPIO_LED_MEDIUM, - .active_low = 1, - }, { - .name = "zcn-1523h:green:strong", - .gpio = ZCN_1523H_2_GPIO_LED_STRONG, - .active_low = 1, - } -}; - -static struct gpio_led zcn_1523h_5_leds_gpio[] __initdata = { - { - .name = "zcn-1523h:red:weak", - .gpio = ZCN_1523H_5_GPIO_LED_WEAK, - .active_low = 1, - }, { - .name = "zcn-1523h:amber:medium", - .gpio = ZCN_1523H_5_GPIO_LED_MEDIUM, - .active_low = 1, - }, { - .name = "zcn-1523h:green:strong", - .gpio = ZCN_1523H_5_GPIO_LED_STRONG, - .active_low = 1, - }, { - .name = "zcn-1523h:green:lan2", - .gpio = ZCN_1523H_5_GPIO_LED_LAN2, - .active_low = 1, - } -}; - -static void __init zcn_1523h_generic_setup(void) -{ - u8 *mac = (u8 *) KSEG1ADDR(0x1f7e0004); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | - AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); - - ath79_register_m25p80(NULL); - - ath79_register_leds_gpio(0, ARRAY_SIZE(zcn_1523h_leds_gpio), - zcn_1523h_leds_gpio); - - ath79_register_gpio_keys_polled(-1, ZCN_1523H_KEYS_POLL_INTERVAL, - ARRAY_SIZE(zcn_1523h_gpio_keys), - zcn_1523h_gpio_keys); - - ap91_pci_init(ee, mac); - - 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); - - /* LAN1 port */ - ath79_register_eth(0); -} - -static void __init zcn_1523h_2_setup(void) -{ - zcn_1523h_generic_setup(); - ap9x_pci_setup_wmac_gpio(0, BIT(9), 0); - - ath79_register_leds_gpio(1, ARRAY_SIZE(zcn_1523h_2_leds_gpio), - zcn_1523h_2_leds_gpio); -} - -MIPS_MACHINE(ATH79_MACH_ZCN_1523H_2, "ZCN-1523H-2", "Zcomax ZCN-1523H-2", - zcn_1523h_2_setup); - -static void __init zcn_1523h_5_setup(void) -{ - zcn_1523h_generic_setup(); - ap9x_pci_setup_wmac_gpio(0, BIT(8), 0); - - ath79_register_leds_gpio(1, ARRAY_SIZE(zcn_1523h_5_leds_gpio), - zcn_1523h_5_leds_gpio); - - /* LAN2 port */ - ath79_register_eth(1); -} - -MIPS_MACHINE(ATH79_MACH_ZCN_1523H_5, "ZCN-1523H-5", "Zcomax ZCN-1523H-5", - zcn_1523h_5_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/machtypes.h deleted file mode 100644 index 0bb15bf3c..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/machtypes.h +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Atheros AR71XX/AR724X/AR913X machine type definitions - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#ifndef _ATH79_MACHTYPE_H -#define _ATH79_MACHTYPE_H - -#include - -enum ath79_mach_type { - ATH79_MACH_GENERIC_OF = -1, /* Device tree board */ - ATH79_MACH_GENERIC = 0, - ATH79_MACH_A40, /* OpenMesh A40 */ - ATH79_MACH_A60, /* OpenMesh A60 */ - ATH79_MACH_WI2A_AC200I, /* Nokia WI2A-AC200i */ - ATH79_MACH_ALFA_AP120C, /* ALFA Network AP120C board */ - ATH79_MACH_ALFA_AP96, /* ALFA Network AP96 board */ - ATH79_MACH_ALFA_NX, /* ALFA Network N2/N5 board */ - ATH79_MACH_ALL0258N, /* Allnet ALL0258N */ - ATH79_MACH_ALL0305, /* Allnet ALL0305 */ - ATH79_MACH_ALL0315N, /* Allnet ALL0315N */ - ATH79_MACH_ANTMINER_S1, /* Antminer S1 */ - ATH79_MACH_ANTMINER_S3, /* Antminer S3 */ - ATH79_MACH_ANTROUTER_R1, /* Antrouter R1 */ - ATH79_MACH_AP121, /* Atheros AP121 reference board */ - ATH79_MACH_AP121_MINI, /* Atheros AP121-MINI reference board */ - ATH79_MACH_AP121F, /* ALFA Network AP121F */ - ATH79_MACH_AP132, /* Atheros AP132 reference board */ - ATH79_MACH_AP135_020, /* Atheros AP135-020 reference board */ - ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */ - ATH79_MACH_AP136_020, /* Atheros AP136-020 reference board */ - ATH79_MACH_AP143, /* Atheros AP143 reference board */ - ATH79_MACH_AP147_010, /* Atheros AP147-010 reference board */ - ATH79_MACH_AC9531_010, /* Atheros AC9531-010 reference board */ - ATH79_MACH_AC9531_020, /* Atheros AC9531-020 reference board */ - ATH79_MACH_AP152, /* Atheros AP152 reference board */ - ATH79_MACH_AP531B0, /* Rockeetech AP531B0 */ - ATH79_MACH_AP90Q, /* YunCore AP80Q/AP90Q */ - ATH79_MACH_AP91_5G, /* ALFA Network AP91-5G */ - ATH79_MACH_AP96, /* Atheros AP96 */ - ATH79_MACH_ARCHER_C25_V1, /* TP-LINK Archer C25 V1 board */ - ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */ - ATH79_MACH_ARCHER_C58_V1, /* TP-LINK Archer C58 V1 board */ - ATH79_MACH_ARCHER_C59_V1, /* TP-LINK Archer C59 V1 board */ - ATH79_MACH_ARCHER_C60_V1, /* TP-LINK Archer C60 V1 board */ - ATH79_MACH_ARCHER_C60_V2, /* TP-LINK Archer C60 V2 board */ - ATH79_MACH_ARCHER_C7, /* TP-LINK Archer C7 board */ - ATH79_MACH_ARCHER_C7_V2, /* TP-LINK Archer C7 V2 board */ - ATH79_MACH_ARCHER_C7_V4, /* TP-LINK Archer C7 V4 board */ - ATH79_MACH_ARDUINO_YUN, /* Yun */ - ATH79_MACH_AW_NR580, /* AzureWave AW-NR580 */ - ATH79_MACH_BHR_4GRV2, /* Buffalo BHR-4GRV2 */ - ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */ - ATH79_MACH_BSB, /* Smart Electronics Black Swift board */ - ATH79_MACH_C55, /* AirTight Networks C-55 */ - ATH79_MACH_C60, /* AirTight Networks C-60 */ - ATH79_MACH_CAP324, /* PowerCloud CAP324 */ - ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */ - ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */ - ATH79_MACH_CF_E316N_V2, /* COMFAST CF-E316N v2 */ - ATH79_MACH_CF_E320N_V2, /* COMFAST CF-E320N v2 */ - ATH79_MACH_CF_E355AC, /* COMFAST CF-E355AC */ - ATH79_MACH_CF_E355AC_V2, /* COMFAST CF-E355AC v2*/ - ATH79_MACH_CF_E375AC, /* COMFAST CF-E375AC */ - ATH79_MACH_CF_E380AC_V1, /* COMFAST CF-E380AC v1 */ - ATH79_MACH_CF_E380AC_V2, /* COMFAST CF-E380AC v2 */ - ATH79_MACH_CF_E385AC, /* COMFAST CF-E385AC */ - ATH79_MACH_CF_E520N, /* COMFAST CF-E520N */ - ATH79_MACH_CF_E530N, /* COMFAST CF-E530N */ - ATH79_MACH_CPE210, /* TP-LINK CPE210 */ - ATH79_MACH_CPE505N, /* P&W CPE505N */ - ATH79_MACH_CPE510, /* TP-LINK CPE510 */ - ATH79_MACH_CPE830, /* YunCore CPE830 */ - ATH79_MACH_CPE870, /* YunCore CPE870 */ - ATH79_MACH_CR3000, /* PowerCloud CR3000 */ - ATH79_MACH_CR5000, /* PowerCloud CR5000 */ - ATH79_MACH_DAP_1330_A1, /* D-Link DAP-1330 rev. A1 */ - ATH79_MACH_DAP_2695_A1, /* D-Link DAP-2695 rev. A1 */ - ATH79_MACH_DB120, /* Atheros DB120 reference board */ - ATH79_MACH_DGL_5500_A1, /* D-link DGL-5500 rev. A1 */ - ATH79_MACH_DHP_1565_A1, /* D-Link DHP-1565 rev. A1 */ - ATH79_MACH_DIR_505_A1, /* D-Link DIR-505 rev. A1 */ - ATH79_MACH_DIR_600_A1, /* D-Link DIR-600 rev. A1 */ - ATH79_MACH_DIR_615_C1, /* D-Link DIR-615 rev. C1 */ - ATH79_MACH_DIR_615_E1, /* D-Link DIR-615 rev. E1 */ - ATH79_MACH_DIR_615_E4, /* D-Link DIR-615 rev. E4 */ - ATH79_MACH_DIR_615_I1, /* D-Link DIR-615 rev. I1 */ - ATH79_MACH_DIR_825_B1, /* D-Link DIR-825 rev. B1 */ - ATH79_MACH_DIR_825_C1, /* D-Link DIR-825 rev. C1 */ - ATH79_MACH_DIR_835_A1, /* D-Link DIR-835 rev. A1 */ - ATH79_MACH_DIR_869_A1, /* D-Link DIR-869 rev. A1 */ - ATH79_MACH_DLAN_HOTSPOT, /* devolo dLAN Hotspot */ - ATH79_MACH_DLAN_PRO_1200_AC, /* devolo dLAN pro 1200+ WiFi ac*/ - ATH79_MACH_DLAN_PRO_500_WP, /* devolo dLAN pro 500 Wireless+ */ - ATH79_MACH_DOMYWIFI_DW33D, /* DomyWifi DW33D */ - ATH79_MACH_DR342, /* Wallys DR342 */ - ATH79_MACH_DR344, /* Wallys DR344 */ - ATH79_MACH_DR531, /* Wallys DR531 */ - ATH79_MACH_DRAGINO2, /* Dragino Version 2 */ - ATH79_MACH_E1700AC_V2, /* Qxwlan E1700AC v2 */ - ATH79_MACH_E600G_V2, /* Qxwlan E600G v2 */ - ATH79_MACH_E600GAC_V2, /* Qxwlan E600GAC v2 */ - ATH79_MACH_EAP120, /* TP-LINK EAP120 */ - ATH79_MACH_EAP300V2, /* EnGenius EAP300 v2 */ - ATH79_MACH_EAP7660D, /* Senao EAP7660D */ - ATH79_MACH_EBR_2310_C1, /* D-link EBR-2310 rev. C1 */ - ATH79_MACH_EL_M150, /* EasyLink EL-M150 */ - ATH79_MACH_EL_MINI, /* EasyLink EL-MINI */ - ATH79_MACH_ENS202EXT, /* EnGenius ENS202EXT */ - ATH79_MACH_EPG5000, /* EnGenius EPG5000 */ - ATH79_MACH_ESR1750, /* EnGenius ESR1750 */ - ATH79_MACH_ESR900, /* EnGenius ESR900 */ - ATH79_MACH_EW_BALIN, /* embedded wireless Balin Platform */ - ATH79_MACH_EW_DORIN, /* embedded wireless Dorin Platform */ - ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */ - ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */ - ATH79_MACH_FRITZ300E, /* AVM FRITZ!WLAN Repeater 300E */ - ATH79_MACH_FRITZ4020, /* AVM FRITZ!Box 4020 */ - ATH79_MACH_GL_AR150, /* GL-AR150 support */ - ATH79_MACH_GL_AR300, /* GL-AR300 */ - ATH79_MACH_GL_AR300M, /* GL-AR300M */ - ATH79_MACH_GL_AR750, /* GL.iNet GL-AR750 */ - ATH79_MACH_GL_AR750S, /* GL.iNet GL-AR750S */ - ATH79_MACH_GL_DOMINO, /* Domino */ - ATH79_MACH_GL_INET, /* GL-CONNECT GL-INET */ - ATH79_MACH_GL_MIFI, /* GL-MIFI support */ - ATH79_MACH_GL_USB150, /* GL.iNet GL-USB150 */ - ATH79_MACH_GS_MINIBOX_V1, /* GainStrong MiniBox V1.0 */ - ATH79_MACH_GS_OOLITE_V1, /* GainStrong Oolite V1.0 */ - ATH79_MACH_GS_OOLITE_V5_2, /* GainStrong Oolite V5.2 */ - ATH79_MACH_GS_OOLITE_V5_2_DEV, /* GainStrong Oolite V5.2-Dev */ - ATH79_MACH_HIVEAP_121, /* Aerohive HiveAP-121*/ - ATH79_MACH_HIWIFI_HC6361, /* HiWiFi HC6361 */ - ATH79_MACH_HORNET_UB, /* ALFA Networks Hornet-UB */ - ATH79_MACH_JA76PF, /* jjPlus JA76PF */ - ATH79_MACH_JA76PF2, /* jjPlus JA76PF2 */ - ATH79_MACH_JWAP003, /* jjPlus JWAP003 */ - ATH79_MACH_JWAP230, /* jjPlus JWAP230 */ - ATH79_MACH_KOALA, /* OCEDO Koala */ - ATH79_MACH_K2T, /* Phicomm K2T A1/A2/A3 board */ - ATH79_MACH_LAN_TURTLE, /* Hak5 LAN Turtle */ - ATH79_MACH_LIMA, /* 8devices Lima */ - ATH79_MACH_MC_MAC1200R, /* MERCURY MAC1200R */ - ATH79_MACH_MR12, /* Cisco Meraki MR12 */ - ATH79_MACH_MR16, /* Cisco Meraki MR16 */ - ATH79_MACH_MR1750, /* OpenMesh MR1750 */ - ATH79_MACH_MR1750V2, /* OpenMesh MR1750v2 */ - ATH79_MACH_MR18, /* Cisco Meraki MR18 */ - ATH79_MACH_MR600, /* OpenMesh MR600 */ - ATH79_MACH_MR600V2, /* OpenMesh MR600v2 */ - ATH79_MACH_MR900, /* OpenMesh MR900 */ - ATH79_MACH_MR900v2, /* OpenMesh MR900v2 */ - ATH79_MACH_MYNET_N600, /* WD My Net N600 */ - ATH79_MACH_MYNET_N750, /* WD My Net N750 */ - ATH79_MACH_MYNET_REXT, /* WD My Net Wi-Fi Range Extender */ - ATH79_MACH_MZK_W04NU, /* Planex MZK-W04NU */ - ATH79_MACH_MZK_W300NH, /* Planex MZK-W300NH */ - ATH79_MACH_N5Q, /* ALFA Network N5Q */ - ATH79_MACH_NBG460N, /* Zyxel NBG460N/550N/550NH */ - ATH79_MACH_NBG6616, /* Zyxel NBG6616 */ - ATH79_MACH_NBG6716, /* Zyxel NBG6716 */ - ATH79_MACH_OM2P, /* OpenMesh OM2P */ - ATH79_MACH_OM2Pv2, /* OpenMesh OM2Pv2 */ - ATH79_MACH_OM2Pv4, /* OpenMesh OM2Pv4 */ - ATH79_MACH_OM2P_HS, /* OpenMesh OM2P-HS */ - ATH79_MACH_OM2P_HSv2, /* OpenMesh OM2P-HSv2 */ - ATH79_MACH_OM2P_HSv3, /* OpenMesh OM2P-HSv3 */ - ATH79_MACH_OM2P_HSv4, /* OpenMesh OM2P-HSv4 */ - ATH79_MACH_OM2P_LC, /* OpenMesh OM2P-LC */ - ATH79_MACH_OM5P, /* OpenMesh OM5P */ - ATH79_MACH_OM5P_AC, /* OpenMesh OM5P-AC */ - ATH79_MACH_OM5P_ACv2, /* OpenMesh OM5P-ACv2 */ - ATH79_MACH_OM5P_AN, /* OpenMesh OM5P-AN */ - ATH79_MACH_OMY_G1, /* OMYlink OMY-G1 */ - ATH79_MACH_OMY_X1, /* OMYlink OMY-X1 */ - ATH79_MACH_ONION_OMEGA, /* ONION OMEGA */ - ATH79_MACH_PACKET_SQUIRREL, /* Hak5 Packet Squirrel */ - ATH79_MACH_PB42, /* Atheros PB42 */ - ATH79_MACH_PB44, /* Atheros PB44 reference board */ - ATH79_MACH_PQI_AIR_PEN, /* PQI Air Pen */ - ATH79_MACH_QIHOO_C301, /* Qihoo 360 C301 */ - ATH79_MACH_R36A, /* ALFA Network R36A */ - ATH79_MACH_R602N, /* P&W R602N */ - ATH79_MACH_R6100, /* NETGEAR R6100 */ - ATH79_MACH_RAMBUTAN, /* 8devices Rambutan */ - ATH79_MACH_RB_2011G, /* Mikrotik RouterBOARD 2011UAS-2HnD */ - ATH79_MACH_RB_2011L, /* Mikrotik RouterBOARD 2011L */ - ATH79_MACH_RB_2011R5, /* Mikrotik RouterBOARD 2011UiAS(-2Hnd) */ - ATH79_MACH_RB_2011US, /* Mikrotik RouterBOARD 2011UAS */ - ATH79_MACH_RB_411, /* MikroTik RouterBOARD 411/411A/411AH */ - ATH79_MACH_RB_411U, /* MikroTik RouterBOARD 411U */ - ATH79_MACH_RB_433, /* MikroTik RouterBOARD 433/433AH */ - ATH79_MACH_RB_433U, /* MikroTik RouterBOARD 433UAH */ - ATH79_MACH_RB_435G, /* MikroTik RouterBOARD 435G */ - ATH79_MACH_RB_450, /* MikroTik RouterBOARD 450 */ - ATH79_MACH_RB_450G, /* MikroTik RouterBOARD 450G */ - ATH79_MACH_RB_493, /* Mikrotik RouterBOARD 493/493AH */ - ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */ - ATH79_MACH_RB_711GR100, /* Mikrotik RouterBOARD 911/912 boards */ - ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */ - ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */ - ATH79_MACH_RB_750UPR2, /* MikroTik RouterBOARD 750UP r2 */ - ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */ - ATH79_MACH_RB_751G, /* Mikrotik RouterBOARD 751G */ - ATH79_MACH_RB_911L, /* Mikrotik RouterBOARD 911-2Hn/911-5Hn boards */ - ATH79_MACH_RB_922GS, /* Mikrotik RouterBOARD 911/922GS boards */ - ATH79_MACH_RB_941, /* MikroTik RouterBOARD 941-2nD */ - ATH79_MACH_RB_951G, /* Mikrotik RouterBOARD 951G */ - ATH79_MACH_RB_951U, /* Mikrotik RouterBOARD 951Ui-2HnD */ - ATH79_MACH_RB_952, /* MikroTik RouterBOARD 951Ui-2nD / 952Ui-5ac2nD */ - ATH79_MACH_RB_962, /* MikroTik RouterBOARD 962UiGS-5HacT2HnT */ - ATH79_MACH_RB_CAP, /* Mikrotik RouterBOARD cAP2nD */ - ATH79_MACH_RB_LHG5, /* Mikrotik RouterBOARD LHG5 */ - ATH79_MACH_RB_MAP, /* Mikrotik RouterBOARD mAP2nD */ - ATH79_MACH_RB_MAPL, /* Mikrotik RouterBOARD mAP L-2nD */ - ATH79_MACH_RB_WAP, /* Mikrotik RouterBOARD wAP2nD */ - ATH79_MACH_RB_WAPAC, /* Mikrotik RouterBOARD wAPG-5HacT2HnD */ - ATH79_MACH_RB_SXTLITE2ND, /* Mikrotik RouterBOARD SXT Lite 2nD */ - ATH79_MACH_RB_SXTLITE5ND, /* Mikrotik RouterBOARD SXT Lite 5nD */ - ATH79_MACH_RE355, /* TP-LINK RE355 */ - ATH79_MACH_RE450, /* TP-LINK RE450 */ - ATH79_MACH_RME_EG200, /* eTactica EG200 */ - ATH79_MACH_RUT9XX, /* Teltonika RUT900 series */ - ATH79_MACH_RW2458N, /* Redwave RW2458N */ - ATH79_MACH_SC1750, /* Abicom SC1750 */ - ATH79_MACH_SC300M, /* Abicom SC300M */ - ATH79_MACH_SC450, /* Abicom SC450 */ - ATH79_MACH_SMART_300, /* NC-LINK SMART-300 */ - ATH79_MACH_SOM9331, /* OpenEmbed SOM9331 */ - ATH79_MACH_SR3200, /* YunCore SR3200 */ - ATH79_MACH_T830, /* YunCore T830 */ - ATH79_MACH_TELLSTICK_ZNET_LITE, /* TellStick ZNet Lite */ - ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */ - ATH79_MACH_TEW_673GRU, /* TRENDnet TEW-673GRU */ - ATH79_MACH_TEW_712BR, /* TRENDnet TEW-712BR */ - ATH79_MACH_TEW_732BR, /* TRENDnet TEW-732BR */ - ATH79_MACH_TEW_823DRU, /* TRENDnet TEW-823DRU */ - ATH79_MACH_TL_MR10U, /* TP-LINK TL-MR10U */ - ATH79_MACH_TL_MR11U, /* TP-LINK TL-MR11U */ - ATH79_MACH_TL_MR13U, /* TP-LINK TL-MR13U */ - ATH79_MACH_TL_MR3020, /* TP-LINK TL-MR3020 */ - ATH79_MACH_TL_MR3040, /* TP-LINK TL-MR3040 */ - ATH79_MACH_TL_MR3040_V2, /* TP-LINK TL-MR3040 v2 */ - ATH79_MACH_TL_MR3220, /* TP-LINK TL-MR3220 */ - ATH79_MACH_TL_MR3220_V2, /* TP-LINK TL-MR3220 v2 */ - ATH79_MACH_TL_MR3420, /* TP-LINK TL-MR3420 */ - ATH79_MACH_TL_MR3420_V2, /* TP-LINK TL-MR3420 v2 */ - ATH79_MACH_TL_MR6400, /* TP-LINK TL-MR6400 */ - ATH79_MACH_TL_WA701ND_V2, /* TP-LINK TL-WA701ND v2 */ - ATH79_MACH_TL_WA7210N_V2, /* TP-LINK TL-WA7210N v2 */ - ATH79_MACH_TL_WA750RE, /* TP-LINK TL-WA750RE */ - ATH79_MACH_TL_WA7510N_V1, /* TP-LINK TL-WA7510N v1 */ - ATH79_MACH_TL_WA801ND_V2, /* TP-LINK TL-WA801ND v2 */ - ATH79_MACH_TL_WA801ND_V3, /* TP-LINK TL-WA801ND v3 */ - ATH79_MACH_TL_WA830RE_V2, /* TP-LINK TL-WA830RE v2 */ - ATH79_MACH_TL_WA850RE, /* TP-LINK TL-WA850RE */ - ATH79_MACH_TL_WA850RE_V2, /* TP-LINK TL-WA850RE v2 */ - ATH79_MACH_TL_WA855RE_V1, /* TP-LINK TL-WA855RE v1 */ - ATH79_MACH_TL_WA860RE, /* TP-LINK TL-WA860RE */ - ATH79_MACH_TL_WA901ND, /* TP-LINK TL-WA901ND */ - ATH79_MACH_TL_WA901ND_V2, /* TP-LINK TL-WA901ND v2 */ - ATH79_MACH_TL_WA901ND_V3, /* TP-LINK TL-WA901ND v3 */ - ATH79_MACH_TL_WA901ND_V4, /* TP-LINK TL-WA901ND v4 */ - ATH79_MACH_TL_WA901ND_V5, /* TP-LINK TL-WA901ND v5 */ - ATH79_MACH_TL_WDR3320_V2, /* TP-LINK TL-WDR3320 v2 */ - ATH79_MACH_TL_WDR3500, /* TP-LINK TL-WDR3500 */ - ATH79_MACH_TL_WDR4300, /* TP-LINK TL-WDR4300 */ - ATH79_MACH_TL_WDR4900_V2, /* TP-LINK TL-WDR4900 v2 */ - ATH79_MACH_TL_WDX6501_V7, /* TP-LINK TL-WDX6501 v7 */ - ATH79_MACH_TL_WDR6500_V2, /* TP-LINK TL-WDR6500 v2 */ - ATH79_MACH_TL_WPA8630, /* TP-Link TL-WPA8630 */ - ATH79_MACH_TL_WR1041N_V2, /* TP-LINK TL-WR1041N v2 */ - ATH79_MACH_TL_WR1043N_V5, /* TP-LINK TL-WR1043N v5 */ - 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 */ - ATH79_MACH_TL_WR720N_V3, /* TP-LINK TL-WR720N v3/v4 */ - ATH79_MACH_TL_WR740N_V6, /* TP-LINK TL-WR740N/ND v6 */ - ATH79_MACH_TL_WR741ND, /* TP-LINK TL-WR741ND */ - ATH79_MACH_TL_WR741ND_V4, /* TP-LINK TL-WR741ND v4 */ - ATH79_MACH_TL_WR802N_V1, /* TP-LINK TL-WR802N v1 */ - ATH79_MACH_TL_WR802N_V2, /* TP-LINK TL-WR802N v2 */ - ATH79_MACH_TL_WR810N, /* TP-LINK TL-WR810N */ - ATH79_MACH_TL_WR810N_V2, /* TP-LINK TL-WR810N v2 */ - ATH79_MACH_TL_WR840N_V2, /* TP-LINK TL-WR840N v2 */ - ATH79_MACH_TL_WR840N_V3, /* TP-LINK TL-WR840N v3 */ - ATH79_MACH_TL_WR841N_V1, /* TP-LINK TL-WR841N v1 */ - ATH79_MACH_TL_WR841N_V11, /* TP-LINK TL-WR841N/ND v11 */ - ATH79_MACH_TL_WR841N_V7, /* TP-LINK TL-WR841N/ND v7 */ - ATH79_MACH_TL_WR841N_V8, /* TP-LINK TL-WR841N/ND v8 */ - ATH79_MACH_TL_WR841N_V9, /* TP-LINK TL-WR841N/ND v9 */ - ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */ - ATH79_MACH_TL_WR842N_V3, /* TP-LINK TL-WR842N/ND v3 */ - ATH79_MACH_TL_WR902AC_V1, /* TP-LINK TL-WR902AC v1 */ - 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_TL_WR940N_V6, /* TP-LINK TL-WR940N v6 */ - ATH79_MACH_TL_WR942N_V1, /* TP-LINK TL-WR942N v1 */ - ATH79_MACH_TS_D084, /* PISEN TS-D084 */ - ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */ - ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */ - ATH79_MACH_UBNT_AIRGWP, /* Ubiquiti AirGateway Pro */ - ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */ - ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ - ATH79_MACH_UBNT_LBE_M5, /* Ubiquiti Litebeam M5 */ - ATH79_MACH_UBNT_LOCO_M_XW, /* Ubiquiti Loco M XW */ - ATH79_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */ - ATH79_MACH_UBNT_LSX, /* Ubiquiti LSX */ - ATH79_MACH_UBNT_NANO_M, /* Ubiquiti NanoStation M */ - ATH79_MACH_UBNT_NANO_M_XW, /* Ubiquiti NanoStation M XW */ - ATH79_MACH_UBNT_ROCKET_M, /* Ubiquiti Rocket M */ - ATH79_MACH_UBNT_ROCKET_M_TI, /* Ubiquiti Rocket M TI */ - ATH79_MACH_UBNT_ROCKET_M_XW, /* Ubiquiti Rocket M XW */ - ATH79_MACH_UBNT_RS, /* Ubiquiti RouterStation */ - ATH79_MACH_UBNT_RSPRO, /* Ubiquiti RouterStation Pro */ - ATH79_MACH_UBNT_UAP_PRO, /* Ubiquiti UniFi AP Pro */ - ATH79_MACH_UBNT_UNIFI, /* Ubiquiti Unifi */ - ATH79_MACH_UBNT_UNIFIAC_LITE, /* Ubiquiti Unifi AC LITE/LR/MESH */ - ATH79_MACH_UBNT_UNIFIAC_PRO, /* Ubiquiti Unifi AC PRO */ - 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_WAM250, /* Samsung WAM250 */ - 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 */ - ATH79_MACH_WHR_HP_GN, /* Buffalo WHR-HP-GN */ - ATH79_MACH_WIFI_PINEAPPLE_NANO, /* Hak5 WiFi Pineapple NANO */ - ATH79_MACH_WLAE_AG300N, /* Buffalo WLAE-AG300N */ - ATH79_MACH_WLR8100, /* SITECOM WLR-8100 */ - ATH79_MACH_WNDAP360, /* NETGEAR WNDAP360 */ - ATH79_MACH_WNDR3700, /* NETGEAR WNDR3700/WNDR3800/WNDRMAC */ - ATH79_MACH_WNDR3700_V4, /* NETGEAR WNDR3700v4 */ - ATH79_MACH_WNDR4300, /* NETGEAR WNDR4300 */ - ATH79_MACH_WNR1000_V2, /* NETGEAR WNR1000 v2 */ - ATH79_MACH_WNR2000, /* NETGEAR WNR2000 */ - ATH79_MACH_WNR2000_V3, /* NETGEAR WNR2000 v3 */ - ATH79_MACH_WNR2000_V4, /* NETGEAR WNR2000 v4 */ - ATH79_MACH_WNR2200, /* NETGEAR WNR2200 */ - ATH79_MACH_WNR612_V2, /* NETGEAR WNR612 v2 */ - ATH79_MACH_WP543, /* Compex WP543 */ - ATH79_MACH_WPE72, /* Compex WPE72 */ - ATH79_MACH_WPJ342, /* Compex WPJ342 */ - ATH79_MACH_WPJ344, /* Compex WPJ344 */ - ATH79_MACH_WPJ531, /* Compex WPJ531 */ - ATH79_MACH_WPJ558, /* Compex WPJ558 */ - ATH79_MACH_WPJ563, /* Compex WPJ563 */ - ATH79_MACH_WPN824N, /* NETGEAR WPN824N */ - ATH79_MACH_WRT160NL, /* Linksys WRT160NL */ - ATH79_MACH_WRT400N, /* Linksys WRT400N */ - ATH79_MACH_WRTNODE2Q, /* WRTnode2Q */ - ATH79_MACH_WZR_450HP2, /* Buffalo WZR-450HP2 */ - ATH79_MACH_WZR_HP_AG300H, /* Buffalo WZR-HP-AG300H */ - 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 */ - ATH79_MACH_ZCN_1523H_5, /* Zcomax ZCN-1523H-5-xx */ -}; - -#endif /* _ATH79_MACHTYPE_H */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/nvram.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/nvram.c deleted file mode 100644 index a1de55fb1..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/nvram.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Atheros AR71xx minimal nvram support - * - * Copyright (C) 2009 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include - -#include "nvram.h" - -char *ath79_nvram_find_var(const char *name, const char *buf, unsigned buf_len) -{ - unsigned len = strlen(name); - char *cur, *last; - - if (buf_len == 0 || len == 0) - return NULL; - - if (buf_len < len) - return NULL; - - if (len == 1) - return memchr(buf, (int) *name, buf_len); - - last = (char *) buf + buf_len - len; - for (cur = (char *) buf; cur <= last; cur++) - if (cur[0] == name[0] && memcmp(cur, name, len) == 0) - return cur + len; - - return NULL; -} - -int ath79_nvram_parse_mac_addr(const char *nvram, unsigned nvram_len, - const char *name, char *mac) -{ - char *buf; - char *mac_str; - int ret; - int t; - - buf = vmalloc(nvram_len); - if (!buf) - return -ENOMEM; - - memcpy(buf, nvram, nvram_len); - buf[nvram_len - 1] = '\0'; - - mac_str = ath79_nvram_find_var(name, buf, nvram_len); - if (!mac_str) { - ret = -EINVAL; - goto free; - } - - if (strlen(mac_str) == 19 && mac_str[0] == '"' && mac_str[18] == '"') { - mac_str[18] = 0; - mac_str++; - } - - t = sscanf(mac_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", - &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]); - - if (t != ETH_ALEN) - t = sscanf(mac_str, "%02hhx-%02hhx-%02hhx-%02hhx-%02hhx-%02hhx", - &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]); - - if (t != ETH_ALEN) { - ret = -EINVAL; - goto free; - } - - ret = 0; - -free: - vfree(buf); - return ret; -} diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/nvram.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/nvram.h deleted file mode 100644 index 75151d4a3..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/nvram.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Atheros AR71xx minimal nvram support - * - * Copyright (C) 2009 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#ifndef _ATH79_NVRAM_H -#define _ATH79_NVRAM_H - -char *ath79_nvram_find_var(const char *name, const char *buf, - unsigned buf_len); -int ath79_nvram_parse_mac_addr(const char *nvram, unsigned nvram_len, - const char *name, char *mac); - -#endif /* _ATH79_NVRAM_H */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/pci-ath9k-fixup.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/pci-ath9k-fixup.c deleted file mode 100644 index 220235180..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/pci-ath9k-fixup.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Atheros AP94 reference board PCI initialization - * - * Copyright (C) 2009-2010 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include - -#include -#include - -struct ath9k_fixup { - u16 *cal_data; - unsigned slot; -}; - -static int ath9k_num_fixups; -static struct ath9k_fixup ath9k_fixups[2]; - -static void ath9k_pci_fixup(struct pci_dev *dev) -{ - void __iomem *mem; - u16 *cal_data = NULL; - u16 cmd; - u32 bar0; - u32 val; - unsigned i; - - for (i = 0; i < ath9k_num_fixups; i++) { - if (ath9k_fixups[i].cal_data == NULL) - continue; - - if (ath9k_fixups[i].slot != PCI_SLOT(dev->devfn)) - continue; - - cal_data = ath9k_fixups[i].cal_data; - break; - } - - if (cal_data == NULL) - return; - - if (*cal_data != 0xa55a) { - pr_err("pci %s: invalid calibration data\n", pci_name(dev)); - return; - } - - pr_info("pci %s: fixup device configuration\n", pci_name(dev)); - - mem = ioremap(AR71XX_PCI_MEM_BASE, 0x10000); - if (!mem) { - pr_err("pci %s: ioremap error\n", pci_name(dev)); - return; - } - - pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0); - - switch (ath79_soc) { - case ATH79_SOC_AR7161: - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, - AR71XX_PCI_MEM_BASE); - break; - case ATH79_SOC_AR7240: - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0xffff); - break; - - case ATH79_SOC_AR7241: - case ATH79_SOC_AR7242: - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0x1000ffff); - break; - case ATH79_SOC_AR9344: - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0x1000ffff); - break; - - default: - BUG(); - } - - pci_read_config_word(dev, PCI_COMMAND, &cmd); - cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - pci_write_config_word(dev, PCI_COMMAND, cmd); - - /* set pointer to first reg address */ - cal_data += 3; - while (*cal_data != 0xffff) { - u32 reg; - reg = *cal_data++; - val = *cal_data++; - val |= (*cal_data++) << 16; - - __raw_writel(val, mem + reg); - udelay(100); - } - - pci_read_config_dword(dev, PCI_VENDOR_ID, &val); - dev->vendor = val & 0xffff; - dev->device = (val >> 16) & 0xffff; - - pci_read_config_dword(dev, PCI_CLASS_REVISION, &val); - dev->revision = val & 0xff; - dev->class = val >> 8; /* upper 3 bytes */ - - pci_read_config_word(dev, PCI_COMMAND, &cmd); - cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); - pci_write_config_word(dev, PCI_COMMAND, cmd); - - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0); - - iounmap(mem); -} -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); - -void __init pci_enable_ath9k_fixup(unsigned slot, u16 *cal_data) -{ - if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) - return; - - ath9k_fixups[ath9k_num_fixups].slot = slot; - ath9k_fixups[ath9k_num_fixups].cal_data = cal_data; - ath9k_num_fixups++; -} diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/pci-ath9k-fixup.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/pci-ath9k-fixup.h deleted file mode 100644 index 5794941f0..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/pci-ath9k-fixup.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _PCI_ATH9K_FIXUP -#define _PCI_ATH9K_FIXUP - -void pci_enable_ath9k_fixup(unsigned slot, u16 *cal_data) __init; - -#endif /* _PCI_ATH9K_FIXUP */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/routerboot.c b/target/linux/ar71xx/files-4.9/arch/mips/ath79/routerboot.c deleted file mode 100644 index 76776e1d8..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/routerboot.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * RouterBoot helper routines - * - * 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. - */ - -#define pr_fmt(fmt) "rb: " fmt - -#include -#include -#include -#include -#include -#include -#include - -#include "routerboot.h" - -#define RB_BLOCK_SIZE 0x1000 -#define RB_ART_SIZE 0x10000 -#define RB_MAGIC_ERD 0x00455244 /* extended radio data */ - -static struct rb_info rb_info; - -static u32 get_u32(void *buf) -{ - u8 *p = buf; - - return ((u32) p[3] + ((u32) p[2] << 8) + ((u32) p[1] << 16) + - ((u32) p[0] << 24)); -} - -static u16 get_u16(void *buf) -{ - u8 *p = buf; - - return (u16) p[1] + ((u16) p[0] << 8); -} - -__init int -routerboot_find_magic(u8 *buf, unsigned int buflen, u32 *offset, bool hard) -{ - u32 magic_ref = hard ? RB_MAGIC_HARD : RB_MAGIC_SOFT; - u32 magic; - u32 cur = *offset; - - while (cur < buflen) { - magic = get_u32(buf + cur); - if (magic == magic_ref) { - *offset = cur; - return 0; - } - - cur += 0x1000; - } - - return -ENOENT; -} - -__init int -routerboot_find_tag(u8 *buf, unsigned int buflen, u16 tag_id, - u8 **tag_data, u16 *tag_len) -{ - uint32_t magic; - bool align = false; - int ret; - - if (buflen < 4) - return -EINVAL; - - magic = get_u32(buf); - switch (magic) { - case RB_MAGIC_ERD: - align = true; - /* fall trough */ - case RB_MAGIC_HARD: - /* skip magic value */ - buf += 4; - buflen -= 4; - break; - - case RB_MAGIC_SOFT: - if (buflen < 8) - return -EINVAL; - - /* skip magic and CRC value */ - buf += 8; - buflen -= 8; - - break; - - default: - return -EINVAL; - } - - ret = -ENOENT; - while (buflen > 2) { - u16 id; - u16 len; - - len = get_u16(buf); - buf += 2; - buflen -= 2; - - if (buflen < 2) - break; - - id = get_u16(buf); - buf += 2; - buflen -= 2; - - if (id == RB_ID_TERMINATOR) - break; - - if (buflen < len) - break; - - if (id == tag_id) { - if (tag_len) - *tag_len = len; - if (tag_data) - *tag_data = buf; - ret = 0; - break; - } - - if (align) - len = (len + 3) / 4; - - buf += len; - buflen -= len; - } - - return ret; -} - -static inline int -rb_find_hard_cfg_tag(u16 tag_id, u8 **tag_data, u16 *tag_len) -{ - if (!rb_info.hard_cfg_data || - !rb_info.hard_cfg_size) - return -ENOENT; - - return routerboot_find_tag(rb_info.hard_cfg_data, - rb_info.hard_cfg_size, - tag_id, tag_data, tag_len); -} - -__init const char * -rb_get_board_name(void) -{ - u16 tag_len; - u8 *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_BOARD_NAME, &tag, &tag_len); - if (err) - return NULL; - - return tag; -} - -__init u32 -rb_get_hw_options(void) -{ - u16 tag_len; - u8 *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_HW_OPTIONS, &tag, &tag_len); - if (err) - return 0; - - return get_u32(tag); -} - -static void * __init -__rb_get_wlan_data(u16 id) -{ - u16 tag_len; - u8 *tag; - void *buf; - int err; - u32 magic; - size_t src_done; - size_t dst_done; - - err = rb_find_hard_cfg_tag(RB_ID_WLAN_DATA, &tag, &tag_len); - if (err) { - pr_err("no calibration data found\n"); - goto err; - } - - buf = kmalloc(RB_ART_SIZE, GFP_KERNEL); - if (buf == NULL) { - pr_err("no memory for calibration data\n"); - goto err; - } - - magic = get_u32(tag); - if (magic == RB_MAGIC_ERD) { - u8 *erd_data; - u16 erd_len; - - if (id == 0) - goto err_free; - - err = routerboot_find_tag(tag, tag_len, id, - &erd_data, &erd_len); - if (err) { - pr_err("no ERD data found for id %u\n", id); - goto err_free; - } - - dst_done = RB_ART_SIZE; - err = lzo1x_decompress_safe(erd_data, erd_len, buf, &dst_done); - if (err) { - pr_err("unable to decompress calibration data %d\n", - err); - goto err_free; - } - } else { - if (id != 0) - goto err_free; - - err = rle_decode((char *) tag, tag_len, buf, RB_ART_SIZE, - &src_done, &dst_done); - if (err) { - pr_err("unable to decode calibration data\n"); - goto err_free; - } - } - - return buf; - -err_free: - kfree(buf); -err: - return NULL; -} - -__init void * -rb_get_wlan_data(void) -{ - return __rb_get_wlan_data(0); -} - -__init void * -rb_get_ext_wlan_data(u16 id) -{ - return __rb_get_wlan_data(id); -} - -__init const struct rb_info * -rb_init_info(void *data, unsigned int size) -{ - unsigned int offset; - - if (size == 0 || (size % RB_BLOCK_SIZE) != 0) - return NULL; - - for (offset = 0; offset < size; offset += RB_BLOCK_SIZE) { - u32 magic; - - magic = get_u32(data + offset); - switch (magic) { - case RB_MAGIC_HARD: - rb_info.hard_cfg_offs = offset; - break; - - case RB_MAGIC_SOFT: - rb_info.soft_cfg_offs = offset; - break; - } - } - - if (!rb_info.hard_cfg_offs) { - pr_err("could not find a valid RouterBOOT hard config\n"); - return NULL; - } - - if (!rb_info.soft_cfg_offs) { - pr_err("could not find a valid RouterBOOT soft config\n"); - return NULL; - } - - rb_info.hard_cfg_size = RB_BLOCK_SIZE; - rb_info.hard_cfg_data = kmemdup(data + rb_info.hard_cfg_offs, - RB_BLOCK_SIZE, GFP_KERNEL); - if (!rb_info.hard_cfg_data) - return NULL; - - rb_info.board_name = rb_get_board_name(); - rb_info.hw_options = rb_get_hw_options(); - - return &rb_info; -} - -static char *rb_ext_wlan_data; - -static ssize_t -rb_ext_wlan_data_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - if (off + count > attr->size) - return -EFBIG; - - memcpy(buf, &rb_ext_wlan_data[off], count); - - return count; -} - -static const struct bin_attribute rb_ext_wlan_data_attr = { - .attr = { - .name = "ext_wlan_data", - .mode = S_IRUSR | S_IWUSR, - }, - .read = rb_ext_wlan_data_read, - .size = RB_ART_SIZE, -}; - -static int __init rb_sysfs_init(void) -{ - struct kobject *rb_kobj; - int ret; - - rb_ext_wlan_data = rb_get_ext_wlan_data(1); - if (rb_ext_wlan_data == NULL) - return -ENOENT; - - rb_kobj = kobject_create_and_add("routerboot", firmware_kobj); - if (rb_kobj == NULL) { - ret = -ENOMEM; - pr_err("unable to create sysfs entry\n"); - goto err_free_wlan_data; - } - - ret = sysfs_create_bin_file(rb_kobj, &rb_ext_wlan_data_attr); - if (ret) { - pr_err("unable to create sysfs file, %d\n", ret); - goto err_put_kobj; - } - - return 0; - -err_put_kobj: - kobject_put(rb_kobj); -err_free_wlan_data: - kfree(rb_ext_wlan_data); - return ret; -} - -late_initcall(rb_sysfs_init); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/routerboot.h b/target/linux/ar71xx/files-4.9/arch/mips/ath79/routerboot.h deleted file mode 100644 index cf189362d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/routerboot.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * RouterBoot definitions - * - * 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. - */ - -#ifndef _ATH79_ROUTERBOOT_H_ -#define _ATH79_ROUTERBOOT_H_ - -struct rb_info { - unsigned int hard_cfg_offs; - unsigned int hard_cfg_size; - void *hard_cfg_data; - unsigned int soft_cfg_offs; - - const char *board_name; - u32 hw_options; -}; - -/* Bit definitions for hardware options */ -#define RB_HW_OPT_UART_ABSENT BIT(0) -#define RB_HW_OPT_HAS_VOLTAGE BIT(1) -#define RB_HW_OPT_HAS_USB BIT(2) -#define RB_HW_OPT_HAS_ATTINY BIT(3) -#define RB_HW_OPT_NO_NAND BIT(14) -#define RB_HW_OPT_HAS_LCD BIT(15) -#define RB_HW_OPT_HAS_POE_OUT BIT(16) -#define RB_HW_OPT_HAS_uSD BIT(17) -#define RB_HW_OPT_HAS_SFP BIT(20) -#define RB_HW_OPT_HAS_WIFI BIT(21) -#define RB_HW_OPT_HAS_TS_FOR_ADC BIT(22) -#define RB_HW_OPT_HAS_PLC BIT(29) - -static inline bool -rb_hw_option_match(const struct rb_info *info, u32 mask, u32 val) -{ - return (info->hw_options & (val | mask)) == val; -} - -static inline bool -rb_has_hw_option(const struct rb_info *info, u32 mask) -{ - return rb_hw_option_match(info, mask, mask); -} - -#ifdef CONFIG_ATH79_ROUTERBOOT -const struct rb_info *rb_init_info(void *data, unsigned int size); -void *rb_get_wlan_data(void); -void *rb_get_ext_wlan_data(u16 id); - -int routerboot_find_tag(u8 *buf, unsigned int buflen, u16 tag_id, - u8 **tag_data, u16 *tag_len); -int routerboot_find_magic(u8 *buf, unsigned int buflen, u32 *offset, bool hard); -#else -static inline const struct rb_info * -rb_init_info(void *data, unsigned int size) -{ - return NULL; -} - -static inline void *rb_get_wlan_data(void) -{ - return NULL; -} - -static inline void *rb_get_wlan_data(u16 id) -{ - return NULL; -} - -static inline int -routerboot_find_tag(u8 *buf, unsigned int buflen, u16 tag_id, - u8 **tag_data, u16 *tag_len) -{ - return -ENOENT; -} - -static inline int -routerboot_find_magic(u8 *buf, unsigned int buflen, u32 *offset, bool hard) -{ - return -ENOENT; -} -#endif - -#endif /* _ATH79_ROUTERBOOT_H_ */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/include/asm/fw/myloader/myloader.h b/target/linux/ar71xx/files-4.9/arch/mips/include/asm/fw/myloader/myloader.h deleted file mode 100644 index 8a99d566d..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/include/asm/fw/myloader/myloader.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Compex's MyLoader specific definitions - * - * Copyright (C) 2006-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _ASM_MIPS_FW_MYLOADER_H -#define _ASM_MIPS_FW_MYLOADER_H - -#include - -struct myloader_info { - uint32_t vid; - uint32_t did; - uint32_t svid; - uint32_t sdid; - uint8_t macs[MYLO_ETHADDR_COUNT][6]; -}; - -#ifdef CONFIG_MYLOADER -extern struct myloader_info *myloader_get_info(void) __init; -#else -static inline struct myloader_info *myloader_get_info(void) -{ - return NULL; -} -#endif /* CONFIG_MYLOADER */ - -#endif /* _ASM_MIPS_FW_MYLOADER_H */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/ag71xx_platform.h b/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/ag71xx_platform.h deleted file mode 100644 index c4c3a6d44..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/ag71xx_platform.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Atheros AR71xx SoC specific platform data definitions - * - * 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. - */ - -#ifndef __ASM_MACH_ATH79_PLATFORM_H -#define __ASM_MACH_ATH79_PLATFORM_H - -#include -#include -#include -#include - -struct ag71xx_switch_platform_data { - u8 phy4_mii_en:1; - u8 phy_poll_mask; -}; - -struct ag71xx_platform_data { - phy_interface_t phy_if_mode; - u32 phy_mask; - int speed; - int duplex; - u32 reset_bit; - u8 mac_addr[ETH_ALEN]; - struct device *mii_bus_dev; - - u8 has_gbit:1; - u8 is_ar91xx:1; - u8 is_ar7240:1; - u8 is_ar724x:1; - u8 has_ar8216:1; - u8 use_flow_control:1; - u8 disable_inline_checksum_engine:1; - - struct ag71xx_switch_platform_data *switch_data; - - void (*ddr_flush)(void); - void (*set_speed)(int speed); - void (*update_pll)(u32 pll_10, u32 pll_100, u32 pll_1000); - - unsigned int max_frame_len; - unsigned int desc_pktlen_mask; -}; - -struct ag71xx_mdio_platform_data { - u32 phy_mask; - u8 builtin_switch:1; - u8 is_ar7240:1; - u8 is_ar9330:1; - u8 is_ar934x:1; - unsigned long mdio_clock; - unsigned long ref_clock; - - void (*reset)(struct mii_bus *bus); -}; - -#endif /* __ASM_MACH_ATH79_PLATFORM_H */ diff --git a/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/mach-rb750.h b/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/mach-rb750.h deleted file mode 100644 index 50d5a2097..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/mach-rb750.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * MikroTik RouterBOARD 750 definitions - * - * Copyright (C) 2010-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. - */ -#ifndef _MACH_RB750_H -#define _MACH_RB750_H - -#include - -#define RB750_GPIO_LVC573_LE 0 /* Latch enable on LVC573 */ -#define RB750_GPIO_NAND_IO0 1 /* NAND I/O 0 */ -#define RB750_GPIO_NAND_IO1 2 /* NAND I/O 1 */ -#define RB750_GPIO_NAND_IO2 3 /* NAND I/O 2 */ -#define RB750_GPIO_NAND_IO3 4 /* NAND I/O 3 */ -#define RB750_GPIO_NAND_IO4 5 /* NAND I/O 4 */ -#define RB750_GPIO_NAND_IO5 6 /* NAND I/O 5 */ -#define RB750_GPIO_NAND_IO6 7 /* NAND I/O 6 */ -#define RB750_GPIO_NAND_IO7 8 /* NAND I/O 7 */ -#define RB750_GPIO_NAND_NCE 11 /* NAND Chip Enable (active low) */ -#define RB750_GPIO_NAND_RDY 12 /* NAND Ready */ -#define RB750_GPIO_NAND_CLE 14 /* NAND Command Latch Enable */ -#define RB750_GPIO_NAND_ALE 15 /* NAND Address Latch Enable */ -#define RB750_GPIO_NAND_NRE 16 /* NAND Read Enable (active low) */ -#define RB750_GPIO_NAND_NWE 17 /* NAND Write Enable (active low) */ - -#define RB750_GPIO_BTN_RESET 1 -#define RB750_GPIO_SPI_CS0 2 -#define RB750_GPIO_LED_ACT 12 -#define RB750_GPIO_LED_PORT1 13 -#define RB750_GPIO_LED_PORT2 14 -#define RB750_GPIO_LED_PORT3 15 -#define RB750_GPIO_LED_PORT4 16 -#define RB750_GPIO_LED_PORT5 17 - -#define RB750_LED_ACT BIT(RB750_GPIO_LED_ACT) -#define RB750_LED_PORT1 BIT(RB750_GPIO_LED_PORT1) -#define RB750_LED_PORT2 BIT(RB750_GPIO_LED_PORT2) -#define RB750_LED_PORT3 BIT(RB750_GPIO_LED_PORT3) -#define RB750_LED_PORT4 BIT(RB750_GPIO_LED_PORT4) -#define RB750_LED_PORT5 BIT(RB750_GPIO_LED_PORT5) -#define RB750_NAND_NCE BIT(RB750_GPIO_NAND_NCE) - -#define RB750_LVC573_LE BIT(RB750_GPIO_LVC573_LE) - -#define RB750_LED_BITS (RB750_LED_PORT1 | RB750_LED_PORT2 | RB750_LED_PORT3 | \ - RB750_LED_PORT4 | RB750_LED_PORT5 | RB750_LED_ACT) - -#define RB7XX_GPIO_NAND_NCE 0 -#define RB7XX_GPIO_MON 9 -#define RB7XX_GPIO_LED_ACT 11 -#define RB7XX_GPIO_USB_POWERON 13 - -#define RB7XX_NAND_NCE BIT(RB7XX_GPIO_NAND_NCE) -#define RB7XX_LED_ACT BIT(RB7XX_GPIO_LED_ACT) -#define RB7XX_MONITOR BIT(RB7XX_GPIO_MON) -#define RB7XX_USB_POWERON BIT(RB7XX_GPIO_USB_POWERON) - -struct rb750_led_data { - char *name; - char *default_trigger; - u32 mask; - int active_low; -}; - -struct rb750_led_platform_data { - int num_leds; - struct rb750_led_data *leds; - void (*latch_change)(u32 clear, u32 set); -}; - -struct rb7xx_nand_platform_data { - u32 nce_line; - - void (*enable_pins)(void); - void (*disable_pins)(void); - void (*latch_change)(u32, u32); -}; - -#endif /* _MACH_RB750_H */ \ No newline at end of file diff --git a/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h b/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h deleted file mode 100644 index 37512ba1a..000000000 --- a/target/linux/ar71xx/files-4.9/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SPI driver definitions for the CPLD chip on the Mikrotik RB4xx boards - * - * Copyright (C) 2010 Gabor Juhos - * - * This file was based on the patches for Linux 2.6.27.39 published by - * MikroTik for their RouterBoard 4xx series devices. - * - * 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 CPLD_GPIO_nLED1 0 -#define CPLD_GPIO_nLED2 1 -#define CPLD_GPIO_nLED3 2 -#define CPLD_GPIO_nLED4 3 -#define CPLD_GPIO_FAN 4 -#define CPLD_GPIO_ALE 5 -#define CPLD_GPIO_CLE 6 -#define CPLD_GPIO_nCE 7 -#define CPLD_GPIO_nLED5 8 - -#define CPLD_NUM_GPIOS 9 - -#define CPLD_CFG_nLED1 BIT(CPLD_GPIO_nLED1) -#define CPLD_CFG_nLED2 BIT(CPLD_GPIO_nLED2) -#define CPLD_CFG_nLED3 BIT(CPLD_GPIO_nLED3) -#define CPLD_CFG_nLED4 BIT(CPLD_GPIO_nLED4) -#define CPLD_CFG_FAN BIT(CPLD_GPIO_FAN) -#define CPLD_CFG_ALE BIT(CPLD_GPIO_ALE) -#define CPLD_CFG_CLE BIT(CPLD_GPIO_CLE) -#define CPLD_CFG_nCE BIT(CPLD_GPIO_nCE) -#define CPLD_CFG_nLED5 BIT(CPLD_GPIO_nLED5) - -struct rb4xx_cpld_platform_data { - unsigned gpio_base; -}; - -extern int rb4xx_cpld_change_cfg(unsigned mask, unsigned value); -extern int rb4xx_cpld_read(unsigned char *rx_buf, - unsigned cnt); -extern int rb4xx_cpld_write(const unsigned char *buf, unsigned count); diff --git a/target/linux/ar71xx/files-4.9/drivers/gpio/gpio-latch.c b/target/linux/ar71xx/files-4.9/drivers/gpio/gpio-latch.c deleted file mode 100644 index d911f6a2c..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/gpio/gpio-latch.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * GPIO latch driver - * - * Copyright (C) 2014 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 - -struct gpio_latch_chip { - struct gpio_chip gc; - - struct mutex mutex; - struct mutex latch_mutex; - bool latch_enabled; - int le_gpio; - bool le_active_low; - int *gpios; -}; - -static inline struct gpio_latch_chip *to_gpio_latch_chip(struct gpio_chip *gc) -{ - return container_of(gc, struct gpio_latch_chip, gc); -} - -static void gpio_latch_lock(struct gpio_latch_chip *glc, bool enable) -{ - mutex_lock(&glc->mutex); - - if (enable) - glc->latch_enabled = true; - - if (glc->latch_enabled) - mutex_lock(&glc->latch_mutex); -} - -static void gpio_latch_unlock(struct gpio_latch_chip *glc, bool disable) -{ - if (glc->latch_enabled) - mutex_unlock(&glc->latch_mutex); - - if (disable) - glc->latch_enabled = true; - - mutex_unlock(&glc->mutex); -} - -static int -gpio_latch_get(struct gpio_chip *gc, unsigned offset) -{ - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); - int ret; - - gpio_latch_lock(glc, false); - ret = gpio_get_value(glc->gpios[offset]); - gpio_latch_unlock(glc, false); - - return ret; -} - -static void -gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value) -{ - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); - bool enable_latch = false; - bool disable_latch = false; - int gpio; - - gpio = glc->gpios[offset]; - - if (gpio == glc->le_gpio) { - enable_latch = value ^ glc->le_active_low; - disable_latch = !enable_latch; - } - - gpio_latch_lock(glc, enable_latch); - gpio_set_value(gpio, value); - gpio_latch_unlock(glc, disable_latch); -} - -static int -gpio_latch_direction_input(struct gpio_chip *gc, unsigned offset) -{ - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); - int ret; - - gpio_latch_lock(glc, false); - ret = gpio_direction_input(glc->gpios[offset]); - gpio_latch_unlock(glc, false); - - return ret; -} - -static int -gpio_latch_direction_output(struct gpio_chip *gc, unsigned offset, int value) -{ - struct gpio_latch_chip *glc = to_gpio_latch_chip(gc); - bool enable_latch = false; - bool disable_latch = false; - int gpio; - int ret; - - gpio = glc->gpios[offset]; - - if (gpio == glc->le_gpio) { - enable_latch = value ^ glc->le_active_low; - disable_latch = !enable_latch; - } - - gpio_latch_lock(glc, enable_latch); - ret = gpio_direction_output(gpio, value); - gpio_latch_unlock(glc, disable_latch); - - return ret; -} - -static int gpio_latch_probe(struct platform_device *pdev) -{ - struct gpio_latch_chip *glc; - struct gpio_latch_platform_data *pdata; - struct gpio_chip *gc; - int size; - int ret; - int i; - - pdata = dev_get_platdata(&pdev->dev); - if (!pdata) - return -EINVAL; - - if (pdata->le_gpio_index >= pdata->num_gpios || - !pdata->num_gpios || - !pdata->gpios) - return -EINVAL; - - for (i = 0; i < pdata->num_gpios; i++) { - int gpio = pdata->gpios[i]; - - ret = devm_gpio_request(&pdev->dev, gpio, - GPIO_LATCH_DRIVER_NAME); - if (ret) - return ret; - } - - glc = devm_kzalloc(&pdev->dev, sizeof(*glc), GFP_KERNEL); - if (!glc) - return -ENOMEM; - - mutex_init(&glc->mutex); - mutex_init(&glc->latch_mutex); - - size = pdata->num_gpios * sizeof(glc->gpios[0]); - glc->gpios = devm_kzalloc(&pdev->dev, size , GFP_KERNEL); - if (!glc->gpios) - return -ENOMEM; - - memcpy(glc->gpios, pdata->gpios, size); - - glc->le_gpio = glc->gpios[pdata->le_gpio_index]; - glc->le_active_low = pdata->le_active_low; - - gc = &glc->gc; - - gc->label = GPIO_LATCH_DRIVER_NAME; - gc->base = pdata->base; - gc->can_sleep = true; - gc->ngpio = pdata->num_gpios; - gc->get = gpio_latch_get; - gc->set = gpio_latch_set; - gc->direction_input = gpio_latch_direction_input, - gc->direction_output = gpio_latch_direction_output; - - platform_set_drvdata(pdev, glc); - - ret = gpiochip_add(&glc->gc); - if (ret) - return ret; - - return 0; -} - -static int gpio_latch_remove(struct platform_device *pdev) -{ - struct gpio_latch_chip *glc = platform_get_drvdata(pdev); - - gpiochip_remove(&glc->gc); - return 0; -} - - -static struct platform_driver gpio_latch_driver = { - .probe = gpio_latch_probe, - .remove = gpio_latch_remove, - .driver = { - .name = GPIO_LATCH_DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init gpio_latch_init(void) -{ - return platform_driver_register(&gpio_latch_driver); -} - -postcore_initcall(gpio_latch_init); - -MODULE_DESCRIPTION("GPIO latch driver"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:" GPIO_LATCH_DRIVER_NAME); diff --git a/target/linux/ar71xx/files-4.9/drivers/gpio/gpio-nxp-74hc153.c b/target/linux/ar71xx/files-4.9/drivers/gpio/gpio-nxp-74hc153.c deleted file mode 100644 index 82e6e943f..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/gpio/gpio-nxp-74hc153.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * NXP 74HC153 - Dual 4-input multiplexer GPIO driver - * - * Copyright (C) 2010 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define NXP_74HC153_NUM_GPIOS 8 -#define NXP_74HC153_S0_MASK 0x1 -#define NXP_74HC153_S1_MASK 0x2 -#define NXP_74HC153_BANK_MASK 0x4 - -struct nxp_74hc153_chip { - struct device *parent; - struct gpio_chip gpio_chip; - struct mutex lock; -}; - -static struct nxp_74hc153_chip *gpio_to_nxp(struct gpio_chip *gc) -{ - return container_of(gc, struct nxp_74hc153_chip, gpio_chip); -} - -static int nxp_74hc153_direction_input(struct gpio_chip *gc, unsigned offset) -{ - return 0; -} - -static int nxp_74hc153_direction_output(struct gpio_chip *gc, - unsigned offset, int val) -{ - return -EINVAL; -} - -static int nxp_74hc153_get_value(struct gpio_chip *gc, unsigned offset) -{ - struct nxp_74hc153_chip *nxp; - struct nxp_74hc153_platform_data *pdata; - unsigned s0; - unsigned s1; - unsigned pin; - int ret; - - nxp = gpio_to_nxp(gc); - pdata = nxp->parent->platform_data; - - s0 = !!(offset & NXP_74HC153_S0_MASK); - s1 = !!(offset & NXP_74HC153_S1_MASK); - pin = (offset & NXP_74HC153_BANK_MASK) ? pdata->gpio_pin_2y - : pdata->gpio_pin_1y; - - mutex_lock(&nxp->lock); - gpio_set_value(pdata->gpio_pin_s0, s0); - gpio_set_value(pdata->gpio_pin_s1, s1); - ret = gpio_get_value(pin); - mutex_unlock(&nxp->lock); - - return ret; -} - -static void nxp_74hc153_set_value(struct gpio_chip *gc, - unsigned offset, int val) -{ - /* not supported */ -} - -static int nxp_74hc153_probe(struct platform_device *pdev) -{ - struct nxp_74hc153_platform_data *pdata; - struct nxp_74hc153_chip *nxp; - struct gpio_chip *gc; - int err; - - pdata = pdev->dev.platform_data; - if (pdata == NULL) { - dev_dbg(&pdev->dev, "no platform data specified\n"); - return -EINVAL; - } - - nxp = kzalloc(sizeof(struct nxp_74hc153_chip), GFP_KERNEL); - if (nxp == NULL) { - dev_err(&pdev->dev, "no memory for private data\n"); - return -ENOMEM; - } - - err = gpio_request(pdata->gpio_pin_s0, dev_name(&pdev->dev)); - if (err) { - dev_err(&pdev->dev, "unable to claim gpio %u, err=%d\n", - pdata->gpio_pin_s0, err); - goto err_free_nxp; - } - - err = gpio_request(pdata->gpio_pin_s1, dev_name(&pdev->dev)); - if (err) { - dev_err(&pdev->dev, "unable to claim gpio %u, err=%d\n", - pdata->gpio_pin_s1, err); - goto err_free_s0; - } - - err = gpio_request(pdata->gpio_pin_1y, dev_name(&pdev->dev)); - if (err) { - dev_err(&pdev->dev, "unable to claim gpio %u, err=%d\n", - pdata->gpio_pin_1y, err); - goto err_free_s1; - } - - err = gpio_request(pdata->gpio_pin_2y, dev_name(&pdev->dev)); - if (err) { - dev_err(&pdev->dev, "unable to claim gpio %u, err=%d\n", - pdata->gpio_pin_2y, err); - goto err_free_1y; - } - - err = gpio_direction_output(pdata->gpio_pin_s0, 0); - if (err) { - dev_err(&pdev->dev, - "unable to set direction of gpio %u, err=%d\n", - pdata->gpio_pin_s0, err); - goto err_free_2y; - } - - err = gpio_direction_output(pdata->gpio_pin_s1, 0); - if (err) { - dev_err(&pdev->dev, - "unable to set direction of gpio %u, err=%d\n", - pdata->gpio_pin_s1, err); - goto err_free_2y; - } - - err = gpio_direction_input(pdata->gpio_pin_1y); - if (err) { - dev_err(&pdev->dev, - "unable to set direction of gpio %u, err=%d\n", - pdata->gpio_pin_1y, err); - goto err_free_2y; - } - - err = gpio_direction_input(pdata->gpio_pin_2y); - if (err) { - dev_err(&pdev->dev, - "unable to set direction of gpio %u, err=%d\n", - pdata->gpio_pin_2y, err); - goto err_free_2y; - } - - nxp->parent = &pdev->dev; - mutex_init(&nxp->lock); - - gc = &nxp->gpio_chip; - - gc->direction_input = nxp_74hc153_direction_input; - gc->direction_output = nxp_74hc153_direction_output; - gc->get = nxp_74hc153_get_value; - gc->set = nxp_74hc153_set_value; - gc->can_sleep = 1; - - gc->base = pdata->gpio_base; - gc->ngpio = NXP_74HC153_NUM_GPIOS; - gc->label = dev_name(nxp->parent); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - gc->dev = nxp->parent; -#else - gc->parent = nxp->parent; -#endif - gc->owner = THIS_MODULE; - - err = gpiochip_add(&nxp->gpio_chip); - if (err) { - dev_err(&pdev->dev, "unable to add gpio chip, err=%d\n", err); - goto err_free_2y; - } - - platform_set_drvdata(pdev, nxp); - return 0; - -err_free_2y: - gpio_free(pdata->gpio_pin_2y); -err_free_1y: - gpio_free(pdata->gpio_pin_1y); -err_free_s1: - gpio_free(pdata->gpio_pin_s1); -err_free_s0: - gpio_free(pdata->gpio_pin_s0); -err_free_nxp: - kfree(nxp); - return err; -} - -static int nxp_74hc153_remove(struct platform_device *pdev) -{ - struct nxp_74hc153_chip *nxp = platform_get_drvdata(pdev); - struct nxp_74hc153_platform_data *pdata = pdev->dev.platform_data; - - if (nxp) { - gpiochip_remove(&nxp->gpio_chip); - gpio_free(pdata->gpio_pin_2y); - gpio_free(pdata->gpio_pin_1y); - gpio_free(pdata->gpio_pin_s1); - gpio_free(pdata->gpio_pin_s0); - - kfree(nxp); - platform_set_drvdata(pdev, NULL); - } - - return 0; -} - -static struct platform_driver nxp_74hc153_driver = { - .probe = nxp_74hc153_probe, - .remove = nxp_74hc153_remove, - .driver = { - .name = NXP_74HC153_DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init nxp_74hc153_init(void) -{ - return platform_driver_register(&nxp_74hc153_driver); -} -subsys_initcall(nxp_74hc153_init); - -static void __exit nxp_74hc153_exit(void) -{ - platform_driver_unregister(&nxp_74hc153_driver); -} -module_exit(nxp_74hc153_exit); - -MODULE_AUTHOR("Gabor Juhos "); -MODULE_DESCRIPTION("GPIO expander driver for NXP 74HC153"); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:" NXP_74HC153_DRIVER_NAME); diff --git a/target/linux/ar71xx/files-4.9/drivers/leds/leds-nu801.c b/target/linux/ar71xx/files-4.9/drivers/leds/leds-nu801.c deleted file mode 100644 index 11e892778..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/leds/leds-nu801.c +++ /dev/null @@ -1,396 +0,0 @@ -/* - * LED driver for NU801 - * - * Kevin Paul Herbert - * Copyright (c) 2012, Meraki, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define MAX_NAME_LENGTH 24 -#define NUM_COLORS 3 - -static const char * const led_nu801_colors[] = { "blue", "green", "red" }; - -struct led_nu801_led_data { - struct led_classdev cdev; - struct led_nu801_data *controller; - enum led_brightness level; - char name[MAX_NAME_LENGTH]; -}; - -struct led_nu801_data { - unsigned cki; - unsigned sdi; - int lei; - struct delayed_work work; - struct led_nu801_led_data *led_chain; - int num_leds; - const char *device_name; - const char *name; - u32 ndelay; - atomic_t pending; -}; - -static void led_nu801_work(struct work_struct *work) -{ - struct led_nu801_data *controller = - container_of(work, struct led_nu801_data, work.work); - struct led_nu801_led_data *led; - u16 bit; - u16 brightness; - int index; - - for (index = 0; index < controller->num_leds; index++) { - led = &controller->led_chain[index]; - brightness = led->level << 8; /* To do: gamma correction */ - for (bit = 0x8000; bit; bit = bit >> 1) { - gpio_set_value(controller->sdi, - (brightness & bit) != 0); - gpio_set_value(controller->cki, 1); - if (unlikely(((index == (controller->num_leds - 1)) && - (bit == 1) && - (controller->lei < 0)))) { - udelay(600); - } else { - ndelay(controller->ndelay); - } - gpio_set_value(controller->cki, 0); - ndelay(controller->ndelay); - } - } - if (controller->lei >= 0) { - gpio_set_value(controller->lei, 1); - ndelay(controller->ndelay); - gpio_set_value(controller->lei, 0); - } - atomic_set(&controller->pending, 1); -} - -static void led_nu801_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - struct led_nu801_led_data *led_dat = - container_of(led_cdev, struct led_nu801_led_data, cdev); - struct led_nu801_data *controller = led_dat->controller; - - if (led_dat->level != value) { - led_dat->level = value; - if (atomic_dec_and_test(&controller->pending)) - schedule_delayed_work(&led_dat->controller->work, - (HZ/1000) + 1); - } -} - -static int led_nu801_create(struct led_nu801_data *controller, - struct device *parent, - int index, - enum led_brightness brightness, -#ifdef CONFIG_LEDS_TRIGGERS - const char *default_trigger, -#endif - const char *color) -{ - struct led_nu801_led_data *led = &controller->led_chain[index]; - int ret; - - scnprintf(led->name, sizeof(led->name), "%s:%s:%s%d", - controller->device_name, color, controller->name, - (controller->num_leds - (index + 1)) / NUM_COLORS); - led->cdev.name = led->name; - led->cdev.brightness_set = led_nu801_set; -#ifdef CONFIG_LEDS_TRIGGERS - led->cdev.default_trigger = default_trigger; -#endif - led->level = brightness; - led->controller = controller; - ret = led_classdev_register(parent, &led->cdev); - if (ret < 0) - goto err; - - return 0; - -err: - kfree(led); - return ret; -} - -static int -led_nu801_create_chain(const struct led_nu801_template *template, - struct led_nu801_data *controller, - struct device *parent) -{ - int ret; - int index; - - controller->cki = template->cki; - controller->sdi = template->sdi; - controller->lei = template->lei; - controller->num_leds = template->num_leds * 3; - controller->device_name = template->device_name; - controller->name = template->name; - controller->ndelay = template->ndelay; - atomic_set(&controller->pending, 1); - - controller->led_chain = kzalloc(sizeof(struct led_nu801_led_data) * - controller->num_leds, GFP_KERNEL); - - if (!controller->led_chain) - return -ENOMEM; - - ret = gpio_request(controller->cki, template->name); - if (ret < 0) - goto err_free_chain; - - ret = gpio_request(controller->sdi, template->name); - if (ret < 0) - goto err_ret_cki; - - if (controller->lei >= 0) { - ret = gpio_request(controller->lei, template->name); - if (ret < 0) - goto err_ret_sdi; - ret = gpio_direction_output(controller->lei, 0); - if (ret < 0) - goto err_ret_lei; - } - - ret = gpio_direction_output(controller->cki, 0); - if (ret < 0) - goto err_ret_lei; - - ret = gpio_direction_output(controller->sdi, 0); - if (ret < 0) - goto err_ret_lei; - - for (index = 0; index < controller->num_leds; index++) { - ret = led_nu801_create(controller, parent, index, - template->init_brightness - [index % NUM_COLORS], -#ifdef CONFIG_LEDS_TRIGGERS - template->default_trigger, -#endif - template->led_colors[index % NUM_COLORS] ? - template->led_colors[index % NUM_COLORS] : - led_nu801_colors[index % NUM_COLORS]); - if (ret < 0) - goto err_ret_sdi; - } - - INIT_DELAYED_WORK(&controller->work, led_nu801_work); - schedule_delayed_work(&controller->work, 0); - - return 0; - -err_ret_lei: - if (controller->lei >= 0) - gpio_free(controller->lei); -err_ret_sdi: - gpio_free(controller->sdi); -err_ret_cki: - gpio_free(controller->cki); -err_free_chain: - kfree(controller->led_chain); - - return ret; -} - -static void led_nu801_delete_chain(struct led_nu801_data *controller) -{ - struct led_nu801_led_data *led_chain; - struct led_nu801_led_data *led; - int index; - int num_leds; - - led_chain = controller->led_chain; - controller->led_chain = 0; - num_leds = controller->num_leds; - controller->num_leds = 0; - cancel_delayed_work_sync(&controller->work); - - for (index = 0; index < num_leds; index++) { - led = &led_chain[index]; - led_classdev_unregister(&led->cdev); - } - - gpio_free(controller->cki); - gpio_free(controller->sdi); - if (controller->lei >= 0) - gpio_free(controller->lei); - - kfree(led_chain); -} - -static struct led_nu801_data * -leds_nu801_create_of(struct platform_device *pdev) -{ - struct device_node *np = pdev->dev.of_node, *child; - struct led_nu801_data *controllers; - int count = 0, ret; - int i = 0; - - for_each_child_of_node(np, child) - count++; - if (!count) - return NULL; - - controllers = kzalloc(sizeof(struct led_nu801_data) * count, - GFP_KERNEL); - if (!controllers) - return NULL; - - for_each_child_of_node(np, child) { - const char *state; - struct led_nu801_template template = {}; - struct device_node *colors; - int jj; - - template.cki = of_get_named_gpio_flags(child, "cki", 0, NULL); - template.sdi = of_get_named_gpio_flags(child, "sdi", 0, NULL); - if (of_find_property(child, "lei", NULL)) { - template.lei = of_get_named_gpio_flags(child, "lei", - 0, NULL); - } else { - template.lei = -1; - } - of_property_read_u32(child, "ndelay", &template.ndelay); - of_property_read_u32(child, "num_leds", &template.num_leds); - template.name = of_get_property(child, "label", NULL) ? : - child->name; - template.default_trigger = of_get_property(child, - "default-trigger", NULL); - - jj = 0; - for_each_child_of_node(child, colors) { - template.led_colors[jj] = of_get_property(colors, - "label", NULL); - state = of_get_property(colors, "state", NULL); - if (!strncmp(state, "off", 3)) - template.init_brightness[jj] = LED_OFF; - else if (!strncmp(state, "half", 4)) - template.init_brightness[jj] = LED_HALF; - else if (!strncmp(state, "full", 4)) - template.init_brightness[jj] = LED_FULL; - jj++; - } - - ret = led_nu801_create_chain(&template, - &controllers[i], - &pdev->dev); - if (ret < 0) - goto err; - i++; - } - - return controllers; - -err: - for (i = i - 1; i >= 0; i--) - led_nu801_delete_chain(&controllers[i]); - kfree(controllers); - return NULL; -} - -static int led_nu801_probe(struct platform_device *pdev) -{ - struct led_nu801_platform_data *pdata = pdev->dev.platform_data; - struct led_nu801_data *controllers; - int i, ret = 0; - - if (!(pdata && pdata->num_controllers)) { - controllers = leds_nu801_create_of(pdev); - if (!controllers) - return -ENODEV; - } - - controllers = kzalloc(sizeof(struct led_nu801_data) * - pdata->num_controllers, GFP_KERNEL); - if (!controllers) - return -ENOMEM; - - for (i = 0; i < pdata->num_controllers; i++) { - ret = led_nu801_create_chain(&pdata->template[i], - &controllers[i], - &pdev->dev); - if (ret < 0) - goto err; - } - - platform_set_drvdata(pdev, controllers); - - return 0; - -err: - for (i = i - 1; i >= 0; i--) - led_nu801_delete_chain(&controllers[i]); - - kfree(controllers); - - return ret; -} - -static int led_nu801_remove(struct platform_device *pdev) -{ - int i; - struct led_nu801_platform_data *pdata = pdev->dev.platform_data; - struct led_nu801_data *controllers; - - controllers = platform_get_drvdata(pdev); - - for (i = 0; i < pdata->num_controllers; i++) - led_nu801_delete_chain(&controllers[i]); - - kfree(controllers); - - return 0; -} - -static const struct of_device_id of_numen_leds_match[] = { - { .compatible = "numen,leds-nu801", }, - {}, -}; -MODULE_DEVICE_TABLE(of, of_pwm_leds_match); - -static struct platform_driver led_nu801_driver = { - .probe = led_nu801_probe, - .remove = led_nu801_remove, - .driver = { - .name = "leds-nu801", - .owner = THIS_MODULE, - .of_match_table = of_numen_leds_match, - }, -}; - -static int __init led_nu801_init(void) -{ - return platform_driver_register(&led_nu801_driver); -} - -static void __exit led_nu801_exit(void) -{ - platform_driver_unregister(&led_nu801_driver); -} - -module_init(led_nu801_init); -module_exit(led_nu801_exit); - -MODULE_AUTHOR("Kevin Paul Herbert "); -MODULE_DESCRIPTION("NU801 LED driver"); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:leds-nu801"); diff --git a/target/linux/ar71xx/files-4.9/drivers/leds/leds-rb750.c b/target/linux/ar71xx/files-4.9/drivers/leds/leds-rb750.c deleted file mode 100644 index 79e98b488..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/leds/leds-rb750.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * LED driver for the RouterBOARD 750 - * - * Copyright (C) 2010 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ -#include -#include -#include -#include -#include -#include - -#include - -#define DRV_NAME "leds-rb750" - -struct rb750_led_dev { - struct led_classdev cdev; - u32 mask; - int active_low; - void (*latch_change)(u32 clear, u32 set); -}; - -struct rb750_led_drvdata { - struct rb750_led_dev *led_devs; - int num_leds; -}; - -static inline struct rb750_led_dev *to_rbled(struct led_classdev *led_cdev) -{ - return (struct rb750_led_dev *)container_of(led_cdev, - struct rb750_led_dev, cdev); -} - -static void rb750_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness value) -{ - struct rb750_led_dev *rbled = to_rbled(led_cdev); - int level; - - level = (value == LED_OFF) ? 0 : 1; - level ^= rbled->active_low; - - if (level) - rbled->latch_change(0, rbled->mask); - else - rbled->latch_change(rbled->mask, 0); -} - -static int rb750_led_probe(struct platform_device *pdev) -{ - struct rb750_led_platform_data *pdata; - struct rb750_led_drvdata *drvdata; - int ret = 0; - int i; - - pdata = pdev->dev.platform_data; - if (!pdata) - return -EINVAL; - - drvdata = kzalloc(sizeof(struct rb750_led_drvdata) + - sizeof(struct rb750_led_dev) * pdata->num_leds, - GFP_KERNEL); - if (!drvdata) - return -ENOMEM; - - drvdata->num_leds = pdata->num_leds; - drvdata->led_devs = (struct rb750_led_dev *) &drvdata[1]; - - for (i = 0; i < drvdata->num_leds; i++) { - struct rb750_led_dev *rbled = &drvdata->led_devs[i]; - struct rb750_led_data *led_data = &pdata->leds[i]; - - rbled->cdev.name = led_data->name; - rbled->cdev.default_trigger = led_data->default_trigger; - rbled->cdev.brightness_set = rb750_led_brightness_set; - rbled->cdev.brightness = LED_OFF; - - rbled->mask = led_data->mask; - rbled->active_low = !!led_data->active_low; - rbled->latch_change = pdata->latch_change; - - ret = led_classdev_register(&pdev->dev, &rbled->cdev); - if (ret) - goto err; - } - - platform_set_drvdata(pdev, drvdata); - return 0; - -err: - for (i = i - 1; i >= 0; i--) - led_classdev_unregister(&drvdata->led_devs[i].cdev); - - kfree(drvdata); - return ret; -} - -static int rb750_led_remove(struct platform_device *pdev) -{ - struct rb750_led_drvdata *drvdata; - int i; - - drvdata = platform_get_drvdata(pdev); - for (i = 0; i < drvdata->num_leds; i++) - led_classdev_unregister(&drvdata->led_devs[i].cdev); - - kfree(drvdata); - return 0; -} - -static struct platform_driver rb750_led_driver = { - .probe = rb750_led_probe, - .remove = rb750_led_remove, - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, -}; - -MODULE_ALIAS("platform:leds-rb750"); - -static int __init rb750_led_init(void) -{ - return platform_driver_register(&rb750_led_driver); -} - -static void __exit rb750_led_exit(void) -{ - platform_driver_unregister(&rb750_led_driver); -} - -module_init(rb750_led_init); -module_exit(rb750_led_exit); - -MODULE_DESCRIPTION(DRV_NAME); -MODULE_DESCRIPTION("LED driver for the RouterBOARD 750"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ar71xx/files-4.9/drivers/leds/leds-wndr3700-usb.c b/target/linux/ar71xx/files-4.9/drivers/leds/leds-wndr3700-usb.c deleted file mode 100644 index 6425b055d..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/leds/leds-wndr3700-usb.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * USB LED driver for the NETGEAR WNDR3700 - * - * 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 - -#define DRIVER_NAME "wndr3700-led-usb" - -static void wndr3700_usb_led_set(struct led_classdev *cdev, - enum led_brightness brightness) -{ - if (brightness) - ath79_device_reset_clear(AR71XX_RESET_GE1_PHY); - else - ath79_device_reset_set(AR71XX_RESET_GE1_PHY); -} - -static enum led_brightness wndr3700_usb_led_get(struct led_classdev *cdev) -{ - return ath79_device_reset_get(AR71XX_RESET_GE1_PHY) ? LED_OFF : LED_FULL; -} - -static struct led_classdev wndr3700_usb_led = { - .name = "netgear:green:usb", - .brightness_set = wndr3700_usb_led_set, - .brightness_get = wndr3700_usb_led_get, -}; - -static int wndr3700_usb_led_probe(struct platform_device *pdev) -{ - return led_classdev_register(&pdev->dev, &wndr3700_usb_led); -} - -static int wndr3700_usb_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&wndr3700_usb_led); - return 0; -} - -static struct platform_driver wndr3700_usb_led_driver = { - .probe = wndr3700_usb_led_probe, - .remove = wndr3700_usb_led_remove, - .driver = { - .name = DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init wndr3700_usb_led_init(void) -{ - return platform_driver_register(&wndr3700_usb_led_driver); -} - -static void __exit wndr3700_usb_led_exit(void) -{ - platform_driver_unregister(&wndr3700_usb_led_driver); -} - -module_init(wndr3700_usb_led_init); -module_exit(wndr3700_usb_led_exit); - -MODULE_DESCRIPTION("USB LED driver for the NETGEAR WNDR3700"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:" DRIVER_NAME); diff --git a/target/linux/ar71xx/files-4.9/drivers/mtd/cybertan_part.c b/target/linux/ar71xx/files-4.9/drivers/mtd/cybertan_part.c deleted file mode 100644 index 4d33c19b7..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/mtd/cybertan_part.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (C) 2009 Christian Daniel - * 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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * TRX flash partition table. - * Based on ar7 map by Felix Fietkau - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -struct cybertan_header { - char magic[4]; - u8 res1[4]; - char fw_date[3]; - char fw_ver[3]; - char id[4]; - char hw_ver; - char unused; - u8 flags[2]; - u8 res2[10]; -}; - -#define TRX_PARTS 6 -#define TRX_MAGIC 0x30524448 -#define TRX_MAX_OFFSET 3 - -struct trx_header { - uint32_t magic; /* "HDR0" */ - uint32_t len; /* Length of file including header */ - uint32_t crc32; /* 32-bit CRC from flag_version to end of file */ - uint32_t flag_version; /* 0:15 flags, 16:31 version */ - uint32_t offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of header */ -}; - -#define IH_MAGIC 0x27051956 /* Image Magic Number */ -#define IH_NMLEN 32 /* Image Name Length */ - -struct uimage_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 */ -}; - -struct firmware_header { - struct cybertan_header cybertan; - struct trx_header trx; - struct uimage_header uimage; -} __packed; - -#define UBOOT_LEN 0x40000 -#define ART_LEN 0x10000 -#define NVRAM_LEN 0x10000 - -static int cybertan_parse_partitions(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data) -{ - struct firmware_header *header; - struct trx_header *theader; - struct uimage_header *uheader; - struct mtd_partition *trx_parts; - size_t retlen; - unsigned int kernel_len; - unsigned int uboot_len; - unsigned int nvram_len; - unsigned int art_len; - int ret; - - uboot_len = max_t(unsigned int, master->erasesize, UBOOT_LEN); - nvram_len = max_t(unsigned int, master->erasesize, NVRAM_LEN); - art_len = max_t(unsigned int, master->erasesize, ART_LEN); - - trx_parts = kzalloc(TRX_PARTS * sizeof(struct mtd_partition), - GFP_KERNEL); - if (!trx_parts) { - ret = -ENOMEM; - goto out; - } - - header = vmalloc(sizeof(*header)); - if (!header) { - return -ENOMEM; - goto free_parts; - } - - ret = mtd_read(master, uboot_len, sizeof(*header), - &retlen, (void *) header); - if (ret) - goto free_hdr; - - if (retlen != sizeof(*header)) { - ret = -EIO; - goto free_hdr; - } - - theader = &header->trx; - if (le32_to_cpu(theader->magic) != TRX_MAGIC) { - printk(KERN_NOTICE "%s: no TRX header found\n", master->name); - goto free_hdr; - } - - uheader = &header->uimage; - if (uheader->ih_magic != IH_MAGIC) { - printk(KERN_NOTICE "%s: no uImage found\n", master->name); - goto free_hdr; - } - - kernel_len = le32_to_cpu(theader->offsets[1]) + - sizeof(struct cybertan_header); - - trx_parts[0].name = "u-boot"; - trx_parts[0].offset = 0; - trx_parts[0].size = uboot_len; - trx_parts[0].mask_flags = MTD_WRITEABLE; - - trx_parts[1].name = "kernel"; - trx_parts[1].offset = trx_parts[0].offset + trx_parts[0].size; - trx_parts[1].size = kernel_len; - trx_parts[1].mask_flags = 0; - - trx_parts[2].name = "rootfs"; - trx_parts[2].offset = trx_parts[1].offset + trx_parts[1].size; - trx_parts[2].size = master->size - uboot_len - nvram_len - art_len - - trx_parts[1].size; - trx_parts[2].mask_flags = 0; - - trx_parts[3].name = "nvram"; - trx_parts[3].offset = master->size - nvram_len - art_len; - trx_parts[3].size = nvram_len; - trx_parts[3].mask_flags = MTD_WRITEABLE; - - trx_parts[4].name = "art"; - trx_parts[4].offset = master->size - art_len; - trx_parts[4].size = art_len; - trx_parts[4].mask_flags = MTD_WRITEABLE; - - trx_parts[5].name = "firmware"; - trx_parts[5].offset = uboot_len; - trx_parts[5].size = master->size - uboot_len - nvram_len - art_len; - trx_parts[5].mask_flags = 0; - - vfree(header); - - *pparts = trx_parts; - return TRX_PARTS; - -free_hdr: - vfree(header); -free_parts: - kfree(trx_parts); -out: - return ret; -} - -static struct mtd_part_parser cybertan_parser = { - .owner = THIS_MODULE, - .parse_fn = cybertan_parse_partitions, - .name = "cybertan", -}; - -static int __init cybertan_parser_init(void) -{ - register_mtd_parser(&cybertan_parser); - - return 0; -} - -module_init(cybertan_parser_init); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Christian Daniel "); diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/Kconfig b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/Kconfig deleted file mode 100644 index 42d544f73..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/Kconfig +++ /dev/null @@ -1,33 +0,0 @@ -config AG71XX - tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support" - depends on ATH79 - select PHYLIB - help - If you wish to compile a kernel for AR7XXX/91XXX and enable - ethernet support, then you should always answer Y to this. - -if AG71XX - -config AG71XX_DEBUG - bool "Atheros AR71xx built-in ethernet driver debugging" - default n - help - Atheros AR71xx built-in ethernet driver debugging messages. - -config AG71XX_DEBUG_FS - bool "Atheros AR71xx built-in ethernet driver debugfs support" - depends on DEBUG_FS - default n - help - Say Y, if you need access to various statistics provided by - the ag71xx driver. - -config AG71XX_AR8216_SUPPORT - bool "special support for the Atheros AR8216 switch" - default n - default y if ATH79_MACH_WNR2000 || ATH79_MACH_MZK_W04NU - help - Say 'y' here if you want to enable special support for the - Atheros AR8216 switch found on some boards. - -endif diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/Makefile b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/Makefile deleted file mode 100644 index b3ec4084c..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# -# Makefile for the Atheros AR71xx built-in ethernet macs -# - -ag71xx-y += ag71xx_main.o -ag71xx-y += ag71xx_ethtool.o -ag71xx-y += ag71xx_phy.o -ag71xx-y += ag71xx_mdio.o -ag71xx-y += ag71xx_ar7240.o - -ag71xx-$(CONFIG_AG71XX_DEBUG_FS) += ag71xx_debugfs.o -ag71xx-$(CONFIG_AG71XX_AR8216_SUPPORT) += ag71xx_ar8216.o - -obj-$(CONFIG_AG71XX) += ag71xx.o - diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx.h deleted file mode 100644 index 77ee5b36e..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx.h +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 __AG71XX_H -#define __AG71XX_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#define AG71XX_DRV_NAME "ag71xx" -#define AG71XX_DRV_VERSION "0.5.35" - -/* - * For our NAPI weight bigger does *NOT* mean better - it means more - * D-cache misses and lots more wasted cycles than we'll ever - * possibly gain from saving instructions. - */ -#define AG71XX_NAPI_WEIGHT 32 -#define AG71XX_OOM_REFILL (1 + HZ/10) - -#define AG71XX_INT_ERR (AG71XX_INT_RX_BE | AG71XX_INT_TX_BE) -#define AG71XX_INT_TX (AG71XX_INT_TX_PS) -#define AG71XX_INT_RX (AG71XX_INT_RX_PR | AG71XX_INT_RX_OF) - -#define AG71XX_INT_POLL (AG71XX_INT_RX | AG71XX_INT_TX) -#define AG71XX_INT_INIT (AG71XX_INT_ERR | AG71XX_INT_POLL) - -#define AG71XX_TX_MTU_LEN 1540 - -#define AG71XX_TX_RING_SPLIT 512 -#define AG71XX_TX_RING_DS_PER_PKT DIV_ROUND_UP(AG71XX_TX_MTU_LEN, \ - AG71XX_TX_RING_SPLIT) -#define AG71XX_TX_RING_SIZE_DEFAULT 128 -#define AG71XX_RX_RING_SIZE_DEFAULT 256 - -#define AG71XX_TX_RING_SIZE_MAX 128 -#define AG71XX_RX_RING_SIZE_MAX 256 - -#ifdef CONFIG_AG71XX_DEBUG -#define DBG(fmt, args...) pr_debug(fmt, ## args) -#else -#define DBG(fmt, args...) do {} while (0) -#endif - -#define ag71xx_assert(_cond) \ -do { \ - if (_cond) \ - break; \ - printk("%s,%d: assertion failed\n", __FILE__, __LINE__); \ - BUG(); \ -} while (0) - -struct ag71xx_desc { - u32 data; - u32 ctrl; -#define DESC_EMPTY BIT(31) -#define DESC_MORE BIT(24) -#define DESC_PKTLEN_M 0xfff - u32 next; - u32 pad; -} __attribute__((aligned(4))); - -#define AG71XX_DESC_SIZE roundup(sizeof(struct ag71xx_desc), \ - L1_CACHE_BYTES) - -struct ag71xx_buf { - union { - struct sk_buff *skb; - void *rx_buf; - }; - union { - dma_addr_t dma_addr; - unsigned int len; - }; -}; - -struct ag71xx_ring { - struct ag71xx_buf *buf; - u8 *descs_cpu; - dma_addr_t descs_dma; - u16 desc_split; - u16 order; - unsigned int curr; - unsigned int dirty; -}; - -struct ag71xx_mdio { - struct mii_bus *mii_bus; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - int mii_irq[PHY_MAX_ADDR]; -#endif - void __iomem *mdio_base; - struct ag71xx_mdio_platform_data *pdata; -}; - -struct ag71xx_int_stats { - unsigned long rx_pr; - unsigned long rx_be; - unsigned long rx_of; - unsigned long tx_ps; - unsigned long tx_be; - unsigned long tx_ur; - unsigned long total; -}; - -struct ag71xx_napi_stats { - unsigned long napi_calls; - unsigned long rx_count; - unsigned long rx_packets; - unsigned long rx_packets_max; - unsigned long tx_count; - unsigned long tx_packets; - unsigned long tx_packets_max; - - unsigned long rx[AG71XX_NAPI_WEIGHT + 1]; - unsigned long tx[AG71XX_NAPI_WEIGHT + 1]; -}; - -struct ag71xx_debug { - struct dentry *debugfs_dir; - - struct ag71xx_int_stats int_stats; - struct ag71xx_napi_stats napi_stats; -}; - -struct ag71xx { - /* - * Critical data related to the per-packet data path are clustered - * early in this structure to help improve the D-cache footprint. - */ - struct ag71xx_ring rx_ring ____cacheline_aligned; - struct ag71xx_ring tx_ring ____cacheline_aligned; - - unsigned int max_frame_len; - unsigned int desc_pktlen_mask; - unsigned int rx_buf_size; - - struct net_device *dev; - struct platform_device *pdev; - spinlock_t lock; - struct napi_struct napi; - u32 msg_enable; - - /* - * From this point onwards we're not looking at per-packet fields. - */ - void __iomem *mac_base; - - struct ag71xx_desc *stop_desc; - dma_addr_t stop_desc_dma; - - struct mii_bus *mii_bus; - struct phy_device *phy_dev; - void *phy_priv; - - unsigned int link; - unsigned int speed; - int duplex; - - struct delayed_work restart_work; - struct delayed_work link_work; - struct timer_list oom_timer; - -#ifdef CONFIG_AG71XX_DEBUG_FS - struct ag71xx_debug debug; -#endif -}; - -extern struct ethtool_ops ag71xx_ethtool_ops; -void ag71xx_link_adjust(struct ag71xx *ag); - -int ag71xx_mdio_driver_init(void) __init; -void ag71xx_mdio_driver_exit(void); - -int ag71xx_phy_connect(struct ag71xx *ag); -void ag71xx_phy_disconnect(struct ag71xx *ag); -void ag71xx_phy_start(struct ag71xx *ag); -void ag71xx_phy_stop(struct ag71xx *ag); - -static inline struct ag71xx_platform_data *ag71xx_get_pdata(struct ag71xx *ag) -{ - return ag->pdev->dev.platform_data; -} - -static inline int ag71xx_desc_empty(struct ag71xx_desc *desc) -{ - return (desc->ctrl & DESC_EMPTY) != 0; -} - -static inline struct ag71xx_desc * -ag71xx_ring_desc(struct ag71xx_ring *ring, int idx) -{ - return (struct ag71xx_desc *) &ring->descs_cpu[idx * AG71XX_DESC_SIZE]; -} - -static inline int -ag71xx_ring_size_order(int size) -{ - return fls(size - 1); -} - -/* Register offsets */ -#define AG71XX_REG_MAC_CFG1 0x0000 -#define AG71XX_REG_MAC_CFG2 0x0004 -#define AG71XX_REG_MAC_IPG 0x0008 -#define AG71XX_REG_MAC_HDX 0x000c -#define AG71XX_REG_MAC_MFL 0x0010 -#define AG71XX_REG_MII_CFG 0x0020 -#define AG71XX_REG_MII_CMD 0x0024 -#define AG71XX_REG_MII_ADDR 0x0028 -#define AG71XX_REG_MII_CTRL 0x002c -#define AG71XX_REG_MII_STATUS 0x0030 -#define AG71XX_REG_MII_IND 0x0034 -#define AG71XX_REG_MAC_IFCTL 0x0038 -#define AG71XX_REG_MAC_ADDR1 0x0040 -#define AG71XX_REG_MAC_ADDR2 0x0044 -#define AG71XX_REG_FIFO_CFG0 0x0048 -#define AG71XX_REG_FIFO_CFG1 0x004c -#define AG71XX_REG_FIFO_CFG2 0x0050 -#define AG71XX_REG_FIFO_CFG3 0x0054 -#define AG71XX_REG_FIFO_CFG4 0x0058 -#define AG71XX_REG_FIFO_CFG5 0x005c -#define AG71XX_REG_FIFO_RAM0 0x0060 -#define AG71XX_REG_FIFO_RAM1 0x0064 -#define AG71XX_REG_FIFO_RAM2 0x0068 -#define AG71XX_REG_FIFO_RAM3 0x006c -#define AG71XX_REG_FIFO_RAM4 0x0070 -#define AG71XX_REG_FIFO_RAM5 0x0074 -#define AG71XX_REG_FIFO_RAM6 0x0078 -#define AG71XX_REG_FIFO_RAM7 0x007c - -#define AG71XX_REG_TX_CTRL 0x0180 -#define AG71XX_REG_TX_DESC 0x0184 -#define AG71XX_REG_TX_STATUS 0x0188 -#define AG71XX_REG_RX_CTRL 0x018c -#define AG71XX_REG_RX_DESC 0x0190 -#define AG71XX_REG_RX_STATUS 0x0194 -#define AG71XX_REG_INT_ENABLE 0x0198 -#define AG71XX_REG_INT_STATUS 0x019c - -#define AG71XX_REG_FIFO_DEPTH 0x01a8 -#define AG71XX_REG_RX_SM 0x01b0 -#define AG71XX_REG_TX_SM 0x01b4 - -#define MAC_CFG1_TXE BIT(0) /* Tx Enable */ -#define MAC_CFG1_STX BIT(1) /* Synchronize Tx Enable */ -#define MAC_CFG1_RXE BIT(2) /* Rx Enable */ -#define MAC_CFG1_SRX BIT(3) /* Synchronize Rx Enable */ -#define MAC_CFG1_TFC BIT(4) /* Tx Flow Control Enable */ -#define MAC_CFG1_RFC BIT(5) /* Rx Flow Control Enable */ -#define MAC_CFG1_LB BIT(8) /* Loopback mode */ -#define MAC_CFG1_SR BIT(31) /* Soft Reset */ - -#define MAC_CFG2_FDX BIT(0) -#define MAC_CFG2_CRC_EN BIT(1) -#define MAC_CFG2_PAD_CRC_EN BIT(2) -#define MAC_CFG2_LEN_CHECK BIT(4) -#define MAC_CFG2_HUGE_FRAME_EN BIT(5) -#define MAC_CFG2_IF_1000 BIT(9) -#define MAC_CFG2_IF_10_100 BIT(8) - -#define FIFO_CFG0_WTM BIT(0) /* Watermark Module */ -#define FIFO_CFG0_RXS BIT(1) /* Rx System Module */ -#define FIFO_CFG0_RXF BIT(2) /* Rx Fabric Module */ -#define FIFO_CFG0_TXS BIT(3) /* Tx System Module */ -#define FIFO_CFG0_TXF BIT(4) /* Tx Fabric Module */ -#define FIFO_CFG0_ALL (FIFO_CFG0_WTM | FIFO_CFG0_RXS | FIFO_CFG0_RXF \ - | FIFO_CFG0_TXS | FIFO_CFG0_TXF) - -#define FIFO_CFG0_ENABLE_SHIFT 8 - -#define FIFO_CFG4_DE BIT(0) /* Drop Event */ -#define FIFO_CFG4_DV BIT(1) /* RX_DV Event */ -#define FIFO_CFG4_FC BIT(2) /* False Carrier */ -#define FIFO_CFG4_CE BIT(3) /* Code Error */ -#define FIFO_CFG4_CR BIT(4) /* CRC error */ -#define FIFO_CFG4_LM BIT(5) /* Length Mismatch */ -#define FIFO_CFG4_LO BIT(6) /* Length out of range */ -#define FIFO_CFG4_OK BIT(7) /* Packet is OK */ -#define FIFO_CFG4_MC BIT(8) /* Multicast Packet */ -#define FIFO_CFG4_BC BIT(9) /* Broadcast Packet */ -#define FIFO_CFG4_DR BIT(10) /* Dribble */ -#define FIFO_CFG4_LE BIT(11) /* Long Event */ -#define FIFO_CFG4_CF BIT(12) /* Control Frame */ -#define FIFO_CFG4_PF BIT(13) /* Pause Frame */ -#define FIFO_CFG4_UO BIT(14) /* Unsupported Opcode */ -#define FIFO_CFG4_VT BIT(15) /* VLAN tag detected */ -#define FIFO_CFG4_FT BIT(16) /* Frame Truncated */ -#define FIFO_CFG4_UC BIT(17) /* Unicast Packet */ - -#define FIFO_CFG5_DE BIT(0) /* Drop Event */ -#define FIFO_CFG5_DV BIT(1) /* RX_DV Event */ -#define FIFO_CFG5_FC BIT(2) /* False Carrier */ -#define FIFO_CFG5_CE BIT(3) /* Code Error */ -#define FIFO_CFG5_LM BIT(4) /* Length Mismatch */ -#define FIFO_CFG5_LO BIT(5) /* Length Out of Range */ -#define FIFO_CFG5_OK BIT(6) /* Packet is OK */ -#define FIFO_CFG5_MC BIT(7) /* Multicast Packet */ -#define FIFO_CFG5_BC BIT(8) /* Broadcast Packet */ -#define FIFO_CFG5_DR BIT(9) /* Dribble */ -#define FIFO_CFG5_CF BIT(10) /* Control Frame */ -#define FIFO_CFG5_PF BIT(11) /* Pause Frame */ -#define FIFO_CFG5_UO BIT(12) /* Unsupported Opcode */ -#define FIFO_CFG5_VT BIT(13) /* VLAN tag detected */ -#define FIFO_CFG5_LE BIT(14) /* Long Event */ -#define FIFO_CFG5_FT BIT(15) /* Frame Truncated */ -#define FIFO_CFG5_16 BIT(16) /* unknown */ -#define FIFO_CFG5_17 BIT(17) /* unknown */ -#define FIFO_CFG5_SF BIT(18) /* Short Frame */ -#define FIFO_CFG5_BM BIT(19) /* Byte Mode */ - -#define AG71XX_INT_TX_PS BIT(0) -#define AG71XX_INT_TX_UR BIT(1) -#define AG71XX_INT_TX_BE BIT(3) -#define AG71XX_INT_RX_PR BIT(4) -#define AG71XX_INT_RX_OF BIT(6) -#define AG71XX_INT_RX_BE BIT(7) - -#define MAC_IFCTL_SPEED BIT(16) - -#define MII_CFG_CLK_DIV_4 0 -#define MII_CFG_CLK_DIV_6 2 -#define MII_CFG_CLK_DIV_8 3 -#define MII_CFG_CLK_DIV_10 4 -#define MII_CFG_CLK_DIV_14 5 -#define MII_CFG_CLK_DIV_20 6 -#define MII_CFG_CLK_DIV_28 7 -#define MII_CFG_CLK_DIV_34 8 -#define MII_CFG_CLK_DIV_42 9 -#define MII_CFG_CLK_DIV_50 10 -#define MII_CFG_CLK_DIV_58 11 -#define MII_CFG_CLK_DIV_66 12 -#define MII_CFG_CLK_DIV_74 13 -#define MII_CFG_CLK_DIV_82 14 -#define MII_CFG_CLK_DIV_98 15 -#define MII_CFG_RESET BIT(31) - -#define MII_CMD_WRITE 0x0 -#define MII_CMD_READ 0x1 -#define MII_ADDR_SHIFT 8 -#define MII_IND_BUSY BIT(0) -#define MII_IND_INVALID BIT(2) - -#define TX_CTRL_TXE BIT(0) /* Tx Enable */ - -#define TX_STATUS_PS BIT(0) /* Packet Sent */ -#define TX_STATUS_UR BIT(1) /* Tx Underrun */ -#define TX_STATUS_BE BIT(3) /* Bus Error */ - -#define RX_CTRL_RXE BIT(0) /* Rx Enable */ - -#define RX_STATUS_PR BIT(0) /* Packet Received */ -#define RX_STATUS_OF BIT(2) /* Rx Overflow */ -#define RX_STATUS_BE BIT(3) /* Bus Error */ - -static inline void ag71xx_check_reg_offset(struct ag71xx *ag, unsigned reg) -{ - switch (reg) { - case AG71XX_REG_MAC_CFG1 ... AG71XX_REG_MAC_MFL: - case AG71XX_REG_MAC_IFCTL ... AG71XX_REG_TX_SM: - case AG71XX_REG_MII_CFG: - break; - - default: - BUG(); - } -} - -static inline void ag71xx_wr(struct ag71xx *ag, unsigned reg, u32 value) -{ - ag71xx_check_reg_offset(ag, reg); - - __raw_writel(value, ag->mac_base + reg); - /* flush write */ - (void) __raw_readl(ag->mac_base + reg); -} - -static inline u32 ag71xx_rr(struct ag71xx *ag, unsigned reg) -{ - ag71xx_check_reg_offset(ag, reg); - - return __raw_readl(ag->mac_base + reg); -} - -static inline void ag71xx_sb(struct ag71xx *ag, unsigned reg, u32 mask) -{ - void __iomem *r; - - ag71xx_check_reg_offset(ag, reg); - - r = ag->mac_base + reg; - __raw_writel(__raw_readl(r) | mask, r); - /* flush write */ - (void)__raw_readl(r); -} - -static inline void ag71xx_cb(struct ag71xx *ag, unsigned reg, u32 mask) -{ - void __iomem *r; - - ag71xx_check_reg_offset(ag, reg); - - r = ag->mac_base + reg; - __raw_writel(__raw_readl(r) & ~mask, r); - /* flush write */ - (void) __raw_readl(r); -} - -static inline void ag71xx_int_enable(struct ag71xx *ag, u32 ints) -{ - ag71xx_sb(ag, AG71XX_REG_INT_ENABLE, ints); -} - -static inline void ag71xx_int_disable(struct ag71xx *ag, u32 ints) -{ - ag71xx_cb(ag, AG71XX_REG_INT_ENABLE, ints); -} - -#ifdef CONFIG_AG71XX_AR8216_SUPPORT -void ag71xx_add_ar8216_header(struct ag71xx *ag, struct sk_buff *skb); -int ag71xx_remove_ar8216_header(struct ag71xx *ag, struct sk_buff *skb, - int pktlen); -static inline int ag71xx_has_ar8216(struct ag71xx *ag) -{ - return ag71xx_get_pdata(ag)->has_ar8216; -} -#else -static inline void ag71xx_add_ar8216_header(struct ag71xx *ag, - struct sk_buff *skb) -{ -} - -static inline int ag71xx_remove_ar8216_header(struct ag71xx *ag, - struct sk_buff *skb, - int pktlen) -{ - return 0; -} -static inline int ag71xx_has_ar8216(struct ag71xx *ag) -{ - return 0; -} -#endif - -#ifdef CONFIG_AG71XX_DEBUG_FS -int ag71xx_debugfs_root_init(void); -void ag71xx_debugfs_root_exit(void); -int ag71xx_debugfs_init(struct ag71xx *ag); -void ag71xx_debugfs_exit(struct ag71xx *ag); -void ag71xx_debugfs_update_int_stats(struct ag71xx *ag, u32 status); -void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, int rx, int tx); -#else -static inline int ag71xx_debugfs_root_init(void) { return 0; } -static inline void ag71xx_debugfs_root_exit(void) {} -static inline int ag71xx_debugfs_init(struct ag71xx *ag) { return 0; } -static inline void ag71xx_debugfs_exit(struct ag71xx *ag) {} -static inline void ag71xx_debugfs_update_int_stats(struct ag71xx *ag, - u32 status) {} -static inline void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, - int rx, int tx) {} -#endif /* CONFIG_AG71XX_DEBUG_FS */ - -void ag71xx_ar7240_start(struct ag71xx *ag); -void ag71xx_ar7240_stop(struct ag71xx *ag); -int ag71xx_ar7240_init(struct ag71xx *ag); -void ag71xx_ar7240_cleanup(struct ag71xx *ag); - -int ag71xx_mdio_mii_read(struct ag71xx_mdio *am, int addr, int reg); -void ag71xx_mdio_mii_write(struct ag71xx_mdio *am, int addr, int reg, u16 val); - -u16 ar7240sw_phy_read(struct mii_bus *mii, unsigned phy_addr, - unsigned reg_addr); -int ar7240sw_phy_write(struct mii_bus *mii, unsigned phy_addr, - unsigned reg_addr, u16 reg_val); - -#endif /* _AG71XX_H */ diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c deleted file mode 100644 index 3f2f64e2a..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c +++ /dev/null @@ -1,1382 +0,0 @@ -/* - * Driver for the built-in ethernet switch of the Atheros AR7240 SoC - * Copyright (c) 2010 Gabor Juhos - * Copyright (c) 2010 Felix Fietkau - * - * 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 "ag71xx.h" - -#define BITM(_count) (BIT(_count) - 1) -#define BITS(_shift, _count) (BITM(_count) << _shift) - -#define AR7240_REG_MASK_CTRL 0x00 -#define AR7240_MASK_CTRL_REVISION_M BITM(8) -#define AR7240_MASK_CTRL_VERSION_M BITM(8) -#define AR7240_MASK_CTRL_VERSION_S 8 -#define AR7240_MASK_CTRL_VERSION_AR7240 0x01 -#define AR7240_MASK_CTRL_VERSION_AR934X 0x02 -#define AR7240_MASK_CTRL_SOFT_RESET BIT(31) - -#define AR7240_REG_MAC_ADDR0 0x20 -#define AR7240_REG_MAC_ADDR1 0x24 - -#define AR7240_REG_FLOOD_MASK 0x2c -#define AR7240_FLOOD_MASK_BROAD_TO_CPU BIT(26) - -#define AR7240_REG_GLOBAL_CTRL 0x30 -#define AR7240_GLOBAL_CTRL_MTU_M BITM(11) -#define AR9340_GLOBAL_CTRL_MTU_M BITM(14) - -#define AR7240_REG_VTU 0x0040 -#define AR7240_VTU_OP BITM(3) -#define AR7240_VTU_OP_NOOP 0x0 -#define AR7240_VTU_OP_FLUSH 0x1 -#define AR7240_VTU_OP_LOAD 0x2 -#define AR7240_VTU_OP_PURGE 0x3 -#define AR7240_VTU_OP_REMOVE_PORT 0x4 -#define AR7240_VTU_ACTIVE BIT(3) -#define AR7240_VTU_FULL BIT(4) -#define AR7240_VTU_PORT BITS(8, 4) -#define AR7240_VTU_PORT_S 8 -#define AR7240_VTU_VID BITS(16, 12) -#define AR7240_VTU_VID_S 16 -#define AR7240_VTU_PRIO BITS(28, 3) -#define AR7240_VTU_PRIO_S 28 -#define AR7240_VTU_PRIO_EN BIT(31) - -#define AR7240_REG_VTU_DATA 0x0044 -#define AR7240_VTUDATA_MEMBER BITS(0, 10) -#define AR7240_VTUDATA_VALID BIT(11) - -#define AR7240_REG_ATU 0x50 -#define AR7240_ATU_FLUSH_ALL 0x1 - -#define AR7240_REG_AT_CTRL 0x5c -#define AR7240_AT_CTRL_AGE_TIME BITS(0, 15) -#define AR7240_AT_CTRL_AGE_EN BIT(17) -#define AR7240_AT_CTRL_LEARN_CHANGE BIT(18) -#define AR7240_AT_CTRL_RESERVED BIT(19) -#define AR7240_AT_CTRL_ARP_EN BIT(20) - -#define AR7240_REG_TAG_PRIORITY 0x70 - -#define AR7240_REG_SERVICE_TAG 0x74 -#define AR7240_SERVICE_TAG_M BITM(16) - -#define AR7240_REG_CPU_PORT 0x78 -#define AR7240_MIRROR_PORT_S 4 -#define AR7240_MIRROR_PORT_M BITM(4) -#define AR7240_CPU_PORT_EN BIT(8) - -#define AR7240_REG_MIB_FUNCTION0 0x80 -#define AR7240_MIB_TIMER_M BITM(16) -#define AR7240_MIB_AT_HALF_EN BIT(16) -#define AR7240_MIB_BUSY BIT(17) -#define AR7240_MIB_FUNC_S 24 -#define AR7240_MIB_FUNC_M BITM(3) -#define AR7240_MIB_FUNC_NO_OP 0x0 -#define AR7240_MIB_FUNC_FLUSH 0x1 -#define AR7240_MIB_FUNC_CAPTURE 0x3 - -#define AR7240_REG_MDIO_CTRL 0x98 -#define AR7240_MDIO_CTRL_DATA_M BITM(16) -#define AR7240_MDIO_CTRL_REG_ADDR_S 16 -#define AR7240_MDIO_CTRL_PHY_ADDR_S 21 -#define AR7240_MDIO_CTRL_CMD_WRITE 0 -#define AR7240_MDIO_CTRL_CMD_READ BIT(27) -#define AR7240_MDIO_CTRL_MASTER_EN BIT(30) -#define AR7240_MDIO_CTRL_BUSY BIT(31) - -#define AR7240_REG_PORT_BASE(_port) (0x100 + (_port) * 0x100) - -#define AR7240_REG_PORT_STATUS(_port) (AR7240_REG_PORT_BASE((_port)) + 0x00) -#define AR7240_PORT_STATUS_SPEED_S 0 -#define AR7240_PORT_STATUS_SPEED_M BITM(2) -#define AR7240_PORT_STATUS_SPEED_10 0 -#define AR7240_PORT_STATUS_SPEED_100 1 -#define AR7240_PORT_STATUS_SPEED_1000 2 -#define AR7240_PORT_STATUS_TXMAC BIT(2) -#define AR7240_PORT_STATUS_RXMAC BIT(3) -#define AR7240_PORT_STATUS_TXFLOW BIT(4) -#define AR7240_PORT_STATUS_RXFLOW BIT(5) -#define AR7240_PORT_STATUS_DUPLEX BIT(6) -#define AR7240_PORT_STATUS_LINK_UP BIT(8) -#define AR7240_PORT_STATUS_LINK_AUTO BIT(9) -#define AR7240_PORT_STATUS_LINK_PAUSE BIT(10) - -#define AR7240_REG_PORT_CTRL(_port) (AR7240_REG_PORT_BASE((_port)) + 0x04) -#define AR7240_PORT_CTRL_STATE_M BITM(3) -#define AR7240_PORT_CTRL_STATE_DISABLED 0 -#define AR7240_PORT_CTRL_STATE_BLOCK 1 -#define AR7240_PORT_CTRL_STATE_LISTEN 2 -#define AR7240_PORT_CTRL_STATE_LEARN 3 -#define AR7240_PORT_CTRL_STATE_FORWARD 4 -#define AR7240_PORT_CTRL_LEARN_LOCK BIT(7) -#define AR7240_PORT_CTRL_VLAN_MODE_S 8 -#define AR7240_PORT_CTRL_VLAN_MODE_KEEP 0 -#define AR7240_PORT_CTRL_VLAN_MODE_STRIP 1 -#define AR7240_PORT_CTRL_VLAN_MODE_ADD 2 -#define AR7240_PORT_CTRL_VLAN_MODE_DOUBLE_TAG 3 -#define AR7240_PORT_CTRL_IGMP_SNOOP BIT(10) -#define AR7240_PORT_CTRL_HEADER BIT(11) -#define AR7240_PORT_CTRL_MAC_LOOP BIT(12) -#define AR7240_PORT_CTRL_SINGLE_VLAN BIT(13) -#define AR7240_PORT_CTRL_LEARN BIT(14) -#define AR7240_PORT_CTRL_DOUBLE_TAG BIT(15) -#define AR7240_PORT_CTRL_MIRROR_TX BIT(16) -#define AR7240_PORT_CTRL_MIRROR_RX BIT(17) - -#define AR7240_REG_PORT_VLAN(_port) (AR7240_REG_PORT_BASE((_port)) + 0x08) - -#define AR7240_PORT_VLAN_DEFAULT_ID_S 0 -#define AR7240_PORT_VLAN_DEST_PORTS_S 16 -#define AR7240_PORT_VLAN_MODE_S 30 -#define AR7240_PORT_VLAN_MODE_PORT_ONLY 0 -#define AR7240_PORT_VLAN_MODE_PORT_FALLBACK 1 -#define AR7240_PORT_VLAN_MODE_VLAN_ONLY 2 -#define AR7240_PORT_VLAN_MODE_SECURE 3 - - -#define AR7240_REG_STATS_BASE(_port) (0x20000 + (_port) * 0x100) - -#define AR7240_STATS_RXBROAD 0x00 -#define AR7240_STATS_RXPAUSE 0x04 -#define AR7240_STATS_RXMULTI 0x08 -#define AR7240_STATS_RXFCSERR 0x0c -#define AR7240_STATS_RXALIGNERR 0x10 -#define AR7240_STATS_RXRUNT 0x14 -#define AR7240_STATS_RXFRAGMENT 0x18 -#define AR7240_STATS_RX64BYTE 0x1c -#define AR7240_STATS_RX128BYTE 0x20 -#define AR7240_STATS_RX256BYTE 0x24 -#define AR7240_STATS_RX512BYTE 0x28 -#define AR7240_STATS_RX1024BYTE 0x2c -#define AR7240_STATS_RX1518BYTE 0x30 -#define AR7240_STATS_RXMAXBYTE 0x34 -#define AR7240_STATS_RXTOOLONG 0x38 -#define AR7240_STATS_RXGOODBYTE 0x3c -#define AR7240_STATS_RXBADBYTE 0x44 -#define AR7240_STATS_RXOVERFLOW 0x4c -#define AR7240_STATS_FILTERED 0x50 -#define AR7240_STATS_TXBROAD 0x54 -#define AR7240_STATS_TXPAUSE 0x58 -#define AR7240_STATS_TXMULTI 0x5c -#define AR7240_STATS_TXUNDERRUN 0x60 -#define AR7240_STATS_TX64BYTE 0x64 -#define AR7240_STATS_TX128BYTE 0x68 -#define AR7240_STATS_TX256BYTE 0x6c -#define AR7240_STATS_TX512BYTE 0x70 -#define AR7240_STATS_TX1024BYTE 0x74 -#define AR7240_STATS_TX1518BYTE 0x78 -#define AR7240_STATS_TXMAXBYTE 0x7c -#define AR7240_STATS_TXOVERSIZE 0x80 -#define AR7240_STATS_TXBYTE 0x84 -#define AR7240_STATS_TXCOLLISION 0x8c -#define AR7240_STATS_TXABORTCOL 0x90 -#define AR7240_STATS_TXMULTICOL 0x94 -#define AR7240_STATS_TXSINGLECOL 0x98 -#define AR7240_STATS_TXEXCDEFER 0x9c -#define AR7240_STATS_TXDEFER 0xa0 -#define AR7240_STATS_TXLATECOL 0xa4 - -#define AR7240_PORT_CPU 0 -#define AR7240_NUM_PORTS 6 -#define AR7240_NUM_PHYS 5 - -#define AR7240_PHY_ID1 0x004d -#define AR7240_PHY_ID2 0xd041 - -#define AR934X_PHY_ID1 0x004d -#define AR934X_PHY_ID2 0xd042 - -#define AR7240_MAX_VLANS 16 - -#define AR934X_REG_OPER_MODE0 0x04 -#define AR934X_OPER_MODE0_MAC_GMII_EN BIT(6) -#define AR934X_OPER_MODE0_PHY_MII_EN BIT(10) - -#define AR934X_REG_OPER_MODE1 0x08 -#define AR934X_REG_OPER_MODE1_PHY4_MII_EN BIT(28) - -#define AR934X_REG_FLOOD_MASK 0x2c -#define AR934X_FLOOD_MASK_MC_DP(_p) BIT(16 + (_p)) -#define AR934X_FLOOD_MASK_BC_DP(_p) BIT(25 + (_p)) - -#define AR934X_REG_QM_CTRL 0x3c -#define AR934X_QM_CTRL_ARP_EN BIT(15) - -#define AR934X_REG_AT_CTRL 0x5c -#define AR934X_AT_CTRL_AGE_TIME BITS(0, 15) -#define AR934X_AT_CTRL_AGE_EN BIT(17) -#define AR934X_AT_CTRL_LEARN_CHANGE BIT(18) - -#define AR934X_MIB_ENABLE BIT(30) - -#define AR934X_REG_PORT_BASE(_port) (0x100 + (_port) * 0x100) - -#define AR934X_REG_PORT_VLAN1(_port) (AR934X_REG_PORT_BASE((_port)) + 0x08) -#define AR934X_PORT_VLAN1_DEFAULT_SVID_S 0 -#define AR934X_PORT_VLAN1_FORCE_DEFAULT_VID_EN BIT(12) -#define AR934X_PORT_VLAN1_PORT_TLS_MODE BIT(13) -#define AR934X_PORT_VLAN1_PORT_VLAN_PROP_EN BIT(14) -#define AR934X_PORT_VLAN1_PORT_CLONE_EN BIT(15) -#define AR934X_PORT_VLAN1_DEFAULT_CVID_S 16 -#define AR934X_PORT_VLAN1_FORCE_PORT_VLAN_EN BIT(28) -#define AR934X_PORT_VLAN1_ING_PORT_PRI_S 29 - -#define AR934X_REG_PORT_VLAN2(_port) (AR934X_REG_PORT_BASE((_port)) + 0x0c) -#define AR934X_PORT_VLAN2_PORT_VID_MEM_S 16 -#define AR934X_PORT_VLAN2_8021Q_MODE_S 30 -#define AR934X_PORT_VLAN2_8021Q_MODE_PORT_ONLY 0 -#define AR934X_PORT_VLAN2_8021Q_MODE_PORT_FALLBACK 1 -#define AR934X_PORT_VLAN2_8021Q_MODE_VLAN_ONLY 2 -#define AR934X_PORT_VLAN2_8021Q_MODE_SECURE 3 - -#define sw_to_ar7240(_dev) container_of(_dev, struct ar7240sw, swdev) - -struct ar7240sw_port_stat { - unsigned long rx_broadcast; - unsigned long rx_pause; - unsigned long rx_multicast; - unsigned long rx_fcs_error; - unsigned long rx_align_error; - unsigned long rx_runt; - unsigned long rx_fragments; - unsigned long rx_64byte; - unsigned long rx_128byte; - unsigned long rx_256byte; - unsigned long rx_512byte; - unsigned long rx_1024byte; - unsigned long rx_1518byte; - unsigned long rx_maxbyte; - unsigned long rx_toolong; - unsigned long rx_good_byte; - unsigned long rx_bad_byte; - unsigned long rx_overflow; - unsigned long filtered; - - unsigned long tx_broadcast; - unsigned long tx_pause; - unsigned long tx_multicast; - unsigned long tx_underrun; - unsigned long tx_64byte; - unsigned long tx_128byte; - unsigned long tx_256byte; - unsigned long tx_512byte; - unsigned long tx_1024byte; - unsigned long tx_1518byte; - unsigned long tx_maxbyte; - unsigned long tx_oversize; - unsigned long tx_byte; - unsigned long tx_collision; - unsigned long tx_abortcol; - unsigned long tx_multicol; - unsigned long tx_singlecol; - unsigned long tx_excdefer; - unsigned long tx_defer; - unsigned long tx_xlatecol; -}; - -struct ar7240sw { - struct mii_bus *mii_bus; - struct ag71xx_switch_platform_data *swdata; - struct switch_dev swdev; - int num_ports; - u8 ver; - bool vlan; - u16 vlan_id[AR7240_MAX_VLANS]; - u8 vlan_table[AR7240_MAX_VLANS]; - u8 vlan_tagged; - u16 pvid[AR7240_NUM_PORTS]; - char buf[80]; - - rwlock_t stats_lock; - struct ar7240sw_port_stat port_stats[AR7240_NUM_PORTS]; -}; - -struct ar7240sw_hw_stat { - char string[ETH_GSTRING_LEN]; - int sizeof_stat; - int reg; -}; - -static DEFINE_MUTEX(reg_mutex); - -static inline int sw_is_ar7240(struct ar7240sw *as) -{ - return as->ver == AR7240_MASK_CTRL_VERSION_AR7240; -} - -static inline int sw_is_ar934x(struct ar7240sw *as) -{ - return as->ver == AR7240_MASK_CTRL_VERSION_AR934X; -} - -static inline u32 ar7240sw_port_mask(struct ar7240sw *as, int port) -{ - return BIT(port); -} - -static inline u32 ar7240sw_port_mask_all(struct ar7240sw *as) -{ - return BIT(as->swdev.ports) - 1; -} - -static inline u32 ar7240sw_port_mask_but(struct ar7240sw *as, int port) -{ - return ar7240sw_port_mask_all(as) & ~BIT(port); -} - -static inline u16 mk_phy_addr(u32 reg) -{ - return 0x17 & ((reg >> 4) | 0x10); -} - -static inline u16 mk_phy_reg(u32 reg) -{ - return (reg << 1) & 0x1e; -} - -static inline u16 mk_high_addr(u32 reg) -{ - return (reg >> 7) & 0x1ff; -} - -static u32 __ar7240sw_reg_read(struct mii_bus *mii, u32 reg) -{ - unsigned long flags; - u16 phy_addr; - u16 phy_reg; - u32 hi, lo; - - reg = (reg & 0xfffffffc) >> 2; - phy_addr = mk_phy_addr(reg); - phy_reg = mk_phy_reg(reg); - - local_irq_save(flags); - ag71xx_mdio_mii_write(mii->priv, 0x1f, 0x10, mk_high_addr(reg)); - lo = (u32) ag71xx_mdio_mii_read(mii->priv, phy_addr, phy_reg); - hi = (u32) ag71xx_mdio_mii_read(mii->priv, phy_addr, phy_reg + 1); - local_irq_restore(flags); - - return (hi << 16) | lo; -} - -static void __ar7240sw_reg_write(struct mii_bus *mii, u32 reg, u32 val) -{ - unsigned long flags; - u16 phy_addr; - u16 phy_reg; - - reg = (reg & 0xfffffffc) >> 2; - phy_addr = mk_phy_addr(reg); - phy_reg = mk_phy_reg(reg); - - local_irq_save(flags); - ag71xx_mdio_mii_write(mii->priv, 0x1f, 0x10, mk_high_addr(reg)); - ag71xx_mdio_mii_write(mii->priv, phy_addr, phy_reg + 1, (val >> 16)); - ag71xx_mdio_mii_write(mii->priv, phy_addr, phy_reg, (val & 0xffff)); - local_irq_restore(flags); -} - -static u32 ar7240sw_reg_read(struct mii_bus *mii, u32 reg_addr) -{ - u32 ret; - - mutex_lock(®_mutex); - ret = __ar7240sw_reg_read(mii, reg_addr); - mutex_unlock(®_mutex); - - return ret; -} - -static void ar7240sw_reg_write(struct mii_bus *mii, u32 reg_addr, u32 reg_val) -{ - mutex_lock(®_mutex); - __ar7240sw_reg_write(mii, reg_addr, reg_val); - mutex_unlock(®_mutex); -} - -static u32 ar7240sw_reg_rmw(struct mii_bus *mii, u32 reg, u32 mask, u32 val) -{ - u32 t; - - mutex_lock(®_mutex); - t = __ar7240sw_reg_read(mii, reg); - t &= ~mask; - t |= val; - __ar7240sw_reg_write(mii, reg, t); - mutex_unlock(®_mutex); - - return t; -} - -static void ar7240sw_reg_set(struct mii_bus *mii, u32 reg, u32 val) -{ - u32 t; - - mutex_lock(®_mutex); - t = __ar7240sw_reg_read(mii, reg); - t |= val; - __ar7240sw_reg_write(mii, reg, t); - mutex_unlock(®_mutex); -} - -static int __ar7240sw_reg_wait(struct mii_bus *mii, u32 reg, u32 mask, u32 val, - unsigned timeout) -{ - int i; - - for (i = 0; i < timeout; i++) { - u32 t; - - t = __ar7240sw_reg_read(mii, reg); - if ((t & mask) == val) - return 0; - - usleep_range(1000, 2000); - } - - return -ETIMEDOUT; -} - -static int ar7240sw_reg_wait(struct mii_bus *mii, u32 reg, u32 mask, u32 val, - unsigned timeout) -{ - int ret; - - mutex_lock(®_mutex); - ret = __ar7240sw_reg_wait(mii, reg, mask, val, timeout); - mutex_unlock(®_mutex); - return ret; -} - -u16 ar7240sw_phy_read(struct mii_bus *mii, unsigned phy_addr, - unsigned reg_addr) -{ - u32 t, val = 0xffff; - int err; - - if (phy_addr >= AR7240_NUM_PHYS) - return 0xffff; - - mutex_lock(®_mutex); - t = (reg_addr << AR7240_MDIO_CTRL_REG_ADDR_S) | - (phy_addr << AR7240_MDIO_CTRL_PHY_ADDR_S) | - AR7240_MDIO_CTRL_MASTER_EN | - AR7240_MDIO_CTRL_BUSY | - AR7240_MDIO_CTRL_CMD_READ; - - __ar7240sw_reg_write(mii, AR7240_REG_MDIO_CTRL, t); - err = __ar7240sw_reg_wait(mii, AR7240_REG_MDIO_CTRL, - AR7240_MDIO_CTRL_BUSY, 0, 5); - if (!err) - val = __ar7240sw_reg_read(mii, AR7240_REG_MDIO_CTRL); - mutex_unlock(®_mutex); - - return val & AR7240_MDIO_CTRL_DATA_M; -} - -int ar7240sw_phy_write(struct mii_bus *mii, unsigned phy_addr, - unsigned reg_addr, u16 reg_val) -{ - u32 t; - int ret; - - if (phy_addr >= AR7240_NUM_PHYS) - return -EINVAL; - - mutex_lock(®_mutex); - t = (phy_addr << AR7240_MDIO_CTRL_PHY_ADDR_S) | - (reg_addr << AR7240_MDIO_CTRL_REG_ADDR_S) | - AR7240_MDIO_CTRL_MASTER_EN | - AR7240_MDIO_CTRL_BUSY | - AR7240_MDIO_CTRL_CMD_WRITE | - reg_val; - - __ar7240sw_reg_write(mii, AR7240_REG_MDIO_CTRL, t); - ret = __ar7240sw_reg_wait(mii, AR7240_REG_MDIO_CTRL, - AR7240_MDIO_CTRL_BUSY, 0, 5); - mutex_unlock(®_mutex); - - return ret; -} - -static int ar7240sw_capture_stats(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - int port; - int ret; - - write_lock(&as->stats_lock); - - /* Capture the hardware statistics for all ports */ - ar7240sw_reg_rmw(mii, AR7240_REG_MIB_FUNCTION0, - (AR7240_MIB_FUNC_M << AR7240_MIB_FUNC_S), - (AR7240_MIB_FUNC_CAPTURE << AR7240_MIB_FUNC_S)); - - /* Wait for the capturing to complete. */ - ret = ar7240sw_reg_wait(mii, AR7240_REG_MIB_FUNCTION0, - AR7240_MIB_BUSY, 0, 10); - - if (ret) - goto unlock; - - for (port = 0; port < AR7240_NUM_PORTS; port++) { - unsigned int base; - struct ar7240sw_port_stat *stats; - - base = AR7240_REG_STATS_BASE(port); - stats = &as->port_stats[port]; - -#define READ_STAT(_r) ar7240sw_reg_read(mii, base + AR7240_STATS_ ## _r) - - stats->rx_good_byte += READ_STAT(RXGOODBYTE); - stats->tx_byte += READ_STAT(TXBYTE); - -#undef READ_STAT - } - - ret = 0; - -unlock: - write_unlock(&as->stats_lock); - return ret; -} - -static void ar7240sw_disable_port(struct ar7240sw *as, unsigned port) -{ - ar7240sw_reg_write(as->mii_bus, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_STATE_DISABLED); -} - -static void ar7240sw_setup(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - - /* Enable CPU port, and disable mirror port */ - ar7240sw_reg_write(mii, AR7240_REG_CPU_PORT, - AR7240_CPU_PORT_EN | - (15 << AR7240_MIRROR_PORT_S)); - - /* Setup TAG priority mapping */ - ar7240sw_reg_write(mii, AR7240_REG_TAG_PRIORITY, 0xfa50); - - if (sw_is_ar934x(as)) { - /* Enable aging, MAC replacing */ - ar7240sw_reg_write(mii, AR934X_REG_AT_CTRL, - 0x2b /* 5 min age time */ | - AR934X_AT_CTRL_AGE_EN | - AR934X_AT_CTRL_LEARN_CHANGE); - /* Enable ARP frame acknowledge */ - ar7240sw_reg_set(mii, AR934X_REG_QM_CTRL, - AR934X_QM_CTRL_ARP_EN); - /* Enable Broadcast/Multicast frames transmitted to the CPU */ - ar7240sw_reg_set(mii, AR934X_REG_FLOOD_MASK, - AR934X_FLOOD_MASK_BC_DP(0) | - AR934X_FLOOD_MASK_MC_DP(0)); - - /* setup MTU */ - ar7240sw_reg_rmw(mii, AR7240_REG_GLOBAL_CTRL, - AR9340_GLOBAL_CTRL_MTU_M, - AR9340_GLOBAL_CTRL_MTU_M); - - /* Enable MIB counters */ - ar7240sw_reg_set(mii, AR7240_REG_MIB_FUNCTION0, - AR934X_MIB_ENABLE); - - } else { - /* Enable ARP frame acknowledge, aging, MAC replacing */ - ar7240sw_reg_write(mii, AR7240_REG_AT_CTRL, - AR7240_AT_CTRL_RESERVED | - 0x2b /* 5 min age time */ | - AR7240_AT_CTRL_AGE_EN | - AR7240_AT_CTRL_ARP_EN | - AR7240_AT_CTRL_LEARN_CHANGE); - /* Enable Broadcast frames transmitted to the CPU */ - ar7240sw_reg_set(mii, AR7240_REG_FLOOD_MASK, - AR7240_FLOOD_MASK_BROAD_TO_CPU); - - /* setup MTU */ - ar7240sw_reg_rmw(mii, AR7240_REG_GLOBAL_CTRL, - AR7240_GLOBAL_CTRL_MTU_M, - AR7240_GLOBAL_CTRL_MTU_M); - } - - /* setup Service TAG */ - ar7240sw_reg_rmw(mii, AR7240_REG_SERVICE_TAG, AR7240_SERVICE_TAG_M, 0); -} - -/* inspired by phy_poll_reset in drivers/net/phy/phy_device.c */ -static int -ar7240sw_phy_poll_reset(struct mii_bus *bus) -{ - const unsigned int sleep_msecs = 20; - int ret, elapsed, i; - - for (elapsed = sleep_msecs; elapsed <= 600; - elapsed += sleep_msecs) { - msleep(sleep_msecs); - for (i = 0; i < AR7240_NUM_PHYS; i++) { - ret = ar7240sw_phy_read(bus, i, MII_BMCR); - if (ret < 0) - return ret; - if (ret & BMCR_RESET) - break; - if (i == AR7240_NUM_PHYS - 1) { - usleep_range(1000, 2000); - return 0; - } - } - } - return -ETIMEDOUT; -} - -static int ar7240sw_reset(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - int ret; - int i; - - /* Set all ports to disabled state. */ - for (i = 0; i < AR7240_NUM_PORTS; i++) - ar7240sw_disable_port(as, i); - - /* Wait for transmit queues to drain. */ - usleep_range(2000, 3000); - - /* Reset the switch. */ - ar7240sw_reg_write(mii, AR7240_REG_MASK_CTRL, - AR7240_MASK_CTRL_SOFT_RESET); - - ret = ar7240sw_reg_wait(mii, AR7240_REG_MASK_CTRL, - AR7240_MASK_CTRL_SOFT_RESET, 0, 1000); - - /* setup PHYs */ - for (i = 0; i < AR7240_NUM_PHYS; i++) { - ar7240sw_phy_write(mii, i, MII_ADVERTISE, - ADVERTISE_ALL | ADVERTISE_PAUSE_CAP | - ADVERTISE_PAUSE_ASYM); - ar7240sw_phy_write(mii, i, MII_BMCR, - BMCR_RESET | BMCR_ANENABLE); - } - ret = ar7240sw_phy_poll_reset(mii); - if (ret) - return ret; - - ar7240sw_setup(as); - return ret; -} - -static void ar7240sw_setup_port(struct ar7240sw *as, unsigned port, u8 portmask) -{ - struct mii_bus *mii = as->mii_bus; - u32 ctrl; - u32 vid, mode; - - ctrl = AR7240_PORT_CTRL_STATE_FORWARD | AR7240_PORT_CTRL_LEARN | - AR7240_PORT_CTRL_SINGLE_VLAN; - - if (port == AR7240_PORT_CPU) { - ar7240sw_reg_write(mii, AR7240_REG_PORT_STATUS(port), - AR7240_PORT_STATUS_SPEED_1000 | - AR7240_PORT_STATUS_TXFLOW | - AR7240_PORT_STATUS_RXFLOW | - AR7240_PORT_STATUS_TXMAC | - AR7240_PORT_STATUS_RXMAC | - AR7240_PORT_STATUS_DUPLEX); - } else { - ar7240sw_reg_write(mii, AR7240_REG_PORT_STATUS(port), - AR7240_PORT_STATUS_LINK_AUTO); - } - - /* Set the default VID for this port */ - if (as->vlan) { - vid = as->vlan_id[as->pvid[port]]; - mode = AR7240_PORT_VLAN_MODE_SECURE; - } else { - vid = port; - mode = AR7240_PORT_VLAN_MODE_PORT_ONLY; - } - - if (as->vlan) { - if (as->vlan_tagged & BIT(port)) - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_ADD << - AR7240_PORT_CTRL_VLAN_MODE_S; - else - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_STRIP << - AR7240_PORT_CTRL_VLAN_MODE_S; - } else { - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_KEEP << - AR7240_PORT_CTRL_VLAN_MODE_S; - } - - if (!portmask) { - if (port == AR7240_PORT_CPU) - portmask = ar7240sw_port_mask_but(as, AR7240_PORT_CPU); - else - portmask = ar7240sw_port_mask(as, AR7240_PORT_CPU); - } - - /* allow the port to talk to all other ports, but exclude its - * own ID to prevent frames from being reflected back to the - * port that they came from */ - portmask &= ar7240sw_port_mask_but(as, port); - - ar7240sw_reg_write(mii, AR7240_REG_PORT_CTRL(port), ctrl); - if (sw_is_ar934x(as)) { - u32 vlan1, vlan2; - - vlan1 = (vid << AR934X_PORT_VLAN1_DEFAULT_CVID_S); - vlan2 = (portmask << AR934X_PORT_VLAN2_PORT_VID_MEM_S) | - (mode << AR934X_PORT_VLAN2_8021Q_MODE_S); - ar7240sw_reg_write(mii, AR934X_REG_PORT_VLAN1(port), vlan1); - ar7240sw_reg_write(mii, AR934X_REG_PORT_VLAN2(port), vlan2); - } else { - u32 vlan; - - vlan = vid | (mode << AR7240_PORT_VLAN_MODE_S) | - (portmask << AR7240_PORT_VLAN_DEST_PORTS_S); - - ar7240sw_reg_write(mii, AR7240_REG_PORT_VLAN(port), vlan); - } -} - -static int ar7240_set_addr(struct ar7240sw *as, u8 *addr) -{ - struct mii_bus *mii = as->mii_bus; - u32 t; - - t = (addr[4] << 8) | addr[5]; - ar7240sw_reg_write(mii, AR7240_REG_MAC_ADDR0, t); - - t = (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) | addr[3]; - ar7240sw_reg_write(mii, AR7240_REG_MAC_ADDR1, t); - - return 0; -} - -static int -ar7240_set_vid(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - as->vlan_id[val->port_vlan] = val->value.i; - return 0; -} - -static int -ar7240_get_vid(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - val->value.i = as->vlan_id[val->port_vlan]; - return 0; -} - -static int -ar7240_set_pvid(struct switch_dev *dev, int port, int vlan) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - - /* make sure no invalid PVIDs get set */ - - if (vlan >= dev->vlans) - return -EINVAL; - - as->pvid[port] = vlan; - return 0; -} - -static int -ar7240_get_pvid(struct switch_dev *dev, int port, int *vlan) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - *vlan = as->pvid[port]; - return 0; -} - -static int -ar7240_get_ports(struct switch_dev *dev, struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 ports = as->vlan_table[val->port_vlan]; - int i; - - val->len = 0; - for (i = 0; i < as->swdev.ports; i++) { - struct switch_port *p; - - if (!(ports & (1 << i))) - continue; - - p = &val->value.ports[val->len++]; - p->id = i; - if (as->vlan_tagged & (1 << i)) - p->flags = (1 << SWITCH_PORT_FLAG_TAGGED); - else - p->flags = 0; - } - return 0; -} - -static int -ar7240_set_ports(struct switch_dev *dev, struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 *vt = &as->vlan_table[val->port_vlan]; - int i, j; - - *vt = 0; - for (i = 0; i < val->len; i++) { - struct switch_port *p = &val->value.ports[i]; - - if (p->flags & (1 << SWITCH_PORT_FLAG_TAGGED)) - as->vlan_tagged |= (1 << p->id); - else { - as->vlan_tagged &= ~(1 << p->id); - as->pvid[p->id] = val->port_vlan; - - /* make sure that an untagged port does not - * appear in other vlans */ - for (j = 0; j < AR7240_MAX_VLANS; j++) { - if (j == val->port_vlan) - continue; - as->vlan_table[j] &= ~(1 << p->id); - } - } - - *vt |= 1 << p->id; - } - return 0; -} - -static int -ar7240_set_vlan(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - as->vlan = !!val->value.i; - return 0; -} - -static int -ar7240_get_vlan(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - val->value.i = as->vlan; - return 0; -} - -static void -ar7240_vtu_op(struct ar7240sw *as, u32 op, u32 val) -{ - struct mii_bus *mii = as->mii_bus; - - if (ar7240sw_reg_wait(mii, AR7240_REG_VTU, AR7240_VTU_ACTIVE, 0, 5)) - return; - - if ((op & AR7240_VTU_OP) == AR7240_VTU_OP_LOAD) { - val &= AR7240_VTUDATA_MEMBER; - val |= AR7240_VTUDATA_VALID; - ar7240sw_reg_write(mii, AR7240_REG_VTU_DATA, val); - } - op |= AR7240_VTU_ACTIVE; - ar7240sw_reg_write(mii, AR7240_REG_VTU, op); -} - -static int -ar7240_hw_apply(struct switch_dev *dev) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 portmask[AR7240_NUM_PORTS]; - int i, j; - - /* flush all vlan translation unit entries */ - ar7240_vtu_op(as, AR7240_VTU_OP_FLUSH, 0); - - memset(portmask, 0, sizeof(portmask)); - if (as->vlan) { - /* calculate the port destination masks and load vlans - * into the vlan translation unit */ - for (j = 0; j < AR7240_MAX_VLANS; j++) { - u8 vp = as->vlan_table[j]; - - if (!vp) - continue; - - for (i = 0; i < as->swdev.ports; i++) { - u8 mask = (1 << i); - if (vp & mask) - portmask[i] |= vp & ~mask; - } - - ar7240_vtu_op(as, - AR7240_VTU_OP_LOAD | - (as->vlan_id[j] << AR7240_VTU_VID_S), - as->vlan_table[j]); - } - } else { - /* vlan disabled: - * isolate all ports, but connect them to the cpu port */ - for (i = 0; i < as->swdev.ports; i++) { - if (i == AR7240_PORT_CPU) - continue; - - portmask[i] = 1 << AR7240_PORT_CPU; - portmask[AR7240_PORT_CPU] |= (1 << i); - } - } - - /* update the port destination mask registers and tag settings */ - for (i = 0; i < as->swdev.ports; i++) - ar7240sw_setup_port(as, i, portmask[i]); - - return 0; -} - -static int -ar7240_reset_switch(struct switch_dev *dev) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - ar7240sw_reset(as); - return 0; -} - -static int -ar7240_get_port_link(struct switch_dev *dev, int port, - struct switch_port_link *link) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - u32 status; - - if (port >= AR7240_NUM_PORTS) - return -EINVAL; - - status = ar7240sw_reg_read(mii, AR7240_REG_PORT_STATUS(port)); - link->aneg = !!(status & AR7240_PORT_STATUS_LINK_AUTO); - if (link->aneg) { - link->link = !!(status & AR7240_PORT_STATUS_LINK_UP); - if (!link->link) - return 0; - } else { - link->link = true; - } - - link->duplex = !!(status & AR7240_PORT_STATUS_DUPLEX); - link->tx_flow = !!(status & AR7240_PORT_STATUS_TXFLOW); - link->rx_flow = !!(status & AR7240_PORT_STATUS_RXFLOW); - switch (status & AR7240_PORT_STATUS_SPEED_M) { - case AR7240_PORT_STATUS_SPEED_10: - link->speed = SWITCH_PORT_SPEED_10; - break; - case AR7240_PORT_STATUS_SPEED_100: - link->speed = SWITCH_PORT_SPEED_100; - break; - case AR7240_PORT_STATUS_SPEED_1000: - link->speed = SWITCH_PORT_SPEED_1000; - break; - } - - return 0; -} - -static int -ar7240_get_port_stats(struct switch_dev *dev, int port, - struct switch_port_stats *stats) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - - if (port >= AR7240_NUM_PORTS) - return -EINVAL; - - ar7240sw_capture_stats(as); - - read_lock(&as->stats_lock); - stats->rx_bytes = as->port_stats[port].rx_good_byte; - stats->tx_bytes = as->port_stats[port].tx_byte; - read_unlock(&as->stats_lock); - - return 0; -} - -static int -ar7240_set_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->value.i; - - if (port > 15) - return -EINVAL; - - ar7240sw_reg_rmw(mii, AR7240_REG_CPU_PORT, - AR7240_MIRROR_PORT_M << AR7240_MIRROR_PORT_S, - port << AR7240_MIRROR_PORT_S); - - return 0; -} - -static int -ar7240_get_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ret; - - ret = ar7240sw_reg_read(mii, AR7240_REG_CPU_PORT); - val->value.i = (ret >> AR7240_MIRROR_PORT_S) & AR7240_MIRROR_PORT_M; - - return 0; -} - -static int -ar7240_set_mirror_rx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - if (val && val->value.i == 1) - ar7240sw_reg_set(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_RX); - else - ar7240sw_reg_rmw(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_RX, 0); - - return 0; -} - -static int -ar7240_get_mirror_rx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ctrl; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_PORT_CTRL(port)); - - if ((ctrl & AR7240_PORT_CTRL_MIRROR_RX) == AR7240_PORT_CTRL_MIRROR_RX) - val->value.i = 1; - else - val->value.i = 0; - - return 0; -} - -static int -ar7240_set_mirror_tx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - if (val && val->value.i == 1) - ar7240sw_reg_set(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_TX); - else - ar7240sw_reg_rmw(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_TX, 0); - - return 0; -} - -static int -ar7240_get_mirror_tx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ctrl; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_PORT_CTRL(port)); - - if ((ctrl & AR7240_PORT_CTRL_MIRROR_TX) == AR7240_PORT_CTRL_MIRROR_TX) - val->value.i = 1; - else - val->value.i = 0; - - return 0; -} - -static struct switch_attr ar7240_globals[] = { - { - .type = SWITCH_TYPE_INT, - .name = "enable_vlan", - .description = "Enable VLAN mode", - .set = ar7240_set_vlan, - .get = ar7240_get_vlan, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "mirror_monitor_port", - .description = "Mirror monitor port", - .set = ar7240_set_mirror_monitor_port, - .get = ar7240_get_mirror_monitor_port, - .max = 15 - }, -}; - -static struct switch_attr ar7240_port[] = { - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_rx", - .description = "Enable mirroring of RX packets", - .set = ar7240_set_mirror_rx, - .get = ar7240_get_mirror_rx, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_tx", - .description = "Enable mirroring of TX packets", - .set = ar7240_set_mirror_tx, - .get = ar7240_get_mirror_tx, - .max = 1 - }, -}; - -static struct switch_attr ar7240_vlan[] = { - { - .type = SWITCH_TYPE_INT, - .name = "vid", - .description = "VLAN ID", - .set = ar7240_set_vid, - .get = ar7240_get_vid, - .max = 4094, - }, -}; - -static const struct switch_dev_ops ar7240_ops = { - .attr_global = { - .attr = ar7240_globals, - .n_attr = ARRAY_SIZE(ar7240_globals), - }, - .attr_port = { - .attr = ar7240_port, - .n_attr = ARRAY_SIZE(ar7240_port), - }, - .attr_vlan = { - .attr = ar7240_vlan, - .n_attr = ARRAY_SIZE(ar7240_vlan), - }, - .get_port_pvid = ar7240_get_pvid, - .set_port_pvid = ar7240_set_pvid, - .get_vlan_ports = ar7240_get_ports, - .set_vlan_ports = ar7240_set_ports, - .apply_config = ar7240_hw_apply, - .reset_switch = ar7240_reset_switch, - .get_port_link = ar7240_get_port_link, - .get_port_stats = ar7240_get_port_stats, -}; - -static struct ar7240sw *ar7240_probe(struct ag71xx *ag) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - struct mii_bus *mii = ag->mii_bus; - struct ar7240sw *as; - struct switch_dev *swdev; - u32 ctrl; - u16 phy_id1; - u16 phy_id2; - int i; - - phy_id1 = ar7240sw_phy_read(mii, 0, MII_PHYSID1); - phy_id2 = ar7240sw_phy_read(mii, 0, MII_PHYSID2); - if ((phy_id1 != AR7240_PHY_ID1 || phy_id2 != AR7240_PHY_ID2) && - (phy_id1 != AR934X_PHY_ID1 || phy_id2 != AR934X_PHY_ID2)) { - pr_err("%s: unknown phy id '%04x:%04x'\n", - dev_name(&mii->dev), phy_id1, phy_id2); - return NULL; - } - - as = kzalloc(sizeof(*as), GFP_KERNEL); - if (!as) - return NULL; - - as->mii_bus = mii; - as->swdata = pdata->switch_data; - - swdev = &as->swdev; - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_MASK_CTRL); - as->ver = (ctrl >> AR7240_MASK_CTRL_VERSION_S) & - AR7240_MASK_CTRL_VERSION_M; - - if (sw_is_ar7240(as)) { - swdev->name = "AR7240/AR9330 built-in switch"; - swdev->ports = AR7240_NUM_PORTS - 1; - } else if (sw_is_ar934x(as)) { - swdev->name = "AR934X built-in switch"; - - if (pdata->phy_if_mode == PHY_INTERFACE_MODE_GMII) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE0, - AR934X_OPER_MODE0_MAC_GMII_EN); - } else if (pdata->phy_if_mode == PHY_INTERFACE_MODE_MII) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE0, - AR934X_OPER_MODE0_PHY_MII_EN); - } else { - pr_err("%s: invalid PHY interface mode\n", - dev_name(&mii->dev)); - goto err_free; - } - - if (as->swdata->phy4_mii_en) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE1, - AR934X_REG_OPER_MODE1_PHY4_MII_EN); - swdev->ports = AR7240_NUM_PORTS - 1; - } else { - swdev->ports = AR7240_NUM_PORTS; - } - } else { - pr_err("%s: unsupported chip, ctrl=%08x\n", - dev_name(&mii->dev), ctrl); - goto err_free; - } - - swdev->cpu_port = AR7240_PORT_CPU; - swdev->vlans = AR7240_MAX_VLANS; - swdev->ops = &ar7240_ops; - - if (register_switch(&as->swdev, ag->dev) < 0) - goto err_free; - - pr_info("%s: Found an %s\n", dev_name(&mii->dev), swdev->name); - - /* initialize defaults */ - for (i = 0; i < AR7240_MAX_VLANS; i++) - as->vlan_id[i] = i; - - as->vlan_table[0] = ar7240sw_port_mask_all(as); - - return as; - -err_free: - kfree(as); - return NULL; -} - -static void link_function(struct work_struct *work) { - struct ag71xx *ag = container_of(work, struct ag71xx, link_work.work); - struct ar7240sw *as = ag->phy_priv; - unsigned long flags; - u8 mask; - int i; - int status = 0; - - mask = ~as->swdata->phy_poll_mask; - for (i = 0; i < AR7240_NUM_PHYS; i++) { - int link; - - if (!(mask & BIT(i))) - continue; - - link = ar7240sw_phy_read(ag->mii_bus, i, MII_BMSR); - if (link & BMSR_LSTATUS) { - status = 1; - break; - } - } - - spin_lock_irqsave(&ag->lock, flags); - if (status != ag->link) { - ag->link = status; - ag71xx_link_adjust(ag); - } - spin_unlock_irqrestore(&ag->lock, flags); - - schedule_delayed_work(&ag->link_work, HZ / 2); -} - -void ag71xx_ar7240_start(struct ag71xx *ag) -{ - struct ar7240sw *as = ag->phy_priv; - - ar7240sw_reset(as); - - ag->speed = SPEED_1000; - ag->duplex = 1; - - ar7240_set_addr(as, ag->dev->dev_addr); - ar7240_hw_apply(&as->swdev); - - schedule_delayed_work(&ag->link_work, HZ / 10); -} - -void ag71xx_ar7240_stop(struct ag71xx *ag) -{ - cancel_delayed_work_sync(&ag->link_work); -} - -int ag71xx_ar7240_init(struct ag71xx *ag) -{ - struct ar7240sw *as; - - as = ar7240_probe(ag); - if (!as) - return -ENODEV; - - ag->phy_priv = as; - ar7240sw_reset(as); - - rwlock_init(&as->stats_lock); - INIT_DELAYED_WORK(&ag->link_work, link_function); - - return 0; -} - -void ag71xx_ar7240_cleanup(struct ag71xx *ag) -{ - struct ar7240sw *as = ag->phy_priv; - - if (!as) - return; - - unregister_switch(&as->swdev); - kfree(as); - ag->phy_priv = NULL; -} diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c deleted file mode 100644 index 7ec43b722..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * Special support for the Atheros ar8216 switch chip - * - * Copyright (C) 2009-2010 Gabor Juhos - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -#define AR8216_PACKET_TYPE_MASK 0xf -#define AR8216_PACKET_TYPE_NORMAL 0 - -#define AR8216_HEADER_LEN 2 - -void ag71xx_add_ar8216_header(struct ag71xx *ag, struct sk_buff *skb) -{ - skb_push(skb, AR8216_HEADER_LEN); - skb->data[0] = 0x10; - skb->data[1] = 0x80; -} - -int ag71xx_remove_ar8216_header(struct ag71xx *ag, struct sk_buff *skb, - int pktlen) -{ - u8 type; - - type = skb->data[1] & AR8216_PACKET_TYPE_MASK; - switch (type) { - case AR8216_PACKET_TYPE_NORMAL: - break; - - default: - return -EINVAL; - } - - skb_pull(skb, AR8216_HEADER_LEN); - return 0; -} diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c deleted file mode 100644 index 20cf1c15c..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -static struct dentry *ag71xx_debugfs_root; - -static int ag71xx_debugfs_generic_open(struct inode *inode, struct file *file) -{ - file->private_data = inode->i_private; - return 0; -} - -void ag71xx_debugfs_update_int_stats(struct ag71xx *ag, u32 status) -{ - if (status) - ag->debug.int_stats.total++; - if (status & AG71XX_INT_TX_PS) - ag->debug.int_stats.tx_ps++; - if (status & AG71XX_INT_TX_UR) - ag->debug.int_stats.tx_ur++; - if (status & AG71XX_INT_TX_BE) - ag->debug.int_stats.tx_be++; - if (status & AG71XX_INT_RX_PR) - ag->debug.int_stats.rx_pr++; - if (status & AG71XX_INT_RX_OF) - ag->debug.int_stats.rx_of++; - if (status & AG71XX_INT_RX_BE) - ag->debug.int_stats.rx_be++; -} - -static ssize_t read_file_int_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ -#define PR_INT_STAT(_label, _field) \ - len += snprintf(buf + len, sizeof(buf) - len, \ - "%20s: %10lu\n", _label, ag->debug.int_stats._field); - - struct ag71xx *ag = file->private_data; - char buf[256]; - unsigned int len = 0; - - PR_INT_STAT("TX Packet Sent", tx_ps); - PR_INT_STAT("TX Underrun", tx_ur); - PR_INT_STAT("TX Bus Error", tx_be); - PR_INT_STAT("RX Packet Received", rx_pr); - PR_INT_STAT("RX Overflow", rx_of); - PR_INT_STAT("RX Bus Error", rx_be); - len += snprintf(buf + len, sizeof(buf) - len, "\n"); - PR_INT_STAT("Total", total); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -#undef PR_INT_STAT -} - -static const struct file_operations ag71xx_fops_int_stats = { - .open = ag71xx_debugfs_generic_open, - .read = read_file_int_stats, - .owner = THIS_MODULE -}; - -void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, int rx, int tx) -{ - struct ag71xx_napi_stats *stats = &ag->debug.napi_stats; - - if (rx) { - stats->rx_count++; - stats->rx_packets += rx; - if (rx <= AG71XX_NAPI_WEIGHT) - stats->rx[rx]++; - if (rx > stats->rx_packets_max) - stats->rx_packets_max = rx; - } - - if (tx) { - stats->tx_count++; - stats->tx_packets += tx; - if (tx <= AG71XX_NAPI_WEIGHT) - stats->tx[tx]++; - if (tx > stats->tx_packets_max) - stats->tx_packets_max = tx; - } -} - -static ssize_t read_file_napi_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ag71xx *ag = file->private_data; - struct ag71xx_napi_stats *stats = &ag->debug.napi_stats; - char *buf; - unsigned int buflen; - unsigned int len = 0; - unsigned long rx_avg = 0; - unsigned long tx_avg = 0; - int ret; - int i; - - buflen = 2048; - buf = kmalloc(buflen, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - if (stats->rx_count) - rx_avg = stats->rx_packets / stats->rx_count; - - if (stats->tx_count) - tx_avg = stats->tx_packets / stats->tx_count; - - len += snprintf(buf + len, buflen - len, "%3s %10s %10s\n", - "len", "rx", "tx"); - - for (i = 1; i <= AG71XX_NAPI_WEIGHT; i++) - len += snprintf(buf + len, buflen - len, - "%3d: %10lu %10lu\n", - i, stats->rx[i], stats->tx[i]); - - len += snprintf(buf + len, buflen - len, "\n"); - - len += snprintf(buf + len, buflen - len, "%3s: %10lu %10lu\n", - "sum", stats->rx_count, stats->tx_count); - len += snprintf(buf + len, buflen - len, "%3s: %10lu %10lu\n", - "avg", rx_avg, tx_avg); - len += snprintf(buf + len, buflen - len, "%3s: %10lu %10lu\n", - "max", stats->rx_packets_max, stats->tx_packets_max); - len += snprintf(buf + len, buflen - len, "%3s: %10lu %10lu\n", - "pkt", stats->rx_packets, stats->tx_packets); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return ret; -} - -static const struct file_operations ag71xx_fops_napi_stats = { - .open = ag71xx_debugfs_generic_open, - .read = read_file_napi_stats, - .owner = THIS_MODULE -}; - -#define DESC_PRINT_LEN 64 - -static ssize_t read_file_ring(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos, - struct ag71xx *ag, - struct ag71xx_ring *ring, - unsigned desc_reg) -{ - int ring_size = BIT(ring->order); - int ring_mask = ring_size - 1; - char *buf; - unsigned int buflen; - unsigned int len = 0; - unsigned long flags; - ssize_t ret; - int curr; - int dirty; - u32 desc_hw; - int i; - - buflen = (ring_size * DESC_PRINT_LEN); - buf = kmalloc(buflen, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - len += snprintf(buf + len, buflen - len, - "Idx ... %-8s %-8s %-8s %-8s .\n", - "desc", "next", "data", "ctrl"); - - spin_lock_irqsave(&ag->lock, flags); - - curr = (ring->curr & ring_mask); - dirty = (ring->dirty & ring_mask); - desc_hw = ag71xx_rr(ag, desc_reg); - for (i = 0; i < ring_size; i++) { - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - u32 desc_dma = ((u32) ring->descs_dma) + i * AG71XX_DESC_SIZE; - - len += snprintf(buf + len, buflen - len, - "%3d %c%c%c %08x %08x %08x %08x %c\n", - i, - (i == curr) ? 'C' : ' ', - (i == dirty) ? 'D' : ' ', - (desc_hw == desc_dma) ? 'H' : ' ', - desc_dma, - desc->next, - desc->data, - desc->ctrl, - (desc->ctrl & DESC_EMPTY) ? 'E' : '*'); - } - - spin_unlock_irqrestore(&ag->lock, flags); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return ret; -} - -static ssize_t read_file_tx_ring(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ag71xx *ag = file->private_data; - - return read_file_ring(file, user_buf, count, ppos, ag, &ag->tx_ring, - AG71XX_REG_TX_DESC); -} - -static const struct file_operations ag71xx_fops_tx_ring = { - .open = ag71xx_debugfs_generic_open, - .read = read_file_tx_ring, - .owner = THIS_MODULE -}; - -static ssize_t read_file_rx_ring(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ag71xx *ag = file->private_data; - - return read_file_ring(file, user_buf, count, ppos, ag, &ag->rx_ring, - AG71XX_REG_RX_DESC); -} - -static const struct file_operations ag71xx_fops_rx_ring = { - .open = ag71xx_debugfs_generic_open, - .read = read_file_rx_ring, - .owner = THIS_MODULE -}; - -void ag71xx_debugfs_exit(struct ag71xx *ag) -{ - debugfs_remove_recursive(ag->debug.debugfs_dir); -} - -int ag71xx_debugfs_init(struct ag71xx *ag) -{ - struct device *dev = &ag->pdev->dev; - - ag->debug.debugfs_dir = debugfs_create_dir(dev_name(dev), - ag71xx_debugfs_root); - if (!ag->debug.debugfs_dir) { - dev_err(dev, "unable to create debugfs directory\n"); - return -ENOENT; - } - - debugfs_create_file("int_stats", S_IRUGO, ag->debug.debugfs_dir, - ag, &ag71xx_fops_int_stats); - debugfs_create_file("napi_stats", S_IRUGO, ag->debug.debugfs_dir, - ag, &ag71xx_fops_napi_stats); - debugfs_create_file("tx_ring", S_IRUGO, ag->debug.debugfs_dir, - ag, &ag71xx_fops_tx_ring); - debugfs_create_file("rx_ring", S_IRUGO, ag->debug.debugfs_dir, - ag, &ag71xx_fops_rx_ring); - - return 0; -} - -int ag71xx_debugfs_root_init(void) -{ - if (ag71xx_debugfs_root) - return -EBUSY; - - ag71xx_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); - if (!ag71xx_debugfs_root) - return -ENOENT; - - return 0; -} - -void ag71xx_debugfs_root_exit(void) -{ - debugfs_remove(ag71xx_debugfs_root); - ag71xx_debugfs_root = NULL; -} diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c deleted file mode 100644 index f0e102152..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -static int ag71xx_ethtool_get_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - - if (!phydev) - return -ENODEV; - - return phy_ethtool_gset(phydev, cmd); -} - -static int ag71xx_ethtool_set_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - - if (!phydev) - return -ENODEV; - - return phy_ethtool_sset(phydev, cmd); -} - -static void ag71xx_ethtool_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - struct ag71xx *ag = netdev_priv(dev); - - strcpy(info->driver, ag->pdev->dev.driver->name); - strcpy(info->version, AG71XX_DRV_VERSION); - strcpy(info->bus_info, dev_name(&ag->pdev->dev)); -} - -static u32 ag71xx_ethtool_get_msglevel(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - - return ag->msg_enable; -} - -static void ag71xx_ethtool_set_msglevel(struct net_device *dev, u32 msg_level) -{ - struct ag71xx *ag = netdev_priv(dev); - - ag->msg_enable = msg_level; -} - -static void ag71xx_ethtool_get_ringparam(struct net_device *dev, - struct ethtool_ringparam *er) -{ - struct ag71xx *ag = netdev_priv(dev); - - er->tx_max_pending = AG71XX_TX_RING_SIZE_MAX; - er->rx_max_pending = AG71XX_RX_RING_SIZE_MAX; - er->rx_mini_max_pending = 0; - er->rx_jumbo_max_pending = 0; - - er->tx_pending = BIT(ag->tx_ring.order); - er->rx_pending = BIT(ag->rx_ring.order); - er->rx_mini_pending = 0; - er->rx_jumbo_pending = 0; - - if (ag->tx_ring.desc_split) - er->tx_pending /= AG71XX_TX_RING_DS_PER_PKT; -} - -static int ag71xx_ethtool_set_ringparam(struct net_device *dev, - struct ethtool_ringparam *er) -{ - struct ag71xx *ag = netdev_priv(dev); - unsigned tx_size; - unsigned rx_size; - int err = 0; - - if (er->rx_mini_pending != 0|| - er->rx_jumbo_pending != 0 || - er->rx_pending == 0 || - er->tx_pending == 0) - return -EINVAL; - - tx_size = er->tx_pending < AG71XX_TX_RING_SIZE_MAX ? - er->tx_pending : AG71XX_TX_RING_SIZE_MAX; - - rx_size = er->rx_pending < AG71XX_RX_RING_SIZE_MAX ? - er->rx_pending : AG71XX_RX_RING_SIZE_MAX; - - if (netif_running(dev)) { - err = dev->netdev_ops->ndo_stop(dev); - if (err) - return err; - } - - if (ag->tx_ring.desc_split) - tx_size *= AG71XX_TX_RING_DS_PER_PKT; - - ag->tx_ring.order = ag71xx_ring_size_order(tx_size); - ag->rx_ring.order = ag71xx_ring_size_order(rx_size); - - if (netif_running(dev)) - err = dev->netdev_ops->ndo_open(dev); - - return err; -} - -struct ethtool_ops ag71xx_ethtool_ops = { - .set_settings = ag71xx_ethtool_set_settings, - .get_settings = ag71xx_ethtool_get_settings, - .get_drvinfo = ag71xx_ethtool_get_drvinfo, - .get_msglevel = ag71xx_ethtool_get_msglevel, - .set_msglevel = ag71xx_ethtool_set_msglevel, - .get_ringparam = ag71xx_ethtool_get_ringparam, - .set_ringparam = ag71xx_ethtool_set_ringparam, - .get_link = ethtool_op_get_link, - .get_ts_info = ethtool_op_get_ts_info, -}; diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c deleted file mode 100644 index 54ec8e67b..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ /dev/null @@ -1,1479 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -#define AG71XX_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) - -static int ag71xx_msg_level = -1; - -module_param_named(msg_level, ag71xx_msg_level, int, 0); -MODULE_PARM_DESC(msg_level, "Message level (-1=defaults,0=none,...,16=all)"); - -#define ETH_SWITCH_HEADER_LEN 2 - -static int ag71xx_tx_packets(struct ag71xx *ag, bool flush); - -static inline unsigned int ag71xx_max_frame_len(unsigned int mtu) -{ - return ETH_SWITCH_HEADER_LEN + ETH_HLEN + VLAN_HLEN + mtu + ETH_FCS_LEN; -} - -static void ag71xx_dump_dma_regs(struct ag71xx *ag) -{ - DBG("%s: dma_tx_ctrl=%08x, dma_tx_desc=%08x, dma_tx_status=%08x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_TX_CTRL), - ag71xx_rr(ag, AG71XX_REG_TX_DESC), - ag71xx_rr(ag, AG71XX_REG_TX_STATUS)); - - DBG("%s: dma_rx_ctrl=%08x, dma_rx_desc=%08x, dma_rx_status=%08x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_RX_CTRL), - ag71xx_rr(ag, AG71XX_REG_RX_DESC), - ag71xx_rr(ag, AG71XX_REG_RX_STATUS)); -} - -static void ag71xx_dump_regs(struct ag71xx *ag) -{ - DBG("%s: mac_cfg1=%08x, mac_cfg2=%08x, ipg=%08x, hdx=%08x, mfl=%08x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_MAC_CFG1), - ag71xx_rr(ag, AG71XX_REG_MAC_CFG2), - ag71xx_rr(ag, AG71XX_REG_MAC_IPG), - ag71xx_rr(ag, AG71XX_REG_MAC_HDX), - ag71xx_rr(ag, AG71XX_REG_MAC_MFL)); - DBG("%s: mac_ifctl=%08x, mac_addr1=%08x, mac_addr2=%08x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_MAC_IFCTL), - ag71xx_rr(ag, AG71XX_REG_MAC_ADDR1), - ag71xx_rr(ag, AG71XX_REG_MAC_ADDR2)); - DBG("%s: fifo_cfg0=%08x, fifo_cfg1=%08x, fifo_cfg2=%08x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG0), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG1), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG2)); - DBG("%s: fifo_cfg3=%08x, fifo_cfg4=%08x, fifo_cfg5=%08x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG3), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG4), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG5)); -} - -static inline void ag71xx_dump_intr(struct ag71xx *ag, char *label, u32 intr) -{ - DBG("%s: %s intr=%08x %s%s%s%s%s%s\n", - ag->dev->name, label, intr, - (intr & AG71XX_INT_TX_PS) ? "TXPS " : "", - (intr & AG71XX_INT_TX_UR) ? "TXUR " : "", - (intr & AG71XX_INT_TX_BE) ? "TXBE " : "", - (intr & AG71XX_INT_RX_PR) ? "RXPR " : "", - (intr & AG71XX_INT_RX_OF) ? "RXOF " : "", - (intr & AG71XX_INT_RX_BE) ? "RXBE " : ""); -} - -static void ag71xx_ring_tx_clean(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->tx_ring; - struct net_device *dev = ag->dev; - int ring_mask = BIT(ring->order) - 1; - u32 bytes_compl = 0, pkts_compl = 0; - - while (ring->curr != ring->dirty) { - struct ag71xx_desc *desc; - u32 i = ring->dirty & ring_mask; - - desc = ag71xx_ring_desc(ring, i); - if (!ag71xx_desc_empty(desc)) { - desc->ctrl = 0; - dev->stats.tx_errors++; - } - - if (ring->buf[i].skb) { - bytes_compl += ring->buf[i].len; - pkts_compl++; - dev_kfree_skb_any(ring->buf[i].skb); - } - ring->buf[i].skb = NULL; - ring->dirty++; - } - - /* flush descriptors */ - wmb(); - - netdev_completed_queue(dev, pkts_compl, bytes_compl); -} - -static void ag71xx_ring_tx_init(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->tx_ring; - int ring_size = BIT(ring->order); - int ring_mask = ring_size - 1; - int i; - - for (i = 0; i < ring_size; i++) { - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - - desc->next = (u32) (ring->descs_dma + - AG71XX_DESC_SIZE * ((i + 1) & ring_mask)); - - desc->ctrl = DESC_EMPTY; - ring->buf[i].skb = NULL; - } - - /* flush descriptors */ - wmb(); - - ring->curr = 0; - ring->dirty = 0; - netdev_reset_queue(ag->dev); -} - -static void ag71xx_ring_rx_clean(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->rx_ring; - int ring_size = BIT(ring->order); - int i; - - if (!ring->buf) - return; - - for (i = 0; i < ring_size; i++) - if (ring->buf[i].rx_buf) { - dma_unmap_single(&ag->dev->dev, ring->buf[i].dma_addr, - ag->rx_buf_size, DMA_FROM_DEVICE); - skb_free_frag(ring->buf[i].rx_buf); - } -} - -static int ag71xx_buffer_offset(struct ag71xx *ag) -{ - int offset = NET_SKB_PAD; - - /* - * On AR71xx/AR91xx packets must be 4-byte aligned. - * - * When using builtin AR8216 support, hardware adds a 2-byte header, - * so we don't need any extra alignment in that case. - */ - if (!ag71xx_get_pdata(ag)->is_ar724x || ag71xx_has_ar8216(ag)) - return offset; - - return offset + NET_IP_ALIGN; -} - -static int ag71xx_buffer_size(struct ag71xx *ag) -{ - return ag->rx_buf_size + - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); -} - -static bool ag71xx_fill_rx_buf(struct ag71xx *ag, struct ag71xx_buf *buf, - int offset, - void *(*alloc)(unsigned int size)) -{ - struct ag71xx_ring *ring = &ag->rx_ring; - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, buf - &ring->buf[0]); - void *data; - - data = alloc(ag71xx_buffer_size(ag)); - if (!data) - return false; - - buf->rx_buf = data; - buf->dma_addr = dma_map_single(&ag->dev->dev, data, ag->rx_buf_size, - DMA_FROM_DEVICE); - desc->data = (u32) buf->dma_addr + offset; - return true; -} - -static int ag71xx_ring_rx_init(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->rx_ring; - int ring_size = BIT(ring->order); - int ring_mask = BIT(ring->order) - 1; - unsigned int i; - int ret; - int offset = ag71xx_buffer_offset(ag); - - ret = 0; - for (i = 0; i < ring_size; i++) { - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - - desc->next = (u32) (ring->descs_dma + - AG71XX_DESC_SIZE * ((i + 1) & ring_mask)); - - DBG("ag71xx: RX desc at %p, next is %08x\n", - desc, desc->next); - } - - for (i = 0; i < ring_size; i++) { - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - - if (!ag71xx_fill_rx_buf(ag, &ring->buf[i], offset, - netdev_alloc_frag)) { - ret = -ENOMEM; - break; - } - - desc->ctrl = DESC_EMPTY; - } - - /* flush descriptors */ - wmb(); - - ring->curr = 0; - ring->dirty = 0; - - return ret; -} - -static int ag71xx_ring_rx_refill(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->rx_ring; - int ring_mask = BIT(ring->order) - 1; - unsigned int count; - int offset = ag71xx_buffer_offset(ag); - - count = 0; - for (; ring->curr - ring->dirty > 0; ring->dirty++) { - struct ag71xx_desc *desc; - unsigned int i; - - i = ring->dirty & ring_mask; - desc = ag71xx_ring_desc(ring, i); - - if (!ring->buf[i].rx_buf && - !ag71xx_fill_rx_buf(ag, &ring->buf[i], offset, - napi_alloc_frag)) - break; - - desc->ctrl = DESC_EMPTY; - count++; - } - - /* flush descriptors */ - wmb(); - - DBG("%s: %u rx descriptors refilled\n", ag->dev->name, count); - - return count; -} - -static int ag71xx_rings_init(struct ag71xx *ag) -{ - struct ag71xx_ring *tx = &ag->tx_ring; - struct ag71xx_ring *rx = &ag->rx_ring; - int ring_size = BIT(tx->order) + BIT(rx->order); - int tx_size = BIT(tx->order); - - tx->buf = kzalloc(ring_size * sizeof(*tx->buf), GFP_KERNEL); - if (!tx->buf) - return -ENOMEM; - - tx->descs_cpu = dma_alloc_coherent(NULL, ring_size * AG71XX_DESC_SIZE, - &tx->descs_dma, GFP_ATOMIC); - if (!tx->descs_cpu) { - kfree(tx->buf); - tx->buf = NULL; - return -ENOMEM; - } - - rx->buf = &tx->buf[BIT(tx->order)]; - rx->descs_cpu = ((void *)tx->descs_cpu) + tx_size * AG71XX_DESC_SIZE; - rx->descs_dma = tx->descs_dma + tx_size * AG71XX_DESC_SIZE; - - ag71xx_ring_tx_init(ag); - return ag71xx_ring_rx_init(ag); -} - -static void ag71xx_rings_free(struct ag71xx *ag) -{ - struct ag71xx_ring *tx = &ag->tx_ring; - struct ag71xx_ring *rx = &ag->rx_ring; - int ring_size = BIT(tx->order) + BIT(rx->order); - - if (tx->descs_cpu) - dma_free_coherent(NULL, ring_size * AG71XX_DESC_SIZE, - tx->descs_cpu, tx->descs_dma); - - kfree(tx->buf); - - tx->descs_cpu = NULL; - rx->descs_cpu = NULL; - tx->buf = NULL; - rx->buf = NULL; -} - -static void ag71xx_rings_cleanup(struct ag71xx *ag) -{ - ag71xx_ring_rx_clean(ag); - ag71xx_ring_tx_clean(ag); - ag71xx_rings_free(ag); - - netdev_reset_queue(ag->dev); -} - -static unsigned char *ag71xx_speed_str(struct ag71xx *ag) -{ - switch (ag->speed) { - case SPEED_1000: - return "1000"; - case SPEED_100: - return "100"; - case SPEED_10: - return "10"; - } - - return "?"; -} - -static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac) -{ - u32 t; - - t = (((u32) mac[5]) << 24) | (((u32) mac[4]) << 16) - | (((u32) mac[3]) << 8) | ((u32) mac[2]); - - ag71xx_wr(ag, AG71XX_REG_MAC_ADDR1, t); - - t = (((u32) mac[1]) << 24) | (((u32) mac[0]) << 16); - ag71xx_wr(ag, AG71XX_REG_MAC_ADDR2, t); -} - -static void ag71xx_dma_reset(struct ag71xx *ag) -{ - u32 val; - int i; - - ag71xx_dump_dma_regs(ag); - - /* stop RX and TX */ - ag71xx_wr(ag, AG71XX_REG_RX_CTRL, 0); - ag71xx_wr(ag, AG71XX_REG_TX_CTRL, 0); - - /* - * give the hardware some time to really stop all rx/tx activity - * clearing the descriptors too early causes random memory corruption - */ - mdelay(1); - - /* clear descriptor addresses */ - ag71xx_wr(ag, AG71XX_REG_TX_DESC, ag->stop_desc_dma); - ag71xx_wr(ag, AG71XX_REG_RX_DESC, ag->stop_desc_dma); - - /* clear pending RX/TX interrupts */ - for (i = 0; i < 256; i++) { - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_PR); - ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_PS); - } - - /* clear pending errors */ - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_BE | RX_STATUS_OF); - ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_BE | TX_STATUS_UR); - - val = ag71xx_rr(ag, AG71XX_REG_RX_STATUS); - if (val) - pr_alert("%s: unable to clear DMA Rx status: %08x\n", - ag->dev->name, val); - - val = ag71xx_rr(ag, AG71XX_REG_TX_STATUS); - - /* mask out reserved bits */ - val &= ~0xff000000; - - if (val) - pr_alert("%s: unable to clear DMA Tx status: %08x\n", - ag->dev->name, val); - - ag71xx_dump_dma_regs(ag); -} - -#define MAC_CFG1_INIT (MAC_CFG1_RXE | MAC_CFG1_TXE | \ - MAC_CFG1_SRX | MAC_CFG1_STX) - -#define FIFO_CFG0_INIT (FIFO_CFG0_ALL << FIFO_CFG0_ENABLE_SHIFT) - -#define FIFO_CFG4_INIT (FIFO_CFG4_DE | FIFO_CFG4_DV | FIFO_CFG4_FC | \ - FIFO_CFG4_CE | FIFO_CFG4_CR | FIFO_CFG4_LM | \ - FIFO_CFG4_LO | FIFO_CFG4_OK | FIFO_CFG4_MC | \ - FIFO_CFG4_BC | FIFO_CFG4_DR | FIFO_CFG4_LE | \ - FIFO_CFG4_CF | FIFO_CFG4_PF | FIFO_CFG4_UO | \ - FIFO_CFG4_VT) - -#define FIFO_CFG5_INIT (FIFO_CFG5_DE | FIFO_CFG5_DV | FIFO_CFG5_FC | \ - FIFO_CFG5_CE | FIFO_CFG5_LO | FIFO_CFG5_OK | \ - FIFO_CFG5_MC | FIFO_CFG5_BC | FIFO_CFG5_DR | \ - FIFO_CFG5_CF | FIFO_CFG5_PF | FIFO_CFG5_VT | \ - FIFO_CFG5_LE | FIFO_CFG5_FT | FIFO_CFG5_16 | \ - FIFO_CFG5_17 | FIFO_CFG5_SF) - -static void ag71xx_hw_stop(struct ag71xx *ag) -{ - /* disable all interrupts and stop the rx/tx engine */ - ag71xx_wr(ag, AG71XX_REG_INT_ENABLE, 0); - ag71xx_wr(ag, AG71XX_REG_RX_CTRL, 0); - ag71xx_wr(ag, AG71XX_REG_TX_CTRL, 0); -} - -static void ag71xx_hw_setup(struct ag71xx *ag) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - u32 init = MAC_CFG1_INIT; - - /* setup MAC configuration registers */ - if (pdata->use_flow_control) - init |= MAC_CFG1_TFC | MAC_CFG1_RFC; - ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, init); - - ag71xx_sb(ag, AG71XX_REG_MAC_CFG2, - MAC_CFG2_PAD_CRC_EN | MAC_CFG2_LEN_CHECK); - - /* setup max frame length to zero */ - ag71xx_wr(ag, AG71XX_REG_MAC_MFL, 0); - - /* setup FIFO configuration registers */ - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG0, FIFO_CFG0_INIT); - if (pdata->is_ar724x) { - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG1, 0x0010ffff); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG2, 0x015500aa); - } else { - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG1, 0x0fff0000); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG2, 0x00001fff); - } - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG4, FIFO_CFG4_INIT); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, FIFO_CFG5_INIT); -} - -static void ag71xx_hw_init(struct ag71xx *ag) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - u32 reset_mask = pdata->reset_bit; - - ag71xx_hw_stop(ag); - - if (pdata->is_ar724x) { - u32 reset_phy = reset_mask; - - reset_phy &= AR71XX_RESET_GE0_PHY | AR71XX_RESET_GE1_PHY; - reset_mask &= ~(AR71XX_RESET_GE0_PHY | AR71XX_RESET_GE1_PHY); - - ath79_device_reset_set(reset_phy); - msleep(50); - ath79_device_reset_clear(reset_phy); - msleep(200); - } - - ag71xx_sb(ag, AG71XX_REG_MAC_CFG1, MAC_CFG1_SR); - udelay(20); - - ath79_device_reset_set(reset_mask); - msleep(100); - ath79_device_reset_clear(reset_mask); - msleep(200); - - ag71xx_hw_setup(ag); - - ag71xx_dma_reset(ag); -} - -static void ag71xx_fast_reset(struct ag71xx *ag) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - struct net_device *dev = ag->dev; - u32 reset_mask = pdata->reset_bit; - u32 rx_ds; - u32 mii_reg; - - reset_mask &= AR71XX_RESET_GE0_MAC | AR71XX_RESET_GE1_MAC; - - ag71xx_hw_stop(ag); - wmb(); - - mii_reg = ag71xx_rr(ag, AG71XX_REG_MII_CFG); - rx_ds = ag71xx_rr(ag, AG71XX_REG_RX_DESC); - - ag71xx_tx_packets(ag, true); - - ath79_device_reset_set(reset_mask); - udelay(10); - ath79_device_reset_clear(reset_mask); - udelay(10); - - ag71xx_dma_reset(ag); - ag71xx_hw_setup(ag); - ag->tx_ring.curr = 0; - ag->tx_ring.dirty = 0; - netdev_reset_queue(ag->dev); - - /* setup max frame length */ - ag71xx_wr(ag, AG71XX_REG_MAC_MFL, - ag71xx_max_frame_len(ag->dev->mtu)); - - ag71xx_wr(ag, AG71XX_REG_RX_DESC, rx_ds); - ag71xx_wr(ag, AG71XX_REG_TX_DESC, ag->tx_ring.descs_dma); - ag71xx_wr(ag, AG71XX_REG_MII_CFG, mii_reg); - - ag71xx_hw_set_macaddr(ag, dev->dev_addr); -} - -static void ag71xx_hw_start(struct ag71xx *ag) -{ - /* start RX engine */ - ag71xx_wr(ag, AG71XX_REG_RX_CTRL, RX_CTRL_RXE); - - /* enable interrupts */ - ag71xx_wr(ag, AG71XX_REG_INT_ENABLE, AG71XX_INT_INIT); - - netif_wake_queue(ag->dev); -} - -static void -__ag71xx_link_adjust(struct ag71xx *ag, bool update) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - u32 cfg2; - u32 ifctl; - u32 fifo5; - u32 fifo3; - - if (!ag->link && update) { - ag71xx_hw_stop(ag); - netif_carrier_off(ag->dev); - if (netif_msg_link(ag)) - pr_info("%s: link down\n", ag->dev->name); - return; - } - - if (pdata->is_ar724x) - ag71xx_fast_reset(ag); - - cfg2 = ag71xx_rr(ag, AG71XX_REG_MAC_CFG2); - cfg2 &= ~(MAC_CFG2_IF_1000 | MAC_CFG2_IF_10_100 | MAC_CFG2_FDX); - cfg2 |= (ag->duplex) ? MAC_CFG2_FDX : 0; - - ifctl = ag71xx_rr(ag, AG71XX_REG_MAC_IFCTL); - ifctl &= ~(MAC_IFCTL_SPEED); - - fifo5 = ag71xx_rr(ag, AG71XX_REG_FIFO_CFG5); - fifo5 &= ~FIFO_CFG5_BM; - - switch (ag->speed) { - case SPEED_1000: - cfg2 |= MAC_CFG2_IF_1000; - fifo5 |= FIFO_CFG5_BM; - break; - case SPEED_100: - cfg2 |= MAC_CFG2_IF_10_100; - ifctl |= MAC_IFCTL_SPEED; - break; - case SPEED_10: - cfg2 |= MAC_CFG2_IF_10_100; - break; - default: - BUG(); - return; - } - - if (pdata->is_ar91xx) - fifo3 = 0x00780fff; - else if (pdata->is_ar724x) - fifo3 = 0x01f00140; - else - fifo3 = 0x008001ff; - - if (ag->tx_ring.desc_split) { - fifo3 &= 0xffff; - fifo3 |= ((2048 - ag->tx_ring.desc_split) / 4) << 16; - } - - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG3, fifo3); - - if (update && pdata->set_speed) - pdata->set_speed(ag->speed); - - ag71xx_wr(ag, AG71XX_REG_MAC_CFG2, cfg2); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, fifo5); - ag71xx_wr(ag, AG71XX_REG_MAC_IFCTL, ifctl); - - if (pdata->disable_inline_checksum_engine) { - /* - * The rx ring buffer can stall on small packets on QCA953x and - * QCA956x. Disabling the inline checksum engine fixes the stall. - * The wr, rr functions cannot be used since this hidden register - * is outside of the normal ag71xx register block. - */ - void __iomem *dam = ioremap_nocache(0xb90001bc, 0x4); - if (dam) { - __raw_writel(__raw_readl(dam) & ~BIT(27), dam); - (void)__raw_readl(dam); - iounmap(dam); - } - } - - ag71xx_hw_start(ag); - - netif_carrier_on(ag->dev); - if (update && netif_msg_link(ag)) - pr_info("%s: link up (%sMbps/%s duplex)\n", - ag->dev->name, - ag71xx_speed_str(ag), - (DUPLEX_FULL == ag->duplex) ? "Full" : "Half"); - - DBG("%s: fifo_cfg0=%#x, fifo_cfg1=%#x, fifo_cfg2=%#x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG0), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG1), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG2)); - - DBG("%s: fifo_cfg3=%#x, fifo_cfg4=%#x, fifo_cfg5=%#x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG3), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG4), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG5)); - - DBG("%s: mac_cfg2=%#x, mac_ifctl=%#x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_MAC_CFG2), - ag71xx_rr(ag, AG71XX_REG_MAC_IFCTL)); -} - -void ag71xx_link_adjust(struct ag71xx *ag) -{ - __ag71xx_link_adjust(ag, true); -} - -static int ag71xx_hw_enable(struct ag71xx *ag) -{ - int ret; - - ret = ag71xx_rings_init(ag); - if (ret) - return ret; - - napi_enable(&ag->napi); - ag71xx_wr(ag, AG71XX_REG_TX_DESC, ag->tx_ring.descs_dma); - ag71xx_wr(ag, AG71XX_REG_RX_DESC, ag->rx_ring.descs_dma); - netif_start_queue(ag->dev); - - return 0; -} - -static void ag71xx_hw_disable(struct ag71xx *ag) -{ - unsigned long flags; - - spin_lock_irqsave(&ag->lock, flags); - - netif_stop_queue(ag->dev); - - ag71xx_hw_stop(ag); - ag71xx_dma_reset(ag); - - napi_disable(&ag->napi); - del_timer_sync(&ag->oom_timer); - - spin_unlock_irqrestore(&ag->lock, flags); - - ag71xx_rings_cleanup(ag); -} - -static int ag71xx_open(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - unsigned int max_frame_len; - int ret; - - netif_carrier_off(dev); - max_frame_len = ag71xx_max_frame_len(dev->mtu); - ag->rx_buf_size = SKB_DATA_ALIGN(max_frame_len + NET_SKB_PAD + NET_IP_ALIGN); - - /* setup max frame length */ - ag71xx_wr(ag, AG71XX_REG_MAC_MFL, max_frame_len); - ag71xx_hw_set_macaddr(ag, dev->dev_addr); - - ret = ag71xx_hw_enable(ag); - if (ret) - goto err; - - ag71xx_phy_start(ag); - - return 0; - -err: - ag71xx_rings_cleanup(ag); - return ret; -} - -static int ag71xx_stop(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - - netif_carrier_off(dev); - ag71xx_phy_stop(ag); - ag71xx_hw_disable(ag); - - return 0; -} - -static int ag71xx_fill_dma_desc(struct ag71xx_ring *ring, u32 addr, int len) -{ - int i; - struct ag71xx_desc *desc; - int ring_mask = BIT(ring->order) - 1; - int ndesc = 0; - int split = ring->desc_split; - - if (!split) - split = len; - - while (len > 0) { - unsigned int cur_len = len; - - i = (ring->curr + ndesc) & ring_mask; - desc = ag71xx_ring_desc(ring, i); - - if (!ag71xx_desc_empty(desc)) - return -1; - - if (cur_len > split) { - cur_len = split; - - /* - * TX will hang if DMA transfers <= 4 bytes, - * make sure next segment is more than 4 bytes long. - */ - if (len <= split + 4) - cur_len -= 4; - } - - desc->data = addr; - addr += cur_len; - len -= cur_len; - - if (len > 0) - cur_len |= DESC_MORE; - - /* prevent early tx attempt of this descriptor */ - if (!ndesc) - cur_len |= DESC_EMPTY; - - desc->ctrl = cur_len; - ndesc++; - } - - return ndesc; -} - -static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - struct ag71xx_ring *ring = &ag->tx_ring; - int ring_mask = BIT(ring->order) - 1; - int ring_size = BIT(ring->order); - struct ag71xx_desc *desc; - dma_addr_t dma_addr; - int i, n, ring_min; - - if (ag71xx_has_ar8216(ag)) - ag71xx_add_ar8216_header(ag, skb); - - if (skb->len <= 4) { - DBG("%s: packet len is too small\n", ag->dev->name); - goto err_drop; - } - - dma_addr = dma_map_single(&dev->dev, skb->data, skb->len, - DMA_TO_DEVICE); - - i = ring->curr & ring_mask; - desc = ag71xx_ring_desc(ring, i); - - /* setup descriptor fields */ - n = ag71xx_fill_dma_desc(ring, (u32) dma_addr, skb->len & ag->desc_pktlen_mask); - if (n < 0) - goto err_drop_unmap; - - i = (ring->curr + n - 1) & ring_mask; - ring->buf[i].len = skb->len; - ring->buf[i].skb = skb; - - netdev_sent_queue(dev, skb->len); - - skb_tx_timestamp(skb); - - desc->ctrl &= ~DESC_EMPTY; - ring->curr += n; - - /* flush descriptor */ - wmb(); - - ring_min = 2; - if (ring->desc_split) - ring_min *= AG71XX_TX_RING_DS_PER_PKT; - - if (ring->curr - ring->dirty >= ring_size - ring_min) { - DBG("%s: tx queue full\n", dev->name); - netif_stop_queue(dev); - } - - DBG("%s: packet injected into TX queue\n", ag->dev->name); - - /* enable TX engine */ - ag71xx_wr(ag, AG71XX_REG_TX_CTRL, TX_CTRL_TXE); - - return NETDEV_TX_OK; - -err_drop_unmap: - dma_unmap_single(&dev->dev, dma_addr, skb->len, DMA_TO_DEVICE); - -err_drop: - dev->stats.tx_dropped++; - - dev_kfree_skb(skb); - return NETDEV_TX_OK; -} - -static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - int ret; - - switch (cmd) { - case SIOCETHTOOL: - if (ag->phy_dev == NULL) - break; - - spin_lock_irq(&ag->lock); - ret = phy_ethtool_ioctl(ag->phy_dev, (void *) ifr->ifr_data); - spin_unlock_irq(&ag->lock); - return ret; - - case SIOCSIFHWADDR: - if (copy_from_user - (dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr))) - return -EFAULT; - return 0; - - case SIOCGIFHWADDR: - if (copy_to_user - (ifr->ifr_data, dev->dev_addr, sizeof(dev->dev_addr))) - return -EFAULT; - return 0; - - case SIOCGMIIPHY: - case SIOCGMIIREG: - case SIOCSMIIREG: - if (ag->phy_dev == NULL) - break; - - return phy_mii_ioctl(ag->phy_dev, ifr, cmd); - - default: - break; - } - - return -EOPNOTSUPP; -} - -static void ag71xx_oom_timer_handler(unsigned long data) -{ - struct net_device *dev = (struct net_device *) data; - struct ag71xx *ag = netdev_priv(dev); - - napi_schedule(&ag->napi); -} - -static void ag71xx_tx_timeout(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - - if (netif_msg_tx_err(ag)) - pr_info("%s: tx timeout\n", ag->dev->name); - - schedule_delayed_work(&ag->restart_work, 1); -} - -static void ag71xx_restart_work_func(struct work_struct *work) -{ - struct ag71xx *ag = container_of(work, struct ag71xx, restart_work.work); - - rtnl_lock(); - ag71xx_hw_disable(ag); - ag71xx_hw_enable(ag); - if (ag->link) - __ag71xx_link_adjust(ag, false); - rtnl_unlock(); -} - -static bool ag71xx_check_dma_stuck(struct ag71xx *ag) -{ - unsigned long timestamp; - u32 rx_sm, tx_sm, rx_fd; - - timestamp = netdev_get_tx_queue(ag->dev, 0)->trans_start; - if (likely(time_before(jiffies, timestamp + HZ/10))) - return false; - - if (!netif_carrier_ok(ag->dev)) - return false; - - rx_sm = ag71xx_rr(ag, AG71XX_REG_RX_SM); - if ((rx_sm & 0x7) == 0x3 && ((rx_sm >> 4) & 0x7) == 0x6) - return true; - - tx_sm = ag71xx_rr(ag, AG71XX_REG_TX_SM); - rx_fd = ag71xx_rr(ag, AG71XX_REG_FIFO_DEPTH); - if (((tx_sm >> 4) & 0x7) == 0 && ((rx_sm & 0x7) == 0) && - ((rx_sm >> 4) & 0x7) == 0 && rx_fd == 0) - return true; - - return false; -} - -static int ag71xx_tx_packets(struct ag71xx *ag, bool flush) -{ - struct ag71xx_ring *ring = &ag->tx_ring; - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - bool dma_stuck = false; - int ring_mask = BIT(ring->order) - 1; - int ring_size = BIT(ring->order); - int sent = 0; - int bytes_compl = 0; - int n = 0; - - DBG("%s: processing TX ring\n", ag->dev->name); - - while (ring->dirty + n != ring->curr) { - unsigned int i = (ring->dirty + n) & ring_mask; - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - struct sk_buff *skb = ring->buf[i].skb; - - if (!flush && !ag71xx_desc_empty(desc)) { - if (pdata->is_ar724x && - ag71xx_check_dma_stuck(ag)) { - schedule_delayed_work(&ag->restart_work, HZ / 2); - dma_stuck = true; - } - break; - } - - if (flush) - desc->ctrl |= DESC_EMPTY; - - n++; - if (!skb) - continue; - - dev_kfree_skb_any(skb); - ring->buf[i].skb = NULL; - - bytes_compl += ring->buf[i].len; - - sent++; - ring->dirty += n; - - while (n > 0) { - ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_PS); - n--; - } - } - - DBG("%s: %d packets sent out\n", ag->dev->name, sent); - - if (!sent) - return 0; - - ag->dev->stats.tx_bytes += bytes_compl; - ag->dev->stats.tx_packets += sent; - - netdev_completed_queue(ag->dev, sent, bytes_compl); - if ((ring->curr - ring->dirty) < (ring_size * 3) / 4) - netif_wake_queue(ag->dev); - - if (!dma_stuck) - cancel_delayed_work(&ag->restart_work); - - return sent; -} - -static int ag71xx_rx_packets(struct ag71xx *ag, int limit) -{ - struct net_device *dev = ag->dev; - struct ag71xx_ring *ring = &ag->rx_ring; - int offset = ag71xx_buffer_offset(ag); - unsigned int pktlen_mask = ag->desc_pktlen_mask; - int ring_mask = BIT(ring->order) - 1; - int ring_size = BIT(ring->order); - struct sk_buff_head queue; - struct sk_buff *skb; - int done = 0; - - DBG("%s: rx packets, limit=%d, curr=%u, dirty=%u\n", - dev->name, limit, ring->curr, ring->dirty); - - skb_queue_head_init(&queue); - - while (done < limit) { - unsigned int i = ring->curr & ring_mask; - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - int pktlen; - int err = 0; - - if (ag71xx_desc_empty(desc)) - break; - - if ((ring->dirty + ring_size) == ring->curr) { - ag71xx_assert(0); - break; - } - - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_PR); - - pktlen = desc->ctrl & pktlen_mask; - pktlen -= ETH_FCS_LEN; - - dma_unmap_single(&dev->dev, ring->buf[i].dma_addr, - ag->rx_buf_size, DMA_FROM_DEVICE); - - dev->stats.rx_packets++; - dev->stats.rx_bytes += pktlen; - - skb = build_skb(ring->buf[i].rx_buf, ag71xx_buffer_size(ag)); - if (!skb) { - skb_free_frag(ring->buf[i].rx_buf); - goto next; - } - - skb_reserve(skb, offset); - skb_put(skb, pktlen); - - if (ag71xx_has_ar8216(ag)) - err = ag71xx_remove_ar8216_header(ag, skb, pktlen); - - if (err) { - dev->stats.rx_dropped++; - kfree_skb(skb); - } else { - skb->dev = dev; - skb->ip_summed = CHECKSUM_NONE; - __skb_queue_tail(&queue, skb); - } - -next: - ring->buf[i].rx_buf = NULL; - done++; - - ring->curr++; - } - - ag71xx_ring_rx_refill(ag); - - while ((skb = __skb_dequeue(&queue)) != NULL) { - skb->protocol = eth_type_trans(skb, dev); - netif_receive_skb(skb); - } - - DBG("%s: rx finish, curr=%u, dirty=%u, done=%d\n", - dev->name, ring->curr, ring->dirty, done); - - return done; -} - -static int ag71xx_poll(struct napi_struct *napi, int limit) -{ - struct ag71xx *ag = container_of(napi, struct ag71xx, napi); - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - struct net_device *dev = ag->dev; - struct ag71xx_ring *rx_ring = &ag->rx_ring; - int rx_ring_size = BIT(rx_ring->order); - unsigned long flags; - u32 status; - int tx_done; - int rx_done; - - pdata->ddr_flush(); - tx_done = ag71xx_tx_packets(ag, false); - - DBG("%s: processing RX ring\n", dev->name); - rx_done = ag71xx_rx_packets(ag, limit); - - ag71xx_debugfs_update_napi_stats(ag, rx_done, tx_done); - - if (rx_ring->buf[rx_ring->dirty % rx_ring_size].rx_buf == NULL) - goto oom; - - status = ag71xx_rr(ag, AG71XX_REG_RX_STATUS); - if (unlikely(status & RX_STATUS_OF)) { - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_OF); - dev->stats.rx_fifo_errors++; - - /* restart RX */ - ag71xx_wr(ag, AG71XX_REG_RX_CTRL, RX_CTRL_RXE); - } - - if (rx_done < limit) { - if (status & RX_STATUS_PR) - goto more; - - status = ag71xx_rr(ag, AG71XX_REG_TX_STATUS); - if (status & TX_STATUS_PS) - goto more; - - DBG("%s: disable polling mode, rx=%d, tx=%d,limit=%d\n", - dev->name, rx_done, tx_done, limit); - - napi_complete(napi); - - /* enable interrupts */ - spin_lock_irqsave(&ag->lock, flags); - ag71xx_int_enable(ag, AG71XX_INT_POLL); - spin_unlock_irqrestore(&ag->lock, flags); - return rx_done; - } - -more: - DBG("%s: stay in polling mode, rx=%d, tx=%d, limit=%d\n", - dev->name, rx_done, tx_done, limit); - return limit; - -oom: - if (netif_msg_rx_err(ag)) - pr_info("%s: out of memory\n", dev->name); - - mod_timer(&ag->oom_timer, jiffies + AG71XX_OOM_REFILL); - napi_complete(napi); - return 0; -} - -static irqreturn_t ag71xx_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = dev_id; - struct ag71xx *ag = netdev_priv(dev); - u32 status; - - status = ag71xx_rr(ag, AG71XX_REG_INT_STATUS); - ag71xx_dump_intr(ag, "raw", status); - - if (unlikely(!status)) - return IRQ_NONE; - - if (unlikely(status & AG71XX_INT_ERR)) { - if (status & AG71XX_INT_TX_BE) { - ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_BE); - dev_err(&dev->dev, "TX BUS error\n"); - } - if (status & AG71XX_INT_RX_BE) { - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_BE); - dev_err(&dev->dev, "RX BUS error\n"); - } - } - - if (likely(status & AG71XX_INT_POLL)) { - ag71xx_int_disable(ag, AG71XX_INT_POLL); - DBG("%s: enable polling mode\n", dev->name); - napi_schedule(&ag->napi); - } - - ag71xx_debugfs_update_int_stats(ag, status); - - return IRQ_HANDLED; -} - -#ifdef CONFIG_NET_POLL_CONTROLLER -/* - * Polling 'interrupt' - used by things like netconsole to send skbs - * without having to re-enable interrupts. It's not called while - * the interrupt routine is executing. - */ -static void ag71xx_netpoll(struct net_device *dev) -{ - disable_irq(dev->irq); - ag71xx_interrupt(dev->irq, dev); - enable_irq(dev->irq); -} -#endif - -static int ag71xx_change_mtu(struct net_device *dev, int new_mtu) -{ - struct ag71xx *ag = netdev_priv(dev); - unsigned int max_frame_len; - - max_frame_len = ag71xx_max_frame_len(new_mtu); - if (new_mtu < 68 || max_frame_len > ag->max_frame_len) - return -EINVAL; - - if (netif_running(dev)) - return -EBUSY; - - dev->mtu = new_mtu; - return 0; -} - -static const struct net_device_ops ag71xx_netdev_ops = { - .ndo_open = ag71xx_open, - .ndo_stop = ag71xx_stop, - .ndo_start_xmit = ag71xx_hard_start_xmit, - .ndo_do_ioctl = ag71xx_do_ioctl, - .ndo_tx_timeout = ag71xx_tx_timeout, - .ndo_change_mtu = ag71xx_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = ag71xx_netpoll, -#endif -}; - -static const char *ag71xx_get_phy_if_mode_name(phy_interface_t mode) -{ - switch (mode) { - case PHY_INTERFACE_MODE_MII: - return "MII"; - case PHY_INTERFACE_MODE_GMII: - return "GMII"; - case PHY_INTERFACE_MODE_RMII: - return "RMII"; - case PHY_INTERFACE_MODE_RGMII: - return "RGMII"; - case PHY_INTERFACE_MODE_SGMII: - return "SGMII"; - default: - break; - } - - return "unknown"; -} - - -static int ag71xx_probe(struct platform_device *pdev) -{ - struct net_device *dev; - struct resource *res; - struct ag71xx *ag; - struct ag71xx_platform_data *pdata; - int tx_size, err; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "no platform data specified\n"); - err = -ENXIO; - goto err_out; - } - - if (pdata->mii_bus_dev == NULL && pdata->phy_mask) { - dev_err(&pdev->dev, "no MII bus device specified\n"); - err = -EINVAL; - goto err_out; - } - - dev = alloc_etherdev(sizeof(*ag)); - if (!dev) { - dev_err(&pdev->dev, "alloc_etherdev failed\n"); - err = -ENOMEM; - goto err_out; - } - - if (!pdata->max_frame_len || !pdata->desc_pktlen_mask) - return -EINVAL; - - SET_NETDEV_DEV(dev, &pdev->dev); - - ag = netdev_priv(dev); - ag->pdev = pdev; - ag->dev = dev; - ag->msg_enable = netif_msg_init(ag71xx_msg_level, - AG71XX_DEFAULT_MSG_ENABLE); - spin_lock_init(&ag->lock); - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mac_base"); - if (!res) { - dev_err(&pdev->dev, "no mac_base resource found\n"); - err = -ENXIO; - goto err_out; - } - - ag->mac_base = ioremap_nocache(res->start, res->end - res->start + 1); - if (!ag->mac_base) { - dev_err(&pdev->dev, "unable to ioremap mac_base\n"); - err = -ENOMEM; - goto err_free_dev; - } - - dev->irq = platform_get_irq(pdev, 0); - err = request_irq(dev->irq, ag71xx_interrupt, - 0x0, - dev->name, dev); - if (err) { - dev_err(&pdev->dev, "unable to request IRQ %d\n", dev->irq); - goto err_unmap_base; - } - - dev->base_addr = (unsigned long)ag->mac_base; - dev->netdev_ops = &ag71xx_netdev_ops; - dev->ethtool_ops = &ag71xx_ethtool_ops; - - INIT_DELAYED_WORK(&ag->restart_work, ag71xx_restart_work_func); - - init_timer(&ag->oom_timer); - ag->oom_timer.data = (unsigned long) dev; - ag->oom_timer.function = ag71xx_oom_timer_handler; - - tx_size = AG71XX_TX_RING_SIZE_DEFAULT; - ag->rx_ring.order = ag71xx_ring_size_order(AG71XX_RX_RING_SIZE_DEFAULT); - - ag->max_frame_len = pdata->max_frame_len; - ag->desc_pktlen_mask = pdata->desc_pktlen_mask; - - if (!pdata->is_ar724x && !pdata->is_ar91xx) { - ag->tx_ring.desc_split = AG71XX_TX_RING_SPLIT; - tx_size *= AG71XX_TX_RING_DS_PER_PKT; - } - ag->tx_ring.order = ag71xx_ring_size_order(tx_size); - - ag->stop_desc = dma_alloc_coherent(NULL, - sizeof(struct ag71xx_desc), &ag->stop_desc_dma, GFP_KERNEL); - - if (!ag->stop_desc) - goto err_free_irq; - - ag->stop_desc->data = 0; - ag->stop_desc->ctrl = 0; - ag->stop_desc->next = (u32) ag->stop_desc_dma; - - memcpy(dev->dev_addr, pdata->mac_addr, ETH_ALEN); - - netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); - - ag71xx_dump_regs(ag); - - ag71xx_hw_init(ag); - - ag71xx_dump_regs(ag); - - err = ag71xx_phy_connect(ag); - if (err) - goto err_free_desc; - - err = ag71xx_debugfs_init(ag); - if (err) - goto err_phy_disconnect; - - platform_set_drvdata(pdev, dev); - - err = register_netdev(dev); - if (err) { - dev_err(&pdev->dev, "unable to register net device\n"); - goto err_debugfs_exit; - } - - pr_info("%s: Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n", - dev->name, dev->base_addr, dev->irq, - ag71xx_get_phy_if_mode_name(pdata->phy_if_mode)); - - return 0; - -err_debugfs_exit: - ag71xx_debugfs_exit(ag); -err_phy_disconnect: - ag71xx_phy_disconnect(ag); -err_free_desc: - dma_free_coherent(NULL, sizeof(struct ag71xx_desc), ag->stop_desc, - ag->stop_desc_dma); -err_free_irq: - free_irq(dev->irq, dev); -err_unmap_base: - iounmap(ag->mac_base); -err_free_dev: - kfree(dev); -err_out: - platform_set_drvdata(pdev, NULL); - return err; -} - -static int ag71xx_remove(struct platform_device *pdev) -{ - struct net_device *dev = platform_get_drvdata(pdev); - - if (dev) { - struct ag71xx *ag = netdev_priv(dev); - - ag71xx_debugfs_exit(ag); - ag71xx_phy_disconnect(ag); - unregister_netdev(dev); - free_irq(dev->irq, dev); - iounmap(ag->mac_base); - kfree(dev); - platform_set_drvdata(pdev, NULL); - } - - return 0; -} - -static struct platform_driver ag71xx_driver = { - .probe = ag71xx_probe, - .remove = ag71xx_remove, - .driver = { - .name = AG71XX_DRV_NAME, - } -}; - -static int __init ag71xx_module_init(void) -{ - int ret; - - ret = ag71xx_debugfs_root_init(); - if (ret) - goto err_out; - - ret = ag71xx_mdio_driver_init(); - if (ret) - goto err_debugfs_exit; - - ret = platform_driver_register(&ag71xx_driver); - if (ret) - goto err_mdio_exit; - - return 0; - -err_mdio_exit: - ag71xx_mdio_driver_exit(); -err_debugfs_exit: - ag71xx_debugfs_root_exit(); -err_out: - return ret; -} - -static void __exit ag71xx_module_exit(void) -{ - platform_driver_unregister(&ag71xx_driver); - ag71xx_mdio_driver_exit(); - ag71xx_debugfs_root_exit(); -} - -module_init(ag71xx_module_init); -module_exit(ag71xx_module_exit); - -MODULE_VERSION(AG71XX_DRV_VERSION); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_AUTHOR("Imre Kaloz "); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:" AG71XX_DRV_NAME); diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c deleted file mode 100644 index cf41aa8a3..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -#define AG71XX_MDIO_RETRY 1000 -#define AG71XX_MDIO_DELAY 5 - -static inline void ag71xx_mdio_wr(struct ag71xx_mdio *am, unsigned reg, - u32 value) -{ - void __iomem *r; - - r = am->mdio_base + reg; - __raw_writel(value, r); - - /* flush write */ - (void) __raw_readl(r); -} - -static inline u32 ag71xx_mdio_rr(struct ag71xx_mdio *am, unsigned reg) -{ - return __raw_readl(am->mdio_base + reg); -} - -static void ag71xx_mdio_dump_regs(struct ag71xx_mdio *am) -{ - DBG("%s: mii_cfg=%08x, mii_cmd=%08x, mii_addr=%08x\n", - am->mii_bus->name, - ag71xx_mdio_rr(am, AG71XX_REG_MII_CFG), - ag71xx_mdio_rr(am, AG71XX_REG_MII_CMD), - ag71xx_mdio_rr(am, AG71XX_REG_MII_ADDR)); - DBG("%s: mii_ctrl=%08x, mii_status=%08x, mii_ind=%08x\n", - am->mii_bus->name, - ag71xx_mdio_rr(am, AG71XX_REG_MII_CTRL), - ag71xx_mdio_rr(am, AG71XX_REG_MII_STATUS), - ag71xx_mdio_rr(am, AG71XX_REG_MII_IND)); -} - -static int ag71xx_mdio_wait_busy(struct ag71xx_mdio *am) -{ - int i; - - for (i = 0; i < AG71XX_MDIO_RETRY; i++) { - u32 busy; - - udelay(AG71XX_MDIO_DELAY); - - busy = ag71xx_mdio_rr(am, AG71XX_REG_MII_IND); - if (!busy) - return 0; - - udelay(AG71XX_MDIO_DELAY); - } - - pr_err("%s: MDIO operation timed out\n", am->mii_bus->name); - - return -ETIMEDOUT; -} - -int ag71xx_mdio_mii_read(struct ag71xx_mdio *am, int addr, int reg) -{ - int err; - int ret; - - err = ag71xx_mdio_wait_busy(am); - if (err) - return 0xffff; - - ag71xx_mdio_wr(am, AG71XX_REG_MII_CMD, MII_CMD_WRITE); - ag71xx_mdio_wr(am, AG71XX_REG_MII_ADDR, - ((addr & 0xff) << MII_ADDR_SHIFT) | (reg & 0xff)); - ag71xx_mdio_wr(am, AG71XX_REG_MII_CMD, MII_CMD_READ); - - err = ag71xx_mdio_wait_busy(am); - if (err) - return 0xffff; - - ret = ag71xx_mdio_rr(am, AG71XX_REG_MII_STATUS) & 0xffff; - ag71xx_mdio_wr(am, AG71XX_REG_MII_CMD, MII_CMD_WRITE); - - DBG("mii_read: addr=%04x, reg=%04x, value=%04x\n", addr, reg, ret); - - return ret; -} - -void ag71xx_mdio_mii_write(struct ag71xx_mdio *am, int addr, int reg, u16 val) -{ - DBG("mii_write: addr=%04x, reg=%04x, value=%04x\n", addr, reg, val); - - ag71xx_mdio_wr(am, AG71XX_REG_MII_ADDR, - ((addr & 0xff) << MII_ADDR_SHIFT) | (reg & 0xff)); - ag71xx_mdio_wr(am, AG71XX_REG_MII_CTRL, val); - - ag71xx_mdio_wait_busy(am); -} - -static const u32 ar71xx_mdio_div_table[] = { - 4, 4, 6, 8, 10, 14, 20, 28, -}; - -static const u32 ar7240_mdio_div_table[] = { - 2, 2, 4, 6, 8, 12, 18, 26, 32, 40, 48, 56, 62, 70, 78, 96, -}; - -static const u32 ar933x_mdio_div_table[] = { - 4, 4, 6, 8, 10, 14, 20, 28, 34, 42, 50, 58, 66, 74, 82, 98, -}; - -static int ag71xx_mdio_get_divider(struct ag71xx_mdio *am, u32 *div) -{ - unsigned long ref_clock, mdio_clock; - const u32 *table; - int ndivs; - int i; - - ref_clock = am->pdata->ref_clock; - mdio_clock = am->pdata->mdio_clock; - - if (!ref_clock || !mdio_clock) - return -EINVAL; - - if (am->pdata->is_ar9330 || am->pdata->is_ar934x) { - table = ar933x_mdio_div_table; - ndivs = ARRAY_SIZE(ar933x_mdio_div_table); - } else if (am->pdata->is_ar7240) { - table = ar7240_mdio_div_table; - ndivs = ARRAY_SIZE(ar7240_mdio_div_table); - } else { - table = ar71xx_mdio_div_table; - ndivs = ARRAY_SIZE(ar71xx_mdio_div_table); - } - - for (i = 0; i < ndivs; i++) { - unsigned long t; - - t = ref_clock / table[i]; - if (t <= mdio_clock) { - *div = i; - return 0; - } - } - - dev_err(&am->mii_bus->dev, "no divider found for %lu/%lu\n", - ref_clock, mdio_clock); - return -ENOENT; -} - -static int ag71xx_mdio_reset(struct mii_bus *bus) -{ - struct ag71xx_mdio *am = bus->priv; - u32 t; - int err; - - err = ag71xx_mdio_get_divider(am, &t); - if (err) { - /* fallback */ - if (am->pdata->is_ar7240) - t = MII_CFG_CLK_DIV_6; - else if (am->pdata->builtin_switch && !am->pdata->is_ar934x) - t = MII_CFG_CLK_DIV_10; - else if (!am->pdata->builtin_switch && am->pdata->is_ar934x) - t = MII_CFG_CLK_DIV_58; - else - t = MII_CFG_CLK_DIV_28; - } - - ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, t | MII_CFG_RESET); - udelay(100); - - ag71xx_mdio_wr(am, AG71XX_REG_MII_CFG, t); - udelay(100); - - if (am->pdata->reset) - am->pdata->reset(bus); - - return 0; -} - -static int ag71xx_mdio_read(struct mii_bus *bus, int addr, int reg) -{ - struct ag71xx_mdio *am = bus->priv; - - if (am->pdata->builtin_switch) - return ar7240sw_phy_read(bus, addr, reg); - else - return ag71xx_mdio_mii_read(am, addr, reg); -} - -static int ag71xx_mdio_write(struct mii_bus *bus, int addr, int reg, u16 val) -{ - struct ag71xx_mdio *am = bus->priv; - - if (am->pdata->builtin_switch) - ar7240sw_phy_write(bus, addr, reg, val); - else - ag71xx_mdio_mii_write(am, addr, reg, val); - return 0; -} - -static int ag71xx_mdio_probe(struct platform_device *pdev) -{ - struct ag71xx_mdio_platform_data *pdata; - struct ag71xx_mdio *am; - struct resource *res; - int i; - int err; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "no platform data specified\n"); - return -EINVAL; - } - - am = kzalloc(sizeof(*am), GFP_KERNEL); - if (!am) { - err = -ENOMEM; - goto err_out; - } - - am->pdata = pdata; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "no iomem resource found\n"); - err = -ENXIO; - goto err_free_mdio; - } - - am->mdio_base = ioremap_nocache(res->start, res->end - res->start + 1); - if (!am->mdio_base) { - dev_err(&pdev->dev, "unable to ioremap registers\n"); - err = -ENOMEM; - goto err_free_mdio; - } - - am->mii_bus = mdiobus_alloc(); - if (am->mii_bus == NULL) { - err = -ENOMEM; - goto err_iounmap; - } - - am->mii_bus->name = "ag71xx_mdio"; - am->mii_bus->read = ag71xx_mdio_read; - am->mii_bus->write = ag71xx_mdio_write; - am->mii_bus->reset = ag71xx_mdio_reset; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - am->mii_bus->irq = am->mii_irq; -#endif - am->mii_bus->priv = am; - am->mii_bus->parent = &pdev->dev; - snprintf(am->mii_bus->id, MII_BUS_ID_SIZE, "%s", dev_name(&pdev->dev)); - am->mii_bus->phy_mask = pdata->phy_mask; - - for (i = 0; i < PHY_MAX_ADDR; i++) - am->mii_bus->irq[i] = PHY_POLL; - - ag71xx_mdio_wr(am, AG71XX_REG_MAC_CFG1, 0); - - err = mdiobus_register(am->mii_bus); - if (err) - goto err_free_bus; - - ag71xx_mdio_dump_regs(am); - - platform_set_drvdata(pdev, am); - return 0; - -err_free_bus: - mdiobus_free(am->mii_bus); -err_iounmap: - iounmap(am->mdio_base); -err_free_mdio: - kfree(am); -err_out: - return err; -} - -static int ag71xx_mdio_remove(struct platform_device *pdev) -{ - struct ag71xx_mdio *am = platform_get_drvdata(pdev); - - if (am) { - mdiobus_unregister(am->mii_bus); - mdiobus_free(am->mii_bus); - iounmap(am->mdio_base); - kfree(am); - platform_set_drvdata(pdev, NULL); - } - - return 0; -} - -static struct platform_driver ag71xx_mdio_driver = { - .probe = ag71xx_mdio_probe, - .remove = ag71xx_mdio_remove, - .driver = { - .name = "ag71xx-mdio", - } -}; - -int __init ag71xx_mdio_driver_init(void) -{ - return platform_driver_register(&ag71xx_mdio_driver); -} - -void ag71xx_mdio_driver_exit(void) -{ - platform_driver_unregister(&ag71xx_mdio_driver); -} diff --git a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c b/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c deleted file mode 100644 index 12fa2e301..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -static void ag71xx_phy_link_adjust(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - unsigned long flags; - int status_change = 0; - - spin_lock_irqsave(&ag->lock, flags); - - if (phydev->link) { - if (ag->duplex != phydev->duplex - || ag->speed != phydev->speed) { - status_change = 1; - } - } - - if (phydev->link != ag->link) - status_change = 1; - - ag->link = phydev->link; - ag->duplex = phydev->duplex; - ag->speed = phydev->speed; - - if (status_change) - ag71xx_link_adjust(ag); - - spin_unlock_irqrestore(&ag->lock, flags); -} - -void ag71xx_phy_start(struct ag71xx *ag) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - - if (ag->phy_dev) { - phy_start(ag->phy_dev); - } else if (pdata->mii_bus_dev && pdata->switch_data) { - ag71xx_ar7240_start(ag); - } else { - ag->link = 1; - ag71xx_link_adjust(ag); - } -} - -void ag71xx_phy_stop(struct ag71xx *ag) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - unsigned long flags; - - if (ag->phy_dev) - phy_stop(ag->phy_dev); - else if (pdata->mii_bus_dev && pdata->switch_data) - ag71xx_ar7240_stop(ag); - - spin_lock_irqsave(&ag->lock, flags); - if (ag->link) { - ag->link = 0; - ag71xx_link_adjust(ag); - } - spin_unlock_irqrestore(&ag->lock, flags); -} - -static int ag71xx_phy_connect_fixed(struct ag71xx *ag) -{ - struct device *dev = &ag->pdev->dev; - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - int ret = 0; - - /* use fixed settings */ - switch (pdata->speed) { - case SPEED_10: - case SPEED_100: - case SPEED_1000: - break; - default: - dev_err(dev, "invalid speed specified\n"); - ret = -EINVAL; - break; - } - - dev_dbg(dev, "using fixed link parameters\n"); - - ag->duplex = pdata->duplex; - ag->speed = pdata->speed; - - return ret; -} - -static int ag71xx_phy_connect_multi(struct ag71xx *ag) -{ - struct device *dev = &ag->pdev->dev; - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - struct phy_device *phydev = NULL; - int phy_addr; - int ret = 0; - - for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { - if (!(pdata->phy_mask & (1 << phy_addr))) - continue; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - if (ag->mii_bus->phy_map[phy_addr] == NULL) - continue; - - DBG("%s: PHY found at %s, uid=%08x\n", - dev_name(dev), - dev_name(&ag->mii_bus->phy_map[phy_addr]->dev), - ag->mii_bus->phy_map[phy_addr]->phy_id); - - if (phydev == NULL) - phydev = ag->mii_bus->phy_map[phy_addr]; -#else - if (ag->mii_bus->mdio_map[phy_addr] == NULL) - continue; - - DBG("%s: PHY found at %s, uid=%08x\n", - dev_name(dev), - dev_name(&ag->mii_bus->mdio_map[phy_addr]->dev), - ag->mii_bus->mdio_map[phy_addr]->phy_id); - - if (phydev == NULL) - phydev = mdiobus_get_phy(ag->mii_bus, phy_addr); -#endif - } - - if (!phydev) { - dev_err(dev, "no PHY found with phy_mask=%08x\n", - pdata->phy_mask); - return -ENODEV; - } - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - ag->phy_dev = phy_connect(ag->dev, dev_name(&phydev->dev), -#else - ag->phy_dev = phy_connect(ag->dev, phydev_name(phydev), -#endif - &ag71xx_phy_link_adjust, - pdata->phy_if_mode); - - if (IS_ERR(ag->phy_dev)) { - dev_err(dev, "could not connect to PHY at %s\n", -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - dev_name(&phydev->dev)); -#else - phydev_name(phydev)); -#endif - return PTR_ERR(ag->phy_dev); - } - - /* mask with MAC supported features */ - if (pdata->has_gbit) - phydev->supported &= PHY_GBIT_FEATURES; - else - phydev->supported &= PHY_BASIC_FEATURES; - - phydev->advertising = phydev->supported; - - dev_info(dev, "connected to PHY at %s [uid=%08x, driver=%s]\n", -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - dev_name(&phydev->dev), -#else - phydev_name(phydev), -#endif - phydev->phy_id, phydev->drv->name); - - ag->link = 0; - ag->speed = 0; - ag->duplex = -1; - - return ret; -} - -static int dev_is_class(struct device *dev, void *class) -{ - if (dev->class != NULL && !strcmp(dev->class->name, class)) - return 1; - - return 0; -} - -static struct device *dev_find_class(struct device *parent, char *class) -{ - if (dev_is_class(parent, class)) { - get_device(parent); - return parent; - } - - return device_find_child(parent, class, dev_is_class); -} - -static struct mii_bus *dev_to_mii_bus(struct device *dev) -{ - struct device *d; - - d = dev_find_class(dev, "mdio_bus"); - if (d != NULL) { - struct mii_bus *bus; - - bus = to_mii_bus(d); - put_device(d); - - return bus; - } - - return NULL; -} - -int ag71xx_phy_connect(struct ag71xx *ag) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - - if (pdata->mii_bus_dev == NULL || - pdata->mii_bus_dev->bus == NULL ) - return ag71xx_phy_connect_fixed(ag); - - ag->mii_bus = dev_to_mii_bus(pdata->mii_bus_dev); - if (ag->mii_bus == NULL) { - dev_err(&ag->pdev->dev, "unable to find MII bus on device '%s'\n", - dev_name(pdata->mii_bus_dev)); - return -ENODEV; - } - - /* Reset the mdio bus explicitly */ - if (ag->mii_bus->reset) { - mutex_lock(&ag->mii_bus->mdio_lock); - ag->mii_bus->reset(ag->mii_bus); - mutex_unlock(&ag->mii_bus->mdio_lock); - } - - if (pdata->switch_data) - return ag71xx_ar7240_init(ag); - - if (pdata->phy_mask) - return ag71xx_phy_connect_multi(ag); - - return ag71xx_phy_connect_fixed(ag); -} - -void ag71xx_phy_disconnect(struct ag71xx *ag) -{ - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - - if (pdata->switch_data) - ag71xx_ar7240_cleanup(ag); - else if (ag->phy_dev) - phy_disconnect(ag->phy_dev); -} diff --git a/target/linux/ar71xx/files-4.9/drivers/spi/spi-rb4xx-cpld.c b/target/linux/ar71xx/files-4.9/drivers/spi/spi-rb4xx-cpld.c deleted file mode 100644 index 18af83b67..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/spi/spi-rb4xx-cpld.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - * SPI driver for the CPLD chip on the Mikrotik RB4xx boards - * - * Copyright (C) 2010 Gabor Juhos - * - * This file was based on the patches for Linux 2.6.27.39 published by - * MikroTik for their RouterBoard 4xx series devices. - * - * 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 DRV_NAME "spi-rb4xx-cpld" -#define DRV_DESC "RB4xx CPLD driver" -#define DRV_VERSION "0.1.0" - -#define CPLD_CMD_WRITE_NAND 0x08 /* send cmd, n x send data, send indle */ -#define CPLD_CMD_WRITE_CFG 0x09 /* send cmd, n x send cfg */ -#define CPLD_CMD_READ_NAND 0x0a /* send cmd, send idle, n x read data */ -#define CPLD_CMD_READ_FAST 0x0b /* send cmd, 4 x idle, n x read data */ -#define CPLD_CMD_LED5_ON 0x0c /* send cmd */ -#define CPLD_CMD_LED5_OFF 0x0d /* send cmd */ - -struct rb4xx_cpld { - struct spi_device *spi; - struct mutex lock; - struct gpio_chip chip; - unsigned int config; -}; - -static struct rb4xx_cpld *rb4xx_cpld; - -static inline struct rb4xx_cpld *gpio_to_cpld(struct gpio_chip *chip) -{ - return container_of(chip, struct rb4xx_cpld, chip); -} - -static int rb4xx_cpld_write_cmd(struct rb4xx_cpld *cpld, unsigned char cmd) -{ - struct spi_transfer t[1]; - struct spi_message m; - unsigned char tx_buf[1]; - int err; - - spi_message_init(&m); - memset(&t, 0, sizeof(t)); - - t[0].tx_buf = tx_buf; - t[0].len = sizeof(tx_buf); - spi_message_add_tail(&t[0], &m); - - tx_buf[0] = cmd; - - err = spi_sync(cpld->spi, &m); - return err; -} - -static int rb4xx_cpld_write_cfg(struct rb4xx_cpld *cpld, unsigned char config) -{ - struct spi_transfer t[1]; - struct spi_message m; - unsigned char cmd[2]; - int err; - - spi_message_init(&m); - memset(&t, 0, sizeof(t)); - - t[0].tx_buf = cmd; - t[0].len = sizeof(cmd); - spi_message_add_tail(&t[0], &m); - - cmd[0] = CPLD_CMD_WRITE_CFG; - cmd[1] = config; - - err = spi_sync(cpld->spi, &m); - return err; -} - -static int __rb4xx_cpld_change_cfg(struct rb4xx_cpld *cpld, unsigned mask, - unsigned value) -{ - unsigned int config; - int err; - - config = cpld->config & ~mask; - config |= value; - - if ((cpld->config ^ config) & 0xff) { - err = rb4xx_cpld_write_cfg(cpld, config); - if (err) - return err; - } - - if ((cpld->config ^ config) & CPLD_CFG_nLED5) { - err = rb4xx_cpld_write_cmd(cpld, (value) ? CPLD_CMD_LED5_ON : - CPLD_CMD_LED5_OFF); - if (err) - return err; - } - - cpld->config = config; - return 0; -} - -int rb4xx_cpld_change_cfg(unsigned mask, unsigned value) -{ - int ret; - - if (rb4xx_cpld == NULL) - return -ENODEV; - - mutex_lock(&rb4xx_cpld->lock); - ret = __rb4xx_cpld_change_cfg(rb4xx_cpld, mask, value); - mutex_unlock(&rb4xx_cpld->lock); - - return ret; -} -EXPORT_SYMBOL_GPL(rb4xx_cpld_change_cfg); - -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] = { - { - .tx_buf = &cmd, - .len = 2, - }, { - .rx_buf = rx_buf, - .len = count, - }, - }; - struct spi_message m; - - if (rb4xx_cpld == NULL) - return -ENODEV; - - spi_message_init(&m); - 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); - -int rb4xx_cpld_write(const unsigned char *buf, unsigned count) -{ - static const unsigned char cmd = CPLD_CMD_WRITE_NAND; - struct spi_transfer t[3] = { - { - .tx_buf = &cmd, - .len = 1, - }, { - .tx_buf = buf, - .len = count, - .tx_nbits = SPI_NBITS_DUAL, - }, { - .len = 1, - .tx_nbits = SPI_NBITS_DUAL, - }, - }; - struct spi_message m; - - if (rb4xx_cpld == NULL) - return -ENODEV; - - spi_message_init(&m); - spi_message_add_tail(&t[0], &m); - spi_message_add_tail(&t[1], &m); - spi_message_add_tail(&t[2], &m); - return spi_sync(rb4xx_cpld->spi, &m); -} -EXPORT_SYMBOL_GPL(rb4xx_cpld_write); - -static int rb4xx_cpld_gpio_get(struct gpio_chip *chip, unsigned offset) -{ - struct rb4xx_cpld *cpld = gpio_to_cpld(chip); - int ret; - - mutex_lock(&cpld->lock); - ret = (cpld->config >> offset) & 1; - mutex_unlock(&cpld->lock); - - return ret; -} - -static void rb4xx_cpld_gpio_set(struct gpio_chip *chip, unsigned offset, - int value) -{ - struct rb4xx_cpld *cpld = gpio_to_cpld(chip); - - mutex_lock(&cpld->lock); - __rb4xx_cpld_change_cfg(cpld, (1 << offset), !!value << offset); - mutex_unlock(&cpld->lock); -} - -static int rb4xx_cpld_gpio_direction_input(struct gpio_chip *chip, - unsigned offset) -{ - return -EOPNOTSUPP; -} - -static int rb4xx_cpld_gpio_direction_output(struct gpio_chip *chip, - unsigned offset, - int value) -{ - struct rb4xx_cpld *cpld = gpio_to_cpld(chip); - int ret; - - mutex_lock(&cpld->lock); - ret = __rb4xx_cpld_change_cfg(cpld, (1 << offset), !!value << offset); - mutex_unlock(&cpld->lock); - - return ret; -} - -static int rb4xx_cpld_gpio_init(struct rb4xx_cpld *cpld, unsigned int base) -{ - int err; - - /* init config */ - cpld->config = CPLD_CFG_nLED1 | CPLD_CFG_nLED2 | CPLD_CFG_nLED3 | - CPLD_CFG_nLED4 | CPLD_CFG_nCE; - rb4xx_cpld_write_cfg(cpld, cpld->config); - - /* setup GPIO chip */ - cpld->chip.label = DRV_NAME; - - cpld->chip.get = rb4xx_cpld_gpio_get; - cpld->chip.set = rb4xx_cpld_gpio_set; - cpld->chip.direction_input = rb4xx_cpld_gpio_direction_input; - cpld->chip.direction_output = rb4xx_cpld_gpio_direction_output; - - cpld->chip.base = base; - cpld->chip.ngpio = CPLD_NUM_GPIOS; - cpld->chip.can_sleep = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - cpld->chip.dev = &cpld->spi->dev; -#else - cpld->chip.parent = &cpld->spi->dev; -#endif - cpld->chip.owner = THIS_MODULE; - - err = gpiochip_add(&cpld->chip); - if (err) - dev_err(&cpld->spi->dev, "adding GPIO chip failed, err=%d\n", - err); - - return err; -} - -static int rb4xx_cpld_probe(struct spi_device *spi) -{ - struct rb4xx_cpld *cpld; - struct rb4xx_cpld_platform_data *pdata; - int err; - - pdata = spi->dev.platform_data; - if (!pdata) { - dev_dbg(&spi->dev, "no platform data\n"); - return -EINVAL; - } - - cpld = kzalloc(sizeof(*cpld), GFP_KERNEL); - if (!cpld) { - dev_err(&spi->dev, "no memory for private data\n"); - return -ENOMEM; - } - - mutex_init(&cpld->lock); - cpld->spi = spi_dev_get(spi); - dev_set_drvdata(&spi->dev, cpld); - - spi->mode = SPI_MODE_0 | SPI_TX_DUAL; - spi->bits_per_word = 8; - err = spi_setup(spi); - if (err) { - dev_err(&spi->dev, "spi_setup failed, err=%d\n", err); - goto err_drvdata; - } - - err = rb4xx_cpld_gpio_init(cpld, pdata->gpio_base); - if (err) - goto err_drvdata; - - rb4xx_cpld = cpld; - - return 0; - -err_drvdata: - dev_set_drvdata(&spi->dev, NULL); - kfree(cpld); - - return err; -} - -static int rb4xx_cpld_remove(struct spi_device *spi) -{ - struct rb4xx_cpld *cpld; - - rb4xx_cpld = NULL; - cpld = dev_get_drvdata(&spi->dev); - dev_set_drvdata(&spi->dev, NULL); - kfree(cpld); - - return 0; -} - -static struct spi_driver rb4xx_cpld_driver = { - .driver = { - .name = DRV_NAME, - .bus = &spi_bus_type, - .owner = THIS_MODULE, - }, - .probe = rb4xx_cpld_probe, - .remove = rb4xx_cpld_remove, -}; - -static int __init rb4xx_cpld_init(void) -{ - return spi_register_driver(&rb4xx_cpld_driver); -} -module_init(rb4xx_cpld_init); - -static void __exit rb4xx_cpld_exit(void) -{ - spi_unregister_driver(&rb4xx_cpld_driver); -} -module_exit(rb4xx_cpld_exit); - -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ar71xx/files-4.9/drivers/spi/spi-rb4xx.c b/target/linux/ar71xx/files-4.9/drivers/spi/spi-rb4xx.c deleted file mode 100644 index 2d95e8049..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/spi/spi-rb4xx.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * SPI controller driver for the Mikrotik RB4xx boards - * - * Copyright (C) 2010 Gabor Juhos - * - * This file was based on the patches for Linux 2.6.27.39 published by - * MikroTik for their RouterBoard 4xx series devices. - * - * 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 DRV_NAME "rb4xx-spi" -#define DRV_DESC "Mikrotik RB4xx SPI controller driver" -#define DRV_VERSION "0.1.0" - -#define SPI_CTRL_FASTEST 0x40 -#define SPI_FLASH_HZ 33333334 -#define SPI_CPLD_HZ 33333334 - -#define CPLD_CMD_READ_FAST 0x0b - -#undef RB4XX_SPI_DEBUG - -struct rb4xx_spi { - void __iomem *base; - struct spi_master *master; - - unsigned spi_ctrl_flash; - unsigned spi_ctrl_fread; - - struct clk *ahb_clk; - unsigned long ahb_freq; - - spinlock_t lock; - struct list_head queue; - int busy:1; - int cs_wait; -}; - -static unsigned spi_clk_low = AR71XX_SPI_IOC_CS1; - -#ifdef RB4XX_SPI_DEBUG -static inline void do_spi_delay(void) -{ - ndelay(20000); -} -#else -static inline void do_spi_delay(void) { } -#endif - -static inline void do_spi_init(struct spi_device *spi) -{ - unsigned cs = AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1; - - if (!(spi->mode & SPI_CS_HIGH)) - cs ^= (spi->chip_select == 2) ? AR71XX_SPI_IOC_CS1 : - AR71XX_SPI_IOC_CS0; - - spi_clk_low = cs; -} - -static inline void do_spi_finish(void __iomem *base) -{ - do_spi_delay(); - __raw_writel(AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1, - base + AR71XX_SPI_REG_IOC); -} - -static inline void do_spi_clk(void __iomem *base, int bit) -{ - unsigned bval = spi_clk_low | ((bit & 1) ? AR71XX_SPI_IOC_DO : 0); - - do_spi_delay(); - __raw_writel(bval, base + AR71XX_SPI_REG_IOC); - do_spi_delay(); - __raw_writel(bval | AR71XX_SPI_IOC_CLK, base + AR71XX_SPI_REG_IOC); -} - -static void do_spi_byte(void __iomem *base, unsigned char byte) -{ - do_spi_clk(base, byte >> 7); - do_spi_clk(base, byte >> 6); - do_spi_clk(base, byte >> 5); - do_spi_clk(base, byte >> 4); - do_spi_clk(base, byte >> 3); - do_spi_clk(base, byte >> 2); - do_spi_clk(base, byte >> 1); - do_spi_clk(base, byte); - - pr_debug("spi_byte sent 0x%02x got 0x%02x\n", - (unsigned)byte, - (unsigned char)__raw_readl(base + AR71XX_SPI_REG_RDS)); -} - -static inline void do_spi_clk_fast(void __iomem *base, unsigned bit1, - unsigned bit2) -{ - unsigned bval = (spi_clk_low | - ((bit1 & 1) ? AR71XX_SPI_IOC_DO : 0) | - ((bit2 & 1) ? AR71XX_SPI_IOC_CS2 : 0)); - do_spi_delay(); - __raw_writel(bval, base + AR71XX_SPI_REG_IOC); - do_spi_delay(); - __raw_writel(bval | AR71XX_SPI_IOC_CLK, base + AR71XX_SPI_REG_IOC); -} - -static void do_spi_byte_fast(void __iomem *base, unsigned char byte) -{ - do_spi_clk_fast(base, byte >> 7, byte >> 6); - do_spi_clk_fast(base, byte >> 5, byte >> 4); - do_spi_clk_fast(base, byte >> 3, byte >> 2); - do_spi_clk_fast(base, byte >> 1, byte >> 0); - - pr_debug("spi_byte_fast sent 0x%02x got 0x%02x\n", - (unsigned)byte, - (unsigned char) __raw_readl(base + AR71XX_SPI_REG_RDS)); -} - -static int rb4xx_spi_txrx(void __iomem *base, struct spi_transfer *t) -{ - const unsigned char *tx_ptr = t->tx_buf; - unsigned char *rx_ptr = t->rx_buf; - unsigned i; - - pr_debug("spi_txrx len %u tx %u rx %u\n", - t->len, - (t->tx_buf ? 1 : 0), - (t->rx_buf ? 1 : 0)); - - for (i = 0; i < t->len; ++i) { - unsigned char sdata = tx_ptr ? tx_ptr[i] : 0; - - if (t->tx_nbits == SPI_NBITS_DUAL) - do_spi_byte_fast(base, sdata); - else - do_spi_byte(base, sdata); - - if (rx_ptr) - rx_ptr[i] = __raw_readl(base + AR71XX_SPI_REG_RDS) & 0xff; - } - - return i; -} - -static int rb4xx_spi_msg(struct rb4xx_spi *rbspi, struct spi_message *m) -{ - struct spi_transfer *t = NULL; - void __iomem *base = rbspi->base; - - m->status = 0; - if (list_empty(&m->transfers)) - 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); - - list_for_each_entry(t, &m->transfers, transfer_list) { - int len; - - len = rb4xx_spi_txrx(base, t); - if (len != t->len) { - m->status = -EMSGSIZE; - break; - } - m->actual_length += len; - - if (t->cs_change) { - if (list_is_last(&t->transfer_list, &m->transfers)) { - /* wait for continuation */ - return m->spi->chip_select; - } - do_spi_finish(base); - ndelay(100); - } - } - - do_spi_finish(base); - __raw_writel(rbspi->spi_ctrl_flash, base + AR71XX_SPI_REG_CTRL); - __raw_writel(0, base + AR71XX_SPI_REG_FS); - return -1; -} - -static void rb4xx_spi_process_queue_locked(struct rb4xx_spi *rbspi, - unsigned long *flags) -{ - int cs = rbspi->cs_wait; - - rbspi->busy = 1; - while (!list_empty(&rbspi->queue)) { - struct spi_message *m; - - list_for_each_entry(m, &rbspi->queue, queue) - if (cs < 0 || cs == m->spi->chip_select) - break; - - if (&m->queue == &rbspi->queue) - break; - - list_del_init(&m->queue); - spin_unlock_irqrestore(&rbspi->lock, *flags); - - cs = rb4xx_spi_msg(rbspi, m); - m->complete(m->context); - - spin_lock_irqsave(&rbspi->lock, *flags); - } - - rbspi->cs_wait = cs; - rbspi->busy = 0; - - if (cs >= 0) { - /* TODO: add timer to unlock cs after 1s inactivity */ - } -} - -static int rb4xx_spi_transfer(struct spi_device *spi, - struct spi_message *m) -{ - struct rb4xx_spi *rbspi = spi_master_get_devdata(spi->master); - unsigned long flags; - - m->actual_length = 0; - m->status = -EINPROGRESS; - - spin_lock_irqsave(&rbspi->lock, flags); - list_add_tail(&m->queue, &rbspi->queue); - if (rbspi->busy || - (rbspi->cs_wait >= 0 && rbspi->cs_wait != m->spi->chip_select)) { - /* job will be done later */ - spin_unlock_irqrestore(&rbspi->lock, flags); - return 0; - } - - /* process job in current context */ - rb4xx_spi_process_queue_locked(rbspi, &flags); - spin_unlock_irqrestore(&rbspi->lock, flags); - - return 0; -} - -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 | SPI_TX_DUAL)) { - dev_err(&spi->dev, "mode %x not supported\n", - (unsigned) spi->mode); - return -EINVAL; - } - - if (spi->bits_per_word != 8 && spi->bits_per_word != 0) { - dev_err(&spi->dev, "bits_per_word %u not supported\n", - (unsigned) spi->bits_per_word); - return -EINVAL; - } - - spin_lock_irqsave(&rbspi->lock, flags); - if (rbspi->cs_wait == spi->chip_select && !rbspi->busy) { - rbspi->cs_wait = -1; - rb4xx_spi_process_queue_locked(rbspi, &flags); - } - spin_unlock_irqrestore(&rbspi->lock, flags); - - return 0; -} - -static unsigned get_spi_ctrl(struct rb4xx_spi *rbspi, unsigned hz_max, - const char *name) -{ - unsigned div; - - div = (rbspi->ahb_freq - 1) / (2 * hz_max); - - /* - * CPU has a bug at (div == 0) - first bit read is random - */ - if (div == 0) - ++div; - - if (name) { - unsigned ahb_khz = (rbspi->ahb_freq + 500) / 1000; - unsigned div_real = 2 * (div + 1); - pr_debug("rb4xx: %s SPI clock %u kHz (AHB %u kHz / %u)\n", - name, - ahb_khz / div_real, - ahb_khz, div_real); - } - - return SPI_CTRL_FASTEST + div; -} - -static int rb4xx_spi_probe(struct platform_device *pdev) -{ - struct spi_master *master; - struct rb4xx_spi *rbspi; - struct resource *r; - int err = 0; - - master = spi_alloc_master(&pdev->dev, sizeof(*rbspi)); - if (master == NULL) { - dev_err(&pdev->dev, "no memory for spi_master\n"); - err = -ENOMEM; - goto err_out; - } - - master->bus_num = 0; - master->num_chipselect = 3; - master->mode_bits = SPI_TX_DUAL; - master->setup = rb4xx_spi_setup; - master->transfer = rb4xx_spi_transfer; - - rbspi = spi_master_get_devdata(master); - - rbspi->ahb_clk = clk_get(&pdev->dev, "ahb"); - if (IS_ERR(rbspi->ahb_clk)) { - err = PTR_ERR(rbspi->ahb_clk); - goto err_put_master; - } - - err = clk_prepare_enable(rbspi->ahb_clk); - if (err) - goto err_clk_put; - - rbspi->ahb_freq = clk_get_rate(rbspi->ahb_clk); - if (!rbspi->ahb_freq) { - err = -EINVAL; - goto err_clk_disable; - } - - platform_set_drvdata(pdev, rbspi); - - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (r == NULL) { - err = -ENOENT; - goto err_clk_disable; - } - - rbspi->base = ioremap(r->start, r->end - r->start + 1); - if (!rbspi->base) { - err = -ENXIO; - goto err_clk_disable; - } - - rbspi->master = master; - rbspi->spi_ctrl_flash = get_spi_ctrl(rbspi, SPI_FLASH_HZ, "FLASH"); - rbspi->spi_ctrl_fread = get_spi_ctrl(rbspi, SPI_CPLD_HZ, "CPLD"); - rbspi->cs_wait = -1; - - spin_lock_init(&rbspi->lock); - INIT_LIST_HEAD(&rbspi->queue); - - err = spi_register_master(master); - if (err) { - dev_err(&pdev->dev, "failed to register SPI master\n"); - goto err_iounmap; - } - - return 0; - -err_iounmap: - iounmap(rbspi->base); -err_clk_disable: - clk_disable_unprepare(rbspi->ahb_clk); -err_clk_put: - clk_put(rbspi->ahb_clk); -err_put_master: - platform_set_drvdata(pdev, NULL); - spi_master_put(master); -err_out: - return err; -} - -static int rb4xx_spi_remove(struct platform_device *pdev) -{ - struct rb4xx_spi *rbspi = platform_get_drvdata(pdev); - - iounmap(rbspi->base); - clk_disable_unprepare(rbspi->ahb_clk); - clk_put(rbspi->ahb_clk); - platform_set_drvdata(pdev, NULL); - spi_master_put(rbspi->master); - - return 0; -} - -static struct platform_driver rb4xx_spi_drv = { - .probe = rb4xx_spi_probe, - .remove = rb4xx_spi_remove, - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, -}; - -static int __init rb4xx_spi_init(void) -{ - return platform_driver_register(&rb4xx_spi_drv); -} -subsys_initcall(rb4xx_spi_init); - -static void __exit rb4xx_spi_exit(void) -{ - platform_driver_unregister(&rb4xx_spi_drv); -} - -module_exit(rb4xx_spi_exit); - -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ar71xx/files-4.9/drivers/spi/spi-vsc7385.c b/target/linux/ar71xx/files-4.9/drivers/spi/spi-vsc7385.c deleted file mode 100644 index b712e7187..000000000 --- a/target/linux/ar71xx/files-4.9/drivers/spi/spi-vsc7385.c +++ /dev/null @@ -1,621 +0,0 @@ -/* - * SPI driver for the Vitesse VSC7385 ethernet switch - * - * Copyright (C) 2009 Gabor Juhos - * - * Parts of this file are based on Atheros' 2.6.15 BSP - * - * 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 DRV_NAME "spi-vsc7385" -#define DRV_DESC "Vitesse VSC7385 Gbit ethernet switch driver" -#define DRV_VERSION "0.1.0" - -#define VSC73XX_BLOCK_MAC 0x1 -#define VSC73XX_BLOCK_2 0x2 -#define VSC73XX_BLOCK_MII 0x3 -#define VSC73XX_BLOCK_4 0x4 -#define VSC73XX_BLOCK_5 0x5 -#define VSC73XX_BLOCK_SYSTEM 0x7 - -#define VSC73XX_SUBBLOCK_PORT_0 0 -#define VSC73XX_SUBBLOCK_PORT_1 1 -#define VSC73XX_SUBBLOCK_PORT_2 2 -#define VSC73XX_SUBBLOCK_PORT_3 3 -#define VSC73XX_SUBBLOCK_PORT_4 4 -#define VSC73XX_SUBBLOCK_PORT_MAC 6 - -/* MAC Block registers */ -#define VSC73XX_MAC_CFG 0x0 -#define VSC73XX_ADVPORTM 0x19 -#define VSC73XX_RXOCT 0x50 -#define VSC73XX_TXOCT 0x51 -#define VSC73XX_C_RX0 0x52 -#define VSC73XX_C_RX1 0x53 -#define VSC73XX_C_RX2 0x54 -#define VSC73XX_C_TX0 0x55 -#define VSC73XX_C_TX1 0x56 -#define VSC73XX_C_TX2 0x57 -#define VSC73XX_C_CFG 0x58 - -/* MAC_CFG register bits */ -#define VSC73XX_MAC_CFG_WEXC_DIS (1 << 31) -#define VSC73XX_MAC_CFG_PORT_RST (1 << 29) -#define VSC73XX_MAC_CFG_TX_EN (1 << 28) -#define VSC73XX_MAC_CFG_SEED_LOAD (1 << 27) -#define VSC73XX_MAC_CFG_FDX (1 << 18) -#define VSC73XX_MAC_CFG_GIGE (1 << 17) -#define VSC73XX_MAC_CFG_RX_EN (1 << 16) -#define VSC73XX_MAC_CFG_VLAN_DBLAWR (1 << 15) -#define VSC73XX_MAC_CFG_VLAN_AWR (1 << 14) -#define VSC73XX_MAC_CFG_100_BASE_T (1 << 13) -#define VSC73XX_MAC_CFG_TX_IPG(x) (((x) & 0x1f) << 6) -#define VSC73XX_MAC_CFG_MAC_RX_RST (1 << 5) -#define VSC73XX_MAC_CFG_MAC_TX_RST (1 << 4) -#define VSC73XX_MAC_CFG_BIT2 (1 << 2) -#define VSC73XX_MAC_CFG_CLK_SEL(x) ((x) & 0x3) - -/* ADVPORTM register bits */ -#define VSC73XX_ADVPORTM_IFG_PPM (1 << 7) -#define VSC73XX_ADVPORTM_EXC_COL_CONT (1 << 6) -#define VSC73XX_ADVPORTM_EXT_PORT (1 << 5) -#define VSC73XX_ADVPORTM_INV_GTX (1 << 4) -#define VSC73XX_ADVPORTM_ENA_GTX (1 << 3) -#define VSC73XX_ADVPORTM_DDR_MODE (1 << 2) -#define VSC73XX_ADVPORTM_IO_LOOPBACK (1 << 1) -#define VSC73XX_ADVPORTM_HOST_LOOPBACK (1 << 0) - -/* MII Block registers */ -#define VSC73XX_MII_STAT 0x0 -#define VSC73XX_MII_CMD 0x1 -#define VSC73XX_MII_DATA 0x2 - -/* System Block registers */ -#define VSC73XX_ICPU_SIPAD 0x01 -#define VSC73XX_ICPU_CLOCK_DELAY 0x05 -#define VSC73XX_ICPU_CTRL 0x10 -#define VSC73XX_ICPU_ADDR 0x11 -#define VSC73XX_ICPU_SRAM 0x12 -#define VSC73XX_ICPU_MBOX_VAL 0x15 -#define VSC73XX_ICPU_MBOX_SET 0x16 -#define VSC73XX_ICPU_MBOX_CLR 0x17 -#define VSC73XX_ICPU_CHIPID 0x18 -#define VSC73XX_ICPU_GPIO 0x34 - -#define VSC73XX_ICPU_CTRL_CLK_DIV (1 << 8) -#define VSC73XX_ICPU_CTRL_SRST_HOLD (1 << 7) -#define VSC73XX_ICPU_CTRL_BOOT_EN (1 << 3) -#define VSC73XX_ICPU_CTRL_EXT_ACC_EN (1 << 2) -#define VSC73XX_ICPU_CTRL_CLK_EN (1 << 1) -#define VSC73XX_ICPU_CTRL_SRST (1 << 0) - -#define VSC73XX_ICPU_CHIPID_ID_SHIFT 12 -#define VSC73XX_ICPU_CHIPID_ID_MASK 0xffff -#define VSC73XX_ICPU_CHIPID_REV_SHIFT 28 -#define VSC73XX_ICPU_CHIPID_REV_MASK 0xf -#define VSC73XX_ICPU_CHIPID_ID_7385 0x7385 -#define VSC73XX_ICPU_CHIPID_ID_7395 0x7395 - -#define VSC73XX_CMD_MODE_READ 0 -#define VSC73XX_CMD_MODE_WRITE 1 -#define VSC73XX_CMD_MODE_SHIFT 4 -#define VSC73XX_CMD_BLOCK_SHIFT 5 -#define VSC73XX_CMD_BLOCK_MASK 0x7 -#define VSC73XX_CMD_SUBBLOCK_MASK 0xf - -#define VSC7385_CLOCK_DELAY ((3 << 4) | 3) -#define VSC7385_CLOCK_DELAY_MASK ((3 << 4) | 3) - -#define VSC73XX_ICPU_CTRL_STOP (VSC73XX_ICPU_CTRL_SRST_HOLD | \ - VSC73XX_ICPU_CTRL_BOOT_EN | \ - VSC73XX_ICPU_CTRL_EXT_ACC_EN) - -#define VSC73XX_ICPU_CTRL_START (VSC73XX_ICPU_CTRL_CLK_DIV | \ - VSC73XX_ICPU_CTRL_BOOT_EN | \ - VSC73XX_ICPU_CTRL_CLK_EN | \ - VSC73XX_ICPU_CTRL_SRST) - -#define VSC7385_ADVPORTM_MASK (VSC73XX_ADVPORTM_IFG_PPM | \ - VSC73XX_ADVPORTM_EXC_COL_CONT | \ - VSC73XX_ADVPORTM_EXT_PORT | \ - VSC73XX_ADVPORTM_INV_GTX | \ - VSC73XX_ADVPORTM_ENA_GTX | \ - VSC73XX_ADVPORTM_DDR_MODE | \ - VSC73XX_ADVPORTM_IO_LOOPBACK | \ - VSC73XX_ADVPORTM_HOST_LOOPBACK) - -#define VSC7385_ADVPORTM_INIT (VSC73XX_ADVPORTM_EXT_PORT | \ - VSC73XX_ADVPORTM_ENA_GTX | \ - VSC73XX_ADVPORTM_DDR_MODE) - -#define VSC7385_MAC_CFG_RESET (VSC73XX_MAC_CFG_PORT_RST | \ - VSC73XX_MAC_CFG_MAC_RX_RST | \ - VSC73XX_MAC_CFG_MAC_TX_RST) - -#define VSC73XX_MAC_CFG_INIT (VSC73XX_MAC_CFG_TX_EN | \ - VSC73XX_MAC_CFG_FDX | \ - VSC73XX_MAC_CFG_GIGE | \ - VSC73XX_MAC_CFG_RX_EN) - -#define VSC73XX_RESET_DELAY 100 - -struct vsc7385 { - struct spi_device *spi; - struct mutex lock; - struct vsc7385_platform_data *pdata; -}; - -static int vsc7385_is_addr_valid(u8 block, u8 subblock) -{ - switch (block) { - case VSC73XX_BLOCK_MAC: - switch (subblock) { - case 0 ... 4: - case 6: - return 1; - } - break; - - case VSC73XX_BLOCK_2: - case VSC73XX_BLOCK_SYSTEM: - switch (subblock) { - case 0: - return 1; - } - break; - - case VSC73XX_BLOCK_MII: - case VSC73XX_BLOCK_4: - case VSC73XX_BLOCK_5: - switch (subblock) { - case 0 ... 1: - return 1; - } - break; - } - - return 0; -} - -static inline u8 vsc7385_make_addr(u8 mode, u8 block, u8 subblock) -{ - u8 ret; - - ret = (block & VSC73XX_CMD_BLOCK_MASK) << VSC73XX_CMD_BLOCK_SHIFT; - ret |= (mode & 1) << VSC73XX_CMD_MODE_SHIFT; - ret |= subblock & VSC73XX_CMD_SUBBLOCK_MASK; - - return ret; -} - -static int vsc7385_read(struct vsc7385 *vsc, u8 block, u8 subblock, u8 reg, - u32 *value) -{ - u8 cmd[4]; - u8 buf[4]; - struct spi_transfer t[2]; - struct spi_message m; - int err; - - if (!vsc7385_is_addr_valid(block, subblock)) - return -EINVAL; - - spi_message_init(&m); - - memset(&t, 0, sizeof(t)); - - t[0].tx_buf = cmd; - t[0].len = sizeof(cmd); - spi_message_add_tail(&t[0], &m); - - t[1].rx_buf = buf; - t[1].len = sizeof(buf); - spi_message_add_tail(&t[1], &m); - - cmd[0] = vsc7385_make_addr(VSC73XX_CMD_MODE_READ, block, subblock); - cmd[1] = reg; - cmd[2] = 0; - cmd[3] = 0; - - mutex_lock(&vsc->lock); - err = spi_sync(vsc->spi, &m); - mutex_unlock(&vsc->lock); - - if (err) - return err; - - *value = (((u32) buf[0]) << 24) | (((u32) buf[1]) << 16) | - (((u32) buf[2]) << 8) | ((u32) buf[3]); - - return 0; -} - - -static int vsc7385_write(struct vsc7385 *vsc, u8 block, u8 subblock, u8 reg, - u32 value) -{ - u8 cmd[2]; - u8 buf[4]; - struct spi_transfer t[2]; - struct spi_message m; - int err; - - if (!vsc7385_is_addr_valid(block, subblock)) - return -EINVAL; - - spi_message_init(&m); - - memset(&t, 0, sizeof(t)); - - t[0].tx_buf = cmd; - t[0].len = sizeof(cmd); - spi_message_add_tail(&t[0], &m); - - t[1].tx_buf = buf; - t[1].len = sizeof(buf); - spi_message_add_tail(&t[1], &m); - - cmd[0] = vsc7385_make_addr(VSC73XX_CMD_MODE_WRITE, block, subblock); - cmd[1] = reg; - - buf[0] = (value >> 24) & 0xff; - buf[1] = (value >> 16) & 0xff; - buf[2] = (value >> 8) & 0xff; - buf[3] = value & 0xff; - - mutex_lock(&vsc->lock); - err = spi_sync(vsc->spi, &m); - mutex_unlock(&vsc->lock); - - return err; -} - -static inline int vsc7385_write_verify(struct vsc7385 *vsc, u8 block, - u8 subblock, u8 reg, u32 value, - u32 read_mask, u32 read_val) -{ - struct spi_device *spi = vsc->spi; - u32 t; - int err; - - err = vsc7385_write(vsc, block, subblock, reg, value); - if (err) - return err; - - err = vsc7385_read(vsc, block, subblock, reg, &t); - if (err) - return err; - - if ((t & read_mask) != read_val) { - dev_err(&spi->dev, "register write error\n"); - return -EIO; - } - - return 0; -} - -static inline int vsc7385_set_clock_delay(struct vsc7385 *vsc, u32 val) -{ - return vsc7385_write(vsc, VSC73XX_BLOCK_SYSTEM, 0, - VSC73XX_ICPU_CLOCK_DELAY, val); -} - -static inline int vsc7385_get_clock_delay(struct vsc7385 *vsc, u32 *val) -{ - return vsc7385_read(vsc, VSC73XX_BLOCK_SYSTEM, 0, - VSC73XX_ICPU_CLOCK_DELAY, val); -} - -static inline int vsc7385_icpu_stop(struct vsc7385 *vsc) -{ - return vsc7385_write(vsc, VSC73XX_BLOCK_SYSTEM, 0, VSC73XX_ICPU_CTRL, - VSC73XX_ICPU_CTRL_STOP); -} - -static inline int vsc7385_icpu_start(struct vsc7385 *vsc) -{ - return vsc7385_write(vsc, VSC73XX_BLOCK_SYSTEM, 0, VSC73XX_ICPU_CTRL, - VSC73XX_ICPU_CTRL_START); -} - -static inline int vsc7385_icpu_reset(struct vsc7385 *vsc) -{ - int rc; - - rc = vsc7385_write(vsc, VSC73XX_BLOCK_SYSTEM, 0, VSC73XX_ICPU_ADDR, - 0x0000); - if (rc) - dev_err(&vsc->spi->dev, - "could not reset microcode, err=%d\n", rc); - - return rc; -} - -static int vsc7385_upload_ucode(struct vsc7385 *vsc) -{ - struct spi_device *spi = vsc->spi; - const struct firmware *firmware; - char *ucode_name; - unsigned char *dp; - unsigned int curVal; - int i; - int diffs; - int rc; - - ucode_name = (vsc->pdata->ucode_name) ? vsc->pdata->ucode_name - : "vsc7385_ucode.bin"; - rc = request_firmware(&firmware, ucode_name, &spi->dev); - if (rc) { - dev_err(&spi->dev, "request_firmware failed, err=%d\n", - rc); - return rc; - } - - rc = vsc7385_icpu_stop(vsc); - if (rc) - goto out; - - rc = vsc7385_icpu_reset(vsc); - if (rc) - goto out; - - dev_info(&spi->dev, "uploading microcode...\n"); - - dp = (unsigned char *) firmware->data; - for (i = 0; i < firmware->size; i++) { - rc = vsc7385_write(vsc, VSC73XX_BLOCK_SYSTEM, 0, - VSC73XX_ICPU_SRAM, *dp++); - if (rc) { - dev_err(&spi->dev, "could not load microcode, err=%d\n", - rc); - goto out; - } - } - - rc = vsc7385_icpu_reset(vsc); - if (rc) - goto out; - - dev_info(&spi->dev, "verifying microcode...\n"); - - dp = (unsigned char *) firmware->data; - diffs = 0; - for (i = 0; i < firmware->size; i++) { - rc = vsc7385_read(vsc, VSC73XX_BLOCK_SYSTEM, 0, - VSC73XX_ICPU_SRAM, &curVal); - if (rc) { - dev_err(&spi->dev, "could not read microcode %d\n", - rc); - goto out; - } - - if (curVal > 0xff) { - dev_err(&spi->dev, "bad val read: %04x : %02x %02x\n", - i, *dp, curVal); - rc = -EIO; - goto out; - } - - if ((curVal & 0xff) != *dp) { - diffs++; - dev_err(&spi->dev, "verify error: %04x : %02x %02x\n", - i, *dp, curVal); - - if (diffs > 4) - break; - } - dp++; - } - - if (diffs) { - dev_err(&spi->dev, "microcode verification failed\n"); - rc = -EIO; - goto out; - } - - dev_info(&spi->dev, "microcode uploaded\n"); - - rc = vsc7385_icpu_start(vsc); - -out: - release_firmware(firmware); - return rc; -} - -static int vsc7385_setup(struct vsc7385 *vsc) -{ - struct vsc7385_platform_data *pdata = vsc->pdata; - u32 t; - int err; - - err = vsc7385_write_verify(vsc, VSC73XX_BLOCK_SYSTEM, 0, - VSC73XX_ICPU_CLOCK_DELAY, - VSC7385_CLOCK_DELAY, - VSC7385_CLOCK_DELAY_MASK, - VSC7385_CLOCK_DELAY); - if (err) - goto err; - - err = vsc7385_write_verify(vsc, VSC73XX_BLOCK_MAC, - VSC73XX_SUBBLOCK_PORT_MAC, VSC73XX_ADVPORTM, - VSC7385_ADVPORTM_INIT, - VSC7385_ADVPORTM_MASK, - VSC7385_ADVPORTM_INIT); - if (err) - goto err; - - err = vsc7385_write(vsc, VSC73XX_BLOCK_MAC, VSC73XX_SUBBLOCK_PORT_MAC, - VSC73XX_MAC_CFG, VSC7385_MAC_CFG_RESET); - if (err) - goto err; - - t = VSC73XX_MAC_CFG_INIT; - t |= VSC73XX_MAC_CFG_TX_IPG(pdata->mac_cfg.tx_ipg); - t |= VSC73XX_MAC_CFG_CLK_SEL(pdata->mac_cfg.clk_sel); - if (pdata->mac_cfg.bit2) - t |= VSC73XX_MAC_CFG_BIT2; - - err = vsc7385_write(vsc, VSC73XX_BLOCK_MAC, VSC73XX_SUBBLOCK_PORT_MAC, - VSC73XX_MAC_CFG, t); - if (err) - goto err; - - return 0; - -err: - return err; -} - -static int vsc7385_detect(struct vsc7385 *vsc) -{ - struct spi_device *spi = vsc->spi; - u32 t; - u32 id; - u32 rev; - int err; - - err = vsc7385_read(vsc, VSC73XX_BLOCK_SYSTEM, 0, - VSC73XX_ICPU_MBOX_VAL, &t); - if (err) { - dev_err(&spi->dev, "unable to read mailbox, err=%d\n", err); - return err; - } - - if (t == 0xffffffff) { - dev_dbg(&spi->dev, "assert chip reset\n"); - if (vsc->pdata->reset) - vsc->pdata->reset(); - - } - - err = vsc7385_read(vsc, VSC73XX_BLOCK_SYSTEM, 0, - VSC73XX_ICPU_CHIPID, &t); - if (err) { - dev_err(&spi->dev, "unable to read chip id, err=%d\n", err); - return err; - } - - id = (t >> VSC73XX_ICPU_CHIPID_ID_SHIFT) & VSC73XX_ICPU_CHIPID_ID_MASK; - switch (id) { - case VSC73XX_ICPU_CHIPID_ID_7385: - case VSC73XX_ICPU_CHIPID_ID_7395: - break; - default: - dev_err(&spi->dev, "unsupported chip, id=%04x\n", id); - return -ENODEV; - } - - rev = (t >> VSC73XX_ICPU_CHIPID_REV_SHIFT) & - VSC73XX_ICPU_CHIPID_REV_MASK; - dev_info(&spi->dev, "VSC%04X (rev. %d) switch found\n", id, rev); - - return 0; -} - -static int vsc7385_probe(struct spi_device *spi) -{ - struct vsc7385 *vsc; - struct vsc7385_platform_data *pdata; - int err; - - printk(KERN_INFO DRV_DESC " version " DRV_VERSION"\n"); - - pdata = spi->dev.platform_data; - if (!pdata) { - dev_err(&spi->dev, "no platform data specified\n"); - return -ENODEV; - } - - vsc = kzalloc(sizeof(*vsc), GFP_KERNEL); - if (!vsc) { - dev_err(&spi->dev, "no memory for private data\n"); - return -ENOMEM; - } - - mutex_init(&vsc->lock); - vsc->pdata = pdata; - vsc->spi = spi_dev_get(spi); - dev_set_drvdata(&spi->dev, vsc); - - spi->mode = SPI_MODE_0; - spi->bits_per_word = 8; - err = spi_setup(spi); - if (err) { - dev_err(&spi->dev, "spi_setup failed, err=%d\n", err); - goto err_drvdata; - } - - err = vsc7385_detect(vsc); - if (err) { - dev_err(&spi->dev, "no chip found, err=%d\n", err); - goto err_drvdata; - } - - err = vsc7385_upload_ucode(vsc); - if (err) - goto err_drvdata; - - err = vsc7385_setup(vsc); - if (err) - goto err_drvdata; - - return 0; - -err_drvdata: - dev_set_drvdata(&spi->dev, NULL); - kfree(vsc); - return err; -} - -static int vsc7385_remove(struct spi_device *spi) -{ - struct vsc7385_data *vsc; - - vsc = dev_get_drvdata(&spi->dev); - dev_set_drvdata(&spi->dev, NULL); - kfree(vsc); - - return 0; -} - -static struct spi_driver vsc7385_driver = { - .driver = { - .name = DRV_NAME, - .bus = &spi_bus_type, - .owner = THIS_MODULE, - }, - .probe = vsc7385_probe, - .remove = vsc7385_remove, -}; - -static int __init vsc7385_init(void) -{ - return spi_register_driver(&vsc7385_driver); -} -module_init(vsc7385_init); - -static void __exit vsc7385_exit(void) -{ - spi_unregister_driver(&vsc7385_driver); -} -module_exit(vsc7385_exit); - -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_LICENSE("GPL v2"); - diff --git a/target/linux/ar71xx/files-4.9/include/linux/leds-nu801.h b/target/linux/ar71xx/files-4.9/include/linux/leds-nu801.h deleted file mode 100644 index 0fc310d27..000000000 --- a/target/linux/ar71xx/files-4.9/include/linux/leds-nu801.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __LEDS_NU801_H__ -#define __LEDS_NU801_H__ - -/* - * Definitions for LED driver for NU801 - * - * Kevin Paul Herbert - * Copyright (c) 2012, Meraki, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#include - -struct led_nu801_template { - const char *device_name; /* Name of the platform device */ - const char *name; /* Name of this LED chain */ - int num_leds; /* Number of LEDs in the chain */ - unsigned cki; /* GPIO pin for CKI */ - unsigned sdi; /* GPIO pin for SDI */ - int lei; /* GPIO pin for LEI; < 0 if none */ - u32 ndelay; /* Delay in nanoseconds */ - enum led_brightness init_brightness[3]; /* Default rgb state */ -#ifdef CONFIG_LEDS_TRIGGERS - const char *default_trigger; /* default trigger */ -#endif - const char *led_colors[3]; /* rgb color order */ -}; - -struct led_nu801_platform_data { - int num_controllers; /* Numnber of controllers */ - struct led_nu801_template *template; /* Template per controller */ -}; - -#endif /* __LEDS_NU801_H__ */ diff --git a/target/linux/ar71xx/files-4.9/include/linux/nxp_74hc153.h b/target/linux/ar71xx/files-4.9/include/linux/nxp_74hc153.h deleted file mode 100644 index 20b8845e5..000000000 --- a/target/linux/ar71xx/files-4.9/include/linux/nxp_74hc153.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * NXP 74HC153 - Dual 4-input multiplexer defines - * - * Copyright (C) 2010 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef _NXP_74HC153_H -#define _NXP_74HC153_H - -#define NXP_74HC153_DRIVER_NAME "nxp-74hc153" - -struct nxp_74hc153_platform_data { - unsigned gpio_base; - unsigned gpio_pin_s0; - unsigned gpio_pin_s1; - unsigned gpio_pin_1y; - unsigned gpio_pin_2y; -}; - -#endif /* _NXP_74HC153_H */ diff --git a/target/linux/ar71xx/files-4.9/include/linux/platform/ar934x_nfc.h b/target/linux/ar71xx/files-4.9/include/linux/platform/ar934x_nfc.h deleted file mode 100644 index 371aaee7f..000000000 --- a/target/linux/ar71xx/files-4.9/include/linux/platform/ar934x_nfc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Platform data definition for the built-in NAND controller of the - * Atheros AR934x SoCs - * - * Copyright (C) 2011-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. - */ - -#ifndef _AR934X_NFC_PLATFORM_H -#define _AR934X_NFC_PLATFORM_H - -#define AR934X_NFC_DRIVER_NAME "ar934x-nfc" - -struct mtd_info; -struct mtd_partition; - -enum ar934x_nfc_ecc_mode { - AR934X_NFC_ECC_SOFT = 0, - AR934X_NFC_ECC_HW, - AR934X_NFC_ECC_SOFT_BCH, -}; - -struct ar934x_nfc_platform_data { - const char *name; - struct mtd_partition *parts; - int nr_parts; - - bool swap_dma; - enum ar934x_nfc_ecc_mode ecc_mode; - - void (*hw_reset)(bool active); - void (*select_chip)(int chip_no); - int (*scan_fixup)(struct mtd_info *mtd); -}; - -#endif /* _AR934X_NFC_PLATFORM_H */ diff --git a/target/linux/ar71xx/files-4.9/include/linux/platform_data/gpio-latch.h b/target/linux/ar71xx/files-4.9/include/linux/platform_data/gpio-latch.h deleted file mode 100644 index 0450e679e..000000000 --- a/target/linux/ar71xx/files-4.9/include/linux/platform_data/gpio-latch.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _GPIO_LATCH_H_ -#define _GPIO_LATCH_H_ - -#define GPIO_LATCH_DRIVER_NAME "gpio-latch" - -struct gpio_latch_platform_data { - int base; - int num_gpios; - int *gpios; - int le_gpio_index; - bool le_active_low; -}; - -#endif /* _GPIO_LATCH_H_ */ diff --git a/target/linux/ar71xx/files-4.9/include/linux/platform_data/rb91x_nand.h b/target/linux/ar71xx/files-4.9/include/linux/platform_data/rb91x_nand.h deleted file mode 100644 index 5f17fb814..000000000 --- a/target/linux/ar71xx/files-4.9/include/linux/platform_data/rb91x_nand.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _RB91X_NAND_H_ -#define _RB91X_NAND_H_ - -#define RB91X_NAND_DRIVER_NAME "rb91x-nand" - -struct rb91x_nand_platform_data { - int gpio_nce; /* chip enable, active low */ - int gpio_ale; /* address latch enable */ - int gpio_cle; /* command latch enable */ - int gpio_rdy; - int gpio_read; - int gpio_nrw; /* read/write enable, active low */ - int gpio_nle; /* latch enable, active low */ -}; - -#endif /* _RB91X_NAND_H_ */ \ No newline at end of file diff --git a/target/linux/ar71xx/files-4.9/include/linux/spi/vsc7385.h b/target/linux/ar71xx/files-4.9/include/linux/spi/vsc7385.h deleted file mode 100644 index 1072ad794..000000000 --- a/target/linux/ar71xx/files-4.9/include/linux/spi/vsc7385.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Platform data definition for the Vitesse VSC7385 ethernet switch 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. - */ - -struct vsc7385_platform_data { - void (*reset)(void); - char *ucode_name; - struct { - u32 tx_ipg:5; - u32 bit2:1; - u32 clk_sel:3; - } mac_cfg; -}; diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt similarity index 99% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/Kconfig.openwrt rename to target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index a992277b1..e7655b3c0 100644 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -194,16 +194,6 @@ config ATH79_MACH_AP147 select ATH79_DEV_WMAC select ATH79_DEV_AP9X_PCI if PCI -config ATH79_MACH_AC9531 - bool "Atheros AC9531 reference board" - select SOC_QCA953X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_DEV_AP9X_PCI if PCI - config ATH79_MACH_AP152 bool "Atheros AP152 reference board" select SOC_QCA956X @@ -721,6 +711,17 @@ config ATH79_MACH_E2100L select ATH79_DEV_WMAC select ATH79_NVRAM +config ATH79_MACH_E558_V2 + bool "Qxwlan E558 v2 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_USB + select ATH79_DEV_WMAC + config ATH79_MACH_E600G_V2 bool "Qxwlan E600G/E600GAC v2 support" select SOC_QCA953X @@ -732,6 +733,28 @@ config ATH79_MACH_E600G_V2 select ATH79_DEV_USB select ATH79_DEV_WMAC +config ATH79_MACH_E750A_V4 + bool "Qxwlan E750A v4 support" + select SOC_AR934X + 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_E750G_V8 + bool "Qxwlan E750G v8 support" + select SOC_AR934X + 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_ESR900 bool "EnGenius ESR900 board support" select SOC_QCA955X @@ -824,17 +847,6 @@ config ATH79_MACH_GL_AR750 select ATH79_DEV_USB select ATH79_DEV_WMAC -config ATH79_MACH_GL_AR750S - bool "GL.iNet GL-AR750S 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_GL_DOMINO bool "DOMINO support" select SOC_AR933X @@ -980,16 +992,6 @@ config ATH79_MACH_KOALA select ATH79_DEV_M25P80 select ATH79_DEV_WMAC -config ATH79_MACH_K2T - bool "Phicomm K2T A1/A2/A3 board" - select SOC_QCA956X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_M25P80 - select ATH79_DEV_USB - select ATH79_DEV_WMAC - select ATH79_DEV_AP9X_PCI if PCI - config ATH79_MACH_WAM250 bool "Samsung WAM250 support" select SOC_AR934X @@ -1604,6 +1606,7 @@ config ATH79_MACH_CPE505N config ATH79_MACH_CPE510 bool "TP-LINK CPE510 support" select SOC_AR934X + select SOC_QCA953X select ATH79_DEV_ETH select ATH79_DEV_GPIO_BUTTONS select ATH79_DEV_LEDS_GPIO @@ -1804,17 +1807,6 @@ config ATH79_MACH_TL_WDR4300 select ATH79_DEV_USB select ATH79_DEV_WMAC -config ATH79_MACH_TL_WDX6501_V7 - bool "TP-LINK TL-WDX6501 v7 board 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_WDR6500_V2 bool "TP-LINK TL-WDR6500 v2 board support" select SOC_QCA956X @@ -2418,3 +2410,12 @@ config ATH79_MACH_FRITZ4020 select ATH79_DEV_LEDS_GPIO select ATH79_DEV_USB select ATH79_DEV_M25P80 + +config ATH79_MACH_FRITZ450E + bool "AVM FRITZ!WLAN Repeater 450E support" + select SOC_QCA955X + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_WMAC diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile similarity index 98% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/Makefile rename to target/linux/ar71xx/files/arch/mips/ath79/Makefile index 79f19f728..8800a7de1 100644 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -59,7 +59,6 @@ obj-$(CONFIG_ATH79_MACH_AP531B0) += mach-ap531b0.o obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o obj-$(CONFIG_ATH79_MACH_AP91_5G) += mach-ap91-5g.o obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o -obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1) += mach-archer-c25-v1.o obj-$(CONFIG_ATH79_MACH_ARCHER_C58_V1) += mach-archer-c59-v1.o obj-$(CONFIG_ATH79_MACH_ARCHER_C59_V1) += mach-archer-c59-v1.o @@ -67,6 +66,7 @@ obj-$(CONFIG_ATH79_MACH_ARCHER_C60_V1) += mach-archer-c60-v1.o obj-$(CONFIG_ATH79_MACH_ARCHER_C60_V2) += mach-archer-c60-v1.o obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7.o obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7-v4.o +obj-$(CONFIG_ATH79_MACH_ARCHER_C7) += mach-archer-c7-v5.o obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN) += mach-arduino-yun.o obj-$(CONFIG_ATH79_MACH_AW_NR580) += mach-aw-nr580.o obj-$(CONFIG_ATH79_MACH_BHR_4GRV2) += mach-bhr-4grv2.o @@ -112,7 +112,10 @@ obj-$(CONFIG_ATH79_MACH_DR344) += mach-dr344.o obj-$(CONFIG_ATH79_MACH_DR531) += mach-dr531.o obj-$(CONFIG_ATH79_MACH_DRAGINO2) += mach-dragino2.o obj-$(CONFIG_ATH79_MACH_E1700AC_V2) += mach-e1700ac-v2.o +obj-$(CONFIG_ATH79_MACH_E558_V2) += mach-e558-v2.o obj-$(CONFIG_ATH79_MACH_E600G_V2) += mach-e600g-v2.o +obj-$(CONFIG_ATH79_MACH_E750A_V4) += mach-e750a-v4.o +obj-$(CONFIG_ATH79_MACH_E750G_V8) += mach-e750g-v8.o obj-$(CONFIG_ATH79_MACH_EAP120) += mach-eap120.o obj-$(CONFIG_ATH79_MACH_EAP300V2) += mach-eap300v2.o obj-$(CONFIG_ATH79_MACH_EAP7660D) += mach-eap7660d.o @@ -127,11 +130,11 @@ obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.o obj-$(CONFIG_ATH79_MACH_F9K1115V2) += mach-f9k1115v2.o obj-$(CONFIG_ATH79_MACH_FRITZ300E) += mach-fritz300e.o obj-$(CONFIG_ATH79_MACH_FRITZ4020) += mach-fritz4020.o +obj-$(CONFIG_ATH79_MACH_FRITZ450E) += mach-fritz450e.o obj-$(CONFIG_ATH79_MACH_GL_AR150) += mach-gl-ar150.o obj-$(CONFIG_ATH79_MACH_GL_AR300) += mach-gl-ar300.o obj-$(CONFIG_ATH79_MACH_GL_AR300M) += mach-gl-ar300m.o obj-$(CONFIG_ATH79_MACH_GL_AR750) += mach-gl-ar750.o -obj-$(CONFIG_ATH79_MACH_GL_AR750S) += mach-gl-ar750s.o obj-$(CONFIG_ATH79_MACH_GL_DOMINO) += mach-gl-domino.o obj-$(CONFIG_ATH79_MACH_GL_INET) += mach-gl-inet.o obj-$(CONFIG_ATH79_MACH_GL_MIFI) += mach-gl-mifi.o @@ -145,7 +148,6 @@ obj-$(CONFIG_ATH79_MACH_JA76PF) += mach-ja76pf.o obj-$(CONFIG_ATH79_MACH_JWAP003) += mach-jwap003.o obj-$(CONFIG_ATH79_MACH_JWAP230) += mach-jwap230.o obj-$(CONFIG_ATH79_MACH_KOALA) += mach-koala.o -obj-$(CONFIG_ATH79_MACH_K2T) += mach-k2t.o obj-$(CONFIG_ATH79_MACH_LAN_TURTLE) += mach-lan-turtle.o obj-$(CONFIG_ATH79_MACH_LIMA) += mach-lima.o obj-$(CONFIG_ATH79_MACH_MC_MAC1200R) += mach-mc-mac1200r.o diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-ap9x-pci.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-ap9x-pci.c rename to target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-ap9x-pci.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-ap9x-pci.h rename to target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-dsa.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-dsa.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-dsa.c rename to target/linux/ar71xx/files/arch/mips/ath79/dev-dsa.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-dsa.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-dsa.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-dsa.h rename to target/linux/ar71xx/files/arch/mips/ath79/dev-dsa.h diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c similarity index 98% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-eth.c rename to target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index b46bab788..1e230bce6 100644 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -383,16 +383,26 @@ static void qca955x_set_speed_xmii(int speed) iounmap(base); } -static void qca955x_set_speed_sgmii(int speed) +static void qca955x_set_speed_sgmii(int id, int speed) { void __iomem *base; - u32 val = ath79_get_eth_pll(1, speed); + u32 val = ath79_get_eth_pll(id, speed); base = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE); __raw_writel(val, base + QCA955X_PLL_ETH_SGMII_CONTROL_REG); iounmap(base); } +static void qca9556_set_speed_sgmii(int speed) +{ + qca955x_set_speed_sgmii(0, speed); +} + +static void qca9558_set_speed_sgmii(int speed) +{ + qca955x_set_speed_sgmii(1, speed); +} + static void qca956x_set_speed_sgmii(int speed) { void __iomem *base; @@ -1028,10 +1038,14 @@ void __init ath79_register_eth(unsigned int id) pdata->reset_bit = QCA955X_RESET_GE0_MAC | QCA955X_RESET_GE0_MDIO; pdata->set_speed = qca955x_set_speed_xmii; + + /* QCA9556 only has SGMII interface */ + if (ath79_soc == ATH79_SOC_QCA9556) + pdata->set_speed = qca9556_set_speed_sgmii; } else { pdata->reset_bit = QCA955X_RESET_GE1_MAC | QCA955X_RESET_GE1_MDIO; - pdata->set_speed = qca955x_set_speed_sgmii; + pdata->set_speed = qca9558_set_speed_sgmii; } pdata->has_gbit = 1; diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-eth.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-eth.h rename to target/linux/ar71xx/files/arch/mips/ath79/dev-eth.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-m25p80.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-m25p80.c rename to target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-m25p80.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-m25p80.h rename to target/linux/ar71xx/files/arch/mips/ath79/dev-m25p80.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-nfc.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-nfc.c rename to target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-nfc.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/dev-nfc.h rename to target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.h diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-a60.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-a60.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-a60.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-a60.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-ap120c.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-ap120c.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-alfa-ap120c.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-ap120c.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-alfa-ap96.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-ap96.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-alfa-ap96.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-ap96.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-alfa-nx.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-nx.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-alfa-nx.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-alfa-nx.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-all0258n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-all0258n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-all0258n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-all0258n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-all0315n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-all0315n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-all0315n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-all0315n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-antminer-s1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-antminer-s1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-antminer-s1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-antminer-s1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-antminer-s3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-antminer-s3.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-antminer-s3.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-antminer-s3.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-antrouter-r1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-antrouter-r1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-antrouter-r1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-antrouter-r1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap121f.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap121f.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap121f.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap121f.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap132.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap132.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap132.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap132.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap143.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap143.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap143.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap143.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap147.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap147.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap147.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap147.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap152.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap152.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ap152.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap152.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap531b0.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap531b0.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap531b0.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap531b0.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap90q.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap90q.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap90q.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap90q.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap91-5g.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap91-5g.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap91-5g.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap91-5g.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap96.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap96.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ap96.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ap96.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c25-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c25-v1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c25-v1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c59-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c59-v1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c59-v1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c60-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c60-v1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c7-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c7-v4.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v4.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c7-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v5.c similarity index 55% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c7-v4.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v5.c index 2dcd66af5..a80e0bd94 100644 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-archer-c7-v4.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7-v5.c @@ -1,7 +1,7 @@ - /* * Atheros ARCHER_C7 reference board support * + * Copyright (c) 2018 Arvid E. Picciani * Copyright (c) 2017 Felix Fietkau * Copyright (c) 2014 The Linux Foundation. All rights reserved. * Copyright (c) 2012 Gabor Juhos @@ -42,29 +42,21 @@ #include "dev-wmac.h" -#define ARCHER_C7_GPIO_SHIFT_OE 1 -#define ARCHER_C7_GPIO_SHIFT_SER 14 -#define ARCHER_C7_GPIO_SHIFT_SRCLK 15 -#define ARCHER_C7_GPIO_SHIFT_RCLK 16 -#define ARCHER_C7_GPIO_SHIFT_SRCLR 21 - #define ARCHER_C7_GPIO_BTN_RESET 5 #define ARCHER_C7_GPIO_BTN_WPS_WIFI 2 #define ARCHER_C7_GPIO_LED_WLAN5 9 #define ARCHER_C7_GPIO_LED_POWER 6 -#define ARCHER_C7_GPIO_LED_USB1 7 -#define ARCHER_C7_GPIO_LED_USB2 8 - -#define ARCHER_C7_74HC_GPIO_BASE 32 -#define ARCHER_C7_GPIO_LED_WPS (ARCHER_C7_74HC_GPIO_BASE + 0) -#define ARCHER_C7_GPIO_LED_LAN1 (ARCHER_C7_74HC_GPIO_BASE + 1) -#define ARCHER_C7_GPIO_LED_LAN2 (ARCHER_C7_74HC_GPIO_BASE + 2) -#define ARCHER_C7_GPIO_LED_LAN3 (ARCHER_C7_74HC_GPIO_BASE + 3) -#define ARCHER_C7_GPIO_LED_LAN4 (ARCHER_C7_74HC_GPIO_BASE + 4) -#define ARCHER_C7_GPIO_LED_WAN_GREEN (ARCHER_C7_74HC_GPIO_BASE + 5) -#define ARCHER_C7_GPIO_LED_WAN_AMBER (ARCHER_C7_74HC_GPIO_BASE + 6) -#define ARCHER_C7_GPIO_LED_WLAN2 (ARCHER_C7_74HC_GPIO_BASE + 7) +#define ARCHER_C7_GPIO_LED_USB 7 +#define ARCHER_C7_GPIO_LED_WPS 1 +#define ARCHER_C7_GPIO_LED_LAN1 8 +#define ARCHER_C7_GPIO_LED_LAN2 17 +#define ARCHER_C7_GPIO_LED_LAN3 16 +#define ARCHER_C7_GPIO_LED_LAN4 15 +#define ARCHER_C7_GPIO_LED_WAN_GREEN 21 +#define ARCHER_C7_GPIO_LED_WAN_AMBER 20 +#define ARCHER_C7_GPIO_LED_WLAN2 14 +#define ARCHER_C7_GPIO_USB_PWR 19 #define ARCHER_C7_KEYS_POLL_INTERVAL 20 /* msecs */ #define ARCHER_C7_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C7_KEYS_POLL_INTERVAL) @@ -76,93 +68,55 @@ #define ARCHER_C7_GPIO_MDC 3 #define ARCHER_C7_GPIO_MDIO 4 -static struct spi_gpio_platform_data archer_c7_v4_spi_data = { - .sck = ARCHER_C7_GPIO_SHIFT_SRCLK, - .miso = SPI_GPIO_NO_MISO, - .mosi = ARCHER_C7_GPIO_SHIFT_SER, - .num_chipselect = 1, -}; - -static u8 archer_c7_v4_ssr_initdata = 0xff; - -static struct gen_74x164_chip_platform_data archer_c7_v4_ssr_data = { - .base = ARCHER_C7_74HC_GPIO_BASE, - .num_registers = 1, - .init_data = &archer_c7_v4_ssr_initdata, -}; - -static struct platform_device archer_c7_v4_spi_device = { - .name = "spi_gpio", - .id = 1, - .dev = { - .platform_data = &archer_c7_v4_spi_data, - }, -}; - -static struct spi_board_info archer_c7_v4_spi_info[] = { +static struct gpio_led archer_c7_v5_leds_gpio[] __initdata = { { - .bus_num = 1, - .chip_select = 0, - .max_speed_hz = 10000000, - .modalias = "74x164", - .platform_data = &archer_c7_v4_ssr_data, - .controller_data = (void *) ARCHER_C7_GPIO_SHIFT_RCLK, - }, -}; - -static struct gpio_led archer_c7_v4_leds_gpio[] __initdata = { - { - .name = "archer-c7-v4:green:power", + .name = "archer-c7-v5:green:power", .gpio = ARCHER_C7_GPIO_LED_POWER, .active_low = 1, }, { - .name = "archer-c7-v4:green:wps", + .name = "archer-c7-v5:green:wps", .gpio = ARCHER_C7_GPIO_LED_WPS, .active_low = 1, }, { - .name = "archer-c7-v4:green:wlan2g", + .name = "archer-c7-v5:green:wlan2g", .gpio = ARCHER_C7_GPIO_LED_WLAN2, .active_low = 1, }, { - .name = "archer-c7-v4:green:wlan5g", + .name = "archer-c7-v5:green:wlan5g", .gpio = ARCHER_C7_GPIO_LED_WLAN5, .active_low = 1, }, { - .name = "archer-c7-v4:green:lan1", + .name = "archer-c7-v5:green:lan1", .gpio = ARCHER_C7_GPIO_LED_LAN1, .active_low = 1, }, { - .name = "archer-c7-v4:green:lan2", + .name = "archer-c7-v5:green:lan2", .gpio = ARCHER_C7_GPIO_LED_LAN2, .active_low = 1, }, { - .name = "archer-c7-v4:green:lan3", + .name = "archer-c7-v5:green:lan3", .gpio = ARCHER_C7_GPIO_LED_LAN3, .active_low = 1, }, { - .name = "archer-c7-v4:green:lan4", + .name = "archer-c7-v5:green:lan4", .gpio = ARCHER_C7_GPIO_LED_LAN4, .active_low = 1, }, { - .name = "archer-c7-v4:green:wan", + .name = "archer-c7-v5:green:wan", .gpio = ARCHER_C7_GPIO_LED_WAN_GREEN, .active_low = 1, }, { - .name = "archer-c7-v4:amber:wan", + .name = "archer-c7-v5:amber:wan", .gpio = ARCHER_C7_GPIO_LED_WAN_AMBER, .active_low = 1, }, { - .name = "archer-c7-v4:green:usb1", - .gpio = ARCHER_C7_GPIO_LED_USB1, - .active_low = 1, - }, { - .name = "archer-c7-v4:green:usb2", - .gpio = ARCHER_C7_GPIO_LED_USB2, + .name = "archer-c7-v5:green:usb", + .gpio = ARCHER_C7_GPIO_LED_USB, .active_low = 1, }, }; -static struct gpio_keys_button archer_c7_v4_gpio_keys[] __initdata = { +static struct gpio_keys_button archer_c7_v5_gpio_keys[] __initdata = { { .desc = "WPS and WIFI button", .type = EV_KEY, @@ -181,13 +135,14 @@ static struct gpio_keys_button archer_c7_v4_gpio_keys[] __initdata = { }, }; -static struct ar8327_pad_cfg archer_c7_v4_ar8337_pad0_cfg = { + +static struct ar8327_pad_cfg archer_c7_v5_ar8337_pad0_cfg = { .mode = AR8327_PAD_MAC_SGMII, .sgmii_delay_en = true, }; -static struct ar8327_platform_data archer_c7_v4_ar8337_data = { - .pad0_cfg = &archer_c7_v4_ar8337_pad0_cfg, +static struct ar8327_platform_data archer_c7_v5_ar8337_data = { + .pad0_cfg = &archer_c7_v5_ar8337_pad0_cfg, .port0_cfg = { .force_link = 1, .speed = AR8327_PORT_SPEED_1000, @@ -197,42 +152,29 @@ static struct ar8327_platform_data archer_c7_v4_ar8337_data = { }, }; -static struct mdio_board_info archer_c7_v4_mdio0_info[] = { +static struct mdio_board_info archer_c7_v5_mdio0_info[] = { { .bus_id = "ag71xx-mdio.0", - .modalias = "archer_c7_v4", - .mdio_addr = 0, - .platform_data = &archer_c7_v4_ar8337_data, + .phy_addr = 0, + .platform_data = &archer_c7_v5_ar8337_data, }, }; -static void __init archer_c7_v4_setup(void) +static void __init archer_c7_v5_setup(void) { - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *mac = (u8 *) KSEG1ADDR(0x1ff00008); + u8 *art = (u8 *) KSEG1ADDR(0x1f050000); + u8 *mac = (u8 *) KSEG1ADDR(0x1f060008); ath79_register_m25p80(NULL); - spi_register_board_info(archer_c7_v4_spi_info, - ARRAY_SIZE(archer_c7_v4_spi_info)); - platform_device_register(&archer_c7_v4_spi_device); - - gpio_request_one(ARCHER_C7_GPIO_SHIFT_OE, - GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, - "LED control"); - - gpio_request_one(ARCHER_C7_GPIO_SHIFT_SRCLR, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "LED reset"); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_v4_leds_gpio), - archer_c7_v4_leds_gpio); + ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_v5_leds_gpio), + archer_c7_v5_leds_gpio); ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL, - ARRAY_SIZE(archer_c7_v4_gpio_keys), - archer_c7_v4_gpio_keys); + ARRAY_SIZE(archer_c7_v5_gpio_keys), + archer_c7_v5_gpio_keys); ath79_register_usb(); @@ -241,8 +183,12 @@ static void __init archer_c7_v4_setup(void) ath79_register_mdio(0, 0x0); - mdiobus_register_board_info(archer_c7_v4_mdio0_info, - ARRAY_SIZE(archer_c7_v4_mdio0_info)); + mdiobus_register_board_info(archer_c7_v5_mdio0_info, + ARRAY_SIZE(archer_c7_v5_mdio0_info)); + + gpio_request_one(ARCHER_C7_GPIO_USB_PWR, + GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, + "USB power"); ath79_register_wmac(art + ARCHER_C7_WMAC_CALDATA_OFFSET, mac); ath79_register_pci(); @@ -257,5 +203,5 @@ static void __init archer_c7_v4_setup(void) ath79_register_eth(0); } -MIPS_MACHINE(ATH79_MACH_ARCHER_C7_V4, "ARCHER-C7-V4", "TP-LINK Archer C7 v4", - archer_c7_v4_setup); +MIPS_MACHINE(ATH79_MACH_ARCHER_C7_V5, "ARCHER-C7-V5", "TP-LINK Archer C7 v5", + archer_c7_v5_setup); diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c7.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-archer-c7.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-arduino-yun.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-arduino-yun.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-arduino-yun.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-arduino-yun.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-aw-nr580.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-aw-nr580.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-aw-nr580.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-aw-nr580.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bhr-4grv2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-bhr-4grv2.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-bhr-4grv2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-bhr-4grv2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-bhu-bxu2000n2-a.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-bxu2000n2-a.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-bhu-bxu2000n2-a.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-bxu2000n2-a.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-bsb.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-bsb.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-bsb.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-c55.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-c55.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-c55.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-c55.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-c60.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-c60.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-c60.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cap324.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cap324.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cap324.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-cap324.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cap4200ag.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cap4200ag.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cap4200ag.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-cap4200ag.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-carambola2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-carambola2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-carambola2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-carambola2.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cf-e316n-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cf-e316n-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c similarity index 71% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cpe510.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c index d2dbed1fe..ceb1769dd 100644 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cpe510.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c @@ -1,7 +1,8 @@ /* - * TP-LINK CPE210/220/510/520 board support + * TP-LINK CPE210/210 v2/220/510/520 board support * * Copyright (C) 2014 Matthias Schiffer + * Copyright (C) 2017 Robert Marko * * 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 @@ -41,6 +42,8 @@ #define CPE510_KEYS_POLL_INTERVAL 20 /* msecs */ #define CPE510_KEYS_DEBOUNCE_INTERVAL (3 * CPE510_KEYS_POLL_INTERVAL) +/* CPE210 v2 reset GPIO */ +#define CPE210_V2_GPIO_BTN_RESET 17 static struct gpio_led cpe510_leds_gpio[] __initdata = { { @@ -98,6 +101,30 @@ static struct gpio_led wbs510_leds_gpio[] __initdata = { }, }; +static struct gpio_led cpe210_v2_leds_gpio[] __initdata = { + { + .name = "tp-link:green:lan0", + .gpio = CPE510_GPIO_LED_LAN0, + .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 = CPE510_GPIO_LED_L4, + .active_low = 1, + }, +}; + static struct gpio_keys_button cpe510_gpio_keys[] __initdata = { { .desc = "Reset button", @@ -109,6 +136,17 @@ static struct gpio_keys_button cpe510_gpio_keys[] __initdata = { } }; +static struct gpio_keys_button cpe210_v2_gpio_keys[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = CPE510_KEYS_DEBOUNCE_INTERVAL, + .gpio = CPE210_V2_GPIO_BTN_RESET, + .active_low = 1, + } +}; + static void __init cpe_setup(u8 *mac) { /* Disable JTAG, enabling GPIOs 0-3 */ @@ -171,9 +209,33 @@ static void __init wbs_setup(void) ath79_register_wmac(ee, mac); } +static void __init cpe210_v2_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f830008); + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(cpe210_v2_leds_gpio), + cpe210_v2_leds_gpio); + ath79_register_gpio_keys_polled(-1, CPE510_KEYS_POLL_INTERVAL, + ARRAY_SIZE(cpe210_v2_gpio_keys), + cpe210_v2_gpio_keys); + ath79_register_m25p80(NULL); + ath79_register_mdio(0, 0x0); + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.speed = SPEED_100; + ath79_eth0_data.phy_mask = BIT(4); + ath79_register_eth(0); + ath79_register_wmac(ee, mac); +} + MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220", cpe210_setup); +MIPS_MACHINE(ATH79_MACH_CPE210_V2, "CPE210V2", "TP-LINK CPE210 v2", + cpe210_v2_setup); + MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520", cpe510_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cpe870.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe870.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cpe870.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-cpe870.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cr3000.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cr3000.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-cr3000.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-cr3000.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cr5000.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cr5000.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-cr5000.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-cr5000.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dap-1330-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dap-1330-a1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dap-1330-a1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dap-1330-a1.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dap-2695-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dap-2695-a1.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dap-2695-a1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dap-2695-a1.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dgl-5500-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dgl-5500-a1.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dgl-5500-a1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dgl-5500-a1.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dhp-1565-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dhp-1565-a1.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dhp-1565-a1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dhp-1565-a1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-505-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-505-a1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-505-a1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dir-505-a1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-600-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-600-a1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-600-a1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dir-600-a1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-615-c1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-615-c1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-615-c1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dir-615-c1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-615-i1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-615-i1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-615-i1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dir-615-i1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-825-b1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-825-b1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dir-825-b1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dir-825-b1.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-825-c1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-825-c1.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-825-c1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dir-825-c1.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-869-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-869-a1.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dir-869-a1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dir-869-a1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-hotspot.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-hotspot.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dlan-hotspot.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-hotspot.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dlan-pro-1200-ac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-pro-1200-ac.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dlan-pro-1200-ac.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-pro-1200-ac.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dlan-pro-500-wp.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-pro-500-wp.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dlan-pro-500-wp.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-pro-500-wp.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-domywifi-dw33d.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-domywifi-dw33d.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-domywifi-dw33d.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-domywifi-dw33d.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dr344.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-dr344.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dr344.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dr531.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dr531.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dr531.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dr531.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dragino2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-dragino2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-dragino2.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e1700ac-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-e1700ac-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-e1700ac-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-e1700ac-v2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-e2100l.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-e2100l.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-e2100l.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-e2100l.c diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-e558-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-e558-v2.c new file mode 100644 index 000000000..c067d58bb --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-e558-v2.c @@ -0,0 +1,170 @@ +/* + * Qxwlan E558 v2 board support + * + * Copyright (C) 2017 Peng Zhang + * + * 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-spi.h" +#include "dev-usb.h" +#include "dev-wmac.h" +#include "machtypes.h" +#include "pci.h" + +#define E558_V2_GPIO_LED_WLAN 13 +#define E558_V2_GPIO_LED_SYSTEM 14 +#define E558_V2_GPIO_LED_QSS 15 + +#define E558_V2_GPIO_BTN_RESET 16 + +#define E558_V2_KEYS_POLL_INTERVAL 20 /* msecs */ +#define E558_V2_KEYS_DEBOUNCE_INTERVAL (3 * E558_V2_KEYS_POLL_INTERVAL) + +static struct gpio_led e558_v2_leds_gpio[] __initdata = { + { + .name = "e558-v2:green:qss", + .gpio = E558_V2_GPIO_LED_QSS, + .active_low = 1, + }, + { + .name = "e558-v2:green:system", + .gpio = E558_V2_GPIO_LED_SYSTEM, + .active_low = 1, + }, + { + .name = "e558-v2:green:wlan", + .gpio = E558_V2_GPIO_LED_WLAN, + .active_low = 1, + }, +}; + +static struct gpio_keys_button e558_v2_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = E558_V2_KEYS_DEBOUNCE_INTERVAL, + .gpio = E558_V2_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +/* GMAC0 of the AR8327 switch is connected to the QCA9558 SoC via SGMII */ +static struct ar8327_pad_cfg e558_v2_ar8327_pad0_cfg = { + .mode = AR8327_PAD_MAC_SGMII, + .sgmii_delay_en = true, +}; + +/* GMAC6 of the AR8327 switch is connected to the QCA9558 SoC via RGMII */ +static struct ar8327_pad_cfg e558_v2_ar8327_pad6_cfg = { + .mode = AR8327_PAD_MAC_RGMII, + .txclk_delay_en = true, + .rxclk_delay_en = true, + .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, + .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, +}; + +static const struct ar8327_led_info e558_v2_leds_qca8334[] = { + AR8327_LED_INFO(PHY2_0, HW, "e558-v2:green:wan"), + AR8327_LED_INFO(PHY3_0, HW, "e558-v2:green:lan1"), + AR8327_LED_INFO(PHY4_0, HW, "e558-v2:green:lan2"), +}; + +static struct ar8327_led_cfg e558_v2_ar8327_led_cfg = { + .led_ctrl0 = 0xc737c737, + .led_ctrl1 = 0x00000000, + .led_ctrl2 = 0x00000000, + .led_ctrl3 = 0x0030c300, + .open_drain = false, +}; + +static struct ar8327_platform_data e558_v2_ar8327_data = { + .pad0_cfg = &e558_v2_ar8327_pad0_cfg, + .pad6_cfg = &e558_v2_ar8327_pad6_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, + .port6_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, + .led_cfg = &e558_v2_ar8327_led_cfg, + .leds = e558_v2_leds_qca8334, + .num_leds = ARRAY_SIZE(e558_v2_leds_qca8334), +}; + +static struct mdio_board_info e558_v2_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 0, + .platform_data = &e558_v2_ar8327_data, + }, +}; + +static void __init e558_v2_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f050400); + u8 *art = (u8 *) KSEG1ADDR(0x1f061000); + + ath79_register_m25p80(NULL); + ath79_register_leds_gpio(-1, ARRAY_SIZE(e558_v2_leds_gpio), + e558_v2_leds_gpio); + + ath79_register_gpio_keys_polled(-1, E558_V2_KEYS_POLL_INTERVAL, + ARRAY_SIZE(e558_v2_gpio_keys), + e558_v2_gpio_keys); + + ath79_register_mdio(0, 0x0); + mdiobus_register_board_info(e558_v2_mdio0_info, + ARRAY_SIZE(e558_v2_mdio0_info)); + + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + + /* GMAC0 is connected to the RMGII interface */ + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.phy_mask = BIT(0); + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_pll_data.pll_1000 = 0x56000000; + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); + ath79_register_eth(0); + + /* GMAC1 is connected to the SGMII interface */ + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth1_data.speed = SPEED_1000; + ath79_eth1_data.duplex = DUPLEX_FULL; + ath79_eth1_pll_data.pll_1000 = 0x03000101; + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); + ath79_register_eth(1); + + ath79_register_pci(); + ath79_register_usb(); + ath79_register_wmac(art, NULL); +} + +MIPS_MACHINE(ATH79_MACH_E558_V2, "E558-V2", "Qxwlan E558 v2", + e558_v2_setup); + diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-e600g-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-e600g-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-e600g-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-e600g-v2.c diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-e750a-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-e750a-v4.c new file mode 100644 index 000000000..7cf3292c6 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-e750a-v4.c @@ -0,0 +1,122 @@ +/* + * Qxwlan E750A v4 board support + * + * Copyright (C) 2017 Peng Zhang + * + * 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-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" +#include "pci.h" + +#define E750A_V4_GPIO_LED_SYS 14 +#define E750A_V4_GPIO_LED_LAN 19 +#define E750A_V4_GPIO_LED_WAN 18 +#define E750A_V4_GPIO_LED_DS10 15 +#define E750A_V4_GPIO_LED_DS20 20 +#define E750A_V4_GPIO_LED_WLAN 21 + +#define E750A_V4_GPIO_BTN_RESET 12 + +#define E750A_V4_KEYS_POLL_INTERVAL 20 /* msecs */ +#define E750A_V4_KEYS_DEBOUNCE_INTERVAL (3 * E750A_V4_KEYS_POLL_INTERVAL) + +static struct gpio_led e750a_v4_leds_gpio[] __initdata = { + { + .name = "e750a-v4:green:system", + .gpio = E750A_V4_GPIO_LED_SYS, + .active_low = 1, + }, + { + .name = "e750a-v4:green:lan", + .gpio = E750A_V4_GPIO_LED_LAN, + .active_low = 1, + }, + { + .name = "e750a-v4:green:wan", + .gpio = E750A_V4_GPIO_LED_WAN, + .active_low = 1, + }, + { + .name = "e750a-v4:green:wlan", + .gpio = E750A_V4_GPIO_LED_WLAN, + .active_low = 1, + }, + { + .name = "e750a-v4:green:ds10", + .gpio = E750A_V4_GPIO_LED_DS10, + .active_low = 1, + }, + { + .name = "e750a-v4:green:ds20", + .gpio = E750A_V4_GPIO_LED_DS20, + .active_low = 1, + }, +}; + +static struct gpio_keys_button e750a_v4_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = E750A_V4_KEYS_DEBOUNCE_INTERVAL, + .gpio = E750A_V4_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + + +static void __init e750a_v4_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f050400); + u8 *art = (u8 *) KSEG1ADDR(0x1f061000); + + ath79_register_m25p80(NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(e750a_v4_leds_gpio), + e750a_v4_leds_gpio); + ath79_register_gpio_keys_polled(-1, E750A_V4_KEYS_POLL_INTERVAL, + ARRAY_SIZE(e750a_v4_gpio_keys), + e750a_v4_gpio_keys); + + ath79_register_mdio(1, 0x0); + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); + + /* GMAC1 is connected to the internal switch */ + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); + ath79_register_eth(1); + + /* GMAC0 is connected to the PHY4 of the internal switch */ + ath79_switch_data.phy4_mii_en = 1; + ath79_switch_data.phy_poll_mask = BIT(4); + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.phy_mask = BIT(4); + ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); + ath79_register_eth(0); + + ath79_register_pci(); + ath79_register_usb(); + ath79_register_wmac(art, NULL); +} + +MIPS_MACHINE(ATH79_MACH_E750A_V4, "E750A-V4", "Qxlan E750A v4", + e750a_v4_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-e750g-v8.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-e750g-v8.c new file mode 100644 index 000000000..72d134912 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-e750g-v8.c @@ -0,0 +1,151 @@ +/* + * Qxwlan E750G v8 board support + * + * Copyright (C) 2017 Peng Zhang + * + * 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 "common.h" +#include "pci.h" +#include "dev-ap9x-pci.h" +#include "dev-gpio-buttons.h" +#include "dev-eth.h" +#include "dev-usb.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-spi.h" +#include "dev-wmac.h" +#include "machtypes.h" + +#define E750G_V8_GPIO_LED_SYS 14 +#define E750G_V8_GPIO_LED_DS20 15 +#define E750G_V8_GPIO_LED_DS10 20 +#define E750G_V8_GPIO_LED_WLAN 21 + +#define E750G_V8_GPIO_BTN_RESET 12 + +#define E750G_V8_KEYS_POLL_INTERVAL 20 /* msecs */ +#define E750G_V8_KEYS_DEBOUNCE_INTERVAL (3 * E750G_V8_KEYS_POLL_INTERVAL) + +static struct gpio_led e750g_v8_leds_gpio[] __initdata = { + { + .name = "e750g-v8:green:system", + .gpio = E750G_V8_GPIO_LED_SYS, + .active_low = 1, + }, + { + .name = "e750g-v8:green:ds10", + .gpio = E750G_V8_GPIO_LED_DS10, + .active_low = 1, + }, + { + .name = "e750g-v8:green:ds20", + .gpio = E750G_V8_GPIO_LED_DS20, + .active_low = 1, + }, + { + .name = "e750g-v8:green:wlan", + .gpio = E750G_V8_GPIO_LED_WLAN, + .active_low = 1, + }, +}; + +static struct gpio_keys_button e750g_v8_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = E750G_V8_KEYS_DEBOUNCE_INTERVAL, + .gpio = E750G_V8_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +static const struct ar8327_led_info e750g_v8_leds_qca8334[] = { + AR8327_LED_INFO(PHY1_0, HW, "e750g-v8:green:lan"), + AR8327_LED_INFO(PHY2_0, HW, "e750g-v8:green:wan"), +}; + +static struct ar8327_pad_cfg e750g_v8_ar8327_pad0_cfg = { + .mode = AR8327_PAD_MAC_RGMII, + .txclk_delay_en = true, + .rxclk_delay_en = true, + .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, + .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, + .mac06_exchange_dis = true, +}; + +static struct ar8327_led_cfg e750g_v8_ar8327_led_cfg = { + .led_ctrl0 = 0x00000000, + .led_ctrl1 = 0xc737c737, + .led_ctrl2 = 0x00000000, + .led_ctrl3 = 0x00c30c00, + .open_drain = true, +}; + +static struct ar8327_platform_data e750g_v8_ar8327_data = { + .pad0_cfg = &e750g_v8_ar8327_pad0_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, + .led_cfg = &e750g_v8_ar8327_led_cfg, + .leds = e750g_v8_leds_qca8334, + .num_leds = ARRAY_SIZE(e750g_v8_leds_qca8334), +}; + +static struct mdio_board_info e750g_v8_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 0, + .platform_data = &e750g_v8_ar8327_data, + }, +}; + +static void __init e750g_v8_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f050400); + u8 *art = (u8 *) KSEG1ADDR(0x1f061000); + + ath79_register_m25p80(NULL); + ath79_register_leds_gpio(-1, ARRAY_SIZE(e750g_v8_leds_gpio), + e750g_v8_leds_gpio); + ath79_register_gpio_keys_polled(-1, E750G_V8_KEYS_POLL_INTERVAL, + ARRAY_SIZE(e750g_v8_gpio_keys), + e750g_v8_gpio_keys); + + mdiobus_register_board_info(e750g_v8_mdio0_info, + ARRAY_SIZE(e750g_v8_mdio0_info)); + + ath79_register_mdio(0, 0x0); + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | + AR934X_ETH_CFG_SW_ONLY_MODE); + + /* GMAC0 is connected to an AR8327 switch */ + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.phy_mask = BIT(0); + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_pll_data.pll_1000 = 0x06000000; + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_register_eth(0); + + ath79_register_pci(); + ath79_register_usb(); + ath79_register_wmac(art, NULL); +} + +MIPS_MACHINE(ATH79_MACH_E750G_V8, "E750G-V8", "Qxwlan E750G v8", + e750g_v8_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-eap120.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-eap120.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-eap120.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-eap120.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-eap300v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-eap300v2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-eap300v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-eap300v2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-eap7660d.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-eap7660d.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-eap7660d.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-eap7660d.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-el-m150.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-el-m150.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-el-m150.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-el-m150.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-el-mini.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-el-mini.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-el-mini.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-el-mini.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ens202ext.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ens202ext.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ens202ext.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ens202ext.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-epg5000.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-epg5000.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-epg5000.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-epg5000.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-esr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-esr1750.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-esr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-esr900.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ew-balin.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ew-balin.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ew-dorin.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ew-dorin.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ew-dorin.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ew-dorin.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-f9k1115v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-f9k1115v2.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-f9k1115v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-f9k1115v2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-fritz300e.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz300e.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-fritz300e.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-fritz300e.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-fritz4020.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz4020.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-fritz4020.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-fritz4020.c diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c new file mode 100644 index 000000000..ee0a18530 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-fritz450e.c @@ -0,0 +1,177 @@ +/* + * AVM FRITZ!WLAN Repeater 450E board support + * + * Copyright (C) 2018 David Bauer + * + * 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 "common.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-spi.h" +#include "dev-wmac.h" +#include "machtypes.h" + +#define FRITZ450E_GPIO_LED_POWER 14 +#define FRITZ450E_GPIO_LED_LAN 13 +#define FRITZ450E_GPIO_LED_WLAN 15 +#define FRITZ450E_GPIO_LED_RSSI2 16 +#define FRITZ450E_GPIO_LED_RSSI3 17 +#define FRITZ450E_GPIO_LED_RSSI4 18 + +#define FRITZ450E_GPIO_BTN_WPS 4 +#define FRITZ450E_KEYS_POLL_INTERVAL 20 /* msecs */ +#define FRITZ450E_KEYS_DEBOUNCE_INTERVAL (3 * FRITZ450E_KEYS_POLL_INTERVAL) + +#define FRITZ450E_PHY_ADDRESS 0 +#define FRITZ450E_GPIO_PHY_RESET 11 +#define FRITZ450E_GPIO_MDIO_CLK 12 +#define FRITZ450E_GPIO_MDIO_DATA 19 + +#define FRITZ450E_OFFSET_URLADER_WIFI_MAC_REVERSE 0x1979 + + +static struct mtd_partition fritz450E_flash_partitions[] = { + { + .name = "urlader", + .offset = 0, + .size = 0x0020000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "firmware", + .offset = 0x0020000, + .size = 0x0EE0000, + }, { + .name = "tffs (1)", + .offset = 0x0f00000, + .size = 0x0080000, + .mask_flags = MTD_WRITEABLE, + }, { + .name = "tffs (2)", + .offset = 0x0f80000, + .size = 0x0080000, + .mask_flags = MTD_WRITEABLE, + } +}; + +static struct flash_platform_data fritz450E_flash_data = { + .parts = fritz450E_flash_partitions, + .nr_parts = ARRAY_SIZE(fritz450E_flash_partitions), +}; + +static struct gpio_led fritz450E_leds_gpio[] __initdata = { + { + .name = "fritz450e:green:lan", + .gpio = FRITZ450E_GPIO_LED_LAN, + .active_low = 1, + }, { + .name = "fritz450e:green:rssi2", + .gpio = FRITZ450E_GPIO_LED_RSSI2, + .active_low = 1, + }, { + .name = "fritz450e:green:rssi3", + .gpio = FRITZ450E_GPIO_LED_RSSI3, + .active_low = 1, + }, { + .name = "fritz450e:green:rssi4", + .gpio = FRITZ450E_GPIO_LED_RSSI4, + .active_low = 1, + }, { + .name = "fritz450e:green:wlan", + .gpio = FRITZ450E_GPIO_LED_WLAN, + .active_low = 1, + }, { + .name = "fritz450e:green:power", + .gpio = FRITZ450E_GPIO_LED_POWER, + .active_low = 0, + }, +}; + +static struct gpio_keys_button fritz450E_gpio_keys[] __initdata = { + { + .desc = "WPS Button", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = FRITZ450E_KEYS_DEBOUNCE_INTERVAL, + .gpio = FRITZ450E_GPIO_BTN_WPS, + .active_low = 1, + } +}; + +static struct at803x_platform_data fritz450E_at803x_data = { + .disable_smarteee = 1, + .has_reset_gpio = 1, + .reset_gpio = FRITZ450E_GPIO_PHY_RESET, +}; + +static struct mdio_board_info fritz450E_mdio_info[] = { + { + .bus_id = "ag71xx-mdio.1", + .phy_addr = FRITZ450E_PHY_ADDRESS, + .platform_data = &fritz450E_at803x_data, + }, +}; + +static void __init fritz450E_setup(void) { + u8 *urlader = (u8 *) KSEG1ADDR(0x1f000000); + u8 wifi_mac[ETH_ALEN]; + + ath79_register_m25p80(&fritz450E_flash_data); + + gpio_request_one(FRITZ450E_GPIO_MDIO_CLK, GPIOF_OUT_INIT_HIGH, "MDC Pull-UP"); + gpio_request_one(FRITZ450E_GPIO_MDIO_DATA, GPIOF_OUT_INIT_HIGH, "MDIO Pull-UP"); + gpio_request_one(FRITZ450E_GPIO_PHY_RESET, GPIOF_OUT_INIT_HIGH, "PHY reset"); + + /* Register PHY device */ + mdiobus_register_board_info(fritz450E_mdio_info, + ARRAY_SIZE(fritz450E_mdio_info)); + + /* Initialize Ethernet */ + ath79_extract_mac_reverse(urlader + FRITZ450E_OFFSET_URLADER_WIFI_MAC_REVERSE, wifi_mac); + ath79_init_mac(ath79_eth0_data.mac_addr, wifi_mac, -2); + + ath79_register_mdio(1, ~BIT(FRITZ450E_PHY_ADDRESS)); + ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth0_data.phy_mask = BIT(FRITZ450E_PHY_ADDRESS); + ath79_eth0_pll_data.pll_1000 = 0x03000000; + ath79_eth0_pll_data.pll_100 = 0x00000101; + ath79_eth0_pll_data.pll_10 = 0x00001313; + ath79_register_eth(0); + + /* Initialize 2.4GHz WiFi */ + ath79_register_wmac_simple(); + + /* Register GPIO buttons */ + ath79_register_gpio_keys_polled(-1, FRITZ450E_KEYS_POLL_INTERVAL, + ARRAY_SIZE(fritz450E_gpio_keys), + fritz450E_gpio_keys); + + /* Register LEDs */ + ath79_register_leds_gpio(-1, ARRAY_SIZE(fritz450E_leds_gpio), + fritz450E_leds_gpio); +} + +MIPS_MACHINE(ATH79_MACH_FRITZ450E, "FRITZ450E", + "AVM FRITZ!WLAN Repeater 450E", fritz450E_setup); diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar150.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar150.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar150.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar300.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar300.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar300m.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar300m.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-ar750.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar750.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-domino.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-domino.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-domino.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gl-domino.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-inet.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-inet.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-inet.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gl-inet.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-mifi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-mifi.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-usb150.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-usb150.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gl-usb150.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gl-usb150.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gs-oolite-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gs-oolite-v1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gs-oolite-v1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gs-oolite-v1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gs-oolite-v5-2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gs-oolite-v5-2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-gs-oolite-v5-2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-gs-oolite-v5-2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-hiveap-121.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-hiveap-121.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-hiwifi-hc6361.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-hiwifi-hc6361.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-hiwifi-hc6361.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-hiwifi-hc6361.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-hornet-ub.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-hornet-ub.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-hornet-ub.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-hornet-ub.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ja76pf.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ja76pf.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ja76pf.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ja76pf.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-jwap003.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-jwap003.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-jwap003.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-jwap003.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-jwap230.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-jwap230.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-jwap230.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-jwap230.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-koala.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-koala.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-koala.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-koala.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-lan-turtle.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-lan-turtle.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-lan-turtle.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-lan-turtle.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-lima.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-lima.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-lima.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-lima.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mc-mac1200r.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mc-mac1200r.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mc-mac1200r.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mc-mac1200r.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr12.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr12.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr12.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mr12.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr16.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr16.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr16.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mr16.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr1750.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mr1750.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr18.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr18.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr18.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mr18.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr600.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr600.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mr600.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mr600.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mr900.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-n600.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n600.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mynet-n600.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n600.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mynet-n750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n750.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mynet-n750.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n750.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mynet-rext.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-rext.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-mynet-rext.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-rext.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mzk-w04nu.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mzk-w04nu.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mzk-w04nu.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mzk-w04nu.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mzk-w300nh.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mzk-w300nh.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-mzk-w300nh.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-mzk-w300nh.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-n5q.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-n5q.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-n5q.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-n5q.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-nbg460n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-nbg460n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-nbg460n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-nbg460n.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-nbg6716.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-nbg6716.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-nbg6716.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-nbg6716.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om2p.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om2p.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-om2p.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-om2p.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om5p.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5p.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om5p.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-om5p.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om5pac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pac.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om5pac.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-om5pac.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om5pacv2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-om5pacv2.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-om5pacv2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-om5pacv2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-omy-g1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-omy-g1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-omy-g1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-omy-g1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-omy-x1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-omy-x1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-omy-x1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-omy-x1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-onion-omega.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-onion-omega.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-onion-omega.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-onion-omega.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-pb42.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-pb42.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-pb42.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-pb42.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-pqi-air-pen.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-pqi-air-pen.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-pqi-air-pen.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-pqi-air-pen.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-qihoo-c301.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-qihoo-c301.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-r36a.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-r36a.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-r36a.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-r36a.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-r602n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-r602n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-r602n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-r602n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-r6100.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-r6100.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-r6100.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-r6100.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rambutan.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rambutan.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rambutan.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb2011.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb2011.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb4xx.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb4xx.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rb4xx.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rb4xx.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb750.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb91x.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb91x.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb922.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb922.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb922.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rb922.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb95x.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rb95x.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rbspi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c similarity index 99% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rbspi.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c index f7f3b028f..a9f3fc95b 100644 --- a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-rbspi.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c @@ -476,10 +476,10 @@ static struct gpio_led rblhg_leds[] __initdata = { }; /* RB w APG-5HacT2HnD (wAP AC) gpios*/ -#define RBWAPGSC_LED1 1 -#define RBWAPGSC_LED2 8 -#define RBWAPGSC_LED3 9 -#define RBWAPGSC_POWERLED 16 +#define RBWAPGSC_WIFI_LED_1 1 +#define RBWAPGSC_WIFI_LED_2 8 +#define RBWAPGSC_WIFI_LED_3 9 +#define RBWAPGSC_GPIO_LED_POWER 16 #define RBWAPGSC_GPIO_BTN_RESET 1 #define RBWAPGSC_GPIO_MDIO_MDC 12 #define RBWAPGSC_GPIO_MDIO_DATA 11 @@ -487,13 +487,10 @@ static struct gpio_led rblhg_leds[] __initdata = { static struct gpio_led rbwapgsc_leds[] __initdata = { { - .name = "rb:green:led1", - .gpio = RBWAPGSC_LED1, - .active_low = 1, - },{ - .name = "rb:blue:power", - .gpio = RBWAPGSC_POWERLED, + .name = "rb:green:power", + .gpio = RBWAPGSC_GPIO_LED_POWER, .active_low = 1, + .default_state = LEDS_GPIO_DEFSTATE_ON, }, }; diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rbsxtlite.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rbsxtlite.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rbsxtlite.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rbsxtlite.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-re450.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-re450.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-re450.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-re450.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rme-eg200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rme-eg200.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rme-eg200.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rme-eg200.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rut9xx.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rut9xx.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rut9xx.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rut9xx.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rw2458n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rw2458n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-rw2458n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-rw2458n.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-sc1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-sc1750.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-sc1750.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-sc1750.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-sc300m.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-sc300m.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-sc300m.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-sc300m.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-sc450.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-sc450.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-sc450.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-sc450.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-smart-300.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-smart-300.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-smart-300.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-smart-300.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-som9331.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-som9331.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-som9331.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-som9331.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-sr3200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-sr3200.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-sr3200.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-sr3200.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-t830.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-t830.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-t830.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-t830.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tellstick-znet-lite.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tellstick-znet-lite.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tellstick-znet-lite.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tellstick-znet-lite.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-632brp.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tew-632brp.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-632brp.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tew-632brp.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-673gru.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tew-673gru.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-673gru.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tew-673gru.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-712br.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tew-712br.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-712br.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tew-712br.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-732br.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tew-732br.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tew-732br.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tew-732br.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-823dru.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tew-823dru.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tew-823dru.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tew-823dru.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr11u.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr11u.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr11u.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr11u.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr13u.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr13u.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr13u.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr13u.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr3020.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr3020.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr3020.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr3020.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr3x20.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr3x20.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr3x20.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr3x20.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr6400.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr6400.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-mr6400.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr6400.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa701nd-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa701nd-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa701nd-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa701nd-v2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa7210n-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa7210n-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa7210n-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa7210n-v2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa801nd-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa801nd-v3.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa801nd-v3.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa830re-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa830re-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa830re-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa830re-v2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa901nd-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa901nd-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa901nd-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa901nd-v2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa901nd-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa901nd-v4.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa901nd-v4.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa901nd-v4.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa901nd.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa901nd.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wa901nd.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa901nd.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wax50re.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wax50re.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr3320-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3320-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr3320-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3320-v2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr3500.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3500.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr3500.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr3500.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr4300.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr4300.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wdr4300.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr4300.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr6500-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr6500-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wdr6500-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wdr6500-v2.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wpa8630.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wpa8630.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wpa8630.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wpa8630.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1041n-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1041n-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1041n-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1041n-v2.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1043nd-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v2.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1043nd-v2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v2.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1043nd-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-tl-wr1043nd-v4.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd-v4.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd.c similarity index 96% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd.c index 4e4b85d73..61aeb52d0 100644 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr1043nd.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr1043nd.c @@ -83,7 +83,7 @@ static struct gpio_keys_button tl_wr1043nd_gpio_keys[] __initdata = { } }; -static void tl_wr1043nd_rtl8366rb_hw_reset(struct rtl8366_smi *smi, bool active) +static void tl_wr1043nd_rtl8366rb_hw_reset(bool active) { if (active) ath79_device_reset_set(AR71XX_RESET_GE0_PHY); @@ -110,7 +110,7 @@ static void __init tl_wr1043nd_setup(void) u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); - tl_wr1043nd_rtl8366rb_hw_reset(NULL, true); + tl_wr1043nd_rtl8366rb_hw_reset(true); ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); ath79_eth0_data.mii_bus_dev = &tl_wr1043nd_rtl8366rb_device.dev; diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr2543n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2543n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr2543n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2543n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr703n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr703n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr703n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr720n-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr720n-v3.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr720n-v3.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr720n-v3.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr741nd-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd-v4.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr741nd-v4.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd-v4.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr741nd.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr741nd.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr741nd.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr802n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr802n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr802n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr802n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr810n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr810n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr810n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr810n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr841n-v8.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr841n-v8.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr841n-v9.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr841n-v9.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v9.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr841n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr841n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr902ac-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr902ac-v1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr902ac-v1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr902ac-v1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr940n-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr940n-v4.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr940n-v4.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr941nd-v6.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd-v6.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr941nd-v6.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd-v6.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr941nd.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr941nd.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr941nd.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr942n-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr942n-v1.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tl-wr942n-v1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr942n-v1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ts-d084.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ts-d084.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ts-d084.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ts-d084.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tube2h.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-tube2h.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-tube2h.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-tube2h.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ubnt-unifiac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ubnt-unifiac.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-unifiac.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ubnt-xm.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-ubnt-xm.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-ubnt.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wam250.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wam250.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wam250.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wam250.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-weio.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-weio.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-whr-hp-g300n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-whr-hp-g300n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-whr-hp-g300n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-whr-hp-g300n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wi2a-ac200i.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wi2a-ac200i.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wi2a-ac200i.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wi2a-ac200i.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wifi-pineapple-nano.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wifi-pineapple-nano.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wifi-pineapple-nano.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wifi-pineapple-nano.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wlae-ag300n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wlae-ag300n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wlae-ag300n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wlae-ag300n.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wlr8100.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wlr8100.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wlr8100.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wlr8100.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wndap360.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wndap360.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wndap360.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wndap360.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wndr3700.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wndr3700.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wndr3700.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndr4300.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wndr4300.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wndr4300.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wndr4300.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wnr2000-v3.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wnr2000-v3.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v3.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wnr2000-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wnr2000-v4.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wnr2000.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wnr2000.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wnr2200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wnr2200.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wp543.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wp543.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wp543.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wp543.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpe72.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpe72.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpe72.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wpe72.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj342.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj342.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj342.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wpj342.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj344.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj344.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj344.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wpj344.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj531.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wpj531.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wpj531.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj558.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj558.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj558.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wpj558.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj563.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wpj563.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wpj563.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wpj563.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wrt160nl.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wrt160nl.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wrt160nl.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wrt160nl.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wrt400n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wrt400n.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wrt400n.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wrt400n.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wrtnode2q.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wrtnode2q.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wrtnode2q.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wrtnode2q.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-450hp2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-450hp2.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-wzr-450hp2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-450hp2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-hp-ag300h.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-ag300h.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-hp-ag300h.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-ag300h.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-hp-g300nh.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-hp-g300nh.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-hp-g300nh2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh2.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-hp-g300nh2.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g300nh2.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-hp-g450h.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g450h.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-wzr-hp-g450h.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-wzr-hp-g450h.c diff --git a/target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-z1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-z1.c similarity index 100% rename from target/linux/ar71xx/files-4.9/arch/mips/ath79/mach-z1.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-z1.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-zbt-we1526.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-zbt-we1526.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-zbt-we1526.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-zbt-we1526.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-zcn-1523h.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-zcn-1523h.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/mach-zcn-1523h.c rename to target/linux/ar71xx/files/arch/mips/ath79/mach-zcn-1523h.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h similarity index 98% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/machtypes.h rename to target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 8b86f9ca8..390ec0b2c 100644 --- a/target/linux/ar71xx/files-4.14/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -43,7 +43,6 @@ enum ath79_mach_type { ATH79_MACH_AP90Q, /* YunCore AP80Q/AP90Q */ ATH79_MACH_AP91_5G, /* ALFA Network AP91-5G */ ATH79_MACH_AP96, /* Atheros AP96 */ - ATH79_MACH_AP81, /* Atheros AP81 reference board */ ATH79_MACH_ARCHER_C25_V1, /* TP-LINK Archer C25 V1 board */ ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */ ATH79_MACH_ARCHER_C58_V1, /* TP-LINK Archer C58 V1 board */ @@ -53,6 +52,7 @@ enum ath79_mach_type { ATH79_MACH_ARCHER_C7, /* TP-LINK Archer C7 board */ ATH79_MACH_ARCHER_C7_V2, /* TP-LINK Archer C7 V2 board */ ATH79_MACH_ARCHER_C7_V4, /* TP-LINK Archer C7 V4 board */ + ATH79_MACH_ARCHER_C7_V5, /* TP-LINK Archer C7 V5 board */ ATH79_MACH_ARDUINO_YUN, /* Yun */ ATH79_MACH_AW_NR580, /* AzureWave AW-NR580 */ ATH79_MACH_BHR_4GRV2, /* Buffalo BHR-4GRV2 */ @@ -73,7 +73,8 @@ enum ath79_mach_type { ATH79_MACH_CF_E385AC, /* COMFAST CF-E385AC */ ATH79_MACH_CF_E520N, /* COMFAST CF-E520N */ ATH79_MACH_CF_E530N, /* COMFAST CF-E530N */ - ATH79_MACH_CPE210, /* TP-LINK CPE210 */ + ATH79_MACH_CPE210, /* TP-LINK CPE210 v1 */ + ATH79_MACH_CPE210_V2, /* TP-LINK CPE210 v2 */ ATH79_MACH_CPE505N, /* P&W CPE505N */ ATH79_MACH_CPE510, /* TP-LINK CPE510 */ ATH79_MACH_CPE830, /* YunCore CPE830 */ @@ -104,8 +105,11 @@ enum ath79_mach_type { ATH79_MACH_DR531, /* Wallys DR531 */ ATH79_MACH_DRAGINO2, /* Dragino Version 2 */ ATH79_MACH_E1700AC_V2, /* Qxwlan E1700AC v2 */ + ATH79_MACH_E558_V2, /* Qxwlan E558 v2 */ ATH79_MACH_E600G_V2, /* Qxwlan E600G v2 */ ATH79_MACH_E600GAC_V2, /* Qxwlan E600GAC v2 */ + ATH79_MACH_E750A_V4, /* Qxwlan E750A v4 */ + ATH79_MACH_E750G_V8, /* Qxwlan E750G v8 */ ATH79_MACH_EAP120, /* TP-LINK EAP120 */ ATH79_MACH_EAP300V2, /* EnGenius EAP300 v2 */ ATH79_MACH_EAP7660D, /* Senao EAP7660D */ @@ -122,11 +126,11 @@ enum ath79_mach_type { ATH79_MACH_F9K1115V2, /* Belkin AC1750DB */ ATH79_MACH_FRITZ300E, /* AVM FRITZ!WLAN Repeater 300E */ ATH79_MACH_FRITZ4020, /* AVM FRITZ!Box 4020 */ + ATH79_MACH_FRITZ450E, /* AVM FRITZ!WLAN Repeater 450E */ ATH79_MACH_GL_AR150, /* GL-AR150 support */ ATH79_MACH_GL_AR300, /* GL-AR300 */ ATH79_MACH_GL_AR300M, /* GL-AR300M */ ATH79_MACH_GL_AR750, /* GL.iNet GL-AR750 */ - ATH79_MACH_GL_AR750S, /* GL.iNet GL-AR750S */ ATH79_MACH_GL_DOMINO, /* Domino */ ATH79_MACH_GL_INET, /* GL-CONNECT GL-INET */ ATH79_MACH_GL_MIFI, /* GL-MIFI support */ @@ -143,7 +147,6 @@ enum ath79_mach_type { ATH79_MACH_JWAP003, /* jjPlus JWAP003 */ ATH79_MACH_JWAP230, /* jjPlus JWAP230 */ ATH79_MACH_KOALA, /* OCEDO Koala */ - ATH79_MACH_K2T, /* Phicomm K2T A1/A2/A3 board */ ATH79_MACH_LAN_TURTLE, /* Hak5 LAN Turtle */ ATH79_MACH_LIMA, /* 8devices Lima */ ATH79_MACH_MC_MAC1200R, /* MERCURY MAC1200R */ diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/nvram.c b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/nvram.c rename to target/linux/ar71xx/files/arch/mips/ath79/nvram.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/nvram.h b/target/linux/ar71xx/files/arch/mips/ath79/nvram.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/nvram.h rename to target/linux/ar71xx/files/arch/mips/ath79/nvram.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/pci-ath9k-fixup.c b/target/linux/ar71xx/files/arch/mips/ath79/pci-ath9k-fixup.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/pci-ath9k-fixup.c rename to target/linux/ar71xx/files/arch/mips/ath79/pci-ath9k-fixup.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/pci-ath9k-fixup.h b/target/linux/ar71xx/files/arch/mips/ath79/pci-ath9k-fixup.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/pci-ath9k-fixup.h rename to target/linux/ar71xx/files/arch/mips/ath79/pci-ath9k-fixup.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/routerboot.c b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/routerboot.c rename to target/linux/ar71xx/files/arch/mips/ath79/routerboot.c diff --git a/target/linux/ar71xx/files-4.14/arch/mips/ath79/routerboot.h b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/ath79/routerboot.h rename to target/linux/ar71xx/files/arch/mips/ath79/routerboot.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/include/asm/fw/myloader/myloader.h b/target/linux/ar71xx/files/arch/mips/include/asm/fw/myloader/myloader.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/include/asm/fw/myloader/myloader.h rename to target/linux/ar71xx/files/arch/mips/include/asm/fw/myloader/myloader.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/include/asm/mach-ath79/ag71xx_platform.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/include/asm/mach-ath79/ag71xx_platform.h rename to target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/include/asm/mach-ath79/mach-rb750.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/mach-rb750.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/include/asm/mach-ath79/mach-rb750.h rename to target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/mach-rb750.h diff --git a/target/linux/ar71xx/files-4.14/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h similarity index 100% rename from target/linux/ar71xx/files-4.14/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h rename to target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/rb4xx_cpld.h diff --git a/target/linux/ar71xx/files-4.14/drivers/gpio/gpio-latch.c b/target/linux/ar71xx/files/drivers/gpio/gpio-latch.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/gpio/gpio-latch.c rename to target/linux/ar71xx/files/drivers/gpio/gpio-latch.c diff --git a/target/linux/ar71xx/files-4.14/drivers/gpio/gpio-nxp-74hc153.c b/target/linux/ar71xx/files/drivers/gpio/gpio-nxp-74hc153.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/gpio/gpio-nxp-74hc153.c rename to target/linux/ar71xx/files/drivers/gpio/gpio-nxp-74hc153.c diff --git a/target/linux/ar71xx/files-4.14/drivers/leds/leds-nu801.c b/target/linux/ar71xx/files/drivers/leds/leds-nu801.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/leds/leds-nu801.c rename to target/linux/ar71xx/files/drivers/leds/leds-nu801.c diff --git a/target/linux/ar71xx/files-4.14/drivers/leds/leds-rb750.c b/target/linux/ar71xx/files/drivers/leds/leds-rb750.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/leds/leds-rb750.c rename to target/linux/ar71xx/files/drivers/leds/leds-rb750.c diff --git a/target/linux/ar71xx/files-4.14/drivers/leds/leds-wndr3700-usb.c b/target/linux/ar71xx/files/drivers/leds/leds-wndr3700-usb.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/leds/leds-wndr3700-usb.c rename to target/linux/ar71xx/files/drivers/leds/leds-wndr3700-usb.c diff --git a/target/linux/ar71xx/files-4.14/drivers/mtd/cybertan_part.c b/target/linux/ar71xx/files/drivers/mtd/cybertan_part.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/mtd/cybertan_part.c rename to target/linux/ar71xx/files/drivers/mtd/cybertan_part.c diff --git a/target/linux/ar71xx/files-4.9/drivers/mtd/nand/ar934x_nfc.c b/target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c similarity index 100% rename from target/linux/ar71xx/files-4.9/drivers/mtd/nand/ar934x_nfc.c rename to target/linux/ar71xx/files/drivers/mtd/nand/ar934x_nfc.c diff --git a/target/linux/ar71xx/files-4.9/drivers/mtd/nand/rb4xx_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c similarity index 100% rename from target/linux/ar71xx/files-4.9/drivers/mtd/nand/rb4xx_nand.c rename to target/linux/ar71xx/files/drivers/mtd/nand/rb4xx_nand.c diff --git a/target/linux/ar71xx/files-4.9/drivers/mtd/nand/rb750_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c similarity index 100% rename from target/linux/ar71xx/files-4.9/drivers/mtd/nand/rb750_nand.c rename to target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c diff --git a/target/linux/ar71xx/files-4.9/drivers/mtd/nand/rb91x_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c similarity index 100% rename from target/linux/ar71xx/files-4.9/drivers/mtd/nand/rb91x_nand.c rename to target/linux/ar71xx/files/drivers/mtd/nand/rb91x_nand.c diff --git a/target/linux/ar71xx/files-4.9/drivers/mtd/tplinkpart.c b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c similarity index 100% rename from target/linux/ar71xx/files-4.9/drivers/mtd/tplinkpart.c rename to target/linux/ar71xx/files/drivers/mtd/tplinkpart.c diff --git a/target/linux/ar71xx/files-4.9/drivers/net/dsa/mv88e6063.c b/target/linux/ar71xx/files/drivers/net/dsa/mv88e6063.c similarity index 100% rename from target/linux/ar71xx/files-4.9/drivers/net/dsa/mv88e6063.c rename to target/linux/ar71xx/files/drivers/net/dsa/mv88e6063.c diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/Kconfig b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/Kconfig similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/Kconfig rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/Kconfig diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/Makefile b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/Makefile similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/Makefile rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/Makefile diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx.h rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar8216.c diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c diff --git a/target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c rename to target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c diff --git a/target/linux/ar71xx/files-4.14/drivers/spi/spi-rb4xx-cpld.c b/target/linux/ar71xx/files/drivers/spi/spi-rb4xx-cpld.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/spi/spi-rb4xx-cpld.c rename to target/linux/ar71xx/files/drivers/spi/spi-rb4xx-cpld.c diff --git a/target/linux/ar71xx/files-4.14/drivers/spi/spi-rb4xx.c b/target/linux/ar71xx/files/drivers/spi/spi-rb4xx.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/spi/spi-rb4xx.c rename to target/linux/ar71xx/files/drivers/spi/spi-rb4xx.c diff --git a/target/linux/ar71xx/files-4.14/drivers/spi/spi-vsc7385.c b/target/linux/ar71xx/files/drivers/spi/spi-vsc7385.c similarity index 100% rename from target/linux/ar71xx/files-4.14/drivers/spi/spi-vsc7385.c rename to target/linux/ar71xx/files/drivers/spi/spi-vsc7385.c diff --git a/target/linux/ar71xx/files-4.14/include/linux/leds-nu801.h b/target/linux/ar71xx/files/include/linux/leds-nu801.h similarity index 100% rename from target/linux/ar71xx/files-4.14/include/linux/leds-nu801.h rename to target/linux/ar71xx/files/include/linux/leds-nu801.h diff --git a/target/linux/ar71xx/files-4.14/include/linux/nxp_74hc153.h b/target/linux/ar71xx/files/include/linux/nxp_74hc153.h similarity index 100% rename from target/linux/ar71xx/files-4.14/include/linux/nxp_74hc153.h rename to target/linux/ar71xx/files/include/linux/nxp_74hc153.h diff --git a/target/linux/ar71xx/files-4.14/include/linux/platform/ar934x_nfc.h b/target/linux/ar71xx/files/include/linux/platform/ar934x_nfc.h similarity index 100% rename from target/linux/ar71xx/files-4.14/include/linux/platform/ar934x_nfc.h rename to target/linux/ar71xx/files/include/linux/platform/ar934x_nfc.h diff --git a/target/linux/ar71xx/files-4.14/include/linux/platform_data/gpio-latch.h b/target/linux/ar71xx/files/include/linux/platform_data/gpio-latch.h similarity index 100% rename from target/linux/ar71xx/files-4.14/include/linux/platform_data/gpio-latch.h rename to target/linux/ar71xx/files/include/linux/platform_data/gpio-latch.h diff --git a/target/linux/ar71xx/files-4.14/include/linux/platform_data/rb91x_nand.h b/target/linux/ar71xx/files/include/linux/platform_data/rb91x_nand.h similarity index 100% rename from target/linux/ar71xx/files-4.14/include/linux/platform_data/rb91x_nand.h rename to target/linux/ar71xx/files/include/linux/platform_data/rb91x_nand.h diff --git a/target/linux/ar71xx/files-4.14/include/linux/spi/vsc7385.h b/target/linux/ar71xx/files/include/linux/spi/vsc7385.h similarity index 100% rename from target/linux/ar71xx/files-4.14/include/linux/spi/vsc7385.h rename to target/linux/ar71xx/files/include/linux/spi/vsc7385.h diff --git a/target/linux/ar71xx/generic/config-default b/target/linux/ar71xx/generic/config-default index bb616ef8f..da331d38d 100644 --- a/target/linux/ar71xx/generic/config-default +++ b/target/linux/ar71xx/generic/config-default @@ -8,7 +8,6 @@ CONFIG_ATH79_DEV_SPI=y CONFIG_ATH79_DEV_USB=y CONFIG_ATH79_DEV_WMAC=y CONFIG_ATH79_MACH_A60=y -CONFIG_ATH79_MACH_AC9531=y CONFIG_ATH79_MACH_ALFA_AP120C=y CONFIG_ATH79_MACH_ALFA_AP96=y CONFIG_ATH79_MACH_ALFA_NX=y @@ -75,7 +74,10 @@ CONFIG_ATH79_MACH_DR531=y CONFIG_ATH79_MACH_DRAGINO2=y CONFIG_ATH79_MACH_E1700AC_V2=y CONFIG_ATH79_MACH_E2100L=y +CONFIG_ATH79_MACH_E558_V2=y CONFIG_ATH79_MACH_E600G_V2=y +CONFIG_ATH79_MACH_E750A_V4=y +CONFIG_ATH79_MACH_E750G_V8=y CONFIG_ATH79_MACH_EAP120=y CONFIG_ATH79_MACH_EAP300V2=y CONFIG_ATH79_MACH_EAP7660D=y @@ -90,11 +92,11 @@ CONFIG_ATH79_MACH_EW_DORIN=y CONFIG_ATH79_MACH_F9K1115V2=y CONFIG_ATH79_MACH_FRITZ300E=y CONFIG_ATH79_MACH_FRITZ4020=y +CONFIG_ATH79_MACH_FRITZ450E=y CONFIG_ATH79_MACH_GL_AR150=y CONFIG_ATH79_MACH_GL_AR300=y CONFIG_ATH79_MACH_GL_AR300M=y CONFIG_ATH79_MACH_GL_AR750=y -CONFIG_ATH79_MACH_GL_AR750S=y CONFIG_ATH79_MACH_GL_DOMINO=y CONFIG_ATH79_MACH_GL_INET=y CONFIG_ATH79_MACH_GL_MIFI=y @@ -107,7 +109,6 @@ CONFIG_ATH79_MACH_JA76PF=y CONFIG_ATH79_MACH_JWAP003=y CONFIG_ATH79_MACH_JWAP230=y CONFIG_ATH79_MACH_KOALA=y -CONFIG_ATH79_MACH_K2T=y CONFIG_ATH79_MACH_LAN_TURTLE=y CONFIG_ATH79_MACH_LIMA=y CONFIG_ATH79_MACH_MC_MAC1200R=y @@ -156,7 +157,6 @@ CONFIG_ATH79_MACH_TL_MR6400=y CONFIG_ATH79_MACH_TL_WDR3500=y CONFIG_ATH79_MACH_TL_WDR4300=y CONFIG_ATH79_MACH_TL_WDR6500_V2=y -CONFIG_ATH79_MACH_TL_WDX6501_V7=y CONFIG_ATH79_MACH_TL_WPA8630=y CONFIG_ATH79_MACH_TL_WR1043ND=y CONFIG_ATH79_MACH_TL_WR1043ND_V2=y diff --git a/target/linux/ar71xx/image/generic-legacy-devices.mk b/target/linux/ar71xx/image/generic-legacy-devices.mk index dac90f21f..7692e802d 100644 --- a/target/linux/ar71xx/image/generic-legacy-devices.mk +++ b/target/linux/ar71xx/image/generic-legacy-devices.mk @@ -105,25 +105,13 @@ LEGACY_DEVICES += AP143_16M define LegacyDevice/AP147_010 DEVICE_TITLE := Qualcomm Atheros AP147-010 reference board - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-ath10k ath10k-firmware-qca9887 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage endef LEGACY_DEVICES += AP147_010 -define LegacyDevice/AC9531_010 - DEVICE_TITLE := Qualcomm Atheros AC9531-010 reference board - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-ath10k ath10k-firmware-qca9887 -endef -LEGACY_DEVICES += AC9531_010 - -define LegacyDevice/AC9531_020 - DEVICE_TITLE := Qualcomm Atheros AC9531-020 reference board - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-ath10k ath10k-firmware-qca9887 -endef -LEGACY_DEVICES += AC9531_020 - define LegacyDevice/AP152_16M DEVICE_TITLE := Qualcomm Atheros AP152 reference board (16MB flash) - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-ath10k ath10k-firmware-qca988x + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage endef LEGACY_DEVICES += AP152_16M diff --git a/target/linux/ar71xx/image/generic-tp-link.mk b/target/linux/ar71xx/image/generic-tp-link.mk index cea8f9919..502c88b1b 100644 --- a/target/linux/ar71xx/image/generic-tp-link.mk +++ b/target/linux/ar71xx/image/generic-tp-link.mk @@ -141,22 +141,37 @@ define Device/archer-c7-v4 endef TARGET_DEVICES += archer-c7-v4 -define Device/cpe510-520-v1 - DEVICE_TITLE := TP-LINK CPE510/520 v1 +define Device/archer-c7-v5 + $(Device/archer-c7-v4) + DEVICE_TITLE := TP-LINK Archer C7 v5 + BOARDNAME := ARCHER-C7-V5 + TPLINK_BOARD_ID := ARCHER-C7-V5 + IMAGE_SIZE := 15104k + MTDPARTS := spi0.0:128k(factory-uboot)ro,128k(u-boot)ro,64k@0x50000(art)ro,1536k@0xc0000(kernel),13824k(rootfs),15360k@0xc0000(firmware) + SUPPORTED_DEVICES := archer-c7-v5 +endef +TARGET_DEVICES += archer-c7-v5 + +define Device/cpexxx DEVICE_PACKAGES := rssileds MTDPARTS := spi0.0:128k(u-boot)ro,64k(partition-table)ro,64k(product-info)ro,1792k(kernel),5888k(rootfs),192k(config)ro,64k(ART)ro,7680k@0x40000(firmware) IMAGE_SIZE := 7680k - BOARDNAME := CPE510 - TPLINK_BOARD_ID := CPE510 DEVICE_PROFILE := CPE510 LOADER_TYPE := elf + IMAGES := sysupgrade.bin factory.bin + IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade + IMAGE/factory.bin := append-rootfs | tplink-safeloader factory +endef + +define Device/cpe510-520-v1 + $(Device/cpexxx) + DEVICE_TITLE := TP-LINK CPE510/520 v1 + BOARDNAME := CPE510 + TPLINK_BOARD_ID := CPE510 LOADER_FLASH_OFFS := 0x43000 COMPILE := loader-$(1).elf COMPILE/loader-$(1).elf := loader-okli-compile KERNEL := kernel-bin | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) 12288 - IMAGES := sysupgrade.bin factory.bin - IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade - IMAGE/factory.bin := append-rootfs | tplink-safeloader factory endef TARGET_DEVICES += cpe510-520-v1 @@ -168,6 +183,18 @@ define Device/cpe210-220-v1 endef TARGET_DEVICES += cpe210-220-v1 +define Device/cpe210-v2 + $(Device/cpexxx) + DEVICE_TITLE := TP-LINK CPE210 v2 + BOARDNAME := CPE210V2 + TPLINK_BOARD_ID := CPE210V2 + KERNEL := kernel-bin | patch-cmdline | lzma | tplink-v1-header + TPLINK_HWID := 0x0 + TPLINK_HWREV := 0 + TPLINK_HEADER_VERSION := 1 +endef +TARGET_DEVICES += cpe210-v2 + define Device/wbs210-v1 $(Device/cpe510-520-v1) DEVICE_TITLE := TP-LINK WBS210 v1 @@ -311,27 +338,6 @@ define Device/tl-wdr6500-v2 endef TARGET_DEVICES += tl-wdr6500-v2 -define Device/tl-wdx6501-v7 - TPLINK_HWREV := 0x1 - TPLINK_HEADER_VERSION := 1 - LOADER_TYPE := gz - KERNEL := kernel-bin | patch-cmdline | lzma - KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | tplink-v1-header - IMAGES := sysupgrade.bin - IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade - TPLINK_FLASHLAYOUT := 8Mlzma - IMAGE_SIZE := 7936k - DEVICE_TITLE := TP-LINK TL-WDX6501 v7 - DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9888 - KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma - KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | uImage lzma | tplink-v1-header - BOARDNAME := TL-WDX6501-v7 - DEVICE_PROFILE := TLWDX6501V7 - TPLINK_HWID := 0x65010007 - TPLINK_HEADER_VERSION := 2 -endef -TARGET_DEVICES += tl-wdx6501-v7 - define Device/mw4530r-v1 $(Device/tl-wdr4300-v1) DEVICE_TITLE := Mercury MW4530R v1 diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 16426fb54..640557532 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -334,6 +334,25 @@ define Device/e1700ac-v2-8M endef TARGET_DEVICES += e1700ac-v2-8M +define Device/e558-v2-16M + DEVICE_TITLE := Qxwlan E558 v2 (16MB flash) + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig + BOARDNAME := E558-V2 + SUPPORTED_DEVICES := e558-v2 + IMAGE_SIZE := 15936k + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(pri-data)ro,64k(art),-(firmware) + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\ + append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) +endef +TARGET_DEVICES += e558-v2-16M + +define Device/e558-v2-8M + $(Device/e558-v2-16M) + DEVICE_TITLE := Qxwlan E558 v2 (8MB flash) + IMAGE_SIZE := 7744k +endef +TARGET_DEVICES += e558-v2-8M + define Device/e600g-v2-16M DEVICE_TITLE := Qxwlan E600G v2 (16MB flash) DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig @@ -373,6 +392,44 @@ define Device/e600gac-v2-8M endef TARGET_DEVICES += e600gac-v2-8M +define Device/e750a-v4-16M + DEVICE_TITLE := Qxwlan E750A v4 (16MB flash) + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig + BOARDNAME := E750A-V4 + SUPPORTED_DEVICES := e750a-v4 + IMAGE_SIZE := 15936k + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(pri-data)ro,64k(art),-(firmware) + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\ + append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) +endef +TARGET_DEVICES += e750a-v4-16M + +define Device/e750a-v4-8M + $(Device/e750a-v4-16M) + DEVICE_TITLE := Qxwlan E750A v4 (8MB flash) + IMAGE_SIZE := 7744k +endef +TARGET_DEVICES += e750a-v4-8M + +define Device/e750g-v8-16M + DEVICE_TITLE := Qxwlan E750G v8 (16MB flash) + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 -swconfig + BOARDNAME := E750G-V8 + SUPPORTED_DEVICES := e750g-v8 + IMAGE_SIZE := 15936k + MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(pri-data)ro,64k(art),-(firmware) + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\ + append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) +endef +TARGET_DEVICES += e750g-v8-16M + +define Device/e750g-v8-8M + $(Device/e750g-v8-16M) + DEVICE_TITLE := Qxwlan E750G v8 (8MB flash) + IMAGE_SIZE := 7744k +endef +TARGET_DEVICES += e750g-v8-8M + define Device/ew-balin DEVICE_TITLE := Embedded Wireless Balin Platform DEVICE_PACKAGES := kmod-usb-core kmod-usb-chipidea @@ -461,19 +518,6 @@ define Device/gl-ar750 endef TARGET_DEVICES += gl-ar750 -define Device/gl-ar750s - DEVICE_TITLE := GL.iNet GL-AR750S - DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887 kmod-usb-core \ - kmod-usb2 kmod-usb-storage - BOARDNAME := GL-AR750S - SUPPORTED_DEVICES := gl-ar750s - IMAGE_SIZE := 16000k - MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(art)ro,-(firmware) - IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ - append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) -endef -TARGET_DEVICES += gl-ar750s - define Device/gl-domino DEVICE_TITLE := GL.iNet Domino Pi DEVICE_PACKAGES := kmod-usb-core kmod-usb2 @@ -801,18 +845,6 @@ define Device/jwap230 endef TARGET_DEVICES += jwap230 -define Device/k2t - DEVICE_TITLE := Phicomm K2T A1/A2/A3 board (16MB flash) - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage kmod-ath10k ath10k-firmware-qca9888 - BOARDNAME := K2T - IMAGE_SIZE := 15744k - MTDPARTS := spi0.0:192k(u-boot)ro,64k(config)ro,320k(permanent),15744k(firmware),64k(art)ro - SUPPORTED_DEVICES := k2t - IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ - append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) -endef -TARGET_DEVICES += k2t - define Device/r36a DEVICE_TITLE := ALFA Network R36A DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport -swconfig @@ -1346,3 +1378,13 @@ define Device/fritz4020 IMAGE_SIZE := 15232k endef TARGET_DEVICES += fritz4020 + +define Device/fritz450e + $(call Device/AVM) + DEVICE_TITLE := AVM FRITZ!WLAN Repeater 450E + DEVICE_PACKAGES += -swconfig + BOARDNAME := FRITZ450E + SUPPORTED_DEVICES := fritz450e + IMAGE_SIZE := 15232k +endef +TARGET_DEVICES += fritz450e diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk index 8b7f07252..cbc859dd0 100644 --- a/target/linux/ar71xx/image/legacy.mk +++ b/target/linux/ar71xx/image/legacy.mk @@ -236,7 +236,6 @@ ap136_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1 ap143_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1472k(kernel),64k(art)ro,7744k@0x50000(firmware) ap143_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware) ap147_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware) -ac9531_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware) ap152_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k@0x50000(firmware) bxu2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),8448k(rootfs),6016k(user),64k(cfg),64k(oem),64k(art)ro cameo_ap81_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,3840k(firmware),64k(art)ro @@ -891,8 +890,6 @@ $(eval $(call SingleProfile,AthLzma,64k,AP136_020,ap136-020,AP136-020,ttyS0,1152 $(eval $(call SingleProfile,AthLzma,64k,AP143_8M,ap143-8M,AP143,ttyS0,115200,$$(ap143_mtdlayout_8M),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,AP143_16M,ap143-16M,AP143,ttyS0,115200,$$(ap143_mtdlayout_16M),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,AP147_010,ap147-010,AP147-010,ttyS0,115200,$$(ap147_mtdlayout),RKuImage)) -$(eval $(call SingleProfile,AthLzma,64k,AC9531_010,ac9531-010,AC9531-010,ttyS0,115200,$$(ac9531_mtdlayout),RKuImage)) -$(eval $(call SingleProfile,AthLzma,64k,AC9531_020,ac9531-020,AC9531-020,ttyS0,115200,$$(ac9531_mtdlayout),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,AP152_16M,ap152-16M,AP152,ttyS0,115200,$$(ap152_mtdlayout_16M),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,ttyS0,115200,$$(bxu2000n2_mtdlayout),RKuImage)) $(eval $(call SingleProfile,AthLzma,64k,CAP4200AG,cap4200ag,CAP4200AG,ttyS0,115200,$$(cap4200ag_mtdlayout),KRuImage)) diff --git a/target/linux/ar71xx/image/mikrotik.mk b/target/linux/ar71xx/image/mikrotik.mk index b13bbdc18..dc0066d6e 100644 --- a/target/linux/ar71xx/image/mikrotik.mk +++ b/target/linux/ar71xx/image/mikrotik.mk @@ -49,7 +49,7 @@ TARGET_DEVICES += rb-nor-flash-16M define Device/rb-nor-flash-16M-ac $(Device/rb-nor-flash-16M) DEVICE_TITLE := MikroTik RouterBoard (16 MB SPI NOR, 802.11ac) - DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x ath10k-firmware-qca9887 + DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x ath10k-firmware-qca9887 kmod-usb-ehci SUPPORTED_DEVICES += rb-wapg-5hact2hnd endef TARGET_DEVICES += rb-nor-flash-16M-ac diff --git a/target/linux/ar71xx/image/tiny-tp-link.mk b/target/linux/ar71xx/image/tiny-tp-link.mk index 799ef0c30..2891b9654 100644 --- a/target/linux/ar71xx/image/tiny-tp-link.mk +++ b/target/linux/ar71xx/image/tiny-tp-link.mk @@ -2,7 +2,7 @@ include ./common-tp-link.mk define Device/tl-mr10u-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-MR10U v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 BOARDNAME := TL-MR10U @@ -13,7 +13,7 @@ endef TARGET_DEVICES += tl-mr10u-v1 define Device/tl-mr11u-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-MR11U v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport BOARDNAME := TL-MR11U @@ -31,7 +31,7 @@ endef TARGET_DEVICES += tl-mr11u-v2 define Device/tl-mr12u-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-MR12U v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport BOARDNAME := TL-MR13U @@ -50,7 +50,7 @@ endef TARGET_DEVICES += tl-mr13u-v1 define Device/tl-mr3020-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-MR3020 v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport BOARDNAME := TL-MR3020 @@ -78,7 +78,7 @@ endef TARGET_DEVICES += tl-mr3040-v2 define Device/tl-mr3220-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-MR3220 v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport BOARDNAME := TL-MR3220 @@ -88,7 +88,7 @@ endef TARGET_DEVICES += tl-mr3220-v1 define Device/tl-mr3220-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-MR3220 v2 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport BOARDNAME := TL-MR3220-v2 @@ -99,7 +99,7 @@ endef TARGET_DEVICES += tl-mr3220-v2 define Device/tl-mr3420-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-MR3420 v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport BOARDNAME := TL-MR3420 @@ -109,7 +109,7 @@ endef TARGET_DEVICES += tl-mr3420-v1 define Device/tl-mr3420-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-MR3420 v2 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport BOARDNAME := TL-MR3420-v2 @@ -119,7 +119,7 @@ endef TARGET_DEVICES += tl-mr3420-v2 define Device/tl-wa701nd-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WA701N/ND v1 BOARDNAME := TL-WA901ND DEVICE_PROFILE := TLWA701 @@ -128,7 +128,7 @@ endef TARGET_DEVICES += tl-wa701nd-v1 define Device/tl-wa701nd-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA701N/ND v2 BOARDNAME := TL-WA701ND-v2 DEVICE_PROFILE := TLWA701 @@ -138,7 +138,7 @@ endef TARGET_DEVICES += tl-wa701nd-v2 define Device/tl-wa7210n-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA7210N v2 DEVICE_PACKAGES := rssileds kmod-ledtrig-netdev BOARDNAME := TL-WA7210N-v2 @@ -149,7 +149,7 @@ endef TARGET_DEVICES += tl-wa7210n-v2 define Device/tl-wa730re-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WA730RE v1 BOARDNAME := TL-WA901ND DEVICE_PROFILE := TLWA730RE @@ -158,7 +158,7 @@ endef TARGET_DEVICES += tl-wa730re-v1 define Device/tl-wa750re-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA750RE v1 DEVICE_PACKAGES := rssileds BOARDNAME := TL-WA750RE @@ -168,7 +168,7 @@ endef TARGET_DEVICES += tl-wa750re-v1 define Device/tl-wa7510n-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WA7510N v1 BOARDNAME := TL-WA7510N DEVICE_PROFILE := TLWA7510 @@ -177,7 +177,7 @@ endef TARGET_DEVICES += tl-wa7510n-v1 define Device/tl-wa801nd-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WA801N/ND v1 BOARDNAME := TL-WA901ND DEVICE_PROFILE := TLWA801 @@ -186,7 +186,7 @@ endef TARGET_DEVICES += tl-wa801nd-v1 define Device/tl-wa801nd-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA801N/ND v2 BOARDNAME := TL-WA801ND-v2 DEVICE_PROFILE := TLWA801 @@ -195,7 +195,7 @@ endef TARGET_DEVICES += tl-wa801nd-v2 define Device/tl-wa801nd-v3 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA801N/ND v3 BOARDNAME := TL-WA801ND-v3 DEVICE_PROFILE := TLWA801 @@ -204,7 +204,7 @@ endef TARGET_DEVICES += tl-wa801nd-v3 define Device/tl-wa830re-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WA830RE v1 BOARDNAME := TL-WA901ND DEVICE_PROFILE := TLWA830 @@ -213,7 +213,7 @@ endef TARGET_DEVICES += tl-wa830re-v1 define Device/tl-wa830re-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA830RE v2 BOARDNAME := TL-WA830RE-v2 DEVICE_PROFILE := TLWA830 @@ -222,7 +222,7 @@ endef TARGET_DEVICES += tl-wa830re-v2 define Device/tl-wa850re-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA850RE v1 DEVICE_PACKAGES := rssileds BOARDNAME := TL-WA850RE @@ -263,7 +263,7 @@ TARGET_DEVICES += tl-wa855re-v1 define Device/tl-wa860re-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA860RE v1 BOARDNAME := TL-WA860RE DEVICE_PROFILE := TLWA860 @@ -272,7 +272,7 @@ endef TARGET_DEVICES += tl-wa860re-v1 define Device/tl-wa901nd-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WA901N/ND v1 BOARDNAME := TL-WA901ND DEVICE_PROFILE := TLWA901 @@ -281,7 +281,7 @@ endef TARGET_DEVICES += tl-wa901nd-v1 define Device/tl-wa901nd-v2 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WA901N/ND v2 BOARDNAME := TL-WA901ND-v2 DEVICE_PROFILE := TLWA901 @@ -290,7 +290,7 @@ endef TARGET_DEVICES += tl-wa901nd-v2 define Device/tl-wa901nd-v3 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA901N/ND v3 BOARDNAME := TL-WA901ND-v3 DEVICE_PROFILE := TLWA901 @@ -299,7 +299,7 @@ endef TARGET_DEVICES += tl-wa901nd-v3 define Device/tl-wa901nd-v4 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WA901N/ND v4 BOARDNAME := TL-WA901ND-v4 DEVICE_PROFILE := TLWA901 @@ -317,7 +317,7 @@ endef TARGET_DEVICES += tl-wa901nd-v5 define Device/tl-wdr3320-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WDR3320 v2 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport BOARDNAME := TL-WDR3320-v2 @@ -328,7 +328,7 @@ endef TARGET_DEVICES += tl-wdr3320-v2 define Device/tl-wr1041n-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR1041N v2 BOARDNAME := TL-WR1041N-v2 DEVICE_PROFILE := TLWR1041 @@ -337,7 +337,7 @@ endef TARGET_DEVICES += tl-wr1041n-v2 define Device/tl-wr703n-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR703N v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 BOARDNAME := TL-WR703N @@ -348,7 +348,7 @@ endef TARGET_DEVICES += tl-wr703n-v1 define Device/tl-wr710n-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR710N v2 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 BOARDNAME := TL-WR710N @@ -359,7 +359,7 @@ endef TARGET_DEVICES += tl-wr710n-v2 define Device/tl-wr720n-v3 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR720N v3 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 BOARDNAME := TL-WR720N-v3 @@ -377,7 +377,7 @@ endef TARGET_DEVICES += tl-wr720n-v4 define Device/tl-wr740n-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR740N/ND v1 BOARDNAME := TL-WR741ND DEVICE_PROFILE := TLWR740 @@ -393,7 +393,7 @@ endef TARGET_DEVICES += tl-wr740n-v3 define Device/tl-wr740n-v4 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR740N/ND v4 BOARDNAME := TL-WR741ND-v4 DEVICE_PROFILE := TLWR740 @@ -410,7 +410,7 @@ endef TARGET_DEVICES += tl-wr740n-v5 define Device/tl-wr740n-v6 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR740N/ND v6 BOARDNAME := TL-WR740N-v6 DEVICE_PROFILE := TLWR740 @@ -419,7 +419,7 @@ endef TARGET_DEVICES += tl-wr740n-v6 define Device/tl-wr741nd-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR741N/ND v1 BOARDNAME := TL-WR741ND DEVICE_PROFILE := TLWR741 @@ -434,7 +434,7 @@ endef TARGET_DEVICES += tl-wr741nd-v2 define Device/tl-wr741nd-v4 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR741N/ND v4 BOARDNAME := TL-WR741ND-v4 DEVICE_PROFILE := TLWR741 @@ -451,7 +451,7 @@ endef TARGET_DEVICES += tl-wr741nd-v5 define Device/tl-wr743nd-v1 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR743N/ND v1 BOARDNAME := TL-WR741ND DEVICE_PROFILE := TLWR743 @@ -468,7 +468,7 @@ endef TARGET_DEVICES += tl-wr743nd-v2 define Device/tl-wr802n-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR802N v1 BOARDNAME := TL-WR802N-v1 DEVICE_PROFILE := TLWR802 @@ -478,7 +478,7 @@ endef TARGET_DEVICES += tl-wr802n-v1 define Device/tl-wr802n-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR802N v2 BOARDNAME := TL-WR802N-v2 DEVICE_PROFILE := TLWR802 @@ -491,7 +491,7 @@ endef TARGET_DEVICES += tl-wr802n-v2 define Device/tl-wr840n-v2 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR840N v2 BOARDNAME := TL-WR840N-v2 DEVICE_PROFILE := TLWR840 @@ -510,7 +510,7 @@ endef TARGET_DEVICES += tl-wr840n-v3 define Device/tl-wr841-v1.5 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR841N/ND v1.5 BOARDNAME := TL-WR841N-v1.5 DEVICE_PROFILE := TLWR841 @@ -520,7 +520,7 @@ endef TARGET_DEVICES += tl-wr841-v1.5 define Device/tl-wr841-v3 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR841N/ND v3 BOARDNAME := TL-WR941ND DEVICE_PROFILE := TLWR841 @@ -530,7 +530,7 @@ endef TARGET_DEVICES += tl-wr841-v3 define Device/tl-wr841-v5 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR841N/ND v5 BOARDNAME := TL-WR741ND DEVICE_PROFILE := TLWR841 @@ -539,7 +539,7 @@ endef TARGET_DEVICES += tl-wr841-v5 define Device/tl-wr841-v7 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR841N/ND v7 BOARDNAME := TL-WR841N-v7 DEVICE_PROFILE := TLWR841 @@ -548,7 +548,7 @@ endef TARGET_DEVICES += tl-wr841-v7 define Device/tl-wr841-v8 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR841N/ND v8 BOARDNAME := TL-WR841N-v8 DEVICE_PROFILE := TLWR841 @@ -557,7 +557,7 @@ endef TARGET_DEVICES += tl-wr841-v8 define Device/tl-wr841-v9 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR841N/ND v9 BOARDNAME := TL-WR841N-v9 DEVICE_PROFILE := TLWR841 @@ -573,7 +573,7 @@ endef TARGET_DEVICES += tl-wr841-v10 define Device/tl-wr841-v11 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR841N/ND v11 BOARDNAME := TL-WR841N-v11 DEVICE_PROFILE := TLWR841 @@ -592,7 +592,7 @@ endef TARGET_DEVICES += tl-wr841-v12 define Device/tl-wr843nd-v1 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR843N/ND v1 BOARDNAME := TL-WR841N-v8 DEVICE_PROFILE := TLWR843 @@ -601,7 +601,7 @@ endef TARGET_DEVICES += tl-wr843nd-v1 define Device/tl-wr847n-v8 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR847N/ND v8 BOARDNAME := TL-WR841N-v8 DEVICE_PROFILE := TLWR841 @@ -610,7 +610,7 @@ endef TARGET_DEVICES += tl-wr847n-v8 define Device/tl-wr940n-v4 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR940N v4 BOARDNAME := TL-WR940N-v4 DEVICE_PROFILE := TLWR941 @@ -631,7 +631,7 @@ endef TARGET_DEVICES += tl-wr940n-v6 define Device/tl-wr941nd-v2 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR941N/ND v2 BOARDNAME := TL-WR941ND DEVICE_PROFILE := TLWR941 @@ -655,7 +655,7 @@ endef TARGET_DEVICES += rnx-n360rt define Device/tl-wr941nd-v4 - $(Device/tplink-8m) + $(Device/tplink-4m) DEVICE_TITLE := TP-LINK TL-WR941N/ND v4 BOARDNAME := TL-WR741ND DEVICE_PROFILE := TLWR941 @@ -664,7 +664,7 @@ endef TARGET_DEVICES += tl-wr941nd-v4 define Device/tl-wr941nd-v5 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR941N/ND v5 BOARDNAME := TL-WR941ND-v5 DEVICE_PROFILE := TLWR941 @@ -673,7 +673,7 @@ endef TARGET_DEVICES += tl-wr941nd-v5 define Device/tl-wr941nd-v6 - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR941N/ND v6 BOARDNAME := TL-WR941ND-v6 DEVICE_PROFILE := TLWR941 @@ -683,7 +683,7 @@ TARGET_DEVICES += tl-wr941nd-v6 # Chinese version (unlike European) is similar to the TL-WDR3500 define Device/tl-wr941nd-v6-cn - $(Device/tplink-8mlzma) + $(Device/tplink-4mlzma) DEVICE_TITLE := TP-LINK TL-WR941N/ND v6 (CN) BOARDNAME := TL-WDR3500 DEVICE_PROFILE := TLWR941 diff --git a/target/linux/ar71xx/patches-4.14/001-spi-cs-gpio.patch b/target/linux/ar71xx/patches-4.14/001-spi-cs-gpio.patch deleted file mode 100644 index 7a0b669e4..000000000 --- a/target/linux/ar71xx/patches-4.14/001-spi-cs-gpio.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- 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.14/002-add_back_gpio_function_select.patch b/target/linux/ar71xx/patches-4.14/002-add_back_gpio_function_select.patch deleted file mode 100644 index 5b26a640e..000000000 --- a/target/linux/ar71xx/patches-4.14/002-add_back_gpio_function_select.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- /dev/null -+++ b/arch/mips/ath79/gpio.c -@@ -0,0 +1,59 @@ -+/* -+ * Atheros AR71XX/AR724X/AR913X GPIO API support -+ * -+ * Copyright (C) 2010-2011 Jaiganesh Narayanan -+ * Copyright (C) 2008-2011 Gabor Juhos -+ * Copyright (C) 2008 Imre Kaloz -+ * -+ * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP -+ * -+ * 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" -+ -+void __iomem *ath79_gpio_base; -+EXPORT_SYMBOL_GPL(ath79_gpio_base); -+ -+static void __iomem *ath79_gpio_get_function_reg(void) -+{ -+ u32 reg = 0; -+ -+ if (soc_is_ar71xx() || -+ soc_is_ar724x() || -+ soc_is_ar913x() || -+ soc_is_ar933x()) -+ reg = AR71XX_GPIO_REG_FUNC; -+ else if (soc_is_ar934x()) -+ reg = AR934X_GPIO_REG_FUNC; -+ else -+ BUG(); -+ -+ return ath79_gpio_base + reg; -+} -+ -+void ath79_gpio_function_setup(u32 set, u32 clear) -+{ -+ void __iomem *reg = ath79_gpio_get_function_reg(); -+ -+ __raw_writel((__raw_readl(reg) & ~clear) | set, reg); -+ /* flush write */ -+ __raw_readl(reg); -+} -+ -+void ath79_gpio_function_enable(u32 mask) -+{ -+ ath79_gpio_function_setup(mask, 0); -+} -+ -+void ath79_gpio_function_disable(u32 mask) -+{ -+ ath79_gpio_function_setup(0, mask); -+} ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -118,6 +118,7 @@ static inline int soc_is_qca955x(void) - void ath79_ddr_wb_flush(unsigned int reg); - void ath79_ddr_set_pci_windows(void); - -+extern void __iomem *ath79_gpio_base; - extern void __iomem *ath79_pll_base; - extern void __iomem *ath79_reset_base; - ---- a/arch/mips/ath79/dev-common.c -+++ b/arch/mips/ath79/dev-common.c -@@ -156,4 +156,5 @@ void __init ath79_gpio_init(void) - } - - platform_device_register(&ath79_gpio_device); -+ ath79_gpio_base = ioremap(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE); - } ---- a/arch/mips/ath79/common.h -+++ b/arch/mips/ath79/common.h -@@ -24,6 +24,9 @@ unsigned long ath79_get_sys_clk_rate(con - - void ath79_ddr_ctrl_init(void); - -+void ath79_gpio_function_enable(u32 mask); -+void ath79_gpio_function_disable(u32 mask); -+void ath79_gpio_function_setup(u32 set, u32 clear); - void ath79_gpio_init(void); - - #endif /* __ATH79_COMMON_H */ diff --git a/target/linux/ar71xx/patches-4.14/004-register_gpio_driver_earlier.patch b/target/linux/ar71xx/patches-4.14/004-register_gpio_driver_earlier.patch deleted file mode 100644 index d93498c64..000000000 --- a/target/linux/ar71xx/patches-4.14/004-register_gpio_driver_earlier.patch +++ /dev/null @@ -1,18 +0,0 @@ -HACK: register the GPIO driver earlier to ensure that gpio_request calls -from mach files succeed. - ---- a/drivers/gpio/gpio-ath79.c -+++ b/drivers/gpio/gpio-ath79.c -@@ -322,7 +322,11 @@ - .remove = ath79_gpio_remove, - }; - --module_platform_driver(ath79_gpio_driver); -+static int __init ath79_gpio_init(void) -+{ -+ return platform_driver_register(&ath79_gpio_driver); -+} -+postcore_initcall(ath79_gpio_init); - - MODULE_DESCRIPTION("Atheros AR71XX/AR724X/AR913X GPIO API support"); - MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ar71xx/patches-4.14/100-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch b/target/linux/ar71xx/patches-4.14/100-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch deleted file mode 100644 index 8d5b08998..000000000 --- a/target/linux/ar71xx/patches-4.14/100-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 8b7a76e72fc819753878cd5684e243f33f847c79 Mon Sep 17 00:00:00 2001 -From: Markos Chandras -Date: Wed, 21 Aug 2013 11:47:22 +0100 -Subject: [PATCH] MIPS: ath79: Avoid using unitialized 'reg' variable - -Fixes the following build error: -arch/mips/include/asm/mach-ath79/ath79.h:139:20: error: 'reg' may be used -uninitialized in this function [-Werror=maybe-uninitialized] -arch/mips/ath79/common.c:62:6: note: 'reg' was declared here -In file included from arch/mips/ath79/common.c:20:0: -arch/mips/ath79/common.c: In function 'ath79_device_reset_clear': -arch/mips/include/asm/mach-ath79/ath79.h:139:20: -error: 'reg' may be used uninitialized in this function -[-Werror=maybe-uninitialized] -arch/mips/ath79/common.c:90:6: note: 'reg' was declared here - -Signed-off-by: Markos Chandras -Acked-by: Gabor Juhos ---- - arch/mips/ath79/common.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -106,7 +106,7 @@ void ath79_device_reset_set(u32 mask) - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -- BUG(); -+ panic("Reset register not defined for this SOC"); - - spin_lock_irqsave(&ath79_device_reset_lock, flags); - t = ath79_reset_rr(reg); -@@ -134,7 +134,7 @@ void ath79_device_reset_clear(u32 mask) - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -- BUG(); -+ panic("Reset register not defined for this SOC"); - - spin_lock_irqsave(&ath79_device_reset_lock, flags); - t = ath79_reset_rr(reg); diff --git a/target/linux/ar71xx/patches-4.14/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch b/target/linux/ar71xx/patches-4.14/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch deleted file mode 100644 index 64fb545b2..000000000 --- a/target/linux/ar71xx/patches-4.14/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Wed, 18 May 2016 18:03:31 +0200 -Subject: [PATCH] MIPS: ath79: fix register address in ath79_ddr_wb_flush() - -ath79_ddr_wb_flush_base has the type void __iomem *, so register offsets -need to be a multiple of 4. - -Cc: Alban Bedel -Fixes: 24b0e3e84fbf ("MIPS: ath79: Improve the DDR controller interface") -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -58,7 +58,7 @@ EXPORT_SYMBOL_GPL(ath79_ddr_ctrl_init); - - void ath79_ddr_wb_flush(u32 reg) - { -- void __iomem *flush_reg = ath79_ddr_wb_flush_base + reg; -+ void __iomem *flush_reg = ath79_ddr_wb_flush_base + reg * 4; - - /* Flush the DDR write buffer. */ - __raw_writel(0x1, flush_reg); diff --git a/target/linux/ar71xx/patches-4.14/200-MIPS-ath79-fix-ar933x-wmac-reset.patch b/target/linux/ar71xx/patches-4.14/200-MIPS-ath79-fix-ar933x-wmac-reset.patch deleted file mode 100644 index b7ae0ce64..000000000 --- a/target/linux/ar71xx/patches-4.14/200-MIPS-ath79-fix-ar933x-wmac-reset.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -62,10 +62,26 @@ static void __init ar913x_wmac_setup(voi - - static int ar933x_wmac_reset(void) - { -+ int retries = 20; -+ - ath79_device_reset_set(AR933X_RESET_WMAC); - ath79_device_reset_clear(AR933X_RESET_WMAC); - -- return 0; -+ while (1) { -+ u32 bootstrap; -+ -+ bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); -+ if ((bootstrap & AR933X_BOOTSTRAP_EEPBUSY) == 0) -+ return 0; -+ -+ if (retries-- == 0) -+ break; -+ -+ udelay(10000); -+ } -+ -+ pr_err("ar933x: WMAC reset timed out"); -+ return -ETIMEDOUT; - } - - static int ar933x_r1_get_wmac_revision(void) diff --git a/target/linux/ar71xx/patches-4.14/201-ar913x_wmac_external_reset.patch b/target/linux/ar71xx/patches-4.14/201-ar913x_wmac_external_reset.patch deleted file mode 100644 index 9b704a3c4..000000000 --- a/target/linux/ar71xx/patches-4.14/201-ar913x_wmac_external_reset.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -44,7 +44,7 @@ static struct platform_device ath79_wmac - }, - }; - --static void __init ar913x_wmac_setup(void) -+static int ar913x_wmac_reset(void) - { - /* reset the WMAC */ - ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); -@@ -53,10 +53,19 @@ static void __init ar913x_wmac_setup(voi - ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); - mdelay(10); - -+ return 0; -+} -+ -+static void __init ar913x_wmac_setup(void) -+{ -+ ar913x_wmac_reset(); -+ - ath79_wmac_resources[0].start = AR913X_WMAC_BASE; - ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1; - ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2); - ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2); -+ -+ ath79_wmac_data.external_reset = ar913x_wmac_reset; - } - - diff --git a/target/linux/ar71xx/patches-4.14/202-MIPS-ath79-ar934x-wmac-revision.patch b/target/linux/ar71xx/patches-4.14/202-MIPS-ath79-ar934x-wmac-revision.patch deleted file mode 100644 index 0f8016f84..000000000 --- a/target/linux/ar71xx/patches-4.14/202-MIPS-ath79-ar934x-wmac-revision.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -139,6 +139,8 @@ static void ar934x_wmac_setup(void) - ath79_wmac_data.is_clk_25mhz = false; - else - ath79_wmac_data.is_clk_25mhz = true; -+ -+ ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision; - } - - static void qca955x_wmac_setup(void) diff --git a/target/linux/ar71xx/patches-4.14/203-MIPS-ath79-fix-restart.patch b/target/linux/ar71xx/patches-4.14/203-MIPS-ath79-fix-restart.patch deleted file mode 100644 index 48f4d95e7..000000000 --- a/target/linux/ar71xx/patches-4.14/203-MIPS-ath79-fix-restart.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -40,6 +40,7 @@ static char ath79_sys_type[ATH79_SYS_TYP - - static void ath79_restart(char *command) - { -+ local_irq_disable(); - ath79_device_reset_set(AR71XX_RESET_FULL_CHIP); - for (;;) - if (cpu_wait) ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -135,6 +135,7 @@ static inline u32 ath79_pll_rr(unsigned - static inline void ath79_reset_wr(unsigned reg, u32 val) - { - __raw_writel(val, ath79_reset_base + reg); -+ (void) __raw_readl(ath79_reset_base + reg); /* flush */ - } - - static inline u32 ath79_reset_rr(unsigned reg) diff --git a/target/linux/ar71xx/patches-4.14/220-add_cpu_feature_overrides.patch b/target/linux/ar71xx/patches-4.14/220-add_cpu_feature_overrides.patch deleted file mode 100644 index d925f9262..000000000 --- a/target/linux/ar71xx/patches-4.14/220-add_cpu_feature_overrides.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h -+++ b/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h -@@ -36,6 +36,7 @@ - #define cpu_has_mdmx 0 - #define cpu_has_mips3d 0 - #define cpu_has_smartmips 0 -+#define cpu_has_rixi 0 - - #define cpu_has_mips32r1 1 - #define cpu_has_mips32r2 1 -@@ -43,6 +44,7 @@ - #define cpu_has_mips64r2 0 - - #define cpu_has_mipsmt 0 -+#define cpu_has_userlocal 0 - - #define cpu_has_64bits 0 - #define cpu_has_64bit_zero_reg 0 -@@ -51,5 +53,9 @@ - - #define cpu_dcache_line_size() 32 - #define cpu_icache_line_size() 32 -+#define cpu_has_vtag_icache 0 -+#define cpu_has_dc_aliases 1 -+#define cpu_has_ic_fills_f_dc 0 -+#define cpu_has_pindexed_dcache 0 - - #endif /* __ASM_MACH_ATH79_CPU_FEATURE_OVERRIDES_H */ diff --git a/target/linux/ar71xx/patches-4.14/300-MIPS-add-MIPS_MACHINE_NONAME-macro.patch b/target/linux/ar71xx/patches-4.14/300-MIPS-add-MIPS_MACHINE_NONAME-macro.patch deleted file mode 100644 index 0bc64b7a1..000000000 --- a/target/linux/ar71xx/patches-4.14/300-MIPS-add-MIPS_MACHINE_NONAME-macro.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/arch/mips/include/asm/mips_machine.h -+++ b/arch/mips/include/asm/mips_machine.h -@@ -36,6 +36,18 @@ static struct mips_machine machine_##_ty - .mach_setup = _setup, \ - }; - -+#define MIPS_MACHINE_NONAME(_type, _id, _setup) \ -+static const char machine_id_##_type[] __initconst \ -+ __aligned(1) = _id; \ -+static struct mips_machine machine_##_type \ -+ __used __section(.mips.machines.init) = \ -+{ \ -+ .mach_type = _type, \ -+ .mach_id = machine_id_##_type, \ -+ .mach_name = NULL, \ -+ .mach_setup = _setup, \ -+}; -+ - extern long __mips_machines_start; - extern long __mips_machines_end; - diff --git a/target/linux/ar71xx/patches-4.14/310-lib-add-rle-decompression.patch b/target/linux/ar71xx/patches-4.14/310-lib-add-rle-decompression.patch deleted file mode 100644 index 766ffbeb7..000000000 --- a/target/linux/ar71xx/patches-4.14/310-lib-add-rle-decompression.patch +++ /dev/null @@ -1,124 +0,0 @@ ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -265,6 +265,9 @@ config LZMA_COMPRESS - config LZMA_DECOMPRESS - tristate - -+config RLE_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 -@@ -134,6 +134,7 @@ obj-$(CONFIG_XZ_DEC) += xz/ - obj-$(CONFIG_RAID6_PQ) += raid6/ - obj-$(CONFIG_LZMA_COMPRESS) += lzma/ - obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/ -+obj-$(CONFIG_RLE_DECOMPRESS) += rle.o - - lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o - lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o ---- /dev/null -+++ b/include/linux/rle.h -@@ -0,0 +1,18 @@ -+#ifndef _RLE_H_ -+#define _RLE_H_ -+ -+#ifdef CONFIG_RLE_DECOMPRESS -+int rle_decode(const unsigned char *src, size_t srclen, -+ unsigned char *dst, size_t dstlen, -+ size_t *src_done, size_t *dst_done); -+#else -+static inline int -+rle_decode(const unsigned char *src, size_t srclen, -+ unsigned char *dst, size_t dstlen, -+ size_t *src_done, size_t *dst_done) -+{ -+ return -ENOTSUPP; -+} -+#endif /* CONFIG_RLE_DECOMPRESS */ -+ -+#endif /* _RLE_H_ */ ---- /dev/null -+++ b/lib/rle.c -@@ -0,0 +1,78 @@ -+/* -+ * RLE decoding routine -+ * -+ * 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 -+ -+int rle_decode(const unsigned char *src, size_t srclen, -+ unsigned char *dst, size_t dstlen, -+ size_t *src_done, size_t *dst_done) -+{ -+ size_t srcpos, dstpos; -+ int ret; -+ -+ srcpos = 0; -+ dstpos = 0; -+ ret = -EINVAL; -+ -+ /* sanity checks */ -+ if (!src || !srclen || !dst || !dstlen) -+ goto out; -+ -+ while (1) { -+ char count; -+ -+ if (srcpos >= srclen) -+ break; -+ -+ count = (char) src[srcpos++]; -+ if (count == 0) { -+ ret = 0; -+ break; -+ } -+ -+ if (count > 0) { -+ unsigned char c; -+ -+ if (srcpos >= srclen) -+ break; -+ -+ c = src[srcpos++]; -+ -+ while (count--) { -+ if (dstpos >= dstlen) -+ break; -+ -+ dst[dstpos++] = c; -+ } -+ } else { -+ count *= -1; -+ -+ while (count--) { -+ if (srcpos >= srclen) -+ break; -+ if (dstpos >= dstlen) -+ break; -+ dst[dstpos++] = src[srcpos++]; -+ } -+ } -+ } -+ -+out: -+ if (src_done) -+ *src_done = srcpos; -+ if (dst_done) -+ *dst_done = dstpos; -+ -+ return ret; -+} -+ -+EXPORT_SYMBOL_GPL(rle_decode); diff --git a/target/linux/ar71xx/patches-4.14/401-mtd-physmap-add-lock-unlock.patch b/target/linux/ar71xx/patches-4.14/401-mtd-physmap-add-lock-unlock.patch deleted file mode 100644 index db7b3ca83..000000000 --- a/target/linux/ar71xx/patches-4.14/401-mtd-physmap-add-lock-unlock.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- a/drivers/mtd/maps/physmap.c -+++ b/drivers/mtd/maps/physmap.c -@@ -31,6 +31,66 @@ struct physmap_flash_info { - int vpp_refcnt; - }; - -+static struct platform_device *physmap_map2pdev(struct map_info *map) -+{ -+ return (struct platform_device *) map->map_priv_1; -+} -+ -+static void physmap_lock(struct map_info *map) -+{ -+ struct platform_device *pdev; -+ struct physmap_flash_data *physmap_data; -+ -+ pdev = physmap_map2pdev(map); -+ physmap_data = pdev->dev.platform_data; -+ physmap_data->lock(pdev); -+} -+ -+static void physmap_unlock(struct map_info *map) -+{ -+ struct platform_device *pdev; -+ struct physmap_flash_data *physmap_data; -+ -+ pdev = physmap_map2pdev(map); -+ physmap_data = pdev->dev.platform_data; -+ physmap_data->unlock(pdev); -+} -+ -+static map_word physmap_flash_read_lock(struct map_info *map, unsigned long ofs) -+{ -+ map_word ret; -+ -+ physmap_lock(map); -+ ret = inline_map_read(map, ofs); -+ physmap_unlock(map); -+ -+ return ret; -+} -+ -+static void physmap_flash_write_lock(struct map_info *map, map_word d, -+ unsigned long ofs) -+{ -+ physmap_lock(map); -+ inline_map_write(map, d, ofs); -+ physmap_unlock(map); -+} -+ -+static void physmap_flash_copy_from_lock(struct map_info *map, void *to, -+ unsigned long from, ssize_t len) -+{ -+ physmap_lock(map); -+ inline_map_copy_from(map, to, from, len); -+ physmap_unlock(map); -+} -+ -+static void physmap_flash_copy_to_lock(struct map_info *map, unsigned long to, -+ const void *from, ssize_t len) -+{ -+ physmap_lock(map); -+ inline_map_copy_to(map, to, from, len); -+ physmap_unlock(map); -+} -+ - static int physmap_flash_remove(struct platform_device *dev) - { - struct physmap_flash_info *info; -@@ -153,6 +213,13 @@ static int physmap_flash_probe(struct pl - - simple_map_init(&info->map[i]); - -+ if (physmap_data->lock && physmap_data->unlock) { -+ info->map[i].read = physmap_flash_read_lock; -+ info->map[i].write = physmap_flash_write_lock; -+ info->map[i].copy_from = physmap_flash_copy_from_lock; -+ info->map[i].copy_to = physmap_flash_copy_to_lock; -+ } -+ - probe_type = rom_probe_types; - if (physmap_data->probe_type == NULL) { - for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) ---- a/include/linux/mtd/physmap.h -+++ b/include/linux/mtd/physmap.h -@@ -25,6 +25,8 @@ struct physmap_flash_data { - unsigned int width; - int (*init)(struct platform_device *); - void (*exit)(struct platform_device *); -+ void (*lock)(struct platform_device *); -+ void (*unlock)(struct platform_device *); - void (*set_vpp)(struct platform_device *, int); - unsigned int nr_parts; - unsigned int pfow_base; diff --git a/target/linux/ar71xx/patches-4.14/402-mtd-SST39VF6401B-support.patch b/target/linux/ar71xx/patches-4.14/402-mtd-SST39VF6401B-support.patch deleted file mode 100644 index 0d483ab1a..000000000 --- a/target/linux/ar71xx/patches-4.14/402-mtd-SST39VF6401B-support.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/drivers/mtd/chips/jedec_probe.c -+++ b/drivers/mtd/chips/jedec_probe.c -@@ -148,6 +148,7 @@ - #define SST39LF160 0x2782 - #define SST39VF1601 0x234b - #define SST39VF3201 0x235b -+#define SST39VF6401B 0x236d - #define SST39WF1601 0x274b - #define SST39WF1602 0x274a - #define SST39LF512 0x00D4 -@@ -1569,6 +1570,18 @@ static const struct amd_flash_info jedec - ERASEINFO(0x10000,64), - } - }, { -+ .mfr_id = CFI_MFR_SST, -+ .dev_id = SST39VF6401B, -+ .name = "SST 39VF6401B", -+ .devtypes = CFI_DEVICETYPE_X16, -+ .uaddr = MTD_UADDR_0xAAAA_0x5555, -+ .dev_size = SIZE_8MiB, -+ .cmd_set = P_ID_AMD_STD, -+ .nr_regions = 1, -+ .regions = { -+ ERASEINFO(0x10000,128) -+ } -+ }, { - .mfr_id = CFI_MFR_ST, - .dev_id = M29F800AB, - .name = "ST M29F800AB", diff --git a/target/linux/ar71xx/patches-4.14/403-mtd_fix_cfi_cmdset_0002_status_check.patch b/target/linux/ar71xx/patches-4.14/403-mtd_fix_cfi_cmdset_0002_status_check.patch deleted file mode 100644 index c5167ade2..000000000 --- a/target/linux/ar71xx/patches-4.14/403-mtd_fix_cfi_cmdset_0002_status_check.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -1635,8 +1635,8 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip, - break; - } - -- if (chip_ready(map, adr)) -- break; -+ if (chip_good(map, adr, datum)) -+ goto enable_xip; - - /* Latency issues. Drop the lock, wait a while and retry */ - UDELAY(map, chip, adr, 1); -@@ -1652,6 +1652,8 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip, - - ret = -EIO; - } -+ -+ enable_xip: - xip_enable(map, chip, adr); - op_done: - if (mode == FL_OTP_WRITE) -@@ -2230,7 +2232,6 @@ static int cfi_amdstd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, - return 0; - } - -- - /* - * Handle devices with one erase region, that only implement - * the chip erase command. -@@ -2295,8 +2296,8 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) - chip->erase_suspended = 0; - } - -- if (chip_ready(map, adr)) -- break; -+ if (chip_good(map, adr, map_word_ff(map))) -+ goto op_done; - - if (time_after(jiffies, timeo)) { - printk(KERN_WARNING "MTD %s(): software timeout\n", -@@ -2316,6 +2317,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) - ret = -EIO; - } - -+ op_done: - chip->state = FL_READY; - xip_enable(map, chip, adr); - DISABLE_VPP(map); -@@ -2385,9 +2387,9 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, - chip->erase_suspended = 0; - } - -- if (chip_ready(map, adr)) { -+ if (chip_good(map, adr, map_word_ff(map))) { - xip_enable(map, chip, adr); -- break; -+ goto op_done; - } - - if (time_after(jiffies, timeo)) { -@@ -2409,6 +2411,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, - ret = -EIO; - } - -+ op_done: - chip->state = FL_READY; - DISABLE_VPP(map); - put_chip(map, chip, adr); diff --git a/target/linux/ar71xx/patches-4.14/404-mtd-cybertan-trx-parser.patch b/target/linux/ar71xx/patches-4.14/404-mtd-cybertan-trx-parser.patch deleted file mode 100644 index 922849fcb..000000000 --- a/target/linux/ar71xx/patches-4.14/404-mtd-cybertan-trx-parser.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -178,6 +178,12 @@ menu "Partition parsers" - source "drivers/mtd/parsers/Kconfig" - endmenu - -+config MTD_CYBERTAN_PARTS -+ tristate "Cybertan partitioning support" -+ depends on ATH79 -+ ---help--- -+ Cybertan partitioning support -+ - config MTD_MYLOADER_PARTS - tristate "MyLoader partition parsing" - depends on ADM5120 || ATH25 || ATH79 ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - obj-y += parsers/ -+obj-$(CONFIG_MTD_CYBERTAN_PARTS) += cybertan_part.o - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/ar71xx/patches-4.14/405-mtd-tp-link-partition-parser.patch b/target/linux/ar71xx/patches-4.14/405-mtd-tp-link-partition-parser.patch deleted file mode 100644 index 35ae11dac..000000000 --- a/target/linux/ar71xx/patches-4.14/405-mtd-tp-link-partition-parser.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -200,6 +200,12 @@ config MTD_MYLOADER_PARTS - You will still need the parsing functions to be called by the driver - for your particular device. It won't happen automatically. - -+config MTD_TPLINK_PARTS -+ tristate "TP-Link AR7XXX/AR9XXX partitioning support" -+ depends on ATH79 -+ ---help--- -+ TBD. -+ - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - obj-y += parsers/ -+obj-$(CONFIG_MTD_TPLINK_PARTS) += tplinkpart.o - obj-$(CONFIG_MTD_CYBERTAN_PARTS) += cybertan_part.o - - # 'Users' - code which presents functionality to userspace. diff --git a/target/linux/ar71xx/patches-4.14/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch b/target/linux/ar71xx/patches-4.14/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch deleted file mode 100644 index f8e51d823..000000000 --- a/target/linux/ar71xx/patches-4.14/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -235,6 +235,7 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len, - */ - static int m25p_probe(struct spi_device *spi) - { -+ struct mtd_part_parser_data ppdata = {0,}; - struct flash_platform_data *data; - struct m25p *flash; - struct spi_nor *nor; -@@ -300,8 +301,11 @@ static int m25p_probe(struct spi_device *spi) - if (ret) - return ret; - -- return mtd_device_register(&nor->mtd, data ? data->parts : NULL, -- data ? data->nr_parts : 0); -+ return mtd_device_parse_register(&nor->mtd, -+ data ? data->part_probes : NULL, -+ &ppdata, -+ data ? data->parts : NULL, -+ data ? data->nr_parts : 0); - } - - ---- a/include/linux/spi/flash.h -+++ b/include/linux/spi/flash.h -@@ -25,6 +25,7 @@ struct flash_platform_data { - unsigned int nr_parts; - - char *type; -+ const char **part_probes; - - /* we'll likely add more ... use JEDEC IDs, etc */ - }; diff --git a/target/linux/ar71xx/patches-4.14/408-mtd-redboot_partition_scan.patch b/target/linux/ar71xx/patches-4.14/408-mtd-redboot_partition_scan.patch deleted file mode 100644 index cd41e7ceb..000000000 --- a/target/linux/ar71xx/patches-4.14/408-mtd-redboot_partition_scan.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -76,12 +76,18 @@ static int parse_redboot_partitions(stru - static char nullstring[] = "unallocated"; - #endif - -+ buf = vmalloc(master->erasesize); -+ if (!buf) -+ return -ENOMEM; -+ -+ restart: - if ( directory < 0 ) { - offset = master->size + directory * master->erasesize; - while (mtd_block_isbad(master, offset)) { - if (!offset) { - nogood: - printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n"); -+ vfree(buf); - return -EIO; - } - offset -= master->erasesize; -@@ -94,10 +100,6 @@ static int parse_redboot_partitions(stru - goto nogood; - } - } -- buf = vmalloc(master->erasesize); -- -- if (!buf) -- return -ENOMEM; - - printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n", - master->name, offset); -@@ -170,6 +172,11 @@ static int parse_redboot_partitions(stru - } - if (i == numslots) { - /* Didn't find it */ -+ if (offset + master->erasesize < master->size) { -+ /* not at the end of the flash yet, maybe next block :) */ -+ directory++; -+ goto restart; -+ } - printk(KERN_NOTICE "No RedBoot partition table detected in %s\n", - master->name); - ret = 0; diff --git a/target/linux/ar71xx/patches-4.14/409-mtd-rb4xx_nand_driver.patch b/target/linux/ar71xx/patches-4.14/409-mtd-rb4xx_nand_driver.patch deleted file mode 100644 index d1a307f2d..000000000 --- a/target/linux/ar71xx/patches-4.14/409-mtd-rb4xx_nand_driver.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/mtd/nand/Kconfig -+++ b/drivers/mtd/nand/Kconfig -@@ -563,4 +563,8 @@ config MTD_NAND_MTK - Enables support for NAND controller on MTK SoCs. - This controller is found on mt27xx, mt81xx, mt65xx SoCs. - -+config MTD_NAND_RB4XX -+ tristate "NAND flash driver for RouterBoard 4xx series" -+ depends on MTD_NAND && ATH79_MACH_RB4XX -+ - endif # MTD_NAND ---- a/drivers/mtd/nand/Makefile -+++ b/drivers/mtd/nand/Makefile -@@ -34,6 +34,7 @@ obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o - obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o - obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o - obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o -+obj-$(CONFIG_MTD_NAND_RB4XX) += rb4xx_nand.o - obj-$(CONFIG_MTD_NAND_PASEMI) += pasemi_nand.o - obj-$(CONFIG_MTD_NAND_ORION) += orion_nand.o - obj-$(CONFIG_MTD_NAND_OXNAS) += oxnas_nand.o diff --git a/target/linux/ar71xx/patches-4.14/410-mtd-rb750-nand-driver.patch b/target/linux/ar71xx/patches-4.14/410-mtd-rb750-nand-driver.patch deleted file mode 100644 index 086935be9..000000000 --- a/target/linux/ar71xx/patches-4.14/410-mtd-rb750-nand-driver.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/mtd/nand/Kconfig -+++ b/drivers/mtd/nand/Kconfig -@@ -567,4 +567,8 @@ config MTD_NAND_RB4XX - tristate "NAND flash driver for RouterBoard 4xx series" - depends on MTD_NAND && ATH79_MACH_RB4XX - -+config MTD_NAND_RB750 -+ tristate "NAND flash driver for the RouterBoard 750" -+ depends on MTD_NAND && ATH79_MACH_RB750 -+ - endif # MTD_NAND ---- a/drivers/mtd/nand/Makefile -+++ b/drivers/mtd/nand/Makefile -@@ -35,6 +35,7 @@ obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o - obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o - obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o - obj-$(CONFIG_MTD_NAND_RB4XX) += rb4xx_nand.o -+obj-$(CONFIG_MTD_NAND_RB750) += rb750_nand.o - obj-$(CONFIG_MTD_NAND_PASEMI) += pasemi_nand.o - obj-$(CONFIG_MTD_NAND_ORION) += orion_nand.o - obj-$(CONFIG_MTD_NAND_OXNAS) += oxnas_nand.o diff --git a/target/linux/ar71xx/patches-4.14/411-mtd-cfi_cmdset_0002-force-word-write.patch b/target/linux/ar71xx/patches-4.14/411-mtd-cfi_cmdset_0002-force-word-write.patch deleted file mode 100644 index 8572533f2..000000000 --- a/target/linux/ar71xx/patches-4.14/411-mtd-cfi_cmdset_0002-force-word-write.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- 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 mtd_info *mtd) - } - #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(struct mtd_info *mtd) - 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) -@@ -1794,6 +1798,7 @@ static int cfi_amdstd_write_words(struct mtd_info *mtd, loff_t to, size_t len, - /* - * 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) -@@ -1922,7 +1927,6 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, - 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) - { -@@ -1997,6 +2001,7 @@ static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len, - - return 0; - } -+#endif /* !FORCE_WORD_WRITE */ - - /* - * Wait for the flash chip to become ready to write data diff --git a/target/linux/ar71xx/patches-4.14/413-mtd-ar934x-nand-driver.patch b/target/linux/ar71xx/patches-4.14/413-mtd-ar934x-nand-driver.patch deleted file mode 100644 index 3c7300c77..000000000 --- a/target/linux/ar71xx/patches-4.14/413-mtd-ar934x-nand-driver.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/mtd/nand/Kconfig -+++ b/drivers/mtd/nand/Kconfig -@@ -571,4 +571,12 @@ config MTD_NAND_RB750 - tristate "NAND flash driver for the RouterBoard 750" - depends on MTD_NAND && ATH79_MACH_RB750 - -+config MTD_NAND_AR934X -+ tristate "NAND flash driver for the Qualcomm Atheros AR934x/QCA955x SoCs" -+ depends on (SOC_AR934X || SOC_QCA955X) -+ -+config MTD_NAND_AR934X_HW_ECC -+ bool "Hardware ECC support for the AR934X NAND Controller (EXPERIMENTAL)" -+ depends on MTD_NAND_AR934X -+ - endif # MTD_NAND ---- a/drivers/mtd/nand/Makefile -+++ b/drivers/mtd/nand/Makefile -@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_NAND_AMS_DELTA) += ams-delta.o - obj-$(CONFIG_MTD_NAND_DENALI) += denali.o - obj-$(CONFIG_MTD_NAND_DENALI_PCI) += denali_pci.o - obj-$(CONFIG_MTD_NAND_DENALI_DT) += denali_dt.o -+obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nfc.o - obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o - obj-$(CONFIG_MTD_NAND_BF5XX) += bf5xx_nand.o - obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o diff --git a/target/linux/ar71xx/patches-4.14/414-mtd-rb91x-nand-driver.patch b/target/linux/ar71xx/patches-4.14/414-mtd-rb91x-nand-driver.patch deleted file mode 100644 index d01053551..000000000 --- a/target/linux/ar71xx/patches-4.14/414-mtd-rb91x-nand-driver.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/mtd/nand/Kconfig -+++ b/drivers/mtd/nand/Kconfig -@@ -571,4 +571,8 @@ config MTD_NAND_RB750 - tristate "NAND flash driver for the RouterBoard 750" - depends on MTD_NAND && ATH79_MACH_RB750 - -+config MTD_NAND_RB91X -+ tristate "NAND flash driver for the RouterBOARD 91x series" -+ depends on MTD_NAND && ATH79_MACH_RB91X -+ - endif # MTD_NAND ---- a/drivers/mtd/nand/Makefile -+++ b/drivers/mtd/nand/Makefile -@@ -36,6 +36,7 @@ obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o - obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o - obj-$(CONFIG_MTD_NAND_RB4XX) += rb4xx_nand.o - obj-$(CONFIG_MTD_NAND_RB750) += rb750_nand.o -+obj-$(CONFIG_MTD_NAND_RB91X) += rb91x_nand.o - obj-$(CONFIG_MTD_NAND_PASEMI) += pasemi_nand.o - obj-$(CONFIG_MTD_NAND_ORION) += orion_nand.o - obj-$(CONFIG_MTD_NAND_OXNAS) += oxnas_nand.o diff --git a/target/linux/ar71xx/patches-4.14/420-net-ar71xx_mac_driver.patch b/target/linux/ar71xx/patches-4.14/420-net-ar71xx_mac_driver.patch deleted file mode 100644 index 6377db0ac..000000000 --- a/target/linux/ar71xx/patches-4.14/420-net-ar71xx_mac_driver.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/net/ethernet/atheros/Kconfig -+++ b/drivers/net/ethernet/atheros/Kconfig -@@ -5,7 +5,7 @@ - config NET_VENDOR_ATHEROS - bool "Atheros devices" - default y -- depends on PCI -+ depends on (PCI || ATH79) - ---help--- - If you have a network (Ethernet) card belonging to this class, say Y. - -@@ -78,4 +78,6 @@ config ALX - To compile this driver as a module, choose M here. The module - will be called alx. - -+source drivers/net/ethernet/atheros/ag71xx/Kconfig -+ - endif # NET_VENDOR_ATHEROS ---- a/drivers/net/ethernet/atheros/Makefile -+++ b/drivers/net/ethernet/atheros/Makefile -@@ -3,6 +3,7 @@ - # Makefile for the Atheros network device drivers. - # - -+obj-$(CONFIG_AG71XX) += ag71xx/ - obj-$(CONFIG_ATL1) += atlx/ - obj-$(CONFIG_ATL2) += atlx/ - obj-$(CONFIG_ATL1E) += atl1e/ diff --git a/target/linux/ar71xx/patches-4.14/423-dsa-add-88e6063-driver.patch b/target/linux/ar71xx/patches-4.14/423-dsa-add-88e6063-driver.patch deleted file mode 100644 index 67aefe558..000000000 --- a/target/linux/ar71xx/patches-4.14/423-dsa-add-88e6063-driver.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/drivers/net/dsa/Kconfig -+++ b/drivers/net/dsa/Kconfig -@@ -39,6 +39,14 @@ config NET_DSA_MV88E6060 - This enables support for the Marvell 88E6060 ethernet switch - chip. - -+config NET_DSA_MV88E6063 -+ bool "Marvell 88E6063 ethernet switch chip support" -+ depends on NET_DSA -+ select NET_DSA_TAG_TRAILER -+ ---help--- -+ This enables support for the Marvell 88E6063 ethernet switch -+ chip -+ - source "drivers/net/dsa/microchip/Kconfig" - - source "drivers/net/dsa/mv88e6xxx/Kconfig" ---- a/drivers/net/dsa/Makefile -+++ b/drivers/net/dsa/Makefile -@@ -7,6 +7,7 @@ obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o - endif - obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o - obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o -+obj-$(CONFIG_NET_DSA_MV88E6063) += mv88e6063.o - obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o - obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o - obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o diff --git a/target/linux/ar71xx/patches-4.14/430-drivers-link-spi-before-mtd.patch b/target/linux/ar71xx/patches-4.14/430-drivers-link-spi-before-mtd.patch deleted file mode 100644 index 2f1549710..000000000 --- a/target/linux/ar71xx/patches-4.14/430-drivers-link-spi-before-mtd.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -83,8 +83,8 @@ obj-$(CONFIG_SCSI) += scsi/ - obj-y += nvme/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_TARGET_CORE) += target/ --obj-$(CONFIG_MTD) += mtd/ - obj-$(CONFIG_SPI) += spi/ -+obj-$(CONFIG_MTD) += mtd/ - obj-$(CONFIG_SPMI) += spmi/ - obj-$(CONFIG_HSI) += hsi/ - obj-y += net/ diff --git a/target/linux/ar71xx/patches-4.14/432-spi-rb4xx-spi-driver.patch b/target/linux/ar71xx/patches-4.14/432-spi-rb4xx-spi-driver.patch deleted file mode 100644 index eeebc95c7..000000000 --- a/target/linux/ar71xx/patches-4.14/432-spi-rb4xx-spi-driver.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -563,6 +563,12 @@ config SPI_QUP - This driver can also be built as a module. If so, the module - will be called spi_qup. - -+config SPI_RB4XX -+ tristate "Mikrotik RB4XX SPI master" -+ depends on SPI_MASTER && ATH79_MACH_RB4XX -+ help -+ SPI controller driver for the Mikrotik RB4xx series boards. -+ - config SPI_S3C24XX - tristate "Samsung S3C24XX series SPI" - depends on ARCH_S3C24XX ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -77,6 +77,7 @@ obj-$(CONFIG_SPI_PPC4xx) += spi-ppc4xx.o - spi-pxa2xx-platform-objs := spi-pxa2xx.o spi-pxa2xx-dma.o - obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-platform.o - obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o -+obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o - obj-$(CONFIG_SPI_QUP) += spi-qup.o - obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o - obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o diff --git a/target/linux/ar71xx/patches-4.14/433-spi-rb4xx-cpld-driver.patch b/target/linux/ar71xx/patches-4.14/433-spi-rb4xx-cpld-driver.patch deleted file mode 100644 index 85201f28b..000000000 --- a/target/linux/ar71xx/patches-4.14/433-spi-rb4xx-cpld-driver.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -801,6 +801,13 @@ config SPI_TLE62X0 - sysfs interface, with each line presented as a kind of GPIO - exposing both switch control and diagnostic feedback. - -+config SPI_RB4XX_CPLD -+ tristate "MikroTik RB4XX CPLD driver" -+ depends on ATH79_MACH_RB4XX -+ help -+ SPI driver for the Xilinx CPLD chip present on the -+ MikroTik RB4xx boards. -+ - # - # Add new SPI protocol masters in alphabetical order above this line - # ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -78,6 +78,7 @@ spi-pxa2xx-platform-objs := spi-pxa2xx.o spi-pxa2xx-dma.o - obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-platform.o - obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o - obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o -+obj-$(CONFIG_SPI_RB4XX_CPLD) += spi-rb4xx-cpld.o - obj-$(CONFIG_SPI_QUP) += spi-qup.o - obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o - obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o diff --git a/target/linux/ar71xx/patches-4.14/435-spi-vsc7385_driver.patch b/target/linux/ar71xx/patches-4.14/435-spi-vsc7385_driver.patch deleted file mode 100644 index 085dd3ebf..000000000 --- a/target/linux/ar71xx/patches-4.14/435-spi-vsc7385_driver.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/spi/Kconfig -+++ b/drivers/spi/Kconfig -@@ -808,6 +808,11 @@ config SPI_RB4XX_CPLD - SPI driver for the Xilinx CPLD chip present on the - MikroTik RB4xx boards. - -+config SPI_VSC7385 -+ tristate "Vitesse VSC7385 ethernet switch driver" -+ help -+ SPI driver for the Vitesse VSC7385 ethernet switch. -+ - # - # Add new SPI protocol masters in alphabetical order above this line - # ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -105,6 +105,7 @@ spi-thunderx-objs := spi-cavium.o spi-cavium-thunderx.o - obj-$(CONFIG_SPI_THUNDERX) += spi-thunderx.o - obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o - obj-$(CONFIG_SPI_TXX9) += spi-txx9.o -+obj-$(CONFIG_SPI_VSC7385) += spi-vsc7385.o - obj-$(CONFIG_SPI_XCOMM) += spi-xcomm.o - obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o - obj-$(CONFIG_SPI_XLP) += spi-xlp.o diff --git a/target/linux/ar71xx/patches-4.14/440-leds-wndr3700-usb-led-driver.patch b/target/linux/ar71xx/patches-4.14/440-leds-wndr3700-usb-led-driver.patch deleted file mode 100644 index 8b6b885fc..000000000 --- a/target/linux/ar71xx/patches-4.14/440-leds-wndr3700-usb-led-driver.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -696,6 +696,13 @@ config LEDS_NIC78BX - To compile this driver as a module, choose M here: the module - will be called leds-nic78bx. - -+config LEDS_WNDR3700_USB -+ tristate "NETGEAR WNDR3700 USB LED driver" -+ depends on LEDS_CLASS && ATH79_MACH_WNDR3700 -+ help -+ This option enables support for the USB LED found on the -+ NETGEAR WNDR3700 board. -+ - comment "LED Triggers" - source "drivers/leds/trigger/Kconfig" - ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -51,6 +51,7 @@ obj-$(CONFIG_LEDS_DA9052) += leds-da9052.o - obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o - obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o - obj-$(CONFIG_LEDS_PWM) += leds-pwm.o -+obj-${CONFIG_LEDS_WNDR3700_USB} += leds-wndr3700-usb.o - obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o - obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o - obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o diff --git a/target/linux/ar71xx/patches-4.14/441-leds-rb750-led-driver.patch b/target/linux/ar71xx/patches-4.14/441-leds-rb750-led-driver.patch deleted file mode 100644 index bc844fe12..000000000 --- a/target/linux/ar71xx/patches-4.14/441-leds-rb750-led-driver.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -703,6 +703,10 @@ config LEDS_WNDR3700_USB - This option enables support for the USB LED found on the - NETGEAR WNDR3700 board. - -+config LEDS_RB750 -+ tristate "LED driver for the Mikrotik RouterBOARD 750" -+ depends on LEDS_CLASS && ATH79_MACH_RB750 -+ - comment "LED Triggers" - source "drivers/leds/trigger/Kconfig" - ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -57,6 +57,7 @@ obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o - obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o - obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o - obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o -+obj-$(CONFIG_LEDS_RB750) += leds-rb750.o - obj-$(CONFIG_LEDS_NS2) += leds-ns2.o - obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o - obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o diff --git a/target/linux/ar71xx/patches-4.14/442-leds-gpio-allow-to-use-OPEN_-DRAIN-SOURCE-flags-with.patch b/target/linux/ar71xx/patches-4.14/442-leds-gpio-allow-to-use-OPEN_-DRAIN-SOURCE-flags-with.patch deleted file mode 100644 index bc7884be0..000000000 --- a/target/linux/ar71xx/patches-4.14/442-leds-gpio-allow-to-use-OPEN_-DRAIN-SOURCE-flags-with.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 183148e0789bee1cd5c46ba49afcb211f636f8a2 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 15 Jan 2018 15:01:14 +0100 -Subject: [PATCH] leds: gpio: allow to use OPEN_{DRAIN,SOURCE} flags with - legacy GPIOs - -LEDs which are connected to open-source or open-drain type of GPIO lines -can be used only, if those are defined via devicetree. -Add two new fields to 'struct gpio_led' in order to make it possible to -specify this type of GPIO lines to the leds-gpio driver via platform data. -Also update the create_gpio_led() function to set the GPIOF_OPEN_DRAIN and -GPIOF_OPEN_SOURCE flags for the given GPIO line. - -Signed-off-by: Gabor Juhos ---- - drivers/leds/leds-gpio.c | 6 ++++++ - include/linux/leds.h | 2 ++ - 2 files changed, 8 insertions(+) - ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -100,6 +100,12 @@ static int create_gpio_led(const struct gpio_led *template, - if (template->active_low) - flags |= GPIOF_ACTIVE_LOW; - -+ if (template->open_drain) -+ flags |= GPIOF_OPEN_DRAIN; -+ -+ if (template->open_source) -+ flags |= GPIOF_OPEN_SOURCE; -+ - ret = devm_gpio_request_one(parent, template->gpio, flags, - template->name); - if (ret < 0) ---- a/include/linux/leds.h -+++ b/include/linux/leds.h -@@ -395,6 +395,8 @@ struct gpio_led { - unsigned default_state : 2; - unsigned retain_state_shutdown : 1; - /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ -+ unsigned open_drain : 1; -+ unsigned open_source : 1; - struct gpio_desc *gpiod; - }; - #define LEDS_GPIO_DEFSTATE_OFF 0 diff --git a/target/linux/ar71xx/patches-4.14/450-gpio-nxp-74hc153-gpio-chip-driver.patch b/target/linux/ar71xx/patches-4.14/450-gpio-nxp-74hc153-gpio-chip-driver.patch deleted file mode 100644 index 3ea491bc3..000000000 --- a/target/linux/ar71xx/patches-4.14/450-gpio-nxp-74hc153-gpio-chip-driver.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -1298,4 +1298,12 @@ config GPIO_VIPERBOARD - - endmenu - -+comment "Other GPIO expanders" -+ -+config GPIO_NXP_74HC153 -+ tristate "NXP 74HC153 Dual 4-input multiplexer" -+ help -+ Platform driver for NXP 74HC153 Dual 4-input Multiplexer. This -+ provides a GPIO interface supporting input mode only. -+ - endif ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -89,6 +89,7 @@ obj-$(CONFIG_GPIO_MSIC) += gpio-msic.o - obj-$(CONFIG_GPIO_MVEBU) += gpio-mvebu.o - obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o - obj-$(CONFIG_GPIO_MXS) += gpio-mxs.o -+obj-$(CONFIG_GPIO_NXP_74HC153) += gpio-nxp-74hc153.o - obj-$(CONFIG_GPIO_OCTEON) += gpio-octeon.o - obj-$(CONFIG_GPIO_OMAP) += gpio-omap.o - obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o diff --git a/target/linux/ar71xx/patches-4.14/451-gpio-74x164-improve-platform-device-support.patch b/target/linux/ar71xx/patches-4.14/451-gpio-74x164-improve-platform-device-support.patch deleted file mode 100644 index aae5c10d3..000000000 --- a/target/linux/ar71xx/patches-4.14/451-gpio-74x164-improve-platform-device-support.patch +++ /dev/null @@ -1,119 +0,0 @@ ---- a/drivers/gpio/gpio-74x164.c -+++ b/drivers/gpio/gpio-74x164.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -105,9 +106,16 @@ static int gen_74x164_direction_output(struct gpio_chip *gc, - static int gen_74x164_probe(struct spi_device *spi) - { - struct gen_74x164_chip *chip; -+ struct gen_74x164_chip_platform_data *pdata = spi->dev.platform_data; -+ struct device_node *np = spi->dev.of_node; - u32 nregs; - int ret; - -+ if (!np && !pdata) { -+ dev_err(&spi->dev, "No configuration data available.\n"); -+ return -EINVAL; -+ } -+ - /* - * bits_per_word cannot be configured in platform data - */ -@@ -117,12 +125,15 @@ static int gen_74x164_probe(struct spi_device *spi) - if (ret < 0) - return ret; - -- if (of_property_read_u32(spi->dev.of_node, "registers-number", -- &nregs)) { -- dev_err(&spi->dev, -- "Missing registers-number property in the DT.\n"); -- return -EINVAL; -- } -+ if (np) { -+ if (of_property_read_u32(np, "registers-number", &nregs)) { -+ dev_err(&spi->dev, -+ "Missing registers-number property in the DT.\n"); -+ return -EINVAL; -+ } -+ } else if (pdata) { -+ nregs = pdata->num_registers; -+ } - - chip = devm_kzalloc(&spi->dev, sizeof(*chip) + nregs, GFP_KERNEL); - if (!chip) -@@ -142,7 +153,11 @@ static int gen_74x164_probe(struct spi_device *spi) - chip->gpio_chip.get = gen_74x164_get_value; - chip->gpio_chip.set = gen_74x164_set_value; - chip->gpio_chip.set_multiple = gen_74x164_set_multiple; -- chip->gpio_chip.base = -1; -+ if (np) -+ chip->gpio_chip.base = -1; -+ else if (pdata) -+ chip->gpio_chip.base = pdata->base; -+ - - chip->registers = nregs; - chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; -@@ -151,6 +166,9 @@ static int gen_74x164_probe(struct spi_device *spi) - chip->gpio_chip.parent = &spi->dev; - chip->gpio_chip.owner = THIS_MODULE; - -+ if (pdata && pdata->init_data) -+ memcpy(chip->buffer, pdata->init_data, chip->registers); -+ - mutex_init(&chip->lock); - - ret = __gen_74x164_write_config(chip); -@@ -180,17 +198,19 @@ static int gen_74x164_remove(struct spi_device *spi) - return 0; - } - -+#ifdef CONFIG_OF - static const struct of_device_id gen_74x164_dt_ids[] = { - { .compatible = "fairchild,74hc595" }, - { .compatible = "nxp,74lvc594" }, - {}, - }; - MODULE_DEVICE_TABLE(of, gen_74x164_dt_ids); -+#endif - - static struct spi_driver gen_74x164_driver = { - .driver = { - .name = "74x164", -- .of_match_table = gen_74x164_dt_ids, -+ .of_match_table = of_match_ptr(gen_74x164_dt_ids), - }, - .probe = gen_74x164_probe, - .remove = gen_74x164_remove, ---- /dev/null -+++ b/include/linux/spi/74x164.h -@@ -0,0 +1,13 @@ -+#ifndef LINUX_SPI_74X164_H -+#define LINUX_SPI_74X164_H -+ -+struct gen_74x164_chip_platform_data { -+ /* number assigned to the first GPIO */ -+ unsigned base; -+ /* number of chained registers */ -+ unsigned num_registers; -+ /* address of a buffer containing initial data */ -+ u8 *init_data; -+}; -+ -+#endif ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -1250,7 +1250,6 @@ menu "SPI GPIO expanders" - - config GPIO_74X164 - tristate "74x164 serial-in/parallel-out 8-bits shift register" -- depends on OF_GPIO - help - Driver for 74x164 compatible serial-in/parallel-out 8-outputs - shift registers. This driver can be used to provide access diff --git a/target/linux/ar71xx/patches-4.14/452-gpio-add-gpio-latch-driver.patch b/target/linux/ar71xx/patches-4.14/452-gpio-add-gpio-latch-driver.patch deleted file mode 100644 index 0e1e327d5..000000000 --- a/target/linux/ar71xx/patches-4.14/452-gpio-add-gpio-latch-driver.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -1305,4 +1305,9 @@ config GPIO_NXP_74HC153 - Platform driver for NXP 74HC153 Dual 4-input Multiplexer. This - provides a GPIO interface supporting input mode only. - -+config GPIO_LATCH -+ tristate "GPIO latch driver" -+ help -+ Say yes here to enable a GPIO latch driver. -+ - endif ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -63,6 +63,7 @@ obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o - obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o - obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o - obj-$(CONFIG_GPIO_INTEL_MID) += gpio-intel-mid.o -+obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o - obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o - obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o - obj-$(CONFIG_GPIO_LPC18XX) += gpio-lpc18xx.o diff --git a/target/linux/ar71xx/patches-4.14/461-spi-ath79-add-fast-flash-read.patch b/target/linux/ar71xx/patches-4.14/461-spi-ath79-add-fast-flash-read.patch deleted file mode 100644 index e2771691b..000000000 --- a/target/linux/ar71xx/patches-4.14/461-spi-ath79-add-fast-flash-read.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/drivers/spi/spi-ath79.c -+++ b/drivers/spi/spi-ath79.c -@@ -102,9 +102,6 @@ static void ath79_spi_enable(struct ath79_spi *sp) - /* 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) -@@ -204,6 +201,38 @@ static u32 ath79_spi_txrx_mode0(struct spi_device *spi, unsigned int nsecs, - return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); - } - -+static bool ath79_spi_flash_read_supported(struct spi_device *spi) -+{ -+ if (spi->chip_select || gpio_is_valid(spi->cs_gpio)) -+ return false; -+ -+ return true; -+} -+ -+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; -+ -+ /* 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; -@@ -233,6 +262,8 @@ static int ath79_spi_probe(struct platform_device *pdev) - master->num_chipselect = pdata->num_chipselect; - master->cs_gpios = pdata->cs_gpios; - } -+ master->spi_flash_read = ath79_spi_read_flash_data; -+ master->flash_read_supported = ath79_spi_flash_read_supported; - - sp->bitbang.master = master; - sp->bitbang.chipselect = ath79_spi_chipselect; diff --git a/target/linux/ar71xx/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch b/target/linux/ar71xx/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch deleted file mode 100644 index 7c39a9251..000000000 --- a/target/linux/ar71xx/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch +++ /dev/null @@ -1,111 +0,0 @@ ---- /dev/null -+++ b/arch/mips/include/asm/mach-ath79/mangle-port.h -@@ -0,0 +1,37 @@ -+/* -+ * Copyright (C) 2012 Gabor Juhos -+ * -+ * This file was derived from: inlude/asm-mips/mach-generic/mangle-port.h -+ * Copyright (C) 2003, 2004 Ralf Baechle -+ * -+ * 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_ATH79_MANGLE_PORT_H -+#define __ASM_MACH_ATH79_MANGLE_PORT_H -+ -+#ifdef CONFIG_PCI -+extern unsigned long (ath79_pci_swizzle_b)(unsigned long port); -+extern unsigned long (ath79_pci_swizzle_w)(unsigned long port); -+#else -+#define ath79_pci_swizzle_b(port) (port) -+#define ath79_pci_swizzle_w(port) (port) -+#endif -+ -+#define __swizzle_addr_b(port) ath79_pci_swizzle_b(port) -+#define __swizzle_addr_w(port) ath79_pci_swizzle_w(port) -+#define __swizzle_addr_l(port) (port) -+#define __swizzle_addr_q(port) (port) -+ -+# define ioswabb(a, x) (x) -+# define __mem_ioswabb(a, x) (x) -+# define ioswabw(a, x) (x) -+# define __mem_ioswabw(a, x) cpu_to_le16(x) -+# define ioswabl(a, x) (x) -+# define __mem_ioswabl(a, x) cpu_to_le32(x) -+# define ioswabq(a, x) (x) -+# define __mem_ioswabq(a, x) cpu_to_le64(x) -+ -+#endif /* __ASM_MACH_ATH79_MANGLE_PORT_H */ ---- a/arch/mips/ath79/pci.c -+++ b/arch/mips/ath79/pci.c -@@ -13,6 +13,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -25,6 +26,9 @@ static int (*ath79_pci_plat_dev_init)(struct pci_dev *dev); - static const struct ath79_pci_irq *ath79_pci_irq_map; - static unsigned ath79_pci_nr_irqs; - -+static unsigned long (*__ath79_pci_swizzle_b)(unsigned long port); -+static unsigned long (*__ath79_pci_swizzle_w)(unsigned long port); -+ - static const struct ath79_pci_irq ar71xx_pci_irq_map[] = { - { - .slot = 17, -@@ -212,12 +216,50 @@ ath79_register_pci_ar724x(int id, - return pdev; - } - -+static inline bool ar71xx_is_pci_addr(unsigned long port) -+{ -+ unsigned long phys = CPHYSADDR(port); -+ -+ return (phys >= AR71XX_PCI_MEM_BASE && -+ phys < AR71XX_PCI_MEM_BASE + AR71XX_PCI_MEM_SIZE); -+} -+ -+static unsigned long ar71xx_pci_swizzle_b(unsigned long port) -+{ -+ return ar71xx_is_pci_addr(port) ? port ^ 3 : port; -+} -+ -+static unsigned long ar71xx_pci_swizzle_w(unsigned long port) -+{ -+ return ar71xx_is_pci_addr(port) ? port ^ 2 : port; -+} -+ -+unsigned long ath79_pci_swizzle_b(unsigned long port) -+{ -+ if (__ath79_pci_swizzle_b) -+ return __ath79_pci_swizzle_b(port); -+ -+ return port; -+} -+EXPORT_SYMBOL(ath79_pci_swizzle_b); -+ -+unsigned long ath79_pci_swizzle_w(unsigned long port) -+{ -+ if (__ath79_pci_swizzle_w) -+ return __ath79_pci_swizzle_w(port); -+ -+ return port; -+} -+EXPORT_SYMBOL(ath79_pci_swizzle_w); -+ - int __init ath79_register_pci(void) - { - struct platform_device *pdev = NULL; - - if (soc_is_ar71xx()) { - pdev = ath79_register_pci_ar71xx(); -+ __ath79_pci_swizzle_b = ar71xx_pci_swizzle_b; -+ __ath79_pci_swizzle_w = ar71xx_pci_swizzle_w; - } else if (soc_is_ar724x()) { - pdev = ath79_register_pci_ar724x(-1, - AR724X_PCI_CFG_BASE, diff --git a/target/linux/ar71xx/patches-4.14/490-usb-ehci-add-quirks-for-qca-socs.patch b/target/linux/ar71xx/patches-4.14/490-usb-ehci-add-quirks-for-qca-socs.patch deleted file mode 100644 index d3c10f57a..000000000 --- a/target/linux/ar71xx/patches-4.14/490-usb-ehci-add-quirks-for-qca-socs.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -252,6 +252,37 @@ int ehci_reset(struct ehci_hcd *ehci) - command |= CMD_RESET; - dbg_cmd (ehci, "reset", command); - ehci_writel(ehci, command, &ehci->regs->command); -+ -+ if (ehci->qca_force_host_mode) { -+ u32 usbmode; -+ -+ udelay(1000); -+ -+ usbmode = ehci_readl(ehci, &ehci->regs->usbmode); -+ usbmode |= USBMODE_CM_HC | (1 << 4); -+ ehci_writel(ehci, usbmode, &ehci->regs->usbmode); -+ -+ ehci_dbg(ehci, "forced host mode, usbmode: %08x\n", -+ ehci_readl(ehci, &ehci->regs->usbmode)); -+ } -+ -+ if (ehci->qca_force_16bit_ptw) { -+ u32 port_status; -+ -+ udelay(1000); -+ -+ /* enable 16-bit UTMI interface */ -+ port_status = ehci_readl(ehci, &ehci->regs->port_status[0]); -+ port_status |= BIT(28); -+ ehci_writel(ehci, port_status, &ehci->regs->port_status[0]); -+ -+ ehci_dbg(ehci, "16-bit UTMI interface enabled, status: %08x\n", -+ ehci_readl(ehci, &ehci->regs->port_status[0])); -+ } -+ -+ if (ehci->reset_notifier) -+ ehci->reset_notifier(ehci_to_hcd(ehci)); -+ - ehci->rh_state = EHCI_RH_HALTED; - ehci->next_statechange = jiffies; - retval = ehci_handshake(ehci, &ehci->regs->command, ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -53,6 +53,14 @@ struct ehci_platform_priv { - - static const char hcd_name[] = "ehci-platform"; - -+static void ehci_platform_reset_notifier(struct usb_hcd *hcd) -+{ -+ struct platform_device *pdev = to_platform_device(hcd->self.controller); -+ struct usb_ehci_pdata *pdata = pdev->dev.platform_data; -+ -+ pdata->reset_notifier(pdev); -+} -+ - static int ehci_platform_reset(struct usb_hcd *hcd) - { - struct platform_device *pdev = to_platform_device(hcd->self.controller); -@@ -265,6 +273,13 @@ static int ehci_platform_probe(struct platform_device *dev) - priv->reset_on_resume = true; - if (pdata->ignore_oc) - ehci->ignore_oc = 1; -+ if (pdata->qca_force_host_mode) -+ ehci->qca_force_host_mode = 1; -+ if (pdata->qca_force_16bit_ptw) -+ ehci->qca_force_16bit_ptw = 1; -+ -+ if (pdata->reset_notifier) -+ ehci->reset_notifier = ehci_platform_reset_notifier; - - #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO - if (ehci->big_endian_mmio) { ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -232,6 +232,10 @@ struct ehci_hcd { /* one per controller */ - unsigned need_oc_pp_cycle:1; /* MPC834X port power */ - unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ - unsigned ignore_oc:1; -+ unsigned qca_force_host_mode:1; -+ unsigned qca_force_16bit_ptw:1; /* force 16 bit UTMI */ -+ -+ void (*reset_notifier)(struct usb_hcd *hcd); - - /* required for usb32 quirk */ - #define OHCI_CTRL_HCFS (3 << 6) ---- a/include/linux/usb/ehci_pdriver.h -+++ b/include/linux/usb/ehci_pdriver.h -@@ -50,6 +50,8 @@ struct usb_ehci_pdata { - unsigned reset_on_resume:1; - unsigned dma_mask_64:1; - unsigned ignore_oc:1; -+ unsigned qca_force_host_mode:1; -+ unsigned qca_force_16bit_ptw:1; - - /* Turn on all power and clocks */ - int (*power_on)(struct platform_device *pdev); -@@ -59,6 +61,7 @@ struct usb_ehci_pdata { - * turn off everything else */ - void (*power_suspend)(struct platform_device *pdev); - int (*pre_setup)(struct usb_hcd *hcd); -+ void (*reset_notifier)(struct platform_device *pdev); - }; - - #endif /* __USB_CORE_EHCI_PDRIVER_H */ diff --git a/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch b/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch deleted file mode 100644 index 611029678..000000000 --- a/target/linux/ar71xx/patches-4.14/500-MIPS-fw-myloader.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1151,6 +1151,9 @@ config MIPS_MSC - config MIPS_NILE4 - bool - -+config MYLOADER -+ bool -+ - config SYNC_R4K - bool - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -227,6 +227,7 @@ cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT - # - libs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/ - libs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/ -+libs-$(CONFIG_MYLOADER) += arch/mips/fw/myloader/ - libs-$(CONFIG_FW_SNIPROM) += arch/mips/fw/sni/ - libs-y += arch/mips/fw/lib/ - diff --git a/target/linux/ar71xx/patches-4.14/501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch b/target/linux/ar71xx/patches-4.14/501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch deleted file mode 100644 index 12ab3b50d..000000000 --- a/target/linux/ar71xx/patches-4.14/501-MIPS-ath79-add-mac-argument-to-ath79_register_wmac.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -22,6 +23,7 @@ - #include - #include "dev-wmac.h" - -+static u8 ath79_wmac_mac[ETH_ALEN]; - static struct ath9k_platform_data ath79_wmac_data; - - static struct resource ath79_wmac_resources[] = { -@@ -161,7 +163,7 @@ static void qca955x_wmac_setup(void) - ath79_wmac_data.is_clk_25mhz = true; - } - --void __init ath79_register_wmac(u8 *cal_data) -+void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr) - { - if (soc_is_ar913x()) - ar913x_wmac_setup(); -@@ -178,5 +180,10 @@ void __init ath79_register_wmac(u8 *cal_ - memcpy(ath79_wmac_data.eeprom_data, cal_data, - sizeof(ath79_wmac_data.eeprom_data)); - -+ if (mac_addr) { -+ memcpy(ath79_wmac_mac, mac_addr, sizeof(ath79_wmac_mac)); -+ ath79_wmac_data.macaddr = ath79_wmac_mac; -+ } -+ - platform_device_register(&ath79_wmac_device); - } ---- a/arch/mips/ath79/dev-wmac.h -+++ b/arch/mips/ath79/dev-wmac.h -@@ -12,6 +12,6 @@ - #ifndef _ATH79_DEV_WMAC_H - #define _ATH79_DEV_WMAC_H - --void ath79_register_wmac(u8 *cal_data); -+void ath79_register_wmac(u8 *cal_data, u8 *mac_addr); - - #endif /* _ATH79_DEV_WMAC_H */ ---- a/arch/mips/ath79/mach-db120.c -+++ b/arch/mips/ath79/mach-db120.c -@@ -128,7 +128,7 @@ static void __init db120_setup(void) - ath79_register_spi(&db120_spi_data, db120_spi_info, - ARRAY_SIZE(db120_spi_info)); - ath79_register_usb(); -- ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET); -+ ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET, NULL); - db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET); - } - ---- a/arch/mips/ath79/mach-ap121.c -+++ b/arch/mips/ath79/mach-ap121.c -@@ -85,7 +85,7 @@ static void __init ap121_setup(void) - ath79_register_spi(&ap121_spi_data, ap121_spi_info, - ARRAY_SIZE(ap121_spi_info)); - ath79_register_usb(); -- ath79_register_wmac(cal_data); -+ ath79_register_wmac(cal_data, NULL); - } - - MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board", diff --git a/target/linux/ar71xx/patches-4.14/504-MIPS-ath79-add-ath79_device_reset_get.patch b/target/linux/ar71xx/patches-4.14/504-MIPS-ath79-add-ath79_device_reset_get.patch deleted file mode 100644 index c0e96b272..000000000 --- a/target/linux/ar71xx/patches-4.14/504-MIPS-ath79-add-ath79_device_reset_get.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -145,6 +145,7 @@ 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_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3); - void ath79_misc_irq_init(void __iomem *regs, int irq, ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -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; -+ u32 reg; -+ u32 ret; -+ -+ if (soc_is_ar71xx()) -+ reg = AR71XX_RESET_REG_RESET_MODULE; -+ else if (soc_is_ar724x()) -+ reg = AR724X_RESET_REG_RESET_MODULE; -+ else if (soc_is_ar913x()) -+ reg = AR913X_RESET_REG_RESET_MODULE; -+ else if (soc_is_ar933x()) -+ reg = AR933X_RESET_REG_RESET_MODULE; -+ else if (soc_is_ar934x()) -+ reg = AR934X_RESET_REG_RESET_MODULE; -+ else -+ BUG(); -+ -+ spin_lock_irqsave(&ath79_device_reset_lock, flags); -+ ret = ath79_reset_rr(reg); -+ spin_unlock_irqrestore(&ath79_device_reset_lock, flags); -+ return ret; -+} -+EXPORT_SYMBOL_GPL(ath79_device_reset_get); diff --git a/target/linux/ar71xx/patches-4.14/505-MIPS-ath79-add-ath79_gpio_function_select.patch b/target/linux/ar71xx/patches-4.14/505-MIPS-ath79-add-ath79_gpio_function_select.patch deleted file mode 100644 index 278e78153..000000000 --- a/target/linux/ar71xx/patches-4.14/505-MIPS-ath79-add-ath79_gpio_function_select.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/arch/mips/ath79/common.h -+++ b/arch/mips/ath79/common.h -@@ -27,6 +27,7 @@ void ath79_ddr_ctrl_init(void); - void ath79_gpio_function_enable(u32 mask); - void ath79_gpio_function_disable(u32 mask); - void ath79_gpio_function_setup(u32 set, u32 clear); -+void ath79_gpio_output_select(unsigned gpio, u8 val); - void ath79_gpio_init(void); - - #endif /* __ATH79_COMMON_H */ ---- a/arch/mips/ath79/gpio.c -+++ b/arch/mips/ath79/gpio.c -@@ -57,3 +57,26 @@ void ath79_gpio_function_disable(u32 mas - { - ath79_gpio_function_setup(0, mask); - } -+ -+void __init ath79_gpio_output_select(unsigned gpio, u8 val) -+{ -+ void __iomem *base = ath79_gpio_base; -+ unsigned int reg; -+ u32 t, s; -+ -+ BUG_ON(!soc_is_ar934x()); -+ -+ if (gpio >= AR934X_GPIO_COUNT) -+ return; -+ -+ reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4); -+ s = 8 * (gpio % 4); -+ -+ t = __raw_readl(base + reg); -+ t &= ~(0xff << s); -+ t |= val << s; -+ __raw_writel(t, base + reg); -+ -+ /* flush write */ -+ (void) __raw_readl(base + reg); -+} diff --git a/target/linux/ar71xx/patches-4.14/506-MIPS-ath79-prom-parse-redboot-args.patch b/target/linux/ar71xx/patches-4.14/506-MIPS-ath79-prom-parse-redboot-args.patch deleted file mode 100644 index 46beeffee..000000000 --- a/target/linux/ar71xx/patches-4.14/506-MIPS-ath79-prom-parse-redboot-args.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/arch/mips/ath79/prom.c -+++ b/arch/mips/ath79/prom.c -@@ -22,10 +22,39 @@ - - #include "common.h" - -+static char ath79_cmdline_buf[COMMAND_LINE_SIZE] __initdata; -+ -+static void __init ath79_prom_append_cmdline(const char *name, -+ const char *value) -+{ -+ snprintf(ath79_cmdline_buf, sizeof(ath79_cmdline_buf), -+ " %s=%s", name, value); -+ strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline)); -+} -+ - void __init prom_init(void) - { -+ const char *env; -+ - fw_init_cmdline(); - -+ env = fw_getenv("ethaddr"); -+ if (env) -+ ath79_prom_append_cmdline("ethaddr", env); -+ -+ env = fw_getenv("board"); -+ if (env) { -+ /* Workaround for buggy bootloaders */ -+ if (strcmp(env, "RouterStation") == 0 || -+ strcmp(env, "Ubiquiti AR71xx-based board") == 0) -+ env = "UBNT-RS"; -+ -+ if (strcmp(env, "RouterStation PRO") == 0) -+ env = "UBNT-RSPRO"; -+ -+ ath79_prom_append_cmdline("board", env); -+ } -+ - #ifdef CONFIG_BLK_DEV_INITRD - /* Read the initrd address from the firmware environment */ - initrd_start = fw_getenvl("initrd_start"); diff --git a/target/linux/ar71xx/patches-4.14/507-MIPS-ath79-prom-add-myloader-support.patch b/target/linux/ar71xx/patches-4.14/507-MIPS-ath79-prom-add-myloader-support.patch deleted file mode 100644 index 17a97335d..000000000 --- a/target/linux/ar71xx/patches-4.14/507-MIPS-ath79-prom-add-myloader-support.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/arch/mips/ath79/prom.c -+++ b/arch/mips/ath79/prom.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include "common.h" - -@@ -32,10 +33,44 @@ static void __init ath79_prom_append_cmd - strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline)); - } - -+static int __init ath79_prom_init_myloader(void) -+{ -+ struct myloader_info *mylo; -+ char mac_buf[32]; -+ unsigned char *mac; -+ -+ mylo = myloader_get_info(); -+ if (!mylo) -+ return 0; -+ -+ switch (mylo->did) { -+ case DEVID_COMPEX_WP543: -+ ath79_prom_append_cmdline("board", "WP543"); -+ break; -+ case DEVID_COMPEX_WPE72: -+ ath79_prom_append_cmdline("board", "WPE72"); -+ break; -+ default: -+ pr_warn("prom: unknown device id: %x\n", mylo->did); -+ return 0; -+ } -+ -+ mac = mylo->macs[0]; -+ snprintf(mac_buf, sizeof(mac_buf), "%02x:%02x:%02x:%02x:%02x:%02x", -+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); -+ -+ ath79_prom_append_cmdline("ethaddr", mac_buf); -+ -+ return 1; -+} -+ - void __init prom_init(void) - { - const char *env; - -+ if (ath79_prom_init_myloader()) -+ return; -+ - fw_init_cmdline(); - - env = fw_getenv("ethaddr"); diff --git a/target/linux/ar71xx/patches-4.14/508-MIPS-ath79-prom-image-command-line-hack.patch b/target/linux/ar71xx/patches-4.14/508-MIPS-ath79-prom-image-command-line-hack.patch deleted file mode 100644 index cfa5e72ee..000000000 --- a/target/linux/ar71xx/patches-4.14/508-MIPS-ath79-prom-image-command-line-hack.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- a/arch/mips/ath79/prom.c -+++ b/arch/mips/ath79/prom.c -@@ -33,6 +33,41 @@ static void __init ath79_prom_append_cmd - strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline)); - } - -+#ifdef CONFIG_IMAGE_CMDLINE_HACK -+extern char __image_cmdline[]; -+ -+static int __init ath79_use_image_cmdline(void) -+{ -+ char *p = __image_cmdline; -+ int replace = 0; -+ -+ if (*p == '-') { -+ replace = 1; -+ p++; -+ } -+ -+ if (*p == '\0') -+ return 0; -+ -+ if (replace) { -+ strlcpy(arcs_cmdline, p, sizeof(arcs_cmdline)); -+ } else { -+ strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline)); -+ strlcat(arcs_cmdline, p, sizeof(arcs_cmdline)); -+ } -+ -+ /* Validate and setup environment pointer */ -+ if (fw_arg2 < CKSEG0) -+ _fw_envp = NULL; -+ else -+ _fw_envp = (int *)fw_arg2; -+ -+ return 1; -+} -+#else -+static inline int ath79_use_image_cmdline(void) { return 0; } -+#endif -+ - static int __init ath79_prom_init_myloader(void) - { - struct myloader_info *mylo; -@@ -61,6 +96,8 @@ static int __init ath79_prom_init_myload - - ath79_prom_append_cmdline("ethaddr", mac_buf); - -+ ath79_use_image_cmdline(); -+ - return 1; - } - -@@ -71,7 +108,8 @@ void __init prom_init(void) - if (ath79_prom_init_myloader()) - return; - -- fw_init_cmdline(); -+ if (!ath79_use_image_cmdline()) -+ fw_init_cmdline(); - - env = fw_getenv("ethaddr"); - if (env) ---- a/arch/mips/fw/lib/cmdline.c -+++ b/arch/mips/fw/lib/cmdline.c -@@ -35,6 +35,7 @@ void __init fw_init_cmdline(void) - else - _fw_envp = (int *)fw_arg2; - -+ arcs_cmdline[0] = '\0'; - for (i = 1; i < fw_argc; i++) { - strlcat(arcs_cmdline, fw_argv(i), COMMAND_LINE_SIZE); - if (i < (fw_argc - 1)) diff --git a/target/linux/ar71xx/patches-4.14/509-MIPS-ath79-process-board-kernel-option.patch b/target/linux/ar71xx/patches-4.14/509-MIPS-ath79-process-board-kernel-option.patch deleted file mode 100644 index 3091ab69b..000000000 --- a/target/linux/ar71xx/patches-4.14/509-MIPS-ath79-process-board-kernel-option.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -283,6 +283,8 @@ void __init plat_time_init(void) - mips_hpt_frequency = cpu_clk_rate / 2; - } - -+__setup("board=", mips_machtype_setup); -+ - static int __init ath79_setup(void) - { - if (mips_machtype == ATH79_MACH_GENERIC_OF) diff --git a/target/linux/ar71xx/patches-4.14/510-MIPS-ath79-init-gpio-pin-of-wmac-device.patch b/target/linux/ar71xx/patches-4.14/510-MIPS-ath79-init-gpio-pin-of-wmac-device.patch deleted file mode 100644 index 2d2235e29..000000000 --- a/target/linux/ar71xx/patches-4.14/510-MIPS-ath79-init-gpio-pin-of-wmac-device.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -24,7 +24,10 @@ - #include "dev-wmac.h" - - static u8 ath79_wmac_mac[ETH_ALEN]; --static struct ath9k_platform_data ath79_wmac_data; -+ -+static struct ath9k_platform_data ath79_wmac_data = { -+ .led_pin = -1, -+}; - - static struct resource ath79_wmac_resources[] = { - { diff --git a/target/linux/ar71xx/patches-4.14/520-MIPS-ath79-enable-UART-function.patch b/target/linux/ar71xx/patches-4.14/520-MIPS-ath79-enable-UART-function.patch deleted file mode 100644 index c8649b749..000000000 --- a/target/linux/ar71xx/patches-4.14/520-MIPS-ath79-enable-UART-function.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/arch/mips/ath79/dev-common.c -+++ b/arch/mips/ath79/dev-common.c -@@ -81,6 +81,15 @@ void __init ath79_register_uart(void) - - uart_clk_rate = ath79_get_sys_clk_rate("uart"); - -+ if (soc_is_ar71xx()) -+ ath79_gpio_function_enable(AR71XX_GPIO_FUNC_UART_EN); -+ else if (soc_is_ar724x()) -+ ath79_gpio_function_enable(AR724X_GPIO_FUNC_UART_EN); -+ else if (soc_is_ar913x()) -+ ath79_gpio_function_enable(AR913X_GPIO_FUNC_UART_EN); -+ else if (soc_is_ar933x()) -+ ath79_gpio_function_enable(AR933X_GPIO_FUNC_UART_EN); -+ - if (soc_is_ar71xx() || - soc_is_ar724x() || - soc_is_ar913x() || diff --git a/target/linux/ar71xx/patches-4.14/521-MIPS-ath79-enable-UART-for-early_serial.patch b/target/linux/ar71xx/patches-4.14/521-MIPS-ath79-enable-UART-for-early_serial.patch deleted file mode 100644 index e546ff26f..000000000 --- a/target/linux/ar71xx/patches-4.14/521-MIPS-ath79-enable-UART-for-early_serial.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -58,6 +58,46 @@ static void prom_putchar_dummy(unsigned - /* nothing to do */ - } - -+static void prom_enable_uart(u32 id) -+{ -+ void __iomem *gpio_base; -+ u32 uart_en; -+ u32 t; -+ -+ switch (id) { -+ case REV_ID_MAJOR_AR71XX: -+ uart_en = AR71XX_GPIO_FUNC_UART_EN; -+ break; -+ -+ case REV_ID_MAJOR_AR7240: -+ case REV_ID_MAJOR_AR7241: -+ case REV_ID_MAJOR_AR7242: -+ uart_en = AR724X_GPIO_FUNC_UART_EN; -+ break; -+ -+ case REV_ID_MAJOR_AR913X: -+ uart_en = AR913X_GPIO_FUNC_UART_EN; -+ break; -+ -+ case REV_ID_MAJOR_AR9330: -+ case REV_ID_MAJOR_AR9331: -+ uart_en = AR933X_GPIO_FUNC_UART_EN; -+ break; -+ -+ case REV_ID_MAJOR_AR9341: -+ case REV_ID_MAJOR_AR9342: -+ case REV_ID_MAJOR_AR9344: -+ /* TODO */ -+ default: -+ return; -+ } -+ -+ gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE)); -+ t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC); -+ t |= uart_en; -+ __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC); -+} -+ - static void prom_putchar_init(void) - { - void __iomem *base; -@@ -88,8 +128,10 @@ static void prom_putchar_init(void) - - default: - _prom_putchar = prom_putchar_dummy; -- break; -+ return; - } -+ -+ prom_enable_uart(id); - } - - void prom_putchar(unsigned char ch) diff --git a/target/linux/ar71xx/patches-4.14/522-MIPS-ath79-add-ath79_wmac_register_simple-helper.patch b/target/linux/ar71xx/patches-4.14/522-MIPS-ath79-add-ath79_wmac_register_simple-helper.patch deleted file mode 100644 index 2d5559cb9..000000000 --- a/target/linux/ar71xx/patches-4.14/522-MIPS-ath79-add-ath79_wmac_register_simple-helper.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -190,3 +190,9 @@ void __init ath79_register_wmac(u8 *cal_ - - platform_device_register(&ath79_wmac_device); - } -+ -+void __init ath79_register_wmac_simple(void) -+{ -+ ath79_register_wmac(NULL, NULL); -+ ath79_wmac_data.eeprom_name = "soc_wmac.eeprom"; -+} ---- a/arch/mips/ath79/dev-wmac.h -+++ b/arch/mips/ath79/dev-wmac.h -@@ -13,5 +13,6 @@ - #define _ATH79_DEV_WMAC_H - - void ath79_register_wmac(u8 *cal_data, u8 *mac_addr); -+void ath79_register_wmac_simple(void); - - #endif /* _ATH79_DEV_WMAC_H */ diff --git a/target/linux/ar71xx/patches-4.14/523-MIPS-ath79-OTP-support.patch b/target/linux/ar71xx/patches-4.14/523-MIPS-ath79-OTP-support.patch deleted file mode 100644 index d11d418f1..000000000 --- a/target/linux/ar71xx/patches-4.14/523-MIPS-ath79-OTP-support.patch +++ /dev/null @@ -1,192 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -166,6 +166,149 @@ static void qca955x_wmac_setup(void) - ath79_wmac_data.is_clk_25mhz = true; - } - -+#define AR93XX_WMAC_SIZE \ -+ (soc_is_ar934x() ? AR934X_WMAC_SIZE : AR933X_WMAC_SIZE) -+#define AR93XX_WMAC_BASE \ -+ (soc_is_ar934x() ? AR934X_WMAC_BASE : AR933X_WMAC_BASE) -+ -+#define AR93XX_OTP_BASE \ -+ (soc_is_ar934x() ? AR934X_OTP_BASE : AR9300_OTP_BASE) -+#define AR93XX_OTP_STATUS \ -+ (soc_is_ar934x() ? AR934X_OTP_STATUS : AR9300_OTP_STATUS) -+#define AR93XX_OTP_READ_DATA \ -+ (soc_is_ar934x() ? AR934X_OTP_READ_DATA : AR9300_OTP_READ_DATA) -+ -+static bool __init -+ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data) -+{ -+ int timeout = 1000; -+ u32 val; -+ -+ __raw_readl(base + AR93XX_OTP_BASE + (4 * addr)); -+ while (timeout--) { -+ val = __raw_readl(base + AR93XX_OTP_STATUS); -+ if ((val & AR9300_OTP_STATUS_TYPE) == AR9300_OTP_STATUS_VALID) -+ break; -+ -+ udelay(10); -+ } -+ -+ if (!timeout) -+ return false; -+ -+ *data = __raw_readl(base + AR93XX_OTP_READ_DATA); -+ return true; -+} -+ -+static bool __init -+ar93xx_wmac_otp_read(void __iomem *base, int addr, u8 *dest, int len) -+{ -+ u32 data; -+ int i; -+ -+ for (i = 0; i < len; i++) { -+ int offset = 8 * ((addr - i) % 4); -+ -+ if (!ar93xx_wmac_otp_read_word(base, (addr - i) / 4, &data)) -+ return false; -+ -+ dest[i] = (data >> offset) & 0xff; -+ } -+ -+ return true; -+} -+ -+static bool __init -+ar93xx_wmac_otp_uncompress(void __iomem *base, int addr, int len, u8 *dest, -+ int dest_start, int dest_len) -+{ -+ int dest_bytes = 0; -+ int offset = 0; -+ int end = addr - len; -+ u8 hdr[2]; -+ -+ while (addr > end) { -+ if (!ar93xx_wmac_otp_read(base, addr, hdr, 2)) -+ return false; -+ -+ addr -= 2; -+ offset += hdr[0]; -+ -+ if (offset <= dest_start + dest_len && -+ offset + len >= dest_start) { -+ int data_offset = 0; -+ int dest_offset = 0; -+ int copy_len; -+ -+ if (offset < dest_start) -+ data_offset = dest_start - offset; -+ else -+ dest_offset = offset - dest_start; -+ -+ copy_len = len - data_offset; -+ if (copy_len > dest_len - dest_offset) -+ copy_len = dest_len - dest_offset; -+ -+ ar93xx_wmac_otp_read(base, addr - data_offset, -+ dest + dest_offset, -+ copy_len); -+ -+ dest_bytes += copy_len; -+ } -+ addr -= hdr[1]; -+ } -+ return !!dest_bytes; -+} -+ -+bool __init ar93xx_wmac_read_mac_address(u8 *dest) -+{ -+ void __iomem *base; -+ bool ret = false; -+ int addr = 0x1ff; -+ unsigned int len; -+ u32 hdr_u32; -+ u8 *hdr = (u8 *) &hdr_u32; -+ u8 mac[6] = { 0x00, 0x02, 0x03, 0x04, 0x05, 0x06 }; -+ int mac_start = 2, mac_end = 8; -+ -+ BUG_ON(!soc_is_ar933x() && !soc_is_ar934x()); -+ base = ioremap_nocache(AR93XX_WMAC_BASE, AR93XX_WMAC_SIZE); -+ while (addr > sizeof(hdr_u32)) { -+ if (!ar93xx_wmac_otp_read(base, addr, hdr, sizeof(hdr_u32))) -+ break; -+ -+ if (hdr_u32 == 0 || hdr_u32 == ~0) -+ break; -+ -+ len = (hdr[1] << 4) | (hdr[2] >> 4); -+ addr -= 4; -+ -+ switch (hdr[0] >> 5) { -+ case 0: -+ if (len < mac_end) -+ break; -+ -+ ar93xx_wmac_otp_read(base, addr - mac_start, mac, 6); -+ ret = true; -+ break; -+ case 3: -+ ret |= ar93xx_wmac_otp_uncompress(base, addr, len, mac, -+ mac_start, 6); -+ break; -+ default: -+ break; -+ } -+ -+ addr -= len + 2; -+ } -+ -+ iounmap(base); -+ if (ret) -+ memcpy(dest, mac, 6); -+ -+ return ret; -+} -+ - void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr) - { - if (soc_is_ar913x()) ---- a/arch/mips/ath79/dev-wmac.h -+++ b/arch/mips/ath79/dev-wmac.h -@@ -14,5 +14,6 @@ - - void ath79_register_wmac(u8 *cal_data, u8 *mac_addr); - void ath79_register_wmac_simple(void); -+bool ar93xx_wmac_read_mac_address(u8 *dest); - - #endif /* _ATH79_DEV_WMAC_H */ ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -112,6 +112,14 @@ - #define QCA955X_EHCI1_BASE 0x1b400000 - #define QCA955X_EHCI_SIZE 0x1000 - -+#define AR9300_OTP_BASE 0x14000 -+#define AR9300_OTP_STATUS 0x15f18 -+#define AR9300_OTP_STATUS_TYPE 0x7 -+#define AR9300_OTP_STATUS_VALID 0x4 -+#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 -+#define AR9300_OTP_STATUS_SM_BUSY 0x1 -+#define AR9300_OTP_READ_DATA 0x15f1c -+ - /* - * DDR_CTRL block - */ -@@ -149,6 +157,13 @@ - #define AR934X_DDR_REG_FLUSH_PCIE 0xa8 - #define AR934X_DDR_REG_FLUSH_WMAC 0xac - -+#define AR934X_OTP_BASE 0x30000 -+#define AR934X_OTP_STATUS 0x31018 -+#define AR934X_OTP_READ_DATA 0x3101c -+#define AR934X_OTP_INTF2_ADDRESS 0x31008 -+#define AR934X_OTP_INTF3_ADDRESS 0x3100c -+#define AR934X_OTP_PGENB_SETUP_HOLD_TIME_ADDRESS 0x31034 -+ - /* - * PLL block - */ diff --git a/target/linux/ar71xx/patches-4.14/524-MIPS-ath79-add-ath79_wmac_disable_25ghz-helpers.patch b/target/linux/ar71xx/patches-4.14/524-MIPS-ath79-add-ath79_wmac_disable_25ghz-helpers.patch deleted file mode 100644 index 91e037e24..000000000 --- a/target/linux/ar71xx/patches-4.14/524-MIPS-ath79-add-ath79_wmac_disable_25ghz-helpers.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -309,6 +309,16 @@ bool __init ar93xx_wmac_read_mac_address - return ret; - } - -+void __init ath79_wmac_disable_2ghz(void) -+{ -+ ath79_wmac_data.disable_2ghz = true; -+} -+ -+void __init ath79_wmac_disable_5ghz(void) -+{ -+ ath79_wmac_data.disable_5ghz = true; -+} -+ - void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr) - { - if (soc_is_ar913x()) ---- a/arch/mips/ath79/dev-wmac.h -+++ b/arch/mips/ath79/dev-wmac.h -@@ -14,6 +14,9 @@ - - void ath79_register_wmac(u8 *cal_data, u8 *mac_addr); - void ath79_register_wmac_simple(void); -+void ath79_wmac_disable_2ghz(void); -+void ath79_wmac_disable_5ghz(void); -+ - bool ar93xx_wmac_read_mac_address(u8 *dest); - - #endif /* _ATH79_DEV_WMAC_H */ diff --git a/target/linux/ar71xx/patches-4.14/525-MIPS-ath79-enable-qca-usb-quirks.patch b/target/linux/ar71xx/patches-4.14/525-MIPS-ath79-enable-qca-usb-quirks.patch deleted file mode 100644 index 0e33674ad..000000000 --- a/target/linux/ar71xx/patches-4.14/525-MIPS-ath79-enable-qca-usb-quirks.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- a/arch/mips/ath79/dev-usb.c -+++ b/arch/mips/ath79/dev-usb.c -@@ -37,6 +37,8 @@ static struct usb_ehci_pdata ath79_ehci_ - static struct usb_ehci_pdata ath79_ehci_pdata_v2 = { - .caps_offset = 0x100, - .has_tt = 1, -+ .qca_force_host_mode = 1, -+ .qca_force_16bit_ptw = 1, - }; - - static void __init ath79_usb_register(const char *name, int id, -@@ -159,6 +161,9 @@ static void __init ar913x_usb_setup(void - ath79_device_reset_clear(AR913X_RESET_USB_PHY); - mdelay(10); - -+ ath79_ehci_pdata_v2.qca_force_host_mode = 0; -+ ath79_ehci_pdata_v2.qca_force_16bit_ptw = 0; -+ - ath79_usb_register("ehci-platform", -1, - AR913X_EHCI_BASE, AR913X_EHCI_SIZE, - ATH79_CPU_IRQ(3), -@@ -182,14 +187,34 @@ static void __init ar933x_usb_setup(void - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); - } - --static void __init ar934x_usb_setup(void) -+static void enable_tx_tx_idp_violation_fix(unsigned base) - { -- u32 bootstrap; -+ void __iomem *phy_reg; -+ u32 t; -+ -+ phy_reg = ioremap(base, 4); -+ if (!phy_reg) -+ return; -+ -+ t = ioread32(phy_reg); -+ t &= ~0xff; -+ t |= 0x58; -+ iowrite32(t, phy_reg); -+ -+ iounmap(phy_reg); -+} - -- bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP); -- if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE) -+static void ar934x_usb_reset_notifier(struct platform_device *pdev) -+{ -+ if (pdev->id != -1) - return; - -+ enable_tx_tx_idp_violation_fix(0x18116c94); -+ dev_info(&pdev->dev, "TX-TX IDP fix enabled\n"); -+} -+ -+static void __init ar934x_usb_setup(void) -+{ - ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE); - udelay(1000); - -@@ -202,14 +227,40 @@ static void __init ar934x_usb_setup(void - ath79_device_reset_clear(AR934X_RESET_USB_HOST); - udelay(1000); - -+ if (ath79_soc_rev >= 3) -+ ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier; -+ - ath79_usb_register("ehci-platform", -1, - AR934X_EHCI_BASE, AR934X_EHCI_SIZE, - ATH79_CPU_IRQ(3), - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); - } - -+static void qca955x_usb_reset_notifier(struct platform_device *pdev) -+{ -+ u32 base; -+ -+ switch (pdev->id) { -+ case 0: -+ base = 0x18116c94; -+ break; -+ -+ case 1: -+ base = 0x18116e54; -+ break; -+ -+ default: -+ return; -+ } -+ -+ enable_tx_tx_idp_violation_fix(base); -+ dev_info(&pdev->dev, "TX-TX IDP fix enabled\n"); -+} -+ - static void __init qca955x_usb_setup(void) - { -+ ath79_ehci_pdata_v2.reset_notifier = qca955x_usb_reset_notifier; -+ - ath79_usb_register("ehci-platform", 0, - QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE, - ATH79_IP3_IRQ(0), diff --git a/target/linux/ar71xx/patches-4.14/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-4.14/601-MIPS-ath79-add-more-register-defines.patch deleted file mode 100644 index 2b6cc9e3f..000000000 --- a/target/linux/ar71xx/patches-4.14/601-MIPS-ath79-add-more-register-defines.patch +++ /dev/null @@ -1,456 +0,0 @@ ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -20,6 +20,10 @@ - #include - - #define AR71XX_APB_BASE 0x18000000 -+#define AR71XX_GE0_BASE 0x19000000 -+#define AR71XX_GE0_SIZE 0x10000 -+#define AR71XX_GE1_BASE 0x1a000000 -+#define AR71XX_GE1_SIZE 0x10000 - #define AR71XX_EHCI_BASE 0x1b000000 - #define AR71XX_EHCI_SIZE 0x1000 - #define AR71XX_OHCI_BASE 0x1c000000 -@@ -39,6 +43,8 @@ - #define AR71XX_PLL_SIZE 0x100 - #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000) - #define AR71XX_RESET_SIZE 0x100 -+#define AR71XX_MII_BASE (AR71XX_APB_BASE + 0x00070000) -+#define AR71XX_MII_SIZE 0x100 - - #define AR71XX_PCI_MEM_BASE 0x10000000 - #define AR71XX_PCI_MEM_SIZE 0x07000000 -@@ -81,15 +87,21 @@ - - #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000) - #define AR933X_UART_SIZE 0x14 -+#define AR933X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define AR933X_GMAC_SIZE 0x04 - #define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) - #define AR933X_WMAC_SIZE 0x20000 - #define AR933X_EHCI_BASE 0x1b000000 - #define AR933X_EHCI_SIZE 0x1000 - -+#define AR934X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define AR934X_GMAC_SIZE 0x14 - #define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) - #define AR934X_WMAC_SIZE 0x20000 - #define AR934X_EHCI_BASE 0x1b000000 - #define AR934X_EHCI_SIZE 0x200 -+#define AR934X_NFC_BASE 0x1b000200 -+#define AR934X_NFC_SIZE 0xb8 - #define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000) - #define AR934X_SRIF_SIZE 0x1000 - -@@ -106,11 +118,15 @@ - #define QCA955X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000) - #define QCA955X_PCI_CTRL_SIZE 0x100 - -+#define QCA955X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define QCA955X_GMAC_SIZE 0x40 - #define QCA955X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) - #define QCA955X_WMAC_SIZE 0x20000 - #define QCA955X_EHCI0_BASE 0x1b000000 - #define QCA955X_EHCI1_BASE 0x1b400000 - #define QCA955X_EHCI_SIZE 0x1000 -+#define QCA955X_NFC_BASE 0x1b800200 -+#define QCA955X_NFC_SIZE 0xb8 - - #define AR9300_OTP_BASE 0x14000 - #define AR9300_OTP_STATUS 0x15f18 -@@ -181,6 +197,9 @@ - #define AR71XX_AHB_DIV_SHIFT 20 - #define AR71XX_AHB_DIV_MASK 0x7 - -+#define AR71XX_ETH0_PLL_SHIFT 17 -+#define AR71XX_ETH1_PLL_SHIFT 19 -+ - #define AR724X_PLL_REG_CPU_CONFIG 0x00 - #define AR724X_PLL_REG_PCIE_CONFIG 0x10 - -@@ -193,6 +212,8 @@ - #define AR724X_DDR_DIV_SHIFT 22 - #define AR724X_DDR_DIV_MASK 0x3 - -+#define AR7242_PLL_REG_ETH0_INT_CLOCK 0x2c -+ - #define AR913X_PLL_REG_CPU_CONFIG 0x00 - #define AR913X_PLL_REG_ETH_CONFIG 0x04 - #define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14 -@@ -205,6 +226,9 @@ - #define AR913X_AHB_DIV_SHIFT 19 - #define AR913X_AHB_DIV_MASK 0x1 - -+#define AR913X_ETH0_PLL_SHIFT 20 -+#define AR913X_ETH1_PLL_SHIFT 22 -+ - #define AR933X_PLL_CPU_CONFIG_REG 0x00 - #define AR933X_PLL_CLOCK_CTRL_REG 0x08 - -@@ -226,6 +250,8 @@ - #define AR934X_PLL_CPU_CONFIG_REG 0x00 - #define AR934X_PLL_DDR_CONFIG_REG 0x04 - #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG 0x08 -+#define AR934X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24 -+#define AR934X_PLL_ETH_XMII_CONTROL_REG 0x2c - - #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 - #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -@@ -258,9 +284,13 @@ - #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) - #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -+#define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6) -+ - #define QCA955X_PLL_CPU_CONFIG_REG 0x00 - #define QCA955X_PLL_DDR_CONFIG_REG 0x04 - #define QCA955X_PLL_CLK_CTRL_REG 0x08 -+#define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28 -+#define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48 - - #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 - #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -@@ -385,16 +415,83 @@ - #define AR913X_RESET_USB_HOST BIT(5) - #define AR913X_RESET_USB_PHY BIT(4) - -+#define AR933X_RESET_GE1_MDIO BIT(23) -+#define AR933X_RESET_GE0_MDIO BIT(22) -+#define AR933X_RESET_GE1_MAC BIT(13) - #define AR933X_RESET_WMAC BIT(11) -+#define AR933X_RESET_GE0_MAC BIT(9) - #define AR933X_RESET_USB_HOST BIT(5) - #define AR933X_RESET_USB_PHY BIT(4) - #define AR933X_RESET_USBSUS_OVERRIDE BIT(3) - -+#define AR934X_RESET_HOST BIT(31) -+#define AR934X_RESET_SLIC BIT(30) -+#define AR934X_RESET_HDMA BIT(29) -+#define AR934X_RESET_EXTERNAL BIT(28) -+#define AR934X_RESET_RTC BIT(27) -+#define AR934X_RESET_PCIE_EP_INT BIT(26) -+#define AR934X_RESET_CHKSUM_ACC BIT(25) -+#define AR934X_RESET_FULL_CHIP BIT(24) -+#define AR934X_RESET_GE1_MDIO BIT(23) -+#define AR934X_RESET_GE0_MDIO BIT(22) -+#define AR934X_RESET_CPU_NMI BIT(21) -+#define AR934X_RESET_CPU_COLD BIT(20) -+#define AR934X_RESET_HOST_RESET_INT BIT(19) -+#define AR934X_RESET_PCIE_EP BIT(18) -+#define AR934X_RESET_UART1 BIT(17) -+#define AR934X_RESET_DDR BIT(16) -+#define AR934X_RESET_USB_PHY_PLL_PWD_EXT BIT(15) -+#define AR934X_RESET_NANDF BIT(14) -+#define AR934X_RESET_GE1_MAC BIT(13) -+#define AR934X_RESET_ETH_SWITCH_ANALOG BIT(12) - #define AR934X_RESET_USB_PHY_ANALOG BIT(11) -+#define AR934X_RESET_HOST_DMA_INT BIT(10) -+#define AR934X_RESET_GE0_MAC BIT(9) -+#define AR934X_RESET_ETH_SWITCH BIT(8) -+#define AR934X_RESET_PCIE_PHY BIT(7) -+#define AR934X_RESET_PCIE BIT(6) - #define AR934X_RESET_USB_HOST BIT(5) - #define AR934X_RESET_USB_PHY BIT(4) - #define AR934X_RESET_USBSUS_OVERRIDE BIT(3) -- -+#define AR934X_RESET_LUT BIT(2) -+#define AR934X_RESET_MBOX BIT(1) -+#define AR934X_RESET_I2S BIT(0) -+ -+#define QCA955X_RESET_HOST BIT(31) -+#define QCA955X_RESET_SLIC BIT(30) -+#define QCA955X_RESET_HDMA BIT(29) -+#define QCA955X_RESET_EXTERNAL BIT(28) -+#define QCA955X_RESET_RTC BIT(27) -+#define QCA955X_RESET_PCIE_EP_INT BIT(26) -+#define QCA955X_RESET_CHKSUM_ACC BIT(25) -+#define QCA955X_RESET_FULL_CHIP BIT(24) -+#define QCA955X_RESET_GE1_MDIO BIT(23) -+#define QCA955X_RESET_GE0_MDIO BIT(22) -+#define QCA955X_RESET_CPU_NMI BIT(21) -+#define QCA955X_RESET_CPU_COLD BIT(20) -+#define QCA955X_RESET_HOST_RESET_INT BIT(19) -+#define QCA955X_RESET_PCIE_EP BIT(18) -+#define QCA955X_RESET_UART1 BIT(17) -+#define QCA955X_RESET_DDR BIT(16) -+#define QCA955X_RESET_USB_PHY_PLL_PWD_EXT BIT(15) -+#define QCA955X_RESET_NANDF BIT(14) -+#define QCA955X_RESET_GE1_MAC BIT(13) -+#define QCA955X_RESET_SGMII_ANALOG BIT(12) -+#define QCA955X_RESET_USB_PHY_ANALOG BIT(11) -+#define QCA955X_RESET_HOST_DMA_INT BIT(10) -+#define QCA955X_RESET_GE0_MAC BIT(9) -+#define QCA955X_RESET_SGMII BIT(8) -+#define QCA955X_RESET_PCIE_PHY BIT(7) -+#define QCA955X_RESET_PCIE BIT(6) -+#define QCA955X_RESET_USB_HOST BIT(5) -+#define QCA955X_RESET_USB_PHY BIT(4) -+#define QCA955X_RESET_USBSUS_OVERRIDE BIT(3) -+#define QCA955X_RESET_LUT BIT(2) -+#define QCA955X_RESET_MBOX BIT(1) -+#define QCA955X_RESET_I2S BIT(0) -+ -+#define AR933X_BOOTSTRAP_MDIO_GPIO_EN BIT(18) -+#define AR933X_BOOTSTRAP_EEPBUSY BIT(4) - #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0) - - #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23) -@@ -536,8 +633,22 @@ - #define AR71XX_GPIO_REG_INT_ENABLE 0x24 - #define AR71XX_GPIO_REG_FUNC 0x28 - -+#define AR934X_GPIO_REG_OUT_FUNC0 0x2c -+#define AR934X_GPIO_REG_OUT_FUNC1 0x30 -+#define AR934X_GPIO_REG_OUT_FUNC2 0x34 -+#define AR934X_GPIO_REG_OUT_FUNC3 0x38 -+#define AR934X_GPIO_REG_OUT_FUNC4 0x3c -+#define AR934X_GPIO_REG_OUT_FUNC5 0x40 - #define AR934X_GPIO_REG_FUNC 0x6c - -+#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c -+#define QCA955X_GPIO_REG_OUT_FUNC1 0x30 -+#define QCA955X_GPIO_REG_OUT_FUNC2 0x34 -+#define QCA955X_GPIO_REG_OUT_FUNC3 0x38 -+#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c -+#define QCA955X_GPIO_REG_OUT_FUNC5 0x40 -+#define QCA955X_GPIO_REG_FUNC 0x6c -+ - #define AR71XX_GPIO_COUNT 16 - #define AR7240_GPIO_COUNT 18 - #define AR7241_GPIO_COUNT 20 -@@ -567,4 +678,235 @@ - #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 - #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 - -+#define AR71XX_GPIO_FUNC_STEREO_EN BIT(17) -+#define AR71XX_GPIO_FUNC_SLIC_EN BIT(16) -+#define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13) -+#define AR71XX_GPIO_FUNC_SPI_CS1_EN BIT(12) -+#define AR71XX_GPIO_FUNC_UART_EN BIT(8) -+#define AR71XX_GPIO_FUNC_USB_OC_EN BIT(4) -+#define AR71XX_GPIO_FUNC_USB_CLK_EN BIT(0) -+ -+#define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19) -+#define AR724X_GPIO_FUNC_SPI_EN BIT(18) -+#define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14) -+#define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13) -+#define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12) -+#define AR724X_GPIO_FUNC_CLK_OBS4_EN BIT(11) -+#define AR724X_GPIO_FUNC_CLK_OBS3_EN BIT(10) -+#define AR724X_GPIO_FUNC_CLK_OBS2_EN BIT(9) -+#define AR724X_GPIO_FUNC_CLK_OBS1_EN BIT(8) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3) -+#define AR724X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2) -+#define AR724X_GPIO_FUNC_UART_EN BIT(1) -+#define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0) -+ -+#define AR913X_GPIO_FUNC_WMAC_LED_EN BIT(22) -+#define AR913X_GPIO_FUNC_EXP_PORT_CS_EN BIT(21) -+#define AR913X_GPIO_FUNC_I2S_REFCLKEN BIT(20) -+#define AR913X_GPIO_FUNC_I2S_MCKEN BIT(19) -+#define AR913X_GPIO_FUNC_I2S1_EN BIT(18) -+#define AR913X_GPIO_FUNC_I2S0_EN BIT(17) -+#define AR913X_GPIO_FUNC_SLIC_EN BIT(16) -+#define AR913X_GPIO_FUNC_UART_RTSCTS_EN BIT(9) -+#define AR913X_GPIO_FUNC_UART_EN BIT(8) -+#define AR913X_GPIO_FUNC_USB_CLK_EN BIT(4) -+ -+#define AR933X_GPIO_FUNC_SPDIF2TCK BIT(31) -+#define AR933X_GPIO_FUNC_SPDIF_EN BIT(30) -+#define AR933X_GPIO_FUNC_I2SO_22_18_EN BIT(29) -+#define AR933X_GPIO_FUNC_I2S_MCK_EN BIT(27) -+#define AR933X_GPIO_FUNC_I2SO_EN BIT(26) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_DUPL BIT(25) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_COLL BIT(24) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_ACT BIT(23) -+#define AR933X_GPIO_FUNC_SPI_EN BIT(18) -+#define AR933X_GPIO_FUNC_SPI_CS_EN2 BIT(14) -+#define AR933X_GPIO_FUNC_SPI_CS_EN1 BIT(13) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3) -+#define AR933X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2) -+#define AR933X_GPIO_FUNC_UART_EN BIT(1) -+#define AR933X_GPIO_FUNC_JTAG_DISABLE BIT(0) -+ -+#define AR934X_GPIO_FUNC_CLK_OBS7_EN BIT(9) -+#define AR934X_GPIO_FUNC_CLK_OBS6_EN BIT(8) -+#define AR934X_GPIO_FUNC_CLK_OBS5_EN BIT(7) -+#define AR934X_GPIO_FUNC_CLK_OBS4_EN BIT(6) -+#define AR934X_GPIO_FUNC_CLK_OBS3_EN BIT(5) -+#define AR934X_GPIO_FUNC_CLK_OBS2_EN BIT(4) -+#define AR934X_GPIO_FUNC_CLK_OBS1_EN BIT(3) -+#define AR934X_GPIO_FUNC_CLK_OBS0_EN BIT(2) -+#define AR934X_GPIO_FUNC_JTAG_DISABLE BIT(1) -+ -+#define AR934X_GPIO_OUT_GPIO 0 -+#define AR934X_GPIO_OUT_SPI_CS1 7 -+#define AR934X_GPIO_OUT_LED_LINK0 41 -+#define AR934X_GPIO_OUT_LED_LINK1 42 -+#define AR934X_GPIO_OUT_LED_LINK2 43 -+#define AR934X_GPIO_OUT_LED_LINK3 44 -+#define AR934X_GPIO_OUT_LED_LINK4 45 -+#define AR934X_GPIO_OUT_EXT_LNA0 46 -+#define AR934X_GPIO_OUT_EXT_LNA1 47 -+ -+#define QCA955X_GPIO_FUNC_CLK_OBS7_EN BIT(9) -+#define QCA955X_GPIO_FUNC_CLK_OBS6_EN BIT(8) -+#define QCA955X_GPIO_FUNC_CLK_OBS5_EN BIT(7) -+#define QCA955X_GPIO_FUNC_CLK_OBS4_EN BIT(6) -+#define QCA955X_GPIO_FUNC_CLK_OBS3_EN BIT(5) -+#define QCA955X_GPIO_FUNC_CLK_OBS2_EN BIT(4) -+#define QCA955X_GPIO_FUNC_CLK_OBS1_EN BIT(3) -+#define QCA955X_GPIO_FUNC_JTAG_DISABLE BIT(1) -+ -+#define QCA955X_GPIO_OUT_GPIO 0 -+#define QCA955X_MII_EXT_MDI 1 -+#define QCA955X_SLIC_DATA_OUT 3 -+#define QCA955X_SLIC_PCM_FS 4 -+#define QCA955X_SLIC_PCM_CLK 5 -+#define QCA955X_SPI_CLK 8 -+#define QCA955X_SPI_CS_0 9 -+#define QCA955X_SPI_CS_1 10 -+#define QCA955X_SPI_CS_2 11 -+#define QCA955X_SPI_MISO 12 -+#define QCA955X_I2S_CLK 13 -+#define QCA955X_I2S_WS 14 -+#define QCA955X_I2S_SD 15 -+#define QCA955X_I2S_MCK 16 -+#define QCA955X_SPDIF_OUT 17 -+#define QCA955X_UART1_TD 18 -+#define QCA955X_UART1_RTS 19 -+#define QCA955X_UART1_RD 20 -+#define QCA955X_UART1_CTS 21 -+#define QCA955X_UART0_SOUT 22 -+#define QCA955X_SPDIF2_OUT 23 -+#define QCA955X_LED_SGMII_SPEED0 24 -+#define QCA955X_LED_SGMII_SPEED1 25 -+#define QCA955X_LED_SGMII_DUPLEX 26 -+#define QCA955X_LED_SGMII_LINK_UP 27 -+#define QCA955X_SGMII_SPEED0_INVERT 28 -+#define QCA955X_SGMII_SPEED1_INVERT 29 -+#define QCA955X_SGMII_DUPLEX_INVERT 30 -+#define QCA955X_SGMII_LINK_UP_INVERT 31 -+#define QCA955X_GE1_MII_MDO 32 -+#define QCA955X_GE1_MII_MDC 33 -+#define QCA955X_SWCOM2 38 -+#define QCA955X_SWCOM3 39 -+#define QCA955X_MAC2_GPIO 40 -+#define QCA955X_MAC3_GPIO 41 -+#define QCA955X_ATT_LED 42 -+#define QCA955X_PWR_LED 43 -+#define QCA955X_TX_FRAME 44 -+#define QCA955X_RX_CLEAR_EXTERNAL 45 -+#define QCA955X_LED_NETWORK_EN 46 -+#define QCA955X_LED_POWER_EN 47 -+#define QCA955X_WMAC_GLUE_WOW 68 -+#define QCA955X_RX_CLEAR_EXTENSION 70 -+#define QCA955X_CP_NAND_CS1 73 -+#define QCA955X_USB_SUSPEND 74 -+#define QCA955X_ETH_TX_ERR 75 -+#define QCA955X_DDR_DQ_OE 76 -+#define QCA955X_CLKREQ_N_EP 77 -+#define QCA955X_CLKREQ_N_RC 78 -+#define QCA955X_CLK_OBS0 79 -+#define QCA955X_CLK_OBS1 80 -+#define QCA955X_CLK_OBS2 81 -+#define QCA955X_CLK_OBS3 82 -+#define QCA955X_CLK_OBS4 83 -+#define QCA955X_CLK_OBS5 84 -+ -+/* -+ * MII_CTRL block -+ */ -+#define AR71XX_MII_REG_MII0_CTRL 0x00 -+#define AR71XX_MII_REG_MII1_CTRL 0x04 -+ -+#define AR71XX_MII_CTRL_IF_MASK 3 -+#define AR71XX_MII_CTRL_SPEED_SHIFT 4 -+#define AR71XX_MII_CTRL_SPEED_MASK 3 -+#define AR71XX_MII_CTRL_SPEED_10 0 -+#define AR71XX_MII_CTRL_SPEED_100 1 -+#define AR71XX_MII_CTRL_SPEED_1000 2 -+ -+#define AR71XX_MII0_CTRL_IF_GMII 0 -+#define AR71XX_MII0_CTRL_IF_MII 1 -+#define AR71XX_MII0_CTRL_IF_RGMII 2 -+#define AR71XX_MII0_CTRL_IF_RMII 3 -+ -+#define AR71XX_MII1_CTRL_IF_RGMII 0 -+#define AR71XX_MII1_CTRL_IF_RMII 1 -+ -+/* -+ * AR933X GMAC interface -+ */ -+#define AR933X_GMAC_REG_ETH_CFG 0x00 -+ -+#define AR933X_ETH_CFG_RGMII_GE0 BIT(0) -+#define AR933X_ETH_CFG_MII_GE0 BIT(1) -+#define AR933X_ETH_CFG_GMII_GE0 BIT(2) -+#define AR933X_ETH_CFG_MII_GE0_MASTER BIT(3) -+#define AR933X_ETH_CFG_MII_GE0_SLAVE BIT(4) -+#define AR933X_ETH_CFG_MII_GE0_ERR_EN BIT(5) -+#define AR933X_ETH_CFG_SW_PHY_SWAP BIT(7) -+#define AR933X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(8) -+#define AR933X_ETH_CFG_RMII_GE0 BIT(9) -+#define AR933X_ETH_CFG_RMII_GE0_SPD_10 0 -+#define AR933X_ETH_CFG_RMII_GE0_SPD_100 BIT(10) -+ -+/* -+ * AR934X GMAC Interface -+ */ -+#define AR934X_GMAC_REG_ETH_CFG 0x00 -+ -+#define AR934X_ETH_CFG_RGMII_GMAC0 BIT(0) -+#define AR934X_ETH_CFG_MII_GMAC0 BIT(1) -+#define AR934X_ETH_CFG_GMII_GMAC0 BIT(2) -+#define AR934X_ETH_CFG_MII_GMAC0_MASTER BIT(3) -+#define AR934X_ETH_CFG_MII_GMAC0_SLAVE BIT(4) -+#define AR934X_ETH_CFG_MII_GMAC0_ERR_EN BIT(5) -+#define AR934X_ETH_CFG_SW_ONLY_MODE BIT(6) -+#define AR934X_ETH_CFG_SW_PHY_SWAP BIT(7) -+#define AR934X_ETH_CFG_SW_APB_ACCESS BIT(9) -+#define AR934X_ETH_CFG_RMII_GMAC0 BIT(10) -+#define AR933X_ETH_CFG_MII_CNTL_SPEED BIT(11) -+#define AR934X_ETH_CFG_RMII_GMAC0_MASTER BIT(12) -+#define AR933X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13) -+#define AR934X_ETH_CFG_RXD_DELAY BIT(14) -+#define AR934X_ETH_CFG_RXD_DELAY_MASK 0x3 -+#define AR934X_ETH_CFG_RXD_DELAY_SHIFT 14 -+#define AR934X_ETH_CFG_RDV_DELAY BIT(16) -+#define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 -+#define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 -+ -+/* -+ * QCA955X GMAC Interface -+ */ -+ -+#define QCA955X_GMAC_REG_ETH_CFG 0x00 -+ -+#define QCA955X_ETH_CFG_RGMII_EN BIT(0) -+#define QCA955X_ETH_CFG_MII_GE0 BIT(1) -+#define QCA955X_ETH_CFG_GMII_GE0 BIT(2) -+#define QCA955X_ETH_CFG_MII_GE0_MASTER BIT(3) -+#define QCA955X_ETH_CFG_MII_GE0_SLAVE BIT(4) -+#define QCA955X_ETH_CFG_GE0_ERR_EN BIT(5) -+#define QCA955X_ETH_CFG_GE0_SGMII BIT(6) -+#define QCA955X_ETH_CFG_RMII_GE0 BIT(10) -+#define QCA955X_ETH_CFG_MII_CNTL_SPEED BIT(11) -+#define QCA955X_ETH_CFG_RMII_GE0_MASTER BIT(12) -+#define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3 -+#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14 -+#define QCA955X_ETH_CFG_RDV_DELAY BIT(16) -+#define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3 -+#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16 -+#define QCA955X_ETH_CFG_TXD_DELAY_MASK 0x3 -+#define QCA955X_ETH_CFG_TXD_DELAY_SHIFT 18 -+#define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 -+#define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 -+ - #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/target/linux/ar71xx/patches-4.14/602-MIPS-ath79-add-openwrt-stuff.patch b/target/linux/ar71xx/patches-4.14/602-MIPS-ath79-add-openwrt-stuff.patch deleted file mode 100644 index 047be0c7f..000000000 --- a/target/linux/ar71xx/patches-4.14/602-MIPS-ath79-add-openwrt-stuff.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -99,6 +99,20 @@ config SOC_QCA955X - select PCI_AR724X if PCI - def_bool n - -+config ATH79_DEV_M25P80 -+ select ATH79_DEV_SPI -+ def_bool n -+ -+config ATH79_DEV_AP9X_PCI -+ select ATH79_PCI_ATH9K_FIXUP -+ def_bool n -+ -+config ATH79_DEV_DSA -+ def_bool n -+ -+config ATH79_DEV_ETH -+ def_bool n -+ - config PCI_AR724X - def_bool n - -@@ -108,6 +122,10 @@ config ATH79_DEV_GPIO_BUTTONS - config ATH79_DEV_LEDS_GPIO - def_bool n - -+config ATH79_DEV_NFC -+ depends on (SOC_AR934X || SOC_QCA955X) -+ def_bool n -+ - config ATH79_DEV_SPI - def_bool n - -@@ -118,4 +136,14 @@ config ATH79_DEV_WMAC - depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) - def_bool n - -+config ATH79_NVRAM -+ def_bool n -+ -+config ATH79_PCI_ATH9K_FIXUP -+ def_bool n -+ -+config ATH79_ROUTERBOOT -+ select LZO_DECOMPRESS -+ def_bool n -+ - endif diff --git a/target/linux/ar71xx/patches-4.14/603-MIPS-ath79-ap121-fixes.patch b/target/linux/ar71xx/patches-4.14/603-MIPS-ath79-ap121-fixes.patch deleted file mode 100644 index 7c71d1160..000000000 --- a/target/linux/ar71xx/patches-4.14/603-MIPS-ath79-ap121-fixes.patch +++ /dev/null @@ -1,149 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -6,9 +6,10 @@ menu "Atheros AR71XX/AR724X/AR913X machine selection" - config ATH79_MACH_AP121 - bool "Atheros AP121 reference board" - select SOC_AR933X -+ 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 ---- a/arch/mips/ath79/mach-ap121.c -+++ b/arch/mips/ath79/mach-ap121.c -@@ -1,19 +1,21 @@ - /* - * Atheros AP121 board support - * -- * Copyright (C) 2011 Gabor Juhos -+ * Copyright (C) 2011-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 "machtypes.h" -+#include "dev-eth.h" - #include "dev-gpio-buttons.h" - #include "dev-leds-gpio.h" -+#include "dev-m25p80.h" - #include "dev-spi.h" - #include "dev-usb.h" - #include "dev-wmac.h" -+#include "machtypes.h" - - #define AP121_GPIO_LED_WLAN 0 - #define AP121_GPIO_LED_USB 1 -@@ -24,7 +26,14 @@ - #define AP121_KEYS_POLL_INTERVAL 20 /* msecs */ - #define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL) - --#define AP121_CAL_DATA_ADDR 0x1fff1000 -+#define AP121_MAC0_OFFSET 0x0000 -+#define AP121_MAC1_OFFSET 0x0006 -+#define AP121_CALDATA_OFFSET 0x1000 -+#define AP121_WMAC_MAC_OFFSET 0x1002 -+ -+#define AP121_MINI_GPIO_LED_WLAN 0 -+#define AP121_MINI_GPIO_BTN_JUMPSTART 12 -+#define AP121_MINI_GPIO_BTN_RESET 11 - - static struct gpio_led ap121_leds_gpio[] __initdata = { - { -@@ -58,35 +67,78 @@ static struct gpio_keys_button ap121_gpio_keys[] __initdata = { - } - }; - --static struct spi_board_info ap121_spi_info[] = { -+static struct gpio_led ap121_mini_leds_gpio[] __initdata = { - { -- .bus_num = 0, -- .chip_select = 0, -- .max_speed_hz = 25000000, -- .modalias = "mx25l1606e", -- } -+ .name = "ap121:green:wlan", -+ .gpio = AP121_MINI_GPIO_LED_WLAN, -+ .active_low = 0, -+ }, - }; - --static struct ath79_spi_platform_data ap121_spi_data = { -- .bus_num = 0, -- .num_chipselect = 1, -+static struct gpio_keys_button ap121_mini_gpio_keys[] __initdata = { -+ { -+ .desc = "jumpstart button", -+ .type = EV_KEY, -+ .code = KEY_WPS_BUTTON, -+ .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL, -+ .gpio = AP121_MINI_GPIO_BTN_JUMPSTART, -+ .active_low = 1, -+ }, -+ { -+ .desc = "reset button", -+ .type = EV_KEY, -+ .code = KEY_RESTART, -+ .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL, -+ .gpio = AP121_MINI_GPIO_BTN_RESET, -+ .active_low = 1, -+ } - }; - -+static void __init ap121_common_setup(void) -+{ -+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); -+ -+ ath79_register_m25p80(NULL); -+ ath79_register_wmac(art + AP121_CALDATA_OFFSET, -+ art + AP121_WMAC_MAC_OFFSET); -+ -+ ath79_init_mac(ath79_eth0_data.mac_addr, art + AP121_MAC0_OFFSET, 0); -+ ath79_init_mac(ath79_eth1_data.mac_addr, art + AP121_MAC1_OFFSET, 0); -+ -+ ath79_register_mdio(0, 0x0); -+ -+ /* LAN ports */ -+ ath79_register_eth(1); -+ -+ /* WAN port */ -+ ath79_register_eth(0); -+} -+ - static void __init ap121_setup(void) - { -- u8 *cal_data = (u8 *) KSEG1ADDR(AP121_CAL_DATA_ADDR); -+ ap121_common_setup(); - - ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio), - ap121_leds_gpio); - ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL, - ARRAY_SIZE(ap121_gpio_keys), - ap121_gpio_keys); -- -- ath79_register_spi(&ap121_spi_data, ap121_spi_info, -- ARRAY_SIZE(ap121_spi_info)); - ath79_register_usb(); -- ath79_register_wmac(cal_data, NULL); - } - - MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board", - ap121_setup); -+ -+static void __init ap121_mini_setup(void) -+{ -+ ap121_common_setup(); -+ -+ ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_mini_leds_gpio), -+ ap121_mini_leds_gpio); -+ ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL, -+ ARRAY_SIZE(ap121_mini_gpio_keys), -+ ap121_mini_gpio_keys); -+} -+ -+MIPS_MACHINE(ATH79_MACH_AP121_MINI, "AP121-MINI", "Atheros AP121-MINI", -+ ap121_mini_setup); diff --git a/target/linux/ar71xx/patches-4.14/605-MIPS-ath79-db120-fixes.patch b/target/linux/ar71xx/patches-4.14/605-MIPS-ath79-db120-fixes.patch deleted file mode 100644 index 7682a5584..000000000 --- a/target/linux/ar71xx/patches-4.14/605-MIPS-ath79-db120-fixes.patch +++ /dev/null @@ -1,205 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -43,9 +43,12 @@ config ATH79_MACH_AP81 - config ATH79_MACH_DB120 - bool "Atheros DB120 reference board" - select SOC_AR934X -+ select ATH79_DEV_AP9X_PCI if PCI -+ 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_NFC - select ATH79_DEV_USB - select ATH79_DEV_WMAC - help ---- a/arch/mips/ath79/mach-db120.c -+++ b/arch/mips/ath79/mach-db120.c -@@ -2,7 +2,7 @@ - * Atheros DB120 reference board support - * - * Copyright (c) 2011 Qualcomm Atheros -- * Copyright (c) 2011 Gabor Juhos -+ * Copyright (c) 2011-2012 Gabor Juhos - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above -@@ -19,16 +19,26 @@ - */ - - #include -+#include -+#include - #include -+#include - --#include "machtypes.h" -+#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-nfc.h" - #include "dev-spi.h" - #include "dev-usb.h" - #include "dev-wmac.h" --#include "pci.h" -+#include "machtypes.h" - -+#define DB120_GPIO_LED_USB 11 - #define DB120_GPIO_LED_WLAN_5G 12 - #define DB120_GPIO_LED_WLAN_2G 13 - #define DB120_GPIO_LED_STATUS 14 -@@ -39,8 +49,10 @@ - #define DB120_KEYS_POLL_INTERVAL 20 /* msecs */ - #define DB120_KEYS_DEBOUNCE_INTERVAL (3 * DB120_KEYS_POLL_INTERVAL) - --#define DB120_WMAC_CALDATA_OFFSET 0x1000 --#define DB120_PCIE_CALDATA_OFFSET 0x5000 -+#define DB120_MAC0_OFFSET 0 -+#define DB120_MAC1_OFFSET 6 -+#define DB120_WMAC_CALDATA_OFFSET 0x1000 -+#define DB120_PCIE_CALDATA_OFFSET 0x5000 - - static struct gpio_led db120_leds_gpio[] __initdata = { - { -@@ -63,6 +75,11 @@ static struct gpio_led db120_leds_gpio[] __initdata = { - .gpio = DB120_GPIO_LED_WLAN_2G, - .active_low = 1, - }, -+ { -+ .name = "db120:green:usb", -+ .gpio = DB120_GPIO_LED_USB, -+ .active_low = 1, -+ } - }; - - static struct gpio_keys_button db120_gpio_keys[] __initdata = { -@@ -76,60 +93,86 @@ static struct gpio_keys_button db120_gpio_keys[] __initdata = { - }, - }; - --static struct spi_board_info db120_spi_info[] = { -- { -- .bus_num = 0, -- .chip_select = 0, -- .max_speed_hz = 25000000, -- .modalias = "s25sl064a", -- } -+static struct ar8327_pad_cfg db120_ar8327_pad0_cfg = { -+ .mode = AR8327_PAD_MAC_RGMII, -+ .txclk_delay_en = true, -+ .rxclk_delay_en = true, -+ .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, -+ .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, - }; - --static struct ath79_spi_platform_data db120_spi_data = { -- .bus_num = 0, -- .num_chipselect = 1, -+static struct ar8327_led_cfg db120_ar8327_led_cfg = { -+ .led_ctrl0 = 0x00000000, -+ .led_ctrl1 = 0xc737c737, -+ .led_ctrl2 = 0x00000000, -+ .led_ctrl3 = 0x00c30c00, -+ .open_drain = true, - }; - --#ifdef CONFIG_PCI --static struct ath9k_platform_data db120_ath9k_data; -- --static int db120_pci_plat_dev_init(struct pci_dev *dev) --{ -- switch (PCI_SLOT(dev->devfn)) { -- case 0: -- dev->dev.platform_data = &db120_ath9k_data; -- break; -- } -- -- return 0; --} -- --static void __init db120_pci_init(u8 *eeprom) --{ -- memcpy(db120_ath9k_data.eeprom_data, eeprom, -- sizeof(db120_ath9k_data.eeprom_data)); -+static struct ar8327_platform_data db120_ar8327_data = { -+ .pad0_cfg = &db120_ar8327_pad0_cfg, -+ .port0_cfg = { -+ .force_link = 1, -+ .speed = AR8327_PORT_SPEED_1000, -+ .duplex = 1, -+ .txpause = 1, -+ .rxpause = 1, -+ }, -+ .led_cfg = &db120_ar8327_led_cfg, -+}; - -- ath79_pci_set_plat_dev_init(db120_pci_plat_dev_init); -- ath79_register_pci(); --} --#else --static inline void db120_pci_init(u8 *eeprom) {} --#endif /* CONFIG_PCI */ -+static struct mdio_board_info db120_mdio0_info[] = { -+ { -+ .bus_id = "ag71xx-mdio.0", -+ .modalias = "db120", -+ .mdio_addr = 0, -+ .platform_data = &db120_ar8327_data, -+ }, -+}; - - static void __init db120_setup(void) - { - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - -+ ath79_gpio_output_select(DB120_GPIO_LED_USB, AR934X_GPIO_OUT_GPIO); -+ ath79_register_m25p80(NULL); -+ - ath79_register_leds_gpio(-1, ARRAY_SIZE(db120_leds_gpio), - db120_leds_gpio); - ath79_register_gpio_keys_polled(-1, DB120_KEYS_POLL_INTERVAL, - ARRAY_SIZE(db120_gpio_keys), - db120_gpio_keys); -- ath79_register_spi(&db120_spi_data, db120_spi_info, -- ARRAY_SIZE(db120_spi_info)); - ath79_register_usb(); - ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET, NULL); -- db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET); -+ ap91_pci_init(art + DB120_PCIE_CALDATA_OFFSET, NULL); -+ -+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | -+ AR934X_ETH_CFG_SW_ONLY_MODE); -+ -+ ath79_register_mdio(1, 0x0); -+ ath79_register_mdio(0, 0x0); -+ -+ ath79_init_mac(ath79_eth0_data.mac_addr, art + DB120_MAC0_OFFSET, 0); -+ -+ mdiobus_register_board_info(db120_mdio0_info, -+ ARRAY_SIZE(db120_mdio0_info)); -+ -+ /* GMAC0 is connected to an AR8327 switch */ -+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; -+ ath79_eth0_data.phy_mask = BIT(0); -+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; -+ ath79_eth0_pll_data.pll_1000 = 0x06000000; -+ ath79_register_eth(0); -+ -+ /* GMAC1 is connected to the internal switch */ -+ ath79_init_mac(ath79_eth1_data.mac_addr, art + DB120_MAC1_OFFSET, 0); -+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; -+ ath79_eth1_data.speed = SPEED_1000; -+ ath79_eth1_data.duplex = DUPLEX_FULL; -+ -+ ath79_register_eth(1); -+ -+ ath79_register_nfc(); - } - - MIPS_MACHINE(ATH79_MACH_DB120, "DB120", "Atheros DB120 reference board", diff --git a/target/linux/ar71xx/patches-4.14/606-MIPS-ath79-pb44-fixes.patch b/target/linux/ar71xx/patches-4.14/606-MIPS-ath79-pb44-fixes.patch deleted file mode 100644 index 655fee988..000000000 --- a/target/linux/ar71xx/patches-4.14/606-MIPS-ath79-pb44-fixes.patch +++ /dev/null @@ -1,145 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -58,6 +58,7 @@ config ATH79_MACH_DB120 - config ATH79_MACH_PB44 - bool "Atheros PB44 reference board" - select SOC_AR71XX -+ select ATH79_DEV_ETH - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO - select ATH79_DEV_SPI ---- a/arch/mips/ath79/mach-pb44.c -+++ b/arch/mips/ath79/mach-pb44.c -@@ -8,23 +8,47 @@ - * by the Free Software Foundation. - */ - -+#include - #include - #include - #include - #include - #include -+#include -+#include - --#include "machtypes.h" -+#include -+#include -+ -+#include "dev-eth.h" - #include "dev-gpio-buttons.h" - #include "dev-leds-gpio.h" - #include "dev-spi.h" - #include "dev-usb.h" -+#include "machtypes.h" - #include "pci.h" - - #define PB44_GPIO_I2C_SCL 0 - #define PB44_GPIO_I2C_SDA 1 - -+#define PB44_PCF8757_VSC7395_CS 0 -+#define PB44_PCF8757_STEREO_CS 1 -+#define PB44_PCF8757_SLIC_CS0 2 -+#define PB44_PCF8757_SLIC_TEST 3 -+#define PB44_PCF8757_SLIC_INT0 4 -+#define PB44_PCF8757_SLIC_INT1 5 -+#define PB44_PCF8757_SW_RESET 6 -+#define PB44_PCF8757_SW_JUMP 8 -+#define PB44_PCF8757_LED_JUMP1 9 -+#define PB44_PCF8757_LED_JUMP2 10 -+#define PB44_PCF8757_TP24 11 -+#define PB44_PCF8757_TP25 12 -+#define PB44_PCF8757_TP26 13 -+#define PB44_PCF8757_TP27 14 -+#define PB44_PCF8757_TP28 15 -+ - #define PB44_GPIO_EXP_BASE 16 -+#define PB44_GPIO_VSC7395_CS (PB44_GPIO_EXP_BASE + PB44_PCF8757_VSC7395_CS) - #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) -@@ -87,20 +111,59 @@ static struct gpio_keys_button pb44_gpio_keys[] __initdata = { - } - }; - -+static void pb44_vsc7395_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 pb44_vsc7395_data = { -+ .reset = pb44_vsc7395_reset, -+ .ucode_name = "vsc7395_ucode_pb44.bin", -+ .mac_cfg = { -+ .tx_ipg = 6, -+ .bit2 = 1, -+ .clk_sel = 0, -+ }, -+}; -+ -+static const char *pb44_part_probes[] = { -+ "RedBoot", -+ NULL, -+}; -+ -+static struct flash_platform_data pb44_flash_data = { -+ .part_probes = pb44_part_probes, -+}; -+ - static struct spi_board_info pb44_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p64", -+ .platform_data = &pb44_flash_data, - }, -+ { -+ .bus_num = 0, -+ .chip_select = 1, -+ .max_speed_hz = 25000000, -+ .modalias = "spi-vsc7385", -+ .platform_data = &pb44_vsc7395_data, -+ } - }; - - static struct ath79_spi_platform_data pb44_spi_data = { - .bus_num = 0, -- .num_chipselect = 1, -+ .num_chipselect = 2, - }; - -+#define PB44_WAN_PHYMASK BIT(0) -+#define PB44_LAN_PHYMASK 0 -+#define PB44_MDIO_PHYMASK (PB44_LAN_PHYMASK | PB44_WAN_PHYMASK) -+ - static void __init pb44_init(void) - { - i2c_register_board_info(0, pb44_i2c_board_info, -@@ -116,6 +179,22 @@ static void __init pb44_init(void) - ARRAY_SIZE(pb44_spi_info)); - ath79_register_usb(); - ath79_register_pci(); -+ -+ ath79_register_mdio(0, ~PB44_MDIO_PHYMASK); -+ -+ ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); -+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; -+ ath79_eth0_data.phy_mask = PB44_WAN_PHYMASK; -+ -+ ath79_register_eth(0); -+ -+ ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 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 = 0x110000; -+ -+ ath79_register_eth(1); - } - - MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board", diff --git a/target/linux/ar71xx/patches-4.14/607-MIPS-ath79-ubnt-xm-fixes.patch b/target/linux/ar71xx/patches-4.14/607-MIPS-ath79-ubnt-xm-fixes.patch deleted file mode 100644 index 4699c8274..000000000 --- a/target/linux/ar71xx/patches-4.14/607-MIPS-ath79-ubnt-xm-fixes.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -70,9 +70,10 @@ config ATH79_MACH_PB44 - config ATH79_MACH_UBNT_XM - bool "Ubiquiti Networks XM (rev 1.0) board" - select SOC_AR724X -+ select ATH79_DEV_AP9X_PCI if PCI - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI -+ select ATH79_DEV_M25P80 - help - Say 'Y' here if you want your kernel to support the - Ubiquiti Networks XM (rev 1.0) board. diff --git a/target/linux/ar71xx/patches-4.14/608-MIPS-ath79-ubnt-xm-add-more-boards.patch b/target/linux/ar71xx/patches-4.14/608-MIPS-ath79-ubnt-xm-add-more-boards.patch deleted file mode 100644 index b33db4dd0..000000000 --- a/target/linux/ar71xx/patches-4.14/608-MIPS-ath79-ubnt-xm-add-more-boards.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -68,12 +68,16 @@ config ATH79_MACH_PB44 - Atheros PB44 reference board. - - config ATH79_MACH_UBNT_XM -- bool "Ubiquiti Networks XM (rev 1.0) board" -+ bool "Ubiquiti Networks XM/UniFi boards" - select SOC_AR724X -+ select SOC_AR934X - 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 - help - Say 'Y' here if you want your kernel to support the - Ubiquiti Networks XM (rev 1.0) board. diff --git a/target/linux/ar71xx/patches-4.14/609-MIPS-ath79-ap136-fixes.patch b/target/linux/ar71xx/patches-4.14/609-MIPS-ath79-ap136-fixes.patch deleted file mode 100644 index 9aa9bae6c..000000000 --- a/target/linux/ar71xx/patches-4.14/609-MIPS-ath79-ap136-fixes.patch +++ /dev/null @@ -1,301 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -17,16 +17,17 @@ config ATH79_MACH_AP121 - Atheros AP121 reference board. - - config ATH79_MACH_AP136 -- bool "Atheros AP136 reference board" -+ bool "Atheros AP136/AP135 reference board" - select SOC_QCA955X - select ATH79_DEV_GPIO_BUTTONS - select ATH79_DEV_LEDS_GPIO -+ select ATH79_DEV_NFC - select ATH79_DEV_SPI - select ATH79_DEV_USB - select ATH79_DEV_WMAC - help - Say 'Y' here if you want your kernel to support the -- Atheros AP136 reference board. -+ Atheros AP136 or AP135 reference boards. - - config ATH79_MACH_AP81 - bool "Atheros AP81 reference board" ---- a/arch/mips/ath79/mach-ap136.c -+++ b/arch/mips/ath79/mach-ap136.c -@@ -18,23 +18,29 @@ - * - */ - --#include --#include -+#include -+#include - --#include "machtypes.h" -+#include -+ -+#include "common.h" -+#include "pci.h" -+#include "dev-ap9x-pci.h" - #include "dev-gpio-buttons.h" -+#include "dev-eth.h" - #include "dev-leds-gpio.h" --#include "dev-spi.h" -+#include "dev-m25p80.h" -+#include "dev-nfc.h" - #include "dev-usb.h" - #include "dev-wmac.h" --#include "pci.h" -+#include "machtypes.h" - --#define AP136_GPIO_LED_STATUS_RED 14 --#define AP136_GPIO_LED_STATUS_GREEN 19 - #define AP136_GPIO_LED_USB 4 --#define AP136_GPIO_LED_WLAN_2G 13 - #define AP136_GPIO_LED_WLAN_5G 12 -+#define AP136_GPIO_LED_WLAN_2G 13 -+#define AP136_GPIO_LED_STATUS_RED 14 - #define AP136_GPIO_LED_WPS_RED 15 -+#define AP136_GPIO_LED_STATUS_GREEN 19 - #define AP136_GPIO_LED_WPS_GREEN 20 - - #define AP136_GPIO_BTN_WPS 16 -@@ -43,37 +49,39 @@ - #define AP136_KEYS_POLL_INTERVAL 20 /* msecs */ - #define AP136_KEYS_DEBOUNCE_INTERVAL (3 * AP136_KEYS_POLL_INTERVAL) - --#define AP136_WMAC_CALDATA_OFFSET 0x1000 --#define AP136_PCIE_CALDATA_OFFSET 0x5000 -+#define AP136_MAC0_OFFSET 0 -+#define AP136_MAC1_OFFSET 6 -+#define AP136_WMAC_CALDATA_OFFSET 0x1000 -+#define AP136_PCIE_CALDATA_OFFSET 0x5000 - - static struct gpio_led ap136_leds_gpio[] __initdata = { - { -- .name = "qca:green:status", -+ .name = "ap136:green:status", - .gpio = AP136_GPIO_LED_STATUS_GREEN, - .active_low = 1, - }, - { -- .name = "qca:red:status", -+ .name = "ap136:red:status", - .gpio = AP136_GPIO_LED_STATUS_RED, - .active_low = 1, - }, - { -- .name = "qca:green:wps", -+ .name = "ap136:green:wps", - .gpio = AP136_GPIO_LED_WPS_GREEN, - .active_low = 1, - }, - { -- .name = "qca:red:wps", -+ .name = "ap136:red:wps", - .gpio = AP136_GPIO_LED_WPS_RED, - .active_low = 1, - }, - { -- .name = "qca:red:wlan-2g", -+ .name = "ap136:red:wlan-2g", - .gpio = AP136_GPIO_LED_WLAN_2G, - .active_low = 1, - }, - { -- .name = "qca:red:usb", -+ .name = "ap136:red:usb", - .gpio = AP136_GPIO_LED_USB, - .active_low = 1, - } -@@ -98,59 +106,152 @@ static struct gpio_keys_button ap136_gpio_keys[] __initdata = { - }, - }; - --static struct spi_board_info ap136_spi_info[] = { -- { -- .bus_num = 0, -- .chip_select = 0, -- .max_speed_hz = 25000000, -- .modalias = "mx25l6405d", -- } -+static struct ar8327_pad_cfg ap136_ar8327_pad0_cfg; -+static struct ar8327_pad_cfg ap136_ar8327_pad6_cfg; -+ -+static struct ar8327_platform_data ap136_ar8327_data = { -+ .pad0_cfg = &ap136_ar8327_pad0_cfg, -+ .pad6_cfg = &ap136_ar8327_pad6_cfg, -+ .port0_cfg = { -+ .force_link = 1, -+ .speed = AR8327_PORT_SPEED_1000, -+ .duplex = 1, -+ .txpause = 1, -+ .rxpause = 1, -+ }, -+ .port6_cfg = { -+ .force_link = 1, -+ .speed = AR8327_PORT_SPEED_1000, -+ .duplex = 1, -+ .txpause = 1, -+ .rxpause = 1, -+ }, - }; - --static struct ath79_spi_platform_data ap136_spi_data = { -- .bus_num = 0, -- .num_chipselect = 1, -+static struct mdio_board_info ap136_mdio0_info[] = { -+ { -+ .bus_id = "ag71xx-mdio.0", -+ .modalias = "ap136", -+ .mdio_addr = 0, -+ .platform_data = &ap136_ar8327_data, -+ }, - }; - --#ifdef CONFIG_PCI --static struct ath9k_platform_data ap136_ath9k_data; -+static void __init ap136_common_setup(void) -+{ -+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); -+ -+ ath79_register_m25p80(NULL); -+ -+ ath79_register_leds_gpio(-1, ARRAY_SIZE(ap136_leds_gpio), -+ ap136_leds_gpio); -+ ath79_register_gpio_keys_polled(-1, AP136_KEYS_POLL_INTERVAL, -+ ARRAY_SIZE(ap136_gpio_keys), -+ ap136_gpio_keys); -+ -+ ath79_register_usb(); -+ ath79_register_nfc(); -+ -+ ath79_register_wmac(art + AP136_WMAC_CALDATA_OFFSET, NULL); -+ -+ ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); -+ -+ ath79_register_mdio(0, 0x0); -+ ath79_init_mac(ath79_eth0_data.mac_addr, art + AP136_MAC0_OFFSET, 0); - --static int ap136_pci_plat_dev_init(struct pci_dev *dev) -+ mdiobus_register_board_info(ap136_mdio0_info, -+ ARRAY_SIZE(ap136_mdio0_info)); -+ -+ /* GMAC0 is connected to the RMGII interface */ -+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; -+ ath79_eth0_data.phy_mask = BIT(0); -+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; -+ -+ ath79_register_eth(0); -+ -+ /* GMAC1 is connected tot eh SGMII interface */ -+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; -+ ath79_eth1_data.speed = SPEED_1000; -+ ath79_eth1_data.duplex = DUPLEX_FULL; -+ -+ ath79_register_eth(1); -+} -+ -+static void __init ap136_010_setup(void) - { -- if (dev->bus->number == 1 && (PCI_SLOT(dev->devfn)) == 0) -- dev->dev.platform_data = &ap136_ath9k_data; -+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); -+ -+ /* GMAC0 of the AR8327 switch is connected to GMAC0 via RGMII */ -+ ap136_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_RGMII; -+ ap136_ar8327_pad0_cfg.txclk_delay_en = true; -+ ap136_ar8327_pad0_cfg.rxclk_delay_en = true; -+ ap136_ar8327_pad0_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1; -+ ap136_ar8327_pad0_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2; - -- return 0; -+ /* GMAC6 of the AR8327 switch is connected to GMAC1 via SGMII */ -+ ap136_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_SGMII; -+ ap136_ar8327_pad6_cfg.rxclk_delay_en = true; -+ ap136_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL0; -+ -+ ath79_eth0_pll_data.pll_1000 = 0xa6000000; -+ ath79_eth1_pll_data.pll_1000 = 0x03000101; -+ -+ ap136_common_setup(); -+ ap91_pci_init(art + AP136_PCIE_CALDATA_OFFSET, NULL); - } - --static void __init ap136_pci_init(u8 *eeprom) -+MIPS_MACHINE(ATH79_MACH_AP136_010, "AP136-010", -+ "Atheros AP136-010 reference board", -+ ap136_010_setup); -+ -+static void __init ap136_020_common_setup(void) - { -- memcpy(ap136_ath9k_data.eeprom_data, eeprom, -- sizeof(ap136_ath9k_data.eeprom_data)); -+ /* GMAC0 of the AR8327 switch is connected to GMAC1 via SGMII */ -+ ap136_ar8327_pad0_cfg.mode = AR8327_PAD_MAC_SGMII; -+ ap136_ar8327_pad0_cfg.sgmii_delay_en = true; - -- ath79_pci_set_plat_dev_init(ap136_pci_plat_dev_init); -- ath79_register_pci(); -+ /* GMAC6 of the AR8327 switch is connected to GMAC0 via RGMII */ -+ ap136_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_RGMII; -+ ap136_ar8327_pad6_cfg.txclk_delay_en = true; -+ ap136_ar8327_pad6_cfg.rxclk_delay_en = true; -+ ap136_ar8327_pad6_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1; -+ ap136_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2; -+ -+ ath79_eth0_pll_data.pll_1000 = 0x56000000; -+ ath79_eth1_pll_data.pll_1000 = 0x03000101; -+ -+ ap136_common_setup(); - } --#else --static inline void ap136_pci_init(u8 *eeprom) {} --#endif /* CONFIG_PCI */ - --static void __init ap136_setup(void) -+static void __init ap136_020_setup(void) - { - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - -- ath79_register_leds_gpio(-1, ARRAY_SIZE(ap136_leds_gpio), -- ap136_leds_gpio); -- ath79_register_gpio_keys_polled(-1, AP136_KEYS_POLL_INTERVAL, -- ARRAY_SIZE(ap136_gpio_keys), -- ap136_gpio_keys); -- ath79_register_spi(&ap136_spi_data, ap136_spi_info, -- ARRAY_SIZE(ap136_spi_info)); -- ath79_register_usb(); -- ath79_register_wmac(art + AP136_WMAC_CALDATA_OFFSET); -- ap136_pci_init(art + AP136_PCIE_CALDATA_OFFSET); -+ ap136_020_common_setup(); -+ ap91_pci_init(art + AP136_PCIE_CALDATA_OFFSET, NULL); - } - --MIPS_MACHINE(ATH79_MACH_AP136_010, "AP136-010", -- "Atheros AP136-010 reference board", -- ap136_setup); -+MIPS_MACHINE(ATH79_MACH_AP136_020, "AP136-020", -+ "Atheros AP136-020 reference board", -+ ap136_020_setup); -+ -+/* -+ * AP135-020 is similar to AP136-020, any future AP135 specific init -+ * code can be added here. -+ */ -+static void __init ap135_020_setup(void) -+{ -+ ap136_leds_gpio[0].name = "ap135:green:status"; -+ ap136_leds_gpio[1].name = "ap135:red:status"; -+ ap136_leds_gpio[2].name = "ap135:green:wps"; -+ ap136_leds_gpio[3].name = "ap135:red:wps"; -+ ap136_leds_gpio[4].name = "ap135:red:wlan-2g"; -+ ap136_leds_gpio[5].name = "ap135:red:usb"; -+ -+ ap136_020_common_setup(); -+ ath79_register_pci(); -+} -+ -+MIPS_MACHINE(ATH79_MACH_AP135_020, "AP135-020", -+ "Atheros AP135-020 reference board", -+ ap135_020_setup); diff --git a/target/linux/ar71xx/patches-4.14/611-MIPS-ath79-wdt-timeout.patch b/target/linux/ar71xx/patches-4.14/611-MIPS-ath79-wdt-timeout.patch deleted file mode 100644 index 0927d5a97..000000000 --- a/target/linux/ar71xx/patches-4.14/611-MIPS-ath79-wdt-timeout.patch +++ /dev/null @@ -1,25 +0,0 @@ -MIPS: ath79: fix maximum timeout - -If the userland tries to set a timeout higher than the max_timeout, then we should fallback to max_timeout. - -Signed-off-by: John Crispin - ---- a/drivers/watchdog/ath79_wdt.c -+++ b/drivers/watchdog/ath79_wdt.c -@@ -115,10 +115,14 @@ static inline void ath79_wdt_disable(voi - - static int ath79_wdt_set_timeout(int val) - { -- if (val < 1 || val > max_timeout) -+ if (val < 1) - return -EINVAL; - -- timeout = val; -+ if (val > max_timeout) -+ timeout = max_timeout; -+ else -+ timeout = val; -+ - ath79_wdt_keepalive(); - - return 0; diff --git a/target/linux/ar71xx/patches-4.14/612-MIPS-ath79-set-buffalo-txgain.patch b/target/linux/ar71xx/patches-4.14/612-MIPS-ath79-set-buffalo-txgain.patch deleted file mode 100644 index 3d100e054..000000000 --- a/target/linux/ar71xx/patches-4.14/612-MIPS-ath79-set-buffalo-txgain.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -319,6 +319,11 @@ void __init ath79_wmac_disable_5ghz(void - ath79_wmac_data.disable_5ghz = true; - } - -+void __init ath79_wmac_set_tx_gain_buffalo(void) -+{ -+ ath79_wmac_data.tx_gain_buffalo = true; -+} -+ - void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr) - { - if (soc_is_ar913x()) ---- a/arch/mips/ath79/dev-wmac.h -+++ b/arch/mips/ath79/dev-wmac.h -@@ -16,6 +16,7 @@ void ath79_register_wmac(u8 *cal_data, u - void ath79_register_wmac_simple(void); - void ath79_wmac_disable_2ghz(void); - void ath79_wmac_disable_5ghz(void); -+void ath79_wmac_set_tx_gain_buffalo(void); - - bool ar93xx_wmac_read_mac_address(u8 *dest); - diff --git a/target/linux/ar71xx/patches-4.14/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch b/target/linux/ar71xx/patches-4.14/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch deleted file mode 100644 index 5c1205d59..000000000 --- a/target/linux/ar71xx/patches-4.14/613-MIPS-ath79-add-ath79_wmac_setup_ext_lna_gpio-helper.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -18,9 +18,11 @@ - #include - #include - #include -+#include - - #include - #include -+#include "common.h" - #include "dev-wmac.h" - - static u8 ath79_wmac_mac[ETH_ALEN]; -@@ -324,6 +326,51 @@ void __init ath79_wmac_set_tx_gain_buffa - ath79_wmac_data.tx_gain_buffalo = true; - } - -+static int ath79_request_ext_lna_gpio(unsigned chain, int gpio) -+{ -+ char *label; -+ int err; -+ -+ label = kasprintf(GFP_KERNEL, "external LNA%u", chain); -+ if (!label) -+ return -ENOMEM; -+ -+ err = gpio_request_one(gpio, GPIOF_DIR_OUT | GPIOF_INIT_LOW, label); -+ if (err) { -+ pr_err("unable to request GPIO%d for external LNA%u\n", -+ gpio, chain); -+ kfree(label); -+ } -+ -+ return err; -+} -+ -+static void ar934x_set_ext_lna_gpio(unsigned chain, int gpio) -+{ -+ unsigned int sel; -+ int err; -+ -+ if (WARN_ON(chain > 1)) -+ return; -+ -+ err = ath79_request_ext_lna_gpio(chain, gpio); -+ if (err) -+ return; -+ -+ if (chain == 0) -+ sel = AR934X_GPIO_OUT_EXT_LNA0; -+ else -+ sel = AR934X_GPIO_OUT_EXT_LNA1; -+ -+ ath79_gpio_output_select(gpio, sel); -+} -+ -+void __init ath79_wmac_set_ext_lna_gpio(unsigned chain, int gpio) -+{ -+ if (soc_is_ar934x()) -+ ar934x_set_ext_lna_gpio(chain, gpio); -+} -+ - void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr) - { - if (soc_is_ar913x()) ---- a/arch/mips/ath79/dev-wmac.h -+++ b/arch/mips/ath79/dev-wmac.h -@@ -17,6 +17,7 @@ void ath79_register_wmac_simple(void); - void ath79_wmac_disable_2ghz(void); - void ath79_wmac_disable_5ghz(void); - void ath79_wmac_set_tx_gain_buffalo(void); -+void ath79_wmac_set_ext_lna_gpio(unsigned chain, int gpio); - - bool ar93xx_wmac_read_mac_address(u8 *dest); - diff --git a/target/linux/ar71xx/patches-4.14/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch b/target/linux/ar71xx/patches-4.14/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch deleted file mode 100644 index 74d247558..000000000 --- a/target/linux/ar71xx/patches-4.14/620-MIPS-ath79-add-support-for-QCA953x-SoC.patch +++ /dev/null @@ -1,696 +0,0 @@ -From 5300a7cd7ed2f88488ddba62947b9c6bb9663777 Mon Sep 17 00:00:00 2001 -Message-Id: <5300a7cd7ed2f88488ddba62947b9c6bb9663777.1396122227.git.mschiffer@universe-factory.net> -From: Matthias Schiffer -Date: Sat, 29 Mar 2014 20:26:08 +0100 -Subject: [PATCH 1/2] MIPS: ath79: add support for QCA953x SoC - -Note that the clock calculation looks very similar to the QCA955x, but the -meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed. ---- - arch/mips/ath79/Kconfig | 6 +- - arch/mips/ath79/clock.c | 78 ++++++++++++++++++++++++++ - arch/mips/ath79/common.c | 4 ++ - arch/mips/ath79/dev-common.c | 1 + - arch/mips/ath79/dev-wmac.c | 20 +++++++ - arch/mips/ath79/early_printk.c | 1 + - arch/mips/ath79/gpio.c | 4 +- - arch/mips/ath79/irq.c | 4 ++ - arch/mips/ath79/setup.c | 8 ++- - arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 48 ++++++++++++++++ - arch/mips/include/asm/mach-ath79/ath79.h | 11 ++++ - 11 files changed, 182 insertions(+), 3 deletions(-) - ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -105,6 +105,10 @@ config SOC_AR934X - select PCI_AR724X if PCI - def_bool n - -+config SOC_QCA953X -+ select USB_ARCH_HAS_EHCI -+ def_bool n -+ - config SOC_QCA955X - select HW_HAS_PCI - select PCI_AR724X if PCI -@@ -144,7 +148,7 @@ config ATH79_DEV_USB - def_bool n - - config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) -+ depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X) - def_bool n - - config ATH79_NVRAM ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -355,6 +355,87 @@ static void __init ar934x_clocks_init(void) - iounmap(dpll_base); - } - -+static void __init qca953x_clocks_init(void) -+{ -+ unsigned long ref_rate; -+ unsigned long cpu_rate; -+ unsigned long ddr_rate; -+ unsigned long ahb_rate; -+ u32 pll, out_div, ref_div, nint, frac, clk_ctrl, postdiv; -+ u32 cpu_pll, ddr_pll; -+ -+ /* QCA953X only supports 25MHz ref_clk */ -+ ref_rate = 25 * 1000 * 1000; -+ -+ pll = ath79_pll_rr(QCA953X_PLL_CPU_CONFIG_REG); -+ out_div = (pll >> QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_REFDIV_MASK; -+ nint = (pll >> QCA953X_PLL_CPU_CONFIG_NINT_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_NINT_MASK; -+ frac = (pll >> QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_NFRAC_MASK; -+ -+ cpu_pll = nint * ref_rate / ref_div; -+ cpu_pll += frac * (ref_rate >> 6) / ref_div; -+ cpu_pll /= (1 << out_div); -+ -+ pll = ath79_pll_rr(QCA953X_PLL_DDR_CONFIG_REG); -+ out_div = (pll >> QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_REFDIV_MASK; -+ nint = (pll >> QCA953X_PLL_DDR_CONFIG_NINT_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_NINT_MASK; -+ frac = (pll >> QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_NFRAC_MASK; -+ -+ ddr_pll = nint * ref_rate / ref_div; -+ ddr_pll += frac * (ref_rate >> 6) / (ref_div << 4); -+ ddr_pll /= (1 << out_div); -+ -+ clk_ctrl = ath79_pll_rr(QCA953X_PLL_CLK_CTRL_REG); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS) -+ cpu_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL) -+ cpu_rate = cpu_pll / (postdiv + 1); -+ else -+ cpu_rate = ddr_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS) -+ ddr_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL) -+ ddr_rate = ddr_pll / (postdiv + 1); -+ else -+ ddr_rate = cpu_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS) -+ ahb_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL) -+ ahb_rate = ddr_pll / (postdiv + 1); -+ else -+ ahb_rate = cpu_pll / (postdiv + 1); -+ -+ ath79_add_sys_clkdev("ref", ref_rate); -+ ath79_add_sys_clkdev("cpu", cpu_rate); -+ ath79_add_sys_clkdev("ddr", ddr_rate); -+ ath79_add_sys_clkdev("ahb", ahb_rate); -+ -+ clk_add_alias("wdt", NULL, "ref", NULL); -+ clk_add_alias("uart", NULL, "ref", NULL); -+} -+ - static void __init qca955x_clocks_init(void) - { - unsigned long ref_rate; -@@ -450,6 +531,8 @@ void __init ath79_clocks_init(void) - ar933x_clocks_init(); - else if (soc_is_ar934x()) - ar934x_clocks_init(); -+ else if (soc_is_qca953x()) -+ qca953x_clocks_init(); - else if (soc_is_qca955x()) - qca955x_clocks_init(); - else ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -103,6 +103,8 @@ void ath79_device_reset_set(u32 mask) - reg = AR933X_RESET_REG_RESET_MODULE; - else if (soc_is_ar934x()) - reg = AR934X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca953x()) -+ reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -@@ -131,6 +133,8 @@ void ath79_device_reset_clear(u32 mask) - reg = AR933X_RESET_REG_RESET_MODULE; - else if (soc_is_ar934x()) - reg = AR934X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca953x()) -+ reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else ---- a/arch/mips/ath79/dev-common.c -+++ b/arch/mips/ath79/dev-common.c -@@ -94,6 +94,7 @@ void __init ath79_register_uart(void) - soc_is_ar724x() || - soc_is_ar913x() || - soc_is_ar934x() || -+ soc_is_qca953x() || - soc_is_qca955x()) { - ath79_uart_data[0].uartclk = uart_clk_rate; - platform_device_register(&ath79_uart_device); -@@ -157,6 +158,9 @@ void __init ath79_gpio_init(void) - } else if (soc_is_ar934x()) { - ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; -+ } else if (soc_is_qca953x()) { -+ ath79_gpio_pdata.ngpios = QCA953X_GPIO_COUNT; -+ ath79_gpio_pdata.oe_inverted = 1; - } else if (soc_is_qca955x()) { - ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; ---- a/arch/mips/ath79/dev-usb.c -+++ b/arch/mips/ath79/dev-usb.c -@@ -236,6 +236,30 @@ static void __init ar934x_usb_setup(void) - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); - } - -+static void __init qca953x_usb_setup(void) -+{ -+ u32 bootstrap; -+ -+ bootstrap = ath79_reset_rr(QCA953X_RESET_REG_BOOTSTRAP); -+ -+ ath79_device_reset_set(QCA953X_RESET_USBSUS_OVERRIDE); -+ udelay(1000); -+ -+ ath79_device_reset_clear(QCA953X_RESET_USB_PHY); -+ udelay(1000); -+ -+ ath79_device_reset_clear(QCA953X_RESET_USB_PHY_ANALOG); -+ udelay(1000); -+ -+ ath79_device_reset_clear(QCA953X_RESET_USB_HOST); -+ udelay(1000); -+ -+ ath79_usb_register("ehci-platform", -1, -+ QCA953X_EHCI_BASE, QCA953X_EHCI_SIZE, -+ ATH79_CPU_IRQ(3), -+ &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); -+} -+ - static void qca955x_usb_reset_notifier(struct platform_device *pdev) - { - u32 base; -@@ -286,6 +310,8 @@ void __init ath79_register_usb(void) - ar933x_usb_setup(); - else if (soc_is_ar934x()) - ar934x_usb_setup(); -+ else if (soc_is_qca953x()) -+ qca953x_usb_setup(); - else if (soc_is_qca955x()) - qca955x_usb_setup(); - else ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -100,7 +100,7 @@ static int ar933x_wmac_reset(void) - return -ETIMEDOUT; - } - --static int ar933x_r1_get_wmac_revision(void) -+static int ar93xx_get_soc_revision(void) - { - return ath79_soc_rev; - } -@@ -125,7 +125,7 @@ static void __init ar933x_wmac_setup(void) - ath79_wmac_data.is_clk_25mhz = true; - - if (ath79_soc_rev == 1) -- ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision; -+ ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision; - - ath79_wmac_data.external_reset = ar933x_wmac_reset; - } -@@ -150,6 +150,21 @@ static void ar934x_wmac_setup(void) - ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision; - } - -+static void qca953x_wmac_setup(void) -+{ -+ ath79_wmac_device.name = "qca953x_wmac"; -+ -+ ath79_wmac_resources[0].start = QCA953X_WMAC_BASE; -+ ath79_wmac_resources[0].end = QCA953X_WMAC_BASE + QCA953X_WMAC_SIZE - 1; -+ ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1); -+ ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1); -+ -+ /* QCA953X only supports 25MHz ref_clk */ -+ ath79_wmac_data.is_clk_25mhz = true; -+ -+ ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision; -+} -+ - static void qca955x_wmac_setup(void) - { - u32 t; -@@ -379,6 +394,8 @@ void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr) - ar933x_wmac_setup(); - else if (soc_is_ar934x()) - ar934x_wmac_setup(); -+ else if (soc_is_qca953x()) -+ qca953x_wmac_setup(); - else if (soc_is_qca955x()) - qca955x_wmac_setup(); - else ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -116,6 +116,8 @@ static void prom_putchar_init(void) - case REV_ID_MAJOR_AR9341: - case REV_ID_MAJOR_AR9342: - case REV_ID_MAJOR_AR9344: -+ case REV_ID_MAJOR_QCA9533: -+ case REV_ID_MAJOR_QCA9533_V2: - case REV_ID_MAJOR_QCA9556: - case REV_ID_MAJOR_QCA9558: - _prom_putchar = prom_putchar_ar71xx; ---- a/arch/mips/ath79/gpio.c -+++ b/arch/mips/ath79/gpio.c -@@ -31,7 +31,7 @@ static void __iomem *ath79_gpio_get_function_reg(void) - soc_is_ar913x() || - soc_is_ar933x()) - reg = AR71XX_GPIO_REG_FUNC; -- else if (soc_is_ar934x()) -+ else if (soc_is_ar934x() || soc_is_qca953x()) - reg = AR934X_GPIO_REG_FUNC; - else - BUG(); -@@ -64,7 +64,7 @@ void __init ath79_gpio_output_select(unsigned gpio, u8 val) - unsigned int reg; - u32 t, s; - -- BUG_ON(!soc_is_ar934x()); -+ BUG_ON(!soc_is_ar934x() && !soc_is_qca953x()); - - if (gpio >= AR934X_GPIO_COUNT) - return; ---- a/arch/mips/ath79/irq.c -+++ b/arch/mips/ath79/irq.c -@@ -56,6 +56,34 @@ static void ar934x_ip2_irq_init(void) - irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch); - } - -+static void qca953x_ip2_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS); -+ -+ if (status & QCA953X_PCIE_WMAC_INT_PCIE_ALL) { -+ ath79_ddr_wb_flush(3); -+ generic_handle_irq(ATH79_IP2_IRQ(0)); -+ } else if (status & QCA953X_PCIE_WMAC_INT_WMAC_ALL) { -+ ath79_ddr_wb_flush(4); -+ generic_handle_irq(ATH79_IP2_IRQ(1)); -+ } else { -+ spurious_interrupt(); -+ } -+} -+ -+static void qca953x_irq_init(void) -+{ -+ int i; -+ -+ for (i = ATH79_IP2_IRQ_BASE; -+ i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch); -+} -+ - static void qca955x_ip2_irq_dispatch(struct irq_desc *desc) - { - u32 status; -@@ -143,7 +171,7 @@ void __init arch_init_irq(void) - soc_is_ar913x() || soc_is_ar933x()) { - irq_wb_chan2 = 3; - irq_wb_chan3 = 2; -- } else if (soc_is_ar934x()) { -+ } else if (soc_is_ar934x() || soc_is_qca953x()) { - irq_wb_chan3 = 2; - } - -@@ -154,6 +182,7 @@ void __init arch_init_irq(void) - else if (soc_is_ar724x() || - soc_is_ar933x() || - soc_is_ar934x() || -+ soc_is_qca953x() || - soc_is_qca955x()) - misc_is_ar71xx = false; - else -@@ -164,6 +193,8 @@ void __init arch_init_irq(void) - - if (soc_is_ar934x()) - ar934x_ip2_irq_init(); -+ else if (soc_is_qca953x()) -+ qca953x_irq_init(); - else if (soc_is_qca955x()) - qca955x_irq_init(); - } ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -60,6 +60,7 @@ static void __init ath79_detect_sys_type(void) - u32 major; - u32 minor; - u32 rev = 0; -+ u32 ver = 1; - - id = ath79_reset_rr(AR71XX_RESET_REG_REV_ID); - major = id & REV_ID_MAJOR_MASK; -@@ -152,6 +153,17 @@ static void __init ath79_detect_sys_type(void) - rev = id & AR934X_REV_ID_REVISION_MASK; - break; - -+ case REV_ID_MAJOR_QCA9533_V2: -+ ver = 2; -+ ath79_soc_rev = 2; -+ /* drop through */ -+ -+ case REV_ID_MAJOR_QCA9533: -+ ath79_soc = ATH79_SOC_QCA9533; -+ chip = "9533"; -+ rev = id & QCA953X_REV_ID_REVISION_MASK; -+ break; -+ - case REV_ID_MAJOR_QCA9556: - ath79_soc = ATH79_SOC_QCA9556; - chip = "9556"; -@@ -168,11 +180,12 @@ static void __init ath79_detect_sys_type(void) - panic("ath79: unknown SoC, id:0x%08x", id); - } - -- ath79_soc_rev = rev; -+ if (ver == 1) -+ ath79_soc_rev = rev; - -- if (soc_is_qca955x()) -- sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u", -- chip, rev); -+ if (soc_is_qca953x() || soc_is_qca955x()) -+ sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", -+ chip, ver, rev); - else - sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev); - pr_info("SoC: %s\n", ath79_sys_type); ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -105,6 +105,21 @@ - #define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000) - #define AR934X_SRIF_SIZE 0x1000 - -+#define QCA953X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define QCA953X_GMAC_SIZE 0x14 -+#define QCA953X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) -+#define QCA953X_WMAC_SIZE 0x20000 -+#define QCA953X_EHCI_BASE 0x1b000000 -+#define QCA953X_EHCI_SIZE 0x200 -+#define QCA953X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000) -+#define QCA953X_SRIF_SIZE 0x1000 -+ -+#define QCA953X_PCI_CFG_BASE0 0x14000000 -+#define QCA953X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000) -+#define QCA953X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000) -+#define QCA953X_PCI_MEM_BASE0 0x10000000 -+#define QCA953X_PCI_MEM_SIZE 0x02000000 -+ - #define QCA955X_PCI_MEM_BASE0 0x10000000 - #define QCA955X_PCI_MEM_BASE1 0x12000000 - #define QCA955X_PCI_MEM_SIZE 0x02000000 -@@ -180,6 +195,12 @@ - #define AR934X_OTP_INTF3_ADDRESS 0x3100c - #define AR934X_OTP_PGENB_SETUP_HOLD_TIME_ADDRESS 0x31034 - -+#define QCA953X_DDR_REG_FLUSH_GE0 0x9c -+#define QCA953X_DDR_REG_FLUSH_GE1 0xa0 -+#define QCA953X_DDR_REG_FLUSH_USB 0xa4 -+#define QCA953X_DDR_REG_FLUSH_PCIE 0xa8 -+#define QCA953X_DDR_REG_FLUSH_WMAC 0xac -+ - /* - * PLL block - */ -@@ -286,6 +307,44 @@ - - #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6) - -+#define QCA953X_PLL_CPU_CONFIG_REG 0x00 -+#define QCA953X_PLL_DDR_CONFIG_REG 0x04 -+#define QCA953X_PLL_CLK_CTRL_REG 0x08 -+#define QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24 -+#define QCA953X_PLL_ETH_XMII_CONTROL_REG 0x2c -+#define QCA953X_PLL_ETH_SGMII_CONTROL_REG 0x48 -+ -+#define QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 -+#define QCA953X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -+#define QCA953X_PLL_CPU_CONFIG_NINT_SHIFT 6 -+#define QCA953X_PLL_CPU_CONFIG_NINT_MASK 0x3f -+#define QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 -+#define QCA953X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -+#define QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19 -+#define QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7 -+ -+#define QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT 0 -+#define QCA953X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff -+#define QCA953X_PLL_DDR_CONFIG_NINT_SHIFT 10 -+#define QCA953X_PLL_DDR_CONFIG_NINT_MASK 0x3f -+#define QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT 16 -+#define QCA953X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f -+#define QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23 -+#define QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7 -+ -+#define QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2) -+#define QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3) -+#define QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4) -+#define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5 -+#define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f -+#define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10 -+#define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f -+#define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15 -+#define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f -+#define QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20) -+#define QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) -+#define QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) -+ - #define QCA955X_PLL_CPU_CONFIG_REG 0x00 - #define QCA955X_PLL_DDR_CONFIG_REG 0x04 - #define QCA955X_PLL_CLK_CTRL_REG 0x08 -@@ -362,6 +421,10 @@ - #define AR934X_RESET_REG_BOOTSTRAP 0xb0 - #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac - -+#define QCA953X_RESET_REG_RESET_MODULE 0x1c -+#define QCA953X_RESET_REG_BOOTSTRAP 0xb0 -+#define QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac -+ - #define QCA955X_RESET_REG_RESET_MODULE 0x1c - #define QCA955X_RESET_REG_BOOTSTRAP 0xb0 - #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac -@@ -457,6 +520,27 @@ - #define AR934X_RESET_MBOX BIT(1) - #define AR934X_RESET_I2S BIT(0) - -+#define QCA953X_RESET_USB_EXT_PWR BIT(29) -+#define QCA953X_RESET_EXTERNAL BIT(28) -+#define QCA953X_RESET_RTC BIT(27) -+#define QCA953X_RESET_FULL_CHIP BIT(24) -+#define QCA953X_RESET_GE1_MDIO BIT(23) -+#define QCA953X_RESET_GE0_MDIO BIT(22) -+#define QCA953X_RESET_CPU_NMI BIT(21) -+#define QCA953X_RESET_CPU_COLD BIT(20) -+#define QCA953X_RESET_DDR BIT(16) -+#define QCA953X_RESET_USB_PHY_PLL_PWD_EXT BIT(15) -+#define QCA953X_RESET_GE1_MAC BIT(13) -+#define QCA953X_RESET_ETH_SWITCH_ANALOG BIT(12) -+#define QCA953X_RESET_USB_PHY_ANALOG BIT(11) -+#define QCA953X_RESET_GE0_MAC BIT(9) -+#define QCA953X_RESET_ETH_SWITCH BIT(8) -+#define QCA953X_RESET_PCIE_PHY BIT(7) -+#define QCA953X_RESET_PCIE BIT(6) -+#define QCA953X_RESET_USB_HOST BIT(5) -+#define QCA953X_RESET_USB_PHY BIT(4) -+#define QCA953X_RESET_USBSUS_OVERRIDE BIT(3) -+ - #define QCA955X_RESET_HOST BIT(31) - #define QCA955X_RESET_SLIC BIT(30) - #define QCA955X_RESET_HDMA BIT(29) -@@ -510,6 +594,13 @@ - #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1) - #define AR934X_BOOTSTRAP_DDR1 BIT(0) - -+#define QCA953X_BOOTSTRAP_SW_OPTION2 BIT(12) -+#define QCA953X_BOOTSTRAP_SW_OPTION1 BIT(11) -+#define QCA953X_BOOTSTRAP_EJTAG_MODE BIT(5) -+#define QCA953X_BOOTSTRAP_REF_CLK_40 BIT(4) -+#define QCA953X_BOOTSTRAP_SDRAM_DISABLED BIT(1) -+#define QCA953X_BOOTSTRAP_DDR1 BIT(0) -+ - #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4) - - #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) -@@ -530,6 +621,24 @@ - AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \ - AR934X_PCIE_WMAC_INT_PCIE_RC3) - -+#define QCA953X_PCIE_WMAC_INT_WMAC_MISC BIT(0) -+#define QCA953X_PCIE_WMAC_INT_WMAC_TX BIT(1) -+#define QCA953X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) -+#define QCA953X_PCIE_WMAC_INT_WMAC_RXHP BIT(3) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC BIT(4) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC0 BIT(5) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC1 BIT(6) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC2 BIT(7) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC3 BIT(8) -+#define QCA953X_PCIE_WMAC_INT_WMAC_ALL \ -+ (QCA953X_PCIE_WMAC_INT_WMAC_MISC | QCA953X_PCIE_WMAC_INT_WMAC_TX | \ -+ QCA953X_PCIE_WMAC_INT_WMAC_RXLP | QCA953X_PCIE_WMAC_INT_WMAC_RXHP) -+ -+#define QCA953X_PCIE_WMAC_INT_PCIE_ALL \ -+ (QCA953X_PCIE_WMAC_INT_PCIE_RC | QCA953X_PCIE_WMAC_INT_PCIE_RC0 | \ -+ QCA953X_PCIE_WMAC_INT_PCIE_RC1 | QCA953X_PCIE_WMAC_INT_PCIE_RC2 | \ -+ QCA953X_PCIE_WMAC_INT_PCIE_RC3) -+ - #define QCA955X_EXT_INT_WMAC_MISC BIT(0) - #define QCA955X_EXT_INT_WMAC_TX BIT(1) - #define QCA955X_EXT_INT_WMAC_RXLP BIT(2) -@@ -572,6 +681,8 @@ - #define REV_ID_MAJOR_AR9341 0x0120 - #define REV_ID_MAJOR_AR9342 0x1120 - #define REV_ID_MAJOR_AR9344 0x2120 -+#define REV_ID_MAJOR_QCA9533 0x0140 -+#define REV_ID_MAJOR_QCA9533_V2 0x0160 - #define REV_ID_MAJOR_QCA9556 0x0130 - #define REV_ID_MAJOR_QCA9558 0x1130 - -@@ -594,6 +705,8 @@ - - #define AR934X_REV_ID_REVISION_MASK 0xf - -+#define QCA953X_REV_ID_REVISION_MASK 0xf -+ - #define QCA955X_REV_ID_REVISION_MASK 0xf - - /* -@@ -641,6 +754,25 @@ - #define AR934X_GPIO_REG_OUT_FUNC5 0x40 - #define AR934X_GPIO_REG_FUNC 0x6c - -+#define QCA953X_GPIO_REG_OUT_FUNC0 0x2c -+#define QCA953X_GPIO_REG_OUT_FUNC1 0x30 -+#define QCA953X_GPIO_REG_OUT_FUNC2 0x34 -+#define QCA953X_GPIO_REG_OUT_FUNC3 0x38 -+#define QCA953X_GPIO_REG_OUT_FUNC4 0x3c -+#define QCA953X_GPIO_REG_IN_ENABLE0 0x44 -+#define QCA953X_GPIO_REG_FUNC 0x6c -+ -+#define QCA953X_GPIO_OUT_MUX_SPI_CS1 10 -+#define QCA953X_GPIO_OUT_MUX_SPI_CS2 11 -+#define QCA953X_GPIO_OUT_MUX_SPI_CS0 9 -+#define QCA953X_GPIO_OUT_MUX_SPI_CLK 8 -+#define QCA953X_GPIO_OUT_MUX_SPI_MOSI 12 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK1 41 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK2 42 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK3 43 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK4 44 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK5 45 -+ - #define QCA955X_GPIO_REG_OUT_FUNC0 0x2c - #define QCA955X_GPIO_REG_OUT_FUNC1 0x30 - #define QCA955X_GPIO_REG_OUT_FUNC2 0x34 -@@ -655,6 +787,7 @@ - #define AR913X_GPIO_COUNT 22 - #define AR933X_GPIO_COUNT 30 - #define AR934X_GPIO_COUNT 23 -+#define QCA953X_GPIO_COUNT 18 - #define QCA955X_GPIO_COUNT 24 - - /* -@@ -678,6 +811,24 @@ - #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 - #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 - -+#define QCA953X_SRIF_CPU_DPLL1_REG 0x1c0 -+#define QCA953X_SRIF_CPU_DPLL2_REG 0x1c4 -+#define QCA953X_SRIF_CPU_DPLL3_REG 0x1c8 -+ -+#define QCA953X_SRIF_DDR_DPLL1_REG 0x240 -+#define QCA953X_SRIF_DDR_DPLL2_REG 0x244 -+#define QCA953X_SRIF_DDR_DPLL3_REG 0x248 -+ -+#define QCA953X_SRIF_DPLL1_REFDIV_SHIFT 27 -+#define QCA953X_SRIF_DPLL1_REFDIV_MASK 0x1f -+#define QCA953X_SRIF_DPLL1_NINT_SHIFT 18 -+#define QCA953X_SRIF_DPLL1_NINT_MASK 0x1ff -+#define QCA953X_SRIF_DPLL1_NFRAC_MASK 0x0003ffff -+ -+#define QCA953X_SRIF_DPLL2_LOCAL_PLL BIT(30) -+#define QCA953X_SRIF_DPLL2_OUTDIV_SHIFT 13 -+#define QCA953X_SRIF_DPLL2_OUTDIV_MASK 0x7 -+ - #define AR71XX_GPIO_FUNC_STEREO_EN BIT(17) - #define AR71XX_GPIO_FUNC_SLIC_EN BIT(16) - #define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13) -@@ -883,6 +1034,16 @@ - #define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 - #define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 - -+/* -+ * QCA953X GMAC Interface -+ */ -+#define QCA953X_GMAC_REG_ETH_CFG 0x00 -+ -+#define QCA953X_ETH_CFG_SW_ONLY_MODE BIT(6) -+#define QCA953X_ETH_CFG_SW_PHY_SWAP BIT(7) -+#define QCA953X_ETH_CFG_SW_APB_ACCESS BIT(9) -+#define QCA953X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13) -+ - /* - * QCA955X GMAC Interface - */ ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -32,6 +32,7 @@ enum ath79_soc_type { - ATH79_SOC_AR9341, - ATH79_SOC_AR9342, - ATH79_SOC_AR9344, -+ ATH79_SOC_QCA9533, - ATH79_SOC_QCA9556, - ATH79_SOC_QCA9558, - }; -@@ -100,6 +101,16 @@ static inline int soc_is_ar934x(void) - return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344(); - } - -+static inline int soc_is_qca9533(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA9533; -+} -+ -+static inline int soc_is_qca953x(void) -+{ -+ return soc_is_qca9533(); -+} -+ - static inline int soc_is_qca9556(void) - { - return ath79_soc == ATH79_SOC_QCA9556; diff --git a/target/linux/ar71xx/patches-4.14/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-4.14/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch deleted file mode 100644 index bfe8b8e9f..000000000 --- a/target/linux/ar71xx/patches-4.14/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch +++ /dev/null @@ -1,717 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -114,6 +114,12 @@ config SOC_QCA955X - select PCI_AR724X if PCI - def_bool n - -+config SOC_QCA956X -+ select USB_ARCH_HAS_EHCI -+ select HW_HAS_PCI -+ select PCI_AR724X if PCI -+ def_bool n -+ - config ATH79_DEV_M25P80 - select ATH79_DEV_SPI - def_bool n -@@ -148,7 +154,7 @@ config ATH79_DEV_USB - def_bool n - - config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X) -+ depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X || SOC_QCA956X) - def_bool n - - config ATH79_NVRAM ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -521,6 +521,100 @@ static void __init qca955x_clocks_init(void) - clk_add_alias("uart", NULL, "ref", NULL); - } - -+static void __init qca956x_clocks_init(void) -+{ -+ unsigned long ref_rate; -+ unsigned long cpu_rate; -+ unsigned long ddr_rate; -+ unsigned long ahb_rate; -+ u32 pll, out_div, ref_div, nint, hfrac, lfrac, clk_ctrl, postdiv; -+ u32 cpu_pll, ddr_pll; -+ u32 bootstrap; -+ -+ bootstrap = ath79_reset_rr(QCA956X_RESET_REG_BOOTSTRAP); -+ if (bootstrap & QCA956X_BOOTSTRAP_REF_CLK_40) -+ ref_rate = 40 * 1000 * 1000; -+ else -+ ref_rate = 25 * 1000 * 1000; -+ -+ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG_REG); -+ out_div = (pll >> QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG_REFDIV_MASK; -+ -+ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG1_REG); -+ nint = (pll >> QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NINT_MASK; -+ hfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK; -+ lfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK; -+ -+ cpu_pll = nint * ref_rate / ref_div; -+ cpu_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); -+ cpu_pll += (hfrac >> 13) * ref_rate / ref_div; -+ cpu_pll /= (1 << out_div); -+ -+ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG_REG); -+ out_div = (pll >> QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG_REFDIV_MASK; -+ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG1_REG); -+ nint = (pll >> QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NINT_MASK; -+ hfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK; -+ lfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK; -+ -+ ddr_pll = nint * ref_rate / ref_div; -+ ddr_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); -+ ddr_pll += (hfrac >> 13) * ref_rate / ref_div; -+ ddr_pll /= (1 << out_div); -+ -+ clk_ctrl = ath79_pll_rr(QCA956X_PLL_CLK_CTRL_REG); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS) -+ cpu_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL) -+ cpu_rate = ddr_pll / (postdiv + 1); -+ else -+ cpu_rate = cpu_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS) -+ ddr_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL) -+ ddr_rate = cpu_pll / (postdiv + 1); -+ else -+ ddr_rate = ddr_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS) -+ ahb_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL) -+ ahb_rate = ddr_pll / (postdiv + 1); -+ else -+ ahb_rate = cpu_pll / (postdiv + 1); -+ -+ ath79_add_sys_clkdev("ref", ref_rate); -+ ath79_add_sys_clkdev("cpu", cpu_rate); -+ ath79_add_sys_clkdev("ddr", ddr_rate); -+ ath79_add_sys_clkdev("ahb", ahb_rate); -+ -+ clk_add_alias("wdt", NULL, "ref", NULL); -+ clk_add_alias("uart", NULL, "ref", NULL); -+} -+ - void __init ath79_clocks_init(void) - { - if (soc_is_ar71xx()) -@@ -535,6 +629,8 @@ void __init ath79_clocks_init(void) - qca953x_clocks_init(); - else if (soc_is_qca955x()) - qca955x_clocks_init(); -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ qca956x_clocks_init(); - else - BUG(); - } ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -107,6 +107,8 @@ void ath79_device_reset_set(u32 mask) - reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ reg = QCA956X_RESET_REG_RESET_MODULE; - else - panic("Reset register not defined for this SOC"); - -@@ -137,6 +139,8 @@ void ath79_device_reset_clear(u32 mask) - reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ reg = QCA956X_RESET_REG_RESET_MODULE; - else - panic("Reset register not defined for this SOC"); - -@@ -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; -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ reg = QCA956X_RESET_REG_RESET_MODULE; - else - BUG(); - ---- a/arch/mips/ath79/dev-common.c -+++ b/arch/mips/ath79/dev-common.c -@@ -95,7 +95,9 @@ void __init ath79_register_uart(void) - soc_is_ar913x() || - soc_is_ar934x() || - soc_is_qca953x() || -- soc_is_qca955x()) { -+ soc_is_qca955x() || -+ soc_is_qca956x() || -+ soc_is_tp9343()) { - ath79_uart_data[0].uartclk = uart_clk_rate; - platform_device_register(&ath79_uart_device); - } else if (soc_is_ar933x()) { -@@ -164,6 +166,9 @@ void __init ath79_gpio_init(void) - } else if (soc_is_qca955x()) { - ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; -+ } else if (soc_is_qca956x() || soc_is_tp9343()) { -+ ath79_gpio_pdata.ngpios = QCA956X_GPIO_COUNT; -+ ath79_gpio_pdata.oe_inverted = 1; - } else { - BUG(); - } ---- a/arch/mips/ath79/dev-usb.c -+++ b/arch/mips/ath79/dev-usb.c -@@ -296,6 +296,19 @@ static void __init qca955x_usb_setup(void) - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); - } - -+static void __init qca956x_usb_setup(void) -+{ -+ ath79_usb_register("ehci-platform", 0, -+ QCA956X_EHCI0_BASE, QCA956X_EHCI_SIZE, -+ ATH79_IP3_IRQ(0), -+ &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); -+ -+ ath79_usb_register("ehci-platform", 1, -+ QCA956X_EHCI1_BASE, QCA956X_EHCI_SIZE, -+ ATH79_IP3_IRQ(1), -+ &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); -+} -+ - void __init ath79_register_usb(void) - { - if (soc_is_ar71xx()) -@@ -314,6 +327,8 @@ void __init ath79_register_usb(void) - qca953x_usb_setup(); - else if (soc_is_qca955x()) - qca955x_usb_setup(); -+ else if (soc_is_qca956x()) -+ qca956x_usb_setup(); - else - BUG(); - } ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -195,6 +195,26 @@ static void qca955x_wmac_setup(void) - #define AR93XX_OTP_READ_DATA \ - (soc_is_ar934x() ? AR934X_OTP_READ_DATA : AR9300_OTP_READ_DATA) - -+static void qca956x_wmac_setup(void) -+{ -+ u32 t; -+ -+ ath79_wmac_device.name = "qca956x_wmac"; -+ -+ ath79_wmac_resources[0].start = QCA956X_WMAC_BASE; -+ ath79_wmac_resources[0].end = QCA956X_WMAC_BASE + QCA956X_WMAC_SIZE - 1; -+ ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1); -+ ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1); -+ -+ t = ath79_reset_rr(QCA956X_RESET_REG_BOOTSTRAP); -+ if (t & QCA956X_BOOTSTRAP_REF_CLK_40) -+ ath79_wmac_data.is_clk_25mhz = false; -+ else -+ ath79_wmac_data.is_clk_25mhz = true; -+ -+ ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision; -+} -+ - static bool __init - ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data) - { -@@ -398,6 +418,8 @@ void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr) - qca953x_wmac_setup(); - else if (soc_is_qca955x()) - qca955x_wmac_setup(); -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ qca956x_wmac_setup(); - else - BUG(); - ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -120,6 +120,8 @@ static void prom_putchar_init(void) - case REV_ID_MAJOR_QCA9533_V2: - case REV_ID_MAJOR_QCA9556: - case REV_ID_MAJOR_QCA9558: -+ case REV_ID_MAJOR_TP9343: -+ case REV_ID_MAJOR_QCA956X: - _prom_putchar = prom_putchar_ar71xx; - break; - ---- a/arch/mips/ath79/gpio.c -+++ b/arch/mips/ath79/gpio.c -@@ -31,7 +31,10 @@ static void __iomem *ath79_gpio_get_function_reg(void) - soc_is_ar913x() || - soc_is_ar933x()) - reg = AR71XX_GPIO_REG_FUNC; -- else if (soc_is_ar934x() || soc_is_qca953x()) -+ else if (soc_is_ar934x() || -+ soc_is_qca953x() || -+ soc_is_qca956x() || -+ soc_is_tp9343()) - reg = AR934X_GPIO_REG_FUNC; - else - BUG(); -@@ -64,7 +67,7 @@ void __init ath79_gpio_output_select(unsigned gpio, u8 val) - unsigned int reg; - u32 t, s; - -- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x()); -+ BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x()); - - if (gpio >= AR934X_GPIO_COUNT) - return; ---- a/arch/mips/ath79/irq.c -+++ b/arch/mips/ath79/irq.c -@@ -156,6 +156,87 @@ static void qca955x_irq_init(void) - irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); - } - -+static void qca956x_ip2_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -+ status &= QCA956X_EXT_INT_PCIE_RC1_ALL | QCA956X_EXT_INT_WMAC_ALL; -+ -+ if (status == 0) { -+ spurious_interrupt(); -+ return; -+ } -+ -+ if (status & QCA956X_EXT_INT_PCIE_RC1_ALL) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP2_IRQ(0)); -+ } -+ -+ if (status & QCA956X_EXT_INT_WMAC_ALL) { -+ /* TODO: flsuh DDR? */ -+ generic_handle_irq(ATH79_IP2_IRQ(1)); -+ } -+} -+ -+static void qca956x_ip3_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -+ status &= QCA956X_EXT_INT_PCIE_RC2_ALL | -+ QCA956X_EXT_INT_USB1 | QCA956X_EXT_INT_USB2; -+ -+ if (status == 0) { -+ spurious_interrupt(); -+ return; -+ } -+ -+ if (status & QCA956X_EXT_INT_USB1) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(0)); -+ } -+ -+ if (status & QCA956X_EXT_INT_USB2) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(1)); -+ } -+ -+ if (status & QCA956X_EXT_INT_PCIE_RC2_ALL) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(2)); -+ } -+} -+ -+static void qca956x_enable_timer_cb(void) { -+ u32 misc; -+ -+ misc = ath79_reset_rr(AR71XX_RESET_REG_MISC_INT_ENABLE); -+ misc |= MISC_INT_MIPS_SI_TIMERINT_MASK; -+ ath79_reset_wr(AR71XX_RESET_REG_MISC_INT_ENABLE, misc); -+} -+ -+static void qca956x_irq_init(void) -+{ -+ int i; -+ -+ for (i = ATH79_IP2_IRQ_BASE; -+ i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch); -+ -+ for (i = ATH79_IP3_IRQ_BASE; -+ i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch); -+ -+ /* QCA956x timer init workaround has to be applied right before setting -+ * up the clock. Else, there will be no jiffies */ -+ late_time_init = &qca956x_enable_timer_cb; -+} -+ - void __init arch_init_irq(void) - { - unsigned irq_wb_chan2 = -1; -@@ -183,7 +264,9 @@ void __init arch_init_irq(void) - soc_is_ar933x() || - soc_is_ar934x() || - soc_is_qca953x() || -- soc_is_qca955x()) -+ soc_is_qca955x() || -+ soc_is_qca956x() || -+ soc_is_tp9343()) - misc_is_ar71xx = false; - else - BUG(); -@@ -197,4 +280,6 @@ void __init arch_init_irq(void) - qca953x_irq_init(); - else if (soc_is_qca955x()) - qca955x_irq_init(); -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ qca956x_irq_init(); - } ---- a/arch/mips/ath79/pci.c -+++ b/arch/mips/ath79/pci.c -@@ -68,6 +68,21 @@ static const struct ath79_pci_irq qca955x_pci_irq_map[] = { - }, - }; - -+static const struct ath79_pci_irq qca956x_pci_irq_map[] = { -+ { -+ .bus = 0, -+ .slot = 0, -+ .pin = 1, -+ .irq = ATH79_PCI_IRQ(0), -+ }, -+ { -+ .bus = 1, -+ .slot = 0, -+ .pin = 1, -+ .irq = ATH79_PCI_IRQ(1), -+ }, -+}; -+ - int pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin) - { - int irq = -1; -@@ -86,6 +101,9 @@ int pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin) - } else if (soc_is_qca955x()) { - ath79_pci_irq_map = qca955x_pci_irq_map; - ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map); -+ } else if (soc_is_qca956x()) { -+ ath79_pci_irq_map = qca956x_pci_irq_map; -+ ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map); - } else { - pr_crit("pci %s: invalid irq map\n", - pci_name((struct pci_dev *) dev)); -@@ -303,6 +321,15 @@ int __init ath79_register_pci(void) - QCA955X_PCI_MEM_SIZE, - 1, - ATH79_IP3_IRQ(2)); -+ } else if (soc_is_qca956x()) { -+ pdev = ath79_register_pci_ar724x(0, -+ QCA956X_PCI_CFG_BASE1, -+ QCA956X_PCI_CTRL_BASE1, -+ QCA956X_PCI_CRP_BASE1, -+ QCA956X_PCI_MEM_BASE1, -+ QCA956X_PCI_MEM_SIZE, -+ 1, -+ ATH79_IP3_IRQ(2)); - } else { - /* No PCI support */ - return -ENODEV; ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -176,6 +176,18 @@ static void __init ath79_detect_sys_type(void) - rev = id & QCA955X_REV_ID_REVISION_MASK; - break; - -+ case REV_ID_MAJOR_QCA956X: -+ ath79_soc = ATH79_SOC_QCA956X; -+ chip = "956X"; -+ rev = id & QCA956X_REV_ID_REVISION_MASK; -+ break; -+ -+ case REV_ID_MAJOR_TP9343: -+ ath79_soc = ATH79_SOC_TP9343; -+ chip = "9343"; -+ rev = id & QCA956X_REV_ID_REVISION_MASK; -+ break; -+ - default: - panic("ath79: unknown SoC, id:0x%08x", id); - } -@@ -183,9 +195,12 @@ static void __init ath79_detect_sys_type(void) - if (ver == 1) - ath79_soc_rev = rev; - -- if (soc_is_qca953x() || soc_is_qca955x()) -+ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca956x()) - sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", - chip, ver, rev); -+ else if (soc_is_tp9343()) -+ sprintf(ath79_sys_type, "Qualcomm Atheros TP%s rev %u", -+ chip, rev); - else - sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev); - pr_info("SoC: %s\n", ath79_sys_type); ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -143,6 +143,23 @@ - #define QCA955X_NFC_BASE 0x1b800200 - #define QCA955X_NFC_SIZE 0xb8 - -+#define QCA956X_PCI_MEM_BASE1 0x12000000 -+#define QCA956X_PCI_MEM_SIZE 0x02000000 -+#define QCA956X_PCI_CFG_BASE1 0x16000000 -+#define QCA956X_PCI_CFG_SIZE 0x1000 -+#define QCA956X_PCI_CRP_BASE1 (AR71XX_APB_BASE + 0x00250000) -+#define QCA956X_PCI_CRP_SIZE 0x1000 -+#define QCA956X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000) -+#define QCA956X_PCI_CTRL_SIZE 0x100 -+ -+#define QCA956X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) -+#define QCA956X_WMAC_SIZE 0x20000 -+#define QCA956X_EHCI0_BASE 0x1b000000 -+#define QCA956X_EHCI1_BASE 0x1b400000 -+#define QCA956X_EHCI_SIZE 0x200 -+#define QCA956X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define QCA956X_GMAC_SIZE 0x64 -+ - #define AR9300_OTP_BASE 0x14000 - #define AR9300_OTP_STATUS 0x15f18 - #define AR9300_OTP_STATUS_TYPE 0x7 -@@ -151,6 +168,13 @@ - #define AR9300_OTP_STATUS_SM_BUSY 0x1 - #define AR9300_OTP_READ_DATA 0x15f1c - -+/* -+ * Hidden Registers -+ */ -+#define QCA956X_DAM_RESET_OFFSET 0xb90001bc -+#define QCA956X_DAM_RESET_SIZE 0x4 -+#define QCA956X_INLINE_CHKSUM_ENG BIT(27) -+ - /* - * DDR_CTRL block - */ -@@ -382,6 +406,49 @@ - #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) - #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -+#define QCA956X_PLL_CPU_CONFIG_REG 0x00 -+#define QCA956X_PLL_CPU_CONFIG1_REG 0x04 -+#define QCA956X_PLL_DDR_CONFIG_REG 0x08 -+#define QCA956X_PLL_DDR_CONFIG1_REG 0x0c -+#define QCA956X_PLL_CLK_CTRL_REG 0x10 -+ -+#define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 -+#define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -+#define QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19 -+#define QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7 -+ -+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0 -+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK 0x1f -+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5 -+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x1fff -+#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT 18 -+#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff -+ -+#define QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT 16 -+#define QCA956X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f -+#define QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23 -+#define QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7 -+ -+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0 -+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK 0x1f -+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5 -+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x1fff -+#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT 18 -+#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff -+ -+#define QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2) -+#define QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3) -+#define QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4) -+#define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5 -+#define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f -+#define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10 -+#define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f -+#define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15 -+#define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f -+#define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL BIT(20) -+#define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL BIT(21) -+#define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) -+ - /* - * USB_CONFIG block - */ -@@ -429,6 +496,11 @@ - #define QCA955X_RESET_REG_BOOTSTRAP 0xb0 - #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac - -+#define QCA956X_RESET_REG_RESET_MODULE 0x1c -+#define QCA956X_RESET_REG_BOOTSTRAP 0xb0 -+#define QCA956X_RESET_REG_EXT_INT_STATUS 0xac -+ -+#define MISC_INT_MIPS_SI_TIMERINT_MASK BIT(28) - #define MISC_INT_ETHSW BIT(12) - #define MISC_INT_TIMER4 BIT(10) - #define MISC_INT_TIMER3 BIT(9) -@@ -603,6 +675,8 @@ - - #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4) - -+#define QCA956X_BOOTSTRAP_REF_CLK_40 BIT(2) -+ - #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) - #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1) - #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) -@@ -670,6 +744,37 @@ - QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \ - QCA955X_EXT_INT_PCIE_RC2_INT3) - -+#define QCA956X_EXT_INT_WMAC_MISC BIT(0) -+#define QCA956X_EXT_INT_WMAC_TX BIT(1) -+#define QCA956X_EXT_INT_WMAC_RXLP BIT(2) -+#define QCA956X_EXT_INT_WMAC_RXHP BIT(3) -+#define QCA956X_EXT_INT_PCIE_RC1 BIT(4) -+#define QCA956X_EXT_INT_PCIE_RC1_INT0 BIT(5) -+#define QCA956X_EXT_INT_PCIE_RC1_INT1 BIT(6) -+#define QCA956X_EXT_INT_PCIE_RC1_INT2 BIT(7) -+#define QCA956X_EXT_INT_PCIE_RC1_INT3 BIT(8) -+#define QCA956X_EXT_INT_PCIE_RC2 BIT(12) -+#define QCA956X_EXT_INT_PCIE_RC2_INT0 BIT(13) -+#define QCA956X_EXT_INT_PCIE_RC2_INT1 BIT(14) -+#define QCA956X_EXT_INT_PCIE_RC2_INT2 BIT(15) -+#define QCA956X_EXT_INT_PCIE_RC2_INT3 BIT(16) -+#define QCA956X_EXT_INT_USB1 BIT(24) -+#define QCA956X_EXT_INT_USB2 BIT(28) -+ -+#define QCA956X_EXT_INT_WMAC_ALL \ -+ (QCA956X_EXT_INT_WMAC_MISC | QCA956X_EXT_INT_WMAC_TX | \ -+ QCA956X_EXT_INT_WMAC_RXLP | QCA956X_EXT_INT_WMAC_RXHP) -+ -+#define QCA956X_EXT_INT_PCIE_RC1_ALL \ -+ (QCA956X_EXT_INT_PCIE_RC1 | QCA956X_EXT_INT_PCIE_RC1_INT0 | \ -+ QCA956X_EXT_INT_PCIE_RC1_INT1 | QCA956X_EXT_INT_PCIE_RC1_INT2 | \ -+ QCA956X_EXT_INT_PCIE_RC1_INT3) -+ -+#define QCA956X_EXT_INT_PCIE_RC2_ALL \ -+ (QCA956X_EXT_INT_PCIE_RC2 | QCA956X_EXT_INT_PCIE_RC2_INT0 | \ -+ QCA956X_EXT_INT_PCIE_RC2_INT1 | QCA956X_EXT_INT_PCIE_RC2_INT2 | \ -+ QCA956X_EXT_INT_PCIE_RC2_INT3) -+ - #define REV_ID_MAJOR_MASK 0xfff0 - #define REV_ID_MAJOR_AR71XX 0x00a0 - #define REV_ID_MAJOR_AR913X 0x00b0 -@@ -685,6 +790,8 @@ - #define REV_ID_MAJOR_QCA9533_V2 0x0160 - #define REV_ID_MAJOR_QCA9556 0x0130 - #define REV_ID_MAJOR_QCA9558 0x1130 -+#define REV_ID_MAJOR_TP9343 0x0150 -+#define REV_ID_MAJOR_QCA956X 0x1150 - - #define AR71XX_REV_ID_MINOR_MASK 0x3 - #define AR71XX_REV_ID_MINOR_AR7130 0x0 -@@ -709,6 +816,8 @@ - - #define QCA955X_REV_ID_REVISION_MASK 0xf - -+#define QCA956X_REV_ID_REVISION_MASK 0xf -+ - /* - * SPI block - */ -@@ -781,6 +890,19 @@ - #define QCA955X_GPIO_REG_OUT_FUNC5 0x40 - #define QCA955X_GPIO_REG_FUNC 0x6c - -+#define QCA956X_GPIO_REG_OUT_FUNC0 0x2c -+#define QCA956X_GPIO_REG_OUT_FUNC1 0x30 -+#define QCA956X_GPIO_REG_OUT_FUNC2 0x34 -+#define QCA956X_GPIO_REG_OUT_FUNC3 0x38 -+#define QCA956X_GPIO_REG_OUT_FUNC4 0x3c -+#define QCA956X_GPIO_REG_OUT_FUNC5 0x40 -+#define QCA956X_GPIO_REG_IN_ENABLE0 0x44 -+#define QCA956X_GPIO_REG_IN_ENABLE3 0x50 -+#define QCA956X_GPIO_REG_FUNC 0x6c -+ -+#define QCA956X_GPIO_OUT_MUX_GE0_MDO 32 -+#define QCA956X_GPIO_OUT_MUX_GE0_MDC 33 -+ - #define AR71XX_GPIO_COUNT 16 - #define AR7240_GPIO_COUNT 18 - #define AR7241_GPIO_COUNT 20 -@@ -789,6 +911,7 @@ - #define AR934X_GPIO_COUNT 23 - #define QCA953X_GPIO_COUNT 18 - #define QCA955X_GPIO_COUNT 24 -+#define QCA956X_GPIO_COUNT 23 - - /* - * SRIF block ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -35,6 +35,8 @@ enum ath79_soc_type { - ATH79_SOC_QCA9533, - ATH79_SOC_QCA9556, - ATH79_SOC_QCA9558, -+ ATH79_SOC_TP9343, -+ ATH79_SOC_QCA956X, - }; - - extern enum ath79_soc_type ath79_soc; -@@ -126,6 +128,26 @@ static inline int soc_is_qca955x(void) - return soc_is_qca9556() || soc_is_qca9558(); - } - -+static inline int soc_is_tp9343(void) -+{ -+ return ath79_soc == ATH79_SOC_TP9343; -+} -+ -+static inline int soc_is_qca9561(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA956X; -+} -+ -+static inline int soc_is_qca9563(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA956X; -+} -+ -+static inline int soc_is_qca956x(void) -+{ -+ return soc_is_qca9561() || soc_is_qca9563(); -+} -+ - void ath79_ddr_wb_flush(unsigned int reg); - void ath79_ddr_set_pci_windows(void); - diff --git a/target/linux/ar71xx/patches-4.14/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-4.14/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch deleted file mode 100644 index 6573b298a..000000000 --- a/target/linux/ar71xx/patches-4.14/622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -157,6 +157,10 @@ - #define QCA956X_EHCI0_BASE 0x1b000000 - #define QCA956X_EHCI1_BASE 0x1b400000 - #define QCA956X_EHCI_SIZE 0x200 -+#define QCA956X_GMAC_SGMII_BASE (AR71XX_APB_BASE + 0x00070000) -+#define QCA956X_GMAC_SGMII_SIZE 0x64 -+#define QCA956X_PLL_BASE (AR71XX_APB_BASE + 0x00050000) -+#define QCA956X_PLL_SIZE 0x50 - #define QCA956X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) - #define QCA956X_GMAC_SIZE 0x64 - -@@ -411,6 +415,7 @@ - #define QCA956X_PLL_DDR_CONFIG_REG 0x08 - #define QCA956X_PLL_DDR_CONFIG1_REG 0x0c - #define QCA956X_PLL_CLK_CTRL_REG 0x10 -+#define QCA956X_PLL_ETH_XMII_CONTROL_REG 0x30 - - #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 - #define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -@@ -1193,4 +1198,16 @@ - #define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 - #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 - -+/* -+ * QCA956X GMAC Interface -+ */ -+ -+#define QCA956X_GMAC_REG_ETH_CFG 0x00 -+ -+#define QCA956X_ETH_CFG_SW_ONLY_MODE BIT(7) -+#define QCA956X_ETH_CFG_SW_PHY_SWAP BIT(8) -+#define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(9) -+#define QCA956X_ETH_CFG_SW_APB_ACCESS BIT(10) -+#define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13) -+ - #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/target/linux/ar71xx/patches-4.14/630-MIPS-ath79-fix-chained-irq-disable.patch b/target/linux/ar71xx/patches-4.14/630-MIPS-ath79-fix-chained-irq-disable.patch deleted file mode 100644 index 2b92b88d0..000000000 --- a/target/linux/ar71xx/patches-4.14/630-MIPS-ath79-fix-chained-irq-disable.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- a/arch/mips/ath79/irq.c -+++ b/arch/mips/ath79/irq.c -@@ -27,6 +27,9 @@ - #include "machtypes.h" - - -+static struct irq_chip ip2_chip; -+static struct irq_chip ip3_chip; -+ - static void ar934x_ip2_irq_dispatch(struct irq_desc *desc) - { - u32 status; -@@ -50,8 +53,7 @@ static void ar934x_ip2_irq_init(void) - - for (i = ATH79_IP2_IRQ_BASE; - i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, -- handle_level_irq); -+ irq_set_chip_and_handler(i, &ip2_chip, handle_level_irq); - - irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch); - } -@@ -79,7 +81,7 @@ static void qca953x_irq_init(void) - - for (i = ATH79_IP2_IRQ_BASE; - i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ irq_set_chip_and_handler(i, &ip2_chip, handle_level_irq); - - irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch); - } -@@ -143,15 +145,13 @@ static void qca955x_irq_init(void) - - for (i = ATH79_IP2_IRQ_BASE; - i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, -- handle_level_irq); -+ irq_set_chip_and_handler(i, &ip2_chip, handle_level_irq); - - irq_set_chained_handler(ATH79_CPU_IRQ(2), qca955x_ip2_irq_dispatch); - - for (i = ATH79_IP3_IRQ_BASE; - i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, -- handle_level_irq); -+ irq_set_chip_and_handler(i, &ip3_chip, handle_level_irq); - - irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); - } -@@ -222,13 +222,13 @@ static void qca956x_irq_init(void) - - for (i = ATH79_IP2_IRQ_BASE; - i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ irq_set_chip_and_handler(i, &ip2_chip, handle_level_irq); - - irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch); - - for (i = ATH79_IP3_IRQ_BASE; - i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ irq_set_chip_and_handler(i, &ip3_chip, handle_level_irq); - - irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch); - -@@ -237,12 +237,40 @@ static void qca956x_irq_init(void) - late_time_init = &qca956x_enable_timer_cb; - } - -+static void ath79_ip2_disable(struct irq_data *data) -+{ -+ disable_irq(ATH79_CPU_IRQ(2)); -+} -+ -+static void ath79_ip2_enable(struct irq_data *data) -+{ -+ enable_irq(ATH79_CPU_IRQ(2)); -+} -+ -+static void ath79_ip3_disable(struct irq_data *data) -+{ -+ disable_irq(ATH79_CPU_IRQ(3)); -+} -+ -+static void ath79_ip3_enable(struct irq_data *data) -+{ -+ enable_irq(ATH79_CPU_IRQ(3)); -+} -+ - void __init arch_init_irq(void) - { - unsigned irq_wb_chan2 = -1; - unsigned irq_wb_chan3 = -1; - bool misc_is_ar71xx; - -+ ip2_chip = dummy_irq_chip; -+ ip2_chip.irq_disable = ath79_ip2_disable; -+ ip2_chip.irq_enable = ath79_ip2_enable; -+ -+ ip3_chip = dummy_irq_chip; -+ ip3_chip.irq_disable = ath79_ip3_disable; -+ ip3_chip.irq_enable = ath79_ip3_enable; -+ - if (mips_machtype == ATH79_MACH_GENERIC_OF) { - irqchip_init(); - return; diff --git a/target/linux/ar71xx/patches-4.14/631-MIPS-ath79-wmac-enable-set-led-pin.patch b/target/linux/ar71xx/patches-4.14/631-MIPS-ath79-wmac-enable-set-led-pin.patch deleted file mode 100644 index a31221771..000000000 --- a/target/linux/ar71xx/patches-4.14/631-MIPS-ath79-wmac-enable-set-led-pin.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -406,6 +406,11 @@ void __init ath79_wmac_set_ext_lna_gpio( - ar934x_set_ext_lna_gpio(chain, gpio); - } - -+void __init ath79_wmac_set_led_pin(int gpio) -+{ -+ ath79_wmac_data.led_pin = gpio; -+} -+ - void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr) - { - if (soc_is_ar913x()) ---- a/arch/mips/ath79/dev-wmac.h -+++ b/arch/mips/ath79/dev-wmac.h -@@ -18,6 +18,7 @@ void ath79_wmac_disable_2ghz(void); - void ath79_wmac_disable_5ghz(void); - void ath79_wmac_set_tx_gain_buffalo(void); - void ath79_wmac_set_ext_lna_gpio(unsigned chain, int gpio); -+void ath79_wmac_set_led_pin(int gpio); - - bool ar93xx_wmac_read_mac_address(u8 *dest); - diff --git a/target/linux/ar71xx/patches-4.14/632-MIPS-ath79-gpio-enable-set-direction.patch b/target/linux/ar71xx/patches-4.14/632-MIPS-ath79-gpio-enable-set-direction.patch deleted file mode 100644 index 4cf36325e..000000000 --- a/target/linux/ar71xx/patches-4.14/632-MIPS-ath79-gpio-enable-set-direction.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/arch/mips/ath79/common.h -+++ b/arch/mips/ath79/common.h -@@ -28,6 +28,7 @@ void ath79_gpio_function_enable(u32 mask - void ath79_gpio_function_disable(u32 mask); - void ath79_gpio_function_setup(u32 set, u32 clear); - void ath79_gpio_output_select(unsigned gpio, u8 val); -+int ath79_gpio_direction_select(unsigned gpio, bool oe); - void ath79_gpio_init(void); - - #endif /* __ATH79_COMMON_H */ ---- a/arch/mips/ath79/gpio.c -+++ b/arch/mips/ath79/gpio.c -@@ -83,3 +83,19 @@ void __init ath79_gpio_output_select(uns - /* flush write */ - (void) __raw_readl(base + reg); - } -+ -+int ath79_gpio_direction_select(unsigned gpio, bool oe) -+{ -+ void __iomem *base = ath79_gpio_base; -+ bool ieq_1 = (soc_is_ar934x() || -+ soc_is_qca953x()); -+ -+ if ((ieq_1 && oe) || (!ieq_1 && !oe)) -+ __raw_writel(__raw_readl(base + AR71XX_GPIO_REG_OE) & ~(1 << gpio), -+ base + AR71XX_GPIO_REG_OE); -+ else -+ __raw_writel(__raw_readl(base + AR71XX_GPIO_REG_OE) | (1 << gpio), -+ base + AR71XX_GPIO_REG_OE); -+ -+ return 0; -+} diff --git a/target/linux/ar71xx/patches-4.14/640-MIPS-ath79-add-QCA955x-wmac-reset.patch b/target/linux/ar71xx/patches-4.14/640-MIPS-ath79-add-QCA955x-wmac-reset.patch deleted file mode 100644 index bb315a1e6..000000000 --- a/target/linux/ar71xx/patches-4.14/640-MIPS-ath79-add-QCA955x-wmac-reset.patch +++ /dev/null @@ -1,82 +0,0 @@ ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -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); --static void __iomem *ath79_ddr_base; -+void __iomem *ath79_ddr_base; - static void __iomem *ath79_ddr_wb_flush_base; - static void __iomem *ath79_ddr_pci_win_base; - ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -32,7 +32,7 @@ - #define AR71XX_SPI_SIZE 0x01000000 - - #define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000) --#define AR71XX_DDR_CTRL_SIZE 0x100 -+#define AR71XX_DDR_CTRL_SIZE 0x200 - #define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000) - #define AR71XX_UART_SIZE 0x100 - #define AR71XX_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000) -@@ -229,6 +229,9 @@ - #define QCA953X_DDR_REG_FLUSH_PCIE 0xa8 - #define QCA953X_DDR_REG_FLUSH_WMAC 0xac - -+#define QCA955X_DDR_CTL_CONFIG 0x108 -+#define QCA955X_DDR_CTL_CONFIG_ACT_WMAC BIT(23) -+ - /* - * PLL block - */ ---- a/arch/mips/ath79/dev-wmac.c -+++ b/arch/mips/ath79/dev-wmac.c -@@ -165,6 +165,27 @@ static void qca953x_wmac_setup(void) - ath79_wmac_data.get_mac_revision = ar93xx_get_soc_revision; - } - -+static int ar955x_wmac_reset(void) -+{ -+ int i; -+ -+ /* Try to wait for WMAC DDR activity to stop */ -+ for (i = 0; i < 10; i++) { -+ if (!(__raw_readl(ath79_ddr_base + QCA955X_DDR_CTL_CONFIG) & -+ QCA955X_DDR_CTL_CONFIG_ACT_WMAC)) -+ break; -+ -+ udelay(10); -+ } -+ -+ ath79_device_reset_set(QCA955X_RESET_RTC); -+ udelay(10); -+ ath79_device_reset_clear(QCA955X_RESET_RTC); -+ udelay(10); -+ -+ return 0; -+} -+ - static void qca955x_wmac_setup(void) - { - u32 t; -@@ -181,6 +202,8 @@ static void qca955x_wmac_setup(void) - ath79_wmac_data.is_clk_25mhz = false; - else - ath79_wmac_data.is_clk_25mhz = true; -+ -+ ath79_wmac_data.external_reset = ar955x_wmac_reset; - } - - #define AR93XX_WMAC_SIZE \ ---- a/arch/mips/ath79/common.h -+++ b/arch/mips/ath79/common.h -@@ -19,6 +19,8 @@ - #define ATH79_MEM_SIZE_MIN (2 * 1024 * 1024) - #define ATH79_MEM_SIZE_MAX (256 * 1024 * 1024) - -+extern void __iomem *ath79_ddr_base; -+ - void ath79_clocks_init(void); - unsigned long ath79_get_sys_clk_rate(const char *id); - diff --git a/target/linux/ar71xx/patches-4.14/641-MIPS-ath79-ath9k-exports.patch b/target/linux/ar71xx/patches-4.14/641-MIPS-ath79-ath9k-exports.patch deleted file mode 100644 index acf0017c1..000000000 --- a/target/linux/ar71xx/patches-4.14/641-MIPS-ath79-ath9k-exports.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -34,11 +34,13 @@ EXPORT_SYMBOL_GPL(ath79_ddr_freq); - - enum ath79_soc_type ath79_soc; - unsigned int ath79_soc_rev; -+EXPORT_SYMBOL_GPL(ath79_soc_rev); - - void __iomem *ath79_pll_base; - void __iomem *ath79_reset_base; - EXPORT_SYMBOL_GPL(ath79_reset_base); - void __iomem *ath79_ddr_base; -+EXPORT_SYMBOL_GPL(ath79_ddr_base); - static void __iomem *ath79_ddr_wb_flush_base; - static void __iomem *ath79_ddr_pci_win_base; - ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -153,6 +153,7 @@ void ath79_ddr_set_pci_windows(void); - - extern void __iomem *ath79_gpio_base; - extern void __iomem *ath79_pll_base; -+extern void __iomem *ath79_ddr_base; - extern void __iomem *ath79_reset_base; - - static inline void ath79_pll_wr(unsigned reg, u32 val) diff --git a/target/linux/ar71xx/patches-4.14/642-MIPS-ath79-no-of.patch b/target/linux/ar71xx/patches-4.14/642-MIPS-ath79-no-of.patch deleted file mode 100644 index b2ef8a73c..000000000 --- a/target/linux/ar71xx/patches-4.14/642-MIPS-ath79-no-of.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -202,7 +202,6 @@ config ATH79 - select SYS_SUPPORTS_BIG_ENDIAN - select SYS_SUPPORTS_MIPS16 - select SYS_SUPPORTS_ZBOOT_UART_PROM -- select USE_OF - help - Support for the Atheros AR71XX/AR724X/AR913X SoCs. - ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -32,10 +32,12 @@ - #define AR724X_BASE_FREQ 40000000 - - static struct clk *clks[ATH79_CLK_END]; -+#ifdef CONFIG_OF - static struct clk_onecell_data clk_data = { - .clks = clks, - .clk_num = ARRAY_SIZE(clks), - }; -+#endif - - static struct clk *__init ath79_add_sys_clkdev( - const char *id, unsigned long rate) ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -224,16 +224,20 @@ unsigned int get_c0_compare_int(void) - - void __init plat_mem_setup(void) - { -+#ifdef CONFIG_OF - unsigned long fdt_start; -+#endif - - set_io_port_base(KSEG1); - -+#ifdef CONFIG_OF - /* Get the position of the FDT passed by the bootloader */ - fdt_start = fw_getenvl("fdt_start"); - if (fdt_start) - __dt_setup_arch((void *)KSEG0ADDR(fdt_start)); - else if (fw_passed_dtb) - __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb)); -+#endif - - if (mips_machtype != ATH79_MACH_GENERIC_OF) { - ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, -@@ -329,17 +333,21 @@ static int __init ath79_setup(void) - - arch_initcall(ath79_setup); - -+#ifdef CONFIG_OF - void __init device_tree_init(void) - { - unflatten_and_copy_device_tree(); - } -+#endif - - MIPS_MACHINE(ATH79_MACH_GENERIC, - "Generic", - "Generic AR71XX/AR724X/AR913X based board", - NULL); - -+#ifdef CONFIG_OF - MIPS_MACHINE(ATH79_MACH_GENERIC_OF, - "DTB", - "Generic AR71XX/AR724X/AR913X based board (DT)", - NULL); -+#endif diff --git a/target/linux/ar71xx/patches-4.14/700-MIPS-ath79-add-openwrt-Kconfig.patch b/target/linux/ar71xx/patches-4.14/700-MIPS-ath79-add-openwrt-Kconfig.patch deleted file mode 100644 index 093def8d1..000000000 --- a/target/linux/ar71xx/patches-4.14/700-MIPS-ath79-add-openwrt-Kconfig.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -83,6 +83,8 @@ config ATH79_MACH_UBNT_XM - Say 'Y' here if you want your kernel to support the - Ubiquiti Networks XM (rev 1.0) board. - -+source "arch/mips/ath79/Kconfig.openwrt" -+ - endmenu - - config SOC_AR71XX diff --git a/target/linux/ar71xx/patches-4.14/701-MIPS-ath79-add-routerboard-detection.patch b/target/linux/ar71xx/patches-4.14/701-MIPS-ath79-add-routerboard-detection.patch deleted file mode 100644 index 64c7e881a..000000000 --- a/target/linux/ar71xx/patches-4.14/701-MIPS-ath79-add-routerboard-detection.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/arch/mips/ath79/prom.c -+++ b/arch/mips/ath79/prom.c -@@ -136,6 +136,31 @@ void __init prom_init(void) - initrd_end = initrd_start + fw_getenvl("initrd_size"); - } - #endif -+ -+ if (strstr(arcs_cmdline, "board=750Gr3") || -+ strstr(arcs_cmdline, "board=750i") || -+ strstr(arcs_cmdline, "board=750-hb") || -+ strstr(arcs_cmdline, "board=411") || -+ strstr(arcs_cmdline, "board=433") || -+ strstr(arcs_cmdline, "board=435") || -+ strstr(arcs_cmdline, "board=450") || -+ strstr(arcs_cmdline, "board=493") || -+ strstr(arcs_cmdline, "board=951G") || -+ strstr(arcs_cmdline, "board=H951L") || -+ strstr(arcs_cmdline, "board=952-hb") || -+ strstr(arcs_cmdline, "board=953gs") || -+ strstr(arcs_cmdline, "board=962") || -+ strstr(arcs_cmdline, "board=lhg") || -+ strstr(arcs_cmdline, "board=map-hb") || -+ strstr(arcs_cmdline, "board=map2-hb") || -+ strstr(arcs_cmdline, "board=wap-hb") || -+ strstr(arcs_cmdline, "board=wapg-sc") || -+ strstr(arcs_cmdline, "board=2011L") || -+ strstr(arcs_cmdline, "board=2011r") || -+ strstr(arcs_cmdline, "board=711Gr100") || -+ strstr(arcs_cmdline, "board=911L") || -+ strstr(arcs_cmdline, "board=922gs")) -+ ath79_prom_append_cmdline("console", "ttyS0,115200"); - } - - void __init prom_free_prom_memory(void) diff --git a/target/linux/ar71xx/patches-4.14/702-MIPS-ath79-fixup-routerboot-board-parameter.patch b/target/linux/ar71xx/patches-4.14/702-MIPS-ath79-fixup-routerboot-board-parameter.patch deleted file mode 100644 index b8715bba9..000000000 --- a/target/linux/ar71xx/patches-4.14/702-MIPS-ath79-fixup-routerboot-board-parameter.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Gabor Juhos -Date: Sat, 2 Dec 2017 19:15:29 +0100 -Subject: [PATCH] MIPS: ath79: fix board detection with newer RouterBOOT versions - -Recent RouterBOOT version (at least version 3.41 on RB911G-5HPacD) -use "Board=" kernel parameter instead of "board=" to pass the board -name to the kernel. Due to this change the board detection code is -not working on the devices shipped with the new RouterBOOT version. -Because the kernel is unable to identify these boards they become -unusable despite that they are supported by the current code. - -Update the prom_init code to convert the 'Board' kernel parameter to -'board'. After this change, the board detection works also with the -new RouterBOOT versions. - -Signed-off-by: Gabor Juhos ---- ---- a/arch/mips/ath79/prom.c -+++ b/arch/mips/ath79/prom.c -@@ -104,6 +104,7 @@ static int __init ath79_prom_init_myload - void __init prom_init(void) - { - const char *env; -+ char *c; - - if (ath79_prom_init_myloader()) - return; -@@ -137,6 +138,15 @@ void __init prom_init(void) - } - #endif - -+ /* -+ * RouterBOOT uses "Board" kernel parameter instead of "board" since -+ * version 3.41 (or so). Replace the first character of the parameter -+ * to keep board detection working. -+ */ -+ c = strstr(arcs_cmdline, "Board="); -+ if (c) -+ c[0] = 'b'; -+ - if (strstr(arcs_cmdline, "board=750Gr3") || - strstr(arcs_cmdline, "board=750i") || - strstr(arcs_cmdline, "board=750-hb") || diff --git a/target/linux/ar71xx/patches-4.14/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch b/target/linux/ar71xx/patches-4.14/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch deleted file mode 100644 index a65f7d993..000000000 --- a/target/linux/ar71xx/patches-4.14/739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/arch/mips/ath79/gpio.c -+++ b/arch/mips/ath79/gpio.c -@@ -33,6 +33,7 @@ static void __iomem *ath79_gpio_get_func - reg = AR71XX_GPIO_REG_FUNC; - else if (soc_is_ar934x() || - soc_is_qca953x() || -+ soc_is_qca955x() || - soc_is_qca956x() || - soc_is_tp9343()) - reg = AR934X_GPIO_REG_FUNC; -@@ -64,15 +65,21 @@ void ath79_gpio_function_disable(u32 mas - void __init ath79_gpio_output_select(unsigned gpio, u8 val) - { - void __iomem *base = ath79_gpio_base; -- unsigned int reg; -+ unsigned int reg, reg_base; - u32 t, s; - -- BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x()); -- -- if (gpio >= AR934X_GPIO_COUNT) -- return; -+ if (soc_is_ar934x()) -+ reg_base = AR934X_GPIO_REG_OUT_FUNC0; -+ else if (soc_is_qca953x()) -+ reg_base = QCA953X_GPIO_REG_OUT_FUNC0; -+ else if (soc_is_qca955x()) -+ reg_base = QCA955X_GPIO_REG_OUT_FUNC0; -+ else if (soc_is_qca956x()) -+ reg_base = QCA956X_GPIO_REG_OUT_FUNC0; -+ else -+ BUG(); - -- reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4); -+ reg = reg_base + 4 * (gpio / 4); - s = 8 * (gpio % 4); - - t = __raw_readl(base + reg); diff --git a/target/linux/ar71xx/patches-4.14/740-MIPS-ath79-add-PCI-for-QCA953x-SoC.patch b/target/linux/ar71xx/patches-4.14/740-MIPS-ath79-add-PCI-for-QCA953x-SoC.patch deleted file mode 100644 index 1358fd391..000000000 --- a/target/linux/ar71xx/patches-4.14/740-MIPS-ath79-add-PCI-for-QCA953x-SoC.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/arch/mips/ath79/pci.c -+++ b/arch/mips/ath79/pci.c -@@ -53,6 +53,15 @@ static const struct ath79_pci_irq ar724x_pci_irq_map[] = { - } - }; - -+static const struct ath79_pci_irq qca953x_pci_irq_map[] = { -+ { -+ .bus = 0, -+ .slot = 0, -+ .pin = 1, -+ .irq = ATH79_PCI_IRQ(0), -+ }, -+}; -+ - static const struct ath79_pci_irq qca955x_pci_irq_map[] = { - { - .bus = 0, -@@ -98,6 +107,9 @@ int pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin) - soc_is_ar9344()) { - ath79_pci_irq_map = ar724x_pci_irq_map; - ath79_pci_nr_irqs = ARRAY_SIZE(ar724x_pci_irq_map); -+ } else if (soc_is_qca953x()) { -+ ath79_pci_irq_map = qca953x_pci_irq_map; -+ ath79_pci_nr_irqs = ARRAY_SIZE(qca953x_pci_irq_map); - } else if (soc_is_qca955x()) { - ath79_pci_irq_map = qca955x_pci_irq_map; - ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map); -@@ -303,6 +315,15 @@ int __init ath79_register_pci(void) - AR724X_PCI_MEM_SIZE, - 0, - ATH79_IP2_IRQ(0)); -+ } else if (soc_is_qca9533()) { -+ pdev = ath79_register_pci_ar724x(0, -+ QCA953X_PCI_CFG_BASE0, -+ QCA953X_PCI_CTRL_BASE0, -+ QCA953X_PCI_CRP_BASE0, -+ QCA953X_PCI_MEM_BASE0, -+ QCA953X_PCI_MEM_SIZE, -+ 0, -+ ATH79_IP2_IRQ(0)); - } else if (soc_is_qca9558()) { - pdev = ath79_register_pci_ar724x(0, - QCA955X_PCI_CFG_BASE0, diff --git a/target/linux/ar71xx/patches-4.14/741-MIPS-ath79-add-PCI-for-QCA9556-SoC.patch b/target/linux/ar71xx/patches-4.14/741-MIPS-ath79-add-PCI-for-QCA9556-SoC.patch deleted file mode 100644 index 5ca078425..000000000 --- a/target/linux/ar71xx/patches-4.14/741-MIPS-ath79-add-PCI-for-QCA9556-SoC.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/arch/mips/ath79/pci.c -+++ b/arch/mips/ath79/pci.c -@@ -324,7 +324,8 @@ int __init ath79_register_pci(void) - QCA953X_PCI_MEM_SIZE, - 0, - ATH79_IP2_IRQ(0)); -- } else if (soc_is_qca9558()) { -+ } else if (soc_is_qca9558() || -+ soc_is_qca9556()) { - pdev = ath79_register_pci_ar724x(0, - QCA955X_PCI_CFG_BASE0, - QCA955X_PCI_CTRL_BASE0, diff --git a/target/linux/ar71xx/patches-4.14/818-MIPS-ath79-add-nu801-led-driver.patch b/target/linux/ar71xx/patches-4.14/818-MIPS-ath79-add-nu801-led-driver.patch deleted file mode 100644 index a9e9cc2fc..000000000 --- a/target/linux/ar71xx/patches-4.14/818-MIPS-ath79-add-nu801-led-driver.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -632,6 +632,13 @@ config LEDS_IS31FL32XX - - comment "LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)" - -+config LEDS_NU801 -+ tristate "LED driver for NU801 RGB LED" -+ depends on LEDS_CLASS && (ATH79_MACH_MR18 || ATH79_MACH_Z1) -+ help -+ This option enables support for NU801 RGB LED driver chips -+ accessed via GPIO. -+ - config LEDS_BLINKM - tristate "LED support for the BlinkM I2C RGB LED" - depends on LEDS_CLASS ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -58,6 +58,7 @@ obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o - obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o - obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o - obj-$(CONFIG_LEDS_RB750) += leds-rb750.o -+obj-$(CONFIG_LEDS_NU801) += leds-nu801.o - obj-$(CONFIG_LEDS_NS2) += leds-ns2.o - obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o - obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o diff --git a/target/linux/ar71xx/patches-4.14/820-MIPS-ath79-add_gpio_function2_setup.patch b/target/linux/ar71xx/patches-4.14/820-MIPS-ath79-add_gpio_function2_setup.patch deleted file mode 100644 index 98fb1d826..000000000 --- a/target/linux/ar71xx/patches-4.14/820-MIPS-ath79-add_gpio_function2_setup.patch +++ /dev/null @@ -1,67 +0,0 @@ -Add access to the function2 gpio register. This probably has to be -converted into a pimux driver later on. This is needed for some setup -functions on the Arduino Yun. - ---- a/arch/mips/ath79/common.h -+++ b/arch/mips/ath79/common.h -@@ -29,6 +29,7 @@ void ath79_ddr_ctrl_init(void); - void ath79_gpio_function_enable(u32 mask); - void ath79_gpio_function_disable(u32 mask); - void ath79_gpio_function_setup(u32 set, u32 clear); -+void ath79_gpio_function2_setup(u32 set, u32 clear); - void ath79_gpio_output_select(unsigned gpio, u8 val); - int ath79_gpio_direction_select(unsigned gpio, bool oe); - void ath79_gpio_init(void); ---- a/arch/mips/ath79/gpio.c -+++ b/arch/mips/ath79/gpio.c -@@ -43,6 +43,31 @@ static void __iomem *ath79_gpio_get_function_reg(void) - return ath79_gpio_base + reg; - } - -+static void __iomem *ath79_gpio_get_function2_reg(void) -+{ -+ u32 reg = 0; -+ -+ if (soc_is_ar71xx() || -+ soc_is_ar724x() || -+ soc_is_ar913x() || -+ soc_is_ar933x()) -+ reg = AR71XX_GPIO_REG_FUNC_2; -+ else -+ BUG(); -+ -+ return ath79_gpio_base + reg; -+} -+ -+ -+void ath79_gpio_function2_setup(u32 set, u32 clear) -+{ -+ void __iomem *reg = ath79_gpio_get_function2_reg(); -+ -+ __raw_writel((__raw_readl(reg) & ~clear) | set, reg); -+ /* flush write */ -+ __raw_readl(reg); -+} -+ - void ath79_gpio_function_setup(u32 set, u32 clear) - { - void __iomem *reg = ath79_gpio_get_function_reg(); ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -862,6 +862,7 @@ - #define AR71XX_GPIO_REG_INT_PENDING 0x20 - #define AR71XX_GPIO_REG_INT_ENABLE 0x24 - #define AR71XX_GPIO_REG_FUNC 0x28 -+#define AR71XX_GPIO_REG_FUNC_2 0x30 - - #define AR934X_GPIO_REG_OUT_FUNC0 0x2c - #define AR934X_GPIO_REG_OUT_FUNC1 0x30 -@@ -986,6 +987,8 @@ - #define AR724X_GPIO_FUNC_UART_EN BIT(1) - #define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0) - -+#define AR933X_GPIO_FUNC2_JUMPSTART_DISABLE BIT(9) -+ - #define AR913X_GPIO_FUNC_WMAC_LED_EN BIT(22) - #define AR913X_GPIO_FUNC_EXP_PORT_CS_EN BIT(21) - #define AR913X_GPIO_FUNC_I2S_REFCLKEN BIT(20) diff --git a/target/linux/ar71xx/patches-4.14/900-mdio_bitbang_ignore_ta_value.patch b/target/linux/ar71xx/patches-4.14/900-mdio_bitbang_ignore_ta_value.patch deleted file mode 100644 index 8f8f349a6..000000000 --- a/target/linux/ar71xx/patches-4.14/900-mdio_bitbang_ignore_ta_value.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/drivers/net/phy/mdio-bitbang.c -+++ b/drivers/net/phy/mdio-bitbang.c -@@ -155,7 +155,7 @@ static int mdiobb_cmd_addr(struct mdiobb - static int mdiobb_read(struct mii_bus *bus, int phy, int reg) - { - struct mdiobb_ctrl *ctrl = bus->priv; -- int ret, i; -+ int ret; - - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); -@@ -165,19 +165,7 @@ static int mdiobb_read(struct mii_bus *b - - ctrl->ops->set_mdio_dir(ctrl, 0); - -- /* check the turnaround bit: the PHY should be driving it to zero, if this -- * PHY is listed in phy_ignore_ta_mask as having broken TA, skip that -- */ -- if (mdiobb_get_bit(ctrl) != 0 && -- !(bus->phy_ignore_ta_mask & (1 << phy))) { -- /* PHY didn't drive TA low -- flush any bits it -- * may be trying to send. -- */ -- for (i = 0; i < 32; i++) -- mdiobb_get_bit(ctrl); -- -- return 0xffff; -- } -+ mdiobb_get_bit(ctrl); - - ret = mdiobb_get_num(ctrl, 16); - mdiobb_get_bit(ctrl); diff --git a/target/linux/ar71xx/patches-4.14/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch b/target/linux/ar71xx/patches-4.14/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch deleted file mode 100644 index a830346a3..000000000 --- a/target/linux/ar71xx/patches-4.14/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 66e584435ac0de6e0abeb6d7166fe4fe25d6bb73 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 16 Jun 2015 13:15:08 +0200 -Subject: [PATCH] phy/mdio-bitbang: prevent rescheduling during command - -It seems some phys have some maximum timings for accessing the MDIO line, -resulting in bit errors under cpu stress. Prevent this from happening by -disabling interrupts when sending commands. - -Signed-off-by: Jonas Gorski ---- - drivers/net/phy/mdio-bitbang.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/net/phy/mdio-bitbang.c -+++ b/drivers/net/phy/mdio-bitbang.c -@@ -17,6 +17,7 @@ - * kind, whether express or implied. - */ - -+#include - #include - #include - #include -@@ -156,7 +157,9 @@ static int mdiobb_read(struct mii_bus *b - { - struct mdiobb_ctrl *ctrl = bus->priv; - int ret; -+ unsigned long flags; - -+ local_irq_save(flags); - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); - mdiobb_cmd(ctrl, MDIO_C45_READ, phy, reg); -@@ -169,13 +172,17 @@ static int mdiobb_read(struct mii_bus *b - - ret = mdiobb_get_num(ctrl, 16); - mdiobb_get_bit(ctrl); -+ local_irq_restore(flags); -+ - return ret; - } - - static int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val) - { - struct mdiobb_ctrl *ctrl = bus->priv; -+ unsigned long flags; - -+ local_irq_save(flags); - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); - mdiobb_cmd(ctrl, MDIO_C45_WRITE, phy, reg); -@@ -190,6 +197,8 @@ static int mdiobb_write(struct mii_bus * - - ctrl->ops->set_mdio_dir(ctrl, 0); - mdiobb_get_bit(ctrl); -+ local_irq_restore(flags); -+ - return 0; - } - diff --git a/target/linux/ar71xx/patches-4.14/902-at803x-add-reset-gpio-pdata.patch b/target/linux/ar71xx/patches-4.14/902-at803x-add-reset-gpio-pdata.patch deleted file mode 100644 index aace08c11..000000000 --- a/target/linux/ar71xx/patches-4.14/902-at803x-add-reset-gpio-pdata.patch +++ /dev/null @@ -1,68 +0,0 @@ -Add support for configuring AT803x GPIO reset via platform data. -This is necessary, because ath79 is not converted to device tree yet. - -Signed-off-by: Felix Fietkau - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -261,6 +261,7 @@ static int at803x_resume(struct phy_device *phydev) - - static int at803x_probe(struct phy_device *phydev) - { -+ struct at803x_platform_data *pdata; - struct device *dev = &phydev->mdio.dev; - struct at803x_priv *priv; - struct gpio_desc *gpiod_reset; -@@ -273,6 +274,12 @@ static int at803x_probe(struct phy_device *phydev) - phydev->drv->phy_id != ATH8032_PHY_ID) - goto does_not_require_reset_workaround; - -+ pdata = dev_get_platdata(dev); -+ if (pdata && pdata->has_reset_gpio) { -+ devm_gpio_request(dev, pdata->reset_gpio, "reset"); -+ gpio_direction_output(pdata->reset_gpio, 1); -+ } -+ - gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(gpiod_reset)) - return PTR_ERR(gpiod_reset); -@@ -404,15 +411,23 @@ static void at803x_link_change_notify(struct phy_device *phydev) - * cannot recover from by software. - */ - if (phydev->state == PHY_NOLINK) { -- if (priv->gpiod_reset && !priv->phy_reset) { -+ if ((priv->gpiod_reset || (pdata && pdata->has_reset_gpio)) && -+ !priv->phy_reset) { - struct at803x_context context; - - at803x_context_save(phydev, &context); - -- gpiod_set_value(priv->gpiod_reset, 1); -- msleep(1); -- gpiod_set_value(priv->gpiod_reset, 0); -- msleep(1); -+ if (pdata && pdata->has_reset_gpio) { -+ gpio_set_value_cansleep(pdata->reset_gpio, 0); -+ msleep(1); -+ gpio_set_value_cansleep(pdata->reset_gpio, 1); -+ msleep(1); -+ } else { -+ gpiod_set_value(priv->gpiod_reset, 1); -+ msleep(1); -+ gpiod_set_value(priv->gpiod_reset, 0); -+ msleep(1); -+ } - - at803x_context_restore(phydev, &context); - ---- a/include/linux/platform_data/phy-at803x.h -+++ b/include/linux/platform_data/phy-at803x.h -@@ -6,6 +6,8 @@ struct at803x_platform_data { - int enable_rgmii_tx_delay:1; - int enable_rgmii_rx_delay:1; - int fixup_rgmii_tx_delay:1; -+ int has_reset_gpio:1; -+ int reset_gpio; - }; - - #endif /* _PHY_AT803X_PDATA_H */ diff --git a/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch deleted file mode 100644 index 61eac6d45..000000000 --- a/target/linux/ar71xx/patches-4.14/910-unaligned_access_hacks.patch +++ /dev/null @@ -1,933 +0,0 @@ ---- a/arch/mips/include/asm/checksum.h -+++ b/arch/mips/include/asm/checksum.h -@@ -134,26 +134,30 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) - const unsigned int *stop = word + ihl; - unsigned int csum; - int carry; -+ unsigned int w; - -- csum = word[0]; -- csum += word[1]; -- carry = (csum < word[1]); -+ csum = net_hdr_word(word++); -+ -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- csum += word[2]; -- carry = (csum < word[2]); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- csum += word[3]; -- carry = (csum < word[3]); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- word += 4; - do { -- csum += *word; -- carry = (csum < *word); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; -- word++; - } while (word != stop); - - return csum_fold(csum); -@@ -214,73 +218,6 @@ static inline __sum16 ip_compute_csum(const void *buff, int len) - return csum_fold(csum_partial(buff, len, 0)); - } - --#define _HAVE_ARCH_IPV6_CSUM --static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, -- const struct in6_addr *daddr, -- __u32 len, __u8 proto, -- __wsum sum) --{ -- __wsum tmp; -- -- __asm__( -- " .set push # csum_ipv6_magic\n" -- " .set noreorder \n" -- " .set noat \n" -- " addu %0, %5 # proto (long in network byte order)\n" -- " sltu $1, %0, %5 \n" -- " addu %0, $1 \n" -- -- " addu %0, %6 # csum\n" -- " sltu $1, %0, %6 \n" -- " lw %1, 0(%2) # four words source address\n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 4(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 8(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 12(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 0(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 4(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 8(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 12(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " addu %0, $1 # Add final carry\n" -- " .set pop" -- : "=&r" (sum), "=&r" (tmp) -- : "r" (saddr), "r" (daddr), -- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); -- -- return csum_fold(sum); --} -- - #include - #endif /* CONFIG_GENERIC_CSUM */ - ---- a/drivers/net/vxlan.c -+++ b/drivers/net/vxlan.c -@@ -1824,15 +1824,15 @@ static int vxlan_build_skb(struct sk_buff *skb, struct dst_entry *dst, - return err; - - vxh = __skb_push(skb, sizeof(*vxh)); -- vxh->vx_flags = VXLAN_HF_VNI; -- vxh->vx_vni = vxlan_vni_field(vni); -+ net_hdr_word(&vxh->vx_flags) = VXLAN_HF_VNI; -+ net_hdr_word(&vxh->vx_vni) = vxlan_vni_field(vni); - - if (type & SKB_GSO_TUNNEL_REMCSUM) { - unsigned int start; - - start = skb_checksum_start_offset(skb) - sizeof(struct vxlanhdr); -- vxh->vx_vni |= vxlan_compute_rco(start, skb->csum_offset); -- vxh->vx_flags |= VXLAN_HF_RCO; -+ net_hdr_word(&vxh->vx_vni) |= vxlan_compute_rco(start, skb->csum_offset); -+ net_hdr_word(&vxh->vx_flags) |= VXLAN_HF_RCO; - - if (!skb_is_gso(skb)) { - skb->ip_summed = CHECKSUM_NONE; ---- a/include/linux/etherdevice.h -+++ b/include/linux/etherdevice.h -@@ -480,7 +480,7 @@ static inline bool is_etherdev_addr(const struct net_device *dev, - * @b: Pointer to Ethernet header - * - * Compare two Ethernet headers, returns 0 if equal. -- * This assumes that the network header (i.e., IP header) is 4-byte -+ * This assumes that the network header (i.e., IP header) is 2-byte - * aligned OR the platform can handle unaligned access. This is the - * case for all packets coming into netif_receive_skb or similar - * entry points. -@@ -503,11 +503,12 @@ static inline unsigned long compare_ether_header(const void *a, const void *b) - fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); - return fold; - #else -- u32 *a32 = (u32 *)((u8 *)a + 2); -- u32 *b32 = (u32 *)((u8 *)b + 2); -+ const u16 *a16 = a; -+ const u16 *b16 = b; - -- return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) | -- (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]); -+ return (a16[0] ^ b16[0]) | (a16[1] ^ b16[1]) | (a16[2] ^ b16[2]) | -+ (a16[3] ^ b16[3]) | (a16[4] ^ b16[4]) | (a16[5] ^ b16[5]) | -+ (a16[6] ^ b16[6]); - #endif - } - ---- a/include/linux/ipv6.h -+++ b/include/linux/ipv6.h -@@ -6,6 +6,7 @@ - - #define ipv6_optlen(p) (((p)->hdrlen+1) << 3) - #define ipv6_authlen(p) (((p)->hdrlen+2) << 2) -+ - /* - * This structure contains configuration options per IPv6 link. - */ ---- a/include/linux/types.h -+++ b/include/linux/types.h -@@ -229,5 +229,11 @@ struct callback_head { - typedef void (*rcu_callback_t)(struct rcu_head *head); - typedef void (*call_rcu_func_t)(struct rcu_head *head, rcu_callback_t func); - -+struct net_hdr_word { -+ u32 words[1]; -+} __attribute__((packed, aligned(2))); -+ -+#define net_hdr_word(_p) (((struct net_hdr_word *) (_p))->words[0]) -+ - #endif /* __ASSEMBLY__ */ - #endif /* _LINUX_TYPES_H */ ---- a/include/net/addrconf.h -+++ b/include/net/addrconf.h -@@ -47,7 +47,7 @@ struct prefix_info { - __be32 reserved2; - - struct in6_addr prefix; --}; -+} __attribute__((packed, aligned(2))); - - #include - #include ---- a/include/net/inet_ecn.h -+++ b/include/net/inet_ecn.h -@@ -125,9 +125,9 @@ static inline int IP6_ECN_set_ce(struct sk_buff *skb, struct ipv6hdr *iph) - if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) - return 0; - -- from = *(__be32 *)iph; -+ from = net_hdr_word(iph); - to = from | htonl(INET_ECN_CE << 20); -- *(__be32 *)iph = to; -+ net_hdr_word(iph) = to; - if (skb->ip_summed == CHECKSUM_COMPLETE) - skb->csum = csum_add(csum_sub(skb->csum, (__force __wsum)from), - (__force __wsum)to); -@@ -136,7 +136,7 @@ static inline int IP6_ECN_set_ce(struct sk_buff *skb, struct ipv6hdr *iph) - - static inline void IP6_ECN_clear(struct ipv6hdr *iph) - { -- *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); -+ net_hdr_word(iph) &= ~htonl(INET_ECN_MASK << 20); - } - - static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner) ---- a/include/net/ipv6.h -+++ b/include/net/ipv6.h -@@ -108,7 +108,7 @@ struct frag_hdr { - __u8 reserved; - __be16 frag_off; - __be32 identification; --}; -+} __attribute__((packed, aligned(2))); - - #define IP6_MF 0x0001 - #define IP6_OFFSET 0xFFF8 -@@ -451,8 +451,8 @@ static inline void __ipv6_addr_set_half(__be32 *addr, - } - #endif - #endif -- addr[0] = wh; -- addr[1] = wl; -+ net_hdr_word(&addr[0]) = wh; -+ net_hdr_word(&addr[1]) = wl; - } - - static inline void ipv6_addr_set(struct in6_addr *addr, -@@ -511,6 +511,8 @@ static inline bool ipv6_prefix_equal(const struct in6_addr *addr1, - const __be32 *a1 = addr1->s6_addr32; - const __be32 *a2 = addr2->s6_addr32; - unsigned int pdw, pbi; -+ /* Used for last <32-bit fraction of prefix */ -+ u32 pbia1, pbia2; - - /* check complete u32 in prefix */ - pdw = prefixlen >> 5; -@@ -519,7 +521,9 @@ static inline bool ipv6_prefix_equal(const struct in6_addr *addr1, - - /* check incomplete u32 in prefix */ - pbi = prefixlen & 0x1f; -- if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) -+ pbia1 = net_hdr_word(&a1[pdw]); -+ pbia2 = net_hdr_word(&a2[pdw]); -+ if (pbi && ((pbia1 ^ pbia2) & htonl((0xffffffff) << (32 - pbi)))) - return false; - - return true; -@@ -663,13 +667,13 @@ static inline void ipv6_addr_set_v4mapped(const __be32 addr, - */ - static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) - { -- const __be32 *a1 = token1, *a2 = token2; -+ const struct in6_addr *a1 = token1, *a2 = token2; - int i; - - addrlen >>= 2; - - for (i = 0; i < addrlen; i++) { -- __be32 xb = a1[i] ^ a2[i]; -+ __be32 xb = a1->s6_addr32[i] ^ a2->s6_addr32[i]; - if (xb) - return i * 32 + 31 - __fls(ntohl(xb)); - } -@@ -838,17 +842,18 @@ static inline int ip6_default_np_autolabel(struct net *net) - static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, - __be32 flowlabel) - { -- *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | flowlabel; -+ net_hdr_word((__be32 *)hdr) = -+ htonl(0x60000000 | (tclass << 20)) | flowlabel; - } - - static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr) - { -- return *(__be32 *)hdr & IPV6_FLOWINFO_MASK; -+ return net_hdr_word((__be32 *)hdr) & IPV6_FLOWINFO_MASK; - } - - static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr) - { -- return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK; -+ return net_hdr_word((__be32 *)hdr) & IPV6_FLOWLABEL_MASK; - } - - static inline u8 ip6_tclass(__be32 flowinfo) ---- a/include/net/ndisc.h -+++ b/include/net/ndisc.h -@@ -89,7 +89,7 @@ struct ra_msg { - struct icmp6hdr icmph; - __be32 reachable_time; - __be32 retrans_timer; --}; -+} __attribute__((packed, aligned(2))); - - struct rd_msg { - struct icmp6hdr icmph; -@@ -368,10 +368,10 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _ - { - const u32 *p32 = pkey; - -- return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) + -- (p32[1] * hash_rnd[1]) + -- (p32[2] * hash_rnd[2]) + -- (p32[3] * hash_rnd[3])); -+ return (((net_hdr_word(&p32[0]) ^ hash32_ptr(dev)) * hash_rnd[0]) + -+ (net_hdr_word(&p32[1]) * hash_rnd[1]) + -+ (net_hdr_word(&p32[2]) * hash_rnd[2]) + -+ (net_hdr_word(&p32[3]) * hash_rnd[3])); - } - - static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) ---- a/include/net/neighbour.h -+++ b/include/net/neighbour.h -@@ -265,8 +265,10 @@ static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey) - const u32 *n32 = (const u32 *)n->primary_key; - const u32 *p32 = pkey; - -- return ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) | -- (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0; -+ return ((n32[0] ^ net_hdr_word(&p32[0])) | -+ (n32[1] ^ net_hdr_word(&p32[1])) | -+ (n32[2] ^ net_hdr_word(&p32[2])) | -+ (n32[3] ^ net_hdr_word(&p32[3]))) == 0; - } - - static inline struct neighbour *___neigh_lookup_noref( ---- a/include/net/secure_seq.h -+++ b/include/net/secure_seq.h -@@ -3,6 +3,7 @@ - #define _NET_SECURE_SEQ - - #include -+#include - - u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); - u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, ---- a/include/uapi/linux/icmp.h -+++ b/include/uapi/linux/icmp.h -@@ -82,7 +82,7 @@ struct icmphdr { - } frag; - __u8 reserved[4]; - } un; --}; -+} __attribute__((packed, aligned(2))); - - - /* ---- a/include/uapi/linux/icmpv6.h -+++ b/include/uapi/linux/icmpv6.h -@@ -77,7 +77,7 @@ struct icmp6hdr { - #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other - #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime - #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref --}; -+} __attribute__((packed, aligned(2))); - - - #define ICMPV6_ROUTER_PREF_LOW 0x3 ---- a/include/uapi/linux/if_pppox.h -+++ b/include/uapi/linux/if_pppox.h -@@ -51,6 +51,7 @@ struct pppoe_addr { - */ - struct pptp_addr { - __u16 call_id; -+ __u16 pad; - struct in_addr sin_addr; - }; - ---- a/include/uapi/linux/igmp.h -+++ b/include/uapi/linux/igmp.h -@@ -33,7 +33,7 @@ struct igmphdr { - __u8 code; /* For newer IGMP */ - __sum16 csum; - __be32 group; --}; -+} __attribute__((packed, aligned(2))); - - /* V3 group record types [grec_type] */ - #define IGMPV3_MODE_IS_INCLUDE 1 -@@ -49,7 +49,7 @@ struct igmpv3_grec { - __be16 grec_nsrcs; - __be32 grec_mca; - __be32 grec_src[0]; --}; -+} __attribute__((packed, aligned(2))); - - struct igmpv3_report { - __u8 type; -@@ -58,7 +58,7 @@ struct igmpv3_report { - __be16 resv2; - __be16 ngrec; - struct igmpv3_grec grec[0]; --}; -+} __attribute__((packed, aligned(2))); - - struct igmpv3_query { - __u8 type; -@@ -79,7 +79,7 @@ struct igmpv3_query { - __u8 qqic; - __be16 nsrcs; - __be32 srcs[0]; --}; -+} __attribute__((packed, aligned(2))); - - #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ - #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ ---- a/include/uapi/linux/in.h -+++ b/include/uapi/linux/in.h -@@ -84,7 +84,7 @@ enum { - /* Internet address. */ - struct in_addr { - __be32 s_addr; --}; -+} __attribute__((packed, aligned(2))); - #endif - - #define IP_TOS 1 ---- a/include/uapi/linux/in6.h -+++ b/include/uapi/linux/in6.h -@@ -43,7 +43,7 @@ struct in6_addr { - #define s6_addr16 in6_u.u6_addr16 - #define s6_addr32 in6_u.u6_addr32 - #endif --}; -+} __attribute__((packed, aligned(2))); - #endif /* __UAPI_DEF_IN6_ADDR */ - - #if __UAPI_DEF_SOCKADDR_IN6 ---- a/include/uapi/linux/ip.h -+++ b/include/uapi/linux/ip.h -@@ -103,7 +103,7 @@ struct iphdr { - __be32 saddr; - __be32 daddr; - /*The options start here. */ --}; -+} __attribute__((packed, aligned(2))); - - - struct ip_auth_hdr { ---- a/include/uapi/linux/ipv6.h -+++ b/include/uapi/linux/ipv6.h -@@ -131,7 +131,7 @@ struct ipv6hdr { - - struct in6_addr saddr; - struct in6_addr daddr; --}; -+} __attribute__((packed, aligned(2))); - - - /* index values for the variables in ipv6_devconf */ ---- a/include/uapi/linux/netfilter_arp/arp_tables.h -+++ b/include/uapi/linux/netfilter_arp/arp_tables.h -@@ -70,7 +70,7 @@ struct arpt_arp { - __u8 flags; - /* Inverse flags */ - __u16 invflags; --}; -+} __attribute__((aligned(4))); - - /* Values for "flag" field in struct arpt_ip (general arp structure). - * No flags defined yet. ---- a/include/uapi/linux/tcp.h -+++ b/include/uapi/linux/tcp.h -@@ -55,7 +55,7 @@ struct tcphdr { - __be16 window; - __sum16 check; - __be16 urg_ptr; --}; -+} __attribute__((packed, aligned(2))); - - /* - * The union cast uses a gcc extension to avoid aliasing problems -@@ -65,7 +65,7 @@ struct tcphdr { - union tcp_word_hdr { - struct tcphdr hdr; - __be32 words[5]; --}; -+} __attribute__((packed, aligned(2))); - - #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) - ---- a/include/uapi/linux/udp.h -+++ b/include/uapi/linux/udp.h -@@ -25,7 +25,7 @@ struct udphdr { - __be16 dest; - __be16 len; - __sum16 check; --}; -+} __attribute__((packed, aligned(2))); - - /* UDP socket options */ - #define UDP_CORK 1 /* Never send partially complete segments */ ---- a/net/core/flow_dissector.c -+++ b/net/core/flow_dissector.c -@@ -108,7 +108,7 @@ __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto, - ports = __skb_header_pointer(skb, thoff + poff, - sizeof(_ports), data, hlen, &_ports); - if (ports) -- return *ports; -+ return (__be32)net_hdr_word(ports); - } - - return 0; ---- a/net/core/utils.c -+++ b/net/core/utils.c -@@ -424,8 +424,14 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, - bool pseudohdr) - { - __be32 diff[] = { -- ~from[0], ~from[1], ~from[2], ~from[3], -- to[0], to[1], to[2], to[3], -+ ~net_hdr_word(&from[0]), -+ ~net_hdr_word(&from[1]), -+ ~net_hdr_word(&from[2]), -+ ~net_hdr_word(&from[3]), -+ net_hdr_word(&to[0]), -+ net_hdr_word(&to[1]), -+ net_hdr_word(&to[2]), -+ net_hdr_word(&to[3]), - }; - if (skb->ip_summed != CHECKSUM_PARTIAL) { - *sum = csum_fold(csum_partial(diff, sizeof(diff), ---- a/net/ipv4/af_inet.c -+++ b/net/ipv4/af_inet.c -@@ -1351,8 +1351,8 @@ struct sk_buff **inet_gro_receive(struct sk_buff **head, struct sk_buff *skb) - if (unlikely(ip_fast_csum((u8 *)iph, 5))) - goto out_unlock; - -- id = ntohl(*(__be32 *)&iph->id); -- flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF)); -+ id = ntohl(net_hdr_word(&iph->id)); -+ flush = (u16)((ntohl(net_hdr_word(iph)) ^ skb_gro_len(skb)) | (id & ~IP_DF)); - id >>= 16; - - for (p = *head; p; p = p->next) { ---- a/net/ipv4/igmp.c -+++ b/net/ipv4/igmp.c -@@ -537,7 +537,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, - if (!skb) - return NULL; - psrc = skb_put(skb, sizeof(__be32)); -- *psrc = psf->sf_inaddr; -+ net_hdr_word(psrc) = psf->sf_inaddr; - scount++; stotal++; - if ((type == IGMPV3_ALLOW_NEW_SOURCES || - type == IGMPV3_BLOCK_OLD_SOURCES) && psf->sf_crcount) { ---- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c -+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c -@@ -48,8 +48,8 @@ static bool ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, - if (ap == NULL) - return false; - -- tuple->src.u3.ip = ap[0]; -- tuple->dst.u3.ip = ap[1]; -+ tuple->src.u3.ip = net_hdr_word(ap++); -+ tuple->dst.u3.ip = net_hdr_word(ap); - - return true; - } ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -465,7 +465,7 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, - else if (skb) - pkey = &ip_hdr(skb)->daddr; - -- n = __ipv4_neigh_lookup(dev, *(__force u32 *)pkey); -+ n = __ipv4_neigh_lookup(dev, net_hdr_word(pkey)); - if (n) - return n; - return neigh_create(&arp_tbl, pkey, dev); ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -3844,14 +3844,16 @@ static bool tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr - { - const __be32 *ptr = (const __be32 *)(th + 1); - -- if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) -- | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { -+ if (net_hdr_word(ptr) == -+ htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { - tp->rx_opt.saw_tstamp = 1; - ++ptr; -- tp->rx_opt.rcv_tsval = ntohl(*ptr); -+ tp->rx_opt.rcv_tsval = get_unaligned_be32(ptr); - ++ptr; -- if (*ptr) -- tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset; -+ if (net_hdr_word(ptr)) -+ tp->rx_opt.rcv_tsecr = get_unaligned_be32(ptr) - -+ tp->tsoffset; - else - tp->rx_opt.rcv_tsecr = 0; - return true; ---- a/net/ipv4/tcp_offload.c -+++ b/net/ipv4/tcp_offload.c -@@ -226,7 +226,7 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb) - - th2 = tcp_hdr(p); - -- if (*(u32 *)&th->source ^ *(u32 *)&th2->source) { -+ if (net_hdr_word(&th->source) ^ net_hdr_word(&th2->source)) { - NAPI_GRO_CB(p)->same_flow = 0; - continue; - } -@@ -244,8 +244,8 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb) - ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH)); - flush |= (__force int)(th->ack_seq ^ th2->ack_seq); - for (i = sizeof(*th); i < thlen; i += 4) -- flush |= *(u32 *)((u8 *)th + i) ^ -- *(u32 *)((u8 *)th2 + i); -+ flush |= net_hdr_word((u8 *)th + i) ^ -+ net_hdr_word((u8 *)th2 + i); - - /* When we receive our second frame we can made a decision on if we - * continue this flow as an atomic flow with a fixed ID or if we use ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -449,48 +449,53 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, - u16 options = opts->options; /* mungable copy */ - - if (unlikely(OPTION_MD5 & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -- (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); - /* overload cookie hash location */ - opts->hash_location = (__u8 *)ptr; - ptr += 4; - } - - if (unlikely(opts->mss)) { -- *ptr++ = htonl((TCPOPT_MSS << 24) | -- (TCPOLEN_MSS << 16) | -- opts->mss); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | -+ opts->mss); - } - - if (likely(OPTION_TS & options)) { - if (unlikely(OPTION_SACK_ADVERTISE & options)) { -- *ptr++ = htonl((TCPOPT_SACK_PERM << 24) | -- (TCPOLEN_SACK_PERM << 16) | -- (TCPOPT_TIMESTAMP << 8) | -- TCPOLEN_TIMESTAMP); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_SACK_PERM << 24) | -+ (TCPOLEN_SACK_PERM << 16) | -+ (TCPOPT_TIMESTAMP << 8) | -+ TCPOLEN_TIMESTAMP); - options &= ~OPTION_SACK_ADVERTISE; - } else { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_TIMESTAMP << 8) | -- TCPOLEN_TIMESTAMP); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | -+ TCPOLEN_TIMESTAMP); - } -- *ptr++ = htonl(opts->tsval); -- *ptr++ = htonl(opts->tsecr); -+ net_hdr_word(ptr++) = htonl(opts->tsval); -+ net_hdr_word(ptr++) = htonl(opts->tsecr); - } - - if (unlikely(OPTION_SACK_ADVERTISE & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_SACK_PERM << 8) | -- TCPOLEN_SACK_PERM); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_SACK_PERM << 8) | -+ TCPOLEN_SACK_PERM); - } - - if (unlikely(OPTION_WSCALE & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_WINDOW << 16) | -- (TCPOLEN_WINDOW << 8) | -- opts->ws); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_WINDOW << 16) | -+ (TCPOLEN_WINDOW << 8) | -+ opts->ws); - } - - if (unlikely(opts->num_sack_blocks)) { -@@ -498,16 +503,17 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, - tp->duplicate_sack : tp->selective_acks; - int this_sack; - -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_SACK << 8) | -- (TCPOLEN_SACK_BASE + (opts->num_sack_blocks * -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_SACK << 8) | -+ (TCPOLEN_SACK_BASE + (opts->num_sack_blocks * - TCPOLEN_SACK_PERBLOCK))); - - for (this_sack = 0; this_sack < opts->num_sack_blocks; - ++this_sack) { -- *ptr++ = htonl(sp[this_sack].start_seq); -- *ptr++ = htonl(sp[this_sack].end_seq); -+ net_hdr_word(ptr++) = htonl(sp[this_sack].start_seq); -+ net_hdr_word(ptr++) = htonl(sp[this_sack].end_seq); - } - - tp->rx_opt.dsack = 0; -@@ -520,13 +526,14 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, - - if (foc->exp) { - len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; -- *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) | -+ net_hdr_word(ptr) = -+ htonl((TCPOPT_EXP << 24) | (len << 16) | - TCPOPT_FASTOPEN_MAGIC); - p += TCPOLEN_EXP_FASTOPEN_BASE; - } else { - len = TCPOLEN_FASTOPEN_BASE + foc->len; -- *p++ = TCPOPT_FASTOPEN; -- *p++ = len; -+ net_hdr_word(p++) = TCPOPT_FASTOPEN; -+ net_hdr_word(p++) = len; - } - - memcpy(p, foc->val, foc->len); ---- a/net/ipv6/datagram.c -+++ b/net/ipv6/datagram.c -@@ -485,7 +485,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) - ipv6_iface_scope_id(&sin->sin6_addr, - IP6CB(skb)->iif); - } else { -- ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset), -+ ipv6_addr_set_v4mapped(net_hdr_word(nh + serr->addr_offset), - &sin->sin6_addr); - sin->sin6_scope_id = 0; - } -@@ -833,12 +833,12 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk, - } - - if (fl6->flowlabel&IPV6_FLOWINFO_MASK) { -- if ((fl6->flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) { -+ if ((fl6->flowlabel^net_hdr_word(CMSG_DATA(cmsg)))&~IPV6_FLOWINFO_MASK) { - err = -EINVAL; - goto exit_f; - } - } -- fl6->flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg); -+ fl6->flowlabel = IPV6_FLOWINFO_MASK & net_hdr_word(CMSG_DATA(cmsg)); - break; - - case IPV6_2292HOPOPTS: ---- a/net/ipv6/exthdrs.c -+++ b/net/ipv6/exthdrs.c -@@ -733,7 +733,7 @@ static bool ipv6_hop_jumbo(struct sk_buff *skb, int optoff) - goto drop; - } - -- pkt_len = ntohl(*(__be32 *)(nh + optoff + 2)); -+ pkt_len = ntohl(net_hdr_word(nh + optoff + 2)); - if (pkt_len <= IPV6_MAXPLEN) { - __IP6_INC_STATS(net, ipv6_skb_idev(skb), - IPSTATS_MIB_INHDRERRORS); ---- a/net/ipv6/ip6_fib.c -+++ b/net/ipv6/ip6_fib.c -@@ -137,7 +137,7 @@ static __be32 addr_bit_set(const void *token, int fn_bit) - * See include/asm-generic/bitops/le.h. - */ - return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) & -- addr[fn_bit >> 5]; -+ net_hdr_word(&addr[fn_bit >> 5]); - } - - static struct fib6_node *node_alloc(void) ---- a/net/ipv6/ip6_gre.c -+++ b/net/ipv6/ip6_gre.c -@@ -397,7 +397,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, - return; - ipv6h = (const struct ipv6hdr *)skb->data; - greh = (const struct gre_base_hdr *)(skb->data + offset); -- key = key_off ? *(__be32 *)(skb->data + key_off) : 0; -+ key = key_off ? net_hdr_word((__be32 *)(skb->data + key_off)) : 0; - - t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr, - key, greh->protocol); ---- a/net/ipv6/ip6_offload.c -+++ b/net/ipv6/ip6_offload.c -@@ -220,7 +220,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head, - continue; - - iph2 = (struct ipv6hdr *)(p->data + off); -- first_word = *(__be32 *)iph ^ *(__be32 *)iph2; -+ first_word = net_hdr_word(iph) ^ net_hdr_word(iph2); - - /* All fields must match except length and Traffic Class. - * XXX skbs on the gro_list have all been parsed and pulled ---- a/net/ipv6/netfilter/ip6table_mangle.c -+++ b/net/ipv6/netfilter/ip6table_mangle.c -@@ -50,7 +50,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state) - hop_limit = ipv6_hdr(skb)->hop_limit; - - /* flowlabel and prio (includes version, which shouldn't change either */ -- flowlabel = *((u_int32_t *)ipv6_hdr(skb)); -+ flowlabel = net_hdr_word(ipv6_hdr(skb)); - - ret = ip6t_do_table(skb, state, state->net->ipv6.ip6table_mangle); - -@@ -59,7 +59,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state) - !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) || - skb->mark != mark || - ipv6_hdr(skb)->hop_limit != hop_limit || -- flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { -+ flowlabel != net_hdr_word(ipv6_hdr(skb)))) { - err = ip6_route_me_harder(state->net, skb); - if (err < 0) - ret = NF_DROP_ERR(err); ---- a/net/ipv6/netfilter/nf_log_ipv6.c -+++ b/net/ipv6/netfilter/nf_log_ipv6.c -@@ -66,9 +66,9 @@ static void dump_ipv6_packet(struct nf_log_buf *m, - /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */ - nf_log_buf_add(m, "LEN=%zu TC=%u HOPLIMIT=%u FLOWLBL=%u ", - ntohs(ih->payload_len) + sizeof(struct ipv6hdr), -- (ntohl(*(__be32 *)ih) & 0x0ff00000) >> 20, -+ (ntohl(net_hdr_word(ih)) & 0x0ff00000) >> 20, - ih->hop_limit, -- (ntohl(*(__be32 *)ih) & 0x000fffff)); -+ (ntohl(net_hdr_word(ih)) & 0x000fffff)); - - fragment = 0; - ptr = ip6hoff + sizeof(struct ipv6hdr); ---- a/net/ipv6/tcp_ipv6.c -+++ b/net/ipv6/tcp_ipv6.c -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -819,10 +820,10 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 - topt = (__be32 *)(t1 + 1); - - if (tsecr) { -- *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -- (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); -- *topt++ = htonl(tsval); -- *topt++ = htonl(tsecr); -+ put_unaligned_be32((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP, topt++); -+ put_unaligned_be32(tsval, topt++); -+ put_unaligned_be32(tsecr, topt++); - } - - #ifdef CONFIG_TCP_MD5SIG ---- a/net/netfilter/nf_conntrack_proto_tcp.c -+++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -448,7 +448,7 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff, - - /* Fast path for timestamp-only option */ - if (length == TCPOLEN_TSTAMP_ALIGNED -- && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24) -+ && net_hdr_word(ptr) == htonl((TCPOPT_NOP << 24) - | (TCPOPT_NOP << 16) - | (TCPOPT_TIMESTAMP << 8) - | TCPOLEN_TIMESTAMP)) ---- a/net/sched/cls_u32.c -+++ b/net/sched/cls_u32.c -@@ -165,7 +165,7 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, - data = skb_header_pointer(skb, toff, 4, &hdata); - if (!data) - goto out; -- if ((*data ^ key->val) & key->mask) { -+ if ((net_hdr_word(data) ^ key->val) & key->mask) { - n = rcu_dereference_bh(n->next); - goto next_knode; - } -@@ -218,8 +218,8 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, - &hdata); - if (!data) - goto out; -- sel = ht->divisor & u32_hash_fold(*data, &n->sel, -- n->fshift); -+ sel = ht->divisor & u32_hash_fold(net_hdr_word(data), -+ &n->sel, n->fshift); - } - if (!(n->sel.flags & (TC_U32_VAROFFSET | TC_U32_OFFSET | TC_U32_EAT))) - goto next_ht; ---- a/net/xfrm/xfrm_input.c -+++ b/net/xfrm/xfrm_input.c -@@ -193,8 +193,8 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq) - if (!pskb_may_pull(skb, hlen)) - return -EINVAL; - -- *spi = *(__be32 *)(skb_transport_header(skb) + offset); -- *seq = *(__be32 *)(skb_transport_header(skb) + offset_seq); -+ *spi = net_hdr_word(skb_transport_header(skb) + offset); -+ *seq = net_hdr_word(skb_transport_header(skb) + offset_seq); - return 0; - } - EXPORT_SYMBOL(xfrm_parse_spi); diff --git a/target/linux/ar71xx/patches-4.14/920-usb-chipidea-AR933x-platform-support.patch b/target/linux/ar71xx/patches-4.14/920-usb-chipidea-AR933x-platform-support.patch deleted file mode 100644 index 175330837..000000000 --- a/target/linux/ar71xx/patches-4.14/920-usb-chipidea-AR933x-platform-support.patch +++ /dev/null @@ -1,128 +0,0 @@ -diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c -index 2558f973..c2872ab3 100644 ---- a/arch/mips/ath79/dev-usb.c -+++ b/arch/mips/ath79/dev-usb.c -@@ -19,6 +19,9 @@ - #include - #include - #include -+#include -+#include -+#include - - #include - #include -@@ -170,6 +173,44 @@ static void __init ar913x_usb_setup(void) - &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); - } - -+static void __init ar9xxx_ci_usb_setup(int bus_id, int irq) -+{ -+ struct ci_hdrc_platform_data ci_pdata; -+ bool host_mode = true; -+ -+ if (soc_is_ar933x()) -+ host_mode = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP) & -+ AR933X_BOOTSTRAP_USB_MODE_HOST; -+ else -+ host_mode = !(ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP) & -+ AR934X_BOOTSTRAP_USB_MODE_DEVICE); -+ -+ if (host_mode) { -+ ath79_usb_register("ehci-platform", bus_id, -+ AR934X_EHCI_BASE, AR934X_EHCI_SIZE, -+ irq, &ath79_ehci_pdata_v2, -+ sizeof(ath79_ehci_pdata_v2)); -+ -+ return; -+ } -+ -+ memset(&ci_pdata, 0, sizeof(ci_pdata)); -+ ci_pdata.name = "ci_hdrc_ar9xxx"; -+ ci_pdata.capoffset = DEF_CAPOFFSET; -+ ci_pdata.dr_mode = USB_DR_MODE_PERIPHERAL; -+ ci_pdata.flags = CI_HDRC_DUAL_ROLE_NOT_OTG | CI_HDRC_DP_ALWAYS_PULLUP; -+ ci_pdata.vbus_extcon.edev = ERR_PTR(-ENODEV); -+ ci_pdata.id_extcon.edev = ERR_PTR(-ENODEV); -+ ci_pdata.itc_setting = 1; -+ -+ platform_device_register_simple("usb_phy_generic", -+ PLATFORM_DEVID_AUTO, NULL, 0); -+ -+ ath79_usb_register("ci_hdrc", -1, -+ AR934X_EHCI_BASE, AR934X_EHCI_SIZE, -+ irq, &ci_pdata, sizeof(ci_pdata)); -+} -+ - static void __init ar933x_usb_setup(void) - { - ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE); -@@ -181,10 +222,7 @@ static void __init ar933x_usb_setup(void) - ath79_device_reset_clear(AR933X_RESET_USB_PHY); - mdelay(10); - -- ath79_usb_register("ehci-platform", -1, -- AR933X_EHCI_BASE, AR933X_EHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); -+ ar9xxx_ci_usb_setup(-1, ATH79_CPU_IRQ(3)); - } - - static void enable_tx_tx_idp_violation_fix(unsigned base) -@@ -230,10 +268,7 @@ static void __init ar934x_usb_setup(void) - if (ath79_soc_rev >= 3) - ath79_ehci_pdata_v2.reset_notifier = ar934x_usb_reset_notifier; - -- ath79_usb_register("ehci-platform", -1, -- AR934X_EHCI_BASE, AR934X_EHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); -+ ar9xxx_ci_usb_setup(-1, ATH79_CPU_IRQ(3)); - } - - static void __init qca953x_usb_setup(void) -@@ -254,10 +289,7 @@ static void __init qca953x_usb_setup(void) - ath79_device_reset_clear(QCA953X_RESET_USB_HOST); - udelay(1000); - -- ath79_usb_register("ehci-platform", -1, -- QCA953X_EHCI_BASE, QCA953X_EHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); -+ ar9xxx_ci_usb_setup(-1, ATH79_CPU_IRQ(3)); - } - - static void qca955x_usb_reset_notifier(struct platform_device *pdev) -@@ -285,10 +317,7 @@ static void __init qca955x_usb_setup(void) - { - ath79_ehci_pdata_v2.reset_notifier = qca955x_usb_reset_notifier; - -- ath79_usb_register("ehci-platform", 0, -- QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE, -- ATH79_IP3_IRQ(0), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); -+ ar9xxx_ci_usb_setup(0, ATH79_IP3_IRQ(0)); - - ath79_usb_register("ehci-platform", 1, - QCA955X_EHCI1_BASE, QCA955X_EHCI_SIZE, -diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -index 70c8e657..c275e12e 100644 ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -656,6 +656,7 @@ - - #define AR933X_BOOTSTRAP_MDIO_GPIO_EN BIT(18) - #define AR933X_BOOTSTRAP_EEPBUSY BIT(4) -+#define AR933X_BOOTSTRAP_USB_MODE_HOST BIT(3) - #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0) - - #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23) -@@ -685,6 +686,8 @@ - - #define QCA956X_BOOTSTRAP_REF_CLK_40 BIT(2) - -+#define AR933X_USB_CONFIG_HOST_ONLY BIT(8) -+ - #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) - #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1) - #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) diff --git a/target/linux/ar71xx/patches-4.14/921-MIPS-ath79-add-even-more-register-defines-for-QCA956x-SoC.patch b/target/linux/ar71xx/patches-4.14/921-MIPS-ath79-add-even-more-register-defines-for-QCA956x-SoC.patch deleted file mode 100644 index 1c0f18e31..000000000 --- a/target/linux/ar71xx/patches-4.14/921-MIPS-ath79-add-even-more-register-defines-for-QCA956x-SoC.patch +++ /dev/null @@ -1,194 +0,0 @@ -diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -index c275e12e..fdba433c 100644 ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -175,6 +175,35 @@ - /* - * Hidden Registers - */ -+#define QCA956X_MAC_CFG_BASE 0xb9000000 -+#define QCA956X_MAC_CFG_SIZE 0x64 -+ -+#define QCA956X_MAC_CFG1_REG 0x00 -+#define QCA956X_MAC_CFG1_SOFT_RST BIT(31) -+#define QCA956X_MAC_CFG1_RX_RST BIT(19) -+#define QCA956X_MAC_CFG1_TX_RST BIT(18) -+#define QCA956X_MAC_CFG1_LOOPBACK BIT(8) -+#define QCA956X_MAC_CFG1_RX_EN BIT(2) -+#define QCA956X_MAC_CFG1_TX_EN BIT(0) -+ -+#define QCA956X_MAC_CFG2_REG 0x04 -+#define QCA956X_MAC_CFG2_IF_1000 BIT(9) -+#define QCA956X_MAC_CFG2_IF_10_100 BIT(8) -+#define QCA956X_MAC_CFG2_HUGE_FRAME_EN BIT(5) -+#define QCA956X_MAC_CFG2_LEN_CHECK BIT(4) -+#define QCA956X_MAC_CFG2_PAD_CRC_EN BIT(2) -+#define QCA956X_MAC_CFG2_FDX BIT(0) -+ -+#define QCA956X_MAC_MII_MGMT_CFG_REG 0x20 -+#define QCA956X_MGMT_CFG_CLK_DIV_20 0x07 -+ -+#define QCA956X_MAC_FIFO_CFG0_REG 0x48 -+#define QCA956X_MAC_FIFO_CFG1_REG 0x4c -+#define QCA956X_MAC_FIFO_CFG2_REG 0x50 -+#define QCA956X_MAC_FIFO_CFG3_REG 0x54 -+#define QCA956X_MAC_FIFO_CFG4_REG 0x58 -+#define QCA956X_MAC_FIFO_CFG5_REG 0x5c -+ - #define QCA956X_DAM_RESET_OFFSET 0xb90001bc - #define QCA956X_DAM_RESET_SIZE 0x4 - #define QCA956X_INLINE_CHKSUM_ENG BIT(27) -@@ -381,6 +410,7 @@ - #define QCA955X_PLL_CLK_CTRL_REG 0x08 - #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28 - #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48 -+#define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c - - #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 - #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -@@ -413,12 +443,18 @@ - #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) - #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -+#define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2) -+#define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1) -+#define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0) -+ - #define QCA956X_PLL_CPU_CONFIG_REG 0x00 - #define QCA956X_PLL_CPU_CONFIG1_REG 0x04 - #define QCA956X_PLL_DDR_CONFIG_REG 0x08 - #define QCA956X_PLL_DDR_CONFIG1_REG 0x0c - #define QCA956X_PLL_CLK_CTRL_REG 0x10 -+#define QCA956X_PLL_SWITCH_CLOCK_CONTROL_REG 0x28 - #define QCA956X_PLL_ETH_XMII_CONTROL_REG 0x30 -+#define QCA956X_PLL_ETH_SGMII_SERDES_REG 0x4c - - #define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 - #define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -@@ -457,6 +493,31 @@ - #define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL BIT(21) - #define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_I2C_CLK_SELB BIT(5) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1 BIT(6) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_UART1_CLK_SEL BIT(7) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_SHIFT 8 -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_MASK 0xf -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_EN_PLL_TOP BIT(12) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2 BIT(13) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1 BIT(14) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2 BIT(15) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_SWITCH_FUNC_TST_MODE BIT(16) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_EEE_ENABLE BIT(17) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_OEN_CLK125M_PLL BIT(18) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_SWITCHCLK_SEL BIT(19) -+ -+#define QCA956X_PLL_ETH_XMII_TX_INVERT BIT(1) -+#define QCA956X_PLL_ETH_XMII_GIGE BIT(25) -+#define QCA956X_PLL_ETH_XMII_RX_DELAY_SHIFT 28 -+#define QCA956X_PLL_ETH_XMII_RX_DELAY_MASK 0x3 -+#define QCA956X_PLL_ETH_XMII_TX_DELAY_SHIFT 26 -+#define QCA956X_PLL_ETH_XMII_TX_DELAY_MASK 3 -+ -+#define QCA956X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2) -+#define QCA956X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1) -+#define QCA956X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0) -+ - /* - * USB_CONFIG block - */ -@@ -654,6 +715,25 @@ - #define QCA955X_RESET_MBOX BIT(1) - #define QCA955X_RESET_I2S BIT(0) - -+#define QCA956X_RESET_EXTERNAL BIT(28) -+#define QCA956X_RESET_FULL_CHIP BIT(24) -+#define QCA956X_RESET_GE1_MDIO BIT(23) -+#define QCA956X_RESET_GE0_MDIO BIT(22) -+#define QCA956X_RESET_CPU_NMI BIT(21) -+#define QCA956X_RESET_CPU_COLD BIT(20) -+#define QCA956X_RESET_DMA BIT(19) -+#define QCA956X_RESET_DDR BIT(16) -+#define QCA956X_RESET_GE1_MAC BIT(13) -+#define QCA956X_RESET_SGMII_ANALOG BIT(12) -+#define QCA956X_RESET_USB_PHY_ANALOG BIT(11) -+#define QCA956X_RESET_GE0_MAC BIT(9) -+#define QCA956X_RESET_SGMII BIT(8) -+#define QCA956X_RESET_USB_HOST BIT(5) -+#define QCA956X_RESET_USB_PHY BIT(4) -+#define QCA956X_RESET_USBSUS_OVERRIDE BIT(3) -+#define QCA956X_RESET_SWITCH_ANALOG BIT(2) -+#define QCA956X_RESET_SWITCH BIT(0) -+ - #define AR933X_BOOTSTRAP_MDIO_GPIO_EN BIT(18) - #define AR933X_BOOTSTRAP_EEPBUSY BIT(4) - #define AR933X_BOOTSTRAP_USB_MODE_HOST BIT(3) -@@ -1186,6 +1266,7 @@ - */ - - #define QCA955X_GMAC_REG_ETH_CFG 0x00 -+#define QCA955X_GMAC_REG_SGMII_SERDES 0x18 - - #define QCA955X_ETH_CFG_RGMII_EN BIT(0) - #define QCA955X_ETH_CFG_MII_GE0 BIT(1) -@@ -1207,16 +1288,58 @@ - #define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 - #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 - -+#define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15) -+#define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23 -+#define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf - /* - * QCA956X GMAC Interface - */ - --#define QCA956X_GMAC_REG_ETH_CFG 0x00 -+#define QCA956X_GMAC_REG_ETH_CFG 0x00 -+#define QCA956X_GMAC_REG_SGMII_RESET 0x14 -+#define QCA956X_GMAC_REG_SGMII_SERDES 0x18 -+#define QCA956X_GMAC_REG_MR_AN_CONTROL 0x1c -+#define QCA956X_GMAC_REG_SGMII_CONFIG 0x34 -+#define QCA956X_GMAC_REG_SGMII_DEBUG 0x58 - -+#define QCA956X_ETH_CFG_RGMII_EN BIT(0) -+#define QCA956X_ETH_CFG_GE0_SGMII BIT(6) - #define QCA956X_ETH_CFG_SW_ONLY_MODE BIT(7) --#define QCA956X_ETH_CFG_SW_PHY_SWAP BIT(8) -+#define QCA956X_ETH_CFG_SW_PHY_SWAP BIT(8) - #define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(9) - #define QCA956X_ETH_CFG_SW_APB_ACCESS BIT(10) - #define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13) -+#define QCA956X_ETH_CFG_RXD_DELAY_MASK 0x3 -+#define QCA956X_ETH_CFG_RXD_DELAY_SHIFT 14 -+#define QCA956X_ETH_CFG_RDV_DELAY_MASK 0x3 -+#define QCA956X_ETH_CFG_RDV_DELAY_SHIFT 16 -+ -+#define QCA956X_SGMII_RESET_RX_CLK_N_RESET 0x0 -+#define QCA956X_SGMII_RESET_RX_CLK_N BIT(0) -+#define QCA956X_SGMII_RESET_TX_CLK_N BIT(1) -+#define QCA956X_SGMII_RESET_RX_125M_N BIT(2) -+#define QCA956X_SGMII_RESET_TX_125M_N BIT(3) -+#define QCA956X_SGMII_RESET_HW_RX_125M_N BIT(4) -+ -+#define QCA956X_SGMII_SERDES_CDR_BW_MASK 0x3 -+#define QCA956X_SGMII_SERDES_CDR_BW_SHIFT 1 -+#define QCA956X_SGMII_SERDES_TX_DR_CTRL_MASK 0x7 -+#define QCA956X_SGMII_SERDES_TX_DR_CTRL_SHIFT 4 -+#define QCA956X_SGMII_SERDES_PLL_BW BIT(8) -+#define QCA956X_SGMII_SERDES_VCO_FAST BIT(9) -+#define QCA956X_SGMII_SERDES_VCO_SLOW BIT(10) -+#define QCA956X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15) -+#define QCA956X_SGMII_SERDES_EN_SIGNAL_DETECT BIT(16) -+#define QCA956X_SGMII_SERDES_FIBER_SDO BIT(17) -+#define QCA956X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23 -+#define QCA956X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf -+#define QCA956X_SGMII_SERDES_VCO_REG_SHIFT 27 -+#define QCA956X_SGMII_SERDES_VCO_REG_MASK 0xf -+ -+#define QCA956X_MR_AN_CONTROL_AN_ENABLE BIT(12) -+#define QCA956X_MR_AN_CONTROL_PHY_RESET BIT(15) -+ -+#define QCA956X_SGMII_CONFIG_MODE_CTRL_SHIFT 0 -+#define QCA956X_SGMII_CONFIG_MODE_CTRL_MASK 0x7 - - #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/target/linux/ar71xx/patches-4.14/930-chipidea-pullup.patch b/target/linux/ar71xx/patches-4.14/930-chipidea-pullup.patch deleted file mode 100644 index f6a4f0161..000000000 --- a/target/linux/ar71xx/patches-4.14/930-chipidea-pullup.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- a/drivers/usb/chipidea/ci.h -+++ b/drivers/usb/chipidea/ci.h -@@ -205,6 +205,7 @@ struct hw_bank { - * @in_lpm: if the core in low power mode - * @wakeup_int: if wakeup interrupt occur - * @rev: The revision number for controller -+ * @dp_always_pullup: keep dp always pullup at device mode - */ - struct ci_hdrc { - struct device *dev; -@@ -259,6 +260,7 @@ struct ci_hdrc { - bool in_lpm; - bool wakeup_int; - enum ci_revision rev; -+ bool dp_always_pullup; - }; - - static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci) ---- a/drivers/usb/chipidea/core.c -+++ b/drivers/usb/chipidea/core.c -@@ -818,7 +818,7 @@ static inline void ci_role_destroy(struct ci_hdrc *ci) - { - ci_hdrc_gadget_destroy(ci); - ci_hdrc_host_destroy(ci); -- if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) -+ if (!ci->dp_always_pullup && ci->roles[CI_ROLE_GADGET]) - ci_hdrc_otg_destroy(ci); - } - -@@ -923,6 +923,9 @@ static int ci_hdrc_probe(struct platform_device *pdev) - CI_HDRC_SUPPORTS_RUNTIME_PM); - platform_set_drvdata(pdev, ci); - -+ ci->dp_always_pullup = !!(ci->platdata->flags & -+ CI_HDRC_DP_ALWAYS_PULLUP); -+ - ret = hw_device_init(ci, base); - if (ret < 0) { - dev_err(dev, "can't initialize hardware\n"); -@@ -1004,7 +1007,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) - goto deinit_gadget; - } - -- if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) { -+ if (!ci->dp_always_pullup && ci->roles[CI_ROLE_GADGET]) { - ret = ci_hdrc_otg_init(ci); - if (ret) { - dev_err(dev, "init otg fails, ret = %d\n", ret); ---- a/drivers/usb/chipidea/otg.c -+++ b/drivers/usb/chipidea/otg.c -@@ -131,8 +131,10 @@ enum ci_role ci_otg_role(struct ci_hdrc *ci) - - void ci_handle_vbus_change(struct ci_hdrc *ci) - { -- if (!ci->is_otg) -+ if (ci->dp_always_pullup) { -+ usb_gadget_vbus_connect(&ci->gadget); - return; -+ } - - if (hw_read_otgsc(ci, OTGSC_BSV) && !ci->vbus_active) - usb_gadget_vbus_connect(&ci->gadget); ---- a/include/linux/usb/chipidea.h -+++ b/include/linux/usb/chipidea.h -@@ -59,6 +59,7 @@ struct ci_hdrc_platform_data { - #define CI_HDRC_OVERRIDE_TX_BURST BIT(10) - #define CI_HDRC_OVERRIDE_RX_BURST BIT(11) - #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */ -+#define CI_HDRC_DP_ALWAYS_PULLUP BIT(12) - #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13) - enum usb_dr_mode dr_mode; - #define CI_HDRC_CONTROLLER_RESET_EVENT 0 diff --git a/target/linux/ar71xx/patches-4.14/980-patch-switch-ext.patch b/target/linux/ar71xx/patches-4.14/980-patch-switch-ext.patch deleted file mode 100644 index 2f43480be..000000000 --- a/target/linux/ar71xx/patches-4.14/980-patch-switch-ext.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/include/linux/switch.h -+++ b/include/linux/switch.h -@@ -66,6 +66,11 @@ struct switch_port_stats { - unsigned long long rx_bytes; - }; - -+struct switch_ext { -+ const char *option_name; -+ const char *option_value; -+ struct switch_ext *next; -+}; - /** - * struct switch_dev_ops - switch driver operations - * -@@ -157,6 +162,7 @@ struct switch_val { - const char *s; - u32 i; - struct switch_port *ports; -+ struct switch_ext *ext_val; - struct switch_port_link *link; - } value; - }; ---- a/include/uapi/linux/switch.h -+++ b/include/uapi/linux/switch.h -@@ -89,6 +89,7 @@ enum switch_val_type { - SWITCH_TYPE_PORTS, - SWITCH_TYPE_LINK, - SWITCH_TYPE_NOVAL, -+ SWITCH_TYPE_EXT, - }; - - /* port nested attributes */ diff --git a/target/linux/ar71xx/patches-4.14/999-ppp-function.patch b/target/linux/ar71xx/patches-4.14/999-ppp-function.patch deleted file mode 100644 index 0c5ad25e3..000000000 --- a/target/linux/ar71xx/patches-4.14/999-ppp-function.patch +++ /dev/null @@ -1,379 +0,0 @@ ---- a/drivers/net/ppp/ppp_generic.c -+++ b/drivers/net/ppp/ppp_generic.c -@@ -3311,6 +3311,291 @@ static void *unit_find(struct idr *p, int n) - return idr_find(p, n); - } - -+/* -+ * Registers a destroy method to the channel. When a PPP interface goes down, -+ * this destroy method is called if it is registered. -+ */ -+bool ppp_register_destroy_method(struct net_device *dev, ppp_channel_destroy_method_t method, void *arg) -+{ -+ struct channel *pch; -+ struct ppp *ppp; -+ struct ppp_net *pn; -+ -+ if (!dev) { -+ printk(KERN_NOTICE "net device is null\n"); -+ return false; -+ } -+ -+ if (dev->type != ARPHRD_PPP) { -+ printk(KERN_NOTICE "net device type is not PPP\n"); -+ return false; -+ } -+ -+ ppp = netdev_priv(dev); -+ pn = ppp_pernet(ppp->ppp_net); -+ -+ spin_lock_bh(&pn->all_channels_lock); -+ list_for_each_entry(pch, &ppp->channels, clist) { -+ if (pch->chan && pch->chan->ops->reg_destroy_method) { -+ if (!pch->chan->ops->reg_destroy_method(pch->chan, method, arg)) { -+ /* -+ * One of the channels has failed to register the destroy method. -+ */ -+ spin_unlock_bh(&pn->all_channels_lock); -+ printk(KERN_NOTICE "PPP channel %p failed to register destroy method\n", pch->chan); -+ return false; -+ } -+ } -+ } -+ spin_unlock_bh(&pn->all_channels_lock); -+ -+ return true; -+} -+ -+/* -+ * Unregisters the destroy method from the channel. -+ */ -+bool ppp_unregister_destroy_method(struct net_device *dev) -+{ -+ struct channel *pch; -+ struct ppp *ppp; -+ struct ppp_net *pn; -+ -+ if (!dev) { -+ printk(KERN_NOTICE "net device is null\n"); -+ return false; -+ } -+ -+ if (dev->type != ARPHRD_PPP) { -+ printk(KERN_NOTICE "net device type is not PPP\n"); -+ return false; -+ } -+ -+ ppp = netdev_priv(dev); -+ -+ pn = ppp_pernet(ppp->ppp_net); -+ -+ spin_lock_bh(&pn->all_channels_lock); -+ list_for_each_entry(pch, &ppp->channels, clist) { -+ if (pch->chan && pch->chan->ops->unreg_destroy_method) { -+ /* -+ * unregister function just sets the fields to NULL, so there is not any failure case. -+ */ -+ pch->chan->ops->unreg_destroy_method(pch->chan); -+ } -+ } -+ spin_unlock_bh(&pn->all_channels_lock); -+ -+ return true; -+} -+ -+/* -+ * ppp_is_multilink() -+ * Returns >0 if the device is a multilink PPP netdevice, 0 if not or < 0 if the device is not PPP -+ */ -+int ppp_is_multilink(struct net_device *dev) -+{ -+ struct ppp *ppp; -+ unsigned int flags; -+ -+ if (!dev) { -+ return -1; -+ } -+ if (dev->type != ARPHRD_PPP) { -+ return -1; -+ } -+ -+ ppp = netdev_priv(dev); -+ ppp_lock(ppp); -+ flags = ppp->flags; -+ ppp_unlock(ppp); -+ if (flags & SC_MULTILINK) { -+ return 1; -+ } -+ return 0; -+} -+ -+/* -+ * ppp_channel_get_protocol() -+ * Call this to obtain the underlying protocol of the PPP channel, e.g. PX_PROTO_OE -+ * -+ * NOTE: Some channels do not use PX sockets so the protocol value may be very different for them. -+ * NOTE: -1 indicates failure. -+ * NOTE: Once you know the channel protocol you may then either cast 'chan' to its sub-class or -+ * use the channel protocol specific API's as provided by that channel sub type. -+ */ -+int ppp_channel_get_protocol(struct ppp_channel *chan) -+{ -+ if (!chan->ops->get_channel_protocol) { -+ return -1; -+ } -+ return chan->ops->get_channel_protocol(chan); -+} -+ -+/* -+ * ppp_channel_hold() -+ * Call this to hold a channel. -+ * -+ * Returns true on success or false if the hold could not happen. -+ * -+ * NOTE: chan must be protected against destruction during this call - -+ * either by correct locking etc. or because you already have an implicit -+ * or explicit hold to the channel already and this is an additional hold. -+ */ -+bool ppp_channel_hold(struct ppp_channel *chan) -+{ -+ if (!chan->ops->hold) { -+ return false; -+ } -+ chan->ops->hold(chan); -+ return true; -+} -+ -+/* -+ * ppp_channel_release() -+ * Call this to release a hold you have upon a channel -+ */ -+void ppp_channel_release(struct ppp_channel *chan) -+{ -+ chan->ops->release(chan); -+} -+ -+/* -+ * ppp_hold_channels() -+ * Returns the PPP channels of the PPP device, storing each one into channels[]. -+ * -+ * channels[] has chan_sz elements. -+ * This function returns the number of channels stored, up to chan_sz. -+ * It will return < 0 if the device is not PPP. -+ * -+ * You MUST release the channels using ppp_release_channels(). -+ */ -+int ppp_hold_channels(struct net_device *dev, struct ppp_channel *channels[], unsigned int chan_sz) -+{ -+ struct ppp *ppp; -+ int c; -+ struct channel *pch; -+ -+ if (!dev) { -+ return -1; -+ } -+ if (dev->type != ARPHRD_PPP) { -+ return -1; -+ } -+ -+ ppp = netdev_priv(dev); -+ -+ c = 0; -+ ppp_lock(ppp); -+ list_for_each_entry(pch, &ppp->channels, clist) { -+ struct ppp_channel *chan; -+ -+ if (!pch->chan) { -+ /* -+ * Channel is going / gone away -+ */ -+ continue; -+ } -+ if (c == chan_sz) { -+ /* -+ * No space to record channel -+ */ -+ ppp_unlock(ppp); -+ return c; -+ } -+ -+ /* -+ * Hold the channel, if supported -+ */ -+ chan = pch->chan; -+ if (!chan->ops->hold) { -+ continue; -+ } -+ chan->ops->hold(chan); -+ -+ /* -+ * Record the channel -+ */ -+ channels[c++] = chan; -+ } -+ ppp_unlock(ppp); -+ return c; -+} -+ -+/* -+ * __ppp_hold_channels() -+ * Returns the PPP channels of the PPP device, storing each -+ * one into channels[]. -+ * -+ * channels[] has chan_sz elements. -+ * This function returns the number of channels stored, up to chan_sz. -+ * It will return < 0 if the device is not PPP. -+ * -+ * You MUST acquire ppp_lock & release the channels using -+ * ppp_release_channels(). -+ */ -+int __ppp_hold_channels(struct net_device *dev, struct ppp_channel *channels[], -+ unsigned int chan_sz) -+{ -+ struct ppp *ppp; -+ int c; -+ struct channel *pch; -+ -+ if (!dev) -+ return -1; -+ -+ if (dev->type != ARPHRD_PPP) -+ return -1; -+ -+ ppp = netdev_priv(dev); -+ -+ c = 0; -+ list_for_each_entry(pch, &ppp->channels, clist) { -+ struct ppp_channel *chan; -+ -+ if (!pch->chan) { -+ /* -+ * Channel is going / gone away -+ */ -+ continue; -+ } -+ if (c == chan_sz) { -+ /* -+ * No space to record channel -+ */ -+ return c; -+ } -+ -+ /* -+ * Hold the channel, if supported -+ */ -+ chan = pch->chan; -+ if (!chan->ops->hold) { -+ continue; -+ } -+ chan->ops->hold(chan); -+ -+ /* -+ * Record the channel -+ */ -+ channels[c++] = chan; -+ } -+ return c; -+} -+ -+/* -+ * ppp_release_channels() -+ * Releases channels -+ */ -+void ppp_release_channels(struct ppp_channel *channels[], unsigned int chan_sz) -+{ -+ unsigned int c; -+ for (c = 0; c < chan_sz; ++c) { -+ struct ppp_channel *chan; -+ chan = channels[c]; -+ chan->ops->release(chan); -+ } -+} - /* Module/initialization stuff */ - - module_init(ppp_init); -@@ -3327,6 +3612,16 @@ EXPORT_SYMBOL(ppp_input_error); - EXPORT_SYMBOL(ppp_output_wakeup); - EXPORT_SYMBOL(ppp_register_compressor); - EXPORT_SYMBOL(ppp_unregister_compressor); -+EXPORT_SYMBOL(ppp_register_destroy_method); -+EXPORT_SYMBOL(ppp_unregister_destroy_method); -+EXPORT_SYMBOL(ppp_is_multilink); -+EXPORT_SYMBOL(ppp_hold_channels); -+EXPORT_SYMBOL(__ppp_hold_channels); -+EXPORT_SYMBOL(ppp_release_channels); -+EXPORT_SYMBOL(ppp_channel_get_protocol); -+EXPORT_SYMBOL(ppp_channel_hold); -+EXPORT_SYMBOL(ppp_channel_release); -+ - MODULE_LICENSE("GPL"); - MODULE_ALIAS_CHARDEV(PPP_MAJOR, 0); - MODULE_ALIAS_RTNL_LINK("ppp"); ---- a/include/linux/ppp_channel.h -+++ b/include/linux/ppp_channel.h -@@ -24,6 +24,8 @@ - #include - #include - -+typedef void (*ppp_channel_destroy_method_t)(void *, uint16_t, uint8_t *); -+ - struct ppp_channel; - - struct ppp_channel_ops { -@@ -32,6 +34,18 @@ struct ppp_channel_ops { - int (*start_xmit)(struct ppp_channel *, struct sk_buff *); - /* Handle an ioctl call that has come in via /dev/ppp. */ - int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long); -+ /* Return the net_device of the given channel. */ -+ struct net_device* (*get_netdev)(struct ppp_channel *); -+ /* Register destroy function into PPP channels */ -+ bool (*reg_destroy_method)(struct ppp_channel *, ppp_channel_destroy_method_t method, void *); -+ /* Unregister destroy function from PPP channels */ -+ void (*unreg_destroy_method)(struct ppp_channel *); -+ /* Get channel protocol type, one of PX_PROTO_XYZ or specific to the channel subtype */ -+ int (*get_channel_protocol)(struct ppp_channel *); -+ /* Hold the channel from being destroyed */ -+ void (*hold)(struct ppp_channel *); -+ /* Release hold on the channel */ -+ void (*release)(struct ppp_channel *); - - #if IS_ENABLED(CONFIG_NF_FLOW_TABLE) - int (*flow_offload_check)(struct ppp_channel *, struct flow_offload_hw_path *); -@@ -50,6 +64,37 @@ struct ppp_channel { - }; - - #ifdef __KERNEL__ -+/* Call this to obtain the underlying protocol of the PPP channel, e.g. PX_PROTO_OE */ -+extern int ppp_channel_get_protocol(struct ppp_channel *); -+ -+/* Call this to hold a channel */ -+extern bool ppp_channel_hold(struct ppp_channel *); -+ -+/* Call this to release a hold you have upon a channel */ -+extern void ppp_channel_release(struct ppp_channel *); -+ -+/* Register destroy function into PPP channels */ -+extern bool ppp_register_destroy_method(struct net_device *dev, ppp_channel_destroy_method_t method, void *arg); -+ -+/* Unregister destroy function from PPP channels */ -+extern bool ppp_unregister_destroy_method(struct net_device *dev); -+ -+/* Release hold on PPP channels */ -+extern void ppp_release_channels(struct ppp_channel *channels[], unsigned int chan_sz); -+ -+/* Hold PPP channels for the PPP device */ -+extern int ppp_hold_channels(struct net_device *dev, struct ppp_channel *channels[], unsigned int chan_sz); -+ -+/* Hold PPP channels for the PPP device */ -+extern int __ppp_hold_channels(struct net_device *dev, struct ppp_channel *channels[], unsigned int chan_sz); -+ -+/* Test if the ppp device is a multi-link ppp device */ -+extern int ppp_is_multilink(struct net_device *dev); -+ -+/* Update statistics of the PPP net_device by incrementing related -+ statistics field value with corresponding parameter */ -+extern void ppp_update_stats(struct net_device *dev, unsigned long rx_packets, -+ unsigned long rx_bytes, unsigned long tx_packets, unsigned long tx_bytes); - /* Called by the channel when it can send some more data. */ - extern void ppp_output_wakeup(struct ppp_channel *); - diff --git a/target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch b/target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch deleted file mode 100644 index 64fb545b2..000000000 --- a/target/linux/ar71xx/patches-4.9/103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Wed, 18 May 2016 18:03:31 +0200 -Subject: [PATCH] MIPS: ath79: fix register address in ath79_ddr_wb_flush() - -ath79_ddr_wb_flush_base has the type void __iomem *, so register offsets -need to be a multiple of 4. - -Cc: Alban Bedel -Fixes: 24b0e3e84fbf ("MIPS: ath79: Improve the DDR controller interface") -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -58,7 +58,7 @@ EXPORT_SYMBOL_GPL(ath79_ddr_ctrl_init); - - void ath79_ddr_wb_flush(u32 reg) - { -- void __iomem *flush_reg = ath79_ddr_wb_flush_base + reg; -+ void __iomem *flush_reg = ath79_ddr_wb_flush_base + reg * 4; - - /* Flush the DDR write buffer. */ - __raw_writel(0x1, flush_reg); diff --git a/target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch b/target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch deleted file mode 100644 index 3a7fe99e6..000000000 --- a/target/linux/ar71xx/patches-4.9/403-mtd_fix_cfi_cmdset_0002_status_check.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -1631,8 +1631,8 @@ static int __xipram do_write_oneword(str - break; - } - -- if (chip_ready(map, adr)) -- break; -+ if (chip_good(map, adr, datum)) -+ goto enable_xip; - - /* Latency issues. Drop the lock, wait a while and retry */ - UDELAY(map, chip, adr, 1); -@@ -1648,6 +1648,8 @@ static int __xipram do_write_oneword(str - - ret = -EIO; - } -+ -+ enable_xip: - xip_enable(map, chip, adr); - op_done: - if (mode == FL_OTP_WRITE) -@@ -2226,7 +2228,6 @@ static int cfi_amdstd_panic_write(struct - return 0; - } - -- - /* - * Handle devices with one erase region, that only implement - * the chip erase command. -@@ -2291,8 +2292,8 @@ static int __xipram do_erase_chip(struct - chip->erase_suspended = 0; - } - -- if (chip_ready(map, adr)) -- break; -+ if (chip_good(map, adr, map_word_ff(map))) -+ goto op_done; - - if (time_after(jiffies, timeo)) { - printk(KERN_WARNING "MTD %s(): software timeout\n", -@@ -2312,6 +2313,7 @@ static int __xipram do_erase_chip(struct - ret = -EIO; - } - -+ op_done: - chip->state = FL_READY; - xip_enable(map, chip, adr); - DISABLE_VPP(map); -@@ -2381,9 +2383,9 @@ 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; -+ goto op_done; - } - - if (time_after(jiffies, timeo)) { -@@ -2405,6 +2407,7 @@ static int __xipram do_erase_oneblock(st - ret = -EIO; - } - -+ op_done: - chip->state = FL_READY; - DISABLE_VPP(map); - put_chip(map, chip, adr); diff --git a/target/linux/ar71xx/patches-4.9/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch b/target/linux/ar71xx/patches-4.9/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch index 418db2a2b..cfc84c4af 100644 --- a/target/linux/ar71xx/patches-4.9/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch +++ b/target/linux/ar71xx/patches-4.9/407-mtd-m25p80-allow-to-pass-probe-types-via-platform-data.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c -@@ -194,6 +194,7 @@ static ssize_t m25p80_read(struct spi_no +@@ -195,6 +195,7 @@ static ssize_t m25p80_read(struct spi_no */ static int m25p_probe(struct spi_device *spi) { @@ -8,7 +8,7 @@ struct flash_platform_data *data; struct m25p *flash; struct spi_nor *nor; -@@ -246,8 +247,11 @@ static int m25p_probe(struct spi_device +@@ -247,8 +248,11 @@ static int m25p_probe(struct spi_device if (ret) return ret; diff --git a/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch b/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch index 25a73dcdf..ddd69f17e 100644 --- a/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch +++ b/target/linux/ar71xx/patches-4.9/411-mtd-cfi_cmdset_0002-force-word-write.patch @@ -7,7 +7,7 @@ -#define FORCE_WORD_WRITE 0 +#define FORCE_WORD_WRITE 1 - #define MAX_WORD_RETRIES 3 + #define MAX_RETRIES 3 @@ -51,7 +51,9 @@ @@ -35,7 +35,7 @@ /* Atmel chips don't use the same PRI format as AMD chips */ static void fixup_convert_atmel_pri(struct mtd_info *mtd) -@@ -1790,6 +1794,7 @@ static int cfi_amdstd_write_words(struct +@@ -1788,6 +1792,7 @@ static int cfi_amdstd_write_words(struct /* * FIXME: interleaved mode not tested, and probably not supported! */ @@ -43,7 +43,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, unsigned long adr, const u_char *buf, int len) -@@ -1918,7 +1923,6 @@ static int __xipram do_write_buffer(stru +@@ -1916,7 +1921,6 @@ static int __xipram do_write_buffer(stru return ret; } @@ -51,7 +51,7 @@ static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { -@@ -1993,6 +1997,7 @@ static int cfi_amdstd_write_buffers(stru +@@ -1991,6 +1995,7 @@ static int cfi_amdstd_write_buffers(stru return 0; } diff --git a/target/linux/ar71xx/patches-4.9/500-MIPS-fw-myloader.patch b/target/linux/ar71xx/patches-4.9/500-MIPS-fw-myloader.patch index 301422a7d..304fd69b2 100644 --- a/target/linux/ar71xx/patches-4.9/500-MIPS-fw-myloader.patch +++ b/target/linux/ar71xx/patches-4.9/500-MIPS-fw-myloader.patch @@ -1,6 +1,6 @@ --- a/arch/mips/Makefile +++ b/arch/mips/Makefile -@@ -213,6 +213,7 @@ cflags-$(toolchain-virt) += -DTOOLCHAIN +@@ -218,6 +218,7 @@ cflags-$(toolchain-virt) += -DTOOLCHAIN # libs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/ libs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/ diff --git a/target/linux/ar71xx/patches-4.9/902-at803x-add-reset-gpio-pdata.patch b/target/linux/ar71xx/patches-4.9/902-at803x-add-reset-gpio-pdata.patch index fb6f85cdf..7822158cf 100644 --- a/target/linux/ar71xx/patches-4.9/902-at803x-add-reset-gpio-pdata.patch +++ b/target/linux/ar71xx/patches-4.9/902-at803x-add-reset-gpio-pdata.patch @@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau #endif /* _PHY_AT803X_PDATA_H */ --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -263,6 +263,7 @@ static int at803x_resume(struct phy_devi +@@ -261,6 +261,7 @@ static int at803x_resume(struct phy_devi static int at803x_probe(struct phy_device *phydev) { @@ -24,8 +24,8 @@ Signed-off-by: Felix Fietkau struct device *dev = &phydev->mdio.dev; struct at803x_priv *priv; struct gpio_desc *gpiod_reset; -@@ -274,6 +275,12 @@ static int at803x_probe(struct phy_devic - if (phydev->drv->phy_id != ATH8030_PHY_ID) +@@ -273,6 +274,12 @@ static int at803x_probe(struct phy_devic + phydev->drv->phy_id != ATH8032_PHY_ID) goto does_not_require_reset_workaround; + pdata = dev_get_platdata(dev); @@ -37,7 +37,7 @@ Signed-off-by: Felix Fietkau gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(gpiod_reset)) return PTR_ERR(gpiod_reset); -@@ -405,15 +412,23 @@ static void at803x_link_change_notify(st +@@ -404,15 +411,23 @@ static void at803x_link_change_notify(st * cannot recover from by software. */ if (phydev->state == PHY_NOLINK) { diff --git a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch index 1815ccb1d..620020370 100644 --- a/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-4.9/910-unaligned_access_hacks.patch @@ -250,7 +250,7 @@ &sin->sin6_addr); sin->sin6_scope_id = 0; } -@@ -814,12 +814,12 @@ int ip6_datagram_send_ctl(struct net *ne +@@ -817,12 +817,12 @@ int ip6_datagram_send_ctl(struct net *ne } if (fl6->flowlabel&IPV6_FLOWINFO_MASK) { @@ -327,7 +327,7 @@ return neigh_create(&arp_tbl, pkey, dev); --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -448,48 +448,53 @@ static void tcp_options_write(__be32 *pt +@@ -453,48 +453,53 @@ static void tcp_options_write(__be32 *pt u16 options = opts->options; /* mungable copy */ if (unlikely(OPTION_MD5 & options)) { @@ -404,7 +404,7 @@ } if (unlikely(opts->num_sack_blocks)) { -@@ -497,16 +502,17 @@ static void tcp_options_write(__be32 *pt +@@ -502,16 +507,17 @@ static void tcp_options_write(__be32 *pt tp->duplicate_sack : tp->selective_acks; int this_sack; @@ -428,7 +428,7 @@ } tp->rx_opt.dsack = 0; -@@ -519,13 +525,14 @@ static void tcp_options_write(__be32 *pt +@@ -524,13 +530,14 @@ static void tcp_options_write(__be32 *pt if (foc->exp) { len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; @@ -795,7 +795,7 @@ --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c -@@ -3896,14 +3896,16 @@ static bool tcp_parse_aligned_timestamp( +@@ -3910,14 +3910,16 @@ static bool tcp_parse_aligned_timestamp( { const __be32 *ptr = (const __be32 *)(th + 1); diff --git a/target/linux/ar71xx/patches-4.9/940-m25p80-add-m25qh64a.patch b/target/linux/ar71xx/patches-4.9/940-m25p80-add-m25qh64a.patch deleted file mode 100644 index e69744302..000000000 --- a/target/linux/ar71xx/patches-4.9/940-m25p80-add-m25qh64a.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c -index 79b2da1..c32228b 100644 ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1120,6 +1120,7 @@ static const struct flash_info spi_nor_ids[] = { - { "m25px32-s0", INFO(0x207316, 0, 64 * 1024, 64, SECT_4K) }, - { "m25px32-s1", INFO(0x206316, 0, 64 * 1024, 64, SECT_4K) }, - { "m25px64", INFO(0x207117, 0, 64 * 1024, 128, 0) }, -+ { "m25qh64a", INFO(0x207017, 0, 64 * 1024, 128, 0) }, - { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, - - /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ diff --git a/target/linux/arc770/generic/target.mk b/target/linux/arc770/generic/target.mk index 2ca59b579..5a7595d65 100644 --- a/target/linux/arc770/generic/target.mk +++ b/target/linux/arc770/generic/target.mk @@ -1,5 +1,5 @@ BOARDNAME:=Generic -FEATURES += ramdisk usb ext4 source-only +FEATURES += ramdisk usb ext4 define Target/Description Build firmware images for generic ARC 770D based boards. diff --git a/target/linux/archs38/config-4.14 b/target/linux/archs38/config-4.14 index 9a04154a2..21983479b 100644 --- a/target/linux/archs38/config-4.14 +++ b/target/linux/archs38/config-4.14 @@ -8,7 +8,6 @@ CONFIG_ARCH_HAS_SG_CHAIN=y # CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set # CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARC_BUILTIN_DTB_NAME="" CONFIG_ARC_CACHE=y CONFIG_ARC_CACHE_LINE_SHIFT=6 @@ -62,20 +61,15 @@ CONFIG_CRYPTO_MANAGER2=y CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y CONFIG_DWMAC_ANARION=y # CONFIG_DWMAC_DWC_QOS_ETH is not set CONFIG_DWMAC_GENERIC=y CONFIG_DW_APB_ICTL=y -CONFIG_EXPORTFS=y CONFIG_EXT4_FS=y # CONFIG_EZNPS_GIC is not set CONFIG_FIXED_PHY=y CONFIG_FS_MBCACHE=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CSUM=y CONFIG_GENERIC_FIND_FIRST_BIT=y @@ -205,7 +199,6 @@ CONFIG_STMMAC_ETH=y CONFIG_STMMAC_PLATFORM=y CONFIG_SWPHY=y CONFIG_TASKS_RCU=y -CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y diff --git a/target/linux/armvirt/64/config-default b/target/linux/armvirt/64/config-default index 4e63668f5..a38a9162b 100644 --- a/target/linux/armvirt/64/config-default +++ b/target/linux/armvirt/64/config-default @@ -42,6 +42,7 @@ CONFIG_ARM64_PAN=y # CONFIG_ARM64_PTDUMP is not set # CONFIG_ARM64_PTDUMP_DEBUGFS is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_ARM64_SSBD=y # CONFIG_ARM64_SW_TTBR0_PAN is not set CONFIG_ARM64_UAO=y CONFIG_ARM64_VA_BITS=39 @@ -106,6 +107,7 @@ CONFIG_GENERIC_CSUM=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_ARCH_HUGE_VMAP=y CONFIG_HAVE_ARCH_KASAN=y @@ -177,6 +179,7 @@ CONFIG_SYS_SUPPORTS_HUGETLBFS=y # CONFIG_THUNDER_NIC_PF is not set # CONFIG_THUNDER_NIC_RGX is not set # CONFIG_THUNDER_NIC_VF is not set +CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_VEXPRESS_CONFIG=y CONFIG_VEXPRESS_SYSCFG=y CONFIG_VIDEOMODE_HELPERS=y diff --git a/target/linux/at91/image/legacy.mk b/target/linux/at91/image/legacy.mk index c6d9ed810..ae3c163d9 100644 --- a/target/linux/at91/image/legacy.mk +++ b/target/linux/at91/image/legacy.mk @@ -115,7 +115,7 @@ define Device/at91-q5xr5 DEVICE_TITLE := Exegin Q5XR5 KERNEL_SIZE := 2048k endef -TARGET_DEVICES += at91-q5xr5 +#TARGET_DEVICES += at91-q5xr5 define Device/wb45n $(Device/evaluation-fit) diff --git a/target/linux/ath25/Makefile b/target/linux/ath25/Makefile index 27c263965..cb8b7ec1b 100644 --- a/target/linux/ath25/Makefile +++ b/target/linux/ath25/Makefile @@ -12,7 +12,7 @@ BOARDNAME:=Atheros AR231x/AR5312 FEATURES:=squashfs low_mem small_flash MAINTAINER:=Sergey Ryazanov -KERNEL_PATCHVER:=4.9 +KERNEL_PATCHVER:=4.14 define Target/Description Build firmware images for Atheros SoC boards diff --git a/target/linux/ath25/config-4.9 b/target/linux/ath25/config-4.14 similarity index 88% rename from target/linux/ath25/config-4.9 rename to target/linux/ath25/config-4.14 index bc28b8892..4d3f0c697 100644 --- a/target/linux/ath25/config-4.9 +++ b/target/linux/ath25/config-4.14 @@ -7,12 +7,20 @@ CONFIG_ARCH_DISCARD_MEMBLOCK=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y # CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set # CONFIG_ARCH_HAS_SG_CHAIN is not set +# CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is not set +# CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not set CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 +# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set +# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_ARCH_USE_QUEUED_RWLOCKS=y +CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ATH25=y CONFIG_BLK_MQ_PCI=y @@ -42,8 +50,10 @@ CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_IO=y CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_PCI_IOMAP=y CONFIG_GENERIC_SCHED_CLOCK=y @@ -53,6 +63,7 @@ CONFIG_GPIOLIB=y CONFIG_GPIO_AR2315=y CONFIG_GPIO_AR5312=y CONFIG_GPIO_SYSFS=y +# CONFIG_GRO_CELLS is not set CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y @@ -68,6 +79,7 @@ CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_CBPF_JIT=y CONFIG_HAVE_CC_STACKPROTECTOR=y CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_HAVE_C_RECORDMCOUNT=y CONFIG_HAVE_DEBUG_KMEMLEAK=y CONFIG_HAVE_DEBUG_STACKOVERFLOW=y @@ -101,7 +113,8 @@ CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_WORK=y CONFIG_LEDS_GPIO=y -CONFIG_MDIO_BOARDINFO=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 @@ -135,6 +148,7 @@ CONFIG_PCI_DRIVERS_LEGACY=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +# CONFIG_RCU_NEED_SEGCBLIST is not set # CONFIG_RCU_STALL_COMMON is not set # CONFIG_SCHED_INFO is not set # CONFIG_SCSI_DMA is not set @@ -153,4 +167,5 @@ CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TINY_SRCU=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/ath25/image/Makefile b/target/linux/ath25/image/Makefile index 5a20bdb64..ee5e74e69 100644 --- a/target/linux/ath25/image/Makefile +++ b/target/linux/ath25/image/Makefile @@ -82,13 +82,13 @@ define Device/ubnt2 DEVICE_TITLE := Ubiquiti XS2 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS2 -v XS2.ar2316 endef -TARGET_DEVICES += ubnt2 +#TARGET_DEVICES += ubnt2 define Device/ubnt5 DEVICE_TITLE := Ubiquiti XS5 IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS5 -v XS5.ar2313 endef -TARGET_DEVICES += ubnt5 +#TARGET_DEVICES += ubnt5 define Device/np25g DEVICE_TITLE := np25g diff --git a/target/linux/ath25/patches-4.9/107-ar5312_gpio.patch b/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch similarity index 97% rename from target/linux/ath25/patches-4.9/107-ar5312_gpio.patch rename to target/linux/ath25/patches-4.14/107-ar5312_gpio.patch index f42108702..9b2bee1d7 100644 --- a/target/linux/ath25/patches-4.9/107-ar5312_gpio.patch +++ b/target/linux/ath25/patches-4.14/107-ar5312_gpio.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath25/Kconfig +++ b/arch/mips/ath25/Kconfig -@@ -1,6 +1,7 @@ +@@ -2,6 +2,7 @@ config SOC_AR5312 bool "Atheros AR5312/AR2312+ SoC support" depends on ATH25 @@ -68,8 +68,8 @@ depends on (ARCH_ASPEED || COMPILE_TEST) && OF_GPIO --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile -@@ -26,6 +26,7 @@ obj-$(CONFIG_GPIO_ADP5588) += gpio-adp55 - obj-$(CONFIG_GPIO_ALTERA) += gpio-altera.o +@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA) += gpio-alte + obj-$(CONFIG_GPIO_ALTERA_A10SR) += gpio-altera-a10sr.o obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o +obj-$(CONFIG_GPIO_AR5312) += gpio-ar5312.o @@ -202,7 +202,7 @@ +subsys_initcall(ar5312_gpio_init); --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -168,6 +168,7 @@ config ATH25 +@@ -174,6 +174,7 @@ config ATH25 select CEVT_R4K select CSRC_R4K select DMA_NONCOHERENT diff --git a/target/linux/ath25/patches-4.9/108-ar2315_gpio.patch b/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch similarity index 98% rename from target/linux/ath25/patches-4.9/108-ar2315_gpio.patch rename to target/linux/ath25/patches-4.14/108-ar2315_gpio.patch index cd9d8bcda..749b308b8 100644 --- a/target/linux/ath25/patches-4.9/108-ar2315_gpio.patch +++ b/target/linux/ath25/patches-4.14/108-ar2315_gpio.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath25/Kconfig +++ b/arch/mips/ath25/Kconfig -@@ -7,6 +7,7 @@ config SOC_AR5312 +@@ -8,6 +8,7 @@ config SOC_AR5312 config SOC_AR2315 bool "Atheros AR2315+ SoC support" depends on ATH25 @@ -91,8 +91,8 @@ default y if SOC_AR5312 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile -@@ -26,6 +26,7 @@ obj-$(CONFIG_GPIO_ADP5588) += gpio-adp55 - obj-$(CONFIG_GPIO_ALTERA) += gpio-altera.o +@@ -29,6 +29,7 @@ obj-$(CONFIG_GPIO_ALTERA) += gpio-alte + obj-$(CONFIG_GPIO_ALTERA_A10SR) += gpio-altera-a10sr.o obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o +obj-$(CONFIG_GPIO_AR2315) += gpio-ar2315.o @@ -337,7 +337,7 @@ +subsys_initcall(ar2315_gpio_init); --- a/arch/mips/ath25/devices.h +++ b/arch/mips/ath25/devices.h -@@ -3,6 +3,11 @@ +@@ -4,6 +4,11 @@ #include diff --git a/target/linux/ath25/patches-4.9/110-ar2313_ethernet.patch b/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch similarity index 99% rename from target/linux/ath25/patches-4.9/110-ar2313_ethernet.patch rename to target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch index 39638a24d..a2b149225 100644 --- a/target/linux/ath25/patches-4.9/110-ar2313_ethernet.patch +++ b/target/linux/ath25/patches-4.14/110-ar2313_ethernet.patch @@ -1,6 +1,6 @@ --- a/drivers/net/ethernet/atheros/Makefile +++ b/drivers/net/ethernet/atheros/Makefile -@@ -7,3 +7,4 @@ obj-$(CONFIG_ATL2) += atlx/ +@@ -8,3 +8,4 @@ obj-$(CONFIG_ATL2) += atlx/ obj-$(CONFIG_ATL1E) += atl1e/ obj-$(CONFIG_ATL1C) += atl1c/ obj-$(CONFIG_ALX) += alx/ @@ -1625,7 +1625,7 @@ break; --- a/arch/mips/ath25/devices.h +++ b/arch/mips/ath25/devices.h -@@ -32,6 +32,8 @@ extern struct ar231x_board_config ath25_ +@@ -33,6 +33,8 @@ extern struct ar231x_board_config ath25_ extern void (*ath25_irq_dispatch)(void); int ath25_find_config(phys_addr_t offset, unsigned long size); @@ -1636,7 +1636,7 @@ --- a/arch/mips/ath25/devices.c +++ b/arch/mips/ath25/devices.c -@@ -12,6 +12,51 @@ +@@ -13,6 +13,51 @@ struct ar231x_board_config ath25_board; enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN; @@ -1688,7 +1688,7 @@ static struct resource ath25_wmac0_res[] = { { .name = "wmac0_membase", -@@ -70,6 +115,25 @@ const char *get_system_type(void) +@@ -71,6 +116,25 @@ const char *get_system_type(void) return soc_type_strings[ath25_soc]; } @@ -1716,7 +1716,7 @@ struct uart_port s; --- a/arch/mips/include/asm/mach-ath25/ath25_platform.h +++ b/arch/mips/include/asm/mach-ath25/ath25_platform.h -@@ -70,4 +70,15 @@ struct ar231x_board_config { +@@ -71,4 +71,15 @@ struct ar231x_board_config { const char *radio; }; diff --git a/target/linux/ath25/patches-4.9/120-spiflash.patch b/target/linux/ath25/patches-4.14/120-spiflash.patch similarity index 99% rename from target/linux/ath25/patches-4.9/120-spiflash.patch rename to target/linux/ath25/patches-4.14/120-spiflash.patch index 695ea4303..0a2161fb7 100644 --- a/target/linux/ath25/patches-4.9/120-spiflash.patch +++ b/target/linux/ath25/patches-4.14/120-spiflash.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig -@@ -120,6 +120,10 @@ config MTD_BCM47XXSFLASH +@@ -130,6 +130,10 @@ config MTD_BCM47XXSFLASH registered by bcma as platform devices. This enables driver for serial flash memories. @@ -13,8 +13,8 @@ help --- a/drivers/mtd/devices/Makefile +++ b/drivers/mtd/devices/Makefile -@@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataf - obj-$(CONFIG_MTD_M25P80) += m25p80.o +@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_M25P80) += m25p80.o + obj-$(CONFIG_MTD_MCHP23K256) += mchp23k256.o obj-$(CONFIG_MTD_SPEAR_SMI) += spear_smi.o obj-$(CONFIG_MTD_SST25L) += sst25l.o +obj-$(CONFIG_MTD_AR2315) += ar2315.o diff --git a/target/linux/ath25/patches-4.9/130-watchdog.patch b/target/linux/ath25/patches-4.14/130-watchdog.patch similarity index 98% rename from target/linux/ath25/patches-4.9/130-watchdog.patch rename to target/linux/ath25/patches-4.14/130-watchdog.patch index 7009dd928..890d7ad49 100644 --- a/target/linux/ath25/patches-4.9/130-watchdog.patch +++ b/target/linux/ath25/patches-4.14/130-watchdog.patch @@ -212,7 +212,7 @@ +MODULE_ALIAS("platform:" DRIVER_NAME); --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig -@@ -1555,6 +1555,13 @@ config PIC32_DMT +@@ -1646,6 +1646,13 @@ config PIC32_DMT To compile this driver as a loadable module, choose M here. The module will be called pic32-dmt. @@ -228,7 +228,7 @@ # POWERPC Architecture --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile -@@ -159,6 +159,7 @@ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o +@@ -166,6 +166,7 @@ obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o obj-$(CONFIG_AR7_WDT) += ar7_wdt.o diff --git a/target/linux/ath25/patches-4.9/140-redboot_boardconfig.patch b/target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch similarity index 100% rename from target/linux/ath25/patches-4.9/140-redboot_boardconfig.patch rename to target/linux/ath25/patches-4.14/140-redboot_boardconfig.patch diff --git a/target/linux/ath25/patches-4.9/141-redboot_partition_scan.patch b/target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch similarity index 100% rename from target/linux/ath25/patches-4.9/141-redboot_partition_scan.patch rename to target/linux/ath25/patches-4.14/141-redboot_partition_scan.patch diff --git a/target/linux/ath25/patches-4.9/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch similarity index 100% rename from target/linux/ath25/patches-4.9/142-redboot_various_erase_size_fix.patch rename to target/linux/ath25/patches-4.14/142-redboot_various_erase_size_fix.patch diff --git a/target/linux/ath25/patches-4.9/210-reset_button.patch b/target/linux/ath25/patches-4.14/210-reset_button.patch similarity index 97% rename from target/linux/ath25/patches-4.9/210-reset_button.patch rename to target/linux/ath25/patches-4.14/210-reset_button.patch index 34ef46bc5..b3f7a14cd 100644 --- a/target/linux/ath25/patches-4.9/210-reset_button.patch +++ b/target/linux/ath25/patches-4.14/210-reset_button.patch @@ -68,4 +68,4 @@ + return -ENOMEM; +} + -+module_init(ar231x_init_reset); ++device_initcall(ar231x_init_reset); diff --git a/target/linux/ath25/patches-4.9/220-enet_micrel_workaround.patch b/target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch similarity index 100% rename from target/linux/ath25/patches-4.9/220-enet_micrel_workaround.patch rename to target/linux/ath25/patches-4.14/220-enet_micrel_workaround.patch diff --git a/target/linux/ath25/patches-4.9/330-board_leds.patch b/target/linux/ath25/patches-4.14/330-board_leds.patch similarity index 100% rename from target/linux/ath25/patches-4.9/330-board_leds.patch rename to target/linux/ath25/patches-4.14/330-board_leds.patch diff --git a/target/linux/ath79/Makefile b/target/linux/ath79/Makefile deleted file mode 100644 index 6add24a72..000000000 --- a/target/linux/ath79/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include $(TOPDIR)/rules.mk - -ARCH:=mips -BOARD:=ath79 -BOARDNAME:=Atheros ATH79 (DTS) -CPU_TYPE:=24kc -SUBTARGETS:=generic tiny - -FEATURES:=ramdisk source-only - -KERNEL_PATCHVER:=4.14 - -include $(INCLUDE_DIR)/target.mk - -DEFAULT_PACKAGES += \ - kmod-gpio-button-hotplug swconfig \ - kmod-ath9k wpad-mini uboot-envtools - -$(eval $(call BuildTarget)) diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds deleted file mode 100755 index 76b025791..000000000 --- a/target/linux/ath79/base-files/etc/board.d/01_leds +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -. /lib/functions/uci-defaults.sh - -board_config_update - -board=$(board_name) -boardname="${board##*,}" - -case "$board" in -"avm,fritz300e") - ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0" - ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" "phy0tpt" - ucidef_set_rssimon "wlan0" "200000" "1" - ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:green:rssi0" "wlan0" "1" "100" - ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:green:rssi1" "wlan0" "20" "100" - ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$boardname:green:rssi2" "wlan0" "40" "100" - ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssi3" "wlan0" "60" "100" - ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssi4" "wlan0" "80" "100" - ;; -"glinet,ar150") - ucidef_set_led_wlan "wlan" "WLAN" "gl-ar150:orange:wlan" "phy0tpt" - ;; -"tplink,tl-wr740n-v2") - ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0" - ucidef_set_led_switch "lan1" "LAN1" "$boardname:green:lan1" "switch0" "0x02" - ucidef_set_led_switch "lan2" "LAN2" "$boardname:green:lan2" "switch0" "0x04" - ucidef_set_led_switch "lan3" "LAN3" "$boardname:green:lan3" "switch0" "0x08" - ucidef_set_led_switch "lan4" "LAN4" "$boardname:green:lan4" "switch0" "0x10" - ;; -"tplink,tl-wr1043nd-v1") - ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1" - ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network deleted file mode 100755 index a9eeb5b45..000000000 --- a/target/linux/ath79/base-files/etc/board.d/02_network +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh - -. /lib/functions/system.sh -. /lib/functions/uci-defaults.sh - -ath79_setup_interfaces() -{ - local board="$1" - - case "$board" in - "avm,fritz300e"|\ - "tplink,tl-wr703n"|\ - "ubnt,unifi") - ucidef_set_interface_lan "eth0" - ;; - - "glinet,ar150") - ucidef_set_interfaces_lan_wan "eth1" "eth0" - ;; - - "tplink,tl-wdr3600"|\ - "tplink,tl-wdr4300") - ucidef_add_switch "switch0" \ - "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan" - ;; - - "tplink,tl-wr740n-v2") - ucidef_set_interfaces_lan_wan "eth1.1" "eth0" - ucidef_add_switch "switch0" \ - "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" - ;; - - "tplink,tl-wr1043nd-v1") - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0" - ;; - "netgear,wndr3800") - ucidef_set_interfaces_lan_wan "eth0" "eth1" - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0" - - ucidef_add_switch_attr "switch0" "blinkrate" 2 - ucidef_add_switch_port_attr "switch0" 1 led 6 - ucidef_add_switch_port_attr "switch0" 2 led 9 - ucidef_add_switch_port_attr "switch0" 5 led 2 - ;; - "buffalo,wzr-hp-g450h") - ucidef_add_switch "switch0" \ - "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" - ;; - *) - ucidef_set_interfaces_lan_wan "eth0" "eth1" - ;; - esac -} - -ath79_setup_macs() -{ - local board="$1" - - case "$board" in - avm,fritz300e) - lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) - ;; - esac - - [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac -} - -board_config_update -board=$(board_name) -ath79_setup_interfaces $board -ath79_setup_macs $board -board_config_flush - -exit 0 diff --git a/target/linux/ath79/base-files/etc/diag.sh b/target/linux/ath79/base-files/etc/diag.sh deleted file mode 100644 index b18463413..000000000 --- a/target/linux/ath79/base-files/etc/diag.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -. /lib/functions/leds.sh - -status_led="$(get_dt_led status)" - -get_status_led() { - local board=$(board_name) - local boardname="${board##*,}" - - case $board in - "avm,fritz300e") - status_led="${boardname}:green:power" - ;; - "glinet,ar150") - status_led="gl-ar150:orange:wlan" - ;; - "tplink,tl-wr1043nd-v1") - status_led="tp-link:green:system" - ;; - "ubnt,unifi") - status_led="ubnt:green:dome" - ;; - esac -} - -set_state() { - [ -z "$status_led" ] && get_status_led - - case "$1" in - preinit) - status_led_blink_preinit - ;; - failsafe) - status_led_blink_failsafe - ;; - preinit_regular) - status_led_blink_preinit_regular - ;; - done) - status_led_on - ;; - esac -} diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom deleted file mode 100644 index 498cc4e6c..000000000 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -[ -e /lib/firmware/$FIRMWARE ] && exit 0 - -. /lib/functions.sh -. /lib/functions/system.sh - -ath9k_eeprom_die() { - echo "ath9k eeprom: " "$*" - exit 1 -} - -ath9k_eeprom_extract() { - local part=$1 - local offset=$2 - local count=$3 - local mtd - - mtd=$(find_mtd_chardev $part) - [ -n "$mtd" ] || \ - ath9k_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 || \ - ath9k_eeprom_die "failed to extract from $mtd" -} - -ath9k_eeprom_extract_reverse() { - local part=$1 - local offset=$2 - local count=$3 - local mtd - local reversed - local caldata - - mtd=$(find_mtd_chardev "$part") - reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd) - - for byte in $reversed; do - caldata="\x${byte}${caldata}" - done - - printf "%b" "$caldata" > /lib/firmware/$FIRMWARE -} - -board=$(board_name) - -case "$FIRMWARE" in -"ath9k-eeprom-pci-0000:00:00.0.bin") - case $board in - "avm,fritz300e") - ath9k_eeprom_extract_reverse "urloader" 5441 1088 - ;; - "tplink,tl-wdr3600"|\ - "tplink,tl-wdr4300") - ath9k_eeprom_extract "art" 20480 1088 - ;; - "tplink,tl-wr740n-v2"|\ - "ubnt,unifi") - ath9k_eeprom_extract "art" 4096 2048 - ;; - *) - ath9k_eeprom_die "board $board is not supported yet" - ;; - esac - ;; -esac diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata deleted file mode 100644 index 2bbe5923b..000000000 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ /dev/null @@ -1,58 +0,0 @@ -#!/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/functions.sh -. /lib/functions/system.sh - -board=$(board_name) - -case "$FIRMWARE" in -"ath10k/cal-pci-0000:00:00.0.bin") - case $board in - openmesh,om5p-ac-v2) - ath10kcal_extract "ART" 20480 2116 - ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) - ;; - esac - ;; -*) - exit 1 - ;; -esac diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh b/target/linux/ath79/base-files/lib/upgrade/platform.sh deleted file mode 100644 index dfcf70487..000000000 --- a/target/linux/ath79/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (C) 2011 OpenWrt.org -# - -PART_NAME=firmware -REQUIRE_IMAGE_METADATA=1 - -platform_check_image() { - return 0 -} - -platform_do_upgrade() { - local board=$(board_name) - - case "$board" in - *) - default_do_upgrade "$ARGV" - ;; - esac -} diff --git a/target/linux/ath79/dts/ar7100.dtsi b/target/linux/ath79/dts/ar7100.dtsi deleted file mode 100644 index 9957b8df6..000000000 --- a/target/linux/ath79/dts/ar7100.dtsi +++ /dev/null @@ -1,204 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include -#include "ath79.dtsi" - -/ { - compatible = "qca,ar7100"; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "mips,mips24Kc"; - clocks = <&pll ATH79_CLK_CPU>; - reg = <0>; - }; - }; - - ahb { - apb { - ddr_ctrl: memory-controller@18000000 { - compatible = "qca,ar7100-ddr-controller"; - reg = <0x18000000 0x100>; - - #qca,ddr-wb-channel-cells = <1>; - }; - - uart: uart@18020000 { - compatible = "ns16550a"; - reg = <0x18020000 0x20>; - interrupts = <3>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "uart"; - - reg-io-width = <4>; - reg-shift = <2>; - no-loopback-test; - - status = "disabled"; - }; - - usb_phy: usb-phy@18030000 { - compatible = "qca,ar7100-usb-phy"; - reg = <0x18030000 0x10>; - - reset-names = "usb-phy", "usb-host", "usb-ohci-dll"; - resets = <&rst 4>, <&rst 5>, <&rst 6>; - - #phy-cells = <0>; - - status = "disabled"; - }; - - gpio: gpio@18040000 { - compatible = "qca,ar7100-gpio"; - reg = <0x18040000 0x30>; - interrupts = <2>; - - ngpios = <16>; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-controller; - #interrupt-cells = <2>; - }; - - pll: pll-controller@18050000 { - compatible = "qca,ar7100-pll", "syscon"; - reg = <0x18050000 0x20>; - - clock-names = "ref"; - /* The board must provides the ref clock */ - - #clock-cells = <1>; - clock-output-names = "cpu", "ddr", "ahb"; - }; - - wdt: wdt@18060008 { - compatible = "qca,ar7130-wdt"; - reg = <0x18060008 0x8>; - - interrupts = <4>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "wdt"; - }; - - - rst: reset-controller@18060024 { - compatible = "qca,ar7100-reset"; - reg = <0x18060024 0x4>; - - #reset-cells = <1>; - }; - - pcie0: pcie-controller@180c0000 { - compatible = "qca,ar7100-pci"; - #address-cells = <3>; - #size-cells = <2>; - bus-range = <0x0 0x0>; - reg = <0x17010000 0x100>; - reg-names = "cfg_base"; - ranges = <0x2000000 0 0x10000000 0x10000000 0 0x07000000 /* pci memory */ - 0x1000000 0 0x00000000 0x0000000 0 0x000001>; /* io space */ - interrupt-parent = <&cpuintc>; - interrupts = <2>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-map-mask = <0 0 0 1>; - interrupt-map = <0 0 0 0 &pcie0 0>; - status = "disabled"; - }; - }; - }; - - usb2: usb@1b000000 { - compatible = "generic-ehci"; - reg = <0x1b000000 0x1000>; - - interrupt-parent = <&cpuintc>; - interrupts = <3>; - - phy-names = "usb-phy"; - phys = <&usb_phy>; - - has-synopsys-hc-bug; - - status = "disabled"; - }; - - usb1: usb@1c000000 { - compatible = "generic-ohci"; - reg = <0x1c000000 0x1000>; - - interrupt-parent = <&miscintc>; - interrupts = <6>; - - phy-names = "usb-phy"; - phys = <&usb_phy>; - - status = "disabled"; - }; - - spi: spi@1f000000 { - compatible = "qca,ar7100-spi"; - reg = <0x1f000000 0x10>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "ahb"; - - #address-cells = <1>; - #size-cells = <0>; - - status = "disabled"; - }; -}; - -&cpuintc { - qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>; - qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>, - <&ddr_ctrl 0>, <&ddr_ctrl 1>; -}; - -&miscintc { - compatible = "qca,ar7100-misc-intc"; -}; - -ð0 { - compatible = "qca,ar7100-eth"; - reg = <0x19000000 0x200 - 0x18070000 0x4>; - - pll-data = <0x00110000 0x00001099 0x00991099>; - pll-reg = <0x4 0x10 17>; - pll-handle = <&pll>; - phy-mode = "rgmii"; - - resets = <&rst 8>, <&rst 9>; - reset-names = "phy", "mac"; -}; - -&mdio1 { - builtin-switch; -}; - -ð1 { - compatible = "qca,ar7100-eth"; - reg = <0x1a000000 0x200 - 0x18070004 0x4>; - - pll-data = <0x00110000 0x00001099 0x00991099>; - pll-reg = <0x4 0x14 19>; - pll-handle = <&pll>; - - phy-mode = "rgmii"; - - resets = <&rst 12>, <&rst 13>; - reset-names = "phy", "mac"; -}; diff --git a/target/linux/ath79/dts/ar7161_netgear_wndr3800.dts b/target/linux/ath79/dts/ar7161_netgear_wndr3800.dts deleted file mode 100644 index a175fd769..000000000 --- a/target/linux/ath79/dts/ar7161_netgear_wndr3800.dts +++ /dev/null @@ -1,192 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "ar7100.dtsi" - -/ { - compatible = "netgear,wndr3800", "qca,ar7161"; - model = "Netgear WNDR3800"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x8000000>; - }; - - extosc: ref { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-output-names = "ref"; - clock-frequency = <40000000>; - }; - - reset-leds { - compatible = "reset-leds"; - - wps { - label = "netgear:green:usb"; - resets = <&rst 12>; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - wps { - label = "netgear:orange:wps"; - gpios = <&gpio 0 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - power_green { - label = "netgear:green:power"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - power_orange { - label = "netgear:orange:power"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - wps_green { - label = "netgear:green:wps"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - wan_green { - label = "netgear:green:wan"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - button@0 { - label = "wps"; - linux,code = ; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - }; - - button@1 { - label = "reset"; - linux,code = ; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - }; - - button@2 { - label = "wifi"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - }; - - rtl8366s { - compatible = "realtek,rtl8366s"; - gpio-sda = <&gpio 5 GPIO_ACTIVE_HIGH>; - gpio-sck = <&gpio 7 GPIO_ACTIVE_HIGH>; - - mdio-bus { - status = "okay"; - - phy-mask = <0x10>; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "rgmii"; - }; - }; - }; -}; - -&usb_phy { - status = "okay"; -}; - -&usb1 { - status = "okay"; -}; - -&usb2 { - status = "okay"; -}; - -&pcie0 { - status = "okay"; -}; - -&uart { - status = "okay"; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "mx25l12805d"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x050000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x050000 0x020000>; - }; - - partition@2 { - label = "firmware"; - reg = <0x70000 0xf80000>; - }; - - partition@3 { - label = "art"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -ð0 { - status = "okay"; - - pll-data = <0x11110000 0x00001099 0x00991099>; - - fixed-link { - speed = <1000>; - full-duplex; - }; -}; - -ð1 { - status = "okay"; - - pll-data = <0x11110000 0x00001099 0x00991099>; - - resets = <&rst 13>; - reset-names = "mac"; - - phy-handle = <&phy4>; -}; diff --git a/target/linux/ath79/dts/ar7240.dtsi b/target/linux/ath79/dts/ar7240.dtsi deleted file mode 100644 index 6805d1a78..000000000 --- a/target/linux/ath79/dts/ar7240.dtsi +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "ar724x.dtsi" - -/ { - usb_phy: usb-phy { - compatible = "qca,ar7200-usb-phy"; - - reset-names = "usb-phy", "usb-ohci-dll"; - resets = <&rst 4>, <&rst 3>; - - #phy-cells = <0>; - - status = "disabled"; - }; -}; - -&ahb { - usb: usb@1b000000 { - compatible = "generic-ohci"; - reg = <0x1b000000 0x1000>; - - interrupts = <3>; - - resets = <&rst 5>; - reset-names = "usb-host"; - - phy-names = "usb-phy"; - phys = <&usb_phy>; - - status = "disabled"; - }; -}; - -&mdio0 { - builtin-switch; -}; - -ð0 { - compatible = "qca,ar7240-eth", "syscon"; - - pll-data = <0x00110000 0x00001099 0x00991099>; - - resets = <&rst 8>, <&rst 9>; - reset-names = "phy", "mac"; -}; - -&mdio1 { - builtin-switch; -}; - -ð1 { - compatible = "qca,ar7240-eth", "syscon"; - - pll-data = <0x00110000 0x00001099 0x00991099>; - - resets = <&rst 12>, <&rst 13>; - reset-names = "phy", "mac"; - - phy-mode = "gmii"; - - fixed-link { - speed = <1000>; - full-duplex; - }; -}; diff --git a/target/linux/ath79/dts/ar7240_tl-wr740n-v2.dts b/target/linux/ath79/dts/ar7240_tl-wr740n-v2.dts deleted file mode 100644 index f86cb50d4..000000000 --- a/target/linux/ath79/dts/ar7240_tl-wr740n-v2.dts +++ /dev/null @@ -1,174 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "ar7240.dtsi" - -/ { - compatible = "tplink,tl-wr740n-v2", "qca,ar7240"; - model = "TP-Link TL-WR740N v2"; - - aliases { - led-status = &led_system; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x2000000>; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - linux,code = ; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&switch_led_pins>; - - led_system: system { - label = "tl-wr740n-v2:green:system"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "tl-wr740n-v2:green:lan1"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "tl-wr740n-v2:green:lan2"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - - lan3 { - label = "tl-wr740n-v2:green:lan3"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - lan4 { - label = "tl-wr740n-v2:green:lan4"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - - wan { - label = "tl-wr740n-v2:green:wan"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - }; - - wlan { - label = "tl-wr740n-v2:green:wlan"; - gpios = <&ath9k 1 GPIO_ACTIVE_LOW>; - default-state = "off"; - linux,default-trigger = "phy0tpt"; - }; - - wps { - label = "tl-wr740n-v2:green:wps"; - gpios = <&gpio 0 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - uboot: partition@0 { - reg = <0x0 0x20000>; - label = "u-boot"; - read-only; - }; - - firmware: partition@20000 { - reg = <0x20000 0x3d0000>; - label = "firmware"; - }; - - art: partition@3f0000 { - reg = <0x3f0000 0x10000>; - label = "art"; - read-only; - }; - }; - }; -}; - -ð0 { - status = "okay"; - - phy-handle = <&phy4>; - - mtd-mac-address = <&uboot 0x1fc00>; - mtd-mac-address-increment = <(-1)>; -}; - -ð1 { - status = "okay"; - - mtd-mac-address = <&uboot 0x1fc00>; - mtd-mac-address-increment = <1>; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "mii"; - }; -}; - -&pcie { - status = "okay"; - - ath9k: wifi@168c,002b { - compatible = "pci168c,002b"; - reg = <0x0000 0 0 0 0>; - qca,no-eeprom; - mtd-mac-address = <&uboot 0x1fc00>; - #gpio-cells = <2>; - gpio-controller; - }; -}; - -&pinmux { - switch_led_pins: pinmux_switch_led_pins { - pinctrl-single,bits = <0x0 0x0 0xf8>; - }; -}; - -&uart { - status = "okay"; -}; diff --git a/target/linux/ath79/dts/ar7241.dtsi b/target/linux/ath79/dts/ar7241.dtsi deleted file mode 100644 index 91ebea54e..000000000 --- a/target/linux/ath79/dts/ar7241.dtsi +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "ar724x.dtsi" - -/ { - usb_phy: usb-phy { - compatible = "qca,ar7200-usb-phy"; - - reset-names = "usb-phy", "usb-suspend-override"; - resets = <&rst 4>, <&rst 3>; - - #phy-cells = <0>; - - status = "disabled"; - }; -}; - -&gpio { - ngpios = <20>; -}; - -&ahb { - usb: usb@1b000000 { - compatible = "generic-ehci"; - reg = <0x1b000000 0x1000>; - - interrupts = <3>; - - resets = <&rst 5>; - reset-names = "usb-host"; - - has-transaction-translator; - caps-offset = <0x100>; - - phy-names = "usb-phy"; - phys = <&usb_phy>; - - status = "disabled"; - }; -}; - -&mdio0 { - regmap = <ð1>; - builtin-switch; - resets = <&rst 22>; - reset-names = "mdio"; -}; - -ð0 { - compatible = "qca,ar7241-eth", "syscon"; - - pll-data = <0x00110000 0x00001099 0x00991099>; - - resets = <&rst 8>, <&rst 9>; - reset-names = "mac", "phy"; -}; - -&mdio1 { - resets = <&rst 23>; - reset-names = "mdio"; - builtin-switch; -}; - -ð1 { - compatible = "qca,ar7241-eth", "syscon"; - - pll-data = <0x00110000 0x00001099 0x00991099>; - - resets = <&rst 12>, <&rst 13>; - reset-names = "mac", "phy"; - - phy-mode = "gmii"; - - fixed-link { - speed = <1000>; - full-duplex; - }; -}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts b/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts deleted file mode 100644 index 0de97ea93..000000000 --- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "ar7241_ubnt_xm.dtsi" - -/ { - compatible = "ubnt,bullet-m", "qca,ar7241"; - model = "Ubiquiti Bullet M"; -}; - -ð1 { - compatible = "syscon"; -}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_nano-m.dts b/target/linux/ath79/dts/ar7241_ubnt_nano-m.dts deleted file mode 100644 index 417e50312..000000000 --- a/target/linux/ath79/dts/ar7241_ubnt_nano-m.dts +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "ar7241_ubnt_xm.dtsi" - -/ { - compatible = "ubnt,nano-m", "qca,ar7241"; - model = "Ubiquiti Nanostation M"; -}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts deleted file mode 100644 index 36fa2750a..000000000 --- a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "ar7241_ubnt_xm.dtsi" - -/ { - compatible = "ubnt,rocket-m", "qca,ar7241"; - model = "Ubiquiti Rocket M"; -}; - -ð1 { - compatible = "syscon"; -}; - -&usb_phy { - status = "okay"; -}; - -&usb { - status = "okay"; -}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_unifi.dts b/target/linux/ath79/dts/ar7241_ubnt_unifi.dts deleted file mode 100644 index 1cb45e6af..000000000 --- a/target/linux/ath79/dts/ar7241_ubnt_unifi.dts +++ /dev/null @@ -1,142 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "ar7241.dtsi" - -/ { - compatible = "ubnt,unifi", "qca,ar7241"; - model = "Ubiquiti UniFi AP"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - extosc: ref { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <40000000>; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - - poll-interval = <20>; - button@0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - led@0 { - label = "ubnt:green:dome"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - }; - - led@1 { - label = "ubnt:orange:dome"; - gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&uart { - status = "okay"; -}; - -&pll { - clocks = <&extosc>; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "mx25l6405d"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@2 { - label = "firmware"; - reg = <0x050000 0x750000>; - }; - - partition@3 { - label = "board_config"; - reg = <0x7a0000 0x010000>; - read-only; - }; - - partition@4 { - label = "cfg"; - reg = <0x7b0000 0x040000>; - read-only; - }; - - art: partition@5 { - label = "art"; - reg = <0x7f0000 0x010000>; - read-only; - }; - }; - }; -}; - -&pcie { - status = "okay"; - - ath9k@0000 { - reg = <0x0000 0 0 0 0>; - qca,no-eeprom; - }; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "mii"; - }; -}; - -ð0 { - status = "okay"; - - mtd-mac-address = <&art 0x0>; - phy-handle = <&phy4>; -}; - -ð1 { - status = "okay"; - - compatible = "syscon"; -}; diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi b/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi deleted file mode 100644 index bea9adc5d..000000000 --- a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi +++ /dev/null @@ -1,153 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include -#include - -#include "ar7241.dtsi" - -/ { - compatible = "ubnt,xm", "qca,ar7241"; - model = "Ubiquiti Networks XM (rev 1.0) board"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x2000000>; - }; - -/* extosc: ref { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <40000000>; - }; -*/ - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - - poll-interval = <20>; - button@0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - led@0 { - label = "ubnt:red:link1"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - }; - - led@1 { - label = "ubnt:orange:link2"; - gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; - }; - - led@2 { - label = "ubnt:green:link3"; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - - led@3 { - label = "ubnt:green:link4"; - gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&uart { - status = "okay"; -}; - -/*&pll { - clocks = <&extosc>; -};*/ - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "mx25l6405d"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@2 { - label = "firmware"; - reg = <0x050000 0x750000>; - }; - - partition@3 { - label = "board_config"; - reg = <0x7a0000 0x010000>; - read-only; - }; - - partition@4 { - label = "cfg"; - reg = <0x7b0000 0x040000>; - read-only; - }; - - art: partition@5 { - label = "art"; - reg = <0x7f0000 0x010000>; - read-only; - }; - }; - }; -}; - -&pcie { - status = "okay"; - - ath9k@0000 { - reg = <0x0000 0 0 0 0>; - qca,no-eeprom; - }; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "mii"; - }; -}; - -ð0 { - status = "okay"; - - mtd-mac-address = <&art 0x0>; - - phy-mode = "mii"; - phy-handle = <&phy4>; -}; - -ð1 { - status = "okay"; - - mtd-mac-address = <&art 0x6>; -}; diff --git a/target/linux/ath79/dts/ar7242.dtsi b/target/linux/ath79/dts/ar7242.dtsi deleted file mode 100644 index a5909a9b3..000000000 --- a/target/linux/ath79/dts/ar7242.dtsi +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "ar724x.dtsi" - -/ { - usb_phy: usb-phy { - compatible = "qca,ar7200-usb-phy"; - - reset-names = "usb-phy", "usb-suspend-override"; - resets = <&rst 4>, <&rst 3>; - - #phy-cells = <0>; - - status = "disabled"; - }; -}; - -&gpio { - ngpios = <20>; -}; - -&ahb { - usb: usb@1b000000 { - compatible = "generic-ehci"; - reg = <0x1b000000 0x1000>; - - interrupts = <3>; - - resets = <&rst 5>; - reset-names = "usb-host"; - - has-transaction-translator; - caps-offset = <0x100>; - - phy-names = "usb-phy"; - phys = <&usb_phy>; - - status = "disabled"; - }; -}; - -&mdio0 { - resets = <&rst 22>; - reset-names = "mdio"; -}; - -ð0 { - compatible = "qca,ar7242-eth", "syscon"; - - pll-data = <0x16000000 0x00000101 0x00001616>; - pll-reg = <0x4 0x2c 17>; - pll-handle = <&pll>; - - resets = <&rst 8>, <&rst 9>; - reset-names = "mac", "phy"; -}; - -&mdio1 { - resets = <&rst 23>; - reset-names = "mdio"; - builtin-switch; -}; - -ð1 { - compatible = "qca,ar7242-eth", "syscon"; - - resets = <&rst 12>, <&rst 13>; - reset-names = "mac", "phy"; -}; diff --git a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts b/target/linux/ath79/dts/ar7242_avm_fritz300e.dts deleted file mode 100644 index f1ad138f4..000000000 --- a/target/linux/ath79/dts/ar7242_avm_fritz300e.dts +++ /dev/null @@ -1,169 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "ar7242.dtsi" - -/ { - compatible = "avm,fritz300e", "qca,ar7242"; - model = "AVM FRITZ!WLAN Repeater 300E"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - gpio-keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - linux,code = ; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power { - label = "fritz300e:green:power"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - lan { - label = "fritz300e:green:lan"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - wlan { - label = "fritz300e:green:wlan"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - }; - }; - - ath9k-leds { - compatible = "gpio-leds"; - - rssi0 { - label = "fritz300e:green:rssi0"; - gpios = <&ath9k 10 GPIO_ACTIVE_LOW>; - }; - - rssi1 { - label = "fritz300e:green:rssi1"; - gpios = <&ath9k 4 GPIO_ACTIVE_LOW>; - }; - - rssi2 { - label = "fritz300e:green:rssi2"; - gpios = <&ath9k 6 GPIO_ACTIVE_LOW>; - }; - - rssi3 { - label = "fritz300e:green:rssi3"; - gpios = <&ath9k 7 GPIO_ACTIVE_LOW>; - }; - - rssi4 { - label = "fritz300e:green:rssi4"; - gpios = <&ath9k 5 GPIO_ACTIVE_LOW>; - }; - }; - - eth-phy-reset { - compatible = "regulator-fixed"; - - regulator-name = "eth-phy-reset"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - - gpio = <&gpio 11 GPIO_ACTIVE_LOW>; - startup-delay-us = <300000>; - enable-active-high; - - regulator-always-on; - }; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x0 0x20000>; - label = "urloader"; - read-only; - }; - - partition@20000 { - reg = <0x20000 0xee0000>; - label = "firmware"; - }; - - partition@f00000 { - reg = <0xf00000 0x80000>; - label = "tffs (1)"; - read-only; - }; - - partition@f80000 { - reg = <0xf80000 0x80000>; - label = "tffs (2)"; - read-only; - }; - }; - }; -}; - -&uart { - status = "okay"; -}; - -&pcie { - status = "okay"; - - ath9k: wifi@0000 { - reg = <0x0000 0 0 0 0>; - #gpio-cells = <2>; - gpio-controller; - qca,no-eeprom; - }; -}; - -&mdio0 { - status = "okay"; - - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "rgmii"; - }; -}; - -ð0 { - status = "okay"; - - phy-mode = "rgmii"; - phy-handle = <&phy0>; - - pll-data = <0x16000000 0x00000101 0x00001313>; -}; diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts deleted file mode 100644 index 4e52e30b9..000000000 --- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g450h.dts +++ /dev/null @@ -1,127 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "ar7242.dtsi" - -/ { - compatible = "buffalo,wzr-hp-g450h", "qca,ar7242"; - model = "Buffalo WZR-HP-G450H"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - - poll-interval = <20>; - button@0 { - label = "usb"; - linux,code = ; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - button@1 { - label = "reset"; - linux,code = ; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - button@2 { - label = "movie_engine"; - linux,code = ; - gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; - debounce-interval = <60>; - }; - - button@3 { - label = "aoss"; - linux,code = ; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - button@4 { - label = "router_off"; - linux,code = ; - gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - debounce-interval = <60>; - }; - - }; - - leds { - compatible = "gpio-leds"; - led@0 { - label = "buffalo:orange:security"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - led@1 { - label = "buffalo:red:diag"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - }; - - gpio-export { - compatible = "gpio-export"; - #size-cells = <0>; - - gpio_usb_power { - gpio-export,name = "wzr-hp-g450h:usb-power"; - gpio-export,output = <1>; - gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&mdio0 { - status = "okay"; - phy-mask = <0x1>; - - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "rgmii"; - }; -}; - -ð0 { - status = "okay"; - - phy-mode = "rgmii"; - pll-data = <0x62000000 0 0>; - - fixed-link { - speed = <1000>; - full-duplex; - }; -}; - -&uart { - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&usb { - status = "okay"; -}; - -&pcie { - status = "okay"; - - ath9k@0000 { - reg = <0x0000 0 0 0 0>; - qca,no-eeprom; - }; -}; diff --git a/target/linux/ath79/dts/ar724x.dtsi b/target/linux/ath79/dts/ar724x.dtsi deleted file mode 100644 index b2844bf17..000000000 --- a/target/linux/ath79/dts/ar724x.dtsi +++ /dev/null @@ -1,154 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include -#include "ath79.dtsi" - -/ { - compatible = "qca,ar7240"; - - #address-cells = <1>; - #size-cells = <1>; - - chosen { - bootargs = "console=ttyS0,115200"; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "mips,mips24Kc"; - clocks = <&pll ATH79_CLK_CPU>; - reg = <0>; - }; - }; - - ahb: ahb { - apb { - ddr_ctrl: memory-controller@18000000 { - compatible = "qca,ar9132-ddr-controller", - "qca,ar7240-ddr-controller"; - reg = <0x18000000 0x100>; - - #qca,ddr-wb-channel-cells = <1>; - }; - - uart: uart@18020000 { - compatible = "ns16550a"; - reg = <0x18020000 0x20>; - interrupts = <3>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "uart"; - - reg-io-width = <4>; - reg-shift = <2>; - no-loopback-test; - - status = "disabled"; - }; - - gpio: gpio@18040000 { - compatible = "qca,ar7240-gpio", - "qca,ar7100-gpio"; - reg = <0x18040000 0x30>; - interrupts = <2>; - - ngpios = <18>; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-controller; - #interrupt-cells = <2>; - }; - - pinmux: pinmux@18040028 { - compatible = "pinctrl-single"; - - reg = <0x18040028 0x8>; - - pinctrl-single,bit-per-mux; - pinctrl-single,register-width = <32>; - pinctrl-single,function-mask = <0x1>; - #pinctrl-cells = <2>; - - jtag_disable_pins: pinmux_jtag_disable_pins { - pinctrl-single,bits = <0x0 0x1 0x1>; - }; - }; - - pll: pll-controller@18050000 { - compatible = "qca,ar7240-pll", "syscon"; - reg = <0x18050000 0x3c>; - - clock-names = "ref"; - /* The board must provides the ref clock */ - - #clock-cells = <1>; - clock-output-names = "cpu", "ddr", "ahb"; - }; - - wdt: wdt@18060008 { - compatible = "qca,ar7130-wdt"; - reg = <0x18060008 0x8>; - - interrupts = <4>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "wdt"; - }; - - rst: reset-controller@1806001c { - compatible = "qca,ar7240-reset", - "qca,ar7100-reset"; - reg = <0x1806001c 0x4>; - - #reset-cells = <1>; - }; - - pcie: pcie-controller@180c0000 { - compatible = "qcom,ar7240-pci"; - #address-cells = <3>; - #size-cells = <2>; - bus-range = <0x0 0x0>; - reg = <0x180c0000 0x1000>, /* CRP */ - <0x180f0000 0x100>, /* CTRL */ - <0x14000000 0x1000>; /* CFG */ - reg-names = "crp_base", "ctrl_base", "cfg_base"; - ranges = <0x2000000 0 0x10000000 0x10000000 0 0x04000000 /* pci memory */ - 0x1000000 0 0x00000000 0x0000000 0 0x000001>; /* io space */ - interrupt-parent = <&cpuintc>; - interrupts = <2>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-map-mask = <0 0 0 1>; - interrupt-map = <0 0 0 0 &pcie 0>; - status = "disabled"; - }; - }; - - spi: spi@1f000000 { - compatible = "qca,ar7240-spi", - "qca,ar7100-spi"; - reg = <0x1f000000 0x10>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "ahb"; - - status = "disabled"; - - #address-cells = <1>; - #size-cells = <0>; - }; - }; -}; - -&cpuintc { - qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>; - qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>, - <&ddr_ctrl 0>, <&ddr_ctrl 1>; -}; diff --git a/target/linux/ath79/dts/ar9132.dtsi b/target/linux/ath79/dts/ar9132.dtsi deleted file mode 100644 index d079811fe..000000000 --- a/target/linux/ath79/dts/ar9132.dtsi +++ /dev/null @@ -1,196 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include "ath79.dtsi" - -/ { - compatible = "qca,ar9132"; - - #address-cells = <1>; - #size-cells = <1>; - - chosen { - bootargs = "console=ttyS0,115200"; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "mips,mips24Kc"; - clocks = <&pll ATH79_CLK_CPU>; - reg = <0>; - }; - }; - - cpuintc: interrupt-controller { - compatible = "qca,ar9132-cpu-intc", "qca,ar7100-cpu-intc"; - - interrupt-controller; - #interrupt-cells = <1>; - - qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>; - qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>, - <&ddr_ctrl 0>, <&ddr_ctrl 1>; - }; - - ahb { - compatible = "simple-bus"; - ranges; - - #address-cells = <1>; - #size-cells = <1>; - - interrupt-parent = <&cpuintc>; - - apb { - compatible = "simple-bus"; - ranges; - - #address-cells = <1>; - #size-cells = <1>; - - interrupt-parent = <&miscintc>; - - ddr_ctrl: memory-controller@18000000 { - compatible = "qca,ar9132-ddr-controller", - "qca,ar7240-ddr-controller"; - reg = <0x18000000 0x100>; - - #qca,ddr-wb-channel-cells = <1>; - }; - - uart: uart@18020000 { - compatible = "ns8250"; - reg = <0x18020000 0x20>; - interrupts = <3>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "uart"; - - reg-io-width = <4>; - reg-shift = <2>; - no-loopback-test; - - status = "disabled"; - }; - - gpio: gpio@18040000 { - compatible = "qca,ar9132-gpio", - "qca,ar7100-gpio"; - reg = <0x18040000 0x30>; - interrupts = <2>; - - ngpios = <22>; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-controller; - #interrupt-cells = <2>; - }; - - pll: pll-controller@18050000 { - compatible = "qca,ar9132-pll", - "qca,ar9130-pll"; - reg = <0x18050000 0x20>; - - clock-names = "ref"; - /* The board must provides the ref clock */ - - #clock-cells = <1>; - clock-output-names = "cpu", "ddr", "ahb"; - }; - - wdt: wdt@18060008 { - compatible = "qca,ar7130-wdt"; - reg = <0x18060008 0x8>; - - interrupts = <4>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "wdt"; - }; - - miscintc: interrupt-controller@18060010 { - compatible = "qca,ar9132-misc-intc", - "qca,ar7100-misc-intc"; - reg = <0x18060010 0x8>; - - interrupt-parent = <&cpuintc>; - interrupts = <6>; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - rst: reset-controller@1806001c { - compatible = "qca,ar9132-reset", - "qca,ar7100-reset"; - reg = <0x1806001c 0x4>; - - #reset-cells = <1>; - }; - }; - - usb: usb@1b000100 { - compatible = "qca,ar7100-ehci", "generic-ehci"; - reg = <0x1b000100 0x100>; - - interrupts = <3>; - resets = <&rst 5>; - - has-transaction-translator; - - phy-names = "usb"; - phys = <&usb_phy>; - - status = "disabled"; - }; - - spi: spi@1f000000 { - compatible = "qca,ar9132-spi", "qca,ar7100-spi"; - reg = <0x1f000000 0x10>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "ahb"; - - status = "disabled"; - - #address-cells = <1>; - #size-cells = <0>; - }; - - wmac: wmac@180c0000 { - compatible = "qca,ar9130-wmac"; - reg = <0x180c0000 0x230000>; - - interrupts = <2>; - - status = "disabled"; - }; - }; - - usb_phy: usb-phy { - compatible = "qca,ar7200-usb-phy"; - - reset-names = "usb-phy", "usb-suspend-override"; - resets = <&rst 4>, <&rst 3>; - - #phy-cells = <0>; - - status = "disabled"; - }; -}; - -ð0 { - compatible = "qca,ar9130-eth", "syscon"; - reg = <0x19000000 0x200 - 0x18070000 0x4>; - pll-data = <0x1a000000 0x13000a44 0x00441099>; - pll-reg = <0x4 0x10 17>; - pll-handle = <&pll>; - resets = <&rst 8>, <&rst 9>; - reset-names = "phy", "mac"; -}; diff --git a/target/linux/ath79/dts/ar9132_tl-wr1043nd-v1.dts b/target/linux/ath79/dts/ar9132_tl-wr1043nd-v1.dts deleted file mode 100644 index 97ad5ac20..000000000 --- a/target/linux/ath79/dts/ar9132_tl-wr1043nd-v1.dts +++ /dev/null @@ -1,178 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/dts-v1/; - -#include -#include - -#include "ar9132.dtsi" - -/ { - compatible = "tplink,tl-wr1043nd-v1", "qca,ar9132"; - model = "TP-Link TL-WR1043ND Version 1"; - - aliases { - led-status = &system; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x2000000>; - }; - - extosc: ref { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <40000000>; - }; - - keys { - compatible = "gpio-keys"; - #address-cells = <1>; - #size-cells = <0>; - - button0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - button1 { - label = "qss"; - linux,code = ; - gpios = <&gpio 7 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - usb { - label = "tp-link:green:usb"; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - default-state = "off"; - trigger-sources = <&hub_port>; - linux,default-trigger = "usbport"; - }; - - system: system { - label = "tp-link:green:system"; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - linux,default-trigger = "heartbeat"; - }; - - qss { - label = "tp-link:green:qss"; - gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; - }; - - wlan { - label = "tp-link:green:wlan"; - gpios = <&gpio 9 GPIO_ACTIVE_LOW>; - default-state = "off"; - linux,default-trigger = "phy0tpt"; - }; - }; - - rtl8366rb { - compatible = "realtek,rtl8366rb"; - gpio-sda = <&gpio 18 GPIO_ACTIVE_HIGH>; - gpio-sck = <&gpio 19 GPIO_ACTIVE_HIGH>; - - resets = <&rst 8>; - reset-names = "switch"; - - mdio-bus { - status = "okay"; - - phy0: ethernet-phy@0 { - reg = <0>; - }; - }; - }; - -}; - -&uart { - status = "okay"; -}; - -&pll { - clocks = <&extosc>; -}; - -&usb { - status = "okay"; - - port@1 { - reg = <1>; - #trigger-source-cells = <0>; - - hub_port: port@1 { - reg = <1>; - #trigger-source-cells = <0>; - }; - }; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - uboot: partition@0 { - label = "u-boot"; - reg = <0x000000 0x020000>; - read-only; - }; - - partition@020000 { - label = "firmware"; - reg = <0x020000 0x7D0000>; - }; - - art: partition@7F0000 { - label = "art"; - reg = <0x7F0000 0x010000>; - read-only; - }; - }; - }; -}; - -ð0 { - status = "okay"; - - phy-mode = "rgmii"; - mtd-mac-address = <&uboot 0x1fc00>; - - resets = <&rst 9>; - reset-names = "mac"; - - phy-handle = <&phy0>; - fixed-link { - speed = <1000>; - full-duplex; - }; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&uboot 0x1fc00>; -}; diff --git a/target/linux/ath79/dts/ar9330.dtsi b/target/linux/ath79/dts/ar9330.dtsi deleted file mode 100644 index 0c3035489..000000000 --- a/target/linux/ath79/dts/ar9330.dtsi +++ /dev/null @@ -1,169 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include -#include "ath79.dtsi" - -/ { - compatible = "qca,ar9330"; - - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "mips,mips24Kc"; - clocks = <&pll ATH79_CLK_CPU>; - reg = <0>; - }; - }; - - chosen { - bootargs = "console=ttyATH0,115200"; - }; - - ahb { - apb { - ddr_ctrl: memory-controller@18000000 { - compatible = "qca,ar7240-ddr-controller"; - reg = <0x18000000 0x100>; - - #qca,ddr-wb-channel-cells = <1>; - }; - - uart: uart@18020000 { - compatible = "qca,ar9330-uart"; - reg = <0x18020000 0x14>; - - interrupts = <3>; - - clocks = <&pll ATH79_CLK_REF>; - clock-names = "uart"; - - status = "disabled"; - }; - - gpio: gpio@18040000 { - compatible = "qca,ar7100-gpio"; - reg = <0x18040000 0x34>; - interrupts = <2>; - - ngpios = <30>; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-controller; - #interrupt-cells = <2>; - - status = "disabled"; - }; - - pll: pll-controller@18050000 { - compatible = "qca,ar9330-pll"; - reg = <0x18050000 0x100>; - - #clock-cells = <1>; - }; - - rst: reset-controller@1806001c { - compatible = "qca,ar7100-reset"; - reg = <0x1806001c 0x4>; - - #reset-cells = <1>; - }; - }; - - usb: usb@1b000100 { - compatible = "chipidea,usb2"; - reg = <0x1b000000 0x200>; - - interrupts = <3>; - resets = <&rst 5>; - reset-names = "usb-host"; - - phy-names = "usb-phy"; - phys = <&usb_phy>; - - status = "disabled"; - }; - - spi: spi@1f000000 { - compatible = "qca,ar7100-spi"; - reg = <0x1f000000 0x10>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "ahb"; - - #address-cells = <1>; - #size-cells = <0>; - - status = "disabled"; - }; - - gmac: gmac@18070000 { - compatible = "qca,ar9330-gmac"; - reg = <0x18070000 0x4>; - }; - - wmac: wmac@18100000 { - compatible = "qca,ar9330-wmac"; - reg = <0x18100000 0x20000>; - - interrupts = <2>; - - status = "disabled"; - }; - }; - - usb_phy: usb-phy { - compatible = "qca,ar7200-usb-phy"; - - reset-names = "usb-phy", "usb-suspend-override"; - resets = <&rst 4>, <&rst 3>; - - #phy-cells = <0>; - - status = "disabled"; - }; -}; - -&cpuintc { - qca,ddr-wb-channel-interrupts = <2>, <3>; - qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>; -}; - -ð0 { - compatible = "qca,ar9330-eth", "syscon"; - - pll-data = <0x00110000 0x00001099 0x00991099>; - - resets = <&rst 9>; - reset-names = "mac"; -}; - -&mdio0 { - regmap = <ð1>; - builtin-switch; - resets = <&rst 23>; - reset-names = "mdio"; -}; - -&mdio1 { - resets = <&rst 23>; - reset-names = "mdio"; - - builtin-switch; -}; - -ð1 { - compatible = "qca,ar9330-eth", "syscon"; - - pll-data = <0x00110000 0x00001099 0x00991099>; - phy-mode = "gmii"; - - resets = <&rst 13>; - reset-names = "mac"; -}; diff --git a/target/linux/ath79/dts/ar9330_glinet_ar150.dts b/target/linux/ath79/dts/ar9330_glinet_ar150.dts deleted file mode 100644 index a7dab8355..000000000 --- a/target/linux/ath79/dts/ar9330_glinet_ar150.dts +++ /dev/null @@ -1,168 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "ar9330.dtsi" - -/ { - model = "GL.iNet GL-AR150"; - compatible = "glinet,ar150", "qca,ar9330"; - - aliases { - serial0 = &uart; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - leds { - compatible = "gpio-leds"; - - wlan { - label = "gl-ar150:orange:wlan"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - lan { - label = "gl-ar150:green:lan"; - gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - wan { - label = "gl-ar150:green:wan"; - gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - manual { - label = "manual"; - linux,code = ; - gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; - }; - - auto { - label = "auto"; - linux,code = ; - gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; - }; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - status = "okay"; -}; - -&usb_phy { - status = "okay"; - gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - spiflash { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@2 { - label = "firmware"; - reg = <0x050000 0xfa0000>; - }; - - art: partition@3 { - label = "ART"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "mii"; - }; -}; - -ð0 { - status = "okay"; - - mtd-mac-address = <&art 0x0>; - - phy-handle = <&phy4>; -}; - -ð1 { - status = "okay"; - - mtd-mac-address = <&art 0x0>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - - gmac-config { - device = <&gmac>; - - switch-phy-addr-swap = <0>; - switch-phy-swap = <0>; - }; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&art 0x0>; -}; diff --git a/target/linux/ath79/dts/ar9331.dtsi b/target/linux/ath79/dts/ar9331.dtsi deleted file mode 100644 index b29c88a95..000000000 --- a/target/linux/ath79/dts/ar9331.dtsi +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "ar9330.dtsi" - -/ { - compatible = "qca,ar9331"; -}; diff --git a/target/linux/ath79/dts/ar9331_dpt_module.dts b/target/linux/ath79/dts/ar9331_dpt_module.dts deleted file mode 100644 index dc4df6b27..000000000 --- a/target/linux/ath79/dts/ar9331_dpt_module.dts +++ /dev/null @@ -1,79 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - model = "DPTechnics DPT-Module"; - compatible = "dptechnics,dpt-module", "qca,ar9331"; - - aliases { - serial0 = &uart; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - leds { - compatible = "gpio-leds"; - - system { - label = "dpt-module:green:system"; - gpios = <&gpio 27 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - button@0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&ref { - clock-frequency = <25000000>; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - /* Winbond 25Q128FVSG SPI flash */ - spiflash: w25q128@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "winbond,w25q128", "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - }; -}; diff --git a/target/linux/ath79/dts/ar9331_dragino_ms14.dts b/target/linux/ath79/dts/ar9331_dragino_ms14.dts deleted file mode 100644 index 9fb674eb2..000000000 --- a/target/linux/ath79/dts/ar9331_dragino_ms14.dts +++ /dev/null @@ -1,103 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - model = "Dragino MS14 (Dragino 2)"; - compatible = "dragino,ms14", "qca,ar9331"; - - aliases { - serial0 = &uart; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - leds { - compatible = "gpio-leds"; - - wlan { - label = "dragino2:red:wlan"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - lan { - label = "dragino2:red:lan"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - wan { - label = "dragino2:red:wan"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - system { - label = "dragino2:red:system"; - gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - button@0 { - label = "jumpstart"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - - button@1 { - label = "reset"; - linux,code = ; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&ref { - clock-frequency = <25000000>; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - /* Winbond 25Q128BVFG SPI flash */ - spiflash: w25q128@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "winbond,w25q128", "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - }; -}; diff --git a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts b/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts deleted file mode 100644 index 4b204b756..000000000 --- a/target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts +++ /dev/null @@ -1,130 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - model = "Embedded Wireless Dorin"; - compatible = "embeddedwireless,dorin", "qca,ar9331"; - - aliases { - serial0 = &uart; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - leds { - compatible = "gpio-leds"; - - status { - label = "dorin:green:status"; - gpios = <&gpio 21 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - wps { - label = "wps"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - spiflash { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@2 { - label = "firmware"; - reg = <0x050000 0xfa0000>; - }; - - art: partition@3 { - label = "ART"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -ð1 { - status = "okay"; - - mtd-mac-address = <&art 0x1002>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - - gmac-config { - device = <&gmac>; - - switch-phy-addr-swap = <1>; - switch-phy-swap = <1>; - }; -}; - -&mdio1 { - status = "okay"; -}; diff --git a/target/linux/ath79/dts/ar9331_omega.dts b/target/linux/ath79/dts/ar9331_omega.dts deleted file mode 100644 index 32551427e..000000000 --- a/target/linux/ath79/dts/ar9331_omega.dts +++ /dev/null @@ -1,79 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - model = "Onion Omega"; - compatible = "onion,omega", "qca,ar9331"; - - aliases { - serial0 = &uart; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x4000000>; - }; - - leds { - compatible = "gpio-leds"; - - system { - label = "onion:amber:system"; - gpios = <&gpio 27 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - button@0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&ref { - clock-frequency = <25000000>; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - /* Winbond 25Q128FVSG SPI flash */ - spiflash: w25q128@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "winbond,w25q128", "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - }; -}; diff --git a/target/linux/ath79/dts/ar9331_tl-wr703n.dts b/target/linux/ath79/dts/ar9331_tl-wr703n.dts deleted file mode 100644 index 70f94ed4c..000000000 --- a/target/linux/ath79/dts/ar9331_tl-wr703n.dts +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - compatible = "tplink,tl-wr703n", "qca,ar9331"; - model = "TP-Link TL-WR703N"; - - aliases { - serial0 = &uart; - led-status = &led_system; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x2000000>; - }; - - gpio-keys-polled { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - led_system: system { - label = "tl-wr703n:blue:system"; - gpios = <&gpio 27 GPIO_ACTIVE_LOW>; - }; - }; - - reg_usb_vbus: reg_usb_vbus { - compatible = "regulator-fixed"; - regulator-name = "usb_vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; - -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - uboot: partition@0 { - reg = <0x0 0x20000>; - label = "u-boot"; - read-only; - }; - - firmware: partition@20000 { - reg = <0x20000 0x3d0000>; - label = "firmware"; - }; - - art: partition@3f0000 { - reg = <0x3f0000 0x10000>; - label = "art"; - read-only; - }; - }; - }; -}; - -ð0 { - status = "okay"; - - phy-handle = <&phy4>; - - mtd-mac-address = <&uboot 0x1fc00>; - - gmac-config { - device = <&gmac>; - - switch-phy-addr-swap = <0>; - switch-phy-swap = <0>; - }; -}; - -&gpio { - status = "okay"; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "mii"; - }; -}; - -&uart { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - vbus-supply = <®_usb_vbus>; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&wmac { - status = "okay"; - mtd-cal-data = <&art 0x1000>; - mtd-mac-address = <&uboot 0x1fc00>; -}; diff --git a/target/linux/ath79/dts/ar9331_tl_mr3020.dts b/target/linux/ath79/dts/ar9331_tl_mr3020.dts deleted file mode 100644 index 34ee805b3..000000000 --- a/target/linux/ath79/dts/ar9331_tl_mr3020.dts +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/dts-v1/; - -#include -#include - -#include "ar9331.dtsi" - -/ { - model = "TP-Link TL-MR3020"; - compatible = "tplink,tl-mr3020", "qca,ar9331"; - - aliases { - serial0 = &uart; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x2000000>; - }; - - leds { - compatible = "gpio-leds"; - - wlan { - label = "tp-link:green:wlan"; - gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; - default-state = "off"; - }; - - lan { - label = "tp-link:green:lan"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - wps { - label = "tp-link:green:wps"; - gpios = <&gpio 26 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - led3g { - label = "tp-link:green:3g"; - gpios = <&gpio 27 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - button@0 { - label = "wps"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - }; - - button@1 { - label = "sw1"; - linux,code = ; - gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; - }; - - button@2 { - label = "sw2"; - linux,code = ; - gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; - }; - }; - - reg_usb_vbus: reg_usb_vbus { - compatible = "regulator-fixed"; - regulator-name = "usb_vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - gpio = <&gpio 8 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; -}; - -&ref { - clock-frequency = <25000000>; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&usb { - dr_mode = "host"; - vbus-supply = <®_usb_vbus>; - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; - -&spi { - num-chipselects = <1>; - status = "okay"; - - /* Spansion S25FL032PIF SPI flash */ - spiflash: s25sl032p@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "spansion,s25sl032p", "jedec,spi-nor"; - spi-max-frequency = <104000000>; - reg = <0>; - }; -}; diff --git a/target/linux/ath79/dts/ar9344.dtsi b/target/linux/ath79/dts/ar9344.dtsi deleted file mode 100644 index 655ab35d7..000000000 --- a/target/linux/ath79/dts/ar9344.dtsi +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "ar934x.dtsi" - -/ { - compatible = "qca,ar9344"; -}; - -&apb { - pcie: pcie-controller@180c0000 { - compatible = "qcom,ar9340-pci", "qcom,ar7240-pci"; - #address-cells = <3>; - #size-cells = <2>; - bus-range = <0x0 0x0>; - reg = <0x180c0000 0x1000>, /* CRP */ - <0x180f0000 0x100>, /* CTRL */ - <0x14000000 0x1000>; /* CFG */ - reg-names = "crp_base", "ctrl_base", "cfg_base"; - ranges = <0x2000000 0 0x10000000 0x10000000 0 0x04000000 /* pci memory */ - 0x1000000 0 0x00000000 0x0000000 0 0x000001>; /* io space */ - interrupt-parent = <&cpuintc>; - interrupts = <2>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-map-mask = <0 0 0 1>; - interrupt-map = <0 0 0 0 &pcie 0>; - - status = "disabled"; - }; -}; diff --git a/target/linux/ath79/dts/ar9344_tl-wdr3600.dts b/target/linux/ath79/dts/ar9344_tl-wdr3600.dts deleted file mode 100644 index d0886ee86..000000000 --- a/target/linux/ath79/dts/ar9344_tl-wdr3600.dts +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "ar9344_tl-wdr4300.dtsi" - -/ { - model = "TP-Link WDR3600"; - compatible = "tplink,tl-wdr3600"; -}; diff --git a/target/linux/ath79/dts/ar9344_tl-wdr4300.dts b/target/linux/ath79/dts/ar9344_tl-wdr4300.dts deleted file mode 100644 index 617da5709..000000000 --- a/target/linux/ath79/dts/ar9344_tl-wdr4300.dts +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include "ar9344_tl-wdr4300.dtsi" - -/ { - model = "TP-Link WDR4300"; - compatible = "tplink,tl-wdr4300"; -}; diff --git a/target/linux/ath79/dts/ar9344_tl-wdr4300.dtsi b/target/linux/ath79/dts/ar9344_tl-wdr4300.dtsi deleted file mode 100644 index e7f24bfe3..000000000 --- a/target/linux/ath79/dts/ar9344_tl-wdr4300.dtsi +++ /dev/null @@ -1,240 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include -#include - -#include "ar9344.dtsi" - -/ { - model = "TP-Link WDR4300"; - compatible = "tplink,tl-wdr4300"; - - aliases { - led-status = &system; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x8000000>; - }; - - leds { - compatible = "gpio-leds"; - - usb1 { - label = "tp-link:green:usb1"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - default-state = "off"; - trigger-sources = <&hub_port1>; - linux,default-trigger = "usbport"; - }; - - usb2 { - label = "tp-link:green:usb2"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - default-state = "off"; - trigger-sources = <&hub_port2>; - linux,default-trigger = "usbport"; - }; - - wlan2g { - label = "tp-link:green:wlan2g"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - default-state = "off"; - linux,default-trigger = "phy0tpt"; - }; - - system: system { - label = "tp-link:green:system"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - - qss { - label = "tp-link:green:qss"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - }; - - ath9k-leds { - compatible = "gpio-leds"; - - wlan5g { - label = "tp-link:green:wlan5g"; - gpios = <&ath9k 0 GPIO_ACTIVE_LOW>; - default-state = "off"; - linux,default-trigger = "phy1tpt"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - button@0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - button@1 { - label = "wifi"; - linux,code = ; - linux,input-type = ; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - gpio-export { - compatible = "gpio-export"; - #size-cells = <0>; - - gpio_usb1_power { - gpio-export,name = "tp-link:power:usb1"; - gpio-export,output = <1>; - gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; - }; - - gpio_usb2_power { - gpio-export,name = "tp-link:power:usb2"; - gpio-export,output = <1>; - gpios = <&gpio 21 GPIO_ACTIVE_HIGH>; - }; - - gpio_ext_lna0 { - gpio-export,name = "tp-link:ext:lna0"; - gpio-export,output = <1>; - gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; - }; - - gpio_ext_lna1 { - gpio-export,name = "tp-link:ext:lna1"; - gpio-export,output = <1>; - gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&ref { - clock-frequency = <40000000>; -}; - -&uart { - status = "okay"; -}; - -&gpio { - status = "okay"; -}; - -&spi { - num-cs = <1>; - - status = "okay"; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - uboot: partition@0 { - label = "u-boot"; - reg = <0x000000 0x020000>; - read-only; - }; - - partition@20000 { - label = "firmware"; - reg = <0x020000 0x7d0000>; - }; - - partition@7f0000 { - label = "art"; - reg = <0x7f0000 0x010000>; - read-only; - }; - }; - }; -}; - -&usb { - status = "okay"; - - port@1 { - reg = <1>; - #trigger-source-cells = <0>; - - hub_port1: port@1 { - reg = <1>; - #trigger-source-cells = <0>; - }; - - hub_port2: port@2 { - reg = <2>; - #trigger-source-cells = <0>; - }; - }; -}; - -&usb_phy { - status = "okay"; -}; - -&pcie { - status = "okay"; - - ath9k: wifi@168c,0033 { - compatible = "pci168c,0033"; - reg = <0x0000 0 0 0 0>; - mtd-mac-address = <&uboot 0x1fc00>; - qca,no-eeprom; - #gpio-cells = <2>; - gpio-controller; - }; -}; - -&mdio0 { - status = "okay"; - - phy-mask = <0>; - - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "rgmii"; - - qca,ar8327-initvals = < - 0x04 0x07600000 /* PORT0 PAD MODE CTRL */ - 0x10 0x80000080 /* POWER_ON_STRIP */ - 0x50 0xc737c737 /* LED_CTRL0 */ - 0x54 0x00000000 /* LED_CTRL1 */ - 0x58 0x00000000 /* LED_CTRL2 */ - 0x5c 0x0030c300 /* LED_CTRL3 */ - 0x7c 0x0000007e /* PORT0_STATUS */ - >; - }; -}; - -ð0 { - status = "okay"; - - /* default for ar934x, except for 1000M */ - pll-data = <0x06000000 0x00000101 0x00001616>; - - mtd-mac-address = <&uboot 0x1fc00>; - mtd-mac-address-increment = <(-2)>; - - phy-mode = "rgmii"; - phy-handle = <&phy0>; -}; diff --git a/target/linux/ath79/dts/ar934x.dtsi b/target/linux/ath79/dts/ar934x.dtsi deleted file mode 100644 index b8a915f36..000000000 --- a/target/linux/ath79/dts/ar934x.dtsi +++ /dev/null @@ -1,219 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include - -#include "ath79.dtsi" - -/ { - compatible = "qca,ar9340"; - - #address-cells = <1>; - #size-cells = <1>; - - chosen { - bootargs = "console=ttyS0,115200"; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "mips,mips74Kc"; - clocks = <&pll ATH79_CLK_CPU>; - reg = <0>; - }; - }; - - clocks { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - ref: ref { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-output-names = "ref"; - }; - }; - - ahb { - compatible = "simple-bus"; - ranges; - - #address-cells = <1>; - #size-cells = <1>; - - apb: apb { - compatible = "simple-bus"; - ranges; - - #address-cells = <1>; - #size-cells = <1>; - - ddr_ctrl: memory-controller@18000000 { - compatible = "qca,ar9340-ddr-controller", - "qca,ar7240-ddr-controller"; - reg = <0x18000000 0x12c>; - - #qca,ddr-wb-channel-cells = <1>; - }; - - uart: uart@18020000 { - compatible = "ns16550a"; - reg = <0x18020000 0x2c>; - - interrupts = <3>; - - clocks = <&pll ATH79_CLK_REF>; - clock-names = "uart"; - - reg-io-width = <4>; - reg-shift = <2>; - no-loopback-test; - - status = "disabled"; - }; - - gpio: gpio@18040000 { - compatible = "qca,ar9340-gpio"; - reg = <0x18040000 0x2c>; - - interrupts = <2>; - ngpios = <23>; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-controller; - #interrupt-cells = <2>; - }; - - pinmux: pinmux@1804002c { - compatible = "pinctrl-single"; - - reg = <0x1804002c 0x44>; - - #size-cells = <0>; - - pinctrl-single,bit-per-mux; - pinctrl-single,register-width = <32>; - pinctrl-single,function-mask = <0x1>; - #pinctrl-cells = <2>; - - jtag_disable_pins: pinmux_jtag_disable_pins { - pinctrl-single,bits = <0x40 0x2 0x2>; - }; - }; - - pll: pll-controller@18050000 { - compatible = "qca,ar9340-pll", "syscon"; - reg = <0x18050000 0x4c>; - - #clock-cells = <1>; - clocks = <&ref>; - clock-names = "ref"; - clock-output-names = "cpu", "ddr", "ahb"; - }; - - wdt: wdt@18060008 { - compatible = "qca,ar9340-wdt", "qca,ar7130-wdt"; - reg = <0x18060008 0x8>; - - interrupts = <4>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "wdt"; - }; - - rst: reset-controller@1806001c { - compatible = "qca,ar9340-reset", "qca,ar7100-reset"; - reg = <0x1806001c 0x4>; - - #reset-cells = <1>; - }; - - gmac: gmac@18070000 { - compatible = "qca,ar9340-gmac", "qca,ar9330-gmac"; - reg = <0x18070000 0x14>; - }; - }; - - usb: usb@1b000000 { - compatible = "generic-ehci"; - reg = <0x1b000000 0x1d8>; - - interrupts = <3>; - resets = <&rst 5>; - reset-names = "usb-host"; - - has-transaction-translator; - caps-offset = <0x100>; - - phy-names = "usb-phy"; - phys = <&usb_phy>; - - status = "disabled"; - }; - - spi: spi@1f000000 { - compatible = "qca,ar9340-spi", "qca,ar7100-spi"; - reg = <0x1f000000 0x1c>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "ahb"; - - #address-cells = <1>; - #size-cells = <0>; - - status = "disabled"; - }; - }; - - usb_phy: usb-phy { - compatible = "qca,ar9340-usb-phy", "qca,ar7200-usb-phy"; - - reset-names = "usb-phy", "usb-suspend-override"; - resets = <&rst 4>, <&rst 3>; - - #phy-cells = <0>; - - status = "disabled"; - }; -}; - -&cpuintc { - qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>; - qca,ddr-wb-channels = <&ddr_ctrl 3>, <&ddr_ctrl 2>, - <&ddr_ctrl 0>, <&ddr_ctrl 1>; -}; - -&mdio0 { - resets = <&rst 22>; - reset-names = "mdio"; -}; - -ð0 { - compatible = "qca,ar9340-eth", "syscon"; - - pll-data = <0x16000000 0x00000101 0x00001616>; - pll-reg = <0x4 0x2c 17>; - pll-handle = <&pll>; - - resets = <&rst 8>, <&rst 9>; - reset-names = "mac", "phy"; -}; - -&mdio1 { - resets = <&rst 23>; - reset-names = "mdio"; - builtin-switch; -}; - -ð1 { - compatible = "qca,ar9340-eth", "syscon"; - - resets = <&rst 12>, <&rst 13>; - reset-names = "mac", "phy"; -}; diff --git a/target/linux/ath79/dts/ath79.dtsi b/target/linux/ath79/dts/ath79.dtsi deleted file mode 100644 index baf348207..000000000 --- a/target/linux/ath79/dts/ath79.dtsi +++ /dev/null @@ -1,81 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/ { - #address-cells = <1>; - #size-cells = <1>; - - cpuintc: interrupt-controller { - compatible = "qca,ar7100-cpu-intc"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - ahb { - compatible = "simple-bus"; - ranges; - - #address-cells = <1>; - #size-cells = <1>; - - interrupt-parent = <&cpuintc>; - - apb { - compatible = "simple-bus"; - ranges; - - #address-cells = <1>; - #size-cells = <1>; - - interrupt-parent = <&miscintc>; - - miscintc: interrupt-controller@18060010 { - compatible = "qca,ar7240-misc-intc"; - reg = <0x18060010 0x4>; - - interrupt-parent = <&cpuintc>; - interrupts = <6>; - - interrupt-controller; - #interrupt-cells = <1>; - }; - }; - - eth0: eth@19000000 { - status = "disabled"; - - compatible = "qca,ath79-eth", "syscon"; - reg = <0x19000000 0x200>; - - interrupts = <4>; - phy-mode = "mii"; - - mdio0: mdio-bus { - status = "disabled"; - - regmap = <ð0>; - - clocks = <&pll ATH79_CLK_MDIO>; - clock-names = "ref"; - }; - }; - - eth1: eth@1a000000 { - status = "disabled"; - - compatible = "qca,ath79-eth", "syscon"; - reg = <0x1a000000 0x200>; - - interrupts = <5>; - phy-mode = "mii"; - - mdio1: mdio-bus { - status = "disabled"; - - regmap = <ð1>; - - clocks = <&pll ATH79_CLK_MDIO>; - clock-names = "ref"; - }; - }; - }; -}; diff --git a/target/linux/ath79/dts/qca9557.dtsi b/target/linux/ath79/dts/qca9557.dtsi deleted file mode 100644 index 605855237..000000000 --- a/target/linux/ath79/dts/qca9557.dtsi +++ /dev/null @@ -1,201 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include -#include "ath79.dtsi" - -/ { - compatible = "qca,qca9557"; - - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "mips,mips24Kc"; - clocks = <&pll ATH79_CLK_CPU>; - reg = <0>; - }; - }; - - ahb { - apb { - ddr_ctrl: memory-controller@18000000 { - compatible = "qca,ar9557-ddr-controller", - "qca,ar7240-ddr-controller"; - reg = <0x18000000 0x100>; - - #qca,ddr-wb-channel-cells = <1>; - }; - - uart: uart@18020000 { - compatible = "ns16550a"; - reg = <0x18020000 0x20>; - - interrupts = <3>; - - clocks = <&pll ATH79_CLK_REF>; - clock-names = "uart"; - - reg-io-width = <4>; - reg-shift = <2>; - no-loopback-test; - - status = "disabled"; - }; - - gpio: gpio@18040000 { - compatible = "qca,ar9557-gpio", - "qca,ar9340-gpio"; - reg = <0x18040000 0x28>; - - interrupts = <2>; - ngpios = <24>; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-controller; - #interrupt-cells = <2>; - }; - - pinmux: pinmux@1804002c { - compatible = "pinctrl-single"; - - reg = <0x1804002c 0x40>; - - #size-cells = <0>; - - pinctrl-single,bit-per-mux; - pinctrl-single,register-width = <32>; - pinctrl-single,function-mask = <0x1>; - #pinctrl-cells = <2>; - - jtag_disable_pins: pinmux_jtag_disable_pins { - pinctrl-single,bits = <0x40 0x2 0x2>; - }; - }; - - pll: pll-controller@18050000 { - compatible = "qca,ar9557-pll", - "qca,qca9550-pll"; - reg = <0x18050000 0x20>; - - #clock-cells = <1>; - clock-output-names = "cpu", "ddr", "ahb"; - }; - - wdt: wdt@18060008 { - compatible = "qca,ar7130-wdt"; - reg = <0x18060008 0x8>; - - interrupts = <4>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "wdt"; - }; - - rst: reset-controller@1806001c { - compatible = "qca,ar9557-reset", - "qca,ar7100-reset", - "simple-bus"; - reg = <0x1806001c 0x4>; - - #reset-cells = <1>; - interrupt-parent = <&cpuintc>; - - intc2: interrupt-controller@2 { - compatible = "qcom,qca9556-intc"; - - interrupts = <2>; - - interrupt-controller; - #interrupt-cells = <1>; - - qcom,pending-bits = <0x1f0>, /* pcie rc1 */ - <0xf>; /* wmac */ - }; - - intc3: interrupt-controller@3 { - compatible = "qcom,qca9556-intc"; - - interrupts = <3>; - - interrupt-controller; - #interrupt-cells = <1>; - - qcom,pending-bits = <0x1f000>, /* pcie rc2 */ - <0x1000000>, /* usb1 */ - <0x10000000>; /* usb2 */ - }; - }; - - pcie0: pcie-controller@180c0000 { - compatible = "qcom,ar7240-pci"; - #address-cells = <3>; - #size-cells = <2>; - bus-range = <0x0 0x0>; - reg = <0x180c0000 0x1000>, /* CRP */ - <0x180f0000 0x100>, /* CTRL */ - <0x14000000 0x1000>; /* CFG */ - reg-names = "crp_base", "ctrl_base", "cfg_base"; - ranges = <0x2000000 0 0x10000000 0x10000000 0 0x04000000 /* pci memory */ - 0x1000000 0 0x00000000 0x0000000 0 0x000001>; /* io space */ - interrupt-parent = <&intc2>; - interrupts = <0>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-map-mask = <0 0 0 1>; - interrupt-map = <0 0 0 0 &pcie0 0>; - status = "disabled"; - }; - }; - - spi: spi@1f000000 { - compatible = "qca,ar9557-spi", "qca,ar7100-spi"; - reg = <0x1f000000 0x10>; - - clocks = <&pll ATH79_CLK_AHB>; - clock-names = "ahb"; - - status = "disabled"; - - #address-cells = <1>; - #size-cells = <0>; - }; - }; -}; - -&mdio0 { - resets = <&rst 22>; - reset-names = "mdio"; -}; - -ð0 { - compatible = "qca,qca9550-eth", "syscon"; - - pll-data = <0x82000101 0x80000101 0x80001313>; - phy-mode = "rgmii"; - - resets = <&rst 9>; - reset-names = "mac"; -}; - -&mdio1 { - resets = <&rst 23>; - reset-names = "mdio"; -}; - -ð1 { - compatible = "qca,qca9550-eth", "syscon"; - - pll-data = <0x82000101 0x80000101 0x80001313>; - phy-mode = "sgmii"; - - resets = <&rst 13>; - reset-names = "mac"; -}; diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts deleted file mode 100644 index 974b1c61f..000000000 --- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts +++ /dev/null @@ -1,176 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - -#include -#include - -#include "qca9557.dtsi" - -/ { - compatible = "openmesh,om5p-ac-v2", "qca,qca9557"; - model = "OpenMesh OM5P-AC V2"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x8000000>; - }; - - extosc: ref { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-output-names = "ref"; - clock-frequency = <40000000>; - }; - - leds { - compatible = "gpio-leds"; - - power { - label = "om5pac:blue:power"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - wifi_green { - label = "om5pac:green:wifi"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - wifi_yellow { - label = "om5pac:yellow:wifi"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - - wifi_red { - label = "om5pac:red:wifi"; - gpios = <&gpio 23 GPIO_ACTIVE_LOW>; - default-state = "off"; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <100>; - - button@0 { - label = "reset"; - linux,code = ; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - }; - - gpio-export { - compatible = "gpio-export"; - #size-cells = <0>; - - gpio_pa_dcdc { - gpio-export,name = "om5pac:pa_dcdc"; - gpio-export,output = <1>; - gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; - }; - gpio_pa_high { - gpio-export,name = "om5pac:pa_high"; - gpio-export,output = <1>; - gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pinmux { - pinmux_pa_dcdc_pins { - pinctrl-single,bits = <0x0 0xff00 0x0>; - }; - - pinmux_pa_high_pins { - pinctrl-single,bits = <0x10 0xff 0x0>; - }; -}; - -&pcie0 { - status = "okay"; -}; - -&uart { - status = "okay"; -}; - -&pll { - clocks = <&extosc>; -}; - -&spi { - status = "okay"; - num-cs = <1>; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "mx25l12805d"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@1 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - partition@2 { - label = "firmware"; - reg = <0x850000 0x7a0000>; - }; - - partition@3 { - label = "ART"; - reg = <0xff0000 0x010000>; - read-only; - }; - }; - }; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "rgmii-id"; - }; -}; - -&mdio1 { - status = "okay"; - - phy1: ethernet-phy@1 { - reg = <1>; - phy-mode = "sgmii"; - }; -}; - -ð0 { - status = "okay"; - - phy-handle = <&phy4>; - phy-mode = "rgmii"; -}; - -ð1 { - status = "okay"; - - phy-handle = <&phy1>; - phy-mode = "sgmii"; -}; diff --git a/target/linux/ath79/files/arch/mips/ath79/pci-ath9k-fixup.c b/target/linux/ath79/files/arch/mips/ath79/pci-ath9k-fixup.c deleted file mode 100644 index 220235180..000000000 --- a/target/linux/ath79/files/arch/mips/ath79/pci-ath9k-fixup.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Atheros AP94 reference board PCI initialization - * - * Copyright (C) 2009-2010 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include - -#include -#include - -struct ath9k_fixup { - u16 *cal_data; - unsigned slot; -}; - -static int ath9k_num_fixups; -static struct ath9k_fixup ath9k_fixups[2]; - -static void ath9k_pci_fixup(struct pci_dev *dev) -{ - void __iomem *mem; - u16 *cal_data = NULL; - u16 cmd; - u32 bar0; - u32 val; - unsigned i; - - for (i = 0; i < ath9k_num_fixups; i++) { - if (ath9k_fixups[i].cal_data == NULL) - continue; - - if (ath9k_fixups[i].slot != PCI_SLOT(dev->devfn)) - continue; - - cal_data = ath9k_fixups[i].cal_data; - break; - } - - if (cal_data == NULL) - return; - - if (*cal_data != 0xa55a) { - pr_err("pci %s: invalid calibration data\n", pci_name(dev)); - return; - } - - pr_info("pci %s: fixup device configuration\n", pci_name(dev)); - - mem = ioremap(AR71XX_PCI_MEM_BASE, 0x10000); - if (!mem) { - pr_err("pci %s: ioremap error\n", pci_name(dev)); - return; - } - - pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0); - - switch (ath79_soc) { - case ATH79_SOC_AR7161: - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, - AR71XX_PCI_MEM_BASE); - break; - case ATH79_SOC_AR7240: - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0xffff); - break; - - case ATH79_SOC_AR7241: - case ATH79_SOC_AR7242: - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0x1000ffff); - break; - case ATH79_SOC_AR9344: - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0x1000ffff); - break; - - default: - BUG(); - } - - pci_read_config_word(dev, PCI_COMMAND, &cmd); - cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - pci_write_config_word(dev, PCI_COMMAND, cmd); - - /* set pointer to first reg address */ - cal_data += 3; - while (*cal_data != 0xffff) { - u32 reg; - reg = *cal_data++; - val = *cal_data++; - val |= (*cal_data++) << 16; - - __raw_writel(val, mem + reg); - udelay(100); - } - - pci_read_config_dword(dev, PCI_VENDOR_ID, &val); - dev->vendor = val & 0xffff; - dev->device = (val >> 16) & 0xffff; - - pci_read_config_dword(dev, PCI_CLASS_REVISION, &val); - dev->revision = val & 0xff; - dev->class = val >> 8; /* upper 3 bytes */ - - pci_read_config_word(dev, PCI_COMMAND, &cmd); - cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); - pci_write_config_word(dev, PCI_COMMAND, cmd); - - pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0); - - iounmap(mem); -} -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); - -void __init pci_enable_ath9k_fixup(unsigned slot, u16 *cal_data) -{ - if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) - return; - - ath9k_fixups[ath9k_num_fixups].slot = slot; - ath9k_fixups[ath9k_num_fixups].cal_data = cal_data; - ath9k_num_fixups++; -} diff --git a/target/linux/ath79/files/arch/mips/ath79/pci-ath9k-fixup.h b/target/linux/ath79/files/arch/mips/ath79/pci-ath9k-fixup.h deleted file mode 100644 index 5794941f0..000000000 --- a/target/linux/ath79/files/arch/mips/ath79/pci-ath9k-fixup.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _PCI_ATH9K_FIXUP -#define _PCI_ATH9K_FIXUP - -void pci_enable_ath9k_fixup(unsigned slot, u16 *cal_data) __init; - -#endif /* _PCI_ATH9K_FIXUP */ diff --git a/target/linux/ath79/files/arch/mips/include/asm/fw/myloader/myloader.h b/target/linux/ath79/files/arch/mips/include/asm/fw/myloader/myloader.h deleted file mode 100644 index 8a99d566d..000000000 --- a/target/linux/ath79/files/arch/mips/include/asm/fw/myloader/myloader.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Compex's MyLoader specific definitions - * - * Copyright (C) 2006-2008 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _ASM_MIPS_FW_MYLOADER_H -#define _ASM_MIPS_FW_MYLOADER_H - -#include - -struct myloader_info { - uint32_t vid; - uint32_t did; - uint32_t svid; - uint32_t sdid; - uint8_t macs[MYLO_ETHADDR_COUNT][6]; -}; - -#ifdef CONFIG_MYLOADER -extern struct myloader_info *myloader_get_info(void) __init; -#else -static inline struct myloader_info *myloader_get_info(void) -{ - return NULL; -} -#endif /* CONFIG_MYLOADER */ - -#endif /* _ASM_MIPS_FW_MYLOADER_H */ diff --git a/target/linux/ath79/files/drivers/mtd/tplinkpart.c b/target/linux/ath79/files/drivers/mtd/tplinkpart.c deleted file mode 100644 index 1b94163b8..000000000 --- a/target/linux/ath79/files/drivers/mtd/tplinkpart.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * 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. - * - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#define TPLINK_NUM_PARTS 5 -#define TPLINK_HEADER_V1 0x01000000 -#define TPLINK_HEADER_V2 0x02000000 -#define MD5SUM_LEN 16 - -#define TPLINK_ART_LEN 0x10000 -#define TPLINK_KERNEL_OFFS 0x20000 -#define TPLINK_64K_KERNEL_OFFS 0x10000 - -struct tplink_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 */ - uint8_t pad[360]; -} __attribute__ ((packed)); - -static struct tplink_fw_header * -tplink_read_header(struct mtd_info *mtd, size_t offset) -{ - struct tplink_fw_header *header; - size_t header_len; - size_t retlen; - int ret; - u32 t; - - header = vmalloc(sizeof(*header)); - if (!header) - goto err; - - header_len = sizeof(struct tplink_fw_header); - ret = mtd_read(mtd, offset, header_len, &retlen, - (unsigned char *) header); - if (ret) - goto err_free_header; - - if (retlen != header_len) - goto err_free_header; - - /* sanity checks */ - t = be32_to_cpu(header->version); - if ((t != TPLINK_HEADER_V1) && (t != TPLINK_HEADER_V2)) - goto err_free_header; - - t = be32_to_cpu(header->kernel_ofs); - if (t != header_len) - goto err_free_header; - - return header; - -err_free_header: - vfree(header); -err: - return NULL; -} - -static int tplink_check_rootfs_magic(struct mtd_info *mtd, size_t offset) -{ - u32 magic; - size_t retlen; - int ret; - - ret = mtd_read(mtd, offset, sizeof(magic), &retlen, - (unsigned char *) &magic); - if (ret) - return ret; - - if (retlen != sizeof(magic)) - return -EIO; - - if (le32_to_cpu(magic) != SQUASHFS_MAGIC && - magic != 0x19852003) - return -EINVAL; - - return 0; -} - -static int tplink_parse_partitions_offset(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data, - size_t offset) -{ - struct mtd_partition *parts; - struct tplink_fw_header *header; - int nr_parts; - size_t art_offset; - size_t rootfs_offset; - size_t squashfs_offset; - int ret; - - nr_parts = TPLINK_NUM_PARTS; - parts = kzalloc(nr_parts * sizeof(struct mtd_partition), GFP_KERNEL); - if (!parts) { - ret = -ENOMEM; - goto err; - } - - header = tplink_read_header(master, offset); - if (!header) { - pr_notice("%s: no TP-Link header found\n", master->name); - ret = -ENODEV; - goto err_free_parts; - } - - squashfs_offset = offset + sizeof(struct tplink_fw_header) + - be32_to_cpu(header->kernel_len); - - ret = tplink_check_rootfs_magic(master, squashfs_offset); - if (ret == 0) - rootfs_offset = squashfs_offset; - else - rootfs_offset = offset + be32_to_cpu(header->rootfs_ofs); - - art_offset = master->size - TPLINK_ART_LEN; - - parts[0].name = "u-boot"; - parts[0].offset = 0; - parts[0].size = offset; - parts[0].mask_flags = MTD_WRITEABLE; - - parts[1].name = "kernel"; - parts[1].offset = offset; - parts[1].size = rootfs_offset - offset; - - parts[2].name = "rootfs"; - parts[2].offset = rootfs_offset; - parts[2].size = art_offset - rootfs_offset; - - parts[3].name = "art"; - parts[3].offset = art_offset; - parts[3].size = TPLINK_ART_LEN; - parts[3].mask_flags = MTD_WRITEABLE; - - parts[4].name = "firmware"; - parts[4].offset = offset; - parts[4].size = art_offset - offset; - - vfree(header); - - *pparts = parts; - return nr_parts; - -err_free_parts: - kfree(parts); -err: - *pparts = NULL; - return ret; -} - -static int tplink_parse_partitions(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data) -{ - return tplink_parse_partitions_offset(master, pparts, data, - TPLINK_KERNEL_OFFS); -} - -static int tplink_parse_64k_partitions(struct mtd_info *master, -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - struct mtd_partition **pparts, -#else - const struct mtd_partition **pparts, -#endif - struct mtd_part_parser_data *data) -{ - return tplink_parse_partitions_offset(master, pparts, data, - TPLINK_64K_KERNEL_OFFS); -} - -static struct mtd_part_parser tplink_parser = { - .owner = THIS_MODULE, - .parse_fn = tplink_parse_partitions, - .name = "tp-link", -}; - -static struct mtd_part_parser tplink_64k_parser = { - .owner = THIS_MODULE, - .parse_fn = tplink_parse_64k_partitions, - .name = "tp-link-64k", -}; - -static int __init tplink_parser_init(void) -{ - register_mtd_parser(&tplink_parser); - register_mtd_parser(&tplink_64k_parser); - - return 0; -} - -module_init(tplink_parser_init); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Gabor Juhos "); diff --git a/target/linux/ath79/files/drivers/net/dsa/mv88e6063.c b/target/linux/ath79/files/drivers/net/dsa/mv88e6063.c deleted file mode 100644 index 5b6da713f..000000000 --- a/target/linux/ath79/files/drivers/net/dsa/mv88e6063.c +++ /dev/null @@ -1,289 +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 -#include -#include - -#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) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev); - return mdiobus_read(bus, addr, reg); -#else - struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->dev); - return mdiobus_read(bus, addr, reg); -#endif -} - -#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) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev); - return mdiobus_write(bus, addr, reg, val); -#else - struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->dev); - return mdiobus_write(bus, addr, reg, val); -#endif -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) -static enum dsa_tag_protocol mv88e6063_get_tag_protocol(struct dsa_switch *ds) -{ - return DSA_TAG_PROTO_TRAILER; -} -#endif - -#define REG_WRITE(addr, reg, val) \ - ({ \ - int __ret; \ - \ - __ret = reg_write(ds, addr, reg, val); \ - if (__ret < 0) \ - return __ret; \ - }) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static char *mv88e6063_drv_probe(struct device *host_dev, int sw_addr) -#else -static const char *mv88e6063_drv_probe(struct device *dsa_dev, - struct device *host_dev, int sw_addr, - void **_priv) -#endif -{ - struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev); - int ret; - - if (!bus) - return NULL; - - 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) ? -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) - ds->phys_port_mask : -#else - ds->enabled_port_mask : -#endif - (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); -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0) -static struct dsa_switch_driver mv88e6063_switch_ops = { -#else -static struct dsa_switch_ops mv88e6063_switch_ops = { -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0) - .tag_protocol = htons(ETH_P_TRAILER), -#else - .get_tag_protocol = mv88e6063_get_tag_protocol, -#endif - .probe = mv88e6063_drv_probe, - .setup = mv88e6063_setup, - .set_addr = mv88e6063_set_addr, - .phy_read = mv88e6063_phy_read, - .phy_write = mv88e6063_phy_write, -}; - -static int __init mv88e6063_init(void) -{ - register_switch_driver(&mv88e6063_switch_ops); - return 0; -} -module_init(mv88e6063_init); - -static void __exit mv88e6063_cleanup(void) -{ - unregister_switch_driver(&mv88e6063_switch_ops); -} -module_exit(mv88e6063_cleanup); diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Kconfig b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Kconfig deleted file mode 100644 index 4df2d21e3..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Kconfig +++ /dev/null @@ -1,25 +0,0 @@ -config AG71XX - tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support" - depends on ATH79 - select PHYLIB - help - If you wish to compile a kernel for AR7XXX/91XXX and enable - ethernet support, then you should always answer Y to this. - -if AG71XX - -config AG71XX_DEBUG - bool "Atheros AR71xx built-in ethernet driver debugging" - default n - help - Atheros AR71xx built-in ethernet driver debugging messages. - -config AG71XX_DEBUG_FS - bool "Atheros AR71xx built-in ethernet driver debugfs support" - depends on DEBUG_FS - default n - help - Say Y, if you need access to various statistics provided by - the ag71xx driver. - -endif diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile deleted file mode 100644 index 7f396ad46..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# -# Makefile for the Atheros AR71xx built-in ethernet macs -# - -ag71xx-y += ag71xx_main.o -ag71xx-y += ag71xx_ethtool.o -ag71xx-y += ag71xx_phy.o -ag71xx-y += ag71xx_mdio.o -ag71xx-y += ag71xx_ar7240.o - -ag71xx-$(CONFIG_AG71XX_DEBUG_FS) += ag71xx_debugfs.o - -obj-$(CONFIG_AG71XX) += ag71xx.o - diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h deleted file mode 100644 index 22b22522a..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 __AG71XX_H -#define __AG71XX_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#define AG71XX_DRV_NAME "ag71xx" - -/* - * For our NAPI weight bigger does *NOT* mean better - it means more - * D-cache misses and lots more wasted cycles than we'll ever - * possibly gain from saving instructions. - */ -#define AG71XX_NAPI_WEIGHT 32 -#define AG71XX_OOM_REFILL (1 + HZ/10) - -#define AG71XX_INT_ERR (AG71XX_INT_RX_BE | AG71XX_INT_TX_BE) -#define AG71XX_INT_TX (AG71XX_INT_TX_PS) -#define AG71XX_INT_RX (AG71XX_INT_RX_PR | AG71XX_INT_RX_OF) - -#define AG71XX_INT_POLL (AG71XX_INT_RX | AG71XX_INT_TX) -#define AG71XX_INT_INIT (AG71XX_INT_ERR | AG71XX_INT_POLL) - -#define AG71XX_TX_MTU_LEN 1540 - -#define AG71XX_TX_RING_SPLIT 512 -#define AG71XX_TX_RING_DS_PER_PKT DIV_ROUND_UP(AG71XX_TX_MTU_LEN, \ - AG71XX_TX_RING_SPLIT) -#define AG71XX_TX_RING_SIZE_DEFAULT 128 -#define AG71XX_RX_RING_SIZE_DEFAULT 256 - -#define AG71XX_TX_RING_SIZE_MAX 128 -#define AG71XX_RX_RING_SIZE_MAX 256 - -#ifdef CONFIG_AG71XX_DEBUG -#define DBG(fmt, args...) pr_debug(fmt, ## args) -#else -#define DBG(fmt, args...) do {} while (0) -#endif - -#define ag71xx_assert(_cond) \ -do { \ - if (_cond) \ - break; \ - printk("%s,%d: assertion failed\n", __FILE__, __LINE__); \ - BUG(); \ -} while (0) - -struct ag71xx_desc { - u32 data; - u32 ctrl; -#define DESC_EMPTY BIT(31) -#define DESC_MORE BIT(24) -#define DESC_PKTLEN_M 0xfff - u32 next; - u32 pad; -} __attribute__((aligned(4))); - -#define AG71XX_DESC_SIZE roundup(sizeof(struct ag71xx_desc), \ - L1_CACHE_BYTES) - -struct ag71xx_buf { - union { - struct sk_buff *skb; - void *rx_buf; - }; - union { - dma_addr_t dma_addr; - unsigned int len; - }; -}; - -struct ag71xx_ring { - struct ag71xx_buf *buf; - u8 *descs_cpu; - dma_addr_t descs_dma; - u16 desc_split; - u16 order; - unsigned int curr; - unsigned int dirty; -}; - -struct ag71xx_int_stats { - unsigned long rx_pr; - unsigned long rx_be; - unsigned long rx_of; - unsigned long tx_ps; - unsigned long tx_be; - unsigned long tx_ur; - unsigned long total; -}; - -struct ag71xx_napi_stats { - unsigned long napi_calls; - unsigned long rx_count; - unsigned long rx_packets; - unsigned long rx_packets_max; - unsigned long tx_count; - unsigned long tx_packets; - unsigned long tx_packets_max; - - unsigned long rx[AG71XX_NAPI_WEIGHT + 1]; - unsigned long tx[AG71XX_NAPI_WEIGHT + 1]; -}; - -struct ag71xx_debug { - struct dentry *debugfs_dir; - - struct ag71xx_int_stats int_stats; - struct ag71xx_napi_stats napi_stats; -}; - -struct ag71xx { - /* - * Critical data related to the per-packet data path are clustered - * early in this structure to help improve the D-cache footprint. - */ - struct ag71xx_ring rx_ring ____cacheline_aligned; - struct ag71xx_ring tx_ring ____cacheline_aligned; - - u16 desc_pktlen_mask; - u16 rx_buf_size; - u8 rx_buf_offset; - u8 tx_hang_workaround:1; - - struct net_device *dev; - struct platform_device *pdev; - spinlock_t lock; - struct napi_struct napi; - u32 msg_enable; - - /* - * From this point onwards we're not looking at per-packet fields. - */ - void __iomem *mac_base; - void __iomem *mii_base; - struct regmap *mii_regmap; - - struct ag71xx_desc *stop_desc; - dma_addr_t stop_desc_dma; - - struct mii_bus *mii_bus; - struct phy_device *phy_dev; - void *phy_priv; - int phy_if_mode; - - unsigned int link; - unsigned int speed; - int duplex; - - struct delayed_work restart_work; - struct timer_list oom_timer; - - struct reset_control *mac_reset; - struct reset_control *phy_reset; - struct reset_control *mdio_reset; - - u32 fifodata[3]; - u32 plldata[3]; - u32 pllreg[3]; - struct regmap *pllregmap; - -#ifdef CONFIG_AG71XX_DEBUG_FS - struct ag71xx_debug debug; -#endif -}; - -extern struct ethtool_ops ag71xx_ethtool_ops; -void ag71xx_link_adjust(struct ag71xx *ag); - -int ag71xx_phy_connect(struct ag71xx *ag); -void ag71xx_phy_disconnect(struct ag71xx *ag); - -static inline int ag71xx_desc_empty(struct ag71xx_desc *desc) -{ - return (desc->ctrl & DESC_EMPTY) != 0; -} - -static inline struct ag71xx_desc * -ag71xx_ring_desc(struct ag71xx_ring *ring, int idx) -{ - return (struct ag71xx_desc *) &ring->descs_cpu[idx * AG71XX_DESC_SIZE]; -} - -static inline int -ag71xx_ring_size_order(int size) -{ - return fls(size - 1); -} - -/* Register offsets */ -#define AG71XX_REG_MAC_CFG1 0x0000 -#define AG71XX_REG_MAC_CFG2 0x0004 -#define AG71XX_REG_MAC_IPG 0x0008 -#define AG71XX_REG_MAC_HDX 0x000c -#define AG71XX_REG_MAC_MFL 0x0010 -#define AG71XX_REG_MII_CFG 0x0020 -#define AG71XX_REG_MII_CMD 0x0024 -#define AG71XX_REG_MII_ADDR 0x0028 -#define AG71XX_REG_MII_CTRL 0x002c -#define AG71XX_REG_MII_STATUS 0x0030 -#define AG71XX_REG_MII_IND 0x0034 -#define AG71XX_REG_MAC_IFCTL 0x0038 -#define AG71XX_REG_MAC_ADDR1 0x0040 -#define AG71XX_REG_MAC_ADDR2 0x0044 -#define AG71XX_REG_FIFO_CFG0 0x0048 -#define AG71XX_REG_FIFO_CFG1 0x004c -#define AG71XX_REG_FIFO_CFG2 0x0050 -#define AG71XX_REG_FIFO_CFG3 0x0054 -#define AG71XX_REG_FIFO_CFG4 0x0058 -#define AG71XX_REG_FIFO_CFG5 0x005c -#define AG71XX_REG_FIFO_RAM0 0x0060 -#define AG71XX_REG_FIFO_RAM1 0x0064 -#define AG71XX_REG_FIFO_RAM2 0x0068 -#define AG71XX_REG_FIFO_RAM3 0x006c -#define AG71XX_REG_FIFO_RAM4 0x0070 -#define AG71XX_REG_FIFO_RAM5 0x0074 -#define AG71XX_REG_FIFO_RAM6 0x0078 -#define AG71XX_REG_FIFO_RAM7 0x007c - -#define AG71XX_REG_TX_CTRL 0x0180 -#define AG71XX_REG_TX_DESC 0x0184 -#define AG71XX_REG_TX_STATUS 0x0188 -#define AG71XX_REG_RX_CTRL 0x018c -#define AG71XX_REG_RX_DESC 0x0190 -#define AG71XX_REG_RX_STATUS 0x0194 -#define AG71XX_REG_INT_ENABLE 0x0198 -#define AG71XX_REG_INT_STATUS 0x019c - -#define AG71XX_REG_FIFO_DEPTH 0x01a8 -#define AG71XX_REG_RX_SM 0x01b0 -#define AG71XX_REG_TX_SM 0x01b4 - -#define MAC_CFG1_TXE BIT(0) /* Tx Enable */ -#define MAC_CFG1_STX BIT(1) /* Synchronize Tx Enable */ -#define MAC_CFG1_RXE BIT(2) /* Rx Enable */ -#define MAC_CFG1_SRX BIT(3) /* Synchronize Rx Enable */ -#define MAC_CFG1_TFC BIT(4) /* Tx Flow Control Enable */ -#define MAC_CFG1_RFC BIT(5) /* Rx Flow Control Enable */ -#define MAC_CFG1_LB BIT(8) /* Loopback mode */ -#define MAC_CFG1_SR BIT(31) /* Soft Reset */ - -#define MAC_CFG2_FDX BIT(0) -#define MAC_CFG2_CRC_EN BIT(1) -#define MAC_CFG2_PAD_CRC_EN BIT(2) -#define MAC_CFG2_LEN_CHECK BIT(4) -#define MAC_CFG2_HUGE_FRAME_EN BIT(5) -#define MAC_CFG2_IF_1000 BIT(9) -#define MAC_CFG2_IF_10_100 BIT(8) - -#define FIFO_CFG0_WTM BIT(0) /* Watermark Module */ -#define FIFO_CFG0_RXS BIT(1) /* Rx System Module */ -#define FIFO_CFG0_RXF BIT(2) /* Rx Fabric Module */ -#define FIFO_CFG0_TXS BIT(3) /* Tx System Module */ -#define FIFO_CFG0_TXF BIT(4) /* Tx Fabric Module */ -#define FIFO_CFG0_ALL (FIFO_CFG0_WTM | FIFO_CFG0_RXS | FIFO_CFG0_RXF \ - | FIFO_CFG0_TXS | FIFO_CFG0_TXF) - -#define FIFO_CFG0_ENABLE_SHIFT 8 - -#define FIFO_CFG4_DE BIT(0) /* Drop Event */ -#define FIFO_CFG4_DV BIT(1) /* RX_DV Event */ -#define FIFO_CFG4_FC BIT(2) /* False Carrier */ -#define FIFO_CFG4_CE BIT(3) /* Code Error */ -#define FIFO_CFG4_CR BIT(4) /* CRC error */ -#define FIFO_CFG4_LM BIT(5) /* Length Mismatch */ -#define FIFO_CFG4_LO BIT(6) /* Length out of range */ -#define FIFO_CFG4_OK BIT(7) /* Packet is OK */ -#define FIFO_CFG4_MC BIT(8) /* Multicast Packet */ -#define FIFO_CFG4_BC BIT(9) /* Broadcast Packet */ -#define FIFO_CFG4_DR BIT(10) /* Dribble */ -#define FIFO_CFG4_LE BIT(11) /* Long Event */ -#define FIFO_CFG4_CF BIT(12) /* Control Frame */ -#define FIFO_CFG4_PF BIT(13) /* Pause Frame */ -#define FIFO_CFG4_UO BIT(14) /* Unsupported Opcode */ -#define FIFO_CFG4_VT BIT(15) /* VLAN tag detected */ -#define FIFO_CFG4_FT BIT(16) /* Frame Truncated */ -#define FIFO_CFG4_UC BIT(17) /* Unicast Packet */ - -#define FIFO_CFG5_DE BIT(0) /* Drop Event */ -#define FIFO_CFG5_DV BIT(1) /* RX_DV Event */ -#define FIFO_CFG5_FC BIT(2) /* False Carrier */ -#define FIFO_CFG5_CE BIT(3) /* Code Error */ -#define FIFO_CFG5_LM BIT(4) /* Length Mismatch */ -#define FIFO_CFG5_LO BIT(5) /* Length Out of Range */ -#define FIFO_CFG5_OK BIT(6) /* Packet is OK */ -#define FIFO_CFG5_MC BIT(7) /* Multicast Packet */ -#define FIFO_CFG5_BC BIT(8) /* Broadcast Packet */ -#define FIFO_CFG5_DR BIT(9) /* Dribble */ -#define FIFO_CFG5_CF BIT(10) /* Control Frame */ -#define FIFO_CFG5_PF BIT(11) /* Pause Frame */ -#define FIFO_CFG5_UO BIT(12) /* Unsupported Opcode */ -#define FIFO_CFG5_VT BIT(13) /* VLAN tag detected */ -#define FIFO_CFG5_LE BIT(14) /* Long Event */ -#define FIFO_CFG5_FT BIT(15) /* Frame Truncated */ -#define FIFO_CFG5_16 BIT(16) /* unknown */ -#define FIFO_CFG5_17 BIT(17) /* unknown */ -#define FIFO_CFG5_SF BIT(18) /* Short Frame */ -#define FIFO_CFG5_BM BIT(19) /* Byte Mode */ - -#define AG71XX_INT_TX_PS BIT(0) -#define AG71XX_INT_TX_UR BIT(1) -#define AG71XX_INT_TX_BE BIT(3) -#define AG71XX_INT_RX_PR BIT(4) -#define AG71XX_INT_RX_OF BIT(6) -#define AG71XX_INT_RX_BE BIT(7) - -#define MAC_IFCTL_SPEED BIT(16) - -#define MII_CFG_CLK_DIV_4 0 -#define MII_CFG_CLK_DIV_6 2 -#define MII_CFG_CLK_DIV_8 3 -#define MII_CFG_CLK_DIV_10 4 -#define MII_CFG_CLK_DIV_14 5 -#define MII_CFG_CLK_DIV_20 6 -#define MII_CFG_CLK_DIV_28 7 -#define MII_CFG_CLK_DIV_34 8 -#define MII_CFG_CLK_DIV_42 9 -#define MII_CFG_CLK_DIV_50 10 -#define MII_CFG_CLK_DIV_58 11 -#define MII_CFG_CLK_DIV_66 12 -#define MII_CFG_CLK_DIV_74 13 -#define MII_CFG_CLK_DIV_82 14 -#define MII_CFG_CLK_DIV_98 15 -#define MII_CFG_RESET BIT(31) - -#define MII_CMD_WRITE 0x0 -#define MII_CMD_READ 0x1 -#define MII_ADDR_SHIFT 8 -#define MII_IND_BUSY BIT(0) -#define MII_IND_INVALID BIT(2) - -#define TX_CTRL_TXE BIT(0) /* Tx Enable */ - -#define TX_STATUS_PS BIT(0) /* Packet Sent */ -#define TX_STATUS_UR BIT(1) /* Tx Underrun */ -#define TX_STATUS_BE BIT(3) /* Bus Error */ - -#define RX_CTRL_RXE BIT(0) /* Rx Enable */ - -#define RX_STATUS_PR BIT(0) /* Packet Received */ -#define RX_STATUS_OF BIT(2) /* Rx Overflow */ -#define RX_STATUS_BE BIT(3) /* Bus Error */ - -static inline void ag71xx_wr(struct ag71xx *ag, unsigned reg, u32 value) -{ - __raw_writel(value, ag->mac_base + reg); - /* flush write */ - (void) __raw_readl(ag->mac_base + reg); -} - -static inline u32 ag71xx_rr(struct ag71xx *ag, unsigned reg) -{ - return __raw_readl(ag->mac_base + reg); -} - -static inline void ag71xx_sb(struct ag71xx *ag, unsigned reg, u32 mask) -{ - void __iomem *r; - - r = ag->mac_base + reg; - __raw_writel(__raw_readl(r) | mask, r); - /* flush write */ - (void) __raw_readl(r); -} - -static inline void ag71xx_cb(struct ag71xx *ag, unsigned reg, u32 mask) -{ - void __iomem *r; - - r = ag->mac_base + reg; - __raw_writel(__raw_readl(r) & ~mask, r); - /* flush write */ - (void) __raw_readl(r); -} - -static inline void ag71xx_int_enable(struct ag71xx *ag, u32 ints) -{ - ag71xx_sb(ag, AG71XX_REG_INT_ENABLE, ints); -} - -static inline void ag71xx_int_disable(struct ag71xx *ag, u32 ints) -{ - ag71xx_cb(ag, AG71XX_REG_INT_ENABLE, ints); -} - -#ifdef CONFIG_AG71XX_DEBUG_FS -int ag71xx_debugfs_root_init(void); -void ag71xx_debugfs_root_exit(void); -int ag71xx_debugfs_init(struct ag71xx *ag); -void ag71xx_debugfs_exit(struct ag71xx *ag); -void ag71xx_debugfs_update_int_stats(struct ag71xx *ag, u32 status); -void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, int rx, int tx); -#else -static inline int ag71xx_debugfs_root_init(void) { return 0; } -static inline void ag71xx_debugfs_root_exit(void) {} -static inline int ag71xx_debugfs_init(struct ag71xx *ag) { return 0; } -static inline void ag71xx_debugfs_exit(struct ag71xx *ag) {} -static inline void ag71xx_debugfs_update_int_stats(struct ag71xx *ag, - u32 status) {} -static inline void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, - int rx, int tx) {} -#endif /* CONFIG_AG71XX_DEBUG_FS */ - -int ag71xx_ar7240_init(struct ag71xx *ag, struct device_node *np); -void ag71xx_ar7240_cleanup(struct ag71xx *ag); -void ag71xx_ar7240_start(struct ag71xx *ag); - -int ag71xx_mdio_init(struct ag71xx *ag); -void ag71xx_mdio_cleanup(struct ag71xx *ag); -int ag71xx_mdio_mii_read(struct mii_bus *bus, int addr, int reg); -int ag71xx_mdio_mii_write(struct mii_bus *bus, int addr, int reg, u16 val); - -int ar7240sw_phy_read(struct mii_bus *mii, int addr, int reg); -int ar7240sw_phy_write(struct mii_bus *mii, int addr, int reg, u16 val); - -#endif /* _AG71XX_H */ diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c deleted file mode 100644 index 52c0f964c..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c +++ /dev/null @@ -1,1340 +0,0 @@ -/* - * Driver for the built-in ethernet switch of the Atheros AR7240 SoC - * Copyright (c) 2010 Gabor Juhos - * Copyright (c) 2010 Felix Fietkau - * - * 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 "ag71xx.h" - -#define BITM(_count) (BIT(_count) - 1) -#define BITS(_shift, _count) (BITM(_count) << _shift) - -#define AR7240_REG_MASK_CTRL 0x00 -#define AR7240_MASK_CTRL_REVISION_M BITM(8) -#define AR7240_MASK_CTRL_VERSION_M BITM(8) -#define AR7240_MASK_CTRL_VERSION_S 8 -#define AR7240_MASK_CTRL_VERSION_AR7240 0x01 -#define AR7240_MASK_CTRL_VERSION_AR934X 0x02 -#define AR7240_MASK_CTRL_SOFT_RESET BIT(31) - -#define AR7240_REG_MAC_ADDR0 0x20 -#define AR7240_REG_MAC_ADDR1 0x24 - -#define AR7240_REG_FLOOD_MASK 0x2c -#define AR7240_FLOOD_MASK_BROAD_TO_CPU BIT(26) - -#define AR7240_REG_GLOBAL_CTRL 0x30 -#define AR7240_GLOBAL_CTRL_MTU_M BITM(11) -#define AR9340_GLOBAL_CTRL_MTU_M BITM(14) - -#define AR7240_REG_VTU 0x0040 -#define AR7240_VTU_OP BITM(3) -#define AR7240_VTU_OP_NOOP 0x0 -#define AR7240_VTU_OP_FLUSH 0x1 -#define AR7240_VTU_OP_LOAD 0x2 -#define AR7240_VTU_OP_PURGE 0x3 -#define AR7240_VTU_OP_REMOVE_PORT 0x4 -#define AR7240_VTU_ACTIVE BIT(3) -#define AR7240_VTU_FULL BIT(4) -#define AR7240_VTU_PORT BITS(8, 4) -#define AR7240_VTU_PORT_S 8 -#define AR7240_VTU_VID BITS(16, 12) -#define AR7240_VTU_VID_S 16 -#define AR7240_VTU_PRIO BITS(28, 3) -#define AR7240_VTU_PRIO_S 28 -#define AR7240_VTU_PRIO_EN BIT(31) - -#define AR7240_REG_VTU_DATA 0x0044 -#define AR7240_VTUDATA_MEMBER BITS(0, 10) -#define AR7240_VTUDATA_VALID BIT(11) - -#define AR7240_REG_ATU 0x50 -#define AR7240_ATU_FLUSH_ALL 0x1 - -#define AR7240_REG_AT_CTRL 0x5c -#define AR7240_AT_CTRL_AGE_TIME BITS(0, 15) -#define AR7240_AT_CTRL_AGE_EN BIT(17) -#define AR7240_AT_CTRL_LEARN_CHANGE BIT(18) -#define AR7240_AT_CTRL_RESERVED BIT(19) -#define AR7240_AT_CTRL_ARP_EN BIT(20) - -#define AR7240_REG_TAG_PRIORITY 0x70 - -#define AR7240_REG_SERVICE_TAG 0x74 -#define AR7240_SERVICE_TAG_M BITM(16) - -#define AR7240_REG_CPU_PORT 0x78 -#define AR7240_MIRROR_PORT_S 4 -#define AR7240_MIRROR_PORT_M BITM(4) -#define AR7240_CPU_PORT_EN BIT(8) - -#define AR7240_REG_MIB_FUNCTION0 0x80 -#define AR7240_MIB_TIMER_M BITM(16) -#define AR7240_MIB_AT_HALF_EN BIT(16) -#define AR7240_MIB_BUSY BIT(17) -#define AR7240_MIB_FUNC_S 24 -#define AR7240_MIB_FUNC_M BITM(3) -#define AR7240_MIB_FUNC_NO_OP 0x0 -#define AR7240_MIB_FUNC_FLUSH 0x1 -#define AR7240_MIB_FUNC_CAPTURE 0x3 - -#define AR7240_REG_MDIO_CTRL 0x98 -#define AR7240_MDIO_CTRL_DATA_M BITM(16) -#define AR7240_MDIO_CTRL_REG_ADDR_S 16 -#define AR7240_MDIO_CTRL_PHY_ADDR_S 21 -#define AR7240_MDIO_CTRL_CMD_WRITE 0 -#define AR7240_MDIO_CTRL_CMD_READ BIT(27) -#define AR7240_MDIO_CTRL_MASTER_EN BIT(30) -#define AR7240_MDIO_CTRL_BUSY BIT(31) - -#define AR7240_REG_PORT_BASE(_port) (0x100 + (_port) * 0x100) - -#define AR7240_REG_PORT_STATUS(_port) (AR7240_REG_PORT_BASE((_port)) + 0x00) -#define AR7240_PORT_STATUS_SPEED_S 0 -#define AR7240_PORT_STATUS_SPEED_M BITM(2) -#define AR7240_PORT_STATUS_SPEED_10 0 -#define AR7240_PORT_STATUS_SPEED_100 1 -#define AR7240_PORT_STATUS_SPEED_1000 2 -#define AR7240_PORT_STATUS_TXMAC BIT(2) -#define AR7240_PORT_STATUS_RXMAC BIT(3) -#define AR7240_PORT_STATUS_TXFLOW BIT(4) -#define AR7240_PORT_STATUS_RXFLOW BIT(5) -#define AR7240_PORT_STATUS_DUPLEX BIT(6) -#define AR7240_PORT_STATUS_LINK_UP BIT(8) -#define AR7240_PORT_STATUS_LINK_AUTO BIT(9) -#define AR7240_PORT_STATUS_LINK_PAUSE BIT(10) - -#define AR7240_REG_PORT_CTRL(_port) (AR7240_REG_PORT_BASE((_port)) + 0x04) -#define AR7240_PORT_CTRL_STATE_M BITM(3) -#define AR7240_PORT_CTRL_STATE_DISABLED 0 -#define AR7240_PORT_CTRL_STATE_BLOCK 1 -#define AR7240_PORT_CTRL_STATE_LISTEN 2 -#define AR7240_PORT_CTRL_STATE_LEARN 3 -#define AR7240_PORT_CTRL_STATE_FORWARD 4 -#define AR7240_PORT_CTRL_LEARN_LOCK BIT(7) -#define AR7240_PORT_CTRL_VLAN_MODE_S 8 -#define AR7240_PORT_CTRL_VLAN_MODE_KEEP 0 -#define AR7240_PORT_CTRL_VLAN_MODE_STRIP 1 -#define AR7240_PORT_CTRL_VLAN_MODE_ADD 2 -#define AR7240_PORT_CTRL_VLAN_MODE_DOUBLE_TAG 3 -#define AR7240_PORT_CTRL_IGMP_SNOOP BIT(10) -#define AR7240_PORT_CTRL_HEADER BIT(11) -#define AR7240_PORT_CTRL_MAC_LOOP BIT(12) -#define AR7240_PORT_CTRL_SINGLE_VLAN BIT(13) -#define AR7240_PORT_CTRL_LEARN BIT(14) -#define AR7240_PORT_CTRL_DOUBLE_TAG BIT(15) -#define AR7240_PORT_CTRL_MIRROR_TX BIT(16) -#define AR7240_PORT_CTRL_MIRROR_RX BIT(17) - -#define AR7240_REG_PORT_VLAN(_port) (AR7240_REG_PORT_BASE((_port)) + 0x08) - -#define AR7240_PORT_VLAN_DEFAULT_ID_S 0 -#define AR7240_PORT_VLAN_DEST_PORTS_S 16 -#define AR7240_PORT_VLAN_MODE_S 30 -#define AR7240_PORT_VLAN_MODE_PORT_ONLY 0 -#define AR7240_PORT_VLAN_MODE_PORT_FALLBACK 1 -#define AR7240_PORT_VLAN_MODE_VLAN_ONLY 2 -#define AR7240_PORT_VLAN_MODE_SECURE 3 - - -#define AR7240_REG_STATS_BASE(_port) (0x20000 + (_port) * 0x100) - -#define AR7240_STATS_RXBROAD 0x00 -#define AR7240_STATS_RXPAUSE 0x04 -#define AR7240_STATS_RXMULTI 0x08 -#define AR7240_STATS_RXFCSERR 0x0c -#define AR7240_STATS_RXALIGNERR 0x10 -#define AR7240_STATS_RXRUNT 0x14 -#define AR7240_STATS_RXFRAGMENT 0x18 -#define AR7240_STATS_RX64BYTE 0x1c -#define AR7240_STATS_RX128BYTE 0x20 -#define AR7240_STATS_RX256BYTE 0x24 -#define AR7240_STATS_RX512BYTE 0x28 -#define AR7240_STATS_RX1024BYTE 0x2c -#define AR7240_STATS_RX1518BYTE 0x30 -#define AR7240_STATS_RXMAXBYTE 0x34 -#define AR7240_STATS_RXTOOLONG 0x38 -#define AR7240_STATS_RXGOODBYTE 0x3c -#define AR7240_STATS_RXBADBYTE 0x44 -#define AR7240_STATS_RXOVERFLOW 0x4c -#define AR7240_STATS_FILTERED 0x50 -#define AR7240_STATS_TXBROAD 0x54 -#define AR7240_STATS_TXPAUSE 0x58 -#define AR7240_STATS_TXMULTI 0x5c -#define AR7240_STATS_TXUNDERRUN 0x60 -#define AR7240_STATS_TX64BYTE 0x64 -#define AR7240_STATS_TX128BYTE 0x68 -#define AR7240_STATS_TX256BYTE 0x6c -#define AR7240_STATS_TX512BYTE 0x70 -#define AR7240_STATS_TX1024BYTE 0x74 -#define AR7240_STATS_TX1518BYTE 0x78 -#define AR7240_STATS_TXMAXBYTE 0x7c -#define AR7240_STATS_TXOVERSIZE 0x80 -#define AR7240_STATS_TXBYTE 0x84 -#define AR7240_STATS_TXCOLLISION 0x8c -#define AR7240_STATS_TXABORTCOL 0x90 -#define AR7240_STATS_TXMULTICOL 0x94 -#define AR7240_STATS_TXSINGLECOL 0x98 -#define AR7240_STATS_TXEXCDEFER 0x9c -#define AR7240_STATS_TXDEFER 0xa0 -#define AR7240_STATS_TXLATECOL 0xa4 - -#define AR7240_PORT_CPU 0 -#define AR7240_NUM_PORTS 6 -#define AR7240_NUM_PHYS 5 - -#define AR7240_PHY_ID1 0x004d -#define AR7240_PHY_ID2 0xd041 - -#define AR934X_PHY_ID1 0x004d -#define AR934X_PHY_ID2 0xd042 - -#define AR7240_MAX_VLANS 16 - -#define AR934X_REG_OPER_MODE0 0x04 -#define AR934X_OPER_MODE0_MAC_GMII_EN BIT(6) -#define AR934X_OPER_MODE0_PHY_MII_EN BIT(10) - -#define AR934X_REG_OPER_MODE1 0x08 -#define AR934X_REG_OPER_MODE1_PHY4_MII_EN BIT(28) - -#define AR934X_REG_FLOOD_MASK 0x2c -#define AR934X_FLOOD_MASK_MC_DP(_p) BIT(16 + (_p)) -#define AR934X_FLOOD_MASK_BC_DP(_p) BIT(25 + (_p)) - -#define AR934X_REG_QM_CTRL 0x3c -#define AR934X_QM_CTRL_ARP_EN BIT(15) - -#define AR934X_REG_AT_CTRL 0x5c -#define AR934X_AT_CTRL_AGE_TIME BITS(0, 15) -#define AR934X_AT_CTRL_AGE_EN BIT(17) -#define AR934X_AT_CTRL_LEARN_CHANGE BIT(18) - -#define AR934X_MIB_ENABLE BIT(30) - -#define AR934X_REG_PORT_BASE(_port) (0x100 + (_port) * 0x100) - -#define AR934X_REG_PORT_VLAN1(_port) (AR934X_REG_PORT_BASE((_port)) + 0x08) -#define AR934X_PORT_VLAN1_DEFAULT_SVID_S 0 -#define AR934X_PORT_VLAN1_FORCE_DEFAULT_VID_EN BIT(12) -#define AR934X_PORT_VLAN1_PORT_TLS_MODE BIT(13) -#define AR934X_PORT_VLAN1_PORT_VLAN_PROP_EN BIT(14) -#define AR934X_PORT_VLAN1_PORT_CLONE_EN BIT(15) -#define AR934X_PORT_VLAN1_DEFAULT_CVID_S 16 -#define AR934X_PORT_VLAN1_FORCE_PORT_VLAN_EN BIT(28) -#define AR934X_PORT_VLAN1_ING_PORT_PRI_S 29 - -#define AR934X_REG_PORT_VLAN2(_port) (AR934X_REG_PORT_BASE((_port)) + 0x0c) -#define AR934X_PORT_VLAN2_PORT_VID_MEM_S 16 -#define AR934X_PORT_VLAN2_8021Q_MODE_S 30 -#define AR934X_PORT_VLAN2_8021Q_MODE_PORT_ONLY 0 -#define AR934X_PORT_VLAN2_8021Q_MODE_PORT_FALLBACK 1 -#define AR934X_PORT_VLAN2_8021Q_MODE_VLAN_ONLY 2 -#define AR934X_PORT_VLAN2_8021Q_MODE_SECURE 3 - -#define sw_to_ar7240(_dev) container_of(_dev, struct ar7240sw, swdev) - -struct ar7240sw_port_stat { - unsigned long rx_broadcast; - unsigned long rx_pause; - unsigned long rx_multicast; - unsigned long rx_fcs_error; - unsigned long rx_align_error; - unsigned long rx_runt; - unsigned long rx_fragments; - unsigned long rx_64byte; - unsigned long rx_128byte; - unsigned long rx_256byte; - unsigned long rx_512byte; - unsigned long rx_1024byte; - unsigned long rx_1518byte; - unsigned long rx_maxbyte; - unsigned long rx_toolong; - unsigned long rx_good_byte; - unsigned long rx_bad_byte; - unsigned long rx_overflow; - unsigned long filtered; - - unsigned long tx_broadcast; - unsigned long tx_pause; - unsigned long tx_multicast; - unsigned long tx_underrun; - unsigned long tx_64byte; - unsigned long tx_128byte; - unsigned long tx_256byte; - unsigned long tx_512byte; - unsigned long tx_1024byte; - unsigned long tx_1518byte; - unsigned long tx_maxbyte; - unsigned long tx_oversize; - unsigned long tx_byte; - unsigned long tx_collision; - unsigned long tx_abortcol; - unsigned long tx_multicol; - unsigned long tx_singlecol; - unsigned long tx_excdefer; - unsigned long tx_defer; - unsigned long tx_xlatecol; -}; - -struct ar7240sw { - struct mii_bus *mii_bus; - struct ag71xx_switch_platform_data *swdata; - struct switch_dev swdev; - int num_ports; - u8 ver; - bool vlan; - u16 vlan_id[AR7240_MAX_VLANS]; - u8 vlan_table[AR7240_MAX_VLANS]; - u8 vlan_tagged; - u16 pvid[AR7240_NUM_PORTS]; - char buf[80]; - - rwlock_t stats_lock; - struct ar7240sw_port_stat port_stats[AR7240_NUM_PORTS]; -}; - -struct ar7240sw_hw_stat { - char string[ETH_GSTRING_LEN]; - int sizeof_stat; - int reg; -}; - -static DEFINE_MUTEX(reg_mutex); - -static inline int sw_is_ar7240(struct ar7240sw *as) -{ - return as->ver == AR7240_MASK_CTRL_VERSION_AR7240; -} - -static inline int sw_is_ar934x(struct ar7240sw *as) -{ - return as->ver == AR7240_MASK_CTRL_VERSION_AR934X; -} - -static inline u32 ar7240sw_port_mask(struct ar7240sw *as, int port) -{ - return BIT(port); -} - -static inline u32 ar7240sw_port_mask_all(struct ar7240sw *as) -{ - return BIT(as->swdev.ports) - 1; -} - -static inline u32 ar7240sw_port_mask_but(struct ar7240sw *as, int port) -{ - return ar7240sw_port_mask_all(as) & ~BIT(port); -} - -static inline u16 mk_phy_addr(u32 reg) -{ - return 0x17 & ((reg >> 4) | 0x10); -} - -static inline u16 mk_phy_reg(u32 reg) -{ - return (reg << 1) & 0x1e; -} - -static inline u16 mk_high_addr(u32 reg) -{ - return (reg >> 7) & 0x1ff; -} - -static u32 __ar7240sw_reg_read(struct mii_bus *mii, u32 reg) -{ - unsigned long flags; - u16 phy_addr; - u16 phy_reg; - u32 hi, lo; - - reg = (reg & 0xfffffffc) >> 2; - phy_addr = mk_phy_addr(reg); - phy_reg = mk_phy_reg(reg); - - local_irq_save(flags); - ag71xx_mdio_mii_write(mii, 0x1f, 0x10, mk_high_addr(reg)); - lo = (u32) ag71xx_mdio_mii_read(mii, phy_addr, phy_reg); - hi = (u32) ag71xx_mdio_mii_read(mii, phy_addr, phy_reg + 1); - local_irq_restore(flags); - - return (hi << 16) | lo; -} - -static void __ar7240sw_reg_write(struct mii_bus *mii, u32 reg, u32 val) -{ - unsigned long flags; - u16 phy_addr; - u16 phy_reg; - - reg = (reg & 0xfffffffc) >> 2; - phy_addr = mk_phy_addr(reg); - phy_reg = mk_phy_reg(reg); - - local_irq_save(flags); - ag71xx_mdio_mii_write(mii, 0x1f, 0x10, mk_high_addr(reg)); - ag71xx_mdio_mii_write(mii, phy_addr, phy_reg + 1, (val >> 16)); - ag71xx_mdio_mii_write(mii, phy_addr, phy_reg, (val & 0xffff)); - local_irq_restore(flags); -} - -static u32 ar7240sw_reg_read(struct mii_bus *mii, u32 reg_addr) -{ - u32 ret; - - mutex_lock(®_mutex); - ret = __ar7240sw_reg_read(mii, reg_addr); - mutex_unlock(®_mutex); - - return ret; -} - -static void ar7240sw_reg_write(struct mii_bus *mii, u32 reg_addr, u32 reg_val) -{ - mutex_lock(®_mutex); - __ar7240sw_reg_write(mii, reg_addr, reg_val); - mutex_unlock(®_mutex); -} - -static u32 ar7240sw_reg_rmw(struct mii_bus *mii, u32 reg, u32 mask, u32 val) -{ - u32 t; - - mutex_lock(®_mutex); - t = __ar7240sw_reg_read(mii, reg); - t &= ~mask; - t |= val; - __ar7240sw_reg_write(mii, reg, t); - mutex_unlock(®_mutex); - - return t; -} - -static void ar7240sw_reg_set(struct mii_bus *mii, u32 reg, u32 val) -{ - u32 t; - - mutex_lock(®_mutex); - t = __ar7240sw_reg_read(mii, reg); - t |= val; - __ar7240sw_reg_write(mii, reg, t); - mutex_unlock(®_mutex); -} - -static int __ar7240sw_reg_wait(struct mii_bus *mii, u32 reg, u32 mask, u32 val, - unsigned timeout) -{ - int i; - - for (i = 0; i < timeout; i++) { - u32 t; - - t = __ar7240sw_reg_read(mii, reg); - if ((t & mask) == val) - return 0; - - usleep_range(1000, 2000); - } - - return -ETIMEDOUT; -} - -static int ar7240sw_reg_wait(struct mii_bus *mii, u32 reg, u32 mask, u32 val, - unsigned timeout) -{ - int ret; - - mutex_lock(®_mutex); - ret = __ar7240sw_reg_wait(mii, reg, mask, val, timeout); - mutex_unlock(®_mutex); - return ret; -} - -int ar7240sw_phy_read(struct mii_bus *mii, int phy_addr, int reg_addr) -{ - u32 t, val = 0xffff; - int err; - - if (phy_addr >= AR7240_NUM_PHYS) - return 0xffff; - - mutex_lock(®_mutex); - t = (reg_addr << AR7240_MDIO_CTRL_REG_ADDR_S) | - (phy_addr << AR7240_MDIO_CTRL_PHY_ADDR_S) | - AR7240_MDIO_CTRL_MASTER_EN | - AR7240_MDIO_CTRL_BUSY | - AR7240_MDIO_CTRL_CMD_READ; - - __ar7240sw_reg_write(mii, AR7240_REG_MDIO_CTRL, t); - err = __ar7240sw_reg_wait(mii, AR7240_REG_MDIO_CTRL, - AR7240_MDIO_CTRL_BUSY, 0, 5); - if (!err) - val = __ar7240sw_reg_read(mii, AR7240_REG_MDIO_CTRL); - mutex_unlock(®_mutex); - - return val & AR7240_MDIO_CTRL_DATA_M; -} - -int ar7240sw_phy_write(struct mii_bus *mii, int phy_addr, int reg_addr, - u16 reg_val) -{ - u32 t; - int ret; - - if (phy_addr >= AR7240_NUM_PHYS) - return -EINVAL; - - mutex_lock(®_mutex); - t = (phy_addr << AR7240_MDIO_CTRL_PHY_ADDR_S) | - (reg_addr << AR7240_MDIO_CTRL_REG_ADDR_S) | - AR7240_MDIO_CTRL_MASTER_EN | - AR7240_MDIO_CTRL_BUSY | - AR7240_MDIO_CTRL_CMD_WRITE | - reg_val; - - __ar7240sw_reg_write(mii, AR7240_REG_MDIO_CTRL, t); - ret = __ar7240sw_reg_wait(mii, AR7240_REG_MDIO_CTRL, - AR7240_MDIO_CTRL_BUSY, 0, 5); - mutex_unlock(®_mutex); - - return ret; -} - -static int ar7240sw_capture_stats(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - int port; - int ret; - - write_lock(&as->stats_lock); - - /* Capture the hardware statistics for all ports */ - ar7240sw_reg_rmw(mii, AR7240_REG_MIB_FUNCTION0, - (AR7240_MIB_FUNC_M << AR7240_MIB_FUNC_S), - (AR7240_MIB_FUNC_CAPTURE << AR7240_MIB_FUNC_S)); - - /* Wait for the capturing to complete. */ - ret = ar7240sw_reg_wait(mii, AR7240_REG_MIB_FUNCTION0, - AR7240_MIB_BUSY, 0, 10); - - if (ret) - goto unlock; - - for (port = 0; port < AR7240_NUM_PORTS; port++) { - unsigned int base; - struct ar7240sw_port_stat *stats; - - base = AR7240_REG_STATS_BASE(port); - stats = &as->port_stats[port]; - -#define READ_STAT(_r) ar7240sw_reg_read(mii, base + AR7240_STATS_ ## _r) - - stats->rx_good_byte += READ_STAT(RXGOODBYTE); - stats->tx_byte += READ_STAT(TXBYTE); - -#undef READ_STAT - } - - ret = 0; - -unlock: - write_unlock(&as->stats_lock); - return ret; -} - -static void ar7240sw_disable_port(struct ar7240sw *as, unsigned port) -{ - ar7240sw_reg_write(as->mii_bus, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_STATE_DISABLED); -} - -static void ar7240sw_setup(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - - /* Enable CPU port, and disable mirror port */ - ar7240sw_reg_write(mii, AR7240_REG_CPU_PORT, - AR7240_CPU_PORT_EN | - (15 << AR7240_MIRROR_PORT_S)); - - /* Setup TAG priority mapping */ - ar7240sw_reg_write(mii, AR7240_REG_TAG_PRIORITY, 0xfa50); - - if (sw_is_ar934x(as)) { - /* Enable aging, MAC replacing */ - ar7240sw_reg_write(mii, AR934X_REG_AT_CTRL, - 0x2b /* 5 min age time */ | - AR934X_AT_CTRL_AGE_EN | - AR934X_AT_CTRL_LEARN_CHANGE); - /* Enable ARP frame acknowledge */ - ar7240sw_reg_set(mii, AR934X_REG_QM_CTRL, - AR934X_QM_CTRL_ARP_EN); - /* Enable Broadcast/Multicast frames transmitted to the CPU */ - ar7240sw_reg_set(mii, AR934X_REG_FLOOD_MASK, - AR934X_FLOOD_MASK_BC_DP(0) | - AR934X_FLOOD_MASK_MC_DP(0)); - - /* setup MTU */ - ar7240sw_reg_rmw(mii, AR7240_REG_GLOBAL_CTRL, - AR9340_GLOBAL_CTRL_MTU_M, - AR9340_GLOBAL_CTRL_MTU_M); - - /* Enable MIB counters */ - ar7240sw_reg_set(mii, AR7240_REG_MIB_FUNCTION0, - AR934X_MIB_ENABLE); - - } else { - /* Enable ARP frame acknowledge, aging, MAC replacing */ - ar7240sw_reg_write(mii, AR7240_REG_AT_CTRL, - AR7240_AT_CTRL_RESERVED | - 0x2b /* 5 min age time */ | - AR7240_AT_CTRL_AGE_EN | - AR7240_AT_CTRL_ARP_EN | - AR7240_AT_CTRL_LEARN_CHANGE); - /* Enable Broadcast frames transmitted to the CPU */ - ar7240sw_reg_set(mii, AR7240_REG_FLOOD_MASK, - AR7240_FLOOD_MASK_BROAD_TO_CPU); - - /* setup MTU */ - ar7240sw_reg_rmw(mii, AR7240_REG_GLOBAL_CTRL, - AR7240_GLOBAL_CTRL_MTU_M, - AR7240_GLOBAL_CTRL_MTU_M); - } - - /* setup Service TAG */ - ar7240sw_reg_rmw(mii, AR7240_REG_SERVICE_TAG, AR7240_SERVICE_TAG_M, 0); -} - -/* inspired by phy_poll_reset in drivers/net/phy/phy_device.c */ -static int -ar7240sw_phy_poll_reset(struct mii_bus *bus) -{ - const unsigned int sleep_msecs = 20; - int ret, elapsed, i; - - for (elapsed = sleep_msecs; elapsed <= 600; - elapsed += sleep_msecs) { - msleep(sleep_msecs); - for (i = 0; i < AR7240_NUM_PHYS; i++) { - ret = ar7240sw_phy_read(bus, i, MII_BMCR); - if (ret < 0) - return ret; - if (ret & BMCR_RESET) - break; - if (i == AR7240_NUM_PHYS - 1) { - usleep_range(1000, 2000); - return 0; - } - } - } - return -ETIMEDOUT; -} - -static int ar7240sw_reset(struct ar7240sw *as) -{ - struct mii_bus *mii = as->mii_bus; - int ret; - int i; - - /* Set all ports to disabled state. */ - for (i = 0; i < AR7240_NUM_PORTS; i++) - ar7240sw_disable_port(as, i); - - /* Wait for transmit queues to drain. */ - usleep_range(2000, 3000); - - /* Reset the switch. */ - ar7240sw_reg_write(mii, AR7240_REG_MASK_CTRL, - AR7240_MASK_CTRL_SOFT_RESET); - - ret = ar7240sw_reg_wait(mii, AR7240_REG_MASK_CTRL, - AR7240_MASK_CTRL_SOFT_RESET, 0, 1000); - - /* setup PHYs */ - for (i = 0; i < AR7240_NUM_PHYS; i++) { - ar7240sw_phy_write(mii, i, MII_ADVERTISE, - ADVERTISE_ALL | ADVERTISE_PAUSE_CAP | - ADVERTISE_PAUSE_ASYM); - ar7240sw_phy_write(mii, i, MII_BMCR, - BMCR_RESET | BMCR_ANENABLE); - } - ret = ar7240sw_phy_poll_reset(mii); - if (ret) - return ret; - - ar7240sw_setup(as); - return ret; -} - -static void ar7240sw_setup_port(struct ar7240sw *as, unsigned port, u8 portmask) -{ - struct mii_bus *mii = as->mii_bus; - u32 ctrl; - u32 vid, mode; - - ctrl = AR7240_PORT_CTRL_STATE_FORWARD | AR7240_PORT_CTRL_LEARN | - AR7240_PORT_CTRL_SINGLE_VLAN; - - if (port == AR7240_PORT_CPU) { - ar7240sw_reg_write(mii, AR7240_REG_PORT_STATUS(port), - AR7240_PORT_STATUS_SPEED_1000 | - AR7240_PORT_STATUS_TXFLOW | - AR7240_PORT_STATUS_RXFLOW | - AR7240_PORT_STATUS_TXMAC | - AR7240_PORT_STATUS_RXMAC | - AR7240_PORT_STATUS_DUPLEX); - } else { - ar7240sw_reg_write(mii, AR7240_REG_PORT_STATUS(port), - AR7240_PORT_STATUS_LINK_AUTO); - } - - /* Set the default VID for this port */ - if (as->vlan) { - vid = as->vlan_id[as->pvid[port]]; - mode = AR7240_PORT_VLAN_MODE_SECURE; - } else { - vid = port; - mode = AR7240_PORT_VLAN_MODE_PORT_ONLY; - } - - if (as->vlan) { - if (as->vlan_tagged & BIT(port)) - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_ADD << - AR7240_PORT_CTRL_VLAN_MODE_S; - else - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_STRIP << - AR7240_PORT_CTRL_VLAN_MODE_S; - } else { - ctrl |= AR7240_PORT_CTRL_VLAN_MODE_KEEP << - AR7240_PORT_CTRL_VLAN_MODE_S; - } - - if (!portmask) { - if (port == AR7240_PORT_CPU) - portmask = ar7240sw_port_mask_but(as, AR7240_PORT_CPU); - else - portmask = ar7240sw_port_mask(as, AR7240_PORT_CPU); - } - - /* allow the port to talk to all other ports, but exclude its - * own ID to prevent frames from being reflected back to the - * port that they came from */ - portmask &= ar7240sw_port_mask_but(as, port); - - ar7240sw_reg_write(mii, AR7240_REG_PORT_CTRL(port), ctrl); - if (sw_is_ar934x(as)) { - u32 vlan1, vlan2; - - vlan1 = (vid << AR934X_PORT_VLAN1_DEFAULT_CVID_S); - vlan2 = (portmask << AR934X_PORT_VLAN2_PORT_VID_MEM_S) | - (mode << AR934X_PORT_VLAN2_8021Q_MODE_S); - ar7240sw_reg_write(mii, AR934X_REG_PORT_VLAN1(port), vlan1); - ar7240sw_reg_write(mii, AR934X_REG_PORT_VLAN2(port), vlan2); - } else { - u32 vlan; - - vlan = vid | (mode << AR7240_PORT_VLAN_MODE_S) | - (portmask << AR7240_PORT_VLAN_DEST_PORTS_S); - - ar7240sw_reg_write(mii, AR7240_REG_PORT_VLAN(port), vlan); - } -} - -static int ar7240_set_addr(struct ar7240sw *as, u8 *addr) -{ - struct mii_bus *mii = as->mii_bus; - u32 t; - - t = (addr[4] << 8) | addr[5]; - ar7240sw_reg_write(mii, AR7240_REG_MAC_ADDR0, t); - - t = (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) | addr[3]; - ar7240sw_reg_write(mii, AR7240_REG_MAC_ADDR1, t); - - return 0; -} - -static int -ar7240_set_vid(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - as->vlan_id[val->port_vlan] = val->value.i; - return 0; -} - -static int -ar7240_get_vid(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - val->value.i = as->vlan_id[val->port_vlan]; - return 0; -} - -static int -ar7240_set_pvid(struct switch_dev *dev, int port, int vlan) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - - /* make sure no invalid PVIDs get set */ - - if (vlan >= dev->vlans) - return -EINVAL; - - as->pvid[port] = vlan; - return 0; -} - -static int -ar7240_get_pvid(struct switch_dev *dev, int port, int *vlan) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - *vlan = as->pvid[port]; - return 0; -} - -static int -ar7240_get_ports(struct switch_dev *dev, struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 ports = as->vlan_table[val->port_vlan]; - int i; - - val->len = 0; - for (i = 0; i < as->swdev.ports; i++) { - struct switch_port *p; - - if (!(ports & (1 << i))) - continue; - - p = &val->value.ports[val->len++]; - p->id = i; - if (as->vlan_tagged & (1 << i)) - p->flags = (1 << SWITCH_PORT_FLAG_TAGGED); - else - p->flags = 0; - } - return 0; -} - -static int -ar7240_set_ports(struct switch_dev *dev, struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 *vt = &as->vlan_table[val->port_vlan]; - int i, j; - - *vt = 0; - for (i = 0; i < val->len; i++) { - struct switch_port *p = &val->value.ports[i]; - - if (p->flags & (1 << SWITCH_PORT_FLAG_TAGGED)) - as->vlan_tagged |= (1 << p->id); - else { - as->vlan_tagged &= ~(1 << p->id); - as->pvid[p->id] = val->port_vlan; - - /* make sure that an untagged port does not - * appear in other vlans */ - for (j = 0; j < AR7240_MAX_VLANS; j++) { - if (j == val->port_vlan) - continue; - as->vlan_table[j] &= ~(1 << p->id); - } - } - - *vt |= 1 << p->id; - } - return 0; -} - -static int -ar7240_set_vlan(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - as->vlan = !!val->value.i; - return 0; -} - -static int -ar7240_get_vlan(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - val->value.i = as->vlan; - return 0; -} - -static void -ar7240_vtu_op(struct ar7240sw *as, u32 op, u32 val) -{ - struct mii_bus *mii = as->mii_bus; - - if (ar7240sw_reg_wait(mii, AR7240_REG_VTU, AR7240_VTU_ACTIVE, 0, 5)) - return; - - if ((op & AR7240_VTU_OP) == AR7240_VTU_OP_LOAD) { - val &= AR7240_VTUDATA_MEMBER; - val |= AR7240_VTUDATA_VALID; - ar7240sw_reg_write(mii, AR7240_REG_VTU_DATA, val); - } - op |= AR7240_VTU_ACTIVE; - ar7240sw_reg_write(mii, AR7240_REG_VTU, op); -} - -static int -ar7240_hw_apply(struct switch_dev *dev) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - u8 portmask[AR7240_NUM_PORTS]; - int i, j; - - /* flush all vlan translation unit entries */ - ar7240_vtu_op(as, AR7240_VTU_OP_FLUSH, 0); - - memset(portmask, 0, sizeof(portmask)); - if (as->vlan) { - /* calculate the port destination masks and load vlans - * into the vlan translation unit */ - for (j = 0; j < AR7240_MAX_VLANS; j++) { - u8 vp = as->vlan_table[j]; - - if (!vp) - continue; - - for (i = 0; i < as->swdev.ports; i++) { - u8 mask = (1 << i); - if (vp & mask) - portmask[i] |= vp & ~mask; - } - - ar7240_vtu_op(as, - AR7240_VTU_OP_LOAD | - (as->vlan_id[j] << AR7240_VTU_VID_S), - as->vlan_table[j]); - } - } else { - /* vlan disabled: - * isolate all ports, but connect them to the cpu port */ - for (i = 0; i < as->swdev.ports; i++) { - if (i == AR7240_PORT_CPU) - continue; - - portmask[i] = 1 << AR7240_PORT_CPU; - portmask[AR7240_PORT_CPU] |= (1 << i); - } - } - - /* update the port destination mask registers and tag settings */ - for (i = 0; i < as->swdev.ports; i++) - ar7240sw_setup_port(as, i, portmask[i]); - - return 0; -} - -static int -ar7240_reset_switch(struct switch_dev *dev) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - ar7240sw_reset(as); - return 0; -} - -static int -ar7240_get_port_link(struct switch_dev *dev, int port, - struct switch_port_link *link) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - u32 status; - - if (port >= AR7240_NUM_PORTS) - return -EINVAL; - - status = ar7240sw_reg_read(mii, AR7240_REG_PORT_STATUS(port)); - link->aneg = !!(status & AR7240_PORT_STATUS_LINK_AUTO); - if (link->aneg) { - link->link = !!(status & AR7240_PORT_STATUS_LINK_UP); - if (!link->link) - return 0; - } else { - link->link = true; - } - - link->duplex = !!(status & AR7240_PORT_STATUS_DUPLEX); - link->tx_flow = !!(status & AR7240_PORT_STATUS_TXFLOW); - link->rx_flow = !!(status & AR7240_PORT_STATUS_RXFLOW); - switch (status & AR7240_PORT_STATUS_SPEED_M) { - case AR7240_PORT_STATUS_SPEED_10: - link->speed = SWITCH_PORT_SPEED_10; - break; - case AR7240_PORT_STATUS_SPEED_100: - link->speed = SWITCH_PORT_SPEED_100; - break; - case AR7240_PORT_STATUS_SPEED_1000: - link->speed = SWITCH_PORT_SPEED_1000; - break; - } - - return 0; -} - -static int -ar7240_get_port_stats(struct switch_dev *dev, int port, - struct switch_port_stats *stats) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - - if (port >= AR7240_NUM_PORTS) - return -EINVAL; - - ar7240sw_capture_stats(as); - - read_lock(&as->stats_lock); - stats->rx_bytes = as->port_stats[port].rx_good_byte; - stats->tx_bytes = as->port_stats[port].tx_byte; - read_unlock(&as->stats_lock); - - return 0; -} - -static int -ar7240_set_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->value.i; - - if (port > 15) - return -EINVAL; - - ar7240sw_reg_rmw(mii, AR7240_REG_CPU_PORT, - AR7240_MIRROR_PORT_M << AR7240_MIRROR_PORT_S, - port << AR7240_MIRROR_PORT_S); - - return 0; -} - -static int -ar7240_get_mirror_monitor_port(struct switch_dev *dev, - const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ret; - - ret = ar7240sw_reg_read(mii, AR7240_REG_CPU_PORT); - val->value.i = (ret >> AR7240_MIRROR_PORT_S) & AR7240_MIRROR_PORT_M; - - return 0; -} - -static int -ar7240_set_mirror_rx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - if (val && val->value.i == 1) - ar7240sw_reg_set(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_RX); - else - ar7240sw_reg_rmw(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_RX, 0); - - return 0; -} - -static int -ar7240_get_mirror_rx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ctrl; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_PORT_CTRL(port)); - - if ((ctrl & AR7240_PORT_CTRL_MIRROR_RX) == AR7240_PORT_CTRL_MIRROR_RX) - val->value.i = 1; - else - val->value.i = 0; - - return 0; -} - -static int -ar7240_set_mirror_tx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - if (val && val->value.i == 1) - ar7240sw_reg_set(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_TX); - else - ar7240sw_reg_rmw(mii, AR7240_REG_PORT_CTRL(port), - AR7240_PORT_CTRL_MIRROR_TX, 0); - - return 0; -} - -static int -ar7240_get_mirror_tx(struct switch_dev *dev, const struct switch_attr *attr, - struct switch_val *val) -{ - struct ar7240sw *as = sw_to_ar7240(dev); - struct mii_bus *mii = as->mii_bus; - - u32 ctrl; - - int port = val->port_vlan; - - if (port >= dev->ports) - return -EINVAL; - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_PORT_CTRL(port)); - - if ((ctrl & AR7240_PORT_CTRL_MIRROR_TX) == AR7240_PORT_CTRL_MIRROR_TX) - val->value.i = 1; - else - val->value.i = 0; - - return 0; -} - -static struct switch_attr ar7240_globals[] = { - { - .type = SWITCH_TYPE_INT, - .name = "enable_vlan", - .description = "Enable VLAN mode", - .set = ar7240_set_vlan, - .get = ar7240_get_vlan, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "mirror_monitor_port", - .description = "Mirror monitor port", - .set = ar7240_set_mirror_monitor_port, - .get = ar7240_get_mirror_monitor_port, - .max = 15 - }, -}; - -static struct switch_attr ar7240_port[] = { - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_rx", - .description = "Enable mirroring of RX packets", - .set = ar7240_set_mirror_rx, - .get = ar7240_get_mirror_rx, - .max = 1 - }, - { - .type = SWITCH_TYPE_INT, - .name = "enable_mirror_tx", - .description = "Enable mirroring of TX packets", - .set = ar7240_set_mirror_tx, - .get = ar7240_get_mirror_tx, - .max = 1 - }, -}; - -static struct switch_attr ar7240_vlan[] = { - { - .type = SWITCH_TYPE_INT, - .name = "vid", - .description = "VLAN ID", - .set = ar7240_set_vid, - .get = ar7240_get_vid, - .max = 4094, - }, -}; - -static const struct switch_dev_ops ar7240_ops = { - .attr_global = { - .attr = ar7240_globals, - .n_attr = ARRAY_SIZE(ar7240_globals), - }, - .attr_port = { - .attr = ar7240_port, - .n_attr = ARRAY_SIZE(ar7240_port), - }, - .attr_vlan = { - .attr = ar7240_vlan, - .n_attr = ARRAY_SIZE(ar7240_vlan), - }, - .get_port_pvid = ar7240_get_pvid, - .set_port_pvid = ar7240_set_pvid, - .get_vlan_ports = ar7240_get_ports, - .set_vlan_ports = ar7240_set_ports, - .apply_config = ar7240_hw_apply, - .reset_switch = ar7240_reset_switch, - .get_port_link = ar7240_get_port_link, - .get_port_stats = ar7240_get_port_stats, -}; - -static struct ar7240sw * -ar7240_probe(struct ag71xx *ag, struct device_node *np) -{ - struct mii_bus *mii = ag->mii_bus; - struct ar7240sw *as; - struct switch_dev *swdev; - u32 ctrl; - u16 phy_id1; - u16 phy_id2; - int i; - - phy_id1 = ar7240sw_phy_read(mii, 0, MII_PHYSID1); - phy_id2 = ar7240sw_phy_read(mii, 0, MII_PHYSID2); - if ((phy_id1 != AR7240_PHY_ID1 || phy_id2 != AR7240_PHY_ID2) && - (phy_id1 != AR934X_PHY_ID1 || phy_id2 != AR934X_PHY_ID2)) { - pr_err("%s: unknown phy id '%04x:%04x'\n", - dev_name(&mii->dev), phy_id1, phy_id2); - return NULL; - } - - as = kzalloc(sizeof(*as), GFP_KERNEL); - if (!as) - return NULL; - - as->mii_bus = mii; - - swdev = &as->swdev; - - ctrl = ar7240sw_reg_read(mii, AR7240_REG_MASK_CTRL); - as->ver = (ctrl >> AR7240_MASK_CTRL_VERSION_S) & - AR7240_MASK_CTRL_VERSION_M; - - if (sw_is_ar7240(as)) { - swdev->name = "AR7240/AR9330 built-in switch"; - swdev->ports = AR7240_NUM_PORTS - 1; - } else if (sw_is_ar934x(as)) { - swdev->name = "AR934X built-in switch"; - - if (ag->phy_if_mode == PHY_INTERFACE_MODE_GMII) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE0, - AR934X_OPER_MODE0_MAC_GMII_EN); - } else if (ag->phy_if_mode == PHY_INTERFACE_MODE_MII) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE0, - AR934X_OPER_MODE0_PHY_MII_EN); - } else { - pr_err("%s: invalid PHY interface mode\n", - dev_name(&mii->dev)); - goto err_free; - } - - if (of_property_read_bool(np, "phy4-mii-enable")) { - ar7240sw_reg_set(mii, AR934X_REG_OPER_MODE1, - AR934X_REG_OPER_MODE1_PHY4_MII_EN); - swdev->ports = AR7240_NUM_PORTS - 1; - } else { - swdev->ports = AR7240_NUM_PORTS; - } - } else { - pr_err("%s: unsupported chip, ctrl=%08x\n", - dev_name(&mii->dev), ctrl); - goto err_free; - } - - swdev->cpu_port = AR7240_PORT_CPU; - swdev->vlans = AR7240_MAX_VLANS; - swdev->ops = &ar7240_ops; - - if (register_switch(&as->swdev, ag->dev) < 0) - goto err_free; - - pr_info("%s: Found an %s\n", dev_name(&mii->dev), swdev->name); - - /* initialize defaults */ - for (i = 0; i < AR7240_MAX_VLANS; i++) - as->vlan_id[i] = i; - - as->vlan_table[0] = ar7240sw_port_mask_all(as); - - return as; - -err_free: - kfree(as); - return NULL; -} - -void ag71xx_ar7240_start(struct ag71xx *ag) -{ - struct ar7240sw *as = ag->phy_priv; - - if (!as) - return; - - ar7240sw_reset(as); - - ar7240_set_addr(as, ag->dev->dev_addr); - ar7240_hw_apply(&as->swdev); -} - -int ag71xx_ar7240_init(struct ag71xx *ag, struct device_node *np) -{ - struct ar7240sw *as; - - as = ar7240_probe(ag, np); - if (!as) - return -ENODEV; - - ag->phy_priv = as; - ar7240sw_reset(as); - - rwlock_init(&as->stats_lock); - - return 0; -} - -void ag71xx_ar7240_cleanup(struct ag71xx *ag) -{ - struct ar7240sw *as = ag->phy_priv; - - if (!as) - return; - - unregister_switch(&as->swdev); - kfree(as); - ag->phy_priv = NULL; -} diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c deleted file mode 100644 index 20cf1c15c..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_debugfs.c +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -static struct dentry *ag71xx_debugfs_root; - -static int ag71xx_debugfs_generic_open(struct inode *inode, struct file *file) -{ - file->private_data = inode->i_private; - return 0; -} - -void ag71xx_debugfs_update_int_stats(struct ag71xx *ag, u32 status) -{ - if (status) - ag->debug.int_stats.total++; - if (status & AG71XX_INT_TX_PS) - ag->debug.int_stats.tx_ps++; - if (status & AG71XX_INT_TX_UR) - ag->debug.int_stats.tx_ur++; - if (status & AG71XX_INT_TX_BE) - ag->debug.int_stats.tx_be++; - if (status & AG71XX_INT_RX_PR) - ag->debug.int_stats.rx_pr++; - if (status & AG71XX_INT_RX_OF) - ag->debug.int_stats.rx_of++; - if (status & AG71XX_INT_RX_BE) - ag->debug.int_stats.rx_be++; -} - -static ssize_t read_file_int_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ -#define PR_INT_STAT(_label, _field) \ - len += snprintf(buf + len, sizeof(buf) - len, \ - "%20s: %10lu\n", _label, ag->debug.int_stats._field); - - struct ag71xx *ag = file->private_data; - char buf[256]; - unsigned int len = 0; - - PR_INT_STAT("TX Packet Sent", tx_ps); - PR_INT_STAT("TX Underrun", tx_ur); - PR_INT_STAT("TX Bus Error", tx_be); - PR_INT_STAT("RX Packet Received", rx_pr); - PR_INT_STAT("RX Overflow", rx_of); - PR_INT_STAT("RX Bus Error", rx_be); - len += snprintf(buf + len, sizeof(buf) - len, "\n"); - PR_INT_STAT("Total", total); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -#undef PR_INT_STAT -} - -static const struct file_operations ag71xx_fops_int_stats = { - .open = ag71xx_debugfs_generic_open, - .read = read_file_int_stats, - .owner = THIS_MODULE -}; - -void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, int rx, int tx) -{ - struct ag71xx_napi_stats *stats = &ag->debug.napi_stats; - - if (rx) { - stats->rx_count++; - stats->rx_packets += rx; - if (rx <= AG71XX_NAPI_WEIGHT) - stats->rx[rx]++; - if (rx > stats->rx_packets_max) - stats->rx_packets_max = rx; - } - - if (tx) { - stats->tx_count++; - stats->tx_packets += tx; - if (tx <= AG71XX_NAPI_WEIGHT) - stats->tx[tx]++; - if (tx > stats->tx_packets_max) - stats->tx_packets_max = tx; - } -} - -static ssize_t read_file_napi_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ag71xx *ag = file->private_data; - struct ag71xx_napi_stats *stats = &ag->debug.napi_stats; - char *buf; - unsigned int buflen; - unsigned int len = 0; - unsigned long rx_avg = 0; - unsigned long tx_avg = 0; - int ret; - int i; - - buflen = 2048; - buf = kmalloc(buflen, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - if (stats->rx_count) - rx_avg = stats->rx_packets / stats->rx_count; - - if (stats->tx_count) - tx_avg = stats->tx_packets / stats->tx_count; - - len += snprintf(buf + len, buflen - len, "%3s %10s %10s\n", - "len", "rx", "tx"); - - for (i = 1; i <= AG71XX_NAPI_WEIGHT; i++) - len += snprintf(buf + len, buflen - len, - "%3d: %10lu %10lu\n", - i, stats->rx[i], stats->tx[i]); - - len += snprintf(buf + len, buflen - len, "\n"); - - len += snprintf(buf + len, buflen - len, "%3s: %10lu %10lu\n", - "sum", stats->rx_count, stats->tx_count); - len += snprintf(buf + len, buflen - len, "%3s: %10lu %10lu\n", - "avg", rx_avg, tx_avg); - len += snprintf(buf + len, buflen - len, "%3s: %10lu %10lu\n", - "max", stats->rx_packets_max, stats->tx_packets_max); - len += snprintf(buf + len, buflen - len, "%3s: %10lu %10lu\n", - "pkt", stats->rx_packets, stats->tx_packets); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return ret; -} - -static const struct file_operations ag71xx_fops_napi_stats = { - .open = ag71xx_debugfs_generic_open, - .read = read_file_napi_stats, - .owner = THIS_MODULE -}; - -#define DESC_PRINT_LEN 64 - -static ssize_t read_file_ring(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos, - struct ag71xx *ag, - struct ag71xx_ring *ring, - unsigned desc_reg) -{ - int ring_size = BIT(ring->order); - int ring_mask = ring_size - 1; - char *buf; - unsigned int buflen; - unsigned int len = 0; - unsigned long flags; - ssize_t ret; - int curr; - int dirty; - u32 desc_hw; - int i; - - buflen = (ring_size * DESC_PRINT_LEN); - buf = kmalloc(buflen, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - len += snprintf(buf + len, buflen - len, - "Idx ... %-8s %-8s %-8s %-8s .\n", - "desc", "next", "data", "ctrl"); - - spin_lock_irqsave(&ag->lock, flags); - - curr = (ring->curr & ring_mask); - dirty = (ring->dirty & ring_mask); - desc_hw = ag71xx_rr(ag, desc_reg); - for (i = 0; i < ring_size; i++) { - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - u32 desc_dma = ((u32) ring->descs_dma) + i * AG71XX_DESC_SIZE; - - len += snprintf(buf + len, buflen - len, - "%3d %c%c%c %08x %08x %08x %08x %c\n", - i, - (i == curr) ? 'C' : ' ', - (i == dirty) ? 'D' : ' ', - (desc_hw == desc_dma) ? 'H' : ' ', - desc_dma, - desc->next, - desc->data, - desc->ctrl, - (desc->ctrl & DESC_EMPTY) ? 'E' : '*'); - } - - spin_unlock_irqrestore(&ag->lock, flags); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return ret; -} - -static ssize_t read_file_tx_ring(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ag71xx *ag = file->private_data; - - return read_file_ring(file, user_buf, count, ppos, ag, &ag->tx_ring, - AG71XX_REG_TX_DESC); -} - -static const struct file_operations ag71xx_fops_tx_ring = { - .open = ag71xx_debugfs_generic_open, - .read = read_file_tx_ring, - .owner = THIS_MODULE -}; - -static ssize_t read_file_rx_ring(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ag71xx *ag = file->private_data; - - return read_file_ring(file, user_buf, count, ppos, ag, &ag->rx_ring, - AG71XX_REG_RX_DESC); -} - -static const struct file_operations ag71xx_fops_rx_ring = { - .open = ag71xx_debugfs_generic_open, - .read = read_file_rx_ring, - .owner = THIS_MODULE -}; - -void ag71xx_debugfs_exit(struct ag71xx *ag) -{ - debugfs_remove_recursive(ag->debug.debugfs_dir); -} - -int ag71xx_debugfs_init(struct ag71xx *ag) -{ - struct device *dev = &ag->pdev->dev; - - ag->debug.debugfs_dir = debugfs_create_dir(dev_name(dev), - ag71xx_debugfs_root); - if (!ag->debug.debugfs_dir) { - dev_err(dev, "unable to create debugfs directory\n"); - return -ENOENT; - } - - debugfs_create_file("int_stats", S_IRUGO, ag->debug.debugfs_dir, - ag, &ag71xx_fops_int_stats); - debugfs_create_file("napi_stats", S_IRUGO, ag->debug.debugfs_dir, - ag, &ag71xx_fops_napi_stats); - debugfs_create_file("tx_ring", S_IRUGO, ag->debug.debugfs_dir, - ag, &ag71xx_fops_tx_ring); - debugfs_create_file("rx_ring", S_IRUGO, ag->debug.debugfs_dir, - ag, &ag71xx_fops_rx_ring); - - return 0; -} - -int ag71xx_debugfs_root_init(void) -{ - if (ag71xx_debugfs_root) - return -EBUSY; - - ag71xx_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); - if (!ag71xx_debugfs_root) - return -ENOENT; - - return 0; -} - -void ag71xx_debugfs_root_exit(void) -{ - debugfs_remove(ag71xx_debugfs_root); - ag71xx_debugfs_root = NULL; -} diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c deleted file mode 100644 index 6f37fda38..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -static int ag71xx_ethtool_get_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - - if (!phydev) - return -ENODEV; - - return phy_ethtool_ioctl(phydev, cmd); -} - -static int ag71xx_ethtool_set_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - - if (!phydev) - return -ENODEV; - - return phy_ethtool_ioctl(phydev, cmd); -} - -static u32 ag71xx_ethtool_get_msglevel(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - - return ag->msg_enable; -} - -static void ag71xx_ethtool_set_msglevel(struct net_device *dev, u32 msg_level) -{ - struct ag71xx *ag = netdev_priv(dev); - - ag->msg_enable = msg_level; -} - -static void ag71xx_ethtool_get_ringparam(struct net_device *dev, - struct ethtool_ringparam *er) -{ - struct ag71xx *ag = netdev_priv(dev); - - er->tx_max_pending = AG71XX_TX_RING_SIZE_MAX; - er->rx_max_pending = AG71XX_RX_RING_SIZE_MAX; - er->rx_mini_max_pending = 0; - er->rx_jumbo_max_pending = 0; - - er->tx_pending = BIT(ag->tx_ring.order); - er->rx_pending = BIT(ag->rx_ring.order); - er->rx_mini_pending = 0; - er->rx_jumbo_pending = 0; - - if (ag->tx_ring.desc_split) - er->tx_pending /= AG71XX_TX_RING_DS_PER_PKT; -} - -static int ag71xx_ethtool_set_ringparam(struct net_device *dev, - struct ethtool_ringparam *er) -{ - struct ag71xx *ag = netdev_priv(dev); - unsigned tx_size; - unsigned rx_size; - int err = 0; - - if (er->rx_mini_pending != 0|| - er->rx_jumbo_pending != 0 || - er->rx_pending == 0 || - er->tx_pending == 0) - return -EINVAL; - - tx_size = er->tx_pending < AG71XX_TX_RING_SIZE_MAX ? - er->tx_pending : AG71XX_TX_RING_SIZE_MAX; - - rx_size = er->rx_pending < AG71XX_RX_RING_SIZE_MAX ? - er->rx_pending : AG71XX_RX_RING_SIZE_MAX; - - if (netif_running(dev)) { - err = dev->netdev_ops->ndo_stop(dev); - if (err) - return err; - } - - if (ag->tx_ring.desc_split) - tx_size *= AG71XX_TX_RING_DS_PER_PKT; - - ag->tx_ring.order = ag71xx_ring_size_order(tx_size); - ag->rx_ring.order = ag71xx_ring_size_order(rx_size); - - if (netif_running(dev)) - err = dev->netdev_ops->ndo_open(dev); - - return err; -} - -struct ethtool_ops ag71xx_ethtool_ops = { - .set_settings = ag71xx_ethtool_set_settings, - .get_settings = ag71xx_ethtool_get_settings, - .get_msglevel = ag71xx_ethtool_get_msglevel, - .set_msglevel = ag71xx_ethtool_set_msglevel, - .get_ringparam = ag71xx_ethtool_get_ringparam, - .set_ringparam = ag71xx_ethtool_set_ringparam, - .get_link = ethtool_op_get_link, - .get_ts_info = ethtool_op_get_ts_info, -}; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c deleted file mode 100644 index 656a22a4b..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ /dev/null @@ -1,1614 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -#define AG71XX_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) - -static int ag71xx_msg_level = -1; - -module_param_named(msg_level, ag71xx_msg_level, int, 0); -MODULE_PARM_DESC(msg_level, "Message level (-1=defaults,0=none,...,16=all)"); - -#define ETH_SWITCH_HEADER_LEN 2 - -static int ag71xx_tx_packets(struct ag71xx *ag, bool flush); - -static inline unsigned int ag71xx_max_frame_len(unsigned int mtu) -{ - return ETH_SWITCH_HEADER_LEN + ETH_HLEN + VLAN_HLEN + mtu + ETH_FCS_LEN; -} - -static void ag71xx_dump_dma_regs(struct ag71xx *ag) -{ - DBG("%s: dma_tx_ctrl=%08x, dma_tx_desc=%08x, dma_tx_status=%08x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_TX_CTRL), - ag71xx_rr(ag, AG71XX_REG_TX_DESC), - ag71xx_rr(ag, AG71XX_REG_TX_STATUS)); - - DBG("%s: dma_rx_ctrl=%08x, dma_rx_desc=%08x, dma_rx_status=%08x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_RX_CTRL), - ag71xx_rr(ag, AG71XX_REG_RX_DESC), - ag71xx_rr(ag, AG71XX_REG_RX_STATUS)); -} - -static inline void ag71xx_dump_intr(struct ag71xx *ag, char *label, u32 intr) -{ - DBG("%s: %s intr=%08x %s%s%s%s%s%s\n", - ag->dev->name, label, intr, - (intr & AG71XX_INT_TX_PS) ? "TXPS " : "", - (intr & AG71XX_INT_TX_UR) ? "TXUR " : "", - (intr & AG71XX_INT_TX_BE) ? "TXBE " : "", - (intr & AG71XX_INT_RX_PR) ? "RXPR " : "", - (intr & AG71XX_INT_RX_OF) ? "RXOF " : "", - (intr & AG71XX_INT_RX_BE) ? "RXBE " : ""); -} - -static void ag71xx_ring_tx_clean(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->tx_ring; - struct net_device *dev = ag->dev; - int ring_mask = BIT(ring->order) - 1; - u32 bytes_compl = 0, pkts_compl = 0; - - while (ring->curr != ring->dirty) { - struct ag71xx_desc *desc; - u32 i = ring->dirty & ring_mask; - - desc = ag71xx_ring_desc(ring, i); - if (!ag71xx_desc_empty(desc)) { - desc->ctrl = 0; - dev->stats.tx_errors++; - } - - if (ring->buf[i].skb) { - bytes_compl += ring->buf[i].len; - pkts_compl++; - dev_kfree_skb_any(ring->buf[i].skb); - } - ring->buf[i].skb = NULL; - ring->dirty++; - } - - /* flush descriptors */ - wmb(); - - netdev_completed_queue(dev, pkts_compl, bytes_compl); -} - -static void ag71xx_ring_tx_init(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->tx_ring; - int ring_size = BIT(ring->order); - int ring_mask = ring_size - 1; - int i; - - for (i = 0; i < ring_size; i++) { - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - - desc->next = (u32) (ring->descs_dma + - AG71XX_DESC_SIZE * ((i + 1) & ring_mask)); - - desc->ctrl = DESC_EMPTY; - ring->buf[i].skb = NULL; - } - - /* flush descriptors */ - wmb(); - - ring->curr = 0; - ring->dirty = 0; - netdev_reset_queue(ag->dev); -} - -static void ag71xx_ring_rx_clean(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->rx_ring; - int ring_size = BIT(ring->order); - int i; - - if (!ring->buf) - return; - - for (i = 0; i < ring_size; i++) - if (ring->buf[i].rx_buf) { - dma_unmap_single(&ag->dev->dev, ring->buf[i].dma_addr, - ag->rx_buf_size, DMA_FROM_DEVICE); - skb_free_frag(ring->buf[i].rx_buf); - } -} - -static int ag71xx_buffer_size(struct ag71xx *ag) -{ - return ag->rx_buf_size + - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); -} - -static bool ag71xx_fill_rx_buf(struct ag71xx *ag, struct ag71xx_buf *buf, - int offset, - void *(*alloc)(unsigned int size)) -{ - struct ag71xx_ring *ring = &ag->rx_ring; - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, buf - &ring->buf[0]); - void *data; - - data = alloc(ag71xx_buffer_size(ag)); - if (!data) - return false; - - buf->rx_buf = data; - buf->dma_addr = dma_map_single(&ag->dev->dev, data, ag->rx_buf_size, - DMA_FROM_DEVICE); - desc->data = (u32) buf->dma_addr + offset; - return true; -} - -static int ag71xx_ring_rx_init(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->rx_ring; - int ring_size = BIT(ring->order); - int ring_mask = BIT(ring->order) - 1; - unsigned int i; - int ret; - - ret = 0; - for (i = 0; i < ring_size; i++) { - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - - desc->next = (u32) (ring->descs_dma + - AG71XX_DESC_SIZE * ((i + 1) & ring_mask)); - - DBG("ag71xx: RX desc at %p, next is %08x\n", - desc, desc->next); - } - - for (i = 0; i < ring_size; i++) { - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - - if (!ag71xx_fill_rx_buf(ag, &ring->buf[i], ag->rx_buf_offset, - netdev_alloc_frag)) { - ret = -ENOMEM; - break; - } - - desc->ctrl = DESC_EMPTY; - } - - /* flush descriptors */ - wmb(); - - ring->curr = 0; - ring->dirty = 0; - - return ret; -} - -static int ag71xx_ring_rx_refill(struct ag71xx *ag) -{ - struct ag71xx_ring *ring = &ag->rx_ring; - int ring_mask = BIT(ring->order) - 1; - unsigned int count; - int offset = ag->rx_buf_offset; - - count = 0; - for (; ring->curr - ring->dirty > 0; ring->dirty++) { - struct ag71xx_desc *desc; - unsigned int i; - - i = ring->dirty & ring_mask; - desc = ag71xx_ring_desc(ring, i); - - if (!ring->buf[i].rx_buf && - !ag71xx_fill_rx_buf(ag, &ring->buf[i], offset, - napi_alloc_frag)) - break; - - desc->ctrl = DESC_EMPTY; - count++; - } - - /* flush descriptors */ - wmb(); - - DBG("%s: %u rx descriptors refilled\n", ag->dev->name, count); - - return count; -} - -static int ag71xx_rings_init(struct ag71xx *ag) -{ - struct ag71xx_ring *tx = &ag->tx_ring; - struct ag71xx_ring *rx = &ag->rx_ring; - int ring_size = BIT(tx->order) + BIT(rx->order); - int tx_size = BIT(tx->order); - - tx->buf = kzalloc(ring_size * sizeof(*tx->buf), GFP_KERNEL); - if (!tx->buf) - return -ENOMEM; - - tx->descs_cpu = dma_alloc_coherent(NULL, ring_size * AG71XX_DESC_SIZE, - &tx->descs_dma, GFP_ATOMIC); - if (!tx->descs_cpu) { - kfree(tx->buf); - tx->buf = NULL; - return -ENOMEM; - } - - rx->buf = &tx->buf[BIT(tx->order)]; - rx->descs_cpu = ((void *)tx->descs_cpu) + tx_size * AG71XX_DESC_SIZE; - rx->descs_dma = tx->descs_dma + tx_size * AG71XX_DESC_SIZE; - - ag71xx_ring_tx_init(ag); - return ag71xx_ring_rx_init(ag); -} - -static void ag71xx_rings_free(struct ag71xx *ag) -{ - struct ag71xx_ring *tx = &ag->tx_ring; - struct ag71xx_ring *rx = &ag->rx_ring; - int ring_size = BIT(tx->order) + BIT(rx->order); - - if (tx->descs_cpu) - dma_free_coherent(NULL, ring_size * AG71XX_DESC_SIZE, - tx->descs_cpu, tx->descs_dma); - - kfree(tx->buf); - - tx->descs_cpu = NULL; - rx->descs_cpu = NULL; - tx->buf = NULL; - rx->buf = NULL; -} - -static void ag71xx_rings_cleanup(struct ag71xx *ag) -{ - ag71xx_ring_rx_clean(ag); - ag71xx_ring_tx_clean(ag); - ag71xx_rings_free(ag); - - netdev_reset_queue(ag->dev); -} - -static unsigned char *ag71xx_speed_str(struct ag71xx *ag) -{ - switch (ag->speed) { - case SPEED_1000: - return "1000"; - case SPEED_100: - return "100"; - case SPEED_10: - return "10"; - } - - return "?"; -} - -static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac) -{ - u32 t; - - t = (((u32) mac[5]) << 24) | (((u32) mac[4]) << 16) - | (((u32) mac[3]) << 8) | ((u32) mac[2]); - - ag71xx_wr(ag, AG71XX_REG_MAC_ADDR1, t); - - t = (((u32) mac[1]) << 24) | (((u32) mac[0]) << 16); - ag71xx_wr(ag, AG71XX_REG_MAC_ADDR2, t); -} - -static void ag71xx_dma_reset(struct ag71xx *ag) -{ - u32 val; - int i; - - ag71xx_dump_dma_regs(ag); - - /* stop RX and TX */ - ag71xx_wr(ag, AG71XX_REG_RX_CTRL, 0); - ag71xx_wr(ag, AG71XX_REG_TX_CTRL, 0); - - /* - * give the hardware some time to really stop all rx/tx activity - * clearing the descriptors too early causes random memory corruption - */ - mdelay(1); - - /* clear descriptor addresses */ - ag71xx_wr(ag, AG71XX_REG_TX_DESC, ag->stop_desc_dma); - ag71xx_wr(ag, AG71XX_REG_RX_DESC, ag->stop_desc_dma); - - /* clear pending RX/TX interrupts */ - for (i = 0; i < 256; i++) { - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_PR); - ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_PS); - } - - /* clear pending errors */ - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_BE | RX_STATUS_OF); - ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_BE | TX_STATUS_UR); - - val = ag71xx_rr(ag, AG71XX_REG_RX_STATUS); - if (val) - pr_alert("%s: unable to clear DMA Rx status: %08x\n", - ag->dev->name, val); - - val = ag71xx_rr(ag, AG71XX_REG_TX_STATUS); - - /* mask out reserved bits */ - val &= ~0xff000000; - - if (val) - pr_alert("%s: unable to clear DMA Tx status: %08x\n", - ag->dev->name, val); - - ag71xx_dump_dma_regs(ag); -} - -#define MAC_CFG1_INIT (MAC_CFG1_RXE | MAC_CFG1_TXE | \ - MAC_CFG1_SRX | MAC_CFG1_STX) - -#define FIFO_CFG0_INIT (FIFO_CFG0_ALL << FIFO_CFG0_ENABLE_SHIFT) - -#define FIFO_CFG4_INIT (FIFO_CFG4_DE | FIFO_CFG4_DV | FIFO_CFG4_FC | \ - FIFO_CFG4_CE | FIFO_CFG4_CR | FIFO_CFG4_LM | \ - FIFO_CFG4_LO | FIFO_CFG4_OK | FIFO_CFG4_MC | \ - FIFO_CFG4_BC | FIFO_CFG4_DR | FIFO_CFG4_LE | \ - FIFO_CFG4_CF | FIFO_CFG4_PF | FIFO_CFG4_UO | \ - FIFO_CFG4_VT) - -#define FIFO_CFG5_INIT (FIFO_CFG5_DE | FIFO_CFG5_DV | FIFO_CFG5_FC | \ - FIFO_CFG5_CE | FIFO_CFG5_LO | FIFO_CFG5_OK | \ - FIFO_CFG5_MC | FIFO_CFG5_BC | FIFO_CFG5_DR | \ - FIFO_CFG5_CF | FIFO_CFG5_PF | FIFO_CFG5_VT | \ - FIFO_CFG5_LE | FIFO_CFG5_FT | FIFO_CFG5_16 | \ - FIFO_CFG5_17 | FIFO_CFG5_SF) - -static void ag71xx_hw_stop(struct ag71xx *ag) -{ - /* disable all interrupts and stop the rx/tx engine */ - ag71xx_wr(ag, AG71XX_REG_INT_ENABLE, 0); - ag71xx_wr(ag, AG71XX_REG_RX_CTRL, 0); - ag71xx_wr(ag, AG71XX_REG_TX_CTRL, 0); -} - -static void ag71xx_hw_setup(struct ag71xx *ag) -{ - struct device_node *np = ag->pdev->dev.of_node; - u32 init = MAC_CFG1_INIT; - - /* setup MAC configuration registers */ - if (of_property_read_bool(np, "flow-control")) - init |= MAC_CFG1_TFC | MAC_CFG1_RFC; - ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, init); - - ag71xx_sb(ag, AG71XX_REG_MAC_CFG2, - MAC_CFG2_PAD_CRC_EN | MAC_CFG2_LEN_CHECK); - - /* setup max frame length to zero */ - ag71xx_wr(ag, AG71XX_REG_MAC_MFL, 0); - - /* setup FIFO configuration registers */ - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG0, FIFO_CFG0_INIT); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG1, ag->fifodata[0]); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG2, ag->fifodata[1]); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG4, FIFO_CFG4_INIT); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, FIFO_CFG5_INIT); -} - -static void ag71xx_hw_init(struct ag71xx *ag) -{ - ag71xx_hw_stop(ag); - - if (ag->phy_reset) { - reset_control_assert(ag->phy_reset); - msleep(50); - reset_control_deassert(ag->phy_reset); - msleep(200); - } - - ag71xx_sb(ag, AG71XX_REG_MAC_CFG1, MAC_CFG1_SR); - udelay(20); - - reset_control_assert(ag->mac_reset); - msleep(100); - reset_control_deassert(ag->mac_reset); - msleep(200); - - ag71xx_hw_setup(ag); - - ag71xx_dma_reset(ag); -} - -static void ag71xx_fast_reset(struct ag71xx *ag) -{ - struct net_device *dev = ag->dev; - u32 rx_ds; - u32 mii_reg; - - ag71xx_hw_stop(ag); - wmb(); - - mii_reg = ag71xx_rr(ag, AG71XX_REG_MII_CFG); - rx_ds = ag71xx_rr(ag, AG71XX_REG_RX_DESC); - - ag71xx_tx_packets(ag, true); - - reset_control_assert(ag->mac_reset); - udelay(10); - reset_control_deassert(ag->mac_reset); - udelay(10); - - ag71xx_dma_reset(ag); - ag71xx_hw_setup(ag); - ag->tx_ring.curr = 0; - ag->tx_ring.dirty = 0; - netdev_reset_queue(ag->dev); - - /* setup max frame length */ - ag71xx_wr(ag, AG71XX_REG_MAC_MFL, - ag71xx_max_frame_len(ag->dev->mtu)); - - ag71xx_wr(ag, AG71XX_REG_RX_DESC, rx_ds); - ag71xx_wr(ag, AG71XX_REG_TX_DESC, ag->tx_ring.descs_dma); - ag71xx_wr(ag, AG71XX_REG_MII_CFG, mii_reg); - - ag71xx_hw_set_macaddr(ag, dev->dev_addr); -} - -static void ag71xx_hw_start(struct ag71xx *ag) -{ - /* start RX engine */ - ag71xx_wr(ag, AG71XX_REG_RX_CTRL, RX_CTRL_RXE); - - /* enable interrupts */ - ag71xx_wr(ag, AG71XX_REG_INT_ENABLE, AG71XX_INT_INIT); - - netif_wake_queue(ag->dev); -} - -static void ath79_set_pllval(struct ag71xx *ag) -{ - u32 pll_reg = ag->pllreg[1]; - u32 pll_val; - - if (!ag->pllregmap) - return; - - switch (ag->speed) { - case SPEED_10: - pll_val = ag->plldata[2]; - break; - case SPEED_100: - pll_val = ag->plldata[1]; - break; - case SPEED_1000: - pll_val = ag->plldata[0]; - break; - default: - BUG(); - } - - if (pll_val) - regmap_write(ag->pllregmap, pll_reg, pll_val); -} - -static void ath79_set_pll(struct ag71xx *ag) -{ - u32 pll_cfg = ag->pllreg[0]; - u32 pll_shift = ag->pllreg[2]; - - if (!ag->pllregmap) - return; - - regmap_update_bits(ag->pllregmap, pll_cfg, 3 << pll_shift, 2 << pll_shift); - udelay(100); - - ath79_set_pllval(ag); - - regmap_update_bits(ag->pllregmap, pll_cfg, 3 << pll_shift, 3 << pll_shift); - udelay(100); - - regmap_update_bits(ag->pllregmap, pll_cfg, 3 << pll_shift, 0); - udelay(100); -} - -static void ath79_mii_ctrl_set_speed(struct ag71xx *ag) -{ - unsigned int mii_speed; - u32 t; - - if (!ag->mii_base) - return; - - switch (ag->speed) { - case SPEED_10: - mii_speed = AR71XX_MII_CTRL_SPEED_10; - break; - case SPEED_100: - mii_speed = AR71XX_MII_CTRL_SPEED_100; - break; - case SPEED_1000: - mii_speed = AR71XX_MII_CTRL_SPEED_1000; - break; - default: - BUG(); - } - - t = __raw_readl(ag->mii_base); - t &= ~(AR71XX_MII_CTRL_IF_MASK); - t |= (mii_speed & AR71XX_MII_CTRL_IF_MASK); - __raw_writel(t, ag->mii_base); -} - -static void -__ag71xx_link_adjust(struct ag71xx *ag, bool update) -{ - struct device_node *np = ag->pdev->dev.of_node; - u32 cfg2; - u32 ifctl; - u32 fifo5; - - if (!ag->link && update) { - ag71xx_hw_stop(ag); - netif_carrier_off(ag->dev); - if (netif_msg_link(ag)) - pr_info("%s: link down\n", ag->dev->name); - return; - } - - if (!of_device_is_compatible(np, "qca,ar9130-eth") && - !of_device_is_compatible(np, "qca,ar7100-eth")) - ag71xx_fast_reset(ag); - - cfg2 = ag71xx_rr(ag, AG71XX_REG_MAC_CFG2); - cfg2 &= ~(MAC_CFG2_IF_1000 | MAC_CFG2_IF_10_100 | MAC_CFG2_FDX); - cfg2 |= (ag->duplex) ? MAC_CFG2_FDX : 0; - - ifctl = ag71xx_rr(ag, AG71XX_REG_MAC_IFCTL); - ifctl &= ~(MAC_IFCTL_SPEED); - - fifo5 = ag71xx_rr(ag, AG71XX_REG_FIFO_CFG5); - fifo5 &= ~FIFO_CFG5_BM; - - switch (ag->speed) { - case SPEED_1000: - cfg2 |= MAC_CFG2_IF_1000; - fifo5 |= FIFO_CFG5_BM; - break; - case SPEED_100: - cfg2 |= MAC_CFG2_IF_10_100; - ifctl |= MAC_IFCTL_SPEED; - break; - case SPEED_10: - cfg2 |= MAC_CFG2_IF_10_100; - break; - default: - BUG(); - return; - } - - if (ag->tx_ring.desc_split) { - ag->fifodata[2] &= 0xffff; - ag->fifodata[2] |= ((2048 - ag->tx_ring.desc_split) / 4) << 16; - } - - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG3, ag->fifodata[2]); - - if (update) { - if (of_device_is_compatible(np, "qca,ar7100-eth")) { - ath79_set_pll(ag); - ath79_mii_ctrl_set_speed(ag); - } else if (of_device_is_compatible(np, "qca,ar7242-eth")) { - ath79_set_pll(ag); - } else if (of_device_is_compatible(np, "qca,ar9130-eth")) { - ath79_set_pll(ag); - ath79_mii_ctrl_set_speed(ag); - } else if (of_device_is_compatible(np, "qca,ar9340-eth")) { - ath79_set_pll(ag); - } else if (of_device_is_compatible(np, "qca,qca9550-eth")) { - } else if (of_device_is_compatible(np, "qca,qca9560-eth")) { - } - } - - ag71xx_wr(ag, AG71XX_REG_MAC_CFG2, cfg2); - ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, fifo5); - ag71xx_wr(ag, AG71XX_REG_MAC_IFCTL, ifctl); - - if (of_device_is_compatible(np, "qca,qca9530-eth")) { - /* - * The rx ring buffer can stall on small packets on QCA953x and - * QCA956x. Disabling the inline checksum engine fixes the stall. - * The wr, rr functions cannot be used since this hidden register - * is outside of the normal ag71xx register block. - */ - void __iomem *dam = ioremap_nocache(0xb90001bc, 0x4); - if (dam) { - __raw_writel(__raw_readl(dam) & ~BIT(27), dam); - (void)__raw_readl(dam); - iounmap(dam); - } - } - - ag71xx_hw_start(ag); - - netif_carrier_on(ag->dev); - if (update && netif_msg_link(ag)) - pr_info("%s: link up (%sMbps/%s duplex)\n", - ag->dev->name, - ag71xx_speed_str(ag), - (DUPLEX_FULL == ag->duplex) ? "Full" : "Half"); - - DBG("%s: fifo_cfg0=%#x, fifo_cfg1=%#x, fifo_cfg2=%#x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG0), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG1), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG2)); - - DBG("%s: fifo_cfg3=%#x, fifo_cfg4=%#x, fifo_cfg5=%#x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG3), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG4), - ag71xx_rr(ag, AG71XX_REG_FIFO_CFG5)); - - DBG("%s: mac_cfg2=%#x, mac_ifctl=%#x\n", - ag->dev->name, - ag71xx_rr(ag, AG71XX_REG_MAC_CFG2), - ag71xx_rr(ag, AG71XX_REG_MAC_IFCTL)); -} - -void ag71xx_link_adjust(struct ag71xx *ag) -{ - __ag71xx_link_adjust(ag, true); -} - -static int ag71xx_hw_enable(struct ag71xx *ag) -{ - int ret; - - ret = ag71xx_rings_init(ag); - if (ret) - return ret; - - napi_enable(&ag->napi); - ag71xx_wr(ag, AG71XX_REG_TX_DESC, ag->tx_ring.descs_dma); - ag71xx_wr(ag, AG71XX_REG_RX_DESC, ag->rx_ring.descs_dma); - netif_start_queue(ag->dev); - - return 0; -} - -static void ag71xx_hw_disable(struct ag71xx *ag) -{ - unsigned long flags; - - spin_lock_irqsave(&ag->lock, flags); - - netif_stop_queue(ag->dev); - - ag71xx_hw_stop(ag); - ag71xx_dma_reset(ag); - - napi_disable(&ag->napi); - del_timer_sync(&ag->oom_timer); - - spin_unlock_irqrestore(&ag->lock, flags); - - ag71xx_rings_cleanup(ag); -} - -static int ag71xx_open(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - unsigned int max_frame_len; - int ret; - - netif_carrier_off(dev); - max_frame_len = ag71xx_max_frame_len(dev->mtu); - ag->rx_buf_size = SKB_DATA_ALIGN(max_frame_len + NET_SKB_PAD + NET_IP_ALIGN); - - /* setup max frame length */ - ag71xx_wr(ag, AG71XX_REG_MAC_MFL, max_frame_len); - ag71xx_hw_set_macaddr(ag, dev->dev_addr); - - ret = ag71xx_hw_enable(ag); - if (ret) - goto err; - - ag71xx_ar7240_start(ag); - phy_start(ag->phy_dev); - - return 0; - -err: - ag71xx_rings_cleanup(ag); - return ret; -} - -static int ag71xx_stop(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - - netif_carrier_off(dev); - phy_stop(ag->phy_dev); - ag71xx_hw_disable(ag); - - return 0; -} - -static int ag71xx_fill_dma_desc(struct ag71xx_ring *ring, u32 addr, int len) -{ - int i; - struct ag71xx_desc *desc; - int ring_mask = BIT(ring->order) - 1; - int ndesc = 0; - int split = ring->desc_split; - - if (!split) - split = len; - - while (len > 0) { - unsigned int cur_len = len; - - i = (ring->curr + ndesc) & ring_mask; - desc = ag71xx_ring_desc(ring, i); - - if (!ag71xx_desc_empty(desc)) - return -1; - - if (cur_len > split) { - cur_len = split; - - /* - * TX will hang if DMA transfers <= 4 bytes, - * make sure next segment is more than 4 bytes long. - */ - if (len <= split + 4) - cur_len -= 4; - } - - desc->data = addr; - addr += cur_len; - len -= cur_len; - - if (len > 0) - cur_len |= DESC_MORE; - - /* prevent early tx attempt of this descriptor */ - if (!ndesc) - cur_len |= DESC_EMPTY; - - desc->ctrl = cur_len; - ndesc++; - } - - return ndesc; -} - -static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - struct ag71xx_ring *ring = &ag->tx_ring; - int ring_mask = BIT(ring->order) - 1; - int ring_size = BIT(ring->order); - struct ag71xx_desc *desc; - dma_addr_t dma_addr; - int i, n, ring_min; - - if (skb->len <= 4) { - DBG("%s: packet len is too small\n", ag->dev->name); - goto err_drop; - } - - dma_addr = dma_map_single(&dev->dev, skb->data, skb->len, - DMA_TO_DEVICE); - - i = ring->curr & ring_mask; - desc = ag71xx_ring_desc(ring, i); - - /* setup descriptor fields */ - n = ag71xx_fill_dma_desc(ring, (u32) dma_addr, skb->len & ag->desc_pktlen_mask); - if (n < 0) - goto err_drop_unmap; - - i = (ring->curr + n - 1) & ring_mask; - ring->buf[i].len = skb->len; - ring->buf[i].skb = skb; - - netdev_sent_queue(dev, skb->len); - - skb_tx_timestamp(skb); - - desc->ctrl &= ~DESC_EMPTY; - ring->curr += n; - - /* flush descriptor */ - wmb(); - - ring_min = 2; - if (ring->desc_split) - ring_min *= AG71XX_TX_RING_DS_PER_PKT; - - if (ring->curr - ring->dirty >= ring_size - ring_min) { - DBG("%s: tx queue full\n", dev->name); - netif_stop_queue(dev); - } - - DBG("%s: packet injected into TX queue\n", ag->dev->name); - - /* enable TX engine */ - ag71xx_wr(ag, AG71XX_REG_TX_CTRL, TX_CTRL_TXE); - - return NETDEV_TX_OK; - -err_drop_unmap: - dma_unmap_single(&dev->dev, dma_addr, skb->len, DMA_TO_DEVICE); - -err_drop: - dev->stats.tx_dropped++; - - dev_kfree_skb(skb); - return NETDEV_TX_OK; -} - -static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - struct ag71xx *ag = netdev_priv(dev); - int ret; - - switch (cmd) { - case SIOCETHTOOL: - if (ag->phy_dev == NULL) - break; - - spin_lock_irq(&ag->lock); - ret = phy_ethtool_ioctl(ag->phy_dev, (void *) ifr->ifr_data); - spin_unlock_irq(&ag->lock); - return ret; - - case SIOCSIFHWADDR: - if (copy_from_user - (dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr))) - return -EFAULT; - return 0; - - case SIOCGIFHWADDR: - if (copy_to_user - (ifr->ifr_data, dev->dev_addr, sizeof(dev->dev_addr))) - return -EFAULT; - return 0; - - case SIOCGMIIPHY: - case SIOCGMIIREG: - case SIOCSMIIREG: - if (ag->phy_dev == NULL) - break; - - return phy_mii_ioctl(ag->phy_dev, ifr, cmd); - - default: - break; - } - - return -EOPNOTSUPP; -} - -static void ag71xx_oom_timer_handler(unsigned long data) -{ - struct net_device *dev = (struct net_device *) data; - struct ag71xx *ag = netdev_priv(dev); - - napi_schedule(&ag->napi); -} - -static void ag71xx_tx_timeout(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - - if (netif_msg_tx_err(ag)) - pr_info("%s: tx timeout\n", ag->dev->name); - - schedule_delayed_work(&ag->restart_work, 1); -} - -static void ag71xx_restart_work_func(struct work_struct *work) -{ - struct ag71xx *ag = container_of(work, struct ag71xx, restart_work.work); - - rtnl_lock(); - ag71xx_hw_disable(ag); - ag71xx_hw_enable(ag); - if (ag->link) - __ag71xx_link_adjust(ag, false); - rtnl_unlock(); -} - -static bool ag71xx_check_dma_stuck(struct ag71xx *ag) -{ - unsigned long timestamp; - u32 rx_sm, tx_sm, rx_fd; - - timestamp = netdev_get_tx_queue(ag->dev, 0)->trans_start; - if (likely(time_before(jiffies, timestamp + HZ/10))) - return false; - - if (!netif_carrier_ok(ag->dev)) - return false; - - rx_sm = ag71xx_rr(ag, AG71XX_REG_RX_SM); - if ((rx_sm & 0x7) == 0x3 && ((rx_sm >> 4) & 0x7) == 0x6) - return true; - - tx_sm = ag71xx_rr(ag, AG71XX_REG_TX_SM); - rx_fd = ag71xx_rr(ag, AG71XX_REG_FIFO_DEPTH); - if (((tx_sm >> 4) & 0x7) == 0 && ((rx_sm & 0x7) == 0) && - ((rx_sm >> 4) & 0x7) == 0 && rx_fd == 0) - return true; - - return false; -} - -static int ag71xx_tx_packets(struct ag71xx *ag, bool flush) -{ - struct ag71xx_ring *ring = &ag->tx_ring; - bool dma_stuck = false; - int ring_mask = BIT(ring->order) - 1; - int ring_size = BIT(ring->order); - int sent = 0; - int bytes_compl = 0; - int n = 0; - - DBG("%s: processing TX ring\n", ag->dev->name); - - while (ring->dirty + n != ring->curr) { - unsigned int i = (ring->dirty + n) & ring_mask; - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - struct sk_buff *skb = ring->buf[i].skb; - - if (!flush && !ag71xx_desc_empty(desc)) { - if (ag->tx_hang_workaround && - ag71xx_check_dma_stuck(ag)) { - schedule_delayed_work(&ag->restart_work, HZ / 2); - dma_stuck = true; - } - break; - } - - if (flush) - desc->ctrl |= DESC_EMPTY; - - n++; - if (!skb) - continue; - - dev_kfree_skb_any(skb); - ring->buf[i].skb = NULL; - - bytes_compl += ring->buf[i].len; - - sent++; - ring->dirty += n; - - while (n > 0) { - ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_PS); - n--; - } - } - - DBG("%s: %d packets sent out\n", ag->dev->name, sent); - - if (!sent) - return 0; - - ag->dev->stats.tx_bytes += bytes_compl; - ag->dev->stats.tx_packets += sent; - - netdev_completed_queue(ag->dev, sent, bytes_compl); - if ((ring->curr - ring->dirty) < (ring_size * 3) / 4) - netif_wake_queue(ag->dev); - - if (!dma_stuck) - cancel_delayed_work(&ag->restart_work); - - return sent; -} - -static int ag71xx_rx_packets(struct ag71xx *ag, int limit) -{ - struct net_device *dev = ag->dev; - struct ag71xx_ring *ring = &ag->rx_ring; - unsigned int pktlen_mask = ag->desc_pktlen_mask; - unsigned int offset = ag->rx_buf_offset; - int ring_mask = BIT(ring->order) - 1; - int ring_size = BIT(ring->order); - struct sk_buff_head queue; - struct sk_buff *skb; - int done = 0; - - DBG("%s: rx packets, limit=%d, curr=%u, dirty=%u\n", - dev->name, limit, ring->curr, ring->dirty); - - skb_queue_head_init(&queue); - - while (done < limit) { - unsigned int i = ring->curr & ring_mask; - struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); - int pktlen; - int err = 0; - - if (ag71xx_desc_empty(desc)) - break; - - if ((ring->dirty + ring_size) == ring->curr) { - ag71xx_assert(0); - break; - } - - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_PR); - - pktlen = desc->ctrl & pktlen_mask; - pktlen -= ETH_FCS_LEN; - - dma_unmap_single(&dev->dev, ring->buf[i].dma_addr, - ag->rx_buf_size, DMA_FROM_DEVICE); - - dev->stats.rx_packets++; - dev->stats.rx_bytes += pktlen; - - skb = build_skb(ring->buf[i].rx_buf, ag71xx_buffer_size(ag)); - if (!skb) { - skb_free_frag(ring->buf[i].rx_buf); - goto next; - } - - skb_reserve(skb, offset); - skb_put(skb, pktlen); - - if (err) { - dev->stats.rx_dropped++; - kfree_skb(skb); - } else { - skb->dev = dev; - skb->ip_summed = CHECKSUM_NONE; - __skb_queue_tail(&queue, skb); - } - -next: - ring->buf[i].rx_buf = NULL; - done++; - - ring->curr++; - } - - ag71xx_ring_rx_refill(ag); - - while ((skb = __skb_dequeue(&queue)) != NULL) { - skb->protocol = eth_type_trans(skb, dev); - netif_receive_skb(skb); - } - - DBG("%s: rx finish, curr=%u, dirty=%u, done=%d\n", - dev->name, ring->curr, ring->dirty, done); - - return done; -} - -static int ag71xx_poll(struct napi_struct *napi, int limit) -{ - struct ag71xx *ag = container_of(napi, struct ag71xx, napi); - struct net_device *dev = ag->dev; - struct ag71xx_ring *rx_ring = &ag->rx_ring; - int rx_ring_size = BIT(rx_ring->order); - unsigned long flags; - u32 status; - int tx_done; - int rx_done; - - tx_done = ag71xx_tx_packets(ag, false); - - DBG("%s: processing RX ring\n", dev->name); - rx_done = ag71xx_rx_packets(ag, limit); - - ag71xx_debugfs_update_napi_stats(ag, rx_done, tx_done); - - if (rx_ring->buf[rx_ring->dirty % rx_ring_size].rx_buf == NULL) - goto oom; - - status = ag71xx_rr(ag, AG71XX_REG_RX_STATUS); - if (unlikely(status & RX_STATUS_OF)) { - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_OF); - dev->stats.rx_fifo_errors++; - - /* restart RX */ - ag71xx_wr(ag, AG71XX_REG_RX_CTRL, RX_CTRL_RXE); - } - - if (rx_done < limit) { - if (status & RX_STATUS_PR) - goto more; - - status = ag71xx_rr(ag, AG71XX_REG_TX_STATUS); - if (status & TX_STATUS_PS) - goto more; - - DBG("%s: disable polling mode, rx=%d, tx=%d,limit=%d\n", - dev->name, rx_done, tx_done, limit); - - napi_complete(napi); - - /* enable interrupts */ - spin_lock_irqsave(&ag->lock, flags); - ag71xx_int_enable(ag, AG71XX_INT_POLL); - spin_unlock_irqrestore(&ag->lock, flags); - return rx_done; - } - -more: - DBG("%s: stay in polling mode, rx=%d, tx=%d, limit=%d\n", - dev->name, rx_done, tx_done, limit); - return limit; - -oom: - if (netif_msg_rx_err(ag)) - pr_info("%s: out of memory\n", dev->name); - - mod_timer(&ag->oom_timer, jiffies + AG71XX_OOM_REFILL); - napi_complete(napi); - return 0; -} - -static irqreturn_t ag71xx_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = dev_id; - struct ag71xx *ag = netdev_priv(dev); - u32 status; - - status = ag71xx_rr(ag, AG71XX_REG_INT_STATUS); - ag71xx_dump_intr(ag, "raw", status); - - if (unlikely(!status)) - return IRQ_NONE; - - if (unlikely(status & AG71XX_INT_ERR)) { - if (status & AG71XX_INT_TX_BE) { - ag71xx_wr(ag, AG71XX_REG_TX_STATUS, TX_STATUS_BE); - dev_err(&dev->dev, "TX BUS error\n"); - } - if (status & AG71XX_INT_RX_BE) { - ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_BE); - dev_err(&dev->dev, "RX BUS error\n"); - } - } - - if (likely(status & AG71XX_INT_POLL)) { - ag71xx_int_disable(ag, AG71XX_INT_POLL); - DBG("%s: enable polling mode\n", dev->name); - napi_schedule(&ag->napi); - } - - ag71xx_debugfs_update_int_stats(ag, status); - - return IRQ_HANDLED; -} - -#ifdef CONFIG_NET_POLL_CONTROLLER -/* - * Polling 'interrupt' - used by things like netconsole to send skbs - * without having to re-enable interrupts. It's not called while - * the interrupt routine is executing. - */ -static void ag71xx_netpoll(struct net_device *dev) -{ - disable_irq(dev->irq); - ag71xx_interrupt(dev->irq, dev); - enable_irq(dev->irq); -} -#endif - -static int ag71xx_change_mtu(struct net_device *dev, int new_mtu) -{ - struct ag71xx *ag = netdev_priv(dev); - - dev->mtu = new_mtu; - ag71xx_wr(ag, AG71XX_REG_MAC_MFL, - ag71xx_max_frame_len(dev->mtu)); - - return 0; -} - -static const struct net_device_ops ag71xx_netdev_ops = { - .ndo_open = ag71xx_open, - .ndo_stop = ag71xx_stop, - .ndo_start_xmit = ag71xx_hard_start_xmit, - .ndo_do_ioctl = ag71xx_do_ioctl, - .ndo_tx_timeout = ag71xx_tx_timeout, - .ndo_change_mtu = ag71xx_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = ag71xx_netpoll, -#endif -}; - -static const char *ag71xx_get_phy_if_mode_name(phy_interface_t mode) -{ - switch (mode) { - case PHY_INTERFACE_MODE_MII: - return "MII"; - case PHY_INTERFACE_MODE_GMII: - return "GMII"; - case PHY_INTERFACE_MODE_RMII: - return "RMII"; - case PHY_INTERFACE_MODE_RGMII: - return "RGMII"; - case PHY_INTERFACE_MODE_SGMII: - return "SGMII"; - default: - break; - } - - return "unknown"; -} - -static void ag71xx_of_bit(struct device_node *np, const char *prop, - u32 *reg, u32 mask) -{ - u32 val; - - if (of_property_read_u32(np, prop, &val)) - return; - - if (val) - *reg |= mask; - else - *reg &= ~mask; -} - -static void ag71xx_setup_gmac_933x(struct device_node *np, void __iomem *base) -{ - u32 val = __raw_readl(base + AR933X_GMAC_REG_ETH_CFG); - - ag71xx_of_bit(np, "switch-phy-swap", &val, AR933X_ETH_CFG_SW_PHY_SWAP); - ag71xx_of_bit(np, "switch-phy-addr-swap", &val, - AR933X_ETH_CFG_SW_PHY_ADDR_SWAP); - - __raw_writel(val, base + AR933X_GMAC_REG_ETH_CFG); -} - -static int ag71xx_setup_gmac(struct device_node *np) -{ - struct device_node *np_dev; - void __iomem *base; - int err = 0; - - np = of_get_child_by_name(np, "gmac-config"); - if (!np) - return 0; - - np_dev = of_parse_phandle(np, "device", 0); - if (!np_dev) - goto out; - - base = of_iomap(np_dev, 0); - if (!base) { - pr_err("%pOF: can't map GMAC registers\n", np_dev); - err = -ENOMEM; - goto err_iomap; - } - - if (of_device_is_compatible(np_dev, "qca,ar9330-gmac")) - ag71xx_setup_gmac_933x(np, base); - - iounmap(base); - -err_iomap: - of_node_put(np_dev); -out: - of_node_put(np); - return err; -} - -static int ag71xx_probe(struct platform_device *pdev) -{ - struct device_node *np = pdev->dev.of_node; - struct net_device *dev; - struct resource *res; - struct ag71xx *ag; - const void *mac_addr; - u32 max_frame_len; - int tx_size, err; - - if (!np) - return -ENODEV; - - dev = alloc_etherdev(sizeof(*ag)); - if (!dev) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -EINVAL; - - err = ag71xx_setup_gmac(np); - if (err) - return err; - - SET_NETDEV_DEV(dev, &pdev->dev); - - ag = netdev_priv(dev); - ag->pdev = pdev; - ag->dev = dev; - ag->msg_enable = netif_msg_init(ag71xx_msg_level, - AG71XX_DEFAULT_MSG_ENABLE); - spin_lock_init(&ag->lock); - - ag->mac_reset = devm_reset_control_get(&pdev->dev, "mac"); - if (IS_ERR(ag->mac_reset)) { - dev_err(&pdev->dev, "missing mac reset\n"); - err = PTR_ERR(ag->mac_reset); - goto err_free; - } - - ag->phy_reset = devm_reset_control_get_optional(&pdev->dev, "phy"); - - if (of_property_read_u32_array(np, "fifo-data", ag->fifodata, 3)) { - if (of_device_is_compatible(np, "qca,ar9130-eth") || - of_device_is_compatible(np, "qca,ar7100-eth")) { - ag->fifodata[0] = 0x0fff0000; - ag->fifodata[1] = 0x00001fff; - } else { - ag->fifodata[0] = 0x0010ffff; - ag->fifodata[1] = 0x015500aa; - ag->fifodata[2] = 0x01f00140; - } - if (of_device_is_compatible(np, "qca,ar9130-eth")) - ag->fifodata[2] = 0x00780fff; - else if (of_device_is_compatible(np, "qca,ar7100-eth")) - ag->fifodata[2] = 0x008001ff; - } - - if (of_property_read_u32_array(np, "pll-data", ag->plldata, 3)) - dev_dbg(&pdev->dev, "failed to read pll-data property\n"); - - if (of_property_read_u32_array(np, "pll-reg", ag->pllreg, 3)) - dev_dbg(&pdev->dev, "failed to read pll-reg property\n"); - - ag->pllregmap = syscon_regmap_lookup_by_phandle(np, "pll-handle"); - if (IS_ERR(ag->pllregmap)) { - dev_dbg(&pdev->dev, "failed to read pll-handle property\n"); - ag->pllregmap = NULL; - } - - ag->mac_base = devm_ioremap_nocache(&pdev->dev, res->start, - res->end - res->start + 1); - if (!ag->mac_base) { - err = -ENOMEM; - goto err_free; - } - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res) { - ag->mii_base = devm_ioremap_nocache(&pdev->dev, res->start, - res->end - res->start + 1); - if (!ag->mii_base) { - err = -ENOMEM; - goto err_free; - } - } - - dev->irq = platform_get_irq(pdev, 0); - err = devm_request_irq(&pdev->dev, dev->irq, ag71xx_interrupt, - 0x0, dev_name(&pdev->dev), dev); - if (err) { - dev_err(&pdev->dev, "unable to request IRQ %d\n", dev->irq); - goto err_free; - } - - dev->netdev_ops = &ag71xx_netdev_ops; - dev->ethtool_ops = &ag71xx_ethtool_ops; - - INIT_DELAYED_WORK(&ag->restart_work, ag71xx_restart_work_func); - - init_timer(&ag->oom_timer); - ag->oom_timer.data = (unsigned long) dev; - ag->oom_timer.function = ag71xx_oom_timer_handler; - - tx_size = AG71XX_TX_RING_SIZE_DEFAULT; - ag->rx_ring.order = ag71xx_ring_size_order(AG71XX_RX_RING_SIZE_DEFAULT); - - if (of_device_is_compatible(np, "qca,ar9340-eth") || - of_device_is_compatible(np, "qca,qca9530-eth") || - of_device_is_compatible(np, "qca,qca9550-eth") || - of_device_is_compatible(np, "qca,qca9560-eth")) - ag->desc_pktlen_mask = SZ_16K - 1; - else - ag->desc_pktlen_mask = SZ_4K - 1; - - if (ag->desc_pktlen_mask == SZ_16K - 1 && - !of_device_is_compatible(np, "qca,qca9550-eth") && - !of_device_is_compatible(np, "qca,qca9560-eth")) - max_frame_len = ag->desc_pktlen_mask; - else - max_frame_len = 1540; - - dev->min_mtu = 68; - dev->max_mtu = max_frame_len - ag71xx_max_frame_len(0); - - if (of_device_is_compatible(np, "qca,ar7240-eth")) - ag->tx_hang_workaround = 1; - - ag->rx_buf_offset = NET_SKB_PAD; - if (!of_device_is_compatible(np, "qca,ar7100-eth") && - !of_device_is_compatible(np, "qca,ar9130-eth")) - ag->rx_buf_offset += NET_IP_ALIGN; - - if (of_device_is_compatible(np, "qca,ar7100-eth")) { - ag->tx_ring.desc_split = AG71XX_TX_RING_SPLIT; - tx_size *= AG71XX_TX_RING_DS_PER_PKT; - } - ag->tx_ring.order = ag71xx_ring_size_order(tx_size); - - ag->stop_desc = dmam_alloc_coherent(&pdev->dev, - sizeof(struct ag71xx_desc), - &ag->stop_desc_dma, GFP_KERNEL); - if (!ag->stop_desc) - goto err_free; - - ag->stop_desc->data = 0; - ag->stop_desc->ctrl = 0; - ag->stop_desc->next = (u32) ag->stop_desc_dma; - - mac_addr = of_get_mac_address(np); - if (mac_addr) - memcpy(dev->dev_addr, mac_addr, ETH_ALEN); - if (!mac_addr || !is_valid_ether_addr(dev->dev_addr)) { - dev_err(&pdev->dev, "invalid MAC address, using random address\n"); - eth_random_addr(dev->dev_addr); - } - - ag->phy_if_mode = of_get_phy_mode(np); - if (ag->phy_if_mode < 0) { - dev_err(&pdev->dev, "missing phy-mode property in DT\n"); - err = ag->phy_if_mode; - goto err_free; - } - - netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); - - ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, 0); - ag71xx_hw_init(ag); - ag71xx_mdio_init(ag); - - err = ag71xx_phy_connect(ag); - if (err) - goto err_mdio_free; - - err = ag71xx_debugfs_init(ag); - if (err) - goto err_phy_disconnect; - - platform_set_drvdata(pdev, dev); - - err = register_netdev(dev); - if (err) { - dev_err(&pdev->dev, "unable to register net device\n"); - platform_set_drvdata(pdev, NULL); - ag71xx_debugfs_exit(ag); - goto err_phy_disconnect; - } - - pr_info("%s: Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n", - dev->name, (unsigned long) ag->mac_base, dev->irq, - ag71xx_get_phy_if_mode_name(ag->phy_if_mode)); - - return 0; - -err_phy_disconnect: - ag71xx_phy_disconnect(ag); -err_mdio_free: - ag71xx_mdio_cleanup(ag); -err_free: - free_netdev(dev); - return err; -} - -static int ag71xx_remove(struct platform_device *pdev) -{ - struct net_device *dev = platform_get_drvdata(pdev); - struct ag71xx *ag; - - if (!dev) - return 0; - - ag = netdev_priv(dev); - ag71xx_debugfs_exit(ag); - ag71xx_phy_disconnect(ag); - ag71xx_mdio_cleanup(ag); - unregister_netdev(dev); - free_irq(dev->irq, dev); - iounmap(ag->mac_base); - kfree(dev); - platform_set_drvdata(pdev, NULL); - - return 0; -} - -static const struct of_device_id ag71xx_match[] = { - { .compatible = "qca,ar7100-eth" }, - { .compatible = "qca,ar7240-eth" }, - { .compatible = "qca,ar7241-eth" }, - { .compatible = "qca,ar7242-eth" }, - { .compatible = "qca,ar9130-eth" }, - { .compatible = "qca,ar9330-eth" }, - { .compatible = "qca,ar9340-eth" }, - { .compatible = "qca,qca9530-eth" }, - { .compatible = "qca,qca9550-eth" }, - { .compatible = "qca,qca9560-eth" }, - {} -}; - -static struct platform_driver ag71xx_driver = { - .probe = ag71xx_probe, - .remove = ag71xx_remove, - .driver = { - .name = AG71XX_DRV_NAME, - .of_match_table = ag71xx_match, - } -}; - -static int __init ag71xx_module_init(void) -{ - int ret; - - ret = ag71xx_debugfs_root_init(); - if (ret) - goto err_out; - - ret = platform_driver_register(&ag71xx_driver); - if (ret) - goto err_debugfs_exit; - - return 0; - -err_debugfs_exit: - ag71xx_debugfs_root_exit(); -err_out: - return ret; -} - -static void __exit ag71xx_module_exit(void) -{ - platform_driver_unregister(&ag71xx_driver); - ag71xx_debugfs_root_exit(); -} - -module_init(ag71xx_module_init); -module_exit(ag71xx_module_exit); - -MODULE_AUTHOR("Gabor Juhos "); -MODULE_AUTHOR("Imre Kaloz "); -MODULE_AUTHOR("Felix Fietkau "); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:" AG71XX_DRV_NAME); diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c deleted file mode 100644 index 8c1572b18..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_mdio.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -#define AG71XX_MDIO_RETRY 1000 -#define AG71XX_MDIO_DELAY 5 - -static int bus_count; - -static int ag71xx_mdio_wait_busy(struct ag71xx *ag) -{ - int i; - - for (i = 0; i < AG71XX_MDIO_RETRY; i++) { - u32 busy; - - udelay(AG71XX_MDIO_DELAY); - - regmap_read(ag->mii_regmap, AG71XX_REG_MII_IND, &busy); - if (!busy) - return 0; - - udelay(AG71XX_MDIO_DELAY); - } - - pr_err("%s: MDIO operation timed out\n", ag->mii_bus->name); - - return -ETIMEDOUT; -} - -int ag71xx_mdio_mii_read(struct mii_bus *bus, int addr, int reg) -{ - struct ag71xx *ag = bus->priv; - int err; - int ret; - - err = ag71xx_mdio_wait_busy(ag); - if (err) - return 0xffff; - - regmap_write(ag->mii_regmap, AG71XX_REG_MII_CMD, MII_CMD_WRITE); - regmap_write(ag->mii_regmap, AG71XX_REG_MII_ADDR, - ((addr & 0xff) << MII_ADDR_SHIFT) | (reg & 0xff)); - regmap_write(ag->mii_regmap, AG71XX_REG_MII_CMD, MII_CMD_READ); - - err = ag71xx_mdio_wait_busy(ag); - if (err) - return 0xffff; - - regmap_read(ag->mii_regmap, AG71XX_REG_MII_STATUS, &ret); - ret &= 0xffff; - regmap_write(ag->mii_regmap, AG71XX_REG_MII_CMD, MII_CMD_WRITE); - - DBG("mii_read: addr=%04x, reg=%04x, value=%04x\n", addr, reg, ret); - - return ret; -} - -int ag71xx_mdio_mii_write(struct mii_bus *bus, int addr, int reg, u16 val) -{ - struct ag71xx *ag = bus->priv; - - DBG("mii_write: addr=%04x, reg=%04x, value=%04x\n", addr, reg, val); - - regmap_write(ag->mii_regmap, AG71XX_REG_MII_ADDR, - ((addr & 0xff) << MII_ADDR_SHIFT) | (reg & 0xff)); - regmap_write(ag->mii_regmap, AG71XX_REG_MII_CTRL, val); - - ag71xx_mdio_wait_busy(ag); - - return 0; -} - -static int ar934x_mdio_clock_div(unsigned int rate) -{ - if (rate == 100 * 1000 * 1000) - return 6; /* 100 MHz clock divided by 20 => 5 MHz */ - else if (rate == 25 * 1000 * 1000) - return 0; /* 25 MHz clock divided by 4 => 6.25 MHz */ - else - return 3; /* 40 MHz clock divided by 8 => 5 MHz */ -} - -static int ag71xx_mdio_reset(struct mii_bus *bus) -{ - struct device_node *np = bus->dev.of_node; - struct ag71xx *ag = bus->priv; - struct device_node *np_ag = ag->pdev->dev.of_node; - bool builtin_switch; - u32 t; - - builtin_switch = of_property_read_bool(np, "builtin-switch"); - - if (of_device_is_compatible(np_ag, "qca,ar7240-eth")) - t = MII_CFG_CLK_DIV_6; - else if (of_device_is_compatible(np_ag, "qca,ar9340-eth")) - t = MII_CFG_CLK_DIV_58; - else if (builtin_switch) - t = MII_CFG_CLK_DIV_10; - else - t = MII_CFG_CLK_DIV_28; - - if (builtin_switch && of_device_is_compatible(np_ag, "qca,ar9340-eth")) { - struct clk *ref_clk = of_clk_get(np, 0); - int clock_rate; - - if (WARN_ON_ONCE(!ref_clk)) - clock_rate = 40 * 1000 * 1000; - else - clock_rate = clk_get_rate(ref_clk); - - t = ar934x_mdio_clock_div(clock_rate); - clk_put(ref_clk); - } - - regmap_write(ag->mii_regmap, AG71XX_REG_MII_CFG, t | MII_CFG_RESET); - udelay(100); - - regmap_write(ag->mii_regmap, AG71XX_REG_MII_CFG, t); - udelay(100); - - return 0; -} - -int ag71xx_mdio_init(struct ag71xx *ag) -{ - struct device *parent = &ag->pdev->dev; - struct device_node *np; - struct mii_bus *mii_bus; - bool builtin_switch; - int i, err; - - np = of_get_child_by_name(parent->of_node, "mdio-bus"); - if (!np) - return -ENODEV; - - if (!of_device_is_available(np)) { - err = 0; - goto err_out; - } - - ag->mii_regmap = syscon_regmap_lookup_by_phandle(np, "regmap"); - if (!ag->mii_regmap) - return -ENOENT; - - mii_bus = devm_mdiobus_alloc(parent); - if (!mii_bus) { - err = -ENOMEM; - goto err_out; - } - - ag->mdio_reset = of_reset_control_get_exclusive(np, "mdio"); - builtin_switch = of_property_read_bool(np, "builtin-switch"); - - mii_bus->name = "mdio"; - if (builtin_switch) { - mii_bus->read = ar7240sw_phy_read; - mii_bus->write = ar7240sw_phy_write; - } else { - mii_bus->read = ag71xx_mdio_mii_read; - mii_bus->write = ag71xx_mdio_mii_write; - } - mii_bus->reset = ag71xx_mdio_reset; - mii_bus->priv = ag; - mii_bus->parent = parent; - snprintf(mii_bus->id, MII_BUS_ID_SIZE, "%s.%d", np->name, bus_count++); - - if (!builtin_switch && - of_property_read_u32(np, "phy-mask", &mii_bus->phy_mask)) - mii_bus->phy_mask = 0; - - for (i = 0; i < PHY_MAX_ADDR; i++) - mii_bus->irq[i] = PHY_POLL; - - if (!IS_ERR(ag->mdio_reset)) { - reset_control_assert(ag->mdio_reset); - msleep(100); - reset_control_deassert(ag->mdio_reset); - msleep(200); - } - - err = of_mdiobus_register(mii_bus, np); - if (err) - goto err_out; - - ag->mii_bus = mii_bus; - - if (builtin_switch) - ag71xx_ar7240_init(ag, np); - - return 0; - -err_out: - of_node_put(np); - return err; -} - -void ag71xx_mdio_cleanup(struct ag71xx *ag) -{ - if (!ag->mii_bus) - return; - - ag71xx_ar7240_cleanup(ag); - mdiobus_unregister(ag->mii_bus); -} diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c deleted file mode 100644 index f9df38d53..000000000 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Atheros AR71xx built-in ethernet mac driver - * - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Based on Atheros' AG7100 driver - * - * 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 "ag71xx.h" - -static void ag71xx_phy_link_adjust(struct net_device *dev) -{ - struct ag71xx *ag = netdev_priv(dev); - struct phy_device *phydev = ag->phy_dev; - unsigned long flags; - int status_change = 0; - - spin_lock_irqsave(&ag->lock, flags); - - if (phydev->link) { - if (ag->duplex != phydev->duplex - || ag->speed != phydev->speed) { - status_change = 1; - } - } - - if (phydev->link != ag->link) - status_change = 1; - - ag->link = phydev->link; - ag->duplex = phydev->duplex; - ag->speed = phydev->speed; - - if (status_change) - ag71xx_link_adjust(ag); - - spin_unlock_irqrestore(&ag->lock, flags); -} - -int ag71xx_phy_connect(struct ag71xx *ag) -{ - struct device_node *np = ag->pdev->dev.of_node; - struct device_node *phy_node; - int ret; - - if (of_phy_is_fixed_link(np)) { - ret = of_phy_register_fixed_link(np); - if (ret < 0) { - dev_err(&ag->pdev->dev, - "Failed to register fixed PHY link: %d\n", ret); - return ret; - } - - phy_node = of_node_get(np); - } else { - phy_node = of_parse_phandle(np, "phy-handle", 0); - } - - if (!phy_node) { - dev_err(&ag->pdev->dev, - "Could not find valid phy node\n"); - return -ENODEV; - } - - ag->phy_dev = of_phy_connect(ag->dev, phy_node, ag71xx_phy_link_adjust, - 0, ag->phy_if_mode); - - of_node_put(phy_node); - - if (!ag->phy_dev) { - dev_err(&ag->pdev->dev, - "Could not connect to PHY device\n"); - return -ENODEV; - } - - dev_info(&ag->pdev->dev, "connected to PHY at %s [uid=%08x, driver=%s]\n", - phydev_name(ag->phy_dev), - ag->phy_dev->phy_id, ag->phy_dev->drv->name); - - return 0; -} - -void ag71xx_phy_disconnect(struct ag71xx *ag) -{ - phy_disconnect(ag->phy_dev); -} diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default deleted file mode 100644 index c174c4e12..000000000 --- a/target/linux/ath79/generic/config-default +++ /dev/null @@ -1,16 +0,0 @@ -CONFIG_BLK_MQ_PCI=y -CONFIG_INTEL_XWAY_PHY=y -CONFIG_LEDS_RESET=y -CONFIG_MTD_SPLIT_EVA_FW=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_PCI=y -CONFIG_PCI_AR71XX=y -CONFIG_PCI_AR724X=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PHY_AR7100_USB=y -CONFIG_PHY_AR7200_USB=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y diff --git a/target/linux/ath79/generic/profiles/00-default.mk b/target/linux/ath79/generic/profiles/00-default.mk deleted file mode 100644 index 83b39e441..000000000 --- a/target/linux/ath79/generic/profiles/00-default.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (C) 2009 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 (all drivers) - PRIORITY := 1 -endef - -define Profile/Default/Description - Default package set compatible with most boards. -endef -$(eval $(call Profile,Default)) diff --git a/target/linux/ath79/generic/target.mk b/target/linux/ath79/generic/target.mk deleted file mode 100644 index 64eb205e4..000000000 --- a/target/linux/ath79/generic/target.mk +++ /dev/null @@ -1,8 +0,0 @@ -BOARDNAME:=Generic -FEATURES += squashfs - -define Target/Description - Build firmware images for generic Atheros AR71xx/AR913x/AR934x based boards. -endef - - diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile deleted file mode 100644 index cd136b23b..000000000 --- a/target/linux/ath79/image/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -KERNEL_LOADADDR = 0x80060000 - -DEVICE_VARS += IMAGE_SIZE LOADER_FLASH_OFFS LOADER_TYPE ATH_SOC - -define Build/loader-common - rm -rf $@.src - $(MAKE) -C lzma-loader \ - PKG_BUILD_DIR="$@.src" \ - TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \ - LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \ - $(1) compile loader.$(LOADER_TYPE) - mv "$@.$(LOADER_TYPE)" "$@" - rm -rf $@.src -endef - -define Build/loader-kernel - $(call Build/loader-common,LOADER_DATA="$@") -endef - -define Build/loader-kernel-cmdline - $(call Build/loader-common,LOADER_DATA="$@") -endef - - -define Build/loader-okli-compile - $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0) -endef - -define Build/loader-okli - dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new" - cat "$@" >> "$@.new" - mv "$@.new" "$@" -endef - -define Build/relocate-kernel - rm -rf $@.relocate - $(CP) ../../generic/image/relocate $@.relocate - $(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS) - ( \ - dd if=$@.relocate/loader.bin bs=32 conv=sync && \ - perl -e '@s = stat("$@"); print pack("N", @s[7])' && \ - cat "$@" \ - ) > "$@.new" - mv "$@.new" "$@" - rm -rf $@.relocate -endef - - -define Device/Default - ATH_SOC := - DEVICE_DTS_DIR := ../dts - DEVICE_DTS = $$(ATH_SOC)_$(1) - PROFILES = Default - MTDPARTS := - BLOCKSIZE := 64k - KERNEL := kernel-bin | append-dtb | lzma | uImage lzma - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma - COMPILE := - SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) - IMAGES := sysupgrade.bin - IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \ - append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) -endef - -ifeq ($(SUBTARGET),generic) -include ./generic.mk -include ./generic-tp-link.mk -include ./generic-ubnt.mk -endif -ifeq ($(SUBTARGET),tiny) -include ./tiny-tp-link.mk -endif -$(eval $(call BuildImage)) diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk deleted file mode 100644 index 1dd5a289f..000000000 --- a/target/linux/ath79/image/common-tp-link.mk +++ /dev/null @@ -1,84 +0,0 @@ -DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION TPLINK_BOARD_NAME - -define rootfs_align -$(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1)))))) -endef - -# combine kernel and rootfs into one image -# mktplinkfw -# is "sysupgrade" or "factory" -# -# -a align the rootfs start on an bytes boundary -# -j add jffs2 end-of-filesystem markers -# -s strip padding from end of the image -# -X reserve bytes in the firmware image (hexval prefixed with 0x) -define Build/mktplinkfw - -$(STAGING_DIR_HOST)/bin/mktplinkfw \ - -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \ - -m $(TPLINK_HEADER_VERSION) \ - -k $(IMAGE_KERNEL) \ - -r $@ \ - -o $@.new \ - -j -X 0x40000 \ - -a $(call rootfs_align,$(FILESYSTEM)) \ - $(wordlist 2,$(words $(1)),$(1)) \ - $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@ -endef - -# mktplinkfw-combined -# -# -c combined image -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) \ - -k $@ \ - -o $@.new \ - -s -S \ - -c - @mv $@.new $@ -endef - -define Device/tplink - TPLINK_HWREV := 0x1 - TPLINK_HEADER_VERSION := 1 - LOADER_TYPE := gz - KERNEL := kernel-bin | append-dtb | lzma - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v1-header - IMAGES := sysupgrade.bin factory.bin - IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade | append-metadata - IMAGE/factory.bin := append-rootfs | mktplinkfw factory -endef - -define Device/tplink-nolzma - $(Device/tplink) - LOADER_FLASH_OFFS := 0x22000 - COMPILE := loader-$(1).gz - COMPILE/loader-$(1).gz := loader-okli-compile - KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) - KERNEL_INITRAMFS := kernel-bin | append-dtb | gzip | tplink-v1-header -endef - -define Device/tplink-4m - $(Device/tplink-nolzma) - TPLINK_FLASHLAYOUT := 4M - IMAGE_SIZE := 3904k -endef - -define Device/tplink-4mlzma - $(Device/tplink) - TPLINK_FLASHLAYOUT := 4Mlzma - IMAGE_SIZE := 3904k -endef - -define Device/tplink-8m - $(Device/tplink-nolzma) - TPLINK_FLASHLAYOUT := 8M - IMAGE_SIZE := 7936k -endef - -define Device/tplink-8mlzma -$(Device/tplink) - TPLINK_FLASHLAYOUT := 8Mlzma - IMAGE_SIZE := 7936k -endef diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk deleted file mode 100644 index 0b4659abe..000000000 --- a/target/linux/ath79/image/generic-tp-link.mk +++ /dev/null @@ -1,30 +0,0 @@ -include ./common-tp-link.mk - - -define Device/tl-wr1043nd-v1 - $(Device/tplink-8m) - ATH_SOC := ar9132 - DEVICE_TITLE := TP-LINK TL-WR1043N/ND v1 - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport - TPLINK_HWID := 0x10430001 - SUPPORTED_DEVICES := tplink,tl-wr1043nd-v1 tl-wr1043nd -endef -TARGET_DEVICES += tl-wr1043nd-v1 - -define Device/tl-wdr3600 - $(Device/tplink-8mlzma) - ATH_SOC := ar9344 - DEVICE_TITLE := TP-LINK TL-WDR3600 - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport - TPLINK_HWID := 0x36000001 - SUPPORTED_DEVICES := tplink,tl-wdr3600 tl-wdr3600 -endef -TARGET_DEVICES += tl-wdr3600 - -define Device/tl-wdr4300 - $(Device/tl-wdr3600) - DEVICE_TITLE := TP-LINK TL-WDR4300 - TPLINK_HWID := 0x43000001 - SUPPORTED_DEVICES := tplink,tl-wdr4300 tl-wdr4300 -endef -TARGET_DEVICES += tl-wdr4300 diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk deleted file mode 100644 index 1aae93869..000000000 --- a/target/linux/ath79/image/generic-ubnt.mk +++ /dev/null @@ -1,81 +0,0 @@ -DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE - -# 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-$(VERSION_DIST)-$(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-$(VERSION_DIST)-$(REVISION) \ - -k $@.old1 \ - -r $@.old2 \ - -o $@; \ - rm $@.old1 $@.old2 ) -endef - -# 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 - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 - IMAGE_SIZE := 7552k - UBNT_BOARD := XM - IMAGES += factory.bin - IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ - append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | mkubntimage-split -endef - -define Device/ubnt-xm - $(Device/ubnt) - DEVICE_PACKAGES += kmod-usb-ohci - UBNT_TYPE := XM - UBNT_CHIP := ar7240 - ATH_SOC := ar7241 - KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma -endef - -define Device/ubnt-bz - $(Device/ubnt) - UBNT_TYPE := BZ - UBNT_CHIP := ar7240 - ATH_SOC := ar7241 -endef - -define Device/ubnt_bullet-m - $(Device/ubnt-xm) - DEVICE_TITLE := Ubiquiti Bullet-M - SUPPORTED_DEVICES += bullet-m -endef -TARGET_DEVICES += ubnt_bullet-m - -define Device/ubnt_rocket-m - $(Device/ubnt-xm) - DEVICE_TITLE := Ubiquiti Rocket-M - SUPPORTED_DEVICES += rocket-m -endef -TARGET_DEVICES += ubnt_rocket-m - -define Device/ubnt_nano-m - $(Device/ubnt-xm) - DEVICE_TITLE := Ubiquiti Nano-M - SUPPORTED_DEVICES += nano-m -endef -TARGET_DEVICES += ubnt_nano-m - -define Device/ubnt_unifi - $(Device/ubnt-bz) - DEVICE_TITLE := Ubiquiti UniFi - SUPPORTED_DEVICES += unifi -endef -TARGET_DEVICES += ubnt_unifi diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk deleted file mode 100644 index cb5dc38f6..000000000 --- a/target/linux/ath79/image/generic.mk +++ /dev/null @@ -1,90 +0,0 @@ -define Build/netgear-squashfs - rm -rf $@.fs $@.squashfs - mkdir -p $@.fs/image - cp $@ $@.fs/image/uImage - $(STAGING_DIR_HOST)/bin/mksquashfs-lzma \ - $@.fs $@.squashfs \ - -noappend -root-owned -be -b 65536 \ - $(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH)) - - dd if=/dev/zero bs=1k count=1 >> $@.squashfs - mkimage \ - -A mips -O linux -T filesystem -C none \ - -M $(NETGEAR_KERNEL_MAGIC) \ - -a 0xbf070000 -e 0xbf070000 \ - -n 'MIPS $(VERSION_DIST) Linux-$(LINUX_VERSION)' \ - -d $@.squashfs $@ - rm -rf $@.squashfs $@.fs -endef - -define Build/netgear-uImage - $(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC)) -endef - - -define Device/avm_fritz300e - ATH_SOC := ar7242 - DEVICE_TITLE := AVM FRITZ!WLAN Repeater 300E - KERNEL := kernel-bin | append-dtb | lzma | eva-image - KERNEL_INITRAMFS := $$(KERNEL) - IMAGE_SIZE := 15232k - IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \ - append-squashfs-fakeroot-be | pad-to 256 | \ - append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) - DEVICE_PACKAGES := fritz-tffs rssileds -swconfig -endef -TARGET_DEVICES += avm_fritz300e - -define Device/embeddedwireless_dorin - ATH_SOC := ar9331 - DEVICE_TITLE := Embedded Wireless Dorin - DEVICE_PACKAGES := kmod-usb-chipidea2 - IMAGE_SIZE := 16000k - SUPPORTED_DEVICES += ew-dorin -endef -TARGET_DEVICES += embeddedwireless_dorin - -define Device/glinet_ar150 - ATH_SOC := ar9330 - DEVICE_TITLE := GL.iNet GL-AR150 - DEVICE_PACKAGES := kmod-usb-chipidea2 - IMAGE_SIZE := 16000k - SUPPORTED_DEVICES += gl-ar150 -endef -TARGET_DEVICES += glinet_ar150 - -define Device/openmesh_om5p-ac-v2 - ATH_SOC := qca9558 - DEVICE_TITLE := OpenMesh OM5P-AC v2 - DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca988x om-watchdog - IMAGE_SIZE := 7808k - SUPPORTED_DEVICES += om5p-acv2 -endef -TARGET_DEVICES += openmesh_om5p-ac-v2 - -define Device/netgear_wndr3800 - ATH_SOC := ar7161 - DEVICE_TITLE := NETGEAR WNDR3800 - NETGEAR_KERNEL_MAGIC := 0x33373031 - KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma - NETGEAR_BOARD_ID := WNDR3800 - NETGEAR_HW_ID := 29763654+16+128 - IMAGE_SIZE := 15872k - IMAGES := sysupgrade.bin factory.img - IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE) - IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size $$$$(IMAGE_SIZE) - DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-leds-reset - SUPPORTED_DEVICES += wndr3800 -endef -TARGET_DEVICES += netgear_wndr3800 - -define Device/buffalo_wzr-hp-g450h - ATH_SOC := ar7242 - DEVICE_TITLE := Buffalo WZR-HP-G450H - DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport - IMAGE_SIZE := 32256k - SUPPORTED_DEVICES += wzr-hp-g450h -endef -TARGET_DEVICES += buffalo_wzr-hp-g450h diff --git a/target/linux/ath79/image/lzma-loader/Makefile b/target/linux/ath79/image/lzma-loader/Makefile deleted file mode 100644 index 9b81e8730..000000000 --- a/target/linux/ath79/image/lzma-loader/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -# -# Copyright (C) 2011 OpenWrt.org -# Copyright (C) 2011 Gabor Juhos -# -# 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 -LOADADDR := 0x80060000 -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) \ - LOADADDR=$(LOADADDR) \ - LOADER_DATA=$(LOADER_DATA) \ - FLASH_OFFS=$(FLASH_OFFS) \ - FLASH_MAX=$(FLASH_MAX) \ - BOARD="$(BOARD)" \ - 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/ath79/image/lzma-loader/src/LzmaDecode.c b/target/linux/ath79/image/lzma-loader/src/LzmaDecode.c deleted file mode 100644 index cb8345377..000000000 --- a/target/linux/ath79/image/lzma-loader/src/LzmaDecode.c +++ /dev/null @@ -1,584 +0,0 @@ -/* - 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/ath79/image/lzma-loader/src/LzmaDecode.h b/target/linux/ath79/image/lzma-loader/src/LzmaDecode.h deleted file mode 100644 index 2870eeb9c..000000000 --- a/target/linux/ath79/image/lzma-loader/src/LzmaDecode.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - 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/ath79/image/lzma-loader/src/LzmaTypes.h b/target/linux/ath79/image/lzma-loader/src/LzmaTypes.h deleted file mode 100644 index 9c2729075..000000000 --- a/target/linux/ath79/image/lzma-loader/src/LzmaTypes.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -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/ath79/image/lzma-loader/src/Makefile b/target/linux/ath79/image/lzma-loader/src/Makefile deleted file mode 100644 index 133bf6ee8..000000000 --- a/target/linux/ath79/image/lzma-loader/src/Makefile +++ /dev/null @@ -1,107 +0,0 @@ -# -# 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 := -KERNEL_CMDLINE := rootfstype=squashfs - -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 \ - -R .MIPS.abiflags -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 - -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.o printf.o LzmaDecode.o - -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/ath79/image/lzma-loader/src/ar71xx_regs.h b/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h deleted file mode 100644 index 19a4785bb..000000000 --- a/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h +++ /dev/null @@ -1,725 +0,0 @@ -/* - * Atheros AR71XX/AR724X/AR913X SoC register definitions - * - * Copyright (C) 2010-2011 Jaiganesh Narayanan - * Copyright (C) 2008-2010 Gabor Juhos - * Copyright (C) 2008 Imre Kaloz - * - * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP - * - * 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_AR71XX_REGS_H -#define __ASM_MACH_AR71XX_REGS_H - -#define BIT(_x) (1UL << (_x)) - -#define AR71XX_APB_BASE 0x18000000 -#define AR71XX_GE0_BASE 0x19000000 -#define AR71XX_GE0_SIZE 0x10000 -#define AR71XX_GE1_BASE 0x1a000000 -#define AR71XX_GE1_SIZE 0x10000 -#define AR71XX_EHCI_BASE 0x1b000000 -#define AR71XX_EHCI_SIZE 0x1000 -#define AR71XX_OHCI_BASE 0x1c000000 -#define AR71XX_OHCI_SIZE 0x1000 -#define AR71XX_SPI_BASE 0x1f000000 -#define AR71XX_SPI_SIZE 0x01000000 - -#define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000) -#define AR71XX_DDR_CTRL_SIZE 0x100 -#define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000) -#define AR71XX_UART_SIZE 0x100 -#define AR71XX_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000) -#define AR71XX_USB_CTRL_SIZE 0x100 -#define AR71XX_GPIO_BASE (AR71XX_APB_BASE + 0x00040000) -#define AR71XX_GPIO_SIZE 0x100 -#define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000) -#define AR71XX_PLL_SIZE 0x100 -#define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000) -#define AR71XX_RESET_SIZE 0x100 -#define AR71XX_MII_BASE (AR71XX_APB_BASE + 0x00070000) -#define AR71XX_MII_SIZE 0x100 - -#define AR71XX_PCI_MEM_BASE 0x10000000 -#define AR71XX_PCI_MEM_SIZE 0x07000000 - -#define AR71XX_PCI_WIN0_OFFS 0x10000000 -#define AR71XX_PCI_WIN1_OFFS 0x11000000 -#define AR71XX_PCI_WIN2_OFFS 0x12000000 -#define AR71XX_PCI_WIN3_OFFS 0x13000000 -#define AR71XX_PCI_WIN4_OFFS 0x14000000 -#define AR71XX_PCI_WIN5_OFFS 0x15000000 -#define AR71XX_PCI_WIN6_OFFS 0x16000000 -#define AR71XX_PCI_WIN7_OFFS 0x07000000 - -#define AR71XX_PCI_CFG_BASE \ - (AR71XX_PCI_MEM_BASE + AR71XX_PCI_WIN7_OFFS + 0x10000) -#define AR71XX_PCI_CFG_SIZE 0x100 - -#define AR7240_USB_CTRL_BASE (AR71XX_APB_BASE + 0x00030000) -#define AR7240_USB_CTRL_SIZE 0x100 -#define AR7240_OHCI_BASE 0x1b000000 -#define AR7240_OHCI_SIZE 0x1000 - -#define AR724X_PCI_MEM_BASE 0x10000000 -#define AR724X_PCI_MEM_SIZE 0x04000000 - -#define AR724X_PCI_CFG_BASE 0x14000000 -#define AR724X_PCI_CFG_SIZE 0x1000 -#define AR724X_PCI_CRP_BASE (AR71XX_APB_BASE + 0x000c0000) -#define AR724X_PCI_CRP_SIZE 0x1000 -#define AR724X_PCI_CTRL_BASE (AR71XX_APB_BASE + 0x000f0000) -#define AR724X_PCI_CTRL_SIZE 0x100 - -#define AR724X_EHCI_BASE 0x1b000000 -#define AR724X_EHCI_SIZE 0x1000 - -#define AR913X_EHCI_BASE 0x1b000000 -#define AR913X_EHCI_SIZE 0x1000 -#define AR913X_WMAC_BASE (AR71XX_APB_BASE + 0x000C0000) -#define AR913X_WMAC_SIZE 0x30000 - -#define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000) -#define AR933X_UART_SIZE 0x14 -#define AR933X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -#define AR933X_GMAC_SIZE 0x04 -#define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) -#define AR933X_WMAC_SIZE 0x20000 -#define AR933X_EHCI_BASE 0x1b000000 -#define AR933X_EHCI_SIZE 0x1000 - -#define AR934X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -#define AR934X_GMAC_SIZE 0x14 -#define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) -#define AR934X_WMAC_SIZE 0x20000 -#define AR934X_EHCI_BASE 0x1b000000 -#define AR934X_EHCI_SIZE 0x200 - -#define QCA955X_PCI_MEM_BASE0 0x10000000 -#define QCA955X_PCI_MEM_BASE1 0x12000000 -#define QCA955X_PCI_MEM_SIZE 0x02000000 -#define QCA955X_PCI_CFG_BASE0 0x14000000 -#define QCA955X_PCI_CFG_BASE1 0x16000000 -#define QCA955X_PCI_CFG_SIZE 0x1000 -#define QCA955X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000) -#define QCA955X_PCI_CRP_BASE1 (AR71XX_APB_BASE + 0x00250000) -#define QCA955X_PCI_CRP_SIZE 0x1000 -#define QCA955X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000) -#define QCA955X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000) -#define QCA955X_PCI_CTRL_SIZE 0x100 - -#define QCA955X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) -#define QCA955X_WMAC_SIZE 0x20000 -#define QCA955X_EHCI0_BASE 0x1b000000 -#define QCA955X_EHCI1_BASE 0x1b400000 -#define QCA955X_EHCI_SIZE 0x1000 -#define QCA955X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -#define QCA955X_GMAC_SIZE 0x40 - -#define AR9300_OTP_BASE 0x14000 -#define AR9300_OTP_STATUS 0x15f18 -#define AR9300_OTP_STATUS_TYPE 0x7 -#define AR9300_OTP_STATUS_VALID 0x4 -#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 -#define AR9300_OTP_STATUS_SM_BUSY 0x1 -#define AR9300_OTP_READ_DATA 0x15f1c - -/* - * DDR_CTRL block - */ -#define AR71XX_DDR_REG_PCI_WIN0 0x7c -#define AR71XX_DDR_REG_PCI_WIN1 0x80 -#define AR71XX_DDR_REG_PCI_WIN2 0x84 -#define AR71XX_DDR_REG_PCI_WIN3 0x88 -#define AR71XX_DDR_REG_PCI_WIN4 0x8c -#define AR71XX_DDR_REG_PCI_WIN5 0x90 -#define AR71XX_DDR_REG_PCI_WIN6 0x94 -#define AR71XX_DDR_REG_PCI_WIN7 0x98 -#define AR71XX_DDR_REG_FLUSH_GE0 0x9c -#define AR71XX_DDR_REG_FLUSH_GE1 0xa0 -#define AR71XX_DDR_REG_FLUSH_USB 0xa4 -#define AR71XX_DDR_REG_FLUSH_PCI 0xa8 - -#define AR724X_DDR_REG_FLUSH_GE0 0x7c -#define AR724X_DDR_REG_FLUSH_GE1 0x80 -#define AR724X_DDR_REG_FLUSH_USB 0x84 -#define AR724X_DDR_REG_FLUSH_PCIE 0x88 - -#define AR913X_DDR_REG_FLUSH_GE0 0x7c -#define AR913X_DDR_REG_FLUSH_GE1 0x80 -#define AR913X_DDR_REG_FLUSH_USB 0x84 -#define AR913X_DDR_REG_FLUSH_WMAC 0x88 - -#define AR933X_DDR_REG_FLUSH_GE0 0x7c -#define AR933X_DDR_REG_FLUSH_GE1 0x80 -#define AR933X_DDR_REG_FLUSH_USB 0x84 -#define AR933X_DDR_REG_FLUSH_WMAC 0x88 - -#define AR934X_DDR_REG_FLUSH_GE0 0x9c -#define AR934X_DDR_REG_FLUSH_GE1 0xa0 -#define AR934X_DDR_REG_FLUSH_USB 0xa4 -#define AR934X_DDR_REG_FLUSH_PCIE 0xa8 -#define AR934X_DDR_REG_FLUSH_WMAC 0xac - -/* - * PLL block - */ -#define AR71XX_PLL_REG_CPU_CONFIG 0x00 -#define AR71XX_PLL_REG_SEC_CONFIG 0x04 -#define AR71XX_PLL_REG_ETH0_INT_CLOCK 0x10 -#define AR71XX_PLL_REG_ETH1_INT_CLOCK 0x14 - -#define AR71XX_PLL_DIV_SHIFT 3 -#define AR71XX_PLL_DIV_MASK 0x1f -#define AR71XX_CPU_DIV_SHIFT 16 -#define AR71XX_CPU_DIV_MASK 0x3 -#define AR71XX_DDR_DIV_SHIFT 18 -#define AR71XX_DDR_DIV_MASK 0x3 -#define AR71XX_AHB_DIV_SHIFT 20 -#define AR71XX_AHB_DIV_MASK 0x7 - -#define AR71XX_ETH0_PLL_SHIFT 17 -#define AR71XX_ETH1_PLL_SHIFT 19 - -#define AR724X_PLL_REG_CPU_CONFIG 0x00 -#define AR724X_PLL_REG_PCIE_CONFIG 0x18 - -#define AR724X_PLL_DIV_SHIFT 0 -#define AR724X_PLL_DIV_MASK 0x3ff -#define AR724X_PLL_REF_DIV_SHIFT 10 -#define AR724X_PLL_REF_DIV_MASK 0xf -#define AR724X_AHB_DIV_SHIFT 19 -#define AR724X_AHB_DIV_MASK 0x1 -#define AR724X_DDR_DIV_SHIFT 22 -#define AR724X_DDR_DIV_MASK 0x3 - -#define AR7242_PLL_REG_ETH0_INT_CLOCK 0x2c - -#define AR913X_PLL_REG_CPU_CONFIG 0x00 -#define AR913X_PLL_REG_ETH_CONFIG 0x04 -#define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14 -#define AR913X_PLL_REG_ETH1_INT_CLOCK 0x18 - -#define AR913X_PLL_DIV_SHIFT 0 -#define AR913X_PLL_DIV_MASK 0x3ff -#define AR913X_DDR_DIV_SHIFT 22 -#define AR913X_DDR_DIV_MASK 0x3 -#define AR913X_AHB_DIV_SHIFT 19 -#define AR913X_AHB_DIV_MASK 0x1 - -#define AR913X_ETH0_PLL_SHIFT 20 -#define AR913X_ETH1_PLL_SHIFT 22 - -#define AR933X_PLL_CPU_CONFIG_REG 0x00 -#define AR933X_PLL_CLOCK_CTRL_REG 0x08 - -#define AR933X_PLL_CPU_CONFIG_NINT_SHIFT 10 -#define AR933X_PLL_CPU_CONFIG_NINT_MASK 0x3f -#define AR933X_PLL_CPU_CONFIG_REFDIV_SHIFT 16 -#define AR933X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -#define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT 23 -#define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7 - -#define AR933X_PLL_CLOCK_CTRL_BYPASS BIT(2) -#define AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT 5 -#define AR933X_PLL_CLOCK_CTRL_CPU_DIV_MASK 0x3 -#define AR933X_PLL_CLOCK_CTRL_DDR_DIV_SHIFT 10 -#define AR933X_PLL_CLOCK_CTRL_DDR_DIV_MASK 0x3 -#define AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT 15 -#define AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK 0x7 - -#define AR934X_PLL_CPU_CONFIG_REG 0x00 -#define AR934X_PLL_DDR_CONFIG_REG 0x04 -#define AR934X_PLL_CPU_DDR_CLK_CTRL_REG 0x08 -#define AR934X_PLL_ETH_XMII_CONTROL_REG 0x2c - -#define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 -#define AR934X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -#define AR934X_PLL_CPU_CONFIG_NINT_SHIFT 6 -#define AR934X_PLL_CPU_CONFIG_NINT_MASK 0x3f -#define AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 -#define AR934X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -#define AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19 -#define AR934X_PLL_CPU_CONFIG_OUTDIV_MASK 0x3 - -#define AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT 0 -#define AR934X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff -#define AR934X_PLL_DDR_CONFIG_NINT_SHIFT 10 -#define AR934X_PLL_DDR_CONFIG_NINT_MASK 0x3f -#define AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT 16 -#define AR934X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f -#define AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23 -#define AR934X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7 - -#define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_PLL_BYPASS BIT(2) -#define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_PLL_BYPASS BIT(3) -#define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_PLL_BYPASS BIT(4) -#define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT 5 -#define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK 0x1f -#define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_SHIFT 10 -#define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK 0x1f -#define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_SHIFT 15 -#define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK 0x1f -#define AR934X_PLL_CPU_DDR_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20) -#define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) -#define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -#define QCA955X_PLL_CPU_CONFIG_REG 0x00 -#define QCA955X_PLL_DDR_CONFIG_REG 0x04 -#define QCA955X_PLL_CLK_CTRL_REG 0x08 - -#define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 -#define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -#define QCA955X_PLL_CPU_CONFIG_NINT_SHIFT 6 -#define QCA955X_PLL_CPU_CONFIG_NINT_MASK 0x3f -#define QCA955X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 -#define QCA955X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -#define QCA955X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19 -#define QCA955X_PLL_CPU_CONFIG_OUTDIV_MASK 0x3 - -#define QCA955X_PLL_DDR_CONFIG_NFRAC_SHIFT 0 -#define QCA955X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff -#define QCA955X_PLL_DDR_CONFIG_NINT_SHIFT 10 -#define QCA955X_PLL_DDR_CONFIG_NINT_MASK 0x3f -#define QCA955X_PLL_DDR_CONFIG_REFDIV_SHIFT 16 -#define QCA955X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f -#define QCA955X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23 -#define QCA955X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7 - -#define QCA955X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2) -#define QCA955X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3) -#define QCA955X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4) -#define QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5 -#define QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f -#define QCA955X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10 -#define QCA955X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f -#define QCA955X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15 -#define QCA955X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f -#define QCA955X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20) -#define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) -#define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -/* - * USB_CONFIG block - */ -#define AR71XX_USB_CTRL_REG_FLADJ 0x00 -#define AR71XX_USB_CTRL_REG_CONFIG 0x04 - -/* - * RESET block - */ -#define AR71XX_RESET_REG_TIMER 0x00 -#define AR71XX_RESET_REG_TIMER_RELOAD 0x04 -#define AR71XX_RESET_REG_WDOG_CTRL 0x08 -#define AR71XX_RESET_REG_WDOG 0x0c -#define AR71XX_RESET_REG_MISC_INT_STATUS 0x10 -#define AR71XX_RESET_REG_MISC_INT_ENABLE 0x14 -#define AR71XX_RESET_REG_PCI_INT_STATUS 0x18 -#define AR71XX_RESET_REG_PCI_INT_ENABLE 0x1c -#define AR71XX_RESET_REG_GLOBAL_INT_STATUS 0x20 -#define AR71XX_RESET_REG_RESET_MODULE 0x24 -#define AR71XX_RESET_REG_PERFC_CTRL 0x2c -#define AR71XX_RESET_REG_PERFC0 0x30 -#define AR71XX_RESET_REG_PERFC1 0x34 -#define AR71XX_RESET_REG_REV_ID 0x90 - -#define AR913X_RESET_REG_GLOBAL_INT_STATUS 0x18 -#define AR913X_RESET_REG_RESET_MODULE 0x1c -#define AR913X_RESET_REG_PERF_CTRL 0x20 -#define AR913X_RESET_REG_PERFC0 0x24 -#define AR913X_RESET_REG_PERFC1 0x28 - -#define AR724X_RESET_REG_RESET_MODULE 0x1c - -#define AR933X_RESET_REG_RESET_MODULE 0x1c -#define AR933X_RESET_REG_BOOTSTRAP 0xac - -#define AR934X_RESET_REG_RESET_MODULE 0x1c -#define AR934X_RESET_REG_BOOTSTRAP 0xb0 -#define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac - -#define QCA955X_RESET_REG_BOOTSTRAP 0xb0 -#define QCA955X_RESET_REG_EXT_INT_STATUS 0xac - -#define MISC_INT_ETHSW BIT(12) -#define MISC_INT_TIMER4 BIT(10) -#define MISC_INT_TIMER3 BIT(9) -#define MISC_INT_TIMER2 BIT(8) -#define MISC_INT_DMA BIT(7) -#define MISC_INT_OHCI BIT(6) -#define MISC_INT_PERFC BIT(5) -#define MISC_INT_WDOG BIT(4) -#define MISC_INT_UART BIT(3) -#define MISC_INT_GPIO BIT(2) -#define MISC_INT_ERROR BIT(1) -#define MISC_INT_TIMER BIT(0) - -#define AR71XX_RESET_EXTERNAL BIT(28) -#define AR71XX_RESET_FULL_CHIP BIT(24) -#define AR71XX_RESET_CPU_NMI BIT(21) -#define AR71XX_RESET_CPU_COLD BIT(20) -#define AR71XX_RESET_DMA BIT(19) -#define AR71XX_RESET_SLIC BIT(18) -#define AR71XX_RESET_STEREO BIT(17) -#define AR71XX_RESET_DDR BIT(16) -#define AR71XX_RESET_GE1_MAC BIT(13) -#define AR71XX_RESET_GE1_PHY BIT(12) -#define AR71XX_RESET_USBSUS_OVERRIDE BIT(10) -#define AR71XX_RESET_GE0_MAC BIT(9) -#define AR71XX_RESET_GE0_PHY BIT(8) -#define AR71XX_RESET_USB_OHCI_DLL BIT(6) -#define AR71XX_RESET_USB_HOST BIT(5) -#define AR71XX_RESET_USB_PHY BIT(4) -#define AR71XX_RESET_PCI_BUS BIT(1) -#define AR71XX_RESET_PCI_CORE BIT(0) - -#define AR7240_RESET_USB_HOST BIT(5) -#define AR7240_RESET_OHCI_DLL BIT(3) - -#define AR724X_RESET_GE1_MDIO BIT(23) -#define AR724X_RESET_GE0_MDIO BIT(22) -#define AR724X_RESET_PCIE_PHY_SERIAL BIT(10) -#define AR724X_RESET_PCIE_PHY BIT(7) -#define AR724X_RESET_PCIE BIT(6) -#define AR724X_RESET_USB_HOST BIT(5) -#define AR724X_RESET_USB_PHY BIT(4) -#define AR724X_RESET_USBSUS_OVERRIDE BIT(3) - -#define AR913X_RESET_AMBA2WMAC BIT(22) -#define AR913X_RESET_USBSUS_OVERRIDE BIT(10) -#define AR913X_RESET_USB_HOST BIT(5) -#define AR913X_RESET_USB_PHY BIT(4) - -#define AR933X_RESET_GE1_MDIO BIT(23) -#define AR933X_RESET_GE0_MDIO BIT(22) -#define AR933X_RESET_GE1_MAC BIT(13) -#define AR933X_RESET_WMAC BIT(11) -#define AR933X_RESET_GE0_MAC BIT(9) -#define AR933X_RESET_USB_HOST BIT(5) -#define AR933X_RESET_USB_PHY BIT(4) -#define AR933X_RESET_USBSUS_OVERRIDE BIT(3) - -#define AR934X_RESET_HOST BIT(31) -#define AR934X_RESET_SLIC BIT(30) -#define AR934X_RESET_HDMA BIT(29) -#define AR934X_RESET_EXTERNAL BIT(28) -#define AR934X_RESET_RTC BIT(27) -#define AR934X_RESET_PCIE_EP_INT BIT(26) -#define AR934X_RESET_CHKSUM_ACC BIT(25) -#define AR934X_RESET_FULL_CHIP BIT(24) -#define AR934X_RESET_GE1_MDIO BIT(23) -#define AR934X_RESET_GE0_MDIO BIT(22) -#define AR934X_RESET_CPU_NMI BIT(21) -#define AR934X_RESET_CPU_COLD BIT(20) -#define AR934X_RESET_HOST_RESET_INT BIT(19) -#define AR934X_RESET_PCIE_EP BIT(18) -#define AR934X_RESET_UART1 BIT(17) -#define AR934X_RESET_DDR BIT(16) -#define AR934X_RESET_USB_PHY_PLL_PWD_EXT BIT(15) -#define AR934X_RESET_NANDF BIT(14) -#define AR934X_RESET_GE1_MAC BIT(13) -#define AR934X_RESET_ETH_SWITCH_ANALOG BIT(12) -#define AR934X_RESET_USB_PHY_ANALOG BIT(11) -#define AR934X_RESET_HOST_DMA_INT BIT(10) -#define AR934X_RESET_GE0_MAC BIT(9) -#define AR934X_RESET_ETH_SWITCH BIT(8) -#define AR934X_RESET_PCIE_PHY BIT(7) -#define AR934X_RESET_PCIE BIT(6) -#define AR934X_RESET_USB_HOST BIT(5) -#define AR934X_RESET_USB_PHY BIT(4) -#define AR934X_RESET_USBSUS_OVERRIDE BIT(3) -#define AR934X_RESET_LUT BIT(2) -#define AR934X_RESET_MBOX BIT(1) -#define AR934X_RESET_I2S BIT(0) - -#define AR933X_BOOTSTRAP_MDIO_GPIO_EN BIT(18) -#define AR933X_BOOTSTRAP_EEPBUSY BIT(4) -#define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0) - -#define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23) -#define AR934X_BOOTSTRAP_SW_OPTION7 BIT(22) -#define AR934X_BOOTSTRAP_SW_OPTION6 BIT(21) -#define AR934X_BOOTSTRAP_SW_OPTION5 BIT(20) -#define AR934X_BOOTSTRAP_SW_OPTION4 BIT(19) -#define AR934X_BOOTSTRAP_SW_OPTION3 BIT(18) -#define AR934X_BOOTSTRAP_SW_OPTION2 BIT(17) -#define AR934X_BOOTSTRAP_SW_OPTION1 BIT(16) -#define AR934X_BOOTSTRAP_USB_MODE_DEVICE BIT(7) -#define AR934X_BOOTSTRAP_PCIE_RC BIT(6) -#define AR934X_BOOTSTRAP_EJTAG_MODE BIT(5) -#define AR934X_BOOTSTRAP_REF_CLK_40 BIT(4) -#define AR934X_BOOTSTRAP_BOOT_FROM_SPI BIT(2) -#define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1) -#define AR934X_BOOTSTRAP_DDR1 BIT(0) - -#define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4) - -#define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) -#define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1) -#define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) -#define AR934X_PCIE_WMAC_INT_WMAC_RXHP BIT(3) -#define AR934X_PCIE_WMAC_INT_PCIE_RC BIT(4) -#define AR934X_PCIE_WMAC_INT_PCIE_RC0 BIT(5) -#define AR934X_PCIE_WMAC_INT_PCIE_RC1 BIT(6) -#define AR934X_PCIE_WMAC_INT_PCIE_RC2 BIT(7) -#define AR934X_PCIE_WMAC_INT_PCIE_RC3 BIT(8) -#define AR934X_PCIE_WMAC_INT_WMAC_ALL \ - (AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \ - AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP) - -#define AR934X_PCIE_WMAC_INT_PCIE_ALL \ - (AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \ - AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \ - AR934X_PCIE_WMAC_INT_PCIE_RC3) - -#define QCA955X_EXT_INT_WMAC_MISC BIT(0) -#define QCA955X_EXT_INT_WMAC_TX BIT(1) -#define QCA955X_EXT_INT_WMAC_RXLP BIT(2) -#define QCA955X_EXT_INT_WMAC_RXHP BIT(3) -#define QCA955X_EXT_INT_PCIE_RC1 BIT(4) -#define QCA955X_EXT_INT_PCIE_RC1_INT0 BIT(5) -#define QCA955X_EXT_INT_PCIE_RC1_INT1 BIT(6) -#define QCA955X_EXT_INT_PCIE_RC1_INT2 BIT(7) -#define QCA955X_EXT_INT_PCIE_RC1_INT3 BIT(8) -#define QCA955X_EXT_INT_PCIE_RC2 BIT(12) -#define QCA955X_EXT_INT_PCIE_RC2_INT0 BIT(13) -#define QCA955X_EXT_INT_PCIE_RC2_INT1 BIT(14) -#define QCA955X_EXT_INT_PCIE_RC2_INT2 BIT(15) -#define QCA955X_EXT_INT_PCIE_RC2_INT3 BIT(16) -#define QCA955X_EXT_INT_USB1 BIT(24) -#define QCA955X_EXT_INT_USB2 BIT(28) - -#define QCA955X_EXT_INT_WMAC_ALL \ - (QCA955X_EXT_INT_WMAC_MISC | QCA955X_EXT_INT_WMAC_TX | \ - QCA955X_EXT_INT_WMAC_RXLP | QCA955X_EXT_INT_WMAC_RXHP) - -#define QCA955X_EXT_INT_PCIE_RC1_ALL \ - (QCA955X_EXT_INT_PCIE_RC1 | QCA955X_EXT_INT_PCIE_RC1_INT0 | \ - QCA955X_EXT_INT_PCIE_RC1_INT1 | QCA955X_EXT_INT_PCIE_RC1_INT2 | \ - QCA955X_EXT_INT_PCIE_RC1_INT3) - -#define QCA955X_EXT_INT_PCIE_RC2_ALL \ - (QCA955X_EXT_INT_PCIE_RC2 | QCA955X_EXT_INT_PCIE_RC2_INT0 | \ - QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \ - QCA955X_EXT_INT_PCIE_RC2_INT3) - -#define REV_ID_MAJOR_MASK 0xfff0 -#define REV_ID_MAJOR_AR71XX 0x00a0 -#define REV_ID_MAJOR_AR913X 0x00b0 -#define REV_ID_MAJOR_AR7240 0x00c0 -#define REV_ID_MAJOR_AR7241 0x0100 -#define REV_ID_MAJOR_AR7242 0x1100 -#define REV_ID_MAJOR_AR9330 0x0110 -#define REV_ID_MAJOR_AR9331 0x1110 -#define REV_ID_MAJOR_AR9341 0x0120 -#define REV_ID_MAJOR_AR9342 0x1120 -#define REV_ID_MAJOR_AR9344 0x2120 -#define REV_ID_MAJOR_QCA9558 0x1130 - -#define AR71XX_REV_ID_MINOR_MASK 0x3 -#define AR71XX_REV_ID_MINOR_AR7130 0x0 -#define AR71XX_REV_ID_MINOR_AR7141 0x1 -#define AR71XX_REV_ID_MINOR_AR7161 0x2 -#define AR71XX_REV_ID_REVISION_MASK 0x3 -#define AR71XX_REV_ID_REVISION_SHIFT 2 - -#define AR913X_REV_ID_MINOR_MASK 0x3 -#define AR913X_REV_ID_MINOR_AR9130 0x0 -#define AR913X_REV_ID_MINOR_AR9132 0x1 -#define AR913X_REV_ID_REVISION_MASK 0x3 -#define AR913X_REV_ID_REVISION_SHIFT 2 - -#define AR933X_REV_ID_REVISION_MASK 0x3 - -#define AR724X_REV_ID_REVISION_MASK 0x3 - -#define AR934X_REV_ID_REVISION_MASK 0xf - -#define AR944X_REV_ID_REVISION_MASK 0xf - -/* - * SPI block - */ -#define AR71XX_SPI_REG_FS 0x00 /* Function Select */ -#define AR71XX_SPI_REG_CTRL 0x04 /* SPI Control */ -#define AR71XX_SPI_REG_IOC 0x08 /* SPI I/O Control */ -#define AR71XX_SPI_REG_RDS 0x0c /* Read Data Shift */ - -#define AR71XX_SPI_FS_GPIO BIT(0) /* Enable GPIO mode */ - -#define AR71XX_SPI_CTRL_RD BIT(6) /* Remap Disable */ -#define AR71XX_SPI_CTRL_DIV_MASK 0x3f - -#define AR71XX_SPI_IOC_DO BIT(0) /* Data Out pin */ -#define AR71XX_SPI_IOC_CLK BIT(8) /* CLK pin */ -#define AR71XX_SPI_IOC_CS(n) BIT(16 + (n)) -#define AR71XX_SPI_IOC_CS0 AR71XX_SPI_IOC_CS(0) -#define AR71XX_SPI_IOC_CS1 AR71XX_SPI_IOC_CS(1) -#define AR71XX_SPI_IOC_CS2 AR71XX_SPI_IOC_CS(2) -#define AR71XX_SPI_IOC_CS_ALL (AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \ - AR71XX_SPI_IOC_CS2) - -/* - * GPIO block - */ -#define AR71XX_GPIO_REG_OE 0x00 -#define AR71XX_GPIO_REG_IN 0x04 -#define AR71XX_GPIO_REG_OUT 0x08 -#define AR71XX_GPIO_REG_SET 0x0c -#define AR71XX_GPIO_REG_CLEAR 0x10 -#define AR71XX_GPIO_REG_INT_MODE 0x14 -#define AR71XX_GPIO_REG_INT_TYPE 0x18 -#define AR71XX_GPIO_REG_INT_POLARITY 0x1c -#define AR71XX_GPIO_REG_INT_PENDING 0x20 -#define AR71XX_GPIO_REG_INT_ENABLE 0x24 -#define AR71XX_GPIO_REG_FUNC 0x28 - -#define AR934X_GPIO_REG_OUT_FUNC0 0x2c -#define AR934X_GPIO_REG_OUT_FUNC1 0x30 -#define AR934X_GPIO_REG_OUT_FUNC2 0x34 -#define AR934X_GPIO_REG_OUT_FUNC3 0x38 -#define AR934X_GPIO_REG_OUT_FUNC4 0x3c -#define AR934X_GPIO_REG_OUT_FUNC5 0x40 -#define AR934X_GPIO_REG_FUNC 0x6c - -#define AR71XX_GPIO_COUNT 16 -#define AR724X_GPIO_COUNT 18 -#define AR913X_GPIO_COUNT 22 -#define AR933X_GPIO_COUNT 30 -#define AR934X_GPIO_COUNT 23 -#define QCA955X_GPIO_COUNT 24 - -#define AR71XX_GPIO_FUNC_STEREO_EN BIT(17) -#define AR71XX_GPIO_FUNC_SLIC_EN BIT(16) -#define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13) -#define AR71XX_GPIO_FUNC_SPI_CS1_EN BIT(12) -#define AR71XX_GPIO_FUNC_UART_EN BIT(8) -#define AR71XX_GPIO_FUNC_USB_OC_EN BIT(4) -#define AR71XX_GPIO_FUNC_USB_CLK_EN BIT(0) - -#define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19) -#define AR724X_GPIO_FUNC_SPI_EN BIT(18) -#define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14) -#define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13) -#define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12) -#define AR724X_GPIO_FUNC_CLK_OBS4_EN BIT(11) -#define AR724X_GPIO_FUNC_CLK_OBS3_EN BIT(10) -#define AR724X_GPIO_FUNC_CLK_OBS2_EN BIT(9) -#define AR724X_GPIO_FUNC_CLK_OBS1_EN BIT(8) -#define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7) -#define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6) -#define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5) -#define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4) -#define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3) -#define AR724X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2) -#define AR724X_GPIO_FUNC_UART_EN BIT(1) -#define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0) - -#define AR913X_GPIO_FUNC_WMAC_LED_EN BIT(22) -#define AR913X_GPIO_FUNC_EXP_PORT_CS_EN BIT(21) -#define AR913X_GPIO_FUNC_I2S_REFCLKEN BIT(20) -#define AR913X_GPIO_FUNC_I2S_MCKEN BIT(19) -#define AR913X_GPIO_FUNC_I2S1_EN BIT(18) -#define AR913X_GPIO_FUNC_I2S0_EN BIT(17) -#define AR913X_GPIO_FUNC_SLIC_EN BIT(16) -#define AR913X_GPIO_FUNC_UART_RTSCTS_EN BIT(9) -#define AR913X_GPIO_FUNC_UART_EN BIT(8) -#define AR913X_GPIO_FUNC_USB_CLK_EN BIT(4) - -#define AR933X_GPIO_FUNC_SPDIF2TCK BIT(31) -#define AR933X_GPIO_FUNC_SPDIF_EN BIT(30) -#define AR933X_GPIO_FUNC_I2SO_22_18_EN BIT(29) -#define AR933X_GPIO_FUNC_I2S_MCK_EN BIT(27) -#define AR933X_GPIO_FUNC_I2SO_EN BIT(26) -#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_DUPL BIT(25) -#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_COLL BIT(24) -#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_ACT BIT(23) -#define AR933X_GPIO_FUNC_SPI_EN BIT(18) -#define AR933X_GPIO_FUNC_SPI_CS_EN2 BIT(14) -#define AR933X_GPIO_FUNC_SPI_CS_EN1 BIT(13) -#define AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7) -#define AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6) -#define AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5) -#define AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4) -#define AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3) -#define AR933X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2) -#define AR933X_GPIO_FUNC_UART_EN BIT(1) -#define AR933X_GPIO_FUNC_JTAG_DISABLE BIT(0) - -#define AR934X_GPIO_FUNC_DDR_DQOE_EN BIT(17) -#define AR934X_GPIO_FUNC_SPI_CS_1_EN BIT(14) -#define AR934X_GPIO_FUNC_SPI_CS_0_EN BIT(13) - -#define AR934X_GPIO_OUT_GPIO 0x00 - -/* - * MII_CTRL block - */ -#define AR71XX_MII_REG_MII0_CTRL 0x00 -#define AR71XX_MII_REG_MII1_CTRL 0x04 - -#define AR71XX_MII_CTRL_IF_MASK 3 -#define AR71XX_MII_CTRL_SPEED_SHIFT 4 -#define AR71XX_MII_CTRL_SPEED_MASK 3 -#define AR71XX_MII_CTRL_SPEED_10 0 -#define AR71XX_MII_CTRL_SPEED_100 1 -#define AR71XX_MII_CTRL_SPEED_1000 2 - -#define AR71XX_MII0_CTRL_IF_GMII 0 -#define AR71XX_MII0_CTRL_IF_MII 1 -#define AR71XX_MII0_CTRL_IF_RGMII 2 -#define AR71XX_MII0_CTRL_IF_RMII 3 - -#define AR71XX_MII1_CTRL_IF_RGMII 0 -#define AR71XX_MII1_CTRL_IF_RMII 1 - -/* - * AR933X GMAC interface - */ -#define AR933X_GMAC_REG_ETH_CFG 0x00 - -#define AR933X_ETH_CFG_RGMII_GE0 BIT(0) -#define AR933X_ETH_CFG_MII_GE0 BIT(1) -#define AR933X_ETH_CFG_GMII_GE0 BIT(2) -#define AR933X_ETH_CFG_MII_GE0_MASTER BIT(3) -#define AR933X_ETH_CFG_MII_GE0_SLAVE BIT(4) -#define AR933X_ETH_CFG_MII_GE0_ERR_EN BIT(5) -#define AR933X_ETH_CFG_SW_PHY_SWAP BIT(7) -#define AR933X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(8) -#define AR933X_ETH_CFG_RMII_GE0 BIT(9) -#define AR933X_ETH_CFG_RMII_GE0_SPD_10 0 -#define AR933X_ETH_CFG_RMII_GE0_SPD_100 BIT(10) - -/* - * AR934X GMAC Interface - */ -#define AR934X_GMAC_REG_ETH_CFG 0x00 - -#define AR934X_ETH_CFG_RGMII_GMAC0 BIT(0) -#define AR934X_ETH_CFG_MII_GMAC0 BIT(1) -#define AR934X_ETH_CFG_GMII_GMAC0 BIT(2) -#define AR934X_ETH_CFG_MII_GMAC0_MASTER BIT(3) -#define AR934X_ETH_CFG_MII_GMAC0_SLAVE BIT(4) -#define AR934X_ETH_CFG_MII_GMAC0_ERR_EN BIT(5) -#define AR934X_ETH_CFG_SW_ONLY_MODE BIT(6) -#define AR934X_ETH_CFG_SW_PHY_SWAP BIT(7) -#define AR934X_ETH_CFG_SW_APB_ACCESS BIT(9) -#define AR934X_ETH_CFG_RMII_GMAC0 BIT(10) -#define AR933X_ETH_CFG_MII_CNTL_SPEED BIT(11) -#define AR934X_ETH_CFG_RMII_GMAC0_MASTER BIT(12) -#define AR933X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13) - -/* - * QCA955X GMAC Interface - */ - -#define QCA955X_GMAC_REG_ETH_CFG 0x00 - -#define QCA955X_ETH_CFG_RGMII_GMAC0 BIT(0) -#define QCA955X_ETH_CFG_SGMII_GMAC0 BIT(6) - -#endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c deleted file mode 100644 index 2f4dd6b1f..000000000 --- a/target/linux/ath79/image/lzma-loader/src/board.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -#include -#include "config.h" -#include "ar71xx_regs.h" - -#define READREG(r) *(volatile unsigned int *)(r) -#define WRITEREG(r,v) *(volatile unsigned int *)(r) = v - -#define KSEG1ADDR(_x) (((_x) & 0x1fffffff) | 0xa0000000) - -#define UART_BASE 0xb8020000 - -#define UART_TX 0 -#define UART_LSR 5 - -#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); -} - -#ifdef CONFIG_BOARD_TL_WR1043ND_V1 -static void tlwr1043nd_init(void) -{ - unsigned int reg = KSEG1ADDR(AR71XX_RESET_BASE); - unsigned int t; - - t = READREG(reg + AR913X_RESET_REG_RESET_MODULE); - t |= AR71XX_RESET_GE0_PHY; - WRITEREG(reg + AR913X_RESET_REG_RESET_MODULE, t); - /* flush write */ - t = READREG(reg + AR913X_RESET_REG_RESET_MODULE); -} -#else -static inline void tlwr1043nd_init(void) {} -#endif - -void board_init(void) -{ - tlwr1043nd_init(); -} diff --git a/target/linux/ath79/image/lzma-loader/src/cache.c b/target/linux/ath79/image/lzma-loader/src/cache.c deleted file mode 100644 index 28cc84833..000000000 --- a/target/linux/ath79/image/lzma-loader/src/cache.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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/ath79/image/lzma-loader/src/cache.h b/target/linux/ath79/image/lzma-loader/src/cache.h deleted file mode 100644 index 506a23588..000000000 --- a/target/linux/ath79/image/lzma-loader/src/cache.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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/ath79/image/lzma-loader/src/cacheops.h b/target/linux/ath79/image/lzma-loader/src/cacheops.h deleted file mode 100644 index 70bcad769..000000000 --- a/target/linux/ath79/image/lzma-loader/src/cacheops.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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/ath79/image/lzma-loader/src/config.h b/target/linux/ath79/image/lzma-loader/src/config.h deleted file mode 100644 index 287392b34..000000000 --- a/target/linux/ath79/image/lzma-loader/src/config.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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_ - -#define CONFIG_ICACHE_SIZE (32 * 1024) -#define CONFIG_DCACHE_SIZE (64 * 1024) -#define CONFIG_CACHELINE_SIZE 32 - -#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/ath79/image/lzma-loader/src/cp0regdef.h b/target/linux/ath79/image/lzma-loader/src/cp0regdef.h deleted file mode 100644 index c1188ad8c..000000000 --- a/target/linux/ath79/image/lzma-loader/src/cp0regdef.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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/ath79/image/lzma-loader/src/head.S b/target/linux/ath79/image/lzma-loader/src/head.S deleted file mode 100644 index 47a7c9bd6..000000000 --- a/target/linux/ath79/image/lzma-loader/src/head.S +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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/ath79/image/lzma-loader/src/loader.c b/target/linux/ath79/image/lzma-loader/src/loader.c deleted file mode 100644 index cc73eb172..000000000 --- a/target/linux/ath79/image/lzma-loader/src/loader.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 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 2 -static const char kernel_cmdline[] = CONFIG_KERNEL_CMDLINE; -static const char *kernel_argv[] = { - NULL, - 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 AR7XXX/AR9XXX\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/ath79/image/lzma-loader/src/loader.lds b/target/linux/ath79/image/lzma-loader/src/loader.lds deleted file mode 100644 index 80cc7ca3e..000000000 --- a/target/linux/ath79/image/lzma-loader/src/loader.lds +++ /dev/null @@ -1,35 +0,0 @@ -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/ath79/image/lzma-loader/src/loader2.lds b/target/linux/ath79/image/lzma-loader/src/loader2.lds deleted file mode 100644 index db0bb4642..000000000 --- a/target/linux/ath79/image/lzma-loader/src/loader2.lds +++ /dev/null @@ -1,10 +0,0 @@ -OUTPUT_ARCH(mips) -SECTIONS { - .text : { - startup = .; - *(.text) - *(.text.*) - *(.data) - *(.data.*) - } -} diff --git a/target/linux/ath79/image/lzma-loader/src/lzma-data.lds b/target/linux/ath79/image/lzma-loader/src/lzma-data.lds deleted file mode 100644 index abf756ba1..000000000 --- a/target/linux/ath79/image/lzma-loader/src/lzma-data.lds +++ /dev/null @@ -1,8 +0,0 @@ -OUTPUT_ARCH(mips) -SECTIONS { - .data.lzma : { - _lzma_data_start = .; - *(.data) - _lzma_data_end = .; - } -} diff --git a/target/linux/ath79/image/lzma-loader/src/printf.c b/target/linux/ath79/image/lzma-loader/src/printf.c deleted file mode 100644 index 7bb5a86e1..000000000 --- a/target/linux/ath79/image/lzma-loader/src/printf.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * 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/ath79/image/lzma-loader/src/printf.h b/target/linux/ath79/image/lzma-loader/src/printf.h deleted file mode 100644 index 9b1c1df23..000000000 --- a/target/linux/ath79/image/lzma-loader/src/printf.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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/ath79/image/tiny-tp-link.mk b/target/linux/ath79/image/tiny-tp-link.mk deleted file mode 100644 index e6d5feefc..000000000 --- a/target/linux/ath79/image/tiny-tp-link.mk +++ /dev/null @@ -1,21 +0,0 @@ -include ./common-tp-link.mk - - -define Device/tl-wr703n - $(Device/tplink-4mlzma) - ATH_SOC := ar9331 - DEVICE_TITLE := TP-Link TL-WR703N - DEVICE_PACKAGES := kmod-usb-chipidea2 - TPLINK_HWID := 0x07030101 - SUPPORTED_DEVICES := tplink,tl-wr703n tl-wr703n -endef -TARGET_DEVICES += tl-wr703n - -define Device/tl-wr740n-v2 - $(Device/tplink-4m) - ATH_SOC := ar7240 - DEVICE_TITLE := TP-Link TL-WR740N/ND v2 - TPLINK_HWID := 0x07400001 - SUPPORTED_DEVICES := tplink,tl-wr740n-v2 tl-wr740n-v2 -endef -TARGET_DEVICES += tl-wr740n-v2 diff --git a/target/linux/ath79/modules.mk b/target/linux/ath79/modules.mk deleted file mode 100644 index 946440dd6..000000000 --- a/target/linux/ath79/modules.mk +++ /dev/null @@ -1,16 +0,0 @@ -LEDS_MENU:=LED modules - -define KernelPackage/leds-reset - SUBMENU:=$(LEDS_MENU) - TITLE:=reset controller LED support - DEPENDS:= @TARGET_ath79 - KCONFIG:=CONFIG_LEDS_RESET=m - FILES:=$(LINUX_DIR)/drivers/leds/leds-reset.ko - AUTOLOAD:=$(call AutoLoad,60,leds-reset,1) -endef - -define KernelPackage/leds-reset/description - Kernel module for LEDs on reset lines -endef - -$(eval $(call KernelPackage,leds-reset)) diff --git a/target/linux/ath79/patches-4.14/0001-tty-serial-drop-QCA-pecific-SoC-symbols.patch b/target/linux/ath79/patches-4.14/0001-tty-serial-drop-QCA-pecific-SoC-symbols.patch deleted file mode 100644 index 6c4b907e2..000000000 --- a/target/linux/ath79/patches-4.14/0001-tty-serial-drop-QCA-pecific-SoC-symbols.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 58812f6d0f1e11b03ed266038ed3b7274ab6f121 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:26:32 +0100 -Subject: [PATCH 01/27] tty: serial: drop QCA pecific SoC symbols - -Signed-off-by: John Crispin ---- - drivers/tty/serial/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/tty/serial/Kconfig -+++ b/drivers/tty/serial/Kconfig -@@ -1463,7 +1463,7 @@ config SERIAL_XILINX_PS_UART_CONSOLE - - config SERIAL_AR933X - tristate "AR933X serial port support" -- depends on HAVE_CLK && SOC_AR933X -+ depends on HAVE_CLK && ATH79 - select SERIAL_CORE - help - If you have an Atheros AR933X SOC based board and want to use the diff --git a/target/linux/ath79/patches-4.14/0002-watchdog-ath79-fix-maximum-timeout.patch b/target/linux/ath79/patches-4.14/0002-watchdog-ath79-fix-maximum-timeout.patch deleted file mode 100644 index 36234d8d8..000000000 --- a/target/linux/ath79/patches-4.14/0002-watchdog-ath79-fix-maximum-timeout.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5f5c9858af167f842ee8df053920b98387a71af1 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Mon, 5 Mar 2018 11:41:25 +0100 -Subject: [PATCH 02/27] watchdog: ath79: fix maximum timeout - -If the userland tries to set a timeout higher than the max_timeout, -then we should fallback to max_timeout. - -Signed-off-by: John Crispin ---- - drivers/watchdog/ath79_wdt.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - ---- a/drivers/watchdog/ath79_wdt.c -+++ b/drivers/watchdog/ath79_wdt.c -@@ -115,10 +115,14 @@ static inline void ath79_wdt_disable(voi - - static int ath79_wdt_set_timeout(int val) - { -- if (val < 1 || val > max_timeout) -+ if (val < 1) - return -EINVAL; - -- timeout = val; -+ if (val > max_timeout) -+ timeout = max_timeout; -+ else -+ timeout = val; -+ - ath79_wdt_keepalive(); - - return 0; diff --git a/target/linux/ath79/patches-4.14/0003-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-4.14/0003-leds-add-reset-controller-based-driver.patch deleted file mode 100644 index 495d79288..000000000 --- a/target/linux/ath79/patches-4.14/0003-leds-add-reset-controller-based-driver.patch +++ /dev/null @@ -1,183 +0,0 @@ -From ecbd9c87f073f097d9fe56390353e64e963e866a Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:03:03 +0100 -Subject: [PATCH 03/27] leds: add reset-controller based driver - -Signed-off-by: John Crispin ---- - drivers/leds/Kconfig | 11 ++++ - drivers/leds/Makefile | 1 + - drivers/leds/leds-reset.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 149 insertions(+) - create mode 100644 drivers/leds/leds-reset.c - ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -696,6 +696,17 @@ config LEDS_NIC78BX - To compile this driver as a module, choose M here: the module - will be called leds-nic78bx. - -+config LEDS_RESET -+ tristate "LED support for reset-controller API" -+ depends on LEDS_CLASS -+ depends on RESET_CONTROLLER -+ help -+ This option enables support for LEDs connected to pins driven by reset -+ controllers. Yes, DNI actual built HW like that. -+ -+ To compile this driver as a module, choose M here: the module -+ will be called leds-reset. -+ - comment "LED Triggers" - source "drivers/leds/trigger/Kconfig" - ---- /dev/null -+++ b/drivers/leds/leds-reset.c -@@ -0,0 +1,137 @@ -+/* -+ * Copyright (C) 2018 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 -+ -+struct reset_led_data { -+ struct led_classdev cdev; -+ struct reset_control *rst; -+}; -+ -+static inline struct reset_led_data * -+ cdev_to_reset_led_data(struct led_classdev *led_cdev) -+{ -+ return container_of(led_cdev, struct reset_led_data, cdev); -+} -+ -+static void reset_led_set(struct led_classdev *led_cdev, -+ enum led_brightness value) -+{ -+ struct reset_led_data *led_dat = cdev_to_reset_led_data(led_cdev); -+ -+ if (value == LED_OFF) -+ reset_control_assert(led_dat->rst); -+ else -+ reset_control_deassert(led_dat->rst); -+} -+ -+struct reset_leds_priv { -+ int num_leds; -+ struct reset_led_data leds[]; -+}; -+ -+static inline int sizeof_reset_leds_priv(int num_leds) -+{ -+ return sizeof(struct reset_leds_priv) + -+ (sizeof(struct reset_led_data) * num_leds); -+} -+ -+static struct reset_leds_priv *reset_leds_create(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct fwnode_handle *child; -+ struct reset_leds_priv *priv; -+ int count, ret; -+ -+ count = device_get_child_node_count(dev); -+ if (!count) -+ return ERR_PTR(-ENODEV); -+ -+ priv = devm_kzalloc(dev, sizeof_reset_leds_priv(count), GFP_KERNEL); -+ if (!priv) -+ return ERR_PTR(-ENOMEM); -+ -+ device_for_each_child_node(dev, child) { -+ struct reset_led_data *led = &priv->leds[priv->num_leds]; -+ struct device_node *np = to_of_node(child); -+ -+ ret = fwnode_property_read_string(child, "label", &led->cdev.name); -+ if (!led->cdev.name) { -+ fwnode_handle_put(child); -+ return ERR_PTR(-EINVAL); -+ } -+ led->rst = __of_reset_control_get(np, NULL, 0, 0, 0); -+ if (IS_ERR(led->rst)) -+ return ERR_PTR(-EINVAL); -+ -+ led->cdev.brightness_set = reset_led_set; -+ ret = devm_of_led_classdev_register(&pdev->dev, np, &led->cdev); -+ if (ret < 0) -+ return ERR_PTR(ret); -+ led->cdev.dev->of_node = np; -+ priv->num_leds++; -+ } -+ -+ return priv; -+} -+ -+static const struct of_device_id of_reset_leds_match[] = { -+ { .compatible = "reset-leds", }, -+ {}, -+}; -+ -+MODULE_DEVICE_TABLE(of, of_reset_leds_match); -+ -+static int reset_led_probe(struct platform_device *pdev) -+{ -+ struct reset_leds_priv *priv; -+ -+ priv = reset_leds_create(pdev); -+ if (IS_ERR(priv)) -+ return PTR_ERR(priv); -+ -+ platform_set_drvdata(pdev, priv); -+ -+ return 0; -+} -+ -+static void reset_led_shutdown(struct platform_device *pdev) -+{ -+ struct reset_leds_priv *priv = platform_get_drvdata(pdev); -+ int i; -+ -+ for (i = 0; i < priv->num_leds; i++) { -+ struct reset_led_data *led = &priv->leds[i]; -+ -+ if (!(led->cdev.flags & LED_RETAIN_AT_SHUTDOWN)) -+ reset_led_set(&led->cdev, LED_OFF); -+ } -+} -+ -+static struct platform_driver reset_led_driver = { -+ .probe = reset_led_probe, -+ .shutdown = reset_led_shutdown, -+ .driver = { -+ .name = "leds-reset", -+ .of_match_table = of_reset_leds_match, -+ }, -+}; -+ -+module_platform_driver(reset_led_driver); -+ -+MODULE_AUTHOR("John Crispin "); -+MODULE_DESCRIPTION("reset controller LED driver"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:leds-reset"); ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -73,6 +73,7 @@ obj-$(CONFIG_LEDS_PM8058) += leds-pm805 - obj-$(CONFIG_LEDS_MLXCPLD) += leds-mlxcpld.o - obj-$(CONFIG_LEDS_NIC78BX) += leds-nic78bx.o - obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o -+obj-$(CONFIG_LEDS_RESET) += leds-reset.o - - # LED SPI Drivers - obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o diff --git a/target/linux/ath79/patches-4.14/0004-phy-add-ath79-usb-phys.patch b/target/linux/ath79/patches-4.14/0004-phy-add-ath79-usb-phys.patch deleted file mode 100644 index 6280baf91..000000000 --- a/target/linux/ath79/patches-4.14/0004-phy-add-ath79-usb-phys.patch +++ /dev/null @@ -1,320 +0,0 @@ -From 08c9d6ceef01893678a5d2e8a15517c745417f21 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:04:05 +0100 -Subject: [PATCH 04/27] phy: add ath79 usb phys - -Signed-off-by: John Crispin ---- - drivers/phy/Kconfig | 16 ++++++ - drivers/phy/Makefile | 2 + - drivers/phy/phy-ar7100-usb.c | 124 +++++++++++++++++++++++++++++++++++++++++++ - drivers/phy/phy-ar7200-usb.c | 108 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 250 insertions(+) - create mode 100644 drivers/phy/phy-ar7100-usb.c - create mode 100644 drivers/phy/phy-ar7200-usb.c - ---- a/drivers/phy/Kconfig -+++ b/drivers/phy/Kconfig -@@ -15,6 +15,22 @@ config GENERIC_PHY - phy users can obtain reference to the PHY. All the users of this - framework should select this config. - -+config PHY_AR7100_USB -+ tristate "Atheros AR7100 USB PHY driver" -+ depends on ATH79 || COMPILE_TEST -+ default y if USB_EHCI_HCD_PLATFORM -+ select PHY_SIMPLE -+ help -+ Enable this to support the USB PHY on Atheros AR7100 SoCs. -+ -+config PHY_AR7200_USB -+ tristate "Atheros AR7200 USB PHY driver" -+ depends on ATH79 || COMPILE_TEST -+ default y if USB_EHCI_HCD_PLATFORM -+ select PHY_SIMPLE -+ help -+ Enable this to support the USB PHY on Atheros AR7200 SoCs. -+ - config PHY_LPC18XX_USB_OTG - tristate "NXP LPC18xx/43xx SoC USB OTG PHY driver" - depends on OF && (ARCH_LPC18XX || COMPILE_TEST) ---- a/drivers/phy/Makefile -+++ b/drivers/phy/Makefile -@@ -4,6 +4,8 @@ - # - - obj-$(CONFIG_GENERIC_PHY) += phy-core.o -+obj-$(CONFIG_PHY_AR7100_USB) += phy-ar7100-usb.o -+obj-$(CONFIG_PHY_AR7200_USB) += phy-ar7200-usb.o - obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o - obj-$(CONFIG_PHY_XGENE) += phy-xgene.o - obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o ---- /dev/null -+++ b/drivers/phy/phy-ar7100-usb.c -@@ -0,0 +1,140 @@ -+/* -+ * Copyright (C) 2018 John Crispin -+ * -+ * 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 -+ -+struct ar7100_usb_phy { -+ struct reset_control *rst_phy; -+ struct reset_control *rst_host; -+ struct reset_control *rst_ohci_dll; -+ void __iomem *io_base; -+ struct phy *phy; -+ int gpio; -+}; -+ -+static int ar7100_usb_phy_power_off(struct phy *phy) -+{ -+ struct ar7100_usb_phy *priv = phy_get_drvdata(phy); -+ int err = 0; -+ -+ err |= reset_control_assert(priv->rst_host); -+ err |= reset_control_assert(priv->rst_phy); -+ err |= reset_control_assert(priv->rst_ohci_dll); -+ -+ return err; -+} -+ -+static int ar7100_usb_phy_power_on(struct phy *phy) -+{ -+ struct ar7100_usb_phy *priv = phy_get_drvdata(phy); -+ int err = 0; -+ -+ err |= ar7100_usb_phy_power_off(phy); -+ mdelay(100); -+ err |= reset_control_deassert(priv->rst_ohci_dll); -+ err |= reset_control_deassert(priv->rst_phy); -+ err |= reset_control_deassert(priv->rst_host); -+ mdelay(500); -+ iowrite32(0xf0000, priv->io_base + AR71XX_USB_CTRL_REG_CONFIG); -+ iowrite32(0x20c00, priv->io_base + AR71XX_USB_CTRL_REG_FLADJ); -+ -+ return err; -+} -+ -+static const struct phy_ops ar7100_usb_phy_ops = { -+ .power_on = ar7100_usb_phy_power_on, -+ .power_off = ar7100_usb_phy_power_off, -+ .owner = THIS_MODULE, -+}; -+ -+static int ar7100_usb_phy_probe(struct platform_device *pdev) -+{ -+ struct phy_provider *phy_provider; -+ struct resource *res; -+ struct ar7100_usb_phy *priv; -+ -+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ priv->io_base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(priv->io_base)) -+ return PTR_ERR(priv->io_base); -+ -+ priv->rst_phy = devm_reset_control_get(&pdev->dev, "usb-phy"); -+ if (IS_ERR(priv->rst_phy)) { -+ dev_err(&pdev->dev, "phy reset is missing\n"); -+ return PTR_ERR(priv->rst_phy); -+ } -+ -+ priv->rst_host = devm_reset_control_get(&pdev->dev, "usb-host"); -+ if (IS_ERR(priv->rst_host)) { -+ dev_err(&pdev->dev, "host reset is missing\n"); -+ return PTR_ERR(priv->rst_host); -+ } -+ -+ priv->rst_ohci_dll = devm_reset_control_get(&pdev->dev, "usb-ohci-dll"); -+ if (IS_ERR(priv->rst_ohci_dll)) { -+ dev_err(&pdev->dev, "ohci-dll reset is missing\n"); -+ return PTR_ERR(priv->rst_host); -+ } -+ -+ priv->phy = devm_phy_create(&pdev->dev, NULL, &ar7100_usb_phy_ops); -+ if (IS_ERR(priv->phy)) { -+ dev_err(&pdev->dev, "failed to create PHY\n"); -+ return PTR_ERR(priv->phy); -+ } -+ -+ priv->gpio = of_get_gpio(pdev->dev.of_node, 0); -+ if (priv->gpio >= 0) { -+ int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio\n"); -+ return ret; -+ } -+ gpio_export_with_name(priv->gpio, 0, dev_name(&pdev->dev)); -+ gpio_set_value(priv->gpio, 1); -+ } -+ -+ phy_set_drvdata(priv->phy, priv); -+ -+ phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); -+ -+ -+ return PTR_ERR_OR_ZERO(phy_provider); -+} -+ -+static const struct of_device_id ar7100_usb_phy_of_match[] = { -+ { .compatible = "qca,ar7100-usb-phy" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, ar7100_usb_phy_of_match); -+ -+static struct platform_driver ar7100_usb_phy_driver = { -+ .probe = ar7100_usb_phy_probe, -+ .driver = { -+ .of_match_table = ar7100_usb_phy_of_match, -+ .name = "ar7100-usb-phy", -+ } -+}; -+module_platform_driver(ar7100_usb_phy_driver); -+ -+MODULE_DESCRIPTION("ATH79 USB PHY driver"); -+MODULE_AUTHOR("Alban Bedel "); -+MODULE_LICENSE("GPL"); ---- /dev/null -+++ b/drivers/phy/phy-ar7200-usb.c -@@ -0,0 +1,123 @@ -+/* -+ * Copyright (C) 2015 Alban Bedel -+ * -+ * 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 -+ -+struct ar7200_usb_phy { -+ struct reset_control *rst_phy; -+ struct reset_control *suspend_override; -+ struct phy *phy; -+ int gpio; -+}; -+ -+static int ar7200_usb_phy_power_on(struct phy *phy) -+{ -+ struct ar7200_usb_phy *priv = phy_get_drvdata(phy); -+ int err = 0; -+ -+ if (priv->rst_phy) -+ err = reset_control_deassert(priv->rst_phy); -+ if (!err && priv->suspend_override) -+ err = reset_control_assert(priv->suspend_override); -+ if (err && priv->rst_phy) -+ err = reset_control_assert(priv->rst_phy); -+ -+ return err; -+} -+ -+static int ar7200_usb_phy_power_off(struct phy *phy) -+{ -+ struct ar7200_usb_phy *priv = phy_get_drvdata(phy); -+ int err = 0; -+ -+ if (priv->suspend_override) -+ err = reset_control_deassert(priv->suspend_override); -+ if (priv->rst_phy) -+ err |= reset_control_assert(priv->rst_phy); -+ -+ return err; -+} -+ -+static const struct phy_ops ar7200_usb_phy_ops = { -+ .power_on = ar7200_usb_phy_power_on, -+ .power_off = ar7200_usb_phy_power_off, -+ .owner = THIS_MODULE, -+}; -+ -+static int ar7200_usb_phy_probe(struct platform_device *pdev) -+{ -+ struct phy_provider *phy_provider; -+ struct ar7200_usb_phy *priv; -+ -+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ priv->rst_phy = devm_reset_control_get(&pdev->dev, "usb-phy"); -+ if (IS_ERR(priv->rst_phy)) { -+ dev_err(&pdev->dev, "phy reset is missing\n"); -+ return PTR_ERR(priv->rst_phy); -+ } -+ -+ priv->suspend_override = devm_reset_control_get_optional( -+ &pdev->dev, "usb-suspend-override"); -+ if (IS_ERR(priv->suspend_override)) { -+ if (PTR_ERR(priv->suspend_override) == -ENOENT) -+ priv->suspend_override = NULL; -+ else -+ return PTR_ERR(priv->suspend_override); -+ } -+ -+ priv->phy = devm_phy_create(&pdev->dev, NULL, &ar7200_usb_phy_ops); -+ if (IS_ERR(priv->phy)) { -+ dev_err(&pdev->dev, "failed to create PHY\n"); -+ return PTR_ERR(priv->phy); -+ } -+ -+ priv->gpio = of_get_gpio(pdev->dev.of_node, 0); -+ if (priv->gpio >= 0) { -+ int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio\n"); -+ return ret; -+ } -+ gpio_export_with_name(priv->gpio, 0, dev_name(&pdev->dev)); -+ gpio_set_value(priv->gpio, 1); -+ } -+ -+ phy_set_drvdata(priv->phy, priv); -+ -+ phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); -+ -+ return PTR_ERR_OR_ZERO(phy_provider); -+} -+ -+static const struct of_device_id ar7200_usb_phy_of_match[] = { -+ { .compatible = "qca,ar7200-usb-phy" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, ar7200_usb_phy_of_match); -+ -+static struct platform_driver ar7200_usb_phy_driver = { -+ .probe = ar7200_usb_phy_probe, -+ .driver = { -+ .of_match_table = ar7200_usb_phy_of_match, -+ .name = "ar7200-usb-phy", -+ } -+}; -+module_platform_driver(ar7200_usb_phy_driver); -+ -+MODULE_DESCRIPTION("ATH79 USB PHY driver"); -+MODULE_AUTHOR("Alban Bedel "); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/ath79/patches-4.14/0005-usb-add-more-OF-quirk-properties.patch b/target/linux/ath79/patches-4.14/0005-usb-add-more-OF-quirk-properties.patch deleted file mode 100644 index ec1bc3f7f..000000000 --- a/target/linux/ath79/patches-4.14/0005-usb-add-more-OF-quirk-properties.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 2201818e5bd33f389beceb3943fdfcf5a698fc5b Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:01:43 +0100 -Subject: [PATCH 05/27] usb: add more OF/quirk properties - -Signed-off-by: John Crispin ---- - drivers/usb/host/ehci-platform.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -187,6 +187,11 @@ static int ehci_platform_probe(struct pl - ehci = hcd_to_ehci(hcd); - - if (pdata == &ehci_platform_defaults && dev->dev.of_node) { -+ of_property_read_u32(dev->dev.of_node, "caps-offset", &pdata->caps_offset); -+ -+ if (of_property_read_bool(dev->dev.of_node, "has-synopsys-hc-bug")) -+ pdata->has_synopsys_hc_bug = 1; -+ - if (of_property_read_bool(dev->dev.of_node, "big-endian-regs")) - ehci->big_endian_mmio = 1; - diff --git a/target/linux/ath79/patches-4.14/0006-usb-drop-deprecated-symbols.patch b/target/linux/ath79/patches-4.14/0006-usb-drop-deprecated-symbols.patch deleted file mode 100644 index a97fab71f..000000000 --- a/target/linux/ath79/patches-4.14/0006-usb-drop-deprecated-symbols.patch +++ /dev/null @@ -1,51 +0,0 @@ -From bd17da5b6297e0e52b787049292d076ad415362a Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:04:54 +0100 -Subject: [PATCH 06/27] usb: drop deprecated symbols - -Signed-off-by: John Crispin ---- - drivers/usb/host/Kconfig | 25 ------------------------- - 1 file changed, 25 deletions(-) - ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -297,19 +297,6 @@ config USB_CNS3XXX_EHCI - It is needed for high-speed (480Mbit/sec) USB 2.0 device - support. - --config USB_EHCI_ATH79 -- bool "EHCI support for AR7XXX/AR9XXX SoCs (DEPRECATED)" -- depends on (SOC_AR71XX || SOC_AR724X || SOC_AR913X || SOC_AR933X) -- select USB_EHCI_ROOT_HUB_TT -- select USB_EHCI_HCD_PLATFORM -- default y -- ---help--- -- This option is deprecated now and the driver was removed, use -- USB_EHCI_HCD_PLATFORM instead. -- -- Enables support for the built-in EHCI controller present -- on the Atheros AR7XXX/AR9XXX SoCs. -- - config USB_EHCI_HCD_PLATFORM - tristate "Generic EHCI driver for a platform device" - default n -@@ -493,18 +480,6 @@ config USB_OHCI_HCD_DAVINCI - controller. This driver cannot currently be a loadable - module because it lacks a proper PHY abstraction. - --config USB_OHCI_ATH79 -- bool "USB OHCI support for the Atheros AR71XX/AR7240 SoCs (DEPRECATED)" -- depends on (SOC_AR71XX || SOC_AR724X) -- select USB_OHCI_HCD_PLATFORM -- default y -- help -- This option is deprecated now and the driver was removed, use -- USB_OHCI_HCD_PLATFORM instead. -- -- Enables support for the built-in OHCI controller present on the -- Atheros AR71XX/AR7240 SoCs. -- - config USB_OHCI_HCD_PPC_OF_BE - bool "OHCI support for OF platform bus (big endian)" - depends on PPC diff --git a/target/linux/ath79/patches-4.14/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch b/target/linux/ath79/patches-4.14/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch deleted file mode 100644 index 72a7a5ee2..000000000 --- a/target/linux/ath79/patches-4.14/0007-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch +++ /dev/null @@ -1,130 +0,0 @@ -From cb376159800b9b44be76949c3aee89eb06d29faa Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:55:13 +0100 -Subject: [PATCH 07/27] irqchip/irq-ath79-intc: add irq cascade driver for - QCA9556 SoCs - -Signed-off-by: John Crispin ---- - drivers/irqchip/Makefile | 1 + - drivers/irqchip/irq-ath79-intc.c | 104 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 105 insertions(+) - create mode 100644 drivers/irqchip/irq-ath79-intc.c - ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -3,6 +3,7 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o - - obj-$(CONFIG_ALPINE_MSI) += irq-alpine-msi.o - obj-$(CONFIG_ATH79) += irq-ath79-cpu.o -+obj-$(CONFIG_ATH79) += irq-ath79-intc.o - obj-$(CONFIG_ATH79) += irq-ath79-misc.o - obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o - obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o ---- /dev/null -+++ b/drivers/irqchip/irq-ath79-intc.c -@@ -0,0 +1,104 @@ -+/* -+ * Atheros AR71xx/AR724x/AR913x specific interrupt handling -+ * -+ * Copyright (C) 2018 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 -+ -+#define ATH79_MAX_INTC_CASCADE 3 -+ -+struct ath79_intc { -+ struct irq_chip chip; -+ u32 irq; -+ u32 pending_mask; -+ u32 irq_mask[ATH79_MAX_INTC_CASCADE]; -+}; -+ -+static void ath79_intc_irq_handler(struct irq_desc *desc) -+{ -+ struct irq_domain *domain = irq_desc_get_handler_data(desc); -+ struct ath79_intc *intc = domain->host_data; -+ u32 pending; -+ -+ pending = ath79_reset_rr(QCA955X_RESET_REG_EXT_INT_STATUS); -+ pending &= intc->pending_mask; -+ -+ if (pending) { -+ int i; -+ -+ for (i = 0; i < domain->hwirq_max; i++) -+ if (pending & intc->irq_mask[i]) -+ generic_handle_irq(irq_find_mapping(domain, i)); -+ } else { -+ spurious_interrupt(); -+ } -+} -+ -+static void ath79_intc_irq_unmask(struct irq_data *d) -+{ -+} -+ -+static void ath79_intc_irq_mask(struct irq_data *d) -+{ -+} -+ -+static int ath79_intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) -+{ -+ struct ath79_intc *intc = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &intc->chip, handle_level_irq); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops ath79_irq_domain_ops = { -+ .xlate = irq_domain_xlate_onecell, -+ .map = ath79_intc_map, -+}; -+ -+static int __init qca9556_intc_of_init( -+ struct device_node *node, struct device_node *parent) -+{ -+ struct irq_domain *domain; -+ struct ath79_intc *intc; -+ int cnt, i; -+ -+ cnt = of_property_count_u32_elems(node, "qcom,pending-bits"); -+ if (cnt > ATH79_MAX_INTC_CASCADE) -+ panic("Too many INTC pending bits\n"); -+ -+ intc = kzalloc(sizeof(*intc), GFP_KERNEL); -+ if (!intc) -+ panic("Failed to allocate INTC memory\n"); -+ intc->chip.name = "INTC"; -+ intc->chip.irq_unmask = ath79_intc_irq_unmask, -+ intc->chip.irq_mask = ath79_intc_irq_mask, -+ -+ of_property_read_u32_array(node, "qcom,pending-bits", intc->irq_mask, cnt); -+ for (i = 0; i < cnt; i++) -+ intc->pending_mask |= intc->irq_mask[i]; -+ -+ intc->irq = irq_of_parse_and_map(node, 0); -+ if (!intc->irq) -+ panic("Failed to get INTC IRQ"); -+ -+ domain = irq_domain_add_linear(node, cnt, &ath79_irq_domain_ops, intc); -+ irq_set_chained_handler_and_data(intc->irq, ath79_intc_irq_handler, domain); -+ -+ return 0; -+} -+IRQCHIP_DECLARE(qca9556_intc, "qcom,qca9556-intc", -+ qca9556_intc_of_init); diff --git a/target/linux/ath79/patches-4.14/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch b/target/linux/ath79/patches-4.14/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch deleted file mode 100644 index 84e066e2a..000000000 --- a/target/linux/ath79/patches-4.14/0008-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch +++ /dev/null @@ -1,23 +0,0 @@ -From f711421eb5f6f790f1ebc09a13ae4aed8ba5f67b Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:58:19 +0100 -Subject: [PATCH 08/27] irqchip/irq-ath79-cpu: drop !OF init helper - -Signed-off-by: John Crispin ---- - drivers/irqchip/irq-ath79-cpu.c | 7 ------- - 1 file changed, 7 deletions(-) - ---- a/drivers/irqchip/irq-ath79-cpu.c -+++ b/drivers/irqchip/irq-ath79-cpu.c -@@ -88,10 +88,3 @@ static int __init ar79_cpu_intc_of_init( - } - IRQCHIP_DECLARE(ar79_cpu_intc, "qca,ar7100-cpu-intc", - ar79_cpu_intc_of_init); -- --void __init ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3) --{ -- irq_wb_chan[2] = irq_wb_chan2; -- irq_wb_chan[3] = irq_wb_chan3; -- mips_cpu_irq_init(); --} diff --git a/target/linux/ath79/patches-4.14/0009-MIPS-ath79-add-lots-of-missing-registers.patch b/target/linux/ath79/patches-4.14/0009-MIPS-ath79-add-lots-of-missing-registers.patch deleted file mode 100644 index d1755394f..000000000 --- a/target/linux/ath79/patches-4.14/0009-MIPS-ath79-add-lots-of-missing-registers.patch +++ /dev/null @@ -1,971 +0,0 @@ -From 3ea2bff4ed3ce74dc4303aa20f5e906e78352f6b Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:06:10 +0100 -Subject: [PATCH 09/27] MIPS: ath79: add lots of missing registers - -Signed-off-by: John Crispin ---- - arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 773 ++++++++++++++++++++++++- - 1 file changed, 771 insertions(+), 2 deletions(-) - ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -20,6 +20,10 @@ - #include - - #define AR71XX_APB_BASE 0x18000000 -+#define AR71XX_GE0_BASE 0x19000000 -+#define AR71XX_GE0_SIZE 0x10000 -+#define AR71XX_GE1_BASE 0x1a000000 -+#define AR71XX_GE1_SIZE 0x10000 - #define AR71XX_EHCI_BASE 0x1b000000 - #define AR71XX_EHCI_SIZE 0x1000 - #define AR71XX_OHCI_BASE 0x1c000000 -@@ -39,6 +43,8 @@ - #define AR71XX_PLL_SIZE 0x100 - #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000) - #define AR71XX_RESET_SIZE 0x100 -+#define AR71XX_MII_BASE (AR71XX_APB_BASE + 0x00070000) -+#define AR71XX_MII_SIZE 0x100 - - #define AR71XX_PCI_MEM_BASE 0x10000000 - #define AR71XX_PCI_MEM_SIZE 0x07000000 -@@ -81,18 +87,39 @@ - - #define AR933X_UART_BASE (AR71XX_APB_BASE + 0x00020000) - #define AR933X_UART_SIZE 0x14 -+#define AR933X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define AR933X_GMAC_SIZE 0x04 - #define AR933X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) - #define AR933X_WMAC_SIZE 0x20000 - #define AR933X_EHCI_BASE 0x1b000000 - #define AR933X_EHCI_SIZE 0x1000 - -+#define AR934X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define AR934X_GMAC_SIZE 0x14 - #define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) - #define AR934X_WMAC_SIZE 0x20000 - #define AR934X_EHCI_BASE 0x1b000000 - #define AR934X_EHCI_SIZE 0x200 -+#define AR934X_NFC_BASE 0x1b000200 -+#define AR934X_NFC_SIZE 0xb8 - #define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000) - #define AR934X_SRIF_SIZE 0x1000 - -+#define QCA953X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define QCA953X_GMAC_SIZE 0x14 -+#define QCA953X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) -+#define QCA953X_WMAC_SIZE 0x20000 -+#define QCA953X_EHCI_BASE 0x1b000000 -+#define QCA953X_EHCI_SIZE 0x200 -+#define QCA953X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000) -+#define QCA953X_SRIF_SIZE 0x1000 -+ -+#define QCA953X_PCI_CFG_BASE0 0x14000000 -+#define QCA953X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000) -+#define QCA953X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000) -+#define QCA953X_PCI_MEM_BASE0 0x10000000 -+#define QCA953X_PCI_MEM_SIZE 0x02000000 -+ - #define QCA955X_PCI_MEM_BASE0 0x10000000 - #define QCA955X_PCI_MEM_BASE1 0x12000000 - #define QCA955X_PCI_MEM_SIZE 0x02000000 -@@ -106,11 +133,72 @@ - #define QCA955X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000) - #define QCA955X_PCI_CTRL_SIZE 0x100 - -+#define QCA955X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define QCA955X_GMAC_SIZE 0x40 - #define QCA955X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) - #define QCA955X_WMAC_SIZE 0x20000 - #define QCA955X_EHCI0_BASE 0x1b000000 - #define QCA955X_EHCI1_BASE 0x1b400000 - #define QCA955X_EHCI_SIZE 0x1000 -+#define QCA955X_NFC_BASE 0x1b800200 -+#define QCA955X_NFC_SIZE 0xb8 -+ -+#define QCA956X_PCI_MEM_BASE1 0x12000000 -+#define QCA956X_PCI_MEM_SIZE 0x02000000 -+#define QCA956X_PCI_CFG_BASE1 0x16000000 -+#define QCA956X_PCI_CFG_SIZE 0x1000 -+#define QCA956X_PCI_CRP_BASE1 (AR71XX_APB_BASE + 0x00250000) -+#define QCA956X_PCI_CRP_SIZE 0x1000 -+#define QCA956X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000) -+#define QCA956X_PCI_CTRL_SIZE 0x100 -+ -+#define QCA956X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) -+#define QCA956X_WMAC_SIZE 0x20000 -+#define QCA956X_EHCI0_BASE 0x1b000000 -+#define QCA956X_EHCI1_BASE 0x1b400000 -+#define QCA956X_EHCI_SIZE 0x200 -+#define QCA956X_GMAC_SGMII_BASE (AR71XX_APB_BASE + 0x00070000) -+#define QCA956X_GMAC_SGMII_SIZE 0x64 -+#define QCA956X_PLL_BASE (AR71XX_APB_BASE + 0x00050000) -+#define QCA956X_PLL_SIZE 0x50 -+#define QCA956X_GMAC_BASE (AR71XX_APB_BASE + 0x00070000) -+#define QCA956X_GMAC_SIZE 0x64 -+ -+/* -+ * Hidden Registers -+ */ -+#define QCA956X_MAC_CFG_BASE 0xb9000000 -+#define QCA956X_MAC_CFG_SIZE 0x64 -+ -+#define QCA956X_MAC_CFG1_REG 0x00 -+#define QCA956X_MAC_CFG1_SOFT_RST BIT(31) -+#define QCA956X_MAC_CFG1_RX_RST BIT(19) -+#define QCA956X_MAC_CFG1_TX_RST BIT(18) -+#define QCA956X_MAC_CFG1_LOOPBACK BIT(8) -+#define QCA956X_MAC_CFG1_RX_EN BIT(2) -+#define QCA956X_MAC_CFG1_TX_EN BIT(0) -+ -+#define QCA956X_MAC_CFG2_REG 0x04 -+#define QCA956X_MAC_CFG2_IF_1000 BIT(9) -+#define QCA956X_MAC_CFG2_IF_10_100 BIT(8) -+#define QCA956X_MAC_CFG2_HUGE_FRAME_EN BIT(5) -+#define QCA956X_MAC_CFG2_LEN_CHECK BIT(4) -+#define QCA956X_MAC_CFG2_PAD_CRC_EN BIT(2) -+#define QCA956X_MAC_CFG2_FDX BIT(0) -+ -+#define QCA956X_MAC_MII_MGMT_CFG_REG 0x20 -+#define QCA956X_MGMT_CFG_CLK_DIV_20 0x07 -+ -+#define QCA956X_MAC_FIFO_CFG0_REG 0x48 -+#define QCA956X_MAC_FIFO_CFG1_REG 0x4c -+#define QCA956X_MAC_FIFO_CFG2_REG 0x50 -+#define QCA956X_MAC_FIFO_CFG3_REG 0x54 -+#define QCA956X_MAC_FIFO_CFG4_REG 0x58 -+#define QCA956X_MAC_FIFO_CFG5_REG 0x5c -+ -+#define QCA956X_DAM_RESET_OFFSET 0xb90001bc -+#define QCA956X_DAM_RESET_SIZE 0x4 -+#define QCA956X_INLINE_CHKSUM_ENG BIT(27) - - /* - * DDR_CTRL block -@@ -149,6 +237,12 @@ - #define AR934X_DDR_REG_FLUSH_PCIE 0xa8 - #define AR934X_DDR_REG_FLUSH_WMAC 0xac - -+#define QCA953X_DDR_REG_FLUSH_GE0 0x9c -+#define QCA953X_DDR_REG_FLUSH_GE1 0xa0 -+#define QCA953X_DDR_REG_FLUSH_USB 0xa4 -+#define QCA953X_DDR_REG_FLUSH_PCIE 0xa8 -+#define QCA953X_DDR_REG_FLUSH_WMAC 0xac -+ - /* - * PLL block - */ -@@ -166,9 +260,15 @@ - #define AR71XX_AHB_DIV_SHIFT 20 - #define AR71XX_AHB_DIV_MASK 0x7 - -+#define AR71XX_ETH0_PLL_SHIFT 17 -+#define AR71XX_ETH1_PLL_SHIFT 19 -+ - #define AR724X_PLL_REG_CPU_CONFIG 0x00 - #define AR724X_PLL_REG_PCIE_CONFIG 0x10 - -+#define AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS BIT(16) -+#define AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET BIT(25) -+ - #define AR724X_PLL_FB_SHIFT 0 - #define AR724X_PLL_FB_MASK 0x3ff - #define AR724X_PLL_REF_DIV_SHIFT 10 -@@ -178,6 +278,8 @@ - #define AR724X_DDR_DIV_SHIFT 22 - #define AR724X_DDR_DIV_MASK 0x3 - -+#define AR7242_PLL_REG_ETH0_INT_CLOCK 0x2c -+ - #define AR913X_PLL_REG_CPU_CONFIG 0x00 - #define AR913X_PLL_REG_ETH_CONFIG 0x04 - #define AR913X_PLL_REG_ETH0_INT_CLOCK 0x14 -@@ -190,6 +292,9 @@ - #define AR913X_AHB_DIV_SHIFT 19 - #define AR913X_AHB_DIV_MASK 0x1 - -+#define AR913X_ETH0_PLL_SHIFT 20 -+#define AR913X_ETH1_PLL_SHIFT 22 -+ - #define AR933X_PLL_CPU_CONFIG_REG 0x00 - #define AR933X_PLL_CLOCK_CTRL_REG 0x08 - -@@ -211,6 +316,8 @@ - #define AR934X_PLL_CPU_CONFIG_REG 0x00 - #define AR934X_PLL_DDR_CONFIG_REG 0x04 - #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG 0x08 -+#define AR934X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24 -+#define AR934X_PLL_ETH_XMII_CONTROL_REG 0x2c - - #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 - #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -@@ -243,9 +350,52 @@ - #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) - #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -+#define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6) -+ -+#define QCA953X_PLL_CPU_CONFIG_REG 0x00 -+#define QCA953X_PLL_DDR_CONFIG_REG 0x04 -+#define QCA953X_PLL_CLK_CTRL_REG 0x08 -+#define QCA953X_PLL_SWITCH_CLOCK_CONTROL_REG 0x24 -+#define QCA953X_PLL_ETH_XMII_CONTROL_REG 0x2c -+#define QCA953X_PLL_ETH_SGMII_CONTROL_REG 0x48 -+ -+#define QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 -+#define QCA953X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -+#define QCA953X_PLL_CPU_CONFIG_NINT_SHIFT 6 -+#define QCA953X_PLL_CPU_CONFIG_NINT_MASK 0x3f -+#define QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 -+#define QCA953X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -+#define QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19 -+#define QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7 -+ -+#define QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT 0 -+#define QCA953X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff -+#define QCA953X_PLL_DDR_CONFIG_NINT_SHIFT 10 -+#define QCA953X_PLL_DDR_CONFIG_NINT_MASK 0x3f -+#define QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT 16 -+#define QCA953X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f -+#define QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23 -+#define QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7 -+ -+#define QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2) -+#define QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3) -+#define QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4) -+#define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5 -+#define QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f -+#define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10 -+#define QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f -+#define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15 -+#define QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f -+#define QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20) -+#define QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) -+#define QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) -+ - #define QCA955X_PLL_CPU_CONFIG_REG 0x00 - #define QCA955X_PLL_DDR_CONFIG_REG 0x04 - #define QCA955X_PLL_CLK_CTRL_REG 0x08 -+#define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28 -+#define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48 -+#define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c - - #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 - #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f -@@ -278,6 +428,81 @@ - #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) - #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -+#define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2) -+#define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1) -+#define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0) -+ -+#define QCA956X_PLL_CPU_CONFIG_REG 0x00 -+#define QCA956X_PLL_CPU_CONFIG1_REG 0x04 -+#define QCA956X_PLL_DDR_CONFIG_REG 0x08 -+#define QCA956X_PLL_DDR_CONFIG1_REG 0x0c -+#define QCA956X_PLL_CLK_CTRL_REG 0x10 -+#define QCA956X_PLL_SWITCH_CLOCK_CONTROL_REG 0x28 -+#define QCA956X_PLL_ETH_XMII_CONTROL_REG 0x30 -+#define QCA956X_PLL_ETH_SGMII_SERDES_REG 0x4c -+ -+#define QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 -+#define QCA956X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f -+#define QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19 -+#define QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7 -+ -+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0 -+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK 0x1f -+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5 -+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK 0x1fff -+#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT 18 -+#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff -+ -+#define QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT 16 -+#define QCA956X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f -+#define QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23 -+#define QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7 -+ -+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0 -+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK 0x1f -+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5 -+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK 0x1fff -+#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT 18 -+#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff -+ -+#define QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS BIT(2) -+#define QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS BIT(3) -+#define QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS BIT(4) -+#define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT 5 -+#define QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK 0x1f -+#define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT 10 -+#define QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK 0x1f -+#define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT 15 -+#define QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK 0x1f -+#define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL BIT(20) -+#define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL BIT(21) -+#define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) -+ -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_I2C_CLK_SELB BIT(5) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1 BIT(6) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_UART1_CLK_SEL BIT(7) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_SHIFT 8 -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_MASK 0xf -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_EN_PLL_TOP BIT(12) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2 BIT(13) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1 BIT(14) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2 BIT(15) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_SWITCH_FUNC_TST_MODE BIT(16) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_EEE_ENABLE BIT(17) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_OEN_CLK125M_PLL BIT(18) -+#define QCA956X_PLL_SWITCH_CLOCK_SPARE_SWITCHCLK_SEL BIT(19) -+ -+#define QCA956X_PLL_ETH_XMII_TX_INVERT BIT(1) -+#define QCA956X_PLL_ETH_XMII_GIGE BIT(25) -+#define QCA956X_PLL_ETH_XMII_RX_DELAY_SHIFT 28 -+#define QCA956X_PLL_ETH_XMII_RX_DELAY_MASK 0x3 -+#define QCA956X_PLL_ETH_XMII_TX_DELAY_SHIFT 26 -+#define QCA956X_PLL_ETH_XMII_TX_DELAY_MASK 3 -+ -+#define QCA956X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2) -+#define QCA956X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1) -+#define QCA956X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0) -+ - /* - * USB_CONFIG block - */ -@@ -317,10 +542,19 @@ - #define AR934X_RESET_REG_BOOTSTRAP 0xb0 - #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac - -+#define QCA953X_RESET_REG_RESET_MODULE 0x1c -+#define QCA953X_RESET_REG_BOOTSTRAP 0xb0 -+#define QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac -+ - #define QCA955X_RESET_REG_RESET_MODULE 0x1c - #define QCA955X_RESET_REG_BOOTSTRAP 0xb0 - #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac - -+#define QCA956X_RESET_REG_RESET_MODULE 0x1c -+#define QCA956X_RESET_REG_BOOTSTRAP 0xb0 -+#define QCA956X_RESET_REG_EXT_INT_STATUS 0xac -+ -+#define MISC_INT_MIPS_SI_TIMERINT_MASK BIT(28) - #define MISC_INT_ETHSW BIT(12) - #define MISC_INT_TIMER4 BIT(10) - #define MISC_INT_TIMER3 BIT(9) -@@ -370,16 +604,123 @@ - #define AR913X_RESET_USB_HOST BIT(5) - #define AR913X_RESET_USB_PHY BIT(4) - -+#define AR933X_RESET_GE1_MDIO BIT(23) -+#define AR933X_RESET_GE0_MDIO BIT(22) -+#define AR933X_RESET_GE1_MAC BIT(13) - #define AR933X_RESET_WMAC BIT(11) -+#define AR933X_RESET_GE0_MAC BIT(9) - #define AR933X_RESET_USB_HOST BIT(5) - #define AR933X_RESET_USB_PHY BIT(4) - #define AR933X_RESET_USBSUS_OVERRIDE BIT(3) - -+#define AR934X_RESET_HOST BIT(31) -+#define AR934X_RESET_SLIC BIT(30) -+#define AR934X_RESET_HDMA BIT(29) -+#define AR934X_RESET_EXTERNAL BIT(28) -+#define AR934X_RESET_RTC BIT(27) -+#define AR934X_RESET_PCIE_EP_INT BIT(26) -+#define AR934X_RESET_CHKSUM_ACC BIT(25) -+#define AR934X_RESET_FULL_CHIP BIT(24) -+#define AR934X_RESET_GE1_MDIO BIT(23) -+#define AR934X_RESET_GE0_MDIO BIT(22) -+#define AR934X_RESET_CPU_NMI BIT(21) -+#define AR934X_RESET_CPU_COLD BIT(20) -+#define AR934X_RESET_HOST_RESET_INT BIT(19) -+#define AR934X_RESET_PCIE_EP BIT(18) -+#define AR934X_RESET_UART1 BIT(17) -+#define AR934X_RESET_DDR BIT(16) -+#define AR934X_RESET_USB_PHY_PLL_PWD_EXT BIT(15) -+#define AR934X_RESET_NANDF BIT(14) -+#define AR934X_RESET_GE1_MAC BIT(13) -+#define AR934X_RESET_ETH_SWITCH_ANALOG BIT(12) - #define AR934X_RESET_USB_PHY_ANALOG BIT(11) -+#define AR934X_RESET_HOST_DMA_INT BIT(10) -+#define AR934X_RESET_GE0_MAC BIT(9) -+#define AR934X_RESET_ETH_SWITCH BIT(8) -+#define AR934X_RESET_PCIE_PHY BIT(7) -+#define AR934X_RESET_PCIE BIT(6) - #define AR934X_RESET_USB_HOST BIT(5) - #define AR934X_RESET_USB_PHY BIT(4) - #define AR934X_RESET_USBSUS_OVERRIDE BIT(3) -+#define AR934X_RESET_LUT BIT(2) -+#define AR934X_RESET_MBOX BIT(1) -+#define AR934X_RESET_I2S BIT(0) -+ -+#define QCA953X_RESET_USB_EXT_PWR BIT(29) -+#define QCA953X_RESET_EXTERNAL BIT(28) -+#define QCA953X_RESET_RTC BIT(27) -+#define QCA953X_RESET_FULL_CHIP BIT(24) -+#define QCA953X_RESET_GE1_MDIO BIT(23) -+#define QCA953X_RESET_GE0_MDIO BIT(22) -+#define QCA953X_RESET_CPU_NMI BIT(21) -+#define QCA953X_RESET_CPU_COLD BIT(20) -+#define QCA953X_RESET_DDR BIT(16) -+#define QCA953X_RESET_USB_PHY_PLL_PWD_EXT BIT(15) -+#define QCA953X_RESET_GE1_MAC BIT(13) -+#define QCA953X_RESET_ETH_SWITCH_ANALOG BIT(12) -+#define QCA953X_RESET_USB_PHY_ANALOG BIT(11) -+#define QCA953X_RESET_GE0_MAC BIT(9) -+#define QCA953X_RESET_ETH_SWITCH BIT(8) -+#define QCA953X_RESET_PCIE_PHY BIT(7) -+#define QCA953X_RESET_PCIE BIT(6) -+#define QCA953X_RESET_USB_HOST BIT(5) -+#define QCA953X_RESET_USB_PHY BIT(4) -+#define QCA953X_RESET_USBSUS_OVERRIDE BIT(3) -+ -+#define QCA955X_RESET_HOST BIT(31) -+#define QCA955X_RESET_SLIC BIT(30) -+#define QCA955X_RESET_HDMA BIT(29) -+#define QCA955X_RESET_EXTERNAL BIT(28) -+#define QCA955X_RESET_RTC BIT(27) -+#define QCA955X_RESET_PCIE_EP_INT BIT(26) -+#define QCA955X_RESET_CHKSUM_ACC BIT(25) -+#define QCA955X_RESET_FULL_CHIP BIT(24) -+#define QCA955X_RESET_GE1_MDIO BIT(23) -+#define QCA955X_RESET_GE0_MDIO BIT(22) -+#define QCA955X_RESET_CPU_NMI BIT(21) -+#define QCA955X_RESET_CPU_COLD BIT(20) -+#define QCA955X_RESET_HOST_RESET_INT BIT(19) -+#define QCA955X_RESET_PCIE_EP BIT(18) -+#define QCA955X_RESET_UART1 BIT(17) -+#define QCA955X_RESET_DDR BIT(16) -+#define QCA955X_RESET_USB_PHY_PLL_PWD_EXT BIT(15) -+#define QCA955X_RESET_NANDF BIT(14) -+#define QCA955X_RESET_GE1_MAC BIT(13) -+#define QCA955X_RESET_SGMII_ANALOG BIT(12) -+#define QCA955X_RESET_USB_PHY_ANALOG BIT(11) -+#define QCA955X_RESET_HOST_DMA_INT BIT(10) -+#define QCA955X_RESET_GE0_MAC BIT(9) -+#define QCA955X_RESET_SGMII BIT(8) -+#define QCA955X_RESET_PCIE_PHY BIT(7) -+#define QCA955X_RESET_PCIE BIT(6) -+#define QCA955X_RESET_USB_HOST BIT(5) -+#define QCA955X_RESET_USB_PHY BIT(4) -+#define QCA955X_RESET_USBSUS_OVERRIDE BIT(3) -+#define QCA955X_RESET_LUT BIT(2) -+#define QCA955X_RESET_MBOX BIT(1) -+#define QCA955X_RESET_I2S BIT(0) -+ -+#define QCA956X_RESET_EXTERNAL BIT(28) -+#define QCA956X_RESET_FULL_CHIP BIT(24) -+#define QCA956X_RESET_GE1_MDIO BIT(23) -+#define QCA956X_RESET_GE0_MDIO BIT(22) -+#define QCA956X_RESET_CPU_NMI BIT(21) -+#define QCA956X_RESET_CPU_COLD BIT(20) -+#define QCA956X_RESET_DMA BIT(19) -+#define QCA956X_RESET_DDR BIT(16) -+#define QCA956X_RESET_GE1_MAC BIT(13) -+#define QCA956X_RESET_SGMII_ANALOG BIT(12) -+#define QCA956X_RESET_USB_PHY_ANALOG BIT(11) -+#define QCA956X_RESET_GE0_MAC BIT(9) -+#define QCA956X_RESET_SGMII BIT(8) -+#define QCA956X_RESET_USB_HOST BIT(5) -+#define QCA956X_RESET_USB_PHY BIT(4) -+#define QCA956X_RESET_USBSUS_OVERRIDE BIT(3) -+#define QCA956X_RESET_SWITCH_ANALOG BIT(2) -+#define QCA956X_RESET_SWITCH BIT(0) - -+#define AR933X_BOOTSTRAP_MDIO_GPIO_EN BIT(18) -+#define AR933X_BOOTSTRAP_EEPBUSY BIT(4) - #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0) - - #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23) -@@ -398,8 +739,17 @@ - #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1) - #define AR934X_BOOTSTRAP_DDR1 BIT(0) - -+#define QCA953X_BOOTSTRAP_SW_OPTION2 BIT(12) -+#define QCA953X_BOOTSTRAP_SW_OPTION1 BIT(11) -+#define QCA953X_BOOTSTRAP_EJTAG_MODE BIT(5) -+#define QCA953X_BOOTSTRAP_REF_CLK_40 BIT(4) -+#define QCA953X_BOOTSTRAP_SDRAM_DISABLED BIT(1) -+#define QCA953X_BOOTSTRAP_DDR1 BIT(0) -+ - #define QCA955X_BOOTSTRAP_REF_CLK_40 BIT(4) - -+#define QCA956X_BOOTSTRAP_REF_CLK_40 BIT(2) -+ - #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) - #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1) - #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) -@@ -418,6 +768,24 @@ - AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \ - AR934X_PCIE_WMAC_INT_PCIE_RC3) - -+#define QCA953X_PCIE_WMAC_INT_WMAC_MISC BIT(0) -+#define QCA953X_PCIE_WMAC_INT_WMAC_TX BIT(1) -+#define QCA953X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) -+#define QCA953X_PCIE_WMAC_INT_WMAC_RXHP BIT(3) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC BIT(4) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC0 BIT(5) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC1 BIT(6) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC2 BIT(7) -+#define QCA953X_PCIE_WMAC_INT_PCIE_RC3 BIT(8) -+#define QCA953X_PCIE_WMAC_INT_WMAC_ALL \ -+ (QCA953X_PCIE_WMAC_INT_WMAC_MISC | QCA953X_PCIE_WMAC_INT_WMAC_TX | \ -+ QCA953X_PCIE_WMAC_INT_WMAC_RXLP | QCA953X_PCIE_WMAC_INT_WMAC_RXHP) -+ -+#define QCA953X_PCIE_WMAC_INT_PCIE_ALL \ -+ (QCA953X_PCIE_WMAC_INT_PCIE_RC | QCA953X_PCIE_WMAC_INT_PCIE_RC0 | \ -+ QCA953X_PCIE_WMAC_INT_PCIE_RC1 | QCA953X_PCIE_WMAC_INT_PCIE_RC2 | \ -+ QCA953X_PCIE_WMAC_INT_PCIE_RC3) -+ - #define QCA955X_EXT_INT_WMAC_MISC BIT(0) - #define QCA955X_EXT_INT_WMAC_TX BIT(1) - #define QCA955X_EXT_INT_WMAC_RXLP BIT(2) -@@ -449,6 +817,37 @@ - QCA955X_EXT_INT_PCIE_RC2_INT1 | QCA955X_EXT_INT_PCIE_RC2_INT2 | \ - QCA955X_EXT_INT_PCIE_RC2_INT3) - -+#define QCA956X_EXT_INT_WMAC_MISC BIT(0) -+#define QCA956X_EXT_INT_WMAC_TX BIT(1) -+#define QCA956X_EXT_INT_WMAC_RXLP BIT(2) -+#define QCA956X_EXT_INT_WMAC_RXHP BIT(3) -+#define QCA956X_EXT_INT_PCIE_RC1 BIT(4) -+#define QCA956X_EXT_INT_PCIE_RC1_INT0 BIT(5) -+#define QCA956X_EXT_INT_PCIE_RC1_INT1 BIT(6) -+#define QCA956X_EXT_INT_PCIE_RC1_INT2 BIT(7) -+#define QCA956X_EXT_INT_PCIE_RC1_INT3 BIT(8) -+#define QCA956X_EXT_INT_PCIE_RC2 BIT(12) -+#define QCA956X_EXT_INT_PCIE_RC2_INT0 BIT(13) -+#define QCA956X_EXT_INT_PCIE_RC2_INT1 BIT(14) -+#define QCA956X_EXT_INT_PCIE_RC2_INT2 BIT(15) -+#define QCA956X_EXT_INT_PCIE_RC2_INT3 BIT(16) -+#define QCA956X_EXT_INT_USB1 BIT(24) -+#define QCA956X_EXT_INT_USB2 BIT(28) -+ -+#define QCA956X_EXT_INT_WMAC_ALL \ -+ (QCA956X_EXT_INT_WMAC_MISC | QCA956X_EXT_INT_WMAC_TX | \ -+ QCA956X_EXT_INT_WMAC_RXLP | QCA956X_EXT_INT_WMAC_RXHP) -+ -+#define QCA956X_EXT_INT_PCIE_RC1_ALL \ -+ (QCA956X_EXT_INT_PCIE_RC1 | QCA956X_EXT_INT_PCIE_RC1_INT0 | \ -+ QCA956X_EXT_INT_PCIE_RC1_INT1 | QCA956X_EXT_INT_PCIE_RC1_INT2 | \ -+ QCA956X_EXT_INT_PCIE_RC1_INT3) -+ -+#define QCA956X_EXT_INT_PCIE_RC2_ALL \ -+ (QCA956X_EXT_INT_PCIE_RC2 | QCA956X_EXT_INT_PCIE_RC2_INT0 | \ -+ QCA956X_EXT_INT_PCIE_RC2_INT1 | QCA956X_EXT_INT_PCIE_RC2_INT2 | \ -+ QCA956X_EXT_INT_PCIE_RC2_INT3) -+ - #define REV_ID_MAJOR_MASK 0xfff0 - #define REV_ID_MAJOR_AR71XX 0x00a0 - #define REV_ID_MAJOR_AR913X 0x00b0 -@@ -460,8 +859,12 @@ - #define REV_ID_MAJOR_AR9341 0x0120 - #define REV_ID_MAJOR_AR9342 0x1120 - #define REV_ID_MAJOR_AR9344 0x2120 -+#define REV_ID_MAJOR_QCA9533 0x0140 -+#define REV_ID_MAJOR_QCA9533_V2 0x0160 - #define REV_ID_MAJOR_QCA9556 0x0130 - #define REV_ID_MAJOR_QCA9558 0x1130 -+#define REV_ID_MAJOR_TP9343 0x0150 -+#define REV_ID_MAJOR_QCA956X 0x1150 - - #define AR71XX_REV_ID_MINOR_MASK 0x3 - #define AR71XX_REV_ID_MINOR_AR7130 0x0 -@@ -482,8 +885,12 @@ - - #define AR934X_REV_ID_REVISION_MASK 0xf - -+#define QCA953X_REV_ID_REVISION_MASK 0xf -+ - #define QCA955X_REV_ID_REVISION_MASK 0xf - -+#define QCA956X_REV_ID_REVISION_MASK 0xf -+ - /* - * SPI block - */ -@@ -521,15 +928,63 @@ - #define AR71XX_GPIO_REG_INT_ENABLE 0x24 - #define AR71XX_GPIO_REG_FUNC 0x28 - -+#define AR934X_GPIO_REG_OUT_FUNC0 0x2c -+#define AR934X_GPIO_REG_OUT_FUNC1 0x30 -+#define AR934X_GPIO_REG_OUT_FUNC2 0x34 -+#define AR934X_GPIO_REG_OUT_FUNC3 0x38 -+#define AR934X_GPIO_REG_OUT_FUNC4 0x3c -+#define AR934X_GPIO_REG_OUT_FUNC5 0x40 - #define AR934X_GPIO_REG_FUNC 0x6c - -+#define QCA953X_GPIO_REG_OUT_FUNC0 0x2c -+#define QCA953X_GPIO_REG_OUT_FUNC1 0x30 -+#define QCA953X_GPIO_REG_OUT_FUNC2 0x34 -+#define QCA953X_GPIO_REG_OUT_FUNC3 0x38 -+#define QCA953X_GPIO_REG_OUT_FUNC4 0x3c -+#define QCA953X_GPIO_REG_IN_ENABLE0 0x44 -+#define QCA953X_GPIO_REG_FUNC 0x6c -+ -+#define QCA953X_GPIO_OUT_MUX_SPI_CS1 10 -+#define QCA953X_GPIO_OUT_MUX_SPI_CS2 11 -+#define QCA953X_GPIO_OUT_MUX_SPI_CS0 9 -+#define QCA953X_GPIO_OUT_MUX_SPI_CLK 8 -+#define QCA953X_GPIO_OUT_MUX_SPI_MOSI 12 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK1 41 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK2 42 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK3 43 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK4 44 -+#define QCA953X_GPIO_OUT_MUX_LED_LINK5 45 -+ -+#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c -+#define QCA955X_GPIO_REG_OUT_FUNC1 0x30 -+#define QCA955X_GPIO_REG_OUT_FUNC2 0x34 -+#define QCA955X_GPIO_REG_OUT_FUNC3 0x38 -+#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c -+#define QCA955X_GPIO_REG_OUT_FUNC5 0x40 -+#define QCA955X_GPIO_REG_FUNC 0x6c -+ -+#define QCA956X_GPIO_REG_OUT_FUNC0 0x2c -+#define QCA956X_GPIO_REG_OUT_FUNC1 0x30 -+#define QCA956X_GPIO_REG_OUT_FUNC2 0x34 -+#define QCA956X_GPIO_REG_OUT_FUNC3 0x38 -+#define QCA956X_GPIO_REG_OUT_FUNC4 0x3c -+#define QCA956X_GPIO_REG_OUT_FUNC5 0x40 -+#define QCA956X_GPIO_REG_IN_ENABLE0 0x44 -+#define QCA956X_GPIO_REG_IN_ENABLE3 0x50 -+#define QCA956X_GPIO_REG_FUNC 0x6c -+ -+#define QCA956X_GPIO_OUT_MUX_GE0_MDO 32 -+#define QCA956X_GPIO_OUT_MUX_GE0_MDC 33 -+ - #define AR71XX_GPIO_COUNT 16 - #define AR7240_GPIO_COUNT 18 - #define AR7241_GPIO_COUNT 20 - #define AR913X_GPIO_COUNT 22 - #define AR933X_GPIO_COUNT 30 - #define AR934X_GPIO_COUNT 23 -+#define QCA953X_GPIO_COUNT 18 - #define QCA955X_GPIO_COUNT 24 -+#define QCA956X_GPIO_COUNT 23 - - /* - * SRIF block -@@ -552,4 +1007,318 @@ - #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 - #define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 - -+#define QCA953X_SRIF_CPU_DPLL1_REG 0x1c0 -+#define QCA953X_SRIF_CPU_DPLL2_REG 0x1c4 -+#define QCA953X_SRIF_CPU_DPLL3_REG 0x1c8 -+ -+#define QCA953X_SRIF_DDR_DPLL1_REG 0x240 -+#define QCA953X_SRIF_DDR_DPLL2_REG 0x244 -+#define QCA953X_SRIF_DDR_DPLL3_REG 0x248 -+ -+#define QCA953X_SRIF_DPLL1_REFDIV_SHIFT 27 -+#define QCA953X_SRIF_DPLL1_REFDIV_MASK 0x1f -+#define QCA953X_SRIF_DPLL1_NINT_SHIFT 18 -+#define QCA953X_SRIF_DPLL1_NINT_MASK 0x1ff -+#define QCA953X_SRIF_DPLL1_NFRAC_MASK 0x0003ffff -+ -+#define QCA953X_SRIF_DPLL2_LOCAL_PLL BIT(30) -+#define QCA953X_SRIF_DPLL2_OUTDIV_SHIFT 13 -+#define QCA953X_SRIF_DPLL2_OUTDIV_MASK 0x7 -+ -+#define AR71XX_GPIO_FUNC_STEREO_EN BIT(17) -+#define AR71XX_GPIO_FUNC_SLIC_EN BIT(16) -+#define AR71XX_GPIO_FUNC_SPI_CS2_EN BIT(13) -+#define AR71XX_GPIO_FUNC_SPI_CS1_EN BIT(12) -+#define AR71XX_GPIO_FUNC_UART_EN BIT(8) -+#define AR71XX_GPIO_FUNC_USB_OC_EN BIT(4) -+#define AR71XX_GPIO_FUNC_USB_CLK_EN BIT(0) -+ -+#define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19) -+#define AR724X_GPIO_FUNC_SPI_EN BIT(18) -+#define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14) -+#define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13) -+#define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12) -+#define AR724X_GPIO_FUNC_CLK_OBS4_EN BIT(11) -+#define AR724X_GPIO_FUNC_CLK_OBS3_EN BIT(10) -+#define AR724X_GPIO_FUNC_CLK_OBS2_EN BIT(9) -+#define AR724X_GPIO_FUNC_CLK_OBS1_EN BIT(8) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4) -+#define AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3) -+#define AR724X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2) -+#define AR724X_GPIO_FUNC_UART_EN BIT(1) -+#define AR724X_GPIO_FUNC_JTAG_DISABLE BIT(0) -+ -+#define AR913X_GPIO_FUNC_WMAC_LED_EN BIT(22) -+#define AR913X_GPIO_FUNC_EXP_PORT_CS_EN BIT(21) -+#define AR913X_GPIO_FUNC_I2S_REFCLKEN BIT(20) -+#define AR913X_GPIO_FUNC_I2S_MCKEN BIT(19) -+#define AR913X_GPIO_FUNC_I2S1_EN BIT(18) -+#define AR913X_GPIO_FUNC_I2S0_EN BIT(17) -+#define AR913X_GPIO_FUNC_SLIC_EN BIT(16) -+#define AR913X_GPIO_FUNC_UART_RTSCTS_EN BIT(9) -+#define AR913X_GPIO_FUNC_UART_EN BIT(8) -+#define AR913X_GPIO_FUNC_USB_CLK_EN BIT(4) -+ -+#define AR933X_GPIO_FUNC_SPDIF2TCK BIT(31) -+#define AR933X_GPIO_FUNC_SPDIF_EN BIT(30) -+#define AR933X_GPIO_FUNC_I2SO_22_18_EN BIT(29) -+#define AR933X_GPIO_FUNC_I2S_MCK_EN BIT(27) -+#define AR933X_GPIO_FUNC_I2SO_EN BIT(26) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_DUPL BIT(25) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_COLL BIT(24) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED_ACT BIT(23) -+#define AR933X_GPIO_FUNC_SPI_EN BIT(18) -+#define AR933X_GPIO_FUNC_SPI_CS_EN2 BIT(14) -+#define AR933X_GPIO_FUNC_SPI_CS_EN1 BIT(13) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN BIT(7) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN BIT(6) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN BIT(5) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN BIT(4) -+#define AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN BIT(3) -+#define AR933X_GPIO_FUNC_UART_RTS_CTS_EN BIT(2) -+#define AR933X_GPIO_FUNC_UART_EN BIT(1) -+#define AR933X_GPIO_FUNC_JTAG_DISABLE BIT(0) -+ -+#define AR934X_GPIO_FUNC_CLK_OBS7_EN BIT(9) -+#define AR934X_GPIO_FUNC_CLK_OBS6_EN BIT(8) -+#define AR934X_GPIO_FUNC_CLK_OBS5_EN BIT(7) -+#define AR934X_GPIO_FUNC_CLK_OBS4_EN BIT(6) -+#define AR934X_GPIO_FUNC_CLK_OBS3_EN BIT(5) -+#define AR934X_GPIO_FUNC_CLK_OBS2_EN BIT(4) -+#define AR934X_GPIO_FUNC_CLK_OBS1_EN BIT(3) -+#define AR934X_GPIO_FUNC_CLK_OBS0_EN BIT(2) -+#define AR934X_GPIO_FUNC_JTAG_DISABLE BIT(1) -+ -+#define AR934X_GPIO_OUT_GPIO 0 -+#define AR934X_GPIO_OUT_SPI_CS1 7 -+#define AR934X_GPIO_OUT_LED_LINK0 41 -+#define AR934X_GPIO_OUT_LED_LINK1 42 -+#define AR934X_GPIO_OUT_LED_LINK2 43 -+#define AR934X_GPIO_OUT_LED_LINK3 44 -+#define AR934X_GPIO_OUT_LED_LINK4 45 -+#define AR934X_GPIO_OUT_EXT_LNA0 46 -+#define AR934X_GPIO_OUT_EXT_LNA1 47 -+ -+#define QCA955X_GPIO_FUNC_CLK_OBS7_EN BIT(9) -+#define QCA955X_GPIO_FUNC_CLK_OBS6_EN BIT(8) -+#define QCA955X_GPIO_FUNC_CLK_OBS5_EN BIT(7) -+#define QCA955X_GPIO_FUNC_CLK_OBS4_EN BIT(6) -+#define QCA955X_GPIO_FUNC_CLK_OBS3_EN BIT(5) -+#define QCA955X_GPIO_FUNC_CLK_OBS2_EN BIT(4) -+#define QCA955X_GPIO_FUNC_CLK_OBS1_EN BIT(3) -+#define QCA955X_GPIO_FUNC_JTAG_DISABLE BIT(1) -+ -+#define QCA955X_GPIO_OUT_GPIO 0 -+#define QCA955X_MII_EXT_MDI 1 -+#define QCA955X_SLIC_DATA_OUT 3 -+#define QCA955X_SLIC_PCM_FS 4 -+#define QCA955X_SLIC_PCM_CLK 5 -+#define QCA955X_SPI_CLK 8 -+#define QCA955X_SPI_CS_0 9 -+#define QCA955X_SPI_CS_1 10 -+#define QCA955X_SPI_CS_2 11 -+#define QCA955X_SPI_MISO 12 -+#define QCA955X_I2S_CLK 13 -+#define QCA955X_I2S_WS 14 -+#define QCA955X_I2S_SD 15 -+#define QCA955X_I2S_MCK 16 -+#define QCA955X_SPDIF_OUT 17 -+#define QCA955X_UART1_TD 18 -+#define QCA955X_UART1_RTS 19 -+#define QCA955X_UART1_RD 20 -+#define QCA955X_UART1_CTS 21 -+#define QCA955X_UART0_SOUT 22 -+#define QCA955X_SPDIF2_OUT 23 -+#define QCA955X_LED_SGMII_SPEED0 24 -+#define QCA955X_LED_SGMII_SPEED1 25 -+#define QCA955X_LED_SGMII_DUPLEX 26 -+#define QCA955X_LED_SGMII_LINK_UP 27 -+#define QCA955X_SGMII_SPEED0_INVERT 28 -+#define QCA955X_SGMII_SPEED1_INVERT 29 -+#define QCA955X_SGMII_DUPLEX_INVERT 30 -+#define QCA955X_SGMII_LINK_UP_INVERT 31 -+#define QCA955X_GE1_MII_MDO 32 -+#define QCA955X_GE1_MII_MDC 33 -+#define QCA955X_SWCOM2 38 -+#define QCA955X_SWCOM3 39 -+#define QCA955X_MAC2_GPIO 40 -+#define QCA955X_MAC3_GPIO 41 -+#define QCA955X_ATT_LED 42 -+#define QCA955X_PWR_LED 43 -+#define QCA955X_TX_FRAME 44 -+#define QCA955X_RX_CLEAR_EXTERNAL 45 -+#define QCA955X_LED_NETWORK_EN 46 -+#define QCA955X_LED_POWER_EN 47 -+#define QCA955X_WMAC_GLUE_WOW 68 -+#define QCA955X_RX_CLEAR_EXTENSION 70 -+#define QCA955X_CP_NAND_CS1 73 -+#define QCA955X_USB_SUSPEND 74 -+#define QCA955X_ETH_TX_ERR 75 -+#define QCA955X_DDR_DQ_OE 76 -+#define QCA955X_CLKREQ_N_EP 77 -+#define QCA955X_CLKREQ_N_RC 78 -+#define QCA955X_CLK_OBS0 79 -+#define QCA955X_CLK_OBS1 80 -+#define QCA955X_CLK_OBS2 81 -+#define QCA955X_CLK_OBS3 82 -+#define QCA955X_CLK_OBS4 83 -+#define QCA955X_CLK_OBS5 84 -+ -+/* -+ * MII_CTRL block -+ */ -+#define AR71XX_MII_REG_MII0_CTRL 0x00 -+#define AR71XX_MII_REG_MII1_CTRL 0x04 -+ -+#define AR71XX_MII_CTRL_IF_MASK 3 -+#define AR71XX_MII_CTRL_SPEED_SHIFT 4 -+#define AR71XX_MII_CTRL_SPEED_MASK 3 -+#define AR71XX_MII_CTRL_SPEED_10 0 -+#define AR71XX_MII_CTRL_SPEED_100 1 -+#define AR71XX_MII_CTRL_SPEED_1000 2 -+ -+#define AR71XX_MII0_CTRL_IF_GMII 0 -+#define AR71XX_MII0_CTRL_IF_MII 1 -+#define AR71XX_MII0_CTRL_IF_RGMII 2 -+#define AR71XX_MII0_CTRL_IF_RMII 3 -+ -+#define AR71XX_MII1_CTRL_IF_RGMII 0 -+#define AR71XX_MII1_CTRL_IF_RMII 1 -+ -+/* -+ * AR933X GMAC interface -+ */ -+#define AR933X_GMAC_REG_ETH_CFG 0x00 -+ -+#define AR933X_ETH_CFG_RGMII_GE0 BIT(0) -+#define AR933X_ETH_CFG_MII_GE0 BIT(1) -+#define AR933X_ETH_CFG_GMII_GE0 BIT(2) -+#define AR933X_ETH_CFG_MII_GE0_MASTER BIT(3) -+#define AR933X_ETH_CFG_MII_GE0_SLAVE BIT(4) -+#define AR933X_ETH_CFG_MII_GE0_ERR_EN BIT(5) -+#define AR933X_ETH_CFG_SW_PHY_SWAP BIT(7) -+#define AR933X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(8) -+#define AR933X_ETH_CFG_RMII_GE0 BIT(9) -+#define AR933X_ETH_CFG_RMII_GE0_SPD_10 0 -+#define AR933X_ETH_CFG_RMII_GE0_SPD_100 BIT(10) -+ -+/* -+ * AR934X GMAC Interface -+ */ -+#define AR934X_GMAC_REG_ETH_CFG 0x00 -+ -+#define AR934X_ETH_CFG_RGMII_GMAC0 BIT(0) -+#define AR934X_ETH_CFG_MII_GMAC0 BIT(1) -+#define AR934X_ETH_CFG_GMII_GMAC0 BIT(2) -+#define AR934X_ETH_CFG_MII_GMAC0_MASTER BIT(3) -+#define AR934X_ETH_CFG_MII_GMAC0_SLAVE BIT(4) -+#define AR934X_ETH_CFG_MII_GMAC0_ERR_EN BIT(5) -+#define AR934X_ETH_CFG_SW_ONLY_MODE BIT(6) -+#define AR934X_ETH_CFG_SW_PHY_SWAP BIT(7) -+#define AR934X_ETH_CFG_SW_APB_ACCESS BIT(9) -+#define AR934X_ETH_CFG_RMII_GMAC0 BIT(10) -+#define AR933X_ETH_CFG_MII_CNTL_SPEED BIT(11) -+#define AR934X_ETH_CFG_RMII_GMAC0_MASTER BIT(12) -+#define AR933X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13) -+#define AR934X_ETH_CFG_RXD_DELAY BIT(14) -+#define AR934X_ETH_CFG_RXD_DELAY_MASK 0x3 -+#define AR934X_ETH_CFG_RXD_DELAY_SHIFT 14 -+#define AR934X_ETH_CFG_RDV_DELAY BIT(16) -+#define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 -+#define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 -+ -+/* -+ * QCA953X GMAC Interface -+ */ -+#define QCA953X_GMAC_REG_ETH_CFG 0x00 -+ -+#define QCA953X_ETH_CFG_SW_ONLY_MODE BIT(6) -+#define QCA953X_ETH_CFG_SW_PHY_SWAP BIT(7) -+#define QCA953X_ETH_CFG_SW_APB_ACCESS BIT(9) -+#define QCA953X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13) -+ -+/* -+ * QCA955X GMAC Interface -+ */ -+ -+#define QCA955X_GMAC_REG_ETH_CFG 0x00 -+#define QCA955X_GMAC_REG_SGMII_SERDES 0x18 -+ -+#define QCA955X_ETH_CFG_RGMII_EN BIT(0) -+#define QCA955X_ETH_CFG_MII_GE0 BIT(1) -+#define QCA955X_ETH_CFG_GMII_GE0 BIT(2) -+#define QCA955X_ETH_CFG_MII_GE0_MASTER BIT(3) -+#define QCA955X_ETH_CFG_MII_GE0_SLAVE BIT(4) -+#define QCA955X_ETH_CFG_GE0_ERR_EN BIT(5) -+#define QCA955X_ETH_CFG_GE0_SGMII BIT(6) -+#define QCA955X_ETH_CFG_RMII_GE0 BIT(10) -+#define QCA955X_ETH_CFG_MII_CNTL_SPEED BIT(11) -+#define QCA955X_ETH_CFG_RMII_GE0_MASTER BIT(12) -+#define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3 -+#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14 -+#define QCA955X_ETH_CFG_RDV_DELAY BIT(16) -+#define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3 -+#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16 -+#define QCA955X_ETH_CFG_TXD_DELAY_MASK 0x3 -+#define QCA955X_ETH_CFG_TXD_DELAY_SHIFT 18 -+#define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 -+#define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 -+ -+#define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15) -+#define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23 -+#define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf -+/* -+ * QCA956X GMAC Interface -+ */ -+ -+#define QCA956X_GMAC_REG_ETH_CFG 0x00 -+#define QCA956X_GMAC_REG_SGMII_RESET 0x14 -+#define QCA956X_GMAC_REG_SGMII_SERDES 0x18 -+#define QCA956X_GMAC_REG_MR_AN_CONTROL 0x1c -+#define QCA956X_GMAC_REG_SGMII_CONFIG 0x34 -+#define QCA956X_GMAC_REG_SGMII_DEBUG 0x58 -+ -+#define QCA956X_ETH_CFG_RGMII_EN BIT(0) -+#define QCA956X_ETH_CFG_GE0_SGMII BIT(6) -+#define QCA956X_ETH_CFG_SW_ONLY_MODE BIT(7) -+#define QCA956X_ETH_CFG_SW_PHY_SWAP BIT(8) -+#define QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP BIT(9) -+#define QCA956X_ETH_CFG_SW_APB_ACCESS BIT(10) -+#define QCA956X_ETH_CFG_SW_ACC_MSB_FIRST BIT(13) -+#define QCA956X_ETH_CFG_RXD_DELAY_MASK 0x3 -+#define QCA956X_ETH_CFG_RXD_DELAY_SHIFT 14 -+#define QCA956X_ETH_CFG_RDV_DELAY_MASK 0x3 -+#define QCA956X_ETH_CFG_RDV_DELAY_SHIFT 16 -+ -+#define QCA956X_SGMII_RESET_RX_CLK_N_RESET 0x0 -+#define QCA956X_SGMII_RESET_RX_CLK_N BIT(0) -+#define QCA956X_SGMII_RESET_TX_CLK_N BIT(1) -+#define QCA956X_SGMII_RESET_RX_125M_N BIT(2) -+#define QCA956X_SGMII_RESET_TX_125M_N BIT(3) -+#define QCA956X_SGMII_RESET_HW_RX_125M_N BIT(4) -+ -+#define QCA956X_SGMII_SERDES_CDR_BW_MASK 0x3 -+#define QCA956X_SGMII_SERDES_CDR_BW_SHIFT 1 -+#define QCA956X_SGMII_SERDES_TX_DR_CTRL_MASK 0x7 -+#define QCA956X_SGMII_SERDES_TX_DR_CTRL_SHIFT 4 -+#define QCA956X_SGMII_SERDES_PLL_BW BIT(8) -+#define QCA956X_SGMII_SERDES_VCO_FAST BIT(9) -+#define QCA956X_SGMII_SERDES_VCO_SLOW BIT(10) -+#define QCA956X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15) -+#define QCA956X_SGMII_SERDES_EN_SIGNAL_DETECT BIT(16) -+#define QCA956X_SGMII_SERDES_FIBER_SDO BIT(17) -+#define QCA956X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23 -+#define QCA956X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf -+#define QCA956X_SGMII_SERDES_VCO_REG_SHIFT 27 -+#define QCA956X_SGMII_SERDES_VCO_REG_MASK 0xf -+ -+#define QCA956X_MR_AN_CONTROL_AN_ENABLE BIT(12) -+#define QCA956X_MR_AN_CONTROL_PHY_RESET BIT(15) -+ -+#define QCA956X_SGMII_CONFIG_MODE_CTRL_SHIFT 0 -+#define QCA956X_SGMII_CONFIG_MODE_CTRL_MASK 0x7 -+ - #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/target/linux/ath79/patches-4.14/0010-MIPS-ath79-select-the-PINCTRL-subsystem.patch b/target/linux/ath79/patches-4.14/0010-MIPS-ath79-select-the-PINCTRL-subsystem.patch deleted file mode 100644 index cd3f96c3f..000000000 --- a/target/linux/ath79/patches-4.14/0010-MIPS-ath79-select-the-PINCTRL-subsystem.patch +++ /dev/null @@ -1,20 +0,0 @@ -From f3d5027255ef0752ed12b65c3bf7eb363fc3c096 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:00:55 +0100 -Subject: [PATCH 10/27] MIPS: ath79: select the PINCTRL subsystem - -Signed-off-by: John Crispin ---- - arch/mips/Kconfig | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -191,6 +191,7 @@ config ATH79 - select CSRC_R4K - select DMA_NONCOHERENT - select GPIOLIB -+ select PINCTRL - select HAVE_CLK - select COMMON_CLK - select CLKDEV_LOOKUP diff --git a/target/linux/ath79/patches-4.14/0011-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch b/target/linux/ath79/patches-4.14/0011-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch deleted file mode 100644 index 85ee24c20..000000000 --- a/target/linux/ath79/patches-4.14/0011-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 54204ef3edbb1aa2390cabba61fe185a12cc39f0 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Tue, 6 Mar 2018 08:35:44 +0100 -Subject: [PATCH 11/27] MIPS: ath79: fix register address in - ath79_ddr_wb_flush() - -ath79_ddr_wb_flush_base has the type void __iomem *, so register offsets -need to be a multiple of 4. - -Cc: Alban Bedel -Fixes: 24b0e3e84fbf ("MIPS: ath79: Improve the DDR controller interface") -Signed-off-by: Felix Fietkau ---- - arch/mips/ath79/common.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -58,7 +58,7 @@ EXPORT_SYMBOL_GPL(ath79_ddr_ctrl_init); - - void ath79_ddr_wb_flush(u32 reg) - { -- void __iomem *flush_reg = ath79_ddr_wb_flush_base + reg; -+ void __iomem *flush_reg = ath79_ddr_wb_flush_base + (reg * 4); - - /* Flush the DDR write buffer. */ - __raw_writel(0x1, flush_reg); diff --git a/target/linux/ath79/patches-4.14/0012-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch b/target/linux/ath79/patches-4.14/0012-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch deleted file mode 100644 index 2b744ee94..000000000 --- a/target/linux/ath79/patches-4.14/0012-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ac3a5ee699f3baa7654c93a3ffda46be82443344 Mon Sep 17 00:00:00 2001 -From: Markos Chandras -Date: Wed, 21 Aug 2013 11:47:22 +0100 -Subject: [PATCH 12/27] MIPS: ath79: Avoid using unitialized 'reg' variable - -Fixes the following build error: -arch/mips/include/asm/mach-ath79/ath79.h:139:20: error: 'reg' may be used -uninitialized in this function [-Werror=maybe-uninitialized] -arch/mips/ath79/common.c:62:6: note: 'reg' was declared here -In file included from arch/mips/ath79/common.c:20:0: -arch/mips/ath79/common.c: In function 'ath79_device_reset_clear': -arch/mips/include/asm/mach-ath79/ath79.h:139:20: -error: 'reg' may be used uninitialized in this function -[-Werror=maybe-uninitialized] -arch/mips/ath79/common.c:90:6: note: 'reg' was declared here - -Signed-off-by: Markos Chandras -Acked-by: Gabor Juhos ---- - arch/mips/ath79/common.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -106,7 +106,7 @@ void ath79_device_reset_set(u32 mask) - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -- BUG(); -+ panic("Reset register not defined for this SOC"); - - spin_lock_irqsave(&ath79_device_reset_lock, flags); - t = ath79_reset_rr(reg); -@@ -134,7 +134,7 @@ void ath79_device_reset_clear(u32 mask) - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -- BUG(); -+ panic("Reset register not defined for this SOC"); - - spin_lock_irqsave(&ath79_device_reset_lock, flags); - t = ath79_reset_rr(reg); diff --git a/target/linux/ath79/patches-4.14/0013-MIPS-ath79-fix-system-restart.patch b/target/linux/ath79/patches-4.14/0013-MIPS-ath79-fix-system-restart.patch deleted file mode 100644 index 969636128..000000000 --- a/target/linux/ath79/patches-4.14/0013-MIPS-ath79-fix-system-restart.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 11562939754b8f877562d9a137854022eb521716 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Mon, 5 Mar 2018 11:33:54 +0100 -Subject: [PATCH 13/27] MIPS: ath79: fix system restart - -Signed-off-by: Felix Fietkau -Signed-off-by: John Crispin ---- - arch/mips/ath79/setup.c | 1 + - arch/mips/include/asm/mach-ath79/ath79.h | 1 + - 2 files changed, 2 insertions(+) - ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -40,6 +40,7 @@ static char ath79_sys_type[ATH79_SYS_TYP - - static void ath79_restart(char *command) - { -+ local_irq_disable(); - ath79_device_reset_set(AR71XX_RESET_FULL_CHIP); - for (;;) - if (cpu_wait) ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -134,6 +134,7 @@ static inline u32 ath79_pll_rr(unsigned - static inline void ath79_reset_wr(unsigned reg, u32 val) - { - __raw_writel(val, ath79_reset_base + reg); -+ (void) __raw_readl(ath79_reset_base + reg); /* flush */ - } - - static inline u32 ath79_reset_rr(unsigned reg) diff --git a/target/linux/ath79/patches-4.14/0014-MIPS-ath79-finetune-cpu-overrides.patch b/target/linux/ath79/patches-4.14/0014-MIPS-ath79-finetune-cpu-overrides.patch deleted file mode 100644 index e390e584f..000000000 --- a/target/linux/ath79/patches-4.14/0014-MIPS-ath79-finetune-cpu-overrides.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 5a8496923bafc4350f51b26964fdc3252a09fd79 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Mon, 5 Mar 2018 11:35:29 +0100 -Subject: [PATCH 14/27] MIPS: ath79: finetune cpu-overrides - -Signed-off-by: Felix Fietkau ---- - arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h -+++ b/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h -@@ -36,6 +36,7 @@ - #define cpu_has_mdmx 0 - #define cpu_has_mips3d 0 - #define cpu_has_smartmips 0 -+#define cpu_has_rixi 0 - - #define cpu_has_mips32r1 1 - #define cpu_has_mips32r2 1 -@@ -43,6 +44,7 @@ - #define cpu_has_mips64r2 0 - - #define cpu_has_mipsmt 0 -+#define cpu_has_userlocal 0 - - #define cpu_has_64bits 0 - #define cpu_has_64bit_zero_reg 0 -@@ -51,5 +53,9 @@ - - #define cpu_dcache_line_size() 32 - #define cpu_icache_line_size() 32 -+#define cpu_has_vtag_icache 0 -+#define cpu_has_dc_aliases 1 -+#define cpu_has_ic_fills_f_dc 0 -+#define cpu_has_pindexed_dcache 0 - - #endif /* __ASM_MACH_ATH79_CPU_FEATURE_OVERRIDES_H */ diff --git a/target/linux/ath79/patches-4.14/0015-MIPS-ath79-enable-uart-during-early_prink.patch b/target/linux/ath79/patches-4.14/0015-MIPS-ath79-enable-uart-during-early_prink.patch deleted file mode 100644 index 5826d0176..000000000 --- a/target/linux/ath79/patches-4.14/0015-MIPS-ath79-enable-uart-during-early_prink.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b14f8260724abec6c82970085dece6a143d3a0db Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 5 Mar 2018 11:38:21 +0100 -Subject: [PATCH 15/27] MIPS: ath79: enable uart during early_prink - -Signed-off-by: Gabor Juhos ---- - arch/mips/ath79/early_printk.c | 44 +++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 43 insertions(+), 1 deletion(-) - ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -58,6 +58,46 @@ static void prom_putchar_dummy(unsigned - /* nothing to do */ - } - -+static void prom_enable_uart(u32 id) -+{ -+ void __iomem *gpio_base; -+ u32 uart_en; -+ u32 t; -+ -+ switch (id) { -+ case REV_ID_MAJOR_AR71XX: -+ uart_en = AR71XX_GPIO_FUNC_UART_EN; -+ break; -+ -+ case REV_ID_MAJOR_AR7240: -+ case REV_ID_MAJOR_AR7241: -+ case REV_ID_MAJOR_AR7242: -+ uart_en = AR724X_GPIO_FUNC_UART_EN; -+ break; -+ -+ case REV_ID_MAJOR_AR913X: -+ uart_en = AR913X_GPIO_FUNC_UART_EN; -+ break; -+ -+ case REV_ID_MAJOR_AR9330: -+ case REV_ID_MAJOR_AR9331: -+ uart_en = AR933X_GPIO_FUNC_UART_EN; -+ break; -+ -+ case REV_ID_MAJOR_AR9341: -+ case REV_ID_MAJOR_AR9342: -+ case REV_ID_MAJOR_AR9344: -+ /* TODO */ -+ default: -+ return; -+ } -+ -+ gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE)); -+ t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC); -+ t |= uart_en; -+ __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC); -+} -+ - static void prom_putchar_init(void) - { - void __iomem *base; -@@ -88,8 +128,10 @@ static void prom_putchar_init(void) - - default: - _prom_putchar = prom_putchar_dummy; -- break; -+ return; - } -+ -+ prom_enable_uart(id); - } - - void prom_putchar(unsigned char ch) diff --git a/target/linux/ath79/patches-4.14/0016-MIPS-ath79-add-support-for-QCA953x-SoC.patch b/target/linux/ath79/patches-4.14/0016-MIPS-ath79-add-support-for-QCA953x-SoC.patch deleted file mode 100644 index 0432a23d1..000000000 --- a/target/linux/ath79/patches-4.14/0016-MIPS-ath79-add-support-for-QCA953x-SoC.patch +++ /dev/null @@ -1,331 +0,0 @@ -From cff23ba486e3c5d17c4d7e446f5eddead855c101 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 08:45:55 +0100 -Subject: [PATCH 16/27] MIPS: ath79: add support for QCA953x SoC - -Note that the clock calculation looks very similar to the QCA955x, but the -meaning of the bits CPUCLK_FROM_CPUPLL and DDRCLK_FROM_DDRPLL is reversed. - -Signed-off-by: Matthias Schiffer ---- - arch/mips/ath79/Kconfig | 6 ++- - arch/mips/ath79/clock.c | 87 ++++++++++++++++++++++++++++++++ - arch/mips/ath79/common.c | 4 ++ - arch/mips/ath79/dev-common.c | 4 ++ - arch/mips/ath79/early_printk.c | 2 + - arch/mips/ath79/irq.c | 33 +++++++++++- - arch/mips/ath79/setup.c | 21 ++++++-- - arch/mips/include/asm/mach-ath79/ath79.h | 11 ++++ - 8 files changed, 162 insertions(+), 6 deletions(-) - ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -94,6 +94,10 @@ config SOC_AR934X - select PCI_AR724X if PCI - def_bool n - -+config SOC_QCA953X -+ select USB_ARCH_HAS_EHCI -+ def_bool n -+ - config SOC_QCA955X - select HW_HAS_PCI - select PCI_AR724X if PCI -@@ -115,7 +119,7 @@ config ATH79_DEV_USB - def_bool n - - config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) -+ depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X) - def_bool n - - endif ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -355,6 +355,91 @@ static void __init ar934x_clocks_init(vo - iounmap(dpll_base); - } - -+static void __init qca953x_clocks_init(void) -+{ -+ unsigned long ref_rate; -+ unsigned long cpu_rate; -+ unsigned long ddr_rate; -+ unsigned long ahb_rate; -+ u32 pll, out_div, ref_div, nint, frac, clk_ctrl, postdiv; -+ u32 cpu_pll, ddr_pll; -+ u32 bootstrap; -+ -+ bootstrap = ath79_reset_rr(QCA953X_RESET_REG_BOOTSTRAP); -+ if (bootstrap & QCA953X_BOOTSTRAP_REF_CLK_40) -+ ref_rate = 40 * 1000 * 1000; -+ else -+ ref_rate = 25 * 1000 * 1000; -+ -+ pll = ath79_pll_rr(QCA953X_PLL_CPU_CONFIG_REG); -+ out_div = (pll >> QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_REFDIV_MASK; -+ nint = (pll >> QCA953X_PLL_CPU_CONFIG_NINT_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_NINT_MASK; -+ frac = (pll >> QCA953X_PLL_CPU_CONFIG_NFRAC_SHIFT) & -+ QCA953X_PLL_CPU_CONFIG_NFRAC_MASK; -+ -+ cpu_pll = nint * ref_rate / ref_div; -+ cpu_pll += frac * (ref_rate >> 6) / ref_div; -+ cpu_pll /= (1 << out_div); -+ -+ pll = ath79_pll_rr(QCA953X_PLL_DDR_CONFIG_REG); -+ out_div = (pll >> QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_REFDIV_MASK; -+ nint = (pll >> QCA953X_PLL_DDR_CONFIG_NINT_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_NINT_MASK; -+ frac = (pll >> QCA953X_PLL_DDR_CONFIG_NFRAC_SHIFT) & -+ QCA953X_PLL_DDR_CONFIG_NFRAC_MASK; -+ -+ ddr_pll = nint * ref_rate / ref_div; -+ ddr_pll += frac * (ref_rate >> 6) / (ref_div << 4); -+ ddr_pll /= (1 << out_div); -+ -+ clk_ctrl = ath79_pll_rr(QCA953X_PLL_CLK_CTRL_REG); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_CPU_PLL_BYPASS) -+ cpu_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_CPUCLK_FROM_CPUPLL) -+ cpu_rate = cpu_pll / (postdiv + 1); -+ else -+ cpu_rate = ddr_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_DDR_PLL_BYPASS) -+ ddr_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL) -+ ddr_rate = ddr_pll / (postdiv + 1); -+ else -+ ddr_rate = cpu_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & -+ QCA953X_PLL_CLK_CTRL_AHB_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA953X_PLL_CLK_CTRL_AHB_PLL_BYPASS) -+ ahb_rate = ref_rate; -+ else if (clk_ctrl & QCA953X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL) -+ ahb_rate = ddr_pll / (postdiv + 1); -+ else -+ ahb_rate = cpu_pll / (postdiv + 1); -+ -+ ath79_add_sys_clkdev("ref", ref_rate); -+ ath79_add_sys_clkdev("cpu", cpu_rate); -+ ath79_add_sys_clkdev("ddr", ddr_rate); -+ ath79_add_sys_clkdev("ahb", ahb_rate); -+ -+ clk_add_alias("wdt", NULL, "ref", NULL); -+ clk_add_alias("uart", NULL, "ref", NULL); -+} -+ - static void __init qca955x_clocks_init(void) - { - unsigned long ref_rate; -@@ -450,6 +535,8 @@ void __init ath79_clocks_init(void) - ar933x_clocks_init(); - else if (soc_is_ar934x()) - ar934x_clocks_init(); -+ else if (soc_is_qca953x()) -+ qca953x_clocks_init(); - else if (soc_is_qca955x()) - qca955x_clocks_init(); - else ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -103,6 +103,8 @@ void ath79_device_reset_set(u32 mask) - reg = AR933X_RESET_REG_RESET_MODULE; - else if (soc_is_ar934x()) - reg = AR934X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca953x()) -+ reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else -@@ -131,6 +133,8 @@ void ath79_device_reset_clear(u32 mask) - reg = AR933X_RESET_REG_RESET_MODULE; - else if (soc_is_ar934x()) - reg = AR934X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca953x()) -+ reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; - else ---- a/arch/mips/ath79/dev-common.c -+++ b/arch/mips/ath79/dev-common.c -@@ -85,6 +85,7 @@ void __init ath79_register_uart(void) - soc_is_ar724x() || - soc_is_ar913x() || - soc_is_ar934x() || -+ soc_is_qca953x() || - soc_is_qca955x()) { - ath79_uart_data[0].uartclk = uart_clk_rate; - platform_device_register(&ath79_uart_device); -@@ -148,6 +149,9 @@ void __init ath79_gpio_init(void) - } else if (soc_is_ar934x()) { - ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; -+ } else if (soc_is_qca953x()) { -+ ath79_gpio_pdata.ngpios = QCA953X_GPIO_COUNT; -+ ath79_gpio_pdata.oe_inverted = 1; - } else if (soc_is_qca955x()) { - ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -116,6 +116,8 @@ static void prom_putchar_init(void) - case REV_ID_MAJOR_AR9341: - case REV_ID_MAJOR_AR9342: - case REV_ID_MAJOR_AR9344: -+ case REV_ID_MAJOR_QCA9533: -+ case REV_ID_MAJOR_QCA9533_V2: - case REV_ID_MAJOR_QCA9556: - case REV_ID_MAJOR_QCA9558: - _prom_putchar = prom_putchar_ar71xx; ---- a/arch/mips/ath79/irq.c -+++ b/arch/mips/ath79/irq.c -@@ -56,6 +56,34 @@ static void ar934x_ip2_irq_init(void) - irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch); - } - -+static void qca953x_ip2_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS); -+ -+ if (status & QCA953X_PCIE_WMAC_INT_PCIE_ALL) { -+ ath79_ddr_wb_flush(3); -+ generic_handle_irq(ATH79_IP2_IRQ(0)); -+ } else if (status & QCA953X_PCIE_WMAC_INT_WMAC_ALL) { -+ ath79_ddr_wb_flush(4); -+ generic_handle_irq(ATH79_IP2_IRQ(1)); -+ } else { -+ spurious_interrupt(); -+ } -+} -+ -+static void qca953x_irq_init(void) -+{ -+ int i; -+ -+ for (i = ATH79_IP2_IRQ_BASE; -+ i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch); -+} -+ - static void qca955x_ip2_irq_dispatch(struct irq_desc *desc) - { - u32 status; -@@ -143,7 +171,7 @@ void __init arch_init_irq(void) - soc_is_ar913x() || soc_is_ar933x()) { - irq_wb_chan2 = 3; - irq_wb_chan3 = 2; -- } else if (soc_is_ar934x()) { -+ } else if (soc_is_ar934x() || soc_is_qca953x()) { - irq_wb_chan3 = 2; - } - -@@ -154,6 +182,7 @@ void __init arch_init_irq(void) - else if (soc_is_ar724x() || - soc_is_ar933x() || - soc_is_ar934x() || -+ soc_is_qca953x() || - soc_is_qca955x()) - misc_is_ar71xx = false; - else -@@ -164,6 +193,8 @@ void __init arch_init_irq(void) - - if (soc_is_ar934x()) - ar934x_ip2_irq_init(); -+ else if (soc_is_qca953x()) -+ qca953x_irq_init(); - else if (soc_is_qca955x()) - qca955x_irq_init(); - } ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -60,6 +60,7 @@ static void __init ath79_detect_sys_type - u32 major; - u32 minor; - u32 rev = 0; -+ u32 ver = 1; - - id = ath79_reset_rr(AR71XX_RESET_REG_REV_ID); - major = id & REV_ID_MAJOR_MASK; -@@ -152,6 +153,17 @@ static void __init ath79_detect_sys_type - rev = id & AR934X_REV_ID_REVISION_MASK; - break; - -+ case REV_ID_MAJOR_QCA9533_V2: -+ ver = 2; -+ ath79_soc_rev = 2; -+ /* drop through */ -+ -+ case REV_ID_MAJOR_QCA9533: -+ ath79_soc = ATH79_SOC_QCA9533; -+ chip = "9533"; -+ rev = id & QCA953X_REV_ID_REVISION_MASK; -+ break; -+ - case REV_ID_MAJOR_QCA9556: - ath79_soc = ATH79_SOC_QCA9556; - chip = "9556"; -@@ -168,11 +180,12 @@ static void __init ath79_detect_sys_type - panic("ath79: unknown SoC, id:0x%08x", id); - } - -- ath79_soc_rev = rev; -+ if (ver == 1) -+ ath79_soc_rev = rev; - -- if (soc_is_qca955x()) -- sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s rev %u", -- chip, rev); -+ if (soc_is_qca953x() || soc_is_qca955x()) -+ sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", -+ chip, ver, rev); - else - sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev); - pr_info("SoC: %s\n", ath79_sys_type); ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -32,6 +32,7 @@ enum ath79_soc_type { - ATH79_SOC_AR9341, - ATH79_SOC_AR9342, - ATH79_SOC_AR9344, -+ ATH79_SOC_QCA9533, - ATH79_SOC_QCA9556, - ATH79_SOC_QCA9558, - }; -@@ -100,6 +101,16 @@ static inline int soc_is_ar934x(void) - return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344(); - } - -+static inline int soc_is_qca9533(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA9533; -+} -+ -+static inline int soc_is_qca953x(void) -+{ -+ return soc_is_qca9533(); -+} -+ - static inline int soc_is_qca9556(void) - { - return ath79_soc == ATH79_SOC_QCA9556; diff --git a/target/linux/ath79/patches-4.14/0017-MIPS-ath79-add-support-for-qca956x-soc.patch b/target/linux/ath79/patches-4.14/0017-MIPS-ath79-add-support-for-qca956x-soc.patch deleted file mode 100644 index 294fb32a1..000000000 --- a/target/linux/ath79/patches-4.14/0017-MIPS-ath79-add-support-for-qca956x-soc.patch +++ /dev/null @@ -1,410 +0,0 @@ -From 6aeb24b9508bbe91f89cd4eb21d0d7582d971146 Mon Sep 17 00:00:00 2001 -From: Weijie Gao -Date: Tue, 6 Mar 2018 08:48:31 +0100 -Subject: [PATCH 17/27] MIPS: ath79: add support for qca956x soc - -This patch adds soc support for QCA9561 and TP9343. -TP9343 is a reduced version of QCA9561, which can be found in TP-LINK routers in China. -The qca956x_wmac has not yet been supported by ath9k. - -tested on TL-WDR6500 and TL-WR882N v1 (Chinese version) - -Signed-off-by: Weijie Gao ---- - arch/mips/ath79/Kconfig | 2 +- - arch/mips/ath79/clock.c | 96 ++++++++++++++++++++++++++++++++ - arch/mips/ath79/common.c | 4 ++ - arch/mips/ath79/dev-common.c | 7 ++- - arch/mips/ath79/early_printk.c | 2 + - arch/mips/ath79/irq.c | 87 ++++++++++++++++++++++++++++- - arch/mips/ath79/pci.c | 12 ++++ - arch/mips/ath79/setup.c | 17 +++++- - arch/mips/include/asm/mach-ath79/ath79.h | 22 ++++++++ - 9 files changed, 245 insertions(+), 4 deletions(-) - ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -119,7 +119,7 @@ config ATH79_DEV_USB - def_bool n - - config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X) -+ depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X || SOC_QCA956X) - def_bool n - - endif ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -525,6 +525,100 @@ static void __init qca955x_clocks_init(v - clk_add_alias("uart", NULL, "ref", NULL); - } - -+static void __init qca956x_clocks_init(void) -+{ -+ unsigned long ref_rate; -+ unsigned long cpu_rate; -+ unsigned long ddr_rate; -+ unsigned long ahb_rate; -+ u32 pll, out_div, ref_div, nint, hfrac, lfrac, clk_ctrl, postdiv; -+ u32 cpu_pll, ddr_pll; -+ u32 bootstrap; -+ -+ bootstrap = ath79_reset_rr(QCA956X_RESET_REG_BOOTSTRAP); -+ if (bootstrap & QCA956X_BOOTSTRAP_REF_CLK_40) -+ ref_rate = 40 * 1000 * 1000; -+ else -+ ref_rate = 25 * 1000 * 1000; -+ -+ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG_REG); -+ out_div = (pll >> QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG_REFDIV_MASK; -+ -+ pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG1_REG); -+ nint = (pll >> QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NINT_MASK; -+ hfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK; -+ lfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT) & -+ QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK; -+ -+ cpu_pll = nint * ref_rate / ref_div; -+ cpu_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); -+ cpu_pll += (hfrac >> 13) * ref_rate / ref_div; -+ cpu_pll /= (1 << out_div); -+ -+ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG_REG); -+ out_div = (pll >> QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK; -+ ref_div = (pll >> QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG_REFDIV_MASK; -+ pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG1_REG); -+ nint = (pll >> QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NINT_MASK; -+ hfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK; -+ lfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT) & -+ QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK; -+ -+ ddr_pll = nint * ref_rate / ref_div; -+ ddr_pll += (lfrac * ref_rate) / ((ref_div * 25) << 13); -+ ddr_pll += (hfrac >> 13) * ref_rate / ref_div; -+ ddr_pll /= (1 << out_div); -+ -+ clk_ctrl = ath79_pll_rr(QCA956X_PLL_CLK_CTRL_REG); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_PLL_BYPASS) -+ cpu_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL) -+ cpu_rate = ddr_pll / (postdiv + 1); -+ else -+ cpu_rate = cpu_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_DDR_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_DDR_PLL_BYPASS) -+ ddr_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_DDRPLL) -+ ddr_rate = cpu_pll / (postdiv + 1); -+ else -+ ddr_rate = ddr_pll / (postdiv + 1); -+ -+ postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_SHIFT) & -+ QCA956X_PLL_CLK_CTRL_AHB_POST_DIV_MASK; -+ -+ if (clk_ctrl & QCA956X_PLL_CLK_CTRL_AHB_PLL_BYPASS) -+ ahb_rate = ref_rate; -+ else if (clk_ctrl & QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL) -+ ahb_rate = ddr_pll / (postdiv + 1); -+ else -+ ahb_rate = cpu_pll / (postdiv + 1); -+ -+ ath79_add_sys_clkdev("ref", ref_rate); -+ ath79_add_sys_clkdev("cpu", cpu_rate); -+ ath79_add_sys_clkdev("ddr", ddr_rate); -+ ath79_add_sys_clkdev("ahb", ahb_rate); -+ -+ clk_add_alias("wdt", NULL, "ref", NULL); -+ clk_add_alias("uart", NULL, "ref", NULL); -+} -+ - void __init ath79_clocks_init(void) - { - if (soc_is_ar71xx()) -@@ -539,6 +633,8 @@ void __init ath79_clocks_init(void) - qca953x_clocks_init(); - else if (soc_is_qca955x()) - qca955x_clocks_init(); -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ qca956x_clocks_init(); - else - BUG(); - } ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -107,6 +107,8 @@ void ath79_device_reset_set(u32 mask) - reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ reg = QCA956X_RESET_REG_RESET_MODULE; - else - panic("Reset register not defined for this SOC"); - -@@ -137,6 +139,8 @@ void ath79_device_reset_clear(u32 mask) - reg = QCA953X_RESET_REG_RESET_MODULE; - else if (soc_is_qca955x()) - reg = QCA955X_RESET_REG_RESET_MODULE; -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ reg = QCA956X_RESET_REG_RESET_MODULE; - else - panic("Reset register not defined for this SOC"); - ---- a/arch/mips/ath79/dev-common.c -+++ b/arch/mips/ath79/dev-common.c -@@ -86,7 +86,9 @@ void __init ath79_register_uart(void) - soc_is_ar913x() || - soc_is_ar934x() || - soc_is_qca953x() || -- soc_is_qca955x()) { -+ soc_is_qca955x() || -+ soc_is_qca956x() || -+ soc_is_tp9343()) { - ath79_uart_data[0].uartclk = uart_clk_rate; - platform_device_register(&ath79_uart_device); - } else if (soc_is_ar933x()) { -@@ -155,6 +157,9 @@ void __init ath79_gpio_init(void) - } else if (soc_is_qca955x()) { - ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; - ath79_gpio_pdata.oe_inverted = 1; -+ } else if (soc_is_qca956x() || soc_is_tp9343()) { -+ ath79_gpio_pdata.ngpios = QCA956X_GPIO_COUNT; -+ ath79_gpio_pdata.oe_inverted = 1; - } else { - BUG(); - } ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -120,6 +120,8 @@ static void prom_putchar_init(void) - case REV_ID_MAJOR_QCA9533_V2: - case REV_ID_MAJOR_QCA9556: - case REV_ID_MAJOR_QCA9558: -+ case REV_ID_MAJOR_TP9343: -+ case REV_ID_MAJOR_QCA956X: - _prom_putchar = prom_putchar_ar71xx; - break; - ---- a/arch/mips/ath79/irq.c -+++ b/arch/mips/ath79/irq.c -@@ -156,6 +156,87 @@ static void qca955x_irq_init(void) - irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); - } - -+static void qca956x_ip2_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -+ status &= QCA956X_EXT_INT_PCIE_RC1_ALL | QCA956X_EXT_INT_WMAC_ALL; -+ -+ if (status == 0) { -+ spurious_interrupt(); -+ return; -+ } -+ -+ if (status & QCA956X_EXT_INT_PCIE_RC1_ALL) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP2_IRQ(0)); -+ } -+ -+ if (status & QCA956X_EXT_INT_WMAC_ALL) { -+ /* TODO: flsuh DDR? */ -+ generic_handle_irq(ATH79_IP2_IRQ(1)); -+ } -+} -+ -+static void qca956x_ip3_irq_dispatch(struct irq_desc *desc) -+{ -+ u32 status; -+ -+ status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -+ status &= QCA956X_EXT_INT_PCIE_RC2_ALL | -+ QCA956X_EXT_INT_USB1 | QCA956X_EXT_INT_USB2; -+ -+ if (status == 0) { -+ spurious_interrupt(); -+ return; -+ } -+ -+ if (status & QCA956X_EXT_INT_USB1) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(0)); -+ } -+ -+ if (status & QCA956X_EXT_INT_USB2) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(1)); -+ } -+ -+ if (status & QCA956X_EXT_INT_PCIE_RC2_ALL) { -+ /* TODO: flush DDR? */ -+ generic_handle_irq(ATH79_IP3_IRQ(2)); -+ } -+} -+ -+static void qca956x_enable_timer_cb(void) { -+ u32 misc; -+ -+ misc = ath79_reset_rr(AR71XX_RESET_REG_MISC_INT_ENABLE); -+ misc |= MISC_INT_MIPS_SI_TIMERINT_MASK; -+ ath79_reset_wr(AR71XX_RESET_REG_MISC_INT_ENABLE, misc); -+} -+ -+static void qca956x_irq_init(void) -+{ -+ int i; -+ -+ for (i = ATH79_IP2_IRQ_BASE; -+ i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch); -+ -+ for (i = ATH79_IP3_IRQ_BASE; -+ i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++) -+ irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -+ -+ irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch); -+ -+ /* QCA956x timer init workaround has to be applied right before setting -+ * up the clock. Else, there will be no jiffies */ -+ late_time_init = &qca956x_enable_timer_cb; -+} -+ - void __init arch_init_irq(void) - { - unsigned irq_wb_chan2 = -1; -@@ -183,7 +264,9 @@ void __init arch_init_irq(void) - soc_is_ar933x() || - soc_is_ar934x() || - soc_is_qca953x() || -- soc_is_qca955x()) -+ soc_is_qca955x() || -+ soc_is_qca956x() || -+ soc_is_tp9343()) - misc_is_ar71xx = false; - else - BUG(); -@@ -197,4 +280,6 @@ void __init arch_init_irq(void) - qca953x_irq_init(); - else if (soc_is_qca955x()) - qca955x_irq_init(); -+ else if (soc_is_qca956x() || soc_is_tp9343()) -+ qca956x_irq_init(); - } ---- a/arch/mips/ath79/pci.c -+++ b/arch/mips/ath79/pci.c -@@ -82,6 +82,9 @@ int pcibios_map_irq(const struct pci_dev - } else if (soc_is_qca955x()) { - ath79_pci_irq_map = qca955x_pci_irq_map; - ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map); -+ } else if (soc_is_qca956x()) { -+ ath79_pci_irq_map = qca956x_pci_irq_map; -+ ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map); - } else { - pr_crit("pci %s: invalid irq map\n", - pci_name((struct pci_dev *) dev)); -@@ -261,6 +264,15 @@ int __init ath79_register_pci(void) - QCA955X_PCI_MEM_SIZE, - 1, - ATH79_IP3_IRQ(2)); -+ } else if (soc_is_qca956x()) { -+ pdev = ath79_register_pci_ar724x(0, -+ QCA956X_PCI_CFG_BASE1, -+ QCA956X_PCI_CTRL_BASE1, -+ QCA956X_PCI_CRP_BASE1, -+ QCA956X_PCI_MEM_BASE1, -+ QCA956X_PCI_MEM_SIZE, -+ 1, -+ ATH79_IP3_IRQ(2)); - } else { - /* No PCI support */ - return -ENODEV; ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -176,6 +176,18 @@ static void __init ath79_detect_sys_type - rev = id & QCA955X_REV_ID_REVISION_MASK; - break; - -+ case REV_ID_MAJOR_QCA956X: -+ ath79_soc = ATH79_SOC_QCA956X; -+ chip = "956X"; -+ rev = id & QCA956X_REV_ID_REVISION_MASK; -+ break; -+ -+ case REV_ID_MAJOR_TP9343: -+ ath79_soc = ATH79_SOC_TP9343; -+ chip = "9343"; -+ rev = id & QCA956X_REV_ID_REVISION_MASK; -+ break; -+ - default: - panic("ath79: unknown SoC, id:0x%08x", id); - } -@@ -183,9 +195,12 @@ static void __init ath79_detect_sys_type - if (ver == 1) - ath79_soc_rev = rev; - -- if (soc_is_qca953x() || soc_is_qca955x()) -+ if (soc_is_qca953x() || soc_is_qca955x() || soc_is_qca956x()) - sprintf(ath79_sys_type, "Qualcomm Atheros QCA%s ver %u rev %u", - chip, ver, rev); -+ else if (soc_is_tp9343()) -+ sprintf(ath79_sys_type, "Qualcomm Atheros TP%s rev %u", -+ chip, rev); - else - sprintf(ath79_sys_type, "Atheros AR%s rev %u", chip, rev); - pr_info("SoC: %s\n", ath79_sys_type); ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -35,6 +35,8 @@ enum ath79_soc_type { - ATH79_SOC_QCA9533, - ATH79_SOC_QCA9556, - ATH79_SOC_QCA9558, -+ ATH79_SOC_TP9343, -+ ATH79_SOC_QCA956X, - }; - - extern enum ath79_soc_type ath79_soc; -@@ -126,6 +128,26 @@ static inline int soc_is_qca955x(void) - return soc_is_qca9556() || soc_is_qca9558(); - } - -+static inline int soc_is_tp9343(void) -+{ -+ return ath79_soc == ATH79_SOC_TP9343; -+} -+ -+static inline int soc_is_qca9561(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA956X; -+} -+ -+static inline int soc_is_qca9563(void) -+{ -+ return ath79_soc == ATH79_SOC_QCA956X; -+} -+ -+static inline int soc_is_qca956x(void) -+{ -+ return soc_is_qca9561() || soc_is_qca9563(); -+} -+ - void ath79_ddr_wb_flush(unsigned int reg); - void ath79_ddr_set_pci_windows(void); - diff --git a/target/linux/ath79/patches-4.14/0019-MIPS-ath79-get-PCIe-controller-out-of-reset.patch b/target/linux/ath79/patches-4.14/0019-MIPS-ath79-get-PCIe-controller-out-of-reset.patch deleted file mode 100644 index f435e9bc1..000000000 --- a/target/linux/ath79/patches-4.14/0019-MIPS-ath79-get-PCIe-controller-out-of-reset.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 308c2ef9c4f1be2e1cee699042671eb973b51803 Mon Sep 17 00:00:00 2001 -From: Mathias Kresin -Date: Tue, 6 Mar 2018 08:37:43 +0100 -Subject: [PATCH 19/27] MIPS: ath79: get PCIe controller out of reset - -The ar724x pci driver expects the PCIe controller to be brought out of -reset by the bootloader. - -At least the AVM Fritz 300E bootloader doesn't take care of releasing -the different PCIe controller related resets which causes an endless -hang as soon as either the PCIE Reset register (0x180f0018) or the PCI -Application Control register (0x180f0000) is read from. - -Do the full "PCIE Root Complex Initialization Sequence" if the PCIe -host controller is still in reset during probing. - -The QCA u-boot sleeps 10ms after the PCIE Application Control bit is -set to ready. It has been shown that 10ms might not be enough time if -PCIe should be used right after setting the bit. During my tests it -took up to 20ms till the link was up. Giving the link up to 100ms -should work for all cases. - -Signed-off-by: Mathias Kresin ---- - arch/mips/pci/pci-ar724x.c | 42 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - ---- a/arch/mips/pci/pci-ar724x.c -+++ b/arch/mips/pci/pci-ar724x.c -@@ -12,14 +12,18 @@ - #include - #include - #include -+#include - #include - #include - #include - -+#define AR724X_PCI_REG_APP 0x00 - #define AR724X_PCI_REG_RESET 0x18 - #define AR724X_PCI_REG_INT_STATUS 0x4c - #define AR724X_PCI_REG_INT_MASK 0x50 - -+#define AR724X_PCI_APP_LTSSM_ENABLE BIT(0) -+ - #define AR724X_PCI_RESET_LINK_UP BIT(0) - - #define AR724X_PCI_INT_DEV0 BIT(14) -@@ -325,6 +329,37 @@ static void ar724x_pci_irq_init(struct a - apc); - } - -+static void ar724x_pci_hw_init(struct ar724x_pci_controller *apc) -+{ -+ u32 ppl, app; -+ int wait = 0; -+ -+ /* deassert PCIe host controller and PCIe PHY reset */ -+ ath79_device_reset_clear(AR724X_RESET_PCIE); -+ ath79_device_reset_clear(AR724X_RESET_PCIE_PHY); -+ -+ /* remove the reset of the PCIE PLL */ -+ ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); -+ ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET; -+ ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); -+ -+ /* deassert bypass for the PCIE PLL */ -+ ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); -+ ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS; -+ ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); -+ -+ /* set PCIE Application Control to ready */ -+ app = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_APP); -+ app |= AR724X_PCI_APP_LTSSM_ENABLE; -+ __raw_writel(app, apc->ctrl_base + AR724X_PCI_REG_APP); -+ -+ /* wait up to 100ms for PHY link up */ -+ do { -+ mdelay(10); -+ wait++; -+ } while (wait < 10 && !ar724x_pci_check_link(apc)); -+} -+ - static int ar724x_pci_probe(struct platform_device *pdev) - { - struct ar724x_pci_controller *apc; -@@ -383,6 +418,13 @@ static int ar724x_pci_probe(struct platf - apc->pci_controller.io_resource = &apc->io_res; - apc->pci_controller.mem_resource = &apc->mem_res; - -+ /* -+ * Do the full PCIE Root Complex Initialization Sequence if the PCIe -+ * host controller is in reset. -+ */ -+ if (ath79_reset_rr(AR724X_RESET_REG_RESET_MODULE) & AR724X_RESET_PCIE) -+ ar724x_pci_hw_init(apc); -+ - apc->link_up = ar724x_pci_check_link(apc); - if (!apc->link_up) - dev_warn(&pdev->dev, "PCIe link is down\n"); diff --git a/target/linux/ath79/patches-4.14/0020-MIPS-ath79-turn-pci-ar71xx-driver-into-a-pure-OF-dri.patch b/target/linux/ath79/patches-4.14/0020-MIPS-ath79-turn-pci-ar71xx-driver-into-a-pure-OF-dri.patch deleted file mode 100644 index 2d9ddf4a2..000000000 --- a/target/linux/ath79/patches-4.14/0020-MIPS-ath79-turn-pci-ar71xx-driver-into-a-pure-OF-dri.patch +++ /dev/null @@ -1,197 +0,0 @@ -From cc5a306038b7956b5736a70696dddaaf3792df76 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:22:49 +0100 -Subject: [PATCH 20/27] MIPS: ath79: turn pci-ar71xx driver into a pure OF - driver - -Signed-off-by: John Crispin ---- - arch/mips/pci/pci-ar71xx.c | 81 +++++++++++++++++++++++----------------------- - 1 file changed, 40 insertions(+), 41 deletions(-) - ---- a/arch/mips/pci/pci-ar71xx.c -+++ b/arch/mips/pci/pci-ar71xx.c -@@ -18,8 +18,11 @@ - #include - #include - #include -+#include - #include - #include -+#include -+#include - - #include - #include -@@ -49,12 +52,13 @@ - #define AR71XX_PCI_IRQ_COUNT 5 - - struct ar71xx_pci_controller { -+ struct device_node *np; - void __iomem *cfg_base; - int irq; -- int irq_base; - struct pci_controller pci_ctrl; - struct resource io_res; - struct resource mem_res; -+ struct irq_domain *domain; - }; - - /* Byte lane enable bits */ -@@ -228,29 +232,30 @@ static struct pci_ops ar71xx_pci_ops = { - - static void ar71xx_pci_irq_handler(struct irq_desc *desc) - { -- struct ar71xx_pci_controller *apc; - void __iomem *base = ath79_reset_base; -+ struct irq_chip *chip = irq_desc_get_chip(desc); -+ struct ar71xx_pci_controller *apc = irq_desc_get_handler_data(desc); - u32 pending; - -- apc = irq_desc_get_handler_data(desc); -- -+ chained_irq_enter(chip, desc); - pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & - __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); - - if (pending & AR71XX_PCI_INT_DEV0) -- generic_handle_irq(apc->irq_base + 0); -+ generic_handle_irq(irq_linear_revmap(apc->domain, 1)); - - else if (pending & AR71XX_PCI_INT_DEV1) -- generic_handle_irq(apc->irq_base + 1); -+ generic_handle_irq(irq_linear_revmap(apc->domain, 2)); - - else if (pending & AR71XX_PCI_INT_DEV2) -- generic_handle_irq(apc->irq_base + 2); -+ generic_handle_irq(irq_linear_revmap(apc->domain, 3)); - - else if (pending & AR71XX_PCI_INT_CORE) -- generic_handle_irq(apc->irq_base + 4); -+ generic_handle_irq(irq_linear_revmap(apc->domain, 4)); - - else - spurious_interrupt(); -+ chained_irq_exit(chip, desc); - } - - static void ar71xx_pci_irq_unmask(struct irq_data *d) -@@ -261,7 +266,7 @@ static void ar71xx_pci_irq_unmask(struct - u32 t; - - apc = irq_data_get_irq_chip_data(d); -- irq = d->irq - apc->irq_base; -+ irq = irq_linear_revmap(apc->domain, d->irq); - - t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); - __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); -@@ -278,7 +283,7 @@ static void ar71xx_pci_irq_mask(struct i - u32 t; - - apc = irq_data_get_irq_chip_data(d); -- irq = d->irq - apc->irq_base; -+ irq = irq_linear_revmap(apc->domain, d->irq); - - t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); - __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); -@@ -294,24 +299,30 @@ static struct irq_chip ar71xx_pci_irq_ch - .irq_mask_ack = ar71xx_pci_irq_mask, - }; - -+static int ar71xx_pci_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) -+{ -+ struct ar71xx_pci_controller *apc = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &ar71xx_pci_irq_chip, handle_level_irq); -+ irq_set_chip_data(irq, apc); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops ar71xx_pci_domain_ops = { -+ .xlate = irq_domain_xlate_onecell, -+ .map = ar71xx_pci_irq_map, -+}; -+ - static void ar71xx_pci_irq_init(struct ar71xx_pci_controller *apc) - { - void __iomem *base = ath79_reset_base; -- int i; - - __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_ENABLE); - __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_STATUS); - -- BUILD_BUG_ON(ATH79_PCI_IRQ_COUNT < AR71XX_PCI_IRQ_COUNT); -- -- apc->irq_base = ATH79_PCI_IRQ_BASE; -- for (i = apc->irq_base; -- i < apc->irq_base + AR71XX_PCI_IRQ_COUNT; i++) { -- irq_set_chip_and_handler(i, &ar71xx_pci_irq_chip, -- handle_level_irq); -- irq_set_chip_data(i, apc); -- } -- -+ apc->domain = irq_domain_add_linear(apc->np, AR71XX_PCI_IRQ_COUNT, -+ &ar71xx_pci_domain_ops, apc); - irq_set_chained_handler_and_data(apc->irq, ar71xx_pci_irq_handler, - apc); - } -@@ -328,6 +339,11 @@ static void ar71xx_pci_reset(void) - mdelay(100); - } - -+static const struct of_device_id ar71xx_pci_ids[] = { -+ { .compatible = "qca,ar7100-pci" }, -+ {}, -+}; -+ - static int ar71xx_pci_probe(struct platform_device *pdev) - { - struct ar71xx_pci_controller *apc; -@@ -348,26 +364,6 @@ static int ar71xx_pci_probe(struct platf - if (apc->irq < 0) - return -EINVAL; - -- res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); -- if (!res) -- return -EINVAL; -- -- apc->io_res.parent = res; -- apc->io_res.name = "PCI IO space"; -- apc->io_res.start = res->start; -- apc->io_res.end = res->end; -- apc->io_res.flags = IORESOURCE_IO; -- -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base"); -- if (!res) -- return -EINVAL; -- -- apc->mem_res.parent = res; -- apc->mem_res.name = "PCI memory space"; -- apc->mem_res.start = res->start; -- apc->mem_res.end = res->end; -- apc->mem_res.flags = IORESOURCE_MEM; -- - ar71xx_pci_reset(); - - /* setup COMMAND register */ -@@ -380,9 +376,11 @@ static int ar71xx_pci_probe(struct platf - - ar71xx_pci_irq_init(apc); - -+ apc->np = pdev->dev.of_node; - apc->pci_ctrl.pci_ops = &ar71xx_pci_ops; - apc->pci_ctrl.mem_resource = &apc->mem_res; - apc->pci_ctrl.io_resource = &apc->io_res; -+ pci_load_of_ranges(&apc->pci_ctrl, pdev->dev.of_node); - - register_pci_controller(&apc->pci_ctrl); - -@@ -393,6 +391,7 @@ static struct platform_driver ar71xx_pci - .probe = ar71xx_pci_probe, - .driver = { - .name = "ar71xx-pci", -+ .of_match_table = of_match_ptr(ar71xx_pci_ids), - }, - }; - diff --git a/target/linux/ath79/patches-4.14/0021-MIPS-ath79-turn-pci-ar724x-driver-into-a-pure-OF-dri.patch b/target/linux/ath79/patches-4.14/0021-MIPS-ath79-turn-pci-ar724x-driver-into-a-pure-OF-dri.patch deleted file mode 100644 index d5ebeb87a..000000000 --- a/target/linux/ath79/patches-4.14/0021-MIPS-ath79-turn-pci-ar724x-driver-into-a-pure-OF-dri.patch +++ /dev/null @@ -1,199 +0,0 @@ -From 0e7f36bfd68401e8c42933e7f770f270497bb9a8 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:23:25 +0100 -Subject: [PATCH 21/27] MIPS: ath79: turn pci-ar724x driver into a pure OF - driver - -Signed-off-by: John Crispin ---- - arch/mips/pci/pci-ar724x.c | 86 +++++++++++++++++++++------------------------- - 1 file changed, 40 insertions(+), 46 deletions(-) - ---- a/arch/mips/pci/pci-ar724x.c -+++ b/arch/mips/pci/pci-ar724x.c -@@ -14,8 +14,11 @@ - #include - #include - #include -+#include - #include - #include -+#include -+#include - - #define AR724X_PCI_REG_APP 0x00 - #define AR724X_PCI_REG_RESET 0x18 -@@ -45,17 +48,20 @@ struct ar724x_pci_controller { - void __iomem *crp_base; - - int irq; -- int irq_base; - - bool link_up; - bool bar0_is_cached; - u32 bar0_value; - -+ struct device_node *np; - struct pci_controller pci_controller; -+ struct irq_domain *domain; - struct resource io_res; - struct resource mem_res; - }; - -+static struct irq_chip ar724x_pci_irq_chip; -+ - static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc) - { - u32 reset; -@@ -231,35 +237,31 @@ static struct pci_ops ar724x_pci_ops = { - - static void ar724x_pci_irq_handler(struct irq_desc *desc) - { -- struct ar724x_pci_controller *apc; -- void __iomem *base; -+ struct irq_chip *chip = irq_desc_get_chip(desc); -+ struct ar724x_pci_controller *apc = irq_desc_get_handler_data(desc); - u32 pending; - -- apc = irq_desc_get_handler_data(desc); -- base = apc->ctrl_base; -- -- pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) & -- __raw_readl(base + AR724X_PCI_REG_INT_MASK); -+ chained_irq_enter(chip, desc); -+ pending = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_INT_STATUS) & -+ __raw_readl(apc->ctrl_base + AR724X_PCI_REG_INT_MASK); - - if (pending & AR724X_PCI_INT_DEV0) -- generic_handle_irq(apc->irq_base + 0); -- -+ generic_handle_irq(irq_linear_revmap(apc->domain, 1)); - else - spurious_interrupt(); -+ chained_irq_exit(chip, desc); - } - - static void ar724x_pci_irq_unmask(struct irq_data *d) - { - struct ar724x_pci_controller *apc; - void __iomem *base; -- int offset; - u32 t; - - apc = irq_data_get_irq_chip_data(d); - base = apc->ctrl_base; -- offset = apc->irq_base - d->irq; - -- switch (offset) { -+ switch (irq_linear_revmap(apc->domain, d->irq)) { - case 0: - t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); - __raw_writel(t | AR724X_PCI_INT_DEV0, -@@ -273,14 +275,12 @@ static void ar724x_pci_irq_mask(struct i - { - struct ar724x_pci_controller *apc; - void __iomem *base; -- int offset; - u32 t; - - apc = irq_data_get_irq_chip_data(d); - base = apc->ctrl_base; -- offset = apc->irq_base - d->irq; - -- switch (offset) { -+ switch (irq_linear_revmap(apc->domain, d->irq)) { - case 0: - t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); - __raw_writel(t & ~AR724X_PCI_INT_DEV0, -@@ -305,26 +305,32 @@ static struct irq_chip ar724x_pci_irq_ch - .irq_mask_ack = ar724x_pci_irq_mask, - }; - -+static int ar724x_pci_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) -+{ -+ struct ar724x_pci_controller *apc = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &ar724x_pci_irq_chip, handle_level_irq); -+ irq_set_chip_data(irq, apc); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops ar724x_pci_domain_ops = { -+ .xlate = irq_domain_xlate_onecell, -+ .map = ar724x_pci_irq_map, -+}; -+ - static void ar724x_pci_irq_init(struct ar724x_pci_controller *apc, - int id) - { - void __iomem *base; -- int i; - - base = apc->ctrl_base; - - __raw_writel(0, base + AR724X_PCI_REG_INT_MASK); - __raw_writel(0, base + AR724X_PCI_REG_INT_STATUS); - -- apc->irq_base = ATH79_PCI_IRQ_BASE + (id * AR724X_PCI_IRQ_COUNT); -- -- for (i = apc->irq_base; -- i < apc->irq_base + AR724X_PCI_IRQ_COUNT; i++) { -- irq_set_chip_and_handler(i, &ar724x_pci_irq_chip, -- handle_level_irq); -- irq_set_chip_data(i, apc); -- } -- -+ apc->domain = irq_domain_add_linear(apc->np, 2, &ar724x_pci_domain_ops, apc); - irq_set_chained_handler_and_data(apc->irq, ar724x_pci_irq_handler, - apc); - } -@@ -394,29 +400,11 @@ static int ar724x_pci_probe(struct platf - if (apc->irq < 0) - return -EINVAL; - -- res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); -- if (!res) -- return -EINVAL; -- -- apc->io_res.parent = res; -- apc->io_res.name = "PCI IO space"; -- apc->io_res.start = res->start; -- apc->io_res.end = res->end; -- apc->io_res.flags = IORESOURCE_IO; -- -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base"); -- if (!res) -- return -EINVAL; -- -- apc->mem_res.parent = res; -- apc->mem_res.name = "PCI memory space"; -- apc->mem_res.start = res->start; -- apc->mem_res.end = res->end; -- apc->mem_res.flags = IORESOURCE_MEM; -- -+ apc->np = pdev->dev.of_node; - apc->pci_controller.pci_ops = &ar724x_pci_ops; - apc->pci_controller.io_resource = &apc->io_res; - apc->pci_controller.mem_resource = &apc->mem_res; -+ pci_load_of_ranges(&apc->pci_controller, pdev->dev.of_node); - - /* - * Do the full PCIE Root Complex Initialization Sequence if the PCIe -@@ -438,10 +426,16 @@ static int ar724x_pci_probe(struct platf - return 0; - } - -+static const struct of_device_id ar724x_pci_ids[] = { -+ { .compatible = "qcom,ar7240-pci" }, -+ {}, -+}; -+ - static struct platform_driver ar724x_pci_driver = { - .probe = ar724x_pci_probe, - .driver = { - .name = "ar724x-pci", -+ .of_match_table = of_match_ptr(ar724x_pci_ids), - }, - }; - diff --git a/target/linux/ath79/patches-4.14/0022-MIPS-ath79-drop-pci.c.patch b/target/linux/ath79/patches-4.14/0022-MIPS-ath79-drop-pci.c.patch deleted file mode 100644 index 58ed122c6..000000000 --- a/target/linux/ath79/patches-4.14/0022-MIPS-ath79-drop-pci.c.patch +++ /dev/null @@ -1,350 +0,0 @@ -From f4128f3224df2309262ef8d1275d928717ebefd0 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:21:46 +0100 -Subject: [PATCH 22/27] MIPS: ath79: drop pci.c - -This patch drops pci.c fromt he ath79 folder and moves the the pcibios -callbacks to a new fixup file. - -Signed-off-by: John Crispin ---- - arch/mips/ath79/Makefile | 1 - - arch/mips/ath79/pci.c | 285 -------------------------------------------- - arch/mips/pci/Makefile | 1 + - arch/mips/pci/fixup-ath79.c | 21 ++++ - 4 files changed, 22 insertions(+), 286 deletions(-) - delete mode 100644 arch/mips/ath79/pci.c - create mode 100644 arch/mips/pci/fixup-ath79.c - ---- a/arch/mips/ath79/Makefile -+++ b/arch/mips/ath79/Makefile -@@ -11,7 +11,6 @@ - obj-y := prom.o setup.o irq.o common.o clock.o - - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o --obj-$(CONFIG_PCI) += pci.o - - # - # Devices ---- a/arch/mips/ath79/pci.c -+++ /dev/null -@@ -1,285 +0,0 @@ --/* -- * Atheros AR71XX/AR724X specific PCI setup code -- * -- * Copyright (C) 2011 René Bolldorf -- * Copyright (C) 2008-2011 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * Parts of this file are based on Atheros' 2.6.15 BSP -- * -- * 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 "pci.h" -- --static int (*ath79_pci_plat_dev_init)(struct pci_dev *dev); --static const struct ath79_pci_irq *ath79_pci_irq_map; --static unsigned ath79_pci_nr_irqs; -- --static const struct ath79_pci_irq ar71xx_pci_irq_map[] = { -- { -- .slot = 17, -- .pin = 1, -- .irq = ATH79_PCI_IRQ(0), -- }, { -- .slot = 18, -- .pin = 1, -- .irq = ATH79_PCI_IRQ(1), -- }, { -- .slot = 19, -- .pin = 1, -- .irq = ATH79_PCI_IRQ(2), -- } --}; -- --static const struct ath79_pci_irq ar724x_pci_irq_map[] = { -- { -- .slot = 0, -- .pin = 1, -- .irq = ATH79_PCI_IRQ(0), -- } --}; -- --static const struct ath79_pci_irq qca955x_pci_irq_map[] = { -- { -- .bus = 0, -- .slot = 0, -- .pin = 1, -- .irq = ATH79_PCI_IRQ(0), -- }, -- { -- .bus = 1, -- .slot = 0, -- .pin = 1, -- .irq = ATH79_PCI_IRQ(1), -- }, --}; -- --int pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin) --{ -- int irq = -1; -- int i; -- -- if (ath79_pci_nr_irqs == 0 || -- ath79_pci_irq_map == NULL) { -- if (soc_is_ar71xx()) { -- ath79_pci_irq_map = ar71xx_pci_irq_map; -- ath79_pci_nr_irqs = ARRAY_SIZE(ar71xx_pci_irq_map); -- } else if (soc_is_ar724x() || -- soc_is_ar9342() || -- soc_is_ar9344()) { -- ath79_pci_irq_map = ar724x_pci_irq_map; -- ath79_pci_nr_irqs = ARRAY_SIZE(ar724x_pci_irq_map); -- } else if (soc_is_qca955x()) { -- ath79_pci_irq_map = qca955x_pci_irq_map; -- ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map); -- } else if (soc_is_qca956x()) { -- ath79_pci_irq_map = qca956x_pci_irq_map; -- ath79_pci_nr_irqs = ARRAY_SIZE(qca956x_pci_irq_map); -- } else { -- pr_crit("pci %s: invalid irq map\n", -- pci_name((struct pci_dev *) dev)); -- return irq; -- } -- } -- -- for (i = 0; i < ath79_pci_nr_irqs; i++) { -- const struct ath79_pci_irq *entry; -- -- entry = &ath79_pci_irq_map[i]; -- if (entry->bus == dev->bus->number && -- entry->slot == slot && -- entry->pin == pin) { -- irq = entry->irq; -- break; -- } -- } -- -- if (irq < 0) -- pr_crit("pci %s: no irq found for pin %u\n", -- pci_name((struct pci_dev *) dev), pin); -- else -- pr_info("pci %s: using irq %d for pin %u\n", -- pci_name((struct pci_dev *) dev), irq, pin); -- -- return irq; --} -- --int pcibios_plat_dev_init(struct pci_dev *dev) --{ -- if (ath79_pci_plat_dev_init) -- return ath79_pci_plat_dev_init(dev); -- -- return 0; --} -- --void __init ath79_pci_set_irq_map(unsigned nr_irqs, -- const struct ath79_pci_irq *map) --{ -- ath79_pci_nr_irqs = nr_irqs; -- ath79_pci_irq_map = map; --} -- --void __init ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *dev)) --{ -- ath79_pci_plat_dev_init = func; --} -- --static struct platform_device * --ath79_register_pci_ar71xx(void) --{ -- struct platform_device *pdev; -- struct resource res[4]; -- -- memset(res, 0, sizeof(res)); -- -- res[0].name = "cfg_base"; -- res[0].flags = IORESOURCE_MEM; -- res[0].start = AR71XX_PCI_CFG_BASE; -- res[0].end = AR71XX_PCI_CFG_BASE + AR71XX_PCI_CFG_SIZE - 1; -- -- res[1].flags = IORESOURCE_IRQ; -- res[1].start = ATH79_CPU_IRQ(2); -- res[1].end = ATH79_CPU_IRQ(2); -- -- res[2].name = "io_base"; -- res[2].flags = IORESOURCE_IO; -- res[2].start = 0; -- res[2].end = 0; -- -- res[3].name = "mem_base"; -- res[3].flags = IORESOURCE_MEM; -- res[3].start = AR71XX_PCI_MEM_BASE; -- res[3].end = AR71XX_PCI_MEM_BASE + AR71XX_PCI_MEM_SIZE - 1; -- -- pdev = platform_device_register_simple("ar71xx-pci", -1, -- res, ARRAY_SIZE(res)); -- return pdev; --} -- --static struct platform_device * --ath79_register_pci_ar724x(int id, -- unsigned long cfg_base, -- unsigned long ctrl_base, -- unsigned long crp_base, -- unsigned long mem_base, -- unsigned long mem_size, -- unsigned long io_base, -- int irq) --{ -- struct platform_device *pdev; -- struct resource res[6]; -- -- memset(res, 0, sizeof(res)); -- -- res[0].name = "cfg_base"; -- res[0].flags = IORESOURCE_MEM; -- res[0].start = cfg_base; -- res[0].end = cfg_base + AR724X_PCI_CFG_SIZE - 1; -- -- res[1].name = "ctrl_base"; -- res[1].flags = IORESOURCE_MEM; -- res[1].start = ctrl_base; -- res[1].end = ctrl_base + AR724X_PCI_CTRL_SIZE - 1; -- -- res[2].flags = IORESOURCE_IRQ; -- res[2].start = irq; -- res[2].end = irq; -- -- res[3].name = "mem_base"; -- res[3].flags = IORESOURCE_MEM; -- res[3].start = mem_base; -- res[3].end = mem_base + mem_size - 1; -- -- res[4].name = "io_base"; -- res[4].flags = IORESOURCE_IO; -- res[4].start = io_base; -- res[4].end = io_base; -- -- res[5].name = "crp_base"; -- res[5].flags = IORESOURCE_MEM; -- res[5].start = crp_base; -- res[5].end = crp_base + AR724X_PCI_CRP_SIZE - 1; -- -- pdev = platform_device_register_simple("ar724x-pci", id, -- res, ARRAY_SIZE(res)); -- return pdev; --} -- --int __init ath79_register_pci(void) --{ -- struct platform_device *pdev = NULL; -- -- if (soc_is_ar71xx()) { -- pdev = ath79_register_pci_ar71xx(); -- } else if (soc_is_ar724x()) { -- pdev = ath79_register_pci_ar724x(-1, -- AR724X_PCI_CFG_BASE, -- AR724X_PCI_CTRL_BASE, -- AR724X_PCI_CRP_BASE, -- AR724X_PCI_MEM_BASE, -- AR724X_PCI_MEM_SIZE, -- 0, -- ATH79_CPU_IRQ(2)); -- } else if (soc_is_ar9342() || -- soc_is_ar9344()) { -- u32 bootstrap; -- -- bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP); -- if ((bootstrap & AR934X_BOOTSTRAP_PCIE_RC) == 0) -- return -ENODEV; -- -- pdev = ath79_register_pci_ar724x(-1, -- AR724X_PCI_CFG_BASE, -- AR724X_PCI_CTRL_BASE, -- AR724X_PCI_CRP_BASE, -- AR724X_PCI_MEM_BASE, -- AR724X_PCI_MEM_SIZE, -- 0, -- ATH79_IP2_IRQ(0)); -- } else if (soc_is_qca9558()) { -- pdev = ath79_register_pci_ar724x(0, -- QCA955X_PCI_CFG_BASE0, -- QCA955X_PCI_CTRL_BASE0, -- QCA955X_PCI_CRP_BASE0, -- QCA955X_PCI_MEM_BASE0, -- QCA955X_PCI_MEM_SIZE, -- 0, -- ATH79_IP2_IRQ(0)); -- -- pdev = ath79_register_pci_ar724x(1, -- QCA955X_PCI_CFG_BASE1, -- QCA955X_PCI_CTRL_BASE1, -- QCA955X_PCI_CRP_BASE1, -- QCA955X_PCI_MEM_BASE1, -- QCA955X_PCI_MEM_SIZE, -- 1, -- ATH79_IP3_IRQ(2)); -- } else if (soc_is_qca956x()) { -- pdev = ath79_register_pci_ar724x(0, -- QCA956X_PCI_CFG_BASE1, -- QCA956X_PCI_CTRL_BASE1, -- QCA956X_PCI_CRP_BASE1, -- QCA956X_PCI_MEM_BASE1, -- QCA956X_PCI_MEM_SIZE, -- 1, -- ATH79_IP3_IRQ(2)); -- } else { -- /* No PCI support */ -- return -ENODEV; -- } -- -- if (!pdev) -- pr_err("unable to register PCI controller device\n"); -- -- return pdev ? 0 : -ENODEV; --} ---- a/arch/mips/pci/Makefile -+++ b/arch/mips/pci/Makefile -@@ -29,6 +29,7 @@ obj-$(CONFIG_MIPS_PCI_VIRTIO) += pci-vir - # - # These are still pretty much in the old state, watch, go blind. - # -+obj-$(CONFIG_ATH79) += fixup-ath79.o - obj-$(CONFIG_LASAT) += pci-lasat.o - obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o - obj-$(CONFIG_LEMOTE_FULOONG2E) += fixup-fuloong2e.o ops-loongson2.o ---- /dev/null -+++ b/arch/mips/pci/fixup-ath79.c -@@ -0,0 +1,21 @@ -+/* -+ * Copyright (C) 2018 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 -+ -+int pcibios_plat_dev_init(struct pci_dev *dev) -+{ -+ return PCIBIOS_SUCCESSFUL; -+} -+ -+int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ return of_irq_parse_and_map_pci(dev, slot, pin); -+} diff --git a/target/linux/ath79/patches-4.14/0023-MIPS-ath79-drop-mach-files.patch b/target/linux/ath79/patches-4.14/0023-MIPS-ath79-drop-mach-files.patch deleted file mode 100644 index 2d9a9bc97..000000000 --- a/target/linux/ath79/patches-4.14/0023-MIPS-ath79-drop-mach-files.patch +++ /dev/null @@ -1,742 +0,0 @@ -From 6e38a86d50dba5cc1da9bfd07969d76dd3ac2dda Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:28:13 +0100 -Subject: [PATCH 23/27] MIPS: ath79: drop mach files - -Signed-off-by: John Crispin ---- - arch/mips/ath79/Kconfig | 73 ------------------- - arch/mips/ath79/Makefile | 10 --- - arch/mips/ath79/mach-ap121.c | 92 ------------------------ - arch/mips/ath79/mach-ap136.c | 156 ----------------------------------------- - arch/mips/ath79/mach-ap81.c | 100 -------------------------- - arch/mips/ath79/mach-db120.c | 136 ----------------------------------- - arch/mips/ath79/mach-pb44.c | 128 --------------------------------- - arch/mips/ath79/mach-ubnt-xm.c | 126 --------------------------------- - 8 files changed, 821 deletions(-) - delete mode 100644 arch/mips/ath79/mach-ap121.c - delete mode 100644 arch/mips/ath79/mach-ap136.c - delete mode 100644 arch/mips/ath79/mach-ap81.c - delete mode 100644 arch/mips/ath79/mach-db120.c - delete mode 100644 arch/mips/ath79/mach-pb44.c - delete mode 100644 arch/mips/ath79/mach-ubnt-xm.c - ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -1,79 +1,6 @@ - # SPDX-License-Identifier: GPL-2.0 - if ATH79 - --menu "Atheros AR71XX/AR724X/AR913X machine selection" -- --config ATH79_MACH_AP121 -- bool "Atheros AP121 reference board" -- select SOC_AR933X -- select ATH79_DEV_GPIO_BUTTONS -- select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI -- select ATH79_DEV_USB -- select ATH79_DEV_WMAC -- help -- Say 'Y' here if you want your kernel to support the -- Atheros AP121 reference board. -- --config ATH79_MACH_AP136 -- bool "Atheros AP136 reference board" -- select SOC_QCA955X -- select ATH79_DEV_GPIO_BUTTONS -- select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI -- select ATH79_DEV_USB -- select ATH79_DEV_WMAC -- help -- Say 'Y' here if you want your kernel to support the -- Atheros AP136 reference board. -- --config ATH79_MACH_AP81 -- bool "Atheros AP81 reference board" -- select SOC_AR913X -- select ATH79_DEV_GPIO_BUTTONS -- select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI -- select ATH79_DEV_USB -- select ATH79_DEV_WMAC -- help -- Say 'Y' here if you want your kernel to support the -- Atheros AP81 reference board. -- --config ATH79_MACH_DB120 -- bool "Atheros DB120 reference board" -- select SOC_AR934X -- select ATH79_DEV_GPIO_BUTTONS -- select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI -- select ATH79_DEV_USB -- select ATH79_DEV_WMAC -- help -- Say 'Y' here if you want your kernel to support the -- Atheros DB120 reference board. -- --config ATH79_MACH_PB44 -- bool "Atheros PB44 reference board" -- select SOC_AR71XX -- select ATH79_DEV_GPIO_BUTTONS -- select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI -- select ATH79_DEV_USB -- help -- Say 'Y' here if you want your kernel to support the -- Atheros PB44 reference board. -- --config ATH79_MACH_UBNT_XM -- bool "Ubiquiti Networks XM (rev 1.0) board" -- select SOC_AR724X -- select ATH79_DEV_GPIO_BUTTONS -- select ATH79_DEV_LEDS_GPIO -- select ATH79_DEV_SPI -- help -- Say 'Y' here if you want your kernel to support the -- Ubiquiti Networks XM (rev 1.0) board. -- --endmenu -- - config SOC_AR71XX - select HW_HAS_PCI - def_bool n ---- a/arch/mips/ath79/Makefile -+++ b/arch/mips/ath79/Makefile -@@ -21,13 +21,3 @@ obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev - obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o - obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o - obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o -- --# --# Machines --# --obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o --obj-$(CONFIG_ATH79_MACH_AP136) += mach-ap136.o --obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o --obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o --obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o --obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o ---- a/arch/mips/ath79/mach-ap121.c -+++ /dev/null -@@ -1,92 +0,0 @@ --/* -- * Atheros AP121 board support -- * -- * 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. -- */ -- --#include "machtypes.h" --#include "dev-gpio-buttons.h" --#include "dev-leds-gpio.h" --#include "dev-spi.h" --#include "dev-usb.h" --#include "dev-wmac.h" -- --#define AP121_GPIO_LED_WLAN 0 --#define AP121_GPIO_LED_USB 1 -- --#define AP121_GPIO_BTN_JUMPSTART 11 --#define AP121_GPIO_BTN_RESET 12 -- --#define AP121_KEYS_POLL_INTERVAL 20 /* msecs */ --#define AP121_KEYS_DEBOUNCE_INTERVAL (3 * AP121_KEYS_POLL_INTERVAL) -- --#define AP121_CAL_DATA_ADDR 0x1fff1000 -- --static struct gpio_led ap121_leds_gpio[] __initdata = { -- { -- .name = "ap121:green:usb", -- .gpio = AP121_GPIO_LED_USB, -- .active_low = 0, -- }, -- { -- .name = "ap121:green:wlan", -- .gpio = AP121_GPIO_LED_WLAN, -- .active_low = 0, -- }, --}; -- --static struct gpio_keys_button ap121_gpio_keys[] __initdata = { -- { -- .desc = "jumpstart button", -- .type = EV_KEY, -- .code = KEY_WPS_BUTTON, -- .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL, -- .gpio = AP121_GPIO_BTN_JUMPSTART, -- .active_low = 1, -- }, -- { -- .desc = "reset button", -- .type = EV_KEY, -- .code = KEY_RESTART, -- .debounce_interval = AP121_KEYS_DEBOUNCE_INTERVAL, -- .gpio = AP121_GPIO_BTN_RESET, -- .active_low = 1, -- } --}; -- --static struct spi_board_info ap121_spi_info[] = { -- { -- .bus_num = 0, -- .chip_select = 0, -- .max_speed_hz = 25000000, -- .modalias = "mx25l1606e", -- } --}; -- --static struct ath79_spi_platform_data ap121_spi_data = { -- .bus_num = 0, -- .num_chipselect = 1, --}; -- --static void __init ap121_setup(void) --{ -- u8 *cal_data = (u8 *) KSEG1ADDR(AP121_CAL_DATA_ADDR); -- -- ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121_leds_gpio), -- ap121_leds_gpio); -- ath79_register_gpio_keys_polled(-1, AP121_KEYS_POLL_INTERVAL, -- ARRAY_SIZE(ap121_gpio_keys), -- ap121_gpio_keys); -- -- ath79_register_spi(&ap121_spi_data, ap121_spi_info, -- ARRAY_SIZE(ap121_spi_info)); -- ath79_register_usb(); -- ath79_register_wmac(cal_data); --} -- --MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board", -- ap121_setup); ---- a/arch/mips/ath79/mach-ap136.c -+++ /dev/null -@@ -1,156 +0,0 @@ --/* -- * Qualcomm Atheros AP136 reference board support -- * -- * Copyright (c) 2012 Qualcomm Atheros -- * Copyright (c) 2012-2013 Gabor Juhos -- * -- * 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 "machtypes.h" --#include "dev-gpio-buttons.h" --#include "dev-leds-gpio.h" --#include "dev-spi.h" --#include "dev-usb.h" --#include "dev-wmac.h" --#include "pci.h" -- --#define AP136_GPIO_LED_STATUS_RED 14 --#define AP136_GPIO_LED_STATUS_GREEN 19 --#define AP136_GPIO_LED_USB 4 --#define AP136_GPIO_LED_WLAN_2G 13 --#define AP136_GPIO_LED_WLAN_5G 12 --#define AP136_GPIO_LED_WPS_RED 15 --#define AP136_GPIO_LED_WPS_GREEN 20 -- --#define AP136_GPIO_BTN_WPS 16 --#define AP136_GPIO_BTN_RFKILL 21 -- --#define AP136_KEYS_POLL_INTERVAL 20 /* msecs */ --#define AP136_KEYS_DEBOUNCE_INTERVAL (3 * AP136_KEYS_POLL_INTERVAL) -- --#define AP136_WMAC_CALDATA_OFFSET 0x1000 --#define AP136_PCIE_CALDATA_OFFSET 0x5000 -- --static struct gpio_led ap136_leds_gpio[] __initdata = { -- { -- .name = "qca:green:status", -- .gpio = AP136_GPIO_LED_STATUS_GREEN, -- .active_low = 1, -- }, -- { -- .name = "qca:red:status", -- .gpio = AP136_GPIO_LED_STATUS_RED, -- .active_low = 1, -- }, -- { -- .name = "qca:green:wps", -- .gpio = AP136_GPIO_LED_WPS_GREEN, -- .active_low = 1, -- }, -- { -- .name = "qca:red:wps", -- .gpio = AP136_GPIO_LED_WPS_RED, -- .active_low = 1, -- }, -- { -- .name = "qca:red:wlan-2g", -- .gpio = AP136_GPIO_LED_WLAN_2G, -- .active_low = 1, -- }, -- { -- .name = "qca:red:usb", -- .gpio = AP136_GPIO_LED_USB, -- .active_low = 1, -- } --}; -- --static struct gpio_keys_button ap136_gpio_keys[] __initdata = { -- { -- .desc = "WPS button", -- .type = EV_KEY, -- .code = KEY_WPS_BUTTON, -- .debounce_interval = AP136_KEYS_DEBOUNCE_INTERVAL, -- .gpio = AP136_GPIO_BTN_WPS, -- .active_low = 1, -- }, -- { -- .desc = "RFKILL button", -- .type = EV_KEY, -- .code = KEY_RFKILL, -- .debounce_interval = AP136_KEYS_DEBOUNCE_INTERVAL, -- .gpio = AP136_GPIO_BTN_RFKILL, -- .active_low = 1, -- }, --}; -- --static struct spi_board_info ap136_spi_info[] = { -- { -- .bus_num = 0, -- .chip_select = 0, -- .max_speed_hz = 25000000, -- .modalias = "mx25l6405d", -- } --}; -- --static struct ath79_spi_platform_data ap136_spi_data = { -- .bus_num = 0, -- .num_chipselect = 1, --}; -- --#ifdef CONFIG_PCI --static struct ath9k_platform_data ap136_ath9k_data; -- --static int ap136_pci_plat_dev_init(struct pci_dev *dev) --{ -- if (dev->bus->number == 1 && (PCI_SLOT(dev->devfn)) == 0) -- dev->dev.platform_data = &ap136_ath9k_data; -- -- return 0; --} -- --static void __init ap136_pci_init(u8 *eeprom) --{ -- memcpy(ap136_ath9k_data.eeprom_data, eeprom, -- sizeof(ap136_ath9k_data.eeprom_data)); -- -- ath79_pci_set_plat_dev_init(ap136_pci_plat_dev_init); -- ath79_register_pci(); --} --#else --static inline void ap136_pci_init(u8 *eeprom) {} --#endif /* CONFIG_PCI */ -- --static void __init ap136_setup(void) --{ -- u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); -- -- ath79_register_leds_gpio(-1, ARRAY_SIZE(ap136_leds_gpio), -- ap136_leds_gpio); -- ath79_register_gpio_keys_polled(-1, AP136_KEYS_POLL_INTERVAL, -- ARRAY_SIZE(ap136_gpio_keys), -- ap136_gpio_keys); -- ath79_register_spi(&ap136_spi_data, ap136_spi_info, -- ARRAY_SIZE(ap136_spi_info)); -- ath79_register_usb(); -- ath79_register_wmac(art + AP136_WMAC_CALDATA_OFFSET); -- ap136_pci_init(art + AP136_PCIE_CALDATA_OFFSET); --} -- --MIPS_MACHINE(ATH79_MACH_AP136_010, "AP136-010", -- "Atheros AP136-010 reference board", -- ap136_setup); ---- a/arch/mips/ath79/mach-ap81.c -+++ /dev/null -@@ -1,100 +0,0 @@ --/* -- * Atheros AP81 board support -- * -- * Copyright (C) 2009-2010 Gabor Juhos -- * Copyright (C) 2009 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 "machtypes.h" --#include "dev-wmac.h" --#include "dev-gpio-buttons.h" --#include "dev-leds-gpio.h" --#include "dev-spi.h" --#include "dev-usb.h" -- --#define AP81_GPIO_LED_STATUS 1 --#define AP81_GPIO_LED_AOSS 3 --#define AP81_GPIO_LED_WLAN 6 --#define AP81_GPIO_LED_POWER 14 -- --#define AP81_GPIO_BTN_SW4 12 --#define AP81_GPIO_BTN_SW1 21 -- --#define AP81_KEYS_POLL_INTERVAL 20 /* msecs */ --#define AP81_KEYS_DEBOUNCE_INTERVAL (3 * AP81_KEYS_POLL_INTERVAL) -- --#define AP81_CAL_DATA_ADDR 0x1fff1000 -- --static struct gpio_led ap81_leds_gpio[] __initdata = { -- { -- .name = "ap81:green:status", -- .gpio = AP81_GPIO_LED_STATUS, -- .active_low = 1, -- }, { -- .name = "ap81:amber:aoss", -- .gpio = AP81_GPIO_LED_AOSS, -- .active_low = 1, -- }, { -- .name = "ap81:green:wlan", -- .gpio = AP81_GPIO_LED_WLAN, -- .active_low = 1, -- }, { -- .name = "ap81:green:power", -- .gpio = AP81_GPIO_LED_POWER, -- .active_low = 1, -- } --}; -- --static struct gpio_keys_button ap81_gpio_keys[] __initdata = { -- { -- .desc = "sw1", -- .type = EV_KEY, -- .code = BTN_0, -- .debounce_interval = AP81_KEYS_DEBOUNCE_INTERVAL, -- .gpio = AP81_GPIO_BTN_SW1, -- .active_low = 1, -- } , { -- .desc = "sw4", -- .type = EV_KEY, -- .code = BTN_1, -- .debounce_interval = AP81_KEYS_DEBOUNCE_INTERVAL, -- .gpio = AP81_GPIO_BTN_SW4, -- .active_low = 1, -- } --}; -- --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); -- -- ath79_register_leds_gpio(-1, ARRAY_SIZE(ap81_leds_gpio), -- ap81_leds_gpio); -- 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_wmac(cal_data); -- ath79_register_usb(); --} -- --MIPS_MACHINE(ATH79_MACH_AP81, "AP81", "Atheros AP81 reference board", -- ap81_setup); ---- a/arch/mips/ath79/mach-db120.c -+++ /dev/null -@@ -1,136 +0,0 @@ --/* -- * Atheros DB120 reference board support -- * -- * Copyright (c) 2011 Qualcomm Atheros -- * Copyright (c) 2011 Gabor Juhos -- * -- * 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 "machtypes.h" --#include "dev-gpio-buttons.h" --#include "dev-leds-gpio.h" --#include "dev-spi.h" --#include "dev-usb.h" --#include "dev-wmac.h" --#include "pci.h" -- --#define DB120_GPIO_LED_WLAN_5G 12 --#define DB120_GPIO_LED_WLAN_2G 13 --#define DB120_GPIO_LED_STATUS 14 --#define DB120_GPIO_LED_WPS 15 -- --#define DB120_GPIO_BTN_WPS 16 -- --#define DB120_KEYS_POLL_INTERVAL 20 /* msecs */ --#define DB120_KEYS_DEBOUNCE_INTERVAL (3 * DB120_KEYS_POLL_INTERVAL) -- --#define DB120_WMAC_CALDATA_OFFSET 0x1000 --#define DB120_PCIE_CALDATA_OFFSET 0x5000 -- --static struct gpio_led db120_leds_gpio[] __initdata = { -- { -- .name = "db120:green:status", -- .gpio = DB120_GPIO_LED_STATUS, -- .active_low = 1, -- }, -- { -- .name = "db120:green:wps", -- .gpio = DB120_GPIO_LED_WPS, -- .active_low = 1, -- }, -- { -- .name = "db120:green:wlan-5g", -- .gpio = DB120_GPIO_LED_WLAN_5G, -- .active_low = 1, -- }, -- { -- .name = "db120:green:wlan-2g", -- .gpio = DB120_GPIO_LED_WLAN_2G, -- .active_low = 1, -- }, --}; -- --static struct gpio_keys_button db120_gpio_keys[] __initdata = { -- { -- .desc = "WPS button", -- .type = EV_KEY, -- .code = KEY_WPS_BUTTON, -- .debounce_interval = DB120_KEYS_DEBOUNCE_INTERVAL, -- .gpio = DB120_GPIO_BTN_WPS, -- .active_low = 1, -- }, --}; -- --static struct spi_board_info db120_spi_info[] = { -- { -- .bus_num = 0, -- .chip_select = 0, -- .max_speed_hz = 25000000, -- .modalias = "s25sl064a", -- } --}; -- --static struct ath79_spi_platform_data db120_spi_data = { -- .bus_num = 0, -- .num_chipselect = 1, --}; -- --#ifdef CONFIG_PCI --static struct ath9k_platform_data db120_ath9k_data; -- --static int db120_pci_plat_dev_init(struct pci_dev *dev) --{ -- switch (PCI_SLOT(dev->devfn)) { -- case 0: -- dev->dev.platform_data = &db120_ath9k_data; -- break; -- } -- -- return 0; --} -- --static void __init db120_pci_init(u8 *eeprom) --{ -- memcpy(db120_ath9k_data.eeprom_data, eeprom, -- sizeof(db120_ath9k_data.eeprom_data)); -- -- ath79_pci_set_plat_dev_init(db120_pci_plat_dev_init); -- ath79_register_pci(); --} --#else --static inline void db120_pci_init(u8 *eeprom) {} --#endif /* CONFIG_PCI */ -- --static void __init db120_setup(void) --{ -- u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); -- -- ath79_register_leds_gpio(-1, ARRAY_SIZE(db120_leds_gpio), -- db120_leds_gpio); -- ath79_register_gpio_keys_polled(-1, DB120_KEYS_POLL_INTERVAL, -- ARRAY_SIZE(db120_gpio_keys), -- db120_gpio_keys); -- ath79_register_spi(&db120_spi_data, db120_spi_info, -- ARRAY_SIZE(db120_spi_info)); -- ath79_register_usb(); -- ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET); -- db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET); --} -- --MIPS_MACHINE(ATH79_MACH_DB120, "DB120", "Atheros DB120 reference board", -- db120_setup); ---- a/arch/mips/ath79/mach-pb44.c -+++ /dev/null -@@ -1,122 +0,0 @@ --/* -- * Atheros PB44 reference board support -- * -- * Copyright (C) 2009-2010 Gabor Juhos -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#include --#include --#include --#include --#include -- --#include "machtypes.h" --#include "dev-gpio-buttons.h" --#include "dev-leds-gpio.h" --#include "dev-spi.h" --#include "dev-usb.h" --#include "pci.h" -- --#define PB44_GPIO_I2C_SCL 0 --#define PB44_GPIO_I2C_SDA 1 -- --#define PB44_GPIO_EXP_BASE 16 --#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) --#define PB44_GPIO_LED_JUMP2 (PB44_GPIO_EXP_BASE + 10) -- --#define PB44_KEYS_POLL_INTERVAL 20 /* msecs */ --#define PB44_KEYS_DEBOUNCE_INTERVAL (3 * PB44_KEYS_POLL_INTERVAL) -- --static struct i2c_gpio_platform_data pb44_i2c_gpio_data = { -- .sda_pin = PB44_GPIO_I2C_SDA, -- .scl_pin = PB44_GPIO_I2C_SCL, --}; -- --static struct platform_device pb44_i2c_gpio_device = { -- .name = "i2c-gpio", -- .id = 0, -- .dev = { -- .platform_data = &pb44_i2c_gpio_data, -- } --}; -- --static struct pcf857x_platform_data pb44_pcf857x_data = { -- .gpio_base = PB44_GPIO_EXP_BASE, --}; -- --static struct i2c_board_info pb44_i2c_board_info[] __initdata = { -- { -- I2C_BOARD_INFO("pcf8575", 0x20), -- .platform_data = &pb44_pcf857x_data, -- }, --}; -- --static struct gpio_led pb44_leds_gpio[] __initdata = { -- { -- .name = "pb44:amber:jump1", -- .gpio = PB44_GPIO_LED_JUMP1, -- .active_low = 1, -- }, { -- .name = "pb44:green:jump2", -- .gpio = PB44_GPIO_LED_JUMP2, -- .active_low = 1, -- }, --}; -- --static struct gpio_keys_button pb44_gpio_keys[] __initdata = { -- { -- .desc = "soft_reset", -- .type = EV_KEY, -- .code = KEY_RESTART, -- .debounce_interval = PB44_KEYS_DEBOUNCE_INTERVAL, -- .gpio = PB44_GPIO_SW_RESET, -- .active_low = 1, -- } , { -- .desc = "jumpstart", -- .type = EV_KEY, -- .code = KEY_WPS_BUTTON, -- .debounce_interval = PB44_KEYS_DEBOUNCE_INTERVAL, -- .gpio = PB44_GPIO_SW_JUMP, -- .active_low = 1, -- } --}; -- --static struct spi_board_info pb44_spi_info[] = { -- { -- .bus_num = 0, -- .chip_select = 0, -- .max_speed_hz = 25000000, -- .modalias = "m25p64", -- }, --}; -- --static struct ath79_spi_platform_data pb44_spi_data = { -- .bus_num = 0, -- .num_chipselect = 1, --}; -- --static void __init pb44_init(void) --{ -- i2c_register_board_info(0, pb44_i2c_board_info, -- ARRAY_SIZE(pb44_i2c_board_info)); -- platform_device_register(&pb44_i2c_gpio_device); -- -- ath79_register_leds_gpio(-1, ARRAY_SIZE(pb44_leds_gpio), -- pb44_leds_gpio); -- ath79_register_gpio_keys_polled(-1, PB44_KEYS_POLL_INTERVAL, -- ARRAY_SIZE(pb44_gpio_keys), -- pb44_gpio_keys); -- ath79_register_spi(&pb44_spi_data, pb44_spi_info, -- ARRAY_SIZE(pb44_spi_info)); -- ath79_register_usb(); -- ath79_register_pci(); --} -- --MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board", -- pb44_init); diff --git a/target/linux/ath79/patches-4.14/0024-GPIO-add-named-gpio-exports.patch b/target/linux/ath79/patches-4.14/0024-GPIO-add-named-gpio-exports.patch deleted file mode 100644 index 0c1bc7392..000000000 --- a/target/linux/ath79/patches-4.14/0024-GPIO-add-named-gpio-exports.patch +++ /dev/null @@ -1,166 +0,0 @@ -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" - -@@ -506,3 +508,69 @@ void of_gpiochip_remove(struct gpio_chip - gpiochip_remove_pin_ranges(chip); - of_node_put(chip->of_node); - } -+ -+static struct of_device_id gpio_export_ids[] = { -+ { .compatible = "gpio-export" }, -+ { /* sentinel */ } -+}; -+ -+static int __init of_gpio_export_probe(struct platform_device *pdev) -+{ -+ struct device_node *np = pdev->dev.of_node; -+ struct device_node *cnp; -+ u32 val; -+ int nb = 0; -+ -+ for_each_child_of_node(np, cnp) { -+ const char *name = NULL; -+ int gpio; -+ bool dmc; -+ int max_gpio = 1; -+ int i; -+ -+ of_property_read_string(cnp, "gpio-export,name", &name); -+ -+ if (!name) -+ max_gpio = of_gpio_count(cnp); -+ -+ for (i = 0; i < max_gpio; i++) { -+ unsigned flags = 0; -+ enum of_gpio_flags of_flags; -+ -+ gpio = of_get_gpio_flags(cnp, i, &of_flags); -+ -+ if (of_flags == OF_GPIO_ACTIVE_LOW) -+ flags |= GPIOF_ACTIVE_LOW; -+ -+ if (!of_property_read_u32(cnp, "gpio-export,output", &val)) -+ flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; -+ else -+ flags |= GPIOF_IN; -+ -+ if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np))) -+ continue; -+ -+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change"); -+ gpio_export_with_name(gpio, dmc, name); -+ nb++; -+ } -+ } -+ -+ dev_info(&pdev->dev, "%d gpio(s) exported\n", nb); -+ -+ return 0; -+} -+ -+static struct platform_driver gpio_export_driver = { -+ .driver = { -+ .name = "gpio-export", -+ .owner = THIS_MODULE, -+ .of_match_table = of_match_ptr(gpio_export_ids), -+ }, -+}; -+ -+static int __init of_gpio_export_init(void) -+{ -+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe); -+} -+device_initcall(of_gpio_export_init); ---- a/drivers/gpio/gpiolib-sysfs.c -+++ b/drivers/gpio/gpiolib-sysfs.c -@@ -553,7 +553,7 @@ static struct class gpio_class = { - * - * Returns zero on success, else an error. - */ --int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name) - { - struct gpio_chip *chip; - struct gpio_device *gdev; -@@ -615,6 +615,8 @@ int gpiod_export(struct gpio_desc *desc, - offset = gpio_chip_hwgpio(desc); - if (chip->names && chip->names[offset]) - ioname = chip->names[offset]; -+ if (name) -+ ioname = name; - - dev = device_create_with_groups(&gpio_class, &gdev->dev, - MKDEV(0, 0), data, gpio_groups, -@@ -636,6 +638,12 @@ err_unlock: - gpiod_dbg(desc, "%s: status %d\n", __func__, status); - return status; - } -+EXPORT_SYMBOL_GPL(__gpiod_export); -+ -+int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+{ -+ return __gpiod_export(desc, direction_may_change, NULL); -+} - EXPORT_SYMBOL_GPL(gpiod_export); - - static int match_export(struct device *dev, const void *desc) ---- a/include/asm-generic/gpio.h -+++ b/include/asm-generic/gpio.h -@@ -127,6 +127,12 @@ static inline int gpio_export(unsigned g - return gpiod_export(gpio_to_desc(gpio), direction_may_change); - } - -+int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); -+static inline int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name) -+{ -+ return __gpiod_export(gpio_to_desc(gpio), direction_may_change, name); -+} -+ - static inline int gpio_export_link(struct device *dev, const char *name, - unsigned gpio) - { ---- a/include/linux/gpio/consumer.h -+++ b/include/linux/gpio/consumer.h -@@ -451,6 +451,7 @@ struct gpio_desc *devm_fwnode_get_gpiod_ - - #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) - -+int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); - int gpiod_export(struct gpio_desc *desc, bool direction_may_change); - int gpiod_export_link(struct device *dev, const char *name, - struct gpio_desc *desc); -@@ -458,6 +459,13 @@ void gpiod_unexport(struct gpio_desc *de - - #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ - -+static inline int _gpiod_export(struct gpio_desc *desc, -+ bool direction_may_change, -+ const char *name) -+{ -+ return -ENOSYS; -+} -+ - static inline int gpiod_export(struct gpio_desc *desc, - bool direction_may_change) - { diff --git a/target/linux/ath79/patches-4.14/0024-MIPS-ath79-drop-pdata-helpers.patch b/target/linux/ath79/patches-4.14/0024-MIPS-ath79-drop-pdata-helpers.patch deleted file mode 100644 index 8c4956ec3..000000000 --- a/target/linux/ath79/patches-4.14/0024-MIPS-ath79-drop-pdata-helpers.patch +++ /dev/null @@ -1,922 +0,0 @@ -From c038250c16cdefd6d74ad61309ba84973eceb630 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:29:46 +0100 -Subject: [PATCH 24/27] MIPS: ath79: drop pdata helpers - -Signed-off-by: John Crispin ---- - arch/mips/ath79/dev-common.c | 168 ------------------------- - arch/mips/ath79/dev-common.h | 18 --- - arch/mips/ath79/dev-gpio-buttons.c | 56 --------- - arch/mips/ath79/dev-gpio-buttons.h | 23 ---- - arch/mips/ath79/dev-leds-gpio.c | 54 --------- - arch/mips/ath79/dev-leds-gpio.h | 21 ---- - arch/mips/ath79/dev-spi.c | 38 ------ - arch/mips/ath79/dev-spi.h | 22 ---- - arch/mips/ath79/dev-usb.c | 242 ------------------------------------- - arch/mips/ath79/dev-usb.h | 17 --- - arch/mips/ath79/dev-wmac.c | 155 ------------------------ - arch/mips/ath79/dev-wmac.h | 17 --- - arch/mips/ath79/setup.c | 5 - - 13 files changed, 836 deletions(-) - delete mode 100644 arch/mips/ath79/dev-common.c - delete mode 100644 arch/mips/ath79/dev-common.h - delete mode 100644 arch/mips/ath79/dev-gpio-buttons.c - delete mode 100644 arch/mips/ath79/dev-gpio-buttons.h - delete mode 100644 arch/mips/ath79/dev-leds-gpio.c - delete mode 100644 arch/mips/ath79/dev-leds-gpio.h - delete mode 100644 arch/mips/ath79/dev-spi.c - delete mode 100644 arch/mips/ath79/dev-spi.h - delete mode 100644 arch/mips/ath79/dev-usb.c - delete mode 100644 arch/mips/ath79/dev-usb.h - delete mode 100644 arch/mips/ath79/dev-wmac.c - delete mode 100644 arch/mips/ath79/dev-wmac.h - ---- a/arch/mips/ath79/dev-common.c -+++ /dev/null -@@ -1,168 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X common devices -- * -- * Copyright (C) 2008-2011 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * Parts of this file are based on Atheros' 2.6.15 BSP -- * -- * 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 "common.h" --#include "dev-common.h" -- --static struct resource ath79_uart_resources[] = { -- { -- .start = AR71XX_UART_BASE, -- .end = AR71XX_UART_BASE + AR71XX_UART_SIZE - 1, -- .flags = IORESOURCE_MEM, -- }, --}; -- --#define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP) --static struct plat_serial8250_port ath79_uart_data[] = { -- { -- .mapbase = AR71XX_UART_BASE, -- .irq = ATH79_MISC_IRQ(3), -- .flags = AR71XX_UART_FLAGS, -- .iotype = UPIO_MEM32, -- .regshift = 2, -- }, { -- /* terminating entry */ -- } --}; -- --static struct platform_device ath79_uart_device = { -- .name = "serial8250", -- .id = PLAT8250_DEV_PLATFORM, -- .resource = ath79_uart_resources, -- .num_resources = ARRAY_SIZE(ath79_uart_resources), -- .dev = { -- .platform_data = ath79_uart_data -- }, --}; -- --static struct resource ar933x_uart_resources[] = { -- { -- .start = AR933X_UART_BASE, -- .end = AR933X_UART_BASE + AR71XX_UART_SIZE - 1, -- .flags = IORESOURCE_MEM, -- }, -- { -- .start = ATH79_MISC_IRQ(3), -- .end = ATH79_MISC_IRQ(3), -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device ar933x_uart_device = { -- .name = "ar933x-uart", -- .id = -1, -- .resource = ar933x_uart_resources, -- .num_resources = ARRAY_SIZE(ar933x_uart_resources), --}; -- --void __init ath79_register_uart(void) --{ -- unsigned long uart_clk_rate; -- -- uart_clk_rate = ath79_get_sys_clk_rate("uart"); -- -- if (soc_is_ar71xx() || -- soc_is_ar724x() || -- soc_is_ar913x() || -- soc_is_ar934x() || -- soc_is_qca953x() || -- soc_is_qca955x() || -- soc_is_qca956x() || -- soc_is_tp9343()) { -- ath79_uart_data[0].uartclk = uart_clk_rate; -- platform_device_register(&ath79_uart_device); -- } else if (soc_is_ar933x()) { -- platform_device_register(&ar933x_uart_device); -- } else { -- BUG(); -- } --} -- --void __init ath79_register_wdt(void) --{ -- struct resource res; -- -- memset(&res, 0, sizeof(res)); -- -- res.flags = IORESOURCE_MEM; -- res.start = AR71XX_RESET_BASE + AR71XX_RESET_REG_WDOG_CTRL; -- res.end = res.start + 0x8 - 1; -- -- platform_device_register_simple("ath79-wdt", -1, &res, 1); --} -- --static struct ath79_gpio_platform_data ath79_gpio_pdata; -- --static struct resource ath79_gpio_resources[] = { -- { -- .flags = IORESOURCE_MEM, -- .start = AR71XX_GPIO_BASE, -- .end = AR71XX_GPIO_BASE + AR71XX_GPIO_SIZE - 1, -- }, -- { -- .start = ATH79_MISC_IRQ(2), -- .end = ATH79_MISC_IRQ(2), -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device ath79_gpio_device = { -- .name = "ath79-gpio", -- .id = -1, -- .resource = ath79_gpio_resources, -- .num_resources = ARRAY_SIZE(ath79_gpio_resources), -- .dev = { -- .platform_data = &ath79_gpio_pdata -- }, --}; -- --void __init ath79_gpio_init(void) --{ -- if (soc_is_ar71xx()) { -- ath79_gpio_pdata.ngpios = AR71XX_GPIO_COUNT; -- } else if (soc_is_ar7240()) { -- ath79_gpio_pdata.ngpios = AR7240_GPIO_COUNT; -- } else if (soc_is_ar7241() || soc_is_ar7242()) { -- ath79_gpio_pdata.ngpios = AR7241_GPIO_COUNT; -- } else if (soc_is_ar913x()) { -- ath79_gpio_pdata.ngpios = AR913X_GPIO_COUNT; -- } else if (soc_is_ar933x()) { -- ath79_gpio_pdata.ngpios = AR933X_GPIO_COUNT; -- } else if (soc_is_ar934x()) { -- ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT; -- ath79_gpio_pdata.oe_inverted = 1; -- } else if (soc_is_qca953x()) { -- ath79_gpio_pdata.ngpios = QCA953X_GPIO_COUNT; -- ath79_gpio_pdata.oe_inverted = 1; -- } else if (soc_is_qca955x()) { -- ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT; -- ath79_gpio_pdata.oe_inverted = 1; -- } else if (soc_is_qca956x() || soc_is_tp9343()) { -- ath79_gpio_pdata.ngpios = QCA956X_GPIO_COUNT; -- ath79_gpio_pdata.oe_inverted = 1; -- } else { -- BUG(); -- } -- -- platform_device_register(&ath79_gpio_device); --} ---- a/arch/mips/ath79/dev-common.h -+++ /dev/null -@@ -1,18 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X common devices -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#ifndef _ATH79_DEV_COMMON_H --#define _ATH79_DEV_COMMON_H -- --void ath79_register_uart(void); --void ath79_register_wdt(void); -- --#endif /* _ATH79_DEV_COMMON_H */ ---- a/arch/mips/ath79/dev-gpio-buttons.c -+++ /dev/null -@@ -1,56 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X GPIO button support -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#include "linux/init.h" --#include "linux/slab.h" --#include -- --#include "dev-gpio-buttons.h" -- --void __init ath79_register_gpio_keys_polled(int id, -- unsigned poll_interval, -- unsigned nbuttons, -- struct gpio_keys_button *buttons) --{ -- struct platform_device *pdev; -- struct gpio_keys_platform_data pdata; -- struct gpio_keys_button *p; -- int err; -- -- p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL); -- if (!p) -- return; -- -- pdev = platform_device_alloc("gpio-keys-polled", id); -- if (!pdev) -- goto err_free_buttons; -- -- memset(&pdata, 0, sizeof(pdata)); -- pdata.poll_interval = poll_interval; -- pdata.nbuttons = nbuttons; -- pdata.buttons = p; -- -- err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); -- if (err) -- goto err_put_pdev; -- -- err = platform_device_add(pdev); -- if (err) -- goto err_put_pdev; -- -- return; -- --err_put_pdev: -- platform_device_put(pdev); -- --err_free_buttons: -- kfree(p); --} ---- a/arch/mips/ath79/dev-gpio-buttons.h -+++ /dev/null -@@ -1,23 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X GPIO button support -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#ifndef _ATH79_DEV_GPIO_BUTTONS_H --#define _ATH79_DEV_GPIO_BUTTONS_H -- --#include --#include -- --void ath79_register_gpio_keys_polled(int id, -- unsigned poll_interval, -- unsigned nbuttons, -- struct gpio_keys_button *buttons); -- --#endif /* _ATH79_DEV_GPIO_BUTTONS_H */ ---- a/arch/mips/ath79/dev-leds-gpio.c -+++ /dev/null -@@ -1,54 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X common GPIO LEDs support -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#include --#include --#include -- --#include "dev-leds-gpio.h" -- --void __init ath79_register_leds_gpio(int id, -- unsigned num_leds, -- struct gpio_led *leds) --{ -- struct platform_device *pdev; -- struct gpio_led_platform_data pdata; -- struct gpio_led *p; -- int err; -- -- p = kmemdup(leds, num_leds * sizeof(*p), GFP_KERNEL); -- if (!p) -- return; -- -- pdev = platform_device_alloc("leds-gpio", id); -- if (!pdev) -- goto err_free_leds; -- -- memset(&pdata, 0, sizeof(pdata)); -- pdata.num_leds = num_leds; -- pdata.leds = p; -- -- err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); -- if (err) -- goto err_put_pdev; -- -- err = platform_device_add(pdev); -- if (err) -- goto err_put_pdev; -- -- return; -- --err_put_pdev: -- platform_device_put(pdev); -- --err_free_leds: -- kfree(p); --} ---- a/arch/mips/ath79/dev-leds-gpio.h -+++ /dev/null -@@ -1,21 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X common GPIO LEDs support -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#ifndef _ATH79_DEV_LEDS_GPIO_H --#define _ATH79_DEV_LEDS_GPIO_H -- --#include -- --void ath79_register_leds_gpio(int id, -- unsigned num_leds, -- struct gpio_led *leds); -- --#endif /* _ATH79_DEV_LEDS_GPIO_H */ ---- a/arch/mips/ath79/dev-spi.c -+++ /dev/null -@@ -1,38 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X SPI controller device -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#include --#include --#include "dev-spi.h" -- --static struct resource ath79_spi_resources[] = { -- { -- .start = AR71XX_SPI_BASE, -- .end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1, -- .flags = IORESOURCE_MEM, -- }, --}; -- --static struct platform_device ath79_spi_device = { -- .name = "ath79-spi", -- .id = -1, -- .resource = ath79_spi_resources, -- .num_resources = ARRAY_SIZE(ath79_spi_resources), --}; -- --void __init ath79_register_spi(struct ath79_spi_platform_data *pdata, -- struct spi_board_info const *info, -- unsigned n) --{ -- spi_register_board_info(info, n); -- ath79_spi_device.dev.platform_data = pdata; -- platform_device_register(&ath79_spi_device); --} ---- a/arch/mips/ath79/dev-spi.h -+++ /dev/null -@@ -1,22 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X SPI controller device -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#ifndef _ATH79_DEV_SPI_H --#define _ATH79_DEV_SPI_H -- --#include --#include -- --void ath79_register_spi(struct ath79_spi_platform_data *pdata, -- struct spi_board_info const *info, -- unsigned n); -- --#endif /* _ATH79_DEV_SPI_H */ ---- a/arch/mips/ath79/dev-usb.c -+++ /dev/null -@@ -1,242 +0,0 @@ --/* -- * Atheros AR7XXX/AR9XXX USB Host Controller device -- * -- * Copyright (C) 2008-2011 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * Parts of this file are based on Atheros' 2.6.15 BSP -- * -- * 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-usb.h" -- --static u64 ath79_usb_dmamask = DMA_BIT_MASK(32); -- --static struct usb_ohci_pdata ath79_ohci_pdata = { --}; -- --static struct usb_ehci_pdata ath79_ehci_pdata_v1 = { -- .has_synopsys_hc_bug = 1, --}; -- --static struct usb_ehci_pdata ath79_ehci_pdata_v2 = { -- .caps_offset = 0x100, -- .has_tt = 1, --}; -- --static void __init ath79_usb_register(const char *name, int id, -- unsigned long base, unsigned long size, -- int irq, const void *data, -- size_t data_size) --{ -- struct resource res[2]; -- struct platform_device *pdev; -- -- memset(res, 0, sizeof(res)); -- -- res[0].flags = IORESOURCE_MEM; -- res[0].start = base; -- res[0].end = base + size - 1; -- -- res[1].flags = IORESOURCE_IRQ; -- res[1].start = irq; -- res[1].end = irq; -- -- pdev = platform_device_register_resndata(NULL, name, id, -- res, ARRAY_SIZE(res), -- data, data_size); -- -- if (IS_ERR(pdev)) { -- pr_err("ath79: unable to register USB at %08lx, err=%d\n", -- base, (int) PTR_ERR(pdev)); -- return; -- } -- -- pdev->dev.dma_mask = &ath79_usb_dmamask; -- pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); --} -- --#define AR71XX_USB_RESET_MASK (AR71XX_RESET_USB_HOST | \ -- AR71XX_RESET_USB_PHY | \ -- AR71XX_RESET_USB_OHCI_DLL) -- --static void __init ath79_usb_setup(void) --{ -- void __iomem *usb_ctrl_base; -- -- ath79_device_reset_set(AR71XX_USB_RESET_MASK); -- mdelay(1000); -- ath79_device_reset_clear(AR71XX_USB_RESET_MASK); -- -- usb_ctrl_base = ioremap(AR71XX_USB_CTRL_BASE, AR71XX_USB_CTRL_SIZE); -- -- /* Turning on the Buff and Desc swap bits */ -- __raw_writel(0xf0000, usb_ctrl_base + AR71XX_USB_CTRL_REG_CONFIG); -- -- /* WAR for HW bug. Here it adjusts the duration between two SOFS */ -- __raw_writel(0x20c00, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ); -- -- iounmap(usb_ctrl_base); -- -- mdelay(900); -- -- ath79_usb_register("ohci-platform", -1, -- AR71XX_OHCI_BASE, AR71XX_OHCI_SIZE, -- ATH79_MISC_IRQ(6), -- &ath79_ohci_pdata, sizeof(ath79_ohci_pdata)); -- -- ath79_usb_register("ehci-platform", -1, -- AR71XX_EHCI_BASE, AR71XX_EHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ehci_pdata_v1, sizeof(ath79_ehci_pdata_v1)); --} -- --static void __init ar7240_usb_setup(void) --{ -- void __iomem *usb_ctrl_base; -- -- ath79_device_reset_clear(AR7240_RESET_OHCI_DLL); -- ath79_device_reset_set(AR7240_RESET_USB_HOST); -- -- mdelay(1000); -- -- ath79_device_reset_set(AR7240_RESET_OHCI_DLL); -- ath79_device_reset_clear(AR7240_RESET_USB_HOST); -- -- usb_ctrl_base = ioremap(AR7240_USB_CTRL_BASE, AR7240_USB_CTRL_SIZE); -- -- /* WAR for HW bug. Here it adjusts the duration between two SOFS */ -- __raw_writel(0x3, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ); -- -- iounmap(usb_ctrl_base); -- -- ath79_usb_register("ohci-platform", -1, -- AR7240_OHCI_BASE, AR7240_OHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ohci_pdata, sizeof(ath79_ohci_pdata)); --} -- --static void __init ar724x_usb_setup(void) --{ -- ath79_device_reset_set(AR724X_RESET_USBSUS_OVERRIDE); -- mdelay(10); -- -- ath79_device_reset_clear(AR724X_RESET_USB_HOST); -- mdelay(10); -- -- ath79_device_reset_clear(AR724X_RESET_USB_PHY); -- mdelay(10); -- -- ath79_usb_register("ehci-platform", -1, -- AR724X_EHCI_BASE, AR724X_EHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); --} -- --static void __init ar913x_usb_setup(void) --{ -- ath79_device_reset_set(AR913X_RESET_USBSUS_OVERRIDE); -- mdelay(10); -- -- ath79_device_reset_clear(AR913X_RESET_USB_HOST); -- mdelay(10); -- -- ath79_device_reset_clear(AR913X_RESET_USB_PHY); -- mdelay(10); -- -- ath79_usb_register("ehci-platform", -1, -- AR913X_EHCI_BASE, AR913X_EHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); --} -- --static void __init ar933x_usb_setup(void) --{ -- ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE); -- mdelay(10); -- -- ath79_device_reset_clear(AR933X_RESET_USB_HOST); -- mdelay(10); -- -- ath79_device_reset_clear(AR933X_RESET_USB_PHY); -- mdelay(10); -- -- ath79_usb_register("ehci-platform", -1, -- AR933X_EHCI_BASE, AR933X_EHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); --} -- --static void __init ar934x_usb_setup(void) --{ -- u32 bootstrap; -- -- bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP); -- if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE) -- return; -- -- ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE); -- udelay(1000); -- -- ath79_device_reset_clear(AR934X_RESET_USB_PHY); -- udelay(1000); -- -- ath79_device_reset_clear(AR934X_RESET_USB_PHY_ANALOG); -- udelay(1000); -- -- ath79_device_reset_clear(AR934X_RESET_USB_HOST); -- udelay(1000); -- -- ath79_usb_register("ehci-platform", -1, -- AR934X_EHCI_BASE, AR934X_EHCI_SIZE, -- ATH79_CPU_IRQ(3), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); --} -- --static void __init qca955x_usb_setup(void) --{ -- ath79_usb_register("ehci-platform", 0, -- QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE, -- ATH79_IP3_IRQ(0), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); -- -- ath79_usb_register("ehci-platform", 1, -- QCA955X_EHCI1_BASE, QCA955X_EHCI_SIZE, -- ATH79_IP3_IRQ(1), -- &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); --} -- --void __init ath79_register_usb(void) --{ -- if (soc_is_ar71xx()) -- ath79_usb_setup(); -- else if (soc_is_ar7240()) -- ar7240_usb_setup(); -- else if (soc_is_ar7241() || soc_is_ar7242()) -- ar724x_usb_setup(); -- else if (soc_is_ar913x()) -- ar913x_usb_setup(); -- else if (soc_is_ar933x()) -- ar933x_usb_setup(); -- else if (soc_is_ar934x()) -- ar934x_usb_setup(); -- else if (soc_is_qca955x()) -- qca955x_usb_setup(); -- else -- BUG(); --} ---- a/arch/mips/ath79/dev-usb.h -+++ /dev/null -@@ -1,17 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X USB Host Controller support -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#ifndef _ATH79_DEV_USB_H --#define _ATH79_DEV_USB_H -- --void ath79_register_usb(void); -- --#endif /* _ATH79_DEV_USB_H */ ---- a/arch/mips/ath79/dev-wmac.c -+++ /dev/null -@@ -1,155 +0,0 @@ --/* -- * Atheros AR913X/AR933X SoC built-in WMAC device support -- * -- * Copyright (C) 2010-2011 Jaiganesh Narayanan -- * Copyright (C) 2008-2011 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * Parts of this file are based on Atheros 2.6.15/2.6.31 BSP -- * -- * 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 "dev-wmac.h" -- --static struct ath9k_platform_data ath79_wmac_data; -- --static struct resource ath79_wmac_resources[] = { -- { -- /* .start and .end fields are filled dynamically */ -- .flags = IORESOURCE_MEM, -- }, { -- /* .start and .end fields are filled dynamically */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device ath79_wmac_device = { -- .name = "ath9k", -- .id = -1, -- .resource = ath79_wmac_resources, -- .num_resources = ARRAY_SIZE(ath79_wmac_resources), -- .dev = { -- .platform_data = &ath79_wmac_data, -- }, --}; -- --static void __init ar913x_wmac_setup(void) --{ -- /* reset the WMAC */ -- ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); -- mdelay(10); -- -- ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); -- mdelay(10); -- -- ath79_wmac_resources[0].start = AR913X_WMAC_BASE; -- ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1; -- ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2); -- ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2); --} -- -- --static int ar933x_wmac_reset(void) --{ -- ath79_device_reset_set(AR933X_RESET_WMAC); -- ath79_device_reset_clear(AR933X_RESET_WMAC); -- -- return 0; --} -- --static int ar933x_r1_get_wmac_revision(void) --{ -- return ath79_soc_rev; --} -- --static void __init ar933x_wmac_setup(void) --{ -- u32 t; -- -- ar933x_wmac_reset(); -- -- ath79_wmac_device.name = "ar933x_wmac"; -- -- ath79_wmac_resources[0].start = AR933X_WMAC_BASE; -- ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1; -- ath79_wmac_resources[1].start = ATH79_CPU_IRQ(2); -- ath79_wmac_resources[1].end = ATH79_CPU_IRQ(2); -- -- t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); -- if (t & AR933X_BOOTSTRAP_REF_CLK_40) -- ath79_wmac_data.is_clk_25mhz = false; -- else -- ath79_wmac_data.is_clk_25mhz = true; -- -- if (ath79_soc_rev == 1) -- ath79_wmac_data.get_mac_revision = ar933x_r1_get_wmac_revision; -- -- ath79_wmac_data.external_reset = ar933x_wmac_reset; --} -- --static void ar934x_wmac_setup(void) --{ -- u32 t; -- -- ath79_wmac_device.name = "ar934x_wmac"; -- -- ath79_wmac_resources[0].start = AR934X_WMAC_BASE; -- ath79_wmac_resources[0].end = AR934X_WMAC_BASE + AR934X_WMAC_SIZE - 1; -- ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1); -- ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1); -- -- t = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP); -- if (t & AR934X_BOOTSTRAP_REF_CLK_40) -- ath79_wmac_data.is_clk_25mhz = false; -- else -- ath79_wmac_data.is_clk_25mhz = true; --} -- --static void qca955x_wmac_setup(void) --{ -- u32 t; -- -- ath79_wmac_device.name = "qca955x_wmac"; -- -- ath79_wmac_resources[0].start = QCA955X_WMAC_BASE; -- ath79_wmac_resources[0].end = QCA955X_WMAC_BASE + QCA955X_WMAC_SIZE - 1; -- ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1); -- ath79_wmac_resources[1].end = ATH79_IP2_IRQ(1); -- -- t = ath79_reset_rr(QCA955X_RESET_REG_BOOTSTRAP); -- if (t & QCA955X_BOOTSTRAP_REF_CLK_40) -- ath79_wmac_data.is_clk_25mhz = false; -- else -- ath79_wmac_data.is_clk_25mhz = true; --} -- --void __init ath79_register_wmac(u8 *cal_data) --{ -- if (soc_is_ar913x()) -- ar913x_wmac_setup(); -- else if (soc_is_ar933x()) -- ar933x_wmac_setup(); -- else if (soc_is_ar934x()) -- ar934x_wmac_setup(); -- else if (soc_is_qca955x()) -- qca955x_wmac_setup(); -- else -- BUG(); -- -- if (cal_data) -- memcpy(ath79_wmac_data.eeprom_data, cal_data, -- sizeof(ath79_wmac_data.eeprom_data)); -- -- platform_device_register(&ath79_wmac_device); --} ---- a/arch/mips/ath79/dev-wmac.h -+++ /dev/null -@@ -1,17 +0,0 @@ --/* -- * Atheros AR913X/AR933X SoC built-in WMAC device support -- * -- * Copyright (C) 2008-2011 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#ifndef _ATH79_DEV_WMAC_H --#define _ATH79_DEV_WMAC_H -- --void ath79_register_wmac(u8 *cal_data); -- --#endif /* _ATH79_DEV_WMAC_H */ ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -31,7 +31,6 @@ - #include - #include - #include "common.h" --#include "dev-common.h" - #include "machtypes.h" - - #define ATH79_SYS_TYPE_LEN 64 -@@ -316,10 +315,6 @@ static int __init ath79_setup(void) - if (mips_machtype == ATH79_MACH_GENERIC_OF) - return 0; - -- ath79_gpio_init(); -- ath79_register_uart(); -- ath79_register_wdt(); -- - mips_machine_setup(); - - return 0; diff --git a/target/linux/ath79/patches-4.14/0025-MIPS-ath79-drop-irq.c.patch b/target/linux/ath79/patches-4.14/0025-MIPS-ath79-drop-irq.c.patch deleted file mode 100644 index 95b29455f..000000000 --- a/target/linux/ath79/patches-4.14/0025-MIPS-ath79-drop-irq.c.patch +++ /dev/null @@ -1,336 +0,0 @@ -From 08b9cad7da5d981d595fe6d76e9675f85e23e688 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:57:15 +0100 -Subject: [PATCH 25/27] MIPS: ath79: drop irq.c - -all IRQ init code will flow via OF based irq chips. - -Signed-off-by: John Crispin ---- - arch/mips/ath79/Makefile | 2 +- - arch/mips/ath79/irq.c | 285 ----------------------------------------------- - arch/mips/ath79/setup.c | 6 + - 3 files changed, 7 insertions(+), 286 deletions(-) - delete mode 100644 arch/mips/ath79/irq.c - ---- a/arch/mips/ath79/Makefile -+++ b/arch/mips/ath79/Makefile -@@ -8,7 +8,7 @@ - # under the terms of the GNU General Public License version 2 as published - # by the Free Software Foundation. - --obj-y := prom.o setup.o irq.o common.o clock.o -+obj-y := prom.o setup.o common.o clock.o - - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - ---- a/arch/mips/ath79/irq.c -+++ /dev/null -@@ -1,285 +0,0 @@ --/* -- * Atheros AR71xx/AR724x/AR913x specific interrupt handling -- * -- * Copyright (C) 2010-2011 Jaiganesh Narayanan -- * Copyright (C) 2008-2011 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP -- * -- * 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 "common.h" --#include "machtypes.h" -- -- --static void ar934x_ip2_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(AR934X_RESET_REG_PCIE_WMAC_INT_STATUS); -- -- if (status & AR934X_PCIE_WMAC_INT_PCIE_ALL) { -- ath79_ddr_wb_flush(3); -- generic_handle_irq(ATH79_IP2_IRQ(0)); -- } else if (status & AR934X_PCIE_WMAC_INT_WMAC_ALL) { -- ath79_ddr_wb_flush(4); -- generic_handle_irq(ATH79_IP2_IRQ(1)); -- } else { -- spurious_interrupt(); -- } --} -- --static void ar934x_ip2_irq_init(void) --{ -- int i; -- -- for (i = ATH79_IP2_IRQ_BASE; -- i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, -- handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(2), ar934x_ip2_irq_dispatch); --} -- --static void qca953x_ip2_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS); -- -- if (status & QCA953X_PCIE_WMAC_INT_PCIE_ALL) { -- ath79_ddr_wb_flush(3); -- generic_handle_irq(ATH79_IP2_IRQ(0)); -- } else if (status & QCA953X_PCIE_WMAC_INT_WMAC_ALL) { -- ath79_ddr_wb_flush(4); -- generic_handle_irq(ATH79_IP2_IRQ(1)); -- } else { -- spurious_interrupt(); -- } --} -- --static void qca953x_irq_init(void) --{ -- int i; -- -- for (i = ATH79_IP2_IRQ_BASE; -- i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(2), qca953x_ip2_irq_dispatch); --} -- --static void qca955x_ip2_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(QCA955X_RESET_REG_EXT_INT_STATUS); -- status &= QCA955X_EXT_INT_PCIE_RC1_ALL | QCA955X_EXT_INT_WMAC_ALL; -- -- if (status == 0) { -- spurious_interrupt(); -- return; -- } -- -- if (status & QCA955X_EXT_INT_PCIE_RC1_ALL) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP2_IRQ(0)); -- } -- -- if (status & QCA955X_EXT_INT_WMAC_ALL) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP2_IRQ(1)); -- } --} -- --static void qca955x_ip3_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(QCA955X_RESET_REG_EXT_INT_STATUS); -- status &= QCA955X_EXT_INT_PCIE_RC2_ALL | -- QCA955X_EXT_INT_USB1 | -- QCA955X_EXT_INT_USB2; -- -- if (status == 0) { -- spurious_interrupt(); -- return; -- } -- -- if (status & QCA955X_EXT_INT_USB1) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(0)); -- } -- -- if (status & QCA955X_EXT_INT_USB2) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(1)); -- } -- -- if (status & QCA955X_EXT_INT_PCIE_RC2_ALL) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(2)); -- } --} -- --static void qca955x_irq_init(void) --{ -- int i; -- -- for (i = ATH79_IP2_IRQ_BASE; -- i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, -- handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(2), qca955x_ip2_irq_dispatch); -- -- for (i = ATH79_IP3_IRQ_BASE; -- i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, -- handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(3), qca955x_ip3_irq_dispatch); --} -- --static void qca956x_ip2_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -- status &= QCA956X_EXT_INT_PCIE_RC1_ALL | QCA956X_EXT_INT_WMAC_ALL; -- -- if (status == 0) { -- spurious_interrupt(); -- return; -- } -- -- if (status & QCA956X_EXT_INT_PCIE_RC1_ALL) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP2_IRQ(0)); -- } -- -- if (status & QCA956X_EXT_INT_WMAC_ALL) { -- /* TODO: flsuh DDR? */ -- generic_handle_irq(ATH79_IP2_IRQ(1)); -- } --} -- --static void qca956x_ip3_irq_dispatch(struct irq_desc *desc) --{ -- u32 status; -- -- status = ath79_reset_rr(QCA956X_RESET_REG_EXT_INT_STATUS); -- status &= QCA956X_EXT_INT_PCIE_RC2_ALL | -- QCA956X_EXT_INT_USB1 | QCA956X_EXT_INT_USB2; -- -- if (status == 0) { -- spurious_interrupt(); -- return; -- } -- -- if (status & QCA956X_EXT_INT_USB1) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(0)); -- } -- -- if (status & QCA956X_EXT_INT_USB2) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(1)); -- } -- -- if (status & QCA956X_EXT_INT_PCIE_RC2_ALL) { -- /* TODO: flush DDR? */ -- generic_handle_irq(ATH79_IP3_IRQ(2)); -- } --} -- --static void qca956x_enable_timer_cb(void) { -- u32 misc; -- -- misc = ath79_reset_rr(AR71XX_RESET_REG_MISC_INT_ENABLE); -- misc |= MISC_INT_MIPS_SI_TIMERINT_MASK; -- ath79_reset_wr(AR71XX_RESET_REG_MISC_INT_ENABLE, misc); --} -- --static void qca956x_irq_init(void) --{ -- int i; -- -- for (i = ATH79_IP2_IRQ_BASE; -- i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(2), qca956x_ip2_irq_dispatch); -- -- for (i = ATH79_IP3_IRQ_BASE; -- i < ATH79_IP3_IRQ_BASE + ATH79_IP3_IRQ_COUNT; i++) -- irq_set_chip_and_handler(i, &dummy_irq_chip, handle_level_irq); -- -- irq_set_chained_handler(ATH79_CPU_IRQ(3), qca956x_ip3_irq_dispatch); -- -- /* QCA956x timer init workaround has to be applied right before setting -- * up the clock. Else, there will be no jiffies */ -- late_time_init = &qca956x_enable_timer_cb; --} -- --void __init arch_init_irq(void) --{ -- unsigned irq_wb_chan2 = -1; -- unsigned irq_wb_chan3 = -1; -- bool misc_is_ar71xx; -- -- if (mips_machtype == ATH79_MACH_GENERIC_OF) { -- irqchip_init(); -- return; -- } -- -- if (soc_is_ar71xx() || soc_is_ar724x() || -- soc_is_ar913x() || soc_is_ar933x()) { -- irq_wb_chan2 = 3; -- irq_wb_chan3 = 2; -- } else if (soc_is_ar934x() || soc_is_qca953x()) { -- irq_wb_chan3 = 2; -- } -- -- ath79_cpu_irq_init(irq_wb_chan2, irq_wb_chan3); -- -- if (soc_is_ar71xx() || soc_is_ar913x()) -- misc_is_ar71xx = true; -- else if (soc_is_ar724x() || -- soc_is_ar933x() || -- soc_is_ar934x() || -- soc_is_qca953x() || -- soc_is_qca955x() || -- soc_is_qca956x() || -- soc_is_tp9343()) -- misc_is_ar71xx = false; -- else -- BUG(); -- ath79_misc_irq_init( -- ath79_reset_base + AR71XX_RESET_REG_MISC_INT_STATUS, -- ATH79_CPU_IRQ(6), ATH79_MISC_IRQ_BASE, misc_is_ar71xx); -- -- if (soc_is_ar934x()) -- ar934x_ip2_irq_init(); -- else if (soc_is_qca953x()) -- qca953x_irq_init(); -- else if (soc_is_qca955x()) -- qca955x_irq_init(); -- else if (soc_is_qca956x() || soc_is_tp9343()) -- qca956x_irq_init(); --} ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -310,6 +311,11 @@ void __init plat_time_init(void) - mips_hpt_frequency = cpu_clk_rate / 2; - } - -+void __init arch_init_irq(void) -+{ -+ irqchip_init(); -+} -+ - static int __init ath79_setup(void) - { - if (mips_machtype == ATH79_MACH_GENERIC_OF) diff --git a/target/linux/ath79/patches-4.14/0026-MIPS-ath79-sanitize-Kconfig-symbols.patch b/target/linux/ath79/patches-4.14/0026-MIPS-ath79-sanitize-Kconfig-symbols.patch deleted file mode 100644 index f9906516d..000000000 --- a/target/linux/ath79/patches-4.14/0026-MIPS-ath79-sanitize-Kconfig-symbols.patch +++ /dev/null @@ -1,111 +0,0 @@ -From deda44895d289a72a235359fc21f8a62ea44dc1c Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:33:26 +0100 -Subject: [PATCH 26/27] MIPS: ath79: sanitize Kconfig symbols - -Signed-off-by: John Crispin ---- - arch/mips/Kconfig | 2 ++ - arch/mips/ath79/Kconfig | 48 +++++------------------------------------------- - arch/mips/ath79/Makefile | 10 ---------- - arch/mips/pci/Makefile | 2 +- - 4 files changed, 8 insertions(+), 54 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -203,6 +203,8 @@ config ATH79 - select SYS_SUPPORTS_BIG_ENDIAN - select SYS_SUPPORTS_MIPS16 - select SYS_SUPPORTS_ZBOOT_UART_PROM -+ select HW_HAS_PCI -+ select USB_ARCH_HAS_EHCI - select USE_OF - help - Support for the Atheros AR71XX/AR724X/AR913X SoCs. ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -1,52 +1,14 @@ - # SPDX-License-Identifier: GPL-2.0 - if ATH79 - --config SOC_AR71XX -- select HW_HAS_PCI -- def_bool n -- --config SOC_AR724X -- select HW_HAS_PCI -- select PCI_AR724X if PCI -- def_bool n -- --config SOC_AR913X -- def_bool n -- --config SOC_AR933X -- def_bool n -- --config SOC_AR934X -- select HW_HAS_PCI -- select PCI_AR724X if PCI -- def_bool n -- --config SOC_QCA953X -- select USB_ARCH_HAS_EHCI -- def_bool n -- --config SOC_QCA955X -- select HW_HAS_PCI -- select PCI_AR724X if PCI -+config PCI_AR71XX -+ bool "PCI support for AR7100 type SoCs" -+ depends on PCI - def_bool n - - config PCI_AR724X -- def_bool n -- --config ATH79_DEV_GPIO_BUTTONS -- def_bool n -- --config ATH79_DEV_LEDS_GPIO -- def_bool n -- --config ATH79_DEV_SPI -- def_bool n -- --config ATH79_DEV_USB -- def_bool n -- --config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA953X || SOC_QCA955X || SOC_QCA956X) -+ bool "PCI support for AR724x type SoCs" -+ depends on PCI - def_bool n - - endif ---- a/arch/mips/ath79/Makefile -+++ b/arch/mips/ath79/Makefile -@@ -11,13 +11,3 @@ - obj-y := prom.o setup.o common.o clock.o - - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -- --# --# Devices --# --obj-y += dev-common.o --obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o --obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev-leds-gpio.o --obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o --obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o --obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o ---- a/arch/mips/pci/Makefile -+++ b/arch/mips/pci/Makefile -@@ -23,7 +23,7 @@ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o - ops-bcm63xx.o - obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o - obj-$(CONFIG_PCI_AR2315) += pci-ar2315.o --obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o -+obj-$(CONFIG_PCI_AR71XX) += pci-ar71xx.o - obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o - obj-$(CONFIG_MIPS_PCI_VIRTIO) += pci-virtio-guest.o - # diff --git a/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-mips_machine-support.patch b/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-mips_machine-support.patch deleted file mode 100644 index cde3bae67..000000000 --- a/target/linux/ath79/patches-4.14/0027-MIPS-ath79-drop-mips_machine-support.patch +++ /dev/null @@ -1,172 +0,0 @@ -From e03edbc8e68063b3fca7457fa048d8abe0045f1f Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:15:54 +0100 -Subject: [PATCH 27/27] MIPS: ath79: drop mips_machine support - -Signed-off-by: John Crispin ---- - arch/mips/Kconfig | 1 - - arch/mips/ath79/machtypes.h | 28 ----------------- - arch/mips/ath79/setup.c | 74 ++++++--------------------------------------- - 3 files changed, 10 insertions(+), 93 deletions(-) - delete mode 100644 arch/mips/ath79/machtypes.h - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -196,7 +196,6 @@ config ATH79 - select COMMON_CLK - select CLKDEV_LOOKUP - select IRQ_MIPS_CPU -- select MIPS_MACHINE - select SYS_HAS_CPU_MIPS32_R2 - select SYS_HAS_EARLY_PRINTK - select SYS_SUPPORTS_32BIT_KERNEL ---- a/arch/mips/ath79/machtypes.h -+++ /dev/null -@@ -1,28 +0,0 @@ --/* -- * Atheros AR71XX/AR724X/AR913X machine type definitions -- * -- * Copyright (C) 2008-2010 Gabor Juhos -- * Copyright (C) 2008 Imre Kaloz -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU General Public License version 2 as published -- * by the Free Software Foundation. -- */ -- --#ifndef _ATH79_MACHTYPE_H --#define _ATH79_MACHTYPE_H -- --#include -- --enum ath79_mach_type { -- ATH79_MACH_GENERIC_OF = -1, /* Device tree board */ -- ATH79_MACH_GENERIC = 0, -- ATH79_MACH_AP121, /* Atheros AP121 reference board */ -- ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */ -- ATH79_MACH_AP81, /* Atheros AP81 reference board */ -- ATH79_MACH_DB120, /* Atheros DB120 reference board */ -- ATH79_MACH_PB44, /* Atheros PB44 reference board */ -- ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ --}; -- --#endif /* _ATH79_MACHTYPE_H */ ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -32,7 +32,6 @@ - #include - #include - #include "common.h" --#include "machtypes.h" - - #define ATH79_SYS_TYPE_LEN 64 - -@@ -235,25 +234,21 @@ void __init plat_mem_setup(void) - else if (fw_passed_dtb) - __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb)); - -- if (mips_machtype != ATH79_MACH_GENERIC_OF) { -- ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, -- AR71XX_RESET_SIZE); -- ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, -- AR71XX_PLL_SIZE); -- ath79_detect_sys_type(); -- ath79_ddr_ctrl_init(); -+ ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE, -+ AR71XX_RESET_SIZE); -+ ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE, -+ AR71XX_PLL_SIZE); -+ ath79_detect_sys_type(); -+ ath79_ddr_ctrl_init(); - -- detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); -- -- /* OF machines should use the reset driver */ -- _machine_restart = ath79_restart; -- } -+ detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); - -+ _machine_restart = ath79_restart; - _machine_halt = ath79_halt; - pm_power_off = ath79_halt; - } - --static void __init ath79_of_plat_time_init(void) -+void __init plat_time_init(void) - { - struct device_node *np; - struct clk *clk; -@@ -283,62 +278,12 @@ static void __init ath79_of_plat_time_in - clk_put(clk); - } - --void __init plat_time_init(void) --{ -- unsigned long cpu_clk_rate; -- unsigned long ahb_clk_rate; -- unsigned long ddr_clk_rate; -- unsigned long ref_clk_rate; -- -- if (IS_ENABLED(CONFIG_OF) && mips_machtype == ATH79_MACH_GENERIC_OF) { -- ath79_of_plat_time_init(); -- return; -- } -- -- ath79_clocks_init(); -- -- cpu_clk_rate = ath79_get_sys_clk_rate("cpu"); -- ahb_clk_rate = ath79_get_sys_clk_rate("ahb"); -- ddr_clk_rate = ath79_get_sys_clk_rate("ddr"); -- ref_clk_rate = ath79_get_sys_clk_rate("ref"); -- -- pr_info("Clocks: CPU:%lu.%03luMHz, DDR:%lu.%03luMHz, AHB:%lu.%03luMHz, Ref:%lu.%03luMHz\n", -- cpu_clk_rate / 1000000, (cpu_clk_rate / 1000) % 1000, -- ddr_clk_rate / 1000000, (ddr_clk_rate / 1000) % 1000, -- ahb_clk_rate / 1000000, (ahb_clk_rate / 1000) % 1000, -- ref_clk_rate / 1000000, (ref_clk_rate / 1000) % 1000); -- -- mips_hpt_frequency = cpu_clk_rate / 2; --} -- - void __init arch_init_irq(void) - { - irqchip_init(); - } - --static int __init ath79_setup(void) --{ -- if (mips_machtype == ATH79_MACH_GENERIC_OF) -- return 0; -- -- mips_machine_setup(); -- -- return 0; --} -- --arch_initcall(ath79_setup); -- - void __init device_tree_init(void) - { - unflatten_and_copy_device_tree(); - } -- --MIPS_MACHINE(ATH79_MACH_GENERIC, -- "Generic", -- "Generic AR71XX/AR724X/AR913X based board", -- NULL); -- --MIPS_MACHINE(ATH79_MACH_GENERIC_OF, -- "DTB", -- "Generic AR71XX/AR724X/AR913X based board (DT)", -- NULL); ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -26,7 +26,6 @@ - #include - #include - #include "common.h" --#include "machtypes.h" - - #define AR71XX_BASE_FREQ 40000000 - #define AR724X_BASE_FREQ 40000000 diff --git a/target/linux/ath79/patches-4.14/0028-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch b/target/linux/ath79/patches-4.14/0028-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch deleted file mode 100644 index 15f6b1f8c..000000000 --- a/target/linux/ath79/patches-4.14/0028-MIPS-ath79-add-helpers-for-setting-clocks-and-expose.patch +++ /dev/null @@ -1,238 +0,0 @@ -From: Felix Fietkau -Date: Tue, 6 Mar 2018 13:19:26 +0100 -Subject: [PATCH] MIPS: ath79: add helpers for setting clocks and expose - the ref clock - -Preparation for transitioning legacy the legacy clock setup code over -to OF. - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -36,20 +36,46 @@ static struct clk_onecell_data clk_data - .clk_num = ARRAY_SIZE(clks), - }; - --static struct clk *__init ath79_add_sys_clkdev( -- const char *id, unsigned long rate) -+static const char * const clk_names[ATH79_CLK_END] = { -+ [ATH79_CLK_CPU] = "cpu", -+ [ATH79_CLK_DDR] = "ddr", -+ [ATH79_CLK_AHB] = "ahb", -+ [ATH79_CLK_REF] = "ref", -+}; -+ -+static const char * __init ath79_clk_name(int type) - { -- struct clk *clk; -- int err; -+ BUG_ON(type >= ARRAY_SIZE(clk_names) || !clk_names[type]); -+ return clk_names[type]; -+} - -- clk = clk_register_fixed_rate(NULL, id, NULL, 0, rate); -+static void __init __ath79_set_clk(int type, const char *name, struct clk *clk) -+{ - if (IS_ERR(clk)) -- panic("failed to allocate %s clock structure", id); -+ panic("failed to allocate %s clock structure", clk_names[type]); - -- err = clk_register_clkdev(clk, id, NULL); -- if (err) -- panic("unable to register %s clock device", id); -+ clks[type] = clk; -+ clk_register_clkdev(clk, name, NULL); -+} - -+static struct clk * __init ath79_set_clk(int type, unsigned long rate) -+{ -+ const char *name = ath79_clk_name(type); -+ struct clk *clk; -+ -+ clk = clk_register_fixed_rate(NULL, name, NULL, 0, rate); -+ __ath79_set_clk(type, name, clk); -+ return clk; -+} -+ -+static struct clk * __init ath79_set_ff_clk(int type, const char *parent, -+ unsigned int mult, unsigned int div) -+{ -+ const char *name = ath79_clk_name(type); -+ struct clk *clk; -+ -+ clk = clk_register_fixed_factor(NULL, name, parent, 0, mult, div); -+ __ath79_set_clk(type, name, clk); - return clk; - } - -@@ -79,27 +105,15 @@ static void __init ar71xx_clocks_init(vo - div = (((pll >> AR71XX_AHB_DIV_SHIFT) & AR71XX_AHB_DIV_MASK) + 1) * 2; - ahb_rate = cpu_rate / div; - -- ath79_add_sys_clkdev("ref", ref_rate); -- clks[ATH79_CLK_CPU] = ath79_add_sys_clkdev("cpu", cpu_rate); -- clks[ATH79_CLK_DDR] = ath79_add_sys_clkdev("ddr", ddr_rate); -- clks[ATH79_CLK_AHB] = ath79_add_sys_clkdev("ahb", ahb_rate); -+ ath79_set_clk(ATH79_CLK_REF, ref_rate); -+ ath79_set_clk(ATH79_CLK_CPU, cpu_rate); -+ ath79_set_clk(ATH79_CLK_DDR, ddr_rate); -+ ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - - clk_add_alias("wdt", NULL, "ahb", NULL); - clk_add_alias("uart", NULL, "ahb", NULL); - } - --static struct clk * __init ath79_reg_ffclk(const char *name, -- const char *parent_name, unsigned int mult, unsigned int div) --{ -- struct clk *clk; -- -- clk = clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div); -- if (IS_ERR(clk)) -- panic("failed to allocate %s clock structure", name); -- -- return clk; --} -- - static void __init ar724x_clk_init(struct clk *ref_clk, void __iomem *pll_base) - { - u32 pll; -@@ -113,24 +127,19 @@ static void __init ar724x_clk_init(struc - ddr_div = ((pll >> AR724X_DDR_DIV_SHIFT) & AR724X_DDR_DIV_MASK) + 1; - ahb_div = (((pll >> AR724X_AHB_DIV_SHIFT) & AR724X_AHB_DIV_MASK) + 1) * 2; - -- clks[ATH79_CLK_CPU] = ath79_reg_ffclk("cpu", "ref", mult, div); -- clks[ATH79_CLK_DDR] = ath79_reg_ffclk("ddr", "ref", mult, div * ddr_div); -- clks[ATH79_CLK_AHB] = ath79_reg_ffclk("ahb", "ref", mult, div * ahb_div); -+ ath79_set_ff_clk(ATH79_CLK_CPU, "ref", mult, div); -+ ath79_set_ff_clk(ATH79_CLK_DDR, "ref", mult, div * ddr_div); -+ ath79_set_ff_clk(ATH79_CLK_AHB, "ref", mult, div * ahb_div); - } - - static void __init ar724x_clocks_init(void) - { - struct clk *ref_clk; - -- ref_clk = ath79_add_sys_clkdev("ref", AR724X_BASE_FREQ); -+ ref_clk = ath79_set_clk(ATH79_CLK_REF, AR724X_BASE_FREQ); - - ar724x_clk_init(ref_clk, ath79_pll_base); - -- /* just make happy plat_time_init() from arch/mips/ath79/setup.c */ -- clk_register_clkdev(clks[ATH79_CLK_CPU], "cpu", NULL); -- clk_register_clkdev(clks[ATH79_CLK_DDR], "ddr", NULL); -- clk_register_clkdev(clks[ATH79_CLK_AHB], "ahb", NULL); -- - clk_add_alias("wdt", NULL, "ahb", NULL); - clk_add_alias("uart", NULL, "ahb", NULL); - } -@@ -185,12 +194,12 @@ static void __init ar9330_clk_init(struc - AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK) + 1; - } - -- clks[ATH79_CLK_CPU] = ath79_reg_ffclk("cpu", "ref", -- ninit_mul, ref_div * out_div * cpu_div); -- clks[ATH79_CLK_DDR] = ath79_reg_ffclk("ddr", "ref", -- ninit_mul, ref_div * out_div * ddr_div); -- clks[ATH79_CLK_AHB] = ath79_reg_ffclk("ahb", "ref", -- ninit_mul, ref_div * out_div * ahb_div); -+ ath79_set_ff_clk(ATH79_CLK_CPU, "ref", ninit_mul, -+ ref_div * out_div * cpu_div); -+ ath79_set_ff_clk(ATH79_CLK_DDR, "ref", ninit_mul, -+ ref_div * out_div * ddr_div); -+ ath79_set_ff_clk(ATH79_CLK_AHB, "ref", ninit_mul, -+ ref_div * out_div * ahb_div); - } - - static void __init ar933x_clocks_init(void) -@@ -205,15 +214,10 @@ static void __init ar933x_clocks_init(vo - else - ref_rate = (25 * 1000 * 1000); - -- ref_clk = ath79_add_sys_clkdev("ref", ref_rate); -+ ref_clk = ath79_set_clk(ATH79_CLK_REF, ref_rate); - - ar9330_clk_init(ref_clk, ath79_pll_base); - -- /* just make happy plat_time_init() from arch/mips/ath79/setup.c */ -- clk_register_clkdev(clks[ATH79_CLK_CPU], "cpu", NULL); -- clk_register_clkdev(clks[ATH79_CLK_DDR], "ddr", NULL); -- clk_register_clkdev(clks[ATH79_CLK_AHB], "ahb", NULL); -- - clk_add_alias("wdt", NULL, "ahb", NULL); - clk_add_alias("uart", NULL, "ref", NULL); - } -@@ -343,10 +347,10 @@ static void __init ar934x_clocks_init(vo - else - ahb_rate = cpu_pll / (postdiv + 1); - -- ath79_add_sys_clkdev("ref", ref_rate); -- clks[ATH79_CLK_CPU] = ath79_add_sys_clkdev("cpu", cpu_rate); -- clks[ATH79_CLK_DDR] = ath79_add_sys_clkdev("ddr", ddr_rate); -- clks[ATH79_CLK_AHB] = ath79_add_sys_clkdev("ahb", ahb_rate); -+ ath79_set_clk(ATH79_CLK_REF, ref_rate); -+ ath79_set_clk(ATH79_CLK_CPU, cpu_rate); -+ ath79_set_clk(ATH79_CLK_DDR, ddr_rate); -+ ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - - clk_add_alias("wdt", NULL, "ref", NULL); - clk_add_alias("uart", NULL, "ref", NULL); -@@ -430,10 +434,10 @@ static void __init qca953x_clocks_init(v - else - ahb_rate = cpu_pll / (postdiv + 1); - -- ath79_add_sys_clkdev("ref", ref_rate); -- ath79_add_sys_clkdev("cpu", cpu_rate); -- ath79_add_sys_clkdev("ddr", ddr_rate); -- ath79_add_sys_clkdev("ahb", ahb_rate); -+ ath79_set_clk(ATH79_CLK_REF, ref_rate); -+ ath79_set_clk(ATH79_CLK_CPU, cpu_rate); -+ ath79_set_clk(ATH79_CLK_DDR, ddr_rate); -+ ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - - clk_add_alias("wdt", NULL, "ref", NULL); - clk_add_alias("uart", NULL, "ref", NULL); -@@ -515,10 +519,10 @@ static void __init qca955x_clocks_init(v - else - ahb_rate = cpu_pll / (postdiv + 1); - -- ath79_add_sys_clkdev("ref", ref_rate); -- clks[ATH79_CLK_CPU] = ath79_add_sys_clkdev("cpu", cpu_rate); -- clks[ATH79_CLK_DDR] = ath79_add_sys_clkdev("ddr", ddr_rate); -- clks[ATH79_CLK_AHB] = ath79_add_sys_clkdev("ahb", ahb_rate); -+ ath79_set_clk(ATH79_CLK_REF, ref_rate); -+ ath79_set_clk(ATH79_CLK_CPU, cpu_rate); -+ ath79_set_clk(ATH79_CLK_DDR, ddr_rate); -+ ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - - clk_add_alias("wdt", NULL, "ref", NULL); - clk_add_alias("uart", NULL, "ref", NULL); -@@ -609,10 +613,10 @@ static void __init qca956x_clocks_init(v - else - ahb_rate = cpu_pll / (postdiv + 1); - -- ath79_add_sys_clkdev("ref", ref_rate); -- ath79_add_sys_clkdev("cpu", cpu_rate); -- ath79_add_sys_clkdev("ddr", ddr_rate); -- ath79_add_sys_clkdev("ahb", ahb_rate); -+ ath79_set_clk(ATH79_CLK_REF, ref_rate); -+ ath79_set_clk(ATH79_CLK_CPU, cpu_rate); -+ ath79_set_clk(ATH79_CLK_DDR, ddr_rate); -+ ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - - clk_add_alias("wdt", NULL, "ref", NULL); - clk_add_alias("uart", NULL, "ref", NULL); ---- a/include/dt-bindings/clock/ath79-clk.h -+++ b/include/dt-bindings/clock/ath79-clk.h -@@ -13,7 +13,8 @@ - #define ATH79_CLK_CPU 0 - #define ATH79_CLK_DDR 1 - #define ATH79_CLK_AHB 2 -+#define ATH79_CLK_REF 3 - --#define ATH79_CLK_END 3 -+#define ATH79_CLK_END 4 - - #endif /* __DT_BINDINGS_ATH79_CLK_H */ diff --git a/target/linux/ath79/patches-4.14/0029-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch b/target/linux/ath79/patches-4.14/0029-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch deleted file mode 100644 index 07e750a96..000000000 --- a/target/linux/ath79/patches-4.14/0029-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch +++ /dev/null @@ -1,110 +0,0 @@ -From: Felix Fietkau -Date: Tue, 6 Mar 2018 13:22:43 +0100 -Subject: [PATCH] MIPS: ath79: move legacy "wdt" and "uart" clock aliases - out of soc init - -Preparation for reusing functions for DT - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -109,9 +109,6 @@ static void __init ar71xx_clocks_init(vo - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -- -- clk_add_alias("wdt", NULL, "ahb", NULL); -- clk_add_alias("uart", NULL, "ahb", NULL); - } - - static void __init ar724x_clk_init(struct clk *ref_clk, void __iomem *pll_base) -@@ -139,9 +136,6 @@ static void __init ar724x_clocks_init(vo - ref_clk = ath79_set_clk(ATH79_CLK_REF, AR724X_BASE_FREQ); - - ar724x_clk_init(ref_clk, ath79_pll_base); -- -- clk_add_alias("wdt", NULL, "ahb", NULL); -- clk_add_alias("uart", NULL, "ahb", NULL); - } - - static void __init ar9330_clk_init(struct clk *ref_clk, void __iomem *pll_base) -@@ -217,9 +211,6 @@ static void __init ar933x_clocks_init(vo - ref_clk = ath79_set_clk(ATH79_CLK_REF, ref_rate); - - ar9330_clk_init(ref_clk, ath79_pll_base); -- -- clk_add_alias("wdt", NULL, "ahb", NULL); -- clk_add_alias("uart", NULL, "ref", NULL); - } - - static u32 __init ar934x_get_pll_freq(u32 ref, u32 ref_div, u32 nint, u32 nfrac, -@@ -352,9 +343,6 @@ static void __init ar934x_clocks_init(vo - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - -- clk_add_alias("wdt", NULL, "ref", NULL); -- clk_add_alias("uart", NULL, "ref", NULL); -- - iounmap(dpll_base); - } - -@@ -438,9 +426,6 @@ static void __init qca953x_clocks_init(v - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -- -- clk_add_alias("wdt", NULL, "ref", NULL); -- clk_add_alias("uart", NULL, "ref", NULL); - } - - static void __init qca955x_clocks_init(void) -@@ -523,9 +508,6 @@ static void __init qca955x_clocks_init(v - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -- -- clk_add_alias("wdt", NULL, "ref", NULL); -- clk_add_alias("uart", NULL, "ref", NULL); - } - - static void __init qca956x_clocks_init(void) -@@ -617,13 +599,13 @@ static void __init qca956x_clocks_init(v - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -- -- clk_add_alias("wdt", NULL, "ref", NULL); -- clk_add_alias("uart", NULL, "ref", NULL); - } - - void __init ath79_clocks_init(void) - { -+ const char *wdt; -+ const char *uart; -+ - if (soc_is_ar71xx()) - ar71xx_clocks_init(); - else if (soc_is_ar724x() || soc_is_ar913x()) -@@ -640,6 +622,20 @@ void __init ath79_clocks_init(void) - qca956x_clocks_init(); - else - BUG(); -+ -+ if (soc_is_ar71xx() || soc_is_ar724x() || soc_is_ar913x()) { -+ wdt = "ahb"; -+ uart = "ahb"; -+ } else if (soc_is_ar933x()) { -+ wdt = "ahb"; -+ uart = "ref"; -+ } else { -+ wdt = "ref"; -+ uart = "ref"; -+ } -+ -+ clk_add_alias("wdt", NULL, wdt, NULL); -+ clk_add_alias("uart", NULL, uart, NULL); - } - - unsigned long __init diff --git a/target/linux/ath79/patches-4.14/0030-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch b/target/linux/ath79/patches-4.14/0030-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch deleted file mode 100644 index d326880d8..000000000 --- a/target/linux/ath79/patches-4.14/0030-MIPS-ath79-pass-PLL-base-to-clock-init-functions.patch +++ /dev/null @@ -1,238 +0,0 @@ -From: Felix Fietkau -Date: Tue, 6 Mar 2018 13:23:20 +0100 -Subject: [PATCH] MIPS: ath79: pass PLL base to clock init functions - -Preparation for passing the mapped base via DT - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -79,7 +79,7 @@ static struct clk * __init ath79_set_ff_ - return clk; - } - --static void __init ar71xx_clocks_init(void) -+static void __init ar71xx_clocks_init(void __iomem *pll_base) - { - unsigned long ref_rate; - unsigned long cpu_rate; -@@ -91,7 +91,7 @@ static void __init ar71xx_clocks_init(vo - - ref_rate = AR71XX_BASE_FREQ; - -- pll = ath79_pll_rr(AR71XX_PLL_REG_CPU_CONFIG); -+ pll = __raw_readl(pll_base + AR71XX_PLL_REG_CPU_CONFIG); - - div = ((pll >> AR71XX_PLL_FB_SHIFT) & AR71XX_PLL_FB_MASK) + 1; - freq = div * ref_rate; -@@ -129,13 +129,13 @@ static void __init ar724x_clk_init(struc - ath79_set_ff_clk(ATH79_CLK_AHB, "ref", mult, div * ahb_div); - } - --static void __init ar724x_clocks_init(void) -+static void __init ar724x_clocks_init(void __iomem *pll_base) - { - struct clk *ref_clk; - - ref_clk = ath79_set_clk(ATH79_CLK_REF, AR724X_BASE_FREQ); - -- ar724x_clk_init(ref_clk, ath79_pll_base); -+ ar724x_clk_init(ref_clk, pll_base); - } - - static void __init ar9330_clk_init(struct clk *ref_clk, void __iomem *pll_base) -@@ -196,7 +196,7 @@ static void __init ar9330_clk_init(struc - ref_div * out_div * ahb_div); - } - --static void __init ar933x_clocks_init(void) -+static void __init ar933x_clocks_init(void __iomem *pll_base) - { - struct clk *ref_clk; - unsigned long ref_rate; -@@ -233,7 +233,7 @@ static u32 __init ar934x_get_pll_freq(u3 - return ret; - } - --static void __init ar934x_clocks_init(void) -+static void __init ar934x_clocks_init(void __iomem *pll_base) - { - unsigned long ref_rate; - unsigned long cpu_rate; -@@ -264,7 +264,7 @@ static void __init ar934x_clocks_init(vo - AR934X_SRIF_DPLL1_REFDIV_MASK; - frac = 1 << 18; - } else { -- pll = ath79_pll_rr(AR934X_PLL_CPU_CONFIG_REG); -+ pll = __raw_readl(pll_base + AR934X_PLL_CPU_CONFIG_REG); - out_div = (pll >> AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & - AR934X_PLL_CPU_CONFIG_OUTDIV_MASK; - ref_div = (pll >> AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -@@ -291,7 +291,7 @@ static void __init ar934x_clocks_init(vo - AR934X_SRIF_DPLL1_REFDIV_MASK; - frac = 1 << 18; - } else { -- pll = ath79_pll_rr(AR934X_PLL_DDR_CONFIG_REG); -+ pll = __raw_readl(pll_base + AR934X_PLL_DDR_CONFIG_REG); - out_div = (pll >> AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & - AR934X_PLL_DDR_CONFIG_OUTDIV_MASK; - ref_div = (pll >> AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -@@ -306,7 +306,7 @@ static void __init ar934x_clocks_init(vo - ddr_pll = ar934x_get_pll_freq(ref_rate, ref_div, nint, - nfrac, frac, out_div); - -- clk_ctrl = ath79_pll_rr(AR934X_PLL_CPU_DDR_CLK_CTRL_REG); -+ clk_ctrl = __raw_readl(pll_base + AR934X_PLL_CPU_DDR_CLK_CTRL_REG); - - postdiv = (clk_ctrl >> AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT) & - AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK; -@@ -346,7 +346,7 @@ static void __init ar934x_clocks_init(vo - iounmap(dpll_base); - } - --static void __init qca953x_clocks_init(void) -+static void __init qca953x_clocks_init(void __iomem *pll_base) - { - unsigned long ref_rate; - unsigned long cpu_rate; -@@ -362,7 +362,7 @@ static void __init qca953x_clocks_init(v - else - ref_rate = 25 * 1000 * 1000; - -- pll = ath79_pll_rr(QCA953X_PLL_CPU_CONFIG_REG); -+ pll = __raw_readl(pll_base + QCA953X_PLL_CPU_CONFIG_REG); - out_div = (pll >> QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & - QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK; - ref_div = (pll >> QCA953X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -@@ -376,7 +376,7 @@ static void __init qca953x_clocks_init(v - cpu_pll += frac * (ref_rate >> 6) / ref_div; - cpu_pll /= (1 << out_div); - -- pll = ath79_pll_rr(QCA953X_PLL_DDR_CONFIG_REG); -+ pll = __raw_readl(pll_base + QCA953X_PLL_DDR_CONFIG_REG); - out_div = (pll >> QCA953X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & - QCA953X_PLL_DDR_CONFIG_OUTDIV_MASK; - ref_div = (pll >> QCA953X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -@@ -390,7 +390,7 @@ static void __init qca953x_clocks_init(v - ddr_pll += frac * (ref_rate >> 6) / (ref_div << 4); - ddr_pll /= (1 << out_div); - -- clk_ctrl = ath79_pll_rr(QCA953X_PLL_CLK_CTRL_REG); -+ clk_ctrl = __raw_readl(pll_base + QCA953X_PLL_CLK_CTRL_REG); - - postdiv = (clk_ctrl >> QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & - QCA953X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -@@ -428,7 +428,7 @@ static void __init qca953x_clocks_init(v - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - } - --static void __init qca955x_clocks_init(void) -+static void __init qca955x_clocks_init(void __iomem *pll_base) - { - unsigned long ref_rate; - unsigned long cpu_rate; -@@ -444,7 +444,7 @@ static void __init qca955x_clocks_init(v - else - ref_rate = 25 * 1000 * 1000; - -- pll = ath79_pll_rr(QCA955X_PLL_CPU_CONFIG_REG); -+ pll = __raw_readl(pll_base + QCA955X_PLL_CPU_CONFIG_REG); - out_div = (pll >> QCA955X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & - QCA955X_PLL_CPU_CONFIG_OUTDIV_MASK; - ref_div = (pll >> QCA955X_PLL_CPU_CONFIG_REFDIV_SHIFT) & -@@ -458,7 +458,7 @@ static void __init qca955x_clocks_init(v - cpu_pll += frac * ref_rate / (ref_div * (1 << 6)); - cpu_pll /= (1 << out_div); - -- pll = ath79_pll_rr(QCA955X_PLL_DDR_CONFIG_REG); -+ pll = __raw_readl(pll_base + QCA955X_PLL_DDR_CONFIG_REG); - out_div = (pll >> QCA955X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & - QCA955X_PLL_DDR_CONFIG_OUTDIV_MASK; - ref_div = (pll >> QCA955X_PLL_DDR_CONFIG_REFDIV_SHIFT) & -@@ -472,7 +472,7 @@ static void __init qca955x_clocks_init(v - ddr_pll += frac * ref_rate / (ref_div * (1 << 10)); - ddr_pll /= (1 << out_div); - -- clk_ctrl = ath79_pll_rr(QCA955X_PLL_CLK_CTRL_REG); -+ clk_ctrl = __raw_readl(pll_base + QCA955X_PLL_CLK_CTRL_REG); - - postdiv = (clk_ctrl >> QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & - QCA955X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -@@ -510,7 +510,7 @@ static void __init qca955x_clocks_init(v - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - } - --static void __init qca956x_clocks_init(void) -+static void __init qca956x_clocks_init(void __iomem *pll_base) - { - unsigned long ref_rate; - unsigned long cpu_rate; -@@ -526,13 +526,13 @@ static void __init qca956x_clocks_init(v - else - ref_rate = 25 * 1000 * 1000; - -- pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG_REG); -+ pll = __raw_readl(pll_base + QCA956X_PLL_CPU_CONFIG_REG); - out_div = (pll >> QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & - QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK; - ref_div = (pll >> QCA956X_PLL_CPU_CONFIG_REFDIV_SHIFT) & - QCA956X_PLL_CPU_CONFIG_REFDIV_MASK; - -- pll = ath79_pll_rr(QCA956X_PLL_CPU_CONFIG1_REG); -+ pll = __raw_readl(pll_base + QCA956X_PLL_CPU_CONFIG1_REG); - nint = (pll >> QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT) & - QCA956X_PLL_CPU_CONFIG1_NINT_MASK; - hfrac = (pll >> QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT) & -@@ -545,12 +545,12 @@ static void __init qca956x_clocks_init(v - cpu_pll += (hfrac >> 13) * ref_rate / ref_div; - cpu_pll /= (1 << out_div); - -- pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG_REG); -+ pll = __raw_readl(pll_base + QCA956X_PLL_DDR_CONFIG_REG); - out_div = (pll >> QCA956X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & - QCA956X_PLL_DDR_CONFIG_OUTDIV_MASK; - ref_div = (pll >> QCA956X_PLL_DDR_CONFIG_REFDIV_SHIFT) & - QCA956X_PLL_DDR_CONFIG_REFDIV_MASK; -- pll = ath79_pll_rr(QCA956X_PLL_DDR_CONFIG1_REG); -+ pll = __raw_readl(pll_base + QCA956X_PLL_DDR_CONFIG1_REG); - nint = (pll >> QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT) & - QCA956X_PLL_DDR_CONFIG1_NINT_MASK; - hfrac = (pll >> QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT) & -@@ -563,7 +563,7 @@ static void __init qca956x_clocks_init(v - ddr_pll += (hfrac >> 13) * ref_rate / ref_div; - ddr_pll /= (1 << out_div); - -- clk_ctrl = ath79_pll_rr(QCA956X_PLL_CLK_CTRL_REG); -+ clk_ctrl = __raw_readl(pll_base + QCA956X_PLL_CLK_CTRL_REG); - - postdiv = (clk_ctrl >> QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_SHIFT) & - QCA956X_PLL_CLK_CTRL_CPU_POST_DIV_MASK; -@@ -607,19 +607,19 @@ void __init ath79_clocks_init(void) - const char *uart; - - if (soc_is_ar71xx()) -- ar71xx_clocks_init(); -+ ar71xx_clocks_init(ath79_pll_base); - else if (soc_is_ar724x() || soc_is_ar913x()) -- ar724x_clocks_init(); -+ ar724x_clocks_init(ath79_pll_base); - else if (soc_is_ar933x()) -- ar933x_clocks_init(); -+ ar933x_clocks_init(ath79_pll_base); - else if (soc_is_ar934x()) -- ar934x_clocks_init(); -+ ar934x_clocks_init(ath79_pll_base); - else if (soc_is_qca953x()) -- qca953x_clocks_init(); -+ qca953x_clocks_init(ath79_pll_base); - else if (soc_is_qca955x()) -- qca955x_clocks_init(); -+ qca955x_clocks_init(ath79_pll_base); - else if (soc_is_qca956x() || soc_is_tp9343()) -- qca956x_clocks_init(); -+ qca956x_clocks_init(ath79_pll_base); - else - BUG(); - diff --git a/target/linux/ath79/patches-4.14/0031-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch b/target/linux/ath79/patches-4.14/0031-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch deleted file mode 100644 index 9cadc02d3..000000000 --- a/target/linux/ath79/patches-4.14/0031-MIPS-ath79-make-specifying-the-reference-clock-in-DT.patch +++ /dev/null @@ -1,225 +0,0 @@ -From: Felix Fietkau -Date: Tue, 6 Mar 2018 13:24:07 +0100 -Subject: [PATCH] MIPS: ath79: make specifying the reference clock in DT - optional - -It can be autodetected for many SoCs using the strapping options. -If the clock is specified in DT, the autodetected value is ignored - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -79,6 +79,18 @@ static struct clk * __init ath79_set_ff_ - return clk; - } - -+static unsigned long __init ath79_setup_ref_clk(unsigned long rate) -+{ -+ struct clk *clk = clks[ATH79_CLK_REF]; -+ -+ if (clk) -+ rate = clk_get_rate(clk); -+ else -+ clk = ath79_set_clk(ATH79_CLK_REF, rate); -+ -+ return rate; -+} -+ - static void __init ar71xx_clocks_init(void __iomem *pll_base) - { - unsigned long ref_rate; -@@ -89,7 +101,7 @@ static void __init ar71xx_clocks_init(vo - u32 freq; - u32 div; - -- ref_rate = AR71XX_BASE_FREQ; -+ ref_rate = ath79_setup_ref_clk(AR71XX_BASE_FREQ); - - pll = __raw_readl(pll_base + AR71XX_PLL_REG_CPU_CONFIG); - -@@ -105,16 +117,17 @@ static void __init ar71xx_clocks_init(vo - div = (((pll >> AR71XX_AHB_DIV_SHIFT) & AR71XX_AHB_DIV_MASK) + 1) * 2; - ahb_rate = cpu_rate / div; - -- ath79_set_clk(ATH79_CLK_REF, ref_rate); - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - } - --static void __init ar724x_clk_init(struct clk *ref_clk, void __iomem *pll_base) -+static void __init ar724x_clocks_init(void __iomem *pll_base) - { -- u32 pll; - u32 mult, div, ddr_div, ahb_div; -+ u32 pll; -+ -+ ath79_setup_ref_clk(AR71XX_BASE_FREQ); - - pll = __raw_readl(pll_base + AR724X_PLL_REG_CPU_CONFIG); - -@@ -129,17 +142,9 @@ static void __init ar724x_clk_init(struc - ath79_set_ff_clk(ATH79_CLK_AHB, "ref", mult, div * ahb_div); - } - --static void __init ar724x_clocks_init(void __iomem *pll_base) --{ -- struct clk *ref_clk; -- -- ref_clk = ath79_set_clk(ATH79_CLK_REF, AR724X_BASE_FREQ); -- -- ar724x_clk_init(ref_clk, pll_base); --} -- --static void __init ar9330_clk_init(struct clk *ref_clk, void __iomem *pll_base) -+static void __init ar933x_clocks_init(void __iomem *pll_base) - { -+ unsigned long ref_rate; - u32 clock_ctrl; - u32 ref_div; - u32 ninit_mul; -@@ -148,6 +153,15 @@ static void __init ar9330_clk_init(struc - u32 cpu_div; - u32 ddr_div; - u32 ahb_div; -+ u32 t; -+ -+ t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); -+ if (t & AR933X_BOOTSTRAP_REF_CLK_40) -+ ref_rate = (40 * 1000 * 1000); -+ else -+ ref_rate = (25 * 1000 * 1000); -+ -+ ath79_setup_ref_clk(ref_rate); - - clock_ctrl = __raw_readl(pll_base + AR933X_PLL_CLOCK_CTRL_REG); - if (clock_ctrl & AR933X_PLL_CLOCK_CTRL_BYPASS) { -@@ -196,23 +210,6 @@ static void __init ar9330_clk_init(struc - ref_div * out_div * ahb_div); - } - --static void __init ar933x_clocks_init(void __iomem *pll_base) --{ -- struct clk *ref_clk; -- unsigned long ref_rate; -- u32 t; -- -- t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); -- if (t & AR933X_BOOTSTRAP_REF_CLK_40) -- ref_rate = (40 * 1000 * 1000); -- else -- ref_rate = (25 * 1000 * 1000); -- -- ref_clk = ath79_set_clk(ATH79_CLK_REF, ref_rate); -- -- ar9330_clk_init(ref_clk, ath79_pll_base); --} -- - static u32 __init ar934x_get_pll_freq(u32 ref, u32 ref_div, u32 nint, u32 nfrac, - u32 frac, u32 out_div) - { -@@ -252,6 +249,8 @@ static void __init ar934x_clocks_init(vo - else - ref_rate = 25 * 1000 * 1000; - -+ ref_rate = ath79_setup_ref_clk(ref_rate); -+ - pll = __raw_readl(dpll_base + AR934X_SRIF_CPU_DPLL2_REG); - if (pll & AR934X_SRIF_DPLL2_LOCAL_PLL) { - out_div = (pll >> AR934X_SRIF_DPLL2_OUTDIV_SHIFT) & -@@ -338,7 +337,6 @@ static void __init ar934x_clocks_init(vo - else - ahb_rate = cpu_pll / (postdiv + 1); - -- ath79_set_clk(ATH79_CLK_REF, ref_rate); - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -@@ -362,6 +360,8 @@ static void __init qca953x_clocks_init(v - else - ref_rate = 25 * 1000 * 1000; - -+ ref_rate = ath79_setup_ref_clk(ref_rate); -+ - pll = __raw_readl(pll_base + QCA953X_PLL_CPU_CONFIG_REG); - out_div = (pll >> QCA953X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & - QCA953X_PLL_CPU_CONFIG_OUTDIV_MASK; -@@ -422,7 +422,6 @@ static void __init qca953x_clocks_init(v - else - ahb_rate = cpu_pll / (postdiv + 1); - -- ath79_set_clk(ATH79_CLK_REF, ref_rate); - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -@@ -444,6 +443,8 @@ static void __init qca955x_clocks_init(v - else - ref_rate = 25 * 1000 * 1000; - -+ ref_rate = ath79_setup_ref_clk(ref_rate); -+ - pll = __raw_readl(pll_base + QCA955X_PLL_CPU_CONFIG_REG); - out_div = (pll >> QCA955X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & - QCA955X_PLL_CPU_CONFIG_OUTDIV_MASK; -@@ -504,7 +505,6 @@ static void __init qca955x_clocks_init(v - else - ahb_rate = cpu_pll / (postdiv + 1); - -- ath79_set_clk(ATH79_CLK_REF, ref_rate); - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -@@ -526,6 +526,8 @@ static void __init qca956x_clocks_init(v - else - ref_rate = 25 * 1000 * 1000; - -+ ref_rate = ath79_setup_ref_clk(ref_rate); -+ - pll = __raw_readl(pll_base + QCA956X_PLL_CPU_CONFIG_REG); - out_div = (pll >> QCA956X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & - QCA956X_PLL_CPU_CONFIG_OUTDIV_MASK; -@@ -595,7 +597,6 @@ static void __init qca956x_clocks_init(v - else - ahb_rate = cpu_pll / (postdiv + 1); - -- ath79_set_clk(ATH79_CLK_REF, ref_rate); - ath79_set_clk(ATH79_CLK_CPU, cpu_rate); - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); -@@ -671,10 +672,8 @@ static void __init ath79_clocks_init_dt_ - void __iomem *pll_base; - - ref_clk = of_clk_get(np, 0); -- if (IS_ERR(ref_clk)) { -- pr_err("%pOF: of_clk_get failed\n", np); -- goto err; -- } -+ if (!IS_ERR(ref_clk)) -+ clks[ATH79_CLK_REF] = ref_clk; - - pll_base = of_iomap(np, 0); - if (!pll_base) { -@@ -683,9 +682,9 @@ static void __init ath79_clocks_init_dt_ - } - - if (of_device_is_compatible(np, "qca,ar9130-pll")) -- ar724x_clk_init(ref_clk, pll_base); -+ ar724x_clocks_init(pll_base); - else if (of_device_is_compatible(np, "qca,ar9330-pll")) -- ar9330_clk_init(ref_clk, pll_base); -+ ar933x_clocks_init(pll_base); - else { - pr_err("%pOF: could not find any appropriate clk_init()\n", np); - goto err_iounmap; -@@ -703,9 +702,6 @@ err_iounmap: - - err_clk: - clk_put(ref_clk); -- --err: -- return; - } - CLK_OF_DECLARE(ar9130_clk, "qca,ar9130-pll", ath79_clocks_init_dt_ng); - CLK_OF_DECLARE(ar9330_clk, "qca,ar9330-pll", ath79_clocks_init_dt_ng); diff --git a/target/linux/ath79/patches-4.14/0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch b/target/linux/ath79/patches-4.14/0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch deleted file mode 100644 index 35c6ea7db..000000000 --- a/target/linux/ath79/patches-4.14/0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch +++ /dev/null @@ -1,73 +0,0 @@ -From: Felix Fietkau -Date: Tue, 6 Mar 2018 13:26:27 +0100 -Subject: [PATCH] MIPS: ath79: support setting up clock via DT on all SoC - types - -Use the same functions as the legacy code - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -658,16 +658,6 @@ ath79_get_sys_clk_rate(const char *id) - #ifdef CONFIG_OF - static void __init ath79_clocks_init_dt(struct device_node *np) - { -- of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); --} -- --CLK_OF_DECLARE(ar7100, "qca,ar7100-pll", ath79_clocks_init_dt); --CLK_OF_DECLARE(ar7240, "qca,ar7240-pll", ath79_clocks_init_dt); --CLK_OF_DECLARE(ar9340, "qca,ar9340-pll", ath79_clocks_init_dt); --CLK_OF_DECLARE(ar9550, "qca,qca9550-pll", ath79_clocks_init_dt); -- --static void __init ath79_clocks_init_dt_ng(struct device_node *np) --{ - struct clk *ref_clk; - void __iomem *pll_base; - -@@ -681,14 +671,21 @@ static void __init ath79_clocks_init_dt_ - goto err_clk; - } - -- if (of_device_is_compatible(np, "qca,ar9130-pll")) -+ if (of_device_is_compatible(np, "qca,ar7100-pll")) -+ ar71xx_clocks_init(pll_base); -+ else if (of_device_is_compatible(np, "qca,ar7240-pll") || -+ of_device_is_compatible(np, "qca,ar9130-pll")) - ar724x_clocks_init(pll_base); - else if (of_device_is_compatible(np, "qca,ar9330-pll")) - ar933x_clocks_init(pll_base); -- else { -- pr_err("%pOF: could not find any appropriate clk_init()\n", np); -- goto err_iounmap; -- } -+ else if (of_device_is_compatible(np, "qca,ar9340-pll")) -+ ar934x_clocks_init(pll_base); -+ else if (of_device_is_compatible(np, "qca,qca9530-pll")) -+ qca953x_clocks_init(pll_base); -+ else if (of_device_is_compatible(np, "qca,qca9550-pll")) -+ qca955x_clocks_init(pll_base); -+ else if (of_device_is_compatible(np, "qca,qca9560-pll")) -+ qca956x_clocks_init(pll_base); - - if (of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data)) { - pr_err("%pOF: could not register clk provider\n", np); -@@ -703,6 +700,14 @@ err_iounmap: - err_clk: - clk_put(ref_clk); - } --CLK_OF_DECLARE(ar9130_clk, "qca,ar9130-pll", ath79_clocks_init_dt_ng); --CLK_OF_DECLARE(ar9330_clk, "qca,ar9330-pll", ath79_clocks_init_dt_ng); -+ -+CLK_OF_DECLARE(ar7100_clk, "qca,ar7100-pll", ath79_clocks_init_dt); -+CLK_OF_DECLARE(ar7240_clk, "qca,ar7240-pll", ath79_clocks_init_dt); -+CLK_OF_DECLARE(ar9130_clk, "qca,ar9130-pll", ath79_clocks_init_dt); -+CLK_OF_DECLARE(ar9330_clk, "qca,ar9330-pll", ath79_clocks_init_dt); -+CLK_OF_DECLARE(ar9340_clk, "qca,ar9340-pll", ath79_clocks_init_dt); -+CLK_OF_DECLARE(ar9530_clk, "qca,qca9530-pll", ath79_clocks_init_dt); -+CLK_OF_DECLARE(ar9550_clk, "qca,qca9550-pll", ath79_clocks_init_dt); -+CLK_OF_DECLARE(ar9560_clk, "qca,qca9560-pll", ath79_clocks_init_dt); -+ - #endif diff --git a/target/linux/ath79/patches-4.14/0033-MIPS-ath79-export-switch-MDIO-reference-clock.patch b/target/linux/ath79/patches-4.14/0033-MIPS-ath79-export-switch-MDIO-reference-clock.patch deleted file mode 100644 index 6530344ce..000000000 --- a/target/linux/ath79/patches-4.14/0033-MIPS-ath79-export-switch-MDIO-reference-clock.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Felix Fietkau -Date: Tue, 6 Mar 2018 13:27:28 +0100 -Subject: [PATCH] MIPS: ath79: export switch MDIO reference clock - -On AR934x, the MDIO reference clock can be configured to a fixed 100 MHz -clock. If that feature is not used, it defaults to the main reference clock, -like on all other SoC. - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -41,6 +41,7 @@ static const char * const clk_names[ATH7 - [ATH79_CLK_DDR] = "ddr", - [ATH79_CLK_AHB] = "ahb", - [ATH79_CLK_REF] = "ref", -+ [ATH79_CLK_MDIO] = "mdio", - }; - - static const char * __init ath79_clk_name(int type) -@@ -341,6 +342,10 @@ static void __init ar934x_clocks_init(vo - ath79_set_clk(ATH79_CLK_DDR, ddr_rate); - ath79_set_clk(ATH79_CLK_AHB, ahb_rate); - -+ clk_ctrl = __raw_readl(pll_base + AR934X_PLL_SWITCH_CLOCK_CONTROL_REG); -+ if (clk_ctrl & AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL) -+ ath79_set_clk(ATH79_CLK_MDIO, 100 * 1000 * 1000); -+ - iounmap(dpll_base); - } - -@@ -687,6 +692,9 @@ static void __init ath79_clocks_init_dt( - else if (of_device_is_compatible(np, "qca,qca9560-pll")) - qca956x_clocks_init(pll_base); - -+ if (!clks[ATH79_CLK_MDIO]) -+ clks[ATH79_CLK_MDIO] = clks[ATH79_CLK_REF]; -+ - if (of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data)) { - pr_err("%pOF: could not register clk provider\n", np); - goto err_iounmap; ---- a/include/dt-bindings/clock/ath79-clk.h -+++ b/include/dt-bindings/clock/ath79-clk.h -@@ -14,7 +14,8 @@ - #define ATH79_CLK_DDR 1 - #define ATH79_CLK_AHB 2 - #define ATH79_CLK_REF 3 -+#define ATH79_CLK_MDIO 4 - --#define ATH79_CLK_END 4 -+#define ATH79_CLK_END 5 - - #endif /* __DT_BINDINGS_ATH79_CLK_H */ diff --git a/target/linux/ath79/patches-4.14/0034-MIPS-ath79-ath9k-exports.patch b/target/linux/ath79/patches-4.14/0034-MIPS-ath79-ath9k-exports.patch deleted file mode 100644 index 6eec142c7..000000000 --- a/target/linux/ath79/patches-4.14/0034-MIPS-ath79-ath9k-exports.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -34,11 +34,13 @@ EXPORT_SYMBOL_GPL(ath79_ddr_freq); - - enum ath79_soc_type ath79_soc; - unsigned int ath79_soc_rev; -+EXPORT_SYMBOL_GPL(ath79_soc_rev); - - void __iomem *ath79_pll_base; - void __iomem *ath79_reset_base; - EXPORT_SYMBOL_GPL(ath79_reset_base); --static void __iomem *ath79_ddr_base; -+void __iomem *ath79_ddr_base; -+EXPORT_SYMBOL_GPL(ath79_ddr_base); - static void __iomem *ath79_ddr_wb_flush_base; - static void __iomem *ath79_ddr_pci_win_base; - ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -152,6 +152,7 @@ void ath79_ddr_wb_flush(unsigned int reg - void ath79_ddr_set_pci_windows(void); - - extern void __iomem *ath79_pll_base; -+extern void __iomem *ath79_ddr_base; - extern void __iomem *ath79_reset_base; - - static inline void ath79_pll_wr(unsigned reg, u32 val) diff --git a/target/linux/ath79/patches-4.14/004-register_gpio_driver_earlier.patch b/target/linux/ath79/patches-4.14/004-register_gpio_driver_earlier.patch deleted file mode 100644 index cc30e2d91..000000000 --- a/target/linux/ath79/patches-4.14/004-register_gpio_driver_earlier.patch +++ /dev/null @@ -1,18 +0,0 @@ -HACK: register the GPIO driver earlier to ensure that gpio_request calls -from mach files succeed. - ---- a/drivers/gpio/gpio-ath79.c -+++ b/drivers/gpio/gpio-ath79.c -@@ -322,7 +322,11 @@ static struct platform_driver ath79_gpio - .remove = ath79_gpio_remove, - }; - --module_platform_driver(ath79_gpio_driver); -+static int __init ath79_gpio_init(void) -+{ -+ return platform_driver_register(&ath79_gpio_driver); -+} -+postcore_initcall(ath79_gpio_init); - - MODULE_DESCRIPTION("Atheros AR71XX/AR724X/AR913X GPIO API support"); - MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ath79/patches-4.14/405-mtd-tp-link-partition-parser.patch b/target/linux/ath79/patches-4.14/405-mtd-tp-link-partition-parser.patch deleted file mode 100644 index 846b7f0a0..000000000 --- a/target/linux/ath79/patches-4.14/405-mtd-tp-link-partition-parser.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -194,6 +194,12 @@ config MTD_MYLOADER_PARTS - You will still need the parsing functions to be called by the driver - for your particular device. It won't happen automatically. - -+config MTD_TPLINK_PARTS -+ tristate "TP-Link AR7XXX/AR9XXX partitioning support" -+ depends on ATH79 -+ ---help--- -+ TBD. -+ - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63 - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - obj-y += parsers/ -+obj-$(CONFIG_MTD_TPLINK_PARTS) += tplinkpart.o - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/ath79/patches-4.14/420-net-ar71xx_mac_driver.patch b/target/linux/ath79/patches-4.14/420-net-ar71xx_mac_driver.patch deleted file mode 100644 index 6377db0ac..000000000 --- a/target/linux/ath79/patches-4.14/420-net-ar71xx_mac_driver.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/net/ethernet/atheros/Kconfig -+++ b/drivers/net/ethernet/atheros/Kconfig -@@ -5,7 +5,7 @@ - config NET_VENDOR_ATHEROS - bool "Atheros devices" - default y -- depends on PCI -+ depends on (PCI || ATH79) - ---help--- - If you have a network (Ethernet) card belonging to this class, say Y. - -@@ -78,4 +78,6 @@ config ALX - To compile this driver as a module, choose M here. The module - will be called alx. - -+source drivers/net/ethernet/atheros/ag71xx/Kconfig -+ - endif # NET_VENDOR_ATHEROS ---- a/drivers/net/ethernet/atheros/Makefile -+++ b/drivers/net/ethernet/atheros/Makefile -@@ -3,6 +3,7 @@ - # Makefile for the Atheros network device drivers. - # - -+obj-$(CONFIG_AG71XX) += ag71xx/ - obj-$(CONFIG_ATL1) += atlx/ - obj-$(CONFIG_ATL2) += atlx/ - obj-$(CONFIG_ATL1E) += atl1e/ diff --git a/target/linux/ath79/patches-4.14/430-drivers-link-spi-before-mtd.patch b/target/linux/ath79/patches-4.14/430-drivers-link-spi-before-mtd.patch deleted file mode 100644 index 2f1549710..000000000 --- a/target/linux/ath79/patches-4.14/430-drivers-link-spi-before-mtd.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -83,8 +83,8 @@ obj-$(CONFIG_SCSI) += scsi/ - obj-y += nvme/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_TARGET_CORE) += target/ --obj-$(CONFIG_MTD) += mtd/ - obj-$(CONFIG_SPI) += spi/ -+obj-$(CONFIG_MTD) += mtd/ - obj-$(CONFIG_SPMI) += spmi/ - obj-$(CONFIG_HSI) += hsi/ - obj-y += net/ diff --git a/target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch b/target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch deleted file mode 100644 index 06da2b34e..000000000 --- a/target/linux/ath79/patches-4.14/461-spi-ath79-add-fast-flash-read.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- 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) -@@ -204,6 +201,38 @@ static u32 ath79_spi_txrx_mode0(struct s - return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); - } - -+static bool ath79_spi_flash_read_supported(struct spi_device *spi) -+{ -+ if (spi->chip_select || gpio_is_valid(spi->cs_gpio)) -+ return false; -+ -+ return true; -+} -+ -+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; -+ -+ /* 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; -@@ -232,6 +261,8 @@ static int ath79_spi_probe(struct platfo - master->bus_num = pdata->bus_num; - master->num_chipselect = pdata->num_chipselect; - } -+ master->spi_flash_read = ath79_spi_read_flash_data; -+ master->flash_read_supported = ath79_spi_flash_read_supported; - - sp->bitbang.master = master; - sp->bitbang.chipselect = ath79_spi_chipselect; diff --git a/target/linux/ath79/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch b/target/linux/ath79/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch deleted file mode 100644 index ad8b7b47d..000000000 --- a/target/linux/ath79/patches-4.14/470-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- /dev/null -+++ b/arch/mips/include/asm/mach-ath79/mangle-port.h -@@ -0,0 +1,37 @@ -+/* -+ * Copyright (C) 2012 Gabor Juhos -+ * -+ * This file was derived from: inlude/asm-mips/mach-generic/mangle-port.h -+ * Copyright (C) 2003, 2004 Ralf Baechle -+ * -+ * 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_ATH79_MANGLE_PORT_H -+#define __ASM_MACH_ATH79_MANGLE_PORT_H -+ -+#ifdef CONFIG_PCI_AR71XX -+extern unsigned long (ath79_pci_swizzle_b)(unsigned long port); -+extern unsigned long (ath79_pci_swizzle_w)(unsigned long port); -+#else -+#define ath79_pci_swizzle_b(port) (port) -+#define ath79_pci_swizzle_w(port) (port) -+#endif -+ -+#define __swizzle_addr_b(port) ath79_pci_swizzle_b(port) -+#define __swizzle_addr_w(port) ath79_pci_swizzle_w(port) -+#define __swizzle_addr_l(port) (port) -+#define __swizzle_addr_q(port) (port) -+ -+# define ioswabb(a, x) (x) -+# define __mem_ioswabb(a, x) (x) -+# define ioswabw(a, x) (x) -+# define __mem_ioswabw(a, x) cpu_to_le16(x) -+# define ioswabl(a, x) (x) -+# define __mem_ioswabl(a, x) cpu_to_le32(x) -+# define ioswabq(a, x) (x) -+# define __mem_ioswabq(a, x) cpu_to_le64(x) -+ -+#endif /* __ASM_MACH_ATH79_MANGLE_PORT_H */ ---- a/arch/mips/pci/pci-ar71xx.c -+++ b/arch/mips/pci/pci-ar71xx.c -@@ -73,6 +73,45 @@ static const u32 ar71xx_pci_read_mask[8] - 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 - }; - -+static unsigned long (*__ath79_pci_swizzle_b)(unsigned long port); -+static unsigned long (*__ath79_pci_swizzle_w)(unsigned long port); -+ -+static inline bool ar71xx_is_pci_addr(unsigned long port) -+{ -+ unsigned long phys = CPHYSADDR(port); -+ -+ return (phys >= AR71XX_PCI_MEM_BASE && -+ phys < AR71XX_PCI_MEM_BASE + AR71XX_PCI_MEM_SIZE); -+} -+ -+static unsigned long ar71xx_pci_swizzle_b(unsigned long port) -+{ -+ return ar71xx_is_pci_addr(port) ? port ^ 3 : port; -+} -+ -+static unsigned long ar71xx_pci_swizzle_w(unsigned long port) -+{ -+ return ar71xx_is_pci_addr(port) ? port ^ 2 : port; -+} -+ -+unsigned long ath79_pci_swizzle_b(unsigned long port) -+{ -+ if (__ath79_pci_swizzle_b) -+ return __ath79_pci_swizzle_b(port); -+ -+ return port; -+} -+EXPORT_SYMBOL(ath79_pci_swizzle_b); -+ -+unsigned long ath79_pci_swizzle_w(unsigned long port) -+{ -+ if (__ath79_pci_swizzle_w) -+ return __ath79_pci_swizzle_w(port); -+ -+ return port; -+} -+EXPORT_SYMBOL(ath79_pci_swizzle_w); -+ - static inline u32 ar71xx_pci_get_ble(int where, int size, int local) - { - u32 t; -@@ -384,6 +423,9 @@ static int ar71xx_pci_probe(struct platf - - register_pci_controller(&apc->pci_ctrl); - -+ __ath79_pci_swizzle_b = ar71xx_pci_swizzle_b; -+ __ath79_pci_swizzle_w = ar71xx_pci_swizzle_w; -+ - return 0; - } - diff --git a/target/linux/ath79/patches-4.14/490-usb-ehci-add-quirks-for-qca-socs.patch b/target/linux/ath79/patches-4.14/490-usb-ehci-add-quirks-for-qca-socs.patch deleted file mode 100644 index 1d1979cd6..000000000 --- a/target/linux/ath79/patches-4.14/490-usb-ehci-add-quirks-for-qca-socs.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -252,6 +252,37 @@ int ehci_reset(struct ehci_hcd *ehci) - command |= CMD_RESET; - dbg_cmd (ehci, "reset", command); - ehci_writel(ehci, command, &ehci->regs->command); -+ -+ if (ehci->qca_force_host_mode) { -+ u32 usbmode; -+ -+ udelay(1000); -+ -+ usbmode = ehci_readl(ehci, &ehci->regs->usbmode); -+ usbmode |= USBMODE_CM_HC | (1 << 4); -+ ehci_writel(ehci, usbmode, &ehci->regs->usbmode); -+ -+ ehci_dbg(ehci, "forced host mode, usbmode: %08x\n", -+ ehci_readl(ehci, &ehci->regs->usbmode)); -+ } -+ -+ if (ehci->qca_force_16bit_ptw) { -+ u32 port_status; -+ -+ udelay(1000); -+ -+ /* enable 16-bit UTMI interface */ -+ port_status = ehci_readl(ehci, &ehci->regs->port_status[0]); -+ port_status |= BIT(28); -+ ehci_writel(ehci, port_status, &ehci->regs->port_status[0]); -+ -+ ehci_dbg(ehci, "16-bit UTMI interface enabled, status: %08x\n", -+ ehci_readl(ehci, &ehci->regs->port_status[0])); -+ } -+ -+ if (ehci->reset_notifier) -+ ehci->reset_notifier(ehci_to_hcd(ehci)); -+ - ehci->rh_state = EHCI_RH_HALTED; - ehci->next_statechange = jiffies; - retval = ehci_handshake(ehci, &ehci->regs->command, ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -232,6 +232,10 @@ struct ehci_hcd { /* one per controlle - unsigned need_oc_pp_cycle:1; /* MPC834X port power */ - unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ - unsigned ignore_oc:1; -+ unsigned qca_force_host_mode:1; -+ unsigned qca_force_16bit_ptw:1; /* force 16 bit UTMI */ -+ -+ void (*reset_notifier)(struct usb_hcd *hcd); - - /* required for usb32 quirk */ - #define OHCI_CTRL_HCFS (3 << 6) ---- a/include/linux/usb/ehci_pdriver.h -+++ b/include/linux/usb/ehci_pdriver.h -@@ -50,6 +50,8 @@ struct usb_ehci_pdata { - unsigned reset_on_resume:1; - unsigned dma_mask_64:1; - unsigned ignore_oc:1; -+ unsigned qca_force_host_mode:1; -+ unsigned qca_force_16bit_ptw:1; - - /* Turn on all power and clocks */ - int (*power_on)(struct platform_device *pdev); -@@ -59,6 +61,7 @@ struct usb_ehci_pdata { - * turn off everything else */ - void (*power_suspend)(struct platform_device *pdev); - int (*pre_setup)(struct usb_hcd *hcd); -+ void (*reset_notifier)(struct platform_device *pdev); - }; - - #endif /* __USB_CORE_EHCI_PDRIVER_H */ ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -53,6 +53,14 @@ struct ehci_platform_priv { - - static const char hcd_name[] = "ehci-platform"; - -+static void ehci_platform_reset_notifier(struct usb_hcd *hcd) -+{ -+ struct platform_device *pdev = to_platform_device(hcd->self.controller); -+ struct usb_ehci_pdata *pdata = pdev->dev.platform_data; -+ -+ pdata->reset_notifier(pdev); -+} -+ - static int ehci_platform_reset(struct usb_hcd *hcd) - { - struct platform_device *pdev = to_platform_device(hcd->self.controller); -@@ -270,6 +278,13 @@ static int ehci_platform_probe(struct pl - priv->reset_on_resume = true; - if (pdata->ignore_oc) - ehci->ignore_oc = 1; -+ if (pdata->qca_force_host_mode) -+ ehci->qca_force_host_mode = 1; -+ if (pdata->qca_force_16bit_ptw) -+ ehci->qca_force_16bit_ptw = 1; -+ -+ if (pdata->reset_notifier) -+ ehci->reset_notifier = ehci_platform_reset_notifier; - - #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO - if (ehci->big_endian_mmio) { diff --git a/target/linux/ath79/patches-4.14/900-mdio_bitbang_ignore_ta_value.patch b/target/linux/ath79/patches-4.14/900-mdio_bitbang_ignore_ta_value.patch deleted file mode 100644 index 8f8f349a6..000000000 --- a/target/linux/ath79/patches-4.14/900-mdio_bitbang_ignore_ta_value.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/drivers/net/phy/mdio-bitbang.c -+++ b/drivers/net/phy/mdio-bitbang.c -@@ -155,7 +155,7 @@ static int mdiobb_cmd_addr(struct mdiobb - static int mdiobb_read(struct mii_bus *bus, int phy, int reg) - { - struct mdiobb_ctrl *ctrl = bus->priv; -- int ret, i; -+ int ret; - - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); -@@ -165,19 +165,7 @@ static int mdiobb_read(struct mii_bus *b - - ctrl->ops->set_mdio_dir(ctrl, 0); - -- /* check the turnaround bit: the PHY should be driving it to zero, if this -- * PHY is listed in phy_ignore_ta_mask as having broken TA, skip that -- */ -- if (mdiobb_get_bit(ctrl) != 0 && -- !(bus->phy_ignore_ta_mask & (1 << phy))) { -- /* PHY didn't drive TA low -- flush any bits it -- * may be trying to send. -- */ -- for (i = 0; i < 32; i++) -- mdiobb_get_bit(ctrl); -- -- return 0xffff; -- } -+ mdiobb_get_bit(ctrl); - - ret = mdiobb_get_num(ctrl, 16); - mdiobb_get_bit(ctrl); diff --git a/target/linux/ath79/patches-4.14/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch b/target/linux/ath79/patches-4.14/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch deleted file mode 100644 index a830346a3..000000000 --- a/target/linux/ath79/patches-4.14/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 66e584435ac0de6e0abeb6d7166fe4fe25d6bb73 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 16 Jun 2015 13:15:08 +0200 -Subject: [PATCH] phy/mdio-bitbang: prevent rescheduling during command - -It seems some phys have some maximum timings for accessing the MDIO line, -resulting in bit errors under cpu stress. Prevent this from happening by -disabling interrupts when sending commands. - -Signed-off-by: Jonas Gorski ---- - drivers/net/phy/mdio-bitbang.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/net/phy/mdio-bitbang.c -+++ b/drivers/net/phy/mdio-bitbang.c -@@ -17,6 +17,7 @@ - * kind, whether express or implied. - */ - -+#include - #include - #include - #include -@@ -156,7 +157,9 @@ static int mdiobb_read(struct mii_bus *b - { - struct mdiobb_ctrl *ctrl = bus->priv; - int ret; -+ unsigned long flags; - -+ local_irq_save(flags); - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); - mdiobb_cmd(ctrl, MDIO_C45_READ, phy, reg); -@@ -169,13 +172,17 @@ static int mdiobb_read(struct mii_bus *b - - ret = mdiobb_get_num(ctrl, 16); - mdiobb_get_bit(ctrl); -+ local_irq_restore(flags); -+ - return ret; - } - - static int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val) - { - struct mdiobb_ctrl *ctrl = bus->priv; -+ unsigned long flags; - -+ local_irq_save(flags); - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); - mdiobb_cmd(ctrl, MDIO_C45_WRITE, phy, reg); -@@ -190,6 +197,8 @@ static int mdiobb_write(struct mii_bus * - - ctrl->ops->set_mdio_dir(ctrl, 0); - mdiobb_get_bit(ctrl); -+ local_irq_restore(flags); -+ - return 0; - } - diff --git a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch deleted file mode 100644 index 9897679a6..000000000 --- a/target/linux/ath79/patches-4.14/910-unaligned_access_hacks.patch +++ /dev/null @@ -1,900 +0,0 @@ ---- a/arch/mips/include/asm/checksum.h -+++ b/arch/mips/include/asm/checksum.h -@@ -134,26 +134,30 @@ static inline __sum16 ip_fast_csum(const - const unsigned int *stop = word + ihl; - unsigned int csum; - int carry; -+ unsigned int w; - -- csum = word[0]; -- csum += word[1]; -- carry = (csum < word[1]); -+ csum = net_hdr_word(word++); -+ -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- csum += word[2]; -- carry = (csum < word[2]); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- csum += word[3]; -- carry = (csum < word[3]); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- word += 4; - do { -- csum += *word; -- carry = (csum < *word); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; -- word++; - } while (word != stop); - - return csum_fold(csum); -@@ -214,73 +218,6 @@ static inline __sum16 ip_compute_csum(co - return csum_fold(csum_partial(buff, len, 0)); - } - --#define _HAVE_ARCH_IPV6_CSUM --static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, -- const struct in6_addr *daddr, -- __u32 len, __u8 proto, -- __wsum sum) --{ -- __wsum tmp; -- -- __asm__( -- " .set push # csum_ipv6_magic\n" -- " .set noreorder \n" -- " .set noat \n" -- " addu %0, %5 # proto (long in network byte order)\n" -- " sltu $1, %0, %5 \n" -- " addu %0, $1 \n" -- -- " addu %0, %6 # csum\n" -- " sltu $1, %0, %6 \n" -- " lw %1, 0(%2) # four words source address\n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 4(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 8(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 12(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 0(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 4(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 8(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 12(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " addu %0, $1 # Add final carry\n" -- " .set pop" -- : "=&r" (sum), "=&r" (tmp) -- : "r" (saddr), "r" (daddr), -- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); -- -- return csum_fold(sum); --} -- - #include - #endif /* CONFIG_GENERIC_CSUM */ - ---- a/include/uapi/linux/ip.h -+++ b/include/uapi/linux/ip.h -@@ -103,7 +103,7 @@ struct iphdr { - __be32 saddr; - __be32 daddr; - /*The options start here. */ --}; -+} __attribute__((packed, aligned(2))); - - - struct ip_auth_hdr { ---- a/include/uapi/linux/ipv6.h -+++ b/include/uapi/linux/ipv6.h -@@ -131,7 +131,7 @@ struct ipv6hdr { - - struct in6_addr saddr; - struct in6_addr daddr; --}; -+} __attribute__((packed, aligned(2))); - - - /* index values for the variables in ipv6_devconf */ ---- a/include/uapi/linux/tcp.h -+++ b/include/uapi/linux/tcp.h -@@ -55,7 +55,7 @@ struct tcphdr { - __be16 window; - __sum16 check; - __be16 urg_ptr; --}; -+} __attribute__((packed, aligned(2))); - - /* - * The union cast uses a gcc extension to avoid aliasing problems -@@ -65,7 +65,7 @@ struct tcphdr { - union tcp_word_hdr { - struct tcphdr hdr; - __be32 words[5]; --}; -+} __attribute__((packed, aligned(2))); - - #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) - ---- a/include/uapi/linux/udp.h -+++ b/include/uapi/linux/udp.h -@@ -25,7 +25,7 @@ struct udphdr { - __be16 dest; - __be16 len; - __sum16 check; --}; -+} __attribute__((packed, aligned(2))); - - /* UDP socket options */ - #define UDP_CORK 1 /* Never send partially complete segments */ ---- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c -+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c -@@ -48,8 +48,8 @@ static bool ipv4_pkt_to_tuple(const stru - if (ap == NULL) - return false; - -- tuple->src.u3.ip = ap[0]; -- tuple->dst.u3.ip = ap[1]; -+ tuple->src.u3.ip = net_hdr_word(ap++); -+ tuple->dst.u3.ip = net_hdr_word(ap); - - return true; - } ---- a/include/uapi/linux/icmp.h -+++ b/include/uapi/linux/icmp.h -@@ -82,7 +82,7 @@ struct icmphdr { - } frag; - __u8 reserved[4]; - } un; --}; -+} __attribute__((packed, aligned(2))); - - - /* ---- a/include/uapi/linux/in6.h -+++ b/include/uapi/linux/in6.h -@@ -43,7 +43,7 @@ struct in6_addr { - #define s6_addr16 in6_u.u6_addr16 - #define s6_addr32 in6_u.u6_addr32 - #endif --}; -+} __attribute__((packed, aligned(2))); - #endif /* __UAPI_DEF_IN6_ADDR */ - - #if __UAPI_DEF_SOCKADDR_IN6 ---- a/net/ipv6/tcp_ipv6.c -+++ b/net/ipv6/tcp_ipv6.c -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -819,10 +820,10 @@ static void tcp_v6_send_response(const s - topt = (__be32 *)(t1 + 1); - - if (tsecr) { -- *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -- (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); -- *topt++ = htonl(tsval); -- *topt++ = htonl(tsecr); -+ put_unaligned_be32((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP, topt++); -+ put_unaligned_be32(tsval, topt++); -+ put_unaligned_be32(tsecr, topt++); - } - - #ifdef CONFIG_TCP_MD5SIG ---- a/include/linux/ipv6.h -+++ b/include/linux/ipv6.h -@@ -6,6 +6,7 @@ - - #define ipv6_optlen(p) (((p)->hdrlen+1) << 3) - #define ipv6_authlen(p) (((p)->hdrlen+2) << 2) -+ - /* - * This structure contains configuration options per IPv6 link. - */ ---- a/net/ipv6/datagram.c -+++ b/net/ipv6/datagram.c -@@ -485,7 +485,7 @@ int ipv6_recv_error(struct sock *sk, str - ipv6_iface_scope_id(&sin->sin6_addr, - IP6CB(skb)->iif); - } else { -- ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset), -+ ipv6_addr_set_v4mapped(net_hdr_word(nh + serr->addr_offset), - &sin->sin6_addr); - sin->sin6_scope_id = 0; - } -@@ -833,12 +833,12 @@ int ip6_datagram_send_ctl(struct net *ne - } - - if (fl6->flowlabel&IPV6_FLOWINFO_MASK) { -- if ((fl6->flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) { -+ if ((fl6->flowlabel^net_hdr_word(CMSG_DATA(cmsg)))&~IPV6_FLOWINFO_MASK) { - err = -EINVAL; - goto exit_f; - } - } -- fl6->flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg); -+ fl6->flowlabel = IPV6_FLOWINFO_MASK & net_hdr_word(CMSG_DATA(cmsg)); - break; - - case IPV6_2292HOPOPTS: ---- a/net/ipv6/ip6_gre.c -+++ b/net/ipv6/ip6_gre.c -@@ -397,7 +397,7 @@ static void ip6gre_err(struct sk_buff *s - return; - ipv6h = (const struct ipv6hdr *)skb->data; - greh = (const struct gre_base_hdr *)(skb->data + offset); -- key = key_off ? *(__be32 *)(skb->data + key_off) : 0; -+ key = key_off ? net_hdr_word((__be32 *)(skb->data + key_off)) : 0; - - t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr, - key, greh->protocol); ---- a/net/ipv6/exthdrs.c -+++ b/net/ipv6/exthdrs.c -@@ -733,7 +733,7 @@ static bool ipv6_hop_jumbo(struct sk_buf - goto drop; - } - -- pkt_len = ntohl(*(__be32 *)(nh + optoff + 2)); -+ pkt_len = ntohl(net_hdr_word(nh + optoff + 2)); - if (pkt_len <= IPV6_MAXPLEN) { - __IP6_INC_STATS(net, ipv6_skb_idev(skb), - IPSTATS_MIB_INHDRERRORS); ---- a/include/linux/types.h -+++ b/include/linux/types.h -@@ -229,5 +229,11 @@ struct callback_head { - typedef void (*rcu_callback_t)(struct rcu_head *head); - typedef void (*call_rcu_func_t)(struct rcu_head *head, rcu_callback_t func); - -+struct net_hdr_word { -+ u32 words[1]; -+} __attribute__((packed, aligned(2))); -+ -+#define net_hdr_word(_p) (((struct net_hdr_word *) (_p))->words[0]) -+ - #endif /* __ASSEMBLY__ */ - #endif /* _LINUX_TYPES_H */ ---- a/net/ipv4/af_inet.c -+++ b/net/ipv4/af_inet.c -@@ -1351,8 +1351,8 @@ struct sk_buff **inet_gro_receive(struct - if (unlikely(ip_fast_csum((u8 *)iph, 5))) - goto out_unlock; - -- id = ntohl(*(__be32 *)&iph->id); -- flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF)); -+ id = ntohl(net_hdr_word(&iph->id)); -+ flush = (u16)((ntohl(net_hdr_word(iph)) ^ skb_gro_len(skb)) | (id & ~IP_DF)); - id >>= 16; - - for (p = *head; p; p = p->next) { ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -465,7 +465,7 @@ static struct neighbour *ipv4_neigh_look - else if (skb) - pkey = &ip_hdr(skb)->daddr; - -- n = __ipv4_neigh_lookup(dev, *(__force u32 *)pkey); -+ n = __ipv4_neigh_lookup(dev, net_hdr_word(pkey)); - if (n) - return n; - return neigh_create(&arp_tbl, pkey, dev); ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -449,48 +449,53 @@ static void tcp_options_write(__be32 *pt - u16 options = opts->options; /* mungable copy */ - - if (unlikely(OPTION_MD5 & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -- (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); - /* overload cookie hash location */ - opts->hash_location = (__u8 *)ptr; - ptr += 4; - } - - if (unlikely(opts->mss)) { -- *ptr++ = htonl((TCPOPT_MSS << 24) | -- (TCPOLEN_MSS << 16) | -- opts->mss); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | -+ opts->mss); - } - - if (likely(OPTION_TS & options)) { - if (unlikely(OPTION_SACK_ADVERTISE & options)) { -- *ptr++ = htonl((TCPOPT_SACK_PERM << 24) | -- (TCPOLEN_SACK_PERM << 16) | -- (TCPOPT_TIMESTAMP << 8) | -- TCPOLEN_TIMESTAMP); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_SACK_PERM << 24) | -+ (TCPOLEN_SACK_PERM << 16) | -+ (TCPOPT_TIMESTAMP << 8) | -+ TCPOLEN_TIMESTAMP); - options &= ~OPTION_SACK_ADVERTISE; - } else { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_TIMESTAMP << 8) | -- TCPOLEN_TIMESTAMP); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | -+ TCPOLEN_TIMESTAMP); - } -- *ptr++ = htonl(opts->tsval); -- *ptr++ = htonl(opts->tsecr); -+ net_hdr_word(ptr++) = htonl(opts->tsval); -+ net_hdr_word(ptr++) = htonl(opts->tsecr); - } - - if (unlikely(OPTION_SACK_ADVERTISE & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_SACK_PERM << 8) | -- TCPOLEN_SACK_PERM); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_SACK_PERM << 8) | -+ TCPOLEN_SACK_PERM); - } - - if (unlikely(OPTION_WSCALE & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_WINDOW << 16) | -- (TCPOLEN_WINDOW << 8) | -- opts->ws); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_WINDOW << 16) | -+ (TCPOLEN_WINDOW << 8) | -+ opts->ws); - } - - if (unlikely(opts->num_sack_blocks)) { -@@ -498,16 +503,17 @@ static void tcp_options_write(__be32 *pt - tp->duplicate_sack : tp->selective_acks; - int this_sack; - -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_SACK << 8) | -- (TCPOLEN_SACK_BASE + (opts->num_sack_blocks * -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_SACK << 8) | -+ (TCPOLEN_SACK_BASE + (opts->num_sack_blocks * - TCPOLEN_SACK_PERBLOCK))); - - for (this_sack = 0; this_sack < opts->num_sack_blocks; - ++this_sack) { -- *ptr++ = htonl(sp[this_sack].start_seq); -- *ptr++ = htonl(sp[this_sack].end_seq); -+ net_hdr_word(ptr++) = htonl(sp[this_sack].start_seq); -+ net_hdr_word(ptr++) = htonl(sp[this_sack].end_seq); - } - - tp->rx_opt.dsack = 0; -@@ -520,13 +526,14 @@ static void tcp_options_write(__be32 *pt - - if (foc->exp) { - len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; -- *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) | -+ net_hdr_word(ptr) = -+ htonl((TCPOPT_EXP << 24) | (len << 16) | - TCPOPT_FASTOPEN_MAGIC); - p += TCPOLEN_EXP_FASTOPEN_BASE; - } else { - len = TCPOLEN_FASTOPEN_BASE + foc->len; -- *p++ = TCPOPT_FASTOPEN; -- *p++ = len; -+ net_hdr_word(p++) = TCPOPT_FASTOPEN; -+ net_hdr_word(p++) = len; - } - - memcpy(p, foc->val, foc->len); ---- a/include/uapi/linux/igmp.h -+++ b/include/uapi/linux/igmp.h -@@ -33,7 +33,7 @@ struct igmphdr { - __u8 code; /* For newer IGMP */ - __sum16 csum; - __be32 group; --}; -+} __attribute__((packed, aligned(2))); - - /* V3 group record types [grec_type] */ - #define IGMPV3_MODE_IS_INCLUDE 1 -@@ -49,7 +49,7 @@ struct igmpv3_grec { - __be16 grec_nsrcs; - __be32 grec_mca; - __be32 grec_src[0]; --}; -+} __attribute__((packed, aligned(2))); - - struct igmpv3_report { - __u8 type; -@@ -58,7 +58,7 @@ struct igmpv3_report { - __be16 resv2; - __be16 ngrec; - struct igmpv3_grec grec[0]; --}; -+} __attribute__((packed, aligned(2))); - - struct igmpv3_query { - __u8 type; -@@ -79,7 +79,7 @@ struct igmpv3_query { - __u8 qqic; - __be16 nsrcs; - __be32 srcs[0]; --}; -+} __attribute__((packed, aligned(2))); - - #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ - #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ ---- a/net/core/flow_dissector.c -+++ b/net/core/flow_dissector.c -@@ -108,7 +108,7 @@ __be32 __skb_flow_get_ports(const struct - ports = __skb_header_pointer(skb, thoff + poff, - sizeof(_ports), data, hlen, &_ports); - if (ports) -- return *ports; -+ return (__be32)net_hdr_word(ports); - } - - return 0; ---- a/include/uapi/linux/icmpv6.h -+++ b/include/uapi/linux/icmpv6.h -@@ -77,7 +77,7 @@ struct icmp6hdr { - #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other - #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime - #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref --}; -+} __attribute__((packed, aligned(2))); - - - #define ICMPV6_ROUTER_PREF_LOW 0x3 ---- a/include/net/ndisc.h -+++ b/include/net/ndisc.h -@@ -89,7 +89,7 @@ struct ra_msg { - struct icmp6hdr icmph; - __be32 reachable_time; - __be32 retrans_timer; --}; -+} __attribute__((packed, aligned(2))); - - struct rd_msg { - struct icmp6hdr icmph; -@@ -368,10 +368,10 @@ static inline u32 ndisc_hashfn(const voi - { - const u32 *p32 = pkey; - -- return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) + -- (p32[1] * hash_rnd[1]) + -- (p32[2] * hash_rnd[2]) + -- (p32[3] * hash_rnd[3])); -+ return (((net_hdr_word(&p32[0]) ^ hash32_ptr(dev)) * hash_rnd[0]) + -+ (net_hdr_word(&p32[1]) * hash_rnd[1]) + -+ (net_hdr_word(&p32[2]) * hash_rnd[2]) + -+ (net_hdr_word(&p32[3]) * hash_rnd[3])); - } - - static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) ---- a/net/sched/cls_u32.c -+++ b/net/sched/cls_u32.c -@@ -165,7 +165,7 @@ next_knode: - data = skb_header_pointer(skb, toff, 4, &hdata); - if (!data) - goto out; -- if ((*data ^ key->val) & key->mask) { -+ if ((net_hdr_word(data) ^ key->val) & key->mask) { - n = rcu_dereference_bh(n->next); - goto next_knode; - } -@@ -218,8 +218,8 @@ check_terminal: - &hdata); - if (!data) - goto out; -- sel = ht->divisor & u32_hash_fold(*data, &n->sel, -- n->fshift); -+ sel = ht->divisor & u32_hash_fold(net_hdr_word(data), -+ &n->sel, n->fshift); - } - if (!(n->sel.flags & (TC_U32_VAROFFSET | TC_U32_OFFSET | TC_U32_EAT))) - goto next_ht; ---- a/net/ipv6/ip6_offload.c -+++ b/net/ipv6/ip6_offload.c -@@ -220,7 +220,7 @@ static struct sk_buff **ipv6_gro_receive - continue; - - iph2 = (struct ipv6hdr *)(p->data + off); -- first_word = *(__be32 *)iph ^ *(__be32 *)iph2; -+ first_word = net_hdr_word(iph) ^ net_hdr_word(iph2); - - /* All fields must match except length and Traffic Class. - * XXX skbs on the gro_list have all been parsed and pulled ---- a/include/net/addrconf.h -+++ b/include/net/addrconf.h -@@ -47,7 +47,7 @@ struct prefix_info { - __be32 reserved2; - - struct in6_addr prefix; --}; -+} __attribute__((packed, aligned(2))); - - #include - #include ---- a/include/net/inet_ecn.h -+++ b/include/net/inet_ecn.h -@@ -125,9 +125,9 @@ static inline int IP6_ECN_set_ce(struct - if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) - return 0; - -- from = *(__be32 *)iph; -+ from = net_hdr_word(iph); - to = from | htonl(INET_ECN_CE << 20); -- *(__be32 *)iph = to; -+ net_hdr_word(iph) = to; - if (skb->ip_summed == CHECKSUM_COMPLETE) - skb->csum = csum_add(csum_sub(skb->csum, (__force __wsum)from), - (__force __wsum)to); -@@ -136,7 +136,7 @@ static inline int IP6_ECN_set_ce(struct - - static inline void IP6_ECN_clear(struct ipv6hdr *iph) - { -- *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); -+ net_hdr_word(iph) &= ~htonl(INET_ECN_MASK << 20); - } - - static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner) ---- a/include/net/ipv6.h -+++ b/include/net/ipv6.h -@@ -108,7 +108,7 @@ struct frag_hdr { - __u8 reserved; - __be16 frag_off; - __be32 identification; --}; -+} __attribute__((packed, aligned(2))); - - #define IP6_MF 0x0001 - #define IP6_OFFSET 0xFFF8 -@@ -451,8 +451,8 @@ static inline void __ipv6_addr_set_half( - } - #endif - #endif -- addr[0] = wh; -- addr[1] = wl; -+ net_hdr_word(&addr[0]) = wh; -+ net_hdr_word(&addr[1]) = wl; - } - - static inline void ipv6_addr_set(struct in6_addr *addr, -@@ -511,6 +511,8 @@ static inline bool ipv6_prefix_equal(con - const __be32 *a1 = addr1->s6_addr32; - const __be32 *a2 = addr2->s6_addr32; - unsigned int pdw, pbi; -+ /* Used for last <32-bit fraction of prefix */ -+ u32 pbia1, pbia2; - - /* check complete u32 in prefix */ - pdw = prefixlen >> 5; -@@ -519,7 +521,9 @@ static inline bool ipv6_prefix_equal(con - - /* check incomplete u32 in prefix */ - pbi = prefixlen & 0x1f; -- if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) -+ pbia1 = net_hdr_word(&a1[pdw]); -+ pbia2 = net_hdr_word(&a2[pdw]); -+ if (pbi && ((pbia1 ^ pbia2) & htonl((0xffffffff) << (32 - pbi)))) - return false; - - return true; -@@ -663,13 +667,13 @@ static inline void ipv6_addr_set_v4mappe - */ - static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) - { -- const __be32 *a1 = token1, *a2 = token2; -+ const struct in6_addr *a1 = token1, *a2 = token2; - int i; - - addrlen >>= 2; - - for (i = 0; i < addrlen; i++) { -- __be32 xb = a1[i] ^ a2[i]; -+ __be32 xb = a1->s6_addr32[i] ^ a2->s6_addr32[i]; - if (xb) - return i * 32 + 31 - __fls(ntohl(xb)); - } -@@ -838,17 +842,18 @@ static inline int ip6_default_np_autolab - static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, - __be32 flowlabel) - { -- *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | flowlabel; -+ net_hdr_word((__be32 *)hdr) = -+ htonl(0x60000000 | (tclass << 20)) | flowlabel; - } - - static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr) - { -- return *(__be32 *)hdr & IPV6_FLOWINFO_MASK; -+ return net_hdr_word((__be32 *)hdr) & IPV6_FLOWINFO_MASK; - } - - static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr) - { -- return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK; -+ return net_hdr_word((__be32 *)hdr) & IPV6_FLOWLABEL_MASK; - } - - static inline u8 ip6_tclass(__be32 flowinfo) ---- a/include/net/secure_seq.h -+++ b/include/net/secure_seq.h -@@ -3,6 +3,7 @@ - #define _NET_SECURE_SEQ - - #include -+#include - - u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); - u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, ---- a/include/uapi/linux/in.h -+++ b/include/uapi/linux/in.h -@@ -84,7 +84,7 @@ enum { - /* Internet address. */ - struct in_addr { - __be32 s_addr; --}; -+} __attribute__((packed, aligned(2))); - #endif - - #define IP_TOS 1 ---- a/net/ipv6/ip6_fib.c -+++ b/net/ipv6/ip6_fib.c -@@ -137,7 +137,7 @@ static __be32 addr_bit_set(const void *t - * See include/asm-generic/bitops/le.h. - */ - return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) & -- addr[fn_bit >> 5]; -+ net_hdr_word(&addr[fn_bit >> 5]); - } - - static struct fib6_node *node_alloc(void) ---- a/net/netfilter/nf_conntrack_proto_tcp.c -+++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -447,7 +447,7 @@ static void tcp_sack(const struct sk_buf - - /* Fast path for timestamp-only option */ - if (length == TCPOLEN_TSTAMP_ALIGNED -- && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24) -+ && net_hdr_word(ptr) == htonl((TCPOPT_NOP << 24) - | (TCPOPT_NOP << 16) - | (TCPOPT_TIMESTAMP << 8) - | TCPOLEN_TIMESTAMP)) ---- a/net/xfrm/xfrm_input.c -+++ b/net/xfrm/xfrm_input.c -@@ -193,8 +193,8 @@ int xfrm_parse_spi(struct sk_buff *skb, - if (!pskb_may_pull(skb, hlen)) - return -EINVAL; - -- *spi = *(__be32 *)(skb_transport_header(skb) + offset); -- *seq = *(__be32 *)(skb_transport_header(skb) + offset_seq); -+ *spi = net_hdr_word(skb_transport_header(skb) + offset); -+ *seq = net_hdr_word(skb_transport_header(skb) + offset_seq); - return 0; - } - EXPORT_SYMBOL(xfrm_parse_spi); ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -3844,14 +3844,16 @@ static bool tcp_parse_aligned_timestamp( - { - const __be32 *ptr = (const __be32 *)(th + 1); - -- if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) -- | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { -+ if (net_hdr_word(ptr) == -+ htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { - tp->rx_opt.saw_tstamp = 1; - ++ptr; -- tp->rx_opt.rcv_tsval = ntohl(*ptr); -+ tp->rx_opt.rcv_tsval = get_unaligned_be32(ptr); - ++ptr; -- if (*ptr) -- tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset; -+ if (net_hdr_word(ptr)) -+ tp->rx_opt.rcv_tsecr = get_unaligned_be32(ptr) - -+ tp->tsoffset; - else - tp->rx_opt.rcv_tsecr = 0; - return true; ---- a/include/uapi/linux/if_pppox.h -+++ b/include/uapi/linux/if_pppox.h -@@ -51,6 +51,7 @@ struct pppoe_addr { - */ - struct pptp_addr { - __u16 call_id; -+ __u16 pad; - struct in_addr sin_addr; - }; - ---- a/net/ipv6/netfilter/nf_log_ipv6.c -+++ b/net/ipv6/netfilter/nf_log_ipv6.c -@@ -66,9 +66,9 @@ static void dump_ipv6_packet(struct nf_l - /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */ - nf_log_buf_add(m, "LEN=%zu TC=%u HOPLIMIT=%u FLOWLBL=%u ", - ntohs(ih->payload_len) + sizeof(struct ipv6hdr), -- (ntohl(*(__be32 *)ih) & 0x0ff00000) >> 20, -+ (ntohl(net_hdr_word(ih)) & 0x0ff00000) >> 20, - ih->hop_limit, -- (ntohl(*(__be32 *)ih) & 0x000fffff)); -+ (ntohl(net_hdr_word(ih)) & 0x000fffff)); - - fragment = 0; - ptr = ip6hoff + sizeof(struct ipv6hdr); ---- a/include/net/neighbour.h -+++ b/include/net/neighbour.h -@@ -265,8 +265,10 @@ static inline bool neigh_key_eq128(const - const u32 *n32 = (const u32 *)n->primary_key; - const u32 *p32 = pkey; - -- return ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) | -- (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0; -+ return ((n32[0] ^ net_hdr_word(&p32[0])) | -+ (n32[1] ^ net_hdr_word(&p32[1])) | -+ (n32[2] ^ net_hdr_word(&p32[2])) | -+ (n32[3] ^ net_hdr_word(&p32[3]))) == 0; - } - - static inline struct neighbour *___neigh_lookup_noref( ---- a/include/uapi/linux/netfilter_arp/arp_tables.h -+++ b/include/uapi/linux/netfilter_arp/arp_tables.h -@@ -70,7 +70,7 @@ struct arpt_arp { - __u8 flags; - /* Inverse flags */ - __u16 invflags; --}; -+} __attribute__((aligned(4))); - - /* Values for "flag" field in struct arpt_ip (general arp structure). - * No flags defined yet. ---- a/net/core/utils.c -+++ b/net/core/utils.c -@@ -424,8 +424,14 @@ void inet_proto_csum_replace16(__sum16 * - bool pseudohdr) - { - __be32 diff[] = { -- ~from[0], ~from[1], ~from[2], ~from[3], -- to[0], to[1], to[2], to[3], -+ ~net_hdr_word(&from[0]), -+ ~net_hdr_word(&from[1]), -+ ~net_hdr_word(&from[2]), -+ ~net_hdr_word(&from[3]), -+ net_hdr_word(&to[0]), -+ net_hdr_word(&to[1]), -+ net_hdr_word(&to[2]), -+ net_hdr_word(&to[3]), - }; - if (skb->ip_summed != CHECKSUM_PARTIAL) { - *sum = csum_fold(csum_partial(diff, sizeof(diff), ---- a/include/linux/etherdevice.h -+++ b/include/linux/etherdevice.h -@@ -480,7 +480,7 @@ static inline bool is_etherdev_addr(cons - * @b: Pointer to Ethernet header - * - * Compare two Ethernet headers, returns 0 if equal. -- * This assumes that the network header (i.e., IP header) is 4-byte -+ * This assumes that the network header (i.e., IP header) is 2-byte - * aligned OR the platform can handle unaligned access. This is the - * case for all packets coming into netif_receive_skb or similar - * entry points. -@@ -503,11 +503,12 @@ static inline unsigned long compare_ethe - fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); - return fold; - #else -- u32 *a32 = (u32 *)((u8 *)a + 2); -- u32 *b32 = (u32 *)((u8 *)b + 2); -+ const u16 *a16 = a; -+ const u16 *b16 = b; - -- return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) | -- (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]); -+ return (a16[0] ^ b16[0]) | (a16[1] ^ b16[1]) | (a16[2] ^ b16[2]) | -+ (a16[3] ^ b16[3]) | (a16[4] ^ b16[4]) | (a16[5] ^ b16[5]) | -+ (a16[6] ^ b16[6]); - #endif - } - ---- a/net/ipv4/tcp_offload.c -+++ b/net/ipv4/tcp_offload.c -@@ -226,7 +226,7 @@ struct sk_buff **tcp_gro_receive(struct - - th2 = tcp_hdr(p); - -- if (*(u32 *)&th->source ^ *(u32 *)&th2->source) { -+ if (net_hdr_word(&th->source) ^ net_hdr_word(&th2->source)) { - NAPI_GRO_CB(p)->same_flow = 0; - continue; - } -@@ -244,8 +244,8 @@ found: - ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH)); - flush |= (__force int)(th->ack_seq ^ th2->ack_seq); - for (i = sizeof(*th); i < thlen; i += 4) -- flush |= *(u32 *)((u8 *)th + i) ^ -- *(u32 *)((u8 *)th2 + i); -+ flush |= net_hdr_word((u8 *)th + i) ^ -+ net_hdr_word((u8 *)th2 + i); - - /* When we receive our second frame we can made a decision on if we - * continue this flow as an atomic flow with a fixed ID or if we use ---- a/net/ipv6/netfilter/ip6table_mangle.c -+++ b/net/ipv6/netfilter/ip6table_mangle.c -@@ -50,7 +50,7 @@ ip6t_mangle_out(struct sk_buff *skb, con - hop_limit = ipv6_hdr(skb)->hop_limit; - - /* flowlabel and prio (includes version, which shouldn't change either */ -- flowlabel = *((u_int32_t *)ipv6_hdr(skb)); -+ flowlabel = net_hdr_word(ipv6_hdr(skb)); - - ret = ip6t_do_table(skb, state, state->net->ipv6.ip6table_mangle); - -@@ -59,7 +59,7 @@ ip6t_mangle_out(struct sk_buff *skb, con - !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) || - skb->mark != mark || - ipv6_hdr(skb)->hop_limit != hop_limit || -- flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { -+ flowlabel != net_hdr_word(ipv6_hdr(skb)))) { - err = ip6_route_me_harder(state->net, skb); - if (err < 0) - ret = NF_DROP_ERR(err); diff --git a/target/linux/ath79/tiny/config-default b/target/linux/ath79/tiny/config-default deleted file mode 100644 index 01af54446..000000000 --- a/target/linux/ath79/tiny/config-default +++ /dev/null @@ -1,14 +0,0 @@ -CONFIG_BLK_MQ_PCI=y -CONFIG_LEDS_RESET=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_PCI=y -CONFIG_PCI_AR71XX=y -CONFIG_PCI_AR724X=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PHY_AR7100_USB=y -CONFIG_PHY_AR7200_USB=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y diff --git a/target/linux/ath79/tiny/profiles/00-default.mk b/target/linux/ath79/tiny/profiles/00-default.mk deleted file mode 100644 index aa8e1195f..000000000 --- a/target/linux/ath79/tiny/profiles/00-default.mk +++ /dev/null @@ -1,9 +0,0 @@ -define Profile/Default - NAME:=Default Profile (all drivers) - PRIORITY := 1 -endef - -define Profile/Default/Description - Default package set compatible with most boards. -endef -$(eval $(call Profile,Default)) diff --git a/target/linux/ath79/tiny/target.mk b/target/linux/ath79/tiny/target.mk deleted file mode 100644 index 87af3ef2b..000000000 --- a/target/linux/ath79/tiny/target.mk +++ /dev/null @@ -1,6 +0,0 @@ -BOARDNAME:=Devices with small flash -FEATURES += squashfs small_flash - -define Target/Description - Build firmware images for Atheros AR71xx/AR913x/AR934x based boards with small flash -endef diff --git a/target/linux/au1000/Makefile b/target/linux/au1000/Makefile deleted file mode 100644 index debc41e97..000000000 --- a/target/linux/au1000/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (C) 2006-2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=mipsel -BOARD:=au1000 -BOARDNAME:=RMI/AMD AU1x00 -FEATURES:=squashfs usb pci -SUBTARGETS:=au1500 au1550 -MAINTAINER:=Florian Fainelli - -KERNEL_PATCHVER:=3.18 - -define Target/Description - Build firmware for RMI/AMD Alchemy 1500,1550 boards - (e.g. 4G-Systems Mesh/Access Cube, DBAu1550 ...) -endef - -include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES += wpad-mini yamonenv - -define Kernel/BuildImage - $(call Kernel/BuildImage/Default) - $(CP) $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec $(LINUX_DIR)/zImage.flash.srec - $(CP) $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.srec $(LINUX_DIR)/zImage.srec -endef - -$(eval $(call BuildTarget)) diff --git a/target/linux/au1000/au1500/config-default b/target/linux/au1000/au1500/config-default deleted file mode 100644 index 0289d967b..000000000 --- a/target/linux/au1000/au1500/config-default +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG_DMA_NONCOHERENT=y -# CONFIG_MIPS_DB1550 is not set -CONFIG_MIPS_MTX1=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_WDT_MTX1=y diff --git a/target/linux/au1000/au1500/profiles/Atheros.mk b/target/linux/au1000/au1500/profiles/Atheros.mk deleted file mode 100644 index 75e8e108f..000000000 --- a/target/linux/au1000/au1500/profiles/Atheros.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (C) 2006 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Atheros - NAME:=Atheros WiFi (default) - PACKAGES:=kmod-ath5k -endef -$(eval $(call Profile,Atheros)) - diff --git a/target/linux/au1000/au1500/profiles/InternetBox.mk b/target/linux/au1000/au1500/profiles/InternetBox.mk deleted file mode 100644 index a73f0ce9a..000000000 --- a/target/linux/au1000/au1500/profiles/InternetBox.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2007-2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/InternetBox - NAME:=T-Mobile "InternetBox" - PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-ohci kmod-usb-serial kmod-usb-serial-option \ - comgt -endef - -define Profile/InternetBox/Description - Package set for the T-Mobile "InternetBox" (TMD SB1-S) -endef - -$(eval $(call Profile,InternetBox)) diff --git a/target/linux/au1000/au1500/profiles/MeshCube.mk b/target/linux/au1000/au1500/profiles/MeshCube.mk deleted file mode 100644 index 969a3bbff..000000000 --- a/target/linux/au1000/au1500/profiles/MeshCube.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2007-2009 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/MeshCube - NAME:=MeshCube MTX-1 - PACKAGES:=kmod-ath5k kmod-net-prism54 \ - kmod-usb-core kmod-usb-ohci kmod-usb-storage kmod-fs-ext4 kmod-fs-vfat -endef - -define Profile/MeshCube/Description - Package set for the 4G MeshCube (MTX-1) -endef - -$(eval $(call Profile,MeshCube)) diff --git a/target/linux/au1000/au1500/target.mk b/target/linux/au1000/au1500/target.mk deleted file mode 100644 index 240914ff7..000000000 --- a/target/linux/au1000/au1500/target.mk +++ /dev/null @@ -1,7 +0,0 @@ -BOARDNAME:=Au1500 - -DEFAULT_PACKAGES+= wpad-mini - -define Target/Description - Build firmware images for Au1500 based boards -endef diff --git a/target/linux/au1000/au1550/config-default b/target/linux/au1000/au1550/config-default deleted file mode 100644 index 2c641b8ca..000000000 --- a/target/linux/au1000/au1550/config-default +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_DMA_COHERENT=y -CONFIG_MIPS_DB1550=y -CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y -# CONFIG_MIPS_MTX1 is not set diff --git a/target/linux/au1000/au1550/profiles/DBAu1550.mk b/target/linux/au1000/au1550/profiles/DBAu1550.mk deleted file mode 100644 index 3535be623..000000000 --- a/target/linux/au1000/au1550/profiles/DBAu1550.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (C) 2009-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/DBAu1550 - NAME:=AMD DBAu1550 Development Kit - PACKAGES:=kmod-pcmcia-au1000 kmod-usb-ohci kmod-usb2-pci -endef - -$(eval $(call Profile,DBAu1550)) diff --git a/target/linux/au1000/au1550/target.mk b/target/linux/au1000/au1550/target.mk deleted file mode 100644 index 1429cb403..000000000 --- a/target/linux/au1000/au1550/target.mk +++ /dev/null @@ -1,8 +0,0 @@ -BOARDNAME:=Au1550 -FEATURES += pcmcia - -DEFAULT_PACKAGES+= wpad-mini - -define Target/Description - Build firmware images for Au1550 based boards -endef diff --git a/target/linux/au1000/base-files/etc/diag.sh b/target/linux/au1000/base-files/etc/diag.sh deleted file mode 100644 index 65e3011be..000000000 --- a/target/linux/au1000/base-files/etc/diag.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Copyright (C) 2007-2013 OpenWrt.org - -. /lib/functions/leds.sh - -set_state() { - case "$1" in - preinit) - led_off "mtx1:green" - led_on "mtx1:red" - ;; - failsafe) - led_on "mtx1:green" - led_on "mtx1:red" - ;; - done) - led_on "mtx1:green" - led_off "mtx1:red" - ;; - esac -} diff --git a/target/linux/au1000/base-files/lib/upgrade/platform.sh b/target/linux/au1000/base-files/lib/upgrade/platform.sh deleted file mode 100644 index 7beb4a0d0..000000000 --- a/target/linux/au1000/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,26 +0,0 @@ -KERNEL_IMG="openwrt-au1000-au1500-vmlinux.bin" -ROOTFS_IMG="openwrt-au1000-au1500-root.fs" - -platform_check_image() { - [ "$#" -gt 1 ] && return 1 - case "$(get_magic_word "$1")" in - 6f70) - ( get_image "$1" | tar -tf - $KERNEL_IMG >/dev/null && \ - get_image "$1" | tar -tf - $ROOTFS_IMG >/dev/null) || { - echo "Invalid image contents" - return 1 - } - return 0;; - *) - echo "Invalid image type" - return 1;; - esac -} - -platform_do_upgrade() { - sync - local conf="" - [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && conf="-j $CONF_TAR" - get_image "$1" | tar -Oxvf - $KERNEL_IMG | mtd write - "kernel" - get_image "$1" | tar -Oxvf - $ROOTFS_IMG | mtd $conf write - "rootfs" -} diff --git a/target/linux/au1000/config-3.18 b/target/linux/au1000/config-3.18 deleted file mode 100644 index cb2eee20e..000000000 --- a/target/linux/au1000/config-3.18 +++ /dev/null @@ -1,141 +0,0 @@ -CONFIG_64BIT_PHYS_ADDR=y -CONFIG_ALCHEMY_GPIOINT_AU1000=y -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock0 rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -CONFIG_CPU_MIPSR1=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_R4K_FPU=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CRC16=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_EARLY_PRINTK=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQ_CPU=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_KEXEC=y -CONFIG_LEDS_GPIO=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_MDIO_BOARDINFO=y -CONFIG_MIPS=y -CONFIG_MIPS_ALCHEMY=y -CONFIG_MIPS_AU1X00_ENET=y -CONFIG_MIPS_DB1000=y -# CONFIG_MIPS_DB1XXX is not set -# CONFIG_MIPS_DB1235 is not set -# CONFIG_MIPS_GPR is not set -# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -# CONFIG_MIPS_MTX1 is not set -CONFIG_MIPS_MT_DISABLED=y -# CONFIG_MIPS_XXS1500 is not set -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MTD_CFI_INTELEXT is not set -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_PHYSMAP=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PHYLIB=y -CONFIG_PHYS_ADDR_T_64BIT=y -# CONFIG_PREEMPT_RCU is not set -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -# CONFIG_RCU_STALL_COMMON is not set -# CONFIG_SCSI_DMA is not set -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -# CONFIG_STANDALONE is not set -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_SYS_SUPPORTS_ZBOOT=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_USB_SUPPORT=y -CONFIG_WATCHDOG_CORE=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/au1000/image/Makefile b/target/linux/au1000/image/Makefile deleted file mode 100644 index 744e5c64e..000000000 --- a/target/linux/au1000/image/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright (C) 2006-2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -JFFS2_BLOCKSIZE = 128k - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -LOADADDR = 0x81000000 # RAM start + 16M -KERNEL_ENTRY = 0x80100000 -RAMSIZE = 0x00100000 # 1MB - -FLASH_KERNEL := 0xBFD00000 -FLASH_FS := 0xBE000000 - -LOADER_MAKEOPTS= \ - KDIR=$(KDIR) \ - LOADADDR=$(LOADADDR) \ - KERNEL_ENTRY=$(KERNEL_ENTRY) \ - RAMSIZE=$(RAMSIZE) - -define Build/Clean - $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean -endef - -DROP_SECTIONS := .reginfo .mdebug .comment .note .pdr .options .MIPS.options -OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS)) -OBJCOPY_BIN := $(TARGET_CROSS)objcopy -S -O binary $(addprefix --remove-section=,$(DROP_SECTIONS)) - -define Image/Prepare - cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma - - # Build RAM image - $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \ - $(LOADER_MAKEOPTS) \ - clean compile - $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/kernel.ram.srec - - # Build Flash image - $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \ - $(LOADER_MAKEOPTS) \ - IMAGE_COPY=1 \ - LOADER_ENTRY=$(FLASH_KERNEL) \ - LOADER_TYPE=_flash \ - clean compile - $(OBJCOPY_SREC) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.srec - $(OBJCOPY_BIN) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.bin -endef - -define Image/Build/Initramfs - $(OBJCOPY_SREC) $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs.srec -endef - -define Image/Build - $(SCRIPT_DIR)/srecimage.pl $(KDIR)/root.$(1) $(KDIR)/root.$(1).srec $(FLASH_FS) - grep -v S7 $(KDIR)/root.$(1).srec > $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec - grep -v S0 $(KDIR)/kernel.flash.srec >> $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec - $(INSTALL_BIN) $(KDIR)/kernel.flash.bin $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.bin - $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs - $(CP) $(KDIR)/kernel.flash.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-flash.srec - $(CP) $(KDIR)/kernel.ram.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-ram.srec - $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs $(TMP_DIR)/$(IMG_PREFIX)-root.fs - tar -C $(BIN_DIR) -cvzf $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \ - $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR) $(IMG_PREFIX)-root.fs -ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) - $(call Image/Build/Initramfs) -endif -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/au1000/modules.mk b/target/linux/au1000/modules.mk deleted file mode 100644 index 6b110531a..000000000 --- a/target/linux/au1000/modules.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (C) 2010-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define KernelPackage/pcmcia-au1000 - SUBMENU:=$(PCMCIA_MENU) - TITLE:=RMI/AMD Au1000 PCMCIA support - DEPENDS:=@TARGET_au1000 +kmod-pcmcia-core +kmod-pcmcia-rsrc - FILES:=$(LINUX_DIR)/drivers/pcmcia/db1xxx_ss.ko - KCONFIG:=CONFIG_PCMCIA_ALCHEMY_DEVBOARD - AUTOLOAD:=$(call AutoLoad,41,db1xxx_ss) -endef - -$(eval $(call KernelPackage,pcmcia-au1000)) diff --git a/target/linux/au1000/patches-3.18/002-openwrt_rootfs.patch b/target/linux/au1000/patches-3.18/002-openwrt_rootfs.patch deleted file mode 100644 index 1de823654..000000000 --- a/target/linux/au1000/patches-3.18/002-openwrt_rootfs.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/mips/alchemy/board-mtx1.c -+++ b/arch/mips/alchemy/board-mtx1.c -@@ -169,7 +169,7 @@ static struct platform_device mtx1_gpio_ - - static struct mtd_partition mtx1_mtd_partitions[] = { - { -- .name = "filesystem", -+ .name = "rootfs", - .size = 0x01C00000, - .offset = 0, - }, diff --git a/target/linux/au1000/patches-3.18/003-au1000_eth_ioctl.patch b/target/linux/au1000/patches-3.18/003-au1000_eth_ioctl.patch deleted file mode 100644 index 58927f590..000000000 --- a/target/linux/au1000/patches-3.18/003-au1000_eth_ioctl.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/drivers/net/ethernet/amd/au1000_eth.c -+++ b/drivers/net/ethernet/amd/au1000_eth.c -@@ -1113,10 +1113,14 @@ static void au1000_multicast_list(struct - writel(reg, &aup->mac->control); - } - -+#define AU1000_KNOWN_PHY_IOCTLS (SIOCGMIIPHY & 0xfff0) - static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) - { - struct au1000_private *aup = netdev_priv(dev); - -+ if((cmd & AU1000_KNOWN_PHY_IOCTLS) != AU1000_KNOWN_PHY_IOCTLS) -+ return -EINVAL; -+ - if (!netif_running(dev)) - return -EINVAL; - diff --git a/target/linux/au1000/patches-3.18/004-watchdog_low_init.patch b/target/linux/au1000/patches-3.18/004-watchdog_low_init.patch deleted file mode 100644 index 09110408e..000000000 --- a/target/linux/au1000/patches-3.18/004-watchdog_low_init.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/arch/mips/alchemy/board-mtx1.c -+++ b/arch/mips/alchemy/board-mtx1.c -@@ -98,6 +98,9 @@ void __init board_setup(void) - alchemy_gpio_direction_output(211, 1); /* green on */ - alchemy_gpio_direction_output(212, 0); /* red off */ - -+ /* Set watchdog pin low */ -+ alchemy_gpio_direction_output(215, 0); -+ - pm_power_off = mtx1_power_off; - _machine_halt = mtx1_power_off; - _machine_restart = mtx1_reset; diff --git a/target/linux/au1000/patches-3.18/006-codec.patch b/target/linux/au1000/patches-3.18/006-codec.patch deleted file mode 100644 index d80cf56ac..000000000 --- a/target/linux/au1000/patches-3.18/006-codec.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/arch/mips/alchemy/devboards/db1300.c -+++ b/arch/mips/alchemy/devboards/db1300.c -@@ -712,6 +712,7 @@ static struct platform_device db1300_lcd - - /**********************************************************************/ - -+#ifdef CONFIG_TOUCHSCREEN_WM97XX - static void db1300_wm97xx_irqen(struct wm97xx *wm, int enable) - { - if (enable) -@@ -744,6 +745,15 @@ static int db1300_wm97xx_probe(struct pl - return wm97xx_register_mach_ops(wm, &db1300_wm97xx_ops); - } - -+#else -+ -+static int db1300_wm97xx_probe(struct platform_device *pdev) -+{ -+ return -1; -+} -+ -+#endif -+ - static struct platform_driver db1300_wm97xx_driver = { - .driver.name = "wm97xx-touch", - .driver.owner = THIS_MODULE, diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile index 244513dfc..870029c4c 100644 --- a/target/linux/brcm2708/Makefile +++ b/target/linux/brcm2708/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=brcm2708 BOARDNAME:=Broadcom BCM27xx -FEATURES:=ext4 audio usb usbgadget display gpio fpu +FEATURES:=ext4 audio usb usbgadget display gpio fpu squashfs MAINTAINER:=Álvaro Fernández Rojas SUBTARGETS:=bcm2708 bcm2709 bcm2710 @@ -27,7 +27,8 @@ DEFAULT_PACKAGES += \ kmod-usb-hid \ kmod-sound-core kmod-sound-arm-bcm2835 \ kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \ - brcmfmac-firmware-43430-sdio kmod-brcmfmac wpad-mini + brcmfmac-firmware-43430-sdio kmod-brcmfmac wpad-mini \ + partx-utils mkf2fs e2fsprogs KERNELNAME:=Image dtbs diff --git a/target/linux/brcm2708/base-files/etc/board.d/02_network b/target/linux/brcm2708/base-files/etc/board.d/02_network index a9c947b65..c8449bb78 100755 --- a/target/linux/brcm2708/base-files/etc/board.d/02_network +++ b/target/linux/brcm2708/base-files/etc/board.d/02_network @@ -15,7 +15,8 @@ raspberrypi,model-b |\ raspberrypi,model-b-plus |\ raspberrypi,model-b-rev2 |\ raspberrypi,2-model-b |\ -raspberrypi,3-model-b) +raspberrypi,3-model-b |\ +raspberrypi,3-model-b-plus) ucidef_set_interface_lan "eth0" ;; diff --git a/target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708 b/target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708 index 76eb5905e..3a5c198fc 100644 --- a/target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708 +++ b/target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708 @@ -8,6 +8,7 @@ set_preinit_iface() { case "$(board_name)" in raspberrypi,2-model-b |\ raspberrypi,3-model-b |\ + raspberrypi,3-model-b-plus |\ raspberrypi,model-b |\ raspberrypi,model-b-plus |\ raspberrypi,model-b-rev2) diff --git a/target/linux/brcm2708/bcm2708/config-4.9 b/target/linux/brcm2708/bcm2708/config-4.9 index dccf85fac..116dd257d 100644 --- a/target/linux/brcm2708/bcm2708/config-4.9 +++ b/target/linux/brcm2708/bcm2708/config-4.9 @@ -141,6 +141,11 @@ CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=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_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_CFB_COPYAREA=y @@ -342,7 +347,6 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SG_POOL=y CONFIG_SPARSE_IRQ=y -# CONFIG_SQUASHFS is not set CONFIG_SRCU=y # CONFIG_STRIP_ASM_SYMS is not set CONFIG_SUSPEND=y diff --git a/target/linux/brcm2708/bcm2709/config-4.9 b/target/linux/brcm2708/bcm2709/config-4.9 index 71884a5fa..4e505edce 100644 --- a/target/linux/brcm2708/bcm2709/config-4.9 +++ b/target/linux/brcm2708/bcm2709/config-4.9 @@ -155,6 +155,11 @@ CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=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_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_CFB_COPYAREA=y @@ -372,7 +377,6 @@ CONFIG_SG_POOL=y CONFIG_SMP=y CONFIG_SMP_ON_UP=y CONFIG_SPARSE_IRQ=y -# CONFIG_SQUASHFS is not set CONFIG_SRCU=y # CONFIG_STRIP_ASM_SYMS is not set CONFIG_SUSPEND=y @@ -398,6 +402,7 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_COMMON=y CONFIG_USB_DWCOTG=y # CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_LAN78XX=y CONFIG_USB_NET_DRIVERS=y CONFIG_USB_NET_SMSC95XX=y CONFIG_USB_STORAGE=y diff --git a/target/linux/brcm2708/bcm2710/config-4.9 b/target/linux/brcm2708/bcm2710/config-4.9 index d402f4b57..ae772c6dd 100644 --- a/target/linux/brcm2708/bcm2710/config-4.9 +++ b/target/linux/brcm2708/bcm2710/config-4.9 @@ -47,6 +47,7 @@ CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y # CONFIG_ARM64_PTDUMP is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_ARM64_SSBD=y CONFIG_ARM64_UAO=y CONFIG_ARM64_VA_BITS=39 CONFIG_ARM64_VA_BITS_39=y @@ -59,8 +60,6 @@ CONFIG_ARM_BCM2835_CPUFREQ=y CONFIG_ARM_GIC=y CONFIG_ARM_GIC_V3=y CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_SBSA_WATCHDOG is not set -# CONFIG_ARM_SCPI_PROTOCOL is not set # CONFIG_ARM_SP805_WATCHDOG is not set CONFIG_ARM_TIMER_SP804=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y @@ -162,6 +161,11 @@ CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=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_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_CFB_COPYAREA=y @@ -181,7 +185,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAME_POINTER=y CONFIG_FREEZER=y CONFIG_FSL_ERRATUM_A008585=y -# CONFIG_FSL_MC_BUS is not set CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y CONFIG_GENERIC_ALLOCATOR=y @@ -209,6 +212,7 @@ CONFIG_GPIO_BCM_EXP=y CONFIG_GPIO_BCM_VIRT=y CONFIG_GPIO_SYSFS=y CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y @@ -285,8 +289,6 @@ CONFIG_LOGO=y CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y CONFIG_MAC_PARTITION=y CONFIG_MAGIC_SYSRQ=y CONFIG_MAILBOX=y @@ -381,7 +383,6 @@ CONFIG_SERIAL_8250_FSL=y CONFIG_SERIAL_8250_NR_UARTS=1 CONFIG_SERIAL_8250_RUNTIME_UARTS=0 CONFIG_SERIAL_8250_SHARE_IRQ=y -# CONFIG_SERIAL_AMBA_PL010 is not set CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y @@ -393,7 +394,6 @@ CONFIG_SPARSEMEM_MANUAL=y CONFIG_SPARSEMEM_VMEMMAP=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSE_IRQ=y -# CONFIG_SQUASHFS is not set CONFIG_SRCU=y # CONFIG_STRIP_ASM_SYMS is not set CONFIG_SUSPEND=y @@ -411,11 +411,13 @@ CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TREE_RCU=y CONFIG_UEVENT_HELPER_PATH="" +CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_COMMON=y CONFIG_USB_DWCOTG=y # CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_LAN78XX=y CONFIG_USB_NET_DRIVERS=y CONFIG_USB_NET_SMSC95XX=y CONFIG_USB_STORAGE=y diff --git a/target/linux/brcm2708/image/Makefile b/target/linux/brcm2708/image/Makefile index 9ea9a07a9..8ace69bdf 100644 --- a/target/linux/brcm2708/image/Makefile +++ b/target/linux/brcm2708/image/Makefile @@ -47,11 +47,11 @@ endef ### Devices ### define Device/Default - FILESYSTEMS := ext4 KERNEL := kernel-bin | kernel-img KERNEL_IMG := kernel.img - IMAGES := sdcard.img.gz - IMAGE/sdcard.img.gz := boot-img | sdcard-img | gzip | append-metadata + IMAGES := factory.img.gz sysupgrade.img.gz + IMAGE/sysupgrade.img.gz := boot-img | sdcard-img | gzip | append-metadata + IMAGE/factory.img.gz := boot-img | sdcard-img | gzip endef define Device/rpi @@ -64,9 +64,9 @@ ifeq ($(SUBTARGET),bcm2708) endif define Device/rpi-2 - DEVICE_TITLE := Raspberry Pi 2B/3B/3CM - DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-cm3 - SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-cm raspberrypi,2-model-b raspberrypi,3-model-b raspberrypi,compute-module-3 + DEVICE_TITLE := Raspberry Pi 2B/3B/3B+/3CM + DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3 + SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm raspberrypi,2-model-b raspberrypi,3-model-b raspberrypi,3-model-b-plus raspberrypi,compute-module-3 endef ifeq ($(SUBTARGET),bcm2709) TARGET_DEVICES += rpi-2 @@ -74,9 +74,9 @@ endif define Device/rpi-3 KERNEL_IMG := kernel8.img - DEVICE_TITLE := Raspberry Pi 3B (64 bit) - DEVICE_DTS := broadcom/bcm2710-rpi-3-b - SUPPORTED_DEVICES := rpi-3-b raspberrypi,3-model-b + DEVICE_TITLE := Raspberry Pi 3B/3B+ + DEVICE_DTS := broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus + SUPPORTED_DEVICES := rpi-3-b rpi-3-b-plus raspberrypi,3-model-b raspberrypi,3-model-b-plus endef ifeq ($(SUBTARGET),bcm2710) TARGET_DEVICES += rpi-3 diff --git a/target/linux/brcm2708/image/cmdline.txt b/target/linux/brcm2708/image/cmdline.txt index 24f4f0c27..c1099afb0 100644 --- a/target/linux/brcm2708/image/cmdline.txt +++ b/target/linux/brcm2708/image/cmdline.txt @@ -1 +1 @@ -dwc_otg.lpm_enable=0 console=serial0,115200 kgdboc=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait +dwc_otg.lpm_enable=0 console=serial0,115200 kgdboc=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=squashfs,ext4 rootwait diff --git a/target/linux/brcm2708/patches-4.9/950-0028-kbuild-Ignore-dtco-targets-when-filtering-symbols.patch b/target/linux/brcm2708/patches-4.9/950-0028-kbuild-Ignore-dtco-targets-when-filtering-symbols.patch index 0f5afac4e..52fe8a228 100644 --- a/target/linux/brcm2708/patches-4.9/950-0028-kbuild-Ignore-dtco-targets-when-filtering-symbols.patch +++ b/target/linux/brcm2708/patches-4.9/950-0028-kbuild-Ignore-dtco-targets-when-filtering-symbols.patch @@ -9,7 +9,7 @@ Subject: [PATCH] kbuild: Ignore dtco targets when filtering symbols --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include -@@ -284,7 +284,7 @@ ksym_dep_filter = +@@ -285,7 +285,7 @@ ksym_dep_filter = $(CPP) $(call flags_nodeps,c_flags) -D__KSYM_DEPS__ $< ;; \ as_*_S|cpp_s_S) \ $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;; \ diff --git a/target/linux/brcm2708/patches-4.9/950-0031-Add-dwc_otg-driver.patch b/target/linux/brcm2708/patches-4.9/950-0031-Add-dwc_otg-driver.patch index 34e776466..1db23d723 100644 --- a/target/linux/brcm2708/patches-4.9/950-0031-Add-dwc_otg-driver.patch +++ b/target/linux/brcm2708/patches-4.9/950-0031-Add-dwc_otg-driver.patch @@ -696,7 +696,7 @@ Signed-off-by: Noralf Trønnes } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5062,7 +5062,7 @@ static void port_event(struct usb_hub *h +@@ -5072,7 +5072,7 @@ static void port_event(struct usb_hub *h if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; diff --git a/target/linux/brcm2708/patches-4.9/950-0058-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch b/target/linux/brcm2708/patches-4.9/950-0058-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch index 408ac045f..4c3d2b15f 100644 --- a/target/linux/brcm2708/patches-4.9/950-0058-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch +++ b/target/linux/brcm2708/patches-4.9/950-0058-enabling-the-realtime-clock-1-wire-chip-DS1307-and-1.patch @@ -94,28 +94,7 @@ w1-gpio: Sort out the pullup/parasitic power tangle pdev->dev.platform_data = pdata; -@@ -113,13 +140,15 @@ static int w1_gpio_probe_dt(struct platf - static int w1_gpio_probe(struct platform_device *pdev) - { - struct w1_bus_master *master; -- struct w1_gpio_platform_data *pdata; -+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; - int err; - -- if (of_have_populated_dt()) { -- err = w1_gpio_probe_dt(pdev); -- if (err < 0) -- return err; -+ if(pdata == NULL) { -+ if (of_have_populated_dt()) { -+ err = w1_gpio_probe_dt(pdev); -+ if (err < 0) -+ return err; -+ } - } - - pdata = dev_get_platdata(&pdev->dev); -@@ -136,6 +165,22 @@ static int w1_gpio_probe(struct platform +@@ -135,6 +162,22 @@ static int w1_gpio_probe(struct platform return -ENOMEM; } @@ -138,7 +117,7 @@ w1-gpio: Sort out the pullup/parasitic power tangle err = devm_gpio_request(&pdev->dev, pdata->pin, "w1"); if (err) { dev_err(&pdev->dev, "gpio_request (pin) failed\n"); -@@ -165,6 +210,14 @@ static int w1_gpio_probe(struct platform +@@ -164,6 +207,14 @@ static int w1_gpio_probe(struct platform master->set_pullup = w1_gpio_set_pullup; } @@ -153,7 +132,7 @@ w1-gpio: Sort out the pullup/parasitic power tangle err = w1_add_master_device(master); if (err) { dev_err(&pdev->dev, "w1_add_master device failed\n"); -@@ -195,6 +248,10 @@ static int w1_gpio_remove(struct platfor +@@ -194,6 +245,10 @@ static int w1_gpio_remove(struct platfor w1_remove_master_device(master); diff --git a/target/linux/brcm2708/patches-4.9/950-0087-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch b/target/linux/brcm2708/patches-4.9/950-0087-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch index 2710ed63d..a6f034682 100644 --- a/target/linux/brcm2708/patches-4.9/950-0087-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch +++ b/target/linux/brcm2708/patches-4.9/950-0087-amba_pl011-Don-t-use-DT-aliases-for-numbering.patch @@ -14,7 +14,7 @@ use the same logic. --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -2501,7 +2501,12 @@ static int pl011_setup_port(struct devic +@@ -2517,7 +2517,12 @@ static int pl011_setup_port(struct devic if (IS_ERR(base)) return PTR_ERR(base); diff --git a/target/linux/brcm2708/patches-4.9/950-0139-usb-dwc2-Avoid-suspending-if-we-re-in-gadget-mode-18.patch b/target/linux/brcm2708/patches-4.9/950-0139-usb-dwc2-Avoid-suspending-if-we-re-in-gadget-mode-18.patch index 1bfe34408..862f322e6 100644 --- a/target/linux/brcm2708/patches-4.9/950-0139-usb-dwc2-Avoid-suspending-if-we-re-in-gadget-mode-18.patch +++ b/target/linux/brcm2708/patches-4.9/950-0139-usb-dwc2-Avoid-suspending-if-we-re-in-gadget-mode-18.patch @@ -39,7 +39,7 @@ Signed-off-by: Felipe Balbi --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c -@@ -4381,6 +4381,9 @@ static int _dwc2_hcd_suspend(struct usb_ +@@ -4383,6 +4383,9 @@ static int _dwc2_hcd_suspend(struct usb_ if (!HCD_HW_ACCESSIBLE(hcd)) goto unlock; diff --git a/target/linux/brcm2708/patches-4.9/950-0195-amba_pl011-Round-input-clock-up.patch b/target/linux/brcm2708/patches-4.9/950-0195-amba_pl011-Round-input-clock-up.patch index b981be02a..ad532c511 100644 --- a/target/linux/brcm2708/patches-4.9/950-0195-amba_pl011-Round-input-clock-up.patch +++ b/target/linux/brcm2708/patches-4.9/950-0195-amba_pl011-Round-input-clock-up.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell /* Clear pending error and receive interrupts */ pl011_write(UART011_OEIS | UART011_BEIS | UART011_PEIS | -@@ -2305,7 +2322,7 @@ static int __init pl011_console_setup(st +@@ -2321,7 +2338,7 @@ static int __init pl011_console_setup(st plat->init(); } @@ -68,7 +68,7 @@ Signed-off-by: Phil Elwell if (uap->vendor->fixed_options) { baud = uap->fixed_baud; -@@ -2432,6 +2449,7 @@ static struct uart_driver amba_reg = { +@@ -2448,6 +2465,7 @@ static struct uart_driver amba_reg = { .cons = AMBA_CONSOLE, }; @@ -76,7 +76,7 @@ Signed-off-by: Phil Elwell static int pl011_probe_dt_alias(int index, struct device *dev) { struct device_node *np; -@@ -2463,6 +2481,7 @@ static int pl011_probe_dt_alias(int inde +@@ -2479,6 +2497,7 @@ static int pl011_probe_dt_alias(int inde return ret; } diff --git a/target/linux/brcm2708/patches-4.9/950-1002-bcm2708-raspberry-pi-3-b-plus.patch b/target/linux/brcm2708/patches-4.9/950-1002-bcm2708-raspberry-pi-3-b-plus.patch new file mode 100644 index 000000000..5eb129fda --- /dev/null +++ b/target/linux/brcm2708/patches-4.9/950-1002-bcm2708-raspberry-pi-3-b-plus.patch @@ -0,0 +1,298 @@ +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -7,6 +7,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ + bcm2708-rpi-0-w.dtb \ + bcm2709-rpi-2-b.dtb \ + bcm2710-rpi-3-b.dtb \ ++ bcm2710-rpi-3-b-plus.dtb \ + bcm2710-rpi-cm3.dtb + + dtb-$(CONFIG_ARCH_ALPINE) += \ +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts +@@ -0,0 +1,220 @@ ++/dts-v1/; ++ ++#include "bcm2710.dtsi" ++#include "bcm283x-rpi-lan7515.dtsi" ++ ++/ { ++ compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837", "brcm,bcm2836"; ++ model = "Raspberry Pi 3 Model B+"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ sdio_pins: sdio_pins { ++ brcm,pins = <34 35 36 37 38 39>; ++ brcm,function = <7>; // alt3 = SD1 ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ ++ bt_pins: bt_pins { ++ brcm,pins = <43>; ++ brcm,function = <4>; /* alt0:GPCLK2 */ ++ brcm,pull = <0>; ++ }; ++ ++ uart0_pins: uart0_pins { ++ brcm,pins = <32 33>; ++ brcm,function = <7>; /* alt3=UART0 */ ++ brcm,pull = <0 2>; ++ }; ++ ++ uart1_pins: uart1_pins { ++ brcm,pins; ++ brcm,function; ++ brcm,pull; ++ }; ++ ++ audio_pins: audio_pins { ++ brcm,pins = <40 41>; ++ brcm,function = <4>; ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++ brcm,overclock-50 = <0>; ++}; ++ ++&soc { ++ expgpio: expgpio { ++ compatible = "brcm,bcm2835-expgpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins &bt_pins>; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ spidev0: spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <125000000>; ++ }; ++ ++ spidev1: spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <125000000>; ++ }; ++}; ++ ++&i2c0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 29 0>; ++ }; ++ ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "default-on"; ++ gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; ++ }; ++}; ++ ++&hdmi { ++ hpd-gpios = <&expgpio 4 GPIO_ACTIVE_LOW>; ++}; ++ ++&audio { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&audio_pins>; ++}; ++ ++/ { ++ chosen { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart1 = <&uart1>,"status"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; ++ }; ++}; ++ ++&i2c_dsi { ++ gpios = <&gpio 44 0 ++ &gpio 45 0>; ++}; +--- /dev/null ++++ b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi +@@ -0,0 +1,36 @@ ++/ { ++ aliases { ++ ethernet = ðernet; ++ }; ++}; ++ ++&usb { ++ usb1@1 { ++ compatible = "usb424,2514"; ++ reg = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ usb1_1@1 { ++ compatible = "usb424,2514"; ++ reg = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ethernet: usbether@1 { ++ compatible = "usb424,7800"; ++ reg = <1>; ++ microchip,eee-enabled; ++ microchip,tx-lpi-timer = <600>; /* non-aggressive*/ ++ }; ++ }; ++ }; ++}; ++ ++ ++/ { ++ __overrides__ { ++ eee = <ðernet>,"microchip,eee-enabled?"; ++ tx_lpi_timer = <ðernet>,"microchip,tx-lpi-timer:0"; ++ }; ++}; +--- a/arch/arm64/boot/dts/broadcom/Makefile ++++ b/arch/arm64/boot/dts/broadcom/Makefile +@@ -8,6 +8,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rp + dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb + dtb-$(CONFIG_ARCH_VULCAN) += vulcan-eval.dtb + dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb ++dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b-plus.dtb + + dts-dirs += ../overlays + +--- /dev/null ++++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dts +@@ -0,0 +1,3 @@ ++#define RPI364 ++ ++#include "../../../../arm/boot/dts/bcm2710-rpi-3-b-plus.dts" +--- a/arch/arm64/configs/bcmrpi3_defconfig ++++ b/arch/arm64/configs/bcmrpi3_defconfig +@@ -482,6 +482,7 @@ CONFIG_USB_NET_SR9700=m + CONFIG_USB_NET_SR9800=m + CONFIG_USB_NET_SMSC75XX=m + CONFIG_USB_NET_SMSC95XX=y ++CONFIG_USB_LAN78XX=y + CONFIG_USB_NET_GL620A=m + CONFIG_USB_NET_NET1080=m + CONFIG_USB_NET_PLUSB=m diff --git a/target/linux/brcm47xx/Makefile b/target/linux/brcm47xx/Makefile index f0ac7f94a..484f314bc 100644 --- a/target/linux/brcm47xx/Makefile +++ b/target/linux/brcm47xx/Makefile @@ -13,7 +13,7 @@ FEATURES:=squashfs usb SUBTARGETS:=generic mips74k legacy MAINTAINER:=Hauke Mehrtens -KERNEL_PATCHVER:=4.9 +KERNEL_PATCHVER:=4.14 define Target/Description Build firmware images for Broadcom based BCM47xx/53xx routers with MIPS CPU, *not* ARM. diff --git a/target/linux/brcm47xx/base-files/etc/board.d/01_detect b/target/linux/brcm47xx/base-files/etc/board.d/01_network similarity index 90% rename from target/linux/brcm47xx/base-files/etc/board.d/01_detect rename to target/linux/brcm47xx/base-files/etc/board.d/01_network index 18604072f..8428b43de 100755 --- a/target/linux/brcm47xx/base-files/etc/board.d/01_detect +++ b/target/linux/brcm47xx/base-files/etc/board.d/01_network @@ -4,7 +4,7 @@ . /lib/functions/system.sh . /lib/functions/uci-defaults.sh -detect_by_vlanports() { +configure_by_vlanports() { local vlan0ports="$(nvram get vlan0ports)" local vlan1ports="$(nvram get vlan1ports)" local vlan2ports="$(nvram get vlan2ports)" @@ -39,12 +39,12 @@ detect_by_vlanports() { "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0" else - logger -t "01_detect" "Unable to determine network configuration" + logger -t "01_network" "Unable to determine network configuration" ucidef_set_interface_lan "eth0" fi } -detect_by_boardnum() { +configure_by_boardnum() { local boardnum="$1" case "$boardnum" in @@ -56,12 +56,12 @@ detect_by_boardnum() { # Generic detection fallback *) - detect_by_vlanports + configure_by_vlanports ;; esac } -detect_by_boardtype() { +configure_by_boardtype() { local boardtype="$1" local boardnum="$2" @@ -111,12 +111,12 @@ detect_by_boardtype() { ;; *) - detect_by_boardnum "$boardnum" + configure_by_boardnum "$boardnum" ;; esac } -detect_by_model() { +configure_by_model() { local model="$1" local boardtype="$2" local boardnum="$3" @@ -139,7 +139,6 @@ detect_by_model() { ;; "Asus WL500G" | \ - "Asus WL500W" | \ "Microsoft MN-700") ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; @@ -159,6 +158,7 @@ detect_by_model() { "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "5@eth0" ;; + "Asus WL500W" | \ "Dell TrueMobile 2300") ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ @@ -172,21 +172,24 @@ detect_by_model() { ;; *) - detect_by_boardtype "$boardtype" "$boardnum" + configure_by_boardtype "$boardtype" "$boardnum" ;; esac } -model="$(board_name)" -boardtype="$(nvram get boardtype)" -boardnum="$(nvram get boardnum)" +model="$(cat /tmp/sysinfo/model)" +boardtype="$(board_name)" + +case "$boardtype" in + *:*) + boardnum="${boardtype##*:}" + boardtype="${boardtype%:*}" + ;; +esac board_config_update -ucidef_set_board_id "$boardtype${boardnum:+:$boardnum}" -ucidef_set_model_name "$model" - -detect_by_model "$model" "$boardtype" "$boardnum" +configure_by_model "$model" "$boardtype" "$boardnum" board_config_flush diff --git a/target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo b/target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo index 8a2de67bc..a3b0c3843 100644 --- a/target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo +++ b/target/linux/brcm47xx/base-files/lib/preinit/01_sysinfo @@ -1,12 +1,16 @@ #!/bin/sh do_sysinfo_brcm47xx() { - local name="$(sed -ne 's/^machine[ \t]*: //p' /proc/cpuinfo)" - [ -z "$name" ] && name="unknown" + local boardtype="$(nvram get boardtype)" + local boardnum="$(nvram get boardnum)" + local model="$(sed -ne 's/^machine[ \t]*: //p' /proc/cpuinfo)" + + [ -z "$model" ] && model="unknown" + [ -z "$boardtype" ] && boardtype="unknown" [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" - echo "$name" > /tmp/sysinfo/board_name - echo "unknown" > /tmp/sysinfo/model + echo "$boardtype${boardnum:+:$boardnum}" > /tmp/sysinfo/board_name + echo "$model" > /tmp/sysinfo/model } boot_hook_add preinit_main do_sysinfo_brcm47xx diff --git a/target/linux/brcm47xx/config-4.14 b/target/linux/brcm47xx/config-4.14 index 9211d10e6..d26ef6426 100644 --- a/target/linux/brcm47xx/config-4.14 +++ b/target/linux/brcm47xx/config-4.14 @@ -19,7 +19,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_BCM47XX=y CONFIG_BCM47XX_BCMA=y @@ -67,13 +66,8 @@ CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y CONFIG_CSRC_R4K=y CONFIG_DMA_NONCOHERENT=y -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set # CONFIG_EARLY_PRINTK is not set -CONFIG_EXPORTFS=y CONFIG_FIXED_PHY=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y @@ -214,7 +208,6 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_HIGHMEM=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y CONFIG_SYS_SUPPORTS_MIPS16=y -CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TINY_SRCU=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/brcm47xx/config-4.4 b/target/linux/brcm47xx/config-4.4 deleted file mode 100644 index be396bb2d..000000000 --- a/target/linux/brcm47xx/config-4.4 +++ /dev/null @@ -1,196 +0,0 @@ -CONFIG_ADM6996_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_SG_CHAIN is not set -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_BCM47XX=y -CONFIG_BCM47XX_BCMA=y -CONFIG_BCM47XX_NVRAM=y -CONFIG_BCM47XX_SSB=y -CONFIG_BCM47XX_WDT=y -CONFIG_BCMA=y -CONFIG_BCMA_BLOCKIO=y -CONFIG_BCMA_DEBUG=y -CONFIG_BCMA_DRIVER_GMAC_CMN=y -CONFIG_BCMA_DRIVER_GPIO=y -CONFIG_BCMA_DRIVER_MIPS=y -CONFIG_BCMA_DRIVER_PCI=y -CONFIG_BCMA_DRIVER_PCI_HOSTMODE=y -CONFIG_BCMA_HOST_PCI=y -CONFIG_BCMA_HOST_PCI_POSSIBLE=y -CONFIG_BCMA_HOST_SOC=y -CONFIG_BCMA_NFLASH=y -CONFIG_BCMA_PFLASH=y -CONFIG_BCMA_SFLASH=y -# CONFIG_BGMAC_BCMA is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="noinitrd console=ttyS0,115200" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -# CONFIG_CPU_BMIPS is not set -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -# CONFIG_CPU_MIPS32_R2 is not set -CONFIG_CPU_MIPSR1=y -CONFIG_CPU_MIPSR2_IRQ_VI=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_CRYPTO_RNG2=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -# CONFIG_EARLY_PRINTK is not set -CONFIG_FIXED_PHY=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_WDT=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_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_EXIT_ON_IRQ_STACK=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MIPS_CPU=y -CONFIG_IRQ_WORK=y -CONFIG_LEDS_GPIO_REGISTER=y -CONFIG_MDIO_BOARDINFO=y -CONFIG_MIPS=y -CONFIG_MIPS_CLOCK_VSYSCALL=y -CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y -# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MTD_BCM47XXSFLASH=y -CONFIG_MTD_BCM47XX_PARTS=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_BCM47XXNFLASH=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_PHYSMAP=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NO_EXCEPT_FILL=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -# CONFIG_NO_IOPORT_MAP is not set -# CONFIG_OF is not set -CONFIG_PCI=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -# CONFIG_RCU_STALL_COMMON is not set -# CONFIG_SCHED_INFO is not set -# CONFIG_SCSI_DMA is not set -CONFIG_SERIAL_8250_EXTENDED=y -# CONFIG_SERIAL_8250_FSL is not set -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SRCU=y -CONFIG_SSB=y -CONFIG_SSB_B43_PCI_BRIDGE=y -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_DEBUG=y -CONFIG_SSB_DRIVER_EXTIF=y -CONFIG_SSB_DRIVER_GIGE=y -CONFIG_SSB_DRIVER_GPIO=y -CONFIG_SSB_DRIVER_MIPS=y -CONFIG_SSB_DRIVER_PCICORE=y -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_EMBEDDED=y -CONFIG_SSB_HOST_SOC=y -CONFIG_SSB_PCICORE_HOSTMODE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_SERIAL=y -CONFIG_SSB_SFLASH=y -CONFIG_SSB_SPROM=y -CONFIG_SWCONFIG=y -CONFIG_SWCONFIG_B53=y -# CONFIG_SWCONFIG_B53_MMAP_DRIVER is not set -CONFIG_SWCONFIG_B53_PHY_DRIVER=y -CONFIG_SWCONFIG_B53_PHY_FIXUP=y -# CONFIG_SWCONFIG_B53_SRAB_DRIVER is not set -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_HAS_CPU_BMIPS=y -CONFIG_SYS_HAS_CPU_BMIPS32_3300=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_HIGHMEM=y -CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_SYS_SUPPORTS_MIPS16=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_USB_SUPPORT=y -CONFIG_USE_GENERIC_EARLY_PRINTK_8250=y -CONFIG_WATCHDOG_CORE=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/brcm47xx/patches-4.14/032-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch b/target/linux/brcm47xx/patches-4.14/032-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch new file mode 100644 index 000000000..2f85e8655 --- /dev/null +++ b/target/linux/brcm47xx/patches-4.14/032-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch @@ -0,0 +1,96 @@ +From 88b882ba0b0b7439d16d2c9df7f111cdf793443b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 8 Apr 2018 22:39:15 +0200 +Subject: [PATCH] MIPS: BCM47XX: Add support for Netgear WNR1000 V3 + +This adds support for detecting this model board and registers some LEDs +and buttons. + +There are two uncommon things regarding this device: +1) It can use two different "board_id" ID values. + Unit I have uses "U12H139T00_NETGEAR" value. This magic is also used + in firmware file header. There are two reports (one from an OpenWrt + user) of a different "U12H139T50_NETGEAR" magic though. +2) Power LEDs share GPIOs with buttons. + Amber one seems to share GPIO 2 with WPS button and green one seems + to share GPIO 3 with reset button. It remains unknown how to support + them and handle buttons at the same time. For that reason they aren't + added to the list of supported LEDs. +--- + arch/mips/bcm47xx/board.c | 2 ++ + arch/mips/bcm47xx/buttons.c | 9 +++++++++ + arch/mips/bcm47xx/leds.c | 9 +++++++++ + arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 1 + + 4 files changed, 21 insertions(+) + +--- a/arch/mips/bcm47xx/board.c ++++ b/arch/mips/bcm47xx/board.c +@@ -172,6 +172,8 @@ struct bcm47xx_board_type_list1 bcm47xx_ + {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"}, ++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T00_NETGEAR"}, ++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"}, +--- a/arch/mips/bcm47xx/buttons.c ++++ b/arch/mips/bcm47xx/buttons.c +@@ -412,6 +412,12 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i + }; + + static const struct gpio_keys_button ++bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = { ++ BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON), ++ BCM47XX_GPIO_KEY(3, KEY_RESTART), ++}; ++ ++static const struct gpio_keys_button + bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = { + BCM47XX_GPIO_KEY(4, KEY_RESTART), + BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), +@@ -670,6 +676,9 @@ int __init bcm47xx_buttons_register(void + case BCM47XX_BOARD_NETGEAR_WNDR4500V1: + err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); + break; ++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3: ++ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3); ++ break; + case BCM47XX_BOARD_NETGEAR_WNR3500L: + err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1); + break; +--- a/arch/mips/bcm47xx/leds.c ++++ b/arch/mips/bcm47xx/leds.c +@@ -498,6 +498,12 @@ bcm47xx_leds_netgear_wndr4500v1[] __init + }; + + static const struct gpio_led ++bcm47xx_leds_netgear_wnr1000_v3[] __initconst = { ++ BCM47XX_GPIO_LED(0, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), ++ BCM47XX_GPIO_LED(1, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), ++}; ++ ++static const struct gpio_led + bcm47xx_leds_netgear_wnr3500lv1[] __initconst = { + BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), + BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), +@@ -758,6 +764,9 @@ void __init bcm47xx_leds_register(void) + case BCM47XX_BOARD_NETGEAR_WNDR4500V1: + bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1); + break; ++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3: ++ bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr1000_v3); ++ break; + case BCM47XX_BOARD_NETGEAR_WNR3500L: + bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1); + break; +--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h ++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h +@@ -110,6 +110,7 @@ enum bcm47xx_board { + BCM47XX_BOARD_NETGEAR_WNDR4000, + BCM47XX_BOARD_NETGEAR_WNDR4500V1, + BCM47XX_BOARD_NETGEAR_WNDR4500V2, ++ BCM47XX_BOARD_NETGEAR_WNR1000_V3, + BCM47XX_BOARD_NETGEAR_WNR2000, + BCM47XX_BOARD_NETGEAR_WNR3500L, + BCM47XX_BOARD_NETGEAR_WNR3500U, diff --git a/target/linux/brcm47xx/patches-4.14/033-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch b/target/linux/brcm47xx/patches-4.14/033-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch new file mode 100644 index 000000000..7c860bb7e --- /dev/null +++ b/target/linux/brcm47xx/patches-4.14/033-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch @@ -0,0 +1,24 @@ +From 663beaeacf2552ed07405e69e96a18775e069eab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 8 Apr 2018 22:51:08 +0200 +Subject: [PATCH] firmware: bcm47xx_nvram: support small (0x6000 B) NVRAM + partitions + +Some old devices with 4 MiB flashes were using 0x1000 block size and +could use smaller (0x6000 bytes) flash partition for storing NVRAM +content. This adds support for reading NVRAM on Netgear WNR1000 V3. +--- + drivers/firmware/broadcom/bcm47xx_nvram.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -36,7 +36,7 @@ struct nvram_header { + + static char nvram_buf[NVRAM_SPACE]; + static size_t nvram_len; +-static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; ++static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000}; + + static u32 find_nvram_size(void __iomem *end) + { diff --git a/target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch index f6b8d66bb..74060e218 100644 --- a/target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch +++ b/target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch @@ -21,14 +21,6 @@ {{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"}, -@@ -172,6 +176,7 @@ struct bcm47xx_board_type_list1 bcm47xx_ - {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"}, -+ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"}, --- a/arch/mips/bcm47xx/buttons.c +++ b/arch/mips/bcm47xx/buttons.c @@ -27,6 +27,12 @@ @@ -81,19 +73,7 @@ bcm47xx_buttons_netgear_wndr3400v1[] __initconst = { BCM47XX_GPIO_KEY(4, KEY_RESTART), BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), -@@ -412,6 +441,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i - }; - - static const struct gpio_keys_button -+bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = { -+ BCM47XX_GPIO_KEY(3, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button - bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = { - BCM47XX_GPIO_KEY(4, KEY_RESTART), - BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), -@@ -465,6 +499,9 @@ int __init bcm47xx_buttons_register(void +@@ -471,6 +500,9 @@ int __init bcm47xx_buttons_register(void int err; switch (board) { @@ -103,7 +83,7 @@ case BCM47XX_BOARD_ASUS_RTN12: err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12); break; -@@ -595,6 +632,12 @@ int __init bcm47xx_buttons_register(void +@@ -601,6 +633,12 @@ int __init bcm47xx_buttons_register(void case BCM47XX_BOARD_LINKSYS_WRT310NV1: err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1); break; @@ -116,7 +96,7 @@ case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2); break; -@@ -658,6 +701,12 @@ int __init bcm47xx_buttons_register(void +@@ -664,6 +702,12 @@ int __init bcm47xx_buttons_register(void err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3); break; @@ -129,16 +109,6 @@ case BCM47XX_BOARD_NETGEAR_WNDR3400V1: err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1); break; -@@ -670,6 +719,9 @@ int __init bcm47xx_buttons_register(void - case BCM47XX_BOARD_NETGEAR_WNDR4500V1: - err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); - break; -+ case BCM47XX_BOARD_NETGEAR_WNR1000_V3: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3); -+ break; - case BCM47XX_BOARD_NETGEAR_WNR3500L: - err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1); - break; --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h @@ -72,6 +72,7 @@ enum bcm47xx_board { @@ -162,14 +132,6 @@ BCM47XX_BOARD_NETGEAR_WNDR3300, BCM47XX_BOARD_NETGEAR_WNDR3400V1, BCM47XX_BOARD_NETGEAR_WNDR3400V2, -@@ -110,6 +114,7 @@ enum bcm47xx_board { - BCM47XX_BOARD_NETGEAR_WNDR4000, - BCM47XX_BOARD_NETGEAR_WNDR4500V1, - BCM47XX_BOARD_NETGEAR_WNDR4500V2, -+ BCM47XX_BOARD_NETGEAR_WNR1000_V3, - BCM47XX_BOARD_NETGEAR_WNR2000, - BCM47XX_BOARD_NETGEAR_WNR3500L, - BCM47XX_BOARD_NETGEAR_WNR3500U, --- a/arch/mips/bcm47xx/leds.c +++ b/arch/mips/bcm47xx/leds.c @@ -30,6 +30,14 @@ @@ -201,7 +163,7 @@ bcm47xx_leds_linksys_wrt54g_generic[] __initconst = { BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), -@@ -550,6 +565,9 @@ void __init bcm47xx_leds_register(void) +@@ -556,6 +571,9 @@ void __init bcm47xx_leds_register(void) enum bcm47xx_board board = bcm47xx_board_get(); switch (board) { @@ -211,7 +173,7 @@ case BCM47XX_BOARD_ASUS_RTN12: bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12); break; -@@ -683,6 +701,9 @@ void __init bcm47xx_leds_register(void) +@@ -689,6 +707,9 @@ void __init bcm47xx_leds_register(void) case BCM47XX_BOARD_LINKSYS_WRT310NV1: bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1); break; diff --git a/target/linux/brcm47xx/patches-4.14/330-Revert-MIPS-BCM47XX-Enable-74K-Core-ExternalSync-for.patch b/target/linux/brcm47xx/patches-4.14/330-Revert-MIPS-BCM47XX-Enable-74K-Core-ExternalSync-for.patch new file mode 100644 index 000000000..ad306210b --- /dev/null +++ b/target/linux/brcm47xx/patches-4.14/330-Revert-MIPS-BCM47XX-Enable-74K-Core-ExternalSync-for.patch @@ -0,0 +1,76 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 27 Jul 2018 12:39:01 +0200 +Subject: [PATCH] Revert "MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe + erratum" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 2a027b47dba6b77ab8c8e47b589ae9bbc5ac6175. + +Enabling ExternalSync caused a regression for BCM4718A1 (used e.g. in +Netgear E3000 and ASUS RT-N16): it simply hangs during PCIe +initialization. It's likely that BCM4717A1 is also affected. + +I didn't notice that earlier as the only BCM47XX devices with PCIe I +own are: +1) BCM4706 with 2 x 14e4:4331 +2) BCM4706 with 14e4:4360 and 14e4:4331 +it appears that BCM4706 is unaffected. + +While BCM5300X-ES300-RDS.pdf seems to document that erratum and its +workarounds (according to quotes provided by Tokunori) it seems not even +Broadcom follows them. + +According to the provided info Broadcom should define CONF7_ES in their +SDK's mipsinc.h and implement workaround in the si_mips_init(). Checking +both didn't reveal such code. It *could* mean Broadcom also had some +problems with the given workaround. + +Reported-by: Michael Marley +Cc: Tokunori Ikegami +Cc: Paul Burton +Cc: Hauke Mehrtens +Cc: Chris Packham +Cc: stable@vger.kernel.org +Cc: James Hogan +Signed-off-by: Rafał Miłecki +--- + arch/mips/bcm47xx/setup.c | 6 ------ + arch/mips/include/asm/mipsregs.h | 3 --- + 2 files changed, 9 deletions(-) + +--- a/arch/mips/bcm47xx/setup.c ++++ b/arch/mips/bcm47xx/setup.c +@@ -212,12 +212,6 @@ static int __init bcm47xx_cpu_fixes(void + */ + if (bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4706) + cpu_wait = NULL; +- +- /* +- * BCM47XX Erratum "R10: PCIe Transactions Periodically Fail" +- * Enable ExternalSync for sync instruction to take effect +- */ +- set_c0_config7(MIPS_CONF7_ES); + break; + #endif + } +--- a/arch/mips/include/asm/mipsregs.h ++++ b/arch/mips/include/asm/mipsregs.h +@@ -680,8 +680,6 @@ + #define MIPS_CONF7_WII (_ULCAST_(1) << 31) + + #define MIPS_CONF7_RPS (_ULCAST_(1) << 2) +-/* ExternalSync */ +-#define MIPS_CONF7_ES (_ULCAST_(1) << 8) + + #define MIPS_CONF7_IAR (_ULCAST_(1) << 10) + #define MIPS_CONF7_AR (_ULCAST_(1) << 16) +@@ -2747,7 +2745,6 @@ __BUILD_SET_C0(status) + __BUILD_SET_C0(cause) + __BUILD_SET_C0(config) + __BUILD_SET_C0(config5) +-__BUILD_SET_C0(config7) + __BUILD_SET_C0(intcontrol) + __BUILD_SET_C0(intctl) + __BUILD_SET_C0(srsmap) diff --git a/target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch b/target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch index 4b726bb42..aaab39ae4 100644 --- a/target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch +++ b/target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch @@ -245,7 +245,7 @@ out the configuration than the in kernel cfe config reader. @@ -37,6 +37,8 @@ struct nvram_header { static char nvram_buf[NVRAM_SPACE]; static size_t nvram_len; - static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; + static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000}; +static int cfe_env; +extern char *cfe_env_get(char *nv_buf, const char *name); diff --git a/target/linux/brcm47xx/patches-4.14/999-wl_exports.patch b/target/linux/brcm47xx/patches-4.14/999-wl_exports.patch index 60ea1ea40..2ecf65147 100644 --- a/target/linux/brcm47xx/patches-4.14/999-wl_exports.patch +++ b/target/linux/brcm47xx/patches-4.14/999-wl_exports.patch @@ -8,7 +8,7 @@ +char nvram_buf[NVRAM_SPACE]; +EXPORT_SYMBOL(nvram_buf); static size_t nvram_len; - static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; + static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000}; static int cfe_env; --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c diff --git a/target/linux/brcm47xx/patches-4.4/030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch b/target/linux/brcm47xx/patches-4.4/030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch deleted file mode 100644 index 49ba62373..000000000 --- a/target/linux/brcm47xx/patches-4.4/030-MIPS-BCM47XX-Add-Luxul-devices-to-the-database.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 36b3b702c20e67b18070159dfba80d2084836928 Mon Sep 17 00:00:00 2001 -From: Dan Haab -Date: Mon, 23 Jan 2017 12:50:38 -0700 -Subject: [PATCH] MIPS: BCM47XX: Add Luxul devices to the database -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -So far only Luxul XWR-1750 router was supported. This adds a set of -other Luxul devices based on BCM47XX. It's a standard support for LEDs -and buttons. - -Signed-off-by: Dan Haab -Cc: Hauke Mehrtens -Cc: Rafał Miłecki -Cc: linux-mips@linux-mips.org -Patchwork: https://patchwork.linux-mips.org/patch/15106/ -Signed-off-by: Ralf Baechle ---- - arch/mips/bcm47xx/board.c | 9 +++ - arch/mips/bcm47xx/buttons.c | 72 +++++++++++++++++++ - arch/mips/bcm47xx/leds.c | 81 ++++++++++++++++++++++ - arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 9 +++ - 4 files changed, 171 insertions(+) - ---- a/arch/mips/bcm47xx/board.c -+++ b/arch/mips/bcm47xx/board.c -@@ -149,6 +149,15 @@ struct bcm47xx_board_type_list2 bcm47xx_ - /* board_id */ - static const - struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = { -+ {{BCM47XX_BOARD_LUXUL_ABR_4400_V1, "Luxul ABR-4400 V1"}, "luxul_abr4400_v1"}, -+ {{BCM47XX_BOARD_LUXUL_XAP_310_V1, "Luxul XAP-310 V1"}, "luxul_xap310_v1"}, -+ {{BCM47XX_BOARD_LUXUL_XAP_1210_V1, "Luxul XAP-1210 V1"}, "luxul_xap1210_v1"}, -+ {{BCM47XX_BOARD_LUXUL_XAP_1230_V1, "Luxul XAP-1230 V1"}, "luxul_xap1230_v1"}, -+ {{BCM47XX_BOARD_LUXUL_XAP_1240_V1, "Luxul XAP-1240 V1"}, "luxul_xap1240_v1"}, -+ {{BCM47XX_BOARD_LUXUL_XAP_1500_V1, "Luxul XAP-1500 V1"}, "luxul_xap1500_v1"}, -+ {{BCM47XX_BOARD_LUXUL_XBR_4400_V1, "Luxul XBR-4400 V1"}, "luxul_xbr4400_v1"}, -+ {{BCM47XX_BOARD_LUXUL_XVW_P30_V1, "Luxul XVW-P30 V1"}, "luxul_xvwp30_v1"}, -+ {{BCM47XX_BOARD_LUXUL_XWR_600_V1, "Luxul XWR-600 V1"}, "luxul_xwr600_v1"}, - {{BCM47XX_BOARD_LUXUL_XWR_1750_V1, "Luxul XWR-1750 V1"}, "luxul_xwr1750_v1"}, - {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"}, ---- a/arch/mips/bcm47xx/buttons.c -+++ b/arch/mips/bcm47xx/buttons.c -@@ -308,6 +308,51 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __in - /* Luxul */ - - static const struct gpio_keys_button -+bcm47xx_buttons_luxul_abr_4400_v1[] = { -+ BCM47XX_GPIO_KEY(14, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_luxul_xap_310_v1[] = { -+ BCM47XX_GPIO_KEY(20, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_luxul_xap_1210_v1[] = { -+ BCM47XX_GPIO_KEY(8, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_luxul_xap_1230_v1[] = { -+ BCM47XX_GPIO_KEY(8, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_luxul_xap_1240_v1[] = { -+ BCM47XX_GPIO_KEY(8, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_luxul_xap_1500_v1[] = { -+ BCM47XX_GPIO_KEY(14, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_luxul_xbr_4400_v1[] = { -+ BCM47XX_GPIO_KEY(14, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_luxul_xvw_p30_v1[] = { -+ BCM47XX_GPIO_KEY(20, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_luxul_xwr_600_v1[] = { -+ BCM47XX_GPIO_KEY(8, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button - bcm47xx_buttons_luxul_xwr_1750_v1[] = { - BCM47XX_GPIO_KEY(14, BTN_TASK), - }; -@@ -567,6 +612,33 @@ int __init bcm47xx_buttons_register(void - err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs); - break; - -+ case BCM47XX_BOARD_LUXUL_ABR_4400_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_abr_4400_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_310_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_310_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_1210_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1210_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_1230_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1230_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_1240_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1240_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_1500_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1500_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XBR_4400_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xbr_4400_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XVW_P30_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xvw_p30_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XWR_600_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_600_v1); -+ break; - case BCM47XX_BOARD_LUXUL_XWR_1750_V1: - err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1); - break; ---- a/arch/mips/bcm47xx/leds.c -+++ b/arch/mips/bcm47xx/leds.c -@@ -373,6 +373,60 @@ bcm47xx_leds_linksys_wrtsl54gs[] __initc - /* Luxul */ - - static const struct gpio_led -+bcm47xx_leds_luxul_abr_4400_v1[] __initconst = { -+ BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"), -+}; -+ -+static const struct gpio_led -+bcm47xx_leds_luxul_xap_310_v1[] __initconst = { -+ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), -+}; -+ -+static const struct gpio_led -+bcm47xx_leds_luxul_xap_1210_v1[] __initconst = { -+ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), -+}; -+ -+static const struct gpio_led -+bcm47xx_leds_luxul_xap_1230_v1[] __initconst = { -+ BCM47XX_GPIO_LED(3, "blue", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED(4, "green", "bridge", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), -+}; -+ -+static const struct gpio_led -+bcm47xx_leds_luxul_xap_1240_v1[] __initconst = { -+ BCM47XX_GPIO_LED(3, "blue", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED(4, "green", "bridge", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), -+}; -+ -+static const struct gpio_led -+bcm47xx_leds_luxul_xap_1500_v1[] __initconst = { -+ BCM47XX_GPIO_LED_TRIGGER(13, "green", "status", 1, "timer"), -+}; -+ -+static const struct gpio_led -+bcm47xx_leds_luxul_xbr_4400_v1[] __initconst = { -+ BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"), -+}; -+ -+static const struct gpio_led -+bcm47xx_leds_luxul_xvw_p30_v1[] __initconst = { -+ BCM47XX_GPIO_LED_TRIGGER(0, "blue", "status", 1, "timer"), -+ BCM47XX_GPIO_LED(1, "green", "link", 1, LEDS_GPIO_DEFSTATE_OFF), -+}; -+ -+static const struct gpio_led -+bcm47xx_leds_luxul_xwr_600_v1[] __initconst = { -+ BCM47XX_GPIO_LED(3, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), -+ BCM47XX_GPIO_LED(9, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), -+}; -+ -+static const struct gpio_led - bcm47xx_leds_luxul_xwr_1750_v1[] __initconst = { - BCM47XX_GPIO_LED(5, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF), - BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), -@@ -633,6 +687,33 @@ void __init bcm47xx_leds_register(void) - bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs); - break; - -+ case BCM47XX_BOARD_LUXUL_ABR_4400_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_abr_4400_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_310_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_310_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_1210_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1210_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_1230_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1230_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_1240_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1240_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XAP_1500_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1500_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XBR_4400_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xbr_4400_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XVW_P30_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xvw_p30_v1); -+ break; -+ case BCM47XX_BOARD_LUXUL_XWR_600_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_600_v1); -+ break; - case BCM47XX_BOARD_LUXUL_XWR_1750_V1: - bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1); - break; ---- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h -+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h -@@ -80,6 +80,15 @@ enum bcm47xx_board { - BCM47XX_BOARD_LINKSYS_WRT610NV2, - BCM47XX_BOARD_LINKSYS_WRTSL54GS, - -+ BCM47XX_BOARD_LUXUL_ABR_4400_V1, -+ BCM47XX_BOARD_LUXUL_XAP_310_V1, -+ BCM47XX_BOARD_LUXUL_XAP_1210_V1, -+ BCM47XX_BOARD_LUXUL_XAP_1230_V1, -+ BCM47XX_BOARD_LUXUL_XAP_1240_V1, -+ BCM47XX_BOARD_LUXUL_XAP_1500_V1, -+ BCM47XX_BOARD_LUXUL_XBR_4400_V1, -+ BCM47XX_BOARD_LUXUL_XVW_P30_V1, -+ BCM47XX_BOARD_LUXUL_XWR_600_V1, - BCM47XX_BOARD_LUXUL_XWR_1750_V1, - - BCM47XX_BOARD_MICROSOFT_MN700, diff --git a/target/linux/brcm47xx/patches-4.4/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch b/target/linux/brcm47xx/patches-4.4/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch deleted file mode 100644 index d14719ba3..000000000 --- a/target/linux/brcm47xx/patches-4.4/032-MIPS-BCM47XX-Add-Luxul-XAP1500-XWR1750-WiFi-LEDs.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 272641206100e89656038180da12eff4f03d79d1 Mon Sep 17 00:00:00 2001 -From: Dan Haab -Date: Tue, 27 Mar 2018 11:24:34 -0600 -Subject: [PATCH] MIPS: BCM47XX: Add Luxul XAP1500/XWR1750 WiFi LEDs - -Some Luxul devices use PCIe connected GPIO LEDs that are not available -until the PCI subsytem and its drivers load. Using the same array for -these LEDs would block registering any LEDs until all GPIOs become -available. This may be undesired behavior as some LEDs should be -available as early as possible (e.g. system status LED). This patch will -allow registering available LEDs while deferring these PCIe GPIO -connected 'extra' LEDs until they become available. - -Signed-off-by: Dan Haab -Cc: Ralf Baechle -Cc: Hauke Mehrtens -Cc: linux-mips@linux-mips.org -Patchwork: https://patchwork.linux-mips.org/patch/18952/ -Signed-off-by: James Hogan ---- - arch/mips/bcm47xx/leds.c | 21 +++++++++++++++++++++ - 1 file changed, 21 insertions(+) - ---- a/arch/mips/bcm47xx/leds.c -+++ b/arch/mips/bcm47xx/leds.c -@@ -408,6 +408,12 @@ bcm47xx_leds_luxul_xap_1500_v1[] __initc - }; - - static const struct gpio_led -+bcm47xx_leds_luxul_xap1500_v1_extra[] __initconst = { -+ BCM47XX_GPIO_LED(44, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED(76, "green", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), -+}; -+ -+static const struct gpio_led - bcm47xx_leds_luxul_xbr_4400_v1[] __initconst = { - BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), - BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"), -@@ -434,6 +440,11 @@ bcm47xx_leds_luxul_xwr_1750_v1[] __initc - BCM47XX_GPIO_LED(15, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), - }; - -+static const struct gpio_led -+bcm47xx_leds_luxul_xwr1750_v1_extra[] __initconst = { -+ BCM47XX_GPIO_LED(76, "green", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), -+}; -+ - /* Microsoft */ - - static const struct gpio_led -@@ -527,6 +538,12 @@ static struct gpio_led_platform_data bcm - bcm47xx_leds_pdata.num_leds = ARRAY_SIZE(dev_leds); \ - } while (0) - -+static struct gpio_led_platform_data bcm47xx_leds_pdata_extra __initdata = {}; -+#define bcm47xx_set_pdata_extra(dev_leds) do { \ -+ bcm47xx_leds_pdata_extra.leds = dev_leds; \ -+ bcm47xx_leds_pdata_extra.num_leds = ARRAY_SIZE(dev_leds); \ -+} while (0) -+ - void __init bcm47xx_leds_register(void) - { - enum bcm47xx_board board = bcm47xx_board_get(); -@@ -704,6 +721,7 @@ void __init bcm47xx_leds_register(void) - break; - case BCM47XX_BOARD_LUXUL_XAP_1500_V1: - bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1500_v1); -+ bcm47xx_set_pdata_extra(bcm47xx_leds_luxul_xap1500_v1_extra); - break; - case BCM47XX_BOARD_LUXUL_XBR_4400_V1: - bcm47xx_set_pdata(bcm47xx_leds_luxul_xbr_4400_v1); -@@ -716,6 +734,7 @@ void __init bcm47xx_leds_register(void) - break; - case BCM47XX_BOARD_LUXUL_XWR_1750_V1: - bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1); -+ bcm47xx_set_pdata_extra(bcm47xx_leds_luxul_xwr1750_v1_extra); - break; - - case BCM47XX_BOARD_MICROSOFT_MN700: -@@ -759,4 +778,6 @@ void __init bcm47xx_leds_register(void) - } - - gpio_led_register_device(-1, &bcm47xx_leds_pdata); -+ if (bcm47xx_leds_pdata_extra.num_leds) -+ gpio_led_register_device(0, &bcm47xx_leds_pdata_extra); - } diff --git a/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch b/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch deleted file mode 100644 index 32a65186d..000000000 --- a/target/linux/brcm47xx/patches-4.4/159-cpu_fixes.patch +++ /dev/null @@ -1,468 +0,0 @@ ---- a/arch/mips/include/asm/r4kcache.h -+++ b/arch/mips/include/asm/r4kcache.h -@@ -25,6 +25,38 @@ - extern void (*r4k_blast_dcache)(void); - extern void (*r4k_blast_icache)(void); - -+#if defined(CONFIG_BCM47XX) && !defined(CONFIG_CPU_MIPS32_R2) -+#include -+#include -+#define BCM4710_DUMMY_RREG() bcm4710_dummy_rreg() -+ -+static inline unsigned long bcm4710_dummy_rreg(void) -+{ -+ return *(volatile unsigned long *)(KSEG1ADDR(SSB_ENUM_BASE)); -+} -+ -+#define BCM4710_FILL_TLB(addr) bcm4710_fill_tlb((void *)(addr)) -+ -+static inline unsigned long bcm4710_fill_tlb(void *addr) -+{ -+ return *(unsigned long *)addr; -+} -+ -+#define BCM4710_PROTECTED_FILL_TLB(addr) bcm4710_protected_fill_tlb((void *)(addr)) -+ -+static inline void bcm4710_protected_fill_tlb(void *addr) -+{ -+ unsigned long x; -+ get_dbe(x, (unsigned long *)addr);; -+} -+ -+#else -+#define BCM4710_DUMMY_RREG() -+ -+#define BCM4710_FILL_TLB(addr) -+#define BCM4710_PROTECTED_FILL_TLB(addr) -+#endif -+ - /* - * This macro return a properly sign-extended address suitable as base address - * for indexed cache operations. Two issues here: -@@ -98,6 +130,7 @@ static inline void flush_icache_line_ind - static inline void flush_dcache_line_indexed(unsigned long addr) - { - __dflush_prologue -+ BCM4710_DUMMY_RREG(); - cache_op(Index_Writeback_Inv_D, addr); - __dflush_epilogue - } -@@ -125,6 +158,7 @@ static inline void flush_icache_line(uns - static inline void flush_dcache_line(unsigned long addr) - { - __dflush_prologue -+ BCM4710_DUMMY_RREG(); - cache_op(Hit_Writeback_Inv_D, addr); - __dflush_epilogue - } -@@ -132,6 +166,7 @@ static inline void flush_dcache_line(uns - static inline void invalidate_dcache_line(unsigned long addr) - { - __dflush_prologue -+ BCM4710_DUMMY_RREG(); - cache_op(Hit_Invalidate_D, addr); - __dflush_epilogue - } -@@ -187,6 +222,7 @@ static inline void protected_flush_icach - #ifdef CONFIG_EVA - protected_cachee_op(Hit_Invalidate_I, addr); - #else -+ BCM4710_DUMMY_RREG(); - protected_cache_op(Hit_Invalidate_I, addr); - #endif - break; -@@ -201,6 +237,7 @@ static inline void protected_flush_icach - */ - static inline void protected_writeback_dcache_line(unsigned long addr) - { -+ BCM4710_DUMMY_RREG(); - #ifdef CONFIG_EVA - protected_cachee_op(Hit_Writeback_Inv_D, addr); - #else -@@ -554,8 +591,51 @@ static inline void invalidate_tcache_pag - : "r" (base), \ - "i" (op)); - -+static inline void blast_dcache(void) -+{ -+ unsigned long start = KSEG0; -+ unsigned long dcache_size = current_cpu_data.dcache.waysize * current_cpu_data.dcache.ways; -+ unsigned long end = (start + dcache_size); -+ -+ do { -+ BCM4710_DUMMY_RREG(); -+ cache_op(Index_Writeback_Inv_D, start); -+ start += current_cpu_data.dcache.linesz; -+ } while(start < end); -+} -+ -+static inline void blast_dcache_page(unsigned long page) -+{ -+ unsigned long start = page; -+ unsigned long end = start + PAGE_SIZE; -+ -+ BCM4710_FILL_TLB(start); -+ do { -+ BCM4710_DUMMY_RREG(); -+ cache_op(Hit_Writeback_Inv_D, start); -+ start += current_cpu_data.dcache.linesz; -+ } while(start < end); -+} -+ -+static inline void blast_dcache_page_indexed(unsigned long page) -+{ -+ unsigned long start = page; -+ unsigned long end = start + PAGE_SIZE; -+ unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit; -+ unsigned long ws_end = current_cpu_data.dcache.ways << -+ current_cpu_data.dcache.waybit; -+ unsigned long ws, addr; -+ for (ws = 0; ws < ws_end; ws += ws_inc) { -+ start = page + ws; -+ for (addr = start; addr < end; addr += current_cpu_data.dcache.linesz) { -+ BCM4710_DUMMY_RREG(); -+ cache_op(Index_Writeback_Inv_D, addr); -+ } -+ } -+} -+ - /* build blast_xxx, blast_xxx_page, blast_xxx_page_indexed */ --#define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize, extra) \ -+#define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize, extra, war) \ - static inline void extra##blast_##pfx##cache##lsize(void) \ - { \ - unsigned long start = INDEX_BASE; \ -@@ -567,6 +647,7 @@ static inline void extra##blast_##pfx##c - \ - __##pfx##flush_prologue \ - \ -+ war \ - for (ws = 0; ws < ws_end; ws += ws_inc) \ - for (addr = start; addr < end; addr += lsize * 32) \ - cache##lsize##_unroll32(addr|ws, indexop); \ -@@ -581,6 +662,7 @@ static inline void extra##blast_##pfx##c - \ - __##pfx##flush_prologue \ - \ -+ war \ - do { \ - cache##lsize##_unroll32(start, hitop); \ - start += lsize * 32; \ -@@ -599,6 +681,8 @@ static inline void extra##blast_##pfx##c - current_cpu_data.desc.waybit; \ - unsigned long ws, addr; \ - \ -+ war \ -+ \ - __##pfx##flush_prologue \ - \ - for (ws = 0; ws < ws_end; ws += ws_inc) \ -@@ -608,26 +692,26 @@ static inline void extra##blast_##pfx##c - __##pfx##flush_epilogue \ - } - --__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16, ) --__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16, ) --__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16, ) --__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32, ) --__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32, ) --__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I_Loongson2, 32, loongson2_) --__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32, ) --__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64, ) --__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64, ) --__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64, ) --__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 128, ) --__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 128, ) --__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128, ) -- --__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16, ) --__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 32, ) --__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 16, ) --__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 32, ) --__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64, ) --__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128, ) -+__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16, , ) -+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16, , BCM4710_FILL_TLB(start);) -+__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16, , ) -+__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32, , ) -+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32, , BCM4710_FILL_TLB(start);) -+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I_Loongson2, 32, loongson2_, BCM4710_FILL_TLB(start);) -+__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32, , ) -+__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64, , ) -+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64, , BCM4710_FILL_TLB(start);) -+__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64, , ) -+__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 128, , ) -+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 128, , ) -+__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128, , ) -+ -+__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16, , ) -+__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 32, , ) -+__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 16, , ) -+__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 32, , ) -+__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64, , ) -+__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128, , ) - - #define __BUILD_BLAST_USER_CACHE(pfx, desc, indexop, hitop, lsize) \ - static inline void blast_##pfx##cache##lsize##_user_page(unsigned long page) \ -@@ -656,17 +740,19 @@ __BUILD_BLAST_USER_CACHE(d, dcache, Inde - __BUILD_BLAST_USER_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64) - - /* build blast_xxx_range, protected_blast_xxx_range */ --#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot, extra) \ -+#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot, extra, war, war2) \ - static inline void prot##extra##blast_##pfx##cache##_range(unsigned long start, \ - unsigned long end) \ - { \ - unsigned long lsize = cpu_##desc##_line_size(); \ - unsigned long addr = start & ~(lsize - 1); \ - unsigned long aend = (end - 1) & ~(lsize - 1); \ -+ war \ - \ - __##pfx##flush_prologue \ - \ - while (1) { \ -+ war2 \ - prot##cache_op(hitop, addr); \ - if (addr == aend) \ - break; \ -@@ -678,8 +764,8 @@ static inline void prot##extra##blast_## - - #ifndef CONFIG_EVA - --__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_, ) --__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_, ) -+__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_, , BCM4710_PROTECTED_FILL_TLB(addr); BCM4710_PROTECTED_FILL_TLB(aend);, BCM4710_DUMMY_RREG();) -+__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_, , , ) - - #else - -@@ -716,14 +802,14 @@ __BUILD_PROT_BLAST_CACHE_RANGE(d, dcache - __BUILD_PROT_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I) - - #endif --__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_, ) -+__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_, , , ) - __BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I_Loongson2, \ -- protected_, loongson2_) --__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, , ) --__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, , ) --__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, , ) -+ protected_, loongson2_, , ) -+__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, , , BCM4710_FILL_TLB(addr); BCM4710_FILL_TLB(aend);, BCM4710_DUMMY_RREG();) -+__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, , , , ) -+__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, , , , ) - /* blast_inv_dcache_range */ --__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, , ) --__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, , ) -+__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, , , , BCM4710_DUMMY_RREG();) -+__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, , , , ) - - #endif /* _ASM_R4KCACHE_H */ ---- a/arch/mips/include/asm/stackframe.h -+++ b/arch/mips/include/asm/stackframe.h -@@ -365,6 +365,10 @@ - .macro RESTORE_SP_AND_RET - LONG_L sp, PT_R29(sp) - .set arch=r4000 -+#ifdef CONFIG_BCM47XX -+ nop -+ nop -+#endif - eret - .set mips0 - .endm ---- a/arch/mips/kernel/genex.S -+++ b/arch/mips/kernel/genex.S -@@ -21,6 +21,19 @@ - #include - #include - -+#ifdef CONFIG_BCM47XX -+# ifdef eret -+# undef eret -+# endif -+# define eret \ -+ .set push; \ -+ .set noreorder; \ -+ nop; \ -+ nop; \ -+ eret; \ -+ .set pop; -+#endif -+ - __INIT - - /* -@@ -32,6 +45,9 @@ - NESTED(except_vec3_generic, 0, sp) - .set push - .set noat -+#ifdef CONFIG_BCM47XX -+ nop -+#endif - #if R5432_CP0_INTERRUPT_WAR - mfc0 k0, CP0_INDEX - #endif -@@ -55,6 +71,9 @@ NESTED(except_vec3_r4000, 0, sp) - .set push - .set arch=r4000 - .set noat -+#ifdef CONFIG_BCM47XX -+ nop -+#endif - mfc0 k1, CP0_CAUSE - li k0, 31<<2 - andi k1, k1, 0x7c ---- a/arch/mips/mm/c-r4k.c -+++ b/arch/mips/mm/c-r4k.c -@@ -39,6 +39,9 @@ - #include - #include - -+/* For enabling BCM4710 cache workarounds */ -+static int bcm4710 = 0; -+ - /* - * Bits describing what cache ops an IPI callback function may perform. - * -@@ -202,6 +205,9 @@ static void r4k_blast_dcache_user_page_s - { - unsigned long dc_lsize = cpu_dcache_line_size(); - -+ if (bcm4710) -+ r4k_blast_dcache_page = blast_dcache_page; -+ else - if (dc_lsize == 0) - r4k_blast_dcache_user_page = (void *)cache_noop; - else if (dc_lsize == 16) -@@ -220,6 +226,9 @@ static void r4k_blast_dcache_page_indexe - { - unsigned long dc_lsize = cpu_dcache_line_size(); - -+ if (bcm4710) -+ r4k_blast_dcache_page_indexed = blast_dcache_page_indexed; -+ else - if (dc_lsize == 0) - r4k_blast_dcache_page_indexed = (void *)cache_noop; - else if (dc_lsize == 16) -@@ -239,6 +248,9 @@ static void r4k_blast_dcache_setup(void) - { - unsigned long dc_lsize = cpu_dcache_line_size(); - -+ if (bcm4710) -+ r4k_blast_dcache = blast_dcache; -+ else - if (dc_lsize == 0) - r4k_blast_dcache = (void *)cache_noop; - else if (dc_lsize == 16) -@@ -880,6 +892,8 @@ static void local_r4k_flush_cache_sigtra - unsigned long addr = (unsigned long) arg; - - R4600_HIT_CACHEOP_WAR_IMPL; -+ BCM4710_PROTECTED_FILL_TLB(addr); -+ BCM4710_PROTECTED_FILL_TLB(addr + 4); - if (dc_lsize) - protected_writeback_dcache_line(addr & ~(dc_lsize - 1)); - if (!cpu_icache_snoops_remote_store && scache_size) -@@ -1704,6 +1718,17 @@ static void coherency_setup(void) - * silly idea of putting something else there ... - */ - switch (current_cpu_type()) { -+ case CPU_BMIPS3300: -+ { -+ u32 cm; -+ cm = read_c0_diag(); -+ /* Enable icache */ -+ cm |= (1 << 31); -+ /* Enable dcache */ -+ cm |= (1 << 30); -+ write_c0_diag(cm); -+ } -+ break; - case CPU_R4000PC: - case CPU_R4000SC: - case CPU_R4000MC: -@@ -1750,6 +1775,15 @@ void r4k_cache_init(void) - extern void build_copy_page(void); - struct cpuinfo_mips *c = ¤t_cpu_data; - -+ /* Check if special workarounds are required */ -+#if defined(CONFIG_BCM47XX) && !defined(CONFIG_CPU_MIPS32_R2) -+ if (current_cpu_data.cputype == CPU_BMIPS32 && (current_cpu_data.processor_id & 0xff) == 0) { -+ printk("Enabling BCM4710A0 cache workarounds.\n"); -+ bcm4710 = 1; -+ } else -+#endif -+ bcm4710 = 0; -+ - probe_pcache(); - setup_scache(); - -@@ -1819,7 +1853,15 @@ void r4k_cache_init(void) - */ - local_r4k___flush_cache_all(NULL); - -+#ifdef CONFIG_BCM47XX -+ { -+ static void (*_coherency_setup)(void); -+ _coherency_setup = (void (*)(void)) KSEG1ADDR(coherency_setup); -+ _coherency_setup(); -+ } -+#else - coherency_setup(); -+#endif - board_cache_error_setup = r4k_cache_error_setup; - - /* ---- a/arch/mips/mm/tlbex.c -+++ b/arch/mips/mm/tlbex.c -@@ -960,6 +960,9 @@ build_get_pgde32(u32 **p, unsigned int t - uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT); - uasm_i_addu(p, ptr, tmp, ptr); - #else -+#ifdef CONFIG_BCM47XX -+ uasm_i_nop(p); -+#endif - UASM_i_LA_mostly(p, ptr, pgdc); - #endif - uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ -@@ -1301,6 +1304,9 @@ static void build_r4000_tlb_refill_handl - #ifdef CONFIG_64BIT - build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */ - #else -+# ifdef CONFIG_BCM47XX -+ uasm_i_nop(&p); -+# endif - build_get_pgde32(&p, K0, K1); /* get pgd in K1 */ - #endif - -@@ -1312,6 +1318,9 @@ static void build_r4000_tlb_refill_handl - build_update_entries(&p, K0, K1); - build_tlb_write_entry(&p, &l, &r, tlb_random); - uasm_l_leave(&l, p); -+#ifdef CONFIG_BCM47XX -+ uasm_i_nop(&p); -+#endif - uasm_i_eret(&p); /* return from trap */ - } - #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT -@@ -1888,6 +1897,9 @@ build_r4000_tlbchange_handler_head(u32 * - #ifdef CONFIG_64BIT - build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */ - #else -+# ifdef CONFIG_BCM47XX -+ uasm_i_nop(p); -+# endif - build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */ - #endif - -@@ -1934,6 +1946,9 @@ build_r4000_tlbchange_handler_tail(u32 * - build_tlb_write_entry(p, l, r, tlb_indexed); - uasm_l_leave(l, *p); - build_restore_work_registers(p); -+#ifdef CONFIG_BCM47XX -+ uasm_i_nop(p); -+#endif - uasm_i_eret(p); /* return from trap */ - - #ifdef CONFIG_64BIT diff --git a/target/linux/brcm47xx/patches-4.4/160-kmap_coherent.patch b/target/linux/brcm47xx/patches-4.4/160-kmap_coherent.patch deleted file mode 100644 index af8c27a67..000000000 --- a/target/linux/brcm47xx/patches-4.4/160-kmap_coherent.patch +++ /dev/null @@ -1,78 +0,0 @@ -From: Jeff Hansen -Subject: [PATCH] kmap_coherent - -On ASUS WL-500gP there are some "Data bus error"s when executing simple -commands liks "ps" or "cat /proc/1/cmdline". - -This fixes OpenWrt ticket #1485: https://dev.openwrt.org/ticket/1485 ---- ---- a/arch/mips/include/asm/cpu-features.h -+++ b/arch/mips/include/asm/cpu-features.h -@@ -160,6 +160,9 @@ - #ifndef cpu_has_local_ebase - #define cpu_has_local_ebase 1 - #endif -+#ifndef cpu_use_kmap_coherent -+#define cpu_use_kmap_coherent 1 -+#endif - - /* - * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors ---- a/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h -+++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h -@@ -79,4 +79,6 @@ - #define cpu_scache_line_size() 0 - #define cpu_has_vz 0 - -+#define cpu_use_kmap_coherent 0 -+ - #endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */ ---- a/arch/mips/mm/c-r4k.c -+++ b/arch/mips/mm/c-r4k.c -@@ -645,7 +645,7 @@ static inline void local_r4k_flush_cache - */ - map_coherent = (cpu_has_dc_aliases && - page_mapped(page) && !Page_dcache_dirty(page)); -- if (map_coherent) -+ if (map_coherent && cpu_use_kmap_coherent) - vaddr = kmap_coherent(page, addr); - else - vaddr = kmap_atomic(page); -@@ -670,7 +670,7 @@ static inline void local_r4k_flush_cache - } - - if (vaddr) { -- if (map_coherent) -+ if (map_coherent && cpu_use_kmap_coherent) - kunmap_coherent(); - else - kunmap_atomic(vaddr); ---- a/arch/mips/mm/init.c -+++ b/arch/mips/mm/init.c -@@ -164,7 +164,7 @@ void copy_user_highpage(struct page *to, - void *vfrom, *vto; - - vto = kmap_atomic(to); -- if (cpu_has_dc_aliases && -+ if (cpu_has_dc_aliases && cpu_use_kmap_coherent && - page_mapped(from) && !Page_dcache_dirty(from)) { - vfrom = kmap_coherent(from, vaddr); - copy_page(vto, vfrom); -@@ -186,7 +186,7 @@ void copy_to_user_page(struct vm_area_st - struct page *page, unsigned long vaddr, void *dst, const void *src, - unsigned long len) - { -- if (cpu_has_dc_aliases && -+ if (cpu_has_dc_aliases && cpu_use_kmap_coherent && - page_mapped(page) && !Page_dcache_dirty(page)) { - void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); - memcpy(vto, src, len); -@@ -204,7 +204,7 @@ void copy_from_user_page(struct vm_area_ - struct page *page, unsigned long vaddr, void *dst, const void *src, - unsigned long len) - { -- if (cpu_has_dc_aliases && -+ if (cpu_has_dc_aliases && cpu_use_kmap_coherent && - page_mapped(page) && !Page_dcache_dirty(page)) { - void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); - memcpy(dst, vfrom, len); diff --git a/target/linux/brcm47xx/patches-4.4/209-b44-register-adm-switch.patch b/target/linux/brcm47xx/patches-4.4/209-b44-register-adm-switch.patch deleted file mode 100644 index 7e3d1d617..000000000 --- a/target/linux/brcm47xx/patches-4.4/209-b44-register-adm-switch.patch +++ /dev/null @@ -1,121 +0,0 @@ -From b36f694256f41bc71571f467646d015dda128d14 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 9 Nov 2013 17:03:59 +0100 -Subject: [PATCH 210/210] b44: register adm switch - ---- - drivers/net/ethernet/broadcom/b44.c | 57 +++++++++++++++++++++++++++++++++++ - drivers/net/ethernet/broadcom/b44.h | 3 ++ - 2 files changed, 60 insertions(+) - ---- a/drivers/net/ethernet/broadcom/b44.c -+++ b/drivers/net/ethernet/broadcom/b44.c -@@ -31,6 +31,8 @@ - #include - #include - #include -+#include -+#include - - #include - #include -@@ -2240,6 +2242,69 @@ static void b44_adjust_link(struct net_d - } - } - -+#ifdef CONFIG_BCM47XX -+static int b44_register_adm_switch(struct b44 *bp) -+{ -+ int gpio; -+ struct platform_device *pdev; -+ struct adm6996_gpio_platform_data adm_data = {0}; -+ struct platform_device_info info = {0}; -+ -+ adm_data.model = ADM6996L; -+ gpio = bcm47xx_nvram_gpio_pin("adm_eecs"); -+ if (gpio >= 0) -+ adm_data.eecs = gpio; -+ else -+ adm_data.eecs = 2; -+ -+ gpio = bcm47xx_nvram_gpio_pin("adm_eesk"); -+ if (gpio >= 0) -+ adm_data.eesk = gpio; -+ else -+ adm_data.eesk = 3; -+ -+ gpio = bcm47xx_nvram_gpio_pin("adm_eedi"); -+ if (gpio >= 0) -+ adm_data.eedi = gpio; -+ else -+ adm_data.eedi = 4; -+ -+ /* -+ * We ignore the "adm_rc" GPIO here. The driver does not use it, -+ * and it conflicts with the Reset button GPIO on the Linksys WRT54GSv1. -+ */ -+ -+ info.parent = bp->sdev->dev; -+ info.name = "adm6996_gpio"; -+ info.id = -1; -+ info.data = &adm_data; -+ info.size_data = sizeof(adm_data); -+ -+ if (!bp->adm_switch) { -+ pdev = platform_device_register_full(&info); -+ if (IS_ERR(pdev)) -+ return PTR_ERR(pdev); -+ -+ bp->adm_switch = pdev; -+ } -+ return 0; -+} -+static void b44_unregister_adm_switch(struct b44 *bp) -+{ -+ if (bp->adm_switch) -+ platform_device_unregister(bp->adm_switch); -+} -+#else -+static int b44_register_adm_switch(struct b44 *bp) -+{ -+ return 0; -+} -+static void b44_unregister_adm_switch(struct b44 *bp) -+{ -+ -+} -+#endif /* CONFIG_BCM47XX */ -+ - static int b44_register_phy_one(struct b44 *bp) - { - struct mii_bus *mii_bus; -@@ -2283,6 +2348,9 @@ static int b44_register_phy_one(struct b - if (!bp->mii_bus->phy_map[bp->phy_addr] && - (sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) { - -+ if (sprom->boardflags_lo & B44_BOARDFLAG_ADM) -+ b44_register_adm_switch(bp); -+ - dev_info(sdev->dev, - "could not find PHY at %i, use fixed one\n", - bp->phy_addr); -@@ -2479,6 +2547,7 @@ static void b44_remove_one(struct ssb_de - unregister_netdev(dev); - if (bp->flags & B44_FLAG_EXTERNAL_PHY) - b44_unregister_phy_one(bp); -+ b44_unregister_adm_switch(bp); - ssb_device_disable(sdev, 0); - ssb_bus_may_powerdown(sdev->bus); - netif_napi_del(&bp->napi); ---- a/drivers/net/ethernet/broadcom/b44.h -+++ b/drivers/net/ethernet/broadcom/b44.h -@@ -408,6 +408,9 @@ struct b44 { - struct mii_bus *mii_bus; - int old_link; - struct mii_if_info mii_if; -+ -+ /* platform device for associated switch */ -+ struct platform_device *adm_switch; - }; - - #endif /* _B44_H */ diff --git a/target/linux/brcm47xx/patches-4.4/210-b44_phy_fix.patch b/target/linux/brcm47xx/patches-4.4/210-b44_phy_fix.patch deleted file mode 100644 index 04f683216..000000000 --- a/target/linux/brcm47xx/patches-4.4/210-b44_phy_fix.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- a/drivers/net/ethernet/broadcom/b44.c -+++ b/drivers/net/ethernet/broadcom/b44.c -@@ -431,10 +431,34 @@ static void b44_wap54g10_workaround(stru - error: - pr_warn("PHY: cannot reset MII transceiver isolate bit\n"); - } -+ -+static void b44_bcm47xx_workarounds(struct b44 *bp) -+{ -+ char buf[20]; -+ struct ssb_device *sdev = bp->sdev; -+ -+ /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */ -+ if (sdev->bus->sprom.board_num == 100) { -+ bp->phy_addr = B44_PHY_ADDR_NO_LOCAL_PHY; -+ } else { -+ /* WL-HDD */ -+ if (bcm47xx_nvram_getenv("hardware_version", buf, sizeof(buf)) >= 0 && -+ !strncmp(buf, "WL300-", strlen("WL300-"))) { -+ if (sdev->bus->sprom.et0phyaddr == 0 && -+ sdev->bus->sprom.et1phyaddr == 1) -+ bp->phy_addr = B44_PHY_ADDR_NO_LOCAL_PHY; -+ } -+ } -+ return; -+} - #else - static inline void b44_wap54g10_workaround(struct b44 *bp) - { - } -+ -+static inline void b44_bcm47xx_workarounds(struct b44 *bp) -+{ -+} - #endif - - static int b44_setup_phy(struct b44 *bp) -@@ -443,6 +467,7 @@ static int b44_setup_phy(struct b44 *bp) - int err; - - b44_wap54g10_workaround(bp); -+ b44_bcm47xx_workarounds(bp); - - if (bp->flags & B44_FLAG_EXTERNAL_PHY) - return 0; -@@ -2170,6 +2195,8 @@ static int b44_get_invariants(struct b44 - * valid PHY address. */ - bp->phy_addr &= 0x1F; - -+ b44_bcm47xx_workarounds(bp); -+ - memcpy(bp->dev->dev_addr, addr, ETH_ALEN); - - if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){ diff --git a/target/linux/brcm47xx/patches-4.4/280-activate_ssb_support_in_usb.patch b/target/linux/brcm47xx/patches-4.4/280-activate_ssb_support_in_usb.patch deleted file mode 100644 index ae6a72de7..000000000 --- a/target/linux/brcm47xx/patches-4.4/280-activate_ssb_support_in_usb.patch +++ /dev/null @@ -1,25 +0,0 @@ -This prevents the options from being delete with make kernel_oldconfig. ---- - drivers/ssb/Kconfig | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -33,6 +33,7 @@ config BCMA_HOST_PCI - config BCMA_HOST_SOC - bool "Support for BCMA in a SoC" - depends on BCMA -+ select USB_HCD_BCMA if USB_EHCI_HCD || USB_OHCI_HCD - help - Host interface for a Broadcom AIX bus directly mapped into - the memory. This only works with the Broadcom SoCs from the ---- a/drivers/ssb/Kconfig -+++ b/drivers/ssb/Kconfig -@@ -156,6 +156,7 @@ config SSB_SFLASH - config SSB_EMBEDDED - bool - depends on SSB_DRIVER_MIPS && SSB_PCICORE_HOSTMODE -+ select USB_HCD_SSB if USB_EHCI_HCD || USB_OHCI_HCD - default y - - config SSB_DRIVER_EXTIF diff --git a/target/linux/brcm47xx/patches-4.4/300-fork_cacheflush.patch b/target/linux/brcm47xx/patches-4.4/300-fork_cacheflush.patch deleted file mode 100644 index daa2c1adf..000000000 --- a/target/linux/brcm47xx/patches-4.4/300-fork_cacheflush.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Wolfram Joost -Subject: [PATCH] fork_cacheflush - -On ASUS WL-500gP there are many unexpected "Segmentation fault"s that -seem to be caused by a kernel. They can be avoided by: -1) Disabling highpage -2) Using flush_cache_mm in flush_cache_dup_mm - -For details see OpenWrt ticket #2035 https://dev.openwrt.org/ticket/2035 ---- ---- a/arch/mips/include/asm/cacheflush.h -+++ b/arch/mips/include/asm/cacheflush.h -@@ -46,7 +46,7 @@ - extern void (*flush_cache_all)(void); - extern void (*__flush_cache_all)(void); - extern void (*flush_cache_mm)(struct mm_struct *mm); --#define flush_cache_dup_mm(mm) do { (void) (mm); } while (0) -+#define flush_cache_dup_mm(mm) flush_cache_mm(mm) - extern void (*flush_cache_range)(struct vm_area_struct *vma, - unsigned long start, unsigned long end); - extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn); diff --git a/target/linux/brcm47xx/patches-4.4/310-no_highpage.patch b/target/linux/brcm47xx/patches-4.4/310-no_highpage.patch deleted file mode 100644 index bb67417f9..000000000 --- a/target/linux/brcm47xx/patches-4.4/310-no_highpage.patch +++ /dev/null @@ -1,74 +0,0 @@ -From: Jeff Hansen -Subject: [PATCH] no highpage - -On ASUS WL-500gP there are many unexpected "Segmentation fault"s that -seem to be caused by a kernel. They can be avoided by: -1) Disabling highpage -2) Using flush_cache_mm in flush_cache_dup_mm - -For details see OpenWrt ticket #2035 https://dev.openwrt.org/ticket/2035 ---- ---- a/arch/mips/include/asm/page.h -+++ b/arch/mips/include/asm/page.h -@@ -71,6 +71,7 @@ static inline unsigned int page_size_ftl - #endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */ - - #include -+#include - - extern void build_clear_page(void); - extern void build_copy_page(void); -@@ -105,11 +106,16 @@ static inline void clear_user_page(void - flush_data_cache_page((unsigned long)addr); - } - --struct vm_area_struct; --extern void copy_user_highpage(struct page *to, struct page *from, -- unsigned long vaddr, struct vm_area_struct *vma); -+static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, -+ struct page *to) -+{ -+ extern void (*flush_data_cache_page)(unsigned long addr); - --#define __HAVE_ARCH_COPY_USER_HIGHPAGE -+ copy_page(vto, vfrom); -+ if (!cpu_has_ic_fills_f_dc || -+ pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK)) -+ flush_data_cache_page((unsigned long)vto); -+} - - /* - * These are used to make use of C type-checking.. ---- a/arch/mips/mm/init.c -+++ b/arch/mips/mm/init.c -@@ -158,30 +158,6 @@ void kunmap_coherent(void) - preempt_enable(); - } - --void copy_user_highpage(struct page *to, struct page *from, -- unsigned long vaddr, struct vm_area_struct *vma) --{ -- void *vfrom, *vto; -- -- vto = kmap_atomic(to); -- if (cpu_has_dc_aliases && cpu_use_kmap_coherent && -- page_mapped(from) && !Page_dcache_dirty(from)) { -- vfrom = kmap_coherent(from, vaddr); -- copy_page(vto, vfrom); -- kunmap_coherent(); -- } else { -- vfrom = kmap_atomic(from); -- copy_page(vto, vfrom); -- kunmap_atomic(vfrom); -- } -- if ((!cpu_has_ic_fills_f_dc) || -- pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK)) -- flush_data_cache_page((unsigned long)vto); -- kunmap_atomic(vto); -- /* Make sure this page is cleared on other CPU's too before using it */ -- smp_wmb(); --} -- - void copy_to_user_page(struct vm_area_struct *vma, - struct page *page, unsigned long vaddr, void *dst, const void *src, - unsigned long len) diff --git a/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch deleted file mode 100644 index c5f97ba49..000000000 --- a/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch +++ /dev/null @@ -1,223 +0,0 @@ ---- a/arch/mips/bcm47xx/board.c -+++ b/arch/mips/bcm47xx/board.c -@@ -140,6 +140,7 @@ struct bcm47xx_board_type_list2 bcm47xx_ - {{BCM47XX_BOARD_LINKSYS_WRT300NV11, "Linksys WRT300N V1.1"}, "WRT300N", "1.1"}, - {{BCM47XX_BOARD_LINKSYS_WRT310NV1, "Linksys WRT310N V1"}, "WRT310N", "1.0"}, - {{BCM47XX_BOARD_LINKSYS_WRT310NV2, "Linksys WRT310N V2"}, "WRT310N", "2.0"}, -+ {{BCM47XX_BOARD_LINKSYS_WRT320N_V1, "Linksys WRT320N V1"}, "WRT320N", "1.0"}, - {{BCM47XX_BOARD_LINKSYS_WRT54G3GV2, "Linksys WRT54G3GV2-VF"}, "WRT54G3GV2-VF", "1.0"}, - {{BCM47XX_BOARD_LINKSYS_WRT610NV1, "Linksys WRT610N V1"}, "WRT610N", "1.0"}, - {{BCM47XX_BOARD_LINKSYS_WRT610NV2, "Linksys WRT610N V2"}, "WRT610N", "2.0"}, -@@ -159,9 +160,12 @@ struct bcm47xx_board_type_list1 bcm47xx_ - {{BCM47XX_BOARD_LUXUL_XVW_P30_V1, "Luxul XVW-P30 V1"}, "luxul_xvwp30_v1"}, - {{BCM47XX_BOARD_LUXUL_XWR_600_V1, "Luxul XWR-600 V1"}, "luxul_xwr600_v1"}, - {{BCM47XX_BOARD_LUXUL_XWR_1750_V1, "Luxul XWR-1750 V1"}, "luxul_xwr1750_v1"}, -+ {{BCM47XX_BOARD_NETGEAR_R6300_V1, "Netgear R6300 V1"}, "U12H218T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WGR614_V10, "Netgear WGR614 V10"}, "U12H139T01_NETGEAR"}, -+ {{BCM47XX_BOARD_NETGEAR_WN2500RP_V1, "Netgear WN2500RP V1"}, "U12H197T00_NETGEAR"}, -+ {{BCM47XX_BOARD_NETGEAR_WN2500RP_V2, "Netgear WN2500RP V2"}, "U12H294T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"}, -@@ -171,6 +175,7 @@ struct bcm47xx_board_type_list1 bcm47xx_ - {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"}, -+ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"}, ---- a/arch/mips/bcm47xx/buttons.c -+++ b/arch/mips/bcm47xx/buttons.c -@@ -26,6 +26,12 @@ - /* Asus */ - - static const struct gpio_keys_button -+bcm47xx_buttons_asus_rtn10u[] __initconst = { -+ BCM47XX_GPIO_KEY(20, KEY_WPS_BUTTON), -+ BCM47XX_GPIO_KEY(21, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button - bcm47xx_buttons_asus_rtn12[] __initconst = { - BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), - BCM47XX_GPIO_KEY(1, KEY_RESTART), -@@ -276,6 +282,18 @@ bcm47xx_buttons_linksys_wrt310nv1[] __in - }; - - static const struct gpio_keys_button -+bcm47xx_buttons_linksys_wrt310n_v2[] __initconst = { -+ BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), -+ BCM47XX_GPIO_KEY(6, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_linksys_wrt320n_v1[] __initconst = { -+ BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), -+ BCM47XX_GPIO_KEY(8, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button - bcm47xx_buttons_linksys_wrt54g3gv2[] __initconst = { - BCM47XX_GPIO_KEY(5, KEY_WIMAX), - BCM47XX_GPIO_KEY(6, KEY_RESTART), -@@ -384,6 +402,17 @@ bcm47xx_buttons_motorola_wr850gv2v3[] __ - /* Netgear */ - - static const struct gpio_keys_button -+bcm47xx_buttons_netgear_r6300_v1[] __initconst = { -+ BCM47XX_GPIO_KEY(6, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button -+bcm47xx_buttons_netgear_wn2500rp_v1[] __initconst = { -+ BCM47XX_GPIO_KEY(12, KEY_RESTART), -+ BCM47XX_GPIO_KEY(31, KEY_WPS_BUTTON), -+}; -+ -+static const struct gpio_keys_button - bcm47xx_buttons_netgear_wndr3400v1[] __initconst = { - BCM47XX_GPIO_KEY(4, KEY_RESTART), - BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), -@@ -411,6 +440,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i - }; - - static const struct gpio_keys_button -+bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = { -+ BCM47XX_GPIO_KEY(3, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button - bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = { - BCM47XX_GPIO_KEY(4, KEY_RESTART), - BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), -@@ -464,6 +498,9 @@ int __init bcm47xx_buttons_register(void - int err; - - switch (board) { -+ case BCM47XX_BOARD_ASUS_RTN10U: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn10u); -+ break; - case BCM47XX_BOARD_ASUS_RTN12: - err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12); - break; -@@ -594,6 +631,12 @@ int __init bcm47xx_buttons_register(void - case BCM47XX_BOARD_LINKSYS_WRT310NV1: - err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1); - break; -+ case BCM47XX_BOARD_LINKSYS_WRT310NV2: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310n_v2); -+ break; -+ case BCM47XX_BOARD_LINKSYS_WRT320N_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt320n_v1); -+ break; - case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: - err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2); - break; -@@ -657,6 +700,12 @@ int __init bcm47xx_buttons_register(void - err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3); - break; - -+ case BCM47XX_BOARD_NETGEAR_R6300_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6300_v1); -+ break; -+ case BCM47XX_BOARD_NETGEAR_WN2500RP_V1: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wn2500rp_v1); -+ break; - case BCM47XX_BOARD_NETGEAR_WNDR3400V1: - err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1); - break; -@@ -669,6 +718,9 @@ int __init bcm47xx_buttons_register(void - case BCM47XX_BOARD_NETGEAR_WNDR4500V1: - err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); - break; -+ case BCM47XX_BOARD_NETGEAR_WNR1000_V3: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3); -+ break; - case BCM47XX_BOARD_NETGEAR_WNR3500L: - err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1); - break; ---- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h -+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h -@@ -71,6 +71,7 @@ enum bcm47xx_board { - BCM47XX_BOARD_LINKSYS_WRT300NV11, - BCM47XX_BOARD_LINKSYS_WRT310NV1, - BCM47XX_BOARD_LINKSYS_WRT310NV2, -+ BCM47XX_BOARD_LINKSYS_WRT320N_V1, - BCM47XX_BOARD_LINKSYS_WRT54G3GV2, - BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101, - BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467, -@@ -97,9 +98,12 @@ enum bcm47xx_board { - BCM47XX_BOARD_MOTOROLA_WR850GP, - BCM47XX_BOARD_MOTOROLA_WR850GV2V3, - -+ BCM47XX_BOARD_NETGEAR_R6300_V1, - BCM47XX_BOARD_NETGEAR_WGR614V8, - BCM47XX_BOARD_NETGEAR_WGR614V9, - BCM47XX_BOARD_NETGEAR_WGR614_V10, -+ BCM47XX_BOARD_NETGEAR_WN2500RP_V1, -+ BCM47XX_BOARD_NETGEAR_WN2500RP_V2, - BCM47XX_BOARD_NETGEAR_WNDR3300, - BCM47XX_BOARD_NETGEAR_WNDR3400V1, - BCM47XX_BOARD_NETGEAR_WNDR3400V2, -@@ -109,6 +113,7 @@ enum bcm47xx_board { - BCM47XX_BOARD_NETGEAR_WNDR4000, - BCM47XX_BOARD_NETGEAR_WNDR4500V1, - BCM47XX_BOARD_NETGEAR_WNDR4500V2, -+ BCM47XX_BOARD_NETGEAR_WNR1000_V3, - BCM47XX_BOARD_NETGEAR_WNR2000, - BCM47XX_BOARD_NETGEAR_WNR3500L, - BCM47XX_BOARD_NETGEAR_WNR3500U, ---- a/arch/mips/bcm47xx/leds.c -+++ b/arch/mips/bcm47xx/leds.c -@@ -29,6 +29,14 @@ - /* Asus */ - - static const struct gpio_led -+bcm47xx_leds_asus_rtn10u[] __initconst = { -+ BCM47XX_GPIO_LED(5, "green", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED(6, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON), -+ BCM47XX_GPIO_LED(7, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED(8, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), -+}; -+ -+static const struct gpio_led - bcm47xx_leds_asus_rtn12[] __initconst = { - BCM47XX_GPIO_LED(2, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), - BCM47XX_GPIO_LED(7, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), -@@ -313,6 +321,13 @@ bcm47xx_leds_linksys_wrt310nv1[] __initc - }; - - static const struct gpio_led -+bcm47xx_leds_linksys_wrt320n_v1[] __initconst = { -+ BCM47XX_GPIO_LED(1, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), -+ BCM47XX_GPIO_LED(2, "blue", "power", 0, LEDS_GPIO_DEFSTATE_ON), -+ BCM47XX_GPIO_LED(4, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), -+}; -+ -+static const struct gpio_led - bcm47xx_leds_linksys_wrt54g_generic[] __initconst = { - BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), - BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), -@@ -549,6 +564,9 @@ void __init bcm47xx_leds_register(void) - enum bcm47xx_board board = bcm47xx_board_get(); - - switch (board) { -+ case BCM47XX_BOARD_ASUS_RTN10U: -+ bcm47xx_set_pdata(bcm47xx_leds_asus_rtn10u); -+ break; - case BCM47XX_BOARD_ASUS_RTN12: - bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12); - break; -@@ -682,6 +700,9 @@ void __init bcm47xx_leds_register(void) - case BCM47XX_BOARD_LINKSYS_WRT310NV1: - bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1); - break; -+ case BCM47XX_BOARD_LINKSYS_WRT320N_V1: -+ bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt320n_v1); -+ break; - case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: - bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g3gv2); - break; diff --git a/target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch b/target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch deleted file mode 100644 index 64184c079..000000000 --- a/target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -217,6 +217,7 @@ static int bcm47xxpart_parse(struct mtd_ - int trx_num = 0; /* Number of found TRX partitions */ - int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; - int err; -+ bool found_nvram = false; - - /* - * Some really old flashes (like AT45DB*) had smaller erasesize-s, but -@@ -384,12 +385,23 @@ static int bcm47xxpart_parse(struct mtd_ - if (buf[0] == NVRAM_HEADER) { - bcm47xxpart_add_part(&parts[curr_part++], "nvram", - master->size - blocksize, 0); -+ found_nvram = true; - break; - } - } - - kfree(buf); - -+ if (!found_nvram) { -+ pr_err("can not find a nvram partition reserve last block\n"); -+ bcm47xxpart_add_part(&parts[curr_part++], "nvram_guess", -+ master->size - blocksize * 2, MTD_WRITEABLE); -+ for (i = 0; i < curr_part; i++) { -+ if (parts[i].size + parts[i].offset == master->size) -+ parts[i].offset -= blocksize * 2; -+ } -+ } -+ - /* - * Assume that partitions end at the beginning of the one they are - * followed by. diff --git a/target/linux/brcm47xx/patches-4.4/610-pci_ide_fix.patch b/target/linux/brcm47xx/patches-4.4/610-pci_ide_fix.patch deleted file mode 100644 index c5a51add9..000000000 --- a/target/linux/brcm47xx/patches-4.4/610-pci_ide_fix.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: b.sander -Subject: [PATCH] pci: IDE fix - -These are standard probing messages when using pdc202xx_old: -pdc202xx_old 0000:00:01.0: IDE controller (0x105a:0x0d30 rev 0x02) -PCI: Enabling device 0000:00:01.0 (0004 -> 0007) -PCI: Fixing up device 0000:00:01.0 -0000:00:01.0: (U)DMA Burst Bit DISABLED Primary PCI Mode Secondary PCI Mode. -0000:00:01.0: FORCING BURST BIT 0x00->0x01 ACTIVE -pdc202xx_old 0000:00:01.0: 100% native mode on irq 6 - -With the default MAX_HWIFS value after above we get: - ide2: BM-DMA at 0x0400-0x0407 - ide3: BM-DMA at 0x0408-0x040f -Probing IDE interface ide2... -hde: CF500, CFA DISK drive - -As you can see it's ide2 + ide3 and hde. - -With this patch applied we get: - ide0: BM-DMA at 0x0400-0x0407 - ide1: BM-DMA at 0x0408-0x040f -Probing IDE interface ide0... -hda: CF500, CFA DISK drive - -This fixes OpenWrt ticket #7061: https://dev.openwrt.org/ticket/7061 ---- ---- a/include/linux/ide.h -+++ b/include/linux/ide.h -@@ -204,7 +204,11 @@ static inline void ide_std_init_ports(st - hw->io_ports.ctl_addr = ctl_addr; - } - -+#if defined CONFIG_BCM47XX -+# define MAX_HWIFS 2 -+#else - #define MAX_HWIFS 10 -+#endif - - /* - * Now for the data we need to maintain per-drive: ide_drive_t diff --git a/target/linux/brcm47xx/patches-4.4/791-tg3-no-pci-sleep.patch b/target/linux/brcm47xx/patches-4.4/791-tg3-no-pci-sleep.patch deleted file mode 100644 index 35a816d8c..000000000 --- a/target/linux/brcm47xx/patches-4.4/791-tg3-no-pci-sleep.patch +++ /dev/null @@ -1,17 +0,0 @@ -When the Ethernet controller is powered down and someone wants to -access the mdio bus like the witch driver (b53) the system crashed if -PCI_D3hot was set before. This patch deactivates this power sawing mode -when a switch driver is in use. - ---- a/drivers/net/ethernet/broadcom/tg3.c -+++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -4263,7 +4263,8 @@ static int tg3_power_down_prepare(struct - static void tg3_power_down(struct tg3 *tp) - { - pci_wake_from_d3(tp->pdev, tg3_flag(tp, WOL_ENABLE)); -- pci_set_power_state(tp->pdev, PCI_D3hot); -+ if (!tg3_flag(tp, ROBOSWITCH)) -+ pci_set_power_state(tp->pdev, PCI_D3hot); - } - - static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 *duplex) diff --git a/target/linux/brcm47xx/patches-4.4/800-bcma-add-table-of-serial-flashes-with-smaller-blocks.patch b/target/linux/brcm47xx/patches-4.4/800-bcma-add-table-of-serial-flashes-with-smaller-blocks.patch deleted file mode 100644 index 318dc5581..000000000 --- a/target/linux/brcm47xx/patches-4.4/800-bcma-add-table-of-serial-flashes-with-smaller-blocks.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 597715c61ae75a05ab3310a34ff3857a006f0f63 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 20 Nov 2014 21:32:42 +0100 -Subject: [PATCH] bcma: add table of serial flashes with smaller blocks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Rafał Miłecki ---- - drivers/bcma/driver_chipcommon_sflash.c | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - ---- a/drivers/bcma/driver_chipcommon_sflash.c -+++ b/drivers/bcma/driver_chipcommon_sflash.c -@@ -9,6 +9,7 @@ - - #include - #include -+#include - - static struct resource bcma_sflash_resource = { - .name = "bcma_sflash", -@@ -42,6 +43,13 @@ static const struct bcma_sflash_tbl_e bc - { NULL }, - }; - -+/* Some devices use smaller blocks (and have more of them) */ -+static const struct bcma_sflash_tbl_e bcma_sflash_st_shrink_tbl[] = { -+ { "M25P16", 0x14, 0x1000, 512, }, -+ { "M25P32", 0x15, 0x1000, 1024, }, -+ { NULL }, -+}; -+ - static const struct bcma_sflash_tbl_e bcma_sflash_sst_tbl[] = { - { "SST25WF512", 1, 0x1000, 16, }, - { "SST25VF512", 0x48, 0x1000, 16, }, -@@ -85,6 +93,24 @@ static void bcma_sflash_cmd(struct bcma_ - bcma_err(cc->core->bus, "SFLASH control command failed (timeout)!\n"); - } - -+const struct bcma_sflash_tbl_e *bcma_sflash_shrink_flash(u32 id) -+{ -+ enum bcm47xx_board board = bcm47xx_board_get(); -+ const struct bcma_sflash_tbl_e *e; -+ -+ switch (board) { -+ case BCM47XX_BOARD_NETGEAR_WGR614_V10: -+ case BCM47XX_BOARD_NETGEAR_WNR1000_V3: -+ for (e = bcma_sflash_st_shrink_tbl; e->name; e++) { -+ if (e->id == id) -+ return e; -+ } -+ return NULL; -+ default: -+ return NULL; -+ } -+} -+ - /* Initialize serial flash access */ - int bcma_sflash_init(struct bcma_drv_cc *cc) - { -@@ -115,6 +141,10 @@ int bcma_sflash_init(struct bcma_drv_cc - case 0x13: - return -ENOTSUPP; - default: -+ e = bcma_sflash_shrink_flash(id); -+ if (e) -+ break; -+ - for (e = bcma_sflash_st_tbl; e->name; e++) { - if (e->id == id) - break; diff --git a/target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch b/target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch deleted file mode 100644 index da0f56fd5..000000000 --- a/target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch +++ /dev/null @@ -1,293 +0,0 @@ -The Netgear wgt634u uses a different format for storing the -configuration. This patch is needed to read out the correct -configuration. The cfe_env.c file uses a different method way to read -out the configuration than the in kernel cfe config reader. - ---- a/drivers/firmware/broadcom/Makefile -+++ b/drivers/firmware/broadcom/Makefile -@@ -1 +1 @@ --obj-$(CONFIG_BCM47XX_NVRAM) += bcm47xx_nvram.o -+obj-$(CONFIG_BCM47XX_NVRAM) += bcm47xx_nvram.o cfe_env.o ---- /dev/null -+++ b/drivers/firmware/broadcom/cfe_env.c -@@ -0,0 +1,228 @@ -+/* -+ * CFE environment variable access -+ * -+ * Copyright 2001-2003, Broadcom Corporation -+ * Copyright 2006, Felix Fietkau -+ * -+ * 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 -+ -+#define NVRAM_SIZE (0x1ff0) -+static char _nvdata[NVRAM_SIZE]; -+static char _valuestr[256]; -+ -+/* -+ * TLV types. These codes are used in the "type-length-value" -+ * encoding of the items stored in the NVRAM device (flash or EEPROM) -+ * -+ * The layout of the flash/nvram is as follows: -+ * -+ * -+ * -+ * The type code of "ENV_TLV_TYPE_END" marks the end of the list. -+ * The "length" field marks the length of the data section, not -+ * including the type and length fields. -+ * -+ * Environment variables are stored as follows: -+ * -+ * = -+ * -+ * If bit 0 (low bit) is set, the length is an 8-bit value. -+ * If bit 0 (low bit) is clear, the length is a 16-bit value -+ * -+ * Bit 7 set indicates "user" TLVs. In this case, bit 0 still -+ * indicates the size of the length field. -+ * -+ * Flags are from the constants below: -+ * -+ */ -+#define ENV_LENGTH_16BITS 0x00 /* for low bit */ -+#define ENV_LENGTH_8BITS 0x01 -+ -+#define ENV_TYPE_USER 0x80 -+ -+#define ENV_CODE_SYS(n,l) (((n)<<1)|(l)) -+#define ENV_CODE_USER(n,l) ((((n)<<1)|(l)) | ENV_TYPE_USER) -+ -+/* -+ * The actual TLV types we support -+ */ -+ -+#define ENV_TLV_TYPE_END 0x00 -+#define ENV_TLV_TYPE_ENV ENV_CODE_SYS(0,ENV_LENGTH_8BITS) -+ -+/* -+ * Environment variable flags -+ */ -+ -+#define ENV_FLG_NORMAL 0x00 /* normal read/write */ -+#define ENV_FLG_BUILTIN 0x01 /* builtin - not stored in flash */ -+#define ENV_FLG_READONLY 0x02 /* read-only - cannot be changed */ -+ -+#define ENV_FLG_MASK 0xFF /* mask of attributes we keep */ -+#define ENV_FLG_ADMIN 0x100 /* lets us internally override permissions */ -+ -+ -+/* ********************************************************************* -+ * _nvram_read(buffer,offset,length) -+ * -+ * Read data from the NVRAM device -+ * -+ * Input parameters: -+ * buffer - destination buffer -+ * offset - offset of data to read -+ * length - number of bytes to read -+ * -+ * Return value: -+ * number of bytes read, or <0 if error occured -+ ********************************************************************* */ -+static int -+_nvram_read(unsigned char *nv_buf, unsigned char *buffer, int offset, int length) -+{ -+ int i; -+ if (offset > NVRAM_SIZE) -+ return -1; -+ -+ for ( i = 0; i < length; i++) { -+ buffer[i] = ((volatile unsigned char*)nv_buf)[offset + i]; -+ } -+ return length; -+} -+ -+ -+static char* -+_strnchr(const char *dest,int c,size_t cnt) -+{ -+ while (*dest && (cnt > 0)) { -+ if (*dest == c) return (char *) dest; -+ dest++; -+ cnt--; -+ } -+ return NULL; -+} -+ -+ -+ -+/* -+ * Core support API: Externally visible. -+ */ -+ -+/* -+ * Get the value of an NVRAM variable -+ * @param name name of variable to get -+ * @return value of variable or NULL if undefined -+ */ -+ -+char *cfe_env_get(unsigned char *nv_buf, const char *name) -+{ -+ int size; -+ unsigned char *buffer; -+ unsigned char *ptr; -+ unsigned char *envval; -+ unsigned int reclen; -+ unsigned int rectype; -+ int offset; -+ int flg; -+ -+ if (!strcmp(name, "nvram_type")) -+ return "cfe"; -+ -+ size = NVRAM_SIZE; -+ buffer = &_nvdata[0]; -+ -+ ptr = buffer; -+ offset = 0; -+ -+ /* Read the record type and length */ -+ if (_nvram_read(nv_buf, ptr,offset,1) != 1) { -+ goto error; -+ } -+ -+ while ((*ptr != ENV_TLV_TYPE_END) && (size > 1)) { -+ -+ /* Adjust pointer for TLV type */ -+ rectype = *(ptr); -+ offset++; -+ size--; -+ -+ /* -+ * Read the length. It can be either 1 or 2 bytes -+ * depending on the code -+ */ -+ if (rectype & ENV_LENGTH_8BITS) { -+ /* Read the record type and length - 8 bits */ -+ if (_nvram_read(nv_buf, ptr,offset,1) != 1) { -+ goto error; -+ } -+ reclen = *(ptr); -+ size--; -+ offset++; -+ } -+ else { -+ /* Read the record type and length - 16 bits, MSB first */ -+ if (_nvram_read(nv_buf, ptr,offset,2) != 2) { -+ goto error; -+ } -+ reclen = (((unsigned int) *(ptr)) << 8) + (unsigned int) *(ptr+1); -+ size -= 2; -+ offset += 2; -+ } -+ -+ if (reclen > size) -+ break; /* should not happen, bad NVRAM */ -+ -+ switch (rectype) { -+ case ENV_TLV_TYPE_ENV: -+ /* Read the TLV data */ -+ if (_nvram_read(nv_buf, ptr,offset,reclen) != reclen) -+ goto error; -+ flg = *ptr++; -+ envval = (unsigned char *) _strnchr(ptr,'=',(reclen-1)); -+ if (envval) { -+ *envval++ = '\0'; -+ memcpy(_valuestr,envval,(reclen-1)-(envval-ptr)); -+ _valuestr[(reclen-1)-(envval-ptr)] = '\0'; -+#if 0 -+ printk(KERN_INFO "NVRAM:%s=%s\n", ptr, _valuestr); -+#endif -+ if(!strcmp(ptr, name)){ -+ return _valuestr; -+ } -+ if((strlen(ptr) > 1) && !strcmp(&ptr[1], name)) -+ return _valuestr; -+ } -+ break; -+ -+ default: -+ /* Unknown TLV type, skip it. */ -+ break; -+ } -+ -+ /* -+ * Advance to next TLV -+ */ -+ -+ size -= (int)reclen; -+ offset += reclen; -+ -+ /* Read the next record type */ -+ ptr = buffer; -+ if (_nvram_read(nv_buf, ptr,offset,1) != 1) -+ goto error; -+ } -+ -+error: -+ return NULL; -+ -+} -+ ---- a/drivers/firmware/broadcom/bcm47xx_nvram.c -+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c -@@ -37,6 +37,8 @@ struct nvram_header { - static char nvram_buf[NVRAM_SPACE]; - static size_t nvram_len; - static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; -+static int cfe_env; -+extern char *cfe_env_get(char *nv_buf, const char *name); - - static u32 find_nvram_size(void __iomem *end) - { -@@ -66,6 +68,26 @@ static int nvram_find_and_copy(void __io - return -EEXIST; - } - -+ cfe_env = 0; -+ -+ /* XXX: hack for supporting the CFE environment stuff on WGT634U */ -+ if (lim >= 8 * 1024 * 1024) { -+ src = (u32 *)(iobase + 8 * 1024 * 1024 - 0x2000); -+ dst = (u32 *)nvram_buf; -+ -+ if ((*src & 0xff00ff) == 0x000001) { -+ printk("early_nvram_init: WGT634U NVRAM found.\n"); -+ -+ for (i = 0; i < 0x1ff0; i++) { -+ if (*src == 0xFFFFFFFF) -+ break; -+ *dst++ = *src++; -+ } -+ cfe_env = 1; -+ return 0; -+ } -+ } -+ - /* TODO: when nvram is on nand flash check for bad blocks first. */ - off = FLASH_MIN; - while (off <= lim) { -@@ -180,6 +202,13 @@ int bcm47xx_nvram_getenv(const char *nam - if (!name) - return -EINVAL; - -+ if (cfe_env) { -+ value = cfe_env_get(nvram_buf, name); -+ if (!value) -+ return -ENOENT; -+ return snprintf(val, val_len, "%s", value); -+ } -+ - if (!nvram_len) { - err = nvram_init(); - if (err) diff --git a/target/linux/brcm47xx/patches-4.4/830-huawei_e970_support.patch b/target/linux/brcm47xx/patches-4.4/830-huawei_e970_support.patch deleted file mode 100644 index f67c5dde1..000000000 --- a/target/linux/brcm47xx/patches-4.4/830-huawei_e970_support.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- a/arch/mips/bcm47xx/setup.c -+++ b/arch/mips/bcm47xx/setup.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -262,6 +263,33 @@ static struct fixed_phy_status bcm47xx_f - .duplex = DUPLEX_FULL, - }; - -+static struct gpio_wdt_platform_data gpio_wdt_data; -+ -+static struct platform_device gpio_wdt_device = { -+ .name = "gpio-wdt", -+ .id = 0, -+ .dev = { -+ .platform_data = &gpio_wdt_data, -+ }, -+}; -+ -+static int __init bcm47xx_register_gpio_watchdog(void) -+{ -+ enum bcm47xx_board board = bcm47xx_board_get(); -+ -+ switch (board) { -+ case BCM47XX_BOARD_HUAWEI_E970: -+ pr_info("bcm47xx: detected Huawei E970 or similar, starting early gpio_wdt timer\n"); -+ gpio_wdt_data.gpio = 7; -+ gpio_wdt_data.interval = HZ; -+ gpio_wdt_data.first_interval = HZ / 5; -+ return platform_device_register(&gpio_wdt_device); -+ default: -+ /* Nothing to do */ -+ return 0; -+ } -+} -+ - static int __init bcm47xx_register_bus_complete(void) - { - switch (bcm47xx_bus_type) { -@@ -281,6 +309,7 @@ static int __init bcm47xx_register_bus_c - bcm47xx_workarounds(); - - fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status, -1); -+ bcm47xx_register_gpio_watchdog(); - return 0; - } - device_initcall(bcm47xx_register_bus_complete); ---- a/arch/mips/configs/bcm47xx_defconfig -+++ b/arch/mips/configs/bcm47xx_defconfig -@@ -67,6 +67,7 @@ CONFIG_HW_RANDOM=y - CONFIG_GPIO_SYSFS=y - CONFIG_WATCHDOG=y - CONFIG_BCM47XX_WDT=y -+CONFIG_GPIO_WDT=y - CONFIG_SSB_DEBUG=y - CONFIG_SSB_DRIVER_GIGE=y - CONFIG_BCMA_DRIVER_GMAC_CMN=y ---- a/drivers/ssb/embedded.c -+++ b/drivers/ssb/embedded.c -@@ -34,11 +34,36 @@ int ssb_watchdog_timer_set(struct ssb_bu - } - EXPORT_SYMBOL(ssb_watchdog_timer_set); - -+#ifdef CONFIG_BCM47XX -+#include -+ -+static bool ssb_watchdog_supported(void) -+{ -+ enum bcm47xx_board board = bcm47xx_board_get(); -+ -+ /* The Huawei E970 has a hardware watchdog using a GPIO */ -+ switch (board) { -+ case BCM47XX_BOARD_HUAWEI_E970: -+ return false; -+ default: -+ return true; -+ } -+} -+#else -+static bool ssb_watchdog_supported(void) -+{ -+ return true; -+} -+#endif -+ - int ssb_watchdog_register(struct ssb_bus *bus) - { - struct bcm47xx_wdt wdt = {}; - struct platform_device *pdev; - -+ if (!ssb_watchdog_supported()) -+ return 0; -+ - if (ssb_chipco_available(&bus->chipco)) { - wdt.driver_data = &bus->chipco; - wdt.timer_set = ssb_chipco_watchdog_timer_set_wdt; diff --git a/target/linux/brcm47xx/patches-4.4/831-old_gpio_wdt.patch b/target/linux/brcm47xx/patches-4.4/831-old_gpio_wdt.patch deleted file mode 100644 index 5856a5c50..000000000 --- a/target/linux/brcm47xx/patches-4.4/831-old_gpio_wdt.patch +++ /dev/null @@ -1,360 +0,0 @@ -This generic GPIO watchdog is used on Huawei E970 (brcm47xx) - -Signed-off-by: Mathias Adam - ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -1216,6 +1216,15 @@ config WDT_MTX1 - Hardware driver for the MTX-1 boards. This is a watchdog timer that - will reboot the machine after a 100 seconds timer expired. - -+config GPIO_WDT -+ tristate "GPIO Hardware Watchdog" -+ help -+ Hardware driver for GPIO-controlled watchdogs. GPIO pin and -+ toggle interval settings are platform-specific. The driver -+ will stop toggling the GPIO (i.e. machine reboots) after a -+ 100 second timer expired and no process has written to -+ /dev/watchdog during that time. -+ - config PNX833X_WDT - tristate "PNX833x Hardware Watchdog" - depends on SOC_PNX8335 ---- a/drivers/watchdog/Makefile -+++ b/drivers/watchdog/Makefile -@@ -140,6 +140,7 @@ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt - obj-$(CONFIG_INDYDOG) += indydog.o - obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o - obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o -+obj-$(CONFIG_GPIO_WDT) += old_gpio_wdt.o - obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o - obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o - obj-$(CONFIG_AR7_WDT) += ar7_wdt.o ---- /dev/null -+++ b/drivers/watchdog/old_gpio_wdt.c -@@ -0,0 +1,301 @@ -+/* -+ * Driver for GPIO-controlled Hardware Watchdogs. -+ * -+ * Copyright (C) 2013 Mathias Adam -+ * -+ * Replaces mtx1_wdt (driver for the MTX-1 Watchdog): -+ * -+ * (C) Copyright 2005 4G Systems , -+ * All Rights Reserved. -+ * http://www.4g-systems.biz -+ * -+ * (C) Copyright 2007 OpenWrt.org, Florian Fainelli -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version -+ * 2 of the License, or (at your option) any later version. -+ * -+ * Neither Michael Stickel nor 4G Systems admit liability nor provide -+ * warranty for any of this software. This material is provided -+ * "AS-IS" and at no charge. -+ * -+ * (c) Copyright 2005 4G Systems -+ * -+ * Release 0.01. -+ * Author: Michael Stickel michael.stickel@4g-systems.biz -+ * -+ * Release 0.02. -+ * Author: Florian Fainelli florian@openwrt.org -+ * use the Linux watchdog/timer APIs -+ * -+ * Release 0.03. -+ * Author: Mathias Adam -+ * make it a generic gpio watchdog driver -+ * -+ * The Watchdog is configured to reset the MTX-1 -+ * if it is not triggered for 100 seconds. -+ * It should not be triggered more often than 1.6 seconds. -+ * -+ * A timer triggers the watchdog every 5 seconds, until -+ * it is opened for the first time. After the first open -+ * it MUST be triggered every 2..95 seconds. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int ticks = 100 * HZ; -+ -+static struct { -+ struct completion stop; -+ spinlock_t lock; -+ int running; -+ struct timer_list timer; -+ int queue; -+ int default_ticks; -+ unsigned long inuse; -+ unsigned gpio; -+ unsigned int gstate; -+ int interval; -+ int first_interval; -+} gpio_wdt_device; -+ -+static void gpio_wdt_trigger(unsigned long unused) -+{ -+ spin_lock(&gpio_wdt_device.lock); -+ if (gpio_wdt_device.running && ticks > 0) -+ ticks -= gpio_wdt_device.interval; -+ -+ /* toggle wdt gpio */ -+ gpio_wdt_device.gstate = !gpio_wdt_device.gstate; -+ gpio_set_value(gpio_wdt_device.gpio, gpio_wdt_device.gstate); -+ -+ if (gpio_wdt_device.queue && ticks > 0) -+ mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.interval); -+ else -+ complete(&gpio_wdt_device.stop); -+ spin_unlock(&gpio_wdt_device.lock); -+} -+ -+static void gpio_wdt_reset(void) -+{ -+ ticks = gpio_wdt_device.default_ticks; -+} -+ -+ -+static void gpio_wdt_start(void) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&gpio_wdt_device.lock, flags); -+ if (!gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 1; -+ gpio_wdt_device.gstate = 1; -+ gpio_set_value(gpio_wdt_device.gpio, 1); -+ mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.first_interval); -+ } -+ gpio_wdt_device.running++; -+ spin_unlock_irqrestore(&gpio_wdt_device.lock, flags); -+} -+ -+static int gpio_wdt_stop(void) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&gpio_wdt_device.lock, flags); -+ if (gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 0; -+ gpio_wdt_device.gstate = 0; -+ gpio_set_value(gpio_wdt_device.gpio, 0); -+ } -+ ticks = gpio_wdt_device.default_ticks; -+ spin_unlock_irqrestore(&gpio_wdt_device.lock, flags); -+ return 0; -+} -+ -+/* Filesystem functions */ -+ -+static int gpio_wdt_open(struct inode *inode, struct file *file) -+{ -+ if (test_and_set_bit(0, &gpio_wdt_device.inuse)) -+ return -EBUSY; -+ return nonseekable_open(inode, file); -+} -+ -+ -+static int gpio_wdt_release(struct inode *inode, struct file *file) -+{ -+ clear_bit(0, &gpio_wdt_device.inuse); -+ return 0; -+} -+ -+static long gpio_wdt_ioctl(struct file *file, unsigned int cmd, -+ unsigned long arg) -+{ -+ void __user *argp = (void __user *)arg; -+ int __user *p = (int __user *)argp; -+ unsigned int value; -+ static const struct watchdog_info ident = { -+ .options = WDIOF_CARDRESET, -+ .identity = "GPIO WDT", -+ }; -+ -+ switch (cmd) { -+ case WDIOC_GETSUPPORT: -+ if (copy_to_user(argp, &ident, sizeof(ident))) -+ return -EFAULT; -+ break; -+ case WDIOC_GETSTATUS: -+ case WDIOC_GETBOOTSTATUS: -+ put_user(0, p); -+ break; -+ case WDIOC_SETOPTIONS: -+ if (get_user(value, p)) -+ return -EFAULT; -+ if (value & WDIOS_ENABLECARD) -+ gpio_wdt_start(); -+ else if (value & WDIOS_DISABLECARD) -+ gpio_wdt_stop(); -+ else -+ return -EINVAL; -+ return 0; -+ case WDIOC_KEEPALIVE: -+ gpio_wdt_reset(); -+ break; -+ default: -+ return -ENOTTY; -+ } -+ return 0; -+} -+ -+ -+static ssize_t gpio_wdt_write(struct file *file, const char *buf, -+ size_t count, loff_t *ppos) -+{ -+ if (!count) -+ return -EIO; -+ gpio_wdt_reset(); -+ return count; -+} -+ -+static const struct file_operations gpio_wdt_fops = { -+ .owner = THIS_MODULE, -+ .llseek = no_llseek, -+ .unlocked_ioctl = gpio_wdt_ioctl, -+ .open = gpio_wdt_open, -+ .write = gpio_wdt_write, -+ .release = gpio_wdt_release, -+}; -+ -+ -+static struct miscdevice gpio_wdt_misc = { -+ .minor = WATCHDOG_MINOR, -+ .name = "watchdog", -+ .fops = &gpio_wdt_fops, -+}; -+ -+ -+static int gpio_wdt_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct gpio_wdt_platform_data *gpio_wdt_data = pdev->dev.platform_data; -+ -+ gpio_wdt_device.gpio = gpio_wdt_data->gpio; -+ gpio_wdt_device.interval = gpio_wdt_data->interval; -+ gpio_wdt_device.first_interval = gpio_wdt_data->first_interval; -+ if (gpio_wdt_device.first_interval <= 0) { -+ gpio_wdt_device.first_interval = gpio_wdt_device.interval; -+ } -+ -+ ret = gpio_request(gpio_wdt_device.gpio, "gpio-wdt"); -+ if (ret < 0) { -+ dev_err(&pdev->dev, "failed to request gpio"); -+ return ret; -+ } -+ -+ spin_lock_init(&gpio_wdt_device.lock); -+ init_completion(&gpio_wdt_device.stop); -+ gpio_wdt_device.queue = 0; -+ clear_bit(0, &gpio_wdt_device.inuse); -+ setup_timer(&gpio_wdt_device.timer, gpio_wdt_trigger, 0L); -+ gpio_wdt_device.default_ticks = ticks; -+ -+ gpio_wdt_start(); -+ dev_info(&pdev->dev, "GPIO Hardware Watchdog driver (gpio=%i interval=%i/%i)\n", -+ gpio_wdt_data->gpio, gpio_wdt_data->first_interval, gpio_wdt_data->interval); -+ return 0; -+} -+ -+static int gpio_wdt_remove(struct platform_device *pdev) -+{ -+ /* FIXME: do we need to lock this test ? */ -+ if (gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 0; -+ wait_for_completion(&gpio_wdt_device.stop); -+ } -+ -+ gpio_free(gpio_wdt_device.gpio); -+ misc_deregister(&gpio_wdt_misc); -+ return 0; -+} -+ -+static struct platform_driver gpio_wdt_driver = { -+ .probe = gpio_wdt_probe, -+ .remove = gpio_wdt_remove, -+ .driver.name = "gpio-wdt", -+ .driver.owner = THIS_MODULE, -+}; -+ -+static int __init gpio_wdt_init(void) -+{ -+ return platform_driver_register(&gpio_wdt_driver); -+} -+arch_initcall(gpio_wdt_init); -+ -+/* -+ * We do wdt initialization in two steps: arch_initcall probes the wdt -+ * very early to start pinging the watchdog (misc devices are not yet -+ * available), and later module_init() just registers the misc device. -+ */ -+static int gpio_wdt_init_late(void) -+{ -+ int ret; -+ -+ ret = misc_register(&gpio_wdt_misc); -+ if (ret < 0) { -+ pr_err("GPIO_WDT: failed to register misc device\n"); -+ return ret; -+ } -+ return 0; -+} -+#ifndef MODULE -+module_init(gpio_wdt_init_late); -+#endif -+ -+static void __exit gpio_wdt_exit(void) -+{ -+ platform_driver_unregister(&gpio_wdt_driver); -+} -+module_exit(gpio_wdt_exit); -+ -+MODULE_AUTHOR("Michael Stickel, Florian Fainelli, Mathias Adam"); -+MODULE_DESCRIPTION("Driver for GPIO hardware watchdogs"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); -+MODULE_ALIAS("platform:gpio-wdt"); ---- /dev/null -+++ b/include/linux/old_gpio_wdt.h -@@ -0,0 +1,21 @@ -+/* -+ * Definitions for the GPIO watchdog driver -+ * -+ * Copyright (C) 2013 Mathias Adam -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#ifndef _GPIO_WDT_H_ -+#define _GPIO_WDT_H_ -+ -+struct gpio_wdt_platform_data { -+ int gpio; /* GPIO line number */ -+ int interval; /* watchdog reset interval in system ticks */ -+ int first_interval; /* first wd reset interval in system ticks */ -+}; -+ -+#endif /* _GPIO_WDT_H_ */ diff --git a/target/linux/brcm47xx/patches-4.4/900-ssb-reject-PCI-writes-setting-CardBus-bridge-resourc.patch b/target/linux/brcm47xx/patches-4.4/900-ssb-reject-PCI-writes-setting-CardBus-bridge-resourc.patch deleted file mode 100644 index d7d2d7e59..000000000 --- a/target/linux/brcm47xx/patches-4.4/900-ssb-reject-PCI-writes-setting-CardBus-bridge-resourc.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 5c81397a0147ea59c778d1de14ef54e2268221f6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 8 Apr 2015 06:58:11 +0200 -Subject: [PATCH] ssb: reject PCI writes setting CardBus bridge resources -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If SoC has a CardBus we can set resources of device at slot 1 only. It's -impossigle to set bridge resources as it simply overwrites device 1 -configuration and usually results in Data bus error-s. - -Signed-off-by: Rafał Miłecki ---- - drivers/ssb/driver_pcicore.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/ssb/driver_pcicore.c -+++ b/drivers/ssb/driver_pcicore.c -@@ -164,6 +164,10 @@ static int ssb_extpci_write_config(struc - SSB_WARN_ON(!pc->hostmode); - if (unlikely(len != 1 && len != 2 && len != 4)) - goto out; -+ /* CardBus SoCs allow configuring dev 1 resources only */ -+ if (extpci_core->cardbusmode && dev != 1 && -+ off >= PCI_BASE_ADDRESS_0 && off <= PCI_BASE_ADDRESS_5) -+ goto out; - addr = get_cfgspace_addr(pc, bus, dev, func, off); - if (unlikely(!addr)) - goto out; diff --git a/target/linux/brcm47xx/patches-4.4/901-Revert-bcma-switch-GPIO-portions-to-use-GPIOLIB_IRQC.patch b/target/linux/brcm47xx/patches-4.4/901-Revert-bcma-switch-GPIO-portions-to-use-GPIOLIB_IRQC.patch deleted file mode 100644 index 57799ee08..000000000 --- a/target/linux/brcm47xx/patches-4.4/901-Revert-bcma-switch-GPIO-portions-to-use-GPIOLIB_IRQC.patch +++ /dev/null @@ -1,233 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 18 Dec 2015 07:51:08 +0100 -Subject: [PATCH] Revert "bcma: switch GPIO portions to use GPIOLIB_IRQCHIP" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This reverts commit 74f4e0cc61080f63f28e8d519bdf437957e64217. - -On BCM47XX (MIPS) bcma_bus_get_host_dev returns NULL which results in: -[ 0.157054] missing gpiochip .dev parent pointer -[ 0.157287] bcma: bus0: Error registering GPIO driver: -22 - -Signed-off-by: Rafał Miłecki ---- - drivers/bcma/Kconfig | 2 +- - drivers/bcma/driver_gpio.c | 92 +++++++++++++++++++---------- - include/linux/bcma/bcma_driver_chipcommon.h | 1 + - 3 files changed, 64 insertions(+), 31 deletions(-) - ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -106,7 +106,7 @@ config BCMA_DRIVER_GMAC_CMN - config BCMA_DRIVER_GPIO - bool "BCMA GPIO driver" - depends on BCMA && GPIOLIB -- select GPIOLIB_IRQCHIP if BCMA_HOST_SOC -+ select IRQ_DOMAIN if BCMA_HOST_SOC - help - Driver to provide access to the GPIO pins of the bcma bus. - ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -8,8 +8,10 @@ - * Licensed under the GNU/GPL. See COPYING for details. - */ - --#include -+#include -+#include - #include -+#include - #include - #include - -@@ -77,11 +79,19 @@ static void bcma_gpio_free(struct gpio_c - } - - #if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X) -+static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); -+ -+ if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) -+ return irq_find_mapping(cc->irq_domain, gpio); -+ else -+ return -EINVAL; -+} - - static void bcma_gpio_irq_unmask(struct irq_data *d) - { -- struct gpio_chip *gc = irq_data_get_irq_chip_data(d); -- struct bcma_drv_cc *cc = bcma_gpio_get_cc(gc); -+ struct bcma_drv_cc *cc = irq_data_get_irq_chip_data(d); - int gpio = irqd_to_hwirq(d); - u32 val = bcma_chipco_gpio_in(cc, BIT(gpio)); - -@@ -91,8 +101,7 @@ static void bcma_gpio_irq_unmask(struct - - static void bcma_gpio_irq_mask(struct irq_data *d) - { -- struct gpio_chip *gc = irq_data_get_irq_chip_data(d); -- struct bcma_drv_cc *cc = bcma_gpio_get_cc(gc); -+ struct bcma_drv_cc *cc = irq_data_get_irq_chip_data(d); - int gpio = irqd_to_hwirq(d); - - bcma_chipco_gpio_intmask(cc, BIT(gpio), 0); -@@ -107,7 +116,6 @@ static struct irq_chip bcma_gpio_irq_chi - static irqreturn_t bcma_gpio_irq_handler(int irq, void *dev_id) - { - struct bcma_drv_cc *cc = dev_id; -- struct gpio_chip *gc = &cc->gpio; - u32 val = bcma_cc_read32(cc, BCMA_CC_GPIOIN); - u32 mask = bcma_cc_read32(cc, BCMA_CC_GPIOIRQ); - u32 pol = bcma_cc_read32(cc, BCMA_CC_GPIOPOL); -@@ -117,58 +125,81 @@ static irqreturn_t bcma_gpio_irq_handler - if (!irqs) - return IRQ_NONE; - -- for_each_set_bit(gpio, &irqs, gc->ngpio) -- generic_handle_irq(irq_find_mapping(gc->irqdomain, gpio)); -+ for_each_set_bit(gpio, &irqs, cc->gpio.ngpio) -+ generic_handle_irq(bcma_gpio_to_irq(&cc->gpio, gpio)); - bcma_chipco_gpio_polarity(cc, irqs, val & irqs); - - return IRQ_HANDLED; - } - --static int bcma_gpio_irq_init(struct bcma_drv_cc *cc) -+static int bcma_gpio_irq_domain_init(struct bcma_drv_cc *cc) - { - struct gpio_chip *chip = &cc->gpio; -- int hwirq, err; -+ int gpio, hwirq, err; - - if (cc->core->bus->hosttype != BCMA_HOSTTYPE_SOC) - return 0; - -+ cc->irq_domain = irq_domain_add_linear(NULL, chip->ngpio, -+ &irq_domain_simple_ops, cc); -+ if (!cc->irq_domain) { -+ err = -ENODEV; -+ goto err_irq_domain; -+ } -+ for (gpio = 0; gpio < chip->ngpio; gpio++) { -+ int irq = irq_create_mapping(cc->irq_domain, gpio); -+ -+ irq_set_chip_data(irq, cc); -+ irq_set_chip_and_handler(irq, &bcma_gpio_irq_chip, -+ handle_simple_irq); -+ } -+ - hwirq = bcma_core_irq(cc->core, 0); - err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio", - cc); - if (err) -- return err; -+ goto err_req_irq; - - bcma_chipco_gpio_intmask(cc, ~0, 0); - bcma_cc_set32(cc, BCMA_CC_IRQMASK, BCMA_CC_IRQ_GPIO); - -- err = gpiochip_irqchip_add(chip, -- &bcma_gpio_irq_chip, -- 0, -- handle_simple_irq, -- IRQ_TYPE_NONE); -- if (err) { -- free_irq(hwirq, cc); -- return err; -- } -- - return 0; -+ -+err_req_irq: -+ for (gpio = 0; gpio < chip->ngpio; gpio++) { -+ int irq = irq_find_mapping(cc->irq_domain, gpio); -+ -+ irq_dispose_mapping(irq); -+ } -+ irq_domain_remove(cc->irq_domain); -+err_irq_domain: -+ return err; - } - --static void bcma_gpio_irq_exit(struct bcma_drv_cc *cc) -+static void bcma_gpio_irq_domain_exit(struct bcma_drv_cc *cc) - { -+ struct gpio_chip *chip = &cc->gpio; -+ int gpio; -+ - if (cc->core->bus->hosttype != BCMA_HOSTTYPE_SOC) - return; - - bcma_cc_mask32(cc, BCMA_CC_IRQMASK, ~BCMA_CC_IRQ_GPIO); - free_irq(bcma_core_irq(cc->core, 0), cc); -+ for (gpio = 0; gpio < chip->ngpio; gpio++) { -+ int irq = irq_find_mapping(cc->irq_domain, gpio); -+ -+ irq_dispose_mapping(irq); -+ } -+ irq_domain_remove(cc->irq_domain); - } - #else --static int bcma_gpio_irq_init(struct bcma_drv_cc *cc) -+static int bcma_gpio_irq_domain_init(struct bcma_drv_cc *cc) - { - return 0; - } - --static void bcma_gpio_irq_exit(struct bcma_drv_cc *cc) -+static void bcma_gpio_irq_domain_exit(struct bcma_drv_cc *cc) - { - } - #endif -@@ -187,8 +218,9 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->set = bcma_gpio_set_value; - chip->direction_input = bcma_gpio_direction_input; - chip->direction_output = bcma_gpio_direction_output; -- chip->owner = THIS_MODULE; -- chip->dev = bcma_bus_get_host_dev(bus); -+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X) -+ chip->to_irq = bcma_gpio_to_irq; -+#endif - #if IS_BUILTIN(CONFIG_OF) - chip->of_node = cc->core->dev.of_node; - #endif -@@ -216,13 +248,13 @@ int bcma_gpio_init(struct bcma_drv_cc *c - else - chip->base = -1; - -- err = gpiochip_add(chip); -+ err = bcma_gpio_irq_domain_init(cc); - if (err) - return err; - -- err = bcma_gpio_irq_init(cc); -+ err = gpiochip_add(chip); - if (err) { -- gpiochip_remove(chip); -+ bcma_gpio_irq_domain_exit(cc); - return err; - } - -@@ -231,7 +263,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c - - int bcma_gpio_unregister(struct bcma_drv_cc *cc) - { -- bcma_gpio_irq_exit(cc); -+ bcma_gpio_irq_domain_exit(cc); - gpiochip_remove(&cc->gpio); - return 0; - } ---- a/include/linux/bcma/bcma_driver_chipcommon.h -+++ b/include/linux/bcma/bcma_driver_chipcommon.h -@@ -646,6 +646,7 @@ struct bcma_drv_cc { - spinlock_t gpio_lock; - #ifdef CONFIG_BCMA_DRIVER_GPIO - struct gpio_chip gpio; -+ struct irq_domain *irq_domain; - #endif - }; - diff --git a/target/linux/brcm47xx/patches-4.4/940-bcm47xx-yenta.patch b/target/linux/brcm47xx/patches-4.4/940-bcm47xx-yenta.patch deleted file mode 100644 index 00a44d631..000000000 --- a/target/linux/brcm47xx/patches-4.4/940-bcm47xx-yenta.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/drivers/pcmcia/yenta_socket.c -+++ b/drivers/pcmcia/yenta_socket.c -@@ -919,6 +919,8 @@ static unsigned int yenta_probe_irq(stru - * Probe for usable interrupts using the force - * register to generate bogus card status events. - */ -+#ifndef CONFIG_BCM47XX -+ /* WRT54G3G does not like this */ - cb_writel(socket, CB_SOCKET_EVENT, -1); - cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK); - reg = exca_readb(socket, I365_CSCINT); -@@ -934,6 +936,7 @@ static unsigned int yenta_probe_irq(stru - } - cb_writel(socket, CB_SOCKET_MASK, 0); - exca_writeb(socket, I365_CSCINT, reg); -+#endif - - mask = probe_irq_mask(val) & 0xffff; - -@@ -1018,6 +1021,10 @@ static void yenta_get_socket_capabilitie - else - socket->socket.irq_mask = 0; - -+ /* irq mask probing is broken for the WRT54G3G */ -+ if (socket->socket.irq_mask == 0) -+ socket->socket.irq_mask = 0x6f8; -+ - dev_info(&socket->dev->dev, "ISA IRQ mask 0x%04x, PCI irq %d\n", - socket->socket.irq_mask, socket->cb_irq); - } -@@ -1250,6 +1257,15 @@ static int yenta_probe(struct pci_dev *d - dev_info(&dev->dev, "Socket status: %08x\n", - cb_readl(socket, CB_SOCKET_STATE)); - -+ /* Generate an interrupt on card insert/remove */ -+ config_writew(socket, CB_SOCKET_MASK, CB_CSTSMASK | CB_CDMASK); -+ -+ /* Set up Multifunction Routing Status Register */ -+ config_writew(socket, 0x8C, 0x1000 /* MFUNC3 to GPIO3 */ | 0x2 /* MFUNC0 to INTA */); -+ -+ /* Switch interrupts to parallelized */ -+ config_writeb(socket, 0x92, 0x64); -+ - yenta_fixup_parent_bridge(dev->subordinate); - - /* Register it with the pcmcia layer.. */ diff --git a/target/linux/brcm47xx/patches-4.4/976-ssb_increase_pci_delay.patch b/target/linux/brcm47xx/patches-4.4/976-ssb_increase_pci_delay.patch deleted file mode 100644 index 90bda515e..000000000 --- a/target/linux/brcm47xx/patches-4.4/976-ssb_increase_pci_delay.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/ssb/driver_pcicore.c -+++ b/drivers/ssb/driver_pcicore.c -@@ -389,7 +389,7 @@ static void ssb_pcicore_init_hostmode(st - set_io_port_base(ssb_pcicore_controller.io_map_base); - /* Give some time to the PCI controller to configure itself with the new - * values. Not waiting at this point causes crashes of the machine. */ -- mdelay(10); -+ mdelay(300); - register_pci_controller(&ssb_pcicore_controller); - } - diff --git a/target/linux/brcm47xx/patches-4.4/999-wl_exports.patch b/target/linux/brcm47xx/patches-4.4/999-wl_exports.patch deleted file mode 100644 index ea59f4f1d..000000000 --- a/target/linux/brcm47xx/patches-4.4/999-wl_exports.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/drivers/firmware/broadcom/bcm47xx_nvram.c -+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c -@@ -34,7 +34,8 @@ struct nvram_header { - u32 config_ncdl; /* ncdl values for memc */ - }; - --static char nvram_buf[NVRAM_SPACE]; -+char nvram_buf[NVRAM_SPACE]; -+EXPORT_SYMBOL(nvram_buf); - static size_t nvram_len; - static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; - static int cfe_env; ---- a/arch/mips/mm/cache.c -+++ b/arch/mips/mm/cache.c -@@ -59,6 +59,7 @@ void (*_dma_cache_wback)(unsigned long s - void (*_dma_cache_inv)(unsigned long start, unsigned long size); - - EXPORT_SYMBOL(_dma_cache_wback_inv); -+EXPORT_SYMBOL(_dma_cache_inv); - - #endif /* CONFIG_DMA_NONCOHERENT || CONFIG_DMA_MAYBE_COHERENT */ - diff --git a/target/linux/brcm47xx/patches-4.9/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch b/target/linux/brcm47xx/patches-4.9/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch new file mode 100644 index 000000000..e4c47605d --- /dev/null +++ b/target/linux/brcm47xx/patches-4.9/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch @@ -0,0 +1,96 @@ +From 88b882ba0b0b7439d16d2c9df7f111cdf793443b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 8 Apr 2018 22:39:15 +0200 +Subject: [PATCH] MIPS: BCM47XX: Add support for Netgear WNR1000 V3 + +This adds support for detecting this model board and registers some LEDs +and buttons. + +There are two uncommon things regarding this device: +1) It can use two different "board_id" ID values. + Unit I have uses "U12H139T00_NETGEAR" value. This magic is also used + in firmware file header. There are two reports (one from an OpenWrt + user) of a different "U12H139T50_NETGEAR" magic though. +2) Power LEDs share GPIOs with buttons. + Amber one seems to share GPIO 2 with WPS button and green one seems + to share GPIO 3 with reset button. It remains unknown how to support + them and handle buttons at the same time. For that reason they aren't + added to the list of supported LEDs. +--- + arch/mips/bcm47xx/board.c | 2 ++ + arch/mips/bcm47xx/buttons.c | 9 +++++++++ + arch/mips/bcm47xx/leds.c | 9 +++++++++ + arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 1 + + 4 files changed, 21 insertions(+) + +--- a/arch/mips/bcm47xx/board.c ++++ b/arch/mips/bcm47xx/board.c +@@ -171,6 +171,8 @@ struct bcm47xx_board_type_list1 bcm47xx_ + {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"}, ++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T00_NETGEAR"}, ++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"}, +--- a/arch/mips/bcm47xx/buttons.c ++++ b/arch/mips/bcm47xx/buttons.c +@@ -411,6 +411,12 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i + }; + + static const struct gpio_keys_button ++bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = { ++ BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON), ++ BCM47XX_GPIO_KEY(3, KEY_RESTART), ++}; ++ ++static const struct gpio_keys_button + bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = { + BCM47XX_GPIO_KEY(4, KEY_RESTART), + BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), +@@ -669,6 +675,9 @@ int __init bcm47xx_buttons_register(void + case BCM47XX_BOARD_NETGEAR_WNDR4500V1: + err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); + break; ++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3: ++ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3); ++ break; + case BCM47XX_BOARD_NETGEAR_WNR3500L: + err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1); + break; +--- a/arch/mips/bcm47xx/leds.c ++++ b/arch/mips/bcm47xx/leds.c +@@ -497,6 +497,12 @@ bcm47xx_leds_netgear_wndr4500v1[] __init + }; + + static const struct gpio_led ++bcm47xx_leds_netgear_wnr1000_v3[] __initconst = { ++ BCM47XX_GPIO_LED(0, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), ++ BCM47XX_GPIO_LED(1, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), ++}; ++ ++static const struct gpio_led + bcm47xx_leds_netgear_wnr3500lv1[] __initconst = { + BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), + BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), +@@ -757,6 +763,9 @@ void __init bcm47xx_leds_register(void) + case BCM47XX_BOARD_NETGEAR_WNDR4500V1: + bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1); + break; ++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3: ++ bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr1000_v3); ++ break; + case BCM47XX_BOARD_NETGEAR_WNR3500L: + bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1); + break; +--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h ++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h +@@ -109,6 +109,7 @@ enum bcm47xx_board { + BCM47XX_BOARD_NETGEAR_WNDR4000, + BCM47XX_BOARD_NETGEAR_WNDR4500V1, + BCM47XX_BOARD_NETGEAR_WNDR4500V2, ++ BCM47XX_BOARD_NETGEAR_WNR1000_V3, + BCM47XX_BOARD_NETGEAR_WNR2000, + BCM47XX_BOARD_NETGEAR_WNR3500L, + BCM47XX_BOARD_NETGEAR_WNR3500U, diff --git a/target/linux/brcm47xx/patches-4.9/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch b/target/linux/brcm47xx/patches-4.9/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch new file mode 100644 index 000000000..7c860bb7e --- /dev/null +++ b/target/linux/brcm47xx/patches-4.9/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch @@ -0,0 +1,24 @@ +From 663beaeacf2552ed07405e69e96a18775e069eab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 8 Apr 2018 22:51:08 +0200 +Subject: [PATCH] firmware: bcm47xx_nvram: support small (0x6000 B) NVRAM + partitions + +Some old devices with 4 MiB flashes were using 0x1000 block size and +could use smaller (0x6000 bytes) flash partition for storing NVRAM +content. This adds support for reading NVRAM on Netgear WNR1000 V3. +--- + drivers/firmware/broadcom/bcm47xx_nvram.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -36,7 +36,7 @@ struct nvram_header { + + static char nvram_buf[NVRAM_SPACE]; + static size_t nvram_len; +-static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; ++static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000}; + + static u32 find_nvram_size(void __iomem *end) + { diff --git a/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch index c5f97ba49..d771081dd 100644 --- a/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch +++ b/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch @@ -21,14 +21,6 @@ {{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"}, -@@ -171,6 +175,7 @@ struct bcm47xx_board_type_list1 bcm47xx_ - {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"}, -+ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"}, - {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"}, --- a/arch/mips/bcm47xx/buttons.c +++ b/arch/mips/bcm47xx/buttons.c @@ -26,6 +26,12 @@ @@ -81,19 +73,7 @@ bcm47xx_buttons_netgear_wndr3400v1[] __initconst = { BCM47XX_GPIO_KEY(4, KEY_RESTART), BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), -@@ -411,6 +440,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i - }; - - static const struct gpio_keys_button -+bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = { -+ BCM47XX_GPIO_KEY(3, KEY_RESTART), -+}; -+ -+static const struct gpio_keys_button - bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = { - BCM47XX_GPIO_KEY(4, KEY_RESTART), - BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), -@@ -464,6 +498,9 @@ int __init bcm47xx_buttons_register(void +@@ -470,6 +499,9 @@ int __init bcm47xx_buttons_register(void int err; switch (board) { @@ -103,7 +83,7 @@ case BCM47XX_BOARD_ASUS_RTN12: err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12); break; -@@ -594,6 +631,12 @@ int __init bcm47xx_buttons_register(void +@@ -600,6 +632,12 @@ int __init bcm47xx_buttons_register(void case BCM47XX_BOARD_LINKSYS_WRT310NV1: err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1); break; @@ -116,7 +96,7 @@ case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2); break; -@@ -657,6 +700,12 @@ int __init bcm47xx_buttons_register(void +@@ -663,6 +701,12 @@ int __init bcm47xx_buttons_register(void err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3); break; @@ -129,16 +109,6 @@ case BCM47XX_BOARD_NETGEAR_WNDR3400V1: err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1); break; -@@ -669,6 +718,9 @@ int __init bcm47xx_buttons_register(void - case BCM47XX_BOARD_NETGEAR_WNDR4500V1: - err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); - break; -+ case BCM47XX_BOARD_NETGEAR_WNR1000_V3: -+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3); -+ break; - case BCM47XX_BOARD_NETGEAR_WNR3500L: - err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1); - break; --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h @@ -71,6 +71,7 @@ enum bcm47xx_board { @@ -162,14 +132,6 @@ BCM47XX_BOARD_NETGEAR_WNDR3300, BCM47XX_BOARD_NETGEAR_WNDR3400V1, BCM47XX_BOARD_NETGEAR_WNDR3400V2, -@@ -109,6 +113,7 @@ enum bcm47xx_board { - BCM47XX_BOARD_NETGEAR_WNDR4000, - BCM47XX_BOARD_NETGEAR_WNDR4500V1, - BCM47XX_BOARD_NETGEAR_WNDR4500V2, -+ BCM47XX_BOARD_NETGEAR_WNR1000_V3, - BCM47XX_BOARD_NETGEAR_WNR2000, - BCM47XX_BOARD_NETGEAR_WNR3500L, - BCM47XX_BOARD_NETGEAR_WNR3500U, --- a/arch/mips/bcm47xx/leds.c +++ b/arch/mips/bcm47xx/leds.c @@ -29,6 +29,14 @@ @@ -201,7 +163,7 @@ bcm47xx_leds_linksys_wrt54g_generic[] __initconst = { BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), -@@ -549,6 +564,9 @@ void __init bcm47xx_leds_register(void) +@@ -555,6 +570,9 @@ void __init bcm47xx_leds_register(void) enum bcm47xx_board board = bcm47xx_board_get(); switch (board) { @@ -211,7 +173,7 @@ case BCM47XX_BOARD_ASUS_RTN12: bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12); break; -@@ -682,6 +700,9 @@ void __init bcm47xx_leds_register(void) +@@ -688,6 +706,9 @@ void __init bcm47xx_leds_register(void) case BCM47XX_BOARD_LINKSYS_WRT310NV1: bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1); break; diff --git a/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch b/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch index 7e4ae2070..58d8500b0 100644 --- a/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch +++ b/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c -@@ -102,6 +102,7 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -103,6 +103,7 @@ static int bcm47xxpart_parse(struct mtd_ int trx_num = 0; /* Number of found TRX partitions */ int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; int err; @@ -8,7 +8,7 @@ /* * Some really old flashes (like AT45DB*) had smaller erasesize-s, but -@@ -269,12 +270,23 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -284,12 +285,23 @@ static int bcm47xxpart_parse(struct mtd_ if (buf[0] == NVRAM_HEADER) { bcm47xxpart_add_part(&parts[curr_part++], "nvram", master->size - blocksize, 0); diff --git a/target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch b/target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch index 867c6777c..5c3221157 100644 --- a/target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch +++ b/target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch @@ -245,7 +245,7 @@ out the configuration than the in kernel cfe config reader. @@ -37,6 +37,8 @@ struct nvram_header { static char nvram_buf[NVRAM_SPACE]; static size_t nvram_len; - static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; + static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000}; +static int cfe_env; +extern char *cfe_env_get(char *nv_buf, const char *name); diff --git a/target/linux/brcm47xx/patches-4.9/830-huawei_e970_support.patch b/target/linux/brcm47xx/patches-4.9/830-huawei_e970_support.patch index b6150ed8f..5d40fe654 100644 --- a/target/linux/brcm47xx/patches-4.9/830-huawei_e970_support.patch +++ b/target/linux/brcm47xx/patches-4.9/830-huawei_e970_support.patch @@ -8,7 +8,7 @@ #include #include #include -@@ -225,6 +226,33 @@ static struct fixed_phy_status bcm47xx_f +@@ -231,6 +232,33 @@ static struct fixed_phy_status bcm47xx_f .duplex = DUPLEX_FULL, }; @@ -42,7 +42,7 @@ static int __init bcm47xx_register_bus_complete(void) { switch (bcm47xx_bus_type) { -@@ -244,6 +272,7 @@ static int __init bcm47xx_register_bus_c +@@ -250,6 +278,7 @@ static int __init bcm47xx_register_bus_c bcm47xx_workarounds(); fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status, -1); diff --git a/target/linux/brcm47xx/patches-4.9/999-wl_exports.patch b/target/linux/brcm47xx/patches-4.9/999-wl_exports.patch index ccad06da0..957e5885a 100644 --- a/target/linux/brcm47xx/patches-4.9/999-wl_exports.patch +++ b/target/linux/brcm47xx/patches-4.9/999-wl_exports.patch @@ -8,7 +8,7 @@ +char nvram_buf[NVRAM_SPACE]; +EXPORT_SYMBOL(nvram_buf); static size_t nvram_len; - static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; + static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000}; static int cfe_env; --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c diff --git a/target/linux/brcm63xx/base-files/etc/board.d/02_network b/target/linux/brcm63xx/base-files/etc/board.d/02_network index 06b4b6ece..a7fd6f5d3 100755 --- a/target/linux/brcm63xx/base-files/etc/board.d/02_network +++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network @@ -98,13 +98,18 @@ vr-3026e) "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "8t@eth0" ;; -ad1018-nor|\ ar-5315u |\ +fast2704n |\ vh4032n) ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "8t@eth0" ;; +ad1018-nor) + ucidef_add_switch "switch0" \ + "1:lan:3" "2:lan:2" "3:lan:1" "0:wan" "8t@eth0" + ;; + bcm96368mvwg) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "4:lan" "5:lan" "8t@eth0" @@ -115,10 +120,9 @@ wap-5813n) "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@eth0" ;; -fast2704n |\ dgnd3700v1_dgnd3800b) ucidef_add_switch "switch0" \ - "1:lan:1" "2:lan:2" "3:lan:3" "4:lan:4" "0:wan" "8t@eth0" + "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "8t@eth0" ;; neufbox6) diff --git a/target/linux/brcm63xx/config-4.14 b/target/linux/brcm63xx/config-4.14 index 87cfe2886..2a001952e 100644 --- a/target/linux/brcm63xx/config-4.14 +++ b/target/linux/brcm63xx/config-4.14 @@ -18,7 +18,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_BCM6345_EXT_IRQ=y CONFIG_BCM6345_PERIPH_IRQ=y @@ -75,15 +74,10 @@ CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y CONFIG_CSRC_R4K=y CONFIG_DMA_NONCOHERENT=y -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y CONFIG_EARLY_PRINTK=y -CONFIG_EXPORTFS=y CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FIXED_PHY=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y @@ -278,7 +272,6 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_HOTPLUG_CPU=y CONFIG_SYS_SUPPORTS_SMP=y -CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TINY_SRCU=y CONFIG_USB_SUPPORT=y diff --git a/target/linux/brcm63xx/config-4.4 b/target/linux/brcm63xx/config-4.4 deleted file mode 100644 index 755590f53..000000000 --- a/target/linux/brcm63xx/config-4.4 +++ /dev/null @@ -1,261 +0,0 @@ -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_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_BCM6345_EXT_IRQ=y -CONFIG_BCM6345_PERIPH_IRQ=y -CONFIG_BCM63XX=y -CONFIG_BCM63XX_CPU_3368=y -CONFIG_BCM63XX_CPU_6318=y -CONFIG_BCM63XX_CPU_63268=y -CONFIG_BCM63XX_CPU_6328=y -CONFIG_BCM63XX_CPU_6338=y -CONFIG_BCM63XX_CPU_6345=y -CONFIG_BCM63XX_CPU_6348=y -CONFIG_BCM63XX_CPU_6358=y -CONFIG_BCM63XX_CPU_6362=y -CONFIG_BCM63XX_CPU_6368=y -CONFIG_BCM63XX_EHCI=y -CONFIG_BCM63XX_ENET=y -CONFIG_BCM63XX_OHCI=y -CONFIG_BCM63XX_PHY=y -CONFIG_BCM63XX_WDT=y -CONFIG_BCMA=y -CONFIG_BCMA_BLOCKIO=y -# CONFIG_BCMA_DEBUG is not set -# CONFIG_BCMA_DRIVER_GMAC_CMN is not set -# CONFIG_BCMA_DRIVER_MIPS is not set -CONFIG_BCMA_DRIVER_PCI=y -# CONFIG_BCMA_DRIVER_PCI_HOSTMODE is not set -CONFIG_BCMA_HOST_PCI=y -CONFIG_BCMA_HOST_PCI_POSSIBLE=y -# CONFIG_BCMA_HOST_SOC is not set -CONFIG_BCM_NET_PHYLIB=y -CONFIG_BOARD_BCM63XX_DT=y -CONFIG_BOARD_BCM963XX=y -CONFIG_BOARD_LIVEBOX=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CEVT_R4K=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CPU_BMIPS=y -CONFIG_CPU_BMIPS32_3300=y -CONFIG_CPU_BMIPS4350=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_MIPS32=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_CRYPTO_RNG2=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_DTC=y -CONFIG_EARLY_PRINTK=y -CONFIG_FIRMWARE_IN_KERNEL=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_PINCONF=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_BCM63XX=y -CONFIG_GPIO_DEVRES=y -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_SYSFS=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_EXIT_ON_IRQ_STACK=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HW_HAS_PCI=y -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_BCM63XX=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IP_PIMSM_V1=y -CONFIG_IP_PIMSM_V2=y -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MIPS_CPU=y -CONFIG_IRQ_WORK=y -CONFIG_KEXEC=y -CONFIG_KEXEC_CORE=y -CONFIG_LEDS_BCM6328=y -CONFIG_LEDS_BCM6358=y -CONFIG_LEDS_GPIO=y -CONFIG_LIBFDT=y -CONFIG_MDIO_BOARDINFO=y -CONFIG_MFD_SYSCON=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 is not set -CONFIG_MIPS_RAW_APPENDED_DTB=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MODULE_FORCE_LOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_MTD_BCM63XX_PARTS=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_BE_BYTE_SWAP=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_CFI_NOSWAP is not set -CONFIG_MTD_CFI_STAA=y -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_M25P80=y -CONFIG_MTD_PHYSMAP=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y -CONFIG_MTD_SPI_NOR=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -# CONFIG_NO_IOPORT_MAP is not set -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_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_PCIEAER is not set -CONFIG_PCIEPORTBUS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PINCTRL=y -CONFIG_PINCTRL_BCM6318=y -CONFIG_PINCTRL_BCM63268=y -CONFIG_PINCTRL_BCM6328=y -CONFIG_PINCTRL_BCM6348=y -CONFIG_PINCTRL_BCM6358=y -CONFIG_PINCTRL_BCM6362=y -CONFIG_PINCTRL_BCM6368=y -CONFIG_PINCTRL_BCM63XX=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -# CONFIG_RCU_STALL_COMMON is not set -CONFIG_REGMAP=y -CONFIG_REGMAP_MMIO=y -CONFIG_RELAY=y -CONFIG_RTL8366_SMI=y -CONFIG_RTL8367_PHY=y -# CONFIG_SCHED_INFO is not set -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_BCM63XX=y -CONFIG_SERIAL_BCM63XX_CONSOLE=y -CONFIG_SPI=y -CONFIG_SPI_BCM63XX=y -CONFIG_SPI_BCM63XX_HSSPI=y -CONFIG_SPI_MASTER=y -CONFIG_SQUASHFS_EMBEDDED=y -CONFIG_SRCU=y -CONFIG_SSB=y -CONFIG_SSB_B43_PCI_BRIDGE=y -CONFIG_SSB_BLOCKIO=y -# CONFIG_SSB_DRIVER_MIPS is not set -CONFIG_SSB_DRIVER_PCICORE=y -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_SPROM=y -CONFIG_SWAP_IO_SPACE=y -CONFIG_SWCONFIG=y -CONFIG_SWCONFIG_B53=y -CONFIG_SWCONFIG_B53_MMAP_DRIVER=y -CONFIG_SWCONFIG_B53_PHY_DRIVER=y -CONFIG_SWCONFIG_B53_PHY_FIXUP=y -CONFIG_SWCONFIG_B53_SPI_DRIVER=y -# CONFIG_SWCONFIG_B53_SRAB_DRIVER is not set -CONFIG_SYNC_R4K=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_HAS_CPU_BMIPS=y -CONFIG_SYS_HAS_CPU_BMIPS32_3300=y -CONFIG_SYS_HAS_CPU_BMIPS4350=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_SYS_SUPPORTS_HOTPLUG_CPU=y -CONFIG_SYS_SUPPORTS_SMP=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_USB_SUPPORT=y -CONFIG_USE_OF=y -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WATCHDOG_NOWAYOUT=y -CONFIG_WEAK_ORDERING=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/brcm63xx/patches-4.14/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch b/target/linux/brcm63xx/patches-4.14/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch deleted file mode 100644 index bd66e72c9..000000000 --- a/target/linux/brcm63xx/patches-4.14/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch +++ /dev/null @@ -1,101 +0,0 @@ -From d0423d3e4fa7ae305729cb50369427f075ccb279 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 25 Feb 2017 12:41:28 +0100 -Subject: [PATCH 1/6] bcm63xx_enet: correct clock usage - -Check the return code of prepare_enable and change one last instance of -enable only to prepare_enable. Also properly disable and release the -clock in error paths and on remove for enetsw. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 31 +++++++++++++++++++++------- - 1 file changed, 23 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1773,7 +1773,9 @@ static int bcm_enet_probe(struct platfor - ret = PTR_ERR(priv->mac_clk); - goto out; - } -- clk_prepare_enable(priv->mac_clk); -+ ret = clk_prepare_enable(priv->mac_clk); -+ if (ret) -+ goto out_put_clk_mac; - - /* initialize default and fetch platform data */ - priv->rx_ring_size = BCMENET_DEF_RX_DESC; -@@ -1805,9 +1807,11 @@ static int bcm_enet_probe(struct platfor - if (IS_ERR(priv->phy_clk)) { - ret = PTR_ERR(priv->phy_clk); - priv->phy_clk = NULL; -- goto out_put_clk_mac; -+ goto out_disable_clk_mac; - } -- clk_prepare_enable(priv->phy_clk); -+ ret = clk_prepare_enable(priv->phy_clk); -+ if (ret) -+ goto out_put_clk_phy; - } - - /* do minimal hardware init to be able to probe mii bus */ -@@ -1901,13 +1905,16 @@ out_free_mdio: - out_uninit_hw: - /* turn off mdc clock */ - enet_writel(priv, 0, ENET_MIISC_REG); -- if (priv->phy_clk) { -+ if (priv->phy_clk) - clk_disable_unprepare(priv->phy_clk); -+ -+out_put_clk_phy: -+ if (priv->phy_clk) - clk_put(priv->phy_clk); -- } - --out_put_clk_mac: -+out_disable_clk_mac: - clk_disable_unprepare(priv->mac_clk); -+out_put_clk_mac: - clk_put(priv->mac_clk); - out: - free_netdev(dev); -@@ -2752,7 +2759,9 @@ static int bcm_enetsw_probe(struct platf - ret = PTR_ERR(priv->mac_clk); - goto out_unmap; - } -- clk_enable(priv->mac_clk); -+ ret = clk_prepare_enable(priv->mac_clk); -+ if (ret) -+ goto out_put_clk; - - priv->rx_chan = 0; - priv->tx_chan = 1; -@@ -2773,7 +2782,7 @@ static int bcm_enetsw_probe(struct platf - - ret = register_netdev(dev); - if (ret) -- goto out_put_clk; -+ goto out_disable_clk; - - netif_carrier_off(dev); - platform_set_drvdata(pdev, dev); -@@ -2782,6 +2791,9 @@ static int bcm_enetsw_probe(struct platf - - return 0; - -+out_disable_clk: -+ clk_disable_unprepare(priv->mac_clk); -+ - out_put_clk: - clk_put(priv->mac_clk); - -@@ -2813,6 +2825,9 @@ static int bcm_enetsw_remove(struct plat - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res->start, resource_size(res)); - -+ clk_disable_unprepare(priv->mac_clk); -+ clk_put(priv->mac_clk); -+ - free_netdev(dev); - return 0; - } diff --git a/target/linux/brcm63xx/patches-4.14/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch b/target/linux/brcm63xx/patches-4.14/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch deleted file mode 100644 index 22b3a732f..000000000 --- a/target/linux/brcm63xx/patches-4.14/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 23d94cb855b6f4f0ee1c01679224472104ac6440 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 30 Sep 2017 14:10:18 +0200 -Subject: [PATCH 2/6] bcm63xx_enet: do not write to random DMA channel on - BCM6345 - -The DMA controller regs actually point to DMA channel 0, so the write to -ENETDMA_CFG_REG will actually modify a random DMA channel. - -Since DMA controller registers do not exist on BCM6345, guard the write -with the usual check for dma_has_sram. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1062,7 +1062,8 @@ static int bcm_enet_open(struct net_devi - val = enet_readl(priv, ENET_CTL_REG); - val |= ENET_CTL_ENABLE_MASK; - enet_writel(priv, val, ENET_CTL_REG); -- enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); -+ if (priv->dma_has_sram) -+ enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); - enet_dmac_writel(priv, priv->dma_chan_en_mask, - ENETDMAC_CHANCFG, priv->rx_chan); - diff --git a/target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch b/target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch new file mode 100644 index 000000000..073a8a45f --- /dev/null +++ b/target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch @@ -0,0 +1,81 @@ +From e62ff8f02eb3ae35ae7ece7c5272a689fd8b0bcd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 27 Jul 2018 21:37:48 +0200 +Subject: [PATCH] Revert "mtd: partitions: use DT info for parsing partitions + with "compatible" prop" + +This reverts commit 76a832254ab05502c9394cc51ded6f0abe0e0bee. +--- + drivers/mtd/mtdpart.c | 33 ++++++++++++++++++++------------- + 1 file changed, 20 insertions(+), 13 deletions(-) + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -453,6 +453,22 @@ static inline void free_partition(struct + kfree(p); + } + ++/** ++ * mtd_parse_part - parse MTD partition looking for subpartitions ++ * ++ * @slave: part that is supposed to be a container and should be parsed ++ * @types: NULL-terminated array with names of partition parsers to try ++ * ++ * Some partitions are kind of containers with extra subpartitions (volumes). ++ * There can be various formats of such containers. This function tries to use ++ * specified parsers to analyze given partition and registers found ++ * subpartitions on success. ++ */ ++static int mtd_parse_part(struct mtd_part *slave, const char *const *types) ++{ ++ return parse_mtd_partitions(&slave->mtd, types, NULL); ++} ++ + static struct mtd_part *allocate_partition(struct mtd_info *parent, + const struct mtd_partition *part, int partno, + uint64_t cur_offset) +@@ -932,8 +948,8 @@ int add_mtd_partitions(struct mtd_info * + add_mtd_device(&slave->mtd); + mtd_partition_split(master, slave); + mtd_add_partition_attrs(slave); +- /* Look for subpartitions */ +- parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); ++ if (parts[i].types) ++ mtd_parse_part(slave, parts[i].types); + + cur_offset = slave->offset + slave->mtd.size; + } +@@ -1035,12 +1051,6 @@ static const char * const default_mtd_pa + NULL + }; + +-/* Check DT only when looking for subpartitions. */ +-static const char * const default_subpartition_types[] = { +- "ofpart", +- NULL +-}; +- + static int mtd_part_do_parse(struct mtd_part_parser *parser, + struct mtd_info *master, + struct mtd_partitions *pparts, +@@ -1111,9 +1121,7 @@ static int mtd_part_of_parse(struct mtd_ + const char *fixed = "fixed-partitions"; + int ret, err = 0; + +- np = mtd_get_of_node(master); +- if (!mtd_is_partition(master)) +- np = of_get_child_by_name(np, "partitions"); ++ np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); + of_property_for_each_string(np, "compatible", prop, compat) { + parser = mtd_part_get_compatible_parser(compat); + if (!parser) +@@ -1183,8 +1191,7 @@ int parse_mtd_partitions(struct mtd_info + } + + if (!types) +- types = mtd_is_partition(master) ? default_subpartition_types : +- default_mtd_part_types; ++ types = default_mtd_part_types; + + for ( ; *types; types++) { + /* diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-01-mtd-add-get-set-of_node-flash_node-helpers.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-01-mtd-add-get-set-of_node-flash_node-helpers.patch deleted file mode 100644 index d4ac4fc0a..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-01-mtd-add-get-set-of_node-flash_node-helpers.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 28b8b26b308e656edfa9467867d5f79212da2ec3 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:20 -0700 -Subject: [PATCH 01/11] mtd: add get/set of_node/flash_node helpers - -We are going to begin using the mtd->dev.of_node field for MTD device -nodes, so let's add helpers for it. Also, we'll be making some -conversions on spi_nor (and nand_chip eventually) too, so get that ready -with their own helpers. - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - include/linux/mtd/mtd.h | 11 +++++++++++ - include/linux/mtd/nand.h | 11 +++++++++++ - include/linux/mtd/spi-nor.h | 11 +++++++++++ - 3 files changed, 33 insertions(+) - ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -258,6 +258,17 @@ struct mtd_info { - int usecount; - }; - -+static inline void mtd_set_of_node(struct mtd_info *mtd, -+ struct device_node *np) -+{ -+ mtd->dev.of_node = np; -+} -+ -+static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd) -+{ -+ return mtd->dev.of_node; -+} -+ - int mtd_erase(struct mtd_info *mtd, struct erase_info *instr); - int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, - void **virt, resource_size_t *phys); ---- a/include/linux/mtd/nand.h -+++ b/include/linux/mtd/nand.h -@@ -719,6 +719,17 @@ struct nand_chip { - void *priv; - }; - -+static inline void nand_set_flash_node(struct nand_chip *chip, -+ struct device_node *np) -+{ -+ chip->flash_node = np; -+} -+ -+static inline struct device_node *nand_get_flash_node(struct nand_chip *chip) -+{ -+ return chip->flash_node; -+} -+ - /* - * NAND Flash Manufacturer ID Codes - */ ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -184,6 +184,17 @@ struct spi_nor { - void *priv; - }; - -+static inline void spi_nor_set_flash_node(struct spi_nor *nor, -+ struct device_node *np) -+{ -+ nor->flash_node = np; -+} -+ -+static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor) -+{ -+ return nor->flash_node; -+} -+ - /** - * spi_nor_scan() - scan the SPI NOR - * @nor: the spi_nor structure diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-02-mtd-ofpart-grab-device-tree-node-directly-from-maste.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-02-mtd-ofpart-grab-device-tree-node-directly-from-maste.patch deleted file mode 100644 index 14ad2d43b..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-02-mtd-ofpart-grab-device-tree-node-directly-from-maste.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 3b6521eab0386a4854d47b1a01947d7dc46ec98d Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:21 -0700 -Subject: [PATCH] mtd: ofpart: grab device tree node directly from master - device node - -It seems more logical to use a device node directly associated with the -MTD master device (i.e., mtd->dev.of_node field) rather than requiring -auxiliary partition parser information to be passed in by the driver in -a separate struct. - -This patch supports the mtd->dev.of_node field and deprecates the parser -data 'of_node' field - -Driver conversions may now follow. - -Additional side benefit to assigning mtd->dev.of_node rather than using -parser data: the driver core will automatically create a device -> node -symlink for us. - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - drivers/mtd/ofpart.c | 18 ++++++++++-------- - include/linux/mtd/partitions.h | 4 +++- - 2 files changed, 13 insertions(+), 9 deletions(-) - ---- a/drivers/mtd/ofpart.c -+++ b/drivers/mtd/ofpart.c -@@ -37,10 +37,11 @@ static int parse_ofpart_partitions(struc - bool dedicated = true; - - -- if (!data) -- return 0; -- -- mtd_node = data->of_node; -+ /* -+ * of_node can be provided through auxiliary parser data or (preferred) -+ * by assigning the master device node -+ */ -+ mtd_node = data && data->of_node ? data->of_node : mtd_get_of_node(master); - if (!mtd_node) - return 0; - -@@ -157,10 +158,11 @@ static int parse_ofoldpart_partitions(st - } *part; - const char *names; - -- if (!data) -- return 0; -- -- dp = data->of_node; -+ /* -+ * of_node can be provided through auxiliary parser data or (preferred) -+ * by assigning the master device node -+ */ -+ dp = data && data->of_node ? data->of_node : mtd_get_of_node(master); - if (!dp) - return 0; - ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -56,7 +56,9 @@ struct device_node; - /** - * struct mtd_part_parser_data - used to pass data to MTD partition parsers. - * @origin: for RedBoot, start address of MTD device -- * @of_node: for OF parsers, device node containing partitioning information -+ * @of_node: for OF parsers, device node containing partitioning information. -+ * This field is deprecated, as the device node should simply be -+ * assigned to the master struct device. - */ - struct mtd_part_parser_data { - unsigned long origin; diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-03-mtd-nand-spi-nor-assign-MTD-of_node.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-03-mtd-nand-spi-nor-assign-MTD-of_node.patch deleted file mode 100644 index e29aecda2..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-03-mtd-nand-spi-nor-assign-MTD-of_node.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 3e63b26bdd4069c3df2cd7ce7217a21d06801b41 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:22 -0700 -Subject: [PATCH 03/11] mtd: {nand,spi-nor}: assign MTD of_node - -We should pass along our flash DT node to the MTD layer, so it can set -up ofpart for us. - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - drivers/mtd/nand/nand_base.c | 3 +++ - drivers/mtd/spi-nor/spi-nor.c | 1 + - 2 files changed, 4 insertions(+) - ---- a/drivers/mtd/nand/nand_base.c -+++ b/drivers/mtd/nand/nand_base.c -@@ -3995,6 +3995,9 @@ int nand_scan_ident(struct mtd_info *mtd - int ret; - - if (chip->flash_node) { -+ /* MTD can automatically handle DT partitions, etc. */ -+ mtd_set_of_node(mtd, chip->flash_node); -+ - ret = nand_dt_init(mtd, chip, chip->flash_node); - if (ret) - return ret; ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1228,6 +1228,7 @@ int spi_nor_scan(struct spi_nor *nor, co - mtd->flags |= MTD_NO_ERASE; - - mtd->dev.parent = dev; -+ mtd_set_of_node(mtd, np); - nor->page_size = info->page_size; - mtd->writebufsize = nor->page_size; - diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-04-mtd-nand-convert-to-nand_set_flash_node.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-04-mtd-nand-convert-to-nand_set_flash_node.patch deleted file mode 100644 index 15a1ec37d..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-04-mtd-nand-convert-to-nand_set_flash_node.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 6375219951a66047805ed977b674615d152001ee Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:23 -0700 -Subject: [PATCH 04/11] mtd: nand: convert to nand_set_flash_node() - -Used semantic patch with 'make coccicheck MODE=patch COCCI=script.cocci': - ----8<---- -virtual patch - -@@ -struct nand_chip *c; -struct device_node *d; -@@ --(c)->flash_node = (d) -+nand_set_flash_node(c, d) ----8<---- - -Signed-off-by: Brian Norris -Reviewed-by: Marek Vasut -Reviewed-by: Boris Brezillon ---- - drivers/mtd/nand/brcmnand/brcmnand.c | 2 +- - drivers/mtd/nand/fsmc_nand.c | 2 +- - drivers/mtd/nand/sunxi_nand.c | 2 +- - drivers/mtd/nand/vf610_nfc.c | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/mtd/nand/brcmnand/brcmnand.c -+++ b/drivers/mtd/nand/brcmnand/brcmnand.c -@@ -1950,7 +1950,7 @@ static int brcmnand_init_cs(struct brcmn - mtd = &host->mtd; - chip = &host->chip; - -- chip->flash_node = dn; -+ nand_set_flash_node(chip, dn); - chip->priv = host; - mtd->priv = chip; - mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "brcmnand.%d", ---- a/drivers/mtd/nand/fsmc_nand.c -+++ b/drivers/mtd/nand/fsmc_nand.c -@@ -1033,7 +1033,7 @@ static int __init fsmc_nand_probe(struct - nand->options = pdata->options; - nand->select_chip = fsmc_select_chip; - nand->badblockbits = 7; -- nand->flash_node = np; -+ nand_set_flash_node(nand, np); - - if (pdata->width == FSMC_NAND_BW16) - nand->options |= NAND_BUSWIDTH_16; ---- a/drivers/mtd/nand/sunxi_nand.c -+++ b/drivers/mtd/nand/sunxi_nand.c -@@ -1336,7 +1336,7 @@ static int sunxi_nand_chip_init(struct d - * in the DT. - */ - nand->ecc.mode = NAND_ECC_HW; -- nand->flash_node = np; -+ nand_set_flash_node(nand, np); - nand->select_chip = sunxi_nfc_select_chip; - nand->cmd_ctrl = sunxi_nfc_cmd_ctrl; - nand->read_buf = sunxi_nfc_read_buf; ---- a/drivers/mtd/nand/vf610_nfc.c -+++ b/drivers/mtd/nand/vf610_nfc.c -@@ -714,7 +714,7 @@ static int vf610_nfc_probe(struct platfo - goto error; - } - -- chip->flash_node = child; -+ nand_set_flash_node(chip, child); - } - } - diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-05-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-05-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch deleted file mode 100644 index 4056bafcf..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-05-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 9c7d787508be6d68a6ec66de3c3466b24e820c71 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:24 -0700 -Subject: [PATCH] mtd: spi-nor: convert to spi_nor_{get, set}_flash_node() - -Used semantic patch with 'make coccicheck MODE=patch COCCI=script.cocci': - ----8<---- -virtual patch - -@@ -struct spi_nor b; -struct spi_nor *c; -expression d; -@@ -( --(b).flash_node = (d) -+spi_nor_set_flash_node(&b, d) -| --(c)->flash_node = (d) -+spi_nor_set_flash_node(c, d) -) ----8<---- - -And a manual conversion for the one use of spi_nor_get_flash_node(). - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - drivers/mtd/devices/m25p80.c | 2 +- - drivers/mtd/spi-nor/fsl-quadspi.c | 2 +- - drivers/mtd/spi-nor/nxp-spifi.c | 2 +- - drivers/mtd/spi-nor/spi-nor.c | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -221,7 +221,7 @@ static int m25p_probe(struct spi_device - nor->read_reg = m25p80_read_reg; - - nor->dev = &spi->dev; -- nor->flash_node = spi->dev.of_node; -+ spi_nor_set_flash_node(nor, spi->dev.of_node); - nor->priv = flash; - - spi_set_drvdata(spi, flash); ---- a/drivers/mtd/spi-nor/fsl-quadspi.c -+++ b/drivers/mtd/spi-nor/fsl-quadspi.c -@@ -1013,7 +1013,7 @@ static int fsl_qspi_probe(struct platfor - mtd = &nor->mtd; - - nor->dev = dev; -- nor->flash_node = np; -+ spi_nor_set_flash_node(nor, np); - nor->priv = q; - - /* fill the hooks */ ---- a/drivers/mtd/spi-nor/nxp-spifi.c -+++ b/drivers/mtd/spi-nor/nxp-spifi.c -@@ -330,7 +330,7 @@ static int nxp_spifi_setup_flash(struct - writel(ctrl, spifi->io_base + SPIFI_CTRL); - - spifi->nor.dev = spifi->dev; -- spifi->nor.flash_node = np; -+ spi_nor_set_flash_node(&spifi->nor, np); - spifi->nor.priv = spifi; - spifi->nor.read = nxp_spifi_read; - spifi->nor.write = nxp_spifi_write; ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1120,7 +1120,7 @@ int spi_nor_scan(struct spi_nor *nor, co - const struct flash_info *info = NULL; - struct device *dev = nor->dev; - struct mtd_info *mtd = &nor->mtd; -- struct device_node *np = nor->flash_node; -+ struct device_node *np = spi_nor_get_flash_node(nor); - int ret; - int i; - diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-06-mtd-nand-drop-unnecessary-partition-parser-data.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-06-mtd-nand-drop-unnecessary-partition-parser-data.patch deleted file mode 100644 index 3dc68f01d..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-06-mtd-nand-drop-unnecessary-partition-parser-data.patch +++ /dev/null @@ -1,725 +0,0 @@ -From a61ae81a1907af1987ad4c77300508327bc48b23 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:25 -0700 -Subject: [PATCH 06/11] mtd: nand: drop unnecessary partition parser data - -All of these drivers set up a parser data struct just to communicate DT -partition data. This field has been deprecated and is instead supported -by telling nand_scan_ident() about the 'flash_node'. - -This patch: - * sets chip->flash_node for those drivers that didn't already (but used - OF partitioning) - * drops the parser data - * switches to the simpler mtd_device_register() where possible, now - that we've eliminated one of the auxiliary parameters - -Now that we've assigned chip->flash_node for these drivers, we can -probably rely on nand_dt_init() to do more of the DT parsing for us, but -for now, I don't want to fiddle with each of these drivers. The parsing -is done in duplicate for now on some drivers. I don't think this should -break things. (Famous last words.) - -(Rolled in some changes by Boris Brezillon) - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - drivers/mtd/nand/atmel_nand.c | 7 +++---- - drivers/mtd/nand/brcmnand/brcmnand.c | 3 +-- - drivers/mtd/nand/davinci_nand.c | 10 +++------- - drivers/mtd/nand/fsl_elbc_nand.c | 5 ++--- - drivers/mtd/nand/fsl_ifc_nand.c | 5 ++--- - drivers/mtd/nand/fsl_upm.c | 5 ++--- - drivers/mtd/nand/fsmc_nand.c | 7 +++---- - drivers/mtd/nand/gpio.c | 8 +++----- - drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 5 ++--- - drivers/mtd/nand/hisi504_nand.c | 5 ++--- - drivers/mtd/nand/lpc32xx_mlc.c | 7 +++---- - drivers/mtd/nand/lpc32xx_slc.c | 7 +++---- - drivers/mtd/nand/mpc5121_nfc.c | 5 ++--- - drivers/mtd/nand/mxc_nand.c | 5 ++--- - drivers/mtd/nand/ndfc.c | 5 ++--- - drivers/mtd/nand/omap2.c | 6 ++---- - drivers/mtd/nand/orion_nand.c | 6 ++---- - drivers/mtd/nand/plat_nand.c | 5 ++--- - drivers/mtd/nand/pxa3xx_nand.c | 10 +++++----- - drivers/mtd/nand/sh_flctl.c | 6 ++---- - drivers/mtd/nand/socrates_nand.c | 5 ++--- - drivers/mtd/nand/sunxi_nand.c | 4 +--- - drivers/mtd/nand/vf610_nfc.c | 6 +----- - drivers/staging/mt29f_spinand/mt29f_spinand.c | 5 ++--- - 24 files changed, 54 insertions(+), 88 deletions(-) - ---- a/drivers/mtd/nand/atmel_nand.c -+++ b/drivers/mtd/nand/atmel_nand.c -@@ -2093,7 +2093,6 @@ static int atmel_nand_probe(struct platf - struct mtd_info *mtd; - struct nand_chip *nand_chip; - struct resource *mem; -- struct mtd_part_parser_data ppdata = {}; - int res, irq; - - /* Allocate memory for the device structure (and zero it) */ -@@ -2117,6 +2116,7 @@ static int atmel_nand_probe(struct platf - nand_chip = &host->nand_chip; - host->dev = &pdev->dev; - if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) { -+ nand_set_flash_node(nand_chip, pdev->dev.of_node); - /* Only when CONFIG_OF is enabled of_node can be parsed */ - res = atmel_of_init_port(host, pdev->dev.of_node); - if (res) -@@ -2259,9 +2259,8 @@ static int atmel_nand_probe(struct platf - } - - mtd->name = "atmel_nand"; -- ppdata.of_node = pdev->dev.of_node; -- res = mtd_device_parse_register(mtd, NULL, &ppdata, -- host->board.parts, host->board.num_parts); -+ res = mtd_device_register(mtd, host->board.parts, -+ host->board.num_parts); - if (!res) - return res; - ---- a/drivers/mtd/nand/brcmnand/brcmnand.c -+++ b/drivers/mtd/nand/brcmnand/brcmnand.c -@@ -1939,7 +1939,6 @@ static int brcmnand_init_cs(struct brcmn - struct nand_chip *chip; - int ret; - u16 cfg_offs; -- struct mtd_part_parser_data ppdata = { .of_node = dn }; - - ret = of_property_read_u32(dn, "reg", &host->cs); - if (ret) { -@@ -2018,7 +2017,7 @@ static int brcmnand_init_cs(struct brcmn - if (nand_scan_tail(mtd)) - return -ENXIO; - -- return mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ return mtd_device_register(mtd, NULL, 0); - } - - static void brcmnand_save_restore_cs_config(struct brcmnand_host *host, ---- a/drivers/mtd/nand/davinci_nand.c -+++ b/drivers/mtd/nand/davinci_nand.c -@@ -687,6 +687,7 @@ static int nand_davinci_probe(struct pla - - info->mtd.priv = &info->chip; - info->mtd.dev.parent = &pdev->dev; -+ nand_set_flash_node(&info->chip, pdev->dev.of_node); - - info->chip.IO_ADDR_R = vaddr; - info->chip.IO_ADDR_W = vaddr; -@@ -842,13 +843,8 @@ syndrome_done: - if (pdata->parts) - ret = mtd_device_parse_register(&info->mtd, NULL, NULL, - pdata->parts, pdata->nr_parts); -- else { -- struct mtd_part_parser_data ppdata; -- -- ppdata.of_node = pdev->dev.of_node; -- ret = mtd_device_parse_register(&info->mtd, NULL, &ppdata, -- NULL, 0); -- } -+ else -+ ret = mtd_device_register(&info->mtd, NULL, 0); - if (ret < 0) - goto err; - ---- a/drivers/mtd/nand/fsl_elbc_nand.c -+++ b/drivers/mtd/nand/fsl_elbc_nand.c -@@ -748,6 +748,7 @@ static int fsl_elbc_chip_init(struct fsl - /* Fill in fsl_elbc_mtd structure */ - priv->mtd.priv = chip; - priv->mtd.dev.parent = priv->dev; -+ nand_set_flash_node(chip, priv->dev->of_node); - - /* set timeout to maximum */ - priv->fmr = 15 << FMR_CWTO_SHIFT; -@@ -823,9 +824,7 @@ static int fsl_elbc_nand_probe(struct pl - int bank; - struct device *dev; - struct device_node *node = pdev->dev.of_node; -- struct mtd_part_parser_data ppdata; - -- ppdata.of_node = pdev->dev.of_node; - if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs) - return -ENODEV; - lbc = fsl_lbc_ctrl_dev->regs; -@@ -911,7 +910,7 @@ static int fsl_elbc_nand_probe(struct pl - - /* First look for RedBoot table or partitions on the command - * line, these take precedence over device tree information */ -- mtd_device_parse_register(&priv->mtd, part_probe_types, &ppdata, -+ mtd_device_parse_register(&priv->mtd, part_probe_types, NULL, - NULL, 0); - - printk(KERN_INFO "eLBC NAND device at 0x%llx, bank %d\n", ---- a/drivers/mtd/nand/fsl_ifc_nand.c -+++ b/drivers/mtd/nand/fsl_ifc_nand.c -@@ -883,6 +883,7 @@ static int fsl_ifc_chip_init(struct fsl_ - /* Fill in fsl_ifc_mtd structure */ - priv->mtd.priv = chip; - priv->mtd.dev.parent = priv->dev; -+ nand_set_flash_node(chip, priv->dev->of_node); - - /* fill in nand_chip structure */ - /* set up function call table */ -@@ -1030,9 +1031,7 @@ static int fsl_ifc_nand_probe(struct pla - int ret; - int bank; - struct device_node *node = dev->dev.of_node; -- struct mtd_part_parser_data ppdata; - -- ppdata.of_node = dev->dev.of_node; - if (!fsl_ifc_ctrl_dev || !fsl_ifc_ctrl_dev->regs) - return -ENODEV; - ifc = fsl_ifc_ctrl_dev->regs; -@@ -1128,7 +1127,7 @@ static int fsl_ifc_nand_probe(struct pla - - /* First look for RedBoot table or partitions on the command - * line, these take precedence over device tree information */ -- mtd_device_parse_register(&priv->mtd, part_probe_types, &ppdata, -+ mtd_device_parse_register(&priv->mtd, part_probe_types, NULL, - NULL, 0); - - dev_info(priv->dev, "IFC NAND device at 0x%llx, bank %d\n", ---- a/drivers/mtd/nand/fsl_upm.c -+++ b/drivers/mtd/nand/fsl_upm.c -@@ -159,7 +159,6 @@ static int fun_chip_init(struct fsl_upm_ - { - int ret; - struct device_node *flash_np; -- struct mtd_part_parser_data ppdata; - - fun->chip.IO_ADDR_R = fun->io_base; - fun->chip.IO_ADDR_W = fun->io_base; -@@ -182,6 +181,7 @@ static int fun_chip_init(struct fsl_upm_ - if (!flash_np) - return -ENODEV; - -+ nand_set_flash_node(&fun->chip, flash_np); - fun->mtd.name = kasprintf(GFP_KERNEL, "0x%llx.%s", (u64)io_res->start, - flash_np->name); - if (!fun->mtd.name) { -@@ -193,8 +193,7 @@ static int fun_chip_init(struct fsl_upm_ - if (ret) - goto err; - -- ppdata.of_node = flash_np; -- ret = mtd_device_parse_register(&fun->mtd, NULL, &ppdata, NULL, 0); -+ ret = mtd_device_register(&fun->mtd, NULL, 0); - err: - of_node_put(flash_np); - if (ret) ---- a/drivers/mtd/nand/fsmc_nand.c -+++ b/drivers/mtd/nand/fsmc_nand.c -@@ -926,7 +926,6 @@ static int __init fsmc_nand_probe(struct - { - struct fsmc_nand_platform_data *pdata = dev_get_platdata(&pdev->dev); - struct device_node __maybe_unused *np = pdev->dev.of_node; -- struct mtd_part_parser_data ppdata = {}; - struct fsmc_nand_data *host; - struct mtd_info *mtd; - struct nand_chip *nand; -@@ -1016,6 +1015,7 @@ static int __init fsmc_nand_probe(struct - nand = &host->nand; - mtd->priv = nand; - nand->priv = host; -+ nand_set_flash_node(nand, np); - - host->mtd.dev.parent = &pdev->dev; - nand->IO_ADDR_R = host->data_va; -@@ -1175,9 +1175,8 @@ static int __init fsmc_nand_probe(struct - * Check for partition info passed - */ - host->mtd.name = "nand"; -- ppdata.of_node = np; -- ret = mtd_device_parse_register(&host->mtd, NULL, &ppdata, -- host->partitions, host->nr_partitions); -+ ret = mtd_device_register(&host->mtd, host->partitions, -+ host->nr_partitions); - if (ret) - goto err_probe; - ---- a/drivers/mtd/nand/gpio.c -+++ b/drivers/mtd/nand/gpio.c -@@ -209,7 +209,6 @@ static int gpio_nand_probe(struct platfo - struct gpiomtd *gpiomtd; - struct nand_chip *chip; - struct resource *res; -- struct mtd_part_parser_data ppdata = {}; - int ret = 0; - - if (!pdev->dev.of_node && !dev_get_platdata(&pdev->dev)) -@@ -268,6 +267,7 @@ static int gpio_nand_probe(struct platfo - chip->dev_ready = gpio_nand_devready; - } - -+ nand_set_flash_node(chip, pdev->dev.of_node); - chip->IO_ADDR_W = chip->IO_ADDR_R; - chip->ecc.mode = NAND_ECC_SOFT; - chip->options = gpiomtd->plat.options; -@@ -291,10 +291,8 @@ static int gpio_nand_probe(struct platfo - gpiomtd->plat.adjust_parts(&gpiomtd->plat, - gpiomtd->mtd_info.size); - -- ppdata.of_node = pdev->dev.of_node; -- ret = mtd_device_parse_register(&gpiomtd->mtd_info, NULL, &ppdata, -- gpiomtd->plat.parts, -- gpiomtd->plat.num_parts); -+ ret = mtd_device_register(&gpiomtd->mtd_info, gpiomtd->plat.parts, -+ gpiomtd->plat.num_parts); - if (!ret) - return 0; - ---- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c -+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c -@@ -1888,7 +1888,6 @@ static int gpmi_nand_init(struct gpmi_na - { - struct mtd_info *mtd = &this->mtd; - struct nand_chip *chip = &this->nand; -- struct mtd_part_parser_data ppdata = {}; - int ret; - - /* init current chip */ -@@ -1901,6 +1900,7 @@ static int gpmi_nand_init(struct gpmi_na - - /* init the nand_chip{}, we don't support a 16-bit NAND Flash bus. */ - chip->priv = this; -+ nand_set_flash_node(chip, this->pdev->dev.of_node); - chip->select_chip = gpmi_select_chip; - chip->cmd_ctrl = gpmi_cmd_ctrl; - chip->dev_ready = gpmi_dev_ready; -@@ -1954,8 +1954,7 @@ static int gpmi_nand_init(struct gpmi_na - if (ret) - goto err_out; - -- ppdata.of_node = this->pdev->dev.of_node; -- ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ ret = mtd_device_register(mtd, NULL, 0); - if (ret) - goto err_out; - return 0; ---- a/drivers/mtd/nand/hisi504_nand.c -+++ b/drivers/mtd/nand/hisi504_nand.c -@@ -704,7 +704,6 @@ static int hisi_nfc_probe(struct platfor - struct mtd_info *mtd; - struct resource *res; - struct device_node *np = dev->of_node; -- struct mtd_part_parser_data ppdata; - - host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); - if (!host) -@@ -742,6 +741,7 @@ static int hisi_nfc_probe(struct platfor - mtd->dev.parent = &pdev->dev; - - chip->priv = host; -+ nand_set_flash_node(chip, np); - chip->cmdfunc = hisi_nfc_cmdfunc; - chip->select_chip = hisi_nfc_select_chip; - chip->read_byte = hisi_nfc_read_byte; -@@ -805,8 +805,7 @@ static int hisi_nfc_probe(struct platfor - goto err_res; - } - -- ppdata.of_node = np; -- ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ ret = mtd_device_register(mtd, NULL, 0); - if (ret) { - dev_err(dev, "Err MTD partition=%d\n", ret); - goto err_mtd; ---- a/drivers/mtd/nand/lpc32xx_mlc.c -+++ b/drivers/mtd/nand/lpc32xx_mlc.c -@@ -647,7 +647,6 @@ static int lpc32xx_nand_probe(struct pla - struct nand_chip *nand_chip; - struct resource *rc; - int res; -- struct mtd_part_parser_data ppdata = {}; - - /* Allocate memory for the device structure (and zero it) */ - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); -@@ -682,6 +681,7 @@ static int lpc32xx_nand_probe(struct pla - host->pdata = dev_get_platdata(&pdev->dev); - - nand_chip->priv = host; /* link the private data structures */ -+ nand_set_flash_node(nand_chip, pdev->dev.of_node); - mtd->priv = nand_chip; - mtd->dev.parent = &pdev->dev; - -@@ -786,9 +786,8 @@ static int lpc32xx_nand_probe(struct pla - - mtd->name = DRV_NAME; - -- ppdata.of_node = pdev->dev.of_node; -- res = mtd_device_parse_register(mtd, NULL, &ppdata, host->ncfg->parts, -- host->ncfg->num_parts); -+ res = mtd_device_register(mtd, host->ncfg->parts, -+ host->ncfg->num_parts); - if (!res) - return res; - ---- a/drivers/mtd/nand/lpc32xx_slc.c -+++ b/drivers/mtd/nand/lpc32xx_slc.c -@@ -763,7 +763,6 @@ static int lpc32xx_nand_probe(struct pla - struct mtd_info *mtd; - struct nand_chip *chip; - struct resource *rc; -- struct mtd_part_parser_data ppdata = {}; - int res; - - rc = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -803,6 +802,7 @@ static int lpc32xx_nand_probe(struct pla - mtd = &host->mtd; - chip = &host->nand_chip; - chip->priv = host; -+ nand_set_flash_node(chip, pdev->dev.of_node); - mtd->priv = chip; - mtd->owner = THIS_MODULE; - mtd->dev.parent = &pdev->dev; -@@ -908,9 +908,8 @@ static int lpc32xx_nand_probe(struct pla - } - - mtd->name = "nxp_lpc3220_slc"; -- ppdata.of_node = pdev->dev.of_node; -- res = mtd_device_parse_register(mtd, NULL, &ppdata, host->ncfg->parts, -- host->ncfg->num_parts); -+ res = mtd_device_register(mtd, host->ncfg->parts, -+ host->ncfg->num_parts); - if (!res) - return res; - ---- a/drivers/mtd/nand/mpc5121_nfc.c -+++ b/drivers/mtd/nand/mpc5121_nfc.c -@@ -639,7 +639,6 @@ static int mpc5121_nfc_probe(struct plat - int resettime = 0; - int retval = 0; - int rev, len; -- struct mtd_part_parser_data ppdata; - - /* - * Check SoC revision. This driver supports only NFC -@@ -661,6 +660,7 @@ static int mpc5121_nfc_probe(struct plat - mtd->priv = chip; - mtd->dev.parent = dev; - chip->priv = prv; -+ nand_set_flash_node(chip, dn); - prv->dev = dev; - - /* Read NFC configuration from Reset Config Word */ -@@ -703,7 +703,6 @@ static int mpc5121_nfc_probe(struct plat - } - - mtd->name = "MPC5121 NAND"; -- ppdata.of_node = dn; - chip->dev_ready = mpc5121_nfc_dev_ready; - chip->cmdfunc = mpc5121_nfc_command; - chip->read_byte = mpc5121_nfc_read_byte; -@@ -815,7 +814,7 @@ static int mpc5121_nfc_probe(struct plat - dev_set_drvdata(dev, mtd); - - /* Register device in MTD */ -- retval = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ retval = mtd_device_register(mtd, NULL, 0); - if (retval) { - dev_err(dev, "Error adding MTD device!\n"); - goto error; ---- a/drivers/mtd/nand/mxc_nand.c -+++ b/drivers/mtd/nand/mxc_nand.c -@@ -1524,6 +1524,7 @@ static int mxcnd_probe(struct platform_d - this->chip_delay = 5; - - this->priv = host; -+ nand_set_flash_node(this, pdev->dev.of_node), - this->dev_ready = mxc_nand_dev_ready; - this->cmdfunc = mxc_nand_command; - this->read_byte = mxc_nand_read_byte; -@@ -1683,9 +1684,7 @@ static int mxcnd_probe(struct platform_d - - /* Register the partitions */ - mtd_device_parse_register(mtd, part_probes, -- &(struct mtd_part_parser_data){ -- .of_node = pdev->dev.of_node, -- }, -+ NULL, - host->pdata.parts, - host->pdata.nr_parts); - ---- a/drivers/mtd/nand/ndfc.c -+++ b/drivers/mtd/nand/ndfc.c -@@ -147,7 +147,6 @@ static int ndfc_chip_init(struct ndfc_co - { - struct device_node *flash_np; - struct nand_chip *chip = &ndfc->chip; -- struct mtd_part_parser_data ppdata; - int ret; - - chip->IO_ADDR_R = ndfc->ndfcbase + NDFC_DATA; -@@ -174,8 +173,8 @@ static int ndfc_chip_init(struct ndfc_co - flash_np = of_get_next_child(node, NULL); - if (!flash_np) - return -ENODEV; -+ nand_set_flash_node(chip, flash_np); - -- ppdata.of_node = flash_np; - ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", - dev_name(&ndfc->ofdev->dev), flash_np->name); - if (!ndfc->mtd.name) { -@@ -187,7 +186,7 @@ static int ndfc_chip_init(struct ndfc_co - if (ret) - goto err; - -- ret = mtd_device_parse_register(&ndfc->mtd, NULL, &ppdata, NULL, 0); -+ ret = mtd_device_register(&ndfc->mtd, NULL, 0); - - err: - of_node_put(flash_np); ---- a/drivers/mtd/nand/omap2.c -+++ b/drivers/mtd/nand/omap2.c -@@ -1663,7 +1663,6 @@ static int omap_nand_probe(struct platfo - unsigned sig; - unsigned oob_index; - struct resource *res; -- struct mtd_part_parser_data ppdata = {}; - - pdata = dev_get_platdata(&pdev->dev); - if (pdata == NULL) { -@@ -1688,6 +1687,7 @@ static int omap_nand_probe(struct platfo - mtd->dev.parent = &pdev->dev; - nand_chip = &info->nand; - nand_chip->ecc.priv = NULL; -+ nand_set_flash_node(nand_chip, pdata->of_node); - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - nand_chip->IO_ADDR_R = devm_ioremap_resource(&pdev->dev, res); -@@ -2037,9 +2037,7 @@ scan_tail: - goto return_error; - } - -- ppdata.of_node = pdata->of_node; -- mtd_device_parse_register(mtd, NULL, &ppdata, pdata->parts, -- pdata->nr_parts); -+ mtd_device_register(mtd, pdata->parts, pdata->nr_parts); - - platform_set_drvdata(pdev, mtd); - ---- a/drivers/mtd/nand/orion_nand.c -+++ b/drivers/mtd/nand/orion_nand.c -@@ -76,7 +76,6 @@ static void orion_nand_read_buf(struct m - static int __init orion_nand_probe(struct platform_device *pdev) - { - struct mtd_info *mtd; -- struct mtd_part_parser_data ppdata = {}; - struct nand_chip *nc; - struct orion_nand_data *board; - struct resource *res; -@@ -127,6 +126,7 @@ static int __init orion_nand_probe(struc - mtd->dev.parent = &pdev->dev; - - nc->priv = board; -+ nand_set_flash_node(nc, pdev->dev.of_node); - nc->IO_ADDR_R = nc->IO_ADDR_W = io_base; - nc->cmd_ctrl = orion_nand_cmd_ctrl; - nc->read_buf = orion_nand_read_buf; -@@ -161,9 +161,7 @@ static int __init orion_nand_probe(struc - } - - mtd->name = "orion_nand"; -- ppdata.of_node = pdev->dev.of_node; -- ret = mtd_device_parse_register(mtd, NULL, &ppdata, -- board->parts, board->nr_parts); -+ ret = mtd_device_register(mtd, board->parts, board->nr_parts); - if (ret) { - nand_release(mtd); - goto no_dev; ---- a/drivers/mtd/nand/plat_nand.c -+++ b/drivers/mtd/nand/plat_nand.c -@@ -30,7 +30,6 @@ struct plat_nand_data { - static int plat_nand_probe(struct platform_device *pdev) - { - struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev); -- struct mtd_part_parser_data ppdata; - struct plat_nand_data *data; - struct resource *res; - const char **part_types; -@@ -58,6 +57,7 @@ static int plat_nand_probe(struct platfo - return PTR_ERR(data->io_base); - - data->chip.priv = &data; -+ nand_set_flash_node(&data->chip, pdev->dev.of_node); - data->mtd.priv = &data->chip; - data->mtd.dev.parent = &pdev->dev; - -@@ -105,8 +105,7 @@ static int plat_nand_probe(struct platfo - - part_types = pdata->chip.part_probe_types; - -- ppdata.of_node = pdev->dev.of_node; -- err = mtd_device_parse_register(&data->mtd, part_types, &ppdata, -+ err = mtd_device_parse_register(&data->mtd, part_types, NULL, - pdata->chip.partitions, - pdata->chip.nr_partitions); - ---- a/drivers/mtd/nand/pxa3xx_nand.c -+++ b/drivers/mtd/nand/pxa3xx_nand.c -@@ -1697,6 +1697,7 @@ KEEP_CONFIG: - - static int alloc_nand_resource(struct platform_device *pdev) - { -+ struct device_node *np = pdev->dev.of_node; - struct pxa3xx_nand_platform_data *pdata; - struct pxa3xx_nand_info *info; - struct pxa3xx_nand_host *host; -@@ -1725,6 +1726,8 @@ static int alloc_nand_resource(struct pl - host->info_data = info; - mtd->priv = host; - mtd->dev.parent = &pdev->dev; -+ /* FIXME: all chips use the same device tree partitions */ -+ nand_set_flash_node(chip, np); - - chip->ecc.read_page = pxa3xx_nand_read_page_hwecc; - chip->ecc.write_page = pxa3xx_nand_write_page_hwecc; -@@ -1886,7 +1889,6 @@ static int pxa3xx_nand_probe_dt(struct p - static int pxa3xx_nand_probe(struct platform_device *pdev) - { - struct pxa3xx_nand_platform_data *pdata; -- struct mtd_part_parser_data ppdata = {}; - struct pxa3xx_nand_info *info; - int ret, cs, probe_success, dma_available; - -@@ -1933,10 +1935,8 @@ static int pxa3xx_nand_probe(struct plat - continue; - } - -- ppdata.of_node = pdev->dev.of_node; -- ret = mtd_device_parse_register(mtd, NULL, -- &ppdata, pdata->parts[cs], -- pdata->nr_parts[cs]); -+ ret = mtd_device_register(mtd, pdata->parts[cs], -+ pdata->nr_parts[cs]); - if (!ret) - probe_success = 1; - } ---- a/drivers/mtd/nand/sh_flctl.c -+++ b/drivers/mtd/nand/sh_flctl.c -@@ -1086,7 +1086,6 @@ static int flctl_probe(struct platform_d - struct sh_flctl_platform_data *pdata; - int ret; - int irq; -- struct mtd_part_parser_data ppdata = {}; - - flctl = devm_kzalloc(&pdev->dev, sizeof(struct sh_flctl), GFP_KERNEL); - if (!flctl) -@@ -1124,6 +1123,7 @@ static int flctl_probe(struct platform_d - platform_set_drvdata(pdev, flctl); - flctl_mtd = &flctl->mtd; - nand = &flctl->chip; -+ nand_set_flash_node(nand, pdev->dev.of_node); - flctl_mtd->priv = nand; - flctl_mtd->dev.parent = &pdev->dev; - flctl->pdev = pdev; -@@ -1164,9 +1164,7 @@ static int flctl_probe(struct platform_d - if (ret) - goto err_chip; - -- ppdata.of_node = pdev->dev.of_node; -- ret = mtd_device_parse_register(flctl_mtd, NULL, &ppdata, pdata->parts, -- pdata->nr_parts); -+ ret = mtd_device_register(flctl_mtd, pdata->parts, pdata->nr_parts); - - return 0; - ---- a/drivers/mtd/nand/socrates_nand.c -+++ b/drivers/mtd/nand/socrates_nand.c -@@ -147,7 +147,6 @@ static int socrates_nand_probe(struct pl - struct mtd_info *mtd; - struct nand_chip *nand_chip; - int res; -- struct mtd_part_parser_data ppdata; - - /* Allocate memory for the device structure (and zero it) */ - host = devm_kzalloc(&ofdev->dev, sizeof(*host), GFP_KERNEL); -@@ -165,10 +164,10 @@ static int socrates_nand_probe(struct pl - host->dev = &ofdev->dev; - - nand_chip->priv = host; /* link the private data structures */ -+ nand_set_flash_node(nand_chip, ofdev->dev.of_node); - mtd->priv = nand_chip; - mtd->name = "socrates_nand"; - mtd->dev.parent = &ofdev->dev; -- ppdata.of_node = ofdev->dev.of_node; - - /*should never be accessed directly */ - nand_chip->IO_ADDR_R = (void *)0xdeadbeef; -@@ -200,7 +199,7 @@ static int socrates_nand_probe(struct pl - goto out; - } - -- res = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ res = mtd_device_register(mtd, NULL, 0); - if (!res) - return res; - ---- a/drivers/mtd/nand/sunxi_nand.c -+++ b/drivers/mtd/nand/sunxi_nand.c -@@ -1238,7 +1238,6 @@ static int sunxi_nand_chip_init(struct d - { - const struct nand_sdr_timings *timings; - struct sunxi_nand_chip *chip; -- struct mtd_part_parser_data ppdata; - struct mtd_info *mtd; - struct nand_chip *nand; - int nsels; -@@ -1372,8 +1371,7 @@ static int sunxi_nand_chip_init(struct d - return ret; - } - -- ppdata.of_node = np; -- ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ ret = mtd_device_register(mtd, NULL, 0); - if (ret) { - dev_err(dev, "failed to register mtd device: %d\n", ret); - nand_release(mtd); ---- a/drivers/mtd/nand/vf610_nfc.c -+++ b/drivers/mtd/nand/vf610_nfc.c -@@ -811,11 +811,7 @@ static int vf610_nfc_probe(struct platfo - platform_set_drvdata(pdev, mtd); - - /* Register device in MTD */ -- return mtd_device_parse_register(mtd, NULL, -- &(struct mtd_part_parser_data){ -- .of_node = chip->flash_node, -- }, -- NULL, 0); -+ return mtd_device_register(mtd, NULL, 0); - - error: - of_node_put(chip->flash_node); ---- a/drivers/staging/mt29f_spinand/mt29f_spinand.c -+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c -@@ -850,7 +850,6 @@ static int spinand_probe(struct spi_devi - struct nand_chip *chip; - struct spinand_info *info; - struct spinand_state *state; -- struct mtd_part_parser_data ppdata; - - info = devm_kzalloc(&spi_nand->dev, sizeof(struct spinand_info), - GFP_KERNEL); -@@ -894,6 +893,7 @@ static int spinand_probe(struct spi_devi - pr_info("%s: disable ecc failed!\n", __func__); - #endif - -+ nand_set_flash_node(chip, spi_nand->dev.of_node); - chip->priv = info; - chip->read_buf = spinand_read_buf; - chip->write_buf = spinand_write_buf; -@@ -916,8 +916,7 @@ static int spinand_probe(struct spi_devi - if (nand_scan(mtd, 1)) - return -ENXIO; - -- ppdata.of_node = spi_nand->dev.of_node; -- return mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ return mtd_device_register(mtd, NULL, 0); - } - - /* diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-07-mtd-spi-nor-drop-unnecessary-partition-parser-data.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-07-mtd-spi-nor-drop-unnecessary-partition-parser-data.patch deleted file mode 100644 index dafde1660..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-07-mtd-spi-nor-drop-unnecessary-partition-parser-data.patch +++ /dev/null @@ -1,83 +0,0 @@ -From df02c885f8697546da41665f28dde5e30ce99674 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:26 -0700 -Subject: [PATCH] mtd: spi-nor: drop unnecessary partition parser data - -Now that the SPI-NOR/MTD framework pass the 'flash_node' through to the -partition parsing code, we don't have to do it ourselves. - -Also convert to mtd_device_register(), since we don't need the 2nd and -3rd parameters anymore. - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - drivers/mtd/devices/m25p80.c | 8 ++------ - drivers/mtd/spi-nor/fsl-quadspi.c | 4 +--- - drivers/mtd/spi-nor/nxp-spifi.c | 4 +--- - 3 files changed, 4 insertions(+), 12 deletions(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -197,7 +197,6 @@ static int m25p80_erase(struct spi_nor * - */ - static int m25p_probe(struct spi_device *spi) - { -- struct mtd_part_parser_data ppdata; - struct flash_platform_data *data; - struct m25p *flash; - struct spi_nor *nor; -@@ -249,11 +248,8 @@ static int m25p_probe(struct spi_device - if (ret) - return ret; - -- ppdata.of_node = spi->dev.of_node; -- -- return mtd_device_parse_register(&nor->mtd, NULL, &ppdata, -- data ? data->parts : NULL, -- data ? data->nr_parts : 0); -+ return mtd_device_register(&nor->mtd, data ? data->parts : NULL, -+ data ? data->nr_parts : 0); - } - - ---- a/drivers/mtd/spi-nor/fsl-quadspi.c -+++ b/drivers/mtd/spi-nor/fsl-quadspi.c -@@ -927,7 +927,6 @@ static void fsl_qspi_unprep(struct spi_n - static int fsl_qspi_probe(struct platform_device *pdev) - { - struct device_node *np = pdev->dev.of_node; -- struct mtd_part_parser_data ppdata; - struct device *dev = &pdev->dev; - struct fsl_qspi *q; - struct resource *res; -@@ -1038,8 +1037,7 @@ static int fsl_qspi_probe(struct platfor - if (ret) - goto mutex_failed; - -- ppdata.of_node = np; -- ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); -+ ret = mtd_device_register(mtd, NULL, 0); - if (ret) - goto mutex_failed; - ---- a/drivers/mtd/spi-nor/nxp-spifi.c -+++ b/drivers/mtd/spi-nor/nxp-spifi.c -@@ -271,7 +271,6 @@ static void nxp_spifi_dummy_id_read(stru - static int nxp_spifi_setup_flash(struct nxp_spifi *spifi, - struct device_node *np) - { -- struct mtd_part_parser_data ppdata; - enum read_mode flash_read; - u32 ctrl, property; - u16 mode = 0; -@@ -361,8 +360,7 @@ static int nxp_spifi_setup_flash(struct - return ret; - } - -- ppdata.of_node = np; -- ret = mtd_device_parse_register(&spifi->nor.mtd, NULL, &ppdata, NULL, 0); -+ ret = mtd_device_register(&spifi->nor.mtd, NULL, 0); - if (ret) { - dev_err(spifi->dev, "mtd device parse failed\n"); - return ret; diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-08-mtd-spi-nor-drop-flash_node-field.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-08-mtd-spi-nor-drop-flash_node-field.patch deleted file mode 100644 index 1dd32257d..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-08-mtd-spi-nor-drop-flash_node-field.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 30069af7348b56eb8c5e1dda7788a531c5f24ca2 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:27 -0700 -Subject: [PATCH 08/11] mtd: spi-nor: drop flash_node field - -We can just alias to the MTD of_node. - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - drivers/mtd/spi-nor/spi-nor.c | 1 - - include/linux/mtd/spi-nor.h | 6 ++---- - 2 files changed, 2 insertions(+), 5 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1228,7 +1228,6 @@ int spi_nor_scan(struct spi_nor *nor, co - mtd->flags |= MTD_NO_ERASE; - - mtd->dev.parent = dev; -- mtd_set_of_node(mtd, np); - nor->page_size = info->page_size; - mtd->writebufsize = nor->page_size; - ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -123,7 +123,6 @@ enum spi_nor_option_flags { - * @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 -@@ -154,7 +153,6 @@ struct spi_nor { - struct mtd_info mtd; - struct mutex lock; - struct device *dev; -- struct device_node *flash_node; - u32 page_size; - u8 addr_width; - u8 erase_opcode; -@@ -187,12 +185,12 @@ struct spi_nor { - static inline void spi_nor_set_flash_node(struct spi_nor *nor, - struct device_node *np) - { -- nor->flash_node = np; -+ mtd_set_of_node(&nor->mtd, np); - } - - static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor) - { -- return nor->flash_node; -+ return mtd_get_of_node(&nor->mtd); - } - - /** diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-09-mtd-drop-unnecessary-partition-parser-data.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-09-mtd-drop-unnecessary-partition-parser-data.patch deleted file mode 100644 index 5bd6c8c57..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-09-mtd-drop-unnecessary-partition-parser-data.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 004b5e6031f4e9fd90d565fb213b74cd06d03718 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:28 -0700 -Subject: [PATCH] mtd: drop unnecessary partition parser data - -We should assign the MTD dev.of_node instead of the parser data field. -This gets us the equivalent partition parser behavior with fewer special -fields and parameter passing. - -Also convert several of these to mtd_device_register(), since we don't -need the 2nd and 3rd parameters anymore. - -Signed-off-by: Brian Norris -Reviewed-by: Marek Vasut -Reviewed-by: Boris Brezillon ---- - drivers/mtd/devices/mtd_dataflash.c | 5 ++--- - drivers/mtd/devices/spear_smi.c | 6 ++---- - drivers/mtd/devices/st_spi_fsm.c | 5 ++--- - drivers/mtd/maps/lantiq-flash.c | 5 ++--- - drivers/mtd/maps/physmap_of.c | 5 ++--- - drivers/mtd/onenand/omap2.c | 8 +++----- - 6 files changed, 13 insertions(+), 21 deletions(-) - ---- a/drivers/mtd/devices/mtd_dataflash.c -+++ b/drivers/mtd/devices/mtd_dataflash.c -@@ -624,7 +624,6 @@ static int add_dataflash_otp(struct spi_ - { - struct dataflash *priv; - struct mtd_info *device; -- struct mtd_part_parser_data ppdata; - struct flash_platform_data *pdata = dev_get_platdata(&spi->dev); - char *otp_tag = ""; - int err = 0; -@@ -656,6 +655,7 @@ static int add_dataflash_otp(struct spi_ - device->priv = priv; - - device->dev.parent = &spi->dev; -+ mtd_set_of_node(device, spi->dev.of_node); - - if (revision >= 'c') - otp_tag = otp_setup(device, revision); -@@ -665,8 +665,7 @@ static int add_dataflash_otp(struct spi_ - pagesize, otp_tag); - spi_set_drvdata(spi, priv); - -- ppdata.of_node = spi->dev.of_node; -- err = mtd_device_parse_register(device, NULL, &ppdata, -+ err = mtd_device_register(device, - pdata ? pdata->parts : NULL, - pdata ? pdata->nr_parts : 0); - ---- a/drivers/mtd/devices/spear_smi.c -+++ b/drivers/mtd/devices/spear_smi.c -@@ -810,7 +810,6 @@ static int spear_smi_setup_banks(struct - u32 bank, struct device_node *np) - { - struct spear_smi *dev = platform_get_drvdata(pdev); -- struct mtd_part_parser_data ppdata = {}; - struct spear_smi_flash_info *flash_info; - struct spear_smi_plat_data *pdata; - struct spear_snor_flash *flash; -@@ -855,6 +854,7 @@ static int spear_smi_setup_banks(struct - flash->mtd.name = flash_devices[flash_index].name; - - flash->mtd.dev.parent = &pdev->dev; -+ mtd_set_of_node(&flash->mtd, np); - flash->mtd.type = MTD_NORFLASH; - flash->mtd.writesize = 1; - flash->mtd.flags = MTD_CAP_NORFLASH; -@@ -881,10 +881,8 @@ static int spear_smi_setup_banks(struct - count = flash_info->nr_partitions; - } - #endif -- ppdata.of_node = np; - -- ret = mtd_device_parse_register(&flash->mtd, NULL, &ppdata, parts, -- count); -+ ret = mtd_device_register(&flash->mtd, parts, count); - if (ret) { - dev_err(&dev->pdev->dev, "Err MTD partition=%d\n", ret); - return ret; ---- a/drivers/mtd/devices/st_spi_fsm.c -+++ b/drivers/mtd/devices/st_spi_fsm.c -@@ -2025,7 +2025,6 @@ boot_device_fail: - static int stfsm_probe(struct platform_device *pdev) - { - struct device_node *np = pdev->dev.of_node; -- struct mtd_part_parser_data ppdata; - struct flash_info *info; - struct resource *res; - struct stfsm *fsm; -@@ -2035,7 +2034,6 @@ static int stfsm_probe(struct platform_d - dev_err(&pdev->dev, "No DT found\n"); - return -EINVAL; - } -- ppdata.of_node = np; - - fsm = devm_kzalloc(&pdev->dev, sizeof(*fsm), GFP_KERNEL); - if (!fsm) -@@ -2106,6 +2104,7 @@ static int stfsm_probe(struct platform_d - - fsm->mtd.name = info->name; - fsm->mtd.dev.parent = &pdev->dev; -+ mtd_set_of_node(&fsm->mtd, np); - fsm->mtd.type = MTD_NORFLASH; - fsm->mtd.writesize = 4; - fsm->mtd.writebufsize = fsm->mtd.writesize; -@@ -2124,7 +2123,7 @@ static int stfsm_probe(struct platform_d - (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20), - fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); - -- return mtd_device_parse_register(&fsm->mtd, NULL, &ppdata, NULL, 0); -+ return mtd_device_register(&fsm->mtd, NULL, 0); - } - - static int stfsm_remove(struct platform_device *pdev) ---- a/drivers/mtd/maps/lantiq-flash.c -+++ b/drivers/mtd/maps/lantiq-flash.c -@@ -110,7 +110,6 @@ ltq_copy_to(struct map_info *map, unsign - static int - ltq_mtd_probe(struct platform_device *pdev) - { -- struct mtd_part_parser_data ppdata; - struct ltq_mtd *ltq_mtd; - struct cfi_private *cfi; - int err; -@@ -161,13 +160,13 @@ ltq_mtd_probe(struct platform_device *pd - } - - ltq_mtd->mtd->dev.parent = &pdev->dev; -+ mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); - - cfi = ltq_mtd->map->fldrv_priv; - cfi->addr_unlock1 ^= 1; - cfi->addr_unlock2 ^= 1; - -- ppdata.of_node = pdev->dev.of_node; -- err = mtd_device_parse_register(ltq_mtd->mtd, NULL, &ppdata, NULL, 0); -+ err = mtd_device_register(ltq_mtd->mtd, NULL, 0); - if (err) { - dev_err(&pdev->dev, "failed to add partitions\n"); - goto err_destroy; ---- a/drivers/mtd/maps/physmap_of.c -+++ b/drivers/mtd/maps/physmap_of.c -@@ -128,7 +128,6 @@ static int of_flash_probe(struct platfor - int reg_tuple_size; - struct mtd_info **mtd_list = NULL; - resource_size_t res_size; -- struct mtd_part_parser_data ppdata; - bool map_indirect; - const char *mtd_name = NULL; - -@@ -272,8 +271,8 @@ static int of_flash_probe(struct platfor - if (err) - goto err_out; - -- ppdata.of_node = dp; -- mtd_device_parse_register(info->cmtd, part_probe_types_def, &ppdata, -+ mtd_set_of_node(info->cmtd, dp); -+ mtd_device_parse_register(info->cmtd, part_probe_types_def, NULL, - NULL, 0); - - kfree(mtd_list); ---- a/drivers/mtd/onenand/omap2.c -+++ b/drivers/mtd/onenand/omap2.c -@@ -614,7 +614,6 @@ static int omap2_onenand_probe(struct pl - struct onenand_chip *this; - int r; - struct resource *res; -- struct mtd_part_parser_data ppdata = {}; - - pdata = dev_get_platdata(&pdev->dev); - if (pdata == NULL) { -@@ -713,6 +712,7 @@ static int omap2_onenand_probe(struct pl - c->mtd.priv = &c->onenand; - - c->mtd.dev.parent = &pdev->dev; -+ mtd_set_of_node(&c->mtd, pdata->of_node); - - this = &c->onenand; - if (c->dma_channel >= 0) { -@@ -743,10 +743,8 @@ static int omap2_onenand_probe(struct pl - if ((r = onenand_scan(&c->mtd, 1)) < 0) - goto err_release_regulator; - -- ppdata.of_node = pdata->of_node; -- r = mtd_device_parse_register(&c->mtd, NULL, &ppdata, -- pdata ? pdata->parts : NULL, -- pdata ? pdata->nr_parts : 0); -+ r = mtd_device_register(&c->mtd, pdata ? pdata->parts : NULL, -+ pdata ? pdata->nr_parts : 0); - if (r) - goto err_release_onenand; - diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-10-mtd-ofpart-drop-of_node-partition-parser-data.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-10-mtd-ofpart-drop-of_node-partition-parser-data.patch deleted file mode 100644 index 4c9b11b34..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-10-mtd-ofpart-drop-of_node-partition-parser-data.patch +++ /dev/null @@ -1,61 +0,0 @@ -From e270bca531b40cd0a143176eb093d173b9c6f418 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:29 -0700 -Subject: [PATCH 10/11] mtd: ofpart: drop 'of_node' partition parser data - -This field is no longer used anywhere, as it is superseded by -mtd->dev.of_node. - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - drivers/mtd/ofpart.c | 14 ++++---------- - include/linux/mtd/partitions.h | 4 ---- - 2 files changed, 4 insertions(+), 14 deletions(-) - ---- a/drivers/mtd/ofpart.c -+++ b/drivers/mtd/ofpart.c -@@ -37,11 +37,8 @@ static int parse_ofpart_partitions(struc - bool dedicated = true; - - -- /* -- * of_node can be provided through auxiliary parser data or (preferred) -- * by assigning the master device node -- */ -- mtd_node = data && data->of_node ? data->of_node : mtd_get_of_node(master); -+ /* Pull of_node from the master device node */ -+ mtd_node = mtd_get_of_node(master); - if (!mtd_node) - return 0; - -@@ -158,11 +155,8 @@ static int parse_ofoldpart_partitions(st - } *part; - const char *names; - -- /* -- * of_node can be provided through auxiliary parser data or (preferred) -- * by assigning the master device node -- */ -- dp = data && data->of_node ? data->of_node : mtd_get_of_node(master); -+ /* Pull of_node from the master device node */ -+ dp = mtd_get_of_node(master); - if (!dp) - return 0; - ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -56,13 +56,9 @@ struct device_node; - /** - * struct mtd_part_parser_data - used to pass data to MTD partition parsers. - * @origin: for RedBoot, start address of MTD device -- * @of_node: for OF parsers, device node containing partitioning information. -- * This field is deprecated, as the device node should simply be -- * assigned to the master struct device. - */ - struct mtd_part_parser_data { - unsigned long origin; -- struct device_node *of_node; - }; - - diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-11-mtd-physmap_of-assign-parent-for-the-concatenated-MT.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-11-mtd-physmap_of-assign-parent-for-the-concatenated-MT.patch deleted file mode 100644 index 90eb6dac4..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-11-mtd-physmap_of-assign-parent-for-the-concatenated-MT.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 8361a9b8cb6a9c71b7cf884a87b2532d8367c185 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 30 Oct 2015 20:33:30 -0700 -Subject: [PATCH 11/11] mtd: physmap_of: assign parent for the concatenated MTD - -If there is more than one map region for this device, then the -concatenated MTD will not have a parent device assigned to it -- only -the sub-devices (which are not actually registered with the framework) -will have their parents assigned. Let's assign the concatenated device -correctly. - -Signed-off-by: Brian Norris -Reviewed-by: Boris Brezillon ---- - drivers/mtd/maps/physmap_of.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/maps/physmap_of.c -+++ b/drivers/mtd/maps/physmap_of.c -@@ -271,6 +271,7 @@ static int of_flash_probe(struct platfor - if (err) - goto err_out; - -+ info->cmtd->dev.parent = &dev->dev; - mtd_set_of_node(info->cmtd, dp); - mtd_device_parse_register(info->cmtd, part_probe_types_def, NULL, - NULL, 0); diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-20-spi-expose-master-transfer-size-limitation.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-20-spi-expose-master-transfer-size-limitation.patch deleted file mode 100644 index 21e037ce7..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-20-spi-expose-master-transfer-size-limitation.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 4acad4aae10d1fa79a075b38b5c73772c44f576c Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Wed, 2 Dec 2015 10:38:21 +0000 -Subject: [PATCH] spi: expose master transfer size limitation. - -On some SPI controllers it is not feasible to transfer arbitrary amount -of data at once. - -When the limit on transfer size is a few kilobytes at least it makes -sense to use the SPI hardware rather than reverting to gpio driver. - -The protocol drivers need a way to check that they do not sent overly -long messages, though. - -Signed-off-by: Michal Suchanek -Signed-off-by: Mark Brown ---- - include/linux/spi/spi.h | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -428,6 +428,12 @@ struct spi_master { - #define SPI_MASTER_MUST_RX BIT(3) /* requires rx */ - #define SPI_MASTER_MUST_TX BIT(4) /* requires tx */ - -+ /* -+ * on some hardware transfer size may be constrained -+ * the limit may depend on device transfer settings -+ */ -+ size_t (*max_transfer_size)(struct spi_device *spi); -+ - /* lock and mutex for SPI bus locking */ - spinlock_t bus_lock_spinlock; - struct mutex bus_lock_mutex; -@@ -837,6 +843,15 @@ extern int spi_async(struct spi_device * - extern int spi_async_locked(struct spi_device *spi, - struct spi_message *message); - -+static inline size_t -+spi_max_transfer_size(struct spi_device *spi) -+{ -+ struct spi_master *master = spi->master; -+ if (!master->max_transfer_size) -+ return SIZE_MAX; -+ return master->max_transfer_size(spi); -+} -+ - /*---------------------------------------------------------------------------*/ - - /* All these synchronous SPI transfer routines are utilities layered diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-30-gpio-add-a-data-pointer-to-gpio_chip.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-30-gpio-add-a-data-pointer-to-gpio_chip.patch deleted file mode 100644 index 7a44a7cc6..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-30-gpio-add-a-data-pointer-to-gpio_chip.patch +++ /dev/null @@ -1,121 +0,0 @@ -From b08ea35a3296ee25c4cb53a977b752266dafa2c2 Mon Sep 17 00:00:00 2001 -From: Linus Walleij -Date: Thu, 3 Dec 2015 15:14:13 +0100 -Subject: [PATCH] gpio: add a data pointer to gpio_chip - -This adds a void * pointer to gpio_chip so that driver can -assign and retrieve some states. This is done to get rid of -container_of() calls for gpio_chips embedded inside state -containers, so we can remove the need to have the gpio_chip -or later (planned) struct gpio_device be dynamically allocated -at registration time, so that its struct device can be properly -reference counted and not bound to its parent device (e.g. -a platform_device) but instead live on after unregistration -if it is opened by e.g. a char device or sysfs. - -The data is added with the new function gpiochip_add_data() -and for compatibility we add static inline wrapper function -gpiochip_add() that will call gpiochip_add_data() with -NULL as argument. The latter will be removed once we have -exorcised gpiochip_add() from the kernel. - -gpiochip_get_data() is added as a static inline accessor -for drivers to quickly get their data out. - -Signed-off-by: Linus Walleij ---- - drivers/gpio/gpiolib.c | 10 ++++++---- - include/linux/gpio/driver.h | 14 +++++++++++++- - 2 files changed, 19 insertions(+), 5 deletions(-) - ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -280,7 +280,7 @@ static int gpiochip_set_desc_names(struc - } - - /** -- * gpiochip_add() - register a gpio_chip -+ * gpiochip_add_data() - register a gpio_chip - * @chip: the chip to register, with chip->base initialized - * Context: potentially before irqs will work - * -@@ -288,7 +288,7 @@ static int gpiochip_set_desc_names(struc - * because the chip->base is invalid or already associated with a - * different chip. Otherwise it returns zero as a success code. - * -- * When gpiochip_add() is called very early during boot, so that GPIOs -+ * When gpiochip_add_data() is called very early during boot, so that GPIOs - * can be freely used, the chip->dev device must be registered before - * the gpio framework's arch_initcall(). Otherwise sysfs initialization - * for GPIOs will fail rudely. -@@ -296,7 +296,7 @@ static int gpiochip_set_desc_names(struc - * If chip->base is negative, this requests dynamic assignment of - * a range of valid GPIOs. - */ --int gpiochip_add(struct gpio_chip *chip) -+int gpiochip_add_data(struct gpio_chip *chip, void *data) - { - unsigned long flags; - int status = 0; -@@ -308,6 +308,8 @@ int gpiochip_add(struct gpio_chip *chip) - if (!descs) - return -ENOMEM; - -+ chip->data = data; -+ - spin_lock_irqsave(&gpio_lock, flags); - - if (base < 0) { -@@ -389,7 +391,7 @@ err_free_descs: - chip->label ? : "generic"); - return status; - } --EXPORT_SYMBOL_GPL(gpiochip_add); -+EXPORT_SYMBOL_GPL(gpiochip_add_data); - - /** - * gpiochip_remove() - unregister a gpio_chip ---- a/include/linux/gpio/driver.h -+++ b/include/linux/gpio/driver.h -@@ -23,6 +23,7 @@ struct seq_file; - * @dev: optional device providing the GPIOs - * @cdev: class device used by sysfs interface (may be NULL) - * @owner: helps prevent removal of modules exporting active GPIOs -+ * @data: per-instance data assigned by the driver - * @list: links gpio_chips together for traversal - * @request: optional hook for chip-specific activation, such as - * enabling module power and clock; may sleep -@@ -92,6 +93,7 @@ struct gpio_chip { - struct device *dev; - struct device *cdev; - struct module *owner; -+ void *data; - struct list_head list; - - int (*request)(struct gpio_chip *chip, -@@ -166,7 +168,11 @@ extern const char *gpiochip_is_requested - unsigned offset); - - /* add/remove chips */ --extern int gpiochip_add(struct gpio_chip *chip); -+extern int gpiochip_add_data(struct gpio_chip *chip, void *data); -+static inline int gpiochip_add(struct gpio_chip *chip) -+{ -+ return gpiochip_add_data(chip, NULL); -+} - extern void gpiochip_remove(struct gpio_chip *chip); - extern struct gpio_chip *gpiochip_find(void *data, - int (*match)(struct gpio_chip *chip, void *data)); -@@ -175,6 +181,12 @@ extern struct gpio_chip *gpiochip_find(v - int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset); - void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); - -+/* get driver data */ -+static inline void *gpiochip_get_data(struct gpio_chip *chip) -+{ -+ return chip->data; -+} -+ - struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); - - #ifdef CONFIG_GPIOLIB_IRQCHIP diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-31-gpio-generic-factor-into-gpio_chip-struct.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-31-gpio-generic-factor-into-gpio_chip-struct.patch deleted file mode 100644 index b3c71687b..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.5-31-gpio-generic-factor-into-gpio_chip-struct.patch +++ /dev/null @@ -1,2586 +0,0 @@ -From 0f4630f3720e7e6e921bf525c8357fea7ef3dbab Mon Sep 17 00:00:00 2001 -From: Linus Walleij -Date: Fri, 4 Dec 2015 14:02:58 +0100 -Subject: [PATCH] gpio: generic: factor into gpio_chip struct - -The separate struct bgpio_chip has been a pain to handle, both -by being confusingly similar in name to struct gpio_chip and -for being contained inside a struct so that struct gpio_chip -is contained in a struct contained in a struct, making several -steps of dereferencing necessary. - -Make things simpler: include the fields directly into -, #ifdef:ed for CONFIG_GENERIC_GPIO, and -get rid of the altogether. Prefix -some of the member variables with bgpio_* and add proper -kerneldoc while we're at it. - -Modify all users to handle the change and use a struct -gpio_chip directly. And while we're at it: replace all -container_of() dereferencing by gpiochip_get_data() and -registering the gpio_chip with gpiochip_add_data(). - -Cc: arm@kernel.org -Cc: Alexander Shiyan -Cc: Shawn Guo -Cc: Sascha Hauer -Cc: Kukjin Kim -Cc: Alexandre Courbot -Cc: Brian Norris -Cc: Florian Fainelli -Cc: Sudeep Holla -Cc: Lorenzo Pieralisi -Cc: Nicolas Pitre -Cc: Olof Johansson -Cc: Vladimir Zapolskiy -Cc: Rabin Vincent -Cc: linux-arm-kernel@lists.infradead.org -Cc: linux-omap@vger.kernel.org -Cc: linux-samsung-soc@vger.kernel.org -Cc: bcm-kernel-feedback-list@broadcom.com -Acked-by: Gregory Fong -Acked-by: Liviu Dudau -Acked-by: H Hartley Sweeten -Acked-by: Tony Lindgren -Acked-by: Krzysztof Kozlowski -Acked-by: Lee Jones -Signed-off-by: Linus Walleij ---- - arch/arm/mach-clps711x/board-autcpu12.c | 2 +- - arch/arm/mach-clps711x/board-p720t.c | 2 +- - arch/arm/mach-imx/mach-mx21ads.c | 2 +- - arch/arm/mach-omap1/board-ams-delta.c | 2 +- - arch/arm/mach-s3c64xx/mach-crag6410.c | 2 +- - drivers/gpio/gpio-74xx-mmio.c | 37 ++-- - drivers/gpio/gpio-brcmstb.c | 80 ++++----- - drivers/gpio/gpio-clps711x.c | 28 +-- - drivers/gpio/gpio-dwapb.c | 92 +++++----- - drivers/gpio/gpio-ep93xx.c | 25 +-- - drivers/gpio/gpio-etraxfs.c | 49 +++--- - drivers/gpio/gpio-ge.c | 24 +-- - drivers/gpio/gpio-generic.c | 292 +++++++++++++++----------------- - drivers/gpio/gpio-grgpio.c | 73 ++++---- - drivers/gpio/gpio-moxart.c | 29 ++-- - drivers/gpio/gpio-mxc.c | 27 ++- - drivers/gpio/gpio-mxs.c | 33 ++-- - drivers/gpio/gpio-sodaville.c | 13 +- - drivers/gpio/gpio-xgene-sb.c | 40 ++--- - drivers/mfd/vexpress-sysreg.c | 8 +- - include/linux/basic_mmio_gpio.h | 80 --------- - include/linux/gpio/driver.h | 54 ++++++ - 22 files changed, 442 insertions(+), 552 deletions(-) - delete mode 100644 include/linux/basic_mmio_gpio.h - ---- a/arch/arm/mach-clps711x/board-autcpu12.c -+++ b/arch/arm/mach-clps711x/board-autcpu12.c -@@ -31,7 +31,7 @@ - #include - #include - #include --#include -+#include - - #include - #include ---- a/arch/arm/mach-clps711x/board-p720t.c -+++ b/arch/arm/mach-clps711x/board-p720t.c -@@ -28,7 +28,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include ---- a/arch/arm/mach-imx/mach-mx21ads.c -+++ b/arch/arm/mach-imx/mach-mx21ads.c -@@ -17,7 +17,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include ---- a/arch/arm/mach-omap1/board-ams-delta.c -+++ b/arch/arm/mach-omap1/board-ams-delta.c -@@ -11,7 +11,7 @@ - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ --#include -+#include - #include - #include - #include ---- a/arch/arm/mach-s3c64xx/mach-crag6410.c -+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c -@@ -29,7 +29,7 @@ - #include - #include - #include --#include -+#include - #include - - #include ---- a/drivers/gpio/gpio-74xx-mmio.c -+++ b/drivers/gpio/gpio-74xx-mmio.c -@@ -10,10 +10,9 @@ - */ - - #include --#include - #include - #include --#include -+#include - #include - - #define MMIO_74XX_DIR_IN (0 << 8) -@@ -21,7 +20,7 @@ - #define MMIO_74XX_BIT_CNT(x) ((x) & 0xff) - - struct mmio_74xx_gpio_priv { -- struct bgpio_chip bgc; -+ struct gpio_chip gc; - unsigned flags; - }; - -@@ -78,30 +77,23 @@ static const struct of_device_id mmio_74 - }; - MODULE_DEVICE_TABLE(of, mmio_74xx_gpio_ids); - --static inline struct mmio_74xx_gpio_priv *to_74xx_gpio(struct gpio_chip *gc) --{ -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- -- return container_of(bgc, struct mmio_74xx_gpio_priv, bgc); --} -- - static int mmio_74xx_get_direction(struct gpio_chip *gc, unsigned offset) - { -- struct mmio_74xx_gpio_priv *priv = to_74xx_gpio(gc); -+ struct mmio_74xx_gpio_priv *priv = gpiochip_get_data(gc); - -- return (priv->flags & MMIO_74XX_DIR_OUT) ? GPIOF_DIR_OUT : GPIOF_DIR_IN; -+ return !(priv->flags & MMIO_74XX_DIR_OUT); - } - - static int mmio_74xx_dir_in(struct gpio_chip *gc, unsigned int gpio) - { -- struct mmio_74xx_gpio_priv *priv = to_74xx_gpio(gc); -+ struct mmio_74xx_gpio_priv *priv = gpiochip_get_data(gc); - - return (priv->flags & MMIO_74XX_DIR_OUT) ? -ENOTSUPP : 0; - } - - static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) - { -- struct mmio_74xx_gpio_priv *priv = to_74xx_gpio(gc); -+ struct mmio_74xx_gpio_priv *priv = gpiochip_get_data(gc); - - if (priv->flags & MMIO_74XX_DIR_OUT) { - gc->set(gc, gpio, val); -@@ -134,28 +126,29 @@ static int mmio_74xx_gpio_probe(struct p - - priv->flags = (uintptr_t) of_id->data; - -- err = bgpio_init(&priv->bgc, &pdev->dev, -+ err = bgpio_init(&priv->gc, &pdev->dev, - DIV_ROUND_UP(MMIO_74XX_BIT_CNT(priv->flags), 8), - dat, NULL, NULL, NULL, NULL, 0); - if (err) - return err; - -- priv->bgc.gc.direction_input = mmio_74xx_dir_in; -- priv->bgc.gc.direction_output = mmio_74xx_dir_out; -- priv->bgc.gc.get_direction = mmio_74xx_get_direction; -- priv->bgc.gc.ngpio = MMIO_74XX_BIT_CNT(priv->flags); -- priv->bgc.gc.owner = THIS_MODULE; -+ priv->gc.direction_input = mmio_74xx_dir_in; -+ priv->gc.direction_output = mmio_74xx_dir_out; -+ priv->gc.get_direction = mmio_74xx_get_direction; -+ priv->gc.ngpio = MMIO_74XX_BIT_CNT(priv->flags); -+ priv->gc.owner = THIS_MODULE; - - platform_set_drvdata(pdev, priv); - -- return gpiochip_add(&priv->bgc.gc); -+ return gpiochip_add_data(&priv->gc, priv); - } - - static int mmio_74xx_gpio_remove(struct platform_device *pdev) - { - struct mmio_74xx_gpio_priv *priv = platform_get_drvdata(pdev); - -- return bgpio_remove(&priv->bgc); -+ gpiochip_remove(&priv->gc); -+ return 0; - } - - static struct platform_driver mmio_74xx_gpio_driver = { ---- a/drivers/gpio/gpio-brcmstb.c -+++ b/drivers/gpio/gpio-brcmstb.c -@@ -16,7 +16,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -35,7 +34,7 @@ - struct brcmstb_gpio_bank { - struct list_head node; - int id; -- struct bgpio_chip bgc; -+ struct gpio_chip gc; - struct brcmstb_gpio_priv *parent_priv; - u32 width; - struct irq_chip irq_chip; -@@ -57,37 +56,30 @@ struct brcmstb_gpio_priv { - /* assumes MAX_GPIO_PER_BANK is a multiple of 2 */ - #define GPIO_BIT(gpio) ((gpio) & (MAX_GPIO_PER_BANK - 1)) - --static inline struct brcmstb_gpio_bank * --brcmstb_gpio_gc_to_bank(struct gpio_chip *gc) --{ -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- return container_of(bgc, struct brcmstb_gpio_bank, bgc); --} -- - static inline struct brcmstb_gpio_priv * - brcmstb_gpio_gc_to_priv(struct gpio_chip *gc) - { -- struct brcmstb_gpio_bank *bank = brcmstb_gpio_gc_to_bank(gc); -+ struct brcmstb_gpio_bank *bank = gpiochip_get_data(gc); - return bank->parent_priv; - } - - static void brcmstb_gpio_set_imask(struct brcmstb_gpio_bank *bank, - unsigned int offset, bool enable) - { -- struct bgpio_chip *bgc = &bank->bgc; -+ struct gpio_chip *gc = &bank->gc; - struct brcmstb_gpio_priv *priv = bank->parent_priv; -- u32 mask = bgc->pin2mask(bgc, offset); -+ u32 mask = gc->pin2mask(gc, offset); - u32 imask; - unsigned long flags; - -- spin_lock_irqsave(&bgc->lock, flags); -- imask = bgc->read_reg(priv->reg_base + GIO_MASK(bank->id)); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); -+ imask = gc->read_reg(priv->reg_base + GIO_MASK(bank->id)); - if (enable) - imask |= mask; - else - imask &= ~mask; -- bgc->write_reg(priv->reg_base + GIO_MASK(bank->id), imask); -- spin_unlock_irqrestore(&bgc->lock, flags); -+ gc->write_reg(priv->reg_base + GIO_MASK(bank->id), imask); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - } - - /* -------------------- IRQ chip functions -------------------- */ -@@ -95,7 +87,7 @@ static void brcmstb_gpio_set_imask(struc - static void brcmstb_gpio_irq_mask(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); -- struct brcmstb_gpio_bank *bank = brcmstb_gpio_gc_to_bank(gc); -+ struct brcmstb_gpio_bank *bank = gpiochip_get_data(gc); - - brcmstb_gpio_set_imask(bank, d->hwirq, false); - } -@@ -103,7 +95,7 @@ static void brcmstb_gpio_irq_mask(struct - static void brcmstb_gpio_irq_unmask(struct irq_data *d) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); -- struct brcmstb_gpio_bank *bank = brcmstb_gpio_gc_to_bank(gc); -+ struct brcmstb_gpio_bank *bank = gpiochip_get_data(gc); - - brcmstb_gpio_set_imask(bank, d->hwirq, true); - } -@@ -111,7 +103,7 @@ static void brcmstb_gpio_irq_unmask(stru - static int brcmstb_gpio_irq_set_type(struct irq_data *d, unsigned int type) - { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); -- struct brcmstb_gpio_bank *bank = brcmstb_gpio_gc_to_bank(gc); -+ struct brcmstb_gpio_bank *bank = gpiochip_get_data(gc); - struct brcmstb_gpio_priv *priv = bank->parent_priv; - u32 mask = BIT(d->hwirq); - u32 edge_insensitive, iedge_insensitive; -@@ -149,23 +141,23 @@ static int brcmstb_gpio_irq_set_type(str - return -EINVAL; - } - -- spin_lock_irqsave(&bank->bgc.lock, flags); -+ spin_lock_irqsave(&bank->gc.bgpio_lock, flags); - -- iedge_config = bank->bgc.read_reg(priv->reg_base + -+ iedge_config = bank->gc.read_reg(priv->reg_base + - GIO_EC(bank->id)) & ~mask; -- iedge_insensitive = bank->bgc.read_reg(priv->reg_base + -+ iedge_insensitive = bank->gc.read_reg(priv->reg_base + - GIO_EI(bank->id)) & ~mask; -- ilevel = bank->bgc.read_reg(priv->reg_base + -+ ilevel = bank->gc.read_reg(priv->reg_base + - GIO_LEVEL(bank->id)) & ~mask; - -- bank->bgc.write_reg(priv->reg_base + GIO_EC(bank->id), -+ bank->gc.write_reg(priv->reg_base + GIO_EC(bank->id), - iedge_config | edge_config); -- bank->bgc.write_reg(priv->reg_base + GIO_EI(bank->id), -+ bank->gc.write_reg(priv->reg_base + GIO_EI(bank->id), - iedge_insensitive | edge_insensitive); -- bank->bgc.write_reg(priv->reg_base + GIO_LEVEL(bank->id), -+ bank->gc.write_reg(priv->reg_base + GIO_LEVEL(bank->id), - ilevel | level); - -- spin_unlock_irqrestore(&bank->bgc.lock, flags); -+ spin_unlock_irqrestore(&bank->gc.bgpio_lock, flags); - return 0; - } - -@@ -210,29 +202,29 @@ static irqreturn_t brcmstb_gpio_wake_irq - static void brcmstb_gpio_irq_bank_handler(struct brcmstb_gpio_bank *bank) - { - struct brcmstb_gpio_priv *priv = bank->parent_priv; -- struct irq_domain *irq_domain = bank->bgc.gc.irqdomain; -+ struct irq_domain *irq_domain = bank->gc.irqdomain; - void __iomem *reg_base = priv->reg_base; - unsigned long status; - unsigned long flags; - -- spin_lock_irqsave(&bank->bgc.lock, flags); -- while ((status = bank->bgc.read_reg(reg_base + GIO_STAT(bank->id)) & -- bank->bgc.read_reg(reg_base + GIO_MASK(bank->id)))) { -+ spin_lock_irqsave(&bank->gc.bgpio_lock, flags); -+ while ((status = bank->gc.read_reg(reg_base + GIO_STAT(bank->id)) & -+ bank->gc.read_reg(reg_base + GIO_MASK(bank->id)))) { - int bit; - - for_each_set_bit(bit, &status, 32) { -- u32 stat = bank->bgc.read_reg(reg_base + -+ u32 stat = bank->gc.read_reg(reg_base + - GIO_STAT(bank->id)); - if (bit >= bank->width) - dev_warn(&priv->pdev->dev, - "IRQ for invalid GPIO (bank=%d, offset=%d)\n", - bank->id, bit); -- bank->bgc.write_reg(reg_base + GIO_STAT(bank->id), -+ bank->gc.write_reg(reg_base + GIO_STAT(bank->id), - stat | BIT(bit)); - generic_handle_irq(irq_find_mapping(irq_domain, bit)); - } - } -- spin_unlock_irqrestore(&bank->bgc.lock, flags); -+ spin_unlock_irqrestore(&bank->gc.bgpio_lock, flags); - } - - /* Each UPG GIO block has one IRQ for all banks */ -@@ -303,9 +295,7 @@ static int brcmstb_gpio_remove(struct pl - */ - list_for_each(pos, &priv->bank_list) { - bank = list_entry(pos, struct brcmstb_gpio_bank, node); -- ret = bgpio_remove(&bank->bgc); -- if (ret) -- dev_err(&pdev->dev, "gpiochip_remove fail in cleanup\n"); -+ gpiochip_remove(&bank->gc); - } - if (priv->reboot_notifier.notifier_call) { - ret = unregister_reboot_notifier(&priv->reboot_notifier); -@@ -320,7 +310,7 @@ static int brcmstb_gpio_of_xlate(struct - const struct of_phandle_args *gpiospec, u32 *flags) - { - struct brcmstb_gpio_priv *priv = brcmstb_gpio_gc_to_priv(gc); -- struct brcmstb_gpio_bank *bank = brcmstb_gpio_gc_to_bank(gc); -+ struct brcmstb_gpio_bank *bank = gpiochip_get_data(gc); - int offset; - - if (gc->of_gpio_n_cells != 2) { -@@ -398,9 +388,9 @@ static int brcmstb_gpio_irq_setup(struct - if (priv->can_wake) - bank->irq_chip.irq_set_wake = brcmstb_gpio_irq_set_wake; - -- gpiochip_irqchip_add(&bank->bgc.gc, &bank->irq_chip, 0, -+ gpiochip_irqchip_add(&bank->gc, &bank->irq_chip, 0, - handle_simple_irq, IRQ_TYPE_NONE); -- gpiochip_set_chained_irqchip(&bank->bgc.gc, &bank->irq_chip, -+ gpiochip_set_chained_irqchip(&bank->gc, &bank->irq_chip, - priv->parent_irq, brcmstb_gpio_irq_handler); - - return 0; -@@ -451,7 +441,6 @@ static int brcmstb_gpio_probe(struct pla - of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p, - bank_width) { - struct brcmstb_gpio_bank *bank; -- struct bgpio_chip *bgc; - struct gpio_chip *gc; - - bank = devm_kzalloc(dev, sizeof(*bank), GFP_KERNEL); -@@ -473,8 +462,8 @@ static int brcmstb_gpio_probe(struct pla - * Regs are 4 bytes wide, have data reg, no set/clear regs, - * and direction bits have 0 = output and 1 = input - */ -- bgc = &bank->bgc; -- err = bgpio_init(bgc, dev, 4, -+ gc = &bank->gc; -+ err = bgpio_init(gc, dev, 4, - reg_base + GIO_DATA(bank->id), - NULL, NULL, NULL, - reg_base + GIO_IODIR(bank->id), 0); -@@ -483,7 +472,6 @@ static int brcmstb_gpio_probe(struct pla - goto fail; - } - -- gc = &bgc->gc; - gc->of_node = np; - gc->owner = THIS_MODULE; - gc->label = np->full_name; -@@ -497,9 +485,9 @@ static int brcmstb_gpio_probe(struct pla - * Mask all interrupts by default, since wakeup interrupts may - * be retained from S5 cold boot - */ -- bank->bgc.write_reg(reg_base + GIO_MASK(bank->id), 0); -+ gc->write_reg(reg_base + GIO_MASK(bank->id), 0); - -- err = gpiochip_add(gc); -+ err = gpiochip_add_data(gc, bank); - if (err) { - dev_err(dev, "Could not add gpiochip for bank %d\n", - bank->id); ---- a/drivers/gpio/gpio-clps711x.c -+++ b/drivers/gpio/gpio-clps711x.c -@@ -10,24 +10,23 @@ - */ - - #include --#include - #include --#include -+#include - #include - - static int clps711x_gpio_probe(struct platform_device *pdev) - { - struct device_node *np = pdev->dev.of_node; - void __iomem *dat, *dir; -- struct bgpio_chip *bgc; -+ struct gpio_chip *gc; - struct resource *res; - int err, id = np ? of_alias_get_id(np, "gpio") : pdev->id; - - if ((id < 0) || (id > 4)) - return -ENODEV; - -- bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL); -- if (!bgc) -+ gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL); -+ if (!gc) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -43,11 +42,11 @@ static int clps711x_gpio_probe(struct pl - switch (id) { - case 3: - /* PORTD is inverted logic for direction register */ -- err = bgpio_init(bgc, &pdev->dev, 1, dat, NULL, NULL, -+ err = bgpio_init(gc, &pdev->dev, 1, dat, NULL, NULL, - NULL, dir, 0); - break; - default: -- err = bgpio_init(bgc, &pdev->dev, 1, dat, NULL, NULL, -+ err = bgpio_init(gc, &pdev->dev, 1, dat, NULL, NULL, - dir, NULL, 0); - break; - } -@@ -58,24 +57,25 @@ static int clps711x_gpio_probe(struct pl - switch (id) { - case 4: - /* PORTE is 3 lines only */ -- bgc->gc.ngpio = 3; -+ gc->ngpio = 3; - break; - default: - break; - } - -- bgc->gc.base = id * 8; -- bgc->gc.owner = THIS_MODULE; -- platform_set_drvdata(pdev, bgc); -+ gc->base = id * 8; -+ gc->owner = THIS_MODULE; -+ platform_set_drvdata(pdev, gc); - -- return gpiochip_add(&bgc->gc); -+ return gpiochip_add_data(gc, NULL); - } - - static int clps711x_gpio_remove(struct platform_device *pdev) - { -- struct bgpio_chip *bgc = platform_get_drvdata(pdev); -+ struct gpio_chip *gc = platform_get_drvdata(pdev); - -- return bgpio_remove(bgc); -+ gpiochip_remove(gc); -+ return 0; - } - - static const struct of_device_id __maybe_unused clps711x_gpio_ids[] = { ---- a/drivers/gpio/gpio-dwapb.c -+++ b/drivers/gpio/gpio-dwapb.c -@@ -7,7 +7,9 @@ - * - * All enquiries to support@picochip.com - */ --#include -+#include -+/* FIXME: for gpio_get_value(), replace this with direct register read */ -+#include - #include - #include - #include -@@ -66,7 +68,7 @@ struct dwapb_context { - #endif - - struct dwapb_gpio_port { -- struct bgpio_chip bgc; -+ struct gpio_chip gc; - bool is_registered; - struct dwapb_gpio *gpio; - #ifdef CONFIG_PM_SLEEP -@@ -83,33 +85,26 @@ struct dwapb_gpio { - struct irq_domain *domain; - }; - --static inline struct dwapb_gpio_port * --to_dwapb_gpio_port(struct bgpio_chip *bgc) --{ -- return container_of(bgc, struct dwapb_gpio_port, bgc); --} -- - static inline u32 dwapb_read(struct dwapb_gpio *gpio, unsigned int offset) - { -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - void __iomem *reg_base = gpio->regs; - -- return bgc->read_reg(reg_base + offset); -+ return gc->read_reg(reg_base + offset); - } - - static inline void dwapb_write(struct dwapb_gpio *gpio, unsigned int offset, - u32 val) - { -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - void __iomem *reg_base = gpio->regs; - -- bgc->write_reg(reg_base + offset, val); -+ gc->write_reg(reg_base + offset, val); - } - - static int dwapb_gpio_to_irq(struct gpio_chip *gc, unsigned offset) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- struct dwapb_gpio_port *port = to_dwapb_gpio_port(bgc); -+ struct dwapb_gpio_port *port = gpiochip_get_data(gc); - struct dwapb_gpio *gpio = port->gpio; - - return irq_find_mapping(gpio->domain, offset); -@@ -119,7 +114,7 @@ static void dwapb_toggle_trigger(struct - { - u32 v = dwapb_read(gpio, GPIO_INT_POLARITY); - -- if (gpio_get_value(gpio->ports[0].bgc.gc.base + offs)) -+ if (gpio_get_value(gpio->ports[0].gc.base + offs)) - v &= ~BIT(offs); - else - v |= BIT(offs); -@@ -162,39 +157,39 @@ static void dwapb_irq_enable(struct irq_ - { - struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); - struct dwapb_gpio *gpio = igc->private; -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - unsigned long flags; - u32 val; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - val = dwapb_read(gpio, GPIO_INTEN); - val |= BIT(d->hwirq); - dwapb_write(gpio, GPIO_INTEN, val); -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - } - - static void dwapb_irq_disable(struct irq_data *d) - { - struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); - struct dwapb_gpio *gpio = igc->private; -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - unsigned long flags; - u32 val; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - val = dwapb_read(gpio, GPIO_INTEN); - val &= ~BIT(d->hwirq); - dwapb_write(gpio, GPIO_INTEN, val); -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - } - - static int dwapb_irq_reqres(struct irq_data *d) - { - struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); - struct dwapb_gpio *gpio = igc->private; -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - -- if (gpiochip_lock_as_irq(&bgc->gc, irqd_to_hwirq(d))) { -+ if (gpiochip_lock_as_irq(gc, irqd_to_hwirq(d))) { - dev_err(gpio->dev, "unable to lock HW IRQ %lu for IRQ\n", - irqd_to_hwirq(d)); - return -EINVAL; -@@ -206,16 +201,16 @@ static void dwapb_irq_relres(struct irq_ - { - struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); - struct dwapb_gpio *gpio = igc->private; -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - -- gpiochip_unlock_as_irq(&bgc->gc, irqd_to_hwirq(d)); -+ gpiochip_unlock_as_irq(gc, irqd_to_hwirq(d)); - } - - static int dwapb_irq_set_type(struct irq_data *d, u32 type) - { - struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); - struct dwapb_gpio *gpio = igc->private; -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - int bit = d->hwirq; - unsigned long level, polarity, flags; - -@@ -223,7 +218,7 @@ static int dwapb_irq_set_type(struct irq - IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) - return -EINVAL; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - level = dwapb_read(gpio, GPIO_INTTYPE_LEVEL); - polarity = dwapb_read(gpio, GPIO_INT_POLARITY); - -@@ -254,7 +249,7 @@ static int dwapb_irq_set_type(struct irq - - dwapb_write(gpio, GPIO_INTTYPE_LEVEL, level); - dwapb_write(gpio, GPIO_INT_POLARITY, polarity); -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - - return 0; - } -@@ -262,13 +257,12 @@ static int dwapb_irq_set_type(struct irq - static int dwapb_gpio_set_debounce(struct gpio_chip *gc, - unsigned offset, unsigned debounce) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- struct dwapb_gpio_port *port = to_dwapb_gpio_port(bgc); -+ struct dwapb_gpio_port *port = gpiochip_get_data(gc); - struct dwapb_gpio *gpio = port->gpio; - unsigned long flags, val_deb; -- unsigned long mask = bgc->pin2mask(bgc, offset); -+ unsigned long mask = gc->pin2mask(gc, offset); - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - - val_deb = dwapb_read(gpio, GPIO_PORTA_DEBOUNCE); - if (debounce) -@@ -276,7 +270,7 @@ static int dwapb_gpio_set_debounce(struc - else - dwapb_write(gpio, GPIO_PORTA_DEBOUNCE, val_deb & ~mask); - -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - - return 0; - } -@@ -295,7 +289,7 @@ static void dwapb_configure_irqs(struct - struct dwapb_gpio_port *port, - struct dwapb_port_property *pp) - { -- struct gpio_chip *gc = &port->bgc.gc; -+ struct gpio_chip *gc = &port->gc; - struct device_node *node = pp->node; - struct irq_chip_generic *irq_gc = NULL; - unsigned int hwirq, ngpio = gc->ngpio; -@@ -369,13 +363,13 @@ static void dwapb_configure_irqs(struct - for (hwirq = 0 ; hwirq < ngpio ; hwirq++) - irq_create_mapping(gpio->domain, hwirq); - -- port->bgc.gc.to_irq = dwapb_gpio_to_irq; -+ port->gc.to_irq = dwapb_gpio_to_irq; - } - - static void dwapb_irq_teardown(struct dwapb_gpio *gpio) - { - struct dwapb_gpio_port *port = &gpio->ports[0]; -- struct gpio_chip *gc = &port->bgc.gc; -+ struct gpio_chip *gc = &port->gc; - unsigned int ngpio = gc->ngpio; - irq_hw_number_t hwirq; - -@@ -412,7 +406,7 @@ static int dwapb_gpio_add_port(struct dw - dirout = gpio->regs + GPIO_SWPORTA_DDR + - (pp->idx * GPIO_SWPORT_DDR_SIZE); - -- err = bgpio_init(&port->bgc, gpio->dev, 4, dat, set, NULL, dirout, -+ err = bgpio_init(&port->gc, gpio->dev, 4, dat, set, NULL, dirout, - NULL, false); - if (err) { - dev_err(gpio->dev, "failed to init gpio chip for %s\n", -@@ -421,19 +415,19 @@ static int dwapb_gpio_add_port(struct dw - } - - #ifdef CONFIG_OF_GPIO -- port->bgc.gc.of_node = pp->node; -+ port->gc.of_node = pp->node; - #endif -- port->bgc.gc.ngpio = pp->ngpio; -- port->bgc.gc.base = pp->gpio_base; -+ port->gc.ngpio = pp->ngpio; -+ port->gc.base = pp->gpio_base; - - /* Only port A support debounce */ - if (pp->idx == 0) -- port->bgc.gc.set_debounce = dwapb_gpio_set_debounce; -+ port->gc.set_debounce = dwapb_gpio_set_debounce; - - if (pp->irq) - dwapb_configure_irqs(gpio, port, pp); - -- err = gpiochip_add(&port->bgc.gc); -+ err = gpiochip_add_data(&port->gc, port); - if (err) - dev_err(gpio->dev, "failed to register gpiochip for %s\n", - pp->name); -@@ -449,7 +443,7 @@ static void dwapb_gpio_unregister(struct - - for (m = 0; m < gpio->nr_ports; ++m) - if (gpio->ports[m].is_registered) -- gpiochip_remove(&gpio->ports[m].bgc.gc); -+ gpiochip_remove(&gpio->ports[m].gc); - } - - static struct dwapb_platform_data * -@@ -591,11 +585,11 @@ static int dwapb_gpio_suspend(struct dev - { - struct platform_device *pdev = to_platform_device(dev); - struct dwapb_gpio *gpio = platform_get_drvdata(pdev); -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - unsigned long flags; - int i; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - for (i = 0; i < gpio->nr_ports; i++) { - unsigned int offset; - unsigned int idx = gpio->ports[i].idx; -@@ -624,7 +618,7 @@ static int dwapb_gpio_suspend(struct dev - dwapb_write(gpio, GPIO_INTMASK, 0xffffffff); - } - } -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - - return 0; - } -@@ -633,11 +627,11 @@ static int dwapb_gpio_resume(struct devi - { - struct platform_device *pdev = to_platform_device(dev); - struct dwapb_gpio *gpio = platform_get_drvdata(pdev); -- struct bgpio_chip *bgc = &gpio->ports[0].bgc; -+ struct gpio_chip *gc = &gpio->ports[0].gc; - unsigned long flags; - int i; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - for (i = 0; i < gpio->nr_ports; i++) { - unsigned int offset; - unsigned int idx = gpio->ports[i].idx; -@@ -666,7 +660,7 @@ static int dwapb_gpio_resume(struct devi - dwapb_write(gpio, GPIO_PORTA_EOI, 0xffffffff); - } - } -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - - return 0; - } ---- a/drivers/gpio/gpio-ep93xx.c -+++ b/drivers/gpio/gpio-ep93xx.c -@@ -16,10 +16,11 @@ - #include - #include - #include --#include - #include - #include --#include -+#include -+/* FIXME: this is here for gpio_to_irq() - get rid of this! */ -+#include - - #include - #include -@@ -28,7 +29,7 @@ - - struct ep93xx_gpio { - void __iomem *mmio_base; -- struct bgpio_chip bgc[8]; -+ struct gpio_chip gc[8]; - }; - - /************************************************************************* -@@ -319,26 +320,26 @@ static int ep93xx_gpio_to_irq(struct gpi - return 64 + gpio; - } - --static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev, -+static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev, - void __iomem *mmio_base, struct ep93xx_gpio_bank *bank) - { - void __iomem *data = mmio_base + bank->data; - void __iomem *dir = mmio_base + bank->dir; - int err; - -- err = bgpio_init(bgc, dev, 1, data, NULL, NULL, dir, NULL, 0); -+ err = bgpio_init(gc, dev, 1, data, NULL, NULL, dir, NULL, 0); - if (err) - return err; - -- bgc->gc.label = bank->label; -- bgc->gc.base = bank->base; -+ gc->label = bank->label; -+ gc->base = bank->base; - - if (bank->has_debounce) { -- bgc->gc.set_debounce = ep93xx_gpio_set_debounce; -- bgc->gc.to_irq = ep93xx_gpio_to_irq; -+ gc->set_debounce = ep93xx_gpio_set_debounce; -+ gc->to_irq = ep93xx_gpio_to_irq; - } - -- return gpiochip_add(&bgc->gc); -+ return gpiochip_add_data(gc, NULL); - } - - static int ep93xx_gpio_probe(struct platform_device *pdev) -@@ -358,10 +359,10 @@ static int ep93xx_gpio_probe(struct plat - return PTR_ERR(ep93xx_gpio->mmio_base); - - for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) { -- struct bgpio_chip *bgc = &ep93xx_gpio->bgc[i]; -+ struct gpio_chip *gc = &ep93xx_gpio->gc[i]; - struct ep93xx_gpio_bank *bank = &ep93xx_gpio_banks[i]; - -- if (ep93xx_gpio_add_bank(bgc, &pdev->dev, -+ if (ep93xx_gpio_add_bank(gc, &pdev->dev, - ep93xx_gpio->mmio_base, bank)) - dev_warn(&pdev->dev, "Unable to add gpio bank %s\n", - bank->label); ---- a/drivers/gpio/gpio-etraxfs.c -+++ b/drivers/gpio/gpio-etraxfs.c -@@ -1,12 +1,10 @@ - #include - #include --#include - #include - #include - #include - #include - #include --#include - - #define ETRAX_FS_rw_pa_dout 0 - #define ETRAX_FS_r_pa_din 4 -@@ -67,7 +65,7 @@ struct etraxfs_gpio_block { - }; - - struct etraxfs_gpio_chip { -- struct bgpio_chip bgc; -+ struct gpio_chip gc; - struct etraxfs_gpio_block *block; - }; - -@@ -176,11 +174,6 @@ static const struct etraxfs_gpio_info et - .rw_intr_pins = ARTPEC3_rw_intr_pins, - }; - --static struct etraxfs_gpio_chip *to_etraxfs(struct gpio_chip *gc) --{ -- return container_of(gc, struct etraxfs_gpio_chip, bgc.gc); --} -- - static unsigned int etraxfs_gpio_chip_to_port(struct gpio_chip *gc) - { - return gc->label[0] - 'A'; -@@ -220,13 +213,13 @@ static unsigned int etraxfs_gpio_to_grou - static unsigned int etraxfs_gpio_to_group_pin(struct etraxfs_gpio_chip *chip, - unsigned int gpio) - { -- return 4 * etraxfs_gpio_chip_to_port(&chip->bgc.gc) + gpio / 8; -+ return 4 * etraxfs_gpio_chip_to_port(&chip->gc) + gpio / 8; - } - - static void etraxfs_gpio_irq_ack(struct irq_data *d) - { - struct etraxfs_gpio_chip *chip = -- to_etraxfs(irq_data_get_irq_chip_data(d)); -+ gpiochip_get_data(irq_data_get_irq_chip_data(d)); - struct etraxfs_gpio_block *block = chip->block; - unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - -@@ -236,7 +229,7 @@ static void etraxfs_gpio_irq_ack(struct - static void etraxfs_gpio_irq_mask(struct irq_data *d) - { - struct etraxfs_gpio_chip *chip = -- to_etraxfs(irq_data_get_irq_chip_data(d)); -+ gpiochip_get_data(irq_data_get_irq_chip_data(d)); - struct etraxfs_gpio_block *block = chip->block; - unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - -@@ -249,7 +242,7 @@ static void etraxfs_gpio_irq_mask(struct - static void etraxfs_gpio_irq_unmask(struct irq_data *d) - { - struct etraxfs_gpio_chip *chip = -- to_etraxfs(irq_data_get_irq_chip_data(d)); -+ gpiochip_get_data(irq_data_get_irq_chip_data(d)); - struct etraxfs_gpio_block *block = chip->block; - unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - -@@ -262,7 +255,7 @@ static void etraxfs_gpio_irq_unmask(stru - static int etraxfs_gpio_irq_set_type(struct irq_data *d, u32 type) - { - struct etraxfs_gpio_chip *chip = -- to_etraxfs(irq_data_get_irq_chip_data(d)); -+ gpiochip_get_data(irq_data_get_irq_chip_data(d)); - struct etraxfs_gpio_block *block = chip->block; - unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - u32 cfg; -@@ -299,7 +292,7 @@ static int etraxfs_gpio_irq_set_type(str - static int etraxfs_gpio_irq_request_resources(struct irq_data *d) - { - struct etraxfs_gpio_chip *chip = -- to_etraxfs(irq_data_get_irq_chip_data(d)); -+ gpiochip_get_data(irq_data_get_irq_chip_data(d)); - struct etraxfs_gpio_block *block = chip->block; - unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - int ret = -EBUSY; -@@ -308,7 +301,7 @@ static int etraxfs_gpio_irq_request_reso - if (block->group[grpirq]) - goto out; - -- ret = gpiochip_lock_as_irq(&chip->bgc.gc, d->hwirq); -+ ret = gpiochip_lock_as_irq(&chip->gc, d->hwirq); - if (ret) - goto out; - -@@ -330,13 +323,13 @@ out: - static void etraxfs_gpio_irq_release_resources(struct irq_data *d) - { - struct etraxfs_gpio_chip *chip = -- to_etraxfs(irq_data_get_irq_chip_data(d)); -+ gpiochip_get_data(irq_data_get_irq_chip_data(d)); - struct etraxfs_gpio_block *block = chip->block; - unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq); - - spin_lock(&block->lock); - block->group[grpirq] = 0; -- gpiochip_unlock_as_irq(&chip->bgc.gc, d->hwirq); -+ gpiochip_unlock_as_irq(&chip->gc, d->hwirq); - spin_unlock(&block->lock); - } - -@@ -419,7 +412,7 @@ static int etraxfs_gpio_probe(struct pla - - for (i = 0; i < info->num_ports; i++) { - struct etraxfs_gpio_chip *chip = &chips[i]; -- struct bgpio_chip *bgc = &chip->bgc; -+ struct gpio_chip *gc = &chip->gc; - const struct etraxfs_gpio_port *port = &info->ports[i]; - unsigned long flags = BGPIOF_READ_OUTPUT_REG_SET; - void __iomem *dat = regs + port->din; -@@ -433,7 +426,7 @@ static int etraxfs_gpio_probe(struct pla - flags = BGPIOF_NO_OUTPUT; - } - -- ret = bgpio_init(bgc, dev, 4, -+ ret = bgpio_init(gc, dev, 4, - dat, set, NULL, dirout, NULL, - flags); - if (ret) { -@@ -442,28 +435,28 @@ static int etraxfs_gpio_probe(struct pla - continue; - } - -- bgc->gc.ngpio = port->ngpio; -- bgc->gc.label = port->label; -+ gc->ngpio = port->ngpio; -+ gc->label = port->label; - -- bgc->gc.of_node = dev->of_node; -- bgc->gc.of_gpio_n_cells = 3; -- bgc->gc.of_xlate = etraxfs_gpio_of_xlate; -+ gc->of_node = dev->of_node; -+ gc->of_gpio_n_cells = 3; -+ gc->of_xlate = etraxfs_gpio_of_xlate; - -- ret = gpiochip_add(&bgc->gc); -+ ret = gpiochip_add_data(gc, chip); - if (ret) { - dev_err(dev, "Unable to register port %s\n", -- bgc->gc.label); -+ gc->label); - continue; - } - - if (i > 0 && !allportsirq) - continue; - -- ret = gpiochip_irqchip_add(&bgc->gc, &etraxfs_gpio_irq_chip, 0, -+ ret = gpiochip_irqchip_add(gc, &etraxfs_gpio_irq_chip, 0, - handle_level_irq, IRQ_TYPE_NONE); - if (ret) { - dev_err(dev, "Unable to add irqchip to port %s\n", -- bgc->gc.label); -+ gc->label); - } - } - ---- a/drivers/gpio/gpio-ge.c -+++ b/drivers/gpio/gpio-ge.c -@@ -24,7 +24,7 @@ - #include - #include - #include --#include -+#include - - #define GEF_GPIO_DIRECT 0x00 - #define GEF_GPIO_IN 0x04 -@@ -55,19 +55,19 @@ static int __init gef_gpio_probe(struct - { - const struct of_device_id *of_id = - of_match_device(gef_gpio_ids, &pdev->dev); -- struct bgpio_chip *bgc; -+ struct gpio_chip *gc; - void __iomem *regs; - int ret; - -- bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL); -- if (!bgc) -+ gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL); -+ if (!gc) - return -ENOMEM; - - regs = of_iomap(pdev->dev.of_node, 0); - if (!regs) - return -ENOMEM; - -- ret = bgpio_init(bgc, &pdev->dev, 4, regs + GEF_GPIO_IN, -+ ret = bgpio_init(gc, &pdev->dev, 4, regs + GEF_GPIO_IN, - regs + GEF_GPIO_OUT, NULL, NULL, - regs + GEF_GPIO_DIRECT, BGPIOF_BIG_ENDIAN_BYTE_ORDER); - if (ret) { -@@ -76,20 +76,20 @@ static int __init gef_gpio_probe(struct - } - - /* Setup pointers to chip functions */ -- bgc->gc.label = devm_kstrdup(&pdev->dev, pdev->dev.of_node->full_name, -+ gc->label = devm_kstrdup(&pdev->dev, pdev->dev.of_node->full_name, - GFP_KERNEL); -- if (!bgc->gc.label) { -+ if (!gc->label) { - ret = -ENOMEM; - goto err0; - } - -- bgc->gc.base = -1; -- bgc->gc.ngpio = (u16)(uintptr_t)of_id->data; -- bgc->gc.of_gpio_n_cells = 2; -- bgc->gc.of_node = pdev->dev.of_node; -+ gc->base = -1; -+ gc->ngpio = (u16)(uintptr_t)of_id->data; -+ gc->of_gpio_n_cells = 2; -+ gc->of_node = pdev->dev.of_node; - - /* This function adds a memory mapped GPIO chip */ -- ret = gpiochip_add(&bgc->gc); -+ ret = gpiochip_add_data(gc, NULL); - if (ret) - goto err0; - ---- a/drivers/gpio/gpio-generic.c -+++ b/drivers/gpio/gpio-generic.c -@@ -56,11 +56,10 @@ o ` ~~~~\___/ - #include - #include - #include --#include -+#include - #include - #include - #include --#include - - static void bgpio_write8(void __iomem *reg, unsigned long data) - { -@@ -124,33 +123,30 @@ static unsigned long bgpio_read32be(void - return ioread32be(reg); - } - --static unsigned long bgpio_pin2mask(struct bgpio_chip *bgc, unsigned int pin) -+static unsigned long bgpio_pin2mask(struct gpio_chip *gc, unsigned int pin) - { - return 1 << pin; - } - --static unsigned long bgpio_pin2mask_be(struct bgpio_chip *bgc, -+static unsigned long bgpio_pin2mask_be(struct gpio_chip *gc, - unsigned int pin) - { -- return 1 << (bgc->bits - 1 - pin); -+ return 1 << (gc->bgpio_bits - 1 - pin); - } - - static int bgpio_get_set(struct gpio_chip *gc, unsigned int gpio) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- unsigned long pinmask = bgc->pin2mask(bgc, gpio); -+ unsigned long pinmask = gc->pin2mask(gc, gpio); - -- if (bgc->dir & pinmask) -- return !!(bgc->read_reg(bgc->reg_set) & pinmask); -+ if (gc->bgpio_dir & pinmask) -+ return !!(gc->read_reg(gc->reg_set) & pinmask); - else -- return !!(bgc->read_reg(bgc->reg_dat) & pinmask); -+ return !!(gc->read_reg(gc->reg_dat) & pinmask); - } - - static int bgpio_get(struct gpio_chip *gc, unsigned int gpio) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- -- return !!(bgc->read_reg(bgc->reg_dat) & bgc->pin2mask(bgc, gpio)); -+ return !!(gc->read_reg(gc->reg_dat) & gc->pin2mask(gc, gpio)); - } - - static void bgpio_set_none(struct gpio_chip *gc, unsigned int gpio, int val) -@@ -159,53 +155,50 @@ static void bgpio_set_none(struct gpio_c - - static void bgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- unsigned long mask = bgc->pin2mask(bgc, gpio); -+ unsigned long mask = gc->pin2mask(gc, gpio); - unsigned long flags; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - - if (val) -- bgc->data |= mask; -+ gc->bgpio_data |= mask; - else -- bgc->data &= ~mask; -+ gc->bgpio_data &= ~mask; - -- bgc->write_reg(bgc->reg_dat, bgc->data); -+ gc->write_reg(gc->reg_dat, gc->bgpio_data); - -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - } - - static void bgpio_set_with_clear(struct gpio_chip *gc, unsigned int gpio, - int val) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- unsigned long mask = bgc->pin2mask(bgc, gpio); -+ unsigned long mask = gc->pin2mask(gc, gpio); - - if (val) -- bgc->write_reg(bgc->reg_set, mask); -+ gc->write_reg(gc->reg_set, mask); - else -- bgc->write_reg(bgc->reg_clr, mask); -+ gc->write_reg(gc->reg_clr, mask); - } - - static void bgpio_set_set(struct gpio_chip *gc, unsigned int gpio, int val) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- unsigned long mask = bgc->pin2mask(bgc, gpio); -+ unsigned long mask = gc->pin2mask(gc, gpio); - unsigned long flags; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - - if (val) -- bgc->data |= mask; -+ gc->bgpio_data |= mask; - else -- bgc->data &= ~mask; -+ gc->bgpio_data &= ~mask; - -- bgc->write_reg(bgc->reg_set, bgc->data); -+ gc->write_reg(gc->reg_set, gc->bgpio_data); - -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - } - --static void bgpio_multiple_get_masks(struct bgpio_chip *bgc, -+static void bgpio_multiple_get_masks(struct gpio_chip *gc, - unsigned long *mask, unsigned long *bits, - unsigned long *set_mask, - unsigned long *clear_mask) -@@ -215,19 +208,19 @@ static void bgpio_multiple_get_masks(str - *set_mask = 0; - *clear_mask = 0; - -- for (i = 0; i < bgc->bits; i++) { -+ for (i = 0; i < gc->bgpio_bits; i++) { - if (*mask == 0) - break; - if (__test_and_clear_bit(i, mask)) { - if (test_bit(i, bits)) -- *set_mask |= bgc->pin2mask(bgc, i); -+ *set_mask |= gc->pin2mask(gc, i); - else -- *clear_mask |= bgc->pin2mask(bgc, i); -+ *clear_mask |= gc->pin2mask(gc, i); - } - } - } - --static void bgpio_set_multiple_single_reg(struct bgpio_chip *bgc, -+static void bgpio_set_multiple_single_reg(struct gpio_chip *gc, - unsigned long *mask, - unsigned long *bits, - void __iomem *reg) -@@ -235,47 +228,42 @@ static void bgpio_set_multiple_single_re - unsigned long flags; - unsigned long set_mask, clear_mask; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - -- bgpio_multiple_get_masks(bgc, mask, bits, &set_mask, &clear_mask); -+ bgpio_multiple_get_masks(gc, mask, bits, &set_mask, &clear_mask); - -- bgc->data |= set_mask; -- bgc->data &= ~clear_mask; -+ gc->bgpio_data |= set_mask; -+ gc->bgpio_data &= ~clear_mask; - -- bgc->write_reg(reg, bgc->data); -+ gc->write_reg(reg, gc->bgpio_data); - -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - } - - static void bgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, - unsigned long *bits) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- -- bgpio_set_multiple_single_reg(bgc, mask, bits, bgc->reg_dat); -+ bgpio_set_multiple_single_reg(gc, mask, bits, gc->reg_dat); - } - - static void bgpio_set_multiple_set(struct gpio_chip *gc, unsigned long *mask, - unsigned long *bits) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- -- bgpio_set_multiple_single_reg(bgc, mask, bits, bgc->reg_set); -+ bgpio_set_multiple_single_reg(gc, mask, bits, gc->reg_set); - } - - static void bgpio_set_multiple_with_clear(struct gpio_chip *gc, - unsigned long *mask, - unsigned long *bits) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); - unsigned long set_mask, clear_mask; - -- bgpio_multiple_get_masks(bgc, mask, bits, &set_mask, &clear_mask); -+ bgpio_multiple_get_masks(gc, mask, bits, &set_mask, &clear_mask); - - if (set_mask) -- bgc->write_reg(bgc->reg_set, set_mask); -+ gc->write_reg(gc->reg_set, set_mask); - if (clear_mask) -- bgc->write_reg(bgc->reg_clr, clear_mask); -+ gc->write_reg(gc->reg_clr, clear_mask); - } - - static int bgpio_simple_dir_in(struct gpio_chip *gc, unsigned int gpio) -@@ -299,111 +287,103 @@ static int bgpio_simple_dir_out(struct g - - static int bgpio_dir_in(struct gpio_chip *gc, unsigned int gpio) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); - unsigned long flags; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - -- bgc->dir &= ~bgc->pin2mask(bgc, gpio); -- bgc->write_reg(bgc->reg_dir, bgc->dir); -+ gc->bgpio_dir &= ~gc->pin2mask(gc, gpio); -+ gc->write_reg(gc->reg_dir, gc->bgpio_dir); - -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - - return 0; - } - - static int bgpio_get_dir(struct gpio_chip *gc, unsigned int gpio) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- -- return (bgc->read_reg(bgc->reg_dir) & bgc->pin2mask(bgc, gpio)) ? -- GPIOF_DIR_OUT : GPIOF_DIR_IN; -+ /* Return 0 if output, 1 of input */ -+ return !(gc->read_reg(gc->reg_dir) & gc->pin2mask(gc, gpio)); - } - - static int bgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); - unsigned long flags; - - gc->set(gc, gpio, val); - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - -- bgc->dir |= bgc->pin2mask(bgc, gpio); -- bgc->write_reg(bgc->reg_dir, bgc->dir); -+ gc->bgpio_dir |= gc->pin2mask(gc, gpio); -+ gc->write_reg(gc->reg_dir, gc->bgpio_dir); - -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - - return 0; - } - - static int bgpio_dir_in_inv(struct gpio_chip *gc, unsigned int gpio) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); - unsigned long flags; - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - -- bgc->dir |= bgc->pin2mask(bgc, gpio); -- bgc->write_reg(bgc->reg_dir, bgc->dir); -+ gc->bgpio_dir |= gc->pin2mask(gc, gpio); -+ gc->write_reg(gc->reg_dir, gc->bgpio_dir); - -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - - return 0; - } - - static int bgpio_dir_out_inv(struct gpio_chip *gc, unsigned int gpio, int val) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); - unsigned long flags; - - gc->set(gc, gpio, val); - -- spin_lock_irqsave(&bgc->lock, flags); -+ spin_lock_irqsave(&gc->bgpio_lock, flags); - -- bgc->dir &= ~bgc->pin2mask(bgc, gpio); -- bgc->write_reg(bgc->reg_dir, bgc->dir); -+ gc->bgpio_dir &= ~gc->pin2mask(gc, gpio); -+ gc->write_reg(gc->reg_dir, gc->bgpio_dir); - -- spin_unlock_irqrestore(&bgc->lock, flags); -+ spin_unlock_irqrestore(&gc->bgpio_lock, flags); - - return 0; - } - - static int bgpio_get_dir_inv(struct gpio_chip *gc, unsigned int gpio) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- -- return (bgc->read_reg(bgc->reg_dir) & bgc->pin2mask(bgc, gpio)) ? -- GPIOF_DIR_IN : GPIOF_DIR_OUT; -+ /* Return 0 if output, 1 if input */ -+ return !!(gc->read_reg(gc->reg_dir) & gc->pin2mask(gc, gpio)); - } - - static int bgpio_setup_accessors(struct device *dev, -- struct bgpio_chip *bgc, -+ struct gpio_chip *gc, - bool bit_be, - bool byte_be) - { - -- switch (bgc->bits) { -+ switch (gc->bgpio_bits) { - case 8: -- bgc->read_reg = bgpio_read8; -- bgc->write_reg = bgpio_write8; -+ gc->read_reg = bgpio_read8; -+ gc->write_reg = bgpio_write8; - break; - case 16: - if (byte_be) { -- bgc->read_reg = bgpio_read16be; -- bgc->write_reg = bgpio_write16be; -+ gc->read_reg = bgpio_read16be; -+ gc->write_reg = bgpio_write16be; - } else { -- bgc->read_reg = bgpio_read16; -- bgc->write_reg = bgpio_write16; -+ gc->read_reg = bgpio_read16; -+ gc->write_reg = bgpio_write16; - } - break; - case 32: - if (byte_be) { -- bgc->read_reg = bgpio_read32be; -- bgc->write_reg = bgpio_write32be; -+ gc->read_reg = bgpio_read32be; -+ gc->write_reg = bgpio_write32be; - } else { -- bgc->read_reg = bgpio_read32; -- bgc->write_reg = bgpio_write32; -+ gc->read_reg = bgpio_read32; -+ gc->write_reg = bgpio_write32; - } - break; - #if BITS_PER_LONG >= 64 -@@ -413,17 +393,17 @@ static int bgpio_setup_accessors(struct - "64 bit big endian byte order unsupported\n"); - return -EINVAL; - } else { -- bgc->read_reg = bgpio_read64; -- bgc->write_reg = bgpio_write64; -+ gc->read_reg = bgpio_read64; -+ gc->write_reg = bgpio_write64; - } - break; - #endif /* BITS_PER_LONG >= 64 */ - default: -- dev_err(dev, "unsupported data width %u bits\n", bgc->bits); -+ dev_err(dev, "unsupported data width %u bits\n", gc->bgpio_bits); - return -EINVAL; - } - -- bgc->pin2mask = bit_be ? bgpio_pin2mask_be : bgpio_pin2mask; -+ gc->pin2mask = bit_be ? bgpio_pin2mask_be : bgpio_pin2mask; - - return 0; - } -@@ -450,44 +430,44 @@ static int bgpio_setup_accessors(struct - * - an input direction register (named "dirin") where a 1 bit indicates - * the GPIO is an input. - */ --static int bgpio_setup_io(struct bgpio_chip *bgc, -+static int bgpio_setup_io(struct gpio_chip *gc, - void __iomem *dat, - void __iomem *set, - void __iomem *clr, - unsigned long flags) - { - -- bgc->reg_dat = dat; -- if (!bgc->reg_dat) -+ gc->reg_dat = dat; -+ if (!gc->reg_dat) - return -EINVAL; - - if (set && clr) { -- bgc->reg_set = set; -- bgc->reg_clr = clr; -- bgc->gc.set = bgpio_set_with_clear; -- bgc->gc.set_multiple = bgpio_set_multiple_with_clear; -+ gc->reg_set = set; -+ gc->reg_clr = clr; -+ gc->set = bgpio_set_with_clear; -+ gc->set_multiple = bgpio_set_multiple_with_clear; - } else if (set && !clr) { -- bgc->reg_set = set; -- bgc->gc.set = bgpio_set_set; -- bgc->gc.set_multiple = bgpio_set_multiple_set; -+ gc->reg_set = set; -+ gc->set = bgpio_set_set; -+ gc->set_multiple = bgpio_set_multiple_set; - } else if (flags & BGPIOF_NO_OUTPUT) { -- bgc->gc.set = bgpio_set_none; -- bgc->gc.set_multiple = NULL; -+ gc->set = bgpio_set_none; -+ gc->set_multiple = NULL; - } else { -- bgc->gc.set = bgpio_set; -- bgc->gc.set_multiple = bgpio_set_multiple; -+ gc->set = bgpio_set; -+ gc->set_multiple = bgpio_set_multiple; - } - - if (!(flags & BGPIOF_UNREADABLE_REG_SET) && - (flags & BGPIOF_READ_OUTPUT_REG_SET)) -- bgc->gc.get = bgpio_get_set; -+ gc->get = bgpio_get_set; - else -- bgc->gc.get = bgpio_get; -+ gc->get = bgpio_get; - - return 0; - } - --static int bgpio_setup_direction(struct bgpio_chip *bgc, -+static int bgpio_setup_direction(struct gpio_chip *gc, - void __iomem *dirout, - void __iomem *dirin, - unsigned long flags) -@@ -495,21 +475,21 @@ static int bgpio_setup_direction(struct - if (dirout && dirin) { - return -EINVAL; - } else if (dirout) { -- bgc->reg_dir = dirout; -- bgc->gc.direction_output = bgpio_dir_out; -- bgc->gc.direction_input = bgpio_dir_in; -- bgc->gc.get_direction = bgpio_get_dir; -+ gc->reg_dir = dirout; -+ gc->direction_output = bgpio_dir_out; -+ gc->direction_input = bgpio_dir_in; -+ gc->get_direction = bgpio_get_dir; - } else if (dirin) { -- bgc->reg_dir = dirin; -- bgc->gc.direction_output = bgpio_dir_out_inv; -- bgc->gc.direction_input = bgpio_dir_in_inv; -- bgc->gc.get_direction = bgpio_get_dir_inv; -+ gc->reg_dir = dirin; -+ gc->direction_output = bgpio_dir_out_inv; -+ gc->direction_input = bgpio_dir_in_inv; -+ gc->get_direction = bgpio_get_dir_inv; - } else { - if (flags & BGPIOF_NO_OUTPUT) -- bgc->gc.direction_output = bgpio_dir_out_err; -+ gc->direction_output = bgpio_dir_out_err; - else -- bgc->gc.direction_output = bgpio_simple_dir_out; -- bgc->gc.direction_input = bgpio_simple_dir_in; -+ gc->direction_output = bgpio_simple_dir_out; -+ gc->direction_input = bgpio_simple_dir_in; - } - - return 0; -@@ -523,14 +503,7 @@ static int bgpio_request(struct gpio_chi - return -EINVAL; - } - --int bgpio_remove(struct bgpio_chip *bgc) --{ -- gpiochip_remove(&bgc->gc); -- return 0; --} --EXPORT_SYMBOL_GPL(bgpio_remove); -- --int bgpio_init(struct bgpio_chip *bgc, struct device *dev, -+int bgpio_init(struct gpio_chip *gc, struct device *dev, - unsigned long sz, void __iomem *dat, void __iomem *set, - void __iomem *clr, void __iomem *dirout, void __iomem *dirin, - unsigned long flags) -@@ -540,36 +513,36 @@ int bgpio_init(struct bgpio_chip *bgc, s - if (!is_power_of_2(sz)) - return -EINVAL; - -- bgc->bits = sz * 8; -- if (bgc->bits > BITS_PER_LONG) -+ gc->bgpio_bits = sz * 8; -+ if (gc->bgpio_bits > BITS_PER_LONG) - return -EINVAL; - -- spin_lock_init(&bgc->lock); -- bgc->gc.dev = dev; -- bgc->gc.label = dev_name(dev); -- bgc->gc.base = -1; -- bgc->gc.ngpio = bgc->bits; -- bgc->gc.request = bgpio_request; -+ spin_lock_init(&gc->bgpio_lock); -+ gc->dev = dev; -+ gc->label = dev_name(dev); -+ gc->base = -1; -+ gc->ngpio = gc->bgpio_bits; -+ gc->request = bgpio_request; - -- ret = bgpio_setup_io(bgc, dat, set, clr, flags); -+ ret = bgpio_setup_io(gc, dat, set, clr, flags); - if (ret) - return ret; - -- ret = bgpio_setup_accessors(dev, bgc, flags & BGPIOF_BIG_ENDIAN, -+ ret = bgpio_setup_accessors(dev, gc, flags & BGPIOF_BIG_ENDIAN, - flags & BGPIOF_BIG_ENDIAN_BYTE_ORDER); - if (ret) - return ret; - -- ret = bgpio_setup_direction(bgc, dirout, dirin, flags); -+ ret = bgpio_setup_direction(gc, dirout, dirin, flags); - if (ret) - return ret; - -- bgc->data = bgc->read_reg(bgc->reg_dat); -- if (bgc->gc.set == bgpio_set_set && -+ gc->bgpio_data = gc->read_reg(gc->reg_dat); -+ if (gc->set == bgpio_set_set && - !(flags & BGPIOF_UNREADABLE_REG_SET)) -- bgc->data = bgc->read_reg(bgc->reg_set); -- if (bgc->reg_dir && !(flags & BGPIOF_UNREADABLE_REG_DIR)) -- bgc->dir = bgc->read_reg(bgc->reg_dir); -+ gc->bgpio_data = gc->read_reg(gc->reg_set); -+ if (gc->reg_dir && !(flags & BGPIOF_UNREADABLE_REG_DIR)) -+ gc->bgpio_dir = gc->read_reg(gc->reg_dir); - - return ret; - } -@@ -607,7 +580,7 @@ static int bgpio_pdev_probe(struct platf - unsigned long sz; - unsigned long flags = pdev->id_entry->driver_data; - int err; -- struct bgpio_chip *bgc; -+ struct gpio_chip *gc; - struct bgpio_pdata *pdata = dev_get_platdata(dev); - - r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat"); -@@ -636,32 +609,33 @@ static int bgpio_pdev_probe(struct platf - if (IS_ERR(dirin)) - return PTR_ERR(dirin); - -- bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL); -- if (!bgc) -+ gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL); -+ if (!gc) - return -ENOMEM; - -- err = bgpio_init(bgc, dev, sz, dat, set, clr, dirout, dirin, flags); -+ err = bgpio_init(gc, dev, sz, dat, set, clr, dirout, dirin, flags); - if (err) - return err; - - if (pdata) { - if (pdata->label) -- bgc->gc.label = pdata->label; -- bgc->gc.base = pdata->base; -+ gc->label = pdata->label; -+ gc->base = pdata->base; - if (pdata->ngpio > 0) -- bgc->gc.ngpio = pdata->ngpio; -+ gc->ngpio = pdata->ngpio; - } - -- platform_set_drvdata(pdev, bgc); -+ platform_set_drvdata(pdev, gc); - -- return gpiochip_add(&bgc->gc); -+ return gpiochip_add_data(gc, NULL); - } - - static int bgpio_pdev_remove(struct platform_device *pdev) - { -- struct bgpio_chip *bgc = platform_get_drvdata(pdev); -+ struct gpio_chip *gc = platform_get_drvdata(pdev); - -- return bgpio_remove(bgc); -+ gpiochip_remove(gc); -+ return 0; - } - - static const struct platform_device_id bgpio_id_table[] = { ---- a/drivers/gpio/gpio-grgpio.c -+++ b/drivers/gpio/gpio-grgpio.c -@@ -31,7 +31,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -63,7 +63,7 @@ struct grgpio_lirq { - }; - - struct grgpio_priv { -- struct bgpio_chip bgc; -+ struct gpio_chip gc; - void __iomem *regs; - struct device *dev; - -@@ -92,29 +92,22 @@ struct grgpio_priv { - struct grgpio_lirq lirqs[GRGPIO_MAX_NGPIO]; - }; - --static inline struct grgpio_priv *grgpio_gc_to_priv(struct gpio_chip *gc) --{ -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- -- return container_of(bgc, struct grgpio_priv, bgc); --} -- - static void grgpio_set_imask(struct grgpio_priv *priv, unsigned int offset, - int val) - { -- struct bgpio_chip *bgc = &priv->bgc; -- unsigned long mask = bgc->pin2mask(bgc, offset); -+ struct gpio_chip *gc = &priv->gc; -+ unsigned long mask = gc->pin2mask(gc, offset); - - if (val) - priv->imask |= mask; - else - priv->imask &= ~mask; -- bgc->write_reg(priv->regs + GRGPIO_IMASK, priv->imask); -+ gc->write_reg(priv->regs + GRGPIO_IMASK, priv->imask); - } - - static int grgpio_to_irq(struct gpio_chip *gc, unsigned offset) - { -- struct grgpio_priv *priv = grgpio_gc_to_priv(gc); -+ struct grgpio_priv *priv = gpiochip_get_data(gc); - - if (offset >= gc->ngpio) - return -ENXIO; -@@ -158,15 +151,15 @@ static int grgpio_irq_set_type(struct ir - return -EINVAL; - } - -- spin_lock_irqsave(&priv->bgc.lock, flags); -+ spin_lock_irqsave(&priv->gc.bgpio_lock, flags); - -- ipol = priv->bgc.read_reg(priv->regs + GRGPIO_IPOL) & ~mask; -- iedge = priv->bgc.read_reg(priv->regs + GRGPIO_IEDGE) & ~mask; -+ ipol = priv->gc.read_reg(priv->regs + GRGPIO_IPOL) & ~mask; -+ iedge = priv->gc.read_reg(priv->regs + GRGPIO_IEDGE) & ~mask; - -- priv->bgc.write_reg(priv->regs + GRGPIO_IPOL, ipol | pol); -- priv->bgc.write_reg(priv->regs + GRGPIO_IEDGE, iedge | edge); -+ priv->gc.write_reg(priv->regs + GRGPIO_IPOL, ipol | pol); -+ priv->gc.write_reg(priv->regs + GRGPIO_IEDGE, iedge | edge); - -- spin_unlock_irqrestore(&priv->bgc.lock, flags); -+ spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); - - return 0; - } -@@ -177,11 +170,11 @@ static void grgpio_irq_mask(struct irq_d - int offset = d->hwirq; - unsigned long flags; - -- spin_lock_irqsave(&priv->bgc.lock, flags); -+ spin_lock_irqsave(&priv->gc.bgpio_lock, flags); - - grgpio_set_imask(priv, offset, 0); - -- spin_unlock_irqrestore(&priv->bgc.lock, flags); -+ spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); - } - - static void grgpio_irq_unmask(struct irq_data *d) -@@ -190,11 +183,11 @@ static void grgpio_irq_unmask(struct irq - int offset = d->hwirq; - unsigned long flags; - -- spin_lock_irqsave(&priv->bgc.lock, flags); -+ spin_lock_irqsave(&priv->gc.bgpio_lock, flags); - - grgpio_set_imask(priv, offset, 1); - -- spin_unlock_irqrestore(&priv->bgc.lock, flags); -+ spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); - } - - static struct irq_chip grgpio_irq_chip = { -@@ -207,12 +200,12 @@ static struct irq_chip grgpio_irq_chip = - static irqreturn_t grgpio_irq_handler(int irq, void *dev) - { - struct grgpio_priv *priv = dev; -- int ngpio = priv->bgc.gc.ngpio; -+ int ngpio = priv->gc.ngpio; - unsigned long flags; - int i; - int match = 0; - -- spin_lock_irqsave(&priv->bgc.lock, flags); -+ spin_lock_irqsave(&priv->gc.bgpio_lock, flags); - - /* - * For each gpio line, call its interrupt handler if it its underlying -@@ -228,7 +221,7 @@ static irqreturn_t grgpio_irq_handler(in - } - } - -- spin_unlock_irqrestore(&priv->bgc.lock, flags); -+ spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); - - if (!match) - dev_warn(priv->dev, "No gpio line matched irq %d\n", irq); -@@ -260,7 +253,7 @@ static int grgpio_irq_map(struct irq_dom - dev_dbg(priv->dev, "Mapping irq %d for gpio line %d\n", - irq, offset); - -- spin_lock_irqsave(&priv->bgc.lock, flags); -+ spin_lock_irqsave(&priv->gc.bgpio_lock, flags); - - /* Request underlying irq if not already requested */ - lirq->irq = irq; -@@ -273,14 +266,14 @@ static int grgpio_irq_map(struct irq_dom - "Could not request underlying irq %d\n", - uirq->uirq); - -- spin_unlock_irqrestore(&priv->bgc.lock, flags); -+ spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); - - return ret; - } - } - uirq->refcnt++; - -- spin_unlock_irqrestore(&priv->bgc.lock, flags); -+ spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); - - /* Setup irq */ - irq_set_chip_data(irq, priv); -@@ -298,13 +291,13 @@ static void grgpio_irq_unmap(struct irq_ - struct grgpio_lirq *lirq; - struct grgpio_uirq *uirq; - unsigned long flags; -- int ngpio = priv->bgc.gc.ngpio; -+ int ngpio = priv->gc.ngpio; - int i; - - irq_set_chip_and_handler(irq, NULL, NULL); - irq_set_chip_data(irq, NULL); - -- spin_lock_irqsave(&priv->bgc.lock, flags); -+ spin_lock_irqsave(&priv->gc.bgpio_lock, flags); - - /* Free underlying irq if last user unmapped */ - index = -1; -@@ -326,7 +319,7 @@ static void grgpio_irq_unmap(struct irq_ - free_irq(uirq->uirq, priv); - } - -- spin_unlock_irqrestore(&priv->bgc.lock, flags); -+ spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); - } - - static const struct irq_domain_ops grgpio_irq_domain_ops = { -@@ -341,7 +334,6 @@ static int grgpio_probe(struct platform_ - struct device_node *np = ofdev->dev.of_node; - void __iomem *regs; - struct gpio_chip *gc; -- struct bgpio_chip *bgc; - struct grgpio_priv *priv; - struct resource *res; - int err; -@@ -359,8 +351,8 @@ static int grgpio_probe(struct platform_ - if (IS_ERR(regs)) - return PTR_ERR(regs); - -- bgc = &priv->bgc; -- err = bgpio_init(bgc, &ofdev->dev, 4, regs + GRGPIO_DATA, -+ gc = &priv->gc; -+ err = bgpio_init(gc, &ofdev->dev, 4, regs + GRGPIO_DATA, - regs + GRGPIO_OUTPUT, NULL, regs + GRGPIO_DIR, NULL, - BGPIOF_BIG_ENDIAN_BYTE_ORDER); - if (err) { -@@ -369,10 +361,9 @@ static int grgpio_probe(struct platform_ - } - - priv->regs = regs; -- priv->imask = bgc->read_reg(regs + GRGPIO_IMASK); -+ priv->imask = gc->read_reg(regs + GRGPIO_IMASK); - priv->dev = &ofdev->dev; - -- gc = &bgc->gc; - gc->of_node = np; - gc->owner = THIS_MODULE; - gc->to_irq = grgpio_to_irq; -@@ -435,7 +426,7 @@ static int grgpio_probe(struct platform_ - - platform_set_drvdata(ofdev, priv); - -- err = gpiochip_add(gc); -+ err = gpiochip_add_data(gc, priv); - if (err) { - dev_err(&ofdev->dev, "Could not add gpiochip\n"); - if (priv->domain) -@@ -456,7 +447,7 @@ static int grgpio_remove(struct platform - int i; - int ret = 0; - -- spin_lock_irqsave(&priv->bgc.lock, flags); -+ spin_lock_irqsave(&priv->gc.bgpio_lock, flags); - - if (priv->domain) { - for (i = 0; i < GRGPIO_MAX_NGPIO; i++) { -@@ -467,13 +458,13 @@ static int grgpio_remove(struct platform - } - } - -- gpiochip_remove(&priv->bgc.gc); -+ gpiochip_remove(&priv->gc); - - if (priv->domain) - irq_domain_remove(priv->domain); - - out: -- spin_unlock_irqrestore(&priv->bgc.lock, flags); -+ spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); - - return ret; - } ---- a/drivers/gpio/gpio-moxart.c -+++ b/drivers/gpio/gpio-moxart.c -@@ -14,7 +14,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -23,7 +22,7 @@ - #include - #include - #include --#include -+#include - - #define GPIO_DATA_OUT 0x00 - #define GPIO_DATA_IN 0x04 -@@ -33,12 +32,12 @@ static int moxart_gpio_probe(struct plat - { - struct device *dev = &pdev->dev; - struct resource *res; -- struct bgpio_chip *bgc; -+ struct gpio_chip *gc; - void __iomem *base; - int ret; - -- bgc = devm_kzalloc(dev, sizeof(*bgc), GFP_KERNEL); -- if (!bgc) -+ gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL); -+ if (!gc) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -@@ -46,7 +45,7 @@ static int moxart_gpio_probe(struct plat - if (IS_ERR(base)) - return PTR_ERR(base); - -- ret = bgpio_init(bgc, dev, 4, base + GPIO_DATA_IN, -+ ret = bgpio_init(gc, dev, 4, base + GPIO_DATA_IN, - base + GPIO_DATA_OUT, NULL, - base + GPIO_PIN_DIRECTION, NULL, - BGPIOF_READ_OUTPUT_REG_SET); -@@ -55,16 +54,16 @@ static int moxart_gpio_probe(struct plat - return ret; - } - -- bgc->gc.label = "moxart-gpio"; -- bgc->gc.request = gpiochip_generic_request; -- bgc->gc.free = gpiochip_generic_free; -- bgc->data = bgc->read_reg(bgc->reg_set); -- bgc->gc.base = 0; -- bgc->gc.ngpio = 32; -- bgc->gc.dev = dev; -- bgc->gc.owner = THIS_MODULE; -+ gc->label = "moxart-gpio"; -+ gc->request = gpiochip_generic_request; -+ gc->free = gpiochip_generic_free; -+ gc->bgpio_data = bgc->read_reg(bgc->reg_set); -+ gc->base = 0; -+ gc->ngpio = 32; -+ gc->dev = dev; -+ gc->owner = THIS_MODULE; - -- ret = gpiochip_add(&bgc->gc); -+ ret = gpiochip_add_data(gc, NULL); - if (ret) { - dev_err(dev, "%s: gpiochip_add failed\n", - dev->of_node->full_name); ---- a/drivers/gpio/gpio-mxc.c -+++ b/drivers/gpio/gpio-mxc.c -@@ -26,10 +26,11 @@ - #include - #include - #include --#include - #include - #include --#include -+#include -+/* FIXME: for gpio_get_value() replace this with direct register read */ -+#include - #include - #include - #include -@@ -64,7 +65,7 @@ struct mxc_gpio_port { - int irq; - int irq_high; - struct irq_domain *domain; -- struct bgpio_chip bgc; -+ struct gpio_chip gc; - u32 both_edges; - }; - -@@ -172,7 +173,7 @@ static int gpio_set_irq_type(struct irq_ - struct mxc_gpio_port *port = gc->private; - u32 bit, val; - u32 gpio_idx = d->hwirq; -- u32 gpio = port->bgc.gc.base + gpio_idx; -+ u32 gpio = port->gc.base + gpio_idx; - int edge; - void __iomem *reg = port->base; - -@@ -398,9 +399,7 @@ static void mxc_gpio_get_hw(struct platf - - static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- struct mxc_gpio_port *port = -- container_of(bgc, struct mxc_gpio_port, bgc); -+ struct mxc_gpio_port *port = gpiochip_get_data(gc); - - return irq_find_mapping(port->domain, offset); - } -@@ -451,7 +450,7 @@ static int mxc_gpio_probe(struct platfor - port); - } - -- err = bgpio_init(&port->bgc, &pdev->dev, 4, -+ err = bgpio_init(&port->gc, &pdev->dev, 4, - port->base + GPIO_PSR, - port->base + GPIO_DR, NULL, - port->base + GPIO_GDIR, NULL, -@@ -459,13 +458,13 @@ static int mxc_gpio_probe(struct platfor - if (err) - goto out_bgio; - -- port->bgc.gc.to_irq = mxc_gpio_to_irq; -- port->bgc.gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 : -+ port->gc.to_irq = mxc_gpio_to_irq; -+ port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 : - pdev->id * 32; - -- err = gpiochip_add(&port->bgc.gc); -+ err = gpiochip_add_data(&port->gc, port); - if (err) -- goto out_bgpio_remove; -+ goto out_bgio; - - irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id()); - if (irq_base < 0) { -@@ -494,9 +493,7 @@ out_irqdomain_remove: - out_irqdesc_free: - irq_free_descs(irq_base, 32); - out_gpiochip_remove: -- gpiochip_remove(&port->bgc.gc); --out_bgpio_remove: -- bgpio_remove(&port->bgc); -+ gpiochip_remove(&port->gc); - out_bgio: - dev_info(&pdev->dev, "%s failed with errno %d\n", __func__, err); - return err; ---- a/drivers/gpio/gpio-mxs.c -+++ b/drivers/gpio/gpio-mxs.c -@@ -26,13 +26,14 @@ - #include - #include - #include --#include - #include - #include - #include - #include - #include --#include -+#include -+/* FIXME: for gpio_get_value(), replace this by direct register read */ -+#include - #include - - #define MXS_SET 0x4 -@@ -64,7 +65,7 @@ struct mxs_gpio_port { - int id; - int irq; - struct irq_domain *domain; -- struct bgpio_chip bgc; -+ struct gpio_chip gc; - enum mxs_gpio_id devid; - u32 both_edges; - }; -@@ -93,7 +94,7 @@ static int mxs_gpio_set_irq_type(struct - port->both_edges &= ~pin_mask; - switch (type) { - case IRQ_TYPE_EDGE_BOTH: -- val = gpio_get_value(port->bgc.gc.base + d->hwirq); -+ val = gpio_get_value(port->gc.base + d->hwirq); - if (val) - edge = GPIO_INT_FALL_EDGE; - else -@@ -225,18 +226,14 @@ static int __init mxs_gpio_init_gc(struc - - static int mxs_gpio_to_irq(struct gpio_chip *gc, unsigned offset) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- struct mxs_gpio_port *port = -- container_of(bgc, struct mxs_gpio_port, bgc); -+ struct mxs_gpio_port *port = gpiochip_get_data(gc); - - return irq_find_mapping(port->domain, offset); - } - - static int mxs_gpio_get_direction(struct gpio_chip *gc, unsigned offset) - { -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- struct mxs_gpio_port *port = -- container_of(bgc, struct mxs_gpio_port, bgc); -+ struct mxs_gpio_port *port = gpiochip_get_data(gc); - u32 mask = 1 << offset; - u32 dir; - -@@ -330,26 +327,24 @@ static int mxs_gpio_probe(struct platfor - irq_set_chained_handler_and_data(port->irq, mxs_gpio_irq_handler, - port); - -- err = bgpio_init(&port->bgc, &pdev->dev, 4, -+ err = bgpio_init(&port->gc, &pdev->dev, 4, - port->base + PINCTRL_DIN(port), - port->base + PINCTRL_DOUT(port) + MXS_SET, - port->base + PINCTRL_DOUT(port) + MXS_CLR, - port->base + PINCTRL_DOE(port), NULL, 0); - if (err) -- goto out_irqdesc_free; -+ goto out_irqdomain_remove; - -- port->bgc.gc.to_irq = mxs_gpio_to_irq; -- port->bgc.gc.get_direction = mxs_gpio_get_direction; -- port->bgc.gc.base = port->id * 32; -+ port->gc.to_irq = mxs_gpio_to_irq; -+ port->gc.get_direction = mxs_gpio_get_direction; -+ port->gc.base = port->id * 32; - -- err = gpiochip_add(&port->bgc.gc); -+ err = gpiochip_add_data(&port->gc, port); - if (err) -- goto out_bgpio_remove; -+ goto out_irqdomain_remove; - - return 0; - --out_bgpio_remove: -- bgpio_remove(&port->bgc); - out_irqdomain_remove: - irq_domain_remove(port->domain); - out_irqdesc_free: ---- a/drivers/gpio/gpio-sodaville.c -+++ b/drivers/gpio/gpio-sodaville.c -@@ -10,7 +10,6 @@ - */ - - #include --#include - #include - #include - #include -@@ -20,7 +19,7 @@ - #include - #include - #include --#include -+#include - - #define DRV_NAME "sdv_gpio" - #define SDV_NUM_PUB_GPIOS 12 -@@ -43,7 +42,7 @@ struct sdv_gpio_chip_data { - void __iomem *gpio_pub_base; - struct irq_domain *id; - struct irq_chip_generic *gc; -- struct bgpio_chip bgpio; -+ struct gpio_chip chip; - }; - - static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type) -@@ -226,14 +225,14 @@ static int sdv_gpio_probe(struct pci_dev - writel(mux_val, sd->gpio_pub_base + GPMUXCTL); - } - -- ret = bgpio_init(&sd->bgpio, &pdev->dev, 4, -+ ret = bgpio_init(&sd->chip, &pdev->dev, 4, - sd->gpio_pub_base + GPINR, sd->gpio_pub_base + GPOUTR, - NULL, sd->gpio_pub_base + GPOER, NULL, 0); - if (ret) - goto unmap; -- sd->bgpio.gc.ngpio = SDV_NUM_PUB_GPIOS; -+ sd->chip.ngpio = SDV_NUM_PUB_GPIOS; - -- ret = gpiochip_add(&sd->bgpio.gc); -+ ret = gpiochip_add_data(&sd->chip, sd); - if (ret < 0) { - dev_err(&pdev->dev, "gpiochip_add() failed.\n"); - goto unmap; -@@ -265,7 +264,7 @@ static void sdv_gpio_remove(struct pci_d - free_irq(pdev->irq, sd); - irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); - -- gpiochip_remove(&sd->bgpio.gc); -+ gpiochip_remove(&sd->chip); - pci_release_region(pdev, GPIO_BAR); - iounmap(sd->gpio_pub_base); - pci_disable_device(pdev); ---- a/drivers/gpio/gpio-xgene-sb.c -+++ b/drivers/gpio/gpio-xgene-sb.c -@@ -23,10 +23,8 @@ - #include - #include - #include --#include - #include - #include --#include - - #include "gpiolib.h" - -@@ -43,38 +41,31 @@ - - /** - * struct xgene_gpio_sb - GPIO-Standby private data structure. -- * @bgc: memory-mapped GPIO controllers. -+ * @gc: memory-mapped GPIO controllers. - * @irq: Mapping GPIO pins and interrupt number - * nirq: Number of GPIO pins that supports interrupt - */ - struct xgene_gpio_sb { -- struct bgpio_chip bgc; -+ struct gpio_chip gc; - u32 *irq; - u32 nirq; - }; - --static inline struct xgene_gpio_sb *to_xgene_gpio_sb(struct gpio_chip *gc) --{ -- struct bgpio_chip *bgc = to_bgpio_chip(gc); -- -- return container_of(bgc, struct xgene_gpio_sb, bgc); --} -- --static void xgene_gpio_set_bit(struct bgpio_chip *bgc, void __iomem *reg, u32 gpio, int val) -+static void xgene_gpio_set_bit(struct gpio_chip *gc, void __iomem *reg, u32 gpio, int val) - { - u32 data; - -- data = bgc->read_reg(reg); -+ data = gc->read_reg(reg); - if (val) - data |= GPIO_MASK(gpio); - else - data &= ~GPIO_MASK(gpio); -- bgc->write_reg(reg, data); -+ gc->write_reg(reg, data); - } - - static int apm_gpio_sb_to_irq(struct gpio_chip *gc, u32 gpio) - { -- struct xgene_gpio_sb *priv = to_xgene_gpio_sb(gc); -+ struct xgene_gpio_sb *priv = gpiochip_get_data(gc); - - if (priv->irq[gpio]) - return priv->irq[gpio]; -@@ -99,15 +90,15 @@ static int xgene_gpio_sb_probe(struct pl - if (IS_ERR(regs)) - return PTR_ERR(regs); - -- ret = bgpio_init(&priv->bgc, &pdev->dev, 4, -+ ret = bgpio_init(&priv->gc, &pdev->dev, 4, - regs + MPA_GPIO_IN_ADDR, - regs + MPA_GPIO_OUT_ADDR, NULL, - regs + MPA_GPIO_OE_ADDR, NULL, 0); - if (ret) - return ret; - -- priv->bgc.gc.to_irq = apm_gpio_sb_to_irq; -- priv->bgc.gc.ngpio = XGENE_MAX_GPIO_DS; -+ priv->gc.to_irq = apm_gpio_sb_to_irq; -+ priv->gc.ngpio = XGENE_MAX_GPIO_DS; - - priv->nirq = XGENE_MAX_GPIO_DS_IRQ; - -@@ -118,14 +109,14 @@ static int xgene_gpio_sb_probe(struct pl - - for (i = 0; i < priv->nirq; i++) { - priv->irq[default_lines[i]] = platform_get_irq(pdev, i); -- xgene_gpio_set_bit(&priv->bgc, regs + MPA_GPIO_SEL_LO, -+ xgene_gpio_set_bit(&priv->gc, regs + MPA_GPIO_SEL_LO, - default_lines[i] * 2, 1); -- xgene_gpio_set_bit(&priv->bgc, regs + MPA_GPIO_INT_LVL, i, 1); -+ xgene_gpio_set_bit(&priv->gc, regs + MPA_GPIO_INT_LVL, i, 1); - } - - platform_set_drvdata(pdev, priv); - -- ret = gpiochip_add(&priv->bgc.gc); -+ ret = gpiochip_add_data(&priv->gc, priv); - if (ret) - dev_err(&pdev->dev, "failed to register X-Gene GPIO Standby driver\n"); - else -@@ -133,7 +124,7 @@ static int xgene_gpio_sb_probe(struct pl - - if (priv->nirq > 0) { - /* Register interrupt handlers for gpio signaled acpi events */ -- acpi_gpiochip_request_interrupts(&priv->bgc.gc); -+ acpi_gpiochip_request_interrupts(&priv->gc); - } - - return ret; -@@ -144,10 +135,11 @@ static int xgene_gpio_sb_remove(struct p - struct xgene_gpio_sb *priv = platform_get_drvdata(pdev); - - if (priv->nirq > 0) { -- acpi_gpiochip_free_interrupts(&priv->bgc.gc); -+ acpi_gpiochip_free_interrupts(&priv->gc); - } - -- return bgpio_remove(&priv->bgc); -+ gpiochip_remove(&priv->gc); -+ return 0; - } - - static const struct of_device_id xgene_gpio_sb_of_match[] = { ---- a/drivers/mfd/vexpress-sysreg.c -+++ b/drivers/mfd/vexpress-sysreg.c -@@ -11,7 +11,7 @@ - * Copyright (C) 2012 ARM Limited - */ - --#include -+#include - #include - #include - #include -@@ -164,7 +164,7 @@ static int vexpress_sysreg_probe(struct - { - struct resource *mem; - void __iomem *base; -- struct bgpio_chip *mmc_gpio_chip; -+ struct gpio_chip *mmc_gpio_chip; - int master; - u32 dt_hbi; - -@@ -201,8 +201,8 @@ static int vexpress_sysreg_probe(struct - return -ENOMEM; - bgpio_init(mmc_gpio_chip, &pdev->dev, 0x4, base + SYS_MCI, - NULL, NULL, NULL, NULL, 0); -- mmc_gpio_chip->gc.ngpio = 2; -- gpiochip_add(&mmc_gpio_chip->gc); -+ mmc_gpio_chip->ngpio = 2; -+ gpiochip_add(mmc_gpio_chip); - - return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, - vexpress_sysreg_cells, ---- a/include/linux/basic_mmio_gpio.h -+++ /dev/null -@@ -1,80 +0,0 @@ --/* -- * Basic memory-mapped GPIO controllers. -- * -- * Copyright 2008 MontaVista Software, Inc. -- * Copyright 2008,2010 Anton Vorontsov -- * -- * 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 __BASIC_MMIO_GPIO_H --#define __BASIC_MMIO_GPIO_H -- --#include --#include --#include --#include -- --struct bgpio_pdata { -- const char *label; -- int base; -- int ngpio; --}; -- --struct device; -- --struct bgpio_chip { -- struct gpio_chip gc; -- -- unsigned long (*read_reg)(void __iomem *reg); -- void (*write_reg)(void __iomem *reg, unsigned long data); -- -- void __iomem *reg_dat; -- void __iomem *reg_set; -- void __iomem *reg_clr; -- void __iomem *reg_dir; -- -- /* Number of bits (GPIOs): * 8. */ -- int bits; -- -- /* -- * Some GPIO controllers work with the big-endian bits notation, -- * e.g. in a 8-bits register, GPIO7 is the least significant bit. -- */ -- unsigned long (*pin2mask)(struct bgpio_chip *bgc, unsigned int pin); -- -- /* -- * Used to lock bgpio_chip->data. Also, this is needed to keep -- * shadowed and real data registers writes together. -- */ -- spinlock_t lock; -- -- /* Shadowed data register to clear/set bits safely. */ -- unsigned long data; -- -- /* Shadowed direction registers to clear/set direction safely. */ -- unsigned long dir; --}; -- --static inline struct bgpio_chip *to_bgpio_chip(struct gpio_chip *gc) --{ -- return container_of(gc, struct bgpio_chip, gc); --} -- --int bgpio_remove(struct bgpio_chip *bgc); --int bgpio_init(struct bgpio_chip *bgc, struct device *dev, -- unsigned long sz, void __iomem *dat, void __iomem *set, -- void __iomem *clr, void __iomem *dirout, void __iomem *dirin, -- unsigned long flags); -- --#define BGPIOF_BIG_ENDIAN BIT(0) --#define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */ --#define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */ --#define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3) --#define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */ --#define BGPIOF_NO_OUTPUT BIT(5) /* only input */ -- --#endif /* __BASIC_MMIO_GPIO_H */ ---- a/include/linux/gpio/driver.h -+++ b/include/linux/gpio/driver.h -@@ -8,6 +8,7 @@ - #include - #include - #include -+#include - - struct device; - struct gpio_desc; -@@ -66,6 +67,23 @@ struct seq_file; - * registers. - * @irq_not_threaded: flag must be set if @can_sleep is set but the - * IRQs don't need to be threaded -+ * @read_reg: reader function for generic GPIO -+ * @write_reg: writer function for generic GPIO -+ * @pin2mask: some generic GPIO controllers work with the big-endian bits -+ * notation, e.g. in a 8-bits register, GPIO7 is the least significant -+ * bit. This callback assigns the right bit mask. -+ * @reg_dat: data (in) register for generic GPIO -+ * @reg_set: output set register (out=high) for generic GPIO -+ * @reg_clk: output clear register (out=low) for generic GPIO -+ * @reg_dir: direction setting register for generic GPIO -+ * @bgpio_bits: number of register bits used for a generic GPIO i.e. -+ * * 8 -+ * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep -+ * shadowed and real data registers writes together. -+ * @bgpio_data: shadowed data register for generic GPIO to clear/set bits -+ * safely. -+ * @bgpio_dir: shadowed direction register for generic GPIO to clear/set -+ * direction safely. - * @irqchip: GPIO IRQ chip impl, provided by GPIO driver - * @irqdomain: Interrupt translation domain; responsible for mapping - * between GPIO hwirq number and linux irq number -@@ -129,6 +147,20 @@ struct gpio_chip { - bool can_sleep; - bool irq_not_threaded; - -+#if IS_ENABLED(CONFIG_GPIO_GENERIC) -+ unsigned long (*read_reg)(void __iomem *reg); -+ void (*write_reg)(void __iomem *reg, unsigned long data); -+ unsigned long (*pin2mask)(struct gpio_chip *gc, unsigned int pin); -+ void __iomem *reg_dat; -+ void __iomem *reg_set; -+ void __iomem *reg_clr; -+ void __iomem *reg_dir; -+ int bgpio_bits; -+ spinlock_t bgpio_lock; -+ unsigned long bgpio_data; -+ unsigned long bgpio_dir; -+#endif -+ - #ifdef CONFIG_GPIOLIB_IRQCHIP - /* - * With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib -@@ -189,6 +221,28 @@ static inline void *gpiochip_get_data(st - - struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); - -+#if IS_ENABLED(CONFIG_GPIO_GENERIC) -+ -+struct bgpio_pdata { -+ const char *label; -+ int base; -+ int ngpio; -+}; -+ -+int bgpio_init(struct gpio_chip *gc, struct device *dev, -+ unsigned long sz, void __iomem *dat, void __iomem *set, -+ void __iomem *clr, void __iomem *dirout, void __iomem *dirin, -+ unsigned long flags); -+ -+#define BGPIOF_BIG_ENDIAN BIT(0) -+#define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */ -+#define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */ -+#define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3) -+#define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */ -+#define BGPIOF_NO_OUTPUT BIT(5) /* only input */ -+ -+#endif -+ - #ifdef CONFIG_GPIOLIB_IRQCHIP - - void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, diff --git a/target/linux/brcm63xx/patches-4.4/000-4.6-01-gpio-Add-devm_-apis-for-gpiochip_add_data-and-gpioch.patch b/target/linux/brcm63xx/patches-4.4/000-4.6-01-gpio-Add-devm_-apis-for-gpiochip_add_data-and-gpioch.patch deleted file mode 100644 index ab2fb07ff..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.6-01-gpio-Add-devm_-apis-for-gpiochip_add_data-and-gpioch.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 0cf3292cde22f8843ae5d1eeb8466d8121243c1a Mon Sep 17 00:00:00 2001 -From: Laxman Dewangan -Date: Mon, 15 Feb 2016 16:32:09 +0530 -Subject: [PATCH] gpio: Add devm_ apis for gpiochip_add_data and - gpiochip_remove - -Add device managed APIs devm_gpiochip_add_data() and -devm_gpiochip_remove() for the APIs gpiochip_add_data() -and gpiochip_remove(). - -This helps in reducing code in error path and sometimes -removal of .remove callback for driver unbind. - -Signed-off-by: Laxman Dewangan ---- - drivers/gpio/gpiolib.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ - include/linux/gpio/driver.h | 4 +++ - 2 files changed, 78 insertions(+) - ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -433,6 +433,80 @@ void gpiochip_remove(struct gpio_chip *c - } - EXPORT_SYMBOL_GPL(gpiochip_remove); - -+static void devm_gpio_chip_release(struct device *dev, void *res) -+{ -+ struct gpio_chip *chip = *(struct gpio_chip **)res; -+ -+ gpiochip_remove(chip); -+} -+ -+static int devm_gpio_chip_match(struct device *dev, void *res, void *data) -+ -+{ -+ struct gpio_chip **r = res; -+ -+ if (!r || !*r) { -+ WARN_ON(!r || !*r); -+ return 0; -+ } -+ -+ return *r == data; -+} -+ -+/** -+ * devm_gpiochip_add_data() - Resource manager piochip_add_data() -+ * @dev: the device pointer on which irq_chip belongs to. -+ * @chip: the chip to register, with chip->base initialized -+ * Context: potentially before irqs will work -+ * -+ * Returns a negative errno if the chip can't be registered, such as -+ * because the chip->base is invalid or already associated with a -+ * different chip. Otherwise it returns zero as a success code. -+ * -+ * The gpio chip automatically be released when the device is unbound. -+ */ -+int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip, -+ void *data) -+{ -+ struct gpio_chip **ptr; -+ int ret; -+ -+ ptr = devres_alloc(devm_gpio_chip_release, sizeof(*ptr), -+ GFP_KERNEL); -+ if (!ptr) -+ return -ENOMEM; -+ -+ ret = gpiochip_add_data(chip, data); -+ if (ret < 0) { -+ devres_free(ptr); -+ return ret; -+ } -+ -+ *ptr = chip; -+ devres_add(dev, ptr); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(devm_gpiochip_add_data); -+ -+/** -+ * devm_gpiochip_remove() - Resource manager of gpiochip_remove() -+ * @dev: device for which which resource was allocated -+ * @chip: the chip to remove -+ * -+ * A gpio_chip with any GPIOs still requested may not be removed. -+ */ -+void devm_gpiochip_remove(struct device *dev, struct gpio_chip *chip) -+{ -+ int ret; -+ -+ ret = devres_release(dev, devm_gpio_chip_release, -+ devm_gpio_chip_match, chip); -+ if (!ret) -+ WARN_ON(ret); -+} -+EXPORT_SYMBOL_GPL(devm_gpiochip_remove); -+ - /** - * gpiochip_find() - iterator for locating a specific gpio_chip - * @data: data to pass to match function ---- a/include/linux/gpio/driver.h -+++ b/include/linux/gpio/driver.h -@@ -206,6 +206,10 @@ static inline int gpiochip_add(struct gp - return gpiochip_add_data(chip, NULL); - } - extern void gpiochip_remove(struct gpio_chip *chip); -+extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip, -+ void *data); -+extern void devm_gpiochip_remove(struct device *dev, struct gpio_chip *chip); -+ - extern struct gpio_chip *gpiochip_find(void *data, - int (*match)(struct gpio_chip *chip, void *data)); - diff --git a/target/linux/brcm63xx/patches-4.4/000-4.7-01-pinctrl-Add-devm_-apis-for-pinctrl_-register-unregis.patch b/target/linux/brcm63xx/patches-4.4/000-4.7-01-pinctrl-Add-devm_-apis-for-pinctrl_-register-unregis.patch deleted file mode 100644 index 205b6d700..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.7-01-pinctrl-Add-devm_-apis-for-pinctrl_-register-unregis.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 80e0f8d94d3090f0f7bf3faf3e6180e920ee0d22 Mon Sep 17 00:00:00 2001 -From: Laxman Dewangan -Date: Wed, 24 Feb 2016 14:12:59 +0530 -Subject: [PATCH] pinctrl: Add devm_ apis for pinctrl_{register, unregister} - -Add device managed APIs devm_pinctrl_register() and -devm_pinctrl_unregister() for the APIs pinctrl_register() -and pinctrl_unregister(). - -This helps in reducing code in error path and sometimes -removal of .remove callback for driver unbind. - -Signed-off-by: Laxman Dewangan -Reviewed-by: Philipp Zabel -Acked-by: Bjorn Andersson -Signed-off-by: Linus Walleij ---- - drivers/pinctrl/core.c | 63 +++++++++++++++++++++++++++++++++++++++++ - include/linux/pinctrl/pinctrl.h | 6 ++++ - 2 files changed, 69 insertions(+) - ---- a/drivers/pinctrl/core.c -+++ b/drivers/pinctrl/core.c -@@ -1861,6 +1861,69 @@ void pinctrl_unregister(struct pinctrl_d - } - EXPORT_SYMBOL_GPL(pinctrl_unregister); - -+static void devm_pinctrl_dev_release(struct device *dev, void *res) -+{ -+ struct pinctrl_dev *pctldev = *(struct pinctrl_dev **)res; -+ -+ pinctrl_unregister(pctldev); -+} -+ -+static int devm_pinctrl_dev_match(struct device *dev, void *res, void *data) -+{ -+ struct pctldev **r = res; -+ -+ if (WARN_ON(!r || !*r)) -+ return 0; -+ -+ return *r == data; -+} -+ -+/** -+ * devm_pinctrl_register() - Resource managed version of pinctrl_register(). -+ * @dev: parent device for this pin controller -+ * @pctldesc: descriptor for this pin controller -+ * @driver_data: private pin controller data for this pin controller -+ * -+ * Returns an error pointer if pincontrol register failed. Otherwise -+ * it returns valid pinctrl handle. -+ * -+ * The pinctrl device will be automatically released when the device is unbound. -+ */ -+struct pinctrl_dev *devm_pinctrl_register(struct device *dev, -+ struct pinctrl_desc *pctldesc, -+ void *driver_data) -+{ -+ struct pinctrl_dev **ptr, *pctldev; -+ -+ ptr = devres_alloc(devm_pinctrl_dev_release, sizeof(*ptr), GFP_KERNEL); -+ if (!ptr) -+ return ERR_PTR(-ENOMEM); -+ -+ pctldev = pinctrl_register(pctldesc, dev, driver_data); -+ if (IS_ERR(pctldev)) { -+ devres_free(ptr); -+ return pctldev; -+ } -+ -+ *ptr = pctldev; -+ devres_add(dev, ptr); -+ -+ return pctldev; -+} -+EXPORT_SYMBOL_GPL(devm_pinctrl_register); -+ -+/** -+ * devm_pinctrl_unregister() - Resource managed version of pinctrl_unregister(). -+ * @dev: device for which which resource was allocated -+ * @pctldev: the pinctrl device to unregister. -+ */ -+void devm_pinctrl_unregister(struct device *dev, struct pinctrl_dev *pctldev) -+{ -+ WARN_ON(devres_release(dev, devm_pinctrl_dev_release, -+ devm_pinctrl_dev_match, pctldev)); -+} -+EXPORT_SYMBOL_GPL(devm_pinctrl_unregister); -+ - static int __init pinctrl_init(void) - { - pr_info("initialized pinctrl subsystem\n"); ---- a/include/linux/pinctrl/pinctrl.h -+++ b/include/linux/pinctrl/pinctrl.h -@@ -144,6 +144,12 @@ struct pinctrl_desc { - extern struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, - struct device *dev, void *driver_data); - extern void pinctrl_unregister(struct pinctrl_dev *pctldev); -+extern struct pinctrl_dev *devm_pinctrl_register(struct device *dev, -+ struct pinctrl_desc *pctldesc, -+ void *driver_data); -+extern void devm_pinctrl_unregister(struct device *dev, -+ struct pinctrl_dev *pctldev); -+ - extern bool pin_is_valid(struct pinctrl_dev *pctldev, int pin); - extern void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev, - struct pinctrl_gpio_range *range); diff --git a/target/linux/brcm63xx/patches-4.4/000-4.7-02-pinctrl-Rename-pinctrl_utils_dt_free_map-to-pinctrl_.patch b/target/linux/brcm63xx/patches-4.4/000-4.7-02-pinctrl-Rename-pinctrl_utils_dt_free_map-to-pinctrl_.patch deleted file mode 100644 index 5acb37959..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.7-02-pinctrl-Rename-pinctrl_utils_dt_free_map-to-pinctrl_.patch +++ /dev/null @@ -1,59 +0,0 @@ -From d32f7fd3bbc32732b094d938b95169521503a9fb Mon Sep 17 00:00:00 2001 -From: Irina Tirdea -Date: Thu, 31 Mar 2016 14:44:42 +0300 -Subject: [PATCH] pinctrl: Rename pinctrl_utils_dt_free_map to - pinctrl_utils_free_map - -Rename pinctrl_utils_dt_free_map to pinctrl_utils_free_map, since -it does not depend on device tree despite the current name. This -will enforce a consistent naming in pinctr-utils.c and will make -it clear it can be called from outside device tree (e.g. from -ACPI handling code). - -Signed-off-by: Irina Tirdea -Signed-off-by: Linus Walleij ---- - drivers/pinctrl/pinconf-generic.c | 2 +- - drivers/pinctrl/pinctrl-utils.c | 4 ++-- - drivers/pinctrl/pinctrl-utils.h | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/pinctrl/pinconf-generic.c -+++ b/drivers/pinctrl/pinconf-generic.c -@@ -385,7 +385,7 @@ int pinconf_generic_dt_node_to_map(struc - return 0; - - exit: -- pinctrl_utils_dt_free_map(pctldev, *map, *num_maps); -+ pinctrl_utils_free_map(pctldev, *map, *num_maps); - return ret; - } - EXPORT_SYMBOL_GPL(pinconf_generic_dt_node_to_map); ---- a/drivers/pinctrl/pinctrl-utils.c -+++ b/drivers/pinctrl/pinctrl-utils.c -@@ -122,7 +122,7 @@ int pinctrl_utils_add_config(struct pinc - } - EXPORT_SYMBOL_GPL(pinctrl_utils_add_config); - --void pinctrl_utils_dt_free_map(struct pinctrl_dev *pctldev, -+void pinctrl_utils_free_map(struct pinctrl_dev *pctldev, - struct pinctrl_map *map, unsigned num_maps) - { - int i; -@@ -139,4 +139,4 @@ void pinctrl_utils_dt_free_map(struct pi - } - kfree(map); - } --EXPORT_SYMBOL_GPL(pinctrl_utils_dt_free_map); -+EXPORT_SYMBOL_GPL(pinctrl_utils_free_map); ---- a/drivers/pinctrl/pinctrl-utils.h -+++ b/drivers/pinctrl/pinctrl-utils.h -@@ -37,7 +37,7 @@ int pinctrl_utils_add_map_configs(struct - int pinctrl_utils_add_config(struct pinctrl_dev *pctldev, - unsigned long **configs, unsigned *num_configs, - unsigned long config); --void pinctrl_utils_dt_free_map(struct pinctrl_dev *pctldev, -+void pinctrl_utils_free_map(struct pinctrl_dev *pctldev, - struct pinctrl_map *map, unsigned num_maps); - - #endif /* __PINCTRL_UTILS_H__ */ diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-01-mtd-spi-nor-change-return-value-of-read-write.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-01-mtd-spi-nor-change-return-value-of-read-write.patch deleted file mode 100644 index 31c24e51a..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-01-mtd-spi-nor-change-return-value-of-read-write.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 59451e1233bd315c5379a631838a03d80e689581 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Thu, 5 May 2016 17:31:47 -0700 -Subject: [PATCH 01/10] mtd: spi-nor: change return value of read/write - -Change the return value of spi-nor device read and write methods to -allow returning amount of data transferred and errors as -read(2)/write(2) does. - -Also, start handling positive returns in spi_nor_read(), since we want -to convert drivers to start returning the read-length both via *retlen -and the return code. (We don't need to do the same transition process -for spi_nor_write(), since ->write() didn't used to have a return code -at all.) - -Signed-off-by: Michal Suchanek -Signed-off-by: Brian Norris -Tested-by Cyrille Pitchen -Acked-by: Michal Suchanek -Tested-by: Michal Suchanek ---- - drivers/mtd/devices/m25p80.c | 5 +++-- - drivers/mtd/spi-nor/fsl-quadspi.c | 5 +++-- - drivers/mtd/spi-nor/nxp-spifi.c | 12 ++++++------ - drivers/mtd/spi-nor/spi-nor.c | 5 ++++- - include/linux/mtd/spi-nor.h | 4 ++-- - 6 files changed, 36 insertions(+), 21 deletions(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -73,7 +73,7 @@ static int m25p80_write_reg(struct spi_n - return spi_write(spi, flash->command, len + 1); - } - --static void m25p80_write(struct spi_nor *nor, loff_t to, size_t len, -+static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len, - size_t *retlen, const u_char *buf) - { - struct m25p *flash = nor->priv; -@@ -101,6 +101,7 @@ static void m25p80_write(struct spi_nor - spi_sync(spi, &m); - - *retlen += m.actual_length - cmd_sz; -+ return 0; - } - - static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor) -@@ -119,7 +120,7 @@ static inline unsigned int m25p80_rx_nbi - * Read an address range from the nor chip. The address range - * may be any size provided it is within the physical boundaries. - */ --static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len, -+static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len, - size_t *retlen, u_char *buf) - { - struct m25p *flash = nor->priv; ---- a/drivers/mtd/spi-nor/fsl-quadspi.c -+++ b/drivers/mtd/spi-nor/fsl-quadspi.c -@@ -822,7 +822,7 @@ static int fsl_qspi_write_reg(struct spi - return ret; - } - --static void fsl_qspi_write(struct spi_nor *nor, loff_t to, -+static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to, - size_t len, size_t *retlen, const u_char *buf) - { - struct fsl_qspi *q = nor->priv; -@@ -832,9 +832,10 @@ static void fsl_qspi_write(struct spi_no - - /* invalid the data in the AHB buffer. */ - fsl_qspi_invalid(q); -+ return 0; - } - --static int fsl_qspi_read(struct spi_nor *nor, loff_t from, -+static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from, - size_t len, size_t *retlen, u_char *buf) - { - struct fsl_qspi *q = nor->priv; ---- a/drivers/mtd/spi-nor/nxp-spifi.c -+++ b/drivers/mtd/spi-nor/nxp-spifi.c -@@ -172,8 +172,8 @@ static int nxp_spifi_write_reg(struct sp - return nxp_spifi_wait_for_cmd(spifi); - } - --static int nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len, -- size_t *retlen, u_char *buf) -+static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len, -+ size_t *retlen, u_char *buf) - { - struct nxp_spifi *spifi = nor->priv; - int ret; -@@ -188,8 +188,8 @@ static int nxp_spifi_read(struct spi_nor - return 0; - } - --static void nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, -- size_t *retlen, const u_char *buf) -+static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, -+ size_t *retlen, const u_char *buf) - { - struct nxp_spifi *spifi = nor->priv; - u32 cmd; -@@ -197,7 +197,7 @@ static void nxp_spifi_write(struct spi_n - - ret = nxp_spifi_set_memory_mode_off(spifi); - if (ret) -- return; -+ return ret; - - writel(to, spifi->io_base + SPIFI_ADDR); - *retlen += len; -@@ -212,7 +212,7 @@ static void nxp_spifi_write(struct spi_n - while (len--) - writeb(*buf++, spifi->io_base + SPIFI_DATA); - -- nxp_spifi_wait_for_cmd(spifi); -+ return nxp_spifi_wait_for_cmd(spifi); - } - - static int nxp_spifi_erase(struct spi_nor *nor, loff_t offs) ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -893,7 +893,10 @@ static int spi_nor_read(struct mtd_info - ret = nor->read(nor, from, len, retlen, buf); - - spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ); -- return ret; -+ if (ret < 0) -+ return ret; -+ -+ return 0; - } - - static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -169,9 +169,9 @@ struct spi_nor { - 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 (*read)(struct spi_nor *nor, loff_t from, -+ ssize_t (*read)(struct spi_nor *nor, loff_t from, - size_t len, size_t *retlen, u_char *read_buf); -- void (*write)(struct spi_nor *nor, loff_t to, -+ ssize_t (*write)(struct spi_nor *nor, loff_t to, - size_t len, size_t *retlen, const u_char *write_buf); - int (*erase)(struct spi_nor *nor, loff_t offs); - diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-02-mtd-m25p80-return-amount-of-data-transferred-or-erro.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-02-mtd-m25p80-return-amount-of-data-transferred-or-erro.patch deleted file mode 100644 index fb89b7707..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-02-mtd-m25p80-return-amount-of-data-transferred-or-erro.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 1992297b0810a42d78ec7b4de15304eb0489fd97 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Thu, 5 May 2016 17:31:48 -0700 -Subject: [PATCH 02/10] mtd: m25p80: return amount of data transferred or error - in read/write - -Add checking of SPI transfer errors and return them from read/write -functions. Also return the amount of data transferred. - -Signed-off-by: Michal Suchanek -Signed-off-by: Brian Norris -Acked-by: Michal Suchanek -Tested-by: Michal Suchanek ---- - drivers/mtd/devices/m25p80.c | 29 +++++++++++++++++++++-------- - 1 file changed, 21 insertions(+), 8 deletions(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -81,6 +81,7 @@ static ssize_t m25p80_write(struct spi_n - struct spi_transfer t[2] = {}; - struct spi_message m; - int cmd_sz = m25p_cmdsz(nor); -+ ssize_t ret; - - spi_message_init(&m); - -@@ -98,10 +99,15 @@ static ssize_t m25p80_write(struct spi_n - t[1].len = len; - spi_message_add_tail(&t[1], &m); - -- spi_sync(spi, &m); -+ ret = spi_sync(spi, &m); -+ if (ret) -+ return ret; - -- *retlen += m.actual_length - cmd_sz; -- return 0; -+ ret = m.actual_length - cmd_sz; -+ if (ret < 0) -+ return -EIO; -+ *retlen += ret; -+ return ret; - } - - static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor) -@@ -128,13 +134,13 @@ static ssize_t m25p80_read(struct spi_no - struct spi_transfer t[2]; - struct spi_message m; - unsigned int dummy = nor->read_dummy; -+ ssize_t ret; - - /* convert the dummy cycles to the number of bytes */ - dummy /= 8; - - if (spi_flash_read_supported(spi)) { - struct spi_flash_read_message msg; -- int ret; - - memset(&msg, 0, sizeof(msg)); - -@@ -151,7 +157,9 @@ static ssize_t m25p80_read(struct spi_no - - ret = spi_flash_read(spi, &msg); - *retlen = msg.retlen; -- return ret; -+ if (ret < 0) -+ return ret; -+ return msg.retlen; - } - - spi_message_init(&m); -@@ -169,10 +177,15 @@ static ssize_t m25p80_read(struct spi_no - t[1].len = len; - spi_message_add_tail(&t[1], &m); - -- spi_sync(spi, &m); -+ ret = spi_sync(spi, &m); -+ if (ret) -+ return ret; - -- *retlen = m.actual_length - m25p_cmdsz(nor) - dummy; -- return 0; -+ ret = m.actual_length - m25p_cmdsz(nor) - dummy; -+ if (ret < 0) -+ return -EIO; -+ *retlen += ret; -+ return ret; - } - - static int m25p80_erase(struct spi_nor *nor, loff_t offset) diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-03-mtd-fsl-quadspi-return-amount-of-data-read-written-o.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-03-mtd-fsl-quadspi-return-amount-of-data-read-written-o.patch deleted file mode 100644 index 232f11cf0..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-03-mtd-fsl-quadspi-return-amount-of-data-read-written-o.patch +++ /dev/null @@ -1,72 +0,0 @@ -From fc0d7e542a0d4193521899d15f8f4999dc295323 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Thu, 5 May 2016 17:31:49 -0700 -Subject: [PATCH 03/10] mtd: fsl-quadspi: return amount of data read/written or - error - -Return amount of data read/written or error as read(2)/write(2) does. - -Signed-off-by: Michal Suchanek -Signed-off-by: Brian Norris ---- - drivers/mtd/spi-nor/fsl-quadspi.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - ---- a/drivers/mtd/spi-nor/fsl-quadspi.c -+++ b/drivers/mtd/spi-nor/fsl-quadspi.c -@@ -575,7 +575,7 @@ static inline void fsl_qspi_invalid(stru - writel(reg, q->iobase + QUADSPI_MCR); - } - --static int fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor, -+static ssize_t fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor, - u8 opcode, unsigned int to, u32 *txbuf, - unsigned count, size_t *retlen) - { -@@ -604,8 +604,11 @@ static int fsl_qspi_nor_write(struct fsl - /* Trigger it */ - ret = fsl_qspi_runcmd(q, opcode, to, count); - -- if (ret == 0 && retlen) -- *retlen += count; -+ if (ret == 0) { -+ if (retlen) -+ *retlen += count; -+ return count; -+ } - - return ret; - } -@@ -814,6 +817,8 @@ static int fsl_qspi_write_reg(struct spi - } else if (len > 0) { - ret = fsl_qspi_nor_write(q, nor, opcode, 0, - (u32 *)buf, len, NULL); -+ if (ret > 0) -+ return 0; - } else { - dev_err(q->dev, "invalid cmd %d\n", opcode); - ret = -EINVAL; -@@ -827,12 +832,12 @@ static ssize_t fsl_qspi_write(struct spi - { - struct fsl_qspi *q = nor->priv; - -- fsl_qspi_nor_write(q, nor, nor->program_opcode, to, -+ ssize_t ret = fsl_qspi_nor_write(q, nor, nor->program_opcode, to, - (u32 *)buf, len, retlen); - - /* invalid the data in the AHB buffer. */ - fsl_qspi_invalid(q); -- return 0; -+ return ret; - } - - static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from, -@@ -879,7 +884,7 @@ static ssize_t fsl_qspi_read(struct spi_ - len); - - *retlen += len; -- return 0; -+ return len; - } - - static int fsl_qspi_erase(struct spi_nor *nor, loff_t offs) diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-05-mtd-nxp-spifi-return-amount-of-data-transferred-or-e.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-05-mtd-nxp-spifi-return-amount-of-data-transferred-or-e.patch deleted file mode 100644 index 045814839..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-05-mtd-nxp-spifi-return-amount-of-data-transferred-or-e.patch +++ /dev/null @@ -1,51 +0,0 @@ -From bc418cd2652f47a327e27f978caa3d85f9558b09 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Thu, 5 May 2016 17:31:51 -0700 -Subject: [PATCH 05/10] mtd: nxp-spifi: return amount of data transferred or - error in read/write - -Add checking of SPI transfer errors and return them from read/write -functions. Also return the amount of data transferred. - -Signed-off-by: Brian Norris ---- - drivers/mtd/spi-nor/nxp-spifi.c | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - ---- a/drivers/mtd/spi-nor/nxp-spifi.c -+++ b/drivers/mtd/spi-nor/nxp-spifi.c -@@ -185,7 +185,7 @@ static ssize_t nxp_spifi_read(struct spi - memcpy_fromio(buf, spifi->flash_base + from, len); - *retlen += len; - -- return 0; -+ return len; - } - - static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, -@@ -194,6 +194,7 @@ static ssize_t nxp_spifi_write(struct sp - struct nxp_spifi *spifi = nor->priv; - u32 cmd; - int ret; -+ size_t i; - - ret = nxp_spifi_set_memory_mode_off(spifi); - if (ret) -@@ -209,10 +210,14 @@ static ssize_t nxp_spifi_write(struct sp - SPIFI_CMD_FRAMEFORM(spifi->nor.addr_width + 1); - writel(cmd, spifi->io_base + SPIFI_CMD); - -- while (len--) -- writeb(*buf++, spifi->io_base + SPIFI_DATA); -+ for (i = 0; i < len; i++) -+ writeb(buf[i], spifi->io_base + SPIFI_DATA); - -- return nxp_spifi_wait_for_cmd(spifi); -+ ret = nxp_spifi_wait_for_cmd(spifi); -+ if (ret) -+ return ret; -+ -+ return len; - } - - static int nxp_spifi_erase(struct spi_nor *nor, loff_t offs) diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-06-mtd-spi-nor-check-return-value-from-write.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-06-mtd-spi-nor-check-return-value-from-write.patch deleted file mode 100644 index 0bdcccfdf..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-06-mtd-spi-nor-check-return-value-from-write.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 0bad7b9304d543dd7627f4cd564aea5d7338b950 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Thu, 5 May 2016 17:31:52 -0700 -Subject: [PATCH 06/10] mtd: spi-nor: check return value from write - -SPI NOR hardware drivers now return useful value from their write -functions so check them. - -Signed-off-by: Michal Suchanek -Signed-off-by: Brian Norris -Tested-by Cyrille Pitchen -Acked-by: Michal Suchanek -Tested-by: Michal Suchanek ---- - drivers/mtd/spi-nor/spi-nor.c | 45 ++++++++++++++++++++++++++++++------------- - 1 file changed, 32 insertions(+), 13 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -922,10 +922,14 @@ static int sst_write(struct mtd_info *mt - nor->program_opcode = SPINOR_OP_BP; - - /* write one byte. */ -- nor->write(nor, to, 1, retlen, buf); -+ ret = nor->write(nor, to, 1, retlen, buf); -+ if (ret < 0) -+ goto sst_write_err; -+ WARN(ret != 1, "While writing 1 byte written %i bytes\n", -+ (int)ret); - ret = spi_nor_wait_till_ready(nor); - if (ret) -- goto time_out; -+ goto sst_write_err; - } - to += actual; - -@@ -934,10 +938,14 @@ static int sst_write(struct mtd_info *mt - nor->program_opcode = SPINOR_OP_AAI_WP; - - /* write two bytes. */ -- nor->write(nor, to, 2, retlen, buf + actual); -+ ret = nor->write(nor, to, 2, retlen, buf + actual); -+ if (ret < 0) -+ goto sst_write_err; -+ WARN(ret != 2, "While writing 2 bytes written %i bytes\n", -+ (int)ret); - ret = spi_nor_wait_till_ready(nor); - if (ret) -- goto time_out; -+ goto sst_write_err; - to += 2; - nor->sst_write_second = true; - } -@@ -946,21 +954,24 @@ static int sst_write(struct mtd_info *mt - write_disable(nor); - ret = spi_nor_wait_till_ready(nor); - if (ret) -- goto time_out; -+ goto sst_write_err; - - /* Write out trailing byte if it exists. */ - if (actual != len) { - write_enable(nor); - - nor->program_opcode = SPINOR_OP_BP; -- nor->write(nor, to, 1, retlen, buf + actual); -- -+ ret = nor->write(nor, to, 1, retlen, buf + actual); -+ if (ret < 0) -+ goto sst_write_err; -+ WARN(ret != 1, "While writing 1 byte written %i bytes\n", -+ (int)ret); - ret = spi_nor_wait_till_ready(nor); - if (ret) -- goto time_out; -+ goto sst_write_err; - write_disable(nor); - } --time_out: -+sst_write_err: - spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); - return ret; - } -@@ -989,14 +1000,18 @@ static int spi_nor_write(struct mtd_info - - /* do all the bytes fit onto one page? */ - if (page_offset + len <= nor->page_size) { -- nor->write(nor, to, len, retlen, buf); -+ ret = nor->write(nor, to, len, retlen, buf); -+ if (ret < 0) -+ goto write_err; - } else { - /* the size of data remaining on the first page */ - page_size = nor->page_size - page_offset; -- nor->write(nor, to, page_size, retlen, buf); -+ ret = nor->write(nor, to, page_size, retlen, buf); -+ if (ret < 0) -+ goto write_err; - - /* write everything in nor->page_size chunks */ -- for (i = page_size; i < len; i += page_size) { -+ for (i = ret; i < len; ) { - page_size = len - i; - if (page_size > nor->page_size) - page_size = nor->page_size; -@@ -1007,7 +1022,11 @@ static int spi_nor_write(struct mtd_info - - write_enable(nor); - -- nor->write(nor, to + i, page_size, retlen, buf + i); -+ ret = nor->write(nor, to + i, page_size, retlen, -+ buf + i); -+ if (ret < 0) -+ goto write_err; -+ i += ret; - } - } - diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-07-mtd-spi-nor-stop-passing-around-retlen.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-07-mtd-spi-nor-stop-passing-around-retlen.patch deleted file mode 100644 index 9949d35a6..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-07-mtd-spi-nor-stop-passing-around-retlen.patch +++ /dev/null @@ -1,266 +0,0 @@ -From 2dd087b16946cf168f401526adf26afa771bb740 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Thu, 5 May 2016 17:31:53 -0700 -Subject: [PATCH 07/10] mtd: spi-nor: stop passing around retlen - -Do not pass retlen to hardware driver read/write functions. Update it in -spi-nor generic driver instead. - -Signed-off-by: Michal Suchanek -Signed-off-by: Brian Norris -Tested-by Cyrille Pitchen -Acked-by: Michal Suchanek -Tested-by: Michal Suchanek ---- - drivers/mtd/devices/m25p80.c | 7 ++----- - drivers/mtd/spi-nor/fsl-quadspi.c | 17 ++++++----------- - drivers/mtd/spi-nor/nxp-spifi.c | 6 ++---- - drivers/mtd/spi-nor/spi-nor.c | 21 +++++++++++++-------- - include/linux/mtd/spi-nor.h | 4 ++-- - 6 files changed, 28 insertions(+), 35 deletions(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -74,7 +74,7 @@ static int m25p80_write_reg(struct spi_n - } - - static ssize_t m25p80_write(struct spi_nor *nor, loff_t to, size_t len, -- size_t *retlen, const u_char *buf) -+ const u_char *buf) - { - struct m25p *flash = nor->priv; - struct spi_device *spi = flash->spi; -@@ -106,7 +106,6 @@ static ssize_t m25p80_write(struct spi_n - ret = m.actual_length - cmd_sz; - if (ret < 0) - return -EIO; -- *retlen += ret; - return ret; - } - -@@ -127,7 +126,7 @@ static inline unsigned int m25p80_rx_nbi - * may be any size provided it is within the physical boundaries. - */ - static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len, -- size_t *retlen, u_char *buf) -+ u_char *buf) - { - struct m25p *flash = nor->priv; - struct spi_device *spi = flash->spi; -@@ -156,7 +155,6 @@ static ssize_t m25p80_read(struct spi_no - msg.data_nbits = m25p80_rx_nbits(nor); - - ret = spi_flash_read(spi, &msg); -- *retlen = msg.retlen; - if (ret < 0) - return ret; - return msg.retlen; -@@ -184,7 +182,6 @@ static ssize_t m25p80_read(struct spi_no - ret = m.actual_length - m25p_cmdsz(nor) - dummy; - if (ret < 0) - return -EIO; -- *retlen += ret; - return ret; - } - ---- a/drivers/mtd/spi-nor/fsl-quadspi.c -+++ b/drivers/mtd/spi-nor/fsl-quadspi.c -@@ -577,7 +577,7 @@ static inline void fsl_qspi_invalid(stru - - static ssize_t fsl_qspi_nor_write(struct fsl_qspi *q, struct spi_nor *nor, - u8 opcode, unsigned int to, u32 *txbuf, -- unsigned count, size_t *retlen) -+ unsigned count) - { - int ret, i, j; - u32 tmp; -@@ -604,11 +604,8 @@ static ssize_t fsl_qspi_nor_write(struct - /* Trigger it */ - ret = fsl_qspi_runcmd(q, opcode, to, count); - -- if (ret == 0) { -- if (retlen) -- *retlen += count; -+ if (ret == 0) - return count; -- } - - return ret; - } -@@ -816,7 +813,7 @@ static int fsl_qspi_write_reg(struct spi - - } else if (len > 0) { - ret = fsl_qspi_nor_write(q, nor, opcode, 0, -- (u32 *)buf, len, NULL); -+ (u32 *)buf, len); - if (ret > 0) - return 0; - } else { -@@ -828,12 +825,11 @@ static int fsl_qspi_write_reg(struct spi - } - - static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to, -- size_t len, size_t *retlen, const u_char *buf) -+ size_t len, const u_char *buf) - { - struct fsl_qspi *q = nor->priv; -- - ssize_t ret = fsl_qspi_nor_write(q, nor, nor->program_opcode, to, -- (u32 *)buf, len, retlen); -+ (u32 *)buf, len); - - /* invalid the data in the AHB buffer. */ - fsl_qspi_invalid(q); -@@ -841,7 +837,7 @@ static ssize_t fsl_qspi_write(struct spi - } - - static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from, -- size_t len, size_t *retlen, u_char *buf) -+ size_t len, u_char *buf) - { - struct fsl_qspi *q = nor->priv; - u8 cmd = nor->read_opcode; -@@ -883,7 +879,6 @@ static ssize_t fsl_qspi_read(struct spi_ - memcpy(buf, q->ahb_addr + q->chip_base_addr + from - q->memmap_offs, - len); - -- *retlen += len; - return len; - } - ---- a/drivers/mtd/spi-nor/nxp-spifi.c -+++ b/drivers/mtd/spi-nor/nxp-spifi.c -@@ -173,7 +173,7 @@ static int nxp_spifi_write_reg(struct sp - } - - static ssize_t nxp_spifi_read(struct spi_nor *nor, loff_t from, size_t len, -- size_t *retlen, u_char *buf) -+ u_char *buf) - { - struct nxp_spifi *spifi = nor->priv; - int ret; -@@ -183,13 +183,12 @@ static ssize_t nxp_spifi_read(struct spi - return ret; - - memcpy_fromio(buf, spifi->flash_base + from, len); -- *retlen += len; - - return len; - } - - static ssize_t nxp_spifi_write(struct spi_nor *nor, loff_t to, size_t len, -- size_t *retlen, const u_char *buf) -+ const u_char *buf) - { - struct nxp_spifi *spifi = nor->priv; - u32 cmd; -@@ -201,7 +200,6 @@ static ssize_t nxp_spifi_write(struct sp - return ret; - - writel(to, spifi->io_base + SPIFI_ADDR); -- *retlen += len; - - cmd = SPIFI_CMD_DOUT | - SPIFI_CMD_DATALEN(len) | ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -890,12 +890,13 @@ static int spi_nor_read(struct mtd_info - if (ret) - return ret; - -- ret = nor->read(nor, from, len, retlen, buf); -+ ret = nor->read(nor, from, len, buf); - - spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ); - if (ret < 0) - return ret; - -+ *retlen += ret; - return 0; - } - -@@ -922,7 +923,7 @@ static int sst_write(struct mtd_info *mt - nor->program_opcode = SPINOR_OP_BP; - - /* write one byte. */ -- ret = nor->write(nor, to, 1, retlen, buf); -+ ret = nor->write(nor, to, 1, buf); - if (ret < 0) - goto sst_write_err; - WARN(ret != 1, "While writing 1 byte written %i bytes\n", -@@ -938,7 +939,7 @@ static int sst_write(struct mtd_info *mt - nor->program_opcode = SPINOR_OP_AAI_WP; - - /* write two bytes. */ -- ret = nor->write(nor, to, 2, retlen, buf + actual); -+ ret = nor->write(nor, to, 2, buf + actual); - if (ret < 0) - goto sst_write_err; - WARN(ret != 2, "While writing 2 bytes written %i bytes\n", -@@ -961,7 +962,7 @@ static int sst_write(struct mtd_info *mt - write_enable(nor); - - nor->program_opcode = SPINOR_OP_BP; -- ret = nor->write(nor, to, 1, retlen, buf + actual); -+ ret = nor->write(nor, to, 1, buf + actual); - if (ret < 0) - goto sst_write_err; - WARN(ret != 1, "While writing 1 byte written %i bytes\n", -@@ -970,8 +971,10 @@ static int sst_write(struct mtd_info *mt - if (ret) - goto sst_write_err; - write_disable(nor); -+ actual += 1; - } - sst_write_err: -+ *retlen += actual; - spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); - return ret; - } -@@ -1000,15 +1003,17 @@ static int spi_nor_write(struct mtd_info - - /* do all the bytes fit onto one page? */ - if (page_offset + len <= nor->page_size) { -- ret = nor->write(nor, to, len, retlen, buf); -+ ret = nor->write(nor, to, len, buf); - if (ret < 0) - goto write_err; -+ *retlen += ret; - } else { - /* the size of data remaining on the first page */ - page_size = nor->page_size - page_offset; -- ret = nor->write(nor, to, page_size, retlen, buf); -+ ret = nor->write(nor, to, page_size, buf); - if (ret < 0) - goto write_err; -+ *retlen += ret; - - /* write everything in nor->page_size chunks */ - for (i = ret; i < len; ) { -@@ -1022,10 +1027,10 @@ static int spi_nor_write(struct mtd_info - - write_enable(nor); - -- ret = nor->write(nor, to + i, page_size, retlen, -- buf + i); -+ ret = nor->write(nor, to + i, page_size, buf + i); - if (ret < 0) - goto write_err; -+ *retlen += ret; - i += ret; - } - } ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -170,9 +170,9 @@ struct spi_nor { - int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len); - - ssize_t (*read)(struct spi_nor *nor, loff_t from, -- size_t len, size_t *retlen, u_char *read_buf); -+ size_t len, u_char *read_buf); - ssize_t (*write)(struct spi_nor *nor, loff_t to, -- size_t len, size_t *retlen, const u_char *write_buf); -+ size_t len, const u_char *write_buf); - int (*erase)(struct spi_nor *nor, loff_t offs); - - int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len); diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-08-mtd-spi-nor-simplify-write-loop.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-08-mtd-spi-nor-simplify-write-loop.patch deleted file mode 100644 index b2e840d48..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-08-mtd-spi-nor-simplify-write-loop.patch +++ /dev/null @@ -1,103 +0,0 @@ -From e5d05cbd6d8b01f08c95c427a36c66aac769af4f Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Thu, 5 May 2016 17:31:54 -0700 -Subject: [PATCH 08/10] mtd: spi-nor: simplify write loop - -The spi-nor write loop assumes that what is passed to the hardware -driver write() is what gets written. - -When write() writes less than page size at once data is dropped on the -floor. Check the amount of data writen and exit if it does not match -requested amount. - -Signed-off-by: Michal Suchanek -Signed-off-by: Brian Norris -Tested-by Cyrille Pitchen -Acked-by: Michal Suchanek -Tested-by: Michal Suchanek ---- - drivers/mtd/spi-nor/spi-nor.c | 58 +++++++++++++++++++------------------------ - 1 file changed, 25 insertions(+), 33 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -988,8 +988,8 @@ static int spi_nor_write(struct mtd_info - size_t *retlen, const u_char *buf) - { - struct spi_nor *nor = mtd_to_spi_nor(mtd); -- u32 page_offset, page_size, i; -- int ret; -+ size_t page_offset, page_remain, i; -+ ssize_t ret; - - dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len); - -@@ -997,45 +997,37 @@ static int spi_nor_write(struct mtd_info - if (ret) - return ret; - -- write_enable(nor); -+ for (i = 0; i < len; ) { -+ ssize_t written; - -- page_offset = to & (nor->page_size - 1); -- -- /* do all the bytes fit onto one page? */ -- if (page_offset + len <= nor->page_size) { -- ret = nor->write(nor, to, len, buf); -- if (ret < 0) -- goto write_err; -- *retlen += ret; -- } else { -+ page_offset = (to + i) & (nor->page_size - 1); -+ WARN_ONCE(page_offset, -+ "Writing at offset %zu into a NOR page. Writing partial pages may decrease reliability and increase wear of NOR flash.", -+ page_offset); - /* the size of data remaining on the first page */ -- page_size = nor->page_size - page_offset; -- ret = nor->write(nor, to, page_size, buf); -+ page_remain = min_t(size_t, -+ nor->page_size - page_offset, len - i); -+ -+ write_enable(nor); -+ ret = nor->write(nor, to + i, page_remain, buf + i); - if (ret < 0) - goto write_err; -- *retlen += ret; -+ written = ret; - -- /* write everything in nor->page_size chunks */ -- for (i = ret; i < len; ) { -- page_size = len - i; -- if (page_size > nor->page_size) -- page_size = nor->page_size; -- -- ret = spi_nor_wait_till_ready(nor); -- if (ret) -- goto write_err; -- -- write_enable(nor); -- -- ret = nor->write(nor, to + i, page_size, buf + i); -- if (ret < 0) -- goto write_err; -- *retlen += ret; -- i += ret; -+ ret = spi_nor_wait_till_ready(nor); -+ if (ret) -+ goto write_err; -+ *retlen += written; -+ i += written; -+ if (written != page_remain) { -+ dev_err(nor->dev, -+ "While writing %zu bytes written %zd bytes\n", -+ page_remain, written); -+ ret = -EIO; -+ goto write_err; - } - } - -- ret = spi_nor_wait_till_ready(nor); - write_err: - spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); - return ret; diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-09-mtd-spi-nor-add-read-loop.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-09-mtd-spi-nor-add-read-loop.patch deleted file mode 100644 index 662c73ada..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-09-mtd-spi-nor-add-read-loop.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 26f9bcad29a6c240881bd4efc90f16a9990dd6c2 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Thu, 5 May 2016 17:31:55 -0700 -Subject: [PATCH 09/10] mtd: spi-nor: add read loop - -mtdblock and ubi do not handle the situation when read returns less data -than requested. Loop in spi-nor until buffer is filled or an error is -returned. - -Signed-off-by: Michal Suchanek -Signed-off-by: Brian Norris -Tested-by Cyrille Pitchen -Acked-by: Michal Suchanek -Tested-by: Michal Suchanek ---- - drivers/mtd/spi-nor/spi-nor.c | 25 +++++++++++++++++++------ - 1 file changed, 19 insertions(+), 6 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -890,14 +890,27 @@ static int spi_nor_read(struct mtd_info - if (ret) - return ret; - -- ret = nor->read(nor, from, len, buf); -+ while (len) { -+ ret = nor->read(nor, from, len, buf); -+ if (ret == 0) { -+ /* We shouldn't see 0-length reads */ -+ ret = -EIO; -+ goto read_err; -+ } -+ if (ret < 0) -+ goto read_err; - -- spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ); -- if (ret < 0) -- return ret; -+ WARN_ON(ret > len); -+ *retlen += ret; -+ buf += ret; -+ from += ret; -+ len -= ret; -+ } -+ ret = 0; - -- *retlen += ret; -- return 0; -+read_err: -+ spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ); -+ return ret; - } - - static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-10-mtd-m25p80-read-in-spi_max_transfer_size-chunks.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-10-mtd-m25p80-read-in-spi_max_transfer_size-chunks.patch deleted file mode 100644 index d4f13ecea..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-10-mtd-m25p80-read-in-spi_max_transfer_size-chunks.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 95193796256cfce16e5d881318e15b6b04062c15 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Thu, 5 May 2016 17:31:56 -0700 -Subject: [PATCH 10/10] mtd: m25p80: read in spi_max_transfer_size chunks - -Take into account transfer size limitation of SPI master. - -Signed-off-by: Michal Suchanek -Signed-off-by: Brian Norris -Acked-by: Michal Suchanek -Tested-by: Michal Suchanek ---- - drivers/mtd/devices/m25p80.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -172,7 +172,7 @@ static ssize_t m25p80_read(struct spi_no - - t[1].rx_buf = buf; - t[1].rx_nbits = m25p80_rx_nbits(nor); -- t[1].len = len; -+ t[1].len = min(len, spi_max_transfer_size(spi)); - spi_message_add_tail(&t[1], &m); - - ret = spi_sync(spi, &m); diff --git a/target/linux/brcm63xx/patches-4.4/000-4.8-11-serial-bcm63xx_uart-use-correct-alias-naming.patch b/target/linux/brcm63xx/patches-4.4/000-4.8-11-serial-bcm63xx_uart-use-correct-alias-naming.patch deleted file mode 100644 index 9f4e21aab..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.8-11-serial-bcm63xx_uart-use-correct-alias-naming.patch +++ /dev/null @@ -1,37 +0,0 @@ -From a59388668d0ce19dadea909e09f4eb905a27b1ce Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 8 Jun 2016 12:08:43 +0200 -Subject: [PATCH] serial/bcm63xx_uart: use correct alias naming - -The bcm63xx_uart driver uses the of alias for determing its id. Recent -changes in dts files changed the expected 'uartX' to the recommended -'serialX', breaking serial output. Fix this by checking for a 'serialX' -alias as well. - -Fixes: e3b992d028f8 ("MIPS: BMIPS: Improve BCM6328 device tree") -Fixes: 2d52ee82b475 ("MIPS: BMIPS: Improve BCM6368 device tree") -Fixes: 7537d273e2f3 ("MIPS: BMIPS: Add device tree example for BCM6358") -Signed-off-by: Jonas Gorski -Acked-by: Florian Fainelli -Signed-off-by: Greg Kroah-Hartman ---- - drivers/tty/serial/bcm63xx_uart.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - ---- a/drivers/tty/serial/bcm63xx_uart.c -+++ b/drivers/tty/serial/bcm63xx_uart.c -@@ -813,8 +813,12 @@ static int bcm_uart_probe(struct platfor - struct clk *clk; - int ret; - -- if (pdev->dev.of_node) -- pdev->id = of_alias_get_id(pdev->dev.of_node, "uart"); -+ if (pdev->dev.of_node) { -+ pdev->id = of_alias_get_id(pdev->dev.of_node, "serial"); -+ -+ if (pdev->id < 0) -+ pdev->id = of_alias_get_id(pdev->dev.of_node, "uart"); -+ } - - if (pdev->id < 0 || pdev->id >= BCM63XX_NR_UARTS) - return -EINVAL; diff --git a/target/linux/brcm63xx/patches-4.4/000-4.9-01-spi-introduce-max_message_size-hook-in-spi_master.patch b/target/linux/brcm63xx/patches-4.4/000-4.9-01-spi-introduce-max_message_size-hook-in-spi_master.patch deleted file mode 100644 index 76a66a3bb..000000000 --- a/target/linux/brcm63xx/patches-4.4/000-4.9-01-spi-introduce-max_message_size-hook-in-spi_master.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 5090cc6ae2f79ee779e5faf7c8a28edf42b7d738 Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Wed, 17 Aug 2016 21:08:01 +0200 -Subject: [PATCH] spi: introduce max_message_size hook in spi_master - -Recently a maximum transfer size was was introduced in struct spi_master. -However there are also spi controllers with a maximum message size, e.g. -fsl-espi has a max message size of 64KB. -Introduce a hook max_message_size to deal with such limitations. - -Also make sure that spi_max_transfer_size doesn't return greater values -than spi_max_message_size, even if hook max_transfer_size is not set. - -Signed-off-by: Heiner Kallweit -Signed-off-by: Mark Brown ---- - include/linux/spi/spi.h | 25 +++++++++++++++++++++---- - 1 file changed, 21 insertions(+), 4 deletions(-) - ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -304,6 +304,8 @@ static inline void spi_unregister_driver - * @min_speed_hz: Lowest supported transfer speed - * @max_speed_hz: Highest supported transfer speed - * @flags: other constraints relevant to this driver -+ * @max_message_size: function that returns the max message size for -+ * a &spi_device; may be %NULL, so the default %SIZE_MAX will be used. - * @bus_lock_spinlock: spinlock for SPI bus locking - * @bus_lock_mutex: mutex for SPI bus locking - * @bus_lock_flag: indicates that the SPI bus is locked for exclusive use -@@ -429,10 +431,11 @@ struct spi_master { - #define SPI_MASTER_MUST_TX BIT(4) /* requires tx */ - - /* -- * on some hardware transfer size may be constrained -+ * on some hardware transfer / message size may be constrained - * the limit may depend on device transfer settings - */ - size_t (*max_transfer_size)(struct spi_device *spi); -+ size_t (*max_message_size)(struct spi_device *spi); - - /* lock and mutex for SPI bus locking */ - spinlock_t bus_lock_spinlock; -@@ -844,12 +847,26 @@ extern int spi_async_locked(struct spi_d - struct spi_message *message); - - static inline size_t --spi_max_transfer_size(struct spi_device *spi) -+spi_max_message_size(struct spi_device *spi) - { - struct spi_master *master = spi->master; -- if (!master->max_transfer_size) -+ if (!master->max_message_size) - return SIZE_MAX; -- return master->max_transfer_size(spi); -+ return master->max_message_size(spi); -+} -+ -+static inline size_t -+spi_max_transfer_size(struct spi_device *spi) -+{ -+ struct spi_master *master = spi->master; -+ size_t tr_max = SIZE_MAX; -+ size_t msg_max = spi_max_message_size(spi); -+ -+ if (master->max_transfer_size) -+ tr_max = master->max_transfer_size(spi); -+ -+ /* transfer size limit must not be greater than messsage size limit */ -+ return min(tr_max, msg_max); - } - - /*---------------------------------------------------------------------------*/ diff --git a/target/linux/brcm63xx/patches-4.4/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch b/target/linux/brcm63xx/patches-4.4/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch deleted file mode 100644 index e90270156..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 80a79a889ce5df16c5261ab2f1e8e63b94b78102 Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Fri, 28 Oct 2016 07:58:46 +0200 -Subject: [PATCH 1/8] mtd: m25p80: consider max message size in m25p80_read - -Consider a message size limit when calculating the maximum amount -of data that can be read. - -The message size limit has been introduced with 4.9, so cc it -to stable. - -Signed-off-by: Heiner Kallweit -Cc: # 4.9.x -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/devices/m25p80.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -172,7 +172,8 @@ static ssize_t m25p80_read(struct spi_no - - t[1].rx_buf = buf; - t[1].rx_nbits = m25p80_rx_nbits(nor); -- t[1].len = min(len, spi_max_transfer_size(spi)); -+ t[1].len = min3(len, spi_max_transfer_size(spi), -+ spi_max_message_size(spi) - t[0].len); - spi_message_add_tail(&t[1], &m); - - ret = spi_sync(spi, &m); diff --git a/target/linux/brcm63xx/patches-4.4/001-4.11-02-mtd-spi-nor-remove-WARN_ONCE-message-in-spi_nor_writ.patch b/target/linux/brcm63xx/patches-4.4/001-4.11-02-mtd-spi-nor-remove-WARN_ONCE-message-in-spi_nor_writ.patch deleted file mode 100644 index 7c70d20a4..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.11-02-mtd-spi-nor-remove-WARN_ONCE-message-in-spi_nor_writ.patch +++ /dev/null @@ -1,33 +0,0 @@ -From bc0e151514d09cadb56e473a10c783e64e48ce0b Mon Sep 17 00:00:00 2001 -From: Cyrille Pitchen -Date: Tue, 6 Dec 2016 18:14:24 +0100 -Subject: [PATCH] mtd: spi-nor: remove WARN_ONCE() message in spi_nor_write() - -This patch removes the WARN_ONCE() test in spi_nor_write(). -This macro triggers the display of a warning message almost every time we -use a UBI file-system because a write operation is performed at offset 64, -which is in the middle of the SPI NOR memory page. This is a valid -operation for ubifs. - -Hence this warning is pretty annoying and useless so we just remove it. - -Signed-off-by: Cyrille Pitchen -Suggested-by: Richard Weinberger -Suggested-by: Andras Szemzo -Acked-by: Boris Brezillon ---- - drivers/mtd/spi-nor/spi-nor.c | 3 --- - 1 file changed, 3 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1014,9 +1014,6 @@ static int spi_nor_write(struct mtd_info - ssize_t written; - - page_offset = (to + i) & (nor->page_size - 1); -- WARN_ONCE(page_offset, -- "Writing at offset %zu into a NOR page. Writing partial pages may decrease reliability and increase wear of NOR flash.", -- page_offset); - /* the size of data remaining on the first page */ - page_remain = min_t(size_t, - nor->page_size - page_offset, len - i); diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-01-spi-bcm63xx-make-spi-subsystem-aware-of-message-size.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-01-spi-bcm63xx-make-spi-subsystem-aware-of-message-size.patch deleted file mode 100644 index d806290fd..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.12-01-spi-bcm63xx-make-spi-subsystem-aware-of-message-size.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 3fcc36962c32ad0af2d5904103e2b2b824b6b1aa Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 4 Feb 2017 12:32:59 +0100 -Subject: [PATCH 2/8] spi/bcm63xx: make spi subsystem aware of message size - limits - -The bcm63xx LS SPI controller does not allow manual control of the CS -lines and will toggle it automatically before after sending data, so we -are limited to messages that fit in the FIFO buffer. Since the CS lines -aren't available as GPIOs either, we will need to make slave drivers -aware of this limitation and handle it accordingly. - -Signed-off-by: Jonas Gorski ---- - drivers/spi/spi-bcm63xx.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/spi/spi-bcm63xx.c -+++ b/drivers/spi/spi-bcm63xx.c -@@ -429,6 +429,13 @@ static irqreturn_t bcm63xx_spi_interrupt - return IRQ_HANDLED; - } - -+static size_t bcm63xx_spi_max_length(struct spi_device *spi) -+{ -+ struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); -+ -+ return bs->fifo_size; -+} -+ - static const unsigned long bcm6348_spi_reg_offsets[] = { - [SPI_CMD] = SPI_6348_CMD, - [SPI_INT_STATUS] = SPI_6348_INT_STATUS, -@@ -542,6 +549,8 @@ static int bcm63xx_spi_probe(struct plat - master->transfer_one_message = bcm63xx_spi_transfer_one; - master->mode_bits = MODEBITS; - master->bits_per_word_mask = SPI_BPW_MASK(8); -+ master->max_transfer_size = bcm63xx_spi_max_length; -+ master->max_message_size = bcm63xx_spi_max_length; - master->auto_runtime_pm = true; - bs->msg_type_shift = bs->reg_offsets[SPI_MSG_TYPE_SHIFT]; - bs->msg_ctl_width = bs->reg_offsets[SPI_MSG_CTL_WIDTH]; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-02-spi-bcm63xx-document-device-tree-bindings.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-02-spi-bcm63xx-document-device-tree-bindings.patch deleted file mode 100644 index 524c50e61..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.12-02-spi-bcm63xx-document-device-tree-bindings.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0a0c39044332a75eaf4a3c5654079df953b0d839 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 7 Sep 2015 21:00:38 +0200 -Subject: [PATCH 3/8] spi/bcm63xx: document device tree bindings - -Add documentation for the bindings of the low speed SPI controller found -on most bcm63xx SoCs. - -Signed-off-by: Jonas Gorski ---- - .../devicetree/bindings/spi/spi-bcm63xx.txt | 33 ++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - create mode 100644 Documentation/devicetree/bindings/spi/spi-bcm63xx.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/spi/spi-bcm63xx.txt -@@ -0,0 +1,33 @@ -+Binding for Broadcom BCM6348/BCM6358 SPI controller -+ -+Required properties: -+- compatible: must contain one of "brcm,bcm6348-spi", "brcm,bcm6358-spi". -+- reg: Base address and size of the controllers memory area. -+- interrupts: Interrupt for the SPI block. -+- clocks: phandle of the SPI clock. -+- clock-names: has to be "spi". -+- #address-cells: <1>, as required by generic SPI binding. -+- #size-cells: <0>, also as required by generic SPI binding. -+ -+Optional properties: -+- num-cs: some controllers have less than 8 cs signals. Defaults to 8 -+ if absent. -+ -+Child nodes as per the generic SPI binding. -+ -+Example: -+ -+ spi@10000800 { -+ compatible = "brcm,bcm6368-spi", "brcm,bcm6358-spi"; -+ reg = <0x10000800 0x70c>; -+ -+ interrupts = <1>; -+ -+ clocks = <&clkctl 9>; -+ clock-names = "spi"; -+ -+ num-cs = <5>; -+ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-03-spi-bcm63xx-add-support-for-probing-through-devicetr.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-03-spi-bcm63xx-add-support-for-probing-through-devicetr.patch deleted file mode 100644 index 51054625e..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.12-03-spi-bcm63xx-add-support-for-probing-through-devicetr.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 3353228a04a004ec67073871f40cf58dc4e209aa Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 7 Sep 2015 21:01:38 +0200 -Subject: [PATCH 4/8] spi/bcm63xx: add support for probing through devicetree - -Add required binding support to probe through device tree. - -Use the compatible instead of the resource size for identifiying the -block type, and allow reducing the number of cs lines through OF. - -Signed-off-by: Jonas Gorski ---- - drivers/spi/spi-bcm63xx.c | 42 ++++++++++++++++++++++++++++++++++++------ - 1 file changed, 36 insertions(+), 6 deletions(-) - ---- a/drivers/spi/spi-bcm63xx.c -+++ b/drivers/spi/spi-bcm63xx.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - /* BCM 6338/6348 SPI core */ - #define SPI_6348_RSET_SIZE 64 -@@ -485,21 +486,48 @@ static const struct platform_device_id b - }, - }; - -+static const struct of_device_id bcm63xx_spi_of_match[] = { -+ { .compatible = "brcm,bcm6348-spi", .data = &bcm6348_spi_reg_offsets }, -+ { .compatible = "brcm,bcm6358-spi", .data = &bcm6358_spi_reg_offsets }, -+ { }, -+}; -+ - static int bcm63xx_spi_probe(struct platform_device *pdev) - { - struct resource *r; - const unsigned long *bcm63xx_spireg; - struct device *dev = &pdev->dev; -- int irq; -+ int irq, bus_num; - struct spi_master *master; - struct clk *clk; - struct bcm63xx_spi *bs; - int ret; -+ u32 num_cs = BCM63XX_SPI_MAX_CS; - -- if (!pdev->id_entry->driver_data) -- return -EINVAL; -+ if (dev->of_node) { -+ const struct of_device_id *match; - -- bcm63xx_spireg = (const unsigned long *)pdev->id_entry->driver_data; -+ match = of_match_node(bcm63xx_spi_of_match, dev->of_node); -+ if (!match) -+ return -EINVAL; -+ bcm63xx_spireg = match->data; -+ -+ of_property_read_u32(dev->of_node, "num-cs", &num_cs); -+ if (num_cs > BCM63XX_SPI_MAX_CS) { -+ dev_warn(dev, "unsupported number of cs (%i), reducing to 8\n", -+ num_cs); -+ num_cs = BCM63XX_SPI_MAX_CS; -+ } -+ -+ bus_num = -1; -+ } else if (pdev->id_entry->driver_data) { -+ const struct platform_device_id *match = pdev->id_entry; -+ -+ bcm63xx_spireg = (const unsigned long *)match->driver_data; -+ bus_num = BCM63XX_SPI_BUS_NUM; -+ } else { -+ return -EINVAL; -+ } - - irq = platform_get_irq(pdev, 0); - if (irq < 0) { -@@ -544,8 +572,9 @@ static int bcm63xx_spi_probe(struct plat - goto out_err; - } - -- master->bus_num = BCM63XX_SPI_BUS_NUM; -- master->num_chipselect = BCM63XX_SPI_MAX_CS; -+ master->dev.of_node = dev->of_node; -+ master->bus_num = bus_num; -+ master->num_chipselect = num_cs; - master->transfer_one_message = bcm63xx_spi_transfer_one; - master->mode_bits = MODEBITS; - master->bits_per_word_mask = SPI_BPW_MASK(8); -@@ -634,6 +663,7 @@ static struct platform_driver bcm63xx_sp - .driver = { - .name = "bcm63xx-spi", - .pm = &bcm63xx_spi_pm_ops, -+ .of_match_table = bcm63xx_spi_of_match, - }, - .id_table = bcm63xx_spi_dev_match, - .probe = bcm63xx_spi_probe, diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-04-spi-bcm63xx-hsspi-allow-providing-clock-rate-through.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-04-spi-bcm63xx-hsspi-allow-providing-clock-rate-through.patch deleted file mode 100644 index 30e673468..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.12-04-spi-bcm63xx-hsspi-allow-providing-clock-rate-through.patch +++ /dev/null @@ -1,35 +0,0 @@ -From d03f23df6ff47898d76f06b3aa5dadcfa1ec8f4f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 19 Feb 2017 23:40:22 +0100 -Subject: [PATCH 1/3] spi/bcm63xx-hsspi: allow providing clock rate through a - second clock - -Instead of requiring the hsspi clock to have a rate, allow using a second -clock for providing the Hz rate, which is probably more correct anyway. - -Signed-off-by: Jonas Gorski ---- - drivers/spi/spi-bcm63xx-hsspi.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - ---- a/drivers/spi/spi-bcm63xx-hsspi.c -+++ b/drivers/spi/spi-bcm63xx-hsspi.c -@@ -351,8 +351,16 @@ static int bcm63xx_hsspi_probe(struct pl - return PTR_ERR(clk); - - rate = clk_get_rate(clk); -- if (!rate) -- return -EINVAL; -+ if (!rate) { -+ struct clk *pll_clk = devm_clk_get(dev, "pll"); -+ -+ if (IS_ERR(pll_clk)) -+ return PTR_ERR(pll_clk); -+ -+ rate = clk_get_rate(pll_clk); -+ if (!rate) -+ return -EINVAL; -+ } - - ret = clk_prepare_enable(clk); - if (ret) diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-05-spi-bcm63xx-hsspi-document-device-tree-bindings.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-05-spi-bcm63xx-hsspi-document-device-tree-bindings.patch deleted file mode 100644 index 8f77f4eb2..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.12-05-spi-bcm63xx-hsspi-document-device-tree-bindings.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ff759cc25db31bbb3469abb16a0306f110c4c7fa Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 10 Sep 2015 14:52:32 +0200 -Subject: [PATCH 2/3] dt-bindings: spi: document bcm63xx HS SPI devicetree - bindings - -Add documentation for the bindings of the high speed SPI controller found -on newer bcm63xx SoCs. - -Signed-off-by: Jonas Gorski ---- - .../devicetree/bindings/spi/spi-bcm63xx-hsspi.txt | 33 ++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - create mode 100644 Documentation/devicetree/bindings/spi/spi-bcm63xx-hsspi.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/spi/spi-bcm63xx-hsspi.txt -@@ -0,0 +1,33 @@ -+Binding for Broadcom BCM6328 High Speed SPI controller -+ -+Required properties: -+- compatible: must contain of "brcm,bcm6328-hsspi". -+- reg: Base address and size of the controllers memory area. -+- interrupts: Interrupt for the SPI block. -+- clocks: phandles of the SPI clock and the PLL clock. -+- clock-names: must be "hsspi", "pll". -+- #address-cells: <1>, as required by generic SPI binding. -+- #size-cells: <0>, also as required by generic SPI binding. -+ -+Optional properties: -+- num-cs: some controllers have less than 8 cs signals. Defaults to 8 -+ if absent. -+ -+Child nodes as per the generic SPI binding. -+ -+Example: -+ -+ spi@10001000 { -+ compatible = "brcm,bcm6328-hsspi"; -+ reg = <0x10001000 0x600>; -+ -+ interrupts = <29>; -+ -+ clocks = <&clkctl 9>, <&hsspi_pll>; -+ clock-names = "hsspi", "pll"; -+ -+ num-cs = <2>; -+ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch deleted file mode 100644 index aaf4a59d1..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 776041498c2b285a7f745c924e10fc11ef720eae Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 10 Sep 2015 14:53:53 +0200 -Subject: [PATCH 3/3] spi/bcm63xx-hsspi: allow for probing through devicetree - -Add required binding support to probe through device tree. - -Signed-off-by: Jonas Gorski ---- - drivers/spi/spi-bcm63xx-hsspi.c | 23 ++++++++++++++++++++--- - 1 file changed, 20 insertions(+), 3 deletions(-) - ---- a/drivers/spi/spi-bcm63xx-hsspi.c -+++ b/drivers/spi/spi-bcm63xx-hsspi.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #define HSSPI_GLOBAL_CTRL_REG 0x0 - #define GLOBAL_CTRL_CS_POLARITY_SHIFT 0 -@@ -91,6 +92,7 @@ - - #define HSSPI_MAX_SYNC_CLOCK 30000000 - -+#define HSSPI_SPI_MAX_CS 8 - #define HSSPI_BUS_NUM 1 /* 0 is legacy SPI */ - - struct bcm63xx_hsspi { -@@ -332,7 +334,7 @@ static int bcm63xx_hsspi_probe(struct pl - struct device *dev = &pdev->dev; - struct clk *clk; - int irq, ret; -- u32 reg, rate; -+ u32 reg, rate, num_cs = HSSPI_SPI_MAX_CS; - - irq = platform_get_irq(pdev, 0); - if (irq < 0) { -@@ -382,8 +384,17 @@ static int bcm63xx_hsspi_probe(struct pl - mutex_init(&bs->bus_mutex); - init_completion(&bs->done); - -- master->bus_num = HSSPI_BUS_NUM; -- master->num_chipselect = 8; -+ master->dev.of_node = dev->of_node; -+ if (!dev->of_node) -+ master->bus_num = HSSPI_BUS_NUM; -+ -+ of_property_read_u32(dev->of_node, "num-cs", &num_cs); -+ if (num_cs > 8) { -+ dev_warn(dev, "unsupported number of cs (%i), reducing to 8\n", -+ num_cs); -+ num_cs = HSSPI_SPI_MAX_CS; -+ } -+ master->num_chipselect = num_cs; - master->setup = bcm63xx_hsspi_setup; - master->transfer_one_message = bcm63xx_hsspi_transfer_one; - master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | -@@ -469,10 +480,16 @@ static int bcm63xx_hsspi_resume(struct d - static SIMPLE_DEV_PM_OPS(bcm63xx_hsspi_pm_ops, bcm63xx_hsspi_suspend, - bcm63xx_hsspi_resume); - -+static const struct of_device_id bcm63xx_hsspi_of_match[] = { -+ { .compatible = "brcm,bcm6328-hsspi", }, -+ { }, -+}; -+ - static struct platform_driver bcm63xx_hsspi_driver = { - .driver = { - .name = "bcm63xx-hsspi", - .pm = &bcm63xx_hsspi_pm_ops, -+ .of_match_table = bcm63xx_hsspi_of_match, - }, - .probe = bcm63xx_hsspi_probe, - .remove = bcm63xx_hsspi_remove, diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-07-mdio_bus-Issue-GPIO-RESET-to-PHYs.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-07-mdio_bus-Issue-GPIO-RESET-to-PHYs.patch deleted file mode 100644 index aa813f3d9..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.12-07-mdio_bus-Issue-GPIO-RESET-to-PHYs.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 69226896ad636b94f6d2e55d75ff21a29c4de83b Mon Sep 17 00:00:00 2001 -From: Roger Quadros -Date: Fri, 21 Apr 2017 16:15:38 +0300 -Subject: [PATCH] mdio_bus: Issue GPIO RESET to PHYs. - -Some boards [1] leave the PHYs at an invalid state -during system power-up or reset thus causing unreliability -issues with the PHY which manifests as PHY not being detected -or link not functional. To fix this, these PHYs need to be RESET -via a GPIO connected to the PHY's RESET pin. - -Some boards have a single GPIO controlling the PHY RESET pin of all -PHYs on the bus whereas some others have separate GPIOs controlling -individual PHY RESETs. - -In both cases, the RESET de-assertion cannot be done in the PHY driver -as the PHY will not probe till its reset is de-asserted. -So do the RESET de-assertion in the MDIO bus driver. - -[1] - am572x-idk, am571x-idk, a437x-idk - -Signed-off-by: Roger Quadros -Signed-off-by: David S. Miller ---- - Documentation/devicetree/bindings/net/mdio.txt | 33 ++++++++++++++++++ - drivers/net/phy/mdio_bus.c | 47 ++++++++++++++++++++++++++ - drivers/of/of_mdio.c | 7 ++++ - include/linux/phy.h | 7 ++++ - 4 files changed, 94 insertions(+) - create mode 100644 Documentation/devicetree/bindings/net/mdio.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/net/mdio.txt -@@ -0,0 +1,33 @@ -+Common MDIO bus properties. -+ -+These are generic properties that can apply to any MDIO bus. -+ -+Optional properties: -+- reset-gpios: List of one or more GPIOs that control the RESET lines -+ of the PHYs on that MDIO bus. -+- reset-delay-us: RESET pulse width in microseconds as per PHY datasheet. -+ -+A list of child nodes, one per device on the bus is expected. These -+should follow the generic phy.txt, or a device specific binding document. -+ -+Example : -+This example shows these optional properties, plus other properties -+required for the TI Davinci MDIO driver. -+ -+ davinci_mdio: ethernet@0x5c030000 { -+ compatible = "ti,davinci_mdio"; -+ reg = <0x5c030000 0x1000>; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; -+ reset-delay-us = <2>; /* PHY datasheet states 1us min */ -+ -+ ethphy0: ethernet-phy@1 { -+ reg = <1>; -+ }; -+ -+ ethphy1: ethernet-phy@3 { -+ reg = <3>; -+ }; -+ }; ---- a/drivers/net/phy/mdio_bus.c -+++ b/drivers/net/phy/mdio_bus.c -@@ -22,8 +22,11 @@ - #include - #include - #include -+#include -+#include - #include - #include -+#include - #include - #include - #include -@@ -252,6 +255,7 @@ static inline void of_mdiobus_link_phyde - int __mdiobus_register(struct mii_bus *bus, struct module *owner) - { - int i, err; -+ struct gpio_desc *gpiod; - - if (NULL == bus || NULL == bus->name || - NULL == bus->read || NULL == bus->write) -@@ -278,6 +282,35 @@ int __mdiobus_register(struct mii_bus *b - if (bus->reset) - bus->reset(bus); - -+ /* de-assert bus level PHY GPIO resets */ -+ if (bus->num_reset_gpios > 0) { -+ bus->reset_gpiod = devm_kcalloc(&bus->dev, -+ bus->num_reset_gpios, -+ sizeof(struct gpio_desc *), -+ GFP_KERNEL); -+ if (!bus->reset_gpiod) -+ return -ENOMEM; -+ } -+ -+ for (i = 0; i < bus->num_reset_gpios; i++) { -+ gpiod = devm_gpiod_get_index(&bus->dev, "reset", i, -+ GPIOD_OUT_LOW); -+ if (IS_ERR(gpiod)) { -+ err = PTR_ERR(gpiod); -+ if (err != -ENOENT) { -+ dev_err(&bus->dev, -+ "mii_bus %s couldn't get reset GPIO\n", -+ bus->id); -+ return err; -+ } -+ } else { -+ bus->reset_gpiod[i] = gpiod; -+ gpiod_set_value_cansleep(gpiod, 1); -+ udelay(bus->reset_delay_us); -+ gpiod_set_value_cansleep(gpiod, 0); -+ } -+ } -+ - for (i = 0; i < PHY_MAX_ADDR; i++) { - if ((bus->phy_mask & (1 << i)) == 0) { - struct phy_device *phydev; -@@ -302,6 +335,13 @@ error: - phy_device_free(phydev); - } - } -+ -+ /* Put PHYs in RESET to save power */ -+ for (i = 0; i < bus->num_reset_gpios; i++) { -+ if (bus->reset_gpiod[i]) -+ gpiod_set_value_cansleep(bus->reset_gpiod[i], 1); -+ } -+ - device_del(&bus->dev); - return err; - } -@@ -321,6 +361,13 @@ void mdiobus_unregister(struct mii_bus * - phy_device_free(phydev); - } - } -+ -+ /* Put PHYs in RESET to save power */ -+ for (i = 0; i < bus->num_reset_gpios; i++) { -+ if (bus->reset_gpiod[i]) -+ gpiod_set_value_cansleep(bus->reset_gpiod[i], 1); -+ } -+ - device_del(&bus->dev); - } - EXPORT_SYMBOL(mdiobus_unregister); ---- a/drivers/of/of_mdio.c -+++ b/drivers/of/of_mdio.c -@@ -21,6 +21,8 @@ - #include - #include - -+#define DEFAULT_GPIO_RESET_DELAY 10 /* in microseconds */ -+ - MODULE_AUTHOR("Grant Likely "); - MODULE_LICENSE("GPL"); - -@@ -140,6 +142,11 @@ int of_mdiobus_register(struct mii_bus * - - mdio->dev.of_node = np; - -+ /* Get bus level PHY reset GPIO details */ -+ mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY; -+ of_property_read_u32(np, "reset-delay-us", &mdio->reset_delay_us); -+ mdio->num_reset_gpios = of_gpio_named_count(np, "reset-gpios"); -+ - /* Register the MDIO bus */ - rc = mdiobus_register(mdio); - if (rc) ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -187,6 +187,13 @@ struct mii_bus { - * interrupt at the index matching its address - */ - int *irq; -+ -+ /* GPIO reset pulse width in microseconds */ -+ int reset_delay_us; -+ /* Number of reset GPIOs */ -+ int num_reset_gpios; -+ /* Array of RESET GPIO descriptors */ -+ struct gpio_desc **reset_gpiod; - }; - #define to_mii_bus(d) container_of(d, struct mii_bus, dev) - diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-08-net-phy-Call-bus-reset-after-releasing-PHYs-from-res.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-08-net-phy-Call-bus-reset-after-releasing-PHYs-from-res.patch deleted file mode 100644 index 5788a37de..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.12-08-net-phy-Call-bus-reset-after-releasing-PHYs-from-res.patch +++ /dev/null @@ -1,43 +0,0 @@ -From df0c8d911abf6ba97b2c2fc3c5a12769e0b081a3 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Thu, 11 May 2017 11:24:16 -0700 -Subject: [PATCH] net: phy: Call bus->reset() after releasing PHYs from reset - -The API convention makes it that a given MDIO bus reset should be able -to access PHY devices in its reset() callback and perform additional -MDIO accesses in order to bring the bus and PHYs in a working state. - -Commit 69226896ad63 ("mdio_bus: Issue GPIO RESET to PHYs.") broke that -contract by first calling bus->reset() and then release all PHYs from -reset using their shared GPIO line, so restore the expected -functionality here. - -Fixes: 69226896ad63 ("mdio_bus: Issue GPIO RESET to PHYs.") -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/phy/mdio_bus.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/phy/mdio_bus.c -+++ b/drivers/net/phy/mdio_bus.c -@@ -279,9 +279,6 @@ int __mdiobus_register(struct mii_bus *b - - mutex_init(&bus->mdio_lock); - -- if (bus->reset) -- bus->reset(bus); -- - /* de-assert bus level PHY GPIO resets */ - if (bus->num_reset_gpios > 0) { - bus->reset_gpiod = devm_kcalloc(&bus->dev, -@@ -311,6 +308,9 @@ int __mdiobus_register(struct mii_bus *b - } - } - -+ if (bus->reset) -+ bus->reset(bus); -+ - for (i = 0; i < PHY_MAX_ADDR; i++) { - if ((bus->phy_mask & (1 << i)) == 0) { - struct phy_device *phydev; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.13-01-leds-bcm6328-fix-signal-source-assignment-for-high-l.patch b/target/linux/brcm63xx/patches-4.4/001-4.13-01-leds-bcm6328-fix-signal-source-assignment-for-high-l.patch deleted file mode 100644 index d8a5a3983..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.13-01-leds-bcm6328-fix-signal-source-assignment-for-high-l.patch +++ /dev/null @@ -1,34 +0,0 @@ -From dc90895d776d7b8017bc3b14f588d569d8edbe1f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 11 May 2017 13:36:52 +0200 -Subject: [PATCH] leds: bcm6328: fix signal source assignment for high leds - -Each nibble represents 4 LEDs, and in case of the higher register, bit 0 -represents LED 4, so we need to use modulus for the LED number as well. - -Fixes: fd7b025a238d0a5440bfa26c585eb78097bf48dc ("leds: add BCM6328 LED driver") -Signed-off-by: Jonas Gorski ---- - drivers/leds/leds-bcm6328.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/leds/leds-bcm6328.c -+++ b/drivers/leds/leds-bcm6328.c -@@ -224,7 +224,7 @@ static int bcm6328_hwled(struct device * - - spin_lock_irqsave(lock, flags); - val = bcm6328_led_read(addr); -- val |= (BIT(reg) << (((sel % 4) * 4) + 16)); -+ val |= (BIT(reg % 4) << (((sel % 4) * 4) + 16)); - bcm6328_led_write(addr, val); - spin_unlock_irqrestore(lock, flags); - } -@@ -251,7 +251,7 @@ static int bcm6328_hwled(struct device * - - spin_lock_irqsave(lock, flags); - val = bcm6328_led_read(addr); -- val |= (BIT(reg) << ((sel % 4) * 4)); -+ val |= (BIT(reg % 4) << ((sel % 4) * 4)); - bcm6328_led_write(addr, val); - spin_unlock_irqrestore(lock, flags); - } diff --git a/target/linux/brcm63xx/patches-4.4/001-4.13-02-mdio_bus-handle-only-single-PHY-reset-GPIO.patch b/target/linux/brcm63xx/patches-4.4/001-4.13-02-mdio_bus-handle-only-single-PHY-reset-GPIO.patch deleted file mode 100644 index 7ce5eb59c..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.13-02-mdio_bus-handle-only-single-PHY-reset-GPIO.patch +++ /dev/null @@ -1,120 +0,0 @@ -From d396e84c56047b303cac378dde4b2e5cc430b336 Mon Sep 17 00:00:00 2001 -From: Sergei Shtylyov -Date: Mon, 12 Jun 2017 23:55:38 +0300 -Subject: [PATCH] mdio_bus: handle only single PHY reset GPIO - -Commit 4c5e7a2c0501 ("dt-bindings: mdio: Clarify binding document") -declared that a MDIO reset GPIO property should have only a single GPIO -reference/specifier, however the supporting code was left intact, still -burdening the kernel with now apparently useless loops -- get rid of them. - -Signed-off-by: Sergei Shtylyov -Signed-off-by: David S. Miller ---- - drivers/net/phy/mdio_bus.c | 53 +++++++++++++++++----------------------------- - drivers/of/of_mdio.c | 1 - - include/linux/phy.h | 6 ++---- - 3 files changed, 21 insertions(+), 39 deletions(-) - ---- a/drivers/net/phy/mdio_bus.c -+++ b/drivers/net/phy/mdio_bus.c -@@ -279,33 +279,22 @@ int __mdiobus_register(struct mii_bus *b - - mutex_init(&bus->mdio_lock); - -- /* de-assert bus level PHY GPIO resets */ -- if (bus->num_reset_gpios > 0) { -- bus->reset_gpiod = devm_kcalloc(&bus->dev, -- bus->num_reset_gpios, -- sizeof(struct gpio_desc *), -- GFP_KERNEL); -- if (!bus->reset_gpiod) -- return -ENOMEM; -- } -- -- for (i = 0; i < bus->num_reset_gpios; i++) { -- gpiod = devm_gpiod_get_index(&bus->dev, "reset", i, -- GPIOD_OUT_LOW); -- if (IS_ERR(gpiod)) { -- err = PTR_ERR(gpiod); -- if (err != -ENOENT) { -- dev_err(&bus->dev, -- "mii_bus %s couldn't get reset GPIO\n", -- bus->id); -- return err; -- } -- } else { -- bus->reset_gpiod[i] = gpiod; -- gpiod_set_value_cansleep(gpiod, 1); -- udelay(bus->reset_delay_us); -- gpiod_set_value_cansleep(gpiod, 0); -+ /* de-assert bus level PHY GPIO reset */ -+ gpiod = devm_gpiod_get(&bus->dev, "reset", GPIOD_OUT_LOW); -+ if (IS_ERR(gpiod)) { -+ err = PTR_ERR(gpiod); -+ if (err != -ENOENT) { -+ dev_err(&bus->dev, -+ "mii_bus %s couldn't get reset GPIO\n", -+ bus->id); -+ return err; - } -+ } else { -+ bus->reset_gpiod = gpiod; -+ -+ gpiod_set_value_cansleep(gpiod, 1); -+ udelay(bus->reset_delay_us); -+ gpiod_set_value_cansleep(gpiod, 0); - } - - if (bus->reset) -@@ -337,10 +326,8 @@ error: - } - - /* Put PHYs in RESET to save power */ -- for (i = 0; i < bus->num_reset_gpios; i++) { -- if (bus->reset_gpiod[i]) -- gpiod_set_value_cansleep(bus->reset_gpiod[i], 1); -- } -+ if (bus->reset_gpiod) -+ gpiod_set_value_cansleep(bus->reset_gpiod, 1); - - device_del(&bus->dev); - return err; -@@ -363,10 +350,8 @@ void mdiobus_unregister(struct mii_bus * - } - - /* Put PHYs in RESET to save power */ -- for (i = 0; i < bus->num_reset_gpios; i++) { -- if (bus->reset_gpiod[i]) -- gpiod_set_value_cansleep(bus->reset_gpiod[i], 1); -- } -+ if (bus->reset_gpiod) -+ gpiod_set_value_cansleep(bus->reset_gpiod, 1); - - device_del(&bus->dev); - } ---- a/drivers/of/of_mdio.c -+++ b/drivers/of/of_mdio.c -@@ -145,7 +145,6 @@ int of_mdiobus_register(struct mii_bus * - /* Get bus level PHY reset GPIO details */ - mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY; - of_property_read_u32(np, "reset-delay-us", &mdio->reset_delay_us); -- mdio->num_reset_gpios = of_gpio_named_count(np, "reset-gpios"); - - /* Register the MDIO bus */ - rc = mdiobus_register(mdio); ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -190,10 +190,8 @@ struct mii_bus { - - /* GPIO reset pulse width in microseconds */ - int reset_delay_us; -- /* Number of reset GPIOs */ -- int num_reset_gpios; -- /* Array of RESET GPIO descriptors */ -- struct gpio_desc **reset_gpiod; -+ /* RESET GPIO descriptor pointer */ -+ struct gpio_desc *reset_gpiod; - }; - #define to_mii_bus(d) container_of(d, struct mii_bus, dev) - diff --git a/target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch b/target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch deleted file mode 100644 index d7ac6234c..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch +++ /dev/null @@ -1,39 +0,0 @@ -From fe0e4052fb11d5c713961ab7e136520be40052a3 Mon Sep 17 00:00:00 2001 -From: Sergei Shtylyov -Date: Mon, 12 Jun 2017 23:55:39 +0300 -Subject: [PATCH] mdio_bus: use devm_gpiod_get_optional() - -The MDIO reset GPIO is really a classical optional GPIO property case, -so devm_gpiod_get_optional() should have been used, not devm_gpiod_get(). -Doing this saves several LoCs... - -Signed-off-by: Sergei Shtylyov -Signed-off-by: David S. Miller ---- - drivers/net/phy/mdio_bus.c | 14 +++++--------- - 1 file changed, 5 insertions(+), 9 deletions(-) - ---- a/drivers/net/phy/mdio_bus.c -+++ b/drivers/net/phy/mdio_bus.c -@@ -280,16 +280,12 @@ int __mdiobus_register(struct mii_bus *b - mutex_init(&bus->mdio_lock); - - /* de-assert bus level PHY GPIO reset */ -- gpiod = devm_gpiod_get(&bus->dev, "reset", GPIOD_OUT_LOW); -+ gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(gpiod)) { -- err = PTR_ERR(gpiod); -- if (err != -ENOENT) { -- dev_err(&bus->dev, -- "mii_bus %s couldn't get reset GPIO\n", -- bus->id); -- return err; -- } -- } else { -+ dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n", -+ bus->id); -+ return PTR_ERR(gpiod); -+ } else if (gpiod) { - bus->reset_gpiod = gpiod; - - gpiod_set_value_cansleep(gpiod, 1); diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-01-MIPS-BCM63XX-add-clkdev-lookup-support.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-01-MIPS-BCM63XX-add-clkdev-lookup-support.patch deleted file mode 100644 index 08511d69f..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-01-MIPS-BCM63XX-add-clkdev-lookup-support.patch +++ /dev/null @@ -1,210 +0,0 @@ -From e74caf41aec5338b8cbbd0a1483650848f16f532 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 16 Jul 2017 12:23:47 +0200 -Subject: [PATCH V2 1/8] MIPS: BCM63XX: add clkdev lookup support - -Enable clkdev lookup support to allow us providing clocks under -different names to devices more easily, so we don't need to care -about clock name clashes anymore. - -Reviewed-by: Florian Fainelli -Signed-off-by: Jonas Gorski ---- - arch/mips/Kconfig | 1 + - arch/mips/bcm63xx/clk.c | 150 +++++++++++++++++++++++++++++++++++++----------- - 2 files changed, 116 insertions(+), 35 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -214,6 +214,7 @@ config BCM63XX - select ARCH_REQUIRE_GPIOLIB - select HAVE_CLK - select MIPS_L1_CACHE_SHIFT_4 -+ select CLKDEV_LOOKUP - help - Support for BCM63XX based boards - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -352,44 +353,103 @@ long clk_round_rate(struct clk *clk, uns - } - EXPORT_SYMBOL_GPL(clk_round_rate); - --struct clk *clk_get(struct device *dev, const char *id) --{ -- if (!strcmp(id, "enet0")) -- return &clk_enet0; -- if (!strcmp(id, "enet1")) -- return &clk_enet1; -- if (!strcmp(id, "enetsw")) -- return &clk_enetsw; -- if (!strcmp(id, "ephy")) -- return &clk_ephy; -- if (!strcmp(id, "usbh")) -- return &clk_usbh; -- if (!strcmp(id, "usbd")) -- return &clk_usbd; -- if (!strcmp(id, "spi")) -- return &clk_spi; -- if (!strcmp(id, "hsspi")) -- return &clk_hsspi; -- if (!strcmp(id, "xtm")) -- return &clk_xtm; -- if (!strcmp(id, "periph")) -- return &clk_periph; -- if ((BCMCPU_IS_3368() || BCMCPU_IS_6358()) && !strcmp(id, "pcm")) -- return &clk_pcm; -- if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec")) -- return &clk_ipsec; -- if ((BCMCPU_IS_6328() || BCMCPU_IS_6362()) && !strcmp(id, "pcie")) -- return &clk_pcie; -- return ERR_PTR(-ENOENT); --} -- --EXPORT_SYMBOL(clk_get); -- --void clk_put(struct clk *clk) --{ --} -- --EXPORT_SYMBOL(clk_put); -+static struct clk_lookup bcm3368_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enet0", &clk_enet0), -+ CLKDEV_INIT(NULL, "enet1", &clk_enet1), -+ CLKDEV_INIT(NULL, "ephy", &clk_ephy), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT(NULL, "pcm", &clk_pcm), -+}; -+ -+static struct clk_lookup bcm6328_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "hsspi", &clk_hsspi), -+ CLKDEV_INIT(NULL, "pcie", &clk_pcie), -+}; -+ -+static struct clk_lookup bcm6338_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enet0", &clk_enet0), -+ CLKDEV_INIT(NULL, "enet1", &clk_enet1), -+ CLKDEV_INIT(NULL, "ephy", &clk_ephy), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+}; -+ -+static struct clk_lookup bcm6345_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enet0", &clk_enet0), -+ CLKDEV_INIT(NULL, "enet1", &clk_enet1), -+ CLKDEV_INIT(NULL, "ephy", &clk_ephy), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+}; -+ -+static struct clk_lookup bcm6348_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enet0", &clk_enet0), -+ CLKDEV_INIT(NULL, "enet1", &clk_enet1), -+ CLKDEV_INIT(NULL, "ephy", &clk_ephy), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+}; -+ -+static struct clk_lookup bcm6358_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enet0", &clk_enet0), -+ CLKDEV_INIT(NULL, "enet1", &clk_enet1), -+ CLKDEV_INIT(NULL, "ephy", &clk_ephy), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT(NULL, "pcm", &clk_pcm), -+}; -+ -+static struct clk_lookup bcm6362_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT(NULL, "hsspi", &clk_hsspi), -+ CLKDEV_INIT(NULL, "pcie", &clk_pcie), -+ CLKDEV_INIT(NULL, "ipsec", &clk_ipsec), -+}; -+ -+static struct clk_lookup bcm6368_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT(NULL, "xtm", &clk_xtm), -+ CLKDEV_INIT(NULL, "ipsec", &clk_ipsec), -+}; - - #define HSSPI_PLL_HZ_6328 133333333 - #define HSSPI_PLL_HZ_6362 400000000 -@@ -397,11 +457,31 @@ EXPORT_SYMBOL(clk_put); - static int __init bcm63xx_clk_init(void) - { - switch (bcm63xx_get_cpu_id()) { -+ case BCM3368_CPU_ID: -+ clkdev_add_table(bcm3368_clks, ARRAY_SIZE(bcm3368_clks)); -+ break; - case BCM6328_CPU_ID: - clk_hsspi.rate = HSSPI_PLL_HZ_6328; -+ clkdev_add_table(bcm6328_clks, ARRAY_SIZE(bcm6328_clks)); -+ break; -+ case BCM6338_CPU_ID: -+ clkdev_add_table(bcm6338_clks, ARRAY_SIZE(bcm6338_clks)); -+ break; -+ case BCM6345_CPU_ID: -+ clkdev_add_table(bcm6345_clks, ARRAY_SIZE(bcm6345_clks)); -+ break; -+ case BCM6348_CPU_ID: -+ clkdev_add_table(bcm6348_clks, ARRAY_SIZE(bcm6348_clks)); -+ break; -+ case BCM6358_CPU_ID: -+ clkdev_add_table(bcm6358_clks, ARRAY_SIZE(bcm6358_clks)); - break; - case BCM6362_CPU_ID: - clk_hsspi.rate = HSSPI_PLL_HZ_6362; -+ clkdev_add_table(bcm6362_clks, ARRAY_SIZE(bcm6362_clks)); -+ break; -+ case BCM6368_CPU_ID: -+ clkdev_add_table(bcm6368_clks, ARRAY_SIZE(bcm6368_clks)); - break; - } - diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-02-MIPS-BCM63XX-provide-periph-clock-as-refclk-for-uart.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-02-MIPS-BCM63XX-provide-periph-clock-as-refclk-for-uart.patch deleted file mode 100644 index 2b3ca16de..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-02-MIPS-BCM63XX-provide-periph-clock-as-refclk-for-uart.patch +++ /dev/null @@ -1,84 +0,0 @@ -From d0322bf7bebe87012b4f95c85be6b5ba0cb6f344 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 16 Jul 2017 12:31:44 +0200 -Subject: [PATCH V2 2/8] MIPS: BCM63XX: provide periph clock as refclk for uart - -Add a lookup as "refclk" to describe its function for the uarts. - -Reviewed-by: Florian Fainelli -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/clk.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -356,6 +356,8 @@ EXPORT_SYMBOL_GPL(clk_round_rate); - static struct clk_lookup bcm3368_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -369,6 +371,8 @@ static struct clk_lookup bcm3368_clks[] - static struct clk_lookup bcm6328_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -380,6 +384,7 @@ static struct clk_lookup bcm6328_clks[] - static struct clk_lookup bcm6338_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -392,6 +397,7 @@ static struct clk_lookup bcm6338_clks[] - static struct clk_lookup bcm6345_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -404,6 +410,7 @@ static struct clk_lookup bcm6345_clks[] - static struct clk_lookup bcm6348_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -416,6 +423,8 @@ static struct clk_lookup bcm6348_clks[] - static struct clk_lookup bcm6358_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -429,6 +438,8 @@ static struct clk_lookup bcm6358_clks[] - static struct clk_lookup bcm6362_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -442,6 +453,8 @@ static struct clk_lookup bcm6362_clks[] - static struct clk_lookup bcm6368_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-03-tty-bcm63xx_uart-use-refclk-for-the-expected-clock-n.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-03-tty-bcm63xx_uart-use-refclk-for-the-expected-clock-n.patch deleted file mode 100644 index 5152fbe24..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-03-tty-bcm63xx_uart-use-refclk-for-the-expected-clock-n.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 8124706e6040b1cf0d2dd3a05759df6cec4bddfb Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 16 Jul 2017 12:32:37 +0200 -Subject: [PATCH V2 3/8] tty/bcm63xx_uart: use refclk for the expected clock - name - -We now have the clock available under refclk, so use that. - -Acked-by: Greg Kroah-Hartman -Reviewed-by: Florian Fainelli -Signed-off-by: Jonas Gorski ---- - drivers/tty/serial/bcm63xx_uart.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/tty/serial/bcm63xx_uart.c -+++ b/drivers/tty/serial/bcm63xx_uart.c -@@ -842,7 +842,7 @@ static int bcm_uart_probe(struct platfor - return -ENODEV; - - clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) : -- clk_get(&pdev->dev, "periph"); -+ clk_get(&pdev->dev, "refclk"); - if (IS_ERR(clk)) - return -ENODEV; - diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-04-tty-bcm63xx_uart-allow-naming-clock-in-device-tree.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-04-tty-bcm63xx_uart-allow-naming-clock-in-device-tree.patch deleted file mode 100644 index a8fd5afcb..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-04-tty-bcm63xx_uart-allow-naming-clock-in-device-tree.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 317f8659bba01b307cbe4e9902d4e3d333fd7164 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 16 Jul 2017 12:39:17 +0200 -Subject: [PATCH V2 4/8] tty/bcm63xx_uart: allow naming clock in device tree - -Codify using a named clock for the refclk of the uart. This makes it -easier if we might need to add a gating clock (like present on the -BCM6345). - -Acked-by: Rob Herring -Acked-by: Greg Kroah-Hartman -Reviewed-by: Florian Fainelli -Signed-off-by: Jonas Gorski ---- - Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt | 6 ++++++ - drivers/tty/serial/bcm63xx_uart.c | 6 ++++-- - 2 files changed, 10 insertions(+), 2 deletions(-) - ---- a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt -+++ b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt -@@ -11,6 +11,11 @@ Required properties: - - clocks: Clock driving the hardware; used to figure out the baud rate - divisor. - -+ -+Optional properties: -+ -+- clock-names: Should be "refclk". -+ - Example: - - uart0: serial@14e00520 { -@@ -19,6 +24,7 @@ Example: - interrupt-parent = <&periph_intc>; - interrupts = <2>; - clocks = <&periph_clk>; -+ clock-names = "refclk"; - }; - - clocks { ---- a/drivers/tty/serial/bcm63xx_uart.c -+++ b/drivers/tty/serial/bcm63xx_uart.c -@@ -841,8 +841,10 @@ static int bcm_uart_probe(struct platfor - if (!res_irq) - return -ENODEV; - -- clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) : -- clk_get(&pdev->dev, "refclk"); -+ clk = clk_get(&pdev->dev, "refclk"); -+ if (IS_ERR(clk) && pdev->dev.of_node) -+ clk = of_clk_get(pdev->dev.of_node, 0); -+ - if (IS_ERR(clk)) - return -ENODEV; - diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-05-MIPS-BCM63XX-move-the-HSSPI-PLL-HZ-into-its-own-cloc.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-05-MIPS-BCM63XX-move-the-HSSPI-PLL-HZ-into-its-own-cloc.patch deleted file mode 100644 index 3d9deee79..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-05-MIPS-BCM63XX-move-the-HSSPI-PLL-HZ-into-its-own-cloc.patch +++ /dev/null @@ -1,62 +0,0 @@ -From cb86630379c8f3432c916d62045b5176f17f4123 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 16 Jul 2017 12:57:21 +0200 -Subject: [PATCH V2 6/8] MIPS: BCM63XX: move the HSSPI PLL HZ into its own - clock - -Split up the HSSPL clock into rate and a gate clock, to more closely -match the actual hardware. - -Reviewed-by: Florian Fainelli -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/clk.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -247,6 +247,10 @@ static struct clk clk_hsspi = { - .set = hsspi_set, - }; - -+/* -+ * HSSPI PLL -+ */ -+static struct clk clk_hsspi_pll; - - /* - * XTM clock -@@ -373,6 +377,7 @@ static struct clk_lookup bcm6328_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -440,6 +445,7 @@ static struct clk_lookup bcm6362_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -474,7 +480,7 @@ static int __init bcm63xx_clk_init(void) - clkdev_add_table(bcm3368_clks, ARRAY_SIZE(bcm3368_clks)); - break; - case BCM6328_CPU_ID: -- clk_hsspi.rate = HSSPI_PLL_HZ_6328; -+ clk_hsspi_pll.rate = HSSPI_PLL_HZ_6328; - clkdev_add_table(bcm6328_clks, ARRAY_SIZE(bcm6328_clks)); - break; - case BCM6338_CPU_ID: -@@ -490,7 +496,7 @@ static int __init bcm63xx_clk_init(void) - clkdev_add_table(bcm6358_clks, ARRAY_SIZE(bcm6358_clks)); - break; - case BCM6362_CPU_ID: -- clk_hsspi.rate = HSSPI_PLL_HZ_6362; -+ clk_hsspi_pll.rate = HSSPI_PLL_HZ_6362; - clkdev_add_table(bcm6362_clks, ARRAY_SIZE(bcm6362_clks)); - break; - case BCM6368_CPU_ID: diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-06-MIPS-BCM63XX-provide-enet-clocks-as-enet-to-the-ethe.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-06-MIPS-BCM63XX-provide-enet-clocks-as-enet-to-the-ethe.patch deleted file mode 100644 index 0eafe5f72..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-06-MIPS-BCM63XX-provide-enet-clocks-as-enet-to-the-ethe.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 6d43970a2eb1c7ee88caf7328d201f9c001262e9 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 16 Jul 2017 12:48:41 +0200 -Subject: [PATCH V2 7/8] MIPS: BCM63XX: provide enet clocks as "enet" to the - ethernet devices - -Add lookups to provide the appropriate enetX clocks as just "enet" to -the ethernet devices. - -Reviewed-by: Florian Fainelli -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/clk.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -370,6 +370,8 @@ static struct clk_lookup bcm3368_clks[] - CLKDEV_INIT(NULL, "usbd", &clk_usbd), - CLKDEV_INIT(NULL, "spi", &clk_spi), - CLKDEV_INIT(NULL, "pcm", &clk_pcm), -+ CLKDEV_INIT("bcm63xx_enet.0", "enet", &clk_enet0), -+ CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet1), - }; - - static struct clk_lookup bcm6328_clks[] = { -@@ -397,6 +399,7 @@ static struct clk_lookup bcm6338_clks[] - CLKDEV_INIT(NULL, "usbh", &clk_usbh), - CLKDEV_INIT(NULL, "usbd", &clk_usbd), - CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT("bcm63xx_enet.0", "enet", &clk_enet_misc), - }; - - static struct clk_lookup bcm6345_clks[] = { -@@ -410,6 +413,7 @@ static struct clk_lookup bcm6345_clks[] - CLKDEV_INIT(NULL, "usbh", &clk_usbh), - CLKDEV_INIT(NULL, "usbd", &clk_usbd), - CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT("bcm63xx_enet.0", "enet", &clk_enet_misc), - }; - - static struct clk_lookup bcm6348_clks[] = { -@@ -423,6 +427,8 @@ static struct clk_lookup bcm6348_clks[] - CLKDEV_INIT(NULL, "usbh", &clk_usbh), - CLKDEV_INIT(NULL, "usbd", &clk_usbd), - CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT("bcm63xx_enet.0", "enet", &clk_enet_misc), -+ CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet_misc), - }; - - static struct clk_lookup bcm6358_clks[] = { -@@ -438,6 +444,8 @@ static struct clk_lookup bcm6358_clks[] - CLKDEV_INIT(NULL, "usbd", &clk_usbd), - CLKDEV_INIT(NULL, "spi", &clk_spi), - CLKDEV_INIT(NULL, "pcm", &clk_pcm), -+ CLKDEV_INIT("bcm63xx_enet.0", "enet", &clk_enet0), -+ CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet1), - }; - - static struct clk_lookup bcm6362_clks[] = { diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-07-MIPS-BCM63XX-split-out-swpkt_sar-usb-clocks.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-07-MIPS-BCM63XX-split-out-swpkt_sar-usb-clocks.patch deleted file mode 100644 index b53660182..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-07-MIPS-BCM63XX-split-out-swpkt_sar-usb-clocks.patch +++ /dev/null @@ -1,105 +0,0 @@ -From b98027285bd1fa95da0645a4234a5fc1f1a83f92 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 26 Feb 2017 11:59:52 +0100 -Subject: [PATCH V2 8/8] MIPS: BCM63XX: split out swpkt_sar/usb clocks - -Make the secondary switch clocks their own clocks. This allows proper -enable reference counting between SAR/XTM and the main switch clocks, -and controlling them individually from drivers. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/clk.c | 61 +++++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 51 insertions(+), 10 deletions(-) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -121,21 +121,56 @@ static struct clk clk_ephy = { - }; - - /* -+ * Ethernet switch SAR clock -+ */ -+static void swpkt_sar_set(struct clk *clk, int enable) -+{ -+ if (BCMCPU_IS_6368()) -+ bcm_hwclock_set(CKCTL_6368_SWPKT_SAR_EN, enable); -+ else -+ return; -+} -+ -+static struct clk clk_swpkt_sar = { -+ .set = swpkt_sar_set, -+}; -+ -+/* -+ * Ethernet switch USB clock -+ */ -+static void swpkt_usb_set(struct clk *clk, int enable) -+{ -+ if (BCMCPU_IS_6368()) -+ bcm_hwclock_set(CKCTL_6368_SWPKT_USB_EN, enable); -+ else -+ return; -+} -+ -+static struct clk clk_swpkt_usb = { -+ .set = swpkt_usb_set, -+}; -+ -+/* - * Ethernet switch clock - */ - static void enetsw_set(struct clk *clk, int enable) - { -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6328()) { - bcm_hwclock_set(CKCTL_6328_ROBOSW_EN, enable); -- else if (BCMCPU_IS_6362()) -+ } else if (BCMCPU_IS_6362()) { - bcm_hwclock_set(CKCTL_6362_ROBOSW_EN, enable); -- else if (BCMCPU_IS_6368()) -- bcm_hwclock_set(CKCTL_6368_ROBOSW_EN | -- CKCTL_6368_SWPKT_USB_EN | -- CKCTL_6368_SWPKT_SAR_EN, -- enable); -- else -+ } else if (BCMCPU_IS_6368()) { -+ if (enable) { -+ clk_enable_unlocked(&clk_swpkt_sar); -+ clk_enable_unlocked(&clk_swpkt_usb); -+ } else { -+ clk_disable_unlocked(&clk_swpkt_usb); -+ clk_disable_unlocked(&clk_swpkt_sar); -+ } -+ bcm_hwclock_set(CKCTL_6368_ROBOSW_EN, enable); -+ } else { - return; -+ } - - if (enable) { - /* reset switch core afer clock change */ -@@ -260,8 +295,12 @@ static void xtm_set(struct clk *clk, int - if (!BCMCPU_IS_6368()) - return; - -- bcm_hwclock_set(CKCTL_6368_SAR_EN | -- CKCTL_6368_SWPKT_SAR_EN, enable); -+ if (enable) -+ clk_enable_unlocked(&clk_swpkt_sar); -+ else -+ clk_disable_unlocked(&clk_swpkt_sar); -+ -+ bcm_hwclock_set(CKCTL_6368_SAR_EN, enable); - - if (enable) { - /* reset sar core afer clock change */ -@@ -444,6 +483,8 @@ static struct clk_lookup bcm6358_clks[] - CLKDEV_INIT(NULL, "usbd", &clk_usbd), - CLKDEV_INIT(NULL, "spi", &clk_spi), - CLKDEV_INIT(NULL, "pcm", &clk_pcm), -+ CLKDEV_INIT(NULL, "swpkt_sar", &clk_swpkt_sar), -+ CLKDEV_INIT(NULL, "swpkt_usb", &clk_swpkt_usb), - CLKDEV_INIT("bcm63xx_enet.0", "enet", &clk_enet0), - CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet1), - }; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch deleted file mode 100644 index b85f38b59..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch +++ /dev/null @@ -1,101 +0,0 @@ -From d0423d3e4fa7ae305729cb50369427f075ccb279 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 25 Feb 2017 12:41:28 +0100 -Subject: [PATCH 1/6] bcm63xx_enet: correct clock usage - -Check the return code of prepare_enable and change one last instance of -enable only to prepare_enable. Also properly disable and release the -clock in error paths and on remove for enetsw. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 31 +++++++++++++++++++++------- - 1 file changed, 23 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1787,7 +1787,9 @@ static int bcm_enet_probe(struct platfor - ret = PTR_ERR(priv->mac_clk); - goto out; - } -- clk_prepare_enable(priv->mac_clk); -+ ret = clk_prepare_enable(priv->mac_clk); -+ if (ret) -+ goto out_put_clk_mac; - - /* initialize default and fetch platform data */ - priv->rx_ring_size = BCMENET_DEF_RX_DESC; -@@ -1819,9 +1821,11 @@ static int bcm_enet_probe(struct platfor - if (IS_ERR(priv->phy_clk)) { - ret = PTR_ERR(priv->phy_clk); - priv->phy_clk = NULL; -- goto out_put_clk_mac; -+ goto out_disable_clk_mac; - } -- clk_prepare_enable(priv->phy_clk); -+ ret = clk_prepare_enable(priv->phy_clk); -+ if (ret) -+ goto out_put_clk_phy; - } - - /* do minimal hardware init to be able to probe mii bus */ -@@ -1921,13 +1925,16 @@ out_free_mdio: - out_uninit_hw: - /* turn off mdc clock */ - enet_writel(priv, 0, ENET_MIISC_REG); -- if (priv->phy_clk) { -+ if (priv->phy_clk) - clk_disable_unprepare(priv->phy_clk); -+ -+out_put_clk_phy: -+ if (priv->phy_clk) - clk_put(priv->phy_clk); -- } - --out_put_clk_mac: -+out_disable_clk_mac: - clk_disable_unprepare(priv->mac_clk); -+out_put_clk_mac: - clk_put(priv->mac_clk); - out: - free_netdev(dev); -@@ -2772,7 +2779,9 @@ static int bcm_enetsw_probe(struct platf - ret = PTR_ERR(priv->mac_clk); - goto out_unmap; - } -- clk_enable(priv->mac_clk); -+ ret = clk_prepare_enable(priv->mac_clk); -+ if (ret) -+ goto out_put_clk; - - priv->rx_chan = 0; - priv->tx_chan = 1; -@@ -2793,7 +2802,7 @@ static int bcm_enetsw_probe(struct platf - - ret = register_netdev(dev); - if (ret) -- goto out_put_clk; -+ goto out_disable_clk; - - netif_carrier_off(dev); - platform_set_drvdata(pdev, dev); -@@ -2802,6 +2811,9 @@ static int bcm_enetsw_probe(struct platf - - return 0; - -+out_disable_clk: -+ clk_disable_unprepare(priv->mac_clk); -+ - out_put_clk: - clk_put(priv->mac_clk); - -@@ -2833,6 +2845,9 @@ static int bcm_enetsw_remove(struct plat - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res->start, resource_size(res)); - -+ clk_disable_unprepare(priv->mac_clk); -+ clk_put(priv->mac_clk); -+ - free_netdev(dev); - return 0; - } diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch deleted file mode 100644 index 22c6d0187..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 23d94cb855b6f4f0ee1c01679224472104ac6440 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 30 Sep 2017 14:10:18 +0200 -Subject: [PATCH 2/6] bcm63xx_enet: do not write to random DMA channel on - BCM6345 - -The DMA controller regs actually point to DMA channel 0, so the write to -ENETDMA_CFG_REG will actually modify a random DMA channel. - -Since DMA controller registers do not exist on BCM6345, guard the write -with the usual check for dma_has_sram. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1063,7 +1063,8 @@ static int bcm_enet_open(struct net_devi - val = enet_readl(priv, ENET_CTL_REG); - val |= ENET_CTL_ENABLE_MASK; - enet_writel(priv, val, ENET_CTL_REG); -- enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); -+ if (priv->dma_has_sram) -+ enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); - enet_dmac_writel(priv, priv->dma_chan_en_mask, - ENETDMAC_CHANCFG, priv->rx_chan); - diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-10-bcm63xx_enet-do-not-rely-on-probe-order.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-10-bcm63xx_enet-do-not-rely-on-probe-order.patch deleted file mode 100644 index b14dedcd7..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-10-bcm63xx_enet-do-not-rely-on-probe-order.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 71710bb6cbc82f411a4e5faafa0c3178e48e7137 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 30 May 2017 13:31:45 +0200 -Subject: [PATCH 3/6] bcm63xx_enet: do not rely on probe order - -Do not rely on the shared device being probed before the enet(sw) -devices. This makes it easier to eventually move out the shared -device as a dma controller driver (what it should be). - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 9 ++------- - 1 file changed, 2 insertions(+), 7 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1736,10 +1736,8 @@ static int bcm_enet_probe(struct platfor - const char *clk_name; - int i, ret; - -- /* stop if shared driver failed, assume driver->probe will be -- * called in the same order we register devices (correct ?) */ - if (!bcm_enet_shared_base[0]) -- return -ENODEV; -+ return -EPROBE_DEFER; - - res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - res_irq_rx = platform_get_resource(pdev, IORESOURCE_IRQ, 1); -@@ -2720,11 +2718,8 @@ static int bcm_enetsw_probe(struct platf - struct resource *res_mem; - int ret, irq_rx, irq_tx; - -- /* stop if shared driver failed, assume driver->probe will be -- * called in the same order we register devices (correct ?) -- */ - if (!bcm_enet_shared_base[0]) -- return -ENODEV; -+ return -EPROBE_DEFER; - - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - irq_rx = platform_get_irq(pdev, 0); diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-11-bcm63xx_enet-use-managed-functions-for-clock-ioremap.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-11-bcm63xx_enet-use-managed-functions-for-clock-ioremap.patch deleted file mode 100644 index ae009064b..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-11-bcm63xx_enet-use-managed-functions-for-clock-ioremap.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 179a445ae4ef36ec44f4aea18e5f42d21334d186 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 25 Feb 2017 12:39:25 +0100 -Subject: [PATCH 4/6] bcm63xx_enet: use managed functions for clock/ioremap - -Use managed functions where possible to reduce the amount of resource -handling on error and remove paths. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 54 +++++++--------------------- - 1 file changed, 12 insertions(+), 42 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1781,14 +1781,14 @@ static int bcm_enet_probe(struct platfor - clk_name = "enet1"; - } - -- priv->mac_clk = clk_get(&pdev->dev, clk_name); -+ priv->mac_clk = devm_clk_get(&pdev->dev, clk_name); - if (IS_ERR(priv->mac_clk)) { - ret = PTR_ERR(priv->mac_clk); - goto out; - } - ret = clk_prepare_enable(priv->mac_clk); - if (ret) -- goto out_put_clk_mac; -+ goto out; - - /* initialize default and fetch platform data */ - priv->rx_ring_size = BCMENET_DEF_RX_DESC; -@@ -1816,7 +1816,7 @@ static int bcm_enet_probe(struct platfor - - if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) { - /* using internal PHY, enable clock */ -- priv->phy_clk = clk_get(&pdev->dev, "ephy"); -+ priv->phy_clk = devm_clk_get(&pdev->dev, "ephy"); - if (IS_ERR(priv->phy_clk)) { - ret = PTR_ERR(priv->phy_clk); - priv->phy_clk = NULL; -@@ -1824,7 +1824,7 @@ static int bcm_enet_probe(struct platfor - } - ret = clk_prepare_enable(priv->phy_clk); - if (ret) -- goto out_put_clk_phy; -+ goto out_disable_clk_mac; - } - - /* do minimal hardware init to be able to probe mii bus */ -@@ -1927,14 +1927,8 @@ out_uninit_hw: - if (priv->phy_clk) - clk_disable_unprepare(priv->phy_clk); - --out_put_clk_phy: -- if (priv->phy_clk) -- clk_put(priv->phy_clk); -- - out_disable_clk_mac: - clk_disable_unprepare(priv->mac_clk); --out_put_clk_mac: -- clk_put(priv->mac_clk); - out: - free_netdev(dev); - return ret; -@@ -1970,12 +1964,10 @@ static int bcm_enet_remove(struct platfo - } - - /* disable hw block clocks */ -- if (priv->phy_clk) { -+ if (priv->phy_clk) - clk_disable_unprepare(priv->phy_clk); -- clk_put(priv->phy_clk); -- } -+ - clk_disable_unprepare(priv->mac_clk); -- clk_put(priv->mac_clk); - - free_netdev(dev); - return 0; -@@ -2758,26 +2750,20 @@ static int bcm_enetsw_probe(struct platf - if (ret) - goto out; - -- if (!request_mem_region(res_mem->start, resource_size(res_mem), -- "bcm63xx_enetsw")) { -- ret = -EBUSY; -+ priv->base = devm_ioremap_resource(&pdev->dev, res_mem); -+ if (IS_ERR(priv->base)) { -+ ret = PTR_ERR(priv->base); - goto out; - } - -- priv->base = ioremap(res_mem->start, resource_size(res_mem)); -- if (priv->base == NULL) { -- ret = -ENOMEM; -- goto out_release_mem; -- } -- -- priv->mac_clk = clk_get(&pdev->dev, "enetsw"); -+ priv->mac_clk = devm_clk_get(&pdev->dev, "enetsw"); - if (IS_ERR(priv->mac_clk)) { - ret = PTR_ERR(priv->mac_clk); -- goto out_unmap; -+ goto out; - } - ret = clk_prepare_enable(priv->mac_clk); - if (ret) -- goto out_put_clk; -+ goto out; - - priv->rx_chan = 0; - priv->tx_chan = 1; -@@ -2809,15 +2795,6 @@ static int bcm_enetsw_probe(struct platf - - out_disable_clk: - clk_disable_unprepare(priv->mac_clk); -- --out_put_clk: -- clk_put(priv->mac_clk); -- --out_unmap: -- iounmap(priv->base); -- --out_release_mem: -- release_mem_region(res_mem->start, resource_size(res_mem)); - out: - free_netdev(dev); - return ret; -@@ -2829,20 +2806,13 @@ static int bcm_enetsw_remove(struct plat - { - struct bcm_enet_priv *priv; - struct net_device *dev; -- struct resource *res; - - /* stop netdevice */ - dev = platform_get_drvdata(pdev); - priv = netdev_priv(dev); - unregister_netdev(dev); - -- /* release device resources */ -- iounmap(priv->base); -- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- release_mem_region(res->start, resource_size(res)); -- - clk_disable_unprepare(priv->mac_clk); -- clk_put(priv->mac_clk); - - free_netdev(dev); - return 0; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-12-bcm63xx_enet-drop-unneeded-NULL-phy_clk-check.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-12-bcm63xx_enet-drop-unneeded-NULL-phy_clk-check.patch deleted file mode 100644 index 957c0f372..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-12-bcm63xx_enet-drop-unneeded-NULL-phy_clk-check.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 555baec974ede81e616ca88ac6d3fca09239368f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 18 Jul 2017 13:18:01 +0200 -Subject: [PATCH 5/6] bcm63xx_enet: drop unneeded NULL phy_clk check - -clk_disable and clk_unprepare are NULL-safe, so need to duplicate the -NULL check of the functions. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1924,8 +1924,7 @@ out_free_mdio: - out_uninit_hw: - /* turn off mdc clock */ - enet_writel(priv, 0, ENET_MIISC_REG); -- if (priv->phy_clk) -- clk_disable_unprepare(priv->phy_clk); -+ clk_disable_unprepare(priv->phy_clk); - - out_disable_clk_mac: - clk_disable_unprepare(priv->mac_clk); -@@ -1964,9 +1963,7 @@ static int bcm_enet_remove(struct platfo - } - - /* disable hw block clocks */ -- if (priv->phy_clk) -- clk_disable_unprepare(priv->phy_clk); -- -+ clk_disable_unprepare(priv->phy_clk); - clk_disable_unprepare(priv->mac_clk); - - free_netdev(dev); diff --git a/target/linux/brcm63xx/patches-4.4/001-4.15-13-bcm63xx_enet-remove-unneeded-include.patch b/target/linux/brcm63xx/patches-4.4/001-4.15-13-bcm63xx_enet-remove-unneeded-include.patch deleted file mode 100644 index 482bd5892..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.15-13-bcm63xx_enet-remove-unneeded-include.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 77364ce98037972fb1c57d0ee0418eb1c2b26521 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 29 May 2017 13:11:14 +0200 -Subject: [PATCH 6/6] bcm63xx_enet: remove unneeded include - -We don't use anyhing from that file, so drop it. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.h | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h -@@ -8,7 +8,6 @@ - #include - - #include --#include - #include - #include - diff --git a/target/linux/brcm63xx/patches-4.4/001-4.16-01-bcm63xx_enet-just-use-enet-as-the-clock-name.patch b/target/linux/brcm63xx/patches-4.4/001-4.16-01-bcm63xx_enet-just-use-enet-as-the-clock-name.patch deleted file mode 100644 index 32ef2cb19..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.16-01-bcm63xx_enet-just-use-enet-as-the-clock-name.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 943b0832e0cf3afe5bd40ffb1885d06106122c5d Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 16 Jul 2017 12:49:49 +0200 -Subject: [PATCH 1/4] bcm63xx_enet: just use "enet" as the clock name - -Now that we have the individual clocks available as "enet" we -don't need to rely on the device id for them anymore. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1733,7 +1733,6 @@ static int bcm_enet_probe(struct platfor - struct bcm63xx_enet_platform_data *pd; - struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx; - struct mii_bus *bus; -- const char *clk_name; - int i, ret; - - if (!bcm_enet_shared_base[0]) -@@ -1774,14 +1773,12 @@ static int bcm_enet_probe(struct platfor - if (priv->mac_id == 0) { - priv->rx_chan = 0; - priv->tx_chan = 1; -- clk_name = "enet0"; - } else { - priv->rx_chan = 2; - priv->tx_chan = 3; -- clk_name = "enet1"; - } - -- priv->mac_clk = devm_clk_get(&pdev->dev, clk_name); -+ priv->mac_clk = devm_clk_get(&pdev->dev, "enet"); - if (IS_ERR(priv->mac_clk)) { - ret = PTR_ERR(priv->mac_clk); - goto out; diff --git a/target/linux/brcm63xx/patches-4.4/001-4.16-02-bcm63xx_enet-use-platform-data-for-dma-channel-numbe.patch b/target/linux/brcm63xx/patches-4.4/001-4.16-02-bcm63xx_enet-use-platform-data-for-dma-channel-numbe.patch deleted file mode 100644 index 51d105895..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.16-02-bcm63xx_enet-use-platform-data-for-dma-channel-numbe.patch +++ /dev/null @@ -1,72 +0,0 @@ -From b7d1d1f345bb3b25c360c1df812d98866e2ee7fb Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 30 Sep 2017 13:50:03 +0200 -Subject: [PATCH 2/4] bcm63xx_enet: use platform data for dma channel numbers - -To reduce the reliance on device ids, pass the dma channel numbers to -the enet devices as platform data. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-enet.c | 8 ++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 4 ++++ - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 11 ++--------- - 3 files changed, 14 insertions(+), 9 deletions(-) - ---- a/arch/mips/bcm63xx/dev-enet.c -+++ b/arch/mips/bcm63xx/dev-enet.c -@@ -265,6 +265,14 @@ int __init bcm63xx_enet_register(int uni - dpd->dma_chan_width = ENETDMA_CHAN_WIDTH; - } - -+ if (unit == 0) { -+ dpd->rx_chan = 0; -+ dpd->tx_chan = 1; -+ } else { -+ dpd->rx_chan = 2; -+ dpd->tx_chan = 3; -+ } -+ - ret = platform_device_register(pdev); - if (ret) - return ret; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -@@ -54,6 +54,10 @@ struct bcm63xx_enet_platform_data { - - /* DMA descriptor shift */ - unsigned int dma_desc_shift; -+ -+ /* dma channel ids */ -+ int rx_chan; -+ int tx_chan; - }; - - /* ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1769,15 +1769,6 @@ static int bcm_enet_probe(struct platfor - priv->irq_tx = res_irq_tx->start; - priv->mac_id = pdev->id; - -- /* get rx & tx dma channel id for this mac */ -- if (priv->mac_id == 0) { -- priv->rx_chan = 0; -- priv->tx_chan = 1; -- } else { -- priv->rx_chan = 2; -- priv->tx_chan = 3; -- } -- - priv->mac_clk = devm_clk_get(&pdev->dev, "enet"); - if (IS_ERR(priv->mac_clk)) { - ret = PTR_ERR(priv->mac_clk); -@@ -1809,6 +1800,8 @@ static int bcm_enet_probe(struct platfor - priv->dma_chan_width = pd->dma_chan_width; - priv->dma_has_sram = pd->dma_has_sram; - priv->dma_desc_shift = pd->dma_desc_shift; -+ priv->rx_chan = pd->rx_chan; -+ priv->tx_chan = pd->tx_chan; - } - - if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) { diff --git a/target/linux/brcm63xx/patches-4.4/001-4.16-03-bcm63xx_enet-remove-pointless-mac_id-check.patch b/target/linux/brcm63xx/patches-4.4/001-4.16-03-bcm63xx_enet-remove-pointless-mac_id-check.patch deleted file mode 100644 index 6e6f320b8..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.16-03-bcm63xx_enet-remove-pointless-mac_id-check.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 8c61608e5dd2e15575c171ee9cd558ddc3b94962 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 17 Dec 2017 12:54:30 +0100 -Subject: [PATCH 3/4] bcm63xx_enet: remove pointless mac_id check - -Enabling the ephy clock for mac 1 is harmless, and the actual usage of -the ephy is not restricted to mac 0, so we might as well remove the -check. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1804,7 +1804,7 @@ static int bcm_enet_probe(struct platfor - priv->tx_chan = pd->tx_chan; - } - -- if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) { -+ if (priv->has_phy && !priv->use_external_mii) { - /* using internal PHY, enable clock */ - priv->phy_clk = devm_clk_get(&pdev->dev, "ephy"); - if (IS_ERR(priv->phy_clk)) { diff --git a/target/linux/brcm63xx/patches-4.4/001-4.16-04-bcm63xx_enet-use-platform-device-id-directly-for-mii.patch b/target/linux/brcm63xx/patches-4.4/001-4.16-04-bcm63xx_enet-use-platform-device-id-directly-for-mii.patch deleted file mode 100644 index 2c8206ec9..000000000 --- a/target/linux/brcm63xx/patches-4.4/001-4.16-04-bcm63xx_enet-use-platform-device-id-directly-for-mii.patch +++ /dev/null @@ -1,46 +0,0 @@ -From faea89cd893a1a7af81185f026a64dad603ef72f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 17 Dec 2017 12:58:12 +0100 -Subject: [PATCH 4/4] bcm63xx_enet: use platform device id directly for miibus - name - -Directly use the platform device for generating the miibus name. This removes -the last user of bcm_enet_priv::mac_id and we can remove the field. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 +-- - drivers/net/ethernet/broadcom/bcm63xx_enet.h | 3 --- - 2 files changed, 1 insertion(+), 5 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1767,7 +1767,6 @@ static int bcm_enet_probe(struct platfor - dev->irq = priv->irq = res_irq->start; - priv->irq_rx = res_irq_rx->start; - priv->irq_tx = res_irq_tx->start; -- priv->mac_id = pdev->id; - - priv->mac_clk = devm_clk_get(&pdev->dev, "enet"); - if (IS_ERR(priv->mac_clk)) { -@@ -1835,7 +1834,7 @@ static int bcm_enet_probe(struct platfor - bus->priv = priv; - bus->read = bcm_enet_mdio_read_phylib; - bus->write = bcm_enet_mdio_write_phylib; -- sprintf(bus->id, "%s-%d", pdev->name, priv->mac_id); -+ sprintf(bus->id, "%s-%d", pdev->name, pdev->id); - - /* only probe bus where we think the PHY is, because - * the mdio read operation return 0 instead of 0xffff ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h -@@ -192,9 +192,6 @@ struct bcm_enet_mib_counters { - - struct bcm_enet_priv { - -- /* mac id (from platform device id) */ -- int mac_id; -- - /* base remapped address of device */ - void __iomem *base; - diff --git a/target/linux/brcm63xx/patches-4.4/100-MIPS-BCM63XX-add-USB-host-clock-enable-delay.patch b/target/linux/brcm63xx/patches-4.4/100-MIPS-BCM63XX-add-USB-host-clock-enable-delay.patch deleted file mode 100644 index 67c5ef450..000000000 --- a/target/linux/brcm63xx/patches-4.4/100-MIPS-BCM63XX-add-USB-host-clock-enable-delay.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 80a2f983e9f44dbc3e01ae31c62d877846a7f791 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:19 +0100 -Subject: [PATCH 01/11] MIPS: BCM63XX: add USB host clock enable delay - -Knowledge of the clock setup delay should remain at the clock level (so -it can be clock specific and CPU specific). Add the 100 milliseconds -required clock delay for the USB host clock when it gets enabled. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/clk.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -213,6 +213,11 @@ static void usbh_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6362_USBH_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); -+ else -+ return; -+ -+ if (enable) -+ msleep(100); - } - - static struct clk clk_usbh = { diff --git a/target/linux/brcm63xx/patches-4.4/101-MIPS-BCM63XX-add-USB-device-clock-enable-delay-to-cl.patch b/target/linux/brcm63xx/patches-4.4/101-MIPS-BCM63XX-add-USB-device-clock-enable-delay-to-cl.patch deleted file mode 100644 index 1001df375..000000000 --- a/target/linux/brcm63xx/patches-4.4/101-MIPS-BCM63XX-add-USB-device-clock-enable-delay-to-cl.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 8e9bf528a122741f0171b89c297b63041116d704 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:20 +0100 -Subject: [PATCH 02/11] MIPS: BCM63XX: add USB device clock enable delay to - clock code - -This patch adds the required 10 micro seconds delay to the USB device -clock enable operation. Put this where the correct clock knowledege is, -which is in the clock code, and remove this delay from the bcm63xx_udc -gadget driver where it was before. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/clk.c | 5 +++++ - drivers/usb/gadget/bcm63xx_udc.c | 1 - - 2 files changed, 5 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -235,6 +235,11 @@ static void usbd_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6362_USBD_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_USBD_EN, enable); -+ else -+ return; -+ -+ if (enable) -+ udelay(10); - } - - static struct clk clk_usbd = { ---- a/drivers/usb/gadget/udc/bcm63xx_udc.c -+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c -@@ -411,7 +411,6 @@ static inline void set_clocks(struct bcm - if (is_enabled) { - clk_enable(udc->usbh_clk); - clk_enable(udc->usbd_clk); -- udelay(10); - } else { - clk_disable(udc->usbd_clk); - clk_disable(udc->usbh_clk); diff --git a/target/linux/brcm63xx/patches-4.4/102-MIPS-BCM63XX-move-code-touching-the-USB-private-regi.patch b/target/linux/brcm63xx/patches-4.4/102-MIPS-BCM63XX-move-code-touching-the-USB-private-regi.patch deleted file mode 100644 index c9f8b6929..000000000 --- a/target/linux/brcm63xx/patches-4.4/102-MIPS-BCM63XX-move-code-touching-the-USB-private-regi.patch +++ /dev/null @@ -1,151 +0,0 @@ -From ac9b0b574d54be28b300bf99ffe092a2c589484f Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:21 +0100 -Subject: [PATCH 03/11] MIPS: BCM63XX: move code touching the USB private - register - -This patch moves the code touching the USB private register in the -bcm63xx USB gadget driver to arch/mips/bcm63xx/usb-common.c in -preparation for adding support for OHCI and EHCI host controllers which -will also touch the USB private register. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/usb-common.c | 53 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h | 9 ++++ - drivers/usb/gadget/bcm63xx_udc.c | 27 ++-------- - 4 files changed, 67 insertions(+), 24 deletions(-) - create mode 100644 arch/mips/bcm63xx/usb-common.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -1,7 +1,7 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ - dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ -- dev-wdt.o dev-usb-usbd.o -+ dev-wdt.o dev-usb-usbd.o usb-common.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- /dev/null -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -0,0 +1,53 @@ -+/* -+ * Broadcom BCM63xx common USB device configuration code -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2012 Kevin Cernekee -+ * Copyright (C) 2012 Broadcom Corporation -+ * -+ */ -+#include -+ -+#include -+#include -+#include -+#include -+ -+void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device) -+{ -+ u32 val; -+ -+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); -+ if (is_device) { -+ val |= (portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT); -+ val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -+ } else { -+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT); -+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -+ } -+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+ -+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ if (is_device) -+ val |= USBH_PRIV_SWAP_USBD_MASK; -+ else -+ val &= ~USBH_PRIV_SWAP_USBD_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG); -+} -+EXPORT_SYMBOL(bcm63xx_usb_priv_select_phy_mode); -+ -+void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on) -+{ -+ u32 val; -+ -+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); -+ if (is_on) -+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -+ else -+ val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+} -+EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup); ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h -@@ -0,0 +1,9 @@ -+#ifndef BCM63XX_USB_PRIV_H_ -+#define BCM63XX_USB_PRIV_H_ -+ -+#include -+ -+void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device); -+void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on); -+ -+#endif /* BCM63XX_USB_PRIV_H_ */ ---- a/drivers/usb/gadget/udc/bcm63xx_udc.c -+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - - #define DRV_MODULE_NAME "bcm63xx_udc" - -@@ -888,22 +889,7 @@ static void bcm63xx_select_phy_mode(stru - bcm_gpio_writel(val, GPIO_PINMUX_OTHR_REG); - } - -- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); -- if (is_device) { -- val |= (portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT); -- val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -- } else { -- val &= ~(portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT); -- val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -- } -- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -- -- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -- if (is_device) -- val |= USBH_PRIV_SWAP_USBD_MASK; -- else -- val &= ~USBH_PRIV_SWAP_USBD_MASK; -- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG); -+ bcm63xx_usb_priv_select_phy_mode(portmask, is_device); - } - - /** -@@ -917,14 +903,9 @@ static void bcm63xx_select_phy_mode(stru - */ - static void bcm63xx_select_pullup(struct bcm63xx_udc *udc, bool is_on) - { -- u32 val, portmask = BIT(udc->pd->port_no); -+ u32 portmask = BIT(udc->pd->port_no); - -- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); -- if (is_on) -- val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -- else -- val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+ bcm63xx_usb_priv_select_pullup(portmask, is_on); - } - - /** diff --git a/target/linux/brcm63xx/patches-4.4/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch b/target/linux/brcm63xx/patches-4.4/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch deleted file mode 100644 index 40bbe083a..000000000 --- a/target/linux/brcm63xx/patches-4.4/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 28758a9da77954ed323f86123ef448c6a563c037 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:22 +0100 -Subject: [PATCH 04/11] MIPS: BCM63XX: add OHCI/EHCI configuration bits to - common USB code - -This patch updates the common USB code touching the USB private -registers with the specific bits to properly enable OHCI and EHCI -controllers on BCM63xx SoCs. As a result we now need to protect access -to Read Modify Write sequences using a spinlock because we cannot -guarantee that any of the exposed helper will not be called -concurrently. - -Signed-off-by: Maxime Bizon -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/usb-common.c | 97 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h | 2 + - 2 files changed, 99 insertions(+) - ---- a/arch/mips/bcm63xx/usb-common.c -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -5,10 +5,12 @@ - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * -+ * Copyright (C) 2008 Maxime Bizon - * Copyright (C) 2012 Kevin Cernekee - * Copyright (C) 2012 Broadcom Corporation - * - */ -+#include - #include - - #include -@@ -16,9 +18,14 @@ - #include - #include - -+static DEFINE_SPINLOCK(usb_priv_reg_lock); -+ - void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device) - { - u32 val; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); - - val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); - if (is_device) { -@@ -36,12 +43,17 @@ void bcm63xx_usb_priv_select_phy_mode(u3 - else - val &= ~USBH_PRIV_SWAP_USBD_MASK; - bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG); -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); - } - EXPORT_SYMBOL(bcm63xx_usb_priv_select_phy_mode); - - void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on) - { - u32 val; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); - - val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); - if (is_on) -@@ -49,5 +61,90 @@ void bcm63xx_usb_priv_select_pullup(u32 - else - val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); - bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); - } - EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup); -+ -+/* The following array represents the meaning of the DESC/DATA -+ * endian swapping with respect to the CPU configured endianness -+ * -+ * DATA ENDN mmio descriptor -+ * 0 0 BE invalid -+ * 0 1 BE LE -+ * 1 0 BE BE -+ * 1 1 BE invalid -+ * -+ * Since BCM63XX SoCs are configured to be in big-endian mode -+ * we want configuration at line 3. -+ */ -+void bcm63xx_usb_priv_ohci_cfg_set(void) -+{ -+ u32 reg; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); -+ -+ if (BCMCPU_IS_6348()) -+ bcm_rset_writel(RSET_OHCI_PRIV, 0, OHCI_PRIV_REG); -+ else if (BCMCPU_IS_6358()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG); -+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG); -+ /* -+ * The magic value comes for the original vendor BSP -+ * and is needed for USB to work. Datasheet does not -+ * help, so the magic value is used as-is. -+ */ -+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020, -+ USBH_PRIV_TEST_6358_REG); -+ -+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); -+} -+ -+void bcm63xx_usb_priv_ehci_cfg_set(void) -+{ -+ u32 reg; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); -+ -+ if (BCMCPU_IS_6358()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG); -+ -+ /* -+ * The magic value comes for the original vendor BSP -+ * and is needed for USB to work. Datasheet does not -+ * help, so the magic value is used as-is. -+ */ -+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020, -+ USBH_PRIV_TEST_6358_REG); -+ -+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); -+} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h -@@ -5,5 +5,7 @@ - - void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device); - void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on); -+void bcm63xx_usb_priv_ohci_cfg_set(void); -+void bcm63xx_usb_priv_ehci_cfg_set(void); - - #endif /* BCM63XX_USB_PRIV_H_ */ diff --git a/target/linux/brcm63xx/patches-4.4/104-MIPS-BCM63XX-introduce-BCM63XX_OHCI-configuration-sy.patch b/target/linux/brcm63xx/patches-4.4/104-MIPS-BCM63XX-introduce-BCM63XX_OHCI-configuration-sy.patch deleted file mode 100644 index 768dccac5..000000000 --- a/target/linux/brcm63xx/patches-4.4/104-MIPS-BCM63XX-introduce-BCM63XX_OHCI-configuration-sy.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 94ec618bd1a6b07fafbbfc9bcc54e7f9360ff9a0 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:23 +0100 -Subject: [PATCH 05/11] MIPS: BCM63XX: introduce BCM63XX_OHCI configuration - symbol - -This configuration symbol can be used by CPUs supporting the on-chip -OHCI controller, and ensures that all relevant OHCI-related -configuration options are correctly selected. So far, OHCI support is -available for the 6328, 6348, 6358 and 6358 SoCs. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Kconfig | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -6,10 +6,17 @@ config BCM63XX_CPU_3368 - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI - -+config BCM63XX_OHCI -+ bool -+ select USB_ARCH_HAS_OHCI -+ select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD -+ select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD -+ - config BCM63XX_CPU_6328 - bool "support 6328 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI -+ select BCM63XX_OHCI - - config BCM63XX_CPU_6338 - bool "support 6338 CPU" -@@ -24,21 +31,25 @@ config BCM63XX_CPU_6348 - bool "support 6348 CPU" - select SYS_HAS_CPU_BMIPS32_3300 - select HW_HAS_PCI -+ select BCM63XX_OHCI - - config BCM63XX_CPU_6358 - bool "support 6358 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI -+ select BCM63XX_OHCI - - config BCM63XX_CPU_6362 - bool "support 6362 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI -+ select BCM63XX_OHCI - - config BCM63XX_CPU_6368 - bool "support 6368 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI -+ select BCM63XX_OHCI - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" diff --git a/target/linux/brcm63xx/patches-4.4/105-MIPS-BCM63XX-add-support-for-the-on-chip-OHCI-contro.patch b/target/linux/brcm63xx/patches-4.4/105-MIPS-BCM63XX-add-support-for-the-on-chip-OHCI-contro.patch deleted file mode 100644 index 111d481e5..000000000 --- a/target/linux/brcm63xx/patches-4.4/105-MIPS-BCM63XX-add-support-for-the-on-chip-OHCI-contro.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 30d22baef255c99a12c4858ce4ab0d45f0d8c9ae Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:24 +0100 -Subject: [PATCH 06/11] MIPS: BCM63XX: add support for the on-chip OHCI - controller - -Broadcom BCM63XX SoCs include an on-chip OHCI controller which can be -driven by the ohci-platform generic driver by using specific power -on/off/suspend callback to manage clocks and hardware specific -configuration. - -Signed-off-by: Maxime Bizon -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/dev-usb-ohci.c | 94 ++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h | 6 ++ - 3 files changed, 101 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/bcm63xx/dev-usb-ohci.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -1,7 +1,7 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ - dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ -- dev-wdt.o dev-usb-usbd.o usb-common.o -+ dev-wdt.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- /dev/null -+++ b/arch/mips/bcm63xx/dev-usb-ohci.c -@@ -0,0 +1,94 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2013 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static struct resource ohci_resources[] = { -+ { -+ .start = -1, /* filled at runtime */ -+ .end = -1, /* filled at runtime */ -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = -1, /* filled at runtime */ -+ .flags = IORESOURCE_IRQ, -+ }, -+}; -+ -+static u64 ohci_dmamask = DMA_BIT_MASK(32); -+ -+static struct clk *usb_host_clock; -+ -+static int bcm63xx_ohci_power_on(struct platform_device *pdev) -+{ -+ usb_host_clock = clk_get(&pdev->dev, "usbh"); -+ if (IS_ERR_OR_NULL(usb_host_clock)) -+ return -ENODEV; -+ -+ clk_prepare_enable(usb_host_clock); -+ -+ bcm63xx_usb_priv_ohci_cfg_set(); -+ -+ return 0; -+} -+ -+static void bcm63xx_ohci_power_off(struct platform_device *pdev) -+{ -+ if (!IS_ERR_OR_NULL(usb_host_clock)) { -+ clk_disable_unprepare(usb_host_clock); -+ clk_put(usb_host_clock); -+ } -+} -+ -+static struct usb_ohci_pdata bcm63xx_ohci_pdata = { -+ .big_endian_desc = 1, -+ .big_endian_mmio = 1, -+ .no_big_frame_no = 1, -+ .num_ports = 1, -+ .power_on = bcm63xx_ohci_power_on, -+ .power_off = bcm63xx_ohci_power_off, -+ .power_suspend = bcm63xx_ohci_power_off, -+}; -+ -+static struct platform_device bcm63xx_ohci_device = { -+ .name = "ohci-platform", -+ .id = -1, -+ .num_resources = ARRAY_SIZE(ohci_resources), -+ .resource = ohci_resources, -+ .dev = { -+ .platform_data = &bcm63xx_ohci_pdata, -+ .dma_mask = &ohci_dmamask, -+ .coherent_dma_mask = DMA_BIT_MASK(32), -+ }, -+}; -+ -+int __init bcm63xx_ohci_register(void) -+{ -+ if (BCMCPU_IS_6345() || BCMCPU_IS_6338()) -+ return -ENODEV; -+ -+ ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0); -+ ohci_resources[0].end = ohci_resources[0].start; -+ ohci_resources[0].end += RSET_OHCI_SIZE - 1; -+ ohci_resources[1].start = bcm63xx_get_irq_number(IRQ_OHCI0); -+ -+ return platform_device_register(&bcm63xx_ohci_device); -+} ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h -@@ -0,0 +1,6 @@ -+#ifndef BCM63XX_DEV_USB_OHCI_H_ -+#define BCM63XX_DEV_USB_OHCI_H_ -+ -+int bcm63xx_ohci_register(void); -+ -+#endif /* BCM63XX_DEV_USB_OHCI_H_ */ diff --git a/target/linux/brcm63xx/patches-4.4/106-MIPS-BCM63XX-register-OHCI-controller-if-board-enabl.patch b/target/linux/brcm63xx/patches-4.4/106-MIPS-BCM63XX-register-OHCI-controller-if-board-enabl.patch deleted file mode 100644 index 253d7d5a3..000000000 --- a/target/linux/brcm63xx/patches-4.4/106-MIPS-BCM63XX-register-OHCI-controller-if-board-enabl.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 33ef960aed15f9a98a2c51d8d794cd72418e0be4 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:25 +0100 -Subject: [PATCH 07/11] MIPS: BCM63XX: register OHCI controller if board - enables it - -BCM63XX-based boards can control the registration of the OHCI controller -by setting their has_ohci0 flag to 1. Handle this in the generic -code dealing with board registration and call the actual helper to -register the OHCI controller. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -898,6 +899,9 @@ int __init board_register_devices(void) - if (board.has_usbd) - bcm63xx_usbd_register(&board.usbd); - -+ if (board.has_ohci0) -+ bcm63xx_ohci_register(); -+ - if (board.has_dsp) - bcm63xx_dsp_register(&board.dsp); - diff --git a/target/linux/brcm63xx/patches-4.4/107-MIPS-BCM63XX-introduce-BCM63XX_EHCI-configuration-sy.patch b/target/linux/brcm63xx/patches-4.4/107-MIPS-BCM63XX-introduce-BCM63XX_EHCI-configuration-sy.patch deleted file mode 100644 index bce91e373..000000000 --- a/target/linux/brcm63xx/patches-4.4/107-MIPS-BCM63XX-introduce-BCM63XX_EHCI-configuration-sy.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 00da1683364e58c6430a4577123d01037f8faddc Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:26 +0100 -Subject: [PATCH 08/11] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration - symbol - -This configuration symbol can be used by CPUs supporting the on-chip -EHCI controller, and ensures that all relevant EHCI-related -configuration options are selected. So far BCM6328, BCM6358 and BCM6368 -have an EHCI controller and do select this symbol. Update -drivers/usb/host/Kconfig with BCM63XX to update direct unmet -dependencies. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Kconfig | 9 +++++++++ - drivers/usb/host/Kconfig | 5 +++-- - 2 files changed, 12 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -12,11 +12,18 @@ config BCM63XX_OHCI - select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD - select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD - -+config BCM63XX_EHCI -+ bool -+ select USB_ARCH_HAS_EHCI -+ select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD -+ select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD -+ - config BCM63XX_CPU_6328 - bool "support 6328 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI - select BCM63XX_OHCI -+ select BCM63XX_EHCI - - config BCM63XX_CPU_6338 - bool "support 6338 CPU" -@@ -38,18 +45,21 @@ config BCM63XX_CPU_6358 - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI - select BCM63XX_OHCI -+ select BCM63XX_EHCI - - config BCM63XX_CPU_6362 - bool "support 6362 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI - select BCM63XX_OHCI -+ select BCM63XX_EHCI - - config BCM63XX_CPU_6368 - bool "support 6368 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI - select BCM63XX_OHCI -+ select BCM63XX_EHCI - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" diff --git a/target/linux/brcm63xx/patches-4.4/108-MIPS-BCM63XX-add-support-for-the-on-chip-EHCI-contro.patch b/target/linux/brcm63xx/patches-4.4/108-MIPS-BCM63XX-add-support-for-the-on-chip-EHCI-contro.patch deleted file mode 100644 index 8b1f8d22b..000000000 --- a/target/linux/brcm63xx/patches-4.4/108-MIPS-BCM63XX-add-support-for-the-on-chip-EHCI-contro.patch +++ /dev/null @@ -1,137 +0,0 @@ -From e38f13bd6408769c0b565bb1079024f496eee121 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:27 +0100 -Subject: [PATCH 09/11] MIPS: BCM63XX: add support for the on-chip EHCI - controller - -Broadcom BCM63XX SoCs include an on-chip EHCI controller which can be -driven by the generic ehci-platform driver by using specific power -on/off/suspend callbacks to manage clocks and hardware specific -configuration. - -Signed-off-by: Maxime Bizon -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/dev-usb-ehci.c | 92 ++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h | 6 ++ - 3 files changed, 99 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -1,7 +1,8 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ - dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ -- dev-wdt.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o -+ dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \ -+ usb-common.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- /dev/null -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -0,0 +1,92 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2013 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static struct resource ehci_resources[] = { -+ { -+ .start = -1, /* filled at runtime */ -+ .end = -1, /* filled at runtime */ -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = -1, /* filled at runtime */ -+ .flags = IORESOURCE_IRQ, -+ }, -+}; -+ -+static u64 ehci_dmamask = DMA_BIT_MASK(32); -+ -+static struct clk *usb_host_clock; -+ -+static int bcm63xx_ehci_power_on(struct platform_device *pdev) -+{ -+ usb_host_clock = clk_get(&pdev->dev, "usbh"); -+ if (IS_ERR_OR_NULL(usb_host_clock)) -+ return -ENODEV; -+ -+ clk_prepare_enable(usb_host_clock); -+ -+ bcm63xx_usb_priv_ehci_cfg_set(); -+ -+ return 0; -+} -+ -+static void bcm63xx_ehci_power_off(struct platform_device *pdev) -+{ -+ if (!IS_ERR_OR_NULL(usb_host_clock)) { -+ clk_disable_unprepare(usb_host_clock); -+ clk_put(usb_host_clock); -+ } -+} -+ -+static struct usb_ehci_pdata bcm63xx_ehci_pdata = { -+ .big_endian_desc = 1, -+ .big_endian_mmio = 1, -+ .power_on = bcm63xx_ehci_power_on, -+ .power_off = bcm63xx_ehci_power_off, -+ .power_suspend = bcm63xx_ehci_power_off, -+}; -+ -+static struct platform_device bcm63xx_ehci_device = { -+ .name = "ehci-platform", -+ .id = -1, -+ .num_resources = ARRAY_SIZE(ehci_resources), -+ .resource = ehci_resources, -+ .dev = { -+ .platform_data = &bcm63xx_ehci_pdata, -+ .dma_mask = &ehci_dmamask, -+ .coherent_dma_mask = DMA_BIT_MASK(32), -+ }, -+}; -+ -+int __init bcm63xx_ehci_register(void) -+{ -+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) -+ return 0; -+ -+ ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); -+ ehci_resources[0].end = ehci_resources[0].start; -+ ehci_resources[0].end += RSET_EHCI_SIZE - 1; -+ ehci_resources[1].start = bcm63xx_get_irq_number(IRQ_EHCI0); -+ -+ return platform_device_register(&bcm63xx_ehci_device); -+} ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h -@@ -0,0 +1,6 @@ -+#ifndef BCM63XX_DEV_USB_EHCI_H_ -+#define BCM63XX_DEV_USB_EHCI_H_ -+ -+int bcm63xx_ehci_register(void); -+ -+#endif /* BCM63XX_DEV_USB_EHCI_H_ */ diff --git a/target/linux/brcm63xx/patches-4.4/109-MIPS-BCM63XX-register-EHCI-controller-if-board-enabl.patch b/target/linux/brcm63xx/patches-4.4/109-MIPS-BCM63XX-register-EHCI-controller-if-board-enabl.patch deleted file mode 100644 index f1256727a..000000000 --- a/target/linux/brcm63xx/patches-4.4/109-MIPS-BCM63XX-register-EHCI-controller-if-board-enabl.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 709ef2034f5ba06da35f89856ad7baf2b7a41287 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:28 +0100 -Subject: [PATCH 10/11] MIPS: BCM63XX: register EHCI controller if board - enables it - -BCM63XX-based board can control the registration of the EHCI controller -by setting their has_ehci0 flag to 1. Handle this in the generic -code dealing with board registration and call the actual helper to register -the EHCI controller. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -899,6 +900,9 @@ int __init board_register_devices(void) - if (board.has_usbd) - bcm63xx_usbd_register(&board.usbd); - -+ if (board.has_ehci0) -+ bcm63xx_ehci_register(); -+ - if (board.has_ohci0) - bcm63xx_ohci_register(); - diff --git a/target/linux/brcm63xx/patches-4.4/110-MIPS-BCM63XX-EHCI-controller-does-not-support-overcu.patch b/target/linux/brcm63xx/patches-4.4/110-MIPS-BCM63XX-EHCI-controller-does-not-support-overcu.patch deleted file mode 100644 index 6d9112993..000000000 --- a/target/linux/brcm63xx/patches-4.4/110-MIPS-BCM63XX-EHCI-controller-does-not-support-overcu.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 111bbd770441ab34f9da5bb1d85767a9b75227b4 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:30 +0100 -Subject: [PATCH 12/12] MIPS: BCM63XX: EHCI controller does not support - overcurrent - -This patch sets the ignore_oc flag for the BCM63XX EHCI controller as it -does not support proper overcurrent reporting. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/dev-usb-ehci.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/mips/bcm63xx/dev-usb-ehci.c -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -61,6 +61,7 @@ static void bcm63xx_ehci_power_off(struc - static struct usb_ehci_pdata bcm63xx_ehci_pdata = { - .big_endian_desc = 1, - .big_endian_mmio = 1, -+ .ignore_oc = 1, - .power_on = bcm63xx_ehci_power_on, - .power_off = bcm63xx_ehci_power_off, - .power_suspend = bcm63xx_ehci_power_off, diff --git a/target/linux/brcm63xx/patches-4.4/111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch b/target/linux/brcm63xx/patches-4.4/111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch deleted file mode 100644 index 0a96e1bbb..000000000 --- a/target/linux/brcm63xx/patches-4.4/111-MIPS-BCM63XX-allow-NULL-clock-for-clk_get_rate.patch +++ /dev/null @@ -1,48 +0,0 @@ -From patchwork Tue Jul 18 10:17:27 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [6/9] MIPS: BCM63XX: allow NULL clock for clk_get_rate -X-Patchwork-Submitter: Jonas Gorski -X-Patchwork-Id: 16776 -Message-Id: <20170718101730.2541-7-jonas.gorski@gmail.com> -To: unlisted-recipients:; (no To-header on input) -Cc: Ralf Baechle , - Florian Fainelli , - bcm-kernel-feedback-list@broadcom.com, - James Hogan , - linux-mips@linux-mips.org, linux-kernel@vger.kernel.org -Date: Tue, 18 Jul 2017 12:17:27 +0200 -From: Jonas Gorski -List-Id: linux-mips - -Make the behaviour of clk_get_rate consistent with common clk's -clk_get_rate by accepting NULL clocks as parameter. Some device -drivers rely on this, and will cause an OOPS otherwise. - -Fixes: e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.") -Cc: Ralf Baechle -Cc: Florian Fainelli -Cc: bcm-kernel-feedback-list@broadcom.com -Cc: James Hogan -Cc: linux-mips@linux-mips.org -Cc: linux-kernel@vger.kernel.org -Reported-by: Mathias Kresin -Signed-off-by: Jonas Gorski -Reviewed-by: Florian Fainelli ---- - arch/mips/bcm63xx/clk.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -389,6 +389,9 @@ EXPORT_SYMBOL(clk_disable); - - unsigned long clk_get_rate(struct clk *clk) - { -+ if (!clk) -+ return 0; -+ - return clk->rate; - } - diff --git a/target/linux/brcm63xx/patches-4.4/120-mtdpart_fixup_generic_partprobe.patch b/target/linux/brcm63xx/patches-4.4/120-mtdpart_fixup_generic_partprobe.patch deleted file mode 100644 index b662c9be2..000000000 --- a/target/linux/brcm63xx/patches-4.4/120-mtdpart_fixup_generic_partprobe.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -978,8 +978,8 @@ int parse_mtd_partitions(struct mtd_info - int ret, err = 0; - const char *const *types_of = NULL; - -- if (data && data->of_node) { -- types_of = of_get_probes(data->of_node); -+ if (mtd_get_of_node(master)) { -+ types_of = of_get_probes(mtd_get_of_node(master)); - if (types_of != NULL) - types = types_of; - } diff --git a/target/linux/brcm63xx/patches-4.4/130-pinctrl-add-bcm63xx-base-code.patch b/target/linux/brcm63xx/patches-4.4/130-pinctrl-add-bcm63xx-base-code.patch deleted file mode 100644 index 27c2d0908..000000000 --- a/target/linux/brcm63xx/patches-4.4/130-pinctrl-add-bcm63xx-base-code.patch +++ /dev/null @@ -1,226 +0,0 @@ -From ab2f33e35e35905a76204138143875251f3e1088 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:07:42 +0200 -Subject: [PATCH 01/13] pinctrl: add bcm63xx base code - -Setup directory and add a helper for bcm63xx pinctrl support. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/Kconfig | 1 + - drivers/pinctrl/Makefile | 1 + - drivers/pinctrl/bcm63xx/Kconfig | 3 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.c | 142 ++++++++++++++++++++++++++++++ - drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.h | 14 +++ - 7 files changed, 163 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/Kconfig - create mode 100644 drivers/pinctrl/bcm63xx/Makefile - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.c - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.h - ---- a/drivers/pinctrl/Kconfig -+++ b/drivers/pinctrl/Kconfig -@@ -248,6 +248,7 @@ config PINCTRL_ZYNQ - This selectes the pinctrl driver for Xilinx Zynq. - - source "drivers/pinctrl/bcm/Kconfig" -+source "drivers/pinctrl/bcm63xx/Kconfig" - source "drivers/pinctrl/berlin/Kconfig" - source "drivers/pinctrl/freescale/Kconfig" - source "drivers/pinctrl/intel/Kconfig" ---- a/drivers/pinctrl/Makefile -+++ b/drivers/pinctrl/Makefile -@@ -41,6 +41,7 @@ obj-$(CONFIG_PINCTRL_ST) += pinctrl-st. - obj-$(CONFIG_PINCTRL_ZYNQ) += pinctrl-zynq.o - - obj-$(CONFIG_ARCH_BCM) += bcm/ -+obj-y += bcm63xx/ - obj-$(CONFIG_ARCH_BERLIN) += berlin/ - obj-y += freescale/ - obj-$(CONFIG_X86) += intel/ ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -0,0 +1,3 @@ -+config PINCTRL_BCM63XX -+ bool -+ select GPIO_GENERIC ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.c -@@ -0,0 +1,155 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "pinctrl-bcm63xx.h" -+#include "../core.h" -+ -+#define BANK_SIZE sizeof(u32) -+#define PINS_PER_BANK (BANK_SIZE * BITS_PER_BYTE) -+ -+#ifdef CONFIG_OF -+static int bcm63xx_gpio_of_xlate(struct gpio_chip *gc, -+ const struct of_phandle_args *gpiospec, -+ u32 *flags) -+{ -+ struct gpio_chip *base = gpiochip_get_data(gc); -+ int pin = gpiospec->args[0]; -+ -+ if (gc != &base[pin / PINS_PER_BANK]) -+ return -EINVAL; -+ -+ pin = pin % PINS_PER_BANK; -+ -+ if (pin >= gc->ngpio) -+ return -EINVAL; -+ -+ if (flags) -+ *flags = gpiospec->args[1]; -+ -+ return pin; -+} -+#endif -+ -+static int bcm63xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ struct gpio_chip *base = gpiochip_get_data(chip); -+ char irq_name[7]; /* "gpioXX" */ -+ -+ /* FIXME: this is ugly */ -+ sprintf(irq_name, "gpio%d", gpio + PINS_PER_BANK * (chip - base)); -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ -+static int bcm63xx_setup_gpio(struct device *dev, struct gpio_chip *gc, -+ void __iomem *dirout, void __iomem *data, -+ size_t sz, int ngpio) -+ -+{ -+ int banks, chips, i, ret = -EINVAL; -+ -+ chips = DIV_ROUND_UP(ngpio, PINS_PER_BANK); -+ banks = sz / BANK_SIZE; -+ -+ for (i = 0; i < chips; i++) { -+ int offset, pins; -+ int reg_offset; -+ char *label; -+ -+ label = devm_kasprintf(dev, GFP_KERNEL, "bcm63xx-gpio.%i", i); -+ if (!label) -+ return -ENOMEM; -+ -+ offset = i * PINS_PER_BANK; -+ pins = min_t(int, ngpio - offset, PINS_PER_BANK); -+ -+ /* the registers are treated like a huge big endian register */ -+ reg_offset = (banks - i - 1) * BANK_SIZE; -+ -+ ret = bgpio_init(&gc[i], dev, BANK_SIZE, data + reg_offset, -+ NULL, NULL, dirout + reg_offset, NULL, -+ BGPIOF_BIG_ENDIAN_BYTE_ORDER); -+ if (ret) -+ return ret; -+ -+ gc[i].request = gpiochip_generic_request; -+ gc[i].free = gpiochip_generic_free; -+ -+ if (of_get_property(dev->of_node, "interrupt-names", NULL)) -+ gc[i].to_irq = bcm63xx_gpio_to_irq; -+ -+#ifdef CONFIG_OF -+ gc[i].of_gpio_n_cells = 2; -+ gc[i].of_xlate = bcm63xx_gpio_of_xlate; -+#endif -+ -+ gc[i].label = label; -+ gc[i].ngpio = pins; -+ -+ devm_gpiochip_add_data(dev, &gc[i], gc); -+ } -+ -+ return 0; -+} -+ -+static void bcm63xx_setup_pinranges(struct gpio_chip *gc, const char *name, -+ int ngpio) -+{ -+ int i, chips = DIV_ROUND_UP(ngpio, PINS_PER_BANK); -+ -+ for (i = 0; i < chips; i++) { -+ int offset, pins; -+ -+ offset = i * PINS_PER_BANK; -+ pins = min_t(int, ngpio - offset, PINS_PER_BANK); -+ -+ gpiochip_add_pin_range(&gc[i], name, 0, offset, pins); -+ } -+} -+ -+struct pinctrl_dev *bcm63xx_pinctrl_register(struct platform_device *pdev, -+ struct pinctrl_desc *desc, -+ void *priv, struct gpio_chip *gc, -+ int ngpio) -+{ -+ struct pinctrl_dev *pctldev; -+ struct resource *res; -+ void __iomem *dirout, *data; -+ size_t sz; -+ int ret; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirout"); -+ dirout = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(dirout)) -+ return ERR_CAST(dirout); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat"); -+ data = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(data)) -+ return ERR_CAST(data); -+ -+ sz = resource_size(res); -+ -+ ret = bcm63xx_setup_gpio(&pdev->dev, gc, dirout, data, sz, ngpio); -+ if (ret) -+ return ERR_PTR(ret); -+ -+ pctldev = devm_pinctrl_register(&pdev->dev, desc, priv); -+ if (IS_ERR(pctldev)) -+ return pctldev; -+ -+ bcm63xx_setup_pinranges(gc, pinctrl_dev_get_devname(pctldev), ngpio); -+ -+ dev_info(&pdev->dev, "registered at mmio %p\n", dirout); -+ -+ return pctldev; -+} ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.h -@@ -0,0 +1,14 @@ -+#ifndef __PINCTRL_BCM63XX -+#define __PINCTRL_BCM63XX -+ -+#include -+#include -+#include -+#include -+ -+struct pinctrl_dev *bcm63xx_pinctrl_register(struct platform_device *pdev, -+ struct pinctrl_desc *desc, -+ void *priv, struct gpio_chip *gc, -+ int ngpio); -+ -+#endif diff --git a/target/linux/brcm63xx/patches-4.4/131-Documentation-add-BCM6328-pincontroller-binding-docu.patch b/target/linux/brcm63xx/patches-4.4/131-Documentation-add-BCM6328-pincontroller-binding-docu.patch deleted file mode 100644 index 3a2a7811d..000000000 --- a/target/linux/brcm63xx/patches-4.4/131-Documentation-add-BCM6328-pincontroller-binding-docu.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 4bdd40849632608d5cb7d3a64380cd76e7eea07b Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:33:56 +0200 -Subject: [PATCH 02/16] Documentation: add BCM6328 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6328 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6328-pinctrl.txt | 61 ++++++++++++++++++++++ - 1 file changed, 61 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.txt -@@ -0,0 +1,61 @@ -+* Broadcom BCM6328 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6328-pinctrl". -+- reg: Register specifies of dirout, dat, mode, mux registers. -+- reg-names: Must be "dirout", "dat", "mode", "mux". -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2> -+ -+Example: -+ -+pinctrl: pin-controller@10000080 { -+ compatible = "brcm,bcm6328-pinctrl"; -+ reg = <0x10000080 0x8>, -+ <0x10000088 0x8>, -+ <0x10000098 0x4>, -+ <0x1000009c 0xc>; -+ reg-names = "dirout", "dat", "mode", "mux"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 led -+gpio1 1 led -+gpio2 2 led -+gpio3 3 led -+gpio4 4 led -+gpio5 5 led -+gpio6 6 led, serial_led_data -+gpio7 7 led, serial_led_clk -+gpio8 8 led -+gpio9 9 led -+gpio10 10 led -+gpio11 11 led -+gpio12 12 led -+gpio13 13 led -+gpio14 14 led -+gpio15 15 led -+gpio16 16 led, pcie_clkreq -+gpio17 17 led -+gpio18 18 led -+gpio19 19 led -+gpio20 20 led -+gpio21 21 led -+gpio22 22 led -+gpio23 23 led -+gpio24 24 - -+gpio25 25 ephy0_act_led -+gpio26 26 ephy1_act_led -+gpio27 27 ephy2_act_led -+gpio28 28 ephy3_act_led -+gpio29 29 - -+gpio30 30 - -+gpio31 31 - -+hsspi_cs1 - hsspi_cs1 -+usb_port1 - usb_host_port, usb_device_port diff --git a/target/linux/brcm63xx/patches-4.4/132-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch b/target/linux/brcm63xx/patches-4.4/132-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch deleted file mode 100644 index 3c5f15b91..000000000 --- a/target/linux/brcm63xx/patches-4.4/132-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch +++ /dev/null @@ -1,495 +0,0 @@ -From 393e9753f6492c1fdf55891ddee60d955ae8b119 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:12:50 +0200 -Subject: [PATCH 03/16] pinctrl: add a pincontrol driver for BCM6328 - -Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as -GPIOs, as LEDs for the integrated LED controller, or various other -functions. Its pincontrol mux registers also control other aspects, like -switching the second USB port between host and device mode. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 7 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6328.c | 456 ++++++++++++++++++++++++++++++ - 3 files changed, 464 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6328.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -1,3 +1,10 @@ - config PINCTRL_BCM63XX - bool - select GPIO_GENERIC -+ -+config PINCTRL_BCM6328 -+ bool "BCM6328 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BCM63XX -+ select GENERIC_PINCONF ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -1 +1,2 @@ - obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o -+obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6328.c -@@ -0,0 +1,456 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6328_MUX_LO_REG 0x4 -+#define BCM6328_MUX_HI_REG 0x0 -+#define BCM6328_MUX_OTHER_REG 0x8 -+ -+#define BCM6328_NGPIO 32 -+ -+struct bcm6328_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6328_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ unsigned mode_val:1; -+ unsigned mux_val:2; -+}; -+ -+struct bcm6328_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *mode; -+ void __iomem *mux[3]; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio; -+}; -+ -+static const struct pinctrl_pin_desc bcm6328_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ PINCTRL_PIN(2, "gpio2"), -+ PINCTRL_PIN(3, "gpio3"), -+ PINCTRL_PIN(4, "gpio4"), -+ PINCTRL_PIN(5, "gpio5"), -+ PINCTRL_PIN(6, "gpio6"), -+ PINCTRL_PIN(7, "gpio7"), -+ PINCTRL_PIN(8, "gpio8"), -+ PINCTRL_PIN(9, "gpio9"), -+ PINCTRL_PIN(10, "gpio10"), -+ PINCTRL_PIN(11, "gpio11"), -+ PINCTRL_PIN(12, "gpio12"), -+ PINCTRL_PIN(13, "gpio13"), -+ PINCTRL_PIN(14, "gpio14"), -+ PINCTRL_PIN(15, "gpio15"), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ PINCTRL_PIN(22, "gpio22"), -+ PINCTRL_PIN(23, "gpio23"), -+ PINCTRL_PIN(24, "gpio24"), -+ PINCTRL_PIN(25, "gpio25"), -+ PINCTRL_PIN(26, "gpio26"), -+ PINCTRL_PIN(27, "gpio27"), -+ PINCTRL_PIN(28, "gpio28"), -+ PINCTRL_PIN(29, "gpio29"), -+ PINCTRL_PIN(30, "gpio30"), -+ PINCTRL_PIN(31, "gpio31"), -+ -+ /* -+ * No idea where they really are; so let's put them according -+ * to their mux offsets. -+ */ -+ PINCTRL_PIN(36, "hsspi_cs1"), -+ PINCTRL_PIN(38, "usb_p2"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+ -+static unsigned hsspi_cs1_pins[] = { 36 }; -+static unsigned usb_port1_pins[] = { 38 }; -+ -+#define BCM6328_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm6328_pingroup bcm6328_groups[] = { -+ BCM6328_GROUP(gpio0), -+ BCM6328_GROUP(gpio1), -+ BCM6328_GROUP(gpio2), -+ BCM6328_GROUP(gpio3), -+ BCM6328_GROUP(gpio4), -+ BCM6328_GROUP(gpio5), -+ BCM6328_GROUP(gpio6), -+ BCM6328_GROUP(gpio7), -+ BCM6328_GROUP(gpio8), -+ BCM6328_GROUP(gpio9), -+ BCM6328_GROUP(gpio10), -+ BCM6328_GROUP(gpio11), -+ BCM6328_GROUP(gpio12), -+ BCM6328_GROUP(gpio13), -+ BCM6328_GROUP(gpio14), -+ BCM6328_GROUP(gpio15), -+ BCM6328_GROUP(gpio16), -+ BCM6328_GROUP(gpio17), -+ BCM6328_GROUP(gpio18), -+ BCM6328_GROUP(gpio19), -+ BCM6328_GROUP(gpio20), -+ BCM6328_GROUP(gpio21), -+ BCM6328_GROUP(gpio22), -+ BCM6328_GROUP(gpio23), -+ BCM6328_GROUP(gpio24), -+ BCM6328_GROUP(gpio25), -+ BCM6328_GROUP(gpio26), -+ BCM6328_GROUP(gpio27), -+ BCM6328_GROUP(gpio28), -+ BCM6328_GROUP(gpio29), -+ BCM6328_GROUP(gpio30), -+ BCM6328_GROUP(gpio31), -+ -+ BCM6328_GROUP(hsspi_cs1), -+ BCM6328_GROUP(usb_port1), -+}; -+ -+/* GPIO_MODE */ -+static const char * const led_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+}; -+ -+/* PINMUX_SEL */ -+static const char * const serial_led_data_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const inet_act_led_groups[] = { -+ "gpio11", -+}; -+ -+static const char * const pcie_clkreq_groups[] = { -+ "gpio16", -+}; -+ -+static const char * const ephy0_act_led_groups[] = { -+ "gpio25", -+}; -+ -+static const char * const ephy1_act_led_groups[] = { -+ "gpio26", -+}; -+ -+static const char * const ephy2_act_led_groups[] = { -+ "gpio27", -+}; -+ -+static const char * const ephy3_act_led_groups[] = { -+ "gpio28", -+}; -+ -+static const char * const hsspi_cs1_groups[] = { -+ "hsspi_cs1" -+}; -+ -+static const char * const usb_host_port_groups[] = { -+ "usb_port1", -+}; -+ -+static const char * const usb_device_port_groups[] = { -+ "usb_port1", -+}; -+ -+#define BCM6328_MODE_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .mode_val = 1, \ -+ } -+ -+#define BCM6328_MUX_FUN(n, mux) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .mux_val = mux, \ -+ } -+ -+static const struct bcm6328_function bcm6328_funcs[] = { -+ BCM6328_MODE_FUN(led), -+ BCM6328_MUX_FUN(serial_led_data, 2), -+ BCM6328_MUX_FUN(serial_led_clk, 2), -+ BCM6328_MUX_FUN(inet_act_led, 1), -+ BCM6328_MUX_FUN(pcie_clkreq, 2), -+ BCM6328_MUX_FUN(ephy0_act_led, 1), -+ BCM6328_MUX_FUN(ephy1_act_led, 1), -+ BCM6328_MUX_FUN(ephy2_act_led, 1), -+ BCM6328_MUX_FUN(ephy3_act_led, 1), -+ BCM6328_MUX_FUN(hsspi_cs1, 2), -+ BCM6328_MUX_FUN(usb_host_port, 1), -+ BCM6328_MUX_FUN(usb_device_port, 2), -+}; -+ -+static int bcm6328_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6328_groups); -+} -+ -+static const char *bcm6328_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6328_groups[group].name; -+} -+ -+static int bcm6328_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6328_groups[group].pins; -+ *num_pins = bcm6328_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6328_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6328_funcs); -+} -+ -+static const char *bcm6328_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6328_funcs[selector].name; -+} -+ -+static int bcm6328_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6328_funcs[selector].groups; -+ *num_groups = bcm6328_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6328_rmw_mux(struct bcm6328_pinctrl *pctl, unsigned pin, -+ u32 mode, u32 mux) -+{ -+ unsigned long flags; -+ u32 reg; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ if (pin < 32) { -+ reg = __raw_readl(pctl->mode); -+ reg &= ~BIT(pin); -+ if (mode) -+ reg |= BIT(pin); -+ __raw_writel(reg, pctl->mode); -+ } -+ -+ reg = __raw_readl(pctl->mux[pin / 16]); -+ reg &= ~(3UL << ((pin % 16) * 2)); -+ reg |= mux << ((pin % 16) * 2); -+ __raw_writel(reg, pctl->mux[pin / 16]); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static int bcm6328_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6328_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6328_pingroup *grp = &bcm6328_groups[group]; -+ const struct bcm6328_function *f = &bcm6328_funcs[selector]; -+ -+ bcm6328_rmw_mux(pctl, grp->pins[0], f->mode_val, f->mux_val); -+ -+ return 0; -+} -+ -+static int bcm6328_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6328_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable all functions using this pin */ -+ bcm6328_rmw_mux(pctl, offset, 0, 0); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6328_pctl_ops = { -+ .get_groups_count = bcm6328_pinctrl_get_group_count, -+ .get_group_name = bcm6328_pinctrl_get_group_name, -+ .get_group_pins = bcm6328_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6328_pmx_ops = { -+ .get_functions_count = bcm6328_pinctrl_get_func_count, -+ .get_function_name = bcm6328_pinctrl_get_func_name, -+ .get_function_groups = bcm6328_pinctrl_get_groups, -+ .set_mux = bcm6328_pinctrl_set_mux, -+ .gpio_request_enable = bcm6328_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6328_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6328_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *mode, *mux; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mux"); -+ mux = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mux)) -+ return PTR_ERR(mux); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->mode = mode; -+ pctl->mux[0] = mux + BCM6328_MUX_LO_REG; -+ pctl->mux[1] = mux + BCM6328_MUX_HI_REG; -+ pctl->mux[2] = mux + BCM6328_MUX_OTHER_REG; -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6328_pctl_ops; -+ pctl->desc.pmxops = &bcm6328_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6328_pins); -+ pctl->desc.pins = bcm6328_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ &pctl->gpio, BCM6328_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6328_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6328-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6328_pinctrl_driver = { -+ .probe = bcm6328_pinctrl_probe, -+ .driver = { -+ .name = "bcm6328-pinctrl", -+ .of_match_table = bcm6328_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6328_pinctrl_driver); diff --git a/target/linux/brcm63xx/patches-4.4/133-Documentation-add-BCM6348-pincontroller-binding-docu.patch b/target/linux/brcm63xx/patches-4.4/133-Documentation-add-BCM6348-pincontroller-binding-docu.patch deleted file mode 100644 index 6bac90373..000000000 --- a/target/linux/brcm63xx/patches-4.4/133-Documentation-add-BCM6348-pincontroller-binding-docu.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 962c46bf7f43df730e2d3698930e77958cc6b191 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:35:45 +0200 -Subject: [PATCH 04/16] Documentation: add BCM6348 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6348 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6348-pinctrl.txt | 32 ++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6348-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6348-pinctrl.txt -@@ -0,0 +1,32 @@ -+* Broadcom BCM6348 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6348-pinctrl". -+- reg: register Specifiers of dirout, dat, mode registers. -+- reg-names: Must be "dirout", "dat", "mode". -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@fffe0080 { -+ compatible = "brcm,bcm6348-pinctrl"; -+ reg = <0xfffe0080 0x8>, -+ <0xfffe0088 0x8>, -+ <0xfffe0098 0x4>; -+ reg-names = "dirout", "dat", "mode"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+group0 32-36 ext_mii, utopia, diag -+group1 22-31 ext_ephy, mii_snoop, mii_pccard, -+ spi_master_uart, utopia, diag -+group2 16-21 pci, diag -+group3 8-15 ext_mii, utopia -+group4 0-7 ext_ephy, mii_snoop, legacy_led, diag diff --git a/target/linux/brcm63xx/patches-4.4/134-pinctrl-add-a-pincontrol-driver-for-BCM6348.patch b/target/linux/brcm63xx/patches-4.4/134-pinctrl-add-a-pincontrol-driver-for-BCM6348.patch deleted file mode 100644 index 19b807586..000000000 --- a/target/linux/brcm63xx/patches-4.4/134-pinctrl-add-a-pincontrol-driver-for-BCM6348.patch +++ /dev/null @@ -1,432 +0,0 @@ -From 45444cb631555e2dc16b95d779b10aa075c7482e Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:14:13 +0200 -Subject: [PATCH 05/16] pinctrl: add a pincontrol driver for BCM6348 - -Add a pincotrol driver for BCM6348. BCM6348 allow muxing five groups of -up to ten gpios into fourteen potential functions. It does not allow -muxing individual pins. Some functions require more than one group to be -muxed to the same function. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 7 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6348.c | 392 ++++++++++++++++++++++++++++++ - 3 files changed, 400 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6348.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -8,3 +8,10 @@ config PINCTRL_BCM6328 - select PINCONF - select PINCTRL_BCM63XX - select GENERIC_PINCONF -+ -+config PINCTRL_BCM6348 -+ bool "BCM6348 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BCM63XX -+ select GENERIC_PINCONF ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -1,2 +1,3 @@ - obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o - obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o -+obj-$(CONFIG_PINCTRL_BCM6348) += pinctrl-bcm6348.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6348.c -@@ -0,0 +1,392 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6348_NGPIO 37 -+ -+#define MAX_GROUP 4 -+#define PINS_PER_GROUP 8 -+#define PIN_TO_GROUP(pin) (MAX_GROUP - ((pin) / PINS_PER_GROUP)) -+#define GROUP_SHIFT(pin) (PIN_TO_GROUP(pin) * 4) -+#define GROUP_MASK(pin) (0xf << GROUP_SHIFT(pin)) -+ -+struct bcm6348_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6348_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ unsigned int value; -+}; -+ -+struct bcm6348_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *mode; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM6348_PIN(a, b, group) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)(group), \ -+ } -+ -+static const struct pinctrl_pin_desc bcm6348_pins[] = { -+ BCM6348_PIN(0, "gpio0", 4), -+ BCM6348_PIN(1, "gpio1", 4), -+ BCM6348_PIN(2, "gpio2", 4), -+ BCM6348_PIN(3, "gpio3", 4), -+ BCM6348_PIN(4, "gpio4", 4), -+ BCM6348_PIN(5, "gpio5", 4), -+ BCM6348_PIN(6, "gpio6", 4), -+ BCM6348_PIN(7, "gpio7", 4), -+ BCM6348_PIN(8, "gpio8", 3), -+ BCM6348_PIN(9, "gpio9", 3), -+ BCM6348_PIN(10, "gpio10", 3), -+ BCM6348_PIN(11, "gpio11", 3), -+ BCM6348_PIN(12, "gpio12", 3), -+ BCM6348_PIN(13, "gpio13", 3), -+ BCM6348_PIN(14, "gpio14", 3), -+ BCM6348_PIN(15, "gpio15", 3), -+ BCM6348_PIN(16, "gpio16", 2), -+ BCM6348_PIN(17, "gpio17", 2), -+ BCM6348_PIN(18, "gpio18", 2), -+ BCM6348_PIN(19, "gpio19", 2), -+ BCM6348_PIN(20, "gpio20", 2), -+ BCM6348_PIN(21, "gpio21", 2), -+ BCM6348_PIN(22, "gpio22", 1), -+ BCM6348_PIN(23, "gpio23", 1), -+ BCM6348_PIN(24, "gpio24", 1), -+ BCM6348_PIN(25, "gpio25", 1), -+ BCM6348_PIN(26, "gpio26", 1), -+ BCM6348_PIN(27, "gpio27", 1), -+ BCM6348_PIN(28, "gpio28", 1), -+ BCM6348_PIN(29, "gpio29", 1), -+ BCM6348_PIN(30, "gpio30", 1), -+ BCM6348_PIN(31, "gpio31", 1), -+ BCM6348_PIN(32, "gpio32", 0), -+ BCM6348_PIN(33, "gpio33", 0), -+ BCM6348_PIN(34, "gpio34", 0), -+ BCM6348_PIN(35, "gpio35", 0), -+ BCM6348_PIN(36, "gpio36", 0), -+}; -+ -+enum bcm6348_muxes { -+ BCM6348_MUX_GPIO = 0, -+ BCM6348_MUX_EXT_EPHY, -+ BCM6348_MUX_MII_SNOOP, -+ BCM6348_MUX_LEGACY_LED, -+ BCM6348_MUX_MII_PCCARD, -+ BCM6348_MUX_PCI, -+ BCM6348_MUX_SPI_MASTER_UART, -+ BCM6348_MUX_EXT_MII, -+ BCM6348_MUX_UTOPIA, -+ BCM6348_MUX_DIAG, -+}; -+ -+static unsigned group0_pins[] = { -+ 32, 33, 34, 35, 36, -+}; -+ -+static unsigned group1_pins[] = { -+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -+}; -+ -+static unsigned group2_pins[] = { -+ 16, 17, 18, 19, 20, 21, -+}; -+ -+static unsigned group3_pins[] = { -+ 8, 9, 10, 11, 12, 13, 14, 15, -+}; -+ -+static unsigned group4_pins[] = { -+ 0, 1, 2, 3, 4, 5, 6, 7, -+}; -+ -+#define BCM6348_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } \ -+ -+static struct bcm6348_pingroup bcm6348_groups[] = { -+ BCM6348_GROUP(group0), -+ BCM6348_GROUP(group1), -+ BCM6348_GROUP(group2), -+ BCM6348_GROUP(group3), -+ BCM6348_GROUP(group4), -+}; -+ -+static const char * const ext_mii_groups[] = { -+ "group0", -+ "group3", -+}; -+ -+static const char * const ext_ephy_groups[] = { -+ "group1", -+ "group4" -+}; -+ -+static const char * const mii_snoop_groups[] = { -+ "group1", -+ "group4", -+}; -+ -+static const char * const legacy_led_groups[] = { -+ "group4", -+}; -+ -+static const char * const mii_pccard_groups[] = { -+ "group1", -+}; -+ -+static const char * const pci_groups[] = { -+ "group2", -+}; -+ -+static const char * const spi_master_uart_groups[] = { -+ "group1", -+}; -+ -+static const char * const utopia_groups[] = { -+ "group0", -+ "group1", -+ "group3", -+}; -+ -+static const char * const diag_groups[] = { -+ "group0", -+ "group1", -+ "group2", -+ "group4", -+}; -+ -+#define BCM6348_FUN(n, f) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .value = BCM6348_MUX_##f, \ -+ } -+ -+static const struct bcm6348_function bcm6348_funcs[] = { -+ BCM6348_FUN(ext_mii, EXT_MII), -+ BCM6348_FUN(ext_ephy, EXT_EPHY), -+ BCM6348_FUN(mii_snoop, MII_SNOOP), -+ BCM6348_FUN(legacy_led, LEGACY_LED), -+ BCM6348_FUN(mii_pccard, MII_PCCARD), -+ BCM6348_FUN(pci, PCI), -+ BCM6348_FUN(spi_master_uart, SPI_MASTER_UART), -+ BCM6348_FUN(utopia, UTOPIA), -+ BCM6348_FUN(diag, DIAG), -+}; -+ -+static int bcm6348_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6348_groups); -+} -+ -+static const char *bcm6348_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6348_groups[group].name; -+} -+ -+static int bcm6348_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6348_groups[group].pins; -+ *num_pins = bcm6348_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6348_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6348_funcs); -+} -+ -+static const char *bcm6348_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6348_funcs[selector].name; -+} -+ -+static int bcm6348_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6348_funcs[selector].groups; -+ *num_groups = bcm6348_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6348_rmw_mux(struct bcm6348_pinctrl *pctl, u32 mask, u32 val) -+{ -+ unsigned long flags; -+ u32 reg; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ -+ reg = __raw_readl(pctl->mode); -+ reg &= ~mask; -+ reg |= val & mask; -+ __raw_writel(reg, pctl->mode); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static int bcm6348_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6348_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6348_pingroup *grp = &bcm6348_groups[group]; -+ const struct bcm6348_function *f = &bcm6348_funcs[selector]; -+ u32 group_num, mask, val; -+ -+ /* -+ * pins n..(n+7) share the same group, so we only need to look at -+ * the first pin. -+ */ -+ group_num = (unsigned long)bcm6348_pins[grp->pins[0]].drv_data; -+ mask = GROUP_MASK(group_num); -+ val = f->value << GROUP_SHIFT(group_num); -+ -+ bcm6348_rmw_mux(pctl, mask, val); -+ -+ return 0; -+} -+ -+static int bcm6348_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6348_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ struct pin_desc *desc; -+ u32 mask; -+ -+ /* don't reconfigure if already muxed */ -+ desc = pin_desc_get(pctldev, offset); -+ if (desc->mux_usecount) -+ return 0; -+ -+ mask = GROUP_MASK(offset); -+ -+ /* disable all functions using this pin */ -+ bcm6348_rmw_mux(pctl, mask, 0); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6348_pctl_ops = { -+ .get_groups_count = bcm6348_pinctrl_get_group_count, -+ .get_group_name = bcm6348_pinctrl_get_group_name, -+ .get_group_pins = bcm6348_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6348_pmx_ops = { -+ .get_functions_count = bcm6348_pinctrl_get_func_count, -+ .get_function_name = bcm6348_pinctrl_get_func_name, -+ .get_function_groups = bcm6348_pinctrl_get_groups, -+ .set_mux = bcm6348_pinctrl_set_mux, -+ .gpio_request_enable = bcm6348_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6348_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6348_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *mode; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->mode = mode; -+ -+ /* disable all muxes by default */ -+ __raw_writel(0, pctl->mode); -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6348_pctl_ops; -+ pctl->desc.pmxops = &bcm6348_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6348_pins); -+ pctl->desc.pins = bcm6348_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6348_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6348_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6348-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6348_pinctrl_driver = { -+ .probe = bcm6348_pinctrl_probe, -+ .driver = { -+ .name = "bcm6348-pinctrl", -+ .of_match_table = bcm6348_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6348_pinctrl_driver); diff --git a/target/linux/brcm63xx/patches-4.4/135-Documentation-add-BCM6358-pincontroller-binding-docu.patch b/target/linux/brcm63xx/patches-4.4/135-Documentation-add-BCM6358-pincontroller-binding-docu.patch deleted file mode 100644 index e8a747991..000000000 --- a/target/linux/brcm63xx/patches-4.4/135-Documentation-add-BCM6358-pincontroller-binding-docu.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c7c8fa7f5b5ee9bea751fa7bdae8ff4acde8f26e Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:36:00 +0200 -Subject: [PATCH 06/16] Documentation: add BCM6358 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6358 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6358-pinctrl.txt | 44 ++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.txt -@@ -0,0 +1,44 @@ -+* Broadcom BCM6358 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6358-pinctrl". -+- reg: Register specifiers of dirout, dat registers. -+- reg-names: Must be "dirout", "dat". -+- brcm,gpiomode: Phandle to the shared gpiomode register. -+- gpio-controller: Identifies this node as a gpio-controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@fffe0080 { -+ compatible = "brcm,bcm6358-pinctrl"; -+ reg = <0xfffe0080 0x8>, -+ <0xfffe0088 0x8>, -+ <0xfffe0098 0x4>; -+ reg-names = "dirout", "dat"; -+ brcm,gpiomode = <&gpiomode>; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+gpiomode: syscon@fffe0098 { -+ compatible = "brcm,bcm6358-gpiomode", "syscon"; -+ reg = <0xfffe0098 0x4>; -+ native-endian; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+ebi_cs_grp 30-31 ebi_cs -+uart1_grp 28-31 uart1 -+spi_cs_grp 32-33 spi_cs -+async_modem_grp 12-15 async_modem -+legacy_led_grp 9-15 legacy_led -+serial_led_grp 6-7 serial_led -+led_grp 0-3 led -+utopia_grp 12-15, 22-31 utopia -+pwm_syn_clk_grp 8 pwm_syn_clk -+sys_irq_grp 5 sys_irq diff --git a/target/linux/brcm63xx/patches-4.4/136-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch b/target/linux/brcm63xx/patches-4.4/136-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch deleted file mode 100644 index 87dc741e2..000000000 --- a/target/linux/brcm63xx/patches-4.4/136-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch +++ /dev/null @@ -1,436 +0,0 @@ -From fb00ef462f3f8b70ea8902151cc72810fe90b999 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:16:01 +0200 -Subject: [PATCH 07/16] pinctrl: add a pincontrol driver for BCM6358 - -Add a pincotrol driver for BCM6358. BCM6358 allow overlaying different -functions onto the GPIO pins. It does not support configuring individual -pins but only whole groups. These groups may overlap, and still require -the directions to be set correctly in the GPIO register. In addition the -functions register controls other, not directly mux related functions. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 8 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6358.c | 393 ++++++++++++++++++++++++++++++ - 3 files changed, 402 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6358.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -15,3 +15,11 @@ config PINCTRL_BCM6348 - select PINCONF - select PINCTRL_BCM63XX - select GENERIC_PINCONF -+ -+config PINCTRL_BCM6358 -+ bool "BCM6358 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BCM63XX -+ select GENERIC_PINCONF -+ select MFD_SYSCON ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -1,3 +1,4 @@ - obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o - obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o - obj-$(CONFIG_PINCTRL_BCM6348) += pinctrl-bcm6348.o -+obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6358.c -@@ -0,0 +1,393 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+/* GPIO_MODE register */ -+#define BCM6358_MODE_MUX_NONE 0 -+ -+/* overlays on gpio pins */ -+#define BCM6358_MODE_MUX_EBI_CS BIT(5) -+#define BCM6358_MODE_MUX_UART1 BIT(6) -+#define BCM6358_MODE_MUX_SPI_CS BIT(7) -+#define BCM6358_MODE_MUX_ASYNC_MODEM BIT(8) -+#define BCM6358_MODE_MUX_LEGACY_LED BIT(9) -+#define BCM6358_MODE_MUX_SERIAL_LED BIT(10) -+#define BCM6358_MODE_MUX_LED BIT(11) -+#define BCM6358_MODE_MUX_UTOPIA BIT(12) -+#define BCM6358_MODE_MUX_CLKRST BIT(13) -+#define BCM6358_MODE_MUX_PWM_SYN_CLK BIT(14) -+#define BCM6358_MODE_MUX_SYS_IRQ BIT(15) -+ -+#define BCM6358_NGPIO 40 -+ -+struct bcm6358_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+ -+ const u16 mode_val; -+ -+ /* non-GPIO function muxes require the gpio direction to be set */ -+ const u16 direction; -+}; -+ -+struct bcm6358_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+}; -+ -+struct bcm6358_pinctrl { -+ struct device *dev; -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ struct regmap_field *overlays; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM6358_GPIO_PIN(a, b, bit1, bit2, bit3) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)(BCM6358_MODE_MUX_##bit1 | \ -+ BCM6358_MODE_MUX_##bit2 | \ -+ BCM6358_MODE_MUX_##bit3), \ -+ } -+ -+static const struct pinctrl_pin_desc bcm6358_pins[] = { -+ BCM6358_GPIO_PIN(0, "gpio0", LED, NONE, NONE), -+ BCM6358_GPIO_PIN(1, "gpio1", LED, NONE, NONE), -+ BCM6358_GPIO_PIN(2, "gpio2", LED, NONE, NONE), -+ BCM6358_GPIO_PIN(3, "gpio3", LED, NONE, NONE), -+ PINCTRL_PIN(4, "gpio4"), -+ BCM6358_GPIO_PIN(5, "gpio5", SYS_IRQ, NONE, NONE), -+ BCM6358_GPIO_PIN(6, "gpio6", SERIAL_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(7, "gpio7", SERIAL_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(8, "gpio8", PWM_SYN_CLK, NONE, NONE), -+ BCM6358_GPIO_PIN(9, "gpio09", LEGACY_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(10, "gpio10", LEGACY_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(11, "gpio11", LEGACY_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(12, "gpio12", LEGACY_LED, ASYNC_MODEM, UTOPIA), -+ BCM6358_GPIO_PIN(13, "gpio13", LEGACY_LED, ASYNC_MODEM, UTOPIA), -+ BCM6358_GPIO_PIN(14, "gpio14", LEGACY_LED, ASYNC_MODEM, UTOPIA), -+ BCM6358_GPIO_PIN(15, "gpio15", LEGACY_LED, ASYNC_MODEM, UTOPIA), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ BCM6358_GPIO_PIN(22, "gpio22", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(23, "gpio23", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(24, "gpio24", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(25, "gpio25", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(26, "gpio26", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(27, "gpio27", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(28, "gpio28", UTOPIA, UART1, NONE), -+ BCM6358_GPIO_PIN(29, "gpio29", UTOPIA, UART1, NONE), -+ BCM6358_GPIO_PIN(30, "gpio30", UTOPIA, UART1, EBI_CS), -+ BCM6358_GPIO_PIN(31, "gpio31", UTOPIA, UART1, EBI_CS), -+ BCM6358_GPIO_PIN(32, "gpio32", SPI_CS, NONE, NONE), -+ BCM6358_GPIO_PIN(33, "gpio33", SPI_CS, NONE, NONE), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+ PINCTRL_PIN(38, "gpio38"), -+ PINCTRL_PIN(39, "gpio39"), -+}; -+ -+static unsigned ebi_cs_grp_pins[] = { 30, 31 }; -+ -+static unsigned uart1_grp_pins[] = { 28, 29, 30, 31 }; -+ -+static unsigned spi_cs_grp_pins[] = { 32, 33 }; -+ -+static unsigned async_modem_grp_pins[] = { 12, 13, 14, 15 }; -+ -+static unsigned serial_led_grp_pins[] = { 6, 7 }; -+ -+static unsigned legacy_led_grp_pins[] = { 9, 10, 11, 12, 13, 14, 15 }; -+ -+static unsigned led_grp_pins[] = { 0, 1, 2, 3 }; -+ -+static unsigned utopia_grp_pins[] = { -+ 12, 13, 14, 15, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -+}; -+ -+static unsigned pwm_syn_clk_grp_pins[] = { 8 }; -+ -+static unsigned sys_irq_grp_pins[] = { 5 }; -+ -+#define BCM6358_GPIO_MUX_GROUP(n, bit, dir) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ .mode_val = BCM6358_MODE_MUX_##bit, \ -+ .direction = dir, \ -+ } -+ -+static const struct bcm6358_pingroup bcm6358_groups[] = { -+ BCM6358_GPIO_MUX_GROUP(ebi_cs_grp, EBI_CS, 0x3), -+ BCM6358_GPIO_MUX_GROUP(uart1_grp, UART1, 0x2), -+ BCM6358_GPIO_MUX_GROUP(spi_cs_grp, SPI_CS, 0x6), -+ BCM6358_GPIO_MUX_GROUP(async_modem_grp, ASYNC_MODEM, 0x6), -+ BCM6358_GPIO_MUX_GROUP(legacy_led_grp, LEGACY_LED, 0x7f), -+ BCM6358_GPIO_MUX_GROUP(serial_led_grp, SERIAL_LED, 0x3), -+ BCM6358_GPIO_MUX_GROUP(led_grp, LED, 0xf), -+ BCM6358_GPIO_MUX_GROUP(utopia_grp, UTOPIA, 0x000f), -+ BCM6358_GPIO_MUX_GROUP(pwm_syn_clk_grp, PWM_SYN_CLK, 0x1), -+ BCM6358_GPIO_MUX_GROUP(sys_irq_grp, SYS_IRQ, 0x1), -+}; -+ -+static const char * const ebi_cs_groups[] = { -+ "ebi_cs_grp" -+}; -+ -+static const char * const uart1_groups[] = { -+ "uart1_grp" -+}; -+ -+static const char * const spi_cs_2_3_groups[] = { -+ "spi_cs_2_3_grp" -+}; -+ -+static const char * const async_modem_groups[] = { -+ "async_modem_grp" -+}; -+ -+static const char * const legacy_led_groups[] = { -+ "legacy_led_grp", -+}; -+ -+static const char * const serial_led_groups[] = { -+ "serial_led_grp", -+}; -+ -+static const char * const led_groups[] = { -+ "led_grp", -+}; -+ -+static const char * const clkrst_groups[] = { -+ "clkrst_grp", -+}; -+ -+static const char * const pwm_syn_clk_groups[] = { -+ "pwm_syn_clk_grp", -+}; -+ -+static const char * const sys_irq_groups[] = { -+ "sys_irq_grp", -+}; -+ -+#define BCM6358_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ } -+ -+static const struct bcm6358_function bcm6358_funcs[] = { -+ BCM6358_FUN(ebi_cs), -+ BCM6358_FUN(uart1), -+ BCM6358_FUN(spi_cs_2_3), -+ BCM6358_FUN(async_modem), -+ BCM6358_FUN(legacy_led), -+ BCM6358_FUN(serial_led), -+ BCM6358_FUN(led), -+ BCM6358_FUN(clkrst), -+ BCM6358_FUN(pwm_syn_clk), -+ BCM6358_FUN(sys_irq), -+}; -+ -+static int bcm6358_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6358_groups); -+} -+ -+static const char *bcm6358_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6358_groups[group].name; -+} -+ -+static int bcm6358_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6358_groups[group].pins; -+ *num_pins = bcm6358_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6358_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6358_funcs); -+} -+ -+static const char *bcm6358_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6358_funcs[selector].name; -+} -+ -+static int bcm6358_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6358_funcs[selector].groups; -+ *num_groups = bcm6358_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static int bcm6358_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6358_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6358_pingroup *grp = &bcm6358_groups[group]; -+ u32 val = grp->mode_val; -+ u32 mask = val; -+ unsigned pin; -+ -+ for (pin = 0; pin < grp->num_pins; pin++) -+ mask |= (unsigned long)bcm6358_pins[pin].drv_data; -+ -+ regmap_field_update_bits(pctl->overlays, mask, val); -+ -+ for (pin = 0; pin < grp->num_pins; pin++) { -+ int hw_gpio = bcm6358_pins[pin].number; -+ struct gpio_chip *gc = &pctl->gpio[hw_gpio / 32]; -+ -+ if (grp->direction & BIT(pin)) -+ gc->direction_output(gc, hw_gpio % 32, 0); -+ else -+ gc->direction_input(gc, hw_gpio % 32); -+ } -+ -+ return 0; -+} -+ -+static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6358_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ u32 mask; -+ -+ mask = (unsigned long)bcm6358_pins[offset].drv_data; -+ if (!mask) -+ return 0; -+ -+ /* disable all functions using this pin */ -+ return regmap_field_update_bits(pctl->overlays, mask, 0); -+} -+ -+static struct pinctrl_ops bcm6358_pctl_ops = { -+ .get_groups_count = bcm6358_pinctrl_get_group_count, -+ .get_group_name = bcm6358_pinctrl_get_group_name, -+ .get_group_pins = bcm6358_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6358_pmx_ops = { -+ .get_functions_count = bcm6358_pinctrl_get_func_count, -+ .get_function_name = bcm6358_pinctrl_get_func_name, -+ .get_function_groups = bcm6358_pinctrl_get_groups, -+ .set_mux = bcm6358_pinctrl_set_mux, -+ .gpio_request_enable = bcm6358_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6358_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6358_pinctrl *pctl; -+ struct regmap *mode; -+ struct reg_field overlays = REG_FIELD(0, 0, 15); -+ -+ if (pdev->dev.of_node) -+ mode = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, -+ "brcm,gpiomode"); -+ else -+ mode = syscon_regmap_lookup_by_pdevname("syscon.fffe0098"); -+ -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ pctl->overlays = devm_regmap_field_alloc(&pdev->dev, mode, overlays); -+ if (IS_ERR(pctl->overlays)) -+ return PTR_ERR(pctl->overlays); -+ -+ /* disable all muxes by default */ -+ regmap_field_write(pctl->overlays, 0); -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6358_pctl_ops; -+ pctl->desc.pmxops = &bcm6358_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6358_pins); -+ pctl->desc.pins = bcm6358_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6358_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6358_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6358-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6358_pinctrl_driver = { -+ .probe = bcm6358_pinctrl_probe, -+ .driver = { -+ .name = "bcm6358-pinctrl", -+ .of_match_table = bcm6358_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6358_pinctrl_driver); diff --git a/target/linux/brcm63xx/patches-4.4/137-Documentation-add-BCM6362-pincontroller-binding-docu.patch b/target/linux/brcm63xx/patches-4.4/137-Documentation-add-BCM6362-pincontroller-binding-docu.patch deleted file mode 100644 index 9fc424cb4..000000000 --- a/target/linux/brcm63xx/patches-4.4/137-Documentation-add-BCM6362-pincontroller-binding-docu.patch +++ /dev/null @@ -1,96 +0,0 @@ -From ba03ea8ada2ca71c9095d96a1e4085c2c5cf0e69 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:36:18 +0200 -Subject: [PATCH 08/16] Documentation: add BCM6362 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6362 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6362-pinctrl.txt | 79 ++++++++++++++++++++++ - 1 file changed, 79 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.txt -@@ -0,0 +1,79 @@ -+* Broadcom BCM6362 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6362-pinctrl" -+- reg: Register specifiers of dirout, dat, led, mode, ctrl, basemode registers. -+- reg-names: Must be "dirout", "dat", "led", "mode", "ctrl", "basemode". -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@10000080 { -+ compatible = "brcm,bcm6362-pinctrl"; -+ reg = <0x10000080 0x8>, -+ <0x10000088 0x8>, -+ <0x10000090 0x4>, -+ <0x10000098 0x4>, -+ <0x1000009c 0x4>, -+ <0x100000b8 0x4>; -+ reg-names = "dirout", "dat", "led", -+ "mode", "ctrl", "basemode"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 led, usb_device_led -+gpio1 1 led, sys_irq -+gpio2 2 led, serial_led_clk -+gpio3 3 led, serial_led_data -+gpio4 4 led, robosw_led_data -+gpio5 5 led, robosw_led_clk -+gpio6 6 led, robosw_led0 -+gpio7 7 led, robosw_led1 -+gpio8 8 led, inet_led -+gpio9 9 led, spi_cs2 -+gpio10 10 led, spi_cs3 -+gpio11 11 led, ntr_pulse -+gpio12 12 led, uart1_scts -+gpio13 13 led, uart1_srts -+gpio14 14 led, uart1_sdin -+gpio15 15 led, uart1_sdout -+gpio16 16 led, adsl_spi_miso -+gpio17 17 led, adsl_spi_mosi -+gpio18 18 led, adsl_spi_clk -+gpio19 19 led, adsl_spi_cs -+gpio20 20 led, ephy0_led -+gpio21 21 led, ephy1_led -+gpio22 22 led, ephy2_led -+gpio23 23 led, ephy3_led -+gpio24 24 ext_irq0 -+gpio25 25 ext_irq1 -+gpio26 26 ext_irq2 -+gpio27 27 ext_irq3 -+gpio28 28 - -+gpio29 29 - -+gpio30 30 - -+gpio31 31 - -+gpio32 32 wifi -+gpio33 33 wifi -+gpio34 34 wifi -+gpio35 35 wifi -+gpio36 36 wifi -+gpio37 37 wifi -+gpio38 38 wifi -+gpio39 39 wifi -+gpio40 40 wifi -+gpio41 41 wifi -+gpio42 42 wifi -+gpio43 43 wifi -+gpio44 44 wifi -+gpio45 45 wifi -+gpio46 46 wifi -+gpio47 47 wifi -+nand_grp 8, 12-23, 27 nand diff --git a/target/linux/brcm63xx/patches-4.4/138-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch b/target/linux/brcm63xx/patches-4.4/138-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch deleted file mode 100644 index 726a97f24..000000000 --- a/target/linux/brcm63xx/patches-4.4/138-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch +++ /dev/null @@ -1,733 +0,0 @@ -From eea6b96701d734095e2f823f3a82d9b063f553ae Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:17:20 +0200 -Subject: [PATCH 09/16] pinctrl: add a pincontrol driver for BCM6362 - -Add a pincotrol driver for BCM6362. BCM6362 allows muxing individual -GPIO pins to the LED controller, to be available by the integrated -wifi, or other functions. It also supports overlay groups, of which -only NAND is documented. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 7 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6362.c | 692 ++++++++++++++++++++++++++++++ - 3 files changed, 700 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6362.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -23,3 +23,10 @@ config PINCTRL_BCM6358 - select PINCTRL_BCM63XX - select GENERIC_PINCONF - select MFD_SYSCON -+ -+config PINCTRL_BCM6362 -+ bool "BCM6362 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BCM63XX -+ select GENERIC_PINCONF ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -2,3 +2,4 @@ obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl - obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o - obj-$(CONFIG_PINCTRL_BCM6348) += pinctrl-bcm6348.o - obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o -+obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6362.c -@@ -0,0 +1,692 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6362_NGPIO 48 -+ -+/* GPIO_BASEMODE register */ -+#define BASEMODE_NAND BIT(2) -+ -+enum bcm6362_pinctrl_reg { -+ BCM6362_LEDCTRL, -+ BCM6362_MODE, -+ BCM6362_CTRL, -+ BCM6362_BASEMODE, -+}; -+ -+struct bcm6362_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6362_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ enum bcm6362_pinctrl_reg reg; -+ u32 basemode_mask; -+}; -+ -+struct bcm6362_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *led; -+ void __iomem *mode; -+ void __iomem *ctrl; -+ void __iomem *basemode; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM6362_PIN(a, b, mask) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)(mask), \ -+ } -+ -+static const struct pinctrl_pin_desc bcm6362_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ PINCTRL_PIN(2, "gpio2"), -+ PINCTRL_PIN(3, "gpio3"), -+ PINCTRL_PIN(4, "gpio4"), -+ PINCTRL_PIN(5, "gpio5"), -+ PINCTRL_PIN(6, "gpio6"), -+ PINCTRL_PIN(7, "gpio7"), -+ BCM6362_PIN(8, "gpio8", BASEMODE_NAND), -+ PINCTRL_PIN(9, "gpio9"), -+ PINCTRL_PIN(10, "gpio10"), -+ PINCTRL_PIN(11, "gpio11"), -+ BCM6362_PIN(12, "gpio12", BASEMODE_NAND), -+ BCM6362_PIN(13, "gpio13", BASEMODE_NAND), -+ BCM6362_PIN(14, "gpio14", BASEMODE_NAND), -+ BCM6362_PIN(15, "gpio15", BASEMODE_NAND), -+ BCM6362_PIN(16, "gpio16", BASEMODE_NAND), -+ BCM6362_PIN(17, "gpio17", BASEMODE_NAND), -+ BCM6362_PIN(18, "gpio18", BASEMODE_NAND), -+ BCM6362_PIN(19, "gpio19", BASEMODE_NAND), -+ BCM6362_PIN(20, "gpio20", BASEMODE_NAND), -+ BCM6362_PIN(21, "gpio21", BASEMODE_NAND), -+ BCM6362_PIN(22, "gpio22", BASEMODE_NAND), -+ BCM6362_PIN(23, "gpio23", BASEMODE_NAND), -+ PINCTRL_PIN(24, "gpio24"), -+ PINCTRL_PIN(25, "gpio25"), -+ PINCTRL_PIN(26, "gpio26"), -+ BCM6362_PIN(27, "gpio27", BASEMODE_NAND), -+ PINCTRL_PIN(28, "gpio28"), -+ PINCTRL_PIN(29, "gpio29"), -+ PINCTRL_PIN(30, "gpio30"), -+ PINCTRL_PIN(31, "gpio31"), -+ PINCTRL_PIN(32, "gpio32"), -+ PINCTRL_PIN(33, "gpio33"), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+ PINCTRL_PIN(38, "gpio38"), -+ PINCTRL_PIN(39, "gpio39"), -+ PINCTRL_PIN(40, "gpio40"), -+ PINCTRL_PIN(41, "gpio41"), -+ PINCTRL_PIN(42, "gpio42"), -+ PINCTRL_PIN(43, "gpio43"), -+ PINCTRL_PIN(44, "gpio44"), -+ PINCTRL_PIN(45, "gpio45"), -+ PINCTRL_PIN(46, "gpio46"), -+ PINCTRL_PIN(47, "gpio47"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+static unsigned gpio32_pins[] = { 32 }; -+static unsigned gpio33_pins[] = { 33 }; -+static unsigned gpio34_pins[] = { 34 }; -+static unsigned gpio35_pins[] = { 35 }; -+static unsigned gpio36_pins[] = { 36 }; -+static unsigned gpio37_pins[] = { 37 }; -+static unsigned gpio38_pins[] = { 38 }; -+static unsigned gpio39_pins[] = { 39 }; -+static unsigned gpio40_pins[] = { 40 }; -+static unsigned gpio41_pins[] = { 41 }; -+static unsigned gpio42_pins[] = { 42 }; -+static unsigned gpio43_pins[] = { 43 }; -+static unsigned gpio44_pins[] = { 44 }; -+static unsigned gpio45_pins[] = { 45 }; -+static unsigned gpio46_pins[] = { 46 }; -+static unsigned gpio47_pins[] = { 47 }; -+ -+static unsigned nand_grp_pins[] = { -+ 8, 12, 13, 14, 15, 16, 17, -+ 18, 19, 20, 21, 22, 23, 27, -+}; -+ -+#define BCM6362_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm6362_pingroup bcm6362_groups[] = { -+ BCM6362_GROUP(gpio0), -+ BCM6362_GROUP(gpio1), -+ BCM6362_GROUP(gpio2), -+ BCM6362_GROUP(gpio3), -+ BCM6362_GROUP(gpio4), -+ BCM6362_GROUP(gpio5), -+ BCM6362_GROUP(gpio6), -+ BCM6362_GROUP(gpio7), -+ BCM6362_GROUP(gpio8), -+ BCM6362_GROUP(gpio9), -+ BCM6362_GROUP(gpio10), -+ BCM6362_GROUP(gpio11), -+ BCM6362_GROUP(gpio12), -+ BCM6362_GROUP(gpio13), -+ BCM6362_GROUP(gpio14), -+ BCM6362_GROUP(gpio15), -+ BCM6362_GROUP(gpio16), -+ BCM6362_GROUP(gpio17), -+ BCM6362_GROUP(gpio18), -+ BCM6362_GROUP(gpio19), -+ BCM6362_GROUP(gpio20), -+ BCM6362_GROUP(gpio21), -+ BCM6362_GROUP(gpio22), -+ BCM6362_GROUP(gpio23), -+ BCM6362_GROUP(gpio24), -+ BCM6362_GROUP(gpio25), -+ BCM6362_GROUP(gpio26), -+ BCM6362_GROUP(gpio27), -+ BCM6362_GROUP(gpio28), -+ BCM6362_GROUP(gpio29), -+ BCM6362_GROUP(gpio30), -+ BCM6362_GROUP(gpio31), -+ BCM6362_GROUP(gpio32), -+ BCM6362_GROUP(gpio33), -+ BCM6362_GROUP(gpio34), -+ BCM6362_GROUP(gpio35), -+ BCM6362_GROUP(gpio36), -+ BCM6362_GROUP(gpio37), -+ BCM6362_GROUP(gpio38), -+ BCM6362_GROUP(gpio39), -+ BCM6362_GROUP(gpio40), -+ BCM6362_GROUP(gpio41), -+ BCM6362_GROUP(gpio42), -+ BCM6362_GROUP(gpio43), -+ BCM6362_GROUP(gpio44), -+ BCM6362_GROUP(gpio45), -+ BCM6362_GROUP(gpio46), -+ BCM6362_GROUP(gpio47), -+ BCM6362_GROUP(nand_grp), -+}; -+ -+static const char * const led_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+}; -+ -+static const char * const usb_device_led_groups[] = { -+ "gpio0", -+}; -+ -+static const char * const sys_irq_groups[] = { -+ "gpio1", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio2", -+}; -+ -+static const char * const serial_led_data_groups[] = { -+ "gpio3", -+}; -+ -+static const char * const robosw_led_data_groups[] = { -+ "gpio4", -+}; -+ -+static const char * const robosw_led_clk_groups[] = { -+ "gpio5", -+}; -+ -+static const char * const robosw_led0_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const robosw_led1_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const inet_led_groups[] = { -+ "gpio8", -+}; -+ -+static const char * const spi_cs2_groups[] = { -+ "gpio9", -+}; -+ -+static const char * const spi_cs3_groups[] = { -+ "gpio10", -+}; -+ -+static const char * const ntr_pulse_groups[] = { -+ "gpio11", -+}; -+ -+static const char * const uart1_scts_groups[] = { -+ "gpio12", -+}; -+ -+static const char * const uart1_srts_groups[] = { -+ "gpio13", -+}; -+ -+static const char * const uart1_sdin_groups[] = { -+ "gpio14", -+}; -+ -+static const char * const uart1_sdout_groups[] = { -+ "gpio15", -+}; -+ -+static const char * const adsl_spi_miso_groups[] = { -+ "gpio16", -+}; -+ -+static const char * const adsl_spi_mosi_groups[] = { -+ "gpio17", -+}; -+ -+static const char * const adsl_spi_clk_groups[] = { -+ "gpio18", -+}; -+ -+static const char * const adsl_spi_cs_groups[] = { -+ "gpio19", -+}; -+ -+static const char * const ephy0_led_groups[] = { -+ "gpio20", -+}; -+ -+static const char * const ephy1_led_groups[] = { -+ "gpio21", -+}; -+ -+static const char * const ephy2_led_groups[] = { -+ "gpio22", -+}; -+ -+static const char * const ephy3_led_groups[] = { -+ "gpio23", -+}; -+ -+static const char * const ext_irq0_groups[] = { -+ "gpio24", -+}; -+ -+static const char * const ext_irq1_groups[] = { -+ "gpio25", -+}; -+ -+static const char * const ext_irq2_groups[] = { -+ "gpio26", -+}; -+ -+static const char * const ext_irq3_groups[] = { -+ "gpio27", -+}; -+ -+static const char * const wifi_groups[] = { -+ "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35", -+ "gpio36", -+ "gpio37", -+ "gpio38", -+ "gpio39", -+ "gpio40", -+ "gpio41", -+ "gpio42", -+ "gpio43", -+ "gpio44", -+ "gpio45", -+ "gpio46", -+ "gpio47", -+}; -+ -+static const char * const nand_groups[] = { -+ "nand_grp", -+}; -+ -+#define BCM6362_LED_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM6362_LEDCTRL, \ -+ } -+ -+#define BCM6362_MODE_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM6362_MODE, \ -+ } -+ -+#define BCM6362_CTRL_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM6362_CTRL, \ -+ } -+ -+#define BCM6362_BASEMODE_FUN(n, mask) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM6362_BASEMODE, \ -+ .basemode_mask = (mask), \ -+ } -+ -+static const struct bcm6362_function bcm6362_funcs[] = { -+ BCM6362_LED_FUN(led), -+ BCM6362_MODE_FUN(usb_device_led), -+ BCM6362_MODE_FUN(sys_irq), -+ BCM6362_MODE_FUN(serial_led_clk), -+ BCM6362_MODE_FUN(serial_led_data), -+ BCM6362_MODE_FUN(robosw_led_data), -+ BCM6362_MODE_FUN(robosw_led_clk), -+ BCM6362_MODE_FUN(robosw_led0), -+ BCM6362_MODE_FUN(robosw_led1), -+ BCM6362_MODE_FUN(inet_led), -+ BCM6362_MODE_FUN(spi_cs2), -+ BCM6362_MODE_FUN(spi_cs3), -+ BCM6362_MODE_FUN(ntr_pulse), -+ BCM6362_MODE_FUN(uart1_scts), -+ BCM6362_MODE_FUN(uart1_srts), -+ BCM6362_MODE_FUN(uart1_sdin), -+ BCM6362_MODE_FUN(uart1_sdout), -+ BCM6362_MODE_FUN(adsl_spi_miso), -+ BCM6362_MODE_FUN(adsl_spi_mosi), -+ BCM6362_MODE_FUN(adsl_spi_clk), -+ BCM6362_MODE_FUN(adsl_spi_cs), -+ BCM6362_MODE_FUN(ephy0_led), -+ BCM6362_MODE_FUN(ephy1_led), -+ BCM6362_MODE_FUN(ephy2_led), -+ BCM6362_MODE_FUN(ephy3_led), -+ BCM6362_MODE_FUN(ext_irq0), -+ BCM6362_MODE_FUN(ext_irq1), -+ BCM6362_MODE_FUN(ext_irq2), -+ BCM6362_MODE_FUN(ext_irq3), -+ BCM6362_CTRL_FUN(wifi), -+ BCM6362_BASEMODE_FUN(nand, BASEMODE_NAND), -+}; -+ -+static int bcm6362_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6362_groups); -+} -+ -+static const char *bcm6362_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6362_groups[group].name; -+} -+ -+static int bcm6362_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6362_groups[group].pins; -+ *num_pins = bcm6362_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6362_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6362_funcs); -+} -+ -+static const char *bcm6362_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6362_funcs[selector].name; -+} -+ -+static int bcm6362_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6362_funcs[selector].groups; -+ *num_groups = bcm6362_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6362_rmw_mux(struct bcm6362_pinctrl *pctl, void __iomem *reg, -+ u32 mask, u32 val) -+{ -+ unsigned long flags; -+ u32 tmp; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ tmp = __raw_readl(reg); -+ tmp &= ~mask; -+ tmp |= val & mask; -+ __raw_writel(tmp, reg); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static void bcm6362_set_gpio(struct bcm6362_pinctrl *pctl, unsigned pin) -+{ -+ const struct pinctrl_pin_desc *desc = &bcm6362_pins[pin]; -+ u32 mask = BIT(pin % 32); -+ -+ if (desc->drv_data) -+ bcm6362_rmw_mux(pctl, pctl->basemode, (u32)desc->drv_data, 0); -+ -+ if (pin < 32) { -+ /* base mode 0 => gpio 1 => mux function */ -+ bcm6362_rmw_mux(pctl, pctl->mode, mask, 0); -+ -+ /* pins 0-23 might be muxed to led */ -+ if (pin < 24) -+ bcm6362_rmw_mux(pctl, pctl->led, mask, 0); -+ } else { -+ /* ctrl reg 0 => wifi function 1 => gpio */ -+ bcm6362_rmw_mux(pctl, pctl->ctrl, mask, mask); -+ } -+} -+ -+static int bcm6362_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6362_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6362_pingroup *grp = &bcm6362_groups[group]; -+ const struct bcm6362_function *f = &bcm6362_funcs[selector]; -+ unsigned i; -+ void __iomem *reg; -+ u32 val, mask; -+ -+ for (i = 0; i < grp->num_pins; i++) -+ bcm6362_set_gpio(pctl, grp->pins[i]); -+ -+ switch (f->reg) { -+ case BCM6362_LEDCTRL: -+ reg = pctl->led; -+ mask = BIT(grp->pins[0]); -+ val = BIT(grp->pins[0]); -+ break; -+ case BCM6362_MODE: -+ reg = pctl->ctrl; -+ mask = BIT(grp->pins[0]); -+ val = BIT(grp->pins[0]); -+ break; -+ case BCM6362_CTRL: -+ reg = pctl->ctrl; -+ mask = BIT(grp->pins[0]); -+ val = 0; -+ break; -+ case BCM6362_BASEMODE: -+ reg = pctl->basemode; -+ mask = f->basemode_mask; -+ val = f->basemode_mask; -+ break; -+ default: -+ WARN_ON(1); -+ return -EINVAL; -+ } -+ -+ bcm6362_rmw_mux(pctl, reg, mask, val); -+ -+ return 0; -+} -+ -+static int bcm6362_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6362_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable all functions using this pin */ -+ bcm6362_set_gpio(pctl, offset); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6362_pctl_ops = { -+ .get_groups_count = bcm6362_pinctrl_get_group_count, -+ .get_group_name = bcm6362_pinctrl_get_group_name, -+ .get_group_pins = bcm6362_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6362_pmx_ops = { -+ .get_functions_count = bcm6362_pinctrl_get_func_count, -+ .get_function_name = bcm6362_pinctrl_get_func_name, -+ .get_function_groups = bcm6362_pinctrl_get_groups, -+ .set_mux = bcm6362_pinctrl_set_mux, -+ .gpio_request_enable = bcm6362_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6362_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6362_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *led, *mode, *ctrl, *basemode; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "led"); -+ led = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(led)) -+ return PTR_ERR(led); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); -+ ctrl = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(ctrl)) -+ return PTR_ERR(ctrl); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "basemode"); -+ basemode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(basemode)) -+ return PTR_ERR(basemode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->led = led; -+ pctl->mode = mode; -+ pctl->ctrl = ctrl; -+ pctl->basemode = basemode; -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6362_pctl_ops; -+ pctl->desc.pmxops = &bcm6362_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6362_pins); -+ pctl->desc.pins = bcm6362_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6362_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6362_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6362-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6362_pinctrl_driver = { -+ .probe = bcm6362_pinctrl_probe, -+ .driver = { -+ .name = "bcm6362-pinctrl", -+ .of_match_table = bcm6362_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6362_pinctrl_driver); diff --git a/target/linux/brcm63xx/patches-4.4/139-Documentation-add-BCM6368-pincontroller-binding-docu.patch b/target/linux/brcm63xx/patches-4.4/139-Documentation-add-BCM6368-pincontroller-binding-docu.patch deleted file mode 100644 index e0a698fc1..000000000 --- a/target/linux/brcm63xx/patches-4.4/139-Documentation-add-BCM6368-pincontroller-binding-docu.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 30594cf9bfff176a9e4b14c50dcd8b9d0cc3edec Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:36:51 +0200 -Subject: [PATCH 10/16] Documentation: add BCM6368 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6368 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6368-pinctrl.txt | 67 ++++++++++++++++++++++ - 1 file changed, 67 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.txt -@@ -0,0 +1,67 @@ -+* Broadcom BCM6368 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6368-pinctrl". -+- reg: Register specifiers of dirout, dat, mode registers. -+- reg-names: Must be "dirout", "dat", "mode". -+- brcm,gpiobasemode: Phandle to the gpio basemode register. -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@10000080 { -+ compatible = "brcm,bcm6368-pinctrl"; -+ reg = <0x10000080 0x08>, -+ <0x10000088 0x08>, -+ <0x10000098 0x04>; -+ reg-names = "dirout", "dat", "mode"; -+ brcm,gpiobasemode = <&gpiobasemode>; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+gpiobasemode: syscon@100000b8 { -+ compatible = "brcm,bcm6368-gpiobasemode", "syscon"; -+ reg = <0x100000b8 4>; -+ native-endian; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 analog_afe0 -+gpio1 1 analog_afe1 -+gpio2 2 sys_irq -+gpio3 3 serial_led_data -+gpio4 4 serial_led_clk -+gpio5 5 inet_led -+gpio6 6 ephy0_led -+gpio7 7 ephy1_led -+gpio8 8 ephy2_led -+gpio9 9 ephy3_led -+gpio10 10 robosw_led_data -+gpio11 11 robosw_led_clk -+gpio12 12 robosw_led0 -+gpio13 13 robosw_led1 -+gpio14 14 usb_device_led -+gpio15 15 - -+gpio16 16 pci_req1 -+gpio17 17 pci_gnt1 -+gpio18 18 pci_intb -+gpio19 19 pci_req0 -+gpio20 20 pci_gnt0 -+gpio21 21 - -+gpio22 22 pcmcia_cd1 -+gpio23 23 pcmcia_cd2 -+gpio24 24 pcmcia_vs1 -+gpio25 25 pcmcia_vs2 -+gpio26 26 ebi_cs2 -+gpio27 27 ebi_cs3 -+gpio28 28 spi_cs2 -+gpio29 29 spi_cs3 -+gpio30 30 spi_cs4 -+gpio31 31 spi_cs5 -+uart1_grp 30-33 uart1 diff --git a/target/linux/brcm63xx/patches-4.4/140-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch b/target/linux/brcm63xx/patches-4.4/140-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch deleted file mode 100644 index 6a9b9e080..000000000 --- a/target/linux/brcm63xx/patches-4.4/140-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch +++ /dev/null @@ -1,620 +0,0 @@ -From 90be3cb4f1a45b8be4a4ec264cd66c2f8e893fcb Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:18:25 +0200 -Subject: [PATCH 11/16] pinctrl: add a pincontrol driver for BCM6368 - -Add a pincontrol driver for BCM6368. BCM6368 allows muxing the first 32 -GPIOs onto alternative functions. Not all are documented. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 15 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6368.c | 573 ++++++++++++++++++++++++++++++ - 3 files changed, 589 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6368.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -30,3 +30,18 @@ config PINCTRL_BCM6362 - select PINCONF - select PINCTRL_BCM63XX - select GENERIC_PINCONF -+ -+config PINCTRL_BCM6368 -+ bool "BCM6368 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BCM63XX -+ select GENERIC_PINCONF -+ select MFD_SYSCON -+ -+config PINCTRL_BCM63268 -+ bool "BCM63268 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BCM63XX -+ select GENERIC_PINCONF ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -3,3 +3,4 @@ obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl - obj-$(CONFIG_PINCTRL_BCM6348) += pinctrl-bcm6348.o - obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o - obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o -+obj-$(CONFIG_PINCTRL_BCM6368) += pinctrl-bcm6368.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6368.c -@@ -0,0 +1,573 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6368_NGPIO 38 -+ -+#define BCM6368_BASEMODE_MASK 0x7 -+#define BCM6368_BASEMODE_GPIO 0x0 -+#define BCM6368_BASEMODE_UART1 0x1 -+ -+struct bcm6368_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6368_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ unsigned dir_out:16; -+ unsigned basemode:3; -+}; -+ -+struct bcm6368_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *mode; -+ struct regmap_field *overlay; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM6368_BASEMODE_PIN(a, b) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)true \ -+ } -+ -+static const struct pinctrl_pin_desc bcm6368_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ PINCTRL_PIN(2, "gpio2"), -+ PINCTRL_PIN(3, "gpio3"), -+ PINCTRL_PIN(4, "gpio4"), -+ PINCTRL_PIN(5, "gpio5"), -+ PINCTRL_PIN(6, "gpio6"), -+ PINCTRL_PIN(7, "gpio7"), -+ PINCTRL_PIN(8, "gpio8"), -+ PINCTRL_PIN(9, "gpio9"), -+ PINCTRL_PIN(10, "gpio10"), -+ PINCTRL_PIN(11, "gpio11"), -+ PINCTRL_PIN(12, "gpio12"), -+ PINCTRL_PIN(13, "gpio13"), -+ PINCTRL_PIN(14, "gpio14"), -+ PINCTRL_PIN(15, "gpio15"), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ PINCTRL_PIN(22, "gpio22"), -+ PINCTRL_PIN(23, "gpio23"), -+ PINCTRL_PIN(24, "gpio24"), -+ PINCTRL_PIN(25, "gpio25"), -+ PINCTRL_PIN(26, "gpio26"), -+ PINCTRL_PIN(27, "gpio27"), -+ PINCTRL_PIN(28, "gpio28"), -+ PINCTRL_PIN(29, "gpio29"), -+ BCM6368_BASEMODE_PIN(30, "gpio30"), -+ BCM6368_BASEMODE_PIN(31, "gpio31"), -+ BCM6368_BASEMODE_PIN(32, "gpio32"), -+ BCM6368_BASEMODE_PIN(33, "gpio33"), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+static unsigned uart1_grp_pins[] = { 30, 31, 32, 33 }; -+ -+#define BCM6368_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm6368_pingroup bcm6368_groups[] = { -+ BCM6368_GROUP(gpio0), -+ BCM6368_GROUP(gpio1), -+ BCM6368_GROUP(gpio2), -+ BCM6368_GROUP(gpio3), -+ BCM6368_GROUP(gpio4), -+ BCM6368_GROUP(gpio5), -+ BCM6368_GROUP(gpio6), -+ BCM6368_GROUP(gpio7), -+ BCM6368_GROUP(gpio8), -+ BCM6368_GROUP(gpio9), -+ BCM6368_GROUP(gpio10), -+ BCM6368_GROUP(gpio11), -+ BCM6368_GROUP(gpio12), -+ BCM6368_GROUP(gpio13), -+ BCM6368_GROUP(gpio14), -+ BCM6368_GROUP(gpio15), -+ BCM6368_GROUP(gpio16), -+ BCM6368_GROUP(gpio17), -+ BCM6368_GROUP(gpio18), -+ BCM6368_GROUP(gpio19), -+ BCM6368_GROUP(gpio20), -+ BCM6368_GROUP(gpio21), -+ BCM6368_GROUP(gpio22), -+ BCM6368_GROUP(gpio23), -+ BCM6368_GROUP(gpio24), -+ BCM6368_GROUP(gpio25), -+ BCM6368_GROUP(gpio26), -+ BCM6368_GROUP(gpio27), -+ BCM6368_GROUP(gpio28), -+ BCM6368_GROUP(gpio29), -+ BCM6368_GROUP(gpio30), -+ BCM6368_GROUP(gpio31), -+ BCM6368_GROUP(uart1_grp), -+}; -+ -+static const char * const analog_afe_0_groups[] = { -+ "gpio0", -+}; -+ -+static const char * const analog_afe_1_groups[] = { -+ "gpio1", -+}; -+ -+static const char * const sys_irq_groups[] = { -+ "gpio2", -+}; -+ -+static const char * const serial_led_data_groups[] = { -+ "gpio3", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio4", -+}; -+ -+static const char * const inet_led_groups[] = { -+ "gpio5", -+}; -+ -+static const char * const ephy0_led_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const ephy1_led_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const ephy2_led_groups[] = { -+ "gpio8", -+}; -+ -+static const char * const ephy3_led_groups[] = { -+ "gpio9", -+}; -+ -+static const char * const robosw_led_data_groups[] = { -+ "gpio10", -+}; -+ -+static const char * const robosw_led_clk_groups[] = { -+ "gpio11", -+}; -+ -+static const char * const robosw_led0_groups[] = { -+ "gpio12", -+}; -+ -+static const char * const robosw_led1_groups[] = { -+ "gpio13", -+}; -+ -+static const char * const usb_device_led_groups[] = { -+ "gpio14", -+}; -+ -+static const char * const pci_req1_groups[] = { -+ "gpio16", -+}; -+ -+static const char * const pci_gnt1_groups[] = { -+ "gpio17", -+}; -+ -+static const char * const pci_intb_groups[] = { -+ "gpio18", -+}; -+ -+static const char * const pci_req0_groups[] = { -+ "gpio19", -+}; -+ -+static const char * const pci_gnt0_groups[] = { -+ "gpio20", -+}; -+ -+static const char * const pcmcia_cd1_groups[] = { -+ "gpio22", -+}; -+ -+static const char * const pcmcia_cd2_groups[] = { -+ "gpio23", -+}; -+ -+static const char * const pcmcia_vs1_groups[] = { -+ "gpio24", -+}; -+ -+static const char * const pcmcia_vs2_groups[] = { -+ "gpio25", -+}; -+ -+static const char * const ebi_cs2_groups[] = { -+ "gpio26", -+}; -+ -+static const char * const ebi_cs3_groups[] = { -+ "gpio27", -+}; -+ -+static const char * const spi_cs2_groups[] = { -+ "gpio28", -+}; -+ -+static const char * const spi_cs3_groups[] = { -+ "gpio29", -+}; -+ -+static const char * const spi_cs4_groups[] = { -+ "gpio30", -+}; -+ -+static const char * const spi_cs5_groups[] = { -+ "gpio31", -+}; -+ -+static const char * const uart1_groups[] = { -+ "uart1_grp", -+}; -+ -+#define BCM6368_FUN(n, out) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .dir_out = out, \ -+ } -+ -+#define BCM6368_BASEMODE_FUN(n, val, out) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .basemode = BCM6368_BASEMODE_##val, \ -+ .dir_out = out, \ -+ } -+ -+static const struct bcm6368_function bcm6368_funcs[] = { -+ BCM6368_FUN(analog_afe_0, 1), -+ BCM6368_FUN(analog_afe_1, 1), -+ BCM6368_FUN(sys_irq, 1), -+ BCM6368_FUN(serial_led_data, 1), -+ BCM6368_FUN(serial_led_clk, 1), -+ BCM6368_FUN(inet_led, 1), -+ BCM6368_FUN(ephy0_led, 1), -+ BCM6368_FUN(ephy1_led, 1), -+ BCM6368_FUN(ephy2_led, 1), -+ BCM6368_FUN(ephy3_led, 1), -+ BCM6368_FUN(robosw_led_data, 1), -+ BCM6368_FUN(robosw_led_clk, 1), -+ BCM6368_FUN(robosw_led0, 1), -+ BCM6368_FUN(robosw_led1, 1), -+ BCM6368_FUN(usb_device_led, 1), -+ BCM6368_FUN(pci_req1, 0), -+ BCM6368_FUN(pci_gnt1, 0), -+ BCM6368_FUN(pci_intb, 0), -+ BCM6368_FUN(pci_req0, 0), -+ BCM6368_FUN(pci_gnt0, 0), -+ BCM6368_FUN(pcmcia_cd1, 0), -+ BCM6368_FUN(pcmcia_cd2, 0), -+ BCM6368_FUN(pcmcia_vs1, 0), -+ BCM6368_FUN(pcmcia_vs2, 0), -+ BCM6368_FUN(ebi_cs2, 1), -+ BCM6368_FUN(ebi_cs3, 1), -+ BCM6368_FUN(spi_cs2, 1), -+ BCM6368_FUN(spi_cs3, 1), -+ BCM6368_FUN(spi_cs4, 1), -+ BCM6368_FUN(spi_cs5, 1), -+ BCM6368_BASEMODE_FUN(uart1, UART1, 0x6), -+}; -+ -+static int bcm6368_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6368_groups); -+} -+ -+static const char *bcm6368_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6368_groups[group].name; -+} -+ -+static int bcm6368_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6368_groups[group].pins; -+ *num_pins = bcm6368_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6368_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6368_funcs); -+} -+ -+static const char *bcm6368_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6368_funcs[selector].name; -+} -+ -+static int bcm6368_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6368_funcs[selector].groups; -+ *num_groups = bcm6368_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6368_rmw_mux(struct bcm6368_pinctrl *pctl, void __iomem *reg, -+ u32 mask, u32 val) -+{ -+ u32 tmp; -+ -+ tmp = __raw_readl(reg); -+ tmp &= ~mask; -+ tmp |= (val & mask); -+ __raw_writel(tmp, reg); -+} -+ -+static int bcm6368_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6368_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6368_pingroup *grp = &bcm6368_groups[group]; -+ const struct bcm6368_function *fun = &bcm6368_funcs[selector]; -+ unsigned long flags; -+ int i, pin; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ if (fun->basemode) { -+ u32 mask = 0; -+ -+ for (i = 0; i < grp->num_pins; i++) { -+ pin = grp->pins[i]; -+ if (pin < 32) -+ mask |= BIT(pin); -+ } -+ -+ bcm6368_rmw_mux(pctl, pctl->mode, mask, 0); -+ regmap_field_write(pctl->overlay, fun->basemode); -+ } else { -+ pin = grp->pins[0]; -+ -+ if (bcm6368_pins[pin].drv_data) -+ regmap_field_write(pctl->overlay, -+ BCM6368_BASEMODE_GPIO); -+ -+ bcm6368_rmw_mux(pctl, pctl->mode, BIT(pin), BIT(pin)); -+ } -+ spin_unlock_irqrestore(&pctl->lock, flags); -+ -+ for (pin = 0; pin < grp->num_pins; pin++) { -+ int hw_gpio = bcm6368_pins[pin].number; -+ struct gpio_chip *gc = &pctl->gpio[hw_gpio / 32]; -+ -+ if (fun->dir_out & BIT(pin)) -+ gc->direction_output(gc, hw_gpio % 32, 0); -+ else -+ gc->direction_input(gc, hw_gpio % 32); -+ } -+ -+ return 0; -+} -+ -+static int bcm6368_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6368_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ unsigned long flags; -+ -+ if (offset >= 32 && !bcm6368_pins[offset].drv_data) -+ return 0; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ /* disable all functions using this pin */ -+ if (offset < 32) -+ bcm6368_rmw_mux(pctl, pctl->mode, BIT(offset), 0); -+ -+ if (bcm6368_pins[offset].drv_data) -+ regmap_field_write(pctl->overlay, BCM6368_BASEMODE_GPIO); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6368_pctl_ops = { -+ .get_groups_count = bcm6368_pinctrl_get_group_count, -+ .get_group_name = bcm6368_pinctrl_get_group_name, -+ .get_group_pins = bcm6368_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6368_pmx_ops = { -+ .get_functions_count = bcm6368_pinctrl_get_func_count, -+ .get_function_name = bcm6368_pinctrl_get_func_name, -+ .get_function_groups = bcm6368_pinctrl_get_groups, -+ .set_mux = bcm6368_pinctrl_set_mux, -+ .gpio_request_enable = bcm6368_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6368_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6368_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *mode; -+ struct regmap *basemode; -+ struct reg_field overlay = REG_FIELD(0, 0, 3); -+ -+ if (pdev->dev.of_node) -+ basemode = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, -+ "brcm,gpiobasemode"); -+ else -+ basemode = syscon_regmap_lookup_by_pdevname("syscon.b00000b8"); -+ -+ if (IS_ERR(basemode)) -+ return PTR_ERR(basemode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ pctl->overlay = devm_regmap_field_alloc(&pdev->dev, basemode, overlay); -+ if (IS_ERR(pctl->overlay)) -+ return PTR_ERR(pctl->overlay); -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->mode = mode; -+ -+ /* disable all muxes by default */ -+ __raw_writel(0, pctl->mode); -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6368_pctl_ops; -+ pctl->desc.pmxops = &bcm6368_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6368_pins); -+ pctl->desc.pins = bcm6368_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6368_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6368_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6368-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6368_pinctrl_driver = { -+ .probe = bcm6368_pinctrl_probe, -+ .driver = { -+ .name = "bcm6368-pinctrl", -+ .of_match_table = bcm6368_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6368_pinctrl_driver); diff --git a/target/linux/brcm63xx/patches-4.4/141-Documentation-add-BCM63268-pincontroller-binding-doc.patch b/target/linux/brcm63xx/patches-4.4/141-Documentation-add-BCM63268-pincontroller-binding-doc.patch deleted file mode 100644 index ffe842fd7..000000000 --- a/target/linux/brcm63xx/patches-4.4/141-Documentation-add-BCM63268-pincontroller-binding-doc.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 28cc80e4ada5d73d5305fd268297825cd8d01936 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:37:08 +0200 -Subject: [PATCH 12/16] Documentation: add BCM63268 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in the BCM63268 -family SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm63268-pinctrl.txt | 88 ++++++++++++++++++++++ - 1 file changed, 88 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.txt -@@ -0,0 +1,88 @@ -+* Broadcom BCM63268 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6362-pinctrl". -+- reg: Register specifiers of dirout, dat, led, mode, ctrl, basemode registers. -+- reg-names: Must be "dirout", "dat", "led", "mode", "ctrl", "basemode". -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@100000c0 { -+ compatible = "brcm,bcm63268-pinctrl"; -+ reg = <0x100000c0 0x8>, -+ <0x100000c8 0x8>, -+ <0x100000d0 0x4>, -+ <0x100000d8 0x4>, -+ <0x100000dc 0x4>, -+ <0x100000f8 0x4>; -+ reg-names = "dirout", "dat", "led", "mode", -+ "ctrl", "basemode"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 led, serial_led_clk -+gpio1 1 led, serial_led_data -+gpio2 2 led, -+gpio3 3 led, -+gpio4 4 led, -+gpio5 5 led, -+gpio6 6 led, -+gpio7 7 led, -+gpio8 8 led, hsspi_cs6 -+gpio9 9 led, hsspi_cs7 -+gpio10 10 led, uart1_scts -+gpio11 11 led, uart1_srts -+gpio12 12 led, uart1_sdin -+gpio13 13 led, uart1_sdout -+gpio14 14 led, ntr_pulse_in -+gpio15 15 led, dsl_ntr_pulse_out -+gpio16 16 led, hsspi_cs4 -+gpio17 17 led, hsspi_cs5 -+gpio18 18 led, adsl_spi_miso -+gpio19 19 led, adsl_spi_mosi -+gpio20 20 led, -+gpio21 21 led, -+gpio22 22 led, vreg_clk -+gpio23 23 led, pcie_clkreq_b -+gpio24 24 uart1_scts -+gpio25 25 uart1_srts -+gpio26 26 uart1_sdin -+gpio27 27 uart1_sdout -+gpio28 28 ntr_pulse_in -+gpio29 29 dsl_ntr_pulse_out -+gpio30 30 switch_led_clk -+gpio31 31 switch_led_data -+gpio32 32 wifi -+gpio33 33 wifi -+gpio34 34 wifi -+gpio35 35 wifi -+gpio36 36 wifi -+gpio37 37 wifi -+gpio38 38 wifi -+gpio39 39 wifi -+gpio40 40 wifi -+gpio41 41 wifi -+gpio42 42 wifi -+gpio43 43 wifi -+gpio44 44 wifi -+gpio45 45 wifi -+gpio46 46 wifi -+gpio47 47 wifi -+gpio48 48 wifi -+gpio49 49 wifi -+gpio50 50 wifi -+gpio51 51 wifi -+nand_grp 2-7,24-31 nand -+dect_pd_grp 8-9 dect_pd -+vdsl_phy0_grp 10-11 vdsl_phy0 -+vdsl_phy1_grp 12-13 vdsl_phy1 -+vdsl_phy2_grp 24-25 vdsl_phy2 -+vdsl_phy3_grp 26-27 vdsl_phy3 diff --git a/target/linux/brcm63xx/patches-4.4/142-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch b/target/linux/brcm63xx/patches-4.4/142-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch deleted file mode 100644 index 089d14e3e..000000000 --- a/target/linux/brcm63xx/patches-4.4/142-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch +++ /dev/null @@ -1,736 +0,0 @@ -From 8665d3ea63649cc155286c75f83f694a930580e5 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:19:12 +0200 -Subject: [PATCH 13/16] pinctrl: add a pincontrol driver for BCM63268 - -Add a pincontrol driver for BCM63268. BCM63268 allows muxing GPIOs -to different functions. Depending on the mux, these are either single -pin configurations or whole pin groups. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm63268.c | 710 +++++++++++++++++++++++++++++ - 2 files changed, 711 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm63268.c - ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -4,3 +4,4 @@ obj-$(CONFIG_PINCTRL_BCM6348) += pinctrl - obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o - obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o - obj-$(CONFIG_PINCTRL_BCM6368) += pinctrl-bcm6368.o -+obj-$(CONFIG_PINCTRL_BCM63268) += pinctrl-bcm63268.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm63268.c -@@ -0,0 +1,710 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM63268_NGPIO 52 -+ -+/* GPIO_BASEMODE register */ -+#define BASEMODE_NAND BIT(2) /* GPIOs 2-7, 24-31 */ -+#define BASEMODE_GPIO35 BIT(4) /* GPIO 35 */ -+#define BASEMODE_DECTPD BIT(5) /* GPIOs 8/9 */ -+#define BASEMODE_VDSL_PHY_0 BIT(6) /* GPIOs 10/11 */ -+#define BASEMODE_VDSL_PHY_1 BIT(7) /* GPIOs 12/13 */ -+#define BASEMODE_VDSL_PHY_2 BIT(8) /* GPIOs 24/25 */ -+#define BASEMODE_VDSL_PHY_3 BIT(9) /* GPIOs 26/27 */ -+ -+enum bcm63268_pinctrl_reg { -+ BCM63268_LEDCTRL, -+ BCM63268_MODE, -+ BCM63268_CTRL, -+ BCM63268_BASEMODE, -+}; -+ -+struct bcm63268_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm63268_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ enum bcm63268_pinctrl_reg reg; -+ u32 mask; -+}; -+ -+struct bcm63268_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *led; -+ void __iomem *mode; -+ void __iomem *ctrl; -+ void __iomem *basemode; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM63268_PIN(a, b, basemode) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)(basemode) \ -+ } -+ -+static const struct pinctrl_pin_desc bcm63268_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ BCM63268_PIN(2, "gpio2", BASEMODE_NAND), -+ BCM63268_PIN(3, "gpio3", BASEMODE_NAND), -+ BCM63268_PIN(4, "gpio4", BASEMODE_NAND), -+ BCM63268_PIN(5, "gpio5", BASEMODE_NAND), -+ BCM63268_PIN(6, "gpio6", BASEMODE_NAND), -+ BCM63268_PIN(7, "gpio7", BASEMODE_NAND), -+ BCM63268_PIN(8, "gpio8", BASEMODE_DECTPD), -+ BCM63268_PIN(9, "gpio9", BASEMODE_DECTPD), -+ BCM63268_PIN(10, "gpio10", BASEMODE_VDSL_PHY_0), -+ BCM63268_PIN(11, "gpio11", BASEMODE_VDSL_PHY_0), -+ BCM63268_PIN(12, "gpio12", BASEMODE_VDSL_PHY_1), -+ BCM63268_PIN(13, "gpio13", BASEMODE_VDSL_PHY_1), -+ PINCTRL_PIN(14, "gpio14"), -+ PINCTRL_PIN(15, "gpio15"), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ PINCTRL_PIN(22, "gpio22"), -+ PINCTRL_PIN(23, "gpio23"), -+ BCM63268_PIN(24, "gpio24", BASEMODE_NAND | BASEMODE_VDSL_PHY_2), -+ BCM63268_PIN(25, "gpio25", BASEMODE_NAND | BASEMODE_VDSL_PHY_2), -+ BCM63268_PIN(26, "gpio26", BASEMODE_NAND | BASEMODE_VDSL_PHY_3), -+ BCM63268_PIN(27, "gpio27", BASEMODE_NAND | BASEMODE_VDSL_PHY_3), -+ BCM63268_PIN(28, "gpio28", BASEMODE_NAND), -+ BCM63268_PIN(29, "gpio29", BASEMODE_NAND), -+ BCM63268_PIN(30, "gpio30", BASEMODE_NAND), -+ BCM63268_PIN(31, "gpio31", BASEMODE_NAND), -+ PINCTRL_PIN(32, "gpio32"), -+ PINCTRL_PIN(33, "gpio33"), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+ PINCTRL_PIN(38, "gpio38"), -+ PINCTRL_PIN(39, "gpio39"), -+ PINCTRL_PIN(40, "gpio40"), -+ PINCTRL_PIN(41, "gpio41"), -+ PINCTRL_PIN(42, "gpio42"), -+ PINCTRL_PIN(43, "gpio43"), -+ PINCTRL_PIN(44, "gpio44"), -+ PINCTRL_PIN(45, "gpio45"), -+ PINCTRL_PIN(46, "gpio46"), -+ PINCTRL_PIN(47, "gpio47"), -+ PINCTRL_PIN(48, "gpio48"), -+ PINCTRL_PIN(49, "gpio49"), -+ PINCTRL_PIN(50, "gpio50"), -+ PINCTRL_PIN(51, "gpio51"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+static unsigned gpio32_pins[] = { 32 }; -+static unsigned gpio33_pins[] = { 33 }; -+static unsigned gpio34_pins[] = { 34 }; -+static unsigned gpio35_pins[] = { 35 }; -+static unsigned gpio36_pins[] = { 36 }; -+static unsigned gpio37_pins[] = { 37 }; -+static unsigned gpio38_pins[] = { 38 }; -+static unsigned gpio39_pins[] = { 39 }; -+static unsigned gpio40_pins[] = { 40 }; -+static unsigned gpio41_pins[] = { 41 }; -+static unsigned gpio42_pins[] = { 42 }; -+static unsigned gpio43_pins[] = { 43 }; -+static unsigned gpio44_pins[] = { 44 }; -+static unsigned gpio45_pins[] = { 45 }; -+static unsigned gpio46_pins[] = { 46 }; -+static unsigned gpio47_pins[] = { 47 }; -+static unsigned gpio48_pins[] = { 48 }; -+static unsigned gpio49_pins[] = { 49 }; -+static unsigned gpio50_pins[] = { 50 }; -+static unsigned gpio51_pins[] = { 51 }; -+ -+static unsigned nand_grp_pins[] = { -+ 2, 3, 4, 5, 6, 7, 24, -+ 25, 26, 27, 28, 29, 30, 31, -+}; -+ -+static unsigned dectpd_grp_pins[] = { 8, 9 }; -+static unsigned vdsl_phy0_grp_pins[] = { 10, 11 }; -+static unsigned vdsl_phy1_grp_pins[] = { 12, 13 }; -+static unsigned vdsl_phy2_grp_pins[] = { 24, 25 }; -+static unsigned vdsl_phy3_grp_pins[] = { 26, 27 }; -+ -+#define BCM63268_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm63268_pingroup bcm63268_groups[] = { -+ BCM63268_GROUP(gpio0), -+ BCM63268_GROUP(gpio1), -+ BCM63268_GROUP(gpio2), -+ BCM63268_GROUP(gpio3), -+ BCM63268_GROUP(gpio4), -+ BCM63268_GROUP(gpio5), -+ BCM63268_GROUP(gpio6), -+ BCM63268_GROUP(gpio7), -+ BCM63268_GROUP(gpio8), -+ BCM63268_GROUP(gpio9), -+ BCM63268_GROUP(gpio10), -+ BCM63268_GROUP(gpio11), -+ BCM63268_GROUP(gpio12), -+ BCM63268_GROUP(gpio13), -+ BCM63268_GROUP(gpio14), -+ BCM63268_GROUP(gpio15), -+ BCM63268_GROUP(gpio16), -+ BCM63268_GROUP(gpio17), -+ BCM63268_GROUP(gpio18), -+ BCM63268_GROUP(gpio19), -+ BCM63268_GROUP(gpio20), -+ BCM63268_GROUP(gpio21), -+ BCM63268_GROUP(gpio22), -+ BCM63268_GROUP(gpio23), -+ BCM63268_GROUP(gpio24), -+ BCM63268_GROUP(gpio25), -+ BCM63268_GROUP(gpio26), -+ BCM63268_GROUP(gpio27), -+ BCM63268_GROUP(gpio28), -+ BCM63268_GROUP(gpio29), -+ BCM63268_GROUP(gpio30), -+ BCM63268_GROUP(gpio31), -+ BCM63268_GROUP(gpio32), -+ BCM63268_GROUP(gpio33), -+ BCM63268_GROUP(gpio34), -+ BCM63268_GROUP(gpio35), -+ BCM63268_GROUP(gpio36), -+ BCM63268_GROUP(gpio37), -+ BCM63268_GROUP(gpio38), -+ BCM63268_GROUP(gpio39), -+ BCM63268_GROUP(gpio40), -+ BCM63268_GROUP(gpio41), -+ BCM63268_GROUP(gpio42), -+ BCM63268_GROUP(gpio43), -+ BCM63268_GROUP(gpio44), -+ BCM63268_GROUP(gpio45), -+ BCM63268_GROUP(gpio46), -+ BCM63268_GROUP(gpio47), -+ BCM63268_GROUP(gpio48), -+ BCM63268_GROUP(gpio49), -+ BCM63268_GROUP(gpio50), -+ BCM63268_GROUP(gpio51), -+ -+ /* multi pin groups */ -+ BCM63268_GROUP(nand_grp), -+ BCM63268_GROUP(dectpd_grp), -+ BCM63268_GROUP(vdsl_phy0_grp), -+ BCM63268_GROUP(vdsl_phy1_grp), -+ BCM63268_GROUP(vdsl_phy2_grp), -+ BCM63268_GROUP(vdsl_phy3_grp), -+}; -+ -+static const char * const led_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio0", -+}; -+ -+static const char * const serial_led_data_groups[] = { -+ "gpio1", -+}; -+ -+static const char * const hsspi_cs4_groups[] = { -+ "gpio16", -+}; -+ -+static const char * const hsspi_cs5_groups[] = { -+ "gpio17", -+}; -+ -+static const char * const hsspi_cs6_groups[] = { -+ "gpio8", -+}; -+ -+static const char * const hsspi_cs7_groups[] = { -+ "gpio9", -+}; -+ -+static const char * const uart1_scts_groups[] = { -+ "gpio10", -+ "gpio24", -+}; -+ -+static const char * const uart1_srts_groups[] = { -+ "gpio11", -+ "gpio25", -+}; -+ -+static const char * const uart1_sdin_groups[] = { -+ "gpio12", -+ "gpio26", -+}; -+ -+static const char * const uart1_sdout_groups[] = { -+ "gpio13", -+ "gpio27", -+}; -+ -+static const char * const ntr_pulse_in_groups[] = { -+ "gpio14", -+ "gpio28", -+}; -+ -+static const char * const dsl_ntr_pulse_out_groups[] = { -+ "gpio15", -+ "gpio29", -+}; -+ -+static const char * const adsl_spi_miso_groups[] = { -+ "gpio18", -+}; -+ -+static const char * const adsl_spi_mosi_groups[] = { -+ "gpio19", -+}; -+ -+static const char * const vreg_clk_groups[] = { -+ "gpio22", -+}; -+ -+static const char * const pcie_clkreq_b_groups[] = { -+ "gpio23", -+}; -+ -+static const char * const switch_led_clk_groups[] = { -+ "gpio30", -+}; -+ -+static const char * const switch_led_data_groups[] = { -+ "gpio31", -+}; -+ -+static const char * const wifi_groups[] = { -+ "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35", -+ "gpio36", -+ "gpio37", -+ "gpio38", -+ "gpio39", -+ "gpio40", -+ "gpio41", -+ "gpio42", -+ "gpio43", -+ "gpio44", -+ "gpio45", -+ "gpio46", -+ "gpio47", -+ "gpio48", -+ "gpio49", -+ "gpio50", -+ "gpio51", -+}; -+ -+static const char * const nand_groups[] = { -+ "nand_grp", -+}; -+ -+static const char * const dectpd_groups[] = { -+ "dectpd_grp", -+}; -+ -+static const char * const vdsl_phy_override_0_groups[] = { -+ "vdsl_phy_override_0_grp", -+}; -+ -+static const char * const vdsl_phy_override_1_groups[] = { -+ "vdsl_phy_override_1_grp", -+}; -+ -+static const char * const vdsl_phy_override_2_groups[] = { -+ "vdsl_phy_override_2_grp", -+}; -+ -+static const char * const vdsl_phy_override_3_groups[] = { -+ "vdsl_phy_override_3_grp", -+}; -+ -+#define BCM63268_LED_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_LEDCTRL, \ -+ } -+ -+#define BCM63268_MODE_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_MODE, \ -+ } -+ -+#define BCM63268_CTRL_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_CTRL, \ -+ } -+ -+#define BCM63268_BASEMODE_FUN(n, val) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_BASEMODE, \ -+ .mask = val, \ -+ } -+ -+static const struct bcm63268_function bcm63268_funcs[] = { -+ BCM63268_LED_FUN(led), -+ BCM63268_MODE_FUN(serial_led_clk), -+ BCM63268_MODE_FUN(serial_led_data), -+ BCM63268_MODE_FUN(hsspi_cs6), -+ BCM63268_MODE_FUN(hsspi_cs7), -+ BCM63268_MODE_FUN(uart1_scts), -+ BCM63268_MODE_FUN(uart1_srts), -+ BCM63268_MODE_FUN(uart1_sdin), -+ BCM63268_MODE_FUN(uart1_sdout), -+ BCM63268_MODE_FUN(ntr_pulse_in), -+ BCM63268_MODE_FUN(dsl_ntr_pulse_out), -+ BCM63268_MODE_FUN(hsspi_cs4), -+ BCM63268_MODE_FUN(hsspi_cs5), -+ BCM63268_MODE_FUN(adsl_spi_miso), -+ BCM63268_MODE_FUN(adsl_spi_mosi), -+ BCM63268_MODE_FUN(vreg_clk), -+ BCM63268_MODE_FUN(pcie_clkreq_b), -+ BCM63268_MODE_FUN(switch_led_clk), -+ BCM63268_MODE_FUN(switch_led_data), -+ BCM63268_CTRL_FUN(wifi), -+ BCM63268_BASEMODE_FUN(nand, BASEMODE_NAND), -+ BCM63268_BASEMODE_FUN(dectpd, BASEMODE_DECTPD), -+ BCM63268_BASEMODE_FUN(vdsl_phy_override_0, BASEMODE_VDSL_PHY_0), -+ BCM63268_BASEMODE_FUN(vdsl_phy_override_1, BASEMODE_VDSL_PHY_1), -+ BCM63268_BASEMODE_FUN(vdsl_phy_override_2, BASEMODE_VDSL_PHY_2), -+ BCM63268_BASEMODE_FUN(vdsl_phy_override_3, BASEMODE_VDSL_PHY_3), -+}; -+ -+static int bcm63268_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm63268_groups); -+} -+ -+static const char *bcm63268_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm63268_groups[group].name; -+} -+ -+static int bcm63268_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, -+ const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm63268_groups[group].pins; -+ *num_pins = bcm63268_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm63268_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm63268_funcs); -+} -+ -+static const char *bcm63268_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm63268_funcs[selector].name; -+} -+ -+static int bcm63268_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm63268_funcs[selector].groups; -+ *num_groups = bcm63268_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm63268_rmw_mux(struct bcm63268_pinctrl *pctl, void __iomem *reg, -+ u32 mask, u32 val) -+{ -+ unsigned long flags; -+ u32 tmp; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ tmp = __raw_readl(reg); -+ tmp &= ~mask; -+ tmp |= val; -+ __raw_writel(tmp, reg); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static void bcm63268_set_gpio(struct bcm63268_pinctrl *pctl, unsigned pin) -+{ -+ const struct pinctrl_pin_desc *desc = &bcm63268_pins[pin]; -+ u32 basemode = (unsigned long)desc->drv_data; -+ u32 mask = BIT(pin % 32); -+ -+ if (basemode) -+ bcm63268_rmw_mux(pctl, pctl->basemode, basemode, 0); -+ -+ if (pin < 32) { -+ /* base mode: 0 => gpio, 1 => mux function */ -+ bcm63268_rmw_mux(pctl, pctl->mode, mask, 0); -+ -+ /* pins 0-23 might be muxed to led */ -+ if (pin < 24) -+ bcm63268_rmw_mux(pctl, pctl->led, mask, 0); -+ } else if (pin < 52) { -+ /* ctrl reg: 0 => wifi function, 1 => gpio */ -+ bcm63268_rmw_mux(pctl, pctl->ctrl, mask, mask); -+ } -+} -+ -+static int bcm63268_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm63268_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm63268_pingroup *grp = &bcm63268_groups[group]; -+ const struct bcm63268_function *f = &bcm63268_funcs[selector]; -+ unsigned i; -+ void __iomem *reg; -+ u32 val, mask; -+ -+ for (i = 0; i < grp->num_pins; i++) -+ bcm63268_set_gpio(pctl, grp->pins[i]); -+ -+ switch (f->reg) { -+ case BCM63268_LEDCTRL: -+ reg = pctl->led; -+ mask = BIT(grp->pins[0]); -+ val = BIT(grp->pins[0]); -+ break; -+ case BCM63268_MODE: -+ reg = pctl->mode; -+ mask = BIT(grp->pins[0]); -+ val = BIT(grp->pins[0]); -+ break; -+ case BCM63268_CTRL: -+ reg = pctl->ctrl; -+ mask = BIT(grp->pins[0]); -+ val = 0; -+ break; -+ case BCM63268_BASEMODE: -+ reg = pctl->basemode; -+ mask = f->mask; -+ val = f->mask; -+ break; -+ default: -+ WARN_ON(1); -+ return -EINVAL; -+ } -+ -+ bcm63268_rmw_mux(pctl, reg, mask, val); -+ -+ return 0; -+} -+ -+static int bcm63268_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm63268_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable all functions using this pin */ -+ bcm63268_set_gpio(pctl, offset); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm63268_pctl_ops = { -+ .get_groups_count = bcm63268_pinctrl_get_group_count, -+ .get_group_name = bcm63268_pinctrl_get_group_name, -+ .get_group_pins = bcm63268_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm63268_pmx_ops = { -+ .get_functions_count = bcm63268_pinctrl_get_func_count, -+ .get_function_name = bcm63268_pinctrl_get_func_name, -+ .get_function_groups = bcm63268_pinctrl_get_groups, -+ .set_mux = bcm63268_pinctrl_set_mux, -+ .gpio_request_enable = bcm63268_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm63268_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm63268_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *led, *mode, *ctrl, *basemode; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "led"); -+ led = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(led)) -+ return PTR_ERR(led); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); -+ ctrl = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(ctrl)) -+ return PTR_ERR(ctrl); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "basemode"); -+ basemode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(basemode)) -+ return PTR_ERR(basemode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->led = led; -+ pctl->mode = mode; -+ pctl->ctrl = ctrl; -+ pctl->basemode = basemode; -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm63268_pctl_ops; -+ pctl->desc.pmxops = &bcm63268_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm63268_pins); -+ pctl->desc.pins = bcm63268_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM63268_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm63268_pinctrl_match[] = { -+ { .compatible = "brcm,bcm63268-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm63268_pinctrl_driver = { -+ .probe = bcm63268_pinctrl_probe, -+ .driver = { -+ .name = "bcm63268-pinctrl", -+ .of_match_table = bcm63268_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm63268_pinctrl_driver); diff --git a/target/linux/brcm63xx/patches-4.4/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch b/target/linux/brcm63xx/patches-4.4/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch deleted file mode 100644 index f2490cb62..000000000 --- a/target/linux/brcm63xx/patches-4.4/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 6ac09efa8f0e189ffe7dd7b0889289de56ee44cc Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 19 Jan 2014 12:18:03 +0100 -Subject: [PATCH] USB: EHCI: allow limiting ports for ehci-platform - -In the same way as the ohci platform driver allows limiting ports, -enable the same for ehci. This prevents a mismatch in the available -ports between ehci/ohci on USB 2.0 controllers. - -This is needed if the USB host controller always reports the maximum -number of ports regardless of the number of available ports (because -one might be set to be usb device). - -Signed-off-by: Jonas Gorski ---- - drivers/usb/host/ehci-hcd.c | 4 ++++ - drivers/usb/host/ehci-platform.c | 2 ++ - drivers/usb/host/ehci.h | 1 + - include/linux/usb/ehci_pdriver.h | 1 + - 4 files changed, 8 insertions(+) - ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -666,6 +666,10 @@ int ehci_setup(struct usb_hcd *hcd) - - /* cache this readonly data; minimize chip reads */ - ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); -+ if (ehci->num_ports) { -+ ehci->hcs_params &= ~0xf; /* bits 3:0, ports on HC */ -+ ehci->hcs_params |= ehci->num_ports; -+ } - - ehci->sbrn = HCD_USB2; - ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -60,6 +60,9 @@ static int ehci_platform_reset(struct us - - ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug; - -+ if (pdata->num_ports && pdata->num_ports <= 15) -+ ehci->num_ports = pdata->num_ports; -+ - if (pdata->pre_setup) { - retval = pdata->pre_setup(hcd); - if (retval < 0) ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -213,6 +213,7 @@ struct ehci_hcd { /* one per controlle - u32 command; - - /* SILICON QUIRKS */ -+ unsigned int num_ports; - unsigned no_selective_suspend:1; - unsigned has_fsl_port_bug:1; /* FreeScale */ - unsigned has_fsl_hs_errata:1; /* Freescale HS quirk */ ---- a/include/linux/usb/ehci_pdriver.h -+++ b/include/linux/usb/ehci_pdriver.h -@@ -42,6 +42,7 @@ struct usb_hcd; - */ - struct usb_ehci_pdata { - int caps_offset; -+ unsigned int num_ports; - unsigned has_tt:1; - unsigned has_synopsys_hc_bug:1; - unsigned big_endian_desc:1; diff --git a/target/linux/brcm63xx/patches-4.4/207-MIPS-BCM63XX-move-device-registration-code-into-its-.patch b/target/linux/brcm63xx/patches-4.4/207-MIPS-BCM63XX-move-device-registration-code-into-its-.patch deleted file mode 100644 index f2b2847e6..000000000 --- a/target/linux/brcm63xx/patches-4.4/207-MIPS-BCM63XX-move-device-registration-code-into-its-.patch +++ /dev/null @@ -1,492 +0,0 @@ -From 5a50cb0d53344a2429831b00925d6183d4d332e1 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 9 Mar 2014 03:54:05 +0100 -Subject: [PATCH 40/44] MIPS: BCM63XX: move device registration code into its - own file - -Move device registration code into its own file to allow sharing it -between board implementations. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/Makefile | 1 + - arch/mips/bcm63xx/boards/board_bcm963xx.c | 188 +------------------------- - arch/mips/bcm63xx/boards/board_common.c | 215 ++++++++++++++++++++++++++++++ - arch/mips/bcm63xx/boards/board_common.h | 8 ++ - 4 files changed, 223 insertions(+), 183 deletions(-) - create mode 100644 arch/mips/bcm63xx/boards/board_common.c - create mode 100644 arch/mips/bcm63xx/boards/board_common.h - ---- a/arch/mips/bcm63xx/boards/Makefile -+++ b/arch/mips/bcm63xx/boards/Makefile -@@ -1 +1,2 @@ -+obj-y += board_common.o - obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -12,34 +12,21 @@ - #include - #include - #include --#include --#include - #include - #include - #include --#include - #include - #include - #include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include - #include - -+#include "board_common.h" -+ - #include - - - #define HCS_OFFSET_128K 0x20000 - --static struct board_info board; -- - /* - * known 3368 boards - */ -@@ -712,52 +699,6 @@ static const struct board_info __initcon - }; - - /* -- * Register a sane SPROMv2 to make the on-board -- * bcm4318 WLAN work -- */ --#ifdef CONFIG_SSB_PCIHOST --static struct ssb_sprom bcm63xx_sprom = { -- .revision = 0x02, -- .board_rev = 0x17, -- .country_code = 0x0, -- .ant_available_bg = 0x3, -- .pa0b0 = 0x15ae, -- .pa0b1 = 0xfa85, -- .pa0b2 = 0xfe8d, -- .pa1b0 = 0xffff, -- .pa1b1 = 0xffff, -- .pa1b2 = 0xffff, -- .gpio0 = 0xff, -- .gpio1 = 0xff, -- .gpio2 = 0xff, -- .gpio3 = 0xff, -- .maxpwr_bg = 0x004c, -- .itssi_bg = 0x00, -- .boardflags_lo = 0x2848, -- .boardflags_hi = 0x0000, --}; -- --int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) --{ -- if (bus->bustype == SSB_BUSTYPE_PCI) { -- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -- return 0; -- } else { -- pr_err("unable to fill SPROM for given bustype\n"); -- return -EINVAL; -- } --} --#endif -- --/* -- * return board name for /proc/cpuinfo -- */ --const char *board_get_name(void) --{ -- return board.name; --} -- --/* - * early init callback, read nvram data from flash and checksum it - */ - void __init board_prom_init(void) -@@ -802,140 +743,15 @@ void __init board_prom_init(void) - if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) - continue; - /* copy, board desc array is marked initdata */ -- memcpy(&board, bcm963xx_boards[i], sizeof(board)); -+ board_early_setup(bcm963xx_boards[i]); - break; - } - -- /* bail out if board is not found, will complain later */ -- if (!board.name[0]) { -+ /* warn if board is not found, will complain later */ -+ if (i == ARRAY_SIZE(bcm963xx_boards)) { - char name[17]; - memcpy(name, board_name, 16); - name[16] = 0; - pr_err("unknown bcm963xx board: %s\n", name); -- return; -- } -- -- /* setup pin multiplexing depending on board enabled device, -- * this has to be done this early since PCI init is done -- * inside arch_initcall */ -- val = 0; -- --#ifdef CONFIG_PCI -- if (board.has_pci) { -- bcm63xx_pci_enabled = 1; -- if (BCMCPU_IS_6348()) -- val |= GPIO_MODE_6348_G2_PCI; -- } --#endif -- -- if (board.has_pccard) { -- if (BCMCPU_IS_6348()) -- val |= GPIO_MODE_6348_G1_MII_PCCARD; -- } -- -- if (board.has_enet0 && !board.enet0.use_internal_phy) { -- if (BCMCPU_IS_6348()) -- val |= GPIO_MODE_6348_G3_EXT_MII | -- GPIO_MODE_6348_G0_EXT_MII; -- } -- -- if (board.has_enet1 && !board.enet1.use_internal_phy) { -- if (BCMCPU_IS_6348()) -- val |= GPIO_MODE_6348_G3_EXT_MII | -- GPIO_MODE_6348_G0_EXT_MII; -- } -- -- bcm_gpio_writel(val, GPIO_MODE_REG); --} -- --/* -- * second stage init callback, good time to panic if we couldn't -- * identify on which board we're running since early printk is working -- */ --void __init board_setup(void) --{ -- if (!board.name[0]) -- panic("unable to detect bcm963xx board"); -- pr_info("board name: %s\n", board.name); -- -- /* make sure we're running on expected cpu */ -- if (bcm63xx_get_cpu_id() != board.expected_cpu_id) -- panic("unexpected CPU for bcm963xx board"); --} -- --static struct gpio_led_platform_data bcm63xx_led_data; -- --static struct platform_device bcm63xx_gpio_leds = { -- .name = "leds-gpio", -- .id = 0, -- .dev.platform_data = &bcm63xx_led_data, --}; -- --/* -- * third stage init callback, register all board devices. -- */ --int __init board_register_devices(void) --{ -- if (board.has_uart0) -- bcm63xx_uart_register(0); -- -- if (board.has_uart1) -- bcm63xx_uart_register(1); -- -- if (board.has_pccard) -- bcm63xx_pcmcia_register(); -- -- if (board.has_enet0 && -- !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr)) -- bcm63xx_enet_register(0, &board.enet0); -- -- if (board.has_enet1 && -- !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) -- bcm63xx_enet_register(1, &board.enet1); -- -- if (board.has_enetsw && -- !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr)) -- bcm63xx_enetsw_register(&board.enetsw); -- -- if (board.has_usbd) -- bcm63xx_usbd_register(&board.usbd); -- -- if (board.has_ehci0) -- bcm63xx_ehci_register(); -- -- if (board.has_ohci0) -- bcm63xx_ohci_register(); -- -- if (board.has_dsp) -- bcm63xx_dsp_register(&board.dsp); -- -- /* Generate MAC address for WLAN and register our SPROM, -- * do this after registering enet devices -- */ --#ifdef CONFIG_SSB_PCIHOST -- if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) { -- memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); -- memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); -- if (ssb_arch_register_fallback_sprom( -- &bcm63xx_get_fallback_sprom) < 0) -- pr_err("failed to register fallback SPROM\n"); - } --#endif -- -- bcm63xx_spi_register(); -- -- bcm63xx_hsspi_register(); -- -- bcm63xx_flash_register(); -- -- bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); -- bcm63xx_led_data.leds = board.leds; -- -- platform_device_register(&bcm63xx_gpio_leds); -- -- if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) -- gpio_request_one(board.ephy_reset_gpio, -- board.ephy_reset_gpio_flags, "ephy-reset"); -- -- return 0; - } ---- /dev/null -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -0,0 +1,218 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2008 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define PFX "board: " -+ -+static struct board_info board; -+ -+/* -+ * Register a sane SPROMv2 to make the on-board -+ * bcm4318 WLAN work -+ */ -+#ifdef CONFIG_SSB_PCIHOST -+static struct ssb_sprom bcm63xx_sprom = { -+ .revision = 0x02, -+ .board_rev = 0x17, -+ .country_code = 0x0, -+ .ant_available_bg = 0x3, -+ .pa0b0 = 0x15ae, -+ .pa0b1 = 0xfa85, -+ .pa0b2 = 0xfe8d, -+ .pa1b0 = 0xffff, -+ .pa1b1 = 0xffff, -+ .pa1b2 = 0xffff, -+ .gpio0 = 0xff, -+ .gpio1 = 0xff, -+ .gpio2 = 0xff, -+ .gpio3 = 0xff, -+ .maxpwr_bg = 0x004c, -+ .itssi_bg = 0x00, -+ .boardflags_lo = 0x2848, -+ .boardflags_hi = 0x0000, -+}; -+ -+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -+{ -+ if (bus->bustype == SSB_BUSTYPE_PCI) { -+ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ return 0; -+ } else { -+ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -+ return -EINVAL; -+ } -+} -+#endif -+ -+/* -+ * return board name for /proc/cpuinfo -+ */ -+const char *board_get_name(void) -+{ -+ return board.name; -+} -+ -+/* -+ * setup board for device registration -+ */ -+void __init board_early_setup(const struct board_info *target) -+{ -+ u32 val; -+ -+ memcpy(&board, target, sizeof(board)); -+ -+ /* setup pin multiplexing depending on board enabled device, -+ * this has to be done this early since PCI init is done -+ * inside arch_initcall */ -+ val = 0; -+ -+#ifdef CONFIG_PCI -+ if (board.has_pci) { -+ bcm63xx_pci_enabled = 1; -+ if (BCMCPU_IS_6348()) -+ val |= GPIO_MODE_6348_G2_PCI; -+ } -+#endif -+ -+ if (board.has_pccard) { -+ if (BCMCPU_IS_6348()) -+ val |= GPIO_MODE_6348_G1_MII_PCCARD; -+ } -+ -+ if (board.has_enet0 && !board.enet0.use_internal_phy) { -+ if (BCMCPU_IS_6348()) -+ val |= GPIO_MODE_6348_G3_EXT_MII | -+ GPIO_MODE_6348_G0_EXT_MII; -+ } -+ -+ if (board.has_enet1 && !board.enet1.use_internal_phy) { -+ if (BCMCPU_IS_6348()) -+ val |= GPIO_MODE_6348_G3_EXT_MII | -+ GPIO_MODE_6348_G0_EXT_MII; -+ } -+ -+ bcm_gpio_writel(val, GPIO_MODE_REG); -+} -+ -+ -+/* -+ * second stage init callback, good time to panic if we couldn't -+ * identify on which board we're running since early printk is working -+ */ -+void __init board_setup(void) -+{ -+ if (!board.name[0]) -+ panic("unable to detect bcm963xx board"); -+ printk(KERN_INFO PFX "board name: %s\n", board.name); -+ -+ /* make sure we're running on expected cpu */ -+ if (bcm63xx_get_cpu_id() != board.expected_cpu_id) -+ panic("unexpected CPU for bcm963xx board"); -+} -+ -+static struct gpio_led_platform_data bcm63xx_led_data; -+ -+static struct platform_device bcm63xx_gpio_leds = { -+ .name = "leds-gpio", -+ .id = 0, -+ .dev.platform_data = &bcm63xx_led_data, -+}; -+ -+/* -+ * third stage init callback, register all board devices. -+ */ -+int __init board_register_devices(void) -+{ -+ if (board.has_uart0) -+ bcm63xx_uart_register(0); -+ -+ if (board.has_uart1) -+ bcm63xx_uart_register(1); -+ -+ if (board.has_pccard) -+ bcm63xx_pcmcia_register(); -+ -+ if (board.has_enet0 && -+ !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr)) -+ bcm63xx_enet_register(0, &board.enet0); -+ -+ if (board.has_enet1 && -+ !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) -+ bcm63xx_enet_register(1, &board.enet1); -+ -+ if (board.has_enetsw && -+ !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr)) -+ bcm63xx_enetsw_register(&board.enetsw); -+ -+ if (board.has_usbd) -+ bcm63xx_usbd_register(&board.usbd); -+ -+ if (board.has_ehci0) -+ bcm63xx_ehci_register(); -+ -+ if (board.has_ohci0) -+ bcm63xx_ohci_register(); -+ -+ if (board.has_dsp) -+ bcm63xx_dsp_register(&board.dsp); -+ -+ /* Generate MAC address for WLAN and register our SPROM, -+ * do this after registering enet devices -+ */ -+#ifdef CONFIG_SSB_PCIHOST -+ if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) { -+ memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); -+ if (ssb_arch_register_fallback_sprom( -+ &bcm63xx_get_fallback_sprom) < 0) -+ pr_err(PFX "failed to register fallback SPROM\n"); -+ } -+#endif -+ -+ bcm63xx_spi_register(); -+ -+ bcm63xx_hsspi_register(); -+ -+ bcm63xx_flash_register(); -+ -+ bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); -+ bcm63xx_led_data.leds = board.leds; -+ -+ platform_device_register(&bcm63xx_gpio_leds); -+ -+ if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) -+ gpio_request_one(board.ephy_reset_gpio, -+ board.ephy_reset_gpio_flags, "ephy-reset"); -+ -+ return 0; -+} ---- /dev/null -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -0,0 +1,8 @@ -+#ifndef __BOARD_COMMON_H -+#define __BOARD_COMMON_H -+ -+#include -+ -+void board_early_setup(const struct board_info *board); -+ -+#endif /* __BOARD_COMMON_H */ diff --git a/target/linux/brcm63xx/patches-4.4/208-MIPS-BCM63XX-pass-a-mac-addresss-allocator-to-board-.patch b/target/linux/brcm63xx/patches-4.4/208-MIPS-BCM63XX-pass-a-mac-addresss-allocator-to-board-.patch deleted file mode 100644 index f94ce7029..000000000 --- a/target/linux/brcm63xx/patches-4.4/208-MIPS-BCM63XX-pass-a-mac-addresss-allocator-to-board-.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 4e9c34a37bd3442b286ba55441bfe22c1ac5b65f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 9 Mar 2014 04:08:06 +0100 -Subject: [PATCH 41/44] MIPS: BCM63XX: pass a mac addresss allocator to board - setup - -Pass a mac address allocator to board setup code to allow board -implementations to work with third party bootloaders not using nvram -for configuration storage. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 3 ++- - arch/mips/bcm63xx/boards/board_common.c | 16 ++++++++++------ - arch/mips/bcm63xx/boards/board_common.h | 3 ++- - 3 files changed, 14 insertions(+), 8 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -743,7 +743,8 @@ void __init board_prom_init(void) - if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) - continue; - /* copy, board desc array is marked initdata */ -- board_early_setup(bcm963xx_boards[i]); -+ board_early_setup(bcm963xx_boards[i], -+ bcm63xx_nvram_get_mac_address); - break; - } - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -18,7 +18,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -82,15 +81,20 @@ const char *board_get_name(void) - return board.name; - } - -+static int (*board_get_mac_address)(u8 mac[ETH_ALEN]); -+ - /* - * setup board for device registration - */ --void __init board_early_setup(const struct board_info *target) -+void __init board_early_setup(const struct board_info *target, -+ int (*get_mac_address)(u8 mac[ETH_ALEN])) - { - u32 val; - - memcpy(&board, target, sizeof(board)); - -+ board_get_mac_address = get_mac_address; -+ - /* setup pin multiplexing depending on board enabled device, - * this has to be done this early since PCI init is done - * inside arch_initcall */ -@@ -163,15 +167,15 @@ int __init board_register_devices(void) - bcm63xx_pcmcia_register(); - - if (board.has_enet0 && -- !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr)) -+ !board_get_mac_address(board.enet0.mac_addr)) - bcm63xx_enet_register(0, &board.enet0); - - if (board.has_enet1 && -- !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) -+ !board_get_mac_address(board.enet1.mac_addr)) - bcm63xx_enet_register(1, &board.enet1); - - if (board.has_enetsw && -- !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr)) -+ !board_get_mac_address(board.enetsw.mac_addr)) - bcm63xx_enetsw_register(&board.enetsw); - - if (board.has_usbd) -@@ -190,7 +194,7 @@ int __init board_register_devices(void) - * do this after registering enet devices - */ - #ifdef CONFIG_SSB_PCIHOST -- if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) { -+ if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { - memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); - memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); - if (ssb_arch_register_fallback_sprom( ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -3,6 +3,7 @@ - - #include - --void board_early_setup(const struct board_info *board); -+void board_early_setup(const struct board_info *board, -+ int (*get_mac_address)(u8 mac[ETH_ALEN])); - - #endif /* __BOARD_COMMON_H */ diff --git a/target/linux/brcm63xx/patches-4.4/309-cfe_version_mod.patch b/target/linux/brcm63xx/patches-4.4/309-cfe_version_mod.patch deleted file mode 100644 index 3421ac3eb..000000000 --- a/target/linux/brcm63xx/patches-4.4/309-cfe_version_mod.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -723,10 +723,20 @@ void __init board_prom_init(void) - - /* dump cfe version */ - cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET; -- if (!memcmp(cfe, "cfe-v", 5)) -- snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u", -- cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]); -- else -+ if (strstarts(cfe, "cfe-")) { -+ if(cfe[4] == 'v') { -+ if(cfe[5] == 'd') -+ snprintf(cfe_version, 11, "%s", (char *) &cfe[5]); -+ else if (cfe[10] > 0) -+ snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u-%u", -+ cfe[5], cfe[6], cfe[7], cfe[8], cfe[9], cfe[10]); -+ else -+ snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u", -+ cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]); -+ } else { -+ snprintf(cfe_version, 12, "%s", (char *) &cfe[4]); -+ } -+ } else - strcpy(cfe_version, "unknown"); - pr_info("CFE version: %s\n", cfe_version); - diff --git a/target/linux/brcm63xx/patches-4.4/310-cfe_simplify_detection.patch b/target/linux/brcm63xx/patches-4.4/310-cfe_simplify_detection.patch deleted file mode 100644 index e05c91d93..000000000 --- a/target/linux/brcm63xx/patches-4.4/310-cfe_simplify_detection.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h -@@ -1,6 +1,8 @@ - #ifndef BCM63XX_BOARD_H_ - #define BCM63XX_BOARD_H_ - -+#include -+ - const char *board_get_name(void); - - void board_prom_init(void); -@@ -9,4 +11,8 @@ void board_setup(void); - - int board_register_devices(void); - -+static inline bool bcm63xx_is_cfe_present(void) { -+ return fw_arg3 == 0x43464531; -+} -+ - #endif /* ! BCM63XX_BOARD_H_ */ diff --git a/target/linux/brcm63xx/patches-4.4/311-bcm63xxpart_use_cfedetection.patch b/target/linux/brcm63xx/patches-4.4/311-bcm63xxpart_use_cfedetection.patch deleted file mode 100644 index 46d9b47cd..000000000 --- a/target/linux/brcm63xx/patches-4.4/311-bcm63xxpart_use_cfedetection.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/drivers/mtd/bcm63xxpart.c -+++ b/drivers/mtd/bcm63xxpart.c -@@ -35,7 +35,7 @@ - - #include - #include --#include -+#include - - #define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */ - -@@ -43,30 +43,6 @@ - - #define BCM63XX_CFE_MAGIC_OFFSET 0x4e0 - --static int bcm63xx_detect_cfe(struct mtd_info *master) --{ -- char buf[9]; -- int ret; -- size_t retlen; -- -- ret = mtd_read(master, BCM963XX_CFE_VERSION_OFFSET, 5, &retlen, -- (void *)buf); -- buf[retlen] = 0; -- -- if (ret) -- return ret; -- -- if (strncmp("cfe-v", buf, 5) == 0) -- return 0; -- -- /* very old CFE's do not have the cfe-v string, so check for magic */ -- ret = mtd_read(master, BCM63XX_CFE_MAGIC_OFFSET, 8, &retlen, -- (void *)buf); -- buf[retlen] = 0; -- -- return strncmp("CFE1CFE1", buf, 8); --} -- - static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, - struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -@@ -85,7 +61,7 @@ static int bcm63xx_parse_cfe_partitions( - u32 computed_crc; - bool rootfs_first = false; - -- if (bcm63xx_detect_cfe(master)) -+ if (!bcm63xx_is_cfe_present()) - return -EINVAL; - - cfe_erasesize = max_t(uint32_t, master->erasesize, diff --git a/target/linux/brcm63xx/patches-4.4/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch b/target/linux/brcm63xx/patches-4.4/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch deleted file mode 100644 index 11a815a20..000000000 --- a/target/linux/brcm63xx/patches-4.4/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch +++ /dev/null @@ -1,455 +0,0 @@ -From 301744ecbeece89ab3a9d6beef7802fa22598f00 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 30 Nov 2014 14:53:12 +0100 -Subject: [PATCH 1/5] irqchip: add support for bcm6345-style periphery irq - controller - -Signed-off-by: Jonas Gorski ---- - .../brcm,bcm6345-periph-intc.txt | 50 +++ - drivers/irqchip/Kconfig | 4 + - drivers/irqchip/Makefile | 1 + - drivers/irqchip/irq-bcm6345-periph.c | 339 ++++++++++++++++++++ - include/linux/irqchip/irq-bcm6345-periph.h | 16 + - 5 files changed, 410 insertions(+) - create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-periph-intc.txt - create mode 100644 drivers/irqchip/irq-bcm6345-periph.c - create mode 100644 include/linux/irqchip/irq-bcm6345-periph.h - ---- /dev/null -+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-periph-intc.txt -@@ -0,0 +1,50 @@ -+Broadcom BCM6345 Level 1 periphery interrupt controller -+ -+This block is a interrupt controller that is typically connected directly -+to one of the HW INT lines on each CPU. Every BCM63XX xDSL chip since -+BCM6345 has contained this hardware. -+ -+Key elements of the hardware design include: -+ -+- 32, 64, or 128 incoming level IRQ lines -+ -+- All onchip peripherals are wired directly to an L2 input -+ -+- A separate instance of the register set for each CPU, allowing individual -+ peripheral IRQs to be routed to any CPU -+ -+- No atomic mask/unmask operations -+ -+- No polarity/level/edge settings -+ -+- No FIFO or priority encoder logic; software is expected to read all -+ 1-4 status words to determine which IRQs are pending -+ -+Required properties: -+ -+- compatible: Should be "brcm,bcm6345-periph-intc". -+- reg: Specifies the base physical address and size of the registers. -+ Multiple register addresses may be specified, and must match the amount of -+ parent interrupts. -+- interrupt-controller: Identifies the node as an interrupt controller. -+- #interrupt-cells: Specifies the number of cells needed to encode an interrupt -+ source, should be 1. -+- interrupt-parent: Specifies the phandle to the parent interrupt controller -+ this one is cascaded from. -+- interrupts: Specifies the interrupt line(s) in the interrupt-parent controller -+ node, valid values depend on the type of parent interrupt controller. -+ Multiple lines are used to route interrupts to different cpus, with the first -+ assumed to be for the boot CPU. -+ -+Example: -+ -+periph_intc: interrupt-controller@f0406800 { -+ compatible = "brcm,bcm6345-periph-intc"; -+ reg = <0x10000020 0x10>, <0x10000030 0x10>; -+ -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ -+ interrupt-parent = <&cpu_intc>; -+ interrupts = <2>, <3>; -+}; ---- a/drivers/irqchip/Kconfig -+++ b/drivers/irqchip/Kconfig -@@ -80,6 +80,10 @@ config BRCMSTB_L2_IRQ - select GENERIC_IRQ_CHIP - select IRQ_DOMAIN - -+config BCM6345_PERIPH_IRQ -+ bool -+ select IRQ_DOMAIN -+ - config DW_APB_ICTL - bool - select GENERIC_IRQ_CHIP ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -9,6 +9,7 @@ obj-$(CONFIG_ARCH_MVEBU) += irq-armada- - obj-$(CONFIG_IRQ_MXS) += irq-mxs.o - obj-$(CONFIG_ARCH_TEGRA) += irq-tegra.o - obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o -+obj-$(CONFIG_BCM6345_PERIPH_IRQ) += irq-bcm6345-periph.o - obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o - obj-$(CONFIG_METAG) += irq-metag-ext.o - obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o ---- /dev/null -+++ b/drivers/irqchip/irq-bcm6345-periph.c -@@ -0,0 +1,339 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2014 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_BCM63XX -+#include -+ -+#define VIRQ_BASE IRQ_INTERNAL_BASE -+#else -+#define VIRQ_BASE 0 -+#endif -+ -+#define MAX_WORDS 4 -+#define MAX_PARENT_IRQS 2 -+#define IRQS_PER_WORD 32 -+ -+struct intc_block { -+ int parent_irq; -+ void __iomem *base; -+ void __iomem *en_reg[MAX_WORDS]; -+ void __iomem *status_reg[MAX_WORDS]; -+ u32 mask_cache[MAX_WORDS]; -+}; -+ -+struct intc_data { -+ struct irq_chip chip; -+ struct intc_block block[MAX_PARENT_IRQS]; -+ -+ int num_words; -+ -+ struct irq_domain *domain; -+ raw_spinlock_t lock; -+}; -+ -+static void bcm6345_periph_irq_handle(struct irq_desc *desc) -+{ -+ struct intc_data *data = irq_desc_get_handler_data(desc); -+ struct irq_chip *chip = irq_desc_get_chip(desc); -+ struct intc_block *block; -+ unsigned int irq = irq_desc_get_irq(desc); -+ unsigned int idx; -+ -+ chained_irq_enter(chip, desc); -+ -+ for (idx = 0; idx < MAX_PARENT_IRQS; idx++) -+ if (irq == data->block[idx].parent_irq) -+ block = &data->block[idx]; -+ -+ for (idx = 0; idx < data->num_words; idx++) { -+ int base = idx * IRQS_PER_WORD; -+ unsigned long pending; -+ int hw_irq; -+ -+ raw_spin_lock(&data->lock); -+ pending = __raw_readl(block->en_reg[idx]) & -+ __raw_readl(block->status_reg[idx]); -+ raw_spin_unlock(&data->lock); -+ -+ for_each_set_bit(hw_irq, &pending, IRQS_PER_WORD) { -+ int virq; -+ -+ virq = irq_find_mapping(data->domain, base + hw_irq); -+ generic_handle_irq(virq); -+ } -+ } -+ -+ chained_irq_exit(chip, desc); -+} -+ -+static void __bcm6345_periph_enable(struct intc_block *block, int reg, int bit, -+ bool enable) -+{ -+ u32 val; -+ -+ val = __raw_readl(block->en_reg[reg]); -+ if (enable) -+ val |= BIT(bit); -+ else -+ val &= ~BIT(bit); -+ __raw_writel(val, block->en_reg[reg]); -+} -+ -+static void bcm6345_periph_irq_mask(struct irq_data *data) -+{ -+ unsigned int i, reg, bit; -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ -+ reg = hwirq / IRQS_PER_WORD; -+ bit = hwirq % IRQS_PER_WORD; -+ -+ raw_spin_lock(&priv->lock); -+ for (i = 0; i < MAX_PARENT_IRQS; i++) { -+ struct intc_block *block = &priv->block[i]; -+ -+ if (!block->parent_irq) -+ break; -+ -+ __bcm6345_periph_enable(block, reg, bit, false); -+ } -+ raw_spin_unlock(&priv->lock); -+} -+ -+static void bcm6345_periph_irq_unmask(struct irq_data *data) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ unsigned int i, reg, bit; -+ -+ reg = hwirq / IRQS_PER_WORD; -+ bit = hwirq % IRQS_PER_WORD; -+ -+ raw_spin_lock(&priv->lock); -+ for (i = 0; i < MAX_PARENT_IRQS; i++) { -+ struct intc_block *block = &priv->block[i]; -+ -+ if (!block->parent_irq) -+ break; -+ -+ if (block->mask_cache[reg] & BIT(bit)) -+ __bcm6345_periph_enable(block, reg, bit, true); -+ else -+ __bcm6345_periph_enable(block, reg, bit, false); -+ } -+ raw_spin_unlock(&priv->lock); -+} -+ -+#ifdef CONFIG_SMP -+static int bcm6345_periph_set_affinity(struct irq_data *data, -+ const struct cpumask *mask, bool force) -+{ -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ struct intc_data *priv = data->domain->host_data; -+ unsigned int i, reg, bit; -+ unsigned long flags; -+ bool enabled; -+ int cpu; -+ -+ reg = hwirq / IRQS_PER_WORD; -+ bit = hwirq % IRQS_PER_WORD; -+ -+ /* we could route to more than one cpu, but performance -+ suffers, so fix it to one. -+ */ -+ cpu = cpumask_any_and(mask, cpu_online_mask); -+ if (cpu >= nr_cpu_ids) -+ return -EINVAL; -+ -+ if (cpu >= MAX_PARENT_IRQS) -+ return -EINVAL; -+ -+ if (!priv->block[cpu].parent_irq) -+ return -EINVAL; -+ -+ raw_spin_lock_irqsave(&priv->lock, flags); -+ enabled = !irqd_irq_masked(data); -+ for (i = 0; i < MAX_PARENT_IRQS; i++) { -+ struct intc_block *block = &priv->block[i]; -+ -+ if (!block->parent_irq) -+ break; -+ -+ if (i == cpu) { -+ block->mask_cache[reg] |= BIT(bit); -+ __bcm6345_periph_enable(block, reg, bit, enabled); -+ } else { -+ block->mask_cache[reg] &= ~BIT(bit); -+ __bcm6345_periph_enable(block, reg, bit, false); -+ } -+ } -+ raw_spin_unlock_irqrestore(&priv->lock, flags); -+ -+ return 0; -+} -+#endif -+ -+static int bcm6345_periph_map(struct irq_domain *d, unsigned int irq, -+ irq_hw_number_t hw) -+{ -+ struct intc_data *priv = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &priv->chip, handle_level_irq); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops bcm6345_periph_domain_ops = { -+ .xlate = irq_domain_xlate_onecell, -+ .map = bcm6345_periph_map, -+}; -+ -+static int __init __bcm6345_periph_intc_init(struct device_node *node, -+ int num_blocks, int *irq, -+ void __iomem **base, int num_words) -+{ -+ struct intc_data *data; -+ unsigned int i, w, status_offset; -+ -+ data = kzalloc(sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ -+ raw_spin_lock_init(&data->lock); -+ -+ status_offset = num_words * sizeof(u32); -+ -+ for (i = 0; i < num_blocks; i++) { -+ struct intc_block *block = &data->block[i]; -+ -+ block->parent_irq = irq[i]; -+ block->base = base[i]; -+ -+ for (w = 0; w < num_words; w++) { -+ int word_offset = sizeof(u32) * ((num_words - w) - 1); -+ -+ block->en_reg[w] = base[i] + word_offset; -+ block->status_reg[w] = base[i] + status_offset; -+ block->status_reg[w] += word_offset; -+ -+ /* route all interrupts to line 0 by default */ -+ if (i == 0) -+ block->mask_cache[w] = 0xffffffff; -+ } -+ -+ irq_set_handler_data(block->parent_irq, data); -+ irq_set_chained_handler(block->parent_irq, -+ bcm6345_periph_irq_handle); -+ } -+ -+ data->num_words = num_words; -+ -+ data->chip.name = "bcm6345-periph-intc"; -+ data->chip.irq_mask = bcm6345_periph_irq_mask; -+ data->chip.irq_unmask = bcm6345_periph_irq_unmask; -+ -+#ifdef CONFIG_SMP -+ if (num_blocks > 1) -+ data->chip.irq_set_affinity = bcm6345_periph_set_affinity; -+#endif -+ -+ data->domain = irq_domain_add_simple(node, IRQS_PER_WORD * num_words, -+ VIRQ_BASE, -+ &bcm6345_periph_domain_ops, data); -+ if (!data->domain) { -+ kfree(data); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+void __init bcm6345_periph_intc_init(int num_blocks, int *irq, -+ void __iomem **base, int num_words) -+{ -+ __bcm6345_periph_intc_init(NULL, num_blocks, irq, base, num_words); -+} -+ -+#ifdef CONFIG_OF -+static int __init bcm6345_periph_of_init(struct device_node *node, -+ struct device_node *parent) -+{ -+ struct resource res; -+ int num_irqs, ret = -EINVAL; -+ int irqs[MAX_PARENT_IRQS] = { 0 }; -+ void __iomem *bases[MAX_PARENT_IRQS] = { NULL }; -+ int words = 0; -+ int i; -+ -+ num_irqs = of_irq_count(node); -+ -+ if (num_irqs < 1 || num_irqs > MAX_PARENT_IRQS) -+ return -EINVAL; -+ -+ for (i = 0; i < num_irqs; i++) { -+ resource_size_t size; -+ -+ irqs[i] = irq_of_parse_and_map(node, i); -+ if (!irqs[i]) -+ goto out_unmap; -+ -+ if (of_address_to_resource(node, i, &res)) -+ goto out_unmap; -+ -+ size = resource_size(&res); -+ switch (size) { -+ case 8: -+ case 16: -+ case 32: -+ size = size / 8; -+ break; -+ default: -+ goto out_unmap; -+ } -+ -+ if (words && words != size) { -+ ret = -EINVAL; -+ goto out_unmap; -+ } -+ words = size; -+ -+ bases[i] = of_iomap(node, i); -+ if (!bases[i]) { -+ ret = -ENOMEM; -+ goto out_unmap; -+ } -+ } -+ -+ ret = __bcm6345_periph_intc_init(node, num_irqs, irqs, bases, words); -+ if (!ret) -+ return 0; -+ -+out_unmap: -+ for (i = 0; i < num_irqs; i++) { -+ iounmap(bases[i]); -+ irq_dispose_mapping(irqs[i]); -+ } -+ -+ return ret; -+} -+ -+IRQCHIP_DECLARE(bcm6345_periph_intc, "brcm,bcm6345-l1-intc", -+ bcm6345_periph_of_init); -+#endif ---- /dev/null -+++ b/include/linux/irqchip/irq-bcm6345-periph.h -@@ -0,0 +1,16 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2008 Nicolas Schichan -+ */ -+ -+#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H -+#define __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H -+ -+void bcm6345_periph_intc_init(int num_blocks, int *irq, void __iomem **base, -+ int num_words); -+ -+#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H */ diff --git a/target/linux/brcm63xx/patches-4.4/321-irqchip-add-support-for-bcm6345-style-external-inter.patch b/target/linux/brcm63xx/patches-4.4/321-irqchip-add-support-for-bcm6345-style-external-inter.patch deleted file mode 100644 index 5c735c85f..000000000 --- a/target/linux/brcm63xx/patches-4.4/321-irqchip-add-support-for-bcm6345-style-external-inter.patch +++ /dev/null @@ -1,394 +0,0 @@ -From cf908990d4a8ccdb73ee4484aa8cadad379ca314 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 30 Nov 2014 14:54:27 +0100 -Subject: [PATCH 2/5] irqchip: add support for bcm6345-style external - interrupt controller - -Signed-off-by: Jonas Gorski ---- - .../interrupt-controller/brcm,bcm6345-ext-intc.txt | 29 ++ - drivers/irqchip/Kconfig | 4 + - drivers/irqchip/Makefile | 1 + - drivers/irqchip/irq-bcm6345-ext.c | 287 ++++++++++++++++++++ - include/linux/irqchip/irq-bcm6345-ext.h | 14 + - 5 files changed, 335 insertions(+) - create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-ext-intc.txt - create mode 100644 drivers/irqchip/irq-bcm6345-ext.c - create mode 100644 include/linux/irqchip/irq-bcm6345-ext.h - ---- /dev/null -+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-ext-intc.txt -@@ -0,0 +1,29 @@ -+Broadcom BCM6345-style external interrupt controller -+ -+Required properties: -+ -+- compatible: Should be "brcm,bcm6345-ext-intc" or "brcm,bcm6318-ext-intc". -+- reg: Specifies the base physical addresses and size of the registers. -+- interrupt-controller: identifies the node as an interrupt controller. -+- #interrupt-cells: Specifies the number of cells needed to encode an interrupt -+ source, Should be 2. -+- interrupt-parent: Specifies the phandle to the parent interrupt controller -+ this one is cascaded from. -+- interrupts: Specifies the interrupt line(s) in the interrupt-parent controller -+ node, valid values depend on the type of parent interrupt controller. -+ -+Optional properties: -+ -+- brcm,field-width: Size of each field (mask, clear, sense, ...) in bits in the -+ register. Defaults to 4. -+ -+Example: -+ -+ext_intc: interrupt-controller@10000018 { -+ compatible = "brcm,bcm6345-ext-intc"; -+ interrupt-parent = <&periph_intc>; -+ #interrupt-cells = <2>; -+ reg = <0x10000018 0x4>; -+ interrupt-controller; -+ interrupts = <24>, <25>, <26>, <27>; -+}; ---- a/drivers/irqchip/Kconfig -+++ b/drivers/irqchip/Kconfig -@@ -80,6 +80,10 @@ config BRCMSTB_L2_IRQ - select GENERIC_IRQ_CHIP - select IRQ_DOMAIN - -+config BCM6345_EXT_IRQ -+ bool -+ select IRQ_DOMAIN -+ - config BCM6345_PERIPH_IRQ - bool - select IRQ_DOMAIN ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -9,6 +9,7 @@ obj-$(CONFIG_ARCH_MVEBU) += irq-armada- - obj-$(CONFIG_IRQ_MXS) += irq-mxs.o - obj-$(CONFIG_ARCH_TEGRA) += irq-tegra.o - obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o -+obj-$(CONFIG_BCM6345_EXT_IRQ) += irq-bcm6345-ext.o - obj-$(CONFIG_BCM6345_PERIPH_IRQ) += irq-bcm6345-periph.o - obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o - obj-$(CONFIG_METAG) += irq-metag-ext.o ---- /dev/null -+++ b/drivers/irqchip/irq-bcm6345-ext.c -@@ -0,0 +1,301 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2014 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_BCM63XX -+#include -+ -+#define VIRQ_BASE IRQ_EXTERNAL_BASE -+#else -+#define VIRQ_BASE 0 -+#endif -+ -+#define MAX_IRQS 4 -+ -+#define EXTIRQ_CFG_SENSE 0 -+#define EXTIRQ_CFG_STAT 1 -+#define EXTIRQ_CFG_CLEAR 2 -+#define EXTIRQ_CFG_MASK 3 -+#define EXTIRQ_CFG_BOTHEDGE 4 -+#define EXTIRQ_CFG_LEVELSENSE 5 -+ -+struct intc_data { -+ struct irq_chip chip; -+ struct irq_domain *domain; -+ raw_spinlock_t lock; -+ -+ int parent_irq[MAX_IRQS]; -+ void __iomem *reg; -+ int shift; -+ unsigned int toggle_clear_on_ack:1; -+}; -+ -+static void bcm6345_ext_intc_irq_handle(struct irq_desc *desc) -+{ -+ struct intc_data *data = irq_desc_get_handler_data(desc); -+ struct irq_chip *chip = irq_desc_get_chip(desc); -+ unsigned int irq = irq_desc_get_irq(desc); -+ unsigned int idx; -+ -+ chained_irq_enter(chip, desc); -+ -+ for (idx = 0; idx < MAX_IRQS; idx++) { -+ if (data->parent_irq[idx] != irq) -+ continue; -+ -+ generic_handle_irq(irq_find_mapping(data->domain, idx)); -+ } -+ -+ chained_irq_exit(chip, desc); -+} -+ -+static void bcm6345_ext_intc_irq_ack(struct irq_data *data) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ u32 reg; -+ -+ raw_spin_lock(&priv->lock); -+ reg = __raw_readl(priv->reg); -+ __raw_writel(reg | (1 << (hwirq + EXTIRQ_CFG_CLEAR * priv->shift)), -+ priv->reg); -+ if (priv->toggle_clear_on_ack) -+ __raw_writel(reg, priv->reg); -+ raw_spin_unlock(&priv->lock); -+} -+ -+static void bcm6345_ext_intc_irq_mask(struct irq_data *data) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ u32 reg; -+ -+ raw_spin_lock(&priv->lock); -+ reg = __raw_readl(priv->reg); -+ reg &= ~(1 << (hwirq + EXTIRQ_CFG_MASK * priv->shift)); -+ __raw_writel(reg, priv->reg); -+ raw_spin_unlock(&priv->lock); -+} -+ -+static void bcm6345_ext_intc_irq_unmask(struct irq_data *data) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ u32 reg; -+ -+ raw_spin_lock(&priv->lock); -+ reg = __raw_readl(priv->reg); -+ reg |= 1 << (hwirq + EXTIRQ_CFG_MASK * priv->shift); -+ __raw_writel(reg, priv->reg); -+ raw_spin_unlock(&priv->lock); -+} -+ -+static int bcm6345_ext_intc_set_type(struct irq_data *data, -+ unsigned int flow_type) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ bool levelsense = 0, sense = 0, bothedge = 0; -+ u32 reg; -+ -+ flow_type &= IRQ_TYPE_SENSE_MASK; -+ -+ if (flow_type == IRQ_TYPE_NONE) -+ flow_type = IRQ_TYPE_LEVEL_LOW; -+ -+ switch (flow_type) { -+ case IRQ_TYPE_EDGE_BOTH: -+ bothedge = 1; -+ break; -+ -+ case IRQ_TYPE_EDGE_RISING: -+ sense = 1; -+ break; -+ -+ case IRQ_TYPE_EDGE_FALLING: -+ break; -+ -+ case IRQ_TYPE_LEVEL_HIGH: -+ levelsense = 1; -+ sense = 1; -+ break; -+ -+ case IRQ_TYPE_LEVEL_LOW: -+ levelsense = 1; -+ break; -+ -+ default: -+ pr_err("bogus flow type combination given!\n"); -+ return -EINVAL; -+ } -+ -+ raw_spin_lock(&priv->lock); -+ reg = __raw_readl(priv->reg); -+ -+ if (levelsense) -+ reg |= 1 << (hwirq + EXTIRQ_CFG_LEVELSENSE * priv->shift); -+ else -+ reg &= ~(1 << (hwirq + EXTIRQ_CFG_LEVELSENSE * priv->shift)); -+ if (sense) -+ reg |= 1 << (hwirq + EXTIRQ_CFG_SENSE * priv->shift); -+ else -+ reg &= ~(1 << (hwirq + EXTIRQ_CFG_SENSE * priv->shift)); -+ if (bothedge) -+ reg |= 1 << (hwirq + EXTIRQ_CFG_BOTHEDGE * priv->shift); -+ else -+ reg &= ~(1 << (hwirq + EXTIRQ_CFG_BOTHEDGE * priv->shift)); -+ -+ __raw_writel(reg, priv->reg); -+ raw_spin_unlock(&priv->lock); -+ -+ irqd_set_trigger_type(data, flow_type); -+ if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) -+ irq_set_handler_locked(data, handle_level_irq); -+ else -+ irq_set_handler_locked(data, handle_edge_irq); -+ -+ return 0; -+} -+ -+static int bcm6345_ext_intc_map(struct irq_domain *d, unsigned int irq, -+ irq_hw_number_t hw) -+{ -+ struct intc_data *priv = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &priv->chip, handle_level_irq); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops bcm6345_ext_domain_ops = { -+ .xlate = irq_domain_xlate_twocell, -+ .map = bcm6345_ext_intc_map, -+}; -+ -+static int __init __bcm6345_ext_intc_init(struct device_node *node, -+ int num_irqs, int *irqs, -+ void __iomem *reg, int shift, -+ bool toggle_clear_on_ack) -+{ -+ struct intc_data *data; -+ unsigned int i; -+ int start = VIRQ_BASE; -+ -+ data = kzalloc(sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ -+ raw_spin_lock_init(&data->lock); -+ -+ for (i = 0; i < num_irqs; i++) { -+ data->parent_irq[i] = irqs[i]; -+ -+ irq_set_handler_data(irqs[i], data); -+ irq_set_chained_handler(irqs[i], bcm6345_ext_intc_irq_handle); -+ } -+ -+ data->reg = reg; -+ data->shift = shift; -+ data->toggle_clear_on_ack = toggle_clear_on_ack; -+ -+ data->chip.name = "bcm6345-ext-intc"; -+ data->chip.irq_ack = bcm6345_ext_intc_irq_ack; -+ data->chip.irq_mask = bcm6345_ext_intc_irq_mask; -+ data->chip.irq_unmask = bcm6345_ext_intc_irq_unmask; -+ data->chip.irq_set_type = bcm6345_ext_intc_set_type; -+ -+ /* -+ * If we have less than 4 irqs, this is the second controller on -+ * bcm63xx. So increase the VIRQ start to not overlap with the first -+ * one, but only do so if we actually use a non-zero start. -+ * -+ * This can be removed when bcm63xx has no legacy users anymore. -+ */ -+ if (start && num_irqs < 4) -+ start += 4; -+ -+ data->domain = irq_domain_add_simple(node, num_irqs, start, -+ &bcm6345_ext_domain_ops, data); -+ if (!data->domain) { -+ kfree(data); -+ return -ENOMEM; -+ } -+ -+ return 0; -+} -+ -+void __init bcm6345_ext_intc_init(int num_irqs, int *irqs, void __iomem *reg, -+ int shift) -+{ -+ __bcm6345_ext_intc_init(NULL, num_irqs, irqs, reg, shift, false); -+} -+ -+#ifdef CONFIG_OF -+static int __init bcm6345_ext_intc_of_init(struct device_node *node, -+ struct device_node *parent) -+{ -+ int num_irqs, ret = -EINVAL; -+ unsigned i; -+ void __iomem *base; -+ int irqs[MAX_IRQS] = { 0 }; -+ u32 shift; -+ bool toggle_clear_on_ack = false; -+ -+ num_irqs = of_irq_count(node); -+ -+ if (!num_irqs || num_irqs > MAX_IRQS) -+ return -EINVAL; -+ -+ if (of_property_read_u32(node, "brcm,field-width", &shift)) -+ shift = 4; -+ -+ /* on BCM6318 setting CLEAR seems to continuously mask interrupts */ -+ if (of_device_is_compatible(node, "brcm,bcm6318-ext-intc")) -+ toggle_clear_on_ack = true; -+ -+ for (i = 0; i < num_irqs; i++) { -+ irqs[i] = irq_of_parse_and_map(node, i); -+ if (!irqs[i]) { -+ ret = -ENOMEM; -+ goto out_unmap; -+ } -+ } -+ -+ base = of_iomap(node, 0); -+ if (!base) -+ goto out_unmap; -+ -+ ret = __bcm6345_ext_intc_init(node, num_irqs, irqs, base, shift, -+ toggle_clear_on_ack); -+ if (!ret) -+ return 0; -+out_unmap: -+ iounmap(base); -+ -+ for (i = 0; i < num_irqs; i++) -+ irq_dispose_mapping(irqs[i]); -+ -+ return ret; -+} -+ -+IRQCHIP_DECLARE(bcm6318_ext_intc, "brcm,bcm6318-ext-intc", -+ bcm6345_ext_intc_of_init); -+IRQCHIP_DECLARE(bcm6345_ext_intc, "brcm,bcm6345-ext-intc", -+ bcm6345_ext_intc_of_init); -+#endif ---- /dev/null -+++ b/include/linux/irqchip/irq-bcm6345-ext.h -@@ -0,0 +1,14 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2014 Jonas Gorski -+ */ -+ -+#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_EXT_H -+#define __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_EXT_H -+ -+void bcm6345_ext_intc_init(int n_irqs, int *irqs, void __iomem *reg, int shift); -+ -+#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_EXT_H */ diff --git a/target/linux/brcm63xx/patches-4.4/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch b/target/linux/brcm63xx/patches-4.4/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch deleted file mode 100644 index c7c9c35bd..000000000 --- a/target/linux/brcm63xx/patches-4.4/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch +++ /dev/null @@ -1,695 +0,0 @@ -From d2d2489e0a4b740abd980e9d1cad952d15bc2d9e Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 30 Nov 2014 14:55:02 +0100 -Subject: [PATCH] MIPS: BCM63XX: switch to IRQ_DOMAIN - -Now that we have working IRQ_DOMAIN drivers for both interrupt controllers, -switch to using them. - -Signed-off-by: Jonas Gorski ---- - arch/mips/Kconfig | 3 + - arch/mips/bcm63xx/irq.c | 612 +++++++++--------------------------------------- - 2 files changed, 108 insertions(+), 507 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -207,6 +207,9 @@ config BCM63XX - select SYNC_R4K - select DMA_NONCOHERENT - select IRQ_MIPS_CPU -+ select BCM6345_EXT_IRQ -+ select BCM6345_PERIPH_IRQ -+ select IRQ_DOMAIN - select SYS_SUPPORTS_32BIT_KERNEL - select SYS_SUPPORTS_BIG_ENDIAN - select SYS_HAS_EARLY_PRINTK ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -12,7 +12,9 @@ - #include - #include - #include --#include -+#include -+#include -+#include - #include - #include - #include -@@ -20,544 +22,140 @@ - #include - #include - -- --static DEFINE_SPINLOCK(ipic_lock); --static DEFINE_SPINLOCK(epic_lock); -- --static u32 irq_stat_addr[2]; --static u32 irq_mask_addr[2]; --static void (*dispatch_internal)(int cpu); --static int is_ext_irq_cascaded; --static unsigned int ext_irq_count; --static unsigned int ext_irq_start, ext_irq_end; --static unsigned int ext_irq_cfg_reg1, ext_irq_cfg_reg2; --static void (*internal_irq_mask)(struct irq_data *d); --static void (*internal_irq_unmask)(struct irq_data *d, const struct cpumask *m); -- -- --static inline u32 get_ext_irq_perf_reg(int irq) --{ -- if (irq < 4) -- return ext_irq_cfg_reg1; -- return ext_irq_cfg_reg2; --} -- --static inline void handle_internal(int intbit) --{ -- if (is_ext_irq_cascaded && -- intbit >= ext_irq_start && intbit <= ext_irq_end) -- do_IRQ(intbit - ext_irq_start + IRQ_EXTERNAL_BASE); -- else -- do_IRQ(intbit + IRQ_INTERNAL_BASE); --} -- --static inline int enable_irq_for_cpu(int cpu, struct irq_data *d, -- const struct cpumask *m) --{ -- bool enable = cpu_online(cpu); -- --#ifdef CONFIG_SMP -- if (m) -- enable &= cpumask_test_cpu(cpu, m); -- else if (irqd_affinity_was_set(d)) -- enable &= cpumask_test_cpu(cpu, irq_data_get_affinity_mask(d)); --#endif -- return enable; --} -- --/* -- * dispatch internal devices IRQ (uart, enet, watchdog, ...). do not -- * prioritize any interrupt relatively to another. the static counter -- * will resume the loop where it ended the last time we left this -- * function. -- */ -- --#define BUILD_IPIC_INTERNAL(width) \ --void __dispatch_internal_##width(int cpu) \ --{ \ -- u32 pending[width / 32]; \ -- unsigned int src, tgt; \ -- bool irqs_pending = false; \ -- static unsigned int i[2]; \ -- unsigned int *next = &i[cpu]; \ -- unsigned long flags; \ -- \ -- /* read registers in reverse order */ \ -- spin_lock_irqsave(&ipic_lock, flags); \ -- for (src = 0, tgt = (width / 32); src < (width / 32); src++) { \ -- u32 val; \ -- \ -- val = bcm_readl(irq_stat_addr[cpu] + src * sizeof(u32)); \ -- val &= bcm_readl(irq_mask_addr[cpu] + src * sizeof(u32)); \ -- pending[--tgt] = val; \ -- \ -- if (val) \ -- irqs_pending = true; \ -- } \ -- spin_unlock_irqrestore(&ipic_lock, flags); \ -- \ -- if (!irqs_pending) \ -- return; \ -- \ -- while (1) { \ -- unsigned int to_call = *next; \ -- \ -- *next = (*next + 1) & (width - 1); \ -- if (pending[to_call / 32] & (1 << (to_call & 0x1f))) { \ -- handle_internal(to_call); \ -- break; \ -- } \ -- } \ --} \ -- \ --static void __internal_irq_mask_##width(struct irq_data *d) \ --{ \ -- u32 val; \ -- unsigned irq = d->irq - IRQ_INTERNAL_BASE; \ -- unsigned reg = (irq / 32) ^ (width/32 - 1); \ -- unsigned bit = irq & 0x1f; \ -- unsigned long flags; \ -- int cpu; \ -- \ -- spin_lock_irqsave(&ipic_lock, flags); \ -- for_each_present_cpu(cpu) { \ -- if (!irq_mask_addr[cpu]) \ -- break; \ -- \ -- val = bcm_readl(irq_mask_addr[cpu] + reg * sizeof(u32));\ -- val &= ~(1 << bit); \ -- bcm_writel(val, irq_mask_addr[cpu] + reg * sizeof(u32));\ -- } \ -- spin_unlock_irqrestore(&ipic_lock, flags); \ --} \ -- \ --static void __internal_irq_unmask_##width(struct irq_data *d, \ -- const struct cpumask *m) \ --{ \ -- u32 val; \ -- unsigned irq = d->irq - IRQ_INTERNAL_BASE; \ -- unsigned reg = (irq / 32) ^ (width/32 - 1); \ -- unsigned bit = irq & 0x1f; \ -- unsigned long flags; \ -- int cpu; \ -- \ -- spin_lock_irqsave(&ipic_lock, flags); \ -- for_each_present_cpu(cpu) { \ -- if (!irq_mask_addr[cpu]) \ -- break; \ -- \ -- val = bcm_readl(irq_mask_addr[cpu] + reg * sizeof(u32));\ -- if (enable_irq_for_cpu(cpu, d, m)) \ -- val |= (1 << bit); \ -- else \ -- val &= ~(1 << bit); \ -- bcm_writel(val, irq_mask_addr[cpu] + reg * sizeof(u32));\ -- } \ -- spin_unlock_irqrestore(&ipic_lock, flags); \ --} -- --BUILD_IPIC_INTERNAL(32); --BUILD_IPIC_INTERNAL(64); -- --asmlinkage void plat_irq_dispatch(void) --{ -- u32 cause; -- -- do { -- cause = read_c0_cause() & read_c0_status() & ST0_IM; -- -- if (!cause) -- break; -- -- if (cause & CAUSEF_IP7) -- do_IRQ(7); -- if (cause & CAUSEF_IP0) -- do_IRQ(0); -- if (cause & CAUSEF_IP1) -- do_IRQ(1); -- if (cause & CAUSEF_IP2) -- dispatch_internal(0); -- if (is_ext_irq_cascaded) { -- if (cause & CAUSEF_IP3) -- dispatch_internal(1); -- } else { -- if (cause & CAUSEF_IP3) -- do_IRQ(IRQ_EXT_0); -- if (cause & CAUSEF_IP4) -- do_IRQ(IRQ_EXT_1); -- if (cause & CAUSEF_IP5) -- do_IRQ(IRQ_EXT_2); -- if (cause & CAUSEF_IP6) -- do_IRQ(IRQ_EXT_3); -- } -- } while (1); --} -- --/* -- * internal IRQs operations: only mask/unmask on PERF irq mask -- * register. -- */ --static void bcm63xx_internal_irq_mask(struct irq_data *d) --{ -- internal_irq_mask(d); --} -- --static void bcm63xx_internal_irq_unmask(struct irq_data *d) --{ -- internal_irq_unmask(d, NULL); --} -- --/* -- * external IRQs operations: mask/unmask and clear on PERF external -- * irq control register. -- */ --static void bcm63xx_external_irq_mask(struct irq_data *d) --{ -- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; -- u32 reg, regaddr; -- unsigned long flags; -- -- regaddr = get_ext_irq_perf_reg(irq); -- spin_lock_irqsave(&epic_lock, flags); -- reg = bcm_perf_readl(regaddr); -- -- if (BCMCPU_IS_6348()) -- reg &= ~EXTIRQ_CFG_MASK_6348(irq % 4); -- else -- reg &= ~EXTIRQ_CFG_MASK(irq % 4); -- -- bcm_perf_writel(reg, regaddr); -- spin_unlock_irqrestore(&epic_lock, flags); -- -- if (is_ext_irq_cascaded) -- internal_irq_mask(irq_get_irq_data(irq + ext_irq_start)); --} -- --static void bcm63xx_external_irq_unmask(struct irq_data *d) --{ -- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; -- u32 reg, regaddr; -- unsigned long flags; -- -- regaddr = get_ext_irq_perf_reg(irq); -- spin_lock_irqsave(&epic_lock, flags); -- reg = bcm_perf_readl(regaddr); -- -- if (BCMCPU_IS_6348()) -- reg |= EXTIRQ_CFG_MASK_6348(irq % 4); -- else -- reg |= EXTIRQ_CFG_MASK(irq % 4); -- -- bcm_perf_writel(reg, regaddr); -- spin_unlock_irqrestore(&epic_lock, flags); -- -- if (is_ext_irq_cascaded) -- internal_irq_unmask(irq_get_irq_data(irq + ext_irq_start), -- NULL); --} -- --static void bcm63xx_external_irq_clear(struct irq_data *d) --{ -- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; -- u32 reg, regaddr; -- unsigned long flags; -- -- regaddr = get_ext_irq_perf_reg(irq); -- spin_lock_irqsave(&epic_lock, flags); -- reg = bcm_perf_readl(regaddr); -- -- if (BCMCPU_IS_6348()) -- reg |= EXTIRQ_CFG_CLEAR_6348(irq % 4); -- else -- reg |= EXTIRQ_CFG_CLEAR(irq % 4); -- -- bcm_perf_writel(reg, regaddr); -- spin_unlock_irqrestore(&epic_lock, flags); --} -- --static int bcm63xx_external_irq_set_type(struct irq_data *d, -- unsigned int flow_type) --{ -- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; -- u32 reg, regaddr; -- int levelsense, sense, bothedge; -- unsigned long flags; -- -- flow_type &= IRQ_TYPE_SENSE_MASK; -- -- if (flow_type == IRQ_TYPE_NONE) -- flow_type = IRQ_TYPE_LEVEL_LOW; -- -- levelsense = sense = bothedge = 0; -- switch (flow_type) { -- case IRQ_TYPE_EDGE_BOTH: -- bothedge = 1; -- break; -- -- case IRQ_TYPE_EDGE_RISING: -- sense = 1; -- break; -- -- case IRQ_TYPE_EDGE_FALLING: -- break; -- -- case IRQ_TYPE_LEVEL_HIGH: -- levelsense = 1; -- sense = 1; -- break; -- -- case IRQ_TYPE_LEVEL_LOW: -- levelsense = 1; -- break; -- -- default: -- pr_err("bogus flow type combination given !\n"); -- return -EINVAL; -- } -- -- regaddr = get_ext_irq_perf_reg(irq); -- spin_lock_irqsave(&epic_lock, flags); -- reg = bcm_perf_readl(regaddr); -- irq %= 4; -- -- switch (bcm63xx_get_cpu_id()) { -- case BCM6348_CPU_ID: -- if (levelsense) -- reg |= EXTIRQ_CFG_LEVELSENSE_6348(irq); -- else -- reg &= ~EXTIRQ_CFG_LEVELSENSE_6348(irq); -- if (sense) -- reg |= EXTIRQ_CFG_SENSE_6348(irq); -- else -- reg &= ~EXTIRQ_CFG_SENSE_6348(irq); -- if (bothedge) -- reg |= EXTIRQ_CFG_BOTHEDGE_6348(irq); -- else -- reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq); -- break; -- -- case BCM3368_CPU_ID: -- case BCM6328_CPU_ID: -- case BCM6338_CPU_ID: -- case BCM6345_CPU_ID: -- case BCM6358_CPU_ID: -- case BCM6362_CPU_ID: -- case BCM6368_CPU_ID: -- if (levelsense) -- reg |= EXTIRQ_CFG_LEVELSENSE(irq); -- else -- reg &= ~EXTIRQ_CFG_LEVELSENSE(irq); -- if (sense) -- reg |= EXTIRQ_CFG_SENSE(irq); -- else -- reg &= ~EXTIRQ_CFG_SENSE(irq); -- if (bothedge) -- reg |= EXTIRQ_CFG_BOTHEDGE(irq); -- else -- reg &= ~EXTIRQ_CFG_BOTHEDGE(irq); -- break; -- default: -- BUG(); -- } -- -- bcm_perf_writel(reg, regaddr); -- spin_unlock_irqrestore(&epic_lock, flags); -- -- irqd_set_trigger_type(d, flow_type); -- if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) -- irq_set_handler_locked(d, handle_level_irq); -- else -- irq_set_handler_locked(d, handle_edge_irq); -- -- return IRQ_SET_MASK_OK_NOCOPY; --} -- --#ifdef CONFIG_SMP --static int bcm63xx_internal_set_affinity(struct irq_data *data, -- const struct cpumask *dest, -- bool force) --{ -- if (!irqd_irq_disabled(data)) -- internal_irq_unmask(data, dest); -- -- return 0; --} --#endif -- --static struct irq_chip bcm63xx_internal_irq_chip = { -- .name = "bcm63xx_ipic", -- .irq_mask = bcm63xx_internal_irq_mask, -- .irq_unmask = bcm63xx_internal_irq_unmask, --}; -- --static struct irq_chip bcm63xx_external_irq_chip = { -- .name = "bcm63xx_epic", -- .irq_ack = bcm63xx_external_irq_clear, -- -- .irq_mask = bcm63xx_external_irq_mask, -- .irq_unmask = bcm63xx_external_irq_unmask, -- -- .irq_set_type = bcm63xx_external_irq_set_type, --}; -- --static struct irqaction cpu_ip2_cascade_action = { -- .handler = no_action, -- .name = "cascade_ip2", -- .flags = IRQF_NO_THREAD, --}; -- --#ifdef CONFIG_SMP --static struct irqaction cpu_ip3_cascade_action = { -- .handler = no_action, -- .name = "cascade_ip3", -- .flags = IRQF_NO_THREAD, --}; --#endif -- --static struct irqaction cpu_ext_cascade_action = { -- .handler = no_action, -- .name = "cascade_extirq", -- .flags = IRQF_NO_THREAD, --}; -- --static void bcm63xx_init_irq(void) -+void __init arch_init_irq(void) - { -- int irq_bits; -- -- irq_stat_addr[0] = bcm63xx_regset_address(RSET_PERF); -- irq_mask_addr[0] = bcm63xx_regset_address(RSET_PERF); -- irq_stat_addr[1] = bcm63xx_regset_address(RSET_PERF); -- irq_mask_addr[1] = bcm63xx_regset_address(RSET_PERF); -+ void __iomem *periph_bases[2]; -+ void __iomem *ext_intc_bases[2]; -+ int periph_irq_count, periph_width, ext_irq_count, ext_shift; -+ int periph_irqs[2] = { 2, 3 }; -+ int ext_irqs[6]; -+ -+ periph_bases[0] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); -+ periph_bases[1] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); -+ ext_intc_bases[0] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); -+ ext_intc_bases[1] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); - - switch (bcm63xx_get_cpu_id()) { - case BCM3368_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_3368_REG; -- irq_mask_addr[0] += PERF_IRQMASK_3368_REG; -- irq_stat_addr[1] = 0; -- irq_mask_addr[1] = 0; -- irq_bits = 32; -- ext_irq_count = 4; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; -+ periph_bases[0] += PERF_IRQMASK_3368_REG; -+ periph_irq_count = 1; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_3368; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_3368_EXT_IRQ0; -+ ext_irqs[1] = BCM_3368_EXT_IRQ1; -+ ext_irqs[2] = BCM_3368_EXT_IRQ2; -+ ext_irqs[3] = BCM_3368_EXT_IRQ3; -+ ext_shift = 4; - break; - case BCM6328_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0); -- irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0); -- irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1); -- irq_mask_addr[1] += PERF_IRQMASK_6328_REG(1); -- irq_bits = 64; -- ext_irq_count = 4; -- is_ext_irq_cascaded = 1; -- ext_irq_start = BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE; -- ext_irq_end = BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328; -+ periph_bases[0] += PERF_IRQMASK_6328_REG(0); -+ periph_bases[1] += PERF_IRQMASK_6328_REG(1); -+ periph_irq_count = 2; -+ periph_width = 2; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6328; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_6328_EXT_IRQ0; -+ ext_irqs[1] = BCM_6328_EXT_IRQ1; -+ ext_irqs[2] = BCM_6328_EXT_IRQ2; -+ ext_irqs[3] = BCM_6328_EXT_IRQ3; -+ ext_shift = 4; - break; - case BCM6338_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6338_REG; -- irq_mask_addr[0] += PERF_IRQMASK_6338_REG; -- irq_stat_addr[1] = 0; -- irq_mask_addr[1] = 0; -- irq_bits = 32; -- ext_irq_count = 4; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6338; -+ periph_bases[0] += PERF_IRQMASK_6338_REG; -+ periph_irq_count = 1; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6338; -+ ext_irq_count = 4; -+ ext_irqs[0] = 3; -+ ext_irqs[1] = 4; -+ ext_irqs[2] = 5; -+ ext_irqs[3] = 6; -+ ext_shift = 4; - break; - case BCM6345_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6345_REG; -- irq_mask_addr[0] += PERF_IRQMASK_6345_REG; -- irq_stat_addr[1] = 0; -- irq_mask_addr[1] = 0; -- irq_bits = 32; -- ext_irq_count = 4; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6345; -+ periph_bases[0] += PERF_IRQMASK_6345_REG; -+ periph_irq_count = 1; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6345; -+ ext_irq_count = 4; -+ ext_irqs[0] = 3; -+ ext_irqs[1] = 4; -+ ext_irqs[2] = 5; -+ ext_irqs[3] = 6; -+ ext_shift = 4; - break; - case BCM6348_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6348_REG; -- irq_mask_addr[0] += PERF_IRQMASK_6348_REG; -- irq_stat_addr[1] = 0; -- irq_mask_addr[1] = 0; -- irq_bits = 32; -- ext_irq_count = 4; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6348; -+ periph_bases[0] += PERF_IRQMASK_6348_REG; -+ periph_irq_count = 1; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6348; -+ ext_irq_count = 4; -+ ext_irqs[0] = 3; -+ ext_irqs[1] = 4; -+ ext_irqs[2] = 5; -+ ext_irqs[3] = 6; -+ ext_shift = 5; - break; - case BCM6358_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6358_REG(0); -- irq_mask_addr[0] += PERF_IRQMASK_6358_REG(0); -- irq_stat_addr[1] += PERF_IRQSTAT_6358_REG(1); -- irq_mask_addr[1] += PERF_IRQMASK_6358_REG(1); -- irq_bits = 32; -- ext_irq_count = 4; -- is_ext_irq_cascaded = 1; -- ext_irq_start = BCM_6358_EXT_IRQ0 - IRQ_INTERNAL_BASE; -- ext_irq_end = BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358; -+ periph_bases[0] += PERF_IRQMASK_6358_REG(0); -+ periph_bases[1] += PERF_IRQMASK_6358_REG(1); -+ periph_irq_count = 2; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6358; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_6358_EXT_IRQ0; -+ ext_irqs[1] = BCM_6358_EXT_IRQ1; -+ ext_irqs[2] = BCM_6358_EXT_IRQ2; -+ ext_irqs[3] = BCM_6358_EXT_IRQ3; -+ ext_shift = 4; - break; - case BCM6362_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6362_REG(0); -- irq_mask_addr[0] += PERF_IRQMASK_6362_REG(0); -- irq_stat_addr[1] += PERF_IRQSTAT_6362_REG(1); -- irq_mask_addr[1] += PERF_IRQMASK_6362_REG(1); -- irq_bits = 64; -- ext_irq_count = 4; -- is_ext_irq_cascaded = 1; -- ext_irq_start = BCM_6362_EXT_IRQ0 - IRQ_INTERNAL_BASE; -- ext_irq_end = BCM_6362_EXT_IRQ3 - IRQ_INTERNAL_BASE; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6362; -+ periph_bases[0] += PERF_IRQMASK_6362_REG(0); -+ periph_bases[1] += PERF_IRQMASK_6362_REG(1); -+ periph_irq_count = 2; -+ periph_width = 2; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6362; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_6362_EXT_IRQ0; -+ ext_irqs[1] = BCM_6362_EXT_IRQ1; -+ ext_irqs[2] = BCM_6362_EXT_IRQ2; -+ ext_irqs[3] = BCM_6362_EXT_IRQ3; -+ ext_shift = 4; - break; - case BCM6368_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6368_REG(0); -- irq_mask_addr[0] += PERF_IRQMASK_6368_REG(0); -- irq_stat_addr[1] += PERF_IRQSTAT_6368_REG(1); -- irq_mask_addr[1] += PERF_IRQMASK_6368_REG(1); -- irq_bits = 64; -+ periph_bases[0] += PERF_IRQMASK_6368_REG(0); -+ periph_bases[1] += PERF_IRQMASK_6368_REG(1); -+ periph_irq_count = 2; -+ periph_width = 2; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6368; -+ ext_intc_bases[1] += PERF_EXTIRQ_CFG_REG2_6368; - ext_irq_count = 6; -- is_ext_irq_cascaded = 1; -- ext_irq_start = BCM_6368_EXT_IRQ0 - IRQ_INTERNAL_BASE; -- ext_irq_end = BCM_6368_EXT_IRQ5 - IRQ_INTERNAL_BASE; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6368; -- ext_irq_cfg_reg2 = PERF_EXTIRQ_CFG_REG2_6368; -+ ext_irqs[0] = BCM_6368_EXT_IRQ0; -+ ext_irqs[1] = BCM_6368_EXT_IRQ1; -+ ext_irqs[2] = BCM_6368_EXT_IRQ2; -+ ext_irqs[3] = BCM_6368_EXT_IRQ3; -+ ext_irqs[4] = BCM_6368_EXT_IRQ4; -+ ext_irqs[5] = BCM_6368_EXT_IRQ5; -+ ext_shift = 4; - break; - default: - BUG(); - } - -- if (irq_bits == 32) { -- dispatch_internal = __dispatch_internal_32; -- internal_irq_mask = __internal_irq_mask_32; -- internal_irq_unmask = __internal_irq_unmask_32; -- } else { -- dispatch_internal = __dispatch_internal_64; -- internal_irq_mask = __internal_irq_mask_64; -- internal_irq_unmask = __internal_irq_unmask_64; -- } --} -- --void __init arch_init_irq(void) --{ -- int i; -- -- bcm63xx_init_irq(); - mips_cpu_irq_init(); -- for (i = IRQ_INTERNAL_BASE; i < NR_IRQS; ++i) -- irq_set_chip_and_handler(i, &bcm63xx_internal_irq_chip, -- handle_level_irq); -- -- for (i = IRQ_EXTERNAL_BASE; i < IRQ_EXTERNAL_BASE + ext_irq_count; ++i) -- irq_set_chip_and_handler(i, &bcm63xx_external_irq_chip, -- handle_edge_irq); -- -- if (!is_ext_irq_cascaded) { -- for (i = 3; i < 3 + ext_irq_count; ++i) -- setup_irq(MIPS_CPU_IRQ_BASE + i, &cpu_ext_cascade_action); -- } -- -- setup_irq(MIPS_CPU_IRQ_BASE + 2, &cpu_ip2_cascade_action); --#ifdef CONFIG_SMP -- if (is_ext_irq_cascaded) { -- setup_irq(MIPS_CPU_IRQ_BASE + 3, &cpu_ip3_cascade_action); -- bcm63xx_internal_irq_chip.irq_set_affinity = -- bcm63xx_internal_set_affinity; -- -- cpumask_clear(irq_default_affinity); -- cpumask_set_cpu(smp_processor_id(), irq_default_affinity); -- } --#endif -+ bcm6345_periph_intc_init(periph_irq_count, periph_irqs, periph_bases, -+ periph_width); -+ bcm6345_ext_intc_init(4, ext_irqs, ext_intc_bases[0], ext_shift); -+ if (ext_irq_count > 4) -+ bcm6345_ext_intc_init(2, &ext_irqs[4], ext_intc_bases[1], -+ ext_shift); - } diff --git a/target/linux/brcm63xx/patches-4.4/323-MIPS-BCM63XX-wire-up-BCM6358-s-external-interrupts-4.patch b/target/linux/brcm63xx/patches-4.4/323-MIPS-BCM63XX-wire-up-BCM6358-s-external-interrupts-4.patch deleted file mode 100644 index 0796bb552..000000000 --- a/target/linux/brcm63xx/patches-4.4/323-MIPS-BCM63XX-wire-up-BCM6358-s-external-interrupts-4.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 4fd286c3e5a5bebab0391cf1937695b3ed6721a3 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 30 Nov 2014 20:20:30 +0100 -Subject: [PATCH 4/5] MIPS: BCM63XX: wire up BCM6358's external interrupts 4 - and 5 - -Due to the external interrupts being non consecutive, the previous -implementation did not support them. Now that we treat both registers -as separate irq controllers, there is no such limitation anymore and -we can expose them for drivers to use. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/irq.c | 5 ++++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 2 ++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 1 + - 3 files changed, 7 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -109,11 +109,14 @@ void __init arch_init_irq(void) - periph_width = 1; - - ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6358; -- ext_irq_count = 4; -+ ext_intc_bases[1] += PERF_EXTIRQ_CFG_REG2_6358; -+ ext_irq_count = 6; - ext_irqs[0] = BCM_6358_EXT_IRQ0; - ext_irqs[1] = BCM_6358_EXT_IRQ1; - ext_irqs[2] = BCM_6358_EXT_IRQ2; - ext_irqs[3] = BCM_6358_EXT_IRQ3; -+ ext_irqs[4] = BCM_6358_EXT_IRQ4; -+ ext_irqs[5] = BCM_6358_EXT_IRQ5; - ext_shift = 4; - break; - case BCM6362_CPU_ID: ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -895,6 +895,8 @@ enum bcm63xx_irq { - #define BCM_6358_EXT_IRQ1 (IRQ_INTERNAL_BASE + 26) - #define BCM_6358_EXT_IRQ2 (IRQ_INTERNAL_BASE + 27) - #define BCM_6358_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28) -+#define BCM_6358_EXT_IRQ4 (IRQ_INTERNAL_BASE + 20) -+#define BCM_6358_EXT_IRQ5 (IRQ_INTERNAL_BASE + 21) - - /* - * 6362 irqs ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -243,6 +243,7 @@ - #define PERF_EXTIRQ_CFG_REG_6362 0x18 - #define PERF_EXTIRQ_CFG_REG_6368 0x18 - -+#define PERF_EXTIRQ_CFG_REG2_6358 0x1c - #define PERF_EXTIRQ_CFG_REG2_6368 0x1c - - /* for 6348 only */ diff --git a/target/linux/brcm63xx/patches-4.4/330-MIPS-BCM63XX-add-a-new-cpu-variant-helper.patch b/target/linux/brcm63xx/patches-4.4/330-MIPS-BCM63XX-add-a-new-cpu-variant-helper.patch deleted file mode 100644 index 661abf6d8..000000000 --- a/target/linux/brcm63xx/patches-4.4/330-MIPS-BCM63XX-add-a-new-cpu-variant-helper.patch +++ /dev/null @@ -1,77 +0,0 @@ -From c50acd37b425a8a907a6f7f93aa2e658256e79ce Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:08:36 +0100 -Subject: [PATCH 40/53] MIPS: BCM63XX: add a new cpu variant helper - ---- - arch/mips/bcm63xx/cpu.c | 10 ++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 18 ++++++++++++++++++ - 2 files changed, 28 insertions(+) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -27,6 +27,8 @@ EXPORT_SYMBOL(bcm63xx_irqs); - u16 bcm63xx_cpu_id __read_mostly; - EXPORT_SYMBOL(bcm63xx_cpu_id); - -+static u32 bcm63xx_cpu_variant __read_mostly; -+ - static u8 bcm63xx_cpu_rev; - static unsigned int bcm63xx_cpu_freq; - static unsigned int bcm63xx_memory_size; -@@ -99,6 +101,13 @@ static const int bcm6368_irqs[] = { - - }; - -+u32 bcm63xx_get_cpu_variant(void) -+{ -+ return bcm63xx_cpu_variant; -+} -+ -+EXPORT_SYMBOL(bcm63xx_get_cpu_variant); -+ - u8 bcm63xx_get_cpu_rev(void) - { - return bcm63xx_cpu_rev; -@@ -333,6 +342,7 @@ void __init bcm63xx_cpu_init(void) - /* read out CPU type */ - tmp = bcm_readl(chipid_reg); - bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; -+ bcm63xx_cpu_variant = bcm63xx_cpu_id; - bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT; - - switch (bcm63xx_cpu_id) { ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -19,6 +19,7 @@ - #define BCM6368_CPU_ID 0x6368 - - void __init bcm63xx_cpu_init(void); -+u32 bcm63xx_get_cpu_variant(void); - u8 bcm63xx_get_cpu_rev(void); - unsigned int bcm63xx_get_cpu_freq(void); - -@@ -82,6 +83,23 @@ static inline u16 __pure bcm63xx_get_cpu - #define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID) - #define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID) - -+#define BCMCPU_VARIANT_IS_3368() \ -+ (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID) -+#define BCMCPU_VARIANT_IS_6328() \ -+ (bcm63xx_get_cpu_variant() == BCM6328_CPU_ID) -+#define BCMCPU_VARIANT_IS_6338() \ -+ (bcm63xx_get_cpu_variant() == BCM6338_CPU_ID) -+#define BCMCPU_VARIANT_IS_6345() \ -+ (bcm63xx_get_cpu_variant() == BCM6345_CPU_ID) -+#define BCMCPU_VARIANT_IS_6348() \ -+ (bcm63xx_get_cpu_variant() == BCM6348_CPU_ID) -+#define BCMCPU_VARIANT_IS_6358() \ -+ (bcm63xx_get_cpu_cariant() == BCM6358_CPU_ID) -+#define BCMCPU_VARIANT_IS_6362() \ -+ (bcm63xx_get_cpu_variant() == BCM6362_CPU_ID) -+#define BCMCPU_VARIANT_IS_6368() \ -+ (bcm63xx_get_cpu_variant() == BCM6368_CPU_ID) -+ - /* - * While registers sets are (mostly) the same across 63xx CPU, base - * address of these sets do change. diff --git a/target/linux/brcm63xx/patches-4.4/331-MIPS-BCM63XX-define-variant-id-field.patch b/target/linux/brcm63xx/patches-4.4/331-MIPS-BCM63XX-define-variant-id-field.patch deleted file mode 100644 index 2e21c6500..000000000 --- a/target/linux/brcm63xx/patches-4.4/331-MIPS-BCM63XX-define-variant-id-field.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 3bd8e2535265f06f79ed9c0ad788405441e091dc Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:22:41 +0100 -Subject: [PATCH 21/45] MIPS: BCM63XX: define variant id field - -Some SoC have a variant id field in the chip id register. - -Signed-off-by: Jonas Gorski ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -9,6 +9,8 @@ - #define PERF_REV_REG 0x0 - #define REV_CHIPID_SHIFT 16 - #define REV_CHIPID_MASK (0xffff << REV_CHIPID_SHIFT) -+#define REV_VARID_SHIFT 12 -+#define REV_VARID_MASK (0xf << REV_VARID_SHIFT) - #define REV_REVID_SHIFT 0 - #define REV_REVID_MASK (0xff << REV_REVID_SHIFT) - diff --git a/target/linux/brcm63xx/patches-4.4/332-MIPS-BCM63XX-detect-BCM6328-variants.patch b/target/linux/brcm63xx/patches-4.4/332-MIPS-BCM63XX-detect-BCM6328-variants.patch deleted file mode 100644 index faa002e1e..000000000 --- a/target/linux/brcm63xx/patches-4.4/332-MIPS-BCM63XX-detect-BCM6328-variants.patch +++ /dev/null @@ -1,68 +0,0 @@ -From d59120f23279ef62a48d9f94847254b061d0a8b6 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:30:59 +0100 -Subject: [PATCH 22/45] MIPS: BCM63XX: detect BCM6328 variants - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/cpu.c | 10 ++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 8 ++++++-- - 2 files changed, 16 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -305,6 +305,7 @@ void __init bcm63xx_cpu_init(void) - unsigned int tmp; - unsigned int cpu = smp_processor_id(); - u32 chipid_reg; -+ u8 __maybe_unused varid = 0; - - /* soc registers location depends on cpu type */ - chipid_reg = 0; -@@ -344,6 +345,7 @@ void __init bcm63xx_cpu_init(void) - bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; - bcm63xx_cpu_variant = bcm63xx_cpu_id; - bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT; -+ varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT; - - switch (bcm63xx_cpu_id) { - case BCM3368_CPU_ID: -@@ -353,6 +355,14 @@ void __init bcm63xx_cpu_init(void) - case BCM6328_CPU_ID: - bcm63xx_regs_base = bcm6328_regs_base; - bcm63xx_irqs = bcm6328_irqs; -+ -+ if (varid == 1) -+ bcm63xx_cpu_variant = BCM63281_CPU_ID; -+ else if (varid == 3) -+ bcm63xx_cpu_variant = BCM63283_CPU_ID; -+ else -+ pr_warn("unknown BCM6328 variant: %x\n", varid); -+ - break; - case BCM6338_CPU_ID: - bcm63xx_regs_base = bcm6338_regs_base; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -11,6 +11,8 @@ - */ - #define BCM3368_CPU_ID 0x3368 - #define BCM6328_CPU_ID 0x6328 -+#define BCM63281_CPU_ID 0x63281 -+#define BCM63283_CPU_ID 0x63283 - #define BCM6338_CPU_ID 0x6338 - #define BCM6345_CPU_ID 0x6345 - #define BCM6348_CPU_ID 0x6348 -@@ -85,8 +87,10 @@ static inline u16 __pure bcm63xx_get_cpu - - #define BCMCPU_VARIANT_IS_3368() \ - (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID) --#define BCMCPU_VARIANT_IS_6328() \ -- (bcm63xx_get_cpu_variant() == BCM6328_CPU_ID) -+#define BCMCPU_VARIANT_IS_63281() \ -+ (bcm63xx_get_cpu_variant() == BCM63281_CPU_ID) -+#define BCMCPU_VARIANT_IS_63283() \ -+ (bcm63xx_get_cpu_variant() == BCM63283_CPU_ID) - #define BCMCPU_VARIANT_IS_6338() \ - (bcm63xx_get_cpu_variant() == BCM6338_CPU_ID) - #define BCMCPU_VARIANT_IS_6345() \ diff --git a/target/linux/brcm63xx/patches-4.4/333-MIPS-BCM63XX-detect-BCM6362-variants.patch b/target/linux/brcm63xx/patches-4.4/333-MIPS-BCM63XX-detect-BCM6362-variants.patch deleted file mode 100644 index 62ce12eda..000000000 --- a/target/linux/brcm63xx/patches-4.4/333-MIPS-BCM63XX-detect-BCM6362-variants.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 04458c3db8eb79da21ecde40ab36a1dde52bef06 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:33:28 +0100 -Subject: [PATCH 23/45] MIPS: BCM63XX: detect BCM6362 variants - ---- - arch/mips/bcm63xx/cpu.c | 8 ++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 3 +++ - 2 files changed, 11 insertions(+) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -383,6 +383,14 @@ void __init bcm63xx_cpu_init(void) - case BCM6362_CPU_ID: - bcm63xx_regs_base = bcm6362_regs_base; - bcm63xx_irqs = bcm6362_irqs; -+ -+ if (varid == 1) -+ bcm63xx_cpu_variant = BCM6362_CPU_ID; -+ else if (varid == 2) -+ bcm63xx_cpu_variant = BCM6361_CPU_ID; -+ else -+ pr_warn("unknown BCM6362 variant: %x\n", varid); -+ - break; - case BCM6368_CPU_ID: - bcm63xx_regs_base = bcm6368_regs_base; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -17,6 +17,7 @@ - #define BCM6345_CPU_ID 0x6345 - #define BCM6348_CPU_ID 0x6348 - #define BCM6358_CPU_ID 0x6358 -+#define BCM6361_CPU_ID 0x6361 - #define BCM6362_CPU_ID 0x6362 - #define BCM6368_CPU_ID 0x6368 - -@@ -99,6 +100,8 @@ static inline u16 __pure bcm63xx_get_cpu - (bcm63xx_get_cpu_variant() == BCM6348_CPU_ID) - #define BCMCPU_VARIANT_IS_6358() \ - (bcm63xx_get_cpu_cariant() == BCM6358_CPU_ID) -+#define BCMCPU_VARIANT_IS_6361() \ -+ (bcm63xx_get_cpu_variant() == BCM6361_CPU_ID) - #define BCMCPU_VARIANT_IS_6362() \ - (bcm63xx_get_cpu_variant() == BCM6362_CPU_ID) - #define BCMCPU_VARIANT_IS_6368() \ diff --git a/target/linux/brcm63xx/patches-4.4/334-MIPS-BCM63XX-detect-BCM6368-variants.patch b/target/linux/brcm63xx/patches-4.4/334-MIPS-BCM63XX-detect-BCM6368-variants.patch deleted file mode 100644 index a993e238e..000000000 --- a/target/linux/brcm63xx/patches-4.4/334-MIPS-BCM63XX-detect-BCM6368-variants.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 825cc67e56b5e624a05f6850a86d91508b786848 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:36:56 +0100 -Subject: [PATCH 24/44] MIPS: BCM63XX: detect BCM6368 variants - -The DSL-less BCM6368 variant BCM6367 uses a different chip id. Apart -from missing DSL, there is no difference to BCM6368, so treat it such. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/cpu.c | 4 ++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 3 +++ - 2 files changed, 7 insertions(+) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -393,8 +393,12 @@ void __init bcm63xx_cpu_init(void) - - break; - case BCM6368_CPU_ID: -+ case BCM6369_CPU_ID: - bcm63xx_regs_base = bcm6368_regs_base; - bcm63xx_irqs = bcm6368_irqs; -+ -+ /* BCM6369 is a BCM6368 without xDSL, so treat it the same */ -+ bcm63xx_cpu_id = BCM6368_CPU_ID; - break; - default: - panic("unsupported broadcom CPU %x", bcm63xx_cpu_id); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -20,6 +20,7 @@ - #define BCM6361_CPU_ID 0x6361 - #define BCM6362_CPU_ID 0x6362 - #define BCM6368_CPU_ID 0x6368 -+#define BCM6369_CPU_ID 0x6369 - - void __init bcm63xx_cpu_init(void); - u32 bcm63xx_get_cpu_variant(void); -@@ -106,6 +107,8 @@ static inline u16 __pure bcm63xx_get_cpu - (bcm63xx_get_cpu_variant() == BCM6362_CPU_ID) - #define BCMCPU_VARIANT_IS_6368() \ - (bcm63xx_get_cpu_variant() == BCM6368_CPU_ID) -+#define BCMCPU_VARIANT_IS_6369() \ -+ (bcm63xx_get_cpu_variant() == BCM6369_CPU_ID) - - /* - * While registers sets are (mostly) the same across 63xx CPU, base diff --git a/target/linux/brcm63xx/patches-4.4/335-MIPS-BCM63XX-fix-PCIe-memory-window-size.patch b/target/linux/brcm63xx/patches-4.4/335-MIPS-BCM63XX-fix-PCIe-memory-window-size.patch deleted file mode 100644 index 3230add27..000000000 --- a/target/linux/brcm63xx/patches-4.4/335-MIPS-BCM63XX-fix-PCIe-memory-window-size.patch +++ /dev/null @@ -1,20 +0,0 @@ -From f67f8134b4537c8bbafe7e1975edfe808b813997 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 03:05:54 +0100 -Subject: [PATCH 45/53] MIPS: BCM63XX: fix PCIe memory window size - ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -41,7 +41,7 @@ - BCM_CB_MEM_SIZE - 1) - - #define BCM_PCIE_MEM_BASE_PA 0x10f00000 --#define BCM_PCIE_MEM_SIZE (16 * 1024 * 1024) -+#define BCM_PCIE_MEM_SIZE (1 * 1024 * 1024) - #define BCM_PCIE_MEM_END_PA (BCM_PCIE_MEM_BASE_PA + \ - BCM_PCIE_MEM_SIZE - 1) - diff --git a/target/linux/brcm63xx/patches-4.4/336-MIPS-BCM63XX-dynamically-set-the-pcie-memory-windows.patch b/target/linux/brcm63xx/patches-4.4/336-MIPS-BCM63XX-dynamically-set-the-pcie-memory-windows.patch deleted file mode 100644 index d6eb54d2e..000000000 --- a/target/linux/brcm63xx/patches-4.4/336-MIPS-BCM63XX-dynamically-set-the-pcie-memory-windows.patch +++ /dev/null @@ -1,70 +0,0 @@ -From aa05464973bc176478af462ca7c53a9239c651d4 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 03:13:06 +0100 -Subject: [PATCH 46/53] MIPS: BCM63XX: dynamically set the pcie memory windows - -Different SoCs use different memory windows (and sizes), so don't -hardcode it. ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | 8 ++++---- - arch/mips/pci/pci-bcm63xx.c | 15 ++++++++++----- - 2 files changed, 14 insertions(+), 9 deletions(-) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -40,10 +40,10 @@ - #define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \ - BCM_CB_MEM_SIZE - 1) - --#define BCM_PCIE_MEM_BASE_PA 0x10f00000 --#define BCM_PCIE_MEM_SIZE (1 * 1024 * 1024) --#define BCM_PCIE_MEM_END_PA (BCM_PCIE_MEM_BASE_PA + \ -- BCM_PCIE_MEM_SIZE - 1) -+#define BCM_PCIE_MEM_BASE_PA_6328 0x10f00000 -+#define BCM_PCIE_MEM_SIZE_6328 (1 * 1024 * 1024) -+#define BCM_PCIE_MEM_END_PA_6328 (BCM_PCIE_MEM_BASE_PA_6328 + \ -+ BCM_PCIE_MEM_SIZE_6328 - 1) - - /* - * Internal registers are accessed through KSEG3 ---- a/arch/mips/pci/pci-bcm63xx.c -+++ b/arch/mips/pci/pci-bcm63xx.c -@@ -77,8 +77,8 @@ struct pci_controller bcm63xx_cb_control - - static struct resource bcm_pcie_mem_resource = { - .name = "bcm63xx PCIe memory space", -- .start = BCM_PCIE_MEM_BASE_PA, -- .end = BCM_PCIE_MEM_END_PA, -+ .start = 0, -+ .end = 0, - .flags = IORESOURCE_MEM, - }; - -@@ -195,12 +195,12 @@ static int __init bcm63xx_register_pcie( - bcm_pcie_writel(val, PCIE_CONFIG2_REG); - - /* set bar0 to little endian */ -- val = (BCM_PCIE_MEM_BASE_PA >> 20) << BASEMASK_BASE_SHIFT; -- val |= (BCM_PCIE_MEM_BASE_PA >> 20) << BASEMASK_MASK_SHIFT; -+ val = (bcm_pcie_mem_resource.start >> 20) << BASEMASK_BASE_SHIFT; -+ val |= (bcm_pcie_mem_resource.end >> 20) << BASEMASK_MASK_SHIFT; - val |= BASEMASK_REMAP_EN; - bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_BASEMASK_REG); - -- val = (BCM_PCIE_MEM_BASE_PA >> 20) << REBASE_ADDR_BASE_SHIFT; -+ val = (bcm_pcie_mem_resource.start >> 20) << REBASE_ADDR_BASE_SHIFT; - bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_REBASE_ADDR_REG); - - register_pci_controller(&bcm63xx_pcie_controller); -@@ -334,6 +334,11 @@ static int __init bcm63xx_pci_init(void) - if (!bcm63xx_pci_enabled) - return -ENODEV; - -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { -+ bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_6328; -+ bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_6328; -+ } -+ - switch (bcm63xx_get_cpu_id()) { - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: diff --git a/target/linux/brcm63xx/patches-4.4/337-MIPS-BCM63XX-widen-cpuid-field.patch b/target/linux/brcm63xx/patches-4.4/337-MIPS-BCM63XX-widen-cpuid-field.patch deleted file mode 100644 index 0ead82e86..000000000 --- a/target/linux/brcm63xx/patches-4.4/337-MIPS-BCM63XX-widen-cpuid-field.patch +++ /dev/null @@ -1,56 +0,0 @@ -From f1477f6e3551fd6beecfee5368fed1325dcd421f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:54:51 +0100 -Subject: [PATCH 47/53] MIPS: BCM63XX: widen cpuid field - ---- - arch/mips/bcm63xx/cpu.c | 2 +- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 8 ++++---- - 2 files changed, 5 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -24,7 +24,7 @@ EXPORT_SYMBOL(bcm63xx_regs_base); - const int *bcm63xx_irqs; - EXPORT_SYMBOL(bcm63xx_irqs); - --u16 bcm63xx_cpu_id __read_mostly; -+u32 bcm63xx_cpu_id __read_mostly; - EXPORT_SYMBOL(bcm63xx_cpu_id); - - static u32 bcm63xx_cpu_variant __read_mostly; -@@ -127,7 +127,7 @@ unsigned int bcm63xx_get_memory_size(voi - - static unsigned int detect_cpu_clock(void) - { -- u16 cpu_id = bcm63xx_get_cpu_id(); -+ u32 cpu_id = bcm63xx_get_cpu_id(); - - switch (cpu_id) { - case BCM3368_CPU_ID: ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -27,7 +27,7 @@ u32 bcm63xx_get_cpu_variant(void); - u8 bcm63xx_get_cpu_rev(void); - unsigned int bcm63xx_get_cpu_freq(void); - --static inline u16 __pure __bcm63xx_get_cpu_id(const u16 cpu_id) -+static inline u32 __pure __bcm63xx_get_cpu_id(const u32 cpu_id) - { - switch (cpu_id) { - #ifdef CONFIG_BCM63XX_CPU_3368 -@@ -69,11 +69,11 @@ static inline u16 __pure __bcm63xx_get_c - return cpu_id; - } - --extern u16 bcm63xx_cpu_id; -+extern u32 bcm63xx_cpu_id; - --static inline u16 __pure bcm63xx_get_cpu_id(void) -+static inline u32 __pure bcm63xx_get_cpu_id(void) - { -- const u16 cpu_id = bcm63xx_cpu_id; -+ const u32 cpu_id = bcm63xx_cpu_id; - - return __bcm63xx_get_cpu_id(cpu_id); - } diff --git a/target/linux/brcm63xx/patches-4.4/338-MIPS-BCM63XX-increase-number-of-IRQs.patch b/target/linux/brcm63xx/patches-4.4/338-MIPS-BCM63XX-increase-number-of-IRQs.patch deleted file mode 100644 index 9132e4231..000000000 --- a/target/linux/brcm63xx/patches-4.4/338-MIPS-BCM63XX-increase-number-of-IRQs.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 6f5658c845cf1f79213b1d20423a04967259fdaa Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 15 Dec 2013 20:46:26 +0100 -Subject: [PATCH 48/53] MIPS: BCM63XX: increase number of IRQs - -Newer SoCs have 128 bit wide irq registers, thus 128 available internal -interupts. ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h | 4 +++- - arch/mips/include/asm/mach-bcm63xx/irq.h | 2 +- - 2 files changed, 4 insertions(+), 2 deletions(-) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h -@@ -1,10 +1,12 @@ - #ifndef BCM63XX_IRQ_H_ - #define BCM63XX_IRQ_H_ - -+#include - #include - - #define IRQ_INTERNAL_BASE 8 --#define IRQ_EXTERNAL_BASE 100 -+#define NR_INTERNAL_IRQS 128 -+#define IRQ_EXTERNAL_BASE (IRQ_INTERNAL_BASE + NR_INTERNAL_IRQS) - #define IRQ_EXT_0 (IRQ_EXTERNAL_BASE + 0) - #define IRQ_EXT_1 (IRQ_EXTERNAL_BASE + 1) - #define IRQ_EXT_2 (IRQ_EXTERNAL_BASE + 2) ---- a/arch/mips/include/asm/mach-bcm63xx/irq.h -+++ b/arch/mips/include/asm/mach-bcm63xx/irq.h -@@ -1,7 +1,7 @@ - #ifndef __ASM_MACH_BCM63XX_IRQ_H - #define __ASM_MACH_BCM63XX_IRQ_H - --#define NR_IRQS 128 -+#define NR_IRQS 256 - #define MIPS_CPU_IRQ_BASE 0 - - #endif diff --git a/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch b/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch deleted file mode 100644 index 05922bd58..000000000 --- a/target/linux/brcm63xx/patches-4.4/339-MIPS-BCM63XX-add-support-for-BCM63268.patch +++ /dev/null @@ -1,737 +0,0 @@ -From 98f63141190ac02c58b78d58f771bd263c61d756 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 17:14:17 +0100 -Subject: [PATCH 48/56] MIPS: BCM63XX: add support for BCM63268 - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/Kconfig | 5 + - arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- - arch/mips/bcm63xx/clk.c | 25 ++++- - arch/mips/bcm63xx/cpu.c | 59 +++++++++- - arch/mips/bcm63xx/dev-flash.c | 6 + - arch/mips/bcm63xx/dev-spi.c | 4 +- - arch/mips/bcm63xx/irq.c | 20 +++- - arch/mips/bcm63xx/reset.c | 21 ++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 130 ++++++++++++++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h | 2 + - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 79 +++++++++++++ - arch/mips/include/asm/mach-bcm63xx/ioremap.h | 1 + - 12 files changed, 342 insertions(+), 12 deletions(-) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -60,6 +60,11 @@ config BCM63XX_CPU_6368 - select HW_HAS_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ -+config BCM63XX_CPU_63268 -+ bool "support 63268 CPU" -+ select SYS_HAS_CPU_BMIPS4350 -+ select HW_HAS_PCI - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -713,7 +713,7 @@ void __init board_prom_init(void) - /* read base address of boot chip select (0) - * 6328/6362 do not have MPI but boot from a fixed address - */ -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) { - val = 0x18000000; - } else { - val = bcm_mpi_readl(MPI_CSBASE_REG(0)); ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -168,6 +168,8 @@ static void enetsw_set(struct clk *clk, - clk_disable_unlocked(&clk_swpkt_sar); - } - bcm_hwclock_set(CKCTL_6368_ROBOSW_EN, enable); -+ } else if (BCMCPU_IS_63268()) { -+ bcm_hwclock_set(CKCTL_63268_ROBOSW_EN, enable); - } else { - return; - } -@@ -213,6 +215,8 @@ static void usbh_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6362_USBH_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); -+ else if (BCMCPU_IS_63268()) -+ bcm_hwclock_set(CKCTL_63268_USBH_EN, enable); - else - return; - -@@ -235,6 +239,8 @@ static void usbd_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6362_USBD_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_USBD_EN, enable); -+ else if (BCMCPU_IS_63268()) -+ bcm_hwclock_set(CKCTL_63268_USBD_EN, enable); - else - return; - -@@ -261,9 +267,13 @@ static void spi_set(struct clk *clk, int - mask = CKCTL_6358_SPI_EN; - else if (BCMCPU_IS_6362()) - mask = CKCTL_6362_SPI_EN; -- else -- /* BCMCPU_IS_6368 */ -+ else if (BCMCPU_IS_6368()) - mask = CKCTL_6368_SPI_EN; -+ else if (BCMCPU_IS_63268()) -+ mask = CKCTL_63268_SPI_EN; -+ else -+ return; -+ - bcm_hwclock_set(mask, enable); - } - -@@ -282,6 +292,8 @@ static void hsspi_set(struct clk *clk, i - mask = CKCTL_6328_HSSPI_EN; - else if (BCMCPU_IS_6362()) - mask = CKCTL_6362_HSSPI_EN; -+ else if (BCMCPU_IS_63268()) -+ mask = CKCTL_63268_HSSPI_EN; - else - return; - -@@ -351,6 +363,8 @@ static void pcie_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable); - else if (BCMCPU_IS_6362()) - bcm_hwclock_set(CKCTL_6362_PCIE_EN, enable); -+ else if (BCMCPU_IS_63268()) -+ bcm_hwclock_set(CKCTL_63268_PCIE_EN, enable); - } - - static struct clk clk_pcie = { -@@ -532,6 +546,21 @@ static struct clk_lookup bcm6368_clks[] - CLKDEV_INIT(NULL, "ipsec", &clk_ipsec), - }; - -+static struct clk_lookup bcm63268_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT(NULL, "hsspi", &clk_hsspi), -+ CLKDEV_INIT(NULL, "pcie", &clk_pcie), -+}; -+ - #define HSSPI_PLL_HZ_6328 133333333 - #define HSSPI_PLL_HZ_6362 400000000 - -@@ -564,6 +593,10 @@ static int __init bcm63xx_clk_init(void) - case BCM6368_CPU_ID: - clkdev_add_table(bcm6368_clks, ARRAY_SIZE(bcm6368_clks)); - break; -+ case BCM63268_CPU_ID: -+ clk_hsspi_pll.rate = HSSPI_PLL_HZ_6362; -+ clkdev_add_table(bcm63268_clks, ARRAY_SIZE(bcm63268_clks)); -+ break; - } - - return 0; ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -101,6 +101,15 @@ static const int bcm6368_irqs[] = { - - }; - -+static const unsigned long bcm63268_regs_base[] = { -+ __GEN_CPU_REGS_TABLE(63268) -+}; -+ -+static const int bcm63268_irqs[] = { -+ __GEN_CPU_IRQ_TABLE(63268) -+ -+}; -+ - u32 bcm63xx_get_cpu_variant(void) - { - return bcm63xx_cpu_variant; -@@ -253,6 +262,27 @@ static unsigned int detect_cpu_clock(voi - - return (((64 * 1000000) / p1) * p2 * ndiv) / m1; - } -+ case BCM63268_CPU_ID: -+ { -+ unsigned int tmp, mips_pll_fcvo; -+ -+ tmp = bcm_misc_readl(MISC_STRAPBUS_63268_REG); -+ mips_pll_fcvo = (tmp & STRAPBUS_63268_FCVO_MASK) >> -+ STRAPBUS_63268_FCVO_SHIFT; -+ switch (mips_pll_fcvo) { -+ case 0x3: -+ case 0xe: -+ return 320000000; -+ case 0xa: -+ return 333000000; -+ case 0x2: -+ case 0xb: -+ case 0xf: -+ return 400000000; -+ default: -+ return 0; -+ } -+ } - - default: - panic("Failed to detect clock for CPU with id=%04X\n", cpu_id); -@@ -267,7 +297,7 @@ static unsigned int detect_memory_size(v - unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; - u32 val; - -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) - return bcm_ddr_readl(DDR_CSEND_REG) << 24; - - if (BCMCPU_IS_6345()) { -@@ -305,6 +335,7 @@ void __init bcm63xx_cpu_init(void) - unsigned int tmp; - unsigned int cpu = smp_processor_id(); - u32 chipid_reg; -+ bool long_chipid = false; - u8 __maybe_unused varid = 0; - - /* soc registers location depends on cpu type */ -@@ -326,6 +357,9 @@ void __init bcm63xx_cpu_init(void) - case 0x10: - chipid_reg = BCM_6345_PERF_BASE; - break; -+ case 0x80: -+ long_chipid = true; -+ /* fall-through */ - default: - chipid_reg = BCM_6368_PERF_BASE; - break; -@@ -333,6 +367,7 @@ void __init bcm63xx_cpu_init(void) - break; - } - -+ - /* - * really early to panic, but delaying panic would not help since we - * will never get any working console -@@ -342,10 +377,17 @@ void __init bcm63xx_cpu_init(void) - - /* read out CPU type */ - tmp = bcm_readl(chipid_reg); -- bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; -- bcm63xx_cpu_variant = bcm63xx_cpu_id; -+ -+ if (long_chipid) { -+ bcm63xx_cpu_id = tmp & REV_LONG_CHIPID_MASK; -+ bcm63xx_cpu_id >>= REV_LONG_CHIPID_SHIFT; -+ } else { -+ bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; -+ varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT; -+ } -+ - bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT; -- varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT; -+ bcm63xx_cpu_variant = bcm63xx_cpu_id; - - switch (bcm63xx_cpu_id) { - case BCM3368_CPU_ID: -@@ -400,6 +442,15 @@ void __init bcm63xx_cpu_init(void) - /* BCM6369 is a BCM6368 without xDSL, so treat it the same */ - bcm63xx_cpu_id = BCM6368_CPU_ID; - break; -+ case BCM63168_CPU_ID: -+ case BCM63169_CPU_ID: -+ case BCM63268_CPU_ID: -+ case BCM63269_CPU_ID: -+ bcm63xx_regs_base = bcm63268_regs_base; -+ bcm63xx_irqs = bcm63268_irqs; -+ -+ bcm63xx_cpu_id = BCM63268_CPU_ID; -+ break; - default: - panic("unsupported broadcom CPU %x", bcm63xx_cpu_id); - break; ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -94,6 +94,12 @@ static int __init bcm63xx_detect_flash_t - case STRAPBUS_6368_BOOT_SEL_PARALLEL: - return BCM63XX_FLASH_TYPE_PARALLEL; - } -+ case BCM63268_CPU_ID: -+ val = bcm_misc_readl(MISC_STRAPBUS_63268_REG); -+ if (val & STRAPBUS_63268_BOOT_SEL_SERIAL) -+ return BCM63XX_FLASH_TYPE_SERIAL; -+ else -+ return BCM63XX_FLASH_TYPE_NAND; - default: - return -EINVAL; - } ---- a/arch/mips/bcm63xx/dev-spi.c -+++ b/arch/mips/bcm63xx/dev-spi.c -@@ -51,7 +51,7 @@ int __init bcm63xx_spi_register(void) - } - - if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() || -- BCMCPU_IS_6368()) { -+ BCMCPU_IS_6368() || BCMCPU_IS_63268()) { - bcm63xx_spi_device.name = "bcm6358-spi", - spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1; - } ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -150,6 +150,20 @@ void __init arch_init_irq(void) - ext_irqs[5] = BCM_6368_EXT_IRQ5; - ext_shift = 4; - break; -+ case BCM63268_CPU_ID: -+ periph_bases[0] += PERF_IRQMASK_63268_REG(0); -+ periph_bases[1] += PERF_IRQMASK_63268_REG(1); -+ periph_irq_count = 2; -+ periph_width = 4; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_63268; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_63268_EXT_IRQ0; -+ ext_irqs[1] = BCM_63268_EXT_IRQ1; -+ ext_irqs[2] = BCM_63268_EXT_IRQ2; -+ ext_irqs[3] = BCM_63268_EXT_IRQ3; -+ ext_shift = 4; -+ break; - default: - BUG(); - } ---- a/arch/mips/bcm63xx/reset.c -+++ b/arch/mips/bcm63xx/reset.c -@@ -125,6 +125,20 @@ - #define BCM6368_RESET_PCIE 0 - #define BCM6368_RESET_PCIE_EXT 0 - -+#define BCM63268_RESET_SPI SOFTRESET_63268_SPI_MASK -+#define BCM63268_RESET_ENET 0 -+#define BCM63268_RESET_USBH SOFTRESET_63268_USBH_MASK -+#define BCM63268_RESET_USBD SOFTRESET_63268_USBS_MASK -+#define BCM63268_RESET_DSL 0 -+#define BCM63268_RESET_SAR SOFTRESET_63268_SAR_MASK -+#define BCM63268_RESET_EPHY 0 -+#define BCM63268_RESET_ENETSW SOFTRESET_63268_ENETSW_MASK -+#define BCM63268_RESET_PCM SOFTRESET_63268_PCM_MASK -+#define BCM63268_RESET_MPI 0 -+#define BCM63268_RESET_PCIE (SOFTRESET_63268_PCIE_MASK | \ -+ SOFTRESET_63268_PCIE_CORE_MASK) -+#define BCM63268_RESET_PCIE_EXT SOFTRESET_63268_PCIE_EXT_MASK -+ - /* - * core reset bits - */ -@@ -156,6 +170,10 @@ static const u32 bcm6368_reset_bits[] = - __GEN_RESET_BITS_TABLE(6368) - }; - -+static const u32 bcm63268_reset_bits[] = { -+ __GEN_RESET_BITS_TABLE(63268) -+}; -+ - const u32 *bcm63xx_reset_bits; - static int reset_reg; - -@@ -182,6 +200,9 @@ static int __init bcm63xx_reset_bits_ini - } else if (BCMCPU_IS_6368()) { - reset_reg = PERF_SOFTRESET_6368_REG; - bcm63xx_reset_bits = bcm6368_reset_bits; -+ } else if (BCMCPU_IS_63268()) { -+ reset_reg = PERF_SOFTRESET_63268_REG; -+ bcm63xx_reset_bits = bcm63268_reset_bits; - } - - return 0; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -21,6 +21,10 @@ - #define BCM6362_CPU_ID 0x6362 - #define BCM6368_CPU_ID 0x6368 - #define BCM6369_CPU_ID 0x6369 -+#define BCM63168_CPU_ID 0x63168 -+#define BCM63169_CPU_ID 0x63169 -+#define BCM63268_CPU_ID 0x63268 -+#define BCM63269_CPU_ID 0x63269 - - void __init bcm63xx_cpu_init(void); - u32 bcm63xx_get_cpu_variant(void); -@@ -61,6 +65,10 @@ static inline u32 __pure __bcm63xx_get_c - #ifdef CONFIG_BCM63XX_CPU_6368 - case BCM6368_CPU_ID: - #endif -+ -+#ifdef CONFIG_BCM63XX_CPU_63268 -+ case BCM63268_CPU_ID: -+#endif - break; - default: - unreachable(); -@@ -86,6 +94,7 @@ static inline u32 __pure bcm63xx_get_cpu - #define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID) - #define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID) - #define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID) -+#define BCMCPU_IS_63268() (bcm63xx_get_cpu_id() == BCM63268_CPU_ID) - - #define BCMCPU_VARIANT_IS_3368() \ - (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID) -@@ -109,6 +118,14 @@ static inline u32 __pure bcm63xx_get_cpu - (bcm63xx_get_cpu_variant() == BCM6368_CPU_ID) - #define BCMCPU_VARIANT_IS_6369() \ - (bcm63xx_get_cpu_variant() == BCM6369_CPU_ID) -+#define BCMCPU_VARIANT_IS_63168() \ -+ (bcm63xx_get_cpu_variant() == BCM63168_CPU_ID) -+#define BCMCPU_VARIANT_IS_63169() \ -+ (bcm63xx_get_cpu_variant() == BCM63169_CPU_ID) -+#define BCMCPU_VARIANT_IS_63268() \ -+ (bcm63xx_get_cpu_variant() == BCM63268_CPU_ID) -+#define BCMCPU_VARIANT_IS_63269() \ -+ (bcm63xx_get_cpu_variant() == BCM63269_CPU_ID) - - /* - * While registers sets are (mostly) the same across 63xx CPU, base -@@ -573,6 +590,52 @@ enum bcm63xx_regs_set { - #define BCM_6368_RNG_BASE (0xb0004180) - #define BCM_6368_MISC_BASE (0xdeadbeef) - -+/* -+ * 63268 register sets base address -+ */ -+#define BCM_63268_DSL_LMEM_BASE (0xdeadbeef) -+#define BCM_63268_PERF_BASE (0xb0000000) -+#define BCM_63268_TIMER_BASE (0xb0000080) -+#define BCM_63268_WDT_BASE (0xb000009c) -+#define BCM_63268_UART0_BASE (0xb0000180) -+#define BCM_63268_UART1_BASE (0xb00001a0) -+#define BCM_63268_GPIO_BASE (0xb00000c0) -+#define BCM_63268_SPI_BASE (0xb0000800) -+#define BCM_63268_HSSPI_BASE (0xb0001000) -+#define BCM_63268_UDC0_BASE (0xdeadbeef) -+#define BCM_63268_USBDMA_BASE (0xb000c800) -+#define BCM_63268_OHCI0_BASE (0xb0002600) -+#define BCM_63268_OHCI_PRIV_BASE (0xdeadbeef) -+#define BCM_63268_USBH_PRIV_BASE (0xb0002700) -+#define BCM_63268_USBD_BASE (0xb0002400) -+#define BCM_63268_MPI_BASE (0xdeadbeef) -+#define BCM_63268_PCMCIA_BASE (0xdeadbeef) -+#define BCM_63268_PCIE_BASE (0xb06e0000) -+#define BCM_63268_SDRAM_REGS_BASE (0xdeadbeef) -+#define BCM_63268_DSL_BASE (0xdeadbeef) -+#define BCM_63268_UBUS_BASE (0xdeadbeef) -+#define BCM_63268_ENET0_BASE (0xdeadbeef) -+#define BCM_63268_ENET1_BASE (0xdeadbeef) -+#define BCM_63268_ENETDMA_BASE (0xb000d800) -+#define BCM_63268_ENETDMAC_BASE (0xb000da00) -+#define BCM_63268_ENETDMAS_BASE (0xb000dc00) -+#define BCM_63268_ENETSW_BASE (0xb0700000) -+#define BCM_63268_EHCI0_BASE (0xb0002500) -+#define BCM_63268_SDRAM_BASE (0xdeadbeef) -+#define BCM_63268_MEMC_BASE (0xdeadbeef) -+#define BCM_63268_DDR_BASE (0xb0003000) -+#define BCM_63268_M2M_BASE (0xdeadbeef) -+#define BCM_63268_ATM_BASE (0xdeadbeef) -+#define BCM_63268_XTM_BASE (0xb0007000) -+#define BCM_63268_XTMDMA_BASE (0xb000b800) -+#define BCM_63268_XTMDMAC_BASE (0xdeadbeef) -+#define BCM_63268_XTMDMAS_BASE (0xdeadbeef) -+#define BCM_63268_PCM_BASE (0xb000b000) -+#define BCM_63268_PCMDMA_BASE (0xb000b800) -+#define BCM_63268_PCMDMAC_BASE (0xdeadbeef) -+#define BCM_63268_PCMDMAS_BASE (0xdeadbeef) -+#define BCM_63268_RNG_BASE (0xdeadbeef) -+#define BCM_63268_MISC_BASE (0xb0001800) - - extern const unsigned long *bcm63xx_regs_base; - -@@ -1041,6 +1104,73 @@ enum bcm63xx_irq { - #define BCM_6368_EXT_IRQ4 (IRQ_INTERNAL_BASE + 24) - #define BCM_6368_EXT_IRQ5 (IRQ_INTERNAL_BASE + 25) - -+/* -+ * 63268 irqs -+ */ -+#define BCM_63268_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) -+#define BCM_63268_VERY_HIGH_IRQ_BASE (BCM_63268_HIGH_IRQ_BASE + 32) -+ -+#define BCM_63268_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) -+#define BCM_63268_SPI_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 16) -+#define BCM_63268_UART0_IRQ (IRQ_INTERNAL_BASE + 5) -+#define BCM_63268_UART1_IRQ (BCM_63268_HIGH_IRQ_BASE + 2) -+#define BCM_63268_DSL_IRQ (IRQ_INTERNAL_BASE + 23) -+#define BCM_63268_UDC0_IRQ 0 -+#define BCM_63268_ENET0_IRQ 0 -+#define BCM_63268_ENET1_IRQ 0 -+#define BCM_63268_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 13) -+#define BCM_63268_HSSPI_IRQ (IRQ_INTERNAL_BASE + 6) -+#define BCM_63268_OHCI0_IRQ (IRQ_INTERNAL_BASE + 9) -+#define BCM_63268_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10) -+#define BCM_63268_USBD_IRQ (IRQ_INTERNAL_BASE + 11) -+#define BCM_63268_USBD_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 19) -+#define BCM_63268_USBD_TXDMA0_IRQ (BCM_63268_HIGH_IRQ_BASE + 4) -+#define BCM_63268_USBD_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 20) -+#define BCM_63268_USBD_TXDMA1_IRQ (BCM_63268_HIGH_IRQ_BASE + 5) -+#define BCM_63268_USBD_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 21) -+#define BCM_63268_USBD_TXDMA2_IRQ (BCM_63268_HIGH_IRQ_BASE + 6) -+#define BCM_63268_PCMCIA_IRQ 0 -+#define BCM_63268_ENET0_RXDMA_IRQ 0 -+#define BCM_63268_ENET0_TXDMA_IRQ 0 -+#define BCM_63268_ENET1_RXDMA_IRQ 0 -+#define BCM_63268_ENET1_TXDMA_IRQ 0 -+#define BCM_63268_PCI_IRQ (BCM_63268_HIGH_IRQ_BASE + 8) -+#define BCM_63268_ATM_IRQ 0 -+#define BCM_63268_ENETSW_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 1) -+#define BCM_63268_ENETSW_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 2) -+#define BCM_63268_ENETSW_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 3) -+#define BCM_63268_ENETSW_RXDMA3_IRQ (IRQ_INTERNAL_BASE + 4) -+#define BCM_63268_ENETSW_TXDMA0_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 0) -+#define BCM_63268_ENETSW_TXDMA1_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 1) -+#define BCM_63268_ENETSW_TXDMA2_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 2) -+#define BCM_63268_ENETSW_TXDMA3_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 3) -+#define BCM_63268_XTM_IRQ (BCM_63268_HIGH_IRQ_BASE + 17) -+#define BCM_63268_XTM_DMA0_IRQ (IRQ_INTERNAL_BASE + 26) -+ -+#define BCM_63268_RING_OSC_IRQ (BCM_63268_HIGH_IRQ_BASE + 20) -+#define BCM_63268_WLAN_GPIO_IRQ (BCM_63268_HIGH_IRQ_BASE + 3) -+#define BCM_63268_WLAN_IRQ (IRQ_INTERNAL_BASE + 7) -+#define BCM_63268_IPSEC_IRQ (IRQ_INTERNAL_BASE + 8) -+#define BCM_63268_NAND_IRQ (BCM_63268_HIGH_IRQ_BASE + 18) -+#define BCM_63268_PCM_IRQ (IRQ_INTERNAL_BASE + 13) -+#define BCM_63268_DG_IRQ (IRQ_INTERNAL_BASE + 15) -+#define BCM_63268_EPHY_ENERGY0_IRQ (IRQ_INTERNAL_BASE + 16) -+#define BCM_63268_EPHY_ENERGY1_IRQ (IRQ_INTERNAL_BASE + 17) -+#define BCM_63268_EPHY_ENERGY2_IRQ (IRQ_INTERNAL_BASE + 18) -+#define BCM_63268_EPHY_ENERGY3_IRQ (IRQ_INTERNAL_BASE + 19) -+#define BCM_63268_IPSEC_DMA0_IRQ (IRQ_INTERNAL_BASE + 22) -+#define BCM_63268_IPSEC_DMA1_IRQ (BCM_63268_HIGH_IRQ_BASE + 7) -+#define BCM_63268_FAP0_IRQ (IRQ_INTERNAL_BASE + 24) -+#define BCM_63268_FAP1_IRQ (IRQ_INTERNAL_BASE + 25) -+#define BCM_63268_PCM_DMA0_IRQ (BCM_63268_HIGH_IRQ_BASE + 10) -+#define BCM_63268_PCM_DMA1_IRQ (BCM_63268_HIGH_IRQ_BASE + 11) -+#define BCM_63268_DECT0_IRQ (BCM_63268_HIGH_IRQ_BASE + 0) -+#define BCM_63268_DECT1_IRQ (BCM_63268_HIGH_IRQ_BASE + 1) -+#define BCM_63268_EXT_IRQ0 (BCM_63268_HIGH_IRQ_BASE + 12) -+#define BCM_63268_EXT_IRQ1 (BCM_63268_HIGH_IRQ_BASE + 13) -+#define BCM_63268_EXT_IRQ2 (BCM_63268_HIGH_IRQ_BASE + 14) -+#define BCM_63268_EXT_IRQ3 (BCM_63268_HIGH_IRQ_BASE + 15) -+ - extern const int *bcm63xx_irqs; - - #define __GEN_CPU_IRQ_TABLE(__cpu) \ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -@@ -22,6 +22,8 @@ static inline unsigned long bcm63xx_gpio - return 48; - case BCM6368_CPU_ID: - return 38; -+ case BCM63268_CPU_ID: -+ return 52; - case BCM6348_CPU_ID: - default: - return 37; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -9,6 +9,8 @@ - #define PERF_REV_REG 0x0 - #define REV_CHIPID_SHIFT 16 - #define REV_CHIPID_MASK (0xffff << REV_CHIPID_SHIFT) -+#define REV_LONG_CHIPID_SHIFT 12 -+#define REV_LONG_CHIPID_MASK (0xfffff << REV_LONG_CHIPID_SHIFT) - #define REV_VARID_SHIFT 12 - #define REV_VARID_MASK (0xf << REV_VARID_SHIFT) - #define REV_REVID_SHIFT 0 -@@ -211,6 +213,52 @@ - CKCTL_6368_NAND_EN | \ - CKCTL_6368_IPSEC_EN) - -+#define CKCTL_63268_DISABLE_GLESS (1 << 0) -+#define CKCTL_63268_VDSL_QPROC_EN (1 << 1) -+#define CKCTL_63268_VDSL_AFE_EN (1 << 2) -+#define CKCTL_63268_VDSL_EN (1 << 3) -+#define CKCTL_63268_MIPS_EN (1 << 4) -+#define CKCTL_63268_WLAN_OCP_EN (1 << 5) -+#define CKCTL_63268_DECT_EN (1 << 6) -+#define CKCTL_63268_FAP0_EN (1 << 7) -+#define CKCTL_63268_FAP1_EN (1 << 8) -+#define CKCTL_63268_SAR_EN (1 << 9) -+#define CKCTL_63268_ROBOSW_EN (1 << 10) -+#define CKCTL_63268_PCM_EN (1 << 11) -+#define CKCTL_63268_USBD_EN (1 << 12) -+#define CKCTL_63268_USBH_EN (1 << 13) -+#define CKCTL_63268_IPSEC_EN (1 << 14) -+#define CKCTL_63268_SPI_EN (1 << 15) -+#define CKCTL_63268_HSSPI_EN (1 << 16) -+#define CKCTL_63268_PCIE_EN (1 << 17) -+#define CKCTL_63268_PHYMIPS_EN (1 << 18) -+#define CKCTL_63268_GMAC_EN (1 << 19) -+#define CKCTL_63268_NAND_EN (1 << 20) -+#define CKCTL_63268_TBUS_EN (1 << 27) -+#define CKCTL_63268_ROBOSW250_EN (1 << 31) -+ -+#define CKCTL_63268_ALL_SAFE_EN (CKCTL_63268_VDSL_QPROC_EN | \ -+ CKCTL_63268_VDSL_AFE_EN | \ -+ CKCTL_63268_VDSL_EN | \ -+ CKCTL_63268_WLAN_OCP_EN | \ -+ CKCTL_63268_DECT_EN | \ -+ CKCTL_63268_FAP0_EN | \ -+ CKCTL_63268_FAP1_EN | \ -+ CKCTL_63268_SAR_EN | \ -+ CKCTL_63268_ROBOSW_EN | \ -+ CKCTL_63268_PCM_EN | \ -+ CKCTL_63268_USBD_EN | \ -+ CKCTL_63268_USBH_EN | \ -+ CKCTL_63268_IPSEC_EN | \ -+ CKCTL_63268_SPI_EN | \ -+ CKCTL_63268_HSSPI_EN | \ -+ CKCTL_63268_PCIE_EN | \ -+ CKCTL_63268_PHYMIPS_EN | \ -+ CKCTL_63268_GMAC_EN | \ -+ CKCTL_63268_NAND_EN | \ -+ CKCTL_63268_TBUS_EN | \ -+ CKCTL_63268_ROBOSW250_EN) -+ - /* System PLL Control register */ - #define PERF_SYS_PLL_CTL_REG 0x8 - #define SYS_PLL_SOFT_RESET 0x1 -@@ -224,6 +272,7 @@ - #define PERF_IRQMASK_6358_REG(x) (0xc + (x) * 0x2c) - #define PERF_IRQMASK_6362_REG(x) (0x20 + (x) * 0x10) - #define PERF_IRQMASK_6368_REG(x) (0x20 + (x) * 0x10) -+#define PERF_IRQMASK_63268_REG(x) (0x20 + (x) * 0x20) - - /* Interrupt Status register */ - #define PERF_IRQSTAT_3368_REG 0x10 -@@ -234,6 +283,7 @@ - #define PERF_IRQSTAT_6358_REG(x) (0x10 + (x) * 0x2c) - #define PERF_IRQSTAT_6362_REG(x) (0x28 + (x) * 0x10) - #define PERF_IRQSTAT_6368_REG(x) (0x28 + (x) * 0x10) -+#define PERF_IRQSTAT_63268_REG(x) (0x30 + (x) * 0x20) - - /* External Interrupt Configuration register */ - #define PERF_EXTIRQ_CFG_REG_3368 0x14 -@@ -244,6 +294,7 @@ - #define PERF_EXTIRQ_CFG_REG_6358 0x14 - #define PERF_EXTIRQ_CFG_REG_6362 0x18 - #define PERF_EXTIRQ_CFG_REG_6368 0x18 -+#define PERF_EXTIRQ_CFG_REG_63268 0x18 - - #define PERF_EXTIRQ_CFG_REG2_6358 0x1c - #define PERF_EXTIRQ_CFG_REG2_6368 0x1c -@@ -274,6 +325,7 @@ - #define PERF_SOFTRESET_6358_REG 0x34 - #define PERF_SOFTRESET_6362_REG 0x10 - #define PERF_SOFTRESET_6368_REG 0x10 -+#define PERF_SOFTRESET_63268_REG 0x10 - - #define SOFTRESET_3368_SPI_MASK (1 << 0) - #define SOFTRESET_3368_ENET_MASK (1 << 2) -@@ -367,6 +419,26 @@ - #define SOFTRESET_6368_USBH_MASK (1 << 12) - #define SOFTRESET_6368_PCM_MASK (1 << 13) - -+#define SOFTRESET_63268_SPI_MASK (1 << 0) -+#define SOFTRESET_63268_IPSEC_MASK (1 << 1) -+#define SOFTRESET_63268_EPHY_MASK (1 << 2) -+#define SOFTRESET_63268_SAR_MASK (1 << 3) -+#define SOFTRESET_63268_ENETSW_MASK (1 << 4) -+#define SOFTRESET_63268_USBS_MASK (1 << 5) -+#define SOFTRESET_63268_USBH_MASK (1 << 6) -+#define SOFTRESET_63268_PCM_MASK (1 << 7) -+#define SOFTRESET_63268_PCIE_CORE_MASK (1 << 8) -+#define SOFTRESET_63268_PCIE_MASK (1 << 9) -+#define SOFTRESET_63268_PCIE_EXT_MASK (1 << 10) -+#define SOFTRESET_63268_WLAN_SHIM_MASK (1 << 11) -+#define SOFTRESET_63268_DDR_PHY_MASK (1 << 12) -+#define SOFTRESET_63268_FAP0_MASK (1 << 13) -+#define SOFTRESET_63268_WLAN_UBUS_MASK (1 << 14) -+#define SOFTRESET_63268_DECT_MASK (1 << 15) -+#define SOFTRESET_63268_FAP1_MASK (1 << 16) -+#define SOFTRESET_63268_PCIE_HARD_MASK (1 << 17) -+#define SOFTRESET_63268_GPHY_MASK (1 << 18) -+ - /* MIPS PLL control register */ - #define PERF_MIPSPLLCTL_REG 0x34 - #define MIPSPLLCTL_N1_SHIFT 20 -@@ -1366,6 +1438,13 @@ - #define STRAPBUS_6362_BOOT_SEL_SERIAL (1 << 15) - #define STRAPBUS_6362_BOOT_SEL_NAND (0 << 15) - -+#define MISC_STRAPBUS_63268_REG 0x14 -+#define STRAPBUS_63268_HSSPI_CLK_FAST (1 << 9) -+#define STRAPBUS_63268_BOOT_SEL_SERIAL (1 << 11) -+#define STRAPBUS_63268_BOOT_SEL_NAND (0 << 11) -+#define STRAPBUS_63268_FCVO_SHIFT 21 -+#define STRAPBUS_63268_FCVO_MASK (0xf << STRAPBUS_63268_FCVO_SHIFT) -+ - #define MISC_STRAPBUS_6328_REG 0x240 - #define STRAPBUS_6328_FCVO_SHIFT 7 - #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT) ---- a/arch/mips/include/asm/mach-bcm63xx/ioremap.h -+++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h -@@ -25,6 +25,7 @@ static inline int is_bcm63xx_internal_re - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: - case BCM6368_CPU_ID: -+ case BCM63268_CPU_ID: - if (offset >= 0xb0000000 && offset < 0xb1000000) - return 1; - break; ---- a/arch/mips/bcm63xx/dev-hsspi.c -+++ b/arch/mips/bcm63xx/dev-hsspi.c -@@ -35,7 +35,7 @@ static struct platform_device bcm63xx_hs - - int __init bcm63xx_hsspi_register(void) - { -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362()) -+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_63268()) - return -ENODEV; - - spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); ---- a/arch/mips/bcm63xx/dev-enet.c -+++ b/arch/mips/bcm63xx/dev-enet.c -@@ -176,7 +176,8 @@ static int __init register_shared(void) - else - shared_res[0].end += (RSET_ENETDMA_SIZE) - 1; - -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368() || -+ BCMCPU_IS_63268()) - chan_count = 32; - else if (BCMCPU_IS_6345()) - chan_count = 8; -@@ -284,7 +285,8 @@ bcm63xx_enetsw_register(const struct bcm - { - int ret; - -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) -+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && -+ !BCMCPU_IS_63268()) - return -ENODEV; - - ret = register_shared(); -@@ -305,6 +307,8 @@ bcm63xx_enetsw_register(const struct bcm - enetsw_pd.num_ports = ENETSW_PORTS_6328; - else if (BCMCPU_IS_6362() || BCMCPU_IS_6368()) - enetsw_pd.num_ports = ENETSW_PORTS_6368; -+ else if (BCMCPU_IS_63268()) -+ enetsw_pd.num_ports = ENETSW_PORTS_63268; - - enetsw_pd.dma_has_sram = true; - enetsw_pd.dma_chan_width = ENETDMA_CHAN_WIDTH; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -@@ -66,6 +66,7 @@ struct bcm63xx_enet_platform_data { - #define ENETSW_MAX_PORT 8 - #define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */ - #define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */ -+#define ENETSW_PORTS_63268 8 /* 3 FE PHY + 1 GE PHY + 4 RGMII */ - - #define ENETSW_RGMII_PORT0 4 - diff --git a/target/linux/brcm63xx/patches-4.4/340-MIPS-BCM63XX-add-pcie-support-for-BCM63268.patch b/target/linux/brcm63xx/patches-4.4/340-MIPS-BCM63XX-add-pcie-support-for-BCM63268.patch deleted file mode 100644 index 4e8a09079..000000000 --- a/target/linux/brcm63xx/patches-4.4/340-MIPS-BCM63XX-add-pcie-support-for-BCM63268.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 5c290c81dbdb4433600593fe80c88eb4af86e791 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 03:22:40 +0100 -Subject: [PATCH 50/53] MIPS: BCM63XX: add pcie support for BCM63268 - ---- - arch/mips/bcm63xx/reset.c | 3 ++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | 5 +++++ - arch/mips/pci/pci-bcm63xx.c | 4 ++++ - 3 files changed, 11 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/reset.c -+++ b/arch/mips/bcm63xx/reset.c -@@ -136,7 +136,8 @@ - #define BCM63268_RESET_PCM SOFTRESET_63268_PCM_MASK - #define BCM63268_RESET_MPI 0 - #define BCM63268_RESET_PCIE (SOFTRESET_63268_PCIE_MASK | \ -- SOFTRESET_63268_PCIE_CORE_MASK) -+ SOFTRESET_63268_PCIE_CORE_MASK | \ -+ SOFTRESET_63268_PCIE_HARD_MASK) - #define BCM63268_RESET_PCIE_EXT SOFTRESET_63268_PCIE_EXT_MASK - - /* ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -45,6 +45,11 @@ - #define BCM_PCIE_MEM_END_PA_6328 (BCM_PCIE_MEM_BASE_PA_6328 + \ - BCM_PCIE_MEM_SIZE_6328 - 1) - -+#define BCM_PCIE_MEM_BASE_PA_63268 0x11000000 -+#define BCM_PCIE_MEM_SIZE_63268 (15 * 1024 * 1024) -+#define BCM_PCIE_MEM_END_PA_63268 (BCM_PCIE_MEM_BASE_PA_63268 + \ -+ BCM_PCIE_MEM_SIZE_63268 - 1) -+ - /* - * Internal registers are accessed through KSEG3 - */ ---- a/arch/mips/pci/pci-bcm63xx.c -+++ b/arch/mips/pci/pci-bcm63xx.c -@@ -337,11 +337,15 @@ static int __init bcm63xx_pci_init(void) - if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { - bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_6328; - bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_6328; -+ } else if (BCMCPU_IS_63268()) { -+ bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_63268; -+ bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_63268; - } - - switch (bcm63xx_get_cpu_id()) { - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: -+ case BCM63268_CPU_ID: - return bcm63xx_register_pcie(); - case BCM3368_CPU_ID: - case BCM6348_CPU_ID: diff --git a/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch b/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch deleted file mode 100644 index 277f54dff..000000000 --- a/target/linux/brcm63xx/patches-4.4/341-MIPS-BCM63XX-add-support-for-BCM6318.patch +++ /dev/null @@ -1,697 +0,0 @@ -From 60c29522a8c77d96145d965589c56befda7d4c3d Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 01:24:09 +0100 -Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 - ---- - arch/mips/bcm63xx/Kconfig | 5 + - arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- - arch/mips/bcm63xx/clk.c | 8 +- - arch/mips/bcm63xx/cpu.c | 53 +++++++++++ - arch/mips/bcm63xx/dev-flash.c | 3 + - arch/mips/bcm63xx/dev-spi.c | 2 +- - arch/mips/bcm63xx/irq.c | 10 ++ - arch/mips/bcm63xx/prom.c | 2 +- - arch/mips/bcm63xx/reset.c | 24 +++++ - arch/mips/bcm63xx/setup.c | 5 +- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 107 ++++++++++++++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 75 ++++++++++++++- - arch/mips/include/asm/mach-bcm63xx/ioremap.h | 1 + - 13 files changed, 291 insertions(+), 6 deletions(-) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -18,6 +18,11 @@ config BCM63XX_EHCI - select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD - select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD - -+config BCM63XX_CPU_6318 -+ bool "support 6318 CPU" -+ select SYS_HAS_CPU_BMIPS32_3300 -+ select HW_HAS_PCI -+ - config BCM63XX_CPU_6328 - bool "support 6328 CPU" - select SYS_HAS_CPU_BMIPS4350 ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -713,7 +713,7 @@ void __init board_prom_init(void) - /* read base address of boot chip select (0) - * 6328/6362 do not have MPI but boot from a fixed address - */ -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) { -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) { - val = 0x18000000; - } else { - val = bcm_mpi_readl(MPI_CSBASE_REG(0)); ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -288,7 +288,9 @@ static void hsspi_set(struct clk *clk, i - { - u32 mask; - -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6318()) -+ mask = CKCTL_6318_HSSPI_EN; -+ else if (BCMCPU_IS_6328()) - mask = CKCTL_6328_HSSPI_EN; - else if (BCMCPU_IS_6362()) - mask = CKCTL_6362_HSSPI_EN; -@@ -440,6 +442,19 @@ static struct clk_lookup bcm3368_clks[] - CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet1), - }; - -+static struct clk_lookup bcm6318_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbh), -+ CLKDEV_INIT(NULL, "hsspi", &clk_hsspi), -+ CLKDEV_INIT(NULL, "pcie", &clk_pcie), -+}; -+ - static struct clk_lookup bcm6328_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -@@ -561,6 +576,7 @@ static struct clk_lookup bcm63268_clks[] - CLKDEV_INIT(NULL, "pcie", &clk_pcie), - }; - -+#define HSSPI_PLL_HZ_6318 250000000 - #define HSSPI_PLL_HZ_6328 133333333 - #define HSSPI_PLL_HZ_6362 400000000 - -@@ -570,6 +586,10 @@ static int __init bcm63xx_clk_init(void) - case BCM3368_CPU_ID: - clkdev_add_table(bcm3368_clks, ARRAY_SIZE(bcm3368_clks)); - break; -+ case BCM6318_CPU_ID: -+ clk_hsspi_pll.rate = HSSPI_PLL_HZ_6318; -+ clkdev_add_table(bcm6318_clks, ARRAY_SIZE(bcm6318_clks)); -+ break; - case BCM6328_CPU_ID: - clk_hsspi_pll.rate = HSSPI_PLL_HZ_6328; - clkdev_add_table(bcm6328_clks, ARRAY_SIZE(bcm6328_clks)); ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -41,6 +41,14 @@ static const int bcm3368_irqs[] = { - __GEN_CPU_IRQ_TABLE(3368) - }; - -+static const unsigned long bcm6318_regs_base[] = { -+ __GEN_CPU_REGS_TABLE(6318) -+}; -+ -+static const int bcm6318_irqs[] = { -+ __GEN_CPU_IRQ_TABLE(6318) -+}; -+ - static const unsigned long bcm6328_regs_base[] = { - __GEN_CPU_REGS_TABLE(6328) - }; -@@ -134,6 +142,10 @@ unsigned int bcm63xx_get_memory_size(voi - return bcm63xx_memory_size; - } - -+#define STRAP_OVERRIDE_BUS_REG 0x0 -+#define OVERRIDE_BUS_MIPS_FREQ_SHIFT 23 -+#define OVERRIDE_BUS_MIPS_FREQ_MASK (0x3 << OVERRIDE_BUS_MIPS_FREQ_SHIFT) -+ - static unsigned int detect_cpu_clock(void) - { - u32 cpu_id = bcm63xx_get_cpu_id(); -@@ -142,6 +154,28 @@ static unsigned int detect_cpu_clock(voi - case BCM3368_CPU_ID: - return 300000000; - -+ case BCM6318_CPU_ID: -+ { -+ unsigned int tmp, mips_pll_fcvo; -+ -+ tmp = bcm_readl(BCM_6318_STRAP_BASE + STRAP_OVERRIDE_BUS_REG); -+ -+ pr_info("strap_override_bus = %08x\n", tmp); -+ -+ mips_pll_fcvo = (tmp & OVERRIDE_BUS_MIPS_FREQ_MASK) -+ >> OVERRIDE_BUS_MIPS_FREQ_SHIFT; -+ -+ switch (mips_pll_fcvo) { -+ case 0: -+ return 166000000; -+ case 1: -+ return 400000000; -+ case 2: -+ return 250000000; -+ case 3: -+ return 333000000; -+ }; -+ } - case BCM6328_CPU_ID: - { - unsigned int tmp, mips_pll_fcvo; -@@ -297,6 +331,13 @@ static unsigned int detect_memory_size(v - unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; - u32 val; - -+ if (BCMCPU_IS_6318()) { -+ val = bcm_sdram_readl(SDRAM_CFG_REG); -+ val = val & SDRAM_CFG_6318_SPACE_MASK; -+ val >>= SDRAM_CFG_6318_SPACE_SHIFT; -+ return 1 << (val + 20); -+ } -+ - if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) - return bcm_ddr_readl(DDR_CSEND_REG) << 24; - -@@ -343,6 +384,12 @@ void __init bcm63xx_cpu_init(void) - - switch (current_cpu_type()) { - case CPU_BMIPS3300: -+ if ((read_c0_prid() & 0xff) >= 0x33) { -+ /* BCM6318 */ -+ chipid_reg = BCM_6368_PERF_BASE; -+ break; -+ } -+ - if ((read_c0_prid() & PRID_IMP_MASK) != PRID_IMP_BMIPS3300_ALT) - __cpu_name[cpu] = "Broadcom BCM6338"; - /* fall-through */ -@@ -390,6 +437,10 @@ void __init bcm63xx_cpu_init(void) - bcm63xx_cpu_variant = bcm63xx_cpu_id; - - switch (bcm63xx_cpu_id) { -+ case BCM6318_CPU_ID: -+ bcm63xx_regs_base = bcm6318_regs_base; -+ bcm63xx_irqs = bcm6318_irqs; -+ break; - case BCM3368_CPU_ID: - bcm63xx_regs_base = bcm3368_regs_base; - bcm63xx_irqs = bcm3368_irqs; ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -60,6 +60,9 @@ static int __init bcm63xx_detect_flash_t - u32 val; - - switch (bcm63xx_get_cpu_id()) { -+ case BCM6318_CPU_ID: -+ /* only support serial flash */ -+ return BCM63XX_FLASH_TYPE_SERIAL; - case BCM6328_CPU_ID: - val = bcm_misc_readl(MISC_STRAPBUS_6328_REG); - if (val & STRAPBUS_6328_BOOT_SEL_SERIAL) ---- a/arch/mips/bcm63xx/dev-spi.c -+++ b/arch/mips/bcm63xx/dev-spi.c -@@ -38,7 +38,7 @@ static struct platform_device bcm63xx_sp - - int __init bcm63xx_spi_register(void) - { -- if (BCMCPU_IS_6328() || BCMCPU_IS_6345()) -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6345()) - return -ENODEV; - - spi_resources[0].start = bcm63xx_regset_address(RSET_SPI); ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -49,6 +49,19 @@ void __init arch_init_irq(void) - ext_irqs[3] = BCM_3368_EXT_IRQ3; - ext_shift = 4; - break; -+ case BCM6318_CPU_ID: -+ periph_bases[0] += PERF_IRQMASK_6318_REG; -+ periph_irq_count = 1; -+ periph_width = 4; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6318; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_6318_EXT_IRQ0; -+ ext_irqs[1] = BCM_6318_EXT_IRQ0; -+ ext_irqs[2] = BCM_6318_EXT_IRQ0; -+ ext_irqs[3] = BCM_6318_EXT_IRQ0; -+ ext_shift = 4; -+ break; - case BCM6328_CPU_ID: - periph_bases[0] += PERF_IRQMASK_6328_REG(0); - periph_bases[1] += PERF_IRQMASK_6328_REG(1); ---- a/arch/mips/bcm63xx/prom.c -+++ b/arch/mips/bcm63xx/prom.c -@@ -68,7 +68,7 @@ void __init prom_init(void) - - if (reg & OTP_6328_REG3_TP1_DISABLED) - bmips_smp_enabled = 0; -- } else if (BCMCPU_IS_3368() || BCMCPU_IS_6358()) { -+ } else if (BCMCPU_IS_6318() || BCMCPU_IS_3368() || BCMCPU_IS_6358()) { - bmips_smp_enabled = 0; - } - ---- a/arch/mips/bcm63xx/reset.c -+++ b/arch/mips/bcm63xx/reset.c -@@ -43,6 +43,23 @@ - #define BCM3368_RESET_PCIE 0 - #define BCM3368_RESET_PCIE_EXT 0 - -+ -+#define BCM6318_RESET_SPI SOFTRESET_6318_SPI_MASK -+#define BCM6318_RESET_ENET 0 -+#define BCM6318_RESET_USBH SOFTRESET_6318_USBH_MASK -+#define BCM6318_RESET_USBD SOFTRESET_6318_USBS_MASK -+#define BCM6318_RESET_DSL 0 -+#define BCM6318_RESET_SAR SOFTRESET_6318_SAR_MASK -+#define BCM6318_RESET_EPHY SOFTRESET_6318_EPHY_MASK -+#define BCM6318_RESET_ENETSW SOFTRESET_6318_ENETSW_MASK -+#define BCM6318_RESET_PCM 0 -+#define BCM6318_RESET_MPI 0 -+#define BCM6318_RESET_PCIE \ -+ (SOFTRESET_6318_PCIE_MASK | \ -+ SOFTRESET_6318_PCIE_CORE_MASK | \ -+ SOFTRESET_6318_PCIE_HARD_MASK) -+#define BCM6318_RESET_PCIE_EXT SOFTRESET_6318_PCIE_EXT_MASK -+ - #define BCM6328_RESET_SPI SOFTRESET_6328_SPI_MASK - #define BCM6328_RESET_ENET 0 - #define BCM6328_RESET_USBH SOFTRESET_6328_USBH_MASK -@@ -147,6 +164,10 @@ static const u32 bcm3368_reset_bits[] = - __GEN_RESET_BITS_TABLE(3368) - }; - -+static const u32 bcm6318_reset_bits[] = { -+ __GEN_RESET_BITS_TABLE(6318) -+}; -+ - static const u32 bcm6328_reset_bits[] = { - __GEN_RESET_BITS_TABLE(6328) - }; -@@ -183,6 +204,9 @@ static int __init bcm63xx_reset_bits_ini - if (BCMCPU_IS_3368()) { - reset_reg = PERF_SOFTRESET_6358_REG; - bcm63xx_reset_bits = bcm3368_reset_bits; -+ } else if (BCMCPU_IS_6318()) { -+ reset_reg = PERF_SOFTRESET_6318_REG; -+ bcm63xx_reset_bits = bcm6318_reset_bits; - } else if (BCMCPU_IS_6328()) { - reset_reg = PERF_SOFTRESET_6328_REG; - bcm63xx_reset_bits = bcm6328_reset_bits; ---- a/arch/mips/bcm63xx/setup.c -+++ b/arch/mips/bcm63xx/setup.c -@@ -72,6 +72,9 @@ void bcm63xx_machine_reboot(void) - case BCM3368_CPU_ID: - perf_regs[0] = PERF_EXTIRQ_CFG_REG_3368; - break; -+ case BCM6318_CPU_ID: -+ perf_regs[0] = PERF_EXTIRQ_CFG_REG_6318; -+ break; - case BCM6328_CPU_ID: - perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328; - break; -@@ -111,7 +114,7 @@ void bcm63xx_machine_reboot(void) - bcm6348_a1_reboot(); - - pr_info("triggering watchdog soft-reset...\n"); -- if (BCMCPU_IS_6328()) { -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328()) { - bcm_wdt_writel(1, WDT_SOFTRESET_REG); - } else { - reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -10,6 +10,7 @@ - * arm mach-types) - */ - #define BCM3368_CPU_ID 0x3368 -+#define BCM6318_CPU_ID 0x6318 - #define BCM6328_CPU_ID 0x6328 - #define BCM63281_CPU_ID 0x63281 - #define BCM63283_CPU_ID 0x63283 -@@ -38,6 +39,10 @@ static inline u32 __pure __bcm63xx_get_c - case BCM3368_CPU_ID: - #endif - -+#ifdef CONFIG_BCM63XX_CPU_6318 -+ case BCM6318_CPU_ID: -+#endif -+ - #ifdef CONFIG_BCM63XX_CPU_6328 - case BCM6328_CPU_ID: - #endif -@@ -87,6 +92,7 @@ static inline u32 __pure bcm63xx_get_cpu - } - - #define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID) -+#define BCMCPU_IS_6318() (bcm63xx_get_cpu_id() == BCM6318_CPU_ID) - #define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID) - #define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID) - #define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID) -@@ -98,6 +104,8 @@ static inline u32 __pure bcm63xx_get_cpu - - #define BCMCPU_VARIANT_IS_3368() \ - (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID) -+#define BCMCPU_VARIANT_IS_6318() \ -+ (bcm63xx_get_cpu_variant() == BCM6318_CPU_ID) - #define BCMCPU_VARIANT_IS_63281() \ - (bcm63xx_get_cpu_variant() == BCM63281_CPU_ID) - #define BCMCPU_VARIANT_IS_63283() \ -@@ -252,6 +260,56 @@ enum bcm63xx_regs_set { - #define BCM_3368_MISC_BASE (0xdeadbeef) - - /* -+ * 6318 register sets base address -+ */ -+#define BCM_6318_DSL_LMEM_BASE (0xdeadbeef) -+#define BCM_6318_PERF_BASE (0xb0000000) -+#define BCM_6318_TIMER_BASE (0xb0000040) -+#define BCM_6318_WDT_BASE (0xb0000068) -+#define BCM_6318_UART0_BASE (0xb0000100) -+#define BCM_6318_UART1_BASE (0xdeadbeef) -+#define BCM_6318_GPIO_BASE (0xb0000080) -+#define BCM_6318_SPI_BASE (0xdeadbeef) -+#define BCM_6318_HSSPI_BASE (0xb0003000) -+#define BCM_6318_UDC0_BASE (0xdeadbeef) -+#define BCM_6318_USBDMA_BASE (0xb0006800) -+#define BCM_6318_OHCI0_BASE (0xb0005100) -+#define BCM_6318_OHCI_PRIV_BASE (0xdeadbeef) -+#define BCM_6318_USBH_PRIV_BASE (0xb0005200) -+#define BCM_6318_USBD_BASE (0xb0006000) -+#define BCM_6318_MPI_BASE (0xdeadbeef) -+#define BCM_6318_PCMCIA_BASE (0xdeadbeef) -+#define BCM_6318_PCIE_BASE (0xb0010000) -+#define BCM_6318_SDRAM_REGS_BASE (0xdeadbeef) -+#define BCM_6318_DSL_BASE (0xdeadbeef) -+#define BCM_6318_UBUS_BASE (0xdeadbeef) -+#define BCM_6318_ENET0_BASE (0xdeadbeef) -+#define BCM_6318_ENET1_BASE (0xdeadbeef) -+#define BCM_6318_ENETDMA_BASE (0xb0088000) -+#define BCM_6318_ENETDMAC_BASE (0xb0088200) -+#define BCM_6318_ENETDMAS_BASE (0xb0088400) -+#define BCM_6318_ENETSW_BASE (0xb0080000) -+#define BCM_6318_EHCI0_BASE (0xb0005000) -+#define BCM_6318_SDRAM_BASE (0xb0004000) -+#define BCM_6318_MEMC_BASE (0xdeadbeef) -+#define BCM_6318_DDR_BASE (0xdeadbeef) -+#define BCM_6318_M2M_BASE (0xdeadbeef) -+#define BCM_6318_ATM_BASE (0xdeadbeef) -+#define BCM_6318_XTM_BASE (0xdeadbeef) -+#define BCM_6318_XTMDMA_BASE (0xb000c000) -+#define BCM_6318_XTMDMAC_BASE (0xdeadbeef) -+#define BCM_6318_XTMDMAS_BASE (0xdeadbeef) -+#define BCM_6318_PCM_BASE (0xdeadbeef) -+#define BCM_6318_PCMDMA_BASE (0xdeadbeef) -+#define BCM_6318_PCMDMAC_BASE (0xdeadbeef) -+#define BCM_6318_PCMDMAS_BASE (0xdeadbeef) -+#define BCM_6318_RNG_BASE (0xdeadbeef) -+#define BCM_6318_MISC_BASE (0xb0000280) -+#define BCM_6318_OTP_BASE (0xdeadbeef) -+ -+#define BCM_6318_STRAP_BASE (0xb0000900) -+ -+/* - * 6328 register sets base address - */ - #define BCM_6328_DSL_LMEM_BASE (0xdeadbeef) -@@ -774,6 +832,55 @@ enum bcm63xx_irq { - #define BCM_3368_EXT_IRQ2 (IRQ_INTERNAL_BASE + 27) - #define BCM_3368_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28) - -+/* -+ * 6318 irqs -+ */ -+#define BCM_6318_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) -+#define BCM_6318_VERY_HIGH_IRQ_BASE (BCM_6318_HIGH_IRQ_BASE + 32) -+ -+#define BCM_6318_TIMER_IRQ (IRQ_INTERNAL_BASE + 31) -+#define BCM_6318_SPI_IRQ 0 -+#define BCM_6318_UART0_IRQ (IRQ_INTERNAL_BASE + 28) -+#define BCM_6318_UART1_IRQ 0 -+#define BCM_6318_DSL_IRQ (IRQ_INTERNAL_BASE + 21) -+#define BCM_6318_UDC0_IRQ 0 -+#define BCM_6318_ENET0_IRQ 0 -+#define BCM_6318_ENET1_IRQ 0 -+#define BCM_6318_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) -+#define BCM_6318_HSSPI_IRQ (IRQ_INTERNAL_BASE + 29) -+#define BCM_6318_OHCI0_IRQ (BCM_6318_HIGH_IRQ_BASE + 9) -+#define BCM_6318_EHCI0_IRQ (BCM_6318_HIGH_IRQ_BASE + 10) -+#define BCM_6318_USBD_IRQ (IRQ_INTERNAL_BASE + 4) -+#define BCM_6318_USBD_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 5) -+#define BCM_6318_USBD_TXDMA0_IRQ (IRQ_INTERNAL_BASE + 6) -+#define BCM_6318_USBD_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 7) -+#define BCM_6318_USBD_TXDMA1_IRQ (IRQ_INTERNAL_BASE + 8) -+#define BCM_6318_USBD_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 9) -+#define BCM_6318_USBD_TXDMA2_IRQ (IRQ_INTERNAL_BASE + 10) -+#define BCM_6318_PCMCIA_IRQ 0 -+#define BCM_6318_ENET0_RXDMA_IRQ 0 -+#define BCM_6318_ENET0_TXDMA_IRQ 0 -+#define BCM_6318_ENET1_RXDMA_IRQ 0 -+#define BCM_6318_ENET1_TXDMA_IRQ 0 -+#define BCM_6318_PCI_IRQ (IRQ_INTERNAL_BASE + 23) -+#define BCM_6318_ATM_IRQ 0 -+#define BCM_6318_ENETSW_RXDMA0_IRQ (BCM_6318_HIGH_IRQ_BASE + 0) -+#define BCM_6318_ENETSW_RXDMA1_IRQ (BCM_6318_HIGH_IRQ_BASE + 1) -+#define BCM_6318_ENETSW_RXDMA2_IRQ (BCM_6318_HIGH_IRQ_BASE + 2) -+#define BCM_6318_ENETSW_RXDMA3_IRQ (BCM_6318_HIGH_IRQ_BASE + 3) -+#define BCM_6318_ENETSW_TXDMA0_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 10) -+#define BCM_6318_ENETSW_TXDMA1_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 11) -+#define BCM_6318_ENETSW_TXDMA2_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 12) -+#define BCM_6318_ENETSW_TXDMA3_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 13) -+#define BCM_6318_XTM_IRQ (BCM_6318_HIGH_IRQ_BASE + 31) -+#define BCM_6318_XTM_DMA0_IRQ (BCM_6318_HIGH_IRQ_BASE + 11) -+ -+#define BCM_6318_PCM_DMA0_IRQ (IRQ_INTERNAL_BASE + 2) -+#define BCM_6318_PCM_DMA1_IRQ (IRQ_INTERNAL_BASE + 3) -+#define BCM_6318_EXT_IRQ0 (IRQ_INTERNAL_BASE + 24) -+#define BCM_6318_EXT_IRQ1 (IRQ_INTERNAL_BASE + 25) -+#define BCM_6318_EXT_IRQ2 (IRQ_INTERNAL_BASE + 26) -+#define BCM_6318_EXT_IRQ3 (IRQ_INTERNAL_BASE + 27) - - /* - * 6328 irqs ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -52,6 +52,39 @@ - CKCTL_3368_EMUSB_EN | \ - CKCTL_3368_USBU_EN) - -+#define CKCTL_6318_ADSL_ASB_EN (1 << 0) -+#define CKCTL_6318_USB_ASB_EN (1 << 1) -+#define CKCTL_6318_MIPS_ASB_EN (1 << 2) -+#define CKCTL_6318_PCIE_ASB_EN (1 << 3) -+#define CKCTL_6318_PHYMIPS_ASB_EN (1 << 4) -+#define CKCTL_6318_ROBOSW_ASB_EN (1 << 5) -+#define CKCTL_6318_SAR_ASB_EN (1 << 6) -+#define CKCTL_6318_SDR_ASB_EN (1 << 7) -+#define CKCTL_6318_SWREG_ASB_EN (1 << 8) -+#define CKCTL_6318_PERIPH_ASB_EN (1 << 9) -+#define CKCTL_6318_CPUBUS160_EN (1 << 10) -+#define CKCTL_6318_ADSL_EN (1 << 11) -+#define CKCTL_6318_SAR125_EN (1 << 12) -+#define CKCTL_6318_MIPS_EN (1 << 13) -+#define CKCTL_6318_PCIE_EN (1 << 14) -+#define CKCTL_6318_ROBOSW250_EN (1 << 16) -+#define CKCTL_6318_ROBOSW025_EN (1 << 17) -+#define CKCTL_6318_SDR_EN (1 << 19) -+#define CKCTL_6318_USB_EN (1 << 20) /* both device and host */ -+#define CKCTL_6318_HSSPI_EN (1 << 25) -+#define CKCTL_6318_PCIE25_EN (1 << 27) -+#define CKCTL_6318_PHYMIPS_EN (1 << 28) -+#define CKCTL_6318_ADSL_AFE_EN (1 << 29) -+#define CKCTL_6318_ADSL_QPROC_EN (1 << 30) -+ -+#define CKCTL_6318_ALL_SAFE_EN (CKCTL_6318_PHYMIPS_EN | \ -+ CKCTL_6318_ADSL_QPROC_EN | \ -+ CKCTL_6318_ADSL_AFE_EN | \ -+ CKCTL_6318_ADSL_EN | \ -+ CKCTL_6318_SAR_EN | \ -+ CKCTL_6318_USB_EN | \ -+ CKCTL_6318_PCIE_EN) -+ - #define CKCTL_6328_PHYMIPS_EN (1 << 0) - #define CKCTL_6328_ADSL_QPROC_EN (1 << 1) - #define CKCTL_6328_ADSL_AFE_EN (1 << 2) -@@ -259,12 +292,27 @@ - CKCTL_63268_TBUS_EN | \ - CKCTL_63268_ROBOSW250_EN) - -+/* UBUS Clock Control register */ -+#define PERF_UB_CKCTL_REG 0x10 -+ -+#define UB_CKCTL_6318_ADSL_EN (1 << 0) -+#define UB_CKCTL_6318_ARB_EN (1 << 1) -+#define UB_CKCTL_6318_MIPS_EN (1 << 2) -+#define UB_CKCTL_6318_PCIE_EN (1 << 3) -+#define UB_CKCTL_6318_PERIPH_EN (1 << 4) -+#define UB_CKCTL_6318_PHYMIPS_EN (1 << 5) -+#define UB_CKCTL_6318_ROBOSW_EN (1 << 6) -+#define UB_CKCTL_6318_SAR_EN (1 << 7) -+#define UB_CKCTL_6318_SDR_EN (1 << 8) -+#define UB_CKCTL_6318_USB_EN (1 << 9) -+ - /* System PLL Control register */ - #define PERF_SYS_PLL_CTL_REG 0x8 - #define SYS_PLL_SOFT_RESET 0x1 - - /* Interrupt Mask register */ - #define PERF_IRQMASK_3368_REG 0xc -+#define PERF_IRQMASK_6318_REG 0x20 - #define PERF_IRQMASK_6328_REG(x) (0x20 + (x) * 0x10) - #define PERF_IRQMASK_6338_REG 0xc - #define PERF_IRQMASK_6345_REG 0xc -@@ -276,6 +324,7 @@ - - /* Interrupt Status register */ - #define PERF_IRQSTAT_3368_REG 0x10 -+#define PERF_IRQSTAT_6318_REG 0x30 - #define PERF_IRQSTAT_6328_REG(x) (0x28 + (x) * 0x10) - #define PERF_IRQSTAT_6338_REG 0x10 - #define PERF_IRQSTAT_6345_REG 0x10 -@@ -287,6 +336,7 @@ - - /* External Interrupt Configuration register */ - #define PERF_EXTIRQ_CFG_REG_3368 0x14 -+#define PERF_EXTIRQ_CFG_REG_6318 0x18 - #define PERF_EXTIRQ_CFG_REG_6328 0x18 - #define PERF_EXTIRQ_CFG_REG_6338 0x14 - #define PERF_EXTIRQ_CFG_REG_6345 0x14 -@@ -321,6 +371,7 @@ - - /* Soft Reset register */ - #define PERF_SOFTRESET_REG 0x28 -+#define PERF_SOFTRESET_6318_REG 0x10 - #define PERF_SOFTRESET_6328_REG 0x10 - #define PERF_SOFTRESET_6358_REG 0x34 - #define PERF_SOFTRESET_6362_REG 0x10 -@@ -334,6 +385,18 @@ - #define SOFTRESET_3368_USBS_MASK (1 << 11) - #define SOFTRESET_3368_PCM_MASK (1 << 13) - -+#define SOFTRESET_6318_SPI_MASK (1 << 0) -+#define SOFTRESET_6318_EPHY_MASK (1 << 1) -+#define SOFTRESET_6318_SAR_MASK (1 << 2) -+#define SOFTRESET_6318_ENETSW_MASK (1 << 3) -+#define SOFTRESET_6318_USBS_MASK (1 << 4) -+#define SOFTRESET_6318_USBH_MASK (1 << 5) -+#define SOFTRESET_6318_PCIE_CORE_MASK (1 << 6) -+#define SOFTRESET_6318_PCIE_MASK (1 << 7) -+#define SOFTRESET_6318_PCIE_EXT_MASK (1 << 8) -+#define SOFTRESET_6318_PCIE_HARD_MASK (1 << 9) -+#define SOFTRESET_6318_ADSL_MASK (1 << 10) -+ - #define SOFTRESET_6328_SPI_MASK (1 << 0) - #define SOFTRESET_6328_EPHY_MASK (1 << 1) - #define SOFTRESET_6328_SAR_MASK (1 << 2) -@@ -505,8 +568,17 @@ - #define TIMER_IRQSTAT_TIMER1_IR_EN (1 << 9) - #define TIMER_IRQSTAT_TIMER2_IR_EN (1 << 10) - -+#define TIMER_IRQMASK_6318_REG 0x0 -+#define TIMER_IRQSTAT_6318_REG 0x4 -+#define IRQSTATMASK_TIMER0 (1 << 0) -+#define IRQSTATMASK_TIMER1 (1 << 1) -+#define IRQSTATMASK_TIMER2 (1 << 2) -+#define IRQSTATMASK_TIMER3 (1 << 3) -+#define IRQSTATMASK_WDT (1 << 4) -+ - /* Timer control register */ - #define TIMER_CTLx_REG(x) (0x4 + (x * 4)) -+#define TIMER_CTRx_6318_REG(x) (0x8 + (x * 4)) - #define TIMER_CTL0_REG 0x4 - #define TIMER_CTL1_REG 0x8 - #define TIMER_CTL2_REG 0xC -@@ -1253,6 +1325,8 @@ - #define SDRAM_CFG_32B_MASK (1 << SDRAM_CFG_32B_SHIFT) - #define SDRAM_CFG_BANK_SHIFT 13 - #define SDRAM_CFG_BANK_MASK (1 << SDRAM_CFG_BANK_SHIFT) -+#define SDRAM_CFG_6318_SPACE_SHIFT 4 -+#define SDRAM_CFG_6318_SPACE_MASK (0xf << SDRAM_CFG_6318_SPACE_SHIFT) - - #define SDRAM_MBASE_REG 0xc - ---- a/arch/mips/include/asm/mach-bcm63xx/ioremap.h -+++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h -@@ -22,6 +22,7 @@ static inline int is_bcm63xx_internal_re - if (offset >= 0xfff00000) - return 1; - break; -+ case BCM6318_CPU_ID: - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: - case BCM6368_CPU_ID: ---- a/arch/mips/bcm63xx/dev-hsspi.c -+++ b/arch/mips/bcm63xx/dev-hsspi.c -@@ -35,7 +35,8 @@ static struct platform_device bcm63xx_hs - - int __init bcm63xx_hsspi_register(void) - { -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_63268()) -+ if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6362() && -+ !BCMCPU_IS_63268()) - return -ENODEV; - - spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); ---- a/arch/mips/bcm63xx/dev-usb-usbd.c -+++ b/arch/mips/bcm63xx/dev-usb-usbd.c -@@ -41,7 +41,7 @@ int __init bcm63xx_usbd_register(const s - IRQ_USBD_RXDMA2, IRQ_USBD_TXDMA2 }; - int i; - -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368()) -+ if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6368()) - return 0; - - usbd_resources[0].start = bcm63xx_regset_address(RSET_USBD); ---- a/arch/mips/bcm63xx/dev-enet.c -+++ b/arch/mips/bcm63xx/dev-enet.c -@@ -176,8 +176,8 @@ static int __init register_shared(void) - else - shared_res[0].end += (RSET_ENETDMA_SIZE) - 1; - -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368() || -- BCMCPU_IS_63268()) -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() || -+ BCMCPU_IS_6368() || BCMCPU_IS_63268()) - chan_count = 32; - else if (BCMCPU_IS_6345()) - chan_count = 8; -@@ -285,8 +285,8 @@ bcm63xx_enetsw_register(const struct bcm - { - int ret; - -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && -- !BCMCPU_IS_63268()) -+ if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6362() && -+ !BCMCPU_IS_6368() && !BCMCPU_IS_63268()) - return -ENODEV; - - ret = register_shared(); -@@ -303,7 +303,7 @@ bcm63xx_enetsw_register(const struct bcm - - memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof(*pd)); - -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328()) - enetsw_pd.num_ports = ENETSW_PORTS_6328; - else if (BCMCPU_IS_6362() || BCMCPU_IS_6368()) - enetsw_pd.num_ports = ENETSW_PORTS_6368; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -@@ -9,6 +9,8 @@ int __init bcm63xx_gpio_init(void); - static inline unsigned long bcm63xx_gpio_count(void) - { - switch (bcm63xx_get_cpu_id()) { -+ case BCM6318_CPU_ID: -+ return 50; - case BCM6328_CPU_ID: - return 32; - case BCM3368_CPU_ID: ---- a/arch/mips/bcm63xx/dev-usb-ehci.c -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -81,7 +81,8 @@ static struct platform_device bcm63xx_eh - - int __init bcm63xx_ehci_register(void) - { -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) -+ if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() && -+ !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) - return 0; - - ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); diff --git a/target/linux/brcm63xx/patches-4.4/342-MIPS-BCM63XX-split-PCIe-reset-signals.patch b/target/linux/brcm63xx/patches-4.4/342-MIPS-BCM63XX-split-PCIe-reset-signals.patch deleted file mode 100644 index 71044f846..000000000 --- a/target/linux/brcm63xx/patches-4.4/342-MIPS-BCM63XX-split-PCIe-reset-signals.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 4bdfacdeaf3c988c4f3256c88118893eac640b03 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 14:17:50 +0100 -Subject: [PATCH 52/53] MIPS: BCM63XX: split PCIE reset signals - ---- - arch/mips/bcm63xx/reset.c | 39 ++++++++++++++-------- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h | 2 ++ - arch/mips/pci/pci-bcm63xx.c | 7 ++++ - 3 files changed, 34 insertions(+), 14 deletions(-) - ---- a/arch/mips/bcm63xx/reset.c -+++ b/arch/mips/bcm63xx/reset.c -@@ -28,7 +28,9 @@ - [BCM63XX_RESET_PCM] = BCM## __cpu ##_RESET_PCM, \ - [BCM63XX_RESET_MPI] = BCM## __cpu ##_RESET_MPI, \ - [BCM63XX_RESET_PCIE] = BCM## __cpu ##_RESET_PCIE, \ -- [BCM63XX_RESET_PCIE_EXT] = BCM## __cpu ##_RESET_PCIE_EXT, -+ [BCM63XX_RESET_PCIE_EXT] = BCM## __cpu ##_RESET_PCIE_EXT, \ -+ [BCM63XX_RESET_PCIE_CORE] = BCM## __cpu ##_RESET_PCIE_CORE, \ -+ [BCM63XX_RESET_PCIE_HARD] = BCM## __cpu ##_RESET_PCIE_HARD, - - #define BCM3368_RESET_SPI SOFTRESET_3368_SPI_MASK - #define BCM3368_RESET_ENET SOFTRESET_3368_ENET_MASK -@@ -42,6 +44,8 @@ - #define BCM3368_RESET_MPI SOFTRESET_3368_MPI_MASK - #define BCM3368_RESET_PCIE 0 - #define BCM3368_RESET_PCIE_EXT 0 -+#define BCM3368_RESET_PCIE_CORE 0 -+#define BCM3368_RESET_PCIE_HARD 0 - - - #define BCM6318_RESET_SPI SOFTRESET_6318_SPI_MASK -@@ -54,11 +58,10 @@ - #define BCM6318_RESET_ENETSW SOFTRESET_6318_ENETSW_MASK - #define BCM6318_RESET_PCM 0 - #define BCM6318_RESET_MPI 0 --#define BCM6318_RESET_PCIE \ -- (SOFTRESET_6318_PCIE_MASK | \ -- SOFTRESET_6318_PCIE_CORE_MASK | \ -- SOFTRESET_6318_PCIE_HARD_MASK) -+#define BCM6318_RESET_PCIE SOFTRESET_6318_PCIE_MASK - #define BCM6318_RESET_PCIE_EXT SOFTRESET_6318_PCIE_EXT_MASK -+#define BCM6318_RESET_PCIE_CORE SOFTRESET_6318_PCIE_CORE_MASK -+#define BCM6318_RESET_PCIE_HARD SOFTRESET_6318_PCIE_HARD_MASK - - #define BCM6328_RESET_SPI SOFTRESET_6328_SPI_MASK - #define BCM6328_RESET_ENET 0 -@@ -70,11 +73,10 @@ - #define BCM6328_RESET_ENETSW SOFTRESET_6328_ENETSW_MASK - #define BCM6328_RESET_PCM SOFTRESET_6328_PCM_MASK - #define BCM6328_RESET_MPI 0 --#define BCM6328_RESET_PCIE \ -- (SOFTRESET_6328_PCIE_MASK | \ -- SOFTRESET_6328_PCIE_CORE_MASK | \ -- SOFTRESET_6328_PCIE_HARD_MASK) -+#define BCM6328_RESET_PCIE SOFTRESET_6328_PCIE_MASK - #define BCM6328_RESET_PCIE_EXT SOFTRESET_6328_PCIE_EXT_MASK -+#define BCM6328_RESET_PCIE_CORE SOFTRESET_6328_PCIE_CORE_MASK -+#define BCM6328_RESET_PCIE_HARD SOFTRESET_6328_PCIE_HARD_MASK - - #define BCM6338_RESET_SPI SOFTRESET_6338_SPI_MASK - #define BCM6338_RESET_ENET SOFTRESET_6338_ENET_MASK -@@ -88,6 +90,8 @@ - #define BCM6338_RESET_MPI 0 - #define BCM6338_RESET_PCIE 0 - #define BCM6338_RESET_PCIE_EXT 0 -+#define BCM6338_RESET_PCIE_CORE 0 -+#define BCM6338_RESET_PCIE_HARD 0 - - #define BCM6348_RESET_SPI SOFTRESET_6348_SPI_MASK - #define BCM6348_RESET_ENET SOFTRESET_6348_ENET_MASK -@@ -101,6 +105,8 @@ - #define BCM6348_RESET_MPI 0 - #define BCM6348_RESET_PCIE 0 - #define BCM6348_RESET_PCIE_EXT 0 -+#define BCM6348_RESET_PCIE_CORE 0 -+#define BCM6348_RESET_PCIE_HARD 0 - - #define BCM6358_RESET_SPI SOFTRESET_6358_SPI_MASK - #define BCM6358_RESET_ENET SOFTRESET_6358_ENET_MASK -@@ -114,6 +120,8 @@ - #define BCM6358_RESET_MPI SOFTRESET_6358_MPI_MASK - #define BCM6358_RESET_PCIE 0 - #define BCM6358_RESET_PCIE_EXT 0 -+#define BCM6358_RESET_PCIE_CORE 0 -+#define BCM6358_RESET_PCIE_HARD 0 - - #define BCM6362_RESET_SPI SOFTRESET_6362_SPI_MASK - #define BCM6362_RESET_ENET 0 -@@ -125,9 +133,10 @@ - #define BCM6362_RESET_ENETSW SOFTRESET_6362_ENETSW_MASK - #define BCM6362_RESET_PCM SOFTRESET_6362_PCM_MASK - #define BCM6362_RESET_MPI 0 --#define BCM6362_RESET_PCIE (SOFTRESET_6362_PCIE_MASK | \ -- SOFTRESET_6362_PCIE_CORE_MASK) -+#define BCM6362_RESET_PCIE SOFTRESET_6362_PCIE_MASK - #define BCM6362_RESET_PCIE_EXT SOFTRESET_6362_PCIE_EXT_MASK -+#define BCM6362_RESET_PCIE_CORE SOFTRESET_6362_PCIE_CORE_MASK -+#define BCM6362_RESET_PCIE_HARD 0 - - #define BCM6368_RESET_SPI SOFTRESET_6368_SPI_MASK - #define BCM6368_RESET_ENET 0 -@@ -141,6 +150,8 @@ - #define BCM6368_RESET_MPI SOFTRESET_6368_MPI_MASK - #define BCM6368_RESET_PCIE 0 - #define BCM6368_RESET_PCIE_EXT 0 -+#define BCM6368_RESET_PCIE_CORE 0 -+#define BCM6368_RESET_PCIE_HARD 0 - - #define BCM63268_RESET_SPI SOFTRESET_63268_SPI_MASK - #define BCM63268_RESET_ENET 0 -@@ -152,10 +163,10 @@ - #define BCM63268_RESET_ENETSW SOFTRESET_63268_ENETSW_MASK - #define BCM63268_RESET_PCM SOFTRESET_63268_PCM_MASK - #define BCM63268_RESET_MPI 0 --#define BCM63268_RESET_PCIE (SOFTRESET_63268_PCIE_MASK | \ -- SOFTRESET_63268_PCIE_CORE_MASK | \ -- SOFTRESET_63268_PCIE_HARD_MASK) -+#define BCM63268_RESET_PCIE SOFTRESET_63268_PCIE_MASK - #define BCM63268_RESET_PCIE_EXT SOFTRESET_63268_PCIE_EXT_MASK -+#define BCM63268_RESET_PCIE_CORE SOFTRESET_63268_PCIE_CORE_MASK -+#define BCM63268_RESET_PCIE_HARD SOFTRESET_63268_PCIE_HARD_MASK - - /* - * core reset bits ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h -@@ -14,6 +14,8 @@ enum bcm63xx_core_reset { - BCM63XX_RESET_MPI, - BCM63XX_RESET_PCIE, - BCM63XX_RESET_PCIE_EXT, -+ BCM63XX_RESET_PCIE_CORE, -+ BCM63XX_RESET_PCIE_HARD, - }; - - void bcm63xx_core_set_reset(enum bcm63xx_core_reset, int reset); ---- a/arch/mips/pci/pci-bcm63xx.c -+++ b/arch/mips/pci/pci-bcm63xx.c -@@ -135,9 +135,16 @@ static void __init bcm63xx_reset_pcie(vo - - /* reset the PCIe core */ - bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 1); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_CORE, 1); - bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_EXT, 1); -+ if (BCMCPU_IS_6328() || BCMCPU_IS_63268()) { -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_HARD, 1); -+ mdelay(10); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_HARD, 0); -+ } - mdelay(10); - -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_CORE, 0); - bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 0); - mdelay(10); - diff --git a/target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch b/target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch deleted file mode 100644 index cc2937c57..000000000 --- a/target/linux/brcm63xx/patches-4.4/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch +++ /dev/null @@ -1,333 +0,0 @@ -From 11a8ab8dac4ef5d0d70199843043927edce1d4db Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 15 Dec 2013 20:47:34 +0100 -Subject: [PATCH 53/53] MIPS: BCM63XX: add PCIe support for BCM6318 - ---- - arch/mips/bcm63xx/clk.c | 25 ++++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | 6 ++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 60 +++++++++++- - arch/mips/pci/ops-bcm63xx.c | 16 +++- - arch/mips/pci/pci-bcm63xx.c | 106 ++++++++++++++++++---- - 5 files changed, 184 insertions(+), 29 deletions(-) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -51,6 +51,18 @@ static void bcm_hwclock_set(u32 mask, in - bcm_perf_writel(reg, PERF_CKCTL_REG); - } - -+static void bcm_ub_hwclock_set(u32 mask, int enable) -+{ -+ u32 reg; -+ -+ reg = bcm_perf_readl(PERF_UB_CKCTL_REG); -+ if (enable) -+ reg |= mask; -+ else -+ reg &= ~mask; -+ bcm_perf_writel(reg, PERF_UB_CKCTL_REG); -+} -+ - /* - * Ethernet MAC "misc" clock: dma clocks and main clock on 6348 - */ -@@ -361,12 +373,17 @@ static struct clk clk_ipsec = { - - static void pcie_set(struct clk *clk, int enable) - { -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6318()) { -+ bcm_hwclock_set(CKCTL_6318_PCIE_EN, enable); -+ bcm_hwclock_set(CKCTL_6318_PCIE25_EN, enable); -+ bcm_ub_hwclock_set(UB_CKCTL_6318_PCIE_EN, enable); -+ } else if (BCMCPU_IS_6328()) { - bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable); -- else if (BCMCPU_IS_6362()) -+ } else if (BCMCPU_IS_6362()) { - bcm_hwclock_set(CKCTL_6362_PCIE_EN, enable); -- else if (BCMCPU_IS_63268()) -+ } else if (BCMCPU_IS_63268()) { - bcm_hwclock_set(CKCTL_63268_PCIE_EN, enable); -+ } - } - - static struct clk clk_pcie = { ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -40,6 +40,12 @@ - #define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \ - BCM_CB_MEM_SIZE - 1) - -+#define BCM_PCIE_MEM_BASE_PA_6318 0x10200000 -+#define BCM_PCIE_MEM_SIZE_6318 (1 * 1024 * 1024) -+#define BCM_PCIE_MEM_END_PA_6318 (BCM_PCIE_MEM_BASE_PA_6318 + \ -+ BCM_PCIE_MEM_SIZE_6318 - 1) -+ -+ - #define BCM_PCIE_MEM_BASE_PA_6328 0x10f00000 - #define BCM_PCIE_MEM_SIZE_6328 (1 * 1024 * 1024) - #define BCM_PCIE_MEM_END_PA_6328 (BCM_PCIE_MEM_BASE_PA_6328 + \ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -1529,6 +1529,17 @@ - * _REG relative to RSET_PCIE - *************************************************************************/ - -+#define PCIE_SPECIFIC_REG 0x188 -+#define SPECIFIC_ENDIAN_MODE_BAR1_SHIFT 0 -+#define SPECIFIC_ENDIAN_MODE_BAR1_MASK (0x3 << SPECIFIC_ENDIAN_MODE_BAR1_SHIFT) -+#define SPECIFIC_ENDIAN_MODE_BAR2_SHIFT 2 -+#define SPECIFIC_ENDIAN_MODE_BAR2_MASK (0x3 << SPECIFIC_ENDIAN_MODE_BAR1_SHIFT) -+#define SPECIFIC_ENDIAN_MODE_BAR3_SHIFT 4 -+#define SPECIFIC_ENDIAN_MODE_BAR3_MASK (0x3 << SPECIFIC_ENDIAN_MODE_BAR1_SHIFT) -+#define SPECIFIC_ENDIAN_MODE_WORD_ALIGN 0 -+#define SPECIFIC_ENDIAN_MODE_HALFWORD_ALIGN 1 -+#define SPECIFIC_ENDIAN_MODE_BYTE_ALIGN 2 -+ - #define PCIE_CONFIG2_REG 0x408 - #define CONFIG2_BAR1_SIZE_EN 1 - #define CONFIG2_BAR1_SIZE_MASK 0xf -@@ -1574,7 +1585,54 @@ - #define PCIE_RC_INT_C (1 << 2) - #define PCIE_RC_INT_D (1 << 3) - --#define PCIE_DEVICE_OFFSET 0x8000 -+#define PCIE_CPU_2_PCIE_MEM_WIN0_LO_REG 0x400c -+#define C2P_MEM_WIN_ENDIAN_MODE_MASK 0x3 -+#define C2P_MEM_WIN_ENDIAN_NO_SWAP 0 -+#define C2P_MEM_WIN_ENDIAN_HALF_WORD_SWAP 1 -+#define C2P_MEM_WIN_ENDIAN_HALF_BYTE_SWAP 2 -+#define C2P_MEM_WIN_BASE_ADDR_SHIFT 20 -+#define C2P_MEM_WIN_BASE_ADDR_MASK (0xfff << C2P_MEM_WIN_BASE_ADDR_SHIFT) -+ -+#define PCIE_RC_BAR1_CONFIG_LO_REG 0x402c -+#define RC_BAR_CFG_LO_SIZE_256MB 0xd -+#define RC_BAR_CFG_LO_MATCH_ADDR_SHIFT 20 -+#define RC_BAR_CFG_LO_MATCH_ADDR_MASK (0xfff << RC_BAR_CFG_LO_MATCH_ADDR_SHIFT) -+ -+#define PCIE_CPU_2_PCIE_MEM_WIN0_BASELIMIT_REG 0x4070 -+#define C2P_BASELIMIT_LIMIT_SHIFT 20 -+#define C2P_BASELIMIT_LIMIT_MASK (0xfff << C2P_BASELIMIT_LIMIT_SHIFT) -+#define C2P_BASELIMIT_BASE_SHIFT 4 -+#define C2P_BASELIMIT_BASE_MASK (0xfff << C2P_BASELIMIT_BASE_SHIFT) -+ -+#define PCIE_UBUS_BAR1_CFG_REMAP_REG 0x4088 -+#define BAR1_CFG_REMAP_OFFSET_SHIFT 20 -+#define BAR1_CFG_REMAP_OFFSET_MASK (0xfff << BAR1_CFG_REMAP_OFFSET_SHIFT) -+#define BAR1_CFG_REMAP_ACCESS_EN 1 -+ -+#define PCIE_HARD_DEBUG_REG 0x4204 -+#define HARD_DEBUG_SERDES_IDDQ (1 << 23) -+ -+#define PCIE_CPU_INT1_MASK_CLEAR_REG 0x830c -+#define CPU_INT_PCIE_ERR_ATTN_CPU (1 << 0) -+#define CPU_INT_PCIE_INTA (1 << 1) -+#define CPU_INT_PCIE_INTB (1 << 2) -+#define CPU_INT_PCIE_INTC (1 << 3) -+#define CPU_INT_PCIE_INTD (1 << 4) -+#define CPU_INT_PCIE_INTR (1 << 5) -+#define CPU_INT_PCIE_NMI (1 << 6) -+#define CPU_INT_PCIE_UBUS (1 << 7) -+#define CPU_INT_IPI (1 << 8) -+ -+#define PCIE_EXT_CFG_INDEX_REG 0x8400 -+#define EXT_CFG_FUNC_NUM_SHIFT 12 -+#define EXT_CFG_FUNC_NUM_MASK (0x7 << EXT_CFG_FUNC_NUM_SHIFT) -+#define EXT_CFG_DEV_NUM_SHIFT 15 -+#define EXT_CFG_DEV_NUM_MASK (0xf << EXT_CFG_DEV_NUM_SHIFT) -+#define EXT_CFG_BUS_NUM_SHIFT 20 -+#define EXT_CFG_BUS_NUM_MASK (0xff << EXT_CFG_BUS_NUM_SHIFT) -+ -+#define PCIE_DEVICE_OFFSET_6318 0x9000 -+#define PCIE_DEVICE_OFFSET_6328 0x8000 - - /************************************************************************* - * _REG relative to RSET_OTP ---- a/arch/mips/pci/ops-bcm63xx.c -+++ b/arch/mips/pci/ops-bcm63xx.c -@@ -488,8 +488,12 @@ static int bcm63xx_pcie_read(struct pci_ - if (!bcm63xx_pcie_can_access(bus, devfn)) - return PCIBIOS_DEVICE_NOT_FOUND; - -- if (bus->number == PCIE_BUS_DEVICE) -- reg += PCIE_DEVICE_OFFSET; -+ if (bus->number == PCIE_BUS_DEVICE) { -+ if (BCMCPU_IS_6318()) -+ reg += PCIE_DEVICE_OFFSET_6318; -+ else -+ reg += PCIE_DEVICE_OFFSET_6328; -+ } - - data = bcm_pcie_readl(reg); - -@@ -508,8 +512,12 @@ static int bcm63xx_pcie_write(struct pci - if (!bcm63xx_pcie_can_access(bus, devfn)) - return PCIBIOS_DEVICE_NOT_FOUND; - -- if (bus->number == PCIE_BUS_DEVICE) -- reg += PCIE_DEVICE_OFFSET; -+ if (bus->number == PCIE_BUS_DEVICE) { -+ if (BCMCPU_IS_6318()) -+ reg += PCIE_DEVICE_OFFSET_6318; -+ else -+ reg += PCIE_DEVICE_OFFSET_6328; -+ } - - - data = bcm_pcie_readl(reg); ---- a/arch/mips/pci/pci-bcm63xx.c -+++ b/arch/mips/pci/pci-bcm63xx.c -@@ -118,7 +118,7 @@ static void bcm63xx_int_cfg_writel(u32 v - - void __iomem *pci_iospace_start; - --static void __init bcm63xx_reset_pcie(void) -+static void __init bcm63xx_reset_pcie_gen1(void) - { - u32 val; - u32 reg; -@@ -152,20 +152,32 @@ static void __init bcm63xx_reset_pcie(vo - mdelay(200); - } - --static struct clk *pcie_clk; -- --static int __init bcm63xx_register_pcie(void) -+static void __init bcm63xx_reset_pcie_gen2(void) - { - u32 val; - -- /* enable clock */ -- pcie_clk = clk_get(NULL, "pcie"); -- if (IS_ERR_OR_NULL(pcie_clk)) -- return -ENODEV; -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_HARD, 0); - -- clk_prepare_enable(pcie_clk); -+ /* reset the PCIe core */ -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 1); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_EXT, 1); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_CORE, 1); -+ mdelay(10); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_EXT, 0); -+ mdelay(10); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 0); -+ mdelay(10); -+ val = bcm_pcie_readl(PCIE_HARD_DEBUG_REG); -+ val &= ~HARD_DEBUG_SERDES_IDDQ; -+ bcm_pcie_writel(val, PCIE_HARD_DEBUG_REG); -+ mdelay(10); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_CORE, 0); -+ mdelay(200); -+} - -- bcm63xx_reset_pcie(); -+static void __init bcm63xx_init_pcie_gen1(void) -+{ -+ u32 val; - - /* configure the PCIe bridge */ - val = bcm_pcie_readl(PCIE_BRIDGE_OPT1_REG); -@@ -190,6 +202,65 @@ static int __init bcm63xx_register_pcie( - val |= OPT2_CFG_TYPE1_BD_SEL; - bcm_pcie_writel(val, PCIE_BRIDGE_OPT2_REG); - -+ /* set bar0 to little endian */ -+ val = (bcm_pcie_mem_resource.start >> 20) << BASEMASK_BASE_SHIFT; -+ val |= (bcm_pcie_mem_resource.end >> 20) << BASEMASK_MASK_SHIFT; -+ val |= BASEMASK_REMAP_EN; -+ bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_BASEMASK_REG); -+ -+ val = (bcm_pcie_mem_resource.start >> 20) << REBASE_ADDR_BASE_SHIFT; -+ bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_REBASE_ADDR_REG); -+} -+ -+static void __init bcm63xx_init_pcie_gen2(void) -+{ -+ u32 val; -+ -+ bcm_pcie_writel(CPU_INT_PCIE_INTA | CPU_INT_PCIE_INTB | -+ CPU_INT_PCIE_INTC | CPU_INT_PCIE_INTD, -+ PCIE_CPU_INT1_MASK_CLEAR_REG); -+ -+ val = bcm_pcie_mem_resource.end & C2P_BASELIMIT_LIMIT_MASK; -+ val |= (bcm_pcie_mem_resource.start >> C2P_BASELIMIT_LIMIT_SHIFT) << -+ C2P_BASELIMIT_BASE_SHIFT; -+ -+ bcm_pcie_writel(val, PCIE_CPU_2_PCIE_MEM_WIN0_BASELIMIT_REG); -+ -+ /* set bar0 to little endian */ -+ val = bcm_pcie_readl(PCIE_CPU_2_PCIE_MEM_WIN0_LO_REG); -+ val |= bcm_pcie_mem_resource.start & C2P_MEM_WIN_BASE_ADDR_MASK; -+ val |= C2P_MEM_WIN_ENDIAN_HALF_BYTE_SWAP; -+ bcm_pcie_writel(val, PCIE_CPU_2_PCIE_MEM_WIN0_LO_REG); -+ -+ bcm_pcie_writel(SPECIFIC_ENDIAN_MODE_BYTE_ALIGN, PCIE_SPECIFIC_REG); -+ bcm_pcie_writel(RC_BAR_CFG_LO_SIZE_256MB, PCIE_RC_BAR1_CONFIG_LO_REG); -+ bcm_pcie_writel(BAR1_CFG_REMAP_ACCESS_EN, PCIE_UBUS_BAR1_CFG_REMAP_REG); -+ -+ bcm_pcie_writel(PCIE_BUS_DEVICE << EXT_CFG_BUS_NUM_SHIFT, -+ PCIE_EXT_CFG_INDEX_REG); -+} -+ -+static struct clk *pcie_clk; -+ -+static int __init bcm63xx_register_pcie(void) -+{ -+ u32 val; -+ -+ /* enable clock */ -+ pcie_clk = clk_get(NULL, "pcie"); -+ if (IS_ERR_OR_NULL(pcie_clk)) -+ return -ENODEV; -+ -+ clk_prepare_enable(pcie_clk); -+ -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) { -+ bcm63xx_reset_pcie_gen1(); -+ bcm63xx_init_pcie_gen1(); -+ } else { -+ bcm63xx_reset_pcie_gen2(); -+ bcm63xx_init_pcie_gen2(); -+ } -+ - /* setup class code as bridge */ - val = bcm_pcie_readl(PCIE_IDVAL3_REG); - val &= ~IDVAL3_CLASS_CODE_MASK; -@@ -201,15 +272,6 @@ static int __init bcm63xx_register_pcie( - val &= ~CONFIG2_BAR1_SIZE_MASK; - bcm_pcie_writel(val, PCIE_CONFIG2_REG); - -- /* set bar0 to little endian */ -- val = (bcm_pcie_mem_resource.start >> 20) << BASEMASK_BASE_SHIFT; -- val |= (bcm_pcie_mem_resource.end >> 20) << BASEMASK_MASK_SHIFT; -- val |= BASEMASK_REMAP_EN; -- bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_BASEMASK_REG); -- -- val = (bcm_pcie_mem_resource.start >> 20) << REBASE_ADDR_BASE_SHIFT; -- bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_REBASE_ADDR_REG); -- - register_pci_controller(&bcm63xx_pcie_controller); - - return 0; -@@ -341,7 +403,10 @@ static int __init bcm63xx_pci_init(void) - if (!bcm63xx_pci_enabled) - return -ENODEV; - -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { -+ if (BCMCPU_IS_6318()) { -+ bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_6318; -+ bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_6318; -+ } if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { - bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_6328; - bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_6328; - } else if (BCMCPU_IS_63268()) { -@@ -350,6 +415,7 @@ static int __init bcm63xx_pci_init(void) - } - - switch (bcm63xx_get_cpu_id()) { -+ case BCM6318_CPU_ID: - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: - case BCM63268_CPU_ID: diff --git a/target/linux/brcm63xx/patches-4.4/344-MIPS-BCM63XX-detect-flash-type-early-and-store-the-r.patch b/target/linux/brcm63xx/patches-4.4/344-MIPS-BCM63XX-detect-flash-type-early-and-store-the-r.patch deleted file mode 100644 index f5b0e7766..000000000 --- a/target/linux/brcm63xx/patches-4.4/344-MIPS-BCM63XX-detect-flash-type-early-and-store-the-r.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 9a97177b907330971aa7bf41855fafc2602e1c18 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 22 Dec 2013 12:26:57 +0100 -Subject: [PATCH 51/56] MIPS: BCM63XX: detect flash type early and store the - result - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 10 +++++++--- - arch/mips/bcm63xx/prom.c | 4 ++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 ++ - 3 files changed, 13 insertions(+), 3 deletions(-) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -22,6 +22,8 @@ - #include - #include - -+static int flash_type; -+ - static struct mtd_partition mtd_partitions[] = { - { - .name = "cfe", -@@ -108,13 +110,15 @@ static int __init bcm63xx_detect_flash_t - } - } - -+void __init bcm63xx_flash_detect(void) -+{ -+ flash_type = bcm63xx_detect_flash_type(); -+} -+ - int __init bcm63xx_flash_register(void) - { -- int flash_type; - u32 val; - -- flash_type = bcm63xx_detect_flash_type(); -- - switch (flash_type) { - case BCM63XX_FLASH_TYPE_PARALLEL: - /* read base address of boot chip select (0) */ ---- a/arch/mips/bcm63xx/prom.c -+++ b/arch/mips/bcm63xx/prom.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - - void __init prom_init(void) - { -@@ -52,6 +53,9 @@ void __init prom_init(void) - reg &= ~mask; - bcm_perf_writel(reg, PERF_CKCTL_REG); - -+ /* detect and setup flash access */ -+ bcm63xx_flash_detect(); -+ - /* do low level board init */ - board_prom_init(); - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -@@ -7,6 +7,8 @@ enum { - BCM63XX_FLASH_TYPE_NAND, - }; - -+void bcm63xx_flash_detect(void); -+ - int __init bcm63xx_flash_register(void); - - #endif /* __BCM63XX_FLASH_H */ diff --git a/target/linux/brcm63xx/patches-4.4/345-MIPS-BCM63XX-fixup-mapped-SPI-flash-access-on-boot.patch b/target/linux/brcm63xx/patches-4.4/345-MIPS-BCM63XX-fixup-mapped-SPI-flash-access-on-boot.patch deleted file mode 100644 index c8bef1362..000000000 --- a/target/linux/brcm63xx/patches-4.4/345-MIPS-BCM63XX-fixup-mapped-SPI-flash-access-on-boot.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 1cacd0f7b0d35f8e3d3f8a69ecb3b5e436d6b9e8 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 22 Dec 2013 13:25:25 +0100 -Subject: [PATCH 52/56] MIPS: BCM63XX: fixup mapped SPI flash access on boot - -Some bootloaders leave the flash access in an invalid state with dual -read enabled; fix it by disabling it and falling back to simple fast -reads. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 51 ++++++++++++++++++++++++++++++++++++ - 1 file changed, 51 insertions(+) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -110,9 +111,59 @@ static int __init bcm63xx_detect_flash_t - } - } - -+#define HSSPI_FLASH_CTRL_REG 0x14 -+#define FLASH_CTRL_READ_OPCODE_MASK 0xff -+#define FLASH_CTRL_ADDR_BYTES_MASK (0x3 << 8) -+#define FLASH_CTRL_ADDR_BYTES_2 (0 << 8) -+#define FLASH_CTRL_ADDR_BYTES_3 (1 << 8) -+#define FLASH_CTRL_ADDR_BYTES_4 (2 << 8) -+#define FLASH_CTRL_DUMMY_BYTES_SHIFT 10 -+#define FLASH_CTRL_DUMMY_BYTES_MASK (0x3 << FLASH_CTRL_DUMMY_BYTES_SHIFT) -+#define FLASH_CTRL_MB_EN (1 << 23) -+ - void __init bcm63xx_flash_detect(void) - { - flash_type = bcm63xx_detect_flash_type(); -+ -+ /* ensure flash mapping has sane values */ -+ if (flash_type == BCM63XX_FLASH_TYPE_SERIAL && -+ (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() || -+ BCMCPU_IS_63268())) { -+ u32 val = bcm_rset_readl(RSET_HSSPI, HSSPI_FLASH_CTRL_REG); -+ -+ if (val & FLASH_CTRL_MB_EN) { -+ /* cfe might configure non working dual-io mode */ -+ val &= ~FLASH_CTRL_MB_EN; -+ val &= ~FLASH_CTRL_READ_OPCODE_MASK; -+ val &= ~FLASH_CTRL_DUMMY_BYTES_MASK; -+ val |= 1 << FLASH_CTRL_DUMMY_BYTES_SHIFT; -+ -+ switch (val & FLASH_CTRL_ADDR_BYTES_MASK) { -+ case FLASH_CTRL_ADDR_BYTES_3: -+ val |= SPINOR_OP_READ_FAST; -+ break; -+ case FLASH_CTRL_ADDR_BYTES_4: -+ val |= SPINOR_OP_READ4_FAST; -+ break; -+ case FLASH_CTRL_ADDR_BYTES_2: -+ default: -+ pr_warn("unsupported address byte mode (%x), not fixing up\n", -+ val & FLASH_CTRL_ADDR_BYTES_MASK); -+ return; -+ } -+ } else { -+ /* ensure dummy bytes is set to 1 for _FAST reads */ -+ u8 cmd = val & FLASH_CTRL_READ_OPCODE_MASK; -+ -+ if (cmd != SPINOR_OP_READ_FAST && cmd != SPINOR_OP_READ4_FAST) -+ return; -+ -+ val &= ~FLASH_CTRL_DUMMY_BYTES_MASK; -+ val |= 1 << FLASH_CTRL_DUMMY_BYTES_SHIFT; -+ } -+ -+ bcm_rset_writel(RSET_HSSPI, val, HSSPI_FLASH_CTRL_REG); -+ } - } - - int __init bcm63xx_flash_register(void) diff --git a/target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch b/target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch deleted file mode 100644 index 8e4efeb8d..000000000 --- a/target/linux/brcm63xx/patches-4.4/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -167,7 +167,11 @@ static struct clk clk_swpkt_usb = { - */ - static void enetsw_set(struct clk *clk, int enable) - { -- if (BCMCPU_IS_6328()) { -+ if (BCMCPU_IS_6318()) { -+ bcm_hwclock_set(CKCTL_6318_ROBOSW250_EN | -+ CKCTL_6318_ROBOSW025_EN, enable); -+ bcm_ub_hwclock_set(UB_CKCTL_6318_ROBOSW_EN, enable); -+ } else if (BCMCPU_IS_6328()) { - bcm_hwclock_set(CKCTL_6328_ROBOSW_EN, enable); - } else if (BCMCPU_IS_6362()) { - bcm_hwclock_set(CKCTL_6362_ROBOSW_EN, enable); -@@ -219,18 +223,22 @@ static struct clk clk_pcm = { - */ - static void usbh_set(struct clk *clk, int enable) - { -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6318()) { -+ bcm_hwclock_set(CKCTL_6318_USB_EN, enable); -+ bcm_ub_hwclock_set(UB_CKCTL_6318_USB_EN, enable); -+ } else if (BCMCPU_IS_6328()) { - bcm_hwclock_set(CKCTL_6328_USBH_EN, enable); -- else if (BCMCPU_IS_6348()) -+ } else if (BCMCPU_IS_6348()) { - bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); -- else if (BCMCPU_IS_6362()) -+ } else if (BCMCPU_IS_6362()) { - bcm_hwclock_set(CKCTL_6362_USBH_EN, enable); -- else if (BCMCPU_IS_6368()) -+ } else if (BCMCPU_IS_6368()) { - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); -- else if (BCMCPU_IS_63268()) -+ } else if (BCMCPU_IS_63268()) { - bcm_hwclock_set(CKCTL_63268_USBH_EN, enable); -- else -+ } else { - return; -+ } - - if (enable) - msleep(100); diff --git a/target/linux/brcm63xx/patches-4.4/347-MIPS-BCM6318-USB-support.patch b/target/linux/brcm63xx/patches-4.4/347-MIPS-BCM6318-USB-support.patch deleted file mode 100644 index db489f8b6..000000000 --- a/target/linux/brcm63xx/patches-4.4/347-MIPS-BCM6318-USB-support.patch +++ /dev/null @@ -1,124 +0,0 @@ ---- a/arch/mips/bcm63xx/usb-common.c -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -109,6 +109,27 @@ void bcm63xx_usb_priv_ohci_cfg_set(void) - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); - reg |= USBH_PRIV_SETUP_IOC_MASK; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } else if (BCMCPU_IS_6318()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -+ reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG); -+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6318_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -+ reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG); -+ reg |= USBH_PRIV_SIM_CTRL_LADDR_SEL; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SIM_CTRL_6318_REG); - } - - spin_unlock_irqrestore(&usb_priv_reg_lock, flags); -@@ -144,6 +165,27 @@ void bcm63xx_usb_priv_ehci_cfg_set(void) - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); - reg |= USBH_PRIV_SETUP_IOC_MASK; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } else if (BCMCPU_IS_6318()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -+ reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6318_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -+ reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG); -+ reg |= USBH_PRIV_SIM_CTRL_LADDR_SEL; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SIM_CTRL_6318_REG); - } - - spin_unlock_irqrestore(&usb_priv_reg_lock, flags); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -681,6 +681,12 @@ - #define GPIO_MODE_6368_SPI_SSN4 (1 << 30) - #define GPIO_MODE_6368_SPI_SSN5 (1 << 31) - -+#define GPIO_PINMUX_SEL0_6318 0x1c -+#define GPIO_PINMUX_SEL0_GPIO13_SHIFT 26 -+#define GPIO_PINMUX_SEL0_GPIO13_MASK (0x3 << GPIO_PINMUX_SEL0_GPIO13_SHIFT) -+#define GPIO_PINMUX_SEL0_GPIO13_PWRON (1 << GPIO_PINMUX_SEL0_GPIO13_SHIFT) -+#define GPIO_PINMUX_SEL0_GPIO13_LED (2 << GPIO_PINMUX_SEL0_GPIO13_SHIFT) -+#define GPIO_PINMUX_SEL0_GPIO13_GPIO (3 << GPIO_PINMUX_SEL0_GPIO13_SHIFT) - - #define GPIO_PINMUX_OTHR_REG 0x24 - #define GPIO_PINMUX_OTHR_6328_USB_SHIFT 12 -@@ -999,6 +1005,7 @@ - - #define USBH_PRIV_SWAP_6358_REG 0x0 - #define USBH_PRIV_SWAP_6368_REG 0x1c -+#define USBH_PRIV_SWAP_6318_REG 0x0c - - #define USBH_PRIV_SWAP_USBD_SHIFT 6 - #define USBH_PRIV_SWAP_USBD_MASK (1 << USBH_PRIV_SWAP_USBD_SHIFT) -@@ -1024,6 +1031,13 @@ - #define USBH_PRIV_SETUP_IOC_SHIFT 4 - #define USBH_PRIV_SETUP_IOC_MASK (1 << USBH_PRIV_SETUP_IOC_SHIFT) - -+#define USBH_PRIV_SETUP_6318_REG 0x00 -+#define USBH_PRIV_PLL_CTRL1_6318_REG 0x04 -+#define USBH_PRIV_PLL_CTRL1_SUSP_EN (1 << 27) -+#define USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN (1 << 31) -+#define USBH_PRIV_SIM_CTRL_6318_REG 0x20 -+#define USBH_PRIV_SIM_CTRL_LADDR_SEL (1 << 5) -+ - - /************************************************************************* - * _REG relative to RSET_USBD ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -126,6 +126,15 @@ void __init board_early_setup(const stru - } - - bcm_gpio_writel(val, GPIO_MODE_REG); -+ -+#if IS_ENABLED(CONFIG_USB) -+ if (BCMCPU_IS_6318() && (board.has_ehci0 || board.has_ohci0)) { -+ val = bcm_gpio_readl(GPIO_PINMUX_SEL0_6318); -+ val &= ~GPIO_PINMUX_SEL0_GPIO13_MASK; -+ val |= GPIO_PINMUX_SEL0_GPIO13_PWRON; -+ bcm_gpio_writel(val, GPIO_PINMUX_SEL0_6318); -+ } -+#endif - } - - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -22,6 +22,8 @@ config BCM63XX_CPU_6318 - bool "support 6318 CPU" - select SYS_HAS_CPU_BMIPS32_3300 - select HW_HAS_PCI -+ select BCM63XX_OHCI -+ select BCM63XX_EHCI - - config BCM63XX_CPU_6328 - bool "support 6328 CPU" diff --git a/target/linux/brcm63xx/patches-4.4/348-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch b/target/linux/brcm63xx/patches-4.4/348-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch deleted file mode 100644 index 0b8a5a170..000000000 --- a/target/linux/brcm63xx/patches-4.4/348-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -586,6 +586,9 @@ - #define TIMER_CTL_MONOTONIC_MASK (1 << 30) - #define TIMER_CTL_ENABLE_MASK (1 << 31) - -+/* Clock reset control (63268 only) */ -+#define TIMER_CLK_RST_CTL_REG 0x2c -+#define CLK_RST_CTL_USB_REF_CLK_EN (1 << 18) - - /************************************************************************* - * _REG relative to RSET_WDT -@@ -1533,6 +1536,11 @@ - #define STRAPBUS_63268_FCVO_SHIFT 21 - #define STRAPBUS_63268_FCVO_MASK (0xf << STRAPBUS_63268_FCVO_SHIFT) - -+#define MISC_IDDQ_CTRL_6328_REG 0x48 -+#define MISC_IDDQ_CTRL_63268_REG 0x4c -+ -+#define IDDQ_CTRL_63268_USBH (1 << 4) -+ - #define MISC_STRAPBUS_6328_REG 0x240 - #define STRAPBUS_6328_FCVO_SHIFT 7 - #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT) ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -63,6 +63,26 @@ static void bcm_ub_hwclock_set(u32 mask, - bcm_perf_writel(reg, PERF_UB_CKCTL_REG); - } - -+static void bcm_misc_iddq_set(u32 mask, int enable) -+{ -+ u32 offset; -+ u32 reg; -+ -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) -+ offset = MISC_IDDQ_CTRL_6328_REG; -+ else if (BCMCPU_IS_63268()) -+ offset = MISC_IDDQ_CTRL_63268_REG; -+ else -+ return; -+ -+ reg = bcm_misc_readl(offset); -+ if (enable) -+ reg &= ~mask; -+ else -+ reg |= mask; -+ bcm_misc_writel(reg, offset); -+} -+ - /* - * Ethernet MAC "misc" clock: dma clocks and main clock on 6348 - */ -@@ -235,7 +255,17 @@ static void usbh_set(struct clk *clk, in - } else if (BCMCPU_IS_6368()) { - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); - } else if (BCMCPU_IS_63268()) { -+ u32 reg; -+ - bcm_hwclock_set(CKCTL_63268_USBH_EN, enable); -+ bcm_misc_iddq_set(IDDQ_CTRL_63268_USBH, enable); -+ bcm63xx_core_set_reset(BCM63XX_RESET_USBH, !enable); -+ reg = bcm_timer_readl(TIMER_CLK_RST_CTL_REG); -+ if (enable) -+ reg |= CLK_RST_CTL_USB_REF_CLK_EN; -+ else -+ reg &= ~CLK_RST_CTL_USB_REF_CLK_EN; -+ bcm_timer_writel(reg, TIMER_CLK_RST_CTL_REG); - } else { - return; - } diff --git a/target/linux/brcm63xx/patches-4.4/349-MIPS-BCM63XX-add-BCM63268-USB-support.patch b/target/linux/brcm63xx/patches-4.4/349-MIPS-BCM63XX-add-BCM63268-USB-support.patch deleted file mode 100644 index 0b709915a..000000000 --- a/target/linux/brcm63xx/patches-4.4/349-MIPS-BCM63XX-add-BCM63268-USB-support.patch +++ /dev/null @@ -1,117 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -1033,11 +1033,18 @@ - #define USBH_PRIV_SETUP_6368_REG 0x28 - #define USBH_PRIV_SETUP_IOC_SHIFT 4 - #define USBH_PRIV_SETUP_IOC_MASK (1 << USBH_PRIV_SETUP_IOC_SHIFT) -+#define USBH_PRIV_SETUP_IPP_SHIFT 5 -+#define USBH_PRIV_SETUP_IPP_MASK (1 << USBH_PRIV_SETUP_IPP_SHIFT) - - #define USBH_PRIV_SETUP_6318_REG 0x00 -+#define USBH_PRIV_PLL_CTRL1_6368_REG 0x18 - #define USBH_PRIV_PLL_CTRL1_6318_REG 0x04 --#define USBH_PRIV_PLL_CTRL1_SUSP_EN (1 << 27) --#define USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN (1 << 31) -+ -+#define USBH_PRIV_PLL_CTRL1_6318_SUSP_EN (1 << 27) -+#define USBH_PRIV_PLL_CTRL1_6318_IDDQ_PWRDN (1 << 31) -+#define USBH_PRIV_PLL_CTRL1_63268_IDDQ_PWRDN (1 << 9) -+#define USBH_PRIV_PLL_CTRL1_63268_PWRDN_DELAY (1 << 10) -+ - #define USBH_PRIV_SIM_CTRL_6318_REG 0x20 - #define USBH_PRIV_SIM_CTRL_LADDR_SEL (1 << 5) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -72,6 +72,8 @@ config BCM63XX_CPU_63268 - bool "support 63268 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HW_HAS_PCI -+ select BCM63XX_OHCI -+ select BCM63XX_EHCI - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" ---- a/arch/mips/bcm63xx/dev-usb-ehci.c -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -82,7 +82,7 @@ static struct platform_device bcm63xx_eh - int __init bcm63xx_ehci_register(void) - { - if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() && -- !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) -+ !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && !BCMCPU_IS_63268()) - return 0; - - ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); ---- a/arch/mips/bcm63xx/usb-common.c -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -109,9 +109,24 @@ void bcm63xx_usb_priv_ohci_cfg_set(void) - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); - reg |= USBH_PRIV_SETUP_IOC_MASK; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } else if (BCMCPU_IS_63268()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ reg &= ~USBH_PRIV_SETUP_IPP_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6368_REG); -+ reg &= ~(USBH_PRIV_PLL_CTRL1_63268_IDDQ_PWRDN | -+ USBH_PRIV_PLL_CTRL1_63268_PWRDN_DELAY); -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6368_REG); - } else if (BCMCPU_IS_6318()) { - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -- reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN; -+ reg |= USBH_PRIV_PLL_CTRL1_6318_SUSP_EN; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG); -@@ -124,7 +139,7 @@ void bcm63xx_usb_priv_ohci_cfg_set(void) - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -- reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN; -+ reg &= ~USBH_PRIV_PLL_CTRL1_6318_IDDQ_PWRDN; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG); -@@ -165,9 +180,24 @@ void bcm63xx_usb_priv_ehci_cfg_set(void) - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); - reg |= USBH_PRIV_SETUP_IOC_MASK; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } else if (BCMCPU_IS_63268()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ reg &= ~USBH_PRIV_SETUP_IPP_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6368_REG); -+ reg &= ~(USBH_PRIV_PLL_CTRL1_63268_IDDQ_PWRDN | -+ USBH_PRIV_PLL_CTRL1_63268_PWRDN_DELAY); -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6368_REG); - } else if (BCMCPU_IS_6318()) { - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -- reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN; -+ reg |= USBH_PRIV_PLL_CTRL1_6318_SUSP_EN; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG); -@@ -180,7 +210,7 @@ void bcm63xx_usb_priv_ehci_cfg_set(void) - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -- reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN; -+ reg &= ~USBH_PRIV_PLL_CTRL1_6318_IDDQ_PWRDN; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG); diff --git a/target/linux/brcm63xx/patches-4.4/350-MIPS-BCM63XX-support-settings-num-usbh-ports.patch b/target/linux/brcm63xx/patches-4.4/350-MIPS-BCM63XX-support-settings-num-usbh-ports.patch deleted file mode 100644 index 974c67f73..000000000 --- a/target/linux/brcm63xx/patches-4.4/350-MIPS-BCM63XX-support-settings-num-usbh-ports.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -41,6 +41,7 @@ struct board_info { - - /* USB config */ - struct bcm63xx_usbd_platform_data usbd; -+ unsigned int num_usbh_ports:2; - - /* DSP config */ - struct bcm63xx_dsp_platform_data dsp; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h -@@ -1,6 +1,6 @@ - #ifndef BCM63XX_DEV_USB_EHCI_H_ - #define BCM63XX_DEV_USB_EHCI_H_ - --int bcm63xx_ehci_register(void); -+int bcm63xx_ehci_register(unsigned int num_ports); - - #endif /* BCM63XX_DEV_USB_EHCI_H_ */ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h -@@ -1,6 +1,6 @@ - #ifndef BCM63XX_DEV_USB_OHCI_H_ - #define BCM63XX_DEV_USB_OHCI_H_ - --int bcm63xx_ohci_register(void); -+int bcm63xx_ohci_register(unsigned int num_ports); - - #endif /* BCM63XX_DEV_USB_OHCI_H_ */ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -166,6 +166,8 @@ static struct platform_device bcm63xx_gp - */ - int __init board_register_devices(void) - { -+ int usbh_ports = 0; -+ - if (board.has_uart0) - bcm63xx_uart_register(0); - -@@ -187,14 +189,21 @@ int __init board_register_devices(void) - !board_get_mac_address(board.enetsw.mac_addr)) - bcm63xx_enetsw_register(&board.enetsw); - -+ if ((board.has_ohci0 || board.has_ehci0)) { -+ usbh_ports = board.num_usbh_ports; -+ -+ if (!usbh_ports || WARN_ON(usbh_ports > 1 && board.has_usbd)) -+ usbh_ports = 1; -+ } -+ - if (board.has_usbd) - bcm63xx_usbd_register(&board.usbd); - - if (board.has_ehci0) -- bcm63xx_ehci_register(); -+ bcm63xx_ehci_register(usbh_ports); - - if (board.has_ohci0) -- bcm63xx_ohci_register(); -+ bcm63xx_ohci_register(usbh_ports); - - if (board.has_dsp) - bcm63xx_dsp_register(&board.dsp); ---- a/arch/mips/bcm63xx/dev-usb-ehci.c -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -79,12 +79,14 @@ static struct platform_device bcm63xx_eh - }, - }; - --int __init bcm63xx_ehci_register(void) -+int __init bcm63xx_ehci_register(unsigned int num_ports) - { - if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() && - !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && !BCMCPU_IS_63268()) - return 0; - -+ bcm63xx_ehci_pdata.num_ports = num_ports; -+ - ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); - ehci_resources[0].end = ehci_resources[0].start; - ehci_resources[0].end += RSET_EHCI_SIZE - 1; ---- a/arch/mips/bcm63xx/dev-usb-ohci.c -+++ b/arch/mips/bcm63xx/dev-usb-ohci.c -@@ -62,7 +62,6 @@ static struct usb_ohci_pdata bcm63xx_ohc - .big_endian_desc = 1, - .big_endian_mmio = 1, - .no_big_frame_no = 1, -- .num_ports = 1, - .power_on = bcm63xx_ohci_power_on, - .power_off = bcm63xx_ohci_power_off, - .power_suspend = bcm63xx_ohci_power_off, -@@ -80,11 +79,13 @@ static struct platform_device bcm63xx_oh - }, - }; - --int __init bcm63xx_ohci_register(void) -+int __init bcm63xx_ohci_register(unsigned int num_ports) - { - if (BCMCPU_IS_6345() || BCMCPU_IS_6338()) - return -ENODEV; - -+ bcm63xx_ohci_pdata.num_ports = num_ports; -+ - ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0); - ohci_resources[0].end = ohci_resources[0].start; - ohci_resources[0].end += RSET_OHCI_SIZE - 1; diff --git a/target/linux/brcm63xx/patches-4.4/351-set-board-usbh-ports.patch b/target/linux/brcm63xx/patches-4.4/351-set-board-usbh-ports.patch deleted file mode 100644 index 284475cc7..000000000 --- a/target/linux/brcm63xx/patches-4.4/351-set-board-usbh-ports.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -592,6 +592,7 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pccard = 1, - .has_ehci0 = 1, -+ .num_usbh_ports = 2, - - .leds = { - { diff --git a/target/linux/brcm63xx/patches-4.4/354-MIPS-BCM63XX-allow-building-support-for-more-than-on.patch b/target/linux/brcm63xx/patches-4.4/354-MIPS-BCM63XX-allow-building-support-for-more-than-on.patch deleted file mode 100644 index bc37d97da..000000000 --- a/target/linux/brcm63xx/patches-4.4/354-MIPS-BCM63XX-allow-building-support-for-more-than-on.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 0daf361ea799fba0af5a232036d0f06cea85ad24 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 21 Jun 2014 12:47:49 +0200 -Subject: [PATCH 42/44] MIPS: BCM63XX: allow building support for more than one - board type - -Use the arguments passed to the kernel to detect being booted with -CFE as the indicator for bcm963xx board support, allowing the -non presence of CFE_EPTSEAL to assume a different board type. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/Kconfig | 7 +++---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- - arch/mips/bcm63xx/boards/board_common.c | 13 +++++++++++++ - arch/mips/bcm63xx/boards/board_common.h | 6 ++++++ - 4 files changed, 23 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/boards/Kconfig -+++ b/arch/mips/bcm63xx/boards/Kconfig -@@ -1,11 +1,10 @@ --choice -- prompt "Board support" -+menu "Board support" - depends on BCM63XX -- default BOARD_BCM963XX - - config BOARD_BCM963XX - bool "Generic Broadcom 963xx boards" - select SSB -+ default y - help - --endchoice -+endmenu ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -702,7 +702,7 @@ static const struct board_info __initcon - /* - * early init callback, read nvram data from flash and checksum it - */ --void __init board_prom_init(void) -+void __init board_bcm963xx_init(void) - { - unsigned int i; - u8 *boot_addr, *cfe; ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -13,6 +13,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -31,6 +33,8 @@ - #include - #include - -+#include "board_common.h" -+ - #define PFX "board: " - - static struct board_info board; -@@ -81,6 +85,15 @@ const char *board_get_name(void) - return board.name; - } - -+void __init board_prom_init(void) -+{ -+ /* detect bootloader */ -+ if (fw_arg3 == CFE_EPTSEAL) -+ board_bcm963xx_init(); -+ else -+ panic("unsupported bootloader detected"); -+} -+ - static int (*board_get_mac_address)(u8 mac[ETH_ALEN]); - - /* ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -6,4 +6,10 @@ - void board_early_setup(const struct board_info *board, - int (*get_mac_address)(u8 mac[ETH_ALEN])); - -+#if defined(CONFIG_BOARD_BCM963XX) -+void board_bcm963xx_init(void); -+#else -+static inline void board_bcm963xx_init(void) { } -+#endif -+ - #endif /* __BOARD_COMMON_H */ diff --git a/target/linux/brcm63xx/patches-4.4/355-MIPS-BCM63XX-allow-board-implementations-to-force-fl.patch b/target/linux/brcm63xx/patches-4.4/355-MIPS-BCM63XX-allow-board-implementations-to-force-fl.patch deleted file mode 100644 index bdbba036b..000000000 --- a/target/linux/brcm63xx/patches-4.4/355-MIPS-BCM63XX-allow-board-implementations-to-force-fl.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 8a30097a899b975709f728666d5ad20c8b832d21 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 9 Mar 2014 04:28:14 +0100 -Subject: [PATCH 43/44] MIPS: BCM63XX: allow board implementations to force - flash address - -Allow board implementations to force the physmap address. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 19 ++++++++++++++----- - .../mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 ++ - 2 files changed, 16 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -58,6 +58,12 @@ static struct platform_device mtd_dev = - }, - }; - -+void __init bcm63xx_flash_force_phys_base_address(u32 start, u32 end) -+{ -+ mtd_resources[0].start = start; -+ mtd_resources[0].end = end; -+} -+ - static int __init bcm63xx_detect_flash_type(void) - { - u32 val; -@@ -172,12 +178,15 @@ int __init bcm63xx_flash_register(void) - - switch (flash_type) { - case BCM63XX_FLASH_TYPE_PARALLEL: -- /* read base address of boot chip select (0) */ -- val = bcm_mpi_readl(MPI_CSBASE_REG(0)); -- val &= MPI_CSBASE_BASE_MASK; - -- mtd_resources[0].start = val; -- mtd_resources[0].end = 0x1FFFFFFF; -+ if (!mtd_resources[0].start) { -+ /* read base address of boot chip select (0) */ -+ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); -+ val &= MPI_CSBASE_BASE_MASK; -+ -+ mtd_resources[0].start = val; -+ mtd_resources[0].end = 0x1FFFFFFF; -+ } - - return platform_device_register(&mtd_dev); - case BCM63XX_FLASH_TYPE_SERIAL: ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -@@ -9,6 +9,8 @@ enum { - - void bcm63xx_flash_detect(void); - -+void bcm63xx_flash_force_phys_base_address(u32 start, u32 end); -+ - int __init bcm63xx_flash_register(void); - - #endif /* __BCM63XX_FLASH_H */ diff --git a/target/linux/brcm63xx/patches-4.4/356-MIPS-BCM63XX-move-fallback-sprom-support-into-its-ow.patch b/target/linux/brcm63xx/patches-4.4/356-MIPS-BCM63XX-move-fallback-sprom-support-into-its-ow.patch deleted file mode 100644 index cec6c7e1a..000000000 --- a/target/linux/brcm63xx/patches-4.4/356-MIPS-BCM63XX-move-fallback-sprom-support-into-its-ow.patch +++ /dev/null @@ -1,188 +0,0 @@ -From cc025e749a1fece61a6cc0d64bbe7b12472259cc Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 21:31:12 +0200 -Subject: [PATCH 01/10] MIPS: BCM63XX: move fallback sprom support into its own - unit - -In preparation for enhancing it, move it into its own file. Require a -mac address to be passed as the argument to always "reserve" the mac -regardless of the inclusion state of SSB. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/boards/board_common.c | 53 ++-------------- - arch/mips/bcm63xx/sprom.c | 70 ++++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 6 ++ - 4 files changed, 83 insertions(+), 48 deletions(-) - create mode 100644 arch/mips/bcm63xx/sprom.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -2,7 +2,7 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ - dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ - dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \ -- usb-common.o -+ usb-common.o sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -40,44 +40,6 @@ - static struct board_info board; - - /* -- * Register a sane SPROMv2 to make the on-board -- * bcm4318 WLAN work -- */ --#ifdef CONFIG_SSB_PCIHOST --static struct ssb_sprom bcm63xx_sprom = { -- .revision = 0x02, -- .board_rev = 0x17, -- .country_code = 0x0, -- .ant_available_bg = 0x3, -- .pa0b0 = 0x15ae, -- .pa0b1 = 0xfa85, -- .pa0b2 = 0xfe8d, -- .pa1b0 = 0xffff, -- .pa1b1 = 0xffff, -- .pa1b2 = 0xffff, -- .gpio0 = 0xff, -- .gpio1 = 0xff, -- .gpio2 = 0xff, -- .gpio3 = 0xff, -- .maxpwr_bg = 0x004c, -- .itssi_bg = 0x00, -- .boardflags_lo = 0x2848, -- .boardflags_hi = 0x0000, --}; -- --int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) --{ -- if (bus->bustype == SSB_BUSTYPE_PCI) { -- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -- return 0; -- } else { -- printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -- return -EINVAL; -- } --} --#endif -- --/* - * return board name for /proc/cpuinfo - */ - const char *board_get_name(void) -@@ -180,6 +142,7 @@ static struct platform_device bcm63xx_gp - int __init board_register_devices(void) - { - int usbh_ports = 0; -+ u8 mac[ETH_ALEN]; - - if (board.has_uart0) - bcm63xx_uart_register(0); -@@ -224,15 +187,10 @@ int __init board_register_devices(void) - /* Generate MAC address for WLAN and register our SPROM, - * do this after registering enet devices - */ --#ifdef CONFIG_SSB_PCIHOST -- if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { -- memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); -- memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); -- if (ssb_arch_register_fallback_sprom( -- &bcm63xx_get_fallback_sprom) < 0) -- pr_err(PFX "failed to register fallback SPROM\n"); -- } --#endif -+ -+ if (board_get_mac_address(mac) || -+ bcm63xx_register_fallback_sprom(mac)) -+ pr_err(PFX "failed to register fallback SPROM\n"); - - bcm63xx_spi_register(); - ---- /dev/null -+++ b/arch/mips/bcm63xx/sprom.c -@@ -0,0 +1,70 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2008 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define PFX "sprom: " -+ -+/* -+ * Register a sane SPROMv2 to make the on-board -+ * bcm4318 WLAN work -+ */ -+#ifdef CONFIG_SSB_PCIHOST -+static struct ssb_sprom bcm63xx_sprom = { -+ .revision = 0x02, -+ .board_rev = 0x17, -+ .country_code = 0x0, -+ .ant_available_bg = 0x3, -+ .pa0b0 = 0x15ae, -+ .pa0b1 = 0xfa85, -+ .pa0b2 = 0xfe8d, -+ .pa1b0 = 0xffff, -+ .pa1b1 = 0xffff, -+ .pa1b2 = 0xffff, -+ .gpio0 = 0xff, -+ .gpio1 = 0xff, -+ .gpio2 = 0xff, -+ .gpio3 = 0xff, -+ .maxpwr_bg = 0x004c, -+ .itssi_bg = 0x00, -+ .boardflags_lo = 0x2848, -+ .boardflags_hi = 0x0000, -+}; -+ -+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -+{ -+ if (bus->bustype == SSB_BUSTYPE_PCI) { -+ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ return 0; -+ } else { -+ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -+ return -EINVAL; -+ } -+} -+#endif -+ -+int __init bcm63xx_register_fallback_sprom(u8 *mac) -+{ -+ int ret = 0; -+ -+#ifdef CONFIG_SSB_PCIHOST -+ memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN); -+ -+ ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom); -+#endif -+ return ret; -+} ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -0,0 +1,6 @@ -+#ifndef __BCM63XX_FALLBACK_SPROM -+#define __BCM63XX_FALLBACK_SPROM -+ -+int bcm63xx_register_fallback_sprom(u8 *mac); -+ -+#endif diff --git a/target/linux/brcm63xx/patches-4.4/357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch b/target/linux/brcm63xx/patches-4.4/357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch deleted file mode 100644 index 011549cdc..000000000 --- a/target/linux/brcm63xx/patches-4.4/357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 9912a8b3c240a9b0af01ff496b7e8ed9e4cc5b82 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 21:43:49 +0200 -Subject: [PATCH 02/10] MIPS: BCM63XX: use platform data for the sprom - -Similar to ethernet setup, use a platform data struct for passing -the mac. This eliminates the requirement to allocate an array on -stack for the mac passed. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_common.c | 6 ++---- - arch/mips/bcm63xx/sprom.c | 8 ++++---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 +++++++- - arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 4 ++++ - 4 files changed, 17 insertions(+), 9 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -142,7 +142,6 @@ static struct platform_device bcm63xx_gp - int __init board_register_devices(void) - { - int usbh_ports = 0; -- u8 mac[ETH_ALEN]; - - if (board.has_uart0) - bcm63xx_uart_register(0); -@@ -188,8 +187,8 @@ int __init board_register_devices(void) - * do this after registering enet devices - */ - -- if (board_get_mac_address(mac) || -- bcm63xx_register_fallback_sprom(mac)) -+ if (board_get_mac_address(board.fallback_sprom.mac_addr) || -+ bcm63xx_register_fallback_sprom(&board.fallback_sprom)) - pr_err(PFX "failed to register fallback SPROM\n"); - - bcm63xx_spi_register(); ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -55,14 +55,14 @@ int bcm63xx_get_fallback_sprom(struct ss - } - #endif - --int __init bcm63xx_register_fallback_sprom(u8 *mac) -+int __init bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data) - { - int ret = 0; - - #ifdef CONFIG_SSB_PCIHOST -- memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN); -- memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN); -- memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN); -+ memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); - - ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom); - #endif ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -1,6 +1,12 @@ - #ifndef __BCM63XX_FALLBACK_SPROM - #define __BCM63XX_FALLBACK_SPROM - --int bcm63xx_register_fallback_sprom(u8 *mac); -+#include -+ -+struct fallback_sprom_data { -+ u8 mac_addr[ETH_ALEN]; -+}; -+ -+int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data); - - #endif ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -7,6 +7,7 @@ - #include - #include - #include -+#include - - /* - * flash mapping -@@ -54,6 +55,9 @@ struct board_info { - - /* External PHY reset GPIO flags from gpio.h */ - unsigned long ephy_reset_gpio_flags; -+ -+ /* fallback sprom config */ -+ struct fallback_sprom_data fallback_sprom; - }; - - #endif /* ! BOARD_BCM963XX_H_ */ diff --git a/target/linux/brcm63xx/patches-4.4/358-MIPS-BCM63XX-make-fallback-sprom-optional.patch b/target/linux/brcm63xx/patches-4.4/358-MIPS-BCM63XX-make-fallback-sprom-optional.patch deleted file mode 100644 index 758fefda1..000000000 --- a/target/linux/brcm63xx/patches-4.4/358-MIPS-BCM63XX-make-fallback-sprom-optional.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 83131acbfb59760a19f3711c09526e191c8aad54 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 21:52:56 +0200 -Subject: [PATCH 03/10] MIPS: BCM63XX: make fallback sprom optional - -Some devices do not provide enough mac addresses to populate wifi in -addition to ethernet. - -Use having pci enabled as a rough heuristic which boards should have it -enabled. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 12 ++++++++++++ - arch/mips/bcm63xx/boards/board_common.c | 5 +++-- - arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 1 + - 3 files changed, 16 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -70,6 +70,7 @@ static struct board_info __initdata boar - .has_uart0 = 1, - .has_pci = 1, - .has_usbd = 0, -+ .use_fallback_sprom = 1, - - .usbd = { - .use_fullspeed = 0, -@@ -219,6 +220,7 @@ static struct board_info __initdata boar - .has_uart0 = 1, - .has_enet0 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -264,6 +266,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -324,6 +327,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -378,6 +382,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -436,6 +441,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -459,6 +465,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -477,6 +484,7 @@ static struct board_info __initdata boar - - .has_uart0 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - .has_ohci0 = 1, - - .has_enet0 = 1, -@@ -499,6 +507,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -525,6 +534,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -577,6 +587,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, -@@ -648,6 +659,7 @@ static struct board_info __initdata boar - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .enet0 = { - .has_phy = 1, ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -187,8 +187,9 @@ int __init board_register_devices(void) - * do this after registering enet devices - */ - -- if (board_get_mac_address(board.fallback_sprom.mac_addr) || -- bcm63xx_register_fallback_sprom(&board.fallback_sprom)) -+ if (board.use_fallback_sprom && -+ (board_get_mac_address(board.fallback_sprom.mac_addr) || -+ bcm63xx_register_fallback_sprom(&board.fallback_sprom))) - pr_err(PFX "failed to register fallback SPROM\n"); - - bcm63xx_spi_register(); ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -34,6 +34,7 @@ struct board_info { - unsigned int has_dsp:1; - unsigned int has_uart0:1; - unsigned int has_uart1:1; -+ unsigned int use_fallback_sprom:1; - - /* ethernet config */ - struct bcm63xx_enet_platform_data enet0; diff --git a/target/linux/brcm63xx/patches-4.4/359-MIPS-BCM63XX-allow-different-types-of-sprom.patch b/target/linux/brcm63xx/patches-4.4/359-MIPS-BCM63XX-allow-different-types-of-sprom.patch deleted file mode 100644 index 0c4a9be47..000000000 --- a/target/linux/brcm63xx/patches-4.4/359-MIPS-BCM63XX-allow-different-types-of-sprom.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 1cece9f7aca1f0c193edce201f77a87008c5a405 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 21:58:38 +0200 -Subject: [PATCH 04/10] MIPS: BCM63XX: allow different types of sprom - -Different chips require different sprom contents, so prepare for -supplying the appropriate sprom type. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 13 ++++++++++++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 5 +++++ - 2 files changed, 17 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -22,7 +22,7 @@ - * bcm4318 WLAN work - */ - #ifdef CONFIG_SSB_PCIHOST --static struct ssb_sprom bcm63xx_sprom = { -+static __initconst struct ssb_sprom bcm63xx_default_sprom = { - .revision = 0x02, - .board_rev = 0x17, - .country_code = 0x0, -@@ -43,6 +43,8 @@ static struct ssb_sprom bcm63xx_sprom = - .boardflags_hi = 0x0000, - }; - -+static struct ssb_sprom bcm63xx_sprom; -+ - int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) - { - if (bus->bustype == SSB_BUSTYPE_PCI) { -@@ -60,6 +62,15 @@ int __init bcm63xx_register_fallback_spr - int ret = 0; - - #ifdef CONFIG_SSB_PCIHOST -+ switch (data->type) { -+ case SPROM_DEFAULT: -+ memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, -+ sizeof(bcm63xx_sprom)); -+ break; -+ default: -+ return -EINVAL; -+ } -+ - memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -3,8 +3,13 @@ - - #include - -+enum sprom_type { -+ SPROM_DEFAULT, /* default fallback sprom */ -+}; -+ - struct fallback_sprom_data { - u8 mac_addr[ETH_ALEN]; -+ enum sprom_type type; - }; - - int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data); diff --git a/target/linux/brcm63xx/patches-4.4/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch b/target/linux/brcm63xx/patches-4.4/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch deleted file mode 100644 index 42502eb06..000000000 --- a/target/linux/brcm63xx/patches-4.4/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch +++ /dev/null @@ -1,517 +0,0 @@ -From cedee63bc73f8b7d45b8c0cba1236986812c1f83 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 22:16:36 +0200 -Subject: [PATCH 05/10] MIPS: BCM63XX: add support for "raw" sproms - -Allow using raw sprom content as templates. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 482 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 482 insertions(+) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -55,13 +55,492 @@ int bcm63xx_get_fallback_sprom(struct ss - return -EINVAL; - } - } -+ -+/* FIXME: use lib_sprom after submission upstream */ -+ -+/* Get the word-offset for a SSB_SPROM_XXX define. */ -+#define SPOFF(offset) ((offset) / sizeof(u16)) -+/* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */ -+#define SPEX16(_outvar, _offset, _mask, _shift) \ -+ out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift)) -+#define SPEX32(_outvar, _offset, _mask, _shift) \ -+ out->_outvar = ((((u32)in[SPOFF((_offset)+2)] << 16 | \ -+ in[SPOFF(_offset)]) & (_mask)) >> (_shift)) -+#define SPEX(_outvar, _offset, _mask, _shift) \ -+ SPEX16(_outvar, _offset, _mask, _shift) -+ -+#define SPEX_ARRAY8(_field, _offset, _mask, _shift) \ -+ do { \ -+ SPEX(_field[0], _offset + 0, _mask, _shift); \ -+ SPEX(_field[1], _offset + 2, _mask, _shift); \ -+ SPEX(_field[2], _offset + 4, _mask, _shift); \ -+ SPEX(_field[3], _offset + 6, _mask, _shift); \ -+ SPEX(_field[4], _offset + 8, _mask, _shift); \ -+ SPEX(_field[5], _offset + 10, _mask, _shift); \ -+ SPEX(_field[6], _offset + 12, _mask, _shift); \ -+ SPEX(_field[7], _offset + 14, _mask, _shift); \ -+ } while (0) -+ -+ -+static s8 r123_extract_antgain(u8 sprom_revision, const u16 *in, -+ u16 mask, u16 shift) -+{ -+ u16 v; -+ u8 gain; -+ -+ v = in[SPOFF(SSB_SPROM1_AGAIN)]; -+ gain = (v & mask) >> shift; -+ if (gain == 0xFF) -+ gain = 2; /* If unset use 2dBm */ -+ if (sprom_revision == 1) { -+ /* Convert to Q5.2 */ -+ gain <<= 2; -+ } else { -+ /* Q5.2 Fractional part is stored in 0xC0 */ -+ gain = ((gain & 0xC0) >> 6) | ((gain & 0x3F) << 2); -+ } -+ -+ return (s8)gain; -+} -+ -+static void sprom_extract_r23(struct ssb_sprom *out, const u16 *in) -+{ -+ SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0); -+ SPEX(opo, SSB_SPROM2_OPO, SSB_SPROM2_OPO_VALUE, 0); -+ SPEX(pa1lob0, SSB_SPROM2_PA1LOB0, 0xFFFF, 0); -+ SPEX(pa1lob1, SSB_SPROM2_PA1LOB1, 0xFFFF, 0); -+ SPEX(pa1lob2, SSB_SPROM2_PA1LOB2, 0xFFFF, 0); -+ SPEX(pa1hib0, SSB_SPROM2_PA1HIB0, 0xFFFF, 0); -+ SPEX(pa1hib1, SSB_SPROM2_PA1HIB1, 0xFFFF, 0); -+ SPEX(pa1hib2, SSB_SPROM2_PA1HIB2, 0xFFFF, 0); -+ SPEX(maxpwr_ah, SSB_SPROM2_MAXP_A, SSB_SPROM2_MAXP_A_HI, 0); -+ SPEX(maxpwr_al, SSB_SPROM2_MAXP_A, SSB_SPROM2_MAXP_A_LO, -+ SSB_SPROM2_MAXP_A_LO_SHIFT); -+} -+ -+static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) -+{ -+ u16 loc[3]; -+ -+ if (out->revision == 3) /* rev 3 moved MAC */ -+ loc[0] = SSB_SPROM3_IL0MAC; -+ else { -+ loc[0] = SSB_SPROM1_IL0MAC; -+ loc[1] = SSB_SPROM1_ET0MAC; -+ loc[2] = SSB_SPROM1_ET1MAC; -+ } -+ -+ SPEX(et0phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0A, 0); -+ SPEX(et1phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1A, -+ SSB_SPROM1_ETHPHY_ET1A_SHIFT); -+ SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14); -+ SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15); -+ SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0); -+ SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0); -+ if (out->revision == 1) -+ SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE, -+ SSB_SPROM1_BINF_CCODE_SHIFT); -+ SPEX(ant_available_a, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTA, -+ SSB_SPROM1_BINF_ANTA_SHIFT); -+ SPEX(ant_available_bg, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTBG, -+ SSB_SPROM1_BINF_ANTBG_SHIFT); -+ SPEX(pa0b0, SSB_SPROM1_PA0B0, 0xFFFF, 0); -+ SPEX(pa0b1, SSB_SPROM1_PA0B1, 0xFFFF, 0); -+ SPEX(pa0b2, SSB_SPROM1_PA0B2, 0xFFFF, 0); -+ SPEX(pa1b0, SSB_SPROM1_PA1B0, 0xFFFF, 0); -+ SPEX(pa1b1, SSB_SPROM1_PA1B1, 0xFFFF, 0); -+ SPEX(pa1b2, SSB_SPROM1_PA1B2, 0xFFFF, 0); -+ SPEX(gpio0, SSB_SPROM1_GPIOA, SSB_SPROM1_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM1_GPIOA, SSB_SPROM1_GPIOA_P1, -+ SSB_SPROM1_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM1_GPIOB, SSB_SPROM1_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM1_GPIOB, SSB_SPROM1_GPIOB_P3, -+ SSB_SPROM1_GPIOB_P3_SHIFT); -+ SPEX(maxpwr_a, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_A, -+ SSB_SPROM1_MAXPWR_A_SHIFT); -+ SPEX(maxpwr_bg, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_BG, 0); -+ SPEX(itssi_a, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_A, -+ SSB_SPROM1_ITSSI_A_SHIFT); -+ SPEX(itssi_bg, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_BG, 0); -+ SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0); -+ -+ SPEX(alpha2[0], SSB_SPROM1_CCODE, 0xff00, 8); -+ SPEX(alpha2[1], SSB_SPROM1_CCODE, 0x00ff, 0); -+ -+ /* Extract the antenna gain values. */ -+ out->antenna_gain.a0 = r123_extract_antgain(out->revision, in, -+ SSB_SPROM1_AGAIN_BG, -+ SSB_SPROM1_AGAIN_BG_SHIFT); -+ out->antenna_gain.a1 = r123_extract_antgain(out->revision, in, -+ SSB_SPROM1_AGAIN_A, -+ SSB_SPROM1_AGAIN_A_SHIFT); -+ if (out->revision >= 2) -+ sprom_extract_r23(out, in); -+} -+ -+/* Revs 4 5 and 8 have partially shared layout */ -+static void sprom_extract_r458(struct ssb_sprom *out, const u16 *in) -+{ -+ SPEX(txpid2g[0], SSB_SPROM4_TXPID2G01, -+ SSB_SPROM4_TXPID2G0, SSB_SPROM4_TXPID2G0_SHIFT); -+ SPEX(txpid2g[1], SSB_SPROM4_TXPID2G01, -+ SSB_SPROM4_TXPID2G1, SSB_SPROM4_TXPID2G1_SHIFT); -+ SPEX(txpid2g[2], SSB_SPROM4_TXPID2G23, -+ SSB_SPROM4_TXPID2G2, SSB_SPROM4_TXPID2G2_SHIFT); -+ SPEX(txpid2g[3], SSB_SPROM4_TXPID2G23, -+ SSB_SPROM4_TXPID2G3, SSB_SPROM4_TXPID2G3_SHIFT); -+ -+ SPEX(txpid5gl[0], SSB_SPROM4_TXPID5GL01, -+ SSB_SPROM4_TXPID5GL0, SSB_SPROM4_TXPID5GL0_SHIFT); -+ SPEX(txpid5gl[1], SSB_SPROM4_TXPID5GL01, -+ SSB_SPROM4_TXPID5GL1, SSB_SPROM4_TXPID5GL1_SHIFT); -+ SPEX(txpid5gl[2], SSB_SPROM4_TXPID5GL23, -+ SSB_SPROM4_TXPID5GL2, SSB_SPROM4_TXPID5GL2_SHIFT); -+ SPEX(txpid5gl[3], SSB_SPROM4_TXPID5GL23, -+ SSB_SPROM4_TXPID5GL3, SSB_SPROM4_TXPID5GL3_SHIFT); -+ -+ SPEX(txpid5g[0], SSB_SPROM4_TXPID5G01, -+ SSB_SPROM4_TXPID5G0, SSB_SPROM4_TXPID5G0_SHIFT); -+ SPEX(txpid5g[1], SSB_SPROM4_TXPID5G01, -+ SSB_SPROM4_TXPID5G1, SSB_SPROM4_TXPID5G1_SHIFT); -+ SPEX(txpid5g[2], SSB_SPROM4_TXPID5G23, -+ SSB_SPROM4_TXPID5G2, SSB_SPROM4_TXPID5G2_SHIFT); -+ SPEX(txpid5g[3], SSB_SPROM4_TXPID5G23, -+ SSB_SPROM4_TXPID5G3, SSB_SPROM4_TXPID5G3_SHIFT); -+ -+ SPEX(txpid5gh[0], SSB_SPROM4_TXPID5GH01, -+ SSB_SPROM4_TXPID5GH0, SSB_SPROM4_TXPID5GH0_SHIFT); -+ SPEX(txpid5gh[1], SSB_SPROM4_TXPID5GH01, -+ SSB_SPROM4_TXPID5GH1, SSB_SPROM4_TXPID5GH1_SHIFT); -+ SPEX(txpid5gh[2], SSB_SPROM4_TXPID5GH23, -+ SSB_SPROM4_TXPID5GH2, SSB_SPROM4_TXPID5GH2_SHIFT); -+ SPEX(txpid5gh[3], SSB_SPROM4_TXPID5GH23, -+ SSB_SPROM4_TXPID5GH3, SSB_SPROM4_TXPID5GH3_SHIFT); -+} -+ -+static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) -+{ -+ u16 il0mac_offset; -+ -+ if (out->revision == 4) -+ il0mac_offset = SSB_SPROM4_IL0MAC; -+ else -+ il0mac_offset = SSB_SPROM5_IL0MAC; -+ -+ SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0); -+ SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, -+ SSB_SPROM4_ETHPHY_ET1A_SHIFT); -+ SPEX(board_rev, SSB_SPROM4_BOARDREV, 0xFFFF, 0); -+ SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0); -+ if (out->revision == 4) { -+ SPEX(alpha2[0], SSB_SPROM4_CCODE, 0xff00, 8); -+ SPEX(alpha2[1], SSB_SPROM4_CCODE, 0x00ff, 0); -+ SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); -+ SPEX(boardflags2_lo, SSB_SPROM4_BFL2LO, 0xFFFF, 0); -+ SPEX(boardflags2_hi, SSB_SPROM4_BFL2HI, 0xFFFF, 0); -+ } else { -+ SPEX(alpha2[0], SSB_SPROM5_CCODE, 0xff00, 8); -+ SPEX(alpha2[1], SSB_SPROM5_CCODE, 0x00ff, 0); -+ SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0); -+ SPEX(boardflags2_lo, SSB_SPROM5_BFL2LO, 0xFFFF, 0); -+ SPEX(boardflags2_hi, SSB_SPROM5_BFL2HI, 0xFFFF, 0); -+ } -+ SPEX(ant_available_a, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_A, -+ SSB_SPROM4_ANTAVAIL_A_SHIFT); -+ SPEX(ant_available_bg, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_BG, -+ SSB_SPROM4_ANTAVAIL_BG_SHIFT); -+ SPEX(maxpwr_bg, SSB_SPROM4_MAXP_BG, SSB_SPROM4_MAXP_BG_MASK, 0); -+ SPEX(itssi_bg, SSB_SPROM4_MAXP_BG, SSB_SPROM4_ITSSI_BG, -+ SSB_SPROM4_ITSSI_BG_SHIFT); -+ SPEX(maxpwr_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_MAXP_A_MASK, 0); -+ SPEX(itssi_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_ITSSI_A, -+ SSB_SPROM4_ITSSI_A_SHIFT); -+ if (out->revision == 4) { -+ SPEX(gpio0, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P1, -+ SSB_SPROM4_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P3, -+ SSB_SPROM4_GPIOB_P3_SHIFT); -+ } else { -+ SPEX(gpio0, SSB_SPROM5_GPIOA, SSB_SPROM5_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM5_GPIOA, SSB_SPROM5_GPIOA_P1, -+ SSB_SPROM5_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM5_GPIOB, SSB_SPROM5_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM5_GPIOB, SSB_SPROM5_GPIOB_P3, -+ SSB_SPROM5_GPIOB_P3_SHIFT); -+ } -+ -+ /* Extract the antenna gain values. */ -+ SPEX(antenna_gain.a0, SSB_SPROM4_AGAIN01, -+ SSB_SPROM4_AGAIN0, SSB_SPROM4_AGAIN0_SHIFT); -+ SPEX(antenna_gain.a1, SSB_SPROM4_AGAIN01, -+ SSB_SPROM4_AGAIN1, SSB_SPROM4_AGAIN1_SHIFT); -+ SPEX(antenna_gain.a2, SSB_SPROM4_AGAIN23, -+ SSB_SPROM4_AGAIN2, SSB_SPROM4_AGAIN2_SHIFT); -+ SPEX(antenna_gain.a3, SSB_SPROM4_AGAIN23, -+ SSB_SPROM4_AGAIN3, SSB_SPROM4_AGAIN3_SHIFT); -+ -+ sprom_extract_r458(out, in); -+ -+ /* TODO - get remaining rev 4 stuff needed */ -+} -+ -+static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) -+{ -+ int i; -+ u16 o; -+ u16 pwr_info_offset[] = { -+ SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1, -+ SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3 -+ }; -+ BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) != -+ ARRAY_SIZE(out->core_pwr_info)); -+ -+ SPEX(board_rev, SSB_SPROM8_BOARDREV, 0xFFFF, 0); -+ SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0); -+ SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8); -+ SPEX(alpha2[1], SSB_SPROM8_CCODE, 0x00ff, 0); -+ SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0); -+ SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0xFFFF, 0); -+ SPEX(boardflags2_hi, SSB_SPROM8_BFL2HI, 0xFFFF, 0); -+ SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A, -+ SSB_SPROM8_ANTAVAIL_A_SHIFT); -+ SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG, -+ SSB_SPROM8_ANTAVAIL_BG_SHIFT); -+ SPEX(maxpwr_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_MAXP_BG_MASK, 0); -+ SPEX(itssi_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_ITSSI_BG, -+ SSB_SPROM8_ITSSI_BG_SHIFT); -+ SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0); -+ SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A, -+ SSB_SPROM8_ITSSI_A_SHIFT); -+ SPEX(maxpwr_ah, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AH_MASK, 0); -+ SPEX(maxpwr_al, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AL_MASK, -+ SSB_SPROM8_MAXP_AL_SHIFT); -+ SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1, -+ SSB_SPROM8_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3, -+ SSB_SPROM8_GPIOB_P3_SHIFT); -+ SPEX(tri2g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI2G, 0); -+ SPEX(tri5g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI5G, -+ SSB_SPROM8_TRI5G_SHIFT); -+ SPEX(tri5gl, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GL, 0); -+ SPEX(tri5gh, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GH, -+ SSB_SPROM8_TRI5GH_SHIFT); -+ SPEX(rxpo2g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO2G, 0); -+ SPEX(rxpo5g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO5G, -+ SSB_SPROM8_RXPO5G_SHIFT); -+ SPEX(rssismf2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMF2G, 0); -+ SPEX(rssismc2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMC2G, -+ SSB_SPROM8_RSSISMC2G_SHIFT); -+ SPEX(rssisav2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISAV2G, -+ SSB_SPROM8_RSSISAV2G_SHIFT); -+ SPEX(bxa2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_BXA2G, -+ SSB_SPROM8_BXA2G_SHIFT); -+ SPEX(rssismf5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMF5G, 0); -+ SPEX(rssismc5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMC5G, -+ SSB_SPROM8_RSSISMC5G_SHIFT); -+ SPEX(rssisav5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISAV5G, -+ SSB_SPROM8_RSSISAV5G_SHIFT); -+ SPEX(bxa5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_BXA5G, -+ SSB_SPROM8_BXA5G_SHIFT); -+ SPEX(pa0b0, SSB_SPROM8_PA0B0, 0xFFFF, 0); -+ SPEX(pa0b1, SSB_SPROM8_PA0B1, 0xFFFF, 0); -+ SPEX(pa0b2, SSB_SPROM8_PA0B2, 0xFFFF, 0); -+ SPEX(pa1b0, SSB_SPROM8_PA1B0, 0xFFFF, 0); -+ SPEX(pa1b1, SSB_SPROM8_PA1B1, 0xFFFF, 0); -+ SPEX(pa1b2, SSB_SPROM8_PA1B2, 0xFFFF, 0); -+ SPEX(pa1lob0, SSB_SPROM8_PA1LOB0, 0xFFFF, 0); -+ SPEX(pa1lob1, SSB_SPROM8_PA1LOB1, 0xFFFF, 0); -+ SPEX(pa1lob2, SSB_SPROM8_PA1LOB2, 0xFFFF, 0); -+ SPEX(pa1hib0, SSB_SPROM8_PA1HIB0, 0xFFFF, 0); -+ SPEX(pa1hib1, SSB_SPROM8_PA1HIB1, 0xFFFF, 0); -+ SPEX(pa1hib2, SSB_SPROM8_PA1HIB2, 0xFFFF, 0); -+ SPEX(cck2gpo, SSB_SPROM8_CCK2GPO, 0xFFFF, 0); -+ SPEX32(ofdm2gpo, SSB_SPROM8_OFDM2GPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5glpo, SSB_SPROM8_OFDM5GLPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5gpo, SSB_SPROM8_OFDM5GPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, 0xFFFFFFFF, 0); -+ -+ /* Extract the antenna gain values. */ -+ SPEX(antenna_gain.a0, SSB_SPROM8_AGAIN01, -+ SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT); -+ SPEX(antenna_gain.a1, SSB_SPROM8_AGAIN01, -+ SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT); -+ SPEX(antenna_gain.a2, SSB_SPROM8_AGAIN23, -+ SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT); -+ SPEX(antenna_gain.a3, SSB_SPROM8_AGAIN23, -+ SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT); -+ -+ /* Extract cores power info info */ -+ for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) { -+ o = pwr_info_offset[i]; -+ SPEX(core_pwr_info[i].itssi_2g, o + SSB_SROM8_2G_MAXP_ITSSI, -+ SSB_SPROM8_2G_ITSSI, SSB_SPROM8_2G_ITSSI_SHIFT); -+ SPEX(core_pwr_info[i].maxpwr_2g, o + SSB_SROM8_2G_MAXP_ITSSI, -+ SSB_SPROM8_2G_MAXP, 0); -+ -+ SPEX(core_pwr_info[i].pa_2g[0], o + SSB_SROM8_2G_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_2g[1], o + SSB_SROM8_2G_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_2g[2], o + SSB_SROM8_2G_PA_2, ~0, 0); -+ -+ SPEX(core_pwr_info[i].itssi_5g, o + SSB_SROM8_5G_MAXP_ITSSI, -+ SSB_SPROM8_5G_ITSSI, SSB_SPROM8_5G_ITSSI_SHIFT); -+ SPEX(core_pwr_info[i].maxpwr_5g, o + SSB_SROM8_5G_MAXP_ITSSI, -+ SSB_SPROM8_5G_MAXP, 0); -+ SPEX(core_pwr_info[i].maxpwr_5gh, o + SSB_SPROM8_5GHL_MAXP, -+ SSB_SPROM8_5GH_MAXP, 0); -+ SPEX(core_pwr_info[i].maxpwr_5gl, o + SSB_SPROM8_5GHL_MAXP, -+ SSB_SPROM8_5GL_MAXP, SSB_SPROM8_5GL_MAXP_SHIFT); -+ -+ SPEX(core_pwr_info[i].pa_5gl[0], o + SSB_SROM8_5GL_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gl[1], o + SSB_SROM8_5GL_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gl[2], o + SSB_SROM8_5GL_PA_2, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[0], o + SSB_SROM8_5G_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[1], o + SSB_SROM8_5G_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[2], o + SSB_SROM8_5G_PA_2, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[0], o + SSB_SROM8_5GH_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[1], o + SSB_SROM8_5GH_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[2], o + SSB_SROM8_5GH_PA_2, ~0, 0); -+ } -+ -+ /* Extract FEM info */ -+ SPEX(fem.ghz2.tssipos, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_TSSIPOS, SSB_SROM8_FEM_TSSIPOS_SHIFT); -+ SPEX(fem.ghz2.extpa_gain, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_EXTPA_GAIN, SSB_SROM8_FEM_EXTPA_GAIN_SHIFT); -+ SPEX(fem.ghz2.pdet_range, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_PDET_RANGE, SSB_SROM8_FEM_PDET_RANGE_SHIFT); -+ SPEX(fem.ghz2.tr_iso, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_TR_ISO, SSB_SROM8_FEM_TR_ISO_SHIFT); -+ SPEX(fem.ghz2.antswlut, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT); -+ -+ SPEX(fem.ghz5.tssipos, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_TSSIPOS, SSB_SROM8_FEM_TSSIPOS_SHIFT); -+ SPEX(fem.ghz5.extpa_gain, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_EXTPA_GAIN, SSB_SROM8_FEM_EXTPA_GAIN_SHIFT); -+ SPEX(fem.ghz5.pdet_range, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_PDET_RANGE, SSB_SROM8_FEM_PDET_RANGE_SHIFT); -+ SPEX(fem.ghz5.tr_iso, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_TR_ISO, SSB_SROM8_FEM_TR_ISO_SHIFT); -+ SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT); -+ -+ SPEX(leddc_on_time, SSB_SPROM8_LEDDC, SSB_SPROM8_LEDDC_ON, -+ SSB_SPROM8_LEDDC_ON_SHIFT); -+ SPEX(leddc_off_time, SSB_SPROM8_LEDDC, SSB_SPROM8_LEDDC_OFF, -+ SSB_SPROM8_LEDDC_OFF_SHIFT); -+ -+ SPEX(txchain, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_TXCHAIN, -+ SSB_SPROM8_TXRXC_TXCHAIN_SHIFT); -+ SPEX(rxchain, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_RXCHAIN, -+ SSB_SPROM8_TXRXC_RXCHAIN_SHIFT); -+ SPEX(antswitch, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_SWITCH, -+ SSB_SPROM8_TXRXC_SWITCH_SHIFT); -+ -+ SPEX(opo, SSB_SPROM8_OFDM2GPO, 0x00ff, 0); -+ -+ SPEX_ARRAY8(mcs2gpo, SSB_SPROM8_2G_MCSPO, ~0, 0); -+ SPEX_ARRAY8(mcs5gpo, SSB_SPROM8_5G_MCSPO, ~0, 0); -+ SPEX_ARRAY8(mcs5glpo, SSB_SPROM8_5GL_MCSPO, ~0, 0); -+ SPEX_ARRAY8(mcs5ghpo, SSB_SPROM8_5GH_MCSPO, ~0, 0); -+ -+ SPEX(rawtempsense, SSB_SPROM8_RAWTS, SSB_SPROM8_RAWTS_RAWTEMP, -+ SSB_SPROM8_RAWTS_RAWTEMP_SHIFT); -+ SPEX(measpower, SSB_SPROM8_RAWTS, SSB_SPROM8_RAWTS_MEASPOWER, -+ SSB_SPROM8_RAWTS_MEASPOWER_SHIFT); -+ SPEX(tempsense_slope, SSB_SPROM8_OPT_CORRX, -+ SSB_SPROM8_OPT_CORRX_TEMP_SLOPE, -+ SSB_SPROM8_OPT_CORRX_TEMP_SLOPE_SHIFT); -+ SPEX(tempcorrx, SSB_SPROM8_OPT_CORRX, SSB_SPROM8_OPT_CORRX_TEMPCORRX, -+ SSB_SPROM8_OPT_CORRX_TEMPCORRX_SHIFT); -+ SPEX(tempsense_option, SSB_SPROM8_OPT_CORRX, -+ SSB_SPROM8_OPT_CORRX_TEMP_OPTION, -+ SSB_SPROM8_OPT_CORRX_TEMP_OPTION_SHIFT); -+ SPEX(freqoffset_corr, SSB_SPROM8_HWIQ_IQSWP, -+ SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR, -+ SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR_SHIFT); -+ SPEX(iqcal_swp_dis, SSB_SPROM8_HWIQ_IQSWP, -+ SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP, -+ SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT); -+ SPEX(hw_iqcal_en, SSB_SPROM8_HWIQ_IQSWP, SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL, -+ SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT); -+ -+ SPEX(bw40po, SSB_SPROM8_BW40PO, ~0, 0); -+ SPEX(cddpo, SSB_SPROM8_CDDPO, ~0, 0); -+ SPEX(stbcpo, SSB_SPROM8_STBCPO, ~0, 0); -+ SPEX(bwduppo, SSB_SPROM8_BWDUPPO, ~0, 0); -+ -+ SPEX(tempthresh, SSB_SPROM8_THERMAL, SSB_SPROM8_THERMAL_TRESH, -+ SSB_SPROM8_THERMAL_TRESH_SHIFT); -+ SPEX(tempoffset, SSB_SPROM8_THERMAL, SSB_SPROM8_THERMAL_OFFSET, -+ SSB_SPROM8_THERMAL_OFFSET_SHIFT); -+ SPEX(phycal_tempdelta, SSB_SPROM8_TEMPDELTA, -+ SSB_SPROM8_TEMPDELTA_PHYCAL, -+ SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT); -+ SPEX(temps_period, SSB_SPROM8_TEMPDELTA, SSB_SPROM8_TEMPDELTA_PERIOD, -+ SSB_SPROM8_TEMPDELTA_PERIOD_SHIFT); -+ SPEX(temps_hysteresis, SSB_SPROM8_TEMPDELTA, -+ SSB_SPROM8_TEMPDELTA_HYSTERESIS, -+ SSB_SPROM8_TEMPDELTA_HYSTERESIS_SHIFT); -+ sprom_extract_r458(out, in); -+ -+ /* TODO - get remaining rev 8 stuff needed */ -+} -+ -+static int sprom_extract(struct ssb_sprom *out, const u16 *in, u16 size) -+{ -+ memset(out, 0, sizeof(*out)); -+ -+ out->revision = in[size - 1] & 0x00FF; -+ memset(out->et0mac, 0xFF, 6); /* preset et0 and et1 mac */ -+ memset(out->et1mac, 0xFF, 6); -+ -+ switch (out->revision) { -+ case 1: -+ case 2: -+ case 3: -+ sprom_extract_r123(out, in); -+ break; -+ case 4: -+ case 5: -+ sprom_extract_r45(out, in); -+ break; -+ case 8: -+ sprom_extract_r8(out, in); -+ break; -+ default: -+ pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n", -+ out->revision); -+ out->revision = 1; -+ sprom_extract_r123(out, in); -+ } -+ -+ if (out->boardflags_lo == 0xFFFF) -+ out->boardflags_lo = 0; /* per specs */ -+ if (out->boardflags_hi == 0xFFFF) -+ out->boardflags_hi = 0; /* per specs */ -+ -+ return 0; -+} -+ -+static __initdata u16 template_sprom[220]; - #endif - -+ - int __init bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data) - { - int ret = 0; - - #ifdef CONFIG_SSB_PCIHOST -+ u16 size = 0; -+ - switch (data->type) { - case SPROM_DEFAULT: - memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, -@@ -71,6 +550,9 @@ int __init bcm63xx_register_fallback_spr - return -EINVAL; - } - -+ if (size > 0) -+ sprom_extract(&bcm63xx_sprom, template_sprom, size); -+ - memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); diff --git a/target/linux/brcm63xx/patches-4.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch b/target/linux/brcm63xx/patches-4.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch deleted file mode 100644 index 65c00b519..000000000 --- a/target/linux/brcm63xx/patches-4.4/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 7be5bb46003295c9e04fd4e795593b2deaacd783 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 22:33:38 +0200 -Subject: [PATCH 06/10] MIPS: BCM63XX: add raw fallback sproms for most common - ssb cards - -Add template sproms for BCM4306, BCM4318, BCM4321, BCM4322, and BCM43222. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 136 +++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 6 + - 2 files changed, 142 insertions(+) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -43,6 +43,122 @@ static __initconst struct ssb_sprom bcm6 - .boardflags_hi = 0x0000, - }; - -+ -+static __initconst u16 bcm4306_sprom[] = { -+ 0x4001, 0x0000, 0x0453, 0x14e4, 0x4320, 0x8000, 0x0002, 0x0002, -+ 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x3034, 0x14d4, -+ 0xfa91, 0xfe60, 0xffff, 0xffff, 0x004c, 0xffff, 0xffff, 0xffff, -+ 0x003e, 0x0a49, 0xff02, 0x0000, 0xff10, 0xffff, 0xffff, 0x0002, -+}; -+ -+static __initconst u16 bcm4318_sprom[] = { -+ 0x2001, 0x0000, 0x0449, 0x14e4, 0x4318, 0x8000, 0x0002, 0x0000, -+ 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x3046, 0x15a7, -+ 0xfab0, 0xfe97, 0xffff, 0xffff, 0x0048, 0xffff, 0xffff, 0xffff, -+ 0x003e, 0xea49, 0xff02, 0x0000, 0xff08, 0xffff, 0xffff, 0x0002, -+}; -+ -+static __initconst u16 bcm4321_sprom[] = { -+ 0x3001, 0x0000, 0x046c, 0x14e4, 0x4328, 0x8000, 0x0002, 0x0000, -+ 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x0032, 0x4a01, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x2728, 0x5b5b, 0x222b, 0x5b5b, 0x1927, 0x5b5b, 0x1e36, -+ 0x5b5b, 0x303c, 0x3030, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x3e4c, 0x0000, 0x0000, 0x0000, 0x0000, 0x7838, 0x3a34, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x3e4c, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x7838, 0x3a34, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0008, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0004, -+}; -+ -+static __initconst u16 bcm4322_sprom[] = { -+ 0x3001, 0x0000, 0x04bc, 0x14e4, 0x432c, 0x8000, 0x0002, 0x0000, -+ 0x1730, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x1209, 0x0200, 0x0000, 0x0400, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x0033, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0301, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x2048, 0xfe9a, 0x1571, 0xfabd, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x2048, 0xfeb9, 0x159f, 0xfadd, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x3333, 0x5555, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ -+static __initconst u16 bcm43222_sprom[] = { -+ 0x2001, 0x0000, 0x04d4, 0x14e4, 0x4351, 0x8000, 0x0002, 0x0000, -+ 0x1730, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x2305, 0x0200, 0x0000, 0x2400, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x0033, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0325, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x204c, 0xfea6, 0x1717, 0xfa6d, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x204c, 0xfeb8, 0x167c, 0xfa9e, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x3333, 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, -+ 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ - static struct ssb_sprom bcm63xx_sprom; - - int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -@@ -542,6 +658,26 @@ int __init bcm63xx_register_fallback_spr - u16 size = 0; - - switch (data->type) { -+ case SPROM_BCM4306: -+ memcpy(&template_sprom, &bcm4306_sprom, sizeof(bcm4306_sprom)); -+ size = ARRAY_SIZE(bcm4306_sprom); -+ break; -+ case SPROM_BCM4318: -+ memcpy(&template_sprom, &bcm4318_sprom, sizeof(bcm4318_sprom)); -+ size = ARRAY_SIZE(bcm4318_sprom); -+ break; -+ case SPROM_BCM4321: -+ memcpy(&template_sprom, &bcm4321_sprom, sizeof(bcm4321_sprom)); -+ size = ARRAY_SIZE(bcm4321_sprom); -+ break; -+ case SPROM_BCM4322: -+ memcpy(&template_sprom, &bcm4322_sprom, sizeof(bcm4322_sprom)); -+ size = ARRAY_SIZE(bcm4322_sprom); -+ break; -+ case SPROM_BCM43222: -+ memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom)); -+ size = ARRAY_SIZE(bcm43222_sprom); -+ break; - case SPROM_DEFAULT: - memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, - sizeof(bcm63xx_sprom)); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -5,6 +5,12 @@ - - enum sprom_type { - SPROM_DEFAULT, /* default fallback sprom */ -+ /* SSB based */ -+ SPROM_BCM4306, -+ SPROM_BCM4318, -+ SPROM_BCM4321, -+ SPROM_BCM4322, -+ SPROM_BCM43222, - }; - - struct fallback_sprom_data { diff --git a/target/linux/brcm63xx/patches-4.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch b/target/linux/brcm63xx/patches-4.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch deleted file mode 100644 index 6475f9fa2..000000000 --- a/target/linux/brcm63xx/patches-4.4/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 03feb9db77fba3eef3d83e17a87a56979659b248 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 22:48:26 +0200 -Subject: [PATCH 07/10] MIPS: BCM63XX: also register a fallback sprom for bcma - -Similar to SSB, register a fallback sprom handler for BCMA. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/Kconfig | 1 + - arch/mips/bcm63xx/sprom.c | 40 +++++++++++++++++++++++++++++++++++----- - 2 files changed, 36 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/boards/Kconfig -+++ b/arch/mips/bcm63xx/boards/Kconfig -@@ -4,6 +4,7 @@ menu "Board support" - config BOARD_BCM963XX - bool "Generic Broadcom 963xx boards" - select SSB -+ select BCMA - default y - help - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -21,7 +22,7 @@ - * Register a sane SPROMv2 to make the on-board - * bcm4318 WLAN work - */ --#ifdef CONFIG_SSB_PCIHOST -+#if defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) - static __initconst struct ssb_sprom bcm63xx_default_sprom = { - .revision = 0x02, - .board_rev = 0x17, -@@ -43,7 +44,7 @@ static __initconst struct ssb_sprom bcm6 - .boardflags_hi = 0x0000, - }; - -- -+#if defined (CONFIG_SSB_PCIHOST) - static __initconst u16 bcm4306_sprom[] = { - 0x4001, 0x0000, 0x0453, 0x14e4, 0x4320, 0x8000, 0x0002, 0x0002, - 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -@@ -158,10 +159,12 @@ static __initconst u16 bcm43222_sprom[] - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x0008, - }; -+#endif /* CONFIG_SSB_PCIHOST */ - - static struct ssb_sprom bcm63xx_sprom; - --int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -+#if defined(CONFIG_SSB_PCIHOST) -+int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out) - { - if (bus->bustype == SSB_BUSTYPE_PCI) { - memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -@@ -171,6 +174,20 @@ int bcm63xx_get_fallback_sprom(struct ss - return -EINVAL; - } - } -+#endif -+ -+#if defined(CONFIG_BCMA_HOST_PCI) -+int bcm63xx_get_fallback_bcma_sprom(struct bcma_bus *bus, struct ssb_sprom *out) -+{ -+ if (bus->hosttype == BCMA_HOSTTYPE_PCI) { -+ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ return 0; -+ } else { -+ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -+ return -EINVAL; -+ } -+} -+#endif - - /* FIXME: use lib_sprom after submission upstream */ - -@@ -654,10 +671,11 @@ int __init bcm63xx_register_fallback_spr - { - int ret = 0; - --#ifdef CONFIG_SSB_PCIHOST -+#if defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) - u16 size = 0; - - switch (data->type) { -+#if defined(CONFIG_SSB_PCIHOST) - case SPROM_BCM4306: - memcpy(&template_sprom, &bcm4306_sprom, sizeof(bcm4306_sprom)); - size = ARRAY_SIZE(bcm4306_sprom); -@@ -678,6 +696,7 @@ int __init bcm63xx_register_fallback_spr - memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom)); - size = ARRAY_SIZE(bcm43222_sprom); - break; -+#endif - case SPROM_DEFAULT: - memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, - sizeof(bcm63xx_sprom)); -@@ -692,8 +711,19 @@ int __init bcm63xx_register_fallback_spr - memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); -+#endif /* defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) */ -+ -+#if defined(CONFIG_SSB_PCIHOST) -+ ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_ssb_sprom); -+ if (ret) -+ return ret; -+ -+#endif - -- ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom); -+#if defined(CONFIG_BCMA_HOST_PCI) -+ ret = bcma_arch_register_fallback_sprom(bcm63xx_get_fallback_bcma_sprom); -+ if (ret) -+ return ret; - #endif - return ret; - } diff --git a/target/linux/brcm63xx/patches-4.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch b/target/linux/brcm63xx/patches-4.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch deleted file mode 100644 index 5c0abb90e..000000000 --- a/target/linux/brcm63xx/patches-4.4/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch +++ /dev/null @@ -1,303 +0,0 @@ -From 27bf70e3fe797691b17df07ecbfaf9f5a4419f49 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 30 Jul 2014 23:14:27 +0200 -Subject: [PATCH 08/10] MIPS: BCM63XX: add BCMA based sprom templates - -Add fallback sproms for BCM4313, BCM43131, BCM43217, BCM43225, BCM43227, -BCM43228, and BCM4331. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 256 +++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 + - 2 files changed, 264 insertions(+) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -161,6 +161,226 @@ static __initconst u16 bcm43222_sprom[] - }; - #endif /* CONFIG_SSB_PCIHOST */ - -+#if defined(CONFIG_BCMA_HOST_PCI) -+static __initconst u16 bcm4313_sprom[] = { -+ 0x2801, 0x0000, 0x0510, 0x14e4, 0x0078, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x4727, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1215, 0x2a00, 0x0800, 0x0800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0003, 0x0202, -+ 0xffff, 0x0011, 0x007a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0201, -+ 0x0000, 0x7800, 0x7c0a, 0x0398, 0x0008, 0x0000, 0x0000, 0x0000, -+ 0x0044, 0x1684, 0xfd0d, 0xff35, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0048, 0xfed2, 0x15d9, 0xfac6, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0008, -+}; -+ -+static __initconst u16 bcm43131_sprom[] = { -+ 0x2801, 0x0000, 0x05f7, 0x14e4, 0x0070, 0xedbe, 0x1c00, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x43aa, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1280, 0x0200, 0x0000, 0x8800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0002, 0x0202, -+ 0xffff, 0x0022, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0415, -+ 0x0000, 0x7800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfe96, 0x192c, 0xfa15, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfe91, 0x1950, 0xfa0a, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x4444, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x4444, 0x4444, 0x4444, 0x4444, 0x6666, 0x6666, 0x6666, -+ 0x6666, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ -+static __initconst u16 bcm43217_sprom[] = { -+ 0x2801, 0x0000, 0x05e9, 0x14e4, 0x0070, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x43a9, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1252, 0x0200, 0x0000, 0x9800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0003, 0x0202, -+ 0xffff, 0x0033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0415, -+ 0x0000, 0x7800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfe96, 0x192c, 0xfa15, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfe91, 0x1950, 0xfa0a, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x4444, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x4444, 0x4444, 0x4444, 0x4444, 0x6666, 0x6666, 0x6666, -+ 0x6666, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x7a08, -+}; -+ -+static __initconst u16 bcm43225_sprom[] = { -+ 0x2801, 0x0000, 0x04da, 0x14e4, 0x0078, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0x1008, 0x0005, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x4357, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x1200, 0x0200, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x88ff, 0xffff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x0033, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0325, -+ 0xffff, 0x7800, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x204e, 0xfead, 0x1611, 0xfa9a, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x204e, 0xfec1, 0x1674, 0xfab2, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x5555, 0x5555, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x5555, 0x7555, 0x5555, 0x7555, 0x5555, 0x7555, 0x5555, -+ 0x7555, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0002, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ -+static __initconst u16 bcm43227_sprom[] = { -+ 0x2801, 0x0000, 0x0543, 0x14e4, 0x0070, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x4358, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1402, 0x0200, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0003, 0x0202, -+ 0xffff, 0x0033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0415, -+ 0x0000, 0x7800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xff36, 0x16d2, 0xfaae, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfeca, 0x159b, 0xfa80, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x4444, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x4444, 0x4444, 0x4444, 0x4444, 0x6666, 0x6666, 0x6666, -+ 0x6666, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ -+static __initconst u16 bcm43228_sprom[] = { -+ 0x2801, 0x0000, 0x0011, 0x1028, 0x0070, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x4359, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1203, 0x0200, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x0033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0215, -+ 0x0215, 0x7800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xff73, 0x1762, 0xfaa4, 0x3e34, 0x3434, 0xfea1, 0x154c, -+ 0xfad0, 0xfea1, 0x144c, 0xfafb, 0xfe7b, 0x13fe, 0xfafc, 0x0000, -+ 0x204c, 0xff41, 0x16a3, 0xfa8f, 0x3e34, 0x3434, 0xfe97, 0x1446, -+ 0xfb05, 0xfe97, 0x1346, 0xfb32, 0xfeb9, 0x1516, 0xfaee, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x4444, 0x4444, 0x4444, 0x4444, 0x8888, 0x8888, 0x8888, -+ 0x8888, 0x0000, 0x0000, 0x0000, 0x0000, 0x3333, 0x3333, 0x3333, -+ 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0x3333, 0x3333, 0x3333, -+ 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0x3333, 0x3333, 0x3333, -+ 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xf008, -+}; -+ -+static __initconst u16 bcm4331_sprom[] = { -+ 0x2801, 0x0000, 0x0525, 0x14e4, 0x0078, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0x1010, 0x0005, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x4331, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x1104, 0x0200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0x88ff, 0xffff, 0x0707, 0x0202, -+ 0xff02, 0x0077, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0325, -+ 0x0325, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x2048, 0xfe56, 0x16f2, 0xfa44, 0x3e3c, 0x3c3c, 0xfe77, 0x1657, -+ 0xfa75, 0xffff, 0xffff, 0xffff, 0xfe76, 0x15da, 0xfa85, 0x0000, -+ 0x2048, 0xfe5c, 0x16b5, 0xfa56, 0x3e3c, 0x3c3c, 0xfe7c, 0x169d, -+ 0xfa6b, 0xffff, 0xffff, 0xffff, 0xfe7a, 0x1597, 0xfa97, 0x0000, -+ 0x2048, 0xfe68, 0x1734, 0xfa46, 0x3e3c, 0x3c3c, 0xfe7f, 0x15e4, -+ 0xfa94, 0xffff, 0xffff, 0xffff, 0xfe7d, 0x1582, 0xfa9f, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0009, -+}; -+ -+#endif /* CONFIG_BCMA_HOST_PCI */ -+ - static struct ssb_sprom bcm63xx_sprom; - - #if defined(CONFIG_SSB_PCIHOST) -@@ -697,6 +917,42 @@ int __init bcm63xx_register_fallback_spr - size = ARRAY_SIZE(bcm43222_sprom); - break; - #endif -+#if defined(CONFIG_BCMA_HOST_PCI) -+ case SPROM_BCM4313: -+ memcpy(&template_sprom, &bcm4313_sprom, -+ sizeof(bcm4313_sprom)); -+ size = ARRAY_SIZE(bcm4313_sprom); -+ break; -+ case SPROM_BCM43131: -+ memcpy(&template_sprom, &bcm43131_sprom, -+ sizeof(bcm43131_sprom)); -+ size = ARRAY_SIZE(bcm43131_sprom); -+ break; -+ case SPROM_BCM43217: -+ memcpy(&template_sprom, &bcm43217_sprom, -+ sizeof(bcm43217_sprom)); -+ size = ARRAY_SIZE(bcm43217_sprom); -+ break; -+ case SPROM_BCM43225: -+ memcpy(&template_sprom, &bcm43225_sprom, -+ sizeof(bcm43225_sprom)); -+ size = ARRAY_SIZE(bcm43225_sprom); -+ break; -+ case SPROM_BCM43227: -+ memcpy(&template_sprom, &bcm43227_sprom, -+ sizeof(bcm43227_sprom)); -+ size = ARRAY_SIZE(bcm43227_sprom); -+ break; -+ case SPROM_BCM43228: -+ memcpy(&template_sprom, &bcm43228_sprom, -+ sizeof(bcm43228_sprom)); -+ size = ARRAY_SIZE(bcm43228_sprom); -+ break; -+ case SPROM_BCM4331: -+ memcpy(&template_sprom, &bcm4331_sprom, sizeof(&bcm4331_sprom)); -+ size = ARRAY_SIZE(bcm4331_sprom); -+ break; -+#endif - case SPROM_DEFAULT: - memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, - sizeof(bcm63xx_sprom)); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -11,6 +11,14 @@ enum sprom_type { - SPROM_BCM4321, - SPROM_BCM4322, - SPROM_BCM43222, -+ /* BCMA based */ -+ SPROM_BCM4313, -+ SPROM_BCM43131, -+ SPROM_BCM43217, -+ SPROM_BCM43225, -+ SPROM_BCM43227, -+ SPROM_BCM43228, -+ SPROM_BCM4331, - }; - - struct fallback_sprom_data { diff --git a/target/linux/brcm63xx/patches-4.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch b/target/linux/brcm63xx/patches-4.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch deleted file mode 100644 index 74c2846d5..000000000 --- a/target/linux/brcm63xx/patches-4.4/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 8575548b08e33c9ff4fd540abec09dd177e33682 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 31 Jul 2014 19:12:33 +0200 -Subject: [PATCH 09/10] MIPS: BCM63XX: allow board files to provide sprom - fixups - -Allow board_info files to supply fixups for the base sproms to adapt -them to the actual used sprom contents in case they do not use the -default ones. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 14 +++++++++++++- - .../mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 ++++++++ - 2 files changed, 21 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -883,6 +883,14 @@ static int sprom_extract(struct ssb_spro - return 0; - } - -+void sprom_apply_fixups(u16 *sprom, struct sprom_fixup *fixups, int n) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < n; i++) -+ sprom[fixups[i].offset] = fixups[i].value; -+} -+ - static __initdata u16 template_sprom[220]; - #endif - -@@ -961,8 +969,12 @@ int __init bcm63xx_register_fallback_spr - return -EINVAL; - } - -- if (size > 0) -+ if (size > 0) { -+ sprom_apply_fixups(template_sprom, data->board_fixups, -+ data->num_board_fixups); -+ - sprom_extract(&bcm63xx_sprom, template_sprom, size); -+ } - - memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -21,9 +21,17 @@ enum sprom_type { - SPROM_BCM4331, - }; - -+struct sprom_fixup { -+ u16 offset; -+ u16 value; -+}; -+ - struct fallback_sprom_data { - u8 mac_addr[ETH_ALEN]; - enum sprom_type type; -+ -+ struct sprom_fixup *board_fixups; -+ unsigned int num_board_fixups; - }; - - int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data); diff --git a/target/linux/brcm63xx/patches-4.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch b/target/linux/brcm63xx/patches-4.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch deleted file mode 100644 index 40591e5f2..000000000 --- a/target/linux/brcm63xx/patches-4.4/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch +++ /dev/null @@ -1,102 +0,0 @@ -From f393eaacf178e7e8a61eb11a96edd7dfb35cb49d Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 31 Jul 2014 20:39:44 +0200 -Subject: [PATCH 10/10] MIPS: BCM63XX: allow setting a pci bus/device for - fallback sprom - -Warn if the set pci bus/slot does not match the actual request. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 31 ++++++++++++++++++---- - .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 3 +++ - 2 files changed, 29 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -381,13 +381,25 @@ static __initconst u16 bcm4331_sprom[] = - - #endif /* CONFIG_BCMA_HOST_PCI */ - --static struct ssb_sprom bcm63xx_sprom; -+struct fallback_sprom_match { -+ u8 pci_bus; -+ u8 pci_dev; -+ struct ssb_sprom sprom; -+}; -+ -+static struct fallback_sprom_match fallback_sprom; - - #if defined(CONFIG_SSB_PCIHOST) - int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out) - { - if (bus->bustype == SSB_BUSTYPE_PCI) { -- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ if (bus->host_pci->bus->number != fallback_sprom.pci_bus || -+ PCI_SLOT(bus->host_pci->devfn) != fallback_sprom.pci_dev) -+ pr_warn("ssb_fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n", -+ fallback_sprom.pci_bus, fallback_sprom.pci_dev, -+ bus->host_pci->bus->number, -+ PCI_SLOT(bus->host_pci->devfn)); -+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); - return 0; - } else { - printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -@@ -400,7 +412,13 @@ int bcm63xx_get_fallback_ssb_sprom(struc - int bcm63xx_get_fallback_bcma_sprom(struct bcma_bus *bus, struct ssb_sprom *out) - { - if (bus->hosttype == BCMA_HOSTTYPE_PCI) { -- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ if (bus->host_pci->bus->number != fallback_sprom.pci_bus || -+ PCI_SLOT(bus->host_pci->devfn) != fallback_sprom.pci_dev) -+ pr_warn("bcma_fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n", -+ fallback_sprom.pci_bus, fallback_sprom.pci_dev, -+ bus->host_pci->bus->number, -+ PCI_SLOT(bus->host_pci->devfn)); -+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); - return 0; - } else { - printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -@@ -962,8 +980,8 @@ int __init bcm63xx_register_fallback_spr - break; - #endif - case SPROM_DEFAULT: -- memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, -- sizeof(bcm63xx_sprom)); -+ memcpy(&fallback_sprom.sprom, &bcm63xx_default_sprom, -+ sizeof(bcm63xx_default_sprom)); - break; - default: - return -EINVAL; -@@ -973,12 +991,15 @@ int __init bcm63xx_register_fallback_spr - sprom_apply_fixups(template_sprom, data->board_fixups, - data->num_board_fixups); - -- sprom_extract(&bcm63xx_sprom, template_sprom, size); -+ sprom_extract(&fallback_sprom.sprom, template_sprom, size); - } - -- memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); -- memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); -- memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); -+ memcpy(fallback_sprom.sprom.il0mac, data->mac_addr, ETH_ALEN); -+ memcpy(fallback_sprom.sprom.et0mac, data->mac_addr, ETH_ALEN); -+ memcpy(fallback_sprom.sprom.et1mac, data->mac_addr, ETH_ALEN); -+ -+ fallback_sprom.pci_bus = data->pci_bus; -+ fallback_sprom.pci_dev = data->pci_dev; - #endif /* defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) */ - - #if defined(CONFIG_SSB_PCIHOST) ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -30,6 +30,9 @@ struct fallback_sprom_data { - u8 mac_addr[ETH_ALEN]; - enum sprom_type type; - -+ u8 pci_bus; -+ u8 pci_dev; -+ - struct sprom_fixup *board_fixups; - unsigned int num_board_fixups; - }; diff --git a/target/linux/brcm63xx/patches-4.4/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch b/target/linux/brcm63xx/patches-4.4/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch deleted file mode 100644 index c90ba84b8..000000000 --- a/target/linux/brcm63xx/patches-4.4/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 26546e5499d98616322fb3472b977e2e86603f3a Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 24 Jun 2014 10:57:51 +0200 -Subject: [PATCH 45/48] MIPS: BCM63XX: add support for loading DTB - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/Kconfig | 4 ++++ - arch/mips/bcm63xx/boards/board_common.c | 34 +++++++++++++++++++++++++++++++ - arch/mips/bcm63xx/prom.c | 6 ++++++ - 3 files changed, 44 insertions(+) - ---- a/arch/mips/bcm63xx/boards/Kconfig -+++ b/arch/mips/bcm63xx/boards/Kconfig -@@ -1,6 +1,10 @@ - menu "Board support" - depends on BCM63XX - -+config BOARD_BCM63XX_DT -+ bool "Device Tree boards (experimential)" -+ select USE_OF -+ - config BOARD_BCM963XX - bool "Generic Broadcom 963xx boards" - select SSB ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -10,11 +10,14 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include - #include - #include -+#include - #include - #include - #include -@@ -126,8 +129,23 @@ void __init board_setup(void) - /* make sure we're running on expected cpu */ - if (bcm63xx_get_cpu_id() != board.expected_cpu_id) - panic("unexpected CPU for bcm963xx board"); -+ -+#if CONFIG_OF -+ if (initial_boot_params) -+ __dt_setup_arch(initial_boot_params); -+#endif - } - -+#if CONFIG_OF -+void __init device_tree_init(void) -+{ -+ if (!initial_boot_params) -+ return; -+ -+ unflatten_and_copy_device_tree(); -+} -+#endif -+ - static struct gpio_led_platform_data bcm63xx_led_data; - - static struct platform_device bcm63xx_gpio_leds = { -@@ -136,6 +154,13 @@ static struct platform_device bcm63xx_gp - .dev.platform_data = &bcm63xx_led_data, - }; - -+#if CONFIG_OF -+static struct of_device_id of_ids[] = { -+ { /* filled at runtime */ }, -+ { .compatible = "simple-bus" }, -+ { }, -+}; -+#endif - /* - * third stage init callback, register all board devices. - */ -@@ -143,6 +168,15 @@ int __init board_register_devices(void) - { - int usbh_ports = 0; - -+#if CONFIG_OF -+ if (of_have_populated_dt()) { -+ snprintf(of_ids[0].compatible, sizeof(of_ids[0].compatible), -+ "brcm,bcm%x", bcm63xx_get_cpu_id()); -+ -+ of_platform_populate(NULL, of_ids, NULL, NULL); -+ } -+#endif -+ - if (board.has_uart0) - bcm63xx_uart_register(0); - ---- a/arch/mips/bcm63xx/prom.c -+++ b/arch/mips/bcm63xx/prom.c -@@ -8,6 +8,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -23,6 +24,11 @@ void __init prom_init(void) - { - u32 reg, mask; - -+#if CONFIG_OF -+ if (fw_passed_dtb) -+ early_init_dt_verify((void *)fw_passed_dtb); -+#endif -+ - bcm63xx_cpu_init(); - - /* stop any running watchdog */ diff --git a/target/linux/brcm63xx/patches-4.4/368-MIPS-BCM63XX-add-support-for-matching-the-board_info.patch b/target/linux/brcm63xx/patches-4.4/368-MIPS-BCM63XX-add-support-for-matching-the-board_info.patch deleted file mode 100644 index 1c3e5d12e..000000000 --- a/target/linux/brcm63xx/patches-4.4/368-MIPS-BCM63XX-add-support-for-matching-the-board_info.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 25bf2b5836c892f091651d8a3384c9c57ce1b400 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 26 Jun 2014 12:51:00 +0200 -Subject: [PATCH 46/48] MIPS: BCM63XX: add support for matching the board_info - by dtb - -Allow using the passed dtb's compatible property to match board_info -structs instead of nvram's boardname field, which is not unique anyway. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 15 +++++++++++++++ - arch/mips/bcm63xx/boards/board_common.c | 18 ++++++++++++++++++ - arch/mips/bcm63xx/boards/board_common.h | 3 +++ - 3 files changed, 36 insertions(+) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -711,6 +711,10 @@ static const struct board_info __initcon - #endif - }; - -+static struct of_device_id const bcm963xx_boards_dt[] = { -+ { }, -+}; -+ - /* - * early init callback, read nvram data from flash and checksum it - */ -@@ -722,6 +726,7 @@ void __init board_bcm963xx_init(void) - char *board_name = NULL; - u32 val; - struct bcm_hcs *hcs; -+ const struct of_device_id *board_match; - - /* read base address of boot chip select (0) - * 6328/6362 do not have MPI but boot from a fixed address -@@ -761,6 +766,16 @@ void __init board_bcm963xx_init(void) - } else { - board_name = bcm63xx_nvram_get_name(); - } -+ -+ /* find board by compat */ -+ board_match = bcm63xx_match_board(bcm963xx_boards_dt); -+ if (board_match) { -+ board_early_setup(board_match->data, -+ bcm63xx_nvram_get_mac_address); -+ -+ return; -+ } -+ - /* find board by name */ - for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) { - if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -243,3 +243,21 @@ int __init board_register_devices(void) - - return 0; - } -+ -+const struct of_device_id * __init bcm63xx_match_board(const struct of_device_id *m) -+{ -+ const struct of_device_id *match; -+ unsigned long dt_root; -+ -+ if (!IS_ENABLED(CONFIG_OF) || !initial_boot_params) -+ return NULL; -+ -+ dt_root = of_get_flat_dt_root(); -+ -+ for (match = m; match->compatible[0]; match++) { -+ if (of_flat_dt_is_compatible(dt_root, match->compatible)) -+ return match; -+ } -+ -+ return NULL; -+} ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -1,11 +1,14 @@ - #ifndef __BOARD_COMMON_H - #define __BOARD_COMMON_H - -+#include - #include - - void board_early_setup(const struct board_info *board, - int (*get_mac_address)(u8 mac[ETH_ALEN])); - -+const struct of_device_id *bcm63xx_match_board(const struct of_device_id *); -+ - #if defined(CONFIG_BOARD_BCM963XX) - void board_bcm963xx_init(void); - #else diff --git a/target/linux/brcm63xx/patches-4.4/369-MIPS-BCM63XX-populate-the-compatible-to-board_info-l.patch b/target/linux/brcm63xx/patches-4.4/369-MIPS-BCM63XX-populate-the-compatible-to-board_info-l.patch deleted file mode 100644 index 81c4e2364..000000000 --- a/target/linux/brcm63xx/patches-4.4/369-MIPS-BCM63XX-populate-the-compatible-to-board_info-l.patch +++ /dev/null @@ -1,65 +0,0 @@ -From e71eea9953c774dfadb754258824fb1888c279f4 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 21 Nov 2014 16:54:06 +0100 -Subject: [PATCH 47/48] MIPS: BCM63XX: populate the compatible to board_info - list - -Populate the compatible to board_info list to allow dtbs to be used -for known boards. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 34 +++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -712,6 +712,48 @@ static const struct board_info __initcon - }; - - static struct of_device_id const bcm963xx_boards_dt[] = { -+#ifdef CONFIG_OF -+#ifdef CONFIG_BCM63XX_CPU_3368 -+ { .compatible = "netgear,cvg834g", .data = &board_cvg834g, }, -+#endif -+#ifdef CONFIG_BCM63XX_CPU_6328 -+ { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, -+#endif -+#ifdef CONFIG_BCM63XX_CPU_6338 -+ { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, -+ { .compatible = "brcm,bcm96338w", .data = &board_96338w, }, -+#endif -+#ifdef CONFIG_BCM63XX_CPU_6345 -+ { .compatible = "brcm,bcm96345gw2", .data = &board_96345gw2, }, -+#endif -+#ifdef CONFIG_BCM63XX_CPU_6348 -+ { .compatible = "belkin,f5d7633", .data = &board_96348gw_10, }, -+ { .compatible = "brcm,bcm96348r", .data = &board_96348r, }, -+ { .compatible = "brcm,bcm96348gw-10", .data = &board_96348gw_10, }, -+ { .compatible = "brcm,bcm96348gw-11", .data = &board_96348gw_11, }, -+ { .compatible = "brcm,bcm96348gw-a", .data = &board_96348gw_a, }, -+ { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, -+ { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, }, -+ { .compatible = "netgear,dg834gtpn", .data = &board_96348gw_10, }, -+ { .compatible = "sagem,f@st2404", .data = &board_FAST2404, }, -+ { .compatible = "tp-link,td-w8900gb", .data = &board_96348gw_11, }, -+ { .compatible = "usr,9108", .data = &board_96348gw_a, }, -+#endif -+#ifdef CONFIG_BCM63XX_CPU_6358 -+ { .compatible = "alcatel,rg100a", .data = &board_96358vw2, }, -+ { .compatible = "brcm,bcm96358vw", .data = &board_96358vw, }, -+ { .compatible = "brcm,bcm96358vw2", .data = &board_96358vw2, }, -+ { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, -+ { .compatible = "pirelli,a226g", .data = &board_DWVS0, }, -+ { .compatible = "pirelli,a226m", .data = &board_DWVS0, }, -+ { .compatible = "pirelli,a226m-fwb", .data = &board_DWVS0, }, -+ { .compatible = "pirelli,agpf-s0", .data = &board_AGPFS0, }, -+#endif -+#ifdef CONFIG_BCM63XX_CPU_6368 -+#endif -+#ifdef CONFIG_BCM63XX_CPU_63268 -+#endif -+#endif /* CONFIG_OF */ - { }, - }; - diff --git a/target/linux/brcm63xx/patches-4.4/371_add_of_node_available_by_alias.patch b/target/linux/brcm63xx/patches-4.4/371_add_of_node_available_by_alias.patch deleted file mode 100644 index dbe1a4148..000000000 --- a/target/linux/brcm63xx/patches-4.4/371_add_of_node_available_by_alias.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -144,6 +144,18 @@ void __init device_tree_init(void) - - unflatten_and_copy_device_tree(); - } -+ -+int board_of_device_present(const char *alias) -+{ -+ bool present; -+ struct device_node *np; -+ -+ np = of_find_node_by_path(alias); -+ present = of_device_is_available(np); -+ of_node_put(np); -+ -+ return present; -+} - #endif - - static struct gpio_led_platform_data bcm63xx_led_data; ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -15,4 +15,13 @@ void board_bcm963xx_init(void); - static inline void board_bcm963xx_init(void) { } - #endif - -+#if defined(CONFIG_OF) -+int board_of_device_present(const char *alias); -+#else -+static inline void board_of_device_present(const char *alias) -+{ -+ return 0; -+} -+#endif -+ - #endif /* __BOARD_COMMON_H */ diff --git a/target/linux/brcm63xx/patches-4.4/372_dont_register_pflash_when_available_in_dtb.patch b/target/linux/brcm63xx/patches-4.4/372_dont_register_pflash_when_available_in_dtb.patch deleted file mode 100644 index 25384ebb6..000000000 --- a/target/linux/brcm63xx/patches-4.4/372_dont_register_pflash_when_available_in_dtb.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -23,6 +23,8 @@ - #include - #include - -+#include "boards/board_common.h" -+ - static int flash_type; - - static struct mtd_partition mtd_partitions[] = { -@@ -178,6 +180,9 @@ int __init bcm63xx_flash_register(void) - - switch (flash_type) { - case BCM63XX_FLASH_TYPE_PARALLEL: -+ /* don't register when already registered through from dtb */ -+ if (board_of_device_present("pflash")) -+ return 0; - - if (!mtd_resources[0].start) { - /* read base address of boot chip select (0) */ diff --git a/target/linux/brcm63xx/patches-4.4/373-MIPS-BCM63XX-register-interrupt-controllers-through-.patch b/target/linux/brcm63xx/patches-4.4/373-MIPS-BCM63XX-register-interrupt-controllers-through-.patch deleted file mode 100644 index 555352ef1..000000000 --- a/target/linux/brcm63xx/patches-4.4/373-MIPS-BCM63XX-register-interrupt-controllers-through-.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 8a0803979163c647736cb234ee1620c049c4915c Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 1 Dec 2014 00:20:07 +0100 -Subject: [PATCH 5/5] MIPS: BCM63XX: register interrupt controllers through DT - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/irq.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -15,6 +15,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -22,6 +24,9 @@ - #include - #include - -+IRQCHIP_DECLARE(mips_cpu_intc, "mti,cpu-interrupt-controller", -+ mips_cpu_irq_of_init); -+ - void __init arch_init_irq(void) - { - void __iomem *periph_bases[2]; -@@ -30,6 +35,13 @@ void __init arch_init_irq(void) - int periph_irqs[2] = { 2, 3 }; - int ext_irqs[6]; - -+#ifdef CONFIG_OF -+ if (initial_boot_params) { -+ irqchip_init(); -+ return; -+ } -+#endif -+ - periph_bases[0] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); - periph_bases[1] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); - ext_intc_bases[0] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); diff --git a/target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch b/target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch deleted file mode 100644 index c138e0e46..000000000 --- a/target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch +++ /dev/null @@ -1,178 +0,0 @@ -From dbe94a8daaa63ef81b7414f2a17bca8e36dd6daa Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 20 Feb 2015 19:55:32 +0100 -Subject: [PATCH 1/6] gpio: add a simple GPIO driver for bcm63xx - - -Signed-off-by: Jonas Gorski ---- - drivers/gpio/Kconfig | 8 +++ - drivers/gpio/Makefile | 1 + - drivers/gpio/gpio-bcm63xx.c | 135 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 131 insertions(+) - create mode 100644 drivers/gpio/gpio-bcm63xx.c - ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -133,6 +133,13 @@ config GPIO_BCM_KONA - help - Turn on GPIO support for Broadcom "Kona" chips. - -+config GPIO_BCM63XX -+ bool "Broadcom BCM63XX GPIO" -+ depends on MIPS || COMPILE_TEST -+ select GPIO_GENERIC -+ help -+ Turn on GPIO support for Broadcom BCM63XX xDSL chips. -+ - config GPIO_BRCMSTB - tristate "BRCMSTB GPIO support" - default y if ARCH_BRCMSTB ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -24,6 +24,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o - obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o - obj-$(CONFIG_ATH79) += gpio-ath79.o - obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o -+obj-$(CONFIG_GPIO_BCM63XX) += gpio-bcm63xx.o - obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o - obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o - obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o ---- /dev/null -+++ b/drivers/gpio/gpio-bcm63xx.c -@@ -0,0 +1,135 @@ -+/* -+ * Driver for BCM63XX memory-mapped GPIO controllers, based on -+ * Generic driver for memory-mapped GPIO controllers. -+ * -+ * Copyright 2008 MontaVista Software, Inc. -+ * Copyright 2008,2010 Anton Vorontsov -+ * Copyright 2015 Jonas Gorski -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int bcm63xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ char irq_name[7]; /* "gpioXX" */ -+ -+ sprintf(irq_name, "gpio%d", gpio); -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ -+static int bcm63xx_gpio_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct resource *dat_r, *dirout_r; -+ void __iomem *dat; -+ void __iomem *dirout; -+ unsigned long sz; -+ int err; -+ struct gpio_chip *gc; -+ struct bgpio_pdata *pdata = dev_get_platdata(dev); -+ -+ dirout_r = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ dat_r = platform_get_resource(pdev, IORESOURCE_MEM, 1); -+ if (!dat_r || !dirout_r) -+ return -EINVAL; -+ -+ if (resource_size(dat_r) != resource_size(dirout_r)) -+ return -EINVAL; -+ -+ sz = resource_size(dat_r); -+ -+ dat = devm_ioremap_resource(dev, dat_r); -+ if (IS_ERR(dat)) -+ return PTR_ERR(dat); -+ -+ dirout = devm_ioremap_resource(dev, dirout_r); -+ if (IS_ERR(dirout)) -+ return PTR_ERR(dirout); -+ -+ gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL); -+ if (!gc) -+ return -ENOMEM; -+ -+ err = bgpio_init(gc, dev, sz, dat, NULL, NULL, dirout, NULL, -+ BGPIOF_BIG_ENDIAN_BYTE_ORDER); -+ if (err) -+ return err; -+ -+ platform_set_drvdata(pdev, gc); -+ -+ if (dev->of_node) { -+ int id = of_alias_get_id(dev->of_node, "gpio"); -+ u32 ngpios; -+ -+ if (id >= 0) -+ gc->label = devm_kasprintf(dev, GFP_KERNEL, -+ "bcm63xx-gpio.%d", id); -+ -+ if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios)) -+ gc->ngpio = ngpios; -+ -+ if (of_get_property(dev->of_node, "interrupt-names", NULL)) -+ gc->to_irq = bcm63xx_gpio_to_irq; -+ -+ } else if (pdata) { -+ gc->base = pdata->base; -+ if (pdata->ngpio > 0) -+ gc->ngpio = pdata->ngpio; -+ } -+ -+ return gpiochip_add(gc); -+} -+ -+static int bcm63xx_gpio_remove(struct platform_device *pdev) -+{ -+ struct gpio_chip *gc = platform_get_drvdata(pdev); -+ -+ gpiochip_remove(gc); -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static struct of_device_id bcm63xx_gpio_of_match[] = { -+ { .compatible = "brcm,bcm6345-gpio" }, -+ { }, -+}; -+#endif -+ -+static struct platform_driver bcm63xx_gpio_driver = { -+ .probe = bcm63xx_gpio_probe, -+ .remove = bcm63xx_gpio_remove, -+ .driver = { -+ .name = "bcm63xx-gpio", -+ .of_match_table = of_match_ptr(bcm63xx_gpio_of_match), -+ }, -+}; -+ -+module_platform_driver(bcm63xx_gpio_driver); -+ -+MODULE_DESCRIPTION("Driver for BCM63XX memory-mapped GPIO controllers"); -+MODULE_AUTHOR("Jonas Gorski "); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/brcm63xx/patches-4.4/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch b/target/linux/brcm63xx/patches-4.4/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch deleted file mode 100644 index 8df026fac..000000000 --- a/target/linux/brcm63xx/patches-4.4/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch +++ /dev/null @@ -1,216 +0,0 @@ -From cc99dca188bb63ba390008e2f7fa62d0300233e0 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 20 Feb 2015 23:58:54 +0100 -Subject: [PATCH 2/6] MIPS: BCM63XX: switch to new gpio driver - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_common.c | 2 + - arch/mips/bcm63xx/gpio.c | 147 +++++++------------------------ - arch/mips/bcm63xx/setup.c | 3 - - 3 files changed, 33 insertions(+), 119 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -189,6 +189,8 @@ int __init board_register_devices(void) - } - #endif - -+ bcm63xx_gpio_init(); -+ - if (board.has_uart0) - bcm63xx_uart_register(0); - ---- a/arch/mips/bcm63xx/gpio.c -+++ b/arch/mips/bcm63xx/gpio.c -@@ -5,147 +5,62 @@ - * - * Copyright (C) 2008 Maxime Bizon - * Copyright (C) 2008-2011 Florian Fainelli -+ * Copyright (C) Jonas Gorski - */ - - #include --#include --#include - #include -+#include - #include - - #include - #include --#include - #include - --static u32 gpio_out_low_reg; -- --static void bcm63xx_gpio_out_low_reg_init(void) -+static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio) - { -- switch (bcm63xx_get_cpu_id()) { -- case BCM6345_CPU_ID: -- gpio_out_low_reg = GPIO_DATA_LO_REG_6345; -- break; -- default: -- gpio_out_low_reg = GPIO_DATA_LO_REG; -- break; -- } --} -- --static DEFINE_SPINLOCK(bcm63xx_gpio_lock); --static u32 gpio_out_low, gpio_out_high; -+ struct resource res[2]; -+ struct bgpio_pdata pdata; - --static void bcm63xx_gpio_set(struct gpio_chip *chip, -- unsigned gpio, int val) --{ -- u32 reg; -- u32 mask; -- u32 *v; -- unsigned long flags; -- -- if (gpio >= chip->ngpio) -- BUG(); -- -- if (gpio < 32) { -- reg = gpio_out_low_reg; -- mask = 1 << gpio; -- v = &gpio_out_low; -- } else { -- reg = GPIO_DATA_HI_REG; -- mask = 1 << (gpio - 32); -- v = &gpio_out_high; -- } -- -- spin_lock_irqsave(&bcm63xx_gpio_lock, flags); -- if (val) -- *v |= mask; -- else -- *v &= ~mask; -- bcm_gpio_writel(*v, reg); -- spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags); --} -+ memset(res, 0, sizeof(res)); -+ memset(&pdata, 0, sizeof(pdata)); - --static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio) --{ -- u32 reg; -- u32 mask; -+ res[0].flags = IORESOURCE_MEM; -+ res[0].start = bcm63xx_regset_address(RSET_GPIO); -+ res[0].start += dir; - -- if (gpio >= chip->ngpio) -- BUG(); -+ res[0].end = res[0].start + 3; - -- if (gpio < 32) { -- reg = gpio_out_low_reg; -- mask = 1 << gpio; -- } else { -- reg = GPIO_DATA_HI_REG; -- mask = 1 << (gpio - 32); -- } -+ res[1].flags = IORESOURCE_MEM; -+ res[1].start = bcm63xx_regset_address(RSET_GPIO); -+ res[1].start += data; - -- return !!(bcm_gpio_readl(reg) & mask); --} -+ res[1].end = res[1].start + 3; - --static int bcm63xx_gpio_set_direction(struct gpio_chip *chip, -- unsigned gpio, int dir) --{ -- u32 reg; -- u32 mask; -- u32 tmp; -- unsigned long flags; -- -- if (gpio >= chip->ngpio) -- BUG(); -- -- if (gpio < 32) { -- reg = GPIO_CTL_LO_REG; -- mask = 1 << gpio; -- } else { -- reg = GPIO_CTL_HI_REG; -- mask = 1 << (gpio - 32); -- } -- -- spin_lock_irqsave(&bcm63xx_gpio_lock, flags); -- tmp = bcm_gpio_readl(reg); -- if (dir == BCM63XX_GPIO_DIR_IN) -- tmp &= ~mask; -- else -- tmp |= mask; -- bcm_gpio_writel(tmp, reg); -- spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags); -+ pdata.base = id * 32; -+ pdata.ngpio = ngpio; - -- return 0; -+ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2, -+ &pdata, sizeof(pdata)); - } - --static int bcm63xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) -+int __init bcm63xx_gpio_init(void) - { -- return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_IN); --} -+ int ngpio = bcm63xx_gpio_count(); -+ int data_low_reg; - --static int bcm63xx_gpio_direction_output(struct gpio_chip *chip, -- unsigned gpio, int value) --{ -- bcm63xx_gpio_set(chip, gpio, value); -- return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_OUT); --} -+ if (BCMCPU_IS_6345()) -+ data_low_reg = GPIO_DATA_LO_REG_6345; -+ else -+ data_low_reg = GPIO_DATA_LO_REG; - -+ bcm63xx_gpio_init_one(0, GPIO_CTL_LO_REG, data_low_reg, min(ngpio, 32)); - --static struct gpio_chip bcm63xx_gpio_chip = { -- .label = "bcm63xx-gpio", -- .direction_input = bcm63xx_gpio_direction_input, -- .direction_output = bcm63xx_gpio_direction_output, -- .get = bcm63xx_gpio_get, -- .set = bcm63xx_gpio_set, -- .base = 0, --}; -+ if (ngpio <= 32) -+ return 0; - --int __init bcm63xx_gpio_init(void) --{ -- bcm63xx_gpio_out_low_reg_init(); -+ bcm63xx_gpio_init_one(1, GPIO_CTL_HI_REG, GPIO_DATA_HI_REG, ngpio - 32); - -- gpio_out_low = bcm_gpio_readl(gpio_out_low_reg); -- if (!BCMCPU_IS_6345()) -- gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG); -- bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count(); -- pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio); -+ return 0; - -- return gpiochip_add(&bcm63xx_gpio_chip); - } ---- a/arch/mips/bcm63xx/setup.c -+++ b/arch/mips/bcm63xx/setup.c -@@ -164,9 +164,6 @@ void __init plat_mem_setup(void) - - int __init bcm63xx_register_devices(void) - { -- /* register gpiochip */ -- bcm63xx_gpio_init(); -- - return board_register_devices(); - } - diff --git a/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch deleted file mode 100644 index e277bea13..000000000 --- a/target/linux/brcm63xx/patches-4.4/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch +++ /dev/null @@ -1,129 +0,0 @@ -From d13bdf92ec885105cf107183f8464c40e5f3b93b Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 21 Feb 2015 17:21:59 +0100 -Subject: [PATCH 4/6] MIPS: BCM63XX: register lookup for ephy-reset gpio - - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- - arch/mips/bcm63xx/boards/board_common.c | 7 +++-- - arch/mips/bcm63xx/gpio.c | 32 ++++++++++++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h | 2 ++ - .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 5 +-- - 5 files changed, 42 insertions(+), 6 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -55,7 +55,7 @@ static struct board_info __initdata boar - }, - - .ephy_reset_gpio = 36, -- .ephy_reset_gpio_flags = GPIOF_INIT_HIGH, -+ .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, - }; - #endif - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -251,9 +251,10 @@ int __init board_register_devices(void) - - platform_device_register(&bcm63xx_gpio_leds); - -- if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) -- gpio_request_one(board.ephy_reset_gpio, -- board.ephy_reset_gpio_flags, "ephy-reset"); -+ if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) { -+ bcm63xx_gpio_ephy_reset(board.ephy_reset_gpio, -+ board.ephy_reset_gpio_flags); -+ } - - return 0; - } ---- a/arch/mips/bcm63xx/gpio.c -+++ b/arch/mips/bcm63xx/gpio.c -@@ -8,15 +8,23 @@ - * Copyright (C) Jonas Gorski - */ - -+#include -+ - #include - #include - #include - #include -+#include - - #include - #include - #include - -+static const char * const gpio_chip_labels[] = { -+ "bcm63xx-gpio.0", -+ "bcm63xx-gpio.1", -+}; -+ - static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio) - { - struct resource res[2]; -@@ -64,3 +72,25 @@ int __init bcm63xx_gpio_init(void) - return 0; - - } -+ -+static struct gpiod_lookup_table ephy_reset = { -+ .dev_id = "bcm63xx_enet-0", -+ .table = { -+ { /* filled at runtime */ }, -+ { }, -+ }, -+}; -+ -+ -+void bcm63xx_gpio_ephy_reset(int hw_gpio, enum gpio_lookup_flags flags) -+{ -+ if (ephy_reset.table[0].chip_label) -+ return; -+ -+ ephy_reset.table[0].chip_label = gpio_chip_labels[hw_gpio / 32]; -+ ephy_reset.table[0].chip_hwnum = hw_gpio % 32; -+ ephy_reset.table[0].con_id = "reset"; -+ ephy_reset.table[0].flags = flags; -+ -+ gpiod_add_lookup_table(&ephy_reset); -+} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -@@ -2,9 +2,11 @@ - #define BCM63XX_GPIO_H - - #include -+#include - #include - - int __init bcm63xx_gpio_init(void); -+void bcm63xx_gpio_ephy_reset(int hw_gpio, enum gpio_lookup_flags flags); - - static inline unsigned long bcm63xx_gpio_count(void) - { ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -3,6 +3,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -54,8 +55,8 @@ struct board_info { - /* External PHY reset GPIO */ - unsigned int ephy_reset_gpio; - -- /* External PHY reset GPIO flags from gpio.h */ -- unsigned long ephy_reset_gpio_flags; -+ /* External PHY reset GPIO flags from gpio/machine.h */ -+ enum gpio_lookup_flags ephy_reset_gpio_flags; - - /* fallback sprom config */ - struct fallback_sprom_data fallback_sprom; diff --git a/target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch b/target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch deleted file mode 100644 index 6eb1bd028..000000000 --- a/target/linux/brcm63xx/patches-4.4/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch +++ /dev/null @@ -1,35 +0,0 @@ -From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 21 Feb 2015 17:26:50 +0100 -Subject: [PATCH 5/6] MIPS: BCM63XX: do not register gpio-controller if -present in dtb - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/gpio.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/gpio.c -+++ b/arch/mips/bcm63xx/gpio.c -@@ -20,6 +20,8 @@ - #include - #include - -+#include "boards/board_common.h" -+ - static const char * const gpio_chip_labels[] = { - "bcm63xx-gpio.0", - "bcm63xx-gpio.1", -@@ -48,8 +50,10 @@ static void __init bcm63xx_gpio_init_one - pdata.base = id * 32; - pdata.ngpio = ngpio; - -- platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2, -- &pdata, sizeof(pdata)); -+ if (!board_of_device_present("gpio0") && -+ !board_of_device_present("pinctrl")) -+ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, -+ 2, &pdata, sizeof(pdata)); - } - - int __init bcm63xx_gpio_init(void) diff --git a/target/linux/brcm63xx/patches-4.4/379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch b/target/linux/brcm63xx/patches-4.4/379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch deleted file mode 100644 index b5719990b..000000000 --- a/target/linux/brcm63xx/patches-4.4/379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 1647cccc871bf43876c3df9852869680880d054c Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 25 Mar 2015 13:52:02 +0100 -Subject: [PATCH 1/2] MIPS: BCM63XX: provide a gpio lookup for the pcmcia - ready gpio - -To prepare for a time when gpiobases don't need to be fixed anymore. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-pcmcia.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/arch/mips/bcm63xx/dev-pcmcia.c -+++ b/arch/mips/bcm63xx/dev-pcmcia.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -101,6 +102,14 @@ static const struct { - }, - }; - -+static struct gpiod_lookup_table pcmcia_gpios_table = { -+ .dev_id = "bcm63xx_pcmcia.0", -+ .table = { -+ GPIO_LOOKUP("bcm63xx-gpio.0", 0, "ready", GPIO_ACTIVE_HIGH), -+ { }, -+ }, -+}; -+ - int __init bcm63xx_pcmcia_register(void) - { - int ret, i; -@@ -112,16 +121,20 @@ int __init bcm63xx_pcmcia_register(void) - switch (bcm63xx_get_cpu_id()) { - case BCM6348_CPU_ID: - pd.ready_gpio = 22; -+ pcmcia_gpios_table.table[0].chip_hwnum = 22; - break; - - case BCM6358_CPU_ID: - pd.ready_gpio = 18; -+ pcmcia_gpios_table.table[0].chip_hwnum = 18; - break; - - default: - return -ENODEV; - } - -+ gpiod_add_lookup_table(&pcmcia_gpios_table); -+ - pcmcia_resources[0].start = bcm63xx_regset_address(RSET_PCMCIA); - pcmcia_resources[0].end = pcmcia_resources[0].start + - RSET_PCMCIA_SIZE - 1; diff --git a/target/linux/brcm63xx/patches-4.4/380-pcmcia-bcm63xx_pmcia-use-the-new-named-gpio.patch b/target/linux/brcm63xx/patches-4.4/380-pcmcia-bcm63xx_pmcia-use-the-new-named-gpio.patch deleted file mode 100644 index 524ca1aa0..000000000 --- a/target/linux/brcm63xx/patches-4.4/380-pcmcia-bcm63xx_pmcia-use-the-new-named-gpio.patch +++ /dev/null @@ -1,59 +0,0 @@ -From c4e04f1c54928a49b227a5420d38b18226838775 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 25 Mar 2015 13:54:56 +0100 -Subject: [PATCH 2/2] pcmcia: bcm63xx_pmcia: use the new named gpio - -Use the new named gpio instead of relying on the hardware gpio numbers -matching the virtual gpio numbers. - -Signed-off-by: Jonas Gorski ---- - drivers/pcmcia/bcm63xx_pcmcia.c | 9 ++++++++- - drivers/pcmcia/bcm63xx_pcmcia.h | 4 ++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - ---- a/drivers/pcmcia/bcm63xx_pcmcia.c -+++ b/drivers/pcmcia/bcm63xx_pcmcia.c -@@ -237,7 +237,7 @@ static unsigned int __get_socket_status( - stat |= SS_XVCARD; - stat |= SS_POWERON; - -- if (gpio_get_value(skt->pd->ready_gpio)) -+ if (gpiod_get_value(skt->ready_gpio)) - stat |= SS_READY; - - return stat; -@@ -373,6 +373,13 @@ static int bcm63xx_drv_pcmcia_probe(stru - goto err; - } - -+ /* get ready gpio */ -+ skt->ready_gpio = devm_gpiod_get(&pdev->dev, "ready", GPIOD_IN); -+ if (IS_ERR(skt->ready_gpio)) { -+ ret = PTR_ERR(skt->ready_gpio); -+ goto err; -+ } -+ - /* resources are static */ - sock->resource_ops = &pccard_static_ops; - sock->ops = &bcm63xx_pcmcia_operations; ---- a/drivers/pcmcia/bcm63xx_pcmcia.h -+++ b/drivers/pcmcia/bcm63xx_pcmcia.h -@@ -3,6 +3,7 @@ - - #include - #include -+#include - #include - #include - -@@ -55,6 +56,9 @@ struct bcm63xx_pcmcia_socket { - - /* base address of io memory */ - void __iomem *io_base; -+ -+ /* ready gpio */ -+ struct gpio_desc *ready_gpio; - }; - - #endif /* BCM63XX_PCMCIA_H_ */ diff --git a/target/linux/brcm63xx/patches-4.4/381-Documentation-add-BCM6318-pincontroller-binding-docu.patch b/target/linux/brcm63xx/patches-4.4/381-Documentation-add-BCM6318-pincontroller-binding-docu.patch deleted file mode 100644 index 5d4265f7f..000000000 --- a/target/linux/brcm63xx/patches-4.4/381-Documentation-add-BCM6318-pincontroller-binding-docu.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 8439e5d2e69f54a532bb5f8ec001b4b5a3035574 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:38:05 +0200 -Subject: [PATCH 14/16] Documentation: add BCM6318 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6318 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6318-pinctrl.txt | 79 ++++++++++++++++++++++ - 1 file changed, 79 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.txt -@@ -0,0 +1,79 @@ -+* Broadcom BCM6318 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6318-pinctrl". -+- regs: Register specifiers of dirout, dat, mode, mux, and pad registers. -+- reg-names: Must be "dirout", "dat", "mode", "mux", "pad". -+- gpio-controller: Identifies this node as a gpio controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@10000080 { -+ compatible = "brcm,bcm6318-pinctrl"; -+ reg = <0x10000080 0x08>, -+ <0x10000088 0x08>, -+ <0x10000098 0x04>, -+ <0x1000009c 0x0c>, -+ <0x100000d4 0x18>; -+ reg-names = "dirout", "dat", "mode", "mux", "pad"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 led, ephy0_spd_led -+gpio1 1 led, ephy1_spd_led -+gpio2 2 led, ephy2_spd_led -+gpio3 3 led, ephy3_spd_led -+gpio4 4 led, ephy0_act_led -+gpio5 5 led, ephy1_act_led -+gpio6 6 led, ephy2_act_led, serial_led_data -+gpio7 7 led, ephy3_act_led, serial_led_clk -+gpio8 8 led, inet_act_led -+gpio9 9 led, inet_fail_led -+gpio10 10 led, dsl_led -+gpio11 11 led, post_fail_led -+gpio12 12 led, wlan_wps_led -+gpio13 13 led, usb_pwron, usb_device_led -+gpio14 14 led -+gpio15 15 led -+gpio16 16 led -+gpio17 17 led -+gpio18 18 led -+gpio19 19 led -+gpio20 20 led -+gpio21 21 led -+gpio22 22 led -+gpio23 23 led -+gpio24 24 - -+gpio25 25 - -+gpio26 26 - -+gpio27 27 - -+gpio28 28 - -+gpio29 29 - -+gpio30 30 - -+gpio31 31 - -+gpio32 32 - -+gpio33 33 - -+gpio34 34 - -+gpio35 35 - -+gpio36 36 - -+gpio37 37 - -+gpio38 38 - -+gpio39 39 - -+gpio40 40 usb_active -+gpio41 41 - -+gpio42 42 - -+gpio43 43 - -+gpio44 44 - -+gpio45 45 - -+gpio46 46 - -+gpio47 47 - -+gpio48 48 - -+gpio49 49 - diff --git a/target/linux/brcm63xx/patches-4.4/382-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch b/target/linux/brcm63xx/patches-4.4/382-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch deleted file mode 100644 index 2a89dde3c..000000000 --- a/target/linux/brcm63xx/patches-4.4/382-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch +++ /dev/null @@ -1,609 +0,0 @@ -From bd9c250ef85e6f99aa5d59b21abb87d0a48f2f61 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:20:39 +0200 -Subject: [PATCH 15/16] pinctrl: add a pincontrol driver for BCM6318 - -Add a pincontrol driver for BCM6318. BCM6318 allows muxing most GPIOs -to different functions. BCM6318 is similar to BCM6328 with the addition -of a pad register, and the GPIO meaning of the mux register changes -based on the GPIO number. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 7 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6318.c | 564 ++++++++++++++++++++++++++++++ - 3 files changed, 572 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6318.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -2,6 +2,13 @@ config PINCTRL_BCM63XX - bool - select GPIO_GENERIC - -+config PINCTRL_BCM6318 -+ bool "BCM6318 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BCM63XX -+ select GENERIC_PINCONF -+ - config PINCTRL_BCM6328 - bool "BCM6328 pincontrol driver" if COMPILE_TEST - select PINMUX ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -1,4 +1,5 @@ - obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o -+obj-$(CONFIG_PINCTRL_BCM6318) += pinctrl-bcm6318.o - obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o - obj-$(CONFIG_PINCTRL_BCM6348) += pinctrl-bcm6348.o - obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6318.c -@@ -0,0 +1,564 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6318_NGPIO 50 -+ -+struct bcm6318_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6318_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ unsigned mode_val:1; -+ unsigned mux_val:2; -+}; -+ -+struct bcm6318_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *mode; -+ void __iomem *mux[3]; -+ void __iomem *pad[6]; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+static const struct pinctrl_pin_desc bcm6318_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ PINCTRL_PIN(2, "gpio2"), -+ PINCTRL_PIN(3, "gpio3"), -+ PINCTRL_PIN(4, "gpio4"), -+ PINCTRL_PIN(5, "gpio5"), -+ PINCTRL_PIN(6, "gpio6"), -+ PINCTRL_PIN(7, "gpio7"), -+ PINCTRL_PIN(8, "gpio8"), -+ PINCTRL_PIN(9, "gpio9"), -+ PINCTRL_PIN(10, "gpio10"), -+ PINCTRL_PIN(11, "gpio11"), -+ PINCTRL_PIN(12, "gpio12"), -+ PINCTRL_PIN(13, "gpio13"), -+ PINCTRL_PIN(14, "gpio14"), -+ PINCTRL_PIN(15, "gpio15"), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ PINCTRL_PIN(22, "gpio22"), -+ PINCTRL_PIN(23, "gpio23"), -+ PINCTRL_PIN(24, "gpio24"), -+ PINCTRL_PIN(25, "gpio25"), -+ PINCTRL_PIN(26, "gpio26"), -+ PINCTRL_PIN(27, "gpio27"), -+ PINCTRL_PIN(28, "gpio28"), -+ PINCTRL_PIN(29, "gpio29"), -+ PINCTRL_PIN(30, "gpio30"), -+ PINCTRL_PIN(31, "gpio31"), -+ PINCTRL_PIN(32, "gpio32"), -+ PINCTRL_PIN(33, "gpio33"), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+ PINCTRL_PIN(38, "gpio38"), -+ PINCTRL_PIN(39, "gpio39"), -+ PINCTRL_PIN(40, "gpio40"), -+ PINCTRL_PIN(41, "gpio41"), -+ PINCTRL_PIN(42, "gpio42"), -+ PINCTRL_PIN(43, "gpio43"), -+ PINCTRL_PIN(44, "gpio44"), -+ PINCTRL_PIN(45, "gpio45"), -+ PINCTRL_PIN(46, "gpio46"), -+ PINCTRL_PIN(47, "gpio47"), -+ PINCTRL_PIN(48, "gpio48"), -+ PINCTRL_PIN(49, "gpio49"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+static unsigned gpio32_pins[] = { 32 }; -+static unsigned gpio33_pins[] = { 33 }; -+static unsigned gpio34_pins[] = { 34 }; -+static unsigned gpio35_pins[] = { 35 }; -+static unsigned gpio36_pins[] = { 36 }; -+static unsigned gpio37_pins[] = { 37 }; -+static unsigned gpio38_pins[] = { 38 }; -+static unsigned gpio39_pins[] = { 39 }; -+static unsigned gpio40_pins[] = { 40 }; -+static unsigned gpio41_pins[] = { 41 }; -+static unsigned gpio42_pins[] = { 42 }; -+static unsigned gpio43_pins[] = { 43 }; -+static unsigned gpio44_pins[] = { 44 }; -+static unsigned gpio45_pins[] = { 45 }; -+static unsigned gpio46_pins[] = { 46 }; -+static unsigned gpio47_pins[] = { 47 }; -+static unsigned gpio48_pins[] = { 48 }; -+static unsigned gpio49_pins[] = { 49 }; -+ -+#define BCM6318_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm6318_pingroup bcm6318_groups[] = { -+ BCM6318_GROUP(gpio0), -+ BCM6318_GROUP(gpio1), -+ BCM6318_GROUP(gpio2), -+ BCM6318_GROUP(gpio3), -+ BCM6318_GROUP(gpio4), -+ BCM6318_GROUP(gpio5), -+ BCM6318_GROUP(gpio6), -+ BCM6318_GROUP(gpio7), -+ BCM6318_GROUP(gpio8), -+ BCM6318_GROUP(gpio9), -+ BCM6318_GROUP(gpio10), -+ BCM6318_GROUP(gpio11), -+ BCM6318_GROUP(gpio12), -+ BCM6318_GROUP(gpio13), -+ BCM6318_GROUP(gpio14), -+ BCM6318_GROUP(gpio15), -+ BCM6318_GROUP(gpio16), -+ BCM6318_GROUP(gpio17), -+ BCM6318_GROUP(gpio18), -+ BCM6318_GROUP(gpio19), -+ BCM6318_GROUP(gpio20), -+ BCM6318_GROUP(gpio21), -+ BCM6318_GROUP(gpio22), -+ BCM6318_GROUP(gpio23), -+ BCM6318_GROUP(gpio24), -+ BCM6318_GROUP(gpio25), -+ BCM6318_GROUP(gpio26), -+ BCM6318_GROUP(gpio27), -+ BCM6318_GROUP(gpio28), -+ BCM6318_GROUP(gpio29), -+ BCM6318_GROUP(gpio30), -+ BCM6318_GROUP(gpio31), -+ BCM6318_GROUP(gpio32), -+ BCM6318_GROUP(gpio33), -+ BCM6318_GROUP(gpio34), -+ BCM6318_GROUP(gpio35), -+ BCM6318_GROUP(gpio36), -+ BCM6318_GROUP(gpio37), -+ BCM6318_GROUP(gpio38), -+ BCM6318_GROUP(gpio39), -+ BCM6318_GROUP(gpio40), -+ BCM6318_GROUP(gpio41), -+ BCM6318_GROUP(gpio42), -+ BCM6318_GROUP(gpio43), -+ BCM6318_GROUP(gpio44), -+ BCM6318_GROUP(gpio45), -+ BCM6318_GROUP(gpio46), -+ BCM6318_GROUP(gpio47), -+ BCM6318_GROUP(gpio48), -+ BCM6318_GROUP(gpio49), -+}; -+ -+/* GPIO_MODE */ -+static const char * const led_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+}; -+ -+/* PINMUX_SEL */ -+static const char * const ephy0_spd_led_groups[] = { -+ "gpio0", -+}; -+ -+static const char * const ephy1_spd_led_groups[] = { -+ "gpio1", -+}; -+ -+static const char * const ephy2_spd_led_groups[] = { -+ "gpio2", -+}; -+ -+static const char * const ephy3_spd_led_groups[] = { -+ "gpio3", -+}; -+ -+static const char * const ephy0_act_led_groups[] = { -+ "gpio4", -+}; -+ -+static const char * const ephy1_act_led_groups[] = { -+ "gpio5", -+}; -+ -+static const char * const ephy2_act_led_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const ephy3_act_led_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const serial_led_data_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const inet_act_led_groups[] = { -+ "gpio8", -+}; -+ -+static const char * const inet_fail_led_groups[] = { -+ "gpio9", -+}; -+ -+static const char * const dsl_led_groups[] = { -+ "gpio10", -+}; -+ -+static const char * const post_fail_led_groups[] = { -+ "gpio11", -+}; -+ -+static const char * const wlan_wps_led_groups[] = { -+ "gpio12", -+}; -+ -+static const char * const usb_pwron_groups[] = { -+ "gpio13", -+}; -+ -+static const char * const usb_device_led_groups[] = { -+ "gpio13", -+}; -+ -+static const char * const usb_active_groups[] = { -+ "gpio40", -+}; -+ -+#define BCM6318_MODE_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .mode_val = 1, \ -+ } -+ -+#define BCM6318_MUX_FUN(n, mux) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .mux_val = mux, \ -+ } -+ -+static const struct bcm6318_function bcm6318_funcs[] = { -+ BCM6318_MODE_FUN(led), -+ BCM6318_MUX_FUN(ephy0_spd_led, 1), -+ BCM6318_MUX_FUN(ephy1_spd_led, 1), -+ BCM6318_MUX_FUN(ephy2_spd_led, 1), -+ BCM6318_MUX_FUN(ephy3_spd_led, 1), -+ BCM6318_MUX_FUN(ephy0_act_led, 1), -+ BCM6318_MUX_FUN(ephy1_act_led, 1), -+ BCM6318_MUX_FUN(ephy2_act_led, 1), -+ BCM6318_MUX_FUN(ephy3_act_led, 1), -+ BCM6318_MUX_FUN(serial_led_data, 3), -+ BCM6318_MUX_FUN(serial_led_clk, 3), -+ BCM6318_MUX_FUN(inet_act_led, 1), -+ BCM6318_MUX_FUN(inet_fail_led, 1), -+ BCM6318_MUX_FUN(dsl_led, 1), -+ BCM6318_MUX_FUN(post_fail_led, 1), -+ BCM6318_MUX_FUN(wlan_wps_led, 1), -+ BCM6318_MUX_FUN(usb_pwron, 1), -+ BCM6318_MUX_FUN(usb_device_led, 2), -+ BCM6318_MUX_FUN(usb_active, 2), -+}; -+ -+static int bcm6318_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6318_groups); -+} -+ -+static const char *bcm6318_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6318_groups[group].name; -+} -+ -+static int bcm6318_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6318_groups[group].pins; -+ *num_pins = bcm6318_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6318_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6318_funcs); -+} -+ -+static const char *bcm6318_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6318_funcs[selector].name; -+} -+ -+static int bcm6318_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6318_funcs[selector].groups; -+ *num_groups = bcm6318_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6318_rmw_mux(struct bcm6318_pinctrl *pctl, unsigned pin, -+ u32 mode, u32 mux) -+{ -+ unsigned long flags; -+ u32 reg; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ if (pin < 32) { -+ reg = __raw_readl(pctl->mode); -+ reg &= ~BIT(pin); -+ if (mode) -+ reg |= BIT(pin); -+ __raw_writel(reg, pctl->mode); -+ } -+ -+ if (pin < 48) { -+ reg = __raw_readl(pctl->mux[pin / 16]); -+ reg &= ~(3UL << ((pin % 16) * 2)); -+ reg |= mux << ((pin % 16) * 2); -+ __raw_writel(reg, pctl->mux[pin / 16]); -+ } -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static void bcm6318_set_pad(struct bcm6318_pinctrl *pctl, unsigned pin, u8 val) -+{ -+ unsigned long flags; -+ u32 reg; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ reg = __raw_readl(pctl->pad[pin / 8]); -+ reg &= ~(0xfUL << ((pin % 8) * 4)); -+ reg |= val << ((pin % 8) * 4); -+ __raw_writel(reg, pctl->pad[pin / 8]); -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static int bcm6318_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6318_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6318_pingroup *grp = &bcm6318_groups[group]; -+ const struct bcm6318_function *f = &bcm6318_funcs[selector]; -+ -+ bcm6318_rmw_mux(pctl, grp->pins[0], f->mode_val, f->mux_val); -+ -+ return 0; -+} -+ -+static int bcm6318_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6318_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable all functions using this pin */ -+ if (offset < 13) { -+ /* GPIOs 0-12 use mux 0 as GPIO function */ -+ bcm6318_rmw_mux(pctl, offset, 0, 0); -+ } else if (offset < 42) { -+ /* GPIOs 13-41 use mux 3 as GPIO function */ -+ bcm6318_rmw_mux(pctl, offset, 0, 3); -+ -+ /* FIXME: revert to old value for non gpio? */ -+ bcm6318_set_pad(pctl, offset, 0); -+ } else { -+ /* no idea, really */ -+ } -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6318_pctl_ops = { -+ .get_groups_count = bcm6318_pinctrl_get_group_count, -+ .get_group_name = bcm6318_pinctrl_get_group_name, -+ .get_group_pins = bcm6318_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6318_pmx_ops = { -+ .get_functions_count = bcm6318_pinctrl_get_func_count, -+ .get_function_name = bcm6318_pinctrl_get_func_name, -+ .get_function_groups = bcm6318_pinctrl_get_groups, -+ .set_mux = bcm6318_pinctrl_set_mux, -+ .gpio_request_enable = bcm6318_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6318_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6318_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *mode, *mux, *pad; -+ unsigned i; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mux"); -+ mux = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mux)) -+ return PTR_ERR(mux); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pad"); -+ pad = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(pad)) -+ return PTR_ERR(pad); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->mode = mode; -+ -+ for (i = 0; i < 3; i++) -+ pctl->mux[i] = mux + (i * 4); -+ -+ for (i = 0; i < 6; i++) -+ pctl->pad[i] = pad + (i * 4); -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6318_pctl_ops; -+ pctl->desc.pmxops = &bcm6318_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6318_pins); -+ pctl->desc.pins = bcm6318_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6318_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6318_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6318-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6318_pinctrl_driver = { -+ .probe = bcm6318_pinctrl_probe, -+ .driver = { -+ .name = "bcm6318-pinctrl", -+ .of_match_table = bcm6318_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6318_pinctrl_driver); diff --git a/target/linux/brcm63xx/patches-4.4/383-bcm63xx_select_pinctrl.patch b/target/linux/brcm63xx/patches-4.4/383-bcm63xx_select_pinctrl.patch deleted file mode 100644 index 52c240ff4..000000000 --- a/target/linux/brcm63xx/patches-4.4/383-bcm63xx_select_pinctrl.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -24,6 +24,8 @@ config BCM63XX_CPU_6318 - select HW_HAS_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BCM6318 - - config BCM63XX_CPU_6328 - bool "support 6328 CPU" -@@ -31,6 +33,8 @@ config BCM63XX_CPU_6328 - select HW_HAS_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BCM6328 - - config BCM63XX_CPU_6338 - bool "support 6338 CPU" -@@ -46,6 +50,8 @@ config BCM63XX_CPU_6348 - select SYS_HAS_CPU_BMIPS32_3300 - select HW_HAS_PCI - select BCM63XX_OHCI -+ select PINCTRL -+ select PINCTRL_BCM6348 - - config BCM63XX_CPU_6358 - bool "support 6358 CPU" -@@ -53,6 +59,8 @@ config BCM63XX_CPU_6358 - select HW_HAS_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BCM6358 - - config BCM63XX_CPU_6362 - bool "support 6362 CPU" -@@ -60,6 +68,8 @@ config BCM63XX_CPU_6362 - select HW_HAS_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BCM6362 - - config BCM63XX_CPU_6368 - bool "support 6368 CPU" -@@ -67,6 +77,8 @@ config BCM63XX_CPU_6368 - select HW_HAS_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BCM6368 - - config BCM63XX_CPU_63268 - bool "support 63268 CPU" -@@ -74,6 +86,8 @@ config BCM63XX_CPU_63268 - select HW_HAS_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BCM63268 - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" diff --git a/target/linux/brcm63xx/patches-4.4/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch b/target/linux/brcm63xx/patches-4.4/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch deleted file mode 100644 index 3b2dda121..000000000 --- a/target/linux/brcm63xx/patches-4.4/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch +++ /dev/null @@ -1,105 +0,0 @@ -From cad8f63047c0691e8185d3c9c6a2705b83310c9c Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 31 Jul 2017 20:10:36 +0200 -Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree - ---- - arch/mips/bcm63xx/clk.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -485,6 +485,8 @@ static struct clk_lookup bcm3368_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("fff8c100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("fff8c120.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -501,7 +503,9 @@ static struct clk_lookup bcm6318_clks[] - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ CLKDEV_INIT("10003000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -515,7 +519,10 @@ static struct clk_lookup bcm6328_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -528,6 +535,7 @@ static struct clk_lookup bcm6338_clks[] - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0300.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -542,6 +550,7 @@ static struct clk_lookup bcm6345_clks[] - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0300.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -556,6 +565,7 @@ static struct clk_lookup bcm6348_clks[] - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0300.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -572,6 +582,8 @@ static struct clk_lookup bcm6358_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0120.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -591,7 +603,10 @@ static struct clk_lookup bcm6362_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -607,6 +622,8 @@ static struct clk_lookup bcm6368_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -621,7 +638,10 @@ static struct clk_lookup bcm63268_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("10000180.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("100001a0.serial", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), diff --git a/target/linux/brcm63xx/patches-4.4/390-MIPS-BCM63XX-do-not-register-SPI-controllers.patch b/target/linux/brcm63xx/patches-4.4/390-MIPS-BCM63XX-do-not-register-SPI-controllers.patch deleted file mode 100644 index 084ef9ee8..000000000 --- a/target/linux/brcm63xx/patches-4.4/390-MIPS-BCM63XX-do-not-register-SPI-controllers.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 39d2882058345b5994680b8731848a0343878019 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 4 Feb 2017 12:58:50 +0100 -Subject: [PATCH 7/8] MIPS: BCM63XX: do not register SPI controllers - -We now register them through DT, so no need to keep them here. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 7 ------- - 1 file changed, 7 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -28,9 +28,7 @@ - #include - #include - #include --#include - #include --#include - #include - #include - #include -@@ -240,10 +238,6 @@ int __init board_register_devices(void) - bcm63xx_register_fallback_sprom(&board.fallback_sprom))) - pr_err(PFX "failed to register fallback SPROM\n"); - -- bcm63xx_spi_register(); -- -- bcm63xx_hsspi_register(); -- - bcm63xx_flash_register(); - - bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -1,6 +1,6 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ -- dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ -+ dev-pcmcia.o dev-rng.o dev-uart.o \ - dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \ - usb-common.o sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o ---- a/arch/mips/bcm63xx/dev-hsspi.c -+++ /dev/null -@@ -1,48 +0,0 @@ --/* -- * This file is subject to the terms and conditions of the GNU General Public -- * License. See the file "COPYING" in the main directory of this archive -- * for more details. -- * -- * Copyright (C) 2012 Jonas Gorski -- */ -- --#include --#include --#include -- --#include --#include --#include -- --static struct resource spi_resources[] = { -- { -- .start = -1, /* filled at runtime */ -- .end = -1, /* filled at runtime */ -- .flags = IORESOURCE_MEM, -- }, -- { -- .start = -1, /* filled at runtime */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device bcm63xx_hsspi_device = { -- .name = "bcm63xx-hsspi", -- .id = 0, -- .num_resources = ARRAY_SIZE(spi_resources), -- .resource = spi_resources, --}; -- --int __init bcm63xx_hsspi_register(void) --{ -- if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6362() && -- !BCMCPU_IS_63268()) -- return -ENODEV; -- -- spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); -- spi_resources[0].end = spi_resources[0].start; -- spi_resources[0].end += RSET_HSSPI_SIZE - 1; -- spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI); -- -- return platform_device_register(&bcm63xx_hsspi_device); --} ---- a/arch/mips/bcm63xx/dev-spi.c -+++ /dev/null -@@ -1,60 +0,0 @@ --/* -- * This file is subject to the terms and conditions of the GNU General Public -- * License. See the file "COPYING" in the main directory of this archive -- * for more details. -- * -- * Copyright (C) 2009-2011 Florian Fainelli -- * Copyright (C) 2010 Tanguy Bouzeloc -- */ -- --#include --#include --#include --#include --#include --#include -- --#include --#include --#include -- --static struct resource spi_resources[] = { -- { -- .start = -1, /* filled at runtime */ -- .end = -1, /* filled at runtime */ -- .flags = IORESOURCE_MEM, -- }, -- { -- .start = -1, /* filled at runtime */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device bcm63xx_spi_device = { -- .id = -1, -- .num_resources = ARRAY_SIZE(spi_resources), -- .resource = spi_resources, --}; -- --int __init bcm63xx_spi_register(void) --{ -- if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6345()) -- return -ENODEV; -- -- spi_resources[0].start = bcm63xx_regset_address(RSET_SPI); -- spi_resources[0].end = spi_resources[0].start; -- spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI); -- -- if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) { -- bcm63xx_spi_device.name = "bcm6348-spi", -- spi_resources[0].end += BCM_6348_RSET_SPI_SIZE - 1; -- } -- -- if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() || -- BCMCPU_IS_6368() || BCMCPU_IS_63268()) { -- bcm63xx_spi_device.name = "bcm6358-spi", -- spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1; -- } -- -- return platform_device_register(&bcm63xx_spi_device); --} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h -+++ /dev/null -@@ -1,8 +0,0 @@ --#ifndef BCM63XX_DEV_HSSPI_H --#define BCM63XX_DEV_HSSPI_H -- --#include -- --int bcm63xx_hsspi_register(void); -- --#endif /* BCM63XX_DEV_HSSPI_H */ diff --git a/target/linux/brcm63xx/patches-4.4/391-MIPS-BCM63XX-do-not-register-uart.patch b/target/linux/brcm63xx/patches-4.4/391-MIPS-BCM63XX-do-not-register-uart.patch deleted file mode 100644 index e033ea3a4..000000000 --- a/target/linux/brcm63xx/patches-4.4/391-MIPS-BCM63XX-do-not-register-uart.patch +++ /dev/null @@ -1,257 +0,0 @@ ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -1,6 +1,6 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ -- dev-pcmcia.o dev-rng.o dev-uart.o \ -+ dev-pcmcia.o dev-rng.o \ - dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \ - usb-common.o sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o ---- a/arch/mips/bcm63xx/dev-uart.c -+++ /dev/null -@@ -1,76 +0,0 @@ --/* -- * This file is subject to the terms and conditions of the GNU General Public -- * License. See the file "COPYING" in the main directory of this archive -- * for more details. -- * -- * Copyright (C) 2008 Maxime Bizon -- */ -- --#include --#include --#include --#include -- --static struct resource uart0_resources[] = { -- { -- /* start & end filled at runtime */ -- .flags = IORESOURCE_MEM, -- }, -- { -- /* start filled at runtime */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct resource uart1_resources[] = { -- { -- /* start & end filled at runtime */ -- .flags = IORESOURCE_MEM, -- }, -- { -- /* start filled at runtime */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device bcm63xx_uart_devices[] = { -- { -- .name = "bcm63xx_uart", -- .id = 0, -- .num_resources = ARRAY_SIZE(uart0_resources), -- .resource = uart0_resources, -- }, -- -- { -- .name = "bcm63xx_uart", -- .id = 1, -- .num_resources = ARRAY_SIZE(uart1_resources), -- .resource = uart1_resources, -- } --}; -- --int __init bcm63xx_uart_register(unsigned int id) --{ -- if (id >= ARRAY_SIZE(bcm63xx_uart_devices)) -- return -ENODEV; -- -- if (id == 1 && (!BCMCPU_IS_3368() && !BCMCPU_IS_6358() && -- !BCMCPU_IS_6368())) -- return -ENODEV; -- -- if (id == 0) { -- uart0_resources[0].start = bcm63xx_regset_address(RSET_UART0); -- uart0_resources[0].end = uart0_resources[0].start + -- RSET_UART_SIZE - 1; -- uart0_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0); -- } -- -- if (id == 1) { -- uart1_resources[0].start = bcm63xx_regset_address(RSET_UART1); -- uart1_resources[0].end = uart1_resources[0].start + -- RSET_UART_SIZE - 1; -- uart1_resources[1].start = bcm63xx_get_irq_number(IRQ_UART1); -- } -- -- return platform_device_register(&bcm63xx_uart_devices[id]); --} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h -+++ /dev/null -@@ -1,6 +0,0 @@ --#ifndef BCM63XX_DEV_UART_H_ --#define BCM63XX_DEV_UART_H_ -- --int bcm63xx_uart_register(unsigned int id); -- --#endif /* BCM63XX_DEV_UART_H_ */ ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -33,8 +33,6 @@ struct board_info { - unsigned int has_ehci0:1; - unsigned int has_usbd:1; - unsigned int has_dsp:1; -- unsigned int has_uart0:1; -- unsigned int has_uart1:1; - unsigned int use_fallback_sprom:1; - - /* ethernet config */ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -20,7 +20,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -189,12 +188,6 @@ int __init board_register_devices(void) - - bcm63xx_gpio_init(); - -- if (board.has_uart0) -- bcm63xx_uart_register(0); -- -- if (board.has_uart1) -- bcm63xx_uart_register(1); -- - if (board.has_pccard) - bcm63xx_pcmcia_register(); - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -35,9 +35,6 @@ static struct board_info __initdata boar - .name = "CVG834G_E15R3921", - .expected_cpu_id = 0x3368, - -- .has_uart0 = 1, -- .has_uart1 = 1, -- - .has_enet0 = 1, - .has_pci = 1, - -@@ -67,7 +64,6 @@ static struct board_info __initdata boar - .name = "96328avng", - .expected_cpu_id = 0x6328, - -- .has_uart0 = 1, - .has_pci = 1, - .has_usbd = 0, - .use_fallback_sprom = 1, -@@ -116,7 +112,6 @@ static struct board_info __initdata boar - .name = "96338GW", - .expected_cpu_id = 0x6338, - -- .has_uart0 = 1, - .has_enet0 = 1, - .enet0 = { - .force_speed_100 = 1, -@@ -159,7 +154,6 @@ static struct board_info __initdata boar - .name = "96338W", - .expected_cpu_id = 0x6338, - -- .has_uart0 = 1, - .has_enet0 = 1, - .enet0 = { - .force_speed_100 = 1, -@@ -204,8 +198,6 @@ static struct board_info __initdata boar - static struct board_info __initdata board_96345gw2 = { - .name = "96345GW2", - .expected_cpu_id = 0x6345, -- -- .has_uart0 = 1, - }; - #endif - -@@ -217,7 +209,6 @@ static struct board_info __initdata boar - .name = "96348R", - .expected_cpu_id = 0x6348, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_pci = 1, - .use_fallback_sprom = 1, -@@ -262,7 +253,6 @@ static struct board_info __initdata boar - .name = "96348GW-10", - .expected_cpu_id = 0x6348, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -@@ -323,7 +313,6 @@ static struct board_info __initdata boar - .name = "96348GW-11", - .expected_cpu_id = 0x6348, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -@@ -378,7 +367,6 @@ static struct board_info __initdata boar - .name = "96348GW", - .expected_cpu_id = 0x6348, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -@@ -437,7 +425,6 @@ static struct board_info __initdata boar - .name = "F@ST2404", - .expected_cpu_id = 0x6348, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -@@ -482,7 +469,6 @@ static struct board_info __initdata boar - .name = "DV201AMR", - .expected_cpu_id = 0x6348, - -- .has_uart0 = 1, - .has_pci = 1, - .use_fallback_sprom = 1, - .has_ohci0 = 1, -@@ -503,7 +489,6 @@ static struct board_info __initdata boar - .name = "96348GW-A", - .expected_cpu_id = 0x6348, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -@@ -530,7 +515,6 @@ static struct board_info __initdata boar - .name = "96358VW", - .expected_cpu_id = 0x6358, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -@@ -583,7 +567,6 @@ static struct board_info __initdata boar - .name = "96358VW2", - .expected_cpu_id = 0x6358, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, -@@ -633,7 +616,6 @@ static struct board_info __initdata boar - .name = "AGPF-S0", - .expected_cpu_id = 0x6358, - -- .has_uart0 = 1, - .has_enet0 = 1, - .has_enet1 = 1, - .has_pci = 1, diff --git a/target/linux/brcm63xx/patches-4.4/392-MIPS-BCM63XX-remove-leds-and-buttons.patch b/target/linux/brcm63xx/patches-4.4/392-MIPS-BCM63XX-remove-leds-and-buttons.patch deleted file mode 100644 index 1bbbf9144..000000000 --- a/target/linux/brcm63xx/patches-4.4/392-MIPS-BCM63XX-remove-leds-and-buttons.patch +++ /dev/null @@ -1,343 +0,0 @@ -From 997f53b174c63153335508c22dc4493e8e5808d6 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 22 Feb 2015 17:52:32 +0100 -Subject: [PATCH] MIPS: BCM63XX: remove leds and buttons - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 262 ----------------------------- - 1 file changed, 262 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -43,14 +43,6 @@ static struct board_info __initdata boar - .use_internal_phy = 1, - }, - -- .leds = { -- { -- .name = "CVG834G:green:power", -- .gpio = 37, -- .default_trigger= "default-on", -- }, -- }, -- - .ephy_reset_gpio = 36, - .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, - }; -@@ -72,35 +64,6 @@ static struct board_info __initdata boar - .use_fullspeed = 0, - .port_no = 0, - }, -- -- .leds = { -- { -- .name = "96328avng::ppp-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "96328avng::power", -- .gpio = 4, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "96328avng::power-fail", -- .gpio = 8, -- .active_low = 1, -- }, -- { -- .name = "96328avng::wps", -- .gpio = 9, -- .active_low = 1, -- }, -- { -- .name = "96328avng::ppp", -- .gpio = 11, -- .active_low = 1, -- }, -- }, - }; - #endif - -@@ -119,35 +82,6 @@ static struct board_info __initdata boar - }, - - .has_ohci0 = 1, -- -- .leds = { -- { -- .name = "adsl", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ses", -- .gpio = 5, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- } -- }, - }; - - static struct board_info __initdata board_96338w = { -@@ -159,35 +93,6 @@ static struct board_info __initdata boar - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -- -- .leds = { -- { -- .name = "adsl", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ses", -- .gpio = 5, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - #endif - -@@ -217,36 +122,6 @@ static struct board_info __initdata boar - .has_phy = 1, - .use_internal_phy = 1, - }, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_96348gw_10 = { -@@ -278,35 +153,6 @@ static struct board_info __initdata boar - .cs = 2, - .ext_irq = 2, - }, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_96348gw_11 = { -@@ -332,35 +178,6 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pccard = 1, - .has_ehci0 = 1, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_96348gw = { -@@ -390,35 +207,6 @@ static struct board_info __initdata boar - .ext_irq = 2, - .cs = 2, - }, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_FAST2404 = { -@@ -534,33 +322,6 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pccard = 1, - .has_ehci0 = 1, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 15, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 22, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 23, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 4, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 5, -- }, -- }, - }; - - static struct board_info __initdata board_96358vw2 = { -@@ -587,29 +348,6 @@ static struct board_info __initdata boar - .has_pccard = 1, - .has_ehci0 = 1, - .num_usbh_ports = 2, -- -- .leds = { -- { -- .name = "adsl", -- .gpio = 22, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 23, -- }, -- { -- .name = "power", -- .gpio = 5, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 4, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_AGPFS0 = { diff --git a/target/linux/brcm63xx/patches-4.4/400-bcm963xx_flashmap.patch b/target/linux/brcm63xx/patches-4.4/400-bcm963xx_flashmap.patch deleted file mode 100644 index c693ace36..000000000 --- a/target/linux/brcm63xx/patches-4.4/400-bcm963xx_flashmap.patch +++ /dev/null @@ -1,65 +0,0 @@ -From a4d005c91d403d9f3d0272db6cc46202c06ec774 Mon Sep 17 00:00:00 2001 -From: Axel Gembe -Date: Mon, 12 May 2008 18:54:09 +0200 -Subject: [PATCH] bcm963xx: flashmap support - -Signed-off-by: Axel Gembe ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 19 +---------------- - drivers/mtd/maps/bcm963xx-flash.c | 32 ++++++++++++++++++++++++---- - drivers/mtd/redboot.c | 13 +++++++++-- - 3 files changed, 38 insertions(+), 26 deletions(-) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -35,7 +35,7 @@ static struct mtd_partition mtd_partitio - } - }; - --static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL }; -+static const char *bcm63xx_part_types[] = { "bcm63xxpart", "RedBoot", NULL }; - - static struct physmap_flash_data flash_data = { - .width = 2, ---- a/drivers/mtd/redboot.c -+++ b/drivers/mtd/redboot.c -@@ -72,6 +72,7 @@ static int parse_redboot_partitions(stru - int nulllen = 0; - int numslots; - unsigned long offset; -+ unsigned long fis_origin = 0; - #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - static char nullstring[] = "unallocated"; - #endif -@@ -176,6 +177,16 @@ static int parse_redboot_partitions(stru - goto out; - } - -+ if (data && data->origin) { -+ fis_origin = data->origin; -+ } else { -+ for (i = 0; i < numslots; i++) { -+ if (!strncmp(buf[i].name, "RedBoot", 8)) { -+ fis_origin = (buf[i].flash_base & (master->size << 1) - 1); -+ } -+ } -+ } -+ - for (i = 0; i < numslots; i++) { - struct fis_list *new_fl, **prev; - -@@ -196,10 +207,10 @@ static int parse_redboot_partitions(stru - goto out; - } - new_fl->img = &buf[i]; -- if (data && data->origin) -- buf[i].flash_base -= data->origin; -- else -- buf[i].flash_base &= master->size-1; -+ if (fis_origin) -+ buf[i].flash_base -= fis_origin; -+ -+ buf[i].flash_base &= (master->size << 1) - 1; - - /* I'm sure the JFFS2 code has done me permanent damage. - * I now think the following is _normal_ diff --git a/target/linux/brcm63xx/patches-4.4/401-bcm963xx_real_rootfs_length.patch b/target/linux/brcm63xx/patches-4.4/401-bcm963xx_real_rootfs_length.patch deleted file mode 100644 index 92c264bd7..000000000 --- a/target/linux/brcm63xx/patches-4.4/401-bcm963xx_real_rootfs_length.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h -@@ -85,8 +85,10 @@ struct bcm_tag { - __u32 rootfs_crc; - /* 224-227: CRC32 of kernel partition */ - __u32 kernel_crc; -- /* 228-235: Unused at present */ -- char reserved1[8]; -+ /* 228-231: Image sequence number */ -+ char image_sequence[4]; -+ /* 222-235: Openwrt: real rootfs length */ -+ __u32 real_rootfs_length; - /* 236-239: CRC32 of header excluding last 20 bytes */ - __u32 header_crc; - /* 240-255: Unused at present */ ---- a/drivers/mtd/bcm63xxpart.c -+++ b/drivers/mtd/bcm63xxpart.c -@@ -110,7 +110,8 @@ static int bcm63xx_parse_cfe_partitions( - } else { - /* OpenWrt layout */ - rootfsaddr = kerneladdr + kernellen; -- rootfslen = spareaddr - rootfsaddr; -+ rootfslen = buf->real_rootfs_length; -+ spareaddr = rootfsaddr + rootfslen; - } - } else { - pr_warn("CFE boot tag CRC invalid (expected %08x, actual %08x)\n", diff --git a/target/linux/brcm63xx/patches-4.4/402_bcm63xx_enet_vlan_incoming_fixed.patch b/target/linux/brcm63xx/patches-4.4/402_bcm63xx_enet_vlan_incoming_fixed.patch deleted file mode 100644 index 8cb8099e9..000000000 --- a/target/linux/brcm63xx/patches-4.4/402_bcm63xx_enet_vlan_incoming_fixed.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1632,7 +1632,7 @@ static int compute_hw_mtu(struct bcm_ene - actual_mtu = mtu; - - /* add ethernet header + vlan tag size */ -- actual_mtu += VLAN_ETH_HLEN; -+ actual_mtu += VLAN_ETH_HLEN + VLAN_HLEN; - - if (actual_mtu < 64 || actual_mtu > BCMENET_MAX_MTU) - return -EINVAL; diff --git a/target/linux/brcm63xx/patches-4.4/403-6358-enet1-external-mii-clk.patch b/target/linux/brcm63xx/patches-4.4/403-6358-enet1-external-mii-clk.patch deleted file mode 100644 index 9227eb28a..000000000 --- a/target/linux/brcm63xx/patches-4.4/403-6358-enet1-external-mii-clk.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -98,6 +98,8 @@ void __init board_early_setup(const stru - if (BCMCPU_IS_6348()) - val |= GPIO_MODE_6348_G3_EXT_MII | - GPIO_MODE_6348_G0_EXT_MII; -+ else if (BCMCPU_IS_6358()) -+ val |= GPIO_MODE_6358_ENET1_MII_CLK_INV; - } - - bcm_gpio_writel(val, GPIO_MODE_REG); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -651,6 +651,8 @@ - #define GPIO_MODE_6358_EXTRA_SPI_SS (1 << 7) - #define GPIO_MODE_6358_SERIAL_LED (1 << 10) - #define GPIO_MODE_6358_UTOPIA (1 << 12) -+#define GPIO_MODE_6358_ENET1_MII_CLK_INV (1 << 30) -+#define GPIO_MODE_6358_ENET0_MII_CLK_INV (1 << 31) - - #define GPIO_MODE_6368_ANALOG_AFE_0 (1 << 0) - #define GPIO_MODE_6368_ANALOG_AFE_1 (1 << 1) diff --git a/target/linux/brcm63xx/patches-4.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch b/target/linux/brcm63xx/patches-4.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch deleted file mode 100644 index 5b754ad96..000000000 --- a/target/linux/brcm63xx/patches-4.4/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch +++ /dev/null @@ -1,169 +0,0 @@ -From b11218c750ab92cfab4408a0328f1b36ceec3f33 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 6 Jan 2012 12:24:18 +0100 -Subject: [PATCH 19/63] NET: bcm63xx_enet: move phy_(dis)connect into probe/remove - -Only connect/disconnect the phy during probe and remove, not during any -open/close. The phy seldom changes during the runtime, and disconnecting -the phy during close will prevent it from keeping any configuration over -a down/up cycle. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 84 +++++++++++++------------- - 1 files changed, 41 insertions(+), 43 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -870,10 +870,8 @@ static int bcm_enet_open(struct net_devi - struct bcm_enet_priv *priv; - struct sockaddr addr; - struct device *kdev; -- struct phy_device *phydev; - int i, ret; - unsigned int size; -- char phy_id[MII_BUS_ID_SIZE + 3]; - void *p; - u32 val; - -@@ -881,40 +879,10 @@ static int bcm_enet_open(struct net_devi - kdev = &priv->pdev->dev; - - if (priv->has_phy) { -- /* connect to PHY */ -- snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, -- priv->mii_bus->id, priv->phy_id); -- -- phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, -- PHY_INTERFACE_MODE_MII); -- -- if (IS_ERR(phydev)) { -- dev_err(kdev, "could not attach to PHY\n"); -- return PTR_ERR(phydev); -- } -- -- /* mask with MAC supported features */ -- phydev->supported &= (SUPPORTED_10baseT_Half | -- SUPPORTED_10baseT_Full | -- SUPPORTED_100baseT_Half | -- SUPPORTED_100baseT_Full | -- SUPPORTED_Autoneg | -- SUPPORTED_Pause | -- SUPPORTED_MII); -- phydev->advertising = phydev->supported; -- -- if (priv->pause_auto && priv->pause_rx && priv->pause_tx) -- phydev->advertising |= SUPPORTED_Pause; -- else -- phydev->advertising &= ~SUPPORTED_Pause; -- -- dev_info(kdev, "attached PHY at address %d [%s]\n", -- phydev->addr, phydev->drv->name); -- -+ /* Reset state */ - priv->old_link = 0; - priv->old_duplex = -1; - priv->old_pause = -1; -- priv->phydev = phydev; - } - - /* mask all interrupts and request them */ -@@ -924,7 +892,7 @@ static int bcm_enet_open(struct net_devi - - ret = request_irq(dev->irq, bcm_enet_isr_mac, 0, dev->name, dev); - if (ret) -- goto out_phy_disconnect; -+ return ret; - - ret = request_irq(priv->irq_rx, bcm_enet_isr_dma, 0, - dev->name, dev); -@@ -1128,9 +1096,6 @@ out_freeirq_rx: - out_freeirq: - free_irq(dev->irq, dev); - --out_phy_disconnect: -- phy_disconnect(priv->phydev); -- - return ret; - } - -@@ -1235,12 +1200,6 @@ static int bcm_enet_stop(struct net_devi - free_irq(priv->irq_rx, dev); - free_irq(dev->irq, dev); - -- /* release phy */ -- if (priv->has_phy) { -- phy_disconnect(priv->phydev); -- priv->phydev = NULL; -- } -- - return 0; - } - -@@ -1821,6 +1780,8 @@ static int bcm_enet_probe(struct platfor - - /* MII bus registration */ - if (priv->has_phy) { -+ struct phy_device *phydev; -+ char phy_id[MII_BUS_ID_SIZE + 3]; - - priv->mii_bus = mdiobus_alloc(); - if (!priv->mii_bus) { -@@ -1858,6 +1819,38 @@ static int bcm_enet_probe(struct platfor - dev_err(&pdev->dev, "unable to register mdio bus\n"); - goto out_free_mdio; - } -+ -+ /* connect to PHY */ -+ snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, -+ priv->mii_bus->id, priv->phy_id); -+ -+ phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, -+ PHY_INTERFACE_MODE_MII); -+ -+ if (IS_ERR(phydev)) { -+ dev_err(&pdev->dev, "could not attach to PHY\n"); -+ goto out_unregister_mdio; -+ } -+ -+ /* mask with MAC supported features */ -+ phydev->supported &= (SUPPORTED_10baseT_Half | -+ SUPPORTED_10baseT_Full | -+ SUPPORTED_100baseT_Half | -+ SUPPORTED_100baseT_Full | -+ SUPPORTED_Autoneg | -+ SUPPORTED_Pause | -+ SUPPORTED_MII); -+ phydev->advertising = phydev->supported; -+ -+ if (priv->pause_auto && priv->pause_rx && priv->pause_tx) -+ phydev->advertising |= SUPPORTED_Pause; -+ else -+ phydev->advertising &= ~SUPPORTED_Pause; -+ -+ dev_info(&pdev->dev, "attached PHY at address %d [%s]\n", -+ phydev->addr, phydev->drv->name); -+ -+ priv->phydev = phydev; - } else { - - /* run platform code to initialize PHY device */ -@@ -1903,6 +1896,9 @@ static int bcm_enet_probe(struct platfor - return 0; - - out_unregister_mdio: -+ if (priv->phydev) -+ phy_disconnect(priv->phydev); -+ - if (priv->mii_bus) - mdiobus_unregister(priv->mii_bus); - -@@ -1940,6 +1936,8 @@ static int bcm_enet_remove(struct platfo - enet_writel(priv, 0, ENET_MIISC_REG); - - if (priv->has_phy) { -+ phy_disconnect(priv->phydev); -+ priv->phydev = NULL; - mdiobus_unregister(priv->mii_bus); - mdiobus_free(priv->mii_bus); - } else { diff --git a/target/linux/brcm63xx/patches-4.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch b/target/linux/brcm63xx/patches-4.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch deleted file mode 100644 index 49b9c73e8..000000000 --- a/target/linux/brcm63xx/patches-4.4/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch +++ /dev/null @@ -1,53 +0,0 @@ -From d8237d704fc25eb2fc25ef4403608b78c6a6d4be Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 15 Jul 2012 20:08:57 +0200 -Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports - ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 13 +++++++++++++ - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 12 ++++++++++++ - 2 files changed, 25 insertions(+), 0 deletions(-) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -967,6 +967,19 @@ - #define ENETSW_PORTOV_FDX_MASK (1 << 1) - #define ENETSW_PORTOV_LINKUP_MASK (1 << 0) - -+/* Port RGMII control register */ -+#define ENETSW_RGMII_CTRL_REG(x) (0x60 + (x)) -+#define ENETSW_RGMII_CTRL_GMII_CLK_EN (1 << 7) -+#define ENETSW_RGMII_CTRL_MII_OVERRIDE_EN (1 << 6) -+#define ENETSW_RGMII_CTRL_MII_MODE_MASK (3 << 4) -+#define ENETSW_RGMII_CTRL_RGMII_MODE (0 << 4) -+#define ENETSW_RGMII_CTRL_MII_MODE (1 << 4) -+#define ENETSW_RGMII_CTRL_RVMII_MODE (2 << 4) -+#define ENETSW_RGMII_CTRL_TIMING_SEL_EN (1 << 0) -+ -+/* Port RGMII timing register */ -+#define ENETSW_RGMII_TIMING_REG(x) (0x68 + (x)) -+ - /* MDIO control register */ - #define ENETSW_MDIOC_REG (0xb0) - #define ENETSW_MDIOC_EXT_MASK (1 << 16) ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2212,6 +2212,18 @@ static int bcm_enetsw_open(struct net_de - priv->sw_port_link[i] = 0; - } - -+ /* enable external ports */ -+ for (i = ENETSW_RGMII_PORT0; i < priv->num_ports; i++) { -+ u8 rgmii_ctrl; -+ -+ if (!priv->used_ports[i].used) -+ continue; -+ -+ rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i)); -+ rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN; -+ enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i)); -+ } -+ - /* reset mib */ - val = enetsw_readb(priv, ENETSW_GMCR_REG); - val |= ENETSW_GMCR_RST_MIB_MASK; diff --git a/target/linux/brcm63xx/patches-4.4/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch b/target/linux/brcm63xx/patches-4.4/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch deleted file mode 100644 index 608ad8e39..000000000 --- a/target/linux/brcm63xx/patches-4.4/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch +++ /dev/null @@ -1,157 +0,0 @@ -From d135d94b3d1fe599d13e7198d5f502912d694c13 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 3 Jul 2011 15:00:38 +0200 -Subject: [PATCH 29/60] MIPS: BCM63XX: Register SPI flash if present - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 35 +++++++++++++++++++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 2 + - 2 files changed, 33 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -17,6 +17,9 @@ - #include - #include - #include -+#include -+#include -+#include - - #include - #include -@@ -66,6 +69,41 @@ void __init bcm63xx_flash_force_phys_bas - mtd_resources[0].end = end; - } - -+static struct spi_board_info bcm63xx_spi_flash_info[] = { -+ { -+ .bus_num = 0, -+ .chip_select = 0, -+ .mode = 0, -+ .max_speed_hz = 781000, -+ .modalias = "m25p80", -+ }, -+}; -+ -+static void bcm63xx_of_update_spi_flash_speed(struct device_node *np, -+ unsigned int new_hz) -+{ -+ struct property *max_hz; -+ __be32 *hz; -+ -+ max_hz = kzalloc(sizeof(*max_hz) + sizeof(*hz), GFP_KERNEL); -+ if (!max_hz) -+ return; -+ -+ max_hz->name = kstrdup("spi-max-frequency", GFP_KERNEL); -+ if (!max_hz->name) { -+ kfree(max_hz); -+ return; -+ } -+ -+ max_hz->value = max_hz + 1; -+ max_hz->length = sizeof(*hz); -+ -+ hz = max_hz->value; -+ *hz = cpu_to_be32(new_hz); -+ -+ of_update_property(np, max_hz); -+} -+ - static int __init bcm63xx_detect_flash_type(void) - { - u32 val; -@@ -73,9 +111,15 @@ static int __init bcm63xx_detect_flash_t - switch (bcm63xx_get_cpu_id()) { - case BCM6318_CPU_ID: - /* only support serial flash */ -+ bcm63xx_spi_flash_info[0].max_speed_hz = 62500000; - return BCM63XX_FLASH_TYPE_SERIAL; - case BCM6328_CPU_ID: - val = bcm_misc_readl(MISC_STRAPBUS_6328_REG); -+ if (val & STRAPBUS_6328_HSSPI_CLK_FAST) -+ bcm63xx_spi_flash_info[0].max_speed_hz = 33333334; -+ else -+ bcm63xx_spi_flash_info[0].max_speed_hz = 16666667; -+ - if (val & STRAPBUS_6328_BOOT_SEL_SERIAL) - return BCM63XX_FLASH_TYPE_SERIAL; - else -@@ -94,12 +138,20 @@ static int __init bcm63xx_detect_flash_t - return BCM63XX_FLASH_TYPE_SERIAL; - case BCM6362_CPU_ID: - val = bcm_misc_readl(MISC_STRAPBUS_6362_REG); -+ if (val & STRAPBUS_6362_HSSPI_CLK_FAST) -+ bcm63xx_spi_flash_info[0].max_speed_hz = 50000000; -+ else -+ bcm63xx_spi_flash_info[0].max_speed_hz = 20000000; -+ - if (val & STRAPBUS_6362_BOOT_SEL_SERIAL) - return BCM63XX_FLASH_TYPE_SERIAL; - else - return BCM63XX_FLASH_TYPE_NAND; - case BCM6368_CPU_ID: - val = bcm_gpio_readl(GPIO_STRAPBUS_REG); -+ if (val & STRAPBUS_6368_SPI_CLK_FAST) -+ bcm63xx_spi_flash_info[0].max_speed_hz = 20000000; -+ - switch (val & STRAPBUS_6368_BOOT_SEL_MASK) { - case STRAPBUS_6368_BOOT_SEL_NAND: - return BCM63XX_FLASH_TYPE_NAND; -@@ -110,6 +162,11 @@ static int __init bcm63xx_detect_flash_t - } - case BCM63268_CPU_ID: - val = bcm_misc_readl(MISC_STRAPBUS_63268_REG); -+ if (val & STRAPBUS_63268_HSSPI_CLK_FAST) -+ bcm63xx_spi_flash_info[0].max_speed_hz = 50000000; -+ else -+ bcm63xx_spi_flash_info[0].max_speed_hz = 20000000; -+ - if (val & STRAPBUS_63268_BOOT_SEL_SERIAL) - return BCM63XX_FLASH_TYPE_SERIAL; - else -@@ -176,6 +233,7 @@ void __init bcm63xx_flash_detect(void) - - int __init bcm63xx_flash_register(void) - { -+ struct device_node *np; - u32 val; - - switch (flash_type) { -@@ -195,8 +253,14 @@ int __init bcm63xx_flash_register(void) - - return platform_device_register(&mtd_dev); - case BCM63XX_FLASH_TYPE_SERIAL: -- pr_warn("unsupported serial flash detected\n"); -- return -ENODEV; -+ np = of_find_compatible_node(NULL, NULL, "jedec,spi-nor"); -+ if (np) { -+ bcm63xx_of_update_spi_flash_speed(np, bcm63xx_spi_flash_info[0].max_speed_hz); -+ of_node_put(np); -+ return 0; -+ } else { -+ return -ENODEV; -+ } - case BCM63XX_FLASH_TYPE_NAND: - pr_warn("unsupported NAND flash detected\n"); - return -ENODEV; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -708,6 +708,7 @@ - #define GPIO_STRAPBUS_REG 0x40 - #define STRAPBUS_6358_BOOT_SEL_PARALLEL (1 << 1) - #define STRAPBUS_6358_BOOT_SEL_SERIAL (0 << 1) -+#define STRAPBUS_6368_SPI_CLK_FAST (1 << 6) - #define STRAPBUS_6368_BOOT_SEL_MASK 0x3 - #define STRAPBUS_6368_BOOT_SEL_NAND 0 - #define STRAPBUS_6368_BOOT_SEL_SERIAL 1 -@@ -1564,6 +1565,7 @@ - #define IDDQ_CTRL_63268_USBH (1 << 4) - - #define MISC_STRAPBUS_6328_REG 0x240 -+#define STRAPBUS_6328_HSSPI_CLK_FAST (1 << 4) - #define STRAPBUS_6328_FCVO_SHIFT 7 - #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT) - #define STRAPBUS_6328_BOOT_SEL_SERIAL (1 << 28) diff --git a/target/linux/brcm63xx/patches-4.4/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch b/target/linux/brcm63xx/patches-4.4/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch deleted file mode 100644 index a0ad6e6ce..000000000 --- a/target/linux/brcm63xx/patches-4.4/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 8879e209111192c5e9752d7bd203cf7582693328 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 3 May 2012 14:40:03 +0200 -Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 9 ++++++++- - arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 10 ++++++++++ - 2 files changed, 18 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - #include "board_common.h" - -@@ -178,6 +179,7 @@ static struct of_device_id of_ids[] = { - int __init board_register_devices(void) - { - int usbh_ports = 0; -+ int i; - - #if CONFIG_OF - if (of_have_populated_dt()) { -@@ -245,6 +247,10 @@ int __init board_register_devices(void) - board.ephy_reset_gpio_flags); - } - -+ /* register any fixups */ -+ for (i = 0; i < board.has_caldata; i++) -+ pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset); -+ - return 0; - } - ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - - /* - * flash mapping -@@ -16,6 +17,11 @@ - #define BCM963XX_CFE_VERSION_OFFSET 0x570 - #define BCM963XX_NVRAM_OFFSET 0x580 - -+struct ath9k_caldata { -+ unsigned int slot; -+ u32 caldata_offset; -+}; -+ - /* - * board definition - */ -@@ -34,6 +40,10 @@ struct board_info { - unsigned int has_usbd:1; - unsigned int has_dsp:1; - unsigned int use_fallback_sprom:1; -+ unsigned int has_caldata:2; -+ -+ /* wifi calibration data config */ -+ struct ath9k_caldata caldata[2]; - - /* ethernet config */ - struct bcm63xx_enet_platform_data enet0; diff --git a/target/linux/brcm63xx/patches-4.4/415-MIPS-BCM63XX-export-the-attached-flash-type.patch b/target/linux/brcm63xx/patches-4.4/415-MIPS-BCM63XX-export-the-attached-flash-type.patch deleted file mode 100644 index 94c63c5e8..000000000 --- a/target/linux/brcm63xx/patches-4.4/415-MIPS-BCM63XX-export-the-attached-flash-type.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 066f1e37742ee434496d32a41a9284458de96742 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 13 Jan 2014 12:12:30 +0100 -Subject: [PATCH] MIPS: BCM63XX: export the attached flash type - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 5 +++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 ++ - 2 files changed, 7 insertions(+) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -270,3 +270,8 @@ int __init bcm63xx_flash_register(void) - return -ENODEV; - } - } -+ -+int bcm63xx_flash_get_type(void) -+{ -+ return flash_type; -+} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -@@ -13,4 +13,6 @@ void bcm63xx_flash_force_phys_base_addre - - int __init bcm63xx_flash_register(void); - -+int bcm63xx_flash_get_type(void); -+ - #endif /* __BCM63XX_FLASH_H */ diff --git a/target/linux/brcm63xx/patches-4.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch b/target/linux/brcm63xx/patches-4.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch deleted file mode 100644 index 0f6706a6b..000000000 --- a/target/linux/brcm63xx/patches-4.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch +++ /dev/null @@ -1,237 +0,0 @@ -From bbebbf735a02b6d044ed928978ab4bd5f1833364 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 3 May 2012 14:36:11 +0200 -Subject: [PATCH 61/72] BCM63XX: add a fixup for ath9k devices - ---- - arch/mips/bcm63xx/Makefile | 3 +- - arch/mips/bcm63xx/pci-ath9k-fixup.c | 190 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/pci_ath9k_fixup.h | 7 + - 3 files changed, 199 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/bcm63xx/pci-ath9k-fixup.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -2,7 +2,7 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ - dev-pcmcia.o dev-rng.o \ - dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \ -- usb-common.o sprom.o -+ pci-ath9k-fixup.o usb-common.o sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- /dev/null -+++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -0,0 +1,200 @@ -+/* -+ * Broadcom BCM63XX Ath9k EEPROM fixup helper. -+ * -+ * Copytight (C) 2012 Jonas Gorski -+ * -+ * Based on -+ * -+ * Atheros AP94 reference board PCI initialization -+ * -+ * Copyright (C) 2009-2010 Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define bcm_hsspi_writel(v, o) bcm_rset_writel(RSET_HSSPI, (v), (o)) -+ -+struct ath9k_fixup { -+ unsigned slot; -+ u8 mac[ETH_ALEN]; -+ struct ath9k_platform_data pdata; -+}; -+ -+static int ath9k_num_fixups; -+static struct ath9k_fixup ath9k_fixups[2] = { -+ { -+ .slot = 255, -+ .pdata = { -+ .led_pin = -1, -+ }, -+ }, -+ { -+ .slot = 255, -+ .pdata = { -+ .led_pin = -1, -+ }, -+ }, -+}; -+ -+static u16 *bcm63xx_read_eeprom(u16 *eeprom, u32 offset) -+{ -+ u32 addr; -+ -+ if (BCMCPU_IS_6328()) { -+ addr = 0x18000000; -+ } else { -+ addr = bcm_mpi_readl(MPI_CSBASE_REG(0)); -+ addr &= MPI_CSBASE_BASE_MASK; -+ } -+ -+ switch (bcm63xx_flash_get_type()) { -+ case BCM63XX_FLASH_TYPE_PARALLEL: -+ memcpy(eeprom, (void *)KSEG1ADDR(addr + offset), ATH9K_PLAT_EEP_MAX_WORDS * sizeof(u16)); -+ return eeprom; -+ case BCM63XX_FLASH_TYPE_SERIAL: -+ /* the first megabyte is memory mapped */ -+ if (offset < 0x100000) { -+ memcpy(eeprom, (void *)KSEG1ADDR(addr + offset), ATH9K_PLAT_EEP_MAX_WORDS * sizeof(u16)); -+ return eeprom; -+ } -+ -+ if (BCMCPU_IS_6328()) { -+ /* we can change the memory mapped megabyte */ -+ bcm_hsspi_writel(offset & 0xf00000, 0x18); -+ memcpy(eeprom, (void *)KSEG1ADDR(addr + (offset & 0xfffff)), ATH9K_PLAT_EEP_MAX_WORDS * sizeof(u16)); -+ bcm_hsspi_writel(0, 0x18); -+ return eeprom; -+ } -+ /* can't do anything here without talking to the SPI controller. */ -+ case BCM63XX_FLASH_TYPE_NAND: -+ default: -+ return NULL; -+ } -+} -+ -+static void ath9k_pci_fixup(struct pci_dev *dev) -+{ -+ void __iomem *mem; -+ struct ath9k_platform_data *pdata = NULL; -+ struct pci_dev *bridge = pci_upstream_bridge(dev); -+ u16 *cal_data = NULL; -+ u16 cmd; -+ u32 bar0; -+ u32 val; -+ unsigned i; -+ -+ for (i = 0; i < ath9k_num_fixups; i++) { -+ if (ath9k_fixups[i].slot != PCI_SLOT(dev->devfn)) -+ continue; -+ -+ cal_data = ath9k_fixups[i].pdata.eeprom_data; -+ pdata = &ath9k_fixups[i].pdata; -+ break; -+ } -+ -+ if (cal_data == NULL) -+ return; -+ -+ if (*cal_data != 0xa55a) { -+ pr_err("pci %s: invalid calibration data\n", pci_name(dev)); -+ return; -+ } -+ -+ pr_info("pci %s: fixup device configuration\n", pci_name(dev)); -+ -+ switch (bcm63xx_get_cpu_id()) { -+ case BCM6328_CPU_ID: -+ val = BCM_PCIE_MEM_BASE_PA_6328; -+ break; -+ case BCM6348_CPU_ID: -+ case BCM6358_CPU_ID: -+ case BCM6368_CPU_ID: -+ val = BCM_PCI_MEM_BASE_PA; -+ break; -+ default: -+ BUG(); -+ } -+ -+ mem = ioremap(val, 0x10000); -+ if (!mem) { -+ pr_err("pci %s: ioremap error\n", pci_name(dev)); -+ return; -+ } -+ -+ if (bridge) -+ pci_enable_device(bridge); -+ -+ pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0); -+ pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0); -+ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, val); -+ -+ pci_read_config_word(dev, PCI_COMMAND, &cmd); -+ cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; -+ pci_write_config_word(dev, PCI_COMMAND, cmd); -+ -+ /* set offset to first reg address */ -+ cal_data += 3; -+ while(*cal_data != 0xffff) { -+ u32 reg; -+ reg = *cal_data++; -+ val = *cal_data++; -+ val |= (*cal_data++) << 16; -+ -+ writel(val, mem + reg); -+ udelay(100); -+ } -+ -+ pci_read_config_dword(dev, PCI_VENDOR_ID, &val); -+ dev->vendor = val & 0xffff; -+ dev->device = (val >> 16) & 0xffff; -+ -+ pci_read_config_dword(dev, PCI_CLASS_REVISION, &val); -+ dev->revision = val & 0xff; -+ dev->class = val >> 8; /* upper 3 bytes */ -+ -+ pci_read_config_word(dev, PCI_COMMAND, &cmd); -+ cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); -+ pci_write_config_word(dev, PCI_COMMAND, cmd); -+ -+ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0); -+ -+ if (bridge) -+ pci_disable_device(bridge); -+ -+ iounmap(mem); -+ -+ dev->dev.platform_data = pdata; -+} -+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); -+ -+void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset) -+{ -+ if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) -+ return; -+ -+ ath9k_fixups[ath9k_num_fixups].slot = slot; -+ -+ if (!bcm63xx_read_eeprom(ath9k_fixups[ath9k_num_fixups].pdata.eeprom_data, offset)) -+ return; -+ -+ if (bcm63xx_nvram_get_mac_address(ath9k_fixups[ath9k_num_fixups].mac)) -+ return; -+ -+ ath9k_fixups[ath9k_num_fixups].pdata.macaddr = ath9k_fixups[ath9k_num_fixups].mac; -+ ath9k_num_fixups++; -+} ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -@@ -0,0 +1,7 @@ -+#ifndef _PCI_ATH9K_FIXUP -+#define _PCI_ATH9K_FIXUP -+ -+ -+void pci_enable_ath9k_fixup(unsigned slot, u32 offset) __init; -+ -+#endif /* _PCI_ATH9K_FIXUP */ diff --git a/target/linux/brcm63xx/patches-4.4/420-BCM63XX-add-endian-check-for-ath9k.patch b/target/linux/brcm63xx/patches-4.4/420-BCM63XX-add-endian-check-for-ath9k.patch deleted file mode 100644 index 8921f2d9b..000000000 --- a/target/linux/brcm63xx/patches-4.4/420-BCM63XX-add-endian-check-for-ath9k.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -+++ b/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -@@ -2,6 +2,7 @@ - #define _PCI_ATH9K_FIXUP - - --void pci_enable_ath9k_fixup(unsigned slot, u32 offset) __init; -+void pci_enable_ath9k_fixup(unsigned slot, u32 offset, -+ unsigned endian_check) __init; - - #endif /* _PCI_ATH9K_FIXUP */ ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -20,6 +20,7 @@ - struct ath9k_caldata { - unsigned int slot; - u32 caldata_offset; -+ unsigned int endian_check:1; - }; - - /* ---- a/arch/mips/bcm63xx/pci-ath9k-fixup.c -+++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -182,12 +182,14 @@ static void ath9k_pci_fixup(struct pci_d - } - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); - --void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset) -+void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset, -+ unsigned endian_check) - { - if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) - return; - - ath9k_fixups[ath9k_num_fixups].slot = slot; -+ ath9k_fixups[ath9k_num_fixups].pdata.endian_check = endian_check; - - if (!bcm63xx_read_eeprom(ath9k_fixups[ath9k_num_fixups].pdata.eeprom_data, offset)) - return; ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -249,7 +249,8 @@ int __init board_register_devices(void) - - /* register any fixups */ - for (i = 0; i < board.has_caldata; i++) -- pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset); -+ pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset, -+ board.caldata[i].endian_check); - - return 0; - } diff --git a/target/linux/brcm63xx/patches-4.4/421-BCM63XX-add-led-pin-for-ath9k.patch b/target/linux/brcm63xx/patches-4.4/421-BCM63XX-add-led-pin-for-ath9k.patch deleted file mode 100644 index 3ccf6dcdf..000000000 --- a/target/linux/brcm63xx/patches-4.4/421-BCM63XX-add-led-pin-for-ath9k.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -250,7 +250,7 @@ int __init board_register_devices(void) - /* register any fixups */ - for (i = 0; i < board.has_caldata; i++) - pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset, -- board.caldata[i].endian_check); -+ board.caldata[i].endian_check, board.caldata[i].led_pin, board.caldata[i].led_active_high); - - return 0; - } ---- a/arch/mips/bcm63xx/pci-ath9k-fixup.c -+++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -183,13 +183,15 @@ static void ath9k_pci_fixup(struct pci_d - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); - - void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset, -- unsigned endian_check) -+ unsigned endian_check, int led_pin, bool led_active_high) - { - if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) - return; - - ath9k_fixups[ath9k_num_fixups].slot = slot; - ath9k_fixups[ath9k_num_fixups].pdata.endian_check = endian_check; -+ ath9k_fixups[ath9k_num_fixups].pdata.led_pin = led_pin; -+ ath9k_fixups[ath9k_num_fixups].pdata.led_active_high = led_active_high; - - if (!bcm63xx_read_eeprom(ath9k_fixups[ath9k_num_fixups].pdata.eeprom_data, offset)) - return; ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -21,6 +21,8 @@ struct ath9k_caldata { - unsigned int slot; - u32 caldata_offset; - unsigned int endian_check:1; -+ int led_pin; -+ bool led_active_high; - }; - - /* ---- a/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -+++ b/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -@@ -3,6 +3,6 @@ - - - void pci_enable_ath9k_fixup(unsigned slot, u32 offset, -- unsigned endian_check) __init; -+ unsigned endian_check, int led_pin, bool led_active_high) __init; - - #endif /* _PCI_ATH9K_FIXUP */ diff --git a/target/linux/brcm63xx/patches-4.4/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch b/target/linux/brcm63xx/patches-4.4/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch deleted file mode 100644 index d021b3690..000000000 --- a/target/linux/brcm63xx/patches-4.4/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch +++ /dev/null @@ -1,185 +0,0 @@ -From 5ed5b5e9614fa5b02da699ab565af76c7e63d64d Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 7 Jan 2013 17:45:39 +0100 -Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices - ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 17 ++++- - arch/mips/bcm63xx/dev-flash.c | 2 +- - arch/mips/bcm63xx/pci-rt2x00-fixup.c | 71 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 +- - .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 9 ++- - .../include/asm/mach-bcm63xx/pci_rt2x00_fixup.h | 9 +++ - 7 files changed, 104 insertions(+), 8 deletions(-) - create mode 100644 arch/mips/bcm63xx/pci-rt2x00-fixup.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -2,7 +2,7 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o - setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ - dev-pcmcia.o dev-rng.o \ - dev-wdt.o dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o \ -- pci-ath9k-fixup.o usb-common.o sprom.o -+ pci-ath9k-fixup.o pci-rt2x00-fixup.o usb-common.o sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - - #include "board_common.h" - -@@ -248,9 +249,19 @@ int __init board_register_devices(void) - } - - /* register any fixups */ -- for (i = 0; i < board.has_caldata; i++) -- pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset, -- board.caldata[i].endian_check, board.caldata[i].led_pin, board.caldata[i].led_active_high); -+ for (i = 0; i < board.has_caldata; i++) { -+ switch (board.caldata[i].vendor) { -+ case PCI_VENDOR_ID_ATHEROS: -+ pci_enable_ath9k_fixup(board.caldata[i].slot, -+ board.caldata[i].caldata_offset, board.caldata[i].endian_check, -+ board.caldata[i].led_pin, board.caldata[i].led_active_high); -+ break; -+ case PCI_VENDOR_ID_RALINK: -+ pci_enable_rt2x00_fixup(board.caldata[i].slot, -+ board.caldata[i].eeprom); -+ break; -+ } -+ } - - return 0; - } ---- /dev/null -+++ b/arch/mips/bcm63xx/pci-rt2x00-fixup.c -@@ -0,0 +1,72 @@ -+/* -+ * Broadcom BCM63XX RT2x00 EEPROM fixup helper. -+ * -+ * Copyright (C) 2012 Álvaro Fernández Rojas -+ * -+ * Based on -+ * -+ * Broadcom BCM63XX Ath9k EEPROM fixup helper. -+ * -+ * Copyright (C) 2012 Jonas Gorski -+ * -+ * 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 -+ -+struct rt2x00_fixup { -+ unsigned slot; -+ u8 mac[ETH_ALEN]; -+ struct rt2x00_platform_data pdata; -+}; -+ -+static int rt2x00_num_fixups; -+static struct rt2x00_fixup rt2x00_fixups[2] = { -+ { -+ .slot = 255, -+ }, -+ { -+ .slot = 255, -+ }, -+}; -+ -+static void rt2x00_pci_fixup(struct pci_dev *dev) -+{ -+ unsigned i; -+ struct rt2x00_platform_data *pdata = NULL; -+ -+ for (i = 0; i < rt2x00_num_fixups; i++) { -+ if (rt2x00_fixups[i].slot != PCI_SLOT(dev->devfn)) -+ continue; -+ -+ pdata = &rt2x00_fixups[i].pdata; -+ break; -+ } -+ -+ dev->dev.platform_data = pdata; -+} -+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_RALINK, PCI_ANY_ID, rt2x00_pci_fixup); -+ -+void __init pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) -+{ -+ if (rt2x00_num_fixups >= ARRAY_SIZE(rt2x00_fixups)) -+ return; -+ -+ rt2x00_fixups[rt2x00_num_fixups].slot = slot; -+ rt2x00_fixups[rt2x00_num_fixups].pdata.eeprom_file_name = kstrdup(eeprom, GFP_KERNEL); -+ -+ if (bcm63xx_nvram_get_mac_address(rt2x00_fixups[rt2x00_num_fixups].mac)) -+ return; -+ -+ rt2x00_fixups[rt2x00_num_fixups].pdata.mac_address = rt2x00_fixups[rt2x00_num_fixups].mac; -+ rt2x00_num_fixups++; -+} -+ ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - /* - * flash mapping -@@ -17,12 +18,16 @@ - #define BCM963XX_CFE_VERSION_OFFSET 0x570 - #define BCM963XX_NVRAM_OFFSET 0x580 - --struct ath9k_caldata { -+struct bcm63xx_caldata { -+ unsigned int vendor; - unsigned int slot; - u32 caldata_offset; -+ /* Atheros */ - unsigned int endian_check:1; - int led_pin; - bool led_active_high; -+ /* Ralink */ -+ char* eeprom; - }; - - /* -@@ -46,7 +51,7 @@ struct board_info { - unsigned int has_caldata:2; - - /* wifi calibration data config */ -- struct ath9k_caldata caldata[2]; -+ struct bcm63xx_caldata caldata[2]; - - /* ethernet config */ - struct bcm63xx_enet_platform_data enet0; ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h -@@ -0,0 +1,9 @@ -+#ifndef _PCI_RT2X00_FIXUP -+#define _PCI_RT2X00_FIXUP -+ -+#define PCI_VENDOR_ID_RALINK 0x1814 -+ -+void pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) __init; -+ -+#endif /* _PCI_RT2X00_FIXUP */ -+ diff --git a/target/linux/brcm63xx/patches-4.4/423-bcm63xx_enet_add_b53_support.patch b/target/linux/brcm63xx/patches-4.4/423-bcm63xx_enet_add_b53_support.patch deleted file mode 100644 index 499928f70..000000000 --- a/target/linux/brcm63xx/patches-4.4/423-bcm63xx_enet_add_b53_support.patch +++ /dev/null @@ -1,169 +0,0 @@ ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h -@@ -332,6 +332,9 @@ struct bcm_enet_priv { - struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT]; - int sw_port_link[ENETSW_MAX_PORT]; - -+ /* platform device for associated switch */ -+ struct platform_device *b53_device; -+ - /* used to poll switch port state */ - struct timer_list swphy_poll; - spinlock_t enetsw_mdio_lock; ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - - #include - #include "bcm63xx_enet.h" -@@ -1957,7 +1958,8 @@ static int bcm_enet_remove(struct platfo - return 0; - } - --struct platform_driver bcm63xx_enet_driver = { -+ -+static struct platform_driver bcm63xx_enet_driver = { - .probe = bcm_enet_probe, - .remove = bcm_enet_remove, - .driver = { -@@ -1966,6 +1968,42 @@ struct platform_driver bcm63xx_enet_driv - }, - }; - -+struct b53_platform_data bcm63xx_b53_pdata = { -+ .chip_id = 0x6300, -+ .big_endian = 1, -+}; -+ -+struct platform_device bcm63xx_b53_dev = { -+ .name = "b53-switch", -+ .id = -1, -+ .dev = { -+ .platform_data = &bcm63xx_b53_pdata, -+ }, -+}; -+ -+static int bcmenet_switch_register(struct bcm_enet_priv *priv, u16 port_mask) -+{ -+ int ret; -+ -+ bcm63xx_b53_pdata.regs = priv->base; -+ bcm63xx_b53_pdata.enabled_ports = port_mask; -+ bcm63xx_b53_pdata.alias = priv->net_dev->name; -+ -+ ret = platform_device_register(&bcm63xx_b53_dev); -+ if (!ret) -+ priv->b53_device = &bcm63xx_b53_dev; -+ -+ return ret; -+} -+ -+static void bcmenet_switch_unregister(struct bcm_enet_priv *priv) -+{ -+ if (priv->b53_device) -+ platform_device_unregister(&bcm63xx_b53_dev); -+ -+ priv->b53_device = NULL; -+} -+ - /* - * switch mii access callbacks - */ -@@ -2224,29 +2262,6 @@ static int bcm_enetsw_open(struct net_de - enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i)); - } - -- /* reset mib */ -- val = enetsw_readb(priv, ENETSW_GMCR_REG); -- val |= ENETSW_GMCR_RST_MIB_MASK; -- enetsw_writeb(priv, val, ENETSW_GMCR_REG); -- mdelay(1); -- val &= ~ENETSW_GMCR_RST_MIB_MASK; -- enetsw_writeb(priv, val, ENETSW_GMCR_REG); -- mdelay(1); -- -- /* force CPU port state */ -- val = enetsw_readb(priv, ENETSW_IMPOV_REG); -- val |= ENETSW_IMPOV_FORCE_MASK | ENETSW_IMPOV_LINKUP_MASK; -- enetsw_writeb(priv, val, ENETSW_IMPOV_REG); -- -- /* enable switch forward engine */ -- val = enetsw_readb(priv, ENETSW_SWMODE_REG); -- val |= ENETSW_SWMODE_FWD_EN_MASK; -- enetsw_writeb(priv, val, ENETSW_SWMODE_REG); -- -- /* enable jumbo on all ports */ -- enetsw_writel(priv, 0x1ff, ENETSW_JMBCTL_PORT_REG); -- enetsw_writew(priv, 9728, ENETSW_JMBCTL_MAXSIZE_REG); -- - /* initialize flow control buffer allocation */ - enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0, - ENETDMA_BUFALLOC_REG(priv->rx_chan)); -@@ -2705,6 +2720,9 @@ static int bcm_enetsw_probe(struct platf - struct bcm63xx_enetsw_platform_data *pd; - struct resource *res_mem; - int ret, irq_rx, irq_tx; -+ unsigned i, num_ports = 0; -+ u16 port_mask = BIT(8); -+ u8 val; - - if (!bcm_enet_shared_base[0]) - return -EPROBE_DEFER; -@@ -2787,6 +2805,43 @@ static int bcm_enetsw_probe(struct platf - priv->pdev = pdev; - priv->net_dev = dev; - -+ /* reset mib */ -+ val = enetsw_readb(priv, ENETSW_GMCR_REG); -+ val |= ENETSW_GMCR_RST_MIB_MASK; -+ enetsw_writeb(priv, val, ENETSW_GMCR_REG); -+ mdelay(1); -+ val &= ~ENETSW_GMCR_RST_MIB_MASK; -+ enetsw_writeb(priv, val, ENETSW_GMCR_REG); -+ mdelay(1); -+ -+ /* force CPU port state */ -+ val = enetsw_readb(priv, ENETSW_IMPOV_REG); -+ val |= ENETSW_IMPOV_FORCE_MASK | ENETSW_IMPOV_LINKUP_MASK; -+ enetsw_writeb(priv, val, ENETSW_IMPOV_REG); -+ -+ /* enable switch forward engine */ -+ val = enetsw_readb(priv, ENETSW_SWMODE_REG); -+ val |= ENETSW_SWMODE_FWD_EN_MASK; -+ enetsw_writeb(priv, val, ENETSW_SWMODE_REG); -+ -+ /* enable jumbo on all ports */ -+ enetsw_writel(priv, 0x1ff, ENETSW_JMBCTL_PORT_REG); -+ enetsw_writew(priv, 9728, ENETSW_JMBCTL_MAXSIZE_REG); -+ -+ for (i = 0; i < priv->num_ports; i++) { -+ struct bcm63xx_enetsw_port *port = &priv->used_ports[i]; -+ -+ if (!port->used) -+ continue; -+ -+ num_ports++; -+ port_mask |= BIT(i); -+ } -+ -+ /* only register if there is more than one external port */ -+ if (num_ports > 1) -+ bcmenet_switch_register(priv, port_mask); -+ - return 0; - - out_disable_clk: -@@ -2808,6 +2863,9 @@ static int bcm_enetsw_remove(struct plat - priv = netdev_priv(dev); - unregister_netdev(dev); - -+ /* remove switch */ -+ bcmenet_switch_unregister(priv); -+ - clk_disable_unprepare(priv->mac_clk); - - free_netdev(dev); diff --git a/target/linux/brcm63xx/patches-4.4/424-bcm63xx_enet_no_request_mem_region.patch b/target/linux/brcm63xx/patches-4.4/424-bcm63xx_enet_no_request_mem_region.patch deleted file mode 100644 index 700fb0114..000000000 --- a/target/linux/brcm63xx/patches-4.4/424-bcm63xx_enet_no_request_mem_region.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2764,9 +2764,9 @@ static int bcm_enetsw_probe(struct platf - if (ret) - goto out; - -- priv->base = devm_ioremap_resource(&pdev->dev, res_mem); -- if (IS_ERR(priv->base)) { -- ret = PTR_ERR(priv->base); -+ priv->base = devm_ioremap(&pdev->dev, res_mem->start, resource_size(res_mem)); -+ if (priv->base == NULL) { -+ ret = -ENOMEM; - goto out; - } - diff --git a/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch b/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch deleted file mode 100644 index ea73690d8..000000000 --- a/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch +++ /dev/null @@ -1,324 +0,0 @@ ---- a/drivers/mtd/bcm63xxpart.c -+++ b/drivers/mtd/bcm63xxpart.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -43,46 +44,35 @@ - - #define BCM63XX_CFE_MAGIC_OFFSET 0x4e0 - --static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, -- struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) -+static bool node_has_compatible(struct device_node *pp) -+{ -+ return of_get_property(pp, "compatible", NULL); -+} -+ -+static int parse_bcmtag(struct mtd_info *master, struct mtd_partition *pparts, -+ int next_part, size_t offset, size_t size) - { -- /* CFE, NVRAM and global Linux are always present */ -- int nrparts = 3, curpart = 0; - struct bcm_tag *buf; -- struct mtd_partition *parts; -+ u32 computed_crc; - int ret; - size_t retlen; -- unsigned int rootfsaddr, kerneladdr, spareaddr; -- unsigned int rootfslen, kernellen, sparelen, totallen; -- unsigned int cfelen, nvramlen; -- unsigned int cfe_erasesize; -- int i; -- u32 computed_crc; -+ unsigned int rootfsaddr, kerneladdr; -+ unsigned int rootfslen, kernellen, totallen; - bool rootfs_first = false; -- -- if (!bcm63xx_is_cfe_present()) -- return -EINVAL; -- -- cfe_erasesize = max_t(uint32_t, master->erasesize, -- BCM63XX_CFE_BLOCK_SIZE); -- -- cfelen = cfe_erasesize; -- nvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K; -- nvramlen = roundup(nvramlen, cfe_erasesize); -+ int curr_part = next_part; - - /* Allocate memory for buffer */ -- buf = vmalloc(sizeof(struct bcm_tag)); -+ buf = vmalloc(sizeof(*buf)); - if (!buf) - return -ENOMEM; - - /* Get the tag */ -- ret = mtd_read(master, cfelen, sizeof(struct bcm_tag), &retlen, -+ ret = mtd_read(master, offset, sizeof(*buf), &retlen, - (void *)buf); - -- if (retlen != sizeof(struct bcm_tag)) { -+ if (retlen != sizeof(*buf)) { - vfree(buf); -- return -EIO; -+ return 0; - } - - computed_crc = crc32_le(IMAGETAG_CRC_START, (u8 *)buf, -@@ -101,7 +91,6 @@ static int bcm63xx_parse_cfe_partitions( - - kerneladdr = kerneladdr - BCM63XX_EXTENDED_SIZE; - rootfsaddr = rootfsaddr - BCM63XX_EXTENDED_SIZE; -- spareaddr = roundup(totallen, master->erasesize) + cfelen; - - if (rootfsaddr < kerneladdr) { - /* default Broadcom layout */ -@@ -110,8 +99,8 @@ static int bcm63xx_parse_cfe_partitions( - } else { - /* OpenWrt layout */ - rootfsaddr = kerneladdr + kernellen; -- rootfslen = buf->real_rootfs_length; -- spareaddr = rootfsaddr + rootfslen; -+ rootfslen = size - kernellen - -+ sizeof(*buf); - } - } else { - pr_warn("CFE boot tag CRC invalid (expected %08x, actual %08x)\n", -@@ -119,23 +108,145 @@ static int bcm63xx_parse_cfe_partitions( - kernellen = 0; - rootfslen = 0; - rootfsaddr = 0; -- spareaddr = cfelen; - } -- sparelen = master->size - spareaddr - nvramlen; - -- /* Determine number of partitions */ -- if (rootfslen > 0) -- nrparts++; -+ if (kernellen > 0) { -+ int kernelpart = curr_part; -+ -+ if (rootfslen > 0 && rootfs_first) -+ kernelpart++; -+ pparts[kernelpart].name = "kernel"; -+ pparts[kernelpart].offset = kerneladdr; -+ pparts[kernelpart].size = kernellen; -+ curr_part++; -+ } -+ -+ if (rootfslen > 0) { -+ int rootfspart = curr_part; -+ -+ if (kernellen > 0 && rootfs_first) -+ rootfspart--; -+ pparts[rootfspart].name = "rootfs"; -+ pparts[rootfspart].offset = rootfsaddr; -+ pparts[rootfspart].size = rootfslen; -+ -+ curr_part++; -+ } -+ -+ vfree(buf); -+ -+ return curr_part - next_part; -+} -+ -+ -+static int bcm63xx_parse_cfe_partitions_of(struct mtd_info *master, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct device_node *dp, *mtd_node = mtd_get_of_node(master); -+ struct device_node *pp; -+ int i, nr_parts = 0; -+ const char *partname; -+ int len; -+ -+ dp = of_get_child_by_name(mtd_node, "partitions"); -+ if (!dp) -+ dp = mtd_node; -+ -+ for_each_child_of_node(dp, pp) { -+ if (node_has_compatible(pp) && dp == mtd_node) -+ continue; -+ -+ if (!of_get_property(pp, "reg", &len)) -+ continue; -+ -+ partname = of_get_property(pp, "label", &len); -+ if (!partname) -+ partname = of_get_property(pp, "name", &len); -+ -+ if (!strcmp(partname, "linux") || -+ of_device_is_compatible(pp, "brcm,bcm963xx-imagetag")) -+ nr_parts += 2; -+ -+ nr_parts++; -+ } -+ -+ *pparts = kzalloc(nr_parts * sizeof(**pparts), GFP_KERNEL); -+ if (!*pparts) -+ return -ENOMEM; -+ -+ i = 0; -+ for_each_child_of_node(dp, pp) { -+ const __be32 *reg; -+ int a_cells, s_cells; -+ size_t size, offset; -+ -+ if (node_has_compatible(pp) && dp == mtd_node) -+ continue; -+ -+ reg = of_get_property(pp, "reg", &len); -+ if (!reg) -+ continue; -+ -+ a_cells = of_n_addr_cells(pp); -+ s_cells = of_n_size_cells(pp); -+ offset = of_read_number(reg, a_cells); -+ size = of_read_number(reg + a_cells, s_cells); -+ partname = of_get_property(pp, "label", &len); -+ if (!partname) -+ partname = of_get_property(pp, "name", &len); -+ -+ if (!strcmp(partname, "linux") || -+ of_device_is_compatible(pp, "brcm,bcm963xx-imagetag")) -+ i += parse_bcmtag(master, *pparts, i, offset, size); -+ -+ if (of_get_property(pp, "read-only", &len)) -+ (*pparts)[i].mask_flags |= MTD_WRITEABLE; -+ -+ if (of_get_property(pp, "lock", &len)) -+ (*pparts)[i].mask_flags |= MTD_POWERUP_LOCK; -+ -+ (*pparts)[i].offset = offset; -+ (*pparts)[i].size = size; -+ (*pparts)[i].name = partname; -+ -+ i++; -+ } -+ -+ return i; -+} -+ -+static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ /* CFE, NVRAM and global Linux are always present */ -+ int nrparts = 5, curpart = 0; -+ struct mtd_partition *parts; -+ unsigned int nvramaddr; -+ unsigned int cfelen, nvramlen; -+ unsigned int cfe_erasesize; -+ unsigned int imageaddr, imagelen; -+ int i; -+ -+ if (!bcm63xx_is_cfe_present()) -+ return -EINVAL; -+ -+ cfe_erasesize = max_t(uint32_t, master->erasesize, -+ BCM63XX_CFE_BLOCK_SIZE); -+ -+ cfelen = cfe_erasesize; -+ nvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K; -+ nvramlen = roundup(nvramlen, cfe_erasesize); -+ nvramaddr = master->size - nvramlen; - -- if (kernellen > 0) -- nrparts++; -+ imageaddr = cfelen; -+ imagelen = nvramaddr - imageaddr; - - /* Ask kernel for more memory */ - parts = kzalloc(sizeof(*parts) * nrparts + 10 * nrparts, GFP_KERNEL); -- if (!parts) { -- vfree(buf); -+ if (!parts) - return -ENOMEM; -- } - - /* Start building partition list */ - parts[curpart].name = "CFE"; -@@ -143,29 +254,7 @@ static int bcm63xx_parse_cfe_partitions( - parts[curpart].size = cfelen; - curpart++; - -- if (kernellen > 0) { -- int kernelpart = curpart; -- -- if (rootfslen > 0 && rootfs_first) -- kernelpart++; -- parts[kernelpart].name = "kernel"; -- parts[kernelpart].offset = kerneladdr; -- parts[kernelpart].size = kernellen; -- curpart++; -- } -- -- if (rootfslen > 0) { -- int rootfspart = curpart; -- -- if (kernellen > 0 && rootfs_first) -- rootfspart--; -- parts[rootfspart].name = "rootfs"; -- parts[rootfspart].offset = rootfsaddr; -- parts[rootfspart].size = rootfslen; -- if (sparelen > 0 && !rootfs_first) -- parts[rootfspart].size += sparelen; -- curpart++; -- } -+ curpart += parse_bcmtag(master, parts, curpart, imageaddr, imagelen); - - parts[curpart].name = "nvram"; - parts[curpart].offset = master->size - nvramlen; -@@ -174,25 +263,37 @@ static int bcm63xx_parse_cfe_partitions( - - /* Global partition "linux" to make easy firmware upgrade */ - parts[curpart].name = "linux"; -- parts[curpart].offset = cfelen; -- parts[curpart].size = master->size - cfelen - nvramlen; -+ parts[curpart].offset = imageaddr; -+ parts[curpart].size = imagelen; -+ curpart++; - -- for (i = 0; i < nrparts; i++) -+ for (i = 0; i < curpart; i++) - pr_info("Partition %d is %s offset %llx and length %llx\n", i, - parts[i].name, parts[i].offset, parts[i].size); - -- pr_info("Spare partition is offset %x and length %x\n", spareaddr, -- sparelen); -- - *pparts = parts; -- vfree(buf); - - return nrparts; - }; - -+ -+static int bcm63xx_parse_partitions(struct mtd_info *master, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct device_node *np, *mtd_node = mtd_get_of_node(master); -+ np = of_get_child_by_name(mtd_node, "partitions"); -+ -+ if ((np && of_device_is_compatible(np, "fixed-partitions")) || -+ (!np && of_get_child_count(mtd_node))) -+ return bcm63xx_parse_cfe_partitions_of(master, pparts, data); -+ else -+ return bcm63xx_parse_cfe_partitions(master, pparts, data); -+} -+ - static struct mtd_part_parser bcm63xx_cfe_parser = { - .owner = THIS_MODULE, -- .parse_fn = bcm63xx_parse_cfe_partitions, -+ .parse_fn = bcm63xx_parse_partitions, - .name = "bcm63xxpart", - }; - diff --git a/target/linux/brcm63xx/patches-4.4/427-boards_probe_switch.patch b/target/linux/brcm63xx/patches-4.4/427-boards_probe_switch.patch deleted file mode 100644 index ec03e4cee..000000000 --- a/target/linux/brcm63xx/patches-4.4/427-boards_probe_switch.patch +++ /dev/null @@ -1,119 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -77,6 +77,8 @@ static struct board_info __initdata boar - - .has_enet0 = 1, - .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -90,6 +92,8 @@ static struct board_info __initdata boar - - .has_enet0 = 1, - .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -138,6 +142,8 @@ static struct board_info __initdata boar - .use_internal_phy = 1, - }, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -170,6 +176,8 @@ static struct board_info __initdata boar - }, - - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -194,6 +202,8 @@ static struct board_info __initdata boar - .use_internal_phy = 1, - }, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -224,6 +234,8 @@ static struct board_info __initdata boar - }, - - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -247,6 +259,8 @@ static struct board_info __initdata boar - .use_internal_phy = 1, - }, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -268,6 +282,8 @@ static struct board_info __initdata boar - .use_internal_phy = 1, - }, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -287,6 +303,8 @@ static struct board_info __initdata boar - .use_internal_phy = 1, - }, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -314,6 +332,8 @@ static struct board_info __initdata boar - }, - - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -339,6 +359,8 @@ static struct board_info __initdata boar - }, - - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -364,6 +386,8 @@ static struct board_info __initdata boar - }, - - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -387,6 +411,8 @@ static struct board_info __initdata boar - }, - - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, diff --git a/target/linux/brcm63xx/patches-4.4/499-allow_better_context_for_board_patches.patch b/target/linux/brcm63xx/patches-4.4/499-allow_better_context_for_board_patches.patch deleted file mode 100644 index ad9c5b30e..000000000 --- a/target/linux/brcm63xx/patches-4.4/499-allow_better_context_for_board_patches.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -46,7 +46,7 @@ static struct board_info __initdata boar - .ephy_reset_gpio = 36, - .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, - }; --#endif -+#endif /* CONFIG_BCM63XX_CPU_3368 */ - - /* - * known 6328 boards -@@ -65,7 +65,7 @@ static struct board_info __initdata boar - .port_no = 0, - }, - }; --#endif -+#endif /* CONFIG_BCM63XX_CPU_6328 */ - - /* - * known 6338 boards -@@ -98,7 +98,7 @@ static struct board_info __initdata boar - .force_duplex_full = 1, - }, - }; --#endif -+#endif /* CONFIG_BCM63XX_CPU_6338 */ - - /* - * known 6345 boards -@@ -108,7 +108,7 @@ static struct board_info __initdata boar - .name = "96345GW2", - .expected_cpu_id = 0x6345, - }; --#endif -+#endif /* CONFIG_BCM63XX_CPU_6345 */ - - /* - * known 6348 boards -@@ -311,7 +311,7 @@ static struct board_info __initdata boar - - .has_ohci0 = 1, - }; --#endif -+#endif /* CONFIG_BCM63XX_CPU_6348 */ - - /* - * known 6358 boards -@@ -419,7 +419,7 @@ static struct board_info __initdata boar - - .has_ohci0 = 1, - }; --#endif -+#endif /* CONFIG_BCM63XX_CPU_6358 */ - - /* - * all boards diff --git a/target/linux/brcm63xx/patches-4.4/500-board-D4PW.patch b/target/linux/brcm63xx/patches-4.4/500-board-D4PW.patch deleted file mode 100644 index 31757c464..000000000 --- a/target/linux/brcm63xx/patches-4.4/500-board-D4PW.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -311,6 +311,21 @@ static struct board_info __initdata boar - - .has_ohci0 = 1, - }; -+ -+static struct board_info __initdata board_96348_D4PW = { -+ .name = "D-4P-W", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6348 */ - - /* -@@ -447,6 +462,7 @@ static const struct board_info __initcon - &board_DV201AMR, - &board_96348gw_a, - &board_rta1025w_16, -+ &board_96348_D4PW, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -478,6 +494,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96348gw-10", .data = &board_96348gw_10, }, - { .compatible = "brcm,bcm96348gw-11", .data = &board_96348gw_11, }, - { .compatible = "brcm,bcm96348gw-a", .data = &board_96348gw_a, }, -+ { .compatible = "d-link,dsl-2640b-b", .data = &board_96348_D4PW, }, - { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, - { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, }, - { .compatible = "netgear,dg834gtpn", .data = &board_96348gw_10, }, diff --git a/target/linux/brcm63xx/patches-4.4/501-board-NB4.patch b/target/linux/brcm63xx/patches-4.4/501-board-NB4.patch deleted file mode 100644 index fe228c6b0..000000000 --- a/target/linux/brcm63xx/patches-4.4/501-board-NB4.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -434,6 +434,60 @@ static struct board_info __initdata boar - - .has_ohci0 = 1, - }; -+ -+static struct board_info __initdata board_nb4_ser_r0 = { -+ .name = "NB4-SER-r0", -+ .expected_cpu_id = 0x6358, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ -+ .has_ohci0 = 1, -+ .has_pccard = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+}; -+ -+static struct board_info __initdata board_nb4_fxc_r1 = { -+ .name = "NB4-FXC-r1", -+ .expected_cpu_id = 0x6358, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ -+ .has_ohci0 = 1, -+ .has_pccard = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+}; - #endif /* CONFIG_BCM63XX_CPU_6358 */ - - /* -@@ -470,6 +524,8 @@ static const struct board_info __initcon - &board_96358vw2, - &board_AGPFS0, - &board_DWVS0, -+ &board_nb4_ser_r0, -+ &board_nb4_fxc_r1, - #endif - }; - -@@ -511,6 +567,8 @@ static struct of_device_id const bcm963x - { .compatible = "pirelli,a226m", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m-fwb", .data = &board_DWVS0, }, - { .compatible = "pirelli,agpf-s0", .data = &board_AGPFS0, }, -+ { .compatible = "sfr,nb4-ser-r0", .data = &board_nb4_ser_r0, }, -+ { .compatible = "sfr,nb4-fxc-r1", .data = &board_nb4_fxc_r1, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6368 - #endif diff --git a/target/linux/brcm63xx/patches-4.4/502-board-96338W2_E7T.patch b/target/linux/brcm63xx/patches-4.4/502-board-96338W2_E7T.patch deleted file mode 100644 index 64edf76e5..000000000 --- a/target/linux/brcm63xx/patches-4.4/502-board-96338W2_E7T.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -98,6 +98,20 @@ static struct board_info __initdata boar - .force_duplex_full = 1, - }, - }; -+ -+static struct board_info __initdata board_96338w2_e7t = { -+ .name = "96338W2_E7T", -+ .expected_cpu_id = 0x6338, -+ -+ .has_enet0 = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6338 */ - - /* -@@ -503,6 +517,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6338 - &board_96338gw, - &board_96338w, -+ &board_96338w2_e7t, - #endif - #ifdef CONFIG_BCM63XX_CPU_6345 - &board_96345gw2, -@@ -540,6 +555,7 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6338 - { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, - { .compatible = "brcm,bcm96338w", .data = &board_96338w, }, -+ { .compatible = "d-link,dsl-2640u", .data = &board_96338w2_e7t, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6345 - { .compatible = "brcm,bcm96345gw2", .data = &board_96345gw2, }, diff --git a/target/linux/brcm63xx/patches-4.4/503-board-CPVA642.patch b/target/linux/brcm63xx/patches-4.4/503-board-CPVA642.patch deleted file mode 100644 index 2639aa6fd..000000000 --- a/target/linux/brcm63xx/patches-4.4/503-board-CPVA642.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -401,6 +401,25 @@ static struct board_info __initdata boar - .num_usbh_ports = 2, - }; - -+static struct board_info __initdata board_CPVA642 = { -+ .name = "CPVA642", -+ .expected_cpu_id = 0x6358, -+ -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+}; -+ -+ - static struct board_info __initdata board_AGPFS0 = { - .name = "AGPF-S0", - .expected_cpu_id = 0x6358, -@@ -538,6 +557,7 @@ static const struct board_info __initcon - &board_96358vw, - &board_96358vw2, - &board_AGPFS0, -+ &board_CPVA642, - &board_DWVS0, - &board_nb4_ser_r0, - &board_nb4_fxc_r1, -@@ -585,6 +605,7 @@ static struct of_device_id const bcm963x - { .compatible = "pirelli,agpf-s0", .data = &board_AGPFS0, }, - { .compatible = "sfr,nb4-ser-r0", .data = &board_nb4_ser_r0, }, - { .compatible = "sfr,nb4-fxc-r1", .data = &board_nb4_fxc_r1, }, -+ { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6368 - #endif diff --git a/target/linux/brcm63xx/patches-4.4/504-board_dsl_274xb_rev_c.patch b/target/linux/brcm63xx/patches-4.4/504-board_dsl_274xb_rev_c.patch deleted file mode 100644 index c125b3e0a..000000000 --- a/target/linux/brcm63xx/patches-4.4/504-board_dsl_274xb_rev_c.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -468,6 +468,22 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - }; - -+/* D-Link DSL-274xB revison C2/C3 */ -+static struct board_info __initdata board_dsl_274xb_rev_c = { -+ .name = "AW4139", -+ .expected_cpu_id = 0x6358, -+ -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ - static struct board_info __initdata board_nb4_ser_r0 = { - .name = "NB4-SER-r0", - .expected_cpu_id = 0x6358, -@@ -559,6 +575,7 @@ static const struct board_info __initcon - &board_AGPFS0, - &board_CPVA642, - &board_DWVS0, -+ &board_dsl_274xb_rev_c, - &board_nb4_ser_r0, - &board_nb4_fxc_r1, - #endif -@@ -598,6 +615,7 @@ static struct of_device_id const bcm963x - { .compatible = "alcatel,rg100a", .data = &board_96358vw2, }, - { .compatible = "brcm,bcm96358vw", .data = &board_96358vw, }, - { .compatible = "brcm,bcm96358vw2", .data = &board_96358vw2, }, -+ { .compatible = "d-link,dsl-274xb-c2", .data = &board_dsl_274xb_rev_c, }, - { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, - { .compatible = "pirelli,a226g", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m", .data = &board_DWVS0, }, diff --git a/target/linux/brcm63xx/patches-4.4/505-board_spw500v.patch b/target/linux/brcm63xx/patches-4.4/505-board_spw500v.patch deleted file mode 100644 index c6bc4ec2d..000000000 --- a/target/linux/brcm63xx/patches-4.4/505-board_spw500v.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -340,6 +340,44 @@ static struct board_info __initdata boar - .force_duplex_full = 1, - }, - }; -+ -+static struct sprom_fixup __initdata spw500v_fixups[] = { -+ { .offset = 46, .value = 0x3046 }, -+ { .offset = 47, .value = 0x15a7 }, -+ { .offset = 48, .value = 0xfa89 }, -+ { .offset = 49, .value = 0xfe79 }, -+ { .offset = 57, .value = 0x6a49 }, -+}; -+ -+static struct board_info __initdata board_spw500v = { -+ .name = "SPW500V", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet0 = 1, -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_dsp = 1, -+ .dsp = { -+ .gpio_rst = 6, -+ .gpio_int = 34, -+ .ext_irq = 2, -+ .cs = 2, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = spw500v_fixups, -+ .num_board_fixups = ARRAY_SIZE(spw500v_fixups), -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6348 */ - - /* -@@ -567,6 +605,7 @@ static const struct board_info __initcon - &board_96348gw_a, - &board_rta1025w_16, - &board_96348_D4PW, -+ &board_spw500v, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -608,6 +647,7 @@ static struct of_device_id const bcm963x - { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, }, - { .compatible = "netgear,dg834gtpn", .data = &board_96348gw_10, }, - { .compatible = "sagem,f@st2404", .data = &board_FAST2404, }, -+ { .compatible = "t-com,spw500v", .data = &board_spw500v, }, - { .compatible = "tp-link,td-w8900gb", .data = &board_96348gw_11, }, - { .compatible = "usr,9108", .data = &board_96348gw_a, }, - #endif diff --git a/target/linux/brcm63xx/patches-4.4/506-board_gw6200_gw6000.patch b/target/linux/brcm63xx/patches-4.4/506-board_gw6200_gw6000.patch deleted file mode 100644 index fb28302eb..000000000 --- a/target/linux/brcm63xx/patches-4.4/506-board_gw6200_gw6000.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -233,6 +233,64 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_gw6200 = { -+ .name = "GW6200", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ .enet1 = { -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .has_ohci0 = 1, -+ -+ .has_dsp = 1, -+ .dsp = { -+ .gpio_rst = 8, /* FIXME: What is real GPIO here? */ -+ .gpio_int = 34, -+ .ext_irq = 2, -+ .cs = 2, -+ }, -+}; -+ -+static struct board_info __initdata board_gw6000 = { -+ .name = "GW6000", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ .enet1 = { -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .has_ohci0 = 1, -+ -+ .has_dsp = 1, -+ .dsp = { -+ .gpio_rst = 6, -+ .gpio_int = 34, -+ .ext_irq = 2, -+ .cs = 2, -+ }, -+}; -+ -+ -+ - static struct board_info __initdata board_FAST2404 = { - .name = "F@ST2404", - .expected_cpu_id = 0x6348, -@@ -598,6 +656,8 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6348 - &board_96348r, - &board_96348gw, -+ &board_gw6000, -+ &board_gw6200, - &board_96348gw_10, - &board_96348gw_11, - &board_FAST2404, -@@ -648,6 +708,8 @@ static struct of_device_id const bcm963x - { .compatible = "netgear,dg834gtpn", .data = &board_96348gw_10, }, - { .compatible = "sagem,f@st2404", .data = &board_FAST2404, }, - { .compatible = "t-com,spw500v", .data = &board_spw500v, }, -+ { .compatible = "tecom,gw6000", .data = &board_gw6000, }, -+ { .compatible = "tecom,gw6200", .data = &board_gw6200, }, - { .compatible = "tp-link,td-w8900gb", .data = &board_96348gw_11, }, - { .compatible = "usr,9108", .data = &board_96348gw_a, }, - #endif diff --git a/target/linux/brcm63xx/patches-4.4/507-board-MAGIC.patch b/target/linux/brcm63xx/patches-4.4/507-board-MAGIC.patch deleted file mode 100644 index 9ba7d8c23..000000000 --- a/target/linux/brcm63xx/patches-4.4/507-board-MAGIC.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -436,6 +436,39 @@ static struct board_info __initdata boar - .num_board_fixups = ARRAY_SIZE(spw500v_fixups), - }, - }; -+ -+static struct board_info __initdata board_96348sv = { -+ .name = "MAGIC", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ .enet1 = { -+ /* it has BP_ENET_EXTERNAL_PHY */ -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .has_ohci0 = 1, -+ .has_pccard = 1, -+ .has_ehci0 = 1, -+ -+ .has_dsp = 1, -+ .dsp = { -+ .gpio_rst = 25, -+ .gpio_int = 34, -+ .cs = 2, -+ .ext_irq = 2, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6348 */ - - /* -@@ -666,6 +699,7 @@ static const struct board_info __initcon - &board_rta1025w_16, - &board_96348_D4PW, - &board_spw500v, -+ &board_96348sv, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -710,6 +744,7 @@ static struct of_device_id const bcm963x - { .compatible = "t-com,spw500v", .data = &board_spw500v, }, - { .compatible = "tecom,gw6000", .data = &board_gw6000, }, - { .compatible = "tecom,gw6200", .data = &board_gw6200, }, -+ { .compatible = "telsey,magic", .data = &board_96348sv, }, - { .compatible = "tp-link,td-w8900gb", .data = &board_96348gw_11, }, - { .compatible = "usr,9108", .data = &board_96348gw_a, }, - #endif diff --git a/target/linux/brcm63xx/patches-4.4/508-board_hw553.patch b/target/linux/brcm63xx/patches-4.4/508-board_hw553.patch deleted file mode 100644 index 34800672c..000000000 --- a/target/linux/brcm63xx/patches-4.4/508-board_hw553.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -666,6 +666,32 @@ static struct board_info __initdata boar - .has_ehci0 = 1, - .num_usbh_ports = 2, - }; -+ -+static struct board_info __initdata board_HW553 = { -+ .name = "HW553", -+ .expected_cpu_id = 0x6358, -+ -+ .has_enet1 = 1, -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6358 */ - - /* -@@ -711,6 +737,7 @@ static const struct board_info __initcon - &board_dsl_274xb_rev_c, - &board_nb4_ser_r0, - &board_nb4_fxc_r1, -+ &board_HW553, - #endif - }; - -@@ -754,6 +781,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96358vw2", .data = &board_96358vw2, }, - { .compatible = "d-link,dsl-274xb-c2", .data = &board_dsl_274xb_rev_c, }, - { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, -+ { .compatible = "huawei,hg553", .data = &board_HW553, }, - { .compatible = "pirelli,a226g", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m-fwb", .data = &board_DWVS0, }, diff --git a/target/linux/brcm63xx/patches-4.4/509-board_rta1320_16m.patch b/target/linux/brcm63xx/patches-4.4/509-board_rta1320_16m.patch deleted file mode 100644 index f30dfbee1..000000000 --- a/target/linux/brcm63xx/patches-4.4/509-board_rta1320_16m.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -112,6 +112,20 @@ static struct board_info __initdata boar - .force_duplex_full = 1, - }, - }; -+ -+static struct board_info __initdata board_rta1320_16m = { -+ .name = "RTA1320_16M", -+ .expected_cpu_id = 0x6338, -+ -+ .has_enet0 = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6338 */ - - /* -@@ -708,6 +722,7 @@ static const struct board_info __initcon - &board_96338gw, - &board_96338w, - &board_96338w2_e7t, -+ &board_rta1320_16m, - #endif - #ifdef CONFIG_BCM63XX_CPU_6345 - &board_96345gw2, -@@ -752,6 +767,7 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6338 - { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, - { .compatible = "brcm,bcm96338w", .data = &board_96338w, }, -+ { .compatible = "dynalink,rta1320", .data = &board_rta1320_16m, }, - { .compatible = "d-link,dsl-2640u", .data = &board_96338w2_e7t, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6345 diff --git a/target/linux/brcm63xx/patches-4.4/510-board_spw303v.patch b/target/linux/brcm63xx/patches-4.4/510-board_spw303v.patch deleted file mode 100644 index 30ef4e051..000000000 --- a/target/linux/brcm63xx/patches-4.4/510-board_spw303v.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -706,6 +706,20 @@ static struct board_info __initdata boar - .pci_dev = 1, - }, - }; -+ -+ /* T-Home Speedport W 303V Typ B */ -+static struct board_info __initdata board_spw303v = { -+ .name = "96358-502V", -+ .expected_cpu_id = 0x6358, -+ -+ .has_enet0 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6358 */ - - /* -@@ -753,6 +767,7 @@ static const struct board_info __initcon - &board_nb4_ser_r0, - &board_nb4_fxc_r1, - &board_HW553, -+ &board_spw303v, - #endif - }; - -@@ -804,6 +819,7 @@ static struct of_device_id const bcm963x - { .compatible = "pirelli,agpf-s0", .data = &board_AGPFS0, }, - { .compatible = "sfr,nb4-ser-r0", .data = &board_nb4_ser_r0, }, - { .compatible = "sfr,nb4-fxc-r1", .data = &board_nb4_fxc_r1, }, -+ { .compatible = "t-com,spw303v", .data = &board_spw303v, }, - { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6368 diff --git a/target/linux/brcm63xx/patches-4.4/511-board_V2500V.patch b/target/linux/brcm63xx/patches-4.4/511-board_V2500V.patch deleted file mode 100644 index 46909b073..000000000 --- a/target/linux/brcm63xx/patches-4.4/511-board_V2500V.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -483,6 +483,26 @@ static struct board_info __initdata boar - .ext_irq = 2, - }, - }; -+ -+static struct board_info __initdata board_V2500V_BB = { -+ .name = "V2500V_BB", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6348 */ - - /* -@@ -755,6 +775,7 @@ static const struct board_info __initcon - &board_96348_D4PW, - &board_spw500v, - &board_96348sv, -+ &board_V2500V_BB, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -794,6 +815,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96348gw-10", .data = &board_96348gw_10, }, - { .compatible = "brcm,bcm96348gw-11", .data = &board_96348gw_11, }, - { .compatible = "brcm,bcm96348gw-a", .data = &board_96348gw_a, }, -+ { .compatible = "bt,v2500v-bb", .data = &board_V2500V_BB, }, - { .compatible = "d-link,dsl-2640b-b", .data = &board_96348_D4PW, }, - { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, - { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, }, -@@ -853,6 +875,22 @@ void __init board_bcm963xx_init(void) - val &= MPI_CSBASE_BASE_MASK; - } - boot_addr = (u8 *)KSEG1ADDR(val); -+ pr_info("Boot address 0x%08x\n",(unsigned int)boot_addr); -+ -+ /* BT Voyager 2500V (RTA1046VW PCB) has 8 Meg flash used as two */ -+ /* banks of 4 Meg. The byte at 0xBF800000 identifies the back to use.*/ -+ /* Loading firmware from the CFE Prompt always loads to Bank 0 */ -+ /* Do an early check of CFE and then select bank 0 */ -+ -+ if (boot_addr == (u8 *)0xbf800000) { -+ u8 *tmp_boot_addr = (u8*)0xbfc00000; -+ -+ bcm63xx_nvram_init(tmp_boot_addr + BCM963XX_NVRAM_OFFSET); -+ if (!strcmp(bcm63xx_nvram_get_name(), "V2500V_BB")) { -+ pr_info("V2500V: nvram bank 0\n"); -+ boot_addr = tmp_boot_addr; -+ } -+ } - - /* dump cfe version */ - cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET; ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -21,6 +21,7 @@ - #include - #include - -+#include - #include - #include - #include -@@ -247,6 +248,13 @@ int __init bcm63xx_flash_register(void) - val = bcm_mpi_readl(MPI_CSBASE_REG(0)); - val &= MPI_CSBASE_BASE_MASK; - -+ /* BT Voyager 2500V has 8 Meg flash in two 4 Meg banks */ -+ /* Loading from CFE always uses Bank 0 */ -+ if (!strcmp(board_get_name(), "V2500V_BB")) { -+ pr_info("V2500V: Start in Bank 0\n"); -+ val = val + 0x400000; // Select Bank 0 start address -+ } -+ - mtd_resources[0].start = val; - mtd_resources[0].end = 0x1FFFFFFF; - } diff --git a/target/linux/brcm63xx/patches-4.4/512-board_BTV2110.patch b/target/linux/brcm63xx/patches-4.4/512-board_BTV2110.patch deleted file mode 100644 index f58e294eb..000000000 --- a/target/linux/brcm63xx/patches-4.4/512-board_BTV2110.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -216,6 +216,24 @@ static struct board_info __initdata boar - .has_ehci0 = 1, - }; - -+ -+/* BT Voyager 2110 */ -+static struct board_info __initdata board_V2110 = { -+ .name = "V2110", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+ - static struct board_info __initdata board_96348gw = { - .name = "96348GW", - .expected_cpu_id = 0x6348, -@@ -776,6 +794,7 @@ static const struct board_info __initcon - &board_spw500v, - &board_96348sv, - &board_V2500V_BB, -+ &board_V2110, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -815,6 +834,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96348gw-10", .data = &board_96348gw_10, }, - { .compatible = "brcm,bcm96348gw-11", .data = &board_96348gw_11, }, - { .compatible = "brcm,bcm96348gw-a", .data = &board_96348gw_a, }, -+ { .compatible = "bt,v2110", .data = &board_V2110, }, - { .compatible = "bt,v2500v-bb", .data = &board_V2500V_BB, }, - { .compatible = "d-link,dsl-2640b-b", .data = &board_96348_D4PW, }, - { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, diff --git a/target/linux/brcm63xx/patches-4.4/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch b/target/linux/brcm63xx/patches-4.4/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch deleted file mode 100644 index 769be5a17..000000000 --- a/target/linux/brcm63xx/patches-4.4/513-MIPS-BCM63XX-add-inventel-Livebox-support.patch +++ /dev/null @@ -1,223 +0,0 @@ -From e796582b499f0ba6acaa1ac3a10c09cceaab7702 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 9 Mar 2014 04:55:52 +0100 -Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support - ---- - arch/mips/bcm63xx/boards/Kconfig | 6 + - arch/mips/bcm63xx/boards/Makefile | 1 + - arch/mips/bcm63xx/boards/board_common.c | 2 +- - arch/mips/bcm63xx/boards/board_common.h | 6 + - arch/mips/bcm63xx/boards/board_livebox.c | 215 ++++++++++++++++++++++++++++++ - 5 files changed, 229 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/bcm63xx/boards/board_livebox.c - ---- a/arch/mips/bcm63xx/boards/Kconfig -+++ b/arch/mips/bcm63xx/boards/Kconfig -@@ -12,4 +12,10 @@ config BOARD_BCM963XX - default y - help - -+config BOARD_LIVEBOX -+ bool "Inventel Livebox(es) boards" -+ select SSB -+ help -+ Inventel Livebox boards using the RedBoot bootloader. -+ - endmenu ---- a/arch/mips/bcm63xx/boards/Makefile -+++ b/arch/mips/bcm63xx/boards/Makefile -@@ -1,2 +1,3 @@ - obj-y += board_common.o - obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o -+obj-$(CONFIG_BOARD_LIVEBOX) += board_livebox.o ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -55,7 +55,7 @@ void __init board_prom_init(void) - if (fw_arg3 == CFE_EPTSEAL) - board_bcm963xx_init(); - else -- panic("unsupported bootloader detected"); -+ board_livebox_init(); - } - - static int (*board_get_mac_address)(u8 mac[ETH_ALEN]); ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -24,4 +24,10 @@ static inline void board_of_device_prese - } - #endif - -+#if defined(CONFIG_BOARD_LIVEBOX) -+void board_livebox_init(void); -+#else -+static inline void board_livebox_init(void) { } -+#endif -+ - #endif /* __BOARD_COMMON_H */ ---- /dev/null -+++ b/arch/mips/bcm63xx/boards/board_livebox.c -@@ -0,0 +1,163 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "board_common.h" -+ -+#define PFX "board_livebox: " -+ -+static unsigned int mac_addr_used = 0; -+ -+/* -+ * known 6348 boards -+ */ -+#ifdef CONFIG_BCM63XX_CPU_6348 -+static struct board_info __initdata board_livebox_blue5g = { -+ .name = "Livebox-blue-5g", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 31, -+ }, -+ -+ .ephy_reset_gpio = 6, -+ .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, -+ -+ .has_ohci0 = 1, -+ .has_pccard = 1, -+ -+ .has_dsp = 0, /*TODO some Liveboxes have dsp*/ -+ .dsp = { -+ .gpio_rst = 6, -+ .gpio_int = 35, -+ .cs = 2, -+ .ext_irq = 2, -+ }, -+}; -+#endif -+ -+/* -+ * all boards -+ */ -+static const struct board_info __initdata *bcm963xx_boards[] = { -+#ifdef CONFIG_BCM63XX_CPU_6348 -+ &board_livebox_blue5g -+#endif -+}; -+ -+static struct of_device_id const livebox_boards_dt[] = { -+ { .compatible = "inventel,livebox-blue-5g", .data = &board_livebox_blue5g, }, -+ { } -+}; -+ -+/* -+ * register & return a new board mac address -+ */ -+static int livebox_get_mac_address(u8 *mac) -+{ -+ u8 *p; -+ int count; -+ -+ memcpy(mac, (u8 *)0xBEBFF377, ETH_ALEN); -+ -+ p = mac + ETH_ALEN - 1; -+ count = mac_addr_used; -+ -+ while (count--) { -+ do { -+ (*p)++; -+ if (*p != 0) -+ break; -+ p--; -+ } while (p != mac); -+ } -+ -+ if (p == mac) { -+ printk(KERN_ERR PFX "unable to fetch mac address\n"); -+ return -ENODEV; -+ } -+ mac_addr_used++; -+ -+ return 0; -+} -+ -+/* -+ * early init callback -+ */ -+#define LIVEBOX_GPIO_DETECT_MASK 0x000000ff -+#define LIVEBOX_BOOT_ADDR 0x1e400000 -+ -+#define LIVEBOX_HW_BLUE5G_9 0x90 -+ -+void __init board_livebox_init(void) -+{ -+ u32 val; -+ u8 hw_version; -+ const struct board_info *board; -+ const struct of_device_id *board_match; -+ -+ /* find board by compat */ -+ board_match = bcm63xx_match_board(livebox_boards_dt); -+ if (board_match) { -+ board = board_match->data; -+ } else { -+ /* Get hardware version */ -+ val = bcm_gpio_readl(GPIO_CTL_LO_REG); -+ val &= ~LIVEBOX_GPIO_DETECT_MASK; -+ bcm_gpio_writel(val, GPIO_CTL_LO_REG); -+ -+ hw_version = bcm_gpio_readl(GPIO_DATA_LO_REG); -+ hw_version &= LIVEBOX_GPIO_DETECT_MASK; -+ -+ switch (hw_version) { -+ case LIVEBOX_HW_BLUE5G_9: -+ printk(KERN_INFO PFX "Livebox BLUE5G.9\n"); -+ board = bcm963xx_boards[0]; -+ break; -+ default: -+ printk(KERN_INFO PFX "Unknown livebox version: %02x\n", -+ hw_version); -+ /* use default livebox configuration */ -+ board = bcm963xx_boards[0]; -+ break; -+ } -+ } -+ -+ /* use default livebox configuration */ -+ board_early_setup(board, livebox_get_mac_address); -+ -+ /* read base address of boot chip select (0) */ -+ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); -+ val &= MPI_CSBASE_BASE_MASK; -+ if (val != LIVEBOX_BOOT_ADDR) { -+ printk(KERN_NOTICE PFX "flash address is: 0x%08x, forcing to: 0x%08x\n", -+ val, LIVEBOX_BOOT_ADDR); -+ bcm63xx_flash_force_phys_base_address(LIVEBOX_BOOT_ADDR, 0x1ebfffff); -+ } -+} diff --git a/target/linux/brcm63xx/patches-4.4/514-board_ct536_ct5621.patch b/target/linux/brcm63xx/patches-4.4/514-board_ct536_ct5621.patch deleted file mode 100644 index d111d97d6..000000000 --- a/target/linux/brcm63xx/patches-4.4/514-board_ct536_ct5621.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -234,6 +234,33 @@ static struct board_info __initdata boar - }; - - -+static struct board_info __initdata board_ct536_ct5621 = { -+ .name = "CT536_CT5621", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet0 = 0, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .has_ohci0 = 1, -+ .has_pccard = 1, -+ .has_ehci0 = 1, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ - static struct board_info __initdata board_96348gw = { - .name = "96348GW", - .expected_cpu_id = 0x6348, -@@ -795,6 +822,7 @@ static const struct board_info __initcon - &board_96348sv, - &board_V2500V_BB, - &board_V2110, -+ &board_ct536_ct5621, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -836,6 +864,8 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96348gw-a", .data = &board_96348gw_a, }, - { .compatible = "bt,v2110", .data = &board_V2110, }, - { .compatible = "bt,v2500v-bb", .data = &board_V2500V_BB, }, -+ { .compatible = "comtrend,ct-536+", .data = &board_ct536_ct5621, }, -+ { .compatible = "comtrend,ct-5621", .data = &board_ct536_ct5621, }, - { .compatible = "d-link,dsl-2640b-b", .data = &board_96348_D4PW, }, - { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, - { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, }, diff --git a/target/linux/brcm63xx/patches-4.4/515-board_DWV-S0_fixes.patch b/target/linux/brcm63xx/patches-4.4/515-board_DWV-S0_fixes.patch deleted file mode 100644 index 8e053b293..000000000 --- a/target/linux/brcm63xx/patches-4.4/515-board_DWV-S0_fixes.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -674,6 +674,7 @@ static struct board_info __initdata boar - }, - - .has_ohci0 = 1, -+ .has_ehci0 = 1, - }; - - /* D-Link DSL-274xB revison C2/C3 */ diff --git a/target/linux/brcm63xx/patches-4.4/516-board_96348A-122.patch b/target/linux/brcm63xx/patches-4.4/516-board_96348A-122.patch deleted file mode 100644 index 29dc2620d..000000000 --- a/target/linux/brcm63xx/patches-4.4/516-board_96348A-122.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -261,6 +261,30 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_96348A_122 = { -+ .name = "96348A-122", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet1 = 1, -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .has_ohci0 = 1, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ - static struct board_info __initdata board_96348gw = { - .name = "96348GW", - .expected_cpu_id = 0x6348, -@@ -824,6 +848,7 @@ static const struct board_info __initcon - &board_V2500V_BB, - &board_V2110, - &board_ct536_ct5621, -+ &board_96348A_122, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -866,6 +891,7 @@ static struct of_device_id const bcm963x - { .compatible = "bt,v2110", .data = &board_V2110, }, - { .compatible = "bt,v2500v-bb", .data = &board_V2500V_BB, }, - { .compatible = "comtrend,ct-536+", .data = &board_ct536_ct5621, }, -+ { .compatible = "comtrend,ct-5365", .data = &board_96348A_122, }, - { .compatible = "comtrend,ct-5621", .data = &board_ct536_ct5621, }, - { .compatible = "d-link,dsl-2640b-b", .data = &board_96348_D4PW, }, - { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, diff --git a/target/linux/brcm63xx/patches-4.4/519_board_CPVA502plus.patch b/target/linux/brcm63xx/patches-4.4/519_board_CPVA502plus.patch deleted file mode 100644 index 5af1060df..000000000 --- a/target/linux/brcm63xx/patches-4.4/519_board_CPVA502plus.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -233,6 +233,33 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_CPVA502plus = { -+ .name = "CPVA502+", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ }, -+ -+ .ephy_reset_gpio = 4, -+ .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; - - static struct board_info __initdata board_ct536_ct5621 = { - .name = "CT536_CT5621", -@@ -849,6 +876,7 @@ static const struct board_info __initcon - &board_V2110, - &board_ct536_ct5621, - &board_96348A_122, -+ &board_CPVA502plus, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -901,6 +929,7 @@ static struct of_device_id const bcm963x - { .compatible = "t-com,spw500v", .data = &board_spw500v, }, - { .compatible = "tecom,gw6000", .data = &board_gw6000, }, - { .compatible = "tecom,gw6200", .data = &board_gw6200, }, -+ { .compatible = "telsey,cpva502+", .data = &board_CPVA502plus, }, - { .compatible = "telsey,magic", .data = &board_96348sv, }, - { .compatible = "tp-link,td-w8900gb", .data = &board_96348gw_11, }, - { .compatible = "usr,9108", .data = &board_96348gw_a, }, diff --git a/target/linux/brcm63xx/patches-4.4/520-bcm63xx-add-support-for-96368MVWG-board.patch b/target/linux/brcm63xx/patches-4.4/520-bcm63xx-add-support-for-96368MVWG-board.patch deleted file mode 100644 index 31002842f..000000000 --- a/target/linux/brcm63xx/patches-4.4/520-bcm63xx-add-support-for-96368MVWG-board.patch +++ /dev/null @@ -1,118 +0,0 @@ -From eeacc2529942051504bc957726aa178671344421 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Wed, 20 Jan 2010 16:21:30 +0100 -Subject: [PATCH 32/63] bcm63xx: add support for 96368MVWG board. - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 95 ++++++++++++++++++++ - .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 2 + - 2 files changed, 97 insertions(+), 0 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -840,6 +840,58 @@ static struct board_info __initdata boar - #endif /* CONFIG_BCM63XX_CPU_6358 */ - - /* -+ * known 6368 boards -+ */ -+#ifdef CONFIG_BCM63XX_CPU_6368 -+static struct board_info __initdata board_96368mvwg = { -+ .name = "96368MVWG", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ -+ .has_usbd = 1, -+ -+ .usbd = { -+ .use_fullspeed = 0, -+ .port_no = 0, -+ }, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port1", -+ }, -+ -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port2", -+ }, -+ -+ [4] = { -+ .used = 1, -+ .phy_id = 0x12, -+ .name = "port0", -+ }, -+ -+ [5] = { -+ .used = 1, -+ .phy_id = 0x11, -+ .name = "port3", -+ }, -+ }, -+ }, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+}; -+#endif /* CONFIG_BCM63XX_CPU_6368 */ -+ -+/* - * all boards - */ - static const struct board_info __initconst *bcm963xx_boards[] = { -@@ -891,6 +943,10 @@ static const struct board_info __initcon - &board_HW553, - &board_spw303v, - #endif -+ -+#ifdef CONFIG_BCM63XX_CPU_6368 -+ &board_96368mvwg, -+#endif - }; - - static struct of_device_id const bcm963xx_boards_dt[] = { -@@ -951,6 +1007,7 @@ static struct of_device_id const bcm963x - { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6368 -+ { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 - #endif ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -82,12 +82,25 @@ void __init board_early_setup(const stru - bcm63xx_pci_enabled = 1; - if (BCMCPU_IS_6348()) - val |= GPIO_MODE_6348_G2_PCI; -+ -+ if (BCMCPU_IS_6368()) -+ val |= GPIO_MODE_6368_PCI_REQ1 | -+ GPIO_MODE_6368_PCI_GNT1 | -+ GPIO_MODE_6368_PCI_INTB | -+ GPIO_MODE_6368_PCI_REQ0 | -+ GPIO_MODE_6368_PCI_GNT0; - } - #endif - - if (board.has_pccard) { - if (BCMCPU_IS_6348()) - val |= GPIO_MODE_6348_G1_MII_PCCARD; -+ -+ if (BCMCPU_IS_6368()) -+ val |= GPIO_MODE_6368_PCMCIA_CD1 | -+ GPIO_MODE_6368_PCMCIA_CD2 | -+ GPIO_MODE_6368_PCMCIA_VS1 | -+ GPIO_MODE_6368_PCMCIA_VS2; - } - - if (board.has_enet0 && !board.enet0.use_internal_phy) { diff --git a/target/linux/brcm63xx/patches-4.4/521-bcm63xx-add-support-for-96368MVNgr-board.patch b/target/linux/brcm63xx/patches-4.4/521-bcm63xx-add-support-for-96368MVNgr-board.patch deleted file mode 100644 index f719c2428..000000000 --- a/target/linux/brcm63xx/patches-4.4/521-bcm63xx-add-support-for-96368MVNgr-board.patch +++ /dev/null @@ -1,73 +0,0 @@ -From f457fc2eb9bb915b5a4d251c7c68d4694cf07b01 Mon Sep 17 00:00:00 2001 -From: Maxime Bizon -Date: Fri, 4 Nov 2011 12:33:48 +0100 -Subject: [PATCH 33/63] bcm63xx: add support for 96368MVNgr board. - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 67 +++++++++++++++++++++++++++++ - 1 files changed, 67 insertions(+), 0 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -889,6 +889,45 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_ehci0 = 1, - }; -+ -+static struct board_info __initdata board_96368mvngr = { -+ .name = "96368MVNgr", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+}; - #endif /* CONFIG_BCM63XX_CPU_6368 */ - - /* -@@ -946,6 +985,7 @@ static const struct board_info __initcon - - #ifdef CONFIG_BCM63XX_CPU_6368 - &board_96368mvwg, -+ &board_96368mvngr, - #endif - }; - -@@ -1007,6 +1047,7 @@ static struct of_device_id const bcm963x - { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6368 -+ { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/brcm63xx/patches-4.4/522-MIPS-BCM63XX-add-96328avng-reference-board.patch b/target/linux/brcm63xx/patches-4.4/522-MIPS-BCM63XX-add-96328avng-reference-board.patch deleted file mode 100644 index e482b2093..000000000 --- a/target/linux/brcm63xx/patches-4.4/522-MIPS-BCM63XX-add-96328avng-reference-board.patch +++ /dev/null @@ -1,45 +0,0 @@ -From c93c2bbf0cc96da5a47d77f01daf6c983cfe4216 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 May 2012 10:52:25 +0200 -Subject: [PATCH] MIPS: BCM63XX: add 96328avng reference board - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 77 +++++++++++++++++++++++++++++ - 1 files changed, 77 insertions(+), 0 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -64,6 +64,33 @@ static struct board_info __initdata boar - .use_fullspeed = 0, - .port_no = 0, - }, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, - }; - #endif /* CONFIG_BCM63XX_CPU_6328 */ - diff --git a/target/linux/brcm63xx/patches-4.4/523-MIPS-BCM63XX-add-963281TAN-reference-board.patch b/target/linux/brcm63xx/patches-4.4/523-MIPS-BCM63XX-add-963281TAN-reference-board.patch deleted file mode 100644 index c0f235bee..000000000 --- a/target/linux/brcm63xx/patches-4.4/523-MIPS-BCM63XX-add-963281TAN-reference-board.patch +++ /dev/null @@ -1,68 +0,0 @@ -From f0649f7b7c672cf452a1796a1422bf615e1973f8 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 May 2012 11:01:12 +0200 -Subject: [PATCH] MIPS: BCM63XX: add 963281TAN reference board - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 71 +++++++++++++++++++++++++++++ - 1 files changed, 71 insertions(+), 0 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -92,6 +92,40 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct board_info __initdata board_963281TAN = { -+ .name = "963281TAN", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6328 */ - - /* -@@ -966,6 +1000,7 @@ static const struct board_info __initcon - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, -+ &board_963281TAN, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 - &board_96338gw, -@@ -1022,6 +1057,7 @@ static struct of_device_id const bcm963x - { .compatible = "netgear,cvg834g", .data = &board_cvg834g, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 -+ { .compatible = "brcm,bcm963281TAN", .data = &board_963281TAN, }, - { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 diff --git a/target/linux/brcm63xx/patches-4.4/524-board_dsl_274xb_rev_f.patch b/target/linux/brcm63xx/patches-4.4/524-board_dsl_274xb_rev_f.patch deleted file mode 100644 index e3be8926d..000000000 --- a/target/linux/brcm63xx/patches-4.4/524-board_dsl_274xb_rev_f.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 66808f706b3dcd83a9f5157997ff478a880a2906 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 30 Apr 2012 09:10:51 +0200 -Subject: [PATCH 70/79] MIPS: BCM63XX: Add board definition for D-Link - DSL-274xB rev F1 - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 104 +++++++++++++++++++++++++++++ - 1 files changed, 104 insertions(+), 0 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -126,6 +126,51 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct board_info __initdata board_dsl_274xb_f1 = { -+ .name = "AW4339U", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_ATHEROS, -+ .caldata_offset = 0x7d1000, -+ .slot = 0, -+ .led_pin = -1, -+ .led_active_high = 1, -+ }, -+ }, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 4", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 2", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 1", -+ }, -+ }, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6328 */ - - /* -@@ -1001,6 +1046,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, - &board_963281TAN, -+ &board_dsl_274xb_f1, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 - &board_96338gw, -@@ -1059,6 +1105,7 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6328 - { .compatible = "brcm,bcm963281TAN", .data = &board_963281TAN, }, - { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, -+ { .compatible = "d-link,dsl-274xb-f", .data = &board_dsl_274xb_f1, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 - { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, diff --git a/target/linux/brcm63xx/patches-4.4/525-board_96348w3.patch b/target/linux/brcm63xx/patches-4.4/525-board_96348w3.patch deleted file mode 100644 index 8fd0e85b6..000000000 --- a/target/linux/brcm63xx/patches-4.4/525-board_96348w3.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -600,6 +600,24 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - }; - -+/* NetGear DG834G v4 */ -+static struct board_info __initdata board_96348W3 = { -+ .name = "96348W3", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .has_ohci0 = 1, -+}; -+ - static struct board_info __initdata board_96348_D4PW = { - .name = "D-4P-W", - .expected_cpu_id = 0x6348, -@@ -1076,6 +1094,7 @@ static const struct board_info __initcon - &board_ct536_ct5621, - &board_96348A_122, - &board_CPVA502plus, -+ &board_96348W3, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -1131,6 +1150,7 @@ static struct of_device_id const bcm963x - { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, - { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, }, - { .compatible = "netgear,dg834gtpn", .data = &board_96348gw_10, }, -+ { .compatible = "netgear,dg834g-v4", .data = &board_96348W3, }, - { .compatible = "sagem,f@st2404", .data = &board_FAST2404, }, - { .compatible = "t-com,spw500v", .data = &board_spw500v, }, - { .compatible = "tecom,gw6000", .data = &board_gw6000, }, diff --git a/target/linux/brcm63xx/patches-4.4/526-board_CT6373-1.patch b/target/linux/brcm63xx/patches-4.4/526-board_CT6373-1.patch deleted file mode 100644 index f9257d29d..000000000 --- a/target/linux/brcm63xx/patches-4.4/526-board_CT6373-1.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -922,6 +922,30 @@ static struct board_info __initdata boar - .num_usbh_ports = 2, - }; - -+static struct board_info __initdata board_ct6373_1 = { -+ .name = "CT6373-1", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ - static struct board_info __initdata board_HW553 = { - .name = "HW553", - .expected_cpu_id = 0x6358, -@@ -1106,6 +1130,7 @@ static const struct board_info __initcon - &board_dsl_274xb_rev_c, - &board_nb4_ser_r0, - &board_nb4_fxc_r1, -+ &board_ct6373_1, - &board_HW553, - &board_spw303v, - #endif -@@ -1164,6 +1189,7 @@ static struct of_device_id const bcm963x - { .compatible = "alcatel,rg100a", .data = &board_96358vw2, }, - { .compatible = "brcm,bcm96358vw", .data = &board_96358vw, }, - { .compatible = "brcm,bcm96358vw2", .data = &board_96358vw2, }, -+ { .compatible = "comtrend,ct-6373", .data = &board_ct6373_1, }, - { .compatible = "d-link,dsl-274xb-c2", .data = &board_dsl_274xb_rev_c, }, - { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, - { .compatible = "huawei,hg553", .data = &board_HW553, }, diff --git a/target/linux/brcm63xx/patches-4.4/527-board_dva-g3810bn-tl-1.patch b/target/linux/brcm63xx/patches-4.4/527-board_dva-g3810bn-tl-1.patch deleted file mode 100644 index 6936fa4d5..000000000 --- a/target/linux/brcm63xx/patches-4.4/527-board_dva-g3810bn-tl-1.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -985,6 +985,35 @@ static struct board_info __initdata boar - .use_internal_phy = 1, - }, - }; -+ -+/* D-Link DVA-G3810BN/TL */ -+static struct board_info __initdata board_DVAG3810BN = { -+ .name = "DVAG3810BN", -+ .expected_cpu_id = 0x6358, -+ -+ .has_enet0 = 1, -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet0 = { -+ .has_phy = 0, -+ .use_internal_phy = 1, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ -+ .has_ohci0 = 1, -+ .has_pccard = 1, -+ .has_ehci0 = 1, -+}; - #endif /* CONFIG_BCM63XX_CPU_6358 */ - - /* -@@ -1133,6 +1162,7 @@ static const struct board_info __initcon - &board_ct6373_1, - &board_HW553, - &board_spw303v, -+ &board_DVAG3810BN, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6368 -@@ -1192,6 +1222,7 @@ static struct of_device_id const bcm963x - { .compatible = "comtrend,ct-6373", .data = &board_ct6373_1, }, - { .compatible = "d-link,dsl-274xb-c2", .data = &board_dsl_274xb_rev_c, }, - { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, -+ { .compatible = "d-link,dva-g3810bn/tl", .data = &board_DVAG3810BN, }, - { .compatible = "huawei,hg553", .data = &board_HW553, }, - { .compatible = "pirelli,a226g", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m", .data = &board_DWVS0, }, diff --git a/target/linux/brcm63xx/patches-4.4/528-board_nb6.patch b/target/linux/brcm63xx/patches-4.4/528-board_nb6.patch deleted file mode 100644 index 55cc9ab86..000000000 --- a/target/linux/brcm63xx/patches-4.4/528-board_nb6.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1016,6 +1016,32 @@ static struct board_info __initdata boar - }; - #endif /* CONFIG_BCM63XX_CPU_6358 */ - -+#ifdef CONFIG_BCM63XX_CPU_6362 -+static struct board_info __initdata board_nb6 = { -+ .name = "NB6", -+ .expected_cpu_id = 0x6362, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [4] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+#endif /* CONFIG_BCM63XX_CPU_6362 */ -+ - /* - * known 6368 boards - */ -@@ -1165,6 +1191,10 @@ static const struct board_info __initcon - &board_DVAG3810BN, - #endif - -+#ifdef CONFIG_BCM63XX_CPU_6362 -+ &board_nb6, -+#endif -+ - #ifdef CONFIG_BCM63XX_CPU_6368 - &board_96368mvwg, - &board_96368mvngr, -@@ -1233,6 +1263,9 @@ static struct of_device_id const bcm963x - { .compatible = "t-com,spw303v", .data = &board_spw303v, }, - { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, - #endif -+#ifdef CONFIG_BCM63XX_CPU_6362 -+ { .compatible = "sfr,nb6-ser-r0", .data = &board_nb6, }, -+#endif - #ifdef CONFIG_BCM63XX_CPU_6368 - { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, diff --git a/target/linux/brcm63xx/patches-4.4/529-board_fast2604.patch b/target/linux/brcm63xx/patches-4.4/529-board_fast2604.patch deleted file mode 100644 index 2bca04aa8..000000000 --- a/target/linux/brcm63xx/patches-4.4/529-board_fast2604.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -533,6 +533,22 @@ static struct board_info __initdata boar - .has_ehci0 = 1, - }; - -+static struct board_info __initdata board_FAST2604 = { -+ .name = "F@ST2604", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ - static struct board_info __initdata board_rta1025w_16 = { - .name = "RTA1025W_16", - .expected_cpu_id = 0x6348, -@@ -1162,6 +1178,7 @@ static const struct board_info __initcon - &board_96348gw_10, - &board_96348gw_11, - &board_FAST2404, -+ &board_FAST2604, - &board_DV201AMR, - &board_96348gw_a, - &board_rta1025w_16, -@@ -1237,6 +1254,7 @@ static struct of_device_id const bcm963x - { .compatible = "netgear,dg834gtpn", .data = &board_96348gw_10, }, - { .compatible = "netgear,dg834g-v4", .data = &board_96348W3, }, - { .compatible = "sagem,f@st2404", .data = &board_FAST2404, }, -+ { .compatible = "sagem,f@st2604", .data = &board_FAST2604, }, - { .compatible = "t-com,spw500v", .data = &board_spw500v, }, - { .compatible = "tecom,gw6000", .data = &board_gw6000, }, - { .compatible = "tecom,gw6200", .data = &board_gw6200, }, diff --git a/target/linux/brcm63xx/patches-4.4/530-board_A4001N1.patch b/target/linux/brcm63xx/patches-4.4/530-board_A4001N1.patch deleted file mode 100644 index ec0695cc0..000000000 --- a/target/linux/brcm63xx/patches-4.4/530-board_A4001N1.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -127,6 +127,49 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_A4001N1 = { -+ .name = "963281T_TEF", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ - static struct board_info __initdata board_dsl_274xb_f1 = { - .name = "AW4339U", - .expected_cpu_id = 0x6328, -@@ -1159,6 +1202,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, - &board_963281TAN, -+ &board_A4001N1, - &board_dsl_274xb_f1, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 -@@ -1224,6 +1268,7 @@ static struct of_device_id const bcm963x - { .compatible = "netgear,cvg834g", .data = &board_cvg834g, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 -+ { .compatible = "adb,a4001n1", .data = &board_A4001N1, }, - { .compatible = "brcm,bcm963281TAN", .data = &board_963281TAN, }, - { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, - { .compatible = "d-link,dsl-274xb-f", .data = &board_dsl_274xb_f1, }, diff --git a/target/linux/brcm63xx/patches-4.4/531-board_AR-5387un.patch b/target/linux/brcm63xx/patches-4.4/531-board_AR-5387un.patch deleted file mode 100644 index d38cb3bb1..000000000 --- a/target/linux/brcm63xx/patches-4.4/531-board_AR-5387un.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -93,6 +93,78 @@ static struct board_info __initdata boar - }, - }; - -+static struct sprom_fixup __initdata ar5387un_fixups[] = { -+ { .offset = 2, .value = 0x05bb }, -+ { .offset = 65, .value = 0x1204 }, -+ { .offset = 78, .value = 0x0303 }, -+ { .offset = 79, .value = 0x0202 }, -+ { .offset = 80, .value = 0xff02 }, -+ { .offset = 87, .value = 0x0315 }, -+ { .offset = 88, .value = 0x0315 }, -+ { .offset = 96, .value = 0x2048 }, -+ { .offset = 97, .value = 0xff11 }, -+ { .offset = 98, .value = 0x1567 }, -+ { .offset = 99, .value = 0xfb24 }, -+ { .offset = 100, .value = 0x3e3c }, -+ { .offset = 101, .value = 0x4038 }, -+ { .offset = 102, .value = 0xfe7f }, -+ { .offset = 103, .value = 0x1279 }, -+ { .offset = 112, .value = 0x2048 }, -+ { .offset = 113, .value = 0xff03 }, -+ { .offset = 114, .value = 0x154c }, -+ { .offset = 115, .value = 0xfb27 }, -+ { .offset = 116, .value = 0x3e3c }, -+ { .offset = 117, .value = 0x4038 }, -+ { .offset = 118, .value = 0xfe87 }, -+ { .offset = 119, .value = 0x1233 }, -+ { .offset = 203, .value = 0x2226 }, -+}; -+ -+static struct board_info __initdata board_AR5387un = { -+ .name = "96328A-1441N1", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = ar5387un_fixups, -+ .num_board_fixups = ARRAY_SIZE(ar5387un_fixups), -+ }, -+}; -+ - static struct board_info __initdata board_963281TAN = { - .name = "963281TAN", - .expected_cpu_id = 0x6328, -@@ -1201,6 +1273,7 @@ static const struct board_info __initcon - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, -+ &board_AR5387un, - &board_963281TAN, - &board_A4001N1, - &board_dsl_274xb_f1, -@@ -1271,6 +1344,7 @@ static struct of_device_id const bcm963x - { .compatible = "adb,a4001n1", .data = &board_A4001N1, }, - { .compatible = "brcm,bcm963281TAN", .data = &board_963281TAN, }, - { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, -+ { .compatible = "comtrend,ar-5387un", .data = &board_AR5387un, }, - { .compatible = "d-link,dsl-274xb-f", .data = &board_dsl_274xb_f1, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 diff --git a/target/linux/brcm63xx/patches-4.4/532-board_AR-5381u.patch b/target/linux/brcm63xx/patches-4.4/532-board_AR-5381u.patch deleted file mode 100644 index 07015caaa..000000000 --- a/target/linux/brcm63xx/patches-4.4/532-board_AR-5381u.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -93,6 +93,60 @@ static struct board_info __initdata boar - }, - }; - -+static struct sprom_fixup __initdata ar5381u_fixups[] = { -+ { .offset = 97, .value = 0xfee5 }, -+ { .offset = 98, .value = 0x157c }, -+ { .offset = 99, .value = 0xfae7 }, -+ { .offset = 113, .value = 0xfefa }, -+ { .offset = 114, .value = 0x15d6 }, -+ { .offset = 115, .value = 0xfaf8 }, -+}; -+ -+static struct board_info __initdata board_AR5381u = { -+ .name = "96328A-1241N", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = ar5381u_fixups, -+ .num_board_fixups = ARRAY_SIZE(ar5381u_fixups), -+ }, -+}; -+ - static struct sprom_fixup __initdata ar5387un_fixups[] = { - { .offset = 2, .value = 0x05bb }, - { .offset = 65, .value = 0x1204 }, -@@ -1273,6 +1327,7 @@ static const struct board_info __initcon - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, -+ &board_AR5381u, - &board_AR5387un, - &board_963281TAN, - &board_A4001N1, -@@ -1344,6 +1399,7 @@ static struct of_device_id const bcm963x - { .compatible = "adb,a4001n1", .data = &board_A4001N1, }, - { .compatible = "brcm,bcm963281TAN", .data = &board_963281TAN, }, - { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, -+ { .compatible = "comtrend,ar-5381u", .data = &board_AR5381u, }, - { .compatible = "comtrend,ar-5387un", .data = &board_AR5387un, }, - { .compatible = "d-link,dsl-274xb-f", .data = &board_dsl_274xb_f1, }, - #endif diff --git a/target/linux/brcm63xx/patches-4.4/533-board_rta770bw.patch b/target/linux/brcm63xx/patches-4.4/533-board_rta770bw.patch deleted file mode 100644 index 3ac6161bc..000000000 --- a/target/linux/brcm63xx/patches-4.4/533-board_rta770bw.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -411,6 +411,20 @@ static struct board_info __initdata boar - .name = "96345GW2", - .expected_cpu_id = 0x6345, - }; -+ -+static struct board_info __initdata board_rta770bw = { -+ .name = "RTA770BW", -+ .expected_cpu_id = 0x6345, -+ -+ .has_enet0 = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6345 */ - - /* -@@ -1341,6 +1355,7 @@ static const struct board_info __initcon - #endif - #ifdef CONFIG_BCM63XX_CPU_6345 - &board_96345gw2, -+ &board_rta770bw, - #endif - #ifdef CONFIG_BCM63XX_CPU_6348 - &board_96348r, -@@ -1411,6 +1426,7 @@ static struct of_device_id const bcm963x - #endif - #ifdef CONFIG_BCM63XX_CPU_6345 - { .compatible = "brcm,bcm96345gw2", .data = &board_96345gw2, }, -+ { .compatible = "dynalink,rta770bw", .data = &board_rta770bw, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6348 - { .compatible = "belkin,f5d7633", .data = &board_96348gw_10, }, diff --git a/target/linux/brcm63xx/patches-4.4/534-board_hw556.patch b/target/linux/brcm63xx/patches-4.4/534-board_hw556.patch deleted file mode 100644 index 604ffe7a3..000000000 --- a/target/linux/brcm63xx/patches-4.4/534-board_hw556.patch +++ /dev/null @@ -1,123 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1171,6 +1172,92 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_HW556_C = { -+ .name = "HW556_C", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_RALINK, -+ .caldata_offset = 0xeffe00, -+ .slot = 1, -+ .eeprom = "rt2x00.eeprom", -+ }, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+static struct board_info __initdata board_HW556_A = { -+ .name = "HW556_A", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_ATHEROS, -+ .caldata_offset = 0xf7e000, -+ .slot = 1, -+ .endian_check = 1, -+ .led_pin = 2, -+ .led_active_high = 1, -+ }, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+static struct board_info __initdata board_HW556_B = { -+ .name = "HW556_B", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_ATHEROS, -+ .caldata_offset = 0xefe000, -+ .slot = 1, -+ .endian_check = 1, -+ .led_pin = 2, -+ .led_active_high = 1, -+ }, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ - /* T-Home Speedport W 303V Typ B */ - static struct board_info __initdata board_spw303v = { - .name = "96358-502V", -@@ -1391,6 +1478,9 @@ static const struct board_info __initcon - &board_nb4_fxc_r1, - &board_ct6373_1, - &board_HW553, -+ &board_HW556_A, -+ &board_HW556_B, -+ &board_HW556_C, - &board_spw303v, - &board_DVAG3810BN, - #endif -@@ -1463,6 +1553,9 @@ static struct of_device_id const bcm963x - { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, - { .compatible = "d-link,dva-g3810bn/tl", .data = &board_DVAG3810BN, }, - { .compatible = "huawei,hg553", .data = &board_HW553, }, -+ { .compatible = "huawei,hg556a-a", .data = &board_HW556_A, }, -+ { .compatible = "huawei,hg556a-b", .data = &board_HW556_B, }, -+ { .compatible = "huawei,hg556a-c", .data = &board_HW556_C, }, - { .compatible = "pirelli,a226g", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m-fwb", .data = &board_DWVS0, }, diff --git a/target/linux/brcm63xx/patches-4.4/535-board_rta770w.patch b/target/linux/brcm63xx/patches-4.4/535-board_rta770w.patch deleted file mode 100644 index 7149ed748..000000000 --- a/target/linux/brcm63xx/patches-4.4/535-board_rta770w.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -426,6 +426,25 @@ static struct board_info __initdata boar - .force_duplex_full = 1, - }, - }; -+ -+// Actually this board is the very same as the rta770bw, -+// where the additional 'b' within the name just -+// just indicates 'Annex B'. The ADSL Modem itself is able -+// to handle both Annex A as well as Annex B - -+// the loaded firmware makes the only difference -+static struct board_info __initdata board_rta770w = { -+ .name = "RTA770W", -+ .expected_cpu_id = 0x6345, -+ -+ .has_enet0 = 1, -+ -+ .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6345 */ - - /* -@@ -1443,6 +1462,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6345 - &board_96345gw2, - &board_rta770bw, -+ &board_rta770w, - #endif - #ifdef CONFIG_BCM63XX_CPU_6348 - &board_96348r, -@@ -1517,6 +1537,7 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6345 - { .compatible = "brcm,bcm96345gw2", .data = &board_96345gw2, }, - { .compatible = "dynalink,rta770bw", .data = &board_rta770bw, }, -+ { .compatible = "dynalink,rta770w", .data = &board_rta770w, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6348 - { .compatible = "belkin,f5d7633", .data = &board_96348gw_10, }, diff --git a/target/linux/brcm63xx/patches-4.4/536-board_fast2704.patch b/target/linux/brcm63xx/patches-4.4/536-board_fast2704.patch deleted file mode 100644 index 888854a9c..000000000 --- a/target/linux/brcm63xx/patches-4.4/536-board_fast2704.patch +++ /dev/null @@ -1,74 +0,0 @@ -From: Marcin Jurkowski -Date: Thu, 31 Oct 2013 22:33:10 +0000 -Subject: [PATCH] bcm63xx: Add kernel support for Sagemcom F@ST2704V2 ADSL - router - -This adds kernel support support for Sagemcom F@st 2704 wireless ADSL -router. -It's a BCM6328-based 802.11n wireless router with USB port and ADSL2+ -modem equipped with 64 MiB RAM and 8 MiB flash. - -Signed-off-by: Marcin Jurkowski ---- ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -341,6 +341,43 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct board_info __initdata board_FAST2704V2 = { -+ .name = "F@ST2704V2", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .has_usbd = 1, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6328 */ - - /* -@@ -1452,6 +1489,7 @@ static const struct board_info __initcon - &board_963281TAN, - &board_A4001N1, - &board_dsl_274xb_f1, -+ &board_FAST2704V2, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 - &board_96338gw, -@@ -1527,6 +1565,7 @@ static struct of_device_id const bcm963x - { .compatible = "comtrend,ar-5381u", .data = &board_AR5381u, }, - { .compatible = "comtrend,ar-5387un", .data = &board_AR5387un, }, - { .compatible = "d-link,dsl-274xb-f", .data = &board_dsl_274xb_f1, }, -+ { .compatible = "sagem,f@st2704v2", .data = &board_FAST2704V2, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 - { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, diff --git a/target/linux/brcm63xx/patches-4.4/537-board_fast2504n.patch b/target/linux/brcm63xx/patches-4.4/537-board_fast2504n.patch deleted file mode 100644 index 3472d90e9..000000000 --- a/target/linux/brcm63xx/patches-4.4/537-board_fast2504n.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Max Staudt -Date: Wed, 15 Jan 2014 18:51:13 +0000 -Subject: [PATCH] brcm63xx: F@ST2504n board support (Linux-3.10.26) - -Signed-off-by: Max Staudt ---- ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1382,6 +1382,41 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct board_info __initdata board_fast2504n = { -+ .name = "F@ST2504n", -+ .expected_cpu_id = 0x6362, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6362 */ - - /* -@@ -1545,6 +1580,7 @@ static const struct board_info __initcon - - #ifdef CONFIG_BCM63XX_CPU_6362 - &board_nb6, -+ &board_fast2504n, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6368 -@@ -1626,6 +1662,7 @@ static struct of_device_id const bcm963x - { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6362 -+ { .compatible = "sagem,f@st2504n", .data = &board_fast2504n, }, - { .compatible = "sfr,nb6-ser-r0", .data = &board_nb6, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6368 diff --git a/target/linux/brcm63xx/patches-4.4/555-board_96318ref.patch b/target/linux/brcm63xx/patches-4.4/555-board_96318ref.patch deleted file mode 100644 index c7eadf1b8..000000000 --- a/target/linux/brcm63xx/patches-4.4/555-board_96318ref.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -50,6 +50,55 @@ static struct board_info __initdata boar - #endif /* CONFIG_BCM63XX_CPU_3368 */ - - /* -+ * known 6318 boards -+ */ -+#ifdef CONFIG_BCM63XX_CPU_6318 -+static struct board_info __initdata board_96318ref = { -+ .name = "96318REF", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ -+ .has_usbd = 1, -+ -+ .usbd = { -+ .use_fullspeed = 0, -+ .port_no = 0, -+ }, -+ -+ .has_enetsw = 1, -+ -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; -+#endif /* CONFIG_BCM63XX_CPU_6318 */ -+ -+/* - * known 6328 boards - */ - #ifdef CONFIG_BCM63XX_CPU_6328 -@@ -1517,6 +1566,9 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_3368 - &board_cvg834g, - #endif -+#ifdef CONFIG_BCM63XX_CPU_6318 -+ &board_96318ref, -+#endif - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, - &board_AR5381u, -@@ -1594,6 +1646,9 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_3368 - { .compatible = "netgear,cvg834g", .data = &board_cvg834g, }, - #endif -+#ifdef CONFIG_BCM63XX_CPU_6318 -+ { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, -+#endif - #ifdef CONFIG_BCM63XX_CPU_6328 - { .compatible = "adb,a4001n1", .data = &board_A4001N1, }, - { .compatible = "brcm,bcm963281TAN", .data = &board_963281TAN, }, diff --git a/target/linux/brcm63xx/patches-4.4/556-board_96318ref_p300.patch b/target/linux/brcm63xx/patches-4.4/556-board_96318ref_p300.patch deleted file mode 100644 index 162ecb7c3..000000000 --- a/target/linux/brcm63xx/patches-4.4/556-board_96318ref_p300.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -96,6 +96,50 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct board_info __initdata board_96318ref_p300 = { -+ .name = "96318REF_P300", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ -+ .has_usbd = 1, -+ -+ .usbd = { -+ .use_fullspeed = 0, -+ .port_no = 0, -+ }, -+ -+ .has_enetsw = 1, -+ -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6318 */ - - /* -@@ -1568,6 +1612,7 @@ static const struct board_info __initcon - #endif - #ifdef CONFIG_BCM63XX_CPU_6318 - &board_96318ref, -+ &board_96318ref_p300, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, -@@ -1648,6 +1693,7 @@ static struct of_device_id const bcm963x - #endif - #ifdef CONFIG_BCM63XX_CPU_6318 - { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, -+ { .compatible = "brcm,bcm96318ref_p300", .data = &board_96318ref_p300, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - { .compatible = "adb,a4001n1", .data = &board_A4001N1, }, diff --git a/target/linux/brcm63xx/patches-4.4/557-board_bcm963269bhr.patch b/target/linux/brcm63xx/patches-4.4/557-board_bcm963269bhr.patch deleted file mode 100644 index be0e7e783..000000000 --- a/target/linux/brcm63xx/patches-4.4/557-board_bcm963269bhr.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1604,6 +1604,50 @@ static struct board_info __initdata boar - #endif /* CONFIG_BCM63XX_CPU_6368 */ - - /* -+ * known 63268/63269 boards -+ */ -+#ifdef CONFIG_BCM63XX_CPU_63268 -+static struct board_info __initdata board_963269bhr = { -+ .name = "963269BHR", -+ .expected_cpu_id = 0x63268, -+ -+ .has_pci = 1, -+ -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+}; -+#endif /* CONFIG_BCM63XX_CPU_63268 */ -+ -+/* - * all boards - */ - static const struct board_info __initconst *bcm963xx_boards[] = { -@@ -1684,6 +1728,9 @@ static const struct board_info __initcon - &board_96368mvwg, - &board_96368mvngr, - #endif -+#ifdef CONFIG_BCM63XX_CPU_63268 -+ &board_963269bhr, -+#endif - }; - - static struct of_device_id const bcm963xx_boards_dt[] = { -@@ -1771,6 +1818,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 -+ { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, - #endif - #endif /* CONFIG_OF */ - { }, diff --git a/target/linux/brcm63xx/patches-4.4/558-board_AR1004G.patch b/target/linux/brcm63xx/patches-4.4/558-board_AR1004G.patch deleted file mode 100644 index dc3c13ef4..000000000 --- a/target/linux/brcm63xx/patches-4.4/558-board_AR1004G.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: "mexit@o2.pl" -Date: Sun, 24 Nov 2013 21:33:38 +0000 -Subject: [PATCH 4/5] brcm63xx: add support for Asmax AR 1004g router - -Support for Asmax AR 1004g router - -Signed-off-by: Adrian Feliks ---- ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -655,6 +655,21 @@ static struct board_info __initdata boar - .has_ehci0 = 1, - }; - -+static struct board_info __initdata board_96348gw_10_AR1004G = { -+ .name = "AR1004G", -+ .expected_cpu_id = 0x6348, -+ -+ .has_enet1 = 1, -+ .has_pci = 1, -+ -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ - - /* BT Voyager 2110 */ - static struct board_info __initdata board_V2110 = { -@@ -1699,6 +1714,7 @@ static const struct board_info __initcon - &board_96348A_122, - &board_CPVA502plus, - &board_96348W3, -+ &board_96348gw_10_AR1004G, - #endif - - #ifdef CONFIG_BCM63XX_CPU_6358 -@@ -1763,6 +1779,7 @@ static struct of_device_id const bcm963x - { .compatible = "dynalink,rta770w", .data = &board_rta770w, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6348 -+ { .compatible = "asmax,ar1004g", .data = &board_96348gw_10_AR1004G, }, - { .compatible = "belkin,f5d7633", .data = &board_96348gw_10, }, - { .compatible = "brcm,bcm96348r", .data = &board_96348r, }, - { .compatible = "brcm,bcm96348gw-10", .data = &board_96348gw_10, }, diff --git a/target/linux/brcm63xx/patches-4.4/559-board_vw6339gu.patch b/target/linux/brcm63xx/patches-4.4/559-board_vw6339gu.patch deleted file mode 100644 index dff30121b..000000000 --- a/target/linux/brcm63xx/patches-4.4/559-board_vw6339gu.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1660,6 +1660,51 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct board_info __initdata board_vw6339gu = { -+ .name = "VW6339GU", -+ .expected_cpu_id = 0x63268, -+ -+ .has_ehci0 = 1, -+ .has_ohci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "LAN2", -+ }, -+ -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN4", -+ }, -+ -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ -+ [4] = { -+ .used = 1, -+ .phy_id = 7, -+ .name = "WAN", -+ }, -+ }, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_63268 */ - - /* -@@ -1746,6 +1791,7 @@ static const struct board_info __initcon - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 - &board_963269bhr, -+ &board_vw6339gu, - #endif - }; - -@@ -1836,6 +1882,7 @@ static struct of_device_id const bcm963x - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 - { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, -+ { .compatible = "inteno,vg50", .data = &board_vw6339gu, }, - #endif - #endif /* CONFIG_OF */ - { }, diff --git a/target/linux/brcm63xx/patches-4.4/560-board_963268gu_p300.patch b/target/linux/brcm63xx/patches-4.4/560-board_963268gu_p300.patch deleted file mode 100644 index 4819fc545..000000000 --- a/target/linux/brcm63xx/patches-4.4/560-board_963268gu_p300.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1622,6 +1622,64 @@ static struct board_info __initdata boar - * known 63268/63269 boards - */ - #ifdef CONFIG_BCM63XX_CPU_63268 -+static struct board_info __initdata board_963268bu_p300 = { -+ .name = "963268BU_P300", -+ .expected_cpu_id = 0x63268, -+ -+ .has_ehci0 = 1, -+ .has_ohci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_usbd = 1, -+ -+ .usbd = { -+ .use_fullspeed = 0, -+ .port_no = 0, -+ }, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 17, -+ .name = "FE1", -+ }, -+ -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "GbE2", -+ }, -+ -+ [4] = { -+ .used = 1, -+ .phy_id = 0, -+ .name = "GbE3", -+ }, -+ -+ [5] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "GbE1", -+ }, -+ -+ [6] = { -+ .used = 1, -+ .phy_id = 24, -+ .name = "GbE4", -+ }, -+ -+ [7] = { -+ .used = 1, -+ .phy_id = 25, -+ .name = "GbE5", -+ }, -+ }, -+ }, -+}; -+ - static struct board_info __initdata board_963269bhr = { - .name = "963269BHR", - .expected_cpu_id = 0x63268, -@@ -1790,6 +1848,7 @@ static const struct board_info __initcon - &board_96368mvngr, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 -+ &board_963268bu_p300, - &board_963269bhr, - &board_vw6339gu, - #endif -@@ -1881,6 +1940,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 -+ { .compatible = "brcm,bcm963268bu_p300", .data = &board_963268bu_p300, }, - { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, - { .compatible = "inteno,vg50", .data = &board_vw6339gu, }, - #endif diff --git a/target/linux/brcm63xx/patches-4.4/561-board_WAP-5813n.patch b/target/linux/brcm63xx/patches-4.4/561-board_WAP-5813n.patch deleted file mode 100644 index 675185035..000000000 --- a/target/linux/brcm63xx/patches-4.4/561-board_WAP-5813n.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -13,6 +13,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -1616,6 +1618,47 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_ehci0 = 1, - }; -+ -+static struct sprom_fixup __initdata wap5813n_fixups[] = { -+ { .offset = 97, .value = 0xfeed }, -+ { .offset = 98, .value = 0x15d1 }, -+ { .offset = 99, .value = 0xfb0d }, -+ { .offset = 113, .value = 0xfef7 }, -+ { .offset = 114, .value = 0x15f7 }, -+ { .offset = 115, .value = 0xfb1a }, -+}; -+ -+static struct board_info __initdata board_WAP5813n = { -+ .name = "96369R-1231N", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [4] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = wap5813n_fixups, -+ .num_board_fixups = ARRAY_SIZE(wap5813n_fixups), -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6368 */ - - /* -@@ -1846,6 +1889,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6368 - &board_96368mvwg, - &board_96368mvngr, -+ &board_WAP5813n, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 - &board_963268bu_p300, -@@ -1938,6 +1982,7 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6368 - { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, -+ { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 - { .compatible = "brcm,bcm963268bu_p300", .data = &board_963268bu_p300, }, diff --git a/target/linux/brcm63xx/patches-4.4/562-board_VR-3025u.patch b/target/linux/brcm63xx/patches-4.4/562-board_VR-3025u.patch deleted file mode 100644 index 29413e947..000000000 --- a/target/linux/brcm63xx/patches-4.4/562-board_VR-3025u.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1619,6 +1619,59 @@ static struct board_info __initdata boar - .has_ehci0 = 1, - }; - -+static struct sprom_fixup __initdata vr3025u_fixups[] = { -+ { .offset = 97, .value = 0xfeb3 }, -+ { .offset = 98, .value = 0x1618 }, -+ { .offset = 99, .value = 0xfab0 }, -+ { .offset = 113, .value = 0xfed1 }, -+ { .offset = 114, .value = 0x1609 }, -+ { .offset = 115, .value = 0xfad9 }, -+}; -+ -+static struct board_info __initdata board_VR3025u = { -+ .name = "96368M-1541N", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = vr3025u_fixups, -+ .num_board_fixups = ARRAY_SIZE(vr3025u_fixups), -+ }, -+}; -+ - static struct sprom_fixup __initdata wap5813n_fixups[] = { - { .offset = 97, .value = 0xfeed }, - { .offset = 98, .value = 0x15d1 }, -@@ -1889,6 +1942,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6368 - &board_96368mvwg, - &board_96368mvngr, -+ &board_VR3025u, - &board_WAP5813n, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 -@@ -1982,6 +2036,7 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6368 - { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, -+ { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, - { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/brcm63xx/patches-4.4/563-board_VR-3025un.patch b/target/linux/brcm63xx/patches-4.4/563-board_VR-3025un.patch deleted file mode 100644 index 81ac7021c..000000000 --- a/target/linux/brcm63xx/patches-4.4/563-board_VR-3025un.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1672,6 +1672,59 @@ static struct board_info __initdata boar - }, - }; - -+static struct sprom_fixup __initdata vr3025un_fixups[] = { -+ { .offset = 97, .value = 0xfeb3 }, -+ { .offset = 98, .value = 0x1618 }, -+ { .offset = 99, .value = 0xfab0 }, -+ { .offset = 113, .value = 0xfed1 }, -+ { .offset = 114, .value = 0x1609 }, -+ { .offset = 115, .value = 0xfad9 }, -+}; -+ -+static struct board_info __initdata board_VR3025un = { -+ .name = "96368M-1341N", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = vr3025un_fixups, -+ .num_board_fixups = ARRAY_SIZE(vr3025un_fixups), -+ }, -+}; -+ - static struct sprom_fixup __initdata wap5813n_fixups[] = { - { .offset = 97, .value = 0xfeed }, - { .offset = 98, .value = 0x15d1 }, -@@ -1943,6 +1996,7 @@ static const struct board_info __initcon - &board_96368mvwg, - &board_96368mvngr, - &board_VR3025u, -+ &board_VR3025un, - &board_WAP5813n, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 -@@ -2037,6 +2091,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, - { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, -+ { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, - { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/brcm63xx/patches-4.4/564-board_P870HW-51a_v2.patch b/target/linux/brcm63xx/patches-4.4/564-board_P870HW-51a_v2.patch deleted file mode 100644 index cdab8de25..000000000 --- a/target/linux/brcm63xx/patches-4.4/564-board_P870HW-51a_v2.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1628,6 +1628,48 @@ static struct sprom_fixup __initdata vr3 - { .offset = 115, .value = 0xfad9 }, - }; - -+static struct board_info __initdata board_P870HW51A_V2 = { -+ .name = "P870HW-51a_v2", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ - static struct board_info __initdata board_VR3025u = { - .name = "96368M-1541N", - .expected_cpu_id = 0x6368, -@@ -1995,6 +2037,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6368 - &board_96368mvwg, - &board_96368mvngr, -+ &board_P870HW51A_V2, - &board_VR3025u, - &board_VR3025un, - &board_WAP5813n, -@@ -2093,6 +2136,7 @@ static struct of_device_id const bcm963x - { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, - { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, - { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, -+ { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 - { .compatible = "brcm,bcm963268bu_p300", .data = &board_963268bu_p300, }, diff --git a/target/linux/brcm63xx/patches-4.4/565-board_hw520.patch b/target/linux/brcm63xx/patches-4.4/565-board_hw520.patch deleted file mode 100644 index 75b7ef96e..000000000 --- a/target/linux/brcm63xx/patches-4.4/565-board_hw520.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1312,6 +1312,36 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_HW520 = { -+ .name = "HW6358GW_B", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ - static struct board_info __initdata board_HW553 = { - .name = "HW553", - .expected_cpu_id = 0x6358, -@@ -2021,6 +2051,7 @@ static const struct board_info __initcon - &board_nb4_ser_r0, - &board_nb4_fxc_r1, - &board_ct6373_1, -+ &board_HW520, - &board_HW553, - &board_HW556_A, - &board_HW556_B, -@@ -2113,6 +2144,7 @@ static struct of_device_id const bcm963x - { .compatible = "d-link,dsl-274xb-c2", .data = &board_dsl_274xb_rev_c, }, - { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, - { .compatible = "d-link,dva-g3810bn/tl", .data = &board_DVAG3810BN, }, -+ { .compatible = "huawei,hg520v", .data = &board_HW520, }, - { .compatible = "huawei,hg553", .data = &board_HW553, }, - { .compatible = "huawei,hg556a-a", .data = &board_HW556_A, }, - { .compatible = "huawei,hg556a-b", .data = &board_HW556_B, }, diff --git a/target/linux/brcm63xx/patches-4.4/566-board_A4001N.patch b/target/linux/brcm63xx/patches-4.4/566-board_A4001N.patch deleted file mode 100644 index 2e194a54f..000000000 --- a/target/linux/brcm63xx/patches-4.4/566-board_A4001N.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -349,6 +349,49 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_A4001N = { -+ .name = "96328dg2x2", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ - static struct board_info __initdata board_A4001N1 = { - .name = "963281T_TEF", - .expected_cpu_id = 0x6328, -@@ -2002,6 +2045,7 @@ static const struct board_info __initcon - &board_AR5381u, - &board_AR5387un, - &board_963281TAN, -+ &board_A4001N, - &board_A4001N1, - &board_dsl_274xb_f1, - &board_FAST2704V2, -@@ -2090,6 +2134,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96318ref_p300", .data = &board_96318ref_p300, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 -+ { .compatible = "adb,a4001n", .data = &board_A4001N, }, - { .compatible = "adb,a4001n1", .data = &board_A4001N1, }, - { .compatible = "brcm,bcm963281TAN", .data = &board_963281TAN, }, - { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, diff --git a/target/linux/brcm63xx/patches-4.4/567-board_dsl-2751b_e1.patch b/target/linux/brcm63xx/patches-4.4/567-board_dsl-2751b_e1.patch deleted file mode 100644 index 9852f3460..000000000 --- a/target/linux/brcm63xx/patches-4.4/567-board_dsl-2751b_e1.patch +++ /dev/null @@ -1,93 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -142,6 +142,74 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct sprom_fixup __initdata dsl2751b_e1_fixups[] = { -+ { .offset = 96, .value = 0x2046 }, -+ { .offset = 97, .value = 0xfe9d }, -+ { .offset = 98, .value = 0x1854 }, -+ { .offset = 99, .value = 0xfa59 }, -+ { .offset = 112, .value = 0x2046 }, -+ { .offset = 113, .value = 0xfe79 }, -+ { .offset = 114, .value = 0x17f5 }, -+ { .offset = 115, .value = 0xfa47 }, -+ { .offset = 161, .value = 0x2222 }, -+ { .offset = 162, .value = 0x2222 }, -+ { .offset = 169, .value = 0x2222 }, -+ { .offset = 170, .value = 0x2222 }, -+ { .offset = 171, .value = 0x5555 }, -+ { .offset = 172, .value = 0x5555 }, -+ { .offset = 173, .value = 0x4444 }, -+ { .offset = 174, .value = 0x4444 }, -+ { .offset = 175, .value = 0x5555 }, -+ { .offset = 176, .value = 0x5555 }, -+}; -+ -+static struct board_info __initdata board_dsl_2751b_d1 = { -+ .name = "AW5200B", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .has_enetsw = 1, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = dsl2751b_e1_fixups, -+ .num_board_fixups = ARRAY_SIZE(dsl2751b_e1_fixups), -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6318 */ - - /* -@@ -2039,6 +2107,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6318 - &board_96318ref, - &board_96318ref_p300, -+ &board_dsl_2751b_d1, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, -@@ -2132,6 +2201,7 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6318 - { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, - { .compatible = "brcm,bcm96318ref_p300", .data = &board_96318ref_p300, }, -+ { .compatible = "d-link,dsl-275xb-d", .data = &board_dsl_2751b_d1, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - { .compatible = "adb,a4001n", .data = &board_A4001N, }, diff --git a/target/linux/brcm63xx/patches-4.4/568-board_DGND3700v1_3800B.patch b/target/linux/brcm63xx/patches-4.4/568-board_DGND3700v1_3800B.patch deleted file mode 100644 index cc31a8188..000000000 --- a/target/linux/brcm63xx/patches-4.4/568-board_DGND3700v1_3800B.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1760,6 +1760,30 @@ static struct board_info __initdata boar - .has_ehci0 = 1, - }; - -+static struct board_info __initdata board_DGND3700v1_3800B = { -+ .name = "DGND3700v1_3800B", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [5] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+ - static struct sprom_fixup __initdata vr3025u_fixups[] = { - { .offset = 97, .value = 0xfeb3 }, - { .offset = 98, .value = 0x1618 }, -@@ -2181,6 +2205,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6368 - &board_96368mvwg, - &board_96368mvngr, -+ &board_DGND3700v1_3800B, - &board_P870HW51A_V2, - &board_VR3025u, - &board_VR3025un, -@@ -2283,6 +2308,7 @@ static struct of_device_id const bcm963x - { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, - { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, - { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, -+ { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, }, - { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/brcm63xx/patches-4.4/569-board_homehub2a.patch b/target/linux/brcm63xx/patches-4.4/569-board_homehub2a.patch deleted file mode 100644 index 8dca58683..000000000 --- a/target/linux/brcm63xx/patches-4.4/569-board_homehub2a.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1423,6 +1423,31 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_homehub2a = { -+ .name = "HOMEHUB2A", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM4322, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ - static struct board_info __initdata board_HW520 = { - .name = "HW6358GW_B", - .expected_cpu_id = 0x6358, -@@ -2188,6 +2213,7 @@ static const struct board_info __initcon - &board_nb4_ser_r0, - &board_nb4_fxc_r1, - &board_ct6373_1, -+ &board_homehub2a, - &board_HW520, - &board_HW553, - &board_HW556_A, -@@ -2297,6 +2323,7 @@ static struct of_device_id const bcm963x - { .compatible = "sfr,nb4-fxc-r1", .data = &board_nb4_fxc_r1, }, - { .compatible = "t-com,spw303v", .data = &board_spw303v, }, - { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, -+ { .compatible = "thomson,homehub2a", .data = &board_homehub2a, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6362 - { .compatible = "sagem,f@st2504n", .data = &board_fast2504n, }, diff --git a/target/linux/brcm63xx/patches-4.4/570-board_HG655b.patch b/target/linux/brcm63xx/patches-4.4/570-board_HG655b.patch deleted file mode 100644 index 8fa9112b8..000000000 --- a/target/linux/brcm63xx/patches-4.4/570-board_HG655b.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1809,6 +1809,52 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_HG655b = { -+ .name = "HW65x", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_RALINK, -+ .caldata_offset = 0x7c0000, -+ .slot = 1, -+ .eeprom = "rt2x00.eeprom", -+ }, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+}; -+ - static struct sprom_fixup __initdata vr3025u_fixups[] = { - { .offset = 97, .value = 0xfeb3 }, - { .offset = 98, .value = 0x1618 }, -@@ -2232,6 +2278,7 @@ static const struct board_info __initcon - &board_96368mvwg, - &board_96368mvngr, - &board_DGND3700v1_3800B, -+ &board_HG655b, - &board_P870HW51A_V2, - &board_VR3025u, - &board_VR3025un, -@@ -2335,6 +2382,7 @@ static struct of_device_id const bcm963x - { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, - { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, - { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, -+ { .compatible = "huawei,hg655b", .data = &board_HG655b, }, - { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, }, - { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, - #endif diff --git a/target/linux/brcm63xx/patches-4.4/571-board_fast2704n.patch b/target/linux/brcm63xx/patches-4.4/571-board_fast2704n.patch deleted file mode 100644 index bdae1a7e4..000000000 --- a/target/linux/brcm63xx/patches-4.4/571-board_fast2704n.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -210,6 +210,45 @@ static struct board_info __initdata boar - .num_board_fixups = ARRAY_SIZE(dsl2751b_e1_fixups), - }, - }; -+ -+static struct board_info __initdata board_FAST2704N = { -+ .name = "F@ST2704N", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .has_enetsw = 1, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6318 */ - - /* -@@ -2203,6 +2242,7 @@ static const struct board_info __initcon - &board_96318ref, - &board_96318ref_p300, - &board_dsl_2751b_d1, -+ &board_FAST2704N, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, -@@ -2300,6 +2340,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, - { .compatible = "brcm,bcm96318ref_p300", .data = &board_96318ref_p300, }, - { .compatible = "d-link,dsl-275xb-d", .data = &board_dsl_2751b_d1, }, -+ { .compatible = "sagem,f@st2704n", .data = &board_FAST2704N, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - { .compatible = "adb,a4001n", .data = &board_A4001N, }, diff --git a/target/linux/brcm63xx/patches-4.4/572-board_VR-3026e.patch b/target/linux/brcm63xx/patches-4.4/572-board_VR-3026e.patch deleted file mode 100644 index 260424bee..000000000 --- a/target/linux/brcm63xx/patches-4.4/572-board_VR-3026e.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -2042,6 +2042,59 @@ static struct board_info __initdata boar - }, - }; - -+static struct sprom_fixup __initdata vr3026e_fixups[] = { -+ { .offset = 97, .value = 0xfeb3 }, -+ { .offset = 98, .value = 0x1618 }, -+ { .offset = 99, .value = 0xfab0 }, -+ { .offset = 113, .value = 0xfed1 }, -+ { .offset = 114, .value = 0x1609 }, -+ { .offset = 115, .value = 0xfad9 }, -+}; -+ -+static struct board_info __initdata board_VR3026e = { -+ .name = "96368MT-1341N1", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = vr3026e_fixups, -+ .num_board_fixups = ARRAY_SIZE(vr3026e_fixups), -+ }, -+}; -+ - static struct sprom_fixup __initdata wap5813n_fixups[] = { - { .offset = 97, .value = 0xfeed }, - { .offset = 98, .value = 0x15d1 }, -@@ -2322,6 +2375,7 @@ static const struct board_info __initcon - &board_P870HW51A_V2, - &board_VR3025u, - &board_VR3025un, -+ &board_VR3026e, - &board_WAP5813n, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 -@@ -2422,6 +2476,7 @@ static struct of_device_id const bcm963x - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, - { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, - { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, -+ { .compatible = "comtrend,vr-3026e", .data = &board_VR3026e, }, - { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, - { .compatible = "huawei,hg655b", .data = &board_HG655b, }, - { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, }, diff --git a/target/linux/brcm63xx/patches-4.4/573-board_R5010UNv2.patch b/target/linux/brcm63xx/patches-4.4/573-board_R5010UNv2.patch deleted file mode 100644 index 2764846a0..000000000 --- a/target/linux/brcm63xx/patches-4.4/573-board_R5010UNv2.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -623,6 +623,50 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct board_info __initdata board_R5010UNV2 = { -+ .name = "96328ang", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ - #endif /* CONFIG_BCM63XX_CPU_6328 */ - - /* -@@ -2306,6 +2350,7 @@ static const struct board_info __initcon - &board_A4001N1, - &board_dsl_274xb_f1, - &board_FAST2704V2, -+ &board_R5010UNV2, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 - &board_96338gw, -@@ -2404,6 +2449,7 @@ static struct of_device_id const bcm963x - { .compatible = "comtrend,ar-5381u", .data = &board_AR5381u, }, - { .compatible = "comtrend,ar-5387un", .data = &board_AR5387un, }, - { .compatible = "d-link,dsl-274xb-f", .data = &board_dsl_274xb_f1, }, -+ { .compatible = "nucom,r5010unv2", .data = &board_R5010UNV2, }, - { .compatible = "sagem,f@st2704v2", .data = &board_FAST2704V2, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 diff --git a/target/linux/brcm63xx/patches-4.4/574-board_HG622.patch b/target/linux/brcm63xx/patches-4.4/574-board_HG622.patch deleted file mode 100644 index 860c0e787..000000000 --- a/target/linux/brcm63xx/patches-4.4/574-board_HG622.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1938,6 +1938,52 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_HG622 = { -+ .name = "96368MVWG_hg622", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_RALINK, -+ .caldata_offset = 0xfa0000, -+ .slot = 1, -+ .eeprom = "rt2x00.eeprom", -+ }, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+}; -+ - static struct sprom_fixup __initdata vr3025u_fixups[] = { - { .offset = 97, .value = 0xfeb3 }, - { .offset = 98, .value = 0x1618 }, -@@ -2416,6 +2462,7 @@ static const struct board_info __initcon - &board_96368mvwg, - &board_96368mvngr, - &board_DGND3700v1_3800B, -+ &board_HG622, - &board_HG655b, - &board_P870HW51A_V2, - &board_VR3025u, -@@ -2524,6 +2571,7 @@ static struct of_device_id const bcm963x - { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, - { .compatible = "comtrend,vr-3026e", .data = &board_VR3026e, }, - { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, -+ { .compatible = "huawei,hg622", .data = &board_HG622, }, - { .compatible = "huawei,hg655b", .data = &board_HG655b, }, - { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, }, - { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, diff --git a/target/linux/brcm63xx/patches-4.4/575-board_EVG2000.patch b/target/linux/brcm63xx/patches-4.4/575-board_EVG2000.patch deleted file mode 100644 index 4c9d19ac6..000000000 --- a/target/linux/brcm63xx/patches-4.4/575-board_EVG2000.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1892,6 +1892,42 @@ static struct board_info __initdata boar - }, - }; - -+static struct sprom_fixup __initdata EVG2000_fixups[] = { -+ { .offset = 219, .value = 0xec08 }, -+}; -+ -+static struct board_info __initdata board_EVG2000 = { -+ .name = "96369PVG", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [5] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4322, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = EVG2000_fixups, -+ .num_board_fixups = ARRAY_SIZE(EVG2000_fixups), -+ }, -+}; -+ - static struct board_info __initdata board_HG655b = { - .name = "HW65x", - .expected_cpu_id = 0x6368, -@@ -2462,6 +2498,7 @@ static const struct board_info __initcon - &board_96368mvwg, - &board_96368mvngr, - &board_DGND3700v1_3800B, -+ &board_EVG2000, - &board_HG622, - &board_HG655b, - &board_P870HW51A_V2, -@@ -2574,6 +2611,7 @@ static struct of_device_id const bcm963x - { .compatible = "huawei,hg622", .data = &board_HG622, }, - { .compatible = "huawei,hg655b", .data = &board_HG655b, }, - { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, }, -+ { .compatible = "netgear,evg2000", .data = &board_EVG2000, }, - { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/brcm63xx/patches-4.4/576-board_AV4202N.patch b/target/linux/brcm63xx/patches-4.4/576-board_AV4202N.patch deleted file mode 100644 index 927ce2735..000000000 --- a/target/linux/brcm63xx/patches-4.4/576-board_AV4202N.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1782,6 +1782,51 @@ static struct board_info __initdata boar - * known 6368 boards - */ - #ifdef CONFIG_BCM63XX_CPU_6368 -+static struct board_info __initdata board_AV4202N = { -+ .name = "96368_Swiss_S1", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+ -+}; -+ - static struct board_info __initdata board_96368mvwg = { - .name = "96368MVWG", - .expected_cpu_id = 0x6368, -@@ -2495,6 +2540,7 @@ static const struct board_info __initcon - #endif - - #ifdef CONFIG_BCM63XX_CPU_6368 -+ &board_AV4202N, - &board_96368mvwg, - &board_96368mvngr, - &board_DGND3700v1_3800B, -@@ -2602,6 +2648,7 @@ static struct of_device_id const bcm963x - { .compatible = "sfr,nb6-ser-r0", .data = &board_nb6, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6368 -+ { .compatible = "adb,av4202n", .data = &board_AV4202N, }, - { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, - { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, diff --git a/target/linux/brcm63xx/patches-4.4/577-board_VH4032N.patch b/target/linux/brcm63xx/patches-4.4/577-board_VH4032N.patch deleted file mode 100644 index e9bf9a768..000000000 --- a/target/linux/brcm63xx/patches-4.4/577-board_VH4032N.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -2266,6 +2266,44 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_VH4032N = { -+ .name = "VH4032N", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "LAN4", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN2", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+}; -+ - static struct sprom_fixup __initdata wap5813n_fixups[] = { - { .offset = 97, .value = 0xfeed }, - { .offset = 98, .value = 0x15d1 }, -@@ -2548,6 +2586,7 @@ static const struct board_info __initcon - &board_HG622, - &board_HG655b, - &board_P870HW51A_V2, -+ &board_VH4032N, - &board_VR3025u, - &board_VR3025un, - &board_VR3026e, -@@ -2659,6 +2698,7 @@ static struct of_device_id const bcm963x - { .compatible = "huawei,hg655b", .data = &board_HG655b, }, - { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, }, - { .compatible = "netgear,evg2000", .data = &board_EVG2000, }, -+ { .compatible = "observa,vh4032n", .data = &board_VH4032N, }, - { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/brcm63xx/patches-4.4/578-board_R1000H.patch b/target/linux/brcm63xx/patches-4.4/578-board_R1000H.patch deleted file mode 100644 index 4b4b1a0de..000000000 --- a/target/linux/brcm63xx/patches-4.4/578-board_R1000H.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -2116,6 +2116,29 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_R1000H = { -+ .name = "R1000H", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [5] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+ - static struct board_info __initdata board_VR3025u = { - .name = "96368M-1541N", - .expected_cpu_id = 0x6368, -@@ -2586,6 +2609,7 @@ static const struct board_info __initcon - &board_HG622, - &board_HG655b, - &board_P870HW51A_V2, -+ &board_R1000H, - &board_VH4032N, - &board_VR3025u, - &board_VR3025un, -@@ -2687,6 +2711,7 @@ static struct of_device_id const bcm963x - { .compatible = "sfr,nb6-ser-r0", .data = &board_nb6, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6368 -+ { .compatible = "actiontec,r1000h", .data = &board_R1000H, }, - { .compatible = "adb,av4202n", .data = &board_AV4202N, }, - { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, - { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, diff --git a/target/linux/brcm63xx/patches-4.4/579-board_AR-5315u.patch b/target/linux/brcm63xx/patches-4.4/579-board_AR-5315u.patch deleted file mode 100644 index 1974ccd81..000000000 --- a/target/linux/brcm63xx/patches-4.4/579-board_AR-5315u.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -143,6 +143,67 @@ static struct board_info __initdata boar - }, - }; - -+static struct sprom_fixup __initdata ar5315u_fixups[] = { -+ { .offset = 6, .value = 0x1c00 }, -+ { .offset = 65, .value = 0x1255 }, -+ { .offset = 97, .value = 0xfe55 }, -+ { .offset = 98, .value = 0x171d }, -+ { .offset = 99, .value = 0xfa42 }, -+ { .offset = 113, .value = 0xfeb7 }, -+ { .offset = 114, .value = 0x18cd }, -+ { .offset = 115, .value = 0xfa4f }, -+ { .offset = 162, .value = 0x6444 }, -+ { .offset = 170, .value = 0x6444 }, -+ { .offset = 172, .value = 0x6444 }, -+}; -+ -+static struct board_info __initdata board_AR5315u = { -+ .name = "96318A-1441N1", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .has_enetsw = 1, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "LAN4", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN2", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = ar5315u_fixups, -+ .num_board_fixups = ARRAY_SIZE(ar5315u_fixups), -+ }, -+}; -+ - static struct sprom_fixup __initdata dsl2751b_e1_fixups[] = { - { .offset = 96, .value = 0x2046 }, - { .offset = 97, .value = 0xfe9d }, -@@ -2526,6 +2587,7 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6318 - &board_96318ref, - &board_96318ref_p300, -+ &board_AR5315u, - &board_dsl_2751b_d1, - &board_FAST2704N, - #endif -@@ -2631,6 +2693,7 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6318 - { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, - { .compatible = "brcm,bcm96318ref_p300", .data = &board_96318ref_p300, }, -+ { .compatible = "comtrend,ar-5315u", .data = &board_AR5315u, }, - { .compatible = "d-link,dsl-275xb-d", .data = &board_dsl_2751b_d1, }, - { .compatible = "sagem,f@st2704n", .data = &board_FAST2704N, }, - #endif diff --git a/target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch b/target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch deleted file mode 100644 index 7b28a24e3..000000000 --- a/target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -357,6 +357,73 @@ static struct board_info __initdata boar - }, - }; - -+static struct sprom_fixup __initdata ad1018_fixups[] = { -+ { .offset = 6, .value = 0x1c00 }, -+ { .offset = 65, .value = 0x1256 }, -+ { .offset = 96, .value = 0x2046 }, -+ { .offset = 97, .value = 0xfe69 }, -+ { .offset = 98, .value = 0x1726 }, -+ { .offset = 99, .value = 0xfa5c }, -+ { .offset = 112, .value = 0x2046 }, -+ { .offset = 113, .value = 0xfea8 }, -+ { .offset = 114, .value = 0x1978 }, -+ { .offset = 115, .value = 0xfa26 }, -+ { .offset = 161, .value = 0x2222 }, -+ { .offset = 169, .value = 0x2222 }, -+ { .offset = 171, .value = 0x2222 }, -+ { .offset = 173, .value = 0x2222 }, -+ { .offset = 174, .value = 0x4444 }, -+ { .offset = 175, .value = 0x2222 }, -+ { .offset = 176, .value = 0x4444 }, -+}; -+ -+static struct board_info __initdata board_AD1018 = { -+ .name = "96328avngr", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .use_fallback_sprom = 1, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "FIBRE", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN2", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ }, -+ }, -+ -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = ad1018_fixups, -+ .num_board_fixups = ARRAY_SIZE(ad1018_fixups), -+ }, -+}; -+ - static struct sprom_fixup __initdata ar5381u_fixups[] = { - { .offset = 97, .value = 0xfee5 }, - { .offset = 98, .value = 0x157c }, -@@ -2593,6 +2660,7 @@ static const struct board_info __initcon - #endif - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, -+ &board_AD1018, - &board_AR5381u, - &board_AR5387un, - &board_963281TAN, -@@ -2707,6 +2775,7 @@ static struct of_device_id const bcm963x - { .compatible = "d-link,dsl-274xb-f", .data = &board_dsl_274xb_f1, }, - { .compatible = "nucom,r5010unv2", .data = &board_R5010UNV2, }, - { .compatible = "sagem,f@st2704v2", .data = &board_FAST2704V2, }, -+ { .compatible = "sercomm,ad1018-nor", .data = &board_AD1018, }, - #endif - #ifdef CONFIG_BCM63XX_CPU_6338 - { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, diff --git a/target/linux/brcm63xx/patches-4.4/800-wl_exports.patch b/target/linux/brcm63xx/patches-4.4/800-wl_exports.patch deleted file mode 100644 index 68d37c750..000000000 --- a/target/linux/brcm63xx/patches-4.4/800-wl_exports.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/arch/mips/bcm63xx/nvram.c -+++ b/arch/mips/bcm63xx/nvram.c -@@ -40,6 +40,12 @@ struct bcm963xx_nvram { - static struct bcm963xx_nvram nvram; - static int mac_addr_used; - -+/* -+ * Required export for WL -+ */ -+u32 nvram_buf[5] = { 0, cpu_to_le32(20), 0, 0, 0 }; -+EXPORT_SYMBOL(nvram_buf); -+ - void __init bcm63xx_nvram_init(void *addr) - { - unsigned int check_len; ---- a/arch/mips/mm/cache.c -+++ b/arch/mips/mm/cache.c -@@ -59,6 +59,7 @@ void (*_dma_cache_wback)(unsigned long s - void (*_dma_cache_inv)(unsigned long start, unsigned long size); - - EXPORT_SYMBOL(_dma_cache_wback_inv); -+EXPORT_SYMBOL(_dma_cache_inv); - - #endif /* CONFIG_DMA_NONCOHERENT || CONFIG_DMA_MAYBE_COHERENT */ - diff --git a/target/linux/brcm63xx/patches-4.4/801-ssb_export_fallback_sprom.patch b/target/linux/brcm63xx/patches-4.4/801-ssb_export_fallback_sprom.patch deleted file mode 100644 index 11a83536b..000000000 --- a/target/linux/brcm63xx/patches-4.4/801-ssb_export_fallback_sprom.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -8,6 +8,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -387,7 +388,19 @@ struct fallback_sprom_match { - struct ssb_sprom sprom; - }; - --static struct fallback_sprom_match fallback_sprom; -+struct fallback_sprom_match fallback_sprom; -+ -+int bcm63xx_get_fallback_sprom(uint pci_bus, uint pci_slot, struct ssb_sprom *out) -+{ -+ if (pci_bus != fallback_sprom.pci_bus || -+ pci_slot != fallback_sprom.pci_dev) -+ pr_warn("fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n", -+ fallback_sprom.pci_bus, fallback_sprom.pci_dev, -+ pci_bus, pci_slot); -+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); -+ return 0; -+} -+EXPORT_SYMBOL(bcm63xx_get_fallback_sprom); - - #if defined(CONFIG_SSB_PCIHOST) - int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out) diff --git a/target/linux/brcm63xx/patches-4.4/802-rtl8367r_fix_RGMII_support.patch b/target/linux/brcm63xx/patches-4.4/802-rtl8367r_fix_RGMII_support.patch deleted file mode 100644 index 2aca2f3f7..000000000 --- a/target/linux/brcm63xx/patches-4.4/802-rtl8367r_fix_RGMII_support.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e3208e6087642b95a5bab3101fc9c6e34892c861 Mon Sep 17 00:00:00 2001 -From: Miguel GAIO -Date: Fri, 6 Jul 2012 14:12:33 +0200 -Subject: [PATCH 6/8] * [rtl8367r] Fix RGMII support - ---- - drivers/net/phy/rtl8367.c | 5 +++++ - 1 files changed, 5 insertions(+), 0 deletions(-) - ---- a/drivers/net/phy/rtl8367.c -+++ b/drivers/net/phy/rtl8367.c -@@ -146,6 +146,10 @@ - #define RTL8367_EXT_RGMXF_TXDELAY_MASK 1 - #define RTL8367_EXT_RGMXF_RXDELAY_MASK 0x7 - -+#define RTL8367_PHY_AD_REG 0x130f -+#define RTL8370_PHY_AD_DUMMY_1_OFFSET 5 -+#define RTL8370_PHY_AD_DUMMY_1_MASK 0xe0 -+ - #define RTL8367_DI_FORCE_REG(_x) (0x1310 + (_x)) - #define RTL8367_DI_FORCE_MODE BIT(12) - #define RTL8367_DI_FORCE_NWAY BIT(7) -@@ -897,6 +901,7 @@ static int rtl8367_extif_set_mode(struct - case RTL8367_EXTIF_MODE_RGMII_33V: - REG_WR(smi, RTL8367_CHIP_DEBUG0_REG, 0x0367); - REG_WR(smi, RTL8367_CHIP_DEBUG1_REG, 0x7777); -+ REG_RMW(smi, RTL8367_PHY_AD_REG, BIT(5), 0); - break; - - case RTL8367_EXTIF_MODE_TMII_MAC: diff --git a/target/linux/brcm63xx/patches-4.4/803-jffs2-work-around-unaligned-accesses-failing-on-bcm6.patch b/target/linux/brcm63xx/patches-4.4/803-jffs2-work-around-unaligned-accesses-failing-on-bcm6.patch deleted file mode 100644 index 7a3c2f01c..000000000 --- a/target/linux/brcm63xx/patches-4.4/803-jffs2-work-around-unaligned-accesses-failing-on-bcm6.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ff3409ab17d56450943364ba49a16960e3cdda9b Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 6 Apr 2014 22:33:16 +0200 -Subject: [RFC] jffs2: work around unaligned accesses failing on bcm63xx/smp - -Unligned memcpy_fromio randomly fails with an unaligned dst. Work around -it by ensuring we are always doing aligned copies. - -Should fix filename corruption in jffs2 with SMP. - -Signed-off-by: Jonas Gorski ---- - fs/jffs2/nodelist.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/fs/jffs2/nodelist.h -+++ b/fs/jffs2/nodelist.h -@@ -259,7 +259,7 @@ struct jffs2_full_dirent - uint32_t ino; /* == zero for unlink */ - unsigned int nhash; - unsigned char type; -- unsigned char name[0]; -+ unsigned char name[0] __attribute__((aligned((sizeof(long))))); - }; - - /* diff --git a/target/linux/brcm63xx/patches-4.4/804-bcm63xx_enet_63268_rgmii_ports.patch b/target/linux/brcm63xx/patches-4.4/804-bcm63xx_enet_63268_rgmii_ports.patch deleted file mode 100644 index 5949f890e..000000000 --- a/target/linux/brcm63xx/patches-4.4/804-bcm63xx_enet_63268_rgmii_ports.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2259,6 +2259,10 @@ static int bcm_enetsw_open(struct net_de - - rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i)); - rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN; -+ if (BCMCPU_IS_63268()) { -+ rgmii_ctrl |= ENETSW_RGMII_CTRL_TIMING_SEL_EN; -+ rgmii_ctrl |= ENETSW_RGMII_CTRL_MII_OVERRIDE_EN; -+ } - enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i)); - } - diff --git a/target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch b/target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch deleted file mode 100644 index 9d41b3cce..000000000 --- a/target/linux/brcm63xx/patches-4.9/001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 80a79a889ce5df16c5261ab2f1e8e63b94b78102 Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Fri, 28 Oct 2016 07:58:46 +0200 -Subject: [PATCH 1/8] mtd: m25p80: consider max message size in m25p80_read - -Consider a message size limit when calculating the maximum amount -of data that can be read. - -The message size limit has been introduced with 4.9, so cc it -to stable. - -Signed-off-by: Heiner Kallweit -Cc: # 4.9.x -Signed-off-by: Cyrille Pitchen ---- - drivers/mtd/devices/m25p80.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -174,7 +174,8 @@ static ssize_t m25p80_read(struct spi_no - - t[1].rx_buf = buf; - t[1].rx_nbits = m25p80_rx_nbits(nor); -- t[1].len = min(len, spi_max_transfer_size(spi)); -+ t[1].len = min3(len, spi_max_transfer_size(spi), -+ spi_max_message_size(spi) - t[0].len); - spi_message_add_tail(&t[1], &m); - - ret = spi_sync(spi, &m); diff --git a/target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch b/target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch deleted file mode 100644 index d1d851678..000000000 --- a/target/linux/brcm63xx/patches-4.9/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch +++ /dev/null @@ -1,101 +0,0 @@ -From d0423d3e4fa7ae305729cb50369427f075ccb279 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 25 Feb 2017 12:41:28 +0100 -Subject: [PATCH 1/6] bcm63xx_enet: correct clock usage - -Check the return code of prepare_enable and change one last instance of -enable only to prepare_enable. Also properly disable and release the -clock in error paths and on remove for enetsw. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 31 +++++++++++++++++++++------- - 1 file changed, 23 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1790,7 +1790,9 @@ static int bcm_enet_probe(struct platfor - ret = PTR_ERR(priv->mac_clk); - goto out; - } -- clk_prepare_enable(priv->mac_clk); -+ ret = clk_prepare_enable(priv->mac_clk); -+ if (ret) -+ goto out_put_clk_mac; - - /* initialize default and fetch platform data */ - priv->rx_ring_size = BCMENET_DEF_RX_DESC; -@@ -1822,9 +1824,11 @@ static int bcm_enet_probe(struct platfor - if (IS_ERR(priv->phy_clk)) { - ret = PTR_ERR(priv->phy_clk); - priv->phy_clk = NULL; -- goto out_put_clk_mac; -+ goto out_disable_clk_mac; - } -- clk_prepare_enable(priv->phy_clk); -+ ret = clk_prepare_enable(priv->phy_clk); -+ if (ret) -+ goto out_put_clk_phy; - } - - /* do minimal hardware init to be able to probe mii bus */ -@@ -1915,13 +1919,16 @@ out_free_mdio: - out_uninit_hw: - /* turn off mdc clock */ - enet_writel(priv, 0, ENET_MIISC_REG); -- if (priv->phy_clk) { -+ if (priv->phy_clk) - clk_disable_unprepare(priv->phy_clk); -+ -+out_put_clk_phy: -+ if (priv->phy_clk) - clk_put(priv->phy_clk); -- } - --out_put_clk_mac: -+out_disable_clk_mac: - clk_disable_unprepare(priv->mac_clk); -+out_put_clk_mac: - clk_put(priv->mac_clk); - out: - free_netdev(dev); -@@ -2766,7 +2773,9 @@ static int bcm_enetsw_probe(struct platf - ret = PTR_ERR(priv->mac_clk); - goto out_unmap; - } -- clk_enable(priv->mac_clk); -+ ret = clk_prepare_enable(priv->mac_clk); -+ if (ret) -+ goto out_put_clk; - - priv->rx_chan = 0; - priv->tx_chan = 1; -@@ -2787,7 +2796,7 @@ static int bcm_enetsw_probe(struct platf - - ret = register_netdev(dev); - if (ret) -- goto out_put_clk; -+ goto out_disable_clk; - - netif_carrier_off(dev); - platform_set_drvdata(pdev, dev); -@@ -2796,6 +2805,9 @@ static int bcm_enetsw_probe(struct platf - - return 0; - -+out_disable_clk: -+ clk_disable_unprepare(priv->mac_clk); -+ - out_put_clk: - clk_put(priv->mac_clk); - -@@ -2827,6 +2839,9 @@ static int bcm_enetsw_remove(struct plat - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res->start, resource_size(res)); - -+ clk_disable_unprepare(priv->mac_clk); -+ clk_put(priv->mac_clk); -+ - free_netdev(dev); - return 0; - } diff --git a/target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch b/target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch deleted file mode 100644 index 22c6d0187..000000000 --- a/target/linux/brcm63xx/patches-4.9/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 23d94cb855b6f4f0ee1c01679224472104ac6440 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 30 Sep 2017 14:10:18 +0200 -Subject: [PATCH 2/6] bcm63xx_enet: do not write to random DMA channel on - BCM6345 - -The DMA controller regs actually point to DMA channel 0, so the write to -ENETDMA_CFG_REG will actually modify a random DMA channel. - -Since DMA controller registers do not exist on BCM6345, guard the write -with the usual check for dma_has_sram. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1063,7 +1063,8 @@ static int bcm_enet_open(struct net_devi - val = enet_readl(priv, ENET_CTL_REG); - val |= ENET_CTL_ENABLE_MASK; - enet_writel(priv, val, ENET_CTL_REG); -- enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); -+ if (priv->dma_has_sram) -+ enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); - enet_dmac_writel(priv, priv->dma_chan_en_mask, - ENETDMAC_CHANCFG, priv->rx_chan); - diff --git a/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch b/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch new file mode 100644 index 000000000..a3e9ce86a --- /dev/null +++ b/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch @@ -0,0 +1,81 @@ +From e62ff8f02eb3ae35ae7ece7c5272a689fd8b0bcd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 27 Jul 2018 21:37:48 +0200 +Subject: [PATCH] Revert "mtd: partitions: use DT info for parsing partitions + with "compatible" prop" + +This reverts commit 76a832254ab05502c9394cc51ded6f0abe0e0bee. +--- + drivers/mtd/mtdpart.c | 33 ++++++++++++++++++++------------- + 1 file changed, 20 insertions(+), 13 deletions(-) + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -453,6 +453,22 @@ static inline void free_partition(struct + kfree(p); + } + ++/** ++ * mtd_parse_part - parse MTD partition looking for subpartitions ++ * ++ * @slave: part that is supposed to be a container and should be parsed ++ * @types: NULL-terminated array with names of partition parsers to try ++ * ++ * Some partitions are kind of containers with extra subpartitions (volumes). ++ * There can be various formats of such containers. This function tries to use ++ * specified parsers to analyze given partition and registers found ++ * subpartitions on success. ++ */ ++static int mtd_parse_part(struct mtd_part *slave, const char *const *types) ++{ ++ return parse_mtd_partitions(&slave->mtd, types, NULL); ++} ++ + static struct mtd_part *allocate_partition(struct mtd_info *parent, + const struct mtd_partition *part, int partno, + uint64_t cur_offset) +@@ -924,8 +940,8 @@ int add_mtd_partitions(struct mtd_info * + add_mtd_device(&slave->mtd); + mtd_partition_split(master, slave); + mtd_add_partition_attrs(slave); +- /* Look for subpartitions */ +- parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); ++ if (parts[i].types) ++ mtd_parse_part(slave, parts[i].types); + + cur_offset = slave->offset + slave->mtd.size; + } +@@ -1037,12 +1053,6 @@ static const char * const default_mtd_pa + NULL + }; + +-/* Check DT only when looking for subpartitions. */ +-static const char * const default_subpartition_types[] = { +- "ofpart", +- NULL +-}; +- + static int mtd_part_do_parse(struct mtd_part_parser *parser, + struct mtd_info *master, + struct mtd_partitions *pparts, +@@ -1113,9 +1123,7 @@ static int mtd_part_of_parse(struct mtd_ + const char *fixed = "fixed-partitions"; + int ret, err = 0; + +- np = mtd_get_of_node(master); +- if (!mtd_is_partition(master)) +- np = of_get_child_by_name(np, "partitions"); ++ np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); + of_property_for_each_string(np, "compatible", prop, compat) { + parser = mtd_part_get_compatible_parser(compat); + if (!parser) +@@ -1185,8 +1193,7 @@ int parse_mtd_partitions(struct mtd_info + } + + if (!types) +- types = mtd_is_partition(master) ? default_subpartition_types : +- default_mtd_part_types; ++ types = default_mtd_part_types; + + for ( ; *types; types++) { + /* diff --git a/target/linux/cns3xxx/config-4.14 b/target/linux/cns3xxx/config-4.14 index 5a1aab95f..ba6d0caa0 100644 --- a/target/linux/cns3xxx/config-4.14 +++ b/target/linux/cns3xxx/config-4.14 @@ -27,7 +27,6 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARM=y @@ -94,20 +93,15 @@ CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" # CONFIG_DEBUG_UART_8250 is not set # CONFIG_DEBUG_USER is not set CONFIG_DMA_CACHE_FIQ_BROADCAST=y -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_EEPROM_AT24=y CONFIG_ELF_CORE=y -CONFIG_EXPORTFS=y CONFIG_FIQ=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FRAME_POINTER=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -357,7 +351,6 @@ CONFIG_SRCU=y CONFIG_SWIOTLB=y CONFIG_SWPHY=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y diff --git a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c index 07c9dbc04..4fbc34f35 100644 --- a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c +++ b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c @@ -1112,22 +1112,12 @@ static int eth_set_mac(struct net_device *netdev, void *p) return 0; } -static int cns3xxx_change_mtu(struct net_device *dev, int new_mtu) -{ - if (new_mtu > MAX_MTU) - return -EINVAL; - - dev->mtu = new_mtu; - return 0; -} - static const struct net_device_ops cns3xxx_netdev_ops = { .ndo_open = eth_open, .ndo_stop = eth_close, .ndo_start_xmit = eth_xmit, .ndo_set_rx_mode = eth_rx_mode, .ndo_do_ioctl = eth_ioctl, - .ndo_change_mtu = cns3xxx_change_mtu, .ndo_set_mac_address = eth_set_mac, .ndo_validate_addr = eth_validate_addr, }; @@ -1224,6 +1214,7 @@ static int eth_init_one(struct platform_device *pdev) dev->netdev_ops = &cns3xxx_netdev_ops; dev->ethtool_ops = &cns3xxx_ethtool_ops; dev->tx_queue_len = 1000; + dev->max_mtu = MAX_MTU; dev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST; switch_port_tab[port->id] = port; diff --git a/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch b/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch index 42430ead4..45946e3d6 100644 --- a/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch +++ b/target/linux/cns3xxx/patches-4.14/130-Extend-PCIE_BUS_PEER2PEER-to-set-MRSS-128-to-fix-CNS3xxx-BM-DMA..patch @@ -1,6 +1,6 @@ --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c -@@ -2303,7 +2303,8 @@ static void pcie_write_mrrs(struct pci_d +@@ -2305,7 +2305,8 @@ static void pcie_write_mrrs(struct pci_d /* In the "safe" case, do not configure the MRRS. There appear to be * issues with setting MRRS to 0 on a number of devices. */ diff --git a/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch b/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch index 89117bd87..d9215505e 100644 --- a/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch +++ b/target/linux/generic/backport-4.14/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch @@ -65,7 +65,7 @@ Cc: Kir Kolyshkin * Before updating sk_refcnt, we must commit prior changes to memory --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1671,7 +1671,7 @@ u32 tcp_tso_autosize(const struct sock * +@@ -1683,7 +1683,7 @@ u32 tcp_tso_autosize(const struct sock * { u32 bytes, segs; @@ -74,7 +74,7 @@ Cc: Kir Kolyshkin sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); /* Goal is to send at least one packet per ms, -@@ -2172,7 +2172,7 @@ static bool tcp_small_queue_check(struct +@@ -2184,7 +2184,7 @@ static bool tcp_small_queue_check(struct { unsigned int limit; diff --git a/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch b/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch index 30aa03a69..c2e6d0990 100644 --- a/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch +++ b/target/linux/generic/backport-4.14/030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch @@ -30,7 +30,7 @@ Signed-off-by: Johan Hovold --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -1919,7 +1919,8 @@ static const struct usb_device_id option +@@ -1923,7 +1923,8 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d01, 0xff) }, /* D-Link DWM-156 (variant) */ { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d02, 0xff) }, { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d03, 0xff) }, diff --git a/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch b/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch deleted file mode 100644 index 115415025..000000000 --- a/target/linux/generic/backport-4.14/030-v4.17-0001-usb-dwc2-add-support-for-host-mode-external-vbus-sup.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 531ef5ebea96394ddb7f554d4d88e017dde30a59 Mon Sep 17 00:00:00 2001 -From: Amelie Delaunay -Date: Tue, 13 Feb 2018 09:28:12 +0100 -Subject: [PATCH] usb: dwc2: add support for host mode external vbus supply - -This patch adds a way to enable an external vbus supply in host mode, -when dwc2 drvvbus signal is not used. - -This patch is very similar to the one done in U-Boot dwc2 driver [1]. It -also adds dynamic vbus supply management depending on the role and state -of the core. - -[1] https://lists.denx.de/pipermail/u-boot/2017-March/283434.html - -Signed-off-by: Amelie Delaunay -Signed-off-by: Felipe Balbi ---- - drivers/usb/dwc2/core.h | 2 ++ - drivers/usb/dwc2/hcd.c | 26 ++++++++++++++++++++++++++ - 2 files changed, 28 insertions(+) - ---- a/drivers/usb/dwc2/core.h -+++ b/drivers/usb/dwc2/core.h -@@ -777,6 +777,7 @@ struct dwc2_hregs_backup { - * @plat: The platform specific configuration data. This can be - * removed once all SoCs support usb transceiver. - * @supplies: Definition of USB power supplies -+ * @vbus_supply: Regulator supplying vbus. - * @phyif: PHY interface width - * @lock: Spinlock that protects all the driver data structures - * @priv: Stores a pointer to the struct usb_hcd -@@ -913,6 +914,7 @@ struct dwc2_hsotg { - struct usb_phy *uphy; - struct dwc2_hsotg_plat *plat; - struct regulator_bulk_data supplies[DWC2_NUM_SUPPLIES]; -+ struct regulator *vbus_supply; - u32 phyif; - - spinlock_t lock; ---- a/drivers/usb/dwc2/hcd.c -+++ b/drivers/usb/dwc2/hcd.c -@@ -359,6 +359,23 @@ static void dwc2_gusbcfg_init(struct dwc - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); - } - -+static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg) -+{ -+ hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); -+ if (IS_ERR(hsotg->vbus_supply)) -+ return 0; -+ -+ return regulator_enable(hsotg->vbus_supply); -+} -+ -+static int dwc2_vbus_supply_exit(struct dwc2_hsotg *hsotg) -+{ -+ if (hsotg->vbus_supply) -+ return regulator_disable(hsotg->vbus_supply); -+ -+ return 0; -+} -+ - /** - * dwc2_enable_host_interrupts() - Enables the Host mode interrupts - * -@@ -3276,6 +3293,7 @@ static void dwc2_conn_id_status_change(s - - /* B-Device connector (Device Mode) */ - if (gotgctl & GOTGCTL_CONID_B) { -+ dwc2_vbus_supply_exit(hsotg); - /* Wait for switch to device mode */ - dev_dbg(hsotg->dev, "connId B\n"); - if (hsotg->bus_suspended) { -@@ -4382,6 +4400,9 @@ static int _dwc2_hcd_start(struct usb_hc - } - - spin_unlock_irqrestore(&hsotg->lock, flags); -+ -+ dwc2_vbus_supply_init(hsotg); -+ - return 0; - } - -@@ -4409,6 +4430,8 @@ static void _dwc2_hcd_stop(struct usb_hc - clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); - spin_unlock_irqrestore(&hsotg->lock, flags); - -+ dwc2_vbus_supply_exit(hsotg); -+ - usleep_range(1000, 3000); - } - -@@ -4445,6 +4468,7 @@ static int _dwc2_hcd_suspend(struct usb_ - hprt0 |= HPRT0_SUSP; - hprt0 &= ~HPRT0_PWR; - dwc2_writel(hprt0, hsotg->regs + HPRT0); -+ dwc2_vbus_supply_exit(hsotg); - } - - /* Enter hibernation */ -@@ -4525,6 +4549,8 @@ static int _dwc2_hcd_resume(struct usb_h - spin_unlock_irqrestore(&hsotg->lock, flags); - dwc2_port_resume(hsotg); - } else { -+ dwc2_vbus_supply_init(hsotg); -+ - /* Wait for controller to correctly update D+/D- level */ - usleep_range(3000, 5000); - diff --git a/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch b/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch deleted file mode 100644 index f860cde0f..000000000 --- a/target/linux/generic/backport-4.14/030-v4.17-0002-usb-dwc2-dwc2_vbus_supply_init-fix-error-check.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 438fea2a6325933868aebc20279e2669c9a21207 Mon Sep 17 00:00:00 2001 -From: Tomeu Vizoso -Date: Mon, 26 Mar 2018 11:00:01 +0200 -Subject: [PATCH] usb: dwc2: dwc2_vbus_supply_init: fix error check - -devm_regulator_get_optional returns -ENODEV if the regulator isn't -there, so if that's the case we have to make sure not to leave -ENODEV -in the regulator pointer. - -Also, make sure we return 0 in that case, but correctly propagate any -other errors. Also propagate the error from _dwc2_hcd_start. - -Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply") -Cc: Amelie Delaunay -Reviewed-by: Amelie Delaunay -Reviewed-by: Heiko Stuebner -Reviewed-by: Grigor Tovmasyan -Tested-by: Heiko Stuebner -Acked-by: Minas Harutyunyan -Signed-off-by: Tomeu Vizoso -Signed-off-by: Felipe Balbi ---- - drivers/usb/dwc2/hcd.c | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - ---- a/drivers/usb/dwc2/hcd.c -+++ b/drivers/usb/dwc2/hcd.c -@@ -361,9 +361,14 @@ static void dwc2_gusbcfg_init(struct dwc - - static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg) - { -+ int ret; -+ - hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); -- if (IS_ERR(hsotg->vbus_supply)) -- return 0; -+ if (IS_ERR(hsotg->vbus_supply)) { -+ ret = PTR_ERR(hsotg->vbus_supply); -+ hsotg->vbus_supply = NULL; -+ return ret == -ENODEV ? 0 : ret; -+ } - - return regulator_enable(hsotg->vbus_supply); - } -@@ -4401,9 +4406,7 @@ static int _dwc2_hcd_start(struct usb_hc - - spin_unlock_irqrestore(&hsotg->lock, flags); - -- dwc2_vbus_supply_init(hsotg); -- -- return 0; -+ return dwc2_vbus_supply_init(hsotg); - } - - /* diff --git a/target/linux/generic/backport-4.14/044-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch b/target/linux/generic/backport-4.14/044-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch new file mode 100644 index 000000000..de0ff1f81 --- /dev/null +++ b/target/linux/generic/backport-4.14/044-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch @@ -0,0 +1,39 @@ +From cf589ce71e84d3b8811c65740645af254c5248c0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 9 May 2018 10:17:29 +0200 +Subject: [PATCH] mtd: bcm47xxpart: add of_match_table with a new DT binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows using bcm47xxpart parser to find partitions on flash +described in DT using the "brcm,bcm947xx-cfe-partitions" compatible +property. It means this parser doesn't have to be explicitly selected by +a flash driver anymore. It can be used e.g. together with a generic +m25p80 / spi-nor if device is just properly described. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/bcm47xxpart.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -304,9 +304,16 @@ static int bcm47xxpart_parse(struct mtd_ + return curr_part; + }; + ++static const struct of_device_id bcm47xxpart_of_match_table[] = { ++ { .compatible = "brcm,bcm947xx-cfe-partitions" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm47xxpart_of_match_table); ++ + static struct mtd_part_parser bcm47xxpart_mtd_parser = { + .parse_fn = bcm47xxpart_parse, + .name = "bcm47xxpart", ++ .of_match_table = bcm47xxpart_of_match_table, + }; + module_mtd_part_parser(bcm47xxpart_mtd_parser); + diff --git a/target/linux/generic/backport-4.14/045-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch b/target/linux/generic/backport-4.14/045-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch new file mode 100644 index 000000000..5841dd55f --- /dev/null +++ b/target/linux/generic/backport-4.14/045-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch @@ -0,0 +1,37 @@ +From 98534a58c8a40cdc9e3bcb04d74719fbcedfeb52 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 26 Jun 2018 00:05:08 +0200 +Subject: [PATCH] mtd: parsers: trx: add of_match_table with the new DT binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows using TRX parser to find TRX partitions on flash device +described in DT using a proper binding. It's useful for devices storing +firmware on a separated flash and having rootfs partition in it. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/parsers/parser_trx.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/mtd/parsers/parser_trx.c ++++ b/drivers/mtd/parsers/parser_trx.c +@@ -116,9 +116,16 @@ static int parser_trx_parse(struct mtd_i + return i; + }; + ++static const struct of_device_id mtd_parser_trx_of_match_table[] = { ++ { .compatible = "brcm,trx" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mtd_parser_trx_of_match_table); ++ + static struct mtd_part_parser mtd_parser_trx = { + .parse_fn = parser_trx_parse, + .name = "trx", ++ .of_match_table = mtd_parser_trx_of_match_table, + }; + module_mtd_part_parser(mtd_parser_trx); + diff --git a/target/linux/generic/backport-4.14/046-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch b/target/linux/generic/backport-4.14/046-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch new file mode 100644 index 000000000..1bb3563f1 --- /dev/null +++ b/target/linux/generic/backport-4.14/046-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch @@ -0,0 +1,102 @@ +From 76a832254ab05502c9394cc51ded6f0abe0e0bee Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 13 Jul 2018 16:32:21 +0200 +Subject: [PATCH] mtd: partitions: use DT info for parsing partitions with + "compatible" prop +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far only flash devices could be described in DT regarding partitions +parsing. That could be done with "partitions" subnode and a proper +"compatible" string. + +Some devices may use hierarchical (multi-level) layouts and may mix used +layouts (fixed and dynamic). Describing that in DT is done by specifying +"compatible" for DT-represented partition plus optionally more +properties and/or subnodes. + +To support such layouts each DT partition has to be checked for +additional description. + +Please note this implementation will work in parallel with support for +partition type specified for non-DT setups. That already works since +commit 1a0915be1926 ("mtd: partitions: add support for partition +parsers"). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/mtdpart.c | 33 +++++++++++++-------------------- + 1 file changed, 13 insertions(+), 20 deletions(-) + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -370,22 +370,6 @@ static inline void free_partition(struct + kfree(p); + } + +-/** +- * mtd_parse_part - parse MTD partition looking for subpartitions +- * +- * @slave: part that is supposed to be a container and should be parsed +- * @types: NULL-terminated array with names of partition parsers to try +- * +- * Some partitions are kind of containers with extra subpartitions (volumes). +- * There can be various formats of such containers. This function tries to use +- * specified parsers to analyze given partition and registers found +- * subpartitions on success. +- */ +-static int mtd_parse_part(struct mtd_part *slave, const char *const *types) +-{ +- return parse_mtd_partitions(&slave->mtd, types, NULL); +-} +- + static struct mtd_part *allocate_partition(struct mtd_info *parent, + const struct mtd_partition *part, int partno, + uint64_t cur_offset) +@@ -783,8 +767,8 @@ int add_mtd_partitions(struct mtd_info * + + add_mtd_device(&slave->mtd); + mtd_add_partition_attrs(slave); +- if (parts[i].types) +- mtd_parse_part(slave, parts[i].types); ++ /* Look for subpartitions */ ++ parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); + + cur_offset = slave->offset + slave->mtd.size; + } +@@ -860,6 +844,12 @@ static const char * const default_mtd_pa + NULL + }; + ++/* Check DT only when looking for subpartitions. */ ++static const char * const default_subpartition_types[] = { ++ "ofpart", ++ NULL ++}; ++ + static int mtd_part_do_parse(struct mtd_part_parser *parser, + struct mtd_info *master, + struct mtd_partitions *pparts, +@@ -930,7 +920,9 @@ static int mtd_part_of_parse(struct mtd_ + const char *fixed = "fixed-partitions"; + int ret, err = 0; + +- np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); ++ np = mtd_get_of_node(master); ++ if (!mtd_is_partition(master)) ++ np = of_get_child_by_name(np, "partitions"); + of_property_for_each_string(np, "compatible", prop, compat) { + parser = mtd_part_get_compatible_parser(compat); + if (!parser) +@@ -993,7 +985,8 @@ int parse_mtd_partitions(struct mtd_info + int ret, err = 0; + + if (!types) +- types = default_mtd_part_types; ++ types = mtd_is_partition(master) ? default_subpartition_types : ++ default_mtd_part_types; + + for ( ; *types; types++) { + /* diff --git a/target/linux/generic/backport-4.14/301-v4.16-netfilter-core-only-allow-one-nat-hook-per-hook-poin.patch b/target/linux/generic/backport-4.14/301-v4.16-netfilter-core-only-allow-one-nat-hook-per-hook-poin.patch index 711eca035..5ae8f8f1e 100644 --- a/target/linux/generic/backport-4.14/301-v4.16-netfilter-core-only-allow-one-nat-hook-per-hook-poin.patch +++ b/target/linux/generic/backport-4.14/301-v4.16-netfilter-core-only-allow-one-nat-hook-per-hook-poin.patch @@ -135,7 +135,7 @@ Signed-off-by: Pablo Neira Ayuso new->hooks[nhooks] = old->hooks[i]; --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -1400,6 +1400,8 @@ static int nf_tables_addchain(struct nft +@@ -1431,6 +1431,8 @@ static int nf_tables_addchain(struct nft ops->hook = hookfn; if (afi->hook_ops_init) afi->hook_ops_init(ops, i); diff --git a/target/linux/generic/backport-4.14/303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch b/target/linux/generic/backport-4.14/303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch index 81f140441..75e86f1b4 100644 --- a/target/linux/generic/backport-4.14/303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch +++ b/target/linux/generic/backport-4.14/303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch @@ -11,7 +11,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h -@@ -892,8 +892,6 @@ struct nft_stats { +@@ -897,8 +897,6 @@ struct nft_stats { struct u64_stats_sync syncp; }; @@ -20,7 +20,7 @@ Signed-off-by: Pablo Neira Ayuso /** * struct nft_base_chain - nf_tables base chain * -@@ -905,7 +903,7 @@ struct nft_stats { +@@ -910,7 +908,7 @@ struct nft_stats { * @dev_name: device name that this base chain is attached to (if any) */ struct nft_base_chain { @@ -29,7 +29,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nf_chain_type *type; u8 policy; u8 flags; -@@ -966,8 +964,6 @@ enum nft_af_flags { +@@ -971,8 +969,6 @@ enum nft_af_flags { * @owner: module owner * @tables: used internally * @flags: family flags @@ -38,7 +38,7 @@ Signed-off-by: Pablo Neira Ayuso * @hooks: hookfn overrides for packet validation */ struct nft_af_info { -@@ -977,9 +973,6 @@ struct nft_af_info { +@@ -982,9 +978,6 @@ struct nft_af_info { struct module *owner; struct list_head tables; u32 flags; @@ -128,7 +128,7 @@ Signed-off-by: Pablo Neira Ayuso } static int nft_trans_table_add(struct nft_ctx *ctx, int msg_type) -@@ -595,8 +592,7 @@ static void _nf_tables_table_disable(str +@@ -624,8 +621,7 @@ static void _nf_tables_table_disable(str if (cnt && i++ == cnt) break; @@ -138,7 +138,7 @@ Signed-off-by: Pablo Neira Ayuso } } -@@ -613,8 +609,7 @@ static int nf_tables_table_enable(struct +@@ -642,8 +638,7 @@ static int nf_tables_table_enable(struct if (!nft_is_base_chain(chain)) continue; @@ -148,7 +148,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) goto err; -@@ -1026,7 +1021,7 @@ static int nf_tables_fill_chain_info(str +@@ -1055,7 +1050,7 @@ static int nf_tables_fill_chain_info(str if (nft_is_base_chain(chain)) { const struct nft_base_chain *basechain = nft_base_chain(chain); @@ -157,7 +157,7 @@ Signed-off-by: Pablo Neira Ayuso struct nlattr *nest; nest = nla_nest_start(skb, NFTA_CHAIN_HOOK); -@@ -1252,8 +1247,8 @@ static void nf_tables_chain_destroy(stru +@@ -1283,8 +1278,8 @@ static void nf_tables_chain_destroy(stru free_percpu(basechain->stats); if (basechain->stats) static_branch_dec(&nft_counters_enabled); @@ -168,7 +168,7 @@ Signed-off-by: Pablo Neira Ayuso kfree(chain->name); kfree(basechain); } else { -@@ -1349,7 +1344,6 @@ static int nf_tables_addchain(struct nft +@@ -1380,7 +1375,6 @@ static int nf_tables_addchain(struct nft struct nft_stats __percpu *stats; struct net *net = ctx->net; struct nft_chain *chain; @@ -176,7 +176,7 @@ Signed-off-by: Pablo Neira Ayuso int err; if (table->use == UINT_MAX) -@@ -1388,21 +1382,18 @@ static int nf_tables_addchain(struct nft +@@ -1419,21 +1413,18 @@ static int nf_tables_addchain(struct nft basechain->type = hook.type; chain = &basechain->chain; @@ -210,7 +210,7 @@ Signed-off-by: Pablo Neira Ayuso chain->flags |= NFT_BASE_CHAIN; basechain->policy = policy; -@@ -1420,7 +1411,7 @@ static int nf_tables_addchain(struct nft +@@ -1451,7 +1442,7 @@ static int nf_tables_addchain(struct nft goto err1; } @@ -219,7 +219,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) goto err1; -@@ -1434,7 +1425,7 @@ static int nf_tables_addchain(struct nft +@@ -1465,7 +1456,7 @@ static int nf_tables_addchain(struct nft return 0; err2: @@ -228,7 +228,7 @@ Signed-off-by: Pablo Neira Ayuso err1: nf_tables_chain_destroy(chain); -@@ -1447,14 +1438,13 @@ static int nf_tables_updchain(struct nft +@@ -1478,14 +1469,13 @@ static int nf_tables_updchain(struct nft const struct nlattr * const *nla = ctx->nla; struct nft_table *table = ctx->table; struct nft_chain *chain = ctx->chain; @@ -244,7 +244,7 @@ Signed-off-by: Pablo Neira Ayuso if (nla[NFTA_CHAIN_HOOK]) { if (!nft_is_base_chain(chain)) -@@ -1471,14 +1461,12 @@ static int nf_tables_updchain(struct nft +@@ -1502,14 +1492,12 @@ static int nf_tables_updchain(struct nft return -EBUSY; } @@ -265,7 +265,7 @@ Signed-off-by: Pablo Neira Ayuso } nft_chain_release_hook(&hook); } -@@ -5069,10 +5057,9 @@ static int nf_tables_commit(struct net * +@@ -5113,10 +5101,9 @@ static int nf_tables_commit(struct net * case NFT_MSG_DELCHAIN: list_del_rcu(&trans->ctx.chain->list); nf_tables_chain_notify(&trans->ctx, NFT_MSG_DELCHAIN); @@ -279,7 +279,7 @@ Signed-off-by: Pablo Neira Ayuso break; case NFT_MSG_NEWRULE: nft_clear(trans->ctx.net, nft_trans_rule(trans)); -@@ -5209,10 +5196,9 @@ static int nf_tables_abort(struct net *n +@@ -5253,10 +5240,9 @@ static int nf_tables_abort(struct net *n } else { trans->ctx.table->use--; list_del_rcu(&trans->ctx.chain->list); @@ -293,7 +293,7 @@ Signed-off-by: Pablo Neira Ayuso } break; case NFT_MSG_DELCHAIN: -@@ -5313,7 +5299,7 @@ int nft_chain_validate_hooks(const struc +@@ -5359,7 +5345,7 @@ int nft_chain_validate_hooks(const struc if (nft_is_base_chain(chain)) { basechain = nft_base_chain(chain); @@ -302,7 +302,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; return -EOPNOTSUPP; -@@ -5795,8 +5781,7 @@ int __nft_release_basechain(struct nft_c +@@ -5841,8 +5827,7 @@ int __nft_release_basechain(struct nft_c BUG_ON(!nft_is_base_chain(ctx->chain)); @@ -312,7 +312,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry_safe(rule, nr, &ctx->chain->rules, list) { list_del(&rule->list); ctx->chain->use--; -@@ -5825,8 +5810,7 @@ static void __nft_release_afinfo(struct +@@ -5871,8 +5856,7 @@ static void __nft_release_afinfo(struct list_for_each_entry_safe(table, nt, &afi->tables, list) { list_for_each_entry(chain, &table->chains, list) @@ -353,7 +353,7 @@ Signed-off-by: Pablo Neira Ayuso strncpy(basechain->dev_name, dev->name, IFNAMSIZ); --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c -@@ -169,7 +169,7 @@ nft_target_set_tgchk_param(struct xt_tgc +@@ -186,7 +186,7 @@ nft_target_set_tgchk_param(struct xt_tgc if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain); @@ -362,7 +362,7 @@ Signed-off-by: Pablo Neira Ayuso par->hook_mask = 1 << ops->hooknum; } else { -@@ -302,7 +302,7 @@ static int nft_target_validate(const str +@@ -317,7 +317,7 @@ static int nft_target_validate(const str if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain); @@ -371,7 +371,7 @@ Signed-off-by: Pablo Neira Ayuso hook_mask = 1 << ops->hooknum; if (target->hooks && !(hook_mask & target->hooks)) -@@ -383,7 +383,7 @@ nft_match_set_mtchk_param(struct xt_mtch +@@ -414,7 +414,7 @@ nft_match_set_mtchk_param(struct xt_mtch if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain); @@ -380,7 +380,7 @@ Signed-off-by: Pablo Neira Ayuso par->hook_mask = 1 << ops->hooknum; } else { -@@ -481,7 +481,7 @@ static int nft_match_validate(const stru +@@ -564,7 +564,7 @@ static int nft_match_validate(const stru if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain); diff --git a/target/linux/generic/backport-4.14/312-v4.16-netfilter-nf_tables-remove-hooks-from-family-definit.patch b/target/linux/generic/backport-4.14/312-v4.16-netfilter-nf_tables-remove-hooks-from-family-definit.patch index dd969c12a..3ee8ad9d3 100644 --- a/target/linux/generic/backport-4.14/312-v4.16-netfilter-nf_tables-remove-hooks-from-family-definit.patch +++ b/target/linux/generic/backport-4.14/312-v4.16-netfilter-nf_tables-remove-hooks-from-family-definit.patch @@ -10,7 +10,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h -@@ -870,7 +870,7 @@ enum nft_chain_type { +@@ -875,7 +875,7 @@ enum nft_chain_type { * @family: address family * @owner: module owner * @hook_mask: mask of valid hooks @@ -19,7 +19,7 @@ Signed-off-by: Pablo Neira Ayuso */ struct nf_chain_type { const char *name; -@@ -964,7 +964,6 @@ enum nft_af_flags { +@@ -969,7 +969,6 @@ enum nft_af_flags { * @owner: module owner * @tables: used internally * @flags: family flags @@ -27,7 +27,7 @@ Signed-off-by: Pablo Neira Ayuso */ struct nft_af_info { struct list_head list; -@@ -973,7 +972,6 @@ struct nft_af_info { +@@ -978,7 +977,6 @@ struct nft_af_info { struct module *owner; struct list_head tables; u32 flags; @@ -151,7 +151,7 @@ Signed-off-by: Pablo Neira Ayuso static int __init nf_tables_ipv6_init(void) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -1352,7 +1352,6 @@ static int nf_tables_addchain(struct nft +@@ -1383,7 +1383,6 @@ static int nf_tables_addchain(struct nft if (nla[NFTA_CHAIN_HOOK]) { struct nft_chain_hook hook; struct nf_hook_ops *ops; @@ -159,7 +159,7 @@ Signed-off-by: Pablo Neira Ayuso err = nft_chain_parse_hook(net, nla, afi, &hook, create); if (err < 0) -@@ -1378,7 +1377,6 @@ static int nf_tables_addchain(struct nft +@@ -1409,7 +1408,6 @@ static int nf_tables_addchain(struct nft static_branch_inc(&nft_counters_enabled); } @@ -167,7 +167,7 @@ Signed-off-by: Pablo Neira Ayuso basechain->type = hook.type; chain = &basechain->chain; -@@ -1387,10 +1385,8 @@ static int nf_tables_addchain(struct nft +@@ -1418,10 +1416,8 @@ static int nf_tables_addchain(struct nft ops->hooknum = hook.num; ops->priority = hook.priority; ops->priv = chain; diff --git a/target/linux/generic/backport-4.14/314-v4.16-netfilter-meta-secpath-support.patch b/target/linux/generic/backport-4.14/314-v4.16-netfilter-meta-secpath-support.patch index d755c17fc..7aab67fc2 100644 --- a/target/linux/generic/backport-4.14/314-v4.16-netfilter-meta-secpath-support.patch +++ b/target/linux/generic/backport-4.14/314-v4.16-netfilter-meta-secpath-support.patch @@ -40,7 +40,7 @@ Signed-off-by: Pablo Neira Ayuso default: WARN_ON(1); goto err; -@@ -308,6 +313,11 @@ int nft_meta_get_init(const struct nft_c +@@ -310,6 +315,11 @@ int nft_meta_get_init(const struct nft_c prandom_init_once(&nft_prandom_state); len = sizeof(u32); break; @@ -52,7 +52,7 @@ Signed-off-by: Pablo Neira Ayuso default: return -EOPNOTSUPP; } -@@ -318,6 +328,38 @@ int nft_meta_get_init(const struct nft_c +@@ -320,6 +330,38 @@ int nft_meta_get_init(const struct nft_c } EXPORT_SYMBOL_GPL(nft_meta_get_init); @@ -91,7 +91,7 @@ Signed-off-by: Pablo Neira Ayuso int nft_meta_set_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, const struct nft_data **data) -@@ -434,6 +476,7 @@ static const struct nft_expr_ops nft_met +@@ -436,6 +478,7 @@ static const struct nft_expr_ops nft_met .eval = nft_meta_get_eval, .init = nft_meta_get_init, .dump = nft_meta_get_dump, diff --git a/target/linux/generic/backport-4.14/321-v4.16-netfilter-nf_tables-add-flow-table-netlink-frontend.patch b/target/linux/generic/backport-4.14/321-v4.16-netfilter-nf_tables-add-flow-table-netlink-frontend.patch index 9bdacd914..625de6b34 100644 --- a/target/linux/generic/backport-4.14/321-v4.16-netfilter-nf_tables-add-flow-table-netlink-frontend.patch +++ b/target/linux/generic/backport-4.14/321-v4.16-netfilter-nf_tables-add-flow-table-netlink-frontend.patch @@ -50,7 +50,7 @@ Signed-off-by: Pablo Neira Ayuso #include #define NFT_JUMP_STACK_SIZE 16 -@@ -933,6 +934,7 @@ unsigned int nft_do_chain(struct nft_pkt +@@ -938,6 +939,7 @@ unsigned int nft_do_chain(struct nft_pkt * @chains: chains in the table * @sets: sets in the table * @objects: stateful objects in the table @@ -58,7 +58,7 @@ Signed-off-by: Pablo Neira Ayuso * @hgenerator: handle generator state * @use: number of chain references to this table * @flags: table flag (see enum nft_table_flags) -@@ -944,6 +946,7 @@ struct nft_table { +@@ -949,6 +951,7 @@ struct nft_table { struct list_head chains; struct list_head sets; struct list_head objects; @@ -66,7 +66,7 @@ Signed-off-by: Pablo Neira Ayuso u64 hgenerator; u32 use; u16 flags:14, -@@ -1075,6 +1078,44 @@ int nft_register_obj(struct nft_object_t +@@ -1080,6 +1083,44 @@ int nft_register_obj(struct nft_object_t void nft_unregister_obj(struct nft_object_type *obj_type); /** @@ -111,7 +111,7 @@ Signed-off-by: Pablo Neira Ayuso * struct nft_traceinfo - nft tracing information and state * * @pkt: pktinfo currently processed -@@ -1310,4 +1351,11 @@ struct nft_trans_obj { +@@ -1315,4 +1356,11 @@ struct nft_trans_obj { #define nft_trans_obj(trans) \ (((struct nft_trans_obj *)trans->data)->obj) @@ -217,7 +217,7 @@ Signed-off-by: Pablo Neira Ayuso /** * nft_register_afinfo - register nf_tables address family info -@@ -345,6 +347,40 @@ static int nft_delobj(struct nft_ctx *ct +@@ -374,6 +376,40 @@ static int nft_delobj(struct nft_ctx *ct return err; } @@ -258,7 +258,7 @@ Signed-off-by: Pablo Neira Ayuso /* * Tables */ -@@ -728,6 +764,7 @@ static int nf_tables_newtable(struct net +@@ -757,6 +793,7 @@ static int nf_tables_newtable(struct net INIT_LIST_HEAD(&table->chains); INIT_LIST_HEAD(&table->sets); INIT_LIST_HEAD(&table->objects); @@ -266,7 +266,7 @@ Signed-off-by: Pablo Neira Ayuso table->flags = flags; nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); -@@ -749,10 +786,11 @@ err1: +@@ -778,10 +815,11 @@ err1: static int nft_flush_table(struct nft_ctx *ctx) { @@ -279,7 +279,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry(chain, &ctx->table->chains, list) { if (!nft_is_active_next(ctx->net, chain)) -@@ -778,6 +816,12 @@ static int nft_flush_table(struct nft_ct +@@ -807,6 +845,12 @@ static int nft_flush_table(struct nft_ct goto out; } @@ -292,7 +292,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry_safe(obj, ne, &ctx->table->objects, list) { err = nft_delobj(ctx, obj); if (err < 0) -@@ -4774,6 +4818,605 @@ static void nf_tables_obj_notify(const s +@@ -4818,6 +4862,605 @@ static void nf_tables_obj_notify(const s ctx->afi->family, ctx->report, GFP_KERNEL); } @@ -898,7 +898,7 @@ Signed-off-by: Pablo Neira Ayuso static int nf_tables_fill_gen_info(struct sk_buff *skb, struct net *net, u32 portid, u32 seq) { -@@ -4804,6 +5447,49 @@ nla_put_failure: +@@ -4848,6 +5491,49 @@ nla_put_failure: return -EMSGSIZE; } @@ -948,7 +948,7 @@ Signed-off-by: Pablo Neira Ayuso static void nf_tables_gen_notify(struct net *net, struct sk_buff *skb, int event) { -@@ -4956,6 +5642,21 @@ static const struct nfnl_callback nf_tab +@@ -5000,6 +5686,21 @@ static const struct nfnl_callback nf_tab .attr_count = NFTA_OBJ_MAX, .policy = nft_obj_policy, }, @@ -970,7 +970,7 @@ Signed-off-by: Pablo Neira Ayuso }; static void nft_chain_commit_update(struct nft_trans *trans) -@@ -5001,6 +5702,9 @@ static void nf_tables_commit_release(str +@@ -5045,6 +5746,9 @@ static void nf_tables_commit_release(str case NFT_MSG_DELOBJ: nft_obj_destroy(nft_trans_obj(trans)); break; @@ -980,7 +980,7 @@ Signed-off-by: Pablo Neira Ayuso } kfree(trans); } -@@ -5118,6 +5822,21 @@ static int nf_tables_commit(struct net * +@@ -5162,6 +5866,21 @@ static int nf_tables_commit(struct net * nf_tables_obj_notify(&trans->ctx, nft_trans_obj(trans), NFT_MSG_DELOBJ); break; @@ -1002,7 +1002,7 @@ Signed-off-by: Pablo Neira Ayuso } } -@@ -5155,6 +5874,9 @@ static void nf_tables_abort_release(stru +@@ -5199,6 +5918,9 @@ static void nf_tables_abort_release(stru case NFT_MSG_NEWOBJ: nft_obj_destroy(nft_trans_obj(trans)); break; @@ -1012,7 +1012,7 @@ Signed-off-by: Pablo Neira Ayuso } kfree(trans); } -@@ -5244,6 +5966,17 @@ static int nf_tables_abort(struct net *n +@@ -5290,6 +6012,17 @@ static int nf_tables_abort(struct net *n nft_clear(trans->ctx.net, nft_trans_obj(trans)); nft_trans_destroy(trans); break; @@ -1030,7 +1030,7 @@ Signed-off-by: Pablo Neira Ayuso } } -@@ -5794,6 +6527,7 @@ EXPORT_SYMBOL_GPL(__nft_release_basechai +@@ -5840,6 +6573,7 @@ EXPORT_SYMBOL_GPL(__nft_release_basechai /* Called by nft_unregister_afinfo() from __net_exit path, nfnl_lock is held. */ static void __nft_release_afinfo(struct net *net, struct nft_af_info *afi) { @@ -1038,7 +1038,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table, *nt; struct nft_chain *chain, *nc; struct nft_object *obj, *ne; -@@ -5807,6 +6541,9 @@ static void __nft_release_afinfo(struct +@@ -5853,6 +6587,9 @@ static void __nft_release_afinfo(struct list_for_each_entry_safe(table, nt, &afi->tables, list) { list_for_each_entry(chain, &table->chains, list) nf_tables_unregister_hook(net, table, chain); @@ -1048,8 +1048,8 @@ Signed-off-by: Pablo Neira Ayuso /* No packets are walking on these chains anymore. */ ctx.table = table; list_for_each_entry(chain, &table->chains, list) { -@@ -5817,6 +6554,11 @@ static void __nft_release_afinfo(struct - nf_tables_rule_destroy(&ctx, rule); +@@ -5863,6 +6600,11 @@ static void __nft_release_afinfo(struct + nf_tables_rule_release(&ctx, rule); } } + list_for_each_entry_safe(flowtable, nf, &table->flowtables, list) { @@ -1060,7 +1060,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry_safe(set, ns, &table->sets, list) { list_del(&set->list); table->use--; -@@ -5860,6 +6602,8 @@ static int __init nf_tables_module_init( +@@ -5906,6 +6648,8 @@ static int __init nf_tables_module_init( if (err < 0) goto err3; @@ -1069,7 +1069,7 @@ Signed-off-by: Pablo Neira Ayuso pr_info("nf_tables: (c) 2007-2009 Patrick McHardy \n"); return register_pernet_subsys(&nf_tables_net_ops); err3: -@@ -5874,6 +6618,7 @@ static void __exit nf_tables_module_exit +@@ -5920,6 +6664,7 @@ static void __exit nf_tables_module_exit { unregister_pernet_subsys(&nf_tables_net_ops); nfnetlink_subsys_unregister(&nf_tables_subsys); diff --git a/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch b/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch index abe7ef009..874195558 100644 --- a/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch +++ b/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch @@ -15,7 +15,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/ipv6.h +++ b/include/net/ipv6.h -@@ -913,6 +913,8 @@ static inline struct sk_buff *ip6_finish +@@ -918,6 +918,8 @@ static inline struct sk_buff *ip6_finish &inet6_sk(sk)->cork); } @@ -45,7 +45,7 @@ Signed-off-by: Pablo Neira Ayuso { --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig -@@ -71,6 +71,14 @@ config NFT_FIB_IPV6 +@@ -99,6 +99,14 @@ config NFT_FIB_IPV6 endif # NF_TABLES_IPV6 endif # NF_TABLES diff --git a/target/linux/generic/backport-4.14/327-v4.16-netfilter-nf_tables-remove-nhooks-field-from-struct-.patch b/target/linux/generic/backport-4.14/327-v4.16-netfilter-nf_tables-remove-nhooks-field-from-struct-.patch index d1b12ad0d..9c98fa73c 100644 --- a/target/linux/generic/backport-4.14/327-v4.16-netfilter-nf_tables-remove-nhooks-field-from-struct-.patch +++ b/target/linux/generic/backport-4.14/327-v4.16-netfilter-nf_tables-remove-nhooks-field-from-struct-.patch @@ -14,7 +14,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h -@@ -963,7 +963,6 @@ enum nft_af_flags { +@@ -968,7 +968,6 @@ enum nft_af_flags { * * @list: used internally * @family: address family @@ -22,7 +22,7 @@ Signed-off-by: Pablo Neira Ayuso * @owner: module owner * @tables: used internally * @flags: family flags -@@ -971,7 +970,6 @@ enum nft_af_flags { +@@ -976,7 +975,6 @@ enum nft_af_flags { struct nft_af_info { struct list_head list; int family; @@ -72,7 +72,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -1328,9 +1328,6 @@ static int nft_chain_parse_hook(struct n +@@ -1359,9 +1359,6 @@ static int nft_chain_parse_hook(struct n return -EINVAL; hook->num = ntohl(nla_get_be32(ha[NFTA_HOOK_HOOKNUM])); @@ -82,7 +82,7 @@ Signed-off-by: Pablo Neira Ayuso hook->priority = ntohl(nla_get_be32(ha[NFTA_HOOK_PRIORITY])); type = chain_type[afi->family][NFT_CHAIN_T_DEFAULT]; -@@ -4926,7 +4923,7 @@ static int nf_tables_flowtable_parse_hoo +@@ -4970,7 +4967,7 @@ static int nf_tables_flowtable_parse_hoo return -EINVAL; hooknum = ntohl(nla_get_be32(tb[NFTA_FLOWTABLE_HOOK_NUM])); diff --git a/target/linux/generic/backport-4.14/328-v4.16-netfilter-nf_tables-fix-a-typo-in-nf_tables_getflowt.patch b/target/linux/generic/backport-4.14/328-v4.16-netfilter-nf_tables-fix-a-typo-in-nf_tables_getflowt.patch index 1cfa0ae1c..d0863b836 100644 --- a/target/linux/generic/backport-4.14/328-v4.16-netfilter-nf_tables-fix-a-typo-in-nf_tables_getflowt.patch +++ b/target/linux/generic/backport-4.14/328-v4.16-netfilter-nf_tables-fix-a-typo-in-nf_tables_getflowt.patch @@ -11,7 +11,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5350,7 +5350,7 @@ static int nf_tables_getflowtable(struct +@@ -5394,7 +5394,7 @@ static int nf_tables_getflowtable(struct flowtable = nf_tables_flowtable_lookup(table, nla[NFTA_FLOWTABLE_NAME], genmask); diff --git a/target/linux/generic/backport-4.14/329-v4.16-netfilter-improve-flow-table-Kconfig-dependencies.patch b/target/linux/generic/backport-4.14/329-v4.16-netfilter-improve-flow-table-Kconfig-dependencies.patch index c897c3672..7174723fc 100644 --- a/target/linux/generic/backport-4.14/329-v4.16-netfilter-improve-flow-table-Kconfig-dependencies.patch +++ b/target/linux/generic/backport-4.14/329-v4.16-netfilter-improve-flow-table-Kconfig-dependencies.patch @@ -72,7 +72,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig -@@ -72,8 +72,9 @@ endif # NF_TABLES_IPV6 +@@ -100,8 +100,9 @@ endif # NF_TABLES_IPV6 endif # NF_TABLES config NF_FLOW_TABLE_IPV6 diff --git a/target/linux/generic/backport-4.14/330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch b/target/linux/generic/backport-4.14/330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch index 42aa7b1b0..c599ad79c 100644 --- a/target/linux/generic/backport-4.14/330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch +++ b/target/linux/generic/backport-4.14/330-v4.16-netfilter-nf_tables-remove-flag-field-from-struct-nf.patch @@ -10,7 +10,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h -@@ -954,10 +954,6 @@ struct nft_table { +@@ -959,10 +959,6 @@ struct nft_table { char *name; }; @@ -21,7 +21,7 @@ Signed-off-by: Pablo Neira Ayuso /** * struct nft_af_info - nf_tables address family info * -@@ -965,14 +961,12 @@ enum nft_af_flags { +@@ -970,14 +966,12 @@ enum nft_af_flags { * @family: address family * @owner: module owner * @tables: used internally @@ -38,7 +38,7 @@ Signed-off-by: Pablo Neira Ayuso int nft_register_afinfo(struct net *, struct nft_af_info *); --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -1345,7 +1345,7 @@ static int nft_chain_parse_hook(struct n +@@ -1376,7 +1376,7 @@ static int nft_chain_parse_hook(struct n hook->type = type; hook->dev = NULL; diff --git a/target/linux/generic/backport-4.14/331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch b/target/linux/generic/backport-4.14/331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch index b4d0130a7..aeef00330 100644 --- a/target/linux/generic/backport-4.14/331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch +++ b/target/linux/generic/backport-4.14/331-v4.16-netfilter-nf_tables-no-need-for-struct-nft_af_info-t.patch @@ -11,7 +11,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -611,10 +611,7 @@ err: +@@ -640,10 +640,7 @@ err: return err; } @@ -23,7 +23,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nft_chain *chain; u32 i = 0; -@@ -632,9 +629,7 @@ static void _nf_tables_table_disable(str +@@ -661,9 +658,7 @@ static void _nf_tables_table_disable(str } } @@ -34,7 +34,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nft_chain *chain; int err, i = 0; -@@ -654,15 +649,13 @@ static int nf_tables_table_enable(struct +@@ -683,15 +678,13 @@ static int nf_tables_table_enable(struct return 0; err: if (i) @@ -53,7 +53,7 @@ Signed-off-by: Pablo Neira Ayuso } static int nf_tables_updtable(struct nft_ctx *ctx) -@@ -691,7 +684,7 @@ static int nf_tables_updtable(struct nft +@@ -720,7 +713,7 @@ static int nf_tables_updtable(struct nft nft_trans_table_enable(trans) = false; } else if (!(flags & NFT_TABLE_F_DORMANT) && ctx->table->flags & NFT_TABLE_F_DORMANT) { @@ -62,7 +62,7 @@ Signed-off-by: Pablo Neira Ayuso if (ret >= 0) { ctx->table->flags &= ~NFT_TABLE_F_DORMANT; nft_trans_table_enable(trans) = true; -@@ -5728,7 +5721,6 @@ static int nf_tables_commit(struct net * +@@ -5772,7 +5765,6 @@ static int nf_tables_commit(struct net * if (nft_trans_table_update(trans)) { if (!nft_trans_table_enable(trans)) { nf_tables_table_disable(net, @@ -70,7 +70,7 @@ Signed-off-by: Pablo Neira Ayuso trans->ctx.table); trans->ctx.table->flags |= NFT_TABLE_F_DORMANT; } -@@ -5890,7 +5882,6 @@ static int nf_tables_abort(struct net *n +@@ -5934,7 +5926,6 @@ static int nf_tables_abort(struct net *n if (nft_trans_table_update(trans)) { if (nft_trans_table_enable(trans)) { nf_tables_table_disable(net, diff --git a/target/linux/generic/backport-4.14/332-v4.16-netfilter-nf_tables-remove-struct-nft_af_info-parame.patch b/target/linux/generic/backport-4.14/332-v4.16-netfilter-nf_tables-remove-struct-nft_af_info-parame.patch index 158f987fe..086178ae2 100644 --- a/target/linux/generic/backport-4.14/332-v4.16-netfilter-nf_tables-remove-struct-nft_af_info-parame.patch +++ b/target/linux/generic/backport-4.14/332-v4.16-netfilter-nf_tables-remove-struct-nft_af_info-parame.patch @@ -11,7 +11,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -423,7 +423,7 @@ static inline u64 nf_tables_alloc_handle +@@ -452,7 +452,7 @@ static inline u64 nf_tables_alloc_handle static const struct nf_chain_type *chain_type[NFPROTO_NUMPROTO][NFT_CHAIN_T_MAX]; static const struct nf_chain_type * @@ -20,7 +20,7 @@ Signed-off-by: Pablo Neira Ayuso { int i; -@@ -436,22 +436,20 @@ __nf_tables_chain_type_lookup(int family +@@ -465,22 +465,20 @@ __nf_tables_chain_type_lookup(int family } static const struct nf_chain_type * @@ -47,7 +47,7 @@ Signed-off-by: Pablo Neira Ayuso if (type != NULL) return ERR_PTR(-EAGAIN); } -@@ -1325,8 +1323,8 @@ static int nft_chain_parse_hook(struct n +@@ -1356,8 +1354,8 @@ static int nft_chain_parse_hook(struct n type = chain_type[afi->family][NFT_CHAIN_T_DEFAULT]; if (nla[NFTA_CHAIN_TYPE]) { diff --git a/target/linux/generic/backport-4.14/334-v4.15-netfilter-nf_tables-fix-potential-NULL-ptr-deref-in-.patch b/target/linux/generic/backport-4.14/334-v4.15-netfilter-nf_tables-fix-potential-NULL-ptr-deref-in-.patch index 14921f92a..d7c07244f 100644 --- a/target/linux/generic/backport-4.14/334-v4.15-netfilter-nf_tables-fix-potential-NULL-ptr-deref-in-.patch +++ b/target/linux/generic/backport-4.14/334-v4.15-netfilter-nf_tables-fix-potential-NULL-ptr-deref-in-.patch @@ -15,7 +15,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5269,8 +5269,10 @@ static int nf_tables_dump_flowtable_done +@@ -5313,8 +5313,10 @@ static int nf_tables_dump_flowtable_done if (!filter) return 0; diff --git a/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch b/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch index 787f62ef8..320a90c11 100644 --- a/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch +++ b/target/linux/generic/backport-4.14/335-v4.16-netfilter-nf_tables-add-single-table-list-for-all-fa.patch @@ -42,7 +42,7 @@ Signed-off-by: Pablo Neira Ayuso bool report; }; -@@ -939,6 +939,7 @@ unsigned int nft_do_chain(struct nft_pkt +@@ -944,6 +944,7 @@ unsigned int nft_do_chain(struct nft_pkt * @use: number of chain references to this table * @flags: table flag (see enum nft_table_flags) * @genmask: generation mask @@ -50,7 +50,7 @@ Signed-off-by: Pablo Neira Ayuso * @name: name of the table */ struct nft_table { -@@ -951,6 +952,7 @@ struct nft_table { +@@ -956,6 +957,7 @@ struct nft_table { u32 use; u16 flags:14, genmask:2; @@ -58,7 +58,7 @@ Signed-off-by: Pablo Neira Ayuso char *name; }; -@@ -960,13 +962,11 @@ struct nft_table { +@@ -965,13 +967,11 @@ struct nft_table { * @list: used internally * @family: address family * @owner: module owner @@ -108,7 +108,7 @@ Signed-off-by: Pablo Neira Ayuso ctx->table = table; ctx->chain = chain; ctx->nla = nla; -@@ -385,30 +384,31 @@ static int nft_delflowtable(struct nft_c +@@ -414,30 +413,31 @@ static int nft_delflowtable(struct nft_c * Tables */ @@ -146,7 +146,7 @@ Signed-off-by: Pablo Neira Ayuso if (table != NULL) return table; -@@ -507,7 +507,7 @@ static void nf_tables_table_notify(const +@@ -536,7 +536,7 @@ static void nf_tables_table_notify(const goto err; err = nf_tables_fill_table_info(skb, ctx->net, ctx->portid, ctx->seq, @@ -155,7 +155,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) { kfree_skb(skb); goto err; -@@ -524,7 +524,6 @@ static int nf_tables_dump_tables(struct +@@ -553,7 +553,6 @@ static int nf_tables_dump_tables(struct struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); @@ -163,7 +163,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; unsigned int idx = 0, s_idx = cb->args[0]; struct net *net = sock_net(skb->sk); -@@ -533,30 +532,27 @@ static int nf_tables_dump_tables(struct +@@ -562,30 +561,27 @@ static int nf_tables_dump_tables(struct rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -211,7 +211,7 @@ Signed-off-by: Pablo Neira Ayuso } done: rcu_read_unlock(); -@@ -588,7 +584,8 @@ static int nf_tables_gettable(struct net +@@ -617,7 +613,8 @@ static int nf_tables_gettable(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -221,7 +221,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -719,7 +716,7 @@ static int nf_tables_newtable(struct net +@@ -748,7 +745,7 @@ static int nf_tables_newtable(struct net return PTR_ERR(afi); name = nla[NFTA_TABLE_NAME]; @@ -230,7 +230,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) { if (PTR_ERR(table) != -ENOENT) return PTR_ERR(table); -@@ -729,7 +726,7 @@ static int nf_tables_newtable(struct net +@@ -758,7 +755,7 @@ static int nf_tables_newtable(struct net if (nlh->nlmsg_flags & NLM_F_REPLACE) return -EOPNOTSUPP; @@ -239,7 +239,7 @@ Signed-off-by: Pablo Neira Ayuso return nf_tables_updtable(&ctx); } -@@ -756,14 +753,15 @@ static int nf_tables_newtable(struct net +@@ -785,14 +782,15 @@ static int nf_tables_newtable(struct net INIT_LIST_HEAD(&table->sets); INIT_LIST_HEAD(&table->objects); INIT_LIST_HEAD(&table->flowtables); @@ -257,7 +257,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; err4: kfree(table->name); -@@ -837,30 +835,28 @@ out: +@@ -866,30 +864,28 @@ out: static int nft_flush(struct nft_ctx *ctx, int family) { @@ -301,7 +301,7 @@ Signed-off-by: Pablo Neira Ayuso } out: return err; -@@ -878,7 +874,7 @@ static int nf_tables_deltable(struct net +@@ -907,7 +903,7 @@ static int nf_tables_deltable(struct net int family = nfmsg->nfgen_family; struct nft_ctx ctx; @@ -310,7 +310,7 @@ Signed-off-by: Pablo Neira Ayuso if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL) return nft_flush(&ctx, family); -@@ -886,7 +882,8 @@ static int nf_tables_deltable(struct net +@@ -915,7 +911,8 @@ static int nf_tables_deltable(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -320,7 +320,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -894,7 +891,7 @@ static int nf_tables_deltable(struct net +@@ -923,7 +920,7 @@ static int nf_tables_deltable(struct net table->use > 0) return -EBUSY; @@ -329,7 +329,7 @@ Signed-off-by: Pablo Neira Ayuso ctx.table = table; return nft_flush_table(&ctx); -@@ -906,7 +903,7 @@ static void nf_tables_table_destroy(stru +@@ -935,7 +932,7 @@ static void nf_tables_table_destroy(stru kfree(ctx->table->name); kfree(ctx->table); @@ -338,7 +338,7 @@ Signed-off-by: Pablo Neira Ayuso } int nft_register_chain_type(const struct nf_chain_type *ctype) -@@ -1107,7 +1104,7 @@ static void nf_tables_chain_notify(const +@@ -1136,7 +1133,7 @@ static void nf_tables_chain_notify(const goto err; err = nf_tables_fill_chain_info(skb, ctx->net, ctx->portid, ctx->seq, @@ -347,7 +347,7 @@ Signed-off-by: Pablo Neira Ayuso ctx->chain); if (err < 0) { kfree_skb(skb); -@@ -1125,7 +1122,6 @@ static int nf_tables_dump_chains(struct +@@ -1154,7 +1151,6 @@ static int nf_tables_dump_chains(struct struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); @@ -355,7 +355,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; const struct nft_chain *chain; unsigned int idx = 0, s_idx = cb->args[0]; -@@ -1135,31 +1131,30 @@ static int nf_tables_dump_chains(struct +@@ -1164,31 +1160,30 @@ static int nf_tables_dump_chains(struct rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -407,7 +407,7 @@ Signed-off-by: Pablo Neira Ayuso } } done: -@@ -1193,7 +1188,8 @@ static int nf_tables_getchain(struct net +@@ -1222,7 +1217,8 @@ static int nf_tables_getchain(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -417,7 +417,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -1301,8 +1297,8 @@ struct nft_chain_hook { +@@ -1332,8 +1328,8 @@ struct nft_chain_hook { static int nft_chain_parse_hook(struct net *net, const struct nlattr * const nla[], @@ -428,7 +428,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nlattr *ha[NFTA_HOOK_MAX + 1]; const struct nf_chain_type *type; -@@ -1321,10 +1317,10 @@ static int nft_chain_parse_hook(struct n +@@ -1352,10 +1348,10 @@ static int nft_chain_parse_hook(struct n hook->num = ntohl(nla_get_be32(ha[NFTA_HOOK_HOOKNUM])); hook->priority = ntohl(nla_get_be32(ha[NFTA_HOOK_PRIORITY])); @@ -441,7 +441,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(type)) return PTR_ERR(type); } -@@ -1336,7 +1332,7 @@ static int nft_chain_parse_hook(struct n +@@ -1367,7 +1363,7 @@ static int nft_chain_parse_hook(struct n hook->type = type; hook->dev = NULL; @@ -450,7 +450,7 @@ Signed-off-by: Pablo Neira Ayuso char ifname[IFNAMSIZ]; if (!ha[NFTA_HOOK_DEV]) { -@@ -1371,7 +1367,6 @@ static int nf_tables_addchain(struct nft +@@ -1402,7 +1398,6 @@ static int nf_tables_addchain(struct nft { const struct nlattr * const *nla = ctx->nla; struct nft_table *table = ctx->table; @@ -458,7 +458,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_base_chain *basechain; struct nft_stats __percpu *stats; struct net *net = ctx->net; -@@ -1385,7 +1380,7 @@ static int nf_tables_addchain(struct nft +@@ -1416,7 +1411,7 @@ static int nf_tables_addchain(struct nft struct nft_chain_hook hook; struct nf_hook_ops *ops; @@ -467,7 +467,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) return err; -@@ -1478,7 +1473,7 @@ static int nf_tables_updchain(struct nft +@@ -1509,7 +1504,7 @@ static int nf_tables_updchain(struct nft if (!nft_is_base_chain(chain)) return -EBUSY; @@ -476,7 +476,7 @@ Signed-off-by: Pablo Neira Ayuso create); if (err < 0) return err; -@@ -1571,7 +1566,8 @@ static int nf_tables_newchain(struct net +@@ -1602,7 +1597,8 @@ static int nf_tables_newchain(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -486,7 +486,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -1611,7 +1607,7 @@ static int nf_tables_newchain(struct net +@@ -1642,7 +1638,7 @@ static int nf_tables_newchain(struct net } } @@ -495,7 +495,7 @@ Signed-off-by: Pablo Neira Ayuso if (chain != NULL) { if (nlh->nlmsg_flags & NLM_F_EXCL) -@@ -1645,7 +1641,8 @@ static int nf_tables_delchain(struct net +@@ -1676,7 +1672,8 @@ static int nf_tables_delchain(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -505,7 +505,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -1657,7 +1654,7 @@ static int nf_tables_delchain(struct net +@@ -1688,7 +1685,7 @@ static int nf_tables_delchain(struct net chain->use > 0) return -EBUSY; @@ -514,7 +514,7 @@ Signed-off-by: Pablo Neira Ayuso use = chain->use; list_for_each_entry(rule, &chain->rules, list) { -@@ -1822,7 +1819,7 @@ static int nf_tables_expr_parse(const st +@@ -1853,7 +1850,7 @@ static int nf_tables_expr_parse(const st if (err < 0) return err; @@ -523,7 +523,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(type)) return PTR_ERR(type); -@@ -2045,7 +2042,7 @@ static void nf_tables_rule_notify(const +@@ -2077,7 +2074,7 @@ static void nf_tables_rule_notify(const goto err; err = nf_tables_fill_rule_info(skb, ctx->net, ctx->portid, ctx->seq, @@ -532,7 +532,7 @@ Signed-off-by: Pablo Neira Ayuso ctx->chain, rule); if (err < 0) { kfree_skb(skb); -@@ -2069,7 +2066,6 @@ static int nf_tables_dump_rules(struct s +@@ -2101,7 +2098,6 @@ static int nf_tables_dump_rules(struct s { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); const struct nft_rule_dump_ctx *ctx = cb->data; @@ -540,7 +540,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; const struct nft_chain *chain; const struct nft_rule *rule; -@@ -2080,39 +2076,37 @@ static int nf_tables_dump_rules(struct s +@@ -2112,39 +2108,37 @@ static int nf_tables_dump_rules(struct s rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -605,7 +605,7 @@ Signed-off-by: Pablo Neira Ayuso } } } -@@ -2190,7 +2184,8 @@ static int nf_tables_getrule(struct net +@@ -2222,7 +2216,8 @@ static int nf_tables_getrule(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -615,7 +615,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -2267,7 +2262,8 @@ static int nf_tables_newrule(struct net +@@ -2306,7 +2301,8 @@ static int nf_tables_newrule(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -625,7 +625,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -2306,7 +2302,7 @@ static int nf_tables_newrule(struct net +@@ -2345,7 +2341,7 @@ static int nf_tables_newrule(struct net return PTR_ERR(old_rule); } @@ -634,7 +634,7 @@ Signed-off-by: Pablo Neira Ayuso n = 0; size = 0; -@@ -2446,7 +2442,8 @@ static int nf_tables_delrule(struct net +@@ -2485,7 +2481,8 @@ static int nf_tables_delrule(struct net if (IS_ERR(afi)) return PTR_ERR(afi); @@ -644,7 +644,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -2457,7 +2454,7 @@ static int nf_tables_delrule(struct net +@@ -2496,7 +2493,7 @@ static int nf_tables_delrule(struct net return PTR_ERR(chain); } @@ -653,7 +653,7 @@ Signed-off-by: Pablo Neira Ayuso if (chain) { if (nla[NFTA_RULE_HANDLE]) { -@@ -2655,13 +2652,13 @@ static int nft_ctx_init_from_setattr(str +@@ -2694,13 +2691,13 @@ static int nft_ctx_init_from_setattr(str if (afi == NULL) return -EAFNOSUPPORT; @@ -670,7 +670,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -2788,7 +2785,7 @@ static int nf_tables_fill_set(struct sk_ +@@ -2828,7 +2825,7 @@ static int nf_tables_fill_set(struct sk_ goto nla_put_failure; nfmsg = nlmsg_data(nlh); @@ -679,7 +679,7 @@ Signed-off-by: Pablo Neira Ayuso nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(ctx->net->nft.base_seq & 0xffff); -@@ -2880,10 +2877,8 @@ static int nf_tables_dump_sets(struct sk +@@ -2920,10 +2917,8 @@ static int nf_tables_dump_sets(struct sk { const struct nft_set *set; unsigned int idx, s_idx = cb->args[0]; @@ -690,7 +690,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_ctx *ctx = cb->data, ctx_set; if (cb->args[1]) -@@ -2892,51 +2887,44 @@ static int nf_tables_dump_sets(struct sk +@@ -2932,51 +2927,44 @@ static int nf_tables_dump_sets(struct sk rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -771,7 +771,7 @@ Signed-off-by: Pablo Neira Ayuso } cb->args[1] = 1; done: -@@ -3146,11 +3134,12 @@ static int nf_tables_newset(struct net * +@@ -3186,11 +3174,12 @@ static int nf_tables_newset(struct net * if (IS_ERR(afi)) return PTR_ERR(afi); @@ -786,7 +786,7 @@ Signed-off-by: Pablo Neira Ayuso set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME], genmask); if (IS_ERR(set)) { -@@ -3417,12 +3406,12 @@ static int nft_ctx_init_from_elemattr(st +@@ -3459,12 +3448,12 @@ static int nft_ctx_init_from_elemattr(st if (IS_ERR(afi)) return PTR_ERR(afi); @@ -802,7 +802,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -3527,7 +3516,6 @@ static int nf_tables_dump_set(struct sk_ +@@ -3569,7 +3558,6 @@ static int nf_tables_dump_set(struct sk_ { struct nft_set_dump_ctx *dump_ctx = cb->data; struct net *net = sock_net(skb->sk); @@ -810,7 +810,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_set *set; struct nft_set_dump_args args; -@@ -3539,21 +3527,19 @@ static int nf_tables_dump_set(struct sk_ +@@ -3581,21 +3569,19 @@ static int nf_tables_dump_set(struct sk_ int event; rcu_read_lock(); @@ -841,7 +841,7 @@ Signed-off-by: Pablo Neira Ayuso } break; } -@@ -3573,7 +3559,7 @@ static int nf_tables_dump_set(struct sk_ +@@ -3615,7 +3601,7 @@ static int nf_tables_dump_set(struct sk_ goto nla_put_failure; nfmsg = nlmsg_data(nlh); @@ -850,7 +850,7 @@ Signed-off-by: Pablo Neira Ayuso nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(net->nft.base_seq & 0xffff); -@@ -3675,7 +3661,7 @@ static int nf_tables_fill_setelem_info(s +@@ -3717,7 +3703,7 @@ static int nf_tables_fill_setelem_info(s goto nla_put_failure; nfmsg = nlmsg_data(nlh); @@ -859,7 +859,7 @@ Signed-off-by: Pablo Neira Ayuso nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(ctx->net->nft.base_seq & 0xffff); -@@ -3919,7 +3905,7 @@ static int nft_add_set_elem(struct nft_c +@@ -3961,7 +3947,7 @@ static int nft_add_set_elem(struct nft_c list_for_each_entry(binding, &set->bindings, list) { struct nft_ctx bind_ctx = { .net = ctx->net, @@ -868,7 +868,7 @@ Signed-off-by: Pablo Neira Ayuso .table = ctx->table, .chain = (struct nft_chain *)binding->chain, }; -@@ -4466,7 +4452,8 @@ static int nf_tables_newobj(struct net * +@@ -4510,7 +4496,8 @@ static int nf_tables_newobj(struct net * if (IS_ERR(afi)) return PTR_ERR(afi); @@ -878,7 +878,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -4484,7 +4471,7 @@ static int nf_tables_newobj(struct net * +@@ -4528,7 +4515,7 @@ static int nf_tables_newobj(struct net * return 0; } @@ -887,7 +887,7 @@ Signed-off-by: Pablo Neira Ayuso type = nft_obj_type_get(objtype); if (IS_ERR(type)) -@@ -4561,7 +4548,6 @@ struct nft_obj_filter { +@@ -4605,7 +4592,6 @@ struct nft_obj_filter { static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb) { const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); @@ -895,7 +895,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; unsigned int idx = 0, s_idx = cb->args[0]; struct nft_obj_filter *filter = cb->data; -@@ -4576,38 +4562,37 @@ static int nf_tables_dump_obj(struct sk_ +@@ -4620,38 +4606,37 @@ static int nf_tables_dump_obj(struct sk_ rcu_read_lock(); cb->seq = net->nft.base_seq; @@ -914,7 +914,7 @@ Signed-off-by: Pablo Neira Ayuso - if (idx > s_idx) - memset(&cb->args[1], 0, - sizeof(cb->args) - sizeof(cb->args[0])); -- if (filter && filter->table[0] && +- if (filter && filter->table && - strcmp(filter->table, table->name)) - goto cont; - if (filter && @@ -929,7 +929,7 @@ Signed-off-by: Pablo Neira Ayuso + if (idx > s_idx) + memset(&cb->args[1], 0, + sizeof(cb->args) - sizeof(cb->args[0])); -+ if (filter && filter->table[0] && ++ if (filter && filter->table && + strcmp(filter->table, table->name)) + goto cont; + if (filter && @@ -960,7 +960,7 @@ Signed-off-by: Pablo Neira Ayuso } } done: -@@ -4694,7 +4679,8 @@ static int nf_tables_getobj(struct net * +@@ -4738,7 +4723,8 @@ static int nf_tables_getobj(struct net * if (IS_ERR(afi)) return PTR_ERR(afi); @@ -970,7 +970,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -4754,7 +4740,8 @@ static int nf_tables_delobj(struct net * +@@ -4798,7 +4784,8 @@ static int nf_tables_delobj(struct net * if (IS_ERR(afi)) return PTR_ERR(afi); @@ -980,7 +980,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -4765,7 +4752,7 @@ static int nf_tables_delobj(struct net * +@@ -4809,7 +4796,7 @@ static int nf_tables_delobj(struct net * if (obj->use > 0) return -EBUSY; @@ -989,7 +989,7 @@ Signed-off-by: Pablo Neira Ayuso return nft_delobj(&ctx, obj); } -@@ -4803,7 +4790,7 @@ static void nf_tables_obj_notify(const s +@@ -4847,7 +4834,7 @@ static void nf_tables_obj_notify(const s struct nft_object *obj, int event) { nft_obj_notify(ctx->net, ctx->table, obj, ctx->portid, ctx->seq, event, @@ -998,7 +998,7 @@ Signed-off-by: Pablo Neira Ayuso } /* -@@ -4993,7 +4980,7 @@ void nft_flow_table_iterate(struct net * +@@ -5037,7 +5024,7 @@ void nft_flow_table_iterate(struct net * rcu_read_lock(); list_for_each_entry_rcu(afi, &net->nft.af_info, list) { @@ -1007,7 +1007,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry_rcu(flowtable, &table->flowtables, list) { iter(&flowtable->data, data); } -@@ -5041,7 +5028,8 @@ static int nf_tables_newflowtable(struct +@@ -5085,7 +5072,8 @@ static int nf_tables_newflowtable(struct if (IS_ERR(afi)) return PTR_ERR(afi); @@ -1017,7 +1017,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5058,7 +5046,7 @@ static int nf_tables_newflowtable(struct +@@ -5102,7 +5090,7 @@ static int nf_tables_newflowtable(struct return 0; } @@ -1026,7 +1026,7 @@ Signed-off-by: Pablo Neira Ayuso flowtable = kzalloc(sizeof(*flowtable), GFP_KERNEL); if (!flowtable) -@@ -5139,7 +5127,8 @@ static int nf_tables_delflowtable(struct +@@ -5183,7 +5171,8 @@ static int nf_tables_delflowtable(struct if (IS_ERR(afi)) return PTR_ERR(afi); @@ -1036,7 +1036,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5150,7 +5139,7 @@ static int nf_tables_delflowtable(struct +@@ -5194,7 +5183,7 @@ static int nf_tables_delflowtable(struct if (flowtable->use > 0) return -EBUSY; @@ -1045,7 +1045,7 @@ Signed-off-by: Pablo Neira Ayuso return nft_delflowtable(&ctx, flowtable); } -@@ -5219,40 +5208,37 @@ static int nf_tables_dump_flowtable(stru +@@ -5263,40 +5252,37 @@ static int nf_tables_dump_flowtable(stru struct net *net = sock_net(skb->sk); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; @@ -1081,7 +1081,7 @@ Signed-off-by: Pablo Neira Ayuso + if (idx > s_idx) + memset(&cb->args[1], 0, + sizeof(cb->args) - sizeof(cb->args[0])); -+ if (filter && filter->table[0] && ++ if (filter && filter->table && + strcmp(filter->table, table->name)) + goto cont; @@ -1107,7 +1107,7 @@ Signed-off-by: Pablo Neira Ayuso } } done: -@@ -5337,7 +5323,8 @@ static int nf_tables_getflowtable(struct +@@ -5381,7 +5367,8 @@ static int nf_tables_getflowtable(struct if (IS_ERR(afi)) return PTR_ERR(afi); @@ -1117,7 +1117,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5380,7 +5367,7 @@ static void nf_tables_flowtable_notify(s +@@ -5424,7 +5411,7 @@ static void nf_tables_flowtable_notify(s err = nf_tables_fill_flowtable_info(skb, ctx->net, ctx->portid, ctx->seq, event, 0, @@ -1126,7 +1126,7 @@ Signed-off-by: Pablo Neira Ayuso if (err < 0) { kfree_skb(skb); goto err; -@@ -5458,17 +5445,14 @@ static int nf_tables_flowtable_event(str +@@ -5502,17 +5489,14 @@ static int nf_tables_flowtable_event(str struct net_device *dev = netdev_notifier_info_to_dev(ptr); struct nft_flowtable *flowtable; struct nft_table *table; @@ -1147,7 +1147,7 @@ Signed-off-by: Pablo Neira Ayuso } } nfnl_unlock(NFNL_SUBSYS_NFTABLES); -@@ -6487,6 +6471,7 @@ EXPORT_SYMBOL_GPL(nft_data_dump); +@@ -6533,6 +6517,7 @@ EXPORT_SYMBOL_GPL(nft_data_dump); static int __net_init nf_tables_init_net(struct net *net) { INIT_LIST_HEAD(&net->nft.af_info); @@ -1155,7 +1155,7 @@ Signed-off-by: Pablo Neira Ayuso INIT_LIST_HEAD(&net->nft.commit_list); net->nft.base_seq = 1; return 0; -@@ -6523,10 +6508,10 @@ static void __nft_release_afinfo(struct +@@ -6569,10 +6554,10 @@ static void __nft_release_afinfo(struct struct nft_set *set, *ns; struct nft_ctx ctx = { .net = net, @@ -1210,7 +1210,7 @@ Signed-off-by: Pablo Neira Ayuso nfnl_unlock(NFNL_SUBSYS_NFTABLES); --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c -@@ -144,7 +144,7 @@ nft_target_set_tgchk_param(struct xt_tgc +@@ -161,7 +161,7 @@ nft_target_set_tgchk_param(struct xt_tgc { par->net = ctx->net; par->table = ctx->table->name; @@ -1219,7 +1219,7 @@ Signed-off-by: Pablo Neira Ayuso case AF_INET: entry->e4.ip.proto = proto; entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0; -@@ -175,7 +175,7 @@ nft_target_set_tgchk_param(struct xt_tgc +@@ -192,7 +192,7 @@ nft_target_set_tgchk_param(struct xt_tgc } else { par->hook_mask = 0; } @@ -1228,7 +1228,7 @@ Signed-off-by: Pablo Neira Ayuso par->nft_compat = true; } -@@ -267,7 +267,7 @@ nft_target_destroy(const struct nft_ctx +@@ -282,7 +282,7 @@ nft_target_destroy(const struct nft_ctx par.net = ctx->net; par.target = target; par.targinfo = info; @@ -1237,7 +1237,7 @@ Signed-off-by: Pablo Neira Ayuso if (par.target->destroy != NULL) par.target->destroy(&par); -@@ -358,7 +358,7 @@ nft_match_set_mtchk_param(struct xt_mtch +@@ -389,7 +389,7 @@ nft_match_set_mtchk_param(struct xt_mtch { par->net = ctx->net; par->table = ctx->table->name; @@ -1246,7 +1246,7 @@ Signed-off-by: Pablo Neira Ayuso case AF_INET: entry->e4.ip.proto = proto; entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0; -@@ -389,7 +389,7 @@ nft_match_set_mtchk_param(struct xt_mtch +@@ -420,7 +420,7 @@ nft_match_set_mtchk_param(struct xt_mtch } else { par->hook_mask = 0; } @@ -1255,7 +1255,7 @@ Signed-off-by: Pablo Neira Ayuso par->nft_compat = true; } -@@ -446,7 +446,7 @@ nft_match_destroy(const struct nft_ctx * +@@ -502,7 +502,7 @@ __nft_match_destroy(const struct nft_ctx par.net = ctx->net; par.match = match; par.matchinfo = info; @@ -1264,7 +1264,7 @@ Signed-off-by: Pablo Neira Ayuso if (par.match->destroy != NULL) par.match->destroy(&par); -@@ -648,7 +648,7 @@ nft_match_select_ops(const struct nft_ct +@@ -732,7 +732,7 @@ nft_match_select_ops(const struct nft_ct mt_name = nla_data(tb[NFTA_MATCH_NAME]); rev = ntohl(nla_get_be32(tb[NFTA_MATCH_REV])); @@ -1273,7 +1273,7 @@ Signed-off-by: Pablo Neira Ayuso /* Re-use the existing match if it's already loaded. */ list_for_each_entry(nft_match, &nft_match_list, head) { -@@ -733,7 +733,7 @@ nft_target_select_ops(const struct nft_c +@@ -823,7 +823,7 @@ nft_target_select_ops(const struct nft_c tg_name = nla_data(tb[NFTA_TARGET_NAME]); rev = ntohl(nla_get_be32(tb[NFTA_TARGET_REV])); @@ -1408,7 +1408,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nft_meta.c +++ b/net/netfilter/nft_meta.c -@@ -339,7 +339,7 @@ static int nft_meta_get_validate(const s +@@ -341,7 +341,7 @@ static int nft_meta_get_validate(const s if (priv->key != NFT_META_SECPATH) return 0; @@ -1417,7 +1417,7 @@ Signed-off-by: Pablo Neira Ayuso case NFPROTO_NETDEV: hooks = 1 << NF_NETDEV_INGRESS; break; -@@ -370,7 +370,7 @@ int nft_meta_set_validate(const struct n +@@ -372,7 +372,7 @@ int nft_meta_set_validate(const struct n if (priv->key != NFT_META_PKTTYPE) return 0; diff --git a/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch b/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch index cd5670675..0d973ac02 100644 --- a/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch +++ b/target/linux/generic/backport-4.14/336-v4.15-netfilter-exit_net-cleanup-check-added.patch @@ -21,7 +21,7 @@ Signed-off-by: Pablo Neira Ayuso static struct pernet_operations clusterip_net_ops = { --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -6477,6 +6477,12 @@ static int __net_init nf_tables_init_net(struct net *net) +@@ -6523,6 +6523,12 @@ static int __net_init nf_tables_init_net return 0; } @@ -34,7 +34,7 @@ Signed-off-by: Pablo Neira Ayuso int __nft_release_basechain(struct nft_ctx *ctx) { struct nft_rule *rule, *nr; -@@ -6554,6 +6560,7 @@ static void __nft_release_afinfo(struct net *net, struct nft_af_info *afi) +@@ -6600,6 +6606,7 @@ static void __nft_release_afinfo(struct static struct pernet_operations nf_tables_net_ops = { .init = nf_tables_init_net, @@ -44,7 +44,7 @@ Signed-off-by: Pablo Neira Ayuso static int __init nf_tables_module_init(void) --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c -@@ -1093,10 +1093,15 @@ static int __net_init nfnl_log_net_init(struct net *net) +@@ -1093,10 +1093,15 @@ static int __net_init nfnl_log_net_init( static void __net_exit nfnl_log_net_exit(struct net *net) { @@ -62,7 +62,7 @@ Signed-off-by: Pablo Neira Ayuso static struct pernet_operations nfnl_log_net_ops = { --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c -@@ -1512,10 +1512,15 @@ static int __net_init nfnl_queue_net_init(struct net *net) +@@ -1515,10 +1515,15 @@ static int __net_init nfnl_queue_net_ini static void __net_exit nfnl_queue_net_exit(struct net *net) { @@ -80,7 +80,7 @@ Signed-off-by: Pablo Neira Ayuso static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list) --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c -@@ -1785,8 +1785,17 @@ static int __net_init xt_net_init(struct net *net) +@@ -1785,8 +1785,17 @@ static int __net_init xt_net_init(struct return 0; } diff --git a/target/linux/generic/backport-4.14/337-v4.16-netfilter-nf_tables-get-rid-of-pernet-families.patch b/target/linux/generic/backport-4.14/337-v4.16-netfilter-nf_tables-get-rid-of-pernet-families.patch index 1db472dd6..0ea11524f 100644 --- a/target/linux/generic/backport-4.14/337-v4.16-netfilter-nf_tables-get-rid-of-pernet-families.patch +++ b/target/linux/generic/backport-4.14/337-v4.16-netfilter-nf_tables-get-rid-of-pernet-families.patch @@ -14,7 +14,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h -@@ -969,8 +969,8 @@ struct nft_af_info { +@@ -974,8 +974,8 @@ struct nft_af_info { struct module *owner; }; @@ -364,7 +364,7 @@ Signed-off-by: Pablo Neira Ayuso if (afi->family == family) return afi; } -@@ -4975,15 +4973,12 @@ void nft_flow_table_iterate(struct net * +@@ -5019,15 +5017,12 @@ void nft_flow_table_iterate(struct net * void *data) { struct nft_flowtable *flowtable; @@ -383,7 +383,7 @@ Signed-off-by: Pablo Neira Ayuso } } rcu_read_unlock(); -@@ -6468,21 +6463,6 @@ int nft_data_dump(struct sk_buff *skb, i +@@ -6514,21 +6509,6 @@ int nft_data_dump(struct sk_buff *skb, i } EXPORT_SYMBOL_GPL(nft_data_dump); @@ -405,7 +405,7 @@ Signed-off-by: Pablo Neira Ayuso int __nft_release_basechain(struct nft_ctx *ctx) { struct nft_rule *rule, *nr; -@@ -6503,8 +6483,7 @@ int __nft_release_basechain(struct nft_c +@@ -6549,8 +6529,7 @@ int __nft_release_basechain(struct nft_c } EXPORT_SYMBOL_GPL(__nft_release_basechain); @@ -415,7 +415,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nft_flowtable *flowtable, *nf; struct nft_table *table, *nt; -@@ -6514,10 +6493,11 @@ static void __nft_release_afinfo(struct +@@ -6560,10 +6539,11 @@ static void __nft_release_afinfo(struct struct nft_set *set, *ns; struct nft_ctx ctx = { .net = net, @@ -428,7 +428,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry(chain, &table->chains, list) nf_tables_unregister_hook(net, table, chain); list_for_each_entry(flowtable, &table->flowtables, list) -@@ -6558,6 +6538,21 @@ static void __nft_release_afinfo(struct +@@ -6604,6 +6584,21 @@ static void __nft_release_afinfo(struct } } diff --git a/target/linux/generic/backport-4.14/338-v4.16-netfilter-nf_tables-get-rid-of-struct-nft_af_info-ab.patch b/target/linux/generic/backport-4.14/338-v4.16-netfilter-nf_tables-get-rid-of-struct-nft_af_info-ab.patch index 031f67e5b..0752d6939 100644 --- a/target/linux/generic/backport-4.14/338-v4.16-netfilter-nf_tables-get-rid-of-struct-nft_af_info-ab.patch +++ b/target/linux/generic/backport-4.14/338-v4.16-netfilter-nf_tables-get-rid-of-struct-nft_af_info-ab.patch @@ -11,7 +11,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h -@@ -950,28 +950,12 @@ struct nft_table { +@@ -955,28 +955,12 @@ struct nft_table { struct list_head flowtables; u64 hgenerator; u32 use; @@ -42,7 +42,7 @@ Signed-off-by: Pablo Neira Ayuso int nft_register_chain_type(const struct nf_chain_type *); void nft_unregister_chain_type(const struct nf_chain_type *); -@@ -1139,9 +1123,6 @@ void nft_trace_notify(struct nft_tracein +@@ -1144,9 +1128,6 @@ void nft_trace_notify(struct nft_tracein #define nft_dereference(p) \ nfnl_dereference(p, NFNL_SUBSYS_NFTABLES) @@ -323,7 +323,7 @@ Signed-off-by: Pablo Neira Ayuso static void nft_ctx_init(struct nft_ctx *ctx, struct net *net, -@@ -390,7 +325,7 @@ static struct nft_table *nft_table_looku +@@ -419,7 +354,7 @@ static struct nft_table *nft_table_looku list_for_each_entry(table, &net->nft.tables, list) { if (!nla_strcmp(nla, table->name) && @@ -332,7 +332,7 @@ Signed-off-by: Pablo Neira Ayuso nft_active_genmask(table, genmask)) return table; } -@@ -531,7 +466,7 @@ static int nf_tables_dump_tables(struct +@@ -560,7 +495,7 @@ static int nf_tables_dump_tables(struct cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -341,7 +341,7 @@ Signed-off-by: Pablo Neira Ayuso continue; if (idx < s_idx) -@@ -545,7 +480,7 @@ static int nf_tables_dump_tables(struct +@@ -574,7 +509,7 @@ static int nf_tables_dump_tables(struct NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NFT_MSG_NEWTABLE, NLM_F_MULTI, @@ -350,7 +350,7 @@ Signed-off-by: Pablo Neira Ayuso goto done; nl_dump_check_consistent(cb, nlmsg_hdr(skb)); -@@ -565,7 +500,6 @@ static int nf_tables_gettable(struct net +@@ -594,7 +529,6 @@ static int nf_tables_gettable(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_cur(net); @@ -358,7 +358,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; struct sk_buff *skb2; int family = nfmsg->nfgen_family; -@@ -578,11 +512,7 @@ static int nf_tables_gettable(struct net +@@ -607,11 +541,7 @@ static int nf_tables_gettable(struct net return netlink_dump_start(nlsk, skb, nlh, &c); } @@ -371,7 +371,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -702,19 +632,14 @@ static int nf_tables_newtable(struct net +@@ -731,19 +661,14 @@ static int nf_tables_newtable(struct net const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); const struct nlattr *name; @@ -392,7 +392,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) { if (PTR_ERR(table) != -ENOENT) return PTR_ERR(table); -@@ -724,7 +649,7 @@ static int nf_tables_newtable(struct net +@@ -753,7 +678,7 @@ static int nf_tables_newtable(struct net if (nlh->nlmsg_flags & NLM_F_REPLACE) return -EOPNOTSUPP; @@ -401,7 +401,7 @@ Signed-off-by: Pablo Neira Ayuso return nf_tables_updtable(&ctx); } -@@ -734,40 +659,34 @@ static int nf_tables_newtable(struct net +@@ -763,40 +688,34 @@ static int nf_tables_newtable(struct net return -EINVAL; } @@ -450,7 +450,7 @@ Signed-off-by: Pablo Neira Ayuso return err; } -@@ -838,10 +757,10 @@ static int nft_flush(struct nft_ctx *ctx +@@ -867,10 +786,10 @@ static int nft_flush(struct nft_ctx *ctx int err = 0; list_for_each_entry_safe(table, nt, &ctx->net->nft.tables, list) { @@ -463,7 +463,7 @@ Signed-off-by: Pablo Neira Ayuso if (!nft_is_active_next(ctx->net, table)) continue; -@@ -867,7 +786,6 @@ static int nf_tables_deltable(struct net +@@ -896,7 +815,6 @@ static int nf_tables_deltable(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -471,7 +471,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; int family = nfmsg->nfgen_family; struct nft_ctx ctx; -@@ -876,11 +794,7 @@ static int nf_tables_deltable(struct net +@@ -905,11 +823,7 @@ static int nf_tables_deltable(struct net if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL) return nft_flush(&ctx, family); @@ -484,7 +484,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -889,7 +803,7 @@ static int nf_tables_deltable(struct net +@@ -918,7 +832,7 @@ static int nf_tables_deltable(struct net table->use > 0) return -EBUSY; @@ -493,7 +493,7 @@ Signed-off-by: Pablo Neira Ayuso ctx.table = table; return nft_flush_table(&ctx); -@@ -901,7 +815,6 @@ static void nf_tables_table_destroy(stru +@@ -930,7 +844,6 @@ static void nf_tables_table_destroy(stru kfree(ctx->table->name); kfree(ctx->table); @@ -501,7 +501,7 @@ Signed-off-by: Pablo Neira Ayuso } int nft_register_chain_type(const struct nf_chain_type *ctype) -@@ -1130,7 +1043,7 @@ static int nf_tables_dump_chains(struct +@@ -1159,7 +1072,7 @@ static int nf_tables_dump_chains(struct cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -510,7 +510,7 @@ Signed-off-by: Pablo Neira Ayuso continue; list_for_each_entry_rcu(chain, &table->chains, list) { -@@ -1146,7 +1059,7 @@ static int nf_tables_dump_chains(struct +@@ -1175,7 +1088,7 @@ static int nf_tables_dump_chains(struct cb->nlh->nlmsg_seq, NFT_MSG_NEWCHAIN, NLM_F_MULTI, @@ -519,7 +519,7 @@ Signed-off-by: Pablo Neira Ayuso chain) < 0) goto done; -@@ -1168,7 +1081,6 @@ static int nf_tables_getchain(struct net +@@ -1197,7 +1110,6 @@ static int nf_tables_getchain(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_cur(net); @@ -527,7 +527,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; const struct nft_chain *chain; struct sk_buff *skb2; -@@ -1182,11 +1094,7 @@ static int nf_tables_getchain(struct net +@@ -1211,11 +1123,7 @@ static int nf_tables_getchain(struct net return netlink_dump_start(nlsk, skb, nlh, &c); } @@ -540,7 +540,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -1550,7 +1458,6 @@ static int nf_tables_newchain(struct net +@@ -1581,7 +1489,6 @@ static int nf_tables_newchain(struct net const struct nlattr * uninitialized_var(name); u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; @@ -548,7 +548,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_chain *chain; u8 policy = NF_ACCEPT; -@@ -1560,11 +1467,7 @@ static int nf_tables_newchain(struct net +@@ -1591,11 +1498,7 @@ static int nf_tables_newchain(struct net create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false; @@ -561,7 +561,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -1605,7 +1508,7 @@ static int nf_tables_newchain(struct net +@@ -1636,7 +1539,7 @@ static int nf_tables_newchain(struct net } } @@ -570,7 +570,7 @@ Signed-off-by: Pablo Neira Ayuso if (chain != NULL) { if (nlh->nlmsg_flags & NLM_F_EXCL) -@@ -1626,7 +1529,6 @@ static int nf_tables_delchain(struct net +@@ -1657,7 +1560,6 @@ static int nf_tables_delchain(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -578,7 +578,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_chain *chain; struct nft_rule *rule; -@@ -1635,11 +1537,7 @@ static int nf_tables_delchain(struct net +@@ -1666,11 +1568,7 @@ static int nf_tables_delchain(struct net u32 use; int err; @@ -591,7 +591,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -1652,7 +1550,7 @@ static int nf_tables_delchain(struct net +@@ -1683,7 +1581,7 @@ static int nf_tables_delchain(struct net chain->use > 0) return -EBUSY; @@ -600,7 +600,7 @@ Signed-off-by: Pablo Neira Ayuso use = chain->use; list_for_each_entry(rule, &chain->rules, list) { -@@ -2075,7 +1973,7 @@ static int nf_tables_dump_rules(struct s +@@ -2107,7 +2005,7 @@ static int nf_tables_dump_rules(struct s cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -609,7 +609,7 @@ Signed-off-by: Pablo Neira Ayuso continue; if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0) -@@ -2098,7 +1996,7 @@ static int nf_tables_dump_rules(struct s +@@ -2130,7 +2028,7 @@ static int nf_tables_dump_rules(struct s cb->nlh->nlmsg_seq, NFT_MSG_NEWRULE, NLM_F_MULTI | NLM_F_APPEND, @@ -618,7 +618,7 @@ Signed-off-by: Pablo Neira Ayuso table, chain, rule) < 0) goto done; -@@ -2134,7 +2032,6 @@ static int nf_tables_getrule(struct net +@@ -2166,7 +2064,6 @@ static int nf_tables_getrule(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_cur(net); @@ -626,7 +626,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; const struct nft_chain *chain; const struct nft_rule *rule; -@@ -2178,11 +2075,7 @@ static int nf_tables_getrule(struct net +@@ -2210,11 +2107,7 @@ static int nf_tables_getrule(struct net return netlink_dump_start(nlsk, skb, nlh, &c); } @@ -639,7 +639,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -2240,7 +2133,7 @@ static int nf_tables_newrule(struct net +@@ -2279,7 +2172,7 @@ static int nf_tables_newrule(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -648,7 +648,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_chain *chain; struct nft_rule *rule, *old_rule = NULL; -@@ -2256,11 +2149,7 @@ static int nf_tables_newrule(struct net +@@ -2295,11 +2188,7 @@ static int nf_tables_newrule(struct net create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false; @@ -661,7 +661,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -2300,7 +2189,7 @@ static int nf_tables_newrule(struct net +@@ -2339,7 +2228,7 @@ static int nf_tables_newrule(struct net return PTR_ERR(old_rule); } @@ -670,7 +670,7 @@ Signed-off-by: Pablo Neira Ayuso n = 0; size = 0; -@@ -2429,18 +2318,13 @@ static int nf_tables_delrule(struct net +@@ -2468,18 +2357,13 @@ static int nf_tables_delrule(struct net { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -690,7 +690,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -2452,7 +2336,7 @@ static int nf_tables_delrule(struct net +@@ -2491,7 +2375,7 @@ static int nf_tables_delrule(struct net return PTR_ERR(chain); } @@ -699,7 +699,7 @@ Signed-off-by: Pablo Neira Ayuso if (chain) { if (nla[NFTA_RULE_HANDLE]) { -@@ -2637,26 +2521,17 @@ static int nft_ctx_init_from_setattr(str +@@ -2676,26 +2560,17 @@ static int nft_ctx_init_from_setattr(str u8 genmask) { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); @@ -729,7 +729,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -2887,7 +2762,7 @@ static int nf_tables_dump_sets(struct sk +@@ -2927,7 +2802,7 @@ static int nf_tables_dump_sets(struct sk list_for_each_entry_rcu(table, &net->nft.tables, list) { if (ctx->family != NFPROTO_UNSPEC && @@ -738,7 +738,7 @@ Signed-off-by: Pablo Neira Ayuso continue; if (ctx->table && ctx->table != table) -@@ -2908,7 +2783,7 @@ static int nf_tables_dump_sets(struct sk +@@ -2948,7 +2823,7 @@ static int nf_tables_dump_sets(struct sk ctx_set = *ctx; ctx_set.table = table; @@ -747,7 +747,7 @@ Signed-off-by: Pablo Neira Ayuso if (nf_tables_fill_set(skb, &ctx_set, set, NFT_MSG_NEWSET, -@@ -3020,8 +2895,8 @@ static int nf_tables_newset(struct net * +@@ -3060,8 +2935,8 @@ static int nf_tables_newset(struct net * { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); @@ -757,7 +757,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_set *set; struct nft_ctx ctx; -@@ -3128,16 +3003,12 @@ static int nf_tables_newset(struct net * +@@ -3168,16 +3043,12 @@ static int nf_tables_newset(struct net * create = nlh->nlmsg_flags & NLM_F_CREATE ? true : false; @@ -776,7 +776,7 @@ Signed-off-by: Pablo Neira Ayuso set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME], genmask); if (IS_ERR(set)) { -@@ -3397,19 +3268,15 @@ static int nft_ctx_init_from_elemattr(st +@@ -3439,19 +3310,15 @@ static int nft_ctx_init_from_elemattr(st u8 genmask) { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); @@ -799,7 +799,7 @@ Signed-off-by: Pablo Neira Ayuso return 0; } -@@ -3527,7 +3394,7 @@ static int nf_tables_dump_set(struct sk_ +@@ -3569,7 +3436,7 @@ static int nf_tables_dump_set(struct sk_ rcu_read_lock(); list_for_each_entry_rcu(table, &net->nft.tables, list) { if (dump_ctx->ctx.family != NFPROTO_UNSPEC && @@ -808,7 +808,7 @@ Signed-off-by: Pablo Neira Ayuso continue; if (table != dump_ctx->ctx.table) -@@ -3557,7 +3424,7 @@ static int nf_tables_dump_set(struct sk_ +@@ -3599,7 +3466,7 @@ static int nf_tables_dump_set(struct sk_ goto nla_put_failure; nfmsg = nlmsg_data(nlh); @@ -817,7 +817,7 @@ Signed-off-by: Pablo Neira Ayuso nfmsg->version = NFNETLINK_V0; nfmsg->res_id = htons(net->nft.base_seq & 0xffff); -@@ -4434,7 +4301,6 @@ static int nf_tables_newobj(struct net * +@@ -4478,7 +4345,6 @@ static int nf_tables_newobj(struct net * const struct nft_object_type *type; u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; @@ -825,7 +825,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_object *obj; struct nft_ctx ctx; -@@ -4446,11 +4312,7 @@ static int nf_tables_newobj(struct net * +@@ -4490,11 +4356,7 @@ static int nf_tables_newobj(struct net * !nla[NFTA_OBJ_DATA]) return -EINVAL; @@ -838,7 +838,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -4469,7 +4331,7 @@ static int nf_tables_newobj(struct net * +@@ -4513,7 +4375,7 @@ static int nf_tables_newobj(struct net * return 0; } @@ -847,7 +847,7 @@ Signed-off-by: Pablo Neira Ayuso type = nft_obj_type_get(objtype); if (IS_ERR(type)) -@@ -4561,7 +4423,7 @@ static int nf_tables_dump_obj(struct sk_ +@@ -4605,7 +4467,7 @@ static int nf_tables_dump_obj(struct sk_ cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -856,7 +856,7 @@ Signed-off-by: Pablo Neira Ayuso continue; list_for_each_entry_rcu(obj, &table->objects, list) { -@@ -4584,7 +4446,7 @@ static int nf_tables_dump_obj(struct sk_ +@@ -4628,7 +4490,7 @@ static int nf_tables_dump_obj(struct sk_ cb->nlh->nlmsg_seq, NFT_MSG_NEWOBJ, NLM_F_MULTI | NLM_F_APPEND, @@ -865,7 +865,7 @@ Signed-off-by: Pablo Neira Ayuso obj, reset) < 0) goto done; -@@ -4642,7 +4504,6 @@ static int nf_tables_getobj(struct net * +@@ -4686,7 +4548,6 @@ static int nf_tables_getobj(struct net * const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_cur(net); int family = nfmsg->nfgen_family; @@ -873,7 +873,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; struct nft_object *obj; struct sk_buff *skb2; -@@ -4673,11 +4534,7 @@ static int nf_tables_getobj(struct net * +@@ -4717,11 +4578,7 @@ static int nf_tables_getobj(struct net * !nla[NFTA_OBJ_TYPE]) return -EINVAL; @@ -886,7 +886,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -4724,7 +4581,6 @@ static int nf_tables_delobj(struct net * +@@ -4768,7 +4625,6 @@ static int nf_tables_delobj(struct net * const struct nfgenmsg *nfmsg = nlmsg_data(nlh); u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; @@ -894,7 +894,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_object *obj; struct nft_ctx ctx; -@@ -4734,11 +4590,7 @@ static int nf_tables_delobj(struct net * +@@ -4778,11 +4634,7 @@ static int nf_tables_delobj(struct net * !nla[NFTA_OBJ_NAME]) return -EINVAL; @@ -907,7 +907,7 @@ Signed-off-by: Pablo Neira Ayuso genmask); if (IS_ERR(table)) return PTR_ERR(table); -@@ -4750,7 +4602,7 @@ static int nf_tables_delobj(struct net * +@@ -4794,7 +4646,7 @@ static int nf_tables_delobj(struct net * if (obj->use > 0) return -EBUSY; @@ -916,7 +916,7 @@ Signed-off-by: Pablo Neira Ayuso return nft_delobj(&ctx, obj); } -@@ -4935,33 +4787,31 @@ err1: +@@ -4979,33 +4831,31 @@ err1: return err; } @@ -956,7 +956,7 @@ Signed-off-by: Pablo Neira Ayuso return ERR_PTR(-EAGAIN); } #endif -@@ -5009,7 +4859,6 @@ static int nf_tables_newflowtable(struct +@@ -5053,7 +4903,6 @@ static int nf_tables_newflowtable(struct u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; @@ -964,7 +964,7 @@ Signed-off-by: Pablo Neira Ayuso struct nft_table *table; struct nft_ctx ctx; int err, i, k; -@@ -5019,12 +4868,8 @@ static int nf_tables_newflowtable(struct +@@ -5063,12 +4912,8 @@ static int nf_tables_newflowtable(struct !nla[NFTA_FLOWTABLE_HOOK]) return -EINVAL; @@ -978,7 +978,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5041,7 +4886,7 @@ static int nf_tables_newflowtable(struct +@@ -5085,7 +4930,7 @@ static int nf_tables_newflowtable(struct return 0; } @@ -987,7 +987,7 @@ Signed-off-by: Pablo Neira Ayuso flowtable = kzalloc(sizeof(*flowtable), GFP_KERNEL); if (!flowtable) -@@ -5054,7 +4899,7 @@ static int nf_tables_newflowtable(struct +@@ -5098,7 +4943,7 @@ static int nf_tables_newflowtable(struct goto err1; } @@ -996,7 +996,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(type)) { err = PTR_ERR(type); goto err2; -@@ -5114,16 +4959,11 @@ static int nf_tables_delflowtable(struct +@@ -5158,16 +5003,11 @@ static int nf_tables_delflowtable(struct u8 genmask = nft_genmask_next(net); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; @@ -1014,7 +1014,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -5134,7 +4974,7 @@ static int nf_tables_delflowtable(struct +@@ -5178,7 +5018,7 @@ static int nf_tables_delflowtable(struct if (flowtable->use > 0) return -EBUSY; @@ -1023,7 +1023,7 @@ Signed-off-by: Pablo Neira Ayuso return nft_delflowtable(&ctx, flowtable); } -@@ -5209,7 +5049,7 @@ static int nf_tables_dump_flowtable(stru +@@ -5253,7 +5093,7 @@ static int nf_tables_dump_flowtable(stru cb->seq = net->nft.base_seq; list_for_each_entry_rcu(table, &net->nft.tables, list) { @@ -1032,7 +1032,7 @@ Signed-off-by: Pablo Neira Ayuso continue; list_for_each_entry_rcu(flowtable, &table->flowtables, list) { -@@ -5228,7 +5068,7 @@ static int nf_tables_dump_flowtable(stru +@@ -5272,7 +5112,7 @@ static int nf_tables_dump_flowtable(stru cb->nlh->nlmsg_seq, NFT_MSG_NEWFLOWTABLE, NLM_F_MULTI | NLM_F_APPEND, @@ -1041,7 +1041,7 @@ Signed-off-by: Pablo Neira Ayuso goto done; nl_dump_check_consistent(cb, nlmsg_hdr(skb)); -@@ -5288,7 +5128,6 @@ static int nf_tables_getflowtable(struct +@@ -5332,7 +5172,6 @@ static int nf_tables_getflowtable(struct u8 genmask = nft_genmask_cur(net); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; @@ -1049,7 +1049,7 @@ Signed-off-by: Pablo Neira Ayuso const struct nft_table *table; struct sk_buff *skb2; int err; -@@ -5314,12 +5153,8 @@ static int nf_tables_getflowtable(struct +@@ -5358,12 +5197,8 @@ static int nf_tables_getflowtable(struct if (!nla[NFTA_FLOWTABLE_NAME]) return -EINVAL; @@ -1063,7 +1063,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -6483,7 +6318,7 @@ int __nft_release_basechain(struct nft_c +@@ -6529,7 +6364,7 @@ int __nft_release_basechain(struct nft_c } EXPORT_SYMBOL_GPL(__nft_release_basechain); @@ -1072,7 +1072,7 @@ Signed-off-by: Pablo Neira Ayuso { struct nft_flowtable *flowtable, *nf; struct nft_table *table, *nt; -@@ -6496,7 +6331,7 @@ static void __nft_release_afinfo(struct +@@ -6542,7 +6377,7 @@ static void __nft_release_afinfo(struct }; list_for_each_entry_safe(table, nt, &net->nft.tables, list) { @@ -1081,7 +1081,7 @@ Signed-off-by: Pablo Neira Ayuso list_for_each_entry(chain, &table->chains, list) nf_tables_unregister_hook(net, table, chain); -@@ -6548,7 +6383,7 @@ static int __net_init nf_tables_init_net +@@ -6594,7 +6429,7 @@ static int __net_init nf_tables_init_net static void __net_exit nf_tables_exit_net(struct net *net) { diff --git a/target/linux/generic/backport-4.14/339-v4.16-netfilter-nft_flow_offload-wait-for-garbage-collecto.patch b/target/linux/generic/backport-4.14/339-v4.16-netfilter-nft_flow_offload-wait-for-garbage-collecto.patch index 3e8dccf0e..d6736d652 100644 --- a/target/linux/generic/backport-4.14/339-v4.16-netfilter-nft_flow_offload-wait-for-garbage-collecto.patch +++ b/target/linux/generic/backport-4.14/339-v4.16-netfilter-nft_flow_offload-wait-for-garbage-collecto.patch @@ -17,7 +17,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -4825,13 +4825,13 @@ void nft_flow_table_iterate(struct net * +@@ -4869,13 +4869,13 @@ void nft_flow_table_iterate(struct net * struct nft_flowtable *flowtable; const struct nft_table *table; diff --git a/target/linux/generic/backport-4.14/342-v4.16-netfilter-nf_tables-fix-flowtable-free.patch b/target/linux/generic/backport-4.14/342-v4.16-netfilter-nf_tables-fix-flowtable-free.patch index d0f6b7aa3..d0c6e46c9 100644 --- a/target/linux/generic/backport-4.14/342-v4.16-netfilter-nf_tables-fix-flowtable-free.patch +++ b/target/linux/generic/backport-4.14/342-v4.16-netfilter-nf_tables-fix-flowtable-free.patch @@ -118,7 +118,7 @@ Signed-off-by: Pablo Neira Ayuso }; --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5210,17 +5210,12 @@ err: +@@ -5254,17 +5254,12 @@ err: nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS); } diff --git a/target/linux/generic/backport-4.14/344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch b/target/linux/generic/backport-4.14/344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch index 22720aa72..89e12a5f4 100644 --- a/target/linux/generic/backport-4.14/344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch +++ b/target/linux/generic/backport-4.14/344-v4.16-netfilter-nf_tables-allocate-handle-and-delete-objec.patch @@ -12,7 +12,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h -@@ -369,6 +369,7 @@ void nft_unregister_set(struct nft_set_t +@@ -370,6 +370,7 @@ void nft_unregister_set(struct nft_set_t * @list: table set list node * @bindings: list of set bindings * @name: name of the set @@ -20,7 +20,7 @@ Signed-off-by: Pablo Neira Ayuso * @ktype: key type (numeric type defined by userspace, not used in the kernel) * @dtype: data type (verdict or numeric type defined by userspace) * @objtype: object type (see NFT_OBJECT_* definitions) -@@ -391,6 +392,7 @@ struct nft_set { +@@ -392,6 +393,7 @@ struct nft_set { struct list_head list; struct list_head bindings; char *name; @@ -28,7 +28,7 @@ Signed-off-by: Pablo Neira Ayuso u32 ktype; u32 dtype; u32 objtype; -@@ -936,6 +938,7 @@ unsigned int nft_do_chain(struct nft_pkt +@@ -941,6 +943,7 @@ unsigned int nft_do_chain(struct nft_pkt * @objects: stateful objects in the table * @flowtables: flow tables in the table * @hgenerator: handle generator state @@ -36,7 +36,7 @@ Signed-off-by: Pablo Neira Ayuso * @use: number of chain references to this table * @flags: table flag (see enum nft_table_flags) * @genmask: generation mask -@@ -949,6 +952,7 @@ struct nft_table { +@@ -954,6 +957,7 @@ struct nft_table { struct list_head objects; struct list_head flowtables; u64 hgenerator; @@ -44,7 +44,7 @@ Signed-off-by: Pablo Neira Ayuso u32 use; u16 family:6, flags:8, -@@ -973,9 +977,9 @@ int nft_verdict_dump(struct sk_buff *skb +@@ -978,9 +982,9 @@ int nft_verdict_dump(struct sk_buff *skb * @name: name of this stateful object * @genmask: generation mask * @use: number of references to this stateful object @@ -56,7 +56,7 @@ Signed-off-by: Pablo Neira Ayuso */ struct nft_object { struct list_head list; -@@ -983,6 +987,7 @@ struct nft_object { +@@ -988,6 +992,7 @@ struct nft_object { struct nft_table *table; u32 genmask:2, use:30; @@ -64,7 +64,7 @@ Signed-off-by: Pablo Neira Ayuso /* runtime data below here */ const struct nft_object_ops *ops ____cacheline_aligned; unsigned char data[] -@@ -1064,6 +1069,7 @@ void nft_unregister_obj(struct nft_objec +@@ -1069,6 +1074,7 @@ void nft_unregister_obj(struct nft_objec * @ops_len: number of hooks in array * @genmask: generation mask * @use: number of references to this flow table @@ -72,7 +72,7 @@ Signed-off-by: Pablo Neira Ayuso * @data: rhashtable and garbage collector * @ops: array of hooks */ -@@ -1076,6 +1082,7 @@ struct nft_flowtable { +@@ -1081,6 +1087,7 @@ struct nft_flowtable { int ops_len; u32 genmask:2, use:30; @@ -151,7 +151,7 @@ Signed-off-by: Pablo Neira Ayuso static void nft_ctx_init(struct nft_ctx *ctx, struct net *net, -@@ -332,6 +333,20 @@ static struct nft_table *nft_table_looku +@@ -361,6 +362,20 @@ static struct nft_table *nft_table_looku return NULL; } @@ -172,7 +172,7 @@ Signed-off-by: Pablo Neira Ayuso static struct nft_table *nf_tables_table_lookup(const struct net *net, const struct nlattr *nla, u8 family, u8 genmask) -@@ -348,6 +363,22 @@ static struct nft_table *nf_tables_table +@@ -377,6 +392,22 @@ static struct nft_table *nf_tables_table return ERR_PTR(-ENOENT); } @@ -195,7 +195,7 @@ Signed-off-by: Pablo Neira Ayuso static inline u64 nf_tables_alloc_handle(struct nft_table *table) { return ++table->hgenerator; -@@ -394,6 +425,7 @@ static const struct nla_policy nft_table +@@ -423,6 +454,7 @@ static const struct nla_policy nft_table [NFTA_TABLE_NAME] = { .type = NLA_STRING, .len = NFT_TABLE_MAXNAMELEN - 1 }, [NFTA_TABLE_FLAGS] = { .type = NLA_U32 }, @@ -203,7 +203,7 @@ Signed-off-by: Pablo Neira Ayuso }; static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net, -@@ -415,7 +447,9 @@ static int nf_tables_fill_table_info(str +@@ -444,7 +476,9 @@ static int nf_tables_fill_table_info(str if (nla_put_string(skb, NFTA_TABLE_NAME, table->name) || nla_put_be32(skb, NFTA_TABLE_FLAGS, htonl(table->flags)) || @@ -214,7 +214,7 @@ Signed-off-by: Pablo Neira Ayuso goto nla_put_failure; nlmsg_end(skb, nlh); -@@ -674,6 +708,7 @@ static int nf_tables_newtable(struct net +@@ -703,6 +737,7 @@ static int nf_tables_newtable(struct net INIT_LIST_HEAD(&table->flowtables); table->family = family; table->flags = flags; @@ -222,7 +222,7 @@ Signed-off-by: Pablo Neira Ayuso nft_ctx_init(&ctx, net, skb, nlh, family, table, NULL, nla); err = nft_trans_table_add(&ctx, NFT_MSG_NEWTABLE); -@@ -791,11 +826,18 @@ static int nf_tables_deltable(struct net +@@ -820,11 +855,18 @@ static int nf_tables_deltable(struct net struct nft_ctx ctx; nft_ctx_init(&ctx, net, skb, nlh, 0, NULL, NULL, nla); @@ -244,7 +244,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(table)) return PTR_ERR(table); -@@ -1534,6 +1576,7 @@ static int nf_tables_delchain(struct net +@@ -1565,6 +1607,7 @@ static int nf_tables_delchain(struct net struct nft_rule *rule; int family = nfmsg->nfgen_family; struct nft_ctx ctx; @@ -252,7 +252,7 @@ Signed-off-by: Pablo Neira Ayuso u32 use; int err; -@@ -1542,7 +1585,12 @@ static int nf_tables_delchain(struct net +@@ -1573,7 +1616,12 @@ static int nf_tables_delchain(struct net if (IS_ERR(table)) return PTR_ERR(table); @@ -266,7 +266,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(chain)) return PTR_ERR(chain); -@@ -2508,6 +2556,7 @@ static const struct nla_policy nft_set_p +@@ -2547,6 +2595,7 @@ static const struct nla_policy nft_set_p [NFTA_SET_USERDATA] = { .type = NLA_BINARY, .len = NFT_USERDATA_MAXLEN }, [NFTA_SET_OBJ_TYPE] = { .type = NLA_U32 }, @@ -274,7 +274,7 @@ Signed-off-by: Pablo Neira Ayuso }; static const struct nla_policy nft_set_desc_policy[NFTA_SET_DESC_MAX + 1] = { -@@ -2551,6 +2600,22 @@ static struct nft_set *nf_tables_set_loo +@@ -2590,6 +2639,22 @@ static struct nft_set *nf_tables_set_loo return ERR_PTR(-ENOENT); } @@ -297,7 +297,7 @@ Signed-off-by: Pablo Neira Ayuso static struct nft_set *nf_tables_set_lookup_byid(const struct net *net, const struct nlattr *nla, u8 genmask) -@@ -2666,6 +2731,9 @@ static int nf_tables_fill_set(struct sk_ +@@ -2706,6 +2771,9 @@ static int nf_tables_fill_set(struct sk_ goto nla_put_failure; if (nla_put_string(skb, NFTA_SET_NAME, set->name)) goto nla_put_failure; @@ -307,7 +307,7 @@ Signed-off-by: Pablo Neira Ayuso if (set->flags != 0) if (nla_put_be32(skb, NFTA_SET_FLAGS, htonl(set->flags))) goto nla_put_failure; -@@ -3074,6 +3142,7 @@ static int nf_tables_newset(struct net * +@@ -3114,6 +3182,7 @@ static int nf_tables_newset(struct net * set->udata = udata; set->timeout = timeout; set->gc_int = gc_int; @@ -315,7 +315,7 @@ Signed-off-by: Pablo Neira Ayuso err = ops->init(set, &desc, nla); if (err < 0) -@@ -3133,7 +3202,10 @@ static int nf_tables_delset(struct net * +@@ -3173,7 +3242,10 @@ static int nf_tables_delset(struct net * if (err < 0) return err; @@ -327,7 +327,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(set)) return PTR_ERR(set); -@@ -4189,6 +4261,21 @@ struct nft_object *nf_tables_obj_lookup( +@@ -4233,6 +4305,21 @@ struct nft_object *nf_tables_obj_lookup( } EXPORT_SYMBOL_GPL(nf_tables_obj_lookup); @@ -349,7 +349,7 @@ Signed-off-by: Pablo Neira Ayuso static const struct nla_policy nft_obj_policy[NFTA_OBJ_MAX + 1] = { [NFTA_OBJ_TABLE] = { .type = NLA_STRING, .len = NFT_TABLE_MAXNAMELEN - 1 }, -@@ -4196,6 +4283,7 @@ static const struct nla_policy nft_obj_p +@@ -4240,6 +4327,7 @@ static const struct nla_policy nft_obj_p .len = NFT_OBJ_MAXNAMELEN - 1 }, [NFTA_OBJ_TYPE] = { .type = NLA_U32 }, [NFTA_OBJ_DATA] = { .type = NLA_NESTED }, @@ -357,7 +357,7 @@ Signed-off-by: Pablo Neira Ayuso }; static struct nft_object *nft_obj_init(const struct nft_ctx *ctx, -@@ -4343,6 +4431,8 @@ static int nf_tables_newobj(struct net * +@@ -4387,6 +4475,8 @@ static int nf_tables_newobj(struct net * goto err1; } obj->table = table; @@ -366,7 +366,7 @@ Signed-off-by: Pablo Neira Ayuso obj->name = nla_strdup(nla[NFTA_OBJ_NAME], GFP_KERNEL); if (!obj->name) { err = -ENOMEM; -@@ -4389,7 +4479,9 @@ static int nf_tables_fill_obj_info(struc +@@ -4433,7 +4523,9 @@ static int nf_tables_fill_obj_info(struc nla_put_string(skb, NFTA_OBJ_NAME, obj->name) || nla_put_be32(skb, NFTA_OBJ_TYPE, htonl(obj->ops->type->type)) || nla_put_be32(skb, NFTA_OBJ_USE, htonl(obj->use)) || @@ -377,7 +377,7 @@ Signed-off-by: Pablo Neira Ayuso goto nla_put_failure; nlmsg_end(skb, nlh); -@@ -4587,7 +4679,7 @@ static int nf_tables_delobj(struct net * +@@ -4631,7 +4723,7 @@ static int nf_tables_delobj(struct net * u32 objtype; if (!nla[NFTA_OBJ_TYPE] || @@ -386,7 +386,7 @@ Signed-off-by: Pablo Neira Ayuso return -EINVAL; table = nf_tables_table_lookup(net, nla[NFTA_OBJ_TABLE], family, -@@ -4596,7 +4688,12 @@ static int nf_tables_delobj(struct net * +@@ -4640,7 +4732,12 @@ static int nf_tables_delobj(struct net * return PTR_ERR(table); objtype = ntohl(nla_get_be32(nla[NFTA_OBJ_TYPE])); @@ -400,7 +400,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(obj)) return PTR_ERR(obj); if (obj->use > 0) -@@ -4668,6 +4765,7 @@ static const struct nla_policy nft_flowt +@@ -4712,6 +4809,7 @@ static const struct nla_policy nft_flowt [NFTA_FLOWTABLE_NAME] = { .type = NLA_STRING, .len = NFT_NAME_MAXLEN - 1 }, [NFTA_FLOWTABLE_HOOK] = { .type = NLA_NESTED }, @@ -408,7 +408,7 @@ Signed-off-by: Pablo Neira Ayuso }; struct nft_flowtable *nf_tables_flowtable_lookup(const struct nft_table *table, -@@ -4685,6 +4783,20 @@ struct nft_flowtable *nf_tables_flowtabl +@@ -4729,6 +4827,20 @@ struct nft_flowtable *nf_tables_flowtabl } EXPORT_SYMBOL_GPL(nf_tables_flowtable_lookup); @@ -429,7 +429,7 @@ Signed-off-by: Pablo Neira Ayuso #define NFT_FLOWTABLE_DEVICE_MAX 8 static int nf_tables_parse_devices(const struct nft_ctx *ctx, -@@ -4893,6 +5005,8 @@ static int nf_tables_newflowtable(struct +@@ -4937,6 +5049,8 @@ static int nf_tables_newflowtable(struct return -ENOMEM; flowtable->table = table; @@ -438,7 +438,7 @@ Signed-off-by: Pablo Neira Ayuso flowtable->name = nla_strdup(nla[NFTA_FLOWTABLE_NAME], GFP_KERNEL); if (!flowtable->name) { err = -ENOMEM; -@@ -4967,8 +5081,14 @@ static int nf_tables_delflowtable(struct +@@ -5011,8 +5125,14 @@ static int nf_tables_delflowtable(struct if (IS_ERR(table)) return PTR_ERR(table); @@ -455,7 +455,7 @@ Signed-off-by: Pablo Neira Ayuso if (IS_ERR(flowtable)) return PTR_ERR(flowtable); if (flowtable->use > 0) -@@ -5001,7 +5121,9 @@ static int nf_tables_fill_flowtable_info +@@ -5045,7 +5165,9 @@ static int nf_tables_fill_flowtable_info if (nla_put_string(skb, NFTA_FLOWTABLE_TABLE, flowtable->table->name) || nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) || diff --git a/target/linux/generic/backport-4.14/346-v4.16-netfilter-flowtable-infrastructure-depends-on-NETFIL.patch b/target/linux/generic/backport-4.14/346-v4.16-netfilter-flowtable-infrastructure-depends-on-NETFIL.patch index 5267fd2f6..162086e34 100644 --- a/target/linux/generic/backport-4.14/346-v4.16-netfilter-flowtable-infrastructure-depends-on-NETFIL.patch +++ b/target/linux/generic/backport-4.14/346-v4.16-netfilter-flowtable-infrastructure-depends-on-NETFIL.patch @@ -37,7 +37,7 @@ Signed-off-by: Pablo Neira Ayuso --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig -@@ -73,8 +73,7 @@ endif # NF_TABLES +@@ -101,8 +101,7 @@ endif # NF_TABLES config NF_FLOW_TABLE_IPV6 tristate "Netfilter flow table IPv6 module" diff --git a/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch b/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch index e16f13ac4..9ed9ca558 100644 --- a/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch +++ b/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau #endif --- a/include/net/ipv6.h +++ b/include/net/ipv6.h -@@ -913,8 +913,6 @@ static inline struct sk_buff *ip6_finish +@@ -918,8 +918,6 @@ static inline struct sk_buff *ip6_finish &inet6_sk(sk)->cork); } diff --git a/target/linux/generic/backport-4.14/357-v4.18-netfilter-nf_flow_table-move-init-code-to-nf_flow_ta.patch b/target/linux/generic/backport-4.14/357-v4.18-netfilter-nf_flow_table-move-init-code-to-nf_flow_ta.patch index 278947644..77e4db3ed 100644 --- a/target/linux/generic/backport-4.14/357-v4.18-netfilter-nf_flow_table-move-init-code-to-nf_flow_ta.patch +++ b/target/linux/generic/backport-4.14/357-v4.18-netfilter-nf_flow_table-move-init-code-to-nf_flow_ta.patch @@ -236,7 +236,7 @@ Signed-off-by: Felix Fietkau .owner = THIS_MODULE, --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5020,40 +5020,38 @@ static int nf_tables_newflowtable(struct +@@ -5064,40 +5064,38 @@ static int nf_tables_newflowtable(struct } flowtable->data.type = type; @@ -285,7 +285,7 @@ Signed-off-by: Felix Fietkau err3: module_put(type->owner); err2: -@@ -5334,10 +5332,8 @@ err: +@@ -5378,10 +5376,8 @@ err: static void nf_tables_flowtable_destroy(struct nft_flowtable *flowtable) { diff --git a/target/linux/generic/backport-4.14/358-v4.18-netfilter-nf_flow_table-fix-priv-pointer-for-netdev-.patch b/target/linux/generic/backport-4.14/358-v4.18-netfilter-nf_flow_table-fix-priv-pointer-for-netdev-.patch index fcf206de3..e38f22635 100644 --- a/target/linux/generic/backport-4.14/358-v4.18-netfilter-nf_flow_table-fix-priv-pointer-for-netdev-.patch +++ b/target/linux/generic/backport-4.14/358-v4.18-netfilter-nf_flow_table-fix-priv-pointer-for-netdev-.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -4886,7 +4886,7 @@ static int nf_tables_flowtable_parse_hoo +@@ -4930,7 +4930,7 @@ static int nf_tables_flowtable_parse_hoo flowtable->ops[i].pf = NFPROTO_NETDEV; flowtable->ops[i].hooknum = hooknum; flowtable->ops[i].priority = priority; diff --git a/target/linux/generic/backport-4.14/359-v4.18-netfilter-nf_flow_table-track-flow-tables-in-nf_flow.patch b/target/linux/generic/backport-4.14/359-v4.18-netfilter-nf_flow_table-track-flow-tables-in-nf_flow.patch index 3530eb6c2..2fcd66330 100644 --- a/target/linux/generic/backport-4.14/359-v4.18-netfilter-nf_flow_table-track-flow-tables-in-nf_flow.patch +++ b/target/linux/generic/backport-4.14/359-v4.18-netfilter-nf_flow_table-track-flow-tables-in-nf_flow.patch @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau struct delayed_work gc_work; --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h -@@ -1091,9 +1091,6 @@ struct nft_flowtable { +@@ -1096,9 +1096,6 @@ struct nft_flowtable { struct nft_flowtable *nf_tables_flowtable_lookup(const struct nft_table *table, const struct nlattr *nla, u8 genmask); @@ -88,7 +88,7 @@ Signed-off-by: Felix Fietkau WARN_ON(!nf_flow_offload_gc_step(flow_table)); --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -4930,23 +4930,6 @@ static const struct nf_flowtable_type *n +@@ -4974,23 +4974,6 @@ static const struct nf_flowtable_type *n return ERR_PTR(-ENOENT); } diff --git a/target/linux/generic/backport-4.14/700-1-6-e1000e-Remove-Other-from-EIAC.diff b/target/linux/generic/backport-4.14/700-1-6-e1000e-Remove-Other-from-EIAC.diff new file mode 100644 index 000000000..9ce01aac5 --- /dev/null +++ b/target/linux/generic/backport-4.14/700-1-6-e1000e-Remove-Other-from-EIAC.diff @@ -0,0 +1,66 @@ +From patchwork Mon Mar 5 21:40:25 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [net,v2,1/6] e1000e: Remove Other from EIAC +X-Patchwork-Submitter: "Kirsher, Jeffrey T" +X-Patchwork-Id: 881773 +X-Patchwork-Delegate: davem@davemloft.net +Message-Id: <20180305214030.25141-2-jeffrey.t.kirsher@intel.com> +To: davem@davemloft.net +Cc: Benjamin Poirier , netdev@vger.kernel.org, + nhorman@redhat.com, sassmann@redhat.com, jogreene@redhat.com, + Jeff Kirsher +Date: Mon, 5 Mar 2018 13:40:25 -0800 +From: Jeff Kirsher +List-Id: + +From: Benjamin Poirier + +It was reported that emulated e1000e devices in vmware esxi 6.5 Build +7526125 do not link up after commit 4aea7a5c5e94 ("e1000e: Avoid receiver +overrun interrupt bursts", v4.15-rc1). Some tracing shows that after +e1000e_trigger_lsc() is called, ICR reads out as 0x0 in e1000_msix_other() +on emulated e1000e devices. In comparison, on real e1000e 82574 hardware, +icr=0x80000004 (_INT_ASSERTED | _LSC) in the same situation. + +Some experimentation showed that this flaw in vmware e1000e emulation can +be worked around by not setting Other in EIAC. This is how it was before +16ecba59bc33 ("e1000e: Do not read ICR in Other interrupt", v4.5-rc1). + +Fixes: 4aea7a5c5e94 ("e1000e: Avoid receiver overrun interrupt bursts") +Signed-off-by: Benjamin Poirier +Tested-by: Aaron Brown +Signed-off-by: Jeff Kirsher +--- + drivers/net/ethernet/intel/e1000e/netdev.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/intel/e1000e/netdev.c ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c +@@ -1914,6 +1914,8 @@ static irqreturn_t e1000_msix_other(int + bool enable = true; + + icr = er32(ICR); ++ ew32(ICR, E1000_ICR_OTHER); ++ + if (icr & E1000_ICR_RXO) { + ew32(ICR, E1000_ICR_RXO); + enable = false; +@@ -2036,7 +2038,6 @@ static void e1000_configure_msix(struct + hw->hw_addr + E1000_EITR_82574(vector)); + else + writel(1, hw->hw_addr + E1000_EITR_82574(vector)); +- adapter->eiac_mask |= E1000_IMS_OTHER; + + /* Cause Tx interrupts on every write back */ + ivar |= BIT(31); +@@ -2261,7 +2262,7 @@ static void e1000_irq_enable(struct e100 + + if (adapter->msix_entries) { + ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574); +- ew32(IMS, adapter->eiac_mask | E1000_IMS_LSC); ++ ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC); + } else if (hw->mac.type >= e1000_pch_lpt) { + ew32(IMS, IMS_ENABLE_MASK | E1000_IMS_ECCER); + } else { diff --git a/target/linux/generic/backport-4.14/700-2-6-Partial-revert-e1000e-Avoid-receiver-overrun-interrupt-bursts.diff b/target/linux/generic/backport-4.14/700-2-6-Partial-revert-e1000e-Avoid-receiver-overrun-interrupt-bursts.diff new file mode 100644 index 000000000..2800e6f8d --- /dev/null +++ b/target/linux/generic/backport-4.14/700-2-6-Partial-revert-e1000e-Avoid-receiver-overrun-interrupt-bursts.diff @@ -0,0 +1,84 @@ +From patchwork Mon Mar 5 21:40:26 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [net, v2, + 2/6] Partial revert "e1000e: Avoid receiver overrun interrupt bursts" +X-Patchwork-Submitter: "Kirsher, Jeffrey T" +X-Patchwork-Id: 881769 +X-Patchwork-Delegate: davem@davemloft.net +Message-Id: <20180305214030.25141-3-jeffrey.t.kirsher@intel.com> +To: davem@davemloft.net +Cc: Benjamin Poirier , netdev@vger.kernel.org, + nhorman@redhat.com, sassmann@redhat.com, jogreene@redhat.com, + Jeff Kirsher +Date: Mon, 5 Mar 2018 13:40:26 -0800 +From: Jeff Kirsher +List-Id: + +From: Benjamin Poirier + +This partially reverts commit 4aea7a5c5e940c1723add439f4088844cd26196d. + +We keep the fix for the first part of the problem (1) described in the log +of that commit, that is to read ICR in the other interrupt handler. We +remove the fix for the second part of the problem (2), Other interrupt +throttling. + +Bursts of "Other" interrupts may once again occur during rxo (receive +overflow) traffic conditions. This is deemed acceptable in the interest of +avoiding unforeseen fallout from changes that are not strictly necessary. +As discussed, the e1000e driver should be in "maintenance mode". + +Link: https://www.spinics.net/lists/netdev/msg480675.html +Signed-off-by: Benjamin Poirier +Acked-by: Alexander Duyck +Tested-by: Aaron Brown +Signed-off-by: Jeff Kirsher +--- + drivers/net/ethernet/intel/e1000e/netdev.c | 16 ++-------------- + 1 file changed, 2 insertions(+), 14 deletions(-) + +--- a/drivers/net/ethernet/intel/e1000e/netdev.c ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c +@@ -1911,21 +1911,10 @@ static irqreturn_t e1000_msix_other(int + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; + u32 icr; +- bool enable = true; + + icr = er32(ICR); + ew32(ICR, E1000_ICR_OTHER); + +- if (icr & E1000_ICR_RXO) { +- ew32(ICR, E1000_ICR_RXO); +- enable = false; +- /* napi poll will re-enable Other, make sure it runs */ +- if (napi_schedule_prep(&adapter->napi)) { +- adapter->total_rx_bytes = 0; +- adapter->total_rx_packets = 0; +- __napi_schedule(&adapter->napi); +- } +- } + if (icr & E1000_ICR_LSC) { + ew32(ICR, E1000_ICR_LSC); + hw->mac.get_link_status = true; +@@ -1934,7 +1923,7 @@ static irqreturn_t e1000_msix_other(int + mod_timer(&adapter->watchdog_timer, jiffies + 1); + } + +- if (enable && !test_bit(__E1000_DOWN, &adapter->state)) ++ if (!test_bit(__E1000_DOWN, &adapter->state)) + ew32(IMS, E1000_IMS_OTHER); + + return IRQ_HANDLED; +@@ -2704,8 +2693,7 @@ static int e1000e_poll(struct napi_struc + napi_complete_done(napi, work_done); + if (!test_bit(__E1000_DOWN, &adapter->state)) { + if (adapter->msix_entries) +- ew32(IMS, adapter->rx_ring->ims_val | +- E1000_IMS_OTHER); ++ ew32(IMS, adapter->rx_ring->ims_val); + else + e1000_irq_enable(adapter); + } diff --git a/target/linux/generic/backport-4.14/700-3-6-e1000e-Fix-queue-interrupt-re-raising-in-Other-interrupt.diff b/target/linux/generic/backport-4.14/700-3-6-e1000e-Fix-queue-interrupt-re-raising-in-Other-interrupt.diff new file mode 100644 index 000000000..8ad13ba69 --- /dev/null +++ b/target/linux/generic/backport-4.14/700-3-6-e1000e-Fix-queue-interrupt-re-raising-in-Other-interrupt.diff @@ -0,0 +1,50 @@ +From patchwork Mon Mar 5 21:40:27 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [net, v2, + 3/6] e1000e: Fix queue interrupt re-raising in Other interrupt +X-Patchwork-Submitter: "Kirsher, Jeffrey T" +X-Patchwork-Id: 881775 +X-Patchwork-Delegate: davem@davemloft.net +Message-Id: <20180305214030.25141-4-jeffrey.t.kirsher@intel.com> +To: davem@davemloft.net +Cc: Benjamin Poirier , netdev@vger.kernel.org, + nhorman@redhat.com, sassmann@redhat.com, jogreene@redhat.com, + Jeff Kirsher +Date: Mon, 5 Mar 2018 13:40:27 -0800 +From: Jeff Kirsher +List-Id: + +From: Benjamin Poirier + +Restores the ICS write for Rx/Tx queue interrupts which was present before +commit 16ecba59bc33 ("e1000e: Do not read ICR in Other interrupt", v4.5-rc1) +but was not restored in commit 4aea7a5c5e94 +("e1000e: Avoid receiver overrun interrupt bursts", v4.15-rc1). + +This re-raises the queue interrupts in case the txq or rxq bits were set in +ICR and the Other interrupt handler read and cleared ICR before the queue +interrupt was raised. + +Fixes: 4aea7a5c5e94 ("e1000e: Avoid receiver overrun interrupt bursts") +Signed-off-by: Benjamin Poirier +Acked-by: Alexander Duyck +Tested-by: Aaron Brown +Signed-off-by: Jeff Kirsher +--- + drivers/net/ethernet/intel/e1000e/netdev.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/ethernet/intel/e1000e/netdev.c ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c +@@ -1915,6 +1915,9 @@ static irqreturn_t e1000_msix_other(int + icr = er32(ICR); + ew32(ICR, E1000_ICR_OTHER); + ++ if (icr & adapter->eiac_mask) ++ ew32(ICS, (icr & adapter->eiac_mask)); ++ + if (icr & E1000_ICR_LSC) { + ew32(ICR, E1000_ICR_LSC); + hw->mac.get_link_status = true; diff --git a/target/linux/generic/backport-4.14/700-4-6-e1000e-Avoid-missed-interrupts-following-ICR-read.diff b/target/linux/generic/backport-4.14/700-4-6-e1000e-Avoid-missed-interrupts-following-ICR-read.diff new file mode 100644 index 000000000..f218f34d2 --- /dev/null +++ b/target/linux/generic/backport-4.14/700-4-6-e1000e-Avoid-missed-interrupts-following-ICR-read.diff @@ -0,0 +1,131 @@ +From patchwork Mon Mar 5 21:40:28 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [net,v2,4/6] e1000e: Avoid missed interrupts following ICR read +X-Patchwork-Submitter: "Kirsher, Jeffrey T" +X-Patchwork-Id: 881771 +X-Patchwork-Delegate: davem@davemloft.net +Message-Id: <20180305214030.25141-5-jeffrey.t.kirsher@intel.com> +To: davem@davemloft.net +Cc: Benjamin Poirier , netdev@vger.kernel.org, + nhorman@redhat.com, sassmann@redhat.com, jogreene@redhat.com, + Jeff Kirsher +Date: Mon, 5 Mar 2018 13:40:28 -0800 +From: Jeff Kirsher +List-Id: + +From: Benjamin Poirier + +The 82574 specification update errata 12 states that interrupts may be +missed if ICR is read while INT_ASSERTED is not set. Avoid that problem by +setting all bits related to events that can trigger the Other interrupt in +IMS. + +The Other interrupt is raised for such events regardless of whether or not +they are set in IMS. However, only when they are set is the INT_ASSERTED +bit also set in ICR. + +By doing this, we ensure that INT_ASSERTED is always set when we read ICR +in e1000_msix_other() and steer clear of the errata. This also ensures that +ICR will automatically be cleared on read, therefore we no longer need to +clear bits explicitly. + +Signed-off-by: Benjamin Poirier +Acked-by: Alexander Duyck +Tested-by: Aaron Brown +Signed-off-by: Jeff Kirsher +--- + drivers/net/ethernet/intel/e1000e/defines.h | 21 ++++++++++++++++++++- + drivers/net/ethernet/intel/e1000e/netdev.c | 11 ++++------- + 2 files changed, 24 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/intel/e1000e/defines.h ++++ b/drivers/net/ethernet/intel/e1000e/defines.h +@@ -400,6 +400,10 @@ + #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */ + #define E1000_ICR_RXO 0x00000040 /* Receiver Overrun */ + #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */ ++#define E1000_ICR_MDAC 0x00000200 /* MDIO Access Complete */ ++#define E1000_ICR_SRPD 0x00010000 /* Small Receive Packet Detected */ ++#define E1000_ICR_ACK 0x00020000 /* Receive ACK Frame Detected */ ++#define E1000_ICR_MNG 0x00040000 /* Manageability Event Detected */ + #define E1000_ICR_ECCER 0x00400000 /* Uncorrectable ECC Error */ + /* If this bit asserted, the driver should claim the interrupt */ + #define E1000_ICR_INT_ASSERTED 0x80000000 +@@ -407,7 +411,7 @@ + #define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */ + #define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */ + #define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */ +-#define E1000_ICR_OTHER 0x01000000 /* Other Interrupts */ ++#define E1000_ICR_OTHER 0x01000000 /* Other Interrupt */ + + /* PBA ECC Register */ + #define E1000_PBA_ECC_COUNTER_MASK 0xFFF00000 /* ECC counter mask */ +@@ -431,12 +435,27 @@ + E1000_IMS_RXSEQ | \ + E1000_IMS_LSC) + ++/* These are all of the events related to the OTHER interrupt. ++ */ ++#define IMS_OTHER_MASK ( \ ++ E1000_IMS_LSC | \ ++ E1000_IMS_RXO | \ ++ E1000_IMS_MDAC | \ ++ E1000_IMS_SRPD | \ ++ E1000_IMS_ACK | \ ++ E1000_IMS_MNG) ++ + /* Interrupt Mask Set */ + #define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ + #define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ + #define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ + #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ ++#define E1000_IMS_RXO E1000_ICR_RXO /* Receiver Overrun */ + #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ ++#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO Access Complete */ ++#define E1000_IMS_SRPD E1000_ICR_SRPD /* Small Receive Packet */ ++#define E1000_IMS_ACK E1000_ICR_ACK /* Receive ACK Frame Detected */ ++#define E1000_IMS_MNG E1000_ICR_MNG /* Manageability Event */ + #define E1000_IMS_ECCER E1000_ICR_ECCER /* Uncorrectable ECC Error */ + #define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */ + #define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */ +--- a/drivers/net/ethernet/intel/e1000e/netdev.c ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c +@@ -1910,16 +1910,12 @@ static irqreturn_t e1000_msix_other(int + struct net_device *netdev = data; + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; +- u32 icr; +- +- icr = er32(ICR); +- ew32(ICR, E1000_ICR_OTHER); ++ u32 icr = er32(ICR); + + if (icr & adapter->eiac_mask) + ew32(ICS, (icr & adapter->eiac_mask)); + + if (icr & E1000_ICR_LSC) { +- ew32(ICR, E1000_ICR_LSC); + hw->mac.get_link_status = true; + /* guard against interrupt when we're going down */ + if (!test_bit(__E1000_DOWN, &adapter->state)) +@@ -1927,7 +1923,7 @@ static irqreturn_t e1000_msix_other(int + } + + if (!test_bit(__E1000_DOWN, &adapter->state)) +- ew32(IMS, E1000_IMS_OTHER); ++ ew32(IMS, E1000_IMS_OTHER | IMS_OTHER_MASK); + + return IRQ_HANDLED; + } +@@ -2254,7 +2250,8 @@ static void e1000_irq_enable(struct e100 + + if (adapter->msix_entries) { + ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574); +- ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC); ++ ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | ++ IMS_OTHER_MASK); + } else if (hw->mac.type >= e1000_pch_lpt) { + ew32(IMS, IMS_ENABLE_MASK | E1000_IMS_ECCER); + } else { diff --git a/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch b/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch index 7bf4fd47d..172e714c5 100644 --- a/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch +++ b/target/linux/generic/backport-4.9/024-1-tcp-tsq-add-tsq_flags-tsq_enum.patch @@ -45,7 +45,7 @@ Signed-off-by: David S. Miller return (struct tcp_sock *)sk; --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -784,10 +784,10 @@ static void tcp_tasklet_func(unsigned lo +@@ -789,10 +789,10 @@ static void tcp_tasklet_func(unsigned lo } } @@ -60,7 +60,7 @@ Signed-off-by: David S. Miller /** * tcp_release_cb - tcp release_sock() callback * @sk: socket -@@ -808,7 +808,7 @@ void tcp_release_cb(struct sock *sk) +@@ -813,7 +813,7 @@ void tcp_release_cb(struct sock *sk) nflags = flags & ~TCP_DEFERRED_ALL; } while (cmpxchg(&tp->tsq_flags, flags, nflags) != flags); @@ -69,7 +69,7 @@ Signed-off-by: David S. Miller tcp_tsq_handler(sk); /* Here begins the tricky part : -@@ -822,15 +822,15 @@ void tcp_release_cb(struct sock *sk) +@@ -827,15 +827,15 @@ void tcp_release_cb(struct sock *sk) */ sock_release_ownership(sk); diff --git a/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch b/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch index 914be607e..af194b2be 100644 --- a/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch +++ b/target/linux/generic/backport-4.9/024-2-tcp-tsq-remove-one-locked-operation-in-tcp_wfree.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -860,6 +860,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -865,6 +865,7 @@ void tcp_wfree(struct sk_buff *skb) { struct sock *sk = skb->sk; struct tcp_sock *tp = tcp_sk(sk); @@ -25,7 +25,7 @@ Signed-off-by: David S. Miller int wmem; /* Keep one reference on sk_wmem_alloc. -@@ -877,11 +878,17 @@ void tcp_wfree(struct sk_buff *skb) +@@ -882,11 +883,17 @@ void tcp_wfree(struct sk_buff *skb) if (wmem >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current) goto out; diff --git a/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch b/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch index f5004d3ff..b9b3c5507 100644 --- a/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch +++ b/target/linux/generic/backport-4.9/024-3-tcp-tsq-add-shortcut-in-tcp_tasklet_func.patch @@ -22,7 +22,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -767,19 +767,19 @@ static void tcp_tasklet_func(unsigned lo +@@ -772,19 +772,19 @@ static void tcp_tasklet_func(unsigned lo list_for_each_safe(q, n, &list) { tp = list_entry(q, struct tcp_sock, tsq_node); list_del(&tp->tsq_node); @@ -51,7 +51,7 @@ Signed-off-by: David S. Miller sk_free(sk); } } -@@ -884,7 +884,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -889,7 +889,7 @@ void tcp_wfree(struct sk_buff *skb) if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED)) goto out; @@ -60,7 +60,7 @@ Signed-off-by: David S. Miller nval = cmpxchg(&tp->tsq_flags, oval, nval); if (nval != oval) continue; -@@ -2210,6 +2210,8 @@ static bool tcp_write_xmit(struct sock * +@@ -2222,6 +2222,8 @@ static bool tcp_write_xmit(struct sock * unlikely(tso_fragment(sk, skb, limit, mss_now, gfp))) break; diff --git a/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch b/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch index a25cdb571..87452ac85 100644 --- a/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch +++ b/target/linux/generic/backport-4.9/024-4-tcp-tsq-avoid-one-atomic-in-tcp_wfree.patch @@ -16,7 +16,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -880,6 +880,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -885,6 +885,7 @@ void tcp_wfree(struct sk_buff *skb) for (oval = READ_ONCE(tp->tsq_flags);; oval = nval) { struct tsq_tasklet *tsq; @@ -24,7 +24,7 @@ Signed-off-by: David S. Miller if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED)) goto out; -@@ -892,8 +893,10 @@ void tcp_wfree(struct sk_buff *skb) +@@ -897,8 +898,10 @@ void tcp_wfree(struct sk_buff *skb) /* queue this socket to tasklet queue */ local_irq_save(flags); tsq = this_cpu_ptr(&tsq_tasklet); diff --git a/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch b/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch index 65013b6aa..d04e365f9 100644 --- a/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch +++ b/target/linux/generic/backport-4.9/024-5-tcp-tsq-add-a-shortcut-in-tcp_small_queue_check.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -2115,6 +2115,15 @@ static bool tcp_small_queue_check(struct +@@ -2127,6 +2127,15 @@ static bool tcp_small_queue_check(struct limit <<= factor; if (atomic_read(&sk->sk_wmem_alloc) > limit) { diff --git a/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch b/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch index 6f2d19668..2a6cd40c8 100644 --- a/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch +++ b/target/linux/generic/backport-4.9/024-6-tcp-tcp_mtu_probe-is-likely-to-exit-early.patch @@ -17,7 +17,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1948,26 +1948,26 @@ static bool tcp_can_coalesce_send_queue_ +@@ -1960,26 +1960,26 @@ static bool tcp_can_coalesce_send_queue_ */ static int tcp_mtu_probe(struct sock *sk) { diff --git a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch index 292b381f8..0a5b9ead9 100644 --- a/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch +++ b/target/linux/generic/backport-4.9/024-8-tcp-tsq-move-tsq_flags-close-to-sk_wmem_alloc.patch @@ -58,7 +58,7 @@ Signed-off-by: David S. Miller goto out; --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -767,14 +767,15 @@ static void tcp_tasklet_func(unsigned lo +@@ -772,14 +772,15 @@ static void tcp_tasklet_func(unsigned lo list_for_each_safe(q, n, &list) { tp = list_entry(q, struct tcp_sock, tsq_node); list_del(&tp->tsq_node); @@ -77,7 +77,7 @@ Signed-off-by: David S. Miller tcp_tsq_handler(sk); } bh_unlock_sock(sk); -@@ -797,16 +798,15 @@ static void tcp_tasklet_func(unsigned lo +@@ -802,16 +803,15 @@ static void tcp_tasklet_func(unsigned lo */ void tcp_release_cb(struct sock *sk) { @@ -96,7 +96,7 @@ Signed-off-by: David S. Miller if (flags & TCPF_TSQ_DEFERRED) tcp_tsq_handler(sk); -@@ -878,7 +878,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -883,7 +883,7 @@ void tcp_wfree(struct sk_buff *skb) if (wmem >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current) goto out; @@ -105,7 +105,7 @@ Signed-off-by: David S. Miller struct tsq_tasklet *tsq; bool empty; -@@ -886,7 +886,7 @@ void tcp_wfree(struct sk_buff *skb) +@@ -891,7 +891,7 @@ void tcp_wfree(struct sk_buff *skb) goto out; nval = (oval & ~TSQF_THROTTLED) | TSQF_QUEUED | TCPF_TSQ_DEFERRED; @@ -114,7 +114,7 @@ Signed-off-by: David S. Miller if (nval != oval) continue; -@@ -2124,7 +2124,7 @@ static bool tcp_small_queue_check(struct +@@ -2136,7 +2136,7 @@ static bool tcp_small_queue_check(struct skb->prev == sk->sk_write_queue.next) return false; @@ -123,7 +123,7 @@ Signed-off-by: David S. Miller /* It is possible TX completion already happened * before we set TSQ_THROTTLED, so we must * test again the condition. -@@ -2222,8 +2222,8 @@ static bool tcp_write_xmit(struct sock * +@@ -2234,8 +2234,8 @@ static bool tcp_write_xmit(struct sock * unlikely(tso_fragment(sk, skb, limit, mss_now, gfp))) break; @@ -134,7 +134,7 @@ Signed-off-by: David S. Miller if (tcp_small_queue_check(sk, skb, 0)) break; -@@ -3534,8 +3534,6 @@ void tcp_send_ack(struct sock *sk) +@@ -3546,8 +3546,6 @@ void __tcp_send_ack(struct sock *sk, u32 /* We do not want pure acks influencing TCP Small Queues or fq/pacing * too much. * SKB_TRUESIZE(max(1 .. 66, MAX_TCP_HEADER)) is unfortunately ~784 diff --git a/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch b/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch index d2b8de6a0..bd7430326 100644 --- a/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch +++ b/target/linux/generic/backport-4.9/024-9-tcp-add-a-missing-barrier-in-tcp_tasklet_func.patch @@ -30,7 +30,7 @@ Signed-off-by: David S. Miller --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -769,6 +769,7 @@ static void tcp_tasklet_func(unsigned lo +@@ -774,6 +774,7 @@ static void tcp_tasklet_func(unsigned lo list_del(&tp->tsq_node); sk = (struct sock *)tp; diff --git a/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch b/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch index 33593194d..be3140bb9 100644 --- a/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch +++ b/target/linux/generic/backport-4.9/025-tcp-allow-drivers-to-tweak-TSQ-logic.patch @@ -65,7 +65,7 @@ Cc: Kir Kolyshkin * Before updating sk_refcnt, we must commit prior changes to memory --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c -@@ -1581,7 +1581,7 @@ u32 tcp_tso_autosize(const struct sock * +@@ -1593,7 +1593,7 @@ u32 tcp_tso_autosize(const struct sock * { u32 bytes, segs; @@ -74,7 +74,7 @@ Cc: Kir Kolyshkin sk->sk_gso_max_size - 1 - MAX_TCP_HEADER); /* Goal is to send at least one packet per ms, -@@ -2111,7 +2111,7 @@ static bool tcp_small_queue_check(struct +@@ -2123,7 +2123,7 @@ static bool tcp_small_queue_check(struct { unsigned int limit; diff --git a/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch b/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch new file mode 100644 index 000000000..7a971169b --- /dev/null +++ b/target/linux/generic/backport-4.9/040-mm-add-support-for-releasing-multiple-instances-of-a.patch @@ -0,0 +1,75 @@ +From: Alexander Duyck +Date: Wed, 14 Dec 2016 15:05:26 -0800 +Subject: [PATCH] mm: add support for releasing multiple instances of a page + +Add a function that allows us to batch free a page that has multiple +references outstanding. Specifically this function can be used to drop +a page being used in the page frag alloc cache. With this drivers can +make use of functionality similar to the page frag alloc cache without +having to do any workarounds for the fact that there is no function that +frees multiple references. + +Link: http://lkml.kernel.org/r/20161110113606.76501.70752.stgit@ahduyck-blue-test.jf.intel.com +Signed-off-by: Alexander Duyck +Cc: "David S. Miller" +Cc: "James E.J. Bottomley" +Cc: Chris Metcalf +Cc: David Howells +Cc: Geert Uytterhoeven +Cc: Hans-Christian Noren Egtvedt +Cc: Helge Deller +Cc: James Hogan +Cc: Jeff Kirsher +Cc: Jonas Bonn +Cc: Keguang Zhang +Cc: Ley Foon Tan +Cc: Mark Salter +Cc: Max Filippov +Cc: Michael Ellerman +Cc: Michal Simek +Cc: Ralf Baechle +Cc: Rich Felker +Cc: Richard Kuo +Cc: Russell King +Cc: Steven Miao +Cc: Tobias Klauser +Cc: Vineet Gupta +Cc: Yoshinori Sato +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +--- + +--- a/include/linux/gfp.h ++++ b/include/linux/gfp.h +@@ -506,6 +506,8 @@ extern void free_hot_cold_page(struct pa + extern void free_hot_cold_page_list(struct list_head *list, bool cold); + + struct page_frag_cache; ++extern void __page_frag_drain(struct page *page, unsigned int order, ++ unsigned int count); + extern void *__alloc_page_frag(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask); + extern void __free_page_frag(void *addr); +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -3945,6 +3945,20 @@ static struct page *__page_frag_refill(s + return page; + } + ++void __page_frag_drain(struct page *page, unsigned int order, ++ unsigned int count) ++{ ++ VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); ++ ++ if (page_ref_sub_and_test(page, count)) { ++ if (order == 0) ++ free_hot_cold_page(page, false); ++ else ++ __free_pages_ok(page, order); ++ } ++} ++EXPORT_SYMBOL(__page_frag_drain); ++ + void *__alloc_page_frag(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask) + { diff --git a/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch b/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch new file mode 100644 index 000000000..fbd331601 --- /dev/null +++ b/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch @@ -0,0 +1,137 @@ +From: Alexander Duyck +Date: Tue, 10 Jan 2017 16:58:06 -0800 +Subject: [PATCH] mm: rename __alloc_page_frag to page_frag_alloc and + __free_page_frag to page_frag_free + +Patch series "Page fragment updates", v4. + +This patch series takes care of a few cleanups for the page fragments +API. + +First we do some renames so that things are much more consistent. First +we move the page_frag_ portion of the name to the front of the functions +names. Secondly we split out the cache specific functions from the +other page fragment functions by adding the word "cache" to the name. + +Finally I added a bit of documentation that will hopefully help to +explain some of this. I plan to revisit this later as we get things +more ironed out in the near future with the changes planned for the DMA +setup to support eXpress Data Path. + +This patch (of 3): + +This patch renames the page frag functions to be more consistent with +other APIs. Specifically we place the name page_frag first in the name +and then have either an alloc or free call name that we append as the +suffix. This makes it a bit clearer in terms of naming. + +In addition we drop the leading double underscores since we are +technically no longer a backing interface and instead the front end that +is called from the networking APIs. + +Link: http://lkml.kernel.org/r/20170104023854.13451.67390.stgit@localhost.localdomain +Signed-off-by: Alexander Duyck +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +--- + +--- a/include/linux/gfp.h ++++ b/include/linux/gfp.h +@@ -508,9 +508,9 @@ extern void free_hot_cold_page_list(stru + struct page_frag_cache; + extern void __page_frag_drain(struct page *page, unsigned int order, + unsigned int count); +-extern void *__alloc_page_frag(struct page_frag_cache *nc, +- unsigned int fragsz, gfp_t gfp_mask); +-extern void __free_page_frag(void *addr); ++extern void *page_frag_alloc(struct page_frag_cache *nc, ++ unsigned int fragsz, gfp_t gfp_mask); ++extern void page_frag_free(void *addr); + + #define __free_page(page) __free_pages((page), 0) + #define free_page(addr) free_pages((addr), 0) +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -2471,7 +2471,7 @@ static inline struct sk_buff *netdev_all + + static inline void skb_free_frag(void *addr) + { +- __free_page_frag(addr); ++ page_frag_free(addr); + } + + void *napi_alloc_frag(unsigned int fragsz); +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -3959,8 +3959,8 @@ void __page_frag_drain(struct page *page + } + EXPORT_SYMBOL(__page_frag_drain); + +-void *__alloc_page_frag(struct page_frag_cache *nc, +- unsigned int fragsz, gfp_t gfp_mask) ++void *page_frag_alloc(struct page_frag_cache *nc, ++ unsigned int fragsz, gfp_t gfp_mask) + { + unsigned int size = PAGE_SIZE; + struct page *page; +@@ -4011,19 +4011,19 @@ refill: + + return nc->va + offset; + } +-EXPORT_SYMBOL(__alloc_page_frag); ++EXPORT_SYMBOL(page_frag_alloc); + + /* + * Frees a page fragment allocated out of either a compound or order 0 page. + */ +-void __free_page_frag(void *addr) ++void page_frag_free(void *addr) + { + struct page *page = virt_to_head_page(addr); + + if (unlikely(put_page_testzero(page))) + __free_pages_ok(page, compound_order(page)); + } +-EXPORT_SYMBOL(__free_page_frag); ++EXPORT_SYMBOL(page_frag_free); + + static void *make_alloc_exact(unsigned long addr, unsigned int order, + size_t size) +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -369,7 +369,7 @@ static void *__netdev_alloc_frag(unsigne + + local_irq_save(flags); + nc = this_cpu_ptr(&netdev_alloc_cache); +- data = __alloc_page_frag(nc, fragsz, gfp_mask); ++ data = page_frag_alloc(nc, fragsz, gfp_mask); + local_irq_restore(flags); + return data; + } +@@ -391,7 +391,7 @@ static void *__napi_alloc_frag(unsigned + { + struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); + +- return __alloc_page_frag(&nc->page, fragsz, gfp_mask); ++ return page_frag_alloc(&nc->page, fragsz, gfp_mask); + } + + void *napi_alloc_frag(unsigned int fragsz) +@@ -441,7 +441,7 @@ struct sk_buff *__netdev_alloc_skb(struc + local_irq_save(flags); + + nc = this_cpu_ptr(&netdev_alloc_cache); +- data = __alloc_page_frag(nc, len, gfp_mask); ++ data = page_frag_alloc(nc, len, gfp_mask); + pfmemalloc = nc->pfmemalloc; + + local_irq_restore(flags); +@@ -505,7 +505,7 @@ struct sk_buff *__napi_alloc_skb(struct + if (sk_memalloc_socks()) + gfp_mask |= __GFP_MEMALLOC; + +- data = __alloc_page_frag(&nc->page, len, gfp_mask); ++ data = page_frag_alloc(&nc->page, len, gfp_mask); + if (unlikely(!data)) + return NULL; + diff --git a/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch b/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch new file mode 100644 index 000000000..64fdc7606 --- /dev/null +++ b/target/linux/generic/backport-4.9/042-mm-rename-__page_frag-functions-to-__page_frag_cache.patch @@ -0,0 +1,79 @@ +From: Alexander Duyck +Date: Tue, 10 Jan 2017 16:58:09 -0800 +Subject: [PATCH] mm: rename __page_frag functions to __page_frag_cache, drop + order from drain + +This patch does two things. + +First it goes through and renames the __page_frag prefixed functions to +__page_frag_cache so that we can be clear that we are draining or +refilling the cache, not the frags themselves. + +Second we drop the order parameter from __page_frag_cache_drain since we +don't actually need to pass it since all fragments are either order 0 or +must be a compound page. + +Link: http://lkml.kernel.org/r/20170104023954.13451.5678.stgit@localhost.localdomain +Signed-off-by: Alexander Duyck +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +--- + +--- a/include/linux/gfp.h ++++ b/include/linux/gfp.h +@@ -506,8 +506,7 @@ extern void free_hot_cold_page(struct pa + extern void free_hot_cold_page_list(struct list_head *list, bool cold); + + struct page_frag_cache; +-extern void __page_frag_drain(struct page *page, unsigned int order, +- unsigned int count); ++extern void __page_frag_cache_drain(struct page *page, unsigned int count); + extern void *page_frag_alloc(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask); + extern void page_frag_free(void *addr); +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -3924,8 +3924,8 @@ EXPORT_SYMBOL(free_pages); + * drivers to provide a backing region of memory for use as either an + * sk_buff->head, or to be used in the "frags" portion of skb_shared_info. + */ +-static struct page *__page_frag_refill(struct page_frag_cache *nc, +- gfp_t gfp_mask) ++static struct page *__page_frag_cache_refill(struct page_frag_cache *nc, ++ gfp_t gfp_mask) + { + struct page *page = NULL; + gfp_t gfp = gfp_mask; +@@ -3945,19 +3945,20 @@ static struct page *__page_frag_refill(s + return page; + } + +-void __page_frag_drain(struct page *page, unsigned int order, +- unsigned int count) ++void __page_frag_cache_drain(struct page *page, unsigned int count) + { + VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); + + if (page_ref_sub_and_test(page, count)) { ++ unsigned int order = compound_order(page); ++ + if (order == 0) + free_hot_cold_page(page, false); + else + __free_pages_ok(page, order); + } + } +-EXPORT_SYMBOL(__page_frag_drain); ++EXPORT_SYMBOL(__page_frag_cache_drain); + + void *page_frag_alloc(struct page_frag_cache *nc, + unsigned int fragsz, gfp_t gfp_mask) +@@ -3968,7 +3969,7 @@ void *page_frag_alloc(struct page_frag_c + + if (unlikely(!nc->va)) { + refill: +- page = __page_frag_refill(nc, gfp_mask); ++ page = __page_frag_cache_refill(nc, gfp_mask); + if (!page) + return NULL; + diff --git a/target/linux/generic/backport-4.9/050-usb-dwc2-Remove-unnecessary-kfree.patch b/target/linux/generic/backport-4.9/050-usb-dwc2-Remove-unnecessary-kfree.patch index 69aaa9f84..346eba922 100644 --- a/target/linux/generic/backport-4.9/050-usb-dwc2-Remove-unnecessary-kfree.patch +++ b/target/linux/generic/backport-4.9/050-usb-dwc2-Remove-unnecessary-kfree.patch @@ -14,7 +14,7 @@ Signed-off-by: Felipe Balbi --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c -@@ -5200,7 +5200,6 @@ error3: +@@ -5202,7 +5202,6 @@ error3: error2: usb_put_hcd(hcd); error1: diff --git a/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch b/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch new file mode 100644 index 000000000..29aa3b9e8 --- /dev/null +++ b/target/linux/generic/backport-4.9/068-v4.18-0001-mtd-move-code-adding-registering-partitions-to-the-p.patch @@ -0,0 +1,168 @@ +From 5ac67ce36cfe38b4c104a42ce52c5c8d526f1c95 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 27 Mar 2018 22:35:41 +0200 +Subject: [PATCH] mtd: move code adding (registering) partitions to the + parse_mtd_partitions() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This commit slightly simplifies the code. Every parse_mtd_partitions() +caller (out of two existing ones) had to add partitions & cleanup parser +on its own. This moves that responsibility into the function. + +That change also allows dropping struct mtd_partitions argument. + +There is one minor behavior change caused by this cleanup. If +parse_mtd_partitions() fails to add partitions (add_mtd_partitions() +return an error) then mtd_device_parse_register() will still try to +add (register) fallback partitions. It's a real corner case affecting +one of uncommon error paths and shouldn't cause any harm. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/mtdcore.c | 14 ++++---------- + drivers/mtd/mtdcore.h | 1 - + drivers/mtd/mtdpart.c | 44 ++++++++++++++++---------------------------- + 3 files changed, 20 insertions(+), 39 deletions(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -676,7 +676,6 @@ int mtd_device_parse_register(struct mtd + const struct mtd_partition *parts, + int nr_parts) + { +- struct mtd_partitions parsed = { }; + int ret; + + mtd_set_dev_defaults(mtd); +@@ -688,13 +687,10 @@ int mtd_device_parse_register(struct mtd + } + + /* Prefer parsed partitions over driver-provided fallback */ +- ret = parse_mtd_partitions(mtd, types, &parsed, parser_data); +- if (!ret && parsed.nr_parts) { +- parts = parsed.parts; +- nr_parts = parsed.nr_parts; +- } +- +- if (nr_parts) ++ ret = parse_mtd_partitions(mtd, types, parser_data); ++ if (ret > 0) ++ ret = 0; ++ else if (nr_parts) + ret = add_mtd_partitions(mtd, parts, nr_parts); + else if (!device_is_registered(&mtd->dev)) + ret = add_mtd_device(mtd); +@@ -720,8 +716,6 @@ int mtd_device_parse_register(struct mtd + } + + out: +- /* Cleanup any parsed partitions */ +- mtd_part_parser_cleanup(&parsed); + if (ret && device_is_registered(&mtd->dev)) + del_mtd_device(mtd); + +--- a/drivers/mtd/mtdcore.h ++++ b/drivers/mtd/mtdcore.h +@@ -14,7 +14,6 @@ int del_mtd_partitions(struct mtd_info * + struct mtd_partitions; + + int parse_mtd_partitions(struct mtd_info *master, const char * const *types, +- struct mtd_partitions *pparts, + struct mtd_part_parser_data *data); + + void mtd_part_parser_cleanup(struct mtd_partitions *parts); +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -383,20 +383,7 @@ static inline void free_partition(struct + */ + static int mtd_parse_part(struct mtd_part *slave, const char *const *types) + { +- struct mtd_partitions parsed; +- int err; +- +- err = parse_mtd_partitions(&slave->mtd, types, &parsed, NULL); +- if (err) +- return err; +- else if (!parsed.nr_parts) +- return -ENOENT; +- +- err = add_mtd_partitions(&slave->mtd, parsed.parts, parsed.nr_parts); +- +- mtd_part_parser_cleanup(&parsed); +- +- return err; ++ return parse_mtd_partitions(&slave->mtd, types, NULL); + } + + static struct mtd_part *allocate_partition(struct mtd_info *parent, +@@ -973,30 +960,27 @@ static int mtd_part_of_parse(struct mtd_ + } + + /** +- * parse_mtd_partitions - parse MTD partitions ++ * parse_mtd_partitions - parse and register MTD partitions ++ * + * @master: the master partition (describes whole MTD device) + * @types: names of partition parsers to try or %NULL +- * @pparts: info about partitions found is returned here + * @data: MTD partition parser-specific data + * +- * This function tries to find partition on MTD device @master. It uses MTD +- * partition parsers, specified in @types. However, if @types is %NULL, then +- * the default list of parsers is used. The default list contains only the ++ * This function tries to find & register partitions on MTD device @master. It ++ * uses MTD partition parsers, specified in @types. However, if @types is %NULL, ++ * then the default list of parsers is used. The default list contains only the + * "cmdlinepart" and "ofpart" parsers ATM. + * Note: If there are more then one parser in @types, the kernel only takes the + * partitions parsed out by the first parser. + * + * This function may return: + * o a negative error code in case of failure +- * o zero otherwise, and @pparts will describe the partitions, number of +- * partitions, and the parser which parsed them. Caller must release +- * resources with mtd_part_parser_cleanup() when finished with the returned +- * data. ++ * o number of found partitions otherwise + */ + int parse_mtd_partitions(struct mtd_info *master, const char *const *types, +- struct mtd_partitions *pparts, + struct mtd_part_parser_data *data) + { ++ struct mtd_partitions pparts = { }; + struct mtd_part_parser *parser; + int ret, err = 0; + +@@ -1010,7 +994,7 @@ int parse_mtd_partitions(struct mtd_info + * handled in a separated function. + */ + if (!strcmp(*types, "ofpart")) { +- ret = mtd_part_of_parse(master, pparts); ++ ret = mtd_part_of_parse(master, &pparts); + } else { + pr_debug("%s: parsing partitions %s\n", master->name, + *types); +@@ -1021,13 +1005,17 @@ int parse_mtd_partitions(struct mtd_info + parser ? parser->name : NULL); + if (!parser) + continue; +- ret = mtd_part_do_parse(parser, master, pparts, data); ++ ret = mtd_part_do_parse(parser, master, &pparts, data); + if (ret <= 0) + mtd_part_parser_put(parser); + } + /* Found partitions! */ +- if (ret > 0) +- return 0; ++ if (ret > 0) { ++ err = add_mtd_partitions(master, pparts.parts, ++ pparts.nr_parts); ++ mtd_part_parser_cleanup(&pparts); ++ return err ? err : pparts.nr_parts; ++ } + /* + * Stash the first error we see; only report it if no parser + * succeeds diff --git a/target/linux/generic/pending-4.4/141-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch b/target/linux/generic/backport-4.9/069-v4.18-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch similarity index 83% rename from target/linux/generic/pending-4.4/141-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch rename to target/linux/generic/backport-4.9/069-v4.18-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch index 31acebf50..e08f8dad3 100644 --- a/target/linux/generic/pending-4.4/141-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch +++ b/target/linux/generic/backport-4.9/069-v4.18-mtd-bcm47xxpart-improve-handling-TRX-partition-size.patch @@ -1,4 +1,6 @@ +From 237ea0d4762cc14d0fc80e80d61f0f08e1050c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 12 Apr 2018 07:24:52 +0200 Subject: [PATCH] mtd: bcm47xxpart: improve handling TRX partition size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -6,7 +8,7 @@ Content-Transfer-Encoding: 8bit When bcm47xxpart finds a TRX partition (container) it's supposed to jump to the end of it and keep looking for more partitions. TRX and its -subpartitions are handled be a separated parser. +subpartitions are handled by a separate parser. The problem with old code was relying on the length specified in a TRX header. That isn't reliable as TRX is commonly modified to have checksum @@ -22,11 +24,14 @@ This makes code more optimal & reliable thanks to skipping data that shouldn't be parsed. Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon --- + drivers/mtd/bcm47xxpart.c | 22 ++++++++++++++++++---- + 1 file changed, 18 insertions(+), 4 deletions(-) --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c -@@ -268,6 +268,8 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -186,6 +186,8 @@ static int bcm47xxpart_parse(struct mtd_ /* TRX */ if (buf[0x000 / 4] == TRX_MAGIC) { struct trx_header *trx; @@ -35,7 +40,7 @@ Signed-off-by: Rafał Miłecki if (trx_num >= ARRAY_SIZE(trx_parts)) pr_warn("No enough space to store another TRX found at 0x%X\n", -@@ -277,11 +279,23 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -195,11 +197,23 @@ static int bcm47xxpart_parse(struct mtd_ bcm47xxpart_add_part(&parts[curr_part++], "firmware", offset, 0); diff --git a/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch b/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch index 03013a019..c8bf54c78 100644 --- a/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch +++ b/target/linux/generic/backport-4.9/075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch @@ -38,9 +38,9 @@ Signed-off-by: David S. Miller { --- a/drivers/net/phy/bcm-phy-lib.h +++ b/drivers/net/phy/bcm-phy-lib.h -@@ -19,6 +19,9 @@ - int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val); - int bcm_phy_read_exp(struct phy_device *phydev, u16 reg); +@@ -26,6 +26,9 @@ static inline int bcm_phy_write_exp_sel( + return bcm_phy_write_exp(phydev, reg | MII_BCM54XX_EXP_SEL_ER, val); + } +int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val); +int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum); diff --git a/target/linux/generic/backport-4.9/076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch b/target/linux/generic/backport-4.9/076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch index 96fb3da5b..35eee772d 100644 --- a/target/linux/generic/backport-4.9/076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch +++ b/target/linux/generic/backport-4.9/076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch @@ -78,7 +78,7 @@ Signed-off-by: David S. Miller MODULE_LICENSE("GPL v2"); --- a/drivers/net/phy/bcm-phy-lib.h +++ b/drivers/net/phy/bcm-phy-lib.h -@@ -36,5 +36,5 @@ int bcm_phy_config_intr(struct phy_devic +@@ -43,5 +43,5 @@ int bcm_phy_config_intr(struct phy_devic int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down); diff --git a/target/linux/generic/backport-4.9/076-v4.11-0002-net-phy-broadcom-Add-support-code-for-reading-PHY-co.patch b/target/linux/generic/backport-4.9/076-v4.11-0002-net-phy-broadcom-Add-support-code-for-reading-PHY-co.patch index 1bdecf572..83cfe1f5d 100644 --- a/target/linux/generic/backport-4.9/076-v4.11-0002-net-phy-broadcom-Add-support-code-for-reading-PHY-co.patch +++ b/target/linux/generic/backport-4.9/076-v4.11-0002-net-phy-broadcom-Add-support-code-for-reading-PHY-co.patch @@ -100,7 +100,7 @@ Signed-off-by: David S. Miller MODULE_AUTHOR("Broadcom Corporation"); --- a/drivers/net/phy/bcm-phy-lib.h +++ b/drivers/net/phy/bcm-phy-lib.h -@@ -37,4 +37,10 @@ int bcm_phy_config_intr(struct phy_devic +@@ -44,4 +44,10 @@ int bcm_phy_config_intr(struct phy_devic int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down); int bcm_phy_set_eee(struct phy_device *phydev, bool enable); diff --git a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch index 5c0388ed0..4a5a89013 100644 --- a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch +++ b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch @@ -214,14 +214,14 @@ Signed-off-by: David S. Miller RCANFD_RFCC_RFIE); --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c -@@ -726,7 +726,7 @@ static int xcan_rx_poll(struct napi_stru - can_led_event(ndev, CAN_LED_EVENT_RX); +@@ -838,7 +838,7 @@ static int xcan_rx_poll(struct napi_stru + } if (work_done < quota) { - napi_complete(napi); + napi_complete_done(napi, work_done); ier = priv->read_reg(priv, XCAN_IER_OFFSET); - ier |= (XCAN_IXR_RXOK_MASK | XCAN_IXR_RXNEMP_MASK); + ier |= XCAN_IXR_RXNEMP_MASK; priv->write_reg(priv, XCAN_IER_OFFSET, ier); --- a/drivers/net/ethernet/3com/typhoon.c +++ b/drivers/net/ethernet/3com/typhoon.c @@ -1117,7 +1117,7 @@ Signed-off-by: David S. Miller return work_done; --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c -@@ -922,7 +922,7 @@ static int gem_poll(struct napi_struct * +@@ -924,7 +924,7 @@ static int gem_poll(struct napi_struct * gp->status = readl(gp->regs + GREG_STAT); } while (gp->status & GREG_STAT_NAPI); @@ -1379,7 +1379,7 @@ Signed-off-by: David S. Miller */ --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c -@@ -1064,7 +1064,7 @@ err: +@@ -1065,7 +1065,7 @@ err: if (work_done < budget) { int more_to_do = 0; diff --git a/target/linux/generic/backport-4.9/094-v4.12-0001-ip6_tunnel-Fix-missing-tunnel-encapsulation-limit-op.patch b/target/linux/generic/backport-4.9/094-v4.12-0001-ip6_tunnel-Fix-missing-tunnel-encapsulation-limit-op.patch new file mode 100644 index 000000000..b91bfb7f6 --- /dev/null +++ b/target/linux/generic/backport-4.9/094-v4.12-0001-ip6_tunnel-Fix-missing-tunnel-encapsulation-limit-op.patch @@ -0,0 +1,50 @@ +From 89a23c8b528bd2c89f3981573d6cd7d23840c8a6 Mon Sep 17 00:00:00 2001 +From: Craig Gallek +Date: Wed, 26 Apr 2017 14:37:45 -0400 +Subject: [PATCH] ip6_tunnel: Fix missing tunnel encapsulation limit option + +The IPv6 tunneling code tries to insert IPV6_TLV_TNL_ENCAP_LIMIT and +IPV6_TLV_PADN options when an encapsulation limit is defined (the +default is a limit of 4). An MTU adjustment is done to account for +these options as well. However, the options are never present in the +generated packets. + +The issue appears to be a subtlety between IPV6_DSTOPTS and +IPV6_RTHDRDSTOPTS defined in RFC 3542. When the IPIP tunnel driver was +written, the encap limit options were included as IPV6_RTHDRDSTOPTS in +dst0opt of struct ipv6_txoptions. Later, ipv6_push_nfrags_opts was +(correctly) updated to require IPV6_RTHDR options when IPV6_RTHDRDSTOPTS +are to be used. This caused the options to no longer be included in v6 +encapsulated packets. + +The fix is to use IPV6_DSTOPTS (in dst1opt of struct ipv6_txoptions) +instead. IPV6_DSTOPTS do not have the additional IPV6_RTHDR requirement. + +Fixes: 1df64a8569c7: ("[IPV6]: Add ip6ip6 tunnel driver.") +Fixes: 333fad5364d6: ("[IPV6]: Support several new sockopt / ancillary data in Advanced API (RFC3542)") +Signed-off-by: Craig Gallek +Signed-off-by: David S. Miller +--- + net/ipv6/ip6_tunnel.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -957,7 +957,7 @@ static void init_tel_txopt(struct ipv6_t + opt->dst_opt[5] = IPV6_TLV_PADN; + opt->dst_opt[6] = 1; + +- opt->ops.dst0opt = (struct ipv6_opt_hdr *) opt->dst_opt; ++ opt->ops.dst1opt = (struct ipv6_opt_hdr *) opt->dst_opt; + opt->ops.opt_nflen = 8; + } + +@@ -1187,7 +1187,7 @@ route_lookup: + + if (encap_limit >= 0) { + init_tel_txopt(&opt, encap_limit); +- ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL); ++ ipv6_push_frag_opts(skb, &opt.ops, &proto); + } + + /* Calculate max headroom for all the headers and adjust diff --git a/target/linux/generic/backport-4.9/094-v4.12-0002-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch b/target/linux/generic/backport-4.9/094-v4.12-0002-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch new file mode 100644 index 000000000..d102e7bb8 --- /dev/null +++ b/target/linux/generic/backport-4.9/094-v4.12-0002-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch @@ -0,0 +1,31 @@ +From 5b8481fa42ac58484d633b558579e302aead64c1 Mon Sep 17 00:00:00 2001 +From: "David S. Miller" +Date: Mon, 1 May 2017 15:10:20 -0400 +Subject: [PATCH] ipv6: Need to export ipv6_push_frag_opts for tunneling now. + +Since that change also made the nfrag function not necessary +for exports, remove it. + +Fixes: 89a23c8b528b ("ip6_tunnel: Fix missing tunnel encapsulation limit option") +Signed-off-by: David S. Miller +--- + net/ipv6/exthdrs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/ipv6/exthdrs.c ++++ b/net/ipv6/exthdrs.c +@@ -729,13 +729,13 @@ void ipv6_push_nfrag_opts(struct sk_buff + if (opt->hopopt) + ipv6_push_exthdr(skb, proto, NEXTHDR_HOP, opt->hopopt); + } +-EXPORT_SYMBOL(ipv6_push_nfrag_opts); + + void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt, u8 *proto) + { + if (opt->dst1opt) + ipv6_push_exthdr(skb, proto, NEXTHDR_DEST, opt->dst1opt); + } ++EXPORT_SYMBOL(ipv6_push_frag_opts); + + struct ipv6_txoptions * + ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt) diff --git a/target/linux/generic/backport-4.9/400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch b/target/linux/generic/backport-4.9/400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch new file mode 100644 index 000000000..94a477675 --- /dev/null +++ b/target/linux/generic/backport-4.9/400-v4.18-mtd-bcm47xxpart-add-of_match_table-with-a-new-DT-bin.patch @@ -0,0 +1,47 @@ +From cf589ce71e84d3b8811c65740645af254c5248c0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 9 May 2018 10:17:29 +0200 +Subject: [PATCH] mtd: bcm47xxpart: add of_match_table with a new DT binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows using bcm47xxpart parser to find partitions on flash +described in DT using the "brcm,bcm947xx-cfe-partitions" compatible +property. It means this parser doesn't have to be explicitly selected by +a flash driver anymore. It can be used e.g. together with a generic +m25p80 / spi-nor if device is just properly described. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/bcm47xxpart.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/mtd/bcm47xxpart.c ++++ b/drivers/mtd/bcm47xxpart.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #include + +@@ -304,9 +305,16 @@ static int bcm47xxpart_parse(struct mtd_ + return curr_part; + }; + ++static const struct of_device_id bcm47xxpart_of_match_table[] = { ++ { .compatible = "brcm,bcm947xx-cfe-partitions" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm47xxpart_of_match_table); ++ + static struct mtd_part_parser bcm47xxpart_mtd_parser = { + .parse_fn = bcm47xxpart_parse, + .name = "bcm47xxpart", ++ .of_match_table = bcm47xxpart_of_match_table, + }; + module_mtd_part_parser(bcm47xxpart_mtd_parser); + diff --git a/target/linux/generic/backport-4.9/401-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch b/target/linux/generic/backport-4.9/401-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch new file mode 100644 index 000000000..b92382c1e --- /dev/null +++ b/target/linux/generic/backport-4.9/401-v4.19-mtd-parsers-trx-add-of_match_table-with-the-new-DT-b.patch @@ -0,0 +1,45 @@ +From 98534a58c8a40cdc9e3bcb04d74719fbcedfeb52 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 26 Jun 2018 00:05:08 +0200 +Subject: [PATCH] mtd: parsers: trx: add of_match_table with the new DT binding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows using TRX parser to find TRX partitions on flash device +described in DT using a proper binding. It's useful for devices storing +firmware on a separated flash and having rootfs partition in it. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/parsers/parser_trx.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/mtd/parsers/parser_trx.c ++++ b/drivers/mtd/parsers/parser_trx.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + #define TRX_PARSER_MAX_PARTS 4 + +@@ -116,9 +117,16 @@ static int parser_trx_parse(struct mtd_i + return i; + }; + ++static const struct of_device_id mtd_parser_trx_of_match_table[] = { ++ { .compatible = "brcm,trx" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mtd_parser_trx_of_match_table); ++ + static struct mtd_part_parser mtd_parser_trx = { + .parse_fn = parser_trx_parse, + .name = "trx", ++ .of_match_table = mtd_parser_trx_of_match_table, + }; + module_mtd_part_parser(mtd_parser_trx); + diff --git a/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch b/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch new file mode 100644 index 000000000..4186f5599 --- /dev/null +++ b/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch @@ -0,0 +1,102 @@ +From 76a832254ab05502c9394cc51ded6f0abe0e0bee Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 13 Jul 2018 16:32:21 +0200 +Subject: [PATCH] mtd: partitions: use DT info for parsing partitions with + "compatible" prop +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far only flash devices could be described in DT regarding partitions +parsing. That could be done with "partitions" subnode and a proper +"compatible" string. + +Some devices may use hierarchical (multi-level) layouts and may mix used +layouts (fixed and dynamic). Describing that in DT is done by specifying +"compatible" for DT-represented partition plus optionally more +properties and/or subnodes. + +To support such layouts each DT partition has to be checked for +additional description. + +Please note this implementation will work in parallel with support for +partition type specified for non-DT setups. That already works since +commit 1a0915be1926 ("mtd: partitions: add support for partition +parsers"). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/mtdpart.c | 33 +++++++++++++-------------------- + 1 file changed, 13 insertions(+), 20 deletions(-) + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -370,22 +370,6 @@ static inline void free_partition(struct + kfree(p); + } + +-/** +- * mtd_parse_part - parse MTD partition looking for subpartitions +- * +- * @slave: part that is supposed to be a container and should be parsed +- * @types: NULL-terminated array with names of partition parsers to try +- * +- * Some partitions are kind of containers with extra subpartitions (volumes). +- * There can be various formats of such containers. This function tries to use +- * specified parsers to analyze given partition and registers found +- * subpartitions on success. +- */ +-static int mtd_parse_part(struct mtd_part *slave, const char *const *types) +-{ +- return parse_mtd_partitions(&slave->mtd, types, NULL); +-} +- + static struct mtd_part *allocate_partition(struct mtd_info *parent, + const struct mtd_partition *part, int partno, + uint64_t cur_offset) +@@ -775,8 +759,8 @@ int add_mtd_partitions(struct mtd_info * + + add_mtd_device(&slave->mtd); + mtd_add_partition_attrs(slave); +- if (parts[i].types) +- mtd_parse_part(slave, parts[i].types); ++ /* Look for subpartitions */ ++ parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); + + cur_offset = slave->offset + slave->mtd.size; + } +@@ -852,6 +836,12 @@ static const char * const default_mtd_pa + NULL + }; + ++/* Check DT only when looking for subpartitions. */ ++static const char * const default_subpartition_types[] = { ++ "ofpart", ++ NULL ++}; ++ + static int mtd_part_do_parse(struct mtd_part_parser *parser, + struct mtd_info *master, + struct mtd_partitions *pparts, +@@ -922,7 +912,9 @@ static int mtd_part_of_parse(struct mtd_ + const char *fixed = "fixed-partitions"; + int ret, err = 0; + +- np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); ++ np = mtd_get_of_node(master); ++ if (!mtd_is_partition(master)) ++ np = of_get_child_by_name(np, "partitions"); + of_property_for_each_string(np, "compatible", prop, compat) { + parser = mtd_part_get_compatible_parser(compat); + if (!parser) +@@ -985,7 +977,8 @@ int parse_mtd_partitions(struct mtd_info + int ret, err = 0; + + if (!types) +- types = default_mtd_part_types; ++ types = mtd_is_partition(master) ? default_subpartition_types : ++ default_mtd_part_types; + + for ( ; *types; types++) { + /* diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 deleted file mode 100644 index 04245531f..000000000 --- a/target/linux/generic/config-3.18 +++ /dev/null @@ -1,4657 +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=y -# CONFIG_ADXRS450 is not set -CONFIG_AEABI=y -# CONFIG_AFFS_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_AF_RXRPC is not set -# CONFIG_AGP is not set -# CONFIG_AHCI_MVEBU is not set -CONFIG_AIO=y -# CONFIG_AIRO is not set -# CONFIG_AIRO_CS is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_AK09911 is not set -# CONFIG_AK8975 is not set -# CONFIG_AL3320A is not set -# CONFIG_ALCHEMY_GPIO_INDIRECT is not set -# CONFIG_ALIM7101_WDT is not set -CONFIG_ALLOW_DEV_COREDUMP=y -# CONFIG_ALTERA_STAPL is not set -# CONFIG_ALTERA_TSE is not set -# CONFIG_ALX is not set -# CONFIG_AM335X_PHY_USB is not set -# CONFIG_AMD8111_ETH is not set -# CONFIG_AMD_PHY is not set -# CONFIG_AMD_XGBE is not set -# CONFIG_AMD_XGBE_PHY is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_AMILO_RFKILL is not set -# CONFIG_ANDROID is not set -CONFIG_ANON_INODES=y -# CONFIG_APDS9300 is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_APM8018X is not set -# CONFIG_APPLICOM is not set -# CONFIG_AR5523 is not set -# CONFIG_AR7 is not set -# CONFIG_AR8216_PHY is not set -# CONFIG_AR8216_PHY_LEDS is not set -# CONFIG_ARCH_AT91 is not set -# CONFIG_ARCH_BCM is not set -# CONFIG_ARCH_BCM2835 is not set -# CONFIG_ARCH_BCMRING is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_CNS3XXX is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_EXYNOS is not set -CONFIG_ARCH_FLATMEM_ENABLE=y -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_GEMINI is not set -# CONFIG_ARCH_H720X is not set -# CONFIG_ARCH_HAS_ILOG2_U32 is not set -# CONFIG_ARCH_HAS_ILOG2_U64 is not set -# CONFIG_ARCH_HI3xxx is not set -# CONFIG_ARCH_HIGHBANK is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_IOP13XX is not set -# CONFIG_ARCH_IOP32X is not set -# CONFIG_ARCH_IOP33X is not set -# CONFIG_ARCH_IXP2000 is not set -# CONFIG_ARCH_IXP23XX is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_KEYSTONE is not set -# CONFIG_ARCH_KIRKWOOD is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_MEDIATEK is not set -# CONFIG_ARCH_MESON is not set -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_MSM is not set -# CONFIG_ARCH_MSM_DT is not set -# CONFIG_ARCH_MSM_NODT is not set -# CONFIG_ARCH_MULTIPLATFORM is not set -# CONFIG_ARCH_MULTI_V6 is not set -# CONFIG_ARCH_MULTI_V7 is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_MVEBU is not set -# CONFIG_ARCH_MXC is not set -# CONFIG_ARCH_MXS is not set -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_NOMADIK is not set -# CONFIG_ARCH_NSPIRE is not set -# CONFIG_ARCH_NUC93X is not set -# CONFIG_ARCH_OMAP is not set -# CONFIG_ARCH_OMAP1 is not set -# CONFIG_ARCH_OMAP2PLUS is not set -# CONFIG_ARCH_OMAP3 is not set -# CONFIG_ARCH_OMAP4 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -# CONFIG_ARCH_PICOXCELL is not set -# CONFIG_ARCH_PNX4008 is not set -# CONFIG_ARCH_PRIMA2 is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_QCOM is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_ROCKCHIP is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_S5P64X0 is not set -# CONFIG_ARCH_S5PC100 is not set -# CONFIG_ARCH_S5PV210 is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_SHARK is not set -# CONFIG_ARCH_SHMOBILE is not set -# CONFIG_ARCH_SHMOBILE_LEGACY is not set -# CONFIG_ARCH_SHMOBILE_MULTI is not set -# CONFIG_ARCH_SIRF is not set -# CONFIG_ARCH_SOCFPGA is not set -# CONFIG_ARCH_STI is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_SUPPORTS_MSI is not set -# CONFIG_ARCH_TCC_926 is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_U300 is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_VIRT is not set -# CONFIG_ARCH_VT8500 is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_WM8505 is not set -# CONFIG_ARCH_WM8850 is not set -# CONFIG_ARCH_ZYNQ is not set -# CONFIG_ARCNET is not set -# CONFIG_ARC_EMAC is not set -# CONFIG_ARM_APPENDED_DTB is not set -# CONFIG_ARM_ARCH_TIMER is not set -# CONFIG_ARM_AT91_ETHER is not set -# CONFIG_ARM_CCI is not set -# CONFIG_ARM_CCN is not set -CONFIG_ARM_CPU_TOPOLOGY=y -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -# CONFIG_ARM_ERRATA_326103 is not set -# CONFIG_ARM_ERRATA_364296 is not set -# CONFIG_ARM_ERRATA_411920 is not set -# CONFIG_ARM_ERRATA_430973 is not set -# CONFIG_ARM_ERRATA_458693 is not set -# CONFIG_ARM_ERRATA_460075 is not set -# CONFIG_ARM_ERRATA_643719 is not set -# CONFIG_ARM_ERRATA_720789 is not set -# CONFIG_ARM_ERRATA_742230 is not set -# CONFIG_ARM_ERRATA_742231 is not set -# CONFIG_ARM_ERRATA_743622 is not set -# CONFIG_ARM_ERRATA_751472 is not set -# CONFIG_ARM_ERRATA_754322 is not set -# CONFIG_ARM_ERRATA_754327 is not set -# CONFIG_ARM_ERRATA_764369 is not set -# CONFIG_ARM_ERRATA_773022 is not set -# CONFIG_ARM_ERRATA_775420 is not set -# CONFIG_ARM_ERRATA_798181 is not set -# CONFIG_ARM_KPROBES_TEST is not set -# CONFIG_ARM_PATCH_PHYS_VIRT is not set -# CONFIG_ARM_PSCI is not set -# CONFIG_ARM_PTDUMP is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_ARM_VIRT_EXT is not set -CONFIG_ARPD=y -# CONFIG_ARTHUR is not set -# CONFIG_AS3935 is not set -# CONFIG_ASUS_OLED is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_ASYNC_RAID6_TEST is not set -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_AT76C50X_USB is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_ATA is not set -# CONFIG_ATAGS is not set -CONFIG_ATAGS_PROC=y -# CONFIG_ATALK is not set -# CONFIG_ATARI_PARTITION is not set -# CONFIG_ATA_ACPI is not set -CONFIG_ATA_BMDMA=y -# CONFIG_ATA_GENERIC is not set -# CONFIG_ATA_NONSTANDARD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_ATA_PIIX is not set -CONFIG_ATA_SFF=y -# CONFIG_ATA_VERBOSE_ERROR is not set -# CONFIG_ATH10K is not set -# CONFIG_ATH5K is not set -# CONFIG_ATH6KL is not set -# CONFIG_ATH6K_LEGACY is not set -# CONFIG_ATH79 is not set -# CONFIG_ATH9K is not set -# CONFIG_ATH9K_HTC is not set -# CONFIG_ATH_CARDS is not set -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1C is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL2 is not set -# CONFIG_ATM is not set -# CONFIG_ATMEL is not set -# CONFIG_ATMEL_PIT is not set -# CONFIG_ATMEL_PWM is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ATM_AMBASSADOR is not set -# CONFIG_ATM_BR2684 is not set -CONFIG_ATM_BR2684_IPFILTER=y -# CONFIG_ATM_CLIP is not set -CONFIG_ATM_CLIP_NO_ICMP=y -# CONFIG_ATM_DRIVERS is not set -# CONFIG_ATM_DUMMY is not set -# CONFIG_ATM_ENI is not set -# CONFIG_ATM_FIRESTREAM is not set -# CONFIG_ATM_FORE200E is not set -# CONFIG_ATM_HE is not set -# CONFIG_ATM_HORIZON is not set -# CONFIG_ATM_IA is not set -# CONFIG_ATM_IDT77252 is not set -# CONFIG_ATM_LANAI is not set -# CONFIG_ATM_LANE is not set -# CONFIG_ATM_MPOA is not set -# CONFIG_ATM_NICSTAR is not set -# CONFIG_ATM_SOLOS is not set -# CONFIG_ATM_TCP is not set -# CONFIG_ATM_ZATM is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_ATP is not set -# CONFIG_AUDIT is not set -# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set -# CONFIG_AUDIT_LOGINUID_IMMUTABLE is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_AUTO_ZRELADDR is not set -# CONFIG_AUXDISPLAY is not set -# CONFIG_AVERAGE is not set -# CONFIG_AX25 is not set -# CONFIG_AX25_DAMA_SLAVE is not set -# CONFIG_AX88796 is not set -# CONFIG_B43 is not set -# CONFIG_B43LEGACY is not set -# CONFIG_B44 is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set -# CONFIG_BACKLIGHT_LM3630 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_PANDORA is not set -# CONFIG_BACKLIGHT_SAHARA is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -CONFIG_BASE_FULL=y -CONFIG_BASE_SMALL=0 -# CONFIG_BATMAN_ADV is not set -# CONFIG_BATTERY_BQ27x00 is not set -# CONFIG_BATTERY_DS2760 is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_GOLDFISH is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_BAYCOM_EPP is not set -# CONFIG_BAYCOM_PAR is not set -# CONFIG_BAYCOM_SER_FDX is not set -# CONFIG_BAYCOM_SER_HDX is not set -# CONFIG_BCACHE is not set -# CONFIG_BCM47XX is not set -# CONFIG_BCM63XX is not set -# CONFIG_BCM63XX_PHY is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_BCMA is not set -# CONFIG_BCMA_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y -# CONFIG_BCMGENET is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_BCM_WIMAX is not set -# CONFIG_BDI_SWITCH is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BE2NET is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_BGMAC is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_BIG_LITTLE is not set -# CONFIG_BINARY_PRINTF is not set -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set -CONFIG_BINFMT_SCRIPT=y -CONFIG_BITREVERSE=y -# CONFIG_BLK_CMDLINE_PARSER is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_CPQ_DA is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_BLK_DEV_4DRIVES is not set -# CONFIG_BLK_DEV_AEC62XX is not set -# CONFIG_BLK_DEV_ALI14XX is not set -# CONFIG_BLK_DEV_ALI15X3 is not set -# CONFIG_BLK_DEV_AMD74XX is not set -# CONFIG_BLK_DEV_ATIIXP is not set -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_CMD640 is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_CS5520 is not set -# CONFIG_BLK_DEV_CS5530 is not set -# CONFIG_BLK_DEV_CS5535 is not set -# CONFIG_BLK_DEV_CS5536 is not set -# CONFIG_BLK_DEV_CY82C693 is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_DELKIN is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_DTC2278 is not set -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_GENERIC is not set -# CONFIG_BLK_DEV_HD is not set -# CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_BLK_DEV_HT6560B is not set -# CONFIG_BLK_DEV_IDEACPI is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDECS is not set -# CONFIG_BLK_DEV_IDEPCI is not set -# CONFIG_BLK_DEV_IDEPNP is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDE_AU1XXX is not set -# CONFIG_BLK_DEV_IDE_SATA is not set -CONFIG_BLK_DEV_INITRD=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_BLK_DEV_IT8172 is not set -# CONFIG_BLK_DEV_IT8213 is not set -# CONFIG_BLK_DEV_IT821X is not set -# CONFIG_BLK_DEV_JMICRON is not set -# CONFIG_BLK_DEV_LOOP is not set -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_BLK_DEV_OFFBOARD is not set -# CONFIG_BLK_DEV_OPTI621 is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_DEV_PDC202XX_NEW is not set -# CONFIG_BLK_DEV_PDC202XX_OLD is not set -# CONFIG_BLK_DEV_PIIX is not set -# CONFIG_BLK_DEV_PLATFORM is not set -# CONFIG_BLK_DEV_QD65XX is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set -# CONFIG_BLK_DEV_RZ1000 is not set -# CONFIG_BLK_DEV_SC1200 is not set -# CONFIG_BLK_DEV_SD is not set -# CONFIG_BLK_DEV_SIIMAGE is not set -# CONFIG_BLK_DEV_SIS5513 is not set -# CONFIG_BLK_DEV_SKD is not set -# CONFIG_BLK_DEV_SL82C105 is not set -# CONFIG_BLK_DEV_SLC90E66 is not set -# CONFIG_BLK_DEV_SR is not set -# CONFIG_BLK_DEV_SVWKS is not set -# CONFIG_BLK_DEV_SX8 is not set -# CONFIG_BLK_DEV_TC86C001 is not set -# CONFIG_BLK_DEV_THROTTLING is not set -# CONFIG_BLK_DEV_TRIFLEX is not set -# CONFIG_BLK_DEV_TRM290 is not set -# CONFIG_BLK_DEV_UB is not set -# CONFIG_BLK_DEV_UMC8672 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_VIA82CXXX is not set -# CONFIG_BLK_DEV_XIP is not set -CONFIG_BLOCK=y -# CONFIG_BMA180 is not set -# CONFIG_BMC150_ACCEL is not set -# CONFIG_BMG160 is not set -# CONFIG_BMP085 is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_BNA is not set -# CONFIG_BNX2 is not set -# CONFIG_BNX2X is not set -# CONFIG_BONDING is not set -# CONFIG_BOOKE_WDT is not set -CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT=3 -# CONFIG_BOOT_PRINTK_DELAY is not set -CONFIG_BOOT_RAW=y -# CONFIG_BPCTL is not set -CONFIG_BPF=y -# CONFIG_BPF_JIT is not set -CONFIG_BPF_SYSCALL=y -# CONFIG_BPQETHER is not set -CONFIG_BQL=y -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_BRCMFMAC is not set -# CONFIG_BRCMSMAC is not set -# CONFIG_BRCMSTB_GISB_ARB is not set -CONFIG_BRIDGE=y -# CONFIG_BRIDGE_EBT_802_3 is not set -# CONFIG_BRIDGE_EBT_AMONG is not set -# CONFIG_BRIDGE_EBT_ARP is not set -# CONFIG_BRIDGE_EBT_ARPREPLY is not set -# CONFIG_BRIDGE_EBT_BROUTE is not set -# CONFIG_BRIDGE_EBT_DNAT is not set -# CONFIG_BRIDGE_EBT_IP is not set -# CONFIG_BRIDGE_EBT_IP6 is not set -# CONFIG_BRIDGE_EBT_LIMIT is not set -# CONFIG_BRIDGE_EBT_LOG is not set -# CONFIG_BRIDGE_EBT_MARK is not set -# CONFIG_BRIDGE_EBT_MARK_T is not set -# CONFIG_BRIDGE_EBT_NFLOG is not set -# CONFIG_BRIDGE_EBT_PKTTYPE is not set -# CONFIG_BRIDGE_EBT_REDIRECT is not set -# CONFIG_BRIDGE_EBT_SNAT is not set -# CONFIG_BRIDGE_EBT_STP is not set -# CONFIG_BRIDGE_EBT_T_FILTER is not set -# CONFIG_BRIDGE_EBT_T_NAT is not set -# CONFIG_BRIDGE_EBT_ULOG is not set -# CONFIG_BRIDGE_EBT_VLAN is not set -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_NETFILTER is not set -# CONFIG_BRIDGE_NF_EBTABLES is not set -# CONFIG_BRIDGE_VLAN_FILTERING is not set -# CONFIG_BROADCOM_PHY is not set -CONFIG_BROKEN_ON_SMP=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_BSD_PROCESS_ACCT_V3 is not set -# CONFIG_BT is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_FS is not set -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BT_ATH3K is not set -# CONFIG_BT_BNEP is not set -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -# CONFIG_BT_CMTP is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIBLUECARD is not set -# CONFIG_BT_HCIBPA10X is not set -# CONFIG_BT_HCIBT3C is not set -# CONFIG_BT_HCIBTSDIO is not set -# CONFIG_BT_HCIBTUART is not set -# CONFIG_BT_HCIBTUSB is not set -# CONFIG_BT_HCIDTL1 is not set -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIUART_3WIRE is not set -# CONFIG_BT_HCIUART_ATH3K is not set -CONFIG_BT_HCIUART_BCSP=y -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_LL is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_HIDP is not set -CONFIG_BT_L2CAP=y -# CONFIG_BT_MRVL is not set -# CONFIG_BT_RFCOMM is not set -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_SCO=y -CONFIG_BUG=y -CONFIG_BUILDTIME_EXTABLE_SORT=y -# CONFIG_BUILD_BIN2C is not set -# CONFIG_C2PORT is not set -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_CAIF is not set -# CONFIG_CAN is not set -# CONFIG_CAN_GS_USB is not set -# CONFIG_CAN_M_CAN is not set -# CONFIG_CAN_RCAR is not set -# CONFIG_CAPI_AVM is not set -# CONFIG_CAPI_EICON is not set -# CONFIG_CAPI_TRACE is not set -CONFIG_CARDBUS=y -# CONFIG_CARDMAN_4000 is not set -# CONFIG_CARDMAN_4040 is not set -# CONFIG_CARL9170 is not set -# CONFIG_CARMA_FPGA is not set -# CONFIG_CARMA_FPGA_PROGRAM is not set -# CONFIG_CASSINI is not set -CONFIG_CAVIUM_OCTEON_HELPER=y -# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set -# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set -# CONFIG_CAVIUM_OCTEON_SOC is not set -# CONFIG_CB710_CORE is not set -# CONFIG_CC_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_CFG80211_DEBUGFS is not set -# CONFIG_CFG80211_DEFAULT_PS is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_INTERNAL_REGDB is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_WEXT is not set -# CONFIG_CGROUPS is not set -# CONFIG_CGROUP_DEBUG is not set -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_GPIO is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_CHARGER_TWL4030 is not set -# CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -# CONFIG_CHROME_PLATFORMS is not set -# CONFIG_CHR_DEV_OSST is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_CIFS is not set -# CONFIG_CIFS_ACL is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DEBUG2 is not set -# CONFIG_CIFS_FSCACHE is not set -# CONFIG_CIFS_NFSD_EXPORT is not set -CONFIG_CIFS_POSIX=y -# CONFIG_CIFS_SMB2 is not set -CONFIG_CIFS_STATS=y -# CONFIG_CIFS_STATS2 is not set -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CLEANCACHE is not set -# CONFIG_CLKSRC_VERSATILE is not set -CONFIG_CLS_U32_MARK=y -# CONFIG_CLS_U32_PERF is not set -# CONFIG_CM32181 is not set -# CONFIG_CM36651 is not set -# CONFIG_CMA is not set -CONFIG_CMDLINE="" -# CONFIG_CMDLINE_BOOL is not set -# CONFIG_CMDLINE_EXTEND is not set -# CONFIG_CMDLINE_FORCE is not set -# CONFIG_CMDLINE_FROM_BOOTLOADER is not set -# CONFIG_CMDLINE_PARTITION is not set -# CONFIG_CNIC is not set -# CONFIG_CODA_FS is not set -# CONFIG_CODE_PATCHING_SELFTEST is not set -# CONFIG_COMEDI is not set -# CONFIG_COMMON_CLK_DEBUG is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_QCOM is not set -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMPACTION is not set -# CONFIG_COMPAL_LAPTOP is not set -# CONFIG_COMPAT_BRK is not set -# CONFIG_COMPILE_TEST is not set -# CONFIG_CONFIGFS_FS is not set -# CONFIG_CONNECTOR is not set -CONFIG_CONSTRUCTORS=y -# CONFIG_CONTEXT_SWITCH_TRACER is not set -# CONFIG_COPS is not set -# CONFIG_CORDIC is not set -# CONFIG_COREDUMP is not set -# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set -# CONFIG_CPA_DEBUG is not set -# CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_IDLE is not set -# CONFIG_CPU_IDLE_GOV_MENU is not set -# CONFIG_CPU_IDLE_MULTIPLE_DRIVERS is not set -# CONFIG_CRAMFS is not set -CONFIG_CRASHLOG=y -# CONFIG_CRASH_DUMP is not set -# CONFIG_CRC16 is not set -CONFIG_CRC32=y -# CONFIG_CRC32_BIT is not set -CONFIG_CRC32_SARWATE=y -# CONFIG_CRC32_SELFTEST is not set -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SLICEBY8 is not set -# CONFIG_CRC7 is not set -# CONFIG_CRC8 is not set -# CONFIG_CRC_CCITT is not set -# CONFIG_CRC_ITU_T is not set -# CONFIG_CRC_T10DIF is not set -CONFIG_CROSS_COMPILE="" -# CONFIG_CROSS_MEMORY_ATTACH is not set -CONFIG_CRYPTO=y -# CONFIG_CRYPTO_AEAD is not set -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_AES_586 is not set -# CONFIG_CRYPTO_AES_ARM is not set -# CONFIG_CRYPTO_AES_ARM_BS is not set -# CONFIG_CRYPTO_AES_NI_INTEL is not set -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -# CONFIG_CRYPTO_ANSI_CPRNG is not set -# CONFIG_CRYPTO_ANUBIS is not set -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_AUTHENC is not set -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -# CONFIG_CRYPTO_CBC is not set -# CONFIG_CRYPTO_CCM is not set -# CONFIG_CRYPTO_CMAC is not set -# CONFIG_CRYPTO_CRC32 is not set -# CONFIG_CRYPTO_CRC32C is not set -# CONFIG_CRYPTO_CRC32C_INTEL is not set -# CONFIG_CRYPTO_CRCT10DIF is not set -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_CTR is not set -# CONFIG_CRYPTO_CTS is not set -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_DEV_ATMEL_AES is not set -# CONFIG_CRYPTO_DEV_ATMEL_SHA is not set -# CONFIG_CRYPTO_DEV_ATMEL_TDES is not set -# CONFIG_CRYPTO_DEV_CCP is not set -# CONFIG_CRYPTO_DEV_FSL_CAAM is not set -# CONFIG_CRYPTO_DEV_HIFN_795X is not set -# CONFIG_CRYPTO_DEV_MV_CESA is not set -# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set -# CONFIG_CRYPTO_DEV_QCE is not set -# CONFIG_CRYPTO_DEV_SAHARA is not set -# CONFIG_CRYPTO_DEV_TALITOS is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -# CONFIG_CRYPTO_DRBG_MENU is not set -# CONFIG_CRYPTO_ECB is not set -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_FIPS is not set -# CONFIG_CRYPTO_GCM is not set -# CONFIG_CRYPTO_GF128MUL is not set -# CONFIG_CRYPTO_GHASH is not set -# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set -# CONFIG_CRYPTO_HASH is not set -# CONFIG_CRYPTO_HMAC is not set -# CONFIG_CRYPTO_HW is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set -# CONFIG_CRYPTO_LZO is not set -# CONFIG_CRYPTO_MANAGER is not set -# CONFIG_CRYPTO_MANAGER2 is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -# CONFIG_CRYPTO_MCRYPTD is not set -# CONFIG_CRYPTO_MD4 is not set -# CONFIG_CRYPTO_MD5 is not set -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_PCOMP is not set -# CONFIG_CRYPTO_PCOMP2 is not set -CONFIG_CRYPTO_PCRYPT=y -# CONFIG_CRYPTO_RMD128 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_RMD256 is not set -# CONFIG_CRYPTO_RMD320 is not set -# CONFIG_CRYPTO_RNG is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SALSA20_586 is not set -# CONFIG_CRYPTO_SEED is not set -# CONFIG_CRYPTO_SEQIV is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SHA1 is not set -# CONFIG_CRYPTO_SHA1_ARM is not set -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TEST is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_TWOFISH_586 is not set -# CONFIG_CRYPTO_TWOFISH_COMMON is not set -# CONFIG_CRYPTO_USER is not set -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_VMAC is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_XTS is not set -# CONFIG_CRYPTO_ZLIB is not set -# CONFIG_CRYSTALHD is not set -# CONFIG_CS5535_MFGPT is not set -# CONFIG_CS89x0 is not set -# CONFIG_CUSE is not set -# CONFIG_CW1200 is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXT1E1 is not set -# CONFIG_CYPRESS_FIRMWARE is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_DCB is not set -# CONFIG_DDR is not set -# CONFIG_DE600 is not set -# CONFIG_DE620 is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_CREDENTIALS is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_DEBUG_FS=y -# CONFIG_DEBUG_GPIO is not set -# CONFIG_DEBUG_HIGHMEM is not set -# CONFIG_DEBUG_ICEDCC is not set -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_INFO_DWARF4 is not set -CONFIG_DEBUG_INFO_REDUCED=y -# CONFIG_DEBUG_INFO_SPLIT is not set -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_KOBJECT_RELEASE is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LL is not set -# CONFIG_DEBUG_LL_UART_8250 is not set -# CONFIG_DEBUG_LL_UART_PL01X is not set -# CONFIG_DEBUG_LOCKDEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_NX_TEST is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_PREEMPT is not set -# CONFIG_DEBUG_RODATA is not set -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -# CONFIG_DEBUG_SEMIHOSTING is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_SHIRQ is not set -# CONFIG_DEBUG_SLAB is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_STACKOVERFLOW is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set -# CONFIG_DEBUG_UART_BCM63XX is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_WRITECOUNT is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_ZBOOT is not set -# CONFIG_DECNET is not set -CONFIG_DEFAULT_CUBIC=y -CONFIG_DEFAULT_DEADLINE=y -CONFIG_DEFAULT_HOSTNAME="(none)" -CONFIG_DEFAULT_IOSCHED="deadline" -CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -# CONFIG_DEFAULT_NOOP is not set -# CONFIG_DEFAULT_RENO is not set -CONFIG_DEFAULT_SECURITY="" -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -# CONFIG_DELL_SMO8800 is not set -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_DEVKMEM is not set -CONFIG_DEVPORT=y -# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set -# CONFIG_DEVTMPFS is not set -# CONFIG_DEVTMPFS_MOUNT is not set -# CONFIG_DGAP is not set -# CONFIG_DGNC is not set -# CONFIG_DGRP is not set -# CONFIG_DHT11 is not set -CONFIG_DISABLE_DEV_COREDUMP=y -# CONFIG_DISCONTIGMEM_MANUAL is not set -# CONFIG_DISPLAY_CONNECTOR_ANALOG_TV is not set -# CONFIG_DISPLAY_CONNECTOR_DVI is not set -# CONFIG_DISPLAY_CONNECTOR_HDMI is not set -# CONFIG_DISPLAY_ENCODER_TFP410 is not set -# CONFIG_DISPLAY_ENCODER_TPD12S015 is not set -# CONFIG_DISPLAY_PANEL_DPI is not set -# CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02 is not set -# CONFIG_DISPLAY_PANEL_TPO_TD028TTEC1 is not set -# CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1 is not set -# CONFIG_DISPLAY_SUPPORT is not set -# CONFIG_DL2K is not set -# CONFIG_DLM is not set -# CONFIG_DM9000 is not set -# CONFIG_DMADEVICES is not set -# CONFIG_DMADEVICES_DEBUG is not set -# CONFIG_DMASCC is not set -# CONFIG_DMATEST is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_DMA_ENGINE is not set -# CONFIG_DMA_SHARED_BUFFER is not set -# CONFIG_DM_CACHE is not set -# CONFIG_DM_DEBUG is not set -# CONFIG_DM_DELAY is not set -# CONFIG_DM_ERA is not set -# CONFIG_DM_FLAKEY is not set -# CONFIG_DM_LOG_USERSPACE is not set -# CONFIG_DM_MULTIPATH is not set -# CONFIG_DM_RAID is not set -# CONFIG_DM_SWITCH is not set -# CONFIG_DM_THIN_PROVISIONING is not set -# CONFIG_DM_UEVENT is not set -# CONFIG_DM_VERITY is not set -# CONFIG_DM_ZERO is not set -# CONFIG_DNET is not set -# CONFIG_DNOTIFY is not set -# CONFIG_DNS_RESOLVER is not set -CONFIG_DOUBLEFAULT=y -CONFIG_DQL=y -# CONFIG_DRAGONRISE_FF is not set -# CONFIG_DRM is not set -# CONFIG_DS1682 is not set -# CONFIG_DTLK is not set -# CONFIG_DUMMY is not set -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -# CONFIG_DUMMY_IRQ is not set -# CONFIG_DVB_AU8522_V4L is not set -# CONFIG_DVB_CORE is not set -# CONFIG_DVB_DUMMY_FE is not set -# CONFIG_DVB_TUNER_DIB0070 is not set -# CONFIG_DVB_TUNER_DIB0090 is not set -# CONFIG_DWC3_HOST_USB3_LPM_ENABLE is not set -# CONFIG_DW_DMAC is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_DX_SEP is not set -# CONFIG_DYNAMIC_DEBUG is not set -# CONFIG_E100 is not set -# CONFIG_E1000 is not set -# CONFIG_E1000E is not set -# CONFIG_E2100 is not set -# CONFIG_EARLY_PRINTK_8250 is not set -# CONFIG_EASYCAP is not set -# CONFIG_ECHO is not set -# CONFIG_ECONET is not set -# CONFIG_ECRYPT_FS is not set -# CONFIG_EDAC is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_DIGSY_MTC_CFG is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -# CONFIG_EEXPRESS is not set -# CONFIG_EEXPRESS_PRO is not set -CONFIG_EFI_PARTITION=y -# CONFIG_EFS_FS is not set -# CONFIG_ELF_CORE is not set -# CONFIG_EMAC_ROCKCHIP is not set -CONFIG_EMBEDDED=y -# CONFIG_EM_TIMER_STI is not set -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -# CONFIG_ENC28J60 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_ENCRYPTED_KEYS is not set -# CONFIG_ENIC is not set -# CONFIG_EPAPR_PARAVIRT is not set -# CONFIG_EPIC100 is not set -CONFIG_EPOLL=y -# CONFIG_EQUALIZER is not set -# CONFIG_ET131X is not set -# CONFIG_ETH16I is not set -CONFIG_ETHERNET=y -# CONFIG_ETHOC is not set -CONFIG_EVENTFD=y -# CONFIG_EVENT_POWER_TRACING_DEPRECATED is not set -# CONFIG_EWRK3 is not set -CONFIG_EXPERIMENTAL=y -CONFIG_EXPERT=y -# CONFIG_EXPORTFS is not set -# CONFIG_EXT2_FS is not set -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT2_FS_XIP is not set -# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set -# CONFIG_EXT3_FS is not set -# CONFIG_EXT3_FS_XATTR is not set -# CONFIG_EXT4_DEBUG is not set -# CONFIG_EXT4_FS is not set -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -CONFIG_EXT4_FS_XATTR=y -CONFIG_EXT4_USE_FOR_EXT23=y -# CONFIG_EXTCON is not set -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_TARGETS="" -# CONFIG_EXYNOS_ADC is not set -# CONFIG_EXYNOS_VIDEO is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_F2FS_FS is not set -# CONFIG_F2FS_FS_POSIX_ACL is not set -# CONFIG_FAIR_GROUP_SCHED is not set -# CONFIG_FANOTIFY is not set -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -# CONFIG_FAT_FS is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_FB is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_ARC is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_CFB_COPYAREA is not set -# CONFIG_FB_CFB_FILLRECT is not set -# CONFIG_FB_CFB_IMAGEBLIT is not set -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_DA8XX is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_FOREIGN_ENDIAN is not set -# CONFIG_FB_GEODE is not set -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_HGA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_IMX is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_LE80578 is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_MXS is not set -# CONFIG_FB_N411 is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_OF is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_PS3 is not set -# CONFIG_FB_PXA is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_SM7XX is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_SYS_COPYAREA is not set -# CONFIG_FB_SYS_FILLRECT is not set -# CONFIG_FB_SYS_FOPS is not set -# CONFIG_FB_SYS_IMAGEBLIT is not set -# CONFIG_FB_TILEBLITTING is not set -# CONFIG_FB_TMIO is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_UVESA is not set -# CONFIG_FB_VGA16 is not set -# CONFIG_FB_VIA is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_XGI is not set -# CONFIG_FCOE is not set -# CONFIG_FCOE_FNIC is not set -# CONFIG_FDDI is not set -# CONFIG_FEALNX is not set -# CONFIG_FENCE_TRACE is not set -# CONFIG_FHANDLE is not set -CONFIG_FIB_RULES=y -CONFIG_FILE_LOCKING=y -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -# CONFIG_FIREWIRE_SERIAL is not set -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FIRMWARE_IN_KERNEL is not set -# CONFIG_FIRMWARE_MEMMAP is not set -# CONFIG_FIXED_PHY is not set -CONFIG_FLATMEM=y -CONFIG_FLATMEM_MANUAL=y -CONFIG_FLAT_NODE_MEM_MAP=y -# CONFIG_FM10K is not set -# CONFIG_FMC is not set -# CONFIG_FORCEDETH is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_FRAME_POINTER is not set -CONFIG_FRAME_WARN=1024 -# CONFIG_FREEZER is not set -# CONFIG_FRONTSWAP is not set -# CONFIG_FSCACHE is not set -# CONFIG_FSL_EDMA is not set -# CONFIG_FSL_XGMAC_MDIO is not set -CONFIG_FSNOTIFY=y -# CONFIG_FS_POSIX_ACL is not set -# CONFIG_FT1000 is not set -# CONFIG_FTGMAC100 is not set -# CONFIG_FTL is not set -# CONFIG_FTMAC100 is not set -# CONFIG_FTRACE is not set -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_FTR_FIXUP_SELFTEST is not set -# CONFIG_FUJITSU_TABLET is not set -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_FUSE_FS is not set -# CONFIG_FUSION is not set -# CONFIG_FUSION_FC is not set -# CONFIG_FUSION_SAS is not set -# CONFIG_FUSION_SPI is not set -CONFIG_FUTEX=y -CONFIG_FW_LOADER=y -CONFIG_FW_LOADER_USER_HELPER=y -CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y -CONFIG_GACT_PROB=y -# CONFIG_GADGET_UAC1 is not set -# CONFIG_GAMEPORT is not set -# CONFIG_GATEWORKS_GW16083 is not set -# CONFIG_GCOV is not set -# CONFIG_GCOV_KERNEL is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -CONFIG_GENERIC_CALIBRATE_DELAY=y -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_GENERIC_HARDIRQS=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_NET_UTILS=y -# CONFIG_GENERIC_PHY is not set -CONFIG_GENERIC_TIME=y -# CONFIG_GENEVE is not set -# CONFIG_GENWQE is not set -# CONFIG_GFS2_FS is not set -# CONFIG_GIGASET_CAPI is not set -# CONFIG_GIGASET_DEBUG is not set -# CONFIG_GLOB_SELFTEST is not set -# CONFIG_GP2AP020A00F is not set -# CONFIG_GPIOLIB is not set -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_BCM_KONA is not set -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_CS5535 is not set -# CONFIG_GPIO_DWAPB is not set -# CONFIG_GPIO_EM is not set -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_GRGPIO is not set -# CONFIG_GPIO_ICH is not set -# CONFIG_GPIO_IT8761E is not set -# CONFIG_GPIO_LANGWELL is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_PCH is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_RCAR is not set -# CONFIG_GPIO_RDC321X is not set -# CONFIG_GPIO_SCH is not set -# CONFIG_GPIO_SCH311X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_SYSCON is not set -# CONFIG_GPIO_SYSFS is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_WATCHDOG is not set -# CONFIG_GPIO_WDT is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_ZEVIO is not set -# CONFIG_GREENASIA_FF is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_HAMACHI is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HAPPYMEAL is not set -# CONFIG_HARDLOCKUP_DETECTOR is not set -# CONFIG_HAVE_AOUT is not set -# CONFIG_HAVE_ARM_ARCH_TIMER is not set -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -# CONFIG_HCALL_STATS is not set -# CONFIG_HDLC is not set -# CONFIG_HDLC_CISCO is not set -# CONFIG_HDLC_FR is not set -# CONFIG_HDLC_PPP is not set -# CONFIG_HDLC_RAW is not set -# CONFIG_HDLC_RAW_ETH is not set -# CONFIG_HDQ_MASTER_OMAP is not set -# CONFIG_HEADERS_CHECK is not set -# CONFIG_HERMES is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFS_FS_POSIX_ACL is not set -# CONFIG_HIBERNATION is not set -# CONFIG_HID is not set -# CONFIG_HIDRAW is not set -# CONFIG_HID_A4TECH is not set -# CONFIG_HID_ACRUX is not set -# CONFIG_HID_ACRUX_FF is not set -# CONFIG_HID_APPLE is not set -# CONFIG_HID_APPLEIR is not set -# CONFIG_HID_AUREAL is not set -# CONFIG_HID_BELKIN is not set -# CONFIG_HID_CHERRY is not set -# CONFIG_HID_CHICONY is not set -# CONFIG_HID_CP2112 is not set -# CONFIG_HID_CYPRESS is not set -# CONFIG_HID_DRAGONRISE is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_EZKEY is not set -# CONFIG_HID_GENERIC is not set -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_GT683R is not set -# CONFIG_HID_GYRATION is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_HUION is not set -# CONFIG_HID_ICADE is not set -# CONFIG_HID_KENSINGTON is not set -# CONFIG_HID_KEYTOUCH is not set -# CONFIG_HID_KYE is not set -# CONFIG_HID_LCPOWER is not set -# CONFIG_HID_LENOVO is not set -# CONFIG_HID_LENOVO_TPKBD is not set -# CONFIG_HID_LOGITECH is not set -# CONFIG_HID_LOGITECH_DJ is not set -# CONFIG_HID_LOGITECH_HIDPP is not set -# CONFIG_HID_MAGICMOUSE is not set -# CONFIG_HID_MICROSOFT is not set -# CONFIG_HID_MONTEREY is not set -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTRIG is not set -# CONFIG_HID_ORTEK is not set -# CONFIG_HID_PANTHERLORD is not set -# CONFIG_HID_PENMOUNT is not set -# CONFIG_HID_PETALYNX is not set -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PID is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_PS3REMOTE is not set -# CONFIG_HID_QUANTA is not set -# CONFIG_HID_RMI is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_ROCCAT_ARVO is not set -# CONFIG_HID_ROCCAT_KONE is not set -# CONFIG_HID_ROCCAT_KONEPLUS is not set -# CONFIG_HID_ROCCAT_KOVAPLUS is not set -# CONFIG_HID_ROCCAT_PYRA is not set -# CONFIG_HID_SAITEK is not set -# CONFIG_HID_SAMSUNG is not set -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_SMARTJOYPLUS is not set -# CONFIG_HID_SONY is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -# CONFIG_HID_SUNPLUS is not set -# CONFIG_HID_SUPPORT is not set -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_TIVO is not set -# CONFIG_HID_TOPSEED is not set -# CONFIG_HID_TWINHAN is not set -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WACOM is not set -# CONFIG_HID_WALTOP is not set -# CONFIG_HID_WIIMOTE is not set -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -# CONFIG_HID_ZYDACRON is not set -# CONFIG_HIGHMEM is not set -CONFIG_HIGH_RES_TIMERS=y -# CONFIG_HIPPI is not set -# CONFIG_HIX5HD2_GMAC is not set -# CONFIG_HMC6352 is not set -# CONFIG_HOSTAP is not set -# CONFIG_HOSTAP_CS is not set -# CONFIG_HOSTAP_PCI is not set -# CONFIG_HOSTAP_PLX is not set -CONFIG_HOTPLUG=y -# CONFIG_HOTPLUG_CPU is not set -# CONFIG_HOTPLUG_PCI is not set -# CONFIG_HP100 is not set -CONFIG_HPET_MMAP_DEFAULT=y -# CONFIG_HPFS_FS is not set -# CONFIG_HPLAN is not set -# CONFIG_HPLAN_PLUS is not set -# CONFIG_HP_ILO is not set -# CONFIG_HP_WIRELESS is not set -# CONFIG_HSI is not set -# CONFIG_HSR is not set -# CONFIG_HTC_EGPIO is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HUGETLB_PAGE is not set -# CONFIG_HVC_DCC is not set -# CONFIG_HVC_UDBG is not set -# CONFIG_HWMON is not set -# CONFIG_HWMON_DEBUG_CHIP is not set -# CONFIG_HWMON_VID is not set -# CONFIG_HWSPINLOCK_OMAP is not set -CONFIG_HW_PERF_EVENTS=y -# CONFIG_HW_RANDOM is not set -# CONFIG_HW_RANDOM_AMD is not set -# CONFIG_HW_RANDOM_ATMEL is not set -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_HW_RANDOM_GEODE is not set -# CONFIG_HW_RANDOM_INTEL is not set -# CONFIG_HW_RANDOM_OMAP3_ROM is not set -# CONFIG_HW_RANDOM_PPC4XX is not set -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_TPM is not set -# CONFIG_HW_RANDOM_VIA is not set -# CONFIG_HYPERV is not set -# CONFIG_HYSDN is not set -CONFIG_HZ=100 -CONFIG_HZ_100=y -# CONFIG_HZ_1000 is not set -# CONFIG_HZ_1024 is not set -# CONFIG_HZ_128 is not set -# CONFIG_HZ_200 is not set -# CONFIG_HZ_250 is not set -# CONFIG_HZ_256 is not set -# CONFIG_HZ_300 is not set -# CONFIG_HZ_48 is not set -# CONFIG_HZ_500 is not set -# CONFIG_HZ_PERIODIC is not set -# CONFIG_I2C is not set -# CONFIG_I2C_ALGOBIT is not set -# CONFIG_I2C_ALGOPCA is not set -# CONFIG_I2C_ALGOPCF is not set -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_AU1550 is not set -# CONFIG_I2C_BCM2835 is not set -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_CHARDEV is not set -# CONFIG_I2C_COMPAT is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DESIGNWARE is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_EG20T is not set -# CONFIG_I2C_ELEKTOR is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_HELPER_AUTO is not set -# CONFIG_I2C_HID is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_IBM_IIC is not set -# CONFIG_I2C_INTEL_MID is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_ISMT is not set -# CONFIG_I2C_MPC is not set -# CONFIG_I2C_MUX is not set -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_MV64XXX is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_OCTEON is not set -# CONFIG_I2C_PARPORT is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_PCA_ISA is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_RCAR is not set -# CONFIG_I2C_RK3X is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_SCMI is not set -# CONFIG_I2C_SH_MOBILE is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_SMBUS is not set -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set -# CONFIG_I2C_VERSATILE is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set -# CONFIG_I2C_XILINX is not set -# CONFIG_I2O is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_I82092 is not set -# CONFIG_I82365 is not set -# CONFIG_IBM_ASM is not set -# CONFIG_IBM_EMAC_DEBUG is not set -# CONFIG_IBM_EMAC_EMAC4 is not set -# CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT is not set -# CONFIG_IBM_EMAC_MAL_COMMON_ERR is not set -# CONFIG_IBM_EMAC_NO_FLOW_CTRL is not set -# CONFIG_IBM_EMAC_RGMII is not set -# CONFIG_IBM_EMAC_TAH is not set -# CONFIG_IBM_EMAC_ZMII is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_ICS932S401 is not set -# CONFIG_IDE is not set -# CONFIG_IDEAPAD_LAPTOP is not set -# CONFIG_IDE_GD is not set -# CONFIG_IDE_PHISON is not set -# CONFIG_IDE_PROC_FS is not set -# CONFIG_IDE_TASK_IOCTL is not set -# CONFIG_IEEE802154 is not set -# CONFIG_IEEE802154_FAKEHARD is not set -# CONFIG_IFB is not set -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IIO is not set -# CONFIG_IIO_BUFFER_CB is not set -CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 -# CONFIG_IIO_GPIO_TRIGGER is not set -# CONFIG_IIO_INTERRUPT_TRIGGER is not set -# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set -# CONFIG_IIO_SIMPLE_DUMMY is not set -# CONFIG_IIO_ST_ACCEL_3AXIS is not set -# CONFIG_IIO_ST_GYRO_3AXIS is not set -# CONFIG_IIO_ST_MAGN_3AXIS is not set -# CONFIG_IIO_ST_PRESS is not set -# CONFIG_IIO_SYSFS_TRIGGER is not set -# CONFIG_IKCONFIG is not set -# CONFIG_IKCONFIG_PROC is not set -# CONFIG_IMAGE_CMDLINE_HACK is not set -# CONFIG_IMX_IPUV3_CORE is not set -CONFIG_INET=y -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_INET6_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_DIAG is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_LRO is not set -# CONFIG_INET_TCP_DIAG is not set -# CONFIG_INET_TUNNEL is not set -# CONFIG_INET_UDP_DIAG is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_TUNNEL is not set -# CONFIG_INFINIBAND is not set -# CONFIG_INFTL is not set -# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set -# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set -# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set -CONFIG_INITRAMFS_COMPRESSION_NONE=y -CONFIG_INIT_ENV_ARG_LIMIT=32 -# CONFIG_INLINE_READ_LOCK is not set -# CONFIG_INLINE_READ_LOCK_BH is not set -# CONFIG_INLINE_READ_LOCK_IRQ is not set -# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set -# CONFIG_INLINE_READ_TRYLOCK is not set -CONFIG_INLINE_READ_UNLOCK=y -# CONFIG_INLINE_READ_UNLOCK_BH is not set -CONFIG_INLINE_READ_UNLOCK_IRQ=y -# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_SPIN_LOCK is not set -# CONFIG_INLINE_SPIN_LOCK_BH is not set -# CONFIG_INLINE_SPIN_LOCK_IRQ is not set -# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set -# CONFIG_INLINE_SPIN_TRYLOCK is not set -# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set -CONFIG_INLINE_SPIN_UNLOCK=y -# CONFIG_INLINE_SPIN_UNLOCK_BH is not set -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_WRITE_LOCK is not set -# CONFIG_INLINE_WRITE_LOCK_BH is not set -# CONFIG_INLINE_WRITE_LOCK_IRQ is not set -# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set -# CONFIG_INLINE_WRITE_TRYLOCK is not set -CONFIG_INLINE_WRITE_UNLOCK=y -# CONFIG_INLINE_WRITE_UNLOCK_BH is not set -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set -CONFIG_INOTIFY_USER=y -# CONFIG_INPUT is not set -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_APANEL is not set -# CONFIG_INPUT_ATI_REMOTE is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_ATLAS_BTNS is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_CM109 is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_DRV260X_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_FF_MEMLESS is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_MATRIXKMAP is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_PCSPKR is not set -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_PWM_BEEPER is not set -# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_UINPUT is not set -# CONFIG_INPUT_WISTRON_BTNS is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INT340X_THERMAL is not set -# CONFIG_INTEL_IDLE is not set -# CONFIG_INTEL_MEI is not set -# CONFIG_INTEL_MEI_ME is not set -# CONFIG_INTEL_MEI_TXE is not set -# CONFIG_INTEL_MIC_CARD is not set -# CONFIG_INTEL_MIC_HOST is not set -# CONFIG_INTEL_MID_PTI is not set -# CONFIG_INTEL_OAKTRAIL is not set -# CONFIG_INTEL_RST is not set -# CONFIG_INTEL_SMARTCONNECT is not set -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_INV_MPU6050_IIO is not set -# CONFIG_IOMMU_SUPPORT is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_NOOP=y -# CONFIG_IP1000 is not set -# CONFIG_IP17XX_PHY is not set -# CONFIG_IP6_NF_FILTER is not set -# CONFIG_IP6_NF_IPTABLES is not set -# CONFIG_IP6_NF_MANGLE is not set -# CONFIG_IP6_NF_MATCH_AH is not set -# CONFIG_IP6_NF_MATCH_EUI64 is not set -# CONFIG_IP6_NF_MATCH_FRAG is not set -# CONFIG_IP6_NF_MATCH_HL is not set -# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set -# CONFIG_IP6_NF_MATCH_MH is not set -# CONFIG_IP6_NF_MATCH_OPTS is not set -# CONFIG_IP6_NF_MATCH_RPFILTER is not set -# CONFIG_IP6_NF_MATCH_RT is not set -# CONFIG_IP6_NF_NAT is not set -# CONFIG_IP6_NF_QUEUE is not set -# CONFIG_IP6_NF_RAW is not set -# CONFIG_IP6_NF_TARGET_HL is not set -# CONFIG_IP6_NF_TARGET_LOG is not set -# CONFIG_IP6_NF_TARGET_REJECT is not set -# CONFIG_IP6_NF_TARGET_SYNPROXY is not set -# CONFIG_IPACK_BUS is not set -# CONFIG_IPC_NS is not set -# CONFIG_IPMI_HANDLER is not set -# CONFIG_IPV6 is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_IPV6_MROUTE_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_IPV6_PRIVACY is not set -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_ROUTE_INFO is not set -# CONFIG_IPV6_SIT is not set -# CONFIG_IPV6_SIT_6RD is not set -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_VTI is not set -# CONFIG_IPW2100 is not set -# CONFIG_IPW2100_DEBUG is not set -CONFIG_IPW2100_MONITOR=y -# CONFIG_IPW2200 is not set -# CONFIG_IPW2200_DEBUG is not set -CONFIG_IPW2200_MONITOR=y -# CONFIG_IPW2200_PROMISCUOUS is not set -# CONFIG_IPW2200_QOS is not set -# CONFIG_IPW2200_RADIOTAP is not set -# CONFIG_IPWIRELESS is not set -# CONFIG_IPX is not set -CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_DCCP is not set -# CONFIG_IP_FIB_TRIE_STATS is not set -# CONFIG_IP_MROUTE is not set -CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_MULTIPLE_TABLES=y -# CONFIG_IP_NF_ARPFILTER is not set -# CONFIG_IP_NF_ARPTABLES is not set -# CONFIG_IP_NF_ARP_MANGLE is not set -# CONFIG_IP_NF_FILTER is not set -# CONFIG_IP_NF_IPTABLES is not set -# CONFIG_IP_NF_MANGLE is not set -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_RPFILTER is not set -# CONFIG_IP_NF_MATCH_TTL is not set -# CONFIG_IP_NF_QUEUE is not set -# CONFIG_IP_NF_RAW is not set -# CONFIG_IP_NF_SECURITY is not set -# CONFIG_IP_NF_TARGET_CLUSTERIP is not set -# CONFIG_IP_NF_TARGET_ECN is not set -# CONFIG_IP_NF_TARGET_LOG is not set -# CONFIG_IP_NF_TARGET_MASQUERADE is not set -# CONFIG_IP_NF_TARGET_NETMAP is not set -# CONFIG_IP_NF_TARGET_REDIRECT is not set -# CONFIG_IP_NF_TARGET_REJECT is not set -# CONFIG_IP_NF_TARGET_SYNPROXY is not set -# CONFIG_IP_NF_TARGET_TTL is not set -# CONFIG_IP_NF_TARGET_ULOG is not set -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_IP_PNP is not set -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_VERBOSE=y -# CONFIG_IP_SCTP is not set -# CONFIG_IP_SET is not set -# CONFIG_IP_VS is not set -# CONFIG_IRDA is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_IRQ_ALL_CPUS is not set -# CONFIG_IRQ_DOMAIN_DEBUG is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_IR_GPIO_CIR is not set -# CONFIG_IR_HIX5HD2 is not set -# CONFIG_IR_IGUANA is not set -# CONFIG_IR_IMG is not set -# CONFIG_IR_IMON is not set -# CONFIG_IR_JVC_DECODER is not set -# CONFIG_IR_LIRC_CODEC is not set -# CONFIG_IR_MCEUSB is not set -# CONFIG_IR_NEC_DECODER is not set -# CONFIG_IR_RC5_DECODER is not set -# CONFIG_IR_RC5_SZ_DECODER is not set -# CONFIG_IR_RC6_DECODER is not set -# CONFIG_IR_REDRAT3 is not set -# CONFIG_IR_SONY_DECODER is not set -# CONFIG_IR_STREAMZAP is not set -# CONFIG_IR_TTUSBIR is not set -# CONFIG_ISCSI_BOOT_SYSFS is not set -# CONFIG_ISCSI_TCP is not set -CONFIG_ISDN=y -# CONFIG_ISDN_AUDIO is not set -# CONFIG_ISDN_CAPI is not set -# CONFIG_ISDN_CAPI_CAPIDRV is not set -# CONFIG_ISDN_DIVERSION is not set -# CONFIG_ISDN_DRV_ACT2000 is not set -# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set -# CONFIG_ISDN_DRV_GIGASET is not set -# CONFIG_ISDN_DRV_HISAX is not set -# CONFIG_ISDN_DRV_ICN is not set -# CONFIG_ISDN_DRV_LOOP is not set -# CONFIG_ISDN_DRV_PCBIT is not set -# CONFIG_ISDN_DRV_SC is not set -# CONFIG_ISDN_I4L is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_ISL29125 is not set -# CONFIG_ISO9660_FS is not set -# CONFIG_ISS4xx is not set -# CONFIG_ITG3200 is not set -# CONFIG_IWL3945 is not set -# CONFIG_IWLAGN is not set -# CONFIG_IWLWIFI is not set -# CONFIG_IWMC3200TOP is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_JBD is not set -# CONFIG_JBD2_DEBUG is not set -# CONFIG_JBD_DEBUG is not set -# CONFIG_JFFS2_CMODE_FAVOURLZO is not set -# CONFIG_JFFS2_CMODE_NONE is not set -CONFIG_JFFS2_CMODE_PRIORITY=y -# CONFIG_JFFS2_CMODE_SIZE is not set -CONFIG_JFFS2_COMPRESSION_OPTIONS=y -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -# CONFIG_JFFS2_FS_POSIX_ACL is not set -# CONFIG_JFFS2_FS_SECURITY is not set -# CONFIG_JFFS2_FS_WBUF_VERIFY is not set -CONFIG_JFFS2_FS_WRITEBUFFER=y -CONFIG_JFFS2_FS_XATTR=y -CONFIG_JFFS2_LZMA=y -# CONFIG_JFFS2_LZO is not set -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_JFFS2_SUMMARY=y -# CONFIG_JFFS2_ZLIB is not set -# CONFIG_JFS_DEBUG is not set -# CONFIG_JFS_FS is not set -# CONFIG_JFS_POSIX_ACL is not set -# CONFIG_JFS_SECURITY is not set -# CONFIG_JFS_STATISTICS is not set -# CONFIG_JME is not set -CONFIG_JOLIET=y -# CONFIG_JUMP_LABEL is not set -# CONFIG_KALLSYMS is not set -# CONFIG_KALLSYMS_ALL is not set -# CONFIG_KALLSYMS_UNCOMPRESSED is not set -# CONFIG_KARMA_PARTITION is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_GZIP is not set -# CONFIG_KERNEL_LZ4 is not set -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_LZO is not set -CONFIG_KERNEL_MODE_NEON=y -CONFIG_KERNEL_XZ=y -CONFIG_KERNFS=y -# CONFIG_KEXEC is not set -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -# CONFIG_KEYBOARD_ATKBD is not set -# CONFIG_KEYBOARD_CAP1106 is not set -# CONFIG_KEYBOARD_GPIO_POLLED is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MATRIX is not set -# CONFIG_KEYBOARD_MAX7359 is not set -# CONFIG_KEYBOARD_MCS is not set -# CONFIG_KEYBOARD_MPR121 is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_OMAP4 is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_PXA27x is not set -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_SH_KEYSC is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYS is not set -# CONFIG_KEYS_DEBUG_PROC_KEYS is not set -# CONFIG_KGDB is not set -# CONFIG_KMEMCHECK is not set -# CONFIG_KPROBES is not set -# CONFIG_KPROBES_SANITY_TEST is not set -# CONFIG_KS8842 is not set -# CONFIG_KS8851 is not set -# CONFIG_KS8851_MLL is not set -# CONFIG_KSM is not set -# CONFIG_KSZ884X_PCI is not set -CONFIG_KUSER_HELPERS=y -# CONFIG_KVM_GUEST is not set -# CONFIG_KXCJK1013 is not set -# CONFIG_KXSD9 is not set -# CONFIG_L2TP is not set -# CONFIG_L2TP_ETH is not set -# CONFIG_L2TP_IP is not set -# CONFIG_L2TP_V3 is not set -# CONFIG_LANMEDIA is not set -# CONFIG_LANTIQ is not set -# CONFIG_LAPB is not set -# CONFIG_LASAT is not set -# CONFIG_LATENCYTOP is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -CONFIG_LBDAF=y -# CONFIG_LCD_HX8357 is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_LEDS_ATMEL_PWM is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_BLINKM is not set -CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_GPIO is not set -CONFIG_LEDS_GPIO_OF=y -CONFIG_LEDS_GPIO_PLATFORM=y -# CONFIG_LEDS_INTEL_SS4200 is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3556 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_NET5501 is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA9633 is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PCA9685 is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_RENESAS_TPU is not set -# CONFIG_LEDS_SYSCON is not set -# CONFIG_LEDS_TCA6507 is not set -CONFIG_LEDS_TRIGGERS=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y -# CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set -# CONFIG_LEDS_TRIGGER_IDE_DISK is not set -CONFIG_LEDS_TRIGGER_NETDEV=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEGACY_PTYS is not set -# CONFIG_LIB80211 is not set -# CONFIG_LIB80211_CRYPT_CCMP is not set -# CONFIG_LIB80211_CRYPT_TKIP is not set -# CONFIG_LIB80211_CRYPT_WEP is not set -# CONFIG_LIB80211_DEBUG is not set -# CONFIG_LIBCRC32C is not set -# CONFIG_LIBERTAS is not set -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_LIBERTAS_USB is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_LIBIPW_DEBUG is not set -# CONFIG_LINE6_USB is not set -# CONFIG_LIRC_STAGING is not set -# CONFIG_LIS3L02DQ is not set -# CONFIG_LKDTM is not set -CONFIG_LLC=y -# CONFIG_LLC2 is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -# CONFIG_LOCKD is not set -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_LOCKD_V4=y -# CONFIG_LOCKUP_DETECTOR is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_LOCK_TORTURE_TEST is not set -# CONFIG_LOGFS is not set -# CONFIG_LOGIG940_FF is not set -# CONFIG_LOGIRUMBLEPAD2_FF is not set -# CONFIG_LOGITECH_FF is not set -# CONFIG_LOGIWHEELS_FF is not set -# CONFIG_LOGO is not set -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -# CONFIG_LOONGSON_MC146818 is not set -# CONFIG_LP486E is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_LP_CONSOLE is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LTPC is not set -# CONFIG_LTR501 is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_LXT_PHY is not set -# CONFIG_LZ4HC_COMPRESS is not set -# CONFIG_LZ4_COMPRESS is not set -# CONFIG_LZ4_DECOMPRESS is not set -CONFIG_LZMA_COMPRESS=y -CONFIG_LZMA_DECOMPRESS=y -# CONFIG_LZO_COMPRESS is not set -# CONFIG_LZO_DECOMPRESS is not set -# CONFIG_M25PXX_PREFER_SMALL_SECTOR_ERASE is not set -# CONFIG_MAC80211 is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MACB is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_JZ4740 is not set -# CONFIG_MACH_LOONGSON is not set -# CONFIG_MACH_LOONGSON1 is not set -# CONFIG_MACH_NO_WESTBRIDGE is not set -# CONFIG_MACH_TX39XX is not set -# CONFIG_MACH_TX49XX is not set -# CONFIG_MACH_VR41XX is not set -# CONFIG_MACINTOSH_DRIVERS is not set -# CONFIG_MACVLAN is not set -# CONFIG_MACVTAP is not set -# CONFIG_MAC_EMUMOUSEBTN is not set -# CONFIG_MAC_PARTITION is not set -# CONFIG_MAG3110 is not set -# CONFIG_MAGIC_SYSRQ is not set -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 -# CONFIG_MAILBOX is not set -# CONFIG_MANGLE_BOOTARGS is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_MAX1027 is not set -# CONFIG_MAX1363 is not set -# CONFIG_MAX517 is not set -# CONFIG_MAX5821 is not set -# CONFIG_MAX63XX_WATCHDOG is not set -# CONFIG_MCB is not set -# CONFIG_MCP320X is not set -# CONFIG_MCP3422 is not set -# CONFIG_MCP4725 is not set -# CONFIG_MCP4922 is not set -# CONFIG_MCPM is not set -# CONFIG_MD is not set -# CONFIG_MDIO_BCM_UNIMAC is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MD_FAULTY is not set -# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set -# CONFIG_MEDIA_ATTACH is not set -# CONFIG_MEDIA_CAMERA_SUPPORT is not set -# CONFIG_MEDIA_CONTROLLER is not set -# CONFIG_MEDIA_DIGITAL_TV_SUPPORT is not set -# CONFIG_MEDIA_PARPORT_SUPPORT is not set -# CONFIG_MEDIA_PCI_SUPPORT is not set -# CONFIG_MEDIA_RADIO_SUPPORT is not set -# CONFIG_MEDIA_RC_SUPPORT is not set -# CONFIG_MEDIA_SDR_SUPPORT is not set -# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -# CONFIG_MEDIA_SUPPORT is not set -# CONFIG_MEDIA_TUNER_CUSTOMISE is not set -# CONFIG_MEDIA_USB_SUPPORT is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_MEMORY is not set -# CONFIG_MEMORY_FAILURE is not set -# CONFIG_MEMSTICK is not set -# CONFIG_MEN_A21_WDT is not set -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_MFD_AXP20X is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_CS5535 is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MC13783 is not set -# CONFIG_MFD_MC13XXX is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_MFD_OMAP_USB_HOST is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_PM8921_CORE is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_RK808 is not set -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RTSX_USB is not set -# CONFIG_MFD_S5M_CORE is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_MFD_STMPE is not set -CONFIG_MFD_SUPPORT=y -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -# CONFIG_MFD_TIMBERDALE is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TPS65218 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_WM831X is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_MG_DISK is not set -# CONFIG_MICREL_KS8995MA is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_MIGRATION is not set -CONFIG_MII=y -# CONFIG_MIKROTIK_RB532 is not set -# CONFIG_MINIX_FS is not set -# CONFIG_MINIX_FS_NATIVE_ENDIAN is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_MIPS_ALCHEMY is not set -# CONFIG_MIPS_COBALT is not set -# CONFIG_MIPS_FPU_EMULATOR is not set -# CONFIG_MIPS_MALTA is not set -# CONFIG_MIPS_O32_FP64_SUPPORT is not set -# CONFIG_MIPS_PARAVIRT is not set -# CONFIG_MIPS_SEAD3 is not set -# CONFIG_MIPS_SIM is not set -CONFIG_MISC_DEVICES=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_MISDN is not set -# CONFIG_MISDN_AVMFRITZ is not set -# CONFIG_MISDN_HFCPCI is not set -# CONFIG_MISDN_HFCUSB is not set -# CONFIG_MISDN_INFINEON is not set -# CONFIG_MISDN_NETJET is not set -# CONFIG_MISDN_SPEEDFAX is not set -# CONFIG_MISDN_W6692 is not set -# CONFIG_MKISS is not set -# CONFIG_MLX4_CORE is not set -# CONFIG_MLX4_EN is not set -# CONFIG_MLX5_CORE is not set -# CONFIG_MLX90614 is not set -# CONFIG_MMA8452 is not set -# CONFIG_MMC is not set -# CONFIG_MMC_ARMMMCI is not set -# CONFIG_MMC_AU1X is not set -# CONFIG_MMC_BLOCK is not set -CONFIG_MMC_BLOCK_BOUNCE=y -CONFIG_MMC_BLOCK_MINORS=8 -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_CLKGATE is not set -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_MVSDIO is not set -# CONFIG_MMC_S3C is not set -# CONFIG_MMC_SDHCI is not set -# CONFIG_MMC_SDHCI_ACPI is not set -# CONFIG_MMC_SDHCI_BCM_KONA is not set -# CONFIG_MMC_SDHCI_MSM is not set -# CONFIG_MMC_SDHCI_OF_ARASAN is not set -# CONFIG_MMC_SDHCI_OF_ESDHC is not set -# CONFIG_MMC_SDHCI_OF_HLWD is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDRICOH_CS is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_TEST is not set -# CONFIG_MMC_UNSAFE_RESUME is not set -# CONFIG_MMC_USDHI6ROL0 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMIOTRACE is not set -CONFIG_MMU=y -CONFIG_MODULES=y -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_MODULE_FORCE_LOAD is not set -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -CONFIG_MODULE_STRIPPED=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_GPIO is not set -# CONFIG_MOUSE_INPORT is not set -# CONFIG_MOUSE_LOGIBM is not set -# CONFIG_MOUSE_PC110PAD is not set -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -# CONFIG_MPL115 is not set -# CONFIG_MPL3115 is not set -# CONFIG_MSDOS_FS is not set -CONFIG_MSDOS_PARTITION=y -# CONFIG_MSI_BITMAP_SELFTEST is not set -# CONFIG_MSI_LAPTOP is not set -CONFIG_MTD=y -# CONFIG_MTD_ABSENT is not set -# CONFIG_MTD_AFS_PARTS is not set -# CONFIG_MTD_ALAUDA is not set -# CONFIG_MTD_AR7_PARTS is not set -# CONFIG_MTD_ARM_INTEGRATOR is not set -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_MTD_BLOCK2MTD is not set -CONFIG_MTD_CFI=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_CFI_AMDSTD=y -# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -CONFIG_MTD_CFI_INTELEXT=y -# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set -CONFIG_MTD_CFI_NOSWAP=y -# CONFIG_MTD_CFI_STAA is not set -CONFIG_MTD_CFI_UTIL=y -CONFIG_MTD_CHAR=y -# CONFIG_MTD_CMDLINE_PARTS is not set -CONFIG_MTD_COMPLEX_MAPPINGS=y -# CONFIG_MTD_DATAFLASH is not set -# CONFIG_MTD_DEBUG is not set -# CONFIG_MTD_DOC2000 is not set -# CONFIG_MTD_DOC2001 is not set -# CONFIG_MTD_DOC2001PLUS is not set -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_GPIO_ADDR is not set -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_JEDECPROBE is not set -# CONFIG_MTD_LATCH_ADDR is not set -# CONFIG_MTD_LPDDR is not set -# CONFIG_MTD_LPDDR2_NVM is not set -# CONFIG_MTD_M25P80 is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -CONFIG_MTD_MAP_BANK_WIDTH_2=y -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_MYLOADER_PARTS is not set -# CONFIG_MTD_NAND is not set -# CONFIG_MTD_NAND_AMS_DELTA is not set -# CONFIG_MTD_NAND_AR934X is not set -# CONFIG_MTD_NAND_AR934X_HW_ECC is not set -# CONFIG_MTD_NAND_ATMEL is not set -# CONFIG_MTD_NAND_AU1550 is not set -# CONFIG_MTD_NAND_AUTCPU12 is not set -# CONFIG_MTD_NAND_BCH is not set -# CONFIG_MTD_NAND_BCM_UMI is not set -# CONFIG_MTD_NAND_BF5XX is not set -# CONFIG_MTD_NAND_CAFE is not set -# CONFIG_MTD_NAND_CM_X270 is not set -# CONFIG_MTD_NAND_CS553X is not set -# CONFIG_MTD_NAND_DAVINCI is not set -# CONFIG_MTD_NAND_DENALI is not set -CONFIG_MTD_NAND_DENALI_SCRATCH_REG_ADDR=0xff108018 -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_ECC is not set -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_NAND_ECC_SMC is not set -# CONFIG_MTD_NAND_FSL_ELBC is not set -# CONFIG_MTD_NAND_FSL_IFC is not set -# CONFIG_MTD_NAND_FSL_UPM is not set -# CONFIG_MTD_NAND_FSMC is not set -# CONFIG_MTD_NAND_GPIO is not set -# CONFIG_MTD_NAND_GPMI_NAND is not set -# CONFIG_MTD_NAND_H1900 is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_JZ4740 is not set -# CONFIG_MTD_NAND_MPC5121_NFC is not set -# CONFIG_MTD_NAND_MUSEUM_IDS is not set -# CONFIG_MTD_NAND_MXC is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_NDFC is not set -# CONFIG_MTD_NAND_NOMADIK is not set -# CONFIG_MTD_NAND_NUC900 is not set -# CONFIG_MTD_NAND_OMAP2 is not set -# CONFIG_MTD_NAND_OMAP_BCH_BUILD is not set -# CONFIG_MTD_NAND_ORION is not set -# CONFIG_MTD_NAND_PASEMI is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_NAND_PPCHAMELEONEVB is not set -# CONFIG_MTD_NAND_PXA3xx is not set -# CONFIG_MTD_NAND_RB4XX is not set -# CONFIG_MTD_NAND_RB750 is not set -# CONFIG_MTD_NAND_RICOH is not set -# CONFIG_MTD_NAND_RTC_FROM4 is not set -# CONFIG_MTD_NAND_S3C2410 is not set -# CONFIG_MTD_NAND_SHARPSL is not set -# CONFIG_MTD_NAND_SH_FLCTL is not set -# CONFIG_MTD_NAND_SOCRATES is not set -# CONFIG_MTD_NAND_SPIA is not set -# CONFIG_MTD_NAND_TMIO is not set -# CONFIG_MTD_NAND_TXX9NDFMC is not set -# CONFIG_MTD_NAND_VERIFY_WRITE is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_ONENAND is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_OTP is not set -# CONFIG_MTD_PCI is not set -# CONFIG_MTD_PCMCIA is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PHYSMAP_COMPAT is not set -CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_MTD_PLATRAM is not set -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_RAM is not set -CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 -# CONFIG_MTD_REDBOOT_PARTS is not set -# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set -# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set -# CONFIG_MTD_ROM is not set -CONFIG_MTD_ROOTFS_ROOT_DEV=y -CONFIG_MTD_ROOTFS_SPLIT=y -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_MTD_SPI_NOR is not set -# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set -CONFIG_MTD_SPLIT=y -# CONFIG_MTD_SPLIT_BRNIMAGE_FW is not set -# CONFIG_MTD_SPLIT_EVA_FW is not set -# CONFIG_MTD_SPLIT_FIRMWARE is not set -CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" -# CONFIG_MTD_SPLIT_FIT_FW is not set -# CONFIG_MTD_SPLIT_JIMAGE_FW is not set -# CONFIG_MTD_SPLIT_LZMA_FW is not set -# CONFIG_MTD_SPLIT_MINOR_FW is not set -# CONFIG_MTD_SPLIT_SEAMA_FW is not set -CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y -CONFIG_MTD_SPLIT_SUPPORT=y -# CONFIG_MTD_SPLIT_TPLINK_FW is not set -# CONFIG_MTD_SPLIT_TRX_FW is not set -# CONFIG_MTD_SPLIT_UIMAGE_FW is not set -# CONFIG_MTD_SPLIT_WRGG_FW is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SWAP is not set -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_UBI is not set -# CONFIG_MTD_UIMAGE_SPLIT is not set -# CONFIG_MUTEX_SPIN_ON_OWNER is not set -# CONFIG_MV643XX_ETH is not set -# CONFIG_MVMDIO is not set -# CONFIG_MVSW6171_PHY is not set -# CONFIG_MVSW61XX_PHY is not set -# CONFIG_MVSWITCH_PHY is not set -# CONFIG_MWAVE is not set -# CONFIG_MWIFIEX is not set -# CONFIG_MWL8K is not set -# CONFIG_MYRI10GE is not set -# CONFIG_NAMESPACES is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_NATSEMI is not set -# CONFIG_NAU7802 is not set -# CONFIG_NBPFAXI_DMA is not set -# CONFIG_NCP_FS is not set -# CONFIG_NE2000 is not set -# CONFIG_NE2K_PCI is not set -# CONFIG_NEC_MARKEINS is not set -CONFIG_NET=y -# CONFIG_NETCONSOLE is not set -CONFIG_NETDEVICES=y -CONFIG_NETDEV_1000=y -# CONFIG_NETDEV_10000 is not set -# CONFIG_NETFILTER is not set -# CONFIG_NETFILTER_ADVANCED is not set -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_NETFILTER_NETLINK is not set -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_LOG is not set -# CONFIG_NETFILTER_NETLINK_QUEUE is not set -# CONFIG_NETFILTER_NETLINK_QUEUE_CT is not set -# CONFIG_NETFILTER_TPROXY is not set -# CONFIG_NETFILTER_XTABLES is not set -# CONFIG_NETFILTER_XT_CONNMARK is not set -# CONFIG_NETFILTER_XT_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_BPF is not set -# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set -# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set -# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set -# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set -# CONFIG_NETFILTER_XT_MATCH_CPU is not set -# CONFIG_NETFILTER_XT_MATCH_DCCP is not set -# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set -# CONFIG_NETFILTER_XT_MATCH_DSCP is not set -# CONFIG_NETFILTER_XT_MATCH_ECN is not set -# CONFIG_NETFILTER_XT_MATCH_ESP is not set -# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_HELPER is not set -# CONFIG_NETFILTER_XT_MATCH_HL is not set -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set -# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set -# CONFIG_NETFILTER_XT_MATCH_LAYER7 is not set -# CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG is not set -# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set -# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set -# CONFIG_NETFILTER_XT_MATCH_MAC is not set -# CONFIG_NETFILTER_XT_MATCH_MARK is not set -# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set -# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set -# CONFIG_NETFILTER_XT_MATCH_OSF is not set -# CONFIG_NETFILTER_XT_MATCH_OWNER is not set -# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set -# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set -# CONFIG_NETFILTER_XT_MATCH_POLICY is not set -# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set -# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set -# CONFIG_NETFILTER_XT_MATCH_REALM is not set -# CONFIG_NETFILTER_XT_MATCH_RECENT is not set -# CONFIG_NETFILTER_XT_MATCH_SCTP is not set -# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set -# CONFIG_NETFILTER_XT_MATCH_STATE is not set -# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set -# CONFIG_NETFILTER_XT_MATCH_STRING is not set -# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set -# CONFIG_NETFILTER_XT_MATCH_TIME is not set -# CONFIG_NETFILTER_XT_MATCH_U32 is not set -# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set -# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set -# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set -# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set -# CONFIG_NETFILTER_XT_TARGET_CT is not set -# CONFIG_NETFILTER_XT_TARGET_DSCP is not set -# CONFIG_NETFILTER_XT_TARGET_HL is not set -# CONFIG_NETFILTER_XT_TARGET_HMARK is not set -# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set -# CONFIG_NETFILTER_XT_TARGET_LED is not set -# CONFIG_NETFILTER_XT_TARGET_LOG is not set -# CONFIG_NETFILTER_XT_TARGET_MARK is not set -# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set -# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set -# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set -# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set -# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set -# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set -# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set -# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set -# CONFIG_NETFILTER_XT_TARGET_TEE is not set -# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set -# CONFIG_NETFILTER_XT_TARGET_TRACE is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETPOLL is not set -# CONFIG_NETROM is not set -CONFIG_NETWORK_FILESYSTEMS=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETXEN_NIC is not set -# CONFIG_NET_9P is not set -# CONFIG_NET_ACT_CSUM is not set -# CONFIG_NET_ACT_GACT is not set -# CONFIG_NET_ACT_IPT is not set -# CONFIG_NET_ACT_MIRRED is not set -# CONFIG_NET_ACT_NAT is not set -# CONFIG_NET_ACT_PEDIT is not set -# CONFIG_NET_ACT_POLICE is not set -# CONFIG_NET_ACT_SIMP is not set -# CONFIG_NET_ACT_SKBEDIT is not set -CONFIG_NET_CADENCE=y -# CONFIG_NET_CALXEDA_XGMAC is not set -CONFIG_NET_CLS=y -# CONFIG_NET_CLS_ACT is not set -# CONFIG_NET_CLS_BASIC is not set -# CONFIG_NET_CLS_BPF is not set -# CONFIG_NET_CLS_FLOW is not set -# CONFIG_NET_CLS_FW is not set -CONFIG_NET_CLS_IND=y -# CONFIG_NET_CLS_ROUTE4 is not set -# CONFIG_NET_CLS_RSVP is not set -# CONFIG_NET_CLS_RSVP6 is not set -# CONFIG_NET_CLS_TCINDEX is not set -# CONFIG_NET_CLS_U32 is not set -CONFIG_NET_CORE=y -# CONFIG_NET_DROP_MONITOR is not set -# CONFIG_NET_DSA is not set -# CONFIG_NET_DSA_BCM_SF2 is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6171 is not set -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_TAG_DSA is not set -# CONFIG_NET_DSA_TAG_EDSA is not set -# CONFIG_NET_EMATCH is not set -# CONFIG_NET_EMATCH_CMP is not set -# CONFIG_NET_EMATCH_META is not set -# CONFIG_NET_EMATCH_NBYTE is not set -CONFIG_NET_EMATCH_STACK=32 -# CONFIG_NET_EMATCH_TEXT is not set -# CONFIG_NET_EMATCH_U32 is not set -CONFIG_NET_ETHERNET=y -# CONFIG_NET_FC is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_IPGRE is not set -CONFIG_NET_IPGRE_BROADCAST=y -# CONFIG_NET_IPGRE_DEMUX is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPVTI is not set -# CONFIG_NET_IP_TUNNEL is not set -# CONFIG_NET_ISA is not set -# CONFIG_NET_KEY is not set -# CONFIG_NET_KEY_MIGRATE is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_NET_PACKET_ENGINE is not set -CONFIG_NET_PCI=y -# CONFIG_NET_PCMCIA is not set -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_POCKET is not set -# CONFIG_NET_POLL_CONTROLLER is not set -# CONFIG_NET_PTP_CLASSIFY is not set -CONFIG_NET_RX_BUSY_POLL=y -# CONFIG_NET_SB1000 is not set -CONFIG_NET_SCHED=y -# CONFIG_NET_SCH_ATM is not set -# CONFIG_NET_SCH_CBQ is not set -# CONFIG_NET_SCH_CHOKE is not set -# CONFIG_NET_SCH_CODEL is not set -# CONFIG_NET_SCH_DRR is not set -# CONFIG_NET_SCH_DSMARK is not set -CONFIG_NET_SCH_FIFO=y -# CONFIG_NET_SCH_FQ is not set -CONFIG_NET_SCH_FQ_CODEL=y -# CONFIG_NET_SCH_GRED is not set -# CONFIG_NET_SCH_HFSC is not set -# CONFIG_NET_SCH_HHF is not set -# CONFIG_NET_SCH_HTB is not set -# CONFIG_NET_SCH_INGRESS is not set -# CONFIG_NET_SCH_MQPRIO is not set -# CONFIG_NET_SCH_MULTIQ is not set -# CONFIG_NET_SCH_NETEM is not set -# CONFIG_NET_SCH_PIE is not set -# CONFIG_NET_SCH_PLUG is not set -# CONFIG_NET_SCH_PRIO is not set -# CONFIG_NET_SCH_QFQ is not set -# CONFIG_NET_SCH_RED is not set -# CONFIG_NET_SCH_SFB is not set -# CONFIG_NET_SCH_SFQ is not set -# CONFIG_NET_SCH_TBF is not set -# CONFIG_NET_SCH_TEQL is not set -# CONFIG_NET_SCTPPROBE is not set -# CONFIG_NET_TCPPROBE is not set -# CONFIG_NET_TEAM is not set -# CONFIG_NET_TULIP is not set -# CONFIG_NET_UDP_TUNNEL is not set -CONFIG_NET_VENDOR_3COM=y -CONFIG_NET_VENDOR_8390=y -CONFIG_NET_VENDOR_ADAPTEC=y -CONFIG_NET_VENDOR_AGERE=y -CONFIG_NET_VENDOR_ALTEON=y -CONFIG_NET_VENDOR_AMD=y -CONFIG_NET_VENDOR_ARC=y -CONFIG_NET_VENDOR_ATHEROS=y -CONFIG_NET_VENDOR_BROADCOM=y -CONFIG_NET_VENDOR_BROCADE=y -CONFIG_NET_VENDOR_CHELSIO=y -CONFIG_NET_VENDOR_CIRRUS=y -CONFIG_NET_VENDOR_CISCO=y -CONFIG_NET_VENDOR_DEC=y -CONFIG_NET_VENDOR_DLINK=y -CONFIG_NET_VENDOR_EMULEX=y -CONFIG_NET_VENDOR_EXAR=y -CONFIG_NET_VENDOR_FARADAY=y -CONFIG_NET_VENDOR_FREESCALE=y -CONFIG_NET_VENDOR_FUJITSU=y -CONFIG_NET_VENDOR_HISILICON=y -CONFIG_NET_VENDOR_HP=y -CONFIG_NET_VENDOR_I825XX=y -CONFIG_NET_VENDOR_IBM=y -CONFIG_NET_VENDOR_INTEL=y -CONFIG_NET_VENDOR_MARVELL=y -CONFIG_NET_VENDOR_MELLANOX=y -CONFIG_NET_VENDOR_MICREL=y -CONFIG_NET_VENDOR_MICROCHIP=y -CONFIG_NET_VENDOR_MYRI=y -CONFIG_NET_VENDOR_NATSEMI=y -CONFIG_NET_VENDOR_NVIDIA=y -CONFIG_NET_VENDOR_OKI=y -CONFIG_NET_VENDOR_QLOGIC=y -CONFIG_NET_VENDOR_QUALCOMM=y -CONFIG_NET_VENDOR_RDC=y -CONFIG_NET_VENDOR_REALTEK=y -CONFIG_NET_VENDOR_SAMSUNG=y -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -CONFIG_NET_VENDOR_SILICOM=y -CONFIG_NET_VENDOR_SIS=y -CONFIG_NET_VENDOR_SMSC=y -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_NET_VENDOR_SUN=y -CONFIG_NET_VENDOR_TEHUTI=y -CONFIG_NET_VENDOR_TI=y -CONFIG_NET_VENDOR_TOSHIBA=y -CONFIG_NET_VENDOR_VIA=y -# CONFIG_NET_VENDOR_WIZNET is not set -CONFIG_NET_VENDOR_XILINX=y -CONFIG_NET_VENDOR_XIRCOM=y -# CONFIG_NET_XGENE is not set -CONFIG_NEW_LEDS=y -# CONFIG_NFC is not set -# CONFIG_NFC_DEVICES is not set -# CONFIG_NFSD is not set -# CONFIG_NFSD_DEPRECATED is not set -# CONFIG_NFSD_V2_ACL is not set -CONFIG_NFSD_V3=y -# CONFIG_NFSD_V3_ACL is not set -# CONFIG_NFSD_V4 is not set -# CONFIG_NFS_ACL_SUPPORT is not set -CONFIG_NFS_COMMON=y -# CONFIG_NFS_FS is not set -# CONFIG_NFS_FSCACHE is not set -# CONFIG_NFS_SWAP is not set -# CONFIG_NFS_V2 is not set -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -# CONFIG_NFS_V4 is not set -# CONFIG_NFS_V4_1 is not set -# CONFIG_NFTL is not set -# CONFIG_NF_CONNTRACK is not set -# CONFIG_NF_CONNTRACK_AMANDA is not set -# CONFIG_NF_CONNTRACK_EVENTS is not set -# CONFIG_NF_CONNTRACK_FTP is not set -# CONFIG_NF_CONNTRACK_H323 is not set -# CONFIG_NF_CONNTRACK_IPV4 is not set -# CONFIG_NF_CONNTRACK_IPV6 is not set -# CONFIG_NF_CONNTRACK_IRC is not set -# CONFIG_NF_CONNTRACK_MARK is not set -# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set -# CONFIG_NF_CONNTRACK_PPTP is not set -CONFIG_NF_CONNTRACK_PROCFS=y -# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set -# CONFIG_NF_CONNTRACK_RTSP is not set -# CONFIG_NF_CONNTRACK_SANE is not set -# CONFIG_NF_CONNTRACK_SIP is not set -# CONFIG_NF_CONNTRACK_SNMP is not set -# CONFIG_NF_CONNTRACK_TFTP is not set -# CONFIG_NF_CONNTRACK_TIMEOUT is not set -# CONFIG_NF_CONNTRACK_TIMESTAMP is not set -# CONFIG_NF_CONNTRACK_ZONES is not set -# CONFIG_NF_CT_NETLINK is not set -# CONFIG_NF_CT_NETLINK_TIMEOUT is not set -# CONFIG_NF_CT_PROTO_DCCP is not set -# CONFIG_NF_CT_PROTO_GRE is not set -# CONFIG_NF_CT_PROTO_SCTP is not set -# CONFIG_NF_CT_PROTO_UDPLITE is not set -# CONFIG_NF_DEFRAG_IPV4 is not set -# CONFIG_NF_LOG_ARP is not set -# CONFIG_NF_LOG_IPV4 is not set -# CONFIG_NF_NAT is not set -# CONFIG_NF_NAT_AMANDA is not set -# CONFIG_NF_NAT_FTP is not set -# CONFIG_NF_NAT_H323 is not set -# CONFIG_NF_NAT_IPV6 is not set -# CONFIG_NF_NAT_IRC is not set -# CONFIG_NF_NAT_MASQUERADE_IPV4 is not set -# CONFIG_NF_NAT_MASQUERADE_IPV6 is not set -# CONFIG_NF_NAT_NEEDED is not set -# CONFIG_NF_NAT_PPTP is not set -# CONFIG_NF_NAT_PROTO_GRE is not set -# CONFIG_NF_NAT_RTSP is not set -# CONFIG_NF_NAT_SIP is not set -# CONFIG_NF_NAT_SNMP_BASIC is not set -# CONFIG_NF_NAT_TFTP is not set -# CONFIG_NF_REJECT_IPV4 is not set -# CONFIG_NF_REJECT_IPV6 is not set -# CONFIG_NF_TABLES is not set -# CONFIG_NI52 is not set -# CONFIG_NI65 is not set -# CONFIG_NILFS2_FS is not set -# CONFIG_NIU is not set -# CONFIG_NL80211_TESTMODE is not set -CONFIG_NLATTR=y -# CONFIG_NLMON is not set -# CONFIG_NLM_XLP_BOARD is not set -# CONFIG_NLM_XLR_BOARD is not set -# CONFIG_NLS is not set -# CONFIG_NLS_ASCII is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_CODEPAGE_437 is not set -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -CONFIG_NLS_DEFAULT="iso8859-1" -# CONFIG_NLS_ISO8859_1 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -# CONFIG_NLS_UTF8 is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_NORTEL_HERMES is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_NOZOMI is not set -# CONFIG_NO_BOOTMEM is not set -# CONFIG_NO_HZ is not set -# CONFIG_NO_HZ_FULL is not set -# CONFIG_NO_HZ_IDLE is not set -# CONFIG_NO_IOPORT is not set -# CONFIG_NS83820 is not set -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_FS is not set -# CONFIG_NTFS_RW is not set -# CONFIG_NTP_PPS is not set -# CONFIG_NVRAM is not set -# CONFIG_NV_TCO is not set -# CONFIG_NXP_STB220 is not set -# CONFIG_NXP_STB225 is not set -# CONFIG_N_GSM is not set -# CONFIG_OABI_COMPAT is not set -# CONFIG_OBS600 is not set -# CONFIG_OCFS2_FS is not set -# CONFIG_OC_ETM is not set -# CONFIG_OF_SELFTEST is not set -# CONFIG_OMAP2_DSS_DEBUG is not set -# CONFIG_OMAP2_DSS_DEBUGFS is not set -# CONFIG_OMAP2_DSS_SDI is not set -# CONFIG_OMAP_CONTROL_USB is not set -# CONFIG_OMAP_OCP2SCP is not set -# CONFIG_OMAP_USB2 is not set -# CONFIG_OMAP_USB3 is not set -# CONFIG_OMFS_FS is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_OPROFILE is not set -# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set -# CONFIG_ORION_WATCHDOG is not set -# CONFIG_OSF_PARTITION is not set -CONFIG_OVERLAY_FS=y -# CONFIG_P54_COMMON is not set -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_PAGE_SIZE_16KB is not set -# CONFIG_PAGE_SIZE_32KB is not set -CONFIG_PAGE_SIZE_4KB=y -# CONFIG_PAGE_SIZE_64KB is not set -# CONFIG_PAGE_SIZE_8KB is not set -# CONFIG_PANEL is not set -CONFIG_PANIC_ON_OOPS=y -CONFIG_PANIC_ON_OOPS_VALUE=1 -CONFIG_PANIC_TIMEOUT=1 -# CONFIG_PANTHERLORD_FF is not set -# CONFIG_PARPORT is not set -# CONFIG_PARPORT_1284 is not set -# CONFIG_PARPORT_AX88796 is not set -# CONFIG_PARPORT_PC is not set -CONFIG_PARTITION_ADVANCED=y -# CONFIG_PATA_ALI is not set -# CONFIG_PATA_AMD is not set -# CONFIG_PATA_ARASAN_CF is not set -# CONFIG_PATA_ARTOP is not set -# CONFIG_PATA_ATIIXP is not set -# CONFIG_PATA_ATP867X is not set -# CONFIG_PATA_CMD640_PCI is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CS5520 is not set -# CONFIG_PATA_CS5530 is not set -# CONFIG_PATA_CS5535 is not set -# CONFIG_PATA_CS5536 is not set -# CONFIG_PATA_CYPRESS is not set -# CONFIG_PATA_EFAR is not set -# CONFIG_PATA_HPT366 is not set -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_ISAPNP is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_LEGACY is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OCTEON_CF is not set -# CONFIG_PATA_OF_PLATFORM is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PCMCIA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_QDI is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_RZ1000 is not set -# CONFIG_PATA_SC1200 is not set -# CONFIG_PATA_SCH is not set -# CONFIG_PATA_SERVERWORKS is not set -# CONFIG_PATA_SIL680 is not set -# CONFIG_PATA_SIS is not set -# CONFIG_PATA_TOSHIBA is not set -# CONFIG_PATA_TRIFLEX is not set -# CONFIG_PATA_VIA is not set -# CONFIG_PATA_WINBOND is not set -# CONFIG_PATA_WINBOND_VLB is not set -# CONFIG_PC300TOO is not set -# CONFIG_PCCARD is not set -# CONFIG_PCH_GBE is not set -# CONFIG_PCH_PHUB is not set -# CONFIG_PCI200SYN is not set -# CONFIG_PCIEAER_INJECT is not set -# CONFIG_PCIEASPM is not set -# CONFIG_PCIEPORTBUS is not set -# CONFIG_PCIE_ECRC is not set -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_PCI_ATMEL is not set -# CONFIG_PCI_CNB20LE_QUIRK is not set -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_DISABLE_COMMON_QUIRKS is not set -# CONFIG_PCI_HERMES is not set -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_MSI is not set -# CONFIG_PCI_PASID is not set -# CONFIG_PCI_PRI is not set -CONFIG_PCI_QUIRKS=y -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -CONFIG_PCI_SYSCALL=y -# CONFIG_PCMCIA is not set -# CONFIG_PCMCIA_3C574 is not set -# CONFIG_PCMCIA_3C589 is not set -# CONFIG_PCMCIA_AHA152X is not set -# CONFIG_PCMCIA_ATMEL is not set -# CONFIG_PCMCIA_AXNET is not set -# CONFIG_PCMCIA_DEBUG is not set -# CONFIG_PCMCIA_FDOMAIN is not set -# CONFIG_PCMCIA_FMVJ18X is not set -# CONFIG_PCMCIA_HERMES is not set -# CONFIG_PCMCIA_LOAD_CIS is not set -# CONFIG_PCMCIA_NINJA_SCSI is not set -# CONFIG_PCMCIA_NMCLAN is not set -# CONFIG_PCMCIA_PCNET is not set -# CONFIG_PCMCIA_QLOGIC is not set -# CONFIG_PCMCIA_RAYCS is not set -# CONFIG_PCMCIA_SMC91C92 is not set -# CONFIG_PCMCIA_SPECTRUM is not set -# CONFIG_PCMCIA_SYM53C500 is not set -# CONFIG_PCMCIA_WL3501 is not set -# CONFIG_PCMCIA_XIRC2PS is not set -# CONFIG_PCMCIA_XIRCOM is not set -# CONFIG_PCNET32 is not set -# CONFIG_PCSPKR_PLATFORM is not set -# CONFIG_PD6729 is not set -# CONFIG_PDA_POWER is not set -# CONFIG_PDC_ADMA is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_PERF_COUNTERS is not set -# CONFIG_PERF_EVENTS is not set -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_PHANTOM is not set -# CONFIG_PHONE is not set -# CONFIG_PHONET is not set -# CONFIG_PHYLIB is not set -# CONFIG_PHYS_ADDR_T_64BIT is not set -# CONFIG_PHY_EXYNOS_DP_VIDEO is not set -# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set -# CONFIG_PHY_QCOM_DWC3 is not set -# CONFIG_PHY_SAMSUNG_USB2 is not set -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_PID_NS is not set -CONFIG_PINCONF=y -# CONFIG_PINCTRL is not set -# CONFIG_PINCTRL_CAPRI is not set -# CONFIG_PINCTRL_EXYNOS is not set -# CONFIG_PINCTRL_EXYNOS5440 is not set -# CONFIG_PINCTRL_MSM8X74 is not set -CONFIG_PINCTRL_SINGLE=y -CONFIG_PINMUX=y -# CONFIG_PLAT_SPEAR is not set -# CONFIG_PLIP is not set -# CONFIG_PLX_HERMES is not set -# CONFIG_PM is not set -# CONFIG_PMBUS is not set -# CONFIG_PMC_MSP is not set -# CONFIG_PMC_YOSEMITE is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_DEVFREQ is not set -# CONFIG_PM_RUNTIME is not set -# CONFIG_PM_WAKELOCKS is not set -# CONFIG_PNX8550_JBS is not set -# CONFIG_PNX8550_STB810 is not set -# CONFIG_POHMELFS is not set -# CONFIG_POSIX_MQUEUE is not set -# CONFIG_POWERCAP is not set -# CONFIG_POWERTV is not set -# CONFIG_POWER_AVS is not set -# CONFIG_POWER_RESET is not set -# CONFIG_POWER_RESET_RESTART is not set -# CONFIG_POWER_RESET_VERSATILE is not set -# CONFIG_POWER_SUPPLY is not set -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PPC4xx_GPIO is not set -# CONFIG_PPC_16K_PAGES is not set -# CONFIG_PPC_256K_PAGES is not set -CONFIG_PPC_4K_PAGES=y -# CONFIG_PPC_64K_PAGES is not set -# CONFIG_PPC_DISABLE_WERROR is not set -# CONFIG_PPC_EMULATED_STATS is not set -# CONFIG_PPC_EPAPR_HV_BYTECHAN is not set -# CONFIG_PPP is not set -# CONFIG_PPPOATM is not set -# CONFIG_PPPOE is not set -# CONFIG_PPPOL2TP is not set -# CONFIG_PPP_ASYNC is not set -# CONFIG_PPP_BSDCOMP is not set -# CONFIG_PPP_DEFLATE is not set -CONFIG_PPP_FILTER=y -# CONFIG_PPP_MPPE is not set -CONFIG_PPP_MULTILINK=y -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPS is not set -# CONFIG_PPS_CLIENT_GPIO is not set -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_PARPORT is not set -# CONFIG_PPS_DEBUG is not set -# CONFIG_PPTP is not set -# CONFIG_PREEMPT is not set -CONFIG_PREEMPT_NONE=y -# CONFIG_PREEMPT_TRACER is not set -# CONFIG_PREEMPT_VOLUNTARY is not set -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_PRINTK=y -# CONFIG_PRINTK_TIME is not set -CONFIG_PRINT_STACK_DEPTH=64 -# CONFIG_PRISM2_USB is not set -# CONFIG_PRISM54 is not set -# CONFIG_PROBE_INITRD_HEADER is not set -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -# CONFIG_PROC_PAGE_MONITOR is not set -CONFIG_PROC_STRIPPED=y -CONFIG_PROC_SYSCTL=y -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILING is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_PROVE_RCU is not set -# CONFIG_PROVE_RCU_DELAY is not set -# CONFIG_PSB6970_PHY is not set -# CONFIG_PSTORE is not set -# CONFIG_PTP_1588_CLOCK is not set -# CONFIG_PTP_1588_CLOCK_IXP46X is not set -# CONFIG_PTP_1588_CLOCK_PCH is not set -# CONFIG_PWM is not set -# CONFIG_PWM_PCA9685 is not set -# CONFIG_QCA7000 is not set -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -# CONFIG_QUOTA_DEBUG is not set -# CONFIG_R3964 is not set -# CONFIG_R6040 is not set -# CONFIG_R8169 is not set -# CONFIG_R8187SE is not set -# CONFIG_R8188EU is not set -# CONFIG_R8712U is not set -# CONFIG_R8723AU is not set -# CONFIG_RADIO_ADAPTERS is not set -# CONFIG_RADIO_AZTECH is not set -# CONFIG_RADIO_CADET is not set -# CONFIG_RADIO_GEMTEK is not set -# CONFIG_RADIO_MAXIRADIO is not set -# CONFIG_RADIO_RTRACK is not set -# CONFIG_RADIO_RTRACK2 is not set -# CONFIG_RADIO_SF16FMI is not set -# CONFIG_RADIO_SF16FMR2 is not set -# CONFIG_RADIO_TERRATEC is not set -# CONFIG_RADIO_TRUST is not set -# CONFIG_RADIO_TYPHOON is not set -# CONFIG_RADIO_ZOLTRIX is not set -# CONFIG_RAID_ATTRS is not set -# CONFIG_RALINK is not set -# CONFIG_RAMOOPS is not set -# CONFIG_RANDOM32_SELFTEST is not set -# CONFIG_RAPIDIO is not set -# CONFIG_RAR_REGISTER is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_RCU_CPU_STALL_INFO is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -CONFIG_RCU_FANOUT=32 -# CONFIG_RCU_FANOUT_EXACT is not set -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FAST_NO_HZ is not set -# CONFIG_RCU_NOCB_CPU is not set -# CONFIG_RCU_TORTURE_TEST is not set -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_USER_QS is not set -# CONFIG_RC_ATI_REMOTE is not set -# CONFIG_RC_CORE is not set -# CONFIG_RC_DECODERS is not set -# CONFIG_RC_LOOPBACK is not set -# CONFIG_RC_MAP is not set -# CONFIG_RDS is not set -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_GZIP is not set -# CONFIG_RD_LZ4 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_LZO is not set -# CONFIG_RD_XZ is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_REDWOOD is not set -# CONFIG_REGMAP is not set -# CONFIG_REGMAP_I2C is not set -# CONFIG_REGMAP_MMIO is not set -# CONFIG_REGMAP_SPI is not set -# CONFIG_REGULATOR is not set -# CONFIG_REGULATOR_ACT8865 is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_ANATOP is not set -# CONFIG_REGULATOR_BQ24022 is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_DA9211 is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_FIXED_VOLTAGE is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_ISL9305 is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_LTC3589 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -# CONFIG_REGULATOR_TI_ABB is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS6524X is not set -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REISERFS_CHECK is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_REISERFS_FS_POSIX_ACL is not set -# CONFIG_REISERFS_FS_SECURITY is not set -# CONFIG_REISERFS_FS_XATTR is not set -# CONFIG_REISERFS_PROC_INFO is not set -# CONFIG_RELAY is not set -# CONFIG_RESET_CONTROLLER is not set -# CONFIG_RFD_FTL is not set -# CONFIG_RFKILL is not set -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_ROSE is not set -# CONFIG_RPCSEC_GSS_KRB5 is not set -# CONFIG_RT2X00 is not set -# CONFIG_RTC_CLASS is not set -# CONFIG_RTC_DEBUG is not set -# CONFIG_RTC_DRV_AU1XXX is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_BQ4802 is not set -CONFIG_RTC_DRV_CMOS=y -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1343 is not set -# CONFIG_RTC_DRV_DS1347 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_EP93XX is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_GENERIC is not set -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -# CONFIG_RTC_DRV_HYM8563 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_MCP795 is not set -# CONFIG_RTC_DRV_MOXART is not set -# CONFIG_RTC_DRV_MPC5121 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_OMAP is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_PCF85063 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_PS3 is not set -# CONFIG_RTC_DRV_PT7C4338 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_RTC7301 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_SNVS is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_SUN6I is not set -# CONFIG_RTC_DRV_TEST is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_XGENE is not set -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_LIB=y -CONFIG_RTC_SYSTOHC=y -# CONFIG_RTL8180 is not set -# CONFIG_RTL8187 is not set -# CONFIG_RTL8192E is not set -# CONFIG_RTL8192U is not set -# CONFIG_RTL8306_PHY is not set -# CONFIG_RTL8366RB_PHY is not set -# CONFIG_RTL8366S_PHY is not set -# CONFIG_RTL8366_SMI is not set -# CONFIG_RTL8366_SMI_DEBUG_FS is not set -# CONFIG_RTL8367B_PHY is not set -# CONFIG_RTL8367_PHY is not set -# CONFIG_RTLLIB is not set -# CONFIG_RTL_CARDS is not set -# CONFIG_RTS5139 is not set -# CONFIG_RTS5208 is not set -# CONFIG_RTS_PSTOR is not set -CONFIG_RT_MUTEXES=y -# CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_RUNTIME_DEBUG is not set -CONFIG_RWSEM_GENERIC_SPINLOCK=y -# CONFIG_S2IO is not set -# CONFIG_SAMPLES is not set -# CONFIG_SAMSUNG_LAPTOP is not set -# CONFIG_SAMSUNG_USB2PHY is not set -# CONFIG_SAMSUNG_USB3PHY is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_AHCI is not set -# CONFIG_SATA_AHCI_PLATFORM is not set -# CONFIG_SATA_DWC is not set -# CONFIG_SATA_FSL is not set -# CONFIG_SATA_HIGHBANK is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_MV is not set -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PMP is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_RCAR is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIL24 is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_SX4 is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set -# CONFIG_SBC_FITPC2_WATCHDOG is not set -# CONFIG_SBE_2T3E3 is not set -# CONFIG_SBYPASS is not set -# CONFIG_SC92031 is not set -# CONFIG_SCA3000 is not set -# CONFIG_SCC is not set -# CONFIG_SCHEDSTATS is not set -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHED_MC is not set -CONFIG_SCHED_OMIT_FRAME_POINTER=y -# CONFIG_SCHED_SMT is not set -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_SCSI is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_7000FASST is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_AHA152X is not set -# CONFIG_SCSI_AHA1542 is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC7XXX_OLD is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_BFA_FC is not set -# CONFIG_SCSI_BNX2X_FCOE is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_CHELSIO_FCOE is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_DC390T is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_DH is not set -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_DPT_I2O is not set -# CONFIG_SCSI_DTC3280 is not set -# CONFIG_SCSI_EATA is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_GDTH is not set -# CONFIG_SCSI_GENERIC_NCR5380 is not set -# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_IN2000 is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_ISCI is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_LOGGING is not set -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_LPFC is not set -CONFIG_SCSI_MOD=y -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -CONFIG_SCSI_MULTI_LUN=y -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVSAS_DEBUG is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_NCR53C406A is not set -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -# CONFIG_SCSI_PAS16 is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_PMCRAID is not set -CONFIG_SCSI_PROC_FS=y -# CONFIG_SCSI_QLA_FC is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLOGIC_FAS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SCAN_ASYNC is not set -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_SRP is not set -# CONFIG_SCSI_SRP_ATTRS is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C416 is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_T128 is not set -# CONFIG_SCSI_TGT is not set -# CONFIG_SCSI_U14_34F is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_ULTRASTOR is not set -# CONFIG_SCSI_VIRTIO is not set -# CONFIG_SCx200_ACB is not set -# CONFIG_SDIO_UART is not set -# CONFIG_SECCOMP is not set -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -# CONFIG_SECURITY_DMESG_RESTRICT 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_JZ4740 is not set -# CONFIG_SENSORS_K10TEMP is not set -# CONFIG_SENSORS_K8TEMP is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_SENSORS_LIS3_I2C is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_TSL2563 is not set -# CONFIG_SENSORS_VEXPRESS is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VIA_CPUTEMP is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -CONFIG_SERIAL_8250=y -# CONFIG_SERIAL_8250_ACCENT is not set -# CONFIG_SERIAL_8250_BOCA is not set -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_CS is not set -# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set -# CONFIG_SERIAL_8250_DETECT_IRQ is not set -CONFIG_SERIAL_8250_DMA=y -# CONFIG_SERIAL_8250_DW is not set -# CONFIG_SERIAL_8250_EM is not set -# CONFIG_SERIAL_8250_EXAR_ST16C554 is not set -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SERIAL_8250_FINTEK is not set -# CONFIG_SERIAL_8250_FOURPORT is not set -# CONFIG_SERIAL_8250_HUB6 is not set -# CONFIG_SERIAL_8250_MANY_PORTS is not set -CONFIG_SERIAL_8250_NR_UARTS=2 -# CONFIG_SERIAL_8250_PCI is not set -# CONFIG_SERIAL_8250_RSA is not set -CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -# CONFIG_SERIAL_8250_SYSRQ is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_ARC is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -CONFIG_SERIAL_EARLYCON=y -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX3107 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_MFD_HSU is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_SERIAL_OF_PLATFORM is not set -# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set -# CONFIG_SERIAL_PCH_UART is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SH_SCI is not set -# CONFIG_SERIAL_ST_ASC is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_UARTLITE is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIO is not set -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_AMBAKMI is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_SERIO_LIBPS2 is not set -# CONFIG_SERIO_PARKBD is not set -# CONFIG_SERIO_PCIPS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_RAW is not set -# CONFIG_SERIO_SERPORT is not set -# CONFIG_SFC is not set -# CONFIG_SFI is not set -# CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_SGI_IP22 is not set -# CONFIG_SGI_IP27 is not set -# CONFIG_SGI_IP28 is not set -# CONFIG_SGI_IP32 is not set -# CONFIG_SGI_PARTITION is not set -CONFIG_SHMEM=y -# CONFIG_SH_ETH is not set -# CONFIG_SH_TIMER_CMT is not set -# CONFIG_SH_TIMER_MTU2 is not set -# CONFIG_SH_TIMER_TMU is not set -# CONFIG_SI7005 is not set -# CONFIG_SIBYTE_BIGSUR is not set -# CONFIG_SIBYTE_CARMEL is not set -# CONFIG_SIBYTE_CRHINE is not set -# CONFIG_SIBYTE_CRHONE is not set -# CONFIG_SIBYTE_LITTLESUR is not set -# CONFIG_SIBYTE_RHONE is not set -# CONFIG_SIBYTE_SENTOSA is not set -# CONFIG_SIBYTE_SWARM is not set -# CONFIG_SIGMA is not set -CONFIG_SIGNALFD=y -# CONFIG_SIMPLE_GPIO is not set -# CONFIG_SIS190 is not set -# CONFIG_SIS900 is not set -# CONFIG_SKGE is not set -# CONFIG_SKY2 is not set -# CONFIG_SKY2_DEBUG is not set -CONFIG_SLAB=y -CONFIG_SLABINFO=y -# CONFIG_SLHC is not set -# CONFIG_SLICOSS is not set -# CONFIG_SLIP is not set -# CONFIG_SLOB is not set -# CONFIG_SLUB is not set -# CONFIG_SLUB_DEBUG is not set -# CONFIG_SLUB_STATS is not set -# CONFIG_SMARTJOYPLUS_FF is not set -# CONFIG_SMC911X is not set -# CONFIG_SMC9194 is not set -# CONFIG_SMC91X is not set -# CONFIG_SMP is not set -# CONFIG_SMSC911X is not set -# CONFIG_SMSC9420 is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_SM_FTL is not set -# CONFIG_SND is not set -# CONFIG_SND_AC97_POWER_SAVE is not set -# CONFIG_SND_AD1816A is not set -# CONFIG_SND_AD1848 is not set -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ADLIB is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_ALS100 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALS4000 is not set -# CONFIG_SND_ARM is not set -# CONFIG_SND_ASIHPI is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_ATMEL_AC97C is not set -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT2320 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BCD2000 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMI8330 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_CS4231 is not set -# CONFIG_SND_CS4236 is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CS5530 is not set -# CONFIG_SND_CS5535AUDIO is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_DEBUG is not set -# CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_DYNAMIC_MINORS is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1688 is not set -# CONFIG_SND_ES18XX is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FIREWIRE is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_GUSCLASSIC is not set -# CONFIG_SND_GUSEXTREME is not set -# CONFIG_SND_GUSMAX is not set -# CONFIG_SND_HDA_INPUT_JACK is not set -# CONFIG_SND_HDA_INTEL is not set -CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 -CONFIG_SND_HDA_PREALLOC_SIZE=64 -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_HRTIMER is not set -# CONFIG_SND_HWDEP is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_INTERWAVE is not set -# CONFIG_SND_INTERWAVE_STB is not set -# CONFIG_SND_ISA is not set -# CONFIG_SND_KIRKWOOD_SOC is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_MIPS is not set -# CONFIG_SND_MIRO is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MPC52xx_SOC_EFIKA is not set -# CONFIG_SND_MPU401 is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_MTS64 is not set -# CONFIG_SND_MXS_SOC is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_OPL3SA2 is not set -# CONFIG_SND_OPTI92X_AD1848 is not set -# CONFIG_SND_OPTI92X_CS4231 is not set -# CONFIG_SND_OPTI93X is not set -CONFIG_SND_OSSEMUL=y -# CONFIG_SND_OXYGEN is not set -CONFIG_SND_PCI=y -# CONFIG_SND_PCM is not set -# CONFIG_SND_PCMCIA is not set -# CONFIG_SND_PCM_OSS is not set -CONFIG_SND_PCM_OSS_PLUGINS=y -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_PDAUDIOCF is not set -# CONFIG_SND_PORTMAN2X4 is not set -# CONFIG_SND_POWERPC_SOC is not set -# CONFIG_SND_PPC is not set -# CONFIG_SND_RAWMIDI is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME96 is not set -# CONFIG_SND_RME9652 is not set -# CONFIG_SND_RTCTIMER is not set -# CONFIG_SND_SB16 is not set -# CONFIG_SND_SB8 is not set -# CONFIG_SND_SBAWE is not set -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SND_SIS7019 is not set -# CONFIG_SND_SOC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_AK4104 is not set -# CONFIG_SND_SOC_AK4554 is not set -# CONFIG_SND_SOC_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_AU1XAUDIO is not set -# CONFIG_SND_SOC_AU1XPSC is not set -# CONFIG_SND_SOC_CACHE_LZO is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271 is not set -# CONFIG_SND_SOC_CS42L52 is not set -# CONFIG_SND_SOC_CS42L56 is not set -# CONFIG_SND_SOC_CS42L73 is not set -# CONFIG_SND_SOC_CS42XX8_I2C is not set -# CONFIG_SND_SOC_ES8328 is not set -# CONFIG_SND_SOC_EUKREA_TLV320 is not set -# CONFIG_SND_SOC_FSL_ASOC_CARD is not set -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_HDMI_CODEC is not set -# CONFIG_SND_SOC_IMX_ES8328 is not set -# CONFIG_SND_SOC_IMX_SPDIF is not set -# CONFIG_SND_SOC_IMX_WM8962 is not set -# CONFIG_SND_SOC_INTEL_SST is not set -# CONFIG_SND_SOC_MPC5200_AC97 is not set -# CONFIG_SND_SOC_MPC5200_I2S is not set -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM1792A is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -# CONFIG_SND_SOC_SPDIF is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM4567 is not set -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -# CONFIG_SND_SOC_TPA6130A2 is not set -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8580 is not set -# CONFIG_SND_SOC_WM8711 is not set -# CONFIG_SND_SOC_WM8728 is not set -# CONFIG_SND_SOC_WM8731 is not set -# CONFIG_SND_SOC_WM8737 is not set -# CONFIG_SND_SOC_WM8741 is not set -# CONFIG_SND_SOC_WM8750 is not set -# CONFIG_SND_SOC_WM8753 is not set -# CONFIG_SND_SOC_WM8770 is not set -# CONFIG_SND_SOC_WM8776 is not set -# CONFIG_SND_SOC_WM8804 is not set -# CONFIG_SND_SOC_WM8903 is not set -# CONFIG_SND_SOC_WM8962 is not set -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_SPI is not set -# CONFIG_SND_SSCAPE is not set -# CONFIG_SND_SUPPORT_OLD_API is not set -# CONFIG_SND_TIMER is not set -# CONFIG_SND_TRIDENT is not set -CONFIG_SND_USB=y -# CONFIG_SND_USB_6FIRE is not set -# CONFIG_SND_USB_AUDIO is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_HIFACE is not set -# CONFIG_SND_USB_UA101 is not set -# CONFIG_SND_USB_US122L is not set -# CONFIG_SND_USB_USX2Y is not set -# CONFIG_SND_VERBOSE_PRINTK is not set -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VIA82XX is not set -# CONFIG_SND_VIA82XX_MODEM is not set -# CONFIG_SND_VIRTUOSO is not set -# CONFIG_SND_VX222 is not set -# CONFIG_SND_VXPOCKET is not set -# CONFIG_SND_WAVEFRONT is not set -# CONFIG_SND_YMFPCI is not set -# CONFIG_SNI_RM is not set -# CONFIG_SOC_AM33XX is not set -# CONFIG_SOC_AM43XX is not set -# CONFIG_SOC_CAMERA is not set -# CONFIG_SOC_DRA7XX is not set -# CONFIG_SOC_HAS_OMAP2_SDRC is not set -# CONFIG_SOC_OMAP5 is not set -# CONFIG_SOC_TI is not set -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_SOLO6X10 is not set -# CONFIG_SONYPI is not set -# CONFIG_SONY_LAPTOP is not set -# CONFIG_SOUND is not set -# CONFIG_SOUND_PRIME is not set -# CONFIG_SP5100_TCO is not set -# CONFIG_SPARSEMEM_MANUAL is not set -# CONFIG_SPARSEMEM_STATIC is not set -# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set -# CONFIG_SPARSE_IRQ is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_SPEAKUP is not set -# CONFIG_SPI is not set -# CONFIG_SPINLOCK_TEST is not set -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_AU1550 is not set -# CONFIG_SPI_BCM2835 is not set -# CONFIG_SPI_BITBANG is not set -# CONFIG_SPI_BUTTERFLY is not set -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_DEBUG is not set -# CONFIG_SPI_DESIGNWARE is not set -# CONFIG_SPI_FSL_DSPI is not set -# CONFIG_SPI_FSL_ESPI is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_GPIO_OLD is not set -# CONFIG_SPI_LM70_LLP is not set -# CONFIG_SPI_MASTER is not set -# CONFIG_SPI_MPC52xx is not set -# CONFIG_SPI_MPC52xx_PSC is not set -# CONFIG_SPI_OCTEON is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_ORION is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PPC4xx is not set -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_RAMIPS is not set -# CONFIG_SPI_ROCKCHIP is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_SPIDEV is not set -# CONFIG_SPI_TI_QSPI is not set -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPI_TOPCLIFF_PCH is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_XWAY is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_SPMI is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -# CONFIG_SQUASHFS_FILE_CACHE is not set -CONFIG_SQUASHFS_FILE_DIRECT=y -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_SQUASHFS_LZO is not set -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_ZLIB is not set -# CONFIG_SRAM is not set -# CONFIG_SSB is not set -# CONFIG_SSBI is not set -# CONFIG_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -# CONFIG_SSB_PCMCIAHOST is not set -CONFIG_SSB_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSFDC is not set -# CONFIG_STACKTRACE is not set -CONFIG_STACKTRACE_SUPPORT=y -# CONFIG_STACK_TRACER is not set -CONFIG_STAGING=y -# CONFIG_STAGING_MEDIA is not set -CONFIG_STANDALONE=y -CONFIG_STDBINUTILS=y -# CONFIG_STE10XP is not set -# CONFIG_STE_MODEM_RPROC is not set -# CONFIG_STMMAC_ETH is not set -# CONFIG_STMMAC_PCI is not set -# CONFIG_STMMAC_PLATFORM is not set -CONFIG_STP=y -# CONFIG_STRICT_DEVMEM is not set -CONFIG_STRIP_ASM_SYMS=y -# CONFIG_STUB_POULSBO is not set -# CONFIG_SUNDANCE is not set -# CONFIG_SUNGEM is not set -# CONFIG_SUNRPC is not set -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_SUNRPC_GSS is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_SUSPEND is not set -CONFIG_SWAP=y -# CONFIG_SWCONFIG is not set -# CONFIG_SWCONFIG_B53 is not set -# CONFIG_SWCONFIG_B53_SPI_DRIVER is not set -# CONFIG_SWCONFIG_LEDS is not set -# CONFIG_SXGBE_ETH is not set -# CONFIG_SYNCLINK_CS is not set -CONFIG_SYN_COOKIES=y -CONFIG_SYSCTL=y -# CONFIG_SYSCTL_SYSCALL is not set -# CONFIG_SYSCTL_SYSCALL_CHECK is not set -CONFIG_SYSFS=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_SYSFS_DEPRECATED_V2 is not set -# CONFIG_SYSFS_SYSCALL is not set -# CONFIG_SYSTEMPORT is not set -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -# CONFIG_SYSV68_PARTITION is not set -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -# CONFIG_SYSV_FS is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_T5403 is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_TASKSTATS is not set -# CONFIG_TASKS_RCU is not set -# CONFIG_TC35815 is not set -# CONFIG_TCG_ATMEL is not set -# CONFIG_TCG_INFINEON is not set -# CONFIG_TCG_ST33_I2C is not set -# CONFIG_TCG_TIS is not set -# CONFIG_TCG_TIS_I2C_ATMEL is not set -# CONFIG_TCG_TIS_I2C_INFINEON is not set -# CONFIG_TCG_TIS_I2C_NUVOTON is not set -# CONFIG_TCG_TIS_ST33ZP24 is not set -# CONFIG_TCG_TPM is not set -# CONFIG_TCG_XEN is not set -# CONFIG_TCIC is not set -CONFIG_TCP_CONG_ADVANCED=y -# CONFIG_TCP_CONG_BIC is not set -CONFIG_TCP_CONG_CUBIC=y -# CONFIG_TCP_CONG_DCTCP is not set -# CONFIG_TCP_CONG_HSTCP is not set -# CONFIG_TCP_CONG_HTCP is not set -# CONFIG_TCP_CONG_HYBLA is not set -# CONFIG_TCP_CONG_ILLINOIS is not set -# CONFIG_TCP_CONG_LP is not set -# CONFIG_TCP_CONG_SCALABLE is not set -# CONFIG_TCP_CONG_VEGAS is not set -# CONFIG_TCP_CONG_VENO is not set -# CONFIG_TCP_CONG_WESTWOOD is not set -# CONFIG_TCP_CONG_YEAH is not set -# CONFIG_TCP_MD5SIG is not set -# CONFIG_TCS3414 is not set -# CONFIG_TCS3472 is not set -# CONFIG_TEGRA_HOST1X is not set -# CONFIG_TEHUTI is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_MODULE is not set -# CONFIG_TEST_POWER is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_TEST_USER_COPY is not set -CONFIG_TEXTSEARCH=y -# CONFIG_TEXTSEARCH_BM is not set -# CONFIG_TEXTSEARCH_FSM is not set -# CONFIG_TEXTSEARCH_KMP is not set -# CONFIG_THERMAL is not set -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_HWMON is not set -# CONFIG_THRUSTMASTER_FF is not set -# CONFIG_THUNDERBOLT is not set -# CONFIG_TICK_CPU_ACCOUNTING is not set -CONFIG_TICK_ONESHOT=y -# CONFIG_TIFM_CORE is not set -# CONFIG_TIGON3 is not set -# CONFIG_TIMB_DMA is not set -CONFIG_TIMERFD=y -# CONFIG_TIMER_STATS is not set -CONFIG_TINY_RCU=y -# CONFIG_TIPC is not set -# CONFIG_TI_ADC081C is not set -# CONFIG_TI_ADC128S052 is not set -# CONFIG_TI_AM335X_ADC is not set -# CONFIG_TI_CPSW is not set -# CONFIG_TI_CPTS is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_TI_DAVINCI_CPDMA is not set -# CONFIG_TI_DAVINCI_MDIO is not set -# CONFIG_TI_ST is not set -# CONFIG_TLAN is not set -# CONFIG_TMD_HERMES is not set -# CONFIG_TMP006 is not set -CONFIG_TMPFS=y -# CONFIG_TMPFS_POSIX_ACL is not set -CONFIG_TMPFS_XATTR=y -# CONFIG_TORTURE_TEST is not set -# CONFIG_TOSHIBA_HAPS is not set -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_AD7879_I2C is not set -# CONFIG_TOUCHSCREEN_AD7879_SPI is not set -# CONFIG_TOUCHSCREEN_ADS7846 is not set -# CONFIG_TOUCHSCREEN_AR1021_I2C is not set -# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_S3C2410 is not set -# CONFIG_TOUCHSCREEN_ST1232 is not set -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set -# CONFIG_TOUCHSCREEN_W90X900 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WM97XX is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_TR is not set -# CONFIG_TRACEPOINT_BENCHMARK is not set -# CONFIG_TRACER_SNAPSHOT is not set -# CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP is not set -# CONFIG_TRACE_BRANCH_PROFILING is not set -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -# CONFIG_TRACE_SINK is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_TRAD_SIGNALS=y -# CONFIG_TRANSPARENT_HUGEPAGE is not set -# CONFIG_TRANZPORT is not set -# CONFIG_TREE_PREEMPT_RCU is not set -# CONFIG_TREE_RCU is not set -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_TRUSTED_KEYS is not set -# CONFIG_TSL2583 is not set -# CONFIG_TSL2x7x is not set -# CONFIG_TSL4531 is not set -CONFIG_TTY=y -# CONFIG_TTY_PRINTK is not set -# CONFIG_TUN is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL4030_MADC is not set -# CONFIG_TWL6030_GPADC is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_TYPHOON is not set -# CONFIG_UACCESS_WITH_MEMCPY is not set -# CONFIG_UCB1400_CORE is not set -# CONFIG_UDF_FS is not set -CONFIG_UDF_NLS=y -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -# CONFIG_UFS_FS is not set -# CONFIG_UHID is not set -CONFIG_UIDGID_STRICT_TYPE_CHECKS=y -# CONFIG_UIO is not set -# CONFIG_ULTRA is not set -# CONFIG_ULTRIX_PARTITION is not set -CONFIG_UNIX=y -CONFIG_UNIX98_PTYS=y -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_UNIX_DIAG is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_UPROBES is not set -# CONFIG_UPROBE_EVENT is not set -# CONFIG_USB is not set -# CONFIG_USBIP_CORE is not set -# CONFIG_USBPCWATCHDOG is not set -# CONFIG_USB_ACM is not set -# CONFIG_USB_ADUTUX is not set -CONFIG_USB_ALI_M5632=y -# CONFIG_USB_AMD5536UDC is not set -CONFIG_USB_AN2720=y -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set -# CONFIG_USB_APPLEDISPLAY is not set -CONFIG_USB_ARCH_HAS_EHCI=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB_ARMLINUX=y -# CONFIG_USB_ATM is not set -CONFIG_USB_BELKIN=y -# CONFIG_USB_BTMTK is not set -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_CATC is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_CHIPIDEA is not set -# CONFIG_USB_CONFIGFS is not set -# CONFIG_USB_CXACRU is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_DEBUG is not set -CONFIG_USB_DEFAULT_PERSIST=y -CONFIG_USB_DEVICEFS=y -# CONFIG_USB_DEVICE_CLASS is not set -# CONFIG_USB_DSBR is not set -# CONFIG_USB_DUMMY_HCD is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_DWC2_DUAL_ROLE is not set -# CONFIG_USB_DWC2_HOST is not set -# CONFIG_USB_DWC2_PERIPHERAL is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC3_EXYNOS is not set -# CONFIG_USB_DWC3_KEYSTONE is not set -# CONFIG_USB_DWC3_PCI is not set -# CONFIG_USB_DWC3_QCOM is not set -# CONFIG_USB_DWC_OTG_LPM is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_EHCI_HCD_AT91 is not set -# CONFIG_USB_EHCI_HCD_PPC_OF is not set -# CONFIG_USB_EHCI_MSM is not set -# CONFIG_USB_EHCI_MV is not set -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_ENESTORAGE is not set -# CONFIG_USB_EPSON2888 is not set -# CONFIG_USB_ET61X251 is not set -CONFIG_USB_EZUSB=y -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_FILE_STORAGE is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_FOTG210_UDC is not set -# CONFIG_USB_FSL_USB2 is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_FUNCTIONFS is not set -# CONFIG_USB_FUSB300 is not set -# CONFIG_USB_FUSBH200_HCD is not set -# CONFIG_USB_GADGET is not set -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_GADGET_DEBUG is not set -# CONFIG_USB_GADGET_DEBUG_FILES is not set -# CONFIG_USB_GADGET_DEBUG_FS is not set -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 -CONFIG_USB_GADGET_VBUS_DRAW=2 -# CONFIG_USB_GADGET_XILINX is not set -# CONFIG_USB_GL860 is not set -# CONFIG_USB_GOKU is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_GR_UDC is not set -# CONFIG_USB_GSPCA is not set -# CONFIG_USB_GSPCA_BENQ is not set -# CONFIG_USB_GSPCA_CONEX is not set -# CONFIG_USB_GSPCA_CPIA1 is not set -# CONFIG_USB_GSPCA_DTCS033 is not set -# CONFIG_USB_GSPCA_ETOMS is not set -# CONFIG_USB_GSPCA_FINEPIX is not set -# CONFIG_USB_GSPCA_JEILINJ is not set -# CONFIG_USB_GSPCA_JL2005BCD is not set -# CONFIG_USB_GSPCA_KINECT is not set -# CONFIG_USB_GSPCA_KONICA is not set -# CONFIG_USB_GSPCA_MARS is not set -# CONFIG_USB_GSPCA_MR97310A is not set -# CONFIG_USB_GSPCA_NW80X is not set -# CONFIG_USB_GSPCA_OV519 is not set -# CONFIG_USB_GSPCA_OV534 is not set -# CONFIG_USB_GSPCA_OV534_9 is not set -# CONFIG_USB_GSPCA_PAC207 is not set -# CONFIG_USB_GSPCA_PAC7302 is not set -# CONFIG_USB_GSPCA_PAC7311 is not set -# CONFIG_USB_GSPCA_SE401 is not set -# CONFIG_USB_GSPCA_SN9C2028 is not set -# CONFIG_USB_GSPCA_SN9C20X is not set -# CONFIG_USB_GSPCA_SONIXB is not set -# CONFIG_USB_GSPCA_SONIXJ is not set -# CONFIG_USB_GSPCA_SPCA1528 is not set -# CONFIG_USB_GSPCA_SPCA500 is not set -# CONFIG_USB_GSPCA_SPCA501 is not set -# CONFIG_USB_GSPCA_SPCA505 is not set -# CONFIG_USB_GSPCA_SPCA506 is not set -# CONFIG_USB_GSPCA_SPCA508 is not set -# CONFIG_USB_GSPCA_SPCA561 is not set -# CONFIG_USB_GSPCA_SQ905 is not set -# CONFIG_USB_GSPCA_SQ905C is not set -# CONFIG_USB_GSPCA_SQ930X is not set -# CONFIG_USB_GSPCA_STK014 is not set -# CONFIG_USB_GSPCA_STK1135 is not set -# CONFIG_USB_GSPCA_STV0680 is not set -# CONFIG_USB_GSPCA_SUNPLUS is not set -# CONFIG_USB_GSPCA_T613 is not set -# CONFIG_USB_GSPCA_TOPRO is not set -# CONFIG_USB_GSPCA_TV8532 is not set -# CONFIG_USB_GSPCA_VC032X is not set -# CONFIG_USB_GSPCA_VICAM is not set -# CONFIG_USB_GSPCA_XIRLINK_CIT is not set -# CONFIG_USB_GSPCA_ZC3XX is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_G_NOKIA is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_G_SERIAL is not set -# CONFIG_USB_G_WEBCAM is not set -# CONFIG_USB_HCD_TEST_MODE is not set -# CONFIG_USB_HID is not set -# CONFIG_USB_HIDDEV is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_HWA_HCD is not set -# CONFIG_USB_IBMCAM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_INPUT_IMS_PCU is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_IPHETH is not set -# CONFIG_USB_IP_COMMON is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_KBD is not set -# CONFIG_USB_KC2190 is not set -# CONFIG_USB_KONICAWC is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LIBUSUAL is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_M5602 is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_MASS_STORAGE is not set -# CONFIG_USB_MAX3421_HCD is not set -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_MOUSE is not set -# CONFIG_USB_MSM_OTG is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MXS_PHY is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_NET_AX88179_178A is not set -# CONFIG_USB_NET_AX8817X is not set -# CONFIG_USB_NET_CDCETHER is not set -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_CX82310_ETH is not set -# CONFIG_USB_NET_DM9601 is not set -# CONFIG_USB_NET_DRIVERS is not set -# CONFIG_USB_NET_GL620A is not set -# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set -# CONFIG_USB_NET_INT51X1 is not set -# CONFIG_USB_NET_KALMIA is not set -# CONFIG_USB_NET_MCS7830 is not set -# CONFIG_USB_NET_NET1080 is not set -# CONFIG_USB_NET_PLUSB is not set -# CONFIG_USB_NET_QMI_WWAN is not set -# CONFIG_USB_NET_RNDIS_HOST is not set -# CONFIG_USB_NET_RNDIS_WLAN is not set -# CONFIG_USB_NET_SMSC75XX is not set -# CONFIG_USB_NET_SMSC95XX is not set -# CONFIG_USB_NET_SR9700 is not set -# CONFIG_USB_NET_SR9800 is not set -# CONFIG_USB_NET_ZAURUS is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_OHCI_HCD_PCI is not set -# CONFIG_USB_OHCI_HCD_PPC_OF is not set -# CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set -# CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set -# CONFIG_USB_OHCI_HCD_PPC_SOC is not set -# CONFIG_USB_OHCI_HCD_SSB is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_PHY is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_PWC_INPUT_EVDEV is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_RENESAS_USBHS is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_RTL8152 is not set -# CONFIG_USB_S2255 is not set -# CONFIG_USB_S3C_HSOTG is not set -# CONFIG_USB_SE401 is not set -# CONFIG_USB_SERIAL is not set -# CONFIG_USB_SERIAL_AIRCABLE is not set -# CONFIG_USB_SERIAL_ARK3116 is not set -# CONFIG_USB_SERIAL_BELKIN is not set -# CONFIG_USB_SERIAL_CH341 is not set -# CONFIG_USB_SERIAL_CP210X is not set -# CONFIG_USB_SERIAL_CYBERJACK is not set -# CONFIG_USB_SERIAL_CYPRESS_M8 is not set -# CONFIG_USB_SERIAL_DEBUG is not set -# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT is not set -# CONFIG_USB_SERIAL_EDGEPORT_TI is not set -# CONFIG_USB_SERIAL_EMPEG is not set -# CONFIG_USB_SERIAL_F81232 is not set -# CONFIG_USB_SERIAL_FTDI_SIO is not set -# CONFIG_USB_SERIAL_FUNSOFT is not set -# CONFIG_USB_SERIAL_GARMIN is not set -CONFIG_USB_SERIAL_GENERIC=y -# CONFIG_USB_SERIAL_HP4X is not set -# CONFIG_USB_SERIAL_IPAQ is not set -# CONFIG_USB_SERIAL_IPW is not set -# CONFIG_USB_SERIAL_IR is not set -# CONFIG_USB_SERIAL_IUU is not set -# CONFIG_USB_SERIAL_KEYSPAN is not set -CONFIG_USB_SERIAL_KEYSPAN_MPR=y -# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set -CONFIG_USB_SERIAL_KEYSPAN_USA18X=y -CONFIG_USB_SERIAL_KEYSPAN_USA19=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y -CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y -CONFIG_USB_SERIAL_KEYSPAN_USA19W=y -CONFIG_USB_SERIAL_KEYSPAN_USA28=y -CONFIG_USB_SERIAL_KEYSPAN_USA28X=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y -CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y -CONFIG_USB_SERIAL_KEYSPAN_USA49W=y -CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y -# CONFIG_USB_SERIAL_KLSI is not set -# CONFIG_USB_SERIAL_KOBIL_SCT is not set -# CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_METRO is not set -# CONFIG_USB_SERIAL_MOS7715_PARPORT is not set -# CONFIG_USB_SERIAL_MOS7720 is not set -# CONFIG_USB_SERIAL_MOS7840 is not set -# CONFIG_USB_SERIAL_MOTOROLA is not set -# CONFIG_USB_SERIAL_MXUPORT is not set -# CONFIG_USB_SERIAL_NAVMAN is not set -# CONFIG_USB_SERIAL_OMNINET is not set -# CONFIG_USB_SERIAL_OPTICON is not set -# CONFIG_USB_SERIAL_OPTION is not set -# CONFIG_USB_SERIAL_OTI6858 is not set -# CONFIG_USB_SERIAL_PL2303 is not set -# CONFIG_USB_SERIAL_QCAUX is not set -# CONFIG_USB_SERIAL_QT2 is not set -# CONFIG_USB_SERIAL_QUALCOMM is not set -# CONFIG_USB_SERIAL_QUATECH2 is not set -# CONFIG_USB_SERIAL_QUATECH_USB2 is not set -# CONFIG_USB_SERIAL_SAFE is not set -CONFIG_USB_SERIAL_SAFE_PADDED=y -# CONFIG_USB_SERIAL_SIEMENS_MPI is not set -# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set -# CONFIG_USB_SERIAL_SIMPLE is not set -# CONFIG_USB_SERIAL_SPCP8X5 is not set -# CONFIG_USB_SERIAL_SSU100 is not set -# CONFIG_USB_SERIAL_SYMBOL is not set -# CONFIG_USB_SERIAL_TI is not set -# CONFIG_USB_SERIAL_VISOR is not set -# CONFIG_USB_SERIAL_VIVOPAY_SERIAL is not set -# CONFIG_USB_SERIAL_WHITEHEAT is not set -# CONFIG_USB_SERIAL_WISHBONE is not set -# CONFIG_USB_SERIAL_XIRCOM is not set -# CONFIG_USB_SERIAL_XSENS_MT is not set -# CONFIG_USB_SERIAL_ZIO is not set -# CONFIG_USB_SERIAL_ZTE is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_SIERRA_NET is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_SN9C102 is not set -# CONFIG_USB_SPEEDTOUCH is not set -# CONFIG_USB_STKWEBCAM is not set -# CONFIG_USB_STORAGE is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STV06XX is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_USB_SUSPEND is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_TMC is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_UAS is not set -# CONFIG_USB_UEAGLEATM is not set -# CONFIG_USB_ULPI is not set -# CONFIG_USB_USBNET is not set -# CONFIG_USB_USS720 is not set -# CONFIG_USB_VIDEO_CLASS is not set -CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y -# CONFIG_USB_VL600 is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_WHCI_HCD is not set -# CONFIG_USB_WPAN_HCD is not set -# CONFIG_USB_WUSB is not set -# CONFIG_USB_WUSB_CBAF is not set -# CONFIG_USB_XHCI_HCD is not set -# CONFIG_USB_XUSBATM is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_ZD1201 is not set -# CONFIG_USB_ZERO is not set -# CONFIG_USB_ZR364XX is not set -# CONFIG_USELIB is not set -# CONFIG_USE_GENERIC_SMP_HELPERS is not set -# CONFIG_USE_OF is not set -# CONFIG_UTS_NS is not set -# CONFIG_UWB is not set -# CONFIG_V4L_MEM2MEM_DRIVERS is not set -# CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_VCNL4000 is not set -# CONFIG_VETH is not set -# CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_VF610_ADC is not set -# CONFIG_VFAT_FS is not set -# CONFIG_VGASTATE is not set -# CONFIG_VGA_ARB is not set -# CONFIG_VGA_SWITCHEROO is not set -# CONFIG_VIA_RHINE is not set -# CONFIG_VIA_VELOCITY is not set -# CONFIG_VIDEO_ADV7170 is not set -# CONFIG_VIDEO_ADV7175 is not set -# CONFIG_VIDEO_ADV7180 is not set -# CONFIG_VIDEO_ADV7183 is not set -# CONFIG_VIDEO_ADV7343 is not set -# CONFIG_VIDEO_ADV7393 is not set -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_AK881X is not set -# CONFIG_VIDEO_BT819 is not set -# CONFIG_VIDEO_BT848 is not set -# CONFIG_VIDEO_BT856 is not set -# CONFIG_VIDEO_BT866 is not set -# CONFIG_VIDEO_BWQCAM is not set -# CONFIG_VIDEO_CAFE_CCIC is not set -# CONFIG_VIDEO_CAPTURE_DRIVERS is not set -# CONFIG_VIDEO_CPIA is not set -# CONFIG_VIDEO_CQCAM is not set -# CONFIG_VIDEO_CS5345 is not set -# CONFIG_VIDEO_CS53L32A is not set -# CONFIG_VIDEO_CX231XX is not set -# CONFIG_VIDEO_CX2341X is not set -# CONFIG_VIDEO_CX25840 is not set -# CONFIG_VIDEO_CX88 is not set -# CONFIG_VIDEO_DEV is not set -# CONFIG_VIDEO_DM6446_CCDC is not set -# CONFIG_VIDEO_DT3155 is not set -# CONFIG_VIDEO_EM28XX is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -# CONFIG_VIDEO_GO7007 is not set -# CONFIG_VIDEO_HDPVR is not set -# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set -# CONFIG_VIDEO_HEXIUM_GEMINI is not set -# CONFIG_VIDEO_HEXIUM_ORION is not set -# CONFIG_VIDEO_IR_I2C is not set -# CONFIG_VIDEO_IVTV is not set -# CONFIG_VIDEO_KS0127 is not set -# CONFIG_VIDEO_M52790 is not set -# CONFIG_VIDEO_MEDIA is not set -# CONFIG_VIDEO_MEM2MEM_TESTDEV is not set -# CONFIG_VIDEO_ML86V7667 is not set -# CONFIG_VIDEO_MSP3400 is not set -# CONFIG_VIDEO_MT9V011 is not set -# CONFIG_VIDEO_MXB is not set -# CONFIG_VIDEO_NOON010PC30 is not set -# CONFIG_VIDEO_OMAP2_VOUT is not set -# CONFIG_VIDEO_OUTPUT_CONTROL is not set -# CONFIG_VIDEO_OV7640 is not set -# CONFIG_VIDEO_OV7670 is not set -# CONFIG_VIDEO_PMS is not set -# CONFIG_VIDEO_PVRUSB2 is not set -# CONFIG_VIDEO_SAA6588 is not set -# CONFIG_VIDEO_SAA6752HS is not set -# CONFIG_VIDEO_SAA7110 is not set -# CONFIG_VIDEO_SAA711X is not set -# CONFIG_VIDEO_SAA7127 is not set -# CONFIG_VIDEO_SAA7134 is not set -# CONFIG_VIDEO_SAA717X is not set -# CONFIG_VIDEO_SAA7185 is not set -# CONFIG_VIDEO_SAA7191 is not set -# CONFIG_VIDEO_SH_MOBILE_CEU is not set -# CONFIG_VIDEO_SONY_BTF_MPX is not set -# CONFIG_VIDEO_SR030PC30 is not set -# CONFIG_VIDEO_TCM825X is not set -# CONFIG_VIDEO_TDA7432 is not set -# CONFIG_VIDEO_TDA9840 is not set -# CONFIG_VIDEO_TEA6415C is not set -# CONFIG_VIDEO_TEA6420 is not set -# CONFIG_VIDEO_THS7303 is not set -# CONFIG_VIDEO_THS8200 is not set -# CONFIG_VIDEO_TIMBERDALE is not set -# CONFIG_VIDEO_TLV320AIC23B is not set -# CONFIG_VIDEO_TM6000 is not set -# CONFIG_VIDEO_TVAUDIO is not set -# CONFIG_VIDEO_TVP514X is not set -# CONFIG_VIDEO_TVP5150 is not set -# CONFIG_VIDEO_TVP7002 is not set -# CONFIG_VIDEO_TW2804 is not set -# CONFIG_VIDEO_TW9903 is not set -# CONFIG_VIDEO_TW9906 is not set -# CONFIG_VIDEO_UDA1342 is not set -# CONFIG_VIDEO_UPD64031A is not set -# CONFIG_VIDEO_UPD64083 is not set -# CONFIG_VIDEO_USBTV is not set -# CONFIG_VIDEO_USBVISION is not set -# CONFIG_VIDEO_V4L2 is not set -# CONFIG_VIDEO_V4L2_COMMON is not set -# CONFIG_VIDEO_V4L2_INT_DEVICE is not set -# CONFIG_VIDEO_VIVI is not set -# CONFIG_VIDEO_VP27SMPX is not set -# CONFIG_VIDEO_VPX3220 is not set -# CONFIG_VIDEO_VS6624 is not set -# CONFIG_VIDEO_WM8739 is not set -# CONFIG_VIDEO_WM8775 is not set -# CONFIG_VIDEO_ZORAN is not set -# CONFIG_VIRQ_DEBUG is not set -# CONFIG_VIRTIO_BALLOON is not set -# CONFIG_VIRTIO_MMIO is not set -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTUALIZATION is not set -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRT_TO_BUS=y -# CONFIG_VITESSE_PHY is not set -CONFIG_VLAN_8021Q=y -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_VME_BUS is not set -# CONFIG_VMSPLIT_1G is not set -# CONFIG_VMSPLIT_2G is not set -# CONFIG_VMSPLIT_2G_OPT is not set -CONFIG_VMSPLIT_3G=y -# CONFIG_VMSPLIT_3G_OPT is not set -# CONFIG_VMWARE_PVSCSI is not set -# CONFIG_VMXNET3 is not set -# CONFIG_VM_EVENT_COUNTERS is not set -# CONFIG_VORTEX is not set -# CONFIG_VSOCKETS is not set -# CONFIG_VT is not set -# CONFIG_VT6655 is not set -# CONFIG_VT6656 is not set -# CONFIG_VXFS_FS is not set -# CONFIG_VXGE is not set -# CONFIG_VXLAN is not set -# CONFIG_W1 is not set -# CONFIG_W1_CON is not set -# CONFIG_W1_MASTER_DS1WM is not set -# CONFIG_W1_MASTER_DS2482 is not set -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_GPIO is not set -# CONFIG_W1_MASTER_MATROX is not set -# CONFIG_W1_SLAVE_BQ27000 is not set -# CONFIG_W1_SLAVE_DS2406 is not set -# CONFIG_W1_SLAVE_DS2408 is not set -# CONFIG_W1_SLAVE_DS2413 is not set -# CONFIG_W1_SLAVE_DS2423 is not set -# CONFIG_W1_SLAVE_DS2431 is not set -# CONFIG_W1_SLAVE_DS2433 is not set -# CONFIG_W1_SLAVE_DS2760 is not set -# CONFIG_W1_SLAVE_DS2780 is not set -# CONFIG_W1_SLAVE_DS2781 is not set -# CONFIG_W1_SLAVE_DS28E04 is not set -# CONFIG_W1_SLAVE_SMEM is not set -# CONFIG_W1_SLAVE_THERM is not set -# CONFIG_W35UND is not set -# CONFIG_W83627HF_WDT is not set -# CONFIG_W83697HF_WDT is not set -# CONFIG_W83877F_WDT is not set -# CONFIG_W83977F_WDT is not set -# CONFIG_WAN is not set -# CONFIG_WANXL is not set -# CONFIG_WAN_ROUTER is not set -CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_CORE is not set -# CONFIG_WATCHDOG_NOWAYOUT is not set -# CONFIG_WD80x3 is not set -# CONFIG_WDTPCI is not set -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PRIV=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WILINK_PLATFORM_DATA=y -# CONFIG_WIMAX is not set -# CONFIG_WIMAX_GDM72XX is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -# CONFIG_WIRELESS_EXT_SYSFS is not set -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -# CONFIG_WLAGS49_H2 is not set -# CONFIG_WLAGS49_H25 is not set -CONFIG_WLAN=y -# CONFIG_WLCORE is not set -CONFIG_WL_TI=y -CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y -# CONFIG_WR_PPMC is not set -# CONFIG_X25 is not set -# CONFIG_X86_DEBUG_STATIC_CPU_HAS is not set -# CONFIG_X86_PKG_TEMP_THERMAL is not set -CONFIG_X86_SYSFB=y -# CONFIG_XEN is not set -CONFIG_XFRM=y -# CONFIG_XFRM_IPCOMP is not set -# CONFIG_XFRM_MIGRATE is not set -# CONFIG_XFRM_STATISTICS is not set -# CONFIG_XFRM_SUB_POLICY is not set -# CONFIG_XFRM_USER is not set -# CONFIG_XFS_DEBUG is not set -# CONFIG_XFS_FS is not set -# CONFIG_XFS_POSIX_ACL is not set -# CONFIG_XFS_QUOTA is not set -# CONFIG_XFS_RT is not set -# CONFIG_XFS_WARN is not set -# CONFIG_XILINX_AXI_EMAC is not set -# CONFIG_XILINX_EMACLITE is not set -# CONFIG_XILINX_LL_TEMAC is not set -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_XILLYBUS is not set -# CONFIG_XIP_KERNEL is not set -# CONFIG_XMON is not set -# CONFIG_XVMALLOC is not set -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_TEST is not set -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_YAM is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_YENTA is not set -# CONFIG_YENTA_O2 is not set -# CONFIG_YENTA_RICOH is not set -# CONFIG_YENTA_TI is not set -# CONFIG_YENTA_TOSHIBA is not set -# CONFIG_ZBUD is not set -# CONFIG_ZD1211RW is not set -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_ZEROPLUS_FF is not set -# CONFIG_ZISOFS is not set -# CONFIG_ZLIB_DEFLATE is not set -# CONFIG_ZLIB_INFLATE is not set -# CONFIG_ZNET is not set -CONFIG_ZONE_DMA=y -CONFIG_ZONE_DMA_FLAG=1 -# CONFIG_ZPOOL is not set -# CONFIG_ZRAM is not set -# CONFIG_ZRAM_LZ4_COMPRESS is not set -# CONFIG_ZSMALLOC is not set diff --git a/target/linux/generic/config-4.4 b/target/linux/generic/config-4.4 deleted file mode 100644 index 3285000eb..000000000 --- a/target/linux/generic/config-4.4 +++ /dev/null @@ -1,4857 +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_ALS 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_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_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_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_ADIS16260 is not set -# CONFIG_ADIS16400 is not set -# CONFIG_ADIS16480 is not set -# CONFIG_ADJD_S311 is not set -# CONFIG_ADM6996_PHY is not set -# CONFIG_ADM8211 is not set -# CONFIG_ADT7316 is not set -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_ADXRS450 is not set -CONFIG_AEABI=y -# CONFIG_AFFS_FS is not set -# CONFIG_AFS_FS is not set -# CONFIG_AF_RXRPC is not set -# CONFIG_AGP is not set -# CONFIG_AHCI_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 -# 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_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_PHY is not set -# CONFIG_AMD_XGBE 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_APDS9960 is not set -# CONFIG_APM8018X is not set -# CONFIG_APPLE_GMUX is not set -# CONFIG_APPLICOM is not set -# CONFIG_AQUANTIA_PHY 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_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_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_IXP4XX is not set -# CONFIG_ARCH_KEYSTONE 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_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_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_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_S5PV210 is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_SHMOBILE 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_TEGRA is not set -# CONFIG_ARCH_U300 is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_UNIPHIER 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_ZX is not set -# CONFIG_ARCH_ZYNQ is not set -# CONFIG_ARCNET is not set -# CONFIG_ARC_EMAC is not set -# CONFIG_ARM64_ERRATUM_819472 is not set -# CONFIG_ARM64_ERRATUM_824069 is not set -# CONFIG_ARM64_ERRATUM_826319 is not set -# CONFIG_ARM64_ERRATUM_827319 is not set -# CONFIG_ARM64_ERRATUM_832075 is not set -# CONFIG_ARM64_ERRATUM_834220 is not set -# CONFIG_ARM64_ERRATUM_843419 is not set -# CONFIG_ARM64_ERRATUM_845719 is not set -# CONFIG_ARM_APPENDED_DTB is not set -# CONFIG_ARM_ARCH_TIMER is not set -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_CCI is not set -# CONFIG_ARM_CCI400_PMU is not set -# CONFIG_ARM_CCI500_PMU is not set -# CONFIG_ARM_CCN is not set -# CONFIG_ARM_CPUIDLE is not set -CONFIG_ARM_CPU_TOPOLOGY=y -# 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_MODULE_PLTS 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_TIMER_SP804 is not set -# CONFIG_ARM_UNWIND is not set -# CONFIG_ARM_VIRT_EXT is not set -# CONFIG_AS3935 is not set -# CONFIG_ASM9260_TIMER is not set -# CONFIG_ASUS_LAPTOP is not set -# CONFIG_ASYMMETRIC_KEY_TYPE is not set -# CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE 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_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_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_AURORA_NB8800 is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_AUTO_ZRELADDR is not set -# CONFIG_AUXDISPLAY 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_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_BD6107 is not set -# CONFIG_BACKLIGHT_GENERIC is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LCD_SUPPORT 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_PM8941_WLED 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_BQ27XXX 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_BCM47XX is not set -# CONFIG_BCM63XX is not set -# CONFIG_BCM63XX_PHY is not set -# CONFIG_BCM7038_WDT 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_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_BH1750 is not set -# CONFIG_BIG_KEYS is not set -# CONFIG_BIG_LITTLE is not set -# CONFIG_BINARY_PRINTF is not set -# CONFIG_BINFMT_AOUT is not set -CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set -CONFIG_BINFMT_SCRIPT=y -CONFIG_BITREVERSE=y -# CONFIG_BLK_CMDLINE_PARSER is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_CPQ_DA is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_BLK_DEV_4DRIVES is not set -# CONFIG_BLK_DEV_AEC62XX is not set -# CONFIG_BLK_DEV_ALI14XX is not set -# CONFIG_BLK_DEV_ALI15X3 is not set -# CONFIG_BLK_DEV_AMD74XX is not set -# CONFIG_BLK_DEV_ATIIXP is not set -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_CMD640 is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_CS5520 is not set -# CONFIG_BLK_DEV_CS5530 is not set -# CONFIG_BLK_DEV_CS5535 is not set -# CONFIG_BLK_DEV_CS5536 is not set -# CONFIG_BLK_DEV_CY82C693 is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_DELKIN is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_DTC2278 is not set -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_GENERIC is not set -# CONFIG_BLK_DEV_HD is not set -# CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_BLK_DEV_HT6560B is not set -# CONFIG_BLK_DEV_IDEACPI is not set -# CONFIG_BLK_DEV_IDECD is not set -# CONFIG_BLK_DEV_IDECS is not set -# CONFIG_BLK_DEV_IDEPCI is not set -# CONFIG_BLK_DEV_IDEPNP is not set -# CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDE_AU1XXX is not set -# CONFIG_BLK_DEV_IDE_SATA is not set -CONFIG_BLK_DEV_INITRD=y -# CONFIG_BLK_DEV_INTEGRITY is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_BLK_DEV_IT8172 is not set -# CONFIG_BLK_DEV_IT8213 is not set -# CONFIG_BLK_DEV_IT821X is not set -# CONFIG_BLK_DEV_JMICRON is not set -# CONFIG_BLK_DEV_LOOP is not set -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_NS87415 is not set -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_BLK_DEV_OFFBOARD is not set -# CONFIG_BLK_DEV_OPTI621 is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_DEV_PDC202XX_NEW is not set -# CONFIG_BLK_DEV_PDC202XX_OLD is not set -# CONFIG_BLK_DEV_PIIX is not set -# CONFIG_BLK_DEV_PLATFORM is not set -# CONFIG_BLK_DEV_PMEM 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_UMC8672 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_VIA82CXXX is not set -CONFIG_BLOCK=y -# CONFIG_BMA180 is not set -# CONFIG_BMC150_ACCEL is not set -# CONFIG_BMC150_MAGN 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_BNXT 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_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_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_HCIBTUSB_RTL 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_HCIUART_QCA is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_HIDP is not set -# CONFIG_BT_HS is not set -# CONFIG_BT_LE is not set -# CONFIG_BT_MRVL is not set -# CONFIG_BT_RFCOMM is not set -CONFIG_BT_RFCOMM_TTY=y -# CONFIG_BT_SELFTEST is not set -CONFIG_BUG=y -CONFIG_BUILDTIME_EXTABLE_SORT=y -# CONFIG_BUILD_BIN2C is not set -# CONFIG_C2PORT is not set -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_CAIF is not set -# CONFIG_CAN is not set -# CONFIG_CAN_BCM is not set -# CONFIG_CAN_DEBUG_DEVICES is not set -# CONFIG_CAN_DEV is not set -# CONFIG_CAN_GS_USB is not set -# CONFIG_CAN_GW is not set -# CONFIG_CAN_M_CAN is not set -# CONFIG_CAN_RAW is not set -# CONFIG_CAN_RCAR is not set -# CONFIG_CAN_SLCAN is not set -# CONFIG_CAN_SUN4I is not set -# CONFIG_CAN_VCAN 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_CASSINI is not set -# CONFIG_CAVIUM_ERRATUM_22375 is not set -# CONFIG_CAVIUM_ERRATUM_23144 is not set -# CONFIG_CAVIUM_ERRATUM_23154 is not set -# CONFIG_CAVIUM_ERRATUM_27456 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_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_BQ24257 is not set -# CONFIG_CHARGER_BQ24735 is not set -# CONFIG_CHARGER_BQ25890 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_RT9455 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_CHARGER_TWL4030 is not set -# CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -# CONFIG_CHROME_PLATFORMS is not set -# CONFIG_CHR_DEV_OSST is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_CIFS is not set -# CONFIG_CIFS_ACL is not set -# CONFIG_CIFS_DEBUG is not set -# CONFIG_CIFS_DEBUG2 is not set -# CONFIG_CIFS_FSCACHE is not set -# CONFIG_CIFS_NFSD_EXPORT is not set -CONFIG_CIFS_POSIX=y -# CONFIG_CIFS_SMB2 is not set -CONFIG_CIFS_STATS=y -# CONFIG_CIFS_STATS2 is not set -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_XATTR is not set -# CONFIG_CLEANCACHE is not set -# CONFIG_CLKSRC_VERSATILE is not set -# CONFIG_CLK_QORIQ 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_CDCE925 is not set -# CONFIG_COMMON_CLK_IPROC 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_SI514 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_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_STAT_DETAILS 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_CPU_SW_DOMAIN_PAN=y -# 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_842 is not set -# 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_CHACHA20 is not set -# CONFIG_CRYPTO_CHACHA20POLY1305 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_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 -# 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_ECHAINIV 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_JITTERENTROPY is not set -# CONFIG_CRYPTO_KEYWRAP 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_POLY1305 is not set -# 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_RSA 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_ZLIB 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_CXL_EEH is not set -# CONFIG_CXL_KERNEL_API 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_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_CREDENTIALS is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_DEBUG_FS=y -# CONFIG_DEBUG_GPIO is not set -# CONFIG_DEBUG_HIGHMEM is not set -# CONFIG_DEBUG_ICEDCC is not set -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_INFO_DWARF4 is not set -CONFIG_DEBUG_INFO_REDUCED=y -# CONFIG_DEBUG_INFO_SPLIT is not set -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_KOBJECT_RELEASE is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_LL is not set -# CONFIG_DEBUG_LL_UART_8250 is not set -# CONFIG_DEBUG_LL_UART_PL01X is not set -# CONFIG_DEBUG_LOCKDEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_NX_TEST is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_PREEMPT is not set -# CONFIG_DEBUG_RODATA is not set -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -# CONFIG_DEBUG_SEMIHOSTING is not set -# CONFIG_DEBUG_SET_MODULE_RONX is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_SHIRQ is not set -# CONFIG_DEBUG_SLAB is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_STACKOVERFLOW is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set -# CONFIG_DEBUG_TIMEKEEPING is not set -# CONFIG_DEBUG_UART_BCM63XX is not set -# CONFIG_DEBUG_VM 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_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_RBTN is not set -# 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_DHT11 is not set -# 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_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_LOG_WRITES is not set -# CONFIG_DM_MQ_DEFAULT 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_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -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_DWMAC_IPQ806X is not set -# CONFIG_DWMAC_LPC18XX is not set -# CONFIG_DWMAC_MESON is not set -# CONFIG_DWMAC_ROCKCHIP is not set -# CONFIG_DWMAC_SOCFPGA is not set -# CONFIG_DWMAC_STI is not set -# CONFIG_DW_DMAC is not set -# CONFIG_DW_DMAC_PCI is not set -# CONFIG_DW_WATCHDOG 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_EARLY_PRINTK_8250 is not set -# CONFIG_ECHO is not set -# CONFIG_ECRYPT_FS is not set -# CONFIG_EDAC is not set -# CONFIG_EEEPC_LAPTOP 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_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_ENCX24J600 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_ETHERNET=y -# CONFIG_ETHOC is not set -CONFIG_EVENTFD=y -CONFIG_EXPERT=y -# CONFIG_EXPORTFS is not set -# CONFIG_EXT2_FS is not set -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT3_FS 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_USE_FOR_EXT2=y -# CONFIG_EXTCON is not set -# CONFIG_EXTCON_ADC_JACK is not set -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set -# CONFIG_EXTCON_USB_GPIO is not set -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_TARGETS="" -# CONFIG_EXYNOS_ADC is not set -# CONFIG_EXYNOS_VIDEO is not set -# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_F2FS_FS is not set -# CONFIG_F2FS_FS_ENCRYPTION 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_BIG_ENDIAN is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -# CONFIG_FB_BOTH_ENDIAN 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_LITTLE_ENDIAN 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_OMAP2 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_SM712 is not set -# CONFIG_FB_SM750 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_FPGA is not set -# 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_PQ_MDIO 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_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_ES is not set -# CONFIG_FUJITSU_LAPTOP is not set -# CONFIG_FUJITSU_TABLET is not set -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_FUSE_FS is not set -# CONFIG_FUSION is not set -# CONFIG_FUSION_FC is not set -# CONFIG_FUSION_SAS is not set -# CONFIG_FUSION_SPI is not set -CONFIG_FUTEX=y -CONFIG_FW_LOADER=y -CONFIG_FW_LOADER_USER_HELPER=y -CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y -CONFIG_GACT_PROB=y -# CONFIG_GADGET_UAC1 is not set -# CONFIG_GAMEPORT is not set -# CONFIG_GATEWORKS_GW16083 is not set -# CONFIG_GCOV is not set -# CONFIG_GCOV_KERNEL is not set -# CONFIG_GDB_SCRIPTS is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -CONFIG_GENERIC_CALIBRATE_DELAY=y -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_NET_UTILS=y -# CONFIG_GENERIC_PHY is not set -# CONFIG_GENEVE is not set -# CONFIG_GENWQE is not set -# CONFIG_GFS2_FS is not set -# CONFIG_GIGASET_CAPI is not set -# CONFIG_GIGASET_DEBUG is not set -# CONFIG_GLOB_SELFTEST is not set -# CONFIG_GP2AP020A00F is not set -# CONFIG_GPIOLIB is not set -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_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_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_GPIO_ZX is not set -# CONFIG_GREENASIA_FF is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_HAMACHI is not set -# CONFIG_HAMRADIO is not set -# CONFIG_HAPPYMEAL is not set -# CONFIG_HARDLOCKUP_DETECTOR is not set -# CONFIG_HAVE_AOUT is not set -# CONFIG_HAVE_ARM_ARCH_TIMER is not set -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_CAT=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -# CONFIG_HCALL_STATS is not set -# CONFIG_HDC100X 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_HI8435 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_CORSAIR 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_GEMBIRD is not set -# CONFIG_HID_GENERIC is not set -# CONFIG_HID_GFRM 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_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_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_RMI is not set -# CONFIG_HID_ROCCAT 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_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_HNS is not set -# CONFIG_HNS_DSAF is not set -# CONFIG_HNS_ENET 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_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_HP_ILO is not set -# CONFIG_HP_WIRELESS is not set -# CONFIG_HSI is not set -# CONFIG_HSR is not set -# CONFIG_HTC_EGPIO is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTU21 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_TPM is not set -# CONFIG_HW_RANDOM_VIA is not set -# CONFIG_HW_RANDOM_VIRTIO 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_24 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_CADENCE 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_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_EMEV2 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_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_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_MUX_REG 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_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_PROC_FS is not set -# CONFIG_IDE_TASK_IOCTL is not set -# CONFIG_IDLE_PAGE_TRACKING is not set -# CONFIG_IEEE802154 is not set -# CONFIG_IEEE802154_ATUSB 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_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_IMX_THERMAL 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_INIT_ENV_ARG_LIMIT=32 -# CONFIG_INLINE_READ_LOCK is not set -# CONFIG_INLINE_READ_LOCK_BH is not set -# CONFIG_INLINE_READ_LOCK_IRQ is not set -# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set -# CONFIG_INLINE_READ_TRYLOCK is not set -CONFIG_INLINE_READ_UNLOCK=y -# CONFIG_INLINE_READ_UNLOCK_BH is not set -CONFIG_INLINE_READ_UNLOCK_IRQ=y -# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set -# CONFIG_INLINE_SPIN_LOCK is not set -# CONFIG_INLINE_SPIN_LOCK_BH is not set -# CONFIG_INLINE_SPIN_LOCK_IRQ is not set -# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set -# CONFIG_INLINE_SPIN_TRYLOCK is not set -# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set -# CONFIG_INLINE_SPIN_UNLOCK_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_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_DRV2665_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set -# CONFIG_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_FF_MEMLESS is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_LEDS 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_PALMAS_PWRBUTTON 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_TPS65218_PWRBUTTON is not set -# CONFIG_INPUT_TWL4030_PWRBUTTON is not set -# CONFIG_INPUT_TWL4030_VIBRA is not set -# CONFIG_INPUT_TWL6040_VIBRA 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_IDMA64 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_INTEL_TH 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_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_RAW is not set -# CONFIG_IP6_NF_TARGET_HL 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_ILA 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_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 is not set -CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_MULTIPLE_TABLES=y -# CONFIG_IP_NF_ARPFILTER is not set -# CONFIG_IP_NF_ARPTABLES is not set -# CONFIG_IP_NF_ARP_MANGLE is not set -# CONFIG_IP_NF_FILTER is not set -# CONFIG_IP_NF_IPTABLES is not set -# CONFIG_IP_NF_MANGLE is not set -# CONFIG_IP_NF_MATCH_AH is not set -# CONFIG_IP_NF_MATCH_ECN is not set -# CONFIG_IP_NF_MATCH_RPFILTER is not set -# CONFIG_IP_NF_MATCH_TTL is not set -# CONFIG_IP_NF_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_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_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_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_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_IWLWIFI is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_JBD2_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_KASAN is not set -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_CAT 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_CAP11XX 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_SNVS_PWRKEY 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_TWL4030 is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_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_AMD is not set -# CONFIG_KVM_GUEST is not set -# CONFIG_KVM_INTEL 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_LANTIQ_PHY 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_BCM6328 is not set -# CONFIG_LEDS_BCM6358 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_INTEL_SS4200 is not set -# CONFIG_LEDS_LM3530 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_NS2 is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_SYSCON is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX 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_LGUEST 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_LIBNVDIMM is not set -# CONFIG_LIDAR_LITE_V2 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_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_LP_CONSOLE is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LTPC is not set -# CONFIG_LTR501 is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_LWTUNNEL is not set -# CONFIG_LXT_PHY is not set -# CONFIG_LZ4HC_COMPRESS is not set -# CONFIG_LZ4_COMPRESS is not set -# CONFIG_LZ4_DECOMPRESS is not set -CONFIG_LZMA_COMPRESS=y -CONFIG_LZMA_DECOMPRESS=y -# CONFIG_LZO_COMPRESS is not set -# CONFIG_LZO_DECOMPRESS is not set -# CONFIG_M62332 is not set -# CONFIG_MAC80211 is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_MACB is not set -# CONFIG_MACH_ASM9260 is not set -# CONFIG_MACH_DECSTATION is not set -# CONFIG_MACH_INGENIC is not set -# CONFIG_MACH_JAZZ is not set -# CONFIG_MACH_JZ4740 is not set -# CONFIG_MACH_LOONGSON32 is not set -# CONFIG_MACH_LOONGSON64 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_MACH_XILFPGA 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_MAGIC_SYSRQ_SERIAL is not set -# 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_MCP4531 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_MDIO_OCTEON 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_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_USB_SUPPORT is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_SAS is not set -CONFIG_MEMBARRIER=y -# 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_FLEXCOM 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_DA9062 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_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_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_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_MICROCHIP_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_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_MLXSW_CORE is not set -# CONFIG_MMA8452 is not set -# CONFIG_MMA9551 is not set -# CONFIG_MMA9553 is not set -# CONFIG_MMC is not set -# CONFIG_MMC35240 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_DEBUG is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_MTK 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_F_SDH30 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_AT91 is not set -# CONFIG_MMC_SDHCI_OF_ESDHC is not set -# CONFIG_MMC_SDHCI_OF_HLWD is not set -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_SDHCI_PXAV3 is not set -# CONFIG_MMC_SDRICOH_CS is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_TEST is not set -# CONFIG_MMC_TOSHIBA_PCI 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_MOST is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_ELAN_I2C 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_FOCALTECH 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_MS5637 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_AR7_PARTS 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_CMDLINE_PARTS is not set -CONFIG_MTD_COMPLEX_MAPPINGS=y -# CONFIG_MTD_DATAFLASH 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_BCH is not set -# CONFIG_MTD_NAND_BF5XX is not set -# CONFIG_MTD_NAND_BRCMNAND 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_DT is not set -# CONFIG_MTD_NAND_DENALI_PCI 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_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_MXC is not set -# CONFIG_MTD_NAND_NANDSIM is not set -# CONFIG_MTD_NAND_NDFC 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_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_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_TMIO is not set -# CONFIG_MTD_NAND_TXX9NDFMC 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_SPINAND_MT29F is not set -# CONFIG_MTD_SPI_NOR is not set -# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set -CONFIG_MTD_SPLIT=y -# CONFIG_MTD_SPLIT_BRNIMAGE_FW is not set -# CONFIG_MTD_SPLIT_EVA_FW is not set -# CONFIG_MTD_SPLIT_FIRMWARE is not set -CONFIG_MTD_SPLIT_FIRMWARE_NAME="firmware" -# CONFIG_MTD_SPLIT_FIT_FW is not set -# CONFIG_MTD_SPLIT_JIMAGE_FW is not set -# CONFIG_MTD_SPLIT_LZMA_FW is not set -# CONFIG_MTD_SPLIT_MINOR_FW is not set -# CONFIG_MTD_SPLIT_SEAMA_FW is not set -CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y -CONFIG_MTD_SPLIT_SUPPORT=y -# CONFIG_MTD_SPLIT_TPLINK_FW is not set -# CONFIG_MTD_SPLIT_TRX_FW is not set -# CONFIG_MTD_SPLIT_UIMAGE_FW is not set -# CONFIG_MTD_SPLIT_WRGG_FW is not set -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SWAP is not set -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_UBI is not set -# CONFIG_MTD_UIMAGE_SPLIT is not set -CONFIG_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_MVSWITCH_PHY is not set -# CONFIG_MWAVE is not set -# CONFIG_MWL8K is not set -# CONFIG_MXC4005 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_NETFILTER is not set -# CONFIG_NETFILTER_ADVANCED is not set -# CONFIG_NETFILTER_DEBUG is not set -# CONFIG_NETFILTER_INGRESS is not set -# CONFIG_NETFILTER_NETLINK is not set -# CONFIG_NETFILTER_NETLINK_ACCT is not set -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -# CONFIG_NETFILTER_NETLINK_LOG is not set -# CONFIG_NETFILTER_NETLINK_QUEUE 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_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_FLOWER 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_CANID 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_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_KEY is not set -# CONFIG_NET_KEY_MIGRATE is not set -# CONFIG_NET_L3_MASTER_DEV is not set -# CONFIG_NET_MPLS_GSO is not set -# CONFIG_NET_PACKET_ENGINE is not set -# CONFIG_NET_PKTGEN 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_AURORA=y -CONFIG_NET_VENDOR_BROADCOM=y -CONFIG_NET_VENDOR_BROCADE=y -CONFIG_NET_VENDOR_CAVIUM=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_EZCHIP=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_RENESAS=y -CONFIG_NET_VENDOR_ROCKER=y -CONFIG_NET_VENDOR_SAMSUNG=y -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -CONFIG_NET_VENDOR_SIS=y -CONFIG_NET_VENDOR_SMSC=y -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_NET_VENDOR_SUN=y -CONFIG_NET_VENDOR_SYNOPSYS=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=y -CONFIG_NET_VENDOR_XILINX=y -CONFIG_NET_VENDOR_XIRCOM=y -# CONFIG_NET_VRF is not set -# CONFIG_NET_XGENE is not set -CONFIG_NEW_LEDS=y -# CONFIG_NFC is not set -# CONFIG_NFSD 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_NFT_DUP_IPV4 is not set -# CONFIG_NFT_DUP_IPV6 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_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_DUP_IPV4 is not set -# CONFIG_NF_DUP_IPV6 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_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_NF_TABLES_NETDEV 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_NS83820 is not set -# CONFIG_NTB 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_NVM is not set -# CONFIG_NVMEM is not set -# CONFIG_NVMEM_IMX_OCOTP 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_OF_OVERLAY 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_OCP2SCP is not set -# CONFIG_OMAP_USB2 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_OPT3001 is not set -# CONFIG_ORION_WATCHDOG is not set -# CONFIG_OSF_PARTITION is not set -CONFIG_OVERLAY_FS=y -# CONFIG_OWL_LOADER is not set -# CONFIG_P54_COMMON is not set -# CONFIG_PA12203001 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_PANASONIC_LAPTOP 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_IMX 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_ALTERA 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_EVENTS is not set -# CONFIG_PERSISTENT_KEYRINGS is not set -# CONFIG_PHANTOM 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_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_PHY_QCOM_DWC3 is not set -# CONFIG_PHY_SAMSUNG_USB2 is not set -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_PID_NS is not set -CONFIG_PINCONF=y -# CONFIG_PINCTRL is not set -# CONFIG_PINCTRL_AMD 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_PKCS7_MESSAGE_PARSER is not set -# 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_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_WAKELOCKS is not set -# CONFIG_POSIX_MQUEUE is not set -# CONFIG_POWERCAP is not set -# CONFIG_POWER_AVS is not set -# CONFIG_POWER_RESET is not set -# CONFIG_POWER_RESET_BRCMSTB 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_PROC_CHILDREN 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_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_PUBLIC_KEY_ALGO_RSA 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_QCOM_SPMI_IADC is not set -# CONFIG_QCOM_SPMI_TEMP_ALARM is not set -# CONFIG_QCOM_SPMI_VADC is not set -# CONFIG_QED 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_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_RANDOM32_SELFTEST is not set -# CONFIG_RAPIDIO is not set -# CONFIG_RAS is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_RBTREE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set -CONFIG_RCU_EXPERT=y -CONFIG_RCU_FANOUT=32 -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_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_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_MT6311 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=y -# CONFIG_RFKILL_FULL is not set -# CONFIG_RFKILL_GPIO is not set -# CONFIG_RFKILL_INPUT is not set -# CONFIG_RFKILL_LEDS 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_RPR0521 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_RV8803 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_DRV_ZYNQMP 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_RTC_SYSTOHC_DEVICE="rtc0" -# 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_RTS5208 is not set -CONFIG_RT_MUTEXES=y -# 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_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_SC92031 is not set -# CONFIG_SCA3000 is not set -# CONFIG_SCACHE_DEBUGFS 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_HRTICK=y -# 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_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_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_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_SNIC is not set -# CONFIG_SCSI_SPI_ATTRS 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_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_SECTION_MISMATCH_WARN_ONLY=y -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -# CONFIG_SECURITY_DMESG_RESTRICT 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_DELL_SMM 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_MAX31790 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_TC74 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_INGENIC is not set -# CONFIG_SERIAL_8250_MANY_PORTS is not set -# CONFIG_SERIAL_8250_MID 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_RT288X is not set -CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -# 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_MAX310X 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_STM32 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_SG_SPLIT 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_SIGNALFD=y -# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set -# 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 is not set -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=y -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SLUB_DEBUG is not set -# CONFIG_SLUB_DEBUG_ON 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_EMU10K1_SEQ 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_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_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ 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_PCM_TIMER is not set -# CONFIG_SND_PCM_XRUN_DEBUG is not set -# 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_PROC_FS=y -# CONFIG_SND_RAWMIDI is not set -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME96 is not set -# CONFIG_SND_RME9652 is not set -# CONFIG_SND_RTCTIMER is not set -# CONFIG_SND_SB16 is not set -# CONFIG_SND_SB8 is not set -# CONFIG_SND_SBAWE is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_SE6X 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_AC97_CODEC 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_AK4613 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_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_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_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS4349 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_FSL_SSI is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_IMX_AUDMUX 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_BYTCR_RT5640_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH is not set -# CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH is not set -# CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH is not set -# CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set -# CONFIG_SND_SOC_INTEL_SST is not set -# CONFIG_SND_SOC_MEDIATEK 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_RT5677_SPI is not set -# CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -# CONFIG_SND_SOC_SPDIF is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM4567 is not set -# CONFIG_SND_SOC_STA32X is not set -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_STI_SAS is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TAS571X 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_SUN4I_CODEC 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_BRCMSTB 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_SONYPI is not set -# CONFIG_SONY_LAPTOP is not set -# CONFIG_SOUND is not set -# CONFIG_SOUND_OSS_CORE 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_OCTEON is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_ORION is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PPC4xx is not set -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_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_SPI_ZYNQMP_GQSPI is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_SPMI is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y -# CONFIG_SQUASHFS_DECOMP_SINGLE is not set -# CONFIG_SQUASHFS_EMBEDDED 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_SSB_DEBUG is not set -# CONFIG_SSB_DRIVER_GPIO is not set -# CONFIG_SSB_HOST_SOC is not set -# CONFIG_SSB_PCMCIAHOST is not set -CONFIG_SSB_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSFDC is not set -# CONFIG_STACKTRACE is not set -CONFIG_STACKTRACE_SUPPORT=y -# CONFIG_STACK_TRACER is not set -CONFIG_STAGING=y -# CONFIG_STAGING_BOARD is not set -# CONFIG_STAGING_MEDIA is not set -CONFIG_STANDALONE=y -# CONFIG_STATIC_KEYS_SELFTEST is not set -CONFIG_STDBINUTILS=y -# CONFIG_STE10XP is not set -# CONFIG_STE_MODEM_RPROC is not set -# CONFIG_STK3310 is not set -# CONFIG_STK8312 is not set -# CONFIG_STK8BA50 is not set -# CONFIG_STM is not set -# CONFIG_STMMAC_ETH is not set -# CONFIG_STMMAC_PCI is not set -# CONFIG_STMMAC_PLATFORM is not set -# CONFIG_STM_DUMMY is not set -# CONFIG_STM_SOURCE_CONSOLE is not set -CONFIG_STP=y -# CONFIG_STRICT_DEVMEM is not set -CONFIG_STRIP_ASM_SYMS=y -# 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_SUNXI_SRAM is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_SUSPEND is not set -# CONFIG_SUSPEND_SKIP_SYNC is not set -CONFIG_SWAP=y -# CONFIG_SWCONFIG is not set -# CONFIG_SWCONFIG_B53 is not set -# CONFIG_SWCONFIG_B53_SPI_DRIVER is not set -# CONFIG_SWCONFIG_LEDS is not set -# CONFIG_SX9500 is not set -# CONFIG_SXGBE_ETH is not set -# CONFIG_SYNCLINK_CS is not set -# CONFIG_SYNOPSYS_DWC_ETH_QOS is not set -CONFIG_SYN_COOKIES=y -CONFIG_SYSCTL=y -# CONFIG_SYSCTL_SYSCALL 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_DATA_VERIFICATION is not set -# CONFIG_SYSTEM_TRUSTED_KEYRING is not set -CONFIG_SYSTEM_TRUSTED_KEYS="" -# 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_TASK_XACCT is not set -# CONFIG_TC35815 is not set -# CONFIG_TCG_ATMEL is not set -# CONFIG_TCG_INFINEON is not set -# CONFIG_TCG_ST33_I2C is not set -# CONFIG_TCG_TIS is not set -# CONFIG_TCG_TIS_I2C_ATMEL is not set -# CONFIG_TCG_TIS_I2C_INFINEON is not set -# CONFIG_TCG_TIS_I2C_NUVOTON is not set -# CONFIG_TCG_TIS_ST33ZP24 is not set -# CONFIG_TCG_TPM is not set -# CONFIG_TCG_XEN is not set -# CONFIG_TCIC is not set -CONFIG_TCP_CONG_ADVANCED=y -# CONFIG_TCP_CONG_BIC is not set -# CONFIG_TCP_CONG_CDG 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_TERANETICS_PHY is not set -# CONFIG_TEST_BPF 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_POWER is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_TEST_USER_COPY is not set -CONFIG_TEXTSEARCH=y -# CONFIG_TEXTSEARCH_BM is not set -# CONFIG_TEXTSEARCH_FSM is not set -# CONFIG_TEXTSEARCH_KMP is not set -# CONFIG_THERMAL is not set -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_EMULATION is not set -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set -# CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_HWMON is not set -# CONFIG_THERMAL_WRITABLE_TRIPS 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_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX is not set -# CONFIG_TOUCHSCREEN_ELAN is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_FT6236 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_IMX6UL_TSC 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_ROHM_BU21023 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_TSC2004 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_WDT87XX_I2C 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_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_EVENTS_GPIO is not set -CONFIG_TRACING_SUPPORT=y -CONFIG_TRAD_SIGNALS=y -# CONFIG_TRANSPARENT_HUGEPAGE is not set -# CONFIG_TREE_RCU is not set -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_TRUSTED_KEYS is not set -# CONFIG_TSL2583 is not set -# CONFIG_TSL2x7x is not set -# CONFIG_TSL4531 is not set -# CONFIG_TSYS01 is not set -# CONFIG_TSYS02D is not set -# CONFIG_TTPCI_EEPROM is not set -CONFIG_TTY=y -# CONFIG_TTY_PRINTK is not set -# CONFIG_TUN is not set -# CONFIG_TUN_VNET_CROSS_LE is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL4030_MADC is not set -# CONFIG_TWL6030_GPADC is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_TYPHOON is not set -# CONFIG_UACCESS_WITH_MEMCPY is not set -# CONFIG_UBIFS_ATIME_SUPPORT 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_UID16=y -# CONFIG_UIO is not set -# CONFIG_ULTRA is not set -# CONFIG_ULTRIX_PARTITION is not set -CONFIG_UNIX=y -CONFIG_UNIX98_PTYS=y -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_UNIX_DIAG is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_UPROBES is not set -# CONFIG_UPROBE_EVENT is not set -# CONFIG_US5182D 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_HCD=y -CONFIG_USB_ARMLINUX=y -# CONFIG_USB_ATM is not set -# CONFIG_USB_BDC_UDC is not set -CONFIG_USB_BELKIN=y -# 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_DEFAULT_PERSIST=y -# CONFIG_USB_DSBR is not set -# CONFIG_USB_DUMMY_HCD is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_DWC2_DEBUG is not set -# CONFIG_USB_DWC2_DUAL_ROLE is not set -# CONFIG_USB_DWC2_HOST is not set -# CONFIG_USB_DWC2_PERIPHERAL is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC3_EXYNOS is not set -# CONFIG_USB_DWC3_KEYSTONE is not set -# CONFIG_USB_DWC3_PCI is not set -# CONFIG_USB_DWC3_QCOM is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_EG20T is not set -# CONFIG_USB_EHCI_ATH79 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_EPSON2888 is not set -# CONFIG_USB_EZUSB_FX2 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_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_IDMOUSE is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_IPHETH 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_LAN78XX is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_LEDS_TRIGGER_USBPORT is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_M5602 is not set -# CONFIG_USB_M66592 is not set -# CONFIG_USB_MASS_STORAGE is not set -# CONFIG_USB_MAX3421_HCD is not set -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_MOUSE is not set -# CONFIG_USB_MSM_OTG is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_MV_U3D is not set -# CONFIG_USB_MV_UDC is not set -# CONFIG_USB_MXS_PHY is not set -# CONFIG_USB_NET2272 is not set -# CONFIG_USB_NET2280 is not set -# CONFIG_USB_NET_AX88179_178A is not set -# CONFIG_USB_NET_AX8817X is not set -# CONFIG_USB_NET_CDCETHER is not set -# CONFIG_USB_NET_CDC_EEM is not set -# CONFIG_USB_NET_CDC_MBIM is not set -# CONFIG_USB_NET_CDC_NCM is not set -# CONFIG_USB_NET_CDC_SUBSET is not set -# CONFIG_USB_NET_CH9200 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_SSB is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_PHY is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_PWC_INPUT_EVDEV is not set -# CONFIG_USB_PXA27X is not set -# CONFIG_USB_R8A66597 is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_RENESAS_USBHS is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_RTL8152 is not set -# CONFIG_USB_S2255 is not set -# CONFIG_USB_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_GARMIN is not set -CONFIG_USB_SERIAL_GENERIC=y -# 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_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_SAFE is not set -CONFIG_USB_SERIAL_SAFE_PADDED=y -# 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_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_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_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_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_ULPI_BUS 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_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_USERFAULTFD 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_VHOST_CROSS_ENDIAN_LEGACY is not set -# CONFIG_VHOST_NET 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_CAFE_CCIC 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_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_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_OV2659 is not set -# CONFIG_VIDEO_OV7640 is not set -# CONFIG_VIDEO_OV7670 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_SH_MOBILE_CEU is not set -# CONFIG_VIDEO_SONY_BTF_MPX is not set -# CONFIG_VIDEO_SR030PC30 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_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_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_VZ89X 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_W83627HF_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_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_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set -# CONFIG_WL1251 is not set -# CONFIG_WL12XX is not set -# CONFIG_WL18XX is not set -CONFIG_WLAN=y -# CONFIG_WLCORE is not set -# CONFIG_WL_MEDIATEK is not set -CONFIG_WL_TI=y -CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y -# CONFIG_X25 is not set -# CONFIG_X509_CERTIFICATE_PARSER 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_XZ_DEC=y -# CONFIG_XZ_DEC_ARM is not set -# CONFIG_XZ_DEC_ARMTHUMB is not set -# CONFIG_XZ_DEC_BCJ is not set -# CONFIG_XZ_DEC_IA64 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_SPARC is not set -# CONFIG_XZ_DEC_TEST is not set -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_YAM is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_YENTA is not set -# CONFIG_YENTA_O2 is not set -# CONFIG_YENTA_RICOH is not set -# CONFIG_YENTA_TI is not set -# CONFIG_YENTA_TOSHIBA is not set -# CONFIG_ZBUD is not set -# CONFIG_ZD1211RW is not set -# CONFIG_ZD1211RW_DEBUG is not set -# CONFIG_ZEROPLUS_FF is not set -# CONFIG_ZISOFS is not set -# CONFIG_ZLIB_DEFLATE is not set -# CONFIG_ZLIB_INFLATE is not set -CONFIG_ZONE_DMA=y -CONFIG_ZONE_DMA_FLAG=1 -# CONFIG_ZPOOL is not set -# CONFIG_ZRAM is not set -# CONFIG_ZSMALLOC is not set diff --git a/target/linux/generic/config-4.9 b/target/linux/generic/config-4.9 index 2a76635b6..83abfdc8f 100644 --- a/target/linux/generic/config-4.9 +++ b/target/linux/generic/config-4.9 @@ -3767,7 +3767,7 @@ CONFIG_SCSI_PROC_FS=y CONFIG_SECTION_MISMATCH_WARN_ONLY=y # CONFIG_SECURITY is not set # CONFIG_SECURITYFS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set +CONFIG_SECURITY_DMESG_RESTRICT=y CONFIG_SELECT_MEMORY_MODEL=y # CONFIG_SENSORS_ABITUGURU is not set # CONFIG_SENSORS_ABITUGURU3 is not set diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c index 00ad68e0b..c21ad9425 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c @@ -319,9 +319,9 @@ EXPORT_SYMBOL_GPL(rtl8366_smi_rmwr); static int rtl8366_reset(struct rtl8366_smi *smi) { if (smi->hw_reset) { - smi->hw_reset(smi, true); + smi->hw_reset(true); msleep(RTL8366_SMI_HW_STOP_DELAY); - smi->hw_reset(smi, false); + smi->hw_reset(false); msleep(RTL8366_SMI_HW_START_DELAY); return 0; } @@ -1300,7 +1300,7 @@ static int __rtl8366_smi_init(struct rtl8366_smi *smi, const char *name) /* start the switch */ if (smi->hw_reset) { - smi->hw_reset(smi, false); + smi->hw_reset(false); msleep(RTL8366_SMI_HW_START_DELAY); } @@ -1315,7 +1315,7 @@ static int __rtl8366_smi_init(struct rtl8366_smi *smi, const char *name) static void __rtl8366_smi_cleanup(struct rtl8366_smi *smi) { if (smi->hw_reset) - smi->hw_reset(smi, true); + smi->hw_reset(true); gpio_free(smi->gpio_sck); gpio_free(smi->gpio_sda); @@ -1425,14 +1425,6 @@ void rtl8366_smi_cleanup(struct rtl8366_smi *smi) EXPORT_SYMBOL_GPL(rtl8366_smi_cleanup); #ifdef CONFIG_OF -static void rtl8366_smi_reset(struct rtl8366_smi *smi, bool active) -{ - if (active) - reset_control_assert(smi->reset); - else - reset_control_deassert(smi->reset); -} - int rtl8366_smi_probe_of(struct platform_device *pdev, struct rtl8366_smi *smi) { int sck = of_get_named_gpio(pdev->dev.of_node, "gpio-sck", 0); @@ -1445,9 +1437,6 @@ int rtl8366_smi_probe_of(struct platform_device *pdev, struct rtl8366_smi *smi) smi->gpio_sda = sda; smi->gpio_sck = sck; - smi->reset = devm_reset_control_get(&pdev->dev, "switch"); - if (!IS_ERR(smi->reset)) - smi->hw_reset = rtl8366_smi_reset; return 0; } diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h index e5f34bf9c..4bb9e9a66 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h +++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h @@ -14,7 +14,6 @@ #include #include #include -#include struct rtl8366_smi_ops; struct rtl8366_vlan_ops; @@ -34,7 +33,7 @@ struct rtl8366_smi { struct device *parent; unsigned int gpio_sda; unsigned int gpio_sck; - void (*hw_reset)(struct rtl8366_smi *smi, bool active); + void (*hw_reset)(bool active); unsigned int clk_delay; /* ns */ u8 cmd_read; u8 cmd_write; @@ -55,9 +54,6 @@ struct rtl8366_smi { int vlan4k_enabled; char buf[4096]; - - struct reset_control *reset; - #ifdef CONFIG_RTL8366_SMI_DEBUG_FS struct dentry *debugfs_root; u16 dbg_reg; diff --git a/target/linux/generic/files/include/linux/ar8216_platform.h b/target/linux/generic/files/include/linux/ar8216_platform.h index 466b3b5b4..24bc442a2 100644 --- a/target/linux/generic/files/include/linux/ar8216_platform.h +++ b/target/linux/generic/files/include/linux/ar8216_platform.h @@ -120,7 +120,6 @@ struct ar8327_platform_data { struct ar8327_pad_cfg *pad6_cfg; struct ar8327_sgmii_cfg *sgmii_cfg; struct ar8327_port_cfg port0_cfg; - struct ar8327_port_cfg port5_cfg; struct ar8327_port_cfg port6_cfg; struct ar8327_led_cfg *led_cfg; diff --git a/target/linux/generic/files/include/linux/rtl8366.h b/target/linux/generic/files/include/linux/rtl8366.h index e3ce8f536..78daed220 100644 --- a/target/linux/generic/files/include/linux/rtl8366.h +++ b/target/linux/generic/files/include/linux/rtl8366.h @@ -15,8 +15,6 @@ #define RTL8366S_DRIVER_NAME "rtl8366s" #define RTL8366RB_DRIVER_NAME "rtl8366rb" -struct rtl8366_smi; - enum rtl8366_type { RTL8366_TYPE_UNKNOWN, RTL8366_TYPE_S, @@ -31,7 +29,7 @@ struct rtl8366_initval { struct rtl8366_platform_data { unsigned gpio_sda; unsigned gpio_sck; - void (*hw_reset)(struct rtl8366_smi *smi, bool active); + void (*hw_reset)(bool active); unsigned num_initvals; struct rtl8366_initval *initvals; diff --git a/target/linux/generic/files/include/linux/switch.h b/target/linux/generic/files/include/linux/switch.h index 5cf52c512..4e6238470 100644 --- a/target/linux/generic/files/include/linux/switch.h +++ b/target/linux/generic/files/include/linux/switch.h @@ -45,9 +45,6 @@ enum switch_port_speed { SWITCH_PORT_SPEED_10 = 10, SWITCH_PORT_SPEED_100 = 100, SWITCH_PORT_SPEED_1000 = 1000, - SWITCH_PORT_SPEED_2500 = 2500, - SWITCH_PORT_SPEED_5000 = 5000, - SWITCH_PORT_SPEED_10000 = 10000, }; struct switch_port_link { diff --git a/target/linux/generic/hack-4.14/207-disable-modorder.patch b/target/linux/generic/hack-4.14/207-disable-modorder.patch index 5fb956c98..8e920d1c5 100644 --- a/target/linux/generic/hack-4.14/207-disable-modorder.patch +++ b/target/linux/generic/hack-4.14/207-disable-modorder.patch @@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau --- a/Makefile +++ b/Makefile -@@ -1227,7 +1227,6 @@ all: modules +@@ -1228,7 +1228,6 @@ all: modules PHONY += modules modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost -@@ -1256,7 +1255,6 @@ _modinst_: +@@ -1257,7 +1256,6 @@ _modinst_: rm -f $(MODLIB)/build ; \ ln -s $(CURDIR) $(MODLIB)/build ; \ fi diff --git a/target/linux/generic/hack-4.14/211-host_tools_portability.patch b/target/linux/generic/hack-4.14/211-host_tools_portability.patch index 59f147943..d806df8a5 100644 --- a/target/linux/generic/hack-4.14/211-host_tools_portability.patch +++ b/target/linux/generic/hack-4.14/211-host_tools_portability.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/tools/build/Build.include +++ b/tools/build/Build.include -@@ -97,4 +97,4 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$ +@@ -98,4 +98,4 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$ ### ## HOSTCC C flags diff --git a/target/linux/generic/hack-4.14/220-gc_sections.patch b/target/linux/generic/hack-4.14/220-gc_sections.patch index 7fd493d2f..cdca0bdb5 100644 --- a/target/linux/generic/hack-4.14/220-gc_sections.patch +++ b/target/linux/generic/hack-4.14/220-gc_sections.patch @@ -33,7 +33,7 @@ Signed-off-by: Gabor Juhos # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) -@@ -781,11 +786,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH +@@ -782,11 +787,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif diff --git a/target/linux/generic/hack-4.14/650-netfilter-add-xt_OFFLOAD-target.patch b/target/linux/generic/hack-4.14/650-netfilter-add-xt_OFFLOAD-target.patch index 418ea469e..84ae4affe 100644 --- a/target/linux/generic/hack-4.14/650-netfilter-add-xt_OFFLOAD-target.patch +++ b/target/linux/generic/hack-4.14/650-netfilter-add-xt_OFFLOAD-target.patch @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau depends on !NF_CONNTRACK || NF_CONNTRACK --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig -@@ -69,7 +69,6 @@ config NFT_FIB_IPV6 +@@ -97,7 +97,6 @@ config NFT_FIB_IPV6 multicast or blackhole. endif # NF_TABLES_IPV6 @@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau config NF_FLOW_TABLE_IPV6 tristate "Netfilter flow table IPv6 module" -@@ -79,6 +78,8 @@ config NF_FLOW_TABLE_IPV6 +@@ -107,6 +106,8 @@ config NF_FLOW_TABLE_IPV6 To compile it as a module, choose M here. @@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o --- /dev/null +++ b/net/netfilter/xt_FLOWOFFLOAD.c -@@ -0,0 +1,368 @@ +@@ -0,0 +1,365 @@ +/* + * Copyright (C) 2018 Felix Fietkau + * @@ -326,9 +326,6 @@ Signed-off-by: Felix Fietkau + if (!this_dst || !other_dst) + return -ENOENT; + -+ if (dst_xfrm(this_dst) || dst_xfrm(other_dst)) -+ return -EINVAL; -+ + route->tuple[dir].dst = this_dst; + route->tuple[dir].ifindex = xt_in(par)->ifindex; + route->tuple[!dir].dst = other_dst; diff --git a/target/linux/generic/hack-4.14/710-phy-add-mdio_register_board_info.patch b/target/linux/generic/hack-4.14/710-phy-add-mdio_register_board_info.patch deleted file mode 100644 index 12537d225..000000000 --- a/target/linux/generic/hack-4.14/710-phy-add-mdio_register_board_info.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- a/drivers/net/phy/mdio-boardinfo.c -+++ b/drivers/net/phy/mdio-boardinfo.c -@@ -15,8 +15,10 @@ - - #include "mdio-boardinfo.h" - --static LIST_HEAD(mdio_board_list); --static DEFINE_MUTEX(mdio_board_lock); -+LIST_HEAD(mdio_board_list); -+EXPORT_SYMBOL_GPL(mdio_board_list); -+DEFINE_MUTEX(mdio_board_lock); -+EXPORT_SYMBOL_GPL(mdio_board_lock); - - /** - * mdiobus_setup_mdiodev_from_board_info - create and setup MDIO devices ---- a/drivers/net/phy/mdio-boardinfo.h -+++ b/drivers/net/phy/mdio-boardinfo.h -@@ -15,6 +15,12 @@ struct mdio_board_entry { - 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; -+ - void mdiobus_setup_mdiodev_from_board_info(struct mii_bus *bus, - int (*cb) - (struct mii_bus *bus, ---- a/drivers/net/phy/mdio_bus.c -+++ b/drivers/net/phy/mdio_bus.c -@@ -88,6 +88,8 @@ bool mdiobus_is_registered_device(struct mii_bus *bus, int addr) - } - EXPORT_SYMBOL(mdiobus_is_registered_device); - -+#include "mdio-boardinfo.h" -+ - /** - * mdiobus_alloc_size - allocate a mii_bus structure - * @size: extra amount of memory to allocate for private storage. -@@ -455,6 +457,17 @@ 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->mdio_addr != phydev->mdio.addr) -+ return; -+ -+ phydev->mdio.dev.platform_data = (void *) bi->platform_data; -+} -+ - /** - * mdiobus_scan - scan a bus for MDIO devices. - * @bus: mii_bus to scan -@@ -470,6 +483,7 @@ EXPORT_SYMBOL(mdiobus_free); - 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); -@@ -482,6 +496,12 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) - */ - of_mdiobus_link_mdiodev(bus, &phydev->mdio); - -+ 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); diff --git a/target/linux/generic/hack-4.14/721-phy_packets.patch b/target/linux/generic/hack-4.14/721-phy_packets.patch index 8ce2ea48d..86ff0fe12 100644 --- a/target/linux/generic/hack-4.14/721-phy_packets.patch +++ b/target/linux/generic/hack-4.14/721-phy_packets.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2492,6 +2492,10 @@ static inline int pskb_trim(struct sk_buff *skb, unsigned int len) +@@ -2491,6 +2491,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -2622,16 +2626,6 @@ static inline struct sk_buff *dev_alloc_skb(unsigned int length) +@@ -2621,16 +2625,6 @@ static inline struct sk_buff *dev_alloc_ } @@ -101,9 +101,9 @@ Signed-off-by: Felix Fietkau help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -2988,10 +2988,20 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev, - dev_queue_xmit_nit(skb, dev); - } +@@ -2982,10 +2982,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); @@ -136,7 +136,7 @@ Signed-off-by: Felix Fietkau #include #include -@@ -499,6 +500,22 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, +@@ -499,6 +500,22 @@ skb_fail: } EXPORT_SYMBOL(__napi_alloc_skb); @@ -161,7 +161,7 @@ Signed-off-by: Felix Fietkau { --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c -@@ -172,6 +172,12 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) +@@ -172,6 +172,12 @@ __be16 eth_type_trans(struct sk_buff *sk const struct ethhdr *eth; skb->dev = dev; diff --git a/target/linux/generic/hack-4.14/773-bgmac-add-srab-switch.patch b/target/linux/generic/hack-4.14/773-bgmac-add-srab-switch.patch index 16d798db4..33a18a835 100644 --- a/target/linux/generic/hack-4.14/773-bgmac-add-srab-switch.patch +++ b/target/linux/generic/hack-4.14/773-bgmac-add-srab-switch.patch @@ -14,7 +14,7 @@ Signed-off-by: Hauke Mehrtens --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -268,6 +268,7 @@ static int bgmac_probe(struct bcma_device *core) +@@ -268,6 +268,7 @@ static int bgmac_probe(struct bcma_devic bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; diff --git a/target/linux/generic/hack-4.14/902-debloat_proc.patch b/target/linux/generic/hack-4.14/902-debloat_proc.patch index 16749dcd7..65789d1b8 100644 --- a/target/linux/generic/hack-4.14/902-debloat_proc.patch +++ b/target/linux/generic/hack-4.14/902-debloat_proc.patch @@ -29,7 +29,7 @@ Signed-off-by: Felix Fietkau --- a/fs/locks.c +++ b/fs/locks.c -@@ -2805,6 +2805,8 @@ static const struct file_operations proc_locks_operations = { +@@ -2805,6 +2805,8 @@ static const struct file_operations proc static int __init proc_locks_init(void) { @@ -51,7 +51,7 @@ Signed-off-by: Felix Fietkau + 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_consoles_operations = { +@@ -106,6 +106,9 @@ static const struct file_operations proc static int __init proc_consoles_init(void) { @@ -63,7 +63,7 @@ Signed-off-by: Felix Fietkau } --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c -@@ -145,7 +145,10 @@ static const struct file_operations proc_tty_drivers_operations = { +@@ -145,7 +145,10 @@ static const struct file_operations proc void proc_tty_register_driver(struct tty_driver *driver) { struct proc_dir_entry *ent; @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau if (!driver->driver_name || driver->proc_entry || !driver->ops->proc_fops) return; -@@ -162,6 +165,9 @@ void proc_tty_unregister_driver(struct tty_driver *driver) +@@ -162,6 +165,9 @@ void proc_tty_unregister_driver(struct t { struct proc_dir_entry *ent; @@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau ent = driver->proc_entry; if (!ent) return; -@@ -176,6 +182,9 @@ void proc_tty_unregister_driver(struct tty_driver *driver) +@@ -176,6 +182,9 @@ void proc_tty_unregister_driver(struct t */ void __init proc_tty_init(void) { @@ -166,7 +166,7 @@ Signed-off-by: Felix Fietkau " 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 -@@ -141,6 +141,9 @@ void __init ipc_init_proc_interface(const char *path, const char *header, +@@ -141,6 +141,9 @@ void __init ipc_init_proc_interface(cons struct proc_dir_entry *pde; struct ipc_proc_iface *iface; @@ -178,7 +178,7 @@ Signed-off-by: Felix Fietkau return; --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c -@@ -42,6 +42,8 @@ static const struct file_operations execdomains_proc_fops = { +@@ -42,6 +42,8 @@ static const struct file_operations exec static int __init proc_execdomains_init(void) { @@ -189,7 +189,7 @@ Signed-off-by: Felix Fietkau } --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c -@@ -396,6 +396,9 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) +@@ -396,6 +396,9 @@ void register_irq_proc(unsigned int irq, void __maybe_unused *irqp = (void *)(unsigned long) irq; char name [MAX_NAMELEN]; @@ -199,7 +199,7 @@ Signed-off-by: Felix Fietkau if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) return; -@@ -449,6 +452,9 @@ void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) +@@ -449,6 +452,9 @@ void unregister_irq_proc(unsigned int ir { char name [MAX_NAMELEN]; @@ -221,7 +221,7 @@ Signed-off-by: Felix Fietkau if (!root_irq_dir) --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c -@@ -389,6 +389,8 @@ static int __init init_timer_list_procfs(void) +@@ -389,6 +389,8 @@ static int __init init_timer_list_procfs { struct proc_dir_entry *pe; @@ -232,7 +232,7 @@ Signed-off-by: Felix Fietkau return -ENOMEM; --- a/mm/vmalloc.c +++ b/mm/vmalloc.c -@@ -2769,6 +2769,8 @@ static const struct file_operations proc_vmalloc_operations = { +@@ -2770,6 +2770,8 @@ static const struct file_operations proc static int __init proc_vmalloc_init(void) { @@ -243,7 +243,7 @@ Signed-off-by: Felix Fietkau } --- a/mm/vmstat.c +++ b/mm/vmstat.c -@@ -1946,10 +1946,12 @@ void __init init_mm_internals(void) +@@ -1944,10 +1944,12 @@ void __init init_mm_internals(void) start_shepherd_timer(); #endif #ifdef CONFIG_PROC_FS @@ -271,7 +271,7 @@ Signed-off-by: Felix Fietkau 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 *net) +@@ -146,6 +149,9 @@ int __net_init vlan_proc_init(struct net { struct vlan_net *vn = net_generic(net, vlan_net_id); @@ -283,7 +283,7 @@ Signed-off-by: Felix Fietkau goto err; --- a/net/core/net-procfs.c +++ b/net/core/net-procfs.c -@@ -320,10 +320,12 @@ static int __net_init dev_proc_net_init(struct net *net) +@@ -320,10 +320,12 @@ static int __net_init dev_proc_net_init( if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops)) goto out; @@ -298,7 +298,7 @@ Signed-off-by: Felix Fietkau goto out_softnet; if (wext_proc_init(net)) -@@ -332,9 +334,11 @@ static int __net_init dev_proc_net_init(struct net *net) +@@ -332,9 +334,11 @@ static int __net_init dev_proc_net_init( out: return rc; out_ptype: @@ -312,7 +312,7 @@ Signed-off-by: Felix Fietkau out_dev: remove_proc_entry("dev", net->proc_net); goto out; -@@ -344,8 +348,10 @@ static void __net_exit dev_proc_net_exit(struct net *net) +@@ -344,8 +348,10 @@ static void __net_exit dev_proc_net_exit { wext_proc_exit(net); @@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -3378,6 +3378,8 @@ static __net_initdata struct pernet_operations proto_net_ops = { +@@ -3378,6 +3378,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { @@ -338,7 +338,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -2731,10 +2731,12 @@ static const struct file_operations fib_route_fops = { +@@ -2731,10 +2731,12 @@ static const struct file_operations fib_ int __net_init fib_proc_init(struct net *net) { @@ -353,7 +353,7 @@ Signed-off-by: Felix Fietkau &fib_triestat_fops)) goto out2; -@@ -2744,17 +2746,21 @@ int __net_init fib_proc_init(struct net *net) +@@ -2744,17 +2746,21 @@ int __net_init fib_proc_init(struct net return 0; out3: @@ -381,7 +381,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c -@@ -557,6 +557,9 @@ static __net_initdata struct pernet_operations ip_proc_ops = { +@@ -557,6 +557,9 @@ static __net_initdata struct pernet_oper int __init ip_misc_proc_init(void) { @@ -393,7 +393,7 @@ Signed-off-by: Felix Fietkau --- a/net/ipv4/route.c +++ b/net/ipv4/route.c -@@ -427,6 +427,9 @@ static struct pernet_operations ip_rt_proc_ops __net_initdata = { +@@ -427,6 +427,9 @@ static struct pernet_operations ip_rt_pr static int __init ip_rt_proc_init(void) { diff --git a/target/linux/generic/hack-4.14/904-debloat_dma_buf.patch b/target/linux/generic/hack-4.14/904-debloat_dma_buf.patch index e71590933..4d9f947ed 100644 --- a/target/linux/generic/hack-4.14/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-4.14/904-debloat_dma_buf.patch @@ -54,7 +54,7 @@ Signed-off-by: Felix Fietkau +MODULE_LICENSE("GPL"); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -2147,6 +2147,7 @@ int wake_up_state(struct task_struct *p, +@@ -2164,6 +2164,7 @@ int wake_up_state(struct task_struct *p, { return try_to_wake_up(p, state, 0); } diff --git a/target/linux/generic/hack-4.14/940-cleanup-offload-hooks-on-netdev-unregister.patch b/target/linux/generic/hack-4.14/940-cleanup-offload-hooks-on-netdev-unregister.patch new file mode 100644 index 000000000..833d9f991 --- /dev/null +++ b/target/linux/generic/hack-4.14/940-cleanup-offload-hooks-on-netdev-unregister.patch @@ -0,0 +1,91 @@ +From ae56e27e30122f82d244f9eb35fcab8fa60e0d31 Mon Sep 17 00:00:00 2001 +From: Chen Minqiang +Date: Sun, 29 Apr 2018 14:08:57 +0800 +Subject: [PATCH] cleanup offload hooks on netdev unregister + +This should fix crashdump on reboot when FLOWOFFLOAD enabled + +kmsg: +[ 84.188081] Workqueue: events_power_efficient xt_flowoffload_hook_work [xt_FLOWOFFLOAD] +[ 84.209326] task: ffff88000ecd0c80 task.stack: ffffc90000068000 +[ 84.224706] RIP: 0010:__nf_unregister_net_hook+0x1/0x90 +[ 84.242911] RSP: 0018:ffffc9000006be30 EFLAGS: 00010202 +[ 84.257405] RAX: 0000000000000000 RBX: ffff88000c5b3228 RCX: 0000000100170001 +[ 84.292175] RDX: ffff88000ecd0c80 RSI: ffff88000c5b3228 RDI: 6b6b6b6b6b6b6b6b +[ 84.305095] RBP: ffffc9000006be58 R08: ffff88000c5b3578 R09: ffff88000c5b3538 +[ 84.325980] R10: ffffc9000006be50 R11: ffff88000fc1f310 R12: ffffffff81e6c580 +[ 84.396514] R13: ffff88000d1723d0 R14: ffff88000ec0fc00 R15: 0000000000000000 +[ 84.459500] FS: 0000000000000000(0000) GS:ffff88000fc00000(0000) knlGS:0000000000000000 +[ 84.525121] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 84.565460] CR2: 0000000000a931d8 CR3: 0000000001e08006 CR4: 00000000000606f0 +[ 84.638311] Call Trace: +[ 84.655229] ? nf_unregister_net_hook+0x88/0xd0 +[ 84.706898] xt_flowoffload_hook_work+0x12a/0x17a [xt_FLOWOFFLOAD] +[ 84.765504] process_one_work+0x1c4/0x310 +[ 84.799558] worker_thread+0x20b/0x3c0 +[ 84.850119] kthread+0x112/0x120 +[ 84.884839] ? process_one_work+0x310/0x310 +[ 84.923571] ? kthread_create_on_node+0x40/0x40 +[ 84.966100] ret_from_fork+0x35/0x40 +[ 84.981738] Code: 41 5c 41 5d 41 5e 41 5f 5d c3 48 8b 05 c1 f1 99 00 55 48 89 e5 48 85 c0 75 02 0f 0b e8 b9 f6 30 00 5d c3 0f 1f 80 00 00 00 00 55 <0f> b7 0f 48 89 e5 48 89 c8 48 c1 e0 04 48 8d 54 07 08 31 c0 eb +[ 85.100453] RIP: __nf_unregister_net_hook+0x1/0x90 RSP: ffffc9000006be30 +[ 85.111658] ---[ end trace 5c25a390045cac75 ]--- +[ 85.124535] Kernel panic - not syncing: Fatal exception + +Signed-off-by: Chen Minqiang +--- + net/netfilter/xt_FLOWOFFLOAD.c | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +--- a/net/netfilter/xt_FLOWOFFLOAD.c ++++ b/net/netfilter/xt_FLOWOFFLOAD.c +@@ -337,10 +337,41 @@ static void xt_flowoffload_table_cleanup + nf_flow_table_free(table); + } + ++static int flow_offload_netdev_event(struct notifier_block *this, ++ unsigned long event, void *ptr) ++{ ++ struct xt_flowoffload_hook *hook = NULL; ++ struct net_device *dev = netdev_notifier_info_to_dev(ptr); ++ ++ if (event != NETDEV_UNREGISTER) ++ return NOTIFY_DONE; ++ ++ spin_lock_bh(&hooks_lock); ++ hook = flow_offload_lookup_hook(dev); ++ if (hook) { ++ hlist_del(&hook->list); ++ } ++ spin_unlock_bh(&hooks_lock); ++ if (hook) { ++ nf_unregister_net_hook(hook->net, &hook->ops); ++ kfree(hook); ++ } ++ ++ nf_flow_table_cleanup(dev_net(dev), dev); ++ ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block flow_offload_netdev_notifier = { ++ .notifier_call = flow_offload_netdev_event, ++}; ++ + static int __init xt_flowoffload_tg_init(void) + { + int ret; + ++ register_netdevice_notifier(&flow_offload_netdev_notifier); ++ + INIT_DELAYED_WORK(&hook_work, xt_flowoffload_hook_work); + + ret = xt_flowoffload_table_init(&nf_flowtable); +@@ -358,6 +389,7 @@ static void __exit xt_flowoffload_tg_exi + { + xt_unregister_target(&offload_tg_reg); + xt_flowoffload_table_cleanup(&nf_flowtable); ++ unregister_netdevice_notifier(&flow_offload_netdev_notifier); + } + + MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/hack-4.4/950-net-patch-linux-kernel-to-support-shortcut-fe.patch b/target/linux/generic/hack-4.4/950-net-patch-linux-kernel-to-support-shortcut-fe.patch deleted file mode 100644 index a410015e2..000000000 --- a/target/linux/generic/hack-4.4/950-net-patch-linux-kernel-to-support-shortcut-fe.patch +++ /dev/null @@ -1,145 +0,0 @@ -From ee0b636607a8685dcac16b217ee49432de171cb0 Mon Sep 17 00:00:00 2001 -From: Xiaoping Fan -Date: Fri, 26 Feb 2016 15:01:53 -0800 -Subject: [PATCH 1/3] net: patch linux kernel to support shortcut-fe - -1, add a new flag 'fast_forwarded' in skb structure. -2, put a hook in '__netif_receive_skb_core' to - deliver packet to shortcut-fe. - -Change-Id: Icaa7c172a06df1c3bc89ff89814d1136772fe217 -Signed-off-by: Xiaoping Fan - -msm: ipq806x: exporting TCP sequence check parameters - -This is for use in NSS connection manager. - -Change-Id: I01d30c0ab552308c439353c0d51d3d0ab3aa7699 -Signed-off-by: Pamidipati, Vijay -Signed-off-by: Murat Sezgin ---- - include/linux/skbuff.h | 5 +++++ - net/Kconfig | 3 +++ - net/core/dev.c | 27 +++++++++++++++++++++++++++ - net/netfilter/nf_conntrack_proto_tcp.c | 10 ++++++++++ - 4 files changed, 45 insertions(+) - -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h -index a4b1aaa..f72eea2 100644 ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -643,7 +643,12 @@ struct sk_buff { - __u8 inner_protocol_type:1; - __u8 remcsum_offload:1; - __u8 gro_skip:1; -+#ifdef CONFIG_SHORTCUT_FE -+ __u8 fast_forwarded:1; -+ /* 1 or 3 bit hole */ -+#else - /* 2 or 4 bit hole */ -+#endif - - #ifdef CONFIG_NET_SCHED - __u16 tc_index; /* traffic control index */ -diff --git a/net/Kconfig b/net/Kconfig -index 6dedbb5..e8c6e6c 100644 ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -397,3 +397,6 @@ endif # if NET - # Used by archs to tell that they support BPF_JIT - config HAVE_BPF_JIT - bool -+ -+config SHORTCUT_FE -+ bool "Enables kernel network stack path for Shortcut Forwarding Engine" -diff --git a/net/core/dev.c b/net/core/dev.c -index 11b9cda..3761691 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -2732,8 +2732,17 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev, - unsigned int len; - int rc; - -+#ifdef CONFIG_SHORTCUT_FE -+ /* If this skb has been fast forwarded then we don't want it to -+ * go to any taps (by definition we're trying to bypass them). -+ */ -+ if (!skb->fast_forwarded) { -+#endif - if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) - dev_queue_xmit_nit(skb, dev); -+#ifdef CONFIG_SHORTCUT_FE -+ } -+#endif - - #ifdef CONFIG_ETHERNET_PACKET_MANGLE - if (!dev->eth_mangle_tx || -@@ -3825,6 +3834,11 @@ void netdev_rx_handler_unregister(struct net_device *dev) - } - EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); - -+#ifdef CONFIG_SHORTCUT_FE -+int (*fast_nat_recv)(struct sk_buff *skb) __rcu __read_mostly; -+EXPORT_SYMBOL_GPL(fast_nat_recv); -+#endif -+ - /* - * Limit the use of PFMEMALLOC reserves to those protocols that implement - * the special handling of PFMEMALLOC skbs. -@@ -3867,6 +3881,9 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc) - bool deliver_exact = false; - int ret = NET_RX_DROP; - __be16 type; -+#ifdef CONFIG_SHORTCUT_FE -+ int (*fast_recv)(struct sk_buff *skb); -+#endif - - net_timestamp_check(!netdev_tstamp_prequeue, skb); - -@@ -3893,6 +3910,16 @@ another_round: - goto out; - } - -+#ifdef CONFIG_SHORTCUT_FE -+ fast_recv = rcu_dereference(fast_nat_recv); -+ if (fast_recv) { -+ if (fast_recv(skb)) { -+ ret = NET_RX_SUCCESS; -+ goto out; -+ } -+ } -+#endif -+ - #ifdef CONFIG_NET_CLS_ACT - if (skb->tc_verd & TC_NCLS) { - skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); -diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c -index d41fdab..6f3cdfd 100644 ---- a/net/netfilter/nf_conntrack_proto_tcp.c -+++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -34,12 +34,22 @@ - #include - - /* Do not check the TCP window for incoming packets */ -+#ifdef CONFIG_SHORTCUT_FE -+int nf_ct_tcp_no_window_check __read_mostly = 0; -+EXPORT_SYMBOL_GPL(nf_ct_tcp_no_window_check); -+#else - static int nf_ct_tcp_no_window_check __read_mostly = 1; -+#endif - - /* "Be conservative in what you do, - be liberal in what you accept from others." - If it's non-zero, we mark only out of window RST segments as INVALID. */ -+#ifdef CONFIG_SHORTCUT_FE -+int nf_ct_tcp_be_liberal __read_mostly; -+EXPORT_SYMBOL_GPL(nf_ct_tcp_be_liberal); -+#else - static int nf_ct_tcp_be_liberal __read_mostly = 0; -+#endif - - /* If it is set to zero, we disable picking up already established - connections. */ --- -2.7.4 - diff --git a/target/linux/generic/hack-4.4/951-bridge-Add-new-bridge-APIs-needed-for-network-HW-acc.patch b/target/linux/generic/hack-4.4/951-bridge-Add-new-bridge-APIs-needed-for-network-HW-acc.patch deleted file mode 100644 index 315314327..000000000 --- a/target/linux/generic/hack-4.4/951-bridge-Add-new-bridge-APIs-needed-for-network-HW-acc.patch +++ /dev/null @@ -1,74 +0,0 @@ -From b24526cad8642f974d3c3c440824ecca68ebd9f0 Mon Sep 17 00:00:00 2001 -From: Murat Sezgin -Date: Tue, 25 Nov 2014 17:22:24 -0800 -Subject: [PATCH 2/3] bridge: Add new bridge APIs needed for network HW - acceleration - -Bridge acceleration hardware needs to perform certain operations, - currently unsupported by the existing bridge code: - - ** cut ** - - *update bridge interface statistics from outside the bridge code: - once acceleration is enabled on a connection, packets will not flow - through the host CPU, so we need the hardware accelerator driver to - maintain the statistics on the host and update them and add whatever - flows through the hardware. - These change adds the corresponding functions, and make it available - to other through EXPORT_SYMBOLS(). - -Change-Id: I67afb325796004053897d9916e2df91827b65139 -Signed-off-by: Murat Sezgin ---- - include/linux/if_bridge.h | 2 ++ - net/bridge/br_if.c | 24 ++++++++++++++++++++++++ - 2 files changed, 26 insertions(+) - -diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h -index ef5661b..de79c00 100644 ---- a/include/linux/if_bridge.h -+++ b/include/linux/if_bridge.h -@@ -51,6 +51,8 @@ struct br_ip_list { - #define BR_DEFAULT_AGEING_TIME (300 * HZ) - - extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); -+extern void br_dev_update_stats(struct net_device *dev, -+ struct rtnl_link_stats64 *nlstats); - - typedef int br_should_route_hook_t(struct sk_buff *skb); - extern br_should_route_hook_t __rcu *br_should_route_hook; -diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c -index ec02f58..977415a 100644 ---- a/net/bridge/br_if.c -+++ b/net/bridge/br_if.c -@@ -588,3 +588,27 @@ void br_port_flags_change(struct net_bridge_port *p, unsigned long mask) - if (mask & BR_AUTO_MASK) - nbp_update_port_count(br); - } -+ -+/* Update bridge statistics for bridge packets processed by offload engines */ -+void br_dev_update_stats(struct net_device *dev, -+ struct rtnl_link_stats64 *nlstats) -+{ -+ struct net_bridge *br; -+ struct pcpu_sw_netstats *stats; -+ -+ /* Is this a bridge? */ -+ if (!(dev->priv_flags & IFF_EBRIDGE)) -+ return; -+ -+ br = netdev_priv(dev); -+ stats = this_cpu_ptr(br->stats); -+ -+ u64_stats_update_begin(&stats->syncp); -+ stats->rx_packets += nlstats->rx_packets; -+ stats->rx_bytes += nlstats->rx_bytes; -+ stats->tx_packets += nlstats->tx_packets; -+ stats->tx_bytes += nlstats->tx_bytes; -+ u64_stats_update_end(&stats->syncp); -+} -+EXPORT_SYMBOL_GPL(br_dev_update_stats); -+ --- -2.7.4 - diff --git a/target/linux/generic/hack-4.4/952-net-conntrack-events-support-multiple-registrant.patch b/target/linux/generic/hack-4.4/952-net-conntrack-events-support-multiple-registrant.patch deleted file mode 100644 index 54e7c07b8..000000000 --- a/target/linux/generic/hack-4.4/952-net-conntrack-events-support-multiple-registrant.patch +++ /dev/null @@ -1,318 +0,0 @@ -From 42824d4b753f84ccf885eca602c5037338b546c8 Mon Sep 17 00:00:00 2001 -From: Zhi Chen -Date: Tue, 13 Jan 2015 14:28:18 -0800 -Subject: [PATCH 3/3] net: conntrack events, support multiple registrant - -Merging this patch from kernel 3.4: -This was supported by old (.28) kernel versions but removed -because of it's overhead. -But we need this feature for NA connection manager. Both ipv4 -and ipv6 modules needs to register themselves to ct events. - -Change-Id: Iebfb254590fb594f5baf232f849d1b7ae45ef757 -Signed-off-by: Zhi Chen ---- - include/net/netfilter/nf_conntrack_ecache.h | 42 ++++++++++++++++++- - include/net/netns/conntrack.h | 4 ++ - net/netfilter/Kconfig | 8 ++++ - net/netfilter/nf_conntrack_core.c | 4 ++ - net/netfilter/nf_conntrack_ecache.c | 63 +++++++++++++++++++++++++++++ - net/netfilter/nf_conntrack_netlink.c | 17 ++++++++ - 6 files changed, 137 insertions(+), 1 deletion(-) - -diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h -index 57c8803..f921354 100644 ---- a/include/net/netfilter/nf_conntrack_ecache.h -+++ b/include/net/netfilter/nf_conntrack_ecache.h -@@ -63,6 +63,10 @@ struct nf_ct_event { - int report; - }; - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+extern int nf_conntrack_register_notifier(struct net *net, struct notifier_block *nb); -+extern int nf_conntrack_unregister_notifier(struct net *net, struct notifier_block *nb); -+#else - struct nf_ct_event_notifier { - int (*fcn)(unsigned int events, struct nf_ct_event *item); - }; -@@ -71,17 +75,20 @@ int nf_conntrack_register_notifier(struct net *net, - struct nf_ct_event_notifier *nb); - void nf_conntrack_unregister_notifier(struct net *net, - struct nf_ct_event_notifier *nb); -+#endif - - void nf_ct_deliver_cached_events(struct nf_conn *ct); - - static inline void - nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) - { -- struct net *net = nf_ct_net(ct); - struct nf_conntrack_ecache *e; -+#ifndef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+ struct net *net = nf_ct_net(ct); - - if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb)) - return; -+#endif - - e = nf_ct_ecache_find(ct); - if (e == NULL) -@@ -90,6 +97,38 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) - set_bit(event, &e->cache); - } - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+static inline int -+nf_conntrack_eventmask_report(unsigned int eventmask, -+ struct nf_conn *ct, -+ u32 portid, -+ int report) -+{ -+ struct nf_conntrack_ecache *e; -+ struct net *net = nf_ct_net(ct); -+ -+ e = nf_ct_ecache_find(ct); -+ if (e == NULL) -+ return 0; -+ -+ if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) { -+ struct nf_ct_event item = { -+ .ct = ct, -+ .portid = e->portid ? e->portid : portid, -+ .report = report -+ }; -+ /* This is a resent of a destroy event? If so, skip missed */ -+ unsigned long missed = e->portid ? 0 : e->missed; -+ -+ if (!((eventmask | missed) & e->ctmask)) -+ return 0; -+ -+ atomic_notifier_call_chain(&net->ct.nf_conntrack_chain, eventmask | missed, &item); -+ } -+ -+ return 0; -+} -+#else - static inline int - nf_conntrack_eventmask_report(unsigned int eventmask, - struct nf_conn *ct, -@@ -143,6 +182,7 @@ out_unlock: - rcu_read_unlock(); - return ret; - } -+#endif - - static inline int - nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, -diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h -index 723b61c..fbb9c16 100644 ---- a/include/net/netns/conntrack.h -+++ b/include/net/netns/conntrack.h -@@ -100,7 +100,11 @@ struct netns_ct { - struct hlist_head *expect_hash; - struct ct_pcpu __percpu *pcpu_lists; - struct ip_conntrack_stat __percpu *stat; -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+ struct atomic_notifier_head nf_conntrack_chain; -+#else - struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; -+#endif - struct nf_exp_event_notifier __rcu *nf_expect_event_cb; - struct nf_ip_net nf_ct_proto; - #if defined(CONFIG_NF_CONNTRACK_LABELS) -diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig -index 7da6cef..c374447 100644 ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -136,6 +136,14 @@ config NF_CONNTRACK_TIMEOUT - - If unsure, say `N'. - -+config NF_CONNTRACK_CHAIN_EVENTS -+ bool "Register multiple callbacks to ct events" -+ depends on NF_CONNTRACK_EVENTS -+ help -+ Support multiple registrations. -+ -+ If unsure, say `N'. -+ - config NF_CONNTRACK_TIMESTAMP - bool 'Connection tracking timestamping' - depends on NETFILTER_ADVANCED -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c -index 86a3c6f..027c203 100644 ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -1817,6 +1817,10 @@ int nf_conntrack_init_net(struct net *net) - ret = nf_conntrack_proto_pernet_init(net); - if (ret < 0) - goto err_proto; -+ -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+ ATOMIC_INIT_NOTIFIER_HEAD(&net->ct.nf_conntrack_chain); -+#endif - return 0; - - err_proto: -diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c -index 4e78c57..d3e6773 100644 ---- a/net/netfilter/nf_conntrack_ecache.c -+++ b/net/netfilter/nf_conntrack_ecache.c -@@ -18,6 +18,9 @@ - #include - #include - #include -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+#include -+#endif - #include - #include - #include -@@ -115,6 +118,51 @@ static void ecache_work(struct work_struct *work) - - /* deliver cached events and clear cache entry - must be called with locally - * disabled softirqs */ -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+void nf_ct_deliver_cached_events(struct nf_conn *ct) -+{ -+ unsigned long events, missed; -+ struct nf_conntrack_ecache *e; -+ struct nf_ct_event item; -+ struct net *net = nf_ct_net(ct); -+ int ret = 0; -+ -+ e = nf_ct_ecache_find(ct); -+ if (e == NULL) -+ return; -+ -+ events = xchg(&e->cache, 0); -+ -+ if (!nf_ct_is_confirmed(ct) || nf_ct_is_dying(ct) || !events) -+ return; -+ -+ /* We make a copy of the missed event cache without taking -+ * the lock, thus we may send missed events twice. However, -+ * this does not harm and it happens very rarely. */ -+ missed = e->missed; -+ -+ if (!((events | missed) & e->ctmask)) -+ return; -+ -+ item.ct = ct; -+ item.portid = 0; -+ item.report = 0; -+ -+ atomic_notifier_call_chain(&net->ct.nf_conntrack_chain, -+ events | missed, -+ &item); -+ -+ if (likely(ret >= 0 && !missed)) -+ return; -+ -+ spin_lock_bh(&ct->lock); -+ if (ret < 0) -+ e->missed |= events; -+ else -+ e->missed &= ~missed; -+ spin_unlock_bh(&ct->lock); -+} -+#else - void nf_ct_deliver_cached_events(struct nf_conn *ct) - { - struct net *net = nf_ct_net(ct); -@@ -165,8 +213,15 @@ void nf_ct_deliver_cached_events(struct nf_conn *ct) - out_unlock: - rcu_read_unlock(); - } -+#endif - EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+int nf_conntrack_register_notifier(struct net *net, struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_register(&net->ct.nf_conntrack_chain, nb); -+} -+#else - int nf_conntrack_register_notifier(struct net *net, - struct nf_ct_event_notifier *new) - { -@@ -187,8 +242,15 @@ out_unlock: - mutex_unlock(&nf_ct_ecache_mutex); - return ret; - } -+#endif - EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); - -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+int nf_conntrack_unregister_notifier(struct net *net, struct notifier_block *nb) -+{ -+ return atomic_notifier_chain_unregister(&net->ct.nf_conntrack_chain, nb); -+} -+#else - void nf_conntrack_unregister_notifier(struct net *net, - struct nf_ct_event_notifier *new) - { -@@ -201,6 +263,7 @@ void nf_conntrack_unregister_notifier(struct net *net, - RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL); - mutex_unlock(&nf_ct_ecache_mutex); - } -+#endif - EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); - - int nf_ct_expect_register_notifier(struct net *net, -diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c -index 9f52729..8d8f355 100644 ---- a/net/netfilter/nf_conntrack_netlink.c -+++ b/net/netfilter/nf_conntrack_netlink.c -@@ -28,6 +28,9 @@ - #include - #include - #include -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+#include -+#endif - #include - - #include -@@ -629,14 +632,22 @@ ctnetlink_nlmsg_size(const struct nf_conn *ct) - } - - #ifdef CONFIG_NF_CONNTRACK_EVENTS -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+static int ctnetlink_conntrack_event(struct notifier_block *this, -+ unsigned long events, void *ptr) -+#else - static int - ctnetlink_conntrack_event(unsigned int events, struct nf_ct_event *item) -+#endif - { - const struct nf_conntrack_zone *zone; - struct net *net; - struct nlmsghdr *nlh; - struct nfgenmsg *nfmsg; - struct nlattr *nest_parms; -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+ struct nf_ct_event *item = ptr; -+#endif - struct nf_conn *ct = item->ct; - struct sk_buff *skb; - unsigned int type; -@@ -3258,9 +3269,15 @@ ctnetlink_stat_exp_cpu(struct sock *ctnl, struct sk_buff *skb, - } - - #ifdef CONFIG_NF_CONNTRACK_EVENTS -+#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -+static struct notifier_block ctnl_notifier = { -+ .notifier_call = ctnetlink_conntrack_event, -+}; -+#else - static struct nf_ct_event_notifier ctnl_notifier = { - .fcn = ctnetlink_conntrack_event, - }; -+#endif - - static struct nf_exp_event_notifier ctnl_notifier_exp = { - .fcn = ctnetlink_expect_event, --- -2.7.4 - diff --git a/target/linux/generic/hack-4.9/207-disable-modorder.patch b/target/linux/generic/hack-4.9/207-disable-modorder.patch index f9b3ac4dc..22e863c28 100644 --- a/target/linux/generic/hack-4.9/207-disable-modorder.patch +++ b/target/linux/generic/hack-4.9/207-disable-modorder.patch @@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau --- a/Makefile +++ b/Makefile -@@ -1211,7 +1211,6 @@ all: modules +@@ -1213,7 +1213,6 @@ all: modules PHONY += modules modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild -@@ -1241,7 +1240,6 @@ _modinst_: +@@ -1243,7 +1242,6 @@ _modinst_: rm -f $(MODLIB)/build ; \ ln -s $(CURDIR) $(MODLIB)/build ; \ fi diff --git a/target/linux/generic/hack-4.9/211-host_tools_portability.patch b/target/linux/generic/hack-4.9/211-host_tools_portability.patch index e6fd32843..e4d685141 100644 --- a/target/linux/generic/hack-4.9/211-host_tools_portability.patch +++ b/target/linux/generic/hack-4.9/211-host_tools_portability.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/tools/build/Build.include +++ b/tools/build/Build.include -@@ -95,4 +95,4 @@ cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $( +@@ -96,4 +96,4 @@ cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $( ### ## HOSTCC C flags diff --git a/target/linux/generic/hack-4.9/220-gc_sections.patch b/target/linux/generic/hack-4.9/220-gc_sections.patch index 40e4905db..313174489 100644 --- a/target/linux/generic/hack-4.9/220-gc_sections.patch +++ b/target/linux/generic/hack-4.9/220-gc_sections.patch @@ -33,9 +33,9 @@ Signed-off-by: Gabor Juhos # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) -@@ -636,11 +641,6 @@ KBUILD_CFLAGS += $(call cc-disable-warni - KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) +@@ -638,11 +643,6 @@ KBUILD_CFLAGS += $(call cc-disable-warni KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) + KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias) -ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION -KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) diff --git a/target/linux/generic/hack-4.9/221-module_exports.patch b/target/linux/generic/hack-4.9/221-module_exports.patch index fddf57b47..a2027d0d5 100644 --- a/target/linux/generic/hack-4.9/221-module_exports.patch +++ b/target/linux/generic/hack-4.9/221-module_exports.patch @@ -90,7 +90,7 @@ Signed-off-by: Felix Fietkau __used \ --- a/scripts/Makefile.build +++ b/scripts/Makefile.build -@@ -398,7 +398,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( +@@ -401,7 +401,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( # Linker scripts preprocessor (.lds.S -> .lds) # --------------------------------------------------------------------------- quiet_cmd_cpp_lds_S = LDS $@ diff --git a/target/linux/generic/hack-4.9/902-debloat_proc.patch b/target/linux/generic/hack-4.9/902-debloat_proc.patch index ae2dad61e..cab7276d2 100644 --- a/target/linux/generic/hack-4.9/902-debloat_proc.patch +++ b/target/linux/generic/hack-4.9/902-debloat_proc.patch @@ -232,7 +232,7 @@ Signed-off-by: Felix Fietkau return -ENOMEM; --- a/mm/vmalloc.c +++ b/mm/vmalloc.c -@@ -2713,6 +2713,8 @@ static const struct file_operations proc +@@ -2714,6 +2714,8 @@ static const struct file_operations proc static int __init proc_vmalloc_init(void) { diff --git a/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch b/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch deleted file mode 100644 index 97cd62d75..000000000 --- a/target/linux/generic/pending-3.18/001-mtdsplit_backport.patch +++ /dev/null @@ -1,142 +0,0 @@ ---- a/drivers/mtd/mtdsplit/mtdsplit_brnimage.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_brnimage.c -@@ -27,7 +27,7 @@ - #define BRNIMAGE_MAX_OVERHEAD (BRNIMAGE_ALIGN_BYTES + BRNIMAGE_FOOTER_SIZE) - - static int mtdsplit_parse_brnimage(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_eva.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_eva.c -@@ -29,7 +29,7 @@ struct eva_image_header { - }; - - static int mtdsplit_parse_eva(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_fit.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_fit.c -@@ -45,8 +45,7 @@ struct fdt_header { - }; - - static int --mtdsplit_fit_parse(struct mtd_info *mtd, -- const struct mtd_partition **pparts, -+mtdsplit_fit_parse(struct mtd_info *mtd, struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct fdt_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_lzma.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_lzma.c -@@ -28,7 +28,7 @@ struct lzma_header { - }; - - static int mtdsplit_parse_lzma(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct lzma_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_seama.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_seama.c -@@ -30,7 +30,7 @@ struct seama_header { - }; - - static int mtdsplit_parse_seama(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct seama_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_squashfs.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_squashfs.c -@@ -23,7 +23,7 @@ - - static int - mtdsplit_parse_squashfs(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *part; ---- a/drivers/mtd/mtdsplit/mtdsplit_tplink.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_tplink.c -@@ -83,8 +83,8 @@ struct tplink_fw_header { - }; - - static int mtdsplit_parse_tplink(struct mtd_info *master, -- const struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) - { - struct tplink_fw_header hdr; - size_t hdr_len, retlen, kernel_size; ---- a/drivers/mtd/mtdsplit/mtdsplit_trx.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_trx.c -@@ -56,7 +56,7 @@ read_trx_header(struct mtd_info *mtd, si - - static int - mtdsplit_parse_trx(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_uimage.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_uimage.c -@@ -81,7 +81,7 @@ read_uimage_header(struct mtd_info *mtd, - * of a valid uImage header if found - */ - static int __mtdsplit_parse_uimage(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data, - ssize_t (*find_header)(u_char *buf, size_t len)) - { -@@ -232,7 +232,7 @@ static ssize_t uimage_verify_default(u_c - - static int - mtdsplit_uimage_parse_generic(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, -@@ -289,7 +289,7 @@ static ssize_t uimage_verify_wndr3700(u_ - - static int - mtdsplit_uimage_parse_netgear(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, -@@ -331,7 +331,7 @@ static ssize_t uimage_find_edimax(u_char - - static int - mtdsplit_uimage_parse_edimax(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, ---- a/drivers/mtd/mtdsplit/mtdsplit_wrgg.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_wrgg.c -@@ -40,8 +40,8 @@ struct wrgg03_header { - - - static int mtdsplit_parse_wrgg(struct mtd_info *master, -- const struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) - { - struct wrgg03_header hdr; - size_t hdr_len, retlen, kernel_ent_size; diff --git a/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch b/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch deleted file mode 100644 index 504d772de..000000000 --- a/target/linux/generic/pending-3.18/002-phy_drivers_backport.patch +++ /dev/null @@ -1,552 +0,0 @@ ---- a/drivers/net/phy/adm6996.c -+++ b/drivers/net/phy/adm6996.c -@@ -289,7 +289,7 @@ static u16 - adm6996_read_mii_reg(struct adm6996_priv *priv, enum admreg reg) - { - struct phy_device *phydev = priv->priv; -- struct mii_bus *bus = phydev->mdio.bus; -+ struct mii_bus *bus = phydev->bus; - - return bus->read(bus, PHYADDR(reg)); - } -@@ -298,7 +298,7 @@ static void - adm6996_write_mii_reg(struct adm6996_priv *priv, enum admreg reg, u16 val) - { - struct phy_device *phydev = priv->priv; -- struct mii_bus *bus = phydev->mdio.bus; -+ struct mii_bus *bus = phydev->bus; - - bus->write(bus, PHYADDR(reg), val); - } -@@ -1050,13 +1050,13 @@ static int adm6996_config_init(struct ph - pdev->supported = ADVERTISED_100baseT_Full; - pdev->advertising = ADVERTISED_100baseT_Full; - -- if (pdev->mdio.addr != 0) { -+ if (pdev->addr != 0) { - pr_info ("%s: PHY overlaps ADM6996, providing fixed PHY 0x%x.\n" -- , pdev->attached_dev->name, pdev->mdio.addr); -+ , pdev->attached_dev->name, pdev->addr); - return 0; - } - -- priv = devm_kzalloc(&pdev->mdio.dev, sizeof(struct adm6996_priv), GFP_KERNEL); -+ priv = devm_kzalloc(&pdev->dev, sizeof(struct adm6996_priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - -@@ -1076,7 +1076,7 @@ static int adm6996_config_init(struct ph - } - - /* -- * Warning: phydev->priv is NULL if phydev->mdio.addr != 0 -+ * Warning: phydev->priv is NULL if phydev->addr != 0 - */ - static int adm6996_read_status(struct phy_device *phydev) - { -@@ -1092,7 +1092,7 @@ static int adm6996_read_status(struct ph - } - - /* -- * Warning: phydev->priv is NULL if phydev->mdio.addr != 0 -+ * Warning: phydev->priv is NULL if phydev->addr != 0 - */ - static int adm6996_config_aneg(struct phy_device *phydev) - { -@@ -1101,11 +1101,11 @@ static int adm6996_config_aneg(struct ph - - static int adm6996_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; -+ struct mii_bus *bus = dev->bus; - u16 reg; - - /* Our custom registers are at PHY addresses 0-10. Claim those. */ -- if (dev->mdio.addr > 10) -+ if (dev->addr > 10) - return 0; - - /* look for the switch on the bus */ -@@ -1152,6 +1152,7 @@ static struct phy_driver adm6996_phy_dri - .config_aneg = &adm6996_config_aneg, - .read_status = &adm6996_read_status, - .soft_reset = adm6996_soft_reset, -+ .driver = { .owner = THIS_MODULE,}, - }; - - static int adm6996_gpio_probe(struct platform_device *pdev) -@@ -1220,7 +1221,7 @@ static int __init adm6996_init(void) - int err; - - phy_register_fixup_for_id(PHY_ANY_ID, adm6996_fixup); -- err = phy_driver_register(&adm6996_phy_driver, THIS_MODULE); -+ err = phy_driver_register(&adm6996_phy_driver); - if (err) - return err; - ---- a/drivers/net/phy/ar8216.c -+++ b/drivers/net/phy/ar8216.c -@@ -177,7 +177,7 @@ ar8xxx_phy_check_aneg(struct phy_device - if (ret & BMCR_ANENABLE) - return 0; - -- dev_info(&phydev->mdio.dev, "ANEG disabled, re-enabling ...\n"); -+ dev_info(&phydev->dev, "ANEG disabled, re-enabling ...\n"); - ret |= BMCR_ANENABLE | BMCR_ANRESTART; - return phy_write(phydev, MII_BMCR, ret); - } -@@ -2007,7 +2007,7 @@ ar8xxx_phy_config_init(struct phy_device - - priv->phy = phydev; - -- if (phydev->mdio.addr != 0) { -+ if (phydev->addr != 0) { - if (chip_is_ar8316(priv)) { - /* switch device has been initialized, reinit */ - priv->dev.ports = (AR8216_NUM_PORTS - 1); -@@ -2055,7 +2055,7 @@ ar8xxx_check_link_states(struct ar8xxx_p - /* flush ARL entries for this port if it went down*/ - if (!link_new) - priv->chip->atu_flush_port(priv, i); -- dev_info(&priv->phy->mdio.dev, "Port %d is %s\n", -+ dev_info(&priv->phy->dev, "Port %d is %s\n", - i, link_new ? "up" : "down"); - } - -@@ -2074,10 +2074,10 @@ ar8xxx_phy_read_status(struct phy_device - if (phydev->state == PHY_CHANGELINK) - ar8xxx_check_link_states(priv); - -- if (phydev->mdio.addr != 0) -+ if (phydev->addr != 0) - return genphy_read_status(phydev); - -- ar8216_read_port_link(priv, phydev->mdio.addr, &link); -+ ar8216_read_port_link(priv, phydev->addr, &link); - phydev->link = !!link.link; - if (!phydev->link) - return 0; -@@ -2107,7 +2107,7 @@ ar8xxx_phy_read_status(struct phy_device - static int - ar8xxx_phy_config_aneg(struct phy_device *phydev) - { -- if (phydev->mdio.addr == 0) -+ if (phydev->addr == 0) - return 0; - - return genphy_config_aneg(phydev); -@@ -2162,15 +2162,15 @@ ar8xxx_phy_probe(struct phy_device *phyd - int ret; - - /* skip PHYs at unused adresses */ -- if (phydev->mdio.addr != 0 && phydev->mdio.addr != 4) -+ if (phydev->addr != 0 && phydev->addr != 4) - return -ENODEV; - -- if (!ar8xxx_is_possible(phydev->mdio.bus)) -+ if (!ar8xxx_is_possible(phydev->bus)) - return -ENODEV; - - mutex_lock(&ar8xxx_dev_list_lock); - list_for_each_entry(priv, &ar8xxx_dev_list, list) -- if (priv->mii_bus == phydev->mdio.bus) -+ if (priv->mii_bus == phydev->bus) - goto found; - - priv = ar8xxx_create(); -@@ -2179,7 +2179,7 @@ ar8xxx_phy_probe(struct phy_device *phyd - goto unlock; - } - -- priv->mii_bus = phydev->mdio.bus; -+ priv->mii_bus = phydev->bus; - - ret = ar8xxx_probe_switch(priv); - if (ret) -@@ -2200,7 +2200,7 @@ ar8xxx_phy_probe(struct phy_device *phyd - found: - priv->use_count++; - -- if (phydev->mdio.addr == 0) { -+ if (phydev->addr == 0) { - if (ar8xxx_has_gige(priv)) { - phydev->supported = SUPPORTED_1000baseT_Full; - phydev->advertising = ADVERTISED_1000baseT_Full; -@@ -2288,21 +2288,33 @@ ar8xxx_phy_soft_reset(struct phy_device - return 0; - } - --static struct phy_driver ar8xxx_phy_driver[] = { -- { -- .phy_id = 0x004d0000, -- .name = "Atheros AR8216/AR8236/AR8316", -- .phy_id_mask = 0xffff0000, -- .features = PHY_BASIC_FEATURES, -- .probe = ar8xxx_phy_probe, -- .remove = ar8xxx_phy_remove, -- .detach = ar8xxx_phy_detach, -- .config_init = ar8xxx_phy_config_init, -- .config_aneg = ar8xxx_phy_config_aneg, -- .read_status = ar8xxx_phy_read_status, -- .soft_reset = ar8xxx_phy_soft_reset, -- } -+static struct phy_driver ar8xxx_phy_driver = { -+ .phy_id = 0x004d0000, -+ .name = "Atheros AR8216/AR8236/AR8316", -+ .phy_id_mask = 0xffff0000, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ar8xxx_phy_probe, -+ .remove = ar8xxx_phy_remove, -+ .detach = ar8xxx_phy_detach, -+ .config_init = ar8xxx_phy_config_init, -+ .config_aneg = ar8xxx_phy_config_aneg, -+ .read_status = ar8xxx_phy_read_status, -+ .soft_reset = ar8xxx_phy_soft_reset, -+ .driver = { .owner = THIS_MODULE }, - }; - --module_phy_driver(ar8xxx_phy_driver); -+int __init -+ar8xxx_init(void) -+{ -+ return phy_driver_register(&ar8xxx_phy_driver); -+} -+ -+void __exit -+ar8xxx_exit(void) -+{ -+ phy_driver_unregister(&ar8xxx_phy_driver); -+} -+ -+module_init(ar8xxx_init); -+module_exit(ar8xxx_exit); - MODULE_LICENSE("GPL"); ---- a/drivers/net/phy/ar8327.c -+++ b/drivers/net/phy/ar8327.c -@@ -627,11 +627,11 @@ ar8327_hw_init(struct ar8xxx_priv *priv) - if (!priv->chip_data) - return -ENOMEM; - -- if (priv->phy->mdio.dev.of_node) -- ret = ar8327_hw_config_of(priv, priv->phy->mdio.dev.of_node); -+ if (priv->phy->dev.of_node) -+ ret = ar8327_hw_config_of(priv, priv->phy->dev.of_node); - else - ret = ar8327_hw_config_pdata(priv, -- priv->phy->mdio.dev.platform_data); -+ priv->phy->dev.platform_data); - - if (ret) - return ret; ---- a/drivers/net/phy/ip17xx.c -+++ b/drivers/net/phy/ip17xx.c -@@ -1273,7 +1273,7 @@ static int ip17xx_probe(struct phy_devic - int err; - - /* We only attach to PHY 0, but use all available PHYs */ -- if (pdev->mdio.addr != 0) -+ if (pdev->addr != 0) - return -ENODEV; - - state = kzalloc(sizeof(*state), GFP_KERNEL); -@@ -1283,7 +1283,7 @@ static int ip17xx_probe(struct phy_devic - dev = &state->dev; - - pdev->priv = state; -- state->mii_bus = pdev->mdio.bus; -+ state->mii_bus = pdev->bus; - - err = get_model(state); - if (err < 0) -@@ -1295,7 +1295,7 @@ static int ip17xx_probe(struct phy_devic - dev->name = state->regs->NAME; - dev->ops = &ip17xx_ops; - -- pr_info("IP17xx: Found %s at %s\n", dev->name, dev_name(&pdev->mdio.dev)); -+ pr_info("IP17xx: Found %s at %s\n", dev->name, dev_name(&pdev->dev)); - return 0; - - error: -@@ -1353,25 +1353,58 @@ static int ip17xx_read_status(struct phy - return 0; - } - --static struct phy_driver ip17xx_driver[] = { -- { -- .name = "IC+ IP17xx", -- .phy_id = 0x02430c00, -- .phy_id_mask = 0x0ffffc00, -- .features = PHY_BASIC_FEATURES, -- .probe = ip17xx_probe, -- .remove = ip17xx_remove, -- .config_init = ip17xx_config_init, -- .config_aneg = ip17xx_config_aneg, -- .aneg_done = ip17xx_aneg_done, -- .update_link = ip17xx_update_link, -- .read_status = ip17xx_read_status, -- } -+static struct phy_driver ip17xx_driver = { -+ .name = "IC+ IP17xx", -+ .phy_id = 0x02430c00, -+ .phy_id_mask = 0x0ffffc00, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ip17xx_probe, -+ .remove = ip17xx_remove, -+ .config_init = ip17xx_config_init, -+ .config_aneg = ip17xx_config_aneg, -+ .aneg_done = ip17xx_aneg_done, -+ .update_link = ip17xx_update_link, -+ .read_status = ip17xx_read_status, -+ .driver = { .owner = THIS_MODULE }, - }; - --module_phy_driver(ip17xx_driver); -+static struct phy_driver ip175a_driver = { -+ .name = "IC+ IP175A", -+ .phy_id = 0x02430c50, -+ .phy_id_mask = 0x0ffffff0, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ip17xx_probe, -+ .remove = ip17xx_remove, -+ .config_init = ip17xx_config_init, -+ .config_aneg = ip17xx_config_aneg, -+ .aneg_done = ip17xx_aneg_done, -+ .update_link = ip17xx_update_link, -+ .read_status = ip17xx_read_status, -+ .driver = { .owner = THIS_MODULE }, -+}; -+ -+ -+int __init ip17xx_init(void) -+{ -+ int ret; -+ -+ ret = phy_driver_register(&ip175a_driver); -+ if (ret < 0) -+ return ret; -+ -+ return phy_driver_register(&ip17xx_driver); -+} -+ -+void __exit ip17xx_exit(void) -+{ -+ phy_driver_unregister(&ip17xx_driver); -+ phy_driver_unregister(&ip175a_driver); -+} - - MODULE_AUTHOR("Patrick Horn "); - MODULE_AUTHOR("Felix Fietkau "); - MODULE_AUTHOR("Martin Mares "); - MODULE_LICENSE("GPL"); -+ -+module_init(ip17xx_init); -+module_exit(ip17xx_exit); ---- a/drivers/net/phy/mvswitch.c -+++ b/drivers/net/phy/mvswitch.c -@@ -50,17 +50,13 @@ struct mvswitch_priv { - static inline u16 - r16(struct phy_device *phydev, int addr, int reg) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- return bus->read(bus, addr, reg); -+ return phydev->bus->read(phydev->bus, addr, reg); - } - - static inline void - w16(struct phy_device *phydev, int addr, int reg, u16 val) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- bus->write(bus, addr, reg, val); -+ phydev->bus->write(phydev->bus, addr, reg, val); - } - - -@@ -398,13 +394,12 @@ mvswitch_probe(struct phy_device *pdev) - static int - mvswitch_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; - u16 reg; - -- if (dev->mdio.addr != 0x10) -+ if (dev->addr != 0x10) - return 0; - -- reg = bus->read(bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; -+ reg = dev->bus->read(dev->bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; - if (reg != MV_IDENT_VALUE) - return 0; - -@@ -425,13 +420,14 @@ static struct phy_driver mvswitch_driver - .config_aneg = &mvswitch_config_aneg, - .aneg_done = &mvswitch_aneg_done, - .read_status = &mvswitch_read_status, -+ .driver = { .owner = THIS_MODULE,}, - }; - - static int __init - mvswitch_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, mvswitch_fixup); -- return phy_driver_register(&mvswitch_driver, THIS_MODULE); -+ return phy_driver_register(&mvswitch_driver); - } - - static void __exit ---- a/drivers/net/phy/psb6970.c -+++ b/drivers/net/phy/psb6970.c -@@ -70,16 +70,12 @@ struct psb6970_priv { - - static u16 psb6970_mii_read(struct phy_device *phydev, int reg) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- return bus->read(bus, PHYADDR(reg)); -+ return phydev->bus->read(phydev->bus, PHYADDR(reg)); - } - - static void psb6970_mii_write(struct phy_device *phydev, int reg, u16 val) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- bus->write(bus, PHYADDR(reg), val); -+ phydev->bus->write(phydev->bus, PHYADDR(reg), val); - } - - static int -@@ -316,11 +312,11 @@ static int psb6970_config_init(struct ph - - priv->phy = pdev; - -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - printk(KERN_INFO "%s: psb6970 switch driver attached.\n", - pdev->attached_dev->name); - -- if (pdev->mdio.addr != 0) { -+ if (pdev->addr != 0) { - kfree(priv); - return 0; - } -@@ -388,14 +384,14 @@ static void psb6970_remove(struct phy_de - if (!priv) - return; - -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - unregister_switch(&priv->dev); - kfree(priv); - } - - static int psb6970_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; -+ struct mii_bus *bus = dev->bus; - u16 reg; - - /* look for the switch on the bus */ -@@ -419,12 +415,13 @@ static struct phy_driver psb6970_driver - .config_init = &psb6970_config_init, - .config_aneg = &psb6970_config_aneg, - .read_status = &psb6970_read_status, -+ .driver = {.owner = THIS_MODULE}, - }; - - int __init psb6970_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, psb6970_fixup); -- return phy_driver_register(&psb6970_driver, THIS_MODULE); -+ return phy_driver_register(&psb6970_driver); - } - - module_init(psb6970_init); ---- a/drivers/net/phy/rtl8306.c -+++ b/drivers/net/phy/rtl8306.c -@@ -877,7 +877,7 @@ rtl8306_config_init(struct phy_device *p - int err; - - /* Only init the switch for the primary PHY */ -- if (pdev->mdio.addr != 0) -+ if (pdev->addr != 0) - return 0; - - val.value.i = 1; -@@ -887,7 +887,7 @@ rtl8306_config_init(struct phy_device *p - priv->dev.ops = &rtl8306_ops; - priv->do_cpu = 0; - priv->page = -1; -- priv->bus = pdev->mdio.bus; -+ priv->bus = pdev->bus; - - chipid = rtl_get(dev, RTL_REG_CHIPID); - chipver = rtl_get(dev, RTL_REG_CHIPVER); -@@ -933,13 +933,13 @@ rtl8306_fixup(struct phy_device *pdev) - u16 chipid; - - /* Attach to primary LAN port and WAN port */ -- if (pdev->mdio.addr != 0 && pdev->mdio.addr != 4) -+ if (pdev->addr != 0 && pdev->addr != 4) - return 0; - - memset(&priv, 0, sizeof(priv)); - priv.fixup = true; - priv.page = -1; -- priv.bus = pdev->mdio.bus; -+ priv.bus = pdev->bus; - chipid = rtl_get(&priv.dev, RTL_REG_CHIPID); - if (chipid == 0x5988) - pdev->phy_id = RTL8306_MAGIC; -@@ -957,14 +957,14 @@ rtl8306_probe(struct phy_device *pdev) - * share one rtl_priv instance between virtual phy - * devices on the same bus - */ -- if (priv->bus == pdev->mdio.bus) -+ if (priv->bus == pdev->bus) - goto found; - } - priv = kzalloc(sizeof(struct rtl_priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - -- priv->bus = pdev->mdio.bus; -+ priv->bus = pdev->bus; - - found: - pdev->priv = priv; -@@ -985,7 +985,7 @@ rtl8306_config_aneg(struct phy_device *p - struct rtl_priv *priv = pdev->priv; - - /* Only for WAN */ -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - return 0; - - /* Restart autonegotiation */ -@@ -1001,7 +1001,7 @@ rtl8306_read_status(struct phy_device *p - struct rtl_priv *priv = pdev->priv; - struct switch_dev *dev = &priv->dev; - -- if (pdev->mdio.addr == 4) { -+ if (pdev->addr == 4) { - /* WAN */ - pdev->speed = rtl_get(dev, RTL_PORT_REG(4, SPEED)) ? SPEED_100 : SPEED_10; - pdev->duplex = rtl_get(dev, RTL_PORT_REG(4, DUPLEX)) ? DUPLEX_FULL : DUPLEX_HALF; -@@ -1044,6 +1044,7 @@ static struct phy_driver rtl8306_driver - .config_init = &rtl8306_config_init, - .config_aneg = &rtl8306_config_aneg, - .read_status = &rtl8306_read_status, -+ .driver = { .owner = THIS_MODULE,}, - }; - - -@@ -1051,7 +1052,7 @@ static int __init - rtl_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, rtl8306_fixup); -- return phy_driver_register(&rtl8306_driver, THIS_MODULE); -+ return phy_driver_register(&rtl8306_driver); - } - - static void __exit diff --git a/target/linux/generic/pending-3.18/003-myloader_backport.patch b/target/linux/generic/pending-3.18/003-myloader_backport.patch deleted file mode 100644 index 846b25dc0..000000000 --- a/target/linux/generic/pending-3.18/003-myloader_backport.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/mtd/myloader.c -+++ b/drivers/mtd/myloader.c -@@ -33,7 +33,7 @@ struct part_data { - }; - - static int myloader_parse_partitions(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct part_data *buf; diff --git a/target/linux/generic/pending-3.18/020-ssb_update.patch b/target/linux/generic/pending-3.18/020-ssb_update.patch deleted file mode 100644 index f94d160fc..000000000 --- a/target/linux/generic/pending-3.18/020-ssb_update.patch +++ /dev/null @@ -1,134 +0,0 @@ ---- a/drivers/ssb/pcihost_wrapper.c -+++ b/drivers/ssb/pcihost_wrapper.c -@@ -11,15 +11,17 @@ - * Licensed under the GNU/GPL. See COPYING for details. - */ - -+#include - #include - #include - #include - #include - - --#ifdef CONFIG_PM --static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state) -+#ifdef CONFIG_PM_SLEEP -+static int ssb_pcihost_suspend(struct device *d) - { -+ struct pci_dev *dev = to_pci_dev(d); - struct ssb_bus *ssb = pci_get_drvdata(dev); - int err; - -@@ -28,17 +30,23 @@ static int ssb_pcihost_suspend(struct pc - return err; - pci_save_state(dev); - pci_disable_device(dev); -- pci_set_power_state(dev, pci_choose_state(dev, state)); -+ -+ /* if there is a wakeup enabled child device on ssb bus, -+ enable pci wakeup posibility. */ -+ device_set_wakeup_enable(d, d->power.wakeup_path); -+ -+ pci_prepare_to_sleep(dev); - - return 0; - } - --static int ssb_pcihost_resume(struct pci_dev *dev) -+static int ssb_pcihost_resume(struct device *d) - { -+ struct pci_dev *dev = to_pci_dev(d); - struct ssb_bus *ssb = pci_get_drvdata(dev); - int err; - -- pci_set_power_state(dev, PCI_D0); -+ pci_back_from_sleep(dev); - err = pci_enable_device(dev); - if (err) - return err; -@@ -49,10 +57,12 @@ static int ssb_pcihost_resume(struct pci - - return 0; - } --#else /* CONFIG_PM */ --# define ssb_pcihost_suspend NULL --# define ssb_pcihost_resume NULL --#endif /* CONFIG_PM */ -+ -+static const struct dev_pm_ops ssb_pcihost_pm_ops = { -+ SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume) -+}; -+ -+#endif /* CONFIG_PM_SLEEP */ - - static int ssb_pcihost_probe(struct pci_dev *dev, - const struct pci_device_id *id) -@@ -115,8 +125,9 @@ int ssb_pcihost_register(struct pci_driv - { - driver->probe = ssb_pcihost_probe; - driver->remove = ssb_pcihost_remove; -- driver->suspend = ssb_pcihost_suspend; -- driver->resume = ssb_pcihost_resume; -+#ifdef CONFIG_PM_SLEEP -+ driver->driver.pm = &ssb_pcihost_pm_ops; -+#endif - - return pci_register_driver(driver); - } ---- a/drivers/ssb/driver_pcicore.c -+++ b/drivers/ssb/driver_pcicore.c -@@ -357,6 +357,16 @@ static void ssb_pcicore_init_hostmode(st - pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, - SSB_PCICORE_SBTOPCI_MEM | SSB_PCI_DMA); - -+ /* -+ * Accessing PCI config without a proper delay after devices reset (not -+ * GPIO reset) was causing reboots on WRT300N v1.0 (BCM4704). -+ * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it -+ * completely. Flushing all writes was also tested but with no luck. -+ * The same problem was reported for WRT350N v1 (BCM4705), so we just -+ * sleep here unconditionally. -+ */ -+ usleep_range(1000, 2000); -+ - /* Enable PCI bridge BAR0 prefetch and burst */ - val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - ssb_extpci_write_config(pc, 0, 0, 0, PCI_COMMAND, &val, 2); ---- a/drivers/ssb/main.c -+++ b/drivers/ssb/main.c -@@ -90,25 +90,6 @@ found: - } - #endif /* CONFIG_SSB_PCMCIAHOST */ - --#ifdef CONFIG_SSB_SDIOHOST --struct ssb_bus *ssb_sdio_func_to_bus(struct sdio_func *func) --{ -- struct ssb_bus *bus; -- -- ssb_buses_lock(); -- list_for_each_entry(bus, &buses, list) { -- if (bus->bustype == SSB_BUSTYPE_SDIO && -- bus->host_sdio == func) -- goto found; -- } -- bus = NULL; --found: -- ssb_buses_unlock(); -- -- return bus; --} --#endif /* CONFIG_SSB_SDIOHOST */ -- - int ssb_for_each_bus_call(unsigned long data, - int (*func)(struct ssb_bus *bus, unsigned long data)) - { -@@ -1154,6 +1135,8 @@ static u32 ssb_tmslow_reject_bitmask(str - case SSB_IDLOW_SSBREV_25: /* TODO - find the proper REJECT bit */ - case SSB_IDLOW_SSBREV_27: /* same here */ - return SSB_TMSLOW_REJECT; /* this is a guess */ -+ case SSB_IDLOW_SSBREV: -+ break; - default: - WARN(1, KERN_INFO "ssb: Backplane Revision 0x%.8X\n", rev); - } diff --git a/target/linux/generic/pending-3.18/021-ssb_sprom.patch b/target/linux/generic/pending-3.18/021-ssb_sprom.patch deleted file mode 100644 index 52d8080df..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/025-bcma_backport.patch b/target/linux/generic/pending-3.18/025-bcma_backport.patch deleted file mode 100644 index ec1cb004b..000000000 --- a/target/linux/generic/pending-3.18/025-bcma_backport.patch +++ /dev/null @@ -1,286 +0,0 @@ ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -22,6 +22,7 @@ struct bcma_bus; - /* main.c */ - bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value, - int timeout); -+void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); - int bcma_bus_register(struct bcma_bus *bus); - void bcma_bus_unregister(struct bcma_bus *bus); - int __init bcma_bus_early_register(struct bcma_bus *bus, ---- a/drivers/bcma/driver_chipcommon.c -+++ b/drivers/bcma/driver_chipcommon.c -@@ -339,7 +339,7 @@ void bcma_chipco_serial_init(struct bcma - return; - } - -- irq = bcma_core_irq(cc->core); -+ irq = bcma_core_irq(cc->core, 0); - - /* Determine the registers of the UARTs */ - cc->nr_serial_ports = (cc->capabilities & BCMA_CC_CAP_NRUART); ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -152,7 +152,7 @@ static int bcma_gpio_irq_domain_init(str - handle_simple_irq); - } - -- hwirq = bcma_core_irq(cc->core); -+ hwirq = bcma_core_irq(cc->core, 0); - err = request_irq(hwirq, bcma_gpio_irq_handler, IRQF_SHARED, "gpio", - cc); - if (err) -@@ -183,7 +183,7 @@ static void bcma_gpio_irq_domain_exit(st - return; - - bcma_cc_mask32(cc, BCMA_CC_IRQMASK, ~BCMA_CC_IRQ_GPIO); -- free_irq(bcma_core_irq(cc->core), cc); -+ free_irq(bcma_core_irq(cc->core, 0), cc); - for (gpio = 0; gpio < chip->ngpio; gpio++) { - int irq = irq_find_mapping(cc->irq_domain, gpio); - ---- a/drivers/bcma/driver_mips.c -+++ b/drivers/bcma/driver_mips.c -@@ -115,7 +115,7 @@ static u32 bcma_core_mips_irqflag(struct - * If disabled, 5 is returned. - * If not supported, 6 is returned. - */ --static unsigned int bcma_core_mips_irq(struct bcma_device *dev) -+unsigned int bcma_core_mips_irq(struct bcma_device *dev) - { - struct bcma_device *mdev = dev->bus->drv_mips.core; - u32 irqflag; -@@ -133,13 +133,6 @@ static unsigned int bcma_core_mips_irq(s - return 5; - } - --unsigned int bcma_core_irq(struct bcma_device *dev) --{ -- unsigned int mips_irq = bcma_core_mips_irq(dev); -- return mips_irq <= 4 ? mips_irq + 2 : 0; --} --EXPORT_SYMBOL(bcma_core_irq); -- - static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq) - { - unsigned int oldirq = bcma_core_mips_irq(dev); -@@ -423,7 +416,7 @@ void bcma_core_mips_init(struct bcma_drv - break; - default: - list_for_each_entry(core, &bus->cores, list) { -- core->irq = bcma_core_irq(core); -+ core->irq = bcma_core_irq(core, 0); - } - bcma_err(bus, - "Unknown device (0x%x) found, can not configure IRQs\n", ---- a/drivers/bcma/driver_pci_host.c -+++ b/drivers/bcma/driver_pci_host.c -@@ -593,7 +593,7 @@ int bcma_core_pci_plat_dev_init(struct p - pr_info("PCI: Fixing up device %s\n", pci_name(dev)); - - /* Fix up interrupt lines */ -- dev->irq = bcma_core_irq(pc_host->pdev->core); -+ dev->irq = bcma_core_irq(pc_host->pdev->core, 0); - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); - - readrq = pcie_get_readrq(dev); -@@ -617,6 +617,6 @@ int bcma_core_pci_pcibios_map_irq(const - - pc_host = container_of(dev->bus->ops, struct bcma_drv_pci_host, - pci_ops); -- return bcma_core_irq(pc_host->pdev->core); -+ return bcma_core_irq(pc_host->pdev->core, 0); - } - EXPORT_SYMBOL(bcma_core_pci_pcibios_map_irq); ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - MODULE_DESCRIPTION("Broadcom's specific AMBA driver"); - MODULE_LICENSE("GPL"); -@@ -153,6 +154,46 @@ static struct device_node *bcma_of_find_ - return NULL; - } - -+static int bcma_of_irq_parse(struct platform_device *parent, -+ struct bcma_device *core, -+ struct of_phandle_args *out_irq, int num) -+{ -+ __be32 laddr[1]; -+ int rc; -+ -+ if (core->dev.of_node) { -+ rc = of_irq_parse_one(core->dev.of_node, num, out_irq); -+ if (!rc) -+ return rc; -+ } -+ -+ out_irq->np = parent->dev.of_node; -+ out_irq->args_count = 1; -+ out_irq->args[0] = num; -+ -+ laddr[0] = cpu_to_be32(core->addr); -+ return of_irq_parse_raw(laddr, out_irq); -+} -+ -+static unsigned int bcma_of_get_irq(struct platform_device *parent, -+ struct bcma_device *core, int num) -+{ -+ struct of_phandle_args out_irq; -+ int ret; -+ -+ if (!parent || !parent->dev.of_node) -+ return 0; -+ -+ ret = bcma_of_irq_parse(parent, core, &out_irq, num); -+ if (ret) { -+ bcma_debug(core->bus, "bcma_of_get_irq() failed with rc=%d\n", -+ ret); -+ return 0; -+ } -+ -+ return irq_create_of_mapping(&out_irq); -+} -+ - static void bcma_of_fill_device(struct platform_device *parent, - struct bcma_device *core) - { -@@ -161,18 +202,47 @@ static void bcma_of_fill_device(struct p - node = bcma_of_find_child_device(parent, core); - if (node) - core->dev.of_node = node; -+ -+ core->irq = bcma_of_get_irq(parent, core, 0); - } - #else - static void bcma_of_fill_device(struct platform_device *parent, - struct bcma_device *core) - { - } -+static inline unsigned int bcma_of_get_irq(struct platform_device *parent, -+ struct bcma_device *core, int num) -+{ -+ return 0; -+} - #endif /* CONFIG_OF */ - --static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) -+unsigned int bcma_core_irq(struct bcma_device *core, int num) - { -- int err; -+ struct bcma_bus *bus = core->bus; -+ unsigned int mips_irq; -+ -+ switch (bus->hosttype) { -+ case BCMA_HOSTTYPE_PCI: -+ return bus->host_pci->irq; -+ case BCMA_HOSTTYPE_SOC: -+ if (bus->drv_mips.core && num == 0) { -+ mips_irq = bcma_core_mips_irq(core); -+ return mips_irq <= 4 ? mips_irq + 2 : 0; -+ } -+ if (bus->host_pdev) -+ return bcma_of_get_irq(bus->host_pdev, core, num); -+ return 0; -+ case BCMA_HOSTTYPE_SDIO: -+ return 0; -+ } - -+ return 0; -+} -+EXPORT_SYMBOL(bcma_core_irq); -+ -+void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) -+{ - core->dev.release = bcma_release_core_dev; - core->dev.bus = &bcma_bus_type; - dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); -@@ -196,6 +266,11 @@ static void bcma_register_core(struct bc - case BCMA_HOSTTYPE_SDIO: - break; - } -+} -+ -+static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) -+{ -+ int err; - - err = device_register(&core->dev); - if (err) { ---- a/drivers/bcma/scan.c -+++ b/drivers/bcma/scan.c -@@ -505,6 +505,7 @@ int bcma_bus_scan(struct bcma_bus *bus) - bus->nr_cores++; - other_core = bcma_find_core_reverse(bus, core->id.id); - core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1; -+ bcma_prepare_core(bus, core); - - bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", - core->core_index, bcma_device_name(&core->id), ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -448,4 +448,6 @@ extern u32 bcma_chipco_pll_read(struct b - #define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */ - extern u32 bcma_core_dma_translation(struct bcma_device *core); - -+extern unsigned int bcma_core_irq(struct bcma_device *core, int num); -+ - #endif /* LINUX_BCMA_H_ */ ---- a/include/linux/bcma/bcma_driver_mips.h -+++ b/include/linux/bcma/bcma_driver_mips.h -@@ -43,12 +43,12 @@ struct bcma_drv_mips { - extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); - extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); - --extern unsigned int bcma_core_irq(struct bcma_device *core); -+extern unsigned int bcma_core_mips_irq(struct bcma_device *dev); - #else - static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } - static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } - --static inline unsigned int bcma_core_irq(struct bcma_device *core) -+static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) - { - return 0; - } ---- a/Documentation/devicetree/bindings/bus/bcma.txt -+++ b/Documentation/devicetree/bindings/bus/bcma.txt -@@ -8,6 +8,11 @@ Required properties: - - The cores on the AXI bus are automatically detected by bcma with the - memory ranges they are using and they get registered afterwards. -+Automatic detection of the IRQ number is not working on -+BCM47xx/BCM53xx ARM SoCs. To assign IRQ numbers to the cores, provide -+them manually through device tree. Use an interrupt-map to specify the -+IRQ used by the devices on the bus. The first address is just an index, -+because we do not have any special register. - - The top-level axi bus may contain children representing attached cores - (devices). This is needed since some hardware details can't be auto -@@ -22,6 +27,22 @@ Example: - ranges = <0x00000000 0x18000000 0x00100000>; - #address-cells = <1>; - #size-cells = <1>; -+ #interrupt-cells = <1>; -+ interrupt-map-mask = <0x000fffff 0xffff>; -+ interrupt-map = -+ /* Ethernet Controller 0 */ -+ <0x00024000 0 &gic GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>, -+ -+ /* Ethernet Controller 1 */ -+ <0x00025000 0 &gic GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; -+ -+ /* PCIe Controller 0 */ -+ <0x00012000 0 &gic GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 1 &gic GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 2 &gic GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 3 &gic GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 4 &gic GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>, -+ <0x00012000 5 &gic GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; - - chipcommon { - reg = <0x00000000 0x1000>; diff --git a/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch b/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch deleted file mode 100644 index 628b0bd38..000000000 --- a/target/linux/generic/pending-3.18/026-bcma-from-3.20.patch +++ /dev/null @@ -1,527 +0,0 @@ ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -23,22 +23,18 @@ struct bcma_bus; - bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value, - int timeout); - void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); -+void bcma_init_bus(struct bcma_bus *bus); - int bcma_bus_register(struct bcma_bus *bus); - void bcma_bus_unregister(struct bcma_bus *bus); --int __init bcma_bus_early_register(struct bcma_bus *bus, -- struct bcma_device *core_cc, -- struct bcma_device *core_mips); -+int __init bcma_bus_early_register(struct bcma_bus *bus); - #ifdef CONFIG_PM - int bcma_bus_suspend(struct bcma_bus *bus); - int bcma_bus_resume(struct bcma_bus *bus); - #endif - - /* scan.c */ -+void bcma_detect_chip(struct bcma_bus *bus); - int bcma_bus_scan(struct bcma_bus *bus); --int __init bcma_bus_scan_early(struct bcma_bus *bus, -- struct bcma_device_id *match, -- struct bcma_device *core); --void bcma_init_bus(struct bcma_bus *bus); - - /* sprom.c */ - int bcma_sprom_get(struct bcma_bus *bus); -@@ -109,6 +105,14 @@ extern int bcma_chipco_watchdog_register - #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE - bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); - void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); -+#else -+static inline bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) -+{ -+ return false; -+} -+static inline void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) -+{ -+} - #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ - - #ifdef CONFIG_BCMA_DRIVER_GPIO ---- a/drivers/bcma/driver_chipcommon.c -+++ b/drivers/bcma/driver_chipcommon.c -@@ -79,7 +79,9 @@ static int bcma_chipco_watchdog_ticks_pe - - if (cc->capabilities & BCMA_CC_CAP_PMU) { - if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) -- /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */ -+ /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP -+ * clock -+ */ - return bcma_chipco_get_alp_clock(cc) / 4000; - else - /* based on 32KHz ILP clock */ -@@ -97,7 +99,8 @@ int bcma_chipco_watchdog_register(struct - wdt.driver_data = cc; - wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; - wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; -- wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; -+ wdt.max_timer_ms = -+ bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; - - pdev = platform_device_register_data(NULL, "bcm47xx-wdt", - cc->core->bus->num, &wdt, -@@ -175,7 +178,6 @@ void bcma_core_chipcommon_init(struct bc - u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) - { - u32 maxt; -- enum bcma_clkmode clkmode; - - maxt = bcma_chipco_watchdog_get_max_timer(cc); - if (cc->capabilities & BCMA_CC_CAP_PMU) { -@@ -185,8 +187,13 @@ u32 bcma_chipco_watchdog_timer_set(struc - ticks = maxt; - bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); - } else { -- clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC; -- bcma_core_set_clockmode(cc->core, clkmode); -+ struct bcma_bus *bus = cc->core->bus; -+ -+ if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 && -+ bus->chipinfo.id != BCMA_CHIP_ID_BCM53018) -+ bcma_core_set_clockmode(cc->core, -+ ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC); -+ - if (ticks > maxt) - ticks = maxt; - /* instant NMI */ -@@ -335,7 +342,8 @@ void bcma_chipco_serial_init(struct bcma - | BCMA_CC_CORECTL_UARTCLKEN); - } - } else { -- bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", ccrev); -+ bcma_err(cc->core->bus, "serial not supported on this device ccrev: 0x%x\n", -+ ccrev); - return; - } - ---- a/drivers/bcma/driver_pci.c -+++ b/drivers/bcma/driver_pci.c -@@ -145,6 +145,47 @@ static u16 bcma_pcie_mdio_writeread(stru - } - - /************************************************** -+ * Early init. -+ **************************************************/ -+ -+static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) -+{ -+ struct bcma_device *core = pc->core; -+ u16 val16, core_index; -+ uint regoff; -+ -+ regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); -+ core_index = (u16)core->core_index; -+ -+ val16 = pcicore_read16(pc, regoff); -+ if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) -+ != core_index) { -+ val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | -+ (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); -+ pcicore_write16(pc, regoff, val16); -+ } -+} -+ -+/* -+ * Apply some early fixes required before accessing SPROM. -+ * See also si_pci_fixcfg. -+ */ -+void bcma_core_pci_early_init(struct bcma_drv_pci *pc) -+{ -+ if (pc->early_setup_done) -+ return; -+ -+ pc->hostmode = bcma_core_pci_is_in_hostmode(pc); -+ if (pc->hostmode) -+ goto out; -+ -+ bcma_core_pci_fixcfg(pc); -+ -+out: -+ pc->early_setup_done = true; -+} -+ -+/************************************************** - * Workarounds. - **************************************************/ - -@@ -175,24 +216,6 @@ static void bcma_pcicore_serdes_workarou - tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN); - } - --static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) --{ -- struct bcma_device *core = pc->core; -- u16 val16, core_index; -- uint regoff; -- -- regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); -- core_index = (u16)core->core_index; -- -- val16 = pcicore_read16(pc, regoff); -- if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) -- != core_index) { -- val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | -- (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); -- pcicore_write16(pc, regoff, val16); -- } --} -- - /* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */ - /* Needs to happen when coming out of 'standby'/'hibernate' */ - static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) -@@ -216,7 +239,6 @@ static void bcma_core_pci_config_fixup(s - - static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) - { -- bcma_core_pci_fixcfg(pc); - bcma_pcicore_serdes_workaround(pc); - bcma_core_pci_config_fixup(pc); - } -@@ -226,13 +248,11 @@ void bcma_core_pci_init(struct bcma_drv_ - if (pc->setup_done) - return; - --#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE -- pc->hostmode = bcma_core_pci_is_in_hostmode(pc); -+ bcma_core_pci_early_init(pc); -+ - if (pc->hostmode) - bcma_core_pci_hostmode_init(pc); --#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ -- -- if (!pc->hostmode) -+ else - bcma_core_pci_clientmode_init(pc); - } - ---- a/drivers/bcma/host_pci.c -+++ b/drivers/bcma/host_pci.c -@@ -13,10 +13,12 @@ - - static void bcma_host_pci_switch_core(struct bcma_device *core) - { -+ int win2 = core->bus->host_is_pcie2 ? -+ BCMA_PCIE2_BAR0_WIN2 : BCMA_PCI_BAR0_WIN2; -+ - pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN, - core->addr); -- pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN2, -- core->wrap); -+ pci_write_config_dword(core->bus->host_pci, win2, core->wrap); - core->bus->mapped_core = core; - bcma_debug(core->bus, "Switched to core: 0x%X\n", core->id.id); - } ---- a/drivers/bcma/host_soc.c -+++ b/drivers/bcma/host_soc.c -@@ -193,7 +193,7 @@ int __init bcma_host_soc_init(struct bcm - int err; - - /* Scan bus and initialize it */ -- err = bcma_bus_early_register(bus, &soc->core_cc, &soc->core_mips); -+ err = bcma_bus_early_register(bus); - if (err) - iounmap(bus->mmio); - ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -268,6 +268,18 @@ void bcma_prepare_core(struct bcma_bus * - } - } - -+void bcma_init_bus(struct bcma_bus *bus) -+{ -+ mutex_lock(&bcma_buses_mutex); -+ bus->num = bcma_bus_next_num++; -+ mutex_unlock(&bcma_buses_mutex); -+ -+ INIT_LIST_HEAD(&bus->cores); -+ bus->nr_cores = 0; -+ -+ bcma_detect_chip(bus); -+} -+ - static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) - { - int err; -@@ -356,12 +368,19 @@ static void bcma_unregister_cores(struct - struct bcma_device *core, *tmp; - - list_for_each_entry_safe(core, tmp, &bus->cores, list) { -+ if (!core->dev_registered) -+ continue; - list_del(&core->list); -- if (core->dev_registered) -- device_unregister(&core->dev); -+ device_unregister(&core->dev); - } - if (bus->hosttype == BCMA_HOSTTYPE_SOC) - platform_device_unregister(bus->drv_cc.watchdog); -+ -+ /* Now noone uses internally-handled cores, we can free them */ -+ list_for_each_entry_safe(core, tmp, &bus->cores, list) { -+ list_del(&core->list); -+ kfree(core); -+ } - } - - int bcma_bus_register(struct bcma_bus *bus) -@@ -369,10 +388,6 @@ int bcma_bus_register(struct bcma_bus *b - int err; - struct bcma_device *core; - -- mutex_lock(&bcma_buses_mutex); -- bus->num = bcma_bus_next_num++; -- mutex_unlock(&bcma_buses_mutex); -- - /* Scan for devices (cores) */ - err = bcma_bus_scan(bus); - if (err) { -@@ -387,6 +402,13 @@ int bcma_bus_register(struct bcma_bus *b - bcma_core_chipcommon_early_init(&bus->drv_cc); - } - -+ /* Early init PCIE core */ -+ core = bcma_find_core(bus, BCMA_CORE_PCIE); -+ if (core) { -+ bus->drv_pci[0].core = core; -+ bcma_core_pci_early_init(&bus->drv_pci[0]); -+ } -+ - /* Cores providing flash access go before SPROM init */ - list_for_each_entry(core, &bus->cores, list) { - if (bcma_is_core_needed_early(core->id.id)) -@@ -459,7 +481,6 @@ int bcma_bus_register(struct bcma_bus *b - - void bcma_bus_unregister(struct bcma_bus *bus) - { -- struct bcma_device *cores[3]; - int err; - - err = bcma_gpio_unregister(&bus->drv_cc); -@@ -470,46 +491,23 @@ void bcma_bus_unregister(struct bcma_bus - - bcma_core_chipcommon_b_free(&bus->drv_cc_b); - -- cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); -- cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); -- cores[2] = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON); -- - bcma_unregister_cores(bus); -- -- kfree(cores[2]); -- kfree(cores[1]); -- kfree(cores[0]); - } - --int __init bcma_bus_early_register(struct bcma_bus *bus, -- struct bcma_device *core_cc, -- struct bcma_device *core_mips) -+/* -+ * This is a special version of bus registration function designed for SoCs. -+ * It scans bus and performs basic initialization of main cores only. -+ * Please note it requires memory allocation, however it won't try to sleep. -+ */ -+int __init bcma_bus_early_register(struct bcma_bus *bus) - { - int err; - struct bcma_device *core; -- struct bcma_device_id match; -- -- match.manuf = BCMA_MANUF_BCM; -- match.id = bcma_cc_core_id(bus); -- match.class = BCMA_CL_SIM; -- match.rev = BCMA_ANY_REV; - -- /* Scan for chip common core */ -- err = bcma_bus_scan_early(bus, &match, core_cc); -- if (err) { -- bcma_err(bus, "Failed to scan for common core: %d\n", err); -- return -1; -- } -- -- match.manuf = BCMA_MANUF_MIPS; -- match.id = BCMA_CORE_MIPS_74K; -- match.class = BCMA_CL_SIM; -- match.rev = BCMA_ANY_REV; -- -- /* Scan for mips core */ -- err = bcma_bus_scan_early(bus, &match, core_mips); -+ /* Scan for devices (cores) */ -+ err = bcma_bus_scan(bus); - if (err) { -- bcma_err(bus, "Failed to scan for mips core: %d\n", err); -+ bcma_err(bus, "Failed to scan bus: %d\n", err); - return -1; - } - ---- a/drivers/bcma/scan.c -+++ b/drivers/bcma/scan.c -@@ -435,15 +435,12 @@ static int bcma_get_next_core(struct bcm - return 0; - } - --void bcma_init_bus(struct bcma_bus *bus) -+void bcma_detect_chip(struct bcma_bus *bus) - { - s32 tmp; - struct bcma_chipinfo *chipinfo = &(bus->chipinfo); - char chip_id[8]; - -- INIT_LIST_HEAD(&bus->cores); -- bus->nr_cores = 0; -- - bcma_scan_switch_core(bus, BCMA_ADDR_BASE); - - tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); -@@ -464,6 +461,10 @@ int bcma_bus_scan(struct bcma_bus *bus) - - int err, core_num = 0; - -+ /* Skip if bus was already scanned (e.g. during early register) */ -+ if (bus->nr_cores) -+ return 0; -+ - erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); - if (bus->hosttype == BCMA_HOSTTYPE_SOC) { - eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); -@@ -519,64 +520,6 @@ int bcma_bus_scan(struct bcma_bus *bus) - out: - if (bus->hosttype == BCMA_HOSTTYPE_SOC) - iounmap(eromptr); -- -- return err; --} -- --int __init bcma_bus_scan_early(struct bcma_bus *bus, -- struct bcma_device_id *match, -- struct bcma_device *core) --{ -- u32 erombase; -- u32 __iomem *eromptr, *eromend; -- -- int err = -ENODEV; -- int core_num = 0; -- -- erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); -- if (bus->hosttype == BCMA_HOSTTYPE_SOC) { -- eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE); -- if (!eromptr) -- return -ENOMEM; -- } else { -- eromptr = bus->mmio; -- } -- -- eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32); -- -- bcma_scan_switch_core(bus, erombase); -- -- while (eromptr < eromend) { -- memset(core, 0, sizeof(*core)); -- INIT_LIST_HEAD(&core->list); -- core->bus = bus; -- -- err = bcma_get_next_core(bus, &eromptr, match, core_num, core); -- if (err == -ENODEV) { -- core_num++; -- continue; -- } else if (err == -ENXIO) -- continue; -- else if (err == -ESPIPE) -- break; -- else if (err < 0) -- goto out; -- -- core->core_index = core_num++; -- bus->nr_cores++; -- bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", -- core->core_index, bcma_device_name(&core->id), -- core->id.manuf, core->id.id, core->id.rev, -- core->id.class); -- -- list_add_tail(&core->list, &bus->cores); -- err = 0; -- break; -- } -- --out: -- if (bus->hosttype == BCMA_HOSTTYPE_SOC) -- iounmap(eromptr); - - return err; - } ---- a/drivers/bcma/sprom.c -+++ b/drivers/bcma/sprom.c -@@ -579,7 +579,8 @@ int bcma_sprom_get(struct bcma_bus *bus) - u16 offset = BCMA_CC_SPROM; - u16 *sprom; - size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4, -- SSB_SPROMSIZE_WORDS_R10, }; -+ SSB_SPROMSIZE_WORDS_R10, -+ SSB_SPROMSIZE_WORDS_R11, }; - int i, err = 0; - - if (!bus->drv_cc.core) ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -319,6 +319,7 @@ struct bcma_bus { - const struct bcma_host_ops *ops; - - enum bcma_hosttype hosttype; -+ bool host_is_pcie2; /* Used for BCMA_HOSTTYPE_PCI only */ - union { - /* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */ - struct pci_dev *host_pci; ---- a/include/linux/bcma/bcma_driver_pci.h -+++ b/include/linux/bcma/bcma_driver_pci.h -@@ -223,6 +223,7 @@ struct bcma_drv_pci_host { - - struct bcma_drv_pci { - struct bcma_device *core; -+ u8 early_setup_done:1; - u8 setup_done:1; - u8 hostmode:1; - -@@ -237,6 +238,7 @@ struct bcma_drv_pci { - #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) - #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) - -+extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); - extern void bcma_core_pci_init(struct bcma_drv_pci *pc); - extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, - struct bcma_device *core, bool enable); ---- a/include/linux/bcma/bcma_regs.h -+++ b/include/linux/bcma/bcma_regs.h -@@ -64,6 +64,8 @@ - #define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ - #define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ - -+#define BCMA_PCIE2_BAR0_WIN2 0x70 -+ - /* SiliconBackplane Address Map. - * All regions may not exist on all chips. - */ ---- a/include/linux/bcma/bcma_soc.h -+++ b/include/linux/bcma/bcma_soc.h -@@ -5,8 +5,6 @@ - - struct bcma_soc { - struct bcma_bus bus; -- struct bcma_device core_cc; -- struct bcma_device core_mips; - }; - - int __init bcma_host_soc_register(struct bcma_soc *soc); ---- a/include/linux/ssb/ssb_regs.h -+++ b/include/linux/ssb/ssb_regs.h -@@ -173,6 +173,7 @@ - #define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) - #define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) - #define SSB_SPROMSIZE_WORDS_R10 230 -+#define SSB_SPROMSIZE_WORDS_R11 234 - #define SSB_SPROM_BASE1 0x1000 - #define SSB_SPROM_BASE31 0x0800 - #define SSB_SPROM_REVISION 0x007E diff --git a/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch b/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch deleted file mode 100644 index c88a816fe..000000000 --- a/target/linux/generic/pending-3.18/027-bcma-from-4.1.patch +++ /dev/null @@ -1,680 +0,0 @@ ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -24,6 +24,7 @@ bool bcma_wait_value(struct bcma_device - int timeout); - void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); - void bcma_init_bus(struct bcma_bus *bus); -+void bcma_unregister_cores(struct bcma_bus *bus); - int bcma_bus_register(struct bcma_bus *bus); - void bcma_bus_unregister(struct bcma_bus *bus); - int __init bcma_bus_early_register(struct bcma_bus *bus); -@@ -40,6 +41,9 @@ int bcma_bus_scan(struct bcma_bus *bus); - int bcma_sprom_get(struct bcma_bus *bus); - - /* driver_chipcommon.c */ -+void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); -+void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); -+void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); - #ifdef CONFIG_BCMA_DRIVER_MIPS - void bcma_chipco_serial_init(struct bcma_drv_cc *cc); - extern struct platform_device bcma_pflash_dev; -@@ -50,6 +54,8 @@ int bcma_core_chipcommon_b_init(struct b - void bcma_core_chipcommon_b_free(struct bcma_drv_cc_b *ccb); - - /* driver_chipcommon_pmu.c */ -+void bcma_pmu_early_init(struct bcma_drv_cc *cc); -+void bcma_pmu_init(struct bcma_drv_cc *cc); - u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc); - u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc); - -@@ -98,7 +104,35 @@ static inline void __exit bcma_host_soc_ - #endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */ - - /* driver_pci.c */ -+#ifdef CONFIG_BCMA_DRIVER_PCI - u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); -+void bcma_core_pci_early_init(struct bcma_drv_pci *pc); -+void bcma_core_pci_init(struct bcma_drv_pci *pc); -+void bcma_core_pci_up(struct bcma_drv_pci *pc); -+void bcma_core_pci_down(struct bcma_drv_pci *pc); -+#else -+static inline void bcma_core_pci_early_init(struct bcma_drv_pci *pc) -+{ -+ WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI); -+} -+static inline void bcma_core_pci_init(struct bcma_drv_pci *pc) -+{ -+ /* Initialization is required for PCI hosted bus */ -+ WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI); -+} -+#endif -+ -+/* driver_pcie2.c */ -+#ifdef CONFIG_BCMA_DRIVER_PCI -+void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); -+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2); -+#else -+static inline void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) -+{ -+ /* Initialization is required for PCI hosted bus */ -+ WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI); -+} -+#endif - - extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); - -@@ -115,6 +149,39 @@ static inline void bcma_core_pci_hostmod - } - #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ - -+/************************************************** -+ * driver_mips.c -+ **************************************************/ -+ -+#ifdef CONFIG_BCMA_DRIVER_MIPS -+unsigned int bcma_core_mips_irq(struct bcma_device *dev); -+void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); -+void bcma_core_mips_init(struct bcma_drv_mips *mcore); -+#else -+static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) -+{ -+ return 0; -+} -+static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) -+{ -+} -+static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) -+{ -+} -+#endif -+ -+/************************************************** -+ * driver_gmac_cmn.c -+ **************************************************/ -+ -+#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN -+void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); -+#else -+static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) -+{ -+} -+#endif -+ - #ifdef CONFIG_BCMA_DRIVER_GPIO - /* driver_gpio.c */ - int bcma_gpio_init(struct bcma_drv_cc *cc); ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -17,6 +17,8 @@ - - #include "bcma_private.h" - -+#define BCMA_GPIO_MAX_PINS 32 -+ - static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip) - { - return container_of(chip, struct bcma_drv_cc, gpio); -@@ -76,7 +78,7 @@ static void bcma_gpio_free(struct gpio_c - bcma_chipco_gpio_pullup(cc, 1 << gpio, 0); - } - --#if IS_BUILTIN(CONFIG_BCM47XX) -+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X) - static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) - { - struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); -@@ -204,6 +206,7 @@ static void bcma_gpio_irq_domain_exit(st - - int bcma_gpio_init(struct bcma_drv_cc *cc) - { -+ struct bcma_bus *bus = cc->core->bus; - struct gpio_chip *chip = &cc->gpio; - int err; - -@@ -215,14 +218,14 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->set = bcma_gpio_set_value; - chip->direction_input = bcma_gpio_direction_input; - chip->direction_output = bcma_gpio_direction_output; --#if IS_BUILTIN(CONFIG_BCM47XX) -+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X) - chip->to_irq = bcma_gpio_to_irq; - #endif - #if IS_BUILTIN(CONFIG_OF) - if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) - chip->of_node = cc->core->dev.of_node; - #endif -- switch (cc->core->bus->chipinfo.id) { -+ switch (bus->chipinfo.id) { - case BCMA_CHIP_ID_BCM5357: - case BCMA_CHIP_ID_BCM53572: - chip->ngpio = 32; -@@ -231,13 +234,17 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->ngpio = 16; - } - -- /* There is just one SoC in one device and its GPIO addresses should be -- * deterministic to address them more easily. The other buses could get -- * a random base number. */ -- if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) -- chip->base = 0; -- else -- chip->base = -1; -+ /* -+ * On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO -+ * pin numbers. We don't have Device Tree there and we can't really use -+ * relative (per chip) numbers. -+ * So let's use predictable base for BCM47XX and "random" for all other. -+ */ -+#if IS_BUILTIN(CONFIG_BCM47XX) -+ chip->base = bus->num * BCMA_GPIO_MAX_PINS; -+#else -+ chip->base = -1; -+#endif - - err = bcma_gpio_irq_domain_init(cc); - if (err) ---- a/drivers/bcma/driver_pci.c -+++ b/drivers/bcma/driver_pci.c -@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm - } - EXPORT_SYMBOL_GPL(bcma_core_pci_power_save); - --int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, -- bool enable) --{ -- struct pci_dev *pdev; -- u32 coremask, tmp; -- int err = 0; -- -- if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI) { -- /* This bcma device is not on a PCI host-bus. So the IRQs are -- * not routed through the PCI core. -- * So we must not enable routing through the PCI core. */ -- goto out; -- } -- -- pdev = pc->core->bus->host_pci; -- -- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); -- if (err) -- goto out; -- -- coremask = BIT(core->core_index) << 8; -- if (enable) -- tmp |= coremask; -- else -- tmp &= ~coremask; -- -- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); -- --out: -- return err; --} --EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl); -- - static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) - { - u32 w; -@@ -328,28 +295,12 @@ static void bcma_core_pci_extend_L1timer - bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG); - } - --void bcma_core_pci_up(struct bcma_bus *bus) -+void bcma_core_pci_up(struct bcma_drv_pci *pc) - { -- struct bcma_drv_pci *pc; -- -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) -- return; -- -- pc = &bus->drv_pci[0]; -- - bcma_core_pci_extend_L1timer(pc, true); - } --EXPORT_SYMBOL_GPL(bcma_core_pci_up); - --void bcma_core_pci_down(struct bcma_bus *bus) -+void bcma_core_pci_down(struct bcma_drv_pci *pc) - { -- struct bcma_drv_pci *pc; -- -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) -- return; -- -- pc = &bus->drv_pci[0]; -- - bcma_core_pci_extend_L1timer(pc, false); - } --EXPORT_SYMBOL_GPL(bcma_core_pci_down); ---- a/drivers/bcma/driver_pci_host.c -+++ b/drivers/bcma/driver_pci_host.c -@@ -11,6 +11,7 @@ - - #include "bcma_private.h" - #include -+#include - #include - #include - #include ---- a/drivers/bcma/driver_pcie2.c -+++ b/drivers/bcma/driver_pcie2.c -@@ -10,6 +10,7 @@ - - #include "bcma_private.h" - #include -+#include - - /************************************************** - * R/W ops. -@@ -156,14 +157,23 @@ static void pciedev_reg_pm_clk_period(st - - void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) - { -- struct bcma_chipinfo *ci = &pcie2->core->bus->chipinfo; -+ struct bcma_bus *bus = pcie2->core->bus; -+ struct bcma_chipinfo *ci = &bus->chipinfo; - u32 tmp; - - tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54)); - if ((tmp & 0xe) >> 1 == 2) - bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17); - -- /* TODO: Do we need pcie_reqsize? */ -+ switch (bus->chipinfo.id) { -+ case BCMA_CHIP_ID_BCM4360: -+ case BCMA_CHIP_ID_BCM4352: -+ pcie2->reqsize = 1024; -+ break; -+ default: -+ pcie2->reqsize = 128; -+ break; -+ } - - if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3) - bcma_core_pcie2_war_delay_perst_enab(pcie2, true); -@@ -173,3 +183,18 @@ void bcma_core_pcie2_init(struct bcma_dr - pciedev_crwlpciegen2_180(pcie2); - pciedev_crwlpciegen2_182(pcie2); - } -+ -+/************************************************** -+ * Runtime ops. -+ **************************************************/ -+ -+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2) -+{ -+ struct bcma_bus *bus = pcie2->core->bus; -+ struct pci_dev *dev = bus->host_pci; -+ int err; -+ -+ err = pcie_set_readrq(dev, pcie2->reqsize); -+ if (err) -+ bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err); -+} ---- a/drivers/bcma/host_pci.c -+++ b/drivers/bcma/host_pci.c -@@ -213,16 +213,26 @@ static int bcma_host_pci_probe(struct pc - /* Initialize struct, detect chip */ - bcma_init_bus(bus); - -+ /* Scan bus to find out generation of PCIe core */ -+ err = bcma_bus_scan(bus); -+ if (err) -+ goto err_pci_unmap_mmio; -+ -+ if (bcma_find_core(bus, BCMA_CORE_PCIE2)) -+ bus->host_is_pcie2 = true; -+ - /* Register */ - err = bcma_bus_register(bus); - if (err) -- goto err_pci_unmap_mmio; -+ goto err_unregister_cores; - - pci_set_drvdata(dev, bus); - - out: - return err; - -+err_unregister_cores: -+ bcma_unregister_cores(bus); - err_pci_unmap_mmio: - pci_iounmap(dev, bus->mmio); - err_pci_release_regions: -@@ -283,9 +293,12 @@ static const struct pci_device_id bcma_p - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, -+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43b1) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */ - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */ -@@ -310,3 +323,65 @@ void __exit bcma_host_pci_exit(void) - { - pci_unregister_driver(&bcma_pci_bridge_driver); - } -+ -+/************************************************** -+ * Runtime ops for drivers. -+ **************************************************/ -+ -+/* See also pcicore_up */ -+void bcma_host_pci_up(struct bcma_bus *bus) -+{ -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) -+ return; -+ -+ if (bus->host_is_pcie2) -+ bcma_core_pcie2_up(&bus->drv_pcie2); -+ else -+ bcma_core_pci_up(&bus->drv_pci[0]); -+} -+EXPORT_SYMBOL_GPL(bcma_host_pci_up); -+ -+/* See also pcicore_down */ -+void bcma_host_pci_down(struct bcma_bus *bus) -+{ -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) -+ return; -+ -+ if (!bus->host_is_pcie2) -+ bcma_core_pci_down(&bus->drv_pci[0]); -+} -+EXPORT_SYMBOL_GPL(bcma_host_pci_down); -+ -+/* See also si_pci_setup */ -+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core, -+ bool enable) -+{ -+ struct pci_dev *pdev; -+ u32 coremask, tmp; -+ int err = 0; -+ -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) { -+ /* This bcma device is not on a PCI host-bus. So the IRQs are -+ * not routed through the PCI core. -+ * So we must not enable routing through the PCI core. */ -+ goto out; -+ } -+ -+ pdev = bus->host_pci; -+ -+ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); -+ if (err) -+ goto out; -+ -+ coremask = BIT(core->core_index) << 8; -+ if (enable) -+ tmp |= coremask; -+ else -+ tmp &= ~coremask; -+ -+ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp); -+ -+out: -+ return err; -+} -+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl); ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -363,7 +363,7 @@ static int bcma_register_devices(struct - return 0; - } - --static void bcma_unregister_cores(struct bcma_bus *bus) -+void bcma_unregister_cores(struct bcma_bus *bus) - { - struct bcma_device *core, *tmp; - ---- a/drivers/net/wireless/b43/main.c -+++ b/drivers/net/wireless/b43/main.c -@@ -4770,7 +4770,7 @@ static void b43_wireless_core_exit(struc - switch (dev->dev->bus_type) { - #ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: -- bcma_core_pci_down(dev->dev->bdev->bus); -+ bcma_host_pci_down(dev->dev->bdev->bus); - break; - #endif - #ifdef CONFIG_B43_SSB -@@ -4817,9 +4817,9 @@ static int b43_wireless_core_init(struct - switch (dev->dev->bus_type) { - #ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: -- bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0], -+ bcma_host_pci_irq_ctl(dev->dev->bdev->bus, - dev->dev->bdev, true); -- bcma_core_pci_up(dev->dev->bdev->bus); -+ bcma_host_pci_up(dev->dev->bdev->bus); - break; - #endif - #ifdef CONFIG_B43_SSB ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c -@@ -4669,7 +4669,7 @@ static int brcms_b_attach(struct brcms_c - brcms_c_coredisable(wlc_hw); - - /* Match driver "down" state */ -- bcma_core_pci_down(wlc_hw->d11core->bus); -+ bcma_host_pci_down(wlc_hw->d11core->bus); - - /* turn off pll and xtal to match driver "down" state */ - brcms_b_xtal(wlc_hw, OFF); -@@ -4960,7 +4960,7 @@ static int brcms_b_up_prep(struct brcms_ - * Configure pci/pcmcia here instead of in brcms_c_attach() - * to allow mfg hotswap: down, hotswap (chip power cycle), up. - */ -- bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core, -+ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core, - true); - - /* -@@ -4970,12 +4970,12 @@ static int brcms_b_up_prep(struct brcms_ - */ - if (brcms_b_radio_read_hwdisabled(wlc_hw)) { - /* put SB PCI in down state again */ -- bcma_core_pci_down(wlc_hw->d11core->bus); -+ bcma_host_pci_down(wlc_hw->d11core->bus); - brcms_b_xtal(wlc_hw, OFF); - return -ENOMEDIUM; - } - -- bcma_core_pci_up(wlc_hw->d11core->bus); -+ bcma_host_pci_up(wlc_hw->d11core->bus); - - /* reset the d11 core */ - brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); -@@ -5172,7 +5172,7 @@ static int brcms_b_down_finish(struct br - - /* turn off primary xtal and pll */ - if (!wlc_hw->noreset) { -- bcma_core_pci_down(wlc_hw->d11core->bus); -+ bcma_host_pci_down(wlc_hw->d11core->bus); - brcms_b_xtal(wlc_hw, OFF); - } - } ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -435,6 +435,27 @@ static inline struct bcma_device *bcma_f - return bcma_find_core_unit(bus, coreid, 0); - } - -+#ifdef CONFIG_BCMA_HOST_PCI -+extern void bcma_host_pci_up(struct bcma_bus *bus); -+extern void bcma_host_pci_down(struct bcma_bus *bus); -+extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus, -+ struct bcma_device *core, bool enable); -+#else -+static inline void bcma_host_pci_up(struct bcma_bus *bus) -+{ -+} -+static inline void bcma_host_pci_down(struct bcma_bus *bus) -+{ -+} -+static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus, -+ struct bcma_device *core, bool enable) -+{ -+ if (bus->hosttype == BCMA_HOSTTYPE_PCI) -+ return -ENOTSUPP; -+ return 0; -+} -+#endif -+ - extern bool bcma_core_is_enabled(struct bcma_device *core); - extern void bcma_core_disable(struct bcma_device *core, u32 flags); - extern int bcma_core_enable(struct bcma_device *core, u32 flags); ---- a/include/linux/bcma/bcma_driver_pci.h -+++ b/include/linux/bcma/bcma_driver_pci.h -@@ -238,13 +238,13 @@ struct bcma_drv_pci { - #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) - #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) - --extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); --extern void bcma_core_pci_init(struct bcma_drv_pci *pc); --extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, -- struct bcma_device *core, bool enable); --extern void bcma_core_pci_up(struct bcma_bus *bus); --extern void bcma_core_pci_down(struct bcma_bus *bus); -+#ifdef CONFIG_BCMA_DRIVER_PCI - extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); -+#else -+static inline void bcma_core_pci_power_save(struct bcma_bus *bus, bool up) -+{ -+} -+#endif - - extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); - extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); ---- a/include/linux/bcma/bcma_driver_pcie2.h -+++ b/include/linux/bcma/bcma_driver_pcie2.h -@@ -143,6 +143,8 @@ - - struct bcma_drv_pcie2 { - struct bcma_device *core; -+ -+ u16 reqsize; - }; - - #define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset) -@@ -153,6 +155,4 @@ struct bcma_drv_pcie2 { - #define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set) - #define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask) - --void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); -- - #endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE - config BCMA_HOST_PCI - bool "Support for BCMA on PCI-host bus" - depends on BCMA_HOST_PCI_POSSIBLE -+ select BCMA_DRIVER_PCI - default y - - config BCMA_DRIVER_PCI_HOSTMODE -@@ -44,6 +45,22 @@ config BCMA_HOST_SOC - - If unsure, say N - -+config BCMA_DRIVER_PCI -+ bool "BCMA Broadcom PCI core driver" -+ depends on BCMA && PCI -+ default y -+ help -+ BCMA bus may have many versions of PCIe core. This driver -+ supports: -+ 1) PCIe core working in clientmode -+ 2) PCIe Gen 2 clientmode core -+ -+ In general PCIe (Gen 2) clientmode core is required on PCIe -+ hosted buses. It's responsible for initialization and basic -+ hardware management. -+ This driver is also prerequisite for a hostmode PCIe core -+ support. -+ - config BCMA_DRIVER_MIPS - bool "BCMA Broadcom MIPS core driver" - depends on BCMA && MIPS ---- a/drivers/bcma/Makefile -+++ b/drivers/bcma/Makefile -@@ -3,8 +3,8 @@ bcma-y += driver_chipcommon.o driver - bcma-y += driver_chipcommon_b.o - bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o - bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o --bcma-y += driver_pci.o --bcma-y += driver_pcie2.o -+bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o -+bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pcie2.o - bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o - bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o - bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o ---- a/include/linux/bcma/bcma_driver_chipcommon.h -+++ b/include/linux/bcma/bcma_driver_chipcommon.h -@@ -663,14 +663,6 @@ struct bcma_drv_cc_b { - #define bcma_cc_maskset32(cc, offset, mask, set) \ - bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) - --extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); --extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); -- --extern void bcma_chipco_suspend(struct bcma_drv_cc *cc); --extern void bcma_chipco_resume(struct bcma_drv_cc *cc); -- --void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); -- - extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); - - extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); -@@ -690,9 +682,6 @@ u32 bcma_chipco_gpio_pullup(struct bcma_ - u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value); - - /* PMU support */ --extern void bcma_pmu_init(struct bcma_drv_cc *cc); --extern void bcma_pmu_early_init(struct bcma_drv_cc *cc); -- - extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, - u32 value); - extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, ---- a/include/linux/bcma/bcma_driver_gmac_cmn.h -+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h -@@ -91,10 +91,4 @@ struct bcma_drv_gmac_cmn { - #define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val) - #define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) - --#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN --extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); --#else --static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { } --#endif -- - #endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */ ---- a/include/linux/bcma/bcma_driver_mips.h -+++ b/include/linux/bcma/bcma_driver_mips.h -@@ -39,21 +39,6 @@ struct bcma_drv_mips { - u8 early_setup_done:1; - }; - --#ifdef CONFIG_BCMA_DRIVER_MIPS --extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); --extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); -- --extern unsigned int bcma_core_mips_irq(struct bcma_device *dev); --#else --static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } --static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } -- --static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev) --{ -- return 0; --} --#endif -- - extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); - - #endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ diff --git a/target/linux/generic/pending-3.18/028-bcma-from-4.2.patch b/target/linux/generic/pending-3.18/028-bcma-from-4.2.patch deleted file mode 100644 index ba3df18bd..000000000 --- a/target/linux/generic/pending-3.18/028-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/pending-3.18/029-bcma-from-4.4.patch b/target/linux/generic/pending-3.18/029-bcma-from-4.4.patch deleted file mode 100644 index 5704081ee..000000000 --- a/target/linux/generic/pending-3.18/029-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/pending-3.18/030-backport_bcm47xx_nvram.patch b/target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch deleted file mode 100644 index 7ae8b1db6..000000000 --- a/target/linux/generic/pending-3.18/030-backport_bcm47xx_nvram.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- /dev/null -+++ b/include/linux/bcm47xx_nvram.h -@@ -0,0 +1,49 @@ -+/* -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ */ -+ -+#ifndef __BCM47XX_NVRAM_H -+#define __BCM47XX_NVRAM_H -+ -+#include -+#include -+#include -+ -+#ifdef CONFIG_BCM47XX_NVRAM -+int bcm47xx_nvram_init_from_mem(u32 base, u32 lim); -+int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len); -+int bcm47xx_nvram_gpio_pin(const char *name); -+char *bcm47xx_nvram_get_contents(size_t *val_len); -+static inline void bcm47xx_nvram_release_contents(char *nvram) -+{ -+ vfree(nvram); -+}; -+#else -+static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim) -+{ -+ return -ENOTSUPP; -+}; -+static inline int bcm47xx_nvram_getenv(const char *name, char *val, -+ size_t val_len) -+{ -+ return -ENOTSUPP; -+}; -+static inline int bcm47xx_nvram_gpio_pin(const char *name) -+{ -+ return -ENOTSUPP; -+}; -+ -+static inline char *bcm47xx_nvram_get_contents(size_t *val_len) -+{ -+ return NULL; -+}; -+ -+static inline void bcm47xx_nvram_release_contents(char *nvram) -+{ -+}; -+#endif -+ -+#endif /* __BCM47XX_NVRAM_H */ diff --git a/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch b/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch deleted file mode 100644 index 52a2391cc..000000000 --- a/target/linux/generic/pending-3.18/030-nl80211-Allow-set-network-namespace-by-fd.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Vadim Kochan -Date: Mon, 12 Jan 2015 16:34:05 +0200 -Subject: [PATCH] nl80211: Allow set network namespace by fd - -Added new NL80211_ATTR_NETNS_FD which allows to -set namespace via nl80211 by fd. - -Signed-off-by: Vadim Kochan -Signed-off-by: Johannes Berg ---- - ---- a/net/core/net_namespace.c -+++ b/net/core/net_namespace.c -@@ -361,6 +361,7 @@ struct net *get_net_ns_by_fd(int fd) - return ERR_PTR(-EINVAL); - } - #endif -+EXPORT_SYMBOL_GPL(get_net_ns_by_fd); - - struct net *get_net_ns_by_pid(pid_t pid) - { diff --git a/target/linux/generic/pending-3.18/031-bcma-from-4.5.patch b/target/linux/generic/pending-3.18/031-bcma-from-4.5.patch deleted file mode 100644 index 171395dce..000000000 --- a/target/linux/generic/pending-3.18/031-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/pending-3.18/032-bcma-from-4.6.patch b/target/linux/generic/pending-3.18/032-bcma-from-4.6.patch deleted file mode 100644 index 85eeaad4d..000000000 --- a/target/linux/generic/pending-3.18/032-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 -@@ -29,26 +27,6 @@ enum bcma_boot_dev { - BCMA_BOOT_DEV_NAND, - }; - --static const char * const part_probes[] = { "bcm47xxpart", NULL }; -- --static struct physmap_flash_data bcma_pflash_data = { -- .part_probe_types = part_probes, --}; -- --static struct resource bcma_pflash_resource = { -- .name = "bcma_pflash", -- .flags = IORESOURCE_MEM, --}; -- --struct platform_device bcma_pflash_dev = { -- .name = "physmap-flash", -- .dev = { -- .platform_data = &bcma_pflash_data, -- }, -- .resource = &bcma_pflash_resource, -- .num_resources = 1, --}; -- - /* The 47162a0 hangs when reading MIPS DMP registers registers */ - static inline bool bcma_core_mips_bcm47162a0_quirk(struct bcma_device *dev) - { -@@ -269,48 +247,11 @@ static enum bcma_boot_dev bcma_boot_dev( - return BCMA_BOOT_DEV_SERIAL; - } - --static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) -+static void bcma_core_mips_nvram_init(struct bcma_drv_mips *mcore) - { - struct bcma_bus *bus = mcore->core->bus; -- struct bcma_drv_cc *cc = &bus->drv_cc; -- struct bcma_pflash *pflash = &cc->pflash; - enum bcma_boot_dev boot_dev; - -- switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { -- case BCMA_CC_FLASHT_STSER: -- case BCMA_CC_FLASHT_ATSER: -- bcma_debug(bus, "Found serial flash\n"); -- bcma_sflash_init(cc); -- break; -- case BCMA_CC_FLASHT_PARA: -- bcma_debug(bus, "Found parallel flash\n"); -- pflash->present = true; -- pflash->window = BCMA_SOC_FLASH2; -- pflash->window_size = BCMA_SOC_FLASH2_SZ; -- -- if ((bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & -- BCMA_CC_FLASH_CFG_DS) == 0) -- pflash->buswidth = 1; -- else -- pflash->buswidth = 2; -- -- bcma_pflash_data.width = pflash->buswidth; -- bcma_pflash_resource.start = pflash->window; -- bcma_pflash_resource.end = pflash->window + pflash->window_size; -- -- break; -- default: -- bcma_err(bus, "Flash type not supported\n"); -- } -- -- if (cc->core->id.rev == 38 || -- bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { -- if (cc->capabilities & BCMA_CC_CAP_NFLASH) { -- bcma_debug(bus, "Found NAND flash\n"); -- bcma_nflash_init(cc); -- } -- } -- - /* Determine flash type this SoC boots from */ - boot_dev = bcma_boot_dev(bus); - switch (boot_dev) { -@@ -328,13 +269,10 @@ static void bcma_core_mips_flash_detect( - - void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) - { -- struct bcma_bus *bus = mcore->core->bus; -- - if (mcore->early_setup_done) - return; - -- bcma_chipco_serial_init(&bus->drv_cc); -- bcma_core_mips_flash_detect(mcore); -+ bcma_core_mips_nvram_init(mcore); - - mcore->early_setup_done = true; - } ---- a/drivers/bcma/host_pci.c -+++ b/drivers/bcma/host_pci.c -@@ -294,7 +294,7 @@ static const struct pci_device_id bcma_p - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) }, -- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) }, -+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_DELL, 0x0016) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -70,6 +70,11 @@ config BCMA_DRIVER_MIPS - - If unsure, say N - -+config BCMA_PFLASH -+ bool -+ depends on BCMA_DRIVER_MIPS -+ default y -+ - config BCMA_SFLASH - bool - depends on BCMA_DRIVER_MIPS ---- a/drivers/bcma/Makefile -+++ b/drivers/bcma/Makefile -@@ -1,6 +1,7 @@ - bcma-y += main.o scan.o core.o sprom.o - bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o - bcma-y += driver_chipcommon_b.o -+bcma-$(CONFIG_BCMA_PFLASH) += driver_chipcommon_pflash.o - bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o - bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o - bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o ---- /dev/null -+++ b/drivers/bcma/driver_chipcommon_pflash.c -@@ -0,0 +1,49 @@ -+/* -+ * Broadcom specific AMBA -+ * ChipCommon parallel flash -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#include "bcma_private.h" -+ -+#include -+#include -+#include -+ -+static const char * const part_probes[] = { "bcm47xxpart", NULL }; -+ -+static struct physmap_flash_data bcma_pflash_data = { -+ .part_probe_types = part_probes, -+}; -+ -+static struct resource bcma_pflash_resource = { -+ .name = "bcma_pflash", -+ .flags = IORESOURCE_MEM, -+}; -+ -+struct platform_device bcma_pflash_dev = { -+ .name = "physmap-flash", -+ .dev = { -+ .platform_data = &bcma_pflash_data, -+ }, -+ .resource = &bcma_pflash_resource, -+ .num_resources = 1, -+}; -+ -+int bcma_pflash_init(struct bcma_drv_cc *cc) -+{ -+ struct bcma_pflash *pflash = &cc->pflash; -+ -+ pflash->present = true; -+ -+ if (!(bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & BCMA_CC_FLASH_CFG_DS)) -+ bcma_pflash_data.width = 1; -+ else -+ bcma_pflash_data.width = 2; -+ -+ bcma_pflash_resource.start = BCMA_SOC_FLASH2; -+ bcma_pflash_resource.end = BCMA_SOC_FLASH2 + BCMA_SOC_FLASH2_SZ; -+ -+ return 0; -+} ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -325,7 +325,7 @@ static int bcma_register_devices(struct - bcma_register_core(bus, core); - } - --#ifdef CONFIG_BCMA_DRIVER_MIPS -+#ifdef CONFIG_BCMA_PFLASH - if (bus->drv_cc.pflash.present) { - err = platform_device_register(&bcma_pflash_dev); - if (err) diff --git a/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch b/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch deleted file mode 100644 index b2d53f9f8..000000000 --- a/target/linux/generic/pending-3.18/040-mtd-bcm47xxpart-backports-from-3.19.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -15,8 +15,12 @@ - #include - #include - --/* 10 parts were found on sflash on Netgear WNDR4500 */ --#define BCM47XXPART_MAX_PARTS 12 -+/* -+ * NAND flash on Netgear R6250 was verified to contain 15 partitions. -+ * This will result in allocating too big array for some old devices, but the -+ * memory will be freed soon anyway (see mtd_device_parse_register). -+ */ -+#define BCM47XXPART_MAX_PARTS 20 - - /* - * Amount of bytes we read when analyzing each block of flash memory. -@@ -168,18 +172,26 @@ static int bcm47xxpart_parse(struct mtd_ - i++; - } - -- bcm47xxpart_add_part(&parts[curr_part++], "linux", -- offset + trx->offset[i], 0); -- i++; -+ if (trx->offset[i]) { -+ bcm47xxpart_add_part(&parts[curr_part++], -+ "linux", -+ offset + trx->offset[i], -+ 0); -+ i++; -+ } - - /* - * Pure rootfs size is known and can be calculated as: - * trx->length - trx->offset[i]. We don't fill it as - * we want to have jffs2 (overlay) in the same mtd. - */ -- bcm47xxpart_add_part(&parts[curr_part++], "rootfs", -- offset + trx->offset[i], 0); -- i++; -+ if (trx->offset[i]) { -+ bcm47xxpart_add_part(&parts[curr_part++], -+ "rootfs", -+ offset + trx->offset[i], -+ 0); -+ i++; -+ } - - last_trx_part = curr_part - 1; - diff --git a/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch b/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch deleted file mode 100644 index f3dfa901f..000000000 --- a/target/linux/generic/pending-3.18/041-mtd-bcm47xxpart-backports-from-3.20.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- a/drivers/mtd/bcm47xxpart.c -+++ b/drivers/mtd/bcm47xxpart.c -@@ -15,6 +15,8 @@ - #include - #include - -+#include -+ - /* - * NAND flash on Netgear R6250 was verified to contain 15 partitions. - * This will result in allocating too big array for some old devices, but the -@@ -39,7 +41,8 @@ - #define ML_MAGIC1 0x39685a42 - #define ML_MAGIC2 0x26594131 - #define TRX_MAGIC 0x30524448 --#define SQSH_MAGIC 0x71736873 /* shsq */ -+#define SHSQ_MAGIC 0x71736873 /* shsq (weird ZTE H218N endianness) */ -+#define UBI_EC_MAGIC 0x23494255 /* UBI# */ - - struct trx_header { - uint32_t magic; -@@ -50,7 +53,7 @@ struct trx_header { - uint32_t offset[3]; - } __packed; - --static void bcm47xxpart_add_part(struct mtd_partition *part, char *name, -+static void bcm47xxpart_add_part(struct mtd_partition *part, const char *name, - u64 offset, uint32_t mask_flags) - { - part->name = name; -@@ -58,6 +61,26 @@ static void bcm47xxpart_add_part(struct - part->mask_flags = mask_flags; - } - -+static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master, -+ size_t offset) -+{ -+ uint32_t buf; -+ size_t bytes_read; -+ -+ if (mtd_read(master, offset, sizeof(buf), &bytes_read, -+ (uint8_t *)&buf) < 0) { -+ pr_err("mtd_read error while parsing (offset: 0x%X)!\n", -+ offset); -+ goto out_default; -+ } -+ -+ if (buf == UBI_EC_MAGIC) -+ return "ubi"; -+ -+out_default: -+ return "rootfs"; -+} -+ - static int bcm47xxpart_parse(struct mtd_info *master, - struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -@@ -73,8 +96,12 @@ static int bcm47xxpart_parse(struct mtd_ - int last_trx_part = -1; - int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; - -- if (blocksize <= 0x10000) -- blocksize = 0x10000; -+ /* -+ * Some really old flashes (like AT45DB*) had smaller erasesize-s, but -+ * partitions were aligned to at least 0x1000 anyway. -+ */ -+ if (blocksize < 0x1000) -+ blocksize = 0x1000; - - /* Alloc */ - parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, -@@ -186,8 +213,11 @@ static int bcm47xxpart_parse(struct mtd_ - * we want to have jffs2 (overlay) in the same mtd. - */ - if (trx->offset[i]) { -+ const char *name; -+ -+ name = bcm47xxpart_trx_data_part_name(master, offset + trx->offset[i]); - bcm47xxpart_add_part(&parts[curr_part++], -- "rootfs", -+ name, - offset + trx->offset[i], - 0); - i++; -@@ -203,7 +233,8 @@ static int bcm47xxpart_parse(struct mtd_ - } - - /* Squashfs on devices not using TRX */ -- if (buf[0x000 / 4] == SQSH_MAGIC) { -+ if (le32_to_cpu(buf[0x000 / 4]) == SQUASHFS_MAGIC || -+ buf[0x000 / 4] == SHSQ_MAGIC) { - bcm47xxpart_add_part(&parts[curr_part++], "rootfs", - offset, 0); - continue; diff --git a/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch b/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch deleted file mode 100644 index b7bae34aa..000000000 --- a/target/linux/generic/pending-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch +++ /dev/null @@ -1,15 +0,0 @@ -mtd: spi-nor: support for (GigaDevice) GD25Q128B - -Signed-off-by: Rafał Miłecki -Signed-off-by: Brian Norris - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -510,6 +510,7 @@ static const struct spi_device_id spi_no - /* GigaDevice */ - { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, - { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, - - /* Intel/Numonyx -- xxxs33b */ - { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, diff --git a/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch b/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch deleted file mode 100644 index 24c264ba9..000000000 --- a/target/linux/generic/pending-3.18/044-backport-m25p80-jedec-probe.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -310,11 +310,21 @@ static const struct spi_device_id m25p_i - }; - MODULE_DEVICE_TABLE(spi, m25p_ids); - -+static const struct of_device_id m25p_of_table[] = { -+ /* -+ * Generic compatibility for SPI NOR that can be identified by the -+ * JEDEC READ ID opcode (0x9F). Use this, if possible. -+ */ -+ { .compatible = "jedec,spi-nor" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, m25p_of_table); - - static struct spi_driver m25p80_driver = { - .driver = { - .name = "m25p80", - .owner = THIS_MODULE, -+ .of_match_table = m25p_of_table, - }, - .id_table = m25p_ids, - .probe = m25p_probe, ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -934,8 +934,11 @@ int spi_nor_scan(struct spi_nor *nor, co - if (ret) - return ret; - -- id = spi_nor_match_id(name); -+ if (name) -+ id = spi_nor_match_id(name); - if (!id) -+ id = nor->read_id(nor); -+ if (IS_ERR_OR_NULL(id)) - return -ENOENT; - - info = (void *)id->driver_data; diff --git a/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch b/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch deleted file mode 100644 index 9f23db6a7..000000000 --- a/target/linux/generic/pending-3.18/050-backport_netfilter_rtcache.patch +++ /dev/null @@ -1,509 +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,391 @@ -+/* route cache for netfilter. -+ * -+ * (C) 2014 Red Hat GmbH -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+#include -+#endif -+ -+static void __nf_conn_rtcache_destroy(struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *dst = rtc->cached_dst[dir].dst; -+ -+ dst_release(dst); -+} -+ -+static void nf_conn_rtcache_destroy(struct nf_conn *ct) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ if (!rtc) -+ return; -+ -+ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_ORIGINAL); -+ __nf_conn_rtcache_destroy(rtc, IP_CT_DIR_REPLY); -+} -+ -+static void nf_ct_rtcache_ext_add(struct nf_conn *ct) -+{ -+ struct nf_conn_rtcache *rtc; -+ -+ rtc = nf_ct_ext_add(ct, NF_CT_EXT_RTCACHE, GFP_ATOMIC); -+ if (rtc) { -+ rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif = -1; -+ rtc->cached_dst[IP_CT_DIR_ORIGINAL].dst = NULL; -+ rtc->cached_dst[IP_CT_DIR_REPLY].iif = -1; -+ rtc->cached_dst[IP_CT_DIR_REPLY].dst = NULL; -+ } -+} -+ -+static struct nf_conn_rtcache *nf_ct_rtcache_find_usable(struct nf_conn *ct) -+{ -+ if (nf_ct_is_untracked(ct)) -+ return NULL; -+ return nf_ct_rtcache_find(ct); -+} -+ -+static struct dst_entry * -+nf_conn_rtcache_dst_get(const struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ return rtc->cached_dst[dir].dst; -+} -+ -+static u32 nf_rtcache_get_cookie(int pf, const struct dst_entry *dst) -+{ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ if (pf == NFPROTO_IPV6) { -+ const struct rt6_info *rt = (const struct rt6_info *)dst; -+ -+ if (rt->rt6i_node) -+ return (u32)rt->rt6i_node->fn_sernum; -+ } -+#endif -+ return 0; -+} -+ -+static void nf_conn_rtcache_dst_set(int pf, -+ struct nf_conn_rtcache *rtc, -+ struct dst_entry *dst, -+ enum ip_conntrack_dir dir, int iif) -+{ -+ if (rtc->cached_dst[dir].iif != iif) -+ rtc->cached_dst[dir].iif = iif; -+ -+ if (rtc->cached_dst[dir].dst != dst) { -+ struct dst_entry *old; -+ -+ dst_hold(dst); -+ -+ old = xchg(&rtc->cached_dst[dir].dst, dst); -+ dst_release(old); -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ if (pf == NFPROTO_IPV6) -+ rtc->cached_dst[dir].cookie = -+ nf_rtcache_get_cookie(pf, dst); -+#endif -+ } -+} -+ -+static void nf_conn_rtcache_dst_obsolete(struct nf_conn_rtcache *rtc, -+ enum ip_conntrack_dir dir) -+{ -+ struct dst_entry *old; -+ -+ pr_debug("Invalidate iif %d for dir %d on cache %p\n", -+ rtc->cached_dst[dir].iif, dir, rtc); -+ -+ old = xchg(&rtc->cached_dst[dir].dst, NULL); -+ dst_release(old); -+ rtc->cached_dst[dir].iif = -1; -+} -+ -+static unsigned int nf_rtcache_in(const struct nf_hook_ops *ops, -+ struct sk_buff *skb, -+ const struct net_device *in, -+ const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct nf_conn_rtcache *rtc; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct dst_entry *dst; -+ struct nf_conn *ct; -+ int iif; -+ u32 cookie; -+ -+ if (skb_dst(skb) || skb->sk) -+ return NF_ACCEPT; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (!ct) -+ return NF_ACCEPT; -+ -+ rtc = nf_ct_rtcache_find_usable(ct); -+ if (!rtc) -+ return NF_ACCEPT; -+ -+ /* if iif changes, don't use cache and let ip stack -+ * do route lookup. -+ * -+ * If rp_filter is enabled it might toss skb, so -+ * we don't want to avoid these checks. -+ */ -+ dir = CTINFO2DIR(ctinfo); -+ iif = nf_conn_rtcache_iif_get(rtc, dir); -+ if (in->ifindex != iif) { -+ pr_debug("ct %p, iif %d, cached iif %d, skip cached entry\n", -+ ct, iif, in->ifindex); -+ return NF_ACCEPT; -+ } -+ dst = nf_conn_rtcache_dst_get(rtc, dir); -+ if (dst == NULL) -+ return NF_ACCEPT; -+ -+ cookie = nf_rtcache_get_cookie(ops->pf, dst); -+ -+ dst = dst_check(dst, cookie); -+ pr_debug("obtained dst %p for skb %p, cookie %d\n", dst, skb, cookie); -+ if (likely(dst)) -+ skb_dst_set_noref_force(skb, dst); -+ else -+ nf_conn_rtcache_dst_obsolete(rtc, dir); -+ -+ return NF_ACCEPT; -+} -+ -+static unsigned int nf_rtcache_forward(const struct nf_hook_ops *ops, -+ struct sk_buff *skb, -+ const struct net_device *in, -+ const struct net_device *out, -+ int (*okfn)(struct sk_buff *)) -+{ -+ struct nf_conn_rtcache *rtc; -+ enum ip_conntrack_info ctinfo; -+ enum ip_conntrack_dir dir; -+ struct nf_conn *ct; -+ struct dst_entry *dst = skb_dst(skb); -+ int iif; -+ -+ ct = nf_ct_get(skb, &ctinfo); -+ if (!ct) -+ return NF_ACCEPT; -+ -+ if (dst && dst_xfrm(dst)) -+ return NF_ACCEPT; -+ -+ if (!nf_ct_is_confirmed(ct)) { -+ if (WARN_ON(nf_ct_rtcache_find(ct))) -+ return NF_ACCEPT; -+ nf_ct_rtcache_ext_add(ct); -+ return NF_ACCEPT; -+ } -+ -+ rtc = nf_ct_rtcache_find_usable(ct); -+ if (!rtc) -+ return NF_ACCEPT; -+ -+ dir = CTINFO2DIR(ctinfo); -+ iif = nf_conn_rtcache_iif_get(rtc, dir); -+ pr_debug("ct %p, skb %p, dir %d, iif %d, cached iif %d\n", -+ ct, skb, dir, iif, in->ifindex); -+ if (likely(in->ifindex == iif)) -+ return NF_ACCEPT; -+ -+ nf_conn_rtcache_dst_set(ops->pf, rtc, skb_dst(skb), dir, in->ifindex); -+ return NF_ACCEPT; -+} -+ -+static int nf_rtcache_dst_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ struct net_device *dev = data; -+ -+ if (!rtc) -+ return 0; -+ -+ if (dev->ifindex == rtc->cached_dst[IP_CT_DIR_ORIGINAL].iif || -+ dev->ifindex == rtc->cached_dst[IP_CT_DIR_REPLY].iif) { -+ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_ORIGINAL); -+ nf_conn_rtcache_dst_obsolete(rtc, IP_CT_DIR_REPLY); -+ } -+ -+ return 0; -+} -+ -+static int nf_rtcache_netdev_event(struct notifier_block *this, -+ unsigned long event, void *ptr) -+{ -+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); -+ struct net *net = dev_net(dev); -+ -+ if (event == NETDEV_DOWN) -+ nf_ct_iterate_cleanup(net, nf_rtcache_dst_remove, dev, 0, 0); -+ -+ return NOTIFY_DONE; -+} -+ -+static struct notifier_block nf_rtcache_notifier = { -+ .notifier_call = nf_rtcache_netdev_event, -+}; -+ -+static struct nf_hook_ops rtcache_ops[] = { -+ { -+ .hook = nf_rtcache_in, -+ .owner = THIS_MODULE, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward, -+ .owner = THIS_MODULE, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ { -+ .hook = nf_rtcache_in, -+ .owner = THIS_MODULE, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward, -+ .owner = THIS_MODULE, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#endif -+}; -+ -+static struct nf_ct_ext_type rtcache_extend __read_mostly = { -+ .len = sizeof(struct nf_conn_rtcache), -+ .align = __alignof__(struct nf_conn_rtcache), -+ .id = NF_CT_EXT_RTCACHE, -+ .destroy = nf_conn_rtcache_destroy, -+}; -+ -+static int __init nf_conntrack_rtcache_init(void) -+{ -+ int ret = nf_ct_extend_register(&rtcache_extend); -+ -+ if (ret < 0) { -+ pr_err("nf_conntrack_rtcache: Unable to register extension\n"); -+ return ret; -+ } -+ -+ ret = nf_register_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ if (ret < 0) { -+ nf_ct_extend_unregister(&rtcache_extend); -+ return ret; -+ } -+ -+ ret = register_netdevice_notifier(&nf_rtcache_notifier); -+ if (ret) { -+ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ nf_ct_extend_unregister(&rtcache_extend); -+ } -+ -+ return ret; -+} -+ -+static int nf_rtcache_ext_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ return rtc != NULL; -+} -+ -+static bool __exit nf_conntrack_rtcache_wait_for_dying(struct net *net) -+{ -+ bool wait = false; -+ int cpu; -+ -+ for_each_possible_cpu(cpu) { -+ struct nf_conntrack_tuple_hash *h; -+ struct hlist_nulls_node *n; -+ struct nf_conn *ct; -+ struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); -+ -+ rcu_read_lock(); -+ spin_lock_bh(&pcpu->lock); -+ -+ hlist_nulls_for_each_entry(h, n, &pcpu->dying, hnnode) { -+ ct = nf_ct_tuplehash_to_ctrack(h); -+ if (nf_ct_rtcache_find(ct) != NULL) { -+ wait = true; -+ break; -+ } -+ } -+ spin_unlock_bh(&pcpu->lock); -+ rcu_read_unlock(); -+ } -+ -+ return wait; -+} -+ -+static void __exit nf_conntrack_rtcache_fini(void) -+{ -+ struct net *net; -+ int count = 0; -+ -+ /* remove hooks so no new connections get rtcache extension */ -+ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ -+ synchronize_net(); -+ -+ unregister_netdevice_notifier(&nf_rtcache_notifier); -+ -+ rtnl_lock(); -+ -+ /* zap all conntracks with rtcache extension */ -+ for_each_net(net) -+ nf_ct_iterate_cleanup(net, nf_rtcache_ext_remove, NULL, 0, 0); -+ -+ for_each_net(net) { -+ /* .. and make sure they're gone from dying list, too */ -+ while (nf_conntrack_rtcache_wait_for_dying(net)) { -+ msleep(200); -+ WARN_ONCE(++count > 25, "Waiting for all rtcache conntracks to go away\n"); -+ } -+ } -+ -+ rtnl_unlock(); -+ synchronize_net(); -+ nf_ct_extend_unregister(&rtcache_extend); -+} -+module_init(nf_conntrack_rtcache_init); -+module_exit(nf_conntrack_rtcache_fini); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Florian Westphal "); -+MODULE_DESCRIPTION("Conntrack route cache extension"); diff --git a/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch b/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch deleted file mode 100644 index f7f88f813..000000000 --- a/target/linux/generic/pending-3.18/051-02-bridge-allow-setting-hash_max-multicast_router-if-in.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 6ae4ae8e512bd229f806c22f8a2cd751e4f987c2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Linus=20L=C3=BCssing?= -Date: Sat, 23 May 2015 03:12:34 +0200 -Subject: [PATCH] bridge: allow setting hash_max + multicast_router if - interface is down -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Network managers like netifd (used in OpenWRT for instance) try to -configure interface options after creation but before setting the -interface up. - -Unfortunately the sysfs / bridge currently only allows to configure the -hash_max and multicast_router options when the bridge interface is up. -But since br_multicast_init() doesn't start any timers and only sets -default values and initializes timers it should be save to reconfigure -the default values after that, before things actually get active after -the bridge is set up. - -Signed-off-by: Linus Lüssing -Signed-off-by: David S. Miller ---- - net/bridge/br_multicast.c | 24 +++--------------------- - 1 file changed, 3 insertions(+), 21 deletions(-) - ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -1948,11 +1948,9 @@ out: - - int br_multicast_set_router(struct net_bridge *br, unsigned long val) - { -- int err = -ENOENT; -+ int err = -EINVAL; - - spin_lock_bh(&br->multicast_lock); -- if (!netif_running(br->dev)) -- goto unlock; - - switch (val) { - case 0: -@@ -1963,13 +1961,8 @@ int br_multicast_set_router(struct net_b - br->multicast_router = val; - err = 0; - break; -- -- default: -- err = -EINVAL; -- break; - } - --unlock: - spin_unlock_bh(&br->multicast_lock); - - return err; -@@ -1978,11 +1971,9 @@ unlock: - int br_multicast_set_port_router(struct net_bridge_port *p, unsigned long val) - { - struct net_bridge *br = p->br; -- int err = -ENOENT; -+ int err = -EINVAL; - - spin_lock(&br->multicast_lock); -- if (!netif_running(br->dev) || p->state == BR_STATE_DISABLED) -- goto unlock; - - switch (val) { - case 0: -@@ -2004,13 +1995,8 @@ int br_multicast_set_port_router(struct - - br_multicast_add_router(br, p); - break; -- -- default: -- err = -EINVAL; -- break; - } - --unlock: - spin_unlock(&br->multicast_lock); - - return err; -@@ -2115,15 +2101,11 @@ unlock: - - int br_multicast_set_hash_max(struct net_bridge *br, unsigned long val) - { -- int err = -ENOENT; -+ int err = -EINVAL; - u32 old; - struct net_bridge_mdb_htable *mdb; - - spin_lock_bh(&br->multicast_lock); -- if (!netif_running(br->dev)) -- goto unlock; -- -- err = -EINVAL; - if (!is_power_of_2(val)) - goto unlock; - diff --git a/target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch b/target/linux/generic/pending-3.18/060-mips_decompressor_memmove.patch deleted file mode 100644 index d215b80ab..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/070-bgmac-register-napi-before-the-device.patch b/target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch deleted file mode 100644 index 0e7e4f8b1..000000000 --- a/target/linux/generic/pending-3.18/070-bgmac-register-napi-before-the-device.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6216642f200258708e47170ff14ba8ecb486f4f0 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 18 Jan 2015 19:49:58 +0100 -Subject: [PATCH] bgmac: register napi before the device - -napi should get registered before the netdev and not after. - -Signed-off-by: Hauke Mehrtens -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1521,6 +1521,8 @@ static int bgmac_probe(struct bcma_devic - if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) - bgmac_warn(bgmac, "Support for ADMtek ethernet switch not implemented\n"); - -+ netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); -+ - err = bgmac_mii_register(bgmac); - if (err) { - bgmac_err(bgmac, "Cannot register MDIO\n"); -@@ -1535,8 +1537,6 @@ static int bgmac_probe(struct bcma_devic - - netif_carrier_off(net_dev); - -- netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); -- - return 0; - - err_mii_unregister: -@@ -1555,9 +1555,9 @@ static void bgmac_remove(struct bcma_dev - { - struct bgmac *bgmac = bcma_get_drvdata(core); - -- netif_napi_del(&bgmac->napi); - unregister_netdev(bgmac->net_dev); - bgmac_mii_unregister(bgmac); -+ netif_napi_del(&bgmac->napi); - bgmac_dma_free(bgmac); - bcma_set_drvdata(core, NULL); - free_netdev(bgmac->net_dev); diff --git a/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch b/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch deleted file mode 100644 index cc43d367c..000000000 --- a/target/linux/generic/pending-3.18/071-bgmac-activate-irqs-only-if-there-is-nothing-to-poll.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 43f159c60a99318b1ef7d1d7c16c4dfdd06bfd90 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 18 Jan 2015 19:49:59 +0100 -Subject: [PATCH] bgmac: activate irqs only if there is nothing to poll - -IRQs should only get activated when there is nothing to poll in the -queue any more and to after every poll. - -Signed-off-by: Hauke Mehrtens -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1167,10 +1167,10 @@ static int bgmac_poll(struct napi_struct - bgmac->int_status = 0; - } - -- if (handled < weight) -+ if (handled < weight) { - napi_complete(napi); -- -- bgmac_chip_intrs_on(bgmac); -+ bgmac_chip_intrs_on(bgmac); -+ } - - return handled; - } diff --git a/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch b/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch deleted file mode 100644 index 17fe5dff5..000000000 --- a/target/linux/generic/pending-3.18/073-bgmac-Clean-warning-messages.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 8edfe3b6fad28da191c8fa15e4e0d8f7335a0091 Mon Sep 17 00:00:00 2001 -From: Peter Senna Tschudin -Date: Sat, 7 Mar 2015 12:10:26 +0100 -Subject: [PATCH] bgmac: Clean warning messages -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On my test environment the throughput of a file transfer drops -from 4.4MBps to 116KBps due the number of repeated warning -messages. This patch removes the warning messages as DMA works -correctly with addresses using 0xC0000000 bits. - -Signed-off-by: Peter Senna Tschudin -Acked-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 7 ------- - 1 file changed, 7 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -302,9 +302,6 @@ static int bgmac_dma_rx_skb_for_slot(str - slot->skb = skb; - slot->dma_addr = dma_addr; - -- if (slot->dma_addr & 0xC0000000) -- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); -- - return 0; - } - -@@ -505,8 +502,6 @@ static int bgmac_dma_alloc(struct bgmac - ring->mmio_base); - goto err_dma_free; - } -- if (ring->dma_base & 0xC0000000) -- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); - - ring->unaligned = bgmac_dma_unaligned(bgmac, ring, - BGMAC_DMA_RING_TX); -@@ -536,8 +531,6 @@ static int bgmac_dma_alloc(struct bgmac - err = -ENOMEM; - goto err_dma_free; - } -- if (ring->dma_base & 0xC0000000) -- bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); - - ring->unaligned = bgmac_dma_unaligned(bgmac, ring, - BGMAC_DMA_RING_RX); diff --git a/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch b/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch deleted file mode 100644 index 9f0baff0e..000000000 --- a/target/linux/generic/pending-3.18/074-bgmac-register-fixed-PHY-for-ARM-BCM470X-BCM5301X-ch.patch +++ /dev/null @@ -1,76 +0,0 @@ -From c25b23b8a387e7d31f7a74af8e37b61e9e6ebb21 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 20 Mar 2015 23:14:31 +0100 -Subject: [PATCH] bgmac: register fixed PHY for ARM BCM470X / BCM5301X chipsets -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On ARM SoCs with bgmac Ethernet hardware we don't have any normal PHY. -There is always a switch attached but it's not even controlled over MDIO -like in case of MIPS devices. -We need a fixed PHY to be able to send/receive packets from the switch. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 34 ++++++++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1330,13 +1331,46 @@ static void bgmac_adjust_link(struct net - } - } - -+static int bgmac_fixed_phy_register(struct bgmac *bgmac) -+{ -+ struct fixed_phy_status fphy_status = { -+ .link = 1, -+ .speed = SPEED_1000, -+ .duplex = DUPLEX_FULL, -+ }; -+ struct phy_device *phy_dev; -+ int err; -+ -+ phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL); -+ if (!phy_dev || IS_ERR(phy_dev)) { -+ bgmac_err(bgmac, "Failed to register fixed PHY device\n"); -+ return -ENODEV; -+ } -+ -+ err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link, -+ PHY_INTERFACE_MODE_MII); -+ if (err) { -+ bgmac_err(bgmac, "Connecting PHY failed\n"); -+ return err; -+ } -+ -+ bgmac->phy_dev = phy_dev; -+ -+ return err; -+} -+ - static int bgmac_mii_register(struct bgmac *bgmac) - { -+ struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo; - struct mii_bus *mii_bus; - struct phy_device *phy_dev; - char bus_id[MII_BUS_ID_SIZE + 3]; - int i, err = 0; - -+ if (ci->id == BCMA_CHIP_ID_BCM4707 || -+ ci->id == BCMA_CHIP_ID_BCM53018) -+ return bgmac_fixed_phy_register(bgmac); -+ - mii_bus = mdiobus_alloc(); - if (!mii_bus) - return -ENOMEM; diff --git a/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch b/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch deleted file mode 100644 index 4513667e3..000000000 --- a/target/linux/generic/pending-3.18/075-bgmac-allow-enabling-on-ARCH_BCM_5301X.patch +++ /dev/null @@ -1,28 +0,0 @@ -From fc300dc3733fdc328e6e10c7b8379b60c26cd648 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 20 Mar 2015 23:14:32 +0100 -Subject: [PATCH] bgmac: allow enabling on ARCH_BCM_5301X -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Home routers based on ARM SoCs like BCM4708 also have bcma bus with core -supported by bgmac. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/Kconfig -+++ b/drivers/net/ethernet/broadcom/Kconfig -@@ -143,7 +143,7 @@ config BNX2X_SRIOV - - config BGMAC - tristate "BCMA bus GBit core support" -- depends on BCMA_HOST_SOC && HAS_DMA && BCM47XX -+ depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X) - select PHYLIB - ---help--- - This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus. diff --git a/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch b/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch deleted file mode 100644 index 939016c2e..000000000 --- a/target/linux/generic/pending-3.18/076-net-phy-export-fixed_phy_register.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 37e9a6904520b525b542ecd67201164d06fdb95a Mon Sep 17 00:00:00 2001 -From: Mark Salter -Date: Thu, 11 Dec 2014 23:03:26 -0500 -Subject: [PATCH] net: phy: export fixed_phy_register() - -When building the bcmgenet driver as module, I get: - -ERROR: "fixed_phy_register" [drivers/net/ethernet/broadcom/genet/genet.ko] undefined! - -commit b0ba512e225d72 ("net: bcmgenet: enable driver to work without device -tree") which added a call to fixed_phy_register. But fixed_phy_register -needs to be exported if used from a module. - -Signed-off-by: Mark Salter -Acked-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/phy/fixed.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/phy/fixed.c -+++ b/drivers/net/phy/fixed.c -@@ -274,6 +274,7 @@ struct phy_device *fixed_phy_register(un - - return phy; - } -+EXPORT_SYMBOL_GPL(fixed_phy_register); - - static int __init fixed_mdio_bus_init(void) - { diff --git a/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch b/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch deleted file mode 100644 index fe8a60216..000000000 --- a/target/linux/generic/pending-3.18/077-01-bgmac-fix-descriptor-frame-start-end-definitions.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Mon, 23 Mar 2015 02:40:06 +0100 -Subject: [PATCH] bgmac: fix descriptor frame start/end definitions - -The start-of-frame and end-of-frame bits were accidentally swapped. -In the current code it does not make any difference, since they are -always used together. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -345,8 +345,8 @@ - - #define BGMAC_DESC_CTL0_EOT 0x10000000 /* End of ring */ - #define BGMAC_DESC_CTL0_IOC 0x20000000 /* IRQ on complete */ --#define BGMAC_DESC_CTL0_SOF 0x40000000 /* Start of frame */ --#define BGMAC_DESC_CTL0_EOF 0x80000000 /* End of frame */ -+#define BGMAC_DESC_CTL0_EOF 0x40000000 /* End of frame */ -+#define BGMAC_DESC_CTL0_SOF 0x80000000 /* Start of frame */ - #define BGMAC_DESC_CTL1_LEN 0x00001FFF - - #define BGMAC_PHY_NOREGS 0x1E diff --git a/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch b/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch deleted file mode 100644 index 8dc5242b5..000000000 --- a/target/linux/generic/pending-3.18/077-02-bgmac-implement-GRO-and-use-build_skb.patch +++ /dev/null @@ -1,189 +0,0 @@ -From: Felix Fietkau -Date: Mon, 23 Mar 2015 02:41:25 +0100 -Subject: [PATCH] bgmac: implement GRO and use build_skb - -This improves performance for routing and local rx - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -276,31 +276,31 @@ static int bgmac_dma_rx_skb_for_slot(str - struct bgmac_slot_info *slot) - { - struct device *dma_dev = bgmac->core->dma_dev; -- struct sk_buff *skb; - dma_addr_t dma_addr; - struct bgmac_rx_header *rx; -+ void *buf; - - /* Alloc skb */ -- skb = netdev_alloc_skb(bgmac->net_dev, BGMAC_RX_BUF_SIZE); -- if (!skb) -+ buf = netdev_alloc_frag(BGMAC_RX_ALLOC_SIZE); -+ if (!buf) - return -ENOMEM; - - /* Poison - if everything goes fine, hardware will overwrite it */ -- rx = (struct bgmac_rx_header *)skb->data; -+ rx = buf; - rx->len = cpu_to_le16(0xdead); - rx->flags = cpu_to_le16(0xbeef); - - /* Map skb for the DMA */ -- dma_addr = dma_map_single(dma_dev, skb->data, -- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -+ dma_addr = dma_map_single(dma_dev, buf, BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); - if (dma_mapping_error(dma_dev, dma_addr)) { - bgmac_err(bgmac, "DMA mapping error\n"); -- dev_kfree_skb(skb); -+ put_page(virt_to_head_page(buf)); - return -ENOMEM; - } - - /* Update the slot */ -- slot->skb = skb; -+ slot->buf = buf; - slot->dma_addr = dma_addr; - - return 0; -@@ -343,8 +343,9 @@ static int bgmac_dma_rx_read(struct bgma - while (ring->start != ring->end) { - struct device *dma_dev = bgmac->core->dma_dev; - struct bgmac_slot_info *slot = &ring->slots[ring->start]; -- struct sk_buff *skb = slot->skb; -- struct bgmac_rx_header *rx; -+ struct bgmac_rx_header *rx = slot->buf; -+ struct sk_buff *skb; -+ void *buf = slot->buf; - u16 len, flags; - - /* Unmap buffer to make it accessible to the CPU */ -@@ -352,7 +353,6 @@ static int bgmac_dma_rx_read(struct bgma - BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - - /* Get info from the header */ -- rx = (struct bgmac_rx_header *)skb->data; - len = le16_to_cpu(rx->len); - flags = le16_to_cpu(rx->flags); - -@@ -393,12 +393,13 @@ static int bgmac_dma_rx_read(struct bgma - dma_unmap_single(dma_dev, old_dma_addr, - BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - -+ skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); - skb_put(skb, BGMAC_RX_FRAME_OFFSET + len); - skb_pull(skb, BGMAC_RX_FRAME_OFFSET); - - skb_checksum_none_assert(skb); - skb->protocol = eth_type_trans(skb, bgmac->net_dev); -- netif_receive_skb(skb); -+ napi_gro_receive(&bgmac->napi, skb); - handled++; - } while (0); - -@@ -434,12 +435,11 @@ static bool bgmac_dma_unaligned(struct b - return false; - } - --static void bgmac_dma_ring_free(struct bgmac *bgmac, -- struct bgmac_dma_ring *ring) -+static void bgmac_dma_tx_ring_free(struct bgmac *bgmac, -+ struct bgmac_dma_ring *ring) - { - struct device *dma_dev = bgmac->core->dma_dev; - struct bgmac_slot_info *slot; -- int size; - int i; - - for (i = 0; i < ring->num_slots; i++) { -@@ -451,23 +451,55 @@ static void bgmac_dma_ring_free(struct b - dev_kfree_skb(slot->skb); - } - } -+} -+ -+static void bgmac_dma_rx_ring_free(struct bgmac *bgmac, -+ struct bgmac_dma_ring *ring) -+{ -+ struct device *dma_dev = bgmac->core->dma_dev; -+ struct bgmac_slot_info *slot; -+ int i; -+ -+ for (i = 0; i < ring->num_slots; i++) { -+ slot = &ring->slots[i]; -+ if (!slot->buf) -+ continue; - -- if (ring->cpu_base) { -- /* Free ring of descriptors */ -- size = ring->num_slots * sizeof(struct bgmac_dma_desc); -- dma_free_coherent(dma_dev, size, ring->cpu_base, -- ring->dma_base); -+ if (slot->dma_addr) -+ dma_unmap_single(dma_dev, slot->dma_addr, -+ BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); -+ put_page(virt_to_head_page(slot->buf)); - } - } - -+static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, -+ struct bgmac_dma_ring *ring) -+{ -+ struct device *dma_dev = bgmac->core->dma_dev; -+ int size; -+ -+ if (!ring->cpu_base) -+ return; -+ -+ /* Free ring of descriptors */ -+ size = ring->num_slots * sizeof(struct bgmac_dma_desc); -+ dma_free_coherent(dma_dev, size, ring->cpu_base, -+ ring->dma_base); -+} -+ - static void bgmac_dma_free(struct bgmac *bgmac) - { - int i; - -- for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) -- bgmac_dma_ring_free(bgmac, &bgmac->tx_ring[i]); -- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) -- bgmac_dma_ring_free(bgmac, &bgmac->rx_ring[i]); -+ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { -+ bgmac_dma_tx_ring_free(bgmac, &bgmac->tx_ring[i]); -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); -+ } -+ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { -+ bgmac_dma_rx_ring_free(bgmac, &bgmac->rx_ring[i]); -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); -+ } - } - - static int bgmac_dma_alloc(struct bgmac *bgmac) ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -362,6 +362,8 @@ - #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ - #define BGMAC_RX_MAX_FRAME_SIZE 1536 /* Copied from b44/tg3 */ - #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) -+#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE) + \ -+ SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) - - #define BGMAC_BFL_ENETROBO 0x0010 /* has ephy roboswitch spi */ - #define BGMAC_BFL_ENETADM 0x0080 /* has ADMtek switch */ -@@ -383,7 +385,10 @@ - #define ETHER_MAX_LEN 1518 - - struct bgmac_slot_info { -- struct sk_buff *skb; -+ union { -+ struct sk_buff *skb; -+ void *buf; -+ }; - dma_addr_t dma_addr; - }; - diff --git a/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch b/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch deleted file mode 100644 index 642dd2ad7..000000000 --- a/target/linux/generic/pending-3.18/077-03-bgmac-implement-scatter-gather-support.patch +++ /dev/null @@ -1,267 +0,0 @@ -From: Felix Fietkau -Date: Mon, 23 Mar 2015 02:42:26 +0100 -Subject: [PATCH] bgmac: implement scatter/gather support - -Always use software checksumming, since the hardware does not have any -checksum offload support. -This significantly improves local TCP tx performance. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -115,53 +115,91 @@ static void bgmac_dma_tx_enable(struct b - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, ctl); - } - -+static void -+bgmac_dma_tx_add_buf(struct bgmac *bgmac, struct bgmac_dma_ring *ring, -+ int i, int len, u32 ctl0) -+{ -+ struct bgmac_slot_info *slot; -+ struct bgmac_dma_desc *dma_desc; -+ u32 ctl1; -+ -+ if (i == ring->num_slots - 1) -+ ctl0 |= BGMAC_DESC_CTL0_EOT; -+ -+ ctl1 = len & BGMAC_DESC_CTL1_LEN; -+ -+ slot = &ring->slots[i]; -+ dma_desc = &ring->cpu_base[i]; -+ dma_desc->addr_low = cpu_to_le32(lower_32_bits(slot->dma_addr)); -+ dma_desc->addr_high = cpu_to_le32(upper_32_bits(slot->dma_addr)); -+ dma_desc->ctl0 = cpu_to_le32(ctl0); -+ dma_desc->ctl1 = cpu_to_le32(ctl1); -+} -+ - static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, - struct bgmac_dma_ring *ring, - struct sk_buff *skb) - { - struct device *dma_dev = bgmac->core->dma_dev; - struct net_device *net_dev = bgmac->net_dev; -- struct bgmac_dma_desc *dma_desc; -- struct bgmac_slot_info *slot; -- u32 ctl0, ctl1; -+ struct bgmac_slot_info *slot = &ring->slots[ring->end]; - int free_slots; -+ int nr_frags; -+ u32 flags; -+ int index = ring->end; -+ int i; - - if (skb->len > BGMAC_DESC_CTL1_LEN) { - bgmac_err(bgmac, "Too long skb (%d)\n", skb->len); -- goto err_stop_drop; -+ goto err_drop; - } - -+ if (skb->ip_summed == CHECKSUM_PARTIAL) -+ skb_checksum_help(skb); -+ -+ nr_frags = skb_shinfo(skb)->nr_frags; -+ - if (ring->start <= ring->end) - free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS; - else - free_slots = ring->start - ring->end; -- if (free_slots == 1) { -+ -+ if (free_slots <= nr_frags + 1) { - bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n"); - netif_stop_queue(net_dev); - return NETDEV_TX_BUSY; - } - -- slot = &ring->slots[ring->end]; -- slot->skb = skb; -- slot->dma_addr = dma_map_single(dma_dev, skb->data, skb->len, -+ slot->dma_addr = dma_map_single(dma_dev, skb->data, skb_headlen(skb), - DMA_TO_DEVICE); -- if (dma_mapping_error(dma_dev, slot->dma_addr)) { -- bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n", -- ring->mmio_base); -- goto err_stop_drop; -- } -+ if (unlikely(dma_mapping_error(dma_dev, slot->dma_addr))) -+ goto err_dma_head; - -- ctl0 = BGMAC_DESC_CTL0_IOC | BGMAC_DESC_CTL0_SOF | BGMAC_DESC_CTL0_EOF; -- if (ring->end == ring->num_slots - 1) -- ctl0 |= BGMAC_DESC_CTL0_EOT; -- ctl1 = skb->len & BGMAC_DESC_CTL1_LEN; -+ flags = BGMAC_DESC_CTL0_SOF; -+ if (!nr_frags) -+ flags |= BGMAC_DESC_CTL0_EOF | BGMAC_DESC_CTL0_IOC; -+ -+ bgmac_dma_tx_add_buf(bgmac, ring, index, skb_headlen(skb), flags); -+ flags = 0; -+ -+ for (i = 0; i < nr_frags; i++) { -+ struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; -+ int len = skb_frag_size(frag); -+ -+ index = (index + 1) % BGMAC_TX_RING_SLOTS; -+ slot = &ring->slots[index]; -+ slot->dma_addr = skb_frag_dma_map(dma_dev, frag, 0, -+ len, DMA_TO_DEVICE); -+ if (unlikely(dma_mapping_error(dma_dev, slot->dma_addr))) -+ goto err_dma; - -- dma_desc = ring->cpu_base; -- dma_desc += ring->end; -- dma_desc->addr_low = cpu_to_le32(lower_32_bits(slot->dma_addr)); -- dma_desc->addr_high = cpu_to_le32(upper_32_bits(slot->dma_addr)); -- dma_desc->ctl0 = cpu_to_le32(ctl0); -- dma_desc->ctl1 = cpu_to_le32(ctl1); -+ if (i == nr_frags - 1) -+ flags |= BGMAC_DESC_CTL0_EOF | BGMAC_DESC_CTL0_IOC; -+ -+ bgmac_dma_tx_add_buf(bgmac, ring, index, len, flags); -+ } -+ -+ slot->skb = skb; - - netdev_sent_queue(net_dev, skb->len); - -@@ -170,20 +208,35 @@ static netdev_tx_t bgmac_dma_tx_add(stru - /* Increase ring->end to point empty slot. We tell hardware the first - * slot it should *not* read. - */ -- if (++ring->end >= BGMAC_TX_RING_SLOTS) -- ring->end = 0; -+ ring->end = (index + 1) % BGMAC_TX_RING_SLOTS; - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, - ring->index_base + - ring->end * sizeof(struct bgmac_dma_desc)); - -- /* Always keep one slot free to allow detecting bugged calls. */ -- if (--free_slots == 1) -+ free_slots -= nr_frags + 1; -+ if (free_slots < 8) - netif_stop_queue(net_dev); - - return NETDEV_TX_OK; - --err_stop_drop: -- netif_stop_queue(net_dev); -+err_dma: -+ dma_unmap_single(dma_dev, slot->dma_addr, skb_headlen(skb), -+ DMA_TO_DEVICE); -+ -+ while (i > 0) { -+ int index = (ring->end + i) % BGMAC_TX_RING_SLOTS; -+ struct bgmac_slot_info *slot = &ring->slots[index]; -+ u32 ctl1 = le32_to_cpu(ring->cpu_base[index].ctl1); -+ int len = ctl1 & BGMAC_DESC_CTL1_LEN; -+ -+ dma_unmap_page(dma_dev, slot->dma_addr, len, DMA_TO_DEVICE); -+ } -+ -+err_dma_head: -+ bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n", -+ ring->mmio_base); -+ -+err_drop: - dev_kfree_skb(skb); - return NETDEV_TX_OK; - } -@@ -205,32 +258,45 @@ static void bgmac_dma_tx_free(struct bgm - - while (ring->start != empty_slot) { - struct bgmac_slot_info *slot = &ring->slots[ring->start]; -+ u32 ctl1 = le32_to_cpu(ring->cpu_base[ring->start].ctl1); -+ int len = ctl1 & BGMAC_DESC_CTL1_LEN; - -- if (slot->skb) { -+ if (!slot->dma_addr) { -+ bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", -+ ring->start, ring->end); -+ goto next; -+ } -+ -+ if (ctl1 & BGMAC_DESC_CTL0_SOF) - /* Unmap no longer used buffer */ -- dma_unmap_single(dma_dev, slot->dma_addr, -- slot->skb->len, DMA_TO_DEVICE); -- slot->dma_addr = 0; -+ dma_unmap_single(dma_dev, slot->dma_addr, len, -+ DMA_TO_DEVICE); -+ else -+ dma_unmap_page(dma_dev, slot->dma_addr, len, -+ DMA_TO_DEVICE); - -+ if (slot->skb) { - bytes_compl += slot->skb->len; - pkts_compl++; - - /* Free memory! :) */ - dev_kfree_skb(slot->skb); - slot->skb = NULL; -- } else { -- bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", -- ring->start, ring->end); - } - -+next: -+ slot->dma_addr = 0; - if (++ring->start >= BGMAC_TX_RING_SLOTS) - ring->start = 0; - freed = true; - } - -+ if (!pkts_compl) -+ return; -+ - netdev_completed_queue(bgmac->net_dev, pkts_compl, bytes_compl); - -- if (freed && netif_queue_stopped(bgmac->net_dev)) -+ if (netif_queue_stopped(bgmac->net_dev)) - netif_wake_queue(bgmac->net_dev); - } - -@@ -439,17 +505,25 @@ static void bgmac_dma_tx_ring_free(struc - struct bgmac_dma_ring *ring) - { - struct device *dma_dev = bgmac->core->dma_dev; -+ struct bgmac_dma_desc *dma_desc = ring->cpu_base; - struct bgmac_slot_info *slot; - int i; - - for (i = 0; i < ring->num_slots; i++) { -+ int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN; -+ - slot = &ring->slots[i]; -- if (slot->skb) { -- if (slot->dma_addr) -- dma_unmap_single(dma_dev, slot->dma_addr, -- slot->skb->len, DMA_TO_DEVICE); -- dev_kfree_skb(slot->skb); -- } -+ dev_kfree_skb(slot->skb); -+ -+ if (!slot->dma_addr) -+ continue; -+ -+ if (slot->skb) -+ dma_unmap_single(dma_dev, slot->dma_addr, -+ len, DMA_TO_DEVICE); -+ else -+ dma_unmap_page(dma_dev, slot->dma_addr, -+ len, DMA_TO_DEVICE); - } - } - -@@ -1588,6 +1662,10 @@ static int bgmac_probe(struct bcma_devic - goto err_dma_free; - } - -+ net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; -+ net_dev->hw_features = net_dev->features; -+ net_dev->vlan_features = net_dev->features; -+ - err = register_netdev(bgmac->net_dev); - if (err) { - bgmac_err(bgmac, "Cannot register net device\n"); diff --git a/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch b/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch deleted file mode 100644 index bf4a22dbe..000000000 --- a/target/linux/generic/pending-3.18/077-04-bgmac-simplify-tx-ring-index-handling.patch +++ /dev/null @@ -1,125 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 09:58:56 +0200 -Subject: [PATCH] bgmac: simplify tx ring index handling - -Keep incrementing ring->start and ring->end instead of pointing it to -the actual ring slot entry. This simplifies the calculation of the -number of free slots. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -142,11 +142,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru - { - struct device *dma_dev = bgmac->core->dma_dev; - struct net_device *net_dev = bgmac->net_dev; -- struct bgmac_slot_info *slot = &ring->slots[ring->end]; -- int free_slots; -+ int index = ring->end % BGMAC_TX_RING_SLOTS; -+ struct bgmac_slot_info *slot = &ring->slots[index]; - int nr_frags; - u32 flags; -- int index = ring->end; - int i; - - if (skb->len > BGMAC_DESC_CTL1_LEN) { -@@ -159,12 +158,10 @@ static netdev_tx_t bgmac_dma_tx_add(stru - - nr_frags = skb_shinfo(skb)->nr_frags; - -- if (ring->start <= ring->end) -- free_slots = ring->start - ring->end + BGMAC_TX_RING_SLOTS; -- else -- free_slots = ring->start - ring->end; -- -- if (free_slots <= nr_frags + 1) { -+ /* ring->end - ring->start will return the number of valid slots, -+ * even when ring->end overflows -+ */ -+ if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) { - bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n"); - netif_stop_queue(net_dev); - return NETDEV_TX_BUSY; -@@ -200,7 +197,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru - } - - slot->skb = skb; -- -+ ring->end += nr_frags + 1; - netdev_sent_queue(net_dev, skb->len); - - wmb(); -@@ -208,13 +205,12 @@ static netdev_tx_t bgmac_dma_tx_add(stru - /* Increase ring->end to point empty slot. We tell hardware the first - * slot it should *not* read. - */ -- ring->end = (index + 1) % BGMAC_TX_RING_SLOTS; - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, - ring->index_base + -- ring->end * sizeof(struct bgmac_dma_desc)); -+ (ring->end % BGMAC_TX_RING_SLOTS) * -+ sizeof(struct bgmac_dma_desc)); - -- free_slots -= nr_frags + 1; -- if (free_slots < 8) -+ if (ring->end - ring->start >= BGMAC_TX_RING_SLOTS - 8) - netif_stop_queue(net_dev); - - return NETDEV_TX_OK; -@@ -256,17 +252,17 @@ static void bgmac_dma_tx_free(struct bgm - empty_slot &= BGMAC_DMA_TX_STATDPTR; - empty_slot /= sizeof(struct bgmac_dma_desc); - -- while (ring->start != empty_slot) { -- struct bgmac_slot_info *slot = &ring->slots[ring->start]; -- u32 ctl1 = le32_to_cpu(ring->cpu_base[ring->start].ctl1); -- int len = ctl1 & BGMAC_DESC_CTL1_LEN; -+ while (ring->start != ring->end) { -+ int slot_idx = ring->start % BGMAC_TX_RING_SLOTS; -+ struct bgmac_slot_info *slot = &ring->slots[slot_idx]; -+ u32 ctl1; -+ int len; - -- if (!slot->dma_addr) { -- bgmac_err(bgmac, "Hardware reported transmission for empty TX ring slot %d! End of ring: %d\n", -- ring->start, ring->end); -- goto next; -- } -+ if (slot_idx == empty_slot) -+ break; - -+ ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1); -+ len = ctl1 & BGMAC_DESC_CTL1_LEN; - if (ctl1 & BGMAC_DESC_CTL0_SOF) - /* Unmap no longer used buffer */ - dma_unmap_single(dma_dev, slot->dma_addr, len, -@@ -284,10 +280,8 @@ static void bgmac_dma_tx_free(struct bgm - slot->skb = NULL; - } - --next: - slot->dma_addr = 0; -- if (++ring->start >= BGMAC_TX_RING_SLOTS) -- ring->start = 0; -+ ring->start++; - freed = true; - } - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -414,10 +414,10 @@ enum bgmac_dma_ring_type { - * empty. - */ - struct bgmac_dma_ring { -- u16 num_slots; -- u16 start; -- u16 end; -+ u32 start; -+ u32 end; - -+ u16 num_slots; - u16 mmio_base; - struct bgmac_dma_desc *cpu_base; - dma_addr_t dma_base; diff --git a/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch b/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch deleted file mode 100644 index 4e5e2e720..000000000 --- a/target/linux/generic/pending-3.18/077-05-bgmac-leave-interrupts-disabled-as-long-as-there-is-.patch +++ /dev/null @@ -1,87 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 10:08:04 +0200 -Subject: [PATCH] bgmac: leave interrupts disabled as long as there is work - to do - -Always poll rx and tx during NAPI poll instead of relying on the status -of the first interrupt. This prevents bgmac_poll from leaving unfinished -work around until the next IRQ. -In my tests this makes bridging/routing throughput under heavy load more -stable and ensures that no new IRQs arrive as long as bgmac_poll uses up -the entire budget. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1109,8 +1109,6 @@ static void bgmac_chip_reset(struct bgma - bgmac_phy_init(bgmac); - - netdev_reset_queue(bgmac->net_dev); -- -- bgmac->int_status = 0; - } - - static void bgmac_chip_intrs_on(struct bgmac *bgmac) -@@ -1225,14 +1223,13 @@ static irqreturn_t bgmac_interrupt(int i - if (!int_status) - return IRQ_NONE; - -- /* Ack */ -- bgmac_write(bgmac, BGMAC_INT_STATUS, int_status); -+ int_status &= ~(BGMAC_IS_TX0 | BGMAC_IS_RX); -+ if (int_status) -+ bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", int_status); - - /* Disable new interrupts until handling existing ones */ - bgmac_chip_intrs_off(bgmac); - -- bgmac->int_status = int_status; -- - napi_schedule(&bgmac->napi); - - return IRQ_HANDLED; -@@ -1241,25 +1238,17 @@ static irqreturn_t bgmac_interrupt(int i - static int bgmac_poll(struct napi_struct *napi, int weight) - { - struct bgmac *bgmac = container_of(napi, struct bgmac, napi); -- struct bgmac_dma_ring *ring; - int handled = 0; - -- if (bgmac->int_status & BGMAC_IS_TX0) { -- ring = &bgmac->tx_ring[0]; -- bgmac_dma_tx_free(bgmac, ring); -- bgmac->int_status &= ~BGMAC_IS_TX0; -- } -+ /* Ack */ -+ bgmac_write(bgmac, BGMAC_INT_STATUS, ~0); - -- if (bgmac->int_status & BGMAC_IS_RX) { -- ring = &bgmac->rx_ring[0]; -- handled += bgmac_dma_rx_read(bgmac, ring, weight); -- bgmac->int_status &= ~BGMAC_IS_RX; -- } -+ bgmac_dma_tx_free(bgmac, &bgmac->tx_ring[0]); -+ handled += bgmac_dma_rx_read(bgmac, &bgmac->rx_ring[0], weight); - -- if (bgmac->int_status) { -- bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", bgmac->int_status); -- bgmac->int_status = 0; -- } -+ /* Poll again if more events arrived in the meantime */ -+ if (bgmac_read(bgmac, BGMAC_INT_STATUS) & (BGMAC_IS_TX0 | BGMAC_IS_RX)) -+ return handled; - - if (handled < weight) { - napi_complete(napi); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -452,7 +452,6 @@ struct bgmac { - - /* Int */ - u32 int_mask; -- u32 int_status; - - /* Current MAC state */ - int mac_speed; diff --git a/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch b/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch deleted file mode 100644 index 1b0742cd3..000000000 --- a/target/linux/generic/pending-3.18/077-06-bgmac-set-received-skb-headroom-to-NET_SKB_PAD.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 10:13:28 +0200 -Subject: [PATCH] bgmac: set received skb headroom to NET_SKB_PAD - -A packet buffer offset of 30 bytes is inefficient, because the first 2 -bytes end up in a different cacheline. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -346,13 +346,13 @@ static int bgmac_dma_rx_skb_for_slot(str - return -ENOMEM; - - /* Poison - if everything goes fine, hardware will overwrite it */ -- rx = buf; -+ rx = buf + BGMAC_RX_BUF_OFFSET; - rx->len = cpu_to_le16(0xdead); - rx->flags = cpu_to_le16(0xbeef); - - /* Map skb for the DMA */ -- dma_addr = dma_map_single(dma_dev, buf, BGMAC_RX_BUF_SIZE, -- DMA_FROM_DEVICE); -+ dma_addr = dma_map_single(dma_dev, buf + BGMAC_RX_BUF_OFFSET, -+ BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - if (dma_mapping_error(dma_dev, dma_addr)) { - bgmac_err(bgmac, "DMA mapping error\n"); - put_page(virt_to_head_page(buf)); -@@ -403,7 +403,7 @@ static int bgmac_dma_rx_read(struct bgma - while (ring->start != ring->end) { - struct device *dma_dev = bgmac->core->dma_dev; - struct bgmac_slot_info *slot = &ring->slots[ring->start]; -- struct bgmac_rx_header *rx = slot->buf; -+ struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; - struct sk_buff *skb; - void *buf = slot->buf; - u16 len, flags; -@@ -454,8 +454,10 @@ static int bgmac_dma_rx_read(struct bgma - BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - - skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); -- skb_put(skb, BGMAC_RX_FRAME_OFFSET + len); -- skb_pull(skb, BGMAC_RX_FRAME_OFFSET); -+ skb_put(skb, BGMAC_RX_FRAME_OFFSET + -+ BGMAC_RX_BUF_OFFSET + len); -+ skb_pull(skb, BGMAC_RX_FRAME_OFFSET + -+ BGMAC_RX_BUF_OFFSET); - - skb_checksum_none_assert(skb); - skb->protocol = eth_type_trans(skb, bgmac->net_dev); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -360,9 +360,11 @@ - - #define BGMAC_RX_HEADER_LEN 28 /* Last 24 bytes are unused. Well... */ - #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ -+#define BGMAC_RX_BUF_OFFSET (NET_SKB_PAD + NET_IP_ALIGN - \ -+ BGMAC_RX_FRAME_OFFSET) - #define BGMAC_RX_MAX_FRAME_SIZE 1536 /* Copied from b44/tg3 */ - #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) --#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE) + \ -+#define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE + BGMAC_RX_BUF_OFFSET) + \ - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) - - #define BGMAC_BFL_ENETROBO 0x0010 /* has ephy roboswitch spi */ diff --git a/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch b/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch deleted file mode 100644 index 2be65b454..000000000 --- a/target/linux/generic/pending-3.18/077-07-bgmac-simplify-rx-DMA-error-handling.patch +++ /dev/null @@ -1,130 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 22:23:07 +0200 -Subject: [PATCH] bgmac: simplify/optimize rx DMA error handling - -Allocate a new buffer before processing the completed one. If allocation -fails, reuse the old buffer. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -386,6 +386,19 @@ static void bgmac_dma_rx_setup_desc(stru - dma_desc->ctl1 = cpu_to_le32(ctl1); - } - -+static void bgmac_dma_rx_poison_buf(struct device *dma_dev, -+ struct bgmac_slot_info *slot) -+{ -+ struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; -+ -+ dma_sync_single_for_cpu(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); -+ rx->len = cpu_to_le16(0xdead); -+ rx->flags = cpu_to_le16(0xbeef); -+ dma_sync_single_for_device(dma_dev, slot->dma_addr, BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); -+} -+ - static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, - int weight) - { -@@ -406,53 +419,35 @@ static int bgmac_dma_rx_read(struct bgma - struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; - struct sk_buff *skb; - void *buf = slot->buf; -+ dma_addr_t dma_addr = slot->dma_addr; - u16 len, flags; - -- /* Unmap buffer to make it accessible to the CPU */ -- dma_sync_single_for_cpu(dma_dev, slot->dma_addr, -- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -- -- /* Get info from the header */ -- len = le16_to_cpu(rx->len); -- flags = le16_to_cpu(rx->flags); -- - do { -- dma_addr_t old_dma_addr = slot->dma_addr; -- int err; -+ /* Prepare new skb as replacement */ -+ if (bgmac_dma_rx_skb_for_slot(bgmac, slot)) { -+ bgmac_dma_rx_poison_buf(dma_dev, slot); -+ break; -+ } -+ -+ /* Unmap buffer to make it accessible to the CPU */ -+ dma_unmap_single(dma_dev, dma_addr, -+ BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -+ -+ /* Get info from the header */ -+ len = le16_to_cpu(rx->len); -+ flags = le16_to_cpu(rx->flags); - - /* Check for poison and drop or pass the packet */ - if (len == 0xdead && flags == 0xbeef) { - bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n", - ring->start); -- dma_sync_single_for_device(dma_dev, -- slot->dma_addr, -- BGMAC_RX_BUF_SIZE, -- DMA_FROM_DEVICE); -+ put_page(virt_to_head_page(buf)); - break; - } - - /* Omit CRC. */ - len -= ETH_FCS_LEN; - -- /* Prepare new skb as replacement */ -- err = bgmac_dma_rx_skb_for_slot(bgmac, slot); -- if (err) { -- /* Poison the old skb */ -- rx->len = cpu_to_le16(0xdead); -- rx->flags = cpu_to_le16(0xbeef); -- -- dma_sync_single_for_device(dma_dev, -- slot->dma_addr, -- BGMAC_RX_BUF_SIZE, -- DMA_FROM_DEVICE); -- break; -- } -- bgmac_dma_rx_setup_desc(bgmac, ring, ring->start); -- -- /* Unmap old skb, we'll pass it to the netfif */ -- dma_unmap_single(dma_dev, old_dma_addr, -- BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); -- - skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); - skb_put(skb, BGMAC_RX_FRAME_OFFSET + - BGMAC_RX_BUF_OFFSET + len); -@@ -465,6 +460,8 @@ static int bgmac_dma_rx_read(struct bgma - handled++; - } while (0); - -+ bgmac_dma_rx_setup_desc(bgmac, ring, ring->start); -+ - if (++ring->start >= BGMAC_RX_RING_SLOTS) - ring->start = 0; - -@@ -532,14 +529,14 @@ static void bgmac_dma_rx_ring_free(struc - - for (i = 0; i < ring->num_slots; i++) { - slot = &ring->slots[i]; -- if (!slot->buf) -+ if (!slot->dma_addr) - continue; - -- if (slot->dma_addr) -- dma_unmap_single(dma_dev, slot->dma_addr, -- BGMAC_RX_BUF_SIZE, -- DMA_FROM_DEVICE); -+ dma_unmap_single(dma_dev, slot->dma_addr, -+ BGMAC_RX_BUF_SIZE, -+ DMA_FROM_DEVICE); - put_page(virt_to_head_page(slot->buf)); -+ slot->dma_addr = 0; - } - } - diff --git a/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch b/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch deleted file mode 100644 index 6bb474768..000000000 --- a/target/linux/generic/pending-3.18/077-08-bgmac-add-check-for-oversized-packets.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 22:28:20 +0200 -Subject: [PATCH] bgmac: add check for oversized packets - -In very rare cases, the MAC can catch an internal buffer that is bigger -than it's supposed to be. Instead of crashing the kernel, simply pass -the buffer back to the hardware - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -445,6 +445,13 @@ static int bgmac_dma_rx_read(struct bgma - break; - } - -+ if (len > BGMAC_RX_ALLOC_SIZE) { -+ bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n", -+ ring->start); -+ put_page(virt_to_head_page(buf)); -+ break; -+ } -+ - /* Omit CRC. */ - len -= ETH_FCS_LEN; - diff --git a/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch b/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch deleted file mode 100644 index 1fc4ed03f..000000000 --- a/target/linux/generic/pending-3.18/077-09-bgmac-increase-rx-ring-size-from-511-to-512.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 22:36:16 +0200 -Subject: [PATCH] bgmac: increase rx ring size from 511 to 512 - -Limiting it to 511 looks like a failed attempt at leaving one descriptor -empty to allow the hardware to stop processing a buffer that has not -been prepared yet. However, this doesn't work because this affects the -total ring size as well - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -356,7 +356,7 @@ - #define BGMAC_MAX_RX_RINGS 1 - - #define BGMAC_TX_RING_SLOTS 128 --#define BGMAC_RX_RING_SLOTS 512 - 1 /* Why -1? Well, Broadcom does that... */ -+#define BGMAC_RX_RING_SLOTS 512 - - #define BGMAC_RX_HEADER_LEN 28 /* Last 24 bytes are unused. Well... */ - #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ diff --git a/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch b/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch deleted file mode 100644 index a49bd5f5e..000000000 --- a/target/linux/generic/pending-3.18/077-10-bgmac-simplify-dma-init-cleanup.patch +++ /dev/null @@ -1,184 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 23:19:32 +0200 -Subject: [PATCH] bgmac: simplify dma init/cleanup - -Instead of allocating buffers at device init time and initializing -descriptors at device open, do both at the same time (during open). -Free all buffers when closing the device. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -562,18 +562,26 @@ static void bgmac_dma_ring_desc_free(str - ring->dma_base); - } - --static void bgmac_dma_free(struct bgmac *bgmac) -+static void bgmac_dma_cleanup(struct bgmac *bgmac) - { - int i; - -- for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { -+ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) - bgmac_dma_tx_ring_free(bgmac, &bgmac->tx_ring[i]); -- bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); -- } -- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { -+ -+ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) - bgmac_dma_rx_ring_free(bgmac, &bgmac->rx_ring[i]); -+} -+ -+static void bgmac_dma_free(struct bgmac *bgmac) -+{ -+ int i; -+ -+ for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); -+ -+ for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) - bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); -- } - } - - static int bgmac_dma_alloc(struct bgmac *bgmac) -@@ -621,8 +629,6 @@ static int bgmac_dma_alloc(struct bgmac - } - - for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { -- int j; -- - ring = &bgmac->rx_ring[i]; - ring->num_slots = BGMAC_RX_RING_SLOTS; - ring->mmio_base = ring_base[i]; -@@ -645,15 +651,6 @@ static int bgmac_dma_alloc(struct bgmac - ring->index_base = lower_32_bits(ring->dma_base); - else - ring->index_base = 0; -- -- /* Alloc RX slots */ -- for (j = 0; j < ring->num_slots; j++) { -- err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); -- if (err) { -- bgmac_err(bgmac, "Can't allocate skb for slot in RX ring\n"); -- goto err_dma_free; -- } -- } - } - - return 0; -@@ -663,10 +660,10 @@ err_dma_free: - return -ENOMEM; - } - --static void bgmac_dma_init(struct bgmac *bgmac) -+static int bgmac_dma_init(struct bgmac *bgmac) - { - struct bgmac_dma_ring *ring; -- int i; -+ int i, err; - - for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { - ring = &bgmac->tx_ring[i]; -@@ -698,8 +695,13 @@ static void bgmac_dma_init(struct bgmac - if (ring->unaligned) - bgmac_dma_rx_enable(bgmac, ring); - -- for (j = 0; j < ring->num_slots; j++) -+ for (j = 0; j < ring->num_slots; j++) { -+ err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); -+ if (err) -+ goto error; -+ - bgmac_dma_rx_setup_desc(bgmac, ring, j); -+ } - - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, - ring->index_base + -@@ -708,6 +710,12 @@ static void bgmac_dma_init(struct bgmac - ring->start = 0; - ring->end = 0; - } -+ -+ return 0; -+ -+error: -+ bgmac_dma_cleanup(bgmac); -+ return err; - } - - /************************************************** -@@ -1183,11 +1191,8 @@ static void bgmac_enable(struct bgmac *b - } - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */ --static void bgmac_chip_init(struct bgmac *bgmac, bool full_init) -+static void bgmac_chip_init(struct bgmac *bgmac) - { -- struct bgmac_dma_ring *ring; -- int i; -- - /* 1 interrupt per received frame */ - bgmac_write(bgmac, BGMAC_INT_RECV_LAZY, 1 << BGMAC_IRL_FC_SHIFT); - -@@ -1205,16 +1210,7 @@ static void bgmac_chip_init(struct bgmac - - bgmac_write(bgmac, BGMAC_RXMAX_LENGTH, 32 + ETHER_MAX_LEN); - -- if (full_init) { -- bgmac_dma_init(bgmac); -- if (1) /* FIXME: is there any case we don't want IRQs? */ -- bgmac_chip_intrs_on(bgmac); -- } else { -- for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { -- ring = &bgmac->rx_ring[i]; -- bgmac_dma_rx_enable(bgmac, ring); -- } -- } -+ bgmac_chip_intrs_on(bgmac); - - bgmac_enable(bgmac); - } -@@ -1274,23 +1270,27 @@ static int bgmac_open(struct net_device - int err = 0; - - bgmac_chip_reset(bgmac); -+ -+ err = bgmac_dma_init(bgmac); -+ if (err) -+ return err; -+ - /* Specs say about reclaiming rings here, but we do that in DMA init */ -- bgmac_chip_init(bgmac, true); -+ bgmac_chip_init(bgmac); - - err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED, - KBUILD_MODNAME, net_dev); - if (err < 0) { - bgmac_err(bgmac, "IRQ request error: %d!\n", err); -- goto err_out; -+ bgmac_dma_cleanup(bgmac); -+ return err; - } - napi_enable(&bgmac->napi); - - phy_start(bgmac->phy_dev); - - netif_carrier_on(net_dev); -- --err_out: -- return err; -+ return 0; - } - - static int bgmac_stop(struct net_device *net_dev) -@@ -1306,6 +1306,7 @@ static int bgmac_stop(struct net_device - free_irq(bgmac->core->irq, net_dev); - - bgmac_chip_reset(bgmac); -+ bgmac_dma_cleanup(bgmac); - - return 0; - } diff --git a/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch b/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch deleted file mode 100644 index e7a7987f4..000000000 --- a/target/linux/generic/pending-3.18/077-11-bgmac-fix-DMA-rx-corruption.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 11:59:47 +0200 -Subject: [PATCH] bgmac: fix DMA rx corruption - -The driver needs to inform the hardware about the first invalid (not yet -filled) rx slot, by writing its DMA descriptor pointer offset to the -BGMAC_DMA_RX_INDEX register. - -This register was set to a value exceeding the rx ring size, effectively -allowing the hardware constant access to the full ring, regardless of -which slots are initialized. - -To fix this issue, always mark the last filled rx slot as invalid. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -366,6 +366,16 @@ static int bgmac_dma_rx_skb_for_slot(str - return 0; - } - -+static void bgmac_dma_rx_update_index(struct bgmac *bgmac, -+ struct bgmac_dma_ring *ring) -+{ -+ wmb(); -+ -+ bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, -+ ring->index_base + -+ ring->end * sizeof(struct bgmac_dma_desc)); -+} -+ - static void bgmac_dma_rx_setup_desc(struct bgmac *bgmac, - struct bgmac_dma_ring *ring, int desc_idx) - { -@@ -384,6 +394,8 @@ static void bgmac_dma_rx_setup_desc(stru - dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[desc_idx].dma_addr)); - dma_desc->ctl0 = cpu_to_le32(ctl0); - dma_desc->ctl1 = cpu_to_le32(ctl1); -+ -+ ring->end = desc_idx; - } - - static void bgmac_dma_rx_poison_buf(struct device *dma_dev, -@@ -411,9 +423,7 @@ static int bgmac_dma_rx_read(struct bgma - end_slot &= BGMAC_DMA_RX_STATDPTR; - end_slot /= sizeof(struct bgmac_dma_desc); - -- ring->end = end_slot; -- -- while (ring->start != ring->end) { -+ while (ring->start != end_slot) { - struct device *dma_dev = bgmac->core->dma_dev; - struct bgmac_slot_info *slot = &ring->slots[ring->start]; - struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; -@@ -476,6 +486,8 @@ static int bgmac_dma_rx_read(struct bgma - break; - } - -+ bgmac_dma_rx_update_index(bgmac, ring); -+ - return handled; - } - -@@ -695,6 +707,8 @@ static int bgmac_dma_init(struct bgmac * - if (ring->unaligned) - bgmac_dma_rx_enable(bgmac, ring); - -+ ring->start = 0; -+ ring->end = 0; - for (j = 0; j < ring->num_slots; j++) { - err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); - if (err) -@@ -703,12 +717,7 @@ static int bgmac_dma_init(struct bgmac * - bgmac_dma_rx_setup_desc(bgmac, ring, j); - } - -- bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, -- ring->index_base + -- ring->num_slots * sizeof(struct bgmac_dma_desc)); -- -- ring->start = 0; -- ring->end = 0; -+ bgmac_dma_rx_update_index(bgmac, ring); - } - - return 0; diff --git a/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch b/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch deleted file mode 100644 index 4dbb6f48d..000000000 --- a/target/linux/generic/pending-3.18/077-12-bgmac-drop-ring-num_slots.patch +++ /dev/null @@ -1,132 +0,0 @@ -From: Felix Fietkau -Date: Sun, 12 Apr 2015 23:28:38 +0200 -Subject: [PATCH] bgmac: drop ring->num_slots - -The ring size is always known at compile time, so make the code a bit -more efficient - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -123,7 +123,7 @@ bgmac_dma_tx_add_buf(struct bgmac *bgmac - struct bgmac_dma_desc *dma_desc; - u32 ctl1; - -- if (i == ring->num_slots - 1) -+ if (i == BGMAC_TX_RING_SLOTS - 1) - ctl0 |= BGMAC_DESC_CTL0_EOT; - - ctl1 = len & BGMAC_DESC_CTL1_LEN; -@@ -382,7 +382,7 @@ static void bgmac_dma_rx_setup_desc(stru - struct bgmac_dma_desc *dma_desc = ring->cpu_base + desc_idx; - u32 ctl0 = 0, ctl1 = 0; - -- if (desc_idx == ring->num_slots - 1) -+ if (desc_idx == BGMAC_RX_RING_SLOTS - 1) - ctl0 |= BGMAC_DESC_CTL0_EOT; - ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN; - /* Is there any BGMAC device that requires extension? */ -@@ -521,7 +521,7 @@ static void bgmac_dma_tx_ring_free(struc - struct bgmac_slot_info *slot; - int i; - -- for (i = 0; i < ring->num_slots; i++) { -+ for (i = 0; i < BGMAC_TX_RING_SLOTS; i++) { - int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN; - - slot = &ring->slots[i]; -@@ -546,7 +546,7 @@ static void bgmac_dma_rx_ring_free(struc - struct bgmac_slot_info *slot; - int i; - -- for (i = 0; i < ring->num_slots; i++) { -+ for (i = 0; i < BGMAC_RX_RING_SLOTS; i++) { - slot = &ring->slots[i]; - if (!slot->dma_addr) - continue; -@@ -560,7 +560,8 @@ static void bgmac_dma_rx_ring_free(struc - } - - static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, -- struct bgmac_dma_ring *ring) -+ struct bgmac_dma_ring *ring, -+ int num_slots) - { - struct device *dma_dev = bgmac->core->dma_dev; - int size; -@@ -569,7 +570,7 @@ static void bgmac_dma_ring_desc_free(str - return; - - /* Free ring of descriptors */ -- size = ring->num_slots * sizeof(struct bgmac_dma_desc); -+ size = num_slots * sizeof(struct bgmac_dma_desc); - dma_free_coherent(dma_dev, size, ring->cpu_base, - ring->dma_base); - } -@@ -590,10 +591,12 @@ static void bgmac_dma_free(struct bgmac - int i; - - for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) -- bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i]); -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->tx_ring[i], -+ BGMAC_TX_RING_SLOTS); - - for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) -- bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i]); -+ bgmac_dma_ring_desc_free(bgmac, &bgmac->rx_ring[i], -+ BGMAC_RX_RING_SLOTS); - } - - static int bgmac_dma_alloc(struct bgmac *bgmac) -@@ -616,11 +619,10 @@ static int bgmac_dma_alloc(struct bgmac - - for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { - ring = &bgmac->tx_ring[i]; -- ring->num_slots = BGMAC_TX_RING_SLOTS; - ring->mmio_base = ring_base[i]; - - /* Alloc ring of descriptors */ -- size = ring->num_slots * sizeof(struct bgmac_dma_desc); -+ size = BGMAC_TX_RING_SLOTS * sizeof(struct bgmac_dma_desc); - ring->cpu_base = dma_zalloc_coherent(dma_dev, size, - &ring->dma_base, - GFP_KERNEL); -@@ -642,11 +644,10 @@ static int bgmac_dma_alloc(struct bgmac - - for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { - ring = &bgmac->rx_ring[i]; -- ring->num_slots = BGMAC_RX_RING_SLOTS; - ring->mmio_base = ring_base[i]; - - /* Alloc ring of descriptors */ -- size = ring->num_slots * sizeof(struct bgmac_dma_desc); -+ size = BGMAC_RX_RING_SLOTS * sizeof(struct bgmac_dma_desc); - ring->cpu_base = dma_zalloc_coherent(dma_dev, size, - &ring->dma_base, - GFP_KERNEL); -@@ -709,7 +710,7 @@ static int bgmac_dma_init(struct bgmac * - - ring->start = 0; - ring->end = 0; -- for (j = 0; j < ring->num_slots; j++) { -+ for (j = 0; j < BGMAC_RX_RING_SLOTS; j++) { - err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); - if (err) - goto error; ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -419,11 +419,10 @@ struct bgmac_dma_ring { - u32 start; - u32 end; - -- u16 num_slots; -- u16 mmio_base; - struct bgmac_dma_desc *cpu_base; - dma_addr_t dma_base; - u32 index_base; /* Used for unaligned rings only, otherwise 0 */ -+ u16 mmio_base; - bool unaligned; - - struct bgmac_slot_info slots[BGMAC_RX_RING_SLOTS]; diff --git a/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch b/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch deleted file mode 100644 index a4c7876d7..000000000 --- a/target/linux/generic/pending-3.18/078-bgmac-reset-enable-Ethernet-core-before-using-it.patch +++ /dev/null @@ -1,31 +0,0 @@ -From b4dfd8e92956b396d3438212bc9a0be6267b8b34 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 12 Apr 2016 13:30:45 +0200 -Subject: [PATCH] bgmac: reset & enable Ethernet core before using it -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This fixes Ethernet on D-Link DIR-885L with BCM47094 SoC. Felix reported -similar fix was needed for his BCM4709 device (Buffalo WXR-1900DHP?). -I tested this for regressions on BCM4706, BCM4708A0 and BCM47081A0. - -Cc: Felix Fietkau -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1569,6 +1569,11 @@ static int bgmac_probe(struct bcma_devic - */ - bcma_core_enable(core, 0); - -+ /* This (reset &) enable is not preset in specs or reference driver but -+ * Broadcom does it in arch PCI code when enabling fake PCI device. -+ */ -+ bcma_core_enable(core, 0); -+ - /* Allocation and references */ - net_dev = alloc_etherdev(sizeof(*bgmac)); - if (!net_dev) diff --git a/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch b/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch deleted file mode 100644 index f8d0a5876..000000000 --- a/target/linux/generic/pending-3.18/079-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c02bc350f9dbce7d637c394a6e1c4d29dc5b28b2 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Tue, 12 Apr 2016 18:27:29 +0200 -Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0. This mainly -fixes support for BCM4708A0KF SoCs with Ethernet core rev 5 (it means -only some devices as most of BCM4708A0KF-s got core rev 4). -This was tested for regressions on BCM47094 which doesn't seem to care -which bit gets used. - -Signed-off-by: Felix Fietkau -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -198,9 +198,9 @@ - #define BGMAC_CMDCFG_TAI 0x00000200 - #define BGMAC_CMDCFG_HD 0x00000400 /* Set if in half duplex mode */ - #define BGMAC_CMDCFG_HD_SHIFT 10 --#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for other revs */ --#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, only for core rev 4 */ --#define BGMAC_CMDCFG_SR(rev) ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0) -+#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for core rev 0-3 */ -+#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, for core rev >= 4 */ -+#define BGMAC_CMDCFG_SR(rev) ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0) - #define BGMAC_CMDCFG_ML 0x00008000 /* Set to activate mac loopback mode */ - #define BGMAC_CMDCFG_AE 0x00400000 - #define BGMAC_CMDCFG_CFE 0x00800000 diff --git a/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch b/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch deleted file mode 100644 index 5d99367ad..000000000 --- a/target/linux/generic/pending-3.18/080-00-fib_trie-Fix-proc-net-fib_trie-when-CONFIG_IP_MULTIP.patch +++ /dev/null @@ -1,46 +0,0 @@ -From: Alexander Duyck -Date: Tue, 2 Dec 2014 10:58:21 -0800 -Subject: [PATCH] fib_trie: Fix /proc/net/fib_trie when - CONFIG_IP_MULTIPLE_TABLES is not defined - -In recent testing I had disabled CONFIG_IP_MULTIPLE_TABLES and as a result -when I ran "cat /proc/net/fib_trie" the main trie was displayed multiple -times. I found that the problem line of code was in the function -fib_trie_seq_next. Specifically the line below caused the indexes to go in -the opposite direction of our traversal: - - h = tb->tb_id & (FIB_TABLE_HASHSZ - 1); - -This issue was that the RT tables are defined such that RT_TABLE_LOCAL is ID -255, while it is located at TABLE_LOCAL_INDEX of 0, and RT_TABLE_MAIN is 254 -with a TABLE_MAIN_INDEX of 1. This means that the above line will return 1 -for the local table and 0 for main. The result is that fib_trie_seq_next -will return NULL at the end of the local table, fib_trie_seq_start will -return the start of the main table, and then fib_trie_seq_next will loop on -main forever as h will always return 0. - -The fix for this is to reverse the ordering of the two tables. It has the -advantage of making it so that the tables now print in the same order -regardless of if multiple tables are enabled or not. In order to make the -definition consistent with the multiple tables case I simply masked the to -RT_TABLE_XXX values by (FIB_TABLE_HASHSZ - 1). This way the two table -layouts should always stay consistent. - -Fixes: 93456b6 ("[IPV4]: Unify access to the routing tables") -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/include/net/ip_fib.h -+++ b/include/net/ip_fib.h -@@ -201,8 +201,8 @@ void fib_free_table(struct fib_table *tb - - #ifndef CONFIG_IP_MULTIPLE_TABLES - --#define TABLE_LOCAL_INDEX 0 --#define TABLE_MAIN_INDEX 1 -+#define TABLE_LOCAL_INDEX (RT_TABLE_LOCAL & (FIB_TABLE_HASHSZ - 1)) -+#define TABLE_MAIN_INDEX (RT_TABLE_MAIN & (FIB_TABLE_HASHSZ - 1)) - - static inline struct fib_table *fib_get_table(struct net *net, u32 id) - { diff --git a/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch b/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch deleted file mode 100644 index 4e09f8a18..000000000 --- a/target/linux/generic/pending-3.18/080-01-fib_trie-Fix-trie-balancing-issue-if-new-node-pushes.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Alexander Duyck -Date: Wed, 10 Dec 2014 21:49:22 -0800 -Subject: [PATCH] fib_trie: Fix trie balancing issue if new node pushes down - existing node - -This patch addresses an issue with the level compression of the fib_trie. -Specifically in the case of adding a new leaf that triggers a new node to -be added that takes the place of the old node. The result is a trie where -the 1 child tnode is on one side and one leaf is on the other which gives -you a very deep trie. Below is the script I used to generate a trie on -dummy0 with a 10.X.X.X family of addresses. - - ip link add type dummy - ipval=184549374 - bit=2 - for i in `seq 1 23` - do - ifconfig dummy0:$bit $ipval/8 - ipval=`expr $ipval - $bit` - bit=`expr $bit \* 2` - done - cat /proc/net/fib_triestat - -Running the script before the patch: - - Local: - Aver depth: 10.82 - Max depth: 23 - Leaves: 29 - Prefixes: 30 - Internal nodes: 27 - 1: 26 2: 1 - Pointers: 56 - Null ptrs: 1 - Total size: 5 kB - -After applying the patch and repeating: - - Local: - Aver depth: 4.72 - Max depth: 9 - Leaves: 29 - Prefixes: 30 - Internal nodes: 12 - 1: 3 2: 2 3: 7 - Pointers: 70 - Null ptrs: 30 - Total size: 4 kB - -What this fix does is start the rebalance at the newly created tnode -instead of at the parent tnode. This way if there is a gap between the -parent and the new node it doesn't prevent the new tnode from being -coalesced with any pre-existing nodes that may have been pushed into one -of the new nodes child branches. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -1143,8 +1143,9 @@ static struct list_head *fib_insert_node - put_child(tp, cindex, (struct rt_trie_node *)tn); - } else { - rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); -- tp = tn; - } -+ -+ tp = tn; - } - - if (tp && tp->pos + tp->bits > 32) diff --git a/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch b/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch deleted file mode 100644 index 2e6deb5bb..000000000 --- a/target/linux/generic/pending-3.18/080-02-fib_trie-Update-usage-stats-to-be-percpu-instead-of-.patch +++ /dev/null @@ -1,200 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:29 -0800 -Subject: [PATCH] fib_trie: Update usage stats to be percpu instead of - global variables - -The trie usage stats were currently being shared by all threads that were -calling fib_table_lookup. As a result when multiple threads were -performing lookups simultaneously the trie would begin to cache bounce -between those threads. - -In order to prevent this I have updated the usage stats to use a set of -percpu variables. By doing this we should be able to avoid the cache -bouncing and still make use of these stats. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_frontend.c -+++ b/net/ipv4/fib_frontend.c -@@ -67,7 +67,7 @@ static int __net_init fib4_rules_init(st - return 0; - - fail: -- kfree(local_table); -+ fib_free_table(local_table); - return -ENOMEM; - } - #else ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -153,7 +153,7 @@ struct trie_stat { - struct trie { - struct rt_trie_node __rcu *trie; - #ifdef CONFIG_IP_FIB_TRIE_STATS -- struct trie_use_stats stats; -+ struct trie_use_stats __percpu *stats; - #endif - }; - -@@ -631,7 +631,7 @@ static struct rt_trie_node *resize(struc - if (IS_ERR(tn)) { - tn = old_tn; - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.resize_node_skipped++; -+ this_cpu_inc(t->stats->resize_node_skipped); - #endif - break; - } -@@ -658,7 +658,7 @@ static struct rt_trie_node *resize(struc - if (IS_ERR(tn)) { - tn = old_tn; - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.resize_node_skipped++; -+ this_cpu_inc(t->stats->resize_node_skipped); - #endif - break; - } -@@ -1357,7 +1357,7 @@ static int check_leaf(struct fib_table * - err = fib_props[fa->fa_type].error; - if (err) { - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.semantic_match_passed++; -+ this_cpu_inc(t->stats->semantic_match_passed); - #endif - return err; - } -@@ -1372,7 +1372,7 @@ static int check_leaf(struct fib_table * - continue; - - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.semantic_match_passed++; -+ this_cpu_inc(t->stats->semantic_match_passed); - #endif - res->prefixlen = li->plen; - res->nh_sel = nhsel; -@@ -1388,7 +1388,7 @@ static int check_leaf(struct fib_table * - } - - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.semantic_match_miss++; -+ this_cpu_inc(t->stats->semantic_match_miss); - #endif - } - -@@ -1399,6 +1399,9 @@ int fib_table_lookup(struct fib_table *t - struct fib_result *res, int fib_flags) - { - struct trie *t = (struct trie *) tb->tb_data; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ struct trie_use_stats __percpu *stats = t->stats; -+#endif - int ret; - struct rt_trie_node *n; - struct tnode *pn; -@@ -1417,7 +1420,7 @@ int fib_table_lookup(struct fib_table *t - goto failed; - - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.gets++; -+ this_cpu_inc(stats->gets); - #endif - - /* Just a leaf? */ -@@ -1441,7 +1444,7 @@ int fib_table_lookup(struct fib_table *t - - if (n == NULL) { - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.null_node_hit++; -+ this_cpu_inc(stats->null_node_hit); - #endif - goto backtrace; - } -@@ -1576,7 +1579,7 @@ backtrace: - chopped_off = 0; - - #ifdef CONFIG_IP_FIB_TRIE_STATS -- t->stats.backtrack++; -+ this_cpu_inc(stats->backtrack); - #endif - goto backtrace; - } -@@ -1830,6 +1833,11 @@ int fib_table_flush(struct fib_table *tb - - void fib_free_table(struct fib_table *tb) - { -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ struct trie *t = (struct trie *)tb->tb_data; -+ -+ free_percpu(t->stats); -+#endif /* CONFIG_IP_FIB_TRIE_STATS */ - kfree(tb); - } - -@@ -1973,7 +1981,14 @@ struct fib_table *fib_trie_table(u32 id) - tb->tb_num_default = 0; - - t = (struct trie *) tb->tb_data; -- memset(t, 0, sizeof(*t)); -+ RCU_INIT_POINTER(t->trie, NULL); -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ t->stats = alloc_percpu(struct trie_use_stats); -+ if (!t->stats) { -+ kfree(tb); -+ tb = NULL; -+ } -+#endif - - return tb; - } -@@ -2139,18 +2154,31 @@ static void trie_show_stats(struct seq_f - - #ifdef CONFIG_IP_FIB_TRIE_STATS - static void trie_show_usage(struct seq_file *seq, -- const struct trie_use_stats *stats) -+ const struct trie_use_stats __percpu *stats) - { -+ struct trie_use_stats s = { 0 }; -+ int cpu; -+ -+ /* loop through all of the CPUs and gather up the stats */ -+ for_each_possible_cpu(cpu) { -+ const struct trie_use_stats *pcpu = per_cpu_ptr(stats, cpu); -+ -+ s.gets += pcpu->gets; -+ s.backtrack += pcpu->backtrack; -+ s.semantic_match_passed += pcpu->semantic_match_passed; -+ s.semantic_match_miss += pcpu->semantic_match_miss; -+ s.null_node_hit += pcpu->null_node_hit; -+ s.resize_node_skipped += pcpu->resize_node_skipped; -+ } -+ - seq_printf(seq, "\nCounters:\n---------\n"); -- seq_printf(seq, "gets = %u\n", stats->gets); -- seq_printf(seq, "backtracks = %u\n", stats->backtrack); -+ seq_printf(seq, "gets = %u\n", s.gets); -+ seq_printf(seq, "backtracks = %u\n", s.backtrack); - seq_printf(seq, "semantic match passed = %u\n", -- stats->semantic_match_passed); -- seq_printf(seq, "semantic match miss = %u\n", -- stats->semantic_match_miss); -- seq_printf(seq, "null node hit= %u\n", stats->null_node_hit); -- seq_printf(seq, "skipped node resize = %u\n\n", -- stats->resize_node_skipped); -+ s.semantic_match_passed); -+ seq_printf(seq, "semantic match miss = %u\n", s.semantic_match_miss); -+ seq_printf(seq, "null node hit= %u\n", s.null_node_hit); -+ seq_printf(seq, "skipped node resize = %u\n\n", s.resize_node_skipped); - } - #endif /* CONFIG_IP_FIB_TRIE_STATS */ - -@@ -2191,7 +2219,7 @@ static int fib_triestat_seq_show(struct - trie_collect_stats(t, &stat); - trie_show_stats(seq, &stat); - #ifdef CONFIG_IP_FIB_TRIE_STATS -- trie_show_usage(seq, &t->stats); -+ trie_show_usage(seq, t->stats); - #endif - } - } diff --git a/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch b/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch deleted file mode 100644 index 4c727cdfc..000000000 --- a/target/linux/generic/pending-3.18/080-03-fib_trie-Make-leaf-and-tnode-more-uniform.patch +++ /dev/null @@ -1,421 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:35 -0800 -Subject: [PATCH] fib_trie: Make leaf and tnode more uniform - -This change makes some fundamental changes to the way leaves and tnodes are -constructed. The big differences are: -1. Leaves now populate pos and bits indicating their full key size. -2. Trie nodes now mask out their lower bits to be consistent with the leaf -3. Both structures have been reordered so that rt_trie_node now consisists - of a much larger region including the pos, bits, and rcu portions of - the tnode structure. - -On 32b systems this will result in the leaf being 4B larger as the pos and -bits values were added to a hole created by the key as it was only 4B in -length. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -87,24 +87,38 @@ - - typedef unsigned int t_key; - --#define T_TNODE 0 --#define T_LEAF 1 --#define NODE_TYPE_MASK 0x1UL --#define NODE_TYPE(node) ((node)->parent & NODE_TYPE_MASK) -+#define IS_TNODE(n) ((n)->bits) -+#define IS_LEAF(n) (!(n)->bits) - --#define IS_TNODE(n) (!(n->parent & T_LEAF)) --#define IS_LEAF(n) (n->parent & T_LEAF) -+struct tnode { -+ t_key key; -+ unsigned char bits; /* 2log(KEYLENGTH) bits needed */ -+ unsigned char pos; /* 2log(KEYLENGTH) bits needed */ -+ struct tnode __rcu *parent; -+ union { -+ struct rcu_head rcu; -+ struct tnode *tnode_free; -+ }; -+ unsigned int full_children; /* KEYLENGTH bits needed */ -+ unsigned int empty_children; /* KEYLENGTH bits needed */ -+ struct rt_trie_node __rcu *child[0]; -+}; - - struct rt_trie_node { -- unsigned long parent; - t_key key; -+ unsigned char bits; -+ unsigned char pos; -+ struct tnode __rcu *parent; -+ struct rcu_head rcu; - }; - - struct leaf { -- unsigned long parent; - t_key key; -- struct hlist_head list; -+ unsigned char bits; -+ unsigned char pos; -+ struct tnode __rcu *parent; - struct rcu_head rcu; -+ struct hlist_head list; - }; - - struct leaf_info { -@@ -115,20 +129,6 @@ struct leaf_info { - struct rcu_head rcu; - }; - --struct tnode { -- unsigned long parent; -- t_key key; -- unsigned char pos; /* 2log(KEYLENGTH) bits needed */ -- unsigned char bits; /* 2log(KEYLENGTH) bits needed */ -- unsigned int full_children; /* KEYLENGTH bits needed */ -- unsigned int empty_children; /* KEYLENGTH bits needed */ -- union { -- struct rcu_head rcu; -- struct tnode *tnode_free; -- }; -- struct rt_trie_node __rcu *child[0]; --}; -- - #ifdef CONFIG_IP_FIB_TRIE_STATS - struct trie_use_stats { - unsigned int gets; -@@ -176,38 +176,27 @@ static const int sync_pages = 128; - static struct kmem_cache *fn_alias_kmem __read_mostly; - static struct kmem_cache *trie_leaf_kmem __read_mostly; - --/* -- * caller must hold RTNL -- */ --static inline struct tnode *node_parent(const struct rt_trie_node *node) --{ -- unsigned long parent; -+/* caller must hold RTNL */ -+#define node_parent(n) rtnl_dereference((n)->parent) - -- parent = rcu_dereference_index_check(node->parent, lockdep_rtnl_is_held()); -+/* caller must hold RCU read lock or RTNL */ -+#define node_parent_rcu(n) rcu_dereference_rtnl((n)->parent) - -- return (struct tnode *)(parent & ~NODE_TYPE_MASK); --} -- --/* -- * caller must hold RCU read lock or RTNL -- */ --static inline struct tnode *node_parent_rcu(const struct rt_trie_node *node) -+/* wrapper for rcu_assign_pointer */ -+static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) - { -- unsigned long parent; -- -- parent = rcu_dereference_index_check(node->parent, rcu_read_lock_held() || -- lockdep_rtnl_is_held()); -- -- return (struct tnode *)(parent & ~NODE_TYPE_MASK); -+ if (node) -+ rcu_assign_pointer(node->parent, ptr); - } - --/* Same as rcu_assign_pointer -- * but that macro() assumes that value is a pointer. -+#define NODE_INIT_PARENT(n, p) RCU_INIT_POINTER((n)->parent, p) -+ -+/* This provides us with the number of children in this node, in the case of a -+ * leaf this will return 0 meaning none of the children are accessible. - */ --static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) -+static inline int tnode_child_length(const struct tnode *tn) - { -- smp_wmb(); -- node->parent = (unsigned long)ptr | NODE_TYPE(node); -+ return (1ul << tn->bits) & ~(1ul); - } - - /* -@@ -215,7 +204,7 @@ static inline void node_set_parent(struc - */ - static inline struct rt_trie_node *tnode_get_child(const struct tnode *tn, unsigned int i) - { -- BUG_ON(i >= 1U << tn->bits); -+ BUG_ON(i >= tnode_child_length(tn)); - - return rtnl_dereference(tn->child[i]); - } -@@ -225,16 +214,11 @@ static inline struct rt_trie_node *tnode - */ - static inline struct rt_trie_node *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) - { -- BUG_ON(i >= 1U << tn->bits); -+ BUG_ON(i >= tnode_child_length(tn)); - - return rcu_dereference_rtnl(tn->child[i]); - } - --static inline int tnode_child_length(const struct tnode *tn) --{ -- return 1 << tn->bits; --} -- - static inline t_key mask_pfx(t_key k, unsigned int l) - { - return (l == 0) ? 0 : k >> (KEYLENGTH-l) << (KEYLENGTH-l); -@@ -336,11 +320,6 @@ static inline int tkey_mismatch(t_key a, - - */ - --static inline void check_tnode(const struct tnode *tn) --{ -- WARN_ON(tn && tn->pos+tn->bits > 32); --} -- - static const int halve_threshold = 25; - static const int inflate_threshold = 50; - static const int halve_threshold_root = 15; -@@ -426,11 +405,20 @@ static void tnode_free_flush(void) - } - } - --static struct leaf *leaf_new(void) -+static struct leaf *leaf_new(t_key key) - { - struct leaf *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); - if (l) { -- l->parent = T_LEAF; -+ l->parent = NULL; -+ /* set key and pos to reflect full key value -+ * any trailing zeros in the key should be ignored -+ * as the nodes are searched -+ */ -+ l->key = key; -+ l->pos = KEYLENGTH; -+ /* set bits to 0 indicating we are not a tnode */ -+ l->bits = 0; -+ - INIT_HLIST_HEAD(&l->list); - } - return l; -@@ -451,12 +439,16 @@ static struct tnode *tnode_new(t_key key - { - size_t sz = sizeof(struct tnode) + (sizeof(struct rt_trie_node *) << bits); - struct tnode *tn = tnode_alloc(sz); -+ unsigned int shift = pos + bits; -+ -+ /* verify bits and pos their msb bits clear and values are valid */ -+ BUG_ON(!bits || (shift > KEYLENGTH)); - - if (tn) { -- tn->parent = T_TNODE; -+ tn->parent = NULL; - tn->pos = pos; - tn->bits = bits; -- tn->key = key; -+ tn->key = mask_pfx(key, pos); - tn->full_children = 0; - tn->empty_children = 1<pos == tn->pos + tn->bits; -+ return n && IS_TNODE(n) && (n->pos == (tn->pos + tn->bits)); - } - - static inline void put_child(struct tnode *tn, int i, -@@ -514,8 +503,7 @@ static void tnode_put_child_reorg(struct - else if (!wasfull && isfull) - tn->full_children++; - -- if (n) -- node_set_parent(n, tn); -+ node_set_parent(n, tn); - - rcu_assign_pointer(tn->child[i], n); - } -@@ -523,7 +511,7 @@ static void tnode_put_child_reorg(struct - #define MAX_WORK 10 - static struct rt_trie_node *resize(struct trie *t, struct tnode *tn) - { -- int i; -+ struct rt_trie_node *n = NULL; - struct tnode *old_tn; - int inflate_threshold_use; - int halve_threshold_use; -@@ -536,12 +524,11 @@ static struct rt_trie_node *resize(struc - tn, inflate_threshold, halve_threshold); - - /* No children */ -- if (tn->empty_children == tnode_child_length(tn)) { -- tnode_free_safe(tn); -- return NULL; -- } -+ if (tn->empty_children > (tnode_child_length(tn) - 1)) -+ goto no_children; -+ - /* One child */ -- if (tn->empty_children == tnode_child_length(tn) - 1) -+ if (tn->empty_children == (tnode_child_length(tn) - 1)) - goto one_child; - /* - * Double as long as the resulting node has a number of -@@ -607,11 +594,9 @@ static struct rt_trie_node *resize(struc - * - */ - -- check_tnode(tn); -- - /* Keep root node larger */ - -- if (!node_parent((struct rt_trie_node *)tn)) { -+ if (!node_parent(tn)) { - inflate_threshold_use = inflate_threshold_root; - halve_threshold_use = halve_threshold_root; - } else { -@@ -637,8 +622,6 @@ static struct rt_trie_node *resize(struc - } - } - -- check_tnode(tn); -- - /* Return if at least one inflate is run */ - if (max_work != MAX_WORK) - return (struct rt_trie_node *) tn; -@@ -666,21 +649,16 @@ static struct rt_trie_node *resize(struc - - - /* Only one child remains */ -- if (tn->empty_children == tnode_child_length(tn) - 1) { -+ if (tn->empty_children == (tnode_child_length(tn) - 1)) { -+ unsigned long i; - one_child: -- for (i = 0; i < tnode_child_length(tn); i++) { -- struct rt_trie_node *n; -- -- n = rtnl_dereference(tn->child[i]); -- if (!n) -- continue; -- -- /* compress one level */ -- -- node_set_parent(n, NULL); -- tnode_free_safe(tn); -- return n; -- } -+ for (i = tnode_child_length(tn); !n && i;) -+ n = tnode_get_child(tn, --i); -+no_children: -+ /* compress one level */ -+ node_set_parent(n, NULL); -+ tnode_free_safe(tn); -+ return n; - } - return (struct rt_trie_node *) tn; - } -@@ -760,8 +738,7 @@ static struct tnode *inflate(struct trie - - /* A leaf or an internal node with skipped bits */ - -- if (IS_LEAF(node) || ((struct tnode *) node)->pos > -- tn->pos + tn->bits - 1) { -+ if (IS_LEAF(node) || (node->pos > (tn->pos + tn->bits - 1))) { - put_child(tn, - tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits + 1), - node); -@@ -958,11 +935,9 @@ fib_find_node(struct trie *t, u32 key) - pos = 0; - n = rcu_dereference_rtnl(t->trie); - -- while (n != NULL && NODE_TYPE(n) == T_TNODE) { -+ while (n && IS_TNODE(n)) { - tn = (struct tnode *) n; - -- check_tnode(tn); -- - if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { - pos = tn->pos + tn->bits; - n = tnode_get_child_rcu(tn, -@@ -988,7 +963,7 @@ static void trie_rebalance(struct trie * - - key = tn->key; - -- while (tn != NULL && (tp = node_parent((struct rt_trie_node *)tn)) != NULL) { -+ while (tn != NULL && (tp = node_parent(tn)) != NULL) { - cindex = tkey_extract_bits(key, tp->pos, tp->bits); - wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); - tn = (struct tnode *)resize(t, tn); -@@ -996,7 +971,7 @@ static void trie_rebalance(struct trie * - tnode_put_child_reorg(tp, cindex, - (struct rt_trie_node *)tn, wasfull); - -- tp = node_parent((struct rt_trie_node *) tn); -+ tp = node_parent(tn); - if (!tp) - rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); - -@@ -1048,11 +1023,9 @@ static struct list_head *fib_insert_node - * If it doesn't, we need to replace it with a T_TNODE. - */ - -- while (n != NULL && NODE_TYPE(n) == T_TNODE) { -+ while (n && IS_TNODE(n)) { - tn = (struct tnode *) n; - -- check_tnode(tn); -- - if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { - tp = tn; - pos = tn->pos + tn->bits; -@@ -1087,12 +1060,11 @@ static struct list_head *fib_insert_node - insert_leaf_info(&l->list, li); - goto done; - } -- l = leaf_new(); -+ l = leaf_new(key); - - if (!l) - return NULL; - -- l->key = key; - li = leaf_info_new(plen); - - if (!li) { -@@ -1569,7 +1541,7 @@ backtrace: - if (chopped_off <= pn->bits) { - cindex &= ~(1 << (chopped_off-1)); - } else { -- struct tnode *parent = node_parent_rcu((struct rt_trie_node *) pn); -+ struct tnode *parent = node_parent_rcu(pn); - if (!parent) - goto failed; - -@@ -1597,7 +1569,7 @@ EXPORT_SYMBOL_GPL(fib_table_lookup); - */ - static void trie_leaf_remove(struct trie *t, struct leaf *l) - { -- struct tnode *tp = node_parent((struct rt_trie_node *) l); -+ struct tnode *tp = node_parent(l); - - pr_debug("entering trie_leaf_remove(%p)\n", l); - -@@ -2374,7 +2346,7 @@ static int fib_trie_seq_show(struct seq_ - - if (IS_TNODE(n)) { - struct tnode *tn = (struct tnode *) n; -- __be32 prf = htonl(mask_pfx(tn->key, tn->pos)); -+ __be32 prf = htonl(tn->key); - - seq_indent(seq, iter->depth-1); - seq_printf(seq, " +-- %pI4/%d %d %d %d\n", diff --git a/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch b/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch deleted file mode 100644 index 3f8d03067..000000000 --- a/target/linux/generic/pending-3.18/080-04-fib_trie-Merge-tnode_free-and-leaf_free-into-node_fr.patch +++ /dev/null @@ -1,209 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:41 -0800 -Subject: [PATCH] fib_trie: Merge tnode_free and leaf_free into node_free - -Both the leaf and the tnode had an rcu_head in them, but they had them in -slightly different places. Since we now have them in the same spot and -know that any node with bits == 0 is a leaf and the rest are either vmalloc -or kmalloc tnodes depending on the value of bits it makes it easy to combine -the functions and reduce overhead. - -In addition I have taken advantage of the rcu_head pointer to go ahead and -put together a simple linked list instead of using the tnode pointer as -this way we can merge either type of structure for freeing. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -95,15 +95,17 @@ struct tnode { - unsigned char bits; /* 2log(KEYLENGTH) bits needed */ - unsigned char pos; /* 2log(KEYLENGTH) bits needed */ - struct tnode __rcu *parent; -- union { -- struct rcu_head rcu; -- struct tnode *tnode_free; -- }; -+ struct rcu_head rcu; -+ /* everything above this comment must be the same as rt_trie_node */ - unsigned int full_children; /* KEYLENGTH bits needed */ - unsigned int empty_children; /* KEYLENGTH bits needed */ - struct rt_trie_node __rcu *child[0]; - }; - -+/* This struct represents the shared bits between tnode and leaf. If any -+ * ordering is changed here is must also be updated in tnode and leaf as -+ * well. -+ */ - struct rt_trie_node { - t_key key; - unsigned char bits; -@@ -118,6 +120,7 @@ struct leaf { - unsigned char pos; - struct tnode __rcu *parent; - struct rcu_head rcu; -+ /* everything above this comment must be the same as rt_trie_node */ - struct hlist_head list; - }; - -@@ -163,7 +166,7 @@ static struct rt_trie_node *resize(struc - static struct tnode *inflate(struct trie *t, struct tnode *tn); - static struct tnode *halve(struct trie *t, struct tnode *tn); - /* tnodes to free after resize(); protected by RTNL */ --static struct tnode *tnode_free_head; -+static struct callback_head *tnode_free_head; - static size_t tnode_free_size; - - /* -@@ -336,17 +339,23 @@ static inline void alias_free_mem_rcu(st - call_rcu(&fa->rcu, __alias_free_mem); - } - --static void __leaf_free_rcu(struct rcu_head *head) --{ -- struct leaf *l = container_of(head, struct leaf, rcu); -- kmem_cache_free(trie_leaf_kmem, l); --} -+#define TNODE_KMALLOC_MAX \ -+ ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct rt_trie_node *)) - --static inline void free_leaf(struct leaf *l) -+static void __node_free_rcu(struct rcu_head *head) - { -- call_rcu(&l->rcu, __leaf_free_rcu); -+ struct rt_trie_node *n = container_of(head, struct rt_trie_node, rcu); -+ -+ if (IS_LEAF(n)) -+ kmem_cache_free(trie_leaf_kmem, n); -+ else if (n->bits <= TNODE_KMALLOC_MAX) -+ kfree(n); -+ else -+ vfree(n); - } - -+#define node_free(n) call_rcu(&n->rcu, __node_free_rcu) -+ - static inline void free_leaf_info(struct leaf_info *leaf) - { - kfree_rcu(leaf, rcu); -@@ -360,43 +369,24 @@ static struct tnode *tnode_alloc(size_t - return vzalloc(size); - } - --static void __tnode_free_rcu(struct rcu_head *head) --{ -- struct tnode *tn = container_of(head, struct tnode, rcu); -- size_t size = sizeof(struct tnode) + -- (sizeof(struct rt_trie_node *) << tn->bits); -- -- if (size <= PAGE_SIZE) -- kfree(tn); -- else -- vfree(tn); --} -- --static inline void tnode_free(struct tnode *tn) --{ -- if (IS_LEAF(tn)) -- free_leaf((struct leaf *) tn); -- else -- call_rcu(&tn->rcu, __tnode_free_rcu); --} -- - static void tnode_free_safe(struct tnode *tn) - { - BUG_ON(IS_LEAF(tn)); -- tn->tnode_free = tnode_free_head; -- tnode_free_head = tn; -- tnode_free_size += sizeof(struct tnode) + -- (sizeof(struct rt_trie_node *) << tn->bits); -+ tn->rcu.next = tnode_free_head; -+ tnode_free_head = &tn->rcu; - } - - static void tnode_free_flush(void) - { -- struct tnode *tn; -+ struct callback_head *head; -+ -+ while ((head = tnode_free_head)) { -+ struct tnode *tn = container_of(head, struct tnode, rcu); -+ -+ tnode_free_head = head->next; -+ tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); - -- while ((tn = tnode_free_head)) { -- tnode_free_head = tn->tnode_free; -- tn->tnode_free = NULL; -- tnode_free(tn); -+ node_free(tn); - } - - if (tnode_free_size >= PAGE_SIZE * sync_pages) { -@@ -437,7 +427,7 @@ static struct leaf_info *leaf_info_new(i - - static struct tnode *tnode_new(t_key key, int pos, int bits) - { -- size_t sz = sizeof(struct tnode) + (sizeof(struct rt_trie_node *) << bits); -+ size_t sz = offsetof(struct tnode, child[1 << bits]); - struct tnode *tn = tnode_alloc(sz); - unsigned int shift = pos + bits; - -@@ -666,15 +656,15 @@ no_children: - - static void tnode_clean_free(struct tnode *tn) - { -+ struct rt_trie_node *tofree; - int i; -- struct tnode *tofree; - - for (i = 0; i < tnode_child_length(tn); i++) { -- tofree = (struct tnode *)rtnl_dereference(tn->child[i]); -+ tofree = rtnl_dereference(tn->child[i]); - if (tofree) -- tnode_free(tofree); -+ node_free(tofree); - } -- tnode_free(tn); -+ node_free(tn); - } - - static struct tnode *inflate(struct trie *t, struct tnode *tn) -@@ -717,7 +707,7 @@ static struct tnode *inflate(struct trie - inode->bits - 1); - - if (!right) { -- tnode_free(left); -+ node_free(left); - goto nomem; - } - -@@ -1068,7 +1058,7 @@ static struct list_head *fib_insert_node - li = leaf_info_new(plen); - - if (!li) { -- free_leaf(l); -+ node_free(l); - return NULL; - } - -@@ -1100,7 +1090,7 @@ static struct list_head *fib_insert_node - - if (!tn) { - free_leaf_info(li); -- free_leaf(l); -+ node_free(l); - return NULL; - } - -@@ -1580,7 +1570,7 @@ static void trie_leaf_remove(struct trie - } else - RCU_INIT_POINTER(t->trie, NULL); - -- free_leaf(l); -+ node_free(l); - } - - /* diff --git a/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch b/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch deleted file mode 100644 index a3393bf93..000000000 --- a/target/linux/generic/pending-3.18/080-05-fib_trie-Merge-leaf-into-tnode.patch +++ /dev/null @@ -1,928 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:47 -0800 -Subject: [PATCH] fib_trie: Merge leaf into tnode - -This change makes it so that leaf and tnode are the same struct. As a -result there is no need for rt_trie_node anymore since everyting can be -merged into tnode. - -On 32b systems this results in the leaf being 4 bytes larger, however I -don't know if that is really an issue as this and an eariler patch that -added bits & pos have increased the size from 20 to 28. If I am not -mistaken slub/slab allocate on power of 2 sizes so 20 was likely being -rounded up to 32 anyway. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -96,32 +96,16 @@ struct tnode { - unsigned char pos; /* 2log(KEYLENGTH) bits needed */ - struct tnode __rcu *parent; - struct rcu_head rcu; -- /* everything above this comment must be the same as rt_trie_node */ -- unsigned int full_children; /* KEYLENGTH bits needed */ -- unsigned int empty_children; /* KEYLENGTH bits needed */ -- struct rt_trie_node __rcu *child[0]; --}; -- --/* This struct represents the shared bits between tnode and leaf. If any -- * ordering is changed here is must also be updated in tnode and leaf as -- * well. -- */ --struct rt_trie_node { -- t_key key; -- unsigned char bits; -- unsigned char pos; -- struct tnode __rcu *parent; -- struct rcu_head rcu; --}; -- --struct leaf { -- t_key key; -- unsigned char bits; -- unsigned char pos; -- struct tnode __rcu *parent; -- struct rcu_head rcu; -- /* everything above this comment must be the same as rt_trie_node */ -- struct hlist_head list; -+ union { -+ /* The fields in this struct are valid if bits > 0 (TNODE) */ -+ struct { -+ unsigned int full_children; /* KEYLENGTH bits needed */ -+ unsigned int empty_children; /* KEYLENGTH bits needed */ -+ struct tnode __rcu *child[0]; -+ }; -+ /* This list pointer if valid if bits == 0 (LEAF) */ -+ struct hlist_head list; -+ }; - }; - - struct leaf_info { -@@ -154,15 +138,15 @@ struct trie_stat { - }; - - struct trie { -- struct rt_trie_node __rcu *trie; -+ struct tnode __rcu *trie; - #ifdef CONFIG_IP_FIB_TRIE_STATS - struct trie_use_stats __percpu *stats; - #endif - }; - --static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *n, -+static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, - int wasfull); --static struct rt_trie_node *resize(struct trie *t, struct tnode *tn); -+static struct tnode *resize(struct trie *t, struct tnode *tn); - static struct tnode *inflate(struct trie *t, struct tnode *tn); - static struct tnode *halve(struct trie *t, struct tnode *tn); - /* tnodes to free after resize(); protected by RTNL */ -@@ -186,10 +170,10 @@ static struct kmem_cache *trie_leaf_kmem - #define node_parent_rcu(n) rcu_dereference_rtnl((n)->parent) - - /* wrapper for rcu_assign_pointer */ --static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) -+static inline void node_set_parent(struct tnode *n, struct tnode *tp) - { -- if (node) -- rcu_assign_pointer(node->parent, ptr); -+ if (n) -+ rcu_assign_pointer(n->parent, tp); - } - - #define NODE_INIT_PARENT(n, p) RCU_INIT_POINTER((n)->parent, p) -@@ -205,7 +189,7 @@ static inline int tnode_child_length(con - /* - * caller must hold RTNL - */ --static inline struct rt_trie_node *tnode_get_child(const struct tnode *tn, unsigned int i) -+static inline struct tnode *tnode_get_child(const struct tnode *tn, unsigned int i) - { - BUG_ON(i >= tnode_child_length(tn)); - -@@ -215,7 +199,7 @@ static inline struct rt_trie_node *tnode - /* - * caller must hold RCU read lock or RTNL - */ --static inline struct rt_trie_node *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) -+static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) - { - BUG_ON(i >= tnode_child_length(tn)); - -@@ -340,11 +324,11 @@ static inline void alias_free_mem_rcu(st - } - - #define TNODE_KMALLOC_MAX \ -- ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct rt_trie_node *)) -+ ilog2((PAGE_SIZE - sizeof(struct tnode)) / sizeof(struct tnode *)) - - static void __node_free_rcu(struct rcu_head *head) - { -- struct rt_trie_node *n = container_of(head, struct rt_trie_node, rcu); -+ struct tnode *n = container_of(head, struct tnode, rcu); - - if (IS_LEAF(n)) - kmem_cache_free(trie_leaf_kmem, n); -@@ -395,9 +379,9 @@ static void tnode_free_flush(void) - } - } - --static struct leaf *leaf_new(t_key key) -+static struct tnode *leaf_new(t_key key) - { -- struct leaf *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); -+ struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); - if (l) { - l->parent = NULL; - /* set key and pos to reflect full key value -@@ -444,7 +428,7 @@ static struct tnode *tnode_new(t_key key - } - - pr_debug("AT %p s=%zu %zu\n", tn, sizeof(struct tnode), -- sizeof(struct rt_trie_node *) << bits); -+ sizeof(struct tnode *) << bits); - return tn; - } - -@@ -453,13 +437,13 @@ static struct tnode *tnode_new(t_key key - * and no bits are skipped. See discussion in dyntree paper p. 6 - */ - --static inline int tnode_full(const struct tnode *tn, const struct rt_trie_node *n) -+static inline int tnode_full(const struct tnode *tn, const struct tnode *n) - { - return n && IS_TNODE(n) && (n->pos == (tn->pos + tn->bits)); - } - - static inline void put_child(struct tnode *tn, int i, -- struct rt_trie_node *n) -+ struct tnode *n) - { - tnode_put_child_reorg(tn, i, n, -1); - } -@@ -469,10 +453,10 @@ static inline void put_child(struct tnod - * Update the value of full_children and empty_children. - */ - --static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *n, -+static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, - int wasfull) - { -- struct rt_trie_node *chi = rtnl_dereference(tn->child[i]); -+ struct tnode *chi = rtnl_dereference(tn->child[i]); - int isfull; - - BUG_ON(i >= 1<bits); -@@ -499,10 +483,9 @@ static void tnode_put_child_reorg(struct - } - - #define MAX_WORK 10 --static struct rt_trie_node *resize(struct trie *t, struct tnode *tn) -+static struct tnode *resize(struct trie *t, struct tnode *tn) - { -- struct rt_trie_node *n = NULL; -- struct tnode *old_tn; -+ struct tnode *old_tn, *n = NULL; - int inflate_threshold_use; - int halve_threshold_use; - int max_work; -@@ -614,7 +597,7 @@ static struct rt_trie_node *resize(struc - - /* Return if at least one inflate is run */ - if (max_work != MAX_WORK) -- return (struct rt_trie_node *) tn; -+ return tn; - - /* - * Halve as long as the number of empty children in this -@@ -650,13 +633,13 @@ no_children: - tnode_free_safe(tn); - return n; - } -- return (struct rt_trie_node *) tn; -+ return tn; - } - - - static void tnode_clean_free(struct tnode *tn) - { -- struct rt_trie_node *tofree; -+ struct tnode *tofree; - int i; - - for (i = 0; i < tnode_child_length(tn); i++) { -@@ -667,10 +650,10 @@ static void tnode_clean_free(struct tnod - node_free(tn); - } - --static struct tnode *inflate(struct trie *t, struct tnode *tn) -+static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) - { -- struct tnode *oldtnode = tn; -- int olen = tnode_child_length(tn); -+ int olen = tnode_child_length(oldtnode); -+ struct tnode *tn; - int i; - - pr_debug("In inflate\n"); -@@ -690,11 +673,8 @@ static struct tnode *inflate(struct trie - for (i = 0; i < olen; i++) { - struct tnode *inode; - -- inode = (struct tnode *) tnode_get_child(oldtnode, i); -- if (inode && -- IS_TNODE(inode) && -- inode->pos == oldtnode->pos + oldtnode->bits && -- inode->bits > 1) { -+ inode = tnode_get_child(oldtnode, i); -+ if (tnode_full(oldtnode, inode) && inode->bits > 1) { - struct tnode *left, *right; - t_key m = ~0U << (KEYLENGTH - 1) >> inode->pos; - -@@ -711,33 +691,29 @@ static struct tnode *inflate(struct trie - goto nomem; - } - -- put_child(tn, 2*i, (struct rt_trie_node *) left); -- put_child(tn, 2*i+1, (struct rt_trie_node *) right); -+ put_child(tn, 2*i, left); -+ put_child(tn, 2*i+1, right); - } - } - - for (i = 0; i < olen; i++) { -- struct tnode *inode; -- struct rt_trie_node *node = tnode_get_child(oldtnode, i); -+ struct tnode *inode = tnode_get_child(oldtnode, i); - struct tnode *left, *right; - int size, j; - - /* An empty child */ -- if (node == NULL) -+ if (inode == NULL) - continue; - - /* A leaf or an internal node with skipped bits */ -- -- if (IS_LEAF(node) || (node->pos > (tn->pos + tn->bits - 1))) { -+ if (!tnode_full(oldtnode, inode)) { - put_child(tn, -- tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits + 1), -- node); -+ tkey_extract_bits(inode->key, tn->pos, tn->bits), -+ inode); - continue; - } - - /* An internal node with two children */ -- inode = (struct tnode *) node; -- - if (inode->bits == 1) { - put_child(tn, 2*i, rtnl_dereference(inode->child[0])); - put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); -@@ -769,12 +745,12 @@ static struct tnode *inflate(struct trie - * bit to zero. - */ - -- left = (struct tnode *) tnode_get_child(tn, 2*i); -+ left = tnode_get_child(tn, 2*i); - put_child(tn, 2*i, NULL); - - BUG_ON(!left); - -- right = (struct tnode *) tnode_get_child(tn, 2*i+1); -+ right = tnode_get_child(tn, 2*i+1); - put_child(tn, 2*i+1, NULL); - - BUG_ON(!right); -@@ -796,12 +772,11 @@ nomem: - return ERR_PTR(-ENOMEM); - } - --static struct tnode *halve(struct trie *t, struct tnode *tn) -+static struct tnode *halve(struct trie *t, struct tnode *oldtnode) - { -- struct tnode *oldtnode = tn; -- struct rt_trie_node *left, *right; -+ int olen = tnode_child_length(oldtnode); -+ struct tnode *tn, *left, *right; - int i; -- int olen = tnode_child_length(tn); - - pr_debug("In halve\n"); - -@@ -830,7 +805,7 @@ static struct tnode *halve(struct trie * - if (!newn) - goto nomem; - -- put_child(tn, i/2, (struct rt_trie_node *)newn); -+ put_child(tn, i/2, newn); - } - - } -@@ -855,7 +830,7 @@ static struct tnode *halve(struct trie * - } - - /* Two nonempty children */ -- newBinNode = (struct tnode *) tnode_get_child(tn, i/2); -+ newBinNode = tnode_get_child(tn, i/2); - put_child(tn, i/2, NULL); - put_child(newBinNode, 0, left); - put_child(newBinNode, 1, right); -@@ -871,7 +846,7 @@ nomem: - /* readside must use rcu_read_lock currently dump routines - via get_fa_head and dump */ - --static struct leaf_info *find_leaf_info(struct leaf *l, int plen) -+static struct leaf_info *find_leaf_info(struct tnode *l, int plen) - { - struct hlist_head *head = &l->list; - struct leaf_info *li; -@@ -883,7 +858,7 @@ static struct leaf_info *find_leaf_info( - return NULL; - } - --static inline struct list_head *get_fa_head(struct leaf *l, int plen) -+static inline struct list_head *get_fa_head(struct tnode *l, int plen) - { - struct leaf_info *li = find_leaf_info(l, plen); - -@@ -915,32 +890,25 @@ static void insert_leaf_info(struct hlis - - /* rcu_read_lock needs to be hold by caller from readside */ - --static struct leaf * --fib_find_node(struct trie *t, u32 key) -+static struct tnode *fib_find_node(struct trie *t, u32 key) - { -- int pos; -- struct tnode *tn; -- struct rt_trie_node *n; -- -- pos = 0; -- n = rcu_dereference_rtnl(t->trie); -+ struct tnode *n = rcu_dereference_rtnl(t->trie); -+ int pos = 0; - - while (n && IS_TNODE(n)) { -- tn = (struct tnode *) n; -- -- if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { -- pos = tn->pos + tn->bits; -- n = tnode_get_child_rcu(tn, -+ if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { -+ pos = n->pos + n->bits; -+ n = tnode_get_child_rcu(n, - tkey_extract_bits(key, -- tn->pos, -- tn->bits)); -+ n->pos, -+ n->bits)); - } else - break; - } - /* Case we have found a leaf. Compare prefixes */ - - if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) -- return (struct leaf *)n; -+ return n; - - return NULL; - } -@@ -956,14 +924,13 @@ static void trie_rebalance(struct trie * - while (tn != NULL && (tp = node_parent(tn)) != NULL) { - cindex = tkey_extract_bits(key, tp->pos, tp->bits); - wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); -- tn = (struct tnode *)resize(t, tn); -+ tn = resize(t, tn); - -- tnode_put_child_reorg(tp, cindex, -- (struct rt_trie_node *)tn, wasfull); -+ tnode_put_child_reorg(tp, cindex, tn, wasfull); - - tp = node_parent(tn); - if (!tp) -- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); -+ rcu_assign_pointer(t->trie, tn); - - tnode_free_flush(); - if (!tp) -@@ -973,9 +940,9 @@ static void trie_rebalance(struct trie * - - /* Handle last (top) tnode */ - if (IS_TNODE(tn)) -- tn = (struct tnode *)resize(t, tn); -+ tn = resize(t, tn); - -- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); -+ rcu_assign_pointer(t->trie, tn); - tnode_free_flush(); - } - -@@ -985,8 +952,8 @@ static struct list_head *fib_insert_node - { - int pos, newpos; - struct tnode *tp = NULL, *tn = NULL; -- struct rt_trie_node *n; -- struct leaf *l; -+ struct tnode *n; -+ struct tnode *l; - int missbit; - struct list_head *fa_head = NULL; - struct leaf_info *li; -@@ -1014,17 +981,15 @@ static struct list_head *fib_insert_node - */ - - while (n && IS_TNODE(n)) { -- tn = (struct tnode *) n; -- -- if (tkey_sub_equals(tn->key, pos, tn->pos-pos, key)) { -- tp = tn; -- pos = tn->pos + tn->bits; -- n = tnode_get_child(tn, -+ if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { -+ tp = n; -+ pos = n->pos + n->bits; -+ n = tnode_get_child(n, - tkey_extract_bits(key, -- tn->pos, -- tn->bits)); -+ n->pos, -+ n->bits)); - -- BUG_ON(n && node_parent(n) != tn); -+ BUG_ON(n && node_parent(n) != tp); - } else - break; - } -@@ -1040,14 +1005,13 @@ static struct list_head *fib_insert_node - /* Case 1: n is a leaf. Compare prefixes */ - - if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) { -- l = (struct leaf *) n; - li = leaf_info_new(plen); - - if (!li) - return NULL; - - fa_head = &li->falh; -- insert_leaf_info(&l->list, li); -+ insert_leaf_info(&n->list, li); - goto done; - } - l = leaf_new(key); -@@ -1068,10 +1032,10 @@ static struct list_head *fib_insert_node - if (t->trie && n == NULL) { - /* Case 2: n is NULL, and will just insert a new leaf */ - -- node_set_parent((struct rt_trie_node *)l, tp); -+ node_set_parent(l, tp); - - cindex = tkey_extract_bits(key, tp->pos, tp->bits); -- put_child(tp, cindex, (struct rt_trie_node *)l); -+ put_child(tp, cindex, l); - } else { - /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ - /* -@@ -1094,17 +1058,17 @@ static struct list_head *fib_insert_node - return NULL; - } - -- node_set_parent((struct rt_trie_node *)tn, tp); -+ node_set_parent(tn, tp); - - missbit = tkey_extract_bits(key, newpos, 1); -- put_child(tn, missbit, (struct rt_trie_node *)l); -+ put_child(tn, missbit, l); - put_child(tn, 1-missbit, n); - - if (tp) { - cindex = tkey_extract_bits(key, tp->pos, tp->bits); -- put_child(tp, cindex, (struct rt_trie_node *)tn); -+ put_child(tp, cindex, tn); - } else { -- rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn); -+ rcu_assign_pointer(t->trie, tn); - } - - tp = tn; -@@ -1134,7 +1098,7 @@ int fib_table_insert(struct fib_table *t - u8 tos = cfg->fc_tos; - u32 key, mask; - int err; -- struct leaf *l; -+ struct tnode *l; - - if (plen > 32) - return -EINVAL; -@@ -1292,7 +1256,7 @@ err: - } - - /* should be called with rcu_read_lock */ --static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, -+static int check_leaf(struct fib_table *tb, struct trie *t, struct tnode *l, - t_key key, const struct flowi4 *flp, - struct fib_result *res, int fib_flags) - { -@@ -1365,7 +1329,7 @@ int fib_table_lookup(struct fib_table *t - struct trie_use_stats __percpu *stats = t->stats; - #endif - int ret; -- struct rt_trie_node *n; -+ struct tnode *n; - struct tnode *pn; - unsigned int pos, bits; - t_key key = ntohl(flp->daddr); -@@ -1387,11 +1351,11 @@ int fib_table_lookup(struct fib_table *t - - /* Just a leaf? */ - if (IS_LEAF(n)) { -- ret = check_leaf(tb, t, (struct leaf *)n, key, flp, res, fib_flags); -+ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); - goto found; - } - -- pn = (struct tnode *) n; -+ pn = n; - chopped_off = 0; - - while (pn) { -@@ -1412,13 +1376,13 @@ int fib_table_lookup(struct fib_table *t - } - - if (IS_LEAF(n)) { -- ret = check_leaf(tb, t, (struct leaf *)n, key, flp, res, fib_flags); -+ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); - if (ret > 0) - goto backtrace; - goto found; - } - -- cn = (struct tnode *)n; -+ cn = n; - - /* - * It's a tnode, and we can do some extra checks here if we -@@ -1506,7 +1470,7 @@ int fib_table_lookup(struct fib_table *t - current_prefix_length = mp; - } - -- pn = (struct tnode *)n; /* Descend */ -+ pn = n; /* Descend */ - chopped_off = 0; - continue; - -@@ -1557,7 +1521,7 @@ EXPORT_SYMBOL_GPL(fib_table_lookup); - /* - * Remove the leaf and return parent. - */ --static void trie_leaf_remove(struct trie *t, struct leaf *l) -+static void trie_leaf_remove(struct trie *t, struct tnode *l) - { - struct tnode *tp = node_parent(l); - -@@ -1584,7 +1548,7 @@ int fib_table_delete(struct fib_table *t - u8 tos = cfg->fc_tos; - struct fib_alias *fa, *fa_to_delete; - struct list_head *fa_head; -- struct leaf *l; -+ struct tnode *l; - struct leaf_info *li; - - if (plen > 32) -@@ -1682,7 +1646,7 @@ static int trie_flush_list(struct list_h - return found; - } - --static int trie_flush_leaf(struct leaf *l) -+static int trie_flush_leaf(struct tnode *l) - { - int found = 0; - struct hlist_head *lih = &l->list; -@@ -1704,7 +1668,7 @@ static int trie_flush_leaf(struct leaf * - * Scan for the next right leaf starting at node p->child[idx] - * Since we have back pointer, no recursion necessary. - */ --static struct leaf *leaf_walk_rcu(struct tnode *p, struct rt_trie_node *c) -+static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) - { - do { - t_key idx; -@@ -1720,47 +1684,46 @@ static struct leaf *leaf_walk_rcu(struct - continue; - - if (IS_LEAF(c)) -- return (struct leaf *) c; -+ return c; - - /* Rescan start scanning in new node */ -- p = (struct tnode *) c; -+ p = c; - idx = 0; - } - - /* Node empty, walk back up to parent */ -- c = (struct rt_trie_node *) p; -+ c = p; - } while ((p = node_parent_rcu(c)) != NULL); - - return NULL; /* Root of trie */ - } - --static struct leaf *trie_firstleaf(struct trie *t) -+static struct tnode *trie_firstleaf(struct trie *t) - { -- struct tnode *n = (struct tnode *)rcu_dereference_rtnl(t->trie); -+ struct tnode *n = rcu_dereference_rtnl(t->trie); - - if (!n) - return NULL; - - if (IS_LEAF(n)) /* trie is just a leaf */ -- return (struct leaf *) n; -+ return n; - - return leaf_walk_rcu(n, NULL); - } - --static struct leaf *trie_nextleaf(struct leaf *l) -+static struct tnode *trie_nextleaf(struct tnode *l) - { -- struct rt_trie_node *c = (struct rt_trie_node *) l; -- struct tnode *p = node_parent_rcu(c); -+ struct tnode *p = node_parent_rcu(l); - - if (!p) - return NULL; /* trie with just one leaf */ - -- return leaf_walk_rcu(p, c); -+ return leaf_walk_rcu(p, l); - } - --static struct leaf *trie_leafindex(struct trie *t, int index) -+static struct tnode *trie_leafindex(struct trie *t, int index) - { -- struct leaf *l = trie_firstleaf(t); -+ struct tnode *l = trie_firstleaf(t); - - while (l && index-- > 0) - l = trie_nextleaf(l); -@@ -1775,7 +1738,7 @@ static struct leaf *trie_leafindex(struc - int fib_table_flush(struct fib_table *tb) - { - struct trie *t = (struct trie *) tb->tb_data; -- struct leaf *l, *ll = NULL; -+ struct tnode *l, *ll = NULL; - int found = 0; - - for (l = trie_firstleaf(t); l; l = trie_nextleaf(l)) { -@@ -1840,7 +1803,7 @@ static int fn_trie_dump_fa(t_key key, in - return skb->len; - } - --static int fn_trie_dump_leaf(struct leaf *l, struct fib_table *tb, -+static int fn_trie_dump_leaf(struct tnode *l, struct fib_table *tb, - struct sk_buff *skb, struct netlink_callback *cb) - { - struct leaf_info *li; -@@ -1876,7 +1839,7 @@ static int fn_trie_dump_leaf(struct leaf - int fib_table_dump(struct fib_table *tb, struct sk_buff *skb, - struct netlink_callback *cb) - { -- struct leaf *l; -+ struct tnode *l; - struct trie *t = (struct trie *) tb->tb_data; - t_key key = cb->args[2]; - int count = cb->args[3]; -@@ -1922,7 +1885,7 @@ void __init fib_trie_init(void) - 0, SLAB_PANIC, NULL); - - trie_leaf_kmem = kmem_cache_create("ip_fib_trie", -- max(sizeof(struct leaf), -+ max(sizeof(struct tnode), - sizeof(struct leaf_info)), - 0, SLAB_PANIC, NULL); - } -@@ -1965,7 +1928,7 @@ struct fib_trie_iter { - unsigned int depth; - }; - --static struct rt_trie_node *fib_trie_get_next(struct fib_trie_iter *iter) -+static struct tnode *fib_trie_get_next(struct fib_trie_iter *iter) - { - struct tnode *tn = iter->tnode; - unsigned int cindex = iter->index; -@@ -1979,7 +1942,7 @@ static struct rt_trie_node *fib_trie_get - iter->tnode, iter->index, iter->depth); - rescan: - while (cindex < (1<bits)) { -- struct rt_trie_node *n = tnode_get_child_rcu(tn, cindex); -+ struct tnode *n = tnode_get_child_rcu(tn, cindex); - - if (n) { - if (IS_LEAF(n)) { -@@ -1987,7 +1950,7 @@ rescan: - iter->index = cindex + 1; - } else { - /* push down one level */ -- iter->tnode = (struct tnode *) n; -+ iter->tnode = n; - iter->index = 0; - ++iter->depth; - } -@@ -1998,7 +1961,7 @@ rescan: - } - - /* Current node exhausted, pop back up */ -- p = node_parent_rcu((struct rt_trie_node *)tn); -+ p = node_parent_rcu(tn); - if (p) { - cindex = tkey_extract_bits(tn->key, p->pos, p->bits)+1; - tn = p; -@@ -2010,10 +1973,10 @@ rescan: - return NULL; - } - --static struct rt_trie_node *fib_trie_get_first(struct fib_trie_iter *iter, -+static struct tnode *fib_trie_get_first(struct fib_trie_iter *iter, - struct trie *t) - { -- struct rt_trie_node *n; -+ struct tnode *n; - - if (!t) - return NULL; -@@ -2023,7 +1986,7 @@ static struct rt_trie_node *fib_trie_get - return NULL; - - if (IS_TNODE(n)) { -- iter->tnode = (struct tnode *) n; -+ iter->tnode = n; - iter->index = 0; - iter->depth = 1; - } else { -@@ -2037,7 +2000,7 @@ static struct rt_trie_node *fib_trie_get - - static void trie_collect_stats(struct trie *t, struct trie_stat *s) - { -- struct rt_trie_node *n; -+ struct tnode *n; - struct fib_trie_iter iter; - - memset(s, 0, sizeof(*s)); -@@ -2045,7 +2008,6 @@ static void trie_collect_stats(struct tr - rcu_read_lock(); - for (n = fib_trie_get_first(&iter, t); n; n = fib_trie_get_next(&iter)) { - if (IS_LEAF(n)) { -- struct leaf *l = (struct leaf *)n; - struct leaf_info *li; - - s->leaves++; -@@ -2053,18 +2015,17 @@ static void trie_collect_stats(struct tr - if (iter.depth > s->maxdepth) - s->maxdepth = iter.depth; - -- hlist_for_each_entry_rcu(li, &l->list, hlist) -+ hlist_for_each_entry_rcu(li, &n->list, hlist) - ++s->prefixes; - } else { -- const struct tnode *tn = (const struct tnode *) n; - int i; - - s->tnodes++; -- if (tn->bits < MAX_STAT_DEPTH) -- s->nodesizes[tn->bits]++; -+ if (n->bits < MAX_STAT_DEPTH) -+ s->nodesizes[n->bits]++; - -- for (i = 0; i < (1<bits); i++) -- if (!tn->child[i]) -+ for (i = 0; i < tnode_child_length(n); i++) -+ if (!rcu_access_pointer(n->child[i])) - s->nullpointers++; - } - } -@@ -2088,7 +2049,7 @@ static void trie_show_stats(struct seq_f - seq_printf(seq, "\tMax depth: %u\n", stat->maxdepth); - - seq_printf(seq, "\tLeaves: %u\n", stat->leaves); -- bytes = sizeof(struct leaf) * stat->leaves; -+ bytes = sizeof(struct tnode) * stat->leaves; - - seq_printf(seq, "\tPrefixes: %u\n", stat->prefixes); - bytes += sizeof(struct leaf_info) * stat->prefixes; -@@ -2109,7 +2070,7 @@ static void trie_show_stats(struct seq_f - seq_putc(seq, '\n'); - seq_printf(seq, "\tPointers: %u\n", pointers); - -- bytes += sizeof(struct rt_trie_node *) * pointers; -+ bytes += sizeof(struct tnode *) * pointers; - seq_printf(seq, "Null ptrs: %u\n", stat->nullpointers); - seq_printf(seq, "Total size: %u kB\n", (bytes + 1023) / 1024); - } -@@ -2163,7 +2124,7 @@ static int fib_triestat_seq_show(struct - seq_printf(seq, - "Basic info: size of leaf:" - " %Zd bytes, size of tnode: %Zd bytes.\n", -- sizeof(struct leaf), sizeof(struct tnode)); -+ sizeof(struct tnode), sizeof(struct tnode)); - - for (h = 0; h < FIB_TABLE_HASHSZ; h++) { - struct hlist_head *head = &net->ipv4.fib_table_hash[h]; -@@ -2202,7 +2163,7 @@ static const struct file_operations fib_ - .release = single_release_net, - }; - --static struct rt_trie_node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) -+static struct tnode *fib_trie_get_idx(struct seq_file *seq, loff_t pos) - { - struct fib_trie_iter *iter = seq->private; - struct net *net = seq_file_net(seq); -@@ -2214,7 +2175,7 @@ static struct rt_trie_node *fib_trie_get - struct fib_table *tb; - - hlist_for_each_entry_rcu(tb, head, tb_hlist) { -- struct rt_trie_node *n; -+ struct tnode *n; - - for (n = fib_trie_get_first(iter, - (struct trie *) tb->tb_data); -@@ -2243,7 +2204,7 @@ static void *fib_trie_seq_next(struct se - struct fib_table *tb = iter->tb; - struct hlist_node *tb_node; - unsigned int h; -- struct rt_trie_node *n; -+ struct tnode *n; - - ++*pos; - /* next node in same table */ -@@ -2329,29 +2290,26 @@ static inline const char *rtn_type(char - static int fib_trie_seq_show(struct seq_file *seq, void *v) - { - const struct fib_trie_iter *iter = seq->private; -- struct rt_trie_node *n = v; -+ struct tnode *n = v; - - if (!node_parent_rcu(n)) - fib_table_print(seq, iter->tb); - - if (IS_TNODE(n)) { -- struct tnode *tn = (struct tnode *) n; -- __be32 prf = htonl(tn->key); -+ __be32 prf = htonl(n->key); - -- seq_indent(seq, iter->depth-1); -+ seq_indent(seq, iter->depth - 1); - seq_printf(seq, " +-- %pI4/%d %d %d %d\n", -- &prf, tn->pos, tn->bits, tn->full_children, -- tn->empty_children); -- -+ &prf, n->pos, n->bits, n->full_children, -+ n->empty_children); - } else { -- struct leaf *l = (struct leaf *) n; - struct leaf_info *li; -- __be32 val = htonl(l->key); -+ __be32 val = htonl(n->key); - - seq_indent(seq, iter->depth); - seq_printf(seq, " |-- %pI4\n", &val); - -- hlist_for_each_entry_rcu(li, &l->list, hlist) { -+ hlist_for_each_entry_rcu(li, &n->list, hlist) { - struct fib_alias *fa; - - list_for_each_entry_rcu(fa, &li->falh, fa_list) { -@@ -2401,9 +2359,9 @@ struct fib_route_iter { - t_key key; - }; - --static struct leaf *fib_route_get_idx(struct fib_route_iter *iter, loff_t pos) -+static struct tnode *fib_route_get_idx(struct fib_route_iter *iter, loff_t pos) - { -- struct leaf *l = NULL; -+ struct tnode *l = NULL; - struct trie *t = iter->main_trie; - - /* use cache location of last found key */ -@@ -2448,7 +2406,7 @@ static void *fib_route_seq_start(struct - static void *fib_route_seq_next(struct seq_file *seq, void *v, loff_t *pos) - { - struct fib_route_iter *iter = seq->private; -- struct leaf *l = v; -+ struct tnode *l = v; - - ++*pos; - if (v == SEQ_START_TOKEN) { -@@ -2494,7 +2452,7 @@ static unsigned int fib_flag_trans(int t - */ - static int fib_route_seq_show(struct seq_file *seq, void *v) - { -- struct leaf *l = v; -+ struct tnode *l = v; - struct leaf_info *li; - - if (v == SEQ_START_TOKEN) { diff --git a/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch b/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch deleted file mode 100644 index e84412687..000000000 --- a/target/linux/generic/pending-3.18/080-06-fib_trie-Optimize-fib_table_lookup-to-avoid-wasting-.patch +++ /dev/null @@ -1,343 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:55:54 -0800 -Subject: [PATCH] fib_trie: Optimize fib_table_lookup to avoid wasting - time on loops/variables - -This patch is meant to reduce the complexity of fib_table_lookup by reducing -the number of variables to the bare minimum while still keeping the same if -not improved functionality versus the original. - -Most of this change was started off by the desire to rid the function of -chopped_off and current_prefix_length as they actually added very little to -the function since they only applied when computing the cindex. I was able -to replace them mostly with just a check for the prefix match. As long as -the prefix between the key and the node being tested was the same we know -we can search the tnode fully versus just testing cindex 0. - -The second portion of the change ended up being a massive reordering. -Originally the calls to check_leaf were up near the start of the loop, and -the backtracing and descending into lower levels of tnodes was later. This -didn't make much sense as the structure of the tree means the leaves are -always the last thing to be tested. As such I reordered things so that we -instead have a loop that will delve into the tree and only exit when we -have either found a leaf or we have exhausted the tree. The advantage of -rearranging things like this is that we can fully inline check_leaf since -there is now only one reference to it in the function. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -90,6 +90,9 @@ typedef unsigned int t_key; - #define IS_TNODE(n) ((n)->bits) - #define IS_LEAF(n) (!(n)->bits) - -+#define get_shift(_kv) (KEYLENGTH - (_kv)->pos - (_kv)->bits) -+#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> get_shift(_kv)) -+ - struct tnode { - t_key key; - unsigned char bits; /* 2log(KEYLENGTH) bits needed */ -@@ -1281,7 +1284,7 @@ static int check_leaf(struct fib_table * - continue; - fib_alias_accessed(fa); - err = fib_props[fa->fa_type].error; -- if (err) { -+ if (unlikely(err < 0)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->semantic_match_passed); - #endif -@@ -1303,7 +1306,7 @@ static int check_leaf(struct fib_table * - res->prefixlen = li->plen; - res->nh_sel = nhsel; - res->type = fa->fa_type; -- res->scope = fa->fa_info->fib_scope; -+ res->scope = fi->fib_scope; - res->fi = fi; - res->table = tb; - res->fa_head = &li->falh; -@@ -1321,23 +1324,24 @@ static int check_leaf(struct fib_table * - return 1; - } - -+static inline t_key prefix_mismatch(t_key key, struct tnode *n) -+{ -+ t_key prefix = n->key; -+ -+ return (key ^ prefix) & (prefix | -prefix); -+} -+ - int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, - struct fib_result *res, int fib_flags) - { -- struct trie *t = (struct trie *) tb->tb_data; -+ struct trie *t = (struct trie *)tb->tb_data; - #ifdef CONFIG_IP_FIB_TRIE_STATS - struct trie_use_stats __percpu *stats = t->stats; - #endif -- int ret; -- struct tnode *n; -- struct tnode *pn; -- unsigned int pos, bits; -- t_key key = ntohl(flp->daddr); -- unsigned int chopped_off; -- t_key cindex = 0; -- unsigned int current_prefix_length = KEYLENGTH; -- struct tnode *cn; -- t_key pref_mismatch; -+ const t_key key = ntohl(flp->daddr); -+ struct tnode *n, *pn; -+ t_key cindex; -+ int ret = 1; - - rcu_read_lock(); - -@@ -1349,170 +1353,102 @@ int fib_table_lookup(struct fib_table *t - this_cpu_inc(stats->gets); - #endif - -- /* Just a leaf? */ -- if (IS_LEAF(n)) { -- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); -- goto found; -- } -- - pn = n; -- chopped_off = 0; -- -- while (pn) { -- pos = pn->pos; -- bits = pn->bits; -+ cindex = 0; - -- if (!chopped_off) -- cindex = tkey_extract_bits(mask_pfx(key, current_prefix_length), -- pos, bits); -- -- n = tnode_get_child_rcu(pn, cindex); -- -- if (n == NULL) { --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(stats->null_node_hit); --#endif -- goto backtrace; -- } -+ /* Step 1: Travel to the longest prefix match in the trie */ -+ for (;;) { -+ unsigned long index = get_index(key, n); -+ -+ /* This bit of code is a bit tricky but it combines multiple -+ * checks into a single check. The prefix consists of the -+ * prefix plus zeros for the "bits" in the prefix. The index -+ * is the difference between the key and this value. From -+ * this we can actually derive several pieces of data. -+ * if !(index >> bits) -+ * we know the value is child index -+ * else -+ * we have a mismatch in skip bits and failed -+ */ -+ if (index >> n->bits) -+ break; - -- if (IS_LEAF(n)) { -- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); -- if (ret > 0) -- goto backtrace; -+ /* we have found a leaf. Prefixes have already been compared */ -+ if (IS_LEAF(n)) - goto found; -- } -- -- cn = n; - -- /* -- * It's a tnode, and we can do some extra checks here if we -- * like, to avoid descending into a dead-end branch. -- * This tnode is in the parent's child array at index -- * key[p_pos..p_pos+p_bits] but potentially with some bits -- * chopped off, so in reality the index may be just a -- * subprefix, padded with zero at the end. -- * We can also take a look at any skipped bits in this -- * tnode - everything up to p_pos is supposed to be ok, -- * and the non-chopped bits of the index (se previous -- * paragraph) are also guaranteed ok, but the rest is -- * considered unknown. -- * -- * The skipped bits are key[pos+bits..cn->pos]. -- */ -- -- /* If current_prefix_length < pos+bits, we are already doing -- * actual prefix matching, which means everything from -- * pos+(bits-chopped_off) onward must be zero along some -- * branch of this subtree - otherwise there is *no* valid -- * prefix present. Here we can only check the skipped -- * bits. Remember, since we have already indexed into the -- * parent's child array, we know that the bits we chopped of -- * *are* zero. -+ /* only record pn and cindex if we are going to be chopping -+ * bits later. Otherwise we are just wasting cycles. - */ -- -- /* NOTA BENE: Checking only skipped bits -- for the new node here */ -- -- if (current_prefix_length < pos+bits) { -- if (tkey_extract_bits(cn->key, current_prefix_length, -- cn->pos - current_prefix_length) -- || !(cn->child[0])) -- goto backtrace; -+ if (index) { -+ pn = n; -+ cindex = index; - } - -- /* -- * If chopped_off=0, the index is fully validated and we -- * only need to look at the skipped bits for this, the new, -- * tnode. What we actually want to do is to find out if -- * these skipped bits match our key perfectly, or if we will -- * have to count on finding a matching prefix further down, -- * because if we do, we would like to have some way of -- * verifying the existence of such a prefix at this point. -- */ -- -- /* The only thing we can do at this point is to verify that -- * any such matching prefix can indeed be a prefix to our -- * key, and if the bits in the node we are inspecting that -- * do not match our key are not ZERO, this cannot be true. -- * Thus, find out where there is a mismatch (before cn->pos) -- * and verify that all the mismatching bits are zero in the -- * new tnode's key. -- */ -+ n = rcu_dereference(n->child[index]); -+ if (unlikely(!n)) -+ goto backtrace; -+ } - -- /* -- * Note: We aren't very concerned about the piece of -- * the key that precede pn->pos+pn->bits, since these -- * have already been checked. The bits after cn->pos -- * aren't checked since these are by definition -- * "unknown" at this point. Thus, what we want to see -- * is if we are about to enter the "prefix matching" -- * state, and in that case verify that the skipped -- * bits that will prevail throughout this subtree are -- * zero, as they have to be if we are to find a -- * matching prefix. -+ /* Step 2: Sort out leaves and begin backtracing for longest prefix */ -+ for (;;) { -+ /* record the pointer where our next node pointer is stored */ -+ struct tnode __rcu **cptr = n->child; -+ -+ /* This test verifies that none of the bits that differ -+ * between the key and the prefix exist in the region of -+ * the lsb and higher in the prefix. - */ -+ if (unlikely(prefix_mismatch(key, n))) -+ goto backtrace; - -- pref_mismatch = mask_pfx(cn->key ^ key, cn->pos); -+ /* exit out and process leaf */ -+ if (unlikely(IS_LEAF(n))) -+ break; - -- /* -- * In short: If skipped bits in this node do not match -- * the search key, enter the "prefix matching" -- * state.directly. -+ /* Don't bother recording parent info. Since we are in -+ * prefix match mode we will have to come back to wherever -+ * we started this traversal anyway - */ -- if (pref_mismatch) { -- /* fls(x) = __fls(x) + 1 */ -- int mp = KEYLENGTH - __fls(pref_mismatch) - 1; -- -- if (tkey_extract_bits(cn->key, mp, cn->pos - mp) != 0) -- goto backtrace; -- -- if (current_prefix_length >= cn->pos) -- current_prefix_length = mp; -- } -- -- pn = n; /* Descend */ -- chopped_off = 0; -- continue; - -+ while ((n = rcu_dereference(*cptr)) == NULL) { - backtrace: -- chopped_off++; -- -- /* As zero don't change the child key (cindex) */ -- while ((chopped_off <= pn->bits) -- && !(cindex & (1<<(chopped_off-1)))) -- chopped_off++; -- -- /* Decrease current_... with bits chopped off */ -- if (current_prefix_length > pn->pos + pn->bits - chopped_off) -- current_prefix_length = pn->pos + pn->bits -- - chopped_off; -- -- /* -- * Either we do the actual chop off according or if we have -- * chopped off all bits in this tnode walk up to our parent. -- */ -- -- if (chopped_off <= pn->bits) { -- cindex &= ~(1 << (chopped_off-1)); -- } else { -- struct tnode *parent = node_parent_rcu(pn); -- if (!parent) -- goto failed; -- -- /* Get Child's index */ -- cindex = tkey_extract_bits(pn->key, parent->pos, parent->bits); -- pn = parent; -- chopped_off = 0; -- - #ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(stats->backtrack); -+ if (!n) -+ this_cpu_inc(stats->null_node_hit); - #endif -- goto backtrace; -+ /* If we are at cindex 0 there are no more bits for -+ * us to strip at this level so we must ascend back -+ * up one level to see if there are any more bits to -+ * be stripped there. -+ */ -+ while (!cindex) { -+ t_key pkey = pn->key; -+ -+ pn = node_parent_rcu(pn); -+ if (unlikely(!pn)) -+ goto failed; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(stats->backtrack); -+#endif -+ /* Get Child's index */ -+ cindex = get_index(pkey, pn); -+ } -+ -+ /* strip the least significant bit from the cindex */ -+ cindex &= cindex - 1; -+ -+ /* grab pointer for next child node */ -+ cptr = &pn->child[cindex]; - } - } --failed: -- ret = 1; -+ - found: -+ /* Step 3: Process the leaf, if that fails fall back to backtracing */ -+ ret = check_leaf(tb, t, n, key, flp, res, fib_flags); -+ if (unlikely(ret > 0)) -+ goto backtrace; -+failed: - rcu_read_unlock(); - return ret; - } diff --git a/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch b/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch deleted file mode 100644 index 0193f758f..000000000 --- a/target/linux/generic/pending-3.18/080-07-fib_trie-Optimize-fib_find_node.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:00 -0800 -Subject: [PATCH] fib_trie: Optimize fib_find_node - -This patch makes use of the same features I made use of for -fib_table_lookup to streamline fib_find_node. The resultant code should be -smaller and run faster than the original. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -892,28 +892,34 @@ static void insert_leaf_info(struct hlis - } - - /* rcu_read_lock needs to be hold by caller from readside */ -- - static struct tnode *fib_find_node(struct trie *t, u32 key) - { - struct tnode *n = rcu_dereference_rtnl(t->trie); -- int pos = 0; - -- while (n && IS_TNODE(n)) { -- if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { -- pos = n->pos + n->bits; -- n = tnode_get_child_rcu(n, -- tkey_extract_bits(key, -- n->pos, -- n->bits)); -- } else -+ while (n) { -+ unsigned long index = get_index(key, n); -+ -+ /* This bit of code is a bit tricky but it combines multiple -+ * checks into a single check. The prefix consists of the -+ * prefix plus zeros for the bits in the cindex. The index -+ * is the difference between the key and this value. From -+ * this we can actually derive several pieces of data. -+ * if !(index >> bits) -+ * we know the value is cindex -+ * else -+ * we have a mismatch in skip bits and failed -+ */ -+ if (index >> n->bits) -+ return NULL; -+ -+ /* we have found a leaf. Prefixes have already been compared */ -+ if (IS_LEAF(n)) - break; -- } -- /* Case we have found a leaf. Compare prefixes */ - -- if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) -- return n; -+ n = rcu_dereference_rtnl(n->child[index]); -+ } - -- return NULL; -+ return n; - } - - static void trie_rebalance(struct trie *t, struct tnode *tn) diff --git a/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch b/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch deleted file mode 100644 index b328d2c5d..000000000 --- a/target/linux/generic/pending-3.18/080-08-fib_trie-Optimize-fib_table_insert.patch +++ /dev/null @@ -1,276 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:06 -0800 -Subject: [PATCH] fib_trie: Optimize fib_table_insert - -This patch updates the fib_table_insert function to take advantage of the -changes made to improve the performance of fib_table_lookup. As a result -the code should be smaller and run faster then the original. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -222,31 +222,6 @@ static inline t_key tkey_extract_bits(t_ - return 0; - } - --static inline int tkey_equals(t_key a, t_key b) --{ -- return a == b; --} -- --static inline int tkey_sub_equals(t_key a, int offset, int bits, t_key b) --{ -- if (bits == 0 || offset >= KEYLENGTH) -- return 1; -- bits = bits > KEYLENGTH ? KEYLENGTH : bits; -- return ((a ^ b) << offset) >> (KEYLENGTH - bits) == 0; --} -- --static inline int tkey_mismatch(t_key a, int offset, t_key b) --{ -- t_key diff = a ^ b; -- int i = offset; -- -- if (!diff) -- return 0; -- while ((diff << i) >> (KEYLENGTH-1) == 0) -- i++; -- return i; --} -- - /* - To understand this stuff, an understanding of keys and all their bits is - necessary. Every node in the trie has a key associated with it, but not -@@ -485,6 +460,15 @@ static void tnode_put_child_reorg(struct - rcu_assign_pointer(tn->child[i], n); - } - -+static void put_child_root(struct tnode *tp, struct trie *t, -+ t_key key, struct tnode *n) -+{ -+ if (tp) -+ put_child(tp, get_index(key, tp), n); -+ else -+ rcu_assign_pointer(t->trie, n); -+} -+ - #define MAX_WORK 10 - static struct tnode *resize(struct trie *t, struct tnode *tn) - { -@@ -959,138 +943,100 @@ static void trie_rebalance(struct trie * - - static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) - { -- int pos, newpos; -- struct tnode *tp = NULL, *tn = NULL; -- struct tnode *n; -- struct tnode *l; -- int missbit; - struct list_head *fa_head = NULL; -+ struct tnode *l, *n, *tp = NULL; - struct leaf_info *li; -- t_key cindex; - -- pos = 0; -+ li = leaf_info_new(plen); -+ if (!li) -+ return NULL; -+ fa_head = &li->falh; -+ - n = rtnl_dereference(t->trie); - - /* If we point to NULL, stop. Either the tree is empty and we should - * just put a new leaf in if, or we have reached an empty child slot, - * and we should just put our new leaf in that. -- * If we point to a T_TNODE, check if it matches our key. Note that -- * a T_TNODE might be skipping any number of bits - its 'pos' need -- * not be the parent's 'pos'+'bits'! -- * -- * If it does match the current key, get pos/bits from it, extract -- * the index from our key, push the T_TNODE and walk the tree. -- * -- * If it doesn't, we have to replace it with a new T_TNODE. - * -- * If we point to a T_LEAF, it might or might not have the same key -- * as we do. If it does, just change the value, update the T_LEAF's -- * value, and return it. -- * If it doesn't, we need to replace it with a T_TNODE. -+ * If we hit a node with a key that does't match then we should stop -+ * and create a new tnode to replace that node and insert ourselves -+ * and the other node into the new tnode. - */ -+ while (n) { -+ unsigned long index = get_index(key, n); - -- while (n && IS_TNODE(n)) { -- if (tkey_sub_equals(n->key, pos, n->pos-pos, key)) { -- tp = n; -- pos = n->pos + n->bits; -- n = tnode_get_child(n, -- tkey_extract_bits(key, -- n->pos, -- n->bits)); -- -- BUG_ON(n && node_parent(n) != tp); -- } else -+ /* This bit of code is a bit tricky but it combines multiple -+ * checks into a single check. The prefix consists of the -+ * prefix plus zeros for the "bits" in the prefix. The index -+ * is the difference between the key and this value. From -+ * this we can actually derive several pieces of data. -+ * if !(index >> bits) -+ * we know the value is child index -+ * else -+ * we have a mismatch in skip bits and failed -+ */ -+ if (index >> n->bits) - break; -- } -- -- /* -- * n ----> NULL, LEAF or TNODE -- * -- * tp is n's (parent) ----> NULL or TNODE -- */ - -- BUG_ON(tp && IS_LEAF(tp)); -- -- /* Case 1: n is a leaf. Compare prefixes */ -- -- if (n != NULL && IS_LEAF(n) && tkey_equals(key, n->key)) { -- li = leaf_info_new(plen); -- -- if (!li) -- return NULL; -+ /* we have found a leaf. Prefixes have already been compared */ -+ if (IS_LEAF(n)) { -+ /* Case 1: n is a leaf, and prefixes match*/ -+ insert_leaf_info(&n->list, li); -+ return fa_head; -+ } - -- fa_head = &li->falh; -- insert_leaf_info(&n->list, li); -- goto done; -+ tp = n; -+ n = rcu_dereference_rtnl(n->child[index]); - } -- l = leaf_new(key); -- -- if (!l) -- return NULL; - -- li = leaf_info_new(plen); -- -- if (!li) { -- node_free(l); -+ l = leaf_new(key); -+ if (!l) { -+ free_leaf_info(li); - return NULL; - } - -- fa_head = &li->falh; - insert_leaf_info(&l->list, li); - -- if (t->trie && n == NULL) { -- /* Case 2: n is NULL, and will just insert a new leaf */ -- -- node_set_parent(l, tp); -- -- cindex = tkey_extract_bits(key, tp->pos, tp->bits); -- put_child(tp, cindex, l); -- } else { -- /* Case 3: n is a LEAF or a TNODE and the key doesn't match. */ -- /* -- * Add a new tnode here -- * first tnode need some special handling -- */ -+ /* Case 2: n is a LEAF or a TNODE and the key doesn't match. -+ * -+ * Add a new tnode here -+ * first tnode need some special handling -+ * leaves us in position for handling as case 3 -+ */ -+ if (n) { -+ struct tnode *tn; -+ int newpos; - -- if (n) { -- pos = tp ? tp->pos+tp->bits : 0; -- newpos = tkey_mismatch(key, pos, n->key); -- tn = tnode_new(n->key, newpos, 1); -- } else { -- newpos = 0; -- tn = tnode_new(key, newpos, 1); /* First tnode */ -- } -+ newpos = KEYLENGTH - __fls(n->key ^ key) - 1; - -+ tn = tnode_new(key, newpos, 1); - if (!tn) { - free_leaf_info(li); - node_free(l); - return NULL; - } - -- node_set_parent(tn, tp); -- -- missbit = tkey_extract_bits(key, newpos, 1); -- put_child(tn, missbit, l); -- put_child(tn, 1-missbit, n); -- -- if (tp) { -- cindex = tkey_extract_bits(key, tp->pos, tp->bits); -- put_child(tp, cindex, tn); -- } else { -- rcu_assign_pointer(t->trie, tn); -- } -+ /* initialize routes out of node */ -+ NODE_INIT_PARENT(tn, tp); -+ put_child(tn, get_index(key, tn) ^ 1, n); -+ -+ /* start adding routes into the node */ -+ put_child_root(tp, t, key, tn); -+ node_set_parent(n, tn); - -+ /* parent now has a NULL spot where the leaf can go */ - tp = tn; - } - -- if (tp && tp->pos + tp->bits > 32) -- pr_warn("fib_trie tp=%p pos=%d, bits=%d, key=%0x plen=%d\n", -- tp, tp->pos, tp->bits, key, plen); -- -- /* Rebalance the trie */ -+ /* Case 3: n is NULL, and will just insert a new leaf */ -+ if (tp) { -+ NODE_INIT_PARENT(l, tp); -+ put_child(tp, get_index(key, tp), l); -+ trie_rebalance(t, tp); -+ } else { -+ rcu_assign_pointer(t->trie, l); -+ } - -- trie_rebalance(t, tp); --done: - return fa_head; - } - -@@ -1470,11 +1416,11 @@ static void trie_leaf_remove(struct trie - pr_debug("entering trie_leaf_remove(%p)\n", l); - - if (tp) { -- t_key cindex = tkey_extract_bits(l->key, tp->pos, tp->bits); -- put_child(tp, cindex, NULL); -+ put_child(tp, get_index(l->key, tp), NULL); - trie_rebalance(t, tp); -- } else -+ } else { - RCU_INIT_POINTER(t->trie, NULL); -+ } - - node_free(l); - } diff --git a/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch b/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch deleted file mode 100644 index a0d34762b..000000000 --- a/target/linux/generic/pending-3.18/080-09-fib_trie-Update-meaning-of-pos-to-represent-unchecke.patch +++ /dev/null @@ -1,346 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:12 -0800 -Subject: [PATCH] fib_trie: Update meaning of pos to represent unchecked - bits - -This change moves the pos value to the other side of the "bits" field. By -doing this it actually simplifies a significant amount of code in the trie. - -For example when halving a tree we know that the bit lost exists at -oldnode->pos, and if we inflate the tree the new bit being add is at -tn->pos. Previously to find those bits you would have to subtract pos and -bits from the keylength or start with a value of (1 << 31) and then shift -that. - -There are a number of spots throughout the code that benefit from this. In -the case of the hot-path searches the main advantage is that we can drop 2 -or more operations from the search path as we no longer need to compute the -value for the index to be shifted by and can instead just use the raw pos -value. - -In addition the tkey_extract_bits is now defunct and can be replaced by -get_index since the two operations were doing the same thing, but now -get_index does it much more quickly as it is only an xor and shift versus a -pair of shifts and a subtraction. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -90,8 +90,7 @@ typedef unsigned int t_key; - #define IS_TNODE(n) ((n)->bits) - #define IS_LEAF(n) (!(n)->bits) - --#define get_shift(_kv) (KEYLENGTH - (_kv)->pos - (_kv)->bits) --#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> get_shift(_kv)) -+#define get_index(_key, _kv) (((_key) ^ (_kv)->key) >> (_kv)->pos) - - struct tnode { - t_key key; -@@ -209,81 +208,64 @@ static inline struct tnode *tnode_get_ch - return rcu_dereference_rtnl(tn->child[i]); - } - --static inline t_key mask_pfx(t_key k, unsigned int l) --{ -- return (l == 0) ? 0 : k >> (KEYLENGTH-l) << (KEYLENGTH-l); --} -- --static inline t_key tkey_extract_bits(t_key a, unsigned int offset, unsigned int bits) --{ -- if (offset < KEYLENGTH) -- return ((t_key)(a << offset)) >> (KEYLENGTH - bits); -- else -- return 0; --} -- --/* -- To understand this stuff, an understanding of keys and all their bits is -- necessary. Every node in the trie has a key associated with it, but not -- all of the bits in that key are significant. -- -- Consider a node 'n' and its parent 'tp'. -- -- If n is a leaf, every bit in its key is significant. Its presence is -- necessitated by path compression, since during a tree traversal (when -- searching for a leaf - unless we are doing an insertion) we will completely -- ignore all skipped bits we encounter. Thus we need to verify, at the end of -- a potentially successful search, that we have indeed been walking the -- correct key path. -- -- Note that we can never "miss" the correct key in the tree if present by -- following the wrong path. Path compression ensures that segments of the key -- that are the same for all keys with a given prefix are skipped, but the -- skipped part *is* identical for each node in the subtrie below the skipped -- bit! trie_insert() in this implementation takes care of that - note the -- call to tkey_sub_equals() in trie_insert(). -- -- if n is an internal node - a 'tnode' here, the various parts of its key -- have many different meanings. -- -- Example: -- _________________________________________________________________ -- | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C | -- ----------------------------------------------------------------- -- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -- -- _________________________________________________________________ -- | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u | -- ----------------------------------------------------------------- -- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 -- -- tp->pos = 7 -- tp->bits = 3 -- n->pos = 15 -- n->bits = 4 -- -- First, let's just ignore the bits that come before the parent tp, that is -- the bits from 0 to (tp->pos-1). They are *known* but at this point we do -- not use them for anything. -- -- The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the -- index into the parent's child array. That is, they will be used to find -- 'n' among tp's children. -- -- The bits from (tp->pos + tp->bits) to (n->pos - 1) - "S" - are skipped bits -- for the node n. -- -- All the bits we have seen so far are significant to the node n. The rest -- of the bits are really not needed or indeed known in n->key. -- -- The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into -- n's child array, and will of course be different for each child. -- -- -- The rest of the bits, from (n->pos + n->bits) onward, are completely unknown -- at this point. -- --*/ -+/* To understand this stuff, an understanding of keys and all their bits is -+ * necessary. Every node in the trie has a key associated with it, but not -+ * all of the bits in that key are significant. -+ * -+ * Consider a node 'n' and its parent 'tp'. -+ * -+ * If n is a leaf, every bit in its key is significant. Its presence is -+ * necessitated by path compression, since during a tree traversal (when -+ * searching for a leaf - unless we are doing an insertion) we will completely -+ * ignore all skipped bits we encounter. Thus we need to verify, at the end of -+ * a potentially successful search, that we have indeed been walking the -+ * correct key path. -+ * -+ * Note that we can never "miss" the correct key in the tree if present by -+ * following the wrong path. Path compression ensures that segments of the key -+ * that are the same for all keys with a given prefix are skipped, but the -+ * skipped part *is* identical for each node in the subtrie below the skipped -+ * bit! trie_insert() in this implementation takes care of that. -+ * -+ * if n is an internal node - a 'tnode' here, the various parts of its key -+ * have many different meanings. -+ * -+ * Example: -+ * _________________________________________________________________ -+ * | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C | -+ * ----------------------------------------------------------------- -+ * 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 -+ * -+ * _________________________________________________________________ -+ * | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u | -+ * ----------------------------------------------------------------- -+ * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 -+ * -+ * tp->pos = 22 -+ * tp->bits = 3 -+ * n->pos = 13 -+ * n->bits = 4 -+ * -+ * First, let's just ignore the bits that come before the parent tp, that is -+ * the bits from (tp->pos + tp->bits) to 31. They are *known* but at this -+ * point we do not use them for anything. -+ * -+ * The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the -+ * index into the parent's child array. That is, they will be used to find -+ * 'n' among tp's children. -+ * -+ * The bits from (n->pos + n->bits) to (tn->pos - 1) - "S" - are skipped bits -+ * for the node n. -+ * -+ * All the bits we have seen so far are significant to the node n. The rest -+ * of the bits are really not needed or indeed known in n->key. -+ * -+ * The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into -+ * n's child array, and will of course be different for each child. -+ * -+ * The rest of the bits, from 0 to (n->pos + n->bits), are completely unknown -+ * at this point. -+ */ - - static const int halve_threshold = 25; - static const int inflate_threshold = 50; -@@ -367,7 +349,7 @@ static struct tnode *leaf_new(t_key key) - * as the nodes are searched - */ - l->key = key; -- l->pos = KEYLENGTH; -+ l->pos = 0; - /* set bits to 0 indicating we are not a tnode */ - l->bits = 0; - -@@ -400,7 +382,7 @@ static struct tnode *tnode_new(t_key key - tn->parent = NULL; - tn->pos = pos; - tn->bits = bits; -- tn->key = mask_pfx(key, pos); -+ tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; - tn->full_children = 0; - tn->empty_children = 1<pos == (tn->pos + tn->bits)); -+ return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); - } - - static inline void put_child(struct tnode *tn, int i, -@@ -641,11 +621,12 @@ static struct tnode *inflate(struct trie - { - int olen = tnode_child_length(oldtnode); - struct tnode *tn; -+ t_key m; - int i; - - pr_debug("In inflate\n"); - -- tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits + 1); -+ tn = tnode_new(oldtnode->key, oldtnode->pos - 1, oldtnode->bits + 1); - - if (!tn) - return ERR_PTR(-ENOMEM); -@@ -656,21 +637,18 @@ static struct tnode *inflate(struct trie - * fails. In case of failure we return the oldnode and inflate - * of tnode is ignored. - */ -+ for (i = 0, m = 1u << tn->pos; i < olen; i++) { -+ struct tnode *inode = tnode_get_child(oldtnode, i); - -- for (i = 0; i < olen; i++) { -- struct tnode *inode; -- -- inode = tnode_get_child(oldtnode, i); -- if (tnode_full(oldtnode, inode) && inode->bits > 1) { -+ if (tnode_full(oldtnode, inode) && (inode->bits > 1)) { - struct tnode *left, *right; -- t_key m = ~0U << (KEYLENGTH - 1) >> inode->pos; - -- left = tnode_new(inode->key&(~m), inode->pos + 1, -+ left = tnode_new(inode->key & ~m, inode->pos, - inode->bits - 1); - if (!left) - goto nomem; - -- right = tnode_new(inode->key|m, inode->pos + 1, -+ right = tnode_new(inode->key | m, inode->pos, - inode->bits - 1); - - if (!right) { -@@ -694,9 +672,7 @@ static struct tnode *inflate(struct trie - - /* A leaf or an internal node with skipped bits */ - if (!tnode_full(oldtnode, inode)) { -- put_child(tn, -- tkey_extract_bits(inode->key, tn->pos, tn->bits), -- inode); -+ put_child(tn, get_index(inode->key, tn), inode); - continue; - } - -@@ -767,7 +743,7 @@ static struct tnode *halve(struct trie * - - pr_debug("In halve\n"); - -- tn = tnode_new(oldtnode->key, oldtnode->pos, oldtnode->bits - 1); -+ tn = tnode_new(oldtnode->key, oldtnode->pos + 1, oldtnode->bits - 1); - - if (!tn) - return ERR_PTR(-ENOMEM); -@@ -787,7 +763,7 @@ static struct tnode *halve(struct trie * - if (left && right) { - struct tnode *newn; - -- newn = tnode_new(left->key, tn->pos + tn->bits, 1); -+ newn = tnode_new(left->key, oldtnode->pos, 1); - - if (!newn) - goto nomem; -@@ -915,7 +891,7 @@ static void trie_rebalance(struct trie * - key = tn->key; - - while (tn != NULL && (tp = node_parent(tn)) != NULL) { -- cindex = tkey_extract_bits(key, tp->pos, tp->bits); -+ cindex = get_index(key, tp); - wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); - tn = resize(t, tn); - -@@ -1005,11 +981,8 @@ static struct list_head *fib_insert_node - */ - if (n) { - struct tnode *tn; -- int newpos; -- -- newpos = KEYLENGTH - __fls(n->key ^ key) - 1; - -- tn = tnode_new(key, newpos, 1); -+ tn = tnode_new(key, __fls(key ^ n->key), 1); - if (!tn) { - free_leaf_info(li); - node_free(l); -@@ -1559,12 +1532,7 @@ static int trie_flush_leaf(struct tnode - static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) - { - do { -- t_key idx; -- -- if (c) -- idx = tkey_extract_bits(c->key, p->pos, p->bits) + 1; -- else -- idx = 0; -+ t_key idx = c ? idx = get_index(c->key, p) + 1 : 0; - - while (idx < 1u << p->bits) { - c = tnode_get_child_rcu(p, idx++); -@@ -1851,7 +1819,7 @@ rescan: - /* Current node exhausted, pop back up */ - p = node_parent_rcu(tn); - if (p) { -- cindex = tkey_extract_bits(tn->key, p->pos, p->bits)+1; -+ cindex = get_index(tn->key, p) + 1; - tn = p; - --iter->depth; - goto rescan; -@@ -2186,10 +2154,10 @@ static int fib_trie_seq_show(struct seq_ - if (IS_TNODE(n)) { - __be32 prf = htonl(n->key); - -- seq_indent(seq, iter->depth - 1); -- seq_printf(seq, " +-- %pI4/%d %d %d %d\n", -- &prf, n->pos, n->bits, n->full_children, -- n->empty_children); -+ seq_indent(seq, iter->depth-1); -+ seq_printf(seq, " +-- %pI4/%zu %u %u %u\n", -+ &prf, KEYLENGTH - n->pos - n->bits, n->bits, -+ n->full_children, n->empty_children); - } else { - struct leaf_info *li; - __be32 val = htonl(n->key); diff --git a/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch b/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch deleted file mode 100644 index 487a25f0d..000000000 --- a/target/linux/generic/pending-3.18/080-10-fib_trie-Use-unsigned-long-for-anything-dealing-with.patch +++ /dev/null @@ -1,186 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:18 -0800 -Subject: [PATCH] fib_trie: Use unsigned long for anything dealing with a - shift by bits - -This change makes it so that anything that can be shifted by, or compared -to a value shifted by bits is updated to be an unsigned long. This is -mostly a precaution against an insanely huge address space that somehow -starts coming close to the 2^32 root node size which would require -something like 1.5 billion addresses. - -I chose unsigned long instead of unsigned long long since I do not believe -it is possible to allocate a 32 bit tnode on a 32 bit system as the memory -consumed would be 16GB + 28B which exceeds the addressible space for any -one process. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -146,8 +146,8 @@ struct trie { - #endif - }; - --static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, -- int wasfull); -+static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, -+ struct tnode *n, int wasfull); - static struct tnode *resize(struct trie *t, struct tnode *tn); - static struct tnode *inflate(struct trie *t, struct tnode *tn); - static struct tnode *halve(struct trie *t, struct tnode *tn); -@@ -183,25 +183,23 @@ static inline void node_set_parent(struc - /* This provides us with the number of children in this node, in the case of a - * leaf this will return 0 meaning none of the children are accessible. - */ --static inline int tnode_child_length(const struct tnode *tn) -+static inline unsigned long tnode_child_length(const struct tnode *tn) - { - return (1ul << tn->bits) & ~(1ul); - } - --/* -- * caller must hold RTNL -- */ --static inline struct tnode *tnode_get_child(const struct tnode *tn, unsigned int i) -+/* caller must hold RTNL */ -+static inline struct tnode *tnode_get_child(const struct tnode *tn, -+ unsigned long i) - { - BUG_ON(i >= tnode_child_length(tn)); - - return rtnl_dereference(tn->child[i]); - } - --/* -- * caller must hold RCU read lock or RTNL -- */ --static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, unsigned int i) -+/* caller must hold RCU read lock or RTNL */ -+static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, -+ unsigned long i) - { - BUG_ON(i >= tnode_child_length(tn)); - -@@ -400,7 +398,7 @@ static inline int tnode_full(const struc - return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); - } - --static inline void put_child(struct tnode *tn, int i, -+static inline void put_child(struct tnode *tn, unsigned long i, - struct tnode *n) - { - tnode_put_child_reorg(tn, i, n, -1); -@@ -411,13 +409,13 @@ static inline void put_child(struct tnod - * Update the value of full_children and empty_children. - */ - --static void tnode_put_child_reorg(struct tnode *tn, int i, struct tnode *n, -- int wasfull) -+static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, -+ struct tnode *n, int wasfull) - { - struct tnode *chi = rtnl_dereference(tn->child[i]); - int isfull; - -- BUG_ON(i >= 1<bits); -+ BUG_ON(i >= tnode_child_length(tn)); - - /* update emptyChildren */ - if (n == NULL && chi != NULL) -@@ -607,10 +605,10 @@ no_children: - static void tnode_clean_free(struct tnode *tn) - { - struct tnode *tofree; -- int i; -+ unsigned long i; - - for (i = 0; i < tnode_child_length(tn); i++) { -- tofree = rtnl_dereference(tn->child[i]); -+ tofree = tnode_get_child(tn, i); - if (tofree) - node_free(tofree); - } -@@ -619,10 +617,10 @@ static void tnode_clean_free(struct tnod - - static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) - { -- int olen = tnode_child_length(oldtnode); -+ unsigned long olen = tnode_child_length(oldtnode); - struct tnode *tn; -+ unsigned long i; - t_key m; -- int i; - - pr_debug("In inflate\n"); - -@@ -664,7 +662,7 @@ static struct tnode *inflate(struct trie - for (i = 0; i < olen; i++) { - struct tnode *inode = tnode_get_child(oldtnode, i); - struct tnode *left, *right; -- int size, j; -+ unsigned long size, j; - - /* An empty child */ - if (inode == NULL) -@@ -737,7 +735,7 @@ nomem: - - static struct tnode *halve(struct trie *t, struct tnode *oldtnode) - { -- int olen = tnode_child_length(oldtnode); -+ unsigned long olen = tnode_child_length(oldtnode); - struct tnode *tn, *left, *right; - int i; - -@@ -1532,9 +1530,9 @@ static int trie_flush_leaf(struct tnode - static struct tnode *leaf_walk_rcu(struct tnode *p, struct tnode *c) - { - do { -- t_key idx = c ? idx = get_index(c->key, p) + 1 : 0; -+ unsigned long idx = c ? idx = get_index(c->key, p) + 1 : 0; - -- while (idx < 1u << p->bits) { -+ while (idx < tnode_child_length(p)) { - c = tnode_get_child_rcu(p, idx++); - if (!c) - continue; -@@ -1786,8 +1784,8 @@ struct fib_trie_iter { - - static struct tnode *fib_trie_get_next(struct fib_trie_iter *iter) - { -+ unsigned long cindex = iter->index; - struct tnode *tn = iter->tnode; -- unsigned int cindex = iter->index; - struct tnode *p; - - /* A single entry routing table */ -@@ -1797,7 +1795,7 @@ static struct tnode *fib_trie_get_next(s - pr_debug("get_next iter={node=%p index=%d depth=%d}\n", - iter->tnode, iter->index, iter->depth); - rescan: -- while (cindex < (1<bits)) { -+ while (cindex < tnode_child_length(tn)) { - struct tnode *n = tnode_get_child_rcu(tn, cindex); - - if (n) { -@@ -1874,15 +1872,16 @@ static void trie_collect_stats(struct tr - hlist_for_each_entry_rcu(li, &n->list, hlist) - ++s->prefixes; - } else { -- int i; -+ unsigned long i; - - s->tnodes++; - if (n->bits < MAX_STAT_DEPTH) - s->nodesizes[n->bits]++; - -- for (i = 0; i < tnode_child_length(n); i++) -+ for (i = 0; i < tnode_child_length(n); i++) { - if (!rcu_access_pointer(n->child[i])) - s->nullpointers++; -+ } - } - } - rcu_read_unlock(); diff --git a/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch b/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch deleted file mode 100644 index 29bec8387..000000000 --- a/target/linux/generic/pending-3.18/080-11-fib_trie-Push-rcu_read_lock-unlock-to-callers.patch +++ /dev/null @@ -1,403 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:24 -0800 -Subject: [PATCH] fib_trie: Push rcu_read_lock/unlock to callers - -This change is to start cleaning up some of the rcu_read_lock/unlock -handling. I realized while reviewing the code there are several spots that -I don't believe are being handled correctly or are masking warnings by -locally calling rcu_read_lock/unlock instead of calling them at the correct -level. - -A common example is a call to fib_get_table followed by fib_table_lookup. -The rcu_read_lock/unlock ought to wrap both but there are several spots where -they were not wrapped. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/include/net/ip_fib.h -+++ b/include/net/ip_fib.h -@@ -222,16 +222,19 @@ static inline struct fib_table *fib_new_ - static inline int fib_lookup(struct net *net, const struct flowi4 *flp, - struct fib_result *res) - { -- struct fib_table *table; -+ int err = -ENETUNREACH; - -- table = fib_get_table(net, RT_TABLE_LOCAL); -- if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF)) -- return 0; -- -- table = fib_get_table(net, RT_TABLE_MAIN); -- if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF)) -- return 0; -- return -ENETUNREACH; -+ rcu_read_lock(); -+ -+ if (!fib_table_lookup(fib_get_table(net, RT_TABLE_LOCAL), flp, res, -+ FIB_LOOKUP_NOREF) || -+ !fib_table_lookup(fib_get_table(net, RT_TABLE_MAIN), flp, res, -+ FIB_LOOKUP_NOREF)) -+ err = 0; -+ -+ rcu_read_unlock(); -+ -+ return err; - } - - #else /* CONFIG_IP_MULTIPLE_TABLES */ -@@ -247,20 +250,25 @@ static inline int fib_lookup(struct net - struct fib_result *res) - { - if (!net->ipv4.fib_has_custom_rules) { -+ int err = -ENETUNREACH; -+ -+ rcu_read_lock(); -+ - res->tclassid = 0; -- if (net->ipv4.fib_local && -- !fib_table_lookup(net->ipv4.fib_local, flp, res, -- FIB_LOOKUP_NOREF)) -- return 0; -- if (net->ipv4.fib_main && -- !fib_table_lookup(net->ipv4.fib_main, flp, res, -- FIB_LOOKUP_NOREF)) -- return 0; -- if (net->ipv4.fib_default && -- !fib_table_lookup(net->ipv4.fib_default, flp, res, -- FIB_LOOKUP_NOREF)) -- return 0; -- return -ENETUNREACH; -+ if ((net->ipv4.fib_local && -+ !fib_table_lookup(net->ipv4.fib_local, flp, res, -+ FIB_LOOKUP_NOREF)) || -+ (net->ipv4.fib_main && -+ !fib_table_lookup(net->ipv4.fib_main, flp, res, -+ FIB_LOOKUP_NOREF)) || -+ (net->ipv4.fib_default && -+ !fib_table_lookup(net->ipv4.fib_default, flp, res, -+ FIB_LOOKUP_NOREF))) -+ err = 0; -+ -+ rcu_read_unlock(); -+ -+ return err; - } - return __fib_lookup(net, flp, res); - } ---- a/net/ipv4/fib_frontend.c -+++ b/net/ipv4/fib_frontend.c -@@ -109,6 +109,7 @@ struct fib_table *fib_new_table(struct n - return tb; - } - -+/* caller must hold either rtnl or rcu read lock */ - struct fib_table *fib_get_table(struct net *net, u32 id) - { - struct fib_table *tb; -@@ -119,15 +120,11 @@ struct fib_table *fib_get_table(struct n - id = RT_TABLE_MAIN; - h = id & (FIB_TABLE_HASHSZ - 1); - -- rcu_read_lock(); - head = &net->ipv4.fib_table_hash[h]; - hlist_for_each_entry_rcu(tb, head, tb_hlist) { -- if (tb->tb_id == id) { -- rcu_read_unlock(); -+ if (tb->tb_id == id) - return tb; -- } - } -- rcu_read_unlock(); - return NULL; - } - #endif /* CONFIG_IP_MULTIPLE_TABLES */ -@@ -167,16 +164,18 @@ static inline unsigned int __inet_dev_ad - if (ipv4_is_multicast(addr)) - return RTN_MULTICAST; - -+ rcu_read_lock(); -+ - local_table = fib_get_table(net, RT_TABLE_LOCAL); - if (local_table) { - ret = RTN_UNICAST; -- rcu_read_lock(); - if (!fib_table_lookup(local_table, &fl4, &res, FIB_LOOKUP_NOREF)) { - if (!dev || dev == res.fi->fib_dev) - ret = res.type; - } -- rcu_read_unlock(); - } -+ -+ rcu_read_unlock(); - return ret; - } - -@@ -923,7 +922,7 @@ no_promotions: - #undef BRD1_OK - } - --static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb) -+static void nl_fib_lookup(struct net *net, struct fib_result_nl *frn) - { - - struct fib_result res; -@@ -933,6 +932,11 @@ static void nl_fib_lookup(struct fib_res - .flowi4_tos = frn->fl_tos, - .flowi4_scope = frn->fl_scope, - }; -+ struct fib_table *tb; -+ -+ rcu_read_lock(); -+ -+ tb = fib_get_table(net, frn->tb_id_in); - - frn->err = -ENOENT; - if (tb) { -@@ -949,6 +953,8 @@ static void nl_fib_lookup(struct fib_res - } - local_bh_enable(); - } -+ -+ rcu_read_unlock(); - } - - static void nl_fib_input(struct sk_buff *skb) -@@ -956,7 +962,6 @@ static void nl_fib_input(struct sk_buff - struct net *net; - struct fib_result_nl *frn; - struct nlmsghdr *nlh; -- struct fib_table *tb; - u32 portid; - - net = sock_net(skb->sk); -@@ -972,9 +977,7 @@ static void nl_fib_input(struct sk_buff - nlh = nlmsg_hdr(skb); - - frn = (struct fib_result_nl *) nlmsg_data(nlh); -- tb = fib_get_table(net, frn->tb_id_in); -- -- nl_fib_lookup(frn, tb); -+ nl_fib_lookup(net, frn); - - portid = NETLINK_CB(skb).portid; /* netlink portid */ - NETLINK_CB(skb).portid = 0; /* from kernel */ ---- a/net/ipv4/fib_rules.c -+++ b/net/ipv4/fib_rules.c -@@ -81,27 +81,25 @@ static int fib4_rule_action(struct fib_r - break; - - case FR_ACT_UNREACHABLE: -- err = -ENETUNREACH; -- goto errout; -+ return -ENETUNREACH; - - case FR_ACT_PROHIBIT: -- err = -EACCES; -- goto errout; -+ return -EACCES; - - case FR_ACT_BLACKHOLE: - default: -- err = -EINVAL; -- goto errout; -+ return -EINVAL; - } - -+ rcu_read_lock(); -+ - tbl = fib_get_table(rule->fr_net, rule->table); -- if (!tbl) -- goto errout; -+ if (tbl) -+ err = fib_table_lookup(tbl, &flp->u.ip4, -+ (struct fib_result *)arg->result, -+ arg->flags); - -- err = fib_table_lookup(tbl, &flp->u.ip4, (struct fib_result *) arg->result, arg->flags); -- if (err > 0) -- err = -EAGAIN; --errout: -+ rcu_read_unlock(); - return err; - } - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -1181,72 +1181,6 @@ err: - return err; - } - --/* should be called with rcu_read_lock */ --static int check_leaf(struct fib_table *tb, struct trie *t, struct tnode *l, -- t_key key, const struct flowi4 *flp, -- struct fib_result *res, int fib_flags) --{ -- struct leaf_info *li; -- struct hlist_head *hhead = &l->list; -- -- hlist_for_each_entry_rcu(li, hhead, hlist) { -- struct fib_alias *fa; -- -- if (l->key != (key & li->mask_plen)) -- continue; -- -- list_for_each_entry_rcu(fa, &li->falh, fa_list) { -- struct fib_info *fi = fa->fa_info; -- int nhsel, err; -- -- if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) -- continue; -- if (fi->fib_dead) -- continue; -- if (fa->fa_info->fib_scope < flp->flowi4_scope) -- continue; -- fib_alias_accessed(fa); -- err = fib_props[fa->fa_type].error; -- if (unlikely(err < 0)) { --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->semantic_match_passed); --#endif -- return err; -- } -- if (fi->fib_flags & RTNH_F_DEAD) -- continue; -- for (nhsel = 0; nhsel < fi->fib_nhs; nhsel++) { -- const struct fib_nh *nh = &fi->fib_nh[nhsel]; -- -- if (nh->nh_flags & RTNH_F_DEAD) -- continue; -- if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif) -- continue; -- --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->semantic_match_passed); --#endif -- res->prefixlen = li->plen; -- res->nh_sel = nhsel; -- res->type = fa->fa_type; -- res->scope = fi->fib_scope; -- res->fi = fi; -- res->table = tb; -- res->fa_head = &li->falh; -- if (!(fib_flags & FIB_LOOKUP_NOREF)) -- atomic_inc(&fi->fib_clntref); -- return 0; -- } -- } -- --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->semantic_match_miss); --#endif -- } -- -- return 1; --} -- - static inline t_key prefix_mismatch(t_key key, struct tnode *n) - { - t_key prefix = n->key; -@@ -1254,6 +1188,7 @@ static inline t_key prefix_mismatch(t_ke - return (key ^ prefix) & (prefix | -prefix); - } - -+/* should be called with rcu_read_lock */ - int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, - struct fib_result *res, int fib_flags) - { -@@ -1263,14 +1198,12 @@ int fib_table_lookup(struct fib_table *t - #endif - const t_key key = ntohl(flp->daddr); - struct tnode *n, *pn; -+ struct leaf_info *li; - t_key cindex; -- int ret = 1; -- -- rcu_read_lock(); - - n = rcu_dereference(t->trie); - if (!n) -- goto failed; -+ return -EAGAIN; - - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(stats->gets); -@@ -1350,7 +1283,7 @@ backtrace: - - pn = node_parent_rcu(pn); - if (unlikely(!pn)) -- goto failed; -+ return -EAGAIN; - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(stats->backtrack); - #endif -@@ -1368,12 +1301,62 @@ backtrace: - - found: - /* Step 3: Process the leaf, if that fails fall back to backtracing */ -- ret = check_leaf(tb, t, n, key, flp, res, fib_flags); -- if (unlikely(ret > 0)) -- goto backtrace; --failed: -- rcu_read_unlock(); -- return ret; -+ hlist_for_each_entry_rcu(li, &n->list, hlist) { -+ struct fib_alias *fa; -+ -+ if ((key ^ n->key) & li->mask_plen) -+ continue; -+ -+ list_for_each_entry_rcu(fa, &li->falh, fa_list) { -+ struct fib_info *fi = fa->fa_info; -+ int nhsel, err; -+ -+ if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) -+ continue; -+ if (fi->fib_dead) -+ continue; -+ if (fa->fa_info->fib_scope < flp->flowi4_scope) -+ continue; -+ fib_alias_accessed(fa); -+ err = fib_props[fa->fa_type].error; -+ if (unlikely(err < 0)) { -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(stats->semantic_match_passed); -+#endif -+ return err; -+ } -+ if (fi->fib_flags & RTNH_F_DEAD) -+ continue; -+ for (nhsel = 0; nhsel < fi->fib_nhs; nhsel++) { -+ const struct fib_nh *nh = &fi->fib_nh[nhsel]; -+ -+ if (nh->nh_flags & RTNH_F_DEAD) -+ continue; -+ if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif) -+ continue; -+ -+ if (!(fib_flags & FIB_LOOKUP_NOREF)) -+ atomic_inc(&fi->fib_clntref); -+ -+ res->prefixlen = li->plen; -+ res->nh_sel = nhsel; -+ res->type = fa->fa_type; -+ res->scope = fi->fib_scope; -+ res->fi = fi; -+ res->table = tb; -+ res->fa_head = &li->falh; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(stats->semantic_match_passed); -+#endif -+ return err; -+ } -+ } -+ -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(stats->semantic_match_miss); -+#endif -+ } -+ goto backtrace; - } - EXPORT_SYMBOL_GPL(fib_table_lookup); - diff --git a/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch b/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch deleted file mode 100644 index a373add1d..000000000 --- a/target/linux/generic/pending-3.18/080-12-fib_trie-Move-resize-to-after-inflate-halve.patch +++ /dev/null @@ -1,345 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:31 -0800 -Subject: [PATCH] fib_trie: Move resize to after inflate/halve - -This change consists of a cut/paste of resize to behind inflate and halve -so that I could remove the two function prototypes. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -149,8 +149,6 @@ struct trie { - static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, - struct tnode *n, int wasfull); - static struct tnode *resize(struct trie *t, struct tnode *tn); --static struct tnode *inflate(struct trie *t, struct tnode *tn); --static struct tnode *halve(struct trie *t, struct tnode *tn); - /* tnodes to free after resize(); protected by RTNL */ - static struct callback_head *tnode_free_head; - static size_t tnode_free_size; -@@ -447,161 +445,6 @@ static void put_child_root(struct tnode - rcu_assign_pointer(t->trie, n); - } - --#define MAX_WORK 10 --static struct tnode *resize(struct trie *t, struct tnode *tn) --{ -- struct tnode *old_tn, *n = NULL; -- int inflate_threshold_use; -- int halve_threshold_use; -- int max_work; -- -- if (!tn) -- return NULL; -- -- pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", -- tn, inflate_threshold, halve_threshold); -- -- /* No children */ -- if (tn->empty_children > (tnode_child_length(tn) - 1)) -- goto no_children; -- -- /* One child */ -- if (tn->empty_children == (tnode_child_length(tn) - 1)) -- goto one_child; -- /* -- * Double as long as the resulting node has a number of -- * nonempty nodes that are above the threshold. -- */ -- -- /* -- * From "Implementing a dynamic compressed trie" by Stefan Nilsson of -- * the Helsinki University of Technology and Matti Tikkanen of Nokia -- * Telecommunications, page 6: -- * "A node is doubled if the ratio of non-empty children to all -- * children in the *doubled* node is at least 'high'." -- * -- * 'high' in this instance is the variable 'inflate_threshold'. It -- * is expressed as a percentage, so we multiply it with -- * tnode_child_length() and instead of multiplying by 2 (since the -- * child array will be doubled by inflate()) and multiplying -- * the left-hand side by 100 (to handle the percentage thing) we -- * multiply the left-hand side by 50. -- * -- * The left-hand side may look a bit weird: tnode_child_length(tn) -- * - tn->empty_children is of course the number of non-null children -- * in the current node. tn->full_children is the number of "full" -- * children, that is non-null tnodes with a skip value of 0. -- * All of those will be doubled in the resulting inflated tnode, so -- * we just count them one extra time here. -- * -- * A clearer way to write this would be: -- * -- * to_be_doubled = tn->full_children; -- * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - -- * tn->full_children; -- * -- * new_child_length = tnode_child_length(tn) * 2; -- * -- * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / -- * new_child_length; -- * if (new_fill_factor >= inflate_threshold) -- * -- * ...and so on, tho it would mess up the while () loop. -- * -- * anyway, -- * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= -- * inflate_threshold -- * -- * avoid a division: -- * 100 * (not_to_be_doubled + 2*to_be_doubled) >= -- * inflate_threshold * new_child_length -- * -- * expand not_to_be_doubled and to_be_doubled, and shorten: -- * 100 * (tnode_child_length(tn) - tn->empty_children + -- * tn->full_children) >= inflate_threshold * new_child_length -- * -- * expand new_child_length: -- * 100 * (tnode_child_length(tn) - tn->empty_children + -- * tn->full_children) >= -- * inflate_threshold * tnode_child_length(tn) * 2 -- * -- * shorten again: -- * 50 * (tn->full_children + tnode_child_length(tn) - -- * tn->empty_children) >= inflate_threshold * -- * tnode_child_length(tn) -- * -- */ -- -- /* Keep root node larger */ -- -- if (!node_parent(tn)) { -- inflate_threshold_use = inflate_threshold_root; -- halve_threshold_use = halve_threshold_root; -- } else { -- inflate_threshold_use = inflate_threshold; -- halve_threshold_use = halve_threshold; -- } -- -- max_work = MAX_WORK; -- while ((tn->full_children > 0 && max_work-- && -- 50 * (tn->full_children + tnode_child_length(tn) -- - tn->empty_children) -- >= inflate_threshold_use * tnode_child_length(tn))) { -- -- old_tn = tn; -- tn = inflate(t, tn); -- -- if (IS_ERR(tn)) { -- tn = old_tn; --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->resize_node_skipped); --#endif -- break; -- } -- } -- -- /* Return if at least one inflate is run */ -- if (max_work != MAX_WORK) -- return tn; -- -- /* -- * Halve as long as the number of empty children in this -- * node is above threshold. -- */ -- -- max_work = MAX_WORK; -- while (tn->bits > 1 && max_work-- && -- 100 * (tnode_child_length(tn) - tn->empty_children) < -- halve_threshold_use * tnode_child_length(tn)) { -- -- old_tn = tn; -- tn = halve(t, tn); -- if (IS_ERR(tn)) { -- tn = old_tn; --#ifdef CONFIG_IP_FIB_TRIE_STATS -- this_cpu_inc(t->stats->resize_node_skipped); --#endif -- break; -- } -- } -- -- -- /* Only one child remains */ -- if (tn->empty_children == (tnode_child_length(tn) - 1)) { -- unsigned long i; --one_child: -- for (i = tnode_child_length(tn); !n && i;) -- n = tnode_get_child(tn, --i); --no_children: -- /* compress one level */ -- node_set_parent(n, NULL); -- tnode_free_safe(tn); -- return n; -- } -- return tn; --} -- -- - static void tnode_clean_free(struct tnode *tn) - { - struct tnode *tofree; -@@ -804,6 +647,160 @@ nomem: - return ERR_PTR(-ENOMEM); - } - -+#define MAX_WORK 10 -+static struct tnode *resize(struct trie *t, struct tnode *tn) -+{ -+ struct tnode *old_tn, *n = NULL; -+ int inflate_threshold_use; -+ int halve_threshold_use; -+ int max_work; -+ -+ if (!tn) -+ return NULL; -+ -+ pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", -+ tn, inflate_threshold, halve_threshold); -+ -+ /* No children */ -+ if (tn->empty_children > (tnode_child_length(tn) - 1)) -+ goto no_children; -+ -+ /* One child */ -+ if (tn->empty_children == (tnode_child_length(tn) - 1)) -+ goto one_child; -+ /* -+ * Double as long as the resulting node has a number of -+ * nonempty nodes that are above the threshold. -+ */ -+ -+ /* -+ * From "Implementing a dynamic compressed trie" by Stefan Nilsson of -+ * the Helsinki University of Technology and Matti Tikkanen of Nokia -+ * Telecommunications, page 6: -+ * "A node is doubled if the ratio of non-empty children to all -+ * children in the *doubled* node is at least 'high'." -+ * -+ * 'high' in this instance is the variable 'inflate_threshold'. It -+ * is expressed as a percentage, so we multiply it with -+ * tnode_child_length() and instead of multiplying by 2 (since the -+ * child array will be doubled by inflate()) and multiplying -+ * the left-hand side by 100 (to handle the percentage thing) we -+ * multiply the left-hand side by 50. -+ * -+ * The left-hand side may look a bit weird: tnode_child_length(tn) -+ * - tn->empty_children is of course the number of non-null children -+ * in the current node. tn->full_children is the number of "full" -+ * children, that is non-null tnodes with a skip value of 0. -+ * All of those will be doubled in the resulting inflated tnode, so -+ * we just count them one extra time here. -+ * -+ * A clearer way to write this would be: -+ * -+ * to_be_doubled = tn->full_children; -+ * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - -+ * tn->full_children; -+ * -+ * new_child_length = tnode_child_length(tn) * 2; -+ * -+ * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / -+ * new_child_length; -+ * if (new_fill_factor >= inflate_threshold) -+ * -+ * ...and so on, tho it would mess up the while () loop. -+ * -+ * anyway, -+ * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= -+ * inflate_threshold -+ * -+ * avoid a division: -+ * 100 * (not_to_be_doubled + 2*to_be_doubled) >= -+ * inflate_threshold * new_child_length -+ * -+ * expand not_to_be_doubled and to_be_doubled, and shorten: -+ * 100 * (tnode_child_length(tn) - tn->empty_children + -+ * tn->full_children) >= inflate_threshold * new_child_length -+ * -+ * expand new_child_length: -+ * 100 * (tnode_child_length(tn) - tn->empty_children + -+ * tn->full_children) >= -+ * inflate_threshold * tnode_child_length(tn) * 2 -+ * -+ * shorten again: -+ * 50 * (tn->full_children + tnode_child_length(tn) - -+ * tn->empty_children) >= inflate_threshold * -+ * tnode_child_length(tn) -+ * -+ */ -+ -+ /* Keep root node larger */ -+ -+ if (!node_parent(tn)) { -+ inflate_threshold_use = inflate_threshold_root; -+ halve_threshold_use = halve_threshold_root; -+ } else { -+ inflate_threshold_use = inflate_threshold; -+ halve_threshold_use = halve_threshold; -+ } -+ -+ max_work = MAX_WORK; -+ while ((tn->full_children > 0 && max_work-- && -+ 50 * (tn->full_children + tnode_child_length(tn) -+ - tn->empty_children) -+ >= inflate_threshold_use * tnode_child_length(tn))) { -+ -+ old_tn = tn; -+ tn = inflate(t, tn); -+ -+ if (IS_ERR(tn)) { -+ tn = old_tn; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(t->stats->resize_node_skipped); -+#endif -+ break; -+ } -+ } -+ -+ /* Return if at least one inflate is run */ -+ if (max_work != MAX_WORK) -+ return tn; -+ -+ /* -+ * Halve as long as the number of empty children in this -+ * node is above threshold. -+ */ -+ -+ max_work = MAX_WORK; -+ while (tn->bits > 1 && max_work-- && -+ 100 * (tnode_child_length(tn) - tn->empty_children) < -+ halve_threshold_use * tnode_child_length(tn)) { -+ -+ old_tn = tn; -+ tn = halve(t, tn); -+ if (IS_ERR(tn)) { -+ tn = old_tn; -+#ifdef CONFIG_IP_FIB_TRIE_STATS -+ this_cpu_inc(t->stats->resize_node_skipped); -+#endif -+ break; -+ } -+ } -+ -+ -+ /* Only one child remains */ -+ if (tn->empty_children == (tnode_child_length(tn) - 1)) { -+ unsigned long i; -+one_child: -+ for (i = tnode_child_length(tn); !n && i;) -+ n = tnode_get_child(tn, --i); -+no_children: -+ /* compress one level */ -+ node_set_parent(n, NULL); -+ tnode_free_safe(tn); -+ return n; -+ } -+ return tn; -+} -+ - /* readside must use rcu_read_lock currently dump routines - via get_fa_head and dump */ - diff --git a/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch b/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch deleted file mode 100644 index c01d57af0..000000000 --- a/target/linux/generic/pending-3.18/080-13-fib_trie-Add-functions-should_inflate-and-should_hal.patch +++ /dev/null @@ -1,250 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:37 -0800 -Subject: [PATCH] fib_trie: Add functions should_inflate and should_halve - -This change pulls the logic for if we should inflate/halve the nodes out -into separate functions. It also addresses what I believe is a bug where 1 -full node is all that is needed to keep a node from ever being halved. - -Simple script to reproduce the issue: - modprobe dummy; ifconfig dummy0 up - for i in `seq 0 255`; do ifconfig dummy0:$i 10.0.${i}.1/24 up; done - ifconfig dummy0:256 10.0.255.33/16 up - for i in `seq 0 254`; do ifconfig dummy0:$i down; done - -Results from /proc/net/fib_triestat -Before: - Local: - Aver depth: 3.00 - Max depth: 4 - Leaves: 17 - Prefixes: 18 - Internal nodes: 11 - 1: 8 2: 2 10: 1 - Pointers: 1048 - Null ptrs: 1021 - Total size: 11 kB -After: - Local: - Aver depth: 3.41 - Max depth: 5 - Leaves: 17 - Prefixes: 18 - Internal nodes: 12 - 1: 8 2: 3 3: 1 - Pointers: 36 - Null ptrs: 8 - Total size: 3 kB - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -647,12 +647,94 @@ nomem: - return ERR_PTR(-ENOMEM); - } - -+/* From "Implementing a dynamic compressed trie" by Stefan Nilsson of -+ * the Helsinki University of Technology and Matti Tikkanen of Nokia -+ * Telecommunications, page 6: -+ * "A node is doubled if the ratio of non-empty children to all -+ * children in the *doubled* node is at least 'high'." -+ * -+ * 'high' in this instance is the variable 'inflate_threshold'. It -+ * is expressed as a percentage, so we multiply it with -+ * tnode_child_length() and instead of multiplying by 2 (since the -+ * child array will be doubled by inflate()) and multiplying -+ * the left-hand side by 100 (to handle the percentage thing) we -+ * multiply the left-hand side by 50. -+ * -+ * The left-hand side may look a bit weird: tnode_child_length(tn) -+ * - tn->empty_children is of course the number of non-null children -+ * in the current node. tn->full_children is the number of "full" -+ * children, that is non-null tnodes with a skip value of 0. -+ * All of those will be doubled in the resulting inflated tnode, so -+ * we just count them one extra time here. -+ * -+ * A clearer way to write this would be: -+ * -+ * to_be_doubled = tn->full_children; -+ * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - -+ * tn->full_children; -+ * -+ * new_child_length = tnode_child_length(tn) * 2; -+ * -+ * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / -+ * new_child_length; -+ * if (new_fill_factor >= inflate_threshold) -+ * -+ * ...and so on, tho it would mess up the while () loop. -+ * -+ * anyway, -+ * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= -+ * inflate_threshold -+ * -+ * avoid a division: -+ * 100 * (not_to_be_doubled + 2*to_be_doubled) >= -+ * inflate_threshold * new_child_length -+ * -+ * expand not_to_be_doubled and to_be_doubled, and shorten: -+ * 100 * (tnode_child_length(tn) - tn->empty_children + -+ * tn->full_children) >= inflate_threshold * new_child_length -+ * -+ * expand new_child_length: -+ * 100 * (tnode_child_length(tn) - tn->empty_children + -+ * tn->full_children) >= -+ * inflate_threshold * tnode_child_length(tn) * 2 -+ * -+ * shorten again: -+ * 50 * (tn->full_children + tnode_child_length(tn) - -+ * tn->empty_children) >= inflate_threshold * -+ * tnode_child_length(tn) -+ * -+ */ -+static bool should_inflate(const struct tnode *tn) -+{ -+ unsigned long used = tnode_child_length(tn); -+ unsigned long threshold = used; -+ -+ /* Keep root node larger */ -+ threshold *= node_parent(tn) ? inflate_threshold : -+ inflate_threshold_root; -+ used += tn->full_children; -+ used -= tn->empty_children; -+ -+ return tn->pos && ((50 * used) >= threshold); -+} -+ -+static bool should_halve(const struct tnode *tn) -+{ -+ unsigned long used = tnode_child_length(tn); -+ unsigned long threshold = used; -+ -+ /* Keep root node larger */ -+ threshold *= node_parent(tn) ? halve_threshold : -+ halve_threshold_root; -+ used -= tn->empty_children; -+ -+ return (tn->bits > 1) && ((100 * used) < threshold); -+} -+ - #define MAX_WORK 10 - static struct tnode *resize(struct trie *t, struct tnode *tn) - { - struct tnode *old_tn, *n = NULL; -- int inflate_threshold_use; -- int halve_threshold_use; - int max_work; - - if (!tn) -@@ -668,86 +750,12 @@ static struct tnode *resize(struct trie - /* One child */ - if (tn->empty_children == (tnode_child_length(tn) - 1)) - goto one_child; -- /* -- * Double as long as the resulting node has a number of -- * nonempty nodes that are above the threshold. -- */ - -- /* -- * From "Implementing a dynamic compressed trie" by Stefan Nilsson of -- * the Helsinki University of Technology and Matti Tikkanen of Nokia -- * Telecommunications, page 6: -- * "A node is doubled if the ratio of non-empty children to all -- * children in the *doubled* node is at least 'high'." -- * -- * 'high' in this instance is the variable 'inflate_threshold'. It -- * is expressed as a percentage, so we multiply it with -- * tnode_child_length() and instead of multiplying by 2 (since the -- * child array will be doubled by inflate()) and multiplying -- * the left-hand side by 100 (to handle the percentage thing) we -- * multiply the left-hand side by 50. -- * -- * The left-hand side may look a bit weird: tnode_child_length(tn) -- * - tn->empty_children is of course the number of non-null children -- * in the current node. tn->full_children is the number of "full" -- * children, that is non-null tnodes with a skip value of 0. -- * All of those will be doubled in the resulting inflated tnode, so -- * we just count them one extra time here. -- * -- * A clearer way to write this would be: -- * -- * to_be_doubled = tn->full_children; -- * not_to_be_doubled = tnode_child_length(tn) - tn->empty_children - -- * tn->full_children; -- * -- * new_child_length = tnode_child_length(tn) * 2; -- * -- * new_fill_factor = 100 * (not_to_be_doubled + 2*to_be_doubled) / -- * new_child_length; -- * if (new_fill_factor >= inflate_threshold) -- * -- * ...and so on, tho it would mess up the while () loop. -- * -- * anyway, -- * 100 * (not_to_be_doubled + 2*to_be_doubled) / new_child_length >= -- * inflate_threshold -- * -- * avoid a division: -- * 100 * (not_to_be_doubled + 2*to_be_doubled) >= -- * inflate_threshold * new_child_length -- * -- * expand not_to_be_doubled and to_be_doubled, and shorten: -- * 100 * (tnode_child_length(tn) - tn->empty_children + -- * tn->full_children) >= inflate_threshold * new_child_length -- * -- * expand new_child_length: -- * 100 * (tnode_child_length(tn) - tn->empty_children + -- * tn->full_children) >= -- * inflate_threshold * tnode_child_length(tn) * 2 -- * -- * shorten again: -- * 50 * (tn->full_children + tnode_child_length(tn) - -- * tn->empty_children) >= inflate_threshold * -- * tnode_child_length(tn) -- * -+ /* Double as long as the resulting node has a number of -+ * nonempty nodes that are above the threshold. - */ -- -- /* Keep root node larger */ -- -- if (!node_parent(tn)) { -- inflate_threshold_use = inflate_threshold_root; -- halve_threshold_use = halve_threshold_root; -- } else { -- inflate_threshold_use = inflate_threshold; -- halve_threshold_use = halve_threshold; -- } -- - max_work = MAX_WORK; -- while ((tn->full_children > 0 && max_work-- && -- 50 * (tn->full_children + tnode_child_length(tn) -- - tn->empty_children) -- >= inflate_threshold_use * tnode_child_length(tn))) { -- -+ while (should_inflate(tn) && max_work--) { - old_tn = tn; - tn = inflate(t, tn); - -@@ -764,16 +772,11 @@ static struct tnode *resize(struct trie - if (max_work != MAX_WORK) - return tn; - -- /* -- * Halve as long as the number of empty children in this -+ /* Halve as long as the number of empty children in this - * node is above threshold. - */ -- - max_work = MAX_WORK; -- while (tn->bits > 1 && max_work-- && -- 100 * (tnode_child_length(tn) - tn->empty_children) < -- halve_threshold_use * tnode_child_length(tn)) { -- -+ while (should_halve(tn) && max_work--) { - old_tn = tn; - tn = halve(t, tn); - if (IS_ERR(tn)) { diff --git a/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch b/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch deleted file mode 100644 index 8f26e32d3..000000000 --- a/target/linux/generic/pending-3.18/080-14-fib_trie-Push-assignment-of-child-to-parent-down-int.patch +++ /dev/null @@ -1,336 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:43 -0800 -Subject: [PATCH] fib_trie: Push assignment of child to parent down into - inflate/halve - -This change makes it so that the assignment of the tnode to the parent is -handled directly within whatever function is currently handling the node be -it inflate, halve, or resize. By doing this we can avoid some of the need -to set NULL pointers in the tree while we are resizing the subnodes. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -146,9 +146,7 @@ struct trie { - #endif - }; - --static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, -- struct tnode *n, int wasfull); --static struct tnode *resize(struct trie *t, struct tnode *tn); -+static void resize(struct trie *t, struct tnode *tn); - /* tnodes to free after resize(); protected by RTNL */ - static struct callback_head *tnode_free_head; - static size_t tnode_free_size; -@@ -396,22 +394,13 @@ static inline int tnode_full(const struc - return n && ((n->pos + n->bits) == tn->pos) && IS_TNODE(n); - } - --static inline void put_child(struct tnode *tn, unsigned long i, -- struct tnode *n) --{ -- tnode_put_child_reorg(tn, i, n, -1); --} -- -- /* -- * Add a child at position i overwriting the old value. -- * Update the value of full_children and empty_children. -- */ -- --static void tnode_put_child_reorg(struct tnode *tn, unsigned long i, -- struct tnode *n, int wasfull) -+/* Add a child at position i overwriting the old value. -+ * Update the value of full_children and empty_children. -+ */ -+static void put_child(struct tnode *tn, unsigned long i, struct tnode *n) - { - struct tnode *chi = rtnl_dereference(tn->child[i]); -- int isfull; -+ int isfull, wasfull; - - BUG_ON(i >= tnode_child_length(tn)); - -@@ -422,10 +411,9 @@ static void tnode_put_child_reorg(struct - tn->empty_children--; - - /* update fullChildren */ -- if (wasfull == -1) -- wasfull = tnode_full(tn, chi); -- -+ wasfull = tnode_full(tn, chi); - isfull = tnode_full(tn, n); -+ - if (wasfull && !isfull) - tn->full_children--; - else if (!wasfull && isfull) -@@ -458,9 +446,10 @@ static void tnode_clean_free(struct tnod - node_free(tn); - } - --static struct tnode *inflate(struct trie *t, struct tnode *oldtnode) -+static int inflate(struct trie *t, struct tnode *oldtnode) - { - unsigned long olen = tnode_child_length(oldtnode); -+ struct tnode *tp = node_parent(oldtnode); - struct tnode *tn; - unsigned long i; - t_key m; -@@ -468,9 +457,8 @@ static struct tnode *inflate(struct trie - pr_debug("In inflate\n"); - - tn = tnode_new(oldtnode->key, oldtnode->pos - 1, oldtnode->bits + 1); -- - if (!tn) -- return ERR_PTR(-ENOMEM); -+ return -ENOMEM; - - /* - * Preallocate and store tnodes before the actual work so we -@@ -564,30 +552,36 @@ static struct tnode *inflate(struct trie - put_child(left, j, rtnl_dereference(inode->child[j])); - put_child(right, j, rtnl_dereference(inode->child[j + size])); - } -- put_child(tn, 2*i, resize(t, left)); -- put_child(tn, 2*i+1, resize(t, right)); -+ -+ put_child(tn, 2 * i, left); -+ put_child(tn, 2 * i + 1, right); - - tnode_free_safe(inode); -+ -+ resize(t, left); -+ resize(t, right); - } -+ -+ put_child_root(tp, t, tn->key, tn); - tnode_free_safe(oldtnode); -- return tn; -+ return 0; - nomem: - tnode_clean_free(tn); -- return ERR_PTR(-ENOMEM); -+ return -ENOMEM; - } - --static struct tnode *halve(struct trie *t, struct tnode *oldtnode) -+static int halve(struct trie *t, struct tnode *oldtnode) - { - unsigned long olen = tnode_child_length(oldtnode); -+ struct tnode *tp = node_parent(oldtnode); - struct tnode *tn, *left, *right; - int i; - - pr_debug("In halve\n"); - - tn = tnode_new(oldtnode->key, oldtnode->pos + 1, oldtnode->bits - 1); -- - if (!tn) -- return ERR_PTR(-ENOMEM); -+ return -ENOMEM; - - /* - * Preallocate and store tnodes before the actual work so we -@@ -606,8 +600,10 @@ static struct tnode *halve(struct trie * - - newn = tnode_new(left->key, oldtnode->pos, 1); - -- if (!newn) -- goto nomem; -+ if (!newn) { -+ tnode_clean_free(tn); -+ return -ENOMEM; -+ } - - put_child(tn, i/2, newn); - } -@@ -635,16 +631,18 @@ static struct tnode *halve(struct trie * - - /* Two nonempty children */ - newBinNode = tnode_get_child(tn, i/2); -- put_child(tn, i/2, NULL); - put_child(newBinNode, 0, left); - put_child(newBinNode, 1, right); -- put_child(tn, i/2, resize(t, newBinNode)); -+ -+ put_child(tn, i / 2, newBinNode); -+ -+ resize(t, newBinNode); - } -+ -+ put_child_root(tp, t, tn->key, tn); - tnode_free_safe(oldtnode); -- return tn; --nomem: -- tnode_clean_free(tn); -- return ERR_PTR(-ENOMEM); -+ -+ return 0; - } - - /* From "Implementing a dynamic compressed trie" by Stefan Nilsson of -@@ -704,45 +702,48 @@ nomem: - * tnode_child_length(tn) - * - */ --static bool should_inflate(const struct tnode *tn) -+static bool should_inflate(const struct tnode *tp, const struct tnode *tn) - { - unsigned long used = tnode_child_length(tn); - unsigned long threshold = used; - - /* Keep root node larger */ -- threshold *= node_parent(tn) ? inflate_threshold : -- inflate_threshold_root; -+ threshold *= tp ? inflate_threshold : inflate_threshold_root; - used += tn->full_children; - used -= tn->empty_children; - - return tn->pos && ((50 * used) >= threshold); - } - --static bool should_halve(const struct tnode *tn) -+static bool should_halve(const struct tnode *tp, const struct tnode *tn) - { - unsigned long used = tnode_child_length(tn); - unsigned long threshold = used; - - /* Keep root node larger */ -- threshold *= node_parent(tn) ? halve_threshold : -- halve_threshold_root; -+ threshold *= tp ? halve_threshold : halve_threshold_root; - used -= tn->empty_children; - - return (tn->bits > 1) && ((100 * used) < threshold); - } - - #define MAX_WORK 10 --static struct tnode *resize(struct trie *t, struct tnode *tn) -+static void resize(struct trie *t, struct tnode *tn) - { -- struct tnode *old_tn, *n = NULL; -+ struct tnode *tp = node_parent(tn), *n = NULL; -+ struct tnode __rcu **cptr; - int max_work; - -- if (!tn) -- return NULL; -- - pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", - tn, inflate_threshold, halve_threshold); - -+ /* track the tnode via the pointer from the parent instead of -+ * doing it ourselves. This way we can let RCU fully do its -+ * thing without us interfering -+ */ -+ cptr = tp ? &tp->child[get_index(tn->key, tp)] : &t->trie; -+ BUG_ON(tn != rtnl_dereference(*cptr)); -+ - /* No children */ - if (tn->empty_children > (tnode_child_length(tn) - 1)) - goto no_children; -@@ -755,39 +756,35 @@ static struct tnode *resize(struct trie - * nonempty nodes that are above the threshold. - */ - max_work = MAX_WORK; -- while (should_inflate(tn) && max_work--) { -- old_tn = tn; -- tn = inflate(t, tn); -- -- if (IS_ERR(tn)) { -- tn = old_tn; -+ while (should_inflate(tp, tn) && max_work--) { -+ if (inflate(t, tn)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->resize_node_skipped); - #endif - break; - } -+ -+ tn = rtnl_dereference(*cptr); - } - - /* Return if at least one inflate is run */ - if (max_work != MAX_WORK) -- return tn; -+ return; - - /* Halve as long as the number of empty children in this - * node is above threshold. - */ - max_work = MAX_WORK; -- while (should_halve(tn) && max_work--) { -- old_tn = tn; -- tn = halve(t, tn); -- if (IS_ERR(tn)) { -- tn = old_tn; -+ while (should_halve(tp, tn) && max_work--) { -+ if (halve(t, tn)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->resize_node_skipped); - #endif - break; - } -- } - -+ tn = rtnl_dereference(*cptr); -+ } - - /* Only one child remains */ - if (tn->empty_children == (tnode_child_length(tn) - 1)) { -@@ -797,11 +794,12 @@ one_child: - n = tnode_get_child(tn, --i); - no_children: - /* compress one level */ -- node_set_parent(n, NULL); -+ put_child_root(tp, t, tn->key, n); -+ node_set_parent(n, tp); -+ -+ /* drop dead node */ - tnode_free_safe(tn); -- return n; - } -- return tn; - } - - /* readside must use rcu_read_lock currently dump routines -@@ -882,34 +880,19 @@ static struct tnode *fib_find_node(struc - - static void trie_rebalance(struct trie *t, struct tnode *tn) - { -- int wasfull; -- t_key cindex, key; - struct tnode *tp; - -- key = tn->key; -- -- while (tn != NULL && (tp = node_parent(tn)) != NULL) { -- cindex = get_index(key, tp); -- wasfull = tnode_full(tp, tnode_get_child(tp, cindex)); -- tn = resize(t, tn); -- -- tnode_put_child_reorg(tp, cindex, tn, wasfull); -- -- tp = node_parent(tn); -- if (!tp) -- rcu_assign_pointer(t->trie, tn); -+ while ((tp = node_parent(tn)) != NULL) { -+ resize(t, tn); - - tnode_free_flush(); -- if (!tp) -- break; - tn = tp; - } - - /* Handle last (top) tnode */ - if (IS_TNODE(tn)) -- tn = resize(t, tn); -+ resize(t, tn); - -- rcu_assign_pointer(t->trie, tn); - tnode_free_flush(); - } - diff --git a/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch b/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch deleted file mode 100644 index 51178a0f1..000000000 --- a/target/linux/generic/pending-3.18/080-15-fib_trie-Push-tnode-flushing-down-to-inflate-halve.patch +++ /dev/null @@ -1,237 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:49 -0800 -Subject: [PATCH] fib_trie: Push tnode flushing down to inflate/halve - -This change pushes the tnode freeing down into the inflate and halve -functions. It makes more sense here as we have a better grasp of what is -going on and when a given cluster of nodes is ready to be freed. - -I believe this may address a bug in the freeing logic as well. For some -reason if the freelist got to a certain size we would call -synchronize_rcu(). I'm assuming that what they meant to do is call -synchronize_rcu() after they had handed off that much memory via -call_rcu(). As such that is what I have updated the behavior to be. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -147,8 +147,6 @@ struct trie { - }; - - static void resize(struct trie *t, struct tnode *tn); --/* tnodes to free after resize(); protected by RTNL */ --static struct callback_head *tnode_free_head; - static size_t tnode_free_size; - - /* -@@ -307,32 +305,6 @@ static struct tnode *tnode_alloc(size_t - return vzalloc(size); - } - --static void tnode_free_safe(struct tnode *tn) --{ -- BUG_ON(IS_LEAF(tn)); -- tn->rcu.next = tnode_free_head; -- tnode_free_head = &tn->rcu; --} -- --static void tnode_free_flush(void) --{ -- struct callback_head *head; -- -- while ((head = tnode_free_head)) { -- struct tnode *tn = container_of(head, struct tnode, rcu); -- -- tnode_free_head = head->next; -- tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); -- -- node_free(tn); -- } -- -- if (tnode_free_size >= PAGE_SIZE * sync_pages) { -- tnode_free_size = 0; -- synchronize_rcu(); -- } --} -- - static struct tnode *leaf_new(t_key key) - { - struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); -@@ -433,17 +405,33 @@ static void put_child_root(struct tnode - rcu_assign_pointer(t->trie, n); - } - --static void tnode_clean_free(struct tnode *tn) -+static inline void tnode_free_init(struct tnode *tn) - { -- struct tnode *tofree; -- unsigned long i; -+ tn->rcu.next = NULL; -+} -+ -+static inline void tnode_free_append(struct tnode *tn, struct tnode *n) -+{ -+ n->rcu.next = tn->rcu.next; -+ tn->rcu.next = &n->rcu; -+} - -- for (i = 0; i < tnode_child_length(tn); i++) { -- tofree = tnode_get_child(tn, i); -- if (tofree) -- node_free(tofree); -+static void tnode_free(struct tnode *tn) -+{ -+ struct callback_head *head = &tn->rcu; -+ -+ while (head) { -+ head = head->next; -+ tnode_free_size += offsetof(struct tnode, child[1 << tn->bits]); -+ node_free(tn); -+ -+ tn = container_of(head, struct tnode, rcu); -+ } -+ -+ if (tnode_free_size >= PAGE_SIZE * sync_pages) { -+ tnode_free_size = 0; -+ synchronize_rcu(); - } -- node_free(tn); - } - - static int inflate(struct trie *t, struct tnode *oldtnode) -@@ -476,20 +464,23 @@ static int inflate(struct trie *t, struc - inode->bits - 1); - if (!left) - goto nomem; -+ tnode_free_append(tn, left); - - right = tnode_new(inode->key | m, inode->pos, - inode->bits - 1); - -- if (!right) { -- node_free(left); -+ if (!right) - goto nomem; -- } -+ tnode_free_append(tn, right); - - put_child(tn, 2*i, left); - put_child(tn, 2*i+1, right); - } - } - -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); -+ - for (i = 0; i < olen; i++) { - struct tnode *inode = tnode_get_child(oldtnode, i); - struct tnode *left, *right; -@@ -505,12 +496,13 @@ static int inflate(struct trie *t, struc - continue; - } - -+ /* drop the node in the old tnode free list */ -+ tnode_free_append(oldtnode, inode); -+ - /* An internal node with two children */ - if (inode->bits == 1) { - put_child(tn, 2*i, rtnl_dereference(inode->child[0])); - put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); -- -- tnode_free_safe(inode); - continue; - } - -@@ -556,17 +548,19 @@ static int inflate(struct trie *t, struc - put_child(tn, 2 * i, left); - put_child(tn, 2 * i + 1, right); - -- tnode_free_safe(inode); -- -+ /* resize child nodes */ - resize(t, left); - resize(t, right); - } - - put_child_root(tp, t, tn->key, tn); -- tnode_free_safe(oldtnode); -+ -+ /* we completed without error, prepare to free old node */ -+ tnode_free(oldtnode); - return 0; - nomem: -- tnode_clean_free(tn); -+ /* all pointers should be clean so we are done */ -+ tnode_free(tn); - return -ENOMEM; - } - -@@ -599,17 +593,20 @@ static int halve(struct trie *t, struct - struct tnode *newn; - - newn = tnode_new(left->key, oldtnode->pos, 1); -- - if (!newn) { -- tnode_clean_free(tn); -+ tnode_free(tn); - return -ENOMEM; - } -+ tnode_free_append(tn, newn); - - put_child(tn, i/2, newn); - } - - } - -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); -+ - for (i = 0; i < olen; i += 2) { - struct tnode *newBinNode; - -@@ -636,11 +633,14 @@ static int halve(struct trie *t, struct - - put_child(tn, i / 2, newBinNode); - -+ /* resize child node */ - resize(t, newBinNode); - } - - put_child_root(tp, t, tn->key, tn); -- tnode_free_safe(oldtnode); -+ -+ /* all pointers should be clean so we are done */ -+ tnode_free(oldtnode); - - return 0; - } -@@ -798,7 +798,8 @@ no_children: - node_set_parent(n, tp); - - /* drop dead node */ -- tnode_free_safe(tn); -+ tnode_free_init(tn); -+ tnode_free(tn); - } - } - -@@ -884,16 +885,12 @@ static void trie_rebalance(struct trie * - - while ((tp = node_parent(tn)) != NULL) { - resize(t, tn); -- -- tnode_free_flush(); - tn = tp; - } - - /* Handle last (top) tnode */ - if (IS_TNODE(tn)) - resize(t, tn); -- -- tnode_free_flush(); - } - - /* only used from updater-side */ diff --git a/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch b/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch deleted file mode 100644 index d6b600c5d..000000000 --- a/target/linux/generic/pending-3.18/080-16-fib_trie-inflate-halve-nodes-in-a-more-RCU-friendly-.patch +++ /dev/null @@ -1,345 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:56:55 -0800 -Subject: [PATCH] fib_trie: inflate/halve nodes in a more RCU friendly - way - -This change pulls the node_set_parent functionality out of put_child_reorg -and instead leaves that to the function to take care of as well. By doing -this we can fully construct the new cluster of tnodes and all of the -pointers out of it before we start routing pointers into it. - -I am suspecting this will likely fix some concurency issues though I don't -have a good test to show as such. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -391,8 +391,6 @@ static void put_child(struct tnode *tn, - else if (!wasfull && isfull) - tn->full_children++; - -- node_set_parent(n, tn); -- - rcu_assign_pointer(tn->child[i], n); - } - -@@ -436,10 +434,8 @@ static void tnode_free(struct tnode *tn) - - static int inflate(struct trie *t, struct tnode *oldtnode) - { -- unsigned long olen = tnode_child_length(oldtnode); -- struct tnode *tp = node_parent(oldtnode); -- struct tnode *tn; -- unsigned long i; -+ struct tnode *inode, *node0, *node1, *tn, *tp; -+ unsigned long i, j, k; - t_key m; - - pr_debug("In inflate\n"); -@@ -448,43 +444,13 @@ static int inflate(struct trie *t, struc - if (!tn) - return -ENOMEM; - -- /* -- * Preallocate and store tnodes before the actual work so we -- * don't get into an inconsistent state if memory allocation -- * fails. In case of failure we return the oldnode and inflate -- * of tnode is ignored. -+ /* Assemble all of the pointers in our cluster, in this case that -+ * represents all of the pointers out of our allocated nodes that -+ * point to existing tnodes and the links between our allocated -+ * nodes. - */ -- for (i = 0, m = 1u << tn->pos; i < olen; i++) { -- struct tnode *inode = tnode_get_child(oldtnode, i); -- -- if (tnode_full(oldtnode, inode) && (inode->bits > 1)) { -- struct tnode *left, *right; -- -- left = tnode_new(inode->key & ~m, inode->pos, -- inode->bits - 1); -- if (!left) -- goto nomem; -- tnode_free_append(tn, left); -- -- right = tnode_new(inode->key | m, inode->pos, -- inode->bits - 1); -- -- if (!right) -- goto nomem; -- tnode_free_append(tn, right); -- -- put_child(tn, 2*i, left); -- put_child(tn, 2*i+1, right); -- } -- } -- -- /* prepare oldtnode to be freed */ -- tnode_free_init(oldtnode); -- -- for (i = 0; i < olen; i++) { -- struct tnode *inode = tnode_get_child(oldtnode, i); -- struct tnode *left, *right; -- unsigned long size, j; -+ for (i = tnode_child_length(oldtnode), m = 1u << tn->pos; i;) { -+ inode = tnode_get_child(oldtnode, --i); - - /* An empty child */ - if (inode == NULL) -@@ -496,65 +462,99 @@ static int inflate(struct trie *t, struc - continue; - } - -- /* drop the node in the old tnode free list */ -- tnode_free_append(oldtnode, inode); -- - /* An internal node with two children */ - if (inode->bits == 1) { -- put_child(tn, 2*i, rtnl_dereference(inode->child[0])); -- put_child(tn, 2*i+1, rtnl_dereference(inode->child[1])); -+ put_child(tn, 2 * i + 1, tnode_get_child(inode, 1)); -+ put_child(tn, 2 * i, tnode_get_child(inode, 0)); - continue; - } - -- /* An internal node with more than two children */ -- - /* We will replace this node 'inode' with two new -- * ones, 'left' and 'right', each with half of the -+ * ones, 'node0' and 'node1', each with half of the - * original children. The two new nodes will have - * a position one bit further down the key and this - * means that the "significant" part of their keys - * (see the discussion near the top of this file) - * will differ by one bit, which will be "0" in -- * left's key and "1" in right's key. Since we are -+ * node0's key and "1" in node1's key. Since we are - * moving the key position by one step, the bit that - * we are moving away from - the bit at position -- * (inode->pos) - is the one that will differ between -- * left and right. So... we synthesize that bit in the -- * two new keys. -- * The mask 'm' below will be a single "one" bit at -- * the position (inode->pos) -+ * (tn->pos) - is the one that will differ between -+ * node0 and node1. So... we synthesize that bit in the -+ * two new keys. - */ -+ node1 = tnode_new(inode->key | m, inode->pos, inode->bits - 1); -+ if (!node1) -+ goto nomem; -+ tnode_free_append(tn, node1); -+ -+ node0 = tnode_new(inode->key & ~m, inode->pos, inode->bits - 1); -+ if (!node0) -+ goto nomem; -+ tnode_free_append(tn, node0); -+ -+ /* populate child pointers in new nodes */ -+ for (k = tnode_child_length(inode), j = k / 2; j;) { -+ put_child(node1, --j, tnode_get_child(inode, --k)); -+ put_child(node0, j, tnode_get_child(inode, j)); -+ put_child(node1, --j, tnode_get_child(inode, --k)); -+ put_child(node0, j, tnode_get_child(inode, j)); -+ } -+ -+ /* link new nodes to parent */ -+ NODE_INIT_PARENT(node1, tn); -+ NODE_INIT_PARENT(node0, tn); -+ -+ /* link parent to nodes */ -+ put_child(tn, 2 * i + 1, node1); -+ put_child(tn, 2 * i, node0); -+ } -+ -+ /* setup the parent pointer into and out of this node */ -+ tp = node_parent(oldtnode); -+ NODE_INIT_PARENT(tn, tp); -+ put_child_root(tp, t, tn->key, tn); - -- /* Use the old key, but set the new significant -- * bit to zero. -- */ -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); - -- left = tnode_get_child(tn, 2*i); -- put_child(tn, 2*i, NULL); -+ /* update all child nodes parent pointers to route to us */ -+ for (i = tnode_child_length(oldtnode); i;) { -+ inode = tnode_get_child(oldtnode, --i); - -- BUG_ON(!left); -+ /* A leaf or an internal node with skipped bits */ -+ if (!tnode_full(oldtnode, inode)) { -+ node_set_parent(inode, tn); -+ continue; -+ } - -- right = tnode_get_child(tn, 2*i+1); -- put_child(tn, 2*i+1, NULL); -+ /* drop the node in the old tnode free list */ -+ tnode_free_append(oldtnode, inode); - -- BUG_ON(!right); -+ /* fetch new nodes */ -+ node1 = tnode_get_child(tn, 2 * i + 1); -+ node0 = tnode_get_child(tn, 2 * i); - -- size = tnode_child_length(left); -- for (j = 0; j < size; j++) { -- put_child(left, j, rtnl_dereference(inode->child[j])); -- put_child(right, j, rtnl_dereference(inode->child[j + size])); -+ /* bits == 1 then node0 and node1 represent inode's children */ -+ if (inode->bits == 1) { -+ node_set_parent(node1, tn); -+ node_set_parent(node0, tn); -+ continue; - } - -- put_child(tn, 2 * i, left); -- put_child(tn, 2 * i + 1, right); -+ /* update parent pointers in child node's children */ -+ for (k = tnode_child_length(inode), j = k / 2; j;) { -+ node_set_parent(tnode_get_child(inode, --k), node1); -+ node_set_parent(tnode_get_child(inode, --j), node0); -+ node_set_parent(tnode_get_child(inode, --k), node1); -+ node_set_parent(tnode_get_child(inode, --j), node0); -+ } - - /* resize child nodes */ -- resize(t, left); -- resize(t, right); -+ resize(t, node1); -+ resize(t, node0); - } - -- put_child_root(tp, t, tn->key, tn); -- - /* we completed without error, prepare to free old node */ - tnode_free(oldtnode); - return 0; -@@ -566,10 +566,8 @@ nomem: - - static int halve(struct trie *t, struct tnode *oldtnode) - { -- unsigned long olen = tnode_child_length(oldtnode); -- struct tnode *tp = node_parent(oldtnode); -- struct tnode *tn, *left, *right; -- int i; -+ struct tnode *tn, *tp, *inode, *node0, *node1; -+ unsigned long i; - - pr_debug("In halve\n"); - -@@ -577,68 +575,64 @@ static int halve(struct trie *t, struct - if (!tn) - return -ENOMEM; - -- /* -- * Preallocate and store tnodes before the actual work so we -- * don't get into an inconsistent state if memory allocation -- * fails. In case of failure we return the oldnode and halve -- * of tnode is ignored. -+ /* Assemble all of the pointers in our cluster, in this case that -+ * represents all of the pointers out of our allocated nodes that -+ * point to existing tnodes and the links between our allocated -+ * nodes. - */ -+ for (i = tnode_child_length(oldtnode); i;) { -+ node1 = tnode_get_child(oldtnode, --i); -+ node0 = tnode_get_child(oldtnode, --i); - -- for (i = 0; i < olen; i += 2) { -- left = tnode_get_child(oldtnode, i); -- right = tnode_get_child(oldtnode, i+1); -+ /* At least one of the children is empty */ -+ if (!node1 || !node0) { -+ put_child(tn, i / 2, node1 ? : node0); -+ continue; -+ } - - /* Two nonempty children */ -- if (left && right) { -- struct tnode *newn; -- -- newn = tnode_new(left->key, oldtnode->pos, 1); -- if (!newn) { -- tnode_free(tn); -- return -ENOMEM; -- } -- tnode_free_append(tn, newn); -- -- put_child(tn, i/2, newn); -+ inode = tnode_new(node0->key, oldtnode->pos, 1); -+ if (!inode) { -+ tnode_free(tn); -+ return -ENOMEM; - } -+ tnode_free_append(tn, inode); - -+ /* initialize pointers out of node */ -+ put_child(inode, 1, node1); -+ put_child(inode, 0, node0); -+ NODE_INIT_PARENT(inode, tn); -+ -+ /* link parent to node */ -+ put_child(tn, i / 2, inode); - } - -+ /* setup the parent pointer out of and back into this node */ -+ tp = node_parent(oldtnode); -+ NODE_INIT_PARENT(tn, tp); -+ put_child_root(tp, t, tn->key, tn); -+ - /* prepare oldtnode to be freed */ - tnode_free_init(oldtnode); - -- for (i = 0; i < olen; i += 2) { -- struct tnode *newBinNode; -- -- left = tnode_get_child(oldtnode, i); -- right = tnode_get_child(oldtnode, i+1); -- -- /* At least one of the children is empty */ -- if (left == NULL) { -- if (right == NULL) /* Both are empty */ -- continue; -- put_child(tn, i/2, right); -- continue; -- } -- -- if (right == NULL) { -- put_child(tn, i/2, left); -+ /* update all of the child parent pointers */ -+ for (i = tnode_child_length(tn); i;) { -+ inode = tnode_get_child(tn, --i); -+ -+ /* only new tnodes will be considered "full" nodes */ -+ if (!tnode_full(tn, inode)) { -+ node_set_parent(inode, tn); - continue; - } - - /* Two nonempty children */ -- newBinNode = tnode_get_child(tn, i/2); -- put_child(newBinNode, 0, left); -- put_child(newBinNode, 1, right); -- -- put_child(tn, i / 2, newBinNode); -+ node_set_parent(tnode_get_child(inode, 1), inode); -+ node_set_parent(tnode_get_child(inode, 0), inode); - - /* resize child node */ -- resize(t, newBinNode); -+ resize(t, inode); - } - -- put_child_root(tp, t, tn->key, tn); -- - /* all pointers should be clean so we are done */ - tnode_free(oldtnode); - diff --git a/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch b/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch deleted file mode 100644 index 8f7c671ac..000000000 --- a/target/linux/generic/pending-3.18/080-17-fib_trie-Remove-checks-for-index-tnode_child_length-.patch +++ /dev/null @@ -1,95 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:57:02 -0800 -Subject: [PATCH] fib_trie: Remove checks for index >= tnode_child_length - from tnode_get_child - -For some reason the compiler doesn't seem to understand that when we are in -a loop that runs from tnode_child_length - 1 to 0 we don't expect the value -of tn->bits to change. As such every call to tnode_get_child was rerunning -tnode_chile_length which ended up consuming quite a bit of space in the -resultant assembly code. - -I have gone though and verified that in all cases where tnode_get_child -is used we are either winding though a fixed loop from tnode_child_length - -1 to 0, or are in a fastpath case where we are verifying the value by -either checking for any remaining bits after shifting index by bits and -testing for leaf, or by using tnode_child_length. - -size net/ipv4/fib_trie.o -Before: - text data bss dec hex filename - 15506 376 8 15890 3e12 net/ipv4/fib_trie.o - -After: - text data bss dec hex filename - 14827 376 8 15211 3b6b net/ipv4/fib_trie.o - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -186,8 +186,6 @@ static inline unsigned long tnode_child_ - static inline struct tnode *tnode_get_child(const struct tnode *tn, - unsigned long i) - { -- BUG_ON(i >= tnode_child_length(tn)); -- - return rtnl_dereference(tn->child[i]); - } - -@@ -195,8 +193,6 @@ static inline struct tnode *tnode_get_ch - static inline struct tnode *tnode_get_child_rcu(const struct tnode *tn, - unsigned long i) - { -- BUG_ON(i >= tnode_child_length(tn)); -- - return rcu_dereference_rtnl(tn->child[i]); - } - -@@ -371,7 +367,7 @@ static inline int tnode_full(const struc - */ - static void put_child(struct tnode *tn, unsigned long i, struct tnode *n) - { -- struct tnode *chi = rtnl_dereference(tn->child[i]); -+ struct tnode *chi = tnode_get_child(tn, i); - int isfull, wasfull; - - BUG_ON(i >= tnode_child_length(tn)); -@@ -867,7 +863,7 @@ static struct tnode *fib_find_node(struc - if (IS_LEAF(n)) - break; - -- n = rcu_dereference_rtnl(n->child[index]); -+ n = tnode_get_child_rcu(n, index); - } - - return n; -@@ -934,7 +930,7 @@ static struct list_head *fib_insert_node - } - - tp = n; -- n = rcu_dereference_rtnl(n->child[index]); -+ n = tnode_get_child_rcu(n, index); - } - - l = leaf_new(key); -@@ -1215,7 +1211,7 @@ int fib_table_lookup(struct fib_table *t - cindex = index; - } - -- n = rcu_dereference(n->child[index]); -+ n = tnode_get_child_rcu(n, index); - if (unlikely(!n)) - goto backtrace; - } -@@ -1835,7 +1831,7 @@ static void trie_collect_stats(struct tr - if (n->bits < MAX_STAT_DEPTH) - s->nodesizes[n->bits]++; - -- for (i = 0; i < tnode_child_length(n); i++) { -+ for (i = tnode_child_length(n); i--;) { - if (!rcu_access_pointer(n->child[i])) - s->nullpointers++; - } diff --git a/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch b/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch deleted file mode 100644 index 6a4a45e95..000000000 --- a/target/linux/generic/pending-3.18/080-18-fib_trie-Add-tracking-value-for-suffix-length.patch +++ /dev/null @@ -1,234 +0,0 @@ -From: Alexander Duyck -Date: Wed, 31 Dec 2014 10:57:08 -0800 -Subject: [PATCH] fib_trie: Add tracking value for suffix length - -This change adds a tracking value for the maximum suffix length of all -prefixes stored in any given tnode. With this value we can determine if we -need to backtrace or not based on if the suffix is greater than the pos -value. - -By doing this we can reduce the CPU overhead for lookups in the local table -as many of the prefixes there are 32b long and have a suffix length of 0 -meaning we can immediately backtrace to the root node without needing to -test any of the nodes between it and where we ended up. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -96,6 +96,7 @@ struct tnode { - t_key key; - unsigned char bits; /* 2log(KEYLENGTH) bits needed */ - unsigned char pos; /* 2log(KEYLENGTH) bits needed */ -+ unsigned char slen; - struct tnode __rcu *parent; - struct rcu_head rcu; - union { -@@ -311,6 +312,7 @@ static struct tnode *leaf_new(t_key key) - * as the nodes are searched - */ - l->key = key; -+ l->slen = 0; - l->pos = 0; - /* set bits to 0 indicating we are not a tnode */ - l->bits = 0; -@@ -342,6 +344,7 @@ static struct tnode *tnode_new(t_key key - - if (tn) { - tn->parent = NULL; -+ tn->slen = pos; - tn->pos = pos; - tn->bits = bits; - tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; -@@ -387,6 +390,9 @@ static void put_child(struct tnode *tn, - else if (!wasfull && isfull) - tn->full_children++; - -+ if (n && (tn->slen < n->slen)) -+ tn->slen = n->slen; -+ - rcu_assign_pointer(tn->child[i], n); - } - -@@ -635,6 +641,41 @@ static int halve(struct trie *t, struct - return 0; - } - -+static unsigned char update_suffix(struct tnode *tn) -+{ -+ unsigned char slen = tn->pos; -+ unsigned long stride, i; -+ -+ /* search though the list of children looking for nodes that might -+ * have a suffix greater than the one we currently have. This is -+ * why we start with a stride of 2 since a stride of 1 would -+ * represent the nodes with suffix length equal to tn->pos -+ */ -+ for (i = 0, stride = 0x2ul ; i < tnode_child_length(tn); i += stride) { -+ struct tnode *n = tnode_get_child(tn, i); -+ -+ if (!n || (n->slen <= slen)) -+ continue; -+ -+ /* update stride and slen based on new value */ -+ stride <<= (n->slen - slen); -+ slen = n->slen; -+ i &= ~(stride - 1); -+ -+ /* if slen covers all but the last bit we can stop here -+ * there will be nothing longer than that since only node -+ * 0 and 1 << (bits - 1) could have that as their suffix -+ * length. -+ */ -+ if ((slen + 1) >= (tn->pos + tn->bits)) -+ break; -+ } -+ -+ tn->slen = slen; -+ -+ return slen; -+} -+ - /* From "Implementing a dynamic compressed trie" by Stefan Nilsson of - * the Helsinki University of Technology and Matti Tikkanen of Nokia - * Telecommunications, page 6: -@@ -790,6 +831,19 @@ no_children: - /* drop dead node */ - tnode_free_init(tn); - tnode_free(tn); -+ return; -+ } -+ -+ /* Return if at least one deflate was run */ -+ if (max_work != MAX_WORK) -+ return; -+ -+ /* push the suffix length to the parent node */ -+ if (tn->slen > tn->pos) { -+ unsigned char slen = update_suffix(tn); -+ -+ if (tp && (slen > tp->slen)) -+ tp->slen = slen; - } - } - -@@ -818,8 +872,58 @@ static inline struct list_head *get_fa_h - return &li->falh; - } - --static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new) -+static void leaf_pull_suffix(struct tnode *l) -+{ -+ struct tnode *tp = node_parent(l); -+ -+ while (tp && (tp->slen > tp->pos) && (tp->slen > l->slen)) { -+ if (update_suffix(tp) > l->slen) -+ break; -+ tp = node_parent(tp); -+ } -+} -+ -+static void leaf_push_suffix(struct tnode *l) -+{ -+ struct tnode *tn = node_parent(l); -+ -+ /* if this is a new leaf then tn will be NULL and we can sort -+ * out parent suffix lengths as a part of trie_rebalance -+ */ -+ while (tn && (tn->slen < l->slen)) { -+ tn->slen = l->slen; -+ tn = node_parent(tn); -+ } -+} -+ -+static void remove_leaf_info(struct tnode *l, struct leaf_info *old) -+{ -+ struct hlist_node *prev; -+ -+ /* record the location of the pointer to this object */ -+ prev = rtnl_dereference(hlist_pprev_rcu(&old->hlist)); -+ -+ /* remove the leaf info from the list */ -+ hlist_del_rcu(&old->hlist); -+ -+ /* if we emptied the list this leaf will be freed and we can sort -+ * out parent suffix lengths as a part of trie_rebalance -+ */ -+ if (hlist_empty(&l->list)) -+ return; -+ -+ /* if we removed the tail then we need to update slen */ -+ if (!rcu_access_pointer(hlist_next_rcu(prev))) { -+ struct leaf_info *li = hlist_entry(prev, typeof(*li), hlist); -+ -+ l->slen = KEYLENGTH - li->plen; -+ leaf_pull_suffix(l); -+ } -+} -+ -+static void insert_leaf_info(struct tnode *l, struct leaf_info *new) - { -+ struct hlist_head *head = &l->list; - struct leaf_info *li = NULL, *last = NULL; - - if (hlist_empty(head)) { -@@ -836,6 +940,12 @@ static void insert_leaf_info(struct hlis - else - hlist_add_before_rcu(&new->hlist, &li->hlist); - } -+ -+ /* if we added to the tail node then we need to update slen */ -+ if (!rcu_access_pointer(hlist_next_rcu(&new->hlist))) { -+ l->slen = KEYLENGTH - new->plen; -+ leaf_push_suffix(l); -+ } - } - - /* rcu_read_lock needs to be hold by caller from readside */ -@@ -925,7 +1035,7 @@ static struct list_head *fib_insert_node - /* we have found a leaf. Prefixes have already been compared */ - if (IS_LEAF(n)) { - /* Case 1: n is a leaf, and prefixes match*/ -- insert_leaf_info(&n->list, li); -+ insert_leaf_info(n, li); - return fa_head; - } - -@@ -939,7 +1049,7 @@ static struct list_head *fib_insert_node - return NULL; - } - -- insert_leaf_info(&l->list, li); -+ insert_leaf_info(l, li); - - /* Case 2: n is a LEAF or a TNODE and the key doesn't match. - * -@@ -1206,7 +1316,7 @@ int fib_table_lookup(struct fib_table *t - /* only record pn and cindex if we are going to be chopping - * bits later. Otherwise we are just wasting cycles. - */ -- if (index) { -+ if (n->slen > n->pos) { - pn = n; - cindex = index; - } -@@ -1225,7 +1335,7 @@ int fib_table_lookup(struct fib_table *t - * between the key and the prefix exist in the region of - * the lsb and higher in the prefix. - */ -- if (unlikely(prefix_mismatch(key, n))) -+ if (unlikely(prefix_mismatch(key, n)) || (n->slen == n->pos)) - goto backtrace; - - /* exit out and process leaf */ -@@ -1425,7 +1535,7 @@ int fib_table_delete(struct fib_table *t - tb->tb_num_default--; - - if (list_empty(fa_head)) { -- hlist_del_rcu(&li->hlist); -+ remove_leaf_info(l, li); - free_leaf_info(li); - } - diff --git a/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch b/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch deleted file mode 100644 index d5fc11256..000000000 --- a/target/linux/generic/pending-3.18/080-19-fib_trie-Use-index-0ul-n-bits-instead-of-index-n-bit.patch +++ /dev/null @@ -1,52 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:08 -0800 -Subject: [PATCH] fib_trie: Use index & (~0ul << n->bits) instead of index >> - n->bits - -In doing performance testing and analysis of the changes I recently found -that by shifting the index I had created an unnecessary dependency. - -I have updated the code so that we instead shift a mask by bits and then -just test against that as that should save us about 2 CPU cycles since we -can generate the mask while the key and pos are being processed. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -961,12 +961,12 @@ static struct tnode *fib_find_node(struc - * prefix plus zeros for the bits in the cindex. The index - * is the difference between the key and this value. From - * this we can actually derive several pieces of data. -- * if !(index >> bits) -- * we know the value is cindex -- * else -+ * if (index & (~0ul << bits)) - * we have a mismatch in skip bits and failed -+ * else -+ * we know the value is cindex - */ -- if (index >> n->bits) -+ if (index & (~0ul << n->bits)) - return NULL; - - /* we have found a leaf. Prefixes have already been compared */ -@@ -1301,12 +1301,12 @@ int fib_table_lookup(struct fib_table *t - * prefix plus zeros for the "bits" in the prefix. The index - * is the difference between the key and this value. From - * this we can actually derive several pieces of data. -- * if !(index >> bits) -- * we know the value is child index -- * else -+ * if (index & (~0ul << bits)) - * we have a mismatch in skip bits and failed -+ * else -+ * we know the value is cindex - */ -- if (index >> n->bits) -+ if (index & (~0ul << n->bits)) - break; - - /* we have found a leaf. Prefixes have already been compared */ diff --git a/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch b/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch deleted file mode 100644 index 7e2612708..000000000 --- a/target/linux/generic/pending-3.18/080-20-fib_trie-Fix-RCU-bug-and-merge-similar-bits-of-infla.patch +++ /dev/null @@ -1,267 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:14 -0800 -Subject: [PATCH] fib_trie: Fix RCU bug and merge similar bits of inflate/halve - -This patch addresses two issues. - -The first issue is the fact that I believe I had the RCU freeing sequence -slightly out of order. As a result we could get into an issue if a caller -went into a child of a child of the new node, then backtraced into the to be -freed parent, and then attempted to access a child of a child that may have -been consumed in a resize of one of the new nodes children. To resolve this I -have moved the resize after we have freed the oldtnode. The only side effect -of this is that we will now be calling resize on more nodes in the case of -inflate due to the fact that we don't have a good way to test to see if a -full_tnode on the new node was there before or after the allocation. This -should have minimal impact however since the node should already be -correctly size so it is just the cost of calling should_inflate that we -will be taking on the node which is only a couple of cycles. - -The second issue is the fact that inflate and halve were essentially doing -the same thing after the new node was added to the trie replacing the old -one. As such it wasn't really necessary to keep the code in both functions -so I have split it out into two other functions, called replace and -update_children. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -396,8 +396,30 @@ static void put_child(struct tnode *tn, - rcu_assign_pointer(tn->child[i], n); - } - --static void put_child_root(struct tnode *tp, struct trie *t, -- t_key key, struct tnode *n) -+static void update_children(struct tnode *tn) -+{ -+ unsigned long i; -+ -+ /* update all of the child parent pointers */ -+ for (i = tnode_child_length(tn); i;) { -+ struct tnode *inode = tnode_get_child(tn, --i); -+ -+ if (!inode) -+ continue; -+ -+ /* Either update the children of a tnode that -+ * already belongs to us or update the child -+ * to point to ourselves. -+ */ -+ if (node_parent(inode) == tn) -+ update_children(inode); -+ else -+ node_set_parent(inode, tn); -+ } -+} -+ -+static inline void put_child_root(struct tnode *tp, struct trie *t, -+ t_key key, struct tnode *n) - { - if (tp) - put_child(tp, get_index(key, tp), n); -@@ -434,10 +456,35 @@ static void tnode_free(struct tnode *tn) - } - } - -+static void replace(struct trie *t, struct tnode *oldtnode, struct tnode *tn) -+{ -+ struct tnode *tp = node_parent(oldtnode); -+ unsigned long i; -+ -+ /* setup the parent pointer out of and back into this node */ -+ NODE_INIT_PARENT(tn, tp); -+ put_child_root(tp, t, tn->key, tn); -+ -+ /* update all of the child parent pointers */ -+ update_children(tn); -+ -+ /* all pointers should be clean so we are done */ -+ tnode_free(oldtnode); -+ -+ /* resize children now that oldtnode is freed */ -+ for (i = tnode_child_length(tn); i;) { -+ struct tnode *inode = tnode_get_child(tn, --i); -+ -+ /* resize child node */ -+ if (tnode_full(tn, inode)) -+ resize(t, inode); -+ } -+} -+ - static int inflate(struct trie *t, struct tnode *oldtnode) - { -- struct tnode *inode, *node0, *node1, *tn, *tp; -- unsigned long i, j, k; -+ struct tnode *tn; -+ unsigned long i; - t_key m; - - pr_debug("In inflate\n"); -@@ -446,13 +493,18 @@ static int inflate(struct trie *t, struc - if (!tn) - return -ENOMEM; - -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); -+ - /* Assemble all of the pointers in our cluster, in this case that - * represents all of the pointers out of our allocated nodes that - * point to existing tnodes and the links between our allocated - * nodes. - */ - for (i = tnode_child_length(oldtnode), m = 1u << tn->pos; i;) { -- inode = tnode_get_child(oldtnode, --i); -+ struct tnode *inode = tnode_get_child(oldtnode, --i); -+ struct tnode *node0, *node1; -+ unsigned long j, k; - - /* An empty child */ - if (inode == NULL) -@@ -464,6 +516,9 @@ static int inflate(struct trie *t, struc - continue; - } - -+ /* drop the node in the old tnode free list */ -+ tnode_free_append(oldtnode, inode); -+ - /* An internal node with two children */ - if (inode->bits == 1) { - put_child(tn, 2 * i + 1, tnode_get_child(inode, 1)); -@@ -488,9 +543,9 @@ static int inflate(struct trie *t, struc - node1 = tnode_new(inode->key | m, inode->pos, inode->bits - 1); - if (!node1) - goto nomem; -- tnode_free_append(tn, node1); -+ node0 = tnode_new(inode->key, inode->pos, inode->bits - 1); - -- node0 = tnode_new(inode->key & ~m, inode->pos, inode->bits - 1); -+ tnode_free_append(tn, node1); - if (!node0) - goto nomem; - tnode_free_append(tn, node0); -@@ -512,53 +567,9 @@ static int inflate(struct trie *t, struc - put_child(tn, 2 * i, node0); - } - -- /* setup the parent pointer into and out of this node */ -- tp = node_parent(oldtnode); -- NODE_INIT_PARENT(tn, tp); -- put_child_root(tp, t, tn->key, tn); -+ /* setup the parent pointers into and out of this node */ -+ replace(t, oldtnode, tn); - -- /* prepare oldtnode to be freed */ -- tnode_free_init(oldtnode); -- -- /* update all child nodes parent pointers to route to us */ -- for (i = tnode_child_length(oldtnode); i;) { -- inode = tnode_get_child(oldtnode, --i); -- -- /* A leaf or an internal node with skipped bits */ -- if (!tnode_full(oldtnode, inode)) { -- node_set_parent(inode, tn); -- continue; -- } -- -- /* drop the node in the old tnode free list */ -- tnode_free_append(oldtnode, inode); -- -- /* fetch new nodes */ -- node1 = tnode_get_child(tn, 2 * i + 1); -- node0 = tnode_get_child(tn, 2 * i); -- -- /* bits == 1 then node0 and node1 represent inode's children */ -- if (inode->bits == 1) { -- node_set_parent(node1, tn); -- node_set_parent(node0, tn); -- continue; -- } -- -- /* update parent pointers in child node's children */ -- for (k = tnode_child_length(inode), j = k / 2; j;) { -- node_set_parent(tnode_get_child(inode, --k), node1); -- node_set_parent(tnode_get_child(inode, --j), node0); -- node_set_parent(tnode_get_child(inode, --k), node1); -- node_set_parent(tnode_get_child(inode, --j), node0); -- } -- -- /* resize child nodes */ -- resize(t, node1); -- resize(t, node0); -- } -- -- /* we completed without error, prepare to free old node */ -- tnode_free(oldtnode); - return 0; - nomem: - /* all pointers should be clean so we are done */ -@@ -568,7 +579,7 @@ nomem: - - static int halve(struct trie *t, struct tnode *oldtnode) - { -- struct tnode *tn, *tp, *inode, *node0, *node1; -+ struct tnode *tn; - unsigned long i; - - pr_debug("In halve\n"); -@@ -577,14 +588,18 @@ static int halve(struct trie *t, struct - if (!tn) - return -ENOMEM; - -+ /* prepare oldtnode to be freed */ -+ tnode_free_init(oldtnode); -+ - /* Assemble all of the pointers in our cluster, in this case that - * represents all of the pointers out of our allocated nodes that - * point to existing tnodes and the links between our allocated - * nodes. - */ - for (i = tnode_child_length(oldtnode); i;) { -- node1 = tnode_get_child(oldtnode, --i); -- node0 = tnode_get_child(oldtnode, --i); -+ struct tnode *node1 = tnode_get_child(oldtnode, --i); -+ struct tnode *node0 = tnode_get_child(oldtnode, --i); -+ struct tnode *inode; - - /* At least one of the children is empty */ - if (!node1 || !node0) { -@@ -609,34 +624,8 @@ static int halve(struct trie *t, struct - put_child(tn, i / 2, inode); - } - -- /* setup the parent pointer out of and back into this node */ -- tp = node_parent(oldtnode); -- NODE_INIT_PARENT(tn, tp); -- put_child_root(tp, t, tn->key, tn); -- -- /* prepare oldtnode to be freed */ -- tnode_free_init(oldtnode); -- -- /* update all of the child parent pointers */ -- for (i = tnode_child_length(tn); i;) { -- inode = tnode_get_child(tn, --i); -- -- /* only new tnodes will be considered "full" nodes */ -- if (!tnode_full(tn, inode)) { -- node_set_parent(inode, tn); -- continue; -- } -- -- /* Two nonempty children */ -- node_set_parent(tnode_get_child(inode, 1), inode); -- node_set_parent(tnode_get_child(inode, 0), inode); -- -- /* resize child node */ -- resize(t, inode); -- } -- -- /* all pointers should be clean so we are done */ -- tnode_free(oldtnode); -+ /* setup the parent pointers into and out of this node */ -+ replace(t, oldtnode, tn); - - return 0; - } diff --git a/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch b/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch deleted file mode 100644 index 058b33bf9..000000000 --- a/target/linux/generic/pending-3.18/080-21-fib_trie-Fall-back-to-slen-update-on-inflate-halve-f.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:20 -0800 -Subject: [PATCH] fib_trie: Fall back to slen update on inflate/halve failure - -This change corrects an issue where if inflate or halve fails we were -exiting the resize function without at least updating the slen for the -node. To correct this I have moved the update of max_size into the while -loop so that it is only decremented on a successful call to either inflate -or halve. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -752,7 +752,7 @@ static void resize(struct trie *t, struc - { - struct tnode *tp = node_parent(tn), *n = NULL; - struct tnode __rcu **cptr; -- int max_work; -+ int max_work = MAX_WORK; - - pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", - tn, inflate_threshold, halve_threshold); -@@ -775,8 +775,7 @@ static void resize(struct trie *t, struc - /* Double as long as the resulting node has a number of - * nonempty nodes that are above the threshold. - */ -- max_work = MAX_WORK; -- while (should_inflate(tp, tn) && max_work--) { -+ while (should_inflate(tp, tn) && max_work) { - if (inflate(t, tn)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->resize_node_skipped); -@@ -784,6 +783,7 @@ static void resize(struct trie *t, struc - break; - } - -+ max_work--; - tn = rtnl_dereference(*cptr); - } - -@@ -794,8 +794,7 @@ static void resize(struct trie *t, struc - /* Halve as long as the number of empty children in this - * node is above threshold. - */ -- max_work = MAX_WORK; -- while (should_halve(tp, tn) && max_work--) { -+ while (should_halve(tp, tn) && max_work) { - if (halve(t, tn)) { - #ifdef CONFIG_IP_FIB_TRIE_STATS - this_cpu_inc(t->stats->resize_node_skipped); -@@ -803,6 +802,7 @@ static void resize(struct trie *t, struc - break; - } - -+ max_work--; - tn = rtnl_dereference(*cptr); - } - diff --git a/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch b/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch deleted file mode 100644 index 19b7db7f9..000000000 --- a/target/linux/generic/pending-3.18/080-22-fib_trie-Add-collapse-and-should_collapse-to-resize.patch +++ /dev/null @@ -1,206 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:26 -0800 -Subject: [PATCH] fib_trie: Add collapse() and should_collapse() to resize - -This patch really does two things. - -First it pulls the logic for determining if we should collapse one node out -of the tree and the actual code doing the collapse into a separate pair of -functions. This helps to make the changes to these areas more readable. - -Second it encodes the upper 32b of the empty_children value onto the -full_children value in the case of bits == KEYLENGTH. By doing this we are -able to handle the case of a 32b node where empty_children would appear to -be 0 when it was actually 1ul << 32. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -83,7 +83,8 @@ - - #define MAX_STAT_DEPTH 32 - --#define KEYLENGTH (8*sizeof(t_key)) -+#define KEYLENGTH (8*sizeof(t_key)) -+#define KEY_MAX ((t_key)~0) - - typedef unsigned int t_key; - -@@ -102,8 +103,8 @@ struct tnode { - union { - /* The fields in this struct are valid if bits > 0 (TNODE) */ - struct { -- unsigned int full_children; /* KEYLENGTH bits needed */ -- unsigned int empty_children; /* KEYLENGTH bits needed */ -+ t_key empty_children; /* KEYLENGTH bits needed */ -+ t_key full_children; /* KEYLENGTH bits needed */ - struct tnode __rcu *child[0]; - }; - /* This list pointer if valid if bits == 0 (LEAF) */ -@@ -302,6 +303,16 @@ static struct tnode *tnode_alloc(size_t - return vzalloc(size); - } - -+static inline void empty_child_inc(struct tnode *n) -+{ -+ ++n->empty_children ? : ++n->full_children; -+} -+ -+static inline void empty_child_dec(struct tnode *n) -+{ -+ n->empty_children-- ? : n->full_children--; -+} -+ - static struct tnode *leaf_new(t_key key) - { - struct tnode *l = kmem_cache_alloc(trie_leaf_kmem, GFP_KERNEL); -@@ -335,7 +346,7 @@ static struct leaf_info *leaf_info_new(i - - static struct tnode *tnode_new(t_key key, int pos, int bits) - { -- size_t sz = offsetof(struct tnode, child[1 << bits]); -+ size_t sz = offsetof(struct tnode, child[1ul << bits]); - struct tnode *tn = tnode_alloc(sz); - unsigned int shift = pos + bits; - -@@ -348,8 +359,10 @@ static struct tnode *tnode_new(t_key key - tn->pos = pos; - tn->bits = bits; - tn->key = (shift < KEYLENGTH) ? (key >> shift) << shift : 0; -- tn->full_children = 0; -- tn->empty_children = 1<full_children = 1; -+ else -+ tn->empty_children = 1ul << bits; - } - - pr_debug("AT %p s=%zu %zu\n", tn, sizeof(struct tnode), -@@ -375,11 +388,11 @@ static void put_child(struct tnode *tn, - - BUG_ON(i >= tnode_child_length(tn)); - -- /* update emptyChildren */ -+ /* update emptyChildren, overflow into fullChildren */ - if (n == NULL && chi != NULL) -- tn->empty_children++; -- else if (n != NULL && chi == NULL) -- tn->empty_children--; -+ empty_child_inc(tn); -+ if (n != NULL && chi == NULL) -+ empty_child_dec(tn); - - /* update fullChildren */ - wasfull = tnode_full(tn, chi); -@@ -630,6 +643,24 @@ static int halve(struct trie *t, struct - return 0; - } - -+static void collapse(struct trie *t, struct tnode *oldtnode) -+{ -+ struct tnode *n, *tp; -+ unsigned long i; -+ -+ /* scan the tnode looking for that one child that might still exist */ -+ for (n = NULL, i = tnode_child_length(oldtnode); !n && i;) -+ n = tnode_get_child(oldtnode, --i); -+ -+ /* compress one level */ -+ tp = node_parent(oldtnode); -+ put_child_root(tp, t, oldtnode->key, n); -+ node_set_parent(n, tp); -+ -+ /* drop dead node */ -+ node_free(oldtnode); -+} -+ - static unsigned char update_suffix(struct tnode *tn) - { - unsigned char slen = tn->pos; -@@ -729,10 +760,12 @@ static bool should_inflate(const struct - - /* Keep root node larger */ - threshold *= tp ? inflate_threshold : inflate_threshold_root; -- used += tn->full_children; - used -= tn->empty_children; -+ used += tn->full_children; - -- return tn->pos && ((50 * used) >= threshold); -+ /* if bits == KEYLENGTH then pos = 0, and will fail below */ -+ -+ return (used > 1) && tn->pos && ((50 * used) >= threshold); - } - - static bool should_halve(const struct tnode *tp, const struct tnode *tn) -@@ -744,13 +777,29 @@ static bool should_halve(const struct tn - threshold *= tp ? halve_threshold : halve_threshold_root; - used -= tn->empty_children; - -- return (tn->bits > 1) && ((100 * used) < threshold); -+ /* if bits == KEYLENGTH then used = 100% on wrap, and will fail below */ -+ -+ return (used > 1) && (tn->bits > 1) && ((100 * used) < threshold); -+} -+ -+static bool should_collapse(const struct tnode *tn) -+{ -+ unsigned long used = tnode_child_length(tn); -+ -+ used -= tn->empty_children; -+ -+ /* account for bits == KEYLENGTH case */ -+ if ((tn->bits == KEYLENGTH) && tn->full_children) -+ used -= KEY_MAX; -+ -+ /* One child or none, time to drop us from the trie */ -+ return used < 2; - } - - #define MAX_WORK 10 - static void resize(struct trie *t, struct tnode *tn) - { -- struct tnode *tp = node_parent(tn), *n = NULL; -+ struct tnode *tp = node_parent(tn); - struct tnode __rcu **cptr; - int max_work = MAX_WORK; - -@@ -764,14 +813,6 @@ static void resize(struct trie *t, struc - cptr = tp ? &tp->child[get_index(tn->key, tp)] : &t->trie; - BUG_ON(tn != rtnl_dereference(*cptr)); - -- /* No children */ -- if (tn->empty_children > (tnode_child_length(tn) - 1)) -- goto no_children; -- -- /* One child */ -- if (tn->empty_children == (tnode_child_length(tn) - 1)) -- goto one_child; -- - /* Double as long as the resulting node has a number of - * nonempty nodes that are above the threshold. - */ -@@ -807,19 +848,8 @@ static void resize(struct trie *t, struc - } - - /* Only one child remains */ -- if (tn->empty_children == (tnode_child_length(tn) - 1)) { -- unsigned long i; --one_child: -- for (i = tnode_child_length(tn); !n && i;) -- n = tnode_get_child(tn, --i); --no_children: -- /* compress one level */ -- put_child_root(tp, t, tn->key, n); -- node_set_parent(n, tp); -- -- /* drop dead node */ -- tnode_free_init(tn); -- tnode_free(tn); -+ if (should_collapse(tn)) { -+ collapse(t, tn); - return; - } - diff --git a/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch b/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch deleted file mode 100644 index 160fbe1f3..000000000 --- a/target/linux/generic/pending-3.18/080-23-fib_trie-Use-empty_children-instead-of-counting-empt.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:33 -0800 -Subject: [PATCH] fib_trie: Use empty_children instead of counting empty nodes - in stats collection - -It doesn't make much sense to count the pointers ourselves when -empty_children already has a count for the number of NULL pointers stored -in the tnode. As such save ourselves the cycles and just use -empty_children. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -1954,16 +1954,10 @@ static void trie_collect_stats(struct tr - hlist_for_each_entry_rcu(li, &n->list, hlist) - ++s->prefixes; - } else { -- unsigned long i; -- - s->tnodes++; - if (n->bits < MAX_STAT_DEPTH) - s->nodesizes[n->bits]++; -- -- for (i = tnode_child_length(n); i--;) { -- if (!rcu_access_pointer(n->child[i])) -- s->nullpointers++; -- } -+ s->nullpointers += n->empty_children; - } - } - rcu_read_unlock(); diff --git a/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch b/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch deleted file mode 100644 index 5eba700ca..000000000 --- a/target/linux/generic/pending-3.18/080-24-fib_trie-Move-fib_find_alias-to-file-where-it-is-use.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:39 -0800 -Subject: [PATCH] fib_trie: Move fib_find_alias to file where it is used - -The function fib_find_alias is only accessed by functions in fib_trie.c as -such it makes sense to relocate it and cast it as static so that the -compiler can take advantage of optimizations it can do to it as a local -function. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_lookup.h -+++ b/net/ipv4/fib_lookup.h -@@ -32,7 +32,6 @@ int fib_dump_info(struct sk_buff *skb, u - unsigned int); - void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len, - u32 tb_id, const struct nl_info *info, unsigned int nlm_flags); --struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio); - - static inline void fib_result_assign(struct fib_result *res, - struct fib_info *fi) ---- a/net/ipv4/fib_semantics.c -+++ b/net/ipv4/fib_semantics.c -@@ -410,24 +410,6 @@ errout: - rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err); - } - --/* Return the first fib alias matching TOS with -- * priority less than or equal to PRIO. -- */ --struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) --{ -- if (fah) { -- struct fib_alias *fa; -- list_for_each_entry(fa, fah, fa_list) { -- if (fa->fa_tos > tos) -- continue; -- if (fa->fa_info->fib_priority >= prio || -- fa->fa_tos < tos) -- return fa; -- } -- } -- return NULL; --} -- - static int fib_detect_death(struct fib_info *fi, int order, - struct fib_info **last_resort, int *last_idx, - int dflt) ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -998,6 +998,26 @@ static struct tnode *fib_find_node(struc - return n; - } - -+/* Return the first fib alias matching TOS with -+ * priority less than or equal to PRIO. -+ */ -+static struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) -+{ -+ struct fib_alias *fa; -+ -+ if (!fah) -+ return NULL; -+ -+ list_for_each_entry(fa, fah, fa_list) { -+ if (fa->fa_tos > tos) -+ continue; -+ if (fa->fa_info->fib_priority >= prio || fa->fa_tos < tos) -+ return fa; -+ } -+ -+ return NULL; -+} -+ - static void trie_rebalance(struct trie *t, struct tnode *tn) - { - struct tnode *tp; diff --git a/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch b/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch deleted file mode 100644 index c7739d032..000000000 --- a/target/linux/generic/pending-3.18/080-25-fib_trie-Various-clean-ups-for-handling-slen.patch +++ /dev/null @@ -1,116 +0,0 @@ -From: Alexander Duyck -Date: Thu, 22 Jan 2015 15:51:45 -0800 -Subject: [PATCH] fib_trie: Various clean-ups for handling slen - -While doing further work on the fib_trie I noted a few items. - -First I was using calls that were far more complicated than they needed to -be for determining when to push/pull the suffix length. I have updated the -code to reflect the simplier logic. - -The second issue is that I realised we weren't necessarily handling the -case of a leaf_info struct surviving a flush. I have updated the logic so -that now we will call pull_suffix in the event of having a leaf info value -left in the leaf after flushing it. - -Signed-off-by: Alexander Duyck -Signed-off-by: David S. Miller ---- - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -917,27 +917,20 @@ static void leaf_push_suffix(struct tnod - - static void remove_leaf_info(struct tnode *l, struct leaf_info *old) - { -- struct hlist_node *prev; -- -- /* record the location of the pointer to this object */ -- prev = rtnl_dereference(hlist_pprev_rcu(&old->hlist)); -+ /* record the location of the previous list_info entry */ -+ struct hlist_node **pprev = old->hlist.pprev; -+ struct leaf_info *li = hlist_entry(pprev, typeof(*li), hlist.next); - - /* remove the leaf info from the list */ - hlist_del_rcu(&old->hlist); - -- /* if we emptied the list this leaf will be freed and we can sort -- * out parent suffix lengths as a part of trie_rebalance -- */ -- if (hlist_empty(&l->list)) -+ /* only access li if it is pointing at the last valid hlist_node */ -+ if (hlist_empty(&l->list) || (*pprev)) - return; - -- /* if we removed the tail then we need to update slen */ -- if (!rcu_access_pointer(hlist_next_rcu(prev))) { -- struct leaf_info *li = hlist_entry(prev, typeof(*li), hlist); -- -- l->slen = KEYLENGTH - li->plen; -- leaf_pull_suffix(l); -- } -+ /* update the trie with the latest suffix length */ -+ l->slen = KEYLENGTH - li->plen; -+ leaf_pull_suffix(l); - } - - static void insert_leaf_info(struct tnode *l, struct leaf_info *new) -@@ -961,7 +954,7 @@ static void insert_leaf_info(struct tnod - } - - /* if we added to the tail node then we need to update slen */ -- if (!rcu_access_pointer(hlist_next_rcu(&new->hlist))) { -+ if (l->slen < (KEYLENGTH - new->plen)) { - l->slen = KEYLENGTH - new->plen; - leaf_push_suffix(l); - } -@@ -1613,6 +1606,7 @@ static int trie_flush_leaf(struct tnode - struct hlist_head *lih = &l->list; - struct hlist_node *tmp; - struct leaf_info *li = NULL; -+ unsigned char plen = KEYLENGTH; - - hlist_for_each_entry_safe(li, tmp, lih, hlist) { - found += trie_flush_list(&li->falh); -@@ -1620,8 +1614,14 @@ static int trie_flush_leaf(struct tnode - if (list_empty(&li->falh)) { - hlist_del_rcu(&li->hlist); - free_leaf_info(li); -+ continue; - } -+ -+ plen = li->plen; - } -+ -+ l->slen = KEYLENGTH - plen; -+ - return found; - } - -@@ -1700,13 +1700,22 @@ int fib_table_flush(struct fib_table *tb - for (l = trie_firstleaf(t); l; l = trie_nextleaf(l)) { - found += trie_flush_leaf(l); - -- if (ll && hlist_empty(&ll->list)) -- trie_leaf_remove(t, ll); -+ if (ll) { -+ if (hlist_empty(&ll->list)) -+ trie_leaf_remove(t, ll); -+ else -+ leaf_pull_suffix(ll); -+ } -+ - ll = l; - } - -- if (ll && hlist_empty(&ll->list)) -- trie_leaf_remove(t, ll); -+ if (ll) { -+ if (hlist_empty(&ll->list)) -+ trie_leaf_remove(t, ll); -+ else -+ leaf_pull_suffix(ll); -+ } - - pr_debug("trie_flush found=%d\n", found); - return found; diff --git a/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch b/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch deleted file mode 100644 index 347049a92..000000000 --- a/target/linux/generic/pending-3.18/081-01-pppoe-Use-workqueue-to-die-properly-when-a-PADT-is-r.patch +++ /dev/null @@ -1,89 +0,0 @@ -From: Simon Farnsworth -Date: Sun, 1 Mar 2015 10:54:39 +0000 -Subject: [PATCH] pppoe: Use workqueue to die properly when a PADT is received - -When a PADT frame is received, the socket may not be in a good state to -close down the PPP interface. The current implementation handles this by -simply blocking all further PPP traffic, and hoping that the lack of traffic -will trigger the user to investigate. - -Use schedule_work to get to a process context from which we clear down the -PPP interface, in a fashion analogous to hangup on a TTY-based PPP -interface. This causes pppd to disconnect immediately, and allows tools to -take immediate corrective action. - -Note that pppd's rp_pppoe.so plugin has code in it to disable the session -when it disconnects; however, as a consequence of this patch, the session is -already disabled before rp_pppoe.so is asked to disable the session. The -result is a harmless error message: - -Failed to disconnect PPPoE socket: 114 Operation already in progress - -This message is safe to ignore, as long as the error is 114 Operation -already in progress; in that specific case, it means that the PPPoE session -has already been disabled before pppd tried to disable it. - -Signed-off-by: Simon Farnsworth -Tested-by: Dan Williams -Tested-by: Christoph Schulz -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -454,6 +454,18 @@ out: - return NET_RX_DROP; - } - -+static void pppoe_unbind_sock_work(struct work_struct *work) -+{ -+ struct pppox_sock *po = container_of(work, struct pppox_sock, -+ proto.pppoe.padt_work); -+ struct sock *sk = sk_pppox(po); -+ -+ lock_sock(sk); -+ pppox_unbind_sock(sk); -+ release_sock(sk); -+ sock_put(sk); -+} -+ - /************************************************************************ - * - * Receive a PPPoE Discovery frame. -@@ -499,7 +511,8 @@ static int pppoe_disc_rcv(struct sk_buff - } - - bh_unlock_sock(sk); -- sock_put(sk); -+ if (!schedule_work(&po->proto.pppoe.padt_work)) -+ sock_put(sk); - } - - abort: -@@ -612,6 +625,8 @@ static int pppoe_connect(struct socket * - - lock_sock(sk); - -+ INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work); -+ - error = -EINVAL; - if (sp->sa_protocol != PX_PROTO_OE) - goto end; ---- a/include/linux/if_pppox.h -+++ b/include/linux/if_pppox.h -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - - static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb) -@@ -32,6 +33,7 @@ struct pppoe_opt { - struct pppoe_addr pa; /* what this socket is bound to*/ - struct sockaddr_pppox relay; /* what socket data will be - relayed to (PPPoE relaying) */ -+ struct work_struct padt_work;/* Work item for handling PADT */ - }; - - struct pptp_opt { diff --git a/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch b/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch deleted file mode 100644 index f592929b3..000000000 --- a/target/linux/generic/pending-3.18/081-02-pppoe-Lacks-DST-MAC-address-check.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Joakim Tjernlund -Date: Mon, 20 Apr 2015 21:07:48 +0200 -Subject: [PATCH] pppoe: Lacks DST MAC address check - -A pppoe session is identified by its session ID and MAC address. -Currently pppoe does not check if the received pkg has the correct -MAC address. This is a problem when the eth I/F is in promisc mode -as then any DST MAC address is accepted. - -Signed-off-by: Joakim Tjernlund -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -379,6 +379,9 @@ static int pppoe_rcv_core(struct sock *s - * can't change. - */ - -+ if (skb->pkt_type == PACKET_OTHERHOST) -+ goto abort_kfree; -+ - if (sk->sk_state & PPPOX_BOUND) { - ppp_input(&po->chan, skb); - } else if (sk->sk_state & PPPOX_RELAY) { diff --git a/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch b/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch deleted file mode 100644 index 07d64359c..000000000 --- a/target/linux/generic/pending-3.18/081-03-pppoe-drop-pppoe-device-in-pppoe_unbind_sock_work.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Felix Fietkau -Date: Sat, 9 May 2015 23:08:38 +0200 -Subject: [PATCH] pppoe: drop pppoe device in pppoe_unbind_sock_work - -After receiving a PADT and the socket is closed, user space will no -longer drop the reference to the pppoe device. -This leads to errors like this: - -[ 488.570000] unregister_netdevice: waiting for eth0.2 to become free. Usage count = 2 - -Fixes: 287f3a943fe ("pppoe: Use workqueue to die properly when a PADT is received") -Signed-off-by: Felix Fietkau -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -464,6 +464,10 @@ static void pppoe_unbind_sock_work(struc - struct sock *sk = sk_pppox(po); - - lock_sock(sk); -+ if (po->pppoe_dev) { -+ dev_put(po->pppoe_dev); -+ po->pppoe_dev = NULL; -+ } - pppox_unbind_sock(sk); - release_sock(sk); - sock_put(sk); diff --git a/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch b/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch deleted file mode 100644 index 8d155eba1..000000000 --- a/target/linux/generic/pending-3.18/081-06-ppp-don-t-set-sk_state-to-PPPOX_ZOMBIE-in-pppoe_disc.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Guillaume Nault -Date: Thu, 19 Nov 2015 12:52:56 +0100 -Subject: [PATCH] ppp: don't set sk_state to PPPOX_ZOMBIE in pppoe_disc_rcv() - -Since 287f3a943fef ("pppoe: Use workqueue to die properly when a PADT -is received"), pppoe_disc_rcv() disconnects the socket by scheduling -pppoe_unbind_sock_work(). This is enough to stop socket transmission -and makes the PPPOX_ZOMBIE state uncessary. - -Signed-off-by: Guillaume Nault -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -500,27 +500,9 @@ static int pppoe_disc_rcv(struct sk_buff - - pn = pppoe_pernet(dev_net(dev)); - po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); -- if (po) { -- struct sock *sk = sk_pppox(po); -- -- bh_lock_sock(sk); -- -- /* If the user has locked the socket, just ignore -- * the packet. With the way two rcv protocols hook into -- * one socket family type, we cannot (easily) distinguish -- * what kind of SKB it is during backlog rcv. -- */ -- if (sock_owned_by_user(sk) == 0) { -- /* We're no longer connect at the PPPOE layer, -- * and must wait for ppp channel to disconnect us. -- */ -- sk->sk_state = PPPOX_ZOMBIE; -- } -- -- bh_unlock_sock(sk); -+ if (po) - if (!schedule_work(&po->proto.pppoe.padt_work)) -- sock_put(sk); -- } -+ sock_put(sk_pppox(po)); - - abort: - kfree_skb(skb); diff --git a/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch b/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch deleted file mode 100644 index ffdba4d92..000000000 --- a/target/linux/generic/pending-3.18/081-07-ppp-remove-PPPOX_ZOMBIE-socket-state.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: Guillaume Nault -Date: Thu, 19 Nov 2015 12:53:21 +0100 -Subject: [PATCH] ppp: remove PPPOX_ZOMBIE socket state - -PPPOX_ZOMBIE is never set anymore. - -Signed-off-by: Guillaume Nault -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -311,7 +311,7 @@ static void pppoe_flush_dev(struct net_d - lock_sock(sk); - - if (po->pppoe_dev == dev && -- sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { -+ sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { - pppox_unbind_sock(sk); - sk->sk_state_change(sk); - po->pppoe_dev = NULL; -@@ -775,7 +775,7 @@ static int pppoe_ioctl(struct socket *so - struct pppox_sock *relay_po; - - err = -EBUSY; -- if (sk->sk_state & (PPPOX_BOUND | PPPOX_ZOMBIE | PPPOX_DEAD)) -+ if (sk->sk_state & (PPPOX_BOUND | PPPOX_DEAD)) - break; - - err = -ENOTCONN; ---- a/drivers/net/ppp/pppox.c -+++ b/drivers/net/ppp/pppox.c -@@ -58,7 +58,7 @@ void pppox_unbind_sock(struct sock *sk) - { - /* Clear connection to ppp device, if attached. */ - -- if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED | PPPOX_ZOMBIE)) { -+ if (sk->sk_state & (PPPOX_BOUND | PPPOX_CONNECTED)) { - ppp_unregister_channel(&pppox_sk(sk)->chan); - sk->sk_state = PPPOX_DEAD; - } ---- a/include/linux/if_pppox.h -+++ b/include/linux/if_pppox.h -@@ -91,7 +91,6 @@ enum { - PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */ - PPPOX_BOUND = 2, /* bound to ppp device */ - PPPOX_RELAY = 4, /* forwarding is enabled */ -- PPPOX_ZOMBIE = 8, /* dead, but still bound to ppp device */ - PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/ - }; - diff --git a/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch b/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch deleted file mode 100644 index 147e9712d..000000000 --- a/target/linux/generic/pending-3.18/081-08-pppoe-fix-memory-corruption-in-padt-work-structure.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Guillaume Nault -Date: Thu, 3 Dec 2015 16:49:32 +0100 -Subject: [PATCH] pppoe: fix memory corruption in padt work structure - -pppoe_connect() mustn't touch the padt_work field of pppoe sockets -because that work could be already pending. - -[ 21.473147] BUG: unable to handle kernel NULL pointer dereference at 00000004 -[ 21.474523] IP: [] process_one_work+0x29/0x31c -[ 21.475164] *pde = 00000000 -[ 21.475513] Oops: 0000 [#1] SMP -[ 21.475910] Modules linked in: pppoe pppox ppp_generic slhc crc32c_intel aesni_intel virtio_net xts aes_i586 lrw gf128mul ablk_helper cryptd evdev acpi_cpufreq processor serio_raw button ext4 crc16 mbcache jbd2 virtio_blk virtio_pci virtio_ring virtio -[ 21.476168] CPU: 2 PID: 164 Comm: kworker/2:2 Not tainted 4.4.0-rc1 #1 -[ 21.476168] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014 -[ 21.476168] task: f5f83c00 ti: f5e28000 task.ti: f5e28000 -[ 21.476168] EIP: 0060:[] EFLAGS: 00010046 CPU: 2 -[ 21.476168] EIP is at process_one_work+0x29/0x31c -[ 21.484082] EAX: 00000000 EBX: f678b2a0 ECX: 00000004 EDX: 00000000 -[ 21.484082] ESI: f6c69940 EDI: f5e29ef0 EBP: f5e29f0c ESP: f5e29edc -[ 21.484082] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 -[ 21.484082] CR0: 80050033 CR2: 000000a4 CR3: 317ad000 CR4: 00040690 -[ 21.484082] Stack: -[ 21.484082] 00000000 f6c69950 00000000 f6c69940 c0042338 f5e29f0c c1327945 00000000 -[ 21.484082] 00000008 f678b2a0 f6c69940 f678b2b8 f5e29f30 c1043984 f5f83c00 f6c69970 -[ 21.484082] f678b2a0 c10437d3 f6775e80 f678b2a0 c10437d3 f5e29fac c1047059 f5e29f74 -[ 21.484082] Call Trace: -[ 21.484082] [] ? _raw_spin_lock_irq+0x28/0x30 -[ 21.484082] [] worker_thread+0x1b1/0x244 -[ 21.484082] [] ? rescuer_thread+0x229/0x229 -[ 21.484082] [] ? rescuer_thread+0x229/0x229 -[ 21.484082] [] kthread+0x8f/0x94 -[ 21.484082] [] ? _raw_spin_unlock_irq+0x22/0x26 -[ 21.484082] [] ret_from_kernel_thread+0x21/0x38 -[ 21.484082] [] ? kthread_parkme+0x19/0x19 -[ 21.496082] Code: 5d c3 55 89 e5 57 56 53 89 c3 83 ec 24 89 d0 89 55 e0 8d 7d e4 e8 6c d8 ff ff b9 04 00 00 00 89 45 d8 8b 43 24 89 45 dc 8b 45 d8 <8b> 40 04 8b 80 e0 00 00 00 c1 e8 05 24 01 88 45 d7 8b 45 e0 8d -[ 21.496082] EIP: [] process_one_work+0x29/0x31c SS:ESP 0068:f5e29edc -[ 21.496082] CR2: 0000000000000004 -[ 21.496082] ---[ end trace e362cc9cf10dae89 ]--- - -Reported-by: Andrew -Fixes: 287f3a943fef ("pppoe: Use workqueue to die properly when a PADT is received") -Signed-off-by: Guillaume Nault -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -550,6 +550,9 @@ static int pppoe_create(struct net *net, - sk->sk_family = PF_PPPOX; - sk->sk_protocol = PX_PROTO_OE; - -+ INIT_WORK(&pppox_sk(sk)->proto.pppoe.padt_work, -+ pppoe_unbind_sock_work); -+ - return 0; - } - -@@ -614,8 +617,6 @@ static int pppoe_connect(struct socket * - - lock_sock(sk); - -- INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work); -- - error = -EINVAL; - if (sp->sa_protocol != PX_PROTO_OE) - goto end; -@@ -645,8 +646,13 @@ static int pppoe_connect(struct socket * - po->pppoe_dev = NULL; - } - -- memset(sk_pppox(po) + 1, 0, -- sizeof(struct pppox_sock) - sizeof(struct sock)); -+ po->pppoe_ifindex = 0; -+ memset(&po->pppoe_pa, 0, sizeof(po->pppoe_pa)); -+ memset(&po->pppoe_relay, 0, sizeof(po->pppoe_relay)); -+ memset(&po->chan, 0, sizeof(po->chan)); -+ po->next = NULL; -+ po->num = 0; -+ - sk->sk_state = PPPOX_NONE; - } - diff --git a/target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch b/target/linux/generic/pending-3.18/082-ipv6-ip6_fragment-fix-headroom-tests-and-skb-leak.patch deleted file mode 100644 index 9f39e5ba5..000000000 --- a/target/linux/generic/pending-3.18/082-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 -@@ -600,20 +600,22 @@ int ip6_fragment(struct sk_buff *skb, in - } - mtu -= hlen + sizeof(struct frag_hdr); - -+ hroom = LL_RESERVED_SPACE(rt->dst.dev); - if (skb_has_frag_list(skb)) { - int first_len = skb_pagelen(skb); - struct sk_buff *frag2; - - if (first_len - hlen > mtu || - ((first_len - hlen) & 7) || -- skb_cloned(skb)) -+ skb_cloned(skb) || -+ skb_headroom(skb) < (hroom + sizeof(struct frag_hdr))) - goto slow_path; - - skb_walk_frags(skb, frag) { - /* Correct geometry. */ - if (frag->len > mtu || - ((frag->len & 7) && frag->next) || -- skb_headroom(frag) < hlen) -+ skb_headroom(frag) < (hlen + hroom + sizeof(struct frag_hdr))) - goto slow_path_clean; - - /* Partially cloned skb? */ -@@ -630,8 +632,6 @@ int ip6_fragment(struct sk_buff *skb, in - - err = 0; - offset = 0; -- frag = skb_shinfo(skb)->frag_list; -- skb_frag_list_init(skb); - /* BUILD HEADER */ - - *prevhdr = NEXTHDR_FRAGMENT; -@@ -639,8 +639,11 @@ int ip6_fragment(struct sk_buff *skb, in - if (!tmp_hdr) { - IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), - IPSTATS_MIB_FRAGFAILS); -- return -ENOMEM; -+ err = -ENOMEM; -+ goto fail; - } -+ frag = skb_shinfo(skb)->frag_list; -+ skb_frag_list_init(skb); - - __skb_pull(skb, hlen); - fh = (struct frag_hdr *)__skb_push(skb, sizeof(struct frag_hdr)); -@@ -738,7 +741,6 @@ slow_path: - */ - - *prevhdr = NEXTHDR_FRAGMENT; -- hroom = LL_RESERVED_SPACE(rt->dst.dev); - troom = rt->dst.dev->needed_tailroom; - - /* diff --git a/target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch b/target/linux/generic/pending-3.18/083-solos-pci-Increase-headroom-on-received-packets.patch deleted file mode 100644 index 7f9f9266c..000000000 --- a/target/linux/generic/pending-3.18/083-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 = - pci_map_single(card->dev, skb->data, diff --git a/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch b/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch deleted file mode 100644 index 94b61fdab..000000000 --- a/target/linux/generic/pending-3.18/087-regmap-make-LZO-cache-optional.patch +++ /dev/null @@ -1,67 +0,0 @@ -From de88e9b0354c2e3ff8eae3f97afe43a34f5ed239 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 13 May 2017 13:03:21 +0200 -Subject: [PATCH] regmap: make LZO cache optional - -Commit 2cbbb579bcbe3 ("regmap: Add the LZO cache support") added support -for LZO compression in regcache, but there were never any users added -afterwards. Since LZO support itself has its own size, it currently is -rather a deoptimization. - -So make it optional by introducing a symbol that can be selected by -drivers wanting to make use of it. - -Saves e.g. ~46 kB on MIPS (size of LZO support + regcache LZO code). - -Signed-off-by: Jonas Gorski ---- -I tried using google to find any users (even out-of-tree ones), but at -best I found a single driver submission that was switched to RBTREE in -subsequent resubmissions (MFD_SMSC). - -One could maybe also just drop the code because of no users for 5 years, -but that would be up to the maintainer(s) to decide. - - drivers/base/regmap/Kconfig | 5 ++++- - drivers/base/regmap/Makefile | 3 ++- - drivers/base/regmap/regcache.c | 2 ++ - 3 files changed, 8 insertions(+), 2 deletions(-) - ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -4,9 +4,12 @@ - - config REGMAP - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ) -+ select IRQ_DOMAIN if REGMAP_IRQ -+ bool -+ -+config REGCACHE_COMPRESSED - select LZO_COMPRESS - select LZO_DECOMPRESS -- select IRQ_DOMAIN if REGMAP_IRQ - bool - - config REGMAP_I2C ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -1,5 +1,6 @@ - obj-$(CONFIG_REGMAP) += regmap.o regcache.o --obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o -+obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o -+obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o - obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o - obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o ---- a/drivers/base/regmap/regcache.c -+++ b/drivers/base/regmap/regcache.c -@@ -21,7 +21,9 @@ - - static const struct regcache_ops *cache_types[] = { - ®cache_rbtree_ops, -+#if IS_ENABLED(CONFIG_REGCACHE_COMPRESSED) - ®cache_lzo_ops, -+#endif - ®cache_flat_ops, - }; - diff --git a/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch b/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch deleted file mode 100644 index 6c26a47c5..000000000 --- a/target/linux/generic/pending-3.18/090-overlayfs-fallback-to-readonly-when-full.patch +++ /dev/null @@ -1,109 +0,0 @@ -[linux-unionfs added to Cc] - -On Tue, May 19, 2015 at 09:51:20AM +0200, Bastian Bittorf wrote: -> Hi Miklos, -> -> sorry for writing directly to you, feel free to forward -> this to the appropriate mailinglist. -> -> we have a problem with mainline overlay filesystem on kernel 3.18: -> https://dev.openwrt.org/ticket/19564 -> -> 2 things are odd: -> when the working filesystem is full, overlays fails with: -> -> overlayfs: failed to create directory /overlay/work/work -> -> what is strange, that we call it with: -> -> mount(overlay, "/mnt", "overlay", MS_NOATIME, lowerdir) -> -> see here: -> http://nbd.name/gitweb.cgi?p=fstools.git;a=blob;f=libfstools/mount.c;h=81176ce399b4cd8e2d347c0008c13dec92407f55;hb=e6004000ff15d7bd32cf5663e8690fc94d7ec747#l125 -> -> do you have an idea whats wrong? -> 1) is it really needed, that we need space for creating dir "/overlay/work"? -> 2) why does overlay need "/overlay/work/work"? - -The work directory is needed for atomic copy-up and similar. It is not actually -necessary to mount a read-only overlay. Post 4.0 it is possible to mount the -overlay without workdir (but even then it won't happen automatically in case the -upper fs is full, so this should be fixed in the latest kernel too). - -Could you please try the following patch? If the workdir can't be created it -will fall back to mounting the overlay read-only. - -Thanks, -Miklos - ---- - fs/overlayfs/copy_up.c | 3 +++ - fs/overlayfs/dir.c | 9 +++++++++ - fs/overlayfs/super.c | 12 +++++++++--- - 3 files changed, 21 insertions(+), 3 deletions(-) - ---- a/fs/overlayfs/copy_up.c -+++ b/fs/overlayfs/copy_up.c -@@ -315,6 +315,9 @@ int ovl_copy_up_one(struct dentry *paren - struct cred *override_cred; - char *link = NULL; - -+ if (WARN_ON(!workdir)) -+ return -EROFS; -+ - ovl_path_upper(parent, &parentpath); - upperdir = parentpath.dentry; - ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -222,6 +222,9 @@ static struct dentry *ovl_clear_empty(st - struct kstat stat; - int err; - -+ if (WARN_ON(!workdir)) -+ return ERR_PTR(-EROFS); -+ - err = ovl_lock_rename_workdir(workdir, upperdir); - if (err) - goto out; -@@ -322,6 +325,9 @@ static int ovl_create_over_whiteout(stru - struct dentry *newdentry; - int err; - -+ if (WARN_ON(!workdir)) -+ return -EROFS; -+ - err = ovl_lock_rename_workdir(workdir, upperdir); - if (err) - goto out; -@@ -507,6 +513,9 @@ static int ovl_remove_and_whiteout(struc - int err; - int flags = 0; - -+ if (WARN_ON(!workdir)) -+ return -EROFS; -+ - if (is_dir) { - opaquedir = ovl_check_empty_and_clear(dentry); - err = PTR_ERR(opaquedir); ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -760,9 +760,15 @@ static int ovl_fill_super(struct super_b - ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); - err = PTR_ERR(ufs->workdir); - if (IS_ERR(ufs->workdir)) { -- pr_err("overlayfs: failed to create directory %s/%s\n", -- ufs->config.workdir, OVL_WORKDIR_NAME); -- goto out_put_lower_mnt; -+ if (err == -ENOSPC || err == -EROFS) { -+ pr_warning("overlayfs: failed to create work directory (%s), mounting read-only\n", err == ENOSPC ? "ENOSPC" : "EROFS"); -+ sb->s_flags |= MS_RDONLY; -+ ufs->workdir = NULL; -+ } else { -+ pr_err("overlayfs: failed to create directory %s/%s\n", -+ ufs->config.workdir, OVL_WORKDIR_NAME); -+ goto out_put_lower_mnt; -+ } - } - - /* diff --git a/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch b/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch deleted file mode 100644 index 24aa0752d..000000000 --- a/target/linux/generic/pending-3.18/091-mtd-spi-nor-add-support-Spansion_S25FL164K.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -567,6 +567,7 @@ static const struct spi_device_id spi_no - { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, - { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K) }, - { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) }, - - /* SST -- large erase sizes are "overlays", "sectors" are 4K */ - { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, diff --git a/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch b/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch deleted file mode 100644 index fa3ab6a63..000000000 --- a/target/linux/generic/pending-3.18/092-01-spi-Check-to-see-if-the-device-is-processing-a-messa.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Mark Brown -Date: Tue, 9 Dec 2014 19:46:56 +0000 -Subject: [PATCH] spi: Check to see if the device is processing a message - before we idle - -cur_msg is updated under the queue lock and holds the message we are -currently processing. Since currently we only ever do removals in the -pump kthread it doesn't matter in what order we do things but we want -to be able to push things out from the submitting thread so pull the -check to see if we're currently handling a message before we check to -see if the queue is idle. - -Signed-off-by: Mark Brown ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -891,8 +891,16 @@ static void spi_pump_messages(struct kth - bool was_busy = false; - int ret; - -- /* Lock queue and check for queue work */ -+ /* Lock queue */ - spin_lock_irqsave(&master->queue_lock, flags); -+ -+ /* Make sure we are not already running a message */ -+ if (master->cur_msg) { -+ spin_unlock_irqrestore(&master->queue_lock, flags); -+ return; -+ } -+ -+ /* Check if the queue is idle */ - if (list_empty(&master->queue) || !master->running) { - if (!master->busy) { - spin_unlock_irqrestore(&master->queue_lock, flags); -@@ -916,11 +924,6 @@ static void spi_pump_messages(struct kth - return; - } - -- /* Make sure we are not already running a message */ -- if (master->cur_msg) { -- spin_unlock_irqrestore(&master->queue_lock, flags); -- return; -- } - /* Extract head of queue */ - master->cur_msg = - list_first_entry(&master->queue, struct spi_message, queue); diff --git a/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch b/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch deleted file mode 100644 index b74b4cb93..000000000 --- a/target/linux/generic/pending-3.18/092-02-spi-Pump-transfers-inside-calling-context-for-spi_sy.patch +++ /dev/null @@ -1,184 +0,0 @@ -From: Mark Brown -Date: Tue, 9 Dec 2014 21:38:05 +0000 -Subject: [PATCH] spi: Pump transfers inside calling context for spi_sync() - -If we are using the standard SPI message pump (which all drivers should be -transitioning over to) then special case the message enqueue and instead of -starting the worker thread to push messages to the hardware do so in the -context of the caller if the controller is idle. This avoids a context -switch in the common case where the controller has a single user in a -single thread, for short PIO transfers there may be no need to context -switch away from the calling context to complete the transfer. - -The code is a bit more complex than is desirable in part due to the need -to handle drivers not using the standard queue and in part due to handling -the various combinations of bus locking and asynchronous submission in -interrupt context. - -It is still suboptimal since it will still wake the message pump for each -transfer in order to schedule idling of the hardware and if multiple -contexts are using the controller simultaneously a caller may end up -pumping a message for some random other thread rather than for itself, -and if the thread ends up deferring due to another context idling the -hardware then it will just busy wait. It can, however, have the benefit -of aggregating power up and down of the hardware when a caller performs -a series of transfers back to back without any need for the use of -spi_async(). - -Signed-off-by: Mark Brown ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -882,6 +882,9 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_t - * needs processing and if so call out to the driver to initialize hardware - * and transfer each message. - * -+ * Note that it is called both from the kthread itself and also from -+ * inside spi_sync(); the queue extraction handling at the top of the -+ * function should deal with this safely. - */ - static void spi_pump_messages(struct kthread_work *work) - { -@@ -900,6 +903,13 @@ static void spi_pump_messages(struct kth - return; - } - -+ /* If another context is idling the device then defer */ -+ if (master->idling) { -+ queue_kthread_work(&master->kworker, &master->pump_messages); -+ spin_unlock_irqrestore(&master->queue_lock, flags); -+ return; -+ } -+ - /* Check if the queue is idle */ - if (list_empty(&master->queue) || !master->running) { - if (!master->busy) { -@@ -907,7 +917,9 @@ static void spi_pump_messages(struct kth - return; - } - master->busy = false; -+ master->idling = true; - spin_unlock_irqrestore(&master->queue_lock, flags); -+ - kfree(master->dummy_rx); - master->dummy_rx = NULL; - kfree(master->dummy_tx); -@@ -921,6 +933,10 @@ static void spi_pump_messages(struct kth - pm_runtime_put_autosuspend(master->dev.parent); - } - trace_spi_master_idle(master); -+ -+ spin_lock_irqsave(&master->queue_lock, flags); -+ master->idling = false; -+ spin_unlock_irqrestore(&master->queue_lock, flags); - return; - } - -@@ -1166,12 +1182,9 @@ static int spi_destroy_queue(struct spi_ - return 0; - } - --/** -- * spi_queued_transfer - transfer function for queued transfers -- * @spi: spi device which is requesting transfer -- * @msg: spi message which is to handled is queued to driver queue -- */ --static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) -+static int __spi_queued_transfer(struct spi_device *spi, -+ struct spi_message *msg, -+ bool need_pump) - { - struct spi_master *master = spi->master; - unsigned long flags; -@@ -1186,13 +1199,23 @@ static int spi_queued_transfer(struct sp - msg->status = -EINPROGRESS; - - list_add_tail(&msg->queue, &master->queue); -- if (!master->busy) -+ if (!master->busy && need_pump) - queue_kthread_work(&master->kworker, &master->pump_messages); - - spin_unlock_irqrestore(&master->queue_lock, flags); - return 0; - } - -+/** -+ * spi_queued_transfer - transfer function for queued transfers -+ * @spi: spi device which is requesting transfer -+ * @msg: spi message which is to handled is queued to driver queue -+ */ -+static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) -+{ -+ return __spi_queued_transfer(spi, msg, true); -+} -+ - static int spi_master_initialize_queue(struct spi_master *master) - { - int ret; -@@ -2104,19 +2127,46 @@ static int __spi_sync(struct spi_device - DECLARE_COMPLETION_ONSTACK(done); - int status; - struct spi_master *master = spi->master; -+ unsigned long flags; -+ -+ status = __spi_validate(spi, message); -+ if (status != 0) -+ return status; - - message->complete = spi_complete; - message->context = &done; -+ message->spi = spi; - - if (!bus_locked) - mutex_lock(&master->bus_lock_mutex); - -- status = spi_async_locked(spi, message); -+ /* If we're not using the legacy transfer method then we will -+ * try to transfer in the calling context so special case. -+ * This code would be less tricky if we could remove the -+ * support for driver implemented message queues. -+ */ -+ if (master->transfer == spi_queued_transfer) { -+ spin_lock_irqsave(&master->bus_lock_spinlock, flags); -+ -+ trace_spi_message_submit(message); -+ -+ status = __spi_queued_transfer(spi, message, false); -+ -+ spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); -+ } else { -+ status = spi_async_locked(spi, message); -+ } - - if (!bus_locked) - mutex_unlock(&master->bus_lock_mutex); - - if (status == 0) { -+ /* Push out the messages in the calling context if we -+ * can. -+ */ -+ if (master->transfer == spi_queued_transfer) -+ spi_pump_messages(&master->pump_messages); -+ - wait_for_completion(&done); - status = message->status; - } ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -260,6 +260,7 @@ static inline void spi_unregister_driver - * @pump_messages: work struct for scheduling work to the message pump - * @queue_lock: spinlock to syncronise access to message queue - * @queue: message queue -+ * @idling: the device is entering idle state - * @cur_msg: the currently in-flight message - * @cur_msg_prepared: spi_prepare_message was called for the currently - * in-flight message -@@ -425,6 +426,7 @@ struct spi_master { - spinlock_t queue_lock; - struct list_head queue; - struct spi_message *cur_msg; -+ bool idling; - bool busy; - bool running; - bool rt; diff --git a/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch b/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch deleted file mode 100644 index a5d85be2b..000000000 --- a/target/linux/generic/pending-3.18/092-03-spi-Only-idle-the-message-pump-in-the-worker-kthread.patch +++ /dev/null @@ -1,83 +0,0 @@ -From: Mark Brown -Date: Wed, 10 Dec 2014 13:46:33 +0000 -Subject: [PATCH] spi: Only idle the message pump in the worker kthread - -In order to avoid the situation where the kthread is waiting for another -context to make the hardware idle let the message pump know if it's being -called from the worker thread context and if it isn't then defer to the -worker thread instead of idling the hardware immediately. This will ensure -that if this situation happens we block rather than busy waiting. - -Signed-off-by: Mark Brown ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -875,8 +875,9 @@ void spi_finalize_current_transfer(struc - EXPORT_SYMBOL_GPL(spi_finalize_current_transfer); - - /** -- * spi_pump_messages - kthread work function which processes spi message queue -- * @work: pointer to kthread work struct contained in the master struct -+ * __spi_pump_messages - function which processes spi message queue -+ * @master: master to process queue for -+ * @in_kthread: true if we are in the context of the message pump thread - * - * This function checks if there is any spi message in the queue that - * needs processing and if so call out to the driver to initialize hardware -@@ -886,10 +887,8 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_t - * inside spi_sync(); the queue extraction handling at the top of the - * function should deal with this safely. - */ --static void spi_pump_messages(struct kthread_work *work) -+static void __spi_pump_messages(struct spi_master *master, bool in_kthread) - { -- struct spi_master *master = -- container_of(work, struct spi_master, pump_messages); - unsigned long flags; - bool was_busy = false; - int ret; -@@ -916,6 +915,15 @@ static void spi_pump_messages(struct kth - spin_unlock_irqrestore(&master->queue_lock, flags); - return; - } -+ -+ /* Only do teardown in the thread */ -+ if (!in_kthread) { -+ queue_kthread_work(&master->kworker, -+ &master->pump_messages); -+ spin_unlock_irqrestore(&master->queue_lock, flags); -+ return; -+ } -+ - master->busy = false; - master->idling = true; - spin_unlock_irqrestore(&master->queue_lock, flags); -@@ -1004,6 +1012,18 @@ static void spi_pump_messages(struct kth - } - } - -+/** -+ * spi_pump_messages - kthread work function which processes spi message queue -+ * @work: pointer to kthread work struct contained in the master struct -+ */ -+static void spi_pump_messages(struct kthread_work *work) -+{ -+ struct spi_master *master = -+ container_of(work, struct spi_master, pump_messages); -+ -+ __spi_pump_messages(master, true); -+} -+ - static int spi_init_queue(struct spi_master *master) - { - struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 }; -@@ -2165,7 +2185,7 @@ static int __spi_sync(struct spi_device - * can. - */ - if (master->transfer == spi_queued_transfer) -- spi_pump_messages(&master->pump_messages); -+ __spi_pump_messages(master, false); - - wait_for_completion(&done); - status = message->status; diff --git a/target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch b/target/linux/generic/pending-3.18/095-api-fix-compatibility-of-linux-in.h-with-netinet-in..patch deleted file mode 100644 index 4c5cd596f..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -154,6 +158,7 @@ struct in_addr { - - /* Request struct for multicast socket ops */ - -+#if __UAPI_DEF_IP_MREQ - struct ip_mreq { - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ -@@ -205,14 +210,18 @@ struct group_filter { - #define GROUP_FILTER_SIZE(numsrc) \ - (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ - + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) -+#endif - -+#if __UAPI_DEF_IN_PKTINFO - struct in_pktinfo { - int ipi_ifindex; - struct in_addr ipi_spec_dst; - struct in_addr ipi_addr; - }; -+#endif - - /* Structure describing an Internet (IP) socket address. */ -+#if __UAPI_DEF_SOCKADDR_IN - #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ - struct sockaddr_in { - __kernel_sa_family_t sin_family; /* Address family */ -@@ -224,8 +233,9 @@ struct sockaddr_in { - sizeof(unsigned short int) - sizeof(struct in_addr)]; - }; - #define sin_zero __pad /* for BSD UNIX comp. -FvK */ -+#endif - -- -+#if __UAPI_DEF_IN_CLASS - /* - * Definitions of the bits in an Internet address integer. - * On subnets, host and network parts are found according -@@ -276,7 +286,7 @@ struct sockaddr_in { - #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ - #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ - #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ -- -+#endif - - /* contains the htonl type stuff.. */ - #include ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -56,6 +56,13 @@ - - /* GLIBC headers included first so don't define anything - * that would already be defined. */ -+#define __UAPI_DEF_IN_ADDR 0 -+#define __UAPI_DEF_IN_IPPROTO 0 -+#define __UAPI_DEF_IN_PKTINFO 0 -+#define __UAPI_DEF_IP_MREQ 0 -+#define __UAPI_DEF_SOCKADDR_IN 0 -+#define __UAPI_DEF_IN_CLASS 0 -+ - #define __UAPI_DEF_IN6_ADDR 0 - /* The exception is the in6_addr macros which must be defined - * if the glibc code didn't define them. This guard matches -@@ -76,6 +83,13 @@ - /* Linux headers included first, and we must define everything - * we need. The expectation is that glibc will check the - * __UAPI_DEF_* defines and adjust appropriately. */ -+#define __UAPI_DEF_IN_ADDR 1 -+#define __UAPI_DEF_IN_IPPROTO 1 -+#define __UAPI_DEF_IN_PKTINFO 1 -+#define __UAPI_DEF_IP_MREQ 1 -+#define __UAPI_DEF_SOCKADDR_IN 1 -+#define __UAPI_DEF_IN_CLASS 1 -+ - #define __UAPI_DEF_IN6_ADDR 1 - /* We unconditionally define the in6_addr macros and glibc must - * coordinate. */ -@@ -99,6 +113,14 @@ - * that we need. */ - #else /* !defined(__GLIBC__) */ - -+/* Definitions for in.h */ -+#define __UAPI_DEF_IN_ADDR 1 -+#define __UAPI_DEF_IN_IPPROTO 1 -+#define __UAPI_DEF_IN_PKTINFO 1 -+#define __UAPI_DEF_IP_MREQ 1 -+#define __UAPI_DEF_SOCKADDR_IN 1 -+#define __UAPI_DEF_IN_CLASS 1 -+ - /* Definitions for in6.h */ - #define __UAPI_DEF_IN6_ADDR 1 - #define __UAPI_DEF_IN6_ADDR_ALT 1 diff --git a/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch b/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch deleted file mode 100644 index 352bf6de1..000000000 --- a/target/linux/generic/pending-3.18/099-module_arch_freeing_init-new-hook-for-archs-before-m.patch +++ /dev/null @@ -1,182 +0,0 @@ -From: Rusty Russell -Date: Tue, 20 Jan 2015 09:07:04 +1030 -Subject: [PATCH] module_arch_freeing_init(): new hook for archs before module->module_init freed. - -Archs have been abusing module_free() to clean up their arch-specific -allocations. Since module_free() is also (ab)used by BPF and trace code, -let's keep it to simple allocations, and provide a hook called before -that. - -This means that avr32, ia64, parisc and s390 no longer need to implement -their own module_free() at all. avr32 doesn't need module_finalize() -either. - -Signed-off-by: Rusty Russell -Cc: Chris Metcalf -Cc: Haavard Skinnemoen -Cc: Hans-Christian Egtvedt -Cc: Tony Luck -Cc: Fenghua Yu -Cc: "James E.J. Bottomley" -Cc: Helge Deller -Cc: Martin Schwidefsky -Cc: Heiko Carstens -Cc: linux-kernel@vger.kernel.org -Cc: linux-ia64@vger.kernel.org -Cc: linux-parisc@vger.kernel.org -Cc: linux-s390@vger.kernel.org - -Origin: backport, https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d453cded05ee219b77815ea194dc36efa5398bca ---- - arch/avr32/kernel/module.c | 13 +------------ - arch/ia64/kernel/module.c | 6 ++---- - arch/parisc/kernel/module.c | 6 +----- - arch/s390/kernel/module.c | 10 +++------- - arch/tile/kernel/module.c | 2 +- - include/linux/moduleloader.h | 2 ++ - kernel/module.c | 7 +++++++ - 7 files changed, 17 insertions(+), 29 deletions(-) - ---- a/arch/avr32/kernel/module.c -+++ b/arch/avr32/kernel/module.c -@@ -19,12 +19,10 @@ - #include - #include - --void module_free(struct module *mod, void *module_region) -+void module_arch_freeing_init(struct module *mod) - { - vfree(mod->arch.syminfo); - mod->arch.syminfo = NULL; -- -- vfree(module_region); - } - - static inline int check_rela(Elf32_Rela *rela, struct module *module, -@@ -291,12 +289,3 @@ int apply_relocate_add(Elf32_Shdr *sechd - - return ret; - } -- --int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, -- struct module *module) --{ -- vfree(module->arch.syminfo); -- module->arch.syminfo = NULL; -- -- return 0; --} ---- a/arch/ia64/kernel/module.c -+++ b/arch/ia64/kernel/module.c -@@ -305,14 +305,12 @@ plt_target (struct plt_entry *plt) - #endif /* !USE_BRL */ - - void --module_free (struct module *mod, void *module_region) -+module_arch_freeing_init (struct module *mod) - { -- if (mod && mod->arch.init_unw_table && -- module_region == mod->module_init) { -+ if (mod->arch.init_unw_table) { - unw_remove_unwind_table(mod->arch.init_unw_table); - mod->arch.init_unw_table = NULL; - } -- vfree(module_region); - } - - /* Have we already seen one of these relocations? */ ---- a/arch/parisc/kernel/module.c -+++ b/arch/parisc/kernel/module.c -@@ -298,14 +298,10 @@ static inline unsigned long count_stubs( - } - #endif - -- --/* Free memory returned from module_alloc */ --void module_free(struct module *mod, void *module_region) -+void module_arch_freeing_init(struct module *mod) - { - kfree(mod->arch.section); - mod->arch.section = NULL; -- -- vfree(module_region); - } - - /* Additional bytes needed in front of individual sections */ ---- a/arch/s390/kernel/module.c -+++ b/arch/s390/kernel/module.c -@@ -55,14 +55,10 @@ void *module_alloc(unsigned long size) - } - #endif - --/* Free memory returned from module_alloc */ --void module_free(struct module *mod, void *module_region) -+void module_arch_freeing_init(struct module *mod) - { -- if (mod) { -- vfree(mod->arch.syminfo); -- mod->arch.syminfo = NULL; -- } -- vfree(module_region); -+ vfree(mod->arch.syminfo); -+ mod->arch.syminfo = NULL; - } - - static void check_rela(Elf_Rela *rela, struct module *me) ---- a/arch/tile/kernel/module.c -+++ b/arch/tile/kernel/module.c -@@ -83,7 +83,7 @@ void module_free(struct module *mod, voi - 0, 0, 0, NULL, NULL, 0); - - /* -- * FIXME: If module_region == mod->module_init, trim exception -+ * FIXME: Add module_arch_freeing_init to trim exception - * table entries. - */ - } ---- a/include/linux/moduleloader.h -+++ b/include/linux/moduleloader.h -@@ -82,4 +82,6 @@ int module_finalize(const Elf_Ehdr *hdr, - /* Any cleanup needed when module leaves. */ - void module_arch_cleanup(struct module *mod); - -+/* Any cleanup before freeing mod->module_init */ -+void module_arch_freeing_init(struct module *mod); - #endif ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -1840,6 +1840,10 @@ void __weak module_arch_cleanup(struct m - { - } - -+void __weak module_arch_freeing_init(struct module *mod) -+{ -+} -+ - /* Free a module, remove from lists, etc. */ - static void free_module(struct module *mod) - { -@@ -1872,6 +1876,7 @@ static void free_module(struct module *m - - /* This may be NULL, but that's OK */ - unset_module_init_ro_nx(mod); -+ module_arch_freeing_init(mod); - module_free(mod, mod->module_init); - kfree(mod->args); - percpu_modfree(mod); -@@ -2983,6 +2988,7 @@ static struct module *layout_and_allocat - static void module_deallocate(struct module *mod, struct load_info *info) - { - percpu_modfree(mod); -+ module_arch_freeing_init(mod); - module_free(mod, mod->module_init); - module_free(mod, mod->module_core); - } -@@ -3105,6 +3111,7 @@ static int do_init_module(struct module - rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms); - #endif - unset_module_init_ro_nx(mod); -+ module_arch_freeing_init(mod); - module_free(mod, mod->module_init); - mod->module_init = NULL; - mod->init_size = 0; diff --git a/target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch b/target/linux/generic/pending-3.18/102-ehci_hcd_ignore_oc.patch deleted file mode 100644 index a5645596f..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -633,7 +633,7 @@ static int ehci_run (struct usb_hcd *hcd - "USB %x.%x started, EHCI %x.%02x%s\n", - ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), - temp >> 8, temp & 0xff, -- ignore_oc ? ", overcurrent ignored" : ""); -+ (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : ""); - - ehci_writel(ehci, INTR_MASK, - &ehci->regs->intr_enable); /* Turn On Interrupts */ ---- a/drivers/usb/host/ehci-hub.c -+++ b/drivers/usb/host/ehci-hub.c -@@ -635,7 +635,7 @@ ehci_hub_status_data (struct usb_hcd *hc - * always set, seem to clear PORT_OCC and PORT_CSC when writing to - * PORT_POWER; that's surprising, but maybe within-spec. - */ -- if (!ignore_oc) -+ if (!ignore_oc && !ehci->ignore_oc) - mask = PORT_CSC | PORT_PEC | PORT_OCC; - else - mask = PORT_CSC | PORT_PEC; -@@ -995,7 +995,7 @@ int ehci_hub_control( - if (temp & PORT_PEC) - status |= USB_PORT_STAT_C_ENABLE << 16; - -- if ((temp & PORT_OCC) && !ignore_oc){ -+ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){ - status |= USB_PORT_STAT_C_OVERCURRENT << 16; - - /* ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -226,6 +226,8 @@ static int ehci_platform_probe(struct pl - ehci->big_endian_desc = 1; - if (pdata->big_endian_mmio) - ehci->big_endian_mmio = 1; -+ if (pdata->ignore_oc) -+ ehci->ignore_oc = 1; - - #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO - if (ehci->big_endian_mmio) { ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -226,6 +226,7 @@ struct ehci_hcd { /* one per controlle - unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ - unsigned need_oc_pp_cycle:1; /* MPC834X port power */ - unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ -+ unsigned ignore_oc:1; - - /* required for usb32 quirk */ - #define OHCI_CTRL_HCFS (3 << 6) ---- a/include/linux/usb/ehci_pdriver.h -+++ b/include/linux/usb/ehci_pdriver.h -@@ -45,6 +45,7 @@ struct usb_ehci_pdata { - unsigned big_endian_desc:1; - unsigned big_endian_mmio:1; - unsigned no_io_watchdog:1; -+ unsigned ignore_oc:1; - - /* Turn on all power and clocks */ - int (*power_on)(struct platform_device *pdev); diff --git a/target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch b/target/linux/generic/pending-3.18/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch deleted file mode 100644 index f671db6e9..000000000 --- a/target/linux/generic/pending-3.18/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 (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f) - inc_nlink(new_dir_i); - -- /* Unlink the original */ -- ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -- old_dentry->d_name.name, old_dentry->d_name.len, NULL, now); -+ if (flags & RENAME_WHITEOUT) -+ /* Replace with whiteout */ -+ ret = jffs2_whiteout(old_dir_i, old_dentry); -+ else -+ /* Unlink the original */ -+ ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -+ old_dentry->d_name.name, -+ old_dentry->d_name.len, NULL, now); - - /* We don't touch inode->i_nlink */ - diff --git a/target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch b/target/linux/generic/pending-3.18/111-jffs2-add-RENAME_EXCHANGE-support.patch deleted file mode 100644 index be87c3507..000000000 --- a/target/linux/generic/pending-3.18/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 (new_dentry->d_inode) { -+ if (new_dentry->d_inode && !(flags & RENAME_EXCHANGE)) { - victim_f = JFFS2_INODE_INFO(new_dentry->d_inode); - if (S_ISDIR(new_dentry->d_inode->i_mode)) { - struct jffs2_full_dirent *fd; -@@ -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 (S_ISDIR(new_dentry->d_inode->i_mode)) - clear_nlink(new_dentry->d_inode); -@@ -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), -+ new_dentry->d_inode->i_ino, type, -+ old_dentry->d_name.name, old_dentry->d_name.len, -+ now); - else - /* Unlink the original */ - ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), -@@ -879,7 +885,7 @@ static int jffs2_rename (struct inode *o - return ret; - } - -- if (S_ISDIR(old_dentry->d_inode->i_mode)) -+ if (S_ISDIR(old_dentry->d_inode->i_mode) && !(flags & RENAME_EXCHANGE)) - drop_nlink(old_dir_i); - - new_dir_i->i_mtime = new_dir_i->i_ctime = old_dir_i->i_mtime = old_dir_i->i_ctime = ITIME(now); diff --git a/target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-3.18/120-bridge_allow_receiption_on_disabled_port.patch deleted file mode 100644 index 909611403..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -146,11 +146,13 @@ EXPORT_SYMBOL_GPL(br_handle_frame_finish - static int br_handle_local_finish(struct sk_buff *skb) - { - struct net_bridge_port *p = br_port_get_rcu(skb->dev); -- u16 vid = 0; -+ if (p->state != BR_STATE_DISABLED) { -+ u16 vid = 0; - -- /* check if vlan is allowed, to avoid spoofing */ -- if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid)) -- br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false); -+ /* check if vlan is allowed, to avoid spoofing */ -+ if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid)) -+ br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false); -+ } - return 0; /* process further */ - } - -@@ -224,6 +226,18 @@ rx_handler_result_t br_handle_frame(stru - - forward: - switch (p->state) { -+ case BR_STATE_DISABLED: -+ if (ether_addr_equal(p->br->dev->dev_addr, dest)) -+ skb->pkt_type = PACKET_HOST; -+ -+ if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, -+ br_handle_local_finish)) -+ break; -+ -+ BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; -+ br_pass_frame_up(skb); -+ break; -+ - case BR_STATE_FORWARDING: - rhook = rcu_dereference(br_should_route_hook); - if (rhook) { diff --git a/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch b/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch deleted file mode 100644 index c008aea41..000000000 --- a/target/linux/generic/pending-3.18/132-mips_inline_dma_ops.patch +++ /dev/null @@ -1,688 +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 -@@ -1450,6 +1450,7 @@ config CPU_CAVIUM_OCTEON - select CPU_SUPPORTS_HUGEPAGES - select USB_EHCI_BIG_ENDIAN_MMIO - select MIPS_L1_CACHE_SHIFT_7 -+ select SYS_HAS_DMA_OPS - help - The Cavium Octeon processor is a highly integrated chip containing - many ethernet hardware widgets for networking tasks. The processor -@@ -1705,6 +1706,9 @@ config MIPS_MALTA_PM - bool - default y - -+config SYS_HAS_DMA_OPS -+ bool -+ - # - # CPU may reorder R->R, R->W, W->R, W->W - # Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC ---- a/arch/mips/include/asm/dma-mapping.h -+++ b/arch/mips/include/asm/dma-mapping.h -@@ -1,9 +1,16 @@ - #ifndef _ASM_DMA_MAPPING_H - #define _ASM_DMA_MAPPING_H - -+#include -+#include -+#include -+#include -+#include -+ - #include - #include - #include -+#include - #include - - #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */ -@@ -12,12 +19,48 @@ - - extern struct dma_map_ops *mips_dma_map_ops; - -+void __dma_sync(struct page *page, unsigned long offset, size_t size, -+ enum dma_data_direction direction); -+void *mips_dma_alloc_coherent(struct device *dev, size_t size, -+ dma_addr_t *dma_handle, gfp_t gfp, -+ struct dma_attrs *attrs); -+void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, -+ dma_addr_t dma_handle, struct dma_attrs *attrs); -+ - static inline struct dma_map_ops *get_dma_ops(struct device *dev) - { -+#ifdef CONFIG_SYS_HAS_DMA_OPS - if (dev && dev->archdata.dma_ops) - return dev->archdata.dma_ops; - else - return mips_dma_map_ops; -+#else -+ return NULL; -+#endif -+} -+ -+/* -+ * Warning on the terminology - Linux calls an uncached area coherent; -+ * MIPS terminology calls memory areas with hardware maintained coherency -+ * coherent. -+ */ -+ -+static inline int cpu_needs_post_dma_flush(struct device *dev) -+{ -+#ifndef CONFIG_SYS_HAS_CPU_R10000 -+ return 0; -+#endif -+ return !plat_device_is_coherent(dev) && -+ (boot_cpu_type() == CPU_R10000 || -+ boot_cpu_type() == CPU_R12000 || -+ boot_cpu_type() == CPU_BMIPS5000); -+} -+ -+static inline struct page *dma_addr_to_page(struct device *dev, -+ dma_addr_t dma_addr) -+{ -+ return pfn_to_page( -+ plat_dma_addr_to_phys(dev, dma_addr) >> PAGE_SHIFT); - } - - static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) -@@ -30,12 +73,304 @@ static inline bool dma_capable(struct de - - static inline void dma_mark_clean(void *addr, size_t size) {} - --#include -+static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, -+ size_t size, -+ enum dma_data_direction dir, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ unsigned long offset = (unsigned long)ptr & ~PAGE_MASK; -+ struct page *page = virt_to_page(ptr); -+ dma_addr_t addr; -+ -+ kmemcheck_mark_initialized(ptr, size); -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ addr = ops->map_page(dev, page, offset, size, dir, attrs); -+ } else { -+ if (!plat_device_is_coherent(dev)) -+ __dma_sync(page, offset, size, dir); -+ -+ addr = plat_map_dma_mem_page(dev, page) + offset; -+ } -+ debug_dma_map_page(dev, page, offset, size, dir, addr, true); -+ return addr; -+} -+ -+static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, -+ size_t size, -+ enum dma_data_direction dir, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ ops->unmap_page(dev, addr, size, dir, attrs); -+ } else { -+ if (cpu_needs_post_dma_flush(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr), -+ addr & ~PAGE_MASK, size, dir); -+ -+ plat_unmap_dma_mem(dev, addr, size, dir); -+ } -+ debug_dma_unmap_page(dev, addr, size, dir, true); -+} -+ -+static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, -+ int nents, enum dma_data_direction dir, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ int i, ents; -+ struct scatterlist *s; -+ -+ for_each_sg(sg, s, nents, i) -+ kmemcheck_mark_initialized(sg_virt(s), s->length); -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ ents = ops->map_sg(dev, sg, nents, dir, attrs); -+ } else { -+ for_each_sg(sg, s, nents, i) { -+ struct page *page = sg_page(s); -+ -+ if (!plat_device_is_coherent(dev)) -+ __dma_sync(page, s->offset, s->length, dir); -+#ifdef CONFIG_NEED_SG_DMA_LENGTH -+ s->dma_length = s->length; -+#endif -+ s->dma_address = -+ plat_map_dma_mem_page(dev, page) + s->offset; -+ } -+ ents = nents; -+ } -+ debug_dma_map_sg(dev, sg, nents, ents, dir); -+ -+ return ents; -+} -+ -+static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg, -+ int nents, enum dma_data_direction dir, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ struct scatterlist *s; -+ int i; -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ debug_dma_unmap_sg(dev, sg, nents, dir); -+ if (ops) { -+ ops->unmap_sg(dev, sg, nents, dir, attrs); -+ return; -+ } -+ -+ for_each_sg(sg, s, nents, i) { -+ if (!plat_device_is_coherent(dev) && dir != DMA_TO_DEVICE) -+ __dma_sync(sg_page(s), s->offset, s->length, dir); -+ plat_unmap_dma_mem(dev, s->dma_address, s->length, dir); -+ } -+} -+ -+static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, -+ size_t offset, size_t size, -+ enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ dma_addr_t addr; -+ -+ kmemcheck_mark_initialized(page_address(page) + offset, size); -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ addr = ops->map_page(dev, page, offset, size, dir, NULL); -+ } else { -+ if (!plat_device_is_coherent(dev)) -+ __dma_sync(page, offset, size, dir); -+ -+ addr = plat_map_dma_mem_page(dev, page) + offset; -+ } -+ debug_dma_map_page(dev, page, offset, size, dir, addr, false); -+ -+ return addr; -+} -+ -+static inline void dma_unmap_page(struct device *dev, dma_addr_t addr, -+ size_t size, enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) { -+ ops->unmap_page(dev, addr, size, dir, NULL); -+ } else { -+ if (cpu_needs_post_dma_flush(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr), -+ addr & ~PAGE_MASK, size, dir); -+ -+ plat_unmap_dma_mem(dev, addr, size, dir); -+ } -+ debug_dma_unmap_page(dev, addr, size, dir, false); -+} -+ -+static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, -+ size_t size, -+ enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_single_for_cpu(dev, addr, size, dir); -+ else if (cpu_needs_post_dma_flush(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr), -+ addr & ~PAGE_MASK, size, dir); -+ debug_dma_sync_single_for_cpu(dev, addr, size, dir); -+} -+ -+static inline void dma_sync_single_for_device(struct device *dev, -+ dma_addr_t addr, size_t size, -+ enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_single_for_device(dev, addr, size, dir); -+ else if (!plat_device_is_coherent(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr), -+ addr & ~PAGE_MASK, size, dir); -+ debug_dma_sync_single_for_device(dev, addr, size, dir); -+} -+ -+static inline void dma_sync_single_range_for_cpu(struct device *dev, -+ dma_addr_t addr, -+ unsigned long offset, -+ size_t size, -+ enum dma_data_direction dir) -+{ -+ const struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_single_for_cpu(dev, addr + offset, size, dir); -+ else if (cpu_needs_post_dma_flush(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr + offset), -+ (addr + offset) & ~PAGE_MASK, size, dir); -+ debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); -+} -+ -+static inline void dma_sync_single_range_for_device(struct device *dev, -+ dma_addr_t addr, -+ unsigned long offset, -+ size_t size, -+ enum dma_data_direction dir) -+{ -+ const struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_single_for_device(dev, addr + offset, size, dir); -+ else if (!plat_device_is_coherent(dev)) -+ __dma_sync(dma_addr_to_page(dev, addr + offset), -+ (addr + offset) & ~PAGE_MASK, size, dir); -+ debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); -+} -+ -+static inline void -+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, -+ int nelems, enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ struct scatterlist *s; -+ int i; -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_sg_for_cpu(dev, sg, nelems, dir); -+ else if (cpu_needs_post_dma_flush(dev)) { -+ for_each_sg(sg, s, nelems, i) -+ __dma_sync(sg_page(s), s->offset, s->length, dir); -+ } -+ debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir); -+} -+ -+static inline void -+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, -+ int nelems, enum dma_data_direction dir) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ struct scatterlist *s; -+ int i; -+ -+ BUG_ON(!valid_dma_direction(dir)); -+ if (ops) -+ ops->sync_sg_for_device(dev, sg, nelems, dir); -+ else if (!plat_device_is_coherent(dev)) { -+ for_each_sg(sg, s, nelems, i) -+ __dma_sync(sg_page(s), s->offset, s->length, dir); -+ } -+ debug_dma_sync_sg_for_device(dev, sg, nelems, dir); -+ -+} -+ -+#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL) -+#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL) -+#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL) -+#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL) -+ -+extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, -+ void *cpu_addr, dma_addr_t dma_addr, size_t size); -+ -+/** -+ * dma_mmap_attrs - map a coherent DMA allocation into user space -+ * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices -+ * @vma: vm_area_struct describing requested user mapping -+ * @cpu_addr: kernel CPU-view address returned from dma_alloc_attrs -+ * @handle: device-view address returned from dma_alloc_attrs -+ * @size: size of memory originally requested in dma_alloc_attrs -+ * @attrs: attributes of mapping properties requested in dma_alloc_attrs -+ * -+ * Map a coherent DMA buffer previously allocated by dma_alloc_attrs -+ * into user space. The coherent DMA buffer must not be freed by the -+ * driver until the user space mapping has been released. -+ */ -+static inline int -+dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, -+ dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ BUG_ON(!ops); -+ if (ops && ops->mmap) -+ return ops->mmap(dev, vma, cpu_addr, dma_addr, size, attrs); -+ return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size); -+} -+ -+#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) -+ -+int -+dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, -+ void *cpu_addr, dma_addr_t dma_addr, size_t size); -+ -+static inline int -+dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr, -+ dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ BUG_ON(!ops); -+ if (ops && ops->get_sgtable) -+ return ops->get_sgtable(dev, sgt, cpu_addr, dma_addr, size, -+ attrs); -+ return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size); -+} -+ -+#define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, NULL) -+ - - static inline int dma_supported(struct device *dev, u64 mask) - { - struct dma_map_ops *ops = get_dma_ops(dev); -- return ops->dma_supported(dev, mask); -+ if (ops) -+ return ops->dma_supported(dev, mask); -+ return plat_dma_supported(dev, mask); - } - - static inline int dma_mapping_error(struct device *dev, u64 mask) -@@ -43,7 +378,9 @@ static inline int dma_mapping_error(stru - struct dma_map_ops *ops = get_dma_ops(dev); - - debug_dma_mapping_error(dev, mask); -- return ops->mapping_error(dev, mask); -+ if (ops) -+ return ops->mapping_error(dev, mask); -+ return 0; - } - - static inline int -@@ -54,7 +391,7 @@ dma_set_mask(struct device *dev, u64 mas - if(!dev->dma_mask || !dma_supported(dev, mask)) - return -EIO; - -- if (ops->set_dma_mask) -+ if (ops && ops->set_dma_mask) - return ops->set_dma_mask(dev, mask); - - *dev->dma_mask = mask; -@@ -74,7 +411,11 @@ static inline void *dma_alloc_attrs(stru - void *ret; - struct dma_map_ops *ops = get_dma_ops(dev); - -- ret = ops->alloc(dev, size, dma_handle, gfp, attrs); -+ if (ops) -+ ret = ops->alloc(dev, size, dma_handle, gfp, attrs); -+ else -+ ret = mips_dma_alloc_coherent(dev, size, dma_handle, gfp, -+ attrs); - - debug_dma_alloc_coherent(dev, size, *dma_handle, ret); - -@@ -89,7 +430,10 @@ static inline void dma_free_attrs(struct - { - struct dma_map_ops *ops = get_dma_ops(dev); - -- ops->free(dev, size, vaddr, dma_handle, attrs); -+ if (ops) -+ ops->free(dev, size, vaddr, dma_handle, attrs); -+ else -+ mips_dma_free_coherent(dev, size, vaddr, dma_handle, attrs); - - debug_dma_free_coherent(dev, size, vaddr, dma_handle); - } ---- a/arch/mips/mm/dma-default.c -+++ b/arch/mips/mm/dma-default.c -@@ -26,7 +26,7 @@ - - #ifdef CONFIG_DMA_MAYBE_COHERENT - int coherentio = 0; /* User defined DMA coherency from command line. */ --EXPORT_SYMBOL_GPL(coherentio); -+EXPORT_SYMBOL(coherentio); - int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */ - - static int __init setcoherentio(char *str) -@@ -46,30 +46,6 @@ static int __init setnocoherentio(char * - early_param("nocoherentio", setnocoherentio); - #endif - --static inline struct page *dma_addr_to_page(struct device *dev, -- dma_addr_t dma_addr) --{ -- return pfn_to_page( -- plat_dma_addr_to_phys(dev, dma_addr) >> PAGE_SHIFT); --} -- --/* -- * The affected CPUs below in 'cpu_needs_post_dma_flush()' can -- * speculatively fill random cachelines with stale data at any time, -- * requiring an extra flush post-DMA. -- * -- * Warning on the terminology - Linux calls an uncached area coherent; -- * MIPS terminology calls memory areas with hardware maintained coherency -- * coherent. -- */ --static inline int cpu_needs_post_dma_flush(struct device *dev) --{ -- return !plat_device_is_coherent(dev) && -- (boot_cpu_type() == CPU_R10000 || -- boot_cpu_type() == CPU_R12000 || -- boot_cpu_type() == CPU_BMIPS5000); --} -- - static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp) - { - gfp_t dma_flag; -@@ -125,8 +101,9 @@ void *dma_alloc_noncoherent(struct devic - } - EXPORT_SYMBOL(dma_alloc_noncoherent); - --static void *mips_dma_alloc_coherent(struct device *dev, size_t size, -- dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs) -+void *mips_dma_alloc_coherent(struct device *dev, size_t size, -+ dma_addr_t *dma_handle, gfp_t gfp, -+ struct dma_attrs *attrs) - { - void *ret; - struct page *page = NULL; -@@ -157,6 +134,7 @@ static void *mips_dma_alloc_coherent(str - - return ret; - } -+EXPORT_SYMBOL(mips_dma_alloc_coherent); - - - void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr, -@@ -167,8 +145,8 @@ void dma_free_noncoherent(struct device - } - EXPORT_SYMBOL(dma_free_noncoherent); - --static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, -- dma_addr_t dma_handle, struct dma_attrs *attrs) -+void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, -+ dma_addr_t dma_handle, struct dma_attrs *attrs) - { - unsigned long addr = (unsigned long) vaddr; - int order = get_order(size); -@@ -188,6 +166,7 @@ static void mips_dma_free_coherent(struc - if (!dma_release_from_contiguous(dev, page, count)) - __free_pages(page, get_order(size)); - } -+EXPORT_SYMBOL(mips_dma_free_coherent); - - static inline void __dma_sync_virtual(void *addr, size_t size, - enum dma_data_direction direction) -@@ -216,8 +195,8 @@ static inline void __dma_sync_virtual(vo - * If highmem is not configured then the bulk of this loop gets - * optimized out. - */ --static inline void __dma_sync(struct page *page, -- unsigned long offset, size_t size, enum dma_data_direction direction) -+void __dma_sync(struct page *page, unsigned long offset, size_t size, -+ enum dma_data_direction direction) - { - size_t left = size; - -@@ -246,108 +225,7 @@ static inline void __dma_sync(struct pag - left -= len; - } while (left); - } -- --static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, -- size_t size, enum dma_data_direction direction, struct dma_attrs *attrs) --{ -- if (cpu_needs_post_dma_flush(dev)) -- __dma_sync(dma_addr_to_page(dev, dma_addr), -- dma_addr & ~PAGE_MASK, size, direction); -- -- plat_unmap_dma_mem(dev, dma_addr, size, direction); --} -- --static int mips_dma_map_sg(struct device *dev, struct scatterlist *sg, -- int nents, enum dma_data_direction direction, struct dma_attrs *attrs) --{ -- int i; -- -- for (i = 0; i < nents; i++, sg++) { -- if (!plat_device_is_coherent(dev)) -- __dma_sync(sg_page(sg), sg->offset, sg->length, -- direction); --#ifdef CONFIG_NEED_SG_DMA_LENGTH -- sg->dma_length = sg->length; --#endif -- sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) + -- sg->offset; -- } -- -- return nents; --} -- --static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page, -- unsigned long offset, size_t size, enum dma_data_direction direction, -- struct dma_attrs *attrs) --{ -- if (!plat_device_is_coherent(dev)) -- __dma_sync(page, offset, size, direction); -- -- return plat_map_dma_mem_page(dev, page) + offset; --} -- --static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg, -- int nhwentries, enum dma_data_direction direction, -- struct dma_attrs *attrs) --{ -- int i; -- -- for (i = 0; i < nhwentries; i++, sg++) { -- if (!plat_device_is_coherent(dev) && -- direction != DMA_TO_DEVICE) -- __dma_sync(sg_page(sg), sg->offset, sg->length, -- direction); -- plat_unmap_dma_mem(dev, sg->dma_address, sg->length, direction); -- } --} -- --static void mips_dma_sync_single_for_cpu(struct device *dev, -- dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) --{ -- if (cpu_needs_post_dma_flush(dev)) -- __dma_sync(dma_addr_to_page(dev, dma_handle), -- dma_handle & ~PAGE_MASK, size, direction); --} -- --static void mips_dma_sync_single_for_device(struct device *dev, -- dma_addr_t dma_handle, size_t size, enum dma_data_direction direction) --{ -- if (!plat_device_is_coherent(dev)) -- __dma_sync(dma_addr_to_page(dev, dma_handle), -- dma_handle & ~PAGE_MASK, size, direction); --} -- --static void mips_dma_sync_sg_for_cpu(struct device *dev, -- struct scatterlist *sg, int nelems, enum dma_data_direction direction) --{ -- int i; -- -- if (cpu_needs_post_dma_flush(dev)) -- for (i = 0; i < nelems; i++, sg++) -- __dma_sync(sg_page(sg), sg->offset, sg->length, -- direction); --} -- --static void mips_dma_sync_sg_for_device(struct device *dev, -- struct scatterlist *sg, int nelems, enum dma_data_direction direction) --{ -- int i; -- -- if (!plat_device_is_coherent(dev)) -- for (i = 0; i < nelems; i++, sg++) -- __dma_sync(sg_page(sg), sg->offset, sg->length, -- direction); --} -- --int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) --{ -- return 0; --} -- --int mips_dma_supported(struct device *dev, u64 mask) --{ -- return plat_dma_supported(dev, mask); --} -+EXPORT_SYMBOL(__dma_sync); - - void dma_cache_sync(struct device *dev, void *vaddr, size_t size, - enum dma_data_direction direction) -@@ -360,23 +238,10 @@ void dma_cache_sync(struct device *dev, - - EXPORT_SYMBOL(dma_cache_sync); - --static struct dma_map_ops mips_default_dma_map_ops = { -- .alloc = mips_dma_alloc_coherent, -- .free = mips_dma_free_coherent, -- .map_page = mips_dma_map_page, -- .unmap_page = mips_dma_unmap_page, -- .map_sg = mips_dma_map_sg, -- .unmap_sg = mips_dma_unmap_sg, -- .sync_single_for_cpu = mips_dma_sync_single_for_cpu, -- .sync_single_for_device = mips_dma_sync_single_for_device, -- .sync_sg_for_cpu = mips_dma_sync_sg_for_cpu, -- .sync_sg_for_device = mips_dma_sync_sg_for_device, -- .mapping_error = mips_dma_mapping_error, -- .dma_supported = mips_dma_supported --}; -- --struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops; -+#ifdef CONFIG_SYS_HAS_DMA_OPS -+struct dma_map_ops *mips_dma_map_ops = NULL; - EXPORT_SYMBOL(mips_dma_map_ops); -+#endif - - #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) - diff --git a/target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch deleted file mode 100644 index bd34f9698..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -114,45 +114,9 @@ static struct mtd_info *obsolete_probe(s - static const char * const part_probe_types_def[] = { - "cmdlinepart", "RedBoot", "ofpart", "ofoldpart", NULL }; - --static const char * const *of_get_probes(struct device_node *dp) --{ -- const char *cp; -- int cplen; -- unsigned int l; -- unsigned int count; -- const char **res; -- -- cp = of_get_property(dp, "linux,part-probe", &cplen); -- if (cp == NULL) -- return part_probe_types_def; -- -- count = 0; -- for (l = 0; l != cplen; l++) -- if (cp[l] == 0) -- count++; -- -- res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL); -- count = 0; -- while (cplen > 0) { -- res[count] = cp; -- l = strlen(cp) + 1; -- cp += l; -- cplen -= l; -- count++; -- } -- return res; --} -- --static void of_free_probes(const char * const *probes) --{ -- if (probes != part_probe_types_def) -- kfree(probes); --} -- - static struct of_device_id of_flash_match[]; - static int of_flash_probe(struct platform_device *dev) - { -- const char * const *part_probe_types; - const struct of_device_id *match; - struct device_node *dp = dev->dev.of_node; - struct resource res; -@@ -302,10 +266,8 @@ static int of_flash_probe(struct platfor - goto err_out; - - ppdata.of_node = dp; -- part_probe_types = of_get_probes(dp); -- mtd_device_parse_register(info->cmtd, part_probe_types, &ppdata, -+ mtd_device_parse_register(info->cmtd, part_probe_types_def, &ppdata, - NULL, 0); -- of_free_probes(part_probe_types); - - kfree(mtd_list); - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - - #include "mtdcore.h" -@@ -702,6 +703,40 @@ void deregister_mtd_parser(struct mtd_pa - EXPORT_SYMBOL_GPL(deregister_mtd_parser); - - /* -+ * Parses the linux,part-probe device tree property. -+ * When a non null value is returned it has to be freed with kfree() by -+ * the caller. -+ */ -+static const char * const *of_get_probes(struct device_node *dp) -+{ -+ const char *cp; -+ int cplen; -+ unsigned int l; -+ unsigned int count; -+ const char **res; -+ -+ cp = of_get_property(dp, "linux,part-probe", &cplen); -+ if (cp == NULL) -+ return NULL; -+ -+ count = 0; -+ for (l = 0; l != cplen; l++) -+ if (cp[l] == 0) -+ count++; -+ -+ res = kzalloc((count + 1) * sizeof(*res), GFP_KERNEL); -+ count = 0; -+ while (cplen > 0) { -+ res[count] = cp; -+ l = strlen(cp) + 1; -+ cp += l; -+ cplen -= l; -+ count++; -+ } -+ return res; -+} -+ -+/* - * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you - * are changing this array! - */ -@@ -737,6 +772,13 @@ int parse_mtd_partitions(struct mtd_info - { - struct mtd_part_parser *parser; - int ret = 0; -+ const char *const *types_of = NULL; -+ -+ if (data && data->of_node) { -+ types_of = of_get_probes(data->of_node); -+ if (types_of != NULL) -+ types = types_of; -+ } - - if (!types) - types = default_mtd_part_types; -@@ -755,6 +797,7 @@ int parse_mtd_partitions(struct mtd_info - break; - } - } -+ kfree(types_of); - return ret; - } - diff --git a/target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch b/target/linux/generic/pending-3.18/142-mtd-bcm47xxpart-don-t-fail-because-of-bit-flips.patch deleted file mode 100644 index 926de5fef..000000000 --- a/target/linux/generic/pending-3.18/142-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; - } - -@@ -252,10 +256,11 @@ static int bcm47xxpart_parse(struct mtd_ - } - - /* Read middle of the block */ -- if (mtd_read(master, offset + 0x8000, 0x4, -- &bytes_read, (uint8_t *)buf) < 0) { -- pr_err("mtd_read error while parsing (offset: 0x%X)!\n", -- offset); -+ err = mtd_read(master, offset + 0x8000, 0x4, &bytes_read, -+ (uint8_t *)buf); -+ if (err && !mtd_is_bitflip(err)) { -+ pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", -+ offset, err); - continue; - } - -@@ -275,10 +280,11 @@ static int bcm47xxpart_parse(struct mtd_ - } - - offset = master->size - possible_nvram_sizes[i]; -- if (mtd_read(master, offset, 0x4, &bytes_read, -- (uint8_t *)buf) < 0) { -- pr_err("mtd_read error while reading at offset 0x%X!\n", -- offset); -+ err = mtd_read(master, offset, 0x4, &bytes_read, -+ (uint8_t *)buf); -+ if (err && !mtd_is_bitflip(err)) { -+ pr_err("mtd_read error while reading (offset 0x%X): %d\n", -+ offset, err); - continue; - } - diff --git a/target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch b/target/linux/generic/pending-3.18/180-usb-xhci-make-USB_XHCI_PLATFORM-selectable.patch deleted file mode 100644 index a17e39800..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch b/target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch deleted file mode 100644 index 632384d56..000000000 --- a/target/linux/generic/pending-3.18/190-cdc_ncm_add_support_for_moving_ndp_to_end_of_ncm_frame.patch +++ /dev/null @@ -1,228 +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 -@@ -684,10 +684,12 @@ static void cdc_ncm_free(struct cdc_ncm_ - ctx->tx_curr_skb = NULL; - } - -+ kfree(ctx->delayed_ndp16); -+ - kfree(ctx); - } - --int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) -+int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags) - { - const struct usb_cdc_union_desc *union_desc = NULL; - struct cdc_ncm_ctx *ctx; -@@ -859,6 +861,17 @@ advance: - /* finish setting up the device specific data */ - cdc_ncm_setup(dev); - -+ /* Device-specific flags */ -+ ctx->drvflags = drvflags; -+ -+ /* Allocate the delayed NDP if needed. */ -+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { -+ ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL); -+ if (!ctx->delayed_ndp16) -+ goto error2; -+ dev_info(&intf->dev, "NDP will be placed at end of frame for this device."); -+ } -+ - /* override ethtool_ops */ - dev->net->ethtool_ops = &cdc_ncm_ethtool_ops; - -@@ -956,8 +969,11 @@ static int cdc_ncm_bind(struct usbnet *d - if (cdc_ncm_select_altsetting(intf) != CDC_NCM_COMM_ALTSETTING_NCM) - return -ENODEV; - -- /* The NCM data altsetting is fixed */ -- return cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM); -+ /* The NCM data altsetting is fixed, so we hard-coded it. -+ * Additionally, generic NCM devices are assumed to accept arbitrarily -+ * placed NDP. -+ */ -+ return cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM, 0); - } - - static void cdc_ncm_align_tail(struct sk_buff *skb, size_t modulus, size_t remainder, size_t max) -@@ -979,6 +995,14 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm - struct usb_cdc_ncm_nth16 *nth16 = (void *)skb->data; - size_t ndpoffset = le16_to_cpu(nth16->wNdpIndex); - -+ /* If NDP should be moved to the end of the NCM package, we can't follow the -+ * NTH16 header as we would normally do. NDP isn't written to the SKB yet, and -+ * the wNdpIndex field in the header is actually not consistent with reality. It will be later. -+ */ -+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) -+ if (ctx->delayed_ndp16->dwSignature == sign) -+ return ctx->delayed_ndp16; -+ - /* follow the chain of NDPs, looking for a match */ - while (ndpoffset) { - ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset); -@@ -988,7 +1012,8 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm - } - - /* align new NDP */ -- cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); -+ if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) -+ cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); - - /* verify that there is room for the NDP and the datagram (reserve) */ - if ((ctx->tx_max - skb->len - reserve) < ctx->max_ndp_size) -@@ -1001,7 +1026,11 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm - nth16->wNdpIndex = cpu_to_le16(skb->len); - - /* push a new empty NDP */ -- ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); -+ if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)) -+ ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); -+ else -+ ndp16 = ctx->delayed_ndp16; -+ - ndp16->dwSignature = sign; - ndp16->wLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_ndp16) + sizeof(struct usb_cdc_ncm_dpe16)); - return ndp16; -@@ -1016,6 +1045,15 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev - struct sk_buff *skb_out; - u16 n = 0, index, ndplen; - u8 ready2send = 0; -+ u32 delayed_ndp_size; -+ -+ /* When our NDP gets written in cdc_ncm_ndp(), then skb_out->len gets updated -+ * accordingly. Otherwise, we should check here. -+ */ -+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) -+ delayed_ndp_size = ctx->max_ndp_size; -+ else -+ delayed_ndp_size = 0; - - /* if there is a remaining skb, it gets priority */ - if (skb != NULL) { -@@ -1070,7 +1108,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev - cdc_ncm_align_tail(skb_out, ctx->tx_modulus, ctx->tx_remainder, ctx->tx_max); - - /* check if we had enough room left for both NDP and frame */ -- if (!ndp16 || skb_out->len + skb->len > ctx->tx_max) { -+ if (!ndp16 || skb_out->len + skb->len + delayed_ndp_size > ctx->tx_max) { - if (n == 0) { - /* won't fit, MTU problem? */ - dev_kfree_skb_any(skb); -@@ -1143,6 +1181,17 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev - /* variables will be reset at next call */ - } - -+ /* If requested, put NDP at end of frame. */ -+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) { -+ nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data; -+ cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max); -+ nth16->wNdpIndex = cpu_to_le16(skb_out->len); -+ memcpy(skb_put(skb_out, ctx->max_ndp_size), ctx->delayed_ndp16, ctx->max_ndp_size); -+ -+ /* Zero out delayed NDP - signature checking will naturally fail. */ -+ ndp16 = memset(ctx->delayed_ndp16, 0, ctx->max_ndp_size); -+ } -+ - /* If collected data size is less or equal ctx->min_tx_pkt - * bytes, we send buffers as it is. If we get more data, it - * would be more efficient for USB HS mobile device with DMA ---- a/drivers/net/usb/huawei_cdc_ncm.c -+++ b/drivers/net/usb/huawei_cdc_ncm.c -@@ -73,11 +73,14 @@ static int huawei_cdc_ncm_bind(struct us - struct usb_driver *subdriver = ERR_PTR(-ENODEV); - int ret = -ENODEV; - struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data; -+ int drvflags = 0; - - /* altsetting should always be 1 for NCM devices - so we hard-coded -- * it here -+ * it here. Some huawei devices will need the NDP part of the NCM package to -+ * be at the end of the frame. - */ -- ret = cdc_ncm_bind_common(usbnet_dev, intf, 1); -+ drvflags |= CDC_NCM_FLAG_NDP_TO_END; -+ ret = cdc_ncm_bind_common(usbnet_dev, intf, 1, drvflags); - if (ret) - goto err; - ---- a/include/linux/usb/cdc_ncm.h -+++ b/include/linux/usb/cdc_ncm.h -@@ -80,6 +80,9 @@ - #define CDC_NCM_TIMER_INTERVAL_MIN 5UL - #define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC) - -+/* Driver flags */ -+#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */ -+ - #define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ - (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) - #define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) -@@ -103,9 +106,11 @@ struct cdc_ncm_ctx { - - spinlock_t mtx; - atomic_t stop; -+ int drvflags; - - u32 timer_interval; - u32 max_ndp_size; -+ struct usb_cdc_ncm_ndp16 *delayed_ndp16; - - u32 tx_timer_pending; - u32 tx_curr_frame_num; -@@ -133,7 +138,7 @@ struct cdc_ncm_ctx { - }; - - u8 cdc_ncm_select_altsetting(struct usb_interface *intf); --int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); -+int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags); - void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); - struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); - int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); diff --git a/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch b/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch deleted file mode 100644 index ae018cbab..000000000 --- a/target/linux/generic/pending-3.18/192-USB-qcserial-Add-support-for-Quectel-EC20-Mini-PCIe-.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 128524b9db3e4f4245226852bee771bd03db75be Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20=C5=A0tetiar?= -Date: Tue, 3 Nov 2015 11:01:42 +0100 -Subject: [PATCH 1/2] USB: qcserial: Add support for Quectel EC20 Mini PCIe - module -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It seems like this device has same vendor and product IDs as G2K -devices, but it has different number of interfaces(4 vs 5) and also -different interface layout which makes it currently unusable: - - usbcore: registered new interface driver qcserial - usbserial: USB Serial support registered for Qualcomm USB modem - usb 2-1.2: unknown number of interfaces: 5 - -lsusb output: - - Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless - Device Descriptor: - bLength 18 - bDescriptorType 1 - bcdUSB 2.00 - bDeviceClass 0 (Defined at Interface level) - bDeviceSubClass 0 - bDeviceProtocol 0 - bMaxPacketSize0 64 - idVendor 0x05c6 Qualcomm, Inc. - idProduct 0x9215 Acer Gobi 2000 Wireless Modem - bcdDevice 2.32 - iManufacturer 1 Quectel - iProduct 2 Quectel LTE Module - iSerial 0 - bNumConfigurations 1 - Configuration Descriptor: - bLength 9 - bDescriptorType 2 - wTotalLength 209 - bNumInterfaces 5 - bConfigurationValue 1 - iConfiguration 0 - bmAttributes 0xa0 - (Bus Powered) - Remote Wakeup - MaxPower 500mA - -Signed-off-by: Petr Štetiar ---- - drivers/usb/serial/qcserial.c | 39 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 39 insertions(+) - ---- a/drivers/usb/serial/qcserial.c -+++ b/drivers/usb/serial/qcserial.c -@@ -22,6 +22,8 @@ - #define DRIVER_AUTHOR "Qualcomm Inc" - #define DRIVER_DESC "Qualcomm USB Serial driver" - -+#define QUECTEL_EC20_IDPRODUCT 0x9215 -+ - /* standard device layouts supported by this driver */ - enum qcserial_layouts { - QCSERIAL_G2K = 0, /* Gobi 2000 */ -@@ -176,6 +178,38 @@ static const struct usb_device_id id_tab - }; - MODULE_DEVICE_TABLE(usb, id_table); - -+static int handle_quectel_ec20(struct device *dev, int ifnum) -+{ -+ int altsetting = 0; -+ -+ /* -+ * Quectel EC20 Mini PCIe LTE module layout: -+ * 0: DM/DIAG (use libqcdm from ModemManager for communication) -+ * 1: NMEA -+ * 2: AT-capable modem port -+ * 3: Modem interface -+ * 4: NDIS -+ */ -+ switch (ifnum) { -+ case 0: -+ dev_dbg(dev, "Quectel EC20 DM/DIAG interface found\n"); -+ break; -+ case 1: -+ dev_dbg(dev, "Quectel EC20 NMEA GPS interface found\n"); -+ break; -+ case 2: -+ case 3: -+ dev_dbg(dev, "Quectel EC20 Modem port found\n"); -+ break; -+ case 4: -+ /* Don't claim the QMI/net interface */ -+ altsetting = -1; -+ break; -+ } -+ -+ return altsetting; -+} -+ - static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) - { - struct usb_host_interface *intf = serial->interface->cur_altsetting; -@@ -244,6 +278,11 @@ static int qcprobe(struct usb_serial *se - altsetting = -1; - break; - case QCSERIAL_G2K: -+ if (nintf == 5 && id->idProduct == QUECTEL_EC20_IDPRODUCT) { -+ altsetting = handle_quectel_ec20(dev, ifnum); -+ goto done; -+ } -+ - /* - * Gobi 2K+ USB layout: - * 0: QMI/net diff --git a/target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch b/target/linux/generic/pending-3.18/193-USB-qmi_wwan-Add-quirk-for-Quectel-EC20-Mini-PCIe-mo.patch deleted file mode 100644 index ee0d7b2cc..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -825,6 +825,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) */ -@@ -856,10 +857,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 -@@ -871,6 +886,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/pending-3.18/200-fix_localversion.patch b/target/linux/generic/pending-3.18/200-fix_localversion.patch deleted file mode 100644 index 70228bb5f..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/201-extra_optimization.patch b/target/linux/generic/pending-3.18/201-extra_optimization.patch deleted file mode 100644 index 5a2396cfa..000000000 --- a/target/linux/generic/pending-3.18/201-extra_optimization.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -618,9 +618,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-P - KBUILD_AFLAGS += $(call cc-option,-fno-PIE) - - ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE --KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) -+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION) $(call cc-disable-warning,maybe-uninitialized,) - else --KBUILD_CFLAGS += -O2 -+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION) - endif - - # Tell gcc to never replace conditional load with a non-conditional one diff --git a/target/linux/generic/pending-3.18/202-reduce_module_size.patch b/target/linux/generic/pending-3.18/202-reduce_module_size.patch deleted file mode 100644 index b98ea4e9d..000000000 --- a/target/linux/generic/pending-3.18/202-reduce_module_size.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -409,7 +409,7 @@ KBUILD_CFLAGS_KERNEL := - KBUILD_AFLAGS := -D__ASSEMBLY__ - KBUILD_AFLAGS_MODULE := -DMODULE - KBUILD_CFLAGS_MODULE := -DMODULE --KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds -+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s) - - # Read KERNELRELEASE from include/config/kernel.release (if it exists) - KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) diff --git a/target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-3.18/203-kallsyms_uncompressed.patch deleted file mode 100644 index b9d82207a..000000000 --- a/target/linux/generic/pending-3.18/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; -@@ -392,6 +393,9 @@ static void write_src(void) - - free(markers); - -+ if (uncompressed) -+ return; -+ - output_label("kallsyms_token_table"); - off = 0; - for (i = 0; i < 256; i++) { -@@ -450,6 +454,9 @@ static void *find_token(unsigned char *s - { - int i; - -+ if (uncompressed) -+ return NULL; -+ - for (i = 0; i < len - 1; i++) { - if (str[i] == token[0] && str[i+1] == token[1]) - return &str[i]; -@@ -522,6 +529,9 @@ static void optimize_result(void) - { - int i, best; - -+ if (uncompressed) -+ return; -+ - /* using the '\0' symbol last allows compress_symbols to use standard - * fast string functions */ - for (i = 255; i >= 0; i--) { -@@ -692,7 +702,9 @@ int main(int argc, char **argv) - } else if (strncmp(argv[i], "--page-offset=", 14) == 0) { - const char *p = &argv[i][14]; - kernel_start_addr = strtoull(p, NULL, 16); -- } else -+ } else if (strcmp(argv[i], "--uncompressed") == 0) -+ uncompressed = 1; -+ else - usage(); - } - } else if (argc != 1) ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1338,6 +1338,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW - the unaligned access emulation. - see arch/parisc/kernel/unaligned.c for reference - -+config KALLSYMS_UNCOMPRESSED -+ bool "Keep kallsyms uncompressed" -+ depends on KALLSYMS -+ help -+ Normally kallsyms contains compressed symbols (using a token table), -+ reducing the uncompressed kernel image size. Keeping the symbol table -+ uncompressed significantly improves the size of this part in compressed -+ kernel images. -+ -+ Say N unless you need compressed kernel images to be small. -+ - config HAVE_PCSPKR_PLATFORM - bool - ---- a/scripts/link-vmlinux.sh -+++ b/scripts/link-vmlinux.sh -@@ -90,6 +90,10 @@ kallsyms() - kallsymopt="${kallsymopt} --absolute-percpu" - fi - -+ if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then -+ kallsymopt="${kallsymopt} --uncompressed" -+ fi -+ - local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ - ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" - ---- a/kernel/kallsyms.c -+++ b/kernel/kallsyms.c -@@ -109,6 +109,11 @@ static unsigned int kallsyms_expand_symb - * For every byte on the compressed symbol data, copy the table - * entry for that byte. - */ -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ memcpy(result, data + 1, len - 1); -+ result += len - 1; -+ len = 0; -+#endif - while (len) { - tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; - data++; -@@ -141,6 +146,9 @@ tail: - */ - static char kallsyms_get_symbol_type(unsigned int off) - { -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ return kallsyms_names[off + 1]; -+#endif - /* - * Get just the first code, look it up in the token table, - * and return the first char from this token. diff --git a/target/linux/generic/pending-3.18/204-module_strip.patch b/target/linux/generic/pending-3.18/204-module_strip.patch deleted file mode 100644 index 2df7ba013..000000000 --- a/target/linux/generic/pending-3.18/204-module_strip.patch +++ /dev/null @@ -1,190 +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,6 +84,7 @@ void trim_init_extable(struct module *m) - - /* Generic info of form tag = "info" */ - #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) -+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info) - - /* For userspace: you can also call me... */ - #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) -@@ -127,12 +128,12 @@ void trim_init_extable(struct module *m) - * Author(s), use "Name " or just "Name", for multiple - * authors use multiple MODULE_AUTHOR() statements/lines. - */ --#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) -+#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author) - - /* What your module does. */ --#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) -+#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description) - --#ifdef MODULE -+#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED) - /* Creates an alias so file2alias.c can find device table. */ - #define MODULE_DEVICE_TABLE(type, name) \ - extern const typeof(name) __mod_##type##__##name##_device_table \ -@@ -159,7 +160,9 @@ extern const typeof(name) __mod_##type## - */ - - #if defined(MODULE) || !defined(CONFIG_SYSFS) --#define MODULE_VERSION(_version) MODULE_INFO(version, _version) -+#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version) -+#elif defined(CONFIG_MODULE_STRIPPED) -+#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version) - #else - #define MODULE_VERSION(_version) \ - static struct module_version_attribute ___modver_attr = { \ -@@ -181,7 +184,7 @@ extern const typeof(name) __mod_##type## - /* Optional firmware file (or files) needed by the module - * format is simply firmware file name. Multiple firmware - * files require multiple MODULE_FIRMWARE() specifiers */ --#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) -+#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware) - - /* Given an address, look for it in the exception tables */ - const struct exception_table_entry *search_exception_tables(unsigned long add); ---- a/include/linux/moduleparam.h -+++ b/include/linux/moduleparam.h -@@ -16,6 +16,16 @@ - /* Chosen so that structs with an unsigned long line up. */ - #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) - -+/* This struct is here for syntactic coherency, it is not used */ -+#define __MODULE_INFO_DISABLED(name) \ -+ struct __UNIQUE_ID(name) {} -+ -+#ifdef CONFIG_MODULE_STRIPPED -+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO_DISABLED(name) -+#else -+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info) -+#endif -+ - #ifdef MODULE - #define __MODULE_INFO(tag, name, info) \ - static const char __UNIQUE_ID(name)[] \ -@@ -23,8 +33,7 @@ static const char __UNIQUE_ID(name)[] - = __stringify(tag) "=" info - #else /* !MODULE */ - /* This struct is here for syntactic coherency, it is not used */ --#define __MODULE_INFO(tag, name, info) \ -- struct __UNIQUE_ID(name) {} -+#define __MODULE_INFO(tag, name, info) __MODULE_INFO_DISABLED(name) - #endif - #define __MODULE_PARM_TYPE(name, _type) \ - __MODULE_INFO(parmtype, name##type, #name ":" _type) -@@ -32,7 +41,7 @@ static const char __UNIQUE_ID(name)[] - /* One for each parameter, describing how to use it. Some files do - multiple of these per line, so can't just use MODULE_INFO. */ - #define MODULE_PARM_DESC(_parm, desc) \ -- __MODULE_INFO(parm, _parm, #_parm ":" desc) -+ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc) - - struct kernel_param; - ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1987,6 +1987,13 @@ config MODULE_COMPRESS_XZ - - endchoice - -+config MODULE_STRIPPED -+ bool "Reduce module size" -+ depends on MODULES -+ help -+ Remove module parameter descriptions, author info, version, aliases, -+ device tables, etc. -+ - endif # MODULES - - config INIT_ALL_POSSIBLE ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -2699,6 +2699,7 @@ static struct module *setup_load_info(st - - static int check_modinfo(struct module *mod, struct load_info *info, int flags) - { -+#ifndef CONFIG_MODULE_STRIPPED - const char *modmagic = get_modinfo(info, "vermagic"); - int err; - -@@ -2724,6 +2725,7 @@ static int check_modinfo(struct module * - pr_warn("%s: module is from the staging directory, the quality " - "is unknown, you have been warned.\n", mod->name); - } -+#endif - - /* Set up license info based on the info section */ - set_license(mod, get_modinfo(info, "license")); ---- a/scripts/mod/modpost.c -+++ b/scripts/mod/modpost.c -@@ -1758,7 +1758,9 @@ static void read_symbols(char *modname) - symname = remove_dot(info.strtab + sym->st_name); - - handle_modversions(mod, &info, sym, symname); -+#ifndef CONFIG_MODULE_STRIPPED - handle_moddevtable(mod, &info, sym, symname); -+#endif - } - if (!is_vmlinux(modname) || - (is_vmlinux(modname) && vmlinux_section_warnings)) -@@ -1902,7 +1904,9 @@ static void add_header(struct buffer *b, - buf_printf(b, "#include \n"); - buf_printf(b, "#include \n"); - buf_printf(b, "\n"); -+#ifndef CONFIG_MODULE_STRIPPED - buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); -+#endif - buf_printf(b, "\n"); - buf_printf(b, "__visible struct module __this_module\n"); - buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); -@@ -1919,16 +1923,20 @@ static void add_header(struct buffer *b, - - static void add_intree_flag(struct buffer *b, int is_intree) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (is_intree) - buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n"); -+#endif - } - - static void add_staging_flag(struct buffer *b, const char *name) - { -+#ifndef CONFIG_MODULE_STRIPPED - static const char *staging_dir = "drivers/staging"; - - if (strncmp(staging_dir, name, strlen(staging_dir)) == 0) - buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); -+#endif - } - - /** -@@ -2021,11 +2029,13 @@ static void add_depends(struct buffer *b - - static void add_srcversion(struct buffer *b, struct module *mod) - { -+#ifndef CONFIG_MODULE_STRIPPED - if (mod->srcversion[0]) { - buf_printf(b, "\n"); - buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n", - mod->srcversion); - } -+#endif - } - - static void write_if_changed(struct buffer *b, const char *fname) -@@ -2256,7 +2266,9 @@ int main(int argc, char **argv) - add_staging_flag(&buf, mod->name); - err |= add_versions(&buf, mod); - add_depends(&buf, mod, modules); -+#ifndef CONFIG_MODULE_STRIPPED - add_moddevtable(&buf, mod); -+#endif - add_srcversion(&buf, mod); - - sprintf(fname, "%s.mod.c", mod->name); diff --git a/target/linux/generic/pending-3.18/205-backtrace_module_info.patch b/target/linux/generic/pending-3.18/205-backtrace_module_info.patch deleted file mode 100644 index f83b21ebc..000000000 --- a/target/linux/generic/pending-3.18/205-backtrace_module_info.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/lib/vsprintf.c -+++ b/lib/vsprintf.c -@@ -614,8 +614,10 @@ char *symbol_string(char *buf, char *end - struct printf_spec spec, const char *fmt) - { - unsigned long value; --#ifdef CONFIG_KALLSYMS - char sym[KSYM_SYMBOL_LEN]; -+#ifndef CONFIG_KALLSYMS -+ struct module *mod; -+ int len; - #endif - - if (fmt[1] == 'R') -@@ -629,15 +631,15 @@ char *symbol_string(char *buf, char *end - sprint_symbol(sym, value); - else - sprint_symbol_no_offset(sym, value); -- -- return string(buf, end, sym, spec); - #else -- spec.field_width = 2 * sizeof(void *); -- spec.flags |= SPECIAL | SMALL | ZEROPAD; -- spec.base = 16; -+ len = snprintf(sym, sizeof(sym), "0x%lx", value); - -- return number(buf, end, value, spec); -+ mod = __module_address(value); -+ if (mod) -+ snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]", -+ mod->name, mod->module_core, mod->core_size); - #endif -+ return string(buf, end, sym, spec); - } - - static noinline_for_stack diff --git a/target/linux/generic/pending-3.18/210-darwin_scripts_include.patch b/target/linux/generic/pending-3.18/210-darwin_scripts_include.patch deleted file mode 100644 index dc554de24..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -151,6 +151,9 @@ check-lxdialog := $(srctree)/$(src)/lxd - # we really need to do so. (Do not call gcc as part of make mrproper) - HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ - -DLOCALE -+ifeq ($(shell uname -s),Darwin) -+HOST_LOADLIBES += -lncurses -+endif - - # =========================================================================== - # Shared Makefile for the various kconfig executables: ---- a/scripts/mod/mk_elfconfig.c -+++ b/scripts/mod/mk_elfconfig.c -@@ -1,7 +1,11 @@ - #include - #include - #include -+#ifndef __APPLE__ - #include -+#else -+#include "elf.h" -+#endif - - int - main(int argc, char **argv) ---- a/scripts/mod/modpost.h -+++ b/scripts/mod/modpost.h -@@ -7,7 +7,11 @@ - #include - #include - #include -+#if !(defined(__APPLE__) || defined(__CYGWIN__)) - #include -+#else -+#include "elf.h" -+#endif - - #include "elfconfig.h" - ---- /dev/null -+++ b/scripts/mod/elf.h -@@ -0,0 +1,3007 @@ -+/* This file defines standard ELF types, structures, and macros. -+ Copyright (C) 1995-2012 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef _ELF_H -+#define _ELF_H 1 -+ -+/* Standard ELF types. */ -+ -+#include -+ -+/* Type for a 16-bit quantity. */ -+typedef uint16_t Elf32_Half; -+typedef uint16_t Elf64_Half; -+ -+/* Types for signed and unsigned 32-bit quantities. */ -+typedef uint32_t Elf32_Word; -+typedef int32_t Elf32_Sword; -+typedef uint32_t Elf64_Word; -+typedef int32_t Elf64_Sword; -+ -+/* Types for signed and unsigned 64-bit quantities. */ -+typedef uint64_t Elf32_Xword; -+typedef int64_t Elf32_Sxword; -+typedef uint64_t Elf64_Xword; -+typedef int64_t Elf64_Sxword; -+ -+/* Type of addresses. */ -+typedef uint32_t Elf32_Addr; -+typedef uint64_t Elf64_Addr; -+ -+/* Type of file offsets. */ -+typedef uint32_t Elf32_Off; -+typedef uint64_t Elf64_Off; -+ -+/* Type for section indices, which are 16-bit quantities. */ -+typedef uint16_t Elf32_Section; -+typedef uint16_t Elf64_Section; -+ -+/* Type for version symbol information. */ -+typedef Elf32_Half Elf32_Versym; -+typedef Elf64_Half Elf64_Versym; -+ -+ -+/* The ELF file header. This appears at the start of every ELF file. */ -+ -+#define EI_NIDENT (16) -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf32_Half e_type; /* Object file type */ -+ Elf32_Half e_machine; /* Architecture */ -+ Elf32_Word e_version; /* Object file version */ -+ Elf32_Addr e_entry; /* Entry point virtual address */ -+ Elf32_Off e_phoff; /* Program header table file offset */ -+ Elf32_Off e_shoff; /* Section header table file offset */ -+ Elf32_Word e_flags; /* Processor-specific flags */ -+ Elf32_Half e_ehsize; /* ELF header size in bytes */ -+ Elf32_Half e_phentsize; /* Program header table entry size */ -+ Elf32_Half e_phnum; /* Program header table entry count */ -+ Elf32_Half e_shentsize; /* Section header table entry size */ -+ Elf32_Half e_shnum; /* Section header table entry count */ -+ Elf32_Half e_shstrndx; /* Section header string table index */ -+} Elf32_Ehdr; -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf64_Half e_type; /* Object file type */ -+ Elf64_Half e_machine; /* Architecture */ -+ Elf64_Word e_version; /* Object file version */ -+ Elf64_Addr e_entry; /* Entry point virtual address */ -+ Elf64_Off e_phoff; /* Program header table file offset */ -+ Elf64_Off e_shoff; /* Section header table file offset */ -+ Elf64_Word e_flags; /* Processor-specific flags */ -+ Elf64_Half e_ehsize; /* ELF header size in bytes */ -+ Elf64_Half e_phentsize; /* Program header table entry size */ -+ Elf64_Half e_phnum; /* Program header table entry count */ -+ Elf64_Half e_shentsize; /* Section header table entry size */ -+ Elf64_Half e_shnum; /* Section header table entry count */ -+ Elf64_Half e_shstrndx; /* Section header string table index */ -+} Elf64_Ehdr; -+ -+/* Fields in the e_ident array. The EI_* macros are indices into the -+ array. The macros under each EI_* macro are the values the byte -+ may have. */ -+ -+#define EI_MAG0 0 /* File identification byte 0 index */ -+#define ELFMAG0 0x7f /* Magic number byte 0 */ -+ -+#define EI_MAG1 1 /* File identification byte 1 index */ -+#define ELFMAG1 'E' /* Magic number byte 1 */ -+ -+#define EI_MAG2 2 /* File identification byte 2 index */ -+#define ELFMAG2 'L' /* Magic number byte 2 */ -+ -+#define EI_MAG3 3 /* File identification byte 3 index */ -+#define ELFMAG3 'F' /* Magic number byte 3 */ -+ -+/* Conglomeration of the identification bytes, for easy testing as a word. */ -+#define ELFMAG "\177ELF" -+#define SELFMAG 4 -+ -+#define EI_CLASS 4 /* File class byte index */ -+#define ELFCLASSNONE 0 /* Invalid class */ -+#define ELFCLASS32 1 /* 32-bit objects */ -+#define ELFCLASS64 2 /* 64-bit objects */ -+#define ELFCLASSNUM 3 -+ -+#define EI_DATA 5 /* Data encoding byte index */ -+#define ELFDATANONE 0 /* Invalid data encoding */ -+#define ELFDATA2LSB 1 /* 2's complement, little endian */ -+#define ELFDATA2MSB 2 /* 2's complement, big endian */ -+#define ELFDATANUM 3 -+ -+#define EI_VERSION 6 /* File version byte index */ -+ /* Value must be EV_CURRENT */ -+ -+#define EI_OSABI 7 /* OS ABI identification */ -+#define ELFOSABI_NONE 0 /* UNIX System V ABI */ -+#define ELFOSABI_SYSV 0 /* Alias. */ -+#define ELFOSABI_HPUX 1 /* HP-UX */ -+#define ELFOSABI_NETBSD 2 /* NetBSD. */ -+#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ -+#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ -+#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ -+#define ELFOSABI_AIX 7 /* IBM AIX. */ -+#define ELFOSABI_IRIX 8 /* SGI Irix. */ -+#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ -+#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ -+#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ -+#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ -+#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ -+#define ELFOSABI_ARM 97 /* ARM */ -+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ -+ -+#define EI_ABIVERSION 8 /* ABI version */ -+ -+#define EI_PAD 9 /* Byte index of padding bytes */ -+ -+/* Legal values for e_type (object file type). */ -+ -+#define ET_NONE 0 /* No file type */ -+#define ET_REL 1 /* Relocatable file */ -+#define ET_EXEC 2 /* Executable file */ -+#define ET_DYN 3 /* Shared object file */ -+#define ET_CORE 4 /* Core file */ -+#define ET_NUM 5 /* Number of defined types */ -+#define ET_LOOS 0xfe00 /* OS-specific range start */ -+#define ET_HIOS 0xfeff /* OS-specific range end */ -+#define ET_LOPROC 0xff00 /* Processor-specific range start */ -+#define ET_HIPROC 0xffff /* Processor-specific range end */ -+ -+/* Legal values for e_machine (architecture). */ -+ -+#define EM_NONE 0 /* No machine */ -+#define EM_M32 1 /* AT&T WE 32100 */ -+#define EM_SPARC 2 /* SUN SPARC */ -+#define EM_386 3 /* Intel 80386 */ -+#define EM_68K 4 /* Motorola m68k family */ -+#define EM_88K 5 /* Motorola m88k family */ -+#define EM_860 7 /* Intel 80860 */ -+#define EM_MIPS 8 /* MIPS R3000 big-endian */ -+#define EM_S370 9 /* IBM System/370 */ -+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ -+ -+#define EM_PARISC 15 /* HPPA */ -+#define EM_VPP500 17 /* Fujitsu VPP500 */ -+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ -+#define EM_960 19 /* Intel 80960 */ -+#define EM_PPC 20 /* PowerPC */ -+#define EM_PPC64 21 /* PowerPC 64-bit */ -+#define EM_S390 22 /* IBM S390 */ -+ -+#define EM_V800 36 /* NEC V800 series */ -+#define EM_FR20 37 /* Fujitsu FR20 */ -+#define EM_RH32 38 /* TRW RH-32 */ -+#define EM_RCE 39 /* Motorola RCE */ -+#define EM_ARM 40 /* ARM */ -+#define EM_FAKE_ALPHA 41 /* Digital Alpha */ -+#define EM_SH 42 /* Hitachi SH */ -+#define EM_SPARCV9 43 /* SPARC v9 64-bit */ -+#define EM_TRICORE 44 /* Siemens Tricore */ -+#define EM_ARC 45 /* Argonaut RISC Core */ -+#define EM_H8_300 46 /* Hitachi H8/300 */ -+#define EM_H8_300H 47 /* Hitachi H8/300H */ -+#define EM_H8S 48 /* Hitachi H8S */ -+#define EM_H8_500 49 /* Hitachi H8/500 */ -+#define EM_IA_64 50 /* Intel Merced */ -+#define EM_MIPS_X 51 /* Stanford MIPS-X */ -+#define EM_COLDFIRE 52 /* Motorola Coldfire */ -+#define EM_68HC12 53 /* Motorola M68HC12 */ -+#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -+#define EM_PCP 55 /* Siemens PCP */ -+#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -+#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -+#define EM_STARCORE 58 /* Motorola Start*Core processor */ -+#define EM_ME16 59 /* Toyota ME16 processor */ -+#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -+#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -+#define EM_X86_64 62 /* AMD x86-64 architecture */ -+#define EM_PDSP 63 /* Sony DSP Processor */ -+ -+#define EM_FX66 66 /* Siemens FX66 microcontroller */ -+#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -+#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -+#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -+#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -+#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -+#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -+#define EM_SVX 73 /* Silicon Graphics SVx */ -+#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -+#define EM_VAX 75 /* Digital VAX */ -+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ -+#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ -+#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -+#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -+#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ -+#define EM_HUANY 81 /* Harvard University machine-independent object files */ -+#define EM_PRISM 82 /* SiTera Prism */ -+#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -+#define EM_FR30 84 /* Fujitsu FR30 */ -+#define EM_D10V 85 /* Mitsubishi D10V */ -+#define EM_D30V 86 /* Mitsubishi D30V */ -+#define EM_V850 87 /* NEC v850 */ -+#define EM_M32R 88 /* Mitsubishi M32R */ -+#define EM_MN10300 89 /* Matsushita MN10300 */ -+#define EM_MN10200 90 /* Matsushita MN10200 */ -+#define EM_PJ 91 /* picoJava */ -+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ -+#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ -+#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ -+#define EM_TILEPRO 188 /* Tilera TILEPro */ -+#define EM_TILEGX 191 /* Tilera TILE-Gx */ -+#define EM_NUM 192 -+ -+/* If it is necessary to assign new unofficial EM_* values, please -+ pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the -+ chances of collision with official or non-GNU unofficial values. */ -+ -+#define EM_ALPHA 0x9026 -+ -+/* Legal values for e_version (version). */ -+ -+#define EV_NONE 0 /* Invalid ELF version */ -+#define EV_CURRENT 1 /* Current version */ -+#define EV_NUM 2 -+ -+/* Section header. */ -+ -+typedef struct -+{ -+ Elf32_Word sh_name; /* Section name (string tbl index) */ -+ Elf32_Word sh_type; /* Section type */ -+ Elf32_Word sh_flags; /* Section flags */ -+ Elf32_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf32_Off sh_offset; /* Section file offset */ -+ Elf32_Word sh_size; /* Section size in bytes */ -+ Elf32_Word sh_link; /* Link to another section */ -+ Elf32_Word sh_info; /* Additional section information */ -+ Elf32_Word sh_addralign; /* Section alignment */ -+ Elf32_Word sh_entsize; /* Entry size if section holds table */ -+} Elf32_Shdr; -+ -+typedef struct -+{ -+ Elf64_Word sh_name; /* Section name (string tbl index) */ -+ Elf64_Word sh_type; /* Section type */ -+ Elf64_Xword sh_flags; /* Section flags */ -+ Elf64_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf64_Off sh_offset; /* Section file offset */ -+ Elf64_Xword sh_size; /* Section size in bytes */ -+ Elf64_Word sh_link; /* Link to another section */ -+ Elf64_Word sh_info; /* Additional section information */ -+ Elf64_Xword sh_addralign; /* Section alignment */ -+ Elf64_Xword sh_entsize; /* Entry size if section holds table */ -+} Elf64_Shdr; -+ -+/* Special section indices. */ -+ -+#define SHN_UNDEF 0 /* Undefined section */ -+#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ -+#define SHN_LOPROC 0xff00 /* Start of processor-specific */ -+#define SHN_BEFORE 0xff00 /* Order section before all others -+ (Solaris). */ -+#define SHN_AFTER 0xff01 /* Order section after all others -+ (Solaris). */ -+#define SHN_HIPROC 0xff1f /* End of processor-specific */ -+#define SHN_LOOS 0xff20 /* Start of OS-specific */ -+#define SHN_HIOS 0xff3f /* End of OS-specific */ -+#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ -+#define SHN_COMMON 0xfff2 /* Associated symbol is common */ -+#define SHN_XINDEX 0xffff /* Index is in extra table. */ -+#define SHN_HIRESERVE 0xffff /* End of reserved indices */ -+ -+/* Legal values for sh_type (section type). */ -+ -+#define SHT_NULL 0 /* Section header table entry unused */ -+#define SHT_PROGBITS 1 /* Program data */ -+#define SHT_SYMTAB 2 /* Symbol table */ -+#define SHT_STRTAB 3 /* String table */ -+#define SHT_RELA 4 /* Relocation entries with addends */ -+#define SHT_HASH 5 /* Symbol hash table */ -+#define SHT_DYNAMIC 6 /* Dynamic linking information */ -+#define SHT_NOTE 7 /* Notes */ -+#define SHT_NOBITS 8 /* Program space with no data (bss) */ -+#define SHT_REL 9 /* Relocation entries, no addends */ -+#define SHT_SHLIB 10 /* Reserved */ -+#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ -+#define SHT_INIT_ARRAY 14 /* Array of constructors */ -+#define SHT_FINI_ARRAY 15 /* Array of destructors */ -+#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -+#define SHT_GROUP 17 /* Section group */ -+#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -+#define SHT_NUM 19 /* Number of defined types. */ -+#define SHT_LOOS 0x60000000 /* Start OS-specific. */ -+#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ -+#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ -+#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ -+#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ -+#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ -+#define SHT_SUNW_move 0x6ffffffa -+#define SHT_SUNW_COMDAT 0x6ffffffb -+#define SHT_SUNW_syminfo 0x6ffffffc -+#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ -+#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ -+#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ -+#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ -+#define SHT_HIOS 0x6fffffff /* End OS-specific type */ -+#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define SHT_LOUSER 0x80000000 /* Start of application-specific */ -+#define SHT_HIUSER 0x8fffffff /* End of application-specific */ -+ -+/* Legal values for sh_flags (section flags). */ -+ -+#define SHF_WRITE (1 << 0) /* Writable */ -+#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ -+#define SHF_EXECINSTR (1 << 2) /* Executable */ -+#define SHF_MERGE (1 << 4) /* Might be merged */ -+#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ -+#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ -+#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ -+#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling -+ required */ -+#define SHF_GROUP (1 << 9) /* Section is member of a group. */ -+#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ -+#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ -+#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ -+#define SHF_ORDERED (1 << 30) /* Special ordering requirement -+ (Solaris). */ -+#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless -+ referenced or allocated (Solaris).*/ -+ -+/* Section group handling. */ -+#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ -+ -+/* Symbol table entry. */ -+ -+typedef struct -+{ -+ Elf32_Word st_name; /* Symbol name (string tbl index) */ -+ Elf32_Addr st_value; /* Symbol value */ -+ Elf32_Word st_size; /* Symbol size */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf32_Section st_shndx; /* Section index */ -+} Elf32_Sym; -+ -+typedef struct -+{ -+ Elf64_Word st_name; /* Symbol name (string tbl index) */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf64_Section st_shndx; /* Section index */ -+ Elf64_Addr st_value; /* Symbol value */ -+ Elf64_Xword st_size; /* Symbol size */ -+} Elf64_Sym; -+ -+/* The syminfo section if available contains additional information about -+ every dynamic symbol. */ -+ -+typedef struct -+{ -+ Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf32_Half si_flags; /* Per symbol flags */ -+} Elf32_Syminfo; -+ -+typedef struct -+{ -+ Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf64_Half si_flags; /* Per symbol flags */ -+} Elf64_Syminfo; -+ -+/* Possible values for si_boundto. */ -+#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ -+#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ -+#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ -+ -+/* Possible bitmasks for si_flags. */ -+#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ -+#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ -+#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ -+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy -+ loaded */ -+/* Syminfo version values. */ -+#define SYMINFO_NONE 0 -+#define SYMINFO_CURRENT 1 -+#define SYMINFO_NUM 2 -+ -+ -+/* How to extract and insert information held in the st_info field. */ -+ -+#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) -+#define ELF32_ST_TYPE(val) ((val) & 0xf) -+#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) -+ -+/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ -+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) -+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) -+#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) -+ -+/* Legal values for ST_BIND subfield of st_info (symbol binding). */ -+ -+#define STB_LOCAL 0 /* Local symbol */ -+#define STB_GLOBAL 1 /* Global symbol */ -+#define STB_WEAK 2 /* Weak symbol */ -+#define STB_NUM 3 /* Number of defined types. */ -+#define STB_LOOS 10 /* Start of OS-specific */ -+#define STB_GNU_UNIQUE 10 /* Unique symbol. */ -+#define STB_HIOS 12 /* End of OS-specific */ -+#define STB_LOPROC 13 /* Start of processor-specific */ -+#define STB_HIPROC 15 /* End of processor-specific */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_NOTYPE 0 /* Symbol type is unspecified */ -+#define STT_OBJECT 1 /* Symbol is a data object */ -+#define STT_FUNC 2 /* Symbol is a code object */ -+#define STT_SECTION 3 /* Symbol associated with a section */ -+#define STT_FILE 4 /* Symbol's name is file name */ -+#define STT_COMMON 5 /* Symbol is a common data object */ -+#define STT_TLS 6 /* Symbol is thread-local data object*/ -+#define STT_NUM 7 /* Number of defined types. */ -+#define STT_LOOS 10 /* Start of OS-specific */ -+#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ -+#define STT_HIOS 12 /* End of OS-specific */ -+#define STT_LOPROC 13 /* Start of processor-specific */ -+#define STT_HIPROC 15 /* End of processor-specific */ -+ -+ -+/* Symbol table indices are found in the hash buckets and chain table -+ of a symbol hash table section. This special index value indicates -+ the end of a chain, meaning no further symbols are found in that bucket. */ -+ -+#define STN_UNDEF 0 /* End of a chain. */ -+ -+ -+/* How to extract and insert information held in the st_other field. */ -+ -+#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) -+ -+/* For ELF64 the definitions are the same. */ -+#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) -+ -+/* Symbol visibility specification encoded in the st_other field. */ -+#define STV_DEFAULT 0 /* Default symbol visibility rules */ -+#define STV_INTERNAL 1 /* Processor specific hidden class */ -+#define STV_HIDDEN 2 /* Sym unavailable in other modules */ -+#define STV_PROTECTED 3 /* Not preemptible, not exported */ -+ -+ -+/* Relocation table entry without addend (in section of type SHT_REL). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+} Elf32_Rel; -+ -+/* I have seen two different definitions of the Elf64_Rel and -+ Elf64_Rela structures, so we'll leave them out until Novell (or -+ whoever) gets their act together. */ -+/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+} Elf64_Rel; -+ -+/* Relocation table entry with addend (in section of type SHT_RELA). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+ Elf32_Sword r_addend; /* Addend */ -+} Elf32_Rela; -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+ Elf64_Sxword r_addend; /* Addend */ -+} Elf64_Rela; -+ -+/* How to extract and insert information held in the r_info field. */ -+ -+#define ELF32_R_SYM(val) ((val) >> 8) -+#define ELF32_R_TYPE(val) ((val) & 0xff) -+#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) -+ -+#define ELF64_R_SYM(i) ((i) >> 32) -+#define ELF64_R_TYPE(i) ((i) & 0xffffffff) -+#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) -+ -+/* Program segment header. */ -+ -+typedef struct -+{ -+ Elf32_Word p_type; /* Segment type */ -+ Elf32_Off p_offset; /* Segment file offset */ -+ Elf32_Addr p_vaddr; /* Segment virtual address */ -+ Elf32_Addr p_paddr; /* Segment physical address */ -+ Elf32_Word p_filesz; /* Segment size in file */ -+ Elf32_Word p_memsz; /* Segment size in memory */ -+ Elf32_Word p_flags; /* Segment flags */ -+ Elf32_Word p_align; /* Segment alignment */ -+} Elf32_Phdr; -+ -+typedef struct -+{ -+ Elf64_Word p_type; /* Segment type */ -+ Elf64_Word p_flags; /* Segment flags */ -+ Elf64_Off p_offset; /* Segment file offset */ -+ Elf64_Addr p_vaddr; /* Segment virtual address */ -+ Elf64_Addr p_paddr; /* Segment physical address */ -+ Elf64_Xword p_filesz; /* Segment size in file */ -+ Elf64_Xword p_memsz; /* Segment size in memory */ -+ Elf64_Xword p_align; /* Segment alignment */ -+} Elf64_Phdr; -+ -+/* Special value for e_phnum. This indicates that the real number of -+ program headers is too large to fit into e_phnum. Instead the real -+ value is in the field sh_info of section 0. */ -+ -+#define PN_XNUM 0xffff -+ -+/* Legal values for p_type (segment type). */ -+ -+#define PT_NULL 0 /* Program header table entry unused */ -+#define PT_LOAD 1 /* Loadable program segment */ -+#define PT_DYNAMIC 2 /* Dynamic linking information */ -+#define PT_INTERP 3 /* Program interpreter */ -+#define PT_NOTE 4 /* Auxiliary information */ -+#define PT_SHLIB 5 /* Reserved */ -+#define PT_PHDR 6 /* Entry for header table itself */ -+#define PT_TLS 7 /* Thread-local storage segment */ -+#define PT_NUM 8 /* Number of defined types */ -+#define PT_LOOS 0x60000000 /* Start of OS-specific */ -+#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ -+#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ -+#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ -+#define PT_LOSUNW 0x6ffffffa -+#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ -+#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ -+#define PT_HISUNW 0x6fffffff -+#define PT_HIOS 0x6fffffff /* End of OS-specific */ -+#define PT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define PT_HIPROC 0x7fffffff /* End of processor-specific */ -+ -+/* Legal values for p_flags (segment flags). */ -+ -+#define PF_X (1 << 0) /* Segment is executable */ -+#define PF_W (1 << 1) /* Segment is writable */ -+#define PF_R (1 << 2) /* Segment is readable */ -+#define PF_MASKOS 0x0ff00000 /* OS-specific */ -+#define PF_MASKPROC 0xf0000000 /* Processor-specific */ -+ -+/* Legal values for note segment descriptor types for core files. */ -+ -+#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ -+#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ -+#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ -+#define NT_PRXREG 4 /* Contains copy of prxregset struct */ -+#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ -+#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ -+#define NT_AUXV 6 /* Contains copy of auxv array */ -+#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ -+#define NT_ASRS 8 /* Contains copy of asrset struct */ -+#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ -+#define NT_PSINFO 13 /* Contains copy of psinfo struct */ -+#define NT_PRCRED 14 /* Contains copy of prcred struct */ -+#define NT_UTSNAME 15 /* Contains copy of utsname struct */ -+#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ -+#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ -+#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ -+#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ -+#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ -+#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ -+#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ -+#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ -+#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ -+#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ -+ -+/* Legal values for the note segment descriptor types for object files. */ -+ -+#define NT_VERSION 1 /* Contains a version string. */ -+ -+ -+/* Dynamic section entry. */ -+ -+typedef struct -+{ -+ Elf32_Sword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf32_Word d_val; /* Integer value */ -+ Elf32_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf32_Dyn; -+ -+typedef struct -+{ -+ Elf64_Sxword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf64_Xword d_val; /* Integer value */ -+ Elf64_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf64_Dyn; -+ -+/* Legal values for d_tag (dynamic entry type). */ -+ -+#define DT_NULL 0 /* Marks end of dynamic section */ -+#define DT_NEEDED 1 /* Name of needed library */ -+#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ -+#define DT_PLTGOT 3 /* Processor defined value */ -+#define DT_HASH 4 /* Address of symbol hash table */ -+#define DT_STRTAB 5 /* Address of string table */ -+#define DT_SYMTAB 6 /* Address of symbol table */ -+#define DT_RELA 7 /* Address of Rela relocs */ -+#define DT_RELASZ 8 /* Total size of Rela relocs */ -+#define DT_RELAENT 9 /* Size of one Rela reloc */ -+#define DT_STRSZ 10 /* Size of string table */ -+#define DT_SYMENT 11 /* Size of one symbol table entry */ -+#define DT_INIT 12 /* Address of init function */ -+#define DT_FINI 13 /* Address of termination function */ -+#define DT_SONAME 14 /* Name of shared object */ -+#define DT_RPATH 15 /* Library search path (deprecated) */ -+#define DT_SYMBOLIC 16 /* Start symbol search here */ -+#define DT_REL 17 /* Address of Rel relocs */ -+#define DT_RELSZ 18 /* Total size of Rel relocs */ -+#define DT_RELENT 19 /* Size of one Rel reloc */ -+#define DT_PLTREL 20 /* Type of reloc in PLT */ -+#define DT_DEBUG 21 /* For debugging; unspecified */ -+#define DT_TEXTREL 22 /* Reloc might modify .text */ -+#define DT_JMPREL 23 /* Address of PLT relocs */ -+#define DT_BIND_NOW 24 /* Process relocations of object */ -+#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -+#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -+#define DT_RUNPATH 29 /* Library search path */ -+#define DT_FLAGS 30 /* Flags for the object being loaded */ -+#define DT_ENCODING 32 /* Start of encoded range */ -+#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -+#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -+#define DT_NUM 34 /* Number used */ -+#define DT_LOOS 0x6000000d /* Start of OS-specific */ -+#define DT_HIOS 0x6ffff000 /* End of OS-specific */ -+#define DT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define DT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ -+ -+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the -+ Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's -+ approach. */ -+#define DT_VALRNGLO 0x6ffffd00 -+#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ -+#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ -+#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ -+#define DT_CHECKSUM 0x6ffffdf8 -+#define DT_PLTPADSZ 0x6ffffdf9 -+#define DT_MOVEENT 0x6ffffdfa -+#define DT_MOVESZ 0x6ffffdfb -+#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ -+#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting -+ the following DT_* entry. */ -+#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ -+#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ -+#define DT_VALRNGHI 0x6ffffdff -+#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ -+#define DT_VALNUM 12 -+ -+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the -+ Dyn.d_un.d_ptr field of the Elf*_Dyn structure. -+ -+ If any adjustment is made to the ELF object after it has been -+ built these entries will need to be adjusted. */ -+#define DT_ADDRRNGLO 0x6ffffe00 -+#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ -+#define DT_TLSDESC_PLT 0x6ffffef6 -+#define DT_TLSDESC_GOT 0x6ffffef7 -+#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ -+#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ -+#define DT_CONFIG 0x6ffffefa /* Configuration information. */ -+#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ -+#define DT_AUDIT 0x6ffffefc /* Object auditing. */ -+#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ -+#define DT_MOVETAB 0x6ffffefe /* Move table. */ -+#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ -+#define DT_ADDRRNGHI 0x6ffffeff -+#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ -+#define DT_ADDRNUM 11 -+ -+/* The versioning entry types. The next are defined as part of the -+ GNU extension. */ -+#define DT_VERSYM 0x6ffffff0 -+ -+#define DT_RELACOUNT 0x6ffffff9 -+#define DT_RELCOUNT 0x6ffffffa -+ -+/* These were chosen by Sun. */ -+#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ -+#define DT_VERDEF 0x6ffffffc /* Address of version definition -+ table */ -+#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ -+#define DT_VERNEED 0x6ffffffe /* Address of table with needed -+ versions */ -+#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ -+#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ -+#define DT_VERSIONTAGNUM 16 -+ -+/* Sun added these machine-independent extensions in the "processor-specific" -+ range. Be compatible. */ -+#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ -+#define DT_FILTER 0x7fffffff /* Shared object to get values from */ -+#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) -+#define DT_EXTRANUM 3 -+ -+/* Values of `d_un.d_val' in the DT_FLAGS entry. */ -+#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ -+#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ -+#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ -+#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ -+#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ -+ -+/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 -+ entry in the dynamic section. */ -+#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ -+#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ -+#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ -+#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ -+#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ -+#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ -+#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ -+#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ -+#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ -+#define DF_1_TRANS 0x00000200 -+#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ -+#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ -+#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ -+#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ -+#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ -+#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ -+#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ -+ -+/* Flags for the feature selection in DT_FEATURE_1. */ -+#define DTF_1_PARINIT 0x00000001 -+#define DTF_1_CONFEXP 0x00000002 -+ -+/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ -+#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ -+#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not -+ generally available. */ -+ -+/* Version definition sections. */ -+ -+typedef struct -+{ -+ Elf32_Half vd_version; /* Version revision */ -+ Elf32_Half vd_flags; /* Version information */ -+ Elf32_Half vd_ndx; /* Version Index */ -+ Elf32_Half vd_cnt; /* Number of associated aux entries */ -+ Elf32_Word vd_hash; /* Version name hash value */ -+ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf32_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf32_Verdef; -+ -+typedef struct -+{ -+ Elf64_Half vd_version; /* Version revision */ -+ Elf64_Half vd_flags; /* Version information */ -+ Elf64_Half vd_ndx; /* Version Index */ -+ Elf64_Half vd_cnt; /* Number of associated aux entries */ -+ Elf64_Word vd_hash; /* Version name hash value */ -+ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf64_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf64_Verdef; -+ -+ -+/* Legal values for vd_version (version revision). */ -+#define VER_DEF_NONE 0 /* No version */ -+#define VER_DEF_CURRENT 1 /* Current version */ -+#define VER_DEF_NUM 2 /* Given version number */ -+ -+/* Legal values for vd_flags (version information flags). */ -+#define VER_FLG_BASE 0x1 /* Version definition of file itself */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+/* Versym symbol index values. */ -+#define VER_NDX_LOCAL 0 /* Symbol is local. */ -+#define VER_NDX_GLOBAL 1 /* Symbol is global. */ -+#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ -+#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ -+ -+/* Auxialiary version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vda_name; /* Version or dependency names */ -+ Elf32_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf32_Verdaux; -+ -+typedef struct -+{ -+ Elf64_Word vda_name; /* Version or dependency names */ -+ Elf64_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf64_Verdaux; -+ -+ -+/* Version dependency section. */ -+ -+typedef struct -+{ -+ Elf32_Half vn_version; /* Version of structure */ -+ Elf32_Half vn_cnt; /* Number of associated aux entries */ -+ Elf32_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf32_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf32_Verneed; -+ -+typedef struct -+{ -+ Elf64_Half vn_version; /* Version of structure */ -+ Elf64_Half vn_cnt; /* Number of associated aux entries */ -+ Elf64_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf64_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf64_Verneed; -+ -+ -+/* Legal values for vn_version (version revision). */ -+#define VER_NEED_NONE 0 /* No version */ -+#define VER_NEED_CURRENT 1 /* Current version */ -+#define VER_NEED_NUM 2 /* Given version number */ -+ -+/* Auxiliary needed version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vna_hash; /* Hash value of dependency name */ -+ Elf32_Half vna_flags; /* Dependency specific information */ -+ Elf32_Half vna_other; /* Unused */ -+ Elf32_Word vna_name; /* Dependency name string offset */ -+ Elf32_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf32_Vernaux; -+ -+typedef struct -+{ -+ Elf64_Word vna_hash; /* Hash value of dependency name */ -+ Elf64_Half vna_flags; /* Dependency specific information */ -+ Elf64_Half vna_other; /* Unused */ -+ Elf64_Word vna_name; /* Dependency name string offset */ -+ Elf64_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf64_Vernaux; -+ -+ -+/* Legal values for vna_flags. */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+ -+/* Auxiliary vector. */ -+ -+/* This vector is normally only used by the program interpreter. The -+ usual definition in an ABI supplement uses the name auxv_t. The -+ vector is not usually defined in a standard file, but it -+ can't hurt. We rename it to avoid conflicts. The sizes of these -+ types are an arrangement between the exec server and the program -+ interpreter, so we don't fully specify them here. */ -+ -+typedef struct -+{ -+ uint32_t a_type; /* Entry type */ -+ union -+ { -+ uint32_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf32_auxv_t; -+ -+typedef struct -+{ -+ uint64_t a_type; /* Entry type */ -+ union -+ { -+ uint64_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf64_auxv_t; -+ -+/* Legal values for a_type (entry type). */ -+ -+#define AT_NULL 0 /* End of vector */ -+#define AT_IGNORE 1 /* Entry should be ignored */ -+#define AT_EXECFD 2 /* File descriptor of program */ -+#define AT_PHDR 3 /* Program headers for program */ -+#define AT_PHENT 4 /* Size of program header entry */ -+#define AT_PHNUM 5 /* Number of program headers */ -+#define AT_PAGESZ 6 /* System page size */ -+#define AT_BASE 7 /* Base address of interpreter */ -+#define AT_FLAGS 8 /* Flags */ -+#define AT_ENTRY 9 /* Entry point of program */ -+#define AT_NOTELF 10 /* Program is not ELF */ -+#define AT_UID 11 /* Real uid */ -+#define AT_EUID 12 /* Effective uid */ -+#define AT_GID 13 /* Real gid */ -+#define AT_EGID 14 /* Effective gid */ -+#define AT_CLKTCK 17 /* Frequency of times() */ -+ -+/* Some more special a_type values describing the hardware. */ -+#define AT_PLATFORM 15 /* String identifying platform. */ -+#define AT_HWCAP 16 /* Machine dependent hints about -+ processor capabilities. */ -+ -+/* This entry gives some information about the FPU initialization -+ performed by the kernel. */ -+#define AT_FPUCW 18 /* Used FPU control word. */ -+ -+/* Cache block sizes. */ -+#define AT_DCACHEBSIZE 19 /* Data cache block size. */ -+#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ -+#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ -+ -+/* A special ignored value for PPC, used by the kernel to control the -+ interpretation of the AUXV. Must be > 16. */ -+#define AT_IGNOREPPC 22 /* Entry should be ignored. */ -+ -+#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ -+ -+#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ -+ -+#define AT_RANDOM 25 /* Address of 16 random bytes. */ -+ -+#define AT_EXECFN 31 /* Filename of executable. */ -+ -+/* Pointer to the global system page used for system calls and other -+ nice things. */ -+#define AT_SYSINFO 32 -+#define AT_SYSINFO_EHDR 33 -+ -+/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains -+ log2 of line size; mask those to get cache size. */ -+#define AT_L1I_CACHESHAPE 34 -+#define AT_L1D_CACHESHAPE 35 -+#define AT_L2_CACHESHAPE 36 -+#define AT_L3_CACHESHAPE 37 -+ -+/* Note section contents. Each entry in the note section begins with -+ a header of a fixed form. */ -+ -+typedef struct -+{ -+ Elf32_Word n_namesz; /* Length of the note's name. */ -+ Elf32_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf32_Word n_type; /* Type of the note. */ -+} Elf32_Nhdr; -+ -+typedef struct -+{ -+ Elf64_Word n_namesz; /* Length of the note's name. */ -+ Elf64_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf64_Word n_type; /* Type of the note. */ -+} Elf64_Nhdr; -+ -+/* Known names of notes. */ -+ -+/* Solaris entries in the note section have this name. */ -+#define ELF_NOTE_SOLARIS "SUNW Solaris" -+ -+/* Note entries for GNU systems have this name. */ -+#define ELF_NOTE_GNU "GNU" -+ -+ -+/* Defined types of notes for Solaris. */ -+ -+/* Value of descriptor (one word) is desired pagesize for the binary. */ -+#define ELF_NOTE_PAGESIZE_HINT 1 -+ -+ -+/* Defined note types for GNU systems. */ -+ -+/* ABI information. The descriptor consists of words: -+ word 0: OS descriptor -+ word 1: major version of the ABI -+ word 2: minor version of the ABI -+ word 3: subminor version of the ABI -+*/ -+#define NT_GNU_ABI_TAG 1 -+#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ -+ -+/* Known OSes. These values can appear in word 0 of an -+ NT_GNU_ABI_TAG note section entry. */ -+#define ELF_NOTE_OS_LINUX 0 -+#define ELF_NOTE_OS_GNU 1 -+#define ELF_NOTE_OS_SOLARIS2 2 -+#define ELF_NOTE_OS_FREEBSD 3 -+ -+/* Synthetic hwcap information. The descriptor begins with two words: -+ word 0: number of entries -+ word 1: bitmask of enabled entries -+ Then follow variable-length entries, one byte followed by a -+ '\0'-terminated hwcap name string. The byte gives the bit -+ number to test if enabled, (1U << bit) & bitmask. */ -+#define NT_GNU_HWCAP 2 -+ -+/* Build ID bits as generated by ld --build-id. -+ The descriptor consists of any nonzero number of bytes. */ -+#define NT_GNU_BUILD_ID 3 -+ -+/* Version note generated by GNU gold containing a version string. */ -+#define NT_GNU_GOLD_VERSION 4 -+ -+ -+/* Move records. */ -+typedef struct -+{ -+ Elf32_Xword m_value; /* Symbol value. */ -+ Elf32_Word m_info; /* Size and index. */ -+ Elf32_Word m_poffset; /* Symbol offset. */ -+ Elf32_Half m_repeat; /* Repeat count. */ -+ Elf32_Half m_stride; /* Stride info. */ -+} Elf32_Move; -+ -+typedef struct -+{ -+ Elf64_Xword m_value; /* Symbol value. */ -+ Elf64_Xword m_info; /* Size and index. */ -+ Elf64_Xword m_poffset; /* Symbol offset. */ -+ Elf64_Half m_repeat; /* Repeat count. */ -+ Elf64_Half m_stride; /* Stride info. */ -+} Elf64_Move; -+ -+/* Macro to construct move records. */ -+#define ELF32_M_SYM(info) ((info) >> 8) -+#define ELF32_M_SIZE(info) ((unsigned char) (info)) -+#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) -+ -+#define ELF64_M_SYM(info) ELF32_M_SYM (info) -+#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) -+#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) -+ -+ -+/* Motorola 68k specific definitions. */ -+ -+/* Values for Elf32_Ehdr.e_flags. */ -+#define EF_CPU32 0x00810000 -+ -+/* m68k relocs. */ -+ -+#define R_68K_NONE 0 /* No reloc */ -+#define R_68K_32 1 /* Direct 32 bit */ -+#define R_68K_16 2 /* Direct 16 bit */ -+#define R_68K_8 3 /* Direct 8 bit */ -+#define R_68K_PC32 4 /* PC relative 32 bit */ -+#define R_68K_PC16 5 /* PC relative 16 bit */ -+#define R_68K_PC8 6 /* PC relative 8 bit */ -+#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ -+#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ -+#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ -+#define R_68K_GOT32O 10 /* 32 bit GOT offset */ -+#define R_68K_GOT16O 11 /* 16 bit GOT offset */ -+#define R_68K_GOT8O 12 /* 8 bit GOT offset */ -+#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ -+#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ -+#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ -+#define R_68K_PLT32O 16 /* 32 bit PLT offset */ -+#define R_68K_PLT16O 17 /* 16 bit PLT offset */ -+#define R_68K_PLT8O 18 /* 8 bit PLT offset */ -+#define R_68K_COPY 19 /* Copy symbol at runtime */ -+#define R_68K_GLOB_DAT 20 /* Create GOT entry */ -+#define R_68K_JMP_SLOT 21 /* Create PLT entry */ -+#define R_68K_RELATIVE 22 /* Adjust by program base */ -+#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */ -+#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */ -+#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */ -+#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */ -+#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */ -+#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */ -+#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */ -+#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */ -+#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */ -+#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */ -+#define R_68K_TLS_LE32 37 /* 32 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE16 38 /* 16 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE8 39 /* 8 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */ -+#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */ -+#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */ -+/* Keep this the last entry. */ -+#define R_68K_NUM 43 -+ -+/* Intel 80386 specific definitions. */ -+ -+/* i386 relocs. */ -+ -+#define R_386_NONE 0 /* No reloc */ -+#define R_386_32 1 /* Direct 32 bit */ -+#define R_386_PC32 2 /* PC relative 32 bit */ -+#define R_386_GOT32 3 /* 32 bit GOT entry */ -+#define R_386_PLT32 4 /* 32 bit PLT address */ -+#define R_386_COPY 5 /* Copy symbol at runtime */ -+#define R_386_GLOB_DAT 6 /* Create GOT entry */ -+#define R_386_JMP_SLOT 7 /* Create PLT entry */ -+#define R_386_RELATIVE 8 /* Adjust by program base */ -+#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ -+#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ -+#define R_386_32PLT 11 -+#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ -+#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS -+ block offset */ -+#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block -+ offset */ -+#define R_386_TLS_LE 17 /* Offset relative to static TLS -+ block */ -+#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of -+ general dynamic thread local data */ -+#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of -+ local dynamic thread local data -+ in LE code */ -+#define R_386_16 20 -+#define R_386_PC16 21 -+#define R_386_8 22 -+#define R_386_PC8 23 -+#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic -+ thread local data */ -+#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ -+#define R_386_TLS_GD_CALL 26 /* Relocation for call to -+ __tls_get_addr() */ -+#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ -+#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic -+ thread local data in LE code */ -+#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ -+#define R_386_TLS_LDM_CALL 30 /* Relocation for call to -+ __tls_get_addr() in LDM code */ -+#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ -+#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ -+#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS -+ block offset */ -+#define R_386_TLS_LE_32 34 /* Negated offset relative to static -+ TLS block */ -+#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ -+#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ -+#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ -+/* 38? */ -+#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ -+#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS -+ descriptor for -+ relaxation. */ -+#define R_386_TLS_DESC 41 /* TLS descriptor containing -+ pointer to code and to -+ argument, returning the TLS -+ offset for the symbol. */ -+#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ -+/* Keep this the last entry. */ -+#define R_386_NUM 43 -+ -+/* SUN SPARC specific definitions. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ -+ -+/* Values for Elf64_Ehdr.e_flags. */ -+ -+#define EF_SPARCV9_MM 3 -+#define EF_SPARCV9_TSO 0 -+#define EF_SPARCV9_PSO 1 -+#define EF_SPARCV9_RMO 2 -+#define EF_SPARC_LEDATA 0x800000 /* little endian data */ -+#define EF_SPARC_EXT_MASK 0xFFFF00 -+#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ -+#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ -+#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ -+#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ -+ -+/* SPARC relocs. */ -+ -+#define R_SPARC_NONE 0 /* No reloc */ -+#define R_SPARC_8 1 /* Direct 8 bit */ -+#define R_SPARC_16 2 /* Direct 16 bit */ -+#define R_SPARC_32 3 /* Direct 32 bit */ -+#define R_SPARC_DISP8 4 /* PC relative 8 bit */ -+#define R_SPARC_DISP16 5 /* PC relative 16 bit */ -+#define R_SPARC_DISP32 6 /* PC relative 32 bit */ -+#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ -+#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ -+#define R_SPARC_HI22 9 /* High 22 bit */ -+#define R_SPARC_22 10 /* Direct 22 bit */ -+#define R_SPARC_13 11 /* Direct 13 bit */ -+#define R_SPARC_LO10 12 /* Truncated 10 bit */ -+#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ -+#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ -+#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ -+#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ -+#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ -+#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ -+#define R_SPARC_COPY 19 /* Copy symbol at runtime */ -+#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ -+#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ -+#define R_SPARC_RELATIVE 22 /* Adjust by program base */ -+#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ -+ -+/* Additional Sparc64 relocs. */ -+ -+#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ -+#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ -+#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ -+#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ -+#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ -+#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ -+#define R_SPARC_10 30 /* Direct 10 bit */ -+#define R_SPARC_11 31 /* Direct 11 bit */ -+#define R_SPARC_64 32 /* Direct 64 bit */ -+#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ -+#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ -+#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ -+#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ -+#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ -+#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ -+#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ -+#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ -+#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ -+#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ -+#define R_SPARC_7 43 /* Direct 7 bit */ -+#define R_SPARC_5 44 /* Direct 5 bit */ -+#define R_SPARC_6 45 /* Direct 6 bit */ -+#define R_SPARC_DISP64 46 /* PC relative 64 bit */ -+#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ -+#define R_SPARC_HIX22 48 /* High 22 bit complemented */ -+#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ -+#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ -+#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ -+#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ -+#define R_SPARC_REGISTER 53 /* Global register usage */ -+#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ -+#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ -+#define R_SPARC_TLS_GD_HI22 56 -+#define R_SPARC_TLS_GD_LO10 57 -+#define R_SPARC_TLS_GD_ADD 58 -+#define R_SPARC_TLS_GD_CALL 59 -+#define R_SPARC_TLS_LDM_HI22 60 -+#define R_SPARC_TLS_LDM_LO10 61 -+#define R_SPARC_TLS_LDM_ADD 62 -+#define R_SPARC_TLS_LDM_CALL 63 -+#define R_SPARC_TLS_LDO_HIX22 64 -+#define R_SPARC_TLS_LDO_LOX10 65 -+#define R_SPARC_TLS_LDO_ADD 66 -+#define R_SPARC_TLS_IE_HI22 67 -+#define R_SPARC_TLS_IE_LO10 68 -+#define R_SPARC_TLS_IE_LD 69 -+#define R_SPARC_TLS_IE_LDX 70 -+#define R_SPARC_TLS_IE_ADD 71 -+#define R_SPARC_TLS_LE_HIX22 72 -+#define R_SPARC_TLS_LE_LOX10 73 -+#define R_SPARC_TLS_DTPMOD32 74 -+#define R_SPARC_TLS_DTPMOD64 75 -+#define R_SPARC_TLS_DTPOFF32 76 -+#define R_SPARC_TLS_DTPOFF64 77 -+#define R_SPARC_TLS_TPOFF32 78 -+#define R_SPARC_TLS_TPOFF64 79 -+#define R_SPARC_GOTDATA_HIX22 80 -+#define R_SPARC_GOTDATA_LOX10 81 -+#define R_SPARC_GOTDATA_OP_HIX22 82 -+#define R_SPARC_GOTDATA_OP_LOX10 83 -+#define R_SPARC_GOTDATA_OP 84 -+#define R_SPARC_H34 85 -+#define R_SPARC_SIZE32 86 -+#define R_SPARC_SIZE64 87 -+#define R_SPARC_WDISP10 88 -+#define R_SPARC_JMP_IREL 248 -+#define R_SPARC_IRELATIVE 249 -+#define R_SPARC_GNU_VTINHERIT 250 -+#define R_SPARC_GNU_VTENTRY 251 -+#define R_SPARC_REV32 252 -+/* Keep this the last entry. */ -+#define R_SPARC_NUM 253 -+ -+/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ -+ -+#define DT_SPARC_REGISTER 0x70000001 -+#define DT_SPARC_NUM 2 -+ -+/* MIPS R3000 specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ -+#define EF_MIPS_PIC 2 /* Contains PIC code */ -+#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ -+#define EF_MIPS_XGOT 8 -+#define EF_MIPS_64BIT_WHIRL 16 -+#define EF_MIPS_ABI2 32 -+#define EF_MIPS_ABI_ON32 64 -+#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ -+ -+/* Legal values for MIPS architecture level. */ -+ -+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* The following are non-official names and should not be used. */ -+ -+#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* Special section indices. */ -+ -+#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ -+#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ -+#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ -+#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ -+#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ -+#define SHT_MIPS_MSYM 0x70000001 -+#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ -+#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ -+#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ -+#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ -+#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ -+#define SHT_MIPS_PACKAGE 0x70000007 -+#define SHT_MIPS_PACKSYM 0x70000008 -+#define SHT_MIPS_RELD 0x70000009 -+#define SHT_MIPS_IFACE 0x7000000b -+#define SHT_MIPS_CONTENT 0x7000000c -+#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ -+#define SHT_MIPS_SHDR 0x70000010 -+#define SHT_MIPS_FDESC 0x70000011 -+#define SHT_MIPS_EXTSYM 0x70000012 -+#define SHT_MIPS_DENSE 0x70000013 -+#define SHT_MIPS_PDESC 0x70000014 -+#define SHT_MIPS_LOCSYM 0x70000015 -+#define SHT_MIPS_AUXSYM 0x70000016 -+#define SHT_MIPS_OPTSYM 0x70000017 -+#define SHT_MIPS_LOCSTR 0x70000018 -+#define SHT_MIPS_LINE 0x70000019 -+#define SHT_MIPS_RFDESC 0x7000001a -+#define SHT_MIPS_DELTASYM 0x7000001b -+#define SHT_MIPS_DELTAINST 0x7000001c -+#define SHT_MIPS_DELTACLASS 0x7000001d -+#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ -+#define SHT_MIPS_DELTADECL 0x7000001f -+#define SHT_MIPS_SYMBOL_LIB 0x70000020 -+#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ -+#define SHT_MIPS_TRANSLATE 0x70000022 -+#define SHT_MIPS_PIXIE 0x70000023 -+#define SHT_MIPS_XLATE 0x70000024 -+#define SHT_MIPS_XLATE_DEBUG 0x70000025 -+#define SHT_MIPS_WHIRL 0x70000026 -+#define SHT_MIPS_EH_REGION 0x70000027 -+#define SHT_MIPS_XLATE_OLD 0x70000028 -+#define SHT_MIPS_PDR_EXCEPTION 0x70000029 -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ -+#define SHF_MIPS_MERGE 0x20000000 -+#define SHF_MIPS_ADDR 0x40000000 -+#define SHF_MIPS_STRINGS 0x80000000 -+#define SHF_MIPS_NOSTRIP 0x08000000 -+#define SHF_MIPS_LOCAL 0x04000000 -+#define SHF_MIPS_NAMES 0x02000000 -+#define SHF_MIPS_NODUPE 0x01000000 -+ -+ -+/* Symbol tables. */ -+ -+/* MIPS specific values for `st_other'. */ -+#define STO_MIPS_DEFAULT 0x0 -+#define STO_MIPS_INTERNAL 0x1 -+#define STO_MIPS_HIDDEN 0x2 -+#define STO_MIPS_PROTECTED 0x3 -+#define STO_MIPS_PLT 0x8 -+#define STO_MIPS_SC_ALIGN_UNUSED 0xff -+ -+/* MIPS specific values for `st_info'. */ -+#define STB_MIPS_SPLIT_COMMON 13 -+ -+/* Entries found in sections of type SHT_MIPS_GPTAB. */ -+ -+typedef union -+{ -+ struct -+ { -+ Elf32_Word gt_current_g_value; /* -G value used for compilation */ -+ Elf32_Word gt_unused; /* Not used */ -+ } gt_header; /* First entry in section */ -+ struct -+ { -+ Elf32_Word gt_g_value; /* If this value were used for -G */ -+ Elf32_Word gt_bytes; /* This many bytes would be used */ -+ } gt_entry; /* Subsequent entries in section */ -+} Elf32_gptab; -+ -+/* Entry found in sections of type SHT_MIPS_REGINFO. */ -+ -+typedef struct -+{ -+ Elf32_Word ri_gprmask; /* General registers used */ -+ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ -+ Elf32_Sword ri_gp_value; /* $gp register value */ -+} Elf32_RegInfo; -+ -+/* Entries found in sections of type SHT_MIPS_OPTIONS. */ -+ -+typedef struct -+{ -+ unsigned char kind; /* Determines interpretation of the -+ variable part of descriptor. */ -+ unsigned char size; /* Size of descriptor, including header. */ -+ Elf32_Section section; /* Section header index of section affected, -+ 0 for global options. */ -+ Elf32_Word info; /* Kind-specific information. */ -+} Elf_Options; -+ -+/* Values for `kind' field in Elf_Options. */ -+ -+#define ODK_NULL 0 /* Undefined. */ -+#define ODK_REGINFO 1 /* Register usage information. */ -+#define ODK_EXCEPTIONS 2 /* Exception processing options. */ -+#define ODK_PAD 3 /* Section padding options. */ -+#define ODK_HWPATCH 4 /* Hardware workarounds performed */ -+#define ODK_FILL 5 /* record the fill value used by the linker. */ -+#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ -+#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ -+#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ -+ -+/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ -+ -+#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ -+#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ -+#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ -+#define OEX_SMM 0x20000 /* Force sequential memory mode? */ -+#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ -+#define OEX_PRECISEFP OEX_FPDBUG -+#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ -+ -+#define OEX_FPU_INVAL 0x10 -+#define OEX_FPU_DIV0 0x08 -+#define OEX_FPU_OFLO 0x04 -+#define OEX_FPU_UFLO 0x02 -+#define OEX_FPU_INEX 0x01 -+ -+/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ -+ -+#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ -+#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ -+#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ -+#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ -+ -+#define OPAD_PREFIX 0x1 -+#define OPAD_POSTFIX 0x2 -+#define OPAD_SYMBOL 0x4 -+ -+/* Entry found in `.options' section. */ -+ -+typedef struct -+{ -+ Elf32_Word hwp_flags1; /* Extra flags. */ -+ Elf32_Word hwp_flags2; /* Extra flags. */ -+} Elf_Options_Hw; -+ -+/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ -+ -+#define OHWA0_R4KEOP_CHECKED 0x00000001 -+#define OHWA1_R4KEOP_CLEAN 0x00000002 -+ -+/* MIPS relocs. */ -+ -+#define R_MIPS_NONE 0 /* No reloc */ -+#define R_MIPS_16 1 /* Direct 16 bit */ -+#define R_MIPS_32 2 /* Direct 32 bit */ -+#define R_MIPS_REL32 3 /* PC relative 32 bit */ -+#define R_MIPS_26 4 /* Direct 26 bit shifted */ -+#define R_MIPS_HI16 5 /* High 16 bit */ -+#define R_MIPS_LO16 6 /* Low 16 bit */ -+#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ -+#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ -+#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ -+#define R_MIPS_PC16 10 /* PC relative 16 bit */ -+#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ -+#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ -+ -+#define R_MIPS_SHIFT5 16 -+#define R_MIPS_SHIFT6 17 -+#define R_MIPS_64 18 -+#define R_MIPS_GOT_DISP 19 -+#define R_MIPS_GOT_PAGE 20 -+#define R_MIPS_GOT_OFST 21 -+#define R_MIPS_GOT_HI16 22 -+#define R_MIPS_GOT_LO16 23 -+#define R_MIPS_SUB 24 -+#define R_MIPS_INSERT_A 25 -+#define R_MIPS_INSERT_B 26 -+#define R_MIPS_DELETE 27 -+#define R_MIPS_HIGHER 28 -+#define R_MIPS_HIGHEST 29 -+#define R_MIPS_CALL_HI16 30 -+#define R_MIPS_CALL_LO16 31 -+#define R_MIPS_SCN_DISP 32 -+#define R_MIPS_REL16 33 -+#define R_MIPS_ADD_IMMEDIATE 34 -+#define R_MIPS_PJUMP 35 -+#define R_MIPS_RELGOT 36 -+#define R_MIPS_JALR 37 -+#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ -+#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ -+#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ -+#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ -+#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ -+#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ -+#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ -+#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ -+#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ -+#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ -+#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ -+#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ -+#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ -+#define R_MIPS_GLOB_DAT 51 -+#define R_MIPS_COPY 126 -+#define R_MIPS_JUMP_SLOT 127 -+/* Keep this the last entry. */ -+#define R_MIPS_NUM 128 -+ -+/* Legal values for p_type field of Elf32_Phdr. */ -+ -+#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ -+#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ -+#define PT_MIPS_OPTIONS 0x70000002 -+ -+/* Special program header types. */ -+ -+#define PF_MIPS_LOCAL 0x10000000 -+ -+/* Legal values for d_tag field of Elf32_Dyn. */ -+ -+#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ -+#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ -+#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ -+#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ -+#define DT_MIPS_FLAGS 0x70000005 /* Flags */ -+#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ -+#define DT_MIPS_MSYM 0x70000007 -+#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ -+#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ -+#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ -+#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ -+#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ -+#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ -+#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ -+#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ -+#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ -+#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ -+#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ -+#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in -+ DT_MIPS_DELTA_CLASS. */ -+#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ -+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in -+ DT_MIPS_DELTA_INSTANCE. */ -+#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ -+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in -+ DT_MIPS_DELTA_RELOC. */ -+#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta -+ relocations refer to. */ -+#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in -+ DT_MIPS_DELTA_SYM. */ -+#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the -+ class declaration. */ -+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in -+ DT_MIPS_DELTA_CLASSSYM. */ -+#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ -+#define DT_MIPS_PIXIE_INIT 0x70000023 -+#define DT_MIPS_SYMBOL_LIB 0x70000024 -+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 -+#define DT_MIPS_LOCAL_GOTIDX 0x70000026 -+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 -+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 -+#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ -+#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ -+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b -+#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ -+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve -+ function stored in GOT. */ -+#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added -+ by rld on dlopen() calls. */ -+#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ -+#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ -+#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ -+/* The address of .got.plt in an executable using the new non-PIC ABI. */ -+#define DT_MIPS_PLTGOT 0x70000032 -+/* The base of the PLT in an executable using the new non-PIC ABI if that -+ PLT is writable. For a non-writable PLT, this is omitted or has a zero -+ value. */ -+#define DT_MIPS_RWPLT 0x70000034 -+#define DT_MIPS_NUM 0x35 -+ -+/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ -+ -+#define RHF_NONE 0 /* No flags */ -+#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ -+#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ -+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ -+#define RHF_NO_MOVE (1 << 3) -+#define RHF_SGI_ONLY (1 << 4) -+#define RHF_GUARANTEE_INIT (1 << 5) -+#define RHF_DELTA_C_PLUS_PLUS (1 << 6) -+#define RHF_GUARANTEE_START_INIT (1 << 7) -+#define RHF_PIXIE (1 << 8) -+#define RHF_DEFAULT_DELAY_LOAD (1 << 9) -+#define RHF_REQUICKSTART (1 << 10) -+#define RHF_REQUICKSTARTED (1 << 11) -+#define RHF_CORD (1 << 12) -+#define RHF_NO_UNRES_UNDEF (1 << 13) -+#define RHF_RLD_ORDER_SAFE (1 << 14) -+ -+/* Entries found in sections of type SHT_MIPS_LIBLIST. */ -+ -+typedef struct -+{ -+ Elf32_Word l_name; /* Name (string table index) */ -+ Elf32_Word l_time_stamp; /* Timestamp */ -+ Elf32_Word l_checksum; /* Checksum */ -+ Elf32_Word l_version; /* Interface version */ -+ Elf32_Word l_flags; /* Flags */ -+} Elf32_Lib; -+ -+typedef struct -+{ -+ Elf64_Word l_name; /* Name (string table index) */ -+ Elf64_Word l_time_stamp; /* Timestamp */ -+ Elf64_Word l_checksum; /* Checksum */ -+ Elf64_Word l_version; /* Interface version */ -+ Elf64_Word l_flags; /* Flags */ -+} Elf64_Lib; -+ -+ -+/* Legal values for l_flags. */ -+ -+#define LL_NONE 0 -+#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ -+#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ -+#define LL_REQUIRE_MINOR (1 << 2) -+#define LL_EXPORTS (1 << 3) -+#define LL_DELAY_LOAD (1 << 4) -+#define LL_DELTA (1 << 5) -+ -+/* Entries found in sections of type SHT_MIPS_CONFLICT. */ -+ -+typedef Elf32_Addr Elf32_Conflict; -+ -+ -+/* HPPA specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ -+#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ -+#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ -+#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ -+#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch -+ prediction. */ -+#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ -+#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ -+ -+/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ -+ -+#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ -+#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ -+#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ -+ -+/* Additional section indeces. */ -+ -+#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared -+ symbols in ANSI C. */ -+#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ -+#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ -+#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ -+#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ -+#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ -+ -+#define STT_HP_OPAQUE (STT_LOOS + 0x1) -+#define STT_HP_STUB (STT_LOOS + 0x2) -+ -+/* HPPA relocs. */ -+ -+#define R_PARISC_NONE 0 /* No reloc. */ -+#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ -+#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ -+#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ -+#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ -+#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ -+#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ -+#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ -+#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ -+#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ -+#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ -+#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ -+#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ -+#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ -+#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ -+#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ -+#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ -+#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ -+#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ -+#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ -+#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ -+#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ -+#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ -+#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ -+#define R_PARISC_FPTR64 64 /* 64 bits function address. */ -+#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ -+#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ -+#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ -+#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ -+#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ -+#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ -+#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ -+#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ -+#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ -+#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ -+#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ -+#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ -+#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ -+#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ -+#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ -+#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ -+#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ -+#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LORESERVE 128 -+#define R_PARISC_COPY 128 /* Copy relocation. */ -+#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ -+#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ -+#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ -+#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ -+#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ -+#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ -+#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ -+#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ -+#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_GNU_VTENTRY 232 -+#define R_PARISC_GNU_VTINHERIT 233 -+#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ -+#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ -+#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ -+#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ -+#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ -+#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ -+#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ -+#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ -+#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ -+#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ -+#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L -+#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R -+#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L -+#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R -+#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 -+#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 -+#define R_PARISC_HIRESERVE 255 -+ -+/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PT_HP_TLS (PT_LOOS + 0x0) -+#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -+#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -+#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -+#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -+#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -+#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -+#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -+#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -+#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -+#define PT_HP_PARALLEL (PT_LOOS + 0x10) -+#define PT_HP_FASTBIND (PT_LOOS + 0x11) -+#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) -+#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) -+#define PT_HP_STACK (PT_LOOS + 0x14) -+ -+#define PT_PARISC_ARCHEXT 0x70000000 -+#define PT_PARISC_UNWIND 0x70000001 -+ -+/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PF_PARISC_SBP 0x08000000 -+ -+#define PF_HP_PAGE_SIZE 0x00100000 -+#define PF_HP_FAR_SHARED 0x00200000 -+#define PF_HP_NEAR_SHARED 0x00400000 -+#define PF_HP_CODE 0x01000000 -+#define PF_HP_MODIFY 0x02000000 -+#define PF_HP_LAZYSWAP 0x04000000 -+#define PF_HP_SBP 0x08000000 -+ -+ -+/* Alpha specific definitions. */ -+ -+/* Legal values for e_flags field of Elf64_Ehdr. */ -+ -+#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ -+#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ -+ -+/* Legal values for sh_type field of Elf64_Shdr. */ -+ -+/* These two are primerily concerned with ECOFF debugging info. */ -+#define SHT_ALPHA_DEBUG 0x70000001 -+#define SHT_ALPHA_REGINFO 0x70000002 -+ -+/* Legal values for sh_flags field of Elf64_Shdr. */ -+ -+#define SHF_ALPHA_GPREL 0x10000000 -+ -+/* Legal values for st_other field of Elf64_Sym. */ -+#define STO_ALPHA_NOPV 0x80 /* No PV required. */ -+#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ -+ -+/* Alpha relocs. */ -+ -+#define R_ALPHA_NONE 0 /* No reloc */ -+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ -+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ -+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ -+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ -+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ -+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ -+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ -+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ -+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ -+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ -+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ -+#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ -+#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ -+#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ -+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ -+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ -+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ -+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ -+#define R_ALPHA_TLS_GD_HI 28 -+#define R_ALPHA_TLSGD 29 -+#define R_ALPHA_TLS_LDM 30 -+#define R_ALPHA_DTPMOD64 31 -+#define R_ALPHA_GOTDTPREL 32 -+#define R_ALPHA_DTPREL64 33 -+#define R_ALPHA_DTPRELHI 34 -+#define R_ALPHA_DTPRELLO 35 -+#define R_ALPHA_DTPREL16 36 -+#define R_ALPHA_GOTTPREL 37 -+#define R_ALPHA_TPREL64 38 -+#define R_ALPHA_TPRELHI 39 -+#define R_ALPHA_TPRELLO 40 -+#define R_ALPHA_TPREL16 41 -+/* Keep this the last entry. */ -+#define R_ALPHA_NUM 46 -+ -+/* Magic values of the LITUSE relocation addend. */ -+#define LITUSE_ALPHA_ADDR 0 -+#define LITUSE_ALPHA_BASE 1 -+#define LITUSE_ALPHA_BYTOFF 2 -+#define LITUSE_ALPHA_JSR 3 -+#define LITUSE_ALPHA_TLS_GD 4 -+#define LITUSE_ALPHA_TLS_LDM 5 -+ -+/* Legal values for d_tag of Elf64_Dyn. */ -+#define DT_ALPHA_PLTRO (DT_LOPROC + 0) -+#define DT_ALPHA_NUM 1 -+ -+/* PowerPC specific declarations */ -+ -+/* Values for Elf32/64_Ehdr.e_flags. */ -+#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ -+ -+/* Cygnus local bits below */ -+#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -+#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib -+ flag */ -+ -+/* PowerPC relocations defined by the ABIs */ -+#define R_PPC_NONE 0 -+#define R_PPC_ADDR32 1 /* 32bit absolute address */ -+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -+#define R_PPC_ADDR16 3 /* 16bit absolute address */ -+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -+#define R_PPC_ADDR14_BRTAKEN 8 -+#define R_PPC_ADDR14_BRNTAKEN 9 -+#define R_PPC_REL24 10 /* PC relative 26 bit */ -+#define R_PPC_REL14 11 /* PC relative 16 bit */ -+#define R_PPC_REL14_BRTAKEN 12 -+#define R_PPC_REL14_BRNTAKEN 13 -+#define R_PPC_GOT16 14 -+#define R_PPC_GOT16_LO 15 -+#define R_PPC_GOT16_HI 16 -+#define R_PPC_GOT16_HA 17 -+#define R_PPC_PLTREL24 18 -+#define R_PPC_COPY 19 -+#define R_PPC_GLOB_DAT 20 -+#define R_PPC_JMP_SLOT 21 -+#define R_PPC_RELATIVE 22 -+#define R_PPC_LOCAL24PC 23 -+#define R_PPC_UADDR32 24 -+#define R_PPC_UADDR16 25 -+#define R_PPC_REL32 26 -+#define R_PPC_PLT32 27 -+#define R_PPC_PLTREL32 28 -+#define R_PPC_PLT16_LO 29 -+#define R_PPC_PLT16_HI 30 -+#define R_PPC_PLT16_HA 31 -+#define R_PPC_SDAREL16 32 -+#define R_PPC_SECTOFF 33 -+#define R_PPC_SECTOFF_LO 34 -+#define R_PPC_SECTOFF_HI 35 -+#define R_PPC_SECTOFF_HA 36 -+ -+/* PowerPC relocations defined for the TLS access ABI. */ -+#define R_PPC_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ -+#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ -+#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ -+#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ -+#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ -+#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ -+#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ -+#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ -+#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ -+ -+/* The remaining relocs are from the Embedded ELF ABI, and are not -+ in the SVR4 ELF ABI. */ -+#define R_PPC_EMB_NADDR32 101 -+#define R_PPC_EMB_NADDR16 102 -+#define R_PPC_EMB_NADDR16_LO 103 -+#define R_PPC_EMB_NADDR16_HI 104 -+#define R_PPC_EMB_NADDR16_HA 105 -+#define R_PPC_EMB_SDAI16 106 -+#define R_PPC_EMB_SDA2I16 107 -+#define R_PPC_EMB_SDA2REL 108 -+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -+#define R_PPC_EMB_MRKREF 110 -+#define R_PPC_EMB_RELSEC16 111 -+#define R_PPC_EMB_RELST_LO 112 -+#define R_PPC_EMB_RELST_HI 113 -+#define R_PPC_EMB_RELST_HA 114 -+#define R_PPC_EMB_BIT_FLD 115 -+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ -+ -+/* Diab tool relocations. */ -+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC_IRELATIVE 248 -+ -+/* GNU relocs used in PIC code sequences. */ -+#define R_PPC_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* This is a phony reloc to handle any old fashioned TOC16 references -+ that may still be in object files. */ -+#define R_PPC_TOC16 255 -+ -+/* PowerPC specific values for the Dyn d_tag field. */ -+#define DT_PPC_GOT (DT_LOPROC + 0) -+#define DT_PPC_NUM 1 -+ -+/* PowerPC64 relocations defined by the ABIs */ -+#define R_PPC64_NONE R_PPC_NONE -+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ -+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ -+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ -+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ -+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ -+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ -+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ -+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN -+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN -+#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ -+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ -+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN -+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN -+#define R_PPC64_GOT16 R_PPC_GOT16 -+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO -+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI -+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA -+ -+#define R_PPC64_COPY R_PPC_COPY -+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT -+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT -+#define R_PPC64_RELATIVE R_PPC_RELATIVE -+ -+#define R_PPC64_UADDR32 R_PPC_UADDR32 -+#define R_PPC64_UADDR16 R_PPC_UADDR16 -+#define R_PPC64_REL32 R_PPC_REL32 -+#define R_PPC64_PLT32 R_PPC_PLT32 -+#define R_PPC64_PLTREL32 R_PPC_PLTREL32 -+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO -+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI -+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA -+ -+#define R_PPC64_SECTOFF R_PPC_SECTOFF -+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO -+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI -+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA -+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ -+#define R_PPC64_ADDR64 38 /* doubleword64 S + A */ -+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ -+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ -+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ -+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ -+#define R_PPC64_UADDR64 43 /* doubleword64 S + A */ -+#define R_PPC64_REL64 44 /* doubleword64 S + A - P */ -+#define R_PPC64_PLT64 45 /* doubleword64 L + A */ -+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ -+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ -+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ -+#define R_PPC64_TOC 51 /* doubleword64 .TOC */ -+#define R_PPC64_PLTGOT16 52 /* half16* M + A */ -+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ -+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ -+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ -+ -+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ -+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ -+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ -+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ -+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ -+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ -+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ -+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ -+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ -+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ -+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ -+ -+/* PowerPC64 relocations defined for the TLS access ABI. */ -+#define R_PPC64_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ -+#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ -+#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ -+#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ -+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ -+#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ -+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ -+#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ -+#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ -+#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ -+#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ -+#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ -+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ -+#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ -+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ -+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ -+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC64_JMP_IREL 247 -+#define R_PPC64_IRELATIVE 248 -+#define R_PPC64_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* PowerPC64 specific values for the Dyn d_tag field. */ -+#define DT_PPC64_GLINK (DT_LOPROC + 0) -+#define DT_PPC64_OPD (DT_LOPROC + 1) -+#define DT_PPC64_OPDSZ (DT_LOPROC + 2) -+#define DT_PPC64_NUM 3 -+ -+ -+/* ARM specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_ARM_RELEXEC 0x01 -+#define EF_ARM_HASENTRY 0x02 -+#define EF_ARM_INTERWORK 0x04 -+#define EF_ARM_APCS_26 0x08 -+#define EF_ARM_APCS_FLOAT 0x10 -+#define EF_ARM_PIC 0x20 -+#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ -+#define EF_ARM_NEW_ABI 0x80 -+#define EF_ARM_OLD_ABI 0x100 -+#define EF_ARM_SOFT_FLOAT 0x200 -+#define EF_ARM_VFP_FLOAT 0x400 -+#define EF_ARM_MAVERICK_FLOAT 0x800 -+ -+ -+/* Other constants defined in the ARM ELF spec. version B-01. */ -+/* NB. These conflict with values defined above. */ -+#define EF_ARM_SYMSARESORTED 0x04 -+#define EF_ARM_DYNSYMSUSESEGIDX 0x08 -+#define EF_ARM_MAPSYMSFIRST 0x10 -+#define EF_ARM_EABIMASK 0XFF000000 -+ -+/* Constants defined in AAELF. */ -+#define EF_ARM_BE8 0x00800000 -+#define EF_ARM_LE8 0x00400000 -+ -+#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) -+#define EF_ARM_EABI_UNKNOWN 0x00000000 -+#define EF_ARM_EABI_VER1 0x01000000 -+#define EF_ARM_EABI_VER2 0x02000000 -+#define EF_ARM_EABI_VER3 0x03000000 -+#define EF_ARM_EABI_VER4 0x04000000 -+#define EF_ARM_EABI_VER5 0x05000000 -+ -+/* Additional symbol types for Thumb. */ -+#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ -+#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ -+ -+/* ARM-specific values for sh_flags */ -+#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ -+#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined -+ in the input to a link step. */ -+ -+/* ARM-specific program header flags */ -+#define PF_ARM_SB 0x10000000 /* Segment contains the location -+ addressed by the static base. */ -+#define PF_ARM_PI 0x20000000 /* Position-independent segment. */ -+#define PF_ARM_ABS 0x40000000 /* Absolute segment. */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ -+#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ -+#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ -+ -+ -+/* ARM relocs. */ -+ -+#define R_ARM_NONE 0 /* No reloc */ -+#define R_ARM_PC24 1 /* PC relative 26 bit branch */ -+#define R_ARM_ABS32 2 /* Direct 32 bit */ -+#define R_ARM_REL32 3 /* PC relative 32 bit */ -+#define R_ARM_PC13 4 -+#define R_ARM_ABS16 5 /* Direct 16 bit */ -+#define R_ARM_ABS12 6 /* Direct 12 bit */ -+#define R_ARM_THM_ABS5 7 -+#define R_ARM_ABS8 8 /* Direct 8 bit */ -+#define R_ARM_SBREL32 9 -+#define R_ARM_THM_PC22 10 -+#define R_ARM_THM_PC8 11 -+#define R_ARM_AMP_VCALL9 12 -+#define R_ARM_SWI24 13 /* Obsolete static relocation. */ -+#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ -+#define R_ARM_THM_SWI8 14 -+#define R_ARM_XPC25 15 -+#define R_ARM_THM_XPC22 16 -+#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ -+#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ -+#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ -+#define R_ARM_COPY 20 /* Copy symbol at runtime */ -+#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ -+#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ -+#define R_ARM_RELATIVE 23 /* Adjust by program base */ -+#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ -+#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ -+#define R_ARM_GOT32 26 /* 32 bit GOT entry */ -+#define R_ARM_PLT32 27 /* 32 bit PLT address */ -+#define R_ARM_ALU_PCREL_7_0 32 -+#define R_ARM_ALU_PCREL_15_8 33 -+#define R_ARM_ALU_PCREL_23_15 34 -+#define R_ARM_LDR_SBREL_11_0 35 -+#define R_ARM_ALU_SBREL_19_12 36 -+#define R_ARM_ALU_SBREL_27_20 37 -+#define R_ARM_TLS_GOTDESC 90 -+#define R_ARM_TLS_CALL 91 -+#define R_ARM_TLS_DESCSEQ 92 -+#define R_ARM_THM_TLS_CALL 93 -+#define R_ARM_GNU_VTENTRY 100 -+#define R_ARM_GNU_VTINHERIT 101 -+#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ -+#define R_ARM_THM_PC9 103 /* thumb conditional branch */ -+#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic -+ thread local data */ -+#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic -+ thread local data */ -+#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS -+ block */ -+#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of -+ static TLS block offset */ -+#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static -+ TLS block */ -+#define R_ARM_THM_TLS_DESCSEQ 129 -+#define R_ARM_IRELATIVE 160 -+#define R_ARM_RXPC25 249 -+#define R_ARM_RSBREL32 250 -+#define R_ARM_THM_RPC22 251 -+#define R_ARM_RREL32 252 -+#define R_ARM_RABS22 253 -+#define R_ARM_RPC24 254 -+#define R_ARM_RBASE 255 -+/* Keep this the last entry. */ -+#define R_ARM_NUM 256 -+ -+/* IA-64 specific declarations. */ -+ -+/* Processor specific flags for the Ehdr e_flags field. */ -+#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ -+#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ -+#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ -+#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ -+#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) -+#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) -+#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) -+ -+/* Processor specific flags for the Phdr p_flags field. */ -+#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ -+#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ -+ -+/* Processor specific flags for the Shdr sh_flags field. */ -+#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ -+#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Dyn d_tag field. */ -+#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) -+#define DT_IA_64_NUM 1 -+ -+/* IA-64 relocations. */ -+#define R_IA64_NONE 0x00 /* none */ -+#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ -+#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ -+#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ -+#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ -+#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ -+#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ -+#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ -+#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ -+#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ -+#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ -+#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ -+#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ -+#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ -+#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ -+#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ -+#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ -+#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ -+#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ -+#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ -+#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ -+#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ -+#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ -+#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ -+#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ -+#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ -+#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ -+#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ -+#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ -+#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ -+#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ -+#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ -+#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ -+#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ -+#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ -+#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ -+#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ -+#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ -+#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ -+#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ -+#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ -+#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ -+#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ -+#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ -+#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ -+#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ -+#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ -+#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ -+#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ -+#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ -+#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ -+#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ -+#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ -+#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ -+#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ -+#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ -+#define R_IA64_COPY 0x84 /* copy relocation */ -+#define R_IA64_SUB 0x85 /* Addend and symbol difference */ -+#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ -+#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ -+#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ -+#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ -+#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ -+#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ -+#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ -+#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ -+#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ -+#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ -+#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ -+#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ -+#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ -+#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ -+#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ -+#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ -+ -+/* SH specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_SH_MACH_MASK 0x1f -+#define EF_SH_UNKNOWN 0x0 -+#define EF_SH1 0x1 -+#define EF_SH2 0x2 -+#define EF_SH3 0x3 -+#define EF_SH_DSP 0x4 -+#define EF_SH3_DSP 0x5 -+#define EF_SH4AL_DSP 0x6 -+#define EF_SH3E 0x8 -+#define EF_SH4 0x9 -+#define EF_SH2E 0xb -+#define EF_SH4A 0xc -+#define EF_SH2A 0xd -+#define EF_SH4_NOFPU 0x10 -+#define EF_SH4A_NOFPU 0x11 -+#define EF_SH4_NOMMU_NOFPU 0x12 -+#define EF_SH2A_NOFPU 0x13 -+#define EF_SH3_NOMMU 0x14 -+#define EF_SH2A_SH4_NOFPU 0x15 -+#define EF_SH2A_SH3_NOFPU 0x16 -+#define EF_SH2A_SH4 0x17 -+#define EF_SH2A_SH3E 0x18 -+ -+/* SH relocs. */ -+#define R_SH_NONE 0 -+#define R_SH_DIR32 1 -+#define R_SH_REL32 2 -+#define R_SH_DIR8WPN 3 -+#define R_SH_IND12W 4 -+#define R_SH_DIR8WPL 5 -+#define R_SH_DIR8WPZ 6 -+#define R_SH_DIR8BP 7 -+#define R_SH_DIR8W 8 -+#define R_SH_DIR8L 9 -+#define R_SH_SWITCH16 25 -+#define R_SH_SWITCH32 26 -+#define R_SH_USES 27 -+#define R_SH_COUNT 28 -+#define R_SH_ALIGN 29 -+#define R_SH_CODE 30 -+#define R_SH_DATA 31 -+#define R_SH_LABEL 32 -+#define R_SH_SWITCH8 33 -+#define R_SH_GNU_VTINHERIT 34 -+#define R_SH_GNU_VTENTRY 35 -+#define R_SH_TLS_GD_32 144 -+#define R_SH_TLS_LD_32 145 -+#define R_SH_TLS_LDO_32 146 -+#define R_SH_TLS_IE_32 147 -+#define R_SH_TLS_LE_32 148 -+#define R_SH_TLS_DTPMOD32 149 -+#define R_SH_TLS_DTPOFF32 150 -+#define R_SH_TLS_TPOFF32 151 -+#define R_SH_GOT32 160 -+#define R_SH_PLT32 161 -+#define R_SH_COPY 162 -+#define R_SH_GLOB_DAT 163 -+#define R_SH_JMP_SLOT 164 -+#define R_SH_RELATIVE 165 -+#define R_SH_GOTOFF 166 -+#define R_SH_GOTPC 167 -+/* Keep this the last entry. */ -+#define R_SH_NUM 256 -+ -+/* S/390 specific definitions. */ -+ -+/* Valid values for the e_flags field. */ -+ -+#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */ -+ -+/* Additional s390 relocs */ -+ -+#define R_390_NONE 0 /* No reloc. */ -+#define R_390_8 1 /* Direct 8 bit. */ -+#define R_390_12 2 /* Direct 12 bit. */ -+#define R_390_16 3 /* Direct 16 bit. */ -+#define R_390_32 4 /* Direct 32 bit. */ -+#define R_390_PC32 5 /* PC relative 32 bit. */ -+#define R_390_GOT12 6 /* 12 bit GOT offset. */ -+#define R_390_GOT32 7 /* 32 bit GOT offset. */ -+#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ -+#define R_390_COPY 9 /* Copy symbol at runtime. */ -+#define R_390_GLOB_DAT 10 /* Create GOT entry. */ -+#define R_390_JMP_SLOT 11 /* Create PLT entry. */ -+#define R_390_RELATIVE 12 /* Adjust by program base. */ -+#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ -+#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ -+#define R_390_GOT16 15 /* 16 bit GOT offset. */ -+#define R_390_PC16 16 /* PC relative 16 bit. */ -+#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ -+#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ -+#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ -+#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ -+#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ -+#define R_390_64 22 /* Direct 64 bit. */ -+#define R_390_PC64 23 /* PC relative 64 bit. */ -+#define R_390_GOT64 24 /* 64 bit GOT offset. */ -+#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ -+#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ -+#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ -+#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ -+#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ -+#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ -+#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ -+#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ -+#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ -+#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ -+#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ -+#define R_390_TLS_GDCALL 38 /* Tag for function call in general -+ dynamic TLS code. */ -+#define R_390_TLS_LDCALL 39 /* Tag for function call in local -+ dynamic TLS code. */ -+#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ -+#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ -+#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS -+ block. */ -+#define R_390_20 57 /* Direct 20 bit. */ -+#define R_390_GOT20 58 /* 20 bit GOT offset. */ -+#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ -+#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */ -+/* Keep this the last entry. */ -+#define R_390_NUM 62 -+ -+ -+/* CRIS relocations. */ -+#define R_CRIS_NONE 0 -+#define R_CRIS_8 1 -+#define R_CRIS_16 2 -+#define R_CRIS_32 3 -+#define R_CRIS_8_PCREL 4 -+#define R_CRIS_16_PCREL 5 -+#define R_CRIS_32_PCREL 6 -+#define R_CRIS_GNU_VTINHERIT 7 -+#define R_CRIS_GNU_VTENTRY 8 -+#define R_CRIS_COPY 9 -+#define R_CRIS_GLOB_DAT 10 -+#define R_CRIS_JUMP_SLOT 11 -+#define R_CRIS_RELATIVE 12 -+#define R_CRIS_16_GOT 13 -+#define R_CRIS_32_GOT 14 -+#define R_CRIS_16_GOTPLT 15 -+#define R_CRIS_32_GOTPLT 16 -+#define R_CRIS_32_GOTREL 17 -+#define R_CRIS_32_PLT_GOTREL 18 -+#define R_CRIS_32_PLT_PCREL 19 -+ -+#define R_CRIS_NUM 20 -+ -+ -+/* AMD x86-64 relocations. */ -+#define R_X86_64_NONE 0 /* No reloc */ -+#define R_X86_64_64 1 /* Direct 64 bit */ -+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ -+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ -+#define R_X86_64_PLT32 4 /* 32 bit PLT address */ -+#define R_X86_64_COPY 5 /* Copy symbol at runtime */ -+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ -+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ -+#define R_X86_64_RELATIVE 8 /* Adjust by program base */ -+#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative -+ offset to GOT */ -+#define R_X86_64_32 10 /* Direct 32 bit zero extended */ -+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ -+#define R_X86_64_16 12 /* Direct 16 bit zero extended */ -+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ -+#define R_X86_64_8 14 /* Direct 8 bit sign extended */ -+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ -+#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ -+#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ -+#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ -+#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset -+ to two GOT entries for GD symbol */ -+#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset -+ to two GOT entries for LD symbol */ -+#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ -+#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset -+ to GOT entry for IE symbol */ -+#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ -+#define R_X86_64_PC64 24 /* PC relative 64 bit */ -+#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ -+#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative -+ offset to GOT */ -+#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ -+#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset -+ to GOT entry */ -+#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ -+#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ -+#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset -+ to PLT entry */ -+#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ -+#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ -+#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ -+#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS -+ descriptor. */ -+#define R_X86_64_TLSDESC 36 /* TLS descriptor. */ -+#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ -+#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ -+ -+#define R_X86_64_NUM 39 -+ -+ -+/* AM33 relocations. */ -+#define R_MN10300_NONE 0 /* No reloc. */ -+#define R_MN10300_32 1 /* Direct 32 bit. */ -+#define R_MN10300_16 2 /* Direct 16 bit. */ -+#define R_MN10300_8 3 /* Direct 8 bit. */ -+#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ -+#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ -+#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ -+#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ -+#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ -+#define R_MN10300_24 9 /* Direct 24 bit. */ -+#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ -+#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ -+#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ -+#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ -+#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ -+#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ -+#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ -+#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ -+#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ -+#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ -+#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ -+#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ -+ -+#define R_MN10300_NUM 24 -+ -+ -+/* M32R relocs. */ -+#define R_M32R_NONE 0 /* No reloc. */ -+#define R_M32R_16 1 /* Direct 16 bit. */ -+#define R_M32R_32 2 /* Direct 32 bit. */ -+#define R_M32R_24 3 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ -+#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ -+#define R_M32R_LO16 9 /* Low 16 bit. */ -+#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ -+#define R_M32R_GNU_VTINHERIT 11 -+#define R_M32R_GNU_VTENTRY 12 -+/* M32R relocs use SHT_RELA. */ -+#define R_M32R_16_RELA 33 /* Direct 16 bit. */ -+#define R_M32R_32_RELA 34 /* Direct 32 bit. */ -+#define R_M32R_24_RELA 35 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ -+#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ -+#define R_M32R_LO16_RELA 41 /* Low 16 bit */ -+#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ -+#define R_M32R_RELA_GNU_VTINHERIT 43 -+#define R_M32R_RELA_GNU_VTENTRY 44 -+#define R_M32R_REL32 45 /* PC relative 32 bit. */ -+ -+#define R_M32R_GOT24 48 /* 24 bit GOT entry */ -+#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ -+#define R_M32R_COPY 50 /* Copy symbol at runtime */ -+#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ -+#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ -+#define R_M32R_RELATIVE 53 /* Adjust by program base */ -+#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ -+#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ -+#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned -+ low */ -+#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed -+ low */ -+#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ -+#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to -+ GOT with unsigned low */ -+#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to -+ GOT with signed low */ -+#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to -+ GOT */ -+#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT -+ with unsigned low */ -+#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT -+ with signed low */ -+#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ -+#define R_M32R_NUM 256 /* Keep this the last entry. */ -+ -+ -+/* TILEPro relocations. */ -+#define R_TILEPRO_NONE 0 /* No reloc */ -+#define R_TILEPRO_32 1 /* Direct 32 bit */ -+#define R_TILEPRO_16 2 /* Direct 16 bit */ -+#define R_TILEPRO_8 3 /* Direct 8 bit */ -+#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */ -+#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */ -+#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */ -+#define R_TILEPRO_LO16 7 /* Low 16 bit */ -+#define R_TILEPRO_HI16 8 /* High 16 bit */ -+#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */ -+#define R_TILEPRO_COPY 10 /* Copy relocation */ -+#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */ -+#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */ -+#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */ -+#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */ -+#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */ -+#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */ -+#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */ -+#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */ -+#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */ -+#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */ -+#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */ -+#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */ -+#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */ -+/* Relocs 56-59 are currently not defined. */ -+#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */ -+#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */ -+#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */ -+#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */ -+#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */ -+#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */ -+ -+#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEPRO_NUM 130 -+ -+ -+/* TILE-Gx relocations. */ -+#define R_TILEGX_NONE 0 /* No reloc */ -+#define R_TILEGX_64 1 /* Direct 64 bit */ -+#define R_TILEGX_32 2 /* Direct 32 bit */ -+#define R_TILEGX_16 3 /* Direct 16 bit */ -+#define R_TILEGX_8 4 /* Direct 8 bit */ -+#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */ -+#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */ -+#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */ -+#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */ -+#define R_TILEGX_HW0 9 /* hword 0 16-bit */ -+#define R_TILEGX_HW1 10 /* hword 1 16-bit */ -+#define R_TILEGX_HW2 11 /* hword 2 16-bit */ -+#define R_TILEGX_HW3 12 /* hword 3 16-bit */ -+#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */ -+#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */ -+#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */ -+#define R_TILEGX_COPY 16 /* Copy relocation */ -+#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */ -+#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */ -+#define R_TILEGX_RELATIVE 19 /* Adjust by program base */ -+#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */ -+#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */ -+#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */ -+#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */ -+#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */ -+#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */ -+#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */ -+#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */ -+#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */ -+#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */ -+#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */ -+#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */ -+#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */ -+/* Relocs 66-71 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */ -+/* Relocs 76-77 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */ -+/* Relocs 90-91 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */ -+/* Relocs 94-99 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */ -+/* Relocs 104-105 are currently not defined. */ -+#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */ -+#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */ -+#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */ -+#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */ -+#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */ -+ -+#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEGX_NUM 130 -+ -+#endif /* elf.h */ diff --git a/target/linux/generic/pending-3.18/212-byteshift_portability.patch b/target/linux/generic/pending-3.18/212-byteshift_portability.patch deleted file mode 100644 index 0f23ba9be..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/213-x86_vdso_portability.patch b/target/linux/generic/pending-3.18/213-x86_vdso_portability.patch deleted file mode 100644 index 937ab9054..000000000 --- a/target/linux/generic/pending-3.18/213-x86_vdso_portability.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/arch/x86/vdso/vdso2c.c -+++ b/arch/x86/vdso/vdso2c.c -@@ -63,8 +63,8 @@ - - #include - --#include --#include -+#include -+#include - - const char *outfilename; - diff --git a/target/linux/generic/pending-3.18/214-spidev_h_portability.patch b/target/linux/generic/pending-3.18/214-spidev_h_portability.patch deleted file mode 100644 index dbee09054..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/220-gc_sections.patch b/target/linux/generic/pending-3.18/220-gc_sections.patch deleted file mode 100644 index d872949f8..000000000 --- a/target/linux/generic/pending-3.18/220-gc_sections.patch +++ /dev/null @@ -1,531 +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,7 +123,7 @@ - #ifdef CONFIG_EVENT_TRACING - #define FTRACE_EVENTS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_ftrace_events) = .; \ -- *(_ftrace_events) \ -+ KEEP(*(_ftrace_events)) \ - VMLINUX_SYMBOL(__stop_ftrace_events) = .; - #else - #define FTRACE_EVENTS() -@@ -131,7 +131,7 @@ - - #ifdef CONFIG_TRACING - #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \ -- *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \ -+ KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \ - VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .; - #define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \ - *(__tracepoint_str) /* Trace_printk fmt' pointer */ \ -@@ -144,7 +144,7 @@ - #ifdef CONFIG_FTRACE_SYSCALLS - #define TRACE_SYSCALLS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ -- *(__syscalls_metadata) \ -+ KEEP(*(__syscalls_metadata)) \ - VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; - #else - #define TRACE_SYSCALLS() -@@ -158,8 +158,8 @@ - #define _OF_TABLE_1(name) \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__##name##_of_table) = .; \ -- *(__##name##_of_table) \ -- *(__##name##_of_table_end) -+ KEEP(*(__##name##_of_table)) \ -+ KEEP(*(__##name##_of_table_end)) - - #define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc) - #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip) -@@ -171,7 +171,7 @@ - #define KERNEL_DTB() \ - STRUCT_ALIGN(); \ - VMLINUX_SYMBOL(__dtb_start) = .; \ -- *(.dtb.init.rodata) \ -+ KEEP(*(.dtb.init.rodata)) \ - VMLINUX_SYMBOL(__dtb_end) = .; - - /* .data section */ -@@ -187,16 +187,17 @@ - /* implement dynamic printk debug */ \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__start___jump_table) = .; \ -- *(__jump_table) \ -+ KEEP(*(__jump_table)) \ - VMLINUX_SYMBOL(__stop___jump_table) = .; \ - . = ALIGN(8); \ - VMLINUX_SYMBOL(__start___verbose) = .; \ -- *(__verbose) \ -+ KEEP(*(__verbose)) \ - VMLINUX_SYMBOL(__stop___verbose) = .; \ - LIKELY_PROFILE() \ - BRANCH_PROFILE() \ - TRACE_PRINTKS() \ -- TRACEPOINT_STR() -+ TRACEPOINT_STR() \ -+ *(.data.[a-zA-Z_]*) - - /* - * Data section helpers -@@ -250,35 +251,35 @@ - /* PCI quirks */ \ - .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \ -- *(.pci_fixup_early) \ -+ KEEP(*(.pci_fixup_early)) \ - VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \ -- *(.pci_fixup_header) \ -+ KEEP(*(.pci_fixup_header)) \ - VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \ -- *(.pci_fixup_final) \ -+ KEEP(*(.pci_fixup_final)) \ - VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ -- *(.pci_fixup_enable) \ -+ KEEP(*(.pci_fixup_enable)) \ - VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \ -- *(.pci_fixup_resume) \ -+ KEEP(*(.pci_fixup_resume)) \ - VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \ -- *(.pci_fixup_resume_early) \ -+ KEEP(*(.pci_fixup_resume_early)) \ - VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \ -- *(.pci_fixup_suspend) \ -+ KEEP(*(.pci_fixup_suspend)) \ - VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \ - VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \ -- *(.pci_fixup_suspend_late) \ -+ KEEP(*(.pci_fixup_suspend_late)) \ - VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \ - } \ - \ - /* Built-in firmware blobs */ \ - .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start_builtin_fw) = .; \ -- *(.builtin_fw) \ -+ KEEP(*(.builtin_fw)) \ - VMLINUX_SYMBOL(__end_builtin_fw) = .; \ - } \ - \ -@@ -287,49 +288,49 @@ - /* Kernel symbol table: Normal symbols */ \ - __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab) = .; \ -- *(SORT(___ksymtab+*)) \ -+ KEEP(*(SORT(___ksymtab+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only symbols */ \ - __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ -- *(SORT(___ksymtab_gpl+*)) \ -+ KEEP(*(SORT(___ksymtab_gpl+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ - } \ - \ - /* Kernel symbol table: Normal unused symbols */ \ - __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \ -- *(SORT(___ksymtab_unused+*)) \ -+ KEEP(*(SORT(___ksymtab_unused+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only unused symbols */ \ - __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \ -- *(SORT(___ksymtab_unused_gpl+*)) \ -+ KEEP(*(SORT(___ksymtab_unused_gpl+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \ - } \ - \ - /* Kernel symbol table: GPL-future-only symbols */ \ - __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ -- *(SORT(___ksymtab_gpl_future+*)) \ -+ KEEP(*(SORT(___ksymtab_gpl_future+*))) \ - VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \ - } \ - \ - /* Kernel symbol table: Normal symbols */ \ - __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab) = .; \ -- *(SORT(___kcrctab+*)) \ -+ KEEP(*(SORT(___kcrctab+*))) \ - VMLINUX_SYMBOL(__stop___kcrctab) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only symbols */ \ - __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \ -- *(SORT(___kcrctab_gpl+*)) \ -+ KEEP(*(SORT(___kcrctab_gpl+*))) \ - VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ - } \ - \ -@@ -343,14 +344,14 @@ - /* Kernel symbol table: GPL-only unused symbols */ \ - __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \ -- *(SORT(___kcrctab_unused_gpl+*)) \ -+ KEEP(*(SORT(___kcrctab_unused_gpl+*))) \ - VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \ - } \ - \ - /* Kernel symbol table: GPL-future-only symbols */ \ - __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ -- *(SORT(___kcrctab_gpl_future+*)) \ -+ KEEP(*(SORT(___kcrctab_gpl_future+*))) \ - VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \ - } \ - \ -@@ -369,14 +370,14 @@ - /* Built-in module parameters. */ \ - __param : AT(ADDR(__param) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___param) = .; \ -- *(__param) \ -+ KEEP(*(__param)) \ - VMLINUX_SYMBOL(__stop___param) = .; \ - } \ - \ - /* Built-in module versions. */ \ - __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___modver) = .; \ -- *(__modver) \ -+ KEEP(*(__modver)) \ - VMLINUX_SYMBOL(__stop___modver) = .; \ - . = ALIGN((align)); \ - VMLINUX_SYMBOL(__end_rodata) = .; \ -@@ -432,7 +433,7 @@ - #define ENTRY_TEXT \ - ALIGN_FUNCTION(); \ - VMLINUX_SYMBOL(__entry_text_start) = .; \ -- *(.entry.text) \ -+ KEEP(*(.entry.text)) \ - VMLINUX_SYMBOL(__entry_text_end) = .; - - #ifdef CONFIG_FUNCTION_GRAPH_TRACER -@@ -460,7 +461,7 @@ - . = ALIGN(align); \ - __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ex_table) = .; \ -- *(__ex_table) \ -+ KEEP(*(__ex_table)) \ - VMLINUX_SYMBOL(__stop___ex_table) = .; \ - } - -@@ -476,8 +477,8 @@ - #ifdef CONFIG_CONSTRUCTORS - #define KERNEL_CTORS() . = ALIGN(8); \ - VMLINUX_SYMBOL(__ctors_start) = .; \ -- *(.ctors) \ -- *(.init_array) \ -+ KEEP(*(.ctors)) \ -+ KEEP(*(.init_array)) \ - VMLINUX_SYMBOL(__ctors_end) = .; - #else - #define KERNEL_CTORS() -@@ -525,7 +526,7 @@ - #define SBSS(sbss_align) \ - . = ALIGN(sbss_align); \ - .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ -- *(.sbss) \ -+ *(.sbss .sbss.*) \ - *(.scommon) \ - } - -@@ -543,7 +544,7 @@ - BSS_FIRST_SECTIONS \ - *(.bss..page_aligned) \ - *(.dynbss) \ -- *(.bss) \ -+ *(.bss .bss.*) \ - *(COMMON) \ - } - -@@ -592,7 +593,7 @@ - . = ALIGN(8); \ - __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___bug_table) = .; \ -- *(__bug_table) \ -+ KEEP(*(__bug_table)) \ - VMLINUX_SYMBOL(__stop___bug_table) = .; \ - } - #else -@@ -604,7 +605,7 @@ - . = ALIGN(4); \ - .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__tracedata_start) = .; \ -- *(.tracedata) \ -+ KEEP(*(.tracedata)) \ - VMLINUX_SYMBOL(__tracedata_end) = .; \ - } - #else -@@ -621,17 +622,17 @@ - #define INIT_SETUP(initsetup_align) \ - . = ALIGN(initsetup_align); \ - VMLINUX_SYMBOL(__setup_start) = .; \ -- *(.init.setup) \ -+ KEEP(*(.init.setup)) \ - VMLINUX_SYMBOL(__setup_end) = .; - - #define INIT_CALLS_LEVEL(level) \ - VMLINUX_SYMBOL(__initcall##level##_start) = .; \ -- *(.initcall##level##.init) \ -- *(.initcall##level##s.init) \ -+ KEEP(*(.initcall##level##.init)) \ -+ KEEP(*(.initcall##level##s.init)) \ - - #define INIT_CALLS \ - VMLINUX_SYMBOL(__initcall_start) = .; \ -- *(.initcallearly.init) \ -+ KEEP(*(.initcallearly.init)) \ - INIT_CALLS_LEVEL(0) \ - INIT_CALLS_LEVEL(1) \ - INIT_CALLS_LEVEL(2) \ -@@ -645,21 +646,21 @@ - - #define CON_INITCALL \ - VMLINUX_SYMBOL(__con_initcall_start) = .; \ -- *(.con_initcall.init) \ -+ KEEP(*(.con_initcall.init)) \ - VMLINUX_SYMBOL(__con_initcall_end) = .; - - #define SECURITY_INITCALL \ - VMLINUX_SYMBOL(__security_initcall_start) = .; \ -- *(.security_initcall.init) \ -+ KEEP(*(.security_initcall.init)) \ - VMLINUX_SYMBOL(__security_initcall_end) = .; - - #ifdef CONFIG_BLK_DEV_INITRD - #define INIT_RAM_FS \ - . = ALIGN(4); \ - VMLINUX_SYMBOL(__initramfs_start) = .; \ -- *(.init.ramfs) \ -+ KEEP(*(.init.ramfs)) \ - . = ALIGN(8); \ -- *(.init.ramfs.info) -+ KEEP(*(.init.ramfs.info)) - #else - #define INIT_RAM_FS - #endif ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -18,11 +18,16 @@ ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) - LDFLAGS_vmlinux += --be8 - LDFLAGS_MODULE += --be8 - endif -+LDFLAGS_vmlinux += --gc-sections - - OBJCOPYFLAGS :=-O binary -R .comment -S - GZFLAGS :=-9 - #KBUILD_CFLAGS +=-pipe - -+ifndef CONFIG_FUNCTION_TRACER -+KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections -+endif -+ - # Never generate .eh_frame - KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) - ---- a/arch/arm/kernel/vmlinux.lds.S -+++ b/arch/arm/kernel/vmlinux.lds.S -@@ -12,13 +12,13 @@ - #define PROC_INFO \ - . = ALIGN(4); \ - VMLINUX_SYMBOL(__proc_info_begin) = .; \ -- *(.proc.info.init) \ -+ KEEP(*(.proc.info.init)) \ - VMLINUX_SYMBOL(__proc_info_end) = .; - - #define IDMAP_TEXT \ - ALIGN_FUNCTION(); \ - VMLINUX_SYMBOL(__idmap_text_start) = .; \ -- *(.idmap.text) \ -+ KEEP(*(.idmap.text)) \ - VMLINUX_SYMBOL(__idmap_text_end) = .; \ - . = ALIGN(32); \ - VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ -@@ -93,7 +93,7 @@ SECTIONS - .text : { /* Real text segment */ - _stext = .; /* Text and read-only data */ - __exception_text_start = .; -- *(.exception.text) -+ KEEP(*(.exception.text)) - __exception_text_end = .; - IRQENTRY_TEXT - TEXT_TEXT -@@ -118,7 +118,7 @@ SECTIONS - __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { - __start___ex_table = .; - #ifdef CONFIG_MMU -- *(__ex_table) -+ KEEP(*(__ex_table)) - #endif - __stop___ex_table = .; - } -@@ -130,12 +130,12 @@ SECTIONS - . = ALIGN(8); - .ARM.unwind_idx : { - __start_unwind_idx = .; -- *(.ARM.exidx*) -+ KEEP(*(.ARM.exidx*)) - __stop_unwind_idx = .; - } - .ARM.unwind_tab : { - __start_unwind_tab = .; -- *(.ARM.extab*) -+ KEEP(*(.ARM.extab*)) - __stop_unwind_tab = .; - } - #endif -@@ -154,14 +154,14 @@ SECTIONS - */ - __vectors_start = .; - .vectors 0 : AT(__vectors_start) { -- *(.vectors) -+ KEEP(*(.vectors)) - } - . = __vectors_start + SIZEOF(.vectors); - __vectors_end = .; - - __stubs_start = .; - .stubs 0x1000 : AT(__stubs_start) { -- *(.stubs) -+ KEEP(*(.stubs)) - } - . = __stubs_start + SIZEOF(.stubs); - __stubs_end = .; -@@ -175,24 +175,24 @@ SECTIONS - } - .init.arch.info : { - __arch_info_begin = .; -- *(.arch.info.init) -+ KEEP(*(.arch.info.init)) - __arch_info_end = .; - } - .init.tagtable : { - __tagtable_begin = .; -- *(.taglist.init) -+ KEEP(*(.taglist.init)) - __tagtable_end = .; - } - #ifdef CONFIG_SMP_ON_UP - .init.smpalt : { - __smpalt_begin = .; -- *(.alt.smp.init) -+ KEEP(*(.alt.smp.init)) - __smpalt_end = .; - } - #endif - .init.pv_table : { - __pv_table_begin = .; -- *(.pv_table) -+ KEEP(*(.pv_table)) - __pv_table_end = .; - } - .init.data : { ---- a/arch/arm/boot/compressed/Makefile -+++ b/arch/arm/boot/compressed/Makefile -@@ -122,6 +122,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) - endif -+KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL)) - - ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) - asflags-y := -DZIMAGE diff --git a/target/linux/generic/pending-3.18/221-module_exports.patch b/target/linux/generic/pending-3.18/221-module_exports.patch deleted file mode 100644 index f2cad7a02..000000000 --- a/target/linux/generic/pending-3.18/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. */ -@@ -288,14 +298,14 @@ - /* Kernel symbol table: Normal symbols */ \ - __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab) = .; \ -- KEEP(*(SORT(___ksymtab+*))) \ -+ SYMTAB_KEEP \ - VMLINUX_SYMBOL(__stop___ksymtab) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only symbols */ \ - __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ -- KEEP(*(SORT(___ksymtab_gpl+*))) \ -+ SYMTAB_KEEP_GPL \ - VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ - } \ - \ -@@ -357,7 +367,7 @@ - \ - /* Kernel symbol table: strings */ \ - __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ -- *(__ksymtab_strings) \ -+ *(__ksymtab_strings+*) \ - } \ - \ - /* __*init sections */ \ -@@ -679,6 +689,8 @@ - EXIT_TEXT \ - EXIT_DATA \ - EXIT_CALL \ -+ SYMTAB_DISCARD \ -+ SYMTAB_DISCARD_GPL \ - *(.discard) \ - *(.discard.*) \ - } ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -298,7 +298,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( - # Linker scripts preprocessor (.lds.S -> .lds) - # --------------------------------------------------------------------------- - quiet_cmd_cpp_lds_S = LDS $@ -- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ -+ cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -C -U$(ARCH) \ - -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< - - $(obj)/%.lds: $(src)/%.lds.S FORCE ---- a/include/linux/export.h -+++ b/include/linux/export.h -@@ -52,12 +52,19 @@ extern struct module __this_module; - #define __CRC_SYMBOL(sym, sec) - #endif - -+#ifdef MODULE -+#define __EXPORT_SUFFIX(sym) -+#else -+#define __EXPORT_SUFFIX(sym) "+" #sym -+#endif -+ - /* For every exported symbol, place a struct in the __ksymtab section */ - #define __EXPORT_SYMBOL(sym, sec) \ - extern typeof(sym) sym; \ - __CRC_SYMBOL(sym, sec) \ - static const char __kstrtab_##sym[] \ -- __attribute__((section("__ksymtab_strings"), aligned(1))) \ -+ __attribute__((section("__ksymtab_strings" \ -+ __EXPORT_SUFFIX(sym)), aligned(1))) \ - = VMLINUX_SYMBOL_STR(sym); \ - extern const struct kernel_symbol __ksymtab_##sym; \ - __visible const struct kernel_symbol __ksymtab_##sym \ diff --git a/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch b/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch deleted file mode 100644 index e59fdcd2e..000000000 --- a/target/linux/generic/pending-3.18/230-openwrt_lzma_options.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -325,7 +325,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) - - quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(filter-out FORCE,$^) | \ -- lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ -+ lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ - (rm -f $@ ; false) - - quiet_cmd_lzo = LZO $@ ---- a/scripts/gen_initramfs_list.sh -+++ b/scripts/gen_initramfs_list.sh -@@ -226,7 +226,7 @@ cpio_list= - output="/dev/stdout" - output_file="" - is_cpio_compressed= --compr="gzip -n -9 -f" -+compr="gzip -n -9 -f -" - - arg="$1" - case "$arg" in -@@ -242,13 +242,13 @@ case "$arg" in - output=${cpio_list} - echo "$output_file" | grep -q "\.gz$" \ - && [ -x "`which gzip 2> /dev/null`" ] \ -- && compr="gzip -n -9 -f" -+ && compr="gzip -n -9 -f -" - echo "$output_file" | grep -q "\.bz2$" \ - && [ -x "`which bzip2 2> /dev/null`" ] \ -- && compr="bzip2 -9 -f" -+ && compr="bzip2 -9 -f -" - echo "$output_file" | grep -q "\.lzma$" \ - && [ -x "`which lzma 2> /dev/null`" ] \ -- && compr="lzma -9 -f" -+ && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so" - echo "$output_file" | grep -q "\.xz$" \ - && [ -x "`which xz 2> /dev/null`" ] \ - && compr="xz --check=crc32 --lzma2=dict=1MiB" -@@ -315,7 +315,7 @@ if [ ! -z ${output_file} ]; then - if [ "${is_cpio_compressed}" = "compressed" ]; then - cat ${cpio_tfile} > ${output_file} - else -- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ -+ (cat ${cpio_tfile} | ${compr} > ${output_file}) \ - || (rm -f ${output_file} ; false) - fi - [ -z ${cpio_file} ] && rm ${cpio_tfile} ---- a/lib/decompress.c -+++ b/lib/decompress.c -@@ -48,6 +48,7 @@ static const struct compress_format comp - { {037, 0236}, "gzip", gunzip }, - { {0x42, 0x5a}, "bzip2", bunzip2 }, - { {0x5d, 0x00}, "lzma", unlzma }, -+ { {0x6d, 0x00}, "lzma-openwrt", unlzma }, - { {0xfd, 0x37}, "xz", unxz }, - { {0x89, 0x4c}, "lzo", unlzo }, - { {0x02, 0x21}, "lz4", unlz4 }, diff --git a/target/linux/generic/pending-3.18/250-netfilter_depends.patch b/target/linux/generic/pending-3.18/250-netfilter_depends.patch deleted file mode 100644 index 47be4a019..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -907,7 +906,6 @@ config NETFILTER_XT_TARGET_SECMARK - - config NETFILTER_XT_TARGET_TCPMSS - tristate '"TCPMSS" target support' -- depends on (IPV6 || IPV6=n) - default m if NETFILTER_ADVANCED=n - ---help--- - This option adds a `TCPMSS' target, which allows you to alter the diff --git a/target/linux/generic/pending-3.18/251-sound_kconfig.patch b/target/linux/generic/pending-3.18/251-sound_kconfig.patch deleted file mode 100644 index c2ebacecd..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/252-mv_cesa_depends.patch b/target/linux/generic/pending-3.18/252-mv_cesa_depends.patch deleted file mode 100644 index fee28db12..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/253-ssb_b43_default_on.patch b/target/linux/generic/pending-3.18/253-ssb_b43_default_on.patch deleted file mode 100644 index 29d2a41a3..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/254-textsearch_kconfig_hacks.patch b/target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch deleted file mode 100644 index 3c3b1e1b5..000000000 --- a/target/linux/generic/pending-3.18/254-textsearch_kconfig_hacks.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -320,16 +320,16 @@ config BCH_CONST_T - # Textsearch support is select'ed if needed - # - config TEXTSEARCH -- boolean -+ boolean "Textsearch support" - - config TEXTSEARCH_KMP -- tristate -+ tristate "Textsearch KMP" - - config TEXTSEARCH_BM -- tristate -+ tristate "Textsearch BM" - - config TEXTSEARCH_FSM -- tristate -+ tristate "Textsearch FSM" - - config BTREE - boolean diff --git a/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch b/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch deleted file mode 100644 index d8752359c..000000000 --- a/target/linux/generic/pending-3.18/255-lib80211_kconfig_hacks.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/wireless/Kconfig -+++ b/net/wireless/Kconfig -@@ -183,7 +183,7 @@ config CFG80211_WEXT - extensions with cfg80211-based drivers. - - config LIB80211 -- tristate -+ tristate "LIB80211" - default n - help - This options enables a library of common routines used -@@ -192,13 +192,16 @@ config LIB80211 - Drivers should select this themselves if needed. - - config LIB80211_CRYPT_WEP -- tristate -+ tristate "LIB80211_CRYPT_WEP" -+ select LIB80211 - - config LIB80211_CRYPT_CCMP -- tristate -+ tristate "LIB80211_CRYPT_CCMP" -+ select LIB80211 - - config LIB80211_CRYPT_TKIP -- tristate -+ tristate "LIB80211_CRYPT_TKIP" -+ select LIB80211 - - config LIB80211_DEBUG - bool "lib80211 debugging messages" diff --git a/target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch b/target/linux/generic/pending-3.18/256-crypto_add_kconfig_prompts.patch deleted file mode 100644 index f9f6c0ea7..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/257-wireless_ext_kconfig_hack.patch b/target/linux/generic/pending-3.18/257-wireless_ext_kconfig_hack.patch deleted file mode 100644 index daac5898a..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/258-netfilter_netlink_kconfig_hack.patch b/target/linux/generic/pending-3.18/258-netfilter_netlink_kconfig_hack.patch deleted file mode 100644 index 9d827c253..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/259-regmap_dynamic.patch b/target/linux/generic/pending-3.18/259-regmap_dynamic.patch deleted file mode 100644 index 5e422ebd4..000000000 --- a/target/linux/generic/pending-3.18/259-regmap_dynamic.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -3,9 +3,8 @@ - # subsystems should select the appropriate symbols. - - config REGMAP -- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ) - select IRQ_DOMAIN if REGMAP_IRQ -- bool -+ tristate "Regmap" - - config REGCACHE_COMPRESSED - select LZO_COMPRESS -@@ -13,19 +12,25 @@ config REGCACHE_COMPRESSED - bool - - config REGMAP_I2C -- tristate -+ tristate "Regmap I2C" -+ select REGMAP - depends on I2C - - config REGMAP_SPI -- tristate -+ tristate "Regmap SPI" -+ select REGMAP -+ depends on SPI_MASTER - depends on SPI - - config REGMAP_SPMI -+ select REGMAP - tristate - depends on SPMI - - config REGMAP_MMIO -- tristate -+ tristate "Regmap MMIO" -+ select REGMAP - - config REGMAP_IRQ -+ select REGMAP - bool ---- a/include/linux/regmap.h -+++ b/include/linux/regmap.h -@@ -49,7 +49,7 @@ struct reg_default { - unsigned int def; - }; - --#ifdef CONFIG_REGMAP -+#if IS_ENABLED(CONFIG_REGMAP) - - enum regmap_endian { - /* Unspecified -> 0 -> Backwards compatible default */ ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -1,7 +1,11 @@ --obj-$(CONFIG_REGMAP) += regmap.o regcache.o --obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o --obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o --obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o -+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o -+ifdef CONFIG_DEBUG_FS -+regmap-core-objs += regmap-debugfs.o -+endif -+ifdef CONFIG_REGCACHE_COMPRESSED -+regmap-core-objs += regcache-lzo.o -+endif -+obj-$(CONFIG_REGMAP) += regmap-core.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o - obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o - obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -2630,3 +2631,5 @@ static int __init regmap_initcall(void) - return 0; - } - postcore_initcall(regmap_initcall); -+ -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch b/target/linux/generic/pending-3.18/260-crypto_test_dependencies.patch deleted file mode 100644 index 8a96fd9da..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch b/target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch deleted file mode 100644 index 67895995b..000000000 --- a/target/linux/generic/pending-3.18/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch +++ /dev/null @@ -1,102 +0,0 @@ -From c6bdd0d302119819de72439972d0462c26ef9eda Mon Sep 17 00:00:00 2001 -From: Felix Janda -Date: Sun, 12 Nov 2017 13:30:17 -0500 -Subject: uapi libc compat: add fallback for unsupported libcs - -libc-compat.h aims to prevent symbol collisions between uapi and libc -headers for each supported libc. This requires continuous coordination -between them. - -The goal of this commit is to improve the situation for libcs (such as -musl) which are not yet supported and/or do not wish to be explicitly -supported, while not affecting supported libcs. More precisely, with -this commit, unsupported libcs can request the suppression of any -specific uapi definition by defining the correspondings _UAPI_DEF_* -macro as 0. This can fix symbol collisions for them, as long as the -libc headers are included before the uapi headers. Inclusion in the -other order is outside the scope of this commit. - -All infrastructure in order to enable this fallback for unsupported -libcs is already in place, except that libc-compat.h unconditionally -defines all _UAPI_DEF_* macros to 1 for all unsupported libcs so that -any previous definitions are ignored. In order to fix this, this commit -merely makes these definitions conditional. - -This commit together with the musl libc commit - -http://git.musl-libc.org/cgit/musl/commit/?id=04983f2272382af92eb8f8838964ff944fbb8258 - -fixes for example the following compiler errors when is -included after musl's : - -./linux/in6.h:32:8: error: redefinition of 'struct in6_addr' -./linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6' -./linux/in6.h:59:8: error: redefinition of 'struct ipv6_mreq' - -The comments referencing glibc are still correct, but this file is not -only used for glibc any more. - -Signed-off-by: Felix Janda -Reviewed-by: Hauke Mehrtens ---- - include/uapi/linux/libc-compat.h | 55 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 54 insertions(+), 1 deletion(-) - ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -110,27 +110,54 @@ - - /* If we did not see any headers from any supported C libraries, - * or we are being included in the kernel, then define everything -- * that we need. */ -+ * that we need. Check for previous __UAPI_* definitions to give -+ * unsupported C libraries a way to opt out of any kernel definition. */ - #else /* !defined(__GLIBC__) */ - - /* Definitions for in.h */ -+#ifndef __UAPI_DEF_IN_ADDR - #define __UAPI_DEF_IN_ADDR 1 -+#endif -+#ifndef __UAPI_DEF_IN_IPPROTO - #define __UAPI_DEF_IN_IPPROTO 1 -+#endif -+#ifndef __UAPI_DEF_IN_PKTINFO - #define __UAPI_DEF_IN_PKTINFO 1 -+#endif -+#ifndef __UAPI_DEF_IP_MREQ - #define __UAPI_DEF_IP_MREQ 1 -+#endif -+#ifndef __UAPI_DEF_SOCKADDR_IN - #define __UAPI_DEF_SOCKADDR_IN 1 -+#endif -+#ifndef __UAPI_DEF_IN_CLASS - #define __UAPI_DEF_IN_CLASS 1 -+#endif - - /* Definitions for in6.h */ -+#ifndef __UAPI_DEF_IN6_ADDR - #define __UAPI_DEF_IN6_ADDR 1 -+#endif -+#ifndef __UAPI_DEF_IN6_ADDR_ALT - #define __UAPI_DEF_IN6_ADDR_ALT 1 -+#endif -+#ifndef __UAPI_DEF_SOCKADDR_IN6 - #define __UAPI_DEF_SOCKADDR_IN6 1 -+#endif -+#ifndef __UAPI_DEF_IPV6_MREQ - #define __UAPI_DEF_IPV6_MREQ 1 -+#endif -+#ifndef __UAPI_DEF_IPPROTO_V6 - #define __UAPI_DEF_IPPROTO_V6 1 -+#endif -+#ifndef __UAPI_DEF_IPV6_OPTIONS - #define __UAPI_DEF_IPV6_OPTIONS 1 -+#endif - - /* Definitions for xattr.h */ -+#ifndef __UAPI_DEF_XATTR - #define __UAPI_DEF_XATTR 1 -+#endif - - #endif /* __GLIBC__ */ - diff --git a/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch b/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch deleted file mode 100644 index 10d698f96..000000000 --- a/target/linux/generic/pending-3.18/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 649affd04813c43e0a72886517fcfccd63230981 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Mon, 29 Jun 2015 16:53:03 +0200 -Subject: uapi/if_ether.h: prevent redefinition of struct ethhdr - -Musl provides its own ethhdr struct definition. Add a guard to prevent -its definition of the appropriate musl header has already been included. - -glibc does not implement this header, but when glibc will implement this -they can just define __UAPI_DEF_ETHHDR 0 to make it work with the -kernel. - -Signed-off-by: Hauke Mehrtens ---- - include/uapi/linux/if_ether.h | 3 +++ - include/uapi/linux/libc-compat.h | 6 ++++++ - 2 files changed, 9 insertions(+) - ---- a/include/uapi/linux/if_ether.h -+++ b/include/uapi/linux/if_ether.h -@@ -22,6 +22,7 @@ - #define _UAPI_LINUX_IF_ETHER_H - - #include -+#include - - /* - * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble -@@ -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 -@@ -161,4 +161,10 @@ - - #endif /* __GLIBC__ */ - -+/* Definitions for if_ether.h */ -+/* allow libcs like musl to deactivate this, glibc does not implement this. */ -+#ifndef __UAPI_DEF_ETHHDR -+#define __UAPI_DEF_ETHHDR 1 -+#endif -+ - #endif /* _UAPI_LIBC_COMPAT_H */ diff --git a/target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-3.18/300-mips_expose_boot_raw.patch deleted file mode 100644 index 69d61f20a..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -892,9 +892,6 @@ config FW_ARC - config ARCH_MAY_HAVE_PC_FDC - bool - --config BOOT_RAW -- bool -- - config CEVT_BCM1480 - bool - -@@ -2503,6 +2500,18 @@ config USE_OF - config BUILTIN_DTB - bool - -+config BOOT_RAW -+ bool "Enable the kernel to be executed from the load address" -+ default n -+ help -+ Allow the kernel to be executed from the load address for -+ bootloaders which cannot read the ELF format. This places -+ a jump to start_kernel at the load address. -+ -+ If unsure, say N. -+ -+ -+ - endmenu - - config LOCKDEP_SUPPORT diff --git a/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch b/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch deleted file mode 100644 index c87d4480c..000000000 --- a/target/linux/generic/pending-3.18/301-mips_image_cmdline_hack.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -988,6 +988,10 @@ config SYNC_R4K - config MIPS_MACHINE - def_bool n - -+config IMAGE_CMDLINE_HACK -+ bool "OpenWrt specific image command line hack" -+ default n -+ - config NO_IOPORT_MAP - def_bool n - ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -80,6 +80,12 @@ FEXPORT(__kernel_entry) - j kernel_entry - #endif - -+#ifdef CONFIG_IMAGE_CMDLINE_HACK -+ .ascii "CMDLINE:" -+EXPORT(__image_cmdline) -+ .fill 0x400 -+#endif /* CONFIG_IMAGE_CMDLINE_HACK */ -+ - __REF - - NESTED(kernel_entry, 16, sp) # kernel entry point diff --git a/target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch b/target/linux/generic/pending-3.18/302-mips_no_branch_likely.patch deleted file mode 100644 index 44c6b04fc..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/304-mips_disable_fpu.patch b/target/linux/generic/pending-3.18/304-mips_disable_fpu.patch deleted file mode 100644 index 37ec9934f..000000000 --- a/target/linux/generic/pending-3.18/304-mips_disable_fpu.patch +++ /dev/null @@ -1,105 +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 -@@ -2495,6 +2495,20 @@ config MIPS_O32_FP64_SUPPORT - - If unsure, say N. - -+config MIPS_FPU_EMULATOR -+ bool "MIPS FPU Emulator" -+ default y -+ help -+ This option lets you disable the built-in MIPS FPU (Coprocessor 1) -+ emulator, which handles floating-point instructions on processors -+ without a hardware FPU. It is generally a good idea to keep the -+ emulator built-in, unless you are perfectly sure you have a -+ complete soft-float environment. With the emulator disabled, all -+ users of float operations will be killed with an illegal instr- -+ uction exception. -+ -+ Say Y, please. -+ - config USE_OF - bool - select OF ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -275,7 +275,7 @@ OBJCOPYFLAGS += --remove-section=.regin - head-y := arch/mips/kernel/head.o - - libs-y += arch/mips/lib/ --libs-y += arch/mips/math-emu/ -+libs-$(CONFIG_MIPS_FPU_EMULATOR) += arch/mips/math-emu/ - - # See arch/mips/Kbuild for content of core part of the kernel - core-y += arch/mips/ ---- a/arch/mips/include/asm/fpu.h -+++ b/arch/mips/include/asm/fpu.h -@@ -169,8 +169,10 @@ static inline int init_fpu(void) - ret = __own_fpu(); - if (!ret) - _init_fpu(); -- } else -+ } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR)) - fpu_emulator_init_fpu(); -+ else -+ ret = SIGILL; - - return ret; - } ---- a/arch/mips/include/asm/fpu_emulator.h -+++ b/arch/mips/include/asm/fpu_emulator.h -@@ -30,6 +30,7 @@ - #include - #include - -+#ifdef CONFIG_MIPS_FPU_EMULATOR - #ifdef CONFIG_DEBUG_FS - - struct mips_fpu_emulator_stats { -@@ -65,6 +66,20 @@ extern int do_dsemulret(struct pt_regs * - extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, - struct mips_fpu_struct *ctx, int has_fpu, - void *__user *fault_addr); -+#else /* no CONFIG_MIPS_FPU_EMULATOR */ -+static inline int do_dsemulret(struct pt_regs *xcp) -+{ -+ return 0; /* 0 means error, should never get here anyway */ -+} -+ -+static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp, -+ struct mips_fpu_struct *ctx, int has_fpu, -+ void *__user *fault_addr) -+{ -+ return SIGILL; /* we don't speak MIPS FPU */ -+} -+#endif /* CONFIG_MIPS_FPU_EMULATOR */ -+ - int process_fpemu_return(int sig, void __user *fault_addr); - int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, - unsigned long *contpc); diff --git a/target/linux/generic/pending-3.18/305-mips_module_reloc.patch b/target/linux/generic/pending-3.18/305-mips_module_reloc.patch deleted file mode 100644 index fae7e70f0..000000000 --- a/target/linux/generic/pending-3.18/305-mips_module_reloc.patch +++ /dev/null @@ -1,356 +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,222 @@ struct mips_hi16 { - static LIST_HEAD(dbe_list); - static DEFINE_SPINLOCK(dbe_lock); - --#ifdef MODULE_START -+/* -+ * Get the potential max trampolines size required of the init and -+ * non-init sections. Only used if we cannot find enough contiguous -+ * physically mapped memory to put the module into. -+ */ -+static unsigned int -+get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, -+ const char *secstrings, unsigned int symindex, bool is_init) -+{ -+ unsigned long ret = 0; -+ unsigned int i, j; -+ Elf_Sym *syms; -+ -+ /* Everything marked ALLOC (this includes the exported symbols) */ -+ for (i = 1; i < hdr->e_shnum; ++i) { -+ unsigned int info = sechdrs[i].sh_info; -+ -+ if (sechdrs[i].sh_type != SHT_REL -+ && sechdrs[i].sh_type != SHT_RELA) -+ continue; -+ -+ /* Not a valid relocation section? */ -+ if (info >= hdr->e_shnum) -+ continue; -+ -+ /* Don't bother with non-allocated sections */ -+ if (!(sechdrs[info].sh_flags & SHF_ALLOC)) -+ continue; -+ -+ /* If it's called *.init*, and we're not init, we're -+ not interested */ -+ if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) -+ != is_init) -+ continue; -+ -+ syms = (Elf_Sym *) sechdrs[symindex].sh_addr; -+ if (sechdrs[i].sh_type == SHT_REL) { -+ Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; -+ unsigned int size = sechdrs[i].sh_size / sizeof(*rel); -+ -+ for (j = 0; j < size; ++j) { -+ Elf_Sym *sym; -+ -+ if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) -+ continue; -+ -+ sym = syms + ELF_MIPS_R_SYM(rel[j]); -+ if (!is_init && sym->st_shndx != SHN_UNDEF) -+ continue; -+ -+ ret += 4 * sizeof(int); -+ } -+ } else { -+ Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; -+ unsigned int size = sechdrs[i].sh_size / sizeof(*rela); -+ -+ for (j = 0; j < size; ++j) { -+ Elf_Sym *sym; -+ -+ if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) -+ continue; -+ -+ sym = syms + ELF_MIPS_R_SYM(rela[j]); -+ if (!is_init && sym->st_shndx != SHN_UNDEF) -+ continue; -+ -+ ret += 4 * sizeof(int); -+ } -+ } -+ } -+ -+ return ret; -+} -+ -+#ifndef MODULE_START -+static void *alloc_phys(unsigned long size) -+{ -+ unsigned order; -+ struct page *page; -+ struct page *p; -+ -+ size = PAGE_ALIGN(size); -+ order = get_order(size); -+ -+ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | -+ __GFP_THISNODE, order); -+ if (!page) -+ return NULL; -+ -+ split_page(page, order); -+ -+ for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) -+ __free_page(p); -+ -+ return page_address(page); -+} -+#endif -+ -+static void free_phys(void *ptr, unsigned long size) -+{ -+ struct page *page; -+ struct page *end; -+ -+ page = virt_to_page(ptr); -+ end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); -+ -+ for (; page < end; ++page) -+ __free_page(page); -+} -+ -+ - void *module_alloc(unsigned long size) - { -+#ifdef MODULE_START - return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END, - GFP_KERNEL, PAGE_KERNEL, NUMA_NO_NODE, - __builtin_return_address(0)); -+#else -+ void *ptr; -+ -+ if (size == 0) -+ return NULL; -+ -+ ptr = alloc_phys(size); -+ -+ /* If we failed to allocate physically contiguous memory, -+ * fall back to regular vmalloc. The module loader code will -+ * create jump tables to handle long jumps */ -+ if (!ptr) -+ return vmalloc(size); -+ -+ return ptr; -+#endif - } -+ -+static inline bool is_phys_addr(void *ptr) -+{ -+#ifdef CONFIG_64BIT -+ return (KSEGX((unsigned long)ptr) == CKSEG0); -+#else -+ return (KSEGX(ptr) == KSEG0); - #endif -+} -+ -+/* Free memory returned from module_alloc */ -+void module_free(struct module *mod, void *module_region) -+{ -+ if (is_phys_addr(module_region)) { -+ if (mod->module_init == module_region) -+ free_phys(module_region, mod->init_size); -+ else if (mod->module_core == module_region) -+ free_phys(module_region, mod->core_size); -+ else -+ BUG(); -+ } else { -+ vfree(module_region); -+ } -+} -+ -+static void *__module_alloc(int size, bool phys) -+{ -+ void *ptr; -+ -+ if (phys) -+ ptr = kmalloc(size, GFP_KERNEL); -+ else -+ ptr = vmalloc(size); -+ return ptr; -+} -+ -+static void __module_free(void *ptr) -+{ -+ if (is_phys_addr(ptr)) -+ kfree(ptr); -+ else -+ vfree(ptr); -+} -+ -+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, -+ char *secstrings, struct module *mod) -+{ -+ unsigned int symindex = 0; -+ unsigned int core_size, init_size; -+ int i; -+ -+ mod->arch.phys_plt_offset = 0; -+ mod->arch.virt_plt_offset = 0; -+ mod->arch.phys_plt_tbl = NULL; -+ mod->arch.virt_plt_tbl = NULL; -+ -+ if (IS_ENABLED(CONFIG_64BIT)) -+ return 0; -+ -+ for (i = 1; i < hdr->e_shnum; i++) -+ if (sechdrs[i].sh_type == SHT_SYMTAB) -+ symindex = i; -+ -+ core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false); -+ init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true); -+ -+ if ((core_size + init_size) == 0) -+ return 0; -+ -+ mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1); -+ if (!mod->arch.phys_plt_tbl) -+ return -ENOMEM; -+ -+ mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0); -+ if (!mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ return -ENOMEM; -+ } -+ -+ return 0; -+} - - int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) - { -@@ -64,8 +272,39 @@ static int apply_r_mips_32_rel(struct mo - return 0; - } - -+static Elf_Addr add_plt_entry_to(unsigned *plt_offset, -+ void *start, Elf_Addr v) -+{ -+ unsigned *tramp = start + *plt_offset; -+ *plt_offset += 4 * sizeof(int); -+ -+ /* adjust carry for addiu */ -+ if (v & 0x00008000) -+ v += 0x10000; -+ -+ tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */ -+ tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */ -+ tramp[2] = 0x03200008; /* jr t9 */ -+ tramp[3] = 0x00000000; /* nop */ -+ -+ return (Elf_Addr) tramp; -+} -+ -+static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) -+{ -+ if (is_phys_addr(location)) -+ return add_plt_entry_to(&me->arch.phys_plt_offset, -+ me->arch.phys_plt_tbl, v); -+ else -+ return add_plt_entry_to(&me->arch.virt_plt_offset, -+ me->arch.virt_plt_tbl, v); -+ -+} -+ - static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) - { -+ u32 ofs = *location & 0x03ffffff; -+ - if (v % 4) { - pr_err("module %s: dangerous R_MIPS_26 REL relocation\n", - me->name); -@@ -73,14 +312,17 @@ static int apply_r_mips_26_rel(struct mo - } - - if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { -- printk(KERN_ERR -- "module %s: relocation overflow\n", -- me->name); -- return -ENOEXEC; -+ v = add_plt_entry(me, location, v + (ofs << 2)); -+ if (!v) { -+ printk(KERN_ERR -+ "module %s: relocation overflow\n", me->name); -+ return -ENOEXEC; -+ } -+ ofs = 0; - } - - *location = (*location & ~0x03ffffff) | -- ((*location + (v >> 2)) & 0x03ffffff); -+ ((ofs + (v >> 2)) & 0x03ffffff); - - return 0; - } -@@ -287,9 +529,36 @@ int module_finalize(const Elf_Ehdr *hdr, - list_add(&me->arch.dbe_list, &dbe_list); - spin_unlock_irq(&dbe_lock); - } -+ -+ /* Get rid of the fixup trampoline if we're running the module -+ * from physically mapped address space */ -+ if (me->arch.phys_plt_offset == 0) { -+ __module_free(me->arch.phys_plt_tbl); -+ me->arch.phys_plt_tbl = NULL; -+ } -+ if (me->arch.virt_plt_offset == 0) { -+ __module_free(me->arch.virt_plt_tbl); -+ me->arch.virt_plt_tbl = NULL; -+ } -+ - return 0; - } - -+void module_arch_freeing_init(struct module *mod) -+{ -+ if (mod->state == MODULE_STATE_LIVE) -+ return; -+ -+ if (mod->arch.phys_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ } -+ if (mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.virt_plt_tbl); -+ mod->arch.virt_plt_tbl = NULL; -+ } -+} -+ - void module_arch_cleanup(struct module *mod) - { - spin_lock_irq(&dbe_lock); diff --git a/target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch b/target/linux/generic/pending-3.18/306-mips_mem_functions_performance.patch deleted file mode 100644 index 981867742..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/307-mips_highmem_offset.patch b/target/linux/generic/pending-3.18/307-mips_highmem_offset.patch deleted file mode 100644 index 5a7dc9cee..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/310-arm_module_unresolved_weak_sym.patch b/target/linux/generic/pending-3.18/310-arm_module_unresolved_weak_sym.patch deleted file mode 100644 index 9210c1d2d..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/320-ppc4xx_optimization.patch b/target/linux/generic/pending-3.18/320-ppc4xx_optimization.patch deleted file mode 100644 index 8673de4df..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -45,10 +45,10 @@ BOOTCFLAGS += -I$(obj) -I$(srctree)/$(ob - DTC_FLAGS ?= -p 1024 - - $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405 --$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405 -+$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 - $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405 --$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405 --$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405 -+$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 -+$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 - $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 diff --git a/target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/pending-3.18/321-powerpc_crtsavres_prereq.patch deleted file mode 100644 index ab6ea7beb..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/pending-3.18/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch deleted file mode 100644 index a69d197e6..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch deleted file mode 100644 index 0a6e134ed..000000000 --- a/target/linux/generic/pending-3.18/400-mtd-add-rootfs-split-support.patch +++ /dev/null @@ -1,171 +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 -@@ -30,9 +30,11 @@ - #include - #include - #include -+#include - #include - - #include "mtdcore.h" -+#include "mtdsplit/mtdsplit.h" - - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); -@@ -46,13 +48,14 @@ struct mtd_part { - struct list_head list; - }; - -+static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); -+ - /* - * Given a pointer to the MTD object in the mtd_part structure, we can retrieve - * the pointer to that structure with this macro. - */ - #define PART(x) ((struct mtd_part *)(x)) - -- - /* - * MTD methods which simply translate the effective address and pass through - * to the _real_ device. -@@ -548,8 +551,10 @@ out_register: - return slave; - } - --int mtd_add_partition(struct mtd_info *master, const char *name, -- long long offset, long long length) -+ -+static int -+__mtd_add_partition(struct mtd_info *master, const char *name, -+ long long offset, long long length, bool dup_check) - { - struct mtd_partition part; - struct mtd_part *p, *new; -@@ -581,21 +586,24 @@ int mtd_add_partition(struct mtd_info *m - end = offset + length; - - mutex_lock(&mtd_partitions_mutex); -- list_for_each_entry(p, &mtd_partitions, list) -- if (p->master == master) { -- if ((start >= p->offset) && -- (start < (p->offset + p->mtd.size))) -- goto err_inv; -- -- if ((end >= p->offset) && -- (end < (p->offset + p->mtd.size))) -- goto err_inv; -- } -+ if (dup_check) { -+ list_for_each_entry(p, &mtd_partitions, list) -+ if (p->master == master) { -+ if ((start >= p->offset) && -+ (start < (p->offset + p->mtd.size))) -+ goto err_inv; -+ -+ if ((end >= p->offset) && -+ (end < (p->offset + p->mtd.size))) -+ goto err_inv; -+ } -+ } - - list_add(&new->list, &mtd_partitions); - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&new->mtd); -+ mtd_partition_split(master, new); - - return ret; - err_inv: -@@ -605,6 +613,12 @@ err_inv: - } - EXPORT_SYMBOL_GPL(mtd_add_partition); - -+int mtd_add_partition(struct mtd_info *master, const char *name, -+ long long offset, long long length) -+{ -+ return __mtd_add_partition(master, name, offset, length, true); -+} -+ - int mtd_del_partition(struct mtd_info *master, int partno) - { - struct mtd_part *slave, *next; -@@ -628,6 +642,35 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME -+#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME -+#else -+#define SPLIT_FIRMWARE_NAME "unused" -+#endif -+ -+static void split_firmware(struct mtd_info *master, struct mtd_part *part) -+{ -+} -+ -+void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -+ int offset, int size) -+{ -+} -+ -+static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) -+{ -+ static int rootfs_found = 0; -+ -+ if (rootfs_found) -+ return; -+ -+ if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && -+ config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) -+ split_firmware(master, part); -+ -+ arch_split_mtd_part(master, part->mtd.name, part->offset, -+ part->mtd.size); -+} - /* - * This function, given a master MTD object and a partition table, creates - * and registers slave MTD objects which are bound to the master according to -@@ -657,6 +700,7 @@ int add_mtd_partitions(struct mtd_info * - mutex_unlock(&mtd_partitions_mutex); - - add_mtd_device(&slave->mtd); -+ mtd_partition_split(master, slave); - - cur_offset = slave->offset + slave->mtd.size; - } ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -84,5 +84,7 @@ int mtd_add_partition(struct mtd_info *m - long long offset, long long length); - int mtd_del_partition(struct mtd_info *master, int partno); - uint64_t mtd_get_device_size(const struct mtd_info *mtd); -+extern void __weak arch_split_mtd_part(struct mtd_info *master, -+ const char *name, int offset, int size); - - #endif diff --git a/target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-3.18/401-mtd-add-support-for-different-partition-parser-types.patch deleted file mode 100644 index 684234161..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -730,6 +730,30 @@ static struct mtd_part_parser *get_parti - - #define put_partition_parser(p) do { module_put((p)->owner); } while (0) - -+static struct mtd_part_parser * -+get_partition_parser_by_type(enum mtd_parser_type type, -+ struct mtd_part_parser *start) -+{ -+ struct mtd_part_parser *p, *ret = NULL; -+ -+ spin_lock(&part_parser_lock); -+ -+ p = list_prepare_entry(start, &part_parsers, list); -+ if (start) -+ put_partition_parser(start); -+ -+ list_for_each_entry_continue(p, &part_parsers, list) { -+ if (p->type == type && try_module_get(p->owner)) { -+ ret = p; -+ break; -+ } -+ } -+ -+ spin_unlock(&part_parser_lock); -+ -+ return ret; -+} -+ - void register_mtd_parser(struct mtd_part_parser *p) - { - spin_lock(&part_parser_lock); -@@ -845,6 +869,38 @@ int parse_mtd_partitions(struct mtd_info - return ret; - } - -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct mtd_part_parser *prev = NULL; -+ int ret = 0; -+ -+ while (1) { -+ struct mtd_part_parser *parser; -+ -+ parser = get_partition_parser_by_type(type, prev); -+ if (!parser) -+ break; -+ -+ ret = (*parser->parse_fn)(master, pparts, data); -+ -+ if (ret > 0) { -+ put_partition_parser(parser); -+ printk(KERN_NOTICE -+ "%d %s partitions found on MTD device %s\n", -+ ret, parser->name, master->name); -+ break; -+ } -+ -+ prev = parser; -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); -+ - int mtd_is_partition(const struct mtd_info *mtd) - { - struct mtd_part *part; ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -68,12 +68,17 @@ struct mtd_part_parser_data { - * Functions dealing with the various ways of partitioning the space - */ - -+enum mtd_parser_type { -+ MTD_PARSER_TYPE_DEVICE = 0, -+}; -+ - struct mtd_part_parser { - struct list_head list; - struct module *owner; - const char *name; - int (*parse_fn)(struct mtd_info *, struct mtd_partition **, - struct mtd_part_parser_data *); -+ enum mtd_parser_type type; - }; - - extern void register_mtd_parser(struct mtd_part_parser *parser); -@@ -87,4 +92,9 @@ uint64_t mtd_get_device_size(const struc - extern void __weak arch_split_mtd_part(struct mtd_info *master, - const char *name, int offset, int size); - -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data); -+ - #endif diff --git a/target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch deleted file mode 100644 index dead0fbf5..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -642,6 +642,37 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+static int -+run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) -+{ -+ struct mtd_partition *parts; -+ int nr_parts; -+ int i; -+ -+ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, &parts, -+ NULL); -+ if (nr_parts <= 0) -+ return nr_parts; -+ -+ if (WARN_ON(!parts)) -+ return 0; -+ -+ for (i = 0; i < nr_parts; i++) { -+ /* adjust partition offsets */ -+ parts[i].offset += slave->offset; -+ -+ __mtd_add_partition(slave->master, -+ parts[i].name, -+ parts[i].offset, -+ parts[i].size, -+ false); -+ } -+ -+ kfree(parts); -+ -+ return nr_parts; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -650,6 +681,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); - - static void split_firmware(struct mtd_info *master, struct mtd_part *part) - { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); - } - - void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -664,6 +696,12 @@ static void mtd_partition_split(struct m - if (rootfs_found) - return; - -+ if (!strcmp(part->mtd.name, "rootfs")) { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ -+ rootfs_found = 1; -+ } -+ - if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && - config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) - split_firmware(master, part); ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -70,6 +70,8 @@ struct mtd_part_parser_data { - - enum mtd_parser_type { - MTD_PARSER_TYPE_DEVICE = 0, -+ MTD_PARSER_TYPE_ROOTFS, -+ MTD_PARSER_TYPE_FIRMWARE, - }; - - struct mtd_part_parser { diff --git a/target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch b/target/linux/generic/pending-3.18/403-mtd-hook-mtdsplit-to-Kbuild.patch deleted file mode 100644 index 0cf1c3855..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch deleted file mode 100644 index b2f62c115..000000000 --- a/target/linux/generic/pending-3.18/404-mtd-add-more-helper-functions.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -446,14 +446,12 @@ static struct mtd_part *allocate_partiti - if (slave->offset == MTDPART_OFS_APPEND) - slave->offset = cur_offset; - if (slave->offset == MTDPART_OFS_NXTBLK) { -- slave->offset = cur_offset; -- if (mtd_mod_by_eb(cur_offset, master) != 0) { -- /* Round up to next erasesize */ -- slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; -+ /* Round up to next erasesize */ -+ slave->offset = mtd_roundup_to_eb(cur_offset, master); -+ if (slave->offset != cur_offset) - printk(KERN_NOTICE "Moving partition %d: " - "0x%012llx -> 0x%012llx\n", partno, - (unsigned long long)cur_offset, (unsigned long long)slave->offset); -- } - } - if (slave->offset == MTDPART_OFS_RETAIN) { - slave->offset = cur_offset; -@@ -673,6 +671,17 @@ run_parsers_by_type(struct mtd_part *sla - return nr_parts; - } - -+static inline unsigned long -+mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) -+{ -+ unsigned long mask = mtd->erasesize - 1; -+ -+ len += offset & mask; -+ len = (len + mask) & ~mask; -+ len -= offset & mask; -+ return len; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -956,6 +965,24 @@ int mtd_is_partition(const struct mtd_in - } - EXPORT_SYMBOL_GPL(mtd_is_partition); - -+struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd) -+{ -+ if (!mtd_is_partition(mtd)) -+ return (struct mtd_info *)mtd; -+ -+ return PART(mtd)->master; -+} -+EXPORT_SYMBOL_GPL(mtdpart_get_master); -+ -+uint64_t mtdpart_get_offset(const struct mtd_info *mtd) -+{ -+ if (!mtd_is_partition(mtd)) -+ return 0; -+ -+ return PART(mtd)->offset; -+} -+EXPORT_SYMBOL_GPL(mtdpart_get_offset); -+ - /* Returns the size of the entire flash chip */ - uint64_t mtd_get_device_size(const struct mtd_info *mtd) - { ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -90,6 +90,8 @@ int mtd_is_partition(const struct mtd_in - int mtd_add_partition(struct mtd_info *master, const char *name, - long long offset, long long length); - int mtd_del_partition(struct mtd_info *master, int partno); -+struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd); -+uint64_t mtdpart_get_offset(const struct mtd_info *mtd); - uint64_t mtd_get_device_size(const struct mtd_info *mtd); - extern void __weak arch_split_mtd_part(struct mtd_info *master, - const char *name, int offset, int size); ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -333,6 +333,24 @@ static inline uint32_t mtd_mod_by_eb(uin - return do_div(sz, mtd->erasesize); - } - -+static inline uint64_t mtd_roundup_to_eb(uint64_t sz, struct mtd_info *mtd) -+{ -+ if (mtd_mod_by_eb(sz, mtd) == 0) -+ return sz; -+ -+ /* Round up to next erase block */ -+ return (mtd_div_by_eb(sz, mtd) + 1) * mtd->erasesize; -+} -+ -+static inline uint64_t mtd_rounddown_to_eb(uint64_t sz, struct mtd_info *mtd) -+{ -+ if (mtd_mod_by_eb(sz, mtd) == 0) -+ return sz; -+ -+ /* Round down to the start of the current erase block */ -+ return (mtd_div_by_eb(sz, mtd)) * mtd->erasesize; -+} -+ - static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd) - { - if (mtd->writesize_shift) diff --git a/target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch b/target/linux/generic/pending-3.18/405-mtd-old-firmware-uimage-splitter.patch deleted file mode 100644 index 7e74c4e53..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -682,6 +682,37 @@ mtd_pad_erasesize(struct mtd_info *mtd, - return len; - } - -+#define UBOOT_MAGIC 0x27051956 -+ -+static void split_uimage(struct mtd_info *master, struct mtd_part *part) -+{ -+ struct { -+ __be32 magic; -+ __be32 pad[2]; -+ __be32 size; -+ } hdr; -+ size_t len; -+ -+ if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr)) -+ return; -+ -+ if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC)) -+ return; -+ -+ len = be32_to_cpu(hdr.size) + 0x40; -+ len = mtd_pad_erasesize(master, part->offset, len); -+ if (len + master->erasesize > part->mtd.size) -+ return; -+ -+ if (config_enabled(CONFIG_MTD_SPLIT_UIMAGE_FW)) -+ pr_err("Dedicated partitioner didn't split firmware partition, please fill a bug report!\n"); -+ else -+ pr_warn("Support for built-in firmware splitter will be removed, please use CONFIG_MTD_SPLIT_UIMAGE_FW\n"); -+ -+ __mtd_add_partition(master, "rootfs", part->offset + len, -+ part->mtd.size - len, false); -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -690,7 +721,14 @@ mtd_pad_erasesize(struct mtd_info *mtd, - - static void split_firmware(struct mtd_info *master, struct mtd_part *part) - { -- run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); -+ int ret; -+ -+ ret = run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); -+ if (ret > 0) -+ return; -+ -+ if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT)) -+ split_uimage(master, part); - } - - void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, diff --git a/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch b/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch deleted file mode 100644 index cc548efb6..000000000 --- a/target/linux/generic/pending-3.18/406-mtd-old-rootfs-squashfs-splitter.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -18,6 +18,11 @@ config MTD_ROOTFS_ROOT_DEV - bool "Automatically set 'rootfs' partition to be root filesystem" - default y - -+config MTD_ROOTFS_SPLIT -+ bool "Automatically split 'rootfs' partition for squashfs" -+ select MTD_SPLIT -+ default y -+ - config MTD_SPLIT_FIRMWARE - bool "Automatically split firmware partition for kernel+rootfs" - default y ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -682,6 +682,47 @@ mtd_pad_erasesize(struct mtd_info *mtd, - return len; - } - -+static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) -+{ -+ size_t squashfs_len; -+ int len, ret; -+ -+ ret = mtd_get_squashfs_len(master, offset, &squashfs_len); -+ if (ret) -+ return ret; -+ -+ len = mtd_pad_erasesize(master, offset, squashfs_len); -+ *split_offset = offset + len; -+ -+ return 0; -+} -+ -+static void split_rootfs_data(struct mtd_info *master, struct mtd_part *part) -+{ -+ unsigned int split_offset = 0; -+ unsigned int split_size; -+ int ret; -+ -+ ret = split_squashfs(master, part->offset, &split_offset); -+ if (ret) -+ return; -+ -+ if (split_offset <= 0) -+ return; -+ -+ if (config_enabled(CONFIG_MTD_SPLIT_SQUASHFS_ROOT)) -+ pr_err("Dedicated partitioner didn't create \"rootfs_data\" partition, please fill a bug report!\n"); -+ else -+ pr_warn("Support for built-in \"rootfs_data\" splitter will be removed, please use CONFIG_MTD_SPLIT_SQUASHFS_ROOT\n"); -+ -+ split_size = part->mtd.size - (split_offset - part->offset); -+ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=0x%x, len=0x%x\n", -+ ROOTFS_SPLIT_NAME, split_offset, split_size); -+ -+ __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset, -+ split_size, false); -+} -+ - #define UBOOT_MAGIC 0x27051956 - - static void split_uimage(struct mtd_info *master, struct mtd_part *part) -@@ -744,7 +785,10 @@ static void mtd_partition_split(struct m - return; - - if (!strcmp(part->mtd.name, "rootfs")) { -- run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ int num = run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ -+ if (num <= 0 && config_enabled(CONFIG_MTD_ROOTFS_SPLIT)) -+ split_rootfs_data(master, part); - - rootfs_found = 1; - } diff --git a/target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch b/target/linux/generic/pending-3.18/410-mtd-move-forward-declaration-of-struct-mtd_info.patch deleted file mode 100644 index 78ebbf88c..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch deleted file mode 100644 index 5d5c6ed5d..000000000 --- a/target/linux/generic/pending-3.18/411-mtd-partial_eraseblock_write.patch +++ /dev/null @@ -1,142 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -36,6 +36,8 @@ - #include "mtdcore.h" - #include "mtdsplit/mtdsplit.h" - -+#define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */ -+ - /* Our partition linked list */ - static LIST_HEAD(mtd_partitions); - static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -234,13 +236,61 @@ static int part_erase(struct mtd_info *m - struct mtd_part *part = PART(mtd); - int ret; - -+ -+ instr->partial_start = false; -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ size_t readlen = 0; -+ u64 mtd_ofs; -+ -+ instr->erase_buf = kmalloc(part->master->erasesize, GFP_ATOMIC); -+ if (!instr->erase_buf) -+ return -ENOMEM; -+ -+ mtd_ofs = part->offset + instr->addr; -+ instr->erase_buf_ofs = do_div(mtd_ofs, part->master->erasesize); -+ -+ if (instr->erase_buf_ofs > 0) { -+ instr->addr -= instr->erase_buf_ofs; -+ ret = mtd_read(part->master, -+ instr->addr + part->offset, -+ part->master->erasesize, -+ &readlen, instr->erase_buf); -+ -+ instr->len += instr->erase_buf_ofs; -+ instr->partial_start = true; -+ } else { -+ mtd_ofs = part->offset + part->mtd.size; -+ instr->erase_buf_ofs = part->master->erasesize - -+ do_div(mtd_ofs, part->master->erasesize); -+ -+ if (instr->erase_buf_ofs > 0) { -+ instr->len += instr->erase_buf_ofs; -+ ret = mtd_read(part->master, -+ part->offset + instr->addr + -+ instr->len - part->master->erasesize, -+ part->master->erasesize, &readlen, -+ instr->erase_buf); -+ } else { -+ ret = 0; -+ } -+ } -+ if (ret < 0) { -+ kfree(instr->erase_buf); -+ return ret; -+ } -+ -+ } -+ - instr->addr += part->offset; - ret = part->master->_erase(part->master, instr); - if (ret) { - if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) - instr->fail_addr -= part->offset; - instr->addr -= part->offset; -+ if (mtd->flags & MTD_ERASE_PARTIAL) -+ kfree(instr->erase_buf); - } -+ - return ret; - } - -@@ -248,7 +298,25 @@ void mtd_erase_callback(struct erase_inf - { - if (instr->mtd->_erase == part_erase) { - struct mtd_part *part = PART(instr->mtd); -+ size_t wrlen = 0; - -+ if (instr->mtd->flags & MTD_ERASE_PARTIAL) { -+ if (instr->partial_start) { -+ part->master->_write(part->master, -+ instr->addr, instr->erase_buf_ofs, -+ &wrlen, instr->erase_buf); -+ instr->addr += instr->erase_buf_ofs; -+ } else { -+ instr->len -= instr->erase_buf_ofs; -+ part->master->_write(part->master, -+ instr->addr + instr->len, -+ instr->erase_buf_ofs, &wrlen, -+ instr->erase_buf + -+ part->master->erasesize - -+ instr->erase_buf_ofs); -+ } -+ kfree(instr->erase_buf); -+ } - if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) - instr->fail_addr -= part->offset; - instr->addr -= part->offset; -@@ -515,17 +583,20 @@ static struct mtd_part *allocate_partiti - if ((slave->mtd.flags & MTD_WRITEABLE) && - mtd_mod_by_eb(slave->offset, &slave->mtd)) { - /* Doesn't start on a boundary of major erase size */ -- /* FIXME: Let it be writable if it is on a boundary of -- * _minor_ erase size though */ -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n", -- part->name); -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ if (((u32) slave->mtd.size) > master->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - if ((slave->mtd.flags & MTD_WRITEABLE) && -- mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", -- part->name); -+ mtd_mod_by_eb(slave->offset + slave->mtd.size, &slave->mtd)) { -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ -+ if ((u32) slave->mtd.size > master->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - - slave->mtd.ecclayout = master->ecclayout; ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -55,6 +55,10 @@ struct erase_info { - u_long priv; - u_char state; - struct erase_info *next; -+ -+ u8 *erase_buf; -+ u32 erase_buf_ofs; -+ bool partial_start; - }; - - struct mtd_erase_region_info { diff --git a/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch deleted file mode 100644 index 62f9d5bad..000000000 --- a/target/linux/generic/pending-3.18/412-mtd-partial_eraseblock_unlock.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -335,7 +335,14 @@ static int part_lock(struct mtd_info *mt - static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) - { - struct mtd_part *part = PART(mtd); -- return part->master->_unlock(part->master, ofs + part->offset, len); -+ -+ ofs += part->offset; -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ /* round up len to next erasesize and round down offset to prev block */ -+ len = (mtd_div_by_eb(len, part->master) + 1) * part->master->erasesize; -+ ofs &= ~(part->master->erasesize - 1); -+ } -+ return part->master->_unlock(part->master, ofs, len); - } - - static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) diff --git a/target/linux/generic/pending-3.18/420-mtd-redboot_space.patch b/target/linux/generic/pending-3.18/420-mtd-redboot_space.patch deleted file mode 100644 index f74affcef..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch deleted file mode 100644 index 25e0ecd04..000000000 --- a/target/linux/generic/pending-3.18/430-mtd-add-myloader-partition-parser.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -184,6 +184,22 @@ config MTD_BCM47XX_PARTS - This provides partitions parser for devices based on BCM47xx - boards. - -+config MTD_MYLOADER_PARTS -+ tristate "MyLoader partition parsing" -+ depends on ADM5120 || ATH25 || ATH79 -+ ---help--- -+ MyLoader is a bootloader which allows the user to define partitions -+ in flash devices, by putting a table in the second erase block -+ on the device, similar to a partition table. This table gives the -+ offsets and lengths of the user defined partitions. -+ -+ If you need code which can detect and parse these tables, and -+ register MTD 'partitions' corresponding to each image detected, -+ enable this option. -+ -+ You will still need the parsing functions to be called by the driver -+ for your particular device. It won't happen automatically. -+ - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -15,6 +15,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o -+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-3.18/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch deleted file mode 100644 index 5ad82f1f5..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/pending-3.18/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch deleted file mode 100644 index 9e5ca91e5..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/440-block2mtd_init.patch b/target/linux/generic/pending-3.18/440-block2mtd_init.patch deleted file mode 100644 index 5ab60265a..000000000 --- a/target/linux/generic/pending-3.18/440-block2mtd_init.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -209,11 +210,12 @@ static void block2mtd_free_device(struct - } - - --static struct block2mtd_dev *add_device(char *devname, int erase_size) -+static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) - { - const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; - struct block_device *bdev; - struct block2mtd_dev *dev; -+ struct mtd_partition *part; - char *name; - - if (!devname) -@@ -257,13 +259,16 @@ static struct block2mtd_dev *add_device( - - /* Setup the MTD structure */ - /* make the name contain the block device in */ -- name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname); -+ if (!mtdname) -+ mtdname = devname; -+ name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); - if (!name) - goto err_destroy_mutex; - -+ strcpy(name, mtdname); - dev->mtd.name = name; - -- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; -+ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1); - dev->mtd.erasesize = erase_size; - dev->mtd.writesize = 1; - dev->mtd.writebufsize = PAGE_SIZE; -@@ -276,15 +281,18 @@ static struct block2mtd_dev *add_device( - dev->mtd.priv = dev; - dev->mtd.owner = THIS_MODULE; - -- if (mtd_device_register(&dev->mtd, NULL, 0)) { -+ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); -+ part->name = name; -+ part->offset = 0; -+ part->size = dev->mtd.size; -+ if (mtd_device_register(&dev->mtd, part, 1)) { - /* Device didn't get added, so free the entry */ - goto err_destroy_mutex; - } - list_add(&dev->list, &blkmtd_device_list); - pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n", - dev->mtd.index, -- dev->mtd.name + strlen("block2mtd: "), -- dev->mtd.erasesize >> 10, dev->mtd.erasesize); -+ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize); - return dev; - - err_destroy_mutex: -@@ -353,9 +361,9 @@ static char block2mtd_paramline[80 + 12] - - static int block2mtd_setup2(const char *val) - { -- char buf[80 + 12]; /* 80 for device, 12 for erase size */ -+ char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ - char *str = buf; -- char *token[2]; -+ char *token[3]; - char *name; - size_t erase_size = PAGE_SIZE; - int i, ret; -@@ -368,7 +376,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 2; i++) -+ for (i = 0; i < 3; i++) - token[i] = strsep(&str, ","); - - if (str) { -@@ -394,8 +402,10 @@ static int block2mtd_setup2(const char * - return 0; - } - } -+ if (token[2] && (strlen(token[2]) + 1 > 80)) -+ pr_err("mtd device name too long\n"); - -- add_device(name, erase_size); -+ add_device(name, erase_size, token[2]); - - return 0; - } -@@ -429,7 +439,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic/pending-3.18/441-block2mtd_probe.patch b/target/linux/generic/pending-3.18/441-block2mtd_probe.patch deleted file mode 100644 index 6836a48e3..000000000 --- a/target/linux/generic/pending-3.18/441-block2mtd_probe.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -10,6 +10,7 @@ - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - - #include -+#include - #include - #include - #include -@@ -210,13 +211,16 @@ static void block2mtd_free_device(struct - } - - --static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) -+static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname, int timeout) - { - const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; -- struct block_device *bdev; -+ struct block_device *bdev = ERR_PTR(-ENODEV); - struct block2mtd_dev *dev; - struct mtd_partition *part; - char *name; -+#ifndef MODULE -+ int i; -+#endif - - if (!devname) - return NULL; -@@ -227,15 +231,20 @@ static struct block2mtd_dev *add_device( - - /* Get a handle on the device */ - bdev = blkdev_get_by_path(devname, mode, dev); -+ - #ifndef MODULE -- if (IS_ERR(bdev)) { -+ for (i = 0; IS_ERR(bdev) && i <= timeout; i++) { -+ dev_t devt; - -- /* We might not have rootfs mounted at this point. Try -- to resolve the device name by other means. */ -+ if (i) -+ msleep(1000); -+ wait_for_device_probe(); -+ -+ devt = name_to_dev_t(devname); -+ if (!devt) -+ continue; - -- dev_t devt = name_to_dev_t(devname); -- if (devt) -- bdev = blkdev_get_by_dev(devt, mode, dev); -+ bdev = blkdev_get_by_dev(devt, mode, dev); - } - #endif - -@@ -361,11 +370,12 @@ static char block2mtd_paramline[80 + 12] - - static int block2mtd_setup2(const char *val) - { -- char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ -+ char buf[80 + 12 + 80 + 8]; /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ - char *str = buf; -- char *token[3]; -+ char *token[4]; - char *name; - size_t erase_size = PAGE_SIZE; -+ unsigned long timeout = 0; - int i, ret; - - if (strnlen(val, sizeof(buf)) >= sizeof(buf)) { -@@ -376,7 +386,7 @@ static int block2mtd_setup2(const char * - strcpy(str, val); - kill_final_newline(str); - -- for (i = 0; i < 3; i++) -+ for (i = 0; i < 4; i++) - token[i] = strsep(&str, ","); - - if (str) { -@@ -405,7 +415,10 @@ static int block2mtd_setup2(const char * - if (token[2] && (strlen(token[2]) + 1 > 80)) - pr_err("mtd device name too long\n"); - -- add_device(name, erase_size, token[2]); -+ if (token[3] && kstrtoul(token[3], 0, &timeout)) -+ pr_err("invalid timeout\n"); -+ -+ add_device(name, erase_size, token[2], timeout); - - return 0; - } -@@ -439,7 +452,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,[,]]]\""); - - static int __init block2mtd_init(void) - { -@@ -474,7 +487,7 @@ static void block2mtd_exit(void) - } - - --module_init(block2mtd_init); -+late_initcall(block2mtd_init); - module_exit(block2mtd_exit); - - MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch b/target/linux/generic/pending-3.18/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch deleted file mode 100644 index 0f5abaa72..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -851,6 +851,7 @@ struct platform_nand_chip { - unsigned int options; - unsigned int bbt_options; - const char **part_probe_types; -+ int (*chip_fixup)(struct mtd_info *mtd); - }; - - /* Keep gcc happy */ ---- a/drivers/mtd/nand/plat_nand.c -+++ b/drivers/mtd/nand/plat_nand.c -@@ -90,7 +90,18 @@ static int plat_nand_probe(struct platfo - } - - /* Scan to find existence of the device */ -- if (nand_scan(&data->mtd, pdata->chip.nr_chips)) { -+ if (nand_scan_ident(&data->mtd, pdata->chip.nr_chips, NULL)) { -+ err = -ENXIO; -+ goto out; -+ } -+ -+ if (pdata->chip.chip_fixup) { -+ err = pdata->chip.chip_fixup(&data->mtd); -+ if (err) -+ goto out; -+ } -+ -+ if (nand_scan_tail(&data->mtd)) { - err = -ENXIO; - goto out; - } diff --git a/target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch b/target/linux/generic/pending-3.18/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch deleted file mode 100644 index 6a2092ce2..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch b/target/linux/generic/pending-3.18/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch deleted file mode 100644 index 68fbd1246..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch b/target/linux/generic/pending-3.18/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch deleted file mode 100644 index c437a140f..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch b/target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch deleted file mode 100644 index f059aa777..000000000 --- a/target/linux/generic/pending-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch +++ /dev/null @@ -1,20 +0,0 @@ -From eef9dfc4e821408af1af13aa0cc707fc496fb7c6 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 11 Dec 2013 19:05:59 +0100 -Subject: [PATCH] m25p80: add support for the Winbond W25X05 flash - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/devices/m25p80.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -618,6 +618,7 @@ static const struct spi_device_id spi_no - { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, - - /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ -+ { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) }, - { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) }, - { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) }, - { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) }, diff --git a/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch b/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch deleted file mode 100644 index 9ba7a4ab2..000000000 --- a/target/linux/generic/pending-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0d7388de0911c1a4fc4a8a3898ef9d0ab818ca08 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 7 Apr 2015 18:35:15 +0200 -Subject: [PATCH] mtd: spi-nor: add support for the Macronix MX25L512E SPI - flash chip - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/spi-nor/spi-nor.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -518,6 +518,7 @@ static const struct spi_device_id spi_no - { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, - - /* Macronix */ -+ { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, - { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, - { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, - { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, diff --git a/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch b/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch deleted file mode 100644 index b06ac73fa..000000000 --- a/target/linux/generic/pending-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 34e2b403040a2f9d3ba071d95a7f42457e2950f9 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 7 Apr 2015 18:35:15 +0200 -Subject: [PATCH] mtd: spi-nor: add support for the ISSI SI25CD512 SPI flash - -Signed-off-by: Gabor Juhos ---- - drivers/mtd/spi-nor/spi-nor.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -517,6 +517,9 @@ static const struct spi_device_id spi_no - { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) }, - { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, - -+ /* ISSI */ -+ { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2, SECT_4K) }, -+ - /* Macronix */ - { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1, SECT_4K) }, - { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) }, diff --git a/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch b/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch deleted file mode 100644 index 72c083232..000000000 --- a/target/linux/generic/pending-3.18/475-mtd-spi-nor-add-macronix-mx25u25635f.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -532,6 +532,7 @@ static const struct spi_device_id spi_no - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, - { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, -+ { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, 0) }, - { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, - { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, - { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, diff --git a/target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/pending-3.18/480-mtd-set-rootfs-to-be-root-dev.patch deleted file mode 100644 index 8fc3578a6..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -456,6 +457,15 @@ int add_mtd_device(struct mtd_info *mtd) - of this try_ nonsense, and no bitching about it - either. :) */ - __module_get(THIS_MODULE); -+ -+ if (!strcmp(mtd->name, "rootfs") && -+ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("mtd: device %d (%s) set to be root filesystem\n", -+ mtd->index, mtd->name); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); -+ } -+ - return 0; - - fail_added: diff --git a/target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-3.18/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch deleted file mode 100644 index bca3487d1..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -1212,6 +1212,49 @@ static struct mtd_info * __init open_mtd - return mtd; - } - -+/* -+ * This function tries attaching mtd partitions named either "ubi" or "data" -+ * during boot. -+ */ -+static void __init ubi_auto_attach(void) -+{ -+ int err; -+ struct mtd_info *mtd; -+ -+ /* try attaching mtd device named "ubi" or "data" */ -+ mtd = open_mtd_device("ubi"); -+ if (IS_ERR(mtd)) -+ mtd = open_mtd_device("data"); -+ -+ if (!IS_ERR(mtd)) { -+ size_t len; -+ char magic[4]; -+ -+ /* check for a valid ubi magic */ -+ err = mtd_read(mtd, 0, 4, &len, (void *) magic); -+ if (!err && len == 4 && strncmp(magic, "UBI#", 4)) { -+ ubi_err("no valid UBI magic found inside mtd%d", mtd->index); -+ put_mtd_device(mtd); -+ return; -+ } -+ -+ /* auto-add only media types where UBI makes sense */ -+ if (mtd->type == MTD_NANDFLASH || -+ mtd->type == MTD_NORFLASH || -+ mtd->type == MTD_DATAFLASH || -+ mtd->type == MTD_MLCNANDFLASH) { -+ mutex_lock(&ubi_devices_mutex); -+ ubi_msg("auto-attach mtd%d", mtd->index); -+ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); -+ mutex_unlock(&ubi_devices_mutex); -+ if (err < 0) { -+ ubi_err("cannot attach mtd%d", mtd->index); -+ put_mtd_device(mtd); -+ } -+ } -+ } -+} -+ - static int __init ubi_init(void) - { - int err, i, k; -@@ -1301,6 +1344,12 @@ static int __init ubi_init(void) - } - } - -+ /* auto-attach mtd devices only if built-in to the kernel and no ubi.mtd -+ * parameter was given */ -+ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ !ubi_is_module() && !mtd_devs) -+ ubi_auto_attach(); -+ - err = ubiblock_init(); - if (err) { - ubi_err("block: cannot initialize, error %d", err); diff --git a/target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-3.18/491-ubi-auto-create-ubiblock-device-for-rootfs.patch deleted file mode 100644 index b152fba1b..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -615,6 +615,44 @@ static int __init ubiblock_create_from_p - return ret; - } - -+#define UBIFS_NODE_MAGIC 0x06101831 -+static inline int ubi_vol_is_ubifs(struct ubi_volume_desc *desc) -+{ -+ int ret; -+ uint32_t magic_of, magic; -+ ret = ubi_read(desc, 0, (char *)&magic_of, 0, 4); -+ if (ret) -+ return 0; -+ magic = le32_to_cpu(magic_of); -+ return magic == UBIFS_NODE_MAGIC; -+} -+ -+static void __init ubiblock_create_auto_rootfs(void) -+{ -+ int ubi_num, ret, is_ubifs; -+ struct ubi_volume_desc *desc; -+ struct ubi_volume_info vi; -+ -+ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) { -+ desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY); -+ if (IS_ERR(desc)) -+ continue; -+ -+ ubi_get_volume_info(desc, &vi); -+ is_ubifs = ubi_vol_is_ubifs(desc); -+ ubi_close_volume(desc); -+ if (is_ubifs) -+ break; -+ -+ ret = ubiblock_create(&vi); -+ if (ret) -+ ubi_err("block: can't add '%s' volume, err=%d\n", -+ vi.name, ret); -+ /* always break if we get here */ -+ break; -+ } -+} -+ - static void ubiblock_remove_all(void) - { - struct ubiblock *next; -@@ -645,6 +683,10 @@ int __init ubiblock_init(void) - if (ret) - goto err_remove; - -+ /* auto-attach "rootfs" volume if existing and non-ubifs */ -+ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV)) -+ ubiblock_create_auto_rootfs(); -+ - /* - * Block devices are only created upon user requests, so we ignore - * existing volumes. diff --git a/target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/pending-3.18/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch deleted file mode 100644 index 54a2f8259..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -433,7 +433,28 @@ retry: - out: - put_page(page); - } -- -+ -+static int __init mount_ubi_rootfs(void) -+{ -+ int flags = MS_SILENT; -+ int err, tried = 0; -+ -+ while (tried < 2) { -+ err = do_mount_root("ubi0:rootfs", "ubifs", flags, \ -+ root_mount_data); -+ switch (err) { -+ case -EACCES: -+ flags |= MS_RDONLY; -+ tried++; -+ break; -+ default: -+ return err; -+ } -+ } -+ -+ return -EINVAL; -+} -+ - #ifdef CONFIG_ROOT_NFS - - #define NFSROOT_TIMEOUT_MIN 5 -@@ -527,6 +548,10 @@ void __init mount_root(void) - change_floppy("root floppy"); - } - #endif -+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV -+ if (!mount_ubi_rootfs()) -+ return; -+#endif - #ifdef CONFIG_BLOCK - create_dev("/dev/root", ROOT_DEV); - mount_block_root("/dev/root", root_mountflags); diff --git a/target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch b/target/linux/generic/pending-3.18/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch deleted file mode 100644 index 46917d12d..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -48,6 +48,7 @@ - #include - #include - #include -+#include - - #include "ubi-media.h" - #include "ubi.h" -@@ -448,6 +449,15 @@ int ubiblock_create(struct ubi_volume_in - add_disk(dev->gd); - ubi_msg("%s created from ubi%d:%d(%s)", - dev->gd->disk_name, dev->ubi_num, dev->vol_id, vi->name); -+ -+ if (!strcmp(vi->name, "rootfs") && -+ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n", -+ dev->ubi_num, dev->vol_id, vi->name); -+ ROOT_DEV = MKDEV(gd->major, gd->first_minor); -+ } -+ - return 0; - - out_free_queue: diff --git a/target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch b/target/linux/generic/pending-3.18/494-mtd-ubi-add-EOF-marker-support.patch deleted file mode 100644 index 4b5eb4568..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -800,6 +800,13 @@ out_unlock: - return err; - } - -+static bool ec_hdr_has_eof(struct ubi_ec_hdr *ech) -+{ -+ return ech->padding1[0] == 'E' && -+ ech->padding1[1] == 'O' && -+ ech->padding1[2] == 'F'; -+} -+ - /** - * scan_peb - scan and process UBI headers of a PEB. - * @ubi: UBI device description object -@@ -830,9 +837,21 @@ static int scan_peb(struct ubi_device *u - return 0; - } - -- err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); -- if (err < 0) -- return err; -+ if (!ai->eof_found) { -+ err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); -+ if (err < 0) -+ return err; -+ -+ if (ec_hdr_has_eof(ech)) { -+ ubi_msg("EOF marker found, PEBs from %d will be erased", -+ pnum); -+ ai->eof_found = true; -+ } -+ } -+ -+ if (ai->eof_found) -+ err = UBI_IO_FF_BITFLIPS; -+ - switch (err) { - case 0: - break; ---- a/drivers/mtd/ubi/ubi.h -+++ b/drivers/mtd/ubi/ubi.h -@@ -705,6 +705,7 @@ struct ubi_attach_info { - int mean_ec; - uint64_t ec_sum; - int ec_count; -+ bool eof_found; - struct kmem_cache *aeb_slab_cache; - }; - diff --git a/target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-3.18/530-jffs2_make_lzma_available.patch deleted file mode 100644 index c92209a72..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -227,6 +227,12 @@ config LZ4_DECOMPRESS - - source "lib/xz/Kconfig" - -+config LZMA_COMPRESS -+ tristate -+ -+config LZMA_DECOMPRESS -+ tristate -+ - # - # These all provide a common interface (hence the apparent duplication with - # ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.) ---- a/lib/Makefile -+++ b/lib/Makefile -@@ -2,6 +2,16 @@ - # Makefile for some libs needed in the kernel. - # - -+ifdef CONFIG_JFFS2_ZLIB -+ CONFIG_ZLIB_INFLATE:=y -+ CONFIG_ZLIB_DEFLATE:=y -+endif -+ -+ifdef CONFIG_JFFS2_LZMA -+ CONFIG_LZMA_DECOMPRESS:=y -+ CONFIG_LZMA_COMPRESS:=y -+endif -+ - ifdef CONFIG_FUNCTION_TRACER - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS)) -@@ -85,6 +95,8 @@ obj-$(CONFIG_LZ4HC_COMPRESS) += lz4/ - obj-$(CONFIG_LZ4_DECOMPRESS) += lz4/ - obj-$(CONFIG_XZ_DEC) += xz/ - obj-$(CONFIG_RAID6_PQ) += raid6/ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma/ -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/ - - lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o - lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o ---- /dev/null -+++ b/lib/lzma/LzFind.c -@@ -0,0 +1,761 @@ -+/* LzFind.c -- Match finder for LZ algorithms -+2009-04-22 : Igor Pavlov : Public domain */ -+ -+#include -+ -+#include "LzFind.h" -+#include "LzHash.h" -+ -+#define kEmptyHashValue 0 -+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) -+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ -+#define kNormalizeMask (~(kNormalizeStepMin - 1)) -+#define kMaxHistorySize ((UInt32)3 << 30) -+ -+#define kStartMaxLen 3 -+ -+static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ if (!p->directInput) -+ { -+ alloc->Free(alloc, p->bufferBase); -+ p->bufferBase = 0; -+ } -+} -+ -+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ -+ -+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) -+{ -+ UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; -+ if (p->directInput) -+ { -+ p->blockSize = blockSize; -+ return 1; -+ } -+ if (p->bufferBase == 0 || p->blockSize != blockSize) -+ { -+ LzInWindow_Free(p, alloc); -+ p->blockSize = blockSize; -+ p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); -+ } -+ return (p->bufferBase != 0); -+} -+ -+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } -+ -+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } -+ -+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -+{ -+ p->posLimit -= subValue; -+ p->pos -= subValue; -+ p->streamPos -= subValue; -+} -+ -+static void MatchFinder_ReadBlock(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached || p->result != SZ_OK) -+ return; -+ if (p->directInput) -+ { -+ UInt32 curSize = 0xFFFFFFFF - p->streamPos; -+ if (curSize > p->directInputRem) -+ curSize = (UInt32)p->directInputRem; -+ p->directInputRem -= curSize; -+ p->streamPos += curSize; -+ if (p->directInputRem == 0) -+ p->streamEndWasReached = 1; -+ return; -+ } -+ for (;;) -+ { -+ Byte *dest = p->buffer + (p->streamPos - p->pos); -+ size_t size = (p->bufferBase + p->blockSize - dest); -+ if (size == 0) -+ return; -+ p->result = p->stream->Read(p->stream, dest, &size); -+ if (p->result != SZ_OK) -+ return; -+ if (size == 0) -+ { -+ p->streamEndWasReached = 1; -+ return; -+ } -+ p->streamPos += (UInt32)size; -+ if (p->streamPos - p->pos > p->keepSizeAfter) -+ return; -+ } -+} -+ -+void MatchFinder_MoveBlock(CMatchFinder *p) -+{ -+ memmove(p->bufferBase, -+ p->buffer - p->keepSizeBefore, -+ (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); -+ p->buffer = p->bufferBase + p->keepSizeBefore; -+} -+ -+int MatchFinder_NeedMove(CMatchFinder *p) -+{ -+ if (p->directInput) -+ return 0; -+ /* if (p->streamEndWasReached) return 0; */ -+ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); -+} -+ -+void MatchFinder_ReadIfRequired(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached) -+ return; -+ if (p->keepSizeAfter >= p->streamPos - p->pos) -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) -+{ -+ if (MatchFinder_NeedMove(p)) -+ MatchFinder_MoveBlock(p); -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_SetDefaultSettings(CMatchFinder *p) -+{ -+ p->cutValue = 32; -+ p->btMode = 1; -+ p->numHashBytes = 4; -+ p->bigHash = 0; -+} -+ -+#define kCrcPoly 0xEDB88320 -+ -+void MatchFinder_Construct(CMatchFinder *p) -+{ -+ UInt32 i; -+ p->bufferBase = 0; -+ p->directInput = 0; -+ p->hash = 0; -+ MatchFinder_SetDefaultSettings(p); -+ -+ for (i = 0; i < 256; i++) -+ { -+ UInt32 r = i; -+ int j; -+ for (j = 0; j < 8; j++) -+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); -+ p->crc[i] = r; -+ } -+} -+ -+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->hash); -+ p->hash = 0; -+} -+ -+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ LzInWindow_Free(p, alloc); -+} -+ -+static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) -+{ -+ size_t sizeInBytes = (size_t)num * sizeof(CLzRef); -+ if (sizeInBytes / sizeof(CLzRef) != num) -+ return 0; -+ return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); -+} -+ -+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, -+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, -+ ISzAlloc *alloc) -+{ -+ UInt32 sizeReserv; -+ if (historySize > kMaxHistorySize) -+ { -+ MatchFinder_Free(p, alloc); -+ return 0; -+ } -+ sizeReserv = historySize >> 1; -+ if (historySize > ((UInt32)2 << 30)) -+ sizeReserv = historySize >> 2; -+ sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); -+ -+ p->keepSizeBefore = historySize + keepAddBufferBefore + 1; -+ p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; -+ /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ -+ if (LzInWindow_Create(p, sizeReserv, alloc)) -+ { -+ UInt32 newCyclicBufferSize = historySize + 1; -+ UInt32 hs; -+ p->matchMaxLen = matchMaxLen; -+ { -+ p->fixedHashSize = 0; -+ if (p->numHashBytes == 2) -+ hs = (1 << 16) - 1; -+ else -+ { -+ hs = historySize - 1; -+ hs |= (hs >> 1); -+ hs |= (hs >> 2); -+ hs |= (hs >> 4); -+ hs |= (hs >> 8); -+ hs >>= 1; -+ hs |= 0xFFFF; /* don't change it! It's required for Deflate */ -+ if (hs > (1 << 24)) -+ { -+ if (p->numHashBytes == 3) -+ hs = (1 << 24) - 1; -+ else -+ hs >>= 1; -+ } -+ } -+ p->hashMask = hs; -+ hs++; -+ if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; -+ if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; -+ if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; -+ hs += p->fixedHashSize; -+ } -+ -+ { -+ UInt32 prevSize = p->hashSizeSum + p->numSons; -+ UInt32 newSize; -+ p->historySize = historySize; -+ p->hashSizeSum = hs; -+ p->cyclicBufferSize = newCyclicBufferSize; -+ p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); -+ newSize = p->hashSizeSum + p->numSons; -+ if (p->hash != 0 && prevSize == newSize) -+ return 1; -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ p->hash = AllocRefs(newSize, alloc); -+ if (p->hash != 0) -+ { -+ p->son = p->hash + p->hashSizeSum; -+ return 1; -+ } -+ } -+ } -+ MatchFinder_Free(p, alloc); -+ return 0; -+} -+ -+static void MatchFinder_SetLimits(CMatchFinder *p) -+{ -+ UInt32 limit = kMaxValForNormalize - p->pos; -+ UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; -+ if (limit2 < limit) -+ limit = limit2; -+ limit2 = p->streamPos - p->pos; -+ if (limit2 <= p->keepSizeAfter) -+ { -+ if (limit2 > 0) -+ limit2 = 1; -+ } -+ else -+ limit2 -= p->keepSizeAfter; -+ if (limit2 < limit) -+ limit = limit2; -+ { -+ UInt32 lenLimit = p->streamPos - p->pos; -+ if (lenLimit > p->matchMaxLen) -+ lenLimit = p->matchMaxLen; -+ p->lenLimit = lenLimit; -+ } -+ p->posLimit = p->pos + limit; -+} -+ -+void MatchFinder_Init(CMatchFinder *p) -+{ -+ UInt32 i; -+ for (i = 0; i < p->hashSizeSum; i++) -+ p->hash[i] = kEmptyHashValue; -+ p->cyclicBufferPos = 0; -+ p->buffer = p->bufferBase; -+ p->pos = p->streamPos = p->cyclicBufferSize; -+ p->result = SZ_OK; -+ p->streamEndWasReached = 0; -+ MatchFinder_ReadBlock(p); -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) -+{ -+ return (p->pos - p->historySize - 1) & kNormalizeMask; -+} -+ -+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) -+{ -+ UInt32 i; -+ for (i = 0; i < numItems; i++) -+ { -+ UInt32 value = items[i]; -+ if (value <= subValue) -+ value = kEmptyHashValue; -+ else -+ value -= subValue; -+ items[i] = value; -+ } -+} -+ -+static void MatchFinder_Normalize(CMatchFinder *p) -+{ -+ UInt32 subValue = MatchFinder_GetSubValue(p); -+ MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); -+ MatchFinder_ReduceOffsets(p, subValue); -+} -+ -+static void MatchFinder_CheckLimits(CMatchFinder *p) -+{ -+ if (p->pos == kMaxValForNormalize) -+ MatchFinder_Normalize(p); -+ if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) -+ MatchFinder_CheckAndMoveAndRead(p); -+ if (p->cyclicBufferPos == p->cyclicBufferSize) -+ p->cyclicBufferPos = 0; -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ son[_cyclicBufferPos] = curMatch; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ return distances; -+ { -+ const Byte *pb = cur - delta; -+ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; -+ if (pb[maxLen] == cur[maxLen] && *pb == *cur) -+ { -+ UInt32 len = 0; -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ return distances; -+ } -+ } -+ } -+ } -+} -+ -+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return distances; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ if (++len != lenLimit && pb[len] == cur[len]) -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return distances; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ { -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+#define MOVE_POS \ -+ ++p->cyclicBufferPos; \ -+ p->buffer++; \ -+ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); -+ -+#define MOVE_POS_RET MOVE_POS return offset; -+ -+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } -+ -+#define GET_MATCHES_HEADER2(minLen, ret_op) \ -+ UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ -+ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ -+ cur = p->buffer; -+ -+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) -+#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) -+ -+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue -+ -+#define GET_MATCHES_FOOTER(offset, maxLen) \ -+ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ -+ distances + offset, maxLen) - distances); MOVE_POS_RET; -+ -+#define SKIP_FOOTER \ -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; -+ -+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 1) -+} -+ -+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 2) -+} -+ -+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, delta2, maxLen, offset; -+ GET_MATCHES_HEADER(3) -+ -+ HASH3_CALC; -+ -+ delta2 = p->pos - p->hash[hash2Value]; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ -+ -+ maxLen = 2; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[0] = maxLen; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances + offset, maxLen) - (distances)); -+ MOVE_POS_RET -+} -+ -+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances, 2) - (distances)); -+ MOVE_POS_RET -+} -+ -+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value; -+ SKIP_HEADER(3) -+ HASH3_CALC; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = p->pos; -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) -+{ -+ vTable->Init = (Mf_Init_Func)MatchFinder_Init; -+ vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; -+ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; -+ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; -+ if (!p->btMode) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 2) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 3) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; -+ } -+ else -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; -+ } -+} ---- /dev/null -+++ b/lib/lzma/LzmaDec.c -@@ -0,0 +1,999 @@ -+/* LzmaDec.c -- LZMA Decoder -+2009-09-20 : Igor Pavlov : Public domain */ -+ -+#include "LzmaDec.h" -+ -+#include -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+ -+#define RC_INIT_SIZE 5 -+ -+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); -+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); -+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ -+ { UPDATE_0(p); i = (i + i); A0; } else \ -+ { UPDATE_1(p); i = (i + i) + 1; A1; } -+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) -+ -+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } -+#define TREE_DECODE(probs, limit, i) \ -+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } -+ -+/* #define _LZMA_SIZE_OPT */ -+ -+#ifdef _LZMA_SIZE_OPT -+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) -+#else -+#define TREE_6_DECODE(probs, i) \ -+ { i = 1; \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ i -= 0x40; } -+#endif -+ -+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0_CHECK range = bound; -+#define UPDATE_1_CHECK range -= bound; code -= bound; -+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ -+ { UPDATE_0_CHECK; i = (i + i); A0; } else \ -+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; } -+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) -+#define TREE_DECODE_CHECK(probs, limit, i) \ -+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } -+ -+ -+#define kNumPosBitsMax 4 -+#define kNumPosStatesMax (1 << kNumPosBitsMax) -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define LenChoice 0 -+#define LenChoice2 (LenChoice + 1) -+#define LenLow (LenChoice2 + 1) -+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -+#define kNumLenProbs (LenHigh + kLenNumHighSymbols) -+ -+ -+#define kNumStates 12 -+#define kNumLitStates 7 -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#define kNumPosSlotBits 6 -+#define kNumLenToPosStates 4 -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+ -+#define kMatchMinLen 2 -+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define IsMatch 0 -+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -+#define IsRepG0 (IsRep + kNumStates) -+#define IsRepG1 (IsRepG0 + kNumStates) -+#define IsRepG2 (IsRepG1 + kNumStates) -+#define IsRep0Long (IsRepG2 + kNumStates) -+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -+#define LenCoder (Align + kAlignTableSize) -+#define RepLenCoder (LenCoder + kNumLenProbs) -+#define Literal (RepLenCoder + kNumLenProbs) -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) -+ -+#if Literal != LZMA_BASE_SIZE -+StopCompilingDueBUG -+#endif -+ -+#define LZMA_DIC_MIN (1 << 12) -+ -+/* First LZMA-symbol is always decoded. -+And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization -+Out: -+ Result: -+ SZ_OK - OK -+ SZ_ERROR_DATA - Error -+ p->remainLen: -+ < kMatchSpecLenStart : normal remain -+ = kMatchSpecLenStart : finished -+ = kMatchSpecLenStart + 1 : Flush marker -+ = kMatchSpecLenStart + 2 : State Init Marker -+*/ -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ CLzmaProb *probs = p->probs; -+ -+ unsigned state = p->state; -+ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; -+ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; -+ unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; -+ unsigned lc = p->prop.lc; -+ -+ Byte *dic = p->dic; -+ SizeT dicBufSize = p->dicBufSize; -+ SizeT dicPos = p->dicPos; -+ -+ UInt32 processedPos = p->processedPos; -+ UInt32 checkDicSize = p->checkDicSize; -+ unsigned len = 0; -+ -+ const Byte *buf = p->buf; -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ -+ do -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = processedPos & pbMask; -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ unsigned symbol; -+ UPDATE_0(prob); -+ prob = probs + Literal; -+ if (checkDicSize != 0 || processedPos != 0) -+ prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + -+ (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ state -= (state < 4) ? state : 3; -+ symbol = 1; -+ do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ state -= (state < 10) ? 3 : 6; -+ symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ dic[dicPos++] = (Byte)symbol; -+ processedPos++; -+ continue; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRep + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ state += kNumStates; -+ prob = probs + LenCoder; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ if (checkDicSize == 0 && processedPos == 0) -+ return SZ_ERROR_DATA; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ processedPos++; -+ state = state < kNumLitStates ? 9 : 11; -+ continue; -+ } -+ UPDATE_1(prob); -+ } -+ else -+ { -+ UInt32 distance; -+ UPDATE_1(prob); -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep1; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep2; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ distance = rep3; -+ rep3 = rep2; -+ } -+ rep2 = rep1; -+ } -+ rep1 = rep0; -+ rep0 = distance; -+ } -+ state = state < kNumLitStates ? 8 : 11; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = (1 << kLenNumLowBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenChoice2; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = (1 << kLenNumMidBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = (1 << kLenNumHighBits); -+ } -+ } -+ TREE_DECODE(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state >= kNumStates) -+ { -+ UInt32 distance; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); -+ TREE_6_DECODE(prob, distance); -+ if (distance >= kStartPosModelIndex) -+ { -+ unsigned posSlot = (unsigned)distance; -+ int numDirectBits = (int)(((distance >> 1) - 1)); -+ distance = (2 | (distance & 1)); -+ if (posSlot < kEndPosModelIndex) -+ { -+ distance <<= numDirectBits; -+ prob = probs + SpecPos + distance - posSlot - 1; -+ { -+ UInt32 mask = 1; -+ unsigned i = 1; -+ do -+ { -+ GET_BIT2(prob + i, i, ; , distance |= mask); -+ mask <<= 1; -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE -+ range >>= 1; -+ -+ { -+ UInt32 t; -+ code -= range; -+ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ -+ distance = (distance << 1) + (t + 1); -+ code += range & t; -+ } -+ /* -+ distance <<= 1; -+ if (code >= range) -+ { -+ code -= range; -+ distance |= 1; -+ } -+ */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ distance <<= kNumAlignBits; -+ { -+ unsigned i = 1; -+ GET_BIT2(prob + i, i, ; , distance |= 1); -+ GET_BIT2(prob + i, i, ; , distance |= 2); -+ GET_BIT2(prob + i, i, ; , distance |= 4); -+ GET_BIT2(prob + i, i, ; , distance |= 8); -+ } -+ if (distance == (UInt32)0xFFFFFFFF) -+ { -+ len += kMatchSpecLenStart; -+ state -= kNumStates; -+ break; -+ } -+ } -+ } -+ rep3 = rep2; -+ rep2 = rep1; -+ rep1 = rep0; -+ rep0 = distance + 1; -+ if (checkDicSize == 0) -+ { -+ if (distance >= processedPos) -+ return SZ_ERROR_DATA; -+ } -+ else if (distance >= checkDicSize) -+ return SZ_ERROR_DATA; -+ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; -+ } -+ -+ len += kMatchMinLen; -+ -+ if (limit == dicPos) -+ return SZ_ERROR_DATA; -+ { -+ SizeT rem = limit - dicPos; -+ unsigned curLen = ((rem < len) ? (unsigned)rem : len); -+ SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); -+ -+ processedPos += curLen; -+ -+ len -= curLen; -+ if (pos + curLen <= dicBufSize) -+ { -+ Byte *dest = dic + dicPos; -+ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; -+ const Byte *lim = dest + curLen; -+ dicPos += curLen; -+ do -+ *(dest) = (Byte)*(dest + src); -+ while (++dest != lim); -+ } -+ else -+ { -+ do -+ { -+ dic[dicPos++] = dic[pos]; -+ if (++pos == dicBufSize) -+ pos = 0; -+ } -+ while (--curLen != 0); -+ } -+ } -+ } -+ } -+ while (dicPos < limit && buf < bufLimit); -+ NORMALIZE; -+ p->buf = buf; -+ p->range = range; -+ p->code = code; -+ p->remainLen = len; -+ p->dicPos = dicPos; -+ p->processedPos = processedPos; -+ p->reps[0] = rep0; -+ p->reps[1] = rep1; -+ p->reps[2] = rep2; -+ p->reps[3] = rep3; -+ p->state = state; -+ -+ return SZ_OK; -+} -+ -+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) -+{ -+ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) -+ { -+ Byte *dic = p->dic; -+ SizeT dicPos = p->dicPos; -+ SizeT dicBufSize = p->dicBufSize; -+ unsigned len = p->remainLen; -+ UInt32 rep0 = p->reps[0]; -+ if (limit - dicPos < len) -+ len = (unsigned)(limit - dicPos); -+ -+ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) -+ p->checkDicSize = p->prop.dicSize; -+ -+ p->processedPos += len; -+ p->remainLen -= len; -+ while (len-- != 0) -+ { -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ } -+ p->dicPos = dicPos; -+ } -+} -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ do -+ { -+ SizeT limit2 = limit; -+ if (p->checkDicSize == 0) -+ { -+ UInt32 rem = p->prop.dicSize - p->processedPos; -+ if (limit - p->dicPos > rem) -+ limit2 = p->dicPos + rem; -+ } -+ RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); -+ if (p->processedPos >= p->prop.dicSize) -+ p->checkDicSize = p->prop.dicSize; -+ LzmaDec_WriteRem(p, limit); -+ } -+ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); -+ -+ if (p->remainLen > kMatchSpecLenStart) -+ { -+ p->remainLen = kMatchSpecLenStart; -+ } -+ return 0; -+} -+ -+typedef enum -+{ -+ DUMMY_ERROR, /* unexpected end of input stream */ -+ DUMMY_LIT, -+ DUMMY_MATCH, -+ DUMMY_REP -+} ELzmaDummy; -+ -+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) -+{ -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ const Byte *bufLimit = buf + inSize; -+ CLzmaProb *probs = p->probs; -+ unsigned state = p->state; -+ ELzmaDummy res; -+ -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK -+ -+ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ -+ -+ prob = probs + Literal; -+ if (p->checkDicSize != 0 || p->processedPos != 0) -+ prob += (LZMA_LIT_SIZE * -+ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + -+ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ unsigned symbol = 1; -+ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[p->dicPos - p->reps[0] + -+ ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ unsigned symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ res = DUMMY_LIT; -+ } -+ else -+ { -+ unsigned len; -+ UPDATE_1_CHECK; -+ -+ prob = probs + IsRep + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ state = 0; -+ prob = probs + LenCoder; -+ res = DUMMY_MATCH; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ res = DUMMY_REP; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ NORMALIZE_CHECK; -+ return DUMMY_REP; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ } -+ state = kNumStates; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = 1 << kLenNumLowBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenChoice2; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = 1 << kLenNumMidBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = 1 << kLenNumHighBits; -+ } -+ } -+ TREE_DECODE_CHECK(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state < 4) -+ { -+ unsigned posSlot; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << -+ kNumPosSlotBits); -+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); -+ if (posSlot >= kStartPosModelIndex) -+ { -+ int numDirectBits = ((posSlot >> 1) - 1); -+ -+ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ -+ -+ if (posSlot < kEndPosModelIndex) -+ { -+ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE_CHECK -+ range >>= 1; -+ code -= range & (((code - range) >> 31) - 1); -+ /* if (code >= range) code -= range; */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ numDirectBits = kNumAlignBits; -+ } -+ { -+ unsigned i = 1; -+ do -+ { -+ GET_BIT_CHECK(prob + i, i); -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ } -+ } -+ } -+ NORMALIZE_CHECK; -+ return res; -+} -+ -+ -+static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) -+{ -+ p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); -+ p->range = 0xFFFFFFFF; -+ p->needFlush = 0; -+} -+ -+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -+{ -+ p->needFlush = 1; -+ p->remainLen = 0; -+ p->tempBufSize = 0; -+ -+ if (initDic) -+ { -+ p->processedPos = 0; -+ p->checkDicSize = 0; -+ p->needInitState = 1; -+ } -+ if (initState) -+ p->needInitState = 1; -+} -+ -+void LzmaDec_Init(CLzmaDec *p) -+{ -+ p->dicPos = 0; -+ LzmaDec_InitDicAndState(p, True, True); -+} -+ -+static void LzmaDec_InitStateReal(CLzmaDec *p) -+{ -+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); -+ UInt32 i; -+ CLzmaProb *probs = p->probs; -+ for (i = 0; i < numProbs; i++) -+ probs[i] = kBitModelTotal >> 1; -+ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; -+ p->state = 0; -+ p->needInitState = 0; -+} -+ -+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, -+ ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT inSize = *srcLen; -+ (*srcLen) = 0; -+ LzmaDec_WriteRem(p, dicLimit); -+ -+ *status = LZMA_STATUS_NOT_SPECIFIED; -+ -+ while (p->remainLen != kMatchSpecLenStart) -+ { -+ int checkEndMarkNow; -+ -+ if (p->needFlush != 0) -+ { -+ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) -+ p->tempBuf[p->tempBufSize++] = *src++; -+ if (p->tempBufSize < RC_INIT_SIZE) -+ { -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (p->tempBuf[0] != 0) -+ return SZ_ERROR_DATA; -+ -+ LzmaDec_InitRc(p, p->tempBuf); -+ p->tempBufSize = 0; -+ } -+ -+ checkEndMarkNow = 0; -+ if (p->dicPos >= dicLimit) -+ { -+ if (p->remainLen == 0 && p->code == 0) -+ { -+ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; -+ return SZ_OK; -+ } -+ if (finishMode == LZMA_FINISH_ANY) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_OK; -+ } -+ if (p->remainLen != 0) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ checkEndMarkNow = 1; -+ } -+ -+ if (p->needInitState) -+ LzmaDec_InitStateReal(p); -+ -+ if (p->tempBufSize == 0) -+ { -+ SizeT processed; -+ const Byte *bufLimit; -+ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, src, inSize); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ memcpy(p->tempBuf, src, inSize); -+ p->tempBufSize = (unsigned)inSize; -+ (*srcLen) += inSize; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ bufLimit = src; -+ } -+ else -+ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; -+ p->buf = src; -+ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) -+ return SZ_ERROR_DATA; -+ processed = (SizeT)(p->buf - src); -+ (*srcLen) += processed; -+ src += processed; -+ inSize -= processed; -+ } -+ else -+ { -+ unsigned rem = p->tempBufSize, lookAhead = 0; -+ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) -+ p->tempBuf[rem++] = src[lookAhead++]; -+ p->tempBufSize = rem; -+ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ (*srcLen) += lookAhead; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ } -+ p->buf = p->tempBuf; -+ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) -+ return SZ_ERROR_DATA; -+ lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); -+ (*srcLen) += lookAhead; -+ src += lookAhead; -+ inSize -= lookAhead; -+ p->tempBufSize = 0; -+ } -+ } -+ if (p->code == 0) -+ *status = LZMA_STATUS_FINISHED_WITH_MARK; -+ return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; -+} -+ -+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT outSize = *destLen; -+ SizeT inSize = *srcLen; -+ *srcLen = *destLen = 0; -+ for (;;) -+ { -+ SizeT inSizeCur = inSize, outSizeCur, dicPos; -+ ELzmaFinishMode curFinishMode; -+ SRes res; -+ if (p->dicPos == p->dicBufSize) -+ p->dicPos = 0; -+ dicPos = p->dicPos; -+ if (outSize > p->dicBufSize - dicPos) -+ { -+ outSizeCur = p->dicBufSize; -+ curFinishMode = LZMA_FINISH_ANY; -+ } -+ else -+ { -+ outSizeCur = dicPos + outSize; -+ curFinishMode = finishMode; -+ } -+ -+ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); -+ src += inSizeCur; -+ inSize -= inSizeCur; -+ *srcLen += inSizeCur; -+ outSizeCur = p->dicPos - dicPos; -+ memcpy(dest, p->dic + dicPos, outSizeCur); -+ dest += outSizeCur; -+ outSize -= outSizeCur; -+ *destLen += outSizeCur; -+ if (res != 0) -+ return res; -+ if (outSizeCur == 0 || outSize == 0) -+ return SZ_OK; -+ } -+} -+ -+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->probs); -+ p->probs = 0; -+} -+ -+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->dic); -+ p->dic = 0; -+} -+ -+void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ LzmaDec_FreeProbs(p, alloc); -+ LzmaDec_FreeDict(p, alloc); -+} -+ -+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -+{ -+ UInt32 dicSize; -+ Byte d; -+ -+ if (size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_UNSUPPORTED; -+ else -+ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); -+ -+ if (dicSize < LZMA_DIC_MIN) -+ dicSize = LZMA_DIC_MIN; -+ p->dicSize = dicSize; -+ -+ d = data[0]; -+ if (d >= (9 * 5 * 5)) -+ return SZ_ERROR_UNSUPPORTED; -+ -+ p->lc = d % 9; -+ d /= 9; -+ p->pb = d / 5; -+ p->lp = d % 5; -+ -+ return SZ_OK; -+} -+ -+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) -+{ -+ UInt32 numProbs = LzmaProps_GetNumProbs(propNew); -+ if (p->probs == 0 || numProbs != p->numProbs) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); -+ p->numProbs = numProbs; -+ if (p->probs == 0) -+ return SZ_ERROR_MEM; -+ } -+ return SZ_OK; -+} -+ -+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ SizeT dicBufSize; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ dicBufSize = propNew.dicSize; -+ if (p->dic == 0 || dicBufSize != p->dicBufSize) -+ { -+ LzmaDec_FreeDict(p, alloc); -+ p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); -+ if (p->dic == 0) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ } -+ p->dicBufSize = dicBufSize; -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, -+ ELzmaStatus *status, ISzAlloc *alloc) -+{ -+ CLzmaDec p; -+ SRes res; -+ SizeT inSize = *srcLen; -+ SizeT outSize = *destLen; -+ *srcLen = *destLen = 0; -+ if (inSize < RC_INIT_SIZE) -+ return SZ_ERROR_INPUT_EOF; -+ -+ LzmaDec_Construct(&p); -+ res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); -+ if (res != 0) -+ return res; -+ p.dic = dest; -+ p.dicBufSize = outSize; -+ -+ LzmaDec_Init(&p); -+ -+ *srcLen = inSize; -+ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); -+ -+ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) -+ res = SZ_ERROR_INPUT_EOF; -+ -+ (*destLen) = p.dicPos; -+ LzmaDec_FreeProbs(&p, alloc); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/LzmaEnc.c -@@ -0,0 +1,2271 @@ -+/* LzmaEnc.c -- LZMA Encoder -+2009-11-24 : Igor Pavlov : Public domain */ -+ -+#include -+ -+/* #define SHOW_STAT */ -+/* #define SHOW_STAT2 */ -+ -+#if defined(SHOW_STAT) || defined(SHOW_STAT2) -+#include -+#endif -+ -+#include "LzmaEnc.h" -+ -+/* disable MT */ -+#define _7ZIP_ST -+ -+#include "LzFind.h" -+#ifndef _7ZIP_ST -+#include "LzFindMt.h" -+#endif -+ -+#ifdef SHOW_STAT -+static int ttt = 0; -+#endif -+ -+#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) -+ -+#define kBlockSize (9 << 10) -+#define kUnpackBlockSize (1 << 18) -+#define kMatchArraySize (1 << 21) -+#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) -+ -+#define kNumMaxDirectBits (31) -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+#define kProbInitValue (kBitModelTotal >> 1) -+ -+#define kNumMoveReducingBits 4 -+#define kNumBitPriceShiftBits 4 -+#define kBitPrice (1 << kNumBitPriceShiftBits) -+ -+void LzmaEncProps_Init(CLzmaEncProps *p) -+{ -+ p->level = 5; -+ p->dictSize = p->mc = 0; -+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; -+ p->writeEndMark = 0; -+} -+ -+void LzmaEncProps_Normalize(CLzmaEncProps *p) -+{ -+ int level = p->level; -+ if (level < 0) level = 5; -+ p->level = level; -+ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); -+ if (p->lc < 0) p->lc = 3; -+ if (p->lp < 0) p->lp = 0; -+ if (p->pb < 0) p->pb = 2; -+ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); -+ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); -+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); -+ if (p->numHashBytes < 0) p->numHashBytes = 4; -+ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); -+ if (p->numThreads < 0) -+ p->numThreads = -+ #ifndef _7ZIP_ST -+ ((p->btMode && p->algo) ? 2 : 1); -+ #else -+ 1; -+ #endif -+} -+ -+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -+{ -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ return props.dictSize; -+} -+ -+/* #define LZMA_LOG_BSR */ -+/* Define it for Intel's CPU */ -+ -+ -+#ifdef LZMA_LOG_BSR -+ -+#define kDicLogSizeMaxCompress 30 -+ -+#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } -+ -+UInt32 GetPosSlot1(UInt32 pos) -+{ -+ UInt32 res; -+ BSR2_RET(pos, res); -+ return res; -+} -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } -+ -+#else -+ -+#define kNumLogBits (9 + (int)sizeof(size_t) / 2) -+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) -+ -+void LzmaEnc_FastPosInit(Byte *g_FastPos) -+{ -+ int c = 2, slotFast; -+ g_FastPos[0] = 0; -+ g_FastPos[1] = 1; -+ -+ for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) -+ { -+ UInt32 k = (1 << ((slotFast >> 1) - 1)); -+ UInt32 j; -+ for (j = 0; j < k; j++, c++) -+ g_FastPos[c] = (Byte)slotFast; -+ } -+} -+ -+#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ -+ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ -+ res = p->g_FastPos[pos >> i] + (i * 2); } -+/* -+#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ -+ p->g_FastPos[pos >> 6] + 12 : \ -+ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } -+*/ -+ -+#define GetPosSlot1(pos) p->g_FastPos[pos] -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } -+ -+#endif -+ -+ -+#define LZMA_NUM_REPS 4 -+ -+typedef unsigned CState; -+ -+typedef struct -+{ -+ UInt32 price; -+ -+ CState state; -+ int prev1IsChar; -+ int prev2; -+ -+ UInt32 posPrev2; -+ UInt32 backPrev2; -+ -+ UInt32 posPrev; -+ UInt32 backPrev; -+ UInt32 backs[LZMA_NUM_REPS]; -+} COptimal; -+ -+#define kNumOpts (1 << 12) -+ -+#define kNumLenToPosStates 4 -+#define kNumPosSlotBits 6 -+#define kDicLogSizeMin 0 -+#define kDicLogSizeMax 32 -+#define kDistTableSizeMax (kDicLogSizeMax * 2) -+ -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+#define kAlignMask (kAlignTableSize - 1) -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) -+ -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#ifdef _LZMA_PROB32 -+#define CLzmaProb UInt32 -+#else -+#define CLzmaProb UInt16 -+#endif -+ -+#define LZMA_PB_MAX 4 -+#define LZMA_LC_MAX 8 -+#define LZMA_LP_MAX 4 -+ -+#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) -+ -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define LZMA_MATCH_LEN_MIN 2 -+#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) -+ -+#define kNumStates 12 -+ -+typedef struct -+{ -+ CLzmaProb choice; -+ CLzmaProb choice2; -+ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; -+ CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; -+ CLzmaProb high[kLenNumHighSymbols]; -+} CLenEnc; -+ -+typedef struct -+{ -+ CLenEnc p; -+ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; -+ UInt32 tableSize; -+ UInt32 counters[LZMA_NUM_PB_STATES_MAX]; -+} CLenPriceEnc; -+ -+typedef struct -+{ -+ UInt32 range; -+ Byte cache; -+ UInt64 low; -+ UInt64 cacheSize; -+ Byte *buf; -+ Byte *bufLim; -+ Byte *bufBase; -+ ISeqOutStream *outStream; -+ UInt64 processed; -+ SRes res; -+} CRangeEnc; -+ -+typedef struct -+{ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+} CSaveState; -+ -+typedef struct -+{ -+ IMatchFinder matchFinder; -+ void *matchFinderObj; -+ -+ #ifndef _7ZIP_ST -+ Bool mtMode; -+ CMatchFinderMt matchFinderMt; -+ #endif -+ -+ CMatchFinder matchFinderBase; -+ -+ #ifndef _7ZIP_ST -+ Byte pad[128]; -+ #endif -+ -+ UInt32 optimumEndIndex; -+ UInt32 optimumCurrentIndex; -+ -+ UInt32 longestMatchLength; -+ UInt32 numPairs; -+ UInt32 numAvail; -+ COptimal opt[kNumOpts]; -+ -+ #ifndef LZMA_LOG_BSR -+ Byte g_FastPos[1 << kNumLogBits]; -+ #endif -+ -+ UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; -+ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; -+ UInt32 numFastBytes; -+ UInt32 additionalOffset; -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+ -+ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; -+ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; -+ UInt32 alignPrices[kAlignTableSize]; -+ UInt32 alignPriceCount; -+ -+ UInt32 distTableSize; -+ -+ unsigned lc, lp, pb; -+ unsigned lpMask, pbMask; -+ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ unsigned lclp; -+ -+ Bool fastMode; -+ -+ CRangeEnc rc; -+ -+ Bool writeEndMark; -+ UInt64 nowPos64; -+ UInt32 matchPriceCount; -+ Bool finished; -+ Bool multiThread; -+ -+ SRes result; -+ UInt32 dictSize; -+ UInt32 matchFinderCycles; -+ -+ int needInit; -+ -+ CSaveState saveState; -+} CLzmaEnc; -+ -+void LzmaEnc_SaveState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CSaveState *dest = &p->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); -+} -+ -+void LzmaEnc_RestoreState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *dest = (CLzmaEnc *)pp; -+ const CSaveState *p = &dest->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); -+} -+ -+SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ -+ if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || -+ props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30)) -+ return SZ_ERROR_PARAM; -+ p->dictSize = props.dictSize; -+ p->matchFinderCycles = props.mc; -+ { -+ unsigned fb = props.fb; -+ if (fb < 5) -+ fb = 5; -+ if (fb > LZMA_MATCH_LEN_MAX) -+ fb = LZMA_MATCH_LEN_MAX; -+ p->numFastBytes = fb; -+ } -+ p->lc = props.lc; -+ p->lp = props.lp; -+ p->pb = props.pb; -+ p->fastMode = (props.algo == 0); -+ p->matchFinderBase.btMode = props.btMode; -+ { -+ UInt32 numHashBytes = 4; -+ if (props.btMode) -+ { -+ if (props.numHashBytes < 2) -+ numHashBytes = 2; -+ else if (props.numHashBytes < 4) -+ numHashBytes = props.numHashBytes; -+ } -+ p->matchFinderBase.numHashBytes = numHashBytes; -+ } -+ -+ p->matchFinderBase.cutValue = props.mc; -+ -+ p->writeEndMark = props.writeEndMark; -+ -+ #ifndef _7ZIP_ST -+ /* -+ if (newMultiThread != _multiThread) -+ { -+ ReleaseMatchFinder(); -+ _multiThread = newMultiThread; -+ } -+ */ -+ p->multiThread = (props.numThreads > 1); -+ #endif -+ -+ return SZ_OK; -+} -+ -+static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; -+static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; -+static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; -+static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; -+ -+#define IsCharState(s) ((s) < 7) -+ -+#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) -+ -+#define kInfinityPrice (1 << 30) -+ -+static void RangeEnc_Construct(CRangeEnc *p) -+{ -+ p->outStream = 0; -+ p->bufBase = 0; -+} -+ -+#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) -+ -+#define RC_BUF_SIZE (1 << 16) -+static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ if (p->bufBase == 0) -+ { -+ p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); -+ if (p->bufBase == 0) -+ return 0; -+ p->bufLim = p->bufBase + RC_BUF_SIZE; -+ } -+ return 1; -+} -+ -+static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->bufBase); -+ p->bufBase = 0; -+} -+ -+static void RangeEnc_Init(CRangeEnc *p) -+{ -+ /* Stream.Init(); */ -+ p->low = 0; -+ p->range = 0xFFFFFFFF; -+ p->cacheSize = 1; -+ p->cache = 0; -+ -+ p->buf = p->bufBase; -+ -+ p->processed = 0; -+ p->res = SZ_OK; -+} -+ -+static void RangeEnc_FlushStream(CRangeEnc *p) -+{ -+ size_t num; -+ if (p->res != SZ_OK) -+ return; -+ num = p->buf - p->bufBase; -+ if (num != p->outStream->Write(p->outStream, p->bufBase, num)) -+ p->res = SZ_ERROR_WRITE; -+ p->processed += num; -+ p->buf = p->bufBase; -+} -+ -+static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) -+{ -+ if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) -+ { -+ Byte temp = p->cache; -+ do -+ { -+ Byte *buf = p->buf; -+ *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); -+ p->buf = buf; -+ if (buf == p->bufLim) -+ RangeEnc_FlushStream(p); -+ temp = 0xFF; -+ } -+ while (--p->cacheSize != 0); -+ p->cache = (Byte)((UInt32)p->low >> 24); -+ } -+ p->cacheSize++; -+ p->low = (UInt32)p->low << 8; -+} -+ -+static void RangeEnc_FlushData(CRangeEnc *p) -+{ -+ int i; -+ for (i = 0; i < 5; i++) -+ RangeEnc_ShiftLow(p); -+} -+ -+static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) -+{ -+ do -+ { -+ p->range >>= 1; -+ p->low += p->range & (0 - ((value >> --numBits) & 1)); -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+ } -+ while (numBits != 0); -+} -+ -+static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) -+{ -+ UInt32 ttt = *prob; -+ UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; -+ if (symbol == 0) -+ { -+ p->range = newBound; -+ ttt += (kBitModelTotal - ttt) >> kNumMoveBits; -+ } -+ else -+ { -+ p->low += newBound; -+ p->range -= newBound; -+ ttt -= ttt >> kNumMoveBits; -+ } -+ *prob = (CLzmaProb)ttt; -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+} -+ -+static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) -+{ -+ symbol |= 0x100; -+ do -+ { -+ RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+} -+ -+static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) -+{ -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+} -+ -+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -+{ -+ UInt32 i; -+ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) -+ { -+ const int kCyclesBits = kNumBitPriceShiftBits; -+ UInt32 w = i; -+ UInt32 bitCount = 0; -+ int j; -+ for (j = 0; j < kCyclesBits; j++) -+ { -+ w = w * w; -+ bitCount <<= 1; -+ while (w >= ((UInt32)1 << 16)) -+ { -+ w >>= 1; -+ bitCount++; -+ } -+ } -+ ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); -+ } -+} -+ -+ -+#define GET_PRICE(prob, symbol) \ -+ p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICEa(prob, symbol) \ -+ ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= 0x100; -+ do -+ { -+ price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+ -+static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0;) -+ { -+ UInt32 bit; -+ i--; -+ bit = (symbol >> i) & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ } -+} -+ -+static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = 0; i < numBitLevels; i++) -+ { -+ UInt32 bit = symbol & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ symbol >>= 1; -+ } -+} -+ -+static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= (1 << numBitLevels); -+ while (symbol != 1) -+ { -+ price += GET_PRICEa(probs[symbol >> 1], symbol & 1); -+ symbol >>= 1; -+ } -+ return price; -+} -+ -+static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0; i--) -+ { -+ UInt32 bit = symbol & 1; -+ symbol >>= 1; -+ price += GET_PRICEa(probs[m], bit); -+ m = (m << 1) | bit; -+ } -+ return price; -+} -+ -+ -+static void LenEnc_Init(CLenEnc *p) -+{ -+ unsigned i; -+ p->choice = p->choice2 = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) -+ p->low[i] = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) -+ p->mid[i] = kProbInitValue; -+ for (i = 0; i < kLenNumHighSymbols; i++) -+ p->high[i] = kProbInitValue; -+} -+ -+static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) -+{ -+ if (symbol < kLenNumLowSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 0); -+ RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 1); -+ if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 0); -+ RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 1); -+ RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); -+ } -+ } -+} -+ -+static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) -+{ -+ UInt32 a0 = GET_PRICE_0a(p->choice); -+ UInt32 a1 = GET_PRICE_1a(p->choice); -+ UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); -+ UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); -+ UInt32 i = 0; -+ for (i = 0; i < kLenNumLowSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); -+ } -+ for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); -+ } -+ for (; i < numSymbols; i++) -+ prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); -+} -+ -+static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) -+{ -+ LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); -+ p->counters[posState] = p->tableSize; -+} -+ -+static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) -+{ -+ UInt32 posState; -+ for (posState = 0; posState < numPosStates; posState++) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) -+{ -+ LenEnc_Encode(&p->p, rc, symbol, posState); -+ if (updatePrice) -+ if (--p->counters[posState] == 0) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+ -+ -+ -+static void MovePos(CLzmaEnc *p, UInt32 num) -+{ -+ #ifdef SHOW_STAT -+ ttt += num; -+ printf("\n MovePos %d", num); -+ #endif -+ if (num != 0) -+ { -+ p->additionalOffset += num; -+ p->matchFinder.Skip(p->matchFinderObj, num); -+ } -+} -+ -+static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) -+{ -+ UInt32 lenRes = 0, numPairs; -+ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); -+ #ifdef SHOW_STAT -+ printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); -+ ttt++; -+ { -+ UInt32 i; -+ for (i = 0; i < numPairs; i += 2) -+ printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); -+ } -+ #endif -+ if (numPairs > 0) -+ { -+ lenRes = p->matches[numPairs - 2]; -+ if (lenRes == p->numFastBytes) -+ { -+ const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ UInt32 distance = p->matches[numPairs - 1] + 1; -+ UInt32 numAvail = p->numAvail; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ { -+ const Byte *pby2 = pby - distance; -+ for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); -+ } -+ } -+ } -+ p->additionalOffset++; -+ *numDistancePairsRes = numPairs; -+ return lenRes; -+} -+ -+ -+#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; -+#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; -+#define IsShortRep(p) ((p)->backPrev == 0) -+ -+static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) -+{ -+ return -+ GET_PRICE_0(p->isRepG0[state]) + -+ GET_PRICE_0(p->isRep0Long[state][posState]); -+} -+ -+static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) -+{ -+ UInt32 price; -+ if (repIndex == 0) -+ { -+ price = GET_PRICE_0(p->isRepG0[state]); -+ price += GET_PRICE_1(p->isRep0Long[state][posState]); -+ } -+ else -+ { -+ price = GET_PRICE_1(p->isRepG0[state]); -+ if (repIndex == 1) -+ price += GET_PRICE_0(p->isRepG1[state]); -+ else -+ { -+ price += GET_PRICE_1(p->isRepG1[state]); -+ price += GET_PRICE(p->isRepG2[state], repIndex - 2); -+ } -+ } -+ return price; -+} -+ -+static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) -+{ -+ return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + -+ GetPureRepPrice(p, repIndex, state, posState); -+} -+ -+static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) -+{ -+ UInt32 posMem = p->opt[cur].posPrev; -+ UInt32 backMem = p->opt[cur].backPrev; -+ p->optimumEndIndex = cur; -+ do -+ { -+ if (p->opt[cur].prev1IsChar) -+ { -+ MakeAsChar(&p->opt[posMem]) -+ p->opt[posMem].posPrev = posMem - 1; -+ if (p->opt[cur].prev2) -+ { -+ p->opt[posMem - 1].prev1IsChar = False; -+ p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; -+ p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; -+ } -+ } -+ { -+ UInt32 posPrev = posMem; -+ UInt32 backCur = backMem; -+ -+ backMem = p->opt[posPrev].backPrev; -+ posMem = p->opt[posPrev].posPrev; -+ -+ p->opt[posPrev].backPrev = backCur; -+ p->opt[posPrev].posPrev = cur; -+ cur = posPrev; -+ } -+ } -+ while (cur != 0); -+ *backRes = p->opt[0].backPrev; -+ p->optimumCurrentIndex = p->opt[0].posPrev; -+ return p->optimumCurrentIndex; -+} -+ -+#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) -+ -+static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; -+ UInt32 matchPrice, repMatchPrice, normalMatchPrice; -+ UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; -+ UInt32 *matches; -+ const Byte *data; -+ Byte curByte, matchByte; -+ if (p->optimumEndIndex != p->optimumCurrentIndex) -+ { -+ const COptimal *opt = &p->opt[p->optimumCurrentIndex]; -+ UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; -+ *backRes = opt->backPrev; -+ p->optimumCurrentIndex = opt->posPrev; -+ return lenRes; -+ } -+ p->optimumCurrentIndex = p->optimumEndIndex = 0; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ if (numAvail < 2) -+ { -+ *backRes = (UInt32)(-1); -+ return 1; -+ } -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ repMaxIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 lenTest; -+ const Byte *data2; -+ reps[i] = p->reps[i]; -+ data2 = data - (reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ { -+ repLens[i] = 0; -+ continue; -+ } -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ repLens[i] = lenTest; -+ if (lenTest > repLens[repMaxIndex]) -+ repMaxIndex = i; -+ } -+ if (repLens[repMaxIndex] >= p->numFastBytes) -+ { -+ UInt32 lenRes; -+ *backRes = repMaxIndex; -+ lenRes = repLens[repMaxIndex]; -+ MovePos(p, lenRes - 1); -+ return lenRes; -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) -+ { -+ *backRes = (UInt32)-1; -+ return 1; -+ } -+ -+ p->opt[0].state = (CState)p->state; -+ -+ posState = (position & p->pbMask); -+ -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + -+ (!IsCharState(p->state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ MakeAsChar(&p->opt[1]); -+ -+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); -+ -+ if (matchByte == curByte) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); -+ if (shortRepPrice < p->opt[1].price) -+ { -+ p->opt[1].price = shortRepPrice; -+ MakeAsShortRep(&p->opt[1]); -+ } -+ } -+ lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); -+ -+ if (lenEnd < 2) -+ { -+ *backRes = p->opt[1].backPrev; -+ return 1; -+ } -+ -+ p->opt[1].posPrev = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ p->opt[0].backs[i] = reps[i]; -+ -+ len = lenEnd; -+ do -+ p->opt[len--].price = kInfinityPrice; -+ while (len >= 2); -+ -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 repLen = repLens[i]; -+ UInt32 price; -+ if (repLen < 2) -+ continue; -+ price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; -+ COptimal *opt = &p->opt[repLen]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = i; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--repLen >= 2); -+ } -+ -+ normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); -+ -+ len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); -+ if (len <= mainLen) -+ { -+ UInt32 offs = 0; -+ while (len > matches[offs]) -+ offs += 2; -+ for (; ; len++) -+ { -+ COptimal *opt; -+ UInt32 distance = matches[offs + 1]; -+ -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(len); -+ if (distance < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][distance]; -+ else -+ { -+ UInt32 slot; -+ GetPosSlot2(distance, slot); -+ curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; -+ } -+ opt = &p->opt[len]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = distance + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ if (len == matches[offs]) -+ { -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ } -+ } -+ } -+ -+ cur = 0; -+ -+ #ifdef SHOW_STAT2 -+ if (position >= 0) -+ { -+ unsigned i; -+ printf("\n pos = %4X", position); -+ for (i = cur; i <= lenEnd; i++) -+ printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); -+ } -+ #endif -+ -+ for (;;) -+ { -+ UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; -+ UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; -+ Bool nextIsChar; -+ Byte curByte, matchByte; -+ const Byte *data; -+ COptimal *curOpt; -+ COptimal *nextOpt; -+ -+ cur++; -+ if (cur == lenEnd) -+ return Backward(p, backRes, cur); -+ -+ newLen = ReadMatchDistances(p, &numPairs); -+ if (newLen >= p->numFastBytes) -+ { -+ p->numPairs = numPairs; -+ p->longestMatchLength = newLen; -+ return Backward(p, backRes, cur); -+ } -+ position++; -+ curOpt = &p->opt[cur]; -+ posPrev = curOpt->posPrev; -+ if (curOpt->prev1IsChar) -+ { -+ posPrev--; -+ if (curOpt->prev2) -+ { -+ state = p->opt[curOpt->posPrev2].state; -+ if (curOpt->backPrev2 < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ state = kLiteralNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ if (posPrev == cur - 1) -+ { -+ if (IsShortRep(curOpt)) -+ state = kShortRepNextStates[state]; -+ else -+ state = kLiteralNextStates[state]; -+ } -+ else -+ { -+ UInt32 pos; -+ const COptimal *prevOpt; -+ if (curOpt->prev1IsChar && curOpt->prev2) -+ { -+ posPrev = curOpt->posPrev2; -+ pos = curOpt->backPrev2; -+ state = kRepNextStates[state]; -+ } -+ else -+ { -+ pos = curOpt->backPrev; -+ if (pos < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ prevOpt = &p->opt[posPrev]; -+ if (pos < LZMA_NUM_REPS) -+ { -+ UInt32 i; -+ reps[0] = prevOpt->backs[pos]; -+ for (i = 1; i <= pos; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ for (; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i]; -+ } -+ else -+ { -+ UInt32 i; -+ reps[0] = (pos - LZMA_NUM_REPS); -+ for (i = 1; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ } -+ } -+ curOpt->state = (CState)state; -+ -+ curOpt->backs[0] = reps[0]; -+ curOpt->backs[1] = reps[1]; -+ curOpt->backs[2] = reps[2]; -+ curOpt->backs[3] = reps[3]; -+ -+ curPrice = curOpt->price; -+ nextIsChar = False; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ posState = (position & p->pbMask); -+ -+ curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ curAnd1Price += -+ (!IsCharState(state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ nextOpt = &p->opt[cur + 1]; -+ -+ if (curAnd1Price < nextOpt->price) -+ { -+ nextOpt->price = curAnd1Price; -+ nextOpt->posPrev = cur; -+ MakeAsChar(nextOpt); -+ nextIsChar = True; -+ } -+ -+ matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); -+ -+ if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); -+ if (shortRepPrice <= nextOpt->price) -+ { -+ nextOpt->price = shortRepPrice; -+ nextOpt->posPrev = cur; -+ MakeAsShortRep(nextOpt); -+ nextIsChar = True; -+ } -+ } -+ numAvailFull = p->numAvail; -+ { -+ UInt32 temp = kNumOpts - 1 - cur; -+ if (temp < numAvailFull) -+ numAvailFull = temp; -+ } -+ -+ if (numAvailFull < 2) -+ continue; -+ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); -+ -+ if (!nextIsChar && matchByte != curByte) /* speed optimization */ -+ { -+ /* try Literal + rep0 */ -+ UInt32 temp; -+ UInt32 lenTest2; -+ const Byte *data2 = data - (reps[0] + 1); -+ UInt32 limit = p->numFastBytes + 1; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ -+ for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); -+ lenTest2 = temp - 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kLiteralNextStates[state]; -+ UInt32 posStateNext = (position + 1) & p->pbMask; -+ UInt32 nextRepMatchPrice = curAnd1Price + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = False; -+ } -+ } -+ } -+ } -+ -+ startLen = 2; /* speed optimization */ -+ { -+ UInt32 repIndex; -+ for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) -+ { -+ UInt32 lenTest; -+ UInt32 lenTestTemp; -+ UInt32 price; -+ const Byte *data2 = data - (reps[repIndex] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ while (lenEnd < cur + lenTest) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ lenTestTemp = lenTest; -+ price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; -+ COptimal *opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = repIndex; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--lenTest >= 2); -+ lenTest = lenTestTemp; -+ -+ if (repIndex == 0) -+ startLen = lenTest + 1; -+ -+ /* if (_maxMode) */ -+ { -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kRepNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = -+ price + p->repLenEnc.prices[posState][lenTest - 2] + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (position + lenTest + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = repIndex; -+ } -+ } -+ } -+ } -+ } -+ } -+ /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ -+ if (newLen > numAvail) -+ { -+ newLen = numAvail; -+ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); -+ matches[numPairs] = newLen; -+ numPairs += 2; -+ } -+ if (newLen >= startLen) -+ { -+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); -+ UInt32 offs, curBack, posSlot; -+ UInt32 lenTest; -+ while (lenEnd < cur + newLen) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ -+ offs = 0; -+ while (startLen > matches[offs]) -+ offs += 2; -+ curBack = matches[offs + 1]; -+ GetPosSlot2(curBack, posSlot); -+ for (lenTest = /*2*/ startLen; ; lenTest++) -+ { -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(lenTest); -+ COptimal *opt; -+ if (curBack < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; -+ else -+ curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; -+ -+ opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = curBack + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ -+ if (/*_maxMode && */lenTest == matches[offs]) -+ { -+ /* Try Match + Literal + Rep0 */ -+ const Byte *data2 = data - (curBack + 1); -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kMatchNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = curAndLenPrice + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (posStateNext + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = curBack + LZMA_NUM_REPS; -+ } -+ } -+ } -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ curBack = matches[offs + 1]; -+ if (curBack >= kNumFullDistances) -+ GetPosSlot2(curBack, posSlot); -+ } -+ } -+ } -+ } -+} -+ -+#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) -+ -+static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; -+ const Byte *data; -+ const UInt32 *matches; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ *backRes = (UInt32)-1; -+ if (numAvail < 2) -+ return 1; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ -+ repLen = repIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (len = 2; len < numAvail && data[len] == data2[len]; len++); -+ if (len >= p->numFastBytes) -+ { -+ *backRes = i; -+ MovePos(p, len - 1); -+ return len; -+ } -+ if (len > repLen) -+ { -+ repIndex = i; -+ repLen = len; -+ } -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ -+ mainDist = 0; /* for GCC */ -+ if (mainLen >= 2) -+ { -+ mainDist = matches[numPairs - 1]; -+ while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) -+ { -+ if (!ChangePair(matches[numPairs - 3], mainDist)) -+ break; -+ numPairs -= 2; -+ mainLen = matches[numPairs - 2]; -+ mainDist = matches[numPairs - 1]; -+ } -+ if (mainLen == 2 && mainDist >= 0x80) -+ mainLen = 1; -+ } -+ -+ if (repLen >= 2 && ( -+ (repLen + 1 >= mainLen) || -+ (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || -+ (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) -+ { -+ *backRes = repIndex; -+ MovePos(p, repLen - 1); -+ return repLen; -+ } -+ -+ if (mainLen < 2 || numAvail <= 2) -+ return 1; -+ -+ p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); -+ if (p->longestMatchLength >= 2) -+ { -+ UInt32 newDistance = matches[p->numPairs - 1]; -+ if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || -+ (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || -+ (p->longestMatchLength > mainLen + 1) || -+ (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) -+ return 1; -+ } -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len, limit; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ limit = mainLen - 1; -+ for (len = 2; len < limit && data[len] == data2[len]; len++); -+ if (len >= limit) -+ return 1; -+ } -+ *backRes = mainDist + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 2); -+ return mainLen; -+} -+ -+static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) -+{ -+ UInt32 len; -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ len = LZMA_MATCH_LEN_MIN; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); -+ RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); -+} -+ -+static SRes CheckErrors(CLzmaEnc *p) -+{ -+ if (p->result != SZ_OK) -+ return p->result; -+ if (p->rc.res != SZ_OK) -+ p->result = SZ_ERROR_WRITE; -+ if (p->matchFinderBase.result != SZ_OK) -+ p->result = SZ_ERROR_READ; -+ if (p->result != SZ_OK) -+ p->finished = True; -+ return p->result; -+} -+ -+static SRes Flush(CLzmaEnc *p, UInt32 nowPos) -+{ -+ /* ReleaseMFStream(); */ -+ p->finished = True; -+ if (p->writeEndMark) -+ WriteEndMarker(p, nowPos & p->pbMask); -+ RangeEnc_FlushData(&p->rc); -+ RangeEnc_FlushStream(&p->rc); -+ return CheckErrors(p); -+} -+ -+static void FillAlignPrices(CLzmaEnc *p) -+{ -+ UInt32 i; -+ for (i = 0; i < kAlignTableSize; i++) -+ p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); -+ p->alignPriceCount = 0; -+} -+ -+static void FillDistancesPrices(CLzmaEnc *p) -+{ -+ UInt32 tempPrices[kNumFullDistances]; -+ UInt32 i, lenToPosState; -+ for (i = kStartPosModelIndex; i < kNumFullDistances; i++) -+ { -+ UInt32 posSlot = GetPosSlot1(i); -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); -+ } -+ -+ for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) -+ { -+ UInt32 posSlot; -+ const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; -+ UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; -+ for (posSlot = 0; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); -+ for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); -+ -+ { -+ UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; -+ UInt32 i; -+ for (i = 0; i < kStartPosModelIndex; i++) -+ distancesPrices[i] = posSlotPrices[i]; -+ for (; i < kNumFullDistances; i++) -+ distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; -+ } -+ } -+ p->matchPriceCount = 0; -+} -+ -+void LzmaEnc_Construct(CLzmaEnc *p) -+{ -+ RangeEnc_Construct(&p->rc); -+ MatchFinder_Construct(&p->matchFinderBase); -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Construct(&p->matchFinderMt); -+ p->matchFinderMt.MatchFinder = &p->matchFinderBase; -+ #endif -+ -+ { -+ CLzmaEncProps props; -+ LzmaEncProps_Init(&props); -+ LzmaEnc_SetProps(p, &props); -+ } -+ -+ #ifndef LZMA_LOG_BSR -+ LzmaEnc_FastPosInit(p->g_FastPos); -+ #endif -+ -+ LzmaEnc_InitPriceTables(p->ProbPrices); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) -+{ -+ void *p; -+ p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); -+ if (p != 0) -+ LzmaEnc_Construct((CLzmaEnc *)p); -+ return p; -+} -+ -+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->litProbs); -+ alloc->Free(alloc, p->saveState.litProbs); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); -+ #endif -+ MatchFinder_Free(&p->matchFinderBase, allocBig); -+ LzmaEnc_FreeLits(p, alloc); -+ RangeEnc_Free(&p->rc, alloc); -+} -+ -+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); -+ alloc->Free(alloc, p); -+} -+ -+static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) -+{ -+ UInt32 nowPos32, startPos32; -+ if (p->needInit) -+ { -+ p->matchFinder.Init(p->matchFinderObj); -+ p->needInit = 0; -+ } -+ -+ if (p->finished) -+ return p->result; -+ RINOK(CheckErrors(p)); -+ -+ nowPos32 = (UInt32)p->nowPos64; -+ startPos32 = nowPos32; -+ -+ if (p->nowPos64 == 0) -+ { -+ UInt32 numPairs; -+ Byte curByte; -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ return Flush(p, nowPos32); -+ ReadMatchDistances(p, &numPairs); -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); -+ p->state = kLiteralNextStates[p->state]; -+ curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); -+ LitEnc_Encode(&p->rc, p->litProbs, curByte); -+ p->additionalOffset--; -+ nowPos32++; -+ } -+ -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) -+ for (;;) -+ { -+ UInt32 pos, len, posState; -+ -+ if (p->fastMode) -+ len = GetOptimumFast(p, &pos); -+ else -+ len = GetOptimum(p, nowPos32, &pos); -+ -+ #ifdef SHOW_STAT2 -+ printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); -+ #endif -+ -+ posState = nowPos32 & p->pbMask; -+ if (len == 1 && pos == (UInt32)-1) -+ { -+ Byte curByte; -+ CLzmaProb *probs; -+ const Byte *data; -+ -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+ curByte = *data; -+ probs = LIT_PROBS(nowPos32, *(data - 1)); -+ if (IsCharState(p->state)) -+ LitEnc_Encode(&p->rc, probs, curByte); -+ else -+ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); -+ p->state = kLiteralNextStates[p->state]; -+ } -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ if (pos < LZMA_NUM_REPS) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); -+ if (pos == 0) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); -+ } -+ else -+ { -+ UInt32 distance = p->reps[pos]; -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); -+ if (pos == 1) -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); -+ if (pos == 3) -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ } -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = distance; -+ } -+ if (len == 1) -+ p->state = kShortRepNextStates[p->state]; -+ else -+ { -+ LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ p->state = kRepNextStates[p->state]; -+ } -+ } -+ else -+ { -+ UInt32 posSlot; -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ pos -= LZMA_NUM_REPS; -+ GetPosSlot(pos, posSlot); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); -+ -+ if (posSlot >= kStartPosModelIndex) -+ { -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ UInt32 posReduced = pos - base; -+ -+ if (posSlot < kEndPosModelIndex) -+ RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); -+ else -+ { -+ RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); -+ p->alignPriceCount++; -+ } -+ } -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = pos; -+ p->matchPriceCount++; -+ } -+ } -+ p->additionalOffset -= len; -+ nowPos32 += len; -+ if (p->additionalOffset == 0) -+ { -+ UInt32 processed; -+ if (!p->fastMode) -+ { -+ if (p->matchPriceCount >= (1 << 7)) -+ FillDistancesPrices(p); -+ if (p->alignPriceCount >= kAlignTableSize) -+ FillAlignPrices(p); -+ } -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ break; -+ processed = nowPos32 - startPos32; -+ if (useLimits) -+ { -+ if (processed + kNumOpts + 300 >= maxUnpackSize || -+ RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) -+ break; -+ } -+ else if (processed >= (1 << 15)) -+ { -+ p->nowPos64 += nowPos32 - startPos32; -+ return CheckErrors(p); -+ } -+ } -+ } -+ p->nowPos64 += nowPos32 - startPos32; -+ return Flush(p, nowPos32); -+} -+ -+#define kBigHashDicLimit ((UInt32)1 << 24) -+ -+static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 beforeSize = kNumOpts; -+ Bool btMode; -+ if (!RangeEnc_Alloc(&p->rc, alloc)) -+ return SZ_ERROR_MEM; -+ btMode = (p->matchFinderBase.btMode != 0); -+ #ifndef _7ZIP_ST -+ p->mtMode = (p->multiThread && !p->fastMode && btMode); -+ #endif -+ -+ { -+ unsigned lclp = p->lc + p->lp; -+ if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ if (p->litProbs == 0 || p->saveState.litProbs == 0) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ p->lclp = lclp; -+ } -+ } -+ -+ p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); -+ -+ if (beforeSize + p->dictSize < keepWindowSize) -+ beforeSize = keepWindowSize - p->dictSize; -+ -+ #ifndef _7ZIP_ST -+ if (p->mtMode) -+ { -+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); -+ p->matchFinderObj = &p->matchFinderMt; -+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); -+ } -+ else -+ #endif -+ { -+ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) -+ return SZ_ERROR_MEM; -+ p->matchFinderObj = &p->matchFinderBase; -+ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); -+ } -+ return SZ_OK; -+} -+ -+void LzmaEnc_Init(CLzmaEnc *p) -+{ -+ UInt32 i; -+ p->state = 0; -+ for (i = 0 ; i < LZMA_NUM_REPS; i++) -+ p->reps[i] = 0; -+ -+ RangeEnc_Init(&p->rc); -+ -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ UInt32 j; -+ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) -+ { -+ p->isMatch[i][j] = kProbInitValue; -+ p->isRep0Long[i][j] = kProbInitValue; -+ } -+ p->isRep[i] = kProbInitValue; -+ p->isRepG0[i] = kProbInitValue; -+ p->isRepG1[i] = kProbInitValue; -+ p->isRepG2[i] = kProbInitValue; -+ } -+ -+ { -+ UInt32 num = 0x300 << (p->lp + p->lc); -+ for (i = 0; i < num; i++) -+ p->litProbs[i] = kProbInitValue; -+ } -+ -+ { -+ for (i = 0; i < kNumLenToPosStates; i++) -+ { -+ CLzmaProb *probs = p->posSlotEncoder[i]; -+ UInt32 j; -+ for (j = 0; j < (1 << kNumPosSlotBits); j++) -+ probs[j] = kProbInitValue; -+ } -+ } -+ { -+ for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) -+ p->posEncoders[i] = kProbInitValue; -+ } -+ -+ LenEnc_Init(&p->lenEnc.p); -+ LenEnc_Init(&p->repLenEnc.p); -+ -+ for (i = 0; i < (1 << kNumAlignBits); i++) -+ p->posAlignEncoder[i] = kProbInitValue; -+ -+ p->optimumEndIndex = 0; -+ p->optimumCurrentIndex = 0; -+ p->additionalOffset = 0; -+ -+ p->pbMask = (1 << p->pb) - 1; -+ p->lpMask = (1 << p->lp) - 1; -+} -+ -+void LzmaEnc_InitPrices(CLzmaEnc *p) -+{ -+ if (!p->fastMode) -+ { -+ FillDistancesPrices(p); -+ FillAlignPrices(p); -+ } -+ -+ p->lenEnc.tableSize = -+ p->repLenEnc.tableSize = -+ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; -+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); -+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); -+} -+ -+static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 i; -+ for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) -+ if (p->dictSize <= ((UInt32)1 << i)) -+ break; -+ p->distTableSize = i * 2; -+ -+ p->finished = False; -+ p->result = SZ_OK; -+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ p->nowPos64 = 0; -+ return SZ_OK; -+} -+ -+static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ p->rc.outStream = outStream; -+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); -+} -+ -+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, -+ ISeqInStream *inStream, UInt32 keepWindowSize, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) -+{ -+ p->matchFinderBase.directInput = 1; -+ p->matchFinderBase.bufferBase = (Byte *)src; -+ p->matchFinderBase.directInputRem = srcLen; -+} -+ -+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, -+ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ p->needInit = 1; -+ -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+void LzmaEnc_Finish(CLzmaEncHandle pp) -+{ -+ #ifndef _7ZIP_ST -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ if (p->mtMode) -+ MatchFinderMt_ReleaseStream(&p->matchFinderMt); -+ #else -+ pp = pp; -+ #endif -+} -+ -+typedef struct -+{ -+ ISeqOutStream funcTable; -+ Byte *data; -+ SizeT rem; -+ Bool overflow; -+} CSeqOutStreamBuf; -+ -+static size_t MyWrite(void *pp, const void *data, size_t size) -+{ -+ CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; -+ if (p->rem < size) -+ { -+ size = p->rem; -+ p->overflow = True; -+ } -+ memcpy(p->data, data, size); -+ p->rem -= size; -+ p->data += size; -+ return size; -+} -+ -+ -+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+} -+ -+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+} -+ -+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, -+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ UInt64 nowPos64; -+ SRes res; -+ CSeqOutStreamBuf outStream; -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = False; -+ p->finished = False; -+ p->result = SZ_OK; -+ -+ if (reInit) -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ nowPos64 = p->nowPos64; -+ RangeEnc_Init(&p->rc); -+ p->rc.outStream = &outStream.funcTable; -+ -+ res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); -+ -+ *unpackSize = (UInt32)(p->nowPos64 - nowPos64); -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ -+ return res; -+} -+ -+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) -+{ -+ SRes res = SZ_OK; -+ -+ #ifndef _7ZIP_ST -+ Byte allocaDummy[0x300]; -+ int i = 0; -+ for (i = 0; i < 16; i++) -+ allocaDummy[i] = (Byte)i; -+ #endif -+ -+ for (;;) -+ { -+ res = LzmaEnc_CodeOneBlock(p, False, 0, 0); -+ if (res != SZ_OK || p->finished != 0) -+ break; -+ if (progress != 0) -+ { -+ res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); -+ if (res != SZ_OK) -+ { -+ res = SZ_ERROR_PROGRESS; -+ break; -+ } -+ } -+ } -+ LzmaEnc_Finish(p); -+ return res; -+} -+ -+SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); -+ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); -+} -+ -+SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ int i; -+ UInt32 dictSize = p->dictSize; -+ if (*size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_PARAM; -+ *size = LZMA_PROPS_SIZE; -+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); -+ -+ for (i = 11; i <= 30; i++) -+ { -+ if (dictSize <= ((UInt32)2 << i)) -+ { -+ dictSize = (2 << i); -+ break; -+ } -+ if (dictSize <= ((UInt32)3 << i)) -+ { -+ dictSize = (3 << i); -+ break; -+ } -+ } -+ -+ for (i = 0; i < 4; i++) -+ props[1 + i] = (Byte)(dictSize >> (8 * i)); -+ return SZ_OK; -+} -+ -+SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ SRes res; -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ -+ CSeqOutStreamBuf outStream; -+ -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = writeEndMark; -+ -+ p->rc.outStream = &outStream.funcTable; -+ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); -+ if (res == SZ_OK) -+ res = LzmaEnc_Encode2(p, progress); -+ -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ return res; -+} -+ -+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); -+ SRes res; -+ if (p == 0) -+ return SZ_ERROR_MEM; -+ -+ res = LzmaEnc_SetProps(p, props); -+ if (res == SZ_OK) -+ { -+ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); -+ if (res == SZ_OK) -+ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, -+ writeEndMark, progress, alloc, allocBig); -+ } -+ -+ LzmaEnc_Destroy(p, alloc, allocBig); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/Makefile -@@ -0,0 +1,7 @@ -+lzma_compress-objs := LzFind.o LzmaEnc.o -+lzma_decompress-objs := LzmaDec.o -+ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma_compress.o -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma_decompress.o -+ -+EXTRA_CFLAGS += -Iinclude/linux -Iinclude/linux/lzma -include types.h diff --git a/target/linux/generic/pending-3.18/531-debloat_lzma.patch b/target/linux/generic/pending-3.18/531-debloat_lzma.patch deleted file mode 100644 index aa3c49801..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/532-jffs2_eofdetect.patch b/target/linux/generic/pending-3.18/532-jffs2_eofdetect.patch deleted file mode 100644 index 8ce53d8be..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/550-ubifs-symlink-xattr-support.patch b/target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch deleted file mode 100644 index 6e08ca302..000000000 --- a/target/linux/generic/pending-3.18/550-ubifs-symlink-xattr-support.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/fs/ubifs/file.c -+++ b/fs/ubifs/file.c -@@ -1597,6 +1597,10 @@ const struct inode_operations ubifs_syml - .follow_link = ubifs_follow_link, - .setattr = ubifs_setattr, - .getattr = ubifs_getattr, -+ .setxattr = ubifs_setxattr, -+ .getxattr = ubifs_getxattr, -+ .listxattr = ubifs_listxattr, -+ .removexattr = ubifs_removexattr, - }; - - const struct file_operations ubifs_file_operations = { ---- a/fs/ubifs/journal.c -+++ b/fs/ubifs/journal.c -@@ -572,6 +572,13 @@ int ubifs_jnl_update(struct ubifs_info * - aligned_dlen = ALIGN(dlen, 8); - aligned_ilen = ALIGN(ilen, 8); - len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ; -+ if (xent) { -+ /* -+ * Make sure to account for host_ui->data_len in -+ * length calculation in case there is extended attribute. -+ */ -+ len += host_ui->data_len; -+ } - dent = kmalloc(len, GFP_NOFS); - if (!dent) - return -ENOMEM; -@@ -648,7 +655,8 @@ int ubifs_jnl_update(struct ubifs_info * - - ino_key_init(c, &ino_key, dir->i_ino); - ino_offs += aligned_ilen; -- err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ); -+ err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, -+ UBIFS_INO_NODE_SZ + host_ui->data_len); - if (err) - goto out_ro; - ---- a/fs/ubifs/xattr.c -+++ b/fs/ubifs/xattr.c -@@ -210,12 +210,12 @@ static int change_xattr(struct ubifs_inf - goto out_free; - } - inode->i_size = ui->ui_size = size; -- ui->data_len = size; - - mutex_lock(&host_ui->ui_mutex); - host->i_ctime = ubifs_current_time(host); - host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len); - host_ui->xattr_size += CALC_XATTR_BYTES(size); -+ ui->data_len = size; - - /* - * It is important to write the host inode after the xattr inode diff --git a/target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch b/target/linux/generic/pending-3.18/551-ubifs-fix-default-compression-selection.patch deleted file mode 100644 index 1b0f30718..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/600-netfilter_conntrack_flush.patch b/target/linux/generic/pending-3.18/600-netfilter_conntrack_flush.patch deleted file mode 100644 index bc6ed3e5d..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -262,10 +263,66 @@ static int ct_open(struct inode *inode, - sizeof(struct ct_iter_state)); - } - -+struct kill_request { -+ u16 family; -+ union nf_inet_addr addr; -+}; -+ -+static int kill_matching(struct nf_conn *i, void *data) -+{ -+ struct kill_request *kr = data; -+ struct nf_conntrack_tuple *t1 = &i->tuplehash[IP_CT_DIR_ORIGINAL].tuple; -+ struct nf_conntrack_tuple *t2 = &i->tuplehash[IP_CT_DIR_REPLY].tuple; -+ -+ if (!kr->family) -+ return 1; -+ -+ if (t1->src.l3num != kr->family) -+ return 0; -+ -+ return (nf_inet_addr_cmp(&kr->addr, &t1->src.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t1->dst.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t2->src.u3) || -+ nf_inet_addr_cmp(&kr->addr, &t2->dst.u3)); -+} -+ -+static ssize_t ct_file_write(struct file *file, const char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ struct seq_file *seq = file->private_data; -+ struct net *net = seq_file_net(seq); -+ struct kill_request kr = { }; -+ char req[INET6_ADDRSTRLEN] = { }; -+ -+ if (count == 0) -+ return 0; -+ -+ if (count >= INET6_ADDRSTRLEN) -+ count = INET6_ADDRSTRLEN - 1; -+ -+ if (copy_from_user(req, buf, count)) -+ return -EFAULT; -+ -+ if (strnchr(req, count, ':')) { -+ kr.family = AF_INET6; -+ if (!in6_pton(req, count, (void *)&kr.addr, '\n', NULL)) -+ return -EINVAL; -+ } else if (strnchr(req, count, '.')) { -+ kr.family = AF_INET; -+ if (!in4_pton(req, count, (void *)&kr.addr, '\n', NULL)) -+ return -EINVAL; -+ } -+ -+ nf_ct_iterate_cleanup(net, kill_matching, &kr, 0, 0); -+ -+ return count; -+} -+ - static const struct file_operations ct_file_ops = { - .owner = THIS_MODULE, - .open = ct_open, - .read = seq_read, -+ .write = ct_file_write, - .llseek = seq_lseek, - .release = seq_release_net, - }; -@@ -367,7 +424,7 @@ static int nf_conntrack_standalone_init_ - { - struct proc_dir_entry *pde; - -- pde = proc_create("nf_conntrack", 0440, net->proc_net, &ct_file_ops); -+ pde = proc_create("nf_conntrack", 0660, net->proc_net, &ct_file_ops); - if (!pde) - goto out_nf_conntrack; - diff --git a/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch deleted file mode 100644 index e5c7a77b4..000000000 --- a/target/linux/generic/pending-3.18/610-netfilter_match_bypass_default_checks.patch +++ /dev/null @@ -1,101 +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) - { -@@ -650,6 +676,8 @@ find_check_entry(struct ipt_entry *e, st - struct xt_mtchk_param mtpar; - struct xt_entry_match *ematch; - -+ ip_checkdefault(&e->ip); -+ - j = 0; - mtpar.net = net; - mtpar.table = name; -@@ -942,6 +970,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)) -@@ -973,6 +1002,14 @@ copy_entries_to_user(unsigned int total_ - goto free_counters; - } - -+ flags = e->ip.flags & IPT_F_MASK; -+ if (copy_to_user(userptr + off -+ + offsetof(struct ipt_entry, ip.flags), -+ &flags, sizeof(flags)) != 0) { -+ ret = -EFAULT; -+ goto free_counters; -+ } -+ - for (i = sizeof(struct ipt_entry); - i < e->target_offset; - i += m->u.match_size) { -@@ -1379,12 +1416,15 @@ compat_copy_entry_to_user(struct ipt_ent - compat_uint_t origsize; - const struct xt_entry_match *ematch; - int ret = 0; -+ u8 flags = e->ip.flags & IPT_F_MASK; - - origsize = *size; - ce = (struct compat_ipt_entry __user *)*dstptr; - if (copy_to_user(ce, e, sizeof(struct ipt_entry)) != 0 || - copy_to_user(&ce->counters, &counters[i], -- sizeof(counters[i])) != 0) -+ sizeof(counters[i])) != 0 || -+ copy_to_user(&ce->ip.flags, &flags, -+ sizeof(flags)) != 0) - return -EFAULT; - - *dstptr += sizeof(struct compat_ipt_entry); diff --git a/target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch b/target/linux/generic/pending-3.18/611-netfilter_match_bypass_default_table.patch deleted file mode 100644 index ef993c864..000000000 --- a/target/linux/generic/pending-3.18/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, -@@ -331,9 +358,33 @@ ipt_do_table(struct sk_buff *skb, - unsigned int addend; - - /* Initialization */ -+ IP_NF_ASSERT(table->valid_hooks & (1 << hook)); -+ local_bh_disable(); -+ private = table->private; -+ cpu = smp_processor_id(); -+ /* -+ * Ensure we load private-> members after we've fetched the base -+ * pointer. -+ */ -+ smp_read_barrier_depends(); -+ table_base = private->entries[cpu]; -+ -+ e = get_entry(table_base, private->hook_entry[hook]); -+ if (ipt_handle_default_rule(e, &verdict)) { -+ ADD_COUNTER(e->counters, skb->len, 1); -+ local_bh_enable(); -+ return verdict; -+ } -+ - ip = ip_hdr(skb); - indev = in ? in->name : nulldevname; - outdev = out ? out->name : nulldevname; -+ -+ addend = xt_write_recseq_begin(); -+ jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; -+ stackptr = per_cpu_ptr(private->stackptr, cpu); -+ origptr = *stackptr; -+ - /* We handle fragments by dealing with the first fragment as - * if it was a normal packet. All other fragments are treated - * normally, except that they will NEVER match rules that ask -@@ -348,23 +399,6 @@ ipt_do_table(struct sk_buff *skb, - acpar.family = NFPROTO_IPV4; - acpar.hooknum = hook; - -- IP_NF_ASSERT(table->valid_hooks & (1 << hook)); -- local_bh_disable(); -- addend = xt_write_recseq_begin(); -- private = table->private; -- cpu = smp_processor_id(); -- /* -- * Ensure we load private-> members after we've fetched the base -- * pointer. -- */ -- smp_read_barrier_depends(); -- table_base = private->entries[cpu]; -- jumpstack = (struct ipt_entry **)private->jumpstack[cpu]; -- stackptr = per_cpu_ptr(private->stackptr, cpu); -- origptr = *stackptr; -- -- e = get_entry(table_base, private->hook_entry[hook]); -- - pr_debug("Entering %s(hook %u); sp at %u (UF %p)\n", - table->name, hook, origptr, - get_entry(table_base, private->underflow[hook])); diff --git a/target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch b/target/linux/generic/pending-3.18/612-netfilter_match_reduce_memory_access.patch deleted file mode 100644 index 72172d8bb..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-3.18/613-netfilter_optional_tcp_window_check.patch deleted file mode 100644 index 1d3b37cc1..000000000 --- a/target/linux/generic/pending-3.18/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. - */ -@@ -1452,6 +1458,13 @@ static struct ctl_table tcp_sysctl_table - .mode = 0644, - .proc_handler = proc_dointvec, - }, -+ { -+ .procname = "nf_conntrack_tcp_no_window_check", -+ .data = &nf_ct_tcp_no_window_check, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = proc_dointvec, -+ }, - { } - }; - diff --git a/target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch b/target/linux/generic/pending-3.18/616-net_optimize_xfrm_calls.patch deleted file mode 100644 index 2a64d5420..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/621-sched_act_connmark.patch b/target/linux/generic/pending-3.18/621-sched_act_connmark.patch deleted file mode 100644 index 72d8e5343..000000000 --- a/target/linux/generic/pending-3.18/621-sched_act_connmark.patch +++ /dev/null @@ -1,161 +0,0 @@ ---- /dev/null -+++ b/net/sched/act_connmark.c -@@ -0,0 +1,126 @@ -+/* -+ * Copyright (c) 2011 Felix Fietkau -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms and conditions of the GNU General Public License, -+ * version 2, as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * You should have received a copy of the GNU General Public License along with -+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple -+ * Place - Suite 330, Boston, MA 02111-1307 USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#define TCA_ACT_CONNMARK 20 -+ -+#define CONNMARK_TAB_MASK 3 -+ -+static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a, -+ struct tcf_result *res) -+{ -+ struct nf_conn *c; -+ enum ip_conntrack_info ctinfo; -+ int proto; -+ int r; -+ -+ if (skb->protocol == htons(ETH_P_IP)) { -+ if (skb->len < sizeof(struct iphdr)) -+ goto out; -+ proto = PF_INET; -+ } else if (skb->protocol == htons(ETH_P_IPV6)) { -+ if (skb->len < sizeof(struct ipv6hdr)) -+ goto out; -+ proto = PF_INET6; -+ } else -+ goto out; -+ -+ r = nf_conntrack_in(dev_net(skb->dev), proto, NF_INET_PRE_ROUTING, skb); -+ if (r != NF_ACCEPT) -+ goto out; -+ -+ c = nf_ct_get(skb, &ctinfo); -+ if (!c) -+ goto out; -+ -+ skb->mark = c->mark; -+ nf_conntrack_put(skb->nfct); -+ skb->nfct = NULL; -+ -+out: -+ return TC_ACT_PIPE; -+} -+ -+static int tcf_connmark_init(struct net *net, struct nlattr *nla, -+ struct nlattr *est, struct tc_action *a, -+ int ovr, int bind) -+{ -+ int ret = 0; -+ -+ if (!tcf_hash_check(0, a, bind)) { -+ ret = tcf_hash_create(0, est, a, sizeof(struct tcf_common), bind); -+ if (ret) -+ return ret; -+ -+ tcf_hash_insert(a); -+ ret = ACT_P_CREATED; -+ } else { -+ if (!ovr) { -+ tcf_hash_release(a, bind); -+ return -EEXIST; -+ } -+ } -+ -+ return ret; -+} -+ -+static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a, -+ int bind, int ref) -+{ -+ return skb->len; -+} -+ -+static struct tc_action_ops act_connmark_ops = { -+ .kind = "connmark", -+ .type = TCA_ACT_CONNMARK, -+ .owner = THIS_MODULE, -+ .act = tcf_connmark, -+ .dump = tcf_connmark_dump, -+ .init = tcf_connmark_init, -+}; -+ -+MODULE_AUTHOR("Felix Fietkau "); -+MODULE_DESCRIPTION("Connection tracking mark restoring"); -+MODULE_LICENSE("GPL"); -+ -+static int __init connmark_init_module(void) -+{ -+ -+ return tcf_register_action(&act_connmark_ops, CONNMARK_TAB_MASK); -+} -+ -+static void __exit connmark_cleanup_module(void) -+{ -+ tcf_unregister_action(&act_connmark_ops); -+} -+ -+module_init(connmark_init_module); -+module_exit(connmark_cleanup_module); ---- a/net/sched/Kconfig -+++ b/net/sched/Kconfig -@@ -686,6 +686,19 @@ config NET_ACT_CSUM - To compile this code as a module, choose M here: the - module will be called act_csum. - -+config NET_ACT_CONNMARK -+ tristate "Connection Tracking Marking" -+ depends on NET_CLS_ACT -+ depends on NF_CONNTRACK -+ depends on NF_CONNTRACK_MARK -+ ---help--- -+ Say Y here to restore the connmark from a scheduler action -+ -+ If unsure, say N. -+ -+ To compile this code as a module, choose M here: the -+ module will be called act_connmark. -+ - config NET_CLS_IND - bool "Incoming device classification" - depends on NET_CLS_U32 || NET_CLS_FW ---- a/net/sched/Makefile -+++ b/net/sched/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_NET_ACT_PEDIT) += act_pedit - obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o - obj-$(CONFIG_NET_ACT_SKBEDIT) += act_skbedit.o - obj-$(CONFIG_NET_ACT_CSUM) += act_csum.o -+obj-$(CONFIG_NET_ACT_CONNMARK) += act_connmark.o - obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o - obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o - obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o diff --git a/target/linux/generic/pending-3.18/630-packet_socket_type.patch b/target/linux/generic/pending-3.18/630-packet_socket_type.patch deleted file mode 100644 index ec7383e11..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -1529,6 +1529,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 -@@ -1536,6 +1537,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 -@@ -1548,7 +1550,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))) -@@ -1747,12 +1749,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; - -@@ -1872,12 +1874,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; - -@@ -2831,6 +2833,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; -@@ -3425,6 +3428,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; - } -@@ -3476,6 +3489,13 @@ static int packet_getsockopt(struct sock - case PACKET_VNET_HDR: - val = po->has_vnet_hdr; - break; -+ case PACKET_RECV_TYPE: -+ if (len > sizeof(unsigned int)) -+ len = sizeof(unsigned int); -+ val = po->pkt_type; -+ -+ data = &val; -+ break; - case PACKET_VERSION: - val = po->tp_version; - break; ---- a/net/packet/internal.h -+++ b/net/packet/internal.h -@@ -117,6 +117,7 @@ struct packet_sock { - struct net_device __rcu *cached_dev; - int (*xmit)(struct sk_buff *skb); - struct packet_type prot_hook ____cacheline_aligned_in_smp; -+ unsigned int pkt_type; - }; - - static struct packet_sock *pkt_sk(struct sock *sk) diff --git a/target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch b/target/linux/generic/pending-3.18/640-bridge_no_eap_forward.patch deleted file mode 100644 index 35802d63d..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -97,7 +97,11 @@ int br_handle_frame_finish(struct sk_buf - - dst = NULL; - -- if (is_broadcast_ether_addr(dest)) { -+ if (skb->protocol == htons(ETH_P_PAE)) { -+ skb2 = skb; -+ /* Do not forward 802.1x/EAP frames */ -+ skb = NULL; -+ } else if (is_broadcast_ether_addr(dest)) { - skb2 = skb; - unicast = false; - } else if (is_multicast_ether_addr(dest)) { diff --git a/target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch b/target/linux/generic/pending-3.18/641-bridge_always_accept_eap.patch deleted file mode 100644 index a822fb0dc..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -84,7 +84,7 @@ int br_handle_frame_finish(struct sk_buf - br_multicast_rcv(br, p, skb, vid)) - goto drop; - -- if (p->state == BR_STATE_LEARNING) -+ if ((p->state == BR_STATE_LEARNING) && skb->protocol != htons(ETH_P_PAE)) - goto drop; - - BR_INPUT_SKB_CB(skb)->brdev = br->dev; diff --git a/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch b/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch deleted file mode 100644 index d231f881b..000000000 --- a/target/linux/generic/pending-3.18/642-bridge_port_isolate.patch +++ /dev/null @@ -1,107 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] bridge: port isolate - -Isolating individual bridge ports ---- ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -172,6 +172,7 @@ struct net_bridge_port - #define BR_FLOOD 0x00000040 - #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING) - #define BR_PROMISC 0x00000080 -+#define BR_ISOLATE_MODE 0x00000100 - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - struct bridge_mcast_own_query ip4_own_query; ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -171,6 +171,22 @@ BRPORT_ATTR_FLAG(root_block, BR_ROOT_BLO - BRPORT_ATTR_FLAG(learning, BR_LEARNING); - BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD); - -+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) - { -@@ -213,6 +229,7 @@ static const struct brport_attribute *br - &brport_attr_multicast_router, - &brport_attr_multicast_fast_leave, - #endif -+ &brport_attr_isolate_mode, - NULL - }; - ---- a/net/bridge/br_input.c -+++ b/net/bridge/br_input.c -@@ -120,8 +120,8 @@ int br_handle_frame_finish(struct sk_buf - - unicast = false; - br->dev->stats.multicast++; -- } else if ((dst = __br_fdb_get(br, dest, vid)) && -- dst->is_local) { -+ } else if ((p->flags & BR_ISOLATE_MODE) || -+ ((dst = __br_fdb_get(br, dest, vid)) && dst->is_local)) { - skb2 = skb; - /* Do not forward the packet since it's local. */ - skb = NULL; ---- a/net/bridge/br_forward.c -+++ b/net/bridge/br_forward.c -@@ -117,7 +117,7 @@ EXPORT_SYMBOL_GPL(br_deliver); - /* called with rcu_read_lock */ - void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, struct sk_buff *skb0) - { -- if (should_deliver(to, skb)) { -+ if (should_deliver(to, skb) && !(to->flags & BR_ISOLATE_MODE)) { - if (skb0) - deliver_clone(to, skb, __br_forward); - else -@@ -173,7 +173,7 @@ static void br_flood(struct net_bridge * - struct sk_buff *skb0, - void (*__packet_hook)(const struct net_bridge_port *p, - struct sk_buff *skb), -- bool unicast) -+ bool unicast, bool forward) - { - struct net_bridge_port *p; - struct net_bridge_port *prev; -@@ -181,6 +181,8 @@ static void br_flood(struct net_bridge * - prev = NULL; - - list_for_each_entry_rcu(p, &br->port_list, list) { -+ if (forward && (p->flags & BR_ISOLATE_MODE)) -+ continue; - /* Do not flood unicast traffic to ports that turn it off */ - if (unicast && !(p->flags & BR_FLOOD)) - continue; -@@ -207,14 +209,14 @@ out: - /* called with rcu_read_lock */ - void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb, bool unicast) - { -- br_flood(br, skb, NULL, __br_deliver, unicast); -+ br_flood(br, skb, NULL, __br_deliver, unicast, false); - } - - /* called under bridge lock */ - void br_flood_forward(struct net_bridge *br, struct sk_buff *skb, - struct sk_buff *skb2, bool unicast) - { -- br_flood(br, skb, skb2, __br_forward, unicast); -+ br_flood(br, skb, skb2, __br_forward, unicast, true); - } - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING diff --git a/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch b/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch deleted file mode 100644 index 1226770a3..000000000 --- a/target/linux/generic/pending-3.18/645-bridge_multicast_to_unicast.patch +++ /dev/null @@ -1,390 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] bridge: multicast to unicast - -Implement optinal multicast->unicast conversion for igmp snooping ---- ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -635,7 +635,8 @@ struct net_bridge_port_group *br_multica - struct net_bridge_port *port, - struct br_ip *group, - struct net_bridge_port_group __rcu *next, -- unsigned char state) -+ unsigned char state, -+ const unsigned char *src) - { - struct net_bridge_port_group *p; - -@@ -650,12 +651,33 @@ struct net_bridge_port_group *br_multica - hlist_add_head(&p->mglist, &port->mglist); - setup_timer(&p->timer, br_multicast_port_group_expired, - (unsigned long)p); -+ if ((port->flags & BR_MULTICAST_TO_UCAST) && src) { -+ memcpy(p->eth_addr, src, ETH_ALEN); -+ p->unicast = true; -+ } - return p; - } - -+static bool br_port_group_equal(struct net_bridge_port_group *p, -+ struct net_bridge_port *port, -+ const unsigned char *src) -+{ -+ if (p->port != port) -+ return false; -+ -+ if (!p->unicast) -+ return true; -+ -+ if (!src) -+ return false; -+ -+ return ether_addr_equal(src, p->eth_addr); -+} -+ - static int br_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, -- struct br_ip *group) -+ struct br_ip *group, -+ const unsigned char *src) - { - struct net_bridge_mdb_entry *mp; - struct net_bridge_port_group *p; -@@ -682,13 +704,13 @@ static int br_multicast_add_group(struct - for (pp = &mp->ports; - (p = mlock_dereference(*pp, br)) != NULL; - pp = &p->next) { -- if (p->port == port) -+ if (br_port_group_equal(p, port, src)) - goto found; - if ((unsigned long)p->port < (unsigned long)port) - break; - } - -- p = br_multicast_new_port_group(port, group, *pp, MDB_TEMPORARY); -+ p = br_multicast_new_port_group(port, group, *pp, MDB_TEMPORARY, src); - if (unlikely(!p)) - goto err; - rcu_assign_pointer(*pp, p); -@@ -707,7 +729,7 @@ err: - static int br_ip4_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, - __be32 group, -- __u16 vid) -+ __u16 vid, const unsigned char *src) - { - struct br_ip br_group; - -@@ -718,14 +740,14 @@ static int br_ip4_multicast_add_group(st - br_group.proto = htons(ETH_P_IP); - br_group.vid = vid; - -- return br_multicast_add_group(br, port, &br_group); -+ return br_multicast_add_group(br, port, &br_group, src); - } - - #if IS_ENABLED(CONFIG_IPV6) - static int br_ip6_multicast_add_group(struct net_bridge *br, - struct net_bridge_port *port, - const struct in6_addr *group, -- __u16 vid) -+ __u16 vid, const unsigned char *src) - { - struct br_ip br_group; - -@@ -736,7 +758,7 @@ static int br_ip6_multicast_add_group(st - br_group.proto = htons(ETH_P_IPV6); - br_group.vid = vid; - -- return br_multicast_add_group(br, port, &br_group); -+ return br_multicast_add_group(br, port, &br_group, src); - } - #endif - -@@ -965,6 +987,7 @@ static int br_ip4_multicast_igmp3_report - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct igmpv3_report *ih; - struct igmpv3_grec *grec; - int i; -@@ -1008,7 +1031,8 @@ static int br_ip4_multicast_igmp3_report - continue; - } - -- err = br_ip4_multicast_add_group(br, port, group, vid); -+ src = eth_hdr(skb)->h_source; -+ err = br_ip4_multicast_add_group(br, port, group, vid, src); - if (err) - break; - } -@@ -1022,6 +1046,7 @@ static int br_ip6_multicast_mld2_report( - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct icmp6hdr *icmp6h; - struct mld2_grec *grec; - int i; -@@ -1069,8 +1094,9 @@ static int br_ip6_multicast_mld2_report( - continue; - } - -+ src = eth_hdr(skb)->h_source; - err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, -- vid); -+ vid, src); - if (err) - break; - } -@@ -1406,7 +1432,8 @@ br_multicast_leave_group(struct net_brid - struct net_bridge_port *port, - struct br_ip *group, - struct bridge_mcast_other_query *other_query, -- struct bridge_mcast_own_query *own_query) -+ struct bridge_mcast_own_query *own_query, -+ const unsigned char *src) - { - struct net_bridge_mdb_htable *mdb; - struct net_bridge_mdb_entry *mp; -@@ -1456,7 +1483,7 @@ br_multicast_leave_group(struct net_brid - for (pp = &mp->ports; - (p = mlock_dereference(*pp, br)) != NULL; - pp = &p->next) { -- if (p->port != port) -+ if (!br_port_group_equal(p, port, src)) - continue; - - rcu_assign_pointer(*pp, p->next); -@@ -1490,7 +1517,7 @@ br_multicast_leave_group(struct net_brid - for (p = mlock_dereference(mp->ports, br); - p != NULL; - p = mlock_dereference(p->next, br)) { -- if (p->port != port) -+ if (!br_port_group_equal(p, port, src)) - continue; - - if (!hlist_unhashed(&p->mglist) && -@@ -1508,8 +1535,8 @@ out: - - static void br_ip4_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, -- __be32 group, -- __u16 vid) -+ __be32 group, __u16 vid, -+ const unsigned char *src) - { - struct br_ip br_group; - struct bridge_mcast_own_query *own_query; -@@ -1524,14 +1551,14 @@ static void br_ip4_multicast_leave_group - br_group.vid = vid; - - br_multicast_leave_group(br, port, &br_group, &br->ip4_other_query, -- own_query); -+ own_query, src); - } - - #if IS_ENABLED(CONFIG_IPV6) - static void br_ip6_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, - const struct in6_addr *group, -- __u16 vid) -+ __u16 vid, const unsigned char *src) - { - struct br_ip br_group; - struct bridge_mcast_own_query *own_query; -@@ -1546,7 +1573,7 @@ static void br_ip6_multicast_leave_group - br_group.vid = vid; - - br_multicast_leave_group(br, port, &br_group, &br->ip6_other_query, -- own_query); -+ own_query, src); - } - #endif - -@@ -1555,6 +1582,7 @@ static int br_multicast_ipv4_rcv(struct - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct sk_buff *skb2 = skb; - const struct iphdr *iph; - struct igmphdr *ih; -@@ -1628,7 +1656,8 @@ static int br_multicast_ipv4_rcv(struct - case IGMP_HOST_MEMBERSHIP_REPORT: - case IGMPV2_HOST_MEMBERSHIP_REPORT: - BR_INPUT_SKB_CB(skb)->mrouters_only = 1; -- err = br_ip4_multicast_add_group(br, port, ih->group, vid); -+ src = eth_hdr(skb)->h_source; -+ err = br_ip4_multicast_add_group(br, port, ih->group, vid, src); - break; - case IGMPV3_HOST_MEMBERSHIP_REPORT: - err = br_ip4_multicast_igmp3_report(br, port, skb2, vid); -@@ -1637,7 +1666,8 @@ static int br_multicast_ipv4_rcv(struct - err = br_ip4_multicast_query(br, port, skb2, vid); - break; - case IGMP_HOST_LEAVE_MESSAGE: -- br_ip4_multicast_leave_group(br, port, ih->group, vid); -+ src = eth_hdr(skb)->h_source; -+ br_ip4_multicast_leave_group(br, port, ih->group, vid, src); - break; - } - -@@ -1655,6 +1685,7 @@ static int br_multicast_ipv6_rcv(struct - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct sk_buff *skb2; - const struct ipv6hdr *ip6h; - u8 icmp6_type; -@@ -1764,7 +1795,9 @@ static int br_multicast_ipv6_rcv(struct - } - mld = (struct mld_msg *)skb_transport_header(skb2); - BR_INPUT_SKB_CB(skb)->mrouters_only = 1; -- err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid); -+ src = eth_hdr(skb)->h_source; -+ err = br_ip6_multicast_add_group(br, port, &mld->mld_mca, vid, -+ src); - break; - } - case ICMPV6_MLD2_REPORT: -@@ -1781,7 +1814,8 @@ static int br_multicast_ipv6_rcv(struct - goto out; - } - mld = (struct mld_msg *)skb_transport_header(skb2); -- br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid); -+ src = eth_hdr(skb)->h_source; -+ br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid, src); - } - } - ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -112,6 +112,9 @@ struct net_bridge_port_group { - struct timer_list timer; - struct br_ip addr; - unsigned char state; -+ -+ unsigned char eth_addr[ETH_ALEN]; -+ bool unicast; - }; - - struct net_bridge_mdb_entry -@@ -173,6 +176,7 @@ struct net_bridge_port - #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING) - #define BR_PROMISC 0x00000080 - #define BR_ISOLATE_MODE 0x00000100 -+#define BR_MULTICAST_TO_UCAST 0x00000200 - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING - struct bridge_mcast_own_query ip4_own_query; -@@ -485,7 +489,8 @@ void br_multicast_free_pg(struct rcu_hea - struct net_bridge_port_group * - br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, - struct net_bridge_port_group __rcu *next, -- unsigned char state); -+ unsigned char state, -+ const unsigned char *src); - void br_mdb_init(void); - void br_mdb_uninit(void); - void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, ---- a/net/bridge/br_mdb.c -+++ b/net/bridge/br_mdb.c -@@ -342,7 +342,7 @@ static int br_mdb_add_group(struct net_b - break; - } - -- p = br_multicast_new_port_group(port, group, *pp, state); -+ p = br_multicast_new_port_group(port, group, *pp, state, NULL); - if (unlikely(!p)) - return -ENOMEM; - rcu_assign_pointer(*pp, p); ---- a/net/bridge/br_forward.c -+++ b/net/bridge/br_forward.c -@@ -168,6 +168,34 @@ out: - return p; - } - -+static struct net_bridge_port *maybe_deliver_addr( -+ struct net_bridge_port *prev, struct net_bridge_port *p, -+ struct sk_buff *skb, const unsigned char *addr, -+ void (*__packet_hook)(const struct net_bridge_port *p, -+ struct sk_buff *skb)) -+{ -+ struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev; -+ const unsigned char *src = eth_hdr(skb)->h_source; -+ -+ if (!should_deliver(p, skb)) -+ return prev; -+ -+ /* Even with hairpin, no soliloquies - prevent breaking IPv6 DAD */ -+ if (skb->dev == p->dev && ether_addr_equal(src, addr)) -+ return prev; -+ -+ skb = skb_copy(skb, GFP_ATOMIC); -+ if (!skb) { -+ dev->stats.tx_dropped++; -+ return prev; -+ } -+ -+ memcpy(eth_hdr(skb)->h_dest, addr, ETH_ALEN); -+ __packet_hook(p, skb); -+ -+ return prev; -+} -+ - /* called under bridge lock */ - static void br_flood(struct net_bridge *br, struct sk_buff *skb, - struct sk_buff *skb0, -@@ -232,6 +260,7 @@ static void br_multicast_flood(struct ne - struct net_bridge_port *prev = NULL; - struct net_bridge_port_group *p; - struct hlist_node *rp; -+ const unsigned char *addr; - - rp = rcu_dereference(hlist_first_rcu(&br->router_list)); - p = mdst ? rcu_dereference(mdst->ports) : NULL; -@@ -242,10 +271,19 @@ static void br_multicast_flood(struct ne - rport = rp ? hlist_entry(rp, struct net_bridge_port, rlist) : - NULL; - -- port = (unsigned long)lport > (unsigned long)rport ? -- lport : rport; -- -- prev = maybe_deliver(prev, port, skb, __packet_hook); -+ if ((unsigned long)lport > (unsigned long)rport) { -+ port = lport; -+ addr = p->unicast ? p->eth_addr : NULL; -+ } else { -+ port = rport; -+ addr = NULL; -+ } -+ -+ if (addr) -+ prev = maybe_deliver_addr(prev, port, skb, addr, -+ __packet_hook); -+ else -+ prev = maybe_deliver(prev, port, skb, __packet_hook); - if (IS_ERR(prev)) - goto out; - ---- a/net/bridge/br_sysfs_if.c -+++ b/net/bridge/br_sysfs_if.c -@@ -202,6 +202,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[] = { -@@ -228,6 +229,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_isolate_mode, - NULL diff --git a/target/linux/generic/pending-3.18/650-pppoe_header_pad.patch b/target/linux/generic/pending-3.18/650-pppoe_header_pad.patch deleted file mode 100644 index eb9b4bfd1..000000000 --- a/target/linux/generic/pending-3.18/650-pppoe_header_pad.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -859,7 +859,7 @@ static int pppoe_sendmsg(struct kiocb *i - 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; -@@ -867,7 +867,7 @@ static int pppoe_sendmsg(struct kiocb *i - } - - /* 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/pending-3.18/651-wireless_mesh_header.patch b/target/linux/generic/pending-3.18/651-wireless_mesh_header.patch deleted file mode 100644 index 16da5cd66..000000000 --- a/target/linux/generic/pending-3.18/651-wireless_mesh_header.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -130,7 +130,7 @@ static inline bool dev_xmit_complete(int - */ - - #if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) --# if defined(CONFIG_MAC80211_MESH) -+# if 1 || defined(CONFIG_MAC80211_MESH) - # define LL_MAX_HEADER 128 - # else - # define LL_MAX_HEADER 96 diff --git a/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch b/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch deleted file mode 100644 index fe62110f0..000000000 --- a/target/linux/generic/pending-3.18/653-disable_netlink_trim.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -1107,23 +1107,7 @@ void netlink_detachskb(struct sock *sk, - - static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation) - { -- int delta; -- - WARN_ON(skb->sk != NULL); -- delta = skb->end - skb->tail; -- if (is_vmalloc_addr(skb->head) || delta * 2 < skb->truesize) -- return skb; -- -- if (skb_shared(skb)) { -- struct sk_buff *nskb = skb_clone(skb, allocation); -- if (!nskb) -- return skb; -- consume_skb(skb); -- skb = nskb; -- } -- -- if (!pskb_expand_head(skb, 0, -delta, allocation)) -- skb->truesize -= delta; - - return skb; - } diff --git a/target/linux/generic/pending-3.18/655-increase_skb_pad.patch b/target/linux/generic/pending-3.18/655-increase_skb_pad.patch deleted file mode 100644 index 96f81e9aa..000000000 --- a/target/linux/generic/pending-3.18/655-increase_skb_pad.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2024,7 +2024,7 @@ static inline int pskb_network_may_pull( - * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) - */ - #ifndef NET_SKB_PAD --#define NET_SKB_PAD max(32, L1_CACHE_BYTES) -+#define NET_SKB_PAD max(64, L1_CACHE_BYTES) - #endif - - int ___pskb_trim(struct sk_buff *skb, unsigned int len); diff --git a/target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch b/target/linux/generic/pending-3.18/656-skb_reduce_truesize-helper.patch deleted file mode 100644 index 0fde9f6e6..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -2069,6 +2069,24 @@ static inline void pskb_trim_unique(stru - BUG_ON(err); - } - -+/* -+ * Caller wants to reduce memory needs before queueing skb -+ * The (expensive) copy should not be be done in fast path. -+ */ -+static inline struct sk_buff *skb_reduce_truesize(struct sk_buff *skb) -+{ -+ if (skb->truesize > 2 * SKB_TRUESIZE(skb->len)) { -+ struct sk_buff *nskb; -+ nskb = skb_copy_expand(skb, skb_headroom(skb), 0, -+ GFP_ATOMIC | __GFP_NOWARN); -+ if (nskb) { -+ __kfree_skb(skb); -+ skb = nskb; -+ } -+ } -+ return skb; -+} -+ - /** - * skb_orphan - orphan a buffer - * @skb: buffer to orphan diff --git a/target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch b/target/linux/generic/pending-3.18/657-qdisc_reduce_truesize.patch deleted file mode 100644 index 410e0b763..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/660-fq_codel_defaults.patch b/target/linux/generic/pending-3.18/660-fq_codel_defaults.patch deleted file mode 100644 index 8a870cccc..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/661-fq_codel_keep_dropped_stats.patch b/target/linux/generic/pending-3.18/661-fq_codel_keep_dropped_stats.patch deleted file mode 100644 index 45a8d6836..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/662-use_fq_codel_by_default.patch b/target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch deleted file mode 100644 index 39abfaabe..000000000 --- a/target/linux/generic/pending-3.18/662-use_fq_codel_by_default.patch +++ /dev/null @@ -1,95 +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 -@@ -341,6 +341,7 @@ extern struct Qdisc noop_qdisc; - extern struct Qdisc_ops noop_qdisc_ops; - extern struct Qdisc_ops pfifo_fast_ops; - extern struct Qdisc_ops mq_qdisc_ops; -+extern struct Qdisc_ops fq_codel_qdisc_ops; - extern const struct Qdisc_ops *default_qdisc_ops; - - struct Qdisc_class_common { ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -31,7 +31,7 @@ - #include - - /* Qdisc to use by default */ --const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops; -+const struct Qdisc_ops *default_qdisc_ops = &fq_codel_qdisc_ops; - EXPORT_SYMBOL(default_qdisc_ops); - - /* Main transmission queue. */ -@@ -742,7 +742,7 @@ static void attach_one_default_qdisc(str - - if (dev->tx_queue_len) { - qdisc = qdisc_create_dflt(dev_queue, -- default_qdisc_ops, TC_H_ROOT); -+ &fq_codel_qdisc_ops, TC_H_ROOT); - if (!qdisc) { - netdev_info(dev, "activation failed\n"); - return; ---- a/net/sched/sch_mq.c -+++ b/net/sched/sch_mq.c -@@ -57,7 +57,7 @@ static int mq_init(struct Qdisc *sch, st - - for (ntx = 0; ntx < dev->num_tx_queues; ntx++) { - dev_queue = netdev_get_tx_queue(dev, ntx); -- qdisc = qdisc_create_dflt(dev_queue, default_qdisc_ops, -+ qdisc = qdisc_create_dflt(dev_queue, &fq_codel_qdisc_ops, - TC_H_MAKE(TC_H_MAJ(sch->handle), - TC_H_MIN(ntx + 1))); - if (qdisc == NULL) ---- a/net/sched/sch_mqprio.c -+++ b/net/sched/sch_mqprio.c -@@ -124,7 +124,7 @@ static int mqprio_init(struct Qdisc *sch - - for (i = 0; i < dev->num_tx_queues; i++) { - dev_queue = netdev_get_tx_queue(dev, i); -- qdisc = qdisc_create_dflt(dev_queue, default_qdisc_ops, -+ qdisc = qdisc_create_dflt(dev_queue, &fq_codel_qdisc_ops, - TC_H_MAKE(TC_H_MAJ(sch->handle), - TC_H_MIN(i + 1))); - if (qdisc == NULL) { ---- a/net/sched/sch_api.c -+++ b/net/sched/sch_api.c -@@ -1949,7 +1949,7 @@ static int __init pktsched_init(void) - return err; - } - -- register_qdisc(&pfifo_fast_ops); -+ register_qdisc(&fq_codel_qdisc_ops); - register_qdisc(&pfifo_qdisc_ops); - register_qdisc(&bfifo_qdisc_ops); - register_qdisc(&pfifo_head_drop_qdisc_ops); diff --git a/target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch b/target/linux/generic/pending-3.18/663-remove_pfifo_fast.patch deleted file mode 100644 index 50b90b375..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch deleted file mode 100644 index 43bdbe456..000000000 --- a/target/linux/generic/pending-3.18/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ /dev/null @@ -1,481 +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 -@@ -77,11 +79,9 @@ static bool log_ecn_error = true; - module_param(log_ecn_error, bool, 0644); - MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); - --static u32 HASH(const struct in6_addr *addr1, const struct in6_addr *addr2) -+static u32 HASH(const struct in6_addr *addr) - { -- u32 hash = ipv6_addr_hash(addr1) ^ ipv6_addr_hash(addr2); -- -- return hash_32(hash, HASH_SIZE_SHIFT); -+ return hash_32(ipv6_addr_hash(addr), HASH_SIZE_SHIFT); - } - - static int ip6_tnl_dev_init(struct net_device *dev); -@@ -180,15 +180,24 @@ EXPORT_SYMBOL_GPL(ip6_tnl_dst_store); - static struct ip6_tnl * - ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local) - { -- unsigned int hash = HASH(remote, local); -+ unsigned int hash = HASH(local); - struct ip6_tnl *t; - struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); -+ struct __ip6_tnl_fmr *fmr; - - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { -- if (ipv6_addr_equal(local, &t->parms.laddr) && -- ipv6_addr_equal(remote, &t->parms.raddr) && -- (t->dev->flags & IFF_UP)) -+ if (!ipv6_addr_equal(local, &t->parms.laddr) || -+ !(t->dev->flags & IFF_UP)) -+ continue; -+ -+ if (ipv6_addr_equal(remote, &t->parms.raddr)) - return t; -+ -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { -+ if (ipv6_prefix_equal(remote, &fmr->ip6_prefix, -+ fmr->ip6_prefix_len)) -+ return t; -+ } - } - t = rcu_dereference(ip6n->tnls_wc[0]); - if (t && (t->dev->flags & IFF_UP)) -@@ -218,7 +227,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n, - - if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) { - prio = 1; -- h = HASH(remote, local); -+ h = HASH(local); - } - return &ip6n->tnls[prio][h]; - } -@@ -388,6 +397,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 -@@ -781,6 +796,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 -@@ -825,6 +942,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); - -@@ -1086,6 +1223,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, str - __u8 dsfield; - __u32 mtu; - int err; -+ struct __ip6_tnl_fmr *fmr; - - if ((t->parms.proto != IPPROTO_IPIP && t->parms.proto != 0) || - !ip6_tnl_xmit_ctl(t)) -@@ -1105,6 +1243,18 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, str - if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK) - fl6.flowi6_mark = skb->mark; - -+ /* try to find matching FMR */ -+ for (fmr = t->parms.fmrs; fmr; fmr = fmr->next) { -+ unsigned mshift = 32 - fmr->ip4_prefix_len; -+ if (ntohl(fmr->ip4_prefix.s_addr) >> mshift == -+ ntohl(iph->daddr) >> mshift) -+ break; -+ } -+ -+ /* change dstaddr according to FMR */ -+ if (fmr) -+ ip4ip6_fmr_calc(&fl6.daddr, iph, skb_tail_pointer(skb), fmr, true); -+ - err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu); - if (err != 0) { - /* XXX: send ICMP error even if DF is not set. */ -@@ -1273,6 +1423,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; -@@ -1303,6 +1461,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)); - } - -@@ -1578,6 +1737,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) - { -@@ -1611,6 +1779,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, -@@ -1663,6 +1871,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) + -@@ -1680,6 +1894,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; - } - -@@ -1687,6 +1919,9 @@ static int ip6_tnl_fill_info(struct sk_b - { - struct ip6_tnl *tunnel = netdev_priv(dev); - struct __ip6_tnl_parm *parm = &tunnel->parms; -+ struct __ip6_tnl_fmr *c; -+ int fmrcnt = 0; -+ struct nlattr *fmrs; - - if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) || - nla_put(skb, IFLA_IPTUN_LOCAL, sizeof(struct in6_addr), -@@ -1697,8 +1932,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: -@@ -1714,6 +1968,7 @@ static const struct nla_policy ip6_tnl_p - [IFLA_IPTUN_FLOWINFO] = { .type = NLA_U32 }, - [IFLA_IPTUN_FLAGS] = { .type = NLA_U32 }, - [IFLA_IPTUN_PROTO] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMRS] = { .type = NLA_NESTED }, - }; - - static struct rtnl_link_ops ip6_link_ops __read_mostly = { diff --git a/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch b/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch deleted file mode 100644 index de8745cdc..000000000 --- a/target/linux/generic/pending-3.18/667-ipv6-Fixed-source-specific-default-route-handling.patch +++ /dev/null @@ -1,96 +0,0 @@ -From e16e888b525503be05b3aea64190e8b3bdef44d0 Mon Sep 17 00:00:00 2001 -From: Markus Stenberg -Date: Tue, 5 May 2015 13:36:59 +0300 -Subject: [PATCH] ipv6: Fixed source specific default route handling. - -If there are only IPv6 source specific default routes present, the -host gets -ENETUNREACH on e.g. connect() because ip6_dst_lookup_tail -calls ip6_route_output first, and given source address any, it fails, -and ip6_route_get_saddr is never called. - -The change is to use the ip6_route_get_saddr, even if the initial -ip6_route_output fails, and then doing ip6_route_output _again_ after -we have appropriate source address available. - -Note that this is '99% fix' to the problem; a correct fix would be to -do route lookups only within addrconf.c when picking a source address, -and never call ip6_route_output before source address has been -populated. - -Signed-off-by: Markus Stenberg -Signed-off-by: David S. Miller ---- - net/ipv6/ip6_output.c | 39 +++++++++++++++++++++++++++++++-------- - net/ipv6/route.c | 5 +++-- - 2 files changed, 34 insertions(+), 10 deletions(-) - ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -906,21 +906,45 @@ static int ip6_dst_lookup_tail(struct so - #endif - int err; - -- if (*dst == NULL) -- *dst = ip6_route_output(net, sk, fl6); -- -- if ((err = (*dst)->error)) -- goto out_err_release; -+ /* The correct way to handle this would be to do -+ * ip6_route_get_saddr, and then ip6_route_output; however, -+ * the route-specific preferred source forces the -+ * ip6_route_output call _before_ ip6_route_get_saddr. -+ * -+ * In source specific routing (no src=any default route), -+ * ip6_route_output will fail given src=any saddr, though, so -+ * that's why we try it again later. -+ */ -+ if (ipv6_addr_any(&fl6->saddr) && (!*dst || !(*dst)->error)) { -+ struct rt6_info *rt; -+ bool had_dst = *dst != NULL; - -- if (ipv6_addr_any(&fl6->saddr)) { -- struct rt6_info *rt = (struct rt6_info *) *dst; -+ if (!had_dst) -+ *dst = ip6_route_output(net, sk, fl6); -+ rt = (*dst)->error ? NULL : (struct rt6_info *)*dst; - err = ip6_route_get_saddr(net, rt, &fl6->daddr, - sk ? inet6_sk(sk)->srcprefs : 0, - &fl6->saddr); - if (err) - goto out_err_release; -+ -+ /* If we had an erroneous initial result, pretend it -+ * never existed and let the SA-enabled version take -+ * over. -+ */ -+ if (!had_dst && (*dst)->error) { -+ dst_release(*dst); -+ *dst = NULL; -+ } - } - -+ if (!*dst) -+ *dst = ip6_route_output(net, sk, fl6); -+ -+ err = (*dst)->error; -+ if (err) -+ goto out_err_release; -+ - #ifdef CONFIG_IPV6_OPTIMISTIC_DAD - /* - * Here if the dst entry we've looked up ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -2184,9 +2184,10 @@ int ip6_route_get_saddr(struct net *net, - unsigned int prefs, - struct in6_addr *saddr) - { -- struct inet6_dev *idev = ip6_dst_idev((struct dst_entry *)rt); -+ struct inet6_dev *idev = -+ rt ? ip6_dst_idev((struct dst_entry *)rt) : NULL; - int err = 0; -- if (rt->rt6i_prefsrc.plen) -+ if (rt && rt->rt6i_prefsrc.plen) - *saddr = rt->rt6i_prefsrc.addr; - else - err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, diff --git a/target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-3.18/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch deleted file mode 100644 index f999d44df..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -59,6 +59,7 @@ struct netns_ipv6 { - unsigned long ip6_rt_last_gc; - #ifdef CONFIG_IPV6_MULTIPLE_TABLES - struct rt6_info *ip6_prohibit_entry; -+ struct rt6_info *ip6_policy_failed_entry; - struct rt6_info *ip6_blk_hole_entry; - struct fib6_table *fib6_local_tbl; - struct fib_rules_ops *fib6_rules_ops; ---- a/include/uapi/linux/fib_rules.h -+++ b/include/uapi/linux/fib_rules.h -@@ -64,6 +64,10 @@ enum { - FR_ACT_BLACKHOLE, /* Drop without notification */ - FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ - FR_ACT_PROHIBIT, /* Drop with EACCES */ -+ FR_ACT_RES9, -+ FR_ACT_RES10, -+ FR_ACT_RES11, -+ FR_ACT_POLICY_FAILED, /* Drop with EACCES */ - __FR_ACT_MAX, - }; - ---- a/include/uapi/linux/rtnetlink.h -+++ b/include/uapi/linux/rtnetlink.h -@@ -203,6 +203,7 @@ enum { - RTN_THROW, /* Not in this table */ - RTN_NAT, /* Translate this address */ - RTN_XRESOLVE, /* Use external resolver */ -+ RTN_POLICY_FAILED, /* Failed ingress/egress policy */ - __RTN_MAX - }; - ---- a/net/ipv4/fib_semantics.c -+++ b/net/ipv4/fib_semantics.c -@@ -138,6 +138,10 @@ const struct fib_prop fib_props[RTN_MAX - .error = -EINVAL, - .scope = RT_SCOPE_NOWHERE, - }, -+ [RTN_POLICY_FAILED] = { -+ .error = -EACCES, -+ .scope = RT_SCOPE_UNIVERSE, -+ }, - }; - - static void rt_fibinfo_free(struct rtable __rcu **rtp) ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2236,6 +2236,7 @@ static const char *const rtn_type_names[ - [RTN_THROW] = "THROW", - [RTN_NAT] = "NAT", - [RTN_XRESOLVE] = "XRESOLVE", -+ [RTN_POLICY_FAILED] = "POLICY_FAILED", - }; - - static inline const char *rtn_type(char *buf, size_t len, unsigned int t) ---- a/net/ipv4/ipmr.c -+++ b/net/ipv4/ipmr.c -@@ -184,6 +184,7 @@ static int ipmr_rule_action(struct fib_r - case FR_ACT_UNREACHABLE: - return -ENETUNREACH; - case FR_ACT_PROHIBIT: -+ case FR_ACT_POLICY_FAILED: - return -EACCES; - case FR_ACT_BLACKHOLE: - default: ---- a/net/ipv6/fib6_rules.c -+++ b/net/ipv6/fib6_rules.c -@@ -73,6 +73,10 @@ static int fib6_rule_action(struct fib_r - err = -EACCES; - rt = net->ipv6.ip6_prohibit_entry; - goto discard_pkt; -+ case FR_ACT_POLICY_FAILED: -+ err = -EACCES; -+ rt = net->ipv6.ip6_policy_failed_entry; -+ goto discard_pkt; - } - - table = fib6_get_table(net, rule->table); ---- a/net/ipv6/ip6mr.c -+++ b/net/ipv6/ip6mr.c -@@ -169,6 +169,8 @@ static int ip6mr_rule_action(struct fib_ - return -ENETUNREACH; - case FR_ACT_PROHIBIT: - return -EACCES; -+ case FR_ACT_POLICY_FAILED: -+ return -EACCES; - case FR_ACT_BLACKHOLE: - default: - return -EINVAL; ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -87,6 +87,8 @@ static int ip6_pkt_discard(struct sk_bu - static int ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb); - static int ip6_pkt_prohibit(struct sk_buff *skb); - static int ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb); -+static int ip6_pkt_policy_failed(struct sk_buff *skb); -+static int ip6_pkt_policy_failed_out(struct sock *sk, struct sk_buff *skb); - static void ip6_link_failure(struct sk_buff *skb); - static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, - struct sk_buff *skb, u32 mtu); -@@ -283,6 +285,21 @@ static const struct rt6_info ip6_prohibi - .rt6i_ref = ATOMIC_INIT(1), - }; - -+static const struct rt6_info ip6_policy_failed_entry_template = { -+ .dst = { -+ .__refcnt = ATOMIC_INIT(1), -+ .__use = 1, -+ .obsolete = DST_OBSOLETE_FORCE_CHK, -+ .error = -EACCES, -+ .input = ip6_pkt_policy_failed, -+ .output = ip6_pkt_policy_failed_out, -+ }, -+ .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), -+ .rt6i_protocol = RTPROT_KERNEL, -+ .rt6i_metric = ~(u32) 0, -+ .rt6i_ref = ATOMIC_INIT(1), -+}; -+ - static const struct rt6_info ip6_blk_hole_entry_template = { - .dst = { - .__refcnt = ATOMIC_INIT(1), -@@ -1578,6 +1595,11 @@ int ip6_route_add(struct fib6_config *cf - rt->dst.output = ip6_pkt_prohibit_out; - rt->dst.input = ip6_pkt_prohibit; - break; -+ case RTN_POLICY_FAILED: -+ rt->dst.error = -EACCES; -+ rt->dst.output = ip6_pkt_policy_failed_out; -+ rt->dst.input = ip6_pkt_policy_failed; -+ break; - case RTN_THROW: - default: - rt->dst.error = (cfg->fc_type == RTN_THROW) ? -EAGAIN -@@ -2141,6 +2163,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. - */ -@@ -2365,7 +2398,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) -@@ -2567,6 +2601,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; -@@ -2825,6 +2862,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 -@@ -3047,6 +3086,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; -@@ -3065,6 +3115,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: -@@ -3082,6 +3134,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); - } -@@ -3155,6 +3208,9 @@ void __init ip6_route_init_special_entri - init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); - init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; - init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); -+ init_net.ipv6.ip6_policy_failed_entry->dst.dev = init_net.loopback_dev; -+ init_net.ipv6.ip6_policy_failed_entry->rt6i_idev = -+ in6_dev_get(init_net.loopback_dev); - #endif - } - diff --git a/target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch b/target/linux/generic/pending-3.18/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch deleted file mode 100644 index 25a863939..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -207,6 +207,8 @@ enum { - __RTN_MAX - }; - -+#define RTN_FAILED_POLICY RTN_POLICY_FAILED -+ - #define RTN_MAX (__RTN_MAX - 1) - - diff --git a/target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-3.18/680-NET-skip-GRO-for-foreign-MAC-addresses.patch deleted file mode 100644 index da4b58883..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -4006,6 +4006,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; - -@@ -5077,6 +5080,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) -@@ -5137,6 +5182,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; - -@@ -5254,6 +5300,7 @@ void netdev_upper_dev_unlink(struct net_ - list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) - __netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr); - -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev); - } - EXPORT_SYMBOL(netdev_upper_dev_unlink); -@@ -5773,6 +5820,7 @@ int dev_set_mac_address(struct net_devic - if (err) - return err; - dev->addr_assign_type = NET_ADDR_SET; -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); - add_device_randomness(dev->dev_addr, dev->addr_len); - return 0; ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1556,6 +1556,8 @@ struct net_device { - struct netdev_hw_addr_list mc; - struct netdev_hw_addr_list dev_addrs; - -+ unsigned char local_addr_mask[MAX_ADDR_LEN]; -+ - #ifdef CONFIG_SYSFS - struct kset *queues_kset; - #endif ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -598,7 +598,8 @@ struct sk_buff { - #endif - __u8 ipvs_property:1; - __u8 inner_protocol_type:1; -- /* 4 or 6 bit hole */ -+ __u8 gro_skip:1; -+ /* 3 or 5 bit hole */ - - #ifdef CONFIG_NET_SCHED - __u16 tc_index; /* traffic control index */ ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -172,6 +172,18 @@ u32 eth_get_headlen(void *data, unsigned - } - EXPORT_SYMBOL(eth_get_headlen); - -+static inline bool -+eth_check_local_mask(const void *addr1, const void *addr2, const void *mask) -+{ -+ const u16 *a1 = addr1; -+ const u16 *a2 = addr2; -+ const u16 *m = mask; -+ -+ return (((a1[0] ^ a2[0]) & ~m[0]) | -+ ((a1[1] ^ a2[1]) & ~m[1]) | -+ ((a1[2] ^ a2[2]) & ~m[2])); -+} -+ - /** - * eth_type_trans - determine the packet's protocol ID. - * @skb: received socket data -@@ -199,8 +211,12 @@ __be16 eth_type_trans(struct sk_buff *sk - skb->pkt_type = PACKET_MULTICAST; - } - else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, -- dev->dev_addr))) -+ dev->dev_addr))) { - skb->pkt_type = PACKET_OTHERHOST; -+ if (eth_check_local_mask(eth->h_dest, dev->dev_addr, -+ dev->local_addr_mask)) -+ skb->gro_skip = 1; -+ } - - /* - * Some variants of DSA tagging don't have an ethertype field diff --git a/target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/pending-3.18/681-NET-add-of_get_mac_address_mtd.patch deleted file mode 100644 index a836eed86..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -75,3 +76,45 @@ const void *of_get_mac_address(struct de - return NULL; - } - EXPORT_SYMBOL(of_get_mac_address); -+ -+#ifdef CONFIG_MTD -+int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac) -+{ -+ struct device_node *mtd_np = NULL; -+ size_t retlen; -+ int size, ret; -+ struct mtd_info *mtd; -+ const char *part; -+ const __be32 *list; -+ phandle phandle; -+ u32 mac_inc = 0; -+ -+ list = of_get_property(np, "mtd-mac-address", &size); -+ if (!list || (size != (2 * sizeof(*list)))) -+ return -ENOENT; -+ -+ phandle = be32_to_cpup(list++); -+ if (phandle) -+ mtd_np = of_find_node_by_phandle(phandle); -+ -+ if (!mtd_np) -+ return -ENOENT; -+ -+ part = of_get_property(mtd_np, "label", NULL); -+ if (!part) -+ part = mtd_np->name; -+ -+ mtd = get_mtd_device_nm(part); -+ if (IS_ERR(mtd)) -+ return PTR_ERR(mtd); -+ -+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, mac); -+ put_mtd_device(mtd); -+ -+ if (!of_property_read_u32(np, "mtd-mac-address-increment", &mac_inc)) -+ mac[5] += mac_inc; -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(of_get_mac_address_mtd); -+#endif ---- a/include/linux/of_net.h -+++ b/include/linux/of_net.h -@@ -11,6 +11,14 @@ - #include - extern int of_get_phy_mode(struct device_node *np); - extern const void *of_get_mac_address(struct device_node *np); -+#ifdef CONFIG_MTD -+extern int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac); -+#else -+static inline int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac) -+{ -+ return -ENOENT; -+} -+#endif - #else - static inline int of_get_phy_mode(struct device_node *np) - { diff --git a/target/linux/generic/pending-3.18/700-swconfig.patch b/target/linux/generic/pending-3.18/700-swconfig.patch deleted file mode 100644 index 7cf525a50..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -374,6 +374,7 @@ header-y += stddef.h - header-y += string.h - header-y += suspend_ioctls.h - header-y += swab.h -+header-y += switch.h - header-y += synclink.h - header-y += sysctl.h - header-y += sysinfo.h diff --git a/target/linux/generic/pending-3.18/701-phy_extension.patch b/target/linux/generic/pending-3.18/701-phy_extension.patch deleted file mode 100644 index fa4542b88..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -752,6 +752,7 @@ void phy_start_machine(struct phy_device - void phy_stop_machine(struct phy_device *phydev); - int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); - int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); - int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); - int phy_start_interrupts(struct phy_device *phydev); - void phy_print_status(struct phy_device *phydev); diff --git a/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch b/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch deleted file mode 100644 index bc9515217..000000000 --- a/target/linux/generic/pending-3.18/702-phy_add_aneg_done_function.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -484,6 +484,12 @@ struct phy_driver { - /* Determines the negotiated speed and duplex */ - int (*read_status)(struct phy_device *phydev); - -+ /* -+ * Update the value in phydev->link to reflect the -+ * current link value -+ */ -+ int (*update_link)(struct phy_device *phydev); -+ - /* Clears any pending interrupts */ - int (*ack_interrupt)(struct phy_device *phydev); - ---- a/drivers/net/phy/phy_device.c -+++ b/drivers/net/phy/phy_device.c -@@ -915,6 +915,9 @@ int genphy_update_link(struct phy_device - { - int status; - -+ if (phydev->drv && phydev->drv->update_link) -+ return phydev->drv->update_link(phydev); -+ - /* Do a fake read */ - status = phy_read(phydev, MII_BMSR); - if (status < 0) diff --git a/target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-3.18/703-phy-add-detach-callback-to-struct-phy_driver.patch deleted file mode 100644 index 061e40fb4..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -502,6 +502,12 @@ struct phy_driver { - */ - int (*did_interrupt)(struct phy_device *phydev); - -+ /* -+ * Called before an ethernet device is detached -+ * from the PHY. -+ */ -+ void (*detach)(struct phy_device *phydev); -+ - /* Clears up any memory if needed */ - void (*remove)(struct phy_device *phydev); - diff --git a/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch b/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch deleted file mode 100644 index 424c63e31..000000000 --- a/target/linux/generic/pending-3.18/710-phy-add-mdio_register_board_info.patch +++ /dev/null @@ -1,192 +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 -@@ -789,4 +789,22 @@ int __init mdio_bus_init(void); - void mdio_bus_exit(void); - - extern struct bus_type mdio_bus_type; -+ -+struct mdio_board_info { -+ const char *bus_id; -+ int phy_addr; -+ -+ const void *platform_data; -+}; -+ -+#ifdef CONFIG_MDIO_BOARDINFO -+int mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n); -+#else -+static inline int -+mdiobus_register_board_info(const struct mdio_board_info *info, unsigned n) -+{ -+ return 0; -+} -+#endif -+ - #endif /* __PHY_H */ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -12,6 +12,10 @@ menuconfig PHYLIB - - if PHYLIB - -+config MDIO_BOARDINFO -+ bool -+ default y -+ - config SWCONFIG - tristate "Switch configuration API" - ---help--- ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -2,6 +2,8 @@ - - libphy-objs := phy.o phy_device.o mdio_bus.o - -+obj-$(CONFIG_MDIO_BOARDINFO) += mdio-boardinfo.o -+ - obj-$(CONFIG_PHYLIB) += libphy.o - obj-$(CONFIG_SWCONFIG) += swconfig.o - obj-$(CONFIG_MARVELL_PHY) += marvell.o ---- /dev/null -+++ b/drivers/net/phy/mdio-boardinfo.c -@@ -0,0 +1,58 @@ -+/* -+ * mdio-boardinfo.c - collect pre-declarations of PHY devices -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mdio-boardinfo.h" -+ -+/* -+ * These symbols are exported ONLY FOR the mdio_bus component. -+ * No other users will be supported. -+ */ -+ -+LIST_HEAD(__mdio_board_list); -+EXPORT_SYMBOL_GPL(__mdio_board_list); -+ -+DEFINE_MUTEX(__mdio_board_lock); -+EXPORT_SYMBOL_GPL(__mdio_board_lock); -+ -+/** -+ * mdio_register_board_info - register PHY devices for a given board -+ * @info: array of chip descriptors -+ * @n: how many descriptors are provided -+ * Context: can sleep -+ * -+ * The board info passed can safely be __initdata ... but be careful of -+ * any embedded pointers (platform_data, etc), they're copied as-is. -+ */ -+int __init -+mdiobus_register_board_info(struct mdio_board_info const *info, unsigned n) -+{ -+ struct mdio_board_entry *be; -+ int i; -+ -+ be = kzalloc(n * sizeof(*be), GFP_KERNEL); -+ if (!be) -+ return -ENOMEM; -+ -+ for (i = 0; i < n; i++, be++, info++) { -+ memcpy(&be->board_info, info, sizeof(*info)); -+ mutex_lock(&__mdio_board_lock); -+ list_add_tail(&be->list, &__mdio_board_list); -+ mutex_unlock(&__mdio_board_lock); -+ } -+ -+ return 0; -+} ---- /dev/null -+++ b/drivers/net/phy/mdio-boardinfo.h -@@ -0,0 +1,22 @@ -+/* -+ * mdio-boardinfo.h - boardinfo interface internal to the mdio_bus component -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ */ -+ -+#include -+ -+struct mdio_board_entry { -+ struct list_head list; -+ struct mdio_board_info board_info; -+}; -+ -+/* __mdio_board_lock protects __mdio_board_list -+ * only mdio_bus components are allowed to use these symbols. -+ */ -+extern struct mutex __mdio_board_lock; -+extern struct list_head __mdio_board_list; ---- a/drivers/net/Makefile -+++ b/drivers/net/Makefile -@@ -15,7 +15,7 @@ obj-$(CONFIG_MII) += mii.o - obj-$(CONFIG_MDIO) += mdio.o - obj-$(CONFIG_NET) += Space.o loopback.o - obj-$(CONFIG_NETCONSOLE) += netconsole.o --obj-$(CONFIG_PHYLIB) += phy/ -+obj-y += phy/ - obj-$(CONFIG_RIONET) += rionet.o - obj-$(CONFIG_NET_TEAM) += team/ - obj-$(CONFIG_TUN) += tun.o diff --git a/target/linux/generic/pending-3.18/720-phy_adm6996.patch b/target/linux/generic/pending-3.18/720-phy_adm6996.patch deleted file mode 100644 index b0b8db4e5..000000000 --- a/target/linux/generic/pending-3.18/720-phy_adm6996.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -132,6 +132,13 @@ config MICREL_PHY - ---help--- - Supports the KSZ9021, VSC8201, KS8001 PHYs. - -+config ADM6996_PHY -+ tristate "Driver for ADM6996 switches" -+ select SWCONFIG -+ ---help--- -+ Currently supports the ADM6996FC and ADM6996M switches. -+ Support for FC is very limited. -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -18,6 +18,7 @@ obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o - obj-$(CONFIG_BCM7XXX_PHY) += bcm7xxx.o - obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o -+obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/721-phy_packets.patch b/target/linux/generic/pending-3.18/721-phy_packets.patch deleted file mode 100644 index 7235ab355..000000000 --- a/target/linux/generic/pending-3.18/721-phy_packets.patch +++ /dev/null @@ -1,161 +0,0 @@ ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1228,6 +1228,7 @@ enum netdev_priv_flags { - IFF_LIVE_ADDR_CHANGE = 1<<20, - IFF_MACVLAN = 1<<21, - IFF_XMIT_DST_RELEASE_PERM = 1<<22, -+ IFF_NO_IP_ALIGN = 1<<23, - }; - - #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN -@@ -1253,6 +1254,7 @@ enum netdev_priv_flags { - #define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE - #define IFF_MACVLAN IFF_MACVLAN - #define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM -+#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN - - /** - * struct net_device - The DEVICE structure. -@@ -1523,6 +1525,11 @@ struct net_device { - const struct ethtool_ops *ethtool_ops; - const struct forwarding_accel_ops *fwd_ops; - -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ void (*eth_mangle_rx)(struct net_device *dev, struct sk_buff *skb); -+ struct sk_buff *(*eth_mangle_tx)(struct net_device *dev, struct sk_buff *skb); -+#endif -+ - const struct header_ops *header_ops; - - unsigned int flags; -@@ -1587,6 +1594,10 @@ struct net_device { - void *ax25_ptr; - struct wireless_dev *ieee80211_ptr; - -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ void *phy_ptr; /* PHY device specific data */ -+#endif -+ - /* - * Cache lines mostly used on receive path (including eth_type_trans()) - */ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2055,6 +2055,10 @@ static inline int pskb_trim(struct sk_bu - return (len < skb->len) ? __pskb_trim(skb, len) : 0; - } - -+extern struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -+ unsigned int length, gfp_t gfp); -+ -+ - /** - * pskb_trim_unique - remove end from a paged unique (not cloned) buffer - * @skb: buffer to alter -@@ -2181,16 +2185,6 @@ static inline struct sk_buff *dev_alloc_ - } - - --static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -- unsigned int length, gfp_t gfp) --{ -- struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); -- -- if (NET_IP_ALIGN && skb) -- skb_reserve(skb, NET_IP_ALIGN); -- return skb; --} -- - static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, - unsigned int length) - { ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -25,6 +25,12 @@ menuconfig NET - - if NET - -+config ETHERNET_PACKET_MANGLE -+ bool -+ help -+ This option can be selected by phy drivers that need to mangle -+ packets going in or out of an ethernet device. -+ - config WANT_COMPAT_NETLINK_MESSAGES - bool - help ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -2626,10 +2626,20 @@ static int xmit_one(struct sk_buff *skb, - if (!list_empty(&ptype_all)) - dev_queue_xmit_nit(skb, dev); - -- len = skb->len; -- trace_net_dev_start_xmit(skb, dev); -- rc = netdev_start_xmit(skb, dev, txq, more); -- trace_net_dev_xmit(skb, rc, dev, len); -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (!dev->eth_mangle_tx || -+ (skb = dev->eth_mangle_tx(dev, skb)) != NULL) -+#else -+ if (1) -+#endif -+ { -+ len = skb->len; -+ trace_net_dev_start_xmit(skb, dev); -+ rc = netdev_start_xmit(skb, dev, txq, more); -+ trace_net_dev_xmit(skb, rc, dev, len); -+ } else { -+ rc = NETDEV_TX_OK; -+ } - - return rc; - } ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -63,6 +63,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -471,6 +472,22 @@ struct sk_buff *__netdev_alloc_skb(struc - } - EXPORT_SYMBOL(__netdev_alloc_skb); - -+struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, -+ unsigned int length, gfp_t gfp) -+{ -+ struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); -+ -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (dev && (dev->priv_flags & IFF_NO_IP_ALIGN)) -+ return skb; -+#endif -+ -+ if (NET_IP_ALIGN && skb) -+ skb_reserve(skb, NET_IP_ALIGN); -+ return skb; -+} -+EXPORT_SYMBOL(__netdev_alloc_skb_ip_align); -+ - void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, - int size, unsigned int truesize) - { ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -200,6 +200,12 @@ __be16 eth_type_trans(struct sk_buff *sk - const struct ethhdr *eth; - - skb->dev = dev; -+ -+#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (dev->eth_mangle_rx) -+ dev->eth_mangle_rx(dev, skb); -+#endif -+ - skb_reset_mac_header(skb); - skb_pull_inline(skb, ETH_HLEN); - eth = eth_hdr(skb); diff --git a/target/linux/generic/pending-3.18/722-phy_mvswitch.patch b/target/linux/generic/pending-3.18/722-phy_mvswitch.patch deleted file mode 100644 index f577a9f68..000000000 --- a/target/linux/generic/pending-3.18/722-phy_mvswitch.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -139,6 +139,10 @@ config ADM6996_PHY - Currently supports the ADM6996FC and ADM6996M switches. - Support for FC is very limited. - -+config MVSWITCH_PHY -+ tristate "Driver for Marvell 88E6060 switches" -+ select ETHERNET_PACKET_MANGLE -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -19,6 +19,7 @@ obj-$(CONFIG_BCM7XXX_PHY) += bcm7xxx.o - obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o -+obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/723-phy_ip175c.patch b/target/linux/generic/pending-3.18/723-phy_ip175c.patch deleted file mode 100644 index c7c4f99ee..000000000 --- a/target/linux/generic/pending-3.18/723-phy_ip175c.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -143,6 +143,10 @@ config MVSWITCH_PHY - tristate "Driver for Marvell 88E6060 switches" - select ETHERNET_PACKET_MANGLE - -+config IP17XX_PHY -+ tristate "Driver for IC+ IP17xx switches" -+ select SWCONFIG -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -20,6 +20,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o -+obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o diff --git a/target/linux/generic/pending-3.18/724-phy_ar8216.patch b/target/linux/generic/pending-3.18/724-phy_ar8216.patch deleted file mode 100644 index acb2df8f8..000000000 --- a/target/linux/generic/pending-3.18/724-phy_ar8216.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -147,6 +147,11 @@ config IP17XX_PHY - tristate "Driver for IC+ IP17xx switches" - select SWCONFIG - -+config AR8216_PHY -+ tristate "Driver for Atheros AR8216 switches" -+ select ETHERNET_PACKET_MANGLE -+ select SWCONFIG -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -22,6 +22,7 @@ obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o - obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o -+obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/725-phy_rtl8306.patch b/target/linux/generic/pending-3.18/725-phy_rtl8306.patch deleted file mode 100644 index 78ac6ce98..000000000 --- a/target/linux/generic/pending-3.18/725-phy_rtl8306.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -152,6 +152,10 @@ config AR8216_PHY - select ETHERNET_PACKET_MANGLE - select SWCONFIG - -+config RTL8306_PHY -+ tristate "Driver for Realtek RTL8306S switches" -+ select SWCONFIG -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -23,6 +23,7 @@ obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o - obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o -+obj-$(CONFIG_RTL8306_PHY) += rtl8306.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/726-phy_rtl8366.patch b/target/linux/generic/pending-3.18/726-phy_rtl8366.patch deleted file mode 100644 index 4a4a4acee..000000000 --- a/target/linux/generic/pending-3.18/726-phy_rtl8366.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -250,6 +250,30 @@ config MDIO_BCM_UNIMAC - controllers as well as some Broadcom Ethernet switches such as the - Starfighter 2 switches. - -+config RTL8366_SMI -+ tristate "Driver for the RTL8366 SMI interface" -+ depends on GPIOLIB -+ ---help--- -+ This module implements the SMI interface protocol which is used -+ by some RTL8366 ethernet switch devices via the generic GPIO API. -+ -+if RTL8366_SMI -+ -+config RTL8366_SMI_DEBUG_FS -+ bool "RTL8366 SMI interface debugfs support" -+ depends on DEBUG_FS -+ default n -+ -+config RTL8366S_PHY -+ tristate "Driver for the Realtek RTL8366S switch" -+ select SWCONFIG -+ -+config RTL8366RB_PHY -+ tristate "Driver for the Realtek RTL8366RB switch" -+ select SWCONFIG -+ -+endif # RTL8366_SMI -+ - endif # PHYLIB - - config MICREL_KS8995MA ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -24,6 +24,9 @@ obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o - obj-$(CONFIG_RTL8306_PHY) += rtl8306.o -+obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o -+obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o -+obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/727-phy-rtl8367.patch b/target/linux/generic/pending-3.18/727-phy-rtl8367.patch deleted file mode 100644 index 8481b589d..000000000 --- a/target/linux/generic/pending-3.18/727-phy-rtl8367.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -272,6 +272,10 @@ config RTL8366RB_PHY - tristate "Driver for the Realtek RTL8366RB switch" - select SWCONFIG - -+config RTL8367_PHY -+ tristate "Driver for the Realtek RTL8367R/M switches" -+ select SWCONFIG -+ - endif # RTL8366_SMI - - endif # PHYLIB ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -27,6 +27,7 @@ obj-$(CONFIG_RTL8306_PHY) += rtl8306.o - obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o - obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o - obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o -+obj-$(CONFIG_RTL8367_PHY) += rtl8367.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch b/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch deleted file mode 100644 index 958ff5890..000000000 --- a/target/linux/generic/pending-3.18/728-phy-rtl8367b.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -276,6 +276,10 @@ config RTL8367_PHY - tristate "Driver for the Realtek RTL8367R/M switches" - select SWCONFIG - -+config RTL8367B_PHY -+ tristate "Driver fot the Realtek RTL8367R-VB switch" -+ select SWCONFIG -+ - endif # RTL8366_SMI - - endif # PHYLIB ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -28,6 +28,7 @@ obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi - obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o - obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o - obj-$(CONFIG_RTL8367_PHY) += rtl8367.o -+obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o diff --git a/target/linux/generic/pending-3.18/729-phy-tantos.patch b/target/linux/generic/pending-3.18/729-phy-tantos.patch deleted file mode 100644 index 019f91949..000000000 --- a/target/linux/generic/pending-3.18/729-phy-tantos.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -287,3 +287,8 @@ endif # PHYLIB - config MICREL_KS8995MA - tristate "Micrel KS8995MA 5-ports 10/100 managed Ethernet switch" - depends on SPI -+ -+config PSB6970_PHY -+ tristate "Lantiq XWAY Tantos (PSB6970) Ethernet switch" -+ select SWCONFIG -+ select ETHERNET_PACKET_MANGLE ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -30,6 +30,7 @@ obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb - obj-$(CONFIG_RTL8367_PHY) += rtl8367.o - obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o -+obj-$(CONFIG_PSB6970_PHY) += psb6970.o - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o - obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o diff --git a/target/linux/generic/pending-3.18/730-phy_b53.patch b/target/linux/generic/pending-3.18/730-phy_b53.patch deleted file mode 100644 index 03fc369c9..000000000 --- a/target/linux/generic/pending-3.18/730-phy_b53.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -282,6 +282,8 @@ config RTL8367B_PHY - - endif # RTL8366_SMI - -+source "drivers/net/phy/b53/Kconfig" -+ - endif # PHYLIB - - config MICREL_KS8995MA ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -31,6 +31,7 @@ obj-$(CONFIG_RTL8367_PHY) += rtl8367.o - obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o - obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o - obj-$(CONFIG_PSB6970_PHY) += psb6970.o -+obj-$(CONFIG_SWCONFIG_B53) += b53/ - obj-$(CONFIG_FIXED_PHY) += fixed.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o - obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o diff --git a/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch b/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch deleted file mode 100644 index c75396757..000000000 --- a/target/linux/generic/pending-3.18/732-phy-ar8216-led-support.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -152,6 +152,10 @@ config AR8216_PHY - select ETHERNET_PACKET_MANGLE - select SWCONFIG - -+config AR8216_PHY_LEDS -+ bool "Atheros AR8216 switch LED support" -+ depends on (AR8216_PHY && LEDS_CLASS) -+ - config RTL8306_PHY - tristate "Driver for Realtek RTL8306S switches" - select SWCONFIG diff --git a/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch b/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch deleted file mode 100644 index 041d168b6..000000000 --- a/target/linux/generic/pending-3.18/733-phy_mvsw61xx.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -143,6 +143,10 @@ config MVSWITCH_PHY - tristate "Driver for Marvell 88E6060 switches" - select ETHERNET_PACKET_MANGLE - -+config MVSW61XX_PHY -+ tristate "Driver for Marvell 88E6171/6172 switches" -+ select SWCONFIG -+ - config IP17XX_PHY - tristate "Driver for IC+ IP17xx switches" - select SWCONFIG ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -20,6 +20,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o -+obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o - obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o diff --git a/target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-3.18/734-net-phy-at803x-allow-to-configure-via-pdata.patch deleted file mode 100644 index 0d021ac7b..000000000 --- a/target/linux/generic/pending-3.18/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) -@@ -208,8 +256,16 @@ static int at803x_probe(struct phy_devic - return 0; - } - -+static void at803x_disable_smarteee(struct phy_device *phydev) -+{ -+ phy_write_mmd(phydev, MDIO_MMD_PCS, AT803X_PCS_SMART_EEE_CTRL3, -+ 1 << AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_SHIFT); -+ phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, 0); -+} -+ - static int at803x_config_init(struct phy_device *phydev) - { -+ struct at803x_platform_data *pdata; - int ret; - - ret = genphy_config_init(phydev); -@@ -227,6 +283,26 @@ static int at803x_config_init(struct phy - return ret; - } - -+ pdata = dev_get_platdata(&phydev->dev); -+ if (pdata) { -+ if (pdata->disable_smarteee) -+ at803x_disable_smarteee(phydev); -+ -+ if (pdata->enable_rgmii_rx_delay) -+ at803x_dbg_reg_set(phydev, AT803X_DBG0_REG, -+ AT803X_DEBUG_RGMII_RX_CLK_DLY); -+ else -+ at803x_dbg_reg_clr(phydev, AT803X_DBG0_REG, -+ AT803X_DEBUG_RGMII_RX_CLK_DLY); -+ -+ if (pdata->enable_rgmii_tx_delay) -+ at803x_dbg_reg_set(phydev, AT803X_DEBUG_SYSTEM_MODE_CTRL, -+ AT803X_DEBUG_RGMII_TX_CLK_DLY); -+ else -+ at803x_dbg_reg_clr(phydev, AT803X_DEBUG_SYSTEM_MODE_CTRL, -+ AT803X_DEBUG_RGMII_TX_CLK_DLY); -+ } -+ - return 0; - } - -@@ -258,6 +334,8 @@ static int at803x_config_intr(struct phy - static void at803x_link_change_notify(struct phy_device *phydev) - { - struct at803x_priv *priv = phydev->priv; -+ struct at803x_platform_data *pdata; -+ pdata = dev_get_platdata(&phydev->dev); - - /* - * Conduct a hardware reset for AT8030 every time a link loss is -@@ -288,6 +366,26 @@ static void at803x_link_change_notify(st - priv->phy_reset = false; - } - } -+ if (pdata && pdata->fixup_rgmii_tx_delay && -+ phydev->speed != priv->prev_speed) { -+ switch (phydev->speed) { -+ case SPEED_10: -+ case SPEED_100: -+ at803x_dbg_reg_set(phydev, -+ AT803X_DEBUG_SYSTEM_MODE_CTRL, -+ AT803X_DEBUG_RGMII_TX_CLK_DLY); -+ break; -+ case SPEED_1000: -+ at803x_dbg_reg_clr(phydev, -+ AT803X_DEBUG_SYSTEM_MODE_CTRL, -+ AT803X_DEBUG_RGMII_TX_CLK_DLY); -+ break; -+ default: -+ break; -+ } -+ -+ priv->prev_speed = phydev->speed; -+ } - } - - static struct phy_driver at803x_driver[] = { ---- /dev/null -+++ b/include/linux/platform_data/phy-at803x.h -@@ -0,0 +1,11 @@ -+#ifndef _PHY_AT803X_PDATA_H -+#define _PHY_AT803X_PDATA_H -+ -+struct at803x_platform_data { -+ int disable_smarteee:1; -+ int enable_rgmii_tx_delay:1; -+ int enable_rgmii_rx_delay:1; -+ int fixup_rgmii_tx_delay:1; -+}; -+ -+#endif /* _PHY_AT803X_PDATA_H */ diff --git a/target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-3.18/735-net-phy-at803x-fix-at8033-sgmii-mode.patch deleted file mode 100644 index 4a8f532aa..000000000 --- a/target/linux/generic/pending-3.18/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"); -@@ -267,6 +271,27 @@ static int at803x_config_init(struct phy - { - struct at803x_platform_data *pdata; - int ret; -+ u32 v; -+ -+ if (phydev->drv->phy_id == ATH8031_PHY_ID && -+ phydev->interface == PHY_INTERFACE_MODE_SGMII) -+ { -+ v = phy_read(phydev, AT803X_REG_CHIP_CONFIG); -+ /* select SGMII/fiber page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v & ~AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ /* enable SGMII autonegotiation */ -+ ret = phy_write(phydev, MII_BMCR, AT803X_SGMII_ANEG_EN); -+ if (ret) -+ return ret; -+ /* select copper page */ -+ ret = phy_write(phydev, AT803X_REG_CHIP_CONFIG, -+ v | AT803X_BT_BX_REG_SEL); -+ if (ret) -+ return ret; -+ } - - ret = genphy_config_init(phydev); - if (ret < 0) -@@ -393,7 +418,7 @@ static struct phy_driver at803x_driver[] - /* ATHEROS 8035 */ - .phy_id = ATH8035_PHY_ID, - .name = "Atheros 8035 ethernet", -- .phy_id_mask = 0xffffffef, -+ .phy_id_mask = AT803X_PHY_ID_MASK, - .probe = at803x_probe, - .config_init = at803x_config_init, - .link_change_notify = at803x_link_change_notify, -@@ -412,7 +437,7 @@ static struct phy_driver at803x_driver[] - /* ATHEROS 8030 */ - .phy_id = ATH8030_PHY_ID, - .name = "Atheros 8030 ethernet", -- .phy_id_mask = 0xffffffef, -+ .phy_id_mask = AT803X_PHY_ID_MASK, - .probe = at803x_probe, - .config_init = at803x_config_init, - .link_change_notify = at803x_link_change_notify, -@@ -430,8 +455,8 @@ static struct phy_driver at803x_driver[] - }, { - /* ATHEROS 8031 */ - .phy_id = ATH8031_PHY_ID, -- .name = "Atheros 8031 ethernet", -- .phy_id_mask = 0xffffffef, -+ .name = "Atheros 8031/8033 ethernet", -+ .phy_id_mask = AT803X_PHY_ID_MASK, - .probe = at803x_probe, - .config_init = at803x_config_init, - .link_change_notify = at803x_link_change_notify, -@@ -465,9 +490,9 @@ module_init(atheros_init); - module_exit(atheros_exit); - - static struct mdio_device_id __maybe_unused atheros_tbl[] = { -- { ATH8030_PHY_ID, 0xffffffef }, -- { ATH8031_PHY_ID, 0xffffffef }, -- { ATH8035_PHY_ID, 0xffffffef }, -+ { ATH8030_PHY_ID, AT803X_PHY_ID_MASK }, -+ { ATH8031_PHY_ID, AT803X_PHY_ID_MASK }, -+ { ATH8035_PHY_ID, AT803X_PHY_ID_MASK }, - { } - }; - diff --git a/target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch b/target/linux/generic/pending-3.18/760-8139cp-fixes-from-4.3.patch deleted file mode 100644 index 7051843b7..000000000 --- a/target/linux/generic/pending-3.18/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(&cp->napi); - - spin_unlock_irqrestore(&cp->lock, flags); - } diff --git a/target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch b/target/linux/generic/pending-3.18/773-bgmac-add-srab-switch.patch deleted file mode 100644 index a93877b69..000000000 --- a/target/linux/generic/pending-3.18/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 - **************************************************/ -@@ -1671,6 +1683,16 @@ static int bgmac_probe(struct bcma_devic - net_dev->hw_features = net_dev->features; - net_dev->vlan_features = net_dev->features; - -+ if ((ci->id == BCMA_CHIP_ID_BCM4707 || -+ ci->id == BCMA_CHIP_ID_BCM53018) && -+ !bgmac_b53_pdata.regs) { -+ bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000); -+ -+ err = platform_device_register(&bgmac_b53_dev); -+ if (!err) -+ bgmac->b53_device = &bgmac_b53_dev; -+ } -+ - err = register_netdev(bgmac->net_dev); - if (err) { - bgmac_err(bgmac, "Cannot register net device\n"); -@@ -1697,6 +1719,10 @@ static void bgmac_remove(struct bcma_dev - { - struct bgmac *bgmac = bcma_get_drvdata(core); - -+ if (bgmac->b53_device) -+ platform_device_unregister(&bgmac_b53_dev); -+ bgmac->b53_device = NULL; -+ - unregister_netdev(bgmac->net_dev); - bgmac_mii_unregister(bgmac); - netif_napi_del(&bgmac->napi); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -462,6 +462,9 @@ struct bgmac { - bool has_robosw; - - bool loopback; -+ -+ /* platform device for associated switch */ -+ struct platform_device *b53_device; - }; - - static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset) diff --git a/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch b/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch deleted file mode 100644 index 50bccc4df..000000000 --- a/target/linux/generic/pending-3.18/785-hso-support-0af0-9300.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -468,6 +468,7 @@ static const struct usb_device_id hso_id - {USB_DEVICE(0x0af0, 0x8900)}, - {USB_DEVICE(0x0af0, 0x9000)}, - {USB_DEVICE(0x0af0, 0x9200)}, /* Option GTM671WFS */ -+ {USB_DEVICE(0x0af0, 0x9300)}, /* GTM 66xxWFS */ - {USB_DEVICE(0x0af0, 0xd035)}, - {USB_DEVICE(0x0af0, 0xd055)}, - {USB_DEVICE(0x0af0, 0xd155)}, ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -1330,6 +1330,12 @@ UNUSUAL_DEV( 0x0af0, 0x8304, 0x0000, 0x0 - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - 0 ), - -+UNUSUAL_DEV( 0x0af0, 0x9300, 0x0000, 0x0000, -+ "Option", -+ "Globetrotter 66xxWFS SD-Card", -+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, -+ 0 ), -+ - UNUSUAL_DEV( 0x0af0, 0xc100, 0x0000, 0x0000, - "Option", - "GI 070x SD-Card", diff --git a/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch deleted file mode 100644 index 5155bcdad..000000000 --- a/target/linux/generic/pending-3.18/810-pci_disable_common_quirks.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/drivers/pci/Kconfig -+++ b/drivers/pci/Kconfig -@@ -58,6 +58,12 @@ config XEN_PCIDEV_FRONTEND - The PCI device frontend driver allows the kernel to import arbitrary - PCI devices from a PCI backend to support PCI driver domains. - -+config PCI_DISABLE_COMMON_QUIRKS -+ bool "PCI disable common quirks" -+ depends on PCI -+ help -+ If you don't know what to do here, say N. -+ - config HT_IRQ - bool "Interrupts on hypertransport devices" - default y ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -41,6 +41,7 @@ static void quirk_mmio_always_on(struct - DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - /* The Mellanox Tavor device gives false positive parity errors - * Mark this device with a broken_parity_status, to allow - * PCI scanning code to "skip" this now blacklisted device. -@@ -2929,6 +2930,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ - - /* - * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. To -@@ -2985,6 +2987,8 @@ static void fixup_debug_report(struct pc - } - } - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - /* - * Some BIOS implementations leave the Intel GPU interrupts enabled, - * even though no one is handling them (f.e. i915 driver is never loaded). -@@ -3019,6 +3023,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ - /* - * PCI devices which are on Intel chips can skip the 10ms delay - * before entering D3 mode. diff --git a/target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-3.18/811-pci_disable_usb_common_quirks.patch deleted file mode 100644 index ddc854963..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -98,6 +98,8 @@ struct amd_chipset_type { - u8 rev; - }; - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static struct amd_chipset_info { - struct pci_dev *nb_dev; - struct pci_dev *smbus_dev; -@@ -462,6 +464,10 @@ void usb_amd_dev_put(void) - } - EXPORT_SYMBOL_GPL(usb_amd_dev_put); - -+#endif /* CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ -+#if IS_ENABLED(CONFIG_USB_UHCI_HCD) -+ - /* - * Make sure the controller is completely inactive, unable to - * generate interrupts or do DMA. -@@ -541,8 +547,17 @@ reset_needed: - uhci_reset_hc(pdev, base); - return 1; - } -+#else -+int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base) -+{ -+ return 0; -+} -+ -+#endif - EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask) - { - u16 cmd; -@@ -1103,3 +1118,4 @@ static void quirk_usb_early_handoff(stru - } - DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); -+#endif ---- a/drivers/usb/host/pci-quirks.h -+++ b/drivers/usb/host/pci-quirks.h -@@ -4,6 +4,9 @@ - #ifdef CONFIG_PCI - void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); - int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); -+#endif /* CONFIG_PCI */ -+ -+#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS) - int usb_amd_find_chipset_info(void); - int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev); - bool usb_amd_hang_symptom_quirk(void); -@@ -16,11 +19,24 @@ void usb_disable_xhci_ports(struct pci_d - void sb800_prefetch(struct device *dev, int on); - #else - struct pci_dev; -+static inline int usb_amd_find_chipset_info(void) -+{ -+ return 0; -+} -+static inline bool usb_amd_hang_symptom_quirk(void) -+{ -+ return false; -+} -+static inline bool usb_amd_prefetch_quirk(void) -+{ -+ return false; -+} - static inline void usb_amd_quirk_pll_disable(void) {} - static inline void usb_amd_quirk_pll_enable(void) {} - static inline void usb_amd_dev_put(void) {} - static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} - static inline void sb800_prefetch(struct device *dev, int on) {} --#endif /* CONFIG_PCI */ -+static inline void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) {} -+#endif - - #endif /* __LINUX_USB_PCI_QUIRKS_H */ ---- a/include/linux/usb/hcd.h -+++ b/include/linux/usb/hcd.h -@@ -445,7 +445,14 @@ extern int usb_hcd_pci_probe(struct pci_ - extern void usb_hcd_pci_remove(struct pci_dev *dev); - extern void usb_hcd_pci_shutdown(struct pci_dev *dev); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev); -+#else -+static inline int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev) -+{ -+ return 0; -+} -+#endif - - #ifdef CONFIG_PM - extern const struct dev_pm_ops usb_hcd_pci_pm_ops; diff --git a/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch b/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch deleted file mode 100644 index 9e841cb64..000000000 --- a/target/linux/generic/pending-3.18/821-usb-dwc2-dualrole.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- a/drivers/usb/dwc2/Kconfig -+++ b/drivers/usb/dwc2/Kconfig -@@ -1,6 +1,6 @@ - config USB_DWC2 -- bool "DesignWare USB2 DRD Core Support" -- depends on USB -+ tristate "DesignWare USB2 DRD Core Support" -+ depends on USB || USB_GADGET - help - Say Y here if your system has a Dual Role Hi-Speed USB - controller based on the DesignWare HSOTG IP Core. -@@ -10,49 +10,61 @@ config USB_DWC2 - bus interface module (if you have a PCI bus system) will be - called dwc2_pci.ko, and the platform interface module (for - controllers directly connected to the CPU) will be called -- dwc2_platform.ko. For gadget mode, there will be a single -- module called dwc2_gadget.ko. -- -- NOTE: The s3c-hsotg driver is now renamed to dwc2_gadget. The -- host and gadget drivers are still currently separate drivers. -- There are plans to merge the dwc2_gadget driver with the dwc2 -- host driver in the near future to create a dual-role driver. -+ dwc2_platform.ko. For all modes(host, gadget and dual-role), there -+ will be an additional module named dwc2.ko. - - if USB_DWC2 - -+choice -+ bool "DWC2 Mode Selection" -+ default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET) -+ default USB_DWC2_HOST if (USB && !USB_GADGET) -+ default USB_DWC2_PERIPHERAL if (!USB && USB_GADGET) -+ - config USB_DWC2_HOST -- tristate "Host only mode" -+ bool "Host only mode" - depends on USB - help - The Designware USB2.0 high-speed host controller -- integrated into many SoCs. -+ integrated into many SoCs. Select this option if you want the -+ driver to operate in Host-only mode. - --config USB_DWC2_PLATFORM -- bool "DWC2 Platform" -- depends on USB_DWC2_HOST -- default USB_DWC2_HOST -+comment "Gadget/Dual-role mode requires USB Gadget support to be enabled" -+ -+config USB_DWC2_PERIPHERAL -+ bool "Gadget only mode" -+ depends on USB_GADGET=y || USB_GADGET=USB_DWC2 -+ help -+ The Designware USB2.0 high-speed gadget controller -+ integrated into many SoCs. Select this option if you want the -+ driver to operate in Peripheral-only mode. This option requires -+ USB_GADGET to be enabled. -+ -+config USB_DWC2_DUAL_ROLE -+ bool "Dual Role mode" -+ depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2) - help -- The Designware USB2.0 platform interface module for -- controllers directly connected to the CPU. This is only -- used for host mode. -+ Select this option if you want the driver to work in a dual-role -+ mode. In this mode both host and gadget features are enabled, and -+ the role will be determined by the cable that gets plugged-in. This -+ option requires USB_GADGET to be enabled. -+endchoice -+ -+config USB_DWC2_PLATFORM -+ tristate "DWC2 Platform" -+ default USB_DWC2_HOST || USB_DWC2_PERIPHERAL -+ help -+ The Designware USB2.0 platform interface module for -+ controllers directly connected to the CPU. - - config USB_DWC2_PCI -- bool "DWC2 PCI" -+ tristate "DWC2 PCI" - depends on USB_DWC2_HOST && PCI - default USB_DWC2_HOST - help - The Designware USB2.0 PCI interface module for controllers - connected to a PCI bus. This is only used for host mode. - --comment "Gadget mode requires USB Gadget support to be enabled" -- --config USB_DWC2_PERIPHERAL -- tristate "Gadget only mode" -- depends on USB_GADGET -- help -- The Designware USB2.0 high-speed gadget controller -- integrated into many SoCs. -- - config USB_DWC2_DEBUG - bool "Enable Debugging Messages" - help ---- a/drivers/usb/dwc2/Makefile -+++ b/drivers/usb/dwc2/Makefile -@@ -1,28 +1,28 @@ - ccflags-$(CONFIG_USB_DWC2_DEBUG) += -DDEBUG - ccflags-$(CONFIG_USB_DWC2_VERBOSE) += -DVERBOSE_DEBUG - --obj-$(CONFIG_USB_DWC2_HOST) += dwc2.o -+obj-$(CONFIG_USB_DWC2) += dwc2.o - dwc2-y := core.o core_intr.o --dwc2-y += hcd.o hcd_intr.o --dwc2-y += hcd_queue.o hcd_ddma.o -+ -+ifneq ($(filter y,$(CONFIG_USB_DWC2_HOST) $(CONFIG_USB_DWC2_DUAL_ROLE)),) -+ dwc2-y += hcd.o hcd_intr.o -+ dwc2-y += hcd_queue.o hcd_ddma.o -+endif -+ -+ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),) -+ dwc2-y += gadget.o -+endif - - # NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to - # this location and renamed gadget.c. When building for dynamically linked --# modules, dwc2_gadget.ko will get built for peripheral mode. For host mode, --# the core module will be dwc2.ko, the PCI bus interface module will called --# dwc2_pci.ko and the platform interface module will be called dwc2_platform.ko. --# At present the host and gadget driver will be separate drivers, but there --# are plans in the near future to create a dual-role driver. -+# modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role -+# mode. The PCI bus interface module will called dwc2_pci.ko and the platform -+# interface module will be called dwc2_platform.ko. - - ifneq ($(CONFIG_USB_DWC2_PCI),) -- obj-$(CONFIG_USB_DWC2_HOST) += dwc2_pci.o -+ obj-$(CONFIG_USB_DWC2) += dwc2_pci.o - dwc2_pci-y := pci.o - endif - --ifneq ($(CONFIG_USB_DWC2_PLATFORM),) -- obj-$(CONFIG_USB_DWC2_HOST) += dwc2_platform.o -- dwc2_platform-y := platform.o --endif -- --obj-$(CONFIG_USB_DWC2_PERIPHERAL) += dwc2_gadget.o --dwc2_gadget-y := gadget.o -+obj-$(CONFIG_USB_DWC2_PLATFORM) += dwc2_platform.o -+dwc2_platform-y := platform.o diff --git a/target/linux/generic/pending-3.18/831-ledtrig_netdev.patch b/target/linux/generic/pending-3.18/831-ledtrig_netdev.patch deleted file mode 100644 index 3b46b4a9f..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -62,3 +62,4 @@ obj-$(CONFIG_LEDS_DAC124S085) += leds-d - - # LED Triggers - obj-$(CONFIG_LEDS_TRIGGERS) += trigger/ -+obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o diff --git a/target/linux/generic/pending-3.18/834-ledtrig-libata.patch b/target/linux/generic/pending-3.18/834-ledtrig-libata.patch deleted file mode 100644 index d0aee1c2d..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -725,6 +725,19 @@ u64 ata_tf_read_block(struct ata_taskfil - return block; - } - -+#ifdef CONFIG_ATA_LEDS -+#define LIBATA_BLINK_DELAY 20 /* ms */ -+static inline void ata_led_act(struct ata_port *ap) -+{ -+ unsigned long led_delay = LIBATA_BLINK_DELAY; -+ -+ if (unlikely(!ap->ledtrig)) -+ return; -+ -+ led_trigger_blink_oneshot(ap->ledtrig, &led_delay, &led_delay, 0); -+} -+#endif -+ - /** - * ata_build_rw_tf - Build ATA taskfile for given read/write request - * @tf: Target ATA taskfile -@@ -4800,6 +4813,9 @@ static struct ata_queued_cmd *ata_qc_new - break; - } - } -+#ifdef CONFIG_ATA_LEDS -+ ata_led_act(ap); -+#endif - - return qc; - } -@@ -5710,6 +5726,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; -@@ -5731,6 +5750,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; - } -@@ -6177,7 +6202,23 @@ int ata_host_register(struct ata_host *h - host->ports[i]->print_id = atomic_inc_return(&ata_print_id); - host->ports[i]->local_port_no = i + 1; - } -+#ifdef CONFIG_ATA_LEDS -+ for (i = 0; i < host->n_ports; i++) { -+ if (unlikely(!host->ports[i]->ledtrig)) -+ continue; - -+ snprintf(host->ports[i]->ledtrig_name, -+ sizeof(host->ports[i]->ledtrig_name), "ata%u", -+ host->ports[i]->print_id); -+ -+ host->ports[i]->ledtrig->name = host->ports[i]->ledtrig_name; -+ -+ if (led_trigger_register(host->ports[i]->ledtrig)) { -+ kfree(host->ports[i]->ledtrig); -+ host->ports[i]->ledtrig = NULL; -+ } -+ } -+#endif - /* Create associated sysfs transport objects */ - for (i = 0; i < host->n_ports; i++) { - rc = ata_tport_add(host->dev,host->ports[i]); ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -38,6 +38,9 @@ - #include - #include - #include -+#ifdef CONFIG_ATA_LEDS -+#include -+#endif - - /* - * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -874,6 +877,12 @@ struct ata_port { - #ifdef CONFIG_ATA_ACPI - struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ - #endif -+ -+#ifdef CONFIG_ATA_LEDS -+ struct led_trigger *ledtrig; -+ char ledtrig_name[8]; -+#endif -+ - /* owned by EH */ - u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; - }; diff --git a/target/linux/generic/pending-3.18/840-rtc7301.patch b/target/linux/generic/pending-3.18/840-rtc7301.patch deleted file mode 100644 index 2134d8747..000000000 --- a/target/linux/generic/pending-3.18/840-rtc7301.patch +++ /dev/null @@ -1,250 +0,0 @@ ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -979,6 +979,15 @@ config RTC_DRV_NUC900 - If you say yes here you get support for the RTC subsystem of the - NUC910/NUC920 used in embedded systems. - -+config RTC_DRV_RTC7301 -+ tristate "Epson RTC-7301 SF/DG" -+ help -+ If you say Y here you will get support for the -+ Epson RTC-7301 SF/DG RTC chips. -+ -+ This driver can also be built as a module. If so, the module -+ will be called rtc-7301. -+ - comment "on-CPU RTC drivers" - - config RTC_DRV_DAVINCI ---- a/drivers/rtc/Makefile -+++ b/drivers/rtc/Makefile -@@ -115,6 +115,7 @@ obj-$(CONFIG_RTC_DRV_RP5C01) += rtc-rp5c - obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o - obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o - obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o -+obj-$(CONFIG_RTC_DRV_RTC7301) += rtc-rtc7301.o - obj-$(CONFIG_RTC_DRV_RV3029C2) += rtc-rv3029c2.o - obj-$(CONFIG_RTC_DRV_RX4581) += rtc-rx4581.o - obj-$(CONFIG_RTC_DRV_RX8025) += rtc-rx8025.o ---- /dev/null -+++ b/drivers/rtc/rtc-rtc7301.c -@@ -0,0 +1,219 @@ -+/* -+ * Driver for Epson RTC-7301SF/DG -+ * -+ * Copyright (C) 2009 Jose Vasconcellos -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define RTC_NAME "rtc7301" -+#define RTC_VERSION "0.1" -+ -+/* Epson RTC-7301 register addresses */ -+#define RTC7301_SEC 0x00 -+#define RTC7301_SEC10 0x01 -+#define RTC7301_MIN 0x02 -+#define RTC7301_MIN10 0x03 -+#define RTC7301_HOUR 0x04 -+#define RTC7301_HOUR10 0x05 -+#define RTC7301_WEEKDAY 0x06 -+#define RTC7301_DAY 0x07 -+#define RTC7301_DAY10 0x08 -+#define RTC7301_MON 0x09 -+#define RTC7301_MON10 0x0A -+#define RTC7301_YEAR 0x0B -+#define RTC7301_YEAR10 0x0C -+#define RTC7301_YEAR100 0x0D -+#define RTC7301_YEAR1000 0x0E -+#define RTC7301_CTRLREG 0x0F -+ -+static uint8_t __iomem *rtc7301_base; -+ -+#define read_reg(offset) (readb(rtc7301_base + offset) & 0xf) -+#define write_reg(offset, data) writeb(data, rtc7301_base + (offset)) -+ -+#define rtc7301_isbusy() (read_reg(RTC7301_CTRLREG) & 1) -+ -+static void rtc7301_init_settings(void) -+{ -+ int i; -+ -+ write_reg(RTC7301_CTRLREG, 2); -+ write_reg(RTC7301_YEAR1000, 2); -+ udelay(122); -+ -+ /* bank 1 */ -+ write_reg(RTC7301_CTRLREG, 6); -+ for (i=0; i<15; i++) -+ write_reg(i, 0); -+ -+ /* bank 2 */ -+ write_reg(RTC7301_CTRLREG, 14); -+ for (i=0; i<15; i++) -+ write_reg(i, 0); -+ write_reg(RTC7301_CTRLREG, 0); -+} -+ -+static int rtc7301_get_datetime(struct device *dev, struct rtc_time *dt) -+{ -+ int cnt; -+ uint8_t buf[16]; -+ -+ cnt = 0; -+ while (rtc7301_isbusy()) { -+ udelay(244); -+ if (cnt++ > 100) { -+ dev_err(dev, "%s: timeout error %x\n", __func__, rtc7301_base[RTC7301_CTRLREG]); -+ return -EIO; -+ } -+ } -+ -+ for (cnt=0; cnt<16; cnt++) -+ buf[cnt] = read_reg(cnt); -+ -+ if (buf[RTC7301_SEC10] & 8) { -+ dev_err(dev, "%s: RTC not set\n", __func__); -+ return -EINVAL; -+ } -+ -+ memset(dt, 0, sizeof(*dt)); -+ -+ dt->tm_sec = buf[RTC7301_SEC] + buf[RTC7301_SEC10]*10; -+ dt->tm_min = buf[RTC7301_MIN] + buf[RTC7301_MIN10]*10; -+ dt->tm_hour = buf[RTC7301_HOUR] + buf[RTC7301_HOUR10]*10; -+ -+ dt->tm_mday = buf[RTC7301_DAY] + buf[RTC7301_DAY10]*10; -+ dt->tm_mon = buf[RTC7301_MON] + buf[RTC7301_MON10]*10 - 1; -+ dt->tm_year = buf[RTC7301_YEAR] + buf[RTC7301_YEAR10]*10 + -+ buf[RTC7301_YEAR100]*100 + -+ ((buf[RTC7301_YEAR1000] & 3)*1000) - 1900; -+ -+ /* the rtc device may contain illegal values on power up -+ * according to the data sheet. make sure they are valid. -+ */ -+ -+ return rtc_valid_tm(dt); -+} -+ -+static int rtc7301_set_datetime(struct device *dev, struct rtc_time *dt) -+{ -+ int data; -+ -+ data = dt->tm_year + 1900; -+ if (data >= 2100 || data < 1900) -+ return -EINVAL; -+ -+ write_reg(RTC7301_CTRLREG, 2); -+ udelay(122); -+ -+ data = bin2bcd(dt->tm_sec); -+ write_reg(RTC7301_SEC, data); -+ write_reg(RTC7301_SEC10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_min); -+ write_reg(RTC7301_MIN, data ); -+ write_reg(RTC7301_MIN10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_hour); -+ write_reg(RTC7301_HOUR, data); -+ write_reg(RTC7301_HOUR10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_mday); -+ write_reg(RTC7301_DAY, data); -+ write_reg(RTC7301_DAY10, (data>> 4)); -+ -+ data = bin2bcd(dt->tm_mon + 1); -+ write_reg(RTC7301_MON, data); -+ write_reg(RTC7301_MON10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_year % 100); -+ write_reg(RTC7301_YEAR, data); -+ write_reg(RTC7301_YEAR10, (data >> 4)); -+ data = bin2bcd((1900 + dt->tm_year) / 100); -+ write_reg(RTC7301_YEAR100, data); -+ -+ data = bin2bcd(dt->tm_wday); -+ write_reg(RTC7301_WEEKDAY, data); -+ -+ write_reg(RTC7301_CTRLREG, 0); -+ -+ return 0; -+} -+ -+static const struct rtc_class_ops rtc7301_rtc_ops = { -+ .read_time = rtc7301_get_datetime, -+ .set_time = rtc7301_set_datetime, -+}; -+ -+static int rtc7301_probe(struct platform_device *pdev) -+{ -+ struct rtc_device *rtc; -+ struct resource *res; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) -+ return -ENOENT; -+ -+ rtc7301_base = ioremap_nocache(res->start, 0x1000 /*res->end - res->start + 1*/); -+ if (!rtc7301_base) -+ return -EINVAL; -+ -+ rtc = rtc_device_register(RTC_NAME, &pdev->dev, -+ &rtc7301_rtc_ops, THIS_MODULE); -+ if (IS_ERR(rtc)) { -+ iounmap(rtc7301_base); -+ return PTR_ERR(rtc); -+ } -+ -+ platform_set_drvdata(pdev, rtc); -+ -+ rtc7301_init_settings(); -+ return 0; -+} -+ -+static int rtc7301_remove(struct platform_device *pdev) -+{ -+ struct rtc_device *rtc = platform_get_drvdata(pdev); -+ -+ if (rtc) -+ rtc_device_unregister(rtc); -+ if (rtc7301_base) -+ iounmap(rtc7301_base); -+ return 0; -+} -+ -+static struct platform_driver rtc7301_driver = { -+ .driver = { -+ .name = RTC_NAME, -+ .owner = THIS_MODULE, -+ }, -+ .probe = rtc7301_probe, -+ .remove = rtc7301_remove, -+}; -+ -+static __init int rtc7301_init(void) -+{ -+ return platform_driver_register(&rtc7301_driver); -+} -+module_init(rtc7301_init); -+ -+static __exit void rtc7301_exit(void) -+{ -+ platform_driver_unregister(&rtc7301_driver); -+} -+module_exit(rtc7301_exit); -+ -+MODULE_DESCRIPTION("Epson 7301 RTC driver"); -+MODULE_AUTHOR("Jose Vasconcellos "); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:" RTC_NAME); -+MODULE_VERSION(RTC_VERSION); diff --git a/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch b/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch deleted file mode 100644 index 83b0232e1..000000000 --- a/target/linux/generic/pending-3.18/841-rtc_pt7c4338.patch +++ /dev/null @@ -1,247 +0,0 @@ ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -567,6 +567,15 @@ config RTC_DRV_S5M - This driver can also be built as a module. If so, the module - will be called rtc-s5m. - -+config RTC_DRV_PT7C4338 -+ tristate "Pericom Technology Inc. PT7C4338 RTC" -+ help -+ If you say yes here you get support for the Pericom Technology -+ Inc. PT7C4338 RTC chip. -+ -+ This driver can also be built as a module. If so, the module -+ will be called rtc-pt7c4338. -+ - endif # I2C - - comment "SPI RTC drivers" ---- a/drivers/rtc/Makefile -+++ b/drivers/rtc/Makefile -@@ -106,6 +106,7 @@ obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030 - obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o - obj-$(CONFIG_RTC_DRV_PM8XXX) += rtc-pm8xxx.o - obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o -+obj-$(CONFIG_RTC_DRV_PT7C4338) += rtc-pt7c4338.o - obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o - obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o - obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o ---- /dev/null -+++ b/drivers/rtc/rtc-pt7c4338.c -@@ -0,0 +1,216 @@ -+/* -+ * Copyright 2010 Freescale Semiconductor, Inc. -+ * -+ * Author: Priyanka Jain -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+/* -+ * This file provides Date & Time support (no alarms) for PT7C4338 chip. -+ * -+ * This file is based on drivers/rtc/rtc-ds1307.c -+ * -+ * PT7C4338 chip is manufactured by Pericom Technology Inc. -+ * It is a serial real-time clock which provides -+ * 1)Low-power clock/calendar. -+ * 2)Programmable square-wave output. -+ * It has 56 bytes of nonvolatile RAM. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* RTC register addresses */ -+#define PT7C4338_REG_SECONDS 0x00 -+#define PT7C4338_REG_MINUTES 0x01 -+#define PT7C4338_REG_HOURS 0x02 -+#define PT7C4338_REG_AMPM 0x02 -+#define PT7C4338_REG_DAY 0x03 -+#define PT7C4338_REG_DATE 0x04 -+#define PT7C4338_REG_MONTH 0x05 -+#define PT7C4338_REG_YEAR 0x06 -+#define PT7C4338_REG_CTRL_STAT 0x07 -+ -+/* RTC second register address bit */ -+#define PT7C4338_SEC_BIT_CH 0x80 /*Clock Halt (in Register 0)*/ -+ -+/* RTC control and status register bits */ -+#define PT7C4338_CTRL_STAT_BIT_RS0 0x1 /*Rate select 0*/ -+#define PT7C4338_CTRL_STAT_BIT_RS1 0x2 /*Rate select 1*/ -+#define PT7C4338_CTRL_STAT_BIT_SQWE 0x10 /*Square Wave Enable*/ -+#define PT7C4338_CTRL_STAT_BIT_OSF 0x20 /*Oscillator Stop Flag*/ -+#define PT7C4338_CTRL_STAT_BIT_OUT 0x80 /*Output Level Control*/ -+ -+static const struct i2c_device_id pt7c4338_id[] = { -+ { "pt7c4338", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, pt7c4338_id); -+ -+struct pt7c4338{ -+ struct i2c_client *client; -+ struct rtc_device *rtc; -+}; -+ -+static int pt7c4338_read_time(struct device *dev, struct rtc_time *time) -+{ -+ struct i2c_client *client = to_i2c_client(dev); -+ int ret; -+ u8 buf[7]; -+ u8 year, month, day, hour, minute, second; -+ u8 week, twelve_hr, am_pm; -+ -+ ret = i2c_smbus_read_i2c_block_data(client, -+ PT7C4338_REG_SECONDS, 7, buf); -+ if (ret < 0) -+ return ret; -+ if (ret < 7) -+ return -EIO; -+ -+ second = buf[0]; -+ minute = buf[1]; -+ hour = buf[2]; -+ week = buf[3]; -+ day = buf[4]; -+ month = buf[5]; -+ year = buf[6]; -+ -+ /* Extract additional information for AM/PM */ -+ twelve_hr = hour & 0x40; -+ am_pm = hour & 0x20; -+ -+ /* Write to rtc_time structure */ -+ time->tm_sec = bcd2bin(second & 0x7f); -+ time->tm_min = bcd2bin(minute & 0x7f); -+ if (twelve_hr) { -+ /* Convert to 24 hr */ -+ if (am_pm) -+ time->tm_hour = bcd2bin(hour & 0x10) + 12; -+ else -+ time->tm_hour = bcd2bin(hour & 0xBF); -+ } else { -+ time->tm_hour = bcd2bin(hour); -+ } -+ -+ time->tm_wday = bcd2bin(week & 0x07) - 1; -+ time->tm_mday = bcd2bin(day & 0x3f); -+ time->tm_mon = bcd2bin(month & 0x1F) - 1; -+ /* assume 20YY not 19YY */ -+ time->tm_year = bcd2bin(year) + 100; -+ -+ return 0; -+} -+ -+static int pt7c4338_set_time(struct device *dev, struct rtc_time *time) -+{ -+ struct i2c_client *client = to_i2c_client(dev); -+ u8 buf[7]; -+ -+ /* Extract time from rtc_time and load into pt7c4338*/ -+ buf[0] = bin2bcd(time->tm_sec); -+ buf[1] = bin2bcd(time->tm_min); -+ buf[2] = bin2bcd(time->tm_hour); -+ buf[3] = bin2bcd(time->tm_wday + 1); /* Day of the week */ -+ buf[4] = bin2bcd(time->tm_mday); /* Date */ -+ buf[5] = bin2bcd(time->tm_mon + 1); -+ -+ /* assume 20YY not 19YY */ -+ if (time->tm_year >= 100) -+ buf[6] = bin2bcd(time->tm_year - 100); -+ else -+ buf[6] = bin2bcd(time->tm_year); -+ -+ return i2c_smbus_write_i2c_block_data(client, -+ PT7C4338_REG_SECONDS, 7, buf); -+} -+ -+static const struct rtc_class_ops pt7c4338_rtc_ops = { -+ .read_time = pt7c4338_read_time, -+ .set_time = pt7c4338_set_time, -+}; -+ -+static int pt7c4338_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct pt7c4338 *pt7c4338; -+ struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); -+ int ret; -+ -+ pt7c4338 = kzalloc(sizeof(struct pt7c4338), GFP_KERNEL); -+ if (!pt7c4338) -+ return -ENOMEM; -+ -+ pt7c4338->client = client; -+ i2c_set_clientdata(client, pt7c4338); -+ pt7c4338->rtc = rtc_device_register(client->name, &client->dev, -+ &pt7c4338_rtc_ops, THIS_MODULE); -+ if (IS_ERR(pt7c4338->rtc)) { -+ ret = PTR_ERR(pt7c4338->rtc); -+ dev_err(&client->dev, "unable to register the class device\n"); -+ goto out_free; -+ } -+ -+ return 0; -+out_free: -+ i2c_set_clientdata(client, NULL); -+ kfree(pt7c4338); -+ return ret; -+} -+ -+static int pt7c4338_remove(struct i2c_client *client) -+{ -+ struct pt7c4338 *pt7c4338 = i2c_get_clientdata(client); -+ -+ rtc_device_unregister(pt7c4338->rtc); -+ i2c_set_clientdata(client, NULL); -+ kfree(pt7c4338); -+ return 0; -+} -+ -+static struct i2c_driver pt7c4338_driver = { -+ .driver = { -+ .name = "rtc-pt7c4338", -+ .owner = THIS_MODULE, -+ }, -+ .probe = pt7c4338_probe, -+ .remove = pt7c4338_remove, -+ .id_table = pt7c4338_id, -+}; -+ -+static int __init pt7c4338_init(void) -+{ -+ return i2c_add_driver(&pt7c4338_driver); -+} -+ -+static void __exit pt7c4338_exit(void) -+{ -+ i2c_del_driver(&pt7c4338_driver); -+} -+ -+module_init(pt7c4338_init); -+module_exit(pt7c4338_exit); -+ -+MODULE_AUTHOR("Priyanka Jain "); -+MODULE_DESCRIPTION("pericom Technology Inc. PT7C4338 RTC Driver"); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch b/target/linux/generic/pending-3.18/861-04_spi_gpio_implement_spi_delay.patch deleted file mode 100644 index e7b32a50b..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -73,6 +74,7 @@ struct spi_gpio { - * #define SPI_MOSI_GPIO 120 - * #define SPI_SCK_GPIO 121 - * #define SPI_N_CHIPSEL 4 -+ * #undef NEED_SPIDELAY - * #include "spi-gpio.c" - */ - -@@ -80,6 +82,7 @@ struct spi_gpio { - #define DRIVER_NAME "spi_gpio" - - #define GENERIC_BITBANG /* vs tight inlines */ -+#define NEED_SPIDELAY 1 - - /* all functions referencing these symbols must define pdata */ - #define SPI_MISO_GPIO ((pdata)->miso) -@@ -130,12 +133,20 @@ static inline int getmiso(const struct s - #undef pdata - - /* -- * NOTE: this clocks "as fast as we can". It "should" be a function of the -- * requested device clock. Software overhead means we usually have trouble -- * reaching even one Mbit/sec (except when we can inline bitops), so for now -- * we'll just assume we never need additional per-bit slowdowns. -+ * NOTE: to clock "as fast as we can", set spi_device.max_speed_hz -+ * and spi_transfer.speed_hz to 0. -+ * Otherwise this is a function of the requested device clock. -+ * Software overhead means we usually have trouble -+ * reaching even one Mbit/sec (except when we can inline bitops). So on small -+ * embedded devices with fast SPI slaves you usually don't need a delay. - */ --#define spidelay(nsecs) do {} while (0) -+static inline void spidelay(unsigned nsecs) -+{ -+#ifdef NEED_SPIDELAY -+ if (unlikely(nsecs)) -+ ndelay(nsecs); -+#endif /* NEED_SPIDELAY */ -+} - - #include "spi-bitbang-txrx.h" - diff --git a/target/linux/generic/pending-3.18/862-gpio_spi_driver.patch b/target/linux/generic/pending-3.18/862-gpio_spi_driver.patch deleted file mode 100644 index 70bf11f8f..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -225,6 +225,15 @@ config SPI_GPIO - GPIO operations, you should be able to leverage that for better - speed with a custom version of this driver; see the source code. - -+config SPI_GPIO_OLD -+ tristate "Old GPIO API based bitbanging SPI controller (DEPRECATED)" -+ depends on SPI_MASTER && GPIOLIB -+ select SPI_BITBANG -+ help -+ This code is deprecated. Please use the new mainline SPI-GPIO driver. -+ -+ If unsure, say N. -+ - config SPI_IMX - tristate "Freescale i.MX SPI controllers" - depends on ARCH_MXC || COMPILE_TEST ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -40,6 +40,7 @@ obj-$(CONFIG_SPI_FSL_LIB) += spi-fsl-li - obj-$(CONFIG_SPI_FSL_ESPI) += spi-fsl-espi.o - obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o - obj-$(CONFIG_SPI_GPIO) += spi-gpio.o -+obj-$(CONFIG_SPI_GPIO_OLD) += spi_gpio_old.o - obj-$(CONFIG_SPI_IMX) += spi-imx.o - obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o - obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o diff --git a/target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch b/target/linux/generic/pending-3.18/870-hifn795x_byteswap.patch deleted file mode 100644 index 3a37c951e..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/890-8250_optional_sysrq.patch b/target/linux/generic/pending-3.18/890-8250_optional_sysrq.patch deleted file mode 100644 index 8815e4c64..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/901-debloat_sock_diag.patch b/target/linux/generic/pending-3.18/901-debloat_sock_diag.patch deleted file mode 100644 index 41c9220a6..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -419,6 +419,7 @@ config INET_LRO - - config INET_DIAG - tristate "INET: socket monitoring interface" -+ select SOCK_DIAG - default y - ---help--- - Support for INET (TCP, DCCP, etc) socket monitoring interface used by ---- a/net/unix/Kconfig -+++ b/net/unix/Kconfig -@@ -22,6 +22,7 @@ config UNIX - config UNIX_DIAG - tristate "UNIX: socket monitoring interface" - depends on UNIX -+ select SOCK_DIAG - default n - ---help--- - Support for UNIX socket monitoring interface used by the ss tool. ---- a/net/netlink/Kconfig -+++ b/net/netlink/Kconfig -@@ -4,6 +4,7 @@ - - config NETLINK_DIAG - tristate "NETLINK: socket monitoring interface" -+ select SOCK_DIAG - default n - ---help--- - Support for NETLINK socket monitoring interface used by the ss tool. ---- a/net/packet/Kconfig -+++ b/net/packet/Kconfig -@@ -18,6 +18,7 @@ config PACKET - config PACKET_DIAG - tristate "Packet: sockets monitoring interface" - depends on PACKET -+ select SOCK_DIAG - default n - ---help--- - Support for PF_PACKET sockets monitoring interface used by the ss tool. diff --git a/target/linux/generic/pending-3.18/902-debloat_proc.patch b/target/linux/generic/pending-3.18/902-debloat_proc.patch deleted file mode 100644 index 596a84f8d..000000000 --- a/target/linux/generic/pending-3.18/902-debloat_proc.patch +++ /dev/null @@ -1,341 +0,0 @@ ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -2620,6 +2620,8 @@ static const struct file_operations proc - - static int __init proc_locks_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("locks", 0, NULL, &proc_locks_operations); - return 0; - } ---- a/fs/proc/Kconfig -+++ b/fs/proc/Kconfig -@@ -71,3 +71,8 @@ config PROC_PAGE_MONITOR - /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap, - /proc/kpagecount, and /proc/kpageflags. Disabling these - interfaces will reduce the size of the kernel by approximately 4kb. -+ -+config PROC_STRIPPED -+ default n -+ depends on EXPERT -+ bool "Strip non-essential /proc functionality to reduce code size" ---- a/fs/proc/consoles.c -+++ b/fs/proc/consoles.c -@@ -106,6 +106,9 @@ static const struct file_operations proc - - static int __init proc_consoles_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - proc_create("consoles", 0, NULL, &proc_consoles_operations); - return 0; - } ---- a/fs/proc/proc_tty.c -+++ b/fs/proc/proc_tty.c -@@ -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 -@@ -176,6 +176,8 @@ static const struct file_operations exec - - static int __init proc_execdomains_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("execdomains", 0, NULL, &execdomains_proc_fops); - return 0; - } ---- a/kernel/irq/proc.c -+++ b/kernel/irq/proc.c -@@ -330,6 +330,9 @@ void register_irq_proc(unsigned int irq, - static DEFINE_MUTEX(register_lock); - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) - return; - -@@ -379,6 +382,9 @@ void unregister_irq_proc(unsigned int ir - { - char name [MAX_NAMELEN]; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - if (!root_irq_dir || !desc->dir) - return; - #ifdef CONFIG_SMP -@@ -414,6 +420,9 @@ void init_irq_proc(void) - unsigned int irq; - struct irq_desc *desc; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP)) -+ return; -+ - /* create /proc/irq */ - root_irq_dir = proc_mkdir("irq", NULL); - if (!root_irq_dir) ---- a/kernel/time/timer_list.c -+++ b/kernel/time/timer_list.c -@@ -362,6 +362,8 @@ static int __init init_timer_list_procfs - { - struct proc_dir_entry *pe; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - pe = proc_create("timer_list", 0444, NULL, &timer_list_fops); - if (!pe) - return -ENOMEM; ---- a/mm/vmalloc.c -+++ b/mm/vmalloc.c -@@ -2662,6 +2662,8 @@ static const struct file_operations proc - - static int __init proc_vmalloc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); - return 0; - } ---- a/mm/vmstat.c -+++ b/mm/vmstat.c -@@ -1424,10 +1424,12 @@ static int __init setup_vmstat(void) - cpu_notifier_register_done(); - #endif - #ifdef CONFIG_PROC_FS -- proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); -- proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); -+ proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); -+ proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); -+ } - proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); -- proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); - #endif - return 0; - } ---- a/net/8021q/vlanproc.c -+++ b/net/8021q/vlanproc.c -@@ -127,6 +127,9 @@ void vlan_proc_cleanup(struct net *net) - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (vn->proc_vlan_conf) - remove_proc_entry(name_conf, vn->proc_vlan_dir); - -@@ -146,6 +149,9 @@ int __net_init vlan_proc_init(struct net - { - struct vlan_net *vn = net_generic(net, vlan_net_id); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - vn->proc_vlan_dir = proc_net_mkdir(net, name_root, net->proc_net); - if (!vn->proc_vlan_dir) - goto err; ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -2939,6 +2939,8 @@ static __net_initdata struct pernet_oper - - static int __init proto_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; - return register_pernet_subsys(&proto_net_ops); - } - ---- a/net/ipv4/fib_trie.c -+++ b/net/ipv4/fib_trie.c -@@ -2490,10 +2490,12 @@ static const struct file_operations fib_ - - int __net_init fib_proc_init(struct net *net) - { -- if (!proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("fib_trie", S_IRUGO, net->proc_net, &fib_trie_fops)) - goto out1; - -- if (!proc_create("fib_triestat", S_IRUGO, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("fib_triestat", S_IRUGO, net->proc_net, - &fib_triestat_fops)) - goto out2; - -@@ -2503,17 +2505,21 @@ int __net_init fib_proc_init(struct net - return 0; - - out3: -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_triestat", net->proc_net); - out2: -- remove_proc_entry("fib_trie", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("fib_trie", net->proc_net); - out1: - return -ENOMEM; - } - - void __net_exit fib_proc_exit(struct net *net) - { -- remove_proc_entry("fib_trie", net->proc_net); -- remove_proc_entry("fib_triestat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("fib_trie", net->proc_net); -+ remove_proc_entry("fib_triestat", net->proc_net); -+ } - remove_proc_entry("route", net->proc_net); - } - ---- a/net/ipv4/proc.c -+++ b/net/ipv4/proc.c -@@ -524,6 +524,9 @@ static __net_initdata struct pernet_oper - - int __init ip_misc_proc_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - return register_pernet_subsys(&ip_proc_ops); - } - ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -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 -@@ -1072,6 +1072,9 @@ void __init msg_init(void) - printk(KERN_INFO "msgmni has been set to %d\n", - init_ipc_ns.msg_ctlmni); - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ipc_init_proc_interface("sysvipc/msg", - " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n", - IPC_MSG_IDS, sysvipc_msg_proc_show); ---- a/ipc/sem.c -+++ b/ipc/sem.c -@@ -191,6 +191,8 @@ void sem_exit_ns(struct ipc_namespace *n - void __init sem_init(void) - { - sem_init_ns(&init_ipc_ns); -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/sem", - " key semid perms nsems uid gid cuid cgid otime ctime\n", - IPC_SEM_IDS, sysvipc_sem_proc_show); ---- a/ipc/shm.c -+++ b/ipc/shm.c -@@ -118,6 +118,8 @@ pure_initcall(ipc_ns_init); - - void __init shm_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; - ipc_init_proc_interface("sysvipc/shm", - #if BITS_PER_LONG <= 32 - " key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n", ---- a/ipc/util.c -+++ b/ipc/util.c -@@ -161,6 +161,9 @@ void __init ipc_init_proc_interface(cons - struct proc_dir_entry *pde; - struct ipc_proc_iface *iface; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - iface = kmalloc(sizeof(*iface), GFP_KERNEL); - if (!iface) - return; ---- a/net/core/net-procfs.c -+++ b/net/core/net-procfs.c -@@ -318,10 +318,12 @@ static int __net_init dev_proc_net_init( - - if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops)) - goto out; -- if (!proc_create("softnet_stat", S_IRUGO, net->proc_net, -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("softnet_stat", S_IRUGO, net->proc_net, - &softnet_seq_fops)) - goto out_dev; -- if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) && -+ !proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops)) - goto out_softnet; - - if (wext_proc_init(net)) -@@ -330,9 +332,11 @@ static int __net_init dev_proc_net_init( - out: - return rc; - out_ptype: -- remove_proc_entry("ptype", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("ptype", net->proc_net); - out_softnet: -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ remove_proc_entry("softnet_stat", net->proc_net); - out_dev: - remove_proc_entry("dev", net->proc_net); - goto out; -@@ -342,8 +346,10 @@ static void __net_exit dev_proc_net_exit - { - wext_proc_exit(net); - -- remove_proc_entry("ptype", net->proc_net); -- remove_proc_entry("softnet_stat", net->proc_net); -+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) { -+ remove_proc_entry("ptype", net->proc_net); -+ remove_proc_entry("softnet_stat", net->proc_net); -+ } - remove_proc_entry("dev", net->proc_net); - } - diff --git a/target/linux/generic/pending-3.18/904-debloat_dma_buf.patch b/target/linux/generic/pending-3.18/904-debloat_dma_buf.patch deleted file mode 100644 index a5e0be249..000000000 --- a/target/linux/generic/pending-3.18/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 *); - -@@ -904,4 +905,5 @@ static void __exit dma_buf_deinit(void) - { - dma_buf_uninit_debugfs(); - } --__exitcall(dma_buf_deinit); -+module_exit(dma_buf_deinit); -+MODULE_LICENSE("GPL"); ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1823,6 +1823,7 @@ int wake_up_state(struct task_struct *p, - { - return try_to_wake_up(p, state, 0); - } -+EXPORT_SYMBOL_GPL(wake_up_state); - - /* - * This function clears the sched_dl_entity static params. diff --git a/target/linux/generic/pending-3.18/910-kobject_uevent.patch b/target/linux/generic/pending-3.18/910-kobject_uevent.patch deleted file mode 100644 index f69294b4f..000000000 --- a/target/linux/generic/pending-3.18/910-kobject_uevent.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/lib/kobject_uevent.c -+++ b/lib/kobject_uevent.c -@@ -53,6 +53,18 @@ static const char *kobject_actions[] = { - [KOBJ_OFFLINE] = "offline", - }; - -+u64 uevent_next_seqnum(void) -+{ -+ u64 seq; -+ -+ mutex_lock(&uevent_sock_mutex); -+ seq = ++uevent_seqnum; -+ mutex_unlock(&uevent_sock_mutex); -+ -+ return seq; -+} -+EXPORT_SYMBOL_GPL(uevent_next_seqnum); -+ - /** - * kobject_action_type - translate action string to numeric type - * diff --git a/target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/pending-3.18/911-kobject_add_broadcast_uevent.patch deleted file mode 100644 index 6e4c14029..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -424,6 +424,43 @@ int add_uevent_var(struct kobj_uevent_en - EXPORT_SYMBOL_GPL(add_uevent_var); - - #if defined(CONFIG_NET) -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation) -+{ -+ struct uevent_sock *ue_sk; -+ int err = 0; -+ -+ /* send netlink message */ -+ mutex_lock(&uevent_sock_mutex); -+ list_for_each_entry(ue_sk, &uevent_sock_list, list) { -+ struct sock *uevent_sock = ue_sk->sk; -+ struct sk_buff *skb2; -+ -+ skb2 = skb_clone(skb, allocation); -+ if (!skb2) -+ break; -+ -+ err = netlink_broadcast(uevent_sock, skb2, pid, group, -+ allocation); -+ if (err) -+ break; -+ } -+ mutex_unlock(&uevent_sock_mutex); -+ -+ kfree_skb(skb); -+ return err; -+} -+#else -+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group, -+ gfp_t allocation) -+{ -+ kfree_skb(skb); -+ return 0; -+} -+#endif -+EXPORT_SYMBOL_GPL(broadcast_uevent); -+ -+#if defined(CONFIG_NET) - static int uevent_net_init(struct net *net) - { - struct uevent_sock *ue_sk; diff --git a/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch b/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch deleted file mode 100644 index 57c2fe27b..000000000 --- a/target/linux/generic/pending-3.18/921-use_preinit_as_init.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -963,7 +963,8 @@ static int __ref kernel_init(void *unuse - pr_err("Failed to execute %s (error %d). Attempting defaults...\n", - execute_command, ret); - } -- if (!try_to_run_init_process("/sbin/init") || -+ if (!try_to_run_init_process("/etc/preinit") || -+ !try_to_run_init_process("/sbin/init") || - !try_to_run_init_process("/etc/init") || - !try_to_run_init_process("/bin/init") || - !try_to_run_init_process("/bin/sh")) diff --git a/target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch b/target/linux/generic/pending-3.18/922-always-create-console-node-in-initramfs.patch deleted file mode 100644 index 988de35ce..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/930-crashlog.patch b/target/linux/generic/pending-3.18/930-crashlog.patch deleted file mode 100644 index 9b0eb732d..000000000 --- a/target/linux/generic/pending-3.18/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 -@@ -1279,6 +1279,10 @@ config RELAY - - If unsure, say N. - -+config CRASHLOG -+ bool "Crash logging" -+ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK) && !(ARM || SPARC || PPC) -+ - config BLK_DEV_INITRD - bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" - depends on BROKEN || !FRV ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -96,6 +96,7 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o - obj-$(CONFIG_JUMP_LABEL) += jump_label.o - obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o - obj-$(CONFIG_TORTURE_TEST) += torture.o -+obj-$(CONFIG_CRASHLOG) += crashlog.o - - $(obj)/configs.o: $(obj)/config_data.h - ---- /dev/null -+++ b/kernel/crashlog.c -@@ -0,0 +1,181 @@ -+/* -+ * Crash information logger -+ * Copyright (C) 2010 Felix Fietkau -+ * -+ * Based on ramoops.c -+ * Copyright (C) 2010 Marco Stornelli -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -+ * 02110-1301 USA -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define CRASHLOG_PAGES 4 -+#define CRASHLOG_SIZE (CRASHLOG_PAGES * PAGE_SIZE) -+#define CRASHLOG_MAGIC 0xa1eedead -+ -+/* -+ * Start the log at 1M before the end of RAM, as some boot loaders like -+ * to use the end of the RAM for stack usage and other things -+ * If this fails, fall back to using the last part. -+ */ -+#define CRASHLOG_OFFSET (1024 * 1024) -+ -+struct crashlog_data { -+ u32 magic; -+ u32 len; -+ u8 data[]; -+}; -+ -+static struct debugfs_blob_wrapper crashlog_blob; -+static unsigned long crashlog_addr = 0; -+static struct crashlog_data *crashlog_buf; -+static struct kmsg_dumper dump; -+static bool first = true; -+ -+extern struct list_head *crashlog_modules; -+ -+#ifndef CONFIG_NO_BOOTMEM -+void __init crashlog_init_bootmem(bootmem_data_t *bdata) -+{ -+ unsigned long addr; -+ -+ if (crashlog_addr) -+ return; -+ -+ addr = PFN_PHYS(bdata->node_low_pfn) - CRASHLOG_OFFSET; -+ if (reserve_bootmem(addr, CRASHLOG_SIZE, BOOTMEM_EXCLUSIVE) < 0) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", addr); -+ bdata->node_low_pfn -= CRASHLOG_PAGES; -+ addr = PFN_PHYS(bdata->node_low_pfn); -+ } -+ crashlog_addr = addr; -+} -+#endif -+ -+#ifdef CONFIG_HAVE_MEMBLOCK -+void __init_memblock crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+ if (crashlog_addr) -+ return; -+ -+ addr += size - CRASHLOG_OFFSET; -+ if (memblock_reserve(addr, CRASHLOG_SIZE)) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", (unsigned long) addr); -+ return; -+ } -+ -+ crashlog_addr = addr; -+} -+#endif -+ -+static void __init crashlog_copy(void) -+{ -+ if (crashlog_buf->magic != CRASHLOG_MAGIC) -+ return; -+ -+ if (!crashlog_buf->len || crashlog_buf->len > -+ CRASHLOG_SIZE - sizeof(*crashlog_buf)) -+ return; -+ -+ crashlog_blob.size = crashlog_buf->len; -+ crashlog_blob.data = kmemdup(crashlog_buf->data, -+ crashlog_buf->len, GFP_KERNEL); -+ -+ debugfs_create_blob("crashlog", 0700, NULL, &crashlog_blob); -+} -+ -+static int get_maxlen(void) -+{ -+ return CRASHLOG_SIZE - sizeof(*crashlog_buf) - crashlog_buf->len; -+} -+ -+static void crashlog_printf(const char *fmt, ...) -+{ -+ va_list args; -+ int len = get_maxlen(); -+ -+ if (!len) -+ return; -+ -+ va_start(args, fmt); -+ crashlog_buf->len += vscnprintf( -+ &crashlog_buf->data[crashlog_buf->len], -+ len, fmt, args); -+ va_end(args); -+} -+ -+static void crashlog_do_dump(struct kmsg_dumper *dumper, -+ enum kmsg_dump_reason reason) -+{ -+ struct timeval tv; -+ struct module *m; -+ char *buf; -+ size_t len; -+ -+ if (!first) -+ crashlog_printf("\n===================================\n"); -+ -+ do_gettimeofday(&tv); -+ crashlog_printf("Time: %lu.%lu\n", -+ (long)tv.tv_sec, (long)tv.tv_usec); -+ -+ if (first) { -+ crashlog_printf("Modules:"); -+ list_for_each_entry(m, crashlog_modules, list) { -+ crashlog_printf("\t%s@%p+%x", m->name, -+ m->module_core, m->core_size, -+ m->module_init, m->init_size); -+ } -+ crashlog_printf("\n"); -+ first = false; -+ } -+ -+ buf = (char *)&crashlog_buf->data[crashlog_buf->len]; -+ -+ kmsg_dump_get_buffer(dumper, true, buf, get_maxlen(), &len); -+ -+ crashlog_buf->len += len; -+} -+ -+ -+int __init crashlog_init_fs(void) -+{ -+ if (!crashlog_addr) -+ return -ENOMEM; -+ -+ crashlog_buf = ioremap(crashlog_addr, CRASHLOG_SIZE); -+ -+ crashlog_copy(); -+ -+ crashlog_buf->magic = CRASHLOG_MAGIC; -+ crashlog_buf->len = 0; -+ -+ dump.max_reason = KMSG_DUMP_OOPS; -+ dump.dump = crashlog_do_dump; -+ kmsg_dump_register(&dump); -+ -+ return 0; -+} -+module_init(crashlog_init_fs); ---- a/mm/bootmem.c -+++ b/mm/bootmem.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -177,6 +178,7 @@ static unsigned long __init free_all_boo - if (!bdata->node_bootmem_map) - return 0; - -+ crashlog_init_bootmem(bdata); - map = bdata->node_bootmem_map; - start = bdata->node_min_pfn; - end = bdata->node_low_pfn; ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -105,6 +105,9 @@ static LIST_HEAD(modules); - #ifdef CONFIG_KGDB_KDB - struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ - #endif /* CONFIG_KGDB_KDB */ -+#ifdef CONFIG_CRASHLOG -+struct list_head *crashlog_modules = &modules; -+#endif - - #ifdef CONFIG_MODULE_SIG - #ifdef CONFIG_MODULE_SIG_FORCE ---- a/mm/memblock.c -+++ b/mm/memblock.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -477,6 +478,8 @@ static void __init_memblock memblock_ins - memblock_set_region_node(rgn, nid); - type->cnt++; - type->total_size += size; -+ if (type == &memblock.memory && idx == 0) -+ crashlog_init_memblock(base, size); - } - - /** diff --git a/target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch b/target/linux/generic/pending-3.18/970-remove-unsane-filenames-from-deps_initramfs-list.patch deleted file mode 100644 index ac13c9e67..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/980-arm_openwrt_machtypes.patch b/target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch deleted file mode 100644 index 5e9718b61..000000000 --- a/target/linux/generic/pending-3.18/980-arm_openwrt_machtypes.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/arch/arm/tools/mach-types -+++ b/arch/arm/tools/mach-types -@@ -1007,3 +1007,29 @@ eco5_bx2 MACH_ECO5_BX2 ECO5_BX2 4572 - eukrea_cpuimx28sd MACH_EUKREA_CPUIMX28SD EUKREA_CPUIMX28SD 4573 - domotab MACH_DOMOTAB DOMOTAB 4574 - pfla03 MACH_PFLA03 PFLA03 4575 -+# -+# Additional mach-types supported by OpenWrt -+# -+wg302v1 MACH_WG302V1 WG302V1 889 -+pronghorn MACH_PRONGHORN PRONGHORN 928 -+pronghorn_metro MACH_PRONGHORNMETRO PRONGHORNMETRO 1040 -+sidewinder MACH_SIDEWINDER SIDEWINDER 1041 -+wrt300nv2 MACH_WRT300NV2 WRT300NV2 1077 -+compex42x MACH_COMPEXWP18 COMPEXWP18 1273 -+goldfish MACH_GOLDFISH GOLDFISH 1441 -+cambria MACH_CAMBRIA CAMBRIA 1468 -+dt2 MACH_DT2 DT2 1514 -+ap1000 MACH_AP1000 AP1000 1543 -+tw2662 MACH_TW2662 TW2662 1658 -+tw5334 MACH_TW5334 TW5334 1664 -+usr8200 MACH_USR8200 USR8200 1762 -+mi424wr MACH_MI424WR MI424WR 1778 -+gw2388 MACH_GW2388 GW2388 2635 -+iconnect MACH_ICONNECT ICONNECT 2870 -+nsb3ast MACH_NSB3AST NSB3AST 2917 -+goflexnet MACH_GOFLEXNET GOFLEXNET 3089 -+nas6210 MACH_NAS6210 NAS6210 3104 -+ns_k330 MACH_NS_K330 NS_K330 3108 -+bcm2708 MACH_BCM2708 BCM2708 3138 -+wn802t MACH_WN802T WN802T 3306 -+nsa310 MACH_NSA310 NSA310 4022 diff --git a/target/linux/generic/pending-3.18/990-gpio_wdt.patch b/target/linux/generic/pending-3.18/990-gpio_wdt.patch deleted file mode 100644 index 47422734f..000000000 --- a/target/linux/generic/pending-3.18/990-gpio_wdt.patch +++ /dev/null @@ -1,360 +0,0 @@ -This generic GPIO watchdog is used on Huawei E970 (brcm47xx) - -Signed-off-by: Mathias Adam - ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -1139,6 +1139,15 @@ config WDT_MTX1 - Hardware driver for the MTX-1 boards. This is a watchdog timer that - will reboot the machine after a 100 seconds timer expired. - -+config GPIO_WDT -+ tristate "GPIO Hardware Watchdog" -+ help -+ Hardware driver for GPIO-controlled watchdogs. GPIO pin and -+ toggle interval settings are platform-specific. The driver -+ will stop toggling the GPIO (i.e. machine reboots) after a -+ 100 second timer expired and no process has written to -+ /dev/watchdog during that time. -+ - config PNX833X_WDT - tristate "PNX833x Hardware Watchdog" - depends on SOC_PNX8335 ---- a/drivers/watchdog/Makefile -+++ b/drivers/watchdog/Makefile -@@ -134,6 +134,7 @@ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt - obj-$(CONFIG_INDYDOG) += indydog.o - obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o - obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o -+obj-$(CONFIG_GPIO_WDT) += old_gpio_wdt.o - obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o - obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o - obj-$(CONFIG_AR7_WDT) += ar7_wdt.o ---- /dev/null -+++ b/drivers/watchdog/old_gpio_wdt.c -@@ -0,0 +1,301 @@ -+/* -+ * Driver for GPIO-controlled Hardware Watchdogs. -+ * -+ * Copyright (C) 2013 Mathias Adam -+ * -+ * Replaces mtx1_wdt (driver for the MTX-1 Watchdog): -+ * -+ * (C) Copyright 2005 4G Systems , -+ * All Rights Reserved. -+ * http://www.4g-systems.biz -+ * -+ * (C) Copyright 2007 OpenWrt.org, Florian Fainelli -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version -+ * 2 of the License, or (at your option) any later version. -+ * -+ * Neither Michael Stickel nor 4G Systems admit liability nor provide -+ * warranty for any of this software. This material is provided -+ * "AS-IS" and at no charge. -+ * -+ * (c) Copyright 2005 4G Systems -+ * -+ * Release 0.01. -+ * Author: Michael Stickel michael.stickel@4g-systems.biz -+ * -+ * Release 0.02. -+ * Author: Florian Fainelli florian@openwrt.org -+ * use the Linux watchdog/timer APIs -+ * -+ * Release 0.03. -+ * Author: Mathias Adam -+ * make it a generic gpio watchdog driver -+ * -+ * The Watchdog is configured to reset the MTX-1 -+ * if it is not triggered for 100 seconds. -+ * It should not be triggered more often than 1.6 seconds. -+ * -+ * A timer triggers the watchdog every 5 seconds, until -+ * it is opened for the first time. After the first open -+ * it MUST be triggered every 2..95 seconds. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int ticks = 100 * HZ; -+ -+static struct { -+ struct completion stop; -+ spinlock_t lock; -+ int running; -+ struct timer_list timer; -+ int queue; -+ int default_ticks; -+ unsigned long inuse; -+ unsigned gpio; -+ unsigned int gstate; -+ int interval; -+ int first_interval; -+} gpio_wdt_device; -+ -+static void gpio_wdt_trigger(unsigned long unused) -+{ -+ spin_lock(&gpio_wdt_device.lock); -+ if (gpio_wdt_device.running && ticks > 0) -+ ticks -= gpio_wdt_device.interval; -+ -+ /* toggle wdt gpio */ -+ gpio_wdt_device.gstate = !gpio_wdt_device.gstate; -+ gpio_set_value(gpio_wdt_device.gpio, gpio_wdt_device.gstate); -+ -+ if (gpio_wdt_device.queue && ticks > 0) -+ mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.interval); -+ else -+ complete(&gpio_wdt_device.stop); -+ spin_unlock(&gpio_wdt_device.lock); -+} -+ -+static void gpio_wdt_reset(void) -+{ -+ ticks = gpio_wdt_device.default_ticks; -+} -+ -+ -+static void gpio_wdt_start(void) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&gpio_wdt_device.lock, flags); -+ if (!gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 1; -+ gpio_wdt_device.gstate = 1; -+ gpio_set_value(gpio_wdt_device.gpio, 1); -+ mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.first_interval); -+ } -+ gpio_wdt_device.running++; -+ spin_unlock_irqrestore(&gpio_wdt_device.lock, flags); -+} -+ -+static int gpio_wdt_stop(void) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&gpio_wdt_device.lock, flags); -+ if (gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 0; -+ gpio_wdt_device.gstate = 0; -+ gpio_set_value(gpio_wdt_device.gpio, 0); -+ } -+ ticks = gpio_wdt_device.default_ticks; -+ spin_unlock_irqrestore(&gpio_wdt_device.lock, flags); -+ return 0; -+} -+ -+/* Filesystem functions */ -+ -+static int gpio_wdt_open(struct inode *inode, struct file *file) -+{ -+ if (test_and_set_bit(0, &gpio_wdt_device.inuse)) -+ return -EBUSY; -+ return nonseekable_open(inode, file); -+} -+ -+ -+static int gpio_wdt_release(struct inode *inode, struct file *file) -+{ -+ clear_bit(0, &gpio_wdt_device.inuse); -+ return 0; -+} -+ -+static long gpio_wdt_ioctl(struct file *file, unsigned int cmd, -+ unsigned long arg) -+{ -+ void __user *argp = (void __user *)arg; -+ int __user *p = (int __user *)argp; -+ unsigned int value; -+ static const struct watchdog_info ident = { -+ .options = WDIOF_CARDRESET, -+ .identity = "GPIO WDT", -+ }; -+ -+ switch (cmd) { -+ case WDIOC_GETSUPPORT: -+ if (copy_to_user(argp, &ident, sizeof(ident))) -+ return -EFAULT; -+ break; -+ case WDIOC_GETSTATUS: -+ case WDIOC_GETBOOTSTATUS: -+ put_user(0, p); -+ break; -+ case WDIOC_SETOPTIONS: -+ if (get_user(value, p)) -+ return -EFAULT; -+ if (value & WDIOS_ENABLECARD) -+ gpio_wdt_start(); -+ else if (value & WDIOS_DISABLECARD) -+ gpio_wdt_stop(); -+ else -+ return -EINVAL; -+ return 0; -+ case WDIOC_KEEPALIVE: -+ gpio_wdt_reset(); -+ break; -+ default: -+ return -ENOTTY; -+ } -+ return 0; -+} -+ -+ -+static ssize_t gpio_wdt_write(struct file *file, const char *buf, -+ size_t count, loff_t *ppos) -+{ -+ if (!count) -+ return -EIO; -+ gpio_wdt_reset(); -+ return count; -+} -+ -+static const struct file_operations gpio_wdt_fops = { -+ .owner = THIS_MODULE, -+ .llseek = no_llseek, -+ .unlocked_ioctl = gpio_wdt_ioctl, -+ .open = gpio_wdt_open, -+ .write = gpio_wdt_write, -+ .release = gpio_wdt_release, -+}; -+ -+ -+static struct miscdevice gpio_wdt_misc = { -+ .minor = WATCHDOG_MINOR, -+ .name = "watchdog", -+ .fops = &gpio_wdt_fops, -+}; -+ -+ -+static int gpio_wdt_probe(struct platform_device *pdev) -+{ -+ int ret; -+ struct gpio_wdt_platform_data *gpio_wdt_data = pdev->dev.platform_data; -+ -+ gpio_wdt_device.gpio = gpio_wdt_data->gpio; -+ gpio_wdt_device.interval = gpio_wdt_data->interval; -+ gpio_wdt_device.first_interval = gpio_wdt_data->first_interval; -+ if (gpio_wdt_device.first_interval <= 0) { -+ gpio_wdt_device.first_interval = gpio_wdt_device.interval; -+ } -+ -+ ret = gpio_request(gpio_wdt_device.gpio, "gpio-wdt"); -+ if (ret < 0) { -+ dev_err(&pdev->dev, "failed to request gpio"); -+ return ret; -+ } -+ -+ spin_lock_init(&gpio_wdt_device.lock); -+ init_completion(&gpio_wdt_device.stop); -+ gpio_wdt_device.queue = 0; -+ clear_bit(0, &gpio_wdt_device.inuse); -+ setup_timer(&gpio_wdt_device.timer, gpio_wdt_trigger, 0L); -+ gpio_wdt_device.default_ticks = ticks; -+ -+ gpio_wdt_start(); -+ dev_info(&pdev->dev, "GPIO Hardware Watchdog driver (gpio=%i interval=%i/%i)\n", -+ gpio_wdt_data->gpio, gpio_wdt_data->first_interval, gpio_wdt_data->interval); -+ return 0; -+} -+ -+static int gpio_wdt_remove(struct platform_device *pdev) -+{ -+ /* FIXME: do we need to lock this test ? */ -+ if (gpio_wdt_device.queue) { -+ gpio_wdt_device.queue = 0; -+ wait_for_completion(&gpio_wdt_device.stop); -+ } -+ -+ gpio_free(gpio_wdt_device.gpio); -+ misc_deregister(&gpio_wdt_misc); -+ return 0; -+} -+ -+static struct platform_driver gpio_wdt_driver = { -+ .probe = gpio_wdt_probe, -+ .remove = gpio_wdt_remove, -+ .driver.name = "gpio-wdt", -+ .driver.owner = THIS_MODULE, -+}; -+ -+static int __init gpio_wdt_init(void) -+{ -+ return platform_driver_register(&gpio_wdt_driver); -+} -+arch_initcall(gpio_wdt_init); -+ -+/* -+ * We do wdt initialization in two steps: arch_initcall probes the wdt -+ * very early to start pinging the watchdog (misc devices are not yet -+ * available), and later module_init() just registers the misc device. -+ */ -+static int gpio_wdt_init_late(void) -+{ -+ int ret; -+ -+ ret = misc_register(&gpio_wdt_misc); -+ if (ret < 0) { -+ pr_err("GPIO_WDT: failed to register misc device\n"); -+ return ret; -+ } -+ return 0; -+} -+#ifndef MODULE -+module_init(gpio_wdt_init_late); -+#endif -+ -+static void __exit gpio_wdt_exit(void) -+{ -+ platform_driver_unregister(&gpio_wdt_driver); -+} -+module_exit(gpio_wdt_exit); -+ -+MODULE_AUTHOR("Michael Stickel, Florian Fainelli, Mathias Adam"); -+MODULE_DESCRIPTION("Driver for GPIO hardware watchdogs"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); -+MODULE_ALIAS("platform:gpio-wdt"); ---- /dev/null -+++ b/include/linux/old_gpio_wdt.h -@@ -0,0 +1,21 @@ -+/* -+ * Definitions for the GPIO watchdog driver -+ * -+ * Copyright (C) 2013 Mathias Adam -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#ifndef _GPIO_WDT_H_ -+#define _GPIO_WDT_H_ -+ -+struct gpio_wdt_platform_data { -+ int gpio; /* GPIO line number */ -+ int interval; /* watchdog reset interval in system ticks */ -+ int first_interval; /* first wd reset interval in system ticks */ -+}; -+ -+#endif /* _GPIO_WDT_H_ */ diff --git a/target/linux/generic/pending-3.18/995-mangle_bootargs.patch b/target/linux/generic/pending-3.18/995-mangle_bootargs.patch deleted file mode 100644 index 0029e9082..000000000 --- a/target/linux/generic/pending-3.18/995-mangle_bootargs.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -362,6 +362,29 @@ static inline void setup_nr_cpu_ids(void - static inline void smp_prepare_cpus(unsigned int maxcpus) { } - #endif - -+#ifdef CONFIG_MANGLE_BOOTARGS -+static void __init mangle_bootargs(char *command_line) -+{ -+ char *rootdev; -+ char *rootfs; -+ -+ rootdev = strstr(command_line, "root=/dev/mtdblock"); -+ -+ if (rootdev) -+ strncpy(rootdev, "mangled_rootblock=", 18); -+ -+ rootfs = strstr(command_line, "rootfstype"); -+ -+ if (rootfs) -+ strncpy(rootfs, "mangled_fs", 10); -+ -+} -+#else -+static void __init mangle_bootargs(char *command_line) -+{ -+} -+#endif -+ - /* - * We need to store the untouched command line for future reference. - * We also need to store the touched command line since the parameter -@@ -530,6 +553,7 @@ asmlinkage __visible void __init start_k - pr_notice("%s", linux_banner); - setup_arch(&command_line); - mm_init_cpumask(&init_mm); -+ mangle_bootargs(command_line); - setup_command_line(command_line); - setup_nr_cpu_ids(); - setup_per_cpu_areas(); ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1597,6 +1597,15 @@ config EMBEDDED - an embedded system so certain expert options are available - for configuration. - -+config MANGLE_BOOTARGS -+ bool "Rename offending bootargs" -+ depends on EXPERT -+ help -+ Sometimes the bootloader passed bogus root= and rootfstype= -+ parameters to the kernel, and while you want to ignore them, -+ you need to know the values f.e. to support dual firmware -+ layouts on the flash. -+ - config HAVE_PERF_EVENTS - bool - help diff --git a/target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch b/target/linux/generic/pending-3.18/998-enable_wilink_platform_without_drivers.patch deleted file mode 100644 index d317de110..000000000 --- a/target/linux/generic/pending-3.18/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/pending-3.18/999-seccomp_log.patch b/target/linux/generic/pending-3.18/999-seccomp_log.patch deleted file mode 100644 index 1db6b18d4..000000000 --- a/target/linux/generic/pending-3.18/999-seccomp_log.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/kernel/seccomp.c -+++ b/kernel/seccomp.c -@@ -614,6 +614,7 @@ int __secure_computing(void) - #ifdef CONFIG_SECCOMP_FILTER - static u32 __seccomp_phase1_filter(int this_syscall, struct seccomp_data *sd) - { -+ char name[sizeof(current->comm)]; - u32 filter_ret, action; - int data; - -@@ -644,6 +645,13 @@ static u32 __seccomp_phase1_filter(int t - case SECCOMP_RET_TRACE: - return filter_ret; /* Save the rest for phase 2. */ - -+ case SECCOMP_RET_LOG: -+ get_task_comm(name, current); -+ pr_err_ratelimited("seccomp: %s [%u] tried to call non-whitelisted syscall: %d\n", name, current->pid, this_syscall); -+ syscall_set_return_value(current, task_pt_regs(current), -+ -data, 0); -+ goto skip; -+ - case SECCOMP_RET_ALLOW: - return SECCOMP_PHASE1_OK; - ---- a/include/uapi/linux/seccomp.h -+++ b/include/uapi/linux/seccomp.h -@@ -28,6 +28,7 @@ - #define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */ - #define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */ - #define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */ -+#define SECCOMP_RET_LOG 0x00070000U /* allow + logline */ - #define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */ - #define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ - diff --git a/target/linux/generic/pending-4.14/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch b/target/linux/generic/pending-4.14/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch new file mode 100644 index 000000000..0c4a13f9d --- /dev/null +++ b/target/linux/generic/pending-4.14/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch @@ -0,0 +1,38 @@ +From d9c8bc8c1408f3e8529db6e4e04017b4c579c342 Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Sun, 18 Feb 2018 17:08:04 +0100 +Subject: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio + +In devices, where fdt is used, is impossible to apply platform data +without proper fdt node. + +This patch allow to use platform data in devices with fdt. + +Signed-off-by: Pawel Dembicki +--- + drivers/w1/masters/w1-gpio.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/w1/masters/w1-gpio.c ++++ b/drivers/w1/masters/w1-gpio.c +@@ -112,17 +112,16 @@ static int w1_gpio_probe_dt(struct platf + static int w1_gpio_probe(struct platform_device *pdev) + { + struct w1_bus_master *master; +- struct w1_gpio_platform_data *pdata; ++ struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); + int err; + +- if (of_have_populated_dt()) { ++ if (of_have_populated_dt() && !pdata) { + err = w1_gpio_probe_dt(pdev); + if (err < 0) + return err; ++ pdata = dev_get_platdata(&pdev->dev); + } + +- pdata = dev_get_platdata(&pdev->dev); +- + if (!pdata) { + dev_err(&pdev->dev, "No configuration data\n"); + return -ENXIO; diff --git a/target/linux/generic/pending-4.14/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch b/target/linux/generic/pending-4.14/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch index cc1705312..b3dc43ea6 100644 --- a/target/linux/generic/pending-4.14/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch +++ b/target/linux/generic/pending-4.14/102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch @@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c -@@ -357,6 +357,8 @@ static inline int is_sp_move_ins(union m +@@ -358,6 +358,8 @@ static inline int is_sp_move_ins(union m if (ip->i_format.opcode == addiu_op || ip->i_format.opcode == daddiu_op) { diff --git a/target/linux/generic/pending-4.14/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-4.14/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch index 5ee89be5a..44e7fa70a 100644 --- a/target/linux/generic/pending-4.14/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ b/target/linux/generic/pending-4.14/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch @@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -6147,7 +6147,7 @@ static void __ref alloc_node_mem_map(str +@@ -6146,7 +6146,7 @@ static void __ref alloc_node_mem_map(str mem_map = NODE_DATA(0)->node_mem_map; #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) if (page_to_pfn(mem_map) != pgdat->node_start_pfn) diff --git a/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch index 0e858d93b..80ff556a4 100644 --- a/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ b/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch @@ -104,7 +104,7 @@ Signed-off-by: Hauke Mehrtens #include #include -@@ -851,6 +852,32 @@ void deregister_mtd_parser(struct mtd_pa +@@ -835,6 +836,32 @@ void deregister_mtd_parser(struct mtd_pa EXPORT_SYMBOL_GPL(deregister_mtd_parser); /* @@ -137,7 +137,7 @@ Signed-off-by: Hauke Mehrtens * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you * are changing this array! */ -@@ -991,6 +1018,13 @@ int parse_mtd_partitions(struct mtd_info +@@ -983,6 +1010,13 @@ int parse_mtd_partitions(struct mtd_info struct mtd_partitions pparts = { }; struct mtd_part_parser *parser; int ret, err = 0; @@ -150,8 +150,8 @@ Signed-off-by: Hauke Mehrtens + } if (!types) - types = default_mtd_part_types; -@@ -1031,6 +1065,7 @@ int parse_mtd_partitions(struct mtd_info + types = mtd_is_partition(master) ? default_subpartition_types : +@@ -1024,6 +1058,7 @@ int parse_mtd_partitions(struct mtd_info if (ret < 0 && !err) err = ret; } diff --git a/target/linux/generic/pending-4.14/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch b/target/linux/generic/pending-4.14/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch index d8aea32b5..54858657c 100644 --- a/target/linux/generic/pending-4.14/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch +++ b/target/linux/generic/pending-4.14/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch @@ -23,7 +23,7 @@ Tested-by: Aaron Brown --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c -@@ -5096,7 +5096,7 @@ static bool e1000e_has_link(struct e1000 +@@ -5082,7 +5082,7 @@ static bool e1000e_has_link(struct e1000 /* get_link_status is set on LSC (link status) interrupt or * Rx sequence error interrupt. get_link_status will stay @@ -32,7 +32,7 @@ Tested-by: Aaron Brown * for copper adapters ONLY */ switch (hw->phy.media_type) { -@@ -5114,7 +5114,7 @@ static bool e1000e_has_link(struct e1000 +@@ -5100,7 +5100,7 @@ static bool e1000e_has_link(struct e1000 break; case e1000_media_type_internal_serdes: ret_val = hw->mac.ops.check_for_link(hw); diff --git a/target/linux/generic/pending-4.14/201-extra_optimization.patch b/target/linux/generic/pending-4.14/201-extra_optimization.patch index 445c0bd87..b40f01d41 100644 --- a/target/linux/generic/pending-4.14/201-extra_optimization.patch +++ b/target/linux/generic/pending-4.14/201-extra_optimization.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau --- a/Makefile +++ b/Makefile -@@ -645,12 +645,12 @@ KBUILD_CFLAGS += $(call cc-disable-warni +@@ -646,12 +646,12 @@ KBUILD_CFLAGS += $(call cc-disable-warni ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) diff --git a/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch index bc2272d26..68737803d 100644 --- a/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch @@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve * the pointer to that structure. -@@ -674,6 +678,7 @@ int mtd_add_partition(struct mtd_info *p +@@ -658,6 +662,7 @@ int mtd_add_partition(struct mtd_info *p mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); @@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau mtd_add_partition_attrs(new); -@@ -752,6 +757,35 @@ int mtd_del_partition(struct mtd_info *m +@@ -736,6 +741,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -104,14 +104,14 @@ Signed-off-by: Felix Fietkau /* * 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 -@@ -783,6 +817,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -767,6 +801,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); - if (parts[i].types) - mtd_parse_part(slave, parts[i].types); + /* Look for subpartitions */ + parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h @@ -110,5 +110,7 @@ int mtd_add_partition(struct mtd_info *m diff --git a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch index 7cb336bd1..503a86e24 100644 --- a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch @@ -9,7 +9,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -1120,6 +1120,62 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -1113,6 +1113,62 @@ void mtd_part_parser_cleanup(struct mtd_ } } diff --git a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index cfd178e42..f93b816a3 100644 --- a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -757,6 +757,36 @@ int mtd_del_partition(struct mtd_info *m +@@ -741,6 +741,36 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -765,6 +795,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -749,6 +779,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -55,7 +55,7 @@ Signed-off-by: Gabor Juhos } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -779,6 +810,12 @@ static void mtd_partition_split(struct m +@@ -763,6 +794,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch index 98732e4c8..5df24dff0 100644 --- a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -787,6 +787,17 @@ run_parsers_by_type(struct mtd_part *sla +@@ -771,6 +771,17 @@ run_parsers_by_type(struct mtd_part *sla return nr_parts; } @@ -29,7 +29,7 @@ Signed-off-by: Gabor Juhos #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -1230,6 +1241,24 @@ int mtd_is_partition(const struct mtd_in +@@ -1223,6 +1234,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch index 2fcaec52d..8497bfb76 100644 --- a/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; -@@ -586,19 +655,22 @@ static struct mtd_part *allocate_partiti +@@ -570,19 +639,22 @@ static struct mtd_part *allocate_partiti remainder = do_div(tmp, wr_alignment); if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/pending-4.14/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-4.14/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch index 9299e8867..d54c284c3 100644 --- a/target/linux/generic/pending-4.14/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ b/target/linux/generic/pending-4.14/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch @@ -59,9 +59,10 @@ Signed-off-by: Rafał Miłecki if (trx.offset[i]) { part = &parts[curr_part++]; - part->name = parser_trx_data_part_name(mtd, trx.offset[i]); +- part->name = parser_trx_data_part_name(mtd, trx.offset[i]); - part->offset = trx.offset[i]; + part->offset = parser_trx_real_offset(mtd, trx.offset[i]); ++ part->name = parser_trx_data_part_name(mtd, part->offset); i++; } diff --git a/target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch b/target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch deleted file mode 100644 index b8d510151..000000000 --- a/target/linux/generic/pending-4.14/479-mtd-spi-nor-add-eon-en25qh32.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -955,6 +955,7 @@ static const struct flash_info spi_nor_i - { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, - { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, -+ { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, - { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch index 2a09caf44..63afabb1d 100644 --- a/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ b/target/linux/generic/pending-4.14/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch @@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c -@@ -1168,6 +1168,49 @@ static struct mtd_info * __init open_mtd +@@ -1171,6 +1171,49 @@ static struct mtd_info * __init open_mtd return mtd; } @@ -58,7 +58,7 @@ Signed-off-by: Daniel Golle static int __init ubi_init(void) { int err, i, k; -@@ -1251,6 +1294,12 @@ static int __init ubi_init(void) +@@ -1254,6 +1297,12 @@ static int __init ubi_init(void) } } diff --git a/target/linux/generic/pending-4.14/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-4.14/610-netfilter_match_bypass_default_checks.patch index 361187960..2541230ff 100644 --- a/target/linux/generic/pending-4.14/610-netfilter_match_bypass_default_checks.patch +++ b/target/linux/generic/pending-4.14/610-netfilter_match_bypass_default_checks.patch @@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau if (!xt_percpu_counter_alloc(alloc_state, &e->counters)) return -ENOMEM; -@@ -817,6 +845,7 @@ copy_entries_to_user(unsigned int total_ +@@ -818,6 +846,7 @@ copy_entries_to_user(unsigned int total_ const struct xt_table_info *private = table->private; int ret = 0; const void *loc_cpu_entry; @@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau counters = alloc_counters(table); if (IS_ERR(counters)) -@@ -844,6 +873,14 @@ copy_entries_to_user(unsigned int total_ +@@ -845,6 +874,14 @@ copy_entries_to_user(unsigned int total_ goto free_counters; } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau for (i = sizeof(struct ipt_entry); i < e->target_offset; i += m->u.match_size) { -@@ -1226,12 +1263,15 @@ compat_copy_entry_to_user(struct ipt_ent +@@ -1227,12 +1264,15 @@ compat_copy_entry_to_user(struct ipt_ent compat_uint_t origsize; const struct xt_entry_match *ematch; int ret = 0; diff --git a/target/linux/generic/pending-4.14/630-packet_socket_type.patch b/target/linux/generic/pending-4.14/630-packet_socket_type.patch index e1736214f..82e2c51af 100644 --- a/target/linux/generic/pending-4.14/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.14/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3262,6 +3264,7 @@ static int packet_create(struct net *net +@@ -3260,6 +3262,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3875,6 +3878,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3873,6 +3876,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -3927,6 +3940,13 @@ static int packet_getsockopt(struct sock +@@ -3925,6 +3938,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-4.14/640-netfilter-nf_flow_table-add-hardware-offload-support.patch b/target/linux/generic/pending-4.14/640-netfilter-nf_flow_table-add-hardware-offload-support.patch index 73475a543..bf902875d 100644 --- a/target/linux/generic/pending-4.14/640-netfilter-nf_flow_table-add-hardware-offload-support.patch +++ b/target/linux/generic/pending-4.14/640-netfilter-nf_flow_table-add-hardware-offload-support.patch @@ -506,7 +506,7 @@ Signed-off-by: Pablo Neira Ayuso +MODULE_ALIAS("nf-flow-table-hw"); --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -4873,6 +4873,14 @@ static int nf_tables_flowtable_parse_hoo +@@ -4917,6 +4917,14 @@ static int nf_tables_flowtable_parse_hoo if (err < 0) goto err1; @@ -521,7 +521,7 @@ Signed-off-by: Pablo Neira Ayuso ops = kzalloc(sizeof(struct nf_hook_ops) * n, GFP_KERNEL); if (!ops) { err = -ENOMEM; -@@ -5003,10 +5011,19 @@ static int nf_tables_newflowtable(struct +@@ -5047,10 +5055,19 @@ static int nf_tables_newflowtable(struct } flowtable->data.type = type; @@ -541,7 +541,7 @@ Signed-off-by: Pablo Neira Ayuso err = nf_tables_flowtable_parse_hook(&ctx, nla[NFTA_FLOWTABLE_HOOK], flowtable); if (err < 0) -@@ -5104,7 +5121,8 @@ static int nf_tables_fill_flowtable_info +@@ -5148,7 +5165,8 @@ static int nf_tables_fill_flowtable_info nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) || nla_put_be32(skb, NFTA_FLOWTABLE_USE, htonl(flowtable->use)) || nla_put_be64(skb, NFTA_FLOWTABLE_HANDLE, cpu_to_be64(flowtable->handle), diff --git a/target/linux/generic/pending-4.14/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-4.14/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch index bf1471f64..3b69b6855 100644 --- a/target/linux/generic/pending-4.14/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ b/target/linux/generic/pending-4.14/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch @@ -90,7 +90,7 @@ Signed-off-by: Steven Barth return hash_32(hash, IP6_TUNNEL_HASH_SIZE_SHIFT); } -@@ -141,20 +143,29 @@ static struct net_device_stats *ip6_get_stats(struct net_device *dev) +@@ -141,20 +143,29 @@ static struct net_device_stats *ip6_get_ static struct ip6_tnl * ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_addr *local) { @@ -125,7 +125,7 @@ Signed-off-by: Steven Barth for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { if (ipv6_addr_equal(local, &t->parms.laddr) && ipv6_addr_any(&t->parms.raddr) && -@@ -162,7 +173,7 @@ ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_ +@@ -162,7 +173,7 @@ ip6_tnl_lookup(struct net *net, const st return t; } @@ -134,7 +134,7 @@ Signed-off-by: Steven Barth for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { if (ipv6_addr_equal(remote, &t->parms.raddr) && ipv6_addr_any(&t->parms.laddr) && -@@ -202,7 +213,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n, const struct __ip6_tnl_parm *p) +@@ -202,7 +213,7 @@ ip6_tnl_bucket(struct ip6_tnl_net *ip6n, if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) { prio = 1; @@ -143,7 +143,7 @@ Signed-off-by: Steven Barth } return &ip6n->tnls[prio][h]; } -@@ -383,6 +394,12 @@ ip6_tnl_dev_uninit(struct net_device *dev) +@@ -383,6 +394,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); @@ -264,11 +264,11 @@ Signed-off-by: Steven Barth static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, const struct tnl_ptk_info *tpi, struct metadata_dst *tun_dst, -@@ -831,6 +949,27 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, +@@ -831,6 +949,27 @@ static int __ip6_tnl_rcv(struct ip6_tnl skb_reset_network_header(skb); memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); -+ if (tpi->proto == htons(ETH_P_IP) && ++ if (tpi->proto == htons(ETH_P_IP) && tunnel->parms.fmrs && + !ipv6_addr_equal(&ipv6h->saddr, &tunnel->parms.raddr)) { + /* Packet didn't come from BR, so lookup FMR */ + struct __ip6_tnl_fmr *fmr; @@ -292,7 +292,7 @@ Signed-off-by: Steven Barth __skb_tunnel_rx(skb, tunnel->dev, tunnel->net); err = dscp_ecn_decapsulate(tunnel, ipv6h, skb); -@@ -962,6 +1101,7 @@ static void init_tel_txopt(struct ipv6_tel_txoption *opt, __u8 encap_limit) +@@ -962,6 +1101,7 @@ static void init_tel_txopt(struct ipv6_t opt->ops.opt_nflen = 8; } @@ -300,7 +300,7 @@ Signed-off-by: Steven Barth /** * ip6_tnl_addr_conflict - compare packet addresses to tunnel's own * @t: the outgoing tunnel device -@@ -1303,6 +1443,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) +@@ -1299,6 +1439,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str { struct ip6_tnl *t = netdev_priv(dev); struct ipv6hdr *ipv6h = ipv6_hdr(skb); @@ -308,7 +308,7 @@ Signed-off-by: Steven Barth int encap_limit = -1; __u16 offset; struct flowi6 fl6; -@@ -1365,6 +1506,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) +@@ -1361,6 +1502,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str fl6.flowi6_uid = sock_net_uid(dev_net(dev), NULL); @@ -327,7 +327,7 @@ Signed-off-by: Steven Barth if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) return -1; -@@ -1493,6 +1646,14 @@ ip6_tnl_change(struct ip6_tnl *t, const struct __ip6_tnl_parm *p) +@@ -1489,6 +1642,14 @@ ip6_tnl_change(struct ip6_tnl *t, const t->parms.link = p->link; t->parms.proto = p->proto; t->parms.fwmark = p->fwmark; @@ -342,7 +342,7 @@ Signed-off-by: Steven Barth dst_cache_reset(&t->dst_cache); ip6_tnl_link_config(t); return 0; -@@ -1531,6 +1692,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_parm *p, const struct ip6_tnl_parm *u) +@@ -1527,6 +1688,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ p->flowinfo = u->flowinfo; p->link = u->link; p->proto = u->proto; @@ -350,7 +350,7 @@ Signed-off-by: Steven Barth memcpy(p->name, u->name, sizeof(u->name)); } -@@ -1912,6 +2074,15 @@ static int ip6_tnl_validate(struct nlattr *tb[], struct nlattr *data[], +@@ -1913,6 +2075,15 @@ static int ip6_tnl_validate(struct nlatt return 0; } @@ -366,7 +366,7 @@ Signed-off-by: Steven Barth static void ip6_tnl_netlink_parms(struct nlattr *data[], struct __ip6_tnl_parm *parms) { -@@ -1949,6 +2120,46 @@ static void ip6_tnl_netlink_parms(struct nlattr *data[], +@@ -1950,6 +2121,46 @@ static void ip6_tnl_netlink_parms(struct if (data[IFLA_IPTUN_FWMARK]) parms->fwmark = nla_get_u32(data[IFLA_IPTUN_FWMARK]); @@ -413,7 +413,7 @@ Signed-off-by: Steven Barth } static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[], -@@ -2064,6 +2275,12 @@ static void ip6_tnl_dellink(struct net_d +@@ -2065,6 +2276,12 @@ static void ip6_tnl_dellink(struct net_d static size_t ip6_tnl_get_size(const struct net_device *dev) { @@ -426,7 +426,7 @@ Signed-off-by: Steven Barth return /* IFLA_IPTUN_LINK */ nla_total_size(4) + -@@ -2093,6 +2310,24 @@ static size_t ip6_tnl_get_size(const str +@@ -2094,6 +2311,24 @@ static size_t ip6_tnl_get_size(const str nla_total_size(0) + /* IFLA_IPTUN_FWMARK */ nla_total_size(4) + @@ -451,7 +451,7 @@ Signed-off-by: Steven Barth 0; } -@@ -2100,6 +2335,9 @@ static int ip6_tnl_fill_info(struct sk_b +@@ -2101,6 +2336,9 @@ static int ip6_tnl_fill_info(struct sk_b { struct ip6_tnl *tunnel = netdev_priv(dev); struct __ip6_tnl_parm *parm = &tunnel->parms; @@ -461,7 +461,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) || -@@ -2109,9 +2347,27 @@ static int ip6_tnl_fill_info(struct sk_b +@@ -2110,9 +2348,27 @@ static int ip6_tnl_fill_info(struct sk_b 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) || @@ -490,7 +490,7 @@ Signed-off-by: Steven Barth if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, tunnel->encap.type) || nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, tunnel->encap.sport) || nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, tunnel->encap.dport) || -@@ -2151,6 +2407,7 @@ static const struct nla_policy ip6_tnl_p +@@ -2152,6 +2408,7 @@ static const struct nla_policy ip6_tnl_p [IFLA_IPTUN_ENCAP_DPORT] = { .type = NLA_U16 }, [IFLA_IPTUN_COLLECT_METADATA] = { .type = NLA_FLAG }, [IFLA_IPTUN_FWMARK] = { .type = NLA_U32 }, diff --git a/target/linux/generic/pending-4.14/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-4.14/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 7e7a6a44e..74baa80cd 100644 --- a/target/linux/generic/pending-4.14/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-4.14/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -141,7 +141,7 @@ Signed-off-by: Jonas Gorski static const struct rt6_info ip6_blk_hole_entry_template = { .dst = { .__refcnt = ATOMIC_INIT(1), -@@ -2046,6 +2063,11 @@ static struct rt6_info *ip6_route_info_c +@@ -2043,6 +2060,11 @@ static struct rt6_info *ip6_route_info_c rt->dst.output = ip6_pkt_prohibit_out; rt->dst.input = ip6_pkt_prohibit; break; @@ -153,7 +153,7 @@ Signed-off-by: Jonas Gorski case RTN_THROW: case RTN_UNREACHABLE: default: -@@ -2771,6 +2793,17 @@ static int ip6_pkt_prohibit_out(struct n +@@ -2768,6 +2790,17 @@ static int ip6_pkt_prohibit_out(struct n return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); } @@ -171,7 +171,7 @@ Signed-off-by: Jonas Gorski /* * Allocate a dst for local (unicast / anycast) address. */ -@@ -3007,7 +3040,8 @@ static int rtm_to_fib6_config(struct sk_ +@@ -3004,7 +3037,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 || @@ -181,7 +181,7 @@ Signed-off-by: Jonas Gorski cfg->fc_flags |= RTF_REJECT; if (rtm->rtm_type == RTN_LOCAL) -@@ -3497,6 +3531,9 @@ static int rt6_fill_node(struct net *net +@@ -3494,6 +3528,9 @@ static int rt6_fill_node(struct net *net case -EACCES: rtm->rtm_type = RTN_PROHIBIT; break; @@ -191,7 +191,7 @@ Signed-off-by: Jonas Gorski case -EAGAIN: rtm->rtm_type = RTN_THROW; break; -@@ -3815,6 +3852,8 @@ static int ip6_route_dev_notify(struct n +@@ -3812,6 +3849,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); @@ -200,7 +200,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_blk_hole_entry->dst.dev = dev; net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); #endif -@@ -3826,6 +3865,7 @@ static int ip6_route_dev_notify(struct n +@@ -3823,6 +3862,7 @@ static int ip6_route_dev_notify(struct n in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev); #ifdef CONFIG_IPV6_MULTIPLE_TABLES in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev); @@ -208,7 +208,7 @@ Signed-off-by: Jonas Gorski in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev); #endif } -@@ -4042,6 +4082,17 @@ static int __net_init ip6_route_net_init +@@ -4039,6 +4079,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); @@ -226,7 +226,7 @@ Signed-off-by: Jonas Gorski #endif net->ipv6.sysctl.flush_delay = 0; -@@ -4060,6 +4111,8 @@ out: +@@ -4057,6 +4108,8 @@ out: return ret; #ifdef CONFIG_IPV6_MULTIPLE_TABLES @@ -235,7 +235,7 @@ Signed-off-by: Jonas Gorski out_ip6_prohibit_entry: kfree(net->ipv6.ip6_prohibit_entry); out_ip6_null_entry: -@@ -4077,6 +4130,7 @@ static void __net_exit ip6_route_net_exi +@@ -4074,6 +4127,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); @@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski #endif dst_entries_destroy(&net->ipv6.ip6_dst_ops); } -@@ -4150,6 +4204,9 @@ void __init ip6_route_init_special_entri +@@ -4147,6 +4201,9 @@ void __init ip6_route_init_special_entri init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); diff --git a/target/linux/generic/pending-4.14/701-phy_extension.patch b/target/linux/generic/pending-4.14/701-phy_extension.patch index f1dfac67e..1b380e24a 100644 --- a/target/linux/generic/pending-4.14/701-phy_extension.patch +++ b/target/linux/generic/pending-4.14/701-phy_extension.patch @@ -9,11 +9,11 @@ Signed-off-by: John Crispin --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c -@@ -382,6 +382,74 @@ void phy_ethtool_ksettings_get(struct phy_device *phydev, +@@ -382,6 +382,73 @@ void phy_ethtool_ksettings_get(struct ph } EXPORT_SYMBOL(phy_ethtool_ksettings_get); -+int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) ++static int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) +{ + cmd->supported = phydev->supported; + @@ -35,7 +35,6 @@ Signed-off-by: John Crispin + + return 0; +} -+EXPORT_SYMBOL(phy_ethtool_gset); + +int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr) +{ @@ -86,12 +85,7 @@ Signed-off-by: John Crispin * @phydev: the phy_device struct --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -901,10 +901,12 @@ void phy_start_machine(struct phy_device *phydev); - void phy_stop_machine(struct phy_device *phydev); - void phy_trigger_machine(struct phy_device *phydev, bool sync); - int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); -+int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); - void phy_ethtool_ksettings_get(struct phy_device *phydev, +@@ -905,6 +905,7 @@ void phy_ethtool_ksettings_get(struct ph struct ethtool_link_ksettings *cmd); int phy_ethtool_ksettings_set(struct phy_device *phydev, const struct ethtool_link_ksettings *cmd); diff --git a/target/linux/generic/pending-4.14/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-4.14/735-net-phy-at803x-fix-at8033-sgmii-mode.patch index 9a2f93a6f..0bb365a6e 100644 --- a/target/linux/generic/pending-4.14/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ b/target/linux/generic/pending-4.14/735-net-phy-at803x-fix-at8033-sgmii-mode.patch @@ -13,18 +13,15 @@ Signed-off-by: Roman Yeryomin --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -55,6 +55,10 @@ - #define AT803X_DEBUG_ADDR 0x1D - #define AT803X_DEBUG_DATA 0x1E - -+#define AT803X_REG_CHIP_CONFIG 0x1f -+#define AT803X_BT_BX_REG_SEL 0x8000 +@@ -46,6 +46,7 @@ + #define AT803X_FUNC_DATA 0x4003 + #define AT803X_REG_CHIP_CONFIG 0x1f + #define AT803X_BT_BX_REG_SEL 0x8000 +#define AT803X_SGMII_ANEG_EN 0x1000 -+ - #define AT803X_MODE_CFG_MASK 0x0F - #define AT803X_MODE_CFG_SGMII 0x01 -@@ -292,6 +296,27 @@ static int at803x_config_init(struct phy + #define AT803X_PCS_SMART_EEE_CTRL3 0x805D + #define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 +@@ -292,6 +293,27 @@ static int at803x_config_init(struct phy { struct at803x_platform_data *pdata; int ret; diff --git a/target/linux/generic/pending-4.14/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-4.14/811-pci_disable_usb_common_quirks.patch index db0bcc856..f40214c29 100644 --- a/target/linux/generic/pending-4.14/811-pci_disable_usb_common_quirks.patch +++ b/target/linux/generic/pending-4.14/811-pci_disable_usb_common_quirks.patch @@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau #endif /* __LINUX_USB_PCI_QUIRKS_H */ --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h -@@ -465,7 +465,14 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev, +@@ -465,7 +465,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); diff --git a/target/linux/generic/pending-4.14/834-ledtrig-libata.patch b/target/linux/generic/pending-4.14/834-ledtrig-libata.patch index 9ecefc913..2eec024b7 100644 --- a/target/linux/generic/pending-4.14/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-4.14/834-ledtrig-libata.patch @@ -134,7 +134,7 @@ Signed-off-by: Daniel Golle /* * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -889,6 +892,12 @@ struct ata_port { +@@ -890,6 +893,12 @@ struct ata_port { #ifdef CONFIG_ATA_ACPI struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ #endif diff --git a/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch b/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch deleted file mode 100644 index a2b740fd4..000000000 --- a/target/linux/generic/pending-4.14/950-tty-serial-exar-generalize-rs485-setup.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 24d5ba8ad40c3ac7903f688580c345aafa764dc7 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Mon, 4 Jun 2018 14:51:29 +0200 -Subject: [PATCH] tty: serial: exar: generalize rs485 setup -To: linux-serial@vger.kernel.org, - Greg Kroah-Hartman -Cc: Linus Walleij , - Jan Kiszka - -Move the non-board-specific part of the RS485 initialization -from iot2040_rs485_config function to a new generic function -used also for other boards. -This allows using PCIe boards which are hard-wired to RS485 -or have jumpers for their configurations. - -Signed-off-by: Daniel Golle ---- - drivers/tty/serial/8250/8250_exar.c | 38 +++++++++++++++++++---------- - 1 file changed, 25 insertions(+), 13 deletions(-) - -diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c -index e0aa5f03004c..55b4d6d581f0 100644 ---- a/drivers/tty/serial/8250/8250_exar.c -+++ b/drivers/tty/serial/8250/8250_exar.c -@@ -275,8 +275,32 @@ static int xr17v35x_register_gpio(struct pci_dev *pcidev, - return 0; - } - -+static int generic_rs485_config(struct uart_port *port, -+ struct serial_rs485 *rs485) -+{ -+ bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); -+ u8 __iomem *p = port->membase; -+ u8 value; -+ -+ value = readb(p + UART_EXAR_FCTR); -+ if (is_rs485) -+ value |= UART_FCTR_EXAR_485; -+ else -+ value &= ~UART_FCTR_EXAR_485; -+ -+ writeb(value, p + UART_EXAR_FCTR); -+ -+ if (is_rs485) -+ writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); -+ -+ port->rs485 = *rs485; -+ -+ return 0; -+} -+ - static const struct exar8250_platform exar8250_default_platform = { - .register_gpio = xr17v35x_register_gpio, -+ .rs485_config = generic_rs485_config, - }; - - static int iot2040_rs485_config(struct uart_port *port, -@@ -309,19 +333,7 @@ static int iot2040_rs485_config(struct uart_port *port, - value |= mode; - writeb(value, p + UART_EXAR_MPIOLVL_7_0); - -- value = readb(p + UART_EXAR_FCTR); -- if (is_rs485) -- value |= UART_FCTR_EXAR_485; -- else -- value &= ~UART_FCTR_EXAR_485; -- writeb(value, p + UART_EXAR_FCTR); -- -- if (is_rs485) -- writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); -- -- port->rs485 = *rs485; -- -- return 0; -+ return generic_rs485_config(port, rs485); - } - - static const struct property_entry iot2040_gpio_properties[] = { --- -2.17.1 - diff --git a/target/linux/generic/pending-4.4/001-mtdsplit_backport.patch b/target/linux/generic/pending-4.4/001-mtdsplit_backport.patch deleted file mode 100644 index b5c485fe1..000000000 --- a/target/linux/generic/pending-4.4/001-mtdsplit_backport.patch +++ /dev/null @@ -1,153 +0,0 @@ ---- a/drivers/mtd/mtdsplit/mtdsplit_brnimage.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_brnimage.c -@@ -27,7 +27,7 @@ - #define BRNIMAGE_MAX_OVERHEAD (BRNIMAGE_ALIGN_BYTES + BRNIMAGE_FOOTER_SIZE) - - static int mtdsplit_parse_brnimage(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_eva.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_eva.c -@@ -29,7 +29,7 @@ struct eva_image_header { - }; - - static int mtdsplit_parse_eva(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_fit.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_fit.c -@@ -45,8 +45,7 @@ struct fdt_header { - }; - - static int --mtdsplit_fit_parse(struct mtd_info *mtd, -- const struct mtd_partition **pparts, -+mtdsplit_fit_parse(struct mtd_info *mtd, struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct fdt_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_lzma.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_lzma.c -@@ -28,7 +28,7 @@ struct lzma_header { - }; - - static int mtdsplit_parse_lzma(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct lzma_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_seama.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_seama.c -@@ -30,7 +30,7 @@ struct seama_header { - }; - - static int mtdsplit_parse_seama(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct seama_header hdr; ---- a/drivers/mtd/mtdsplit/mtdsplit_squashfs.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_squashfs.c -@@ -23,7 +23,7 @@ - - static int - mtdsplit_parse_squashfs(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *part; ---- a/drivers/mtd/mtdsplit/mtdsplit_tplink.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_tplink.c -@@ -83,8 +83,8 @@ struct tplink_fw_header { - }; - - static int mtdsplit_parse_tplink(struct mtd_info *master, -- const struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) - { - struct tplink_fw_header hdr; - size_t hdr_len, retlen, kernel_size; ---- a/drivers/mtd/mtdsplit/mtdsplit_trx.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_trx.c -@@ -56,7 +56,7 @@ read_trx_header(struct mtd_info *mtd, si - - static int - mtdsplit_parse_trx(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct mtd_partition *parts; ---- a/drivers/mtd/mtdsplit/mtdsplit_uimage.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_uimage.c -@@ -81,7 +81,7 @@ read_uimage_header(struct mtd_info *mtd, - * of a valid uImage header if found - */ - static int __mtdsplit_parse_uimage(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data, - ssize_t (*find_header)(u_char *buf, size_t len)) - { -@@ -232,7 +232,7 @@ static ssize_t uimage_verify_default(u_c - - static int - mtdsplit_uimage_parse_generic(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, -@@ -289,7 +289,7 @@ static ssize_t uimage_verify_wndr3700(u_ - - static int - mtdsplit_uimage_parse_netgear(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, -@@ -331,7 +331,7 @@ static ssize_t uimage_find_edimax(u_char - - static int - mtdsplit_uimage_parse_edimax(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - return __mtdsplit_parse_uimage(master, pparts, data, ---- a/drivers/mtd/mtdsplit/mtdsplit_wrgg.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_wrgg.c -@@ -51,8 +51,8 @@ struct wrg_header { - - - static int mtdsplit_parse_wrgg(struct mtd_info *master, -- const struct mtd_partition **pparts, -- struct mtd_part_parser_data *data) -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) - { - struct wrgg03_header hdr; - size_t hdr_len, retlen, kernel_ent_size; ---- a/drivers/mtd/mtdsplit/mtdsplit_minor.c -+++ b/drivers/mtd/mtdsplit/mtdsplit_minor.c -@@ -49,7 +49,7 @@ struct minor_header { - }; - - static int mtdsplit_parse_minor(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct minor_header hdr; diff --git a/target/linux/generic/pending-4.4/002-phy_drivers_backport.patch b/target/linux/generic/pending-4.4/002-phy_drivers_backport.patch deleted file mode 100644 index 6c9f30a97..000000000 --- a/target/linux/generic/pending-4.4/002-phy_drivers_backport.patch +++ /dev/null @@ -1,640 +0,0 @@ ---- a/drivers/net/phy/adm6996.c -+++ b/drivers/net/phy/adm6996.c -@@ -289,7 +289,7 @@ static u16 - adm6996_read_mii_reg(struct adm6996_priv *priv, enum admreg reg) - { - struct phy_device *phydev = priv->priv; -- struct mii_bus *bus = phydev->mdio.bus; -+ struct mii_bus *bus = phydev->bus; - - return bus->read(bus, PHYADDR(reg)); - } -@@ -298,7 +298,7 @@ static void - adm6996_write_mii_reg(struct adm6996_priv *priv, enum admreg reg, u16 val) - { - struct phy_device *phydev = priv->priv; -- struct mii_bus *bus = phydev->mdio.bus; -+ struct mii_bus *bus = phydev->bus; - - bus->write(bus, PHYADDR(reg), val); - } -@@ -1050,13 +1050,13 @@ static int adm6996_config_init(struct ph - pdev->supported = ADVERTISED_100baseT_Full; - pdev->advertising = ADVERTISED_100baseT_Full; - -- if (pdev->mdio.addr != 0) { -+ if (pdev->addr != 0) { - pr_info ("%s: PHY overlaps ADM6996, providing fixed PHY 0x%x.\n" -- , pdev->attached_dev->name, pdev->mdio.addr); -+ , pdev->attached_dev->name, pdev->addr); - return 0; - } - -- priv = devm_kzalloc(&pdev->mdio.dev, sizeof(struct adm6996_priv), GFP_KERNEL); -+ priv = devm_kzalloc(&pdev->dev, sizeof(struct adm6996_priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - -@@ -1076,7 +1076,7 @@ static int adm6996_config_init(struct ph - } - - /* -- * Warning: phydev->priv is NULL if phydev->mdio.addr != 0 -+ * Warning: phydev->priv is NULL if phydev->addr != 0 - */ - static int adm6996_read_status(struct phy_device *phydev) - { -@@ -1092,7 +1092,7 @@ static int adm6996_read_status(struct ph - } - - /* -- * Warning: phydev->priv is NULL if phydev->mdio.addr != 0 -+ * Warning: phydev->priv is NULL if phydev->addr != 0 - */ - static int adm6996_config_aneg(struct phy_device *phydev) - { -@@ -1101,11 +1101,11 @@ static int adm6996_config_aneg(struct ph - - static int adm6996_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; -+ struct mii_bus *bus = dev->bus; - u16 reg; - - /* Our custom registers are at PHY addresses 0-10. Claim those. */ -- if (dev->mdio.addr > 10) -+ if (dev->addr > 10) - return 0; - - /* look for the switch on the bus */ -@@ -1152,6 +1152,7 @@ static struct phy_driver adm6996_phy_dri - .config_aneg = &adm6996_config_aneg, - .read_status = &adm6996_read_status, - .soft_reset = adm6996_soft_reset, -+ .driver = { .owner = THIS_MODULE,}, - }; - - static int adm6996_gpio_probe(struct platform_device *pdev) -@@ -1220,7 +1221,7 @@ static int __init adm6996_init(void) - int err; - - phy_register_fixup_for_id(PHY_ANY_ID, adm6996_fixup); -- err = phy_driver_register(&adm6996_phy_driver, THIS_MODULE); -+ err = phy_driver_register(&adm6996_phy_driver); - if (err) - return err; - ---- a/drivers/net/phy/ar8216.c -+++ b/drivers/net/phy/ar8216.c -@@ -177,7 +177,7 @@ ar8xxx_phy_check_aneg(struct phy_device - if (ret & BMCR_ANENABLE) - return 0; - -- dev_info(&phydev->mdio.dev, "ANEG disabled, re-enabling ...\n"); -+ dev_info(&phydev->dev, "ANEG disabled, re-enabling ...\n"); - ret |= BMCR_ANENABLE | BMCR_ANRESTART; - return phy_write(phydev, MII_BMCR, ret); - } -@@ -2007,7 +2007,7 @@ ar8xxx_phy_config_init(struct phy_device - - priv->phy = phydev; - -- if (phydev->mdio.addr != 0) { -+ if (phydev->addr != 0) { - if (chip_is_ar8316(priv)) { - /* switch device has been initialized, reinit */ - priv->dev.ports = (AR8216_NUM_PORTS - 1); -@@ -2055,7 +2055,7 @@ ar8xxx_check_link_states(struct ar8xxx_p - /* flush ARL entries for this port if it went down*/ - if (!link_new) - priv->chip->atu_flush_port(priv, i); -- dev_info(&priv->phy->mdio.dev, "Port %d is %s\n", -+ dev_info(&priv->phy->dev, "Port %d is %s\n", - i, link_new ? "up" : "down"); - } - -@@ -2074,10 +2074,10 @@ ar8xxx_phy_read_status(struct phy_device - if (phydev->state == PHY_CHANGELINK) - ar8xxx_check_link_states(priv); - -- if (phydev->mdio.addr != 0) -+ if (phydev->addr != 0) - return genphy_read_status(phydev); - -- ar8216_read_port_link(priv, phydev->mdio.addr, &link); -+ ar8216_read_port_link(priv, phydev->addr, &link); - phydev->link = !!link.link; - if (!phydev->link) - return 0; -@@ -2107,7 +2107,7 @@ ar8xxx_phy_read_status(struct phy_device - static int - ar8xxx_phy_config_aneg(struct phy_device *phydev) - { -- if (phydev->mdio.addr == 0) -+ if (phydev->addr == 0) - return 0; - - return genphy_config_aneg(phydev); -@@ -2162,15 +2162,15 @@ ar8xxx_phy_probe(struct phy_device *phyd - int ret; - - /* skip PHYs at unused adresses */ -- if (phydev->mdio.addr != 0 && phydev->mdio.addr != 4) -+ if (phydev->addr != 0 && phydev->addr != 4) - return -ENODEV; - -- if (!ar8xxx_is_possible(phydev->mdio.bus)) -+ if (!ar8xxx_is_possible(phydev->bus)) - return -ENODEV; - - mutex_lock(&ar8xxx_dev_list_lock); - list_for_each_entry(priv, &ar8xxx_dev_list, list) -- if (priv->mii_bus == phydev->mdio.bus) -+ if (priv->mii_bus == phydev->bus) - goto found; - - priv = ar8xxx_create(); -@@ -2179,7 +2179,7 @@ ar8xxx_phy_probe(struct phy_device *phyd - goto unlock; - } - -- priv->mii_bus = phydev->mdio.bus; -+ priv->mii_bus = phydev->bus; - - ret = ar8xxx_probe_switch(priv); - if (ret) -@@ -2200,7 +2200,7 @@ ar8xxx_phy_probe(struct phy_device *phyd - found: - priv->use_count++; - -- if (phydev->mdio.addr == 0) { -+ if (phydev->addr == 0) { - if (ar8xxx_has_gige(priv)) { - phydev->supported = SUPPORTED_1000baseT_Full; - phydev->advertising = ADVERTISED_1000baseT_Full; -@@ -2288,21 +2288,33 @@ ar8xxx_phy_soft_reset(struct phy_device - return 0; - } - --static struct phy_driver ar8xxx_phy_driver[] = { -- { -- .phy_id = 0x004d0000, -- .name = "Atheros AR8216/AR8236/AR8316", -- .phy_id_mask = 0xffff0000, -- .features = PHY_BASIC_FEATURES, -- .probe = ar8xxx_phy_probe, -- .remove = ar8xxx_phy_remove, -- .detach = ar8xxx_phy_detach, -- .config_init = ar8xxx_phy_config_init, -- .config_aneg = ar8xxx_phy_config_aneg, -- .read_status = ar8xxx_phy_read_status, -- .soft_reset = ar8xxx_phy_soft_reset, -- } -+static struct phy_driver ar8xxx_phy_driver = { -+ .phy_id = 0x004d0000, -+ .name = "Atheros AR8216/AR8236/AR8316", -+ .phy_id_mask = 0xffff0000, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ar8xxx_phy_probe, -+ .remove = ar8xxx_phy_remove, -+ .detach = ar8xxx_phy_detach, -+ .config_init = ar8xxx_phy_config_init, -+ .config_aneg = ar8xxx_phy_config_aneg, -+ .read_status = ar8xxx_phy_read_status, -+ .soft_reset = ar8xxx_phy_soft_reset, -+ .driver = { .owner = THIS_MODULE }, - }; - --module_phy_driver(ar8xxx_phy_driver); -+int __init -+ar8xxx_init(void) -+{ -+ return phy_driver_register(&ar8xxx_phy_driver); -+} -+ -+void __exit -+ar8xxx_exit(void) -+{ -+ phy_driver_unregister(&ar8xxx_phy_driver); -+} -+ -+module_init(ar8xxx_init); -+module_exit(ar8xxx_exit); - MODULE_LICENSE("GPL"); ---- a/drivers/net/phy/ar8327.c -+++ b/drivers/net/phy/ar8327.c -@@ -627,11 +627,11 @@ ar8327_hw_init(struct ar8xxx_priv *priv) - if (!priv->chip_data) - return -ENOMEM; - -- if (priv->phy->mdio.dev.of_node) -- ret = ar8327_hw_config_of(priv, priv->phy->mdio.dev.of_node); -+ if (priv->phy->dev.of_node) -+ ret = ar8327_hw_config_of(priv, priv->phy->dev.of_node); - else - ret = ar8327_hw_config_pdata(priv, -- priv->phy->mdio.dev.platform_data); -+ priv->phy->dev.platform_data); - - if (ret) - return ret; ---- a/drivers/net/phy/ip17xx.c -+++ b/drivers/net/phy/ip17xx.c -@@ -1273,7 +1273,7 @@ static int ip17xx_probe(struct phy_devic - int err; - - /* We only attach to PHY 0, but use all available PHYs */ -- if (pdev->mdio.addr != 0) -+ if (pdev->addr != 0) - return -ENODEV; - - state = kzalloc(sizeof(*state), GFP_KERNEL); -@@ -1283,7 +1283,7 @@ static int ip17xx_probe(struct phy_devic - dev = &state->dev; - - pdev->priv = state; -- state->mii_bus = pdev->mdio.bus; -+ state->mii_bus = pdev->bus; - - err = get_model(state); - if (err < 0) -@@ -1295,7 +1295,7 @@ static int ip17xx_probe(struct phy_devic - dev->name = state->regs->NAME; - dev->ops = &ip17xx_ops; - -- pr_info("IP17xx: Found %s at %s\n", dev->name, dev_name(&pdev->mdio.dev)); -+ pr_info("IP17xx: Found %s at %s\n", dev->name, dev_name(&pdev->dev)); - return 0; - - error: -@@ -1353,25 +1353,58 @@ static int ip17xx_read_status(struct phy - return 0; - } - --static struct phy_driver ip17xx_driver[] = { -- { -- .name = "IC+ IP17xx", -- .phy_id = 0x02430c00, -- .phy_id_mask = 0x0ffffc00, -- .features = PHY_BASIC_FEATURES, -- .probe = ip17xx_probe, -- .remove = ip17xx_remove, -- .config_init = ip17xx_config_init, -- .config_aneg = ip17xx_config_aneg, -- .aneg_done = ip17xx_aneg_done, -- .update_link = ip17xx_update_link, -- .read_status = ip17xx_read_status, -- } -+static struct phy_driver ip17xx_driver = { -+ .name = "IC+ IP17xx", -+ .phy_id = 0x02430c00, -+ .phy_id_mask = 0x0ffffc00, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ip17xx_probe, -+ .remove = ip17xx_remove, -+ .config_init = ip17xx_config_init, -+ .config_aneg = ip17xx_config_aneg, -+ .aneg_done = ip17xx_aneg_done, -+ .update_link = ip17xx_update_link, -+ .read_status = ip17xx_read_status, -+ .driver = { .owner = THIS_MODULE }, - }; - --module_phy_driver(ip17xx_driver); -+static struct phy_driver ip175a_driver = { -+ .name = "IC+ IP175A", -+ .phy_id = 0x02430c50, -+ .phy_id_mask = 0x0ffffff0, -+ .features = PHY_BASIC_FEATURES, -+ .probe = ip17xx_probe, -+ .remove = ip17xx_remove, -+ .config_init = ip17xx_config_init, -+ .config_aneg = ip17xx_config_aneg, -+ .aneg_done = ip17xx_aneg_done, -+ .update_link = ip17xx_update_link, -+ .read_status = ip17xx_read_status, -+ .driver = { .owner = THIS_MODULE }, -+}; -+ -+ -+int __init ip17xx_init(void) -+{ -+ int ret; -+ -+ ret = phy_driver_register(&ip175a_driver); -+ if (ret < 0) -+ return ret; -+ -+ return phy_driver_register(&ip17xx_driver); -+} -+ -+void __exit ip17xx_exit(void) -+{ -+ phy_driver_unregister(&ip17xx_driver); -+ phy_driver_unregister(&ip175a_driver); -+} - - MODULE_AUTHOR("Patrick Horn "); - MODULE_AUTHOR("Felix Fietkau "); - MODULE_AUTHOR("Martin Mares "); - MODULE_LICENSE("GPL"); -+ -+module_init(ip17xx_init); -+module_exit(ip17xx_exit); ---- a/drivers/net/phy/mvswitch.c -+++ b/drivers/net/phy/mvswitch.c -@@ -50,17 +50,13 @@ struct mvswitch_priv { - static inline u16 - r16(struct phy_device *phydev, int addr, int reg) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- return bus->read(bus, addr, reg); -+ return phydev->bus->read(phydev->bus, addr, reg); - } - - static inline void - w16(struct phy_device *phydev, int addr, int reg, u16 val) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- bus->write(bus, addr, reg, val); -+ phydev->bus->write(phydev->bus, addr, reg, val); - } - - -@@ -398,13 +394,12 @@ mvswitch_probe(struct phy_device *pdev) - static int - mvswitch_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; - u16 reg; - -- if (dev->mdio.addr != 0x10) -+ if (dev->addr != 0x10) - return 0; - -- reg = bus->read(bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; -+ reg = dev->bus->read(dev->bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; - if (reg != MV_IDENT_VALUE) - return 0; - -@@ -425,13 +420,14 @@ static struct phy_driver mvswitch_driver - .config_aneg = &mvswitch_config_aneg, - .aneg_done = &mvswitch_aneg_done, - .read_status = &mvswitch_read_status, -+ .driver = { .owner = THIS_MODULE,}, - }; - - static int __init - mvswitch_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, mvswitch_fixup); -- return phy_driver_register(&mvswitch_driver, THIS_MODULE); -+ return phy_driver_register(&mvswitch_driver); - } - - static void __exit ---- a/drivers/net/phy/psb6970.c -+++ b/drivers/net/phy/psb6970.c -@@ -70,16 +70,12 @@ struct psb6970_priv { - - static u16 psb6970_mii_read(struct phy_device *phydev, int reg) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- return bus->read(bus, PHYADDR(reg)); -+ return phydev->bus->read(phydev->bus, PHYADDR(reg)); - } - - static void psb6970_mii_write(struct phy_device *phydev, int reg, u16 val) - { -- struct mii_bus *bus = phydev->mdio.bus; -- -- bus->write(bus, PHYADDR(reg), val); -+ phydev->bus->write(phydev->bus, PHYADDR(reg), val); - } - - static int -@@ -316,11 +312,11 @@ static int psb6970_config_init(struct ph - - priv->phy = pdev; - -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - printk(KERN_INFO "%s: psb6970 switch driver attached.\n", - pdev->attached_dev->name); - -- if (pdev->mdio.addr != 0) { -+ if (pdev->addr != 0) { - kfree(priv); - return 0; - } -@@ -388,14 +384,14 @@ static void psb6970_remove(struct phy_de - if (!priv) - return; - -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - unregister_switch(&priv->dev); - kfree(priv); - } - - static int psb6970_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; -+ struct mii_bus *bus = dev->bus; - u16 reg; - - /* look for the switch on the bus */ -@@ -419,12 +415,13 @@ static struct phy_driver psb6970_driver - .config_init = &psb6970_config_init, - .config_aneg = &psb6970_config_aneg, - .read_status = &psb6970_read_status, -+ .driver = {.owner = THIS_MODULE}, - }; - - int __init psb6970_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, psb6970_fixup); -- return phy_driver_register(&psb6970_driver, THIS_MODULE); -+ return phy_driver_register(&psb6970_driver); - } - - module_init(psb6970_init); ---- a/drivers/net/phy/rtl8306.c -+++ b/drivers/net/phy/rtl8306.c -@@ -877,7 +877,7 @@ rtl8306_config_init(struct phy_device *p - int err; - - /* Only init the switch for the primary PHY */ -- if (pdev->mdio.addr != 0) -+ if (pdev->addr != 0) - return 0; - - val.value.i = 1; -@@ -887,7 +887,7 @@ rtl8306_config_init(struct phy_device *p - priv->dev.ops = &rtl8306_ops; - priv->do_cpu = 0; - priv->page = -1; -- priv->bus = pdev->mdio.bus; -+ priv->bus = pdev->bus; - - chipid = rtl_get(dev, RTL_REG_CHIPID); - chipver = rtl_get(dev, RTL_REG_CHIPVER); -@@ -933,13 +933,13 @@ rtl8306_fixup(struct phy_device *pdev) - u16 chipid; - - /* Attach to primary LAN port and WAN port */ -- if (pdev->mdio.addr != 0 && pdev->mdio.addr != 4) -+ if (pdev->addr != 0 && pdev->addr != 4) - return 0; - - memset(&priv, 0, sizeof(priv)); - priv.fixup = true; - priv.page = -1; -- priv.bus = pdev->mdio.bus; -+ priv.bus = pdev->bus; - chipid = rtl_get(&priv.dev, RTL_REG_CHIPID); - if (chipid == 0x5988) - pdev->phy_id = RTL8306_MAGIC; -@@ -957,14 +957,14 @@ rtl8306_probe(struct phy_device *pdev) - * share one rtl_priv instance between virtual phy - * devices on the same bus - */ -- if (priv->bus == pdev->mdio.bus) -+ if (priv->bus == pdev->bus) - goto found; - } - priv = kzalloc(sizeof(struct rtl_priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - -- priv->bus = pdev->mdio.bus; -+ priv->bus = pdev->bus; - - found: - pdev->priv = priv; -@@ -985,7 +985,7 @@ rtl8306_config_aneg(struct phy_device *p - struct rtl_priv *priv = pdev->priv; - - /* Only for WAN */ -- if (pdev->mdio.addr == 0) -+ if (pdev->addr == 0) - return 0; - - /* Restart autonegotiation */ -@@ -1001,7 +1001,7 @@ rtl8306_read_status(struct phy_device *p - struct rtl_priv *priv = pdev->priv; - struct switch_dev *dev = &priv->dev; - -- if (pdev->mdio.addr == 4) { -+ if (pdev->addr == 4) { - /* WAN */ - pdev->speed = rtl_get(dev, RTL_PORT_REG(4, SPEED)) ? SPEED_100 : SPEED_10; - pdev->duplex = rtl_get(dev, RTL_PORT_REG(4, DUPLEX)) ? DUPLEX_FULL : DUPLEX_HALF; -@@ -1044,6 +1044,7 @@ static struct phy_driver rtl8306_driver - .config_init = &rtl8306_config_init, - .config_aneg = &rtl8306_config_aneg, - .read_status = &rtl8306_read_status, -+ .driver = { .owner = THIS_MODULE,}, - }; - - -@@ -1051,7 +1052,7 @@ static int __init - rtl_init(void) - { - phy_register_fixup_for_id(PHY_ANY_ID, rtl8306_fixup); -- return phy_driver_register(&rtl8306_driver, THIS_MODULE); -+ return phy_driver_register(&rtl8306_driver); - } - - static void __exit ---- a/drivers/net/phy/b53/b53_mdio.c -+++ b/drivers/net/phy/b53/b53_mdio.c -@@ -277,11 +277,11 @@ static int b53_phy_probe(struct phy_devi - int ret; - - /* allow the generic phy driver to take over */ -- if (phydev->mdio.addr != B53_PSEUDO_PHY && phydev->mdio.addr != 0) -+ if (phydev->addr != B53_PSEUDO_PHY && phydev->addr != 0) - return -ENODEV; - - dev.current_page = 0xff; -- dev.priv = phydev->mdio.bus; -+ dev.priv = phydev->bus; - dev.ops = &b53_mdio_ops; - dev.pdata = NULL; - mutex_init(&dev.reg_mutex); -@@ -305,7 +305,7 @@ static int b53_phy_config_init(struct ph - struct b53_device *dev; - int ret; - -- dev = b53_switch_alloc(&phydev->mdio.dev, &b53_mdio_ops, phydev->mdio.bus); -+ dev = b53_switch_alloc(&phydev->dev, &b53_mdio_ops, phydev->bus); - if (!dev) - return -ENOMEM; - -@@ -372,6 +372,9 @@ static struct phy_driver b53_phy_driver_ - .config_aneg = b53_phy_config_aneg, - .config_init = b53_phy_config_init, - .read_status = b53_phy_read_status, -+ .driver = { -+ .owner = THIS_MODULE, -+ }, - }; - - /* BCM53125, BCM53128 */ -@@ -385,6 +388,9 @@ static struct phy_driver b53_phy_driver_ - .config_aneg = b53_phy_config_aneg, - .config_init = b53_phy_config_init, - .read_status = b53_phy_read_status, -+ .driver = { -+ .owner = THIS_MODULE, -+ }, - }; - - /* BCM5365 */ -@@ -398,21 +404,24 @@ static struct phy_driver b53_phy_driver_ - .config_aneg = b53_phy_config_aneg, - .config_init = b53_phy_config_init, - .read_status = b53_phy_read_status, -+ .driver = { -+ .owner = THIS_MODULE, -+ }, - }; - - int __init b53_phy_driver_register(void) - { - int ret; - -- ret = phy_driver_register(&b53_phy_driver_id1, THIS_MODULE); -+ ret = phy_driver_register(&b53_phy_driver_id1); - if (ret) - return ret; - -- ret = phy_driver_register(&b53_phy_driver_id2, THIS_MODULE); -+ ret = phy_driver_register(&b53_phy_driver_id2); - if (ret) - goto err1; - -- ret = phy_driver_register(&b53_phy_driver_id3, THIS_MODULE); -+ ret = phy_driver_register(&b53_phy_driver_id3); - if (!ret) - return 0; - ---- a/drivers/net/phy/b53/b53_phy_fixup.c -+++ b/drivers/net/phy/b53/b53_phy_fixup.c -@@ -28,10 +28,10 @@ - - static int b53_phy_fixup(struct phy_device *dev) - { -- struct mii_bus *bus = dev->mdio.bus; - u32 phy_id; -+ struct mii_bus *bus = dev->bus; - -- if (dev->mdio.addr != B53_PSEUDO_PHY) -+ if (dev->addr != B53_PSEUDO_PHY) - return 0; - - /* read the first port's id */ diff --git a/target/linux/generic/pending-4.4/003-myloader_backport.patch b/target/linux/generic/pending-4.4/003-myloader_backport.patch deleted file mode 100644 index 846b25dc0..000000000 --- a/target/linux/generic/pending-4.4/003-myloader_backport.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/mtd/myloader.c -+++ b/drivers/mtd/myloader.c -@@ -33,7 +33,7 @@ struct part_data { - }; - - static int myloader_parse_partitions(struct mtd_info *master, -- const struct mtd_partition **pparts, -+ struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { - struct part_data *buf; diff --git a/target/linux/generic/pending-4.4/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch b/target/linux/generic/pending-4.4/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch deleted file mode 100644 index f6c9d1eda..000000000 --- a/target/linux/generic/pending-4.4/010-Kbuild-don-t-hardcode-path-to-awk-in-scripts-ld-vers.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Mon, 18 Jan 2016 12:27:49 +0100 -Subject: [PATCH] Kbuild: don't hardcode path to awk in scripts/ld-version.sh - -On some systems /usr/bin/awk does not exist, or is broken. Find it via -$PATH instead. - -Signed-off-by: Felix Fietkau ---- - ---- a/scripts/ld-version.sh -+++ b/scripts/ld-version.sh -@@ -1,8 +1,10 @@ --#!/usr/bin/awk -f -+#!/bin/sh - # extract linker version number from stdin and turn into single number -+exec awk ' - { - gsub(".*\\)", ""); - split($1,a, "."); - print a[1]*10000000 + a[2]*100000 + a[3]*10000 + a[4]*100 + a[5]; - exit - } -+' diff --git a/target/linux/generic/pending-4.4/020-bcma-from-4.5.patch b/target/linux/generic/pending-4.4/020-bcma-from-4.5.patch deleted file mode 100644 index c5d7bc7e5..000000000 --- a/target/linux/generic/pending-4.4/020-bcma-from-4.5.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -672,11 +672,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; - -@@ -695,7 +720,7 @@ static int __init bcma_modinit(void) - - return err; - } --fs_initcall(bcma_modinit); -+module_init(bcma_modinit); - - static void __exit bcma_modexit(void) - { diff --git a/target/linux/generic/pending-4.4/021-bcma-from-4.6.patch b/target/linux/generic/pending-4.4/021-bcma-from-4.6.patch deleted file mode 100644 index dede2f1f2..000000000 --- a/target/linux/generic/pending-4.4/021-bcma-from-4.6.patch +++ /dev/null @@ -1,761 +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 */ -@@ -662,6 +669,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 -@@ -45,10 +45,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); -@@ -60,6 +56,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 -@@ -197,6 +197,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,8 @@ 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_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_FOXCONN, 0xe092) }, - { 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 -@@ -136,7 +136,6 @@ static bool bcma_is_core_needed_early(u1 - return false; - } - --#if defined(CONFIG_OF) && defined(CONFIG_OF_ADDRESS) - static struct device_node *bcma_of_find_child_device(struct platform_device *parent, - struct bcma_device *core) - { -@@ -184,7 +183,7 @@ static unsigned int bcma_of_get_irq(stru - struct of_phandle_args out_irq; - int ret; - -- if (!parent || !parent->dev.of_node) -+ if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent || !parent->dev.of_node) - return 0; - - ret = bcma_of_irq_parse(parent, core, &out_irq, num); -@@ -202,23 +201,15 @@ static void bcma_of_fill_device(struct p - { - struct device_node *node; - -+ if (!IS_ENABLED(CONFIG_OF_IRQ)) -+ return; -+ - node = bcma_of_find_child_device(parent, core); - if (node) - core->dev.of_node = node; - - core->irq = bcma_of_get_irq(parent, core, 0); - } --#else --static void bcma_of_fill_device(struct platform_device *parent, -- struct bcma_device *core) --{ --} --static inline unsigned int bcma_of_get_irq(struct platform_device *parent, -- struct bcma_device *core, int num) --{ -- return 0; --} --#endif /* CONFIG_OF */ - - unsigned int bcma_core_irq(struct bcma_device *core, int num) - { -@@ -350,7 +341,7 @@ static int bcma_register_devices(struct - bcma_register_core(bus, core); - } - --#ifdef CONFIG_BCMA_DRIVER_MIPS -+#ifdef CONFIG_BCMA_PFLASH - if (bus->drv_cc.pflash.present) { - err = platform_device_register(&bcma_pflash_dev); - if (err) diff --git a/target/linux/generic/pending-4.4/022-bcma-from-4.8.patch b/target/linux/generic/pending-4.4/022-bcma-from-4.8.patch deleted file mode 100644 index 3ff4e9496..000000000 --- a/target/linux/generic/pending-4.4/022-bcma-from-4.8.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/drivers/bcma/Kconfig -+++ b/drivers/bcma/Kconfig -@@ -76,9 +76,16 @@ config BCMA_PFLASH - default y - - config BCMA_SFLASH -- bool -- depends on BCMA_DRIVER_MIPS -+ bool "ChipCommon-attached serial flash support" -+ depends on BCMA_HOST_SOC - default y -+ help -+ Some cheap devices have serial flash connected to the ChipCommon -+ instead of independent SPI controller. It requires using a separated -+ driver that implements ChipCommon specific interface communication. -+ -+ Enabling this symbol will let bcma recognize serial flash and register -+ it as platform device. - - config BCMA_NFLASH - bool ---- a/drivers/bcma/driver_chipcommon_b.c -+++ b/drivers/bcma/driver_chipcommon_b.c -@@ -33,11 +33,12 @@ static bool bcma_wait_reg(struct bcma_bu - void bcma_chipco_b_mii_write(struct bcma_drv_cc_b *ccb, u32 offset, u32 value) - { - struct bcma_bus *bus = ccb->core->bus; -+ void __iomem *mii = ccb->mii; - -- writel(offset, ccb->mii + 0x00); -- bcma_wait_reg(bus, ccb->mii + 0x00, 0x0100, 0x0000, 100); -- writel(value, ccb->mii + 0x04); -- bcma_wait_reg(bus, ccb->mii + 0x00, 0x0100, 0x0000, 100); -+ writel(offset, mii + BCMA_CCB_MII_MNG_CTL); -+ bcma_wait_reg(bus, mii + BCMA_CCB_MII_MNG_CTL, 0x0100, 0x0000, 100); -+ writel(value, mii + BCMA_CCB_MII_MNG_CMD_DATA); -+ bcma_wait_reg(bus, mii + BCMA_CCB_MII_MNG_CTL, 0x0100, 0x0000, 100); - } - EXPORT_SYMBOL_GPL(bcma_chipco_b_mii_write); - ---- a/include/linux/bcma/bcma_driver_chipcommon.h -+++ b/include/linux/bcma/bcma_driver_chipcommon.h -@@ -504,6 +504,9 @@ - #define BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK 0x1ff00000 - #define BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT 20 - -+#define BCMA_CCB_MII_MNG_CTL 0x0000 -+#define BCMA_CCB_MII_MNG_CMD_DATA 0x0004 -+ - /* BCM4331 ChipControl numbers. */ - #define BCMA_CHIPCTL_4331_BT_COEXIST BIT(0) /* 0 disable */ - #define BCMA_CHIPCTL_4331_SECI BIT(1) /* 0 SECI is disabled (JATG functional) */ diff --git a/target/linux/generic/pending-4.4/023-bcma-from-4.9.patch b/target/linux/generic/pending-4.4/023-bcma-from-4.9.patch deleted file mode 100644 index 027054c16..000000000 --- a/target/linux/generic/pending-4.4/023-bcma-from-4.9.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/drivers/bcma/driver_chipcommon.c -+++ b/drivers/bcma/driver_chipcommon.c -@@ -36,12 +36,31 @@ u32 bcma_chipco_get_alp_clock(struct bcm - } - EXPORT_SYMBOL_GPL(bcma_chipco_get_alp_clock); - -+static bool bcma_core_cc_has_pmu_watchdog(struct bcma_drv_cc *cc) -+{ -+ struct bcma_bus *bus = cc->core->bus; -+ -+ if (cc->capabilities & BCMA_CC_CAP_PMU) { -+ if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53573) { -+ WARN(bus->chipinfo.rev <= 1, "No watchdog available\n"); -+ /* 53573B0 and 53573B1 have bugged PMU watchdog. It can -+ * be enabled but timer can't be bumped. Use CC one -+ * instead. -+ */ -+ return false; -+ } -+ return true; -+ } else { -+ return false; -+ } -+} -+ - static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc) - { - struct bcma_bus *bus = cc->core->bus; - u32 nb; - -- if (cc->capabilities & BCMA_CC_CAP_PMU) { -+ if (bcma_core_cc_has_pmu_watchdog(cc)) { - if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) - nb = 32; - else if (cc->core->id.rev < 26) -@@ -95,9 +114,16 @@ static int bcma_chipco_watchdog_ticks_pe - - int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc) - { -+ struct bcma_bus *bus = cc->core->bus; - struct bcm47xx_wdt wdt = {}; - struct platform_device *pdev; - -+ if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53573 && -+ bus->chipinfo.rev <= 1) { -+ pr_debug("No watchdog on 53573A0 / 53573A1\n"); -+ return 0; -+ } -+ - wdt.driver_data = cc; - wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; - wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; -@@ -105,7 +131,7 @@ int bcma_chipco_watchdog_register(struct - bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; - - pdev = platform_device_register_data(NULL, "bcm47xx-wdt", -- cc->core->bus->num, &wdt, -+ bus->num, &wdt, - sizeof(wdt)); - if (IS_ERR(pdev)) - return PTR_ERR(pdev); -@@ -217,7 +243,7 @@ u32 bcma_chipco_watchdog_timer_set(struc - u32 maxt; - - maxt = bcma_chipco_watchdog_get_max_timer(cc); -- if (cc->capabilities & BCMA_CC_CAP_PMU) { -+ if (bcma_core_cc_has_pmu_watchdog(cc)) { - if (ticks == 1) - ticks = 2; - else if (ticks > maxt) ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -204,6 +204,9 @@ struct bcma_host_ops { - #define BCMA_PKG_ID_BCM4709 0 - #define BCMA_CHIP_ID_BCM47094 53030 - #define BCMA_CHIP_ID_BCM53018 53018 -+#define BCMA_CHIP_ID_BCM53573 53573 -+#define BCMA_PKG_ID_BCM53573 0 -+#define BCMA_PKG_ID_BCM47189 1 - - /* Board types (on PCI usually equals to the subsystem dev id) */ - /* BCM4313 */ ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -209,6 +209,8 @@ static void bcma_of_fill_device(struct p - core->dev.of_node = node; - - core->irq = bcma_of_get_irq(parent, core, 0); -+ -+ of_dma_configure(&core->dev, node); - } - - unsigned int bcma_core_irq(struct bcma_device *core, int num) -@@ -248,12 +250,12 @@ void bcma_prepare_core(struct bcma_bus * - core->irq = bus->host_pci->irq; - break; - case BCMA_HOSTTYPE_SOC: -- core->dev.dma_mask = &core->dev.coherent_dma_mask; -- if (bus->host_pdev) { -+ if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { - core->dma_dev = &bus->host_pdev->dev; - core->dev.parent = &bus->host_pdev->dev; - bcma_of_fill_device(bus->host_pdev, core); - } else { -+ core->dev.dma_mask = &core->dev.coherent_dma_mask; - core->dma_dev = &core->dev; - } - break; diff --git a/target/linux/generic/pending-4.4/025-bcma-from-4.11.patch b/target/linux/generic/pending-4.4/025-bcma-from-4.11.patch deleted file mode 100644 index a3b032198..000000000 --- a/target/linux/generic/pending-4.4/025-bcma-from-4.11.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -136,17 +136,17 @@ static bool bcma_is_core_needed_early(u1 - return false; - } - --static struct device_node *bcma_of_find_child_device(struct platform_device *parent, -+static struct device_node *bcma_of_find_child_device(struct device *parent, - struct bcma_device *core) - { - struct device_node *node; - u64 size; - const __be32 *reg; - -- if (!parent || !parent->dev.of_node) -+ if (!parent->of_node) - return NULL; - -- for_each_child_of_node(parent->dev.of_node, node) { -+ for_each_child_of_node(parent->of_node, node) { - reg = of_get_address(node, 0, &size, NULL); - if (!reg) - continue; -@@ -156,7 +156,7 @@ static struct device_node *bcma_of_find_ - return NULL; - } - --static int bcma_of_irq_parse(struct platform_device *parent, -+static int bcma_of_irq_parse(struct device *parent, - struct bcma_device *core, - struct of_phandle_args *out_irq, int num) - { -@@ -169,7 +169,7 @@ static int bcma_of_irq_parse(struct plat - return rc; - } - -- out_irq->np = parent->dev.of_node; -+ out_irq->np = parent->of_node; - out_irq->args_count = 1; - out_irq->args[0] = num; - -@@ -177,13 +177,13 @@ static int bcma_of_irq_parse(struct plat - return of_irq_parse_raw(laddr, out_irq); - } - --static unsigned int bcma_of_get_irq(struct platform_device *parent, -+static unsigned int bcma_of_get_irq(struct device *parent, - struct bcma_device *core, int num) - { - struct of_phandle_args out_irq; - int ret; - -- if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent || !parent->dev.of_node) -+ if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node) - return 0; - - ret = bcma_of_irq_parse(parent, core, &out_irq, num); -@@ -196,7 +196,7 @@ static unsigned int bcma_of_get_irq(stru - return irq_create_of_mapping(&out_irq); - } - --static void bcma_of_fill_device(struct platform_device *parent, -+static void bcma_of_fill_device(struct device *parent, - struct bcma_device *core) - { - struct device_node *node; -@@ -227,7 +227,7 @@ unsigned int bcma_core_irq(struct bcma_d - return mips_irq <= 4 ? mips_irq + 2 : 0; - } - if (bus->host_pdev) -- return bcma_of_get_irq(bus->host_pdev, core, num); -+ return bcma_of_get_irq(&bus->host_pdev->dev, core, num); - return 0; - case BCMA_HOSTTYPE_SDIO: - return 0; -@@ -253,7 +253,8 @@ void bcma_prepare_core(struct bcma_bus * - if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { - core->dma_dev = &bus->host_pdev->dev; - core->dev.parent = &bus->host_pdev->dev; -- bcma_of_fill_device(bus->host_pdev, core); -+ if (core->dev.parent) -+ bcma_of_fill_device(core->dev.parent, core); - } else { - core->dev.dma_mask = &core->dev.coherent_dma_mask; - core->dma_dev = &core->dev; diff --git a/target/linux/generic/pending-4.4/026-bcma-from-4.12.patch b/target/linux/generic/pending-4.4/026-bcma-from-4.12.patch deleted file mode 100644 index bd7d643cb..000000000 --- a/target/linux/generic/pending-4.4/026-bcma-from-4.12.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/drivers/bcma/driver_gpio.c -+++ b/drivers/bcma/driver_gpio.c -@@ -190,8 +190,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c - chip->owner = THIS_MODULE; - chip->dev = bcma_bus_get_host_dev(bus); - #if IS_BUILTIN(CONFIG_OF) -- if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC) -- chip->of_node = cc->core->dev.of_node; -+ chip->of_node = cc->core->dev.of_node; - #endif - switch (bus->chipinfo.id) { - case BCMA_CHIP_ID_BCM4707: ---- a/drivers/bcma/main.c -+++ b/drivers/bcma/main.c -@@ -201,9 +201,6 @@ static void bcma_of_fill_device(struct d - { - struct device_node *node; - -- if (!IS_ENABLED(CONFIG_OF_IRQ)) -- return; -- - node = bcma_of_find_child_device(parent, core); - if (node) - core->dev.of_node = node; -@@ -242,19 +239,18 @@ void bcma_prepare_core(struct bcma_bus * - core->dev.release = bcma_release_core_dev; - core->dev.bus = &bcma_bus_type; - dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); -+ core->dev.parent = bcma_bus_get_host_dev(bus); -+ if (core->dev.parent) -+ bcma_of_fill_device(core->dev.parent, core); - - switch (bus->hosttype) { - case BCMA_HOSTTYPE_PCI: -- core->dev.parent = &bus->host_pci->dev; - core->dma_dev = &bus->host_pci->dev; - core->irq = bus->host_pci->irq; - break; - case BCMA_HOSTTYPE_SOC: - if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { - core->dma_dev = &bus->host_pdev->dev; -- core->dev.parent = &bus->host_pdev->dev; -- if (core->dev.parent) -- bcma_of_fill_device(core->dev.parent, core); - } else { - core->dev.dma_mask = &core->dev.coherent_dma_mask; - core->dma_dev = &core->dev; diff --git a/target/linux/generic/pending-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/pending-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch deleted file mode 100644 index 36fb936e3..000000000 --- a/target/linux/generic/pending-4.4/030-1-smsc95xx-Use-skb_cow_head-to-deal-with-cloned-skbs.patch +++ /dev/null @@ -1,40 +0,0 @@ -From e9156cd26a495a18706e796f02a81fee41ec14f4 Mon Sep 17 00:00:00 2001 -From: James Hughes -Date: Wed, 19 Apr 2017 11:13:40 +0100 -Subject: [PATCH] smsc95xx: Use skb_cow_head to deal with cloned skbs - -The driver was failing to check that the SKB wasn't cloned -before adding checksum data. -Replace existing handling to extend/copy the header buffer -with skb_cow_head. - -Signed-off-by: James Hughes -Acked-by: Eric Dumazet -Acked-by: Woojung Huh -Signed-off-by: David S. Miller ---- - drivers/net/usb/smsc95xx.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -1835,13 +1835,13 @@ static struct sk_buff *smsc95xx_tx_fixup - /* We do not advertise SG, so skbs should be already linearized */ - BUG_ON(skb_shinfo(skb)->nr_frags); - -- if (skb_headroom(skb) < overhead) { -- struct sk_buff *skb2 = skb_copy_expand(skb, -- overhead, 0, flags); -+ /* Make writable and expand header space by overhead if required */ -+ if (skb_cow_head(skb, overhead)) { -+ /* Must deallocate here as returning NULL to indicate error -+ * means the skb won't be deallocated in the caller. -+ */ - dev_kfree_skb_any(skb); -- skb = skb2; -- if (!skb) -- return NULL; -+ return NULL; - } - - if (csum) { diff --git a/target/linux/generic/pending-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/pending-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch deleted file mode 100644 index 2e8bba57e..000000000 --- a/target/linux/generic/pending-4.4/030-6-ch9200-use-skb_cow_head-to-deal-with-cloned-skbs.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6bc6895bdd6744e0136eaa4a11fbdb20a7db4e40 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Wed, 19 Apr 2017 09:59:25 -0700 -Subject: [PATCH] ch9200: use skb_cow_head() to deal with cloned skbs - -We need to ensure there is enough headroom to push extra header, -but we also need to check if we are allowed to change headers. - -skb_cow_head() is the proper helper to deal with this. - -Fixes: 4a476bd6d1d9 ("usbnet: New driver for QinHeng CH9200 devices") -Signed-off-by: Eric Dumazet -Cc: James Hughes -Cc: Matthew Garrett -Signed-off-by: David S. Miller ---- - drivers/net/usb/ch9200.c | 9 ++------- - 1 file changed, 2 insertions(+), 7 deletions(-) - ---- a/drivers/net/usb/ch9200.c -+++ b/drivers/net/usb/ch9200.c -@@ -255,14 +255,9 @@ static struct sk_buff *ch9200_tx_fixup(s - tx_overhead = 0x40; - - len = skb->len; -- if (skb_headroom(skb) < tx_overhead) { -- struct sk_buff *skb2; -- -- skb2 = skb_copy_expand(skb, tx_overhead, 0, flags); -+ if (skb_cow_head(skb, tx_overhead)) { - dev_kfree_skb_any(skb); -- skb = skb2; -- if (!skb) -- return NULL; -+ return NULL; - } - - __skb_push(skb, tx_overhead); diff --git a/target/linux/generic/pending-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch b/target/linux/generic/pending-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch deleted file mode 100644 index 541c694be..000000000 --- a/target/linux/generic/pending-4.4/030-7-kaweth-use-skb_cow_head-to-deal-with-cloned-skbs.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 39fba7835aacda65284a86e611774cbba71dac20 Mon Sep 17 00:00:00 2001 -From: Eric Dumazet -Date: Wed, 19 Apr 2017 09:59:26 -0700 -Subject: [PATCH] kaweth: use skb_cow_head() to deal with cloned skbs - -We can use skb_cow_head() to properly deal with clones, -especially the ones coming from TCP stack that allow their head being -modified. This avoids a copy. - -Signed-off-by: Eric Dumazet -Cc: James Hughes -Signed-off-by: David S. Miller ---- - drivers/net/usb/kaweth.c | 18 ++++++------------ - 1 file changed, 6 insertions(+), 12 deletions(-) - ---- a/drivers/net/usb/kaweth.c -+++ b/drivers/net/usb/kaweth.c -@@ -812,18 +812,12 @@ static netdev_tx_t kaweth_start_xmit(str - } - - /* We now decide whether we can put our special header into the sk_buff */ -- if (skb_cloned(skb) || skb_headroom(skb) < 2) { -- /* no such luck - we make our own */ -- struct sk_buff *copied_skb; -- copied_skb = skb_copy_expand(skb, 2, 0, GFP_ATOMIC); -- dev_kfree_skb_irq(skb); -- skb = copied_skb; -- if (!copied_skb) { -- kaweth->stats.tx_errors++; -- netif_start_queue(net); -- spin_unlock_irq(&kaweth->device_lock); -- return NETDEV_TX_OK; -- } -+ if (skb_cow_head(skb, 2)) { -+ kaweth->stats.tx_errors++; -+ netif_start_queue(net); -+ spin_unlock_irq(&kaweth->device_lock); -+ dev_kfree_skb_any(skb); -+ return NETDEV_TX_OK; - } - - private_header = (__le16 *)__skb_push(skb, 2); diff --git a/target/linux/generic/pending-4.4/032-fq_codel-add-batch-ability-to-fq_codel_drop.patch b/target/linux/generic/pending-4.4/032-fq_codel-add-batch-ability-to-fq_codel_drop.patch deleted file mode 100644 index d1390348c..000000000 --- a/target/linux/generic/pending-4.4/032-fq_codel-add-batch-ability-to-fq_codel_drop.patch +++ /dev/null @@ -1,189 +0,0 @@ -From: Eric Dumazet -Date: Sun, 1 May 2016 16:47:26 -0700 -Subject: [PATCH] fq_codel: add batch ability to fq_codel_drop() - -In presence of inelastic flows and stress, we can call -fq_codel_drop() for every packet entering fq_codel qdisc. - -fq_codel_drop() is quite expensive, as it does a linear scan -of 4 KB of memory to find a fat flow. -Once found, it drops the oldest packet of this flow. - -Instead of dropping a single packet, try to drop 50% of the backlog -of this fat flow, with a configurable limit of 64 packets per round. - -TCA_FQ_CODEL_DROP_BATCH_SIZE is the new attribute to make this -limit configurable. - -With this strategy the 4 KB search is amortized to a single cache line -per drop [1], so fq_codel_drop() no longer appears at the top of kernel -profile in presence of few inelastic flows. - -[1] Assuming a 64byte cache line, and 1024 buckets - -Signed-off-by: Eric Dumazet -Reported-by: Dave Taht -Cc: Jonathan Morton -Acked-by: Jesper Dangaard Brouer -Acked-by: Dave Taht -Signed-off-by: David S. Miller ---- - ---- a/include/uapi/linux/pkt_sched.h -+++ b/include/uapi/linux/pkt_sched.h -@@ -711,6 +711,7 @@ enum { - TCA_FQ_CODEL_FLOWS, - TCA_FQ_CODEL_QUANTUM, - TCA_FQ_CODEL_CE_THRESHOLD, -+ TCA_FQ_CODEL_DROP_BATCH_SIZE, - __TCA_FQ_CODEL_MAX - }; - ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -57,6 +57,7 @@ struct fq_codel_sched_data { - u32 flows_cnt; /* number of flows */ - u32 perturbation; /* hash perturbation */ - u32 quantum; /* psched_mtu(qdisc_dev(sch)); */ -+ u32 drop_batch_size; - struct codel_params cparams; - struct codel_stats cstats; - u32 drop_overlimit; -@@ -133,17 +134,20 @@ static inline void flow_queue_add(struct - skb->next = NULL; - } - --static unsigned int fq_codel_drop(struct Qdisc *sch) -+static unsigned int fq_codel_drop(struct Qdisc *sch, unsigned int max_packets) - { - struct fq_codel_sched_data *q = qdisc_priv(sch); - struct sk_buff *skb; - unsigned int maxbacklog = 0, idx = 0, i, len; - struct fq_codel_flow *flow; -+ unsigned int threshold; - -- /* Queue is full! Find the fat flow and drop packet from it. -+ /* Queue is full! Find the fat flow and drop packet(s) from it. - * This might sound expensive, but with 1024 flows, we scan - * 4KB of memory, and we dont need to handle a complex tree - * in fast path (packet queue/enqueue) with many cache misses. -+ * In stress mode, we'll try to drop 64 packets from the flow, -+ * amortizing this linear lookup to one cache line per drop. - */ - for (i = 0; i < q->flows_cnt; i++) { - if (q->backlogs[i] > maxbacklog) { -@@ -151,15 +155,24 @@ static unsigned int fq_codel_drop(struct - idx = i; - } - } -+ -+ /* Our goal is to drop half of this fat flow backlog */ -+ threshold = maxbacklog >> 1; -+ - flow = &q->flows[idx]; -- skb = dequeue_head(flow); -- len = qdisc_pkt_len(skb); -+ len = 0; -+ i = 0; -+ do { -+ skb = dequeue_head(flow); -+ len += qdisc_pkt_len(skb); -+ kfree_skb(skb); -+ } while (++i < max_packets && len < threshold); -+ -+ flow->dropped += i; - q->backlogs[idx] -= len; -- sch->q.qlen--; -- qdisc_qstats_drop(sch); -- qdisc_qstats_backlog_dec(sch, skb); -- kfree_skb(skb); -- flow->dropped++; -+ sch->qstats.drops += i; -+ sch->qstats.backlog -= len; -+ sch->q.qlen -= i; - return idx; - } - -@@ -168,14 +181,14 @@ static unsigned int fq_codel_qdisc_drop( - unsigned int prev_backlog; - - prev_backlog = sch->qstats.backlog; -- fq_codel_drop(sch); -+ fq_codel_drop(sch, 1U); - return prev_backlog - sch->qstats.backlog; - } - - static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) - { - struct fq_codel_sched_data *q = qdisc_priv(sch); -- unsigned int idx, prev_backlog; -+ unsigned int idx, prev_backlog, prev_qlen; - struct fq_codel_flow *flow; - int uninitialized_var(ret); - -@@ -204,16 +217,22 @@ static int fq_codel_enqueue(struct sk_bu - return NET_XMIT_SUCCESS; - - prev_backlog = sch->qstats.backlog; -- q->drop_overlimit++; -- /* Return Congestion Notification only if we dropped a packet -- * from this flow. -+ prev_qlen = sch->q.qlen; -+ -+ /* fq_codel_drop() is quite expensive, as it performs a linear search -+ * in q->backlogs[] to find a fat flow. -+ * So instead of dropping a single packet, drop half of its backlog -+ * with a 64 packets limit to not add a too big cpu spike here. - */ -- if (fq_codel_drop(sch) == idx) -- return NET_XMIT_CN; -+ ret = fq_codel_drop(sch, q->drop_batch_size); -+ -+ q->drop_overlimit += prev_qlen - sch->q.qlen; - -- /* As we dropped a packet, better let upper stack know this */ -- qdisc_tree_reduce_backlog(sch, 1, prev_backlog - sch->qstats.backlog); -- return NET_XMIT_SUCCESS; -+ /* As we dropped packet(s), better let upper stack know this */ -+ qdisc_tree_reduce_backlog(sch, prev_qlen - sch->q.qlen, -+ prev_backlog - sch->qstats.backlog); -+ -+ return ret == idx ? NET_XMIT_CN : NET_XMIT_SUCCESS; - } - - /* This is the specific function called from codel_dequeue() -@@ -323,6 +342,7 @@ static const struct nla_policy fq_codel_ - [TCA_FQ_CODEL_FLOWS] = { .type = NLA_U32 }, - [TCA_FQ_CODEL_QUANTUM] = { .type = NLA_U32 }, - [TCA_FQ_CODEL_CE_THRESHOLD] = { .type = NLA_U32 }, -+ [TCA_FQ_CODEL_DROP_BATCH_SIZE] = { .type = NLA_U32 }, - }; - - static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt) -@@ -374,6 +394,9 @@ static int fq_codel_change(struct Qdisc - if (tb[TCA_FQ_CODEL_QUANTUM]) - q->quantum = max(256U, nla_get_u32(tb[TCA_FQ_CODEL_QUANTUM])); - -+ if (tb[TCA_FQ_CODEL_DROP_BATCH_SIZE]) -+ q->drop_batch_size = min(1U, nla_get_u32(tb[TCA_FQ_CODEL_DROP_BATCH_SIZE])); -+ - while (sch->q.qlen > sch->limit) { - struct sk_buff *skb = fq_codel_dequeue(sch); - -@@ -419,6 +442,7 @@ static int fq_codel_init(struct Qdisc *s - - sch->limit = 10*1024; - q->flows_cnt = 1024; -+ q->drop_batch_size = 64; - q->quantum = psched_mtu(qdisc_dev(sch)); - q->perturbation = prandom_u32(); - INIT_LIST_HEAD(&q->new_flows); -@@ -476,6 +500,8 @@ static int fq_codel_dump(struct Qdisc *s - q->cparams.ecn) || - nla_put_u32(skb, TCA_FQ_CODEL_QUANTUM, - q->quantum) || -+ nla_put_u32(skb, TCA_FQ_CODEL_DROP_BATCH_SIZE, -+ q->drop_batch_size) || - nla_put_u32(skb, TCA_FQ_CODEL_FLOWS, - q->flows_cnt)) - goto nla_put_failure; diff --git a/target/linux/generic/pending-4.4/033-fq_codel-add-memory-limitation-per-queue.patch b/target/linux/generic/pending-4.4/033-fq_codel-add-memory-limitation-per-queue.patch deleted file mode 100644 index 455add9ea..000000000 --- a/target/linux/generic/pending-4.4/033-fq_codel-add-memory-limitation-per-queue.patch +++ /dev/null @@ -1,182 +0,0 @@ -From: Eric Dumazet -Date: Fri, 6 May 2016 08:55:12 -0700 -Subject: [PATCH] fq_codel: add memory limitation per queue -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On small embedded routers, one wants to control maximal amount of -memory used by fq_codel, instead of controlling number of packets or -bytes, since GRO/TSO make these not practical. - -Assuming skb->truesize is accurate, we have to keep track of -skb->truesize sum for skbs in queue. - -This patch adds a new TCA_FQ_CODEL_MEMORY_LIMIT attribute. - -I chose a default value of 32 MBytes, which looks reasonable even -for heavy duty usages. (Prior fq_codel users should not be hurt -when they upgrade their kernels) - -Two fields are added to tc_fq_codel_qd_stats to report : - - Current memory usage - - Number of drops caused by memory limits - -# tc qd replace dev eth1 root est 1sec 4sec fq_codel memory_limit 4M -.. -# tc -s -d qd sh dev eth1 -qdisc fq_codel 8008: root refcnt 257 limit 10240p flows 1024 - quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn - Sent 2083566791363 bytes 1376214889 pkt (dropped 4994406, overlimits 0 -requeues 21705223) - rate 9841Mbit 812549pps backlog 3906120b 376p requeues 21705223 - maxpacket 68130 drop_overlimit 4994406 new_flow_count 28855414 - ecn_mark 0 memory_used 4190048 drop_overmemory 4994406 - new_flows_len 1 old_flows_len 177 - -Signed-off-by: Eric Dumazet -Cc: Jesper Dangaard Brouer -Cc: Dave Täht -Cc: Sebastian Möller -Signed-off-by: David S. Miller ---- - ---- a/include/uapi/linux/pkt_sched.h -+++ b/include/uapi/linux/pkt_sched.h -@@ -712,6 +712,7 @@ enum { - TCA_FQ_CODEL_QUANTUM, - TCA_FQ_CODEL_CE_THRESHOLD, - TCA_FQ_CODEL_DROP_BATCH_SIZE, -+ TCA_FQ_CODEL_MEMORY_LIMIT, - __TCA_FQ_CODEL_MAX - }; - -@@ -736,6 +737,8 @@ struct tc_fq_codel_qd_stats { - __u32 new_flows_len; /* count of flows in new list */ - __u32 old_flows_len; /* count of flows in old list */ - __u32 ce_mark; /* packets above ce_threshold */ -+ __u32 memory_usage; /* in bytes */ -+ __u32 drop_overmemory; - }; - - struct tc_fq_codel_cl_stats { ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -58,8 +58,11 @@ struct fq_codel_sched_data { - u32 perturbation; /* hash perturbation */ - u32 quantum; /* psched_mtu(qdisc_dev(sch)); */ - u32 drop_batch_size; -+ u32 memory_limit; - struct codel_params cparams; - struct codel_stats cstats; -+ u32 memory_usage; -+ u32 drop_overmemory; - u32 drop_overlimit; - u32 new_flow_count; - -@@ -141,6 +144,7 @@ static unsigned int fq_codel_drop(struct - unsigned int maxbacklog = 0, idx = 0, i, len; - struct fq_codel_flow *flow; - unsigned int threshold; -+ unsigned int mem = 0; - - /* Queue is full! Find the fat flow and drop packet(s) from it. - * This might sound expensive, but with 1024 flows, we scan -@@ -165,11 +169,13 @@ static unsigned int fq_codel_drop(struct - do { - skb = dequeue_head(flow); - len += qdisc_pkt_len(skb); -+ mem += skb->truesize; - kfree_skb(skb); - } while (++i < max_packets && len < threshold); - - flow->dropped += i; - q->backlogs[idx] -= len; -+ q->memory_usage -= mem; - sch->qstats.drops += i; - sch->qstats.backlog -= len; - sch->q.qlen -= i; -@@ -191,6 +197,7 @@ static int fq_codel_enqueue(struct sk_bu - unsigned int idx, prev_backlog, prev_qlen; - struct fq_codel_flow *flow; - int uninitialized_var(ret); -+ bool memory_limited; - - idx = fq_codel_classify(skb, sch, &ret); - if (idx == 0) { -@@ -213,7 +220,9 @@ static int fq_codel_enqueue(struct sk_bu - flow->deficit = q->quantum; - flow->dropped = 0; - } -- if (++sch->q.qlen <= sch->limit) -+ q->memory_usage += skb->truesize; -+ memory_limited = q->memory_usage > q->memory_limit; -+ if (++sch->q.qlen <= sch->limit && !memory_limited) - return NET_XMIT_SUCCESS; - - prev_backlog = sch->qstats.backlog; -@@ -227,7 +236,8 @@ static int fq_codel_enqueue(struct sk_bu - ret = fq_codel_drop(sch, q->drop_batch_size); - - q->drop_overlimit += prev_qlen - sch->q.qlen; -- -+ if (memory_limited) -+ q->drop_overmemory += prev_qlen - sch->q.qlen; - /* As we dropped packet(s), better let upper stack know this */ - qdisc_tree_reduce_backlog(sch, prev_qlen - sch->q.qlen, - prev_backlog - sch->qstats.backlog); -@@ -296,6 +306,7 @@ begin: - list_del_init(&flow->flowchain); - goto begin; - } -+ q->memory_usage -= skb->truesize; - qdisc_bstats_update(sch, skb); - flow->deficit -= qdisc_pkt_len(skb); - /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -@@ -343,6 +354,7 @@ static const struct nla_policy fq_codel_ - [TCA_FQ_CODEL_QUANTUM] = { .type = NLA_U32 }, - [TCA_FQ_CODEL_CE_THRESHOLD] = { .type = NLA_U32 }, - [TCA_FQ_CODEL_DROP_BATCH_SIZE] = { .type = NLA_U32 }, -+ [TCA_FQ_CODEL_MEMORY_LIMIT] = { .type = NLA_U32 }, - }; - - static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt) -@@ -397,7 +409,11 @@ static int fq_codel_change(struct Qdisc - if (tb[TCA_FQ_CODEL_DROP_BATCH_SIZE]) - q->drop_batch_size = min(1U, nla_get_u32(tb[TCA_FQ_CODEL_DROP_BATCH_SIZE])); - -- while (sch->q.qlen > sch->limit) { -+ if (tb[TCA_FQ_CODEL_MEMORY_LIMIT]) -+ q->memory_limit = min(1U << 31, nla_get_u32(tb[TCA_FQ_CODEL_MEMORY_LIMIT])); -+ -+ while (sch->q.qlen > sch->limit || -+ q->memory_usage > q->memory_limit) { - struct sk_buff *skb = fq_codel_dequeue(sch); - - q->cstats.drop_len += qdisc_pkt_len(skb); -@@ -442,6 +458,7 @@ static int fq_codel_init(struct Qdisc *s - - sch->limit = 10*1024; - q->flows_cnt = 1024; -+ q->memory_limit = 32 << 20; /* 32 MBytes */ - q->drop_batch_size = 64; - q->quantum = psched_mtu(qdisc_dev(sch)); - q->perturbation = prandom_u32(); -@@ -502,6 +519,8 @@ static int fq_codel_dump(struct Qdisc *s - q->quantum) || - nla_put_u32(skb, TCA_FQ_CODEL_DROP_BATCH_SIZE, - q->drop_batch_size) || -+ nla_put_u32(skb, TCA_FQ_CODEL_MEMORY_LIMIT, -+ q->memory_limit) || - nla_put_u32(skb, TCA_FQ_CODEL_FLOWS, - q->flows_cnt)) - goto nla_put_failure; -@@ -530,6 +549,8 @@ static int fq_codel_dump_stats(struct Qd - st.qdisc_stats.ecn_mark = q->cstats.ecn_mark; - st.qdisc_stats.new_flow_count = q->new_flow_count; - st.qdisc_stats.ce_mark = q->cstats.ce_mark; -+ st.qdisc_stats.memory_usage = q->memory_usage; -+ st.qdisc_stats.drop_overmemory = q->drop_overmemory; - - list_for_each(pos, &q->new_flows) - st.qdisc_stats.new_flows_len++; diff --git a/target/linux/generic/pending-4.4/034-fq_codel-fix-memory-limitation-drift.patch b/target/linux/generic/pending-4.4/034-fq_codel-fix-memory-limitation-drift.patch deleted file mode 100644 index 45fff7bae..000000000 --- a/target/linux/generic/pending-4.4/034-fq_codel-fix-memory-limitation-drift.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: Eric Dumazet -Date: Sun, 15 May 2016 18:16:38 -0700 -Subject: [PATCH] fq_codel: fix memory limitation drift - -memory_usage must be decreased in dequeue_func(), not in -fq_codel_dequeue(), otherwise packets dropped by Codel algo -are missing this decrease. - -Also we need to clear memory_usage in fq_codel_reset() - -Fixes: 95b58430abe7 ("fq_codel: add memory limitation per queue") -Signed-off-by: Eric Dumazet ---- - ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -259,6 +259,7 @@ static struct sk_buff *dequeue(struct co - if (flow->head) { - skb = dequeue_head(flow); - q->backlogs[flow - q->flows] -= qdisc_pkt_len(skb); -+ q->memory_usage -= skb->truesize; - sch->q.qlen--; - } - return skb; -@@ -306,7 +307,6 @@ begin: - list_del_init(&flow->flowchain); - goto begin; - } -- q->memory_usage -= skb->truesize; - qdisc_bstats_update(sch, skb); - flow->deficit -= qdisc_pkt_len(skb); - /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -@@ -343,6 +343,7 @@ static void fq_codel_reset(struct Qdisc - } - memset(q->backlogs, 0, q->flows_cnt * sizeof(u32)); - sch->q.qlen = 0; -+ q->memory_usage = 0; - } - - static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = { diff --git a/target/linux/generic/pending-4.4/035-fq_codel-fix-NET_XMIT_CN-behavior.patch b/target/linux/generic/pending-4.4/035-fq_codel-fix-NET_XMIT_CN-behavior.patch deleted file mode 100644 index a1902fea0..000000000 --- a/target/linux/generic/pending-4.4/035-fq_codel-fix-NET_XMIT_CN-behavior.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Eric Dumazet -Date: Sat, 4 Jun 2016 12:55:13 -0700 -Subject: [PATCH] fq_codel: fix NET_XMIT_CN behavior - -My prior attempt to fix the backlogs of parents failed. - -If we return NET_XMIT_CN, our parents wont increase their backlog, -so our qdisc_tree_reduce_backlog() should take this into account. - -v2: Florian Westphal pointed out that we could drop the packet, -so we need to save qdisc_pkt_len(skb) in a temp variable before -calling fq_codel_drop() - -Fixes: 9d18562a2278 ("fq_codel: add batch ability to fq_codel_drop()") -Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too") -Reported-by: Stas Nichiporovich -Signed-off-by: Eric Dumazet -Cc: WANG Cong -Cc: Jamal Hadi Salim ---- - ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -197,6 +197,7 @@ static int fq_codel_enqueue(struct sk_bu - unsigned int idx, prev_backlog, prev_qlen; - struct fq_codel_flow *flow; - int uninitialized_var(ret); -+ unsigned int pkt_len; - bool memory_limited; - - idx = fq_codel_classify(skb, sch, &ret); -@@ -228,6 +229,8 @@ static int fq_codel_enqueue(struct sk_bu - prev_backlog = sch->qstats.backlog; - prev_qlen = sch->q.qlen; - -+ /* save this packet length as it might be dropped by fq_codel_drop() */ -+ pkt_len = qdisc_pkt_len(skb); - /* fq_codel_drop() is quite expensive, as it performs a linear search - * in q->backlogs[] to find a fat flow. - * So instead of dropping a single packet, drop half of its backlog -@@ -235,14 +238,23 @@ static int fq_codel_enqueue(struct sk_bu - */ - ret = fq_codel_drop(sch, q->drop_batch_size); - -- q->drop_overlimit += prev_qlen - sch->q.qlen; -+ prev_qlen -= sch->q.qlen; -+ prev_backlog -= sch->qstats.backlog; -+ q->drop_overlimit += prev_qlen; - if (memory_limited) -- q->drop_overmemory += prev_qlen - sch->q.qlen; -- /* As we dropped packet(s), better let upper stack know this */ -- qdisc_tree_reduce_backlog(sch, prev_qlen - sch->q.qlen, -- prev_backlog - sch->qstats.backlog); -+ q->drop_overmemory += prev_qlen; - -- return ret == idx ? NET_XMIT_CN : NET_XMIT_SUCCESS; -+ /* As we dropped packet(s), better let upper stack know this. -+ * If we dropped a packet for this flow, return NET_XMIT_CN, -+ * but in this case, our parents wont increase their backlogs. -+ */ -+ if (ret == idx) { -+ qdisc_tree_reduce_backlog(sch, prev_qlen - 1, -+ prev_backlog - pkt_len); -+ return NET_XMIT_CN; -+ } -+ qdisc_tree_reduce_backlog(sch, prev_qlen, prev_backlog); -+ return NET_XMIT_SUCCESS; - } - - /* This is the specific function called from codel_dequeue() diff --git a/target/linux/generic/pending-4.4/041-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch b/target/linux/generic/pending-4.4/041-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch deleted file mode 100644 index 8214013c5..000000000 --- a/target/linux/generic/pending-4.4/041-mtd-spi-nor-include-mtd.h-header-for-struct-mtd_info.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 2c81de771f38e54324ede3f24118f4852570b384 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -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 -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 -Signed-off-by: Brian Norris ---- - 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/pending-4.4/042-0001-mtd-bcm47xxsflash-use-ioremap_cache-instead-of-KSEG0.patch b/target/linux/generic/pending-4.4/042-0001-mtd-bcm47xxsflash-use-ioremap_cache-instead-of-KSEG0.patch deleted file mode 100644 index 89f1e5ecc..000000000 --- a/target/linux/generic/pending-4.4/042-0001-mtd-bcm47xxsflash-use-ioremap_cache-instead-of-KSEG0.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 5651d6aaf489d1db48c253cf884b40214e91c2c5 Mon Sep 17 00:00:00 2001 -From: Brian Norris -Date: Fri, 26 Feb 2016 11:50:28 +0100 -Subject: [PATCH] mtd: bcm47xxsflash: use ioremap_cache() instead of - KSEG0ADDR() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Using KSEG0ADDR makes code highly MIPS dependent and not portable. -Thanks to the fix a68f376 ("MIPS: io.h: Define `ioremap_cache'") we can -use ioremap_cache which is generic and supported on MIPS as well now. - -KSEG0ADDR was translating 0x1c000000 into 0x9c000000. With ioremap_cache -we use MIPS's __ioremap (and then remap_area_pages). This results in -different address (e.g. 0xc0080000) but it still should be cached as -expected and it was successfully tested with BCM47186B0. - -Other than that drivers/bcma/driver_chipcommon_sflash.c nicely setups a -struct resource for access window, but we wren't using it. Use it now -and drop duplicated info. - -Signed-off-by: Brian Norris -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/bcma/driver_chipcommon_sflash.c -+++ b/drivers/bcma/driver_chipcommon_sflash.c -@@ -146,7 +146,6 @@ int bcma_sflash_init(struct bcma_drv_cc - return -ENOTSUPP; - } - -- sflash->window = BCMA_SOC_FLASH2; - sflash->blocksize = e->blocksize; - sflash->numblocks = e->numblocks; - sflash->size = sflash->blocksize * sflash->numblocks; ---- a/drivers/mtd/devices/bcm47xxsflash.c -+++ b/drivers/mtd/devices/bcm47xxsflash.c -@@ -2,6 +2,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -109,8 +110,7 @@ static int bcm47xxsflash_read(struct mtd - if ((from + len) > mtd->size) - return -EINVAL; - -- memcpy_fromio(buf, (void __iomem *)KSEG0ADDR(b47s->window + from), -- len); -+ memcpy_fromio(buf, b47s->window + from, len); - *retlen = len; - - return len; -@@ -275,15 +275,33 @@ static void bcm47xxsflash_bcma_cc_write( - - static int bcm47xxsflash_bcma_probe(struct platform_device *pdev) - { -- struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev); -+ struct device *dev = &pdev->dev; -+ struct bcma_sflash *sflash = dev_get_platdata(dev); - struct bcm47xxsflash *b47s; -+ struct resource *res; - int err; - -- b47s = devm_kzalloc(&pdev->dev, sizeof(*b47s), GFP_KERNEL); -+ b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL); - if (!b47s) - return -ENOMEM; - sflash->priv = b47s; - -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) { -+ dev_err(dev, "invalid resource\n"); -+ return -EINVAL; -+ } -+ if (!devm_request_mem_region(dev, res->start, resource_size(res), -+ res->name)) { -+ dev_err(dev, "can't request region for resource %pR\n", res); -+ return -EBUSY; -+ } -+ b47s->window = ioremap_cache(res->start, resource_size(res)); -+ if (!b47s->window) { -+ dev_err(dev, "ioremap failed for resource %pR\n", res); -+ return -ENOMEM; -+ } -+ - b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash); - b47s->cc_read = bcm47xxsflash_bcma_cc_read; - b47s->cc_write = bcm47xxsflash_bcma_cc_write; -@@ -297,7 +315,6 @@ static int bcm47xxsflash_bcma_probe(stru - break; - } - -- b47s->window = sflash->window; - b47s->blocksize = sflash->blocksize; - b47s->numblocks = sflash->numblocks; - b47s->size = sflash->size; -@@ -306,6 +323,7 @@ static int bcm47xxsflash_bcma_probe(stru - err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0); - if (err) { - pr_err("Failed to register MTD device: %d\n", err); -+ iounmap(b47s->window); - return err; - } - -@@ -321,6 +339,7 @@ static int bcm47xxsflash_bcma_remove(str - struct bcm47xxsflash *b47s = sflash->priv; - - mtd_device_unregister(&b47s->mtd); -+ iounmap(b47s->window); - - return 0; - } ---- a/drivers/mtd/devices/bcm47xxsflash.h -+++ b/drivers/mtd/devices/bcm47xxsflash.h -@@ -65,7 +65,8 @@ struct bcm47xxsflash { - - enum bcm47xxsflash_type type; - -- u32 window; -+ void __iomem *window; -+ - u32 blocksize; - u16 numblocks; - u32 size; ---- a/include/linux/bcma/bcma_driver_chipcommon.h -+++ b/include/linux/bcma/bcma_driver_chipcommon.h -@@ -588,7 +588,6 @@ struct bcma_pflash { - #ifdef CONFIG_BCMA_SFLASH - struct bcma_sflash { - bool present; -- u32 window; - u32 blocksize; - u16 numblocks; - u32 size; diff --git a/target/linux/generic/pending-4.4/042-0002-mtd-add-arch-dependency-for-MTD_BCM47XXSFLASH-symbol.patch b/target/linux/generic/pending-4.4/042-0002-mtd-add-arch-dependency-for-MTD_BCM47XXSFLASH-symbol.patch deleted file mode 100644 index b7ff055ab..000000000 --- a/target/linux/generic/pending-4.4/042-0002-mtd-add-arch-dependency-for-MTD_BCM47XXSFLASH-symbol.patch +++ /dev/null @@ -1,41 +0,0 @@ -From efacc699139e13f9d3ed8b47df92acb88ff8479f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 19 Jul 2016 09:08:32 +0200 -Subject: [PATCH] mtd: add arch dependency for MTD_BCM47XXSFLASH symbol -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We dropped strict MIPS dependency for bcm47xxsflash driver in: -commit 5651d6aaf489 ("mtd: bcm47xxsflash: use ioremap_cache() instead of -KSEG0ADDR()") but using ioremap_cache still limits building it to few -selected architectures only. - -A recent commit 57d8f7dd2132 ("bcma: allow enabling serial flash support -on non-MIPS SoCs") automatically dropped MIPS dependency for -MTD_BCM47XXSFLASH which broke building e.g. on powerpc and cris. - -The bcma change is alright as it doesn't break building bcma code in any -way. MTD_BCM47XXSFLASH on the other hand should be limited to archs -which need it and can build it (by providing ioremap_cache). - -Fixes: 57d8f7dd2132 ("bcma: allow enabling serial flash support on non-MIPS SoCs") -Signed-off-by: Rafał Miłecki -Cc: Brian Norris -Acked-by: Brian Norris -Signed-off-by: Kalle Valo ---- - drivers/mtd/devices/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/devices/Kconfig -+++ b/drivers/mtd/devices/Kconfig -@@ -114,7 +114,7 @@ config MTD_SST25L - - config MTD_BCM47XXSFLASH - tristate "R/O support for serial flash on BCMA bus" -- depends on BCMA_SFLASH -+ depends on BCMA_SFLASH && (MIPS || ARM) - help - BCMA bus can have various flash memories attached, they are - registered by bcma as platform devices. This enables driver for diff --git a/target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch b/target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch deleted file mode 100644 index c2f2d21d0..000000000 --- a/target/linux/generic/pending-4.4/042-0003-mtd-bcm47xxsflash-use-uncached-MMIO-access-for-BCM53.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 64ad46379fcf14f437553f654d1adcd3d0e0d7f9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 15 Aug 2016 14:21:28 +0200 -Subject: [PATCH] mtd: bcm47xxsflash: use uncached MMIO access for BCM53573 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and uses -this old ChipCommon-based flash access. Early tests resulted in flash -corruptions that were tracked down to using cached MMIO for flash read -access. Switch to ioremap_nocache conditionally to support BCM53573 and -don't break performance on old MIPS devices. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Boris Brezillon -Signed-off-by: Brian Norris ---- - drivers/mtd/devices/bcm47xxsflash.c | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) - ---- a/drivers/mtd/devices/bcm47xxsflash.c -+++ b/drivers/mtd/devices/bcm47xxsflash.c -@@ -296,16 +296,30 @@ static int bcm47xxsflash_bcma_probe(stru - dev_err(dev, "can't request region for resource %pR\n", res); - return -EBUSY; - } -- b47s->window = ioremap_cache(res->start, resource_size(res)); -- if (!b47s->window) { -- dev_err(dev, "ioremap failed for resource %pR\n", res); -- return -ENOMEM; -- } - - b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash); - b47s->cc_read = bcm47xxsflash_bcma_cc_read; - b47s->cc_write = bcm47xxsflash_bcma_cc_write; - -+ /* -+ * On old MIPS devices cache was magically invalidated when needed, -+ * allowing us to use cached access and gain some performance. Trying -+ * the same on ARM based BCM53573 results in flash corruptions, we need -+ * to use uncached access for it. -+ * -+ * It may be arch specific, but right now there is only 1 ARM SoC using -+ * this driver, so let's follow Broadcom's reference code and check -+ * ChipCommon revision. -+ */ -+ if (b47s->bcma_cc->core->id.rev == 54) -+ b47s->window = ioremap_nocache(res->start, resource_size(res)); -+ else -+ b47s->window = ioremap_cache(res->start, resource_size(res)); -+ if (!b47s->window) { -+ dev_err(dev, "ioremap failed for resource %pR\n", res); -+ return -ENOMEM; -+ } -+ - switch (b47s->bcma_cc->capabilities & BCMA_CC_CAP_FLASHT) { - case BCMA_CC_FLASHT_STSER: - b47s->type = BCM47XXSFLASH_TYPE_ST; diff --git a/target/linux/generic/pending-4.4/042-0005-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch b/target/linux/generic/pending-4.4/042-0005-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch deleted file mode 100644 index a68eaa459..000000000 --- a/target/linux/generic/pending-4.4/042-0005-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch +++ /dev/null @@ -1,63 +0,0 @@ -From be5e5099183301fb7920f8f6b66bd3ac1f820a97 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 16 Jan 2017 17:28:18 +0100 -Subject: [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -We have generic place & helpers for storing platform driver data so -there is no reason for using custom priv pointer. - -This allows cleaning up struct bcma_sflash from unneeded fields. - -Signed-off-by: Rafał Miłecki -Acked-by: Kalle Valo -Acked-by: Boris Brezillon -Signed-off-by: Brian Norris ---- - drivers/mtd/devices/bcm47xxsflash.c | 6 +++--- - include/linux/bcma/bcma_driver_chipcommon.h | 3 --- - 2 files changed, 3 insertions(+), 6 deletions(-) - ---- a/drivers/mtd/devices/bcm47xxsflash.c -+++ b/drivers/mtd/devices/bcm47xxsflash.c -@@ -284,7 +284,6 @@ static int bcm47xxsflash_bcma_probe(stru - b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL); - if (!b47s) - return -ENOMEM; -- sflash->priv = b47s; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { -@@ -334,6 +333,8 @@ static int bcm47xxsflash_bcma_probe(stru - b47s->size = sflash->size; - bcm47xxsflash_fill_mtd(b47s, &pdev->dev); - -+ platform_set_drvdata(pdev, b47s); -+ - err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0); - if (err) { - pr_err("Failed to register MTD device: %d\n", err); -@@ -349,8 +350,7 @@ static int bcm47xxsflash_bcma_probe(stru - - static int bcm47xxsflash_bcma_remove(struct platform_device *pdev) - { -- struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev); -- struct bcm47xxsflash *b47s = sflash->priv; -+ struct bcm47xxsflash *b47s = platform_get_drvdata(pdev); - - mtd_device_unregister(&b47s->mtd); - iounmap(b47s->window); ---- a/include/linux/bcma/bcma_driver_chipcommon.h -+++ b/include/linux/bcma/bcma_driver_chipcommon.h -@@ -591,9 +591,6 @@ struct bcma_sflash { - u32 blocksize; - u16 numblocks; - u32 size; -- -- struct mtd_info *mtd; -- void *priv; - }; - #endif - diff --git a/target/linux/generic/pending-4.4/042-0006-mtd-bcm47xxsflash-support-reading-flash-out-of-mappi.patch b/target/linux/generic/pending-4.4/042-0006-mtd-bcm47xxsflash-support-reading-flash-out-of-mappi.patch deleted file mode 100644 index ecdae2a87..000000000 --- a/target/linux/generic/pending-4.4/042-0006-mtd-bcm47xxsflash-support-reading-flash-out-of-mappi.patch +++ /dev/null @@ -1,81 +0,0 @@ -From ccc38234fdc70120be79e7fb2df5c27ca5cd4c8a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 8 Feb 2017 23:53:44 +0100 -Subject: [PATCH] mtd: bcm47xxsflash: support reading flash out of mapping - window -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -For reading flash content we use MMIO but it's possible to read only -first 16 MiB this way. It's simply an arch design/limitation. -To support flash sizes bigger than 16 MiB implement indirect access -using ChipCommon registers. -This has been tested using MX25L25635F. - -Signed-off-by: Rafał Miłecki -Acked-by: Marek Vasut -Signed-off-by: Brian Norris ---- - drivers/mtd/devices/bcm47xxsflash.c | 24 +++++++++++++++++++++--- - drivers/mtd/devices/bcm47xxsflash.h | 3 +++ - 2 files changed, 24 insertions(+), 3 deletions(-) - ---- a/drivers/mtd/devices/bcm47xxsflash.c -+++ b/drivers/mtd/devices/bcm47xxsflash.c -@@ -105,15 +105,33 @@ static int bcm47xxsflash_read(struct mtd - size_t *retlen, u_char *buf) - { - struct bcm47xxsflash *b47s = mtd->priv; -+ size_t orig_len = len; - - /* Check address range */ - if ((from + len) > mtd->size) - return -EINVAL; - -- memcpy_fromio(buf, b47s->window + from, len); -- *retlen = len; -+ /* Read as much as possible using fast MMIO window */ -+ if (from < BCM47XXSFLASH_WINDOW_SZ) { -+ size_t memcpy_len; - -- return len; -+ memcpy_len = min(len, (size_t)(BCM47XXSFLASH_WINDOW_SZ - from)); -+ memcpy_fromio(buf, b47s->window + from, memcpy_len); -+ from += memcpy_len; -+ len -= memcpy_len; -+ buf += memcpy_len; -+ } -+ -+ /* Use indirect access for content out of the window */ -+ for (; len; len--) { -+ b47s->cc_write(b47s, BCMA_CC_FLASHADDR, from++); -+ bcm47xxsflash_cmd(b47s, OPCODE_ST_READ4B); -+ *buf++ = b47s->cc_read(b47s, BCMA_CC_FLASHDATA); -+ } -+ -+ *retlen = orig_len; -+ -+ return orig_len; - } - - static int bcm47xxsflash_write_st(struct mtd_info *mtd, u32 offset, size_t len, ---- a/drivers/mtd/devices/bcm47xxsflash.h -+++ b/drivers/mtd/devices/bcm47xxsflash.h -@@ -3,6 +3,8 @@ - - #include - -+#define BCM47XXSFLASH_WINDOW_SZ SZ_16M -+ - /* Used for ST flashes only. */ - #define OPCODE_ST_WREN 0x0006 /* Write Enable */ - #define OPCODE_ST_WRDIS 0x0004 /* Write Disable */ -@@ -16,6 +18,7 @@ - #define OPCODE_ST_RES 0x03ab /* Read Electronic Signature */ - #define OPCODE_ST_CSA 0x1000 /* Keep chip select asserted */ - #define OPCODE_ST_SSE 0x0220 /* Sub-sector Erase */ -+#define OPCODE_ST_READ4B 0x6313 /* Read Data Bytes in 4Byte addressing mode */ - - /* Used for Atmel flashes only. */ - #define OPCODE_AT_READ 0x07e8 diff --git a/target/linux/generic/pending-4.4/042-0007-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch b/target/linux/generic/pending-4.4/042-0007-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch deleted file mode 100644 index 4ef7e7f5d..000000000 --- a/target/linux/generic/pending-4.4/042-0007-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch +++ /dev/null @@ -1,180 +0,0 @@ -From b522d7b0ebe3539340c2a6d46d787ae3d33bcb92 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 10 Jan 2017 23:15:24 +0100 -Subject: [PATCH] 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 -Acked-by: Marek Vasut -Signed-off-by: Brian Norris ---- - 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/pending-4.4/042-0008-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch b/target/linux/generic/pending-4.4/042-0008-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch deleted file mode 100644 index 6c6c8397d..000000000 --- a/target/linux/generic/pending-4.4/042-0008-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 89a0d9a9f1941a086a82bc7cd73d275cec98ba14 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 10 Jan 2017 23:15:25 +0100 -Subject: [PATCH] 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 -Acked-by: Marek Vasut -Signed-off-by: Brian Norris ---- - 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/pending-4.4/043-mtd-spi-nor-mx25l3205d-mx25l6405d-append-SECT_4K.patch b/target/linux/generic/pending-4.4/043-mtd-spi-nor-mx25l3205d-mx25l6405d-append-SECT_4K.patch deleted file mode 100644 index b7fd046a2..000000000 --- a/target/linux/generic/pending-4.4/043-mtd-spi-nor-mx25l3205d-mx25l6405d-append-SECT_4K.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0501f2e5ff28a02295e42fc9e7164a20ef4c30d5 Mon Sep 17 00:00:00 2001 -From: Andreas Fenkart -Date: Thu, 5 Nov 2015 10:04:23 +0100 -Subject: [PATCH] mtd: spi-nor: mx25l3205d/mx25l6405d: append SECT_4K - -according datasheet both chips can erase 4kByte sectors individually - -Signed-off-by: Andreas Fenkart -Signed-off-by: Brian Norris ---- - drivers/mtd/spi-nor/spi-nor.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -715,9 +715,9 @@ static const struct flash_info spi_nor_i - { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, - { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, - { "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) }, -- { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) }, -+ { "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, 0) }, -+ { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, diff --git a/target/linux/generic/pending-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch b/target/linux/generic/pending-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch deleted file mode 100644 index c4c7e6e01..000000000 --- a/target/linux/generic/pending-4.4/045-mtd-devices-m25p80-add-support-for-mmap-read-request.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 08922f644878c9163ada8df3ef9def89be1d5e90 Mon Sep 17 00:00:00 2001 -From: Vignesh R -Date: Tue, 29 Mar 2016 11:16:17 +0530 -Subject: [PATCH] mtd: devices: m25p80: add support for mmap read request - -Certain SPI controllers may provide accelerated hardware interface to -read from m25p80 type flash devices in order to provide better read -performance. SPI core supports such devices with spi_flash_read() API. -Call spi_flash_read(), if supported, to make use of such interface. - -Signed-off-by: Vignesh R -[Brian: add memset()] -Signed-off-by: Brian Norris ---- - ---- a/drivers/mtd/devices/m25p80.c -+++ b/drivers/mtd/devices/m25p80.c -@@ -131,6 +131,28 @@ static int m25p80_read(struct spi_nor *n - /* convert the dummy cycles to the number of bytes */ - dummy /= 8; - -+ if (spi_flash_read_supported(spi)) { -+ struct spi_flash_read_message msg; -+ int ret; -+ -+ memset(&msg, 0, sizeof(msg)); -+ -+ msg.buf = buf; -+ msg.from = from; -+ msg.len = len; -+ msg.read_opcode = nor->read_opcode; -+ msg.addr_width = nor->addr_width; -+ msg.dummy_bytes = dummy; -+ /* TODO: Support other combinations */ -+ msg.opcode_nbits = SPI_NBITS_SINGLE; -+ msg.addr_nbits = SPI_NBITS_SINGLE; -+ msg.data_nbits = m25p80_rx_nbits(nor); -+ -+ ret = spi_flash_read(spi, &msg); -+ *retlen = msg.retlen; -+ return ret; -+ } -+ - spi_message_init(&m); - memset(t, 0, (sizeof t)); - diff --git a/target/linux/generic/pending-4.4/046-ubifs-silence-error-output-if-MS_SILENT-is-set.patch b/target/linux/generic/pending-4.4/046-ubifs-silence-error-output-if-MS_SILENT-is-set.patch deleted file mode 100644 index 95de68098..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -2107,8 +2107,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/pending-4.4/047-ubifs-silence-early-error-if-MS_SILENT-is-set.patch b/target/linux/generic/pending-4.4/047-ubifs-silence-early-error-if-MS_SILENT-is-set.patch deleted file mode 100644 index 189b96c41..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -520,19 +520,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; - } - -@@ -543,8 +543,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/pending-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch b/target/linux/generic/pending-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch deleted file mode 100644 index 69a5432fa..000000000 --- a/target/linux/generic/pending-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch +++ /dev/null @@ -1,47 +0,0 @@ -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]) -@@ -1163,7 +1164,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); - } -@@ -1179,7 +1181,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/pending-4.4/050-backport_netfilter_rtcache.patch b/target/linux/generic/pending-4.4/050-backport_netfilter_rtcache.patch deleted file mode 100644 index ddf5ba96b..000000000 --- a/target/linux/generic/pending-4.4/050-backport_netfilter_rtcache.patch +++ /dev/null @@ -1,531 +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 -@@ -114,6 +114,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 -@@ -16,6 +16,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,413 @@ -+/* 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(u_int8_t pf, -+ 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(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(u_int8_t pf, -+ 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(pf, rtc, skb_dst(skb), dir, state->in->ifindex); -+ return NF_ACCEPT; -+} -+ -+static unsigned int nf_rtcache_in4(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_in(NFPROTO_IPV4, skb, state); -+} -+ -+static unsigned int nf_rtcache_forward4(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_forward(NFPROTO_IPV4, skb, state); -+} -+ -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+static unsigned int nf_rtcache_in6(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_in(NFPROTO_IPV6, skb, state); -+} -+ -+static unsigned int nf_rtcache_forward6(void *priv, -+ struct sk_buff *skb, -+ const struct nf_hook_state *state) -+{ -+ return nf_rtcache_forward(NFPROTO_IPV6, skb, state); -+} -+#endif -+ -+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_in4, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward4, -+ .pf = NFPROTO_IPV4, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#if IS_ENABLED(CONFIG_NF_CONNTRACK_IPV6) -+ { -+ .hook = nf_rtcache_in6, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_PRE_ROUTING, -+ .priority = NF_IP_PRI_LAST, -+ }, -+ { -+ .hook = nf_rtcache_forward6, -+ .pf = NFPROTO_IPV6, -+ .hooknum = NF_INET_FORWARD, -+ .priority = NF_IP_PRI_LAST, -+ }, -+#endif -+}; -+ -+static struct nf_ct_ext_type rtcache_extend __read_mostly = { -+ .len = sizeof(struct nf_conn_rtcache), -+ .align = __alignof__(struct nf_conn_rtcache), -+ .id = NF_CT_EXT_RTCACHE, -+ .destroy = nf_conn_rtcache_destroy, -+}; -+ -+static int __init nf_conntrack_rtcache_init(void) -+{ -+ int ret = nf_ct_extend_register(&rtcache_extend); -+ -+ if (ret < 0) { -+ pr_err("nf_conntrack_rtcache: Unable to register extension\n"); -+ return ret; -+ } -+ -+ ret = nf_register_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ if (ret < 0) { -+ nf_ct_extend_unregister(&rtcache_extend); -+ return ret; -+ } -+ -+ ret = register_netdevice_notifier(&nf_rtcache_notifier); -+ if (ret) { -+ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ nf_ct_extend_unregister(&rtcache_extend); -+ } -+ -+ return ret; -+} -+ -+static int nf_rtcache_ext_remove(struct nf_conn *ct, void *data) -+{ -+ struct nf_conn_rtcache *rtc = nf_ct_rtcache_find(ct); -+ -+ return rtc != NULL; -+} -+ -+static bool __exit nf_conntrack_rtcache_wait_for_dying(struct net *net) -+{ -+ bool wait = false; -+ int cpu; -+ -+ for_each_possible_cpu(cpu) { -+ struct nf_conntrack_tuple_hash *h; -+ struct hlist_nulls_node *n; -+ struct nf_conn *ct; -+ struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); -+ -+ rcu_read_lock(); -+ spin_lock_bh(&pcpu->lock); -+ -+ hlist_nulls_for_each_entry(h, n, &pcpu->dying, hnnode) { -+ ct = nf_ct_tuplehash_to_ctrack(h); -+ if (nf_ct_rtcache_find(ct) != NULL) { -+ wait = true; -+ break; -+ } -+ } -+ spin_unlock_bh(&pcpu->lock); -+ rcu_read_unlock(); -+ } -+ -+ return wait; -+} -+ -+static void __exit nf_conntrack_rtcache_fini(void) -+{ -+ struct net *net; -+ int count = 0; -+ -+ /* remove hooks so no new connections get rtcache extension */ -+ nf_unregister_hooks(rtcache_ops, ARRAY_SIZE(rtcache_ops)); -+ -+ synchronize_net(); -+ -+ unregister_netdevice_notifier(&nf_rtcache_notifier); -+ -+ rtnl_lock(); -+ -+ /* zap all conntracks with rtcache extension */ -+ for_each_net(net) -+ nf_ct_iterate_cleanup(net, nf_rtcache_ext_remove, NULL, 0, 0); -+ -+ for_each_net(net) { -+ /* .. and make sure they're gone from dying list, too */ -+ while (nf_conntrack_rtcache_wait_for_dying(net)) { -+ msleep(200); -+ WARN_ONCE(++count > 25, "Waiting for all rtcache conntracks to go away\n"); -+ } -+ } -+ -+ rtnl_unlock(); -+ synchronize_net(); -+ nf_ct_extend_unregister(&rtcache_extend); -+} -+module_init(nf_conntrack_rtcache_init); -+module_exit(nf_conntrack_rtcache_fini); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Florian Westphal "); -+MODULE_DESCRIPTION("Conntrack route cache extension"); diff --git a/target/linux/generic/pending-4.4/051-0001-ovl-rename-is_merge-to-is_lowest.patch b/target/linux/generic/pending-4.4/051-0001-ovl-rename-is_merge-to-is_lowest.patch deleted file mode 100644 index 79140b900..000000000 --- a/target/linux/generic/pending-4.4/051-0001-ovl-rename-is_merge-to-is_lowest.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 56656e960b555cb98bc414382566dcb59aae99a2 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Mon, 21 Mar 2016 17:31:46 +0100 -Subject: [PATCH] ovl: rename is_merge to is_lowest - -The 'is_merge' is an historical naming from when only a single lower layer -could exist. With the introduction of multiple lower layers the meaning of -this flag was changed to mean only the "lowest layer" (while all lower -layers were being merged). - -So now 'is_merge' is inaccurate and hence renaming to 'is_lowest' - -Signed-off-by: Miklos Szeredi ---- - fs/overlayfs/readdir.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -36,7 +36,7 @@ struct ovl_dir_cache { - - struct ovl_readdir_data { - struct dir_context ctx; -- bool is_merge; -+ bool is_lowest; - struct rb_root root; - struct list_head *list; - struct list_head middle; -@@ -139,9 +139,9 @@ static int ovl_cache_entry_add_rb(struct - return 0; - } - --static int ovl_fill_lower(struct ovl_readdir_data *rdd, -- const char *name, int namelen, -- loff_t offset, u64 ino, unsigned int d_type) -+static int ovl_fill_lowest(struct ovl_readdir_data *rdd, -+ const char *name, int namelen, -+ loff_t offset, u64 ino, unsigned int d_type) - { - struct ovl_cache_entry *p; - -@@ -193,10 +193,10 @@ static int ovl_fill_merge(struct dir_con - container_of(ctx, struct ovl_readdir_data, ctx); - - rdd->count++; -- if (!rdd->is_merge) -+ if (!rdd->is_lowest) - return ovl_cache_entry_add_rb(rdd, name, namelen, ino, d_type); - else -- return ovl_fill_lower(rdd, name, namelen, offset, ino, d_type); -+ return ovl_fill_lowest(rdd, name, namelen, offset, ino, d_type); - } - - static int ovl_check_whiteouts(struct dentry *dir, struct ovl_readdir_data *rdd) -@@ -289,7 +289,7 @@ static int ovl_dir_read_merged(struct de - .ctx.actor = ovl_fill_merge, - .list = list, - .root = RB_ROOT, -- .is_merge = false, -+ .is_lowest = false, - }; - int idx, next; - -@@ -306,7 +306,7 @@ static int ovl_dir_read_merged(struct de - * allows offsets to be reasonably constant - */ - list_add(&rdd.middle, rdd.list); -- rdd.is_merge = true; -+ rdd.is_lowest = true; - err = ovl_dir_read(&realpath, &rdd); - list_del(&rdd.middle); - } diff --git a/target/linux/generic/pending-4.4/051-0002-ovl-override-creds-with-the-ones-from-the-superblock.patch b/target/linux/generic/pending-4.4/051-0002-ovl-override-creds-with-the-ones-from-the-superblock.patch deleted file mode 100644 index 208bc61ec..000000000 --- a/target/linux/generic/pending-4.4/051-0002-ovl-override-creds-with-the-ones-from-the-superblock.patch +++ /dev/null @@ -1,336 +0,0 @@ -From 3fe6e52f062643676eb4518d68cee3bc1272091b Mon Sep 17 00:00:00 2001 -From: Antonio Murdaca -Date: Thu, 7 Apr 2016 15:48:25 +0200 -Subject: [PATCH] ovl: override creds with the ones from the superblock mounter - -In user namespace the whiteout creation fails with -EPERM because the -current process isn't capable(CAP_SYS_ADMIN) when setting xattr. - -A simple reproducer: - -$ mkdir upper lower work merged lower/dir -$ sudo mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merged -$ unshare -m -p -f -U -r bash - -Now as root in the user namespace: - -\# touch merged/dir/{1,2,3} # this will force a copy up of lower/dir -\# rm -fR merged/* - -This ends up failing with -EPERM after the files in dir has been -correctly deleted: - -unlinkat(4, "2", 0) = 0 -unlinkat(4, "1", 0) = 0 -unlinkat(4, "3", 0) = 0 -close(4) = 0 -unlinkat(AT_FDCWD, "merged/dir", AT_REMOVEDIR) = -1 EPERM (Operation not -permitted) - -Interestingly, if you don't place files in merged/dir you can remove it, -meaning if upper/dir does not exist, creating the char device file works -properly in that same location. - -This patch uses ovl_sb_creator_cred() to get the cred struct from the -superblock mounter and override the old cred with these new ones so that -the whiteout creation is possible because overlay is wrong in assuming that -the creds it will get with prepare_creds will be in the initial user -namespace. The old cap_raise game is removed in favor of just overriding -the old cred struct. - -This patch also drops from ovl_copy_up_one() the following two lines: - -override_cred->fsuid = stat->uid; -override_cred->fsgid = stat->gid; - -This is because the correct uid and gid are taken directly with the stat -struct and correctly set with ovl_set_attr(). - -Signed-off-by: Antonio Murdaca -Signed-off-by: Miklos Szeredi ---- - fs/overlayfs/copy_up.c | 26 +------------------ - fs/overlayfs/dir.c | 67 ++++-------------------------------------------- - fs/overlayfs/overlayfs.h | 1 + - fs/overlayfs/readdir.c | 14 +++------- - fs/overlayfs/super.c | 18 ++++++++++++- - 5 files changed, 27 insertions(+), 99 deletions(-) - ---- a/fs/overlayfs/copy_up.c -+++ b/fs/overlayfs/copy_up.c -@@ -317,7 +317,6 @@ int ovl_copy_up_one(struct dentry *paren - struct dentry *upperdir; - struct dentry *upperdentry; - const struct cred *old_cred; -- struct cred *override_cred; - char *link = NULL; - - if (WARN_ON(!workdir)) -@@ -336,28 +335,7 @@ int ovl_copy_up_one(struct dentry *paren - return PTR_ERR(link); - } - -- err = -ENOMEM; -- override_cred = prepare_creds(); -- if (!override_cred) -- goto out_free_link; -- -- override_cred->fsuid = stat->uid; -- override_cred->fsgid = stat->gid; -- /* -- * CAP_SYS_ADMIN for copying up extended attributes -- * CAP_DAC_OVERRIDE for create -- * CAP_FOWNER for chmod, timestamp update -- * CAP_FSETID for chmod -- * CAP_CHOWN for chown -- * CAP_MKNOD for mknod -- */ -- cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -- cap_raise(override_cred->cap_effective, CAP_FOWNER); -- cap_raise(override_cred->cap_effective, CAP_FSETID); -- cap_raise(override_cred->cap_effective, CAP_CHOWN); -- cap_raise(override_cred->cap_effective, CAP_MKNOD); -- old_cred = override_creds(override_cred); -+ old_cred = ovl_override_creds(dentry->d_sb); - - err = -EIO; - if (lock_rename(workdir, upperdir) != NULL) { -@@ -380,9 +358,7 @@ int ovl_copy_up_one(struct dentry *paren - out_unlock: - unlock_rename(workdir, upperdir); - revert_creds(old_cred); -- put_cred(override_cred); - --out_free_link: - if (link) - free_page((unsigned long) link); - ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -408,28 +408,13 @@ static int ovl_create_or_link(struct den - err = ovl_create_upper(dentry, inode, &stat, link, hardlink); - } else { - const struct cred *old_cred; -- struct cred *override_cred; - -- err = -ENOMEM; -- override_cred = prepare_creds(); -- if (!override_cred) -- goto out_iput; -- -- /* -- * CAP_SYS_ADMIN for setting opaque xattr -- * CAP_DAC_OVERRIDE for create in workdir, rename -- * CAP_FOWNER for removing whiteout from sticky dir -- */ -- cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -- cap_raise(override_cred->cap_effective, CAP_FOWNER); -- old_cred = override_creds(override_cred); -+ old_cred = ovl_override_creds(dentry->d_sb); - - err = ovl_create_over_whiteout(dentry, inode, &stat, link, - hardlink); - - revert_creds(old_cred); -- put_cred(override_cred); - } - - if (!err) -@@ -659,32 +644,11 @@ static int ovl_do_remove(struct dentry * - if (OVL_TYPE_PURE_UPPER(type)) { - err = ovl_remove_upper(dentry, is_dir); - } else { -- const struct cred *old_cred; -- struct cred *override_cred; -- -- err = -ENOMEM; -- override_cred = prepare_creds(); -- if (!override_cred) -- goto out_drop_write; -- -- /* -- * CAP_SYS_ADMIN for setting xattr on whiteout, opaque dir -- * CAP_DAC_OVERRIDE for create in workdir, rename -- * CAP_FOWNER for removing whiteout from sticky dir -- * CAP_FSETID for chmod of opaque dir -- * CAP_CHOWN for chown of opaque dir -- */ -- cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -- cap_raise(override_cred->cap_effective, CAP_FOWNER); -- cap_raise(override_cred->cap_effective, CAP_FSETID); -- cap_raise(override_cred->cap_effective, CAP_CHOWN); -- old_cred = override_creds(override_cred); -+ const struct cred *old_cred = ovl_override_creds(dentry->d_sb); - - err = ovl_remove_and_whiteout(dentry, is_dir); - - revert_creds(old_cred); -- put_cred(override_cred); - } - out_drop_write: - ovl_drop_write(dentry); -@@ -723,7 +687,6 @@ static int ovl_rename2(struct inode *old - bool new_is_dir = false; - struct dentry *opaquedir = NULL; - const struct cred *old_cred = NULL; -- struct cred *override_cred = NULL; - - err = -EINVAL; - if (flags & ~(RENAME_EXCHANGE | RENAME_NOREPLACE)) -@@ -792,26 +755,8 @@ static int ovl_rename2(struct inode *old - old_opaque = !OVL_TYPE_PURE_UPPER(old_type); - new_opaque = !OVL_TYPE_PURE_UPPER(new_type); - -- if (old_opaque || new_opaque) { -- err = -ENOMEM; -- override_cred = prepare_creds(); -- if (!override_cred) -- goto out_drop_write; -- -- /* -- * CAP_SYS_ADMIN for setting xattr on whiteout, opaque dir -- * CAP_DAC_OVERRIDE for create in workdir -- * CAP_FOWNER for removing whiteout from sticky dir -- * CAP_FSETID for chmod of opaque dir -- * CAP_CHOWN for chown of opaque dir -- */ -- cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -- cap_raise(override_cred->cap_effective, CAP_FOWNER); -- cap_raise(override_cred->cap_effective, CAP_FSETID); -- cap_raise(override_cred->cap_effective, CAP_CHOWN); -- old_cred = override_creds(override_cred); -- } -+ if (old_opaque || new_opaque) -+ old_cred = ovl_override_creds(old->d_sb); - - if (overwrite && OVL_TYPE_MERGE_OR_LOWER(new_type) && new_is_dir) { - opaquedir = ovl_check_empty_and_clear(new); -@@ -942,10 +887,8 @@ out_dput_old: - out_unlock: - unlock_rename(new_upperdir, old_upperdir); - out_revert_creds: -- if (old_opaque || new_opaque) { -+ if (old_opaque || new_opaque) - revert_creds(old_cred); -- put_cred(override_cred); -- } - out_drop_write: - ovl_drop_write(old); - out: ---- a/fs/overlayfs/overlayfs.h -+++ b/fs/overlayfs/overlayfs.h -@@ -150,6 +150,7 @@ void ovl_drop_write(struct dentry *dentr - bool ovl_dentry_is_opaque(struct dentry *dentry); - void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque); - bool ovl_is_whiteout(struct dentry *dentry); -+const struct cred *ovl_override_creds(struct super_block *sb); - void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry); - struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, - unsigned int flags); ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -36,6 +36,7 @@ struct ovl_dir_cache { - - struct ovl_readdir_data { - struct dir_context ctx; -+ struct dentry *dentry; - bool is_lowest; - struct rb_root root; - struct list_head *list; -@@ -205,17 +206,8 @@ static int ovl_check_whiteouts(struct de - struct ovl_cache_entry *p; - struct dentry *dentry; - const struct cred *old_cred; -- struct cred *override_cred; -- -- override_cred = prepare_creds(); -- if (!override_cred) -- return -ENOMEM; - -- /* -- * CAP_DAC_OVERRIDE for lookup -- */ -- cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -- old_cred = override_creds(override_cred); -+ old_cred = ovl_override_creds(rdd->dentry->d_sb); - - err = mutex_lock_killable(&dir->d_inode->i_mutex); - if (!err) { -@@ -231,7 +223,6 @@ static int ovl_check_whiteouts(struct de - mutex_unlock(&dir->d_inode->i_mutex); - } - revert_creds(old_cred); -- put_cred(override_cred); - - return err; - } -@@ -287,6 +278,7 @@ static int ovl_dir_read_merged(struct de - struct path realpath; - struct ovl_readdir_data rdd = { - .ctx.actor = ovl_fill_merge, -+ .dentry = dentry, - .list = list, - .root = RB_ROOT, - .is_lowest = false, ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -42,6 +42,8 @@ struct ovl_fs { - long lower_namelen; - /* pathnames of lower and upper dirs, for show_options */ - struct ovl_config config; -+ /* creds of process who forced instantiation of super block */ -+ const struct cred *creator_cred; - }; - - struct ovl_dir_cache; -@@ -246,6 +248,13 @@ bool ovl_is_whiteout(struct dentry *dent - return inode && IS_WHITEOUT(inode); - } - -+const struct cred *ovl_override_creds(struct super_block *sb) -+{ -+ struct ovl_fs *ofs = sb->s_fs_info; -+ -+ return override_creds(ofs->creator_cred); -+} -+ - static bool ovl_is_opaquedir(struct dentry *dentry) - { - int res; -@@ -587,6 +596,7 @@ static void ovl_put_super(struct super_b - kfree(ufs->config.lowerdir); - kfree(ufs->config.upperdir); - kfree(ufs->config.workdir); -+ put_cred(ufs->creator_cred); - kfree(ufs); - } - -@@ -1087,10 +1097,14 @@ static int ovl_fill_super(struct super_b - else - sb->s_d_op = &ovl_dentry_operations; - -+ ufs->creator_cred = prepare_creds(); -+ if (!ufs->creator_cred) -+ goto out_put_lower_mnt; -+ - err = -ENOMEM; - oe = ovl_alloc_entry(numlower); - if (!oe) -- goto out_put_lower_mnt; -+ goto out_put_cred; - - root_dentry = d_make_root(ovl_new_inode(sb, S_IFDIR, oe)); - if (!root_dentry) -@@ -1123,6 +1137,8 @@ static int ovl_fill_super(struct super_b - - out_free_oe: - kfree(oe); -+out_put_cred: -+ put_cred(ufs->creator_cred); - out_put_lower_mnt: - for (i = 0; i < ufs->numlower; i++) - mntput(ufs->lower_mnt[i]); diff --git a/target/linux/generic/pending-4.4/051-0005-ovl-proper-cleanup-of-workdir.patch b/target/linux/generic/pending-4.4/051-0005-ovl-proper-cleanup-of-workdir.patch deleted file mode 100644 index 7225fc8cd..000000000 --- a/target/linux/generic/pending-4.4/051-0005-ovl-proper-cleanup-of-workdir.patch +++ /dev/null @@ -1,131 +0,0 @@ -From eea2fb4851e9dcbab6b991aaf47e2e024f1f55a0 Mon Sep 17 00:00:00 2001 -From: Miklos Szeredi -Date: Thu, 1 Sep 2016 11:11:59 +0200 -Subject: [PATCH] ovl: proper cleanup of workdir - -When mounting overlayfs it needs a clean "work" directory under the -supplied workdir. - -Previously the mount code removed this directory if it already existed and -created a new one. If the removal failed (e.g. directory was not empty) -then it fell back to a read-only mount not using the workdir. - -While this has never been reported, it is possible to get a non-empty -"work" dir from a previous mount of overlayfs in case of crash in the -middle of an operation using the work directory. - -In this case the left over state should be discarded and the overlay -filesystem will be consistent, guaranteed by the atomicity of operations on -moving to/from the workdir to the upper layer. - -This patch implements cleaning out any files left in workdir. It is -implemented using real recursion for simplicity, but the depth is limited -to 2, because the worst case is that of a directory containing whiteouts -under "work". - -Signed-off-by: Miklos Szeredi -Cc: ---- - fs/overlayfs/overlayfs.h | 2 ++ - fs/overlayfs/readdir.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++- - fs/overlayfs/super.c | 2 +- - 3 files changed, 65 insertions(+), 2 deletions(-) - ---- a/fs/overlayfs/overlayfs.h -+++ b/fs/overlayfs/overlayfs.h -@@ -164,6 +164,8 @@ extern const struct file_operations ovl_ - int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list); - void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list); - void ovl_cache_free(struct list_head *list); -+void ovl_workdir_cleanup(struct inode *dir, struct vfsmount *mnt, -+ struct dentry *dentry, int level); - - /* inode.c */ - int ovl_setattr(struct dentry *dentry, struct iattr *attr); ---- a/fs/overlayfs/readdir.c -+++ b/fs/overlayfs/readdir.c -@@ -247,7 +247,7 @@ static inline int ovl_dir_read(struct pa - err = rdd->err; - } while (!err && rdd->count); - -- if (!err && rdd->first_maybe_whiteout) -+ if (!err && rdd->first_maybe_whiteout && rdd->dentry) - err = ovl_check_whiteouts(realpath->dentry, rdd); - - fput(realfile); -@@ -573,3 +573,64 @@ void ovl_cleanup_whiteouts(struct dentry - } - mutex_unlock(&upper->d_inode->i_mutex); - } -+ -+static void ovl_workdir_cleanup_recurse(struct path *path, int level) -+{ -+ int err; -+ struct inode *dir = path->dentry->d_inode; -+ LIST_HEAD(list); -+ struct ovl_cache_entry *p; -+ struct ovl_readdir_data rdd = { -+ .ctx.actor = ovl_fill_merge, -+ .dentry = NULL, -+ .list = &list, -+ .root = RB_ROOT, -+ .is_lowest = false, -+ }; -+ -+ err = ovl_dir_read(path, &rdd); -+ if (err) -+ goto out; -+ -+ mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); -+ list_for_each_entry(p, &list, l_node) { -+ struct dentry *dentry; -+ -+ if (p->name[0] == '.') { -+ if (p->len == 1) -+ continue; -+ if (p->len == 2 && p->name[1] == '.') -+ continue; -+ } -+ dentry = lookup_one_len(p->name, path->dentry, p->len); -+ if (IS_ERR(dentry)) -+ continue; -+ if (dentry->d_inode) -+ ovl_workdir_cleanup(dir, path->mnt, dentry, level); -+ dput(dentry); -+ } -+ mutex_unlock(&dir->i_mutex); -+out: -+ ovl_cache_free(&list); -+} -+ -+void ovl_workdir_cleanup(struct inode *dir, struct vfsmount *mnt, -+ struct dentry *dentry, int level) -+{ -+ int err; -+ -+ if (!d_is_dir(dentry) || level > 1) { -+ ovl_cleanup(dir, dentry); -+ return; -+ } -+ -+ err = ovl_do_rmdir(dir, dentry); -+ if (err) { -+ struct path path = { .mnt = mnt, .dentry = dentry }; -+ -+ mutex_unlock(&dir->i_mutex); -+ ovl_workdir_cleanup_recurse(&path, level + 1); -+ mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); -+ ovl_cleanup(dir, dentry); -+ } -+} ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -784,7 +784,7 @@ retry: - goto out_dput; - - retried = true; -- ovl_cleanup(dir, work); -+ ovl_workdir_cleanup(dir, mnt, work, 0); - dput(work); - goto retry; - } diff --git a/target/linux/generic/pending-4.4/052-01-ubifs-Implement-O_TMPFILE.patch b/target/linux/generic/pending-4.4/052-01-ubifs-Implement-O_TMPFILE.patch deleted file mode 100644 index 1c55a89ac..000000000 --- a/target/linux/generic/pending-4.4/052-01-ubifs-Implement-O_TMPFILE.patch +++ /dev/null @@ -1,99 +0,0 @@ -From: Richard Weinberger -Date: Tue, 13 Sep 2016 16:18:55 +0200 -Subject: [PATCH] ubifs: Implement O_TMPFILE - -This patchs adds O_TMPFILE support to UBIFS. -A temp file is a reference to an unlinked inode, a user -holding the reference can use it. As soon it is being closed -all data vanishes. - -Signed-off-by: Richard Weinberger ---- - ---- a/fs/ubifs/dir.c -+++ b/fs/ubifs/dir.c -@@ -301,6 +301,76 @@ out_budg: - return err; - } - -+static int ubifs_tmpfile(struct inode *dir, struct dentry *dentry, -+ umode_t mode) -+{ -+ struct inode *inode; -+ struct ubifs_info *c = dir->i_sb->s_fs_info; -+ struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1}; -+ struct ubifs_budget_req ino_req = { .dirtied_ino = 1 }; -+ struct ubifs_inode *ui, *dir_ui = ubifs_inode(dir); -+ int err, instantiated = 0; -+ -+ /* -+ * Budget request settings: new dirty inode, new direntry, -+ * budget for dirtied inode will be released via writeback. -+ */ -+ -+ dbg_gen("dent '%pd', mode %#hx in dir ino %lu", -+ dentry, mode, dir->i_ino); -+ -+ err = ubifs_budget_space(c, &req); -+ if (err) -+ return err; -+ -+ err = ubifs_budget_space(c, &ino_req); -+ if (err) { -+ ubifs_release_budget(c, &req); -+ return err; -+ } -+ -+ inode = ubifs_new_inode(c, dir, mode); -+ if (IS_ERR(inode)) { -+ err = PTR_ERR(inode); -+ goto out_budg; -+ } -+ ui = ubifs_inode(inode); -+ -+ err = ubifs_init_security(dir, inode, &dentry->d_name); -+ if (err) -+ goto out_inode; -+ -+ mutex_lock(&ui->ui_mutex); -+ insert_inode_hash(inode); -+ d_tmpfile(dentry, inode); -+ ubifs_assert(ui->dirty); -+ instantiated = 1; -+ mutex_unlock(&ui->ui_mutex); -+ -+ mutex_lock(&dir_ui->ui_mutex); -+ err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 1, 0); -+ if (err) -+ goto out_cancel; -+ mutex_unlock(&dir_ui->ui_mutex); -+ -+ ubifs_release_budget(c, &req); -+ -+ return 0; -+ -+out_cancel: -+ mutex_unlock(&dir_ui->ui_mutex); -+out_inode: -+ make_bad_inode(inode); -+ if (!instantiated) -+ iput(inode); -+out_budg: -+ ubifs_release_budget(c, &req); -+ if (!instantiated) -+ ubifs_release_budget(c, &ino_req); -+ ubifs_err(c, "cannot create temporary file, error %d", err); -+ return err; -+} -+ - /** - * vfs_dent_type - get VFS directory entry type. - * @type: UBIFS directory entry type -@@ -1195,6 +1265,7 @@ const struct inode_operations ubifs_dir_ - #ifdef CONFIG_UBIFS_ATIME_SUPPORT - .update_time = ubifs_update_time, - #endif -+ .tmpfile = ubifs_tmpfile, - }; - - const struct file_operations ubifs_dir_operations = { diff --git a/target/linux/generic/pending-4.4/052-02-ubifs-Implement-RENAME_WHITEOUT.patch b/target/linux/generic/pending-4.4/052-02-ubifs-Implement-RENAME_WHITEOUT.patch deleted file mode 100644 index c2ec90493..000000000 --- a/target/linux/generic/pending-4.4/052-02-ubifs-Implement-RENAME_WHITEOUT.patch +++ /dev/null @@ -1,343 +0,0 @@ -From: Richard Weinberger -Date: Tue, 13 Sep 2016 16:18:56 +0200 -Subject: [PATCH] ubifs: Implement RENAME_WHITEOUT - -Adds RENAME_WHITEOUT support to UBIFS, we implement -it in the same way as ext4 and xfs do. -For an overview of other ways to implement it please -refere to commit 7dcf5c3e4527 ("xfs: add RENAME_WHITEOUT support"). - -Signed-off-by: Richard Weinberger ---- - ---- a/fs/ubifs/dir.c -+++ b/fs/ubifs/dir.c -@@ -301,8 +301,8 @@ out_budg: - return err; - } - --static int ubifs_tmpfile(struct inode *dir, struct dentry *dentry, -- umode_t mode) -+static int do_tmpfile(struct inode *dir, struct dentry *dentry, -+ umode_t mode, struct inode **whiteout) - { - struct inode *inode; - struct ubifs_info *c = dir->i_sb->s_fs_info; -@@ -336,14 +336,27 @@ static int ubifs_tmpfile(struct inode *d - } - ui = ubifs_inode(inode); - -+ if (whiteout) { -+ init_special_inode(inode, inode->i_mode, WHITEOUT_DEV); -+ ubifs_assert(inode->i_op == &ubifs_file_inode_operations); -+ } -+ - err = ubifs_init_security(dir, inode, &dentry->d_name); - if (err) - goto out_inode; - - mutex_lock(&ui->ui_mutex); - insert_inode_hash(inode); -- d_tmpfile(dentry, inode); -+ -+ if (whiteout) { -+ mark_inode_dirty(inode); -+ drop_nlink(inode); -+ *whiteout = inode; -+ } else { -+ d_tmpfile(dentry, inode); -+ } - ubifs_assert(ui->dirty); -+ - instantiated = 1; - mutex_unlock(&ui->ui_mutex); - -@@ -371,6 +384,12 @@ out_budg: - return err; - } - -+static int ubifs_tmpfile(struct inode *dir, struct dentry *dentry, -+ umode_t mode) -+{ -+ return do_tmpfile(dir, dentry, mode, NULL); -+} -+ - /** - * vfs_dent_type - get VFS directory entry type. - * @type: UBIFS directory entry type -@@ -1003,37 +1022,43 @@ out_budg: - } - - /** -- * lock_3_inodes - a wrapper for locking three UBIFS inodes. -+ * lock_4_inodes - a wrapper for locking three UBIFS inodes. - * @inode1: first inode - * @inode2: second inode - * @inode3: third inode -+ * @inode4: fouth inode - * - * This function is used for 'ubifs_rename()' and @inode1 may be the same as -- * @inode2 whereas @inode3 may be %NULL. -+ * @inode2 whereas @inode3 and @inode4 may be %NULL. - * - * We do not implement any tricks to guarantee strict lock ordering, because - * VFS has already done it for us on the @i_mutex. So this is just a simple - * wrapper function. - */ --static void lock_3_inodes(struct inode *inode1, struct inode *inode2, -- struct inode *inode3) -+static void lock_4_inodes(struct inode *inode1, struct inode *inode2, -+ struct inode *inode3, struct inode *inode4) - { - mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1); - if (inode2 != inode1) - mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2); - if (inode3) - mutex_lock_nested(&ubifs_inode(inode3)->ui_mutex, WB_MUTEX_3); -+ if (inode4) -+ mutex_lock_nested(&ubifs_inode(inode4)->ui_mutex, WB_MUTEX_4); - } - - /** -- * unlock_3_inodes - a wrapper for unlocking three UBIFS inodes for rename. -+ * unlock_4_inodes - a wrapper for unlocking three UBIFS inodes for rename. - * @inode1: first inode - * @inode2: second inode - * @inode3: third inode -+ * @inode4: fouth inode - */ --static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, -- struct inode *inode3) -+static void unlock_4_inodes(struct inode *inode1, struct inode *inode2, -+ struct inode *inode3, struct inode *inode4) - { -+ if (inode4) -+ mutex_unlock(&ubifs_inode(inode4)->ui_mutex); - if (inode3) - mutex_unlock(&ubifs_inode(inode3)->ui_mutex); - if (inode1 != inode2) -@@ -1042,12 +1067,15 @@ static void unlock_3_inodes(struct inode - } - - static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, -- struct inode *new_dir, struct dentry *new_dentry) -+ struct inode *new_dir, struct dentry *new_dentry, -+ unsigned int flags) - { - struct ubifs_info *c = old_dir->i_sb->s_fs_info; - struct inode *old_inode = d_inode(old_dentry); - struct inode *new_inode = d_inode(new_dentry); -+ struct inode *whiteout = NULL; - struct ubifs_inode *old_inode_ui = ubifs_inode(old_inode); -+ struct ubifs_inode *whiteout_ui = NULL; - int err, release, sync = 0, move = (new_dir != old_dir); - int is_dir = S_ISDIR(old_inode->i_mode); - int unlink = !!new_inode; -@@ -1069,9 +1097,13 @@ static int ubifs_rename(struct inode *ol - * separately. - */ - -- dbg_gen("dent '%pd' ino %lu in dir ino %lu to dent '%pd' in dir ino %lu", -+ dbg_gen("dent '%pd' ino %lu in dir ino %lu to dent '%pd' in dir ino %lu flags 0x%x", - old_dentry, old_inode->i_ino, old_dir->i_ino, -- new_dentry, new_dir->i_ino); -+ new_dentry, new_dir->i_ino, flags); -+ -+ if (flags & ~(RENAME_NOREPLACE | RENAME_WHITEOUT)) -+ return -EINVAL; -+ - ubifs_assert(mutex_is_locked(&old_dir->i_mutex)); - ubifs_assert(mutex_is_locked(&new_dir->i_mutex)); - if (unlink) -@@ -1093,7 +1125,32 @@ static int ubifs_rename(struct inode *ol - return err; - } - -- lock_3_inodes(old_dir, new_dir, new_inode); -+ if (flags & RENAME_WHITEOUT) { -+ union ubifs_dev_desc *dev = NULL; -+ -+ dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS); -+ if (!dev) { -+ ubifs_release_budget(c, &req); -+ ubifs_release_budget(c, &ino_req); -+ return -ENOMEM; -+ } -+ -+ err = do_tmpfile(old_dir, old_dentry, S_IFCHR | WHITEOUT_MODE, &whiteout); -+ if (err) { -+ ubifs_release_budget(c, &req); -+ ubifs_release_budget(c, &ino_req); -+ kfree(dev); -+ return err; -+ } -+ -+ whiteout->i_state |= I_LINKABLE; -+ whiteout_ui = ubifs_inode(whiteout); -+ whiteout_ui->data = dev; -+ whiteout_ui->data_len = ubifs_encode_dev(dev, MKDEV(0, 0)); -+ ubifs_assert(!whiteout_ui->dirty); -+ } -+ -+ lock_4_inodes(old_dir, new_dir, new_inode, whiteout); - - /* - * Like most other Unix systems, set the @i_ctime for inodes on a -@@ -1163,12 +1220,34 @@ static int ubifs_rename(struct inode *ol - if (unlink && IS_SYNC(new_inode)) - sync = 1; - } -- err = ubifs_jnl_rename(c, old_dir, old_dentry, new_dir, new_dentry, -+ -+ if (whiteout) { -+ struct ubifs_budget_req wht_req = { .dirtied_ino = 1, -+ .dirtied_ino_d = \ -+ ALIGN(ubifs_inode(whiteout)->data_len, 8) }; -+ -+ err = ubifs_budget_space(c, &wht_req); -+ if (err) { -+ ubifs_release_budget(c, &req); -+ ubifs_release_budget(c, &ino_req); -+ kfree(whiteout_ui->data); -+ whiteout_ui->data_len = 0; -+ iput(whiteout); -+ return err; -+ } -+ -+ inc_nlink(whiteout); -+ mark_inode_dirty(whiteout); -+ whiteout->i_state &= ~I_LINKABLE; -+ iput(whiteout); -+ } -+ -+ err = ubifs_jnl_rename(c, old_dir, old_dentry, new_dir, new_dentry, whiteout, - sync); - if (err) - goto out_cancel; - -- unlock_3_inodes(old_dir, new_dir, new_inode); -+ unlock_4_inodes(old_dir, new_dir, new_inode, whiteout); - ubifs_release_budget(c, &req); - - mutex_lock(&old_inode_ui->ui_mutex); -@@ -1201,7 +1280,11 @@ out_cancel: - inc_nlink(old_dir); - } - } -- unlock_3_inodes(old_dir, new_dir, new_inode); -+ if (whiteout) { -+ drop_nlink(whiteout); -+ iput(whiteout); -+ } -+ unlock_4_inodes(old_dir, new_dir, new_inode, whiteout); - ubifs_release_budget(c, &ino_req); - ubifs_release_budget(c, &req); - return err; -@@ -1255,7 +1338,7 @@ const struct inode_operations ubifs_dir_ - .mkdir = ubifs_mkdir, - .rmdir = ubifs_rmdir, - .mknod = ubifs_mknod, -- .rename = ubifs_rename, -+ .rename2 = ubifs_rename, - .setattr = ubifs_setattr, - .getattr = ubifs_getattr, - .setxattr = ubifs_setxattr, ---- a/fs/ubifs/journal.c -+++ b/fs/ubifs/journal.c -@@ -917,14 +917,15 @@ int ubifs_jnl_delete_inode(struct ubifs_ - * @sync: non-zero if the write-buffer has to be synchronized - * - * This function implements the re-name operation which may involve writing up -- * to 3 inodes and 2 directory entries. It marks the written inodes as clean -+ * to 4 inodes and 2 directory entries. It marks the written inodes as clean - * and returns zero on success. In case of failure, a negative error code is - * returned. - */ - int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir, - const struct dentry *old_dentry, - const struct inode *new_dir, -- const struct dentry *new_dentry, int sync) -+ const struct dentry *new_dentry, -+ const struct inode *whiteout, int sync) - { - void *p; - union ubifs_key key; -@@ -980,13 +981,19 @@ int ubifs_jnl_rename(struct ubifs_info * - zero_dent_node_unused(dent); - ubifs_prep_grp_node(c, dent, dlen1, 0); - -- /* Make deletion dent */ - dent2 = (void *)dent + aligned_dlen1; - dent2->ch.node_type = UBIFS_DENT_NODE; - dent_key_init_flash(c, &dent2->key, old_dir->i_ino, - &old_dentry->d_name); -- dent2->inum = 0; -- dent2->type = DT_UNKNOWN; -+ -+ if (whiteout) { -+ dent2->inum = cpu_to_le64(whiteout->i_ino); -+ dent2->type = get_dent_type(whiteout->i_mode); -+ } else { -+ /* Make deletion dent */ -+ dent2->inum = 0; -+ dent2->type = DT_UNKNOWN; -+ } - dent2->nlen = cpu_to_le16(old_dentry->d_name.len); - memcpy(dent2->name, old_dentry->d_name.name, old_dentry->d_name.len); - dent2->name[old_dentry->d_name.len] = '\0'; -@@ -1035,16 +1042,26 @@ int ubifs_jnl_rename(struct ubifs_info * - if (err) - goto out_ro; - -- err = ubifs_add_dirt(c, lnum, dlen2); -- if (err) -- goto out_ro; -- -- dent_key_init(c, &key, old_dir->i_ino, &old_dentry->d_name); -- err = ubifs_tnc_remove_nm(c, &key, &old_dentry->d_name); -- if (err) -- goto out_ro; -+ offs += aligned_dlen1; -+ if (whiteout) { -+ dent_key_init(c, &key, old_dir->i_ino, &old_dentry->d_name); -+ err = ubifs_tnc_add_nm(c, &key, lnum, offs, dlen2, &old_dentry->d_name); -+ if (err) -+ goto out_ro; -+ -+ ubifs_delete_orphan(c, whiteout->i_ino); -+ } else { -+ err = ubifs_add_dirt(c, lnum, dlen2); -+ if (err) -+ goto out_ro; -+ -+ dent_key_init(c, &key, old_dir->i_ino, &old_dentry->d_name); -+ err = ubifs_tnc_remove_nm(c, &key, &old_dentry->d_name); -+ if (err) -+ goto out_ro; -+ } - -- offs += aligned_dlen1 + aligned_dlen2; -+ offs += aligned_dlen2; - if (new_inode) { - ino_key_init(c, &key, new_inode->i_ino); - err = ubifs_tnc_add(c, &key, lnum, offs, ilen); ---- a/fs/ubifs/ubifs.h -+++ b/fs/ubifs/ubifs.h -@@ -180,6 +180,7 @@ enum { - WB_MUTEX_1 = 0, - WB_MUTEX_2 = 1, - WB_MUTEX_3 = 2, -+ WB_MUTEX_4 = 3, - }; - - /* -@@ -1546,7 +1547,8 @@ int ubifs_jnl_delete_inode(struct ubifs_ - int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir, - const struct dentry *old_dentry, - const struct inode *new_dir, -- const struct dentry *new_dentry, int sync); -+ const struct dentry *new_dentry, -+ const struct inode *whiteout, int sync); - int ubifs_jnl_truncate(struct ubifs_info *c, const struct inode *inode, - loff_t old_size, loff_t new_size); - int ubifs_jnl_delete_xattr(struct ubifs_info *c, const struct inode *host, diff --git a/target/linux/generic/pending-4.4/052-03-ubifs-Implement-RENAME_EXCHANGE.patch b/target/linux/generic/pending-4.4/052-03-ubifs-Implement-RENAME_EXCHANGE.patch deleted file mode 100644 index 1830cd0ee..000000000 --- a/target/linux/generic/pending-4.4/052-03-ubifs-Implement-RENAME_EXCHANGE.patch +++ /dev/null @@ -1,267 +0,0 @@ -From: Richard Weinberger -Date: Tue, 13 Sep 2016 16:18:57 +0200 -Subject: [PATCH] ubifs: Implement RENAME_EXCHANGE - -Adds RENAME_EXCHANGE to UBIFS, the operation itself -is completely disjunct from a regular rename() that's -why we dispatch very early in ubifs_reaname(). - -RENAME_EXCHANGE used by the renameat2() system call -allows the caller to exchange two paths atomically. -Both paths have to exist and have to be on the same -filesystem. - -Signed-off-by: Richard Weinberger ---- - ---- a/fs/ubifs/dir.c -+++ b/fs/ubifs/dir.c -@@ -1101,11 +1101,6 @@ static int ubifs_rename(struct inode *ol - old_dentry, old_inode->i_ino, old_dir->i_ino, - new_dentry, new_dir->i_ino, flags); - -- if (flags & ~(RENAME_NOREPLACE | RENAME_WHITEOUT)) -- return -EINVAL; -- -- ubifs_assert(mutex_is_locked(&old_dir->i_mutex)); -- ubifs_assert(mutex_is_locked(&new_dir->i_mutex)); - if (unlink) - ubifs_assert(mutex_is_locked(&new_inode->i_mutex)); - -@@ -1290,6 +1285,64 @@ out_cancel: - return err; - } - -+static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry, -+ struct inode *new_dir, struct dentry *new_dentry) -+{ -+ struct ubifs_info *c = old_dir->i_sb->s_fs_info; -+ struct ubifs_budget_req req = { .new_dent = 1, .mod_dent = 1, -+ .dirtied_ino = 2 }; -+ int sync = IS_DIRSYNC(old_dir) || IS_DIRSYNC(new_dir); -+ struct inode *fst_inode = d_inode(old_dentry); -+ struct inode *snd_inode = d_inode(new_dentry); -+ struct timespec time; -+ int err; -+ -+ ubifs_assert(fst_inode && snd_inode); -+ -+ lock_4_inodes(old_dir, new_dir, NULL, NULL); -+ -+ time = ubifs_current_time(old_dir); -+ fst_inode->i_ctime = time; -+ snd_inode->i_ctime = time; -+ old_dir->i_mtime = old_dir->i_ctime = time; -+ new_dir->i_mtime = new_dir->i_ctime = time; -+ -+ if (old_dir != new_dir) { -+ if (S_ISDIR(fst_inode->i_mode) && !S_ISDIR(snd_inode->i_mode)) { -+ inc_nlink(new_dir); -+ drop_nlink(old_dir); -+ } -+ else if (!S_ISDIR(fst_inode->i_mode) && S_ISDIR(snd_inode->i_mode)) { -+ drop_nlink(new_dir); -+ inc_nlink(old_dir); -+ } -+ } -+ -+ err = ubifs_jnl_xrename(c, old_dir, old_dentry, new_dir, new_dentry, -+ sync); -+ -+ unlock_4_inodes(old_dir, new_dir, NULL, NULL); -+ ubifs_release_budget(c, &req); -+ -+ return err; -+} -+ -+static int ubifs_rename2(struct inode *old_dir, struct dentry *old_dentry, -+ struct inode *new_dir, struct dentry *new_dentry, -+ unsigned int flags) -+{ -+ if (flags & ~(RENAME_NOREPLACE | RENAME_WHITEOUT | RENAME_EXCHANGE)) -+ return -EINVAL; -+ -+ ubifs_assert(mutex_is_locked(&old_dir->i_mutex)); -+ ubifs_assert(mutex_is_locked(&new_dir->i_mutex)); -+ -+ if (flags & RENAME_EXCHANGE) -+ return ubifs_xrename(old_dir, old_dentry, new_dir, new_dentry); -+ -+ return ubifs_rename(old_dir, old_dentry, new_dir, new_dentry, flags); -+} -+ - int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, - struct kstat *stat) - { -@@ -1338,7 +1391,7 @@ const struct inode_operations ubifs_dir_ - .mkdir = ubifs_mkdir, - .rmdir = ubifs_rmdir, - .mknod = ubifs_mknod, -- .rename2 = ubifs_rename, -+ .rename2 = ubifs_rename2, - .setattr = ubifs_setattr, - .getattr = ubifs_getattr, - .setxattr = ubifs_setxattr, ---- a/fs/ubifs/journal.c -+++ b/fs/ubifs/journal.c -@@ -908,6 +908,147 @@ int ubifs_jnl_delete_inode(struct ubifs_ - } - - /** -+ * ubifs_jnl_xrename - cross rename two directory entries. -+ * @c: UBIFS file-system description object -+ * @fst_dir: parent inode of 1st directory entry to exchange -+ * @fst_dentry: 1st directory entry to exchange -+ * @snd_dir: parent inode of 2nd directory entry to exchange -+ * @snd_dentry: 2nd directory entry to exchange -+ * @sync: non-zero if the write-buffer has to be synchronized -+ * -+ * This function implements the cross rename operation which may involve -+ * writing 2 inodes and 2 directory entries. It marks the written inodes as clean -+ * and returns zero on success. In case of failure, a negative error code is -+ * returned. -+ */ -+int ubifs_jnl_xrename(struct ubifs_info *c, const struct inode *fst_dir, -+ const struct dentry *fst_dentry, -+ const struct inode *snd_dir, -+ const struct dentry *snd_dentry, int sync) -+{ -+ union ubifs_key key; -+ struct ubifs_dent_node *dent1, *dent2; -+ int err, dlen1, dlen2, lnum, offs, len, plen = UBIFS_INO_NODE_SZ; -+ int aligned_dlen1, aligned_dlen2; -+ int twoparents = (fst_dir != snd_dir); -+ const struct inode *fst_inode = d_inode(fst_dentry); -+ const struct inode *snd_inode = d_inode(snd_dentry); -+ void *p; -+ -+ dbg_jnl("dent '%pd' in dir ino %lu between dent '%pd' in dir ino %lu", -+ fst_dentry, fst_dir->i_ino, snd_dentry, snd_dir->i_ino); -+ -+ ubifs_assert(ubifs_inode(fst_dir)->data_len == 0); -+ ubifs_assert(ubifs_inode(snd_dir)->data_len == 0); -+ ubifs_assert(mutex_is_locked(&ubifs_inode(fst_dir)->ui_mutex)); -+ ubifs_assert(mutex_is_locked(&ubifs_inode(snd_dir)->ui_mutex)); -+ -+ dlen1 = UBIFS_DENT_NODE_SZ + snd_dentry->d_name.len + 1; -+ dlen2 = UBIFS_DENT_NODE_SZ + fst_dentry->d_name.len + 1; -+ aligned_dlen1 = ALIGN(dlen1, 8); -+ aligned_dlen2 = ALIGN(dlen2, 8); -+ -+ len = aligned_dlen1 + aligned_dlen2 + ALIGN(plen, 8); -+ if (twoparents) -+ len += plen; -+ -+ dent1 = kmalloc(len, GFP_NOFS); -+ if (!dent1) -+ return -ENOMEM; -+ -+ /* Make reservation before allocating sequence numbers */ -+ err = make_reservation(c, BASEHD, len); -+ if (err) -+ goto out_free; -+ -+ /* Make new dent for 1st entry */ -+ dent1->ch.node_type = UBIFS_DENT_NODE; -+ dent_key_init_flash(c, &dent1->key, snd_dir->i_ino, &snd_dentry->d_name); -+ dent1->inum = cpu_to_le64(fst_inode->i_ino); -+ dent1->type = get_dent_type(fst_inode->i_mode); -+ dent1->nlen = cpu_to_le16(snd_dentry->d_name.len); -+ memcpy(dent1->name, snd_dentry->d_name.name, snd_dentry->d_name.len); -+ dent1->name[snd_dentry->d_name.len] = '\0'; -+ zero_dent_node_unused(dent1); -+ ubifs_prep_grp_node(c, dent1, dlen1, 0); -+ -+ /* Make new dent for 2nd entry */ -+ dent2 = (void *)dent1 + aligned_dlen1; -+ dent2->ch.node_type = UBIFS_DENT_NODE; -+ dent_key_init_flash(c, &dent2->key, fst_dir->i_ino, &fst_dentry->d_name); -+ dent2->inum = cpu_to_le64(snd_inode->i_ino); -+ dent2->type = get_dent_type(snd_inode->i_mode); -+ dent2->nlen = cpu_to_le16(fst_dentry->d_name.len); -+ memcpy(dent2->name, fst_dentry->d_name.name, fst_dentry->d_name.len); -+ dent2->name[fst_dentry->d_name.len] = '\0'; -+ zero_dent_node_unused(dent2); -+ ubifs_prep_grp_node(c, dent2, dlen2, 0); -+ -+ p = (void *)dent2 + aligned_dlen2; -+ if (!twoparents) -+ pack_inode(c, p, fst_dir, 1); -+ else { -+ pack_inode(c, p, fst_dir, 0); -+ p += ALIGN(plen, 8); -+ pack_inode(c, p, snd_dir, 1); -+ } -+ -+ err = write_head(c, BASEHD, dent1, len, &lnum, &offs, sync); -+ if (err) -+ goto out_release; -+ if (!sync) { -+ struct ubifs_wbuf *wbuf = &c->jheads[BASEHD].wbuf; -+ -+ ubifs_wbuf_add_ino_nolock(wbuf, fst_dir->i_ino); -+ ubifs_wbuf_add_ino_nolock(wbuf, snd_dir->i_ino); -+ } -+ release_head(c, BASEHD); -+ -+ dent_key_init(c, &key, snd_dir->i_ino, &snd_dentry->d_name); -+ err = ubifs_tnc_add_nm(c, &key, lnum, offs, dlen1, &snd_dentry->d_name); -+ if (err) -+ goto out_ro; -+ -+ offs += aligned_dlen1; -+ dent_key_init(c, &key, fst_dir->i_ino, &fst_dentry->d_name); -+ err = ubifs_tnc_add_nm(c, &key, lnum, offs, dlen2, &fst_dentry->d_name); -+ if (err) -+ goto out_ro; -+ -+ offs += aligned_dlen2; -+ -+ ino_key_init(c, &key, fst_dir->i_ino); -+ err = ubifs_tnc_add(c, &key, lnum, offs, plen); -+ if (err) -+ goto out_ro; -+ -+ if (twoparents) { -+ offs += ALIGN(plen, 8); -+ ino_key_init(c, &key, snd_dir->i_ino); -+ err = ubifs_tnc_add(c, &key, lnum, offs, plen); -+ if (err) -+ goto out_ro; -+ } -+ -+ finish_reservation(c); -+ -+ mark_inode_clean(c, ubifs_inode(fst_dir)); -+ if (twoparents) -+ mark_inode_clean(c, ubifs_inode(snd_dir)); -+ kfree(dent1); -+ return 0; -+ -+out_release: -+ release_head(c, BASEHD); -+out_ro: -+ ubifs_ro_mode(c, err); -+ finish_reservation(c); -+out_free: -+ kfree(dent1); -+ return err; -+} -+ -+/** - * ubifs_jnl_rename - rename a directory entry. - * @c: UBIFS file-system description object - * @old_dir: parent inode of directory entry to rename ---- a/fs/ubifs/ubifs.h -+++ b/fs/ubifs/ubifs.h -@@ -1544,6 +1544,10 @@ int ubifs_jnl_write_data(struct ubifs_in - const union ubifs_key *key, const void *buf, int len); - int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode); - int ubifs_jnl_delete_inode(struct ubifs_info *c, const struct inode *inode); -+int ubifs_jnl_xrename(struct ubifs_info *c, const struct inode *fst_dir, -+ const struct dentry *fst_dentry, -+ const struct inode *snd_dir, -+ const struct dentry *snd_dentry, int sync); - int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir, - const struct dentry *old_dentry, - const struct inode *new_dir, diff --git a/target/linux/generic/pending-4.4/052-04-ubifs-Use-move-variable-in-ubifs_rename.patch b/target/linux/generic/pending-4.4/052-04-ubifs-Use-move-variable-in-ubifs_rename.patch deleted file mode 100644 index 81129359d..000000000 --- a/target/linux/generic/pending-4.4/052-04-ubifs-Use-move-variable-in-ubifs_rename.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Richard Weinberger -Date: Tue, 13 Sep 2016 16:18:58 +0200 -Subject: [PATCH] ubifs: Use move variable in ubifs_rename() - -...to make the code more consistent since we use -move already in other places. - -Signed-off-by: Richard Weinberger ---- - ---- a/fs/ubifs/journal.c -+++ b/fs/ubifs/journal.c -@@ -1100,7 +1100,7 @@ int ubifs_jnl_rename(struct ubifs_info * - aligned_dlen1 = ALIGN(dlen1, 8); - aligned_dlen2 = ALIGN(dlen2, 8); - len = aligned_dlen1 + aligned_dlen2 + ALIGN(ilen, 8) + ALIGN(plen, 8); -- if (old_dir != new_dir) -+ if (move) - len += plen; - dent = kmalloc(len, GFP_NOFS); - if (!dent) -@@ -1216,7 +1216,7 @@ int ubifs_jnl_rename(struct ubifs_info * - if (err) - goto out_ro; - -- if (old_dir != new_dir) { -+ if (move) { - offs += ALIGN(plen, 8); - ino_key_init(c, &key, new_dir->i_ino); - err = ubifs_tnc_add(c, &key, lnum, offs, plen); diff --git a/target/linux/generic/pending-4.4/053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch b/target/linux/generic/pending-4.4/053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch deleted file mode 100644 index 662584ca6..000000000 --- a/target/linux/generic/pending-4.4/053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch +++ /dev/null @@ -1,82 +0,0 @@ -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/pending-4.4/053-0002-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch b/target/linux/generic/pending-4.4/053-0002-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch deleted file mode 100644 index 9313cd557..000000000 --- a/target/linux/generic/pending-4.4/053-0002-ubifs-Use-dirty_writeback_interval-value-for-wbuf-ti.patch +++ /dev/null @@ -1,66 +0,0 @@ -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/pending-4.4/060-mips_decompressor_memmove.patch b/target/linux/generic/pending-4.4/060-mips_decompressor_memmove.patch deleted file mode 100644 index d215b80ab..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/061-softirq-let-ksoftirqd-do-its-job.patch b/target/linux/generic/pending-4.4/061-softirq-let-ksoftirqd-do-its-job.patch deleted file mode 100644 index a2de48093..000000000 --- a/target/linux/generic/pending-4.4/061-softirq-let-ksoftirqd-do-its-job.patch +++ /dev/null @@ -1,83 +0,0 @@ -From: Eric Dumazet -Date: Wed, 31 Aug 2016 10:42:29 -0700 -Subject: [PATCH] softirq: let ksoftirqd do its job - -A while back, Paolo and Hannes sent an RFC patch adding threaded-able -napi poll loop support : (https://patchwork.ozlabs.org/patch/620657/) - -The problem seems to be that softirqs are very aggressive and are often -handled by the current process, even if we are under stress and that -ksoftirqd was scheduled, so that innocent threads would have more chance -to make progress. - -This patch makes sure that if ksoftirq is running, we let it -perform the softirq work. - -Jonathan Corbet summarized the issue in https://lwn.net/Articles/687617/ - -Tested: - - - NIC receiving traffic handled by CPU 0 - - UDP receiver running on CPU 0, using a single UDP socket. - - Incoming flood of UDP packets targeting the UDP socket. - -Before the patch, the UDP receiver could almost never get cpu cycles and -could only receive ~2,000 packets per second. - -After the patch, cpu cycles are split 50/50 between user application and -ksoftirqd/0, and we can effectively read ~900,000 packets per second, -a huge improvement in DOS situation. (Note that more packets are now -dropped by the NIC itself, since the BH handlers get less cpu cycles to -drain RX ring buffer) - -Since the load runs in well identified threads context, an admin can -more easily tune process scheduling parameters if needed. - -Reported-by: Paolo Abeni -Reported-by: Hannes Frederic Sowa -Signed-off-by: Eric Dumazet -Cc: David Miller -Cc: Peter Zijlstra -Cc: Rik van Riel ---- - ---- a/kernel/softirq.c -+++ b/kernel/softirq.c -@@ -78,6 +78,17 @@ static void wakeup_softirqd(void) - } - - /* -+ * If ksoftirqd is scheduled, we do not want to process pending softirqs -+ * right now. Let ksoftirqd handle this at its own rate, to get fairness. -+ */ -+static bool ksoftirqd_running(void) -+{ -+ struct task_struct *tsk = __this_cpu_read(ksoftirqd); -+ -+ return tsk && (tsk->state == TASK_RUNNING); -+} -+ -+/* - * preempt_count and SOFTIRQ_OFFSET usage: - * - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving - * softirq processing. -@@ -313,7 +324,7 @@ asmlinkage __visible void do_softirq(voi - - pending = local_softirq_pending(); - -- if (pending) -+ if (pending && !ksoftirqd_running()) - do_softirq_own_stack(); - - local_irq_restore(flags); -@@ -340,6 +351,9 @@ void irq_enter(void) - - static inline void invoke_softirq(void) - { -+ if (ksoftirqd_running()) -+ return; -+ - if (!force_irqthreads) { - #ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK - /* diff --git a/target/linux/generic/pending-4.4/067-v4.11-mtd-nand-Add-Winbond-manufacturer-id.patch b/target/linux/generic/pending-4.4/067-v4.11-mtd-nand-Add-Winbond-manufacturer-id.patch deleted file mode 100644 index d102d89b2..000000000 --- a/target/linux/generic/pending-4.4/067-v4.11-mtd-nand-Add-Winbond-manufacturer-id.patch +++ /dev/null @@ -1,34 +0,0 @@ -From a4077ce5871304f8a78f80b74b18b6052a410f1a Mon Sep 17 00:00:00 2001 -From: "Andrey Jr. Melnikov" -Date: Thu, 8 Dec 2016 19:57:08 +0300 -Subject: [PATCH] mtd: nand: Add Winbond manufacturer id - -Add WINBOND manufacturer id. - -Signed-off-by: Andrey Jr. Melnikov -Signed-off-by: Boris Brezillon ---- - drivers/mtd/nand/nand_ids.c | 1 + - include/linux/mtd/nand.h | 1 + - 2 files changed, 2 insertions(+) - ---- a/drivers/mtd/nand/nand_ids.c -+++ b/drivers/mtd/nand/nand_ids.c -@@ -181,6 +181,7 @@ struct nand_manufacturers nand_manuf_ids - {NAND_MFR_SANDISK, "SanDisk"}, - {NAND_MFR_INTEL, "Intel"}, - {NAND_MFR_ATO, "ATO"}, -+ {NAND_MFR_WINBOND, "Winbond"}, - {0x0, "Unknown"} - }; - ---- a/include/linux/mtd/nand.h -+++ b/include/linux/mtd/nand.h -@@ -736,6 +736,7 @@ struct nand_chip { - #define NAND_MFR_SANDISK 0x45 - #define NAND_MFR_INTEL 0x89 - #define NAND_MFR_ATO 0x9b -+#define NAND_MFR_WINBOND 0xef - - /* The maximum expected count of bytes in the NAND ID sequence */ - #define NAND_MAX_ID_LEN 8 diff --git a/target/linux/generic/pending-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch b/target/linux/generic/pending-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch deleted file mode 100644 index cd0d09887..000000000 --- a/target/linux/generic/pending-4.4/070-v4.5-0003-net-bgmac-clarify-CONFIG_BCMA-dependency.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 1f820f538f7396db7fd40684b9c3620816acc5a3 Mon Sep 17 00:00:00 2001 -From: Arnd Bergmann -Date: Fri, 29 Jan 2016 12:39:12 +0100 -Subject: [PATCH] net: bgmac: clarify CONFIG_BCMA dependency - -The bgmac driver depends on BCMA_HOST_SOC, which is only used -when CONFIG_BCMA is enabled. However, it is a bool option and can -be set when CONFIG_BCMA=m, and then bgmac can be built-in, leading -to an obvious link error: - -drivers/built-in.o: In function `bgmac_init': -:(.init.text+0x7f2c): undefined reference to `__bcma_driver_register' -drivers/built-in.o: In function `bgmac_exit': -:(.exit.text+0x110a): undefined reference to `bcma_driver_unregister' - -To avoid this case, we need to depend on both BCMA and BCMA_SOC, -as this patch does. I'm also trying to make the dependency more -readable by splitting it into three lines, and adding a COMPILE_TEST -alternative so we can test-build it in all configurations that -support BCMA. - -The added dependency on FIXED_PHY addresses a related issue where -we cannot call fixed_phy_register() when CONFIG_FIXED_PHY=m and -CONFIG_BGMAC=y. - -Signed-off-by: Arnd Bergmann -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/Kconfig | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/Kconfig -+++ b/drivers/net/ethernet/broadcom/Kconfig -@@ -151,8 +151,11 @@ config BNX2X_VXLAN - - config BGMAC - tristate "BCMA bus GBit core support" -- depends on BCMA_HOST_SOC && HAS_DMA && (BCM47XX || ARCH_BCM_5301X) -+ depends on BCMA && BCMA_HOST_SOC -+ depends on HAS_DMA -+ depends on BCM47XX || ARCH_BCM_5301X || COMPILE_TEST - select PHYLIB -+ select FIXED_PHY - ---help--- - This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus. - They can be found on BCM47xx SoCs and provide gigabit ethernet. diff --git a/target/linux/generic/pending-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch b/target/linux/generic/pending-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch deleted file mode 100644 index 94a37d443..000000000 --- a/target/linux/generic/pending-4.4/070-v4.6-0001-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 387b75f8b31437792e8334390fdf5cf060d1e3da Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 2 Feb 2016 07:47:14 +0100 -Subject: [PATCH] bgmac: add helper checking for BCM4707 / BCM53018 chip id -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Chipsets with BCM4707 / BCM53018 ID require special handling at a few -places in the code. It's likely there will be more IDs to check in the -future. To simplify it add this trivial helper. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 30 ++++++++++++++++-------------- - 1 file changed, 16 insertions(+), 14 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -26,6 +26,17 @@ static const struct bcma_device_id bgmac - }; - MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl); - -+static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac) -+{ -+ switch (bgmac->core->bus->chipinfo.id) { -+ case BCMA_CHIP_ID_BCM4707: -+ case BCMA_CHIP_ID_BCM53018: -+ return true; -+ default: -+ return false; -+ } -+} -+ - static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask, - u32 value, int timeout) - { -@@ -991,11 +1002,9 @@ static void bgmac_mac_speed(struct bgmac - static void bgmac_miiconfig(struct bgmac *bgmac) - { - struct bcma_device *core = bgmac->core; -- struct bcma_chipinfo *ci = &core->bus->chipinfo; - u8 imode; - -- if (ci->id == BCMA_CHIP_ID_BCM4707 || -- ci->id == BCMA_CHIP_ID_BCM53018) { -+ if (bgmac_is_bcm4707_family(bgmac)) { - bcma_awrite32(core, BCMA_IOCTL, - bcma_aread32(core, BCMA_IOCTL) | 0x40 | - BGMAC_BCMA_IOCTL_SW_CLKEN); -@@ -1059,9 +1068,7 @@ static void bgmac_chip_reset(struct bgma - } - - /* Request Misc PLL for corerev > 2 */ -- if (core->id.rev > 2 && -- ci->id != BCMA_CHIP_ID_BCM4707 && -- ci->id != BCMA_CHIP_ID_BCM53018) { -+ if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) { - bgmac_set(bgmac, BCMA_CLKCTLST, - BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ); - bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, -@@ -1197,8 +1204,7 @@ static void bgmac_enable(struct bgmac *b - break; - } - -- if (ci->id != BCMA_CHIP_ID_BCM4707 && -- ci->id != BCMA_CHIP_ID_BCM53018) { -+ if (!bgmac_is_bcm4707_family(bgmac)) { - rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL); - rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK; - bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / -@@ -1477,14 +1483,12 @@ static int bgmac_fixed_phy_register(stru - - static int bgmac_mii_register(struct bgmac *bgmac) - { -- struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo; - struct mii_bus *mii_bus; - struct phy_device *phy_dev; - char bus_id[MII_BUS_ID_SIZE + 3]; - int i, err = 0; - -- if (ci->id == BCMA_CHIP_ID_BCM4707 || -- ci->id == BCMA_CHIP_ID_BCM53018) -+ if (bgmac_is_bcm4707_family(bgmac)) - return bgmac_fixed_phy_register(bgmac); - - mii_bus = mdiobus_alloc(); -@@ -1555,7 +1559,6 @@ static void bgmac_mii_unregister(struct - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */ - static int bgmac_probe(struct bcma_device *core) - { -- struct bcma_chipinfo *ci = &core->bus->chipinfo; - struct net_device *net_dev; - struct bgmac *bgmac; - struct ssb_sprom *sprom = &core->bus->sprom; -@@ -1641,8 +1644,7 @@ static int bgmac_probe(struct bcma_devic - bgmac_chip_reset(bgmac); - - /* For Northstar, we have to take all GMAC core out of reset */ -- if (ci->id == BCMA_CHIP_ID_BCM4707 || -- ci->id == BCMA_CHIP_ID_BCM53018) { -+ if (bgmac_is_bcm4707_family(bgmac)) { - struct bcma_device *ns_core; - int ns_gmac; - diff --git a/target/linux/generic/pending-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch b/target/linux/generic/pending-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch deleted file mode 100644 index 41e470b31..000000000 --- a/target/linux/generic/pending-4.4/070-v4.6-0002-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 9e4e6206c67ae11d68fc96882256f37c237087d4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 22 Feb 2016 22:51:13 +0100 -Subject: [PATCH] bgmac: support Ethernet device on BCM47094 SoC -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It needs very similar workarounds to the one on BCM4707. It was tested -on D-Link DIR-885L home router. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -30,6 +30,7 @@ static inline bool bgmac_is_bcm4707_fami - { - switch (bgmac->core->bus->chipinfo.id) { - case BCMA_CHIP_ID_BCM4707: -+ case BCMA_CHIP_ID_BCM47094: - case BCMA_CHIP_ID_BCM53018: - return true; - default: -@@ -1056,8 +1057,9 @@ static void bgmac_chip_reset(struct bgma - (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188)) - iost &= ~BGMAC_BCMA_IOST_ATTACHED; - -- /* 3GMAC: for BCM4707, only do core reset at bgmac_probe() */ -- if (ci->id != BCMA_CHIP_ID_BCM4707) { -+ /* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */ -+ if (ci->id != BCMA_CHIP_ID_BCM4707 && -+ ci->id != BCMA_CHIP_ID_BCM47094) { - flags = 0; - if (iost & BGMAC_BCMA_IOST_ATTACHED) { - flags = BGMAC_BCMA_IOCTL_SW_CLKEN; diff --git a/target/linux/generic/pending-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch b/target/linux/generic/pending-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch deleted file mode 100644 index a5fcaab51..000000000 --- a/target/linux/generic/pending-4.4/070-v4.6-0004-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c02bc350f9dbce7d637c394a6e1c4d29dc5b28b2 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau -Date: Tue, 12 Apr 2016 18:27:29 +0200 -Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0. This mainly -fixes support for BCM4708A0KF SoCs with Ethernet core rev 5 (it means -only some devices as most of BCM4708A0KF-s got core rev 4). -This was tested for regressions on BCM47094 which doesn't seem to care -which bit gets used. - -Signed-off-by: Felix Fietkau -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -199,9 +199,9 @@ - #define BGMAC_CMDCFG_TAI 0x00000200 - #define BGMAC_CMDCFG_HD 0x00000400 /* Set if in half duplex mode */ - #define BGMAC_CMDCFG_HD_SHIFT 10 --#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for other revs */ --#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, only for core rev 4 */ --#define BGMAC_CMDCFG_SR(rev) ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0) -+#define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for core rev 0-3 */ -+#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, for core rev >= 4 */ -+#define BGMAC_CMDCFG_SR(rev) ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0) - #define BGMAC_CMDCFG_ML 0x00008000 /* Set to activate mac loopback mode */ - #define BGMAC_CMDCFG_AE 0x00400000 - #define BGMAC_CMDCFG_CFE 0x00800000 diff --git a/target/linux/generic/pending-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch b/target/linux/generic/pending-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch deleted file mode 100644 index 8f6d9a9ee..000000000 --- a/target/linux/generic/pending-4.4/070-v4.8-0001-bgmac-Bind-net_device-with-backing-device-structure.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2022e9d50798aa592887ccb5a7d045e537f3855f Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Tue, 7 Jun 2016 15:06:13 -0700 -Subject: [PATCH 1/3] bgmac: Bind net_device with backing device structure - -In preparation for allowing different helpers to be utilized against -network devices created by the bgmac driver, make sure that we bind the -net_device with core->dev. - -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1604,6 +1604,7 @@ static int bgmac_probe(struct bcma_devic - bgmac->net_dev = net_dev; - bgmac->core = core; - bcma_set_drvdata(core, bgmac); -+ SET_NETDEV_DEV(net_dev, &core->dev); - - /* Defaults */ - memcpy(bgmac->net_dev->dev_addr, mac, ETH_ALEN); diff --git a/target/linux/generic/pending-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch b/target/linux/generic/pending-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch deleted file mode 100644 index 585282b0a..000000000 --- a/target/linux/generic/pending-4.4/070-v4.8-0002-bgmac-Add-support-for-ethtool-statistics.patch +++ /dev/null @@ -1,175 +0,0 @@ -From f6613d4fa937fa8388f2c1cb4e69ccc25e9e2336 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Tue, 7 Jun 2016 15:06:14 -0700 -Subject: [PATCH 2/3] bgmac: Add support for ethtool statistics - -Read the statistics from the BGMAC's builtin MAC and return them to -user-space using the standard ethtool helpers. - -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 124 ++++++++++++++++++++++++++++++++++ - drivers/net/ethernet/broadcom/bgmac.h | 4 +- - 2 files changed, 126 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1387,6 +1387,127 @@ static const struct net_device_ops bgmac - * ethtool_ops - **************************************************/ - -+struct bgmac_stat { -+ u8 size; -+ u32 offset; -+ const char *name; -+}; -+ -+static struct bgmac_stat bgmac_get_strings_stats[] = { -+ { 8, BGMAC_TX_GOOD_OCTETS, "tx_good_octets" }, -+ { 4, BGMAC_TX_GOOD_PKTS, "tx_good" }, -+ { 8, BGMAC_TX_OCTETS, "tx_octets" }, -+ { 4, BGMAC_TX_PKTS, "tx_pkts" }, -+ { 4, BGMAC_TX_BROADCAST_PKTS, "tx_broadcast" }, -+ { 4, BGMAC_TX_MULTICAST_PKTS, "tx_multicast" }, -+ { 4, BGMAC_TX_LEN_64, "tx_64" }, -+ { 4, BGMAC_TX_LEN_65_TO_127, "tx_65_127" }, -+ { 4, BGMAC_TX_LEN_128_TO_255, "tx_128_255" }, -+ { 4, BGMAC_TX_LEN_256_TO_511, "tx_256_511" }, -+ { 4, BGMAC_TX_LEN_512_TO_1023, "tx_512_1023" }, -+ { 4, BGMAC_TX_LEN_1024_TO_1522, "tx_1024_1522" }, -+ { 4, BGMAC_TX_LEN_1523_TO_2047, "tx_1523_2047" }, -+ { 4, BGMAC_TX_LEN_2048_TO_4095, "tx_2048_4095" }, -+ { 4, BGMAC_TX_LEN_4096_TO_8191, "tx_4096_8191" }, -+ { 4, BGMAC_TX_LEN_8192_TO_MAX, "tx_8192_max" }, -+ { 4, BGMAC_TX_JABBER_PKTS, "tx_jabber" }, -+ { 4, BGMAC_TX_OVERSIZE_PKTS, "tx_oversize" }, -+ { 4, BGMAC_TX_FRAGMENT_PKTS, "tx_fragment" }, -+ { 4, BGMAC_TX_UNDERRUNS, "tx_underruns" }, -+ { 4, BGMAC_TX_TOTAL_COLS, "tx_total_cols" }, -+ { 4, BGMAC_TX_SINGLE_COLS, "tx_single_cols" }, -+ { 4, BGMAC_TX_MULTIPLE_COLS, "tx_multiple_cols" }, -+ { 4, BGMAC_TX_EXCESSIVE_COLS, "tx_excessive_cols" }, -+ { 4, BGMAC_TX_LATE_COLS, "tx_late_cols" }, -+ { 4, BGMAC_TX_DEFERED, "tx_defered" }, -+ { 4, BGMAC_TX_CARRIER_LOST, "tx_carrier_lost" }, -+ { 4, BGMAC_TX_PAUSE_PKTS, "tx_pause" }, -+ { 4, BGMAC_TX_UNI_PKTS, "tx_unicast" }, -+ { 4, BGMAC_TX_Q0_PKTS, "tx_q0" }, -+ { 8, BGMAC_TX_Q0_OCTETS, "tx_q0_octets" }, -+ { 4, BGMAC_TX_Q1_PKTS, "tx_q1" }, -+ { 8, BGMAC_TX_Q1_OCTETS, "tx_q1_octets" }, -+ { 4, BGMAC_TX_Q2_PKTS, "tx_q2" }, -+ { 8, BGMAC_TX_Q2_OCTETS, "tx_q2_octets" }, -+ { 4, BGMAC_TX_Q3_PKTS, "tx_q3" }, -+ { 8, BGMAC_TX_Q3_OCTETS, "tx_q3_octets" }, -+ { 8, BGMAC_RX_GOOD_OCTETS, "rx_good_octets" }, -+ { 4, BGMAC_RX_GOOD_PKTS, "rx_good" }, -+ { 8, BGMAC_RX_OCTETS, "rx_octets" }, -+ { 4, BGMAC_RX_PKTS, "rx_pkts" }, -+ { 4, BGMAC_RX_BROADCAST_PKTS, "rx_broadcast" }, -+ { 4, BGMAC_RX_MULTICAST_PKTS, "rx_multicast" }, -+ { 4, BGMAC_RX_LEN_64, "rx_64" }, -+ { 4, BGMAC_RX_LEN_65_TO_127, "rx_65_127" }, -+ { 4, BGMAC_RX_LEN_128_TO_255, "rx_128_255" }, -+ { 4, BGMAC_RX_LEN_256_TO_511, "rx_256_511" }, -+ { 4, BGMAC_RX_LEN_512_TO_1023, "rx_512_1023" }, -+ { 4, BGMAC_RX_LEN_1024_TO_1522, "rx_1024_1522" }, -+ { 4, BGMAC_RX_LEN_1523_TO_2047, "rx_1523_2047" }, -+ { 4, BGMAC_RX_LEN_2048_TO_4095, "rx_2048_4095" }, -+ { 4, BGMAC_RX_LEN_4096_TO_8191, "rx_4096_8191" }, -+ { 4, BGMAC_RX_LEN_8192_TO_MAX, "rx_8192_max" }, -+ { 4, BGMAC_RX_JABBER_PKTS, "rx_jabber" }, -+ { 4, BGMAC_RX_OVERSIZE_PKTS, "rx_oversize" }, -+ { 4, BGMAC_RX_FRAGMENT_PKTS, "rx_fragment" }, -+ { 4, BGMAC_RX_MISSED_PKTS, "rx_missed" }, -+ { 4, BGMAC_RX_CRC_ALIGN_ERRS, "rx_crc_align" }, -+ { 4, BGMAC_RX_UNDERSIZE, "rx_undersize" }, -+ { 4, BGMAC_RX_CRC_ERRS, "rx_crc" }, -+ { 4, BGMAC_RX_ALIGN_ERRS, "rx_align" }, -+ { 4, BGMAC_RX_SYMBOL_ERRS, "rx_symbol" }, -+ { 4, BGMAC_RX_PAUSE_PKTS, "rx_pause" }, -+ { 4, BGMAC_RX_NONPAUSE_PKTS, "rx_nonpause" }, -+ { 4, BGMAC_RX_SACHANGES, "rx_sa_changes" }, -+ { 4, BGMAC_RX_UNI_PKTS, "rx_unicast" }, -+}; -+ -+#define BGMAC_STATS_LEN ARRAY_SIZE(bgmac_get_strings_stats) -+ -+static int bgmac_get_sset_count(struct net_device *dev, int string_set) -+{ -+ switch (string_set) { -+ case ETH_SS_STATS: -+ return BGMAC_STATS_LEN; -+ } -+ -+ return -EOPNOTSUPP; -+} -+ -+static void bgmac_get_strings(struct net_device *dev, u32 stringset, -+ u8 *data) -+{ -+ int i; -+ -+ if (stringset != ETH_SS_STATS) -+ return; -+ -+ for (i = 0; i < BGMAC_STATS_LEN; i++) -+ strlcpy(data + i * ETH_GSTRING_LEN, -+ bgmac_get_strings_stats[i].name, ETH_GSTRING_LEN); -+} -+ -+static void bgmac_get_ethtool_stats(struct net_device *dev, -+ struct ethtool_stats *ss, uint64_t *data) -+{ -+ struct bgmac *bgmac = netdev_priv(dev); -+ const struct bgmac_stat *s; -+ unsigned int i; -+ u64 val; -+ -+ if (!netif_running(dev)) -+ return; -+ -+ for (i = 0; i < BGMAC_STATS_LEN; i++) { -+ s = &bgmac_get_strings_stats[i]; -+ val = 0; -+ if (s->size == 8) -+ val = (u64)bgmac_read(bgmac, s->offset + 4) << 32; -+ val |= bgmac_read(bgmac, s->offset); -+ data[i] = val; -+ } -+} -+ - static int bgmac_get_settings(struct net_device *net_dev, - struct ethtool_cmd *cmd) - { -@@ -1411,6 +1532,9 @@ static void bgmac_get_drvinfo(struct net - } - - static const struct ethtool_ops bgmac_ethtool_ops = { -+ .get_strings = bgmac_get_strings, -+ .get_sset_count = bgmac_get_sset_count, -+ .get_ethtool_stats = bgmac_get_ethtool_stats, - .get_settings = bgmac_get_settings, - .set_settings = bgmac_set_settings, - .get_drvinfo = bgmac_get_drvinfo, ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -123,7 +123,7 @@ - #define BGMAC_TX_LEN_1024_TO_1522 0x334 - #define BGMAC_TX_LEN_1523_TO_2047 0x338 - #define BGMAC_TX_LEN_2048_TO_4095 0x33c --#define BGMAC_TX_LEN_4095_TO_8191 0x340 -+#define BGMAC_TX_LEN_4096_TO_8191 0x340 - #define BGMAC_TX_LEN_8192_TO_MAX 0x344 - #define BGMAC_TX_JABBER_PKTS 0x348 /* Error */ - #define BGMAC_TX_OVERSIZE_PKTS 0x34c /* Error */ -@@ -166,7 +166,7 @@ - #define BGMAC_RX_LEN_1024_TO_1522 0x3e4 - #define BGMAC_RX_LEN_1523_TO_2047 0x3e8 - #define BGMAC_RX_LEN_2048_TO_4095 0x3ec --#define BGMAC_RX_LEN_4095_TO_8191 0x3f0 -+#define BGMAC_RX_LEN_4096_TO_8191 0x3f0 - #define BGMAC_RX_LEN_8192_TO_MAX 0x3f4 - #define BGMAC_RX_JABBER_PKTS 0x3f8 /* Error */ - #define BGMAC_RX_OVERSIZE_PKTS 0x3fc /* Error */ diff --git a/target/linux/generic/pending-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch b/target/linux/generic/pending-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch deleted file mode 100644 index 1dbe1743d..000000000 --- a/target/linux/generic/pending-4.4/070-v4.8-0003-bgmac-Maintain-some-netdev-statistics.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 6d490f62a4c7f11c552591bdd08eda3636aa0db9 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Tue, 7 Jun 2016 15:06:15 -0700 -Subject: [PATCH 3/3] bgmac: Maintain some netdev statistics - -Add a few netdev statistics to report transmitted and received bytes and -packets and a few obvious errors. - -Signed-off-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -246,6 +246,8 @@ err_dma_head: - - err_drop: - dev_kfree_skb(skb); -+ net_dev->stats.tx_dropped++; -+ net_dev->stats.tx_errors++; - return NETDEV_TX_OK; - } - -@@ -285,6 +287,8 @@ static void bgmac_dma_tx_free(struct bgm - DMA_TO_DEVICE); - - if (slot->skb) { -+ bgmac->net_dev->stats.tx_bytes += slot->skb->len; -+ bgmac->net_dev->stats.tx_packets++; - bytes_compl += slot->skb->len; - pkts_compl++; - -@@ -468,6 +472,7 @@ static int bgmac_dma_rx_read(struct bgma - bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n", - ring->start); - put_page(virt_to_head_page(buf)); -+ bgmac->net_dev->stats.rx_errors++; - break; - } - -@@ -475,6 +480,8 @@ static int bgmac_dma_rx_read(struct bgma - bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n", - ring->start); - put_page(virt_to_head_page(buf)); -+ bgmac->net_dev->stats.rx_length_errors++; -+ bgmac->net_dev->stats.rx_errors++; - break; - } - -@@ -485,6 +492,7 @@ static int bgmac_dma_rx_read(struct bgma - if (unlikely(!skb)) { - bgmac_err(bgmac, "build_skb failed\n"); - put_page(virt_to_head_page(buf)); -+ bgmac->net_dev->stats.rx_errors++; - break; - } - skb_put(skb, BGMAC_RX_FRAME_OFFSET + -@@ -494,6 +502,8 @@ static int bgmac_dma_rx_read(struct bgma - - skb_checksum_none_assert(skb); - skb->protocol = eth_type_trans(skb, bgmac->net_dev); -+ bgmac->net_dev->stats.rx_bytes += len; -+ bgmac->net_dev->stats.rx_packets++; - napi_gro_receive(&bgmac->napi, skb); - handled++; - } while (0); diff --git a/target/linux/generic/pending-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch b/target/linux/generic/pending-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch deleted file mode 100644 index 7ce6a09ec..000000000 --- a/target/linux/generic/pending-4.4/070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch +++ /dev/null @@ -1,105 +0,0 @@ -From b21fcb259313bcf7d4f73ecd5e44948995c8957c Mon Sep 17 00:00:00 2001 -From: Philippe Reynes -Date: Sun, 19 Jun 2016 22:37:05 +0200 -Subject: [PATCH 1/2] net: ethernet: bgmac: use phydev from struct net_device - -The private structure contain a pointer to phydev, but the structure -net_device already contain such pointer. So we can remove the pointer -phydev in the private structure, and update the driver to use the -one contained in struct net_device. - -Signed-off-by: Philippe Reynes -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 17 ++++++----------- - drivers/net/ethernet/broadcom/bgmac.h | 1 - - 2 files changed, 6 insertions(+), 12 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1324,7 +1324,7 @@ static int bgmac_open(struct net_device - } - napi_enable(&bgmac->napi); - -- phy_start(bgmac->phy_dev); -+ phy_start(net_dev->phydev); - - netif_start_queue(net_dev); - -@@ -1337,7 +1337,7 @@ static int bgmac_stop(struct net_device - - netif_carrier_off(net_dev); - -- phy_stop(bgmac->phy_dev); -+ phy_stop(net_dev->phydev); - - napi_disable(&bgmac->napi); - bgmac_chip_intrs_off(bgmac); -@@ -1375,12 +1375,10 @@ static int bgmac_set_mac_address(struct - - static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) - { -- struct bgmac *bgmac = netdev_priv(net_dev); -- - if (!netif_running(net_dev)) - return -EINVAL; - -- return phy_mii_ioctl(bgmac->phy_dev, ifr, cmd); -+ return phy_mii_ioctl(net_dev->phydev, ifr, cmd); - } - - static const struct net_device_ops bgmac_netdev_ops = { -@@ -1523,7 +1521,7 @@ static int bgmac_get_settings(struct net - { - struct bgmac *bgmac = netdev_priv(net_dev); - -- return phy_ethtool_gset(bgmac->phy_dev, cmd); -+ return phy_ethtool_gset(net_dev->phydev, cmd); - } - - static int bgmac_set_settings(struct net_device *net_dev, -@@ -1531,7 +1529,7 @@ static int bgmac_set_settings(struct net - { - struct bgmac *bgmac = netdev_priv(net_dev); - -- return phy_ethtool_sset(bgmac->phy_dev, cmd); -+ return phy_ethtool_sset(net_dev->phydev, cmd); - } - - static void bgmac_get_drvinfo(struct net_device *net_dev, -@@ -1568,7 +1566,7 @@ static int bgmac_mii_write(struct mii_bu - static void bgmac_adjust_link(struct net_device *net_dev) - { - struct bgmac *bgmac = netdev_priv(net_dev); -- struct phy_device *phy_dev = bgmac->phy_dev; -+ struct phy_device *phy_dev = net_dev->phydev; - bool update = false; - - if (phy_dev->link) { -@@ -1612,8 +1610,6 @@ static int bgmac_fixed_phy_register(stru - return err; - } - -- bgmac->phy_dev = phy_dev; -- - return err; - } - -@@ -1666,7 +1662,6 @@ static int bgmac_mii_register(struct bgm - err = PTR_ERR(phy_dev); - goto err_unregister_bus; - } -- bgmac->phy_dev = phy_dev; - - return err; - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -441,7 +441,6 @@ struct bgmac { - struct net_device *net_dev; - struct napi_struct napi; - struct mii_bus *mii_bus; -- struct phy_device *phy_dev; - - /* DMA */ - struct bgmac_dma_ring tx_ring[BGMAC_MAX_TX_RINGS]; diff --git a/target/linux/generic/pending-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch b/target/linux/generic/pending-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch deleted file mode 100644 index 3837b6094..000000000 --- a/target/linux/generic/pending-4.4/071-v4.8-0001-net-ethernet-bgmac-change-bgmac_-prints-to-dev_-prin.patch +++ /dev/null @@ -1,407 +0,0 @@ -From d00a8281bcc962027dfe409c2f3e3f0546be9200 Mon Sep 17 00:00:00 2001 -From: Jon Mason -Date: Thu, 7 Jul 2016 19:08:53 -0400 -Subject: [PATCH 1/5] net: ethernet: bgmac: change bgmac_* prints to dev_* - prints - -The bgmac_* print wrappers call dev_* prints with the dev pointer from -the bcma core. In anticipation of removing the bcma requirement for -this driver, these must be changed to not reference that struct. So, -simply change all of the bgmac_* prints to their dev_* counterparts. In -some cases netdev_* prints are more appropriate, so change those as -well. - -Signed-off-by: Jon Mason -Acked-by: Arnd Bergmann -Reviewed-by: Florian Fainelli -Tested-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 103 +++++++++++++++++----------------- - drivers/net/ethernet/broadcom/bgmac.h | 14 +---- - 2 files changed, 55 insertions(+), 62 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -50,7 +50,7 @@ static bool bgmac_wait_value(struct bcma - return true; - udelay(10); - } -- pr_err("Timeout waiting for reg 0x%X\n", reg); -+ dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg); - return false; - } - -@@ -84,8 +84,8 @@ static void bgmac_dma_tx_reset(struct bg - udelay(10); - } - if (i) -- bgmac_err(bgmac, "Timeout suspending DMA TX ring 0x%X (BGMAC_DMA_TX_STAT: 0x%08X)\n", -- ring->mmio_base, val); -+ dev_err(bgmac->dev, "Timeout suspending DMA TX ring 0x%X (BGMAC_DMA_TX_STAT: 0x%08X)\n", -+ ring->mmio_base, val); - - /* Remove SUSPEND bit */ - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, 0); -@@ -93,13 +93,13 @@ static void bgmac_dma_tx_reset(struct bg - ring->mmio_base + BGMAC_DMA_TX_STATUS, - BGMAC_DMA_TX_STAT, BGMAC_DMA_TX_STAT_DISABLED, - 10000)) { -- bgmac_warn(bgmac, "DMA TX ring 0x%X wasn't disabled on time, waiting additional 300us\n", -- ring->mmio_base); -+ dev_warn(bgmac->dev, "DMA TX ring 0x%X wasn't disabled on time, waiting additional 300us\n", -+ ring->mmio_base); - udelay(300); - val = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS); - if ((val & BGMAC_DMA_TX_STAT) != BGMAC_DMA_TX_STAT_DISABLED) -- bgmac_err(bgmac, "Reset of DMA TX ring 0x%X failed\n", -- ring->mmio_base); -+ dev_err(bgmac->dev, "Reset of DMA TX ring 0x%X failed\n", -+ ring->mmio_base); - } - } - -@@ -161,7 +161,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru - int i; - - if (skb->len > BGMAC_DESC_CTL1_LEN) { -- bgmac_err(bgmac, "Too long skb (%d)\n", skb->len); -+ netdev_err(bgmac->net_dev, "Too long skb (%d)\n", skb->len); - goto err_drop; - } - -@@ -174,7 +174,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru - * even when ring->end overflows - */ - if (ring->end - ring->start + nr_frags + 1 >= BGMAC_TX_RING_SLOTS) { -- bgmac_err(bgmac, "TX ring is full, queue should be stopped!\n"); -+ netdev_err(bgmac->net_dev, "TX ring is full, queue should be stopped!\n"); - netif_stop_queue(net_dev); - return NETDEV_TX_BUSY; - } -@@ -241,8 +241,8 @@ err_dma: - } - - err_dma_head: -- bgmac_err(bgmac, "Mapping error of skb on ring 0x%X\n", -- ring->mmio_base); -+ netdev_err(bgmac->net_dev, "Mapping error of skb on ring 0x%X\n", -+ ring->mmio_base); - - err_drop: - dev_kfree_skb(skb); -@@ -321,8 +321,8 @@ static void bgmac_dma_rx_reset(struct bg - ring->mmio_base + BGMAC_DMA_RX_STATUS, - BGMAC_DMA_RX_STAT, BGMAC_DMA_RX_STAT_DISABLED, - 10000)) -- bgmac_err(bgmac, "Reset of ring 0x%X RX failed\n", -- ring->mmio_base); -+ dev_err(bgmac->dev, "Reset of ring 0x%X RX failed\n", -+ ring->mmio_base); - } - - static void bgmac_dma_rx_enable(struct bgmac *bgmac, -@@ -374,7 +374,7 @@ static int bgmac_dma_rx_skb_for_slot(str - dma_addr = dma_map_single(dma_dev, buf + BGMAC_RX_BUF_OFFSET, - BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); - if (dma_mapping_error(dma_dev, dma_addr)) { -- bgmac_err(bgmac, "DMA mapping error\n"); -+ netdev_err(bgmac->net_dev, "DMA mapping error\n"); - put_page(virt_to_head_page(buf)); - return -ENOMEM; - } -@@ -469,16 +469,16 @@ static int bgmac_dma_rx_read(struct bgma - - /* Check for poison and drop or pass the packet */ - if (len == 0xdead && flags == 0xbeef) { -- bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n", -- ring->start); -+ netdev_err(bgmac->net_dev, "Found poisoned packet at slot %d, DMA issue!\n", -+ ring->start); - put_page(virt_to_head_page(buf)); - bgmac->net_dev->stats.rx_errors++; - break; - } - - if (len > BGMAC_RX_ALLOC_SIZE) { -- bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n", -- ring->start); -+ netdev_err(bgmac->net_dev, "Found oversized packet at slot %d, DMA issue!\n", -+ ring->start); - put_page(virt_to_head_page(buf)); - bgmac->net_dev->stats.rx_length_errors++; - bgmac->net_dev->stats.rx_errors++; -@@ -490,7 +490,7 @@ static int bgmac_dma_rx_read(struct bgma - - skb = build_skb(buf, BGMAC_RX_ALLOC_SIZE); - if (unlikely(!skb)) { -- bgmac_err(bgmac, "build_skb failed\n"); -+ netdev_err(bgmac->net_dev, "build_skb failed\n"); - put_page(virt_to_head_page(buf)); - bgmac->net_dev->stats.rx_errors++; - break; -@@ -644,7 +644,7 @@ static int bgmac_dma_alloc(struct bgmac - BUILD_BUG_ON(BGMAC_MAX_RX_RINGS > ARRAY_SIZE(ring_base)); - - if (!(bcma_aread32(bgmac->core, BCMA_IOST) & BCMA_IOST_DMA64)) { -- bgmac_err(bgmac, "Core does not report 64-bit DMA\n"); -+ dev_err(bgmac->dev, "Core does not report 64-bit DMA\n"); - return -ENOTSUPP; - } - -@@ -658,8 +658,8 @@ static int bgmac_dma_alloc(struct bgmac - &ring->dma_base, - GFP_KERNEL); - if (!ring->cpu_base) { -- bgmac_err(bgmac, "Allocation of TX ring 0x%X failed\n", -- ring->mmio_base); -+ dev_err(bgmac->dev, "Allocation of TX ring 0x%X failed\n", -+ ring->mmio_base); - goto err_dma_free; - } - -@@ -683,8 +683,8 @@ static int bgmac_dma_alloc(struct bgmac - &ring->dma_base, - GFP_KERNEL); - if (!ring->cpu_base) { -- bgmac_err(bgmac, "Allocation of RX ring 0x%X failed\n", -- ring->mmio_base); -+ dev_err(bgmac->dev, "Allocation of RX ring 0x%X failed\n", -+ ring->mmio_base); - err = -ENOMEM; - goto err_dma_free; - } -@@ -803,8 +803,8 @@ static u16 bgmac_phy_read(struct bgmac * - bcma_write32(core, phy_access_addr, tmp); - - if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) { -- bgmac_err(bgmac, "Reading PHY %d register 0x%X failed\n", -- phyaddr, reg); -+ dev_err(bgmac->dev, "Reading PHY %d register 0x%X failed\n", -+ phyaddr, reg); - return 0xffff; - } - -@@ -836,7 +836,7 @@ static int bgmac_phy_write(struct bgmac - - bgmac_write(bgmac, BGMAC_INT_STATUS, BGMAC_IS_MDIO); - if (bgmac_read(bgmac, BGMAC_INT_STATUS) & BGMAC_IS_MDIO) -- bgmac_warn(bgmac, "Error setting MDIO int\n"); -+ dev_warn(bgmac->dev, "Error setting MDIO int\n"); - - tmp = BGMAC_PA_START; - tmp |= BGMAC_PA_WRITE; -@@ -846,8 +846,8 @@ static int bgmac_phy_write(struct bgmac - bcma_write32(core, phy_access_addr, tmp); - - if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) { -- bgmac_err(bgmac, "Writing to PHY %d register 0x%X failed\n", -- phyaddr, reg); -+ dev_err(bgmac->dev, "Writing to PHY %d register 0x%X failed\n", -+ phyaddr, reg); - return -ETIMEDOUT; - } - -@@ -900,7 +900,7 @@ static void bgmac_phy_reset(struct bgmac - bgmac_phy_write(bgmac, bgmac->phyaddr, MII_BMCR, BMCR_RESET); - udelay(100); - if (bgmac_phy_read(bgmac, bgmac->phyaddr, MII_BMCR) & BMCR_RESET) -- bgmac_err(bgmac, "PHY reset failed\n"); -+ dev_err(bgmac->dev, "PHY reset failed\n"); - bgmac_phy_init(bgmac); - } - -@@ -1001,7 +1001,8 @@ static void bgmac_mac_speed(struct bgmac - set |= BGMAC_CMDCFG_ES_2500; - break; - default: -- bgmac_err(bgmac, "Unsupported speed: %d\n", bgmac->mac_speed); -+ dev_err(bgmac->dev, "Unsupported speed: %d\n", -+ bgmac->mac_speed); - } - - if (bgmac->mac_duplex == DUPLEX_HALF) -@@ -1100,8 +1101,8 @@ static void bgmac_chip_reset(struct bgma - - if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) { - if (kstrtou8(buf, 0, &et_swtype)) -- bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n", -- buf); -+ dev_err(bgmac->dev, "Failed to parse et_swtype (%s)\n", -+ buf); - et_swtype &= 0x0f; - et_swtype <<= 4; - sw_type = et_swtype; -@@ -1264,7 +1265,7 @@ static irqreturn_t bgmac_interrupt(int i - - int_status &= ~(BGMAC_IS_TX0 | BGMAC_IS_RX); - if (int_status) -- bgmac_err(bgmac, "Unknown IRQs: 0x%08X\n", int_status); -+ dev_err(bgmac->dev, "Unknown IRQs: 0x%08X\n", int_status); - - /* Disable new interrupts until handling existing ones */ - bgmac_chip_intrs_off(bgmac); -@@ -1318,7 +1319,7 @@ static int bgmac_open(struct net_device - err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED, - KBUILD_MODNAME, net_dev); - if (err < 0) { -- bgmac_err(bgmac, "IRQ request error: %d!\n", err); -+ dev_err(bgmac->dev, "IRQ request error: %d!\n", err); - bgmac_dma_cleanup(bgmac); - return err; - } -@@ -1599,14 +1600,14 @@ static int bgmac_fixed_phy_register(stru - - phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, -1, NULL); - if (!phy_dev || IS_ERR(phy_dev)) { -- bgmac_err(bgmac, "Failed to register fixed PHY device\n"); -+ dev_err(bgmac->dev, "Failed to register fixed PHY device\n"); - return -ENODEV; - } - - err = phy_connect_direct(bgmac->net_dev, phy_dev, bgmac_adjust_link, - PHY_INTERFACE_MODE_MII); - if (err) { -- bgmac_err(bgmac, "Connecting PHY failed\n"); -+ dev_err(bgmac->dev, "Connecting PHY failed\n"); - return err; - } - -@@ -1646,7 +1647,7 @@ static int bgmac_mii_register(struct bgm - - err = mdiobus_register(mii_bus); - if (err) { -- bgmac_err(bgmac, "Registration of mii bus failed\n"); -+ dev_err(bgmac->dev, "Registration of mii bus failed\n"); - goto err_free_irq; - } - -@@ -1658,7 +1659,7 @@ static int bgmac_mii_register(struct bgm - phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link, - PHY_INTERFACE_MODE_MII); - if (IS_ERR(phy_dev)) { -- bgmac_err(bgmac, "PHY connecton failed\n"); -+ dev_err(bgmac->dev, "PHY connecton failed\n"); - err = PTR_ERR(phy_dev); - goto err_unregister_bus; - } -@@ -1707,7 +1708,8 @@ static int bgmac_probe(struct bcma_devic - mac = sprom->et2mac; - break; - default: -- pr_err("Unsupported core_unit %d\n", core->core_unit); -+ dev_err(&core->dev, "Unsupported core_unit %d\n", -+ core->core_unit); - return -ENOTSUPP; - } - -@@ -1730,6 +1732,7 @@ static int bgmac_probe(struct bcma_devic - net_dev->irq = core->irq; - net_dev->ethtool_ops = &bgmac_ethtool_ops; - bgmac = netdev_priv(net_dev); -+ bgmac->dev = &core->dev; - bgmac->net_dev = net_dev; - bgmac->core = core; - bcma_set_drvdata(core, bgmac); -@@ -1741,7 +1744,7 @@ static int bgmac_probe(struct bcma_devic - /* On BCM4706 we need common core to access PHY */ - if (core->id.id == BCMA_CORE_4706_MAC_GBIT && - !core->bus->drv_gmac_cmn.core) { -- bgmac_err(bgmac, "GMAC CMN core not found (required for BCM4706)\n"); -+ dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n"); - err = -ENODEV; - goto err_netdev_free; - } -@@ -1760,15 +1763,15 @@ static int bgmac_probe(struct bcma_devic - } - bgmac->phyaddr &= BGMAC_PHY_MASK; - if (bgmac->phyaddr == BGMAC_PHY_MASK) { -- bgmac_err(bgmac, "No PHY found\n"); -+ dev_err(bgmac->dev, "No PHY found\n"); - err = -ENODEV; - goto err_netdev_free; - } -- bgmac_info(bgmac, "Found PHY addr: %d%s\n", bgmac->phyaddr, -- bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : ""); -+ dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr, -+ bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : ""); - - if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) { -- bgmac_err(bgmac, "PCI setup not implemented\n"); -+ dev_err(bgmac->dev, "PCI setup not implemented\n"); - err = -ENOTSUPP; - goto err_netdev_free; - } -@@ -1797,7 +1800,7 @@ static int bgmac_probe(struct bcma_devic - - err = bgmac_dma_alloc(bgmac); - if (err) { -- bgmac_err(bgmac, "Unable to alloc memory for DMA\n"); -+ dev_err(bgmac->dev, "Unable to alloc memory for DMA\n"); - goto err_netdev_free; - } - -@@ -1811,16 +1814,16 @@ static int bgmac_probe(struct bcma_devic - bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo & - BGMAC_BFL_ENETROBO); - if (bgmac->has_robosw) -- bgmac_warn(bgmac, "Support for Roboswitch not implemented\n"); -+ dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n"); - - if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) -- bgmac_warn(bgmac, "Support for ADMtek ethernet switch not implemented\n"); -+ dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n"); - - netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); - - err = bgmac_mii_register(bgmac); - if (err) { -- bgmac_err(bgmac, "Cannot register MDIO\n"); -+ dev_err(bgmac->dev, "Cannot connect to phy\n"); - goto err_dma_free; - } - -@@ -1830,7 +1833,7 @@ static int bgmac_probe(struct bcma_devic - - err = register_netdev(bgmac->net_dev); - if (err) { -- bgmac_err(bgmac, "Cannot register net device\n"); -+ dev_err(bgmac->dev, "Cannot register net device\n"); - goto err_mii_unregister; - } - ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -1,17 +1,6 @@ - #ifndef _BGMAC_H - #define _BGMAC_H - --#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -- --#define bgmac_err(bgmac, fmt, ...) \ -- dev_err(&(bgmac)->core->dev, fmt, ##__VA_ARGS__) --#define bgmac_warn(bgmac, fmt, ...) \ -- dev_warn(&(bgmac)->core->dev, fmt, ##__VA_ARGS__) --#define bgmac_info(bgmac, fmt, ...) \ -- dev_info(&(bgmac)->core->dev, fmt, ##__VA_ARGS__) --#define bgmac_dbg(bgmac, fmt, ...) \ -- dev_dbg(&(bgmac)->core->dev, fmt, ##__VA_ARGS__) -- - #include - #include - #include -@@ -438,6 +427,8 @@ struct bgmac_rx_header { - struct bgmac { - struct bcma_device *core; - struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */ -+ -+ struct device *dev; - struct net_device *net_dev; - struct napi_struct napi; - struct mii_bus *mii_bus; -@@ -489,5 +480,4 @@ static inline void bgmac_set(struct bgma - { - bgmac_maskset(bgmac, offset, ~0, set); - } -- - #endif /* _BGMAC_H */ diff --git a/target/linux/generic/pending-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch b/target/linux/generic/pending-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch deleted file mode 100644 index dd5b8772e..000000000 --- a/target/linux/generic/pending-4.4/071-v4.8-0002-net-ethernet-bgmac-add-dma_dev-pointer.patch +++ /dev/null @@ -1,112 +0,0 @@ -From a0b68486f6f680c7c0352a47c60042d7d95ffd87 Mon Sep 17 00:00:00 2001 -From: Jon Mason -Date: Thu, 7 Jul 2016 19:08:54 -0400 -Subject: [PATCH 2/5] net: ethernet: bgmac: add dma_dev pointer - -The dma buffer allocation, etc references a dma_dev device pointer from -the bcma core. In anticipation of removing the bcma requirement for -this driver, these must be changed to not reference that struct. Add a -dma_dev device pointer to the bgmac stuct and reference that instead. - -Signed-off-by: Jon Mason -Acked-by: Arnd Bergmann -Reviewed-by: Florian Fainelli -Tested-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 17 +++++++++-------- - drivers/net/ethernet/broadcom/bgmac.h | 1 + - 2 files changed, 10 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -152,7 +152,7 @@ static netdev_tx_t bgmac_dma_tx_add(stru - struct bgmac_dma_ring *ring, - struct sk_buff *skb) - { -- struct device *dma_dev = bgmac->core->dma_dev; -+ struct device *dma_dev = bgmac->dma_dev; - struct net_device *net_dev = bgmac->net_dev; - int index = ring->end % BGMAC_TX_RING_SLOTS; - struct bgmac_slot_info *slot = &ring->slots[index]; -@@ -254,7 +254,7 @@ err_drop: - /* Free transmitted packets */ - static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) - { -- struct device *dma_dev = bgmac->core->dma_dev; -+ struct device *dma_dev = bgmac->dma_dev; - int empty_slot; - bool freed = false; - unsigned bytes_compl = 0, pkts_compl = 0; -@@ -355,7 +355,7 @@ static void bgmac_dma_rx_enable(struct b - static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac, - struct bgmac_slot_info *slot) - { -- struct device *dma_dev = bgmac->core->dma_dev; -+ struct device *dma_dev = bgmac->dma_dev; - dma_addr_t dma_addr; - struct bgmac_rx_header *rx; - void *buf; -@@ -444,7 +444,7 @@ static int bgmac_dma_rx_read(struct bgma - end_slot /= sizeof(struct bgmac_dma_desc); - - while (ring->start != end_slot) { -- struct device *dma_dev = bgmac->core->dma_dev; -+ struct device *dma_dev = bgmac->dma_dev; - struct bgmac_slot_info *slot = &ring->slots[ring->start]; - struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; - struct sk_buff *skb; -@@ -547,7 +547,7 @@ static bool bgmac_dma_unaligned(struct b - static void bgmac_dma_tx_ring_free(struct bgmac *bgmac, - struct bgmac_dma_ring *ring) - { -- struct device *dma_dev = bgmac->core->dma_dev; -+ struct device *dma_dev = bgmac->dma_dev; - struct bgmac_dma_desc *dma_desc = ring->cpu_base; - struct bgmac_slot_info *slot; - int i; -@@ -573,7 +573,7 @@ static void bgmac_dma_tx_ring_free(struc - static void bgmac_dma_rx_ring_free(struct bgmac *bgmac, - struct bgmac_dma_ring *ring) - { -- struct device *dma_dev = bgmac->core->dma_dev; -+ struct device *dma_dev = bgmac->dma_dev; - struct bgmac_slot_info *slot; - int i; - -@@ -594,7 +594,7 @@ static void bgmac_dma_ring_desc_free(str - struct bgmac_dma_ring *ring, - int num_slots) - { -- struct device *dma_dev = bgmac->core->dma_dev; -+ struct device *dma_dev = bgmac->dma_dev; - int size; - - if (!ring->cpu_base) -@@ -632,7 +632,7 @@ static void bgmac_dma_free(struct bgmac - - static int bgmac_dma_alloc(struct bgmac *bgmac) - { -- struct device *dma_dev = bgmac->core->dma_dev; -+ struct device *dma_dev = bgmac->dma_dev; - struct bgmac_dma_ring *ring; - static const u16 ring_base[] = { BGMAC_DMA_BASE0, BGMAC_DMA_BASE1, - BGMAC_DMA_BASE2, BGMAC_DMA_BASE3, }; -@@ -1733,6 +1733,7 @@ static int bgmac_probe(struct bcma_devic - net_dev->ethtool_ops = &bgmac_ethtool_ops; - bgmac = netdev_priv(net_dev); - bgmac->dev = &core->dev; -+ bgmac->dma_dev = core->dma_dev; - bgmac->net_dev = net_dev; - bgmac->core = core; - bcma_set_drvdata(core, bgmac); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -429,6 +429,7 @@ struct bgmac { - struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */ - - struct device *dev; -+ struct device *dma_dev; - struct net_device *net_dev; - struct napi_struct napi; - struct mii_bus *mii_bus; diff --git a/target/linux/generic/pending-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch b/target/linux/generic/pending-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch deleted file mode 100644 index bc7b246cc..000000000 --- a/target/linux/generic/pending-4.4/071-v4.8-0003-net-ethernet-bgmac-move-BCMA-MDIO-Phy-code-into-a-se.patch +++ /dev/null @@ -1,676 +0,0 @@ -From 55954f3bfdacc5908515b0c306cea23e77fab740 Mon Sep 17 00:00:00 2001 -From: Jon Mason -Date: Thu, 7 Jul 2016 19:08:55 -0400 -Subject: [PATCH 3/5] net: ethernet: bgmac: move BCMA MDIO Phy code into a - separate file - -Move the BCMA MDIO phy into a separate file, as it is very tightly -coupled with the BCMA bus. This will help with the upcoming BCMA -removal from the bgmac driver. Optimally, this should be moved into -phy drivers, but it is too tightly coupled with the bgmac driver to -effectively move it without more changes to the driver. - -Note: the phy_reset was intentionally removed, as the mdio phy subsystem -automatically resets the phy if a reset function pointer is present. In -addition to the moving of the driver, this reset function is added. - -Signed-off-by: Jon Mason -Acked-by: Arnd Bergmann -Reviewed-by: Florian Fainelli -Tested-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/Makefile | 2 +- - drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 264 ++++++++++++++++++++++++ - drivers/net/ethernet/broadcom/bgmac.c | 246 +++------------------- - drivers/net/ethernet/broadcom/bgmac.h | 3 + - 4 files changed, 298 insertions(+), 217 deletions(-) - create mode 100644 drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c - ---- a/drivers/net/ethernet/broadcom/Makefile -+++ b/drivers/net/ethernet/broadcom/Makefile -@@ -10,6 +10,6 @@ obj-$(CONFIG_CNIC) += cnic.o - obj-$(CONFIG_BNX2X) += bnx2x/ - obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o - obj-$(CONFIG_TIGON3) += tg3.o --obj-$(CONFIG_BGMAC) += bgmac.o -+obj-$(CONFIG_BGMAC) += bgmac.o bgmac-bcma-mdio.o - obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o - obj-$(CONFIG_BNXT) += bnxt/ ---- /dev/null -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -@@ -0,0 +1,275 @@ -+/* -+ * Driver for (BCM4706)? GBit MAC core on BCMA bus. -+ * -+ * Copyright (C) 2012 Rafał Miłecki -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include -+#include -+#include "bgmac.h" -+ -+struct bcma_mdio { -+ struct bcma_device *core; -+ u8 phyaddr; -+}; -+ -+static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask, -+ u32 value, int timeout) -+{ -+ u32 val; -+ int i; -+ -+ for (i = 0; i < timeout / 10; i++) { -+ val = bcma_read32(core, reg); -+ if ((val & mask) == value) -+ return true; -+ udelay(10); -+ } -+ dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg); -+ return false; -+} -+ -+/************************************************** -+ * PHY ops -+ **************************************************/ -+ -+static u16 bcma_mdio_phy_read(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg) -+{ -+ struct bcma_device *core; -+ u16 phy_access_addr; -+ u16 phy_ctl_addr; -+ u32 tmp; -+ -+ BUILD_BUG_ON(BGMAC_PA_DATA_MASK != BCMA_GMAC_CMN_PA_DATA_MASK); -+ BUILD_BUG_ON(BGMAC_PA_ADDR_MASK != BCMA_GMAC_CMN_PA_ADDR_MASK); -+ BUILD_BUG_ON(BGMAC_PA_ADDR_SHIFT != BCMA_GMAC_CMN_PA_ADDR_SHIFT); -+ BUILD_BUG_ON(BGMAC_PA_REG_MASK != BCMA_GMAC_CMN_PA_REG_MASK); -+ BUILD_BUG_ON(BGMAC_PA_REG_SHIFT != BCMA_GMAC_CMN_PA_REG_SHIFT); -+ BUILD_BUG_ON(BGMAC_PA_WRITE != BCMA_GMAC_CMN_PA_WRITE); -+ BUILD_BUG_ON(BGMAC_PA_START != BCMA_GMAC_CMN_PA_START); -+ BUILD_BUG_ON(BGMAC_PC_EPA_MASK != BCMA_GMAC_CMN_PC_EPA_MASK); -+ BUILD_BUG_ON(BGMAC_PC_MCT_MASK != BCMA_GMAC_CMN_PC_MCT_MASK); -+ BUILD_BUG_ON(BGMAC_PC_MCT_SHIFT != BCMA_GMAC_CMN_PC_MCT_SHIFT); -+ BUILD_BUG_ON(BGMAC_PC_MTE != BCMA_GMAC_CMN_PC_MTE); -+ -+ if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) { -+ core = bcma_mdio->core->bus->drv_gmac_cmn.core; -+ phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS; -+ phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL; -+ } else { -+ core = bcma_mdio->core; -+ phy_access_addr = BGMAC_PHY_ACCESS; -+ phy_ctl_addr = BGMAC_PHY_CNTL; -+ } -+ -+ tmp = bcma_read32(core, phy_ctl_addr); -+ tmp &= ~BGMAC_PC_EPA_MASK; -+ tmp |= phyaddr; -+ bcma_write32(core, phy_ctl_addr, tmp); -+ -+ tmp = BGMAC_PA_START; -+ tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT; -+ tmp |= reg << BGMAC_PA_REG_SHIFT; -+ bcma_write32(core, phy_access_addr, tmp); -+ -+ if (!bcma_mdio_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, -+ 1000)) { -+ dev_err(&core->dev, "Reading PHY %d register 0x%X failed\n", -+ phyaddr, reg); -+ return 0xffff; -+ } -+ -+ return bcma_read32(core, phy_access_addr) & BGMAC_PA_DATA_MASK; -+} -+ -+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */ -+static int bcma_mdio_phy_write(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg, -+ u16 value) -+{ -+ struct bcma_device *core; -+ u16 phy_access_addr; -+ u16 phy_ctl_addr; -+ u32 tmp; -+ -+ if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) { -+ core = bcma_mdio->core->bus->drv_gmac_cmn.core; -+ phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS; -+ phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL; -+ } else { -+ core = bcma_mdio->core; -+ phy_access_addr = BGMAC_PHY_ACCESS; -+ phy_ctl_addr = BGMAC_PHY_CNTL; -+ } -+ -+ tmp = bcma_read32(core, phy_ctl_addr); -+ tmp &= ~BGMAC_PC_EPA_MASK; -+ tmp |= phyaddr; -+ bcma_write32(core, phy_ctl_addr, tmp); -+ -+ bcma_write32(bcma_mdio->core, BGMAC_INT_STATUS, BGMAC_IS_MDIO); -+ if (bcma_read32(bcma_mdio->core, BGMAC_INT_STATUS) & BGMAC_IS_MDIO) -+ dev_warn(&core->dev, "Error setting MDIO int\n"); -+ -+ tmp = BGMAC_PA_START; -+ tmp |= BGMAC_PA_WRITE; -+ tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT; -+ tmp |= reg << BGMAC_PA_REG_SHIFT; -+ tmp |= value; -+ bcma_write32(core, phy_access_addr, tmp); -+ -+ if (!bcma_mdio_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, -+ 1000)) { -+ dev_err(&core->dev, "Writing to PHY %d register 0x%X failed\n", -+ phyaddr, reg); -+ return -ETIMEDOUT; -+ } -+ -+ return 0; -+} -+ -+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyinit */ -+static void bcma_mdio_phy_init(struct bcma_mdio *bcma_mdio) -+{ -+ struct bcma_chipinfo *ci = &bcma_mdio->core->bus->chipinfo; -+ u8 i; -+ -+ if (ci->id == BCMA_CHIP_ID_BCM5356) { -+ for (i = 0; i < 5; i++) { -+ bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x008b); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x15, 0x0100); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x12, 0x2aaa); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -+ } -+ } -+ if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) || -+ (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) || -+ (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg != 9)) { -+ struct bcma_drv_cc *cc = &bcma_mdio->core->bus->drv_cc; -+ -+ bcma_chipco_chipctl_maskset(cc, 2, ~0xc0000000, 0); -+ bcma_chipco_chipctl_maskset(cc, 4, ~0x80000000, 0); -+ for (i = 0; i < 5; i++) { -+ bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5284); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x0010); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5296); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x1073); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9073); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x52b6); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9273); -+ bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -+ } -+ } -+} -+ -+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */ -+static int bcma_mdio_phy_reset(struct mii_bus *bus) -+{ -+ struct bcma_mdio *bcma_mdio = bus->priv; -+ u8 phyaddr = bcma_mdio->phyaddr; -+ -+ if (bcma_mdio->phyaddr == BGMAC_PHY_NOREGS) -+ return 0; -+ -+ bcma_mdio_phy_write(bcma_mdio, phyaddr, MII_BMCR, BMCR_RESET); -+ udelay(100); -+ if (bcma_mdio_phy_read(bcma_mdio, phyaddr, MII_BMCR) & BMCR_RESET) -+ dev_err(&bcma_mdio->core->dev, "PHY reset failed\n"); -+ bcma_mdio_phy_init(bcma_mdio); -+ -+ return 0; -+} -+ -+/************************************************** -+ * MII -+ **************************************************/ -+ -+static int bcma_mdio_mii_read(struct mii_bus *bus, int mii_id, int regnum) -+{ -+ return bcma_mdio_phy_read(bus->priv, mii_id, regnum); -+} -+ -+static int bcma_mdio_mii_write(struct mii_bus *bus, int mii_id, int regnum, -+ u16 value) -+{ -+ return bcma_mdio_phy_write(bus->priv, mii_id, regnum, value); -+} -+ -+struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr) -+{ -+ struct bcma_mdio *bcma_mdio; -+ struct mii_bus *mii_bus; -+ int i, err; -+ -+ bcma_mdio = kzalloc(sizeof(*bcma_mdio), GFP_KERNEL); -+ if (!bcma_mdio) -+ return ERR_PTR(-ENOMEM); -+ -+ mii_bus = mdiobus_alloc(); -+ if (!mii_bus) { -+ err = -ENOMEM; -+ goto err; -+ } -+ -+ mii_bus->name = "bcma_mdio mii bus"; -+ sprintf(mii_bus->id, "%s-%d-%d", "bcma_mdio", core->bus->num, -+ core->core_unit); -+ mii_bus->priv = bcma_mdio; -+ mii_bus->read = bcma_mdio_mii_read; -+ mii_bus->write = bcma_mdio_mii_write; -+ mii_bus->reset = bcma_mdio_phy_reset; -+ mii_bus->parent = &core->dev; -+ mii_bus->phy_mask = ~(1 << phyaddr); -+ -+ mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL); -+ if (!mii_bus->irq) { -+ err = -ENOMEM; -+ goto err_free_bus; -+ } -+ for (i = 0; i < PHY_MAX_ADDR; i++) -+ mii_bus->irq[i] = PHY_POLL; -+ -+ bcma_mdio->core = core; -+ bcma_mdio->phyaddr = phyaddr; -+ -+ err = mdiobus_register(mii_bus); -+ if (err) { -+ dev_err(&core->dev, "Registration of mii bus failed\n"); -+ goto err_free_irq; -+ } -+ -+ return mii_bus; -+ -+err_free_irq: -+ kfree(mii_bus->irq); -+err_free_bus: -+ mdiobus_free(mii_bus); -+err: -+ kfree(bcma_mdio); -+ return ERR_PTR(err); -+} -+ -+void bcma_mdio_mii_unregister(struct mii_bus *mii_bus) -+{ -+ struct bcma_mdio *bcma_mdio; -+ -+ if (!mii_bus) -+ return; -+ -+ bcma_mdio = mii_bus->priv; -+ -+ mdiobus_unregister(mii_bus); -+ kfree(mii_bus->irq); -+ mdiobus_free(mii_bus); -+ kfree(bcma_mdio); -+} -+ -+MODULE_AUTHOR("Rafał Miłecki"); -+MODULE_LICENSE("GPL"); ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -759,150 +759,6 @@ error: - return err; - } - --/************************************************** -- * PHY ops -- **************************************************/ -- --static u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg) --{ -- struct bcma_device *core; -- u16 phy_access_addr; -- u16 phy_ctl_addr; -- u32 tmp; -- -- BUILD_BUG_ON(BGMAC_PA_DATA_MASK != BCMA_GMAC_CMN_PA_DATA_MASK); -- BUILD_BUG_ON(BGMAC_PA_ADDR_MASK != BCMA_GMAC_CMN_PA_ADDR_MASK); -- BUILD_BUG_ON(BGMAC_PA_ADDR_SHIFT != BCMA_GMAC_CMN_PA_ADDR_SHIFT); -- BUILD_BUG_ON(BGMAC_PA_REG_MASK != BCMA_GMAC_CMN_PA_REG_MASK); -- BUILD_BUG_ON(BGMAC_PA_REG_SHIFT != BCMA_GMAC_CMN_PA_REG_SHIFT); -- BUILD_BUG_ON(BGMAC_PA_WRITE != BCMA_GMAC_CMN_PA_WRITE); -- BUILD_BUG_ON(BGMAC_PA_START != BCMA_GMAC_CMN_PA_START); -- BUILD_BUG_ON(BGMAC_PC_EPA_MASK != BCMA_GMAC_CMN_PC_EPA_MASK); -- BUILD_BUG_ON(BGMAC_PC_MCT_MASK != BCMA_GMAC_CMN_PC_MCT_MASK); -- BUILD_BUG_ON(BGMAC_PC_MCT_SHIFT != BCMA_GMAC_CMN_PC_MCT_SHIFT); -- BUILD_BUG_ON(BGMAC_PC_MTE != BCMA_GMAC_CMN_PC_MTE); -- -- if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT) { -- core = bgmac->core->bus->drv_gmac_cmn.core; -- phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS; -- phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL; -- } else { -- core = bgmac->core; -- phy_access_addr = BGMAC_PHY_ACCESS; -- phy_ctl_addr = BGMAC_PHY_CNTL; -- } -- -- tmp = bcma_read32(core, phy_ctl_addr); -- tmp &= ~BGMAC_PC_EPA_MASK; -- tmp |= phyaddr; -- bcma_write32(core, phy_ctl_addr, tmp); -- -- tmp = BGMAC_PA_START; -- tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT; -- tmp |= reg << BGMAC_PA_REG_SHIFT; -- bcma_write32(core, phy_access_addr, tmp); -- -- if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) { -- dev_err(bgmac->dev, "Reading PHY %d register 0x%X failed\n", -- phyaddr, reg); -- return 0xffff; -- } -- -- return bcma_read32(core, phy_access_addr) & BGMAC_PA_DATA_MASK; --} -- --/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */ --static int bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value) --{ -- struct bcma_device *core; -- u16 phy_access_addr; -- u16 phy_ctl_addr; -- u32 tmp; -- -- if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT) { -- core = bgmac->core->bus->drv_gmac_cmn.core; -- phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS; -- phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL; -- } else { -- core = bgmac->core; -- phy_access_addr = BGMAC_PHY_ACCESS; -- phy_ctl_addr = BGMAC_PHY_CNTL; -- } -- -- tmp = bcma_read32(core, phy_ctl_addr); -- tmp &= ~BGMAC_PC_EPA_MASK; -- tmp |= phyaddr; -- bcma_write32(core, phy_ctl_addr, tmp); -- -- bgmac_write(bgmac, BGMAC_INT_STATUS, BGMAC_IS_MDIO); -- if (bgmac_read(bgmac, BGMAC_INT_STATUS) & BGMAC_IS_MDIO) -- dev_warn(bgmac->dev, "Error setting MDIO int\n"); -- -- tmp = BGMAC_PA_START; -- tmp |= BGMAC_PA_WRITE; -- tmp |= phyaddr << BGMAC_PA_ADDR_SHIFT; -- tmp |= reg << BGMAC_PA_REG_SHIFT; -- tmp |= value; -- bcma_write32(core, phy_access_addr, tmp); -- -- if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) { -- dev_err(bgmac->dev, "Writing to PHY %d register 0x%X failed\n", -- phyaddr, reg); -- return -ETIMEDOUT; -- } -- -- return 0; --} -- --/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyinit */ --static void bgmac_phy_init(struct bgmac *bgmac) --{ -- struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo; -- struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc; -- u8 i; -- -- if (ci->id == BCMA_CHIP_ID_BCM5356) { -- for (i = 0; i < 5; i++) { -- bgmac_phy_write(bgmac, i, 0x1f, 0x008b); -- bgmac_phy_write(bgmac, i, 0x15, 0x0100); -- bgmac_phy_write(bgmac, i, 0x1f, 0x000f); -- bgmac_phy_write(bgmac, i, 0x12, 0x2aaa); -- bgmac_phy_write(bgmac, i, 0x1f, 0x000b); -- } -- } -- if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) || -- (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) || -- (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg != 9)) { -- bcma_chipco_chipctl_maskset(cc, 2, ~0xc0000000, 0); -- bcma_chipco_chipctl_maskset(cc, 4, ~0x80000000, 0); -- for (i = 0; i < 5; i++) { -- bgmac_phy_write(bgmac, i, 0x1f, 0x000f); -- bgmac_phy_write(bgmac, i, 0x16, 0x5284); -- bgmac_phy_write(bgmac, i, 0x1f, 0x000b); -- bgmac_phy_write(bgmac, i, 0x17, 0x0010); -- bgmac_phy_write(bgmac, i, 0x1f, 0x000f); -- bgmac_phy_write(bgmac, i, 0x16, 0x5296); -- bgmac_phy_write(bgmac, i, 0x17, 0x1073); -- bgmac_phy_write(bgmac, i, 0x17, 0x9073); -- bgmac_phy_write(bgmac, i, 0x16, 0x52b6); -- bgmac_phy_write(bgmac, i, 0x17, 0x9273); -- bgmac_phy_write(bgmac, i, 0x1f, 0x000b); -- } -- } --} -- --/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */ --static void bgmac_phy_reset(struct bgmac *bgmac) --{ -- if (bgmac->phyaddr == BGMAC_PHY_NOREGS) -- return; -- -- bgmac_phy_write(bgmac, bgmac->phyaddr, MII_BMCR, BMCR_RESET); -- udelay(100); -- if (bgmac_phy_read(bgmac, bgmac->phyaddr, MII_BMCR) & BMCR_RESET) -- dev_err(bgmac->dev, "PHY reset failed\n"); -- bgmac_phy_init(bgmac); --} - - /************************************************** - * Chip ops -@@ -1159,7 +1015,8 @@ static void bgmac_chip_reset(struct bgma - else - bgmac_set(bgmac, BGMAC_PHY_CNTL, BGMAC_PC_MTE); - bgmac_miiconfig(bgmac); -- bgmac_phy_init(bgmac); -+ if (bgmac->mii_bus) -+ bgmac->mii_bus->reset(bgmac->mii_bus); - - netdev_reset_queue(bgmac->net_dev); - } -@@ -1553,17 +1410,6 @@ static const struct ethtool_ops bgmac_et - * MII - **************************************************/ - --static int bgmac_mii_read(struct mii_bus *bus, int mii_id, int regnum) --{ -- return bgmac_phy_read(bus->priv, mii_id, regnum); --} -- --static int bgmac_mii_write(struct mii_bus *bus, int mii_id, int regnum, -- u16 value) --{ -- return bgmac_phy_write(bus->priv, mii_id, regnum, value); --} -- - static void bgmac_adjust_link(struct net_device *net_dev) - { - struct bgmac *bgmac = netdev_priv(net_dev); -@@ -1588,7 +1434,7 @@ static void bgmac_adjust_link(struct net - } - } - --static int bgmac_fixed_phy_register(struct bgmac *bgmac) -+static int bgmac_phy_connect_direct(struct bgmac *bgmac) - { - struct fixed_phy_status fphy_status = { - .link = 1, -@@ -1614,81 +1460,24 @@ static int bgmac_fixed_phy_register(stru - return err; - } - --static int bgmac_mii_register(struct bgmac *bgmac) -+static int bgmac_phy_connect(struct bgmac *bgmac) - { -- struct mii_bus *mii_bus; - struct phy_device *phy_dev; - char bus_id[MII_BUS_ID_SIZE + 3]; -- int i, err = 0; -- -- if (bgmac_is_bcm4707_family(bgmac)) -- return bgmac_fixed_phy_register(bgmac); -- -- mii_bus = mdiobus_alloc(); -- if (!mii_bus) -- return -ENOMEM; -- -- mii_bus->name = "bgmac mii bus"; -- sprintf(mii_bus->id, "%s-%d-%d", "bgmac", bgmac->core->bus->num, -- bgmac->core->core_unit); -- mii_bus->priv = bgmac; -- mii_bus->read = bgmac_mii_read; -- mii_bus->write = bgmac_mii_write; -- mii_bus->parent = &bgmac->core->dev; -- mii_bus->phy_mask = ~(1 << bgmac->phyaddr); -- -- mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL); -- if (!mii_bus->irq) { -- err = -ENOMEM; -- goto err_free_bus; -- } -- for (i = 0; i < PHY_MAX_ADDR; i++) -- mii_bus->irq[i] = PHY_POLL; -- -- err = mdiobus_register(mii_bus); -- if (err) { -- dev_err(bgmac->dev, "Registration of mii bus failed\n"); -- goto err_free_irq; -- } -- -- bgmac->mii_bus = mii_bus; - - /* Connect to the PHY */ -- snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, mii_bus->id, -+ snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id, - bgmac->phyaddr); - phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link, - PHY_INTERFACE_MODE_MII); - if (IS_ERR(phy_dev)) { - dev_err(bgmac->dev, "PHY connecton failed\n"); -- err = PTR_ERR(phy_dev); -- goto err_unregister_bus; -+ return PTR_ERR(phy_dev); - } - -- return err; -- --err_unregister_bus: -- mdiobus_unregister(mii_bus); --err_free_irq: -- kfree(mii_bus->irq); --err_free_bus: -- mdiobus_free(mii_bus); -- return err; --} -- --static void bgmac_mii_unregister(struct bgmac *bgmac) --{ -- struct mii_bus *mii_bus = bgmac->mii_bus; -- -- mdiobus_unregister(mii_bus); -- kfree(mii_bus->irq); -- mdiobus_free(mii_bus); -+ return 0; - } - --/************************************************** -- * BCMA bus ops -- **************************************************/ -- --/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */ - static int bgmac_probe(struct bcma_device *core) - { - struct net_device *net_dev; -@@ -1809,9 +1598,6 @@ static int bgmac_probe(struct bcma_devic - if (bcm47xx_nvram_getenv("et0_no_txint", NULL, 0) == 0) - bgmac->int_mask &= ~BGMAC_IS_TX_MASK; - -- /* TODO: reset the external phy. Specs are needed */ -- bgmac_phy_reset(bgmac); -- - bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo & - BGMAC_BFL_ENETROBO); - if (bgmac->has_robosw) -@@ -1822,10 +1608,25 @@ static int bgmac_probe(struct bcma_devic - - netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); - -- err = bgmac_mii_register(bgmac); -+ if (!bgmac_is_bcm4707_family(bgmac)) { -+ struct mii_bus *mii_bus; -+ -+ mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); -+ if (!IS_ERR(mii_bus)) { -+ err = PTR_ERR(mii_bus); -+ goto err_dma_free; -+ } -+ -+ bgmac->mii_bus = mii_bus; -+ } -+ -+ if (!bgmac->mii_bus) -+ err = bgmac_phy_connect_direct(bgmac); -+ else -+ err = bgmac_phy_connect(bgmac); - if (err) { - dev_err(bgmac->dev, "Cannot connect to phy\n"); -- goto err_dma_free; -+ goto err_mii_unregister; - } - - net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; -@@ -1835,18 +1636,19 @@ static int bgmac_probe(struct bcma_devic - err = register_netdev(bgmac->net_dev); - if (err) { - dev_err(bgmac->dev, "Cannot register net device\n"); -- goto err_mii_unregister; -+ goto err_phy_disconnect; - } - - netif_carrier_off(net_dev); - - return 0; - -+err_phy_disconnect: -+ phy_disconnect(net_dev->phydev); - err_mii_unregister: -- bgmac_mii_unregister(bgmac); -+ bcma_mdio_mii_unregister(bgmac->mii_bus); - err_dma_free: - bgmac_dma_free(bgmac); -- - err_netdev_free: - bcma_set_drvdata(core, NULL); - free_netdev(net_dev); -@@ -1859,7 +1661,8 @@ static void bgmac_remove(struct bcma_dev - struct bgmac *bgmac = bcma_get_drvdata(core); - - unregister_netdev(bgmac->net_dev); -- bgmac_mii_unregister(bgmac); -+ phy_disconnect(bgmac->net_dev->phydev); -+ bcma_mdio_mii_unregister(bgmac->mii_bus); - netif_napi_del(&bgmac->napi); - bgmac_dma_free(bgmac); - bcma_set_drvdata(core, NULL); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -456,6 +456,9 @@ struct bgmac { - bool loopback; - }; - -+struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr); -+void bcma_mdio_mii_unregister(struct mii_bus *mii_bus); -+ - static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset) - { - return bcma_read32(bgmac->core, offset); diff --git a/target/linux/generic/pending-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch b/target/linux/generic/pending-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch deleted file mode 100644 index 0f627919d..000000000 --- a/target/linux/generic/pending-4.4/071-v4.8-0004-net-ethernet-bgmac-convert-to-feature-flags.patch +++ /dev/null @@ -1,384 +0,0 @@ -From db791eb2970bad193b1dc95a4461b222dd22cb64 Mon Sep 17 00:00:00 2001 -From: Jon Mason -Date: Thu, 7 Jul 2016 19:08:56 -0400 -Subject: [PATCH 4/5] net: ethernet: bgmac: convert to feature flags - -The bgmac driver is using the bcma provides device ID and revision, as -well as the SoC ID and package, to determine which features are -necessary to enable, reset, etc in the driver. In anticipation of -removing the bcma requirement for this driver, these must be changed to -not reference that struct. In place of that, each "feature" has been -given a flag, and the flags are enabled for their respective device and -SoC. - -Signed-off-by: Jon Mason -Acked-by: Arnd Bergmann -Reviewed-by: Florian Fainelli -Tested-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 167 ++++++++++++++++++++++++---------- - drivers/net/ethernet/broadcom/bgmac.h | 21 ++++- - 2 files changed, 140 insertions(+), 48 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -109,7 +109,7 @@ static void bgmac_dma_tx_enable(struct b - u32 ctl; - - ctl = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL); -- if (bgmac->core->id.rev >= 4) { -+ if (bgmac->feature_flags & BGMAC_FEAT_TX_MASK_SETUP) { - ctl &= ~BGMAC_DMA_TX_BL_MASK; - ctl |= BGMAC_DMA_TX_BL_128 << BGMAC_DMA_TX_BL_SHIFT; - -@@ -335,7 +335,7 @@ static void bgmac_dma_rx_enable(struct b - /* preserve ONLY bits 16-17 from current hardware value */ - ctl &= BGMAC_DMA_RX_ADDREXT_MASK; - -- if (bgmac->core->id.rev >= 4) { -+ if (bgmac->feature_flags & BGMAC_FEAT_RX_MASK_SETUP) { - ctl &= ~BGMAC_DMA_RX_BL_MASK; - ctl |= BGMAC_DMA_RX_BL_128 << BGMAC_DMA_RX_BL_SHIFT; - -@@ -772,14 +772,20 @@ static void bgmac_cmdcfg_maskset(struct - { - u32 cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG); - u32 new_val = (cmdcfg & mask) | set; -+ u32 cmdcfg_sr; - -- bgmac_set(bgmac, BGMAC_CMDCFG, BGMAC_CMDCFG_SR(bgmac->core->id.rev)); -+ if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4) -+ cmdcfg_sr = BGMAC_CMDCFG_SR_REV4; -+ else -+ cmdcfg_sr = BGMAC_CMDCFG_SR_REV0; -+ -+ bgmac_set(bgmac, BGMAC_CMDCFG, cmdcfg_sr); - udelay(2); - - if (new_val != cmdcfg || force) - bgmac_write(bgmac, BGMAC_CMDCFG, new_val); - -- bgmac_mask(bgmac, BGMAC_CMDCFG, ~BGMAC_CMDCFG_SR(bgmac->core->id.rev)); -+ bgmac_mask(bgmac, BGMAC_CMDCFG, ~cmdcfg_sr); - udelay(2); - } - -@@ -808,7 +814,7 @@ static void bgmac_chip_stats_update(stru - { - int i; - -- if (bgmac->core->id.id != BCMA_CORE_4706_MAC_GBIT) { -+ if (!(bgmac->feature_flags & BGMAC_FEAT_NO_CLR_MIB)) { - for (i = 0; i < BGMAC_NUM_MIB_TX_REGS; i++) - bgmac->mib_tx_regs[i] = - bgmac_read(bgmac, -@@ -827,7 +833,7 @@ static void bgmac_clear_mib(struct bgmac - { - int i; - -- if (bgmac->core->id.id == BCMA_CORE_4706_MAC_GBIT) -+ if (bgmac->feature_flags & BGMAC_FEAT_NO_CLR_MIB) - return; - - bgmac_set(bgmac, BGMAC_DEV_CTL, BGMAC_DC_MROR); -@@ -870,9 +876,8 @@ static void bgmac_mac_speed(struct bgmac - static void bgmac_miiconfig(struct bgmac *bgmac) - { - struct bcma_device *core = bgmac->core; -- u8 imode; - -- if (bgmac_is_bcm4707_family(bgmac)) { -+ if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) { - bcma_awrite32(core, BCMA_IOCTL, - bcma_aread32(core, BCMA_IOCTL) | 0x40 | - BGMAC_BCMA_IOCTL_SW_CLKEN); -@@ -880,6 +885,8 @@ static void bgmac_miiconfig(struct bgmac - bgmac->mac_duplex = DUPLEX_FULL; - bgmac_mac_speed(bgmac); - } else { -+ u8 imode; -+ - imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & - BGMAC_DS_MM_MASK) >> BGMAC_DS_MM_SHIFT; - if (imode == 0 || imode == 1) { -@@ -894,9 +901,7 @@ static void bgmac_miiconfig(struct bgmac - static void bgmac_chip_reset(struct bgmac *bgmac) - { - struct bcma_device *core = bgmac->core; -- struct bcma_bus *bus = core->bus; -- struct bcma_chipinfo *ci = &bus->chipinfo; -- u32 flags; -+ u32 cmdcfg_sr; - u32 iost; - int i; - -@@ -919,15 +924,12 @@ static void bgmac_chip_reset(struct bgma - } - - iost = bcma_aread32(core, BCMA_IOST); -- if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) || -- (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg == 10) || -- (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188)) -+ if (bgmac->feature_flags & BGMAC_FEAT_IOST_ATTACHED) - iost &= ~BGMAC_BCMA_IOST_ATTACHED; - - /* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */ -- if (ci->id != BCMA_CHIP_ID_BCM4707 && -- ci->id != BCMA_CHIP_ID_BCM47094) { -- flags = 0; -+ if (!(bgmac->feature_flags & BGMAC_FEAT_NO_RESET)) { -+ u32 flags = 0; - if (iost & BGMAC_BCMA_IOST_ATTACHED) { - flags = BGMAC_BCMA_IOCTL_SW_CLKEN; - if (!bgmac->has_robosw) -@@ -937,7 +939,7 @@ static void bgmac_chip_reset(struct bgma - } - - /* Request Misc PLL for corerev > 2 */ -- if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) { -+ if (bgmac->feature_flags & BGMAC_FEAT_MISC_PLL_REQ) { - bgmac_set(bgmac, BCMA_CLKCTLST, - BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ); - bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, -@@ -946,9 +948,7 @@ static void bgmac_chip_reset(struct bgma - 1000); - } - -- if (ci->id == BCMA_CHIP_ID_BCM5357 || -- ci->id == BCMA_CHIP_ID_BCM4749 || -- ci->id == BCMA_CHIP_ID_BCM53572) { -+ if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_PHY) { - struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc; - u8 et_swtype = 0; - u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY | -@@ -962,11 +962,9 @@ static void bgmac_chip_reset(struct bgma - et_swtype &= 0x0f; - et_swtype <<= 4; - sw_type = et_swtype; -- } else if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM5358) { -+ } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_EPHYRMII) { - sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII; -- } else if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) || -- (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg == 10) || -- (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188)) { -+ } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_RGMII) { - sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII | - BGMAC_CHIPCTL_1_SW_TYPE_RGMII; - } -@@ -986,6 +984,11 @@ static void bgmac_chip_reset(struct bgma - * BGMAC_CMDCFG is read _after_ putting chip in a reset. So it has to - * be keps until taking MAC out of the reset. - */ -+ if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4) -+ cmdcfg_sr = BGMAC_CMDCFG_SR_REV4; -+ else -+ cmdcfg_sr = BGMAC_CMDCFG_SR_REV0; -+ - bgmac_cmdcfg_maskset(bgmac, - ~(BGMAC_CMDCFG_TE | - BGMAC_CMDCFG_RE | -@@ -1003,13 +1006,13 @@ static void bgmac_chip_reset(struct bgma - BGMAC_CMDCFG_PROM | - BGMAC_CMDCFG_NLC | - BGMAC_CMDCFG_CFE | -- BGMAC_CMDCFG_SR(core->id.rev), -+ cmdcfg_sr, - false); - bgmac->mac_speed = SPEED_UNKNOWN; - bgmac->mac_duplex = DUPLEX_UNKNOWN; - - bgmac_clear_mib(bgmac); -- if (core->id.id == BCMA_CORE_4706_MAC_GBIT) -+ if (bgmac->feature_flags & BGMAC_FEAT_CMN_PHY_CTL) - bcma_maskset32(bgmac->cmn, BCMA_GMAC_CMN_PHY_CTL, ~0, - BCMA_GMAC_CMN_PC_MTE); - else -@@ -1035,46 +1038,48 @@ static void bgmac_chip_intrs_off(struct - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_enable */ - static void bgmac_enable(struct bgmac *bgmac) - { -- struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo; -+ u32 cmdcfg_sr; - u32 cmdcfg; - u32 mode; -- u32 rxq_ctl; -- u32 fl_ctl; -- u16 bp_clk; -- u8 mdp; -+ -+ if (bgmac->feature_flags & BGMAC_FEAT_CMDCFG_SR_REV4) -+ cmdcfg_sr = BGMAC_CMDCFG_SR_REV4; -+ else -+ cmdcfg_sr = BGMAC_CMDCFG_SR_REV0; - - cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG); - bgmac_cmdcfg_maskset(bgmac, ~(BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE), -- BGMAC_CMDCFG_SR(bgmac->core->id.rev), true); -+ cmdcfg_sr, true); - udelay(2); - cmdcfg |= BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE; - bgmac_write(bgmac, BGMAC_CMDCFG, cmdcfg); - - mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >> - BGMAC_DS_MM_SHIFT; -- if (ci->id != BCMA_CHIP_ID_BCM47162 || mode != 0) -+ if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0) - bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT); -- if (ci->id == BCMA_CHIP_ID_BCM47162 && mode == 2) -+ if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2) - bcma_chipco_chipctl_maskset(&bgmac->core->bus->drv_cc, 1, ~0, - BGMAC_CHIPCTL_1_RXC_DLL_BYPASS); - -- switch (ci->id) { -- case BCMA_CHIP_ID_BCM5357: -- case BCMA_CHIP_ID_BCM4749: -- case BCMA_CHIP_ID_BCM53572: -- case BCMA_CHIP_ID_BCM4716: -- case BCMA_CHIP_ID_BCM47162: -- fl_ctl = 0x03cb04cb; -- if (ci->id == BCMA_CHIP_ID_BCM5357 || -- ci->id == BCMA_CHIP_ID_BCM4749 || -- ci->id == BCMA_CHIP_ID_BCM53572) -+ if (bgmac->feature_flags & (BGMAC_FEAT_FLW_CTRL1 | -+ BGMAC_FEAT_FLW_CTRL2)) { -+ u32 fl_ctl; -+ -+ if (bgmac->feature_flags & BGMAC_FEAT_FLW_CTRL1) - fl_ctl = 0x2300e1; -+ else -+ fl_ctl = 0x03cb04cb; -+ - bgmac_write(bgmac, BGMAC_FLOW_CTL_THRESH, fl_ctl); - bgmac_write(bgmac, BGMAC_PAUSE_CTL, 0x27fff); -- break; - } - -- if (!bgmac_is_bcm4707_family(bgmac)) { -+ if (bgmac->feature_flags & BGMAC_FEAT_SET_RXQ_CLK) { -+ u32 rxq_ctl; -+ u16 bp_clk; -+ u8 mdp; -+ - rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL); - rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK; - bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / -@@ -1606,6 +1611,74 @@ static int bgmac_probe(struct bcma_devic - if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) - dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n"); - -+ /* Feature Flags */ -+ switch (core->bus->chipinfo.id) { -+ case BCMA_CHIP_ID_BCM5357: -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -+ if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) { -+ bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -+ } -+ if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358) -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII; -+ break; -+ case BCMA_CHIP_ID_BCM53572: -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -+ if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) { -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -+ bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -+ } -+ break; -+ case BCMA_CHIP_ID_BCM4749: -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -+ if (core->bus->chipinfo.pkg == 10) { -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -+ bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -+ } -+ break; -+ case BCMA_CHIP_ID_BCM4716: -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ /* fallthrough */ -+ case BCMA_CHIP_ID_BCM47162: -+ bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2; -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ break; -+ /* bcm4707_family */ -+ case BCMA_CHIP_ID_BCM4707: -+ case BCMA_CHIP_ID_BCM47094: -+ case BCMA_CHIP_ID_BCM53018: -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; -+ bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; -+ break; -+ default: -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ } -+ -+ if (!bgmac_is_bcm4707_family(bgmac) && core->id.rev > 2) -+ bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ; -+ -+ if (core->id.id == BCMA_CORE_4706_MAC_GBIT) { -+ bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL; -+ bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB; -+ } -+ -+ if (core->id.rev >= 4) { -+ bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4; -+ bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP; -+ bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP; -+ } -+ - netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); - - if (!bgmac_is_bcm4707_family(bgmac)) { ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -190,7 +190,6 @@ - #define BGMAC_CMDCFG_HD_SHIFT 10 - #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 -@@ -376,6 +375,24 @@ - - #define ETHER_MAX_LEN 1518 - -+/* Feature Flags */ -+#define BGMAC_FEAT_TX_MASK_SETUP BIT(0) -+#define BGMAC_FEAT_RX_MASK_SETUP BIT(1) -+#define BGMAC_FEAT_IOST_ATTACHED BIT(2) -+#define BGMAC_FEAT_NO_RESET BIT(3) -+#define BGMAC_FEAT_MISC_PLL_REQ BIT(4) -+#define BGMAC_FEAT_SW_TYPE_PHY BIT(5) -+#define BGMAC_FEAT_SW_TYPE_EPHYRMII BIT(6) -+#define BGMAC_FEAT_SW_TYPE_RGMII BIT(7) -+#define BGMAC_FEAT_CMN_PHY_CTL BIT(8) -+#define BGMAC_FEAT_FLW_CTRL1 BIT(9) -+#define BGMAC_FEAT_FLW_CTRL2 BIT(10) -+#define BGMAC_FEAT_SET_RXQ_CLK BIT(11) -+#define BGMAC_FEAT_CLKCTLST BIT(12) -+#define BGMAC_FEAT_NO_CLR_MIB BIT(13) -+#define BGMAC_FEAT_FORCE_SPEED_2500 BIT(14) -+#define BGMAC_FEAT_CMDCFG_SR_REV4 BIT(15) -+ - struct bgmac_slot_info { - union { - struct sk_buff *skb; -@@ -430,6 +447,8 @@ struct bgmac { - - struct device *dev; - struct device *dma_dev; -+ u32 feature_flags; -+ - struct net_device *net_dev; - struct napi_struct napi; - struct mii_bus *mii_bus; diff --git a/target/linux/generic/pending-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch b/target/linux/generic/pending-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch deleted file mode 100644 index 575518494..000000000 --- a/target/linux/generic/pending-4.4/071-v4.8-0005-net-ethernet-bgmac-Add-platform-device-support.patch +++ /dev/null @@ -1,1260 +0,0 @@ -From f6a95a24957aec5bb488c3f978c4ed508177998f Mon Sep 17 00:00:00 2001 -From: Jon Mason -Date: Thu, 7 Jul 2016 19:08:57 -0400 -Subject: [PATCH 5/5] net: ethernet: bgmac: Add platform device support - -The bcma portion of the driver has been split off into a bcma specific -driver. This has been mirrored for the platform driver. The last -references to the bcma core struct have been changed into a generic -function call. These function calls are wrappers to either the original -bcma code or new platform functions that access the same areas via MMIO. -This necessitated adding function pointers for both platform and bcma to -hide which backend is being used from the generic bgmac code. - -Signed-off-by: Jon Mason -Acked-by: Arnd Bergmann -Reviewed-by: Florian Fainelli -Tested-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/Kconfig | 23 +- - drivers/net/ethernet/broadcom/Makefile | 4 +- - drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 2 + - drivers/net/ethernet/broadcom/bgmac-bcma.c | 315 +++++++++++++++++++++++ - drivers/net/ethernet/broadcom/bgmac-platform.c | 189 ++++++++++++++ - drivers/net/ethernet/broadcom/bgmac.c | 329 ++++-------------------- - drivers/net/ethernet/broadcom/bgmac.h | 73 +++++- - 7 files changed, 650 insertions(+), 285 deletions(-) - create mode 100644 drivers/net/ethernet/broadcom/bgmac-bcma.c - create mode 100644 drivers/net/ethernet/broadcom/bgmac-platform.c - ---- a/drivers/net/ethernet/broadcom/Kconfig -+++ b/drivers/net/ethernet/broadcom/Kconfig -@@ -150,10 +150,18 @@ config BNX2X_VXLAN - Virtual eXtensible Local Area Network (VXLAN) in the driver. - - config BGMAC -- tristate "BCMA bus GBit core support" -+ tristate -+ help -+ This enables the integrated ethernet controller support for many -+ Broadcom (mostly iProc) SoCs. An appropriate bus interface driver -+ needs to be enabled to select this. -+ -+config BGMAC_BCMA -+ tristate "Broadcom iProc GBit BCMA support" - depends on BCMA && BCMA_HOST_SOC - depends on HAS_DMA - depends on BCM47XX || ARCH_BCM_5301X || COMPILE_TEST -+ select BGMAC - select PHYLIB - select FIXED_PHY - ---help--- -@@ -162,6 +170,19 @@ config BGMAC - In case of using this driver on BCM4706 it's also requires to enable - BCMA_DRIVER_GMAC_CMN to make it work. - -+config BGMAC_PLATFORM -+ tristate "Broadcom iProc GBit platform support" -+ depends on HAS_DMA -+ depends on ARCH_BCM_IPROC || COMPILE_TEST -+ depends on OF -+ select BGMAC -+ select PHYLIB -+ select FIXED_PHY -+ default ARCH_BCM_IPROC -+ ---help--- -+ Say Y here if you want to use the Broadcom iProc Gigabit Ethernet -+ controller through the generic platform interface -+ - config SYSTEMPORT - tristate "Broadcom SYSTEMPORT internal MAC support" - depends on OF ---- a/drivers/net/ethernet/broadcom/Makefile -+++ b/drivers/net/ethernet/broadcom/Makefile -@@ -10,6 +10,8 @@ obj-$(CONFIG_CNIC) += cnic.o - obj-$(CONFIG_BNX2X) += bnx2x/ - obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o - obj-$(CONFIG_TIGON3) += tg3.o --obj-$(CONFIG_BGMAC) += bgmac.o bgmac-bcma-mdio.o -+obj-$(CONFIG_BGMAC) += bgmac.o -+obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o -+obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o - obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o - obj-$(CONFIG_BNXT) += bnxt/ ---- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -@@ -255,6 +255,7 @@ err: - kfree(bcma_mdio); - return ERR_PTR(err); - } -+EXPORT_SYMBOL_GPL(bcma_mdio_mii_register); - - void bcma_mdio_mii_unregister(struct mii_bus *mii_bus) - { -@@ -270,6 +271,7 @@ void bcma_mdio_mii_unregister(struct mii - mdiobus_free(mii_bus); - kfree(bcma_mdio); - } -+EXPORT_SYMBOL_GPL(bcma_mdio_mii_unregister); - - MODULE_AUTHOR("Rafał Miłecki"); - MODULE_LICENSE("GPL"); ---- /dev/null -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -0,0 +1,315 @@ -+/* -+ * Driver for (BCM4706)? GBit MAC core on BCMA bus. -+ * -+ * Copyright (C) 2012 Rafał Miłecki -+ * -+ * Licensed under the GNU/GPL. See COPYING for details. -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include -+#include -+#include -+#include "bgmac.h" -+ -+static inline bool bgmac_is_bcm4707_family(struct bcma_device *core) -+{ -+ switch (core->bus->chipinfo.id) { -+ case BCMA_CHIP_ID_BCM4707: -+ case BCMA_CHIP_ID_BCM47094: -+ case BCMA_CHIP_ID_BCM53018: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+/************************************************** -+ * BCMA bus ops -+ **************************************************/ -+ -+static u32 bcma_bgmac_read(struct bgmac *bgmac, u16 offset) -+{ -+ return bcma_read32(bgmac->bcma.core, offset); -+} -+ -+static void bcma_bgmac_write(struct bgmac *bgmac, u16 offset, u32 value) -+{ -+ bcma_write32(bgmac->bcma.core, offset, value); -+} -+ -+static u32 bcma_bgmac_idm_read(struct bgmac *bgmac, u16 offset) -+{ -+ return bcma_aread32(bgmac->bcma.core, offset); -+} -+ -+static void bcma_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value) -+{ -+ return bcma_awrite32(bgmac->bcma.core, offset, value); -+} -+ -+static bool bcma_bgmac_clk_enabled(struct bgmac *bgmac) -+{ -+ return bcma_core_is_enabled(bgmac->bcma.core); -+} -+ -+static void bcma_bgmac_clk_enable(struct bgmac *bgmac, u32 flags) -+{ -+ bcma_core_enable(bgmac->bcma.core, flags); -+} -+ -+static void bcma_bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset, -+ u32 mask, u32 set) -+{ -+ struct bcma_drv_cc *cc = &bgmac->bcma.core->bus->drv_cc; -+ -+ bcma_chipco_chipctl_maskset(cc, offset, mask, set); -+} -+ -+static u32 bcma_bgmac_get_bus_clock(struct bgmac *bgmac) -+{ -+ struct bcma_drv_cc *cc = &bgmac->bcma.core->bus->drv_cc; -+ -+ return bcma_pmu_get_bus_clock(cc); -+} -+ -+static void bcma_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset, u32 mask, -+ u32 set) -+{ -+ bcma_maskset32(bgmac->bcma.cmn, offset, mask, set); -+} -+ -+static const struct bcma_device_id bgmac_bcma_tbl[] = { -+ BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, -+ BCMA_ANY_REV, BCMA_ANY_CLASS), -+ BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_MAC_GBIT, BCMA_ANY_REV, -+ BCMA_ANY_CLASS), -+ {}, -+}; -+MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl); -+ -+/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */ -+static int bgmac_probe(struct bcma_device *core) -+{ -+ struct ssb_sprom *sprom = &core->bus->sprom; -+ struct mii_bus *mii_bus; -+ struct bgmac *bgmac; -+ u8 *mac; -+ int err; -+ -+ bgmac = kzalloc(sizeof(*bgmac), GFP_KERNEL); -+ if (!bgmac) -+ return -ENOMEM; -+ -+ bgmac->bcma.core = core; -+ bgmac->dev = &core->dev; -+ bgmac->dma_dev = core->dma_dev; -+ bgmac->irq = core->irq; -+ -+ bcma_set_drvdata(core, bgmac); -+ -+ switch (core->core_unit) { -+ case 0: -+ mac = sprom->et0mac; -+ break; -+ case 1: -+ mac = sprom->et1mac; -+ break; -+ case 2: -+ mac = sprom->et2mac; -+ break; -+ default: -+ dev_err(bgmac->dev, "Unsupported core_unit %d\n", -+ core->core_unit); -+ err = -ENOTSUPP; -+ goto err; -+ } -+ -+ ether_addr_copy(bgmac->mac_addr, mac); -+ -+ /* On BCM4706 we need common core to access PHY */ -+ if (core->id.id == BCMA_CORE_4706_MAC_GBIT && -+ !core->bus->drv_gmac_cmn.core) { -+ dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n"); -+ err = -ENODEV; -+ goto err; -+ } -+ bgmac->bcma.cmn = core->bus->drv_gmac_cmn.core; -+ -+ switch (core->core_unit) { -+ case 0: -+ bgmac->phyaddr = sprom->et0phyaddr; -+ break; -+ case 1: -+ bgmac->phyaddr = sprom->et1phyaddr; -+ break; -+ case 2: -+ bgmac->phyaddr = sprom->et2phyaddr; -+ break; -+ } -+ bgmac->phyaddr &= BGMAC_PHY_MASK; -+ if (bgmac->phyaddr == BGMAC_PHY_MASK) { -+ dev_err(bgmac->dev, "No PHY found\n"); -+ err = -ENODEV; -+ goto err; -+ } -+ dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr, -+ bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : ""); -+ -+ if (!bgmac_is_bcm4707_family(core)) { -+ mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); -+ if (!IS_ERR(mii_bus)) { -+ err = PTR_ERR(mii_bus); -+ goto err; -+ } -+ -+ bgmac->mii_bus = mii_bus; -+ } -+ -+ if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) { -+ dev_err(bgmac->dev, "PCI setup not implemented\n"); -+ err = -ENOTSUPP; -+ goto err1; -+ } -+ -+ bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo & -+ BGMAC_BFL_ENETROBO); -+ if (bgmac->has_robosw) -+ dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n"); -+ -+ if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) -+ dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n"); -+ -+ /* Feature Flags */ -+ switch (core->bus->chipinfo.id) { -+ case BCMA_CHIP_ID_BCM5357: -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -+ if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) { -+ bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -+ } -+ if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358) -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII; -+ break; -+ case BCMA_CHIP_ID_BCM53572: -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -+ if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) { -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -+ bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -+ } -+ break; -+ case BCMA_CHIP_ID_BCM4749: -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -+ if (core->bus->chipinfo.pkg == 10) { -+ bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -+ bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -+ } -+ break; -+ case BCMA_CHIP_ID_BCM4716: -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ /* fallthrough */ -+ case BCMA_CHIP_ID_BCM47162: -+ bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2; -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ break; -+ /* bcm4707_family */ -+ case BCMA_CHIP_ID_BCM4707: -+ case BCMA_CHIP_ID_BCM47094: -+ case BCMA_CHIP_ID_BCM53018: -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; -+ bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; -+ break; -+ default: -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ } -+ -+ if (!bgmac_is_bcm4707_family(core) && core->id.rev > 2) -+ bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ; -+ -+ if (core->id.id == BCMA_CORE_4706_MAC_GBIT) { -+ bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL; -+ bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB; -+ } -+ -+ if (core->id.rev >= 4) { -+ bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4; -+ bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP; -+ bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP; -+ } -+ -+ bgmac->read = bcma_bgmac_read; -+ bgmac->write = bcma_bgmac_write; -+ bgmac->idm_read = bcma_bgmac_idm_read; -+ bgmac->idm_write = bcma_bgmac_idm_write; -+ bgmac->clk_enabled = bcma_bgmac_clk_enabled; -+ bgmac->clk_enable = bcma_bgmac_clk_enable; -+ bgmac->cco_ctl_maskset = bcma_bgmac_cco_ctl_maskset; -+ bgmac->get_bus_clock = bcma_bgmac_get_bus_clock; -+ bgmac->cmn_maskset32 = bcma_bgmac_cmn_maskset32; -+ -+ err = bgmac_enet_probe(bgmac); -+ if (err) -+ goto err1; -+ -+ return 0; -+ -+err1: -+ bcma_mdio_mii_unregister(bgmac->mii_bus); -+err: -+ kfree(bgmac); -+ bcma_set_drvdata(core, NULL); -+ -+ return err; -+} -+ -+static void bgmac_remove(struct bcma_device *core) -+{ -+ struct bgmac *bgmac = bcma_get_drvdata(core); -+ -+ bcma_mdio_mii_unregister(bgmac->mii_bus); -+ bgmac_enet_remove(bgmac); -+ bcma_set_drvdata(core, NULL); -+ kfree(bgmac); -+} -+ -+static struct bcma_driver bgmac_bcma_driver = { -+ .name = KBUILD_MODNAME, -+ .id_table = bgmac_bcma_tbl, -+ .probe = bgmac_probe, -+ .remove = bgmac_remove, -+}; -+ -+static int __init bgmac_init(void) -+{ -+ int err; -+ -+ err = bcma_driver_register(&bgmac_bcma_driver); -+ if (err) -+ return err; -+ pr_info("Broadcom 47xx GBit MAC driver loaded\n"); -+ -+ return 0; -+} -+ -+static void __exit bgmac_exit(void) -+{ -+ bcma_driver_unregister(&bgmac_bcma_driver); -+} -+ -+module_init(bgmac_init) -+module_exit(bgmac_exit) -+ -+MODULE_AUTHOR("Rafał Miłecki"); -+MODULE_LICENSE("GPL"); ---- /dev/null -+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c -@@ -0,0 +1,189 @@ -+/* -+ * Copyright (C) 2016 Broadcom -+ * -+ * 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. -+ * -+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any -+ * kind, whether express or implied; without even the implied warranty -+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include -+#include -+#include -+#include -+#include "bgmac.h" -+ -+static u32 platform_bgmac_read(struct bgmac *bgmac, u16 offset) -+{ -+ return readl(bgmac->plat.base + offset); -+} -+ -+static void platform_bgmac_write(struct bgmac *bgmac, u16 offset, u32 value) -+{ -+ writel(value, bgmac->plat.base + offset); -+} -+ -+static u32 platform_bgmac_idm_read(struct bgmac *bgmac, u16 offset) -+{ -+ return readl(bgmac->plat.idm_base + offset); -+} -+ -+static void platform_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value) -+{ -+ return writel(value, bgmac->plat.idm_base + offset); -+} -+ -+static bool platform_bgmac_clk_enabled(struct bgmac *bgmac) -+{ -+ if ((bgmac_idm_read(bgmac, BCMA_IOCTL) & -+ (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC)) != BCMA_IOCTL_CLK) -+ return false; -+ if (bgmac_idm_read(bgmac, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET) -+ return false; -+ return true; -+} -+ -+static void platform_bgmac_clk_enable(struct bgmac *bgmac, u32 flags) -+{ -+ bgmac_idm_write(bgmac, BCMA_IOCTL, -+ (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags)); -+ bgmac_idm_read(bgmac, BCMA_IOCTL); -+ -+ bgmac_idm_write(bgmac, BCMA_RESET_CTL, 0); -+ bgmac_idm_read(bgmac, BCMA_RESET_CTL); -+ udelay(1); -+ -+ bgmac_idm_write(bgmac, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags)); -+ bgmac_idm_read(bgmac, BCMA_IOCTL); -+ udelay(1); -+} -+ -+static void platform_bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset, -+ u32 mask, u32 set) -+{ -+ /* This shouldn't be encountered */ -+ WARN_ON(1); -+} -+ -+static u32 platform_bgmac_get_bus_clock(struct bgmac *bgmac) -+{ -+ /* This shouldn't be encountered */ -+ WARN_ON(1); -+ -+ return 0; -+} -+ -+static void platform_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset, -+ u32 mask, u32 set) -+{ -+ /* This shouldn't be encountered */ -+ WARN_ON(1); -+} -+ -+static int bgmac_probe(struct platform_device *pdev) -+{ -+ struct device_node *np = pdev->dev.of_node; -+ struct bgmac *bgmac; -+ struct resource *regs; -+ const u8 *mac_addr; -+ -+ bgmac = devm_kzalloc(&pdev->dev, sizeof(*bgmac), GFP_KERNEL); -+ if (!bgmac) -+ return -ENOMEM; -+ -+ platform_set_drvdata(pdev, bgmac); -+ -+ /* Set the features of the 4707 family */ -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; -+ bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; -+ bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4; -+ bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP; -+ bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP; -+ -+ bgmac->dev = &pdev->dev; -+ bgmac->dma_dev = &pdev->dev; -+ -+ mac_addr = of_get_mac_address(np); -+ if (mac_addr) -+ ether_addr_copy(bgmac->mac_addr, mac_addr); -+ else -+ dev_warn(&pdev->dev, "MAC address not present in device tree\n"); -+ -+ bgmac->irq = platform_get_irq(pdev, 0); -+ if (bgmac->irq < 0) { -+ dev_err(&pdev->dev, "Unable to obtain IRQ\n"); -+ return bgmac->irq; -+ } -+ -+ regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "amac_base"); -+ if (!regs) { -+ dev_err(&pdev->dev, "Unable to obtain base resource\n"); -+ return -EINVAL; -+ } -+ -+ bgmac->plat.base = devm_ioremap_resource(&pdev->dev, regs); -+ if (IS_ERR(bgmac->plat.base)) { -+ dev_err(&pdev->dev, "Unable to map base resource\n"); -+ return PTR_ERR(bgmac->plat.base); -+ } -+ -+ regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base"); -+ if (!regs) { -+ dev_err(&pdev->dev, "Unable to obtain idm resource\n"); -+ return -EINVAL; -+ } -+ -+ bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs); -+ if (!bgmac->plat.idm_base) { -+ dev_err(&pdev->dev, "Unable to map idm resource\n"); -+ return PTR_ERR(bgmac->plat.idm_base); -+ } -+ -+ bgmac->read = platform_bgmac_read; -+ bgmac->write = platform_bgmac_write; -+ bgmac->idm_read = platform_bgmac_idm_read; -+ bgmac->idm_write = platform_bgmac_idm_write; -+ bgmac->clk_enabled = platform_bgmac_clk_enabled; -+ bgmac->clk_enable = platform_bgmac_clk_enable; -+ bgmac->cco_ctl_maskset = platform_bgmac_cco_ctl_maskset; -+ bgmac->get_bus_clock = platform_bgmac_get_bus_clock; -+ bgmac->cmn_maskset32 = platform_bgmac_cmn_maskset32; -+ -+ return bgmac_enet_probe(bgmac); -+} -+ -+static int bgmac_remove(struct platform_device *pdev) -+{ -+ struct bgmac *bgmac = platform_get_drvdata(pdev); -+ -+ bgmac_enet_remove(bgmac); -+ -+ return 0; -+} -+ -+static const struct of_device_id bgmac_of_enet_match[] = { -+ {.compatible = "brcm,amac",}, -+ {.compatible = "brcm,nsp-amac",}, -+ {}, -+}; -+ -+MODULE_DEVICE_TABLE(of, bgmac_of_enet_match); -+ -+static struct platform_driver bgmac_enet_driver = { -+ .driver = { -+ .name = "bgmac-enet", -+ .of_match_table = bgmac_of_enet_match, -+ }, -+ .probe = bgmac_probe, -+ .remove = bgmac_remove, -+}; -+ -+module_platform_driver(bgmac_enet_driver); -+MODULE_LICENSE("GPL"); ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -6,51 +6,27 @@ - * Licensed under the GNU/GPL. See COPYING for details. - */ - --#include "bgmac.h" - --#include --#include --#include -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include - #include --#include --#include --#include --#include --#include - #include -+#include "bgmac.h" - --static const struct bcma_device_id bgmac_bcma_tbl[] = { -- BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS), -- BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS), -- {}, --}; --MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl); -- --static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac) --{ -- switch (bgmac->core->bus->chipinfo.id) { -- case BCMA_CHIP_ID_BCM4707: -- case BCMA_CHIP_ID_BCM47094: -- case BCMA_CHIP_ID_BCM53018: -- return true; -- default: -- return false; -- } --} -- --static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask, -+static bool bgmac_wait_value(struct bgmac *bgmac, u16 reg, u32 mask, - u32 value, int timeout) - { - u32 val; - int i; - - for (i = 0; i < timeout / 10; i++) { -- val = bcma_read32(core, reg); -+ val = bgmac_read(bgmac, reg); - if ((val & mask) == value) - return true; - udelay(10); - } -- dev_err(&core->dev, "Timeout waiting for reg 0x%X\n", reg); -+ dev_err(bgmac->dev, "Timeout waiting for reg 0x%X\n", reg); - return false; - } - -@@ -89,7 +65,7 @@ static void bgmac_dma_tx_reset(struct bg - - /* Remove SUSPEND bit */ - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_CTL, 0); -- if (!bgmac_wait_value(bgmac->core, -+ if (!bgmac_wait_value(bgmac, - ring->mmio_base + BGMAC_DMA_TX_STATUS, - BGMAC_DMA_TX_STAT, BGMAC_DMA_TX_STAT_DISABLED, - 10000)) { -@@ -317,7 +293,7 @@ static void bgmac_dma_rx_reset(struct bg - return; - - bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_CTL, 0); -- if (!bgmac_wait_value(bgmac->core, -+ if (!bgmac_wait_value(bgmac, - ring->mmio_base + BGMAC_DMA_RX_STATUS, - BGMAC_DMA_RX_STAT, BGMAC_DMA_RX_STAT_DISABLED, - 10000)) -@@ -643,7 +619,7 @@ static int bgmac_dma_alloc(struct bgmac - BUILD_BUG_ON(BGMAC_MAX_TX_RINGS > ARRAY_SIZE(ring_base)); - BUILD_BUG_ON(BGMAC_MAX_RX_RINGS > ARRAY_SIZE(ring_base)); - -- if (!(bcma_aread32(bgmac->core, BCMA_IOST) & BCMA_IOST_DMA64)) { -+ if (!(bgmac_idm_read(bgmac, BCMA_IOST) & BCMA_IOST_DMA64)) { - dev_err(bgmac->dev, "Core does not report 64-bit DMA\n"); - return -ENOTSUPP; - } -@@ -875,12 +851,10 @@ static void bgmac_mac_speed(struct bgmac - - static void bgmac_miiconfig(struct bgmac *bgmac) - { -- struct bcma_device *core = bgmac->core; -- - if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) { -- bcma_awrite32(core, BCMA_IOCTL, -- bcma_aread32(core, BCMA_IOCTL) | 0x40 | -- BGMAC_BCMA_IOCTL_SW_CLKEN); -+ bgmac_idm_write(bgmac, BCMA_IOCTL, -+ bgmac_idm_read(bgmac, BCMA_IOCTL) | 0x40 | -+ BGMAC_BCMA_IOCTL_SW_CLKEN); - bgmac->mac_speed = SPEED_2500; - bgmac->mac_duplex = DUPLEX_FULL; - bgmac_mac_speed(bgmac); -@@ -900,12 +874,11 @@ static void bgmac_miiconfig(struct bgmac - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipreset */ - static void bgmac_chip_reset(struct bgmac *bgmac) - { -- struct bcma_device *core = bgmac->core; - u32 cmdcfg_sr; - u32 iost; - int i; - -- if (bcma_core_is_enabled(core)) { -+ if (bgmac_clk_enabled(bgmac)) { - if (!bgmac->stats_grabbed) { - /* bgmac_chip_stats_update(bgmac); */ - bgmac->stats_grabbed = true; -@@ -923,7 +896,7 @@ static void bgmac_chip_reset(struct bgma - /* TODO: Clear software multicast filter list */ - } - -- iost = bcma_aread32(core, BCMA_IOST); -+ iost = bgmac_idm_read(bgmac, BCMA_IOST); - if (bgmac->feature_flags & BGMAC_FEAT_IOST_ATTACHED) - iost &= ~BGMAC_BCMA_IOST_ATTACHED; - -@@ -935,21 +908,20 @@ static void bgmac_chip_reset(struct bgma - if (!bgmac->has_robosw) - flags |= BGMAC_BCMA_IOCTL_SW_RESET; - } -- bcma_core_enable(core, flags); -+ bgmac_clk_enable(bgmac, flags); - } - - /* Request Misc PLL for corerev > 2 */ - if (bgmac->feature_flags & BGMAC_FEAT_MISC_PLL_REQ) { - bgmac_set(bgmac, BCMA_CLKCTLST, - BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ); -- bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, -+ bgmac_wait_value(bgmac, BCMA_CLKCTLST, - BGMAC_BCMA_CLKCTLST_MISC_PLL_ST, - BGMAC_BCMA_CLKCTLST_MISC_PLL_ST, - 1000); - } - - if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_PHY) { -- struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc; - u8 et_swtype = 0; - u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY | - BGMAC_CHIPCTL_1_IF_TYPE_MII; -@@ -968,16 +940,15 @@ static void bgmac_chip_reset(struct bgma - sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII | - BGMAC_CHIPCTL_1_SW_TYPE_RGMII; - } -- bcma_chipco_chipctl_maskset(cc, 1, -- ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK | -- BGMAC_CHIPCTL_1_SW_TYPE_MASK), -- sw_type); -+ bgmac_cco_ctl_maskset(bgmac, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK | -+ BGMAC_CHIPCTL_1_SW_TYPE_MASK), -+ sw_type); - } - - if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw) -- bcma_awrite32(core, BCMA_IOCTL, -- bcma_aread32(core, BCMA_IOCTL) & -- ~BGMAC_BCMA_IOCTL_SW_RESET); -+ bgmac_idm_write(bgmac, BCMA_IOCTL, -+ bgmac_idm_read(bgmac, BCMA_IOCTL) & -+ ~BGMAC_BCMA_IOCTL_SW_RESET); - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_reset - * Specs don't say about using BGMAC_CMDCFG_SR, but in this routine -@@ -1013,8 +984,8 @@ static void bgmac_chip_reset(struct bgma - - bgmac_clear_mib(bgmac); - if (bgmac->feature_flags & BGMAC_FEAT_CMN_PHY_CTL) -- bcma_maskset32(bgmac->cmn, BCMA_GMAC_CMN_PHY_CTL, ~0, -- BCMA_GMAC_CMN_PC_MTE); -+ bgmac_cmn_maskset32(bgmac, BCMA_GMAC_CMN_PHY_CTL, ~0, -+ BCMA_GMAC_CMN_PC_MTE); - else - bgmac_set(bgmac, BGMAC_PHY_CNTL, BGMAC_PC_MTE); - bgmac_miiconfig(bgmac); -@@ -1059,8 +1030,8 @@ static void bgmac_enable(struct bgmac *b - if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0) - bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT); - if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2) -- bcma_chipco_chipctl_maskset(&bgmac->core->bus->drv_cc, 1, ~0, -- BGMAC_CHIPCTL_1_RXC_DLL_BYPASS); -+ bgmac_cco_ctl_maskset(bgmac, 1, ~0, -+ BGMAC_CHIPCTL_1_RXC_DLL_BYPASS); - - if (bgmac->feature_flags & (BGMAC_FEAT_FLW_CTRL1 | - BGMAC_FEAT_FLW_CTRL2)) { -@@ -1082,8 +1053,7 @@ static void bgmac_enable(struct bgmac *b - - rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL); - rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK; -- bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / -- 1000000; -+ bp_clk = bgmac_get_bus_clock(bgmac) / 1000000; - mdp = (bp_clk * 128 / 1000) - 3; - rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT); - bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl); -@@ -1178,7 +1148,7 @@ static int bgmac_open(struct net_device - /* Specs say about reclaiming rings here, but we do that in DMA init */ - bgmac_chip_init(bgmac); - -- err = request_irq(bgmac->core->irq, bgmac_interrupt, IRQF_SHARED, -+ err = request_irq(bgmac->irq, bgmac_interrupt, IRQF_SHARED, - KBUILD_MODNAME, net_dev); - if (err < 0) { - dev_err(bgmac->dev, "IRQ request error: %d!\n", err); -@@ -1204,7 +1174,7 @@ static int bgmac_stop(struct net_device - - napi_disable(&bgmac->napi); - bgmac_chip_intrs_off(bgmac); -- free_irq(bgmac->core->irq, net_dev); -+ free_irq(bgmac->irq, net_dev); - - bgmac_chip_reset(bgmac); - bgmac_dma_cleanup(bgmac); -@@ -1399,7 +1369,7 @@ static void bgmac_get_drvinfo(struct net - struct ethtool_drvinfo *info) - { - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); -- strlcpy(info->bus_info, "BCMA", sizeof(info->bus_info)); -+ strlcpy(info->bus_info, "AXI", sizeof(info->bus_info)); - } - - static const struct ethtool_ops bgmac_ethtool_ops = { -@@ -1483,116 +1453,41 @@ static int bgmac_phy_connect(struct bgma - return 0; - } - --static int bgmac_probe(struct bcma_device *core) -+int bgmac_enet_probe(struct bgmac *info) - { - struct net_device *net_dev; - struct bgmac *bgmac; -- struct ssb_sprom *sprom = &core->bus->sprom; -- u8 *mac; - int err; - -- switch (core->core_unit) { -- case 0: -- mac = sprom->et0mac; -- break; -- case 1: -- mac = sprom->et1mac; -- break; -- case 2: -- mac = sprom->et2mac; -- break; -- default: -- dev_err(&core->dev, "Unsupported core_unit %d\n", -- core->core_unit); -- return -ENOTSUPP; -- } -- -- if (!is_valid_ether_addr(mac)) { -- dev_err(&core->dev, "Invalid MAC addr: %pM\n", mac); -- eth_random_addr(mac); -- dev_warn(&core->dev, "Using random MAC: %pM\n", mac); -- } -- -- /* This (reset &) enable is not preset in specs or reference driver but -- * Broadcom does it in arch PCI code when enabling fake PCI device. -- */ -- bcma_core_enable(core, 0); -- - /* Allocation and references */ - net_dev = alloc_etherdev(sizeof(*bgmac)); - if (!net_dev) - return -ENOMEM; -+ - net_dev->netdev_ops = &bgmac_netdev_ops; -- net_dev->irq = core->irq; - net_dev->ethtool_ops = &bgmac_ethtool_ops; - bgmac = netdev_priv(net_dev); -- bgmac->dev = &core->dev; -- bgmac->dma_dev = core->dma_dev; -+ memcpy(bgmac, info, sizeof(*bgmac)); - bgmac->net_dev = net_dev; -- bgmac->core = core; -- bcma_set_drvdata(core, bgmac); -- SET_NETDEV_DEV(net_dev, &core->dev); -- -- /* Defaults */ -- memcpy(bgmac->net_dev->dev_addr, mac, ETH_ALEN); -- -- /* On BCM4706 we need common core to access PHY */ -- if (core->id.id == BCMA_CORE_4706_MAC_GBIT && -- !core->bus->drv_gmac_cmn.core) { -- dev_err(bgmac->dev, "GMAC CMN core not found (required for BCM4706)\n"); -- err = -ENODEV; -- goto err_netdev_free; -- } -- bgmac->cmn = core->bus->drv_gmac_cmn.core; -+ net_dev->irq = bgmac->irq; -+ SET_NETDEV_DEV(net_dev, bgmac->dev); - -- switch (core->core_unit) { -- case 0: -- bgmac->phyaddr = sprom->et0phyaddr; -- break; -- case 1: -- bgmac->phyaddr = sprom->et1phyaddr; -- break; -- case 2: -- bgmac->phyaddr = sprom->et2phyaddr; -- break; -+ if (!is_valid_ether_addr(bgmac->mac_addr)) { -+ dev_err(bgmac->dev, "Invalid MAC addr: %pM\n", -+ bgmac->mac_addr); -+ eth_random_addr(bgmac->mac_addr); -+ dev_warn(bgmac->dev, "Using random MAC: %pM\n", -+ bgmac->mac_addr); - } -- bgmac->phyaddr &= BGMAC_PHY_MASK; -- if (bgmac->phyaddr == BGMAC_PHY_MASK) { -- dev_err(bgmac->dev, "No PHY found\n"); -- err = -ENODEV; -- goto err_netdev_free; -- } -- dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr, -- bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : ""); -+ ether_addr_copy(net_dev->dev_addr, bgmac->mac_addr); - -- if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) { -- dev_err(bgmac->dev, "PCI setup not implemented\n"); -- err = -ENOTSUPP; -- goto err_netdev_free; -- } -+ /* This (reset &) enable is not preset in specs or reference driver but -+ * Broadcom does it in arch PCI code when enabling fake PCI device. -+ */ -+ bgmac_clk_enable(bgmac, 0); - - bgmac_chip_reset(bgmac); - -- /* For Northstar, we have to take all GMAC core out of reset */ -- if (bgmac_is_bcm4707_family(bgmac)) { -- struct bcma_device *ns_core; -- int ns_gmac; -- -- /* Northstar has 4 GMAC cores */ -- for (ns_gmac = 0; ns_gmac < 4; ns_gmac++) { -- /* As Northstar requirement, we have to reset all GMACs -- * before accessing one. bgmac_chip_reset() call -- * bcma_core_enable() for this core. Then the other -- * three GMACs didn't reset. We do it here. -- */ -- 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); -- } -- } -- - err = bgmac_dma_alloc(bgmac); - if (err) { - dev_err(bgmac->dev, "Unable to alloc memory for DMA\n"); -@@ -1603,103 +1498,15 @@ static int bgmac_probe(struct bcma_devic - if (bcm47xx_nvram_getenv("et0_no_txint", NULL, 0) == 0) - bgmac->int_mask &= ~BGMAC_IS_TX_MASK; - -- bgmac->has_robosw = !!(core->bus->sprom.boardflags_lo & -- BGMAC_BFL_ENETROBO); -- if (bgmac->has_robosw) -- dev_warn(bgmac->dev, "Support for Roboswitch not implemented\n"); -- -- if (core->bus->sprom.boardflags_lo & BGMAC_BFL_ENETADM) -- dev_warn(bgmac->dev, "Support for ADMtek ethernet switch not implemented\n"); -- -- /* Feature Flags */ -- switch (core->bus->chipinfo.id) { -- case BCMA_CHIP_ID_BCM5357: -- bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -- bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -- bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -- bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -- if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47186) { -- bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -- bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -- } -- if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM5358) -- bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII; -- break; -- case BCMA_CHIP_ID_BCM53572: -- bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -- bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -- bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -- bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -- if (core->bus->chipinfo.pkg == BCMA_PKG_ID_BCM47188) { -- bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -- bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -- } -- break; -- case BCMA_CHIP_ID_BCM4749: -- bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -- bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -- bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; -- bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -- if (core->bus->chipinfo.pkg == 10) { -- bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; -- bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -- } -- break; -- case BCMA_CHIP_ID_BCM4716: -- bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -- /* fallthrough */ -- case BCMA_CHIP_ID_BCM47162: -- bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2; -- bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -- break; -- /* bcm4707_family */ -- case BCMA_CHIP_ID_BCM4707: -- case BCMA_CHIP_ID_BCM47094: -- case BCMA_CHIP_ID_BCM53018: -- bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -- bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; -- bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; -- break; -- default: -- bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -- bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -- } -- -- if (!bgmac_is_bcm4707_family(bgmac) && core->id.rev > 2) -- bgmac->feature_flags |= BGMAC_FEAT_MISC_PLL_REQ; -- -- if (core->id.id == BCMA_CORE_4706_MAC_GBIT) { -- bgmac->feature_flags |= BGMAC_FEAT_CMN_PHY_CTL; -- bgmac->feature_flags |= BGMAC_FEAT_NO_CLR_MIB; -- } -- -- if (core->id.rev >= 4) { -- bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4; -- bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP; -- bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP; -- } -- - netif_napi_add(net_dev, &bgmac->napi, bgmac_poll, BGMAC_WEIGHT); - -- if (!bgmac_is_bcm4707_family(bgmac)) { -- struct mii_bus *mii_bus; -- -- mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); -- if (!IS_ERR(mii_bus)) { -- err = PTR_ERR(mii_bus); -- goto err_dma_free; -- } -- -- bgmac->mii_bus = mii_bus; -- } -- - if (!bgmac->mii_bus) - err = bgmac_phy_connect_direct(bgmac); - else - err = bgmac_phy_connect(bgmac); - if (err) { - dev_err(bgmac->dev, "Cannot connect to phy\n"); -- goto err_mii_unregister; -+ goto err_dma_free; - } - - net_dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; -@@ -1718,56 +1525,24 @@ static int bgmac_probe(struct bcma_devic - - err_phy_disconnect: - phy_disconnect(net_dev->phydev); --err_mii_unregister: -- bcma_mdio_mii_unregister(bgmac->mii_bus); - err_dma_free: - bgmac_dma_free(bgmac); - err_netdev_free: -- bcma_set_drvdata(core, NULL); - free_netdev(net_dev); - - return err; - } -+EXPORT_SYMBOL_GPL(bgmac_enet_probe); - --static void bgmac_remove(struct bcma_device *core) -+void bgmac_enet_remove(struct bgmac *bgmac) - { -- struct bgmac *bgmac = bcma_get_drvdata(core); -- - unregister_netdev(bgmac->net_dev); - phy_disconnect(bgmac->net_dev->phydev); -- bcma_mdio_mii_unregister(bgmac->mii_bus); - netif_napi_del(&bgmac->napi); - bgmac_dma_free(bgmac); -- bcma_set_drvdata(core, NULL); - free_netdev(bgmac->net_dev); - } -- --static struct bcma_driver bgmac_bcma_driver = { -- .name = KBUILD_MODNAME, -- .id_table = bgmac_bcma_tbl, -- .probe = bgmac_probe, -- .remove = bgmac_remove, --}; -- --static int __init bgmac_init(void) --{ -- int err; -- -- err = bcma_driver_register(&bgmac_bcma_driver); -- if (err) -- return err; -- pr_info("Broadcom 47xx GBit MAC driver loaded\n"); -- -- return 0; --} -- --static void __exit bgmac_exit(void) --{ -- bcma_driver_unregister(&bgmac_bcma_driver); --} -- --module_init(bgmac_init) --module_exit(bgmac_exit) -+EXPORT_SYMBOL_GPL(bgmac_enet_remove); - - MODULE_AUTHOR("Rafał Miłecki"); - MODULE_LICENSE("GPL"); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -1,8 +1,6 @@ - #ifndef _BGMAC_H - #define _BGMAC_H - --#include --#include - #include - - #define BGMAC_DEV_CTL 0x000 -@@ -442,11 +440,21 @@ struct bgmac_rx_header { - }; - - struct bgmac { -- struct bcma_device *core; -- struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */ -+ union { -+ struct { -+ void *base; -+ void *idm_base; -+ } plat; -+ struct { -+ struct bcma_device *core; -+ /* Reference to CMN core for BCM4706 */ -+ struct bcma_device *cmn; -+ } bcma; -+ }; - - struct device *dev; - struct device *dma_dev; -+ unsigned char mac_addr[ETH_ALEN]; - u32 feature_flags; - - struct net_device *net_dev; -@@ -463,6 +471,7 @@ struct bgmac { - u32 mib_rx_regs[BGMAC_NUM_MIB_RX_REGS]; - - /* Int */ -+ int irq; - u32 int_mask; - - /* Current MAC state */ -@@ -473,19 +482,71 @@ struct bgmac { - bool has_robosw; - - bool loopback; -+ -+ u32 (*read)(struct bgmac *bgmac, u16 offset); -+ void (*write)(struct bgmac *bgmac, u16 offset, u32 value); -+ u32 (*idm_read)(struct bgmac *bgmac, u16 offset); -+ void (*idm_write)(struct bgmac *bgmac, u16 offset, u32 value); -+ bool (*clk_enabled)(struct bgmac *bgmac); -+ void (*clk_enable)(struct bgmac *bgmac, u32 flags); -+ void (*cco_ctl_maskset)(struct bgmac *bgmac, u32 offset, u32 mask, -+ u32 set); -+ u32 (*get_bus_clock)(struct bgmac *bgmac); -+ void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask, -+ u32 set); - }; - -+int bgmac_enet_probe(struct bgmac *info); -+void bgmac_enet_remove(struct bgmac *bgmac); -+ - struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr); - void bcma_mdio_mii_unregister(struct mii_bus *mii_bus); - - static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset) - { -- return bcma_read32(bgmac->core, offset); -+ return bgmac->read(bgmac, offset); - } - - static inline void bgmac_write(struct bgmac *bgmac, u16 offset, u32 value) - { -- bcma_write32(bgmac->core, offset, value); -+ bgmac->write(bgmac, offset, value); -+} -+ -+static inline u32 bgmac_idm_read(struct bgmac *bgmac, u16 offset) -+{ -+ return bgmac->idm_read(bgmac, offset); -+} -+ -+static inline void bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value) -+{ -+ bgmac->idm_write(bgmac, offset, value); -+} -+ -+static inline bool bgmac_clk_enabled(struct bgmac *bgmac) -+{ -+ return bgmac->clk_enabled(bgmac); -+} -+ -+static inline void bgmac_clk_enable(struct bgmac *bgmac, u32 flags) -+{ -+ bgmac->clk_enable(bgmac, flags); -+} -+ -+static inline void bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset, -+ u32 mask, u32 set) -+{ -+ bgmac->cco_ctl_maskset(bgmac, offset, mask, set); -+} -+ -+static inline u32 bgmac_get_bus_clock(struct bgmac *bgmac) -+{ -+ return bgmac->get_bus_clock(bgmac); -+} -+ -+static inline void bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset, -+ u32 mask, u32 set) -+{ -+ bgmac->cmn_maskset32(bgmac, offset, mask, set); - } - - static inline void bgmac_maskset(struct bgmac *bgmac, u16 offset, u32 mask, diff --git a/target/linux/generic/pending-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch b/target/linux/generic/pending-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch deleted file mode 100644 index e0431c123..000000000 --- a/target/linux/generic/pending-4.4/071-v4.8-0006-net-ethernet-bgmac-Fix-return-value-check-in-bgmac_p.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 12c2e32f14da857b58af281b029d4549d24c3292 Mon Sep 17 00:00:00 2001 -From: Wei Yongjun -Date: Tue, 12 Jul 2016 00:17:28 +0000 -Subject: [PATCH] net: ethernet: bgmac: Fix return value check in bgmac_probe() - -In case of error, the function devm_ioremap_resource() returns ERR_PTR() -and never returns NULL. The NULL test in the return value check should be -replaced with IS_ERR(). - -Signed-off-by: Wei Yongjun -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-platform.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-platform.c -+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c -@@ -141,7 +141,7 @@ static int bgmac_probe(struct platform_d - } - - bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs); -- if (!bgmac->plat.idm_base) { -+ if (IS_ERR(bgmac->plat.idm_base)) { - dev_err(&pdev->dev, "Unable to map idm resource\n"); - return PTR_ERR(bgmac->plat.idm_base); - } diff --git a/target/linux/generic/pending-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch b/target/linux/generic/pending-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch deleted file mode 100644 index 479094830..000000000 --- a/target/linux/generic/pending-4.4/071-v4.8-0007-net-ethernet-bgmac-Remove-redundant-dev_err-call-in-.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ce3a380dddd0cb16cb3d8d947b69657d7646c121 Mon Sep 17 00:00:00 2001 -From: Wei Yongjun -Date: Wed, 13 Jul 2016 12:46:57 +0000 -Subject: [PATCH] net: ethernet: bgmac: Remove redundant dev_err call in - bgmac_probe() - -There is a error message within devm_ioremap_resource -already, so remove the dev_err call to avoid redundant -error message. - -Signed-off-by: Wei Yongjun -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-platform.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-platform.c -+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c -@@ -129,10 +129,8 @@ static int bgmac_probe(struct platform_d - } - - bgmac->plat.base = devm_ioremap_resource(&pdev->dev, regs); -- if (IS_ERR(bgmac->plat.base)) { -- dev_err(&pdev->dev, "Unable to map base resource\n"); -+ if (IS_ERR(bgmac->plat.base)) - return PTR_ERR(bgmac->plat.base); -- } - - regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base"); - if (!regs) { -@@ -141,10 +139,8 @@ static int bgmac_probe(struct platform_d - } - - bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs); -- if (IS_ERR(bgmac->plat.idm_base)) { -- dev_err(&pdev->dev, "Unable to map idm resource\n"); -+ if (IS_ERR(bgmac->plat.idm_base)) - return PTR_ERR(bgmac->plat.idm_base); -- } - - bgmac->read = platform_bgmac_read; - bgmac->write = platform_bgmac_write; diff --git a/target/linux/generic/pending-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch b/target/linux/generic/pending-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch deleted file mode 100644 index 945546d6d..000000000 --- a/target/linux/generic/pending-4.4/071-v4.8-0009-net-bgmac-fix-reversed-check-for-MII-registration-er.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b9f63ae7ba2de2ba19137c5757c0607ce40f3ed5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 17 Aug 2016 15:37:14 +0200 -Subject: [PATCH] net: bgmac: fix reversed check for MII registration error -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It was failing on successful registration returning meaningless errors. - -Signed-off-by: Rafał Miłecki -Fixes: 55954f3bfdac ("net: ethernet: bgmac: move BCMA MDIO Phy code into a separate file") -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -159,7 +159,7 @@ static int bgmac_probe(struct bcma_devic - - if (!bgmac_is_bcm4707_family(core)) { - mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); -- if (!IS_ERR(mii_bus)) { -+ if (IS_ERR(mii_bus)) { - err = PTR_ERR(mii_bus); - goto err; - } diff --git a/target/linux/generic/pending-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch b/target/linux/generic/pending-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch deleted file mode 100644 index 82d3fe4d6..000000000 --- a/target/linux/generic/pending-4.4/071-v4.9-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 1cb94db3d1bfe0075bde78fb2989f17e0a8a3936 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 17 Aug 2016 23:00:30 +0200 -Subject: [PATCH] net: bgmac: support Ethernet core on BCM53573 SoCs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and can -be found in two packages (versions): BCM53573 and BCM47189. It shares -some code with the Northstar family, but also requires some new quirks. - -First of all there can be up to 2 Ethernet cores on this SoC. If that is -the case, they are connected to two different switch ports allowing some -more complex/optimized setups. It seems the second unit doesn't come -fully configured and requires some IRQ quirk. - -Other than that only the first core is connected to the PHY. For the -second one we have to register fixed PHY (similarly to the Northstar), -otherwise generic PHY driver would get some invalid info. - -This has been successfully tested on Tenda AC9 (BCM47189B0). - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 19 ++++++++++++++++++- - drivers/net/ethernet/broadcom/bgmac.c | 25 +++++++++++++++++++++++++ - drivers/net/ethernet/broadcom/bgmac.h | 19 +++++++++++++++++++ - include/linux/bcma/bcma.h | 3 +++ - include/linux/bcma/bcma_regs.h | 1 + - 5 files changed, 66 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -92,6 +92,7 @@ MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */ - static int bgmac_probe(struct bcma_device *core) - { -+ struct bcma_chipinfo *ci = &core->bus->chipinfo; - struct ssb_sprom *sprom = &core->bus->sprom; - struct mii_bus *mii_bus; - struct bgmac *bgmac; -@@ -157,7 +158,8 @@ static int bgmac_probe(struct bcma_devic - dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr, - bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : ""); - -- if (!bgmac_is_bcm4707_family(core)) { -+ if (!bgmac_is_bcm4707_family(core) && -+ !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) { - mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); - if (IS_ERR(mii_bus)) { - err = PTR_ERR(mii_bus); -@@ -230,6 +232,21 @@ static int bgmac_probe(struct bcma_devic - bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; - bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; - break; -+ case BCMA_CHIP_ID_BCM53573: -+ bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; -+ bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; -+ if (ci->pkg == BCMA_PKG_ID_BCM47189) -+ bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; -+ if (core->core_unit == 0) { -+ bgmac->feature_flags |= BGMAC_FEAT_CC4_IF_SW_TYPE; -+ if (ci->pkg == BCMA_PKG_ID_BCM47189) -+ bgmac->feature_flags |= -+ BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII; -+ } else if (core->core_unit == 1) { -+ bgmac->feature_flags |= BGMAC_FEAT_IRQ_ID_OOB_6; -+ bgmac->feature_flags |= BGMAC_FEAT_CC7_IF_TYPE_RGMII; -+ } -+ break; - default: - bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; - bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK; ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -943,6 +943,27 @@ static void bgmac_chip_reset(struct bgma - bgmac_cco_ctl_maskset(bgmac, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK | - BGMAC_CHIPCTL_1_SW_TYPE_MASK), - sw_type); -+ } else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE) { -+ u32 sw_type = BGMAC_CHIPCTL_4_IF_TYPE_MII | -+ BGMAC_CHIPCTL_4_SW_TYPE_EPHY; -+ u8 et_swtype = 0; -+ char buf[4]; -+ -+ if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) { -+ if (kstrtou8(buf, 0, &et_swtype)) -+ dev_err(bgmac->dev, "Failed to parse et_swtype (%s)\n", -+ buf); -+ sw_type = (et_swtype & 0x0f) << 12; -+ } else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII) { -+ sw_type = BGMAC_CHIPCTL_4_IF_TYPE_RGMII | -+ BGMAC_CHIPCTL_4_SW_TYPE_RGMII; -+ } -+ bgmac_cco_ctl_maskset(bgmac, 4, ~(BGMAC_CHIPCTL_4_IF_TYPE_MASK | -+ BGMAC_CHIPCTL_4_SW_TYPE_MASK), -+ sw_type); -+ } else if (bgmac->feature_flags & BGMAC_FEAT_CC7_IF_TYPE_RGMII) { -+ bgmac_cco_ctl_maskset(bgmac, 7, ~BGMAC_CHIPCTL_7_IF_TYPE_MASK, -+ BGMAC_CHIPCTL_7_IF_TYPE_RGMII); - } - - if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw) -@@ -1486,6 +1507,10 @@ int bgmac_enet_probe(struct bgmac *info) - */ - bgmac_clk_enable(bgmac, 0); - -+ /* This seems to be fixing IRQ by assigning OOB #6 to the core */ -+ if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6) -+ bgmac_idm_write(bgmac, BCMA_OOB_SEL_OUT_A30, 0x86); -+ - bgmac_chip_reset(bgmac); - - err = bgmac_dma_alloc(bgmac); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -369,6 +369,21 @@ - #define BGMAC_CHIPCTL_1_SW_TYPE_RGMII 0x000000C0 - #define BGMAC_CHIPCTL_1_RXC_DLL_BYPASS 0x00010000 - -+#define BGMAC_CHIPCTL_4_IF_TYPE_MASK 0x00003000 -+#define BGMAC_CHIPCTL_4_IF_TYPE_RMII 0x00000000 -+#define BGMAC_CHIPCTL_4_IF_TYPE_MII 0x00001000 -+#define BGMAC_CHIPCTL_4_IF_TYPE_RGMII 0x00002000 -+#define BGMAC_CHIPCTL_4_SW_TYPE_MASK 0x0000C000 -+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHY 0x00000000 -+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYMII 0x00004000 -+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYRMII 0x00008000 -+#define BGMAC_CHIPCTL_4_SW_TYPE_RGMII 0x0000C000 -+ -+#define BGMAC_CHIPCTL_7_IF_TYPE_MASK 0x000000C0 -+#define BGMAC_CHIPCTL_7_IF_TYPE_RMII 0x00000000 -+#define BGMAC_CHIPCTL_7_IF_TYPE_MII 0x00000040 -+#define BGMAC_CHIPCTL_7_IF_TYPE_RGMII 0x00000080 -+ - #define BGMAC_WEIGHT 64 - - #define ETHER_MAX_LEN 1518 -@@ -390,6 +405,10 @@ - #define BGMAC_FEAT_NO_CLR_MIB BIT(13) - #define BGMAC_FEAT_FORCE_SPEED_2500 BIT(14) - #define BGMAC_FEAT_CMDCFG_SR_REV4 BIT(15) -+#define BGMAC_FEAT_IRQ_ID_OOB_6 BIT(16) -+#define BGMAC_FEAT_CC4_IF_SW_TYPE BIT(17) -+#define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18) -+#define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19) - - struct bgmac_slot_info { - union { ---- a/include/linux/bcma/bcma_regs.h -+++ b/include/linux/bcma/bcma_regs.h -@@ -23,6 +23,7 @@ - #define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */ - - /* Agent registers (common for every core) */ -+#define BCMA_OOB_SEL_OUT_A30 0x0100 - #define BCMA_IOCTL 0x0408 /* IO control */ - #define BCMA_IOCTL_CLK 0x0001 - #define BCMA_IOCTL_FGC 0x0002 diff --git a/target/linux/generic/pending-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch b/target/linux/generic/pending-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch deleted file mode 100644 index 272ec5c3f..000000000 --- a/target/linux/generic/pending-4.4/071-v4.9-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e2d8f646c79f26e094bfaf9b21be614d1e148a67 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 17 Aug 2016 23:11:52 +0200 -Subject: [PATCH] net: bgmac: make it clear when setting interface type to RMII -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It doesn't really change anything as BGMAC_CHIPCTL_1_IF_TYPE_RMII is -equal to 0. It make code a bit clener, so far when reading it one could -think we forgot to set a proper mode. It also keeps this mode code in -sync with other ones. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -935,7 +935,8 @@ static void bgmac_chip_reset(struct bgma - et_swtype <<= 4; - sw_type = et_swtype; - } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_EPHYRMII) { -- sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII; -+ sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RMII | -+ BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII; - } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_RGMII) { - sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII | - BGMAC_CHIPCTL_1_SW_TYPE_RGMII; diff --git a/target/linux/generic/pending-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch b/target/linux/generic/pending-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch deleted file mode 100644 index 830d8ccde..000000000 --- a/target/linux/generic/pending-4.4/071-v4.9-0003-net-bgmac-Fix-errant-feature-flag-check.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 4af1474e6198b10fee7bb20e81f7e033ad1b586c Mon Sep 17 00:00:00 2001 -From: Jon Mason -Date: Wed, 5 Oct 2016 15:36:49 -0400 -Subject: [PATCH] net: bgmac: Fix errant feature flag check -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -During the conversion to the feature flags, a check against -ci->id != BCMA_CHIP_ID_BCM47162 -became -bgmac->feature_flags & BGMAC_FEAT_CLKCTLS -instead of -!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLS) - -Reported-by: Rafał Miłecki -Signed-off-by: Jon Mason -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1049,7 +1049,7 @@ static void bgmac_enable(struct bgmac *b - - mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >> - BGMAC_DS_MM_SHIFT; -- if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0) -+ if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) || mode != 0) - bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT); - if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2) - bgmac_cco_ctl_maskset(bgmac, 1, ~0, diff --git a/target/linux/generic/pending-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch b/target/linux/generic/pending-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch deleted file mode 100644 index 5721abcf9..000000000 --- a/target/linux/generic/pending-4.4/071-v4.9-0004-net-bgmac-fix-spelling-mistake-connecton-connection.patch +++ /dev/null @@ -1,25 +0,0 @@ -From c121f72a66c5f92fbe2fc53baa274eef39875cec Mon Sep 17 00:00:00 2001 -From: Colin Ian King -Date: Mon, 24 Oct 2016 23:46:18 +0100 -Subject: [PATCH] net: bgmac: fix spelling mistake: "connecton" -> "connection" - -trivial fix to spelling mistake in dev_err message - -Signed-off-by: Colin Ian King -Acked-by: Jon Mason -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1468,7 +1468,7 @@ static int bgmac_phy_connect(struct bgma - phy_dev = phy_connect(bgmac->net_dev, bus_id, &bgmac_adjust_link, - PHY_INTERFACE_MODE_MII); - if (IS_ERR(phy_dev)) { -- dev_err(bgmac->dev, "PHY connecton failed\n"); -+ dev_err(bgmac->dev, "PHY connection failed\n"); - return PTR_ERR(phy_dev); - } - diff --git a/target/linux/generic/pending-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch b/target/linux/generic/pending-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch deleted file mode 100644 index e9bf06c87..000000000 --- a/target/linux/generic/pending-4.4/071-v4.9-0005-net-bgmac-fix-reversed-checks-for-clock-control-flag.patch +++ /dev/null @@ -1,35 +0,0 @@ -From cdb26d3387f0cdf7b2a2eea581385173547ef21f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 7 Nov 2016 13:53:27 +0100 -Subject: [PATCH] net: bgmac: fix reversed checks for clock control flag - -This fixes regression introduced by patch adding feature flags. It was -already reported and patch followed (it got accepted) but it appears it -was incorrect. Instead of fixing reversed condition it broke a good one. - -This patch was verified to actually fix SoC hanges caused by bgmac on -BCM47186B0. - -Fixes: db791eb2970b ("net: ethernet: bgmac: convert to feature flags") -Fixes: 4af1474e6198 ("net: bgmac: Fix errant feature flag check") -Cc: Jon Mason -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1049,9 +1049,9 @@ static void bgmac_enable(struct bgmac *b - - mode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >> - BGMAC_DS_MM_SHIFT; -- if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) || mode != 0) -+ if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST || mode != 0) - bgmac_set(bgmac, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT); -- if (bgmac->feature_flags & BGMAC_FEAT_CLKCTLST && mode == 2) -+ if (!(bgmac->feature_flags & BGMAC_FEAT_CLKCTLST) && mode == 2) - bgmac_cco_ctl_maskset(bgmac, 1, ~0, - BGMAC_CHIPCTL_1_RXC_DLL_BYPASS); - diff --git a/target/linux/generic/pending-4.4/072-net-add-devm-version-of-alloc_etherdev_mqs-function.patch b/target/linux/generic/pending-4.4/072-net-add-devm-version-of-alloc_etherdev_mqs-function.patch deleted file mode 100644 index be03cca9e..000000000 --- a/target/linux/generic/pending-4.4/072-net-add-devm-version-of-alloc_etherdev_mqs-function.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 40be0dda0725886b623d67868db3219a2e74683b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sat, 28 Jan 2017 15:15:42 +0100 -Subject: [PATCH] net: add devm version of alloc_etherdev_mqs function - -This patch adds devm_alloc_etherdev_mqs function and devm_alloc_etherdev -macro. These can be used for simpler netdev allocation without having to -care about calling free_netdev. - -Thanks to this change drivers, their error paths and removal paths may -get simpler by a bit. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - include/linux/etherdevice.h | 5 +++++ - net/ethernet/eth.c | 28 ++++++++++++++++++++++++++++ - 2 files changed, 33 insertions(+) - ---- a/include/linux/etherdevice.h -+++ b/include/linux/etherdevice.h -@@ -51,6 +51,11 @@ struct net_device *alloc_etherdev_mqs(in - #define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) - #define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count) - -+struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv, -+ unsigned int txqs, -+ unsigned int rxqs); -+#define devm_alloc_etherdev(dev, sizeof_priv) devm_alloc_etherdev_mqs(dev, sizeof_priv, 1, 1) -+ - struct sk_buff **eth_gro_receive(struct sk_buff **head, - struct sk_buff *skb); - int eth_gro_complete(struct sk_buff *skb, int nhoff); ---- a/net/ethernet/eth.c -+++ b/net/ethernet/eth.c -@@ -388,6 +388,34 @@ struct net_device *alloc_etherdev_mqs(in - } - EXPORT_SYMBOL(alloc_etherdev_mqs); - -+static void devm_free_netdev(struct device *dev, void *res) -+{ -+ free_netdev(*(struct net_device **)res); -+} -+ -+struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv, -+ unsigned int txqs, unsigned int rxqs) -+{ -+ struct net_device **dr; -+ struct net_device *netdev; -+ -+ dr = devres_alloc(devm_free_netdev, sizeof(*dr), GFP_KERNEL); -+ if (!dr) -+ return NULL; -+ -+ netdev = alloc_etherdev_mqs(sizeof_priv, txqs, rxqs); -+ if (!netdev) { -+ devres_free(dr); -+ return NULL; -+ } -+ -+ *dr = netdev; -+ devres_add(dev, dr); -+ -+ return netdev; -+} -+EXPORT_SYMBOL(devm_alloc_etherdev_mqs); -+ - ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len) - { - return scnprintf(buf, PAGE_SIZE, "%*phC\n", len, addr); diff --git a/target/linux/generic/pending-4.4/073-v4.10-0001-net-bgmac-allocate-struct-bgmac-just-once-don-t-copy.patch b/target/linux/generic/pending-4.4/073-v4.10-0001-net-bgmac-allocate-struct-bgmac-just-once-don-t-copy.patch deleted file mode 100644 index 544a074a7..000000000 --- a/target/linux/generic/pending-4.4/073-v4.10-0001-net-bgmac-allocate-struct-bgmac-just-once-don-t-copy.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 34a5102c3235c470a6c77fba16cb971964d9c136 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 31 Jan 2017 19:37:54 +0100 -Subject: [PATCH 1/3] net: bgmac: allocate struct bgmac just once & don't copy - it -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -So far were were allocating struct bgmac in 3 places: platform code, -bcma code and shared bgmac_enet_probe function. The reason for this was -bgmac_enet_probe: -1) Requiring early-filled struct bgmac -2) Calling alloc_etherdev on its own in order to use netdev_priv later - -This solution got few drawbacks: -1) Was duplicating allocating code -2) Required copying early-filled struct -3) Resulted in platform/bcma code having access only to unused struct - -Solve this situation by simply extracting some probe code into the new -bgmac_alloc function. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 4 +--- - drivers/net/ethernet/broadcom/bgmac-platform.c | 2 +- - drivers/net/ethernet/broadcom/bgmac.c | 25 +++++++++++++++++-------- - drivers/net/ethernet/broadcom/bgmac.h | 3 ++- - 4 files changed, 21 insertions(+), 13 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -99,12 +99,11 @@ static int bgmac_probe(struct bcma_devic - u8 *mac; - int err; - -- bgmac = kzalloc(sizeof(*bgmac), GFP_KERNEL); -+ bgmac = bgmac_alloc(&core->dev); - if (!bgmac) - return -ENOMEM; - - bgmac->bcma.core = core; -- bgmac->dev = &core->dev; - bgmac->dma_dev = core->dma_dev; - bgmac->irq = core->irq; - -@@ -285,7 +284,6 @@ static int bgmac_probe(struct bcma_devic - err1: - bcma_mdio_mii_unregister(bgmac->mii_bus); - err: -- kfree(bgmac); - bcma_set_drvdata(core, NULL); - - return err; ---- a/drivers/net/ethernet/broadcom/bgmac-platform.c -+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c -@@ -93,7 +93,7 @@ static int bgmac_probe(struct platform_d - struct resource *regs; - const u8 *mac_addr; - -- bgmac = devm_kzalloc(&pdev->dev, sizeof(*bgmac), GFP_KERNEL); -+ bgmac = bgmac_alloc(&pdev->dev); - if (!bgmac) - return -ENOMEM; - ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -1475,22 +1475,32 @@ static int bgmac_phy_connect(struct bgma - return 0; - } - --int bgmac_enet_probe(struct bgmac *info) -+struct bgmac *bgmac_alloc(struct device *dev) - { - struct net_device *net_dev; - struct bgmac *bgmac; -- int err; - - /* Allocation and references */ -- net_dev = alloc_etherdev(sizeof(*bgmac)); -+ net_dev = devm_alloc_etherdev(dev, sizeof(*bgmac)); - if (!net_dev) -- return -ENOMEM; -+ return NULL; - - net_dev->netdev_ops = &bgmac_netdev_ops; - net_dev->ethtool_ops = &bgmac_ethtool_ops; -+ - bgmac = netdev_priv(net_dev); -- memcpy(bgmac, info, sizeof(*bgmac)); -+ bgmac->dev = dev; - bgmac->net_dev = net_dev; -+ -+ return bgmac; -+} -+EXPORT_SYMBOL_GPL(bgmac_alloc); -+ -+int bgmac_enet_probe(struct bgmac *bgmac) -+{ -+ struct net_device *net_dev = bgmac->net_dev; -+ int err; -+ - net_dev->irq = bgmac->irq; - SET_NETDEV_DEV(net_dev, bgmac->dev); - -@@ -1517,7 +1527,7 @@ int bgmac_enet_probe(struct bgmac *info) - err = bgmac_dma_alloc(bgmac); - if (err) { - dev_err(bgmac->dev, "Unable to alloc memory for DMA\n"); -- goto err_netdev_free; -+ goto err_out; - } - - bgmac->int_mask = BGMAC_IS_ERRMASK | BGMAC_IS_RX | BGMAC_IS_TX_MASK; -@@ -1553,8 +1563,7 @@ err_phy_disconnect: - phy_disconnect(net_dev->phydev); - err_dma_free: - bgmac_dma_free(bgmac); --err_netdev_free: -- free_netdev(net_dev); -+err_out: - - return err; - } ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -515,7 +515,8 @@ struct bgmac { - u32 set); - }; - --int bgmac_enet_probe(struct bgmac *info); -+struct bgmac *bgmac_alloc(struct device *dev); -+int bgmac_enet_probe(struct bgmac *bgmac); - void bgmac_enet_remove(struct bgmac *bgmac); - - struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr); diff --git a/target/linux/generic/pending-4.4/073-v4.10-0002-net-bgmac-drop-struct-bcma_mdio-we-don-t-need-anymor.patch b/target/linux/generic/pending-4.4/073-v4.10-0002-net-bgmac-drop-struct-bcma_mdio-we-don-t-need-anymor.patch deleted file mode 100644 index 8848f619e..000000000 --- a/target/linux/generic/pending-4.4/073-v4.10-0002-net-bgmac-drop-struct-bcma_mdio-we-don-t-need-anymor.patch +++ /dev/null @@ -1,274 +0,0 @@ -From aa8863e5d49417094b9457a0d53e8505e95a1863 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 31 Jan 2017 19:37:55 +0100 -Subject: [PATCH 2/3] net: bgmac: drop struct bcma_mdio we don't need anymore -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Adding struct bcma_mdio was a workaround for bcma code not having access -to the struct bgmac used in the core code. Now we don't duplicate this -struct we can just use it internally in bcma code. - -This simplifies code & allows access to all bgmac driver details from -all places in bcma code. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 98 ++++++++++--------------- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 +- - drivers/net/ethernet/broadcom/bgmac.h | 2 +- - 3 files changed, 42 insertions(+), 60 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -@@ -12,11 +12,6 @@ - #include - #include "bgmac.h" - --struct bcma_mdio { -- struct bcma_device *core; -- u8 phyaddr; --}; -- - static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask, - u32 value, int timeout) - { -@@ -37,7 +32,7 @@ static bool bcma_mdio_wait_value(struct - * PHY ops - **************************************************/ - --static u16 bcma_mdio_phy_read(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg) -+static u16 bcma_mdio_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg) - { - struct bcma_device *core; - u16 phy_access_addr; -@@ -56,12 +51,12 @@ static u16 bcma_mdio_phy_read(struct bcm - BUILD_BUG_ON(BGMAC_PC_MCT_SHIFT != BCMA_GMAC_CMN_PC_MCT_SHIFT); - BUILD_BUG_ON(BGMAC_PC_MTE != BCMA_GMAC_CMN_PC_MTE); - -- if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) { -- core = bcma_mdio->core->bus->drv_gmac_cmn.core; -+ if (bgmac->bcma.core->id.id == BCMA_CORE_4706_MAC_GBIT) { -+ core = bgmac->bcma.core->bus->drv_gmac_cmn.core; - phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS; - phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL; - } else { -- core = bcma_mdio->core; -+ core = bgmac->bcma.core; - phy_access_addr = BGMAC_PHY_ACCESS; - phy_ctl_addr = BGMAC_PHY_CNTL; - } -@@ -87,7 +82,7 @@ static u16 bcma_mdio_phy_read(struct bcm - } - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */ --static int bcma_mdio_phy_write(struct bcma_mdio *bcma_mdio, u8 phyaddr, u8 reg, -+static int bcma_mdio_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, - u16 value) - { - struct bcma_device *core; -@@ -95,12 +90,12 @@ static int bcma_mdio_phy_write(struct bc - u16 phy_ctl_addr; - u32 tmp; - -- if (bcma_mdio->core->id.id == BCMA_CORE_4706_MAC_GBIT) { -- core = bcma_mdio->core->bus->drv_gmac_cmn.core; -+ if (bgmac->bcma.core->id.id == BCMA_CORE_4706_MAC_GBIT) { -+ core = bgmac->bcma.core->bus->drv_gmac_cmn.core; - phy_access_addr = BCMA_GMAC_CMN_PHY_ACCESS; - phy_ctl_addr = BCMA_GMAC_CMN_PHY_CTL; - } else { -- core = bcma_mdio->core; -+ core = bgmac->bcma.core; - phy_access_addr = BGMAC_PHY_ACCESS; - phy_ctl_addr = BGMAC_PHY_CNTL; - } -@@ -110,8 +105,8 @@ static int bcma_mdio_phy_write(struct bc - tmp |= phyaddr; - bcma_write32(core, phy_ctl_addr, tmp); - -- bcma_write32(bcma_mdio->core, BGMAC_INT_STATUS, BGMAC_IS_MDIO); -- if (bcma_read32(bcma_mdio->core, BGMAC_INT_STATUS) & BGMAC_IS_MDIO) -+ bcma_write32(bgmac->bcma.core, BGMAC_INT_STATUS, BGMAC_IS_MDIO); -+ if (bcma_read32(bgmac->bcma.core, BGMAC_INT_STATUS) & BGMAC_IS_MDIO) - dev_warn(&core->dev, "Error setting MDIO int\n"); - - tmp = BGMAC_PA_START; -@@ -132,39 +127,39 @@ static int bcma_mdio_phy_write(struct bc - } - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyinit */ --static void bcma_mdio_phy_init(struct bcma_mdio *bcma_mdio) -+static void bcma_mdio_phy_init(struct bgmac *bgmac) - { -- struct bcma_chipinfo *ci = &bcma_mdio->core->bus->chipinfo; -+ struct bcma_chipinfo *ci = &bgmac->bcma.core->bus->chipinfo; - u8 i; - - if (ci->id == BCMA_CHIP_ID_BCM5356) { - for (i = 0; i < 5; i++) { -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x008b); -- bcma_mdio_phy_write(bcma_mdio, i, 0x15, 0x0100); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -- bcma_mdio_phy_write(bcma_mdio, i, 0x12, 0x2aaa); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x008b); -+ bcma_mdio_phy_write(bgmac, i, 0x15, 0x0100); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bgmac, i, 0x12, 0x2aaa); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); - } - } - if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) || - (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) || - (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg != 9)) { -- struct bcma_drv_cc *cc = &bcma_mdio->core->bus->drv_cc; -+ struct bcma_drv_cc *cc = &bgmac->bcma.core->bus->drv_cc; - - bcma_chipco_chipctl_maskset(cc, 2, ~0xc0000000, 0); - bcma_chipco_chipctl_maskset(cc, 4, ~0x80000000, 0); - for (i = 0; i < 5; i++) { -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -- bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5284); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -- bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x0010); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000f); -- bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x5296); -- bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x1073); -- bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9073); -- bcma_mdio_phy_write(bcma_mdio, i, 0x16, 0x52b6); -- bcma_mdio_phy_write(bcma_mdio, i, 0x17, 0x9273); -- bcma_mdio_phy_write(bcma_mdio, i, 0x1f, 0x000b); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bgmac, i, 0x16, 0x5284); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); -+ bcma_mdio_phy_write(bgmac, i, 0x17, 0x0010); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000f); -+ bcma_mdio_phy_write(bgmac, i, 0x16, 0x5296); -+ bcma_mdio_phy_write(bgmac, i, 0x17, 0x1073); -+ bcma_mdio_phy_write(bgmac, i, 0x17, 0x9073); -+ bcma_mdio_phy_write(bgmac, i, 0x16, 0x52b6); -+ bcma_mdio_phy_write(bgmac, i, 0x17, 0x9273); -+ bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); - } - } - } -@@ -172,17 +167,17 @@ static void bcma_mdio_phy_init(struct bc - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */ - static int bcma_mdio_phy_reset(struct mii_bus *bus) - { -- struct bcma_mdio *bcma_mdio = bus->priv; -- u8 phyaddr = bcma_mdio->phyaddr; -+ struct bgmac *bgmac = bus->priv; -+ u8 phyaddr = bgmac->phyaddr; - -- if (bcma_mdio->phyaddr == BGMAC_PHY_NOREGS) -+ if (phyaddr == BGMAC_PHY_NOREGS) - return 0; - -- bcma_mdio_phy_write(bcma_mdio, phyaddr, MII_BMCR, BMCR_RESET); -+ bcma_mdio_phy_write(bgmac, phyaddr, MII_BMCR, BMCR_RESET); - udelay(100); -- if (bcma_mdio_phy_read(bcma_mdio, phyaddr, MII_BMCR) & BMCR_RESET) -- dev_err(&bcma_mdio->core->dev, "PHY reset failed\n"); -- bcma_mdio_phy_init(bcma_mdio); -+ if (bcma_mdio_phy_read(bgmac, phyaddr, MII_BMCR) & BMCR_RESET) -+ dev_err(bgmac->dev, "PHY reset failed\n"); -+ bcma_mdio_phy_init(bgmac); - - return 0; - } -@@ -202,16 +197,12 @@ static int bcma_mdio_mii_write(struct mi - return bcma_mdio_phy_write(bus->priv, mii_id, regnum, value); - } - --struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr) -+struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac) - { -- struct bcma_mdio *bcma_mdio; -+ struct bcma_device *core = bgmac->bcma.core; - struct mii_bus *mii_bus; - int i, err; - -- bcma_mdio = kzalloc(sizeof(*bcma_mdio), GFP_KERNEL); -- if (!bcma_mdio) -- return ERR_PTR(-ENOMEM); -- - mii_bus = mdiobus_alloc(); - if (!mii_bus) { - err = -ENOMEM; -@@ -221,12 +212,12 @@ struct mii_bus *bcma_mdio_mii_register(s - mii_bus->name = "bcma_mdio mii bus"; - sprintf(mii_bus->id, "%s-%d-%d", "bcma_mdio", core->bus->num, - core->core_unit); -- mii_bus->priv = bcma_mdio; -+ mii_bus->priv = bgmac; - mii_bus->read = bcma_mdio_mii_read; - mii_bus->write = bcma_mdio_mii_write; - mii_bus->reset = bcma_mdio_phy_reset; - mii_bus->parent = &core->dev; -- mii_bus->phy_mask = ~(1 << phyaddr); -+ mii_bus->phy_mask = ~(1 << bgmac->phyaddr); - - mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL); - if (!mii_bus->irq) { -@@ -236,9 +227,6 @@ struct mii_bus *bcma_mdio_mii_register(s - for (i = 0; i < PHY_MAX_ADDR; i++) - mii_bus->irq[i] = PHY_POLL; - -- bcma_mdio->core = core; -- bcma_mdio->phyaddr = phyaddr; -- - err = mdiobus_register(mii_bus); - if (err) { - dev_err(&core->dev, "Registration of mii bus failed\n"); -@@ -252,24 +240,18 @@ err_free_irq: - err_free_bus: - mdiobus_free(mii_bus); - err: -- kfree(bcma_mdio); - return ERR_PTR(err); - } - EXPORT_SYMBOL_GPL(bcma_mdio_mii_register); - - void bcma_mdio_mii_unregister(struct mii_bus *mii_bus) - { -- struct bcma_mdio *bcma_mdio; -- - if (!mii_bus) - return; - -- bcma_mdio = mii_bus->priv; -- - mdiobus_unregister(mii_bus); - kfree(mii_bus->irq); - mdiobus_free(mii_bus); -- kfree(bcma_mdio); - } - EXPORT_SYMBOL_GPL(bcma_mdio_mii_unregister); - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -159,7 +159,7 @@ static int bgmac_probe(struct bcma_devic - - if (!bgmac_is_bcm4707_family(core) && - !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) { -- mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); -+ mii_bus = bcma_mdio_mii_register(bgmac); - if (IS_ERR(mii_bus)) { - err = PTR_ERR(mii_bus); - goto err; ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -519,7 +519,7 @@ struct bgmac *bgmac_alloc(struct device - int bgmac_enet_probe(struct bgmac *bgmac); - void bgmac_enet_remove(struct bgmac *bgmac); - --struct mii_bus *bcma_mdio_mii_register(struct bcma_device *core, u8 phyaddr); -+struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac); - void bcma_mdio_mii_unregister(struct mii_bus *mii_bus); - - static inline u32 bgmac_read(struct bgmac *bgmac, u16 offset) diff --git a/target/linux/generic/pending-4.4/073-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch b/target/linux/generic/pending-4.4/073-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch deleted file mode 100644 index d1be3e3f4..000000000 --- a/target/linux/generic/pending-4.4/073-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 8e6f31baba7e2c13ab7e954fe6179420a7545a8b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 31 Jan 2017 19:37:56 +0100 -Subject: [PATCH 3/3] net: bgmac: use PHY subsystem for initializing PHY -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This adds support for using bgmac with PHYs supported by standalone PHY -drivers. Having any PHY initialization in bgmac is hacky and shouldn't -be extended but rather removed if anyone has hardware to test it. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c -@@ -132,6 +132,10 @@ static void bcma_mdio_phy_init(struct bg - struct bcma_chipinfo *ci = &bgmac->bcma.core->bus->chipinfo; - u8 i; - -+ /* For some legacy hardware we do chipset-based PHY initialization here -+ * without even detecting PHY ID. It's hacky and should be cleaned as -+ * soon as someone can test it. -+ */ - if (ci->id == BCMA_CHIP_ID_BCM5356) { - for (i = 0; i < 5; i++) { - bcma_mdio_phy_write(bgmac, i, 0x1f, 0x008b); -@@ -140,6 +144,7 @@ static void bcma_mdio_phy_init(struct bg - bcma_mdio_phy_write(bgmac, i, 0x12, 0x2aaa); - bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); - } -+ return; - } - if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) || - (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) || -@@ -161,7 +166,12 @@ static void bcma_mdio_phy_init(struct bg - bcma_mdio_phy_write(bgmac, i, 0x17, 0x9273); - bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b); - } -+ return; - } -+ -+ /* For all other hw do initialization using PHY subsystem. */ -+ if (bgmac->net_dev && bgmac->net_dev->phydev) -+ phy_init_hw(bgmac->net_dev->phydev); - } - - /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */ diff --git a/target/linux/generic/pending-4.4/073-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch b/target/linux/generic/pending-4.4/073-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch deleted file mode 100644 index 27cd660b5..000000000 --- a/target/linux/generic/pending-4.4/073-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 12acd136913ccdf394eeb2bc8686ff5505368119 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 12 Oct 2017 10:21:26 +0200 -Subject: [PATCH] net: bgmac: enable master mode for BCM54210E and B50212E PHYs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -There are 4 very similar PHYs: -0x600d84a1: BCM54210E (rev B0) -0x600d84a2: BCM54210E (rev B1) -0x600d84a5: B50212E (rev B0) -0x600d84a6: B50212E (rev B1) -that need setting master mode manually. It's because they run in slave -mode by default with Automatic Slave/Master configuration disabled which -can lead to unreliable connection with massive ping loss. - -So far it was reported for a board with BCM47189 SoC and B50212E B1 PHY -connected to the bgmac supported ethernet device. Telling PHY driver to -setup PHY properly solves this issue. - -Signed-off-by: Rafał Miłecki -Signed-off-by: David S. Miller ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -159,13 +159,19 @@ static int bgmac_probe(struct bcma_devic - - if (!bgmac_is_bcm4707_family(core) && - !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) { -+ struct phy_device *phydev; -+ - mii_bus = bcma_mdio_mii_register(bgmac); - if (IS_ERR(mii_bus)) { - err = PTR_ERR(mii_bus); - goto err; - } -- - bgmac->mii_bus = mii_bus; -+ -+ phydev = bgmac->mii_bus->phy_map[bgmac->phyaddr]; -+ if (ci->id == BCMA_CHIP_ID_BCM53573 && phydev && -+ (phydev->drv->phy_id & phydev->drv->phy_id_mask) == PHY_ID_BCM54210E) -+ phydev->dev_flags |= PHY_BRCM_EN_MASTER_MODE; - } - - if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) { diff --git a/target/linux/generic/pending-4.4/074-NET-PHY-adds-driver-for-lantiq-PHY11G.patch b/target/linux/generic/pending-4.4/074-NET-PHY-adds-driver-for-lantiq-PHY11G.patch deleted file mode 100644 index e24099ef4..000000000 --- a/target/linux/generic/pending-4.4/074-NET-PHY-adds-driver-for-lantiq-PHY11G.patch +++ /dev/null @@ -1,537 +0,0 @@ -From 0a63ab263725c427051a8bbaa0732b749627da27 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 7 Aug 2014 18:15:36 +0200 -Subject: [PATCH 23/36] NET: PHY: adds driver for lantiq PHY11G - -Signed-off-by: John Crispin ---- - drivers/net/phy/Kconfig | 5 + - drivers/net/phy/Makefile | 1 + - drivers/net/phy/lantiq.c | 231 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 237 insertions(+) - create mode 100644 drivers/net/phy/lantiq.c - ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -156,6 +156,11 @@ config MICROCHIP_PHY - help - Supports the LAN88XX PHYs. - -+config LANTIQ_PHY -+ tristate "Driver for Lantiq PHYs" -+ ---help--- -+ Supports the 11G and 22F PHYs. -+ - 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 -@@ -30,6 +30,7 @@ obj-$(CONFIG_DP83848_PHY) += dp83848.o - obj-$(CONFIG_DP83867_PHY) += dp83867.o - obj-$(CONFIG_STE10XP) += ste10Xp.o - obj-$(CONFIG_MICREL_PHY) += micrel.o -+obj-$(CONFIG_LANTIQ_PHY) += lantiq.o - obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o - obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o - obj-$(CONFIG_AT803X_PHY) += at803x.o ---- /dev/null -+++ b/drivers/net/phy/lantiq.c -@@ -0,0 +1,278 @@ -+/* -+ * 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. -+ * -+ * Copyright (C) 2012 Daniel Schwierzeck -+ */ -+ -+#include -+#include -+#include -+ -+#define MII_MMDCTRL 0x0d -+#define MII_MMDDATA 0x0e -+ -+#define MII_VR9_11G_IMASK 0x19 /* interrupt mask */ -+#define MII_VR9_11G_ISTAT 0x1a /* interrupt status */ -+ -+#define INT_VR9_11G_WOL BIT(15) /* Wake-On-LAN */ -+#define INT_VR9_11G_ANE BIT(11) /* Auto-Neg error */ -+#define INT_VR9_11G_ANC BIT(10) /* Auto-Neg complete */ -+#define INT_VR9_11G_ADSC BIT(5) /* Link auto-downspeed detect */ -+#define INT_VR9_11G_DXMC BIT(2) /* Duplex mode change */ -+#define INT_VR9_11G_LSPC BIT(1) /* Link speed change */ -+#define INT_VR9_11G_LSTC BIT(0) /* Link state change */ -+#define INT_VR9_11G_MASK (INT_VR9_11G_LSTC | INT_VR9_11G_ADSC) -+ -+#define ADVERTISED_MPD BIT(10) /* Multi-port device */ -+ -+#define MMD_DEVAD 0x1f -+#define MMD_ACTYPE_SHIFT 14 -+#define MMD_ACTYPE_ADDRESS (0 << MMD_ACTYPE_SHIFT) -+#define MMD_ACTYPE_DATA (1 << MMD_ACTYPE_SHIFT) -+#define MMD_ACTYPE_DATA_PI (2 << MMD_ACTYPE_SHIFT) -+#define MMD_ACTYPE_DATA_PIWR (3 << MMD_ACTYPE_SHIFT) -+ -+static __maybe_unused int vr9_gphy_mmd_read(struct phy_device *phydev, -+ u16 regnum) -+{ -+ phy_write(phydev, MII_MMDCTRL, MMD_ACTYPE_ADDRESS | MMD_DEVAD); -+ phy_write(phydev, MII_MMDDATA, regnum); -+ phy_write(phydev, MII_MMDCTRL, MMD_ACTYPE_DATA | MMD_DEVAD); -+ -+ return phy_read(phydev, MII_MMDDATA); -+} -+ -+static __maybe_unused int vr9_gphy_mmd_write(struct phy_device *phydev, -+ u16 regnum, u16 val) -+{ -+ phy_write(phydev, MII_MMDCTRL, MMD_ACTYPE_ADDRESS | MMD_DEVAD); -+ phy_write(phydev, MII_MMDDATA, regnum); -+ phy_write(phydev, MII_MMDCTRL, MMD_ACTYPE_DATA | MMD_DEVAD); -+ phy_write(phydev, MII_MMDDATA, val); -+ -+ return 0; -+} -+ -+#if IS_ENABLED(CONFIG_OF_MDIO) -+static int vr9_gphy_of_reg_init(struct phy_device *phydev) -+{ -+ u32 tmp; -+ -+ /* store the led values if one was passed by the devicetree */ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,ledch", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e0, tmp); -+ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,ledcl", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e1, tmp); -+ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led0h", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e2, tmp); -+ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led0l", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e3, tmp); -+ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led1h", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e4, tmp); -+ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led1l", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e5, tmp); -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led2h", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e6, tmp); -+ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led2l", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e7, tmp); -+ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led3h", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e8, tmp); -+ -+ if (!of_property_read_u32(phydev->dev.of_node, "lantiq,led3l", &tmp)) -+ vr9_gphy_mmd_write(phydev, 0x1e9, tmp); -+ -+ return 0; -+} -+#else -+static int vr9_gphy_of_reg_init(struct phy_device *phydev) -+{ -+ return 0; -+} -+#endif /* CONFIG_OF_MDIO */ -+ -+static int vr9_gphy_config_init(struct phy_device *phydev) -+{ -+ int err; -+ -+ dev_dbg(&phydev->dev, "%s\n", __func__); -+ -+ /* Mask all interrupts */ -+ err = phy_write(phydev, MII_VR9_11G_IMASK, 0); -+ if (err) -+ return err; -+ -+ /* Clear all pending interrupts */ -+ phy_read(phydev, MII_VR9_11G_ISTAT); -+ -+ vr9_gphy_mmd_write(phydev, 0x1e0, 0xc0); -+ vr9_gphy_mmd_write(phydev, 0x1e1, 0x00); -+ vr9_gphy_mmd_write(phydev, 0x1e2, 0x70); -+ vr9_gphy_mmd_write(phydev, 0x1e3, 0x03); -+ vr9_gphy_mmd_write(phydev, 0x1e4, 0x70); -+ vr9_gphy_mmd_write(phydev, 0x1e5, 0x03); -+ vr9_gphy_mmd_write(phydev, 0x1e6, 0x70); -+ vr9_gphy_mmd_write(phydev, 0x1e7, 0x03); -+ vr9_gphy_mmd_write(phydev, 0x1e8, 0x70); -+ vr9_gphy_mmd_write(phydev, 0x1e9, 0x03); -+ -+ vr9_gphy_of_reg_init(phydev); -+ -+ return 0; -+} -+ -+static int vr9_gphy_config_aneg(struct phy_device *phydev) -+{ -+ int reg, err; -+ -+ /* Advertise as multi-port device */ -+ reg = phy_read(phydev, MII_CTRL1000); -+ reg |= ADVERTISED_MPD; -+ err = phy_write(phydev, MII_CTRL1000, reg); -+ if (err) -+ return err; -+ -+ return genphy_config_aneg(phydev); -+} -+ -+static int vr9_gphy_ack_interrupt(struct phy_device *phydev) -+{ -+ int reg; -+ -+ /* -+ * Possible IRQ numbers: -+ * - IM3_IRL18 for GPHY0 -+ * - IM3_IRL17 for GPHY1 -+ * -+ * Due to a silicon bug IRQ lines are not really independent from -+ * each other. Sometimes the two lines are driven at the same time -+ * if only one GPHY core raises the interrupt. -+ */ -+ -+ reg = phy_read(phydev, MII_VR9_11G_ISTAT); -+ -+ return (reg < 0) ? reg : 0; -+} -+ -+static int vr9_gphy_did_interrupt(struct phy_device *phydev) -+{ -+ int reg; -+ -+ reg = phy_read(phydev, MII_VR9_11G_ISTAT); -+ -+ return reg > 0; -+} -+ -+static int vr9_gphy_config_intr(struct phy_device *phydev) -+{ -+ int err; -+ -+ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) -+ err = phy_write(phydev, MII_VR9_11G_IMASK, INT_VR9_11G_MASK); -+ else -+ err = phy_write(phydev, MII_VR9_11G_IMASK, 0); -+ -+ return err; -+} -+ -+static struct phy_driver lantiq_phy[] = { -+ { -+ .phy_id = 0xd565a400, -+ .phy_id_mask = 0xfffffff8, -+ .name = "Lantiq XWAY PEF7071", -+ .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), -+ .flags = 0, /*PHY_HAS_INTERRUPT,*/ -+ .config_init = vr9_gphy_config_init, -+ .config_aneg = vr9_gphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = vr9_gphy_ack_interrupt, -+ .did_interrupt = vr9_gphy_did_interrupt, -+ .config_intr = vr9_gphy_config_intr, -+ .driver = { .owner = THIS_MODULE }, -+ }, { -+ .phy_id = 0x030260D0, -+ .phy_id_mask = 0xfffffff0, -+ .name = "Lantiq XWAY VR9 GPHY 11G v1.3", -+ .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), -+ .flags = 0, /*PHY_HAS_INTERRUPT,*/ -+ .config_init = vr9_gphy_config_init, -+ .config_aneg = vr9_gphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = vr9_gphy_ack_interrupt, -+ .did_interrupt = vr9_gphy_did_interrupt, -+ .config_intr = vr9_gphy_config_intr, -+ .driver = { .owner = THIS_MODULE }, -+ }, { -+ .phy_id = 0xd565a408, -+ .phy_id_mask = 0xfffffff8, -+ .name = "Lantiq XWAY VR9 GPHY 11G v1.4", -+ .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), -+ .flags = 0, /*PHY_HAS_INTERRUPT,*/ -+ .config_init = vr9_gphy_config_init, -+ .config_aneg = vr9_gphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = vr9_gphy_ack_interrupt, -+ .did_interrupt = vr9_gphy_did_interrupt, -+ .config_intr = vr9_gphy_config_intr, -+ .driver = { .owner = THIS_MODULE }, -+ }, { -+ .phy_id = 0xd565a418, -+ .phy_id_mask = 0xfffffff8, -+ .name = "Lantiq XWAY XRX PHY22F v1.4", -+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), -+ .flags = 0, /*PHY_HAS_INTERRUPT,*/ -+ .config_init = vr9_gphy_config_init, -+ .config_aneg = vr9_gphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = vr9_gphy_ack_interrupt, -+ .did_interrupt = vr9_gphy_did_interrupt, -+ .config_intr = vr9_gphy_config_intr, -+ .driver = { .owner = THIS_MODULE }, -+ }, -+}; -+ -+static int __init ltq_phy_init(void) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(lantiq_phy); i++) { -+ int err = phy_driver_register(&lantiq_phy[i]); -+ if (err) -+ pr_err("lantiq_phy: failed to load %s\n", lantiq_phy[i].name); -+ } -+ -+ return 0; -+} -+ -+static void __exit ltq_phy_exit(void) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(lantiq_phy); i++) -+ phy_driver_unregister(&lantiq_phy[i]); -+} -+ -+module_init(ltq_phy_init); -+module_exit(ltq_phy_exit); -+ -+MODULE_DESCRIPTION("Lantiq PHY drivers"); -+MODULE_AUTHOR("Daniel Schwierzeck "); -+MODULE_LICENSE("GPL"); ---- /dev/null -+++ b/Documentation/devicetree/bindings/phy/phy-lanitq.txt -@@ -0,0 +1,216 @@ -+Lanitq PHY binding -+============================================ -+ -+This devicetree binding controls the lantiq ethernet phys led functionality. -+ -+Example: -+ mdio@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "lantiq,xrx200-mdio"; -+ phy5: ethernet-phy@5 { -+ reg = <0x1>; -+ compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; -+ }; -+ phy11: ethernet-phy@11 { -+ reg = <0x11>; -+ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; -+ lantiq,led2h = <0x00>; -+ lantiq,led2l = <0x03>; -+ }; -+ phy12: ethernet-phy@12 { -+ reg = <0x12>; -+ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; -+ lantiq,led1h = <0x00>; -+ lantiq,led1l = <0x03>; -+ }; -+ phy13: ethernet-phy@13 { -+ reg = <0x13>; -+ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; -+ lantiq,led2h = <0x00>; -+ lantiq,led2l = <0x03>; -+ }; -+ phy14: ethernet-phy@14 { -+ reg = <0x14>; -+ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; -+ lantiq,led1h = <0x00>; -+ lantiq,led1l = <0x03>; -+ }; -+ }; -+ -+Register Description -+============================================ -+ -+LEDCH: -+ -+Name Hardware Reset Value -+LEDCH 0x00C5 -+ -+| 15 | | | | | | | 8 | -+========================================= -+| RES | -+========================================= -+ -+| 7 | | | | | | | 0 | -+========================================= -+| FBF | SBF |RES | NACS | -+========================================= -+ -+Field Bits Type Description -+FBF 7:6 RW Fast Blink Frequency -+ --- -+ 0x0 (00b) F02HZ 2 Hz blinking frequency -+ 0x1 (01b) F04HZ 4 Hz blinking frequency -+ 0x2 (10b) F08HZ 8 Hz blinking frequency -+ 0x3 (11b) F16HZ 16 Hz blinking frequency -+ -+SBF 5:4 RW Slow Blink Frequency -+ --- -+ 0x0 (00b) F02HZ 2 Hz blinking frequency -+ 0x1 (01b) F04HZ 4 Hz blinking frequency -+ 0x2 (10b) F08HZ 8 Hz blinking frequency -+ 0x3 (11b) F16HZ 16 Hz blinking frequency -+ -+NACS 2:0 RW Inverse of Scan Function -+ --- -+ 0x0 (000b) NONE No Function -+ 0x1 (001b) LINK Complex function enabled when link is up -+ 0x2 (010b) PDOWN Complex function enabled when device is powered-down -+ 0x3 (011b) EEE Complex function enabled when device is in EEE mode -+ 0x4 (100b) ANEG Complex function enabled when auto-negotiation is running -+ 0x5 (101b) ABIST Complex function enabled when analog self-test is running -+ 0x6 (110b) CDIAG Complex function enabled when cable diagnostics are running -+ 0x7 (111b) TEST Complex function enabled when test mode is running -+ -+LEDCL: -+ -+Name Hardware Reset Value -+LEDCL 0x0067 -+ -+| 15 | | | | | | | 8 | -+========================================= -+| RES | -+========================================= -+ -+| 7 | | | | | | | 0 | -+========================================= -+|RES | SCAN |RES | CBLINK | -+========================================= -+ -+Field Bits Type Description -+SCAN 6:4 RW Complex Scan Configuration -+ --- -+ 000 B NONE No Function -+ 001 B LINK Complex function enabled when link is up -+ 010 B PDOWN Complex function enabled when device is powered-down -+ 011 B EEE Complex function enabled when device is in EEE mode -+ 100 B ANEG Complex function enabled when auto-negotiation is running -+ 101 B ABIST Complex function enabled when analog self-test is running -+ 110 B CDIAG Complex function enabled when cable diagnostics are running -+ 111 B TEST Complex function enabled when test mode is running -+ -+CBLINK 2:0 RW Complex Blinking Configuration -+ --- -+ 000 B NONE No Function -+ 001 B LINK Complex function enabled when link is up -+ 010 B PDOWN Complex function enabled when device is powered-down -+ 011 B EEE Complex function enabled when device is in EEE mode -+ 100 B ANEG Complex function enabled when auto-negotiation is running -+ 101 B ABIST Complex function enabled when analog self-test is running -+ 110 B CDIAG Complex function enabled when cable diagnostics are running -+ 111 B TEST Complex function enabled when test mode is running -+ -+LEDxH: -+ -+Name Hardware Reset Value -+LED0H 0x0070 -+LED1H 0x0020 -+LED2H 0x0040 -+LED3H 0x0040 -+ -+| 15 | | | | | | | 8 | -+========================================= -+| RES | -+========================================= -+ -+| 7 | | | | | | | 0 | -+========================================= -+| CON | BLINKF | -+========================================= -+ -+Field Bits Type Description -+CON 7:4 RW Constant On Configuration -+ --- -+ 0x0 (0000b) NONE LED does not light up constantly -+ 0x1 (0001b) LINK10 LED is on when link is 10 Mbit/s -+ 0x2 (0010b) LINK100 LED is on when link is 100 Mbit/s -+ 0x3 (0011b) LINK10X LED is on when link is 10/100 Mbit/s -+ 0x4 (0100b) LINK1000 LED is on when link is 1000 Mbit/s -+ 0x5 (0101b) LINK10_0 LED is on when link is 10/1000 Mbit/s -+ 0x6 (0110b) LINK100X LED is on when link is 100/1000 Mbit/s -+ 0x7 (0111b) LINK10XX LED is on when link is 10/100/1000 Mbit/s -+ 0x8 (1000b) PDOWN LED is on when device is powered-down -+ 0x9 (1001b) EEE LED is on when device is in EEE mode -+ 0xA (1010b) ANEG LED is on when auto-negotiation is running -+ 0xB (1011b) ABIST LED is on when analog self-test is running -+ 0xC (1100b) CDIAG LED is on when cable diagnostics are running -+ -+BLINKF 3:0 RW Fast Blinking Configuration -+ --- -+ 0x0 (0000b) NONE No Blinking -+ 0x1 (0001b) LINK10 Blink when link is 10 Mbit/s -+ 0x2 (0010b) LINK100 Blink when link is 100 Mbit/s -+ 0x3 (0011b) LINK10X Blink when link is 10/100 Mbit/s -+ 0x4 (0100b) LINK1000 Blink when link is 1000 Mbit/s -+ 0x5 (0101b) LINK10_0 Blink when link is 10/1000 Mbit/s -+ 0x6 (0110b) LINK100X Blink when link is 100/1000 Mbit/s -+ 0x7 (0111b) LINK10XX Blink when link is 10/100/1000 Mbit/s -+ 0x8 (1000b) PDOWN Blink when device is powered-down -+ 0x9 (1001b) EEE Blink when device is in EEE mode -+ 0xA (1010b) ANEG Blink when auto-negotiation is running -+ 0xB (1011b) ABIST Blink when analog self-test is running -+ 0xC (1100b) CDIAG Blink when cable diagnostics are running -+ -+LEDxL: -+ -+Name Hardware Reset Value -+LED0L 0x0003 -+LED1L 0x0000 -+LED2L 0x0000 -+LED3L 0x0020 -+ -+| 15 | | | | | | | 8 | -+========================================= -+| RES | -+========================================= -+ -+| 7 | | | | | | | 0 | -+========================================= -+| BLINKS | PULSE | -+========================================= -+ -+Field Bits Type Description -+BLINKS 7:4 RW Slow Blinkin Configuration -+ --- -+ 0x0 (0000b) NONE No Blinking -+ 0x1 (0001b) LINK10 Blink when link is 10 Mbit/s -+ 0x2 (0010b) LINK100 Blink when link is 100 Mbit/s -+ 0x3 (0011b) LINK10X Blink when link is 10/100 Mbit/s -+ 0x4 (0100b) LINK1000 Blink when link is 1000 Mbit/s -+ 0x5 (0101b) LINK10_0 Blink when link is 10/1000 Mbit/s -+ 0x6 (0110b) LINK100X Blink when link is 100/1000 Mbit/s -+ 0x7 (0111b) LINK10XX Blink when link is 10/100/1000 Mbit/s -+ 0x8 (1000b) PDOWN Blink when device is powered-down -+ 0x9 (1001b) EEE Blink when device is in EEE mode -+ 0xA (1010b) ANEG Blink when auto-negotiation is running -+ 0xB (1011b) ABIST Blink when analog self-test is running -+ 0xC (1100b) CDIAG Blink when cable diagnostics are runningning -+ -+PULSE 3:0 RW Pulsing Configuration -+ The pulse field is a mask field by which certain events can be combined -+ --- -+ 0x0 (0000b) NONE No pulsing -+ 0x1 (0001b) TXACT Transmit activity -+ 0x2 (0010b) RXACT Receive activity -+ 0x4 (0100b) COL Collision -+ 0x8 (1000b) RES Reserved diff --git a/target/linux/generic/pending-4.4/078-0001-net-phy-update-Broadcom-drivers-to-v4.5.patch b/target/linux/generic/pending-4.4/078-0001-net-phy-update-Broadcom-drivers-to-v4.5.patch deleted file mode 100644 index 222d126f6..000000000 --- a/target/linux/generic/pending-4.4/078-0001-net-phy-update-Broadcom-drivers-to-v4.5.patch +++ /dev/null @@ -1,125 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH 1/4] net: phy: update Broadcom drivers to v4.5 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/net/phy/bcm7xxx.c -+++ b/drivers/net/phy/bcm7xxx.c -@@ -250,10 +250,6 @@ static int bcm7xxx_config_init(struct ph - phy_write(phydev, MII_BCM7XXX_AUX_MODE, MII_BCM7XX_64CLK_MDIO); - phy_read(phydev, MII_BCM7XXX_AUX_MODE); - -- /* Workaround only required for 100Mbits/sec capable PHYs */ -- if (phydev->supported & PHY_GBIT_FEATURES) -- return 0; -- - /* set shadow mode 2 */ - ret = phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, - MII_BCM7XXX_SHD_MODE_2, MII_BCM7XXX_SHD_MODE_2); -@@ -270,7 +266,7 @@ static int bcm7xxx_config_init(struct ph - phy_write(phydev, MII_BCM7XXX_100TX_FALSE_CAR, 0x7555); - - /* reset shadow mode 2 */ -- ret = phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, MII_BCM7XXX_SHD_MODE_2, 0); -+ ret = phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, 0, MII_BCM7XXX_SHD_MODE_2); - if (ret < 0) - return ret; - -@@ -307,11 +303,6 @@ static int bcm7xxx_suspend(struct phy_de - return 0; - } - --static int bcm7xxx_dummy_config_init(struct phy_device *phydev) --{ -- return 0; --} -- - #define BCM7XXX_28NM_GPHY(_oui, _name) \ - { \ - .phy_id = (_oui), \ -@@ -338,7 +329,7 @@ static struct phy_driver bcm7xxx_driver[ - .phy_id = PHY_ID_BCM7425, - .phy_id_mask = 0xfffffff0, - .name = "Broadcom BCM7425", -- .features = PHY_GBIT_FEATURES | -+ .features = PHY_BASIC_FEATURES | - SUPPORTED_Pause | SUPPORTED_Asym_Pause, - .flags = PHY_IS_INTERNAL, - .config_init = bcm7xxx_config_init, -@@ -351,7 +342,7 @@ static struct phy_driver bcm7xxx_driver[ - .phy_id = PHY_ID_BCM7429, - .phy_id_mask = 0xfffffff0, - .name = "Broadcom BCM7429", -- .features = PHY_GBIT_FEATURES | -+ .features = PHY_BASIC_FEATURES | - SUPPORTED_Pause | SUPPORTED_Asym_Pause, - .flags = PHY_IS_INTERNAL, - .config_init = bcm7xxx_config_init, -@@ -361,31 +352,18 @@ static struct phy_driver bcm7xxx_driver[ - .resume = bcm7xxx_config_init, - .driver = { .owner = THIS_MODULE }, - }, { -- .phy_id = PHY_BCM_OUI_4, -- .phy_id_mask = 0xffff0000, -- .name = "Broadcom BCM7XXX 40nm", -- .features = PHY_GBIT_FEATURES | -- SUPPORTED_Pause | SUPPORTED_Asym_Pause, -- .flags = PHY_IS_INTERNAL, -- .config_init = bcm7xxx_config_init, -- .config_aneg = genphy_config_aneg, -- .read_status = genphy_read_status, -- .suspend = bcm7xxx_suspend, -- .resume = bcm7xxx_config_init, -- .driver = { .owner = THIS_MODULE }, --}, { -- .phy_id = PHY_BCM_OUI_5, -- .phy_id_mask = 0xffffff00, -- .name = "Broadcom BCM7XXX 65nm", -- .features = PHY_BASIC_FEATURES | -+ .phy_id = PHY_ID_BCM7435, -+ .phy_id_mask = 0xfffffff0, -+ .name = "Broadcom BCM7435", -+ .features = PHY_BASIC_FEATURES | - SUPPORTED_Pause | SUPPORTED_Asym_Pause, -- .flags = PHY_IS_INTERNAL, -- .config_init = bcm7xxx_dummy_config_init, -- .config_aneg = genphy_config_aneg, -- .read_status = genphy_read_status, -- .suspend = bcm7xxx_suspend, -- .resume = bcm7xxx_config_init, -- .driver = { .owner = THIS_MODULE }, -+ .flags = PHY_IS_INTERNAL, -+ .config_init = bcm7xxx_config_init, -+ .config_aneg = genphy_config_aneg, -+ .read_status = genphy_read_status, -+ .suspend = bcm7xxx_suspend, -+ .resume = bcm7xxx_config_init, -+ .driver = { .owner = THIS_MODULE }, - } }; - - static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = { -@@ -395,9 +373,8 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_BCM7425, 0xfffffff0, }, - { PHY_ID_BCM7429, 0xfffffff0, }, - { PHY_ID_BCM7439, 0xfffffff0, }, -+ { PHY_ID_BCM7435, 0xfffffff0, }, - { PHY_ID_BCM7445, 0xfffffff0, }, -- { PHY_BCM_OUI_4, 0xffff0000 }, -- { PHY_BCM_OUI_5, 0xffffff00 }, - { } - }; - ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -26,6 +26,7 @@ - #define PHY_ID_BCM7366 0x600d8490 - #define PHY_ID_BCM7425 0x600d86b0 - #define PHY_ID_BCM7429 0x600d8730 -+#define PHY_ID_BCM7435 0x600d8750 - #define PHY_ID_BCM7439 0x600d8480 - #define PHY_ID_BCM7439_2 0xae025080 - #define PHY_ID_BCM7445 0x600d8510 diff --git a/target/linux/generic/pending-4.4/078-0002-net-phy-update-Broadcom-drivers-to-v4.6.patch b/target/linux/generic/pending-4.4/078-0002-net-phy-update-Broadcom-drivers-to-v4.6.patch deleted file mode 100644 index 4be229b8f..000000000 --- a/target/linux/generic/pending-4.4/078-0002-net-phy-update-Broadcom-drivers-to-v4.6.patch +++ /dev/null @@ -1,123 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH 2/4] net: phy: update Broadcom drivers to v4.6 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/net/phy/bcm7xxx.c -+++ b/drivers/net/phy/bcm7xxx.c -@@ -24,7 +24,7 @@ - #define MII_BCM7XXX_100TX_FALSE_CAR 0x13 - #define MII_BCM7XXX_100TX_DISC 0x14 - #define MII_BCM7XXX_AUX_MODE 0x1d --#define MII_BCM7XX_64CLK_MDIO BIT(12) -+#define MII_BCM7XXX_64CLK_MDIO BIT(12) - #define MII_BCM7XXX_TEST 0x1f - #define MII_BCM7XXX_SHD_MODE_2 BIT(2) - -@@ -247,7 +247,7 @@ static int bcm7xxx_config_init(struct ph - int ret; - - /* Enable 64 clock MDIO */ -- phy_write(phydev, MII_BCM7XXX_AUX_MODE, MII_BCM7XX_64CLK_MDIO); -+ phy_write(phydev, MII_BCM7XXX_AUX_MODE, MII_BCM7XXX_64CLK_MDIO); - phy_read(phydev, MII_BCM7XXX_AUX_MODE); - - /* set shadow mode 2 */ -@@ -318,6 +318,22 @@ static int bcm7xxx_suspend(struct phy_de - .driver = { .owner = THIS_MODULE }, \ - } - -+#define BCM7XXX_40NM_EPHY(_oui, _name) \ -+{ \ -+ .phy_id = (_oui), \ -+ .phy_id_mask = 0xfffffff0, \ -+ .name = _name, \ -+ .features = PHY_BASIC_FEATURES | \ -+ SUPPORTED_Pause | SUPPORTED_Asym_Pause, \ -+ .flags = PHY_IS_INTERNAL, \ -+ .config_init = bcm7xxx_config_init, \ -+ .config_aneg = genphy_config_aneg, \ -+ .read_status = genphy_read_status, \ -+ .suspend = bcm7xxx_suspend, \ -+ .resume = bcm7xxx_config_init, \ -+ .driver = { .owner = THIS_MODULE }, \ -+} -+ - static struct phy_driver bcm7xxx_driver[] = { - BCM7XXX_28NM_GPHY(PHY_ID_BCM7250, "Broadcom BCM7250"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7364, "Broadcom BCM7364"), -@@ -325,51 +341,19 @@ static struct phy_driver bcm7xxx_driver[ - BCM7XXX_28NM_GPHY(PHY_ID_BCM7439, "Broadcom BCM7439"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7439_2, "Broadcom BCM7439 (2)"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7445, "Broadcom BCM7445"), --{ -- .phy_id = PHY_ID_BCM7425, -- .phy_id_mask = 0xfffffff0, -- .name = "Broadcom BCM7425", -- .features = PHY_BASIC_FEATURES | -- SUPPORTED_Pause | SUPPORTED_Asym_Pause, -- .flags = PHY_IS_INTERNAL, -- .config_init = bcm7xxx_config_init, -- .config_aneg = genphy_config_aneg, -- .read_status = genphy_read_status, -- .suspend = bcm7xxx_suspend, -- .resume = bcm7xxx_config_init, -- .driver = { .owner = THIS_MODULE }, --}, { -- .phy_id = PHY_ID_BCM7429, -- .phy_id_mask = 0xfffffff0, -- .name = "Broadcom BCM7429", -- .features = PHY_BASIC_FEATURES | -- SUPPORTED_Pause | SUPPORTED_Asym_Pause, -- .flags = PHY_IS_INTERNAL, -- .config_init = bcm7xxx_config_init, -- .config_aneg = genphy_config_aneg, -- .read_status = genphy_read_status, -- .suspend = bcm7xxx_suspend, -- .resume = bcm7xxx_config_init, -- .driver = { .owner = THIS_MODULE }, --}, { -- .phy_id = PHY_ID_BCM7435, -- .phy_id_mask = 0xfffffff0, -- .name = "Broadcom BCM7435", -- .features = PHY_BASIC_FEATURES | -- SUPPORTED_Pause | SUPPORTED_Asym_Pause, -- .flags = PHY_IS_INTERNAL, -- .config_init = bcm7xxx_config_init, -- .config_aneg = genphy_config_aneg, -- .read_status = genphy_read_status, -- .suspend = bcm7xxx_suspend, -- .resume = bcm7xxx_config_init, -- .driver = { .owner = THIS_MODULE }, --} }; -+ BCM7XXX_40NM_EPHY(PHY_ID_BCM7346, "Broadcom BCM7346"), -+ BCM7XXX_40NM_EPHY(PHY_ID_BCM7362, "Broadcom BCM7362"), -+ BCM7XXX_40NM_EPHY(PHY_ID_BCM7425, "Broadcom BCM7425"), -+ BCM7XXX_40NM_EPHY(PHY_ID_BCM7429, "Broadcom BCM7429"), -+ BCM7XXX_40NM_EPHY(PHY_ID_BCM7435, "Broadcom BCM7435"), -+}; - - static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = { - { PHY_ID_BCM7250, 0xfffffff0, }, - { PHY_ID_BCM7364, 0xfffffff0, }, - { PHY_ID_BCM7366, 0xfffffff0, }, -+ { PHY_ID_BCM7346, 0xfffffff0, }, -+ { PHY_ID_BCM7362, 0xfffffff0, }, - { PHY_ID_BCM7425, 0xfffffff0, }, - { PHY_ID_BCM7429, 0xfffffff0, }, - { PHY_ID_BCM7439, 0xfffffff0, }, ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -24,6 +24,8 @@ - #define PHY_ID_BCM7250 0xae025280 - #define PHY_ID_BCM7364 0xae025260 - #define PHY_ID_BCM7366 0x600d8490 -+#define PHY_ID_BCM7346 0x600d8650 -+#define PHY_ID_BCM7362 0x600d84b0 - #define PHY_ID_BCM7425 0x600d86b0 - #define PHY_ID_BCM7429 0x600d8730 - #define PHY_ID_BCM7435 0x600d8750 diff --git a/target/linux/generic/pending-4.4/078-0003-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch b/target/linux/generic/pending-4.4/078-0003-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch deleted file mode 100644 index 1d943d605..000000000 --- a/target/linux/generic/pending-4.4/078-0003-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch +++ /dev/null @@ -1,315 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] net: phy: cherry-pick Broadcom drivers updates from v4.10 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This includes following upstream commits: -5519da874ad0 net: phy: broadcom: Move bcm54xx_auxctl_{read, write} to common library -b14995ac2527 net: phy: broadcom: Add BCM54810 PHY entry -5b4e29005123 net: phy: broadcom: add bcm54xx_auxctl_read -d92ead16be40 net: phy: broadcom: Add support for BCM54612E -3cf25904fe46 net: phy: broadcom: Update Auxiliary Control Register macros - -Other commits were skipped as they depend on other changes like -ETHTOOL_PHY_DOWNSHIFT & DOWNSHIFT_DEV_DISABLE and new APIs like -get_sset_count. - -One exception was picking new regs from commit d06f78c4232d ("net: phy: -broadcom: Add support code for downshift/Wirespeed"). - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -77,7 +77,7 @@ config BROADCOM_PHY - select BCM_NET_PHYLIB - ---help--- - Currently supports the BCM5411, BCM5421, BCM5461, BCM54616S, BCM5464, -- BCM5481 and BCM5482 PHYs. -+ BCM5481, BCM54810 and BCM5482 PHYs. - - config BCM_CYGNUS_PHY - tristate "Drivers for Broadcom Cygnus SoC internal PHY" ---- a/drivers/net/phy/bcm-phy-lib.c -+++ b/drivers/net/phy/bcm-phy-lib.c -@@ -50,6 +50,23 @@ int bcm_phy_read_exp(struct phy_device * - } - EXPORT_SYMBOL_GPL(bcm_phy_read_exp); - -+int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum) -+{ -+ /* The register must be written to both the Shadow Register Select and -+ * the Shadow Read Register Selector -+ */ -+ phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | -+ regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT); -+ return phy_read(phydev, MII_BCM54XX_AUX_CTL); -+} -+EXPORT_SYMBOL_GPL(bcm54xx_auxctl_read); -+ -+int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) -+{ -+ return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); -+} -+EXPORT_SYMBOL(bcm54xx_auxctl_write); -+ - int bcm_phy_write_misc(struct phy_device *phydev, - u16 reg, u16 chl, u16 val) - { ---- a/drivers/net/phy/bcm-phy-lib.h -+++ b/drivers/net/phy/bcm-phy-lib.h -@@ -19,6 +19,9 @@ - int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val); - int bcm_phy_read_exp(struct phy_device *phydev, u16 reg); - -+int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val); -+int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum); -+ - int bcm_phy_write_misc(struct phy_device *phydev, - u16 reg, u16 chl, u16 value); - int bcm_phy_read_misc(struct phy_device *phydev, ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -18,7 +18,7 @@ - #include - #include - #include -- -+#include - - #define BRCM_PHY_MODEL(phydev) \ - ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask) -@@ -30,9 +30,32 @@ MODULE_DESCRIPTION("Broadcom PHY driver" - MODULE_AUTHOR("Maciej W. Rozycki"); - MODULE_LICENSE("GPL"); - --static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) -+static int bcm54810_config(struct phy_device *phydev) - { -- return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); -+ int rc, val; -+ -+ val = bcm_phy_read_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL); -+ val &= ~BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN; -+ rc = bcm_phy_write_exp(phydev, BCM54810_EXP_BROADREACH_LRE_MISC_CTL, -+ val); -+ if (rc < 0) -+ return rc; -+ -+ val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); -+ val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; -+ val |= MII_BCM54XX_AUXCTL_MISC_WREN; -+ rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -+ val); -+ if (rc < 0) -+ return rc; -+ -+ val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL); -+ val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; -+ rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); -+ if (rc < 0) -+ return rc; -+ -+ return 0; - } - - /* Needs SMDSP clock enabled via bcm54xx_phydsp_config() */ -@@ -207,6 +230,12 @@ static int bcm54xx_config_init(struct ph - (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) - bcm54xx_adjust_rxrefclk(phydev); - -+ if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { -+ err = bcm54810_config(phydev); -+ if (err) -+ return err; -+ } -+ - bcm54xx_phydsp_config(phydev); - - return 0; -@@ -304,6 +333,7 @@ static int bcm5482_read_status(struct ph - - static int bcm5481_config_aneg(struct phy_device *phydev) - { -+ struct device_node *np = phydev->dev.of_node; - int ret; - - /* Aneg firsly. */ -@@ -334,6 +364,49 @@ static int bcm5481_config_aneg(struct ph - phy_write(phydev, 0x18, reg); - } - -+ if (of_property_read_bool(np, "enet-phy-lane-swap")) { -+ /* Lane Swap - Undocumented register...magic! */ -+ ret = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_SEL_ER + 0x9, -+ 0x11B); -+ if (ret < 0) -+ return ret; -+ } -+ -+ return ret; -+} -+ -+static int bcm54612e_config_aneg(struct phy_device *phydev) -+{ -+ int ret; -+ -+ /* First, auto-negotiate. */ -+ ret = genphy_config_aneg(phydev); -+ -+ /* Clear TX internal delay unless requested. */ -+ if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -+ (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) { -+ /* Disable TXD to GTXCLK clock delay (default set) */ -+ /* Bit 9 is the only field in shadow register 00011 */ -+ bcm_phy_write_shadow(phydev, 0x03, 0); -+ } -+ -+ /* Clear RX internal delay unless requested. */ -+ if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -+ (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { -+ u16 reg; -+ -+ /* Errata: reads require filling in the write selector field */ -+ bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -+ MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC); -+ reg = phy_read(phydev, MII_BCM54XX_AUX_CTL); -+ /* Disable RXD to RXC delay (default set) */ -+ reg &= ~MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW; -+ /* Clear shadow selector field */ -+ reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK; -+ bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -+ MII_BCM54XX_AUXCTL_MISC_WREN | reg); -+ } -+ - return ret; - } - -@@ -488,6 +561,18 @@ static struct phy_driver broadcom_driver - .config_intr = bcm_phy_config_intr, - .driver = { .owner = THIS_MODULE }, - }, { -+ .phy_id = PHY_ID_BCM54612E, -+ .phy_id_mask = 0xfffffff0, -+ .name = "Broadcom BCM54612E", -+ .features = PHY_GBIT_FEATURES | -+ SUPPORTED_Pause | SUPPORTED_Asym_Pause, -+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, -+ .config_init = bcm54xx_config_init, -+ .config_aneg = bcm54612e_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = bcm_phy_ack_intr, -+ .config_intr = bcm_phy_config_intr, -+}, { - .phy_id = PHY_ID_BCM54616S, - .phy_id_mask = 0xfffffff0, - .name = "Broadcom BCM54616S", -@@ -527,6 +612,18 @@ static struct phy_driver broadcom_driver - .config_intr = bcm_phy_config_intr, - .driver = { .owner = THIS_MODULE }, - }, { -+ .phy_id = PHY_ID_BCM54810, -+ .phy_id_mask = 0xfffffff0, -+ .name = "Broadcom BCM54810", -+ .features = PHY_GBIT_FEATURES | -+ SUPPORTED_Pause | SUPPORTED_Asym_Pause, -+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, -+ .config_init = bcm54xx_config_init, -+ .config_aneg = bcm5481_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = bcm_phy_ack_intr, -+ .config_intr = bcm_phy_config_intr, -+}, { - .phy_id = PHY_ID_BCM5482, - .phy_id_mask = 0xfffffff0, - .name = "Broadcom BCM5482", -@@ -612,9 +709,11 @@ static struct mdio_device_id __maybe_unu - { PHY_ID_BCM5411, 0xfffffff0 }, - { PHY_ID_BCM5421, 0xfffffff0 }, - { PHY_ID_BCM5461, 0xfffffff0 }, -+ { PHY_ID_BCM54612E, 0xfffffff0 }, - { PHY_ID_BCM54616S, 0xfffffff0 }, - { PHY_ID_BCM5464, 0xfffffff0 }, - { PHY_ID_BCM5481, 0xfffffff0 }, -+ { PHY_ID_BCM54810, 0xfffffff0 }, - { PHY_ID_BCM5482, 0xfffffff0 }, - { PHY_ID_BCM50610, 0xfffffff0 }, - { PHY_ID_BCM50610M, 0xfffffff0 }, ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -13,11 +13,13 @@ - #define PHY_ID_BCM5241 0x0143bc30 - #define PHY_ID_BCMAC131 0x0143bc70 - #define PHY_ID_BCM5481 0x0143bca0 -+#define PHY_ID_BCM54810 0x03625d00 - #define PHY_ID_BCM5482 0x0143bcb0 - #define PHY_ID_BCM5411 0x00206070 - #define PHY_ID_BCM5421 0x002060e0 - #define PHY_ID_BCM5464 0x002060b0 - #define PHY_ID_BCM5461 0x002060c0 -+#define PHY_ID_BCM54612E 0x03625e60 - #define PHY_ID_BCM54616S 0x03625d10 - #define PHY_ID_BCM57780 0x03625d90 - -@@ -55,6 +57,7 @@ - #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 - #define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 - #define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 -+ - /* Broadcom BCM7xxx specific workarounds */ - #define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff) - #define PHY_BRCM_7XXX_PATCH(x) ((x) & 0xff) -@@ -105,11 +108,14 @@ - #define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800 - - #define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000 -+#define MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW 0x0100 - #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200 - #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000 - #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN (1 << 8) - --#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_MASK 0x0007 - - /* - * Broadcom LED source encodings. These are used in BCM5461, BCM5481, -@@ -124,6 +130,7 @@ - #define BCM_LED_SRC_INTR 0x6 - #define BCM_LED_SRC_QUALITY 0x7 - #define BCM_LED_SRC_RCVLED 0x8 -+#define BCM_LED_SRC_WIRESPEED 0x9 - #define BCM_LED_SRC_MULTICOLOR1 0xa - #define BCM_LED_SRC_OPENSHORT 0xb - #define BCM_LED_SRC_OFF 0xe /* Tied high */ -@@ -135,6 +142,14 @@ - * Shadow values go into bits [14:10] of register 0x1c to select a shadow - * register to access. - */ -+ -+/* 00100: Reserved control register 2 */ -+#define BCM54XX_SHD_SCR2 0x04 -+#define BCM54XX_SHD_SCR2_WSPD_RTRY_DIS 0x100 -+#define BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_SHIFT 2 -+#define BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_OFFSET 2 -+#define BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_MASK 0x7 -+ - /* 00101: Spare Control Register 3 */ - #define BCM54XX_SHD_SCR3 0x05 - #define BCM54XX_SHD_SCR3_DEF_CLK125 0x0001 -@@ -189,6 +204,12 @@ - #define BCM5482_SSD_SGMII_SLAVE_EN 0x0002 /* Slave mode enable */ - #define BCM5482_SSD_SGMII_SLAVE_AD 0x0001 /* Slave auto-detection */ - -+/* BCM54810 Registers */ -+#define BCM54810_EXP_BROADREACH_LRE_MISC_CTL (MII_BCM54XX_EXP_SEL_ER + 0x90) -+#define BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN (1 << 0) -+#define BCM54810_SHD_CLK_CTL 0x3 -+#define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9) -+ - - /*****************************************************************************/ - /* Fast Ethernet Transceiver definitions. */ diff --git a/target/linux/generic/pending-4.4/078-0004-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch b/target/linux/generic/pending-4.4/078-0004-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch deleted file mode 100644 index 269c4e724..000000000 --- a/target/linux/generic/pending-4.4/078-0004-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch +++ /dev/null @@ -1,283 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] net: phy: cherry-pick Broadcom drivers updates from v4.11 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This includes following upstream commits: -62e13097c46c net: phy: broadcom: rehook BCM54612E specific init -0fc9ae107669 net: phy: broadcom: add support for BCM54210E -5e7bfa6cb0a9 net: phy: bcm-phy-lib: clean up remaining AUXCTL register defines -8293c7bcdef1 net: phy: broadcom: drop duplicated define for RGMII SKEW delay -85b4685da52f net: phy: broadcom: use auxctl reading helper in BCM54612E code -039a7b8592ab net: phy: bcm7xxx: Implement EGPHY workaround for 7278 -582d0ac397ca net: phy: bcm7xxx: Add entry for BCM7278 - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/net/phy/bcm7xxx.c -+++ b/drivers/net/phy/bcm7xxx.c -@@ -163,12 +163,43 @@ static int bcm7xxx_28nm_e0_plus_afe_conf - return 0; - } - -+static int bcm7xxx_28nm_a0_patch_afe_config_init(struct phy_device *phydev) -+{ -+ /* +1 RC_CAL codes for RL centering for both LT and HT conditions */ -+ bcm_phy_write_misc(phydev, AFE_RXCONFIG_2, 0xd003); -+ -+ /* Cut master bias current by 2% to compensate for RC_CAL offset */ -+ bcm_phy_write_misc(phydev, DSP_TAP10, 0x791b); -+ -+ /* Improve hybrid leakage */ -+ bcm_phy_write_misc(phydev, AFE_HPF_TRIM_OTHERS, 0x10e3); -+ -+ /* Change rx_on_tune 8 to 0xf */ -+ bcm_phy_write_misc(phydev, 0x21, 0x2, 0x87f6); -+ -+ /* Change 100Tx EEE bandwidth */ -+ bcm_phy_write_misc(phydev, 0x22, 0x2, 0x017d); -+ -+ /* Enable ffe zero detection for Vitesse interoperability */ -+ bcm_phy_write_misc(phydev, 0x26, 0x2, 0x0015); -+ -+ r_rc_cal_reset(phydev); -+ -+ return 0; -+} -+ - static int bcm7xxx_28nm_config_init(struct phy_device *phydev) - { - u8 rev = PHY_BRCM_7XXX_REV(phydev->dev_flags); - u8 patch = PHY_BRCM_7XXX_PATCH(phydev->dev_flags); - int ret = 0; - -+ /* Newer devices have moved the revision information back into a -+ * standard location in MII_PHYS_ID[23] -+ */ -+ if (rev == 0) -+ rev = phydev->phy_id & ~phydev->drv->phy_id_mask; -+ - pr_info_once("%s: %s PHY revision: 0x%02x, patch: %d\n", - dev_name(&phydev->dev), phydev->drv->name, rev, patch); - -@@ -192,6 +223,9 @@ static int bcm7xxx_28nm_config_init(stru - case 0x10: - ret = bcm7xxx_28nm_e0_plus_afe_config_init(phydev); - break; -+ case 0x01: -+ ret = bcm7xxx_28nm_a0_patch_afe_config_init(phydev); -+ break; - default: - break; - } -@@ -336,6 +370,7 @@ static int bcm7xxx_suspend(struct phy_de - - static struct phy_driver bcm7xxx_driver[] = { - BCM7XXX_28NM_GPHY(PHY_ID_BCM7250, "Broadcom BCM7250"), -+ BCM7XXX_28NM_GPHY(PHY_ID_BCM7278, "Broadcom BCM7278"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7364, "Broadcom BCM7364"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7366, "Broadcom BCM7366"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7439, "Broadcom BCM7439"), -@@ -350,6 +385,7 @@ static struct phy_driver bcm7xxx_driver[ - - static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = { - { PHY_ID_BCM7250, 0xfffffff0, }, -+ { PHY_ID_BCM7278, 0xfffffff0, }, - { PHY_ID_BCM7364, 0xfffffff0, }, - { PHY_ID_BCM7366, 0xfffffff0, }, - { PHY_ID_BCM7346, 0xfffffff0, }, ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -30,6 +30,50 @@ MODULE_DESCRIPTION("Broadcom PHY driver" - MODULE_AUTHOR("Maciej W. Rozycki"); - MODULE_LICENSE("GPL"); - -+static int bcm54210e_config_init(struct phy_device *phydev) -+{ -+ int val; -+ -+ val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); -+ val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; -+ val |= MII_BCM54XX_AUXCTL_MISC_WREN; -+ bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, val); -+ -+ val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL); -+ val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; -+ bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); -+ -+ return 0; -+} -+ -+static int bcm54612e_config_init(struct phy_device *phydev) -+{ -+ /* Clear TX internal delay unless requested. */ -+ if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -+ (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) { -+ /* Disable TXD to GTXCLK clock delay (default set) */ -+ /* Bit 9 is the only field in shadow register 00011 */ -+ bcm_phy_write_shadow(phydev, 0x03, 0); -+ } -+ -+ /* Clear RX internal delay unless requested. */ -+ if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -+ (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { -+ u16 reg; -+ -+ reg = bcm54xx_auxctl_read(phydev, -+ MII_BCM54XX_AUXCTL_SHDWSEL_MISC); -+ /* Disable RXD to RXC delay (default set) */ -+ reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; -+ /* Clear shadow selector field */ -+ reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK; -+ bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -+ MII_BCM54XX_AUXCTL_MISC_WREN | reg); -+ } -+ -+ return 0; -+} -+ - static int bcm54810_config(struct phy_device *phydev) - { - int rc, val; -@@ -230,7 +274,15 @@ static int bcm54xx_config_init(struct ph - (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE)) - bcm54xx_adjust_rxrefclk(phydev); - -- if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { -+ if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) { -+ err = bcm54210e_config_init(phydev); -+ if (err) -+ return err; -+ } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54612E) { -+ err = bcm54612e_config_init(phydev); -+ if (err) -+ return err; -+ } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) { - err = bcm54810_config(phydev); - if (err) - return err; -@@ -375,41 +427,6 @@ static int bcm5481_config_aneg(struct ph - return ret; - } - --static int bcm54612e_config_aneg(struct phy_device *phydev) --{ -- int ret; -- -- /* First, auto-negotiate. */ -- ret = genphy_config_aneg(phydev); -- -- /* Clear TX internal delay unless requested. */ -- if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -- (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) { -- /* Disable TXD to GTXCLK clock delay (default set) */ -- /* Bit 9 is the only field in shadow register 00011 */ -- bcm_phy_write_shadow(phydev, 0x03, 0); -- } -- -- /* Clear RX internal delay unless requested. */ -- if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) && -- (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) { -- u16 reg; -- -- /* Errata: reads require filling in the write selector field */ -- bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -- MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC); -- reg = phy_read(phydev, MII_BCM54XX_AUX_CTL); -- /* Disable RXD to RXC delay (default set) */ -- reg &= ~MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW; -- /* Clear shadow selector field */ -- reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK; -- bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, -- MII_BCM54XX_AUXCTL_MISC_WREN | reg); -- } -- -- return ret; --} -- - static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set) - { - int val; -@@ -548,6 +565,19 @@ static struct phy_driver broadcom_driver - .config_intr = bcm_phy_config_intr, - .driver = { .owner = THIS_MODULE }, - }, { -+ .phy_id = PHY_ID_BCM54210E, -+ .phy_id_mask = 0xfffffff0, -+ .name = "Broadcom BCM54210E", -+ .features = PHY_GBIT_FEATURES | -+ SUPPORTED_Pause | SUPPORTED_Asym_Pause, -+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, -+ .config_init = bcm54xx_config_init, -+ .config_aneg = genphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = bcm_phy_ack_intr, -+ .config_intr = bcm_phy_config_intr, -+ .driver = { .owner = THIS_MODULE }, -+}, { - .phy_id = PHY_ID_BCM5461, - .phy_id_mask = 0xfffffff0, - .name = "Broadcom BCM5461", -@@ -568,7 +598,7 @@ static struct phy_driver broadcom_driver - SUPPORTED_Pause | SUPPORTED_Asym_Pause, - .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, - .config_init = bcm54xx_config_init, -- .config_aneg = bcm54612e_config_aneg, -+ .config_aneg = genphy_config_aneg, - .read_status = genphy_read_status, - .ack_interrupt = bcm_phy_ack_intr, - .config_intr = bcm_phy_config_intr, -@@ -708,6 +738,7 @@ module_phy_driver(broadcom_drivers); - static struct mdio_device_id __maybe_unused broadcom_tbl[] = { - { PHY_ID_BCM5411, 0xfffffff0 }, - { PHY_ID_BCM5421, 0xfffffff0 }, -+ { PHY_ID_BCM54210E, 0xfffffff0 }, - { PHY_ID_BCM5461, 0xfffffff0 }, - { PHY_ID_BCM54612E, 0xfffffff0 }, - { PHY_ID_BCM54616S, 0xfffffff0 }, ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -17,6 +17,7 @@ - #define PHY_ID_BCM5482 0x0143bcb0 - #define PHY_ID_BCM5411 0x00206070 - #define PHY_ID_BCM5421 0x002060e0 -+#define PHY_ID_BCM54210E 0x600d84a0 - #define PHY_ID_BCM5464 0x002060b0 - #define PHY_ID_BCM5461 0x002060c0 - #define PHY_ID_BCM54612E 0x03625e60 -@@ -24,6 +25,7 @@ - #define PHY_ID_BCM57780 0x03625d90 - - #define PHY_ID_BCM7250 0xae025280 -+#define PHY_ID_BCM7278 0xae0251a0 - #define PHY_ID_BCM7364 0xae025260 - #define PHY_ID_BCM7366 0x600d8490 - #define PHY_ID_BCM7346 0x600d8650 -@@ -103,18 +105,17 @@ - /* - * AUXILIARY CONTROL SHADOW ACCESS REGISTERS. (PHY REG 0x18) - */ --#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x00 - #define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400 - #define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800 - --#define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000 --#define MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW 0x0100 --#define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200 --#define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000 --#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007 --#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12 --#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN (1 << 8) -+#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010 -+#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN 0x0100 -+#define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200 -+#define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000 - -+#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12 - #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK 0x0007 - - /* diff --git a/target/linux/generic/pending-4.4/078-0006-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch b/target/linux/generic/pending-4.4/078-0006-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch deleted file mode 100644 index c39995da7..000000000 --- a/target/linux/generic/pending-4.4/078-0006-net-phy-cherry-pick-Broadcom-drivers-updates-from-v4.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] net: phy: cherry-pick Broadcom drivers updates from v4.15 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This includes following upstream commits: -2355a6546a05 net: phy: broadcom: support new device flag for setting master mode - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct - val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; - bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); - -+ if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) { -+ val = phy_read(phydev, MII_CTRL1000); -+ val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER; -+ phy_write(phydev, MII_CTRL1000, val); -+ } -+ - return 0; - } - ---- a/include/linux/brcmphy.h -+++ b/include/linux/brcmphy.h -@@ -59,6 +59,7 @@ - #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 - #define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 - #define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 -+#define PHY_BRCM_EN_MASTER_MODE 0x00010000 - - /* Broadcom BCM7xxx specific workarounds */ - #define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff) diff --git a/target/linux/generic/pending-4.4/080-spi-introduce-accelerated-read-support-for-spi-flash.patch b/target/linux/generic/pending-4.4/080-spi-introduce-accelerated-read-support-for-spi-flash.patch deleted file mode 100644 index 5e116b0bb..000000000 --- a/target/linux/generic/pending-4.4/080-spi-introduce-accelerated-read-support-for-spi-flash.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 556351f14e74db4cd3ddde386457edce7bf0b27f Mon Sep 17 00:00:00 2001 -From: Vignesh R -Date: Fri, 11 Dec 2015 09:39:56 +0530 -Subject: [PATCH] spi: introduce accelerated read support for spi flash devices - -In addition to providing direct access to SPI bus, some spi controller -hardwares (like ti-qspi) provide special port (like memory mapped port) -that are optimized to improve SPI flash read performance. -This means the controller can automatically send the SPI signals -required to read data from the SPI flash device. -For this, SPI controller needs to know flash specific information like -read command to use, dummy bytes and address width. - -Introduce spi_flash_read() interface to support accelerated read -over SPI flash devices. SPI master drivers can implement this callback to -support interfaces such as memory mapped read etc. m25p80 flash driver -and other flash drivers can call this make use of such interfaces. The -interface should only be used with SPI flashes and cannot be used with -other SPI devices. - -Signed-off-by: Vignesh R -Signed-off-by: Mark Brown ---- - ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -1135,6 +1135,7 @@ static void __spi_pump_messages(struct s - } - } - -+ mutex_lock(&master->bus_lock_mutex); - trace_spi_message_start(master->cur_msg); - - if (master->prepare_message) { -@@ -1144,6 +1145,7 @@ static void __spi_pump_messages(struct s - "failed to prepare message: %d\n", ret); - master->cur_msg->status = ret; - spi_finalize_current_message(master); -+ mutex_unlock(&master->bus_lock_mutex); - return; - } - master->cur_msg_prepared = true; -@@ -1153,6 +1155,7 @@ static void __spi_pump_messages(struct s - if (ret) { - master->cur_msg->status = ret; - spi_finalize_current_message(master); -+ mutex_unlock(&master->bus_lock_mutex); - return; - } - -@@ -1160,8 +1163,10 @@ static void __spi_pump_messages(struct s - if (ret) { - dev_err(&master->dev, - "failed to transfer one message from queue\n"); -+ mutex_unlock(&master->bus_lock_mutex); - return; - } -+ mutex_unlock(&master->bus_lock_mutex); - } - - /** -@@ -2329,6 +2334,46 @@ int spi_async_locked(struct spi_device * - EXPORT_SYMBOL_GPL(spi_async_locked); - - -+int spi_flash_read(struct spi_device *spi, -+ struct spi_flash_read_message *msg) -+ -+{ -+ struct spi_master *master = spi->master; -+ int ret; -+ -+ if ((msg->opcode_nbits == SPI_NBITS_DUAL || -+ msg->addr_nbits == SPI_NBITS_DUAL) && -+ !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD))) -+ return -EINVAL; -+ if ((msg->opcode_nbits == SPI_NBITS_QUAD || -+ msg->addr_nbits == SPI_NBITS_QUAD) && -+ !(spi->mode & SPI_TX_QUAD)) -+ return -EINVAL; -+ if (msg->data_nbits == SPI_NBITS_DUAL && -+ !(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD))) -+ return -EINVAL; -+ if (msg->data_nbits == SPI_NBITS_QUAD && -+ !(spi->mode & SPI_RX_QUAD)) -+ return -EINVAL; -+ -+ if (master->auto_runtime_pm) { -+ ret = pm_runtime_get_sync(master->dev.parent); -+ if (ret < 0) { -+ dev_err(&master->dev, "Failed to power device: %d\n", -+ ret); -+ return ret; -+ } -+ } -+ mutex_lock(&master->bus_lock_mutex); -+ ret = master->spi_flash_read(spi, msg); -+ mutex_unlock(&master->bus_lock_mutex); -+ if (master->auto_runtime_pm) -+ pm_runtime_put(master->dev.parent); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(spi_flash_read); -+ - /*-------------------------------------------------------------------------*/ - - /* Utility methods for SPI master protocol drivers, layered on ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -25,6 +25,7 @@ - struct dma_chan; - struct spi_master; - struct spi_transfer; -+struct spi_flash_read_message; - - /* - * INTERFACES between SPI master-side drivers and SPI infrastructure. -@@ -361,6 +362,8 @@ static inline void spi_unregister_driver - * @handle_err: the subsystem calls the driver to handle an error that occurs - * in the generic implementation of transfer_one_message(). - * @unprepare_message: undo any work done by prepare_message(). -+ * @spi_flash_read: to support spi-controller hardwares that provide -+ * accelerated interface to read from flash devices. - * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS - * number. Any individual value may be -ENOENT for CS lines that - * are not GPIOs (driven by the SPI controller itself). -@@ -507,6 +510,8 @@ struct spi_master { - struct spi_message *message); - int (*unprepare_message)(struct spi_master *master, - struct spi_message *message); -+ int (*spi_flash_read)(struct spi_device *spi, -+ struct spi_flash_read_message *msg); - - /* - * These hooks are for drivers that use a generic implementation -@@ -999,6 +1004,42 @@ static inline ssize_t spi_w8r16be(struct - return be16_to_cpu(result); - } - -+/** -+ * struct spi_flash_read_message - flash specific information for -+ * spi-masters that provide accelerated flash read interfaces -+ * @buf: buffer to read data -+ * @from: offset within the flash from where data is to be read -+ * @len: length of data to be read -+ * @retlen: actual length of data read -+ * @read_opcode: read_opcode to be used to communicate with flash -+ * @addr_width: number of address bytes -+ * @dummy_bytes: number of dummy bytes -+ * @opcode_nbits: number of lines to send opcode -+ * @addr_nbits: number of lines to send address -+ * @data_nbits: number of lines for data -+ */ -+struct spi_flash_read_message { -+ void *buf; -+ loff_t from; -+ size_t len; -+ size_t retlen; -+ u8 read_opcode; -+ u8 addr_width; -+ u8 dummy_bytes; -+ u8 opcode_nbits; -+ u8 addr_nbits; -+ u8 data_nbits; -+}; -+ -+/* SPI core interface for flash read support */ -+static inline bool spi_flash_read_supported(struct spi_device *spi) -+{ -+ return spi->master->spi_flash_read ? true : false; -+} -+ -+int spi_flash_read(struct spi_device *spi, -+ struct spi_flash_read_message *msg); -+ - /*---------------------------------------------------------------------------*/ - - /* diff --git a/target/linux/generic/pending-4.4/081-spi-bcm53xx-add-spi_flash_read-callback-for-MMIO-bas.patch b/target/linux/generic/pending-4.4/081-spi-bcm53xx-add-spi_flash_read-callback-for-MMIO-bas.patch deleted file mode 100644 index 730f41e4a..000000000 --- a/target/linux/generic/pending-4.4/081-spi-bcm53xx-add-spi_flash_read-callback-for-MMIO-bas.patch +++ /dev/null @@ -1,157 +0,0 @@ -From a7b221d8f0d75511c5f959584712a5dd35f88a86 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 18 Apr 2016 14:39:30 +0200 -Subject: [PATCH] spi: bcm53xx: add spi_flash_read callback for MMIO-based - reads -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This implements more efficient reads of SPI-attached flash content. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Mark Brown ---- - ---- a/drivers/spi/spi-bcm53xx.c -+++ b/drivers/spi/spi-bcm53xx.c -@@ -10,6 +10,7 @@ - #include "spi-bcm53xx.h" - - #define BCM53XXSPI_MAX_SPI_BAUD 13500000 /* 216 MHz? */ -+#define BCM53XXSPI_FLASH_WINDOW SZ_32M - - /* The longest observed required wait was 19 ms */ - #define BCM53XXSPI_SPE_TIMEOUT_MS 80 -@@ -17,8 +18,10 @@ - struct bcm53xxspi { - struct bcma_device *core; - struct spi_master *master; -+ void __iomem *mmio_base; - - size_t read_offset; -+ bool bspi; /* Boot SPI mode with memory mapping */ - }; - - static inline u32 bcm53xxspi_read(struct bcm53xxspi *b53spi, u16 offset) -@@ -32,6 +35,50 @@ static inline void bcm53xxspi_write(stru - bcma_write32(b53spi->core, offset, value); - } - -+static void bcm53xxspi_disable_bspi(struct bcm53xxspi *b53spi) -+{ -+ struct device *dev = &b53spi->core->dev; -+ unsigned long deadline; -+ u32 tmp; -+ -+ if (!b53spi->bspi) -+ return; -+ -+ tmp = bcm53xxspi_read(b53spi, B53SPI_BSPI_MAST_N_BOOT_CTRL); -+ if (tmp & 0x1) -+ return; -+ -+ deadline = jiffies + usecs_to_jiffies(200); -+ do { -+ tmp = bcm53xxspi_read(b53spi, B53SPI_BSPI_BUSY_STATUS); -+ if (!(tmp & 0x1)) { -+ bcm53xxspi_write(b53spi, B53SPI_BSPI_MAST_N_BOOT_CTRL, -+ 0x1); -+ ndelay(200); -+ b53spi->bspi = false; -+ return; -+ } -+ udelay(1); -+ } while (!time_after_eq(jiffies, deadline)); -+ -+ dev_warn(dev, "Timeout disabling BSPI\n"); -+} -+ -+static void bcm53xxspi_enable_bspi(struct bcm53xxspi *b53spi) -+{ -+ u32 tmp; -+ -+ if (b53spi->bspi) -+ return; -+ -+ tmp = bcm53xxspi_read(b53spi, B53SPI_BSPI_MAST_N_BOOT_CTRL); -+ if (!(tmp & 0x1)) -+ return; -+ -+ bcm53xxspi_write(b53spi, B53SPI_BSPI_MAST_N_BOOT_CTRL, 0x0); -+ b53spi->bspi = true; -+} -+ - static inline unsigned int bcm53xxspi_calc_timeout(size_t len) - { - /* Do some magic calculation based on length and buad. Add 10% and 1. */ -@@ -176,6 +223,8 @@ static int bcm53xxspi_transfer_one(struc - u8 *buf; - size_t left; - -+ bcm53xxspi_disable_bspi(b53spi); -+ - if (t->tx_buf) { - buf = (u8 *)t->tx_buf; - left = t->len; -@@ -206,6 +255,22 @@ static int bcm53xxspi_transfer_one(struc - return 0; - } - -+static int bcm53xxspi_flash_read(struct spi_device *spi, -+ struct spi_flash_read_message *msg) -+{ -+ struct bcm53xxspi *b53spi = spi_master_get_devdata(spi->master); -+ int ret = 0; -+ -+ if (msg->from + msg->len > BCM53XXSPI_FLASH_WINDOW) -+ return -EINVAL; -+ -+ bcm53xxspi_enable_bspi(b53spi); -+ memcpy_fromio(msg->buf, b53spi->mmio_base + msg->from, msg->len); -+ msg->retlen = msg->len; -+ -+ return ret; -+} -+ - /************************************************** - * BCMA - **************************************************/ -@@ -222,6 +287,7 @@ MODULE_DEVICE_TABLE(bcma, bcm53xxspi_bcm - - static int bcm53xxspi_bcma_probe(struct bcma_device *core) - { -+ struct device *dev = &core->dev; - struct bcm53xxspi *b53spi; - struct spi_master *master; - int err; -@@ -231,7 +297,7 @@ static int bcm53xxspi_bcma_probe(struct - return -ENOTSUPP; - } - -- master = spi_alloc_master(&core->dev, sizeof(*b53spi)); -+ master = spi_alloc_master(dev, sizeof(*b53spi)); - if (!master) - return -ENOMEM; - -@@ -239,11 +305,19 @@ static int bcm53xxspi_bcma_probe(struct - b53spi->master = master; - b53spi->core = core; - -+ if (core->addr_s[0]) -+ b53spi->mmio_base = devm_ioremap(dev, core->addr_s[0], -+ BCM53XXSPI_FLASH_WINDOW); -+ b53spi->bspi = true; -+ bcm53xxspi_disable_bspi(b53spi); -+ - master->transfer_one = bcm53xxspi_transfer_one; -+ if (b53spi->mmio_base) -+ master->spi_flash_read = bcm53xxspi_flash_read; - - bcma_set_drvdata(core, b53spi); - -- err = devm_spi_register_master(&core->dev, master); -+ err = devm_spi_register_master(dev, master); - if (err) { - spi_master_put(master); - bcma_set_drvdata(core, NULL); diff --git a/target/linux/generic/pending-4.4/082-0001-USB-core-let-USB-device-know-device-node.patch b/target/linux/generic/pending-4.4/082-0001-USB-core-let-USB-device-know-device-node.patch deleted file mode 100644 index 901cdf7e8..000000000 --- a/target/linux/generic/pending-4.4/082-0001-USB-core-let-USB-device-know-device-node.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 69bec725985324e79b1c47ea287815ac4ddb0521 Mon Sep 17 00:00:00 2001 -From: Peter Chen -Date: Fri, 19 Feb 2016 17:26:15 +0800 -Subject: [PATCH] USB: core: let USB device know device node - -Although most of USB devices are hot-plug's, there are still some devices -are hard wired on the board, eg, for HSIC and SSIC interface USB devices. -If these kinds of USB devices are multiple functions, and they can supply -other interfaces like i2c, gpios for other devices, we may need to -describe these at device tree. - -In this commit, it uses "reg" in dts as physical port number to match -the phyiscal port number decided by USB core, if they are the same, -then the device node is for the device we are creating for USB core. - -Signed-off-by: Peter Chen -Acked-by: Philipp Zabel -Acked-by: Alan Stern -Acked-by: Rob Herring -Acked-by: Arnd Bergmann -Signed-off-by: Greg Kroah-Hartman ---- - .../devicetree/bindings/usb/usb-device.txt | 28 +++++++++++++ - drivers/usb/core/Makefile | 2 +- - drivers/usb/core/of.c | 47 ++++++++++++++++++++++ - drivers/usb/core/usb.c | 10 +++++ - include/linux/usb/of.h | 7 ++++ - 5 files changed, 93 insertions(+), 1 deletion(-) - create mode 100644 Documentation/devicetree/bindings/usb/usb-device.txt - create mode 100644 drivers/usb/core/of.c - ---- /dev/null -+++ b/Documentation/devicetree/bindings/usb/usb-device.txt -@@ -0,0 +1,28 @@ -+Generic USB Device Properties -+ -+Usually, we only use device tree for hard wired USB device. -+The reference binding doc is from: -+http://www.firmware.org/1275/bindings/usb/usb-1_0.ps -+ -+Required properties: -+- compatible: usbVID,PID. The textual representation of VID, PID shall -+ be in lower case hexadecimal with leading zeroes suppressed. The -+ other compatible strings from the above standard binding could also -+ be used, but a device adhering to this binding may leave out all except -+ for usbVID,PID. -+- reg: the port number which this device is connecting to, the range -+ is 1-31. -+ -+Example: -+ -+&usb1 { -+ status = "okay"; -+ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ hub: genesys@1 { -+ compatible = "usb5e3,608"; -+ reg = <1>; -+ }; -+} ---- a/drivers/usb/core/Makefile -+++ b/drivers/usb/core/Makefile -@@ -5,7 +5,7 @@ - usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o - usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o - usbcore-y += devio.o notify.o generic.o quirks.o devices.o --usbcore-y += port.o -+usbcore-y += port.o of.o - - usbcore-$(CONFIG_PCI) += hcd-pci.o - usbcore-$(CONFIG_ACPI) += usb-acpi.o ---- /dev/null -+++ b/drivers/usb/core/of.c -@@ -0,0 +1,47 @@ -+/* -+ * of.c The helpers for hcd device tree support -+ * -+ * Copyright (C) 2016 Freescale Semiconductor, Inc. -+ * Author: Peter Chen -+ * -+ * This program is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 of -+ * the License 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, see . -+ */ -+ -+#include -+ -+/** -+ * usb_of_get_child_node - Find the device node match port number -+ * @parent: the parent device node -+ * @portnum: the port number which device is connecting -+ * -+ * Find the node from device tree according to its port number. -+ * -+ * Return: On success, a pointer to the device node, %NULL on failure. -+ */ -+struct device_node *usb_of_get_child_node(struct device_node *parent, -+ int portnum) -+{ -+ struct device_node *node; -+ u32 port; -+ -+ for_each_child_of_node(parent, node) { -+ if (!of_property_read_u32(node, "reg", &port)) { -+ if (port == portnum) -+ return node; -+ } -+ } -+ -+ return NULL; -+} -+EXPORT_SYMBOL_GPL(usb_of_get_child_node); -+ ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -469,6 +470,7 @@ struct usb_device *usb_alloc_dev(struct - dev->route = 0; - - dev->dev.parent = bus->controller; -+ dev->dev.of_node = bus->controller->of_node; - dev_set_name(&dev->dev, "usb%d", bus->busnum); - root_hub = 1; - } else { -@@ -493,6 +495,14 @@ struct usb_device *usb_alloc_dev(struct - dev->dev.parent = &parent->dev; - dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath); - -+ if (!parent->parent) { -+ /* device under root hub's port */ -+ port1 = usb_hcd_find_raw_port_number(usb_hcd, -+ port1); -+ } -+ dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node, -+ port1); -+ - /* hub driver sets up TT records */ - } - ---- a/include/linux/usb/of.h -+++ b/include/linux/usb/of.h -@@ -15,6 +15,8 @@ - bool of_usb_host_tpl_support(struct device_node *np); - int of_usb_update_otg_caps(struct device_node *np, - struct usb_otg_caps *otg_caps); -+struct device_node *usb_of_get_child_node(struct device_node *parent, -+ int portnum); - #else - static inline bool of_usb_host_tpl_support(struct device_node *np) - { -@@ -25,6 +27,11 @@ static inline int of_usb_update_otg_caps - { - return 0; - } -+static inline struct device_node *usb_of_get_child_node -+ (struct device_node *parent, int portnum) -+{ -+ return NULL; -+} - #endif - - #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT) diff --git a/target/linux/generic/pending-4.4/082-0002-usb-core-usb_alloc_dev-fix-setting-of-portnum.patch b/target/linux/generic/pending-4.4/082-0002-usb-core-usb_alloc_dev-fix-setting-of-portnum.patch deleted file mode 100644 index 15cf4cae5..000000000 --- a/target/linux/generic/pending-4.4/082-0002-usb-core-usb_alloc_dev-fix-setting-of-portnum.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 7222c832254a75dcd67d683df75753d4a4e125bb Mon Sep 17 00:00:00 2001 -From: Nicolai Stange -Date: Thu, 17 Mar 2016 23:53:02 +0100 -Subject: [PATCH] usb/core: usb_alloc_dev(): fix setting of ->portnum - -With commit 69bec7259853 ("USB: core: let USB device know device node"), -the port1 argument of usb_alloc_dev() gets overwritten as follows: - - ... usb_alloc_dev(..., unsigned port1) - { - ... - if (!parent->parent) { - port1 = usb_hcd_find_raw_port_number(..., port1); - } - ... - } - -Later on, this now overwritten port1 gets assigned to ->portnum: - - dev->portnum = port1; - -However, since xhci_find_raw_port_number() isn't idempotent, the -aforementioned commit causes a number of KASAN splats like the following: - - BUG: KASAN: slab-out-of-bounds in xhci_find_raw_port_number+0x98/0x170 - at addr ffff8801d9311670 - Read of size 8 by task kworker/2:1/87 - [...] - Workqueue: usb_hub_wq hub_event - 0000000000000188 000000005814b877 ffff8800cba17588 ffffffff8191447e - 0000000041b58ab3 ffffffff82a03209 ffffffff819143a2 ffffffff82a252f4 - ffff8801d93115e0 0000000000000188 ffff8801d9311628 ffff8800cba17588 - Call Trace: - [] dump_stack+0xdc/0x15e - [] ? _atomic_dec_and_lock+0xa2/0xa2 - [] ? print_section+0x61/0xb0 - [] print_trailer+0x179/0x2c0 - [] object_err+0x34/0x40 - [] kasan_report_error+0x2f8/0x8b0 - [] ? __slab_alloc+0x5e/0x90 - [] ? __lock_is_held+0x90/0x130 - [] kasan_report+0x71/0xa0 - [] ? kmem_cache_alloc_trace+0x212/0x560 - [] ? xhci_find_raw_port_number+0x98/0x170 - [] __asan_load8+0x64/0x70 - [] xhci_find_raw_port_number+0x98/0x170 - [] xhci_setup_addressable_virt_dev+0x235/0xa10 - [] xhci_setup_device+0x3c1/0x1430 - [] ? trace_hardirqs_on+0xd/0x10 - [] ? xhci_setup_device+0x1430/0x1430 - [] xhci_address_device+0x13/0x20 - [] hub_port_init+0x55a/0x1550 - [] hub_event+0xef5/0x24d0 - [] ? hub_port_debounce+0x2f0/0x2f0 - [] ? debug_object_deactivate+0x1be/0x270 - [] ? print_rt_rq+0x53/0x2d0 - [] ? trace_hardirqs_off+0xd/0x10 - [] ? _raw_spin_unlock_irqrestore+0x5b/0x60 - [] ? irq_domain_set_hwirq_and_chip+0x30/0xb0 - [] ? debug_lockdep_rcu_enabled+0x39/0x40 - [] ? __lock_is_held+0x90/0x130 - [] process_one_work+0x567/0xec0 - [...] - -Afterwards, xhci reports some functional errors: - - xhci_hcd 0000:00:14.0: ERROR: unexpected setup address command completion - code 0x11. - xhci_hcd 0000:00:14.0: ERROR: unexpected setup address command completion - code 0x11. - usb 4-3: device not accepting address 2, error -22 - -Fix this by not overwriting the port1 argument in usb_alloc_dev(), but -storing the raw port number as required by OF in an additional variable, -raw_port. - -Fixes: 69bec7259853 ("USB: core: let USB device know device node") -Signed-off-by: Nicolai Stange -Acked-by: Alan Stern -Signed-off-by: Greg Kroah-Hartman ---- - drivers/usb/core/usb.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -423,6 +423,7 @@ struct usb_device *usb_alloc_dev(struct - struct usb_device *dev; - struct usb_hcd *usb_hcd = bus_to_hcd(bus); - unsigned root_hub = 0; -+ unsigned raw_port = port1; - - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) -@@ -497,11 +498,11 @@ struct usb_device *usb_alloc_dev(struct - - if (!parent->parent) { - /* device under root hub's port */ -- port1 = usb_hcd_find_raw_port_number(usb_hcd, -+ raw_port = usb_hcd_find_raw_port_number(usb_hcd, - port1); - } - dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node, -- port1); -+ raw_port); - - /* hub driver sets up TT records */ - } diff --git a/target/linux/generic/pending-4.4/083-0001-clk-Add-devm_-clk_hw_-register-unregister-APIs.patch b/target/linux/generic/pending-4.4/083-0001-clk-Add-devm_-clk_hw_-register-unregister-APIs.patch deleted file mode 100644 index 040835313..000000000 --- a/target/linux/generic/pending-4.4/083-0001-clk-Add-devm_-clk_hw_-register-unregister-APIs.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 4143804c4fdef40358c654d1fb2271a1a0f1fedf Mon Sep 17 00:00:00 2001 -From: Stephen Boyd -Date: Fri, 5 Feb 2016 17:02:52 -0800 -Subject: [PATCH] clk: Add {devm_}clk_hw_{register,unregister}() APIs - -We've largely split the clk consumer and provider APIs along -struct clk and struct clk_hw, but clk_register() still returns a -struct clk pointer for each struct clk_hw that's registered. -Eventually we'd like to only allocate struct clks when there's a -user, because struct clk is per-user now, so clk_register() needs -to change. - -Let's add new APIs to register struct clk_hws, but this time -we'll hide the struct clk from the caller by returning an int -error code. Also add an unregistration API that takes the clk_hw -structure that was passed to the registration API. This way -provider drivers never have to deal with a struct clk pointer -unless they're using the clk consumer APIs. - -Signed-off-by: Stephen Boyd ---- - Documentation/driver-model/devres.txt | 1 + - drivers/clk/clk.c | 86 +++++++++++++++++++++++++++++++++++ - include/linux/clk-provider.h | 6 +++ - 3 files changed, 93 insertions(+) - ---- a/Documentation/driver-model/devres.txt -+++ b/Documentation/driver-model/devres.txt -@@ -236,6 +236,7 @@ certainly invest a bit more effort into - CLOCK - devm_clk_get() - devm_clk_put() -+ devm_clk_hw_register() - - DMA - dmam_alloc_coherent() ---- a/drivers/clk/clk.c -+++ b/drivers/clk/clk.c -@@ -2595,6 +2595,22 @@ fail_out: - } - EXPORT_SYMBOL_GPL(clk_register); - -+/** -+ * clk_hw_register - register a clk_hw and return an error code -+ * @dev: device that is registering this clock -+ * @hw: link to hardware-specific clock data -+ * -+ * clk_hw_register is the primary interface for populating the clock tree with -+ * new clock nodes. It returns an integer equal to zero indicating success or -+ * less than zero indicating failure. Drivers must test for an error code after -+ * calling clk_hw_register(). -+ */ -+int clk_hw_register(struct device *dev, struct clk_hw *hw) -+{ -+ return PTR_ERR_OR_ZERO(clk_register(dev, hw)); -+} -+EXPORT_SYMBOL_GPL(clk_hw_register); -+ - /* Free memory allocated for a clock. */ - static void __clk_release(struct kref *ref) - { -@@ -2696,11 +2712,26 @@ void clk_unregister(struct clk *clk) - } - EXPORT_SYMBOL_GPL(clk_unregister); - -+/** -+ * clk_hw_unregister - unregister a currently registered clk_hw -+ * @hw: hardware-specific clock data to unregister -+ */ -+void clk_hw_unregister(struct clk_hw *hw) -+{ -+ clk_unregister(hw->clk); -+} -+EXPORT_SYMBOL_GPL(clk_hw_unregister); -+ - static void devm_clk_release(struct device *dev, void *res) - { - clk_unregister(*(struct clk **)res); - } - -+static void devm_clk_hw_release(struct device *dev, void *res) -+{ -+ clk_hw_unregister(*(struct clk_hw **)res); -+} -+ - /** - * devm_clk_register - resource managed clk_register() - * @dev: device that is registering this clock -@@ -2731,6 +2762,36 @@ struct clk *devm_clk_register(struct dev - } - EXPORT_SYMBOL_GPL(devm_clk_register); - -+/** -+ * devm_clk_hw_register - resource managed clk_hw_register() -+ * @dev: device that is registering this clock -+ * @hw: link to hardware-specific clock data -+ * -+ * Managed clk_hw_register(). Clocks returned from this function are -+ * automatically clk_hw_unregister()ed on driver detach. See clk_hw_register() -+ * for more information. -+ */ -+int devm_clk_hw_register(struct device *dev, struct clk_hw *hw) -+{ -+ struct clk_hw **hwp; -+ int ret; -+ -+ hwp = devres_alloc(devm_clk_hw_release, sizeof(*hwp), GFP_KERNEL); -+ if (!hwp) -+ return -ENOMEM; -+ -+ ret = clk_hw_register(dev, hw); -+ if (!ret) { -+ *hwp = hw; -+ devres_add(dev, hwp); -+ } else { -+ devres_free(hwp); -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(devm_clk_hw_register); -+ - static int devm_clk_match(struct device *dev, void *res, void *data) - { - struct clk *c = res; -@@ -2739,6 +2800,15 @@ static int devm_clk_match(struct device - return c == data; - } - -+static int devm_clk_hw_match(struct device *dev, void *res, void *data) -+{ -+ struct clk_hw *hw = res; -+ -+ if (WARN_ON(!hw)) -+ return 0; -+ return hw == data; -+} -+ - /** - * devm_clk_unregister - resource managed clk_unregister() - * @clk: clock to unregister -@@ -2753,6 +2823,22 @@ void devm_clk_unregister(struct device * - } - EXPORT_SYMBOL_GPL(devm_clk_unregister); - -+/** -+ * devm_clk_hw_unregister - resource managed clk_hw_unregister() -+ * @dev: device that is unregistering the hardware-specific clock data -+ * @hw: link to hardware-specific clock data -+ * -+ * Unregister a clk_hw registered with devm_clk_hw_register(). Normally -+ * this function will not need to be called and the resource management -+ * code will ensure that the resource is freed. -+ */ -+void devm_clk_hw_unregister(struct device *dev, struct clk_hw *hw) -+{ -+ WARN_ON(devres_release(dev, devm_clk_hw_release, devm_clk_hw_match, -+ hw)); -+} -+EXPORT_SYMBOL_GPL(devm_clk_hw_unregister); -+ - /* - * clkdev helpers - */ ---- a/include/linux/clk-provider.h -+++ b/include/linux/clk-provider.h -@@ -639,9 +639,15 @@ void of_gpio_mux_clk_setup(struct device - struct clk *clk_register(struct device *dev, struct clk_hw *hw); - struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw); - -+int __must_check clk_hw_register(struct device *dev, struct clk_hw *hw); -+int __must_check devm_clk_hw_register(struct device *dev, struct clk_hw *hw); -+ - void clk_unregister(struct clk *clk); - void devm_clk_unregister(struct device *dev, struct clk *clk); - -+void clk_hw_unregister(struct clk_hw *hw); -+void devm_clk_hw_unregister(struct device *dev, struct clk_hw *hw); -+ - /* helper functions */ - const char *__clk_get_name(const struct clk *clk); - const char *clk_hw_get_name(const struct clk_hw *hw); diff --git a/target/linux/generic/pending-4.4/083-0002-clk-Add-clk_hw-OF-clk-providers.patch b/target/linux/generic/pending-4.4/083-0002-clk-Add-clk_hw-OF-clk-providers.patch deleted file mode 100644 index 0bcb5bb80..000000000 --- a/target/linux/generic/pending-4.4/083-0002-clk-Add-clk_hw-OF-clk-providers.patch +++ /dev/null @@ -1,234 +0,0 @@ -From 0861e5b8cf80038e91942f1005c8dfce79d18c38 Mon Sep 17 00:00:00 2001 -From: Stephen Boyd -Date: Fri, 5 Feb 2016 17:38:26 -0800 -Subject: [PATCH] clk: Add clk_hw OF clk providers - -Now that we have a clk registration API that doesn't return -struct clks, we need to have some way to hand out struct clks via -the clk_get() APIs that doesn't involve associating struct clk -pointers with an OF node. Currently we ask the OF provider to -give us a struct clk pointer for some clkspec, turn that struct -clk into a struct clk_hw and then allocate a new struct clk to -return to the caller. - -Let's add a clk_hw based OF provider hook that returns a struct -clk_hw directly, so that we skip the intermediate step of -converting from struct clk to struct clk_hw. Eventually when -we've converted all OF clk providers to struct clk_hw based APIs -we can remove the struct clk based ones. - -It should also be noted that we change the onecell provider to -have a flex array instead of a pointer for the array of clk_hw -pointers. This allows providers to allocate one structure of the -correct length in one step instead of two. - -Signed-off-by: Stephen Boyd ---- - drivers/clk/clk.c | 85 +++++++++++++++++++++++++++++++++++++++++--- - include/linux/clk-provider.h | 30 ++++++++++++++++ - 2 files changed, 111 insertions(+), 4 deletions(-) - ---- a/drivers/clk/clk.c -+++ b/drivers/clk/clk.c -@@ -3001,6 +3001,7 @@ struct of_clk_provider { - - struct device_node *node; - struct clk *(*get)(struct of_phandle_args *clkspec, void *data); -+ struct clk_hw *(*get_hw)(struct of_phandle_args *clkspec, void *data); - void *data; - }; - -@@ -3017,6 +3018,12 @@ struct clk *of_clk_src_simple_get(struct - } - EXPORT_SYMBOL_GPL(of_clk_src_simple_get); - -+struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, void *data) -+{ -+ return data; -+} -+EXPORT_SYMBOL_GPL(of_clk_hw_simple_get); -+ - struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data) - { - struct clk_onecell_data *clk_data = data; -@@ -3031,6 +3038,21 @@ struct clk *of_clk_src_onecell_get(struc - } - EXPORT_SYMBOL_GPL(of_clk_src_onecell_get); - -+struct clk_hw * -+of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data) -+{ -+ struct clk_hw_onecell_data *hw_data = data; -+ unsigned int idx = clkspec->args[0]; -+ -+ if (idx >= hw_data->num) { -+ pr_err("%s: invalid index %u\n", __func__, idx); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ return hw_data->hws[idx]; -+} -+EXPORT_SYMBOL_GPL(of_clk_hw_onecell_get); -+ - /** - * of_clk_add_provider() - Register a clock provider for a node - * @np: Device node pointer associated with clock provider -@@ -3067,6 +3089,41 @@ int of_clk_add_provider(struct device_no - EXPORT_SYMBOL_GPL(of_clk_add_provider); - - /** -+ * of_clk_add_hw_provider() - Register a clock provider for a node -+ * @np: Device node pointer associated with clock provider -+ * @get: callback for decoding clk_hw -+ * @data: context pointer for @get callback. -+ */ -+int of_clk_add_hw_provider(struct device_node *np, -+ struct clk_hw *(*get)(struct of_phandle_args *clkspec, -+ void *data), -+ void *data) -+{ -+ struct of_clk_provider *cp; -+ int ret; -+ -+ cp = kzalloc(sizeof(*cp), GFP_KERNEL); -+ if (!cp) -+ return -ENOMEM; -+ -+ cp->node = of_node_get(np); -+ cp->data = data; -+ cp->get_hw = get; -+ -+ mutex_lock(&of_clk_mutex); -+ list_add(&cp->link, &of_clk_providers); -+ mutex_unlock(&of_clk_mutex); -+ pr_debug("Added clk_hw provider from %s\n", np->full_name); -+ -+ ret = of_clk_set_defaults(np, true); -+ if (ret < 0) -+ of_clk_del_provider(np); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(of_clk_add_hw_provider); -+ -+/** - * of_clk_del_provider() - Remove a previously registered clock provider - * @np: Device node pointer associated with clock provider - */ -@@ -3087,11 +3144,32 @@ void of_clk_del_provider(struct device_n - } - EXPORT_SYMBOL_GPL(of_clk_del_provider); - -+static struct clk_hw * -+__of_clk_get_hw_from_provider(struct of_clk_provider *provider, -+ struct of_phandle_args *clkspec) -+{ -+ struct clk *clk; -+ struct clk_hw *hw = ERR_PTR(-EPROBE_DEFER); -+ -+ if (provider->get_hw) { -+ hw = provider->get_hw(clkspec, provider->data); -+ } else if (provider->get) { -+ clk = provider->get(clkspec, provider->data); -+ if (!IS_ERR(clk)) -+ hw = __clk_get_hw(clk); -+ else -+ hw = ERR_CAST(clk); -+ } -+ -+ return hw; -+} -+ - struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec, - const char *dev_id, const char *con_id) - { - struct of_clk_provider *provider; - struct clk *clk = ERR_PTR(-EPROBE_DEFER); -+ struct clk_hw *hw = ERR_PTR(-EPROBE_DEFER); - - if (!clkspec) - return ERR_PTR(-EINVAL); -@@ -3100,10 +3178,9 @@ struct clk *__of_clk_get_from_provider(s - mutex_lock(&of_clk_mutex); - list_for_each_entry(provider, &of_clk_providers, link) { - if (provider->node == clkspec->np) -- clk = provider->get(clkspec, provider->data); -- if (!IS_ERR(clk)) { -- clk = __clk_create_clk(__clk_get_hw(clk), dev_id, -- con_id); -+ hw = __of_clk_get_hw_from_provider(provider, clkspec); -+ if (!IS_ERR(hw)) { -+ clk = __clk_create_clk(hw, dev_id, con_id); - - if (!IS_ERR(clk) && !__clk_get(clk)) { - __clk_free_clk(clk); ---- a/include/linux/clk-provider.h -+++ b/include/linux/clk-provider.h -@@ -693,6 +693,11 @@ struct clk_onecell_data { - unsigned int clk_num; - }; - -+struct clk_hw_onecell_data { -+ size_t num; -+ struct clk_hw *hws[]; -+}; -+ - extern struct of_device_id __clk_of_table; - - #define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn) -@@ -702,10 +707,19 @@ int of_clk_add_provider(struct device_no - struct clk *(*clk_src_get)(struct of_phandle_args *args, - void *data), - void *data); -+int of_clk_add_hw_provider(struct device_node *np, -+ struct clk_hw *(*get)(struct of_phandle_args *clkspec, -+ void *data), -+ void *data); - void of_clk_del_provider(struct device_node *np); - struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, - void *data); -+ -+struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, -+ void *data); - struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); -+struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec, -+ void *data); - int of_clk_get_parent_count(struct device_node *np); - int of_clk_parent_fill(struct device_node *np, const char **parents, - unsigned int size); -@@ -722,6 +736,13 @@ static inline int of_clk_add_provider(st - { - return 0; - } -+static inline int of_clk_add_hw_provider(struct device_node *np, -+ struct clk_hw *(*get)(struct of_phandle_args *clkspec, -+ void *data), -+ void *data) -+{ -+ return 0; -+} - #define of_clk_del_provider(np) \ - { while (0); } - static inline struct clk *of_clk_src_simple_get( -@@ -729,11 +750,21 @@ static inline struct clk *of_clk_src_sim - { - return ERR_PTR(-ENOENT); - } -+static inline struct clk_hw * -+of_clk_hw_simple_get(struct of_phandle_args *clkspec, void *data) -+{ -+ return ERR_PTR(-ENOENT); -+} - static inline struct clk *of_clk_src_onecell_get( - struct of_phandle_args *clkspec, void *data) - { - return ERR_PTR(-ENOENT); - } -+static inline struct clk_hw * -+of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data) -+{ -+ return ERR_PTR(-ENOENT); -+} - static inline int of_clk_get_parent_count(struct device_node *np) - { - return 0; diff --git a/target/linux/generic/pending-4.4/084-0001-usb-core-Introduce-a-USB-port-LED-trigger.patch b/target/linux/generic/pending-4.4/084-0001-usb-core-Introduce-a-USB-port-LED-trigger.patch deleted file mode 100644 index 68039f67b..000000000 --- a/target/linux/generic/pending-4.4/084-0001-usb-core-Introduce-a-USB-port-LED-trigger.patch +++ /dev/null @@ -1,465 +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 -@@ -103,3 +103,11 @@ config USB_ULPI_BUS - - To compile this driver as a module, choose M here: the module will - be called ulpi. -+ -+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/pending-4.4/084-0002-usb-core-usbport-Use-proper-LED-API-to-fix-potential.patch b/target/linux/generic/pending-4.4/084-0002-usb-core-usbport-Use-proper-LED-API-to-fix-potential.patch deleted file mode 100644 index ec41a2dc2..000000000 --- a/target/linux/generic/pending-4.4/084-0002-usb-core-usbport-Use-proper-LED-API-to-fix-potential.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 89778ba335e302a450932ce5b703c1ee6216e949 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 6 Dec 2016 00:39:33 +0100 -Subject: [PATCH] usb: core: usbport: Use proper LED API to fix potential crash -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Calling brightness_set manually isn't safe as some LED drivers don't -implement this callback. The best idea is to just use a proper helper -which will fallback to the brightness_set_blocking callback if needed. - -This fixes: -[ 1461.761528] Unable to handle kernel NULL pointer dereference at virtual address 00000000 -(...) -[ 1462.117049] Backtrace: -[ 1462.119521] [] (usbport_trig_port_store [ledtrig_usbport]) from [] (dev_attr_store+0x20/0x2c) -[ 1462.129826] r7:dcabc7c0 r6:dee0ff80 r5:00000002 r4:bf228164 -[ 1462.135511] [] (dev_attr_store) from [] (sysfs_kf_write+0x48/0x4c) -[ 1462.143459] r5:00000002 r4:c023f738 -[ 1462.147049] [] (sysfs_kf_write) from [] (kernfs_fop_write+0xf8/0x1f8) -[ 1462.155258] r5:00000002 r4:df4a1000 -[ 1462.158850] [] (kernfs_fop_write) from [] (__vfs_write+0x34/0x120) -[ 1462.166800] r10:00000000 r9:dee0e000 r8:c000fc24 r7:00000002 r6:dee0ff80 r5:c01689c0 -[ 1462.174660] r4:df727a80 -[ 1462.177204] [] (__vfs_write) from [] (vfs_write+0xac/0x170) -[ 1462.184543] r9:dee0e000 r8:c000fc24 r7:dee0ff80 r6:b6f092d0 r5:df727a80 r4:00000002 -[ 1462.192319] [] (vfs_write) from [] (SyS_write+0x4c/0xa8) -[ 1462.199396] r9:dee0e000 r8:c000fc24 r7:00000002 r6:b6f092d0 r5:df727a80 r4:df727a80 -[ 1462.207174] [] (SyS_write) from [] (ret_fast_syscall+0x0/0x3c) -[ 1462.214774] r7:00000004 r6:ffffffff r5:00000000 r4:00000000 -[ 1462.220456] Code: bad PC value -[ 1462.223560] ---[ end trace 676638a3a12c7a56 ]--- - -Reported-by: Ralph Sennhauser -Signed-off-by: Rafał Miłecki -Fixes: 0f247626cbb ("usb: core: Introduce a USB port LED trigger") -Cc: stable@vger.kernel.org # 4.9+ -Signed-off-by: Greg Kroah-Hartman ---- - drivers/usb/core/ledtrig-usbport.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - ---- a/drivers/usb/core/ledtrig-usbport.c -+++ b/drivers/usb/core/ledtrig-usbport.c -@@ -74,8 +74,7 @@ static void usbport_trig_update_count(st - - 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); -+ led_set_brightness(led_cdev, usbport_data->count ? LED_FULL : LED_OFF); - } - - /*************************************** -@@ -228,12 +227,12 @@ static int usbport_trig_notify(struct no - 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); -+ led_set_brightness(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); -+ led_set_brightness(led_cdev, LED_OFF); - return NOTIFY_OK; - } - diff --git a/target/linux/generic/pending-4.4/084-0003-usb-core-read-USB-ports-from-DT-in-the-usbport-LED-t.patch b/target/linux/generic/pending-4.4/084-0003-usb-core-read-USB-ports-from-DT-in-the-usbport-LED-t.patch deleted file mode 100644 index 65d17c8a9..000000000 --- a/target/linux/generic/pending-4.4/084-0003-usb-core-read-USB-ports-from-DT-in-the-usbport-LED-t.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 4f04c210d031667e503d6538a72345a36f3b5d71 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 8 Jun 2017 18:08:32 +0200 -Subject: [PATCH] usb: core: read USB ports from DT in the usbport LED trigger - driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This uses DT info to read relation description of LEDs and USB ports. If -DT has properly described LEDs, trigger will know when to turn them on. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Greg Kroah-Hartman ---- - drivers/usb/core/ledtrig-usbport.c | 56 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 56 insertions(+) - ---- a/drivers/usb/core/ledtrig-usbport.c -+++ b/drivers/usb/core/ledtrig-usbport.c -@@ -11,8 +11,10 @@ - #include - #include - #include -+#include - #include - #include -+#include - - struct usbport_trig_data { - struct led_classdev *led_cdev; -@@ -123,6 +125,57 @@ static const struct attribute_group port - * Adding & removing ports - ***************************************/ - -+/** -+ * usbport_trig_port_observed - Check if port should be observed -+ */ -+static bool usbport_trig_port_observed(struct usbport_trig_data *usbport_data, -+ struct usb_device *usb_dev, int port1) -+{ -+ struct device *dev = usbport_data->led_cdev->dev; -+ struct device_node *led_np = dev->of_node; -+ struct of_phandle_args args; -+ struct device_node *port_np; -+ int count, i; -+ -+ if (!led_np) -+ return false; -+ -+ /* Get node of port being added */ -+ port_np = usb_of_get_child_node(usb_dev->dev.of_node, port1); -+ if (!port_np) -+ return false; -+ -+ /* Amount of trigger sources for this LED */ -+ count = of_count_phandle_with_args(led_np, "trigger-sources", -+ "#trigger-source-cells"); -+ if (count < 0) { -+ dev_warn(dev, "Failed to get trigger sources for %s\n", -+ led_np->full_name); -+ return false; -+ } -+ -+ /* Check list of sources for this specific port */ -+ for (i = 0; i < count; i++) { -+ int err; -+ -+ err = of_parse_phandle_with_args(led_np, "trigger-sources", -+ "#trigger-source-cells", i, -+ &args); -+ if (err) { -+ dev_err(dev, "Failed to get trigger source phandle at index %d: %d\n", -+ i, err); -+ continue; -+ } -+ -+ of_node_put(args.np); -+ -+ if (args.np == port_np) -+ return true; -+ } -+ -+ return false; -+} -+ - static int usbport_trig_add_port(struct usbport_trig_data *usbport_data, - struct usb_device *usb_dev, - const char *hub_name, int portnum) -@@ -141,6 +194,8 @@ static int usbport_trig_add_port(struct - port->data = usbport_data; - port->hub = usb_dev; - port->portnum = portnum; -+ port->observed = usbport_trig_port_observed(usbport_data, usb_dev, -+ portnum); - - len = strlen(hub_name) + 8; - port->port_name = kzalloc(len, GFP_KERNEL); -@@ -255,6 +310,7 @@ static void usbport_trig_activate(struct - if (err) - goto err_free; - usb_for_each_dev(usbport_data, usbport_trig_add_usb_dev_ports); -+ usbport_trig_update_count(usbport_data); - - /* Notifications */ - usbport_data->nb.notifier_call = usbport_trig_notify, diff --git a/target/linux/generic/pending-4.4/085-0001-leds-leds-gpio-Set-of_node-for-created-LED-devices.patch b/target/linux/generic/pending-4.4/085-0001-leds-leds-gpio-Set-of_node-for-created-LED-devices.patch deleted file mode 100644 index f60b1fc16..000000000 --- a/target/linux/generic/pending-4.4/085-0001-leds-leds-gpio-Set-of_node-for-created-LED-devices.patch +++ /dev/null @@ -1,53 +0,0 @@ -From bff23714bc36a1322d0f14519022df0d1a4b21f3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 8 Jul 2016 14:53:38 +0200 -Subject: [PATCH] leds: leds-gpio: Set of_node for created LED devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When working with Device Tree we iterate over children of "gpio-leds" -compatible node and create LED device for each of them. We take care of -all common DT properties (label, default trigger, state, etc.), however -some triggers may want to support more of them. - -It could be useful for timer trigger to support setting delay on/off -values with Device Tree property. Or for transient trigger to support -e.g. duration property. - -We obviously should handle such properties in triggers, not in generic -code. To let trigger drivers read properties from DT node we need to set -of_node to point the relevant node. This change allows using all kind of -of helpers in e.g. "activate" callbacks. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Jacek Anaszewski ---- - drivers/leds/leds-gpio.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -182,6 +182,7 @@ static struct gpio_leds_priv *gpio_leds_ - return ERR_PTR(-ENOMEM); - - device_for_each_child_node(dev, child) { -+ struct gpio_led_data *led_dat = &priv->leds[priv->num_leds]; - struct gpio_led led = {}; - const char *state = NULL; - -@@ -220,12 +221,12 @@ static struct gpio_leds_priv *gpio_leds_ - if (fwnode_property_present(child, "retain-state-suspended")) - led.retain_state_suspended = 1; - -- ret = create_gpio_led(&led, &priv->leds[priv->num_leds], -- dev, NULL); -+ ret = create_gpio_led(&led, led_dat, dev, NULL); - if (ret < 0) { - fwnode_handle_put(child); - goto err; - } -+ led_dat->cdev.dev->of_node = np; - priv->num_leds++; - } - diff --git a/target/linux/generic/pending-4.4/085-0002-leds-gpio-introduce-gpio_blink_set_t.patch b/target/linux/generic/pending-4.4/085-0002-leds-gpio-introduce-gpio_blink_set_t.patch deleted file mode 100644 index 670d4ba91..000000000 --- a/target/linux/generic/pending-4.4/085-0002-leds-gpio-introduce-gpio_blink_set_t.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 68620e594c250ba8c43a78e77f5296cb9952582e Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Wed, 14 Sep 2016 20:54:12 +0200 -Subject: [PATCH] leds: gpio: introduce gpio_blink_set_t - -Introduce a typedef gpio_blink_set_t to improve readability of the code. - -Signed-off-by: Heiner Kallweit -Signed-off-by: Jacek Anaszewski ---- - drivers/leds/leds-gpio.c | 6 ++---- - include/linux/leds.h | 9 ++++++--- - 2 files changed, 8 insertions(+), 7 deletions(-) - ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -29,8 +29,7 @@ struct gpio_led_data { - u8 new_level; - u8 can_sleep; - u8 blinking; -- int (*platform_gpio_blink_set)(struct gpio_desc *desc, int state, -- unsigned long *delay_on, unsigned long *delay_off); -+ gpio_blink_set_t platform_gpio_blink_set; - }; - - static void gpio_led_work(struct work_struct *work) -@@ -88,8 +87,7 @@ static int gpio_blink_set(struct led_cla - - static int create_gpio_led(const struct gpio_led *template, - struct gpio_led_data *led_dat, struct device *parent, -- int (*blink_set)(struct gpio_desc *, int, unsigned long *, -- unsigned long *)) -+ gpio_blink_set_t blink_set) - { - int ret, state; - ---- a/include/linux/leds.h -+++ b/include/linux/leds.h -@@ -330,6 +330,11 @@ struct led_platform_data { - struct led_info *leds; - }; - -+struct gpio_desc; -+typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state, -+ unsigned long *delay_on, -+ unsigned long *delay_off); -+ - /* For the leds-gpio driver */ - struct gpio_led { - const char *name; -@@ -352,9 +357,7 @@ struct gpio_led_platform_data { - #define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ - #define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ - #define GPIO_LED_BLINK 2 /* Please, blink */ -- int (*gpio_blink_set)(struct gpio_desc *desc, int state, -- unsigned long *delay_on, -- unsigned long *delay_off); -+ gpio_blink_set_t gpio_blink_set; - }; - - struct platform_device *gpio_led_register_device( diff --git a/target/linux/generic/pending-4.4/085-0003-leds-gpio-switch-to-managed-version-of-led_classdev_.patch b/target/linux/generic/pending-4.4/085-0003-leds-gpio-switch-to-managed-version-of-led_classdev_.patch deleted file mode 100644 index 7aa865aa8..000000000 --- a/target/linux/generic/pending-4.4/085-0003-leds-gpio-switch-to-managed-version-of-led_classdev_.patch +++ /dev/null @@ -1,75 +0,0 @@ -From bc2c0dd85a0a31505ca2f92bef891ddac9126725 Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Wed, 14 Sep 2016 20:55:27 +0200 -Subject: [PATCH] leds: gpio: switch to managed version of - led_classdev_register - -Using the managed version of led_classdev_register allows to -significantly simplify the code. - -Signed-off-by: Heiner Kallweit -Signed-off-by: Jacek Anaszewski ---- - drivers/leds/leds-gpio.c | 23 ++--------------------- - 1 file changed, 2 insertions(+), 21 deletions(-) - ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -143,7 +143,7 @@ static int create_gpio_led(const struct - - INIT_WORK(&led_dat->work, gpio_led_work); - -- return led_classdev_register(parent, &led_dat->cdev); -+ return devm_led_classdev_register(parent, &led_dat->cdev); - } - - static void delete_gpio_led(struct gpio_led_data *led) -@@ -231,8 +231,6 @@ static struct gpio_leds_priv *gpio_leds_ - return priv; - - err: -- for (count = priv->num_leds - 1; count >= 0; count--) -- delete_gpio_led(&priv->leds[count]); - return ERR_PTR(ret); - } - -@@ -261,12 +259,8 @@ static int gpio_led_probe(struct platfor - ret = create_gpio_led(&pdata->leds[i], - &priv->leds[i], - &pdev->dev, pdata->gpio_blink_set); -- if (ret < 0) { -- /* On failure: unwind the led creations */ -- for (i = i - 1; i >= 0; i--) -- delete_gpio_led(&priv->leds[i]); -+ if (ret < 0) - return ret; -- } - } - } else { - priv = gpio_leds_create(pdev); -@@ -279,17 +273,6 @@ static int gpio_led_probe(struct platfor - return 0; - } - --static int gpio_led_remove(struct platform_device *pdev) --{ -- struct gpio_leds_priv *priv = platform_get_drvdata(pdev); -- int i; -- -- for (i = 0; i < priv->num_leds; i++) -- delete_gpio_led(&priv->leds[i]); -- -- return 0; --} -- - static void gpio_led_shutdown(struct platform_device *pdev) - { - struct gpio_leds_priv *priv = platform_get_drvdata(pdev); -@@ -304,7 +287,6 @@ static void gpio_led_shutdown(struct pla - - static struct platform_driver gpio_led_driver = { - .probe = gpio_led_probe, -- .remove = gpio_led_remove, - .shutdown = gpio_led_shutdown, - .driver = { - .name = "leds-gpio", diff --git a/target/linux/generic/pending-4.4/085-0004-leds-core-add-OF-variants-of-LED-registering-functio.patch b/target/linux/generic/pending-4.4/085-0004-leds-core-add-OF-variants-of-LED-registering-functio.patch deleted file mode 100644 index e02984041..000000000 --- a/target/linux/generic/pending-4.4/085-0004-leds-core-add-OF-variants-of-LED-registering-functio.patch +++ /dev/null @@ -1,120 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 6 Mar 2017 06:19:44 +0100 -Subject: [PATCH] leds: core: add OF variants of LED registering functions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -These new functions allow passing an additional device_node argument -that will be internally set for created LED device. Thanks to this LED -core code and triggers will be able to access DT node for reading extra -info. - -The easiest solution for achieving this was reworking old functions to -more generic ones & adding simple defines for API compatibility. - -Signed-off-by: Rafał Miłecki -Acked-by: Pavel Machek -Signed-off-by: Jacek Anaszewski ---- - drivers/leds/led-class.c | 26 ++++++++++++++++---------- - include/linux/leds.h | 14 ++++++++++---- - 2 files changed, 26 insertions(+), 14 deletions(-) - ---- a/drivers/leds/led-class.c -+++ b/drivers/leds/led-class.c -@@ -181,11 +181,14 @@ static int led_classdev_next_name(const - } - - /** -- * led_classdev_register - register a new object of led_classdev class. -- * @parent: The device to register. -+ * of_led_classdev_register - register a new object of led_classdev class. -+ * -+ * @parent: parent of LED device - * @led_cdev: the led_classdev structure for this device. -+ * @np: DT node describing this LED - */ --int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) -+int of_led_classdev_register(struct device *parent, struct device_node *np, -+ struct led_classdev *led_cdev) - { - char name[64]; - int ret; -@@ -198,6 +201,7 @@ int led_classdev_register(struct device - led_cdev, led_cdev->groups, "%s", name); - if (IS_ERR(led_cdev->dev)) - return PTR_ERR(led_cdev->dev); -+ led_cdev->dev->of_node = np; - - if (ret) - dev_warn(parent, "Led %s renamed to %s due to name collision", -@@ -230,7 +234,7 @@ int led_classdev_register(struct device - - return 0; - } --EXPORT_SYMBOL_GPL(led_classdev_register); -+EXPORT_SYMBOL_GPL(of_led_classdev_register); - - /** - * led_classdev_unregister - unregisters a object of led_properties class. -@@ -269,12 +273,14 @@ static void devm_led_classdev_release(st - } - - /** -- * devm_led_classdev_register - resource managed led_classdev_register() -- * @parent: The device to register. -+ * devm_of_led_classdev_register - resource managed led_classdev_register() -+ * -+ * @parent: parent of LED device - * @led_cdev: the led_classdev structure for this device. - */ --int devm_led_classdev_register(struct device *parent, -- struct led_classdev *led_cdev) -+int devm_of_led_classdev_register(struct device *parent, -+ struct device_node *np, -+ struct led_classdev *led_cdev) - { - struct led_classdev **dr; - int rc; -@@ -283,7 +289,7 @@ int devm_led_classdev_register(struct de - if (!dr) - return -ENOMEM; - -- rc = led_classdev_register(parent, led_cdev); -+ rc = of_led_classdev_register(parent, np, led_cdev); - if (rc) { - devres_free(dr); - return rc; -@@ -294,7 +300,7 @@ int devm_led_classdev_register(struct de - - return 0; - } --EXPORT_SYMBOL_GPL(devm_led_classdev_register); -+EXPORT_SYMBOL_GPL(devm_of_led_classdev_register); - - static int devm_led_classdev_match(struct device *dev, void *res, void *data) - { ---- a/include/linux/leds.h -+++ b/include/linux/leds.h -@@ -103,10 +103,16 @@ struct led_classdev { - struct mutex led_access; - }; - --extern int led_classdev_register(struct device *parent, -- struct led_classdev *led_cdev); --extern int devm_led_classdev_register(struct device *parent, -- struct led_classdev *led_cdev); -+extern int of_led_classdev_register(struct device *parent, -+ struct device_node *np, -+ struct led_classdev *led_cdev); -+#define led_classdev_register(parent, led_cdev) \ -+ of_led_classdev_register(parent, NULL, led_cdev) -+extern int devm_of_led_classdev_register(struct device *parent, -+ struct device_node *np, -+ struct led_classdev *led_cdev); -+#define devm_led_classdev_register(parent, led_cdev) \ -+ devm_of_led_classdev_register(parent, NULL, led_cdev) - extern void led_classdev_unregister(struct led_classdev *led_cdev); - extern void devm_led_classdev_unregister(struct device *parent, - struct led_classdev *led_cdev); diff --git a/target/linux/generic/pending-4.4/085-0005-leds-gpio-use-OF-variant-of-LED-registering-function.patch b/target/linux/generic/pending-4.4/085-0005-leds-gpio-use-OF-variant-of-LED-registering-function.patch deleted file mode 100644 index 159fae84f..000000000 --- a/target/linux/generic/pending-4.4/085-0005-leds-gpio-use-OF-variant-of-LED-registering-function.patch +++ /dev/null @@ -1,60 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 6 Mar 2017 06:19:45 +0100 -Subject: [PATCH] leds: gpio: use OF variant of LED registering function -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In leds-gpio we support LEDs specified in DT so we should use -(devm_)of_led_classdev_register. This allows passing DT node as argument -for use by the LED subsystem. - -Signed-off-by: Rafał Miłecki -Acked-by: Pavel Machek -Signed-off-by: Jacek Anaszewski ---- - drivers/leds/leds-gpio.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/drivers/leds/leds-gpio.c -+++ b/drivers/leds/leds-gpio.c -@@ -87,7 +87,7 @@ static int gpio_blink_set(struct led_cla - - static int create_gpio_led(const struct gpio_led *template, - struct gpio_led_data *led_dat, struct device *parent, -- gpio_blink_set_t blink_set) -+ struct device_node *np, gpio_blink_set_t blink_set) - { - int ret, state; - -@@ -143,7 +143,7 @@ static int create_gpio_led(const struct - - INIT_WORK(&led_dat->work, gpio_led_work); - -- return devm_led_classdev_register(parent, &led_dat->cdev); -+ return devm_of_led_classdev_register(parent, np, &led_dat->cdev); - } - - static void delete_gpio_led(struct gpio_led_data *led) -@@ -219,7 +219,7 @@ static struct gpio_leds_priv *gpio_leds_ - if (fwnode_property_present(child, "retain-state-suspended")) - led.retain_state_suspended = 1; - -- ret = create_gpio_led(&led, led_dat, dev, NULL); -+ ret = create_gpio_led(&led, led_dat, dev, np, NULL); - if (ret < 0) { - fwnode_handle_put(child); - goto err; -@@ -256,9 +256,9 @@ static int gpio_led_probe(struct platfor - - priv->num_leds = pdata->num_leds; - for (i = 0; i < priv->num_leds; i++) { -- ret = create_gpio_led(&pdata->leds[i], -- &priv->leds[i], -- &pdev->dev, pdata->gpio_blink_set); -+ ret = create_gpio_led(&pdata->leds[i], &priv->leds[i], -+ &pdev->dev, NULL, -+ pdata->gpio_blink_set); - if (ret < 0) - return ret; - } diff --git a/target/linux/generic/pending-4.4/086-0001-thermal-of-thermal-Add-devm-version-of-thermal_zone_.patch b/target/linux/generic/pending-4.4/086-0001-thermal-of-thermal-Add-devm-version-of-thermal_zone_.patch deleted file mode 100644 index b551bac69..000000000 --- a/target/linux/generic/pending-4.4/086-0001-thermal-of-thermal-Add-devm-version-of-thermal_zone_.patch +++ /dev/null @@ -1,143 +0,0 @@ -From e498b4984db82b4ba3ceea7dba813222a31e9c2e Mon Sep 17 00:00:00 2001 -From: Laxman Dewangan -Date: Wed, 9 Mar 2016 18:40:06 +0530 -Subject: [PATCH] thermal: of-thermal: Add devm version of - thermal_zone_of_sensor_register - -Add resource managed version of thermal_zone_of_sensor_register() and -thermal_zone_of_sensor_unregister(). - -This helps in reducing the code size in error path, remove of -driver remove callbacks and making proper sequence for deallocations. - -Signed-off-by: Laxman Dewangan -Signed-off-by: Eduardo Valentin ---- - drivers/thermal/of-thermal.c | 81 ++++++++++++++++++++++++++++++++++++++++++++ - include/linux/thermal.h | 18 ++++++++++ - 2 files changed, 99 insertions(+) - ---- a/drivers/thermal/of-thermal.c -+++ b/drivers/thermal/of-thermal.c -@@ -559,6 +559,87 @@ void thermal_zone_of_sensor_unregister(s - } - EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_unregister); - -+static void devm_thermal_zone_of_sensor_release(struct device *dev, void *res) -+{ -+ thermal_zone_of_sensor_unregister(dev, -+ *(struct thermal_zone_device **)res); -+} -+ -+static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res, -+ void *data) -+{ -+ struct thermal_zone_device **r = res; -+ -+ if (WARN_ON(!r || !*r)) -+ return 0; -+ -+ return *r == data; -+} -+ -+/** -+ * devm_thermal_zone_of_sensor_register - Resource managed version of -+ * thermal_zone_of_sensor_register() -+ * @dev: a valid struct device pointer of a sensor device. Must contain -+ * a valid .of_node, for the sensor node. -+ * @sensor_id: a sensor identifier, in case the sensor IP has more -+ * than one sensors -+ * @data: a private pointer (owned by the caller) that will be passed -+ * back, when a temperature reading is needed. -+ * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_temp. -+ * -+ * Refer thermal_zone_of_sensor_register() for more details. -+ * -+ * Return: On success returns a valid struct thermal_zone_device, -+ * otherwise, it returns a corresponding ERR_PTR(). Caller must -+ * check the return value with help of IS_ERR() helper. -+ * Registered hermal_zone_device device will automatically be -+ * released when device is unbounded. -+ */ -+struct thermal_zone_device *devm_thermal_zone_of_sensor_register( -+ struct device *dev, int sensor_id, -+ void *data, const struct thermal_zone_of_device_ops *ops) -+{ -+ struct thermal_zone_device **ptr, *tzd; -+ -+ ptr = devres_alloc(devm_thermal_zone_of_sensor_release, sizeof(*ptr), -+ GFP_KERNEL); -+ if (!ptr) -+ return ERR_PTR(-ENOMEM); -+ -+ tzd = thermal_zone_of_sensor_register(dev, sensor_id, data, ops); -+ if (IS_ERR(tzd)) { -+ devres_free(ptr); -+ return tzd; -+ } -+ -+ *ptr = tzd; -+ devres_add(dev, ptr); -+ -+ return tzd; -+} -+EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_register); -+ -+/** -+ * devm_thermal_zone_of_sensor_unregister - Resource managed version of -+ * thermal_zone_of_sensor_unregister(). -+ * @dev: Device for which which resource was allocated. -+ * @tzd: a pointer to struct thermal_zone_device where the sensor is registered. -+ * -+ * This function removes the sensor callbacks and private data from the -+ * thermal zone device registered with devm_thermal_zone_of_sensor_register() -+ * API. It will also silent the zone by remove the .get_temp() and .get_trend() -+ * thermal zone device callbacks. -+ * Normally this function will not need to be called and the resource -+ * management code will ensure that the resource is freed. -+ */ -+void devm_thermal_zone_of_sensor_unregister(struct device *dev, -+ struct thermal_zone_device *tzd) -+{ -+ WARN_ON(devres_release(dev, devm_thermal_zone_of_sensor_release, -+ devm_thermal_zone_of_sensor_match, tzd)); -+} -+EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_unregister); -+ - /*** functions parsing device tree nodes ***/ - - /** ---- a/include/linux/thermal.h -+++ b/include/linux/thermal.h -@@ -364,6 +364,11 @@ thermal_zone_of_sensor_register(struct d - const struct thermal_zone_of_device_ops *ops); - void thermal_zone_of_sensor_unregister(struct device *dev, - struct thermal_zone_device *tz); -+struct thermal_zone_device *devm_thermal_zone_of_sensor_register( -+ struct device *dev, int id, void *data, -+ const struct thermal_zone_of_device_ops *ops); -+void devm_thermal_zone_of_sensor_unregister(struct device *dev, -+ struct thermal_zone_device *tz); - #else - static inline struct thermal_zone_device * - thermal_zone_of_sensor_register(struct device *dev, int id, void *data, -@@ -378,6 +383,19 @@ void thermal_zone_of_sensor_unregister(s - { - } - -+static inline struct thermal_zone_device *devm_thermal_zone_of_sensor_register( -+ struct device *dev, int id, void *data, -+ const struct thermal_zone_of_device_ops *ops) -+{ -+ return ERR_PTR(-ENODEV); -+} -+ -+static inline -+void devm_thermal_zone_of_sensor_unregister(struct device *dev, -+ struct thermal_zone_device *tz) -+{ -+} -+ - #endif - - #if IS_ENABLED(CONFIG_THERMAL) diff --git a/target/linux/generic/pending-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch b/target/linux/generic/pending-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch deleted file mode 100644 index 3fbe5f521..000000000 --- a/target/linux/generic/pending-4.4/086-0002-thermal-core-export-apis-to-get-slope-and-offset.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 4a7069a32c99a81950de035535b0a064dcceaeba Mon Sep 17 00:00:00 2001 -From: Rajendra Nayak -Date: Thu, 5 May 2016 14:21:42 +0530 -Subject: [PATCH] thermal: core: export apis to get slope and offset - -Add apis for platform thermal drivers to query for slope and offset -attributes, which might be needed for temperature calculations. - -Signed-off-by: Rajendra Nayak -Signed-off-by: Eduardo Valentin -Signed-off-by: Zhang Rui ---- - Documentation/thermal/sysfs-api.txt | 12 ++++++++++++ - drivers/thermal/thermal_core.c | 30 ++++++++++++++++++++++++++++++ - include/linux/thermal.h | 8 ++++++++ - 3 files changed, 50 insertions(+) - ---- a/Documentation/thermal/sysfs-api.txt -+++ b/Documentation/thermal/sysfs-api.txt -@@ -72,6 +72,18 @@ temperature) and throttle appropriate de - It deletes the corresponding entry form /sys/class/thermal folder and - unbind all the thermal cooling devices it uses. - -+1.1.7 int thermal_zone_get_slope(struct thermal_zone_device *tz) -+ -+ This interface is used to read the slope attribute value -+ for the thermal zone device, which might be useful for platform -+ drivers for temperature calculations. -+ -+1.1.8 int thermal_zone_get_offset(struct thermal_zone_device *tz) -+ -+ This interface is used to read the offset attribute value -+ for the thermal zone device, which might be useful for platform -+ drivers for temperature calculations. -+ - 1.2 thermal cooling device interface - 1.2.1 struct thermal_cooling_device *thermal_cooling_device_register(char *name, - void *devdata, struct thermal_cooling_device_ops *) ---- a/drivers/thermal/thermal_core.c -+++ b/drivers/thermal/thermal_core.c -@@ -2061,6 +2061,36 @@ exit: - } - EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name); - -+/** -+ * thermal_zone_get_slope - return the slope attribute of the thermal zone -+ * @tz: thermal zone device with the slope attribute -+ * -+ * Return: If the thermal zone device has a slope attribute, return it, else -+ * return 1. -+ */ -+int thermal_zone_get_slope(struct thermal_zone_device *tz) -+{ -+ if (tz && tz->tzp) -+ return tz->tzp->slope; -+ return 1; -+} -+EXPORT_SYMBOL_GPL(thermal_zone_get_slope); -+ -+/** -+ * thermal_zone_get_offset - return the offset attribute of the thermal zone -+ * @tz: thermal zone device with the offset attribute -+ * -+ * Return: If the thermal zone device has a offset attribute, return it, else -+ * return 0. -+ */ -+int thermal_zone_get_offset(struct thermal_zone_device *tz) -+{ -+ if (tz && tz->tzp) -+ return tz->tzp->offset; -+ return 0; -+} -+EXPORT_SYMBOL_GPL(thermal_zone_get_offset); -+ - #ifdef CONFIG_NET - static const struct genl_multicast_group thermal_event_mcgrps[] = { - { .name = THERMAL_GENL_MCAST_GROUP_NAME, }, ---- a/include/linux/thermal.h -+++ b/include/linux/thermal.h -@@ -432,6 +432,8 @@ thermal_of_cooling_device_register(struc - void thermal_cooling_device_unregister(struct thermal_cooling_device *); - struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); - int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); -+int thermal_zone_get_slope(struct thermal_zone_device *tz); -+int thermal_zone_get_offset(struct thermal_zone_device *tz); - - int get_tz_trend(struct thermal_zone_device *, int); - struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, -@@ -489,6 +491,12 @@ static inline struct thermal_zone_device - static inline int thermal_zone_get_temp( - struct thermal_zone_device *tz, int *temp) - { return -ENODEV; } -+static inline int thermal_zone_get_slope( -+ struct thermal_zone_device *tz) -+{ return -ENODEV; } -+static inline int thermal_zone_get_offset( -+ struct thermal_zone_device *tz) -+{ return -ENODEV; } - static inline int get_tz_trend(struct thermal_zone_device *tz, int trip) - { return -ENODEV; } - static inline struct thermal_instance * diff --git a/target/linux/generic/pending-4.4/086-0003-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch b/target/linux/generic/pending-4.4/086-0003-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch deleted file mode 100644 index d606804de..000000000 --- a/target/linux/generic/pending-4.4/086-0003-thermal-bcm2835-add-thermal-driver-for-bcm2835-SoC.patch +++ /dev/null @@ -1,365 +0,0 @@ -From bcb7dd9ef206f7d646ed8dac6fe7772083714253 Mon Sep 17 00:00:00 2001 -From: Stefan Wahren -Date: Fri, 31 Mar 2017 20:03:06 +0000 -Subject: [PATCH] thermal: bcm2835: add thermal driver for bcm2835 SoC -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add basic thermal driver for bcm2835 SoC. - -This driver currently make sure that tsense HW block is set up -correctly. - -Tested-by: Rafał Miłecki -Signed-off-by: Martin Sperl -Signed-off-by: Stefan Wahren -Acked-by: Eric Anholt -Acked-by: Eduardo Valentin -Signed-off-by: Eduardo Valentin ---- - drivers/thermal/Kconfig | 8 + - drivers/thermal/Makefile | 1 + - drivers/thermal/bcm2835_thermal.c | 314 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 323 insertions(+) - create mode 100644 drivers/thermal/bcm2835_thermal.c - ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -391,4 +391,12 @@ config QCOM_SPMI_TEMP_ALARM - real time die temperature if an ADC is present or an estimate of the - temperature based upon the over temperature stage value. - -+config BCM2835_THERMAL -+ tristate "Thermal sensors on bcm2835 SoC" -+ depends on ARCH_BCM2835 || COMPILE_TEST -+ depends on HAS_IOMEM -+ depends on THERMAL_OF -+ help -+ Support for thermal sensors on Broadcom bcm2835 SoCs. -+ - endif ---- a/drivers/thermal/Makefile -+++ b/drivers/thermal/Makefile -@@ -48,3 +48,4 @@ obj-$(CONFIG_INTEL_PCH_THERMAL) += intel - obj-$(CONFIG_ST_THERMAL) += st/ - obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o - obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o -+obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o ---- /dev/null -+++ b/drivers/thermal/bcm2835_thermal.c -@@ -0,0 +1,314 @@ -+/* -+ * Driver for Broadcom BCM2835 SoC temperature sensor -+ * -+ * Copyright (C) 2016 Martin Sperl -+ * -+ * 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 -+#include -+ -+#define BCM2835_TS_TSENSCTL 0x00 -+#define BCM2835_TS_TSENSSTAT 0x04 -+ -+#define BCM2835_TS_TSENSCTL_PRWDW BIT(0) -+#define BCM2835_TS_TSENSCTL_RSTB BIT(1) -+ -+/* -+ * bandgap reference voltage in 6 mV increments -+ * 000b = 1178 mV, 001b = 1184 mV, ... 111b = 1220 mV -+ */ -+#define BCM2835_TS_TSENSCTL_CTRL_BITS 3 -+#define BCM2835_TS_TSENSCTL_CTRL_SHIFT 2 -+#define BCM2835_TS_TSENSCTL_CTRL_MASK \ -+ GENMASK(BCM2835_TS_TSENSCTL_CTRL_BITS + \ -+ BCM2835_TS_TSENSCTL_CTRL_SHIFT - 1, \ -+ BCM2835_TS_TSENSCTL_CTRL_SHIFT) -+#define BCM2835_TS_TSENSCTL_CTRL_DEFAULT 1 -+#define BCM2835_TS_TSENSCTL_EN_INT BIT(5) -+#define BCM2835_TS_TSENSCTL_DIRECT BIT(6) -+#define BCM2835_TS_TSENSCTL_CLR_INT BIT(7) -+#define BCM2835_TS_TSENSCTL_THOLD_SHIFT 8 -+#define BCM2835_TS_TSENSCTL_THOLD_BITS 10 -+#define BCM2835_TS_TSENSCTL_THOLD_MASK \ -+ GENMASK(BCM2835_TS_TSENSCTL_THOLD_BITS + \ -+ BCM2835_TS_TSENSCTL_THOLD_SHIFT - 1, \ -+ BCM2835_TS_TSENSCTL_THOLD_SHIFT) -+/* -+ * time how long the block to be asserted in reset -+ * which based on a clock counter (TSENS clock assumed) -+ */ -+#define BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT 18 -+#define BCM2835_TS_TSENSCTL_RSTDELAY_BITS 8 -+#define BCM2835_TS_TSENSCTL_REGULEN BIT(26) -+ -+#define BCM2835_TS_TSENSSTAT_DATA_BITS 10 -+#define BCM2835_TS_TSENSSTAT_DATA_SHIFT 0 -+#define BCM2835_TS_TSENSSTAT_DATA_MASK \ -+ GENMASK(BCM2835_TS_TSENSSTAT_DATA_BITS + \ -+ BCM2835_TS_TSENSSTAT_DATA_SHIFT - 1, \ -+ BCM2835_TS_TSENSSTAT_DATA_SHIFT) -+#define BCM2835_TS_TSENSSTAT_VALID BIT(10) -+#define BCM2835_TS_TSENSSTAT_INTERRUPT BIT(11) -+ -+struct bcm2835_thermal_data { -+ struct thermal_zone_device *tz; -+ void __iomem *regs; -+ struct clk *clk; -+ struct dentry *debugfsdir; -+}; -+ -+static int bcm2835_thermal_adc2temp(u32 adc, int offset, int slope) -+{ -+ return offset + slope * adc; -+} -+ -+static int bcm2835_thermal_temp2adc(int temp, int offset, int slope) -+{ -+ temp -= offset; -+ temp /= slope; -+ -+ if (temp < 0) -+ temp = 0; -+ if (temp >= BIT(BCM2835_TS_TSENSSTAT_DATA_BITS)) -+ temp = BIT(BCM2835_TS_TSENSSTAT_DATA_BITS) - 1; -+ -+ return temp; -+} -+ -+static int bcm2835_thermal_get_temp(void *d, int *temp) -+{ -+ struct bcm2835_thermal_data *data = d; -+ u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT); -+ -+ if (!(val & BCM2835_TS_TSENSSTAT_VALID)) -+ return -EIO; -+ -+ val &= BCM2835_TS_TSENSSTAT_DATA_MASK; -+ -+ *temp = bcm2835_thermal_adc2temp( -+ val, -+ thermal_zone_get_offset(data->tz), -+ thermal_zone_get_slope(data->tz)); -+ -+ return 0; -+} -+ -+static const struct debugfs_reg32 bcm2835_thermal_regs[] = { -+ { -+ .name = "ctl", -+ .offset = 0 -+ }, -+ { -+ .name = "stat", -+ .offset = 4 -+ } -+}; -+ -+static void bcm2835_thermal_debugfs(struct platform_device *pdev) -+{ -+ struct thermal_zone_device *tz = platform_get_drvdata(pdev); -+ struct bcm2835_thermal_data *data = tz->devdata; -+ struct debugfs_regset32 *regset; -+ -+ data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL); -+ if (!data->debugfsdir) -+ return; -+ -+ regset = devm_kzalloc(&pdev->dev, sizeof(*regset), GFP_KERNEL); -+ if (!regset) -+ return; -+ -+ regset->regs = bcm2835_thermal_regs; -+ regset->nregs = ARRAY_SIZE(bcm2835_thermal_regs); -+ regset->base = data->regs; -+ -+ debugfs_create_regset32("regset", 0444, data->debugfsdir, regset); -+} -+ -+static struct thermal_zone_of_device_ops bcm2835_thermal_ops = { -+ .get_temp = bcm2835_thermal_get_temp, -+}; -+ -+/* -+ * Note: as per Raspberry Foundation FAQ -+ * (https://www.raspberrypi.org/help/faqs/#performanceOperatingTemperature) -+ * the recommended temperature range for the SoC -40C to +85C -+ * so the trip limit is set to 80C. -+ * this applies to all the BCM283X SoC -+ */ -+ -+static const struct of_device_id bcm2835_thermal_of_match_table[] = { -+ { -+ .compatible = "brcm,bcm2835-thermal", -+ }, -+ { -+ .compatible = "brcm,bcm2836-thermal", -+ }, -+ { -+ .compatible = "brcm,bcm2837-thermal", -+ }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); -+ -+static int bcm2835_thermal_probe(struct platform_device *pdev) -+{ -+ const struct of_device_id *match; -+ struct thermal_zone_device *tz; -+ struct bcm2835_thermal_data *data; -+ struct resource *res; -+ int err = 0; -+ u32 val; -+ unsigned long rate; -+ -+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ -+ match = of_match_device(bcm2835_thermal_of_match_table, -+ &pdev->dev); -+ if (!match) -+ return -EINVAL; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ data->regs = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(data->regs)) { -+ err = PTR_ERR(data->regs); -+ dev_err(&pdev->dev, "Could not get registers: %d\n", err); -+ return err; -+ } -+ -+ data->clk = devm_clk_get(&pdev->dev, NULL); -+ if (IS_ERR(data->clk)) { -+ err = PTR_ERR(data->clk); -+ if (err != -EPROBE_DEFER) -+ dev_err(&pdev->dev, "Could not get clk: %d\n", err); -+ return err; -+ } -+ -+ err = clk_prepare_enable(data->clk); -+ if (err) -+ return err; -+ -+ rate = clk_get_rate(data->clk); -+ if ((rate < 1920000) || (rate > 5000000)) -+ dev_warn(&pdev->dev, -+ "Clock %pCn running at %pCr Hz is outside of the recommended range: 1.92 to 5MHz\n", -+ data->clk, data->clk); -+ -+ /* register of thermal sensor and get info from DT */ -+ tz = thermal_zone_of_sensor_register(&pdev->dev, 0, data, -+ &bcm2835_thermal_ops); -+ if (IS_ERR(tz)) { -+ err = PTR_ERR(tz); -+ dev_err(&pdev->dev, -+ "Failed to register the thermal device: %d\n", -+ err); -+ goto err_clk; -+ } -+ -+ /* -+ * right now the FW does set up the HW-block, so we are not -+ * touching the configuration registers. -+ * But if the HW is not enabled, then set it up -+ * using "sane" values used by the firmware right now. -+ */ -+ val = readl(data->regs + BCM2835_TS_TSENSCTL); -+ if (!(val & BCM2835_TS_TSENSCTL_RSTB)) { -+ int trip_temp, offset, slope; -+ -+ slope = thermal_zone_get_slope(tz); -+ offset = thermal_zone_get_offset(tz); -+ /* -+ * For now we deal only with critical, otherwise -+ * would need to iterate -+ */ -+ err = tz->ops->get_trip_temp(tz, 0, &trip_temp); -+ if (err < 0) { -+ err = PTR_ERR(tz); -+ dev_err(&pdev->dev, -+ "Not able to read trip_temp: %d\n", -+ err); -+ goto err_tz; -+ } -+ -+ /* set bandgap reference voltage and enable voltage regulator */ -+ val = (BCM2835_TS_TSENSCTL_CTRL_DEFAULT << -+ BCM2835_TS_TSENSCTL_CTRL_SHIFT) | -+ BCM2835_TS_TSENSCTL_REGULEN; -+ -+ /* use the recommended reset duration */ -+ val |= (0xFE << BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT); -+ -+ /* trip_adc value from info */ -+ val |= bcm2835_thermal_temp2adc(trip_temp, -+ offset, -+ slope) -+ << BCM2835_TS_TSENSCTL_THOLD_SHIFT; -+ -+ /* write the value back to the register as 2 steps */ -+ writel(val, data->regs + BCM2835_TS_TSENSCTL); -+ val |= BCM2835_TS_TSENSCTL_RSTB; -+ writel(val, data->regs + BCM2835_TS_TSENSCTL); -+ } -+ -+ data->tz = tz; -+ -+ platform_set_drvdata(pdev, tz); -+ -+ bcm2835_thermal_debugfs(pdev); -+ -+ return 0; -+err_tz: -+ thermal_zone_of_sensor_unregister(&pdev->dev, tz); -+err_clk: -+ clk_disable_unprepare(data->clk); -+ -+ return err; -+} -+ -+static int bcm2835_thermal_remove(struct platform_device *pdev) -+{ -+ struct thermal_zone_device *tz = platform_get_drvdata(pdev); -+ struct bcm2835_thermal_data *data = tz->devdata; -+ -+ debugfs_remove_recursive(data->debugfsdir); -+ thermal_zone_of_sensor_unregister(&pdev->dev, tz); -+ clk_disable_unprepare(data->clk); -+ -+ return 0; -+} -+ -+static struct platform_driver bcm2835_thermal_driver = { -+ .probe = bcm2835_thermal_probe, -+ .remove = bcm2835_thermal_remove, -+ .driver = { -+ .name = "bcm2835_thermal", -+ .of_match_table = bcm2835_thermal_of_match_table, -+ }, -+}; -+module_platform_driver(bcm2835_thermal_driver); -+ -+MODULE_AUTHOR("Martin Sperl"); -+MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-4.4/086-0004-thermal-broadcom-add-Northstar-thermal-driver.patch b/target/linux/generic/pending-4.4/086-0004-thermal-broadcom-add-Northstar-thermal-driver.patch deleted file mode 100644 index 182109632..000000000 --- a/target/linux/generic/pending-4.4/086-0004-thermal-broadcom-add-Northstar-thermal-driver.patch +++ /dev/null @@ -1,173 +0,0 @@ -From a94cb7eeecc4104a6874339f90c5d0647359c102 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 3 Apr 2017 17:48:29 +0200 -Subject: [PATCH] thermal: broadcom: add Northstar thermal driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Northstar is a SoC family commonly used in home routers. This commit -adds a driver for checking CPU temperature. As Northstar Plus seems to -also have this IP block this new symbol gets ARCH_BCM_IPROC dependency. - -Signed-off-by: Rafał Miłecki -Signed-off-by: Jon Mason -Signed-off-by: Eduardo Valentin ---- - drivers/thermal/Kconfig | 5 ++ - drivers/thermal/Makefile | 1 + - drivers/thermal/broadcom/Kconfig | 8 +++ - drivers/thermal/broadcom/Makefile | 1 + - drivers/thermal/broadcom/ns-thermal.c | 105 ++++++++++++++++++++++++++++++++++ - 5 files changed, 120 insertions(+) - create mode 100644 drivers/thermal/broadcom/Kconfig - create mode 100644 drivers/thermal/broadcom/Makefile - create mode 100644 drivers/thermal/broadcom/ns-thermal.c - ---- a/drivers/thermal/Kconfig -+++ b/drivers/thermal/Kconfig -@@ -365,6 +365,11 @@ config INTEL_PCH_THERMAL - Thermal reporting device will provide temperature reading, - programmable trip points and other information. - -+menu "Broadcom thermal drivers" -+depends on ARCH_BCM || COMPILE_TEST -+source "drivers/thermal/broadcom/Kconfig" -+endmenu -+ - menu "Texas Instruments thermal drivers" - depends on ARCH_HAS_BANDGAP || COMPILE_TEST - source "drivers/thermal/ti-soc-thermal/Kconfig" ---- a/drivers/thermal/Makefile -+++ b/drivers/thermal/Makefile -@@ -26,6 +26,7 @@ thermal_sys-$(CONFIG_CLOCK_THERMAL) += c - thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o - - # platform thermal drivers -+obj-y += broadcom/ - obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o - obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o - obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o ---- /dev/null -+++ b/drivers/thermal/broadcom/Kconfig -@@ -0,0 +1,8 @@ -+config BCM_NS_THERMAL -+ tristate "Northstar thermal driver" -+ depends on ARCH_BCM_IPROC || COMPILE_TEST -+ help -+ Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081, -+ BCM4709 and BCM47094. It contains DMU (Device Management Unit) block -+ with a thermal sensor that allows checking CPU temperature. This -+ driver provides support for it. ---- /dev/null -+++ b/drivers/thermal/broadcom/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_BCM_NS_THERMAL) += ns-thermal.o ---- /dev/null -+++ b/drivers/thermal/broadcom/ns-thermal.c -@@ -0,0 +1,105 @@ -+/* -+ * Copyright (C) 2017 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 -+ -+#define PVTMON_CONTROL0 0x00 -+#define PVTMON_CONTROL0_SEL_MASK 0x0000000e -+#define PVTMON_CONTROL0_SEL_TEMP_MONITOR 0x00000000 -+#define PVTMON_CONTROL0_SEL_TEST_MODE 0x0000000e -+#define PVTMON_STATUS 0x08 -+ -+struct ns_thermal { -+ struct thermal_zone_device *tz; -+ void __iomem *pvtmon; -+}; -+ -+static int ns_thermal_get_temp(void *data, int *temp) -+{ -+ struct ns_thermal *ns_thermal = data; -+ int offset = thermal_zone_get_offset(ns_thermal->tz); -+ int slope = thermal_zone_get_slope(ns_thermal->tz); -+ u32 val; -+ -+ val = readl(ns_thermal->pvtmon + PVTMON_CONTROL0); -+ if ((val & PVTMON_CONTROL0_SEL_MASK) != PVTMON_CONTROL0_SEL_TEMP_MONITOR) { -+ /* Clear current mode selection */ -+ val &= ~PVTMON_CONTROL0_SEL_MASK; -+ -+ /* Set temp monitor mode (it's the default actually) */ -+ val |= PVTMON_CONTROL0_SEL_TEMP_MONITOR; -+ -+ writel(val, ns_thermal->pvtmon + PVTMON_CONTROL0); -+ } -+ -+ val = readl(ns_thermal->pvtmon + PVTMON_STATUS); -+ *temp = slope * val + offset; -+ -+ return 0; -+} -+ -+static const struct thermal_zone_of_device_ops ns_thermal_ops = { -+ .get_temp = ns_thermal_get_temp, -+}; -+ -+static int ns_thermal_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct ns_thermal *ns_thermal; -+ -+ ns_thermal = devm_kzalloc(dev, sizeof(*ns_thermal), GFP_KERNEL); -+ if (!ns_thermal) -+ return -ENOMEM; -+ -+ ns_thermal->pvtmon = of_iomap(dev_of_node(dev), 0); -+ if (WARN_ON(!ns_thermal->pvtmon)) -+ return -ENOENT; -+ -+ ns_thermal->tz = devm_thermal_zone_of_sensor_register(dev, 0, -+ ns_thermal, -+ &ns_thermal_ops); -+ if (IS_ERR(ns_thermal->tz)) { -+ iounmap(ns_thermal->pvtmon); -+ return PTR_ERR(ns_thermal->tz); -+ } -+ -+ platform_set_drvdata(pdev, ns_thermal); -+ -+ return 0; -+} -+ -+static int ns_thermal_remove(struct platform_device *pdev) -+{ -+ struct ns_thermal *ns_thermal = platform_get_drvdata(pdev); -+ -+ iounmap(ns_thermal->pvtmon); -+ -+ return 0; -+} -+ -+static const struct of_device_id ns_thermal_of_match[] = { -+ { .compatible = "brcm,ns-thermal", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, ns_thermal_of_match); -+ -+static struct platform_driver ns_thermal_driver = { -+ .probe = ns_thermal_probe, -+ .remove = ns_thermal_remove, -+ .driver = { -+ .name = "ns-thermal", -+ .of_match_table = ns_thermal_of_match, -+ }, -+}; -+module_platform_driver(ns_thermal_driver); -+ -+MODULE_DESCRIPTION("Northstar thermal driver"); -+MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/pending-4.4/086-0005-thermal-broadcom-fix-compilation-of-Northstar-driver.patch b/target/linux/generic/pending-4.4/086-0005-thermal-broadcom-fix-compilation-of-Northstar-driver.patch deleted file mode 100644 index 62bfffefb..000000000 --- a/target/linux/generic/pending-4.4/086-0005-thermal-broadcom-fix-compilation-of-Northstar-driver.patch +++ /dev/null @@ -1,19 +0,0 @@ -From d44264c8735f79da3253520024841311c555ca31 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 14 Apr 2017 22:25:12 +0200 -Subject: [PATCH] thermal: broadcom: fix compilation of Northstar driver - ---- - drivers/thermal/broadcom/ns-thermal.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/thermal/broadcom/ns-thermal.c -+++ b/drivers/thermal/broadcom/ns-thermal.c -@@ -6,6 +6,7 @@ - * published by the Free Software Foundation. - */ - -+#include - #include - #include - #include diff --git a/target/linux/generic/pending-4.4/087-regmap-make-LZO-cache-optional.patch b/target/linux/generic/pending-4.4/087-regmap-make-LZO-cache-optional.patch deleted file mode 100644 index c26994ee3..000000000 --- a/target/linux/generic/pending-4.4/087-regmap-make-LZO-cache-optional.patch +++ /dev/null @@ -1,69 +0,0 @@ -From de88e9b0354c2e3ff8eae3f97afe43a34f5ed239 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 13 May 2017 13:03:21 +0200 -Subject: [PATCH] regmap: make LZO cache optional - -Commit 2cbbb579bcbe3 ("regmap: Add the LZO cache support") added support -for LZO compression in regcache, but there were never any users added -afterwards. Since LZO support itself has its own size, it currently is -rather a deoptimization. - -So make it optional by introducing a symbol that can be selected by -drivers wanting to make use of it. - -Saves e.g. ~46 kB on MIPS (size of LZO support + regcache LZO code). - -Signed-off-by: Jonas Gorski ---- -I tried using google to find any users (even out-of-tree ones), but at -best I found a single driver submission that was switched to RBTREE in -subsequent resubmissions (MFD_SMSC). - -One could maybe also just drop the code because of no users for 5 years, -but that would be up to the maintainer(s) to decide. - - drivers/base/regmap/Kconfig | 5 ++++- - drivers/base/regmap/Makefile | 3 ++- - drivers/base/regmap/regcache.c | 2 ++ - 3 files changed, 8 insertions(+), 2 deletions(-) - ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -4,9 +4,12 @@ - - config REGMAP - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) -+ select IRQ_DOMAIN if REGMAP_IRQ -+ bool -+ -+config REGCACHE_COMPRESSED - select LZO_COMPRESS - select LZO_DECOMPRESS -- select IRQ_DOMAIN if REGMAP_IRQ - bool - - config REGMAP_AC97 ---- a/drivers/base/regmap/Makefile -+++ b/drivers/base/regmap/Makefile -@@ -2,7 +2,8 @@ - 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_REGMAP) += regcache-rbtree.o regcache-flat.o -+obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o - obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o - obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o - obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o ---- a/drivers/base/regmap/regcache.c -+++ b/drivers/base/regmap/regcache.c -@@ -21,7 +21,9 @@ - - static const struct regcache_ops *cache_types[] = { - ®cache_rbtree_ops, -+#if IS_ENABLED(CONFIG_REGCACHE_COMPRESSED) - ®cache_lzo_ops, -+#endif - ®cache_flat_ops, - }; - diff --git a/target/linux/generic/pending-4.4/090-MIPS-c-r4k-Use-IPI-calls-for-CM-indexed-cache-ops.patch b/target/linux/generic/pending-4.4/090-MIPS-c-r4k-Use-IPI-calls-for-CM-indexed-cache-ops.patch deleted file mode 100644 index 0c1c0a450..000000000 --- a/target/linux/generic/pending-4.4/090-MIPS-c-r4k-Use-IPI-calls-for-CM-indexed-cache-ops.patch +++ /dev/null @@ -1,317 +0,0 @@ -From: James Hogan -Date: Mon, 25 Jan 2016 21:30:00 +0000 -Subject: [PATCH] MIPS: c-r4k: Use IPI calls for CM indexed cache ops - -The Coherence Manager (CM) can propagate address-based ("hit") cache -operations to other cores in the coherent system, alleviating software -of the need to use IPI calls, however indexed cache operations are not -propagated since doing so makes no sense for separate caches. - -r4k_on_each_cpu() previously had a special case for CONFIG_MIPS_MT_SMP, -intended to avoid the IPIs when the only other CPUs in the system were -other VPEs in the same core, and hence sharing the same caches. This was -changed by commit cccf34e9411c ("MIPS: c-r4k: Fix cache flushing for MT -cores") to apparently handle multi-core multi-VPE systems, but it -focussed mainly on hit cache ops, so the IPI calls were still disabled -entirely for CM systems. - -This doesn't normally cause problems, but tests can be written to hit -these corner cases by using multiple threads, or changing task -affinities to force the process to migrate cores. For example the -failure of mprotect RW->RX to globally sync icaches (via -flush_cache_range) can be detected by modifying and mprotecting a code -page on one core, and migrating to a different core to execute from it. - -Most of the functions called by r4k_on_each_cpu() perform cache -operations exclusively with a single addressing-type (virtual address vs -indexed), so add a type argument and modify the callers to pass in -R4K_USER (user virtual addressing), R4K_KERN (global kernel virtual -addressing) or R4K_INDEX (index into cache). - -local_r4k_flush_icache_range() is split up, to allow it to be called -from the rest of the kernel, or from r4k_flush_icache_range() where it -will choose either indexed or hit cache operations based on the size of -the range and the cache sizes. - -local_r4k_flush_kernel_vmap_range() is split into two functions, each of -which uses cache operations with a single addressing-type, with -r4k_flush_kernel_vmap_range() making the decision whether to use indexed -cache ops or not. - -Signed-off-by: James Hogan -Cc: Ralf Baechle -Cc: Paul Burton -Cc: Leonid Yegoshin -Cc: linux-mips@linux-mips.org ---- - ---- a/arch/mips/mm/c-r4k.c -+++ b/arch/mips/mm/c-r4k.c -@@ -40,6 +40,50 @@ - #include - - /* -+ * Bits describing what cache ops an IPI callback function may perform. -+ * -+ * R4K_USER - Virtual user address based cache operations. -+ * Ineffective on other CPUs. -+ * R4K_KERN - Virtual kernel address based cache operations (including kmap). -+ * Effective on other CPUs. -+ * R4K_INDEX - Index based cache operations. -+ * Effective on other CPUs. -+ */ -+ -+#define R4K_USER BIT(0) -+#define R4K_KERN BIT(1) -+#define R4K_INDEX BIT(2) -+ -+#ifdef CONFIG_SMP -+/* The Coherence manager propagates address-based cache ops to other cores */ -+#define r4k_hit_globalized mips_cm_present() -+#define r4k_index_globalized 0 -+#else -+/* If there's only 1 CPU, then all cache ops are globalized to that 1 CPU */ -+#define r4k_hit_globalized 1 -+#define r4k_index_globalized 1 -+#endif -+ -+/** -+ * r4k_op_needs_ipi() - Decide if a cache op needs to be done on every core. -+ * @type: Type of cache operations (R4K_USER, R4K_KERN or R4K_INDEX). -+ * -+ * Returns: 1 if the cache operation @type should be done on every core in -+ * the system. -+ * 0 if the cache operation @type is globalized and only needs to -+ * be performed on a simple CPU. -+ */ -+static inline bool r4k_op_needs_ipi(unsigned int type) -+{ -+ /* -+ * If hardware doesn't globalize the required cache ops we must use IPIs -+ * to do so. -+ */ -+ return (type & R4K_KERN && !r4k_hit_globalized) || -+ (type & R4K_INDEX && !r4k_index_globalized); -+} -+ -+/* - * Special Variant of smp_call_function for use by cache functions: - * - * o No return value -@@ -48,19 +92,11 @@ - * primary cache. - * o doesn't disable interrupts on the local CPU - */ --static inline void r4k_on_each_cpu(void (*func) (void *info), void *info) -+static inline void r4k_on_each_cpu(unsigned int type, -+ void (*func) (void *info), void *info) - { - preempt_disable(); -- -- /* -- * The Coherent Manager propagates address-based cache ops to other -- * cores but not index-based ops. However, r4k_on_each_cpu is used -- * in both cases so there is no easy way to tell what kind of op is -- * executed to the other cores. The best we can probably do is -- * to restrict that call when a CM is not present because both -- * CM-based SMP protocols (CMP & CPS) restrict index-based cache ops. -- */ -- if (!mips_cm_present()) -+ if (r4k_op_needs_ipi(type)) - smp_call_function_many(&cpu_foreign_map, func, info, 1); - func(info); - preempt_enable(); -@@ -456,7 +492,7 @@ static inline void local_r4k___flush_cac - - static void r4k___flush_cache_all(void) - { -- r4k_on_each_cpu(local_r4k___flush_cache_all, NULL); -+ r4k_on_each_cpu(R4K_INDEX, local_r4k___flush_cache_all, NULL); - } - - static inline int has_valid_asid(const struct mm_struct *mm) -@@ -503,7 +539,7 @@ static void r4k_flush_cache_range(struct - int exec = vma->vm_flags & VM_EXEC; - - if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) -- r4k_on_each_cpu(local_r4k_flush_cache_range, vma); -+ r4k_on_each_cpu(R4K_INDEX, local_r4k_flush_cache_range, vma); - } - - static inline void local_r4k_flush_cache_mm(void * args) -@@ -535,7 +571,7 @@ static void r4k_flush_cache_mm(struct mm - if (!cpu_has_dc_aliases) - return; - -- r4k_on_each_cpu(local_r4k_flush_cache_mm, mm); -+ r4k_on_each_cpu(R4K_INDEX, local_r4k_flush_cache_mm, mm); - } - - struct flush_cache_page_args { -@@ -629,7 +665,7 @@ static void r4k_flush_cache_page(struct - args.addr = addr; - args.pfn = pfn; - -- r4k_on_each_cpu(local_r4k_flush_cache_page, &args); -+ r4k_on_each_cpu(R4K_KERN, local_r4k_flush_cache_page, &args); - } - - static inline void local_r4k_flush_data_cache_page(void * addr) -@@ -642,18 +678,23 @@ static void r4k_flush_data_cache_page(un - if (in_atomic()) - local_r4k_flush_data_cache_page((void *)addr); - else -- r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr); -+ r4k_on_each_cpu(R4K_KERN, local_r4k_flush_data_cache_page, -+ (void *) addr); - } - - struct flush_icache_range_args { - unsigned long start; - unsigned long end; -+ unsigned int type; - }; - --static inline void local_r4k_flush_icache_range(unsigned long start, unsigned long end) -+static inline void __local_r4k_flush_icache_range(unsigned long start, -+ unsigned long end, -+ unsigned int type) - { - if (!cpu_has_ic_fills_f_dc) { -- if (end - start >= dcache_size) { -+ if (type == R4K_INDEX || -+ (type & R4K_INDEX && end - start >= dcache_size)) { - r4k_blast_dcache(); - } else { - R4600_HIT_CACHEOP_WAR_IMPL; -@@ -661,7 +702,8 @@ static inline void local_r4k_flush_icach - } - } - -- if (end - start > icache_size) -+ if (type == R4K_INDEX || -+ (type & R4K_INDEX && end - start > icache_size)) - r4k_blast_icache(); - else { - switch (boot_cpu_type()) { -@@ -687,23 +729,59 @@ static inline void local_r4k_flush_icach - #endif - } - -+static inline void local_r4k_flush_icache_range(unsigned long start, -+ unsigned long end) -+{ -+ __local_r4k_flush_icache_range(start, end, R4K_KERN | R4K_INDEX); -+} -+ - static inline void local_r4k_flush_icache_range_ipi(void *args) - { - struct flush_icache_range_args *fir_args = args; - unsigned long start = fir_args->start; - unsigned long end = fir_args->end; -+ unsigned int type = fir_args->type; - -- local_r4k_flush_icache_range(start, end); -+ __local_r4k_flush_icache_range(start, end, type); - } - - static void r4k_flush_icache_range(unsigned long start, unsigned long end) - { - struct flush_icache_range_args args; -+ unsigned long size, cache_size; - - args.start = start; - args.end = end; -+ args.type = R4K_KERN | R4K_INDEX; - -- r4k_on_each_cpu(local_r4k_flush_icache_range_ipi, &args); -+ if (in_atomic()) { -+ /* -+ * We can't do blocking IPI calls from atomic context, so fall -+ * back to pure address-based cache ops if they globalize. -+ */ -+ if (!r4k_index_globalized && r4k_hit_globalized) { -+ args.type &= ~R4K_INDEX; -+ } else { -+ /* Just do it locally instead. */ -+ local_r4k_flush_icache_range(start, end); -+ instruction_hazard(); -+ return; -+ } -+ } else if (!r4k_index_globalized && r4k_hit_globalized) { -+ /* -+ * If address-based cache ops are globalized, then we may be -+ * able to avoid the IPI for small flushes. -+ */ -+ size = start - end; -+ cache_size = icache_size; -+ if (!cpu_has_ic_fills_f_dc) { -+ size *= 2; -+ cache_size += dcache_size; -+ } -+ if (size <= cache_size) -+ args.type &= ~R4K_INDEX; -+ } -+ r4k_on_each_cpu(args.type, local_r4k_flush_icache_range_ipi, &args); - instruction_hazard(); - } - -@@ -823,7 +901,12 @@ static void local_r4k_flush_cache_sigtra - - static void r4k_flush_cache_sigtramp(unsigned long addr) - { -- r4k_on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr); -+ /* -+ * FIXME this is a bit broken when !r4k_hit_globalized, since the user -+ * code probably won't be mapped on other CPUs, so if the process is -+ * migrated, it could end up hitting stale icache lines. -+ */ -+ r4k_on_each_cpu(R4K_USER, local_r4k_flush_cache_sigtramp, (void *)addr); - } - - static void r4k_flush_icache_all(void) -@@ -837,6 +920,15 @@ struct flush_kernel_vmap_range_args { - int size; - }; - -+static inline void local_r4k_flush_kernel_vmap_range_index(void *args) -+{ -+ /* -+ * Aliases only affect the primary caches so don't bother with -+ * S-caches or T-caches. -+ */ -+ r4k_blast_dcache(); -+} -+ - static inline void local_r4k_flush_kernel_vmap_range(void *args) - { - struct flush_kernel_vmap_range_args *vmra = args; -@@ -847,12 +939,8 @@ static inline void local_r4k_flush_kerne - * Aliases only affect the primary caches so don't bother with - * S-caches or T-caches. - */ -- if (cpu_has_safe_index_cacheops && size >= dcache_size) -- r4k_blast_dcache(); -- else { -- R4600_HIT_CACHEOP_WAR_IMPL; -- blast_dcache_range(vaddr, vaddr + size); -- } -+ R4600_HIT_CACHEOP_WAR_IMPL; -+ blast_dcache_range(vaddr, vaddr + size); - } - - static void r4k_flush_kernel_vmap_range(unsigned long vaddr, int size) -@@ -862,7 +950,12 @@ static void r4k_flush_kernel_vmap_range( - args.vaddr = (unsigned long) vaddr; - args.size = size; - -- r4k_on_each_cpu(local_r4k_flush_kernel_vmap_range, &args); -+ if (cpu_has_safe_index_cacheops && size >= dcache_size) -+ r4k_on_each_cpu(R4K_INDEX, -+ local_r4k_flush_kernel_vmap_range_index, NULL); -+ else -+ r4k_on_each_cpu(R4K_KERN, local_r4k_flush_kernel_vmap_range, -+ &args); - } - - static inline void rm7k_erratum31(void) diff --git a/target/linux/generic/pending-4.4/091-MIPS-c-r4k-Exclude-sibling-CPUs-in-SMP-calls.patch b/target/linux/generic/pending-4.4/091-MIPS-c-r4k-Exclude-sibling-CPUs-in-SMP-calls.patch deleted file mode 100644 index 8d5030c84..000000000 --- a/target/linux/generic/pending-4.4/091-MIPS-c-r4k-Exclude-sibling-CPUs-in-SMP-calls.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: James Hogan -Date: Thu, 3 Mar 2016 21:30:42 +0000 -Subject: [PATCH] MIPS: c-r4k: Exclude sibling CPUs in SMP calls - -When performing SMP calls to foreign cores, exclude sibling CPUs from -the provided map, as we already handle the local core on the current -CPU. This prevents an IPI call from for example core 0, VPE 1 to VPE 0 -on the same core. - -Signed-off-by: James Hogan -Cc: Ralf Baechle -Cc: Paul Burton -Cc: linux-mips@linux-mips.org ---- - ---- a/arch/mips/mm/c-r4k.c -+++ b/arch/mips/mm/c-r4k.c -@@ -96,8 +96,17 @@ static inline void r4k_on_each_cpu(unsig - void (*func) (void *info), void *info) - { - preempt_disable(); -- if (r4k_op_needs_ipi(type)) -- smp_call_function_many(&cpu_foreign_map, func, info, 1); -+ /* cpu_foreign_map and cpu_sibling_map[] undeclared when !CONFIG_SMP */ -+#ifdef CONFIG_SMP -+ if (r4k_op_needs_ipi(type)) { -+ struct cpumask mask; -+ -+ /* exclude sibling CPUs */ -+ cpumask_andnot(&mask, &cpu_foreign_map, -+ &cpu_sibling_map[smp_processor_id()]); -+ smp_call_function_many(&mask, func, info, 1); -+ } -+#endif - func(info); - preempt_enable(); - } diff --git a/target/linux/generic/pending-4.4/092-MIPS-ZBOOT-copy-appended-dtb-to-the-end-of-the-kerne.patch b/target/linux/generic/pending-4.4/092-MIPS-ZBOOT-copy-appended-dtb-to-the-end-of-the-kerne.patch deleted file mode 100644 index 78188dd29..000000000 --- a/target/linux/generic/pending-4.4/092-MIPS-ZBOOT-copy-appended-dtb-to-the-end-of-the-kerne.patch +++ /dev/null @@ -1,132 +0,0 @@ -From b8f54f2cde788623f41d11327688c75aed34092f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 20 Jun 2016 11:27:36 +0200 -Subject: [PATCH 1/2] MIPS: ZBOOT: copy appended dtb to the end of the kernel - -Instead of rewriting the arguments, just move the appended dtb to where -the decompressed kernel expects it. This eliminates the need for special -casing vmlinuz.bin appended dtb files. - -Signed-off-by: Jonas Gorski -Cc: Kevin Cernekee -Cc: Florian Fainelli -Cc: John Crispin -Cc: Paul Burton -Cc: James Hogan -Cc: Alban Bedel -Cc: Daniel Gimpelevich -Cc: Antony Pavlov -Cc: linux-mips@linux-mips.org -Patchwork: https://patchwork.linux-mips.org/patch/13698/ -Signed-off-by: Ralf Baechle ---- - arch/mips/Kconfig | 22 ++-------------------- - arch/mips/boot/compressed/decompress.c | 17 +++++++++++++++++ - arch/mips/boot/compressed/head.S | 16 ---------------- - 3 files changed, 19 insertions(+), 36 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -2753,10 +2753,10 @@ choice - the documented boot protocol using a device tree. - - config MIPS_RAW_APPENDED_DTB -- bool "vmlinux.bin" -+ bool "vmlinux.bin or vmlinuz.bin" - help - With this option, the boot code will look for a device tree binary -- DTB) appended to raw vmlinux.bin (without decompressor). -+ DTB) appended to raw vmlinux.bin or vmlinuz.bin. - (e.g. cat vmlinux.bin .dtb > vmlinux_w_dtb). - - This is meant as a backward compatibility convenience for those -@@ -2768,24 +2768,6 @@ choice - look like a DTB header after a reboot if no actual DTB is appended - to vmlinux.bin. Do not leave this option active in a production kernel - if you don't intend to always append a DTB. -- -- config MIPS_ZBOOT_APPENDED_DTB -- bool "vmlinuz.bin" -- depends on SYS_SUPPORTS_ZBOOT -- help -- With this option, the boot code will look for a device tree binary -- DTB) appended to raw vmlinuz.bin (with decompressor). -- (e.g. cat vmlinuz.bin .dtb > vmlinuz_w_dtb). -- -- This is meant as a backward compatibility convenience for those -- systems with a bootloader that can't be upgraded to accommodate -- the documented boot protocol using a device tree. -- -- Beware that there is very little in terms of protection against -- this option being confused by leftover garbage in memory that might -- look like a DTB header after a reboot if no actual DTB is appended -- to vmlinuz.bin. Do not leave this option active in a production kernel -- if you don't intend to always append a DTB. - endchoice - - choice ---- a/arch/mips/boot/compressed/decompress.c -+++ b/arch/mips/boot/compressed/decompress.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - - #include - -@@ -36,6 +37,8 @@ extern void puthex(unsigned long long va - #define puthex(val) do {} while (0) - #endif - -+extern char __appended_dtb[]; -+ - void error(char *x) - { - puts("\n\n"); -@@ -114,6 +117,20 @@ void decompress_kernel(unsigned long boo - __decompress((char *)zimage_start, zimage_size, 0, 0, - (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, 0, error); - -+ if (IS_ENABLED(CONFIG_MIPS_RAW_APPENDED_DTB) && -+ fdt_magic((void *)&__appended_dtb) == FDT_MAGIC) { -+ unsigned int image_size, dtb_size; -+ -+ dtb_size = fdt_totalsize((void *)&__appended_dtb); -+ -+ /* last four bytes is always image size in little endian */ -+ image_size = le32_to_cpup((void *)&__image_end - 4); -+ -+ /* copy dtb to where the booted kernel will expect it */ -+ memcpy((void *)VMLINUX_LOAD_ADDRESS_ULL + image_size, -+ __appended_dtb, dtb_size); -+ } -+ - /* FIXME: should we flush cache here? */ - puts("Now, booting the kernel...\n"); - } ---- a/arch/mips/boot/compressed/head.S -+++ b/arch/mips/boot/compressed/head.S -@@ -25,22 +25,6 @@ start: - move s2, a2 - move s3, a3 - --#ifdef CONFIG_MIPS_ZBOOT_APPENDED_DTB -- PTR_LA t0, __appended_dtb --#ifdef CONFIG_CPU_BIG_ENDIAN -- li t1, 0xd00dfeed --#else -- li t1, 0xedfe0dd0 --#endif -- lw t2, (t0) -- bne t1, t2, not_found -- nop -- -- move s1, t0 -- PTR_LI s0, -2 --not_found: --#endif -- - /* Clear BSS */ - PTR_LA a0, _edata - PTR_LA a2, _end diff --git a/target/linux/generic/pending-4.4/093-MIPS-store-the-appended-dtb-address-in-a-variable.patch b/target/linux/generic/pending-4.4/093-MIPS-store-the-appended-dtb-address-in-a-variable.patch deleted file mode 100644 index d868d210a..000000000 --- a/target/linux/generic/pending-4.4/093-MIPS-store-the-appended-dtb-address-in-a-variable.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 15f37e1588920e010f20b53f04af94e91b8ee714 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 20 Jun 2016 11:27:37 +0200 -Subject: [PATCH] MIPS: store the appended dtb address in a variable - -Instead of rewriting the arguments to match the UHI spec, store the -address of a appended or UHI supplied dtb in fw_supplied_dtb. - -That way the original bootloader arugments are kept intact while still -making the use of an appended dtb invisible for mach code. - -Mach code can still find out if it is an appended dtb by comparing -fw_arg1 with fw_supplied_dtb. - -Signed-off-by: Jonas Gorski -Cc: Kevin Cernekee -Cc: Florian Fainelli -Cc: John Crispin -Cc: Paul Burton -Cc: James Hogan -Cc: Alban Bedel -Cc: Daniel Gimpelevich -Cc: Antony Pavlov -Cc: linux-mips@linux-mips.org -Patchwork: https://patchwork.linux-mips.org/patch/13699/ -Signed-off-by: Ralf Baechle ---- - arch/mips/ath79/setup.c | 4 ++-- - arch/mips/bmips/setup.c | 4 ++-- - arch/mips/include/asm/bootinfo.h | 4 ++++ - arch/mips/kernel/head.S | 21 ++++++++++++++------- - arch/mips/kernel/setup.c | 4 ++++ - arch/mips/lantiq/prom.c | 4 ++-- - arch/mips/pic32/pic32mzda/init.c | 4 ++-- - 7 files changed, 30 insertions(+), 15 deletions(-) - ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -207,6 +207,8 @@ void __init plat_mem_setup(void) - fdt_start = fw_getenvl("fdt_start"); - if (fdt_start) - __dt_setup_arch((void *)KSEG0ADDR(fdt_start)); -+ else if (fw_passed_dtb) -+ __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb)); - #ifdef CONFIG_BUILTIN_DTB - else - __dt_setup_arch(__dtb_start); ---- a/arch/mips/bmips/setup.c -+++ b/arch/mips/bmips/setup.c -@@ -149,8 +149,8 @@ void __init plat_mem_setup(void) - /* intended to somewhat resemble ARM; see Documentation/arm/Booting */ - if (fw_arg0 == 0 && fw_arg1 == 0xffffffff) - dtb = phys_to_virt(fw_arg2); -- else if (fw_arg0 == -2) /* UHI interface */ -- dtb = (void *)fw_arg1; -+ else if (fw_passed_dtb) /* UHI interface */ -+ dtb = (void *)fw_passed_dtb; - else if (__dtb_start != __dtb_end) - dtb = (void *)__dtb_start; - else ---- a/arch/mips/include/asm/bootinfo.h -+++ b/arch/mips/include/asm/bootinfo.h -@@ -127,6 +127,10 @@ extern char arcs_cmdline[COMMAND_LINE_SI - */ - extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3; - -+#ifdef CONFIG_USE_OF -+extern unsigned long fw_passed_dtb; -+#endif -+ - /* - * Platform memory detection hook called by setup_arch - */ ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -94,21 +94,24 @@ NESTED(kernel_entry, 16, sp) # kernel - jr t0 - 0: - -+#ifdef CONFIG_USE_OF - #ifdef CONFIG_MIPS_RAW_APPENDED_DTB -- PTR_LA t0, __appended_dtb -+ PTR_LA t2, __appended_dtb - - #ifdef CONFIG_CPU_BIG_ENDIAN - li t1, 0xd00dfeed - #else - li t1, 0xedfe0dd0 - #endif -- lw t2, (t0) -- bne t1, t2, not_found -- nop -- -- move a1, t0 -- PTR_LI a0, -2 --not_found: -+ lw t0, (t2) -+ beq t0, t1, dtb_found -+#endif -+ li t1, -2 -+ beq a0, t1, dtb_found -+ move t2, a1 -+ -+ li t2, 0 -+dtb_found: - #endif - PTR_LA t0, __bss_start # clear .bss - LONG_S zero, (t0) -@@ -123,6 +126,10 @@ not_found: - LONG_S a2, fw_arg2 - LONG_S a3, fw_arg3 - -+#ifdef CONFIG_USE_OF -+ LONG_S t2, fw_passed_dtb -+#endif -+ - MTC0 zero, CP0_CONTEXT # clear context register - PTR_LA $28, init_thread_union - /* Set the SP after an empty pt_regs. */ ---- a/arch/mips/kernel/setup.c -+++ b/arch/mips/kernel/setup.c -@@ -886,6 +886,10 @@ void __init setup_arch(char **cmdline_p) - unsigned long kernelsp[NR_CPUS]; - unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3; - -+#ifdef CONFIG_USE_OF -+unsigned long fw_passed_dtb; -+#endif -+ - #ifdef CONFIG_DEBUG_FS - struct dentry *mips_debugfs_dir; - static int __init debugfs_mips(void) diff --git a/target/linux/generic/pending-4.4/094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch b/target/linux/generic/pending-4.4/094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch deleted file mode 100644 index 733d9c77b..000000000 --- a/target/linux/generic/pending-4.4/094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch +++ /dev/null @@ -1,38 +0,0 @@ -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/pending-4.4/096-arc-add-model-property-in-dts.patch b/target/linux/generic/pending-4.4/096-arc-add-model-property-in-dts.patch deleted file mode 100644 index 85019ed00..000000000 --- a/target/linux/generic/pending-4.4/096-arc-add-model-property-in-dts.patch +++ /dev/null @@ -1,163 +0,0 @@ -From f1e53ac0a99e3754465bd87ae1a6fdbfb8340d15 Mon Sep 17 00:00:00 2001 -From: Alexey Brodkin -Date: Mon, 15 Aug 2016 14:42:44 +0300 -Subject: [PATCH] arc: Add "model" properly in device tree description of all - boards - -As it was discussed quite some time ago (see -https://lkml.org/lkml/2015/11/5/862) it's a good practice to add -"model" property in .dts. Moreover as per ePAPR "model" property is -required and should look like "manufacturer,model" so we do here. - -Signed-off-by: Alexey Brodkin -Cc: Vineet Gupta -Cc: Jonas Gorski -Cc: Arnd Bergmann -Cc: Rob Herring -Cc: Christian Ruppert ---- - arch/arc/boot/dts/abilis_tb100_dvk.dts | 1 + - arch/arc/boot/dts/abilis_tb101_dvk.dts | 1 + - arch/arc/boot/dts/axs101.dts | 1 + - arch/arc/boot/dts/axs103.dts | 1 + - arch/arc/boot/dts/axs103_idu.dts | 1 + - arch/arc/boot/dts/nsim_700.dts | 1 + - arch/arc/boot/dts/nsim_hs.dts | 1 + - arch/arc/boot/dts/nsim_hs_idu.dts | 1 + - arch/arc/boot/dts/nsimosci.dts | 1 + - arch/arc/boot/dts/nsimosci_hs.dts | 1 + - arch/arc/boot/dts/nsimosci_hs_idu.dts | 1 + - arch/arc/boot/dts/vdk_hs38.dts | 1 + - arch/arc/boot/dts/vdk_hs38_smp.dts | 1 + - 13 files changed, 13 insertions(+) - ---- a/arch/arc/boot/dts/abilis_tb100_dvk.dts -+++ b/arch/arc/boot/dts/abilis_tb100_dvk.dts -@@ -24,6 +24,7 @@ - /include/ "abilis_tb100.dtsi" - - / { -+ model = "abilis,tb100"; - chosen { - bootargs = "earlycon=uart8250,mmio32,0xff100000,9600n8 console=ttyS0,9600n8"; - }; ---- a/arch/arc/boot/dts/abilis_tb101_dvk.dts -+++ b/arch/arc/boot/dts/abilis_tb101_dvk.dts -@@ -24,6 +24,7 @@ - /include/ "abilis_tb101.dtsi" - - / { -+ model = "abilis,tb101"; - chosen { - bootargs = "earlycon=uart8250,mmio32,0xff100000,9600n8 console=ttyS0,9600n8"; - }; ---- a/arch/arc/boot/dts/axs101.dts -+++ b/arch/arc/boot/dts/axs101.dts -@@ -13,6 +13,7 @@ - /include/ "axs10x_mb.dtsi" - - / { -+ model = "snps,axs101"; - compatible = "snps,axs101", "snps,arc-sdp"; - - chosen { ---- a/arch/arc/boot/dts/axs103.dts -+++ b/arch/arc/boot/dts/axs103.dts -@@ -16,6 +16,7 @@ - /include/ "axs10x_mb.dtsi" - - / { -+ model = "snps,axs103"; - compatible = "snps,axs103", "snps,arc-sdp"; - - chosen { ---- a/arch/arc/boot/dts/axs103_idu.dts -+++ b/arch/arc/boot/dts/axs103_idu.dts -@@ -16,6 +16,7 @@ - /include/ "axs10x_mb.dtsi" - - / { -+ model = "snps,axs103-smp"; - compatible = "snps,axs103", "snps,arc-sdp"; - - chosen { ---- a/arch/arc/boot/dts/nsim_700.dts -+++ b/arch/arc/boot/dts/nsim_700.dts -@@ -10,6 +10,7 @@ - /include/ "skeleton.dtsi" - - / { -+ model = "snps,nsim"; - compatible = "snps,nsim"; - clock-frequency = <80000000>; /* 80 MHZ */ - #address-cells = <1>; ---- a/arch/arc/boot/dts/nsim_hs.dts -+++ b/arch/arc/boot/dts/nsim_hs.dts -@@ -10,6 +10,7 @@ - /include/ "skeleton.dtsi" - - / { -+ model = "snps,nsim_hs"; - compatible = "snps,nsim_hs"; - #address-cells = <2>; - #size-cells = <2>; ---- a/arch/arc/boot/dts/nsim_hs_idu.dts -+++ b/arch/arc/boot/dts/nsim_hs_idu.dts -@@ -10,6 +10,7 @@ - /include/ "skeleton.dtsi" - - / { -+ model = "snps,nsim_hs-smp"; - compatible = "snps,nsim_hs"; - interrupt-parent = <&core_intc>; - ---- a/arch/arc/boot/dts/nsimosci.dts -+++ b/arch/arc/boot/dts/nsimosci.dts -@@ -10,6 +10,7 @@ - /include/ "skeleton.dtsi" - - / { -+ model = "snps,nsimosci"; - compatible = "snps,nsimosci"; - clock-frequency = <20000000>; /* 20 MHZ */ - #address-cells = <1>; ---- a/arch/arc/boot/dts/nsimosci_hs.dts -+++ b/arch/arc/boot/dts/nsimosci_hs.dts -@@ -10,6 +10,7 @@ - /include/ "skeleton.dtsi" - - / { -+ model = "snps,nsimosci_hs"; - compatible = "snps,nsimosci_hs"; - clock-frequency = <20000000>; /* 20 MHZ */ - #address-cells = <1>; ---- a/arch/arc/boot/dts/nsimosci_hs_idu.dts -+++ b/arch/arc/boot/dts/nsimosci_hs_idu.dts -@@ -10,6 +10,7 @@ - /include/ "skeleton.dtsi" - - / { -+ model = "snps,nsimosci_hs-smp"; - compatible = "snps,nsimosci_hs"; - clock-frequency = <5000000>; /* 5 MHZ */ - #address-cells = <1>; ---- a/arch/arc/boot/dts/vdk_hs38.dts -+++ b/arch/arc/boot/dts/vdk_hs38.dts -@@ -13,6 +13,7 @@ - /include/ "vdk_axs10x_mb.dtsi" - - / { -+ model = "snps,vdk_archs"; - compatible = "snps,axs103"; - - chosen { ---- a/arch/arc/boot/dts/vdk_hs38_smp.dts -+++ b/arch/arc/boot/dts/vdk_hs38_smp.dts -@@ -13,6 +13,7 @@ - /include/ "vdk_axs10x_mb.dtsi" - - / { -+ model = "snps,vdk_archs-smp"; - compatible = "snps,axs103"; - - chosen { diff --git a/target/linux/generic/pending-4.4/097-MIPS-io.h-Define-ioremap_cache.patch b/target/linux/generic/pending-4.4/097-MIPS-io.h-Define-ioremap_cache.patch deleted file mode 100644 index e048410e4..000000000 --- a/target/linux/generic/pending-4.4/097-MIPS-io.h-Define-ioremap_cache.patch +++ /dev/null @@ -1,29 +0,0 @@ -From a68f376844605399cbd28b662d5ed213639f46f7 Mon Sep 17 00:00:00 2001 -From: "Maciej W. Rozycki" -Date: Sat, 9 Jan 2016 02:05:31 +0000 -Subject: [PATCH] MIPS: io.h: Define `ioremap_cache' -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Maciej W. Rozycki -Cc: Brian Norris -Cc: Rafał Miłecki -Cc: linux-mips@linux-mips.org -Cc: linux-kernel@vger.kernel.org -Patchwork: https://patchwork.linux-mips.org/patch/12040/ -Signed-off-by: Ralf Baechle ---- - arch/mips/include/asm/io.h | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/mips/include/asm/io.h -+++ b/arch/mips/include/asm/io.h -@@ -275,6 +275,7 @@ static inline void __iomem * __ioremap_m - */ - #define ioremap_cachable(offset, size) \ - __ioremap_mode((offset), (size), _page_cachable_default) -+#define ioremap_cache ioremap_cachable - - /* - * These two are MIPS specific ioremap variant. ioremap_cacheable_cow diff --git a/target/linux/generic/pending-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch b/target/linux/generic/pending-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch deleted file mode 100644 index 3a27feac8..000000000 --- a/target/linux/generic/pending-4.4/098-usb-dwc2-Remove-unnecessary-kfree.patch +++ /dev/null @@ -1,24 +0,0 @@ -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/pending-4.4/101-MIPS-fix-cache-flushing-for-highmem-pages.patch b/target/linux/generic/pending-4.4/101-MIPS-fix-cache-flushing-for-highmem-pages.patch deleted file mode 100644 index e4ac2cd58..000000000 --- a/target/linux/generic/pending-4.4/101-MIPS-fix-cache-flushing-for-highmem-pages.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Felix Fietkau -Date: Sun, 24 Jan 2016 01:03:51 +0100 -Subject: [PATCH] MIPS: fix cache flushing for highmem pages - -Most cache flush ops were no-op for highmem pages. This led to nasty -segfaults and (in the case of page_address(page) == NULL) kernel -crashes. - -Fix this by always flushing highmem pages using kmap/kunmap_atomic -around the actual cache flush. This might be a bit inefficient, but at -least it's stable. - -Signed-off-by: Felix Fietkau ---- - ---- a/arch/mips/mm/cache.c -+++ b/arch/mips/mm/cache.c -@@ -111,6 +111,13 @@ void __flush_anon_page(struct page *page - { - unsigned long addr = (unsigned long) page_address(page); - -+ if (PageHighMem(page)) { -+ addr = (unsigned long)kmap_atomic(page); -+ flush_data_cache_page(addr); -+ __kunmap_atomic((void *)addr); -+ return; -+ } -+ - if (pages_do_alias(addr, vmaddr)) { - if (page_mapped(page) && !Page_dcache_dirty(page)) { - void *kaddr; diff --git a/target/linux/generic/pending-4.4/102-ehci_hcd_ignore_oc.patch b/target/linux/generic/pending-4.4/102-ehci_hcd_ignore_oc.patch deleted file mode 100644 index 71e3a74ad..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -639,7 +639,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 -@@ -634,7 +634,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; -@@ -996,7 +996,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 -@@ -254,6 +254,8 @@ static int ehci_platform_probe(struct pl - hcd->has_tt = 1; - if (pdata->reset_on_resume) - priv->reset_on_resume = true; -+ 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 -@@ -227,6 +227,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/pending-4.4/103-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-4.4/103-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch deleted file mode 100644 index a53be2d15..000000000 --- a/target/linux/generic/pending-4.4/103-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ /dev/null @@ -1,86 +0,0 @@ -From: Tobias Wolf -Date: Wed, 30 Nov 2016 09:16:41 +0100 -Subject: [PATCH] mm: Fix alloc_node_mem_map with ARCH_PFN_OFFSET - calculation - -Dear folks, - -An rt288x (ralink) based router (Belkin F5D8235 v1) does not boot with any -kernel beyond version 4.3 resulting in: - -BUG: Bad page state in process swapper pfn:086ac - -bisect resulted in: - -a1c34a3bf00af2cede839879502e12dc68491ad5 is the first bad commit -commit a1c34a3bf00af2cede839879502e12dc68491ad5 -Author: Laura Abbott -Date: Thu Nov 5 18:48:46 2015 -0800 - - mm: Don't offset memmap for flatmem - - Srinivas Kandagatla reported bad page messages when trying to remove the - bottom 2MB on an ARM based IFC6410 board - - BUG: Bad page state in process swapper pfn:fffa8 - page:ef7fb500 count:0 mapcount:0 mapping: (null) index:0x0 - flags: 0x96640253(locked|error|dirty|active|arch_1|reclaim|mlocked) - page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set - bad because of flags: - flags: 0x200041(locked|active|mlocked) - Modules linked in: - CPU: 0 PID: 0 Comm: swapper Not tainted 3.19.0-rc3-00007-g412f9ba-dirty -#816 - Hardware name: Qualcomm (Flattened Device Tree) - unwind_backtrace - show_stack - dump_stack - bad_page - free_pages_prepare - free_hot_cold_page - __free_pages - free_highmem_page - mem_init - start_kernel - Disabling lock debugging due to kernel taint - [...] -:040000 040000 2de013c372345fd471cd58f0553c9b38b0ef1cc4 -0a8156f848733dfa21e16c196dfb6c0a76290709 M mm - -This fix for ARM does not account ARCH_PFN_OFFSET for mem_map as later used by -page_to_pfn anymore. - -The following output was generated with two hacked in printk statements: - -printk("before %p vs. %p or %p\n", mem_map, mem_map - offset, mem_map - -(pgdat->node_start_pfn - ARCH_PFN_OFFSET)); - if (page_to_pfn(mem_map) != pgdat->node_start_pfn) - mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); -printk("after %p\n", mem_map); - -Output: - -[ 0.000000] before 8861b280 vs. 8861b280 or 8851b280 -[ 0.000000] after 8851b280 - -As seen in the first line mem_map with subtraction of offset does not equal the -mem_map after subtraction of ARCH_PFN_OFFSET. - -After adding the offset of ARCH_PFN_OFFSET as well to mem_map as the -previously calculated offset is zero for the named platform it is able to boot -4.4 and 4.9-rc7 again. - -Signed-off-by: Tobias Wolf ---- - ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -5372,7 +5372,7 @@ static void __init_refok alloc_node_mem_ - mem_map = NODE_DATA(0)->node_mem_map; - #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) - if (page_to_pfn(mem_map) != pgdat->node_start_pfn) -- mem_map -= offset; -+ mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); - #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ - } - #endif diff --git a/target/linux/generic/pending-4.4/105-add-linux-spidev-compatible.patch b/target/linux/generic/pending-4.4/105-add-linux-spidev-compatible.patch deleted file mode 100644 index cae20a532..000000000 --- a/target/linux/generic/pending-4.4/105-add-linux-spidev-compatible.patch +++ /dev/null @@ -1,15 +0,0 @@ -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/pending-4.4/106-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch b/target/linux/generic/pending-4.4/106-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch deleted file mode 100644 index 57c947535..000000000 --- a/target/linux/generic/pending-4.4/106-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch +++ /dev/null @@ -1,21 +0,0 @@ -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/pending-4.4/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch b/target/linux/generic/pending-4.4/110-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch deleted file mode 100644 index b7ff84534..000000000 --- a/target/linux/generic/pending-4.4/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, -@@ -754,8 +754,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); -@@ -763,6 +782,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 -@@ -826,9 +848,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/pending-4.4/111-jffs2-add-RENAME_EXCHANGE-support.patch b/target/linux/generic/pending-4.4/111-jffs2-add-RENAME_EXCHANGE-support.patch deleted file mode 100644 index 37eb073df..000000000 --- a/target/linux/generic/pending-4.4/111-jffs2-add-RENAME_EXCHANGE-support.patch +++ /dev/null @@ -1,81 +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 -@@ -779,18 +779,31 @@ static int jffs2_rename (struct inode *o - int ret; - struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); - struct jffs2_inode_info *victim_f = NULL; -+ struct inode *fst_inode = d_inode(old_dentry); -+ struct inode *snd_inode = d_inode(new_dentry); - uint8_t type; - uint32_t now; - -- if (flags & ~RENAME_WHITEOUT) -+ if (flags & ~(RENAME_WHITEOUT | RENAME_EXCHANGE)) - return -EINVAL; - -+ if ((flags & RENAME_EXCHANGE) && (old_dir_i != new_dir_i)) { -+ if (S_ISDIR(fst_inode->i_mode) && !S_ISDIR(snd_inode->i_mode)) { -+ inc_nlink(new_dir_i); -+ drop_nlink(old_dir_i); -+ } -+ else if (!S_ISDIR(fst_inode->i_mode) && S_ISDIR(snd_inode->i_mode)) { -+ drop_nlink(new_dir_i); -+ inc_nlink(old_dir_i); -+ } -+ } -+ - /* 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 - * 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; -@@ -825,7 +838,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)); -@@ -845,12 +858,18 @@ static int jffs2_rename (struct inode *o - - /* If it was a directory we moved, and there was no victim, - increase i_nlink on its new parent */ -- if (d_is_dir(old_dentry) && !victim_f) -+ if (d_is_dir(old_dentry) && !victim_f && !(flags & RENAME_EXCHANGE)) - inc_nlink(new_dir_i); - - 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), -@@ -882,7 +901,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/pending-4.4/120-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-4.4/120-bridge_allow_receiption_on_disabled_port.patch deleted file mode 100644 index bba607498..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -218,11 +218,13 @@ EXPORT_SYMBOL_GPL(br_handle_frame_finish - static int br_handle_local_finish(struct net *net, 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 */ - } - -@@ -297,6 +299,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, dev_net(skb->dev), 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/pending-4.4/132-mips_inline_dma_ops.patch b/target/linux/generic/pending-4.4/132-mips_inline_dma_ops.patch deleted file mode 100644 index 143b0bb3f..000000000 --- a/target/linux/generic/pending-4.4/132-mips_inline_dma_ops.patch +++ /dev/null @@ -1,778 +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 -@@ -1619,6 +1619,7 @@ config CPU_CAVIUM_OCTEON - select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN - select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN - 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 -@@ -1914,6 +1915,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 - - #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */ - #include -@@ -11,12 +18,53 @@ - - 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 -+} -+ -+/* -+ * 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 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) -@@ -29,9 +77,399 @@ 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_post_dma_flush(dev); -+ plat_unmap_dma_mem(dev, addr, size, dir); -+ } -+ debug_dma_unmap_page(dev, addr, size, dir, true); -+} -+ -+/* -+ * dma_maps_sg_attrs returns 0 on error and > 0 on success. -+ * It should never return a value < 0. -+ */ -+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; -+ } -+ BUG_ON(ents < 0); -+ 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); -+ plat_post_dma_flush(dev); -+ } -+ -+ 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); -+ 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) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ debug_dma_mapping_error(dev, mask); -+ if (ops) -+ return ops->mapping_error(dev, mask); -+ return 0; -+} -+ -+static inline int -+dma_set_mask(struct device *dev, u64 mask) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ if(!dev->dma_mask || !dma_supported(dev, mask)) -+ return -EIO; -+ -+ if (ops && ops->set_dma_mask) -+ return ops->set_dma_mask(dev, mask); -+ -+ *dev->dma_mask = mask; -+ -+ return 0; -+} - - extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, - enum dma_data_direction direction); - -+#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) -+ -+static inline void *dma_alloc_attrs(struct device *dev, size_t size, -+ dma_addr_t *dma_handle, gfp_t gfp, -+ struct dma_attrs *attrs) -+{ -+ void *ret; -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ 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); -+ -+ return ret; -+} -+ -+#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) -+ -+static inline void dma_free_attrs(struct device *dev, size_t size, -+ void *vaddr, dma_addr_t dma_handle, -+ struct dma_attrs *attrs) -+{ -+ struct dma_map_ops *ops = get_dma_ops(dev); -+ -+ 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); -+} -+ -+static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, -+ dma_addr_t *dma_handle, gfp_t gfp) -+{ -+ DEFINE_DMA_ATTRS(attrs); -+ -+ dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs); -+ return dma_alloc_attrs(dev, size, dma_handle, gfp, &attrs); -+} -+ -+static inline void dma_free_noncoherent(struct device *dev, size_t size, -+ void *cpu_addr, dma_addr_t dma_handle) -+{ -+ DEFINE_DMA_ATTRS(attrs); -+ -+ dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs); -+ dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs); -+} -+ -+ - #endif /* _ASM_DMA_MAPPING_H */ ---- a/arch/mips/mm/dma-default.c -+++ b/arch/mips/mm/dma-default.c -@@ -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; -@@ -129,7 +100,7 @@ static void *mips_dma_alloc_noncoherent( - return ret; - } - --static void *mips_dma_alloc_coherent(struct device *dev, size_t size, -+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; -@@ -165,6 +136,7 @@ static void *mips_dma_alloc_coherent(str - - return ret; - } -+EXPORT_SYMBOL(mips_dma_alloc_coherent); - - - static void mips_dma_free_noncoherent(struct device *dev, size_t size, -@@ -174,7 +146,7 @@ static void mips_dma_free_noncoherent(st - free_pages((unsigned long) vaddr, get_order(size)); - } - --static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, -+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; -@@ -196,40 +168,7 @@ static void mips_dma_free_coherent(struc - if (!dma_release_from_contiguous(dev, page, count)) - __free_pages(page, get_order(size)); - } -- --static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma, -- void *cpu_addr, dma_addr_t dma_addr, size_t size, -- struct dma_attrs *attrs) --{ -- unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; -- unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; -- unsigned long addr = (unsigned long)cpu_addr; -- unsigned long off = vma->vm_pgoff; -- unsigned long pfn; -- int ret = -ENXIO; -- -- if (!plat_device_is_coherent(dev) && !hw_coherentio) -- addr = CAC_ADDR(addr); -- -- pfn = page_to_pfn(virt_to_page((void *)addr)); -- -- if (dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs)) -- vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); -- else -- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -- -- if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) -- return ret; -- -- if (off < count && user_count <= (count - off)) { -- ret = remap_pfn_range(vma, vma->vm_start, -- pfn + off, -- user_count << PAGE_SHIFT, -- vma->vm_page_prot); -- } -- -- return ret; --} -+EXPORT_SYMBOL(mips_dma_free_coherent); - - static inline void __dma_sync_virtual(void *addr, size_t size, - enum dma_data_direction direction) -@@ -258,7 +197,7 @@ 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, -+void __dma_sync(struct page *page, - unsigned long offset, size_t size, enum dma_data_direction direction) - { - size_t left = size; -@@ -288,120 +227,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 *sglist, -- int nents, enum dma_data_direction direction, struct dma_attrs *attrs) --{ -- int i; -- struct scatterlist *sg; -- -- for_each_sg(sglist, sg, nents, i) { -- 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 *sglist, -- int nhwentries, enum dma_data_direction direction, -- struct dma_attrs *attrs) --{ -- int i; -- struct scatterlist *sg; -- -- for_each_sg(sglist, sg, nhwentries, i) { -- 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 *sglist, int nelems, -- enum dma_data_direction direction) --{ -- int i; -- struct scatterlist *sg; -- -- if (cpu_needs_post_dma_flush(dev)) { -- for_each_sg(sglist, sg, nelems, i) { -- __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 *sglist, int nelems, -- enum dma_data_direction direction) --{ -- int i; -- struct scatterlist *sg; -- -- if (!plat_device_is_coherent(dev)) { -- for_each_sg(sglist, sg, nelems, i) { -- __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) -@@ -414,24 +240,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, -- .mmap = mips_dma_mmap, -- .map_page = mips_dma_map_page, -- .unmap_page = mips_dma_unmap_page, -- .map_sg = mips_dma_map_sg, -- .unmap_sg = mips_dma_unmap_sg, -- .sync_single_for_cpu = mips_dma_sync_single_for_cpu, -- .sync_single_for_device = mips_dma_sync_single_for_device, -- .sync_sg_for_cpu = mips_dma_sync_sg_for_cpu, -- .sync_sg_for_device = mips_dma_sync_sg_for_device, -- .mapping_error = mips_dma_mapping_error, -- .dma_supported = mips_dma_supported --}; -- --struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops; -+#ifdef CONFIG_SYS_HAS_DMA_OPS -+struct dma_map_ops *mips_dma_map_ops = NULL; - EXPORT_SYMBOL(mips_dma_map_ops); -+#endif - - #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) - diff --git a/target/linux/generic/pending-4.4/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.4/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch deleted file mode 100644 index e1b84ae52..000000000 --- a/target/linux/generic/pending-4.4/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ /dev/null @@ -1,183 +0,0 @@ -From 3e7056c3a369e9ef9ca804bc626b60ef6b62ee27 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 17 May 2015 18:48:38 +0200 -Subject: [PATCH 2/3] 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 | 46 +------------------------- - drivers/mtd/mtdpart.c | 45 +++++++++++++++++++++++++ - 3 files changed, 62 insertions(+), 45 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,47 +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); -- if (!res) -- return NULL; -- 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 const 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; -@@ -311,14 +273,8 @@ static int of_flash_probe(struct platfor - goto err_out; - - ppdata.of_node = dp; -- part_probe_types = of_get_probes(dp); -- if (!part_probe_types) { -- err = -ENOMEM; -- goto err_out; -- } -- 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 - -@@ -721,6 +722,42 @@ 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); -+ if (!res) -+ return NULL; -+ 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! - */ -@@ -756,6 +793,13 @@ int parse_mtd_partitions(struct mtd_info - { - struct mtd_part_parser *parser; - int ret, err = 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; -@@ -785,6 +829,7 @@ int parse_mtd_partitions(struct mtd_info - if (ret < 0 && !err) - err = ret; - } -+ kfree(types_of); - return err; - } - diff --git a/target/linux/generic/pending-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch b/target/linux/generic/pending-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch deleted file mode 100644 index d6e577be8..000000000 --- a/target/linux/generic/pending-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: "L. D. Pinney" -Date: Thu, 25 Aug 2016 13:07:56 -0500 -Subject: [PATCH] mtd: spi-nor: add support for ESMT_f25l32qa and ESMT_f25l64qa - -Add Support for the ESMT_F25L32QA and ESMT_F25L64QA -These are 4MB and 8MB SPI NOR Chips from Elite Semiconductor Memory Technology - -Signed-off-by: L. D. Pinney ---- - ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -689,6 +689,8 @@ static const struct flash_info spi_nor_i - - /* ESMT */ - { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) }, -+ { "f25l32qa", INFO(0x8c4116, 0, 64 * 1024, 64, SECT_4K) }, -+ { "f25l64qa", INFO(0x8c4117, 0, 64 * 1024, 128, SECT_4K) }, - - /* Everspin */ - { "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, diff --git a/target/linux/generic/pending-4.4/160-usb-gadget-udc-net2280-add-usb2380-support.patch b/target/linux/generic/pending-4.4/160-usb-gadget-udc-net2280-add-usb2380-support.patch deleted file mode 100644 index 94f78102b..000000000 --- a/target/linux/generic/pending-4.4/160-usb-gadget-udc-net2280-add-usb2380-support.patch +++ /dev/null @@ -1,253 +0,0 @@ -From 5185c91385d73cdf79836eb8548e4726e43ae831 Mon Sep 17 00:00:00 2001 -From: Tim Harvey -Date: Mon, 23 May 2016 06:58:41 -0700 -Subject: [PATCH] usb: gadget: net2280: add USB2380 support - -The PLX USB2380 is a PCIe version of the NET2280 and behaves more like the -USB338x but without the USB3.0 superspeed support. - -This was tested with g_ether, g_serial, g_mass_storage on a Gateworks -Ventana GW2383. - -Cc: Justin DeFields -Signed-off-by: Tim Harvey -Signed-off-by: Felipe Balbi ---- - drivers/usb/gadget/udc/Kconfig | 4 +++- - drivers/usb/gadget/udc/net2280.c | 51 +++++++++++++++++++++++----------------- - drivers/usb/gadget/udc/net2280.h | 1 + - 3 files changed, 34 insertions(+), 22 deletions(-) - ---- a/drivers/usb/gadget/udc/Kconfig -+++ b/drivers/usb/gadget/udc/Kconfig -@@ -298,7 +298,7 @@ config USB_NET2272_DMA - If unsure, say "N" here. The driver works fine in PIO mode. - - config USB_NET2280 -- tristate "NetChip 228x / PLX USB338x" -+ tristate "NetChip NET228x / PLX USB3x8x" - depends on PCI - help - NetChip 2280 / 2282 is a PCI based USB peripheral controller which -@@ -308,6 +308,8 @@ config USB_NET2280 - (for control transfers) and several endpoints with dedicated - functions. - -+ PLX 2380 is a PCIe version of the PLX 2380. -+ - PLX 3380 / 3382 is a PCIe based USB peripheral controller which - supports full, high speed USB 2.0 and super speed USB 3.0 - data transfers. ---- a/drivers/usb/gadget/udc/net2280.c -+++ b/drivers/usb/gadget/udc/net2280.c -@@ -211,7 +211,7 @@ net2280_enable(struct usb_ep *_ep, const - goto print_err; - } - -- if (dev->quirks & PLX_SUPERSPEED) { -+ if (dev->quirks & PLX_PCIE) { - if ((desc->bEndpointAddress & 0x0f) >= 0x0c) { - ret = -EDOM; - goto print_err; -@@ -245,7 +245,7 @@ net2280_enable(struct usb_ep *_ep, const - /* set type, direction, address; reset fifo counters */ - writel(BIT(FIFO_FLUSH), &ep->regs->ep_stat); - -- if ((dev->quirks & PLX_SUPERSPEED) && dev->enhanced_mode) { -+ if ((dev->quirks & PLX_PCIE) && dev->enhanced_mode) { - tmp = readl(&ep->cfg->ep_cfg); - /* If USB ep number doesn't match hardware ep number */ - if ((tmp & 0xf) != usb_endpoint_num(desc)) { -@@ -316,7 +316,7 @@ net2280_enable(struct usb_ep *_ep, const - BIT(CLEAR_NAK_OUT_PACKETS_MODE), &ep->regs->ep_rsp); - } - -- if (dev->quirks & PLX_SUPERSPEED) -+ if (dev->quirks & PLX_PCIE) - ep_clear_seqnum(ep); - writel(tmp, &ep->cfg->ep_cfg); - -@@ -527,7 +527,7 @@ static int net2280_disable(struct usb_ep - spin_lock_irqsave(&ep->dev->lock, flags); - nuke(ep); - -- if (ep->dev->quirks & PLX_SUPERSPEED) -+ if (ep->dev->quirks & PLX_PCIE) - ep_reset_338x(ep->dev->regs, ep); - else - ep_reset_228x(ep->dev->regs, ep); -@@ -862,7 +862,7 @@ static void start_queue(struct net2280_e - writel(readl(&dma->dmastat), &dma->dmastat); - - writel(td_dma, &dma->dmadesc); -- if (ep->dev->quirks & PLX_SUPERSPEED) -+ if (ep->dev->quirks & PLX_PCIE) - dmactl |= BIT(DMA_REQUEST_OUTSTANDING); - writel(dmactl, &dma->dmactl); - -@@ -1046,7 +1046,7 @@ net2280_queue(struct usb_ep *_ep, struct - - /* kickstart this i/o queue? */ - if (list_empty(&ep->queue) && !ep->stopped && -- !((dev->quirks & PLX_SUPERSPEED) && ep->dma && -+ !((dev->quirks & PLX_PCIE) && ep->dma && - (readl(&ep->regs->ep_rsp) & BIT(CLEAR_ENDPOINT_HALT)))) { - - /* use DMA if the endpoint supports it, else pio */ -@@ -1169,7 +1169,7 @@ static void scan_dma_completions(struct - break; - } else if (!ep->is_in && - (req->req.length % ep->ep.maxpacket) && -- !(ep->dev->quirks & PLX_SUPERSPEED)) { -+ !(ep->dev->quirks & PLX_PCIE)) { - - tmp = readl(&ep->regs->ep_stat); - /* AVOID TROUBLE HERE by not issuing short reads from -@@ -1367,7 +1367,7 @@ net2280_set_halt_and_wedge(struct usb_ep - ep->wedged = 1; - } else { - clear_halt(ep); -- if (ep->dev->quirks & PLX_SUPERSPEED && -+ if (ep->dev->quirks & PLX_PCIE && - !list_empty(&ep->queue) && ep->td_dma) - restart_dma(ep); - ep->wedged = 0; -@@ -2394,7 +2394,7 @@ static int net2280_start(struct usb_gadg - */ - net2280_led_active(dev, 1); - -- if ((dev->quirks & PLX_SUPERSPEED) && !dev->bug7734_patched) -+ if ((dev->quirks & PLX_PCIE) && !dev->bug7734_patched) - defect7374_enable_data_eps_zero(dev); - - ep0_start(dev); -@@ -3060,7 +3060,7 @@ static void handle_stat0_irqs(struct net - } - ep->stopped = 0; - dev->protocol_stall = 0; -- if (!(dev->quirks & PLX_SUPERSPEED)) { -+ if (!(dev->quirks & PLX_PCIE)) { - if (ep->dev->quirks & PLX_2280) - tmp = BIT(FIFO_OVERFLOW) | - BIT(FIFO_UNDERFLOW); -@@ -3087,7 +3087,7 @@ static void handle_stat0_irqs(struct net - cpu_to_le32s(&u.raw[0]); - cpu_to_le32s(&u.raw[1]); - -- if ((dev->quirks & PLX_SUPERSPEED) && !dev->bug7734_patched) -+ if ((dev->quirks & PLX_PCIE) && !dev->bug7734_patched) - defect7374_workaround(dev, u.r); - - tmp = 0; -@@ -3170,7 +3170,7 @@ static void handle_stat0_irqs(struct net - } else { - ep_vdbg(dev, "%s clear halt\n", e->ep.name); - clear_halt(e); -- if ((ep->dev->quirks & PLX_SUPERSPEED) && -+ if ((ep->dev->quirks & PLX_PCIE) && - !list_empty(&e->queue) && e->td_dma) - restart_dma(e); - } -@@ -3192,7 +3192,7 @@ static void handle_stat0_irqs(struct net - if (e->ep.name == ep0name) - goto do_stall; - set_halt(e); -- if ((dev->quirks & PLX_SUPERSPEED) && e->dma) -+ if ((dev->quirks & PLX_PCIE) && e->dma) - abort_dma(e); - allow_status(ep); - ep_vdbg(dev, "%s set halt\n", ep->ep.name); -@@ -3231,7 +3231,7 @@ do_stall: - #undef w_length - - next_endpoints: -- if ((dev->quirks & PLX_SUPERSPEED) && dev->enhanced_mode) { -+ if ((dev->quirks & PLX_PCIE) && dev->enhanced_mode) { - u32 mask = (BIT(ENDPOINT_0_INTERRUPT) | - USB3380_IRQSTAT0_EP_INTR_MASK_IN | - USB3380_IRQSTAT0_EP_INTR_MASK_OUT); -@@ -3392,7 +3392,7 @@ static void handle_stat1_irqs(struct net - writel(tmp, &dma->dmastat); - - /* dma sync*/ -- if (dev->quirks & PLX_SUPERSPEED) { -+ if (dev->quirks & PLX_PCIE) { - u32 r_dmacount = readl(&dma->dmacount); - if (!ep->is_in && (r_dmacount & 0x00FFFFFF) && - (tmp & BIT(DMA_TRANSACTION_DONE_INTERRUPT))) -@@ -3461,7 +3461,7 @@ static irqreturn_t net2280_irq(int irq, - /* control requests and PIO */ - handle_stat0_irqs(dev, readl(&dev->regs->irqstat0)); - -- if (dev->quirks & PLX_SUPERSPEED) { -+ if (dev->quirks & PLX_PCIE) { - /* re-enable interrupt to trigger any possible new interrupt */ - u32 pciirqenb1 = readl(&dev->regs->pciirqenb1); - writel(pciirqenb1 & 0x7FFFFFFF, &dev->regs->pciirqenb1); -@@ -3506,7 +3506,7 @@ static void net2280_remove(struct pci_de - } - if (dev->got_irq) - free_irq(pdev->irq, dev); -- if (dev->quirks & PLX_SUPERSPEED) -+ if (dev->quirks & PLX_PCIE) - pci_disable_msi(pdev); - if (dev->regs) - iounmap(dev->regs); -@@ -3586,7 +3586,7 @@ static int net2280_probe(struct pci_dev - dev->dep = (struct net2280_dep_regs __iomem *) (base + 0x0200); - dev->epregs = (struct net2280_ep_regs __iomem *) (base + 0x0300); - -- if (dev->quirks & PLX_SUPERSPEED) { -+ if (dev->quirks & PLX_PCIE) { - u32 fsmvalue; - u32 usbstat; - dev->usb_ext = (struct usb338x_usb_ext_regs __iomem *) -@@ -3630,7 +3630,7 @@ static int net2280_probe(struct pci_dev - goto done; - } - -- if (dev->quirks & PLX_SUPERSPEED) -+ if (dev->quirks & PLX_PCIE) - if (pci_enable_msi(pdev)) - ep_err(dev, "Failed to enable MSI mode\n"); - -@@ -3748,10 +3748,19 @@ static const struct pci_device_id pci_id - .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), - .class_mask = ~0, - .vendor = PCI_VENDOR_ID_PLX, -+ .device = 0x2380, -+ .subvendor = PCI_ANY_ID, -+ .subdevice = PCI_ANY_ID, -+ .driver_data = PLX_PCIE, -+ }, -+ { -+ .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), -+ .class_mask = ~0, -+ .vendor = PCI_VENDOR_ID_PLX, - .device = 0x3380, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, -- .driver_data = PLX_SUPERSPEED, -+ .driver_data = PLX_PCIE | PLX_SUPERSPEED, - }, - { - .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), -@@ -3760,7 +3769,7 @@ static const struct pci_device_id pci_id - .device = 0x3382, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, -- .driver_data = PLX_SUPERSPEED, -+ .driver_data = PLX_PCIE | PLX_SUPERSPEED, - }, - { /* end: all zeroes */ } - }; ---- a/drivers/usb/gadget/udc/net2280.h -+++ b/drivers/usb/gadget/udc/net2280.h -@@ -47,6 +47,7 @@ set_idx_reg(struct net2280_regs __iomem - #define PLX_LEGACY BIT(0) - #define PLX_2280 BIT(1) - #define PLX_SUPERSPEED BIT(2) -+#define PLX_PCIE BIT(3) - - #define REG_DIAG 0x0 - #define RETRY_COUNTER 16 diff --git a/target/linux/generic/pending-4.4/180-Revert-bcma-init-serial-console-directly-from-ChipCo.patch b/target/linux/generic/pending-4.4/180-Revert-bcma-init-serial-console-directly-from-ChipCo.patch deleted file mode 100644 index affe09045..000000000 --- a/target/linux/generic/pending-4.4/180-Revert-bcma-init-serial-console-directly-from-ChipCo.patch +++ /dev/null @@ -1,92 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] Revert "bcma: init serial console directly from ChipCommon - code" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This reverts commit 4c81acab3816 ("bcma: init serial console directly -from ChipCommon code") as it broke IRQ assignment. Getting IRQ with -bcma_core_irq helper on SoC requires MIPS core to be set. It happens -*after* ChipCommon initialization so we can't do this so early. - -This fixes a user reported regression. It wasn't critical as serial was -still somehow working but lack of IRQs was making in unreliable. - -Fixes: 4c81acab3816 ("bcma: init serial console directly from ChipCommon code") -Reported-by: Felix Fietkau -Cc: stable@vger.kernel.org # 4.6+ -Signed-off-by: Rafał Miłecki ---- - drivers/bcma/bcma_private.h | 3 +++ - drivers/bcma/driver_chipcommon.c | 11 +++-------- - drivers/bcma/driver_mips.c | 3 +++ - 3 files changed, 9 insertions(+), 8 deletions(-) - ---- a/drivers/bcma/bcma_private.h -+++ b/drivers/bcma/bcma_private.h -@@ -45,6 +45,9 @@ 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); -+#endif /* CONFIG_BCMA_DRIVER_MIPS */ - - /* driver_chipcommon_b.c */ - int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb); ---- a/drivers/bcma/driver_chipcommon.c -+++ b/drivers/bcma/driver_chipcommon.c -@@ -15,8 +15,6 @@ - #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) - { -@@ -186,9 +184,6 @@ 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); - -@@ -378,9 +373,9 @@ u32 bcma_chipco_gpio_pulldown(struct bcm - return res; - } - --static void bcma_chipco_serial_init(struct bcma_drv_cc *cc) -+#ifdef CONFIG_BCMA_DRIVER_MIPS -+void bcma_chipco_serial_init(struct bcma_drv_cc *cc) - { --#if IS_BUILTIN(CONFIG_BCM47XX) - unsigned int irq; - u32 baud_base; - u32 i; -@@ -422,5 +417,5 @@ static void bcma_chipco_serial_init(stru - ports[i].baud_base = baud_base; - ports[i].reg_shift = 0; - } --#endif /* CONFIG_BCM47XX */ - } -+#endif /* CONFIG_BCMA_DRIVER_MIPS */ ---- a/drivers/bcma/driver_mips.c -+++ b/drivers/bcma/driver_mips.c -@@ -278,9 +278,12 @@ static void bcma_core_mips_nvram_init(st - - 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_nvram_init(mcore); - - mcore->early_setup_done = true; diff --git a/target/linux/generic/pending-4.4/200-fix_localversion.patch b/target/linux/generic/pending-4.4/200-fix_localversion.patch deleted file mode 100644 index 70228bb5f..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/201-extra_optimization.patch b/target/linux/generic/pending-4.4/201-extra_optimization.patch deleted file mode 100644 index b4235a11d..000000000 --- a/target/linux/generic/pending-4.4/201-extra_optimization.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -626,12 +626,12 @@ KBUILD_CFLAGS += $(call cc-disable-warni - KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) - - ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE --KBUILD_CFLAGS += -Os -+KBUILD_CFLAGS += -Os $(EXTRA_OPTIMIZATION) - else - ifdef CONFIG_PROFILE_ALL_BRANCHES --KBUILD_CFLAGS += -O2 -+KBUILD_CFLAGS += -O2 $(EXTRA_OPTIMIZATION) - else --KBUILD_CFLAGS += -O2 -+KBUILD_CFLAGS += -O2 -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION) - endif - endif - diff --git a/target/linux/generic/pending-4.4/202-reduce_module_size.patch b/target/linux/generic/pending-4.4/202-reduce_module_size.patch deleted file mode 100644 index 1aabf3e72..000000000 --- a/target/linux/generic/pending-4.4/202-reduce_module_size.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -405,7 +405,7 @@ KBUILD_CFLAGS_KERNEL := - KBUILD_AFLAGS := -D__ASSEMBLY__ $(call cc-option,-fno-PIE) - KBUILD_AFLAGS_MODULE := -DMODULE - KBUILD_CFLAGS_MODULE := -DMODULE --KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds -+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if $(CONFIG_PROFILING),,-s) - - # Read KERNELRELEASE from include/config/kernel.release (if it exists) - KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) diff --git a/target/linux/generic/pending-4.4/203-kallsyms_uncompressed.patch b/target/linux/generic/pending-4.4/203-kallsyms_uncompressed.patch deleted file mode 100644 index cf8a447bb..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -1345,6 +1345,17 @@ config SYSCTL_ARCH_UNALIGN_ALLOW - the unaligned access emulation. - see arch/parisc/kernel/unaligned.c for reference - -+config KALLSYMS_UNCOMPRESSED -+ bool "Keep kallsyms uncompressed" -+ depends on KALLSYMS -+ help -+ Normally kallsyms contains compressed symbols (using a token table), -+ reducing the uncompressed kernel image size. Keeping the symbol table -+ uncompressed significantly improves the size of this part in compressed -+ kernel images. -+ -+ Say N unless you need compressed kernel images to be small. -+ - config HAVE_PCSPKR_PLATFORM - bool - ---- a/scripts/link-vmlinux.sh -+++ b/scripts/link-vmlinux.sh -@@ -90,6 +90,10 @@ kallsyms() - kallsymopt="${kallsymopt} --absolute-percpu" - fi - -+ if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then -+ kallsymopt="${kallsymopt} --uncompressed" -+ fi -+ - local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ - ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" - ---- a/kernel/kallsyms.c -+++ b/kernel/kallsyms.c -@@ -109,6 +109,11 @@ static unsigned int kallsyms_expand_symb - * For every byte on the compressed symbol data, copy the table - * entry for that byte. - */ -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ memcpy(result, data + 1, len - 1); -+ result += len - 1; -+ len = 0; -+#endif - while (len) { - tptr = &kallsyms_token_table[kallsyms_token_index[*data]]; - data++; -@@ -141,6 +146,9 @@ tail: - */ - static char kallsyms_get_symbol_type(unsigned int off) - { -+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED -+ return kallsyms_names[off + 1]; -+#endif - /* - * Get just the first code, look it up in the token table, - * and return the first char from this token. diff --git a/target/linux/generic/pending-4.4/204-module_strip.patch b/target/linux/generic/pending-4.4/204-module_strip.patch deleted file mode 100644 index a661f98c6..000000000 --- a/target/linux/generic/pending-4.4/204-module_strip.patch +++ /dev/null @@ -1,193 +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 -@@ -169,6 +169,7 @@ void trim_init_extable(struct module *m) - - /* Generic info of form tag = "info" */ - #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) -+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info) - - /* For userspace: you can also call me... */ - #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) -@@ -212,12 +213,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 \ -@@ -244,7 +245,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 = { \ -@@ -266,7 +269,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 -@@ -2033,6 +2033,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 MODULES_TREE_LOOKUP ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -2880,6 +2880,7 @@ static void check_modinfo_retpoline(stru - - 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; - -@@ -2911,6 +2912,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 -@@ -1964,7 +1964,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)) -@@ -2108,7 +2110,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"); -@@ -2125,8 +2129,10 @@ 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 - } - - /* Cannot check for assembler */ -@@ -2139,10 +2145,12 @@ static void add_retpoline(struct buffer - - 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 - } - - /* In kernel, this size is defined in linux/module.h; -@@ -2246,11 +2254,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) -@@ -2485,7 +2495,9 @@ int main(int argc, char **argv) - add_staging_flag(&buf, mod->name); - err |= add_versions(&buf, mod); - add_depends(&buf, mod, modules); -+#ifndef CONFIG_MODULE_STRIPPED - add_moddevtable(&buf, mod); -+#endif - add_srcversion(&buf, mod); - - sprintf(fname, "%s.mod.c", mod->name); diff --git a/target/linux/generic/pending-4.4/205-backtrace_module_info.patch b/target/linux/generic/pending-4.4/205-backtrace_module_info.patch deleted file mode 100644 index 0550ec439..000000000 --- a/target/linux/generic/pending-4.4/205-backtrace_module_info.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/lib/vsprintf.c -+++ b/lib/vsprintf.c -@@ -618,8 +618,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') -@@ -633,15 +635,15 @@ char *symbol_string(char *buf, char *end - sprint_symbol(sym, value); - else - sprint_symbol_no_offset(sym, value); -- -- return string(buf, end, sym, spec); - #else -- spec.field_width = 2 * sizeof(void *); -- spec.flags |= SPECIAL | SMALL | ZEROPAD; -- spec.base = 16; -+ len = snprintf(sym, sizeof(sym), "0x%lx", value); - -- return number(buf, end, value, spec); -+ mod = __module_address(value); -+ if (mod) -+ snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]", -+ mod->name, mod->module_core, mod->core_size); - #endif -+ return string(buf, end, sym, spec); - } - - static noinline_for_stack diff --git a/target/linux/generic/pending-4.4/206-mips-disable-vdso.patch b/target/linux/generic/pending-4.4/206-mips-disable-vdso.patch deleted file mode 100644 index 51b1d041b..000000000 --- a/target/linux/generic/pending-4.4/206-mips-disable-vdso.patch +++ /dev/null @@ -1,21 +0,0 @@ -Disable MIPS VDSO until the cache issues have been sorted out. - -Signed-off-by: Felix Fietkau - ---- a/arch/mips/vdso/Makefile -+++ b/arch/mips/vdso/Makefile -@@ -28,11 +28,11 @@ aflags-vdso := $(ccflags-vdso) \ - # the comments on that file. - # - ifndef CONFIG_CPU_MIPSR6 -- ifeq ($(call ld-ifversion, -lt, 22500000, y),y) -- $(warning MIPS VDSO requires binutils >= 2.25) -+# ifeq ($(call ld-ifversion, -lt, 22500000, y),y) -+# $(warning MIPS VDSO requires binutils >= 2.25) - obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y)) - ccflags-vdso += -DDISABLE_MIPS_VDSO -- endif -+# endif - endif - - # VDSO linker flags. diff --git a/target/linux/generic/pending-4.4/207-mips-vdso-dbg-rebuild-after-genvdso.patch b/target/linux/generic/pending-4.4/207-mips-vdso-dbg-rebuild-after-genvdso.patch deleted file mode 100644 index cfcd0b33a..000000000 --- a/target/linux/generic/pending-4.4/207-mips-vdso-dbg-rebuild-after-genvdso.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/arch/mips/vdso/Makefile -+++ b/arch/mips/vdso/Makefile -@@ -77,7 +77,7 @@ $(obj-vdso): KBUILD_AFLAGS := $(aflags-v - - $(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi) - --$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE -+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(obj)/genvdso FORCE - $(call if_changed,vdsold) - - $(obj)/vdso-image.c: $(obj)/vdso.so.dbg $(obj)/genvdso FORCE -@@ -111,7 +111,7 @@ $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := - $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE - $(call if_changed_dep,cpp_lds_S) - --$(obj)/vdso-o32.so.dbg: $(obj)/vdso-o32.lds $(obj-vdso-o32) FORCE -+$(obj)/vdso-o32.so.dbg: $(obj)/vdso-o32.lds $(obj-vdso-o32) $(obj)/genvdso FORCE - $(call if_changed,vdsold) - - $(obj)/vdso-o32-image.c: VDSO_NAME := o32 -@@ -147,7 +147,7 @@ $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := - $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE - $(call if_changed_dep,cpp_lds_S) - --$(obj)/vdso-n32.so.dbg: $(obj)/vdso-n32.lds $(obj-vdso-n32) FORCE -+$(obj)/vdso-n32.so.dbg: $(obj)/vdso-n32.lds $(obj-vdso-n32) $(obj)/genvdso FORCE - $(call if_changed,vdsold) - - $(obj)/vdso-n32-image.c: VDSO_NAME := n32 diff --git a/target/linux/generic/pending-4.4/208-disable-modorder.patch b/target/linux/generic/pending-4.4/208-disable-modorder.patch deleted file mode 100644 index 1707d520b..000000000 --- a/target/linux/generic/pending-4.4/208-disable-modorder.patch +++ /dev/null @@ -1,34 +0,0 @@ -Disable modules.order to improve build performance. -This file is not needed for anything in LEDE - -Signed-off-by: Felix Fietkau ---- ---- a/Makefile -+++ b/Makefile -@@ -1123,7 +1123,6 @@ all: modules - - PHONY += modules - modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin -- $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order - @$(kecho) ' Building modules, stage 2.'; - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild -@@ -1153,7 +1152,6 @@ _modinst_: - rm -f $(MODLIB)/build ; \ - ln -s $(CURDIR) $(MODLIB)/build ; \ - fi -- @cp -f $(objtree)/modules.order $(MODLIB)/ - @cp -f $(objtree)/modules.builtin $(MODLIB)/ - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst - ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -92,7 +92,7 @@ modorder-target := $(obj)/modules.order - # We keep a list of all modules in $(MODVERDIR) - - __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ -- $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ -+ $(if $(KBUILD_MODULES),$(obj-m)) \ - $(subdir-ym) $(always) - @: - diff --git a/target/linux/generic/pending-4.4/210-darwin_scripts_include.patch b/target/linux/generic/pending-4.4/210-darwin_scripts_include.patch deleted file mode 100644 index 2afeb23b5..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -161,6 +161,9 @@ check-lxdialog := $(srctree)/$(src)/lxd - # we really need to do so. (Do not call gcc as part of make mrproper) - HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ - -DLOCALE -+ifeq ($(shell uname -s),Darwin) -+HOST_LOADLIBES += -lncurses -+endif - - # =========================================================================== - # Shared Makefile for the various kconfig executables: ---- a/scripts/mod/mk_elfconfig.c -+++ b/scripts/mod/mk_elfconfig.c -@@ -1,7 +1,11 @@ - #include - #include - #include -+#ifndef __APPLE__ - #include -+#else -+#include "elf.h" -+#endif - - int - main(int argc, char **argv) ---- a/scripts/mod/modpost.h -+++ b/scripts/mod/modpost.h -@@ -7,7 +7,11 @@ - #include - #include - #include -+#if !(defined(__APPLE__) || defined(__CYGWIN__)) - #include -+#else -+#include "elf.h" -+#endif - - #include "elfconfig.h" - ---- /dev/null -+++ b/scripts/mod/elf.h -@@ -0,0 +1,3007 @@ -+/* This file defines standard ELF types, structures, and macros. -+ Copyright (C) 1995-2012 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef _ELF_H -+#define _ELF_H 1 -+ -+/* Standard ELF types. */ -+ -+#include -+ -+/* Type for a 16-bit quantity. */ -+typedef uint16_t Elf32_Half; -+typedef uint16_t Elf64_Half; -+ -+/* Types for signed and unsigned 32-bit quantities. */ -+typedef uint32_t Elf32_Word; -+typedef int32_t Elf32_Sword; -+typedef uint32_t Elf64_Word; -+typedef int32_t Elf64_Sword; -+ -+/* Types for signed and unsigned 64-bit quantities. */ -+typedef uint64_t Elf32_Xword; -+typedef int64_t Elf32_Sxword; -+typedef uint64_t Elf64_Xword; -+typedef int64_t Elf64_Sxword; -+ -+/* Type of addresses. */ -+typedef uint32_t Elf32_Addr; -+typedef uint64_t Elf64_Addr; -+ -+/* Type of file offsets. */ -+typedef uint32_t Elf32_Off; -+typedef uint64_t Elf64_Off; -+ -+/* Type for section indices, which are 16-bit quantities. */ -+typedef uint16_t Elf32_Section; -+typedef uint16_t Elf64_Section; -+ -+/* Type for version symbol information. */ -+typedef Elf32_Half Elf32_Versym; -+typedef Elf64_Half Elf64_Versym; -+ -+ -+/* The ELF file header. This appears at the start of every ELF file. */ -+ -+#define EI_NIDENT (16) -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf32_Half e_type; /* Object file type */ -+ Elf32_Half e_machine; /* Architecture */ -+ Elf32_Word e_version; /* Object file version */ -+ Elf32_Addr e_entry; /* Entry point virtual address */ -+ Elf32_Off e_phoff; /* Program header table file offset */ -+ Elf32_Off e_shoff; /* Section header table file offset */ -+ Elf32_Word e_flags; /* Processor-specific flags */ -+ Elf32_Half e_ehsize; /* ELF header size in bytes */ -+ Elf32_Half e_phentsize; /* Program header table entry size */ -+ Elf32_Half e_phnum; /* Program header table entry count */ -+ Elf32_Half e_shentsize; /* Section header table entry size */ -+ Elf32_Half e_shnum; /* Section header table entry count */ -+ Elf32_Half e_shstrndx; /* Section header string table index */ -+} Elf32_Ehdr; -+ -+typedef struct -+{ -+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ -+ Elf64_Half e_type; /* Object file type */ -+ Elf64_Half e_machine; /* Architecture */ -+ Elf64_Word e_version; /* Object file version */ -+ Elf64_Addr e_entry; /* Entry point virtual address */ -+ Elf64_Off e_phoff; /* Program header table file offset */ -+ Elf64_Off e_shoff; /* Section header table file offset */ -+ Elf64_Word e_flags; /* Processor-specific flags */ -+ Elf64_Half e_ehsize; /* ELF header size in bytes */ -+ Elf64_Half e_phentsize; /* Program header table entry size */ -+ Elf64_Half e_phnum; /* Program header table entry count */ -+ Elf64_Half e_shentsize; /* Section header table entry size */ -+ Elf64_Half e_shnum; /* Section header table entry count */ -+ Elf64_Half e_shstrndx; /* Section header string table index */ -+} Elf64_Ehdr; -+ -+/* Fields in the e_ident array. The EI_* macros are indices into the -+ array. The macros under each EI_* macro are the values the byte -+ may have. */ -+ -+#define EI_MAG0 0 /* File identification byte 0 index */ -+#define ELFMAG0 0x7f /* Magic number byte 0 */ -+ -+#define EI_MAG1 1 /* File identification byte 1 index */ -+#define ELFMAG1 'E' /* Magic number byte 1 */ -+ -+#define EI_MAG2 2 /* File identification byte 2 index */ -+#define ELFMAG2 'L' /* Magic number byte 2 */ -+ -+#define EI_MAG3 3 /* File identification byte 3 index */ -+#define ELFMAG3 'F' /* Magic number byte 3 */ -+ -+/* Conglomeration of the identification bytes, for easy testing as a word. */ -+#define ELFMAG "\177ELF" -+#define SELFMAG 4 -+ -+#define EI_CLASS 4 /* File class byte index */ -+#define ELFCLASSNONE 0 /* Invalid class */ -+#define ELFCLASS32 1 /* 32-bit objects */ -+#define ELFCLASS64 2 /* 64-bit objects */ -+#define ELFCLASSNUM 3 -+ -+#define EI_DATA 5 /* Data encoding byte index */ -+#define ELFDATANONE 0 /* Invalid data encoding */ -+#define ELFDATA2LSB 1 /* 2's complement, little endian */ -+#define ELFDATA2MSB 2 /* 2's complement, big endian */ -+#define ELFDATANUM 3 -+ -+#define EI_VERSION 6 /* File version byte index */ -+ /* Value must be EV_CURRENT */ -+ -+#define EI_OSABI 7 /* OS ABI identification */ -+#define ELFOSABI_NONE 0 /* UNIX System V ABI */ -+#define ELFOSABI_SYSV 0 /* Alias. */ -+#define ELFOSABI_HPUX 1 /* HP-UX */ -+#define ELFOSABI_NETBSD 2 /* NetBSD. */ -+#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ -+#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ -+#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ -+#define ELFOSABI_AIX 7 /* IBM AIX. */ -+#define ELFOSABI_IRIX 8 /* SGI Irix. */ -+#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ -+#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ -+#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ -+#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ -+#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ -+#define ELFOSABI_ARM 97 /* ARM */ -+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ -+ -+#define EI_ABIVERSION 8 /* ABI version */ -+ -+#define EI_PAD 9 /* Byte index of padding bytes */ -+ -+/* Legal values for e_type (object file type). */ -+ -+#define ET_NONE 0 /* No file type */ -+#define ET_REL 1 /* Relocatable file */ -+#define ET_EXEC 2 /* Executable file */ -+#define ET_DYN 3 /* Shared object file */ -+#define ET_CORE 4 /* Core file */ -+#define ET_NUM 5 /* Number of defined types */ -+#define ET_LOOS 0xfe00 /* OS-specific range start */ -+#define ET_HIOS 0xfeff /* OS-specific range end */ -+#define ET_LOPROC 0xff00 /* Processor-specific range start */ -+#define ET_HIPROC 0xffff /* Processor-specific range end */ -+ -+/* Legal values for e_machine (architecture). */ -+ -+#define EM_NONE 0 /* No machine */ -+#define EM_M32 1 /* AT&T WE 32100 */ -+#define EM_SPARC 2 /* SUN SPARC */ -+#define EM_386 3 /* Intel 80386 */ -+#define EM_68K 4 /* Motorola m68k family */ -+#define EM_88K 5 /* Motorola m88k family */ -+#define EM_860 7 /* Intel 80860 */ -+#define EM_MIPS 8 /* MIPS R3000 big-endian */ -+#define EM_S370 9 /* IBM System/370 */ -+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ -+ -+#define EM_PARISC 15 /* HPPA */ -+#define EM_VPP500 17 /* Fujitsu VPP500 */ -+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ -+#define EM_960 19 /* Intel 80960 */ -+#define EM_PPC 20 /* PowerPC */ -+#define EM_PPC64 21 /* PowerPC 64-bit */ -+#define EM_S390 22 /* IBM S390 */ -+ -+#define EM_V800 36 /* NEC V800 series */ -+#define EM_FR20 37 /* Fujitsu FR20 */ -+#define EM_RH32 38 /* TRW RH-32 */ -+#define EM_RCE 39 /* Motorola RCE */ -+#define EM_ARM 40 /* ARM */ -+#define EM_FAKE_ALPHA 41 /* Digital Alpha */ -+#define EM_SH 42 /* Hitachi SH */ -+#define EM_SPARCV9 43 /* SPARC v9 64-bit */ -+#define EM_TRICORE 44 /* Siemens Tricore */ -+#define EM_ARC 45 /* Argonaut RISC Core */ -+#define EM_H8_300 46 /* Hitachi H8/300 */ -+#define EM_H8_300H 47 /* Hitachi H8/300H */ -+#define EM_H8S 48 /* Hitachi H8S */ -+#define EM_H8_500 49 /* Hitachi H8/500 */ -+#define EM_IA_64 50 /* Intel Merced */ -+#define EM_MIPS_X 51 /* Stanford MIPS-X */ -+#define EM_COLDFIRE 52 /* Motorola Coldfire */ -+#define EM_68HC12 53 /* Motorola M68HC12 */ -+#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -+#define EM_PCP 55 /* Siemens PCP */ -+#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -+#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -+#define EM_STARCORE 58 /* Motorola Start*Core processor */ -+#define EM_ME16 59 /* Toyota ME16 processor */ -+#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -+#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -+#define EM_X86_64 62 /* AMD x86-64 architecture */ -+#define EM_PDSP 63 /* Sony DSP Processor */ -+ -+#define EM_FX66 66 /* Siemens FX66 microcontroller */ -+#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -+#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -+#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -+#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -+#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -+#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -+#define EM_SVX 73 /* Silicon Graphics SVx */ -+#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -+#define EM_VAX 75 /* Digital VAX */ -+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ -+#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */ -+#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -+#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -+#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ -+#define EM_HUANY 81 /* Harvard University machine-independent object files */ -+#define EM_PRISM 82 /* SiTera Prism */ -+#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -+#define EM_FR30 84 /* Fujitsu FR30 */ -+#define EM_D10V 85 /* Mitsubishi D10V */ -+#define EM_D30V 86 /* Mitsubishi D30V */ -+#define EM_V850 87 /* NEC v850 */ -+#define EM_M32R 88 /* Mitsubishi M32R */ -+#define EM_MN10300 89 /* Matsushita MN10300 */ -+#define EM_MN10200 90 /* Matsushita MN10200 */ -+#define EM_PJ 91 /* picoJava */ -+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ -+#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ -+#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ -+#define EM_TILEPRO 188 /* Tilera TILEPro */ -+#define EM_TILEGX 191 /* Tilera TILE-Gx */ -+#define EM_NUM 192 -+ -+/* If it is necessary to assign new unofficial EM_* values, please -+ pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the -+ chances of collision with official or non-GNU unofficial values. */ -+ -+#define EM_ALPHA 0x9026 -+ -+/* Legal values for e_version (version). */ -+ -+#define EV_NONE 0 /* Invalid ELF version */ -+#define EV_CURRENT 1 /* Current version */ -+#define EV_NUM 2 -+ -+/* Section header. */ -+ -+typedef struct -+{ -+ Elf32_Word sh_name; /* Section name (string tbl index) */ -+ Elf32_Word sh_type; /* Section type */ -+ Elf32_Word sh_flags; /* Section flags */ -+ Elf32_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf32_Off sh_offset; /* Section file offset */ -+ Elf32_Word sh_size; /* Section size in bytes */ -+ Elf32_Word sh_link; /* Link to another section */ -+ Elf32_Word sh_info; /* Additional section information */ -+ Elf32_Word sh_addralign; /* Section alignment */ -+ Elf32_Word sh_entsize; /* Entry size if section holds table */ -+} Elf32_Shdr; -+ -+typedef struct -+{ -+ Elf64_Word sh_name; /* Section name (string tbl index) */ -+ Elf64_Word sh_type; /* Section type */ -+ Elf64_Xword sh_flags; /* Section flags */ -+ Elf64_Addr sh_addr; /* Section virtual addr at execution */ -+ Elf64_Off sh_offset; /* Section file offset */ -+ Elf64_Xword sh_size; /* Section size in bytes */ -+ Elf64_Word sh_link; /* Link to another section */ -+ Elf64_Word sh_info; /* Additional section information */ -+ Elf64_Xword sh_addralign; /* Section alignment */ -+ Elf64_Xword sh_entsize; /* Entry size if section holds table */ -+} Elf64_Shdr; -+ -+/* Special section indices. */ -+ -+#define SHN_UNDEF 0 /* Undefined section */ -+#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ -+#define SHN_LOPROC 0xff00 /* Start of processor-specific */ -+#define SHN_BEFORE 0xff00 /* Order section before all others -+ (Solaris). */ -+#define SHN_AFTER 0xff01 /* Order section after all others -+ (Solaris). */ -+#define SHN_HIPROC 0xff1f /* End of processor-specific */ -+#define SHN_LOOS 0xff20 /* Start of OS-specific */ -+#define SHN_HIOS 0xff3f /* End of OS-specific */ -+#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ -+#define SHN_COMMON 0xfff2 /* Associated symbol is common */ -+#define SHN_XINDEX 0xffff /* Index is in extra table. */ -+#define SHN_HIRESERVE 0xffff /* End of reserved indices */ -+ -+/* Legal values for sh_type (section type). */ -+ -+#define SHT_NULL 0 /* Section header table entry unused */ -+#define SHT_PROGBITS 1 /* Program data */ -+#define SHT_SYMTAB 2 /* Symbol table */ -+#define SHT_STRTAB 3 /* String table */ -+#define SHT_RELA 4 /* Relocation entries with addends */ -+#define SHT_HASH 5 /* Symbol hash table */ -+#define SHT_DYNAMIC 6 /* Dynamic linking information */ -+#define SHT_NOTE 7 /* Notes */ -+#define SHT_NOBITS 8 /* Program space with no data (bss) */ -+#define SHT_REL 9 /* Relocation entries, no addends */ -+#define SHT_SHLIB 10 /* Reserved */ -+#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ -+#define SHT_INIT_ARRAY 14 /* Array of constructors */ -+#define SHT_FINI_ARRAY 15 /* Array of destructors */ -+#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -+#define SHT_GROUP 17 /* Section group */ -+#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -+#define SHT_NUM 19 /* Number of defined types. */ -+#define SHT_LOOS 0x60000000 /* Start OS-specific. */ -+#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ -+#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ -+#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ -+#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ -+#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ -+#define SHT_SUNW_move 0x6ffffffa -+#define SHT_SUNW_COMDAT 0x6ffffffb -+#define SHT_SUNW_syminfo 0x6ffffffc -+#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ -+#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ -+#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ -+#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ -+#define SHT_HIOS 0x6fffffff /* End OS-specific type */ -+#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define SHT_LOUSER 0x80000000 /* Start of application-specific */ -+#define SHT_HIUSER 0x8fffffff /* End of application-specific */ -+ -+/* Legal values for sh_flags (section flags). */ -+ -+#define SHF_WRITE (1 << 0) /* Writable */ -+#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */ -+#define SHF_EXECINSTR (1 << 2) /* Executable */ -+#define SHF_MERGE (1 << 4) /* Might be merged */ -+#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */ -+#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */ -+#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */ -+#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling -+ required */ -+#define SHF_GROUP (1 << 9) /* Section is member of a group. */ -+#define SHF_TLS (1 << 10) /* Section hold thread-local data. */ -+#define SHF_MASKOS 0x0ff00000 /* OS-specific. */ -+#define SHF_MASKPROC 0xf0000000 /* Processor-specific */ -+#define SHF_ORDERED (1 << 30) /* Special ordering requirement -+ (Solaris). */ -+#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless -+ referenced or allocated (Solaris).*/ -+ -+/* Section group handling. */ -+#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */ -+ -+/* Symbol table entry. */ -+ -+typedef struct -+{ -+ Elf32_Word st_name; /* Symbol name (string tbl index) */ -+ Elf32_Addr st_value; /* Symbol value */ -+ Elf32_Word st_size; /* Symbol size */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf32_Section st_shndx; /* Section index */ -+} Elf32_Sym; -+ -+typedef struct -+{ -+ Elf64_Word st_name; /* Symbol name (string tbl index) */ -+ unsigned char st_info; /* Symbol type and binding */ -+ unsigned char st_other; /* Symbol visibility */ -+ Elf64_Section st_shndx; /* Section index */ -+ Elf64_Addr st_value; /* Symbol value */ -+ Elf64_Xword st_size; /* Symbol size */ -+} Elf64_Sym; -+ -+/* The syminfo section if available contains additional information about -+ every dynamic symbol. */ -+ -+typedef struct -+{ -+ Elf32_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf32_Half si_flags; /* Per symbol flags */ -+} Elf32_Syminfo; -+ -+typedef struct -+{ -+ Elf64_Half si_boundto; /* Direct bindings, symbol bound to */ -+ Elf64_Half si_flags; /* Per symbol flags */ -+} Elf64_Syminfo; -+ -+/* Possible values for si_boundto. */ -+#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */ -+#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */ -+#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */ -+ -+/* Possible bitmasks for si_flags. */ -+#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ -+#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ -+#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ -+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy -+ loaded */ -+/* Syminfo version values. */ -+#define SYMINFO_NONE 0 -+#define SYMINFO_CURRENT 1 -+#define SYMINFO_NUM 2 -+ -+ -+/* How to extract and insert information held in the st_info field. */ -+ -+#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) -+#define ELF32_ST_TYPE(val) ((val) & 0xf) -+#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) -+ -+/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ -+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) -+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) -+#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) -+ -+/* Legal values for ST_BIND subfield of st_info (symbol binding). */ -+ -+#define STB_LOCAL 0 /* Local symbol */ -+#define STB_GLOBAL 1 /* Global symbol */ -+#define STB_WEAK 2 /* Weak symbol */ -+#define STB_NUM 3 /* Number of defined types. */ -+#define STB_LOOS 10 /* Start of OS-specific */ -+#define STB_GNU_UNIQUE 10 /* Unique symbol. */ -+#define STB_HIOS 12 /* End of OS-specific */ -+#define STB_LOPROC 13 /* Start of processor-specific */ -+#define STB_HIPROC 15 /* End of processor-specific */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_NOTYPE 0 /* Symbol type is unspecified */ -+#define STT_OBJECT 1 /* Symbol is a data object */ -+#define STT_FUNC 2 /* Symbol is a code object */ -+#define STT_SECTION 3 /* Symbol associated with a section */ -+#define STT_FILE 4 /* Symbol's name is file name */ -+#define STT_COMMON 5 /* Symbol is a common data object */ -+#define STT_TLS 6 /* Symbol is thread-local data object*/ -+#define STT_NUM 7 /* Number of defined types. */ -+#define STT_LOOS 10 /* Start of OS-specific */ -+#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ -+#define STT_HIOS 12 /* End of OS-specific */ -+#define STT_LOPROC 13 /* Start of processor-specific */ -+#define STT_HIPROC 15 /* End of processor-specific */ -+ -+ -+/* Symbol table indices are found in the hash buckets and chain table -+ of a symbol hash table section. This special index value indicates -+ the end of a chain, meaning no further symbols are found in that bucket. */ -+ -+#define STN_UNDEF 0 /* End of a chain. */ -+ -+ -+/* How to extract and insert information held in the st_other field. */ -+ -+#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) -+ -+/* For ELF64 the definitions are the same. */ -+#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) -+ -+/* Symbol visibility specification encoded in the st_other field. */ -+#define STV_DEFAULT 0 /* Default symbol visibility rules */ -+#define STV_INTERNAL 1 /* Processor specific hidden class */ -+#define STV_HIDDEN 2 /* Sym unavailable in other modules */ -+#define STV_PROTECTED 3 /* Not preemptible, not exported */ -+ -+ -+/* Relocation table entry without addend (in section of type SHT_REL). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+} Elf32_Rel; -+ -+/* I have seen two different definitions of the Elf64_Rel and -+ Elf64_Rela structures, so we'll leave them out until Novell (or -+ whoever) gets their act together. */ -+/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */ -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+} Elf64_Rel; -+ -+/* Relocation table entry with addend (in section of type SHT_RELA). */ -+ -+typedef struct -+{ -+ Elf32_Addr r_offset; /* Address */ -+ Elf32_Word r_info; /* Relocation type and symbol index */ -+ Elf32_Sword r_addend; /* Addend */ -+} Elf32_Rela; -+ -+typedef struct -+{ -+ Elf64_Addr r_offset; /* Address */ -+ Elf64_Xword r_info; /* Relocation type and symbol index */ -+ Elf64_Sxword r_addend; /* Addend */ -+} Elf64_Rela; -+ -+/* How to extract and insert information held in the r_info field. */ -+ -+#define ELF32_R_SYM(val) ((val) >> 8) -+#define ELF32_R_TYPE(val) ((val) & 0xff) -+#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) -+ -+#define ELF64_R_SYM(i) ((i) >> 32) -+#define ELF64_R_TYPE(i) ((i) & 0xffffffff) -+#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) -+ -+/* Program segment header. */ -+ -+typedef struct -+{ -+ Elf32_Word p_type; /* Segment type */ -+ Elf32_Off p_offset; /* Segment file offset */ -+ Elf32_Addr p_vaddr; /* Segment virtual address */ -+ Elf32_Addr p_paddr; /* Segment physical address */ -+ Elf32_Word p_filesz; /* Segment size in file */ -+ Elf32_Word p_memsz; /* Segment size in memory */ -+ Elf32_Word p_flags; /* Segment flags */ -+ Elf32_Word p_align; /* Segment alignment */ -+} Elf32_Phdr; -+ -+typedef struct -+{ -+ Elf64_Word p_type; /* Segment type */ -+ Elf64_Word p_flags; /* Segment flags */ -+ Elf64_Off p_offset; /* Segment file offset */ -+ Elf64_Addr p_vaddr; /* Segment virtual address */ -+ Elf64_Addr p_paddr; /* Segment physical address */ -+ Elf64_Xword p_filesz; /* Segment size in file */ -+ Elf64_Xword p_memsz; /* Segment size in memory */ -+ Elf64_Xword p_align; /* Segment alignment */ -+} Elf64_Phdr; -+ -+/* Special value for e_phnum. This indicates that the real number of -+ program headers is too large to fit into e_phnum. Instead the real -+ value is in the field sh_info of section 0. */ -+ -+#define PN_XNUM 0xffff -+ -+/* Legal values for p_type (segment type). */ -+ -+#define PT_NULL 0 /* Program header table entry unused */ -+#define PT_LOAD 1 /* Loadable program segment */ -+#define PT_DYNAMIC 2 /* Dynamic linking information */ -+#define PT_INTERP 3 /* Program interpreter */ -+#define PT_NOTE 4 /* Auxiliary information */ -+#define PT_SHLIB 5 /* Reserved */ -+#define PT_PHDR 6 /* Entry for header table itself */ -+#define PT_TLS 7 /* Thread-local storage segment */ -+#define PT_NUM 8 /* Number of defined types */ -+#define PT_LOOS 0x60000000 /* Start of OS-specific */ -+#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ -+#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ -+#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ -+#define PT_LOSUNW 0x6ffffffa -+#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ -+#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ -+#define PT_HISUNW 0x6fffffff -+#define PT_HIOS 0x6fffffff /* End of OS-specific */ -+#define PT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define PT_HIPROC 0x7fffffff /* End of processor-specific */ -+ -+/* Legal values for p_flags (segment flags). */ -+ -+#define PF_X (1 << 0) /* Segment is executable */ -+#define PF_W (1 << 1) /* Segment is writable */ -+#define PF_R (1 << 2) /* Segment is readable */ -+#define PF_MASKOS 0x0ff00000 /* OS-specific */ -+#define PF_MASKPROC 0xf0000000 /* Processor-specific */ -+ -+/* Legal values for note segment descriptor types for core files. */ -+ -+#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */ -+#define NT_FPREGSET 2 /* Contains copy of fpregset struct */ -+#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */ -+#define NT_PRXREG 4 /* Contains copy of prxregset struct */ -+#define NT_TASKSTRUCT 4 /* Contains copy of task structure */ -+#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */ -+#define NT_AUXV 6 /* Contains copy of auxv array */ -+#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */ -+#define NT_ASRS 8 /* Contains copy of asrset struct */ -+#define NT_PSTATUS 10 /* Contains copy of pstatus struct */ -+#define NT_PSINFO 13 /* Contains copy of psinfo struct */ -+#define NT_PRCRED 14 /* Contains copy of prcred struct */ -+#define NT_UTSNAME 15 /* Contains copy of utsname struct */ -+#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */ -+#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */ -+#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */ -+#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ -+#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ -+#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ -+#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ -+#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ -+#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ -+#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ -+ -+/* Legal values for the note segment descriptor types for object files. */ -+ -+#define NT_VERSION 1 /* Contains a version string. */ -+ -+ -+/* Dynamic section entry. */ -+ -+typedef struct -+{ -+ Elf32_Sword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf32_Word d_val; /* Integer value */ -+ Elf32_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf32_Dyn; -+ -+typedef struct -+{ -+ Elf64_Sxword d_tag; /* Dynamic entry type */ -+ union -+ { -+ Elf64_Xword d_val; /* Integer value */ -+ Elf64_Addr d_ptr; /* Address value */ -+ } d_un; -+} Elf64_Dyn; -+ -+/* Legal values for d_tag (dynamic entry type). */ -+ -+#define DT_NULL 0 /* Marks end of dynamic section */ -+#define DT_NEEDED 1 /* Name of needed library */ -+#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */ -+#define DT_PLTGOT 3 /* Processor defined value */ -+#define DT_HASH 4 /* Address of symbol hash table */ -+#define DT_STRTAB 5 /* Address of string table */ -+#define DT_SYMTAB 6 /* Address of symbol table */ -+#define DT_RELA 7 /* Address of Rela relocs */ -+#define DT_RELASZ 8 /* Total size of Rela relocs */ -+#define DT_RELAENT 9 /* Size of one Rela reloc */ -+#define DT_STRSZ 10 /* Size of string table */ -+#define DT_SYMENT 11 /* Size of one symbol table entry */ -+#define DT_INIT 12 /* Address of init function */ -+#define DT_FINI 13 /* Address of termination function */ -+#define DT_SONAME 14 /* Name of shared object */ -+#define DT_RPATH 15 /* Library search path (deprecated) */ -+#define DT_SYMBOLIC 16 /* Start symbol search here */ -+#define DT_REL 17 /* Address of Rel relocs */ -+#define DT_RELSZ 18 /* Total size of Rel relocs */ -+#define DT_RELENT 19 /* Size of one Rel reloc */ -+#define DT_PLTREL 20 /* Type of reloc in PLT */ -+#define DT_DEBUG 21 /* For debugging; unspecified */ -+#define DT_TEXTREL 22 /* Reloc might modify .text */ -+#define DT_JMPREL 23 /* Address of PLT relocs */ -+#define DT_BIND_NOW 24 /* Process relocations of object */ -+#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -+#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -+#define DT_RUNPATH 29 /* Library search path */ -+#define DT_FLAGS 30 /* Flags for the object being loaded */ -+#define DT_ENCODING 32 /* Start of encoded range */ -+#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -+#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -+#define DT_NUM 34 /* Number used */ -+#define DT_LOOS 0x6000000d /* Start of OS-specific */ -+#define DT_HIOS 0x6ffff000 /* End of OS-specific */ -+#define DT_LOPROC 0x70000000 /* Start of processor-specific */ -+#define DT_HIPROC 0x7fffffff /* End of processor-specific */ -+#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */ -+ -+/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the -+ Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's -+ approach. */ -+#define DT_VALRNGLO 0x6ffffd00 -+#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ -+#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ -+#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ -+#define DT_CHECKSUM 0x6ffffdf8 -+#define DT_PLTPADSZ 0x6ffffdf9 -+#define DT_MOVEENT 0x6ffffdfa -+#define DT_MOVESZ 0x6ffffdfb -+#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */ -+#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting -+ the following DT_* entry. */ -+#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ -+#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ -+#define DT_VALRNGHI 0x6ffffdff -+#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ -+#define DT_VALNUM 12 -+ -+/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the -+ Dyn.d_un.d_ptr field of the Elf*_Dyn structure. -+ -+ If any adjustment is made to the ELF object after it has been -+ built these entries will need to be adjusted. */ -+#define DT_ADDRRNGLO 0x6ffffe00 -+#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ -+#define DT_TLSDESC_PLT 0x6ffffef6 -+#define DT_TLSDESC_GOT 0x6ffffef7 -+#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ -+#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ -+#define DT_CONFIG 0x6ffffefa /* Configuration information. */ -+#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */ -+#define DT_AUDIT 0x6ffffefc /* Object auditing. */ -+#define DT_PLTPAD 0x6ffffefd /* PLT padding. */ -+#define DT_MOVETAB 0x6ffffefe /* Move table. */ -+#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */ -+#define DT_ADDRRNGHI 0x6ffffeff -+#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ -+#define DT_ADDRNUM 11 -+ -+/* The versioning entry types. The next are defined as part of the -+ GNU extension. */ -+#define DT_VERSYM 0x6ffffff0 -+ -+#define DT_RELACOUNT 0x6ffffff9 -+#define DT_RELCOUNT 0x6ffffffa -+ -+/* These were chosen by Sun. */ -+#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */ -+#define DT_VERDEF 0x6ffffffc /* Address of version definition -+ table */ -+#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */ -+#define DT_VERNEED 0x6ffffffe /* Address of table with needed -+ versions */ -+#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */ -+#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */ -+#define DT_VERSIONTAGNUM 16 -+ -+/* Sun added these machine-independent extensions in the "processor-specific" -+ range. Be compatible. */ -+#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */ -+#define DT_FILTER 0x7fffffff /* Shared object to get values from */ -+#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) -+#define DT_EXTRANUM 3 -+ -+/* Values of `d_un.d_val' in the DT_FLAGS entry. */ -+#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */ -+#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */ -+#define DF_TEXTREL 0x00000004 /* Object contains text relocations */ -+#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */ -+#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */ -+ -+/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 -+ entry in the dynamic section. */ -+#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */ -+#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */ -+#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */ -+#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/ -+#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/ -+#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/ -+#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */ -+#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */ -+#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */ -+#define DF_1_TRANS 0x00000200 -+#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */ -+#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */ -+#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */ -+#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/ -+#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */ -+#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */ -+#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */ -+ -+/* Flags for the feature selection in DT_FEATURE_1. */ -+#define DTF_1_PARINIT 0x00000001 -+#define DTF_1_CONFEXP 0x00000002 -+ -+/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */ -+#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */ -+#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not -+ generally available. */ -+ -+/* Version definition sections. */ -+ -+typedef struct -+{ -+ Elf32_Half vd_version; /* Version revision */ -+ Elf32_Half vd_flags; /* Version information */ -+ Elf32_Half vd_ndx; /* Version Index */ -+ Elf32_Half vd_cnt; /* Number of associated aux entries */ -+ Elf32_Word vd_hash; /* Version name hash value */ -+ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf32_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf32_Verdef; -+ -+typedef struct -+{ -+ Elf64_Half vd_version; /* Version revision */ -+ Elf64_Half vd_flags; /* Version information */ -+ Elf64_Half vd_ndx; /* Version Index */ -+ Elf64_Half vd_cnt; /* Number of associated aux entries */ -+ Elf64_Word vd_hash; /* Version name hash value */ -+ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */ -+ Elf64_Word vd_next; /* Offset in bytes to next verdef -+ entry */ -+} Elf64_Verdef; -+ -+ -+/* Legal values for vd_version (version revision). */ -+#define VER_DEF_NONE 0 /* No version */ -+#define VER_DEF_CURRENT 1 /* Current version */ -+#define VER_DEF_NUM 2 /* Given version number */ -+ -+/* Legal values for vd_flags (version information flags). */ -+#define VER_FLG_BASE 0x1 /* Version definition of file itself */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+/* Versym symbol index values. */ -+#define VER_NDX_LOCAL 0 /* Symbol is local. */ -+#define VER_NDX_GLOBAL 1 /* Symbol is global. */ -+#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */ -+#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */ -+ -+/* Auxialiary version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vda_name; /* Version or dependency names */ -+ Elf32_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf32_Verdaux; -+ -+typedef struct -+{ -+ Elf64_Word vda_name; /* Version or dependency names */ -+ Elf64_Word vda_next; /* Offset in bytes to next verdaux -+ entry */ -+} Elf64_Verdaux; -+ -+ -+/* Version dependency section. */ -+ -+typedef struct -+{ -+ Elf32_Half vn_version; /* Version of structure */ -+ Elf32_Half vn_cnt; /* Number of associated aux entries */ -+ Elf32_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf32_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf32_Verneed; -+ -+typedef struct -+{ -+ Elf64_Half vn_version; /* Version of structure */ -+ Elf64_Half vn_cnt; /* Number of associated aux entries */ -+ Elf64_Word vn_file; /* Offset of filename for this -+ dependency */ -+ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */ -+ Elf64_Word vn_next; /* Offset in bytes to next verneed -+ entry */ -+} Elf64_Verneed; -+ -+ -+/* Legal values for vn_version (version revision). */ -+#define VER_NEED_NONE 0 /* No version */ -+#define VER_NEED_CURRENT 1 /* Current version */ -+#define VER_NEED_NUM 2 /* Given version number */ -+ -+/* Auxiliary needed version information. */ -+ -+typedef struct -+{ -+ Elf32_Word vna_hash; /* Hash value of dependency name */ -+ Elf32_Half vna_flags; /* Dependency specific information */ -+ Elf32_Half vna_other; /* Unused */ -+ Elf32_Word vna_name; /* Dependency name string offset */ -+ Elf32_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf32_Vernaux; -+ -+typedef struct -+{ -+ Elf64_Word vna_hash; /* Hash value of dependency name */ -+ Elf64_Half vna_flags; /* Dependency specific information */ -+ Elf64_Half vna_other; /* Unused */ -+ Elf64_Word vna_name; /* Dependency name string offset */ -+ Elf64_Word vna_next; /* Offset in bytes to next vernaux -+ entry */ -+} Elf64_Vernaux; -+ -+ -+/* Legal values for vna_flags. */ -+#define VER_FLG_WEAK 0x2 /* Weak version identifier */ -+ -+ -+/* Auxiliary vector. */ -+ -+/* This vector is normally only used by the program interpreter. The -+ usual definition in an ABI supplement uses the name auxv_t. The -+ vector is not usually defined in a standard file, but it -+ can't hurt. We rename it to avoid conflicts. The sizes of these -+ types are an arrangement between the exec server and the program -+ interpreter, so we don't fully specify them here. */ -+ -+typedef struct -+{ -+ uint32_t a_type; /* Entry type */ -+ union -+ { -+ uint32_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf32_auxv_t; -+ -+typedef struct -+{ -+ uint64_t a_type; /* Entry type */ -+ union -+ { -+ uint64_t a_val; /* Integer value */ -+ /* We use to have pointer elements added here. We cannot do that, -+ though, since it does not work when using 32-bit definitions -+ on 64-bit platforms and vice versa. */ -+ } a_un; -+} Elf64_auxv_t; -+ -+/* Legal values for a_type (entry type). */ -+ -+#define AT_NULL 0 /* End of vector */ -+#define AT_IGNORE 1 /* Entry should be ignored */ -+#define AT_EXECFD 2 /* File descriptor of program */ -+#define AT_PHDR 3 /* Program headers for program */ -+#define AT_PHENT 4 /* Size of program header entry */ -+#define AT_PHNUM 5 /* Number of program headers */ -+#define AT_PAGESZ 6 /* System page size */ -+#define AT_BASE 7 /* Base address of interpreter */ -+#define AT_FLAGS 8 /* Flags */ -+#define AT_ENTRY 9 /* Entry point of program */ -+#define AT_NOTELF 10 /* Program is not ELF */ -+#define AT_UID 11 /* Real uid */ -+#define AT_EUID 12 /* Effective uid */ -+#define AT_GID 13 /* Real gid */ -+#define AT_EGID 14 /* Effective gid */ -+#define AT_CLKTCK 17 /* Frequency of times() */ -+ -+/* Some more special a_type values describing the hardware. */ -+#define AT_PLATFORM 15 /* String identifying platform. */ -+#define AT_HWCAP 16 /* Machine dependent hints about -+ processor capabilities. */ -+ -+/* This entry gives some information about the FPU initialization -+ performed by the kernel. */ -+#define AT_FPUCW 18 /* Used FPU control word. */ -+ -+/* Cache block sizes. */ -+#define AT_DCACHEBSIZE 19 /* Data cache block size. */ -+#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */ -+#define AT_UCACHEBSIZE 21 /* Unified cache block size. */ -+ -+/* A special ignored value for PPC, used by the kernel to control the -+ interpretation of the AUXV. Must be > 16. */ -+#define AT_IGNOREPPC 22 /* Entry should be ignored. */ -+ -+#define AT_SECURE 23 /* Boolean, was exec setuid-like? */ -+ -+#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ -+ -+#define AT_RANDOM 25 /* Address of 16 random bytes. */ -+ -+#define AT_EXECFN 31 /* Filename of executable. */ -+ -+/* Pointer to the global system page used for system calls and other -+ nice things. */ -+#define AT_SYSINFO 32 -+#define AT_SYSINFO_EHDR 33 -+ -+/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains -+ log2 of line size; mask those to get cache size. */ -+#define AT_L1I_CACHESHAPE 34 -+#define AT_L1D_CACHESHAPE 35 -+#define AT_L2_CACHESHAPE 36 -+#define AT_L3_CACHESHAPE 37 -+ -+/* Note section contents. Each entry in the note section begins with -+ a header of a fixed form. */ -+ -+typedef struct -+{ -+ Elf32_Word n_namesz; /* Length of the note's name. */ -+ Elf32_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf32_Word n_type; /* Type of the note. */ -+} Elf32_Nhdr; -+ -+typedef struct -+{ -+ Elf64_Word n_namesz; /* Length of the note's name. */ -+ Elf64_Word n_descsz; /* Length of the note's descriptor. */ -+ Elf64_Word n_type; /* Type of the note. */ -+} Elf64_Nhdr; -+ -+/* Known names of notes. */ -+ -+/* Solaris entries in the note section have this name. */ -+#define ELF_NOTE_SOLARIS "SUNW Solaris" -+ -+/* Note entries for GNU systems have this name. */ -+#define ELF_NOTE_GNU "GNU" -+ -+ -+/* Defined types of notes for Solaris. */ -+ -+/* Value of descriptor (one word) is desired pagesize for the binary. */ -+#define ELF_NOTE_PAGESIZE_HINT 1 -+ -+ -+/* Defined note types for GNU systems. */ -+ -+/* ABI information. The descriptor consists of words: -+ word 0: OS descriptor -+ word 1: major version of the ABI -+ word 2: minor version of the ABI -+ word 3: subminor version of the ABI -+*/ -+#define NT_GNU_ABI_TAG 1 -+#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */ -+ -+/* Known OSes. These values can appear in word 0 of an -+ NT_GNU_ABI_TAG note section entry. */ -+#define ELF_NOTE_OS_LINUX 0 -+#define ELF_NOTE_OS_GNU 1 -+#define ELF_NOTE_OS_SOLARIS2 2 -+#define ELF_NOTE_OS_FREEBSD 3 -+ -+/* Synthetic hwcap information. The descriptor begins with two words: -+ word 0: number of entries -+ word 1: bitmask of enabled entries -+ Then follow variable-length entries, one byte followed by a -+ '\0'-terminated hwcap name string. The byte gives the bit -+ number to test if enabled, (1U << bit) & bitmask. */ -+#define NT_GNU_HWCAP 2 -+ -+/* Build ID bits as generated by ld --build-id. -+ The descriptor consists of any nonzero number of bytes. */ -+#define NT_GNU_BUILD_ID 3 -+ -+/* Version note generated by GNU gold containing a version string. */ -+#define NT_GNU_GOLD_VERSION 4 -+ -+ -+/* Move records. */ -+typedef struct -+{ -+ Elf32_Xword m_value; /* Symbol value. */ -+ Elf32_Word m_info; /* Size and index. */ -+ Elf32_Word m_poffset; /* Symbol offset. */ -+ Elf32_Half m_repeat; /* Repeat count. */ -+ Elf32_Half m_stride; /* Stride info. */ -+} Elf32_Move; -+ -+typedef struct -+{ -+ Elf64_Xword m_value; /* Symbol value. */ -+ Elf64_Xword m_info; /* Size and index. */ -+ Elf64_Xword m_poffset; /* Symbol offset. */ -+ Elf64_Half m_repeat; /* Repeat count. */ -+ Elf64_Half m_stride; /* Stride info. */ -+} Elf64_Move; -+ -+/* Macro to construct move records. */ -+#define ELF32_M_SYM(info) ((info) >> 8) -+#define ELF32_M_SIZE(info) ((unsigned char) (info)) -+#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) -+ -+#define ELF64_M_SYM(info) ELF32_M_SYM (info) -+#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) -+#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) -+ -+ -+/* Motorola 68k specific definitions. */ -+ -+/* Values for Elf32_Ehdr.e_flags. */ -+#define EF_CPU32 0x00810000 -+ -+/* m68k relocs. */ -+ -+#define R_68K_NONE 0 /* No reloc */ -+#define R_68K_32 1 /* Direct 32 bit */ -+#define R_68K_16 2 /* Direct 16 bit */ -+#define R_68K_8 3 /* Direct 8 bit */ -+#define R_68K_PC32 4 /* PC relative 32 bit */ -+#define R_68K_PC16 5 /* PC relative 16 bit */ -+#define R_68K_PC8 6 /* PC relative 8 bit */ -+#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */ -+#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */ -+#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */ -+#define R_68K_GOT32O 10 /* 32 bit GOT offset */ -+#define R_68K_GOT16O 11 /* 16 bit GOT offset */ -+#define R_68K_GOT8O 12 /* 8 bit GOT offset */ -+#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */ -+#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */ -+#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */ -+#define R_68K_PLT32O 16 /* 32 bit PLT offset */ -+#define R_68K_PLT16O 17 /* 16 bit PLT offset */ -+#define R_68K_PLT8O 18 /* 8 bit PLT offset */ -+#define R_68K_COPY 19 /* Copy symbol at runtime */ -+#define R_68K_GLOB_DAT 20 /* Create GOT entry */ -+#define R_68K_JMP_SLOT 21 /* Create PLT entry */ -+#define R_68K_RELATIVE 22 /* Adjust by program base */ -+#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */ -+#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */ -+#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */ -+#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */ -+#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */ -+#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */ -+#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */ -+#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */ -+#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */ -+#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */ -+#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */ -+#define R_68K_TLS_LE32 37 /* 32 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE16 38 /* 16 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_LE8 39 /* 8 bit offset relative to -+ static TLS block */ -+#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */ -+#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */ -+#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */ -+/* Keep this the last entry. */ -+#define R_68K_NUM 43 -+ -+/* Intel 80386 specific definitions. */ -+ -+/* i386 relocs. */ -+ -+#define R_386_NONE 0 /* No reloc */ -+#define R_386_32 1 /* Direct 32 bit */ -+#define R_386_PC32 2 /* PC relative 32 bit */ -+#define R_386_GOT32 3 /* 32 bit GOT entry */ -+#define R_386_PLT32 4 /* 32 bit PLT address */ -+#define R_386_COPY 5 /* Copy symbol at runtime */ -+#define R_386_GLOB_DAT 6 /* Create GOT entry */ -+#define R_386_JMP_SLOT 7 /* Create PLT entry */ -+#define R_386_RELATIVE 8 /* Adjust by program base */ -+#define R_386_GOTOFF 9 /* 32 bit offset to GOT */ -+#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */ -+#define R_386_32PLT 11 -+#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */ -+#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS -+ block offset */ -+#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block -+ offset */ -+#define R_386_TLS_LE 17 /* Offset relative to static TLS -+ block */ -+#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of -+ general dynamic thread local data */ -+#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of -+ local dynamic thread local data -+ in LE code */ -+#define R_386_16 20 -+#define R_386_PC16 21 -+#define R_386_8 22 -+#define R_386_PC8 23 -+#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic -+ thread local data */ -+#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */ -+#define R_386_TLS_GD_CALL 26 /* Relocation for call to -+ __tls_get_addr() */ -+#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */ -+#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic -+ thread local data in LE code */ -+#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */ -+#define R_386_TLS_LDM_CALL 30 /* Relocation for call to -+ __tls_get_addr() in LDM code */ -+#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */ -+#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */ -+#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS -+ block offset */ -+#define R_386_TLS_LE_32 34 /* Negated offset relative to static -+ TLS block */ -+#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */ -+#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */ -+#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */ -+/* 38? */ -+#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */ -+#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS -+ descriptor for -+ relaxation. */ -+#define R_386_TLS_DESC 41 /* TLS descriptor containing -+ pointer to code and to -+ argument, returning the TLS -+ offset for the symbol. */ -+#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */ -+/* Keep this the last entry. */ -+#define R_386_NUM 43 -+ -+/* SUN SPARC specific definitions. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ -+ -+/* Values for Elf64_Ehdr.e_flags. */ -+ -+#define EF_SPARCV9_MM 3 -+#define EF_SPARCV9_TSO 0 -+#define EF_SPARCV9_PSO 1 -+#define EF_SPARCV9_RMO 2 -+#define EF_SPARC_LEDATA 0x800000 /* little endian data */ -+#define EF_SPARC_EXT_MASK 0xFFFF00 -+#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ -+#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ -+#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ -+#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ -+ -+/* SPARC relocs. */ -+ -+#define R_SPARC_NONE 0 /* No reloc */ -+#define R_SPARC_8 1 /* Direct 8 bit */ -+#define R_SPARC_16 2 /* Direct 16 bit */ -+#define R_SPARC_32 3 /* Direct 32 bit */ -+#define R_SPARC_DISP8 4 /* PC relative 8 bit */ -+#define R_SPARC_DISP16 5 /* PC relative 16 bit */ -+#define R_SPARC_DISP32 6 /* PC relative 32 bit */ -+#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */ -+#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */ -+#define R_SPARC_HI22 9 /* High 22 bit */ -+#define R_SPARC_22 10 /* Direct 22 bit */ -+#define R_SPARC_13 11 /* Direct 13 bit */ -+#define R_SPARC_LO10 12 /* Truncated 10 bit */ -+#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */ -+#define R_SPARC_GOT13 14 /* 13 bit GOT entry */ -+#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */ -+#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */ -+#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */ -+#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */ -+#define R_SPARC_COPY 19 /* Copy symbol at runtime */ -+#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */ -+#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */ -+#define R_SPARC_RELATIVE 22 /* Adjust by program base */ -+#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */ -+ -+/* Additional Sparc64 relocs. */ -+ -+#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */ -+#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */ -+#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */ -+#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */ -+#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */ -+#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */ -+#define R_SPARC_10 30 /* Direct 10 bit */ -+#define R_SPARC_11 31 /* Direct 11 bit */ -+#define R_SPARC_64 32 /* Direct 64 bit */ -+#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */ -+#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */ -+#define R_SPARC_HM10 35 /* High middle 10 bits of ... */ -+#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */ -+#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */ -+#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */ -+#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ -+#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ -+#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ -+#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ -+#define R_SPARC_7 43 /* Direct 7 bit */ -+#define R_SPARC_5 44 /* Direct 5 bit */ -+#define R_SPARC_6 45 /* Direct 6 bit */ -+#define R_SPARC_DISP64 46 /* PC relative 64 bit */ -+#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */ -+#define R_SPARC_HIX22 48 /* High 22 bit complemented */ -+#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */ -+#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */ -+#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */ -+#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */ -+#define R_SPARC_REGISTER 53 /* Global register usage */ -+#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */ -+#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */ -+#define R_SPARC_TLS_GD_HI22 56 -+#define R_SPARC_TLS_GD_LO10 57 -+#define R_SPARC_TLS_GD_ADD 58 -+#define R_SPARC_TLS_GD_CALL 59 -+#define R_SPARC_TLS_LDM_HI22 60 -+#define R_SPARC_TLS_LDM_LO10 61 -+#define R_SPARC_TLS_LDM_ADD 62 -+#define R_SPARC_TLS_LDM_CALL 63 -+#define R_SPARC_TLS_LDO_HIX22 64 -+#define R_SPARC_TLS_LDO_LOX10 65 -+#define R_SPARC_TLS_LDO_ADD 66 -+#define R_SPARC_TLS_IE_HI22 67 -+#define R_SPARC_TLS_IE_LO10 68 -+#define R_SPARC_TLS_IE_LD 69 -+#define R_SPARC_TLS_IE_LDX 70 -+#define R_SPARC_TLS_IE_ADD 71 -+#define R_SPARC_TLS_LE_HIX22 72 -+#define R_SPARC_TLS_LE_LOX10 73 -+#define R_SPARC_TLS_DTPMOD32 74 -+#define R_SPARC_TLS_DTPMOD64 75 -+#define R_SPARC_TLS_DTPOFF32 76 -+#define R_SPARC_TLS_DTPOFF64 77 -+#define R_SPARC_TLS_TPOFF32 78 -+#define R_SPARC_TLS_TPOFF64 79 -+#define R_SPARC_GOTDATA_HIX22 80 -+#define R_SPARC_GOTDATA_LOX10 81 -+#define R_SPARC_GOTDATA_OP_HIX22 82 -+#define R_SPARC_GOTDATA_OP_LOX10 83 -+#define R_SPARC_GOTDATA_OP 84 -+#define R_SPARC_H34 85 -+#define R_SPARC_SIZE32 86 -+#define R_SPARC_SIZE64 87 -+#define R_SPARC_WDISP10 88 -+#define R_SPARC_JMP_IREL 248 -+#define R_SPARC_IRELATIVE 249 -+#define R_SPARC_GNU_VTINHERIT 250 -+#define R_SPARC_GNU_VTENTRY 251 -+#define R_SPARC_REV32 252 -+/* Keep this the last entry. */ -+#define R_SPARC_NUM 253 -+ -+/* For Sparc64, legal values for d_tag of Elf64_Dyn. */ -+ -+#define DT_SPARC_REGISTER 0x70000001 -+#define DT_SPARC_NUM 2 -+ -+/* MIPS R3000 specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */ -+#define EF_MIPS_PIC 2 /* Contains PIC code */ -+#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */ -+#define EF_MIPS_XGOT 8 -+#define EF_MIPS_64BIT_WHIRL 16 -+#define EF_MIPS_ABI2 32 -+#define EF_MIPS_ABI_ON32 64 -+#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */ -+ -+/* Legal values for MIPS architecture level. */ -+ -+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define EF_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define EF_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* The following are non-official names and should not be used. */ -+ -+#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ -+#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ -+#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ -+#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ -+#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ -+#define E_MIPS_ARCH_32 0x60000000 /* MIPS32 code. */ -+#define E_MIPS_ARCH_64 0x70000000 /* MIPS64 code. */ -+ -+/* Special section indices. */ -+ -+#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */ -+#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ -+#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ -+#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */ -+#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */ -+#define SHT_MIPS_MSYM 0x70000001 -+#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */ -+#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */ -+#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ -+#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/ -+#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */ -+#define SHT_MIPS_PACKAGE 0x70000007 -+#define SHT_MIPS_PACKSYM 0x70000008 -+#define SHT_MIPS_RELD 0x70000009 -+#define SHT_MIPS_IFACE 0x7000000b -+#define SHT_MIPS_CONTENT 0x7000000c -+#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ -+#define SHT_MIPS_SHDR 0x70000010 -+#define SHT_MIPS_FDESC 0x70000011 -+#define SHT_MIPS_EXTSYM 0x70000012 -+#define SHT_MIPS_DENSE 0x70000013 -+#define SHT_MIPS_PDESC 0x70000014 -+#define SHT_MIPS_LOCSYM 0x70000015 -+#define SHT_MIPS_AUXSYM 0x70000016 -+#define SHT_MIPS_OPTSYM 0x70000017 -+#define SHT_MIPS_LOCSTR 0x70000018 -+#define SHT_MIPS_LINE 0x70000019 -+#define SHT_MIPS_RFDESC 0x7000001a -+#define SHT_MIPS_DELTASYM 0x7000001b -+#define SHT_MIPS_DELTAINST 0x7000001c -+#define SHT_MIPS_DELTACLASS 0x7000001d -+#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ -+#define SHT_MIPS_DELTADECL 0x7000001f -+#define SHT_MIPS_SYMBOL_LIB 0x70000020 -+#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ -+#define SHT_MIPS_TRANSLATE 0x70000022 -+#define SHT_MIPS_PIXIE 0x70000023 -+#define SHT_MIPS_XLATE 0x70000024 -+#define SHT_MIPS_XLATE_DEBUG 0x70000025 -+#define SHT_MIPS_WHIRL 0x70000026 -+#define SHT_MIPS_EH_REGION 0x70000027 -+#define SHT_MIPS_XLATE_OLD 0x70000028 -+#define SHT_MIPS_PDR_EXCEPTION 0x70000029 -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */ -+#define SHF_MIPS_MERGE 0x20000000 -+#define SHF_MIPS_ADDR 0x40000000 -+#define SHF_MIPS_STRINGS 0x80000000 -+#define SHF_MIPS_NOSTRIP 0x08000000 -+#define SHF_MIPS_LOCAL 0x04000000 -+#define SHF_MIPS_NAMES 0x02000000 -+#define SHF_MIPS_NODUPE 0x01000000 -+ -+ -+/* Symbol tables. */ -+ -+/* MIPS specific values for `st_other'. */ -+#define STO_MIPS_DEFAULT 0x0 -+#define STO_MIPS_INTERNAL 0x1 -+#define STO_MIPS_HIDDEN 0x2 -+#define STO_MIPS_PROTECTED 0x3 -+#define STO_MIPS_PLT 0x8 -+#define STO_MIPS_SC_ALIGN_UNUSED 0xff -+ -+/* MIPS specific values for `st_info'. */ -+#define STB_MIPS_SPLIT_COMMON 13 -+ -+/* Entries found in sections of type SHT_MIPS_GPTAB. */ -+ -+typedef union -+{ -+ struct -+ { -+ Elf32_Word gt_current_g_value; /* -G value used for compilation */ -+ Elf32_Word gt_unused; /* Not used */ -+ } gt_header; /* First entry in section */ -+ struct -+ { -+ Elf32_Word gt_g_value; /* If this value were used for -G */ -+ Elf32_Word gt_bytes; /* This many bytes would be used */ -+ } gt_entry; /* Subsequent entries in section */ -+} Elf32_gptab; -+ -+/* Entry found in sections of type SHT_MIPS_REGINFO. */ -+ -+typedef struct -+{ -+ Elf32_Word ri_gprmask; /* General registers used */ -+ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ -+ Elf32_Sword ri_gp_value; /* $gp register value */ -+} Elf32_RegInfo; -+ -+/* Entries found in sections of type SHT_MIPS_OPTIONS. */ -+ -+typedef struct -+{ -+ unsigned char kind; /* Determines interpretation of the -+ variable part of descriptor. */ -+ unsigned char size; /* Size of descriptor, including header. */ -+ Elf32_Section section; /* Section header index of section affected, -+ 0 for global options. */ -+ Elf32_Word info; /* Kind-specific information. */ -+} Elf_Options; -+ -+/* Values for `kind' field in Elf_Options. */ -+ -+#define ODK_NULL 0 /* Undefined. */ -+#define ODK_REGINFO 1 /* Register usage information. */ -+#define ODK_EXCEPTIONS 2 /* Exception processing options. */ -+#define ODK_PAD 3 /* Section padding options. */ -+#define ODK_HWPATCH 4 /* Hardware workarounds performed */ -+#define ODK_FILL 5 /* record the fill value used by the linker. */ -+#define ODK_TAGS 6 /* reserve space for desktop tools to write. */ -+#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */ -+#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */ -+ -+/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */ -+ -+#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */ -+#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */ -+#define OEX_PAGE0 0x10000 /* page zero must be mapped. */ -+#define OEX_SMM 0x20000 /* Force sequential memory mode? */ -+#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */ -+#define OEX_PRECISEFP OEX_FPDBUG -+#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */ -+ -+#define OEX_FPU_INVAL 0x10 -+#define OEX_FPU_DIV0 0x08 -+#define OEX_FPU_OFLO 0x04 -+#define OEX_FPU_UFLO 0x02 -+#define OEX_FPU_INEX 0x01 -+ -+/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */ -+ -+#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */ -+#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */ -+#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */ -+#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */ -+ -+#define OPAD_PREFIX 0x1 -+#define OPAD_POSTFIX 0x2 -+#define OPAD_SYMBOL 0x4 -+ -+/* Entry found in `.options' section. */ -+ -+typedef struct -+{ -+ Elf32_Word hwp_flags1; /* Extra flags. */ -+ Elf32_Word hwp_flags2; /* Extra flags. */ -+} Elf_Options_Hw; -+ -+/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */ -+ -+#define OHWA0_R4KEOP_CHECKED 0x00000001 -+#define OHWA1_R4KEOP_CLEAN 0x00000002 -+ -+/* MIPS relocs. */ -+ -+#define R_MIPS_NONE 0 /* No reloc */ -+#define R_MIPS_16 1 /* Direct 16 bit */ -+#define R_MIPS_32 2 /* Direct 32 bit */ -+#define R_MIPS_REL32 3 /* PC relative 32 bit */ -+#define R_MIPS_26 4 /* Direct 26 bit shifted */ -+#define R_MIPS_HI16 5 /* High 16 bit */ -+#define R_MIPS_LO16 6 /* Low 16 bit */ -+#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ -+#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ -+#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ -+#define R_MIPS_PC16 10 /* PC relative 16 bit */ -+#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ -+#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ -+ -+#define R_MIPS_SHIFT5 16 -+#define R_MIPS_SHIFT6 17 -+#define R_MIPS_64 18 -+#define R_MIPS_GOT_DISP 19 -+#define R_MIPS_GOT_PAGE 20 -+#define R_MIPS_GOT_OFST 21 -+#define R_MIPS_GOT_HI16 22 -+#define R_MIPS_GOT_LO16 23 -+#define R_MIPS_SUB 24 -+#define R_MIPS_INSERT_A 25 -+#define R_MIPS_INSERT_B 26 -+#define R_MIPS_DELETE 27 -+#define R_MIPS_HIGHER 28 -+#define R_MIPS_HIGHEST 29 -+#define R_MIPS_CALL_HI16 30 -+#define R_MIPS_CALL_LO16 31 -+#define R_MIPS_SCN_DISP 32 -+#define R_MIPS_REL16 33 -+#define R_MIPS_ADD_IMMEDIATE 34 -+#define R_MIPS_PJUMP 35 -+#define R_MIPS_RELGOT 36 -+#define R_MIPS_JALR 37 -+#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ -+#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ -+#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ -+#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ -+#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ -+#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ -+#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ -+#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ -+#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ -+#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ -+#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ -+#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ -+#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ -+#define R_MIPS_GLOB_DAT 51 -+#define R_MIPS_COPY 126 -+#define R_MIPS_JUMP_SLOT 127 -+/* Keep this the last entry. */ -+#define R_MIPS_NUM 128 -+ -+/* Legal values for p_type field of Elf32_Phdr. */ -+ -+#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ -+#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */ -+#define PT_MIPS_OPTIONS 0x70000002 -+ -+/* Special program header types. */ -+ -+#define PF_MIPS_LOCAL 0x10000000 -+ -+/* Legal values for d_tag field of Elf32_Dyn. */ -+ -+#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */ -+#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ -+#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */ -+#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ -+#define DT_MIPS_FLAGS 0x70000005 /* Flags */ -+#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */ -+#define DT_MIPS_MSYM 0x70000007 -+#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */ -+#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */ -+#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */ -+#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */ -+#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */ -+#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */ -+#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ -+#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */ -+#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ -+#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */ -+#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */ -+#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in -+ DT_MIPS_DELTA_CLASS. */ -+#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */ -+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in -+ DT_MIPS_DELTA_INSTANCE. */ -+#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */ -+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in -+ DT_MIPS_DELTA_RELOC. */ -+#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta -+ relocations refer to. */ -+#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in -+ DT_MIPS_DELTA_SYM. */ -+#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the -+ class declaration. */ -+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in -+ DT_MIPS_DELTA_CLASSSYM. */ -+#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */ -+#define DT_MIPS_PIXIE_INIT 0x70000023 -+#define DT_MIPS_SYMBOL_LIB 0x70000024 -+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 -+#define DT_MIPS_LOCAL_GOTIDX 0x70000026 -+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 -+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 -+#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */ -+#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */ -+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b -+#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */ -+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve -+ function stored in GOT. */ -+#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added -+ by rld on dlopen() calls. */ -+#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ -+#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ -+#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ -+/* The address of .got.plt in an executable using the new non-PIC ABI. */ -+#define DT_MIPS_PLTGOT 0x70000032 -+/* The base of the PLT in an executable using the new non-PIC ABI if that -+ PLT is writable. For a non-writable PLT, this is omitted or has a zero -+ value. */ -+#define DT_MIPS_RWPLT 0x70000034 -+#define DT_MIPS_NUM 0x35 -+ -+/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ -+ -+#define RHF_NONE 0 /* No flags */ -+#define RHF_QUICKSTART (1 << 0) /* Use quickstart */ -+#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */ -+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */ -+#define RHF_NO_MOVE (1 << 3) -+#define RHF_SGI_ONLY (1 << 4) -+#define RHF_GUARANTEE_INIT (1 << 5) -+#define RHF_DELTA_C_PLUS_PLUS (1 << 6) -+#define RHF_GUARANTEE_START_INIT (1 << 7) -+#define RHF_PIXIE (1 << 8) -+#define RHF_DEFAULT_DELAY_LOAD (1 << 9) -+#define RHF_REQUICKSTART (1 << 10) -+#define RHF_REQUICKSTARTED (1 << 11) -+#define RHF_CORD (1 << 12) -+#define RHF_NO_UNRES_UNDEF (1 << 13) -+#define RHF_RLD_ORDER_SAFE (1 << 14) -+ -+/* Entries found in sections of type SHT_MIPS_LIBLIST. */ -+ -+typedef struct -+{ -+ Elf32_Word l_name; /* Name (string table index) */ -+ Elf32_Word l_time_stamp; /* Timestamp */ -+ Elf32_Word l_checksum; /* Checksum */ -+ Elf32_Word l_version; /* Interface version */ -+ Elf32_Word l_flags; /* Flags */ -+} Elf32_Lib; -+ -+typedef struct -+{ -+ Elf64_Word l_name; /* Name (string table index) */ -+ Elf64_Word l_time_stamp; /* Timestamp */ -+ Elf64_Word l_checksum; /* Checksum */ -+ Elf64_Word l_version; /* Interface version */ -+ Elf64_Word l_flags; /* Flags */ -+} Elf64_Lib; -+ -+ -+/* Legal values for l_flags. */ -+ -+#define LL_NONE 0 -+#define LL_EXACT_MATCH (1 << 0) /* Require exact match */ -+#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */ -+#define LL_REQUIRE_MINOR (1 << 2) -+#define LL_EXPORTS (1 << 3) -+#define LL_DELAY_LOAD (1 << 4) -+#define LL_DELTA (1 << 5) -+ -+/* Entries found in sections of type SHT_MIPS_CONFLICT. */ -+ -+typedef Elf32_Addr Elf32_Conflict; -+ -+ -+/* HPPA specific definitions. */ -+ -+/* Legal values for e_flags field of Elf32_Ehdr. */ -+ -+#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */ -+#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */ -+#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ -+#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ -+#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch -+ prediction. */ -+#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ -+#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ -+ -+/* Defined values for `e_flags & EF_PARISC_ARCH' are: */ -+ -+#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */ -+#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ -+#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ -+ -+/* Additional section indeces. */ -+ -+#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared -+ symbols in ANSI C. */ -+#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ -+ -+/* Legal values for sh_type field of Elf32_Shdr. */ -+ -+#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */ -+#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */ -+#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */ -+ -+/* Legal values for sh_flags field of Elf32_Shdr. */ -+ -+#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */ -+#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */ -+#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */ -+ -+/* Legal values for ST_TYPE subfield of st_info (symbol type). */ -+ -+#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */ -+ -+#define STT_HP_OPAQUE (STT_LOOS + 0x1) -+#define STT_HP_STUB (STT_LOOS + 0x2) -+ -+/* HPPA relocs. */ -+ -+#define R_PARISC_NONE 0 /* No reloc. */ -+#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */ -+#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */ -+#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */ -+#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */ -+#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */ -+#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */ -+#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */ -+#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */ -+#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */ -+#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */ -+#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */ -+#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */ -+#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */ -+#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */ -+#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */ -+#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */ -+#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */ -+#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */ -+#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */ -+#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */ -+#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */ -+#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */ -+#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */ -+#define R_PARISC_FPTR64 64 /* 64 bits function address. */ -+#define R_PARISC_PLABEL32 65 /* 32 bits function address. */ -+#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */ -+#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */ -+#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */ -+#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */ -+#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */ -+#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */ -+#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */ -+#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */ -+#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */ -+#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */ -+#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */ -+#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */ -+#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */ -+#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */ -+#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */ -+#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */ -+#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */ -+#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */ -+#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */ -+#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */ -+#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */ -+#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */ -+#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */ -+#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */ -+#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */ -+#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */ -+#define R_PARISC_LORESERVE 128 -+#define R_PARISC_COPY 128 /* Copy relocation. */ -+#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */ -+#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */ -+#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */ -+#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */ -+#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */ -+#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */ -+#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */ -+#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */ -+#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */ -+#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */ -+#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/ -+#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */ -+#define R_PARISC_GNU_VTENTRY 232 -+#define R_PARISC_GNU_VTINHERIT 233 -+#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */ -+#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */ -+#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */ -+#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */ -+#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */ -+#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */ -+#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */ -+#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */ -+#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */ -+#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */ -+#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */ -+#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L -+#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R -+#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L -+#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R -+#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 -+#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 -+#define R_PARISC_HIRESERVE 255 -+ -+/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PT_HP_TLS (PT_LOOS + 0x0) -+#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -+#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -+#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -+#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -+#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -+#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -+#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -+#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -+#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -+#define PT_HP_PARALLEL (PT_LOOS + 0x10) -+#define PT_HP_FASTBIND (PT_LOOS + 0x11) -+#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) -+#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) -+#define PT_HP_STACK (PT_LOOS + 0x14) -+ -+#define PT_PARISC_ARCHEXT 0x70000000 -+#define PT_PARISC_UNWIND 0x70000001 -+ -+/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */ -+ -+#define PF_PARISC_SBP 0x08000000 -+ -+#define PF_HP_PAGE_SIZE 0x00100000 -+#define PF_HP_FAR_SHARED 0x00200000 -+#define PF_HP_NEAR_SHARED 0x00400000 -+#define PF_HP_CODE 0x01000000 -+#define PF_HP_MODIFY 0x02000000 -+#define PF_HP_LAZYSWAP 0x04000000 -+#define PF_HP_SBP 0x08000000 -+ -+ -+/* Alpha specific definitions. */ -+ -+/* Legal values for e_flags field of Elf64_Ehdr. */ -+ -+#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */ -+#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */ -+ -+/* Legal values for sh_type field of Elf64_Shdr. */ -+ -+/* These two are primerily concerned with ECOFF debugging info. */ -+#define SHT_ALPHA_DEBUG 0x70000001 -+#define SHT_ALPHA_REGINFO 0x70000002 -+ -+/* Legal values for sh_flags field of Elf64_Shdr. */ -+ -+#define SHF_ALPHA_GPREL 0x10000000 -+ -+/* Legal values for st_other field of Elf64_Sym. */ -+#define STO_ALPHA_NOPV 0x80 /* No PV required. */ -+#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */ -+ -+/* Alpha relocs. */ -+ -+#define R_ALPHA_NONE 0 /* No reloc */ -+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ -+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ -+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ -+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ -+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ -+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ -+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ -+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ -+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ -+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ -+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ -+#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */ -+#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */ -+#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */ -+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ -+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ -+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ -+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ -+#define R_ALPHA_TLS_GD_HI 28 -+#define R_ALPHA_TLSGD 29 -+#define R_ALPHA_TLS_LDM 30 -+#define R_ALPHA_DTPMOD64 31 -+#define R_ALPHA_GOTDTPREL 32 -+#define R_ALPHA_DTPREL64 33 -+#define R_ALPHA_DTPRELHI 34 -+#define R_ALPHA_DTPRELLO 35 -+#define R_ALPHA_DTPREL16 36 -+#define R_ALPHA_GOTTPREL 37 -+#define R_ALPHA_TPREL64 38 -+#define R_ALPHA_TPRELHI 39 -+#define R_ALPHA_TPRELLO 40 -+#define R_ALPHA_TPREL16 41 -+/* Keep this the last entry. */ -+#define R_ALPHA_NUM 46 -+ -+/* Magic values of the LITUSE relocation addend. */ -+#define LITUSE_ALPHA_ADDR 0 -+#define LITUSE_ALPHA_BASE 1 -+#define LITUSE_ALPHA_BYTOFF 2 -+#define LITUSE_ALPHA_JSR 3 -+#define LITUSE_ALPHA_TLS_GD 4 -+#define LITUSE_ALPHA_TLS_LDM 5 -+ -+/* Legal values for d_tag of Elf64_Dyn. */ -+#define DT_ALPHA_PLTRO (DT_LOPROC + 0) -+#define DT_ALPHA_NUM 1 -+ -+/* PowerPC specific declarations */ -+ -+/* Values for Elf32/64_Ehdr.e_flags. */ -+#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ -+ -+/* Cygnus local bits below */ -+#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -+#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib -+ flag */ -+ -+/* PowerPC relocations defined by the ABIs */ -+#define R_PPC_NONE 0 -+#define R_PPC_ADDR32 1 /* 32bit absolute address */ -+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -+#define R_PPC_ADDR16 3 /* 16bit absolute address */ -+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -+#define R_PPC_ADDR14_BRTAKEN 8 -+#define R_PPC_ADDR14_BRNTAKEN 9 -+#define R_PPC_REL24 10 /* PC relative 26 bit */ -+#define R_PPC_REL14 11 /* PC relative 16 bit */ -+#define R_PPC_REL14_BRTAKEN 12 -+#define R_PPC_REL14_BRNTAKEN 13 -+#define R_PPC_GOT16 14 -+#define R_PPC_GOT16_LO 15 -+#define R_PPC_GOT16_HI 16 -+#define R_PPC_GOT16_HA 17 -+#define R_PPC_PLTREL24 18 -+#define R_PPC_COPY 19 -+#define R_PPC_GLOB_DAT 20 -+#define R_PPC_JMP_SLOT 21 -+#define R_PPC_RELATIVE 22 -+#define R_PPC_LOCAL24PC 23 -+#define R_PPC_UADDR32 24 -+#define R_PPC_UADDR16 25 -+#define R_PPC_REL32 26 -+#define R_PPC_PLT32 27 -+#define R_PPC_PLTREL32 28 -+#define R_PPC_PLT16_LO 29 -+#define R_PPC_PLT16_HI 30 -+#define R_PPC_PLT16_HA 31 -+#define R_PPC_SDAREL16 32 -+#define R_PPC_SECTOFF 33 -+#define R_PPC_SECTOFF_LO 34 -+#define R_PPC_SECTOFF_HI 35 -+#define R_PPC_SECTOFF_HA 36 -+ -+/* PowerPC relocations defined for the TLS access ABI. */ -+#define R_PPC_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */ -+#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */ -+#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */ -+#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */ -+#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */ -+#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */ -+#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */ -+#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ -+#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ -+ -+/* The remaining relocs are from the Embedded ELF ABI, and are not -+ in the SVR4 ELF ABI. */ -+#define R_PPC_EMB_NADDR32 101 -+#define R_PPC_EMB_NADDR16 102 -+#define R_PPC_EMB_NADDR16_LO 103 -+#define R_PPC_EMB_NADDR16_HI 104 -+#define R_PPC_EMB_NADDR16_HA 105 -+#define R_PPC_EMB_SDAI16 106 -+#define R_PPC_EMB_SDA2I16 107 -+#define R_PPC_EMB_SDA2REL 108 -+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -+#define R_PPC_EMB_MRKREF 110 -+#define R_PPC_EMB_RELSEC16 111 -+#define R_PPC_EMB_RELST_LO 112 -+#define R_PPC_EMB_RELST_HI 113 -+#define R_PPC_EMB_RELST_HA 114 -+#define R_PPC_EMB_BIT_FLD 115 -+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ -+ -+/* Diab tool relocations. */ -+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC_IRELATIVE 248 -+ -+/* GNU relocs used in PIC code sequences. */ -+#define R_PPC_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* This is a phony reloc to handle any old fashioned TOC16 references -+ that may still be in object files. */ -+#define R_PPC_TOC16 255 -+ -+/* PowerPC specific values for the Dyn d_tag field. */ -+#define DT_PPC_GOT (DT_LOPROC + 0) -+#define DT_PPC_NUM 1 -+ -+/* PowerPC64 relocations defined by the ABIs */ -+#define R_PPC64_NONE R_PPC_NONE -+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */ -+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */ -+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */ -+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */ -+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */ -+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */ -+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */ -+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN -+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN -+#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */ -+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */ -+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN -+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN -+#define R_PPC64_GOT16 R_PPC_GOT16 -+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO -+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI -+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA -+ -+#define R_PPC64_COPY R_PPC_COPY -+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT -+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT -+#define R_PPC64_RELATIVE R_PPC_RELATIVE -+ -+#define R_PPC64_UADDR32 R_PPC_UADDR32 -+#define R_PPC64_UADDR16 R_PPC_UADDR16 -+#define R_PPC64_REL32 R_PPC_REL32 -+#define R_PPC64_PLT32 R_PPC_PLT32 -+#define R_PPC64_PLTREL32 R_PPC_PLTREL32 -+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO -+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI -+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA -+ -+#define R_PPC64_SECTOFF R_PPC_SECTOFF -+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO -+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI -+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA -+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */ -+#define R_PPC64_ADDR64 38 /* doubleword64 S + A */ -+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */ -+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */ -+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */ -+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */ -+#define R_PPC64_UADDR64 43 /* doubleword64 S + A */ -+#define R_PPC64_REL64 44 /* doubleword64 S + A - P */ -+#define R_PPC64_PLT64 45 /* doubleword64 L + A */ -+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */ -+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */ -+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */ -+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */ -+#define R_PPC64_TOC 51 /* doubleword64 .TOC */ -+#define R_PPC64_PLTGOT16 52 /* half16* M + A */ -+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */ -+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */ -+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */ -+ -+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */ -+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */ -+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */ -+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */ -+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */ -+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */ -+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */ -+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */ -+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */ -+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */ -+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */ -+ -+/* PowerPC64 relocations defined for the TLS access ABI. */ -+#define R_PPC64_TLS 67 /* none (sym+add)@tls */ -+#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */ -+#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */ -+#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */ -+#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */ -+#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */ -+#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */ -+#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */ -+#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */ -+#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */ -+#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */ -+#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */ -+#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */ -+#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */ -+#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */ -+#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */ -+#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */ -+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */ -+#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */ -+#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */ -+#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */ -+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */ -+#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */ -+#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */ -+#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */ -+#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */ -+#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */ -+#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */ -+#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */ -+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */ -+#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */ -+#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */ -+#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */ -+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */ -+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ -+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ -+ -+/* GNU extension to support local ifunc. */ -+#define R_PPC64_JMP_IREL 247 -+#define R_PPC64_IRELATIVE 248 -+#define R_PPC64_REL16 249 /* half16 (sym+add-.) */ -+#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ -+#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ -+#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ -+ -+/* PowerPC64 specific values for the Dyn d_tag field. */ -+#define DT_PPC64_GLINK (DT_LOPROC + 0) -+#define DT_PPC64_OPD (DT_LOPROC + 1) -+#define DT_PPC64_OPDSZ (DT_LOPROC + 2) -+#define DT_PPC64_NUM 3 -+ -+ -+/* ARM specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_ARM_RELEXEC 0x01 -+#define EF_ARM_HASENTRY 0x02 -+#define EF_ARM_INTERWORK 0x04 -+#define EF_ARM_APCS_26 0x08 -+#define EF_ARM_APCS_FLOAT 0x10 -+#define EF_ARM_PIC 0x20 -+#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ -+#define EF_ARM_NEW_ABI 0x80 -+#define EF_ARM_OLD_ABI 0x100 -+#define EF_ARM_SOFT_FLOAT 0x200 -+#define EF_ARM_VFP_FLOAT 0x400 -+#define EF_ARM_MAVERICK_FLOAT 0x800 -+ -+ -+/* Other constants defined in the ARM ELF spec. version B-01. */ -+/* NB. These conflict with values defined above. */ -+#define EF_ARM_SYMSARESORTED 0x04 -+#define EF_ARM_DYNSYMSUSESEGIDX 0x08 -+#define EF_ARM_MAPSYMSFIRST 0x10 -+#define EF_ARM_EABIMASK 0XFF000000 -+ -+/* Constants defined in AAELF. */ -+#define EF_ARM_BE8 0x00800000 -+#define EF_ARM_LE8 0x00400000 -+ -+#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) -+#define EF_ARM_EABI_UNKNOWN 0x00000000 -+#define EF_ARM_EABI_VER1 0x01000000 -+#define EF_ARM_EABI_VER2 0x02000000 -+#define EF_ARM_EABI_VER3 0x03000000 -+#define EF_ARM_EABI_VER4 0x04000000 -+#define EF_ARM_EABI_VER5 0x05000000 -+ -+/* Additional symbol types for Thumb. */ -+#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ -+#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ -+ -+/* ARM-specific values for sh_flags */ -+#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ -+#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined -+ in the input to a link step. */ -+ -+/* ARM-specific program header flags */ -+#define PF_ARM_SB 0x10000000 /* Segment contains the location -+ addressed by the static base. */ -+#define PF_ARM_PI 0x20000000 /* Position-independent segment. */ -+#define PF_ARM_ABS 0x40000000 /* Absolute segment. */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ -+#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ -+#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ -+ -+ -+/* ARM relocs. */ -+ -+#define R_ARM_NONE 0 /* No reloc */ -+#define R_ARM_PC24 1 /* PC relative 26 bit branch */ -+#define R_ARM_ABS32 2 /* Direct 32 bit */ -+#define R_ARM_REL32 3 /* PC relative 32 bit */ -+#define R_ARM_PC13 4 -+#define R_ARM_ABS16 5 /* Direct 16 bit */ -+#define R_ARM_ABS12 6 /* Direct 12 bit */ -+#define R_ARM_THM_ABS5 7 -+#define R_ARM_ABS8 8 /* Direct 8 bit */ -+#define R_ARM_SBREL32 9 -+#define R_ARM_THM_PC22 10 -+#define R_ARM_THM_PC8 11 -+#define R_ARM_AMP_VCALL9 12 -+#define R_ARM_SWI24 13 /* Obsolete static relocation. */ -+#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ -+#define R_ARM_THM_SWI8 14 -+#define R_ARM_XPC25 15 -+#define R_ARM_THM_XPC22 16 -+#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ -+#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ -+#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ -+#define R_ARM_COPY 20 /* Copy symbol at runtime */ -+#define R_ARM_GLOB_DAT 21 /* Create GOT entry */ -+#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */ -+#define R_ARM_RELATIVE 23 /* Adjust by program base */ -+#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */ -+#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */ -+#define R_ARM_GOT32 26 /* 32 bit GOT entry */ -+#define R_ARM_PLT32 27 /* 32 bit PLT address */ -+#define R_ARM_ALU_PCREL_7_0 32 -+#define R_ARM_ALU_PCREL_15_8 33 -+#define R_ARM_ALU_PCREL_23_15 34 -+#define R_ARM_LDR_SBREL_11_0 35 -+#define R_ARM_ALU_SBREL_19_12 36 -+#define R_ARM_ALU_SBREL_27_20 37 -+#define R_ARM_TLS_GOTDESC 90 -+#define R_ARM_TLS_CALL 91 -+#define R_ARM_TLS_DESCSEQ 92 -+#define R_ARM_THM_TLS_CALL 93 -+#define R_ARM_GNU_VTENTRY 100 -+#define R_ARM_GNU_VTINHERIT 101 -+#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ -+#define R_ARM_THM_PC9 103 /* thumb conditional branch */ -+#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic -+ thread local data */ -+#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic -+ thread local data */ -+#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS -+ block */ -+#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of -+ static TLS block offset */ -+#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static -+ TLS block */ -+#define R_ARM_THM_TLS_DESCSEQ 129 -+#define R_ARM_IRELATIVE 160 -+#define R_ARM_RXPC25 249 -+#define R_ARM_RSBREL32 250 -+#define R_ARM_THM_RPC22 251 -+#define R_ARM_RREL32 252 -+#define R_ARM_RABS22 253 -+#define R_ARM_RPC24 254 -+#define R_ARM_RBASE 255 -+/* Keep this the last entry. */ -+#define R_ARM_NUM 256 -+ -+/* IA-64 specific declarations. */ -+ -+/* Processor specific flags for the Ehdr e_flags field. */ -+#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */ -+#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */ -+#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */ -+ -+/* Processor specific values for the Phdr p_type field. */ -+#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */ -+#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */ -+#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) -+#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) -+#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) -+ -+/* Processor specific flags for the Phdr p_flags field. */ -+#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Shdr sh_type field. */ -+#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */ -+#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */ -+ -+/* Processor specific flags for the Shdr sh_flags field. */ -+#define SHF_IA_64_SHORT 0x10000000 /* section near gp */ -+#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */ -+ -+/* Processor specific values for the Dyn d_tag field. */ -+#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) -+#define DT_IA_64_NUM 1 -+ -+/* IA-64 relocations. */ -+#define R_IA64_NONE 0x00 /* none */ -+#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */ -+#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */ -+#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */ -+#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */ -+#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */ -+#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */ -+#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */ -+#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */ -+#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */ -+#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */ -+#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */ -+#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */ -+#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */ -+#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */ -+#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */ -+#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */ -+#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */ -+#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */ -+#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */ -+#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */ -+#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */ -+#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */ -+#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */ -+#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */ -+#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */ -+#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */ -+#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */ -+#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */ -+#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */ -+#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */ -+#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */ -+#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */ -+#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */ -+#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */ -+#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */ -+#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */ -+#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */ -+#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */ -+#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */ -+#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */ -+#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */ -+#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */ -+#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */ -+#define R_IA64_REL32MSB 0x6c /* data 4 + REL */ -+#define R_IA64_REL32LSB 0x6d /* data 4 + REL */ -+#define R_IA64_REL64MSB 0x6e /* data 8 + REL */ -+#define R_IA64_REL64LSB 0x6f /* data 8 + REL */ -+#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */ -+#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */ -+#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */ -+#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */ -+#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */ -+#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */ -+#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */ -+#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */ -+#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */ -+#define R_IA64_COPY 0x84 /* copy relocation */ -+#define R_IA64_SUB 0x85 /* Addend and symbol difference */ -+#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */ -+#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */ -+#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */ -+#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */ -+#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */ -+#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */ -+#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */ -+#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */ -+#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */ -+#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */ -+#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */ -+#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */ -+#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */ -+#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */ -+#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */ -+#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */ -+#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */ -+ -+/* SH specific declarations */ -+ -+/* Processor specific flags for the ELF header e_flags field. */ -+#define EF_SH_MACH_MASK 0x1f -+#define EF_SH_UNKNOWN 0x0 -+#define EF_SH1 0x1 -+#define EF_SH2 0x2 -+#define EF_SH3 0x3 -+#define EF_SH_DSP 0x4 -+#define EF_SH3_DSP 0x5 -+#define EF_SH4AL_DSP 0x6 -+#define EF_SH3E 0x8 -+#define EF_SH4 0x9 -+#define EF_SH2E 0xb -+#define EF_SH4A 0xc -+#define EF_SH2A 0xd -+#define EF_SH4_NOFPU 0x10 -+#define EF_SH4A_NOFPU 0x11 -+#define EF_SH4_NOMMU_NOFPU 0x12 -+#define EF_SH2A_NOFPU 0x13 -+#define EF_SH3_NOMMU 0x14 -+#define EF_SH2A_SH4_NOFPU 0x15 -+#define EF_SH2A_SH3_NOFPU 0x16 -+#define EF_SH2A_SH4 0x17 -+#define EF_SH2A_SH3E 0x18 -+ -+/* SH relocs. */ -+#define R_SH_NONE 0 -+#define R_SH_DIR32 1 -+#define R_SH_REL32 2 -+#define R_SH_DIR8WPN 3 -+#define R_SH_IND12W 4 -+#define R_SH_DIR8WPL 5 -+#define R_SH_DIR8WPZ 6 -+#define R_SH_DIR8BP 7 -+#define R_SH_DIR8W 8 -+#define R_SH_DIR8L 9 -+#define R_SH_SWITCH16 25 -+#define R_SH_SWITCH32 26 -+#define R_SH_USES 27 -+#define R_SH_COUNT 28 -+#define R_SH_ALIGN 29 -+#define R_SH_CODE 30 -+#define R_SH_DATA 31 -+#define R_SH_LABEL 32 -+#define R_SH_SWITCH8 33 -+#define R_SH_GNU_VTINHERIT 34 -+#define R_SH_GNU_VTENTRY 35 -+#define R_SH_TLS_GD_32 144 -+#define R_SH_TLS_LD_32 145 -+#define R_SH_TLS_LDO_32 146 -+#define R_SH_TLS_IE_32 147 -+#define R_SH_TLS_LE_32 148 -+#define R_SH_TLS_DTPMOD32 149 -+#define R_SH_TLS_DTPOFF32 150 -+#define R_SH_TLS_TPOFF32 151 -+#define R_SH_GOT32 160 -+#define R_SH_PLT32 161 -+#define R_SH_COPY 162 -+#define R_SH_GLOB_DAT 163 -+#define R_SH_JMP_SLOT 164 -+#define R_SH_RELATIVE 165 -+#define R_SH_GOTOFF 166 -+#define R_SH_GOTPC 167 -+/* Keep this the last entry. */ -+#define R_SH_NUM 256 -+ -+/* S/390 specific definitions. */ -+ -+/* Valid values for the e_flags field. */ -+ -+#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed. */ -+ -+/* Additional s390 relocs */ -+ -+#define R_390_NONE 0 /* No reloc. */ -+#define R_390_8 1 /* Direct 8 bit. */ -+#define R_390_12 2 /* Direct 12 bit. */ -+#define R_390_16 3 /* Direct 16 bit. */ -+#define R_390_32 4 /* Direct 32 bit. */ -+#define R_390_PC32 5 /* PC relative 32 bit. */ -+#define R_390_GOT12 6 /* 12 bit GOT offset. */ -+#define R_390_GOT32 7 /* 32 bit GOT offset. */ -+#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */ -+#define R_390_COPY 9 /* Copy symbol at runtime. */ -+#define R_390_GLOB_DAT 10 /* Create GOT entry. */ -+#define R_390_JMP_SLOT 11 /* Create PLT entry. */ -+#define R_390_RELATIVE 12 /* Adjust by program base. */ -+#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */ -+#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */ -+#define R_390_GOT16 15 /* 16 bit GOT offset. */ -+#define R_390_PC16 16 /* PC relative 16 bit. */ -+#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */ -+#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */ -+#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */ -+#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */ -+#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */ -+#define R_390_64 22 /* Direct 64 bit. */ -+#define R_390_PC64 23 /* PC relative 64 bit. */ -+#define R_390_GOT64 24 /* 64 bit GOT offset. */ -+#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */ -+#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */ -+#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */ -+#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */ -+#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */ -+#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */ -+#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */ -+#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */ -+#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */ -+#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */ -+#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */ -+#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */ -+#define R_390_TLS_GDCALL 38 /* Tag for function call in general -+ dynamic TLS code. */ -+#define R_390_TLS_LDCALL 39 /* Tag for function call in local -+ dynamic TLS code. */ -+#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic -+ thread local data. */ -+#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic -+ thread local data in LE code. */ -+#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for -+ negated static TLS block offset. */ -+#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to -+ static TLS block. */ -+#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS -+ block. */ -+#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */ -+#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */ -+#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS -+ block. */ -+#define R_390_20 57 /* Direct 20 bit. */ -+#define R_390_GOT20 58 /* 20 bit GOT offset. */ -+#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */ -+#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS -+ block offset. */ -+#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */ -+/* Keep this the last entry. */ -+#define R_390_NUM 62 -+ -+ -+/* CRIS relocations. */ -+#define R_CRIS_NONE 0 -+#define R_CRIS_8 1 -+#define R_CRIS_16 2 -+#define R_CRIS_32 3 -+#define R_CRIS_8_PCREL 4 -+#define R_CRIS_16_PCREL 5 -+#define R_CRIS_32_PCREL 6 -+#define R_CRIS_GNU_VTINHERIT 7 -+#define R_CRIS_GNU_VTENTRY 8 -+#define R_CRIS_COPY 9 -+#define R_CRIS_GLOB_DAT 10 -+#define R_CRIS_JUMP_SLOT 11 -+#define R_CRIS_RELATIVE 12 -+#define R_CRIS_16_GOT 13 -+#define R_CRIS_32_GOT 14 -+#define R_CRIS_16_GOTPLT 15 -+#define R_CRIS_32_GOTPLT 16 -+#define R_CRIS_32_GOTREL 17 -+#define R_CRIS_32_PLT_GOTREL 18 -+#define R_CRIS_32_PLT_PCREL 19 -+ -+#define R_CRIS_NUM 20 -+ -+ -+/* AMD x86-64 relocations. */ -+#define R_X86_64_NONE 0 /* No reloc */ -+#define R_X86_64_64 1 /* Direct 64 bit */ -+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */ -+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */ -+#define R_X86_64_PLT32 4 /* 32 bit PLT address */ -+#define R_X86_64_COPY 5 /* Copy symbol at runtime */ -+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ -+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ -+#define R_X86_64_RELATIVE 8 /* Adjust by program base */ -+#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative -+ offset to GOT */ -+#define R_X86_64_32 10 /* Direct 32 bit zero extended */ -+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */ -+#define R_X86_64_16 12 /* Direct 16 bit zero extended */ -+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */ -+#define R_X86_64_8 14 /* Direct 8 bit sign extended */ -+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */ -+#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ -+#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */ -+#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */ -+#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset -+ to two GOT entries for GD symbol */ -+#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset -+ to two GOT entries for LD symbol */ -+#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ -+#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset -+ to GOT entry for IE symbol */ -+#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */ -+#define R_X86_64_PC64 24 /* PC relative 64 bit */ -+#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */ -+#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative -+ offset to GOT */ -+#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */ -+#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset -+ to GOT entry */ -+#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */ -+#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */ -+#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset -+ to PLT entry */ -+#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */ -+#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */ -+#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */ -+#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS -+ descriptor. */ -+#define R_X86_64_TLSDESC 36 /* TLS descriptor. */ -+#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ -+#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ -+ -+#define R_X86_64_NUM 39 -+ -+ -+/* AM33 relocations. */ -+#define R_MN10300_NONE 0 /* No reloc. */ -+#define R_MN10300_32 1 /* Direct 32 bit. */ -+#define R_MN10300_16 2 /* Direct 16 bit. */ -+#define R_MN10300_8 3 /* Direct 8 bit. */ -+#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ -+#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ -+#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ -+#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */ -+#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */ -+#define R_MN10300_24 9 /* Direct 24 bit. */ -+#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */ -+#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */ -+#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */ -+#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */ -+#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */ -+#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */ -+#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */ -+#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */ -+#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */ -+#define R_MN10300_COPY 20 /* Copy symbol at runtime. */ -+#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */ -+#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */ -+#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ -+ -+#define R_MN10300_NUM 24 -+ -+ -+/* M32R relocs. */ -+#define R_M32R_NONE 0 /* No reloc. */ -+#define R_M32R_16 1 /* Direct 16 bit. */ -+#define R_M32R_32 2 /* Direct 32 bit. */ -+#define R_M32R_24 3 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */ -+#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */ -+#define R_M32R_LO16 9 /* Low 16 bit. */ -+#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */ -+#define R_M32R_GNU_VTINHERIT 11 -+#define R_M32R_GNU_VTENTRY 12 -+/* M32R relocs use SHT_RELA. */ -+#define R_M32R_16_RELA 33 /* Direct 16 bit. */ -+#define R_M32R_32_RELA 34 /* Direct 32 bit. */ -+#define R_M32R_24_RELA 35 /* Direct 24 bit. */ -+#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */ -+#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */ -+#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */ -+#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */ -+#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */ -+#define R_M32R_LO16_RELA 41 /* Low 16 bit */ -+#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */ -+#define R_M32R_RELA_GNU_VTINHERIT 43 -+#define R_M32R_RELA_GNU_VTENTRY 44 -+#define R_M32R_REL32 45 /* PC relative 32 bit. */ -+ -+#define R_M32R_GOT24 48 /* 24 bit GOT entry */ -+#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */ -+#define R_M32R_COPY 50 /* Copy symbol at runtime */ -+#define R_M32R_GLOB_DAT 51 /* Create GOT entry */ -+#define R_M32R_JMP_SLOT 52 /* Create PLT entry */ -+#define R_M32R_RELATIVE 53 /* Adjust by program base */ -+#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */ -+#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */ -+#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned -+ low */ -+#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed -+ low */ -+#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */ -+#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to -+ GOT with unsigned low */ -+#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to -+ GOT with signed low */ -+#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to -+ GOT */ -+#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT -+ with unsigned low */ -+#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT -+ with signed low */ -+#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */ -+#define R_M32R_NUM 256 /* Keep this the last entry. */ -+ -+ -+/* TILEPro relocations. */ -+#define R_TILEPRO_NONE 0 /* No reloc */ -+#define R_TILEPRO_32 1 /* Direct 32 bit */ -+#define R_TILEPRO_16 2 /* Direct 16 bit */ -+#define R_TILEPRO_8 3 /* Direct 8 bit */ -+#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */ -+#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */ -+#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */ -+#define R_TILEPRO_LO16 7 /* Low 16 bit */ -+#define R_TILEPRO_HI16 8 /* High 16 bit */ -+#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */ -+#define R_TILEPRO_COPY 10 /* Copy relocation */ -+#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */ -+#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */ -+#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */ -+#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */ -+#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */ -+#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */ -+#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */ -+#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */ -+#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */ -+#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */ -+#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */ -+#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */ -+#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */ -+#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */ -+#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */ -+#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */ -+#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */ -+#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */ -+#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */ -+#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */ -+#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */ -+#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */ -+#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */ -+#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */ -+#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */ -+#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */ -+/* Relocs 56-59 are currently not defined. */ -+#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */ -+#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */ -+#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */ -+#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */ -+#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */ -+#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */ -+#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */ -+#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */ -+ -+#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEPRO_NUM 130 -+ -+ -+/* TILE-Gx relocations. */ -+#define R_TILEGX_NONE 0 /* No reloc */ -+#define R_TILEGX_64 1 /* Direct 64 bit */ -+#define R_TILEGX_32 2 /* Direct 32 bit */ -+#define R_TILEGX_16 3 /* Direct 16 bit */ -+#define R_TILEGX_8 4 /* Direct 8 bit */ -+#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */ -+#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */ -+#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */ -+#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */ -+#define R_TILEGX_HW0 9 /* hword 0 16-bit */ -+#define R_TILEGX_HW1 10 /* hword 1 16-bit */ -+#define R_TILEGX_HW2 11 /* hword 2 16-bit */ -+#define R_TILEGX_HW3 12 /* hword 3 16-bit */ -+#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */ -+#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */ -+#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */ -+#define R_TILEGX_COPY 16 /* Copy relocation */ -+#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */ -+#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */ -+#define R_TILEGX_RELATIVE 19 /* Adjust by program base */ -+#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */ -+#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */ -+#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */ -+#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */ -+#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */ -+#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */ -+#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */ -+#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */ -+#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */ -+#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */ -+#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */ -+#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */ -+#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */ -+#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */ -+#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */ -+#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */ -+#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */ -+#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */ -+/* Relocs 66-71 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */ -+/* Relocs 76-77 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */ -+/* Relocs 90-91 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */ -+#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */ -+/* Relocs 94-99 are currently not defined. */ -+#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */ -+#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */ -+#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */ -+/* Relocs 104-105 are currently not defined. */ -+#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */ -+#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */ -+#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */ -+#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */ -+#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */ -+#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */ -+#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */ -+#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */ -+#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */ -+#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */ -+ -+#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */ -+#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */ -+ -+#define R_TILEGX_NUM 130 -+ -+#endif /* elf.h */ diff --git a/target/linux/generic/pending-4.4/211-sign-file-libressl.patch b/target/linux/generic/pending-4.4/211-sign-file-libressl.patch deleted file mode 100644 index c174087f1..000000000 --- a/target/linux/generic/pending-4.4/211-sign-file-libressl.patch +++ /dev/null @@ -1,16 +0,0 @@ -LibreSSL disables the CMS subsystem, so sign-file.c needs to fall back to using -PKCS#7 in that case. - -Signed-off-by: Felix Fietkau - ---- a/scripts/sign-file.c -+++ b/scripts/sign-file.c -@@ -39,7 +39,7 @@ - * signing with anything other than SHA1 - so we're stuck with that if such is - * the case. - */ --#if OPENSSL_VERSION_NUMBER < 0x10000000L -+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10000000L - #define USE_PKCS7 - #endif - #ifndef USE_PKCS7 diff --git a/target/linux/generic/pending-4.4/212-byteshift_portability.patch b/target/linux/generic/pending-4.4/212-byteshift_portability.patch deleted file mode 100644 index 0f23ba9be..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/214-spidev_h_portability.patch b/target/linux/generic/pending-4.4/214-spidev_h_portability.patch deleted file mode 100644 index 39fa32ffa..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -112,7 +112,7 @@ struct spi_ioc_transfer { - - /* not all platforms use or _IOC_TYPECHECK() ... */ - #define SPI_MSGSIZE(N) \ -- ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ -+ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << 13)) \ - ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) - #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) - diff --git a/target/linux/generic/pending-4.4/220-gc_sections.patch b/target/linux/generic/pending-4.4/220-gc_sections.patch deleted file mode 100644 index cbe03d5c5..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -69,7 +69,7 @@ SECTIONS - /* Exception table for data bus errors */ - __dbe_table : { - __start___dbe_table = .; -- *(__dbe_table) -+ KEEP(*(__dbe_table)) - __stop___dbe_table = .; - } - -@@ -119,7 +119,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) -@@ -194,7 +194,7 @@ - #define KERNEL_DTB() \ - STRUCT_ALIGN(); \ - VMLINUX_SYMBOL(__dtb_start) = .; \ -- *(.dtb.init.rodata) \ -+ KEEP(*(.dtb.init.rodata)) \ - VMLINUX_SYMBOL(__dtb_end) = .; - - /* .data section */ -@@ -210,16 +210,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 -@@ -273,35 +274,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) = .; \ - } \ - \ -@@ -310,49 +311,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) = .; \ - } \ - \ -@@ -366,14 +367,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) = .; \ - } \ - \ -@@ -392,14 +393,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) = .; \ -@@ -453,7 +454,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 -@@ -481,7 +482,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) = .; \ - } - -@@ -497,9 +498,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() -@@ -556,7 +557,7 @@ - #define SBSS(sbss_align) \ - . = ALIGN(sbss_align); \ - .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ -- *(.sbss) \ -+ *(.sbss .sbss.*) \ - *(.scommon) \ - } - -@@ -574,7 +575,7 @@ - BSS_FIRST_SECTIONS \ - *(.bss..page_aligned) \ - *(.dynbss) \ -- *(.bss) \ -+ *(.bss .bss.*) \ - *(COMMON) \ - } - -@@ -623,7 +624,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 -@@ -635,7 +636,7 @@ - . = ALIGN(4); \ - .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__tracedata_start) = .; \ -- *(.tracedata) \ -+ KEEP(*(.tracedata)) \ - VMLINUX_SYMBOL(__tracedata_end) = .; \ - } - #else -@@ -652,17 +653,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) \ -@@ -676,21 +677,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 -@@ -22,11 +22,16 @@ endif - ifeq ($(CONFIG_ARM_MODULE_PLTS),y) - LDFLAGS_MODULE += -T $(srctree)/arch/arm/kernel/module.lds - 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 -@@ -105,6 +105,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) - ORIG_CFLAGS := $(KBUILD_CFLAGS) - KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) - endif -+KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL)) - - ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) - asflags-y := -DZIMAGE diff --git a/target/linux/generic/pending-4.4/221-module_exports.patch b/target/linux/generic/pending-4.4/221-module_exports.patch deleted file mode 100644 index 44c0a6dec..000000000 --- a/target/linux/generic/pending-4.4/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. */ -@@ -311,14 +321,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) = .; \ - } \ - \ -@@ -380,7 +390,7 @@ - \ - /* Kernel symbol table: strings */ \ - __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ -- *(__ksymtab_strings) \ -+ *(__ksymtab_strings+*) \ - } \ - \ - /* __*init sections */ \ -@@ -710,6 +720,8 @@ - EXIT_TEXT \ - EXIT_DATA \ - EXIT_CALL \ -+ SYMTAB_DISCARD \ -+ SYMTAB_DISCARD_GPL \ - *(.discard) \ - *(.discard.*) \ - } ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -372,7 +372,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( - # Linker scripts preprocessor (.lds.S -> .lds) - # --------------------------------------------------------------------------- - quiet_cmd_cpp_lds_S = LDS $@ -- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ -+ cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -C -U$(ARCH) \ - -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $< - - $(obj)/%.lds: $(src)/%.lds.S FORCE ---- a/include/linux/export.h -+++ b/include/linux/export.h -@@ -52,12 +52,19 @@ extern struct module __this_module; - #define __CRC_SYMBOL(sym, sec) - #endif - -+#ifdef MODULE -+#define __EXPORT_SUFFIX(sym) -+#else -+#define __EXPORT_SUFFIX(sym) "+" #sym -+#endif -+ - /* For every exported symbol, place a struct in the __ksymtab section */ - #define __EXPORT_SYMBOL(sym, sec) \ - extern typeof(sym) sym; \ - __CRC_SYMBOL(sym, sec) \ - static const char __kstrtab_##sym[] \ -- __attribute__((section("__ksymtab_strings"), aligned(1))) \ -+ __attribute__((section("__ksymtab_strings" \ -+ __EXPORT_SUFFIX(sym)), aligned(1))) \ - = VMLINUX_SYMBOL_STR(sym); \ - extern const struct kernel_symbol __ksymtab_##sym; \ - __visible const struct kernel_symbol __ksymtab_##sym \ diff --git a/target/linux/generic/pending-4.4/222-arm_zimage_none.patch b/target/linux/generic/pending-4.4/222-arm_zimage_none.patch deleted file mode 100644 index 47fa6c928..000000000 --- a/target/linux/generic/pending-4.4/222-arm_zimage_none.patch +++ /dev/null @@ -1,133 +0,0 @@ -ARM: implement "uncompressed zImage" - -Based on RFC patch by Uwe Kleine-König -http://www.spinics.net/lists/arm-kernel/msg230153.html - -Signed-off-by: Felix Fietkau ---- ---- a/arch/arm/boot/compressed/Makefile -+++ b/arch/arm/boot/compressed/Makefile -@@ -71,6 +71,7 @@ suffix_$(CONFIG_KERNEL_LZO) = lzo - suffix_$(CONFIG_KERNEL_LZMA) = lzma - suffix_$(CONFIG_KERNEL_XZ) = xzkern - suffix_$(CONFIG_KERNEL_LZ4) = lz4 -+suffix_$(CONFIG_KERNEL_CAT) = cat - - # Borrowed libfdt files for the ATAG compatibility mode - -@@ -95,7 +96,7 @@ targets := vmlinux vmlinux.lds \ - bswapsdi2.S font.o font.c head.o misc.o $(OBJS) - - # Make sure files are removed during clean --extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \ -+extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 piggy.cat \ - lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs) \ - hyp-stub.S - ---- a/arch/arm/boot/compressed/decompress.c -+++ b/arch/arm/boot/compressed/decompress.c -@@ -55,6 +55,10 @@ extern char * strstr(const char * s1, co - #include "../../../../lib/decompress_unlz4.c" - #endif - -+#ifdef CONFIG_KERNEL_CAT -+#include "../../../../lib/decompress_uncat.c" -+#endif -+ - int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) - { - return __decompress(input, len, NULL, NULL, output, 0, NULL, error); ---- /dev/null -+++ b/arch/arm/boot/compressed/piggy.cat.S -@@ -0,0 +1,6 @@ -+ .section .piggydata,#alloc -+ .globl input_data -+input_data: -+ .incbin "arch/arm/boot/compressed/piggy.cat" -+ .globl input_data_end -+input_data_end: ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -115,6 +115,9 @@ config HAVE_KERNEL_LZO - config HAVE_KERNEL_LZ4 - bool - -+config HAVE_KERNEL_CAT -+ bool -+ - choice - prompt "Kernel compression mode" - default KERNEL_GZIP -@@ -181,9 +184,10 @@ config KERNEL_LZO - bool "LZO" - depends on HAVE_KERNEL_LZO - help -- Its compression ratio is the poorest among the choices. The kernel -- size is about 10% bigger than gzip; however its speed -- (both compression and decompression) is the fastest. -+ Its compression ratio is the poorest among the choices (apart from -+ uncompressed below). The kernel size is about 10% bigger than gzip; -+ however its speed (both compression and decompression) is the -+ fastest. - - config KERNEL_LZ4 - bool "LZ4" -@@ -197,6 +201,12 @@ config KERNEL_LZ4 - is about 8% bigger than LZO. But the decompression speed is - faster than LZO. - -+config KERNEL_CAT -+ bool "uncompressed" -+ depends on HAVE_KERNEL_CAT -+ help -+ Don't use compression at all. -+ - endchoice - - config DEFAULT_HOSTNAME ---- /dev/null -+++ b/lib/decompress_uncat.c -@@ -0,0 +1,17 @@ -+#include -+#include -+ -+#ifdef STATIC -+ -+STATIC int __decompress(unsigned char *buf, long in_len, -+ long (*fill)(void*, unsigned long), -+ long (*flush)(void*, unsigned long), -+ unsigned char *output, long out_len, -+ long *posp, -+ void (*error)(char *x)) -+{ -+ memmove(output, buf, in_len); -+ return 0; -+} -+ -+#endif ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -337,6 +337,13 @@ cmd_lz4 = (cat $(filter-out FORCE,$^) | - lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ - (rm -f $@ ; false) - -+# uncompressed -+# --------------------------------------------------------------------------- -+quiet_cmd_cat = CAT $@ -+cmd_cat = (cat $(filter-out FORCE,$^) \ -+ && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ -+ (rm -f $@ ; false) -+ - # U-Boot mkimage - # --------------------------------------------------------------------------- - ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -59,6 +59,7 @@ config ARM - select HAVE_KERNEL_LZMA - select HAVE_KERNEL_LZO - select HAVE_KERNEL_XZ -+ select HAVE_KERNEL_CAT - select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M - select HAVE_KRETPROBES if (HAVE_KPROBES) - select HAVE_MEMBLOCK diff --git a/target/linux/generic/pending-4.4/230-openwrt_lzma_options.patch b/target/linux/generic/pending-4.4/230-openwrt_lzma_options.patch deleted file mode 100644 index d5bbb19cf..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/250-netfilter_depends.patch b/target/linux/generic/pending-4.4/250-netfilter_depends.patch deleted file mode 100644 index b39d971a7..000000000 --- a/target/linux/generic/pending-4.4/250-netfilter_depends.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -218,7 +218,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 -@@ -930,7 +929,6 @@ config NETFILTER_XT_TARGET_SECMARK - - config NETFILTER_XT_TARGET_TCPMSS - tristate '"TCPMSS" target support' -- depends on IPV6 || IPV6=n - default m if NETFILTER_ADVANCED=n - ---help--- - This option adds a `TCPMSS' target, which allows you to alter the diff --git a/target/linux/generic/pending-4.4/251-sound_kconfig.patch b/target/linux/generic/pending-4.4/251-sound_kconfig.patch deleted file mode 100644 index 4cb67adc7..000000000 --- a/target/linux/generic/pending-4.4/251-sound_kconfig.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/sound/core/Kconfig -+++ b/sound/core/Kconfig -@@ -16,13 +16,13 @@ config SND_DMAENGINE_PCM - tristate - - config SND_HWDEP -- tristate -+ tristate "Sound hardware support" - - config SND_RAWMIDI - tristate - - config SND_COMPRESS_OFFLOAD -- tristate -+ tristate "Compression offloading support" - - # To be effective this also requires INPUT - users should say: - # select SND_JACK if INPUT=y || INPUT=SND diff --git a/target/linux/generic/pending-4.4/252-mv_cesa_depends.patch b/target/linux/generic/pending-4.4/252-mv_cesa_depends.patch deleted file mode 100644 index f54f3c7fc..000000000 --- a/target/linux/generic/pending-4.4/252-mv_cesa_depends.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/crypto/Kconfig -+++ b/drivers/crypto/Kconfig -@@ -163,6 +163,7 @@ config CRYPTO_DEV_MV_CESA - tristate "Marvell's Cryptographic Engine" - depends on PLAT_ORION - select CRYPTO_AES -+ select CRYPTO_HASH2 - select CRYPTO_BLKCIPHER - select CRYPTO_HASH - select SRAM diff --git a/target/linux/generic/pending-4.4/253-ssb_b43_default_on.patch b/target/linux/generic/pending-4.4/253-ssb_b43_default_on.patch deleted file mode 100644 index 29d2a41a3..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/254-textsearch_kconfig_hacks.patch b/target/linux/generic/pending-4.4/254-textsearch_kconfig_hacks.patch deleted file mode 100644 index 12cedbed1..000000000 --- a/target/linux/generic/pending-4.4/254-textsearch_kconfig_hacks.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/lib/Kconfig -+++ b/lib/Kconfig -@@ -334,16 +334,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/pending-4.4/255-lib80211_kconfig_hacks.patch b/target/linux/generic/pending-4.4/255-lib80211_kconfig_hacks.patch deleted file mode 100644 index be75806e6..000000000 --- a/target/linux/generic/pending-4.4/255-lib80211_kconfig_hacks.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/wireless/Kconfig -+++ b/net/wireless/Kconfig -@@ -201,7 +201,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 -@@ -210,13 +210,16 @@ config LIB80211 - Drivers should select this themselves if needed. - - config LIB80211_CRYPT_WEP -- tristate -+ tristate "LIB80211_CRYPT_WEP" -+ select LIB80211 - - config LIB80211_CRYPT_CCMP -- tristate -+ tristate "LIB80211_CRYPT_CCMP" -+ select LIB80211 - - config LIB80211_CRYPT_TKIP -- tristate -+ tristate "LIB80211_CRYPT_TKIP" -+ select LIB80211 - - config LIB80211_DEBUG - bool "lib80211 debugging messages" diff --git a/target/linux/generic/pending-4.4/256-crypto_add_kconfig_prompts.patch b/target/linux/generic/pending-4.4/256-crypto_add_kconfig_prompts.patch deleted file mode 100644 index fb5d5dc4b..000000000 --- a/target/linux/generic/pending-4.4/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 - -@@ -52,7 +52,7 @@ config CRYPTO_AEAD2 - select CRYPTO_RNG2 - - config CRYPTO_BLKCIPHER -- tristate -+ tristate "BLKCIPHER" - select CRYPTO_BLKCIPHER2 - select CRYPTO_ALGAPI - -@@ -63,7 +63,7 @@ config CRYPTO_BLKCIPHER2 - select CRYPTO_WORKQUEUE - - config CRYPTO_HASH -- tristate -+ tristate "HASH" - select CRYPTO_HASH2 - select CRYPTO_ALGAPI - -@@ -72,7 +72,7 @@ config CRYPTO_HASH2 - select CRYPTO_ALGAPI2 - - config CRYPTO_RNG -- tristate -+ tristate "RNG" - select CRYPTO_RNG2 - select CRYPTO_ALGAPI - diff --git a/target/linux/generic/pending-4.4/257-wireless_ext_kconfig_hack.patch b/target/linux/generic/pending-4.4/257-wireless_ext_kconfig_hack.patch deleted file mode 100644 index daac5898a..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/258-netfilter_netlink_kconfig_hack.patch b/target/linux/generic/pending-4.4/258-netfilter_netlink_kconfig_hack.patch deleted file mode 100644 index 4206c9a74..000000000 --- a/target/linux/generic/pending-4.4/258-netfilter_netlink_kconfig_hack.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/netfilter/Kconfig -+++ b/net/netfilter/Kconfig -@@ -10,7 +10,7 @@ config NETFILTER_INGRESS - infrastructure. - - config NETFILTER_NETLINK -- tristate -+ tristate "Netfilter NFNETLINK interface" - - config NETFILTER_NETLINK_ACCT - tristate "Netfilter NFACCT over NFNETLINK interface" diff --git a/target/linux/generic/pending-4.4/259-regmap_dynamic.patch b/target/linux/generic/pending-4.4/259-regmap_dynamic.patch deleted file mode 100644 index 42a972856..000000000 --- a/target/linux/generic/pending-4.4/259-regmap_dynamic.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- a/drivers/base/regmap/Kconfig -+++ b/drivers/base/regmap/Kconfig -@@ -3,9 +3,8 @@ - # subsystems should select the appropriate symbols. - - config REGMAP -- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) - select IRQ_DOMAIN if REGMAP_IRQ -- bool -+ tristate "Regmap" - - config REGCACHE_COMPRESSED - select LZO_COMPRESS -@@ -16,19 +15,25 @@ config REGMAP_AC97 - 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 -@@ -65,7 +65,7 @@ struct reg_sequence { - unsigned int delay_us; - }; - --#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,10 +1,14 @@ - # 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-flat.o --obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o --obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o -+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o -+ifdef CONFIG_DEBUG_FS -+regmap-core-objs += regmap-debugfs.o -+endif -+ifdef CONFIG_REGCACHE_COMPRESSED -+regmap-core-objs += regcache-lzo.o -+endif -+obj-$(CONFIG_REGMAP) += regmap-core.o - obj-$(CONFIG_REGMAP_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 -@@ -2869,3 +2870,5 @@ static int __init regmap_initcall(void) - return 0; - } - postcore_initcall(regmap_initcall); -+ -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-4.4/260-crypto_test_dependencies.patch b/target/linux/generic/pending-4.4/260-crypto_test_dependencies.patch deleted file mode 100644 index 54b8730a9..000000000 --- a/target/linux/generic/pending-4.4/260-crypto_test_dependencies.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -118,12 +118,12 @@ config CRYPTO_MANAGER - cbc(aes). - - 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_AKCIPHER2 -+ def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS) -+ 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 -+ select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS - - config CRYPTO_USER - tristate "Userspace cryptographic algorithm configuration" -@@ -136,7 +136,6 @@ config CRYPTO_USER - config CRYPTO_MANAGER_DISABLE_TESTS - bool "Disable run-time self tests" - default y -- depends on CRYPTO_MANAGER2 - help - Disable run-time self tests that normally take place at - algorithm registration. ---- a/crypto/algboss.c -+++ b/crypto/algboss.c -@@ -248,12 +248,16 @@ 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) == - CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize : - alg->cra_ablkcipher.ivsize)) - type |= CRYPTO_ALG_TESTED; -+#endif - - param->type = type; - diff --git a/target/linux/generic/pending-4.4/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch b/target/linux/generic/pending-4.4/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch deleted file mode 100644 index 06ad9bba9..000000000 --- a/target/linux/generic/pending-4.4/270-uapi-libc-compat-add-fallback-for-unsupported-libcs.patch +++ /dev/null @@ -1,130 +0,0 @@ -From c6bdd0d302119819de72439972d0462c26ef9eda Mon Sep 17 00:00:00 2001 -From: Felix Janda -Date: Sun, 12 Nov 2017 13:30:17 -0500 -Subject: uapi libc compat: add fallback for unsupported libcs - -libc-compat.h aims to prevent symbol collisions between uapi and libc -headers for each supported libc. This requires continuous coordination -between them. - -The goal of this commit is to improve the situation for libcs (such as -musl) which are not yet supported and/or do not wish to be explicitly -supported, while not affecting supported libcs. More precisely, with -this commit, unsupported libcs can request the suppression of any -specific uapi definition by defining the correspondings _UAPI_DEF_* -macro as 0. This can fix symbol collisions for them, as long as the -libc headers are included before the uapi headers. Inclusion in the -other order is outside the scope of this commit. - -All infrastructure in order to enable this fallback for unsupported -libcs is already in place, except that libc-compat.h unconditionally -defines all _UAPI_DEF_* macros to 1 for all unsupported libcs so that -any previous definitions are ignored. In order to fix this, this commit -merely makes these definitions conditional. - -This commit together with the musl libc commit - -http://git.musl-libc.org/cgit/musl/commit/?id=04983f2272382af92eb8f8838964ff944fbb8258 - -fixes for example the following compiler errors when is -included after musl's : - -./linux/in6.h:32:8: error: redefinition of 'struct in6_addr' -./linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6' -./linux/in6.h:59:8: error: redefinition of 'struct ipv6_mreq' - -The comments referencing glibc are still correct, but this file is not -only used for glibc any more. - -Signed-off-by: Felix Janda -Reviewed-by: Hauke Mehrtens ---- - include/uapi/linux/libc-compat.h | 55 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 54 insertions(+), 1 deletion(-) - ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -148,39 +148,82 @@ - - /* If we did not see any headers from any supported C libraries, - * or we are being included in the kernel, then define everything -- * that we need. */ -+ * that we need. Check for previous __UAPI_* definitions to give -+ * unsupported C libraries a way to opt out of any kernel definition. */ - #else /* !defined(__GLIBC__) */ - - /* Definitions for if.h */ -+#ifndef __UAPI_DEF_IF_IFCONF - #define __UAPI_DEF_IF_IFCONF 1 -+#endif -+#ifndef __UAPI_DEF_IF_IFMAP - #define __UAPI_DEF_IF_IFMAP 1 -+#endif -+#ifndef __UAPI_DEF_IF_IFNAMSIZ - #define __UAPI_DEF_IF_IFNAMSIZ 1 -+#endif -+#ifndef __UAPI_DEF_IF_IFREQ - #define __UAPI_DEF_IF_IFREQ 1 -+#endif - /* Everything up to IFF_DYNAMIC, matches net/if.h until glibc 2.23 */ -+#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS - #define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 -+#endif - /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */ -+#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO - #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 -+#endif - - /* Definitions for in.h */ -+#ifndef __UAPI_DEF_IN_ADDR - #define __UAPI_DEF_IN_ADDR 1 -+#endif -+#ifndef __UAPI_DEF_IN_IPPROTO - #define __UAPI_DEF_IN_IPPROTO 1 -+#endif -+#ifndef __UAPI_DEF_IN_PKTINFO - #define __UAPI_DEF_IN_PKTINFO 1 -+#endif -+#ifndef __UAPI_DEF_IP_MREQ - #define __UAPI_DEF_IP_MREQ 1 -+#endif -+#ifndef __UAPI_DEF_SOCKADDR_IN - #define __UAPI_DEF_SOCKADDR_IN 1 -+#endif -+#ifndef __UAPI_DEF_IN_CLASS - #define __UAPI_DEF_IN_CLASS 1 -+#endif - - /* Definitions for in6.h */ -+#ifndef __UAPI_DEF_IN6_ADDR - #define __UAPI_DEF_IN6_ADDR 1 -+#endif -+#ifndef __UAPI_DEF_IN6_ADDR_ALT - #define __UAPI_DEF_IN6_ADDR_ALT 1 -+#endif -+#ifndef __UAPI_DEF_SOCKADDR_IN6 - #define __UAPI_DEF_SOCKADDR_IN6 1 -+#endif -+#ifndef __UAPI_DEF_IPV6_MREQ - #define __UAPI_DEF_IPV6_MREQ 1 -+#endif -+#ifndef __UAPI_DEF_IPPROTO_V6 - #define __UAPI_DEF_IPPROTO_V6 1 -+#endif -+#ifndef __UAPI_DEF_IPV6_OPTIONS - #define __UAPI_DEF_IPV6_OPTIONS 1 -+#endif -+#ifndef __UAPI_DEF_IN6_PKTINFO - #define __UAPI_DEF_IN6_PKTINFO 1 -+#endif -+#ifndef __UAPI_DEF_IP6_MTUINFO - #define __UAPI_DEF_IP6_MTUINFO 1 -+#endif - - /* Definitions for xattr.h */ -+#ifndef __UAPI_DEF_XATTR - #define __UAPI_DEF_XATTR 1 -+#endif - - #endif /* __GLIBC__ */ - diff --git a/target/linux/generic/pending-4.4/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch b/target/linux/generic/pending-4.4/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch deleted file mode 100644 index 21494b925..000000000 --- a/target/linux/generic/pending-4.4/272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 649affd04813c43e0a72886517fcfccd63230981 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Mon, 29 Jun 2015 16:53:03 +0200 -Subject: uapi/if_ether.h: prevent redefinition of struct ethhdr - -Musl provides its own ethhdr struct definition. Add a guard to prevent -its definition of the appropriate musl header has already been included. - -glibc does not implement this header, but when glibc will implement this -they can just define __UAPI_DEF_ETHHDR 0 to make it work with the -kernel. - -Signed-off-by: Hauke Mehrtens ---- - include/uapi/linux/if_ether.h | 3 +++ - include/uapi/linux/libc-compat.h | 6 ++++++ - 2 files changed, 9 insertions(+) - ---- a/include/uapi/linux/if_ether.h -+++ b/include/uapi/linux/if_ether.h -@@ -22,6 +22,7 @@ - #define _UAPI_LINUX_IF_ETHER_H - - #include -+#include - - /* - * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble -@@ -135,11 +136,13 @@ - * This is an Ethernet frame header. - */ - -+#if __UAPI_DEF_ETHHDR - struct ethhdr { - unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ - unsigned char h_source[ETH_ALEN]; /* source ether addr */ - __be16 h_proto; /* packet type ID field */ - } __attribute__((packed)); -+#endif - - - #endif /* _UAPI_LINUX_IF_ETHER_H */ ---- a/include/uapi/linux/libc-compat.h -+++ b/include/uapi/linux/libc-compat.h -@@ -227,4 +227,10 @@ - - #endif /* __GLIBC__ */ - -+/* Definitions for if_ether.h */ -+/* allow libcs like musl to deactivate this, glibc does not implement this. */ -+#ifndef __UAPI_DEF_ETHHDR -+#define __UAPI_DEF_ETHHDR 1 -+#endif -+ - #endif /* _UAPI_LIBC_COMPAT_H */ diff --git a/target/linux/generic/pending-4.4/280-rfkill-stubs.patch b/target/linux/generic/pending-4.4/280-rfkill-stubs.patch deleted file mode 100644 index 96a98e219..000000000 --- a/target/linux/generic/pending-4.4/280-rfkill-stubs.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- a/net/rfkill/Kconfig -+++ b/net/rfkill/Kconfig -@@ -1,7 +1,11 @@ - # - # RF switch subsystem configuration - # --menuconfig RFKILL -+config RFKILL -+ bool -+ default y -+ -+menuconfig RFKILL_FULL - tristate "RF switch subsystem support" - help - Say Y here if you want to have control over RF switches -@@ -13,19 +17,19 @@ menuconfig RFKILL - # LED trigger support - config RFKILL_LEDS - bool -- depends on RFKILL -+ depends on RFKILL_FULL - depends on LEDS_TRIGGERS = y || RFKILL = LEDS_TRIGGERS - default y - - config RFKILL_INPUT - bool "RF switch input support" if EXPERT -- depends on RFKILL -+ depends on RFKILL_FULL - depends on INPUT = y || RFKILL = INPUT - default y if !EXPERT - - config RFKILL_REGULATOR - tristate "Generic rfkill regulator driver" -- depends on RFKILL || !RFKILL -+ depends on RFKILL_FULL || !RFKILL_FULL - depends on REGULATOR - help - This options enable controlling radio transmitters connected to -@@ -36,7 +40,7 @@ config RFKILL_REGULATOR - - config RFKILL_GPIO - tristate "GPIO RFKILL driver" -- depends on RFKILL -+ depends on RFKILL_FULL - depends on GPIOLIB || COMPILE_TEST - default n - help ---- a/net/rfkill/Makefile -+++ b/net/rfkill/Makefile -@@ -4,6 +4,6 @@ - - rfkill-y += core.o - rfkill-$(CONFIG_RFKILL_INPUT) += input.o --obj-$(CONFIG_RFKILL) += rfkill.o -+obj-$(CONFIG_RFKILL_FULL) += rfkill.o - obj-$(CONFIG_RFKILL_REGULATOR) += rfkill-regulator.o - obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o ---- a/net/Makefile -+++ b/net/Makefile -@@ -49,7 +49,7 @@ obj-$(CONFIG_MAC80211) += mac80211/ - obj-$(CONFIG_TIPC) += tipc/ - obj-$(CONFIG_NETLABEL) += netlabel/ - obj-$(CONFIG_IUCV) += iucv/ --obj-$(CONFIG_RFKILL) += rfkill/ -+obj-$(CONFIG_RFKILL_FULL) += rfkill/ - obj-$(CONFIG_NET_9P) += 9p/ - obj-$(CONFIG_CAIF) += caif/ - ifneq ($(CONFIG_DCB),) ---- a/include/linux/rfkill.h -+++ b/include/linux/rfkill.h -@@ -64,7 +64,7 @@ struct rfkill_ops { - int (*set_block)(void *data, bool blocked); - }; - --#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) -+#if defined(CONFIG_RFKILL_FULL) || defined(CONFIG_RFKILL_FULL_MODULE) - /** - * rfkill_alloc - allocate rfkill structure - * @name: name of the struct -- the string is not copied internally diff --git a/target/linux/generic/pending-4.4/300-mips_expose_boot_raw.patch b/target/linux/generic/pending-4.4/300-mips_expose_boot_raw.patch deleted file mode 100644 index 0980c26d5..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -1033,9 +1033,6 @@ config FW_ARC - config ARCH_MAY_HAVE_PC_FDC - bool - --config BOOT_RAW -- bool -- - config CEVT_BCM1480 - bool - -@@ -2793,6 +2790,18 @@ choice - bool "Bootloader kernel arguments if available" - endchoice - -+config BOOT_RAW -+ bool "Enable the kernel to be executed from the load address" -+ default n -+ help -+ Allow the kernel to be executed from the load address for -+ bootloaders which cannot read the ELF format. This places -+ a jump to start_kernel at the load address. -+ -+ If unsure, say N. -+ -+ -+ - endmenu - - config LOCKDEP_SUPPORT diff --git a/target/linux/generic/pending-4.4/301-mips_image_cmdline_hack.patch b/target/linux/generic/pending-4.4/301-mips_image_cmdline_hack.patch deleted file mode 100644 index 625a84c81..000000000 --- a/target/linux/generic/pending-4.4/301-mips_image_cmdline_hack.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -1124,6 +1124,10 @@ config SYNC_R4K - config MIPS_MACHINE - def_bool n - -+config IMAGE_CMDLINE_HACK -+ bool "OpenWrt specific image command line hack" -+ default n -+ - config NO_IOPORT_MAP - def_bool n - ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -80,6 +80,12 @@ FEXPORT(__kernel_entry) - j kernel_entry - #endif - -+#ifdef CONFIG_IMAGE_CMDLINE_HACK -+ .ascii "CMDLINE:" -+EXPORT(__image_cmdline) -+ .fill 0x400 -+#endif /* CONFIG_IMAGE_CMDLINE_HACK */ -+ - __REF - - NESTED(kernel_entry, 16, sp) # kernel entry point diff --git a/target/linux/generic/pending-4.4/302-mips_no_branch_likely.patch b/target/linux/generic/pending-4.4/302-mips_no_branch_likely.patch deleted file mode 100644 index 44c6b04fc..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/304-mips_disable_fpu.patch b/target/linux/generic/pending-4.4/304-mips_disable_fpu.patch deleted file mode 100644 index a08564dce..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -2725,6 +2725,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 -@@ -285,7 +285,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 -@@ -223,8 +223,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/pending-4.4/305-mips_module_reloc.patch b/target/linux/generic/pending-4.4/305-mips_module_reloc.patch deleted file mode 100644 index 944921fff..000000000 --- a/target/linux/generic/pending-4.4/305-mips_module_reloc.patch +++ /dev/null @@ -1,355 +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,36 @@ int module_finalize(const Elf_Ehdr *hdr, - list_add(&me->arch.dbe_list, &dbe_list); - spin_unlock_irq(&dbe_lock); - } -+ -+ /* Get rid of the fixup trampoline if we're running the module -+ * from physically mapped address space */ -+ if (me->arch.phys_plt_offset == 0) { -+ __module_free(me->arch.phys_plt_tbl); -+ me->arch.phys_plt_tbl = NULL; -+ } -+ if (me->arch.virt_plt_offset == 0) { -+ __module_free(me->arch.virt_plt_tbl); -+ me->arch.virt_plt_tbl = NULL; -+ } -+ - return 0; - } - -+void module_arch_freeing_init(struct module *mod) -+{ -+ if (mod->state == MODULE_STATE_LIVE) -+ return; -+ -+ if (mod->arch.phys_plt_tbl) { -+ __module_free(mod->arch.phys_plt_tbl); -+ mod->arch.phys_plt_tbl = NULL; -+ } -+ if (mod->arch.virt_plt_tbl) { -+ __module_free(mod->arch.virt_plt_tbl); -+ mod->arch.virt_plt_tbl = NULL; -+ } -+} -+ - void module_arch_cleanup(struct module *mod) - { - spin_lock_irq(&dbe_lock); diff --git a/target/linux/generic/pending-4.4/306-mips_mem_functions_performance.patch b/target/linux/generic/pending-4.4/306-mips_mem_functions_performance.patch deleted file mode 100644 index 981867742..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/307-mips_highmem_offset.patch b/target/linux/generic/pending-4.4/307-mips_highmem_offset.patch deleted file mode 100644 index 5a7dc9cee..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/308-mips32r2_tune.patch b/target/linux/generic/pending-4.4/308-mips32r2_tune.patch deleted file mode 100644 index f4ab89ef2..000000000 --- a/target/linux/generic/pending-4.4/308-mips32r2_tune.patch +++ /dev/null @@ -1,17 +0,0 @@ -Add -mtune=34kc to MIPS CFLAGS when building for mips32r2 -This provides a good tradeoff across at least 24Kc-74Kc, while also -producing smaller code. - -Signed-off-by: Felix Fietkau - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -145,7 +145,7 @@ cflags-$(CONFIG_CPU_R4X00) += -march=r46 - cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ - -Wa,-mips32 -Wa,--trap --cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ -+cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2 -mtune=34kc,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ - -Wa,-mips32r2 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap - cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \ diff --git a/target/linux/generic/pending-4.4/310-arm_module_unresolved_weak_sym.patch b/target/linux/generic/pending-4.4/310-arm_module_unresolved_weak_sym.patch deleted file mode 100644 index 327a47520..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -88,6 +88,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons - return -ENOEXEC; - } - -+ if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) && -+ ELF_ST_BIND(sym->st_info) == STB_WEAK) -+ continue; -+ - loc = dstsec->sh_addr + rel->r_offset; - - switch (ELF32_R_TYPE(rel->r_info)) { diff --git a/target/linux/generic/pending-4.4/320-ppc4xx_optimization.patch b/target/linux/generic/pending-4.4/320-ppc4xx_optimization.patch deleted file mode 100644 index c1ce37da2..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -205,7 +205,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/pending-4.4/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/pending-4.4/321-powerpc_crtsavres_prereq.patch deleted file mode 100644 index a1773feb3..000000000 --- a/target/linux/generic/pending-4.4/321-powerpc_crtsavres_prereq.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -167,7 +167,6 @@ CPP = $(CC) -E $(KBUILD_CFLAGS) - - CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__ - --KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o - - ifeq ($(CONFIG_476FPE_ERR46),y) - KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ diff --git a/target/linux/generic/pending-4.4/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch b/target/linux/generic/pending-4.4/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch deleted file mode 100644 index a69d197e6..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/331-arc-remove-dependency-on-DEVTMPFS.patch b/target/linux/generic/pending-4.4/331-arc-remove-dependency-on-DEVTMPFS.patch deleted file mode 100644 index 48b3f9b42..000000000 --- a/target/linux/generic/pending-4.4/331-arc-remove-dependency-on-DEVTMPFS.patch +++ /dev/null @@ -1,31 +0,0 @@ -From adfbf9e6cad93281cffceab078e7f6f2a8e094f9 Mon Sep 17 00:00:00 2001 -From: Alexey Brodkin -Date: Thu, 13 Aug 2015 01:56:02 +0300 -Subject: [PATCH 1/2] openwrt: arc - remove dependency on DEVTMPFS - -OpenWRT builds initramfs so that it doesn't require DEVTMPFS so dropping -this dependency. That helps to escape 2 separate kernel rebuilds with -and without initramfs. - -2 builds happen because OpenWRT first builds kernel and later modules. -When building entire kernel with simple "make" INITRAMFS sets to a real -value and so was triggering DEVTMPFS selection. Then when building only -modules with "make modules" command INITRAMFS is zeroed and so kernel -config was changing that lead to full kernel rebuild. - -Signed-off-by: Alexey Brodkin ---- - arch/arc/Kconfig | 2 -- - 1 file changed, 2 deletions(-) - ---- a/arch/arc/Kconfig -+++ b/arch/arc/Kconfig -@@ -12,8 +12,6 @@ config ARC - select BUILDTIME_EXTABLE_SORT - select COMMON_CLK - select CLONE_BACKWARDS -- # ARC Busybox based initramfs absolutely relies on DEVTMPFS for /dev -- select DEVTMPFS if !INITRAMFS_SOURCE="" - select GENERIC_ATOMIC64 - select GENERIC_CLOCKEVENTS - select GENERIC_FIND_FIRST_BIT diff --git a/target/linux/generic/pending-4.4/332-arc-add-OWRTDTB-section.patch b/target/linux/generic/pending-4.4/332-arc-add-OWRTDTB-section.patch deleted file mode 100644 index 5a2b67cfc..000000000 --- a/target/linux/generic/pending-4.4/332-arc-add-OWRTDTB-section.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 690e7f2cad271595ff68cace1c45fb10779bde41 Mon Sep 17 00:00:00 2001 -From: Alexey Brodkin -Date: Fri, 15 Jan 2016 00:34:01 +0300 -Subject: [PATCH 2/2] openwrt: arc - add OWRTDTB section - -This change allows OpenWRT to patch resulting kernel binary with -external .dtb. - -That allows us to re-use exactky the same vmlinux on different boards -given its ARC core configurations match (at least cache line sizes etc). - -""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external -.dtb right after it, keeping the string in place. - -Signed-off-by: Alexey Brodkin ---- - arch/arc/kernel/head.S | 10 ++++++++++ - arch/arc/kernel/setup.c | 4 +++- - arch/arc/kernel/vmlinux.lds.S | 13 +++++++++++++ - 3 files changed, 26 insertions(+), 1 deletion(-) - ---- a/arch/arc/kernel/head.S -+++ b/arch/arc/kernel/head.S -@@ -49,6 +49,16 @@ - 1: - .endm - -+; Here "patch-dtb" will embed external .dtb -+; Note "patch-dtb" searches for ASCII "OWRTDTB:" string -+; and pastes .dtb right after it, hense the string precedes -+; __image_dtb symbol. -+ .section .owrt, "aw",@progbits -+ .ascii "OWRTDTB:" -+ENTRY(__image_dtb) -+ .fill 0x4000 -+END(__image_dtb) -+ - .section .init.text, "ax",@progbits - - ;---------------------------------------------------------------- ---- a/arch/arc/kernel/setup.c -+++ b/arch/arc/kernel/setup.c -@@ -366,6 +366,8 @@ static inline int is_kernel(unsigned lon - return 0; - } - -+extern struct boot_param_header __image_dtb; -+ - void __init setup_arch(char **cmdline_p) - { - #ifdef CONFIG_ARC_UBOOT_SUPPORT -@@ -379,7 +381,7 @@ void __init setup_arch(char **cmdline_p) - #endif - { - /* No, so try the embedded one */ -- machine_desc = setup_machine_fdt(__dtb_start); -+ machine_desc = setup_machine_fdt(&__image_dtb); - if (!machine_desc) - panic("Embedded DT invalid\n"); - ---- a/arch/arc/kernel/vmlinux.lds.S -+++ b/arch/arc/kernel/vmlinux.lds.S -@@ -30,6 +30,19 @@ SECTIONS - - . = CONFIG_LINUX_LINK_BASE; - -+ /* -+ * In OpenWRT we want to patch built binary embedding .dtb of choice. -+ * This is implemented with "patch-dtb" utility which searches for -+ * "OWRTDTB:" string in first 16k of image and if it is found -+ * copies .dtb right after mentioned string. -+ * -+ * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it. -+ */ -+ .owrt : { -+ *(.owrt) -+ . = ALIGN(PAGE_SIZE); -+ } -+ - _int_vec_base_lds = .; - .vector : { - *(.vector) diff --git a/target/linux/generic/pending-4.4/333-arc-enable-unaligned-access-in-kernel-mode.patch b/target/linux/generic/pending-4.4/333-arc-enable-unaligned-access-in-kernel-mode.patch deleted file mode 100644 index 082f525f1..000000000 --- a/target/linux/generic/pending-4.4/333-arc-enable-unaligned-access-in-kernel-mode.patch +++ /dev/null @@ -1,26 +0,0 @@ -From af737b55fc7c61f17da9ae89fba536e0a9338e98 Mon Sep 17 00:00:00 2001 -From: Alexey Brodkin -Date: Mon, 14 Mar 2016 17:26:34 +0300 -Subject: [PATCH] arc: enable unaligned access in kernel mode - -This enables misaligned access handling even in kernel mode. -Some wireless drivers (ath9k-htc and mt7601u) use misaligned accesses -here and there and to cope with that without fixing stuff in the drivers -we're just gracefully handling it on ARC. - -Signed-off-by: Alexey Brodkin ---- - arch/arc/kernel/unaligned.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arc/kernel/unaligned.c -+++ b/arch/arc/kernel/unaligned.c -@@ -206,7 +206,7 @@ int misaligned_fixup(unsigned long addre - char buf[TASK_COMM_LEN]; - - /* handle user mode only and only if enabled by sysadmin */ -- if (!user_mode(regs) || !unaligned_enabled) -+ if (!unaligned_enabled) - return 1; - - if (no_unaligned_warning) { diff --git a/target/linux/generic/pending-4.4/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.4/400-mtd-add-rootfs-split-support.patch deleted file mode 100644 index 7925caf97..000000000 --- a/target/linux/generic/pending-4.4/400-mtd-add-rootfs-split-support.patch +++ /dev/null @@ -1,113 +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,6 +49,8 @@ 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. -@@ -612,6 +616,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); - -@@ -644,6 +649,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 -@@ -675,6 +709,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/pending-4.4/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.4/401-mtd-add-support-for-different-partition-parser-types.patch deleted file mode 100644 index 7695d56de..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -740,6 +740,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); -@@ -868,6 +892,38 @@ int parse_mtd_partitions(struct mtd_info - return err; - } - -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct mtd_part_parser *prev = NULL; -+ int ret = 0; -+ -+ while (1) { -+ struct mtd_part_parser *parser; -+ -+ parser = get_partition_parser_by_type(type, prev); -+ if (!parser) -+ break; -+ -+ ret = (*parser->parse_fn)(master, pparts, data); -+ -+ if (ret > 0) { -+ put_partition_parser(parser); -+ printk(KERN_NOTICE -+ "%d %s partitions found on MTD device %s\n", -+ ret, parser->name, master->name); -+ break; -+ } -+ -+ prev = parser; -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); -+ - int mtd_is_partition(const struct mtd_info *mtd) - { - struct mtd_part *part; ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -68,12 +68,17 @@ struct mtd_part_parser_data { - * Functions dealing with the various ways of partitioning the space - */ - -+enum mtd_parser_type { -+ MTD_PARSER_TYPE_DEVICE = 0, -+}; -+ - struct mtd_part_parser { - struct list_head list; - struct module *owner; - const char *name; - int (*parse_fn)(struct mtd_info *, struct mtd_partition **, - struct mtd_part_parser_data *); -+ enum mtd_parser_type type; - }; - - extern void register_mtd_parser(struct mtd_part_parser *parser); -@@ -87,4 +92,9 @@ uint64_t mtd_get_device_size(const struc - extern void __weak arch_split_mtd_part(struct mtd_info *master, - const char *name, int offset, int size); - -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data); -+ - #endif diff --git a/target/linux/generic/pending-4.4/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.4/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch deleted file mode 100644 index 2ea2056ba..000000000 --- a/target/linux/generic/pending-4.4/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -649,6 +649,36 @@ 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); -+ } -+ -+ kfree(parts); -+ -+ return nr_parts; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -657,6 +687,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, -@@ -671,6 +702,12 @@ static void mtd_partition_split(struct m - if (rootfs_found) - return; - -+ if (!strcmp(part->mtd.name, "rootfs")) { -+ run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); -+ -+ rootfs_found = 1; -+ } -+ - if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && - config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) - split_firmware(master, part); ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -70,6 +70,8 @@ struct mtd_part_parser_data { - - enum mtd_parser_type { - MTD_PARSER_TYPE_DEVICE = 0, -+ MTD_PARSER_TYPE_ROOTFS, -+ MTD_PARSER_TYPE_FIRMWARE, - }; - - struct mtd_part_parser { diff --git a/target/linux/generic/pending-4.4/403-mtd-hook-mtdsplit-to-Kbuild.patch b/target/linux/generic/pending-4.4/403-mtd-hook-mtdsplit-to-Kbuild.patch deleted file mode 100644 index 0cf1c3855..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.4/404-mtd-add-more-helper-functions.patch deleted file mode 100644 index 3773e1f19..000000000 --- a/target/linux/generic/pending-4.4/404-mtd-add-more-helper-functions.patch +++ /dev/null @@ -1,101 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -454,14 +454,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; -@@ -679,6 +677,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 -@@ -978,6 +987,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/pending-4.4/410-mtd-move-forward-declaration-of-struct-mtd_info.patch b/target/linux/generic/pending-4.4/410-mtd-move-forward-declaration-of-struct-mtd_info.patch deleted file mode 100644 index 78ebbf88c..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.4/411-mtd-partial_eraseblock_write.patch deleted file mode 100644 index 7ab8eb344..000000000 --- a/target/linux/generic/pending-4.4/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); -@@ -236,13 +238,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; - } - -@@ -250,7 +300,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; -@@ -523,17 +591,20 @@ static struct mtd_part *allocate_partiti - if ((slave->mtd.flags & MTD_WRITEABLE) && - mtd_mod_by_eb(slave->offset, &slave->mtd)) { - /* Doesn't start on a boundary of major erase size */ -- /* FIXME: Let it be writable if it is on a boundary of -- * _minor_ erase size though */ -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n", -- part->name); -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ if (((u32) slave->mtd.size) > master->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - if ((slave->mtd.flags & MTD_WRITEABLE) && -- mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { -- slave->mtd.flags &= ~MTD_WRITEABLE; -- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", -- part->name); -+ mtd_mod_by_eb(slave->offset + slave->mtd.size, &slave->mtd)) { -+ slave->mtd.flags |= MTD_ERASE_PARTIAL; -+ -+ if ((u32) slave->mtd.size > master->erasesize) -+ slave->mtd.flags &= ~MTD_WRITEABLE; -+ else -+ slave->mtd.erasesize = slave->mtd.size; - } - - slave->mtd.ecclayout = master->ecclayout; ---- a/include/linux/mtd/mtd.h -+++ b/include/linux/mtd/mtd.h -@@ -55,6 +55,10 @@ struct erase_info { - u_long priv; - u_char state; - struct erase_info *next; -+ -+ u8 *erase_buf; -+ u32 erase_buf_ofs; -+ bool partial_start; - }; - - struct mtd_erase_region_info { diff --git a/target/linux/generic/pending-4.4/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-4.4/412-mtd-partial_eraseblock_unlock.patch deleted file mode 100644 index 990c2aba6..000000000 --- a/target/linux/generic/pending-4.4/412-mtd-partial_eraseblock_unlock.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -337,7 +337,14 @@ static int part_lock(struct mtd_info *mt - static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) - { - struct mtd_part *part = PART(mtd); -- return part->master->_unlock(part->master, ofs + part->offset, len); -+ -+ ofs += part->offset; -+ if (mtd->flags & MTD_ERASE_PARTIAL) { -+ /* round up len to next erasesize and round down offset to prev block */ -+ len = (mtd_div_by_eb(len, part->master) + 1) * part->master->erasesize; -+ ofs &= ~(part->master->erasesize - 1); -+ } -+ return part->master->_unlock(part->master, ofs, len); - } - - static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) diff --git a/target/linux/generic/pending-4.4/420-mtd-redboot_space.patch b/target/linux/generic/pending-4.4/420-mtd-redboot_space.patch deleted file mode 100644 index f74affcef..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/430-mtd-add-myloader-partition-parser.patch b/target/linux/generic/pending-4.4/430-mtd-add-myloader-partition-parser.patch deleted file mode 100644 index a022564e9..000000000 --- a/target/linux/generic/pending-4.4/430-mtd-add-myloader-partition-parser.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -174,6 +174,22 @@ config MTD_BCM47XX_PARTS - This provides partitions parser for devices based on BCM47xx - boards. - -+config MTD_MYLOADER_PARTS -+ tristate "MyLoader partition parsing" -+ depends on ADM5120 || ATH25 || ATH79 -+ ---help--- -+ MyLoader is a bootloader which allows the user to define partitions -+ in flash devices, by putting a table in the second erase block -+ on the device, similar to a partition table. This table gives the -+ offsets and lengths of the user defined partitions. -+ -+ If you need code which can detect and parse these tables, and -+ register MTD 'partitions' corresponding to each image detected, -+ enable this option. -+ -+ You will still need the parsing functions to be called by the driver -+ for your particular device. It won't happen automatically. -+ - comment "User Modules And Translation Layers" - - # ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -15,6 +15,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o -+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o - - # 'Users' - code which presents functionality to userspace. - obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o diff --git a/target/linux/generic/pending-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch deleted file mode 100644 index 379e551b7..000000000 --- a/target/linux/generic/pending-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ /dev/null @@ -1,91 +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 -@@ -62,6 +62,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) - { -@@ -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; - -@@ -110,21 +139,25 @@ static int bcm47xxpart_parse_trx(struct - - /* 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++; - } - - 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++; - } - - 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/pending-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/pending-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch deleted file mode 100644 index a19e943ef..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -39,6 +39,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 -@@ -297,6 +298,15 @@ static int bcm47xxpart_parse(struct mtd_ - MTD_WRITEABLE); - continue; - } -+ -+ /* T_Meter */ -+ if ((le32_to_cpu(buf[0x000 / 4]) & 0xFFFF0000) == T_METER_MAGIC && -+ (le32_to_cpu(buf[0x030 / 4]) & 0xFFFF0000) == T_METER_MAGIC && -+ (le32_to_cpu(buf[0x060 / 4]) & 0xFFFF0000) == T_METER_MAGIC) { -+ bcm47xxpart_add_part(&parts[curr_part++], "T_Meter", offset, -+ MTD_WRITEABLE); -+ continue; -+ } - - /* TRX */ - if (buf[0x000 / 4] == TRX_MAGIC) { diff --git a/target/linux/generic/pending-4.4/440-block2mtd_init.patch b/target/linux/generic/pending-4.4/440-block2mtd_init.patch deleted file mode 100644 index f2e62b440..000000000 --- a/target/linux/generic/pending-4.4/440-block2mtd_init.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -219,7 +220,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; -@@ -227,6 +228,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) -@@ -283,13 +285,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; -@@ -302,7 +307,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; - } -@@ -310,8 +319,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: -@@ -384,7 +392,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; -@@ -398,7 +406,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) { -@@ -424,8 +432,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; - } -@@ -459,7 +469,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic/pending-4.4/441-block2mtd_probe.patch b/target/linux/generic/pending-4.4/441-block2mtd_probe.patch deleted file mode 100644 index ed14537a6..000000000 --- a/target/linux/generic/pending-4.4/441-block2mtd_probe.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/drivers/mtd/devices/block2mtd.c -+++ b/drivers/mtd/devices/block2mtd.c -@@ -392,7 +392,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; -@@ -406,7 +406,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) { -@@ -435,6 +435,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; -@@ -469,7 +472,7 @@ static int block2mtd_setup(const char *v - - - module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); --MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); -+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,[,]]]\""); - - static int __init block2mtd_init(void) - { diff --git a/target/linux/generic/pending-4.4/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch b/target/linux/generic/pending-4.4/450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch deleted file mode 100644 index b1072047c..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -864,6 +864,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 -@@ -87,7 +87,18 @@ static int plat_nand_probe(struct platfo - } - - /* Scan to find existence of the device */ -- if (nand_scan(&data->mtd, pdata->chip.nr_chips)) { -+ if (nand_scan_ident(&data->mtd, pdata->chip.nr_chips, NULL)) { -+ err = -ENXIO; -+ goto out; -+ } -+ -+ if (pdata->chip.chip_fixup) { -+ err = pdata->chip.chip_fixup(&data->mtd); -+ if (err) -+ goto out; -+ } -+ -+ if (nand_scan_tail(&data->mtd)) { - err = -ENXIO; - goto out; - } diff --git a/target/linux/generic/pending-4.4/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch b/target/linux/generic/pending-4.4/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patch deleted file mode 100644 index 6a2092ce2..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch b/target/linux/generic/pending-4.4/460-mtd-cfi_cmdset_0002-no-erase_suspend.patch deleted file mode 100644 index 68fbd1246..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch b/target/linux/generic/pending-4.4/461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch deleted file mode 100644 index c437a140f..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/pending-4.4/465-m25p80-mx-disable-software-protection.patch deleted file mode 100644 index e81ebbb3f..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -1166,6 +1166,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 || - info->flags & SPI_NOR_HAS_LOCK) { - write_enable(nor); diff --git a/target/linux/generic/pending-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch b/target/linux/generic/pending-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch deleted file mode 100644 index d868a7da2..000000000 --- a/target/linux/generic/pending-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -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) }, -+ { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, 0) }, - { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, - { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, - { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, diff --git a/target/linux/generic/pending-4.4/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/pending-4.4/476-mtd-spi-nor-add-eon-en25q128.patch deleted file mode 100644 index ab805b71d..000000000 --- a/target/linux/generic/pending-4.4/476-mtd-spi-nor-add-eon-en25q128.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -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) }, -+ { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, 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, SECT_4K) }, diff --git a/target/linux/generic/pending-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch b/target/linux/generic/pending-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch deleted file mode 100644 index c2a28a099..000000000 --- a/target/linux/generic/pending-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -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) }, -+ { "mx25u3235f", INFO(0xc22536, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, diff --git a/target/linux/generic/pending-4.4/479-enable_mtd_has_lock_for_f25l32pa.patch b/target/linux/generic/pending-4.4/479-enable_mtd_has_lock_for_f25l32pa.patch deleted file mode 100644 index ec67056c6..000000000 --- a/target/linux/generic/pending-4.4/479-enable_mtd_has_lock_for_f25l32pa.patch +++ /dev/null @@ -1,22 +0,0 @@ -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/pending-4.4/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/pending-4.4/480-mtd-set-rootfs-to-be-root-dev.patch deleted file mode 100644 index d20bd8d4e..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -464,6 +465,15 @@ int add_mtd_device(struct mtd_info *mtd) - of this try_ nonsense, and no bitching about it - either. :) */ - __module_get(THIS_MODULE); -+ -+ if (!strcmp(mtd->name, "rootfs") && -+ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ pr_notice("mtd: device %d (%s) set to be root filesystem\n", -+ mtd->index, mtd->name); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); -+ } -+ - return 0; - - fail_added: diff --git a/target/linux/generic/pending-4.4/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.4/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch deleted file mode 100644 index b15066f75..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -1203,6 +1203,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\n", 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\n", mtd->index); -+ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0); -+ mutex_unlock(&ubi_devices_mutex); -+ if (err < 0) { -+ pr_err("UBI error: cannot attach mtd%d\n", mtd->index); -+ put_mtd_device(mtd); -+ } -+ } -+ } -+} -+ - static int __init ubi_init(void) - { - int err, i, k; -@@ -1286,6 +1329,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/pending-4.4/491-ubi-auto-create-ubiblock-device-for-rootfs.patch b/target/linux/generic/pending-4.4/491-ubi-auto-create-ubiblock-device-for-rootfs.patch deleted file mode 100644 index 462f7f42c..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -636,6 +636,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; -@@ -668,6 +706,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/pending-4.4/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch b/target/linux/generic/pending-4.4/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch deleted file mode 100644 index ab8b8bb0a..000000000 --- a/target/linux/generic/pending-4.4/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 - { - int err = create_dev("/dev/root", ROOT_DEV); diff --git a/target/linux/generic/pending-4.4/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch b/target/linux/generic/pending-4.4/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch deleted file mode 100644 index 9fbfc7992..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -50,6 +50,7 @@ - #include - #include - #include -+#include - - #include "ubi-media.h" - #include "ubi.h" -@@ -447,6 +448,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); -+ } -+ - mutex_unlock(&devices_mutex); - return 0; - diff --git a/target/linux/generic/pending-4.4/494-mtd-ubi-add-EOF-marker-support.patch b/target/linux/generic/pending-4.4/494-mtd-ubi-add-EOF-marker-support.patch deleted file mode 100644 index 749232a39..000000000 --- a/target/linux/generic/pending-4.4/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\n", -+ 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/pending-4.4/530-jffs2_make_lzma_available.patch b/target/linux/generic/pending-4.4/530-jffs2_make_lzma_available.patch deleted file mode 100644 index b75dd0f9f..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -241,6 +241,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)) -@@ -98,6 +108,8 @@ obj-$(CONFIG_LZ4HC_COMPRESS) += lz4/ - obj-$(CONFIG_LZ4_DECOMPRESS) += lz4/ - obj-$(CONFIG_XZ_DEC) += xz/ - obj-$(CONFIG_RAID6_PQ) += raid6/ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma/ -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/ - - lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o - lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o ---- /dev/null -+++ b/lib/lzma/LzFind.c -@@ -0,0 +1,761 @@ -+/* LzFind.c -- Match finder for LZ algorithms -+2009-04-22 : Igor Pavlov : Public domain */ -+ -+#include -+ -+#include "LzFind.h" -+#include "LzHash.h" -+ -+#define kEmptyHashValue 0 -+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF) -+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */ -+#define kNormalizeMask (~(kNormalizeStepMin - 1)) -+#define kMaxHistorySize ((UInt32)3 << 30) -+ -+#define kStartMaxLen 3 -+ -+static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ if (!p->directInput) -+ { -+ alloc->Free(alloc, p->bufferBase); -+ p->bufferBase = 0; -+ } -+} -+ -+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ -+ -+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc) -+{ -+ UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv; -+ if (p->directInput) -+ { -+ p->blockSize = blockSize; -+ return 1; -+ } -+ if (p->bufferBase == 0 || p->blockSize != blockSize) -+ { -+ LzInWindow_Free(p, alloc); -+ p->blockSize = blockSize; -+ p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize); -+ } -+ return (p->bufferBase != 0); -+} -+ -+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } -+ -+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; } -+ -+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue) -+{ -+ p->posLimit -= subValue; -+ p->pos -= subValue; -+ p->streamPos -= subValue; -+} -+ -+static void MatchFinder_ReadBlock(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached || p->result != SZ_OK) -+ return; -+ if (p->directInput) -+ { -+ UInt32 curSize = 0xFFFFFFFF - p->streamPos; -+ if (curSize > p->directInputRem) -+ curSize = (UInt32)p->directInputRem; -+ p->directInputRem -= curSize; -+ p->streamPos += curSize; -+ if (p->directInputRem == 0) -+ p->streamEndWasReached = 1; -+ return; -+ } -+ for (;;) -+ { -+ Byte *dest = p->buffer + (p->streamPos - p->pos); -+ size_t size = (p->bufferBase + p->blockSize - dest); -+ if (size == 0) -+ return; -+ p->result = p->stream->Read(p->stream, dest, &size); -+ if (p->result != SZ_OK) -+ return; -+ if (size == 0) -+ { -+ p->streamEndWasReached = 1; -+ return; -+ } -+ p->streamPos += (UInt32)size; -+ if (p->streamPos - p->pos > p->keepSizeAfter) -+ return; -+ } -+} -+ -+void MatchFinder_MoveBlock(CMatchFinder *p) -+{ -+ memmove(p->bufferBase, -+ p->buffer - p->keepSizeBefore, -+ (size_t)(p->streamPos - p->pos + p->keepSizeBefore)); -+ p->buffer = p->bufferBase + p->keepSizeBefore; -+} -+ -+int MatchFinder_NeedMove(CMatchFinder *p) -+{ -+ if (p->directInput) -+ return 0; -+ /* if (p->streamEndWasReached) return 0; */ -+ return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter); -+} -+ -+void MatchFinder_ReadIfRequired(CMatchFinder *p) -+{ -+ if (p->streamEndWasReached) -+ return; -+ if (p->keepSizeAfter >= p->streamPos - p->pos) -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p) -+{ -+ if (MatchFinder_NeedMove(p)) -+ MatchFinder_MoveBlock(p); -+ MatchFinder_ReadBlock(p); -+} -+ -+static void MatchFinder_SetDefaultSettings(CMatchFinder *p) -+{ -+ p->cutValue = 32; -+ p->btMode = 1; -+ p->numHashBytes = 4; -+ p->bigHash = 0; -+} -+ -+#define kCrcPoly 0xEDB88320 -+ -+void MatchFinder_Construct(CMatchFinder *p) -+{ -+ UInt32 i; -+ p->bufferBase = 0; -+ p->directInput = 0; -+ p->hash = 0; -+ MatchFinder_SetDefaultSettings(p); -+ -+ for (i = 0; i < 256; i++) -+ { -+ UInt32 r = i; -+ int j; -+ for (j = 0; j < 8; j++) -+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1)); -+ p->crc[i] = r; -+ } -+} -+ -+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->hash); -+ p->hash = 0; -+} -+ -+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc) -+{ -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ LzInWindow_Free(p, alloc); -+} -+ -+static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc) -+{ -+ size_t sizeInBytes = (size_t)num * sizeof(CLzRef); -+ if (sizeInBytes / sizeof(CLzRef) != num) -+ return 0; -+ return (CLzRef *)alloc->Alloc(alloc, sizeInBytes); -+} -+ -+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, -+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter, -+ ISzAlloc *alloc) -+{ -+ UInt32 sizeReserv; -+ if (historySize > kMaxHistorySize) -+ { -+ MatchFinder_Free(p, alloc); -+ return 0; -+ } -+ sizeReserv = historySize >> 1; -+ if (historySize > ((UInt32)2 << 30)) -+ sizeReserv = historySize >> 2; -+ sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); -+ -+ p->keepSizeBefore = historySize + keepAddBufferBefore + 1; -+ p->keepSizeAfter = matchMaxLen + keepAddBufferAfter; -+ /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ -+ if (LzInWindow_Create(p, sizeReserv, alloc)) -+ { -+ UInt32 newCyclicBufferSize = historySize + 1; -+ UInt32 hs; -+ p->matchMaxLen = matchMaxLen; -+ { -+ p->fixedHashSize = 0; -+ if (p->numHashBytes == 2) -+ hs = (1 << 16) - 1; -+ else -+ { -+ hs = historySize - 1; -+ hs |= (hs >> 1); -+ hs |= (hs >> 2); -+ hs |= (hs >> 4); -+ hs |= (hs >> 8); -+ hs >>= 1; -+ hs |= 0xFFFF; /* don't change it! It's required for Deflate */ -+ if (hs > (1 << 24)) -+ { -+ if (p->numHashBytes == 3) -+ hs = (1 << 24) - 1; -+ else -+ hs >>= 1; -+ } -+ } -+ p->hashMask = hs; -+ hs++; -+ if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size; -+ if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size; -+ if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size; -+ hs += p->fixedHashSize; -+ } -+ -+ { -+ UInt32 prevSize = p->hashSizeSum + p->numSons; -+ UInt32 newSize; -+ p->historySize = historySize; -+ p->hashSizeSum = hs; -+ p->cyclicBufferSize = newCyclicBufferSize; -+ p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize); -+ newSize = p->hashSizeSum + p->numSons; -+ if (p->hash != 0 && prevSize == newSize) -+ return 1; -+ MatchFinder_FreeThisClassMemory(p, alloc); -+ p->hash = AllocRefs(newSize, alloc); -+ if (p->hash != 0) -+ { -+ p->son = p->hash + p->hashSizeSum; -+ return 1; -+ } -+ } -+ } -+ MatchFinder_Free(p, alloc); -+ return 0; -+} -+ -+static void MatchFinder_SetLimits(CMatchFinder *p) -+{ -+ UInt32 limit = kMaxValForNormalize - p->pos; -+ UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos; -+ if (limit2 < limit) -+ limit = limit2; -+ limit2 = p->streamPos - p->pos; -+ if (limit2 <= p->keepSizeAfter) -+ { -+ if (limit2 > 0) -+ limit2 = 1; -+ } -+ else -+ limit2 -= p->keepSizeAfter; -+ if (limit2 < limit) -+ limit = limit2; -+ { -+ UInt32 lenLimit = p->streamPos - p->pos; -+ if (lenLimit > p->matchMaxLen) -+ lenLimit = p->matchMaxLen; -+ p->lenLimit = lenLimit; -+ } -+ p->posLimit = p->pos + limit; -+} -+ -+void MatchFinder_Init(CMatchFinder *p) -+{ -+ UInt32 i; -+ for (i = 0; i < p->hashSizeSum; i++) -+ p->hash[i] = kEmptyHashValue; -+ p->cyclicBufferPos = 0; -+ p->buffer = p->bufferBase; -+ p->pos = p->streamPos = p->cyclicBufferSize; -+ p->result = SZ_OK; -+ p->streamEndWasReached = 0; -+ MatchFinder_ReadBlock(p); -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) -+{ -+ return (p->pos - p->historySize - 1) & kNormalizeMask; -+} -+ -+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems) -+{ -+ UInt32 i; -+ for (i = 0; i < numItems; i++) -+ { -+ UInt32 value = items[i]; -+ if (value <= subValue) -+ value = kEmptyHashValue; -+ else -+ value -= subValue; -+ items[i] = value; -+ } -+} -+ -+static void MatchFinder_Normalize(CMatchFinder *p) -+{ -+ UInt32 subValue = MatchFinder_GetSubValue(p); -+ MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons); -+ MatchFinder_ReduceOffsets(p, subValue); -+} -+ -+static void MatchFinder_CheckLimits(CMatchFinder *p) -+{ -+ if (p->pos == kMaxValForNormalize) -+ MatchFinder_Normalize(p); -+ if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos) -+ MatchFinder_CheckAndMoveAndRead(p); -+ if (p->cyclicBufferPos == p->cyclicBufferSize) -+ p->cyclicBufferPos = 0; -+ MatchFinder_SetLimits(p); -+} -+ -+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ son[_cyclicBufferPos] = curMatch; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ return distances; -+ { -+ const Byte *pb = cur - delta; -+ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; -+ if (pb[maxLen] == cur[maxLen] && *pb == *cur) -+ { -+ UInt32 len = 0; -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ return distances; -+ } -+ } -+ } -+ } -+} -+ -+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, -+ UInt32 *distances, UInt32 maxLen) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return distances; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ if (++len != lenLimit && pb[len] == cur[len]) -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ if (maxLen < len) -+ { -+ *distances++ = maxLen = len; -+ *distances++ = delta - 1; -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return distances; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, -+ UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue) -+{ -+ CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1; -+ CLzRef *ptr1 = son + (_cyclicBufferPos << 1); -+ UInt32 len0 = 0, len1 = 0; -+ for (;;) -+ { -+ UInt32 delta = pos - curMatch; -+ if (cutValue-- == 0 || delta >= _cyclicBufferSize) -+ { -+ *ptr0 = *ptr1 = kEmptyHashValue; -+ return; -+ } -+ { -+ CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); -+ const Byte *pb = cur - delta; -+ UInt32 len = (len0 < len1 ? len0 : len1); -+ if (pb[len] == cur[len]) -+ { -+ while (++len != lenLimit) -+ if (pb[len] != cur[len]) -+ break; -+ { -+ if (len == lenLimit) -+ { -+ *ptr1 = pair[0]; -+ *ptr0 = pair[1]; -+ return; -+ } -+ } -+ } -+ if (pb[len] < cur[len]) -+ { -+ *ptr1 = curMatch; -+ ptr1 = pair + 1; -+ curMatch = *ptr1; -+ len1 = len; -+ } -+ else -+ { -+ *ptr0 = curMatch; -+ ptr0 = pair; -+ curMatch = *ptr0; -+ len0 = len; -+ } -+ } -+ } -+} -+ -+#define MOVE_POS \ -+ ++p->cyclicBufferPos; \ -+ p->buffer++; \ -+ if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); -+ -+#define MOVE_POS_RET MOVE_POS return offset; -+ -+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; } -+ -+#define GET_MATCHES_HEADER2(minLen, ret_op) \ -+ UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ -+ lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ -+ cur = p->buffer; -+ -+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0) -+#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue) -+ -+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue -+ -+#define GET_MATCHES_FOOTER(offset, maxLen) \ -+ offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \ -+ distances + offset, maxLen) - distances); MOVE_POS_RET; -+ -+#define SKIP_FOOTER \ -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS; -+ -+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 1) -+} -+ -+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = 0; -+ GET_MATCHES_FOOTER(offset, 2) -+} -+ -+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, delta2, maxLen, offset; -+ GET_MATCHES_HEADER(3) -+ -+ HASH3_CALC; -+ -+ delta2 = p->pos - p->hash[hash2Value]; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ -+ -+ maxLen = 2; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[0] = maxLen; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ GET_MATCHES_FOOTER(offset, maxLen) -+} -+ -+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset; -+ GET_MATCHES_HEADER(4) -+ -+ HASH4_CALC; -+ -+ delta2 = p->pos - p->hash[ hash2Value]; -+ delta3 = p->pos - p->hash[kFix3HashSize + hash3Value]; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ -+ maxLen = 1; -+ offset = 0; -+ if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur) -+ { -+ distances[0] = maxLen = 2; -+ distances[1] = delta2 - 1; -+ offset = 2; -+ } -+ if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur) -+ { -+ maxLen = 3; -+ distances[offset + 1] = delta3 - 1; -+ offset += 2; -+ delta2 = delta3; -+ } -+ if (offset != 0) -+ { -+ for (; maxLen != lenLimit; maxLen++) -+ if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen]) -+ break; -+ distances[offset - 2] = maxLen; -+ if (maxLen == lenLimit) -+ { -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS_RET; -+ } -+ } -+ if (maxLen < 3) -+ maxLen = 3; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances + offset, maxLen) - (distances)); -+ MOVE_POS_RET -+} -+ -+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances) -+{ -+ UInt32 offset; -+ GET_MATCHES_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p), -+ distances, 2) - (distances)); -+ MOVE_POS_RET -+} -+ -+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(2) -+ HASH2_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value; -+ SKIP_HEADER(3) -+ HASH3_CALC; -+ curMatch = p->hash[kFix3HashSize + hashValue]; -+ p->hash[hash2Value] = -+ p->hash[kFix3HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = p->pos; -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ SKIP_FOOTER -+ } -+ while (--num != 0); -+} -+ -+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ UInt32 hash2Value, hash3Value; -+ SKIP_HEADER(4) -+ HASH4_CALC; -+ curMatch = p->hash[kFix4HashSize + hashValue]; -+ p->hash[ hash2Value] = -+ p->hash[kFix3HashSize + hash3Value] = -+ p->hash[kFix4HashSize + hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num) -+{ -+ do -+ { -+ SKIP_HEADER(3) -+ HASH_ZIP_CALC; -+ curMatch = p->hash[hashValue]; -+ p->hash[hashValue] = p->pos; -+ p->son[p->cyclicBufferPos] = curMatch; -+ MOVE_POS -+ } -+ while (--num != 0); -+} -+ -+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable) -+{ -+ vTable->Init = (Mf_Init_Func)MatchFinder_Init; -+ vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte; -+ vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes; -+ vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos; -+ if (!p->btMode) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 2) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip; -+ } -+ else if (p->numHashBytes == 3) -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip; -+ } -+ else -+ { -+ vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches; -+ vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip; -+ } -+} ---- /dev/null -+++ b/lib/lzma/LzmaDec.c -@@ -0,0 +1,999 @@ -+/* LzmaDec.c -- LZMA Decoder -+2009-09-20 : Igor Pavlov : Public domain */ -+ -+#include "LzmaDec.h" -+ -+#include -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+ -+#define RC_INIT_SIZE 5 -+ -+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits)); -+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits)); -+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \ -+ { UPDATE_0(p); i = (i + i); A0; } else \ -+ { UPDATE_1(p); i = (i + i) + 1; A1; } -+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;) -+ -+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); } -+#define TREE_DECODE(probs, limit, i) \ -+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; } -+ -+/* #define _LZMA_SIZE_OPT */ -+ -+#ifdef _LZMA_SIZE_OPT -+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i) -+#else -+#define TREE_6_DECODE(probs, i) \ -+ { i = 1; \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ TREE_GET_BIT(probs, i); \ -+ i -= 0x40; } -+#endif -+ -+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); } -+ -+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound) -+#define UPDATE_0_CHECK range = bound; -+#define UPDATE_1_CHECK range -= bound; code -= bound; -+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \ -+ { UPDATE_0_CHECK; i = (i + i); A0; } else \ -+ { UPDATE_1_CHECK; i = (i + i) + 1; A1; } -+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;) -+#define TREE_DECODE_CHECK(probs, limit, i) \ -+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; } -+ -+ -+#define kNumPosBitsMax 4 -+#define kNumPosStatesMax (1 << kNumPosBitsMax) -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define LenChoice 0 -+#define LenChoice2 (LenChoice + 1) -+#define LenLow (LenChoice2 + 1) -+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -+#define kNumLenProbs (LenHigh + kLenNumHighSymbols) -+ -+ -+#define kNumStates 12 -+#define kNumLitStates 7 -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#define kNumPosSlotBits 6 -+#define kNumLenToPosStates 4 -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+ -+#define kMatchMinLen 2 -+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define IsMatch 0 -+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -+#define IsRepG0 (IsRep + kNumStates) -+#define IsRepG1 (IsRepG0 + kNumStates) -+#define IsRepG2 (IsRepG1 + kNumStates) -+#define IsRep0Long (IsRepG2 + kNumStates) -+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -+#define LenCoder (Align + kAlignTableSize) -+#define RepLenCoder (LenCoder + kNumLenProbs) -+#define Literal (RepLenCoder + kNumLenProbs) -+ -+#define LZMA_BASE_SIZE 1846 -+#define LZMA_LIT_SIZE 768 -+ -+#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp))) -+ -+#if Literal != LZMA_BASE_SIZE -+StopCompilingDueBUG -+#endif -+ -+#define LZMA_DIC_MIN (1 << 12) -+ -+/* First LZMA-symbol is always decoded. -+And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization -+Out: -+ Result: -+ SZ_OK - OK -+ SZ_ERROR_DATA - Error -+ p->remainLen: -+ < kMatchSpecLenStart : normal remain -+ = kMatchSpecLenStart : finished -+ = kMatchSpecLenStart + 1 : Flush marker -+ = kMatchSpecLenStart + 2 : State Init Marker -+*/ -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ CLzmaProb *probs = p->probs; -+ -+ unsigned state = p->state; -+ UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3]; -+ unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1; -+ unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1; -+ unsigned lc = p->prop.lc; -+ -+ Byte *dic = p->dic; -+ SizeT dicBufSize = p->dicBufSize; -+ SizeT dicPos = p->dicPos; -+ -+ UInt32 processedPos = p->processedPos; -+ UInt32 checkDicSize = p->checkDicSize; -+ unsigned len = 0; -+ -+ const Byte *buf = p->buf; -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ -+ do -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = processedPos & pbMask; -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ unsigned symbol; -+ UPDATE_0(prob); -+ prob = probs + Literal; -+ if (checkDicSize != 0 || processedPos != 0) -+ prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + -+ (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ state -= (state < 4) ? state : 3; -+ symbol = 1; -+ do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ state -= (state < 10) ? 3 : 6; -+ symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ dic[dicPos++] = (Byte)symbol; -+ processedPos++; -+ continue; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRep + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ state += kNumStates; -+ prob = probs + LenCoder; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ if (checkDicSize == 0 && processedPos == 0) -+ return SZ_ERROR_DATA; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ processedPos++; -+ state = state < kNumLitStates ? 9 : 11; -+ continue; -+ } -+ UPDATE_1(prob); -+ } -+ else -+ { -+ UInt32 distance; -+ UPDATE_1(prob); -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep1; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0(prob) -+ { -+ UPDATE_0(prob); -+ distance = rep2; -+ } -+ else -+ { -+ UPDATE_1(prob); -+ distance = rep3; -+ rep3 = rep2; -+ } -+ rep2 = rep1; -+ } -+ rep1 = rep0; -+ rep0 = distance; -+ } -+ state = state < kNumLitStates ? 8 : 11; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = (1 << kLenNumLowBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenChoice2; -+ IF_BIT_0(probLen) -+ { -+ UPDATE_0(probLen); -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = (1 << kLenNumMidBits); -+ } -+ else -+ { -+ UPDATE_1(probLen); -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = (1 << kLenNumHighBits); -+ } -+ } -+ TREE_DECODE(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state >= kNumStates) -+ { -+ UInt32 distance; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); -+ TREE_6_DECODE(prob, distance); -+ if (distance >= kStartPosModelIndex) -+ { -+ unsigned posSlot = (unsigned)distance; -+ int numDirectBits = (int)(((distance >> 1) - 1)); -+ distance = (2 | (distance & 1)); -+ if (posSlot < kEndPosModelIndex) -+ { -+ distance <<= numDirectBits; -+ prob = probs + SpecPos + distance - posSlot - 1; -+ { -+ UInt32 mask = 1; -+ unsigned i = 1; -+ do -+ { -+ GET_BIT2(prob + i, i, ; , distance |= mask); -+ mask <<= 1; -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE -+ range >>= 1; -+ -+ { -+ UInt32 t; -+ code -= range; -+ t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */ -+ distance = (distance << 1) + (t + 1); -+ code += range & t; -+ } -+ /* -+ distance <<= 1; -+ if (code >= range) -+ { -+ code -= range; -+ distance |= 1; -+ } -+ */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ distance <<= kNumAlignBits; -+ { -+ unsigned i = 1; -+ GET_BIT2(prob + i, i, ; , distance |= 1); -+ GET_BIT2(prob + i, i, ; , distance |= 2); -+ GET_BIT2(prob + i, i, ; , distance |= 4); -+ GET_BIT2(prob + i, i, ; , distance |= 8); -+ } -+ if (distance == (UInt32)0xFFFFFFFF) -+ { -+ len += kMatchSpecLenStart; -+ state -= kNumStates; -+ break; -+ } -+ } -+ } -+ rep3 = rep2; -+ rep2 = rep1; -+ rep1 = rep0; -+ rep0 = distance + 1; -+ if (checkDicSize == 0) -+ { -+ if (distance >= processedPos) -+ return SZ_ERROR_DATA; -+ } -+ else if (distance >= checkDicSize) -+ return SZ_ERROR_DATA; -+ state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; -+ } -+ -+ len += kMatchMinLen; -+ -+ if (limit == dicPos) -+ return SZ_ERROR_DATA; -+ { -+ SizeT rem = limit - dicPos; -+ unsigned curLen = ((rem < len) ? (unsigned)rem : len); -+ SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0); -+ -+ processedPos += curLen; -+ -+ len -= curLen; -+ if (pos + curLen <= dicBufSize) -+ { -+ Byte *dest = dic + dicPos; -+ ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos; -+ const Byte *lim = dest + curLen; -+ dicPos += curLen; -+ do -+ *(dest) = (Byte)*(dest + src); -+ while (++dest != lim); -+ } -+ else -+ { -+ do -+ { -+ dic[dicPos++] = dic[pos]; -+ if (++pos == dicBufSize) -+ pos = 0; -+ } -+ while (--curLen != 0); -+ } -+ } -+ } -+ } -+ while (dicPos < limit && buf < bufLimit); -+ NORMALIZE; -+ p->buf = buf; -+ p->range = range; -+ p->code = code; -+ p->remainLen = len; -+ p->dicPos = dicPos; -+ p->processedPos = processedPos; -+ p->reps[0] = rep0; -+ p->reps[1] = rep1; -+ p->reps[2] = rep2; -+ p->reps[3] = rep3; -+ p->state = state; -+ -+ return SZ_OK; -+} -+ -+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit) -+{ -+ if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart) -+ { -+ Byte *dic = p->dic; -+ SizeT dicPos = p->dicPos; -+ SizeT dicBufSize = p->dicBufSize; -+ unsigned len = p->remainLen; -+ UInt32 rep0 = p->reps[0]; -+ if (limit - dicPos < len) -+ len = (unsigned)(limit - dicPos); -+ -+ if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len) -+ p->checkDicSize = p->prop.dicSize; -+ -+ p->processedPos += len; -+ p->remainLen -= len; -+ while (len-- != 0) -+ { -+ dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)]; -+ dicPos++; -+ } -+ p->dicPos = dicPos; -+ } -+} -+ -+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit) -+{ -+ do -+ { -+ SizeT limit2 = limit; -+ if (p->checkDicSize == 0) -+ { -+ UInt32 rem = p->prop.dicSize - p->processedPos; -+ if (limit - p->dicPos > rem) -+ limit2 = p->dicPos + rem; -+ } -+ RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit)); -+ if (p->processedPos >= p->prop.dicSize) -+ p->checkDicSize = p->prop.dicSize; -+ LzmaDec_WriteRem(p, limit); -+ } -+ while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart); -+ -+ if (p->remainLen > kMatchSpecLenStart) -+ { -+ p->remainLen = kMatchSpecLenStart; -+ } -+ return 0; -+} -+ -+typedef enum -+{ -+ DUMMY_ERROR, /* unexpected end of input stream */ -+ DUMMY_LIT, -+ DUMMY_MATCH, -+ DUMMY_REP -+} ELzmaDummy; -+ -+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize) -+{ -+ UInt32 range = p->range; -+ UInt32 code = p->code; -+ const Byte *bufLimit = buf + inSize; -+ CLzmaProb *probs = p->probs; -+ unsigned state = p->state; -+ ELzmaDummy res; -+ -+ { -+ CLzmaProb *prob; -+ UInt32 bound; -+ unsigned ttt; -+ unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1); -+ -+ prob = probs + IsMatch + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK -+ -+ /* if (bufLimit - buf >= 7) return DUMMY_LIT; */ -+ -+ prob = probs + Literal; -+ if (p->checkDicSize != 0 || p->processedPos != 0) -+ prob += (LZMA_LIT_SIZE * -+ ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + -+ (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc)))); -+ -+ if (state < kNumLitStates) -+ { -+ unsigned symbol = 1; -+ do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100); -+ } -+ else -+ { -+ unsigned matchByte = p->dic[p->dicPos - p->reps[0] + -+ ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)]; -+ unsigned offs = 0x100; -+ unsigned symbol = 1; -+ do -+ { -+ unsigned bit; -+ CLzmaProb *probLit; -+ matchByte <<= 1; -+ bit = (matchByte & offs); -+ probLit = prob + offs + bit + symbol; -+ GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit) -+ } -+ while (symbol < 0x100); -+ } -+ res = DUMMY_LIT; -+ } -+ else -+ { -+ unsigned len; -+ UPDATE_1_CHECK; -+ -+ prob = probs + IsRep + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ state = 0; -+ prob = probs + LenCoder; -+ res = DUMMY_MATCH; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ res = DUMMY_REP; -+ prob = probs + IsRepG0 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ NORMALIZE_CHECK; -+ return DUMMY_REP; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG1 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ prob = probs + IsRepG2 + state; -+ IF_BIT_0_CHECK(prob) -+ { -+ UPDATE_0_CHECK; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ } -+ } -+ } -+ state = kNumStates; -+ prob = probs + RepLenCoder; -+ } -+ { -+ unsigned limit, offset; -+ CLzmaProb *probLen = prob + LenChoice; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenLow + (posState << kLenNumLowBits); -+ offset = 0; -+ limit = 1 << kLenNumLowBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenChoice2; -+ IF_BIT_0_CHECK(probLen) -+ { -+ UPDATE_0_CHECK; -+ probLen = prob + LenMid + (posState << kLenNumMidBits); -+ offset = kLenNumLowSymbols; -+ limit = 1 << kLenNumMidBits; -+ } -+ else -+ { -+ UPDATE_1_CHECK; -+ probLen = prob + LenHigh; -+ offset = kLenNumLowSymbols + kLenNumMidSymbols; -+ limit = 1 << kLenNumHighBits; -+ } -+ } -+ TREE_DECODE_CHECK(probLen, limit, len); -+ len += offset; -+ } -+ -+ if (state < 4) -+ { -+ unsigned posSlot; -+ prob = probs + PosSlot + -+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << -+ kNumPosSlotBits); -+ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot); -+ if (posSlot >= kStartPosModelIndex) -+ { -+ int numDirectBits = ((posSlot >> 1) - 1); -+ -+ /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */ -+ -+ if (posSlot < kEndPosModelIndex) -+ { -+ prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1; -+ } -+ else -+ { -+ numDirectBits -= kNumAlignBits; -+ do -+ { -+ NORMALIZE_CHECK -+ range >>= 1; -+ code -= range & (((code - range) >> 31) - 1); -+ /* if (code >= range) code -= range; */ -+ } -+ while (--numDirectBits != 0); -+ prob = probs + Align; -+ numDirectBits = kNumAlignBits; -+ } -+ { -+ unsigned i = 1; -+ do -+ { -+ GET_BIT_CHECK(prob + i, i); -+ } -+ while (--numDirectBits != 0); -+ } -+ } -+ } -+ } -+ } -+ NORMALIZE_CHECK; -+ return res; -+} -+ -+ -+static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data) -+{ -+ p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]); -+ p->range = 0xFFFFFFFF; -+ p->needFlush = 0; -+} -+ -+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) -+{ -+ p->needFlush = 1; -+ p->remainLen = 0; -+ p->tempBufSize = 0; -+ -+ if (initDic) -+ { -+ p->processedPos = 0; -+ p->checkDicSize = 0; -+ p->needInitState = 1; -+ } -+ if (initState) -+ p->needInitState = 1; -+} -+ -+void LzmaDec_Init(CLzmaDec *p) -+{ -+ p->dicPos = 0; -+ LzmaDec_InitDicAndState(p, True, True); -+} -+ -+static void LzmaDec_InitStateReal(CLzmaDec *p) -+{ -+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp)); -+ UInt32 i; -+ CLzmaProb *probs = p->probs; -+ for (i = 0; i < numProbs; i++) -+ probs[i] = kBitModelTotal >> 1; -+ p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1; -+ p->state = 0; -+ p->needInitState = 0; -+} -+ -+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, -+ ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT inSize = *srcLen; -+ (*srcLen) = 0; -+ LzmaDec_WriteRem(p, dicLimit); -+ -+ *status = LZMA_STATUS_NOT_SPECIFIED; -+ -+ while (p->remainLen != kMatchSpecLenStart) -+ { -+ int checkEndMarkNow; -+ -+ if (p->needFlush != 0) -+ { -+ for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--) -+ p->tempBuf[p->tempBufSize++] = *src++; -+ if (p->tempBufSize < RC_INIT_SIZE) -+ { -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (p->tempBuf[0] != 0) -+ return SZ_ERROR_DATA; -+ -+ LzmaDec_InitRc(p, p->tempBuf); -+ p->tempBufSize = 0; -+ } -+ -+ checkEndMarkNow = 0; -+ if (p->dicPos >= dicLimit) -+ { -+ if (p->remainLen == 0 && p->code == 0) -+ { -+ *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK; -+ return SZ_OK; -+ } -+ if (finishMode == LZMA_FINISH_ANY) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_OK; -+ } -+ if (p->remainLen != 0) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ checkEndMarkNow = 1; -+ } -+ -+ if (p->needInitState) -+ LzmaDec_InitStateReal(p); -+ -+ if (p->tempBufSize == 0) -+ { -+ SizeT processed; -+ const Byte *bufLimit; -+ if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, src, inSize); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ memcpy(p->tempBuf, src, inSize); -+ p->tempBufSize = (unsigned)inSize; -+ (*srcLen) += inSize; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ bufLimit = src; -+ } -+ else -+ bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX; -+ p->buf = src; -+ if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0) -+ return SZ_ERROR_DATA; -+ processed = (SizeT)(p->buf - src); -+ (*srcLen) += processed; -+ src += processed; -+ inSize -= processed; -+ } -+ else -+ { -+ unsigned rem = p->tempBufSize, lookAhead = 0; -+ while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize) -+ p->tempBuf[rem++] = src[lookAhead++]; -+ p->tempBufSize = rem; -+ if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow) -+ { -+ int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem); -+ if (dummyRes == DUMMY_ERROR) -+ { -+ (*srcLen) += lookAhead; -+ *status = LZMA_STATUS_NEEDS_MORE_INPUT; -+ return SZ_OK; -+ } -+ if (checkEndMarkNow && dummyRes != DUMMY_MATCH) -+ { -+ *status = LZMA_STATUS_NOT_FINISHED; -+ return SZ_ERROR_DATA; -+ } -+ } -+ p->buf = p->tempBuf; -+ if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0) -+ return SZ_ERROR_DATA; -+ lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf)); -+ (*srcLen) += lookAhead; -+ src += lookAhead; -+ inSize -= lookAhead; -+ p->tempBufSize = 0; -+ } -+ } -+ if (p->code == 0) -+ *status = LZMA_STATUS_FINISHED_WITH_MARK; -+ return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA; -+} -+ -+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status) -+{ -+ SizeT outSize = *destLen; -+ SizeT inSize = *srcLen; -+ *srcLen = *destLen = 0; -+ for (;;) -+ { -+ SizeT inSizeCur = inSize, outSizeCur, dicPos; -+ ELzmaFinishMode curFinishMode; -+ SRes res; -+ if (p->dicPos == p->dicBufSize) -+ p->dicPos = 0; -+ dicPos = p->dicPos; -+ if (outSize > p->dicBufSize - dicPos) -+ { -+ outSizeCur = p->dicBufSize; -+ curFinishMode = LZMA_FINISH_ANY; -+ } -+ else -+ { -+ outSizeCur = dicPos + outSize; -+ curFinishMode = finishMode; -+ } -+ -+ res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status); -+ src += inSizeCur; -+ inSize -= inSizeCur; -+ *srcLen += inSizeCur; -+ outSizeCur = p->dicPos - dicPos; -+ memcpy(dest, p->dic + dicPos, outSizeCur); -+ dest += outSizeCur; -+ outSize -= outSizeCur; -+ *destLen += outSizeCur; -+ if (res != 0) -+ return res; -+ if (outSizeCur == 0 || outSize == 0) -+ return SZ_OK; -+ } -+} -+ -+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->probs); -+ p->probs = 0; -+} -+ -+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->dic); -+ p->dic = 0; -+} -+ -+void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc) -+{ -+ LzmaDec_FreeProbs(p, alloc); -+ LzmaDec_FreeDict(p, alloc); -+} -+ -+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size) -+{ -+ UInt32 dicSize; -+ Byte d; -+ -+ if (size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_UNSUPPORTED; -+ else -+ dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24); -+ -+ if (dicSize < LZMA_DIC_MIN) -+ dicSize = LZMA_DIC_MIN; -+ p->dicSize = dicSize; -+ -+ d = data[0]; -+ if (d >= (9 * 5 * 5)) -+ return SZ_ERROR_UNSUPPORTED; -+ -+ p->lc = d % 9; -+ d /= 9; -+ p->pb = d / 5; -+ p->lp = d % 5; -+ -+ return SZ_OK; -+} -+ -+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc) -+{ -+ UInt32 numProbs = LzmaProps_GetNumProbs(propNew); -+ if (p->probs == 0 || numProbs != p->numProbs) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb)); -+ p->numProbs = numProbs; -+ if (p->probs == 0) -+ return SZ_ERROR_MEM; -+ } -+ return SZ_OK; -+} -+ -+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc) -+{ -+ CLzmaProps propNew; -+ SizeT dicBufSize; -+ RINOK(LzmaProps_Decode(&propNew, props, propsSize)); -+ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc)); -+ dicBufSize = propNew.dicSize; -+ if (p->dic == 0 || dicBufSize != p->dicBufSize) -+ { -+ LzmaDec_FreeDict(p, alloc); -+ p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize); -+ if (p->dic == 0) -+ { -+ LzmaDec_FreeProbs(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ } -+ p->dicBufSize = dicBufSize; -+ p->prop = propNew; -+ return SZ_OK; -+} -+ -+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, -+ const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, -+ ELzmaStatus *status, ISzAlloc *alloc) -+{ -+ CLzmaDec p; -+ SRes res; -+ SizeT inSize = *srcLen; -+ SizeT outSize = *destLen; -+ *srcLen = *destLen = 0; -+ if (inSize < RC_INIT_SIZE) -+ return SZ_ERROR_INPUT_EOF; -+ -+ LzmaDec_Construct(&p); -+ res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc); -+ if (res != 0) -+ return res; -+ p.dic = dest; -+ p.dicBufSize = outSize; -+ -+ LzmaDec_Init(&p); -+ -+ *srcLen = inSize; -+ res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status); -+ -+ if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT) -+ res = SZ_ERROR_INPUT_EOF; -+ -+ (*destLen) = p.dicPos; -+ LzmaDec_FreeProbs(&p, alloc); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/LzmaEnc.c -@@ -0,0 +1,2271 @@ -+/* LzmaEnc.c -- LZMA Encoder -+2009-11-24 : Igor Pavlov : Public domain */ -+ -+#include -+ -+/* #define SHOW_STAT */ -+/* #define SHOW_STAT2 */ -+ -+#if defined(SHOW_STAT) || defined(SHOW_STAT2) -+#include -+#endif -+ -+#include "LzmaEnc.h" -+ -+/* disable MT */ -+#define _7ZIP_ST -+ -+#include "LzFind.h" -+#ifndef _7ZIP_ST -+#include "LzFindMt.h" -+#endif -+ -+#ifdef SHOW_STAT -+static int ttt = 0; -+#endif -+ -+#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) -+ -+#define kBlockSize (9 << 10) -+#define kUnpackBlockSize (1 << 18) -+#define kMatchArraySize (1 << 21) -+#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) -+ -+#define kNumMaxDirectBits (31) -+ -+#define kNumTopBits 24 -+#define kTopValue ((UInt32)1 << kNumTopBits) -+ -+#define kNumBitModelTotalBits 11 -+#define kBitModelTotal (1 << kNumBitModelTotalBits) -+#define kNumMoveBits 5 -+#define kProbInitValue (kBitModelTotal >> 1) -+ -+#define kNumMoveReducingBits 4 -+#define kNumBitPriceShiftBits 4 -+#define kBitPrice (1 << kNumBitPriceShiftBits) -+ -+void LzmaEncProps_Init(CLzmaEncProps *p) -+{ -+ p->level = 5; -+ p->dictSize = p->mc = 0; -+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; -+ p->writeEndMark = 0; -+} -+ -+void LzmaEncProps_Normalize(CLzmaEncProps *p) -+{ -+ int level = p->level; -+ if (level < 0) level = 5; -+ p->level = level; -+ if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26))); -+ if (p->lc < 0) p->lc = 3; -+ if (p->lp < 0) p->lp = 0; -+ if (p->pb < 0) p->pb = 2; -+ if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); -+ if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); -+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); -+ if (p->numHashBytes < 0) p->numHashBytes = 4; -+ if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1); -+ if (p->numThreads < 0) -+ p->numThreads = -+ #ifndef _7ZIP_ST -+ ((p->btMode && p->algo) ? 2 : 1); -+ #else -+ 1; -+ #endif -+} -+ -+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2) -+{ -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ return props.dictSize; -+} -+ -+/* #define LZMA_LOG_BSR */ -+/* Define it for Intel's CPU */ -+ -+ -+#ifdef LZMA_LOG_BSR -+ -+#define kDicLogSizeMaxCompress 30 -+ -+#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); } -+ -+UInt32 GetPosSlot1(UInt32 pos) -+{ -+ UInt32 res; -+ BSR2_RET(pos, res); -+ return res; -+} -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } -+ -+#else -+ -+#define kNumLogBits (9 + (int)sizeof(size_t) / 2) -+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7) -+ -+void LzmaEnc_FastPosInit(Byte *g_FastPos) -+{ -+ int c = 2, slotFast; -+ g_FastPos[0] = 0; -+ g_FastPos[1] = 1; -+ -+ for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++) -+ { -+ UInt32 k = (1 << ((slotFast >> 1) - 1)); -+ UInt32 j; -+ for (j = 0; j < k; j++, c++) -+ g_FastPos[c] = (Byte)slotFast; -+ } -+} -+ -+#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ -+ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ -+ res = p->g_FastPos[pos >> i] + (i * 2); } -+/* -+#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ -+ p->g_FastPos[pos >> 6] + 12 : \ -+ p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } -+*/ -+ -+#define GetPosSlot1(pos) p->g_FastPos[pos] -+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } -+#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); } -+ -+#endif -+ -+ -+#define LZMA_NUM_REPS 4 -+ -+typedef unsigned CState; -+ -+typedef struct -+{ -+ UInt32 price; -+ -+ CState state; -+ int prev1IsChar; -+ int prev2; -+ -+ UInt32 posPrev2; -+ UInt32 backPrev2; -+ -+ UInt32 posPrev; -+ UInt32 backPrev; -+ UInt32 backs[LZMA_NUM_REPS]; -+} COptimal; -+ -+#define kNumOpts (1 << 12) -+ -+#define kNumLenToPosStates 4 -+#define kNumPosSlotBits 6 -+#define kDicLogSizeMin 0 -+#define kDicLogSizeMax 32 -+#define kDistTableSizeMax (kDicLogSizeMax * 2) -+ -+ -+#define kNumAlignBits 4 -+#define kAlignTableSize (1 << kNumAlignBits) -+#define kAlignMask (kAlignTableSize - 1) -+ -+#define kStartPosModelIndex 4 -+#define kEndPosModelIndex 14 -+#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex) -+ -+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) -+ -+#ifdef _LZMA_PROB32 -+#define CLzmaProb UInt32 -+#else -+#define CLzmaProb UInt16 -+#endif -+ -+#define LZMA_PB_MAX 4 -+#define LZMA_LC_MAX 8 -+#define LZMA_LP_MAX 4 -+ -+#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX) -+ -+ -+#define kLenNumLowBits 3 -+#define kLenNumLowSymbols (1 << kLenNumLowBits) -+#define kLenNumMidBits 3 -+#define kLenNumMidSymbols (1 << kLenNumMidBits) -+#define kLenNumHighBits 8 -+#define kLenNumHighSymbols (1 << kLenNumHighBits) -+ -+#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols) -+ -+#define LZMA_MATCH_LEN_MIN 2 -+#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1) -+ -+#define kNumStates 12 -+ -+typedef struct -+{ -+ CLzmaProb choice; -+ CLzmaProb choice2; -+ CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits]; -+ CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits]; -+ CLzmaProb high[kLenNumHighSymbols]; -+} CLenEnc; -+ -+typedef struct -+{ -+ CLenEnc p; -+ UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal]; -+ UInt32 tableSize; -+ UInt32 counters[LZMA_NUM_PB_STATES_MAX]; -+} CLenPriceEnc; -+ -+typedef struct -+{ -+ UInt32 range; -+ Byte cache; -+ UInt64 low; -+ UInt64 cacheSize; -+ Byte *buf; -+ Byte *bufLim; -+ Byte *bufBase; -+ ISeqOutStream *outStream; -+ UInt64 processed; -+ SRes res; -+} CRangeEnc; -+ -+typedef struct -+{ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+} CSaveState; -+ -+typedef struct -+{ -+ IMatchFinder matchFinder; -+ void *matchFinderObj; -+ -+ #ifndef _7ZIP_ST -+ Bool mtMode; -+ CMatchFinderMt matchFinderMt; -+ #endif -+ -+ CMatchFinder matchFinderBase; -+ -+ #ifndef _7ZIP_ST -+ Byte pad[128]; -+ #endif -+ -+ UInt32 optimumEndIndex; -+ UInt32 optimumCurrentIndex; -+ -+ UInt32 longestMatchLength; -+ UInt32 numPairs; -+ UInt32 numAvail; -+ COptimal opt[kNumOpts]; -+ -+ #ifndef LZMA_LOG_BSR -+ Byte g_FastPos[1 << kNumLogBits]; -+ #endif -+ -+ UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits]; -+ UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1]; -+ UInt32 numFastBytes; -+ UInt32 additionalOffset; -+ UInt32 reps[LZMA_NUM_REPS]; -+ UInt32 state; -+ -+ UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; -+ UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances]; -+ UInt32 alignPrices[kAlignTableSize]; -+ UInt32 alignPriceCount; -+ -+ UInt32 distTableSize; -+ -+ unsigned lc, lp, pb; -+ unsigned lpMask, pbMask; -+ -+ CLzmaProb *litProbs; -+ -+ CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ CLzmaProb isRep[kNumStates]; -+ CLzmaProb isRepG0[kNumStates]; -+ CLzmaProb isRepG1[kNumStates]; -+ CLzmaProb isRepG2[kNumStates]; -+ CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX]; -+ -+ CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits]; -+ CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex]; -+ CLzmaProb posAlignEncoder[1 << kNumAlignBits]; -+ -+ CLenPriceEnc lenEnc; -+ CLenPriceEnc repLenEnc; -+ -+ unsigned lclp; -+ -+ Bool fastMode; -+ -+ CRangeEnc rc; -+ -+ Bool writeEndMark; -+ UInt64 nowPos64; -+ UInt32 matchPriceCount; -+ Bool finished; -+ Bool multiThread; -+ -+ SRes result; -+ UInt32 dictSize; -+ UInt32 matchFinderCycles; -+ -+ int needInit; -+ -+ CSaveState saveState; -+} CLzmaEnc; -+ -+void LzmaEnc_SaveState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CSaveState *dest = &p->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); -+} -+ -+void LzmaEnc_RestoreState(CLzmaEncHandle pp) -+{ -+ CLzmaEnc *dest = (CLzmaEnc *)pp; -+ const CSaveState *p = &dest->saveState; -+ int i; -+ dest->lenEnc = p->lenEnc; -+ dest->repLenEnc = p->repLenEnc; -+ dest->state = p->state; -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); -+ memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); -+ } -+ for (i = 0; i < kNumLenToPosStates; i++) -+ memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); -+ memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); -+ memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); -+ memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); -+ memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); -+ memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); -+ memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); -+ memcpy(dest->reps, p->reps, sizeof(p->reps)); -+ memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); -+} -+ -+SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ CLzmaEncProps props = *props2; -+ LzmaEncProps_Normalize(&props); -+ -+ if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX || -+ props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30)) -+ return SZ_ERROR_PARAM; -+ p->dictSize = props.dictSize; -+ p->matchFinderCycles = props.mc; -+ { -+ unsigned fb = props.fb; -+ if (fb < 5) -+ fb = 5; -+ if (fb > LZMA_MATCH_LEN_MAX) -+ fb = LZMA_MATCH_LEN_MAX; -+ p->numFastBytes = fb; -+ } -+ p->lc = props.lc; -+ p->lp = props.lp; -+ p->pb = props.pb; -+ p->fastMode = (props.algo == 0); -+ p->matchFinderBase.btMode = props.btMode; -+ { -+ UInt32 numHashBytes = 4; -+ if (props.btMode) -+ { -+ if (props.numHashBytes < 2) -+ numHashBytes = 2; -+ else if (props.numHashBytes < 4) -+ numHashBytes = props.numHashBytes; -+ } -+ p->matchFinderBase.numHashBytes = numHashBytes; -+ } -+ -+ p->matchFinderBase.cutValue = props.mc; -+ -+ p->writeEndMark = props.writeEndMark; -+ -+ #ifndef _7ZIP_ST -+ /* -+ if (newMultiThread != _multiThread) -+ { -+ ReleaseMatchFinder(); -+ _multiThread = newMultiThread; -+ } -+ */ -+ p->multiThread = (props.numThreads > 1); -+ #endif -+ -+ return SZ_OK; -+} -+ -+static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; -+static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; -+static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; -+static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; -+ -+#define IsCharState(s) ((s) < 7) -+ -+#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1) -+ -+#define kInfinityPrice (1 << 30) -+ -+static void RangeEnc_Construct(CRangeEnc *p) -+{ -+ p->outStream = 0; -+ p->bufBase = 0; -+} -+ -+#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize) -+ -+#define RC_BUF_SIZE (1 << 16) -+static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ if (p->bufBase == 0) -+ { -+ p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE); -+ if (p->bufBase == 0) -+ return 0; -+ p->bufLim = p->bufBase + RC_BUF_SIZE; -+ } -+ return 1; -+} -+ -+static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->bufBase); -+ p->bufBase = 0; -+} -+ -+static void RangeEnc_Init(CRangeEnc *p) -+{ -+ /* Stream.Init(); */ -+ p->low = 0; -+ p->range = 0xFFFFFFFF; -+ p->cacheSize = 1; -+ p->cache = 0; -+ -+ p->buf = p->bufBase; -+ -+ p->processed = 0; -+ p->res = SZ_OK; -+} -+ -+static void RangeEnc_FlushStream(CRangeEnc *p) -+{ -+ size_t num; -+ if (p->res != SZ_OK) -+ return; -+ num = p->buf - p->bufBase; -+ if (num != p->outStream->Write(p->outStream, p->bufBase, num)) -+ p->res = SZ_ERROR_WRITE; -+ p->processed += num; -+ p->buf = p->bufBase; -+} -+ -+static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) -+{ -+ if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) -+ { -+ Byte temp = p->cache; -+ do -+ { -+ Byte *buf = p->buf; -+ *buf++ = (Byte)(temp + (Byte)(p->low >> 32)); -+ p->buf = buf; -+ if (buf == p->bufLim) -+ RangeEnc_FlushStream(p); -+ temp = 0xFF; -+ } -+ while (--p->cacheSize != 0); -+ p->cache = (Byte)((UInt32)p->low >> 24); -+ } -+ p->cacheSize++; -+ p->low = (UInt32)p->low << 8; -+} -+ -+static void RangeEnc_FlushData(CRangeEnc *p) -+{ -+ int i; -+ for (i = 0; i < 5; i++) -+ RangeEnc_ShiftLow(p); -+} -+ -+static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits) -+{ -+ do -+ { -+ p->range >>= 1; -+ p->low += p->range & (0 - ((value >> --numBits) & 1)); -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+ } -+ while (numBits != 0); -+} -+ -+static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol) -+{ -+ UInt32 ttt = *prob; -+ UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt; -+ if (symbol == 0) -+ { -+ p->range = newBound; -+ ttt += (kBitModelTotal - ttt) >> kNumMoveBits; -+ } -+ else -+ { -+ p->low += newBound; -+ p->range -= newBound; -+ ttt -= ttt >> kNumMoveBits; -+ } -+ *prob = (CLzmaProb)ttt; -+ if (p->range < kTopValue) -+ { -+ p->range <<= 8; -+ RangeEnc_ShiftLow(p); -+ } -+} -+ -+static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol) -+{ -+ symbol |= 0x100; -+ do -+ { -+ RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+} -+ -+static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte) -+{ -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+} -+ -+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices) -+{ -+ UInt32 i; -+ for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits)) -+ { -+ const int kCyclesBits = kNumBitPriceShiftBits; -+ UInt32 w = i; -+ UInt32 bitCount = 0; -+ int j; -+ for (j = 0; j < kCyclesBits; j++) -+ { -+ w = w * w; -+ bitCount <<= 1; -+ while (w >= ((UInt32)1 << 16)) -+ { -+ w >>= 1; -+ bitCount++; -+ } -+ } -+ ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount); -+ } -+} -+ -+ -+#define GET_PRICE(prob, symbol) \ -+ p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICEa(prob, symbol) \ -+ ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; -+ -+#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits] -+#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] -+ -+static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= 0x100; -+ do -+ { -+ price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1); -+ symbol <<= 1; -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 offs = 0x100; -+ symbol |= 0x100; -+ do -+ { -+ matchByte <<= 1; -+ price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); -+ symbol <<= 1; -+ offs &= ~(matchByte ^ symbol); -+ } -+ while (symbol < 0x10000); -+ return price; -+} -+ -+ -+static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0;) -+ { -+ UInt32 bit; -+ i--; -+ bit = (symbol >> i) & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ } -+} -+ -+static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol) -+{ -+ UInt32 m = 1; -+ int i; -+ for (i = 0; i < numBitLevels; i++) -+ { -+ UInt32 bit = symbol & 1; -+ RangeEnc_EncodeBit(rc, probs + m, bit); -+ m = (m << 1) | bit; -+ symbol >>= 1; -+ } -+} -+ -+static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ symbol |= (1 << numBitLevels); -+ while (symbol != 1) -+ { -+ price += GET_PRICEa(probs[symbol >> 1], symbol & 1); -+ symbol >>= 1; -+ } -+ return price; -+} -+ -+static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices) -+{ -+ UInt32 price = 0; -+ UInt32 m = 1; -+ int i; -+ for (i = numBitLevels; i != 0; i--) -+ { -+ UInt32 bit = symbol & 1; -+ symbol >>= 1; -+ price += GET_PRICEa(probs[m], bit); -+ m = (m << 1) | bit; -+ } -+ return price; -+} -+ -+ -+static void LenEnc_Init(CLenEnc *p) -+{ -+ unsigned i; -+ p->choice = p->choice2 = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++) -+ p->low[i] = kProbInitValue; -+ for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++) -+ p->mid[i] = kProbInitValue; -+ for (i = 0; i < kLenNumHighSymbols; i++) -+ p->high[i] = kProbInitValue; -+} -+ -+static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState) -+{ -+ if (symbol < kLenNumLowSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 0); -+ RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice, 1); -+ if (symbol < kLenNumLowSymbols + kLenNumMidSymbols) -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 0); -+ RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols); -+ } -+ else -+ { -+ RangeEnc_EncodeBit(rc, &p->choice2, 1); -+ RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols); -+ } -+ } -+} -+ -+static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices) -+{ -+ UInt32 a0 = GET_PRICE_0a(p->choice); -+ UInt32 a1 = GET_PRICE_1a(p->choice); -+ UInt32 b0 = a1 + GET_PRICE_0a(p->choice2); -+ UInt32 b1 = a1 + GET_PRICE_1a(p->choice2); -+ UInt32 i = 0; -+ for (i = 0; i < kLenNumLowSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices); -+ } -+ for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++) -+ { -+ if (i >= numSymbols) -+ return; -+ prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices); -+ } -+ for (; i < numSymbols; i++) -+ prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices); -+} -+ -+static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices) -+{ -+ LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices); -+ p->counters[posState] = p->tableSize; -+} -+ -+static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices) -+{ -+ UInt32 posState; -+ for (posState = 0; posState < numPosStates; posState++) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices) -+{ -+ LenEnc_Encode(&p->p, rc, symbol, posState); -+ if (updatePrice) -+ if (--p->counters[posState] == 0) -+ LenPriceEnc_UpdateTable(p, posState, ProbPrices); -+} -+ -+ -+ -+ -+static void MovePos(CLzmaEnc *p, UInt32 num) -+{ -+ #ifdef SHOW_STAT -+ ttt += num; -+ printf("\n MovePos %d", num); -+ #endif -+ if (num != 0) -+ { -+ p->additionalOffset += num; -+ p->matchFinder.Skip(p->matchFinderObj, num); -+ } -+} -+ -+static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes) -+{ -+ UInt32 lenRes = 0, numPairs; -+ p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+ numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches); -+ #ifdef SHOW_STAT -+ printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); -+ ttt++; -+ { -+ UInt32 i; -+ for (i = 0; i < numPairs; i += 2) -+ printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); -+ } -+ #endif -+ if (numPairs > 0) -+ { -+ lenRes = p->matches[numPairs - 2]; -+ if (lenRes == p->numFastBytes) -+ { -+ const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ UInt32 distance = p->matches[numPairs - 1] + 1; -+ UInt32 numAvail = p->numAvail; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ { -+ const Byte *pby2 = pby - distance; -+ for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); -+ } -+ } -+ } -+ p->additionalOffset++; -+ *numDistancePairsRes = numPairs; -+ return lenRes; -+} -+ -+ -+#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False; -+#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False; -+#define IsShortRep(p) ((p)->backPrev == 0) -+ -+static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState) -+{ -+ return -+ GET_PRICE_0(p->isRepG0[state]) + -+ GET_PRICE_0(p->isRep0Long[state][posState]); -+} -+ -+static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState) -+{ -+ UInt32 price; -+ if (repIndex == 0) -+ { -+ price = GET_PRICE_0(p->isRepG0[state]); -+ price += GET_PRICE_1(p->isRep0Long[state][posState]); -+ } -+ else -+ { -+ price = GET_PRICE_1(p->isRepG0[state]); -+ if (repIndex == 1) -+ price += GET_PRICE_0(p->isRepG1[state]); -+ else -+ { -+ price += GET_PRICE_1(p->isRepG1[state]); -+ price += GET_PRICE(p->isRepG2[state], repIndex - 2); -+ } -+ } -+ return price; -+} -+ -+static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState) -+{ -+ return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] + -+ GetPureRepPrice(p, repIndex, state, posState); -+} -+ -+static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur) -+{ -+ UInt32 posMem = p->opt[cur].posPrev; -+ UInt32 backMem = p->opt[cur].backPrev; -+ p->optimumEndIndex = cur; -+ do -+ { -+ if (p->opt[cur].prev1IsChar) -+ { -+ MakeAsChar(&p->opt[posMem]) -+ p->opt[posMem].posPrev = posMem - 1; -+ if (p->opt[cur].prev2) -+ { -+ p->opt[posMem - 1].prev1IsChar = False; -+ p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2; -+ p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2; -+ } -+ } -+ { -+ UInt32 posPrev = posMem; -+ UInt32 backCur = backMem; -+ -+ backMem = p->opt[posPrev].backPrev; -+ posMem = p->opt[posPrev].posPrev; -+ -+ p->opt[posPrev].backPrev = backCur; -+ p->opt[posPrev].posPrev = cur; -+ cur = posPrev; -+ } -+ } -+ while (cur != 0); -+ *backRes = p->opt[0].backPrev; -+ p->optimumCurrentIndex = p->opt[0].posPrev; -+ return p->optimumCurrentIndex; -+} -+ -+#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300) -+ -+static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur; -+ UInt32 matchPrice, repMatchPrice, normalMatchPrice; -+ UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS]; -+ UInt32 *matches; -+ const Byte *data; -+ Byte curByte, matchByte; -+ if (p->optimumEndIndex != p->optimumCurrentIndex) -+ { -+ const COptimal *opt = &p->opt[p->optimumCurrentIndex]; -+ UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex; -+ *backRes = opt->backPrev; -+ p->optimumCurrentIndex = opt->posPrev; -+ return lenRes; -+ } -+ p->optimumCurrentIndex = p->optimumEndIndex = 0; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ if (numAvail < 2) -+ { -+ *backRes = (UInt32)(-1); -+ return 1; -+ } -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ repMaxIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 lenTest; -+ const Byte *data2; -+ reps[i] = p->reps[i]; -+ data2 = data - (reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ { -+ repLens[i] = 0; -+ continue; -+ } -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ repLens[i] = lenTest; -+ if (lenTest > repLens[repMaxIndex]) -+ repMaxIndex = i; -+ } -+ if (repLens[repMaxIndex] >= p->numFastBytes) -+ { -+ UInt32 lenRes; -+ *backRes = repMaxIndex; -+ lenRes = repLens[repMaxIndex]; -+ MovePos(p, lenRes - 1); -+ return lenRes; -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2) -+ { -+ *backRes = (UInt32)-1; -+ return 1; -+ } -+ -+ p->opt[0].state = (CState)p->state; -+ -+ posState = (position & p->pbMask); -+ -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + -+ (!IsCharState(p->state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ MakeAsChar(&p->opt[1]); -+ -+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); -+ -+ if (matchByte == curByte) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState); -+ if (shortRepPrice < p->opt[1].price) -+ { -+ p->opt[1].price = shortRepPrice; -+ MakeAsShortRep(&p->opt[1]); -+ } -+ } -+ lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); -+ -+ if (lenEnd < 2) -+ { -+ *backRes = p->opt[1].backPrev; -+ return 1; -+ } -+ -+ p->opt[1].posPrev = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ p->opt[0].backs[i] = reps[i]; -+ -+ len = lenEnd; -+ do -+ p->opt[len--].price = kInfinityPrice; -+ while (len >= 2); -+ -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 repLen = repLens[i]; -+ UInt32 price; -+ if (repLen < 2) -+ continue; -+ price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2]; -+ COptimal *opt = &p->opt[repLen]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = i; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--repLen >= 2); -+ } -+ -+ normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]); -+ -+ len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); -+ if (len <= mainLen) -+ { -+ UInt32 offs = 0; -+ while (len > matches[offs]) -+ offs += 2; -+ for (; ; len++) -+ { -+ COptimal *opt; -+ UInt32 distance = matches[offs + 1]; -+ -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(len); -+ if (distance < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][distance]; -+ else -+ { -+ UInt32 slot; -+ GetPosSlot2(distance, slot); -+ curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot]; -+ } -+ opt = &p->opt[len]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = 0; -+ opt->backPrev = distance + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ if (len == matches[offs]) -+ { -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ } -+ } -+ } -+ -+ cur = 0; -+ -+ #ifdef SHOW_STAT2 -+ if (position >= 0) -+ { -+ unsigned i; -+ printf("\n pos = %4X", position); -+ for (i = cur; i <= lenEnd; i++) -+ printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); -+ } -+ #endif -+ -+ for (;;) -+ { -+ UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; -+ UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; -+ Bool nextIsChar; -+ Byte curByte, matchByte; -+ const Byte *data; -+ COptimal *curOpt; -+ COptimal *nextOpt; -+ -+ cur++; -+ if (cur == lenEnd) -+ return Backward(p, backRes, cur); -+ -+ newLen = ReadMatchDistances(p, &numPairs); -+ if (newLen >= p->numFastBytes) -+ { -+ p->numPairs = numPairs; -+ p->longestMatchLength = newLen; -+ return Backward(p, backRes, cur); -+ } -+ position++; -+ curOpt = &p->opt[cur]; -+ posPrev = curOpt->posPrev; -+ if (curOpt->prev1IsChar) -+ { -+ posPrev--; -+ if (curOpt->prev2) -+ { -+ state = p->opt[curOpt->posPrev2].state; -+ if (curOpt->backPrev2 < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ state = kLiteralNextStates[state]; -+ } -+ else -+ state = p->opt[posPrev].state; -+ if (posPrev == cur - 1) -+ { -+ if (IsShortRep(curOpt)) -+ state = kShortRepNextStates[state]; -+ else -+ state = kLiteralNextStates[state]; -+ } -+ else -+ { -+ UInt32 pos; -+ const COptimal *prevOpt; -+ if (curOpt->prev1IsChar && curOpt->prev2) -+ { -+ posPrev = curOpt->posPrev2; -+ pos = curOpt->backPrev2; -+ state = kRepNextStates[state]; -+ } -+ else -+ { -+ pos = curOpt->backPrev; -+ if (pos < LZMA_NUM_REPS) -+ state = kRepNextStates[state]; -+ else -+ state = kMatchNextStates[state]; -+ } -+ prevOpt = &p->opt[posPrev]; -+ if (pos < LZMA_NUM_REPS) -+ { -+ UInt32 i; -+ reps[0] = prevOpt->backs[pos]; -+ for (i = 1; i <= pos; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ for (; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i]; -+ } -+ else -+ { -+ UInt32 i; -+ reps[0] = (pos - LZMA_NUM_REPS); -+ for (i = 1; i < LZMA_NUM_REPS; i++) -+ reps[i] = prevOpt->backs[i - 1]; -+ } -+ } -+ curOpt->state = (CState)state; -+ -+ curOpt->backs[0] = reps[0]; -+ curOpt->backs[1] = reps[1]; -+ curOpt->backs[2] = reps[2]; -+ curOpt->backs[3] = reps[3]; -+ -+ curPrice = curOpt->price; -+ nextIsChar = False; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ curByte = *data; -+ matchByte = *(data - (reps[0] + 1)); -+ -+ posState = (position & p->pbMask); -+ -+ curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]); -+ { -+ const CLzmaProb *probs = LIT_PROBS(position, *(data - 1)); -+ curAnd1Price += -+ (!IsCharState(state) ? -+ LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) : -+ LitEnc_GetPrice(probs, curByte, p->ProbPrices)); -+ } -+ -+ nextOpt = &p->opt[cur + 1]; -+ -+ if (curAnd1Price < nextOpt->price) -+ { -+ nextOpt->price = curAnd1Price; -+ nextOpt->posPrev = cur; -+ MakeAsChar(nextOpt); -+ nextIsChar = True; -+ } -+ -+ matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]); -+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]); -+ -+ if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0)) -+ { -+ UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState); -+ if (shortRepPrice <= nextOpt->price) -+ { -+ nextOpt->price = shortRepPrice; -+ nextOpt->posPrev = cur; -+ MakeAsShortRep(nextOpt); -+ nextIsChar = True; -+ } -+ } -+ numAvailFull = p->numAvail; -+ { -+ UInt32 temp = kNumOpts - 1 - cur; -+ if (temp < numAvailFull) -+ numAvailFull = temp; -+ } -+ -+ if (numAvailFull < 2) -+ continue; -+ numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes); -+ -+ if (!nextIsChar && matchByte != curByte) /* speed optimization */ -+ { -+ /* try Literal + rep0 */ -+ UInt32 temp; -+ UInt32 lenTest2; -+ const Byte *data2 = data - (reps[0] + 1); -+ UInt32 limit = p->numFastBytes + 1; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ -+ for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); -+ lenTest2 = temp - 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kLiteralNextStates[state]; -+ UInt32 posStateNext = (position + 1) & p->pbMask; -+ UInt32 nextRepMatchPrice = curAnd1Price + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = False; -+ } -+ } -+ } -+ } -+ -+ startLen = 2; /* speed optimization */ -+ { -+ UInt32 repIndex; -+ for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++) -+ { -+ UInt32 lenTest; -+ UInt32 lenTestTemp; -+ UInt32 price; -+ const Byte *data2 = data - (reps[repIndex] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); -+ while (lenEnd < cur + lenTest) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ lenTestTemp = lenTest; -+ price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState); -+ do -+ { -+ UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2]; -+ COptimal *opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = repIndex; -+ opt->prev1IsChar = False; -+ } -+ } -+ while (--lenTest >= 2); -+ lenTest = lenTestTemp; -+ -+ if (repIndex == 0) -+ startLen = lenTest + 1; -+ -+ /* if (_maxMode) */ -+ { -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kRepNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = -+ price + p->repLenEnc.prices[posState][lenTest - 2] + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (position + lenTest + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = repIndex; -+ } -+ } -+ } -+ } -+ } -+ } -+ /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ -+ if (newLen > numAvail) -+ { -+ newLen = numAvail; -+ for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); -+ matches[numPairs] = newLen; -+ numPairs += 2; -+ } -+ if (newLen >= startLen) -+ { -+ UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); -+ UInt32 offs, curBack, posSlot; -+ UInt32 lenTest; -+ while (lenEnd < cur + newLen) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ -+ offs = 0; -+ while (startLen > matches[offs]) -+ offs += 2; -+ curBack = matches[offs + 1]; -+ GetPosSlot2(curBack, posSlot); -+ for (lenTest = /*2*/ startLen; ; lenTest++) -+ { -+ UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; -+ UInt32 lenToPosState = GetLenToPosState(lenTest); -+ COptimal *opt; -+ if (curBack < kNumFullDistances) -+ curAndLenPrice += p->distancesPrices[lenToPosState][curBack]; -+ else -+ curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask]; -+ -+ opt = &p->opt[cur + lenTest]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur; -+ opt->backPrev = curBack + LZMA_NUM_REPS; -+ opt->prev1IsChar = False; -+ } -+ -+ if (/*_maxMode && */lenTest == matches[offs]) -+ { -+ /* Try Match + Literal + Rep0 */ -+ const Byte *data2 = data - (curBack + 1); -+ UInt32 lenTest2 = lenTest + 1; -+ UInt32 limit = lenTest2 + p->numFastBytes; -+ UInt32 nextRepMatchPrice; -+ if (limit > numAvailFull) -+ limit = numAvailFull; -+ for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); -+ lenTest2 -= lenTest + 1; -+ if (lenTest2 >= 2) -+ { -+ UInt32 state2 = kMatchNextStates[state]; -+ UInt32 posStateNext = (position + lenTest) & p->pbMask; -+ UInt32 curAndLenCharPrice = curAndLenPrice + -+ GET_PRICE_0(p->isMatch[state2][posStateNext]) + -+ LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]), -+ data[lenTest], data2[lenTest], p->ProbPrices); -+ state2 = kLiteralNextStates[state2]; -+ posStateNext = (posStateNext + 1) & p->pbMask; -+ nextRepMatchPrice = curAndLenCharPrice + -+ GET_PRICE_1(p->isMatch[state2][posStateNext]) + -+ GET_PRICE_1(p->isRep[state2]); -+ -+ /* for (; lenTest2 >= 2; lenTest2--) */ -+ { -+ UInt32 offset = cur + lenTest + 1 + lenTest2; -+ UInt32 curAndLenPrice; -+ COptimal *opt; -+ while (lenEnd < offset) -+ p->opt[++lenEnd].price = kInfinityPrice; -+ curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); -+ opt = &p->opt[offset]; -+ if (curAndLenPrice < opt->price) -+ { -+ opt->price = curAndLenPrice; -+ opt->posPrev = cur + lenTest + 1; -+ opt->backPrev = 0; -+ opt->prev1IsChar = True; -+ opt->prev2 = True; -+ opt->posPrev2 = cur; -+ opt->backPrev2 = curBack + LZMA_NUM_REPS; -+ } -+ } -+ } -+ offs += 2; -+ if (offs == numPairs) -+ break; -+ curBack = matches[offs + 1]; -+ if (curBack >= kNumFullDistances) -+ GetPosSlot2(curBack, posSlot); -+ } -+ } -+ } -+ } -+} -+ -+#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) -+ -+static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes) -+{ -+ UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; -+ const Byte *data; -+ const UInt32 *matches; -+ -+ if (p->additionalOffset == 0) -+ mainLen = ReadMatchDistances(p, &numPairs); -+ else -+ { -+ mainLen = p->longestMatchLength; -+ numPairs = p->numPairs; -+ } -+ -+ numAvail = p->numAvail; -+ *backRes = (UInt32)-1; -+ if (numAvail < 2) -+ return 1; -+ if (numAvail > LZMA_MATCH_LEN_MAX) -+ numAvail = LZMA_MATCH_LEN_MAX; -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ -+ repLen = repIndex = 0; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ for (len = 2; len < numAvail && data[len] == data2[len]; len++); -+ if (len >= p->numFastBytes) -+ { -+ *backRes = i; -+ MovePos(p, len - 1); -+ return len; -+ } -+ if (len > repLen) -+ { -+ repIndex = i; -+ repLen = len; -+ } -+ } -+ -+ matches = p->matches; -+ if (mainLen >= p->numFastBytes) -+ { -+ *backRes = matches[numPairs - 1] + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 1); -+ return mainLen; -+ } -+ -+ mainDist = 0; /* for GCC */ -+ if (mainLen >= 2) -+ { -+ mainDist = matches[numPairs - 1]; -+ while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) -+ { -+ if (!ChangePair(matches[numPairs - 3], mainDist)) -+ break; -+ numPairs -= 2; -+ mainLen = matches[numPairs - 2]; -+ mainDist = matches[numPairs - 1]; -+ } -+ if (mainLen == 2 && mainDist >= 0x80) -+ mainLen = 1; -+ } -+ -+ if (repLen >= 2 && ( -+ (repLen + 1 >= mainLen) || -+ (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || -+ (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) -+ { -+ *backRes = repIndex; -+ MovePos(p, repLen - 1); -+ return repLen; -+ } -+ -+ if (mainLen < 2 || numAvail <= 2) -+ return 1; -+ -+ p->longestMatchLength = ReadMatchDistances(p, &p->numPairs); -+ if (p->longestMatchLength >= 2) -+ { -+ UInt32 newDistance = matches[p->numPairs - 1]; -+ if ((p->longestMatchLength >= mainLen && newDistance < mainDist) || -+ (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) || -+ (p->longestMatchLength > mainLen + 1) || -+ (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist))) -+ return 1; -+ } -+ -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1; -+ for (i = 0; i < LZMA_NUM_REPS; i++) -+ { -+ UInt32 len, limit; -+ const Byte *data2 = data - (p->reps[i] + 1); -+ if (data[0] != data2[0] || data[1] != data2[1]) -+ continue; -+ limit = mainLen - 1; -+ for (len = 2; len < limit && data[len] == data2[len]; len++); -+ if (len >= limit) -+ return 1; -+ } -+ *backRes = mainDist + LZMA_NUM_REPS; -+ MovePos(p, mainLen - 2); -+ return mainLen; -+} -+ -+static void WriteEndMarker(CLzmaEnc *p, UInt32 posState) -+{ -+ UInt32 len; -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ len = LZMA_MATCH_LEN_MIN; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1); -+ RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask); -+} -+ -+static SRes CheckErrors(CLzmaEnc *p) -+{ -+ if (p->result != SZ_OK) -+ return p->result; -+ if (p->rc.res != SZ_OK) -+ p->result = SZ_ERROR_WRITE; -+ if (p->matchFinderBase.result != SZ_OK) -+ p->result = SZ_ERROR_READ; -+ if (p->result != SZ_OK) -+ p->finished = True; -+ return p->result; -+} -+ -+static SRes Flush(CLzmaEnc *p, UInt32 nowPos) -+{ -+ /* ReleaseMFStream(); */ -+ p->finished = True; -+ if (p->writeEndMark) -+ WriteEndMarker(p, nowPos & p->pbMask); -+ RangeEnc_FlushData(&p->rc); -+ RangeEnc_FlushStream(&p->rc); -+ return CheckErrors(p); -+} -+ -+static void FillAlignPrices(CLzmaEnc *p) -+{ -+ UInt32 i; -+ for (i = 0; i < kAlignTableSize; i++) -+ p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices); -+ p->alignPriceCount = 0; -+} -+ -+static void FillDistancesPrices(CLzmaEnc *p) -+{ -+ UInt32 tempPrices[kNumFullDistances]; -+ UInt32 i, lenToPosState; -+ for (i = kStartPosModelIndex; i < kNumFullDistances; i++) -+ { -+ UInt32 posSlot = GetPosSlot1(i); -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices); -+ } -+ -+ for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++) -+ { -+ UInt32 posSlot; -+ const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState]; -+ UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState]; -+ for (posSlot = 0; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices); -+ for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++) -+ posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits); -+ -+ { -+ UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; -+ UInt32 i; -+ for (i = 0; i < kStartPosModelIndex; i++) -+ distancesPrices[i] = posSlotPrices[i]; -+ for (; i < kNumFullDistances; i++) -+ distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i]; -+ } -+ } -+ p->matchPriceCount = 0; -+} -+ -+void LzmaEnc_Construct(CLzmaEnc *p) -+{ -+ RangeEnc_Construct(&p->rc); -+ MatchFinder_Construct(&p->matchFinderBase); -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Construct(&p->matchFinderMt); -+ p->matchFinderMt.MatchFinder = &p->matchFinderBase; -+ #endif -+ -+ { -+ CLzmaEncProps props; -+ LzmaEncProps_Init(&props); -+ LzmaEnc_SetProps(p, &props); -+ } -+ -+ #ifndef LZMA_LOG_BSR -+ LzmaEnc_FastPosInit(p->g_FastPos); -+ #endif -+ -+ LzmaEnc_InitPriceTables(p->ProbPrices); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc) -+{ -+ void *p; -+ p = alloc->Alloc(alloc, sizeof(CLzmaEnc)); -+ if (p != 0) -+ LzmaEnc_Construct((CLzmaEnc *)p); -+ return p; -+} -+ -+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc) -+{ -+ alloc->Free(alloc, p->litProbs); -+ alloc->Free(alloc, p->saveState.litProbs); -+ p->litProbs = 0; -+ p->saveState.litProbs = 0; -+} -+ -+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ #ifndef _7ZIP_ST -+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); -+ #endif -+ MatchFinder_Free(&p->matchFinderBase, allocBig); -+ LzmaEnc_FreeLits(p, alloc); -+ RangeEnc_Free(&p->rc, alloc); -+} -+ -+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); -+ alloc->Free(alloc, p); -+} -+ -+static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize) -+{ -+ UInt32 nowPos32, startPos32; -+ if (p->needInit) -+ { -+ p->matchFinder.Init(p->matchFinderObj); -+ p->needInit = 0; -+ } -+ -+ if (p->finished) -+ return p->result; -+ RINOK(CheckErrors(p)); -+ -+ nowPos32 = (UInt32)p->nowPos64; -+ startPos32 = nowPos32; -+ -+ if (p->nowPos64 == 0) -+ { -+ UInt32 numPairs; -+ Byte curByte; -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ return Flush(p, nowPos32); -+ ReadMatchDistances(p, &numPairs); -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0); -+ p->state = kLiteralNextStates[p->state]; -+ curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset); -+ LitEnc_Encode(&p->rc, p->litProbs, curByte); -+ p->additionalOffset--; -+ nowPos32++; -+ } -+ -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0) -+ for (;;) -+ { -+ UInt32 pos, len, posState; -+ -+ if (p->fastMode) -+ len = GetOptimumFast(p, &pos); -+ else -+ len = GetOptimum(p, nowPos32, &pos); -+ -+ #ifdef SHOW_STAT2 -+ printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); -+ #endif -+ -+ posState = nowPos32 & p->pbMask; -+ if (len == 1 && pos == (UInt32)-1) -+ { -+ Byte curByte; -+ CLzmaProb *probs; -+ const Byte *data; -+ -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0); -+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+ curByte = *data; -+ probs = LIT_PROBS(nowPos32, *(data - 1)); -+ if (IsCharState(p->state)) -+ LitEnc_Encode(&p->rc, probs, curByte); -+ else -+ LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1)); -+ p->state = kLiteralNextStates[p->state]; -+ } -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1); -+ if (pos < LZMA_NUM_REPS) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1); -+ if (pos == 0) -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0); -+ RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1)); -+ } -+ else -+ { -+ UInt32 distance = p->reps[pos]; -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1); -+ if (pos == 1) -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0); -+ else -+ { -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1); -+ RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2); -+ if (pos == 3) -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ } -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = distance; -+ } -+ if (len == 1) -+ p->state = kShortRepNextStates[p->state]; -+ else -+ { -+ LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ p->state = kRepNextStates[p->state]; -+ } -+ } -+ else -+ { -+ UInt32 posSlot; -+ RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0); -+ p->state = kMatchNextStates[p->state]; -+ LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices); -+ pos -= LZMA_NUM_REPS; -+ GetPosSlot(pos, posSlot); -+ RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot); -+ -+ if (posSlot >= kStartPosModelIndex) -+ { -+ UInt32 footerBits = ((posSlot >> 1) - 1); -+ UInt32 base = ((2 | (posSlot & 1)) << footerBits); -+ UInt32 posReduced = pos - base; -+ -+ if (posSlot < kEndPosModelIndex) -+ RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced); -+ else -+ { -+ RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits); -+ RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask); -+ p->alignPriceCount++; -+ } -+ } -+ p->reps[3] = p->reps[2]; -+ p->reps[2] = p->reps[1]; -+ p->reps[1] = p->reps[0]; -+ p->reps[0] = pos; -+ p->matchPriceCount++; -+ } -+ } -+ p->additionalOffset -= len; -+ nowPos32 += len; -+ if (p->additionalOffset == 0) -+ { -+ UInt32 processed; -+ if (!p->fastMode) -+ { -+ if (p->matchPriceCount >= (1 << 7)) -+ FillDistancesPrices(p); -+ if (p->alignPriceCount >= kAlignTableSize) -+ FillAlignPrices(p); -+ } -+ if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0) -+ break; -+ processed = nowPos32 - startPos32; -+ if (useLimits) -+ { -+ if (processed + kNumOpts + 300 >= maxUnpackSize || -+ RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize) -+ break; -+ } -+ else if (processed >= (1 << 15)) -+ { -+ p->nowPos64 += nowPos32 - startPos32; -+ return CheckErrors(p); -+ } -+ } -+ } -+ p->nowPos64 += nowPos32 - startPos32; -+ return Flush(p, nowPos32); -+} -+ -+#define kBigHashDicLimit ((UInt32)1 << 24) -+ -+static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 beforeSize = kNumOpts; -+ Bool btMode; -+ if (!RangeEnc_Alloc(&p->rc, alloc)) -+ return SZ_ERROR_MEM; -+ btMode = (p->matchFinderBase.btMode != 0); -+ #ifndef _7ZIP_ST -+ p->mtMode = (p->multiThread && !p->fastMode && btMode); -+ #endif -+ -+ { -+ unsigned lclp = p->lc + p->lp; -+ if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb)); -+ if (p->litProbs == 0 || p->saveState.litProbs == 0) -+ { -+ LzmaEnc_FreeLits(p, alloc); -+ return SZ_ERROR_MEM; -+ } -+ p->lclp = lclp; -+ } -+ } -+ -+ p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit); -+ -+ if (beforeSize + p->dictSize < keepWindowSize) -+ beforeSize = keepWindowSize - p->dictSize; -+ -+ #ifndef _7ZIP_ST -+ if (p->mtMode) -+ { -+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); -+ p->matchFinderObj = &p->matchFinderMt; -+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); -+ } -+ else -+ #endif -+ { -+ if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)) -+ return SZ_ERROR_MEM; -+ p->matchFinderObj = &p->matchFinderBase; -+ MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder); -+ } -+ return SZ_OK; -+} -+ -+void LzmaEnc_Init(CLzmaEnc *p) -+{ -+ UInt32 i; -+ p->state = 0; -+ for (i = 0 ; i < LZMA_NUM_REPS; i++) -+ p->reps[i] = 0; -+ -+ RangeEnc_Init(&p->rc); -+ -+ -+ for (i = 0; i < kNumStates; i++) -+ { -+ UInt32 j; -+ for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++) -+ { -+ p->isMatch[i][j] = kProbInitValue; -+ p->isRep0Long[i][j] = kProbInitValue; -+ } -+ p->isRep[i] = kProbInitValue; -+ p->isRepG0[i] = kProbInitValue; -+ p->isRepG1[i] = kProbInitValue; -+ p->isRepG2[i] = kProbInitValue; -+ } -+ -+ { -+ UInt32 num = 0x300 << (p->lp + p->lc); -+ for (i = 0; i < num; i++) -+ p->litProbs[i] = kProbInitValue; -+ } -+ -+ { -+ for (i = 0; i < kNumLenToPosStates; i++) -+ { -+ CLzmaProb *probs = p->posSlotEncoder[i]; -+ UInt32 j; -+ for (j = 0; j < (1 << kNumPosSlotBits); j++) -+ probs[j] = kProbInitValue; -+ } -+ } -+ { -+ for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++) -+ p->posEncoders[i] = kProbInitValue; -+ } -+ -+ LenEnc_Init(&p->lenEnc.p); -+ LenEnc_Init(&p->repLenEnc.p); -+ -+ for (i = 0; i < (1 << kNumAlignBits); i++) -+ p->posAlignEncoder[i] = kProbInitValue; -+ -+ p->optimumEndIndex = 0; -+ p->optimumCurrentIndex = 0; -+ p->additionalOffset = 0; -+ -+ p->pbMask = (1 << p->pb) - 1; -+ p->lpMask = (1 << p->lp) - 1; -+} -+ -+void LzmaEnc_InitPrices(CLzmaEnc *p) -+{ -+ if (!p->fastMode) -+ { -+ FillDistancesPrices(p); -+ FillAlignPrices(p); -+ } -+ -+ p->lenEnc.tableSize = -+ p->repLenEnc.tableSize = -+ p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN; -+ LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices); -+ LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices); -+} -+ -+static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ UInt32 i; -+ for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++) -+ if (p->dictSize <= ((UInt32)1 << i)) -+ break; -+ p->distTableSize = i * 2; -+ -+ p->finished = False; -+ p->result = SZ_OK; -+ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ p->nowPos64 = 0; -+ return SZ_OK; -+} -+ -+static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ p->rc.outStream = outStream; -+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); -+} -+ -+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, -+ ISeqInStream *inStream, UInt32 keepWindowSize, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ p->matchFinderBase.stream = inStream; -+ p->needInit = 1; -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) -+{ -+ p->matchFinderBase.directInput = 1; -+ p->matchFinderBase.bufferBase = (Byte *)src; -+ p->matchFinderBase.directInputRem = srcLen; -+} -+ -+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, -+ UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ p->needInit = 1; -+ -+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); -+} -+ -+void LzmaEnc_Finish(CLzmaEncHandle pp) -+{ -+ #ifndef _7ZIP_ST -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ if (p->mtMode) -+ MatchFinderMt_ReleaseStream(&p->matchFinderMt); -+ #else -+ pp = pp; -+ #endif -+} -+ -+typedef struct -+{ -+ ISeqOutStream funcTable; -+ Byte *data; -+ SizeT rem; -+ Bool overflow; -+} CSeqOutStreamBuf; -+ -+static size_t MyWrite(void *pp, const void *data, size_t size) -+{ -+ CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp; -+ if (p->rem < size) -+ { -+ size = p->rem; -+ p->overflow = True; -+ } -+ memcpy(p->data, data, size); -+ p->rem -= size; -+ p->data += size; -+ return size; -+} -+ -+ -+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); -+} -+ -+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) -+{ -+ const CLzmaEnc *p = (CLzmaEnc *)pp; -+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; -+} -+ -+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, -+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ UInt64 nowPos64; -+ SRes res; -+ CSeqOutStreamBuf outStream; -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = False; -+ p->finished = False; -+ p->result = SZ_OK; -+ -+ if (reInit) -+ LzmaEnc_Init(p); -+ LzmaEnc_InitPrices(p); -+ nowPos64 = p->nowPos64; -+ RangeEnc_Init(&p->rc); -+ p->rc.outStream = &outStream.funcTable; -+ -+ res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); -+ -+ *unpackSize = (UInt32)(p->nowPos64 - nowPos64); -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ -+ return res; -+} -+ -+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) -+{ -+ SRes res = SZ_OK; -+ -+ #ifndef _7ZIP_ST -+ Byte allocaDummy[0x300]; -+ int i = 0; -+ for (i = 0; i < 16; i++) -+ allocaDummy[i] = (Byte)i; -+ #endif -+ -+ for (;;) -+ { -+ res = LzmaEnc_CodeOneBlock(p, False, 0, 0); -+ if (res != SZ_OK || p->finished != 0) -+ break; -+ if (progress != 0) -+ { -+ res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc)); -+ if (res != SZ_OK) -+ { -+ res = SZ_ERROR_PROGRESS; -+ break; -+ } -+ } -+ } -+ LzmaEnc_Finish(p); -+ return res; -+} -+ -+SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, -+ ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); -+ return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); -+} -+ -+SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ int i; -+ UInt32 dictSize = p->dictSize; -+ if (*size < LZMA_PROPS_SIZE) -+ return SZ_ERROR_PARAM; -+ *size = LZMA_PROPS_SIZE; -+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); -+ -+ for (i = 11; i <= 30; i++) -+ { -+ if (dictSize <= ((UInt32)2 << i)) -+ { -+ dictSize = (2 << i); -+ break; -+ } -+ if (dictSize <= ((UInt32)3 << i)) -+ { -+ dictSize = (3 << i); -+ break; -+ } -+ } -+ -+ for (i = 0; i < 4; i++) -+ props[1 + i] = (Byte)(dictSize >> (8 * i)); -+ return SZ_OK; -+} -+ -+SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ SRes res; -+ CLzmaEnc *p = (CLzmaEnc *)pp; -+ -+ CSeqOutStreamBuf outStream; -+ -+ LzmaEnc_SetInputBuf(p, src, srcLen); -+ -+ outStream.funcTable.Write = MyWrite; -+ outStream.data = dest; -+ outStream.rem = *destLen; -+ outStream.overflow = False; -+ -+ p->writeEndMark = writeEndMark; -+ -+ p->rc.outStream = &outStream.funcTable; -+ res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); -+ if (res == SZ_OK) -+ res = LzmaEnc_Encode2(p, progress); -+ -+ *destLen -= outStream.rem; -+ if (outStream.overflow) -+ return SZ_ERROR_OUTPUT_EOF; -+ return res; -+} -+ -+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, -+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, -+ ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig) -+{ -+ CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); -+ SRes res; -+ if (p == 0) -+ return SZ_ERROR_MEM; -+ -+ res = LzmaEnc_SetProps(p, props); -+ if (res == SZ_OK) -+ { -+ res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize); -+ if (res == SZ_OK) -+ res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen, -+ writeEndMark, progress, alloc, allocBig); -+ } -+ -+ LzmaEnc_Destroy(p, alloc, allocBig); -+ return res; -+} ---- /dev/null -+++ b/lib/lzma/Makefile -@@ -0,0 +1,7 @@ -+lzma_compress-objs := LzFind.o LzmaEnc.o -+lzma_decompress-objs := LzmaDec.o -+ -+obj-$(CONFIG_LZMA_COMPRESS) += lzma_compress.o -+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma_decompress.o -+ -+EXTRA_CFLAGS += -Iinclude/linux -Iinclude/linux/lzma -include types.h diff --git a/target/linux/generic/pending-4.4/531-debloat_lzma.patch b/target/linux/generic/pending-4.4/531-debloat_lzma.patch deleted file mode 100644 index aa3c49801..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/532-jffs2_eofdetect.patch b/target/linux/generic/pending-4.4/532-jffs2_eofdetect.patch deleted file mode 100644 index 8ce53d8be..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/551-ubifs-fix-default-compression-selection.patch b/target/linux/generic/pending-4.4/551-ubifs-fix-default-compression-selection.patch deleted file mode 100644 index 1b0f30718..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/600-netfilter_conntrack_flush.patch b/target/linux/generic/pending-4.4/600-netfilter_conntrack_flush.patch deleted file mode 100644 index 879473965..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -288,10 +289,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, - }; -@@ -393,7 +450,7 @@ static int nf_conntrack_standalone_init_ - { - struct proc_dir_entry *pde; - -- pde = proc_create("nf_conntrack", 0440, net->proc_net, &ct_file_ops); -+ pde = proc_create("nf_conntrack", 0660, net->proc_net, &ct_file_ops); - if (!pde) - goto out_nf_conntrack; - diff --git a/target/linux/generic/pending-4.4/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-4.4/610-netfilter_match_bypass_default_checks.patch deleted file mode 100644 index dce8020c9..000000000 --- a/target/linux/generic/pending-4.4/610-netfilter_match_bypass_default_checks.patch +++ /dev/null @@ -1,101 +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) - { -@@ -655,6 +681,8 @@ find_check_entry(struct ipt_entry *e, st - struct xt_entry_match *ematch; - unsigned long pcnt; - -+ ip_checkdefault(&e->ip); -+ - pcnt = xt_percpu_counter_alloc(); - if (IS_ERR_VALUE(pcnt)) - return -ENOMEM; -@@ -953,6 +981,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)) -@@ -980,6 +1009,14 @@ copy_entries_to_user(unsigned int total_ - goto free_counters; - } - -+ flags = e->ip.flags & IPT_F_MASK; -+ if (copy_to_user(userptr + off -+ + offsetof(struct ipt_entry, ip.flags), -+ &flags, sizeof(flags)) != 0) { -+ ret = -EFAULT; -+ goto free_counters; -+ } -+ - for (i = sizeof(struct ipt_entry); - i < e->target_offset; - i += m->u.match_size) { -@@ -1385,12 +1422,15 @@ compat_copy_entry_to_user(struct ipt_ent - compat_uint_t origsize; - const struct xt_entry_match *ematch; - int ret = 0; -+ u8 flags = e->ip.flags & IPT_F_MASK; - - origsize = *size; - ce = (struct compat_ipt_entry __user *)*dstptr; - if (copy_to_user(ce, e, sizeof(struct ipt_entry)) != 0 || - copy_to_user(&ce->counters, &counters[i], -- sizeof(counters[i])) != 0) -+ sizeof(counters[i])) != 0 || -+ copy_to_user(&ce->ip.flags, &flags, -+ sizeof(flags)) != 0) - return -EFAULT; - - *dstptr += sizeof(struct compat_ipt_entry); diff --git a/target/linux/generic/pending-4.4/611-netfilter_match_bypass_default_table.patch b/target/linux/generic/pending-4.4/611-netfilter_match_bypass_default_table.patch deleted file mode 100644 index 1c565198b..000000000 --- a/target/linux/generic/pending-4.4/611-netfilter_match_bypass_default_table.patch +++ /dev/null @@ -1,111 +0,0 @@ ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -308,6 +308,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, -@@ -328,28 +355,8 @@ ipt_do_table(struct sk_buff *skb, - unsigned int addend; - - /* Initialization */ -- stackidx = 0; -- ip = ip_hdr(skb); -- indev = state->in ? state->in->name : nulldevname; -- outdev = state->out ? state->out->name : nulldevname; -- /* 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 -- * things we don't know, ie. tcp syn flag or ports). If the -- * rule is also a fragment-specific rule, non-fragments won't -- * match it. */ -- acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; -- acpar.thoff = ip_hdrlen(skb); -- acpar.hotdrop = false; -- acpar.net = state->net; -- acpar.in = state->in; -- acpar.out = state->out; -- 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(); - /* -@@ -358,6 +365,23 @@ ipt_do_table(struct sk_buff *skb, - */ - smp_read_barrier_depends(); - table_base = private->entries; -+ -+ e = get_entry(table_base, private->hook_entry[hook]); -+ if (ipt_handle_default_rule(e, &verdict)) { -+ struct xt_counters *counter; -+ -+ counter = xt_get_this_cpu_counter(&e->counters); -+ ADD_COUNTER(*counter, skb->len, 1); -+ local_bh_enable(); -+ return verdict; -+ } -+ -+ stackidx = 0; -+ 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]; - - /* Switch to alternate jumpstack if we're being invoked via TEE. -@@ -370,7 +394,20 @@ ipt_do_table(struct sk_buff *skb, - if (static_key_false(&xt_tee_enabled)) - jumpstack += private->stacksize * __this_cpu_read(nf_skb_duplicated); - -- e = get_entry(table_base, private->hook_entry[hook]); -+ /* 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 -+ * things we don't know, ie. tcp syn flag or ports). If the -+ * rule is also a fragment-specific rule, non-fragments won't -+ * match it. */ -+ acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; -+ acpar.thoff = ip_hdrlen(skb); -+ acpar.hotdrop = false; -+ acpar.net = state->net; -+ acpar.in = state->in; -+ acpar.out = state->out; -+ acpar.family = NFPROTO_IPV4; -+ acpar.hooknum = hook; - - pr_debug("Entering %s(hook %u), UF %p\n", - table->name, hook, diff --git a/target/linux/generic/pending-4.4/612-netfilter_match_reduce_memory_access.patch b/target/linux/generic/pending-4.4/612-netfilter_match_reduce_memory_access.patch deleted file mode 100644 index 72172d8bb..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/613-netfilter_optional_tcp_window_check.patch b/target/linux/generic/pending-4.4/613-netfilter_optional_tcp_window_check.patch deleted file mode 100644 index 3740dd74e..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/616-net_optimize_xfrm_calls.patch b/target/linux/generic/pending-4.4/616-net_optimize_xfrm_calls.patch deleted file mode 100644 index e4634e321..000000000 --- a/target/linux/generic/pending-4.4/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 net *net, s - struct dst_entry *dst; - int err; - -+ if (skb->dev && !dev_net(skb->dev)->xfrm.policy_count[XFRM_POLICY_OUT]) -+ return 0; -+ - err = xfrm_decode_session(skb, &fl, family); - if (err < 0) - return err; diff --git a/target/linux/generic/pending-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch b/target/linux/generic/pending-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch deleted file mode 100644 index 2ec9c7a9e..000000000 --- a/target/linux/generic/pending-4.4/620-net_sched-codel-do-not-defer-queue-length-update.patch +++ /dev/null @@ -1,86 +0,0 @@ -From: Konstantin Khlebnikov -Date: Mon, 21 Aug 2017 11:14:14 +0300 -Subject: [PATCH] net_sched/codel: do not defer queue length update - -When codel wants to drop last packet in ->dequeue() it cannot call -qdisc_tree_reduce_backlog() right away - it will notify parent qdisc -about zero qlen and HTB/HFSC will deactivate class. The same class will -be deactivated second time by caller of ->dequeue(). Currently codel and -fq_codel defer update. This triggers warning in HFSC when it's qlen != 0 -but there is no active classes. - -This patch update parent queue length immediately: just temporary increase -qlen around qdisc_tree_reduce_backlog() to prevent first class deactivation -if we have skb to return. - -This might open another problem in HFSC - now operation peek could fail and -deactivate parent class. - -Signed-off-by: Konstantin Khlebnikov -Link: https://bugzilla.kernel.org/show_bug.cgi?id=109581 ---- - ---- a/net/sched/sch_codel.c -+++ b/net/sched/sch_codel.c -@@ -79,11 +79,17 @@ static struct sk_buff *codel_qdisc_deque - - skb = codel_dequeue(sch, &q->params, &q->vars, &q->stats, dequeue); - -- /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -- * or HTB crashes. Defer it for next round. -+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate -+ * parent class, dequeue in parent qdisc will do the same if we -+ * return skb. Temporary increment qlen if we have skb. - */ -- if (q->stats.drop_count && sch->q.qlen) { -- qdisc_tree_reduce_backlog(sch, q->stats.drop_count, q->stats.drop_len); -+ if (q->stats.drop_count) { -+ if (skb) -+ sch->q.qlen++; -+ qdisc_tree_reduce_backlog(sch, q->stats.drop_count, -+ q->stats.drop_len); -+ if (skb) -+ sch->q.qlen--; - q->stats.drop_count = 0; - q->stats.drop_len = 0; - } ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -311,6 +311,21 @@ begin: - flow->dropped += q->cstats.drop_count - prev_drop_count; - flow->dropped += q->cstats.ecn_mark - prev_ecn_mark; - -+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate -+ * parent class, dequeue in parent qdisc will do the same if we -+ * return skb. Temporary increment qlen if we have skb. -+ */ -+ if (q->cstats.drop_count) { -+ if (skb) -+ sch->q.qlen++; -+ qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, -+ q->cstats.drop_len); -+ if (skb) -+ sch->q.qlen--; -+ q->cstats.drop_count = 0; -+ q->cstats.drop_len = 0; -+ } -+ - if (!skb) { - /* force a pass through old_flows to prevent starvation */ - if ((head == &q->new_flows) && !list_empty(&q->old_flows)) -@@ -321,15 +336,6 @@ begin: - } - qdisc_bstats_update(sch, skb); - flow->deficit -= qdisc_pkt_len(skb); -- /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -- * or HTB crashes. Defer it for next round. -- */ -- if (q->cstats.drop_count && sch->q.qlen) { -- qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, -- q->cstats.drop_len); -- q->cstats.drop_count = 0; -- q->cstats.drop_len = 0; -- } - return skb; - } - diff --git a/target/linux/generic/pending-4.4/630-packet_socket_type.patch b/target/linux/generic/pending-4.4/630-packet_socket_type.patch deleted file mode 100644 index 0314938ac..000000000 --- a/target/linux/generic/pending-4.4/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 */ - -@@ -56,6 +58,7 @@ struct sockaddr_ll { - #define PACKET_QDISC_BYPASS 20 - #define PACKET_ROLLOVER_STATS 21 - #define PACKET_FANOUT_DATA 22 -+#define PACKET_RECV_TYPE 23 - - #define PACKET_FANOUT_HASH 0 - #define PACKET_FANOUT_LB 1 ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -1777,6 +1777,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 -@@ -1784,6 +1785,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 -@@ -1796,7 +1798,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))) -@@ -1999,12 +2001,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; - -@@ -2124,12 +2126,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; - -@@ -3126,6 +3128,7 @@ static int packet_create(struct net *net - mutex_init(&po->pg_vec_lock); - po->rollover = NULL; - 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; -@@ -3755,6 +3758,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; - } -@@ -3807,6 +3820,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 -@@ -128,6 +128,7 @@ struct packet_sock { - struct net_device __rcu *cached_dev; - int (*xmit)(struct sk_buff *skb); - struct packet_type prot_hook ____cacheline_aligned_in_smp; -+ unsigned int pkt_type; - }; - - static struct packet_sock *pkt_sk(struct sock *sk) diff --git a/target/linux/generic/pending-4.4/640-bridge_no_eap_forward.patch b/target/linux/generic/pending-4.4/640-bridge_no_eap_forward.patch deleted file mode 100644 index a6dfb4ee5..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -169,7 +169,11 @@ int br_handle_frame_finish(struct net *n - if (IS_ENABLED(CONFIG_INET) && skb->protocol == htons(ETH_P_ARP)) - br_do_proxy_arp(skb, br, vid, p); - -- if (is_broadcast_ether_addr(dest)) { -+ if (skb->protocol == htons(ETH_P_PAE)) { -+ skb2 = skb; -+ /* Do not forward 802.1x/EAP frames */ -+ skb = NULL; -+ } else if (is_broadcast_ether_addr(dest)) { - skb2 = skb; - unicast = false; - } else if (is_multicast_ether_addr(dest)) { diff --git a/target/linux/generic/pending-4.4/641-bridge_always_accept_eap.patch b/target/linux/generic/pending-4.4/641-bridge_always_accept_eap.patch deleted file mode 100644 index a4e2c03cf..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -153,7 +153,7 @@ int br_handle_frame_finish(struct net *n - br_multicast_rcv(br, p, skb, vid)) - goto drop; - -- if (p->state == BR_STATE_LEARNING) -+ if ((p->state == BR_STATE_LEARNING) && skb->protocol != htons(ETH_P_PAE)) - goto drop; - - BR_INPUT_SKB_CB(skb)->brdev = br->dev; diff --git a/target/linux/generic/pending-4.4/642-bridge_port_isolate.patch b/target/linux/generic/pending-4.4/642-bridge_port_isolate.patch deleted file mode 100644 index 02dfea465..000000000 --- a/target/linux/generic/pending-4.4/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) - - #define BR_DEFAULT_AGEING_TIME (300 * HZ) - ---- 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 int 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 -@@ -192,8 +192,8 @@ int br_handle_frame_finish(struct net *n - - 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 -@@ -141,7 +141,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 (to && should_deliver(to, skb)) { -+ if (to && should_deliver(to, skb) && !(to->flags & BR_ISOLATE_MODE)) { - if (skb0) - deliver_clone(to, skb, __br_forward); - else -@@ -197,7 +197,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; -@@ -205,6 +205,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; -@@ -239,14 +241,14 @@ out: - /* called with rcu_read_lock */ - void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb, bool unicast) - { -- br_flood(br, skb, NULL, __br_deliver, unicast); -+ br_flood(br, skb, NULL, __br_deliver, unicast, false); - } - - /* called under bridge lock */ - void br_flood_forward(struct net_bridge *br, struct sk_buff *skb, - struct sk_buff *skb2, bool unicast) - { -- br_flood(br, skb, skb2, __br_forward, unicast); -+ br_flood(br, skb, skb2, __br_forward, unicast, true); - } - - #ifdef CONFIG_BRIDGE_IGMP_SNOOPING diff --git a/target/linux/generic/pending-4.4/645-bridge_multicast_to_unicast.patch b/target/linux/generic/pending-4.4/645-bridge_multicast_to_unicast.patch deleted file mode 100644 index f1c7ab1d9..000000000 --- a/target/linux/generic/pending-4.4/645-bridge_multicast_to_unicast.patch +++ /dev/null @@ -1,420 +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) - - #define BR_DEFAULT_AGEING_TIME (300 * HZ) - ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -42,12 +42,13 @@ static void br_multicast_add_router(stru - static void br_ip4_multicast_leave_group(struct net_bridge *br, - struct net_bridge_port *port, - __be32 group, -- __u16 vid); -+ __u16 vid, -+ const unsigned char *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); - #endif - unsigned int br_mdb_rehash_seq; - -@@ -652,7 +653,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; - -@@ -667,12 +669,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; -@@ -699,13 +722,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); -@@ -724,7 +747,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; - -@@ -735,14 +758,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; - -@@ -753,7 +776,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 - -@@ -1003,6 +1026,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; -@@ -1043,12 +1067,13 @@ static int br_ip4_multicast_igmp3_report - continue; - } - -+ src = eth_hdr(skb)->h_source; - if ((type == IGMPV3_CHANGE_TO_INCLUDE || - type == IGMPV3_MODE_IS_INCLUDE) && - ntohs(grec->grec_nsrcs) == 0) { -- br_ip4_multicast_leave_group(br, port, group, vid); -+ br_ip4_multicast_leave_group(br, port, group, vid, src); - } else { -- err = br_ip4_multicast_add_group(br, port, group, vid); -+ err = br_ip4_multicast_add_group(br, port, group, vid, src); - if (err) - break; - } -@@ -1063,6 +1088,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; -@@ -1114,10 +1140,10 @@ static int br_ip6_multicast_mld2_report( - grec->grec_type == MLD2_MODE_IS_INCLUDE) && - ntohs(*nsrcs) == 0) { - br_ip6_multicast_leave_group(br, port, &grec->grec_mca, -- vid); -+ vid, src); - } else { - err = br_ip6_multicast_add_group(br, port, -- &grec->grec_mca, vid); -+ &grec->grec_mca, vid, src); - if (err) - break; - } -@@ -1432,7 +1458,8 @@ br_multicast_leave_group(struct net_brid - struct net_bridge_port *port, - struct br_ip *group, - struct bridge_mcast_other_query *other_query, -- struct bridge_mcast_own_query *own_query) -+ struct bridge_mcast_own_query *own_query, -+ const unsigned char *src) - { - struct net_bridge_mdb_htable *mdb; - struct net_bridge_mdb_entry *mp; -@@ -1456,7 +1483,7 @@ br_multicast_leave_group(struct net_brid - for (pp = &mp->ports; - (p = mlock_dereference(*pp, br)) != NULL; - pp = &p->next) { -- if (p->port != port) -+ if (!br_port_group_equal(p, port, src)) - continue; - - rcu_assign_pointer(*pp, p->next); -@@ -1519,7 +1546,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) && -@@ -1537,8 +1564,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; -@@ -1553,14 +1580,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; -@@ -1575,7 +1602,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 - -@@ -1584,6 +1611,7 @@ static int br_multicast_ipv4_rcv(struct - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct sk_buff *skb_trimmed = NULL; - struct igmphdr *ih; - int err; -@@ -1600,12 +1628,13 @@ static int br_multicast_ipv4_rcv(struct - - BR_INPUT_SKB_CB(skb)->igmp = 1; - ih = igmp_hdr(skb); -+ 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, skb_trimmed, vid); -@@ -1614,7 +1643,7 @@ static int br_multicast_ipv4_rcv(struct - err = br_ip4_multicast_query(br, port, skb_trimmed, 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; - } - -@@ -1630,6 +1659,7 @@ static int br_multicast_ipv6_rcv(struct - struct sk_buff *skb, - u16 vid) - { -+ const unsigned char *src; - struct sk_buff *skb_trimmed = NULL; - struct mld_msg *mld; - int err; -@@ -1649,8 +1679,9 @@ static int br_multicast_ipv6_rcv(struct - - switch (mld->mld_type) { - case ICMPV6_MGM_REPORT: -+ src = eth_hdr(skb)->h_source; - 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: - err = br_ip6_multicast_mld2_report(br, port, skb_trimmed, vid); -@@ -1659,7 +1690,8 @@ static int br_multicast_ipv6_rcv(struct - err = br_ip6_multicast_query(br, port, skb_trimmed, vid); - break; - case ICMPV6_MGM_REDUCTION: -- br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid); -+ src = eth_hdr(skb)->h_source; -+ br_ip6_multicast_leave_group(br, port, &mld->mld_mca, vid, src); - break; - } - ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -157,7 +157,9 @@ struct net_bridge_port_group { - struct rcu_head rcu; - struct timer_list timer; - struct br_ip addr; -+ unsigned char eth_addr[ETH_ALEN]; - unsigned char state; -+ bool unicast; - }; - - struct net_bridge_mdb_entry -@@ -555,7 +557,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 -@@ -416,7 +416,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 -@@ -192,6 +192,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, -@@ -264,6 +292,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; -@@ -274,10 +303,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/pending-4.4/651-wireless_mesh_header.patch b/target/linux/generic/pending-4.4/651-wireless_mesh_header.patch deleted file mode 100644 index 17bcb6d24..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/653-disable_netlink_trim.patch b/target/linux/generic/pending-4.4/653-disable_netlink_trim.patch deleted file mode 100644 index b11104be9..000000000 --- a/target/linux/generic/pending-4.4/653-disable_netlink_trim.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -1231,24 +1231,7 @@ void netlink_detachskb(struct sock *sk, - - static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation) - { -- int delta; -- - WARN_ON(skb->sk != NULL); -- delta = skb->end - skb->tail; -- if (is_vmalloc_addr(skb->head) || delta * 2 < skb->truesize) -- return skb; -- -- if (skb_shared(skb)) { -- struct sk_buff *nskb = skb_clone(skb, allocation); -- if (!nskb) -- return skb; -- consume_skb(skb); -- skb = nskb; -- } -- -- if (!pskb_expand_head(skb, 0, -delta, allocation)) -- skb->truesize -= delta; -- - return skb; - } - diff --git a/target/linux/generic/pending-4.4/655-increase_skb_pad.patch b/target/linux/generic/pending-4.4/655-increase_skb_pad.patch deleted file mode 100644 index 1c8ebacf4..000000000 --- a/target/linux/generic/pending-4.4/655-increase_skb_pad.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2177,7 +2177,7 @@ static inline int pskb_network_may_pull( - * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) - */ - #ifndef NET_SKB_PAD --#define NET_SKB_PAD max(32, L1_CACHE_BYTES) -+#define NET_SKB_PAD max(64, L1_CACHE_BYTES) - #endif - - int ___pskb_trim(struct sk_buff *skb, unsigned int len); diff --git a/target/linux/generic/pending-4.4/660-fq_codel_defaults.patch b/target/linux/generic/pending-4.4/660-fq_codel_defaults.patch deleted file mode 100644 index fbe900891..000000000 --- a/target/linux/generic/pending-4.4/660-fq_codel_defaults.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -477,7 +477,7 @@ static int fq_codel_init(struct Qdisc *s - - sch->limit = 10*1024; - q->flows_cnt = 1024; -- q->memory_limit = 32 << 20; /* 32 MBytes */ -+ q->memory_limit = 4 << 20; /* 4 MBytes */ - q->drop_batch_size = 64; - q->quantum = psched_mtu(qdisc_dev(sch)); - q->perturbation = prandom_u32(); diff --git a/target/linux/generic/pending-4.4/661-fq_codel_keep_dropped_stats.patch b/target/linux/generic/pending-4.4/661-fq_codel_keep_dropped_stats.patch deleted file mode 100644 index 3cb950c0d..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -219,7 +219,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; - } - q->memory_usage += skb->truesize; - memory_limited = q->memory_usage > q->memory_limit; diff --git a/target/linux/generic/pending-4.4/662-use_fq_codel_by_default.patch b/target/linux/generic/pending-4.4/662-use_fq_codel_by_default.patch deleted file mode 100644 index 8d70b8235..000000000 --- a/target/linux/generic/pending-4.4/662-use_fq_codel_by_default.patch +++ /dev/null @@ -1,95 +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 -@@ -694,7 +694,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), -@@ -710,6 +710,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 -@@ -344,6 +344,7 @@ 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 noqueue_qdisc_ops; -+extern struct Qdisc_ops fq_codel_qdisc_ops; - extern const struct Qdisc_ops *default_qdisc_ops; - - struct Qdisc_class_common { ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -31,7 +31,7 @@ - #include - - /* Qdisc to use by default */ --const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops; -+const struct Qdisc_ops *default_qdisc_ops = &fq_codel_qdisc_ops; - EXPORT_SYMBOL(default_qdisc_ops); - - /* Main transmission queue. */ -@@ -731,7 +731,7 @@ static void attach_one_default_qdisc(str - void *_unused) - { - struct Qdisc *qdisc; -- const struct Qdisc_ops *ops = default_qdisc_ops; -+ const struct Qdisc_ops *ops = &fq_codel_qdisc_ops; - - if (dev->priv_flags & IFF_NO_QUEUE) - ops = &noqueue_qdisc_ops; ---- 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) ---- a/net/sched/sch_mqprio.c -+++ b/net/sched/sch_mqprio.c -@@ -122,7 +122,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) ---- a/net/sched/sch_api.c -+++ b/net/sched/sch_api.c -@@ -1951,7 +1951,7 @@ static int __init pktsched_init(void) - return err; - } - -- register_qdisc(&pfifo_fast_ops); -+ register_qdisc(&fq_codel_qdisc_ops); - register_qdisc(&pfifo_qdisc_ops); - register_qdisc(&bfifo_qdisc_ops); - register_qdisc(&pfifo_head_drop_qdisc_ops); diff --git a/target/linux/generic/pending-4.4/663-remove_pfifo_fast.patch b/target/linux/generic/pending-4.4/663-remove_pfifo_fast.patch deleted file mode 100644 index 6f72b1935..000000000 --- a/target/linux/generic/pending-4.4/663-remove_pfifo_fast.patch +++ /dev/null @@ -1,142 +0,0 @@ ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -438,139 +438,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea - .owner = THIS_MODULE, - }; - --static const u8 prio2band[TC_PRIO_MAX + 1] = { -- 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1 --}; -- --/* 3-band FIFO queue: old style, but should be a bit faster than -- generic prio+fifo combination. -- */ -- --#define PFIFO_FAST_BANDS 3 -- --/* -- * Private data for a pfifo_fast scheduler containing: -- * - queues for the three band -- * - bitmap indicating which of the bands contain skbs -- */ --struct pfifo_fast_priv { -- u32 bitmap; -- struct sk_buff_head q[PFIFO_FAST_BANDS]; --}; -- --/* -- * Convert a bitmap to the first band number where an skb is queued, where: -- * bitmap=0 means there are no skbs on any band. -- * bitmap=1 means there is an skb on band 0. -- * bitmap=7 means there are skbs on all 3 bands, etc. -- */ --static const int bitmap2band[] = {-1, 0, 1, 0, 2, 0, 1, 0}; -- --static inline struct sk_buff_head *band2list(struct pfifo_fast_priv *priv, -- int band) --{ -- return priv->q + band; --} -- --static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc) --{ -- if (skb_queue_len(&qdisc->q) < qdisc_dev(qdisc)->tx_queue_len) { -- int band = prio2band[skb->priority & TC_PRIO_MAX]; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- struct sk_buff_head *list = band2list(priv, band); -- -- priv->bitmap |= (1 << band); -- qdisc->q.qlen++; -- return __qdisc_enqueue_tail(skb, qdisc, list); -- } -- -- return qdisc_drop(skb, qdisc); --} -- --static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- int band = bitmap2band[priv->bitmap]; -- -- if (likely(band >= 0)) { -- struct sk_buff_head *list = band2list(priv, band); -- struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list); -- -- qdisc->q.qlen--; -- if (skb_queue_empty(list)) -- priv->bitmap &= ~(1 << band); -- -- return skb; -- } -- -- return NULL; --} -- --static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc) --{ -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- int band = bitmap2band[priv->bitmap]; -- -- if (band >= 0) { -- struct sk_buff_head *list = band2list(priv, band); -- -- return skb_peek(list); -- } -- -- return NULL; --} -- --static void pfifo_fast_reset(struct Qdisc *qdisc) --{ -- int prio; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) -- __qdisc_reset_queue(qdisc, band2list(priv, prio)); -- -- priv->bitmap = 0; -- qdisc->qstats.backlog = 0; -- qdisc->q.qlen = 0; --} -- --static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) --{ -- struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; -- -- memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); -- if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) -- goto nla_put_failure; -- return skb->len; -- --nla_put_failure: -- return -1; --} -- --static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt) --{ -- int prio; -- struct pfifo_fast_priv *priv = qdisc_priv(qdisc); -- -- for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) -- __skb_queue_head_init(band2list(priv, prio)); -- -- /* Can by-pass the queue discipline */ -- qdisc->flags |= TCQ_F_CAN_BYPASS; -- return 0; --} -- --struct Qdisc_ops pfifo_fast_ops __read_mostly = { -- .id = "pfifo_fast", -- .priv_size = sizeof(struct pfifo_fast_priv), -- .enqueue = pfifo_fast_enqueue, -- .dequeue = pfifo_fast_dequeue, -- .peek = pfifo_fast_peek, -- .init = pfifo_fast_init, -- .reset = pfifo_fast_reset, -- .dump = pfifo_fast_dump, -- .owner = THIS_MODULE, --}; -- - static struct lock_class_key qdisc_tx_busylock; - - struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, diff --git a/target/linux/generic/pending-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch deleted file mode 100644 index fe599798c..000000000 --- a/target/linux/generic/pending-4.4/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ /dev/null @@ -1,496 +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 -@@ -17,6 +17,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 */ -@@ -27,6 +39,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); -@@ -139,20 +139,29 @@ static struct net_device_stats *ip6_get_ - 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) && - ipv6_addr_any(&t->parms.raddr) && -@@ -160,7 +169,7 @@ ip6_tnl_lookup(struct net *net, const st - 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) && - ipv6_addr_any(&t->parms.laddr) && -@@ -196,7 +205,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]; - } -@@ -369,6 +378,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 -@@ -765,6 +780,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 -@@ -810,6 +927,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); - -@@ -1145,6 +1282,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) || -@@ -1175,6 +1313,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) -@@ -1289,6 +1439,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; -+ - dst_cache_reset(&t->dst_cache); - ip6_tnl_link_config(t); - return 0; -@@ -1327,6 +1485,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)); - } - -@@ -1622,6 +1781,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) - { -@@ -1653,6 +1821,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, -@@ -1705,6 +1913,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) + -@@ -1722,6 +1936,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; - } - -@@ -1729,6 +1961,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) || -@@ -1737,8 +1972,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: -@@ -1762,6 +2016,7 @@ static const struct nla_policy ip6_tnl_p - [IFLA_IPTUN_FLOWINFO] = { .type = NLA_U32 }, - [IFLA_IPTUN_FLAGS] = { .type = NLA_U32 }, - [IFLA_IPTUN_PROTO] = { .type = NLA_U8 }, -+ [IFLA_IPTUN_FMRS] = { .type = NLA_NESTED }, - }; - - static struct rtnl_link_ops ip6_link_ops __read_mostly = { diff --git a/target/linux/generic/pending-4.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-4.4/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch deleted file mode 100644 index c921a079a..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -63,6 +63,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 -@@ -2370,6 +2370,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 -@@ -90,6 +90,8 @@ static int ip6_pkt_discard(struct sk_bu - static int ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb); - static int ip6_pkt_prohibit(struct sk_buff *skb); - static int ip6_pkt_prohibit_out(struct net *net, 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 net *net, 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); -@@ -297,6 +299,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), -@@ -1899,6 +1916,11 @@ static struct rt6_info *ip6_route_info_c - 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: - case RTN_UNREACHABLE: - default: -@@ -2502,6 +2524,17 @@ static int ip6_pkt_prohibit_out(struct n - 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 net *net, 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. - */ -@@ -2744,7 +2777,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) -@@ -3097,6 +3131,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; -@@ -3376,6 +3413,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 -@@ -3602,6 +3641,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; -@@ -3620,6 +3670,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: -@@ -3637,6 +3689,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); - } -@@ -3710,6 +3763,9 @@ void __init ip6_route_init_special_entri - init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); - init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; - init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); -+ init_net.ipv6.ip6_policy_failed_entry->dst.dev = init_net.loopback_dev; -+ init_net.ipv6.ip6_policy_failed_entry->rt6i_idev = -+ in6_dev_get(init_net.loopback_dev); - #endif - } - diff --git a/target/linux/generic/pending-4.4/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch b/target/linux/generic/pending-4.4/671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch deleted file mode 100644 index dafb56cd8..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-4.4/680-NET-skip-GRO-for-foreign-MAC-addresses.patch deleted file mode 100644 index bfe76dbc1..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -4278,6 +4278,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; - -@@ -5444,6 +5447,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) -@@ -5515,6 +5560,7 @@ static int __netdev_upper_dev_link(struc - goto rollback_lower_mesh; - } - -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, - &changeupper_info.info); - return 0; -@@ -5641,6 +5687,7 @@ void netdev_upper_dev_unlink(struct net_ - list_for_each_entry(i, &upper_dev->all_adj_list.upper, list) - __netdev_adjacent_dev_unlink(dev, i->dev, i->ref_nr); - -+ netdev_update_addr_mask(dev); - call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, - &changeupper_info.info); - } -@@ -6181,6 +6228,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 -@@ -1639,6 +1639,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 -@@ -642,7 +642,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 -@@ -140,6 +140,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 -@@ -168,8 +180,12 @@ __be16 eth_type_trans(struct sk_buff *sk - skb->pkt_type = PACKET_MULTICAST; - } - else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, -- dev->dev_addr))) -+ dev->dev_addr))) { - skb->pkt_type = PACKET_OTHERHOST; -+ if (eth_check_local_mask(eth->h_dest, dev->dev_addr, -+ dev->local_addr_mask)) -+ skb->gro_skip = 1; -+ } - - /* - * Some variants of DSA tagging don't have an ethertype field diff --git a/target/linux/generic/pending-4.4/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/pending-4.4/681-NET-add-of_get_mac_address_mtd.patch deleted file mode 100644 index 204487297..000000000 --- a/target/linux/generic/pending-4.4/681-NET-add-of_get_mac_address_mtd.patch +++ /dev/null @@ -1,128 +0,0 @@ -From: John Crispin -Date: Sun, 27 Jul 2014 09:40:01 +0100 -Subject: NET: add mtd-mac-address support to of_get_mac_address() - -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 -Signed-off-by: Felix Fietkau ---- - 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 -@@ -38,7 +39,7 @@ int of_get_phy_mode(struct device_node * - } - EXPORT_SYMBOL_GPL(of_get_phy_mode); - --static const void *of_get_mac_addr(struct device_node *np, const char *name) -+static void *of_get_mac_addr(struct device_node *np, const char *name) - { - struct property *pp = of_find_property(np, name, NULL); - -@@ -47,6 +48,73 @@ static const void *of_get_mac_addr(struc - return NULL; - } - -+static const void *of_get_mac_address_mtd(struct device_node *np) -+{ -+#ifdef CONFIG_MTD -+ struct device_node *mtd_np = NULL; -+ struct property *prop; -+ size_t retlen; -+ int size, ret; -+ struct mtd_info *mtd; -+ const char *part; -+ const __be32 *list; -+ phandle phandle; -+ u32 mac_inc = 0; -+ u8 mac[ETH_ALEN]; -+ void *addr; -+ -+ list = of_get_property(np, "mtd-mac-address", &size); -+ if (!list || (size != (2 * sizeof(*list)))) -+ return NULL; -+ -+ phandle = be32_to_cpup(list++); -+ if (phandle) -+ mtd_np = of_find_node_by_phandle(phandle); -+ -+ if (!mtd_np) -+ return NULL; -+ -+ 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 NULL; -+ -+ 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; -+ -+ if (!is_valid_ether_addr(mac)) -+ return NULL; -+ -+ addr = of_get_mac_addr(np, "mac-address"); -+ if (addr) { -+ memcpy(addr, mac, ETH_ALEN); -+ return addr; -+ } -+ -+ prop = kzalloc(sizeof(*prop), GFP_KERNEL); -+ if (!prop) -+ return NULL; -+ -+ prop->name = "mac-address"; -+ prop->length = ETH_ALEN; -+ prop->value = kmemdup(mac, ETH_ALEN, GFP_KERNEL); -+ if (!prop->value || of_add_property(np, prop)) -+ goto free; -+ -+ return prop->value; -+free: -+ kfree(prop->value); -+ kfree(prop); -+#endif -+ return NULL; -+} -+ - /** - * Search the device tree for the best MAC address to use. 'mac-address' is - * checked first, because that is supposed to contain to "most recent" MAC -@@ -64,11 +132,18 @@ static const void *of_get_mac_addr(struc - * addresses. Some older U-Boots only initialized 'local-mac-address'. In - * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists - * but is all zeros. -+ * -+ * If a mtd-mac-address property exists, try to fetch the MAC address from the -+ * specified mtd device, and store it as a 'mac-address' property - */ - const void *of_get_mac_address(struct device_node *np) - { - const void *addr; - -+ addr = of_get_mac_address_mtd(np); -+ if (addr) -+ return addr; -+ - addr = of_get_mac_addr(np, "mac-address"); - if (addr) - return addr; diff --git a/target/linux/generic/pending-4.4/700-swconfig.patch b/target/linux/generic/pending-4.4/700-swconfig.patch deleted file mode 100644 index 122dd446c..000000000 --- a/target/linux/generic/pending-4.4/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 AQUANTIA_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_AQUANTIA_PHY) += aquantia.o - obj-$(CONFIG_MARVELL_PHY) += marvell.o - obj-$(CONFIG_DAVICOM_PHY) += davicom.o ---- a/include/uapi/linux/Kbuild -+++ b/include/uapi/linux/Kbuild -@@ -388,6 +388,7 @@ header-y += stddef.h - header-y += string.h - header-y += suspend_ioctls.h - header-y += swab.h -+header-y += switch.h - header-y += synclink.h - header-y += sysctl.h - header-y += sysinfo.h diff --git a/target/linux/generic/pending-4.4/701-phy_extension.patch b/target/linux/generic/pending-4.4/701-phy_extension.patch deleted file mode 100644 index 39b8fd466..000000000 --- a/target/linux/generic/pending-4.4/701-phy_extension.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -385,6 +385,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 -@@ -807,6 +807,7 @@ void phy_start_machine(struct phy_device - void phy_stop_machine(struct phy_device *phydev); - int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); - int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); -+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr); - int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd); - int phy_start_interrupts(struct phy_device *phydev); - void phy_print_status(struct phy_device *phydev); diff --git a/target/linux/generic/pending-4.4/702-phy_add_aneg_done_function.patch b/target/linux/generic/pending-4.4/702-phy_add_aneg_done_function.patch deleted file mode 100644 index f20f48f40..000000000 --- a/target/linux/generic/pending-4.4/702-phy_add_aneg_done_function.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -497,6 +497,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 -@@ -995,6 +995,9 @@ int genphy_update_link(struct phy_device - { - int status; - -+ if (phydev->drv && phydev->drv->update_link) -+ return phydev->drv->update_link(phydev); -+ - /* Do a fake read */ - status = phy_read(phydev, MII_BMSR); - if (status < 0) diff --git a/target/linux/generic/pending-4.4/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-4.4/703-phy-add-detach-callback-to-struct-phy_driver.patch deleted file mode 100644 index 4ef3b781f..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -734,6 +734,9 @@ void phy_detach(struct phy_device *phyde - struct mii_bus *bus; - int i; - -+ if (phydev->drv && phydev->drv->detach) -+ phydev->drv->detach(phydev); -+ - phydev->attached_dev->phydev = NULL; - phydev->attached_dev = NULL; - phy_suspend(phydev); ---- a/include/linux/phy.h -+++ b/include/linux/phy.h -@@ -515,6 +515,12 @@ struct phy_driver { - */ - int (*did_interrupt)(struct phy_device *phydev); - -+ /* -+ * Called before an ethernet device is detached -+ * from the PHY. -+ */ -+ void (*detach)(struct phy_device *phydev); -+ - /* Clears up any memory if needed */ - void (*remove)(struct phy_device *phydev); - diff --git a/target/linux/generic/pending-4.4/710-phy-add-mdio_register_board_info.patch b/target/linux/generic/pending-4.4/710-phy-add-mdio_register_board_info.patch deleted file mode 100644 index d78f3d48a..000000000 --- a/target/linux/generic/pending-4.4/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. -@@ -346,9 +348,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); -@@ -361,6 +375,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 -@@ -846,6 +846,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_AQUANTIA_PHY) += aquantia.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/pending-4.4/720-phy_adm6996.patch b/target/linux/generic/pending-4.4/720-phy_adm6996.patch deleted file mode 100644 index bf939e893..000000000 --- a/target/linux/generic/pending-4.4/720-phy_adm6996.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -175,6 +175,13 @@ config LANTIQ_PHY - ---help--- - Supports the 11G and 22F 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 -@@ -22,6 +22,7 @@ obj-$(CONFIG_BCM7XXX_PHY) += bcm7xxx.o - obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_BCM_CYGNUS_PHY) += bcm-cygnus.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/pending-4.4/721-phy_packets.patch b/target/linux/generic/pending-4.4/721-phy_packets.patch deleted file mode 100644 index 39dc5ccbf..000000000 --- a/target/linux/generic/pending-4.4/721-phy_packets.patch +++ /dev/null @@ -1,161 +0,0 @@ ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1297,6 +1297,7 @@ enum netdev_priv_flags { - IFF_NO_QUEUE = 1<<21, - IFF_OPENVSWITCH = 1<<22, - IFF_L3MDEV_SLAVE = 1<<23, -+ IFF_NO_IP_ALIGN = 1<<24, - }; - - #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN -@@ -1323,6 +1324,7 @@ enum netdev_priv_flags { - #define IFF_NO_QUEUE IFF_NO_QUEUE - #define IFF_OPENVSWITCH IFF_OPENVSWITCH - #define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE -+#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN - - /** - * struct net_device - The DEVICE structure. -@@ -1603,6 +1605,11 @@ struct net_device { - const struct l3mdev_ops *l3mdev_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; -@@ -1670,6 +1677,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 -@@ -2208,6 +2208,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 -@@ -2312,16 +2316,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 -@@ -2754,10 +2754,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 -@@ -520,6 +521,22 @@ skb_fail: - } - 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 -@@ -168,6 +168,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); - - eth = (struct ethhdr *)skb->data; diff --git a/target/linux/generic/pending-4.4/722-phy_mvswitch.patch b/target/linux/generic/pending-4.4/722-phy_mvswitch.patch deleted file mode 100644 index 37ec7d9e5..000000000 --- a/target/linux/generic/pending-4.4/722-phy_mvswitch.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -182,6 +182,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 -@@ -23,6 +23,7 @@ obj-$(CONFIG_BCM87XX_PHY) += bcm87xx.o - obj-$(CONFIG_BCM_CYGNUS_PHY) += bcm-cygnus.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/pending-4.4/723-phy_ip175c.patch b/target/linux/generic/pending-4.4/723-phy_ip175c.patch deleted file mode 100644 index 5eb10bb30..000000000 --- a/target/linux/generic/pending-4.4/723-phy_ip175c.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -186,6 +186,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 -@@ -24,6 +24,7 @@ obj-$(CONFIG_BCM_CYGNUS_PHY) += bcm-cygn - 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/pending-4.4/724-phy_ar8216.patch b/target/linux/generic/pending-4.4/724-phy_ar8216.patch deleted file mode 100644 index 8cd003433..000000000 --- a/target/linux/generic/pending-4.4/724-phy_ar8216.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -190,6 +190,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 -@@ -26,6 +26,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/pending-4.4/725-phy_rtl8306.patch b/target/linux/generic/pending-4.4/725-phy_rtl8306.patch deleted file mode 100644 index 2bf276076..000000000 --- a/target/linux/generic/pending-4.4/725-phy_rtl8306.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -195,6 +195,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 -@@ -27,6 +27,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/pending-4.4/726-phy_rtl8366.patch b/target/linux/generic/pending-4.4/726-phy_rtl8366.patch deleted file mode 100644 index 53e967b82..000000000 --- a/target/linux/generic/pending-4.4/726-phy_rtl8366.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -299,6 +299,30 @@ config MDIO_BCM_IPROC - This module provides a driver for the MDIO busses found in the - Broadcom iProc SoC's. - -+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 -@@ -28,6 +28,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/pending-4.4/727-phy-rtl8367.patch b/target/linux/generic/pending-4.4/727-phy-rtl8367.patch deleted file mode 100644 index 9fa8c8fc2..000000000 --- a/target/linux/generic/pending-4.4/727-phy-rtl8367.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -321,6 +321,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 -@@ -31,6 +31,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/pending-4.4/728-phy-rtl8367b.patch b/target/linux/generic/pending-4.4/728-phy-rtl8367b.patch deleted file mode 100644 index 12d7fcad9..000000000 --- a/target/linux/generic/pending-4.4/728-phy-rtl8367b.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -325,6 +325,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 -@@ -32,6 +32,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/pending-4.4/729-phy-tantos.patch b/target/linux/generic/pending-4.4/729-phy-tantos.patch deleted file mode 100644 index 3f18c83c4..000000000 --- a/target/linux/generic/pending-4.4/729-phy-tantos.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -336,3 +336,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 -@@ -34,6 +34,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/pending-4.4/730-phy_b53.patch b/target/linux/generic/pending-4.4/730-phy_b53.patch deleted file mode 100644 index 4d5ea7a75..000000000 --- a/target/linux/generic/pending-4.4/730-phy_b53.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -331,6 +331,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 -@@ -35,6 +35,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/pending-4.4/732-phy-ar8216-led-support.patch b/target/linux/generic/pending-4.4/732-phy-ar8216-led-support.patch deleted file mode 100644 index 799ea494a..000000000 --- a/target/linux/generic/pending-4.4/732-phy-ar8216-led-support.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -195,6 +195,10 @@ config AR8216_PHY - select ETHERNET_PACKET_MANGLE - select SWCONFIG - -+config AR8216_PHY_LEDS -+ bool "Atheros AR8216 switch LED support" -+ depends on (AR8216_PHY && LEDS_CLASS) -+ - config RTL8306_PHY - tristate "Driver for Realtek RTL8306S switches" - select SWCONFIG diff --git a/target/linux/generic/pending-4.4/733-phy_mvsw61xx.patch b/target/linux/generic/pending-4.4/733-phy_mvsw61xx.patch deleted file mode 100644 index 4daa9e8c8..000000000 --- a/target/linux/generic/pending-4.4/733-phy_mvsw61xx.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -186,6 +186,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 -@@ -24,6 +24,7 @@ obj-$(CONFIG_BCM_CYGNUS_PHY) += bcm-cygn - obj-$(CONFIG_ICPLUS_PHY) += icplus.o - obj-$(CONFIG_ADM6996_PHY) += adm6996.o - obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o -+obj-$(CONFIG_MVSW61XX_PHY) += mvsw61xx.o - obj-$(CONFIG_IP17XX_PHY) += ip17xx.o - obj-$(CONFIG_REALTEK_PHY) += realtek.o - obj-$(CONFIG_AR8216_PHY) += ar8216.o ar8327.o diff --git a/target/linux/generic/pending-4.4/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-4.4/734-net-phy-at803x-allow-to-configure-via-pdata.patch deleted file mode 100644 index 53abcc33e..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-4.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch deleted file mode 100644 index 60de6b4f7..000000000 --- a/target/linux/generic/pending-4.4/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, -@@ -415,7 +440,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, -@@ -435,8 +460,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, -@@ -458,9 +483,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/pending-4.4/736-at803x-fix-reset-handling.patch b/target/linux/generic/pending-4.4/736-at803x-fix-reset-handling.patch deleted file mode 100644 index 91c2334e5..000000000 --- a/target/linux/generic/pending-4.4/736-at803x-fix-reset-handling.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Sergei Shtylyov -Date: Wed, 23 Mar 2016 00:44:40 +0300 -Subject: [PATCH] at803x: fix reset handling -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The driver of course "knows" that the chip's reset signal is active low, -so it drives the GPIO to 0 to reset the PHY and to 1 otherwise; however -all this will only work iff the GPIO is specified as active-high in the -device tree! I think both the driver and the device trees (if there are -any -- I was unable to find them) need to be fixed in this case... - -Fixes: 13a56b449325 ("net: phy: at803x: Add support for hardware reset") -Signed-off-by: Sergei Shtylyov -Acked-by: Uwe Kleine-König -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -250,7 +250,7 @@ static int at803x_probe(struct phy_devic - if (!priv) - return -ENOMEM; - -- gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); -+ gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(gpiod_reset)) - return PTR_ERR(gpiod_reset); - -@@ -377,10 +377,10 @@ static void at803x_link_change_notify(st - - at803x_context_save(phydev, &context); - -- gpiod_set_value(priv->gpiod_reset, 0); -- msleep(1); - gpiod_set_value(priv->gpiod_reset, 1); - msleep(1); -+ gpiod_set_value(priv->gpiod_reset, 0); -+ msleep(1); - - at803x_context_restore(phydev, &context); - diff --git a/target/linux/generic/pending-4.4/737-net-phy-at803x-Request-reset-GPIO-only-for-AT8030-PH.patch b/target/linux/generic/pending-4.4/737-net-phy-at803x-Request-reset-GPIO-only-for-AT8030-PH.patch deleted file mode 100644 index b30ba7aaa..000000000 --- a/target/linux/generic/pending-4.4/737-net-phy-at803x-Request-reset-GPIO-only-for-AT8030-PH.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Sebastian Frias -Date: Wed, 23 Mar 2016 11:49:09 +0100 -Subject: [PATCH] net: phy: at803x: Request 'reset' GPIO only for AT8030 PHY - -This removes the dependency on GPIOLIB for non faulty PHYs. - -Indeed, without this patch, if GPIOLIB is not selected -devm_gpiod_get_optional() will return -ENOSYS and the driver probe -call will fail, regardless of the actual PHY hardware. - -Out of the 3 PHYs supported by this driver (AT8030, AT8031, AT8035), -only AT8030 presents the issues that commit 13a56b449325 ("net: phy: -at803x: Add support for hardware reset") attempts to work-around by -using a 'reset' GPIO line. - -Hence, only AT8030 should depend on GPIOLIB operating properly. - -Fixes: 13a56b449325 ("net: phy: at803x: Add support for hardware reset") - -Signed-off-by: Sebastian Frias -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -250,12 +250,16 @@ static int at803x_probe(struct phy_devic - if (!priv) - return -ENOMEM; - -+ if (phydev->drv->phy_id != ATH8030_PHY_ID) -+ goto does_not_require_reset_workaround; -+ - gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(gpiod_reset)) - return PTR_ERR(gpiod_reset); - - priv->gpiod_reset = gpiod_reset; - -+does_not_require_reset_workaround: - phydev->priv = priv; - - return 0; diff --git a/target/linux/generic/pending-4.4/738-net-phy-at803x-only-the-AT8030-needs-a-hardware-rese.patch b/target/linux/generic/pending-4.4/738-net-phy-at803x-only-the-AT8030-needs-a-hardware-rese.patch deleted file mode 100644 index 4e6baac0c..000000000 --- a/target/linux/generic/pending-4.4/738-net-phy-at803x-only-the-AT8030-needs-a-hardware-rese.patch +++ /dev/null @@ -1,81 +0,0 @@ -From: Timur Tabi -Date: Tue, 26 Apr 2016 12:44:18 -0500 -Subject: [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on - link change - -Commit 13a56b44 ("at803x: Add support for hardware reset") added a -work-around for a hardware bug on the AT8030. However, the work-around -was being called for all 803x PHYs, even those that don't need it. -Function at803x_link_change_notify() checks to make sure that it only -resets the PHY on the 8030, but it makes more sense to not call that -function at all if it isn't needed. - -Signed-off-by: Timur Tabi -Reviewed-by: Florian Fainelli -Signed-off-by: David S. Miller ---- - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -374,27 +374,25 @@ static void at803x_link_change_notify(st - * in the FIFO. In such cases, the FIFO enters an error mode it - * cannot recover from by software. - */ -- if (phydev->drv->phy_id == ATH8030_PHY_ID) { -- if (phydev->state == PHY_NOLINK) { -- if (priv->gpiod_reset && !priv->phy_reset) { -- struct at803x_context context; -- -- at803x_context_save(phydev, &context); -- -- gpiod_set_value(priv->gpiod_reset, 1); -- msleep(1); -- gpiod_set_value(priv->gpiod_reset, 0); -- msleep(1); -- -- at803x_context_restore(phydev, &context); -- -- dev_dbg(&phydev->dev, "%s(): phy was reset\n", -- __func__); -- priv->phy_reset = true; -- } -- } else { -- priv->phy_reset = false; -+ if (phydev->state == PHY_NOLINK) { -+ if (priv->gpiod_reset && !priv->phy_reset) { -+ struct at803x_context context; -+ -+ at803x_context_save(phydev, &context); -+ -+ gpiod_set_value(priv->gpiod_reset, 1); -+ msleep(1); -+ gpiod_set_value(priv->gpiod_reset, 0); -+ msleep(1); -+ -+ at803x_context_restore(phydev, &context); -+ -+ dev_dbg(&phydev->dev, "%s(): phy was reset\n", -+ __func__); -+ priv->phy_reset = true; - } -+ } else { -+ priv->phy_reset = false; - } - if (pdata && pdata->fixup_rgmii_tx_delay && - phydev->speed != priv->prev_speed) { -@@ -426,7 +424,6 @@ static struct phy_driver at803x_driver[] - .phy_id_mask = AT803X_PHY_ID_MASK, - .probe = at803x_probe, - .config_init = at803x_config_init, -- .link_change_notify = at803x_link_change_notify, - .set_wol = at803x_set_wol, - .get_wol = at803x_get_wol, - .suspend = at803x_suspend, -@@ -468,7 +465,6 @@ static struct phy_driver at803x_driver[] - .phy_id_mask = AT803X_PHY_ID_MASK, - .probe = at803x_probe, - .config_init = at803x_config_init, -- .link_change_notify = at803x_link_change_notify, - .set_wol = at803x_set_wol, - .get_wol = at803x_get_wol, - .suspend = at803x_suspend, diff --git a/target/linux/generic/pending-4.4/739-net-phy-at803x-add-support-for-AT8032.patch b/target/linux/generic/pending-4.4/739-net-phy-at803x-add-support-for-AT8032.patch deleted file mode 100644 index 4455ec49e..000000000 --- a/target/linux/generic/pending-4.4/739-net-phy-at803x-add-support-for-AT8032.patch +++ /dev/null @@ -1,65 +0,0 @@ -From: Felix Fietkau -Date: Wed, 30 Nov 2016 11:31:03 +0100 -Subject: [PATCH] net: phy: at803x: add support for AT8032 - -Like AT8030, this PHY needs the GPIO reset workaround - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/phy/at803x.c -+++ b/drivers/net/phy/at803x.c -@@ -55,6 +55,7 @@ - #define AT803X_PHY_ID_MASK 0xffffffef - #define ATH8030_PHY_ID 0x004dd076 - #define ATH8031_PHY_ID 0x004dd074 -+#define ATH8032_PHY_ID 0x004dd023 - #define ATH8035_PHY_ID 0x004dd072 - - MODULE_DESCRIPTION("Atheros 803x PHY driver"); -@@ -250,7 +251,8 @@ static int at803x_probe(struct phy_devic - if (!priv) - return -ENOMEM; - -- if (phydev->drv->phy_id != ATH8030_PHY_ID) -+ if (phydev->drv->phy_id != ATH8030_PHY_ID && -+ phydev->drv->phy_id != ATH8032_PHY_ID) - goto does_not_require_reset_workaround; - - gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); -@@ -478,6 +480,27 @@ static struct phy_driver at803x_driver[] - .driver = { - .owner = THIS_MODULE, - }, -+}, { -+ /* ATHEROS 8032 */ -+ .phy_id = ATH8032_PHY_ID, -+ .name = "Atheros 8032 ethernet", -+ .phy_id_mask = AT803X_PHY_ID_MASK, -+ .probe = at803x_probe, -+ .config_init = at803x_config_init, -+ .link_change_notify = at803x_link_change_notify, -+ .set_wol = at803x_set_wol, -+ .get_wol = at803x_get_wol, -+ .suspend = at803x_suspend, -+ .resume = at803x_resume, -+ .features = PHY_GBIT_FEATURES, -+ .flags = PHY_HAS_INTERRUPT, -+ .config_aneg = genphy_config_aneg, -+ .read_status = genphy_read_status, -+ .ack_interrupt = &at803x_ack_interrupt, -+ .config_intr = &at803x_config_intr, -+ .driver = { -+ .owner = THIS_MODULE, -+ }, - } }; - - module_phy_driver(at803x_driver); -@@ -485,6 +508,7 @@ module_phy_driver(at803x_driver); - static struct mdio_device_id __maybe_unused atheros_tbl[] = { - { ATH8030_PHY_ID, AT803X_PHY_ID_MASK }, - { ATH8031_PHY_ID, AT803X_PHY_ID_MASK }, -+ { ATH8032_PHY_ID, AT803X_PHY_ID_MASK }, - { ATH8035_PHY_ID, AT803X_PHY_ID_MASK }, - { } - }; diff --git a/target/linux/generic/pending-4.4/773-bgmac-add-srab-switch.patch b/target/linux/generic/pending-4.4/773-bgmac-add-srab-switch.patch deleted file mode 100644 index b3cb08723..000000000 --- a/target/linux/generic/pending-4.4/773-bgmac-add-srab-switch.patch +++ /dev/null @@ -1,88 +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 -@@ -11,6 +11,7 @@ - - #include - #include -+#include - #include - #include "bgmac.h" - -@@ -1403,6 +1404,17 @@ static const struct ethtool_ops bgmac_et - .get_drvinfo = bgmac_get_drvinfo, - }; - -+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, -+ }, -+}; -+ - /************************************************** - * MII - **************************************************/ -@@ -1549,6 +1561,14 @@ int bgmac_enet_probe(struct bgmac *bgmac - net_dev->hw_features = net_dev->features; - net_dev->vlan_features = net_dev->features; - -+ if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !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) { - dev_err(bgmac->dev, "Cannot register net device\n"); -@@ -1571,6 +1591,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe); - - void bgmac_enet_remove(struct bgmac *bgmac) - { -+ if (bgmac->b53_device) -+ platform_device_unregister(&bgmac_b53_dev); -+ bgmac->b53_device = NULL; -+ - unregister_netdev(bgmac->net_dev); - phy_disconnect(bgmac->net_dev->phydev); - netif_napi_del(&bgmac->napi); ---- a/drivers/net/ethernet/broadcom/bgmac.h -+++ b/drivers/net/ethernet/broadcom/bgmac.h -@@ -409,6 +409,7 @@ - #define BGMAC_FEAT_CC4_IF_SW_TYPE BIT(17) - #define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18) - #define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19) -+#define BGMAC_FEAT_SRAB BIT(20) - - struct bgmac_slot_info { - union { -@@ -513,6 +514,9 @@ struct bgmac { - u32 (*get_bus_clock)(struct bgmac *bgmac); - void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask, - u32 set); -+ -+ /* platform device for associated switch */ -+ struct platform_device *b53_device; - }; - - struct bgmac *bgmac_alloc(struct device *dev); ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -236,6 +236,7 @@ static int bgmac_probe(struct bcma_devic - bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; - bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; - bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; -+ bgmac->feature_flags |= BGMAC_FEAT_SRAB; - break; - case BCMA_CHIP_ID_BCM53573: - bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; diff --git a/target/linux/generic/pending-4.4/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-4.4/810-pci_disable_common_quirks.patch deleted file mode 100644 index e5c904306..000000000 --- a/target/linux/generic/pending-4.4/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. -@@ -2975,6 +2976,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 -@@ -3031,6 +3033,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). -@@ -3065,6 +3069,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); - -+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */ -+ - /* - * PCI devices which are on Intel chips can skip the 10ms delay - * before entering D3 mode. diff --git a/target/linux/generic/pending-4.4/811-pci_disable_usb_common_quirks.patch b/target/linux/generic/pending-4.4/811-pci_disable_usb_common_quirks.patch deleted file mode 100644 index 702c9fa2b..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -98,6 +98,8 @@ struct amd_chipset_type { - u8 rev; - }; - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static struct amd_chipset_info { - struct pci_dev *nb_dev; - struct pci_dev *smbus_dev; -@@ -458,6 +460,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. -@@ -537,8 +543,17 @@ reset_needed: - uhci_reset_hc(pdev, base); - return 1; - } -+#else -+int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base) -+{ -+ return 0; -+} -+ -+#endif - EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS -+ - static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask) - { - u16 cmd; -@@ -1103,3 +1118,4 @@ static void quirk_usb_early_handoff(stru - } - DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); -+#endif ---- a/drivers/usb/host/pci-quirks.h -+++ b/drivers/usb/host/pci-quirks.h -@@ -4,6 +4,9 @@ - #ifdef CONFIG_PCI - void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); - int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); -+#endif /* CONFIG_PCI */ -+ -+#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS) - int usb_amd_find_chipset_info(void); - int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev); - bool usb_amd_hang_symptom_quirk(void); -@@ -16,11 +19,24 @@ void usb_disable_xhci_ports(struct pci_d - void sb800_prefetch(struct device *dev, int on); - #else - struct pci_dev; -+static inline int usb_amd_find_chipset_info(void) -+{ -+ return 0; -+} -+static inline bool usb_amd_hang_symptom_quirk(void) -+{ -+ return false; -+} -+static inline bool usb_amd_prefetch_quirk(void) -+{ -+ return false; -+} - static inline void usb_amd_quirk_pll_disable(void) {} - static inline void usb_amd_quirk_pll_enable(void) {} - static inline void usb_amd_dev_put(void) {} - static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} - static inline void sb800_prefetch(struct device *dev, int on) {} --#endif /* CONFIG_PCI */ -+static inline void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) {} -+#endif - - #endif /* __LINUX_USB_PCI_QUIRKS_H */ ---- a/include/linux/usb/hcd.h -+++ b/include/linux/usb/hcd.h -@@ -460,7 +460,14 @@ extern int usb_hcd_pci_probe(struct pci_ - extern void usb_hcd_pci_remove(struct pci_dev *dev); - extern void usb_hcd_pci_shutdown(struct pci_dev *dev); - -+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS - extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev); -+#else -+static inline int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev) -+{ -+ return 0; -+} -+#endif - - #ifdef CONFIG_PM - extern const struct dev_pm_ops usb_hcd_pci_pm_ops; diff --git a/target/linux/generic/pending-4.4/821-usb-Remove-annoying-warning-about-bogus-URB.patch b/target/linux/generic/pending-4.4/821-usb-Remove-annoying-warning-about-bogus-URB.patch deleted file mode 100644 index eb7cc809c..000000000 --- a/target/linux/generic/pending-4.4/821-usb-Remove-annoying-warning-about-bogus-URB.patch +++ /dev/null @@ -1,78 +0,0 @@ -From f13ad28ba4280d2283ca2b49f0bd384bc51e6a68 Mon Sep 17 00:00:00 2001 -From: Alexey Brodkin -Date: Tue, 5 Jul 2016 14:28:31 +0300 -Subject: [PATCH] usb: Remove annoying warning about bogus URB - -When ath9k-htc Wi-Fi dongle is used with generic OHCI controller -infinite stream of warnings appears in debug console like this: --------------------------->8---------------------- -usb 1-1: new full-speed USB device number 2 using ohci-platform -usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested -usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: -51008 -------------[ cut here ]------------ -WARNING: CPU: 0 PID: 19 at drivers/usb/core/urb.c:449 -usb_submit_urb+0x1b4/0x498() -usb 1-1: BOGUS urb xfer, pipe 1 != type 3 -Modules linked in: -CPU: 0 PID: 19 Comm: kworker/0:1 Not tainted -4.4.0-rc4-00017-g00e2d79-dirty #3 -Workqueue: events request_firmware_work_func - -Stack Trace: - arc_unwind_core.constprop.1+0xa4/0x110 ----[ end trace 649ef8c342817fc2 ]--- -------------[ cut here ]------------ -WARNING: CPU: 0 PID: 19 at drivers/usb/core/urb.c:449 -usb_submit_urb+0x1b4/0x498() -usb 1-1: BOGUS urb xfer, pipe 1 != type 3 -Modules linked in: -CPU: 0 PID: 19 Comm: kworker/0:1 Tainted: G W -4.4.0-rc4-00017-g00e2d79-dirty #3 -Workqueue: events request_firmware_work_func - -Stack Trace: - arc_unwind_core.constprop.1+0xa4/0x110 ----[ end trace 649ef8c342817fc3 ]--- -------------[ cut here ]------------ --------------------------->8---------------------- - -There're some discussions in mailing lists proposing to disable -that particular check alltogether and magically all seem to work -fine with muted warning. - -Anyways new thread on that regard could be found here: -http://lists.infradead.org/pipermail/linux-snps-arc/2016-July/001310.html - -Let's see what comes out of that new discussion, hopefully patching -of generic USB stuff won't be required then. - -Signed-off-by: Alexey Brodkin ---- - drivers/usb/core/urb.c | 5 ----- - 1 file changed, 5 deletions(-) - ---- a/drivers/usb/core/urb.c -+++ b/drivers/usb/core/urb.c -@@ -323,9 +323,6 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); - */ - int usb_submit_urb(struct urb *urb, gfp_t mem_flags) - { -- static int pipetypes[4] = { -- PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT -- }; - int xfertype, max; - struct usb_device *dev; - struct usb_host_endpoint *ep; -@@ -443,11 +440,6 @@ int usb_submit_urb(struct urb *urb, gfp_ - * cause problems in HCDs if they get it wrong. - */ - -- /* Check that the pipe's type matches the endpoint's type */ -- if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) -- dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", -- usb_pipetype(urb->pipe), pipetypes[xfertype]); -- - /* Check against a simple/standard policy */ - allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK | - URB_FREE_BUFFER); diff --git a/target/linux/generic/pending-4.4/831-ledtrig_netdev.patch b/target/linux/generic/pending-4.4/831-ledtrig_netdev.patch deleted file mode 100644 index a28de899a..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -72,3 +72,4 @@ obj-$(CONFIG_LEDS_DAC124S085) += leds-d - - # LED Triggers - obj-$(CONFIG_LEDS_TRIGGERS) += trigger/ -+obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o diff --git a/target/linux/generic/pending-4.4/834-ledtrig-libata.patch b/target/linux/generic/pending-4.4/834-ledtrig-libata.patch deleted file mode 100644 index ad6363447..000000000 --- a/target/linux/generic/pending-4.4/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 ---- 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 -@@ -4781,6 +4794,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; -@@ -5678,6 +5694,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; -@@ -5699,6 +5718,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; - } -@@ -6145,7 +6170,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 -@@ -877,6 +880,12 @@ struct ata_port { - #ifdef CONFIG_ATA_ACPI - struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ - #endif -+ -+#ifdef CONFIG_ATA_LEDS -+ struct led_trigger *ledtrig; -+ char ledtrig_name[8]; -+#endif -+ - /* owned by EH */ - u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned; - }; diff --git a/target/linux/generic/pending-4.4/835-misc-owl_loader.patch b/target/linux/generic/pending-4.4/835-misc-owl_loader.patch deleted file mode 100644 index c17902068..000000000 --- a/target/linux/generic/pending-4.4/835-misc-owl_loader.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/drivers/misc/Kconfig -+++ b/drivers/misc/Kconfig -@@ -150,6 +150,18 @@ config SGI_IOC4 - If you have an SGI Altix with an IOC4-based card say Y. - Otherwise say N. - -+config OWL_LOADER -+ tristate "Owl loader for initializing Atheros PCI(e) Wifi chips" -+ depends on PCI -+ ---help--- -+ This kernel module helps to initialize certain Qualcomm -+ Atheros' PCI(e) Wifi chips, which have the init data -+ (which contains the PCI device ID for example) stored -+ together with the calibration data in the file system. -+ -+ This is necessary for devices like the Cisco Meraki Z1, say M. -+ Otherwise say N. -+ - config TIFM_CORE - tristate "TI Flash Media interface support" - depends on PCI ---- a/drivers/misc/Makefile -+++ b/drivers/misc/Makefile -@@ -15,6 +15,7 @@ obj-$(CONFIG_BMP085_SPI) += bmp085-spi.o - obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o - obj-$(CONFIG_ICS932S401) += ics932s401.o - obj-$(CONFIG_LKDTM) += lkdtm.o -+obj-$(CONFIG_OWL_LOADER) += owl-loader.o - obj-$(CONFIG_TIFM_CORE) += tifm_core.o - obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o - obj-$(CONFIG_PHANTOM) += phantom.o diff --git a/target/linux/generic/pending-4.4/840-rtc7301.patch b/target/linux/generic/pending-4.4/840-rtc7301.patch deleted file mode 100644 index fafeb830e..000000000 --- a/target/linux/generic/pending-4.4/840-rtc7301.patch +++ /dev/null @@ -1,250 +0,0 @@ ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -1132,6 +1132,15 @@ config RTC_DRV_ZYNQMP - If you say yes here you get support for the RTC controller found on - Xilinx Zynq Ultrascale+ MPSoC. - -+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 -@@ -125,6 +125,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_RV8803) += rtc-rv8803.o - obj-$(CONFIG_RTC_DRV_RX4581) += rtc-rx4581.o ---- /dev/null -+++ b/drivers/rtc/rtc-rtc7301.c -@@ -0,0 +1,219 @@ -+/* -+ * Driver for Epson RTC-7301SF/DG -+ * -+ * Copyright (C) 2009 Jose Vasconcellos -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define RTC_NAME "rtc7301" -+#define RTC_VERSION "0.1" -+ -+/* Epson RTC-7301 register addresses */ -+#define RTC7301_SEC 0x00 -+#define RTC7301_SEC10 0x01 -+#define RTC7301_MIN 0x02 -+#define RTC7301_MIN10 0x03 -+#define RTC7301_HOUR 0x04 -+#define RTC7301_HOUR10 0x05 -+#define RTC7301_WEEKDAY 0x06 -+#define RTC7301_DAY 0x07 -+#define RTC7301_DAY10 0x08 -+#define RTC7301_MON 0x09 -+#define RTC7301_MON10 0x0A -+#define RTC7301_YEAR 0x0B -+#define RTC7301_YEAR10 0x0C -+#define RTC7301_YEAR100 0x0D -+#define RTC7301_YEAR1000 0x0E -+#define RTC7301_CTRLREG 0x0F -+ -+static uint8_t __iomem *rtc7301_base; -+ -+#define read_reg(offset) (readb(rtc7301_base + offset) & 0xf) -+#define write_reg(offset, data) writeb(data, rtc7301_base + (offset)) -+ -+#define rtc7301_isbusy() (read_reg(RTC7301_CTRLREG) & 1) -+ -+static void rtc7301_init_settings(void) -+{ -+ int i; -+ -+ write_reg(RTC7301_CTRLREG, 2); -+ write_reg(RTC7301_YEAR1000, 2); -+ udelay(122); -+ -+ /* bank 1 */ -+ write_reg(RTC7301_CTRLREG, 6); -+ for (i=0; i<15; i++) -+ write_reg(i, 0); -+ -+ /* bank 2 */ -+ write_reg(RTC7301_CTRLREG, 14); -+ for (i=0; i<15; i++) -+ write_reg(i, 0); -+ write_reg(RTC7301_CTRLREG, 0); -+} -+ -+static int rtc7301_get_datetime(struct device *dev, struct rtc_time *dt) -+{ -+ int cnt; -+ uint8_t buf[16]; -+ -+ cnt = 0; -+ while (rtc7301_isbusy()) { -+ udelay(244); -+ if (cnt++ > 100) { -+ dev_err(dev, "%s: timeout error %x\n", __func__, rtc7301_base[RTC7301_CTRLREG]); -+ return -EIO; -+ } -+ } -+ -+ for (cnt=0; cnt<16; cnt++) -+ buf[cnt] = read_reg(cnt); -+ -+ if (buf[RTC7301_SEC10] & 8) { -+ dev_err(dev, "%s: RTC not set\n", __func__); -+ return -EINVAL; -+ } -+ -+ memset(dt, 0, sizeof(*dt)); -+ -+ dt->tm_sec = buf[RTC7301_SEC] + buf[RTC7301_SEC10]*10; -+ dt->tm_min = buf[RTC7301_MIN] + buf[RTC7301_MIN10]*10; -+ dt->tm_hour = buf[RTC7301_HOUR] + buf[RTC7301_HOUR10]*10; -+ -+ dt->tm_mday = buf[RTC7301_DAY] + buf[RTC7301_DAY10]*10; -+ dt->tm_mon = buf[RTC7301_MON] + buf[RTC7301_MON10]*10 - 1; -+ dt->tm_year = buf[RTC7301_YEAR] + buf[RTC7301_YEAR10]*10 + -+ buf[RTC7301_YEAR100]*100 + -+ ((buf[RTC7301_YEAR1000] & 3)*1000) - 1900; -+ -+ /* the rtc device may contain illegal values on power up -+ * according to the data sheet. make sure they are valid. -+ */ -+ -+ return rtc_valid_tm(dt); -+} -+ -+static int rtc7301_set_datetime(struct device *dev, struct rtc_time *dt) -+{ -+ int data; -+ -+ data = dt->tm_year + 1900; -+ if (data >= 2100 || data < 1900) -+ return -EINVAL; -+ -+ write_reg(RTC7301_CTRLREG, 2); -+ udelay(122); -+ -+ data = bin2bcd(dt->tm_sec); -+ write_reg(RTC7301_SEC, data); -+ write_reg(RTC7301_SEC10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_min); -+ write_reg(RTC7301_MIN, data ); -+ write_reg(RTC7301_MIN10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_hour); -+ write_reg(RTC7301_HOUR, data); -+ write_reg(RTC7301_HOUR10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_mday); -+ write_reg(RTC7301_DAY, data); -+ write_reg(RTC7301_DAY10, (data>> 4)); -+ -+ data = bin2bcd(dt->tm_mon + 1); -+ write_reg(RTC7301_MON, data); -+ write_reg(RTC7301_MON10, (data >> 4)); -+ -+ data = bin2bcd(dt->tm_year % 100); -+ write_reg(RTC7301_YEAR, data); -+ write_reg(RTC7301_YEAR10, (data >> 4)); -+ data = bin2bcd((1900 + dt->tm_year) / 100); -+ write_reg(RTC7301_YEAR100, data); -+ -+ data = bin2bcd(dt->tm_wday); -+ write_reg(RTC7301_WEEKDAY, data); -+ -+ write_reg(RTC7301_CTRLREG, 0); -+ -+ return 0; -+} -+ -+static const struct rtc_class_ops rtc7301_rtc_ops = { -+ .read_time = rtc7301_get_datetime, -+ .set_time = rtc7301_set_datetime, -+}; -+ -+static int rtc7301_probe(struct platform_device *pdev) -+{ -+ struct rtc_device *rtc; -+ struct resource *res; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) -+ return -ENOENT; -+ -+ rtc7301_base = ioremap_nocache(res->start, 0x1000 /*res->end - res->start + 1*/); -+ if (!rtc7301_base) -+ return -EINVAL; -+ -+ rtc = rtc_device_register(RTC_NAME, &pdev->dev, -+ &rtc7301_rtc_ops, THIS_MODULE); -+ if (IS_ERR(rtc)) { -+ iounmap(rtc7301_base); -+ return PTR_ERR(rtc); -+ } -+ -+ platform_set_drvdata(pdev, rtc); -+ -+ rtc7301_init_settings(); -+ return 0; -+} -+ -+static int rtc7301_remove(struct platform_device *pdev) -+{ -+ struct rtc_device *rtc = platform_get_drvdata(pdev); -+ -+ if (rtc) -+ rtc_device_unregister(rtc); -+ if (rtc7301_base) -+ iounmap(rtc7301_base); -+ return 0; -+} -+ -+static struct platform_driver rtc7301_driver = { -+ .driver = { -+ .name = RTC_NAME, -+ .owner = THIS_MODULE, -+ }, -+ .probe = rtc7301_probe, -+ .remove = rtc7301_remove, -+}; -+ -+static __init int rtc7301_init(void) -+{ -+ return platform_driver_register(&rtc7301_driver); -+} -+module_init(rtc7301_init); -+ -+static __exit void rtc7301_exit(void) -+{ -+ platform_driver_unregister(&rtc7301_driver); -+} -+module_exit(rtc7301_exit); -+ -+MODULE_DESCRIPTION("Epson 7301 RTC driver"); -+MODULE_AUTHOR("Jose Vasconcellos "); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:" RTC_NAME); -+MODULE_VERSION(RTC_VERSION); diff --git a/target/linux/generic/pending-4.4/841-rtc_pt7c4338.patch b/target/linux/generic/pending-4.4/841-rtc_pt7c4338.patch deleted file mode 100644 index 4235efa38..000000000 --- a/target/linux/generic/pending-4.4/841-rtc_pt7c4338.patch +++ /dev/null @@ -1,247 +0,0 @@ ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -612,6 +612,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 -@@ -116,6 +116,7 @@ obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030 - obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o - obj-$(CONFIG_RTC_DRV_PM8XXX) += rtc-pm8xxx.o - obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o -+obj-$(CONFIG_RTC_DRV_PT7C4338) += rtc-pt7c4338.o - obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o - obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o - obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o ---- /dev/null -+++ b/drivers/rtc/rtc-pt7c4338.c -@@ -0,0 +1,216 @@ -+/* -+ * Copyright 2010 Freescale Semiconductor, Inc. -+ * -+ * Author: Priyanka Jain -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+/* -+ * This file provides Date & Time support (no alarms) for PT7C4338 chip. -+ * -+ * This file is based on drivers/rtc/rtc-ds1307.c -+ * -+ * PT7C4338 chip is manufactured by Pericom Technology Inc. -+ * It is a serial real-time clock which provides -+ * 1)Low-power clock/calendar. -+ * 2)Programmable square-wave output. -+ * It has 56 bytes of nonvolatile RAM. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* RTC register addresses */ -+#define PT7C4338_REG_SECONDS 0x00 -+#define PT7C4338_REG_MINUTES 0x01 -+#define PT7C4338_REG_HOURS 0x02 -+#define PT7C4338_REG_AMPM 0x02 -+#define PT7C4338_REG_DAY 0x03 -+#define PT7C4338_REG_DATE 0x04 -+#define PT7C4338_REG_MONTH 0x05 -+#define PT7C4338_REG_YEAR 0x06 -+#define PT7C4338_REG_CTRL_STAT 0x07 -+ -+/* RTC second register address bit */ -+#define PT7C4338_SEC_BIT_CH 0x80 /*Clock Halt (in Register 0)*/ -+ -+/* RTC control and status register bits */ -+#define PT7C4338_CTRL_STAT_BIT_RS0 0x1 /*Rate select 0*/ -+#define PT7C4338_CTRL_STAT_BIT_RS1 0x2 /*Rate select 1*/ -+#define PT7C4338_CTRL_STAT_BIT_SQWE 0x10 /*Square Wave Enable*/ -+#define PT7C4338_CTRL_STAT_BIT_OSF 0x20 /*Oscillator Stop Flag*/ -+#define PT7C4338_CTRL_STAT_BIT_OUT 0x80 /*Output Level Control*/ -+ -+static const struct i2c_device_id pt7c4338_id[] = { -+ { "pt7c4338", 0 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(i2c, pt7c4338_id); -+ -+struct pt7c4338{ -+ struct i2c_client *client; -+ struct rtc_device *rtc; -+}; -+ -+static int pt7c4338_read_time(struct device *dev, struct rtc_time *time) -+{ -+ struct i2c_client *client = to_i2c_client(dev); -+ int ret; -+ u8 buf[7]; -+ u8 year, month, day, hour, minute, second; -+ u8 week, twelve_hr, am_pm; -+ -+ ret = i2c_smbus_read_i2c_block_data(client, -+ PT7C4338_REG_SECONDS, 7, buf); -+ if (ret < 0) -+ return ret; -+ if (ret < 7) -+ return -EIO; -+ -+ second = buf[0]; -+ minute = buf[1]; -+ hour = buf[2]; -+ week = buf[3]; -+ day = buf[4]; -+ month = buf[5]; -+ year = buf[6]; -+ -+ /* Extract additional information for AM/PM */ -+ twelve_hr = hour & 0x40; -+ am_pm = hour & 0x20; -+ -+ /* Write to rtc_time structure */ -+ time->tm_sec = bcd2bin(second & 0x7f); -+ time->tm_min = bcd2bin(minute & 0x7f); -+ if (twelve_hr) { -+ /* Convert to 24 hr */ -+ if (am_pm) -+ time->tm_hour = bcd2bin(hour & 0x10) + 12; -+ else -+ time->tm_hour = bcd2bin(hour & 0xBF); -+ } else { -+ time->tm_hour = bcd2bin(hour); -+ } -+ -+ time->tm_wday = bcd2bin(week & 0x07) - 1; -+ time->tm_mday = bcd2bin(day & 0x3f); -+ time->tm_mon = bcd2bin(month & 0x1F) - 1; -+ /* assume 20YY not 19YY */ -+ time->tm_year = bcd2bin(year) + 100; -+ -+ return 0; -+} -+ -+static int pt7c4338_set_time(struct device *dev, struct rtc_time *time) -+{ -+ struct i2c_client *client = to_i2c_client(dev); -+ u8 buf[7]; -+ -+ /* Extract time from rtc_time and load into pt7c4338*/ -+ buf[0] = bin2bcd(time->tm_sec); -+ buf[1] = bin2bcd(time->tm_min); -+ buf[2] = bin2bcd(time->tm_hour); -+ buf[3] = bin2bcd(time->tm_wday + 1); /* Day of the week */ -+ buf[4] = bin2bcd(time->tm_mday); /* Date */ -+ buf[5] = bin2bcd(time->tm_mon + 1); -+ -+ /* assume 20YY not 19YY */ -+ if (time->tm_year >= 100) -+ buf[6] = bin2bcd(time->tm_year - 100); -+ else -+ buf[6] = bin2bcd(time->tm_year); -+ -+ return i2c_smbus_write_i2c_block_data(client, -+ PT7C4338_REG_SECONDS, 7, buf); -+} -+ -+static const struct rtc_class_ops pt7c4338_rtc_ops = { -+ .read_time = pt7c4338_read_time, -+ .set_time = pt7c4338_set_time, -+}; -+ -+static int pt7c4338_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) -+{ -+ struct pt7c4338 *pt7c4338; -+ struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); -+ int ret; -+ -+ pt7c4338 = kzalloc(sizeof(struct pt7c4338), GFP_KERNEL); -+ if (!pt7c4338) -+ return -ENOMEM; -+ -+ pt7c4338->client = client; -+ i2c_set_clientdata(client, pt7c4338); -+ pt7c4338->rtc = rtc_device_register(client->name, &client->dev, -+ &pt7c4338_rtc_ops, THIS_MODULE); -+ if (IS_ERR(pt7c4338->rtc)) { -+ ret = PTR_ERR(pt7c4338->rtc); -+ dev_err(&client->dev, "unable to register the class device\n"); -+ goto out_free; -+ } -+ -+ return 0; -+out_free: -+ i2c_set_clientdata(client, NULL); -+ kfree(pt7c4338); -+ return ret; -+} -+ -+static int pt7c4338_remove(struct i2c_client *client) -+{ -+ struct pt7c4338 *pt7c4338 = i2c_get_clientdata(client); -+ -+ rtc_device_unregister(pt7c4338->rtc); -+ i2c_set_clientdata(client, NULL); -+ kfree(pt7c4338); -+ return 0; -+} -+ -+static struct i2c_driver pt7c4338_driver = { -+ .driver = { -+ .name = "rtc-pt7c4338", -+ .owner = THIS_MODULE, -+ }, -+ .probe = pt7c4338_probe, -+ .remove = pt7c4338_remove, -+ .id_table = pt7c4338_id, -+}; -+ -+static int __init pt7c4338_init(void) -+{ -+ return i2c_add_driver(&pt7c4338_driver); -+} -+ -+static void __exit pt7c4338_exit(void) -+{ -+ i2c_del_driver(&pt7c4338_driver); -+} -+ -+module_init(pt7c4338_init); -+module_exit(pt7c4338_exit); -+ -+MODULE_AUTHOR("Priyanka Jain "); -+MODULE_DESCRIPTION("pericom Technology Inc. PT7C4338 RTC Driver"); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/pending-4.4/861-04_spi_gpio_implement_spi_delay.patch b/target/linux/generic/pending-4.4/861-04_spi_gpio_implement_spi_delay.patch deleted file mode 100644 index fc1b40c03..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/862-gpio_spi_driver.patch b/target/linux/generic/pending-4.4/862-gpio_spi_driver.patch deleted file mode 100644 index 8f334ec39..000000000 --- a/target/linux/generic/pending-4.4/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 -@@ -254,6 +254,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 -@@ -42,6 +42,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/pending-4.4/890-uart_optional_sysrq.patch b/target/linux/generic/pending-4.4/890-uart_optional_sysrq.patch deleted file mode 100644 index 0e37f9456..000000000 --- a/target/linux/generic/pending-4.4/890-uart_optional_sysrq.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/lib/Kconfig.debug -+++ b/lib/Kconfig.debug -@@ -382,6 +382,11 @@ config MAGIC_SYSRQ_DEFAULT_ENABLE - This may be set to 1 or 0 to enable or disable them all, or - to a bitmask as described in Documentation/sysrq.txt. - -+config MAGIC_SYSRQ_SERIAL -+ bool "Enable magic SysRq key over serial" -+ depends on MAGIC_SYSRQ -+ default y -+ - config DEBUG_KERNEL - bool "Kernel debugging" - help ---- a/include/linux/serial_core.h -+++ b/include/linux/serial_core.h -@@ -426,7 +426,7 @@ extern void uart_handle_cts_change(struc - extern void uart_insert_char(struct uart_port *port, unsigned int status, - unsigned int overrun, unsigned int ch, unsigned int flag); - --#ifdef SUPPORT_SYSRQ -+#if defined(SUPPORT_SYSRQ) && defined(CONFIG_MAGIC_SYSRQ_SERIAL) - static inline int - uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) - { diff --git a/target/linux/generic/pending-4.4/901-debloat_sock_diag.patch b/target/linux/generic/pending-4.4/901-debloat_sock_diag.patch deleted file mode 100644 index 4733d1b79..000000000 --- a/target/linux/generic/pending-4.4/901-debloat_sock_diag.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- a/net/Kconfig -+++ b/net/Kconfig -@@ -92,6 +92,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/core/sock.c -+++ b/net/core/sock.c -@@ -1474,9 +1474,11 @@ void sk_destruct(struct sock *sk) - - static void __sk_free(struct sock *sk) - { -+#ifdef CONFIG_SOCK_DIAG - if (unlikely(sock_diag_has_destroy_listeners(sk) && sk->sk_net_refcnt)) - sock_diag_broadcast_destroy(sk); - else -+#endif - sk_destruct(sk); - } - ---- a/net/ipv4/Kconfig -+++ b/net/ipv4/Kconfig -@@ -415,6 +415,7 @@ config INET_LRO - - config INET_DIAG - tristate "INET: socket monitoring interface" -+ select SOCK_DIAG - default y - ---help--- - Support for INET (TCP, DCCP, etc) socket monitoring interface used by ---- a/net/unix/Kconfig -+++ b/net/unix/Kconfig -@@ -22,6 +22,7 @@ config UNIX - config UNIX_DIAG - tristate "UNIX: socket monitoring interface" - depends on UNIX -+ select SOCK_DIAG - default n - ---help--- - Support for UNIX socket monitoring interface used by the ss tool. ---- a/net/netlink/Kconfig -+++ b/net/netlink/Kconfig -@@ -4,6 +4,7 @@ - - config NETLINK_DIAG - tristate "NETLINK: socket monitoring interface" -+ select SOCK_DIAG - default n - ---help--- - Support for NETLINK socket monitoring interface used by the ss tool. ---- a/net/packet/Kconfig -+++ b/net/packet/Kconfig -@@ -18,6 +18,7 @@ config PACKET - config PACKET_DIAG - tristate "Packet: sockets monitoring interface" - depends on PACKET -+ select SOCK_DIAG - default n - ---help--- - Support for PF_PACKET sockets monitoring interface used by the ss tool. diff --git a/target/linux/generic/pending-4.4/902-debloat_proc.patch b/target/linux/generic/pending-4.4/902-debloat_proc.patch deleted file mode 100644 index 2fe048944..000000000 --- a/target/linux/generic/pending-4.4/902-debloat_proc.patch +++ /dev/null @@ -1,385 +0,0 @@ ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -2716,6 +2716,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 -@@ -81,3 +81,8 @@ config PROC_CHILDREN - - Say Y if you are running any user-space software which takes benefit from - this interface. For example, rkt is such a piece of software. -+ -+config PROC_STRIPPED -+ default n -+ depends on EXPERT -+ bool "Strip non-essential /proc functionality to reduce code size" ---- a/fs/proc/consoles.c -+++ b/fs/proc/consoles.c -@@ -106,6 +106,9 @@ static const struct file_operations proc - - static int __init proc_consoles_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return 0; -+ - proc_create("consoles", 0, NULL, &proc_consoles_operations); - return 0; - } ---- a/fs/proc/proc_tty.c -+++ b/fs/proc/proc_tty.c -@@ -144,7 +144,10 @@ static const struct file_operations proc - void proc_tty_register_driver(struct tty_driver *driver) - { - struct proc_dir_entry *ent; -- -+ -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!driver->driver_name || driver->proc_entry || - !driver->ops->proc_fops) - return; -@@ -161,6 +164,9 @@ void proc_tty_unregister_driver(struct t - { - struct proc_dir_entry *ent; - -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - ent = driver->proc_entry; - if (!ent) - return; -@@ -175,6 +181,9 @@ void proc_tty_unregister_driver(struct t - */ - void __init proc_tty_init(void) - { -+ if (IS_ENABLED(CONFIG_PROC_STRIPPED)) -+ return; -+ - if (!proc_mkdir("tty", NULL)) - return; - proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */ ---- a/kernel/exec_domain.c -+++ b/kernel/exec_domain.c -@@ -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 -@@ -393,6 +393,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 -@@ -2684,6 +2684,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 -@@ -1558,10 +1558,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 -@@ -3044,6 +3044,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 -@@ -2641,10 +2641,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; - -@@ -2654,17 +2656,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 -@@ -539,6 +539,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 -@@ -423,6 +423,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 -@@ -1071,6 +1071,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 -@@ -198,6 +198,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/pending-4.4/904-debloat_dma_buf.patch b/target/linux/generic/pending-4.4/904-debloat_dma_buf.patch deleted file mode 100644 index b9fdad9c1..000000000 --- a/target/linux/generic/pending-4.4/904-debloat_dma_buf.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/drivers/base/Kconfig -+++ b/drivers/base/Kconfig -@@ -232,7 +232,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 -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - - static inline int is_dma_buf_file(struct file *); - -@@ -914,4 +915,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 -@@ -2096,6 +2096,7 @@ int wake_up_state(struct task_struct *p, - { - return try_to_wake_up(p, state, 0); - } -+EXPORT_SYMBOL_GPL(wake_up_state); - - /* - * This function clears the sched_dl_entity static params. diff --git a/target/linux/generic/pending-4.4/910-kobject_uevent.patch b/target/linux/generic/pending-4.4/910-kobject_uevent.patch deleted file mode 100644 index a2c935f26..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/pending-4.4/911-kobject_add_broadcast_uevent.patch deleted file mode 100644 index a3401ff4b..000000000 --- a/target/linux/generic/pending-4.4/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[]; -@@ -222,4 +224,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/pending-4.4/921-use_preinit_as_init.patch b/target/linux/generic/pending-4.4/921-use_preinit_as_init.patch deleted file mode 100644 index 3aba9d63b..000000000 --- a/target/linux/generic/pending-4.4/921-use_preinit_as_init.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -966,7 +966,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/pending-4.4/922-always-create-console-node-in-initramfs.patch b/target/linux/generic/pending-4.4/922-always-create-console-node-in-initramfs.patch deleted file mode 100644 index 988de35ce..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/930-crashlog.patch b/target/linux/generic/pending-4.4/930-crashlog.patch deleted file mode 100644 index fdc80d750..000000000 --- a/target/linux/generic/pending-4.4/930-crashlog.patch +++ /dev/null @@ -1,317 +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 -@@ -1296,6 +1296,10 @@ config RELAY - - If unsure, say N. - -+config CRASHLOG -+ bool "Crash logging" -+ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK) -+ - config BLK_DEV_INITRD - bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" - depends on BROKEN || !FRV ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -103,6 +103,7 @@ obj-$(CONFIG_TORTURE_TEST) += torture.o - obj-$(CONFIG_MEMBARRIER) += membarrier.o - - obj-$(CONFIG_HAS_IOMEM) += memremap.o -+obj-$(CONFIG_CRASHLOG) += crashlog.o - - $(obj)/configs.o: $(obj)/config_data.h - ---- /dev/null -+++ b/kernel/crashlog.c -@@ -0,0 +1,213 @@ -+/* -+ * 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 -+#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; -+ -+static bool crashlog_set_addr(phys_addr_t addr, phys_addr_t size) -+{ -+ /* Limit to lower 64 MB to avoid highmem */ -+ phys_addr_t limit = 64 * 1024 * 1024; -+ -+ if (crashlog_addr) -+ return false; -+ -+ if (addr > limit) -+ return false; -+ -+ if (addr + size > limit) -+ size = limit - addr; -+ -+ crashlog_addr = addr; -+ -+ if (addr + size > CRASHLOG_OFFSET) -+ crashlog_addr += size - CRASHLOG_OFFSET; -+ -+ return true; -+} -+ -+#ifndef CONFIG_NO_BOOTMEM -+void __init crashlog_init_bootmem(bootmem_data_t *bdata) -+{ -+ phys_addr_t start, end; -+ -+ start = PFN_PHYS(bdata->node_low_pfn); -+ end = PFN_PHYS(bdata->node_min_pfn); -+ if (!crashlog_set_addr(start, end - start)) -+ return; -+ -+ if (reserve_bootmem(crashlog_addr, CRASHLOG_SIZE, BOOTMEM_EXCLUSIVE) < 0) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", -+ crashlog_addr); -+ crashlog_addr = 0; -+ } -+} -+#endif -+ -+#ifdef CONFIG_HAVE_MEMBLOCK -+void __init_memblock crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+ if (!crashlog_set_addr(addr, size)) -+ return; -+ -+ if (memblock_reserve(crashlog_addr, CRASHLOG_SIZE)) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", -+ crashlog_addr); -+ crashlog_addr = 0; -+ } -+} -+#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) -+{ -+ struct page *pages[CRASHLOG_PAGES]; -+ pgprot_t prot; -+ int i; -+ -+ if (!crashlog_addr) { -+ printk("No memory allocated for crashlog\n"); -+ return -ENOMEM; -+ } -+ -+ printk("Crashlog allocated RAM at address 0x%lx\n", (unsigned long) crashlog_addr); -+ for (i = 0; i < CRASHLOG_PAGES; i++) -+ pages[i] = pfn_to_page((crashlog_addr >> PAGE_SHIFT) + i); -+ -+ prot = pgprot_writecombine(PAGE_KERNEL); -+ crashlog_buf = vmap(pages, CRASHLOG_PAGES, VM_MAP, prot); -+ -+ 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/kernel/module.c -+++ b/kernel/module.c -@@ -275,6 +275,9 @@ static void mod_update_bounds(struct mod - #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 - - static void module_assert_mutex(void) - { ---- a/mm/memblock.c -+++ b/mm/memblock.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -503,6 +504,8 @@ static void __init_memblock memblock_ins - memblock_set_region_node(rgn, nid); - type->cnt++; - type->total_size += size; -+ if (type == &memblock.memory) -+ crashlog_init_memblock(base, size); - } - - /** -@@ -541,6 +544,8 @@ int __init_memblock memblock_add_range(s - type->regions[0].flags = flags; - memblock_set_region_node(&type->regions[0], nid); - type->total_size = size; -+ if (type == &memblock.memory) -+ crashlog_init_memblock(base, size); - return 0; - } - repeat: ---- 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; diff --git a/target/linux/generic/pending-4.4/970-remove-unsane-filenames-from-deps_initramfs-list.patch b/target/linux/generic/pending-4.4/970-remove-unsane-filenames-from-deps_initramfs-list.patch deleted file mode 100644 index ac13c9e67..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.4/995-mangle_bootargs.patch b/target/linux/generic/pending-4.4/995-mangle_bootargs.patch deleted file mode 100644 index 821370350..000000000 --- a/target/linux/generic/pending-4.4/995-mangle_bootargs.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/init/main.c -+++ b/init/main.c -@@ -356,6 +356,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 -@@ -529,6 +552,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 -@@ -1655,6 +1655,15 @@ config EMBEDDED - an embedded system so certain expert options are available - for configuration. - -+config MANGLE_BOOTARGS -+ bool "Rename offending bootargs" -+ depends on EXPERT -+ help -+ Sometimes the bootloader passed bogus root= and rootfstype= -+ parameters to the kernel, and while you want to ignore them, -+ you need to know the values f.e. to support dual firmware -+ layouts on the flash. -+ - config HAVE_PERF_EVENTS - bool - help diff --git a/target/linux/generic/pending-4.4/998-enable_wilink_platform_without_drivers.patch b/target/linux/generic/pending-4.4/998-enable_wilink_platform_without_drivers.patch deleted file mode 100644 index d317de110..000000000 --- a/target/linux/generic/pending-4.4/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/pending-4.9/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch b/target/linux/generic/pending-4.9/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch new file mode 100644 index 000000000..524c6f98d --- /dev/null +++ b/target/linux/generic/pending-4.9/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch @@ -0,0 +1,38 @@ +From d9c8bc8c1408f3e8529db6e4e04017b4c579c342 Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Sun, 18 Feb 2018 17:08:04 +0100 +Subject: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio + +In devices, where fdt is used, is impossible to apply platform data +without proper fdt node. + +This patch allow to use platform data in devices with fdt. + +Signed-off-by: Pawel Dembicki +--- + drivers/w1/masters/w1-gpio.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/w1/masters/w1-gpio.c ++++ b/drivers/w1/masters/w1-gpio.c +@@ -113,17 +113,16 @@ static int w1_gpio_probe_dt(struct platf + static int w1_gpio_probe(struct platform_device *pdev) + { + struct w1_bus_master *master; +- struct w1_gpio_platform_data *pdata; ++ struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); + int err; + +- if (of_have_populated_dt()) { ++ if (of_have_populated_dt() && !pdata) { + err = w1_gpio_probe_dt(pdev); + if (err < 0) + return err; ++ pdata = dev_get_platdata(&pdev->dev); + } + +- pdata = dev_get_platdata(&pdev->dev); +- + if (!pdata) { + dev_err(&pdev->dev, "No configuration data\n"); + return -ENXIO; diff --git a/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch b/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch index adae2e049..5b886b30f 100644 --- a/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch +++ b/target/linux/generic/pending-4.9/120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch @@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -5918,7 +5918,7 @@ static void __ref alloc_node_mem_map(str +@@ -5932,7 +5932,7 @@ static void __ref alloc_node_mem_map(str mem_map = NODE_DATA(0)->node_mem_map; #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) if (page_to_pfn(mem_map) != pgdat->node_start_pfn) diff --git a/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch index e2a0e4887..1b6290fca 100644 --- a/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ b/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch @@ -114,7 +114,7 @@ Signed-off-by: Hauke Mehrtens #include #include -@@ -843,6 +844,42 @@ void deregister_mtd_parser(struct mtd_pa +@@ -827,6 +828,42 @@ void deregister_mtd_parser(struct mtd_pa EXPORT_SYMBOL_GPL(deregister_mtd_parser); /* @@ -157,7 +157,7 @@ Signed-off-by: Hauke Mehrtens * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you * are changing this array! */ -@@ -983,6 +1020,13 @@ int parse_mtd_partitions(struct mtd_info +@@ -975,6 +1012,13 @@ int parse_mtd_partitions(struct mtd_info struct mtd_partitions pparts = { }; struct mtd_part_parser *parser; int ret, err = 0; @@ -170,8 +170,8 @@ Signed-off-by: Hauke Mehrtens + } if (!types) - types = default_mtd_part_types; -@@ -1023,6 +1067,7 @@ int parse_mtd_partitions(struct mtd_info + types = mtd_is_partition(master) ? default_subpartition_types : +@@ -1016,6 +1060,7 @@ int parse_mtd_partitions(struct mtd_info if (ret < 0 && !err) err = ret; } diff --git a/target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch b/target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch new file mode 100644 index 000000000..f2d5df503 --- /dev/null +++ b/target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch @@ -0,0 +1,70 @@ +From: Felix Fietkau +Subject: net: phy: at803x: add support for AT8032 + +Like AT8030, this PHY needs the GPIO reset workaround + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/phy/at803x.c ++++ b/drivers/net/phy/at803x.c +@@ -62,6 +62,7 @@ + + #define ATH8030_PHY_ID 0x004dd076 + #define ATH8031_PHY_ID 0x004dd074 ++#define ATH8032_PHY_ID 0x004dd023 + #define ATH8035_PHY_ID 0x004dd072 + + MODULE_DESCRIPTION("Atheros 803x PHY driver"); +@@ -259,7 +260,8 @@ static int at803x_probe(struct phy_devic + if (!priv) + return -ENOMEM; + +- if (phydev->drv->phy_id != ATH8030_PHY_ID) ++ if (phydev->drv->phy_id != ATH8030_PHY_ID && ++ phydev->drv->phy_id != ATH8032_PHY_ID) + goto does_not_require_reset_workaround; + + gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); +@@ -335,7 +337,7 @@ static void at803x_link_change_notify(st + struct at803x_priv *priv = phydev->priv; + + /* +- * Conduct a hardware reset for AT8030 every time a link loss is ++ * Conduct a hardware reset for AT8030/2 every time a link loss is + * signalled. This is necessary to circumvent a hardware bug that + * occurs when the cable is unplugged while TX packets are pending + * in the FIFO. In such cases, the FIFO enters an error mode it +@@ -447,6 +449,24 @@ static struct phy_driver at803x_driver[] + .aneg_done = at803x_aneg_done, + .ack_interrupt = &at803x_ack_interrupt, + .config_intr = &at803x_config_intr, ++}, { ++ /* ATHEROS 8032 */ ++ .phy_id = ATH8032_PHY_ID, ++ .name = "Atheros 8032 ethernet", ++ .phy_id_mask = 0xffffffef, ++ .probe = at803x_probe, ++ .config_init = at803x_config_init, ++ .link_change_notify = at803x_link_change_notify, ++ .set_wol = at803x_set_wol, ++ .get_wol = at803x_get_wol, ++ .suspend = at803x_suspend, ++ .resume = at803x_resume, ++ .features = PHY_BASIC_FEATURES, ++ .flags = PHY_HAS_INTERRUPT, ++ .config_aneg = genphy_config_aneg, ++ .read_status = genphy_read_status, ++ .ack_interrupt = at803x_ack_interrupt, ++ .config_intr = at803x_config_intr, + } }; + + module_phy_driver(at803x_driver); +@@ -454,6 +474,7 @@ module_phy_driver(at803x_driver); + static struct mdio_device_id __maybe_unused atheros_tbl[] = { + { ATH8030_PHY_ID, 0xffffffef }, + { ATH8031_PHY_ID, 0xffffffef }, ++ { ATH8032_PHY_ID, 0xffffffef }, + { ATH8035_PHY_ID, 0xffffffef }, + { } + }; diff --git a/target/linux/generic/pending-4.9/201-extra_optimization.patch b/target/linux/generic/pending-4.9/201-extra_optimization.patch index 2da816e4e..8197f7bb9 100644 --- a/target/linux/generic/pending-4.9/201-extra_optimization.patch +++ b/target/linux/generic/pending-4.9/201-extra_optimization.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau --- a/Makefile +++ b/Makefile -@@ -642,12 +642,12 @@ KBUILD_CFLAGS += $(call cc-option,-fdata +@@ -644,12 +644,12 @@ KBUILD_CFLAGS += $(call cc-option,-fdata endif ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE diff --git a/target/linux/generic/pending-4.9/305-mips_module_reloc.patch b/target/linux/generic/pending-4.9/305-mips_module_reloc.patch index fc8015b5f..10d9f0bdd 100644 --- a/target/linux/generic/pending-4.9/305-mips_module_reloc.patch +++ b/target/linux/generic/pending-4.9/305-mips_module_reloc.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/arch/mips/Makefile +++ b/arch/mips/Makefile -@@ -93,8 +93,13 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin +@@ -93,8 +93,18 @@ 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 @@ -19,8 +19,13 @@ Signed-off-by: Felix Fietkau KBUILD_AFLAGS_MODULE += -mlong-calls KBUILD_CFLAGS_MODULE += -mlong-calls +else -+KBUILD_AFLAGS_MODULE += -mno-long-calls -+KBUILD_CFLAGS_MODULE += -mno-long-calls ++ ifdef CONFIG_DYNAMIC_FTRACE ++ KBUILD_AFLAGS_MODULE += -mlong-calls ++ KBUILD_CFLAGS_MODULE += -mlong-calls ++ else ++ KBUILD_AFLAGS_MODULE += -mno-long-calls ++ KBUILD_CFLAGS_MODULE += -mno-long-calls ++ endif +endif ifeq ($(CONFIG_RELOCATABLE),y) diff --git a/target/linux/generic/pending-4.9/308-mips32r2_tune.patch b/target/linux/generic/pending-4.9/308-mips32r2_tune.patch index 63cf576bd..9e1efe271 100644 --- a/target/linux/generic/pending-4.9/308-mips32r2_tune.patch +++ b/target/linux/generic/pending-4.9/308-mips32r2_tune.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/arch/mips/Makefile +++ b/arch/mips/Makefile -@@ -148,7 +148,7 @@ cflags-$(CONFIG_CPU_R4X00) += -march=r46 +@@ -153,7 +153,7 @@ cflags-$(CONFIG_CPU_R4X00) += -march=r46 cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ -Wa,-mips32 -Wa,--trap diff --git a/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch index 10be7a16a..b0cb27314 100644 --- a/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch @@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve * the pointer to that structure. -@@ -666,6 +670,7 @@ int mtd_add_partition(struct mtd_info *p +@@ -650,6 +654,7 @@ int mtd_add_partition(struct mtd_info *p mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); @@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau mtd_add_partition_attrs(new); -@@ -744,6 +749,35 @@ int mtd_del_partition(struct mtd_info *m +@@ -728,6 +733,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -104,14 +104,14 @@ Signed-off-by: Felix Fietkau /* * 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 -@@ -775,6 +809,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -759,6 +793,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); - if (parts[i].types) - mtd_parse_part(slave, parts[i].types); + /* Look for subpartitions */ + parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h @@ -110,5 +110,7 @@ int mtd_add_partition(struct mtd_info *m diff --git a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch index 63affd7ee..1188cc656 100644 --- a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch @@ -9,7 +9,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -1122,6 +1122,62 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -1115,6 +1115,62 @@ void mtd_part_parser_cleanup(struct mtd_ } } diff --git a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 10d855148..9c2650b45 100644 --- a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -749,6 +749,36 @@ int mtd_del_partition(struct mtd_info *m +@@ -733,6 +733,36 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -757,6 +787,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -741,6 +771,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -55,7 +55,7 @@ Signed-off-by: Gabor Juhos } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -771,6 +802,12 @@ static void mtd_partition_split(struct m +@@ -755,6 +786,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch index 076ec314b..886dece4f 100644 --- a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -779,6 +779,17 @@ run_parsers_by_type(struct mtd_part *sla +@@ -763,6 +763,17 @@ run_parsers_by_type(struct mtd_part *sla return nr_parts; } @@ -29,7 +29,7 @@ Signed-off-by: Gabor Juhos #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -1232,6 +1243,24 @@ int mtd_is_partition(const struct mtd_in +@@ -1225,6 +1236,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch index e925983b3..4e66272bb 100644 --- a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; -@@ -578,19 +647,22 @@ static struct mtd_part *allocate_partiti +@@ -562,19 +631,22 @@ static struct mtd_part *allocate_partiti remainder = do_div(tmp, wr_alignment); if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch index 9299e8867..cbd185e0a 100644 --- a/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ b/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch @@ -6,7 +6,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/parsers/parser_trx.c +++ b/drivers/mtd/parsers/parser_trx.c -@@ -29,6 +29,33 @@ struct trx_header { +@@ -30,6 +30,33 @@ struct trx_header { uint32_t offset[3]; } __packed; @@ -40,7 +40,7 @@ Signed-off-by: Rafał Miłecki static const char *parser_trx_data_part_name(struct mtd_info *master, size_t offset) { -@@ -83,21 +110,21 @@ static int parser_trx_parse(struct mtd_i +@@ -84,21 +111,21 @@ static int parser_trx_parse(struct mtd_i if (trx.offset[2]) { part = &parts[curr_part++]; part->name = "loader"; @@ -59,9 +59,10 @@ Signed-off-by: Rafał Miłecki if (trx.offset[i]) { part = &parts[curr_part++]; - part->name = parser_trx_data_part_name(mtd, trx.offset[i]); +- part->name = parser_trx_data_part_name(mtd, trx.offset[i]); - part->offset = trx.offset[i]; + part->offset = parser_trx_real_offset(mtd, trx.offset[i]); ++ part->name = parser_trx_data_part_name(mtd, part->offset); i++; } diff --git a/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch index a6d0828b9..397064155 100644 --- a/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch +++ b/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch @@ -11,7 +11,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c -@@ -39,6 +39,7 @@ +@@ -40,6 +40,7 @@ #define NVRAM_HEADER 0x48534C46 /* FLSH */ #define POT_MAGIC1 0x54544f50 /* POTT */ #define POT_MAGIC2 0x504f /* OP */ @@ -19,7 +19,7 @@ Signed-off-by: Rafał Miłecki #define ML_MAGIC1 0x39685a42 #define ML_MAGIC2 0x26594131 #define TRX_MAGIC 0x30524448 -@@ -182,6 +183,15 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -183,6 +184,15 @@ static int bcm47xxpart_parse(struct mtd_ MTD_WRITEABLE); continue; } diff --git a/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch b/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch deleted file mode 100644 index b8d510151..000000000 --- a/target/linux/generic/pending-4.9/479-mtd-spi-nor-add-eon-en25qh32.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -955,6 +955,7 @@ static const struct flash_info spi_nor_i - { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, - { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, -+ { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64, 0) }, - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, - { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch b/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch index 1d44cdb9f..8b37dba03 100644 --- a/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch +++ b/target/linux/generic/pending-4.9/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch @@ -8,7 +8,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c -@@ -1223,6 +1223,49 @@ static struct mtd_info * __init open_mtd +@@ -1226,6 +1226,49 @@ static struct mtd_info * __init open_mtd return mtd; } @@ -58,7 +58,7 @@ Signed-off-by: Daniel Golle static int __init ubi_init(void) { int err, i, k; -@@ -1306,6 +1349,12 @@ static int __init ubi_init(void) +@@ -1309,6 +1352,12 @@ static int __init ubi_init(void) } } diff --git a/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch b/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch index 217d20ec5..d3a6afa80 100644 --- a/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch +++ b/target/linux/generic/pending-4.9/610-netfilter_match_bypass_default_checks.patch @@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau if (!xt_percpu_counter_alloc(alloc_state, &e->counters)) return -ENOMEM; -@@ -829,6 +857,7 @@ copy_entries_to_user(unsigned int total_ +@@ -830,6 +858,7 @@ copy_entries_to_user(unsigned int total_ const struct xt_table_info *private = table->private; int ret = 0; const void *loc_cpu_entry; @@ -76,7 +76,7 @@ Signed-off-by: Felix Fietkau counters = alloc_counters(table); if (IS_ERR(counters)) -@@ -856,6 +885,14 @@ copy_entries_to_user(unsigned int total_ +@@ -857,6 +886,14 @@ copy_entries_to_user(unsigned int total_ goto free_counters; } @@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau for (i = sizeof(struct ipt_entry); i < e->target_offset; i += m->u.match_size) { -@@ -1245,12 +1282,15 @@ compat_copy_entry_to_user(struct ipt_ent +@@ -1246,12 +1283,15 @@ compat_copy_entry_to_user(struct ipt_ent compat_uint_t origsize; const struct xt_entry_match *ematch; int ret = 0; diff --git a/target/linux/generic/pending-4.9/630-packet_socket_type.patch b/target/linux/generic/pending-4.9/630-packet_socket_type.patch index 0bf9339d1..08d730ac3 100644 --- a/target/linux/generic/pending-4.9/630-packet_socket_type.patch +++ b/target/linux/generic/pending-4.9/630-packet_socket_type.patch @@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau if (!net_eq(dev_net(dev), sock_net(sk))) goto drop; -@@ -3262,6 +3264,7 @@ static int packet_create(struct net *net +@@ -3260,6 +3262,7 @@ static int packet_create(struct net *net mutex_init(&po->pg_vec_lock); po->rollover = NULL; po->prot_hook.func = packet_rcv; @@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; -@@ -3875,6 +3878,16 @@ packet_setsockopt(struct socket *sock, i +@@ -3873,6 +3876,16 @@ packet_setsockopt(struct socket *sock, i po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau default: return -ENOPROTOOPT; } -@@ -3927,6 +3940,13 @@ static int packet_getsockopt(struct sock +@@ -3925,6 +3938,13 @@ static int packet_getsockopt(struct sock case PACKET_VNET_HDR: val = po->has_vnet_hdr; break; diff --git a/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch b/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch index 99d1fb2e5..38c2ae647 100644 --- a/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch +++ b/target/linux/generic/pending-4.9/666-Add-support-for-MAP-E-FMRs-mesh-mode.patch @@ -268,7 +268,7 @@ Signed-off-by: Steven Barth skb_reset_network_header(skb); memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); -+ if (tpi->proto == htons(ETH_P_IP) && ++ if (tpi->proto == htons(ETH_P_IP) && tunnel->parms.fmrs && + !ipv6_addr_equal(&ipv6h->saddr, &tunnel->parms.raddr)) { + /* Packet didn't come from BR, so lookup FMR */ + struct __ip6_tnl_fmr *fmr; @@ -300,7 +300,7 @@ Signed-off-by: Steven Barth /** * ip6_tnl_addr_conflict - compare packet addresses to tunnel's own * @t: the outgoing tunnel device -@@ -1298,6 +1438,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str +@@ -1294,6 +1434,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str { struct ip6_tnl *t = netdev_priv(dev); struct ipv6hdr *ipv6h = ipv6_hdr(skb); @@ -308,7 +308,7 @@ Signed-off-by: Steven Barth int encap_limit = -1; __u16 offset; struct flowi6 fl6; -@@ -1356,6 +1497,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str +@@ -1352,6 +1493,18 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str fl6.flowi6_mark = skb->mark; } @@ -327,7 +327,7 @@ Signed-off-by: Steven Barth if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6)) return -1; -@@ -1483,6 +1636,14 @@ ip6_tnl_change(struct ip6_tnl *t, const +@@ -1479,6 +1632,14 @@ ip6_tnl_change(struct ip6_tnl *t, const t->parms.flowinfo = p->flowinfo; t->parms.link = p->link; t->parms.proto = p->proto; @@ -342,7 +342,7 @@ Signed-off-by: Steven Barth dst_cache_reset(&t->dst_cache); ip6_tnl_link_config(t); return 0; -@@ -1521,6 +1682,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ +@@ -1517,6 +1678,7 @@ ip6_tnl_parm_from_user(struct __ip6_tnl_ p->flowinfo = u->flowinfo; p->link = u->link; p->proto = u->proto; @@ -350,7 +350,7 @@ Signed-off-by: Steven Barth memcpy(p->name, u->name, sizeof(u->name)); } -@@ -1898,6 +2060,15 @@ static int ip6_tnl_validate(struct nlatt +@@ -1894,6 +2056,15 @@ static int ip6_tnl_validate(struct nlatt return 0; } @@ -366,7 +366,7 @@ Signed-off-by: Steven Barth static void ip6_tnl_netlink_parms(struct nlattr *data[], struct __ip6_tnl_parm *parms) { -@@ -1932,6 +2103,46 @@ static void ip6_tnl_netlink_parms(struct +@@ -1928,6 +2099,46 @@ static void ip6_tnl_netlink_parms(struct if (data[IFLA_IPTUN_COLLECT_METADATA]) parms->collect_md = true; @@ -413,7 +413,7 @@ Signed-off-by: Steven Barth } static bool ip6_tnl_netlink_encap_parms(struct nlattr *data[], -@@ -2045,6 +2256,12 @@ static void ip6_tnl_dellink(struct net_d +@@ -2041,6 +2252,12 @@ static void ip6_tnl_dellink(struct net_d static size_t ip6_tnl_get_size(const struct net_device *dev) { @@ -426,7 +426,7 @@ Signed-off-by: Steven Barth return /* IFLA_IPTUN_LINK */ nla_total_size(4) + -@@ -2072,6 +2289,24 @@ static size_t ip6_tnl_get_size(const str +@@ -2068,6 +2285,24 @@ static size_t ip6_tnl_get_size(const str nla_total_size(2) + /* IFLA_IPTUN_COLLECT_METADATA */ nla_total_size(0) + @@ -451,7 +451,7 @@ Signed-off-by: Steven Barth 0; } -@@ -2079,6 +2314,9 @@ static int ip6_tnl_fill_info(struct sk_b +@@ -2075,6 +2310,9 @@ static int ip6_tnl_fill_info(struct sk_b { struct ip6_tnl *tunnel = netdev_priv(dev); struct __ip6_tnl_parm *parm = &tunnel->parms; @@ -461,7 +461,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) || -@@ -2087,9 +2325,27 @@ static int ip6_tnl_fill_info(struct sk_b +@@ -2083,9 +2321,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) || @@ -490,7 +490,7 @@ Signed-off-by: Steven Barth if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, tunnel->encap.type) || nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, tunnel->encap.sport) || nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, tunnel->encap.dport) || -@@ -2127,6 +2383,7 @@ static const struct nla_policy ip6_tnl_p +@@ -2123,6 +2379,7 @@ static const struct nla_policy ip6_tnl_p [IFLA_IPTUN_ENCAP_SPORT] = { .type = NLA_U16 }, [IFLA_IPTUN_ENCAP_DPORT] = { .type = NLA_U16 }, [IFLA_IPTUN_COLLECT_METADATA] = { .type = NLA_FLAG }, diff --git a/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch b/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch index 2cebf55a4..4757e81ea 100644 --- a/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch +++ b/target/linux/generic/pending-4.9/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch @@ -141,7 +141,7 @@ Signed-off-by: Jonas Gorski static const struct rt6_info ip6_blk_hole_entry_template = { .dst = { .__refcnt = ATOMIC_INIT(1), -@@ -1970,6 +1987,11 @@ static struct rt6_info *ip6_route_info_c +@@ -1967,6 +1984,11 @@ static struct rt6_info *ip6_route_info_c rt->dst.output = ip6_pkt_prohibit_out; rt->dst.input = ip6_pkt_prohibit; break; @@ -153,7 +153,7 @@ Signed-off-by: Jonas Gorski case RTN_THROW: case RTN_UNREACHABLE: default: -@@ -2613,6 +2635,17 @@ static int ip6_pkt_prohibit_out(struct n +@@ -2610,6 +2632,17 @@ static int ip6_pkt_prohibit_out(struct n return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); } @@ -171,7 +171,7 @@ Signed-off-by: Jonas Gorski /* * Allocate a dst for local (unicast / anycast) address. */ -@@ -2850,7 +2883,8 @@ static int rtm_to_fib6_config(struct sk_ +@@ -2847,7 +2880,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 || @@ -181,7 +181,7 @@ Signed-off-by: Jonas Gorski cfg->fc_flags |= RTF_REJECT; if (rtm->rtm_type == RTN_LOCAL) -@@ -3222,6 +3256,9 @@ static int rt6_fill_node(struct net *net +@@ -3219,6 +3253,9 @@ static int rt6_fill_node(struct net *net case -EACCES: rtm->rtm_type = RTN_PROHIBIT; break; @@ -191,7 +191,7 @@ Signed-off-by: Jonas Gorski case -EAGAIN: rtm->rtm_type = RTN_THROW; break; -@@ -3498,6 +3535,8 @@ static int ip6_route_dev_notify(struct n +@@ -3495,6 +3532,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); @@ -200,7 +200,7 @@ Signed-off-by: Jonas Gorski net->ipv6.ip6_blk_hole_entry->dst.dev = dev; net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); #endif -@@ -3509,6 +3548,7 @@ static int ip6_route_dev_notify(struct n +@@ -3506,6 +3545,7 @@ static int ip6_route_dev_notify(struct n in6_dev_put(net->ipv6.ip6_null_entry->rt6i_idev); #ifdef CONFIG_IPV6_MULTIPLE_TABLES in6_dev_put(net->ipv6.ip6_prohibit_entry->rt6i_idev); @@ -208,7 +208,7 @@ Signed-off-by: Jonas Gorski in6_dev_put(net->ipv6.ip6_blk_hole_entry->rt6i_idev); #endif } -@@ -3724,6 +3764,17 @@ static int __net_init ip6_route_net_init +@@ -3721,6 +3761,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); @@ -226,7 +226,7 @@ Signed-off-by: Jonas Gorski #endif net->ipv6.sysctl.flush_delay = 0; -@@ -3742,6 +3793,8 @@ out: +@@ -3739,6 +3790,8 @@ out: return ret; #ifdef CONFIG_IPV6_MULTIPLE_TABLES @@ -235,7 +235,7 @@ Signed-off-by: Jonas Gorski out_ip6_prohibit_entry: kfree(net->ipv6.ip6_prohibit_entry); out_ip6_null_entry: -@@ -3759,6 +3812,7 @@ static void __net_exit ip6_route_net_exi +@@ -3756,6 +3809,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); @@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski #endif dst_entries_destroy(&net->ipv6.ip6_dst_ops); } -@@ -3832,6 +3886,9 @@ void __init ip6_route_init_special_entri +@@ -3829,6 +3883,9 @@ void __init ip6_route_init_special_entri init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev; init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev); diff --git a/target/linux/generic/pending-4.9/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-4.9/734-net-phy-at803x-allow-to-configure-via-pdata.patch index 8bd9ce3bf..69b21be95 100644 --- a/target/linux/generic/pending-4.9/734-net-phy-at803x-allow-to-configure-via-pdata.patch +++ b/target/linux/generic/pending-4.9/734-net-phy-at803x-allow-to-configure-via-pdata.patch @@ -40,7 +40,7 @@ Signed-off-by: Gabor Juhos #define AT803X_DEBUG_ADDR 0x1D #define AT803X_DEBUG_DATA 0x1E -@@ -71,6 +78,7 @@ MODULE_LICENSE("GPL"); +@@ -72,6 +79,7 @@ MODULE_LICENSE("GPL"); struct at803x_priv { bool phy_reset:1; struct gpio_desc *gpiod_reset; @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos }; struct at803x_context { -@@ -274,8 +282,16 @@ does_not_require_reset_workaround: +@@ -276,8 +284,16 @@ does_not_require_reset_workaround: return 0; } @@ -65,7 +65,7 @@ Signed-off-by: Gabor Juhos int ret; ret = genphy_config_init(phydev); -@@ -296,6 +312,26 @@ static int at803x_config_init(struct phy +@@ -298,6 +314,26 @@ static int at803x_config_init(struct phy return ret; } @@ -92,7 +92,7 @@ Signed-off-by: Gabor Juhos return 0; } -@@ -333,6 +369,8 @@ static int at803x_config_intr(struct phy +@@ -335,6 +371,8 @@ static int at803x_config_intr(struct phy static void at803x_link_change_notify(struct phy_device *phydev) { struct at803x_priv *priv = phydev->priv; @@ -100,8 +100,8 @@ Signed-off-by: Gabor Juhos + pdata = dev_get_platdata(&phydev->mdio.dev); /* - * Conduct a hardware reset for AT8030 every time a link loss is -@@ -361,6 +399,24 @@ static void at803x_link_change_notify(st + * Conduct a hardware reset for AT8030/2 every time a link loss is +@@ -363,6 +401,24 @@ static void at803x_link_change_notify(st } else { priv->phy_reset = false; } diff --git a/target/linux/generic/pending-4.9/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-4.9/735-net-phy-at803x-fix-at8033-sgmii-mode.patch index 1f689850b..381b2d09f 100644 --- a/target/linux/generic/pending-4.9/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ b/target/linux/generic/pending-4.9/735-net-phy-at803x-fix-at8033-sgmii-mode.patch @@ -13,18 +13,15 @@ Signed-off-by: Roman Yeryomin --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -55,6 +55,10 @@ - #define AT803X_DEBUG_ADDR 0x1D - #define AT803X_DEBUG_DATA 0x1E - -+#define AT803X_REG_CHIP_CONFIG 0x1f -+#define AT803X_BT_BX_REG_SEL 0x8000 +@@ -46,6 +46,7 @@ + #define AT803X_FUNC_DATA 0x4003 + #define AT803X_REG_CHIP_CONFIG 0x1f + #define AT803X_BT_BX_REG_SEL 0x8000 +#define AT803X_SGMII_ANEG_EN 0x1000 -+ - #define AT803X_MODE_CFG_MASK 0x0F - #define AT803X_MODE_CFG_SGMII 0x01 -@@ -293,6 +297,27 @@ static int at803x_config_init(struct phy + #define AT803X_PCS_SMART_EEE_CTRL3 0x805D + #define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 +@@ -295,6 +296,27 @@ static int at803x_config_init(struct phy { struct at803x_platform_data *pdata; int ret; diff --git a/target/linux/generic/pending-4.9/834-ledtrig-libata.patch b/target/linux/generic/pending-4.9/834-ledtrig-libata.patch index 78255a955..b2c0b4898 100644 --- a/target/linux/generic/pending-4.9/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-4.9/834-ledtrig-libata.patch @@ -134,7 +134,7 @@ Signed-off-by: Daniel Golle /* * Define if arch has non-standard setup. This is a _PCI_ standard -@@ -883,6 +886,12 @@ struct ata_port { +@@ -884,6 +887,12 @@ struct ata_port { #ifdef CONFIG_ATA_ACPI struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ #endif diff --git a/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch b/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch index 6cb745ee3..ff0824d34 100644 --- a/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch +++ b/target/linux/generic/pending-4.9/890-uart_optional_sysrq.patch @@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h -@@ -455,7 +455,7 @@ extern void uart_handle_cts_change(struc +@@ -456,7 +456,7 @@ extern void uart_handle_cts_change(struc extern void uart_insert_char(struct uart_port *port, unsigned int status, unsigned int overrun, unsigned int ch, unsigned int flag); diff --git a/target/linux/imx6/config-4.14 b/target/linux/imx6/config-4.14 index fc32dbf7b..ea72d18f9 100644 --- a/target/linux/imx6/config-4.14 +++ b/target/linux/imx6/config-4.14 @@ -30,7 +30,6 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARM=y @@ -167,16 +166,12 @@ CONFIG_DECOMPRESS_LZO=y CONFIG_DECOMPRESS_XZ=y CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y -# CONFIG_DMA_NOOP_OPS is not set CONFIG_DMA_OF=y -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y CONFIG_E1000E=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_ENCRYPTED_KEYS=y -CONFIG_EXPORTFS=y CONFIG_EXT4_ENCRYPTION=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_ENCRYPTION=y @@ -191,7 +186,6 @@ CONFIG_FSL_GUTS=y CONFIG_FS_ENCRYPTION=y CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y @@ -475,7 +469,6 @@ CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_GOV_STEP_WISE=y CONFIG_THERMAL_OF=y -CONFIG_THIN_ARCHIVES=y # CONFIG_THUMB2_KERNEL is not set CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y diff --git a/target/linux/ipq40xx/Makefile b/target/linux/ipq40xx/Makefile index ff8eaf3bf..ef7c0f56c 100644 --- a/target/linux/ipq40xx/Makefile +++ b/target/linux/ipq40xx/Makefile @@ -15,8 +15,8 @@ KERNELNAME:=zImage Image dtbs include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ kmod-leds-gpio kmod-gpio-button-hotplug swconfig \ - kmod-ath10k wpad \ + kmod-ath10k wpad-mini \ kmod-usb3 kmod-usb-dwc3-of-simple kmod-usb-phy-qcom-dwc3 \ - ath10k-firmware-qca4019 autosamba + ath10k-firmware-qca4019 $(eval $(call BuildTarget)) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds index 81bed9244..fcba2aea5 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds +++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds @@ -15,22 +15,12 @@ asus,rt-ac58u) ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:blue:wlan2G" "phy0tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:blue:wlan5G" "phy1tpt" ucidef_set_led_usbport "usb" "USB" "${boardname}:blue:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1" - ucidef_set_led_switch "wan" "WAN" "${boardname}:blue:wan" "switch0" "0x20" + ucidef_set_led_netdev "wan" "WAN" "${boardname}:blue:wan" "eth1" ucidef_set_led_switch "lan" "LAN" "${boardname}:blue:lan" "switch0" "0x1e" ;; -asus,rt-acrh17) - ucidef_set_led_default "status" "STATUS" "${boardname}:blue:status" "1" - ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:blue:wlan2g" "phy1tpt" - ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:blue:wlan5g" "phy0tpt" - ucidef_set_led_switch "wan" "WAN(blue)" "${boardname}:blue:wan" "switch0" "0x20" - ucidef_set_led_switch "lan1" "LAN1" "${boardname}:blue:lan1" "switch0" "0x02" - ucidef_set_led_switch "lan2" "LAN2" "${boardname}:blue:lan2" "switch0" "0x04" - ucidef_set_led_switch "lan3" "LAN3" "${boardname}:blue:lan3" "switch0" "0x08" - ucidef_set_led_switch "lan4" "LAN4" "${boardname}:blue:lan4" "switch0" "0x10" - ;; avm,fritzbox-4040) ucidef_set_led_wlan "wlan" "WLAN" "fritz4040:green:wlan" "phy0tpt" "phy1tpt" - ucidef_set_led_switch "wan" "WAN" "fritz4040:green:wan" "switch0" "0x20" + ucidef_set_led_netdev "wan" "WAN" "fritz4040:green:wan" "eth1" ucidef_set_led_switch "lan" "LAN" "fritz4040:green:lan" "switch0" "0x1e" ;; glinet,gl-b1300) @@ -44,6 +34,10 @@ netgear,ex6150v2) meraki,mr33) ucidef_set_interface_lan "eth0" ;; +zyxel,wre6606) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy0tpt" + ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" "phy1tpt" + ;; *) ;; esac diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index a2146c956..03e0c0e16 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -12,45 +12,40 @@ board_config_update board=$(board_name) case "$board" in +8dev,jalapeno) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ;; asus,rt-ac58u) CI_UBIPART=UBI_DEV wan_mac_addr=$(mtd_get_mac_binary_ubi Factory 20486) lan_mac_addr=$(mtd_get_mac_binary_ubi Factory 4102) + ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ - "0t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" - ucidef_set_interface_macaddr "lan" "$lan_mac_addr" - ucidef_set_interface_macaddr "wan" "$wan_mac_addr" - ;; -asus,rt-acrh17) - CI_UBIPART=UBI_DEV - lan_mac_addr=$(mtd_get_mac_binary_ubi Factory 4102) - wan_mac_addr=$(mtd_get_mac_binary_ubi Factory 36870) - ucidef_add_switch "switch0" \ - "0t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" ucidef_set_interface_macaddr "lan" "$lan_mac_addr" ucidef_set_interface_macaddr "wan" "$wan_mac_addr" ;; avm,fritzbox-4040) + ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ - "0t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" ;; compex,wpj428) - ucidef_add_switch "switch0" \ - "0t@eth0" "4:wan" "5:lan" + ucidef_set_interface_lan "eth0 eth1" ;; glinet,gl-b1300) + ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ - "0t@eth0" "3:lan" "4:lan" "5:wan" + "0u@eth0" "3:lan" "4:lan" ;; -8dev,jalapeno |\ openmesh,a42 |\ openmesh,a62) - ucidef_add_switch "switch0" \ - "0t@eth0" "4:lan" "5:wan" + ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; meraki,mr33 |\ netgear,ex6100v2 |\ -netgear,ex6150v2) +netgear,ex6150v2 |\ +zyxel,wre6606) ucidef_set_interface_lan "eth0" ;; *) diff --git a/target/linux/ipq40xx/base-files/etc/diag.sh b/target/linux/ipq40xx/base-files/etc/diag.sh index 4cfe6325f..a3a704770 100755 --- a/target/linux/ipq40xx/base-files/etc/diag.sh +++ b/target/linux/ipq40xx/base-files/etc/diag.sh @@ -7,6 +7,10 @@ failsafe="$(get_dt_led failsafe)" running="$(get_dt_led running)" upgrade="$(get_dt_led upgrade)" +get_status_led() { + status_led="$boot" +} + set_state() { status_led="$boot" diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index df84a275d..d89ddf6e5 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -112,10 +112,6 @@ case "$FIRMWARE" in ;; "ath10k/pre-cal-pci-0000:01:00.0.bin") case "$board" in - asus,rt-acrh17) - CI_UBIPART=UBI_DEV - ath10kcal_ubi_extract "Factory" 36864 12064 - ;; openmesh,a62) ath10kcal_extract "0:ART" 36864 12064 ;; @@ -128,7 +124,6 @@ case "$FIRMWARE" in qcom,ap-dk01.1-c1) ath10kcal_extract "ART" 4096 12064 ;; - asus,rt-acrh17|\ asus,rt-ac58u) CI_UBIPART=UBI_DEV ath10kcal_ubi_extract "Factory" 4096 12064 @@ -151,6 +146,10 @@ case "$FIRMWARE" in openmesh,a62) ath10kcal_extract "0:ART" 4096 12064 ;; + zyxel,wre6606) + ath10kcal_extract "ART" 4096 12064 + ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -2) + ;; esac ;; "ath10k/pre-cal-ahb-a800000.wifi.bin") @@ -182,6 +181,10 @@ case "$FIRMWARE" in openmesh,a62) ath10kcal_extract "0:ART" 20480 12064 ;; + zyxel,wre6606) + ath10kcal_extract "ART" 20480 12064 + ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -1) + ;; esac ;; *) diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/net/16_adjust_network b/target/linux/ipq40xx/base-files/etc/hotplug.d/net/16_adjust_network deleted file mode 100644 index 7aa4f6f72..000000000 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/net/16_adjust_network +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -[ -f /lib/adjust_network.sh ] && { - . /lib/adjust_network.sh - - adjust_eth_queue -} diff --git a/target/linux/ipq40xx/base-files/etc/init.d/adjust_network b/target/linux/ipq40xx/base-files/etc/init.d/adjust_network deleted file mode 100755 index 788b833ff..000000000 --- a/target/linux/ipq40xx/base-files/etc/init.d/adjust_network +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2006-2011 OpenWrt.org - -START=11 -STOP=98 - -adjust_smp_affinity() { - test -f /lib/adjust_network.sh && { - . /lib/adjust_network.sh - - adjust_edma_smp_affinity - adjust_radio_smp_affinity - } -} - -boot() { - adjust_smp_affinity -} diff --git a/target/linux/ipq40xx/base-files/lib/adjust_network.sh b/target/linux/ipq40xx/base-files/lib/adjust_network.sh deleted file mode 100644 index 95ffedc04..000000000 --- a/target/linux/ipq40xx/base-files/lib/adjust_network.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh -# this scripts is used for adjust cpu's choice of interrupts. -# - -################################################ -# Adjust smp_affinity of edma -# Globals: -# None -# Arguments: -# None -# Returns: -# None -# Remark: -# execute only once on start-up. -################################################ -adjust_edma_smp_affinity() { - grep -q edma_eth_ /proc/interrupts || return 0 - local nr=`cat /proc/cpuinfo | grep processor | wc -l` - local cpu=0 - local tx_irq_num - - for tx_num in `seq 0 1 15` ; do - cpu=`printf "%x" $((1<<((tx_num/4+3)%nr)))` - tx_irq_num=`grep -m1 edma_eth_tx$tx_num /proc/interrupts | cut -d ':' -f 1 | tail -n1 | tr -d ' '` - [ -n "$tx_irq_num" ] && echo $cpu > /proc/irq/$tx_irq_num/smp_affinity - done - - for rx_num in `seq 0 1 7` ; do - cpu=`printf "%x" $((1<<((rx_num/2)%nr)))` - rx_irq_num=`grep -m1 edma_eth_rx$rx_num /proc/interrupts | cut -d ':' -f 1 | tail -n1 | tr -d ' '` - [ -n "$rx_irq_num" ] && echo $cpu > /proc/irq/$rx_irq_num/smp_affinity - done -} - -################################################ -# Adjust smp_affinity of ath10k for 2G and 5G -# Globals: -# None -# Arguments: -# None -# Returns: -# None -# Remark: -# execute only once on start-up. -################################################ -adjust_radio_smp_affinity() { - local irqs="`grep -E 'ath10k' /proc/interrupts | cut -d ':' -f 1 | tr -d ' '`" - local nr=`cat /proc/cpuinfo | grep processor | wc -l` - local idx=2 - - for irq in $irqs; do - cpu=`printf "%x" $((1<<((idx)%nr)))` - echo $cpu > /proc/irq/$irq/smp_affinity - idx=$((idx+1)) - done -} - -################################################ -# Adjust queue of eth -# Globals: -# None -# Arguments: -# None -# Returns: -# None -# Remark: -# Each network reboot needs to be executed. -################################################ -adjust_eth_queue() { - local nr=`cat /proc/cpuinfo | grep processor | wc -l` - local cpu=`printf "%x" $(((1< $exps - echo 256 > `dirname $exps`/rps_flow_cnt - done - which ethtool >/dev/null 2>&1 && ethtool -K $eth gro off - done - - echo 1024 > /proc/sys/net/core/rps_sock_flow_entries -} diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh index 909bb0813..1acd7366c 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh @@ -4,12 +4,6 @@ preinit_set_mac_address() { case $(board_name) in - asus,rt-acrh17|\ - asus,rt-ac58u) - CI_UBIPART=UBI_DEV - mac=$(mtd_get_mac_binary_ubi Factory 4102) - ifconfig eth0 hw ether $mac 2>/dev/null - ;; meraki,mr33) mac_lan=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) [ -n "$mac_lan" ] && ip link set dev eth0 address "$mac_lan" diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 7c262b830..4096e127e 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -4,141 +4,28 @@ REQUIRE_IMAGE_METADATA=1 RAMFS_COPY_BIN='fw_printenv fw_setenv' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' -ubi_kill_if_exist() { - local ubidev="$( nand_find_ubi "$CI_UBIPART" )" - local c_ubivol="$( nand_find_volume $ubidev $1 )" - umount -f /dev/$c_ubivol 2>/dev/null - [ "$c_ubivol" ] && ubirmvol /dev/$ubidev -N $1 || true - echo "Partition $1 removed." -} - -# idea from @981213 -# Tar sysupgrade for ASUS RT-AC82U/RT-AC58U -# An ubi repartition is required due to the strange partition table created by Asus. -# We create all the factory partitions to make sure that the U-boot tftp recovery still works. -# The reserved kernel partition size should be enough to put the factory image in. -asus_nand_upgrade_tar() { - local kpart_size="$1" - local tar_file="$2" - - local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') - board_dir=${board_dir%/} - - local kernel_length=`(tar xf $tar_file ${board_dir}/kernel -O | wc -c) 2> /dev/null` - local rootfs_length=`(tar xf $tar_file ${board_dir}/root -O | wc -c) 2> /dev/null` - - local mtdnum="$( find_mtd_index "$CI_UBIPART" )" - if [ ! "$mtdnum" ]; then - echo "cannot find ubi mtd partition $CI_UBIPART" - return 1 - fi - - local ubidev="$( nand_find_ubi "$CI_UBIPART" )" - if [ ! "$ubidev" ]; then - ubiattach -m "$mtdnum" - sync - ubidev="$( nand_find_ubi "$CI_UBIPART" )" - fi - - if [ ! "$ubidev" ]; then - echo "cannot find ubi device $CI_UBIPART" - return 1 - fi - - local root_ubivol="$( nand_find_volume $ubidev rootfs )" - # remove ubiblock device of rootfs - local root_ubiblk="ubiblock${root_ubivol:3}" - if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then - echo "removing $root_ubiblk" - if ! ubiblock -r /dev/$root_ubivol; then - echo "cannot remove $root_ubiblk" - return 1; - fi - fi - - ubi_kill_if_exist rootfs_data - ubi_kill_if_exist rootfs - ubi_kill_if_exist jffs2 - ubi_kill_if_exist linux2 - ubi_kill_if_exist linux - - ubimkvol /dev/$ubidev -N linux -s $kpart_size - ubimkvol /dev/$ubidev -N linux2 -s $kpart_size - ubimkvol /dev/$ubidev -N jffs2 -s 2539520 - ubimkvol /dev/$ubidev -N rootfs -s $rootfs_length - ubimkvol /dev/$ubidev -N rootfs_data -m - - local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)" - echo "Kernel at $kern_ubivol.Writing..." - tar xf $tar_file ${board_dir}/kernel -O | \ - ubiupdatevol /dev/$kern_ubivol -s $kernel_length - - echo "Done." - - local root_ubivol="$(nand_find_volume $ubidev rootfs)" - echo "Rootfs at $root_ubivol.Writing..." - tar xf $tar_file ${board_dir}/root -O | \ - ubiupdatevol /dev/$root_ubivol -s $rootfs_length - - echo "Done." - - nand_do_upgrade_success -} - -# idea from @981213 -# Factory image sysupgrade for ASUS RT-AC82U/RT-AC58U -# Delete all the partitions we created before, create "linux" partition and write factory image in. -# Skip the first 64bytes which is an uImage header to verify the firmware. -# The kernel partition size should be the original one. -asus_nand_upgrade_factory() { - local kpart_size="$1" - local fw_file="$2" - - local mtdnum="$( find_mtd_index "$CI_UBIPART" )" - if [ ! "$mtdnum" ]; then - echo "cannot find ubi mtd partition $CI_UBIPART" - return 1 - fi - - local ubidev="$( nand_find_ubi "$CI_UBIPART" )" - if [ ! "$ubidev" ]; then - ubiattach -m "$mtdnum" - sync - ubidev="$( nand_find_ubi "$CI_UBIPART" )" - fi - - if [ ! "$ubidev" ]; then - echo "cannot find ubi device $CI_UBIPART" - return 1 - fi - - local root_ubivol="$( nand_find_volume $ubidev rootfs )" - # remove ubiblock device of rootfs - local root_ubiblk="ubiblock${root_ubivol:3}" - if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then - echo "removing $root_ubiblk" - if ! ubiblock -r /dev/$root_ubivol; then - echo "cannot remove $root_ubiblk" - return 1; - fi - fi - - ubi_kill_if_exist rootfs_data - ubi_kill_if_exist rootfs - ubi_kill_if_exist jffs2 - ubi_kill_if_exist linux2 - ubi_kill_if_exist linux - - ubimkvol /dev/$ubidev -N linux -s $kpart_size - - local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)" - echo "Asus linux at $kern_ubivol.Writing..." - ubiupdatevol /dev/$kern_ubivol --skip=64 $fw_file - echo "Done." - - umount -a - reboot -f -} - platform_check_image() { + case "$(board_name)" in + asus,rt-ac58u) + CI_UBIPART="UBI_DEV" + local ubidev=$(nand_find_ubi $CI_UBIPART) + local asus_root=$(nand_find_volume $ubidev jffs2) + + [ -n "$asus_root" ] || return 0 + + cat << EOF +jffs2 partition is still present. +There's probably no space left +to install the filesystem. + +You need to delete the jffs2 partition first: +# ubirmvol /dev/ubi0 --name=jffs2 + +Once this is done. Retry. +EOF + return 1 + ;; + esac return 0; } @@ -147,17 +34,10 @@ platform_do_upgrade() { 8dev,jalapeno) nand_do_upgrade "$ARGV" ;; - asus,rt-acrh17|\ asus,rt-ac58u) - local magic=$(get_magic_long "$1") CI_UBIPART="UBI_DEV" CI_KERNPART="linux" - if [ "$magic" == "27051956" ]; then - echo "Got Asus factory image." - asus_nand_upgrade_factory 50409472 "$1" - else - asus_nand_upgrade_tar 20951040 "$1" - fi + nand_do_upgrade "$1" ;; openmesh,a42 |\ openmesh,a62) @@ -176,6 +56,10 @@ platform_do_upgrade() { platform_nand_pre_upgrade() { case "$(board_name)" in + asus,rt-ac58u) + CI_UBIPART="UBI_DEV" + CI_KERNPART="linux" + ;; meraki,mr33) CI_KERNPART="part.safe" ;; diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts index 4a7fe865f..20330afc6 100644 --- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts +++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts @@ -186,7 +186,19 @@ }; &gmac0 { - vlan_tag = <1 0x31>; + qcom,phy_mdio_addr = <4>; + qcom,poll_required = <1>; + qcom,forced_speed = <1000>; + qcom,forced_duplex = <1>; + vlan_tag = <2 0x20>; +}; + +&gmac1 { + qcom,phy_mdio_addr = <3>; + qcom,poll_required = <1>; + qcom,forced_speed = <1000>; + qcom,forced_duplex = <1>; + vlan_tag = <1 0x10>; }; &usb2_hs_phy { diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-jalapeno.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-jalapeno.dts index e12a857f9..ee203b0f1 100644 --- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-jalapeno.dts +++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-jalapeno.dts @@ -231,7 +231,17 @@ }; &gmac0 { - vlan_tag = <1 0x31>; + qcom,poll_required = <1>; + qcom,poll_required_dynamic = <1>; + qcom,phy_mdio_addr = <3>; + vlan_tag = <1 0x10>; +}; + +&gmac1 { + qcom,poll_required = <1>; + qcom,poll_required_dynamic = <1>; + qcom,phy_mdio_addr = <4>; + vlan_tag = <2 0x20>; }; &wifi0 { diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts new file mode 100644 index 000000000..89315365e --- /dev/null +++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-wre6606.dts @@ -0,0 +1,261 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2018, David Bauer + * + * 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 "qcom-ipq4019.dtsi" +#include "qcom-ipq4019-bus.dtsi" +#include +#include +#include + +/ { + model = "ZyXEL WRE6606"; + compatible = "zyxel,wre6606", "qcom,ipq4019"; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; + }; + + chosen { + bootargs-append = " mtdparts="; + }; + + soc { + mdio@90000 { + status = "okay"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + serial@78af000 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "okay"; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + qcom,num_gmac = <1>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wps { + label = "wre6606:green:wps"; + gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; + }; + + wlan5g_green { + label = "wre6606:green:wlan5g"; + gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; + }; + + power: power { + label = "wre6606:green:power"; + gpios = <&tlmm 4 GPIO_ACTIVE_HIGH>; + }; + + wlan5g_red { + label = "wre6606:red:wlan5g"; + gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; + }; + + wlan2g_red { + label = "wre6606:red:wlan2g"; + gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>; + }; + + wlan2g_green { + label = "wre6606:green:wlan2g"; + gpios = <&tlmm 59 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio60", "gpio61"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pin { + function = "blsp_spi0"; + pins = "gpio55", "gpio56", "gpio57"; + drive-strength = <12>; + bias-disable; + }; + pin_cs { + function = "gpio"; + pins = "gpio54"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&spi_0 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; + + mx25l12805d@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition0@0 { + label = "SBL1"; + reg = <0x00000000 0x00040000>; + read-only; + }; + + partition1@40000 { + label = "MIBIB"; + reg = <0x00040000 0x00020000>; + read-only; + }; + + partition2@60000 { + label = "QSEE"; + reg = <0x00060000 0x00060000>; + read-only; + }; + + partition3@c0000 { + label = "CDT"; + reg = <0x000c0000 0x00010000>; + read-only; + }; + + partition4@d0000 { + label = "DDRPARAMS"; + reg = <0x000d0000 0x00010000>; + read-only; + }; + + partition5@E0000 { + label = "APPSBLENV"; + reg = <0x000e0000 0x00010000>; + read-only; + }; + + partition6@F0000 { + label = "APPSBL"; + reg = <0x000f0000 0x00080000>; + read-only; + }; + + partition7@170000 { + label = "ART"; + reg = <0x00170000 0x00010000>; + read-only; + }; + + partition8@180000 { + label = "firmware"; + reg = <0x00180000 0x00ce0000>; + }; + + partition9@e60000 { + label = "manufacture"; + reg = <0x00e60000 0x00050000>; + read-only; + }; + + partition10@eb0000 { + label = "storage"; + reg = <0x00eb0000 0x00150000>; + read-only; + }; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "ZyXEL-WRE6606"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "ZyXEL-WRE6606"; +}; diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-rt-acrh17.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-rt-acrh17.dts deleted file mode 100644 index a6c7fd52a..000000000 --- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-rt-acrh17.dts +++ /dev/null @@ -1,234 +0,0 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * 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 "qcom-ipq4019-ap.dk04.1.dtsi" -#include "qcom-ipq4019-bus.dtsi" -#include -#include -#include - -/ { - model = "ASUS RT-ACRH17"; - compatible = "asus,rt-acrh17", "qcom,ipq4019"; - - memory { - device_type = "memory"; - reg = <0x80000000 0x10000000>; - }; - - aliases { - led-boot = &power; - led-failsafe = &power; - led-running = &power; - led-upgrade = &power; - }; - - soc { - spi_0: spi@78b5000 { - status = "disabled"; - }; - - tcsr@194b000 { - /* select hostmode */ - compatible = "qcom,tcsr"; - reg = <0x194b000 0x100>; - qcom,usb-hsphy-mode-select = ; - status = "ok"; - }; - - ess_tcsr@1953000 { - compatible = "qcom,tcsr"; - reg = <0x1953000 0x1000>; - qcom,ess-interface-select = ; - }; - - tcsr@1949000 { - compatible = "qcom,tcsr"; - reg = <0x1949000 0x100>; - qcom,wifi_glb_cfg = ; - }; - - tcsr@1957000 { - compatible = "qcom,tcsr"; - reg = <0x1957000 0x100>; - qcom,wifi_noc_memtype_m0_m2 = ; - }; - - mdio@90000 { - status = "okay"; - }; - - ess-switch@c000000 { - status = "okay"; - }; - - ess-psgmii@98000 { - status = "okay"; - }; - - edma@c080000 { - status = "okay"; - }; - - wifi0: wifi@a000000 { - status = "ok"; - core-id = <0x0>; - qca,msi_addr = <0x0b006040>; - qca,msi_base = <0x40>; - wifi_led_num = <2>; /* Wifi 2G */ - wifi_led_source = <0>; /* source id 0 */ - qcom,mtd-name = "0:ART"; - qcom,cal-offset = <0x1000>; - qcom,cal-len = <12064>; - qcom,ath10k-calibration-variant = "RT-ACRH17"; - }; - - wifi1: wifi@a800000 { - status = "disabled"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&tlmm 11 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - power: status { - label = "rt-acrh17:blue:status"; - gpios = <&tlmm 40 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "rt-acrh17:blue:lan1"; - gpios = <&tlmm 45 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "rt-acrh17:blue:lan2"; - gpios = <&tlmm 43 GPIO_ACTIVE_LOW>; - }; - - lan3 { - label = "rt-acrh17:blue:lan3"; - gpios = <&tlmm 42 GPIO_ACTIVE_LOW>; - }; - - lan4 { - label = "rt-acrh17:blue:lan4"; - gpios = <&tlmm 49 GPIO_ACTIVE_LOW>; - }; - - wan_blue { - label = "rt-acrh17:blue:wan"; - gpios = <&tlmm 61 GPIO_ACTIVE_HIGH>; - }; - - wan_red { - label = "rt-acrh17:red:wan"; - gpios = <&tlmm 68 GPIO_ACTIVE_HIGH>; - }; - - wlan2g { - label = "rt-acrh17:blue:wlan2g"; - gpios = <&tlmm 52 GPIO_ACTIVE_LOW>; - }; - - wlan5g { - label = "rt-acrh17:blue:wlan5g"; - gpios = <&tlmm 54 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&nand { - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - status = "okay"; - - nand@0 { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "Bootloader"; - reg = <0x000000000000 0x000000400000>; - read-only; - }; - partition@1 { - label = "UBI_DEV"; - reg = <0x000000400000 0x000007C00000>; - }; - }; - }; -}; - -&pcie0 { - status = "okay"; - perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>; - wake-gpio = <&tlmm 50 GPIO_ACTIVE_LOW>; - clkreq-gpio = <&tlmm 39 GPIO_ACTIVE_LOW>; -}; - -&qpic_bam { - status = "okay"; -}; - -&nand_pins { - pullups { - pins = "gpio53", "gpio58", - "gpio59"; - function = "qpic"; - bias-pull-up; - }; - - pulldowns { - pins = "gpio55", "gpio56", - "gpio57", "gpio60", - "gpio62", "gpio63", "gpio64", - "gpio65", "gpio66", "gpio67", - "gpio69"; - function = "qpic"; - bias-pull-down; - }; -}; - -&i2c_0_pins { - pinmux { - function = "blsp_i2c0"; - pins = "gpio10"; - }; - pinconf { - pins = "gpio10"; - drive-strength = <16>; - bias-disable; - }; -}; diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts index a99a3d1e8..f9f0f96ae 100644 --- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts +++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4028-wpj428.dts @@ -234,7 +234,19 @@ }; &gmac0 { - vlan_tag = <1 0x31>; + qcom,phy_mdio_addr = <4>; + qcom,poll_required = <1>; + qcom,forced_speed = <1000>; + qcom,forced_duplex = <1>; + vlan_tag = <2 0x20>; +}; + +&gmac1 { + qcom,phy_mdio_addr = <3>; + qcom,poll_required = <1>; + qcom,forced_speed = <1000>; + qcom,forced_duplex = <1>; + vlan_tag = <1 0x10>; }; &usb3_ss_phy { diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts index 8fa787cb4..d7cc5580b 100644 --- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts +++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4029-gl-b1300.dts @@ -248,10 +248,6 @@ }; }; -&gmac0 { - vlan_tag = <1 0x39>; -}; - &usb2_hs_phy { status = "okay"; }; diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile index f8080fffd..38600cf97 100644 --- a/target/linux/ipq40xx/image/Makefile +++ b/target/linux/ipq40xx/image/Makefile @@ -69,30 +69,11 @@ define Device/asus_rt-ac58u # to add a version... or we are very careful not to add '\0' into that # string and call it a day.... Yeah, we do the latter! UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC58U') - KERNEL_INITRAMFS := $$(KERNEL) | uImage none - KERNEL_INITRAMFS_SUFFIX := -factory.trx IMAGES := sysupgrade.bin DEVICE_PACKAGES := kmod-usb-ledtrig-usbport endef TARGET_DEVICES += asus_rt-ac58u -define Device/asus_rt-acrh17 - $(call Device/FitImageLzma) - DEVICE_DTS := qcom-ipq4019-rt-acrh17 - BLOCKSIZE := 128k - PAGESIZE := 2048 - DTB_SIZE := 65536 - DEVICE_TITLE := Asus RT-ACRH17 - IMAGE_SIZE := 20439364 - FILESYSTEMS := squashfs - UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC82U') - KERNEL_INITRAMFS := $$(KERNEL) | uImage none - KERNEL_INITRAMFS_SUFFIX := -factory.trx - IMAGES := sysupgrade.bin - DEVICE_PACKAGES := ipq-wifi-rt-acrh17 ath10k-firmware-qca9984 -endef -TARGET_DEVICES += asus_rt-acrh17 - define Device/avm_fritzbox-4040 $(call Device/FitImageLzma) DEVICE_DTS := qcom-ipq4018-fritz4040 @@ -224,4 +205,15 @@ define Device/qcom_ap-dk04.1-c1 endef TARGET_DEVICES += qcom_ap-dk04.1-c1 +define Device/zyxel_wre6606 + $(call Device/FitImage) + DEVICE_TITLE := ZyXEL WRE6606 + DEVICE_DTS_CONFIG := config@4 + DEVICE_DTS := qcom-ipq4018-wre6606 + DEVICE_PACKAGES := ipq-wifi-zyxel_wre6606 + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata +endef +TARGET_DEVICES += zyxel_wre6606 + $(eval $(call BuildImage)) diff --git a/target/linux/ipq40xx/patches-4.14/040-dmaengine-qcom-bam-Process-multiple-pending-descript.patch b/target/linux/ipq40xx/patches-4.14/040-dmaengine-qcom-bam-Process-multiple-pending-descript.patch index dca516e87..881d08c7e 100644 --- a/target/linux/ipq40xx/patches-4.14/040-dmaengine-qcom-bam-Process-multiple-pending-descript.patch +++ b/target/linux/ipq40xx/patches-4.14/040-dmaengine-qcom-bam-Process-multiple-pending-descript.patch @@ -114,7 +114,7 @@ Signed-off-by: Vinod Koul struct list_head node; }; -@@ -539,7 +544,7 @@ static void bam_free_chan(struct dma_cha +@@ -540,7 +545,7 @@ static void bam_free_chan(struct dma_cha vchan_free_chan_resources(to_virt_chan(chan)); @@ -123,7 +123,7 @@ Signed-off-by: Vinod Koul dev_err(bchan->bdev->dev, "Cannot free busy channel\n"); goto err; } -@@ -632,8 +637,6 @@ static struct dma_async_tx_descriptor *b +@@ -633,8 +638,6 @@ static struct dma_async_tx_descriptor *b if (flags & DMA_PREP_INTERRUPT) async_desc->flags |= DESC_FLAG_EOT; @@ -132,7 +132,7 @@ Signed-off-by: Vinod Koul async_desc->num_desc = num_alloc; async_desc->curr_desc = async_desc->desc; -@@ -684,14 +687,16 @@ err_out: +@@ -685,14 +688,16 @@ err_out: static int bam_dma_terminate_all(struct dma_chan *chan) { struct bam_chan *bchan = to_bam_chan(chan); @@ -152,7 +152,7 @@ Signed-off-by: Vinod Koul } vchan_get_all_descriptors(&bchan->vc, &head); -@@ -763,9 +768,9 @@ static int bam_resume(struct dma_chan *c +@@ -764,9 +769,9 @@ static int bam_resume(struct dma_chan *c */ static u32 process_channel_irqs(struct bam_device *bdev) { @@ -164,7 +164,7 @@ Signed-off-by: Vinod Koul srcs = readl_relaxed(bam_addr(bdev, 0, BAM_IRQ_SRCS_EE)); -@@ -785,27 +790,40 @@ static u32 process_channel_irqs(struct b +@@ -786,27 +791,40 @@ static u32 process_channel_irqs(struct b writel_relaxed(pipe_stts, bam_addr(bdev, i, BAM_P_IRQ_CLR)); spin_lock_irqsave(&bchan->vc.lock, flags); @@ -214,7 +214,7 @@ Signed-off-by: Vinod Koul } spin_unlock_irqrestore(&bchan->vc.lock, flags); -@@ -867,6 +885,7 @@ static enum dma_status bam_tx_status(str +@@ -868,6 +886,7 @@ static enum dma_status bam_tx_status(str struct dma_tx_state *txstate) { struct bam_chan *bchan = to_bam_chan(chan); @@ -222,7 +222,7 @@ Signed-off-by: Vinod Koul struct virt_dma_desc *vd; int ret; size_t residue = 0; -@@ -882,11 +901,17 @@ static enum dma_status bam_tx_status(str +@@ -883,11 +902,17 @@ static enum dma_status bam_tx_status(str spin_lock_irqsave(&bchan->vc.lock, flags); vd = vchan_find_desc(&bchan->vc, cookie); @@ -244,7 +244,7 @@ Signed-off-by: Vinod Koul spin_unlock_irqrestore(&bchan->vc.lock, flags); -@@ -927,63 +952,86 @@ static void bam_start_dma(struct bam_cha +@@ -928,63 +953,86 @@ static void bam_start_dma(struct bam_cha { struct virt_dma_desc *vd = vchan_next_desc(&bchan->vc); struct bam_device *bdev = bchan->bdev; @@ -367,7 +367,7 @@ Signed-off-by: Vinod Koul /* ensure descriptor writes and dma start not reordered */ wmb(); -@@ -1012,7 +1060,7 @@ static void dma_tasklet(unsigned long da +@@ -1013,7 +1061,7 @@ static void dma_tasklet(unsigned long da bchan = &bdev->channels[i]; spin_lock_irqsave(&bchan->vc.lock, flags); @@ -376,7 +376,7 @@ Signed-off-by: Vinod Koul bam_start_dma(bchan); spin_unlock_irqrestore(&bchan->vc.lock, flags); } -@@ -1033,7 +1081,7 @@ static void bam_issue_pending(struct dma +@@ -1034,7 +1082,7 @@ static void bam_issue_pending(struct dma spin_lock_irqsave(&bchan->vc.lock, flags); /* if work pending and idle, start a transaction */ @@ -385,7 +385,7 @@ Signed-off-by: Vinod Koul bam_start_dma(bchan); spin_unlock_irqrestore(&bchan->vc.lock, flags); -@@ -1133,6 +1181,7 @@ static void bam_channel_init(struct bam_ +@@ -1138,6 +1186,7 @@ static void bam_channel_init(struct bam_ vchan_init(&bchan->vc, &bdev->common); bchan->vc.desc_free = bam_dma_free_desc; diff --git a/target/linux/ipq40xx/patches-4.14/050-0003-mtd-nand-qcom-support-for-command-descriptor-formati.patch b/target/linux/ipq40xx/patches-4.14/050-0003-mtd-nand-qcom-support-for-command-descriptor-formati.patch index 8dd209b91..62bac3762 100644 --- a/target/linux/ipq40xx/patches-4.14/050-0003-mtd-nand-qcom-support-for-command-descriptor-formati.patch +++ b/target/linux/ipq40xx/patches-4.14/050-0003-mtd-nand-qcom-support-for-command-descriptor-formati.patch @@ -191,7 +191,7 @@ Signed-off-by: Boris Brezillon if (r) return r; } -@@ -2722,6 +2797,7 @@ static int qcom_nandc_probe(struct platf +@@ -2725,6 +2800,7 @@ static int qcom_nandc_probe(struct platf if (IS_ERR(nandc->base)) return PTR_ERR(nandc->base); diff --git a/target/linux/ipq40xx/patches-4.14/050-0006-mtd-nand-qcom-Add-a-NULL-check-for-devm_kasprintf.patch b/target/linux/ipq40xx/patches-4.14/050-0006-mtd-nand-qcom-Add-a-NULL-check-for-devm_kasprintf.patch deleted file mode 100644 index 4ddc0148a..000000000 --- a/target/linux/ipq40xx/patches-4.14/050-0006-mtd-nand-qcom-Add-a-NULL-check-for-devm_kasprintf.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 069f05346d01e7298939f16533953cdf52370be3 Mon Sep 17 00:00:00 2001 -From: Fabio Estevam -Date: Fri, 5 Jan 2018 18:02:55 -0200 -Subject: [PATCH 6/7] mtd: nand: qcom: Add a NULL check for devm_kasprintf() - -devm_kasprintf() may fail, so we should better add a NULL check -and propagate an error on failure. - -Signed-off-by: Fabio Estevam -Signed-off-by: Boris Brezillon ---- - drivers/mtd/nand/qcom_nandc.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/mtd/nand/qcom_nandc.c -+++ b/drivers/mtd/nand/qcom_nandc.c -@@ -2639,6 +2639,9 @@ static int qcom_nand_host_init(struct qc - - nand_set_flash_node(chip, dn); - mtd->name = devm_kasprintf(dev, GFP_KERNEL, "qcom_nand.%d", host->cs); -+ if (!mtd->name) -+ return -ENOMEM; -+ - mtd->owner = THIS_MODULE; - mtd->dev.parent = dev; - diff --git a/target/linux/ipq40xx/patches-4.14/069-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-4.14/069-arm-boot-add-dts-files.patch index 1feff745e..3aa368be8 100644 --- a/target/linux/ipq40xx/patches-4.14/069-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-4.14/069-arm-boot-add-dts-files.patch @@ -20,10 +20,10 @@ Signed-off-by: John Crispin + qcom-ipq4018-fritz4040.dtb \ + qcom-ipq4018-jalapeno.dtb \ + qcom-ipq4018-rt-ac58u.dtb \ ++ qcom-ipq4018-wre6606.dtb \ qcom-ipq4019-ap.dk01.1-c1.dtb \ + qcom-ipq4019-a62.dtb \ + qcom-ipq4019-ap.dk04.1-c1.dtb \ -+ qcom-ipq4019-rt-acrh17.dtb \ + qcom-ipq4028-wpj428.dtb \ + qcom-ipq4029-gl-b1300.dtb \ + qcom-ipq4029-mr33.dtb \ diff --git a/target/linux/ipq40xx/patches-4.14/400-mtd-ubi-add-quirk-to-autoload-ubi-on-rt-ac58u.patch b/target/linux/ipq40xx/patches-4.14/400-mtd-ubi-add-quirk-to-autoload-ubi-on-rt-ac58u.patch index 8a9da2c08..4ee79515c 100644 --- a/target/linux/ipq40xx/patches-4.14/400-mtd-ubi-add-quirk-to-autoload-ubi-on-rt-ac58u.patch +++ b/target/linux/ipq40xx/patches-4.14/400-mtd-ubi-add-quirk-to-autoload-ubi-on-rt-ac58u.patch @@ -17,7 +17,7 @@ Signed-off-by: Christian Lamparter --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c -@@ -1181,6 +1181,9 @@ static void __init ubi_auto_attach(void) +@@ -1184,6 +1184,9 @@ static void __init ubi_auto_attach(void) mtd = open_mtd_device("ubi"); if (IS_ERR(mtd)) mtd = open_mtd_device("data"); diff --git a/target/linux/ipq40xx/patches-4.14/713-0001-essedma-fixup-ethernet-driver-rx-bug.patch b/target/linux/ipq40xx/patches-4.14/713-0001-essedma-fixup-ethernet-driver-rx-bug.patch deleted file mode 100644 index 75267b688..000000000 --- a/target/linux/ipq40xx/patches-4.14/713-0001-essedma-fixup-ethernet-driver-rx-bug.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 0bcfbe3c613d6ed8044404bc1cc3c29ff961d89c Mon Sep 17 00:00:00 2001 -From: Chen Minqiang -Date: Thu, 15 Mar 2018 04:59:57 +0800 -Subject: [PATCH 1/2] essedma: fixup ethernet driver rx bug - - - modify the error rx ring full conditions - - in rare cases, out of memory allocation failure causes the receive queues stop - we use the timer to re-alloc rx rings under these circumstances - -Signed-off-by: Chen Minqiang ---- - drivers/net/ethernet/qualcomm/essedma/edma.c | 51 ++++++++++++++++++++++-- - drivers/net/ethernet/qualcomm/essedma/edma.h | 3 ++ - drivers/net/ethernet/qualcomm/essedma/edma_axi.c | 8 ++++ - 3 files changed, 58 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.c b/drivers/net/ethernet/qualcomm/essedma/edma.c -index fecc0ba..3f1da93 100644 ---- a/drivers/net/ethernet/qualcomm/essedma/edma.c -+++ b/drivers/net/ethernet/qualcomm/essedma/edma.c -@@ -530,6 +530,47 @@ static int edma_rx_complete_paged(struct sk_buff *skb, u16 num_rfds, u16 length, - return sw_next_to_clean; - } - -+static int edma_rfd_desc_unused(struct edma_rfd_desc_ring *erdr) -+{ -+ if (erdr->sw_next_to_clean > erdr->sw_next_to_fill) -+ return erdr->sw_next_to_clean - erdr->sw_next_to_fill - 1; -+ return erdr->count + erdr->sw_next_to_clean - erdr->sw_next_to_fill - 1; -+} -+ -+void edma_rx_realloc(unsigned long data) -+{ -+ struct edma_per_cpu_queues_info *edma_percpu_info = (struct edma_per_cpu_queues_info *)data; -+ struct edma_common_info *edma_cinfo = edma_percpu_info->edma_cinfo; -+ s32 status = edma_percpu_info->rx_realloc_status; -+ -+ while (status) { -+ int queue_id; -+ int ret_count; -+ struct edma_rfd_desc_ring *erdr; -+ -+ queue_id = ffs(status) - 1; -+ erdr = edma_cinfo->rfd_ring[queue_id]; -+ ret_count = edma_alloc_rx_buf(edma_cinfo, erdr, edma_rfd_desc_unused(erdr), queue_id); -+ if (ret_count == 0) { -+ edma_percpu_info->rx_realloc_status &= ~(1 << queue_id); -+ } -+ status &= ~(1 << queue_id); -+ } -+ -+ if (edma_percpu_info->rx_realloc_status) { -+ mod_timer(&edma_percpu_info->rx_realloc_timer, jiffies + HZ); -+ } -+} -+ -+static inline void edma_realloc_timer_start(struct napi_struct *napi, int queue_id) -+{ -+ struct edma_per_cpu_queues_info *edma_percpu_info = container_of(napi, -+ struct edma_per_cpu_queues_info, napi); -+ -+ edma_percpu_info->rx_realloc_status |= (1 << queue_id); -+ mod_timer(&edma_percpu_info->rx_realloc_timer, jiffies + 5 * HZ); /* restart alloc in 5 secs */ -+} -+ - /* - * edma_rx_complete() - * Main api called from the poll function to process rx packets. -@@ -754,10 +795,12 @@ static void edma_rx_complete(struct edma_common_info *edma_cinfo, - erdr->sw_next_to_clean = sw_next_to_clean; - - /* Refill here in case refill threshold wasn't reached */ -- if (likely(cleaned_count)) { -- ret_count = edma_alloc_rx_buf(edma_cinfo, erdr, cleaned_count, queue_id); -- if (ret_count) -+ if (edma_rfd_desc_unused(erdr)) { -+ ret_count = edma_alloc_rx_buf(edma_cinfo, erdr, edma_rfd_desc_unused(erdr), queue_id); -+ if (ret_count) { - dev_dbg(&pdev->dev, "Not all buffers was reallocated"); -+ edma_realloc_timer_start(napi, queue_id); -+ } - edma_write_reg(EDMA_REG_RX_SW_CONS_IDX_Q(queue_id), - erdr->sw_next_to_clean); - } -@@ -1801,7 +1844,7 @@ int edma_configure(struct edma_common_info *edma_cinfo) - /* Allocate the RX buffer */ - for (i = 0, j = 0; i < edma_cinfo->num_rx_queues; i++) { - struct edma_rfd_desc_ring *ring = edma_cinfo->rfd_ring[j]; -- ret_count = edma_alloc_rx_buf(edma_cinfo, ring, ring->count, j); -+ ret_count = edma_alloc_rx_buf(edma_cinfo, ring, edma_rfd_desc_unused(ring), j); - if (ret_count) { - dev_dbg(&edma_cinfo->pdev->dev, "not all rx buffers allocated\n"); - } -diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.h b/drivers/net/ethernet/qualcomm/essedma/edma.h -index 5d6dc73..29c8379 100644 ---- a/drivers/net/ethernet/qualcomm/essedma/edma.h -+++ b/drivers/net/ethernet/qualcomm/essedma/edma.h -@@ -304,6 +304,8 @@ struct edma_per_cpu_queues_info { - u32 tx_start; /* tx queue start */ - u32 rx_start; /* rx queue start */ - struct edma_common_info *edma_cinfo; /* edma common info */ -+ u32 rx_realloc_status; -+ struct timer_list rx_realloc_timer; - }; - - /* edma specific common info */ -@@ -448,6 +450,7 @@ void edma_change_tx_coalesce(int usecs); - void edma_change_rx_coalesce(int usecs); - void edma_get_tx_rx_coalesce(u32 *reg_val); - void edma_clear_irq_status(void); -+void edma_rx_realloc(unsigned long data); - void ess_set_port_status_speed(struct edma_common_info *edma_cinfo, - struct phy_device *phydev, uint8_t port_id); - #endif /* _EDMA_H_ */ -diff --git a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c -index 81fc1e1..d9f8b52 100644 ---- a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c -+++ b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c -@@ -1131,6 +1131,11 @@ static int edma_axi_probe(struct platform_device *pdev) - edma_cinfo->edma_percpu_info[i].rx_status = 0; - edma_cinfo->edma_percpu_info[i].edma_cinfo = edma_cinfo; - -+ edma_cinfo->edma_percpu_info[i].rx_realloc_status = 0; -+ init_timer(&edma_cinfo->edma_percpu_info[i].rx_realloc_timer); -+ edma_cinfo->edma_percpu_info[i].rx_realloc_timer.function = edma_rx_realloc; -+ edma_cinfo->edma_percpu_info[i].rx_realloc_timer.data = (unsigned long)&edma_cinfo->edma_percpu_info[i]; -+ - /* Request irq per core */ - for (j = edma_cinfo->edma_percpu_info[i].tx_start; - j < tx_start[i] + 4; j++) { -@@ -1259,7 +1264,10 @@ err_configure: - err_rmap_add_fail: - edma_free_irqs(adapter[0]); - for (i = 0; i < CONFIG_NR_CPUS; i++) -+ { - napi_disable(&edma_cinfo->edma_percpu_info[i].napi); -+ del_timer_sync(&edma_cinfo->edma_percpu_info[i].rx_realloc_timer); -+ } - err_reset: - err_unregister_sysctl_tbl: - err_rmap_alloc_fail: --- -2.7.4 - diff --git a/target/linux/ipq40xx/patches-4.14/713-0002-essedma-refine-txq-to-be-adaptive-of-cpus-and-netdev.patch b/target/linux/ipq40xx/patches-4.14/713-0002-essedma-refine-txq-to-be-adaptive-of-cpus-and-netdev.patch deleted file mode 100644 index 6c6ef84ab..000000000 --- a/target/linux/ipq40xx/patches-4.14/713-0002-essedma-refine-txq-to-be-adaptive-of-cpus-and-netdev.patch +++ /dev/null @@ -1,223 +0,0 @@ -From 7be0cb35513b07bf74d93d052d57b12e2c654b43 Mon Sep 17 00:00:00 2001 -From: Chen Minqiang -Date: Thu, 15 Mar 2018 05:04:37 +0800 -Subject: [PATCH 2/2] essedma: refine txq to be adaptive of cpus and netdev - - - use 4 queue for each cpu if only 1 netdev - - use all 16 txqueue if only 1 netdev - -Signed-off-by: Chen Minqiang ---- - drivers/net/ethernet/qualcomm/essedma/edma.c | 22 +++++-------- - drivers/net/ethernet/qualcomm/essedma/edma.h | 5 +-- - drivers/net/ethernet/qualcomm/essedma/edma_axi.c | 40 ++++++++++++++---------- - 3 files changed, 35 insertions(+), 32 deletions(-) - -diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.c b/drivers/net/ethernet/qualcomm/essedma/edma.c -index 3f1da93..05f9ce9 100644 ---- a/drivers/net/ethernet/qualcomm/essedma/edma.c -+++ b/drivers/net/ethernet/qualcomm/essedma/edma.c -@@ -22,14 +22,6 @@ extern struct net_device *edma_netdev[EDMA_MAX_PORTID_SUPPORTED]; - bool edma_stp_rstp; - u16 edma_ath_eth_type; - --/* edma_skb_priority_offset() -- * get edma skb priority -- */ --static unsigned int edma_skb_priority_offset(struct sk_buff *skb) --{ -- return (skb->priority >> 2) & 1; --} -- - /* edma_alloc_tx_ring() - * Allocate Tx descriptors ring - */ -@@ -1042,13 +1034,14 @@ static inline u16 edma_tpd_available(struct edma_common_info *edma_cinfo, - /* edma_tx_queue_get() - * Get the starting number of the queue - */ --static inline int edma_tx_queue_get(struct edma_adapter *adapter, -+static inline int edma_tx_queue_get(struct edma_common_info *edma_cinfo, struct edma_adapter *adapter, - struct sk_buff *skb, int txq_id) - { - /* skb->priority is used as an index to skb priority table - * and based on packet priority, correspong queue is assigned. -+ * FIXME we just simple use jiffies for time base balance - */ -- return adapter->tx_start_offset[txq_id] + edma_skb_priority_offset(skb); -+ return adapter->tx_start_offset[txq_id] + (jiffies % edma_cinfo->num_txq_per_core_netdev); - } - - /* edma_tx_update_hw_idx() -@@ -1417,8 +1410,9 @@ netdev_tx_t edma_xmit(struct sk_buff *skb, - } - - /* this will be one of the 4 TX queues exposed to linux kernel */ -- txq_id = skb_get_queue_mapping(skb); -- queue_id = edma_tx_queue_get(adapter, skb, txq_id); -+ /* XXX what if num_online_cpus() > EDMA_CPU_CORES_SUPPORTED */ -+ txq_id = smp_processor_id() % EDMA_CPU_CORES_SUPPORTED; -+ queue_id = edma_tx_queue_get(edma_cinfo, adapter, skb, txq_id); - etdr = edma_cinfo->tpd_ring[queue_id]; - nq = netdev_get_tx_queue(net_dev, txq_id); - -@@ -1899,8 +1893,8 @@ void edma_free_irqs(struct edma_adapter *adapter) - int i, j; - int k = ((edma_cinfo->num_rx_queues == 4) ? 1 : 2); - -- for (i = 0; i < CONFIG_NR_CPUS; i++) { -- for (j = edma_cinfo->edma_percpu_info[i].tx_start; j < (edma_cinfo->edma_percpu_info[i].tx_start + 4); j++) -+ for (i = 0; i < num_online_cpus() && i < EDMA_CPU_CORES_SUPPORTED; i++) { -+ for (j = edma_cinfo->edma_percpu_info[i].tx_start; j < (edma_cinfo->edma_percpu_info[i].tx_start + edma_cinfo->num_txq_per_core); j++) - free_irq(edma_cinfo->tx_irq[j], &edma_cinfo->edma_percpu_info[i]); - - for (j = edma_cinfo->edma_percpu_info[i].rx_start; j < (edma_cinfo->edma_percpu_info[i].rx_start + k); j++) -diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.h b/drivers/net/ethernet/qualcomm/essedma/edma.h -index 29c8379..2ba43e0 100644 ---- a/drivers/net/ethernet/qualcomm/essedma/edma.h -+++ b/drivers/net/ethernet/qualcomm/essedma/edma.h -@@ -325,6 +325,7 @@ struct edma_common_info { - u32 from_cpu; /* from CPU TPD field */ - u32 num_rxq_per_core; /* Rx queues per core */ - u32 num_txq_per_core; /* Tx queues per core */ -+ u32 num_txq_per_core_netdev; /* Tx queues per core per netdev */ - u16 tx_ring_count; /* Tx ring count */ - u16 rx_ring_count; /* Rx ring*/ - u16 rx_head_buffer_len; /* rx buffer length */ -@@ -332,7 +333,7 @@ struct edma_common_info { - u32 page_mode; /* Jumbo frame supported flag */ - u32 fraglist_mode; /* fraglist supported flag */ - struct edma_hw hw; /* edma hw specific structure */ -- struct edma_per_cpu_queues_info edma_percpu_info[CONFIG_NR_CPUS]; /* per cpu information */ -+ struct edma_per_cpu_queues_info edma_percpu_info[EDMA_CPU_CORES_SUPPORTED]; /* per cpu information */ - spinlock_t stats_lock; /* protect edma stats area for updation */ - - bool is_single_phy; -@@ -401,7 +402,7 @@ struct edma_adapter { - u32 link_state; /* phy link state */ - u32 phy_mdio_addr; /* PHY device address on MII interface */ - u32 poll_required; /* check if link polling is required */ -- u32 tx_start_offset[CONFIG_NR_CPUS]; /* tx queue start */ -+ u32 tx_start_offset[EDMA_CPU_CORES_SUPPORTED]; /* tx queue start */ - u32 default_vlan_tag; /* vlan tag */ - u32 dp_bitmap; - uint8_t phy_id[MII_BUS_ID_SIZE + 3]; -diff --git a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c -index d9f8b52..5824680 100644 ---- a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c -+++ b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c -@@ -721,11 +721,7 @@ static int edma_axi_probe(struct platform_device *pdev) - int i, j, k, err = 0; - int portid_bmp; - int idx = 0, idx_mac = 0; -- -- if (CONFIG_NR_CPUS != EDMA_CPU_CORES_SUPPORTED) { -- dev_err(&pdev->dev, "Invalid CPU Cores\n"); -- return -EINVAL; -- } -+ int netdev_group = 2; - - if ((num_rxq != 4) && (num_rxq != 8)) { - dev_err(&pdev->dev, "Invalid RX queue, edma probe failed\n"); -@@ -749,7 +745,7 @@ static int edma_axi_probe(struct platform_device *pdev) - /* Initialize the netdev array before allocation - * to avoid double free - */ -- for (i = 0 ; i < edma_cinfo->num_gmac ; i++) -+ for (i = 0 ; i < EDMA_MAX_PORTID_SUPPORTED; i++) - edma_netdev[i] = NULL; - - for (i = 0 ; i < edma_cinfo->num_gmac ; i++) { -@@ -770,8 +766,11 @@ static int edma_axi_probe(struct platform_device *pdev) - - /* Fill ring details */ - edma_cinfo->num_tx_queues = EDMA_MAX_TRANSMIT_QUEUE; -- edma_cinfo->num_txq_per_core = (EDMA_MAX_TRANSMIT_QUEUE / 4); -+ edma_cinfo->num_txq_per_core = (EDMA_MAX_TRANSMIT_QUEUE / num_online_cpus()); -+ edma_cinfo->num_txq_per_core_netdev = (EDMA_MAX_TRANSMIT_QUEUE / netdev_group / num_online_cpus()); - edma_cinfo->tx_ring_count = EDMA_TX_RING_SIZE; -+ if (edma_cinfo->num_txq_per_core == 0) -+ edma_cinfo->num_txq_per_core = 1; - - /* Update num rx queues based on module parameter */ - edma_cinfo->num_rx_queues = num_rxq; -@@ -941,6 +940,13 @@ static int edma_axi_probe(struct platform_device *pdev) - idx_mac++; - } - -+ if (edma_cinfo->num_gmac == 1) { -+ netdev_group = 1; -+ edma_cinfo->num_txq_per_core_netdev = (EDMA_MAX_TRANSMIT_QUEUE / netdev_group / num_online_cpus()); -+ } -+ if (edma_cinfo->num_txq_per_core_netdev == 0) -+ edma_cinfo->num_txq_per_core_netdev = 1; -+ - /* Populate the adapter structure register the netdevice */ - for (i = 0; i < edma_cinfo->num_gmac; i++) { - int k, m; -@@ -948,17 +954,16 @@ static int edma_axi_probe(struct platform_device *pdev) - adapter[i] = netdev_priv(edma_netdev[i]); - adapter[i]->netdev = edma_netdev[i]; - adapter[i]->pdev = pdev; -- for (j = 0; j < CONFIG_NR_CPUS; j++) { -- m = i % 2; -- adapter[i]->tx_start_offset[j] = -- ((j << EDMA_TX_CPU_START_SHIFT) + (m << 1)); -+ for (j = 0; j < num_online_cpus() && j < EDMA_CPU_CORES_SUPPORTED; j++) { -+ m = i % netdev_group; -+ adapter[i]->tx_start_offset[j] = j * edma_cinfo->num_txq_per_core + m * edma_cinfo->num_txq_per_core_netdev; - /* Share the queues with available net-devices. - * For instance , with 5 net-devices - * eth0/eth2/eth4 will share q0,q1,q4,q5,q8,q9,q12,q13 - * and eth1/eth3 will get the remaining. - */ - for (k = adapter[i]->tx_start_offset[j]; k < -- (adapter[i]->tx_start_offset[j] + 2); k++) { -+ (adapter[i]->tx_start_offset[j] + edma_cinfo->num_txq_per_core_netdev); k++) { - if (edma_fill_netdev(edma_cinfo, k, i, j)) { - pr_err("Netdev overflow Error\n"); - goto err_register; -@@ -1111,9 +1116,12 @@ static int edma_axi_probe(struct platform_device *pdev) - /* populate per_core_info, do a napi_Add, request 16 TX irqs, - * 8 RX irqs, do a napi enable - */ -- for (i = 0; i < CONFIG_NR_CPUS; i++) { -+ for (i = 0; i < num_online_cpus() && i < EDMA_MAX_TRANSMIT_QUEUE; i++) { - u8 rx_start; - -+ tx_mask[i] = (0xFFFF >> (16 - edma_cinfo->num_txq_per_core)) << (i * edma_cinfo->num_txq_per_core); -+ tx_start[i] = i * edma_cinfo->num_txq_per_core; -+ - edma_cinfo->edma_percpu_info[i].napi.state = 0; - - netif_napi_add(edma_netdev[0], -@@ -1138,7 +1146,7 @@ static int edma_axi_probe(struct platform_device *pdev) - - /* Request irq per core */ - for (j = edma_cinfo->edma_percpu_info[i].tx_start; -- j < tx_start[i] + 4; j++) { -+ j < tx_start[i] + edma_cinfo->num_txq_per_core; j++) { - sprintf(&edma_tx_irq[j][0], "edma_eth_tx%d", j); - err = request_irq(edma_cinfo->tx_irq[j], - edma_interrupt, -@@ -1263,7 +1271,7 @@ err_configure: - #endif - err_rmap_add_fail: - edma_free_irqs(adapter[0]); -- for (i = 0; i < CONFIG_NR_CPUS; i++) -+ for (i = 0; i < num_online_cpus() && i < EDMA_CPU_CORES_SUPPORTED; i++) - { - napi_disable(&edma_cinfo->edma_percpu_info[i].napi); - del_timer_sync(&edma_cinfo->edma_percpu_info[i].rx_realloc_timer); -@@ -1314,7 +1322,7 @@ static int edma_axi_remove(struct platform_device *pdev) - unregister_netdev(edma_netdev[i]); - - edma_stop_rx_tx(hw); -- for (i = 0; i < CONFIG_NR_CPUS; i++) -+ for (i = 0; i < num_online_cpus() && i < EDMA_CPU_CORES_SUPPORTED; i++) - napi_disable(&edma_cinfo->edma_percpu_info[i].napi); - - edma_irq_disable(edma_cinfo); --- -2.7.4 - diff --git a/target/linux/ipq40xx/patches-4.14/901-essedma-disable-default-vlan-tagging.patch b/target/linux/ipq40xx/patches-4.14/901-essedma-disable-default-vlan-tagging.patch deleted file mode 100644 index ec339c479..000000000 --- a/target/linux/ipq40xx/patches-4.14/901-essedma-disable-default-vlan-tagging.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 42b508d91b7f51b054f383e3aa42089ccab9300d Mon Sep 17 00:00:00 2001 -From: Chen Minqiang -Date: Thu, 15 Mar 2018 05:33:46 +0800 -Subject: [PATCH] essedma: disable default vlan tagging - -The essedma driver has its own unique take on VLAN management -and its configuration. In the original SDK, each VLAN is -assigned one virtual ethernet netdev. - -However, this is non-standard. So, this patch does away -with the default_vlan_tag property the driver is using -and therefore forces the user to use the kernel's vlan -feature. - -This patch also removes the "qcom,poll_required = <1>;" from -the essedma node. - -Signed-off-by: Christian Lamparter -Signed-off-by: Chen Minqiang ---- - arch/arm/boot/dts/qcom-ipq4019.dtsi | 5 ++--- - drivers/net/ethernet/qualcomm/essedma/edma.c | 14 +++++--------- - 2 files changed, 7 insertions(+), 12 deletions(-) - -diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi b/arch/arm/boot/dts/qcom-ipq4019.dtsi -index 3c4617f..7c3af8e 100644 ---- a/arch/arm/boot/dts/qcom-ipq4019.dtsi -+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -598,8 +598,7 @@ - qcom,page-mode = <0>; - qcom,rx_head_buf_size = <1540>; - qcom,mdio_supported; -- qcom,poll_required = <1>; -- qcom,num_gmac = <2>; -+ qcom,num_gmac = <1>; - interrupts = <0 65 IRQ_TYPE_EDGE_RISING - 0 66 IRQ_TYPE_EDGE_RISING - 0 67 IRQ_TYPE_EDGE_RISING -@@ -637,7 +636,7 @@ - - gmac0: gmac0 { - local-mac-address = [00 00 00 00 00 00]; -- vlan_tag = <1 0x1f>; -+ vlan_tag = <1 0x3f>; - }; - - gmac1: gmac1 { -diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.c b/drivers/net/ethernet/qualcomm/essedma/edma.c -index 05f9ce9..a3c0d66 100644 ---- a/drivers/net/ethernet/qualcomm/essedma/edma.c -+++ b/drivers/net/ethernet/qualcomm/essedma/edma.c -@@ -750,13 +750,11 @@ static void edma_rx_complete(struct edma_common_info *edma_cinfo, - edma_receive_checksum(rd, skb); - - /* Process VLAN HW acceleration indication provided by HW */ -- if (unlikely(adapter->default_vlan_tag != rd->rrd4)) { -- vlan = rd->rrd4; -- if (likely(rd->rrd7 & EDMA_RRD_CVLAN)) -- __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan); -- else if (rd->rrd1 & EDMA_RRD_SVLAN) -- __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan); -- } -+ vlan = rd->rrd4; -+ if (likely(rd->rrd7 & EDMA_RRD_CVLAN)) -+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan); -+ else if (rd->rrd1 & EDMA_RRD_SVLAN) -+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan); - - /* Update rx statistics */ - adapter->stats.rx_packets++; -@@ -1434,8 +1432,6 @@ netdev_tx_t edma_xmit(struct sk_buff *skb, - if (!adapter->edma_cinfo->is_single_phy) { - if (unlikely(skb_vlan_tag_present(skb))) - flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_FLAG; -- else if (adapter->default_vlan_tag) -- flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_DEFAULT_FLAG; - } - - /* Check and mark checksum offload */ --- -2.7.4 - diff --git a/target/linux/ipq40xx/patches-4.14/902-essedma-alloc-skb-ip-align.patch b/target/linux/ipq40xx/patches-4.14/902-essedma-alloc-skb-ip-align.patch new file mode 100644 index 000000000..8c70fceb0 --- /dev/null +++ b/target/linux/ipq40xx/patches-4.14/902-essedma-alloc-skb-ip-align.patch @@ -0,0 +1,21 @@ +From 17681f0bb474d0d227f07369144149d1555d8bce Mon Sep 17 00:00:00 2001 +From: Chen Minqiang +Date: Sun, 17 Jun 2018 04:14:13 +0800 +Subject: [PATCH] essedma: alloc skb ip align + +Signed-off-by: Chen Minqiang +--- + drivers/net/ethernet/qualcomm/essedma/edma.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/qualcomm/essedma/edma.c ++++ b/drivers/net/ethernet/qualcomm/essedma/edma.c +@@ -201,7 +201,7 @@ static int edma_alloc_rx_buf(struct edma + skb = sw_desc->skb; + } else { + /* alloc skb */ +- skb = netdev_alloc_skb(edma_netdev[0], length); ++ skb = netdev_alloc_skb_ip_align(edma_netdev[0], length); + if (!skb) { + /* Better luck next round */ + break; diff --git a/target/linux/generic/pending-3.18/997-device_tree_cmdline.patch b/target/linux/ipq40xx/patches-4.14/997-device_tree_cmdline.patch similarity index 53% rename from target/linux/generic/pending-3.18/997-device_tree_cmdline.patch rename to target/linux/ipq40xx/patches-4.14/997-device_tree_cmdline.patch index 61fe71b78..8b5e64a2d 100644 --- a/target/linux/generic/pending-3.18/997-device_tree_cmdline.patch +++ b/target/linux/ipq40xx/patches-4.14/997-device_tree_cmdline.patch @@ -1,6 +1,6 @@ --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -909,6 +909,9 @@ int __init early_init_dt_scan_chosen(uns +@@ -1130,6 +1130,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)); @@ -10,15 +10,3 @@ /* * CONFIG_CMDLINE is meant to be a default in case nothing else ---- a/arch/mips/kernel/prom.c -+++ b/arch/mips/kernel/prom.c -@@ -49,6 +49,9 @@ void * __init early_init_dt_alloc_memory - - void __init __dt_setup_arch(void *bph) - { -+ if (boot_command_line[0] == '\0') -+ strcpy(boot_command_line, arcs_cmdline); -+ - if (!early_init_dt_scan(bph)) - return; - diff --git a/target/linux/ipq806x/Makefile b/target/linux/ipq806x/Makefile index e65c24db5..13be76e7b 100644 --- a/target/linux/ipq806x/Makefile +++ b/target/linux/ipq806x/Makefile @@ -10,7 +10,7 @@ CPU_TYPE:=cortex-a15 CPU_SUBTYPE:=neon-vfpv4 MAINTAINER:=John Crispin -KERNEL_PATCHVER:=4.9 +KERNEL_PATCHVER:=4.14 KERNELNAME:=zImage Image dtbs diff --git a/target/linux/ipq806x/base-files/etc/board.d/01_leds b/target/linux/ipq806x/base-files/etc/board.d/01_leds index a8d9573fa..fea4d7c8b 100755 --- a/target/linux/ipq806x/base-files/etc/board.d/01_leds +++ b/target/linux/ipq806x/base-files/etc/board.d/01_leds @@ -15,6 +15,11 @@ compex,wpq864) ucidef_set_led_usbport "usb" "USB" "wpq864:green:usb" "usb1-port1" "usb2-port1" ucidef_set_led_usbport "pcie-usb" "PCIe USB" "wpq864:green:usb-pcie" "usb3-port1" ;; +nec,wg2600hp) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2g" "phy1tpt" + ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:green:wlan5g" "phy0tpt" + ucidef_set_led_switch "wan" "WAN" "${boardname}:green:active" "switch0" "0x1e" + ;; netgear,d7800 |\ netgear,r7500 |\ netgear,r7500v2 |\ diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network index 9d8af4485..786c6f70e 100755 --- a/target/linux/ipq806x/base-files/etc/board.d/02_network +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network @@ -16,7 +16,6 @@ compex,wpq864 |\ netgear,d7800 |\ netgear,r7500 |\ netgear,r7500v2 |\ -netgear,r7800 |\ qcom,ipq8064-ap148 |\ tplink,vr2600v) ucidef_add_switch "switch0" \ @@ -29,15 +28,20 @@ linksys,ea8500) ucidef_set_interface_macaddr "lan" "$hw_mac_addr" ucidef_set_interface_macaddr "wan" "$hw_mac_addr" ;; +nec,wg2600hp) + ucidef_add_switch "switch0" \ + "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0" + ;; +netgear,r7800 |\ +tplink,c2600) + ucidef_add_switch "switch0" \ + "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0" + ;; qcom,ipq8064-db149) ucidef_set_interface_lan "eth1 eth2 eth3" ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0" ;; -tplink,c2600) - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0" - ;; zyxel,nbg6817) hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr) ucidef_add_switch "switch0" \ diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index ed99bd5ea..fa49c250f 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -60,6 +60,7 @@ case "$FIRMWARE" in ath10kcal_extract "radio" 4096 12064 # ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary default-mac 8) -1) ;; + nec,wg2600hp |\ tplink,vr2600v) ath10kcal_extract "ART" 4096 12064 ;; @@ -83,6 +84,7 @@ case "$FIRMWARE" in ath10kcal_extract "radio" 20480 12064 # ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary default-mac 8) -2) ;; + nec,wg2600hp |\ tplink,vr2600v) ath10kcal_extract "ART" 20480 12064 ;; diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 7e31c3856..afa425f07 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -15,6 +15,9 @@ case "$board" in linksys,ea8500) echo $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress ;; + nec,wg2600hp) + echo $(macaddr_add $(mtd_get_mac_binary PRODUCTDATA 12) $((1 - $PHYNBR)) ) > /sys${DEVPATH}/macaddress + ;; netgear,d7800 |\ netgear,r7500v2 |\ netgear,r7800) diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index 4f230eac8..b41bea1c2 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -32,6 +32,7 @@ platform_do_upgrade() { MTD_CONFIG_ARGS="-s 0x200000" default_do_upgrade "$ARGV" ;; + nec,wg2600hp |\ *) default_do_upgrade "$ARGV" ;; diff --git a/target/linux/ipq806x/config-4.14 b/target/linux/ipq806x/config-4.14 index 8d31e4f77..fda8f52d2 100644 --- a/target/linux/ipq806x/config-4.14 +++ b/target/linux/ipq806x/config-4.14 @@ -309,6 +309,7 @@ CONFIG_MTD_QCOM_SMEM_PARTS=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_FIT_FW=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y @@ -331,7 +332,7 @@ CONFIG_NO_BOOTMEM=y CONFIG_NO_HZ=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y -CONFIG_NR_CPUS=4 +CONFIG_NR_CPUS=2 CONFIG_NVMEM=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/ipq806x/config-4.9 b/target/linux/ipq806x/config-4.9 deleted file mode 100644 index 6bc3daf27..000000000 --- a/target/linux/ipq806x/config-4.9 +++ /dev/null @@ -1,492 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -# CONFIG_AMBA_PL08X is not set -CONFIG_APQ_GCC_8084=y -CONFIG_APQ_MMCC_8084=y -CONFIG_AR8216_PHY=y -CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -# CONFIG_ARCH_MDM9615 is not set -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MSM8960=y -CONFIG_ARCH_MSM8974=y -CONFIG_ARCH_MSM8X60=y -CONFIG_ARCH_MULTIPLATFORM=y -# CONFIG_ARCH_MULTI_CPU_AUTO is not set -CONFIG_ARCH_MULTI_V6_V7=y -CONFIG_ARCH_MULTI_V7=y -CONFIG_ARCH_NR_GPIO=0 -CONFIG_ARCH_QCOM=y -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARM=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_APPENDED_DTB=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_ARM_ATAG_DTB_COMPAT=y -# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set -# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE=y -CONFIG_ARM_CPUIDLE=y -CONFIG_ARM_CPU_SUSPEND=y -# CONFIG_ARM_CPU_TOPOLOGY is not set -CONFIG_ARM_GIC=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_L1_CACHE_SHIFT_6=y -# CONFIG_ARM_LPAE is not set -CONFIG_ARM_PATCH_IDIV=y -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_ARM_QCOM_CPUFREQ=y -CONFIG_ARM_QCOM_CPUIDLE=y -# CONFIG_ARM_SMMU is not set -# CONFIG_ARM_SP805_WATCHDOG is not set -CONFIG_ARM_THUMB=y -# CONFIG_ARM_THUMBEE is not set -CONFIG_ARM_UNWIND=y -CONFIG_ARM_VIRT_EXT=y -# CONFIG_BINFMT_FLAT is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_MQ_PCI=y -# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 -CONFIG_BOUNCE=y -CONFIG_BUS_TOPOLOGY_ADHOC=y -# CONFIG_CACHE_L2X0 is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_PROBE=y -CONFIG_CLKSRC_QCOM=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_QCOM=y -CONFIG_CPUFREQ_DT=y -CONFIG_CPUFREQ_DT_PLATDEV=y -CONFIG_CPU_32v6K=y -CONFIG_CPU_32v7=y -CONFIG_CPU_ABRT_EV7=y -# CONFIG_CPU_BIG_ENDIAN is not set -# CONFIG_CPU_BPREDICT_DISABLE is not set -CONFIG_CPU_CACHE_V7=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_STAT=y -CONFIG_CPU_HAS_ASID=y -# CONFIG_CPU_ICACHE_DISABLE is not set -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_PM=y -CONFIG_CPU_RMAP=y -CONFIG_CPU_THERMAL=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_V7=y -CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CTR=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_DES=y -CONFIG_CRYPTO_DEV_QCE=y -CONFIG_CRYPTO_DRBG=y -CONFIG_CRYPTO_DRBG_HMAC=y -CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_GF128MUL=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_NULL2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_SEQIV=y -CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CRYPTO_XTS=y -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_DEBUG_GPIO=y -CONFIG_DEBUG_LL=y -CONFIG_DEBUG_LL_INCLUDE="debug/msm.S" -CONFIG_DEBUG_QCOM_UARTDM=y -# CONFIG_DEBUG_UART_8250 is not set -CONFIG_DEBUG_UART_PHYS=0x16340000 -CONFIG_DEBUG_UART_VIRT=0xf6340000 -CONFIG_DEBUG_UNCOMPRESS=y -# CONFIG_DEBUG_USER is not set -CONFIG_DMADEVICES=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DTC=y -CONFIG_DT_IDLE_STATES=y -# CONFIG_DWMAC_GENERIC is not set -CONFIG_DWMAC_IPQ806X=y -CONFIG_DYNAMIC_DEBUG=y -CONFIG_EARLY_PRINTK=y -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -CONFIG_ETHERNET_PACKET_MANGLE=y -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_SYSFS=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ARM_ARCH_TIMER=y -CONFIG_HAVE_ARM_SMCCC=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_CBPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_SMP=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HIGHMEM=y -# CONFIG_HIGHPTE is not set -CONFIG_HWMON=y -CONFIG_HWSPINLOCK=y -CONFIG_HWSPINLOCK_QCOM=y -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_MSM=y -CONFIG_HZ_FIXED=0 -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_QUP=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IOMMU_HELPER=y -# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set -# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set -CONFIG_IOMMU_SUPPORT=y -# CONFIG_IPQ_GCC_4019 is not set -CONFIG_IPQ_GCC_806X=y -# CONFIG_IPQ_LCC_806X is not set -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_KPSS_XCC=y -CONFIG_KRAITCC=y -CONFIG_KRAIT_CLOCKS=y -CONFIG_KRAIT_L2_ACCESSORS=y -CONFIG_LIBFDT=y -CONFIG_LOCKUP_DETECTOR=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_BOARDINFO=y -CONFIG_MDIO_GPIO=y -# CONFIG_MDM_GCC_9615 is not set -# CONFIG_MDM_LCC_9615 is not set -# CONFIG_MFD_MAX77620 is not set -CONFIG_MFD_QCOM_RPM=y -# CONFIG_MFD_SPMI_PMIC is not set -CONFIG_MFD_SYSCON=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_MMC=y -CONFIG_MMC_ARMMMCI=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=16 -CONFIG_MMC_QCOM_DML=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_MSM=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -# CONFIG_MMC_TIFM_SD is not set -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MSM_BUS_SCALING=y -CONFIG_MSM_GCC_8660=y -# CONFIG_MSM_GCC_8916 is not set -CONFIG_MSM_GCC_8960=y -CONFIG_MSM_GCC_8974=y -# CONFIG_MSM_GCC_8996 is not set -# CONFIG_MSM_IOMMU is not set -# CONFIG_MSM_LCC_8960 is not set -CONFIG_MSM_MMCC_8960=y -CONFIG_MSM_MMCC_8974=y -# CONFIG_MSM_MMCC_8996 is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_M25P80=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_NAND_QCOM=y -# CONFIG_MTD_PHYSMAP_OF_VERSATILE is not set -CONFIG_MTD_QCOM_SMEM_PARTS=y -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_FIT_FW=y -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -CONFIG_MTD_UBI_BLOCK=y -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MULTI_IRQ_HANDLER=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEON=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_HWMON=y -CONFIG_NET_DSA_QCA8K=y -CONFIG_NET_DSA_TAG_QCA=y -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_PTP_CLASSIFY=y -CONFIG_NET_SWITCHDEV=y -CONFIG_NLS=y -CONFIG_NO_BOOTMEM=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -CONFIG_NR_CPUS=4 -CONFIG_NVMEM=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_PADATA=y -CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PCI=y -CONFIG_PCIEAER=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCIE_DW=y -CONFIG_PCIE_QCOM=y -CONFIG_PCI_DEBUG=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -# CONFIG_PHY_QCOM_APQ8064_SATA is not set -CONFIG_PHY_QCOM_IPQ806X_SATA=y -# CONFIG_PHY_QCOM_UFS is not set -CONFIG_PINCTRL=y -CONFIG_PINCTRL_APQ8064=y -# CONFIG_PINCTRL_APQ8084 is not set -# CONFIG_PINCTRL_IPQ4019 is not set -CONFIG_PINCTRL_IPQ8064=y -# CONFIG_PINCTRL_MDM9615 is not set -CONFIG_PINCTRL_MSM=y -# CONFIG_PINCTRL_MSM8660 is not set -# CONFIG_PINCTRL_MSM8916 is not set -# CONFIG_PINCTRL_MSM8960 is not set -# CONFIG_PINCTRL_MSM8996 is not set -CONFIG_PINCTRL_MSM8X74=y -# CONFIG_PINCTRL_QCOM_SPMI_PMIC is not set -# CONFIG_PINCTRL_QCOM_SSBI_PMIC is not set -# CONFIG_PL330_DMA is not set -CONFIG_PM_OPP=y -CONFIG_POWER_RESET=y -# CONFIG_POWER_RESET_BRCMKONA is not set -CONFIG_POWER_RESET_MSM=y -CONFIG_POWER_SUPPLY=y -CONFIG_PPS=y -CONFIG_PRINTK_TIME=y -CONFIG_PTP_1588_CLOCK=y -CONFIG_QCOM_ADM=y -CONFIG_QCOM_BAM_DMA=y -CONFIG_QCOM_CLK_RPM=y -# CONFIG_QCOM_EBI2 is not set -CONFIG_QCOM_GDSC=y -CONFIG_QCOM_GSBI=y -CONFIG_QCOM_HFPLL=y -CONFIG_QCOM_PM=y -# CONFIG_QCOM_Q6V5_PIL is not set -CONFIG_QCOM_QFPROM=y -CONFIG_QCOM_RPMCC=y -CONFIG_QCOM_SCM=y -CONFIG_QCOM_SCM_32=y -# CONFIG_QCOM_SMD is not set -CONFIG_QCOM_SMEM=y -# CONFIG_QCOM_SMP2P is not set -# CONFIG_QCOM_SMSM is not set -CONFIG_QCOM_TCSR=y -CONFIG_QCOM_TSENS=y -# CONFIG_QCOM_WCNSS_PIL is not set -CONFIG_QCOM_WDT=y -# CONFIG_QRTR is not set -CONFIG_RAS=y -CONFIG_RATIONAL=y -CONFIG_RCU_CPU_STALL_TIMEOUT=21 -CONFIG_RCU_STALL_COMMON=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_SPI=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -CONFIG_REGULATOR_QCOM_RPM=y -# CONFIG_REGULATOR_QCOM_SPMI is not set -CONFIG_RESET_CONTROLLER=y -CONFIG_RFS_ACCEL=y -# CONFIG_RPMSG_QCOM_SMD is not set -CONFIG_RPS=y -CONFIG_RTC_CLASS=y -# CONFIG_RTC_DRV_CMOS is not set -CONFIG_RTC_I2C_AND_SPI=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SCHED_INFO is not set -# CONFIG_SCSI_DMA is not set -CONFIG_SERIAL_8250_FSL=y -# CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIAL_MSM=y -CONFIG_SERIAL_MSM_CONSOLE=y -CONFIG_SMP=y -CONFIG_SMP_ON_UP=y -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -# CONFIG_SPI_CADENCE_QUADSPI is not set -CONFIG_SPI_MASTER=y -CONFIG_SPI_QUP=y -CONFIG_SPMI=y -CONFIG_SPMI_MSM_PMIC_ARB=y -CONFIG_SRCU=y -CONFIG_STMMAC_ETH=y -CONFIG_STMMAC_PLATFORM=y -CONFIG_SWCONFIG=y -CONFIG_SWCONFIG_LEDS=y -CONFIG_SWIOTLB=y -CONFIG_SWPHY=y -CONFIG_SWP_EMULATE=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_THERMAL=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -CONFIG_THERMAL_GOV_STEP_WISE=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -# CONFIG_THUMB2_KERNEL is not set -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TREE_RCU=y -CONFIG_UBIFS_FS=y -CONFIG_UBIFS_FS_ADVANCED_COMPR=y -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -CONFIG_UEVENT_HELPER_PATH="" -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_USB=y -CONFIG_USB_COMMON=y -# CONFIG_USB_EHCI_HCD is not set -CONFIG_USB_SUPPORT=y -# CONFIG_USB_UHCI_HCD is not set -CONFIG_USE_OF=y -CONFIG_VDSO=y -CONFIG_VECTORS_BASE=0xffff0000 -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_WATCHDOG_CORE=y -CONFIG_XPS=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZBOOT_ROM_BSS=0 -CONFIG_ZBOOT_ROM_TEXT=0 -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts index 514ddb501..209d513f1 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts @@ -148,6 +148,7 @@ }; sata@29000000 { + ports-implemented = <0x1>; status = "ok"; }; @@ -269,11 +270,6 @@ reg = <0x7900000 0x0700000>; read-only; }; - - firmware@1480000 { - label = "firmware"; - reg = <0x1480000 0x2000000>; - }; }; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts index 7a209ece1..9ce572bd8 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts @@ -235,11 +235,6 @@ reg = <0x3940000 0x46c0000>; read-only; }; - - firmware@1340000 { - label = "firmware"; - reg = <0x1340000 0x1a00000>; - }; }; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts index 089445fc3..30bf0abd4 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts @@ -271,11 +271,6 @@ reg = <0x7900000 0x0700000>; read-only; }; - - firmware@1480000 { - label = "firmware"; - reg = <0x1480000 0x2000000>; - }; }; }; }; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts similarity index 68% rename from target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts rename to target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts index 561c49aaa..b643014b4 100644 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts @@ -1,10 +1,10 @@ -#include "qcom-ipq8064-v1.0.dtsi" +#include "qcom-ipq8064-v2.0.dtsi" #include / { - model = "TP-Link Archer VR2600v"; - compatible = "tplink,vr2600v", "qcom,ipq8064"; + model = "NEC Aterm WG2600HP"; + compatible = "nec,wg2600hp", "qcom,ipq8064"; memory@0 { reg = <0x42000000 0x1e000000>; @@ -25,10 +25,10 @@ serial0 = &gsbi4_serial; mdio-gpio0 = &mdio0; - led-boot = &power; - led-failsafe = &general; - led-running = &power; - led-upgrade = &general; + led-boot = &power_green; + led-failsafe = &power_green; + led-running = &power_green; + led-upgrade = &power_green; }; chosen { @@ -37,10 +37,9 @@ soc { pinmux@800000 { - led_pins: led_pins { + button_pins: button_pins { mux { - pins = "gpio7", "gpio8", "gpio9", "gpio16", "gpio17", - "gpio26", "gpio53", "gpio56", "gpio66"; + pins = "gpio16", "gpio54", "gpio24", "gpio25"; function = "gpio"; drive-strength = <2>; bias-pull-up; @@ -56,12 +55,14 @@ }; }; - button_pins: button_pins { + led_pins: led_pins { mux { - pins = "gpio54", "gpio64", "gpio65", "gpio67", "gpio68"; + pins = "gpio6", "gpio7", "gpio8", "gpio9", "gpio14", + "gpio15", "gpio55", "gpio56", "gpio57", "gpio58", + "gpio64", "gpio65"; function = "gpio"; drive-strength = <2>; - bias-pull-up; + bias-pull-down; }; }; @@ -107,6 +108,16 @@ bias-disable; }; }; + + usb_pwr_en_pins: usb_pwr_en_pins { + mux { + pins = "gpio22"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + output-high; + }; + }; }; gsbi@16300000 { @@ -135,7 +146,7 @@ cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>; - flash: W25Q128@0 { + flash: m25p80@0 { compatible = "jedec,spi-nor"; #address-cells = <1>; #size-cells = <1>; @@ -198,37 +209,37 @@ APPSBLENV@2a0000 { label = "APPSBLENV"; - reg = <0x2a0000 0x40000>; + reg = <0x2a0000 0x10000>; + }; + + PRODUCTDATA: PRODUCTDATA@2b0000 { + label = "PRODUCTDATA"; + reg = <0x2b0000 0x30000>; read-only; }; - OLDART@2e0000 { - label = "OLDART"; + ART@2e0000 { + label = "ART"; reg = <0x2e0000 0x40000>; read-only; }; - kernel@320000 { - label = "kernel"; - reg = <0x320000 0x200000>; - }; - - rootfs@520000 { - label = "rootfs"; - reg = <0x520000 0xa60000>; - }; - - defaultmac: default-mac@0xfaf100 { - label = "default-mac"; - reg = <0xfaf100 0x00200>; + TP@320000 { + label = "TP"; + reg = <0x320000 0x40000>; read-only; }; - ART@fc0000 { - label = "ART"; - reg = <0xfc0000 0x40000>; + TINY@360000 { + label = "TINY"; + reg = <0x360000 0x500000>; read-only; }; + + firmware@860000 { + label = "firmware"; + reg = <0x860000 0x17a0000>; + }; }; }; }; @@ -251,6 +262,9 @@ usb30@0 { status = "ok"; + + pinctrl-0 = <&usb_pwr_en_pins>; + pinctrl-names = "default"; }; usb30@1 { @@ -259,10 +273,16 @@ pcie0: pci@1b500000 { status = "ok"; + reset-gpio = <&qcom_pinmux 3 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&pcie0_pins>; + pinctrl-names = "default"; }; pcie1: pci@1b700000 { status = "ok"; + reset-gpio = <&qcom_pinmux 48 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&pcie1_pins>; + pinctrl-names = "default"; force_gen1 = <1>; }; @@ -302,8 +322,7 @@ pinctrl-0 = <&rgmii2_pins>; pinctrl-names = "default"; - mtd-mac-address = <&defaultmac 0>; - mtd-mac-address-increment = <1>; + mtd-mac-address = <&PRODUCTDATA 6>; fixed-link { speed = <1000>; @@ -316,18 +335,13 @@ phy-mode = "sgmii"; qcom,id = <2>; - mtd-mac-address = <&defaultmac 0>; + mtd-mac-address = <&PRODUCTDATA 0>; fixed-link { speed = <1000>; full-duplex; }; }; - - rpm@108000 { - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - }; }; gpio-keys { @@ -335,34 +349,30 @@ pinctrl-0 = <&button_pins>; pinctrl-names = "default"; - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; - linux,code = ; + wps { + label = "wps"; + gpios = <&qcom_pinmux 16 GPIO_ACTIVE_LOW>; + linux,code = ; }; reset { label = "reset"; - gpios = <&qcom_pinmux 64 GPIO_ACTIVE_LOW>; + gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; linux,code = ; }; - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; + bridge { + label = "bridge"; + gpios = <&qcom_pinmux 24 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; }; - dect { - label = "dect"; - gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - ledswitch { - label = "ledswitch"; - gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>; - linux,code = ; + converter { + label = "converter"; + gpios = <&qcom_pinmux 25 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; }; }; @@ -371,50 +381,64 @@ pinctrl-0 = <&led_pins>; pinctrl-names = "default"; - dsl { - label = "vr2600v:white:dsl"; + converter_green { + label = "wg2600hp:green:converter"; + gpios = <&qcom_pinmux 6 GPIO_ACTIVE_HIGH>; + }; + + power_red { + label = "wg2600hp:red:power"; gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; }; - usb { - label = "vr2600v:white:usb"; + active_green { + label = "wg2600hp:green:active"; gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; }; - lan { - label = "vr2600v:white:lan"; + active_red { + label = "wg2600hp:red:active"; gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; }; - wlan2g { - label = "vr2600v:white:wlan2g"; - gpios = <&qcom_pinmux 16 GPIO_ACTIVE_HIGH>; + power_green: power_green { + label = "wg2600hp:green:power"; + gpios = <&qcom_pinmux 14 GPIO_ACTIVE_HIGH>; }; - wlan5g { - label = "vr2600v:white:wlan5g"; - gpios = <&qcom_pinmux 17 GPIO_ACTIVE_HIGH>; + converter_red { + label = "wg2600hp:red:converter"; + gpios = <&qcom_pinmux 15 GPIO_ACTIVE_HIGH>; }; - power: power { - label = "vr2600v:white:power"; - gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; - default-state = "keep"; + wlan2g_green { + label = "wg2600hp:green:wlan2g"; + gpios = <&qcom_pinmux 55 GPIO_ACTIVE_HIGH>; }; - phone { - label = "vr2600v:white:phone"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - }; - - wan { - label = "vr2600v:white:wan"; + wlan2g_red { + label = "wg2600hp:red:wlan2g"; gpios = <&qcom_pinmux 56 GPIO_ACTIVE_HIGH>; }; - general: general { - label = "vr2600v:white:general"; - gpios = <&qcom_pinmux 66 GPIO_ACTIVE_HIGH>; + wlan5g_green { + label = "wg2600hp:green:wlan5g"; + gpios = <&qcom_pinmux 57 GPIO_ACTIVE_HIGH>; + }; + + wlan5g_red { + label = "wg2600hp:red:wlan5g"; + gpios = <&qcom_pinmux 58 GPIO_ACTIVE_HIGH>; + }; + + tv_green { + label = "wg2600hp:green:tv"; + gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>; + }; + + tv_red { + label = "wg2600hp:red:tv"; + gpios = <&qcom_pinmux 65 GPIO_ACTIVE_HIGH>; }; }; }; diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts index fbacc039d..29b14df4d 100644 --- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts +++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts @@ -319,13 +319,7 @@ ubi@1880000 { label = "ubi"; - reg = <0x1880000 0x1C00000>; - }; - - netgear@3480000 { - label = "netgear"; - reg = <0x3480000 0x4480000>; - read-only; + reg = <0x1880000 0x6080000>; }; reserve@7900000 { @@ -333,11 +327,6 @@ reg = <0x7900000 0x0700000>; read-only; }; - - firmware@1480000 { - label = "firmware"; - reg = <0x1480000 0x2000000>; - }; }; }; }; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-ap148.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-ap148.dts deleted file mode 100644 index a3df82909..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-ap148.dts +++ /dev/null @@ -1,250 +0,0 @@ -#include "qcom-ipq8064-v1.0.dtsi" - -/ { - model = "Qualcomm IPQ8064/AP148"; - compatible = "qcom,ipq8064-ap148", "qcom,ipq8064"; - - memory@0 { - reg = <0x42000000 0x1e000000>; - device_type = "memory"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - }; - - aliases { - serial0 = &gsbi4_serial; - mdio-gpio0 = &mdio0; - }; - - chosen { - linux,stdout-path = "serial0:115200n8"; - }; - - soc { - pinmux@800000 { - i2c4_pins: i2c4_pinmux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - bias-disable; - }; - - spi_pins: spi_pins { - mux { - pins = "gpio18", "gpio19", "gpio21"; - function = "gsbi5"; - drive-strength = <10>; - bias-none; - }; - }; - nand_pins: nand_pins { - mux { - pins = "gpio34", "gpio35", "gpio36", - "gpio37", "gpio38", "gpio39", - "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - function = "nand"; - drive-strength = <10>; - bias-disable; - }; - pullups { - pins = "gpio39"; - bias-pull-up; - }; - hold { - pins = "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - bias-bus-hold; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - }; - }; - - gsbi@16300000 { - qcom,mode = ; - status = "ok"; - serial@16340000 { - status = "ok"; - }; - - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ - }; - - gsbi5: gsbi@1a200000 { - qcom,mode = ; - status = "ok"; - - spi4: spi@1a280000 { - status = "ok"; - spi-max-frequency = <50000000>; - - pinctrl-0 = <&spi_pins>; - pinctrl-names = "default"; - - cs-gpios = <&qcom_pinmux 20 0>; - - flash: m25p80@0 { - compatible = "s25fl256s1"; - #address-cells = <1>; - #size-cells = <1>; - spi-max-frequency = <50000000>; - reg = <0>; - - partitions { - compatible = "qcom,smem"; - }; - }; - }; - }; - - sata-phy@1b400000 { - status = "ok"; - }; - - sata@29000000 { - status = "ok"; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - status = "ok"; - }; - - usb30@0 { - status = "ok"; - }; - - usb30@1 { - status = "ok"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - }; - - pcie1: pci@1b700000 { - status = "ok"; - force_gen1 = <1>; - }; - - nand@1ac00000 { - status = "ok"; - - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - - cs0 { - reg = <0>; - compatible = "qcom,nandcs"; - - nand-ecc-strength = <4>; - nand-bus-width = <8>; - nand-ecc-step-size = <512>; - - partitions { - compatible = "qcom,smem"; - }; - }; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 0 &qcom_pinmux 0 0>; - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - }; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "rgmii"; - qcom,id = <1>; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - }; -}; - -&adm_dma { - status = "ok"; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-c2600.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-c2600.dts deleted file mode 100644 index a4fd13429..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-c2600.dts +++ /dev/null @@ -1,500 +0,0 @@ -#include "qcom-ipq8064-v1.0.dtsi" - -#include - -/ { - model = "TP-Link Archer C2600"; - compatible = "tplink,c2600", "qcom,ipq8064"; - - memory@0 { - reg = <0x42000000 0x1e000000>; - device_type = "memory"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - }; - - aliases { - serial0 = &gsbi4_serial; - mdio-gpio0 = &mdio0; - - led-boot = &power; - led-failsafe = &general; - led-running = &power; - led-upgrade = &general; - }; - - chosen { - linux,stdout-path = "serial0:115200n8"; - }; - - soc { - pinmux@800000 { - button_pins: button_pins { - mux { - pins = "gpio16", "gpio54", "gpio65"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - i2c4_pins: i2c4_pinmux { - mux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - drive-strength = <12>; - bias-disable; - }; - }; - - led_pins: led_pins { - mux { - pins = "gpio6", "gpio7", "gpio8", "gpio9", "gpio26", "gpio33", - "gpio53", "gpio66"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - spi_pins: spi_pins { - mux { - pins = "gpio18", "gpio19", "gpio21"; - function = "gsbi5"; - bias-pull-down; - }; - - data { - pins = "gpio18", "gpio19"; - drive-strength = <10>; - }; - - cs { - pins = "gpio20"; - function = "gpio"; - drive-strength = <10>; - bias-pull-up; - }; - - clk { - pins = "gpio21"; - drive-strength = <12>; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - }; - - usb0_pwr_en_pin: usb0_pwr_en_pin { - mux { - pins = "gpio25"; - function = "gpio"; - drive-strength = <10>; - bias-pull-up; - output-high; - }; - }; - - usb1_pwr_en_pin: usb1_pwr_en_pin { - mux { - pins = "gpio23"; - function = "gpio"; - drive-strength = <10>; - bias-pull-up; - output-high; - }; - }; - }; - - gsbi@16300000 { - qcom,mode = ; - status = "ok"; - serial@16340000 { - status = "ok"; - }; - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ - }; - - gsbi5: gsbi@1a200000 { - qcom,mode = ; - status = "ok"; - - spi5: spi@1a280000 { - status = "ok"; - - pinctrl-0 = <&spi_pins>; - pinctrl-names = "default"; - - cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>; - - flash: m25p80@0 { - compatible = "jedec,spi-nor"; - #address-cells = <1>; - #size-cells = <1>; - spi-max-frequency = <50000000>; - reg = <0>; - - SBL1@0 { - label = "SBL1"; - reg = <0x0 0x20000>; - read-only; - }; - - MIBIB@20000 { - label = "MIBIB"; - reg = <0x20000 0x20000>; - read-only; - }; - - SBL2@40000 { - label = "SBL2"; - reg = <0x40000 0x20000>; - read-only; - }; - - SBL3@60000 { - label = "SBL3"; - reg = <0x60000 0x30000>; - read-only; - }; - - DDRCONFIG@90000 { - label = "DDRCONFIG"; - reg = <0x90000 0x10000>; - read-only; - }; - - SSD@a0000 { - label = "SSD"; - reg = <0xa0000 0x10000>; - read-only; - }; - - TZ@b0000 { - label = "TZ"; - reg = <0xb0000 0x30000>; - read-only; - }; - - RPM@e0000 { - label = "RPM"; - reg = <0xe0000 0x20000>; - read-only; - }; - - fs-uboot@100000 { - label = "fs-uboot"; - reg = <0x100000 0x70000>; - read-only; - }; - - uboot-env@170000 { - label = "uboot-env"; - reg = <0x170000 0x40000>; - read-only; - }; - - radio@1b0000 { - label = "radio"; - reg = <0x1b0000 0x40000>; - read-only; - }; - - os-image@1f0000 { - label = "os-image"; - reg = <0x1f0000 0x200000>; - }; - - rootfs@3f0000 { - label = "rootfs"; - reg = <0x3f0000 0x1b00000>; - }; - - defaultmac: default-mac@1ef0000 { - label = "default-mac"; - reg = <0x1ef0000 0x00200>; - read-only; - }; - - pin@1ef0200 { - label = "pin"; - reg = <0x1ef0200 0x00200>; - read-only; - }; - - product-info@1ef0400 { - label = "product-info"; - reg = <0x1ef0400 0x0fc00>; - read-only; - }; - - partition-table@1f00000 { - label = "partition-table"; - reg = <0x1f00000 0x10000>; - read-only; - }; - - soft-version@1f10000 { - label = "soft-version"; - reg = <0x1f10000 0x10000>; - read-only; - }; - - support-list@1f20000 { - label = "support-list"; - reg = <0x1f20000 0x10000>; - read-only; - }; - - profile@1f30000 { - label = "profile"; - reg = <0x1f30000 0x10000>; - read-only; - }; - - default-config@1f40000 { - label = "default-config"; - reg = <0x1f40000 0x10000>; - read-only; - }; - - user-config@1f50000 { - label = "user-config"; - reg = <0x1f50000 0x40000>; - read-only; - }; - - qos-db@1f90000 { - label = "qos-db"; - reg = <0x1f90000 0x40000>; - read-only; - }; - - usb-config@1fd0000 { - label = "usb-config"; - reg = <0x1fd0000 0x10000>; - read-only; - }; - - log@1fe0000 { - label = "log"; - reg = <0x1fe0000 0x20000>; - read-only; - }; - }; - }; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - status = "ok"; - }; - - usb30@0 { - status = "ok"; - - pinctrl-0 = <&usb0_pwr_en_pin>; - pinctrl-names = "default"; - }; - - usb30@1 { - status = "ok"; - - pinctrl-0 = <&usb1_pwr_en_pin>; - pinctrl-names = "default"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - }; - - pcie1: pci@1b700000 { - status = "ok"; - force_gen1 = <1>; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - }; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "rgmii"; - qcom,id = <1>; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - - mtd-mac-address = <&defaultmac 0x8>; - mtd-mac-address-increment = <1>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - - mtd-mac-address = <&defaultmac 0x8>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - rpm@108000 { - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 49 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 64 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - ledswitch { - label = "ledswitch"; - gpios = <&qcom_pinmux 16 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - lan { - label = "c2600:white:lan"; - gpios = <&qcom_pinmux 6 GPIO_ACTIVE_HIGH>; - }; - - usb4 { - label = "c2600:white:usb_4"; - gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; - }; - - usb2 { - label = "c2600:white:usb_2"; - gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; - }; - - wps { - label = "c2600:white:wps"; - gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; - }; - - wan_amber { - label = "c2600:amber:wan"; - gpios = <&qcom_pinmux 26 GPIO_ACTIVE_LOW>; - }; - - wan_white { - label = "c2600:white:wan"; - gpios = <&qcom_pinmux 33 GPIO_ACTIVE_LOW>; - }; - - power: power { - label = "c2600:white:power"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - general: general { - label = "c2600:white:general"; - gpios = <&qcom_pinmux 66 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&adm_dma { - status = "ok"; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-d7800.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-d7800.dts deleted file mode 100644 index b7c49cc81..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-d7800.dts +++ /dev/null @@ -1,419 +0,0 @@ -#include "qcom-ipq8064-v1.0.dtsi" - -#include - -/ { - model = "Netgear Nighthawk X4 D7800"; - compatible = "netgear,d7800", "qcom,ipq8064"; - - memory@0 { - reg = <0x42000000 0xe000000>; - device_type = "memory"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - }; - - aliases { - serial0 = &gsbi4_serial; - mdio-gpio0 = &mdio0; - - led-boot = &power_white; - led-failsafe = &power_amber; - led-running = &power_white; - led-upgrade = &power_amber; - }; - - chosen { - bootargs = "rootfstype=squashfs noinitrd"; - linux,stdout-path = "serial0:115200n8"; - }; - - soc { - pinmux@800000 { - button_pins: button_pins { - mux { - pins = "gpio6", "gpio54", "gpio65"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - i2c4_pins: i2c4_pinmux { - mux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - drive-strength = <12>; - bias-disable; - }; - }; - - led_pins: led_pins { - mux { - pins = "gpio7", "gpio8", "gpio9", "gpio22", "gpio23", - "gpio24","gpio26", "gpio53", "gpio64"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - - nand_pins: nand_pins { - mux { - pins = "gpio34", "gpio35", "gpio36", - "gpio37", "gpio38", "gpio39", - "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - function = "nand"; - drive-strength = <10>; - bias-disable; - }; - pullups { - pins = "gpio39"; - bias-pull-up; - }; - hold { - pins = "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - bias-bus-hold; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - }; - - usb0_pwr_en_pins: usb0_pwr_en_pins { - mux { - pins = "gpio15"; - function = "gpio"; - drive-strength = <12>; - bias-pull-down; - output-high; - }; - }; - - usb1_pwr_en_pins: usb1_pwr_en_pins { - mux { - pins = "gpio16", "gpio68"; - function = "gpio"; - drive-strength = <12>; - bias-pull-down; - output-high; - }; - }; - }; - - gsbi@16300000 { - qcom,mode = ; - status = "ok"; - serial@16340000 { - status = "ok"; - }; - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ - }; - - sata-phy@1b400000 { - status = "ok"; - }; - - sata@29000000 { - status = "ok"; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - status = "ok"; - }; - - usb30@0 { - status = "ok"; - - pinctrl-0 = <&usb0_pwr_en_pins>; - pinctrl-names = "default"; - }; - - usb30@1 { - status = "ok"; - - pinctrl-0 = <&usb1_pwr_en_pins>; - pinctrl-names = "default"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - reset-gpio = <&qcom_pinmux 3 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&pcie0_pins>; - pinctrl-names = "default"; - }; - - pcie1: pci@1b700000 { - status = "ok"; - reset-gpio = <&qcom_pinmux 48 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&pcie1_pins>; - pinctrl-names = "default"; - force_gen1 = <1>; - }; - - nand@1ac00000 { - status = "ok"; - - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - - #address-cells = <1>; - #size-cells = <1>; - - cs0 { - reg = <0>; - compatible = "qcom,nandcs"; - - nand-ecc-strength = <4>; - nand-bus-width = <8>; - nand-ecc-step-size = <512>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - qcadata@0 { - label = "qcadata"; - reg = <0x0000000 0x0c80000>; - read-only; - }; - - APPSBL@c80000 { - label = "APPSBL"; - reg = <0x0c80000 0x0500000>; - read-only; - }; - - APPSBLENV@1180000 { - label = "APPSBLENV"; - reg = <0x1180000 0x0080000>; - read-only; - }; - - art: art@1200000 { - label = "art"; - reg = <0x1200000 0x0140000>; - read-only; - }; - - artbak: art@1340000 { - label = "artbak"; - reg = <0x1340000 0x0140000>; - read-only; - }; - - kernel@1480000 { - label = "kernel"; - reg = <0x1480000 0x0200000>; - }; - - ubi@1680000 { - label = "ubi"; - reg = <0x1680000 0x1E00000>; - }; - - netgear@3480000 { - label = "netgear"; - reg = <0x3480000 0x4480000>; - read-only; - }; - - reserve@7900000 { - label = "reserve"; - reg = <0x7900000 0x0700000>; - read-only; - }; - - firmware@1480000 { - label = "firmware"; - reg = <0x1480000 0x2000000>; - }; - }; - }; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - }; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "rgmii"; - phy-handle = <&phy4>; - qcom,id = <1>; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - - mtd-mac-address = <&art 6>; - }; - - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - - mtd-mac-address = <&art 0>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - rpm@108000 { - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 6 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - usb1 { - label = "d7800:white:usb1"; - gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; - }; - - usb2 { - label = "d7800:white:usb2"; - gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; - }; - - power_amber: power_amber { - label = "d7800:amber:power"; - gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; - }; - - wan_white { - label = "d7800:white:wan"; - gpios = <&qcom_pinmux 22 GPIO_ACTIVE_HIGH>; - }; - - wan_amber { - label = "d7800:amber:wan"; - gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; - }; - - wps { - label = "d7800:white:wps"; - gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; - }; - - esata { - label = "d7800:white:esata"; - gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; - }; - - power_white: power_white { - label = "d7800:white:power"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - wifi { - label = "d7800:white:wifi"; - gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&adm_dma { - status = "ok"; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-db149.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-db149.dts deleted file mode 100644 index 4c5686607..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-db149.dts +++ /dev/null @@ -1,236 +0,0 @@ -#include "qcom-ipq8064-v1.0.dtsi" - -/ { - model = "Qualcomm IPQ8064/DB149"; - compatible = "qcom,ipq8064-db149", "qcom,ipq8064"; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - }; - - alias { - serial0 = &uart2; - mdio-gpio0 = &mdio0; - }; - - chosen { - linux,stdout-path = "serial0:115200n8"; - }; - - soc { - pinmux@800000 { - i2c4_pins: i2c4_pinmux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - bias-disable; - }; - - spi_pins: spi_pins { - mux { - pins = "gpio18", "gpio19", "gpio21"; - function = "gsbi5"; - drive-strength = <10>; - bias-none; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - - rgmii0_pins: rgmii0_pins { - mux { - pins = "gpio2", "gpio66"; - drive-strength = <8>; - bias-disable; - }; - }; - }; - - gsbi2: gsbi@12480000 { - qcom,mode = ; - status = "ok"; - uart2: serial@12490000 { - status = "ok"; - }; - }; - - gsbi5: gsbi@1a200000 { - qcom,mode = ; - status = "ok"; - - spi4: spi@1a280000 { - status = "ok"; - spi-max-frequency = <50000000>; - - pinctrl-0 = <&spi_pins>; - pinctrl-names = "default"; - - cs-gpios = <&qcom_pinmux 20 0>; - - flash: m25p80@0 { - compatible = "s25fl256s1"; - #address-cells = <1>; - #size-cells = <1>; - spi-max-frequency = <50000000>; - reg = <0>; - m25p,fast-read; - - partition@0 { - label = "lowlevel_init"; - reg = <0x0 0x1b0000>; - }; - - partition@1 { - label = "u-boot"; - reg = <0x1b0000 0x80000>; - }; - - partition@2 { - label = "u-boot-env"; - reg = <0x230000 0x40000>; - }; - - partition@3 { - label = "caldata"; - reg = <0x270000 0x40000>; - }; - - partition@4 { - label = "firmware"; - reg = <0x2b0000 0x1d50000>; - }; - }; - }; - }; - - sata-phy@1b400000 { - status = "ok"; - }; - - sata@29000000 { - status = "ok"; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - status = "ok"; - }; - - usb30@0 { - status = "ok"; - }; - - usb30@1 { - status = "ok"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - }; - - pcie1: pci@1b700000 { - status = "ok"; - }; - - pcie2: pci@1b900000 { - status = "ok"; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 0 &qcom_pinmux 0 0>; - - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - }; - - phy6: ethernet-phy@6 { - device_type = "ethernet-phy"; - reg = <6>; - }; - - phy7: ethernet-phy@7 { - device_type = "ethernet-phy"; - reg = <7>; - }; - }; - - gmac0: ethernet@37000000 { - status = "ok"; - phy-mode = "rgmii"; - qcom,id = <0>; - phy-handle = <&phy4>; - - pinctrl-0 = <&rgmii0_pins>; - pinctrl-names = "default"; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <1>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - phy-handle = <&phy6>; - }; - - gmac3: ethernet@37600000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <3>; - phy-handle = <&phy7>; - }; - }; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts deleted file mode 100644 index a8628ff93..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts +++ /dev/null @@ -1,406 +0,0 @@ -#include "qcom-ipq8064-v1.0.dtsi" - -#include - -/ { - model = "Linksys EA8500 WiFi Router"; - compatible = "linksys,ea8500", "qcom,ipq8064"; - - memory@0 { - reg = <0x42000000 0x1e000000>; - device_type = "memory"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - }; - - aliases { - serial0 = &gsbi4_serial; - mdio-gpio0 = &mdio0; - - led-boot = &power; - led-failsafe = &power; - led-running = &power; - led-upgrade = &power; - }; - - chosen { - bootargs = "console=ttyMSM0,115200n8"; - linux,stdout-path = "serial0:115200n8"; - append-rootblock = "ubi.mtd="; /* append to bootargs adding the root deviceblock nbr from bootloader */ - }; - - soc { - pinmux@800000 { - button_pins: button_pins { - mux { - pins = "gpio65", "gpio67", "gpio68"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - i2c4_pins: i2c4_pinmux { - mux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - drive-strength = <12>; - bias-disable; - }; - }; - - led_pins: led_pins { - mux { - pins = "gpio6", "gpio53", "gpio54"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - - nand_pins: nand_pins { - mux { - pins = "gpio34", "gpio35", "gpio36", - "gpio37", "gpio38", "gpio39", - "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - function = "nand"; - drive-strength = <10>; - bias-disable; - }; - pullups { - pins = "gpio39"; - bias-pull-up; - }; - hold { - pins = "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - bias-bus-hold; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - }; - }; - - gsbi@16300000 { - qcom,mode = ; - status = "ok"; - serial@16340000 { - status = "ok"; - }; - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ - }; - - sata-phy@1b400000 { - status = "ok"; - }; - - sata@29000000 { - status = "ok"; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - status = "ok"; - }; - - usb30@0 { - status = "ok"; - }; - - usb30@1 { - status = "ok"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - force_gen1 = <1>; - }; - - pcie1: pci@1b700000 { - status = "ok"; - }; - - pcie2: pci@1b900000 { - status = "ok"; - }; - - nand@1ac00000 { - status = "ok"; - - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - - cs0 { - reg = <0>; - compatible = "qcom,nandcs"; - - nand-ecc-strength = <4>; - nand-bus-width = <8>; - nand-ecc-step-size = <512>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - SBL1@0 { - label = "SBL1"; - reg = <0x0000000 0x0040000>; - read-only; - }; - - MIBIB@40000 { - label = "MIBIB"; - reg = <0x0040000 0x0140000>; - read-only; - }; - - SBL2@180000 { - label = "SBL2"; - reg = <0x0180000 0x0140000>; - read-only; - }; - - SBL3@2c0000 { - label = "SBL3"; - reg = <0x02c0000 0x0280000>; - read-only; - }; - - DDRCONFIG@540000 { - label = "DDRCONFIG"; - reg = <0x0540000 0x0120000>; - read-only; - }; - - SSD@660000 { - label = "SSD"; - reg = <0x0660000 0x0120000>; - read-only; - }; - - TZ@780000 { - label = "TZ"; - reg = <0x0780000 0x0280000>; - read-only; - }; - - RPM@a00000 { - label = "RPM"; - reg = <0x0a00000 0x0280000>; - read-only; - }; - - art: art@c80000 { - label = "art"; - reg = <0x0c80000 0x0140000>; - read-only; - }; - - APPSBL@dc0000 { - label = "APPSBL"; - reg = <0x0dc0000 0x0100000>; - read-only; - }; - - u_env@ec0000 { - label = "u_env"; - reg = <0x0ec0000 0x0040000>; - }; - - s_env@f00000 { - label = "s_env"; - reg = <0x0f00000 0x0040000>; - }; - - devinfo@f40000 { - label = "devinfo"; - reg = <0x0f40000 0x0040000>; - }; - - linux@f80000 { - label = "kernel1"; - reg = <0x0f80000 0x2800000>; /* 3 MB spill to rootfs*/ - }; - - rootfs@1280000 { - label = "rootfs1"; - reg = <0x1280000 0x2500000>; - }; - - linux2@3780000 { - label = "kernel2"; - reg = <0x3780000 0x2800000>; - }; - - rootfs2@3a80000 { - label = "rootfs2"; - reg = <0x3a80000 0x2500000>; - }; - - syscfg@5f80000 { - label = "syscfg"; - reg = <0x5f80000 0x2080000>; - }; - }; - }; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - }; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "rgmii"; - qcom,id = <1>; - qcom,phy_mdio_addr = <4>; - qcom,poll_required = <1>; - qcom,rgmii_delay = <0>; - qcom,emulation = <0>; - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - //lan - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - qcom,phy_mdio_addr = <0>; /* none */ - qcom,poll_required = <0>; /* no polling */ - qcom,rgmii_delay = <0>; - qcom,emulation = <0>; - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - rpm@108000 { - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - }; - - adm_dma: dma@18300000 { - status = "ok"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 67 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - wps { - label = "ea8500:green:wps"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - }; - - power: power { - label = "ea8500:white:power"; - gpios = <&qcom_pinmux 6 GPIO_ACTIVE_LOW>; - default-state = "keep"; - }; - - wifi { - label = "ea8500:green:wifi"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_HIGH>; - }; - }; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500.dts deleted file mode 100644 index 3445a7925..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500.dts +++ /dev/null @@ -1,394 +0,0 @@ -#include "qcom-ipq8064-v1.0.dtsi" - -#include -#include - -/ { - model = "Netgear Nighthawk X4 R7500"; - compatible = "netgear,r7500", "qcom,ipq8064"; - - memory@0 { - reg = <0x42000000 0xe000000>; - device_type = "memory"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - }; - - aliases { - serial0 = &gsbi4_serial; - mdio-gpio0 = &mdio0; - - led-boot = &power_white; - led-failsafe = &power_amber; - led-running = &power_white; - led-upgrade = &power_amber; - }; - - chosen { - bootargs = "rootfstype=squashfs noinitrd"; - linux,stdout-path = "serial0:115200n8"; - }; - - soc { - pinmux@800000 { - button_pins: button_pins { - mux { - pins = "gpio6", "gpio54", "gpio65"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - i2c4_pins: i2c4_pinmux { - mux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - drive-strength = <12>; - bias-disable; - }; - }; - - led_pins: led_pins { - mux { - pins = "gpio7", "gpio8", "gpio9", "gpio22", "gpio23", - "gpio24","gpio26", "gpio53", "gpio64"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - - nand_pins: nand_pins { - mux { - pins = "gpio34", "gpio35", "gpio36", - "gpio37", "gpio38", "gpio39", - "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - function = "nand"; - drive-strength = <10>; - bias-disable; - }; - pullups { - pins = "gpio39"; - bias-pull-up; - }; - hold { - pins = "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - bias-bus-hold; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - }; - }; - - gsbi@16300000 { - qcom,mode = ; - status = "ok"; - serial@16340000 { - status = "ok"; - }; - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ - }; - - sata-phy@1b400000 { - status = "ok"; - }; - - sata@29000000 { - status = "ok"; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - clocks = <&gcc USB30_0_UTMI_CLK>; - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - clocks = <&gcc USB30_0_MASTER_CLK>; - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - clocks = <&gcc USB30_1_UTMI_CLK>; - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - clocks = <&gcc USB30_1_MASTER_CLK>; - status = "ok"; - }; - - usb30@0 { - clocks = <&gcc USB30_1_MASTER_CLK>; - status = "ok"; - }; - - usb30@1 { - clocks = <&gcc USB30_0_MASTER_CLK>; - status = "ok"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - }; - - pcie1: pci@1b700000 { - status = "ok"; - force_gen1 = <1>; - }; - - nand@1ac00000 { - status = "ok"; - - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - - cs0 { - reg = <0>; - compatible = "qcom,nandcs"; - - nand-ecc-strength = <4>; - nand-bus-width = <8>; - nand-ecc-step-size = <512>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - qcadata@0 { - label = "qcadata"; - reg = <0x0000000 0x0c80000>; - read-only; - }; - - APPSBL@c80000 { - label = "APPSBL"; - reg = <0x0c80000 0x0500000>; - read-only; - }; - - APPSBLENV@1180000 { - label = "APPSBLENV"; - reg = <0x1180000 0x0080000>; - read-only; - }; - - art: art@1200000 { - label = "art"; - reg = <0x1200000 0x0140000>; - read-only; - }; - - kernel@1340000 { - label = "kernel"; - reg = <0x1340000 0x0200000>; - }; - - ubi@1540000 { - label = "ubi"; - reg = <0x1540000 0x1800000>; - }; - - netgear@2d40000 { - label = "netgear"; - reg = <0x2d40000 0x0c00000>; - read-only; - }; - - reserve@3940000 { - label = "reserve"; - reg = <0x3940000 0x46c0000>; - read-only; - }; - - firmware@1340000 { - label = "firmware"; - reg = <0x1340000 0x1a00000>; - }; - }; - }; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - }; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "rgmii"; - qcom,id = <1>; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - - mtd-mac-address = <&art 6>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - - mtd-mac-address = <&art 0>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - rpm@108000 { - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 6 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - usb1 { - label = "r7500:white:usb1"; - gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; - }; - - usb2 { - label = "r7500:white:usb2"; - gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; - }; - - power_amber: power_amber { - label = "r7500:amber:power"; - gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; - }; - - wan_white { - label = "r7500:white:wan"; - gpios = <&qcom_pinmux 22 GPIO_ACTIVE_HIGH>; - }; - - wan_amber { - label = "r7500:amber:wan"; - gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; - }; - - wps { - label = "r7500:white:wps"; - gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; - }; - - esata { - label = "r7500:white:esata"; - gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; - }; - - power_white: power_white { - label = "r7500:white:power"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - wifi { - label = "r7500:white:wifi"; - gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&tcsr { - qcom,usb-ctrl-select = ; - compatible = "qcom,tcsr"; -}; - -&adm_dma { - status = "ok"; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts deleted file mode 100644 index c4b0c4b5a..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts +++ /dev/null @@ -1,425 +0,0 @@ -#include "qcom-ipq8064-v1.0.dtsi" - -#include - -/ { - model = "Netgear Nighthawk X4 R7500v2"; - compatible = "netgear,r7500v2", "qcom,ipq8064"; - - memory@0 { - reg = <0x42000000 0x1e000000>; - device_type = "memory"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - - rsvd@5fe00000 { - reg = <0x5fe00000 0x200000>; - reusable; - }; - }; - - aliases { - serial0 = &gsbi4_serial; - mdio-gpio0 = &mdio0; - - led-boot = &power; - led-failsafe = &power; - led-running = &power; - led-upgrade = &power; - }; - - chosen { - bootargs = "rootfstype=squashfs noinitrd"; - linux,stdout-path = "serial0:115200n8"; - }; - - soc { - pinmux@800000 { - button_pins: button_pins { - mux { - pins = "gpio6", "gpio54", "gpio65"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - i2c4_pins: i2c4_pinmux { - mux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - drive-strength = <12>; - bias-disable; - }; - }; - - led_pins: led_pins { - mux { - pins = "gpio7", "gpio8", "gpio9", "gpio22", "gpio23", - "gpio24","gpio26", "gpio53", "gpio64"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - - nand_pins: nand_pins { - mux { - pins = "gpio34", "gpio35", "gpio36", - "gpio37", "gpio38", "gpio39", - "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - function = "nand"; - drive-strength = <10>; - bias-disable; - }; - pullups { - pins = "gpio39"; - bias-pull-up; - }; - hold { - pins = "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - bias-bus-hold; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - }; - - usb0_pwr_en_pins: usb0_pwr_en_pins { - mux { - pins = "gpio15"; - function = "gpio"; - drive-strength = <12>; - bias-pull-down; - output-high; - }; - }; - - usb1_pwr_en_pins: usb1_pwr_en_pins { - mux { - pins = "gpio16", "gpio68"; - function = "gpio"; - drive-strength = <12>; - bias-pull-down; - output-high; - }; - }; - }; - - gsbi@16300000 { - qcom,mode = ; - status = "ok"; - serial@16340000 { - status = "ok"; - }; - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ - }; - - sata-phy@1b400000 { - status = "ok"; - }; - - sata@29000000 { - status = "ok"; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - status = "ok"; - }; - - usb30@0 { - status = "ok"; - - pinctrl-0 = <&usb0_pwr_en_pins>; - pinctrl-names = "default"; - }; - - usb30@1 { - status = "ok"; - - pinctrl-0 = <&usb1_pwr_en_pins>; - pinctrl-names = "default"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - reset-gpio = <&qcom_pinmux 3 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&pcie0_pins>; - pinctrl-names = "default"; - }; - - pcie1: pci@1b700000 { - status = "ok"; - reset-gpio = <&qcom_pinmux 48 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&pcie1_pins>; - pinctrl-names = "default"; - force_gen1 = <1>; - }; - - nand@1ac00000 { - status = "ok"; - - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - - cs0 { - reg = <0>; - compatible = "qcom,nandcs"; - - nand-ecc-strength = <4>; - nand-bus-width = <8>; - nand-ecc-step-size = <512>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - qcadata@0 { - label = "qcadata"; - reg = <0x0000000 0x0c80000>; - read-only; - }; - - APPSBL@c80000 { - label = "APPSBL"; - reg = <0x0c80000 0x0500000>; - read-only; - }; - - APPSBLENV@1180000 { - label = "APPSBLENV"; - reg = <0x1180000 0x0080000>; - read-only; - }; - - art: art@1200000 { - label = "art"; - reg = <0x1200000 0x0140000>; - read-only; - }; - - artbak: art@1340000 { - label = "artbak"; - reg = <0x1340000 0x0140000>; - read-only; - }; - - kernel@1480000 { - label = "kernel"; - reg = <0x1480000 0x0200000>; - }; - - ubi@1680000 { - label = "ubi"; - reg = <0x1680000 0x1E00000>; - }; - - netgear@3480000 { - label = "netgear"; - reg = <0x3480000 0x4480000>; - read-only; - }; - - reserve@7900000 { - label = "reserve"; - reg = <0x7900000 0x0700000>; - read-only; - }; - - firmware@1480000 { - label = "firmware"; - reg = <0x1480000 0x2000000>; - }; - }; - }; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0xaa545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - }; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "rgmii"; - qcom,id = <1>; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - - mtd-mac-address = <&art 6>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - - mtd-mac-address = <&art 0>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - rpm@108000 { - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 6 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - usb1 { - label = "r7500v2:amber:usb1"; - gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; - }; - - usb3 { - label = "r7500v2:amber:usb3"; - gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; - }; - - status { - label = "r7500v2:amber:status"; - gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; - }; - - internet { - label = "r7500v2:white:internet"; - gpios = <&qcom_pinmux 22 GPIO_ACTIVE_HIGH>; - }; - - wan { - label = "r7500v2:white:wan"; - gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; - }; - - wps { - label = "r7500v2:white:wps"; - gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; - }; - - esata { - label = "r7500v2:white:esata"; - gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; - }; - - power: power { - label = "r7500v2:white:power"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - wifi { - label = "r7500v2:white:wifi"; - gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&adm_dma { - status = "ok"; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts deleted file mode 100644 index 9440de5b8..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts +++ /dev/null @@ -1,570 +0,0 @@ -/* - * BSD LICENSE - * - * Copyright (C) 2017 Christian Mehlis - * Copyright (C) 2018 Mathias Kresin - * 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. - * 3. Neither the names of the copyright holders nor the names of any - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT - * HOLDER 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 "qcom-ipq8064-v1.0.dtsi" - -#include -#include - -/ { - compatible = "compex,wpq864", "qcom,ipq8064"; - model = "Compex WPQ864"; - - aliases { - mdio-gpio0 = &mdio0; - serial0 = &gsbi4_serial; - ethernet0 = &gmac1; - ethernet1 = &gmac0; - - led-boot = &led_pass; - led-failsafe = &led_fail; - led-running = &led_pass; - led-upgrade = &led_pass; - }; - - chosen { - linux,stdout-path = "serial0:115200n8"; - }; - - soc { - rpm@108000 { - pinctrl-0 = <&rpm_pins>; - pinctrl-names = "default"; - }; - - nand@1ac00000 { - status = "okay"; - - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - - mt29f2g08abbeah4@0 { - compatible = "qcom,nandcs"; - - reg = <0>; - - nand-ecc-strength = <4>; - nand-bus-width = <8>; - nand-ecc-step-size = <512>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - SBL1@0 { - label = "SBL1"; - reg = <0x0000000 0x0040000>; - read-only; - }; - - MIBIB@40000 { - label = "MIBIB"; - reg = <0x0040000 0x0140000>; - read-only; - }; - - SBL2@180000 { - label = "SBL2"; - reg = <0x0180000 0x0140000>; - read-only; - }; - - SBL3@2c0000 { - label = "SBL3"; - reg = <0x02c0000 0x0280000>; - read-only; - }; - - DDRCONFIG@540000 { - label = "DDRCONFIG"; - reg = <0x0540000 0x0120000>; - read-only; - }; - - SSD@660000 { - label = "SSD"; - reg = <0x0660000 0x0120000>; - read-only; - }; - - TZ@780000 { - label = "TZ"; - reg = <0x0780000 0x0280000>; - read-only; - }; - - RPM@a00000 { - label = "RPM"; - reg = <0x0a00000 0x0280000>; - read-only; - }; - - APPSBL@c80000 { - label = "APPSBL"; - reg = <0x0c80000 0x0500000>; - read-only; - }; - - APPSBLENV@1180000 { - label = "APPSBLENV"; - reg = <0x1180000 0x0080000>; - }; - - ART@1200000 { - label = "ART"; - reg = <0x1200000 0x0140000>; - }; - - ubi@1340000 { - label = "ubi"; - reg = <0x1340000 0x4000000>; - }; - - BOOTCONFIG@1340000 { - label = "BOOTCONFIG"; - reg = <0x5340000 0x0060000>; - }; - - SBL2-1@53a0000- { - label = "SBL2_1"; - reg = <0x53a0000 0x0140000>; - read-only; - }; - - SBL3-1@54e0000 { - label = "SBL3_1"; - reg = <0x54e0000 0x0280000>; - read-only; - }; - - DDRCONFIG-1@5760000 { - label = "DDRCONFIG_1"; - reg = <0x5760000 0x0120000>; - read-only; - }; - - SSD-1@5880000 { - label = "SSD_1"; - reg = <0x5880000 0x0120000>; - read-only; - }; - - TZ-1@59a0000 { - label = "TZ_1"; - reg = <0x59a0000 0x0280000>; - read-only; - }; - - RPM-1@5c20000 { - label = "RPM_1"; - reg = <0x5c20000 0x0280000>; - read-only; - }; - - BOOTCONFIG1@5ea0000 { - label = "BOOTCONFIG1"; - reg = <0x5ea0000 0x0060000>; - }; - - APPSBL-1@5f00000 { - label = "APPSBL_1"; - reg = <0x5f00000 0x0500000>; - read-only; - }; - - ubi-1@6400000 { - label = "ubi_1"; - reg = <0x6400000 0x4000000>; - }; - - unused@a400000 { - label = "unused"; - reg = <0xa400000 0x5c00000>; - }; - }; - }; - }; - }; - - mdio0: mdio { - #address-cells = <1>; - #size-cells = <0>; - - compatible = "virtual,mdio-gpio"; - - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; - - ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - >; - }; - - ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - rss4 { - label = "wpq864:green:rss4"; - gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; - }; - - rss3 { - label = "wpq864:green:rss3"; - gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - rss2 { - label = "wpq864:orange:rss2"; - gpios = <&qcom_pinmux 25 GPIO_ACTIVE_HIGH>; - }; - - rss1 { - label = "wpq864:red:rss1"; - gpios = <&qcom_pinmux 22 GPIO_ACTIVE_HIGH>; - }; - - led_pass: pass { - label = "wpq864:green:pass"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - }; - - led_fail: fail { - label = "wpq864:green:fail"; - gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; - }; - - usb { - label = "wpq864:green:usb"; - gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; - }; - - usb-pcie { - label = "wpq864:green:usb-pcie"; - gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - beeper { - compatible = "gpio-beeper"; - - pinctrl-0 = <&beeper_pins>; - pinctrl-names = "default"; - - gpios = <&qcom_pinmux 55 GPIO_ACTIVE_HIGH>; - }; -}; - -&adm_dma { - status = "okay"; -}; - -&gmac1 { - status = "okay"; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - - phy-mode = "rgmii"; - qcom,id = <1>; - - fixed-link { - speed = <1000>; - full-duplex; - }; -}; - -&gmac2 { - status = "okay"; - - phy-mode = "sgmii"; - qcom,id = <2>; - - fixed-link { - speed = <1000>; - full-duplex; - }; -}; - -&gsbi4 { - status = "okay"; - qcom,mode = ; -}; - -&gsbi4_serial { - status = "okay"; - - pinctrl-0 = <&uart0_pins>; - pinctrl-names = "default"; -}; - -&gsbi5 { - status = "okay"; - - qcom,mode = ; - - spi@1a280000 { - status = "okay"; - - pinctrl-0 = <&spi_pins>; - pinctrl-names = "default"; - - cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>; - - s25fl256s1@0 { - compatible = "jedec,spi-nor"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0>; - spi-max-frequency = <50000000>; - }; - }; -}; - -&hs_phy_0 { /* USB3 port 0 HS phy */ - status = "okay"; -}; - -&hs_phy_1 { /* USB3 port 1 HS phy */ - status = "okay"; -}; - -&ss_phy_0 { /* USB3 port 0 SS phy */ - status = "okay"; - - rx_eq = <2>; - tx_deamp_3_5db = <32>; - mpll = <160>; -}; - -&ss_phy_1 { /* USB3 port 1 SS phy */ - status = "okay"; - - rx_eq = <2>; - tx_deamp_3_5db = <32>; - mpll = <160>; -}; - -&pcie0 { - status = "okay"; - - /delete-property/ pinctrl-0; - /delete-property/ pinctrl-names; - /delete-property/ perst-gpios; -}; - -&pcie1 { - status = "okay"; -}; - -&pcie2 { - status = "okay"; - - /delete-property/ pinctrl-0; - /delete-property/ pinctrl-names; - /delete-property/ perst-gpios; -}; - -&qcom_pinmux { - pinctrl-names = "default"; - pinctrl-0 = <&state_default>; - - state_default: pinctrl0 { - pcie0_pcie2_perst { - pins = "gpio3"; - function = "gpio"; - drive-strength = <2>; - bias-disable; - output-high; - }; - }; - - led_pins: led_pins { - mux { - pins = "gpio7", "gpio8", "gpio9", "gpio22", - "gpio23", "gpio24", "gpio25", "gpio53"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - button_pins: button_pins { - mux { - pins = "gpio54"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - beeper_pins: beeper_pins { - mux { - pins = "gpio55"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - rpm_pins: rpm_pins { - mux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - drive-strength = <10>; - bias-disable; - }; - }; - - uart0_pins: uart0_pins { - mux { - pins = "gpio10", "gpio11"; - function = "gsbi4"; - drive-strength = <10>; - bias-disable; - }; - }; - - spi_pins: spi_pins { - mux { - pins = "gpio18", "gpio19"; - function = "gsbi5"; - drive-strength = <10>; - bias-pull-down; - }; - - clk { - pins = "gpio21"; - function = "gsbi5"; - drive-strength = <12>; - bias-pull-down; - }; - - cs { - pins = "gpio20"; - function = "gpio"; - drive-strength = <10>; - bias-pull-up; - }; - }; - - nand_pins: nand_pins { - mux { - pins = "gpio34", "gpio35", "gpio36", "gpio37", - "gpio38", "gpio39", "gpio40", "gpio41", - "gpio42", "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - function = "nand"; - drive-strength = <10>; - bias-disable; - }; - - pullups { - pins = "gpio39"; - bias-pull-up; - }; - - hold { - pins = "gpio40", "gpio41", "gpio42", "gpio43", - "gpio44", "gpio45", "gpio46", "gpio47"; - bias-bus-hold; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", - "gpio31", "gpio32", "gpio51", "gpio52", - "gpio59", "gpio60", "gpio61", "gpio62"; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - }; -}; - -&usb3_0 { - status = "okay"; -}; - - -&usb3_1 { - status = "okay"; -}; - -&tcsr { - qcom,usb-ctrl-select = ; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi deleted file mode 100644 index 90f7a1018..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8064.dtsi +++ /dev/null @@ -1,1333 +0,0 @@ -/dts-v1/; - -#include "skeleton.dtsi" -#include -#include -#include -#include -#include -#include -#include -#include - -/ { - model = "Qualcomm IPQ8064"; - compatible = "qcom,ipq8064"; - interrupt-parent = <&intc>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu0: cpu@0 { - compatible = "qcom,krait"; - enable-method = "qcom,kpss-acc-v1"; - device_type = "cpu"; - reg = <0>; - next-level-cache = <&L2>; - qcom,acc = <&acc0>; - qcom,saw = <&saw0>; - clocks = <&kraitcc 0>, <&kraitcc 4>; - clock-names = "cpu", "l2"; - clock-latency = <100000>; - cpu-supply = <&smb208_s2a>; - voltage-tolerance = <5>; - cooling-min-state = <0>; - cooling-max-state = <10>; - #cooling-cells = <2>; - cpu-idle-states = <&CPU_SPC>; - }; - - cpu1: cpu@1 { - compatible = "qcom,krait"; - enable-method = "qcom,kpss-acc-v1"; - device_type = "cpu"; - reg = <1>; - next-level-cache = <&L2>; - qcom,acc = <&acc1>; - qcom,saw = <&saw1>; - clocks = <&kraitcc 1>, <&kraitcc 4>; - clock-names = "cpu", "l2"; - clock-latency = <100000>; - cpu-supply = <&smb208_s2b>; - cooling-min-state = <0>; - cooling-max-state = <10>; - #cooling-cells = <2>; - cpu-idle-states = <&CPU_SPC>; - }; - - L2: l2-cache { - compatible = "cache"; - cache-level = <2>; - qcom,saw = <&saw_l2>; - }; - - qcom,l2 { - qcom,l2-rates = <384000000 1000000000 1200000000>; - }; - - idle-states { - CPU_SPC: spc { - compatible = "qcom,idle-state-spc", - "arm,idle-state"; - entry-latency-us = <400>; - exit-latency-us = <900>; - min-residency-us = <3000>; - }; - }; - }; - - thermal-zones { - tsens_tz_sensor0 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 0>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor1 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 1>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor2 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 2>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor3 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 3>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor4 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 4>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor5 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 5>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor6 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 6>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor7 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 7>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor8 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 8>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor9 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 9>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - - tsens_tz_sensor10 { - polling-delay-passive = <0>; - polling-delay = <0>; - thermal-sensors = <&tsens 10>; - - trips { - cpu-critical-hi { - temperature = <125000>; - hysteresis = <2000>; - type = "critical_high"; - }; - - cpu-config-hi { - temperature = <105000>; - hysteresis = <2000>; - type = "configurable_hi"; - }; - - cpu-config-lo { - temperature = <95000>; - hysteresis = <2000>; - type = "configurable_lo"; - }; - - cpu-critical-low { - temperature = <0>; - hysteresis = <2000>; - type = "critical_low"; - }; - }; - }; - }; - - cpu-pmu { - compatible = "qcom,krait-pmu"; - interrupts = <1 10 0x304>; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - nss@40000000 { - reg = <0x40000000 0x1000000>; - no-map; - }; - - smem: smem@41000000 { - reg = <0x41000000 0x200000>; - no-map; - }; - }; - - clocks { - cxo_board { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <25000000>; - }; - - pxo_board { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <25000000>; - }; - - sleep_clk: sleep_clk { - compatible = "fixed-clock"; - clock-frequency = <32768>; - #clock-cells = <0>; - }; - }; - - firmware { - scm { - compatible = "qcom,scm-ipq806x"; - }; - }; - - kraitcc: clock-controller { - compatible = "qcom,krait-cc-v1"; - #clock-cells = <1>; - }; - - qcom,pvs { - qcom,pvs-format-a; - qcom,speed0-pvs0-bin-v0 = - < 1400000000 1250000 >, - < 1200000000 1200000 >, - < 1000000000 1150000 >, - < 800000000 1100000 >, - < 600000000 1050000 >, - < 384000000 1000000 >; - - qcom,speed0-pvs1-bin-v0 = - < 1400000000 1175000 >, - < 1200000000 1125000 >, - < 1000000000 1075000 >, - < 800000000 1025000 >, - < 600000000 975000 >, - < 384000000 925000 >; - - qcom,speed0-pvs2-bin-v0 = - < 1400000000 1125000 >, - < 1200000000 1075000 >, - < 1000000000 1025000 >, - < 800000000 995000 >, - < 600000000 925000 >, - < 384000000 875000 >; - - qcom,speed0-pvs3-bin-v0 = - < 1400000000 1050000 >, - < 1200000000 1000000 >, - < 1000000000 950000 >, - < 800000000 900000 >, - < 600000000 850000 >, - < 384000000 800000 >; - }; - - soc: soc { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - - lpass@28100000 { - compatible = "qcom,lpass-cpu"; - status = "disabled"; - clocks = <&lcc AHBIX_CLK>, - <&lcc MI2S_OSR_CLK>, - <&lcc MI2S_BIT_CLK>; - clock-names = "ahbix-clk", - "mi2s-osr-clk", - "mi2s-bit-clk"; - interrupts = <0 85 1>; - interrupt-names = "lpass-irq-lpaif"; - reg = <0x28100000 0x10000>; - reg-names = "lpass-lpaif"; - }; - - qfprom: qfprom@700000 { - compatible = "qcom,qfprom", "syscon"; - reg = <0x700000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - status = "okay"; - tsens_calib: calib@400 { - reg = <0x400 0x10>; - }; - tsens_backup: backup@410 { - reg = <0x410 0x10>; - }; - }; - - rpm@108000 { - compatible = "qcom,rpm-ipq8064"; - reg = <0x108000 0x1000>; - qcom,ipc = <&l2cc 0x8 2>; - - interrupts = <0 19 0>, - <0 21 0>, - <0 22 0>; - interrupt-names = "ack", - "err", - "wakeup"; - - clocks = <&gcc RPM_MSG_RAM_H_CLK>; - clock-names = "ram"; - - #address-cells = <1>; - #size-cells = <0>; - - rpmcc: clock-controller { - compatible = "qcom,rpmcc-ipq806x", "qcom,rpmcc"; - #clock-cells = <1>; - }; - - regulators { - compatible = "qcom,rpm-smb208-regulators"; - - smb208_s1a: s1a { - regulator-min-microvolt = <1050000>; - regulator-max-microvolt = <1150000>; - - qcom,switch-mode-frequency = <1200000>; - - }; - - smb208_s1b: s1b { - regulator-min-microvolt = <1050000>; - regulator-max-microvolt = <1150000>; - - qcom,switch-mode-frequency = <1200000>; - }; - - smb208_s2a: s2a { - regulator-min-microvolt = < 800000>; - regulator-max-microvolt = <1250000>; - - qcom,switch-mode-frequency = <1200000>; - }; - - smb208_s2b: s2b { - regulator-min-microvolt = < 800000>; - regulator-max-microvolt = <1250000>; - - qcom,switch-mode-frequency = <1200000>; - }; - }; - }; - - rng@1a500000 { - compatible = "qcom,prng"; - reg = <0x1a500000 0x200>; - clocks = <&gcc PRNG_CLK>; - clock-names = "core"; - }; - - qcom_pinmux: pinmux@800000 { - compatible = "qcom,ipq8064-pinctrl"; - reg = <0x800000 0x4000>; - - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; - interrupts = <0 16 0x4>; - - pcie0_pins: pcie0_pinmux { - mux { - pins = "gpio3"; - function = "pcie1_rst"; - drive-strength = <2>; - bias-disable; - }; - }; - - pcie1_pins: pcie1_pinmux { - mux { - pins = "gpio48"; - function = "pcie2_rst"; - drive-strength = <2>; - bias-disable; - }; - }; - - pcie2_pins: pcie2_pinmux { - mux { - pins = "gpio63"; - function = "pcie3_rst"; - drive-strength = <2>; - bias-disable; - output-low; - }; - }; - }; - - intc: interrupt-controller@2000000 { - compatible = "qcom,msm-qgic2"; - interrupt-controller; - #interrupt-cells = <3>; - reg = <0x02000000 0x1000>, - <0x02002000 0x1000>; - }; - - timer@200a000 { - compatible = "qcom,kpss-timer", "qcom,msm-timer"; - interrupts = <1 1 0x301>, - <1 2 0x301>, - <1 3 0x301>, - <1 4 0x301>, - <1 5 0x301>; - reg = <0x0200a000 0x100>; - clock-frequency = <25000000>, - <32768>; - clocks = <&sleep_clk>; - clock-names = "sleep"; - cpu-offset = <0x80000>; - }; - - acc0: clock-controller@2088000 { - compatible = "qcom,kpss-acc-v1"; - reg = <0x02088000 0x1000>, <0x02008000 0x1000>; - clock-output-names = "acpu0_aux"; - }; - - acc1: clock-controller@2098000 { - compatible = "qcom,kpss-acc-v1"; - reg = <0x02098000 0x1000>, <0x02008000 0x1000>; - clock-output-names = "acpu1_aux"; - }; - - l2cc: clock-controller@2011000 { - compatible = "qcom,kpss-gcc", "syscon"; - reg = <0x2011000 0x1000>; - clock-output-names = "acpu_l2_aux"; - }; - - saw0: regulator@2089000 { - compatible = "qcom,saw2", "syscon"; - reg = <0x02089000 0x1000>, <0x02009000 0x1000>; - regulator; - }; - - saw1: regulator@2099000 { - compatible = "qcom,saw2", "syscon"; - reg = <0x02099000 0x1000>, <0x02009000 0x1000>; - regulator; - }; - - saw_l2: regulator@02012000 { - compatible = "qcom,saw2", "syscon"; - reg = <0x02012000 0x1000>; - regulator; - }; - - sic_non_secure: sic-non-secure@12100000 { - compatible = "syscon"; - reg = <0x12100000 0x10000>; - }; - - gsbi2: gsbi@12480000 { - compatible = "qcom,gsbi-v1.0.0"; - cell-index = <2>; - reg = <0x12480000 0x100>; - clocks = <&gcc GSBI2_H_CLK>; - clock-names = "iface"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - status = "disabled"; - - syscon-tcsr = <&tcsr>; - - uart2: serial@12490000 { - compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; - reg = <0x12490000 0x1000>, - <0x12480000 0x1000>; - interrupts = <0 195 0x0>; - clocks = <&gcc GSBI2_UART_CLK>, <&gcc GSBI2_H_CLK>; - clock-names = "core", "iface"; - status = "disabled"; - }; - - i2c@124a0000 { - compatible = "qcom,i2c-qup-v1.1.1"; - reg = <0x124a0000 0x1000>; - interrupts = <0 196 0>; - - clocks = <&gcc GSBI2_QUP_CLK>, <&gcc GSBI2_H_CLK>; - clock-names = "core", "iface"; - status = "disabled"; - - #address-cells = <1>; - #size-cells = <0>; - }; - - }; - - gsbi4: gsbi@16300000 { - compatible = "qcom,gsbi-v1.0.0"; - cell-index = <4>; - reg = <0x16300000 0x100>; - clocks = <&gcc GSBI4_H_CLK>; - clock-names = "iface"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - status = "disabled"; - - syscon-tcsr = <&tcsr>; - - gsbi4_serial: serial@16340000 { - compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; - reg = <0x16340000 0x1000>, - <0x16300000 0x1000>; - interrupts = <0 152 0x0>; - clocks = <&gcc GSBI4_UART_CLK>, <&gcc GSBI4_H_CLK>; - clock-names = "core", "iface"; - status = "disabled"; - }; - - i2c@16380000 { - compatible = "qcom,i2c-qup-v1.1.1"; - reg = <0x16380000 0x1000>; - interrupts = <0 153 0>; - - clocks = <&gcc GSBI4_QUP_CLK>, <&gcc GSBI4_H_CLK>; - clock-names = "core", "iface"; - status = "disabled"; - - #address-cells = <1>; - #size-cells = <0>; - }; - }; - - gsbi5: gsbi@1a200000 { - compatible = "qcom,gsbi-v1.0.0"; - cell-index = <5>; - reg = <0x1a200000 0x100>; - clocks = <&gcc GSBI5_H_CLK>; - clock-names = "iface"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - status = "disabled"; - - syscon-tcsr = <&tcsr>; - - uart5: serial@1a240000 { - compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; - reg = <0x1a240000 0x1000>, - <0x1a200000 0x1000>; - interrupts = <0 154 0x0>; - clocks = <&gcc GSBI5_UART_CLK>, <&gcc GSBI5_H_CLK>; - clock-names = "core", "iface"; - status = "disabled"; - }; - - i2c@1a280000 { - compatible = "qcom,i2c-qup-v1.1.1"; - reg = <0x1a280000 0x1000>; - interrupts = <0 155 0>; - - clocks = <&gcc GSBI5_QUP_CLK>, <&gcc GSBI5_H_CLK>; - clock-names = "core", "iface"; - status = "disabled"; - - #address-cells = <1>; - #size-cells = <0>; - }; - - spi@1a280000 { - compatible = "qcom,spi-qup-v1.1.1"; - reg = <0x1a280000 0x1000>; - interrupts = <0 155 0>; - - clocks = <&gcc GSBI5_QUP_CLK>, <&gcc GSBI5_H_CLK>; - clock-names = "core", "iface"; - status = "disabled"; - - #address-cells = <1>; - #size-cells = <0>; - }; - }; - - sata_phy: sata-phy@1b400000 { - compatible = "qcom,ipq806x-sata-phy"; - reg = <0x1b400000 0x200>; - - clocks = <&gcc SATA_PHY_CFG_CLK>; - clock-names = "cfg"; - - #phy-cells = <0>; - status = "disabled"; - }; - - sata@29000000 { - compatible = "qcom,ipq806x-ahci", "generic-ahci"; - reg = <0x29000000 0x180>; - - interrupts = <0 209 0x0>; - - clocks = <&gcc SFAB_SATA_S_H_CLK>, - <&gcc SATA_H_CLK>, - <&gcc SATA_A_CLK>, - <&gcc SATA_RXOOB_CLK>, - <&gcc SATA_PMALIVE_CLK>; - clock-names = "slave_face", "iface", "core", - "rxoob", "pmalive"; - - assigned-clocks = <&gcc SATA_RXOOB_CLK>, <&gcc SATA_PMALIVE_CLK>; - assigned-clock-rates = <100000000>, <100000000>; - - phys = <&sata_phy>; - phy-names = "sata-phy"; - status = "disabled"; - }; - - qcom,ssbi@500000 { - compatible = "qcom,ssbi"; - reg = <0x00500000 0x1000>; - qcom,controller-type = "pmic-arbiter"; - }; - - gcc: clock-controller@900000 { - compatible = "qcom,gcc-ipq8064"; - reg = <0x00900000 0x4000>; - #clock-cells = <1>; - #reset-cells = <1>; - #power-domain-cells = <1>; - }; - - tsens: thermal-sensor@900000 { - compatible = "qcom,ipq8064-tsens"; - reg = <0x900000 0x3680>; - nvmem-cells = <&tsens_calib>, <&tsens_backup>; - nvmem-cell-names = "calib", "calib_backup"; - interrupts = <0 178 0>; - #thermal-sensor-cells = <1>; - }; - - tcsr: syscon@1a400000 { - compatible = "qcom,tcsr-ipq8064", "syscon"; - reg = <0x1a400000 0x100>; - }; - - lcc: clock-controller@28000000 { - compatible = "qcom,lcc-ipq8064"; - reg = <0x28000000 0x1000>; - #clock-cells = <1>; - #reset-cells = <1>; - }; - - sfpb_mutex_block: syscon@1200600 { - compatible = "syscon"; - reg = <0x01200600 0x100>; - }; - - hs_phy_1: phy@100f8800 { - compatible = "qcom,dwc3-hs-usb-phy"; - reg = <0x100f8800 0x30>; - clocks = <&gcc USB30_1_UTMI_CLK>; - clock-names = "ref"; - #phy-cells = <0>; - - status = "disabled"; - }; - - ss_phy_1: phy@100f8830 { - compatible = "qcom,dwc3-ss-usb-phy"; - reg = <0x100f8830 0x30>; - clocks = <&gcc USB30_1_MASTER_CLK>; - clock-names = "ref"; - #phy-cells = <0>; - - status = "disabled"; - }; - - hs_phy_0: phy@110f8800 { - compatible = "qcom,dwc3-hs-usb-phy"; - reg = <0x110f8800 0x30>; - clocks = <&gcc USB30_0_UTMI_CLK>; - clock-names = "ref"; - #phy-cells = <0>; - - status = "disabled"; - }; - - ss_phy_0: phy@110f8830 { - compatible = "qcom,dwc3-ss-usb-phy"; - reg = <0x110f8830 0x30>; - clocks = <&gcc USB30_0_MASTER_CLK>; - clock-names = "ref"; - #phy-cells = <0>; - - status = "disabled"; - }; - - usb3_0: usb30@0 { - compatible = "qcom,dwc3"; - #address-cells = <1>; - #size-cells = <1>; - clocks = <&gcc USB30_0_MASTER_CLK>; - clock-names = "core"; - - ranges; - - resets = <&gcc USB30_0_MASTER_RESET>; - reset-names = "usb30_0_mstr_rst"; - - status = "disabled"; - - dwc3@11000000 { - compatible = "snps,dwc3"; - reg = <0x11000000 0xcd00>; - interrupts = <0 110 0x4>; - phys = <&hs_phy_0>, <&ss_phy_0>; - phy-names = "usb2-phy", "usb3-phy"; - dr_mode = "host"; - snps,dis_u3_susphy_quirk; - }; - }; - - usb3_1: usb30@1 { - compatible = "qcom,dwc3"; - #address-cells = <1>; - #size-cells = <1>; - clocks = <&gcc USB30_1_MASTER_CLK>; - clock-names = "core"; - - ranges; - - resets = <&gcc USB30_1_MASTER_RESET>; - reset-names = "usb30_1_mstr_rst"; - - status = "disabled"; - - dwc3@10000000 { - compatible = "snps,dwc3"; - reg = <0x10000000 0xcd00>; - interrupts = <0 205 0x4>; - phys = <&hs_phy_1>, <&ss_phy_1>; - phy-names = "usb2-phy", "usb3-phy"; - dr_mode = "host"; - snps,dis_u3_susphy_quirk; - }; - }; - - pcie0: pci@1b500000 { - compatible = "qcom,pcie-ipq8064"; - reg = <0x1b500000 0x1000 - 0x1b502000 0x80 - 0x1b600000 0x100 - 0x0ff00000 0x100000>; - reg-names = "dbi", "elbi", "parf", "config"; - device_type = "pci"; - linux,pci-domain = <0>; - bus-range = <0x00 0xff>; - num-lanes = <1>; - #address-cells = <3>; - #size-cells = <2>; - - ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00100000 /* downstream I/O */ - 0x82000000 0 0x08000000 0x08000000 0 0x07e00000>; /* non-prefetchable memory */ - - interrupts = ; - interrupt-names = "msi"; - #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 0x7>; - interrupt-map = <0 0 0 1 &intc 0 36 IRQ_TYPE_LEVEL_HIGH>, /* int_a */ - <0 0 0 2 &intc 0 37 IRQ_TYPE_LEVEL_HIGH>, /* int_b */ - <0 0 0 3 &intc 0 38 IRQ_TYPE_LEVEL_HIGH>, /* int_c */ - <0 0 0 4 &intc 0 39 IRQ_TYPE_LEVEL_HIGH>; /* int_d */ - - clocks = <&gcc PCIE_A_CLK>, - <&gcc PCIE_H_CLK>, - <&gcc PCIE_PHY_CLK>, - <&gcc PCIE_AUX_CLK>, - <&gcc PCIE_ALT_REF_CLK>; - clock-names = "core", "iface", "phy", "aux", "ref"; - - assigned-clocks = <&gcc PCIE_ALT_REF_CLK>; - assigned-clock-rates = <100000000>; - - resets = <&gcc PCIE_ACLK_RESET>, - <&gcc PCIE_HCLK_RESET>, - <&gcc PCIE_POR_RESET>, - <&gcc PCIE_PCI_RESET>, - <&gcc PCIE_PHY_RESET>, - <&gcc PCIE_EXT_RESET>; - reset-names = "axi", "ahb", "por", "pci", "phy", "ext"; - - pinctrl-0 = <&pcie0_pins>; - pinctrl-names = "default"; - - perst-gpios = <&qcom_pinmux 3 GPIO_ACTIVE_LOW>; - - phy-tx0-term-offset = <7>; - - status = "disabled"; - }; - - pcie1: pci@1b700000 { - compatible = "qcom,pcie-ipq8064"; - reg = <0x1b700000 0x1000 - 0x1b702000 0x80 - 0x1b800000 0x100 - 0x31f00000 0x100000>; - reg-names = "dbi", "elbi", "parf", "config"; - device_type = "pci"; - linux,pci-domain = <1>; - bus-range = <0x00 0xff>; - num-lanes = <1>; - #address-cells = <3>; - #size-cells = <2>; - - ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00100000 /* downstream I/O */ - 0x82000000 0 0x2e000000 0x2e000000 0 0x03e00000>; /* non-prefetchable memory */ - - interrupts = ; - interrupt-names = "msi"; - #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 0x7>; - interrupt-map = <0 0 0 1 &intc 0 58 IRQ_TYPE_LEVEL_HIGH>, /* int_a */ - <0 0 0 2 &intc 0 59 IRQ_TYPE_LEVEL_HIGH>, /* int_b */ - <0 0 0 3 &intc 0 60 IRQ_TYPE_LEVEL_HIGH>, /* int_c */ - <0 0 0 4 &intc 0 61 IRQ_TYPE_LEVEL_HIGH>; /* int_d */ - - clocks = <&gcc PCIE_1_A_CLK>, - <&gcc PCIE_1_H_CLK>, - <&gcc PCIE_1_PHY_CLK>, - <&gcc PCIE_1_AUX_CLK>, - <&gcc PCIE_1_ALT_REF_CLK>; - clock-names = "core", "iface", "phy", "aux", "ref"; - - assigned-clocks = <&gcc PCIE_1_ALT_REF_CLK>; - assigned-clock-rates = <100000000>; - - resets = <&gcc PCIE_1_ACLK_RESET>, - <&gcc PCIE_1_HCLK_RESET>, - <&gcc PCIE_1_POR_RESET>, - <&gcc PCIE_1_PCI_RESET>, - <&gcc PCIE_1_PHY_RESET>, - <&gcc PCIE_1_EXT_RESET>; - reset-names = "axi", "ahb", "por", "pci", "phy", "ext"; - - pinctrl-0 = <&pcie1_pins>; - pinctrl-names = "default"; - - perst-gpios = <&qcom_pinmux 48 GPIO_ACTIVE_LOW>; - - phy-tx0-term-offset = <7>; - - status = "disabled"; - }; - - pcie2: pci@1b900000 { - compatible = "qcom,pcie-ipq8064"; - reg = <0x1b900000 0x1000 - 0x1b902000 0x80 - 0x1ba00000 0x100 - 0x35f00000 0x100000>; - reg-names = "dbi", "elbi", "parf", "config"; - device_type = "pci"; - linux,pci-domain = <2>; - bus-range = <0x00 0xff>; - num-lanes = <1>; - #address-cells = <3>; - #size-cells = <2>; - - ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00100000 /* downstream I/O */ - 0x82000000 0 0x32000000 0x32000000 0 0x03e00000>; /* non-prefetchable memory */ - - interrupts = ; - interrupt-names = "msi"; - #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 0x7>; - interrupt-map = <0 0 0 1 &intc 0 72 IRQ_TYPE_LEVEL_HIGH>, /* int_a */ - <0 0 0 2 &intc 0 73 IRQ_TYPE_LEVEL_HIGH>, /* int_b */ - <0 0 0 3 &intc 0 74 IRQ_TYPE_LEVEL_HIGH>, /* int_c */ - <0 0 0 4 &intc 0 75 IRQ_TYPE_LEVEL_HIGH>; /* int_d */ - - clocks = <&gcc PCIE_2_A_CLK>, - <&gcc PCIE_2_H_CLK>, - <&gcc PCIE_2_PHY_CLK>, - <&gcc PCIE_2_AUX_CLK>, - <&gcc PCIE_2_ALT_REF_CLK>; - clock-names = "core", "iface", "phy", "aux", "ref"; - - assigned-clocks = <&gcc PCIE_2_ALT_REF_CLK>; - assigned-clock-rates = <100000000>; - - resets = <&gcc PCIE_2_ACLK_RESET>, - <&gcc PCIE_2_HCLK_RESET>, - <&gcc PCIE_2_POR_RESET>, - <&gcc PCIE_2_PCI_RESET>, - <&gcc PCIE_2_PHY_RESET>, - <&gcc PCIE_2_EXT_RESET>; - reset-names = "axi", "ahb", "por", "pci", "phy", "ext"; - - pinctrl-0 = <&pcie2_pins>; - pinctrl-names = "default"; - - perst-gpios = <&qcom_pinmux 63 GPIO_ACTIVE_LOW>; - - phy-tx0-term-offset = <7>; - - status = "disabled"; - }; - - adm_dma: dma@18300000 { - compatible = "qcom,adm"; - reg = <0x18300000 0x100000>; - interrupts = <0 170 0>; - #dma-cells = <1>; - - clocks = <&gcc ADM0_CLK>, <&gcc ADM0_PBUS_CLK>; - clock-names = "core", "iface"; - - resets = <&gcc ADM0_RESET>, - <&gcc ADM0_PBUS_RESET>, - <&gcc ADM0_C0_RESET>, - <&gcc ADM0_C1_RESET>, - <&gcc ADM0_C2_RESET>; - reset-names = "clk", "pbus", "c0", "c1", "c2"; - qcom,ee = <0>; - - status = "disabled"; - }; - - nand@1ac00000 { - compatible = "qcom,ipq806x-nand"; - reg = <0x1ac00000 0x800>; - - clocks = <&gcc EBI2_CLK>, - <&gcc EBI2_AON_CLK>; - clock-names = "core", "aon"; - - dmas = <&adm_dma 3>; - dma-names = "rxtx"; - qcom,cmd-crci = <15>; - qcom,data-crci = <3>; - - status = "disabled"; - - #address-cells = <1>; - #size-cells = <0>; - }; - - nss_common: syscon@03000000 { - compatible = "syscon"; - reg = <0x03000000 0x0000FFFF>; - }; - - qsgmii_csr: syscon@1bb00000 { - compatible = "syscon"; - reg = <0x1bb00000 0x000001FF>; - }; - - stmmac_axi_setup: stmmac-axi-config { - snps,wr_osr_lmt = <7>; - snps,rd_osr_lmt = <7>; - snps,blen = <16 0 0 0 0 0 0>; - }; - - gmac0: ethernet@37000000 { - device_type = "network"; - compatible = "qcom,ipq806x-gmac"; - reg = <0x37000000 0x200000>; - interrupts = ; - interrupt-names = "macirq"; - - snps,axi-config = <&stmmac_axi_setup>; - snps,pbl = <32>; - snps,aal = <1>; - - qcom,nss-common = <&nss_common>; - qcom,qsgmii-csr = <&qsgmii_csr>; - - clocks = <&gcc GMAC_CORE1_CLK>; - clock-names = "stmmaceth"; - - resets = <&gcc GMAC_CORE1_RESET>; - reset-names = "stmmaceth"; - - status = "disabled"; - }; - - gmac1: ethernet@37200000 { - device_type = "network"; - compatible = "qcom,ipq806x-gmac"; - reg = <0x37200000 0x200000>; - interrupts = ; - interrupt-names = "macirq"; - - snps,axi-config = <&stmmac_axi_setup>; - snps,pbl = <32>; - snps,aal = <1>; - - qcom,nss-common = <&nss_common>; - qcom,qsgmii-csr = <&qsgmii_csr>; - - clocks = <&gcc GMAC_CORE2_CLK>; - clock-names = "stmmaceth"; - - resets = <&gcc GMAC_CORE2_RESET>; - reset-names = "stmmaceth"; - - status = "disabled"; - }; - - gmac2: ethernet@37400000 { - device_type = "network"; - compatible = "qcom,ipq806x-gmac"; - reg = <0x37400000 0x200000>; - interrupts = ; - interrupt-names = "macirq"; - - snps,axi-config = <&stmmac_axi_setup>; - snps,pbl = <32>; - snps,aal = <1>; - - qcom,nss-common = <&nss_common>; - qcom,qsgmii-csr = <&qsgmii_csr>; - - clocks = <&gcc GMAC_CORE3_CLK>; - clock-names = "stmmaceth"; - - resets = <&gcc GMAC_CORE3_RESET>; - reset-names = "stmmaceth"; - - status = "disabled"; - }; - - gmac3: ethernet@37600000 { - device_type = "network"; - compatible = "qcom,ipq806x-gmac"; - reg = <0x37600000 0x200000>; - interrupts = ; - interrupt-names = "macirq"; - - snps,axi-config = <&stmmac_axi_setup>; - snps,pbl = <32>; - snps,aal = <1>; - - qcom,nss-common = <&nss_common>; - qcom,qsgmii-csr = <&qsgmii_csr>; - - clocks = <&gcc GMAC_CORE4_CLK>; - clock-names = "stmmaceth"; - - resets = <&gcc GMAC_CORE4_RESET>; - reset-names = "stmmaceth"; - - status = "disabled"; - }; - }; - - sfpb_mutex: sfpb-mutex { - compatible = "qcom,sfpb-mutex"; - syscon = <&sfpb_mutex_block 4 4>; - - #hwlock-cells = <1>; - }; - - smem { - compatible = "qcom,smem"; - memory-region = <&smem>; - hwlocks = <&sfpb_mutex 3>; - }; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts deleted file mode 100644 index 2f829795b..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts +++ /dev/null @@ -1,393 +0,0 @@ -#include "qcom-ipq8065-v1.0.dtsi" - -#include - -/ { - model = "ZyXEL NBG6817"; - compatible = "zyxel,nbg6817", "qcom,ipq8065"; - - memory@0 { - reg = <0x42000000 0x1e000000>; - device_type = "memory"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - }; - - aliases { - serial0 = &gsbi4_serial; - mdio-gpio0 = &mdio0; - sdcc1 = &sdcc1; - - led-boot = &power; - led-failsafe = &power; - led-running = &power; - led-upgrade = &power; - }; - - chosen { - bootargs = "rootfstype=squashfs,ext4 rootwait noinitrd"; - linux,stdout-path = "serial0:115200n8"; - append-rootblock = "root=/dev/mmcblk0p"; - }; - - soc { - pinmux@800000 { - button_pins: button_pins { - mux { - pins = "gpio53", "gpio54", "gpio65"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - i2c4_pins: i2c4_pinmux { - mux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - drive-strength = <12>; - bias-disable; - }; - }; - - led_pins: led_pins { - mux { - pins = "gpio9", "gpio26", "gpio33", "gpio64"; - function = "gpio"; - drive-strength = <2>; - bias-pull-down; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - - clk { - pins = "gpio1"; - input-disable; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - - tx { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32" ; - input-disable; - }; - }; - - spi_pins: spi_pins { - mux { - pins = "gpio18", "gpio19", "gpio21"; - function = "gsbi5"; - drive-strength = <10>; - bias-none; - }; - - cs { - pins = "gpio20"; - drive-strength = <12>; - }; - }; - - usb0_pwr_en_pins: usb0_pwr_en_pins { - mux { - pins = "gpio16", "gpio17"; - function = "gpio"; - drive-strength = <12>; - }; - - pwr { - pins = "gpio17"; - bias-pull-down; - output-high; - }; - - ovc { - pins = "gpio16"; - bias-pull-up; - }; - }; - - usb1_pwr_en_pins: usb1_pwr_en_pins { - mux { - pins = "gpio14", "gpio15"; - function = "gpio"; - drive-strength = <12>; - }; - - pwr { - pins = "gpio14"; - bias-pull-down; - output-high; - }; - - ovc { - pins = "gpio15"; - bias-pull-up; - }; - }; - }; - - gsbi@16300000 { - qcom,mode = ; - status = "ok"; - serial@16340000 { - status = "ok"; - }; - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ - }; - - gsbi5: gsbi@1a200000 { - qcom,mode = ; - status = "ok"; - - spi4: spi@1a280000 { - status = "ok"; - - pinctrl-0 = <&spi_pins>; - pinctrl-names = "default"; - - cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>; - - flash: m25p80@0 { - compatible = "jedec,spi-nor"; - #address-cells = <1>; - #size-cells = <1>; - spi-max-frequency = <51200000>; - reg = <0>; - - partitions { - compatible = "qcom,smem"; - }; - }; - }; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - status = "ok"; - }; - - usb30@0 { - status = "ok"; - - pinctrl-0 = <&usb0_pwr_en_pins>; - pinctrl-names = "default"; - }; - - usb30@1 { - status = "ok"; - - pinctrl-0 = <&usb1_pwr_en_pins>; - pinctrl-names = "default"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - reset-gpio = <&qcom_pinmux 3 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&pcie0_pins>; - pinctrl-names = "default"; - }; - - pcie1: pci@1b700000 { - status = "ok"; - reset-gpio = <&qcom_pinmux 48 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&pcie1_pins>; - pinctrl-names = "default"; - force_gen1 = <1>; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0xaa545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - 0x00970 0x1e864443 /* QM_PORT0_CTRL0 */ - 0x00974 0x000001c6 /* QM_PORT0_CTRL1 */ - 0x00978 0x19008643 /* QM_PORT1_CTRL0 */ - 0x0097c 0x000001c6 /* QM_PORT1_CTRL1 */ - 0x00980 0x19008643 /* QM_PORT2_CTRL0 */ - 0x00984 0x000001c6 /* QM_PORT2_CTRL1 */ - 0x00988 0x19008643 /* QM_PORT3_CTRL0 */ - 0x0098c 0x000001c6 /* QM_PORT3_CTRL1 */ - 0x00990 0x19008643 /* QM_PORT4_CTRL0 */ - 0x00994 0x000001c6 /* QM_PORT4_CTRL1 */ - 0x00998 0x1e864443 /* QM_PORT5_CTRL0 */ - 0x0099c 0x000001c6 /* QM_PORT5_CTRL1 */ - 0x009a0 0x1e864443 /* QM_PORT6_CTRL0 */ - 0x009a4 0x000001c6 /* QM_PORT6_CTRL1 */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - qca,ar8327-initvals = < - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x0000c 0x80 /* PAD6_MODE */ - >; - }; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "rgmii"; - qcom,id = <1>; - qcom,phy_mdio_addr = <4>; - qcom,poll_required = <0>; - qcom,rgmii_delay = <1>; - qcom,phy_mii_type = <0>; - qcom,emulation = <0>; - qcom,irq = <255>; - mdiobus = <&mdio0>; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - qcom,phy_mdio_addr = <0>; /* none */ - qcom,poll_required = <0>; /* no polling */ - qcom,rgmii_delay = <0>; - qcom,phy_mii_type = <1>; - qcom,emulation = <0>; - qcom,irq = <258>; - mdiobus = <&mdio0>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - rpm@108000 { - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - }; - - amba { - sdcc1: sdcc@12400000 { - status = "okay"; - }; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - internet { - label = "nbg6817:white:internet"; - gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>; - }; - - power: power { - label = "nbg6817:white:power"; - gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - wifi2g { - label = "nbg6817:amber:wifi2g"; - gpios = <&qcom_pinmux 33 GPIO_ACTIVE_HIGH>; - }; - - /* wifi2g amber from the manual is missing */ - - wifi5g { - label = "nbg6817:amber:wifi5g"; - gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; - }; - - /* wifi5g amber from the manual is missing */ - }; -}; - -&adm_dma { - status = "ok"; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-r7800.dts b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-r7800.dts deleted file mode 100644 index 63cb42a3e..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-r7800.dts +++ /dev/null @@ -1,575 +0,0 @@ -#include "qcom-ipq8065-v1.0.dtsi" - -#include - -/ { - model = "Netgear Nighthawk X4S R7800"; - compatible = "netgear,r7800", "qcom,ipq8065", "qcom,ipq8064"; - - memory@0 { - reg = <0x42000000 0x1e000000>; - device_type = "memory"; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - rsvd@41200000 { - reg = <0x41200000 0x300000>; - no-map; - }; - - rsvd@5fe00000 { - reg = <0x5fe00000 0x200000>; - reusable; - }; - }; - - aliases { - serial0 = &gsbi4_serial; - mdio-gpio0 = &mdio0; - - led-boot = &power_white; - led-failsafe = &power_amber; - led-running = &power_white; - led-upgrade = &power_amber; - }; - - chosen { - linux,stdout-path = "serial0:115200n8"; - }; - - soc { - pinmux@800000 { - button_pins: button_pins { - mux { - pins = "gpio6", "gpio54", "gpio65"; - function = "gpio"; - drive-strength = <2>; - bias-pull-up; - }; - }; - - i2c4_pins: i2c4_pinmux { - mux { - pins = "gpio12", "gpio13"; - function = "gsbi4"; - drive-strength = <12>; - bias-disable; - }; - }; - - led_pins: led_pins { - pins = "gpio7", "gpio8", "gpio9", "gpio22", "gpio23", - "gpio24","gpio26", "gpio53", "gpio64"; - function = "gpio"; - drive-strength = <2>; - bias-pull-down; - }; - - nand_pins: nand_pins { - mux { - pins = "gpio34", "gpio35", "gpio36", - "gpio37", "gpio38", "gpio39", - "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - function = "nand"; - drive-strength = <10>; - bias-disable; - }; - pullups { - pins = "gpio39"; - bias-pull-up; - }; - hold { - pins = "gpio40", "gpio41", "gpio42", - "gpio43", "gpio44", "gpio45", - "gpio46", "gpio47"; - bias-bus-hold; - }; - }; - - mdio0_pins: mdio0_pins { - mux { - pins = "gpio0", "gpio1"; - function = "gpio"; - drive-strength = <8>; - bias-disable; - }; - - clk { - pins = "gpio1"; - input-disable; - }; - }; - - rgmii2_pins: rgmii2_pins { - mux { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62" ; - function = "rgmii2"; - drive-strength = <8>; - bias-disable; - }; - - tx { - pins = "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32" ; - input-disable; - }; - }; - - spi_pins: spi_pins { - mux { - pins = "gpio18", "gpio19", "gpio21"; - function = "gsbi5"; - bias-pull-down; - }; - - data { - pins = "gpio18", "gpio19"; - drive-strength = <10>; - }; - - cs { - pins = "gpio20"; - drive-strength = <10>; - bias-pull-up; - }; - - clk { - pins = "gpio21"; - drive-strength = <12>; - }; - }; - - spi6_pins: spi6_pins { - mux { - pins = "gpio55", "gpio56", "gpio58"; - function = "gsbi6"; - bias-pull-down; - }; - - mosi { - pins = "gpio55"; - drive-strength = <12>; - }; - - miso { - pins = "gpio56"; - drive-strength = <14>; - }; - - cs { - pins = "gpio57"; - drive-strength = <12>; - bias-pull-up; - }; - - clk { - pins = "gpio58"; - drive-strength = <12>; - }; - - reset { - pins = "gpio33"; - drive-strength = <10>; - bias-pull-down; - output-high; - }; - }; - - usb0_pwr_en_pins: usb0_pwr_en_pins { - mux { - pins = "gpio15"; - function = "gpio"; - drive-strength = <12>; - bias-pull-down; - output-high; - }; - }; - - usb1_pwr_en_pins: usb1_pwr_en_pins { - mux { - pins = "gpio16", "gpio68"; - function = "gpio"; - drive-strength = <12>; - bias-pull-down; - output-high; - }; - }; - }; - - gsbi@16300000 { - qcom,mode = ; - status = "ok"; - serial@16340000 { - status = "ok"; - }; - /* - * The i2c device on gsbi4 should not be enabled. - * On ipq806x designs gsbi4 i2c is meant for exclusive - * RPM usage. Turning this on in kernel manifests as - * i2c failure for the RPM. - */ - }; - - gsbi5: gsbi@1a200000 { - qcom,mode = ; - status = "ok"; - - spi5: spi@1a280000 { - status = "ok"; - - pinctrl-0 = <&spi_pins>; - pinctrl-names = "default"; - - cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>; - - flash: m25p80@0 { - compatible = "jedec,spi-nor"; - #address-cells = <1>; - #size-cells = <1>; - spi-max-frequency = <50000000>; - reg = <0>; - - partitions { - compatible = "qcom,smem"; - }; - }; - }; - }; - - gsbi6: gsbi@16500000 { - qcom,mode = ; - status = "ok"; - spi6: spi@16580000 { - status = "ok"; - - pinctrl-0 = <&spi6_pins>; - pinctrl-names = "default"; - - cs-gpios = <&qcom_pinmux 57 GPIO_ACTIVE_HIGH>; - - spi-nor@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <6000000>; - }; - }; - }; - - sata-phy@1b400000 { - status = "ok"; - }; - - sata@29000000 { - ports-implemented = <0x1>; - status = "ok"; - }; - - phy@100f8800 { /* USB3 port 1 HS phy */ - status = "ok"; - }; - - phy@100f8830 { /* USB3 port 1 SS phy */ - status = "ok"; - }; - - phy@110f8800 { /* USB3 port 0 HS phy */ - status = "ok"; - }; - - phy@110f8830 { /* USB3 port 0 SS phy */ - status = "ok"; - }; - - usb30@0 { - status = "ok"; - - pinctrl-0 = <&usb0_pwr_en_pins>; - pinctrl-names = "default"; - }; - - usb30@1 { - status = "ok"; - - pinctrl-0 = <&usb1_pwr_en_pins>; - pinctrl-names = "default"; - }; - - pcie0: pci@1b500000 { - status = "ok"; - }; - - pcie1: pci@1b700000 { - status = "ok"; - force_gen1 = <1>; - }; - - nand@1ac00000 { - status = "ok"; - - pinctrl-0 = <&nand_pins>; - pinctrl-names = "default"; - - cs0 { - reg = <0>; - compatible = "qcom,nandcs"; - - nand-ecc-strength = <4>; - nand-bus-width = <8>; - nand-ecc-step-size = <512>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - qcadata@0 { - label = "qcadata"; - reg = <0x0000000 0x0c80000>; - read-only; - }; - - APPSBL@c80000 { - label = "APPSBL"; - reg = <0x0c80000 0x0500000>; - read-only; - }; - - APPSBLENV@1180000 { - label = "APPSBLENV"; - reg = <0x1180000 0x0080000>; - read-only; - }; - - art: art@1200000 { - label = "art"; - reg = <0x1200000 0x0140000>; - read-only; - }; - - artbak: art@1340000 { - label = "artbak"; - reg = <0x1340000 0x0140000>; - read-only; - }; - - kernel@1480000 { - label = "kernel"; - reg = <0x1480000 0x0200000>; - }; - - ubi@1680000 { - label = "ubi"; - reg = <0x1680000 0x1E00000>; - }; - - netgear@3480000 { - label = "netgear"; - reg = <0x3480000 0x4480000>; - read-only; - }; - - reserve@7900000 { - label = "reserve"; - reg = <0x7900000 0x0700000>; - read-only; - }; - - firmware@1480000 { - label = "firmware"; - reg = <0x1480000 0x2000000>; - }; - }; - }; - }; - - mdio0: mdio { - compatible = "virtual,mdio-gpio"; - #address-cells = <1>; - #size-cells = <0>; - gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&mdio0_pins>; - pinctrl-names = "default"; - - - phy0: ethernet-phy@0 { - device_type = "ethernet-phy"; - reg = <0>; - qca,ar8327-initvals = < - 0x00004 0x7600000 /* PAD0_MODE */ - 0x00008 0x1000000 /* PAD5_MODE */ - 0x0000c 0x80 /* PAD6_MODE */ - 0x000e4 0xaa545 /* MAC_POWER_SEL */ - 0x000e0 0xc74164de /* SGMII_CTRL */ - 0x0007c 0x4e /* PORT0_STATUS */ - 0x00094 0x4e /* PORT6_STATUS */ - 0x00970 0x1e864443 /* QM_PORT0_CTRL0 */ - 0x00974 0x000001c6 /* QM_PORT0_CTRL1 */ - 0x00978 0x19008643 /* QM_PORT1_CTRL0 */ - 0x0097c 0x000001c6 /* QM_PORT1_CTRL1 */ - 0x00980 0x19008643 /* QM_PORT2_CTRL0 */ - 0x00984 0x000001c6 /* QM_PORT2_CTRL1 */ - 0x00988 0x19008643 /* QM_PORT3_CTRL0 */ - 0x0098c 0x000001c6 /* QM_PORT3_CTRL1 */ - 0x00990 0x19008643 /* QM_PORT4_CTRL0 */ - 0x00994 0x000001c6 /* QM_PORT4_CTRL1 */ - 0x00998 0x1e864443 /* QM_PORT5_CTRL0 */ - 0x0099c 0x000001c6 /* QM_PORT5_CTRL1 */ - 0x009a0 0x1e864443 /* QM_PORT6_CTRL0 */ - 0x009a4 0x000001c6 /* QM_PORT6_CTRL1 */ - >; - qca,ar8327-vlans = < - 0x1 0x5e /* VLAN1 Ports 1/2/3/4/6 */ - 0x2 0x21 /* VLAN2 Ports 0/5 */ - >; - }; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - reg = <4>; - qca,ar8327-initvals = < - 0x000e4 0x6a545 /* MAC_POWER_SEL */ - 0x0000c 0x80 /* PAD6_MODE */ - >; - }; - }; - - gmac1: ethernet@37200000 { - status = "ok"; - phy-mode = "rgmii"; - qcom,id = <1>; - qcom,phy_mdio_addr = <4>; - qcom,poll_required = <0>; - qcom,rgmii_delay = <1>; - qcom,phy_mii_type = <0>; - qcom,emulation = <0>; - qcom,irq = <255>; - mdiobus = <&mdio0>; - - pinctrl-0 = <&rgmii2_pins>; - pinctrl-names = "default"; - - mtd-mac-address = <&art 6>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - gmac2: ethernet@37400000 { - status = "ok"; - phy-mode = "sgmii"; - qcom,id = <2>; - qcom,phy_mdio_addr = <0>; /* none */ - qcom,poll_required = <0>; /* no polling */ - qcom,rgmii_delay = <0>; - qcom,phy_mii_type = <1>; - qcom,emulation = <0>; - qcom,irq = <258>; - mdiobus = <&mdio0>; - - mtd-mac-address = <&art 0>; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - - rpm@108000 { - pinctrl-0 = <&i2c4_pins>; - pinctrl-names = "default"; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - wifi { - label = "wifi"; - gpios = <&qcom_pinmux 6 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - wakeup-source; - }; - - reset { - label = "reset"; - gpios = <&qcom_pinmux 54 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - wakeup-source; - }; - - wps { - label = "wps"; - gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - wakeup-source; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; - - power_white: power_white { - label = "r7800:white:power"; - gpios = <&qcom_pinmux 53 GPIO_ACTIVE_HIGH>; - default-state = "keep"; - }; - - power_amber: power_amber { - label = "r7800:amber:power"; - gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; - }; - - wan_white { - label = "r7800:white:wan"; - gpios = <&qcom_pinmux 22 GPIO_ACTIVE_HIGH>; - }; - - wan_amber { - label = "r7800:amber:wan"; - gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; - }; - - usb1 { - label = "r7800:white:usb1"; - gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; - }; - - usb2 { - label = "r7800:white:usb2"; - gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; - }; - - esata { - label = "r7800:white:esata"; - gpios = <&qcom_pinmux 26 GPIO_ACTIVE_HIGH>; - }; - - wifi { - label = "r7800:white:wifi"; - gpios = <&qcom_pinmux 64 GPIO_ACTIVE_HIGH>; - }; - - wps { - label = "r7800:white:wps"; - gpios = <&qcom_pinmux 24 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&adm_dma { - status = "ok"; -}; diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-v1.0.dtsi b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-v1.0.dtsi deleted file mode 100644 index 22b5338cc..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065-v1.0.dtsi +++ /dev/null @@ -1 +0,0 @@ -#include "qcom-ipq8065.dtsi" diff --git a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065.dtsi b/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065.dtsi deleted file mode 100644 index 15f3b95f8..000000000 --- a/target/linux/ipq806x/files-4.9/arch/arm/boot/dts/qcom-ipq8065.dtsi +++ /dev/null @@ -1,164 +0,0 @@ -#include "qcom-ipq8064.dtsi" - -/ { - model = "Qualcomm IPQ8065"; - compatible = "qcom,ipq8065", "qcom,ipq8064"; - - qcom,pvs { - qcom,pvs-format-a; - qcom,speed0-pvs0-bin-v0 = - < 1725000000 1262500 >, - < 1400000000 1175000 >, - < 1000000000 1100000 >, - < 800000000 1050000 >, - < 600000000 1000000 >, - < 384000000 975000 >; - qcom,speed0-pvs1-bin-v0 = - < 1725000000 1225000 >, - < 1400000000 1150000 >, - < 1000000000 1075000 >, - < 800000000 1025000 >, - < 600000000 975000 >, - < 384000000 950000 >; - qcom,speed0-pvs2-bin-v0 = - < 1725000000 1200000 >, - < 1400000000 1125000 >, - < 1000000000 1050000 >, - < 800000000 1000000 >, - < 600000000 950000 >, - < 384000000 925000 >; - qcom,speed0-pvs3-bin-v0 = - < 1725000000 1175000 >, - < 1400000000 1100000 >, - < 1000000000 1025000 >, - < 800000000 975000 >, - < 600000000 925000 >, - < 384000000 900000 >; - qcom,speed0-pvs4-bin-v0 = - < 1725000000 1150000 >, - < 1400000000 1075000 >, - < 1000000000 1000000 >, - < 800000000 950000 >, - < 600000000 900000 >, - < 384000000 875000 >; - qcom,speed0-pvs5-bin-v0 = - < 1725000000 1100000 >, - < 1400000000 1025000 >, - < 1000000000 950000 >, - < 800000000 900000 >, - < 600000000 850000 >, - < 384000000 825000 >; - qcom,speed0-pvs6-bin-v0 = - < 1725000000 1050000 >, - < 1400000000 975000 >, - < 1000000000 900000 >, - < 800000000 850000 >, - < 600000000 800000 >, - < 384000000 775000 >; - }; - - soc: soc { - - rpm@108000 { - - regulators { - - smb208_s2a: s2a { - regulator-min-microvolt = <775000>; - regulator-max-microvolt = <1275000>; - }; - - smb208_s2b: s2b { - regulator-min-microvolt = <775000>; - regulator-max-microvolt = <1275000>; - }; - }; - }; - - ss_phy_0: phy@110f8830 { - rx_eq = <2>; - tx_deamp_3_5db = <32>; - mpll = <0xa0>; - }; - ss_phy_1: phy@100f8830 { - rx_eq = <2>; - tx_deamp_3_5db = <32>; - mpll = <0xa0>; - }; - - /* Temporary fixed regulator */ - vsdcc_fixed: vsdcc-regulator { - compatible = "regulator-fixed"; - regulator-name = "SDCC Power"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - }; - - sdcc1bam:dma@12402000 { - compatible = "qcom,bam-v1.3.0"; - reg = <0x12402000 0x8000>; - interrupts = <0 98 0>; - clocks = <&gcc SDC1_H_CLK>; - clock-names = "bam_clk"; - #dma-cells = <1>; - qcom,ee = <0>; - }; - - sdcc3bam:dma@12182000 { - compatible = "qcom,bam-v1.3.0"; - reg = <0x12182000 0x8000>; - interrupts = <0 96 0>; - clocks = <&gcc SDC3_H_CLK>; - clock-names = "bam_clk"; - #dma-cells = <1>; - qcom,ee = <0>; - }; - - amba { - compatible = "arm,amba-bus"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - sdcc1: sdcc@12400000 { - status = "disabled"; - compatible = "arm,pl18x", "arm,primecell"; - arm,primecell-periphid = <0x00051180>; - reg = <0x12400000 0x2000>; - interrupts = ; - interrupt-names = "cmd_irq"; - clocks = <&gcc SDC1_CLK>, <&gcc SDC1_H_CLK>; - clock-names = "mclk", "apb_pclk"; - bus-width = <8>; - max-frequency = <96000000>; - non-removable; - cap-sd-highspeed; - cap-mmc-highspeed; - vmmc-supply = <&vsdcc_fixed>; - dmas = <&sdcc1bam 2>, <&sdcc1bam 1>; - dma-names = "tx", "rx"; - }; - - sdcc3: sdcc@12180000 { - compatible = "arm,pl18x", "arm,primecell"; - arm,primecell-periphid = <0x00051180>; - status = "disabled"; - reg = <0x12180000 0x2000>; - interrupts = ; - interrupt-names = "cmd_irq"; - clocks = <&gcc SDC3_CLK>, <&gcc SDC3_H_CLK>; - clock-names = "mclk", "apb_pclk"; - bus-width = <8>; - cap-sd-highspeed; - cap-mmc-highspeed; - max-frequency = <192000000>; - #mmc-ddr-1_8v; - sd-uhs-sdr104; - sd-uhs-ddr50; - vqmmc-supply = <&vsdcc_fixed>; - dmas = <&sdcc3bam 2>, <&sdcc3bam 1>; - dma-names = "tx", "rx"; - }; - }; - }; -}; diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index a737e165b..2902af323 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -101,10 +101,22 @@ define Device/linksys_ea8500 endef TARGET_DEVICES += linksys_ea8500 +define Device/nec_wg2600hp + $(call Device/LegacyImage) + DEVICE_DTS := qcom-ipq8064-wg2600hp + BLOCKSIZE := 64k + BOARD_NAME := wg2600hp + DEVICE_TITLE := NEC Aterm WG2600HP + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata + DEVICE_PACKAGES := ath10k-firmware-qca99x0 +endef +TARGET_DEVICES += nec_wg2600hp + define Device/netgear_d7800 $(call Device/DniImage) DEVICE_DTS := qcom-ipq8064-d7800 - KERNEL_SIZE := 2097152 + KERNEL_SIZE := 4096k NETGEAR_BOARD_ID := D7800 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4 BLOCKSIZE := 128k @@ -119,7 +131,7 @@ TARGET_DEVICES += netgear_d7800 define Device/netgear_r7500 $(call Device/DniImage) DEVICE_DTS := qcom-ipq8064-r7500 - KERNEL_SIZE := 2097152 + KERNEL_SIZE := 4096k NETGEAR_BOARD_ID := R7500 NETGEAR_HW_ID := 29764841+0+128+256+3x3+4x4 BLOCKSIZE := 128k @@ -134,7 +146,7 @@ TARGET_DEVICES += netgear_r7500 define Device/netgear_r7500v2 $(call Device/DniImage) DEVICE_DTS := qcom-ipq8064-r7500v2 - KERNEL_SIZE := 2097152 + KERNEL_SIZE := 4096k NETGEAR_BOARD_ID := R7500v2 NETGEAR_HW_ID := 29764958+0+128+512+3x3+4x4 BLOCKSIZE := 128k @@ -149,7 +161,7 @@ TARGET_DEVICES += netgear_r7500v2 define Device/netgear_r7800 $(call Device/DniImage) DEVICE_DTS := qcom-ipq8065-r7800 - KERNEL_SIZE := 2097152 + KERNEL_SIZE := 4096k NETGEAR_BOARD_ID := R7800 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4+cascade BLOCKSIZE := 128k @@ -215,7 +227,7 @@ define Device/tplink_vr2600v KERNEL_SUFFIX := -uImage KERNEL = kernel-bin | append-dtb | uImage none KERNEL_NAME := zImage - KERNEL_SIZE := 2097152 + KERNEL_SIZE := 3072k DEVICE_DTS := qcom-ipq8064-vr2600v BLOCKSIZE := 128k PAGESIZE := 2048 diff --git a/target/linux/ipq806x/patches-4.14/0035-clk-mux-Split-out-register-accessors-for-reuse.patch b/target/linux/ipq806x/patches-4.14/0035-clk-mux-Split-out-register-accessors-for-reuse.patch index 0d919ee66..e65ca0298 100644 --- a/target/linux/ipq806x/patches-4.14/0035-clk-mux-Split-out-register-accessors-for-reuse.patch +++ b/target/linux/ipq806x/patches-4.14/0035-clk-mux-Split-out-register-accessors-for-reuse.patch @@ -135,14 +135,14 @@ Signed-off-by: Stephen Boyd if (mux->lock) spin_lock_irqsave(mux->lock, flags); else -@@ -102,14 +121,14 @@ static int clk_mux_set_parent(struct clk +@@ -110,14 +129,14 @@ static int clk_mux_determine_rate(struct } const struct clk_ops clk_mux_ops = { - .get_parent = clk_mux_get_parent, + .get_parent = _clk_mux_get_parent, .set_parent = clk_mux_set_parent, - .determine_rate = __clk_mux_determine_rate, + .determine_rate = clk_mux_determine_rate, }; EXPORT_SYMBOL_GPL(clk_mux_ops); @@ -152,7 +152,7 @@ Signed-off-by: Stephen Boyd }; EXPORT_SYMBOL_GPL(clk_mux_ro_ops); -@@ -117,7 +136,7 @@ struct clk_hw *clk_hw_register_mux_table +@@ -125,7 +144,7 @@ struct clk_hw *clk_hw_register_mux_table const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, diff --git a/target/linux/ipq806x/patches-4.14/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-4.14/0069-arm-boot-add-dts-files.patch index fead994c0..b94e4828c 100644 --- a/target/linux/ipq806x/patches-4.14/0069-arm-boot-add-dts-files.patch +++ b/target/linux/ipq806x/patches-4.14/0069-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -699,6 +699,15 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -699,6 +699,16 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8084-mtp.dtb \ qcom-ipq4019-ap.dk01.1-c1.dtb \ qcom-ipq8064-ap148.dtb \ @@ -20,6 +20,7 @@ Signed-off-by: John Crispin + qcom-ipq8064-ea8500.dtb \ + qcom-ipq8064-r7500.dtb \ + qcom-ipq8064-r7500v2.dtb \ ++ qcom-ipq8064-wg2600hp.dtb \ + qcom-ipq8064-wpq864.dtb \ + qcom-ipq8065-nbg6817.dtb \ + qcom-ipq8065-r7800.dtb \ diff --git a/target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch b/target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch index 6ecda6c35..24a7fda22 100644 --- a/target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch +++ b/target/linux/ipq806x/patches-4.14/105-mtd-nor-add-mx25l25635f.patch @@ -11,7 +11,7 @@ the ubi volume created by the other. --- --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1024,7 +1024,7 @@ static const struct flash_info spi_nor_i +@@ -1023,7 +1023,7 @@ static const struct flash_info spi_nor_i { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, diff --git a/target/linux/ipq806x/patches-4.9/0001-dtbindings-qcom_adm-Fix-channel-specifiers.patch b/target/linux/ipq806x/patches-4.9/0001-dtbindings-qcom_adm-Fix-channel-specifiers.patch deleted file mode 100644 index 2a36a85b8..000000000 --- a/target/linux/ipq806x/patches-4.9/0001-dtbindings-qcom_adm-Fix-channel-specifiers.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 28d0ed88f536dd639adf1b0c7c08e04be3c8f294 Mon Sep 17 00:00:00 2001 -From: Thomas Pedersen -Date: Mon, 16 May 2016 17:58:50 -0700 -Subject: [PATCH 01/69] dtbindings: qcom_adm: Fix channel specifiers - -Original patch from Andy Gross. - -This patch removes the crci information from the dma -channel property. At least one client device requires -using more than one CRCI value for a channel. This does -not match the current binding and the crci information -needs to be removed. - -Instead, the client device will provide this information -via other means. - -Signed-off-by: Andy Gross -Signed-off-by: Thomas Pedersen ---- - Documentation/devicetree/bindings/dma/qcom_adm.txt | 16 ++++++---------- - 1 file changed, 6 insertions(+), 10 deletions(-) - ---- a/Documentation/devicetree/bindings/dma/qcom_adm.txt -+++ b/Documentation/devicetree/bindings/dma/qcom_adm.txt -@@ -4,8 +4,7 @@ Required properties: - - compatible: must contain "qcom,adm" for IPQ/APQ8064 and MSM8960 - - reg: Address range for DMA registers - - interrupts: Should contain one interrupt shared by all channels --- #dma-cells: must be <2>. First cell denotes the channel number. Second cell -- denotes CRCI (client rate control interface) flow control assignment. -+- #dma-cells: must be <1>. First cell denotes the channel number. - - clocks: Should contain the core clock and interface clock. - - clock-names: Must contain "core" for the core clock and "iface" for the - interface clock. -@@ -22,7 +21,7 @@ Example: - compatible = "qcom,adm"; - reg = <0x18300000 0x100000>; - interrupts = <0 170 0>; -- #dma-cells = <2>; -+ #dma-cells = <1>; - - clocks = <&gcc ADM0_CLK>, <&gcc ADM0_PBUS_CLK>; - clock-names = "core", "iface"; -@@ -35,15 +34,12 @@ Example: - qcom,ee = <0>; - }; - --DMA clients must use the format descripted in the dma.txt file, using a three -+DMA clients must use the format descripted in the dma.txt file, using a two - cell specifier for each channel. - --Each dmas request consists of 3 cells: -+Each dmas request consists of two cells: - 1. phandle pointing to the DMA controller - 2. channel number -- 3. CRCI assignment, if applicable. If no CRCI flow control is required, use 0. -- The CRCI is used for flow control. It identifies the peripheral device that -- is the source/destination for the transferred data. - - Example: - -@@ -56,7 +52,7 @@ Example: - - cs-gpios = <&qcom_pinmux 20 0>; - -- dmas = <&adm_dma 6 9>, -- <&adm_dma 5 10>; -+ dmas = <&adm_dma 6>, -+ <&adm_dma 5>; - dma-names = "rx", "tx"; - }; diff --git a/target/linux/ipq806x/patches-4.9/0002-dmaengine-Add-ADM-driver.patch b/target/linux/ipq806x/patches-4.9/0002-dmaengine-Add-ADM-driver.patch deleted file mode 100644 index 4ad025c9c..000000000 --- a/target/linux/ipq806x/patches-4.9/0002-dmaengine-Add-ADM-driver.patch +++ /dev/null @@ -1,966 +0,0 @@ -From 563fa24db4e529c5a3311928d73a8a90531ee527 Mon Sep 17 00:00:00 2001 -From: Thomas Pedersen -Date: Mon, 16 May 2016 17:58:51 -0700 -Subject: [PATCH 02/69] dmaengine: Add ADM driver - -Original patch by Andy Gross. - -Add the DMA engine driver for the QCOM Application Data Mover (ADM) DMA -controller found in the MSM8x60 and IPQ/APQ8064 platforms. - -The ADM supports both memory to memory transactions and memory -to/from peripheral device transactions. The controller also provides flow -control capabilities for transactions to/from peripheral devices. - -The initial release of this driver supports slave transfers to/from peripherals -and also incorporates CRCI (client rate control interface) flow control. - -Signed-off-by: Andy Gross -Signed-off-by: Thomas Pedersen ---- - drivers/dma/qcom/Kconfig | 10 + - drivers/dma/qcom/Makefile | 1 + - drivers/dma/qcom/qcom_adm.c | 900 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 911 insertions(+) - create mode 100644 drivers/dma/qcom/qcom_adm.c - ---- a/drivers/dma/qcom/Kconfig -+++ b/drivers/dma/qcom/Kconfig -@@ -27,3 +27,13 @@ config QCOM_HIDMA - (user to kernel, kernel to kernel, etc.). It only supports - memcpy interface. The core is not intended for general - purpose slave DMA. -+ -+config QCOM_ADM -+ tristate "Qualcomm ADM support" -+ depends on ARCH_QCOM || (COMPILE_TEST && OF && ARM) -+ select DMA_ENGINE -+ select DMA_VIRTUAL_CHANNELS -+ ---help--- -+ Enable support for the Qualcomm ADM DMA controller. This controller -+ provides DMA capabilities for both general purpose and on-chip -+ peripheral devices. ---- a/drivers/dma/qcom/Makefile -+++ b/drivers/dma/qcom/Makefile -@@ -3,3 +3,4 @@ obj-$(CONFIG_QCOM_HIDMA_MGMT) += hdma_mg - hdma_mgmt-objs := hidma_mgmt.o hidma_mgmt_sys.o - obj-$(CONFIG_QCOM_HIDMA) += hdma.o - hdma-objs := hidma_ll.o hidma.o hidma_dbg.o -+obj-$(CONFIG_QCOM_ADM) += qcom_adm.o ---- /dev/null -+++ b/drivers/dma/qcom/qcom_adm.c -@@ -0,0 +1,914 @@ -+/* -+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../dmaengine.h" -+#include "../virt-dma.h" -+ -+/* ADM registers - calculated from channel number and security domain */ -+#define ADM_CHAN_MULTI 0x4 -+#define ADM_CI_MULTI 0x4 -+#define ADM_CRCI_MULTI 0x4 -+#define ADM_EE_MULTI 0x800 -+#define ADM_CHAN_OFFS(chan) (ADM_CHAN_MULTI * chan) -+#define ADM_EE_OFFS(ee) (ADM_EE_MULTI * ee) -+#define ADM_CHAN_EE_OFFS(chan, ee) (ADM_CHAN_OFFS(chan) + ADM_EE_OFFS(ee)) -+#define ADM_CHAN_OFFS(chan) (ADM_CHAN_MULTI * chan) -+#define ADM_CI_OFFS(ci) (ADM_CHAN_OFF(ci)) -+#define ADM_CH_CMD_PTR(chan, ee) (ADM_CHAN_EE_OFFS(chan, ee)) -+#define ADM_CH_RSLT(chan, ee) (0x40 + ADM_CHAN_EE_OFFS(chan, ee)) -+#define ADM_CH_FLUSH_STATE0(chan, ee) (0x80 + ADM_CHAN_EE_OFFS(chan, ee)) -+#define ADM_CH_STATUS_SD(chan, ee) (0x200 + ADM_CHAN_EE_OFFS(chan, ee)) -+#define ADM_CH_CONF(chan) (0x240 + ADM_CHAN_OFFS(chan)) -+#define ADM_CH_RSLT_CONF(chan, ee) (0x300 + ADM_CHAN_EE_OFFS(chan, ee)) -+#define ADM_SEC_DOMAIN_IRQ_STATUS(ee) (0x380 + ADM_EE_OFFS(ee)) -+#define ADM_CI_CONF(ci) (0x390 + ci * ADM_CI_MULTI) -+#define ADM_GP_CTL 0x3d8 -+#define ADM_CRCI_CTL(crci, ee) (0x400 + crci * ADM_CRCI_MULTI + \ -+ ADM_EE_OFFS(ee)) -+ -+/* channel status */ -+#define ADM_CH_STATUS_VALID BIT(1) -+ -+/* channel result */ -+#define ADM_CH_RSLT_VALID BIT(31) -+#define ADM_CH_RSLT_ERR BIT(3) -+#define ADM_CH_RSLT_FLUSH BIT(2) -+#define ADM_CH_RSLT_TPD BIT(1) -+ -+/* channel conf */ -+#define ADM_CH_CONF_SHADOW_EN BIT(12) -+#define ADM_CH_CONF_MPU_DISABLE BIT(11) -+#define ADM_CH_CONF_PERM_MPU_CONF BIT(9) -+#define ADM_CH_CONF_FORCE_RSLT_EN BIT(7) -+#define ADM_CH_CONF_SEC_DOMAIN(ee) (((ee & 0x3) << 4) | ((ee & 0x4) << 11)) -+ -+/* channel result conf */ -+#define ADM_CH_RSLT_CONF_FLUSH_EN BIT(1) -+#define ADM_CH_RSLT_CONF_IRQ_EN BIT(0) -+ -+/* CRCI CTL */ -+#define ADM_CRCI_CTL_MUX_SEL BIT(18) -+#define ADM_CRCI_CTL_RST BIT(17) -+ -+/* CI configuration */ -+#define ADM_CI_RANGE_END(x) (x << 24) -+#define ADM_CI_RANGE_START(x) (x << 16) -+#define ADM_CI_BURST_4_WORDS BIT(2) -+#define ADM_CI_BURST_8_WORDS BIT(3) -+ -+/* GP CTL */ -+#define ADM_GP_CTL_LP_EN BIT(12) -+#define ADM_GP_CTL_LP_CNT(x) (x << 8) -+ -+/* Command pointer list entry */ -+#define ADM_CPLE_LP BIT(31) -+#define ADM_CPLE_CMD_PTR_LIST BIT(29) -+ -+/* Command list entry */ -+#define ADM_CMD_LC BIT(31) -+#define ADM_CMD_DST_CRCI(n) (((n) & 0xf) << 7) -+#define ADM_CMD_SRC_CRCI(n) (((n) & 0xf) << 3) -+ -+#define ADM_CMD_TYPE_SINGLE 0x0 -+#define ADM_CMD_TYPE_BOX 0x3 -+ -+#define ADM_CRCI_MUX_SEL BIT(4) -+#define ADM_DESC_ALIGN 8 -+#define ADM_MAX_XFER (SZ_64K-1) -+#define ADM_MAX_ROWS (SZ_64K-1) -+#define ADM_MAX_CHANNELS 16 -+ -+struct adm_desc_hw_box { -+ u32 cmd; -+ u32 src_addr; -+ u32 dst_addr; -+ u32 row_len; -+ u32 num_rows; -+ u32 row_offset; -+}; -+ -+struct adm_desc_hw_single { -+ u32 cmd; -+ u32 src_addr; -+ u32 dst_addr; -+ u32 len; -+}; -+ -+struct adm_async_desc { -+ struct virt_dma_desc vd; -+ struct adm_device *adev; -+ -+ size_t length; -+ enum dma_transfer_direction dir; -+ dma_addr_t dma_addr; -+ size_t dma_len; -+ -+ void *cpl; -+ dma_addr_t cp_addr; -+ u32 crci; -+ u32 mux; -+ u32 blk_size; -+}; -+ -+struct adm_chan { -+ struct virt_dma_chan vc; -+ struct adm_device *adev; -+ -+ /* parsed from DT */ -+ u32 id; /* channel id */ -+ -+ struct adm_async_desc *curr_txd; -+ struct dma_slave_config slave; -+ struct list_head node; -+ -+ int error; -+ int initialized; -+}; -+ -+static inline struct adm_chan *to_adm_chan(struct dma_chan *common) -+{ -+ return container_of(common, struct adm_chan, vc.chan); -+} -+ -+struct adm_device { -+ void __iomem *regs; -+ struct device *dev; -+ struct dma_device common; -+ struct device_dma_parameters dma_parms; -+ struct adm_chan *channels; -+ -+ u32 ee; -+ -+ struct clk *core_clk; -+ struct clk *iface_clk; -+ -+ struct reset_control *clk_reset; -+ struct reset_control *c0_reset; -+ struct reset_control *c1_reset; -+ struct reset_control *c2_reset; -+ int irq; -+}; -+ -+/** -+ * adm_free_chan - Frees dma resources associated with the specific channel -+ * -+ * Free all allocated descriptors associated with this channel -+ * -+ */ -+static void adm_free_chan(struct dma_chan *chan) -+{ -+ /* free all queued descriptors */ -+ vchan_free_chan_resources(to_virt_chan(chan)); -+} -+ -+/** -+ * adm_get_blksize - Get block size from burst value -+ * -+ */ -+static int adm_get_blksize(unsigned int burst) -+{ -+ int ret; -+ -+ switch (burst) { -+ case 16: -+ case 32: -+ case 64: -+ case 128: -+ ret = ffs(burst>>4) - 1; -+ break; -+ case 192: -+ ret = 4; -+ break; -+ case 256: -+ ret = 5; -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ -+ return ret; -+} -+ -+/** -+ * adm_process_fc_descriptors - Process descriptors for flow controlled xfers -+ * -+ * @achan: ADM channel -+ * @desc: Descriptor memory pointer -+ * @sg: Scatterlist entry -+ * @crci: CRCI value -+ * @burst: Burst size of transaction -+ * @direction: DMA transfer direction -+ */ -+static void *adm_process_fc_descriptors(struct adm_chan *achan, -+ void *desc, struct scatterlist *sg, u32 crci, u32 burst, -+ enum dma_transfer_direction direction) -+{ -+ struct adm_desc_hw_box *box_desc = NULL; -+ struct adm_desc_hw_single *single_desc; -+ u32 remainder = sg_dma_len(sg); -+ u32 rows, row_offset, crci_cmd; -+ u32 mem_addr = sg_dma_address(sg); -+ u32 *incr_addr = &mem_addr; -+ u32 *src, *dst; -+ -+ if (direction == DMA_DEV_TO_MEM) { -+ crci_cmd = ADM_CMD_SRC_CRCI(crci); -+ row_offset = burst; -+ src = &achan->slave.src_addr; -+ dst = &mem_addr; -+ } else { -+ crci_cmd = ADM_CMD_DST_CRCI(crci); -+ row_offset = burst << 16; -+ src = &mem_addr; -+ dst = &achan->slave.dst_addr; -+ } -+ -+ while (remainder >= burst) { -+ box_desc = desc; -+ box_desc->cmd = ADM_CMD_TYPE_BOX | crci_cmd; -+ box_desc->row_offset = row_offset; -+ box_desc->src_addr = *src; -+ box_desc->dst_addr = *dst; -+ -+ rows = remainder / burst; -+ rows = min_t(u32, rows, ADM_MAX_ROWS); -+ box_desc->num_rows = rows << 16 | rows; -+ box_desc->row_len = burst << 16 | burst; -+ -+ *incr_addr += burst * rows; -+ remainder -= burst * rows; -+ desc += sizeof(*box_desc); -+ } -+ -+ /* if leftover bytes, do one single descriptor */ -+ if (remainder) { -+ single_desc = desc; -+ single_desc->cmd = ADM_CMD_TYPE_SINGLE | crci_cmd; -+ single_desc->len = remainder; -+ single_desc->src_addr = *src; -+ single_desc->dst_addr = *dst; -+ desc += sizeof(*single_desc); -+ -+ if (sg_is_last(sg)) -+ single_desc->cmd |= ADM_CMD_LC; -+ } else { -+ if (box_desc && sg_is_last(sg)) -+ box_desc->cmd |= ADM_CMD_LC; -+ } -+ -+ return desc; -+} -+ -+/** -+ * adm_process_non_fc_descriptors - Process descriptors for non-fc xfers -+ * -+ * @achan: ADM channel -+ * @desc: Descriptor memory pointer -+ * @sg: Scatterlist entry -+ * @direction: DMA transfer direction -+ */ -+static void *adm_process_non_fc_descriptors(struct adm_chan *achan, -+ void *desc, struct scatterlist *sg, -+ enum dma_transfer_direction direction) -+{ -+ struct adm_desc_hw_single *single_desc; -+ u32 remainder = sg_dma_len(sg); -+ u32 mem_addr = sg_dma_address(sg); -+ u32 *incr_addr = &mem_addr; -+ u32 *src, *dst; -+ -+ if (direction == DMA_DEV_TO_MEM) { -+ src = &achan->slave.src_addr; -+ dst = &mem_addr; -+ } else { -+ src = &mem_addr; -+ dst = &achan->slave.dst_addr; -+ } -+ -+ do { -+ single_desc = desc; -+ single_desc->cmd = ADM_CMD_TYPE_SINGLE; -+ single_desc->src_addr = *src; -+ single_desc->dst_addr = *dst; -+ single_desc->len = (remainder > ADM_MAX_XFER) ? -+ ADM_MAX_XFER : remainder; -+ -+ remainder -= single_desc->len; -+ *incr_addr += single_desc->len; -+ desc += sizeof(*single_desc); -+ } while (remainder); -+ -+ /* set last command if this is the end of the whole transaction */ -+ if (sg_is_last(sg)) -+ single_desc->cmd |= ADM_CMD_LC; -+ -+ return desc; -+} -+ -+/** -+ * adm_prep_slave_sg - Prep slave sg transaction -+ * -+ * @chan: dma channel -+ * @sgl: scatter gather list -+ * @sg_len: length of sg -+ * @direction: DMA transfer direction -+ * @flags: DMA flags -+ * @context: transfer context (unused) -+ */ -+static struct dma_async_tx_descriptor *adm_prep_slave_sg(struct dma_chan *chan, -+ struct scatterlist *sgl, unsigned int sg_len, -+ enum dma_transfer_direction direction, unsigned long flags, -+ void *context) -+{ -+ struct adm_chan *achan = to_adm_chan(chan); -+ struct adm_device *adev = achan->adev; -+ struct adm_async_desc *async_desc; -+ struct scatterlist *sg; -+ dma_addr_t cple_addr; -+ u32 i, burst; -+ u32 single_count = 0, box_count = 0, crci = 0; -+ void *desc; -+ u32 *cple; -+ int blk_size = 0; -+ -+ if (!is_slave_direction(direction)) { -+ dev_err(adev->dev, "invalid dma direction\n"); -+ return NULL; -+ } -+ -+ /* -+ * get burst value from slave configuration -+ */ -+ burst = (direction == DMA_MEM_TO_DEV) ? -+ achan->slave.dst_maxburst : -+ achan->slave.src_maxburst; -+ -+ /* if using flow control, validate burst and crci values */ -+ if (achan->slave.device_fc) { -+ -+ blk_size = adm_get_blksize(burst); -+ if (blk_size < 0) { -+ dev_err(adev->dev, "invalid burst value: %d\n", -+ burst); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ crci = achan->slave.slave_id & 0xf; -+ if (!crci || achan->slave.slave_id > 0x1f) { -+ dev_err(adev->dev, "invalid crci value\n"); -+ return ERR_PTR(-EINVAL); -+ } -+ } -+ -+ /* iterate through sgs and compute allocation size of structures */ -+ for_each_sg(sgl, sg, sg_len, i) { -+ if (achan->slave.device_fc) { -+ box_count += DIV_ROUND_UP(sg_dma_len(sg) / burst, -+ ADM_MAX_ROWS); -+ if (sg_dma_len(sg) % burst) -+ single_count++; -+ } else { -+ single_count += DIV_ROUND_UP(sg_dma_len(sg), -+ ADM_MAX_XFER); -+ } -+ } -+ -+ async_desc = kzalloc(sizeof(*async_desc), GFP_ATOMIC); -+ if (!async_desc) -+ return ERR_PTR(-ENOMEM); -+ -+ if (crci) -+ async_desc->mux = achan->slave.slave_id & ADM_CRCI_MUX_SEL ? -+ ADM_CRCI_CTL_MUX_SEL : 0; -+ async_desc->crci = crci; -+ async_desc->blk_size = blk_size; -+ async_desc->dma_len = single_count * sizeof(struct adm_desc_hw_single) + -+ box_count * sizeof(struct adm_desc_hw_box) + -+ sizeof(*cple) + 2 * ADM_DESC_ALIGN; -+ -+ async_desc->cpl = kzalloc(async_desc->dma_len, GFP_ATOMIC); -+ if (!async_desc->cpl) -+ goto free; -+ -+ async_desc->adev = adev; -+ -+ /* both command list entry and descriptors must be 8 byte aligned */ -+ cple = PTR_ALIGN(async_desc->cpl, ADM_DESC_ALIGN); -+ desc = PTR_ALIGN(cple + 1, ADM_DESC_ALIGN); -+ -+ for_each_sg(sgl, sg, sg_len, i) { -+ async_desc->length += sg_dma_len(sg); -+ -+ if (achan->slave.device_fc) -+ desc = adm_process_fc_descriptors(achan, desc, sg, crci, -+ burst, direction); -+ else -+ desc = adm_process_non_fc_descriptors(achan, desc, sg, -+ direction); -+ } -+ -+ async_desc->dma_addr = dma_map_single(adev->dev, async_desc->cpl, -+ async_desc->dma_len, -+ DMA_TO_DEVICE); -+ if (dma_mapping_error(adev->dev, async_desc->dma_addr)) -+ goto free; -+ -+ cple_addr = async_desc->dma_addr + ((void *)cple - async_desc->cpl); -+ -+ /* init cmd list */ -+ dma_sync_single_for_cpu(adev->dev, cple_addr, sizeof(*cple), -+ DMA_TO_DEVICE); -+ *cple = ADM_CPLE_LP; -+ *cple |= (async_desc->dma_addr + ADM_DESC_ALIGN) >> 3; -+ dma_sync_single_for_device(adev->dev, cple_addr, sizeof(*cple), -+ DMA_TO_DEVICE); -+ -+ return vchan_tx_prep(&achan->vc, &async_desc->vd, flags); -+ -+free: -+ kfree(async_desc); -+ return ERR_PTR(-ENOMEM); -+} -+ -+/** -+ * adm_terminate_all - terminate all transactions on a channel -+ * @achan: adm dma channel -+ * -+ * Dequeues and frees all transactions, aborts current transaction -+ * No callbacks are done -+ * -+ */ -+static int adm_terminate_all(struct dma_chan *chan) -+{ -+ struct adm_chan *achan = to_adm_chan(chan); -+ struct adm_device *adev = achan->adev; -+ unsigned long flags; -+ LIST_HEAD(head); -+ -+ spin_lock_irqsave(&achan->vc.lock, flags); -+ vchan_get_all_descriptors(&achan->vc, &head); -+ -+ /* send flush command to terminate current transaction */ -+ writel_relaxed(0x0, -+ adev->regs + ADM_CH_FLUSH_STATE0(achan->id, adev->ee)); -+ -+ spin_unlock_irqrestore(&achan->vc.lock, flags); -+ -+ vchan_dma_desc_free_list(&achan->vc, &head); -+ -+ return 0; -+} -+ -+static int adm_slave_config(struct dma_chan *chan, struct dma_slave_config *cfg) -+{ -+ struct adm_chan *achan = to_adm_chan(chan); -+ unsigned long flag; -+ -+ spin_lock_irqsave(&achan->vc.lock, flag); -+ memcpy(&achan->slave, cfg, sizeof(struct dma_slave_config)); -+ spin_unlock_irqrestore(&achan->vc.lock, flag); -+ -+ return 0; -+} -+ -+/** -+ * adm_start_dma - start next transaction -+ * @achan - ADM dma channel -+ */ -+static void adm_start_dma(struct adm_chan *achan) -+{ -+ struct virt_dma_desc *vd = vchan_next_desc(&achan->vc); -+ struct adm_device *adev = achan->adev; -+ struct adm_async_desc *async_desc; -+ -+ lockdep_assert_held(&achan->vc.lock); -+ -+ if (!vd) -+ return; -+ -+ list_del(&vd->node); -+ -+ /* write next command list out to the CMD FIFO */ -+ async_desc = container_of(vd, struct adm_async_desc, vd); -+ achan->curr_txd = async_desc; -+ -+ /* reset channel error */ -+ achan->error = 0; -+ -+ if (!achan->initialized) { -+ /* enable interrupts */ -+ writel(ADM_CH_CONF_SHADOW_EN | -+ ADM_CH_CONF_PERM_MPU_CONF | -+ ADM_CH_CONF_MPU_DISABLE | -+ ADM_CH_CONF_SEC_DOMAIN(adev->ee), -+ adev->regs + ADM_CH_CONF(achan->id)); -+ -+ writel(ADM_CH_RSLT_CONF_IRQ_EN | ADM_CH_RSLT_CONF_FLUSH_EN, -+ adev->regs + ADM_CH_RSLT_CONF(achan->id, adev->ee)); -+ -+ achan->initialized = 1; -+ } -+ -+ /* set the crci block size if this transaction requires CRCI */ -+ if (async_desc->crci) { -+ writel(async_desc->mux | async_desc->blk_size, -+ adev->regs + ADM_CRCI_CTL(async_desc->crci, adev->ee)); -+ } -+ -+ /* make sure IRQ enable doesn't get reordered */ -+ wmb(); -+ -+ /* write next command list out to the CMD FIFO */ -+ writel(ALIGN(async_desc->dma_addr, ADM_DESC_ALIGN) >> 3, -+ adev->regs + ADM_CH_CMD_PTR(achan->id, adev->ee)); -+} -+ -+/** -+ * adm_dma_irq - irq handler for ADM controller -+ * @irq: IRQ of interrupt -+ * @data: callback data -+ * -+ * IRQ handler for the bam controller -+ */ -+static irqreturn_t adm_dma_irq(int irq, void *data) -+{ -+ struct adm_device *adev = data; -+ u32 srcs, i; -+ struct adm_async_desc *async_desc; -+ unsigned long flags; -+ -+ srcs = readl_relaxed(adev->regs + -+ ADM_SEC_DOMAIN_IRQ_STATUS(adev->ee)); -+ -+ for (i = 0; i < ADM_MAX_CHANNELS; i++) { -+ struct adm_chan *achan = &adev->channels[i]; -+ u32 status, result; -+ -+ if (srcs & BIT(i)) { -+ status = readl_relaxed(adev->regs + -+ ADM_CH_STATUS_SD(i, adev->ee)); -+ -+ /* if no result present, skip */ -+ if (!(status & ADM_CH_STATUS_VALID)) -+ continue; -+ -+ result = readl_relaxed(adev->regs + -+ ADM_CH_RSLT(i, adev->ee)); -+ -+ /* no valid results, skip */ -+ if (!(result & ADM_CH_RSLT_VALID)) -+ continue; -+ -+ /* flag error if transaction was flushed or failed */ -+ if (result & (ADM_CH_RSLT_ERR | ADM_CH_RSLT_FLUSH)) -+ achan->error = 1; -+ -+ spin_lock_irqsave(&achan->vc.lock, flags); -+ async_desc = achan->curr_txd; -+ -+ achan->curr_txd = NULL; -+ -+ if (async_desc) { -+ vchan_cookie_complete(&async_desc->vd); -+ -+ /* kick off next DMA */ -+ adm_start_dma(achan); -+ } -+ -+ spin_unlock_irqrestore(&achan->vc.lock, flags); -+ } -+ } -+ -+ return IRQ_HANDLED; -+} -+ -+/** -+ * adm_tx_status - returns status of transaction -+ * @chan: dma channel -+ * @cookie: transaction cookie -+ * @txstate: DMA transaction state -+ * -+ * Return status of dma transaction -+ */ -+static enum dma_status adm_tx_status(struct dma_chan *chan, dma_cookie_t cookie, -+ struct dma_tx_state *txstate) -+{ -+ struct adm_chan *achan = to_adm_chan(chan); -+ struct virt_dma_desc *vd; -+ enum dma_status ret; -+ unsigned long flags; -+ size_t residue = 0; -+ -+ ret = dma_cookie_status(chan, cookie, txstate); -+ if (ret == DMA_COMPLETE || !txstate) -+ return ret; -+ -+ spin_lock_irqsave(&achan->vc.lock, flags); -+ -+ vd = vchan_find_desc(&achan->vc, cookie); -+ if (vd) -+ residue = container_of(vd, struct adm_async_desc, vd)->length; -+ -+ spin_unlock_irqrestore(&achan->vc.lock, flags); -+ -+ /* -+ * residue is either the full length if it is in the issued list, or 0 -+ * if it is in progress. We have no reliable way of determining -+ * anything inbetween -+ */ -+ dma_set_residue(txstate, residue); -+ -+ if (achan->error) -+ return DMA_ERROR; -+ -+ return ret; -+} -+ -+/** -+ * adm_issue_pending - starts pending transactions -+ * @chan: dma channel -+ * -+ * Issues all pending transactions and starts DMA -+ */ -+static void adm_issue_pending(struct dma_chan *chan) -+{ -+ struct adm_chan *achan = to_adm_chan(chan); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&achan->vc.lock, flags); -+ -+ if (vchan_issue_pending(&achan->vc) && !achan->curr_txd) -+ adm_start_dma(achan); -+ spin_unlock_irqrestore(&achan->vc.lock, flags); -+} -+ -+/** -+ * adm_dma_free_desc - free descriptor memory -+ * @vd: virtual descriptor -+ * -+ */ -+static void adm_dma_free_desc(struct virt_dma_desc *vd) -+{ -+ struct adm_async_desc *async_desc = container_of(vd, -+ struct adm_async_desc, vd); -+ -+ dma_unmap_single(async_desc->adev->dev, async_desc->dma_addr, -+ async_desc->dma_len, DMA_TO_DEVICE); -+ kfree(async_desc->cpl); -+ kfree(async_desc); -+} -+ -+static void adm_channel_init(struct adm_device *adev, struct adm_chan *achan, -+ u32 index) -+{ -+ achan->id = index; -+ achan->adev = adev; -+ -+ vchan_init(&achan->vc, &adev->common); -+ achan->vc.desc_free = adm_dma_free_desc; -+} -+ -+static int adm_dma_probe(struct platform_device *pdev) -+{ -+ struct adm_device *adev; -+ struct resource *iores; -+ int ret; -+ u32 i; -+ -+ adev = devm_kzalloc(&pdev->dev, sizeof(*adev), GFP_KERNEL); -+ if (!adev) -+ return -ENOMEM; -+ -+ adev->dev = &pdev->dev; -+ -+ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ adev->regs = devm_ioremap_resource(&pdev->dev, iores); -+ if (IS_ERR(adev->regs)) -+ return PTR_ERR(adev->regs); -+ -+ adev->irq = platform_get_irq(pdev, 0); -+ if (adev->irq < 0) -+ return adev->irq; -+ -+ ret = of_property_read_u32(pdev->dev.of_node, "qcom,ee", &adev->ee); -+ if (ret) { -+ dev_err(adev->dev, "Execution environment unspecified\n"); -+ return ret; -+ } -+ -+ adev->core_clk = devm_clk_get(adev->dev, "core"); -+ if (IS_ERR(adev->core_clk)) -+ return PTR_ERR(adev->core_clk); -+ -+ ret = clk_prepare_enable(adev->core_clk); -+ if (ret) { -+ dev_err(adev->dev, "failed to prepare/enable core clock\n"); -+ return ret; -+ } -+ -+ adev->iface_clk = devm_clk_get(adev->dev, "iface"); -+ if (IS_ERR(adev->iface_clk)) { -+ ret = PTR_ERR(adev->iface_clk); -+ goto err_disable_core_clk; -+ } -+ -+ ret = clk_prepare_enable(adev->iface_clk); -+ if (ret) { -+ dev_err(adev->dev, "failed to prepare/enable iface clock\n"); -+ goto err_disable_core_clk; -+ } -+ -+ adev->clk_reset = devm_reset_control_get(&pdev->dev, "clk"); -+ if (IS_ERR(adev->clk_reset)) { -+ dev_err(adev->dev, "failed to get ADM0 reset\n"); -+ ret = PTR_ERR(adev->clk_reset); -+ goto err_disable_clks; -+ } -+ -+ adev->c0_reset = devm_reset_control_get(&pdev->dev, "c0"); -+ if (IS_ERR(adev->c0_reset)) { -+ dev_err(adev->dev, "failed to get ADM0 C0 reset\n"); -+ ret = PTR_ERR(adev->c0_reset); -+ goto err_disable_clks; -+ } -+ -+ adev->c1_reset = devm_reset_control_get(&pdev->dev, "c1"); -+ if (IS_ERR(adev->c1_reset)) { -+ dev_err(adev->dev, "failed to get ADM0 C1 reset\n"); -+ ret = PTR_ERR(adev->c1_reset); -+ goto err_disable_clks; -+ } -+ -+ adev->c2_reset = devm_reset_control_get(&pdev->dev, "c2"); -+ if (IS_ERR(adev->c2_reset)) { -+ dev_err(adev->dev, "failed to get ADM0 C2 reset\n"); -+ ret = PTR_ERR(adev->c2_reset); -+ goto err_disable_clks; -+ } -+ -+ reset_control_assert(adev->clk_reset); -+ reset_control_assert(adev->c0_reset); -+ reset_control_assert(adev->c1_reset); -+ reset_control_assert(adev->c2_reset); -+ -+ reset_control_deassert(adev->clk_reset); -+ reset_control_deassert(adev->c0_reset); -+ reset_control_deassert(adev->c1_reset); -+ reset_control_deassert(adev->c2_reset); -+ -+ adev->channels = devm_kcalloc(adev->dev, ADM_MAX_CHANNELS, -+ sizeof(*adev->channels), GFP_KERNEL); -+ -+ if (!adev->channels) { -+ ret = -ENOMEM; -+ goto err_disable_clks; -+ } -+ -+ /* allocate and initialize channels */ -+ INIT_LIST_HEAD(&adev->common.channels); -+ -+ for (i = 0; i < ADM_MAX_CHANNELS; i++) -+ adm_channel_init(adev, &adev->channels[i], i); -+ -+ /* reset CRCIs */ -+ for (i = 0; i < 16; i++) -+ writel(ADM_CRCI_CTL_RST, adev->regs + -+ ADM_CRCI_CTL(i, adev->ee)); -+ -+ /* configure client interfaces */ -+ writel(ADM_CI_RANGE_START(0x40) | ADM_CI_RANGE_END(0xb0) | -+ ADM_CI_BURST_8_WORDS, adev->regs + ADM_CI_CONF(0)); -+ writel(ADM_CI_RANGE_START(0x2a) | ADM_CI_RANGE_END(0x2c) | -+ ADM_CI_BURST_8_WORDS, adev->regs + ADM_CI_CONF(1)); -+ writel(ADM_CI_RANGE_START(0x12) | ADM_CI_RANGE_END(0x28) | -+ ADM_CI_BURST_8_WORDS, adev->regs + ADM_CI_CONF(2)); -+ writel(ADM_GP_CTL_LP_EN | ADM_GP_CTL_LP_CNT(0xf), -+ adev->regs + ADM_GP_CTL); -+ -+ ret = devm_request_irq(adev->dev, adev->irq, adm_dma_irq, -+ 0, "adm_dma", adev); -+ if (ret) -+ goto err_disable_clks; -+ -+ platform_set_drvdata(pdev, adev); -+ -+ adev->common.dev = adev->dev; -+ adev->common.dev->dma_parms = &adev->dma_parms; -+ -+ /* set capabilities */ -+ dma_cap_zero(adev->common.cap_mask); -+ dma_cap_set(DMA_SLAVE, adev->common.cap_mask); -+ dma_cap_set(DMA_PRIVATE, adev->common.cap_mask); -+ -+ /* initialize dmaengine apis */ -+ adev->common.directions = BIT(DMA_DEV_TO_MEM | DMA_MEM_TO_DEV); -+ adev->common.residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR; -+ adev->common.src_addr_widths = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ adev->common.dst_addr_widths = DMA_SLAVE_BUSWIDTH_4_BYTES; -+ adev->common.device_free_chan_resources = adm_free_chan; -+ adev->common.device_prep_slave_sg = adm_prep_slave_sg; -+ adev->common.device_issue_pending = adm_issue_pending; -+ adev->common.device_tx_status = adm_tx_status; -+ adev->common.device_terminate_all = adm_terminate_all; -+ adev->common.device_config = adm_slave_config; -+ -+ ret = dma_async_device_register(&adev->common); -+ if (ret) { -+ dev_err(adev->dev, "failed to register dma async device\n"); -+ goto err_disable_clks; -+ } -+ -+ ret = of_dma_controller_register(pdev->dev.of_node, -+ of_dma_xlate_by_chan_id, -+ &adev->common); -+ if (ret) -+ goto err_unregister_dma; -+ -+ return 0; -+ -+err_unregister_dma: -+ dma_async_device_unregister(&adev->common); -+err_disable_clks: -+ clk_disable_unprepare(adev->iface_clk); -+err_disable_core_clk: -+ clk_disable_unprepare(adev->core_clk); -+ -+ return ret; -+} -+ -+static int adm_dma_remove(struct platform_device *pdev) -+{ -+ struct adm_device *adev = platform_get_drvdata(pdev); -+ struct adm_chan *achan; -+ u32 i; -+ -+ of_dma_controller_free(pdev->dev.of_node); -+ dma_async_device_unregister(&adev->common); -+ -+ for (i = 0; i < ADM_MAX_CHANNELS; i++) { -+ achan = &adev->channels[i]; -+ -+ /* mask IRQs for this channel/EE pair */ -+ writel(0, adev->regs + ADM_CH_RSLT_CONF(achan->id, adev->ee)); -+ -+ adm_terminate_all(&adev->channels[i].vc.chan); -+ } -+ -+ devm_free_irq(adev->dev, adev->irq, adev); -+ -+ clk_disable_unprepare(adev->core_clk); -+ clk_disable_unprepare(adev->iface_clk); -+ -+ return 0; -+} -+ -+static const struct of_device_id adm_of_match[] = { -+ { .compatible = "qcom,adm", }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, adm_of_match); -+ -+static struct platform_driver adm_dma_driver = { -+ .probe = adm_dma_probe, -+ .remove = adm_dma_remove, -+ .driver = { -+ .name = "adm-dma-engine", -+ .of_match_table = adm_of_match, -+ }, -+}; -+ -+module_platform_driver(adm_dma_driver); -+ -+MODULE_AUTHOR("Andy Gross "); -+MODULE_DESCRIPTION("QCOM ADM DMA engine driver"); -+MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ipq806x/patches-4.9/0003-spi-qup-Make-sure-mode-is-only-determined-once.patch b/target/linux/ipq806x/patches-4.9/0003-spi-qup-Make-sure-mode-is-only-determined-once.patch deleted file mode 100644 index fd9df4448..000000000 --- a/target/linux/ipq806x/patches-4.9/0003-spi-qup-Make-sure-mode-is-only-determined-once.patch +++ /dev/null @@ -1,208 +0,0 @@ -From 57c4d2626bcb990a2e677b4f769a88c3d8e0911d Mon Sep 17 00:00:00 2001 -From: Andy Gross -Date: Tue, 12 Apr 2016 09:11:47 -0500 -Subject: [PATCH 03/69] spi: qup: Make sure mode is only determined once - -This patch calculates the mode once. All decisions on the current -transaction -is made using the mode instead of use_dma - -Signed-off-by: Andy Gross ---- - drivers/spi/spi-qup.c | 87 ++++++++++++++++++++++----------------------------- - 1 file changed, 37 insertions(+), 50 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -149,12 +149,20 @@ struct spi_qup { - int rx_bytes; - int qup_v1; - -- int use_dma; -+ int mode; - struct dma_slave_config rx_conf; - struct dma_slave_config tx_conf; - }; - - -+static inline bool spi_qup_is_dma_xfer(int mode) -+{ -+ if (mode == QUP_IO_M_MODE_DMOV || mode == QUP_IO_M_MODE_BAM) -+ return true; -+ -+ return false; -+} -+ - static inline bool spi_qup_is_valid_state(struct spi_qup *controller) - { - u32 opstate = readl_relaxed(controller->base + QUP_STATE); -@@ -424,7 +432,7 @@ static irqreturn_t spi_qup_qup_irq(int i - error = -EIO; - } - -- if (!controller->use_dma) { -+ if (!spi_qup_is_dma_xfer(controller->mode)) { - if (opflags & QUP_OP_IN_SERVICE_FLAG) - spi_qup_fifo_read(controller, xfer); - -@@ -443,34 +451,11 @@ static irqreturn_t spi_qup_qup_irq(int i - return IRQ_HANDLED; - } - --static u32 --spi_qup_get_mode(struct spi_master *master, struct spi_transfer *xfer) --{ -- struct spi_qup *qup = spi_master_get_devdata(master); -- u32 mode; -- -- qup->w_size = 4; -- -- if (xfer->bits_per_word <= 8) -- qup->w_size = 1; -- else if (xfer->bits_per_word <= 16) -- qup->w_size = 2; -- -- qup->n_words = xfer->len / qup->w_size; -- -- if (qup->n_words <= (qup->in_fifo_sz / sizeof(u32))) -- mode = QUP_IO_M_MODE_FIFO; -- else -- mode = QUP_IO_M_MODE_BLOCK; -- -- return mode; --} -- - /* set clock freq ... bits per word */ - static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) - { - struct spi_qup *controller = spi_master_get_devdata(spi->master); -- u32 config, iomode, mode, control; -+ u32 config, iomode, control; - int ret, n_words; - - if (spi->mode & SPI_LOOP && xfer->len > controller->in_fifo_sz) { -@@ -491,23 +476,22 @@ static int spi_qup_io_config(struct spi_ - return -EIO; - } - -- mode = spi_qup_get_mode(spi->master, xfer); -+ controller->w_size = DIV_ROUND_UP(xfer->bits_per_word, 8); -+ controller->n_words = xfer->len / controller->w_size; - n_words = controller->n_words; - -- if (mode == QUP_IO_M_MODE_FIFO) { -+ if (n_words <= (controller->in_fifo_sz / sizeof(u32))) { -+ controller->mode = QUP_IO_M_MODE_FIFO; - writel_relaxed(n_words, controller->base + QUP_MX_READ_CNT); - writel_relaxed(n_words, controller->base + QUP_MX_WRITE_CNT); - /* must be zero for FIFO */ - writel_relaxed(0, controller->base + QUP_MX_INPUT_CNT); - writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -- } else if (!controller->use_dma) { -- writel_relaxed(n_words, controller->base + QUP_MX_INPUT_CNT); -- writel_relaxed(n_words, controller->base + QUP_MX_OUTPUT_CNT); -- /* must be zero for BLOCK and BAM */ -- writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -- writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -- } else { -- mode = QUP_IO_M_MODE_BAM; -+ -+ } else if (spi->master->can_dma && -+ spi->master->can_dma(spi->master, spi, xfer) && -+ spi->master->cur_msg_mapped) { -+ controller->mode = QUP_IO_M_MODE_BAM; - writel_relaxed(0, controller->base + QUP_MX_READ_CNT); - writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); - -@@ -528,19 +512,26 @@ static int spi_qup_io_config(struct spi_ - - writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); - } -+ } else { -+ controller->mode = QUP_IO_M_MODE_BLOCK; -+ writel_relaxed(n_words, controller->base + QUP_MX_INPUT_CNT); -+ writel_relaxed(n_words, controller->base + QUP_MX_OUTPUT_CNT); -+ /* must be zero for BLOCK and BAM */ -+ writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -+ writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); - } - - iomode = readl_relaxed(controller->base + QUP_IO_M_MODES); - /* Set input and output transfer mode */ - iomode &= ~(QUP_IO_M_INPUT_MODE_MASK | QUP_IO_M_OUTPUT_MODE_MASK); - -- if (!controller->use_dma) -+ if (!spi_qup_is_dma_xfer(controller->mode)) - iomode &= ~(QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN); - else - iomode |= QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN; - -- iomode |= (mode << QUP_IO_M_OUTPUT_MODE_MASK_SHIFT); -- iomode |= (mode << QUP_IO_M_INPUT_MODE_MASK_SHIFT); -+ iomode |= (controller->mode << QUP_IO_M_OUTPUT_MODE_MASK_SHIFT); -+ iomode |= (controller->mode << QUP_IO_M_INPUT_MODE_MASK_SHIFT); - - writel_relaxed(iomode, controller->base + QUP_IO_M_MODES); - -@@ -581,7 +572,7 @@ static int spi_qup_io_config(struct spi_ - config |= xfer->bits_per_word - 1; - config |= QUP_CONFIG_SPI_MODE; - -- if (controller->use_dma) { -+ if (spi_qup_is_dma_xfer(controller->mode)) { - if (!xfer->tx_buf) - config |= QUP_CONFIG_NO_OUTPUT; - if (!xfer->rx_buf) -@@ -599,7 +590,7 @@ static int spi_qup_io_config(struct spi_ - * status change in BAM mode - */ - -- if (mode == QUP_IO_M_MODE_BAM) -+ if (spi_qup_is_dma_xfer(controller->mode)) - mask = QUP_OP_IN_SERVICE_FLAG | QUP_OP_OUT_SERVICE_FLAG; - - writel_relaxed(mask, controller->base + QUP_OPERATIONAL_MASK); -@@ -633,7 +624,7 @@ static int spi_qup_transfer_one(struct s - controller->tx_bytes = 0; - spin_unlock_irqrestore(&controller->lock, flags); - -- if (controller->use_dma) -+ if (spi_qup_is_dma_xfer(controller->mode)) - ret = spi_qup_do_dma(master, xfer); - else - ret = spi_qup_do_pio(master, xfer); -@@ -657,7 +648,7 @@ exit: - ret = controller->error; - spin_unlock_irqrestore(&controller->lock, flags); - -- if (ret && controller->use_dma) -+ if (ret && spi_qup_is_dma_xfer(controller->mode)) - spi_qup_dma_terminate(master, xfer); - - return ret; -@@ -668,9 +659,7 @@ static bool spi_qup_can_dma(struct spi_m - { - struct spi_qup *qup = spi_master_get_devdata(master); - size_t dma_align = dma_get_cache_alignment(); -- u32 mode; -- -- qup->use_dma = 0; -+ int n_words; - - if (xfer->rx_buf && (xfer->len % qup->in_blk_sz || - IS_ERR_OR_NULL(master->dma_rx) || -@@ -682,12 +671,10 @@ static bool spi_qup_can_dma(struct spi_m - !IS_ALIGNED((size_t)xfer->tx_buf, dma_align))) - return false; - -- mode = spi_qup_get_mode(master, xfer); -- if (mode == QUP_IO_M_MODE_FIFO) -+ n_words = xfer->len / DIV_ROUND_UP(xfer->bits_per_word, 8); -+ if (n_words <= (qup->in_fifo_sz / sizeof(u32))) - return false; - -- qup->use_dma = 1; -- - return true; - } - diff --git a/target/linux/ipq806x/patches-4.9/0004-spi-qup-Fix-transaction-done-signaling.patch b/target/linux/ipq806x/patches-4.9/0004-spi-qup-Fix-transaction-done-signaling.patch deleted file mode 100644 index 5881ffa8b..000000000 --- a/target/linux/ipq806x/patches-4.9/0004-spi-qup-Fix-transaction-done-signaling.patch +++ /dev/null @@ -1,29 +0,0 @@ -From fbdf80d138f8c7fda8e598287109fb90446d557d Mon Sep 17 00:00:00 2001 -From: Andy Gross -Date: Fri, 29 Jan 2016 22:06:50 -0600 -Subject: [PATCH 04/69] spi: qup: Fix transaction done signaling - -Wait to signal done until we get all of the interrupts we are expecting -to get for a transaction. If we don't wait for the input done flag, we -can be inbetween transactions when the done flag comes in and this can -mess up the next transaction. - -CC: Grant Grundler -CC: Sarthak Kukreti -Signed-off-by: Andy Gross ---- - drivers/spi/spi-qup.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -445,7 +445,8 @@ static irqreturn_t spi_qup_qup_irq(int i - controller->xfer = xfer; - spin_unlock_irqrestore(&controller->lock, flags); - -- if (controller->rx_bytes == xfer->len || error) -+ if ((controller->rx_bytes == xfer->len && -+ (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) - complete(&controller->done); - - return IRQ_HANDLED; diff --git a/target/linux/ipq806x/patches-4.9/0005-spi-qup-Fix-DMA-mode-to-work-correctly.patch b/target/linux/ipq806x/patches-4.9/0005-spi-qup-Fix-DMA-mode-to-work-correctly.patch deleted file mode 100644 index 20ab5c180..000000000 --- a/target/linux/ipq806x/patches-4.9/0005-spi-qup-Fix-DMA-mode-to-work-correctly.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 1204ea49f3f7ded898d1ee202776093715a9ecf6 Mon Sep 17 00:00:00 2001 -From: Andy Gross -Date: Tue, 2 Feb 2016 17:00:53 -0600 -Subject: [PATCH 05/69] spi: qup: Fix DMA mode to work correctly - -This patch fixes a few issues with the DMA mode. The QUP needs to be -placed in the run mode before the DMA transactions are executed. The -conditions for being able to DMA vary between revisions of the QUP. -This is due to v1.1.1 using ADM DMA and later revisions using BAM. - -Signed-off-by: Andy Gross ---- - drivers/spi/spi-qup.c | 94 +++++++++++++++++++++++++++++++++------------------ - 1 file changed, 62 insertions(+), 32 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -142,6 +142,7 @@ struct spi_qup { - - struct spi_transfer *xfer; - struct completion done; -+ struct completion dma_tx_done; - int error; - int w_size; /* bytes per SPI word */ - int n_words; -@@ -284,16 +285,16 @@ static void spi_qup_fifo_write(struct sp - - static void spi_qup_dma_done(void *data) - { -- struct spi_qup *qup = data; -+ struct completion *done = data; - -- complete(&qup->done); -+ complete(done); - } - - static int spi_qup_prep_sg(struct spi_master *master, struct spi_transfer *xfer, - enum dma_transfer_direction dir, -- dma_async_tx_callback callback) -+ dma_async_tx_callback callback, -+ void *data) - { -- struct spi_qup *qup = spi_master_get_devdata(master); - unsigned long flags = DMA_PREP_INTERRUPT | DMA_PREP_FENCE; - struct dma_async_tx_descriptor *desc; - struct scatterlist *sgl; -@@ -312,11 +313,11 @@ static int spi_qup_prep_sg(struct spi_ma - } - - desc = dmaengine_prep_slave_sg(chan, sgl, nents, dir, flags); -- if (!desc) -- return -EINVAL; -+ if (IS_ERR_OR_NULL(desc)) -+ return desc ? PTR_ERR(desc) : -EINVAL; - - desc->callback = callback; -- desc->callback_param = qup; -+ desc->callback_param = data; - - cookie = dmaengine_submit(desc); - -@@ -332,18 +333,29 @@ static void spi_qup_dma_terminate(struct - dmaengine_terminate_all(master->dma_rx); - } - --static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer) -+static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer, -+unsigned long timeout) - { -+ struct spi_qup *qup = spi_master_get_devdata(master); - dma_async_tx_callback rx_done = NULL, tx_done = NULL; - int ret; - -+ /* before issuing the descriptors, set the QUP to run */ -+ ret = spi_qup_set_state(qup, QUP_STATE_RUN); -+ if (ret) { -+ dev_warn(qup->dev, "cannot set RUN state\n"); -+ return ret; -+ } -+ - if (xfer->rx_buf) - rx_done = spi_qup_dma_done; -- else if (xfer->tx_buf) -+ -+ if (xfer->tx_buf) - tx_done = spi_qup_dma_done; - - if (xfer->rx_buf) { -- ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done); -+ ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done, -+ &qup->done); - if (ret) - return ret; - -@@ -351,17 +363,25 @@ static int spi_qup_do_dma(struct spi_mas - } - - if (xfer->tx_buf) { -- ret = spi_qup_prep_sg(master, xfer, DMA_MEM_TO_DEV, tx_done); -+ ret = spi_qup_prep_sg(master, xfer, DMA_MEM_TO_DEV, tx_done, -+ &qup->dma_tx_done); - if (ret) - return ret; - - dma_async_issue_pending(master->dma_tx); - } - -- return 0; -+ if (xfer->rx_buf && !wait_for_completion_timeout(&qup->done, timeout)) -+ return -ETIMEDOUT; -+ -+ if (xfer->tx_buf && !wait_for_completion_timeout(&qup->dma_tx_done, timeout)) -+ ret = -ETIMEDOUT; -+ -+ return ret; - } - --static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer) -+static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer, -+ unsigned long timeout) - { - struct spi_qup *qup = spi_master_get_devdata(master); - int ret; -@@ -380,6 +400,15 @@ static int spi_qup_do_pio(struct spi_mas - - spi_qup_fifo_write(qup, xfer); - -+ ret = spi_qup_set_state(qup, QUP_STATE_RUN); -+ if (ret) { -+ dev_warn(qup->dev, "cannot set RUN state\n"); -+ return ret; -+ } -+ -+ if (!wait_for_completion_timeout(&qup->done, timeout)) -+ return -ETIMEDOUT; -+ - return 0; - } - -@@ -428,7 +457,6 @@ static irqreturn_t spi_qup_qup_irq(int i - dev_warn(controller->dev, "CLK_OVER_RUN\n"); - if (spi_err & SPI_ERROR_CLK_UNDER_RUN) - dev_warn(controller->dev, "CLK_UNDER_RUN\n"); -- - error = -EIO; - } - -@@ -617,6 +645,7 @@ static int spi_qup_transfer_one(struct s - timeout = 100 * msecs_to_jiffies(timeout); - - reinit_completion(&controller->done); -+ reinit_completion(&controller->dma_tx_done); - - spin_lock_irqsave(&controller->lock, flags); - controller->xfer = xfer; -@@ -626,21 +655,13 @@ static int spi_qup_transfer_one(struct s - spin_unlock_irqrestore(&controller->lock, flags); - - if (spi_qup_is_dma_xfer(controller->mode)) -- ret = spi_qup_do_dma(master, xfer); -+ ret = spi_qup_do_dma(master, xfer, timeout); - else -- ret = spi_qup_do_pio(master, xfer); -+ ret = spi_qup_do_pio(master, xfer, timeout); - - if (ret) - goto exit; - -- if (spi_qup_set_state(controller, QUP_STATE_RUN)) { -- dev_warn(controller->dev, "cannot set EXECUTE state\n"); -- goto exit; -- } -- -- if (!wait_for_completion_timeout(&controller->done, timeout)) -- ret = -ETIMEDOUT; -- - exit: - spi_qup_set_state(controller, QUP_STATE_RESET); - spin_lock_irqsave(&controller->lock, flags); -@@ -662,15 +683,23 @@ static bool spi_qup_can_dma(struct spi_m - size_t dma_align = dma_get_cache_alignment(); - int n_words; - -- if (xfer->rx_buf && (xfer->len % qup->in_blk_sz || -- IS_ERR_OR_NULL(master->dma_rx) || -- !IS_ALIGNED((size_t)xfer->rx_buf, dma_align))) -- return false; -+ if (xfer->rx_buf) { -+ if (!IS_ALIGNED((size_t)xfer->rx_buf, dma_align) || -+ IS_ERR_OR_NULL(master->dma_rx)) -+ return false; - -- if (xfer->tx_buf && (xfer->len % qup->out_blk_sz || -- IS_ERR_OR_NULL(master->dma_tx) || -- !IS_ALIGNED((size_t)xfer->tx_buf, dma_align))) -- return false; -+ if (qup->qup_v1 && (xfer->len % qup->in_blk_sz)) -+ return false; -+ } -+ -+ if (xfer->tx_buf) { -+ if (!IS_ALIGNED((size_t)xfer->tx_buf, dma_align) || -+ IS_ERR_OR_NULL(master->dma_tx)) -+ return false; -+ -+ if (qup->qup_v1 && (xfer->len % qup->out_blk_sz)) -+ return false; -+ } - - n_words = xfer->len / DIV_ROUND_UP(xfer->bits_per_word, 8); - if (n_words <= (qup->in_fifo_sz / sizeof(u32))) -@@ -836,6 +865,7 @@ static int spi_qup_probe(struct platform - - spin_lock_init(&controller->lock); - init_completion(&controller->done); -+ init_completion(&controller->dma_tx_done); - - iomode = readl_relaxed(base + QUP_IO_M_MODES); - diff --git a/target/linux/ipq806x/patches-4.9/0006-spi-qup-Fix-block-mode-to-work-correctly.patch b/target/linux/ipq806x/patches-4.9/0006-spi-qup-Fix-block-mode-to-work-correctly.patch deleted file mode 100644 index e7d0d656b..000000000 --- a/target/linux/ipq806x/patches-4.9/0006-spi-qup-Fix-block-mode-to-work-correctly.patch +++ /dev/null @@ -1,310 +0,0 @@ -From b56c1e35cc550fd014fa601ca56b964d88fd44a9 Mon Sep 17 00:00:00 2001 -From: Andy Gross -Date: Sun, 31 Jan 2016 21:28:13 -0600 -Subject: [PATCH 06/69] spi: qup: Fix block mode to work correctly - -This patch corrects the behavior of the BLOCK transactions. During block -transactions, the controller must be read/written to in block size transactions. - -Signed-off-by: Andy Gross ---- - drivers/spi/spi-qup.c | 182 +++++++++++++++++++++++++++++++++++++++----------- - 1 file changed, 142 insertions(+), 40 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -82,6 +82,8 @@ - #define QUP_IO_M_MODE_BAM 3 - - /* QUP_OPERATIONAL fields */ -+#define QUP_OP_IN_BLOCK_READ_REQ BIT(13) -+#define QUP_OP_OUT_BLOCK_WRITE_REQ BIT(12) - #define QUP_OP_MAX_INPUT_DONE_FLAG BIT(11) - #define QUP_OP_MAX_OUTPUT_DONE_FLAG BIT(10) - #define QUP_OP_IN_SERVICE_FLAG BIT(9) -@@ -155,6 +157,12 @@ struct spi_qup { - struct dma_slave_config tx_conf; - }; - -+static inline bool spi_qup_is_flag_set(struct spi_qup *controller, u32 flag) -+{ -+ u32 opflag = readl_relaxed(controller->base + QUP_OPERATIONAL); -+ -+ return opflag & flag; -+} - - static inline bool spi_qup_is_dma_xfer(int mode) - { -@@ -216,29 +224,26 @@ static int spi_qup_set_state(struct spi_ - return 0; - } - --static void spi_qup_fifo_read(struct spi_qup *controller, -- struct spi_transfer *xfer) -+static void spi_qup_read_from_fifo(struct spi_qup *controller, -+ struct spi_transfer *xfer, u32 num_words) - { - u8 *rx_buf = xfer->rx_buf; -- u32 word, state; -- int idx, shift, w_size; -- -- w_size = controller->w_size; -+ int i, shift, num_bytes; -+ u32 word; - -- while (controller->rx_bytes < xfer->len) { -- -- state = readl_relaxed(controller->base + QUP_OPERATIONAL); -- if (0 == (state & QUP_OP_IN_FIFO_NOT_EMPTY)) -- break; -+ for (; num_words; num_words--) { - - word = readl_relaxed(controller->base + QUP_INPUT_FIFO); - -+ num_bytes = min_t(int, xfer->len - controller->rx_bytes, -+ controller->w_size); -+ - if (!rx_buf) { -- controller->rx_bytes += w_size; -+ controller->rx_bytes += num_bytes; - continue; - } - -- for (idx = 0; idx < w_size; idx++, controller->rx_bytes++) { -+ for (i = 0; i < num_bytes; i++, controller->rx_bytes++) { - /* - * The data format depends on bytes per SPI word: - * 4 bytes: 0x12345678 -@@ -246,38 +251,80 @@ static void spi_qup_fifo_read(struct spi - * 1 byte : 0x00000012 - */ - shift = BITS_PER_BYTE; -- shift *= (w_size - idx - 1); -+ shift *= (controller->w_size - i - 1); - rx_buf[controller->rx_bytes] = word >> shift; - } - } - } - --static void spi_qup_fifo_write(struct spi_qup *controller, -+static void spi_qup_read(struct spi_qup *controller, - struct spi_transfer *xfer) - { -- const u8 *tx_buf = xfer->tx_buf; -- u32 word, state, data; -- int idx, w_size; -+ u32 remainder, words_per_block, num_words; -+ bool is_block_mode = controller->mode == QUP_IO_M_MODE_BLOCK; -+ -+ remainder = DIV_ROUND_UP(xfer->len - controller->rx_bytes, -+ controller->w_size); -+ words_per_block = controller->in_blk_sz >> 2; -+ -+ do { -+ /* ACK by clearing service flag */ -+ writel_relaxed(QUP_OP_IN_SERVICE_FLAG, -+ controller->base + QUP_OPERATIONAL); -+ -+ if (is_block_mode) { -+ num_words = (remainder > words_per_block) ? -+ words_per_block : remainder; -+ } else { -+ if (!spi_qup_is_flag_set(controller, -+ QUP_OP_IN_FIFO_NOT_EMPTY)) -+ break; - -- w_size = controller->w_size; -+ num_words = 1; -+ } -+ -+ /* read up to the maximum transfer size available */ -+ spi_qup_read_from_fifo(controller, xfer, num_words); - -- while (controller->tx_bytes < xfer->len) { -+ remainder -= num_words; - -- state = readl_relaxed(controller->base + QUP_OPERATIONAL); -- if (state & QUP_OP_OUT_FIFO_FULL) -+ /* if block mode, check to see if next block is available */ -+ if (is_block_mode && !spi_qup_is_flag_set(controller, -+ QUP_OP_IN_BLOCK_READ_REQ)) - break; - -+ } while (remainder); -+ -+ /* -+ * Due to extra stickiness of the QUP_OP_IN_SERVICE_FLAG during block -+ * mode reads, it has to be cleared again at the very end -+ */ -+ if (is_block_mode && spi_qup_is_flag_set(controller, -+ QUP_OP_MAX_INPUT_DONE_FLAG)) -+ writel_relaxed(QUP_OP_IN_SERVICE_FLAG, -+ controller->base + QUP_OPERATIONAL); -+ -+} -+ -+static void spi_qup_write_to_fifo(struct spi_qup *controller, -+ struct spi_transfer *xfer, u32 num_words) -+{ -+ const u8 *tx_buf = xfer->tx_buf; -+ int i, num_bytes; -+ u32 word, data; -+ -+ for (; num_words; num_words--) { - word = 0; -- for (idx = 0; idx < w_size; idx++, controller->tx_bytes++) { - -- if (!tx_buf) { -- controller->tx_bytes += w_size; -- break; -+ num_bytes = min_t(int, xfer->len - controller->tx_bytes, -+ controller->w_size); -+ if (tx_buf) -+ for (i = 0; i < num_bytes; i++) { -+ data = tx_buf[controller->tx_bytes + i]; -+ word |= data << (BITS_PER_BYTE * (3 - i)); - } - -- data = tx_buf[controller->tx_bytes]; -- word |= data << (BITS_PER_BYTE * (3 - idx)); -- } -+ controller->tx_bytes += num_bytes; - - writel_relaxed(word, controller->base + QUP_OUTPUT_FIFO); - } -@@ -290,6 +337,44 @@ static void spi_qup_dma_done(void *data) - complete(done); - } - -+static void spi_qup_write(struct spi_qup *controller, -+ struct spi_transfer *xfer) -+{ -+ bool is_block_mode = controller->mode == QUP_IO_M_MODE_BLOCK; -+ u32 remainder, words_per_block, num_words; -+ -+ remainder = DIV_ROUND_UP(xfer->len - controller->tx_bytes, -+ controller->w_size); -+ words_per_block = controller->out_blk_sz >> 2; -+ -+ do { -+ /* ACK by clearing service flag */ -+ writel_relaxed(QUP_OP_OUT_SERVICE_FLAG, -+ controller->base + QUP_OPERATIONAL); -+ -+ if (is_block_mode) { -+ num_words = (remainder > words_per_block) ? -+ words_per_block : remainder; -+ } else { -+ if (spi_qup_is_flag_set(controller, -+ QUP_OP_OUT_FIFO_FULL)) -+ break; -+ -+ num_words = 1; -+ } -+ -+ spi_qup_write_to_fifo(controller, xfer, num_words); -+ -+ remainder -= num_words; -+ -+ /* if block mode, check to see if next block is available */ -+ if (is_block_mode && !spi_qup_is_flag_set(controller, -+ QUP_OP_OUT_BLOCK_WRITE_REQ)) -+ break; -+ -+ } while (remainder); -+} -+ - static int spi_qup_prep_sg(struct spi_master *master, struct spi_transfer *xfer, - enum dma_transfer_direction dir, - dma_async_tx_callback callback, -@@ -347,11 +432,13 @@ unsigned long timeout) - return ret; - } - -- if (xfer->rx_buf) -- rx_done = spi_qup_dma_done; -+ if (!qup->qup_v1) { -+ if (xfer->rx_buf) -+ rx_done = spi_qup_dma_done; - -- if (xfer->tx_buf) -- tx_done = spi_qup_dma_done; -+ if (xfer->tx_buf) -+ tx_done = spi_qup_dma_done; -+ } - - if (xfer->rx_buf) { - ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done, -@@ -398,7 +485,8 @@ static int spi_qup_do_pio(struct spi_mas - return ret; - } - -- spi_qup_fifo_write(qup, xfer); -+ if (qup->mode == QUP_IO_M_MODE_FIFO) -+ spi_qup_write(qup, xfer); - - ret = spi_qup_set_state(qup, QUP_STATE_RUN); - if (ret) { -@@ -431,10 +519,11 @@ static irqreturn_t spi_qup_qup_irq(int i - - writel_relaxed(qup_err, controller->base + QUP_ERROR_FLAGS); - writel_relaxed(spi_err, controller->base + SPI_ERROR_FLAGS); -- writel_relaxed(opflags, controller->base + QUP_OPERATIONAL); - - if (!xfer) { -- dev_err_ratelimited(controller->dev, "unexpected irq %08x %08x %08x\n", -+ writel_relaxed(opflags, controller->base + QUP_OPERATIONAL); -+ dev_err_ratelimited(controller->dev, -+ "unexpected irq %08x %08x %08x\n", - qup_err, spi_err, opflags); - return IRQ_HANDLED; - } -@@ -460,12 +549,20 @@ static irqreturn_t spi_qup_qup_irq(int i - error = -EIO; - } - -- if (!spi_qup_is_dma_xfer(controller->mode)) { -+ if (spi_qup_is_dma_xfer(controller->mode)) { -+ writel_relaxed(opflags, controller->base + QUP_OPERATIONAL); -+ if (opflags & QUP_OP_IN_SERVICE_FLAG && -+ opflags & QUP_OP_MAX_INPUT_DONE_FLAG) -+ complete(&controller->done); -+ if (opflags & QUP_OP_OUT_SERVICE_FLAG && -+ opflags & QUP_OP_MAX_OUTPUT_DONE_FLAG) -+ complete(&controller->dma_tx_done); -+ } else { - if (opflags & QUP_OP_IN_SERVICE_FLAG) -- spi_qup_fifo_read(controller, xfer); -+ spi_qup_read(controller, xfer); - - if (opflags & QUP_OP_OUT_SERVICE_FLAG) -- spi_qup_fifo_write(controller, xfer); -+ spi_qup_write(controller, xfer); - } - - spin_lock_irqsave(&controller->lock, flags); -@@ -473,6 +570,9 @@ static irqreturn_t spi_qup_qup_irq(int i - controller->xfer = xfer; - spin_unlock_irqrestore(&controller->lock, flags); - -+ /* re-read opflags as flags may have changed due to actions above */ -+ opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); -+ - if ((controller->rx_bytes == xfer->len && - (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) - complete(&controller->done); -@@ -516,11 +616,13 @@ static int spi_qup_io_config(struct spi_ - /* must be zero for FIFO */ - writel_relaxed(0, controller->base + QUP_MX_INPUT_CNT); - writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -- - } else if (spi->master->can_dma && - spi->master->can_dma(spi->master, spi, xfer) && - spi->master->cur_msg_mapped) { - controller->mode = QUP_IO_M_MODE_BAM; -+ writel_relaxed(n_words, controller->base + QUP_MX_INPUT_CNT); -+ writel_relaxed(n_words, controller->base + QUP_MX_OUTPUT_CNT); -+ /* must be zero for BLOCK and BAM */ - writel_relaxed(0, controller->base + QUP_MX_READ_CNT); - writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); - diff --git a/target/linux/ipq806x/patches-4.9/0007-spi-qup-properly-detect-extra-interrupts.patch b/target/linux/ipq806x/patches-4.9/0007-spi-qup-properly-detect-extra-interrupts.patch deleted file mode 100644 index 8a3b02744..000000000 --- a/target/linux/ipq806x/patches-4.9/0007-spi-qup-properly-detect-extra-interrupts.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0f32f976ebaa7d8643fcd9419f12bc801ba14407 Mon Sep 17 00:00:00 2001 -From: Matthew McClintock -Date: Thu, 10 Mar 2016 16:44:55 -0600 -Subject: [PATCH 07/69] spi: qup: properly detect extra interrupts - -It's possible for a SPI transaction to complete and get another -interrupt and have it processed on the same spi_transfer before the -transfer_one can set it to NULL. - -This masks unexpected interrupts, so let's set the spi_transfer to -NULL in the interrupt once the transaction is done. So we can -properly detect these bad interrupts and print warning messages. - -Signed-off-by: Matthew McClintock ---- - drivers/spi/spi-qup.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -507,6 +507,7 @@ static irqreturn_t spi_qup_qup_irq(int i - u32 opflags, qup_err, spi_err; - unsigned long flags; - int error = 0; -+ bool done = 0; - - spin_lock_irqsave(&controller->lock, flags); - xfer = controller->xfer; -@@ -565,16 +566,19 @@ static irqreturn_t spi_qup_qup_irq(int i - spi_qup_write(controller, xfer); - } - -- spin_lock_irqsave(&controller->lock, flags); -- controller->error = error; -- controller->xfer = xfer; -- spin_unlock_irqrestore(&controller->lock, flags); -- - /* re-read opflags as flags may have changed due to actions above */ - opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); - - if ((controller->rx_bytes == xfer->len && - (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) -+ done = true; -+ -+ spin_lock_irqsave(&controller->lock, flags); -+ controller->error = error; -+ controller->xfer = done ? NULL : xfer; -+ spin_unlock_irqrestore(&controller->lock, flags); -+ -+ if (done) - complete(&controller->done); - - return IRQ_HANDLED; -@@ -767,7 +771,6 @@ static int spi_qup_transfer_one(struct s - exit: - spi_qup_set_state(controller, QUP_STATE_RESET); - spin_lock_irqsave(&controller->lock, flags); -- controller->xfer = NULL; - if (!ret) - ret = controller->error; - spin_unlock_irqrestore(&controller->lock, flags); diff --git a/target/linux/ipq806x/patches-4.9/0008-spi-qup-don-t-re-read-opflags-to-see-if-transaction-.patch b/target/linux/ipq806x/patches-4.9/0008-spi-qup-don-t-re-read-opflags-to-see-if-transaction-.patch deleted file mode 100644 index 989359698..000000000 --- a/target/linux/ipq806x/patches-4.9/0008-spi-qup-don-t-re-read-opflags-to-see-if-transaction-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9864f39695aefe0831b3c6e86c0dff30489ad580 Mon Sep 17 00:00:00 2001 -From: Matthew McClintock -Date: Thu, 10 Mar 2016 16:48:27 -0600 -Subject: [PATCH 08/69] spi: qup: don't re-read opflags to see if transaction - is done for reads - -For reads, we will get another interrupt so we need to handle things -then. For writes, we can finish up now. - -Signed-off-by: Matthew McClintock ---- - drivers/spi/spi-qup.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -567,7 +567,8 @@ static irqreturn_t spi_qup_qup_irq(int i - } - - /* re-read opflags as flags may have changed due to actions above */ -- opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); -+ if (opflags & QUP_OP_OUT_SERVICE_FLAG) -+ opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); - - if ((controller->rx_bytes == xfer->len && - (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) diff --git a/target/linux/ipq806x/patches-4.9/0009-spi-qup-refactor-spi_qup_io_config-in-two-functions.patch b/target/linux/ipq806x/patches-4.9/0009-spi-qup-refactor-spi_qup_io_config-in-two-functions.patch deleted file mode 100644 index 36c225bad..000000000 --- a/target/linux/ipq806x/patches-4.9/0009-spi-qup-refactor-spi_qup_io_config-in-two-functions.patch +++ /dev/null @@ -1,202 +0,0 @@ -From e06f04d55752e460d8f332f28317aebc27ab1b17 Mon Sep 17 00:00:00 2001 -From: Matthew McClintock -Date: Tue, 26 Apr 2016 12:57:46 -0500 -Subject: [PATCH 09/69] spi: qup: refactor spi_qup_io_config in two functions - -This is preparation for handling transactions larger than 64K-1 bytes in -block mode which is currently unsupported quietly fails. - -We need to break these into two functions 1) prep is called once per -spi_message and 2) io_config is calle once per spi-qup bus transaction - -This is just refactoring, there should be no functional change - -Signed-off-by: Matthew McClintock ---- - drivers/spi/spi-qup.c | 141 ++++++++++++++++++++++++++++++-------------------- - 1 file changed, 86 insertions(+), 55 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -585,12 +585,11 @@ static irqreturn_t spi_qup_qup_irq(int i - return IRQ_HANDLED; - } - --/* set clock freq ... bits per word */ --static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) -+/* set clock freq ... bits per word, determine mode */ -+static int spi_qup_io_prep(struct spi_device *spi, struct spi_transfer *xfer) - { - struct spi_qup *controller = spi_master_get_devdata(spi->master); -- u32 config, iomode, control; -- int ret, n_words; -+ int ret; - - if (spi->mode & SPI_LOOP && xfer->len > controller->in_fifo_sz) { - dev_err(controller->dev, "too big size for loopback %d > %d\n", -@@ -605,56 +604,94 @@ static int spi_qup_io_config(struct spi_ - return -EIO; - } - -- if (spi_qup_set_state(controller, QUP_STATE_RESET)) { -- dev_err(controller->dev, "cannot set RESET state\n"); -- return -EIO; -- } -- - controller->w_size = DIV_ROUND_UP(xfer->bits_per_word, 8); - controller->n_words = xfer->len / controller->w_size; -- n_words = controller->n_words; - -- if (n_words <= (controller->in_fifo_sz / sizeof(u32))) { -+ if (controller->n_words <= (controller->in_fifo_sz / sizeof(u32))) - controller->mode = QUP_IO_M_MODE_FIFO; -- writel_relaxed(n_words, controller->base + QUP_MX_READ_CNT); -- writel_relaxed(n_words, controller->base + QUP_MX_WRITE_CNT); -- /* must be zero for FIFO */ -- writel_relaxed(0, controller->base + QUP_MX_INPUT_CNT); -- writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -- } else if (spi->master->can_dma && -- spi->master->can_dma(spi->master, spi, xfer) && -- spi->master->cur_msg_mapped) { -+ else if (spi->master->can_dma && -+ spi->master->can_dma(spi->master, spi, xfer) && -+ spi->master->cur_msg_mapped) - controller->mode = QUP_IO_M_MODE_BAM; -- writel_relaxed(n_words, controller->base + QUP_MX_INPUT_CNT); -- writel_relaxed(n_words, controller->base + QUP_MX_OUTPUT_CNT); -- /* must be zero for BLOCK and BAM */ -- writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -- writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -- -- if (!controller->qup_v1) { -- void __iomem *input_cnt; -- -- input_cnt = controller->base + QUP_MX_INPUT_CNT; -- /* -- * for DMA transfers, both QUP_MX_INPUT_CNT and -- * QUP_MX_OUTPUT_CNT must be zero to all cases but one. -- * That case is a non-balanced transfer when there is -- * only a rx_buf. -- */ -- if (xfer->tx_buf) -- writel_relaxed(0, input_cnt); -- else -- writel_relaxed(n_words, input_cnt); -+ else -+ controller->mode = QUP_IO_M_MODE_BLOCK; -+ -+ return 0; -+} - -+/* prep qup for another spi transaction of specific type */ -+static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) -+{ -+ struct spi_qup *controller = spi_master_get_devdata(spi->master); -+ u32 config, iomode, control; -+ unsigned long flags; -+ -+ reinit_completion(&controller->done); -+ reinit_completion(&controller->dma_tx_done); -+ -+ spin_lock_irqsave(&controller->lock, flags); -+ controller->xfer = xfer; -+ controller->error = 0; -+ controller->rx_bytes = 0; -+ controller->tx_bytes = 0; -+ spin_unlock_irqrestore(&controller->lock, flags); -+ -+ -+ if (spi_qup_set_state(controller, QUP_STATE_RESET)) { -+ dev_err(controller->dev, "cannot set RESET state\n"); -+ return -EIO; -+ } -+ -+ switch (controller->mode) { -+ case QUP_IO_M_MODE_FIFO: -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_READ_CNT); -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_WRITE_CNT); -+ /* must be zero for FIFO */ -+ writel_relaxed(0, controller->base + QUP_MX_INPUT_CNT); - writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -- } -- } else { -- controller->mode = QUP_IO_M_MODE_BLOCK; -- writel_relaxed(n_words, controller->base + QUP_MX_INPUT_CNT); -- writel_relaxed(n_words, controller->base + QUP_MX_OUTPUT_CNT); -- /* must be zero for BLOCK and BAM */ -- writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -- writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -+ break; -+ case QUP_IO_M_MODE_BAM: -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_INPUT_CNT); -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_OUTPUT_CNT); -+ /* must be zero for BLOCK and BAM */ -+ writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -+ writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -+ if (!controller->qup_v1) { -+ void __iomem *input_cnt; -+ -+ input_cnt = controller->base + QUP_MX_INPUT_CNT; -+ /* -+ * for DMA transfers, both QUP_MX_INPUT_CNT and -+ * QUP_MX_OUTPUT_CNT must be zero to all cases -+ * but one. That case is a non-balanced -+ * transfer when there is only a rx_buf. -+ */ -+ if (xfer->tx_buf) -+ writel_relaxed(0, input_cnt); -+ else -+ writel_relaxed(controller->n_words, -+ input_cnt); -+ -+ writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -+ } -+ break; -+ case QUP_IO_M_MODE_BLOCK: -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_INPUT_CNT); -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_OUTPUT_CNT); -+ /* must be zero for BLOCK and BAM */ -+ writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -+ writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -+ break; -+ default: -+ dev_err(controller->dev, "unknown mode = %d\n", -+ controller->mode); -+ return -EIO; - } - - iomode = readl_relaxed(controller->base + QUP_IO_M_MODES); -@@ -743,6 +780,10 @@ static int spi_qup_transfer_one(struct s - unsigned long timeout, flags; - int ret = -EIO; - -+ ret = spi_qup_io_prep(spi, xfer); -+ if (ret) -+ return ret; -+ - ret = spi_qup_io_config(spi, xfer); - if (ret) - return ret; -@@ -751,16 +792,6 @@ static int spi_qup_transfer_one(struct s - timeout = DIV_ROUND_UP(xfer->len * 8, timeout); - timeout = 100 * msecs_to_jiffies(timeout); - -- reinit_completion(&controller->done); -- reinit_completion(&controller->dma_tx_done); -- -- spin_lock_irqsave(&controller->lock, flags); -- controller->xfer = xfer; -- controller->error = 0; -- controller->rx_bytes = 0; -- controller->tx_bytes = 0; -- spin_unlock_irqrestore(&controller->lock, flags); -- - if (spi_qup_is_dma_xfer(controller->mode)) - ret = spi_qup_do_dma(master, xfer, timeout); - else diff --git a/target/linux/ipq806x/patches-4.9/0010-spi-qup-call-io_config-in-mode-specific-function.patch b/target/linux/ipq806x/patches-4.9/0010-spi-qup-call-io_config-in-mode-specific-function.patch deleted file mode 100644 index dfbed620f..000000000 --- a/target/linux/ipq806x/patches-4.9/0010-spi-qup-call-io_config-in-mode-specific-function.patch +++ /dev/null @@ -1,391 +0,0 @@ -From afe108e638a2dd441b11cd2c7b1e0658bb47b5e8 Mon Sep 17 00:00:00 2001 -From: Matthew McClintock -Date: Tue, 26 Apr 2016 13:14:45 -0500 -Subject: [PATCH 10/69] spi: qup: call io_config in mode specific function - -DMA transactions should only only need to call io_config only once, but -block mode might call it several times to setup several transactions so -it can handle reads/writes larger than the max size per transaction, so -we move the call to the do_ functions. - -This is just refactoring, there should be no functional change - -Signed-off-by: Matthew McClintock ---- - drivers/spi/spi-qup.c | 327 +++++++++++++++++++++++++------------------------- - 1 file changed, 166 insertions(+), 161 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -418,13 +418,170 @@ static void spi_qup_dma_terminate(struct - dmaengine_terminate_all(master->dma_rx); - } - --static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer, -+/* prep qup for another spi transaction of specific type */ -+static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) -+{ -+ struct spi_qup *controller = spi_master_get_devdata(spi->master); -+ u32 config, iomode, control; -+ unsigned long flags; -+ -+ reinit_completion(&controller->done); -+ reinit_completion(&controller->dma_tx_done); -+ -+ spin_lock_irqsave(&controller->lock, flags); -+ controller->xfer = xfer; -+ controller->error = 0; -+ controller->rx_bytes = 0; -+ controller->tx_bytes = 0; -+ spin_unlock_irqrestore(&controller->lock, flags); -+ -+ if (spi_qup_set_state(controller, QUP_STATE_RESET)) { -+ dev_err(controller->dev, "cannot set RESET state\n"); -+ return -EIO; -+ } -+ -+ switch (controller->mode) { -+ case QUP_IO_M_MODE_FIFO: -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_READ_CNT); -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_WRITE_CNT); -+ /* must be zero for FIFO */ -+ writel_relaxed(0, controller->base + QUP_MX_INPUT_CNT); -+ writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -+ break; -+ case QUP_IO_M_MODE_BAM: -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_INPUT_CNT); -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_OUTPUT_CNT); -+ /* must be zero for BLOCK and BAM */ -+ writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -+ writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -+ if (!controller->qup_v1) { -+ void __iomem *input_cnt; -+ -+ input_cnt = controller->base + QUP_MX_INPUT_CNT; -+ /* -+ * for DMA transfers, both QUP_MX_INPUT_CNT and -+ * QUP_MX_OUTPUT_CNT must be zero to all cases -+ * but one. That case is a non-balanced -+ * transfer when there is only a rx_buf. -+ */ -+ if (xfer->tx_buf) -+ writel_relaxed(0, input_cnt); -+ else -+ writel_relaxed(controller->n_words, -+ input_cnt); -+ -+ writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -+ } -+ break; -+ case QUP_IO_M_MODE_BLOCK: -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_INPUT_CNT); -+ writel_relaxed(controller->n_words, -+ controller->base + QUP_MX_OUTPUT_CNT); -+ /* must be zero for BLOCK and BAM */ -+ writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -+ writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -+ break; -+ default: -+ dev_err(controller->dev, "unknown mode = %d\n", -+ controller->mode); -+ return -EIO; -+ } -+ -+ iomode = readl_relaxed(controller->base + QUP_IO_M_MODES); -+ /* Set input and output transfer mode */ -+ iomode &= ~(QUP_IO_M_INPUT_MODE_MASK | QUP_IO_M_OUTPUT_MODE_MASK); -+ -+ if (!spi_qup_is_dma_xfer(controller->mode)) -+ iomode &= ~(QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN); -+ else -+ iomode |= QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN; -+ -+ iomode |= (controller->mode << QUP_IO_M_OUTPUT_MODE_MASK_SHIFT); -+ iomode |= (controller->mode << QUP_IO_M_INPUT_MODE_MASK_SHIFT); -+ -+ writel_relaxed(iomode, controller->base + QUP_IO_M_MODES); -+ -+ control = readl_relaxed(controller->base + SPI_IO_CONTROL); -+ -+ if (spi->mode & SPI_CPOL) -+ control |= SPI_IO_C_CLK_IDLE_HIGH; -+ else -+ control &= ~SPI_IO_C_CLK_IDLE_HIGH; -+ -+ writel_relaxed(control, controller->base + SPI_IO_CONTROL); -+ -+ config = readl_relaxed(controller->base + SPI_CONFIG); -+ -+ if (spi->mode & SPI_LOOP) -+ config |= SPI_CONFIG_LOOPBACK; -+ else -+ config &= ~SPI_CONFIG_LOOPBACK; -+ -+ if (spi->mode & SPI_CPHA) -+ config &= ~SPI_CONFIG_INPUT_FIRST; -+ else -+ config |= SPI_CONFIG_INPUT_FIRST; -+ -+ /* -+ * HS_MODE improves signal stability for spi-clk high rates, -+ * but is invalid in loop back mode. -+ */ -+ if ((xfer->speed_hz >= SPI_HS_MIN_RATE) && !(spi->mode & SPI_LOOP)) -+ config |= SPI_CONFIG_HS_MODE; -+ else -+ config &= ~SPI_CONFIG_HS_MODE; -+ -+ writel_relaxed(config, controller->base + SPI_CONFIG); -+ -+ config = readl_relaxed(controller->base + QUP_CONFIG); -+ config &= ~(QUP_CONFIG_NO_INPUT | QUP_CONFIG_NO_OUTPUT | QUP_CONFIG_N); -+ config |= xfer->bits_per_word - 1; -+ config |= QUP_CONFIG_SPI_MODE; -+ -+ if (spi_qup_is_dma_xfer(controller->mode)) { -+ if (!xfer->tx_buf) -+ config |= QUP_CONFIG_NO_OUTPUT; -+ if (!xfer->rx_buf) -+ config |= QUP_CONFIG_NO_INPUT; -+ } -+ -+ writel_relaxed(config, controller->base + QUP_CONFIG); -+ -+ /* only write to OPERATIONAL_MASK when register is present */ -+ if (!controller->qup_v1) { -+ u32 mask = 0; -+ -+ /* -+ * mask INPUT and OUTPUT service flags to prevent IRQs on FIFO -+ * status change in BAM mode -+ */ -+ -+ if (spi_qup_is_dma_xfer(controller->mode)) -+ mask = QUP_OP_IN_SERVICE_FLAG | QUP_OP_OUT_SERVICE_FLAG; -+ -+ writel_relaxed(mask, controller->base + QUP_OPERATIONAL_MASK); -+ } -+ -+ return 0; -+} -+ -+static int spi_qup_do_dma(struct spi_device *spi, struct spi_transfer *xfer, - unsigned long timeout) - { -+ struct spi_master *master = spi->master; - struct spi_qup *qup = spi_master_get_devdata(master); - dma_async_tx_callback rx_done = NULL, tx_done = NULL; - int ret; - -+ ret = spi_qup_io_config(spi, xfer); -+ if (ret) -+ return ret; -+ - /* before issuing the descriptors, set the QUP to run */ - ret = spi_qup_set_state(qup, QUP_STATE_RUN); - if (ret) { -@@ -467,12 +624,17 @@ unsigned long timeout) - return ret; - } - --static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer, -+static int spi_qup_do_pio(struct spi_device *spi, struct spi_transfer *xfer, - unsigned long timeout) - { -+ struct spi_master *master = spi->master; - struct spi_qup *qup = spi_master_get_devdata(master); - int ret; - -+ ret = spi_qup_io_config(spi, xfer); -+ if (ret) -+ return ret; -+ - ret = spi_qup_set_state(qup, QUP_STATE_RUN); - if (ret) { - dev_warn(qup->dev, "cannot set RUN state\n"); -@@ -619,159 +781,6 @@ static int spi_qup_io_prep(struct spi_de - return 0; - } - --/* prep qup for another spi transaction of specific type */ --static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) --{ -- struct spi_qup *controller = spi_master_get_devdata(spi->master); -- u32 config, iomode, control; -- unsigned long flags; -- -- reinit_completion(&controller->done); -- reinit_completion(&controller->dma_tx_done); -- -- spin_lock_irqsave(&controller->lock, flags); -- controller->xfer = xfer; -- controller->error = 0; -- controller->rx_bytes = 0; -- controller->tx_bytes = 0; -- spin_unlock_irqrestore(&controller->lock, flags); -- -- -- if (spi_qup_set_state(controller, QUP_STATE_RESET)) { -- dev_err(controller->dev, "cannot set RESET state\n"); -- return -EIO; -- } -- -- switch (controller->mode) { -- case QUP_IO_M_MODE_FIFO: -- writel_relaxed(controller->n_words, -- controller->base + QUP_MX_READ_CNT); -- writel_relaxed(controller->n_words, -- controller->base + QUP_MX_WRITE_CNT); -- /* must be zero for FIFO */ -- writel_relaxed(0, controller->base + QUP_MX_INPUT_CNT); -- writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -- break; -- case QUP_IO_M_MODE_BAM: -- writel_relaxed(controller->n_words, -- controller->base + QUP_MX_INPUT_CNT); -- writel_relaxed(controller->n_words, -- controller->base + QUP_MX_OUTPUT_CNT); -- /* must be zero for BLOCK and BAM */ -- writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -- writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -- if (!controller->qup_v1) { -- void __iomem *input_cnt; -- -- input_cnt = controller->base + QUP_MX_INPUT_CNT; -- /* -- * for DMA transfers, both QUP_MX_INPUT_CNT and -- * QUP_MX_OUTPUT_CNT must be zero to all cases -- * but one. That case is a non-balanced -- * transfer when there is only a rx_buf. -- */ -- if (xfer->tx_buf) -- writel_relaxed(0, input_cnt); -- else -- writel_relaxed(controller->n_words, -- input_cnt); -- -- writel_relaxed(0, controller->base + QUP_MX_OUTPUT_CNT); -- } -- break; -- case QUP_IO_M_MODE_BLOCK: -- writel_relaxed(controller->n_words, -- controller->base + QUP_MX_INPUT_CNT); -- writel_relaxed(controller->n_words, -- controller->base + QUP_MX_OUTPUT_CNT); -- /* must be zero for BLOCK and BAM */ -- writel_relaxed(0, controller->base + QUP_MX_READ_CNT); -- writel_relaxed(0, controller->base + QUP_MX_WRITE_CNT); -- break; -- default: -- dev_err(controller->dev, "unknown mode = %d\n", -- controller->mode); -- return -EIO; -- } -- -- iomode = readl_relaxed(controller->base + QUP_IO_M_MODES); -- /* Set input and output transfer mode */ -- iomode &= ~(QUP_IO_M_INPUT_MODE_MASK | QUP_IO_M_OUTPUT_MODE_MASK); -- -- if (!spi_qup_is_dma_xfer(controller->mode)) -- iomode &= ~(QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN); -- else -- iomode |= QUP_IO_M_PACK_EN | QUP_IO_M_UNPACK_EN; -- -- iomode |= (controller->mode << QUP_IO_M_OUTPUT_MODE_MASK_SHIFT); -- iomode |= (controller->mode << QUP_IO_M_INPUT_MODE_MASK_SHIFT); -- -- writel_relaxed(iomode, controller->base + QUP_IO_M_MODES); -- -- control = readl_relaxed(controller->base + SPI_IO_CONTROL); -- -- if (spi->mode & SPI_CPOL) -- control |= SPI_IO_C_CLK_IDLE_HIGH; -- else -- control &= ~SPI_IO_C_CLK_IDLE_HIGH; -- -- writel_relaxed(control, controller->base + SPI_IO_CONTROL); -- -- config = readl_relaxed(controller->base + SPI_CONFIG); -- -- if (spi->mode & SPI_LOOP) -- config |= SPI_CONFIG_LOOPBACK; -- else -- config &= ~SPI_CONFIG_LOOPBACK; -- -- if (spi->mode & SPI_CPHA) -- config &= ~SPI_CONFIG_INPUT_FIRST; -- else -- config |= SPI_CONFIG_INPUT_FIRST; -- -- /* -- * HS_MODE improves signal stability for spi-clk high rates, -- * but is invalid in loop back mode. -- */ -- if ((xfer->speed_hz >= SPI_HS_MIN_RATE) && !(spi->mode & SPI_LOOP)) -- config |= SPI_CONFIG_HS_MODE; -- else -- config &= ~SPI_CONFIG_HS_MODE; -- -- writel_relaxed(config, controller->base + SPI_CONFIG); -- -- config = readl_relaxed(controller->base + QUP_CONFIG); -- config &= ~(QUP_CONFIG_NO_INPUT | QUP_CONFIG_NO_OUTPUT | QUP_CONFIG_N); -- config |= xfer->bits_per_word - 1; -- config |= QUP_CONFIG_SPI_MODE; -- -- if (spi_qup_is_dma_xfer(controller->mode)) { -- if (!xfer->tx_buf) -- config |= QUP_CONFIG_NO_OUTPUT; -- if (!xfer->rx_buf) -- config |= QUP_CONFIG_NO_INPUT; -- } -- -- writel_relaxed(config, controller->base + QUP_CONFIG); -- -- /* only write to OPERATIONAL_MASK when register is present */ -- if (!controller->qup_v1) { -- u32 mask = 0; -- -- /* -- * mask INPUT and OUTPUT service flags to prevent IRQs on FIFO -- * status change in BAM mode -- */ -- -- if (spi_qup_is_dma_xfer(controller->mode)) -- mask = QUP_OP_IN_SERVICE_FLAG | QUP_OP_OUT_SERVICE_FLAG; -- -- writel_relaxed(mask, controller->base + QUP_OPERATIONAL_MASK); -- } -- -- return 0; --} -- - static int spi_qup_transfer_one(struct spi_master *master, - struct spi_device *spi, - struct spi_transfer *xfer) -@@ -784,18 +793,14 @@ static int spi_qup_transfer_one(struct s - if (ret) - return ret; - -- ret = spi_qup_io_config(spi, xfer); -- if (ret) -- return ret; -- - timeout = DIV_ROUND_UP(xfer->speed_hz, MSEC_PER_SEC); - timeout = DIV_ROUND_UP(xfer->len * 8, timeout); - timeout = 100 * msecs_to_jiffies(timeout); - - if (spi_qup_is_dma_xfer(controller->mode)) -- ret = spi_qup_do_dma(master, xfer, timeout); -+ ret = spi_qup_do_dma(spi, xfer, timeout); - else -- ret = spi_qup_do_pio(master, xfer, timeout); -+ ret = spi_qup_do_pio(spi, xfer, timeout); - - if (ret) - goto exit; diff --git a/target/linux/ipq806x/patches-4.9/0011-spi-qup-allow-block-mode-to-generate-multiple-transa.patch b/target/linux/ipq806x/patches-4.9/0011-spi-qup-allow-block-mode-to-generate-multiple-transa.patch deleted file mode 100644 index 39a1aecab..000000000 --- a/target/linux/ipq806x/patches-4.9/0011-spi-qup-allow-block-mode-to-generate-multiple-transa.patch +++ /dev/null @@ -1,268 +0,0 @@ -From 6858a6a75f1ed364764afba938d77bbb57f80559 Mon Sep 17 00:00:00 2001 -From: Matthew McClintock -Date: Tue, 26 Apr 2016 15:46:24 -0500 -Subject: [PATCH 11/69] spi: qup: allow block mode to generate multiple - transactions - -This let's you write more to the SPI bus than 64K-1 which is important -if the block size of a SPI device is >= 64K or some other device wants -to something larger. - -This has the benefit of completly removing spi_message from the spi-qup -transactions - -Signed-off-by: Matthew McClintock ---- - drivers/spi/spi-qup.c | 120 +++++++++++++++++++++++++++++++------------------- - 1 file changed, 75 insertions(+), 45 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -120,7 +120,7 @@ - - #define SPI_NUM_CHIPSELECTS 4 - --#define SPI_MAX_DMA_XFER (SZ_64K - 64) -+#define SPI_MAX_XFER (SZ_64K - 64) - - /* high speed mode is when bus rate is greater then 26MHz */ - #define SPI_HS_MIN_RATE 26000000 -@@ -150,6 +150,8 @@ struct spi_qup { - int n_words; - int tx_bytes; - int rx_bytes; -+ const u8 *tx_buf; -+ u8 *rx_buf; - int qup_v1; - - int mode; -@@ -172,6 +174,12 @@ static inline bool spi_qup_is_dma_xfer(i - return false; - } - -+/* get's the transaction size length */ -+static inline unsigned spi_qup_len(struct spi_qup *controller) -+{ -+ return controller->n_words * controller->w_size; -+} -+ - static inline bool spi_qup_is_valid_state(struct spi_qup *controller) - { - u32 opstate = readl_relaxed(controller->base + QUP_STATE); -@@ -224,10 +232,9 @@ static int spi_qup_set_state(struct spi_ - return 0; - } - --static void spi_qup_read_from_fifo(struct spi_qup *controller, -- struct spi_transfer *xfer, u32 num_words) -+static void spi_qup_read_from_fifo(struct spi_qup *controller, u32 num_words) - { -- u8 *rx_buf = xfer->rx_buf; -+ u8 *rx_buf = controller->rx_buf; - int i, shift, num_bytes; - u32 word; - -@@ -235,7 +242,7 @@ static void spi_qup_read_from_fifo(struc - - word = readl_relaxed(controller->base + QUP_INPUT_FIFO); - -- num_bytes = min_t(int, xfer->len - controller->rx_bytes, -+ num_bytes = min_t(int, spi_qup_len(controller) - controller->rx_bytes, - controller->w_size); - - if (!rx_buf) { -@@ -257,13 +264,12 @@ static void spi_qup_read_from_fifo(struc - } - } - --static void spi_qup_read(struct spi_qup *controller, -- struct spi_transfer *xfer) -+static void spi_qup_read(struct spi_qup *controller) - { - u32 remainder, words_per_block, num_words; - bool is_block_mode = controller->mode == QUP_IO_M_MODE_BLOCK; - -- remainder = DIV_ROUND_UP(xfer->len - controller->rx_bytes, -+ remainder = DIV_ROUND_UP(spi_qup_len(controller) - controller->rx_bytes, - controller->w_size); - words_per_block = controller->in_blk_sz >> 2; - -@@ -284,7 +290,7 @@ static void spi_qup_read(struct spi_qup - } - - /* read up to the maximum transfer size available */ -- spi_qup_read_from_fifo(controller, xfer, num_words); -+ spi_qup_read_from_fifo(controller, num_words); - - remainder -= num_words; - -@@ -306,17 +312,16 @@ static void spi_qup_read(struct spi_qup - - } - --static void spi_qup_write_to_fifo(struct spi_qup *controller, -- struct spi_transfer *xfer, u32 num_words) -+static void spi_qup_write_to_fifo(struct spi_qup *controller, u32 num_words) - { -- const u8 *tx_buf = xfer->tx_buf; -+ const u8 *tx_buf = controller->tx_buf; - int i, num_bytes; - u32 word, data; - - for (; num_words; num_words--) { - word = 0; - -- num_bytes = min_t(int, xfer->len - controller->tx_bytes, -+ num_bytes = min_t(int, spi_qup_len(controller) - controller->tx_bytes, - controller->w_size); - if (tx_buf) - for (i = 0; i < num_bytes; i++) { -@@ -337,13 +342,12 @@ static void spi_qup_dma_done(void *data) - complete(done); - } - --static void spi_qup_write(struct spi_qup *controller, -- struct spi_transfer *xfer) -+static void spi_qup_write(struct spi_qup *controller) - { - bool is_block_mode = controller->mode == QUP_IO_M_MODE_BLOCK; - u32 remainder, words_per_block, num_words; - -- remainder = DIV_ROUND_UP(xfer->len - controller->tx_bytes, -+ remainder = DIV_ROUND_UP(spi_qup_len(controller) - controller->tx_bytes, - controller->w_size); - words_per_block = controller->out_blk_sz >> 2; - -@@ -363,7 +367,7 @@ static void spi_qup_write(struct spi_qup - num_words = 1; - } - -- spi_qup_write_to_fifo(controller, xfer, num_words); -+ spi_qup_write_to_fifo(controller, num_words); - - remainder -= num_words; - -@@ -629,35 +633,61 @@ static int spi_qup_do_pio(struct spi_dev - { - struct spi_master *master = spi->master; - struct spi_qup *qup = spi_master_get_devdata(master); -- int ret; -+ int ret, n_words, iterations, offset = 0; - -- ret = spi_qup_io_config(spi, xfer); -- if (ret) -- return ret; -+ n_words = qup->n_words; -+ iterations = n_words / SPI_MAX_XFER; /* round down */ - -- ret = spi_qup_set_state(qup, QUP_STATE_RUN); -- if (ret) { -- dev_warn(qup->dev, "cannot set RUN state\n"); -- return ret; -- } -+ qup->rx_buf = xfer->rx_buf; -+ qup->tx_buf = xfer->tx_buf; - -- ret = spi_qup_set_state(qup, QUP_STATE_PAUSE); -- if (ret) { -- dev_warn(qup->dev, "cannot set PAUSE state\n"); -- return ret; -- } -+ do { -+ if (iterations) -+ qup->n_words = SPI_MAX_XFER; -+ else -+ qup->n_words = n_words % SPI_MAX_XFER; -+ -+ if (qup->tx_buf && offset) -+ qup->tx_buf = xfer->tx_buf + offset * SPI_MAX_XFER; -+ -+ if (qup->rx_buf && offset) -+ qup->rx_buf = xfer->rx_buf + offset * SPI_MAX_XFER; -+ -+ /* if the transaction is small enough, we need -+ * to fallback to FIFO mode */ -+ if (qup->n_words <= (qup->in_fifo_sz / sizeof(u32))) -+ qup->mode = QUP_IO_M_MODE_FIFO; - -- if (qup->mode == QUP_IO_M_MODE_FIFO) -- spi_qup_write(qup, xfer); -+ ret = spi_qup_io_config(spi, xfer); -+ if (ret) -+ return ret; - -- ret = spi_qup_set_state(qup, QUP_STATE_RUN); -- if (ret) { -- dev_warn(qup->dev, "cannot set RUN state\n"); -- return ret; -- } -+ ret = spi_qup_set_state(qup, QUP_STATE_RUN); -+ if (ret) { -+ dev_warn(qup->dev, "cannot set RUN state\n"); -+ return ret; -+ } - -- if (!wait_for_completion_timeout(&qup->done, timeout)) -- return -ETIMEDOUT; -+ ret = spi_qup_set_state(qup, QUP_STATE_PAUSE); -+ if (ret) { -+ dev_warn(qup->dev, "cannot set PAUSE state\n"); -+ return ret; -+ } -+ -+ if (qup->mode == QUP_IO_M_MODE_FIFO) -+ spi_qup_write(qup); -+ -+ ret = spi_qup_set_state(qup, QUP_STATE_RUN); -+ if (ret) { -+ dev_warn(qup->dev, "cannot set RUN state\n"); -+ return ret; -+ } -+ -+ if (!wait_for_completion_timeout(&qup->done, timeout)) -+ return -ETIMEDOUT; -+ -+ offset++; -+ } while (iterations--); - - return 0; - } -@@ -722,17 +752,17 @@ static irqreturn_t spi_qup_qup_irq(int i - complete(&controller->dma_tx_done); - } else { - if (opflags & QUP_OP_IN_SERVICE_FLAG) -- spi_qup_read(controller, xfer); -+ spi_qup_read(controller); - - if (opflags & QUP_OP_OUT_SERVICE_FLAG) -- spi_qup_write(controller, xfer); -+ spi_qup_write(controller); - } - - /* re-read opflags as flags may have changed due to actions above */ - if (opflags & QUP_OP_OUT_SERVICE_FLAG) - opflags = readl_relaxed(controller->base + QUP_OPERATIONAL); - -- if ((controller->rx_bytes == xfer->len && -+ if ((controller->rx_bytes == spi_qup_len(controller) && - (opflags & QUP_OP_MAX_INPUT_DONE_FLAG)) || error) - done = true; - -@@ -794,7 +824,7 @@ static int spi_qup_transfer_one(struct s - return ret; - - timeout = DIV_ROUND_UP(xfer->speed_hz, MSEC_PER_SEC); -- timeout = DIV_ROUND_UP(xfer->len * 8, timeout); -+ timeout = DIV_ROUND_UP(min_t(unsigned long, SPI_MAX_XFER, xfer->len) * 8, timeout); - timeout = 100 * msecs_to_jiffies(timeout); - - if (spi_qup_is_dma_xfer(controller->mode)) -@@ -983,7 +1013,7 @@ static int spi_qup_probe(struct platform - master->dev.of_node = pdev->dev.of_node; - master->auto_runtime_pm = true; - master->dma_alignment = dma_get_cache_alignment(); -- master->max_dma_len = SPI_MAX_DMA_XFER; -+ master->max_dma_len = SPI_MAX_XFER; - - platform_set_drvdata(pdev, master); - diff --git a/target/linux/ipq806x/patches-4.9/0012-spi-qup-refactor-spi_qup_prep_sg-to-be-more-take-spe.patch b/target/linux/ipq806x/patches-4.9/0012-spi-qup-refactor-spi_qup_prep_sg-to-be-more-take-spe.patch deleted file mode 100644 index 990cccd8a..000000000 --- a/target/linux/ipq806x/patches-4.9/0012-spi-qup-refactor-spi_qup_prep_sg-to-be-more-take-spe.patch +++ /dev/null @@ -1,73 +0,0 @@ -From fca27bd516d30e33b9373a8c61ca4431077e479e Mon Sep 17 00:00:00 2001 -From: Matthew McClintock -Date: Wed, 4 May 2016 16:33:42 -0500 -Subject: [PATCH 12/69] spi: qup: refactor spi_qup_prep_sg to be more take - specific sgl and nent - -This is in preparation for splitting DMA into multiple transacations, -this contains no code changes just refactoring. - -Signed-off-by: Matthew McClintock ---- - drivers/spi/spi-qup.c | 28 +++++++++++----------------- - 1 file changed, 11 insertions(+), 17 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -379,27 +379,19 @@ static void spi_qup_write(struct spi_qup - } while (remainder); - } - --static int spi_qup_prep_sg(struct spi_master *master, struct spi_transfer *xfer, -- enum dma_transfer_direction dir, -- dma_async_tx_callback callback, -- void *data) -+static int spi_qup_prep_sg(struct spi_master *master, struct scatterlist *sgl, -+ unsigned int nents, enum dma_transfer_direction dir, -+ dma_async_tx_callback callback, void *data) - { - unsigned long flags = DMA_PREP_INTERRUPT | DMA_PREP_FENCE; - struct dma_async_tx_descriptor *desc; -- struct scatterlist *sgl; - struct dma_chan *chan; - dma_cookie_t cookie; -- unsigned int nents; - -- if (dir == DMA_MEM_TO_DEV) { -+ if (dir == DMA_MEM_TO_DEV) - chan = master->dma_tx; -- nents = xfer->tx_sg.nents; -- sgl = xfer->tx_sg.sgl; -- } else { -+ else - chan = master->dma_rx; -- nents = xfer->rx_sg.nents; -- sgl = xfer->rx_sg.sgl; -- } - - desc = dmaengine_prep_slave_sg(chan, sgl, nents, dir, flags); - if (IS_ERR_OR_NULL(desc)) -@@ -602,8 +594,9 @@ unsigned long timeout) - } - - if (xfer->rx_buf) { -- ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done, -- &qup->done); -+ ret = spi_qup_prep_sg(master, xfer->rx_sg.sgl, -+ xfer->rx_sg.nents, DMA_DEV_TO_MEM, -+ rx_done, &qup->done); - if (ret) - return ret; - -@@ -611,8 +604,9 @@ unsigned long timeout) - } - - if (xfer->tx_buf) { -- ret = spi_qup_prep_sg(master, xfer, DMA_MEM_TO_DEV, tx_done, -- &qup->dma_tx_done); -+ ret = spi_qup_prep_sg(master, xfer->tx_sg.sgl, -+ xfer->tx_sg.nents, DMA_MEM_TO_DEV, -+ tx_done, &qup->dma_tx_done); - if (ret) - return ret; - diff --git a/target/linux/ipq806x/patches-4.9/0013-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch b/target/linux/ipq806x/patches-4.9/0013-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch deleted file mode 100644 index 13e199c52..000000000 --- a/target/linux/ipq806x/patches-4.9/0013-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 028f915b20ec343dda88f1bcc99f07f6b428b4aa Mon Sep 17 00:00:00 2001 -From: Matthew McClintock -Date: Thu, 5 May 2016 10:07:11 -0500 -Subject: [PATCH 13/69] spi: qup: allow mulitple DMA transactions per spi xfer - -Much like the block mode changes, we are breaking up DMA transactions -into 64K chunks so we can reset the QUP engine. - -Signed-off-by: Matthew McClintock ---- - drivers/spi/spi-qup.c | 120 ++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 86 insertions(+), 34 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -566,6 +566,21 @@ static int spi_qup_io_config(struct spi_ - return 0; - } - -+static unsigned int spi_qup_sgl_get_size(struct scatterlist *sgl, unsigned int nents) -+{ -+ struct scatterlist *sg; -+ int i; -+ unsigned int length = 0; -+ -+ if (!nents) -+ return 0; -+ -+ for_each_sg(sgl, sg, nents, i) -+ length += sg_dma_len(sg); -+ -+ return length; -+} -+ - static int spi_qup_do_dma(struct spi_device *spi, struct spi_transfer *xfer, - unsigned long timeout) - { -@@ -573,53 +588,90 @@ unsigned long timeout) - struct spi_qup *qup = spi_master_get_devdata(master); - dma_async_tx_callback rx_done = NULL, tx_done = NULL; - int ret; -+ struct scatterlist *tx_sgl, *rx_sgl; - -- ret = spi_qup_io_config(spi, xfer); -- if (ret) -- return ret; -- -- /* before issuing the descriptors, set the QUP to run */ -- ret = spi_qup_set_state(qup, QUP_STATE_RUN); -- if (ret) { -- dev_warn(qup->dev, "cannot set RUN state\n"); -- return ret; -- } -- -- if (!qup->qup_v1) { -- if (xfer->rx_buf) -- rx_done = spi_qup_dma_done; -- -- if (xfer->tx_buf) -- tx_done = spi_qup_dma_done; -- } -- -- if (xfer->rx_buf) { -- ret = spi_qup_prep_sg(master, xfer->rx_sg.sgl, -- xfer->rx_sg.nents, DMA_DEV_TO_MEM, -- rx_done, &qup->done); -- if (ret) -- return ret; -+ rx_sgl = xfer->rx_sg.sgl; -+ tx_sgl = xfer->tx_sg.sgl; - -- dma_async_issue_pending(master->dma_rx); -- } -+ do { -+ int rx_nents = 0, tx_nents = 0; - -- if (xfer->tx_buf) { -- ret = spi_qup_prep_sg(master, xfer->tx_sg.sgl, -- xfer->tx_sg.nents, DMA_MEM_TO_DEV, -- tx_done, &qup->dma_tx_done); -+ if (rx_sgl) { -+ rx_nents = sg_nents_for_len(rx_sgl, SPI_MAX_XFER); -+ if (rx_nents < 0) -+ rx_nents = sg_nents(rx_sgl); -+ -+ qup->n_words = spi_qup_sgl_get_size(rx_sgl, rx_nents) / -+ qup->w_size; -+ } -+ -+ if (tx_sgl) { -+ tx_nents = sg_nents_for_len(tx_sgl, SPI_MAX_XFER); -+ if (tx_nents < 0) -+ tx_nents = sg_nents(tx_sgl); -+ -+ qup->n_words = spi_qup_sgl_get_size(tx_sgl, tx_nents) / -+ qup->w_size; -+ } -+ -+ -+ ret = spi_qup_io_config(spi, xfer); - if (ret) - return ret; - -- dma_async_issue_pending(master->dma_tx); -- } -+ /* before issuing the descriptors, set the QUP to run */ -+ ret = spi_qup_set_state(qup, QUP_STATE_RUN); -+ if (ret) { -+ dev_warn(qup->dev, "cannot set RUN state\n"); -+ return ret; -+ } -+ -+ if (!qup->qup_v1) { -+ if (rx_sgl) { -+ rx_done = spi_qup_dma_done; -+ } -+ -+ if (tx_sgl) { -+ tx_done = spi_qup_dma_done; -+ } -+ } -+ -+ if (rx_sgl) { -+ ret = spi_qup_prep_sg(master, rx_sgl, rx_nents, -+ DMA_DEV_TO_MEM, rx_done, -+ &qup->done); -+ if (ret) -+ return ret; -+ -+ dma_async_issue_pending(master->dma_rx); -+ } -+ -+ if (tx_sgl) { -+ ret = spi_qup_prep_sg(master, tx_sgl, tx_nents, -+ DMA_MEM_TO_DEV, tx_done, -+ &qup->dma_tx_done); -+ if (ret) -+ return ret; -+ -+ dma_async_issue_pending(master->dma_tx); -+ } -+ -+ if (rx_sgl && !wait_for_completion_timeout(&qup->done, timeout)) { -+ pr_emerg(" rx timed out"); -+ return -ETIMEDOUT; -+ } -+ -+ if (tx_sgl && !wait_for_completion_timeout(&qup->dma_tx_done, timeout)) { -+ pr_emerg(" tx timed out\n"); -+ return -ETIMEDOUT; -+ } - -- if (xfer->rx_buf && !wait_for_completion_timeout(&qup->done, timeout)) -- return -ETIMEDOUT; -+ for (; rx_sgl && rx_nents--; rx_sgl = sg_next(rx_sgl)); -+ for (; tx_sgl && tx_nents--; tx_sgl = sg_next(tx_sgl)); - -- if (xfer->tx_buf && !wait_for_completion_timeout(&qup->dma_tx_done, timeout)) -- ret = -ETIMEDOUT; -+ } while (rx_sgl || tx_sgl); - -- return ret; -+ return 0; - } - - static int spi_qup_do_pio(struct spi_device *spi, struct spi_transfer *xfer, diff --git a/target/linux/ipq806x/patches-4.9/0014-spi-qup-Fix-sg-nents-calculation.patch b/target/linux/ipq806x/patches-4.9/0014-spi-qup-Fix-sg-nents-calculation.patch deleted file mode 100644 index 2d321f1d2..000000000 --- a/target/linux/ipq806x/patches-4.9/0014-spi-qup-Fix-sg-nents-calculation.patch +++ /dev/null @@ -1,86 +0,0 @@ -From f5913e137c3dac4972ac0ddd5f248924d02d3dcb Mon Sep 17 00:00:00 2001 -From: Varadarajan Narayanan -Date: Wed, 25 May 2016 13:40:03 +0530 -Subject: [PATCH 14/69] spi: qup: Fix sg nents calculation - -lib/scatterlist.c:sg_nents_for_len() returns the number of SG -entries that total up to greater than or equal to the given -length. However, the spi-qup driver assumed that the returned -nents is for a total less than or equal to the given length. The -spi-qup driver requests nents for SPI_MAX_XFER, however the API -returns nents for SPI_MAX_XFER+delta (actually SZ_64K). - -Based on this, spi_qup_do_dma() calculates n_words and programs -that into QUP_MX_{IN|OUT}PUT_CNT register. The calculated -n_words value is more than the maximum value that can fit in the -the 16-bit COUNT field of the QUP_MX_{IN|OUT}PUT_CNT register. -And, the field gets programmed to zero. Since the COUNT field is -zero, the i/o doesn't start eventually resulting in the i/o -timing out. - -Signed-off-by: Varadarajan Narayanan ---- - drivers/spi/spi-qup.c | 38 ++++++++++++++++++++++++++++++++++++-- - 1 file changed, 36 insertions(+), 2 deletions(-) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -581,6 +581,38 @@ static unsigned int spi_qup_sgl_get_size - return length; - } - -+/** -+ * spi_qup_sg_nents_for_len - return total count of entries in scatterlist -+ * needed to satisfy the supplied length -+ * @sg: The scatterlist -+ * @len: The total required length -+ * -+ * Description: -+ * Determines the number of entries in sg that sum upto a maximum of -+ * the supplied length, taking into acount chaining as well -+ * -+ * Returns: -+ * the number of sg entries needed, negative error on failure -+ * -+ **/ -+int spi_qup_sg_nents_for_len(struct scatterlist *sg, u64 len) -+{ -+ int nents; -+ u64 total; -+ -+ if (!len) -+ return 0; -+ -+ for (nents = 0, total = 0; sg; sg = sg_next(sg)) { -+ nents++; -+ total += sg_dma_len(sg); -+ if (total > len) -+ return (nents - 1); -+ } -+ -+ return -EINVAL; -+} -+ - static int spi_qup_do_dma(struct spi_device *spi, struct spi_transfer *xfer, - unsigned long timeout) - { -@@ -597,7 +629,8 @@ unsigned long timeout) - int rx_nents = 0, tx_nents = 0; - - if (rx_sgl) { -- rx_nents = sg_nents_for_len(rx_sgl, SPI_MAX_XFER); -+ rx_nents = spi_qup_sg_nents_for_len(rx_sgl, -+ SPI_MAX_XFER); - if (rx_nents < 0) - rx_nents = sg_nents(rx_sgl); - -@@ -606,7 +639,8 @@ unsigned long timeout) - } - - if (tx_sgl) { -- tx_nents = sg_nents_for_len(tx_sgl, SPI_MAX_XFER); -+ tx_nents = spi_qup_sg_nents_for_len(tx_sgl, -+ SPI_MAX_XFER); - if (tx_nents < 0) - tx_nents = sg_nents(tx_sgl); - diff --git a/target/linux/ipq806x/patches-4.9/0027-clk-qcom-Add-support-for-SMD-RPM-Clocks.patch b/target/linux/ipq806x/patches-4.9/0027-clk-qcom-Add-support-for-SMD-RPM-Clocks.patch deleted file mode 100644 index f7ff1da8d..000000000 --- a/target/linux/ipq806x/patches-4.9/0027-clk-qcom-Add-support-for-SMD-RPM-Clocks.patch +++ /dev/null @@ -1,731 +0,0 @@ -From 41ee71bae788e1858c0a387d010c342e6bb3f4b0 Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Wed, 2 Nov 2016 17:56:56 +0200 -Subject: [PATCH 27/69] clk: qcom: Add support for SMD-RPM Clocks - -This adds initial support for clocks controlled by the Resource -Power Manager (RPM) processor on some Qualcomm SoCs, which use -the qcom_smd_rpm driver to communicate with RPM. -Such platforms are msm8916, apq8084 and msm8974. - -The RPM is a dedicated hardware engine for managing the shared -SoC resources in order to keep the lowest power profile. It -communicates with other hardware subsystems via shared memory -and accepts clock requests, aggregates the requests and turns -the clocks on/off or scales them on demand. - -This driver is based on the codeaurora.org driver: -https://www.codeaurora.org/cgit/quic/la/kernel/msm-3.10/tree/drivers/clk/qcom/clock-rpm.c - -Signed-off-by: Georgi Djakov ---- - .../devicetree/bindings/clock/qcom,rpmcc.txt | 36 ++ - drivers/clk/qcom/Kconfig | 16 + - drivers/clk/qcom/Makefile | 1 + - drivers/clk/qcom/clk-smd-rpm.c | 571 +++++++++++++++++++++ - include/dt-bindings/clock/qcom,rpmcc.h | 45 ++ - 5 files changed, 669 insertions(+) - create mode 100644 Documentation/devicetree/bindings/clock/qcom,rpmcc.txt - create mode 100644 drivers/clk/qcom/clk-smd-rpm.c - create mode 100644 include/dt-bindings/clock/qcom,rpmcc.h - ---- /dev/null -+++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt -@@ -0,0 +1,36 @@ -+Qualcomm RPM Clock Controller Binding -+------------------------------------------------ -+The RPM is a dedicated hardware engine for managing the shared -+SoC resources in order to keep the lowest power profile. It -+communicates with other hardware subsystems via shared memory -+and accepts clock requests, aggregates the requests and turns -+the clocks on/off or scales them on demand. -+ -+Required properties : -+- compatible : shall contain only one of the following. The generic -+ compatible "qcom,rpmcc" should be also included. -+ -+ "qcom,rpmcc-msm8916", "qcom,rpmcc" -+ -+- #clock-cells : shall contain 1 -+ -+Example: -+ smd { -+ compatible = "qcom,smd"; -+ -+ rpm { -+ interrupts = <0 168 1>; -+ qcom,ipc = <&apcs 8 0>; -+ qcom,smd-edge = <15>; -+ -+ rpm_requests { -+ compatible = "qcom,rpm-msm8916"; -+ qcom,smd-channels = "rpm_requests"; -+ -+ rpmcc: clock-controller { -+ compatible = "qcom,rpmcc-msm8916", "qcom,rpmcc"; -+ #clock-cells = <1>; -+ }; -+ }; -+ }; -+ }; ---- a/drivers/clk/qcom/Kconfig -+++ b/drivers/clk/qcom/Kconfig -@@ -2,6 +2,9 @@ config QCOM_GDSC - bool - select PM_GENERIC_DOMAINS if PM - -+config QCOM_RPMCC -+ bool -+ - config COMMON_CLK_QCOM - tristate "Support for Qualcomm's clock controllers" - depends on OF -@@ -9,6 +12,19 @@ config COMMON_CLK_QCOM - select REGMAP_MMIO - select RESET_CONTROLLER - -+config QCOM_CLK_SMD_RPM -+ tristate "RPM over SMD based Clock Controller" -+ depends on COMMON_CLK_QCOM && QCOM_SMD_RPM -+ select QCOM_RPMCC -+ help -+ The RPM (Resource Power Manager) is a dedicated hardware engine for -+ managing the shared SoC resources in order to keep the lowest power -+ profile. It communicates with other hardware subsystems via shared -+ memory and accepts clock requests, aggregates the requests and turns -+ the clocks on/off or scales them on demand. -+ Say Y if you want to support the clocks exposed by the RPM on -+ platforms such as apq8016, apq8084, msm8974 etc. -+ - config APQ_GCC_8084 - tristate "APQ8084 Global Clock Controller" - select QCOM_GDSC ---- a/drivers/clk/qcom/Makefile -+++ b/drivers/clk/qcom/Makefile -@@ -29,3 +29,4 @@ obj-$(CONFIG_MSM_LCC_8960) += lcc-msm896 - obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o - obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o - obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o -+obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o ---- /dev/null -+++ b/drivers/clk/qcom/clk-smd-rpm.c -@@ -0,0 +1,571 @@ -+/* -+ * Copyright (c) 2016, Linaro Limited -+ * Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * 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 -+ -+#define QCOM_RPM_KEY_SOFTWARE_ENABLE 0x6e657773 -+#define QCOM_RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY 0x62636370 -+#define QCOM_RPM_SMD_KEY_RATE 0x007a484b -+#define QCOM_RPM_SMD_KEY_ENABLE 0x62616e45 -+#define QCOM_RPM_SMD_KEY_STATE 0x54415453 -+#define QCOM_RPM_SCALING_ENABLE_ID 0x2 -+ -+#define __DEFINE_CLK_SMD_RPM(_platform, _name, _active, type, r_id, stat_id, \ -+ key) \ -+ static struct clk_smd_rpm _platform##_##_active; \ -+ static struct clk_smd_rpm _platform##_##_name = { \ -+ .rpm_res_type = (type), \ -+ .rpm_clk_id = (r_id), \ -+ .rpm_status_id = (stat_id), \ -+ .rpm_key = (key), \ -+ .peer = &_platform##_##_active, \ -+ .rate = INT_MAX, \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_smd_rpm_ops, \ -+ .name = #_name, \ -+ .parent_names = (const char *[]){ "xo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ }; \ -+ static struct clk_smd_rpm _platform##_##_active = { \ -+ .rpm_res_type = (type), \ -+ .rpm_clk_id = (r_id), \ -+ .rpm_status_id = (stat_id), \ -+ .active_only = true, \ -+ .rpm_key = (key), \ -+ .peer = &_platform##_##_name, \ -+ .rate = INT_MAX, \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_smd_rpm_ops, \ -+ .name = #_active, \ -+ .parent_names = (const char *[]){ "xo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ } -+ -+#define __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, r_id, \ -+ stat_id, r, key) \ -+ static struct clk_smd_rpm _platform##_##_active; \ -+ static struct clk_smd_rpm _platform##_##_name = { \ -+ .rpm_res_type = (type), \ -+ .rpm_clk_id = (r_id), \ -+ .rpm_status_id = (stat_id), \ -+ .rpm_key = (key), \ -+ .branch = true, \ -+ .peer = &_platform##_##_active, \ -+ .rate = (r), \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_smd_rpm_branch_ops, \ -+ .name = #_name, \ -+ .parent_names = (const char *[]){ "xo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ }; \ -+ static struct clk_smd_rpm _platform##_##_active = { \ -+ .rpm_res_type = (type), \ -+ .rpm_clk_id = (r_id), \ -+ .rpm_status_id = (stat_id), \ -+ .active_only = true, \ -+ .rpm_key = (key), \ -+ .branch = true, \ -+ .peer = &_platform##_##_name, \ -+ .rate = (r), \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_smd_rpm_branch_ops, \ -+ .name = #_active, \ -+ .parent_names = (const char *[]){ "xo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ } -+ -+#define DEFINE_CLK_SMD_RPM(_platform, _name, _active, type, r_id) \ -+ __DEFINE_CLK_SMD_RPM(_platform, _name, _active, type, r_id, \ -+ 0, QCOM_RPM_SMD_KEY_RATE) -+ -+#define DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, r_id, r) \ -+ __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, \ -+ r_id, 0, r, QCOM_RPM_SMD_KEY_ENABLE) -+ -+#define DEFINE_CLK_SMD_RPM_QDSS(_platform, _name, _active, type, r_id) \ -+ __DEFINE_CLK_SMD_RPM(_platform, _name, _active, type, r_id, \ -+ 0, QCOM_RPM_SMD_KEY_STATE) -+ -+#define DEFINE_CLK_SMD_RPM_XO_BUFFER(_platform, _name, _active, r_id) \ -+ __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, \ -+ QCOM_SMD_RPM_CLK_BUF_A, r_id, 0, 1000, \ -+ QCOM_RPM_KEY_SOFTWARE_ENABLE) -+ -+#define DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(_platform, _name, _active, r_id) \ -+ __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, \ -+ QCOM_SMD_RPM_CLK_BUF_A, r_id, 0, 1000, \ -+ QCOM_RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY) -+ -+#define to_clk_smd_rpm(_hw) container_of(_hw, struct clk_smd_rpm, hw) -+ -+struct clk_smd_rpm { -+ const int rpm_res_type; -+ const int rpm_key; -+ const int rpm_clk_id; -+ const int rpm_status_id; -+ const bool active_only; -+ bool enabled; -+ bool branch; -+ struct clk_smd_rpm *peer; -+ struct clk_hw hw; -+ unsigned long rate; -+ struct qcom_smd_rpm *rpm; -+}; -+ -+struct clk_smd_rpm_req { -+ __le32 key; -+ __le32 nbytes; -+ __le32 value; -+}; -+ -+struct rpm_cc { -+ struct qcom_rpm *rpm; -+ struct clk_hw_onecell_data data; -+ struct clk_hw *hws[]; -+}; -+ -+struct rpm_smd_clk_desc { -+ struct clk_smd_rpm **clks; -+ size_t num_clks; -+}; -+ -+static DEFINE_MUTEX(rpm_smd_clk_lock); -+ -+static int clk_smd_rpm_handoff(struct clk_smd_rpm *r) -+{ -+ int ret; -+ struct clk_smd_rpm_req req = { -+ .key = cpu_to_le32(r->rpm_key), -+ .nbytes = cpu_to_le32(sizeof(u32)), -+ .value = cpu_to_le32(INT_MAX), -+ }; -+ -+ ret = qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_ACTIVE_STATE, -+ r->rpm_res_type, r->rpm_clk_id, &req, -+ sizeof(req)); -+ if (ret) -+ return ret; -+ ret = qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_SLEEP_STATE, -+ r->rpm_res_type, r->rpm_clk_id, &req, -+ sizeof(req)); -+ if (ret) -+ return ret; -+ -+ return 0; -+} -+ -+static int clk_smd_rpm_set_rate_active(struct clk_smd_rpm *r, -+ unsigned long rate) -+{ -+ struct clk_smd_rpm_req req = { -+ .key = cpu_to_le32(r->rpm_key), -+ .nbytes = cpu_to_le32(sizeof(u32)), -+ .value = cpu_to_le32(DIV_ROUND_UP(rate, 1000)), /* to kHz */ -+ }; -+ -+ return qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_ACTIVE_STATE, -+ r->rpm_res_type, r->rpm_clk_id, &req, -+ sizeof(req)); -+} -+ -+static int clk_smd_rpm_set_rate_sleep(struct clk_smd_rpm *r, -+ unsigned long rate) -+{ -+ struct clk_smd_rpm_req req = { -+ .key = cpu_to_le32(r->rpm_key), -+ .nbytes = cpu_to_le32(sizeof(u32)), -+ .value = cpu_to_le32(DIV_ROUND_UP(rate, 1000)), /* to kHz */ -+ }; -+ -+ return qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_SLEEP_STATE, -+ r->rpm_res_type, r->rpm_clk_id, &req, -+ sizeof(req)); -+} -+ -+static void to_active_sleep(struct clk_smd_rpm *r, unsigned long rate, -+ unsigned long *active, unsigned long *sleep) -+{ -+ *active = rate; -+ -+ /* -+ * Active-only clocks don't care what the rate is during sleep. So, -+ * they vote for zero. -+ */ -+ if (r->active_only) -+ *sleep = 0; -+ else -+ *sleep = *active; -+} -+ -+static int clk_smd_rpm_prepare(struct clk_hw *hw) -+{ -+ struct clk_smd_rpm *r = to_clk_smd_rpm(hw); -+ struct clk_smd_rpm *peer = r->peer; -+ unsigned long this_rate = 0, this_sleep_rate = 0; -+ unsigned long peer_rate = 0, peer_sleep_rate = 0; -+ unsigned long active_rate, sleep_rate; -+ int ret = 0; -+ -+ mutex_lock(&rpm_smd_clk_lock); -+ -+ /* Don't send requests to the RPM if the rate has not been set. */ -+ if (!r->rate) -+ goto out; -+ -+ to_active_sleep(r, r->rate, &this_rate, &this_sleep_rate); -+ -+ /* Take peer clock's rate into account only if it's enabled. */ -+ if (peer->enabled) -+ to_active_sleep(peer, peer->rate, -+ &peer_rate, &peer_sleep_rate); -+ -+ active_rate = max(this_rate, peer_rate); -+ -+ if (r->branch) -+ active_rate = !!active_rate; -+ -+ ret = clk_smd_rpm_set_rate_active(r, active_rate); -+ if (ret) -+ goto out; -+ -+ sleep_rate = max(this_sleep_rate, peer_sleep_rate); -+ if (r->branch) -+ sleep_rate = !!sleep_rate; -+ -+ ret = clk_smd_rpm_set_rate_sleep(r, sleep_rate); -+ if (ret) -+ /* Undo the active set vote and restore it */ -+ ret = clk_smd_rpm_set_rate_active(r, peer_rate); -+ -+out: -+ if (!ret) -+ r->enabled = true; -+ -+ mutex_unlock(&rpm_smd_clk_lock); -+ -+ return ret; -+} -+ -+static void clk_smd_rpm_unprepare(struct clk_hw *hw) -+{ -+ struct clk_smd_rpm *r = to_clk_smd_rpm(hw); -+ struct clk_smd_rpm *peer = r->peer; -+ unsigned long peer_rate = 0, peer_sleep_rate = 0; -+ unsigned long active_rate, sleep_rate; -+ int ret; -+ -+ mutex_lock(&rpm_smd_clk_lock); -+ -+ if (!r->rate) -+ goto out; -+ -+ /* Take peer clock's rate into account only if it's enabled. */ -+ if (peer->enabled) -+ to_active_sleep(peer, peer->rate, &peer_rate, -+ &peer_sleep_rate); -+ -+ active_rate = r->branch ? !!peer_rate : peer_rate; -+ ret = clk_smd_rpm_set_rate_active(r, active_rate); -+ if (ret) -+ goto out; -+ -+ sleep_rate = r->branch ? !!peer_sleep_rate : peer_sleep_rate; -+ ret = clk_smd_rpm_set_rate_sleep(r, sleep_rate); -+ if (ret) -+ goto out; -+ -+ r->enabled = false; -+ -+out: -+ mutex_unlock(&rpm_smd_clk_lock); -+} -+ -+static int clk_smd_rpm_set_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long parent_rate) -+{ -+ struct clk_smd_rpm *r = to_clk_smd_rpm(hw); -+ struct clk_smd_rpm *peer = r->peer; -+ unsigned long active_rate, sleep_rate; -+ unsigned long this_rate = 0, this_sleep_rate = 0; -+ unsigned long peer_rate = 0, peer_sleep_rate = 0; -+ int ret = 0; -+ -+ mutex_lock(&rpm_smd_clk_lock); -+ -+ if (!r->enabled) -+ goto out; -+ -+ to_active_sleep(r, rate, &this_rate, &this_sleep_rate); -+ -+ /* Take peer clock's rate into account only if it's enabled. */ -+ if (peer->enabled) -+ to_active_sleep(peer, peer->rate, -+ &peer_rate, &peer_sleep_rate); -+ -+ active_rate = max(this_rate, peer_rate); -+ ret = clk_smd_rpm_set_rate_active(r, active_rate); -+ if (ret) -+ goto out; -+ -+ sleep_rate = max(this_sleep_rate, peer_sleep_rate); -+ ret = clk_smd_rpm_set_rate_sleep(r, sleep_rate); -+ if (ret) -+ goto out; -+ -+ r->rate = rate; -+ -+out: -+ mutex_unlock(&rpm_smd_clk_lock); -+ -+ return ret; -+} -+ -+static long clk_smd_rpm_round_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long *parent_rate) -+{ -+ /* -+ * RPM handles rate rounding and we don't have a way to -+ * know what the rate will be, so just return whatever -+ * rate is requested. -+ */ -+ return rate; -+} -+ -+static unsigned long clk_smd_rpm_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ struct clk_smd_rpm *r = to_clk_smd_rpm(hw); -+ -+ /* -+ * RPM handles rate rounding and we don't have a way to -+ * know what the rate will be, so just return whatever -+ * rate was set. -+ */ -+ return r->rate; -+} -+ -+static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm) -+{ -+ int ret; -+ struct clk_smd_rpm_req req = { -+ .key = cpu_to_le32(QCOM_RPM_SMD_KEY_ENABLE), -+ .nbytes = cpu_to_le32(sizeof(u32)), -+ .value = cpu_to_le32(1), -+ }; -+ -+ ret = qcom_rpm_smd_write(rpm, QCOM_SMD_RPM_SLEEP_STATE, -+ QCOM_SMD_RPM_MISC_CLK, -+ QCOM_RPM_SCALING_ENABLE_ID, &req, sizeof(req)); -+ if (ret) { -+ pr_err("RPM clock scaling (sleep set) not enabled!\n"); -+ return ret; -+ } -+ -+ ret = qcom_rpm_smd_write(rpm, QCOM_SMD_RPM_ACTIVE_STATE, -+ QCOM_SMD_RPM_MISC_CLK, -+ QCOM_RPM_SCALING_ENABLE_ID, &req, sizeof(req)); -+ if (ret) { -+ pr_err("RPM clock scaling (active set) not enabled!\n"); -+ return ret; -+ } -+ -+ pr_debug("%s: RPM clock scaling is enabled\n", __func__); -+ return 0; -+} -+ -+static const struct clk_ops clk_smd_rpm_ops = { -+ .prepare = clk_smd_rpm_prepare, -+ .unprepare = clk_smd_rpm_unprepare, -+ .set_rate = clk_smd_rpm_set_rate, -+ .round_rate = clk_smd_rpm_round_rate, -+ .recalc_rate = clk_smd_rpm_recalc_rate, -+}; -+ -+static const struct clk_ops clk_smd_rpm_branch_ops = { -+ .prepare = clk_smd_rpm_prepare, -+ .unprepare = clk_smd_rpm_unprepare, -+ .round_rate = clk_smd_rpm_round_rate, -+ .recalc_rate = clk_smd_rpm_recalc_rate, -+}; -+ -+/* msm8916 */ -+DEFINE_CLK_SMD_RPM(msm8916, pcnoc_clk, pcnoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 0); -+DEFINE_CLK_SMD_RPM(msm8916, snoc_clk, snoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 1); -+DEFINE_CLK_SMD_RPM(msm8916, bimc_clk, bimc_a_clk, QCOM_SMD_RPM_MEM_CLK, 0); -+DEFINE_CLK_SMD_RPM_QDSS(msm8916, qdss_clk, qdss_a_clk, QCOM_SMD_RPM_MISC_CLK, 1); -+DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8916, bb_clk1, bb_clk1_a, 1); -+DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8916, bb_clk2, bb_clk2_a, 2); -+DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8916, rf_clk1, rf_clk1_a, 4); -+DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8916, rf_clk2, rf_clk2_a, 5); -+DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8916, bb_clk1_pin, bb_clk1_a_pin, 1); -+DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8916, bb_clk2_pin, bb_clk2_a_pin, 2); -+DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8916, rf_clk1_pin, rf_clk1_a_pin, 4); -+DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8916, rf_clk2_pin, rf_clk2_a_pin, 5); -+ -+static struct clk_smd_rpm *msm8916_clks[] = { -+ [RPM_SMD_PCNOC_CLK] = &msm8916_pcnoc_clk, -+ [RPM_SMD_PCNOC_A_CLK] = &msm8916_pcnoc_a_clk, -+ [RPM_SMD_SNOC_CLK] = &msm8916_snoc_clk, -+ [RPM_SMD_SNOC_A_CLK] = &msm8916_snoc_a_clk, -+ [RPM_SMD_BIMC_CLK] = &msm8916_bimc_clk, -+ [RPM_SMD_BIMC_A_CLK] = &msm8916_bimc_a_clk, -+ [RPM_SMD_QDSS_CLK] = &msm8916_qdss_clk, -+ [RPM_SMD_QDSS_A_CLK] = &msm8916_qdss_a_clk, -+ [RPM_SMD_BB_CLK1] = &msm8916_bb_clk1, -+ [RPM_SMD_BB_CLK1_A] = &msm8916_bb_clk1_a, -+ [RPM_SMD_BB_CLK2] = &msm8916_bb_clk2, -+ [RPM_SMD_BB_CLK2_A] = &msm8916_bb_clk2_a, -+ [RPM_SMD_RF_CLK1] = &msm8916_rf_clk1, -+ [RPM_SMD_RF_CLK1_A] = &msm8916_rf_clk1_a, -+ [RPM_SMD_RF_CLK2] = &msm8916_rf_clk2, -+ [RPM_SMD_RF_CLK2_A] = &msm8916_rf_clk2_a, -+ [RPM_SMD_BB_CLK1_PIN] = &msm8916_bb_clk1_pin, -+ [RPM_SMD_BB_CLK1_A_PIN] = &msm8916_bb_clk1_a_pin, -+ [RPM_SMD_BB_CLK2_PIN] = &msm8916_bb_clk2_pin, -+ [RPM_SMD_BB_CLK2_A_PIN] = &msm8916_bb_clk2_a_pin, -+ [RPM_SMD_RF_CLK1_PIN] = &msm8916_rf_clk1_pin, -+ [RPM_SMD_RF_CLK1_A_PIN] = &msm8916_rf_clk1_a_pin, -+ [RPM_SMD_RF_CLK2_PIN] = &msm8916_rf_clk2_pin, -+ [RPM_SMD_RF_CLK2_A_PIN] = &msm8916_rf_clk2_a_pin, -+}; -+ -+static const struct rpm_smd_clk_desc rpm_clk_msm8916 = { -+ .clks = msm8916_clks, -+ .num_clks = ARRAY_SIZE(msm8916_clks), -+}; -+ -+static const struct of_device_id rpm_smd_clk_match_table[] = { -+ { .compatible = "qcom,rpmcc-msm8916", .data = &rpm_clk_msm8916 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, rpm_smd_clk_match_table); -+ -+static int rpm_smd_clk_probe(struct platform_device *pdev) -+{ -+ struct clk_hw **hws; -+ struct rpm_cc *rcc; -+ struct clk_hw_onecell_data *data; -+ int ret; -+ size_t num_clks, i; -+ struct qcom_smd_rpm *rpm; -+ struct clk_smd_rpm **rpm_smd_clks; -+ const struct rpm_smd_clk_desc *desc; -+ -+ rpm = dev_get_drvdata(pdev->dev.parent); -+ if (!rpm) { -+ dev_err(&pdev->dev, "Unable to retrieve handle to RPM\n"); -+ return -ENODEV; -+ } -+ -+ desc = of_device_get_match_data(&pdev->dev); -+ if (!desc) -+ return -EINVAL; -+ -+ rpm_smd_clks = desc->clks; -+ num_clks = desc->num_clks; -+ -+ rcc = devm_kzalloc(&pdev->dev, sizeof(*rcc) + sizeof(*hws) * num_clks, -+ GFP_KERNEL); -+ if (!rcc) -+ return -ENOMEM; -+ -+ hws = rcc->hws; -+ data = &rcc->data; -+ data->num = num_clks; -+ -+ for (i = 0; i < num_clks; i++) { -+ if (!rpm_smd_clks[i]) { -+ continue; -+ } -+ -+ rpm_smd_clks[i]->rpm = rpm; -+ -+ ret = clk_smd_rpm_handoff(rpm_smd_clks[i]); -+ if (ret) -+ goto err; -+ } -+ -+ ret = clk_smd_rpm_enable_scaling(rpm); -+ if (ret) -+ goto err; -+ -+ for (i = 0; i < num_clks; i++) { -+ if (!rpm_smd_clks[i]) { -+ data->hws[i] = ERR_PTR(-ENOENT); -+ continue; -+ } -+ -+ ret = devm_clk_hw_register(&pdev->dev, &rpm_smd_clks[i]->hw); -+ if (ret) -+ goto err; -+ } -+ -+ ret = of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_onecell_get, -+ data); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_err(&pdev->dev, "Error registering SMD clock driver (%d)\n", ret); -+ return ret; -+} -+ -+static int rpm_smd_clk_remove(struct platform_device *pdev) -+{ -+ of_clk_del_provider(pdev->dev.of_node); -+ return 0; -+} -+ -+static struct platform_driver rpm_smd_clk_driver = { -+ .driver = { -+ .name = "qcom-clk-smd-rpm", -+ .of_match_table = rpm_smd_clk_match_table, -+ }, -+ .probe = rpm_smd_clk_probe, -+ .remove = rpm_smd_clk_remove, -+}; -+ -+static int __init rpm_smd_clk_init(void) -+{ -+ return platform_driver_register(&rpm_smd_clk_driver); -+} -+core_initcall(rpm_smd_clk_init); -+ -+static void __exit rpm_smd_clk_exit(void) -+{ -+ platform_driver_unregister(&rpm_smd_clk_driver); -+} -+module_exit(rpm_smd_clk_exit); -+ -+MODULE_DESCRIPTION("Qualcomm RPM over SMD Clock Controller Driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:qcom-clk-smd-rpm"); ---- /dev/null -+++ b/include/dt-bindings/clock/qcom,rpmcc.h -@@ -0,0 +1,45 @@ -+/* -+ * Copyright 2015 Linaro Limited -+ * -+ * 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 _DT_BINDINGS_CLK_MSM_RPMCC_H -+#define _DT_BINDINGS_CLK_MSM_RPMCC_H -+ -+/* msm8916 */ -+#define RPM_SMD_XO_CLK_SRC 0 -+#define RPM_SMD_XO_A_CLK_SRC 1 -+#define RPM_SMD_PCNOC_CLK 2 -+#define RPM_SMD_PCNOC_A_CLK 3 -+#define RPM_SMD_SNOC_CLK 4 -+#define RPM_SMD_SNOC_A_CLK 5 -+#define RPM_SMD_BIMC_CLK 6 -+#define RPM_SMD_BIMC_A_CLK 7 -+#define RPM_SMD_QDSS_CLK 8 -+#define RPM_SMD_QDSS_A_CLK 9 -+#define RPM_SMD_BB_CLK1 10 -+#define RPM_SMD_BB_CLK1_A 11 -+#define RPM_SMD_BB_CLK2 12 -+#define RPM_SMD_BB_CLK2_A 13 -+#define RPM_SMD_RF_CLK1 14 -+#define RPM_SMD_RF_CLK1_A 15 -+#define RPM_SMD_RF_CLK2 16 -+#define RPM_SMD_RF_CLK2_A 17 -+#define RPM_SMD_BB_CLK1_PIN 18 -+#define RPM_SMD_BB_CLK1_A_PIN 19 -+#define RPM_SMD_BB_CLK2_PIN 20 -+#define RPM_SMD_BB_CLK2_A_PIN 21 -+#define RPM_SMD_RF_CLK1_PIN 22 -+#define RPM_SMD_RF_CLK1_A_PIN 23 -+#define RPM_SMD_RF_CLK2_PIN 24 -+#define RPM_SMD_RF_CLK2_A_PIN 25 -+ -+#endif diff --git a/target/linux/ipq806x/patches-4.9/0028-clk-qcom-Add-support-for-RPM-Clocks.patch b/target/linux/ipq806x/patches-4.9/0028-clk-qcom-Add-support-for-RPM-Clocks.patch deleted file mode 100644 index 72b392dc1..000000000 --- a/target/linux/ipq806x/patches-4.9/0028-clk-qcom-Add-support-for-RPM-Clocks.patch +++ /dev/null @@ -1,587 +0,0 @@ -From 21e7116c9d639f3283d4cec286fed1e703832b43 Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Wed, 2 Nov 2016 17:56:57 +0200 -Subject: [PATCH 28/69] clk: qcom: Add support for RPM Clocks - -This adds initial support for clocks controlled by the Resource -Power Manager (RPM) processor on some Qualcomm SoCs, which use -the qcom_rpm driver to communicate with RPM. -Such platforms are apq8064 and msm8960. - -Signed-off-by: Georgi Djakov -Acked-by: Rob Herring -Signed-off-by: Stephen Boyd ---- - .../devicetree/bindings/clock/qcom,rpmcc.txt | 1 + - drivers/clk/qcom/Kconfig | 13 + - drivers/clk/qcom/Makefile | 1 + - drivers/clk/qcom/clk-rpm.c | 489 +++++++++++++++++++++ - include/dt-bindings/clock/qcom,rpmcc.h | 24 + - 5 files changed, 528 insertions(+) - create mode 100644 drivers/clk/qcom/clk-rpm.c - ---- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt -+++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt -@@ -11,6 +11,7 @@ Required properties : - compatible "qcom,rpmcc" should be also included. - - "qcom,rpmcc-msm8916", "qcom,rpmcc" -+ "qcom,rpmcc-apq8064", "qcom,rpmcc" - - - #clock-cells : shall contain 1 - ---- a/drivers/clk/qcom/Kconfig -+++ b/drivers/clk/qcom/Kconfig -@@ -12,6 +12,19 @@ config COMMON_CLK_QCOM - select REGMAP_MMIO - select RESET_CONTROLLER - -+config QCOM_CLK_RPM -+ tristate "RPM based Clock Controller" -+ depends on COMMON_CLK_QCOM && MFD_QCOM_RPM -+ select QCOM_RPMCC -+ help -+ The RPM (Resource Power Manager) is a dedicated hardware engine for -+ managing the shared SoC resources in order to keep the lowest power -+ profile. It communicates with other hardware subsystems via shared -+ memory and accepts clock requests, aggregates the requests and turns -+ the clocks on/off or scales them on demand. -+ Say Y if you want to support the clocks exposed by the RPM on -+ platforms such as ipq806x, msm8660, msm8960 etc. -+ - config QCOM_CLK_SMD_RPM - tristate "RPM over SMD based Clock Controller" - depends on COMMON_CLK_QCOM && QCOM_SMD_RPM ---- a/drivers/clk/qcom/Makefile -+++ b/drivers/clk/qcom/Makefile -@@ -29,4 +29,5 @@ obj-$(CONFIG_MSM_LCC_8960) += lcc-msm896 - obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o - obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o - obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o -+obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o - obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o ---- /dev/null -+++ b/drivers/clk/qcom/clk-rpm.c -@@ -0,0 +1,489 @@ -+/* -+ * Copyright (c) 2016, Linaro Limited -+ * Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * 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 -+ -+#define QCOM_RPM_MISC_CLK_TYPE 0x306b6c63 -+#define QCOM_RPM_SCALING_ENABLE_ID 0x2 -+ -+#define DEFINE_CLK_RPM(_platform, _name, _active, r_id) \ -+ static struct clk_rpm _platform##_##_active; \ -+ static struct clk_rpm _platform##_##_name = { \ -+ .rpm_clk_id = (r_id), \ -+ .peer = &_platform##_##_active, \ -+ .rate = INT_MAX, \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_rpm_ops, \ -+ .name = #_name, \ -+ .parent_names = (const char *[]){ "pxo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ }; \ -+ static struct clk_rpm _platform##_##_active = { \ -+ .rpm_clk_id = (r_id), \ -+ .peer = &_platform##_##_name, \ -+ .active_only = true, \ -+ .rate = INT_MAX, \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_rpm_ops, \ -+ .name = #_active, \ -+ .parent_names = (const char *[]){ "pxo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ } -+ -+#define DEFINE_CLK_RPM_PXO_BRANCH(_platform, _name, _active, r_id, r) \ -+ static struct clk_rpm _platform##_##_active; \ -+ static struct clk_rpm _platform##_##_name = { \ -+ .rpm_clk_id = (r_id), \ -+ .active_only = true, \ -+ .peer = &_platform##_##_active, \ -+ .rate = (r), \ -+ .branch = true, \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_rpm_branch_ops, \ -+ .name = #_name, \ -+ .parent_names = (const char *[]){ "pxo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ }; \ -+ static struct clk_rpm _platform##_##_active = { \ -+ .rpm_clk_id = (r_id), \ -+ .peer = &_platform##_##_name, \ -+ .rate = (r), \ -+ .branch = true, \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_rpm_branch_ops, \ -+ .name = #_active, \ -+ .parent_names = (const char *[]){ "pxo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ } -+ -+#define DEFINE_CLK_RPM_CXO_BRANCH(_platform, _name, _active, r_id, r) \ -+ static struct clk_rpm _platform##_##_active; \ -+ static struct clk_rpm _platform##_##_name = { \ -+ .rpm_clk_id = (r_id), \ -+ .peer = &_platform##_##_active, \ -+ .rate = (r), \ -+ .branch = true, \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_rpm_branch_ops, \ -+ .name = #_name, \ -+ .parent_names = (const char *[]){ "cxo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ }; \ -+ static struct clk_rpm _platform##_##_active = { \ -+ .rpm_clk_id = (r_id), \ -+ .active_only = true, \ -+ .peer = &_platform##_##_name, \ -+ .rate = (r), \ -+ .branch = true, \ -+ .hw.init = &(struct clk_init_data){ \ -+ .ops = &clk_rpm_branch_ops, \ -+ .name = #_active, \ -+ .parent_names = (const char *[]){ "cxo_board" }, \ -+ .num_parents = 1, \ -+ }, \ -+ } -+ -+#define to_clk_rpm(_hw) container_of(_hw, struct clk_rpm, hw) -+ -+struct clk_rpm { -+ const int rpm_clk_id; -+ const bool active_only; -+ unsigned long rate; -+ bool enabled; -+ bool branch; -+ struct clk_rpm *peer; -+ struct clk_hw hw; -+ struct qcom_rpm *rpm; -+}; -+ -+struct rpm_cc { -+ struct qcom_rpm *rpm; -+ struct clk_hw_onecell_data data; -+ struct clk_hw *hws[]; -+}; -+ -+struct rpm_clk_desc { -+ struct clk_rpm **clks; -+ size_t num_clks; -+}; -+ -+static DEFINE_MUTEX(rpm_clk_lock); -+ -+static int clk_rpm_handoff(struct clk_rpm *r) -+{ -+ int ret; -+ u32 value = INT_MAX; -+ -+ ret = qcom_rpm_write(r->rpm, QCOM_RPM_ACTIVE_STATE, -+ r->rpm_clk_id, &value, 1); -+ if (ret) -+ return ret; -+ ret = qcom_rpm_write(r->rpm, QCOM_RPM_SLEEP_STATE, -+ r->rpm_clk_id, &value, 1); -+ if (ret) -+ return ret; -+ -+ return 0; -+} -+ -+static int clk_rpm_set_rate_active(struct clk_rpm *r, unsigned long rate) -+{ -+ u32 value = DIV_ROUND_UP(rate, 1000); /* to kHz */ -+ -+ return qcom_rpm_write(r->rpm, QCOM_RPM_ACTIVE_STATE, -+ r->rpm_clk_id, &value, 1); -+} -+ -+static int clk_rpm_set_rate_sleep(struct clk_rpm *r, unsigned long rate) -+{ -+ u32 value = DIV_ROUND_UP(rate, 1000); /* to kHz */ -+ -+ return qcom_rpm_write(r->rpm, QCOM_RPM_SLEEP_STATE, -+ r->rpm_clk_id, &value, 1); -+} -+ -+static void to_active_sleep(struct clk_rpm *r, unsigned long rate, -+ unsigned long *active, unsigned long *sleep) -+{ -+ *active = rate; -+ -+ /* -+ * Active-only clocks don't care what the rate is during sleep. So, -+ * they vote for zero. -+ */ -+ if (r->active_only) -+ *sleep = 0; -+ else -+ *sleep = *active; -+} -+ -+static int clk_rpm_prepare(struct clk_hw *hw) -+{ -+ struct clk_rpm *r = to_clk_rpm(hw); -+ struct clk_rpm *peer = r->peer; -+ unsigned long this_rate = 0, this_sleep_rate = 0; -+ unsigned long peer_rate = 0, peer_sleep_rate = 0; -+ unsigned long active_rate, sleep_rate; -+ int ret = 0; -+ -+ mutex_lock(&rpm_clk_lock); -+ -+ /* Don't send requests to the RPM if the rate has not been set. */ -+ if (!r->rate) -+ goto out; -+ -+ to_active_sleep(r, r->rate, &this_rate, &this_sleep_rate); -+ -+ /* Take peer clock's rate into account only if it's enabled. */ -+ if (peer->enabled) -+ to_active_sleep(peer, peer->rate, -+ &peer_rate, &peer_sleep_rate); -+ -+ active_rate = max(this_rate, peer_rate); -+ -+ if (r->branch) -+ active_rate = !!active_rate; -+ -+ ret = clk_rpm_set_rate_active(r, active_rate); -+ if (ret) -+ goto out; -+ -+ sleep_rate = max(this_sleep_rate, peer_sleep_rate); -+ if (r->branch) -+ sleep_rate = !!sleep_rate; -+ -+ ret = clk_rpm_set_rate_sleep(r, sleep_rate); -+ if (ret) -+ /* Undo the active set vote and restore it */ -+ ret = clk_rpm_set_rate_active(r, peer_rate); -+ -+out: -+ if (!ret) -+ r->enabled = true; -+ -+ mutex_unlock(&rpm_clk_lock); -+ -+ return ret; -+} -+ -+static void clk_rpm_unprepare(struct clk_hw *hw) -+{ -+ struct clk_rpm *r = to_clk_rpm(hw); -+ struct clk_rpm *peer = r->peer; -+ unsigned long peer_rate = 0, peer_sleep_rate = 0; -+ unsigned long active_rate, sleep_rate; -+ int ret; -+ -+ mutex_lock(&rpm_clk_lock); -+ -+ if (!r->rate) -+ goto out; -+ -+ /* Take peer clock's rate into account only if it's enabled. */ -+ if (peer->enabled) -+ to_active_sleep(peer, peer->rate, &peer_rate, -+ &peer_sleep_rate); -+ -+ active_rate = r->branch ? !!peer_rate : peer_rate; -+ ret = clk_rpm_set_rate_active(r, active_rate); -+ if (ret) -+ goto out; -+ -+ sleep_rate = r->branch ? !!peer_sleep_rate : peer_sleep_rate; -+ ret = clk_rpm_set_rate_sleep(r, sleep_rate); -+ if (ret) -+ goto out; -+ -+ r->enabled = false; -+ -+out: -+ mutex_unlock(&rpm_clk_lock); -+} -+ -+static int clk_rpm_set_rate(struct clk_hw *hw, -+ unsigned long rate, unsigned long parent_rate) -+{ -+ struct clk_rpm *r = to_clk_rpm(hw); -+ struct clk_rpm *peer = r->peer; -+ unsigned long active_rate, sleep_rate; -+ unsigned long this_rate = 0, this_sleep_rate = 0; -+ unsigned long peer_rate = 0, peer_sleep_rate = 0; -+ int ret = 0; -+ -+ mutex_lock(&rpm_clk_lock); -+ -+ if (!r->enabled) -+ goto out; -+ -+ to_active_sleep(r, rate, &this_rate, &this_sleep_rate); -+ -+ /* Take peer clock's rate into account only if it's enabled. */ -+ if (peer->enabled) -+ to_active_sleep(peer, peer->rate, -+ &peer_rate, &peer_sleep_rate); -+ -+ active_rate = max(this_rate, peer_rate); -+ ret = clk_rpm_set_rate_active(r, active_rate); -+ if (ret) -+ goto out; -+ -+ sleep_rate = max(this_sleep_rate, peer_sleep_rate); -+ ret = clk_rpm_set_rate_sleep(r, sleep_rate); -+ if (ret) -+ goto out; -+ -+ r->rate = rate; -+ -+out: -+ mutex_unlock(&rpm_clk_lock); -+ -+ return ret; -+} -+ -+static long clk_rpm_round_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long *parent_rate) -+{ -+ /* -+ * RPM handles rate rounding and we don't have a way to -+ * know what the rate will be, so just return whatever -+ * rate is requested. -+ */ -+ return rate; -+} -+ -+static unsigned long clk_rpm_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ struct clk_rpm *r = to_clk_rpm(hw); -+ -+ /* -+ * RPM handles rate rounding and we don't have a way to -+ * know what the rate will be, so just return whatever -+ * rate was set. -+ */ -+ return r->rate; -+} -+ -+static const struct clk_ops clk_rpm_ops = { -+ .prepare = clk_rpm_prepare, -+ .unprepare = clk_rpm_unprepare, -+ .set_rate = clk_rpm_set_rate, -+ .round_rate = clk_rpm_round_rate, -+ .recalc_rate = clk_rpm_recalc_rate, -+}; -+ -+static const struct clk_ops clk_rpm_branch_ops = { -+ .prepare = clk_rpm_prepare, -+ .unprepare = clk_rpm_unprepare, -+ .round_rate = clk_rpm_round_rate, -+ .recalc_rate = clk_rpm_recalc_rate, -+}; -+ -+/* apq8064 */ -+DEFINE_CLK_RPM(apq8064, afab_clk, afab_a_clk, QCOM_RPM_APPS_FABRIC_CLK); -+DEFINE_CLK_RPM(apq8064, cfpb_clk, cfpb_a_clk, QCOM_RPM_CFPB_CLK); -+DEFINE_CLK_RPM(apq8064, daytona_clk, daytona_a_clk, QCOM_RPM_DAYTONA_FABRIC_CLK); -+DEFINE_CLK_RPM(apq8064, ebi1_clk, ebi1_a_clk, QCOM_RPM_EBI1_CLK); -+DEFINE_CLK_RPM(apq8064, mmfab_clk, mmfab_a_clk, QCOM_RPM_MM_FABRIC_CLK); -+DEFINE_CLK_RPM(apq8064, mmfpb_clk, mmfpb_a_clk, QCOM_RPM_MMFPB_CLK); -+DEFINE_CLK_RPM(apq8064, sfab_clk, sfab_a_clk, QCOM_RPM_SYS_FABRIC_CLK); -+DEFINE_CLK_RPM(apq8064, sfpb_clk, sfpb_a_clk, QCOM_RPM_SFPB_CLK); -+DEFINE_CLK_RPM(apq8064, qdss_clk, qdss_a_clk, QCOM_RPM_QDSS_CLK); -+ -+static struct clk_rpm *apq8064_clks[] = { -+ [RPM_APPS_FABRIC_CLK] = &apq8064_afab_clk, -+ [RPM_APPS_FABRIC_A_CLK] = &apq8064_afab_a_clk, -+ [RPM_CFPB_CLK] = &apq8064_cfpb_clk, -+ [RPM_CFPB_A_CLK] = &apq8064_cfpb_a_clk, -+ [RPM_DAYTONA_FABRIC_CLK] = &apq8064_daytona_clk, -+ [RPM_DAYTONA_FABRIC_A_CLK] = &apq8064_daytona_a_clk, -+ [RPM_EBI1_CLK] = &apq8064_ebi1_clk, -+ [RPM_EBI1_A_CLK] = &apq8064_ebi1_a_clk, -+ [RPM_MM_FABRIC_CLK] = &apq8064_mmfab_clk, -+ [RPM_MM_FABRIC_A_CLK] = &apq8064_mmfab_a_clk, -+ [RPM_MMFPB_CLK] = &apq8064_mmfpb_clk, -+ [RPM_MMFPB_A_CLK] = &apq8064_mmfpb_a_clk, -+ [RPM_SYS_FABRIC_CLK] = &apq8064_sfab_clk, -+ [RPM_SYS_FABRIC_A_CLK] = &apq8064_sfab_a_clk, -+ [RPM_SFPB_CLK] = &apq8064_sfpb_clk, -+ [RPM_SFPB_A_CLK] = &apq8064_sfpb_a_clk, -+ [RPM_QDSS_CLK] = &apq8064_qdss_clk, -+ [RPM_QDSS_A_CLK] = &apq8064_qdss_a_clk, -+}; -+ -+static const struct rpm_clk_desc rpm_clk_apq8064 = { -+ .clks = apq8064_clks, -+ .num_clks = ARRAY_SIZE(apq8064_clks), -+}; -+ -+static const struct of_device_id rpm_clk_match_table[] = { -+ { .compatible = "qcom,rpmcc-apq8064", .data = &rpm_clk_apq8064 }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, rpm_clk_match_table); -+ -+static int rpm_clk_probe(struct platform_device *pdev) -+{ -+ struct clk_hw **hws; -+ struct rpm_cc *rcc; -+ struct clk_hw_onecell_data *data; -+ int ret; -+ size_t num_clks, i; -+ struct qcom_rpm *rpm; -+ struct clk_rpm **rpm_clks; -+ const struct rpm_clk_desc *desc; -+ -+ rpm = dev_get_drvdata(pdev->dev.parent); -+ if (!rpm) { -+ dev_err(&pdev->dev, "Unable to retrieve handle to RPM\n"); -+ return -ENODEV; -+ } -+ -+ desc = of_device_get_match_data(&pdev->dev); -+ if (!desc) -+ return -EINVAL; -+ -+ rpm_clks = desc->clks; -+ num_clks = desc->num_clks; -+ -+ rcc = devm_kzalloc(&pdev->dev, sizeof(*rcc) + sizeof(*hws) * num_clks, -+ GFP_KERNEL); -+ if (!rcc) -+ return -ENOMEM; -+ -+ hws = rcc->hws; -+ data = &rcc->data; -+ data->num = num_clks; -+ -+ for (i = 0; i < num_clks; i++) { -+ if (!rpm_clks[i]) -+ continue; -+ -+ rpm_clks[i]->rpm = rpm; -+ -+ ret = clk_rpm_handoff(rpm_clks[i]); -+ if (ret) -+ goto err; -+ } -+ -+ for (i = 0; i < num_clks; i++) { -+ if (!rpm_clks[i]) { -+ data->hws[i] = ERR_PTR(-ENOENT); -+ continue; -+ } -+ -+ ret = devm_clk_hw_register(&pdev->dev, &rpm_clks[i]->hw); -+ if (ret) -+ goto err; -+ } -+ -+ ret = of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_onecell_get, -+ data); -+ if (ret) -+ goto err; -+ -+ return 0; -+err: -+ dev_err(&pdev->dev, "Error registering RPM Clock driver (%d)\n", ret); -+ return ret; -+} -+ -+static int rpm_clk_remove(struct platform_device *pdev) -+{ -+ of_clk_del_provider(pdev->dev.of_node); -+ return 0; -+} -+ -+static struct platform_driver rpm_clk_driver = { -+ .driver = { -+ .name = "qcom-clk-rpm", -+ .of_match_table = rpm_clk_match_table, -+ }, -+ .probe = rpm_clk_probe, -+ .remove = rpm_clk_remove, -+}; -+ -+static int __init rpm_clk_init(void) -+{ -+ return platform_driver_register(&rpm_clk_driver); -+} -+core_initcall(rpm_clk_init); -+ -+static void __exit rpm_clk_exit(void) -+{ -+ platform_driver_unregister(&rpm_clk_driver); -+} -+module_exit(rpm_clk_exit); -+ -+MODULE_DESCRIPTION("Qualcomm RPM Clock Controller Driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:qcom-clk-rpm"); ---- a/include/dt-bindings/clock/qcom,rpmcc.h -+++ b/include/dt-bindings/clock/qcom,rpmcc.h -@@ -14,6 +14,30 @@ - #ifndef _DT_BINDINGS_CLK_MSM_RPMCC_H - #define _DT_BINDINGS_CLK_MSM_RPMCC_H - -+/* apq8064 */ -+#define RPM_PXO_CLK 0 -+#define RPM_PXO_A_CLK 1 -+#define RPM_CXO_CLK 2 -+#define RPM_CXO_A_CLK 3 -+#define RPM_APPS_FABRIC_CLK 4 -+#define RPM_APPS_FABRIC_A_CLK 5 -+#define RPM_CFPB_CLK 6 -+#define RPM_CFPB_A_CLK 7 -+#define RPM_QDSS_CLK 8 -+#define RPM_QDSS_A_CLK 9 -+#define RPM_DAYTONA_FABRIC_CLK 10 -+#define RPM_DAYTONA_FABRIC_A_CLK 11 -+#define RPM_EBI1_CLK 12 -+#define RPM_EBI1_A_CLK 13 -+#define RPM_MM_FABRIC_CLK 14 -+#define RPM_MM_FABRIC_A_CLK 15 -+#define RPM_MMFPB_CLK 16 -+#define RPM_MMFPB_A_CLK 17 -+#define RPM_SYS_FABRIC_CLK 18 -+#define RPM_SYS_FABRIC_A_CLK 19 -+#define RPM_SFPB_CLK 20 -+#define RPM_SFPB_A_CLK 21 -+ - /* msm8916 */ - #define RPM_SMD_XO_CLK_SRC 0 - #define RPM_SMD_XO_A_CLK_SRC 1 diff --git a/target/linux/ipq806x/patches-4.9/0029-clk-qcom-clk-rpm-Fix-clk_hw-references.patch b/target/linux/ipq806x/patches-4.9/0029-clk-qcom-clk-rpm-Fix-clk_hw-references.patch deleted file mode 100644 index 1b1b558dd..000000000 --- a/target/linux/ipq806x/patches-4.9/0029-clk-qcom-clk-rpm-Fix-clk_hw-references.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 7028c21deb2c6205bb896cc3719414de3d6d6a6e Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Wed, 23 Nov 2016 16:52:49 +0200 -Subject: [PATCH 29/69] clk: qcom: clk-rpm: Fix clk_hw references - -Fix the clk_hw references to the actual clocks and add a xlate function -to return the hw pointers from the already existing static array. - -Reported-by: Michael Scott -Signed-off-by: Georgi Djakov -Signed-off-by: Stephen Boyd ---- - drivers/clk/qcom/clk-rpm.c | 36 ++++++++++++++++++++++-------------- - 1 file changed, 22 insertions(+), 14 deletions(-) - ---- a/drivers/clk/qcom/clk-rpm.c -+++ b/drivers/clk/qcom/clk-rpm.c -@@ -127,8 +127,8 @@ struct clk_rpm { - - struct rpm_cc { - struct qcom_rpm *rpm; -- struct clk_hw_onecell_data data; -- struct clk_hw *hws[]; -+ struct clk_rpm **clks; -+ size_t num_clks; - }; - - struct rpm_clk_desc { -@@ -391,11 +391,23 @@ static const struct of_device_id rpm_clk - }; - MODULE_DEVICE_TABLE(of, rpm_clk_match_table); - -+static struct clk_hw *qcom_rpm_clk_hw_get(struct of_phandle_args *clkspec, -+ void *data) -+{ -+ struct rpm_cc *rcc = data; -+ unsigned int idx = clkspec->args[0]; -+ -+ if (idx >= rcc->num_clks) { -+ pr_err("%s: invalid index %u\n", __func__, idx); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ return rcc->clks[idx] ? &rcc->clks[idx]->hw : ERR_PTR(-ENOENT); -+} -+ - static int rpm_clk_probe(struct platform_device *pdev) - { -- struct clk_hw **hws; - struct rpm_cc *rcc; -- struct clk_hw_onecell_data *data; - int ret; - size_t num_clks, i; - struct qcom_rpm *rpm; -@@ -415,14 +427,12 @@ static int rpm_clk_probe(struct platform - rpm_clks = desc->clks; - num_clks = desc->num_clks; - -- rcc = devm_kzalloc(&pdev->dev, sizeof(*rcc) + sizeof(*hws) * num_clks, -- GFP_KERNEL); -+ rcc = devm_kzalloc(&pdev->dev, sizeof(*rcc), GFP_KERNEL); - if (!rcc) - return -ENOMEM; - -- hws = rcc->hws; -- data = &rcc->data; -- data->num = num_clks; -+ rcc->clks = rpm_clks; -+ rcc->num_clks = num_clks; - - for (i = 0; i < num_clks; i++) { - if (!rpm_clks[i]) -@@ -436,18 +446,16 @@ static int rpm_clk_probe(struct platform - } - - for (i = 0; i < num_clks; i++) { -- if (!rpm_clks[i]) { -- data->hws[i] = ERR_PTR(-ENOENT); -+ if (!rpm_clks[i]) - continue; -- } - - ret = devm_clk_hw_register(&pdev->dev, &rpm_clks[i]->hw); - if (ret) - goto err; - } - -- ret = of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_onecell_get, -- data); -+ ret = of_clk_add_hw_provider(pdev->dev.of_node, qcom_rpm_clk_hw_get, -+ rcc); - if (ret) - goto err; - diff --git a/target/linux/ipq806x/patches-4.9/0030-clk-Disable-i2c-device-on-gsbi4.patch b/target/linux/ipq806x/patches-4.9/0030-clk-Disable-i2c-device-on-gsbi4.patch deleted file mode 100644 index b2a6afe0d..000000000 --- a/target/linux/ipq806x/patches-4.9/0030-clk-Disable-i2c-device-on-gsbi4.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0c974b87829e007dc4fae94e20d488204e20e662 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 9 Mar 2017 08:16:10 +0100 -Subject: [PATCH 30/69] clk: Disable i2c device on gsbi4 - -This patch was not annotated and comes from the v4.4 tree. - -Signed-off-by: John Crispin ---- - drivers/clk/qcom/gcc-ipq806x.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/clk/qcom/gcc-ipq806x.c -+++ b/drivers/clk/qcom/gcc-ipq806x.c -@@ -294,7 +294,7 @@ static struct clk_rcg gsbi1_uart_src = { - .parent_names = gcc_pxo_pll8, - .num_parents = 2, - .ops = &clk_rcg_ops, -- .flags = CLK_SET_PARENT_GATE, -+ .flags = CLK_SET_PARENT_GATE | CLK_IGNORE_UNUSED, - }, - }, - }; -@@ -312,7 +312,7 @@ static struct clk_branch gsbi1_uart_clk - }, - .num_parents = 1, - .ops = &clk_branch_ops, -- .flags = CLK_SET_RATE_PARENT, -+ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, - }, - }, - }; -@@ -890,6 +890,7 @@ static struct clk_branch gsbi1_h_clk = { - .hw.init = &(struct clk_init_data){ - .name = "gsbi1_h_clk", - .ops = &clk_branch_ops, -+ .flags = CLK_IGNORE_UNUSED, - }, - }, - }; diff --git a/target/linux/ipq806x/patches-4.9/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch b/target/linux/ipq806x/patches-4.9/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch deleted file mode 100644 index a888b063a..000000000 --- a/target/linux/ipq806x/patches-4.9/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch +++ /dev/null @@ -1,282 +0,0 @@ -From d8eeb4de90e968ba32d956728c866f20752cf2c3 Mon Sep 17 00:00:00 2001 -From: Mathieu Olivari -Date: Thu, 9 Mar 2017 08:18:08 +0100 -Subject: [PATCH 31/69] mtd: add SMEM parser for QCOM platforms - -On QCOM platforms using MTD devices storage (such as IPQ806x), SMEM is -used to store partition layout. This new parser can now be used to read -SMEM and use it to register an MTD layout according to its content. - -Signed-off-by: Mathieu Olivari -Signed-off-by: Ram Chandra Jangir ---- - drivers/mtd/Kconfig | 7 ++ - drivers/mtd/Makefile | 1 + - drivers/mtd/qcom_smem_part.c | 228 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 236 insertions(+) - create mode 100644 drivers/mtd/qcom_smem_part.c - ---- a/drivers/mtd/Kconfig -+++ b/drivers/mtd/Kconfig -@@ -194,6 +194,13 @@ config MTD_MYLOADER_PARTS - You will still need the parsing functions to be called by the driver - for your particular device. It won't happen automatically. - -+config MTD_QCOM_SMEM_PARTS -+ tristate "QCOM SMEM partitioning support" -+ depends on QCOM_SMEM -+ help -+ This provides partitions parser for QCOM devices using SMEM -+ such as IPQ806x. -+ - comment "User Modules And Translation Layers" - - # ---- /dev/null -+++ b/drivers/mtd/qcom_smem_part.c -@@ -0,0 +1,235 @@ -+/* -+ * Copyright (c) 2015, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+/* Processor/host identifier for the application processor */ -+#define SMEM_HOST_APPS 0 -+ -+/* SMEM items index */ -+#define SMEM_AARM_PARTITION_TABLE 9 -+#define SMEM_BOOT_FLASH_TYPE 421 -+#define SMEM_BOOT_FLASH_BLOCK_SIZE 424 -+ -+/* SMEM Flash types */ -+#define SMEM_FLASH_NAND 2 -+#define SMEM_FLASH_SPI 6 -+ -+#define SMEM_PART_NAME_SZ 16 -+#define SMEM_PARTS_MAX 32 -+ -+struct smem_partition { -+ char name[SMEM_PART_NAME_SZ]; -+ __le32 start; -+ __le32 size; -+ __le32 attr; -+}; -+ -+struct smem_partition_table { -+ u8 magic[8]; -+ __le32 version; -+ __le32 len; -+ struct smem_partition parts[SMEM_PARTS_MAX]; -+}; -+ -+/* SMEM Magic values in partition table */ -+static const u8 SMEM_PTABLE_MAGIC[] = { -+ 0xaa, 0x73, 0xee, 0x55, -+ 0xdb, 0xbd, 0x5e, 0xe3, -+}; -+ -+static int qcom_smem_get_flash_blksz(u64 **smem_blksz) -+{ -+ size_t size; -+ -+ *smem_blksz = qcom_smem_get(SMEM_HOST_APPS, SMEM_BOOT_FLASH_BLOCK_SIZE, -+ &size); -+ -+ if (IS_ERR(*smem_blksz)) { -+ pr_err("Unable to read flash blksz from SMEM\n"); -+ return -ENOENT; -+ } -+ -+ if (size != sizeof(**smem_blksz)) { -+ pr_err("Invalid flash blksz size in SMEM\n"); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int qcom_smem_get_flash_type(u64 **smem_flash_type) -+{ -+ size_t size; -+ -+ *smem_flash_type = qcom_smem_get(SMEM_HOST_APPS, SMEM_BOOT_FLASH_TYPE, -+ &size); -+ -+ if (IS_ERR(*smem_flash_type)) { -+ pr_err("Unable to read flash type from SMEM\n"); -+ return -ENOENT; -+ } -+ -+ if (size != sizeof(**smem_flash_type)) { -+ pr_err("Invalid flash type size in SMEM\n"); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int qcom_smem_get_flash_partitions(struct smem_partition_table **pparts) -+{ -+ size_t size; -+ -+ *pparts = qcom_smem_get(SMEM_HOST_APPS, SMEM_AARM_PARTITION_TABLE, -+ &size); -+ -+ if (IS_ERR(*pparts)) { -+ pr_err("Unable to read partition table from SMEM\n"); -+ return -ENOENT; -+ } -+ -+ return 0; -+} -+ -+static int of_dev_node_match(struct device *dev, void *data) -+{ -+ return dev->of_node == data; -+} -+ -+static bool is_spi_device(struct device_node *np) -+{ -+ struct device *dev; -+ -+ dev = bus_find_device(&spi_bus_type, NULL, np, of_dev_node_match); -+ if (!dev) -+ return false; -+ -+ put_device(dev); -+ return true; -+} -+ -+static int parse_qcom_smem_partitions(struct mtd_info *master, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) -+{ -+ struct smem_partition_table *smem_parts; -+ u64 *smem_flash_type, *smem_blksz; -+ struct mtd_partition *mtd_parts; -+ struct device_node *of_node = master->dev.of_node; -+ int i, ret; -+ -+ /* -+ * SMEM will only store the partition table of the boot device. -+ * If this is not the boot device, do not return any partition. -+ */ -+ ret = qcom_smem_get_flash_type(&smem_flash_type); -+ if (ret < 0) -+ return ret; -+ -+ if ((*smem_flash_type == SMEM_FLASH_NAND && !mtd_type_is_nand(master)) -+ || (*smem_flash_type == SMEM_FLASH_SPI && !is_spi_device(of_node))) -+ return 0; -+ -+ /* -+ * Just for sanity purpose, make sure the block size in SMEM matches the -+ * block size of the MTD device -+ */ -+ ret = qcom_smem_get_flash_blksz(&smem_blksz); -+ if (ret < 0) -+ return ret; -+ -+ if (*smem_blksz != master->erasesize) { -+ pr_err("SMEM block size differs from MTD block size\n"); -+ return -EINVAL; -+ } -+ -+ /* Get partition pointer from SMEM */ -+ ret = qcom_smem_get_flash_partitions(&smem_parts); -+ if (ret < 0) -+ return ret; -+ -+ if (memcmp(SMEM_PTABLE_MAGIC, smem_parts->magic, -+ sizeof(SMEM_PTABLE_MAGIC))) { -+ pr_err("SMEM partition magic invalid\n"); -+ return -EINVAL; -+ } -+ -+ /* Allocate and populate the mtd structures */ -+ mtd_parts = kcalloc(le32_to_cpu(smem_parts->len), sizeof(*mtd_parts), -+ GFP_KERNEL); -+ if (!mtd_parts) -+ return -ENOMEM; -+ -+ for (i = 0; i < smem_parts->len; i++) { -+ struct smem_partition *s_part = &smem_parts->parts[i]; -+ struct mtd_partition *m_part = &mtd_parts[i]; -+ -+ m_part->name = s_part->name; -+ m_part->size = le32_to_cpu(s_part->size) * (*smem_blksz); -+ m_part->offset = le32_to_cpu(s_part->start) * (*smem_blksz); -+ -+ /* -+ * The last SMEM partition may have its size marked as -+ * something like 0xffffffff, which means "until the end of the -+ * flash device". In this case, truncate it. -+ */ -+ if (m_part->offset + m_part->size > master->size) -+ m_part->size = master->size - m_part->offset; -+ } -+ -+ *pparts = mtd_parts; -+ -+ return smem_parts->len; -+} -+ -+static const struct of_device_id qcom_smem_of_match_table[] = { -+ { .compatible = "qcom,smem" }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, qcom_smem_of_match_table); -+ -+static struct mtd_part_parser qcom_smem_parser = { -+ .owner = THIS_MODULE, -+ .parse_fn = parse_qcom_smem_partitions, -+ .name = "qcom-smem", -+ .of_match_table = qcom_smem_of_match_table, -+}; -+ -+static int __init qcom_smem_parser_init(void) -+{ -+ register_mtd_parser(&qcom_smem_parser); -+ return 0; -+} -+ -+static void __exit qcom_smem_parser_exit(void) -+{ -+ deregister_mtd_parser(&qcom_smem_parser); -+} -+ -+module_init(qcom_smem_parser_init); -+module_exit(qcom_smem_parser_exit); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Mathieu Olivari "); -+MODULE_DESCRIPTION("Parsing code for SMEM based partition tables"); ---- a/drivers/mtd/Makefile -+++ b/drivers/mtd/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o - obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o - obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o -+obj-$(CONFIG_MTD_QCOM_SMEM_PARTS) += qcom_smem_part.o - obj-y += parsers/ - - # 'Users' - code which presents functionality to userspace. diff --git a/target/linux/ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch b/target/linux/ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch deleted file mode 100644 index 56535a3ee..000000000 --- a/target/linux/ipq806x/patches-4.9/0032-phy-add-qcom-dwc3-phy.patch +++ /dev/null @@ -1,617 +0,0 @@ -From b9004f4fd23e4c614d71c972f3a9311665480e29 Mon Sep 17 00:00:00 2001 -From: Andy Gross -Date: Thu, 9 Mar 2017 08:19:18 +0100 -Subject: [PATCH 32/69] phy: add qcom dwc3 phy - -Signed-off-by: Andy Gross ---- - drivers/phy/Kconfig | 12 + - drivers/phy/Makefile | 1 + - drivers/phy/phy-qcom-dwc3.c | 575 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 588 insertions(+) - create mode 100644 drivers/phy/phy-qcom-dwc3.c - ---- a/drivers/phy/Kconfig -+++ b/drivers/phy/Kconfig -@@ -490,4 +490,16 @@ config PHY_NS2_PCIE - help - Enable this to support the Broadcom Northstar2 PCIe PHY. - If unsure, say N. -+ -+config PHY_QCOM_DWC3 -+ tristate "QCOM DWC3 USB PHY support" -+ depends on ARCH_QCOM -+ depends on HAS_IOMEM -+ depends on OF -+ select GENERIC_PHY -+ help -+ This option enables support for the Synopsis PHYs present inside the -+ Qualcomm USB3.0 DWC3 controller. This driver supports both HS and SS -+ PHY controllers. -+ - endmenu ---- a/drivers/phy/Makefile -+++ b/drivers/phy/Makefile -@@ -60,3 +60,4 @@ obj-$(CONFIG_PHY_PISTACHIO_USB) += phy- - obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o - obj-$(CONFIG_ARCH_TEGRA) += tegra/ - obj-$(CONFIG_PHY_NS2_PCIE) += phy-bcm-ns2-pcie.o -+obj-$(CONFIG_PHY_QCOM_DWC3) += phy-qcom-dwc3.o ---- /dev/null -+++ b/drivers/phy/phy-qcom-dwc3.c -@@ -0,0 +1,575 @@ -+/* Copyright (c) 2014-2015, Code Aurora Forum. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+*/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/** -+ * USB QSCRATCH Hardware registers -+ */ -+#define QSCRATCH_GENERAL_CFG (0x08) -+#define HSUSB_PHY_CTRL_REG (0x10) -+ -+/* PHY_CTRL_REG */ -+#define HSUSB_CTRL_DMSEHV_CLAMP BIT(24) -+#define HSUSB_CTRL_USB2_SUSPEND BIT(23) -+#define HSUSB_CTRL_UTMI_CLK_EN BIT(21) -+#define HSUSB_CTRL_UTMI_OTG_VBUS_VALID BIT(20) -+#define HSUSB_CTRL_USE_CLKCORE BIT(18) -+#define HSUSB_CTRL_DPSEHV_CLAMP BIT(17) -+#define HSUSB_CTRL_COMMONONN BIT(11) -+#define HSUSB_CTRL_ID_HV_CLAMP BIT(9) -+#define HSUSB_CTRL_OTGSESSVLD_CLAMP BIT(8) -+#define HSUSB_CTRL_CLAMP_EN BIT(7) -+#define HSUSB_CTRL_RETENABLEN BIT(1) -+#define HSUSB_CTRL_POR BIT(0) -+ -+/* QSCRATCH_GENERAL_CFG */ -+#define HSUSB_GCFG_XHCI_REV BIT(2) -+ -+/** -+ * USB QSCRATCH Hardware registers -+ */ -+#define SSUSB_PHY_CTRL_REG (0x00) -+#define SSUSB_PHY_PARAM_CTRL_1 (0x04) -+#define SSUSB_PHY_PARAM_CTRL_2 (0x08) -+#define CR_PROTOCOL_DATA_IN_REG (0x0c) -+#define CR_PROTOCOL_DATA_OUT_REG (0x10) -+#define CR_PROTOCOL_CAP_ADDR_REG (0x14) -+#define CR_PROTOCOL_CAP_DATA_REG (0x18) -+#define CR_PROTOCOL_READ_REG (0x1c) -+#define CR_PROTOCOL_WRITE_REG (0x20) -+ -+/* PHY_CTRL_REG */ -+#define SSUSB_CTRL_REF_USE_PAD BIT(28) -+#define SSUSB_CTRL_TEST_POWERDOWN BIT(27) -+#define SSUSB_CTRL_LANE0_PWR_PRESENT BIT(24) -+#define SSUSB_CTRL_SS_PHY_EN BIT(8) -+#define SSUSB_CTRL_SS_PHY_RESET BIT(7) -+ -+/* SSPHY control registers */ -+#define SSPHY_CTRL_RX_OVRD_IN_HI(lane) (0x1006 + 0x100 * lane) -+#define SSPHY_CTRL_TX_OVRD_DRV_LO(lane) (0x1002 + 0x100 * lane) -+ -+/* SSPHY SoC version specific values */ -+#define SSPHY_RX_EQ_VALUE 4 /* Override value for rx_eq */ -+#define SSPHY_TX_DEEMPH_3_5DB 23 /* Override value for transmit -+ preemphasis */ -+#define SSPHY_MPLL_VALUE 0 /* Override value for mpll */ -+ -+/* QSCRATCH PHY_PARAM_CTRL1 fields */ -+#define PHY_PARAM_CTRL1_TX_FULL_SWING_MASK 0x07f00000u -+#define PHY_PARAM_CTRL1_TX_DEEMPH_6DB_MASK 0x000fc000u -+#define PHY_PARAM_CTRL1_TX_DEEMPH_3_5DB_MASK 0x00003f00u -+#define PHY_PARAM_CTRL1_LOS_BIAS_MASK 0x000000f8u -+ -+#define PHY_PARAM_CTRL1_MASK \ -+ (PHY_PARAM_CTRL1_TX_FULL_SWING_MASK | \ -+ PHY_PARAM_CTRL1_TX_DEEMPH_6DB_MASK | \ -+ PHY_PARAM_CTRL1_TX_DEEMPH_3_5DB_MASK | \ -+ PHY_PARAM_CTRL1_LOS_BIAS_MASK) -+ -+#define PHY_PARAM_CTRL1_TX_FULL_SWING(x) \ -+ (((x) << 20) & PHY_PARAM_CTRL1_TX_FULL_SWING_MASK) -+#define PHY_PARAM_CTRL1_TX_DEEMPH_6DB(x) \ -+ (((x) << 14) & PHY_PARAM_CTRL1_TX_DEEMPH_6DB_MASK) -+#define PHY_PARAM_CTRL1_TX_DEEMPH_3_5DB(x) \ -+ (((x) << 8) & PHY_PARAM_CTRL1_TX_DEEMPH_3_5DB_MASK) -+#define PHY_PARAM_CTRL1_LOS_BIAS(x) \ -+ (((x) << 3) & PHY_PARAM_CTRL1_LOS_BIAS_MASK) -+ -+/* RX OVRD IN HI bits */ -+#define RX_OVRD_IN_HI_RX_RESET_OVRD BIT(13) -+#define RX_OVRD_IN_HI_RX_RX_RESET BIT(12) -+#define RX_OVRD_IN_HI_RX_EQ_OVRD BIT(11) -+#define RX_OVRD_IN_HI_RX_EQ_MASK 0x0700 -+#define RX_OVRD_IN_HI_RX_EQ_SHIFT 8 -+#define RX_OVRD_IN_HI_RX_EQ_EN_OVRD BIT(7) -+#define RX_OVRD_IN_HI_RX_EQ_EN BIT(6) -+#define RX_OVRD_IN_HI_RX_LOS_FILTER_OVRD BIT(5) -+#define RX_OVRD_IN_HI_RX_LOS_FILTER_MASK 0x0018 -+#define RX_OVRD_IN_HI_RX_RATE_OVRD BIT(2) -+#define RX_OVRD_IN_HI_RX_RATE_MASK 0x0003 -+ -+/* TX OVRD DRV LO register bits */ -+#define TX_OVRD_DRV_LO_AMPLITUDE_MASK 0x007F -+#define TX_OVRD_DRV_LO_PREEMPH_MASK 0x3F80 -+#define TX_OVRD_DRV_LO_PREEMPH_SHIFT 7 -+#define TX_OVRD_DRV_LO_EN BIT(14) -+ -+/* SS CAP register bits */ -+#define SS_CR_CAP_ADDR_REG BIT(0) -+#define SS_CR_CAP_DATA_REG BIT(0) -+#define SS_CR_READ_REG BIT(0) -+#define SS_CR_WRITE_REG BIT(0) -+ -+struct qcom_dwc3_usb_phy { -+ void __iomem *base; -+ struct device *dev; -+ struct clk *xo_clk; -+ struct clk *ref_clk; -+ u32 rx_eq; -+ u32 tx_deamp_3_5db; -+ u32 mpll; -+}; -+ -+struct qcom_dwc3_phy_drvdata { -+ struct phy_ops ops; -+ u32 clk_rate; -+}; -+ -+/** -+ * Write register and read back masked value to confirm it is written -+ * -+ * @base - QCOM DWC3 PHY base virtual address. -+ * @offset - register offset. -+ * @mask - register bitmask specifying what should be updated -+ * @val - value to write. -+ */ -+static inline void qcom_dwc3_phy_write_readback( -+ struct qcom_dwc3_usb_phy *phy_dwc3, u32 offset, -+ const u32 mask, u32 val) -+{ -+ u32 write_val, tmp = readl(phy_dwc3->base + offset); -+ -+ tmp &= ~mask; /* retain other bits */ -+ write_val = tmp | val; -+ -+ writel(write_val, phy_dwc3->base + offset); -+ -+ /* Read back to see if val was written */ -+ tmp = readl(phy_dwc3->base + offset); -+ tmp &= mask; /* clear other bits */ -+ -+ if (tmp != val) -+ dev_err(phy_dwc3->dev, "write: %x to QSCRATCH: %x FAILED\n", -+ val, offset); -+} -+ -+static int wait_for_latch(void __iomem *addr) -+{ -+ u32 retry = 10; -+ -+ while (true) { -+ if (!readl(addr)) -+ break; -+ -+ if (--retry == 0) -+ return -ETIMEDOUT; -+ -+ usleep_range(10, 20); -+ } -+ -+ return 0; -+} -+ -+/** -+ * Write SSPHY register -+ * -+ * @base - QCOM DWC3 PHY base virtual address. -+ * @addr - SSPHY address to write. -+ * @val - value to write. -+ */ -+static int qcom_dwc3_ss_write_phycreg(struct qcom_dwc3_usb_phy *phy_dwc3, -+ u32 addr, u32 val) -+{ -+ int ret; -+ -+ writel(addr, phy_dwc3->base + CR_PROTOCOL_DATA_IN_REG); -+ writel(SS_CR_CAP_ADDR_REG, phy_dwc3->base + CR_PROTOCOL_CAP_ADDR_REG); -+ -+ ret = wait_for_latch(phy_dwc3->base + CR_PROTOCOL_CAP_ADDR_REG); -+ if (ret) -+ goto err_wait; -+ -+ writel(val, phy_dwc3->base + CR_PROTOCOL_DATA_IN_REG); -+ writel(SS_CR_CAP_DATA_REG, phy_dwc3->base + CR_PROTOCOL_CAP_DATA_REG); -+ -+ ret = wait_for_latch(phy_dwc3->base + CR_PROTOCOL_CAP_DATA_REG); -+ if (ret) -+ goto err_wait; -+ -+ writel(SS_CR_WRITE_REG, phy_dwc3->base + CR_PROTOCOL_WRITE_REG); -+ -+ ret = wait_for_latch(phy_dwc3->base + CR_PROTOCOL_WRITE_REG); -+ -+err_wait: -+ if (ret) -+ dev_err(phy_dwc3->dev, "timeout waiting for latch\n"); -+ return ret; -+} -+ -+/** -+ * Read SSPHY register. -+ * -+ * @base - QCOM DWC3 PHY base virtual address. -+ * @addr - SSPHY address to read. -+ */ -+static int qcom_dwc3_ss_read_phycreg(void __iomem *base, u32 addr, u32 *val) -+{ -+ int ret; -+ -+ writel(addr, base + CR_PROTOCOL_DATA_IN_REG); -+ writel(SS_CR_CAP_ADDR_REG, base + CR_PROTOCOL_CAP_ADDR_REG); -+ -+ ret = wait_for_latch(base + CR_PROTOCOL_CAP_ADDR_REG); -+ if (ret) -+ goto err_wait; -+ -+ /* -+ * Due to hardware bug, first read of SSPHY register might be -+ * incorrect. Hence as workaround, SW should perform SSPHY register -+ * read twice, but use only second read and ignore first read. -+ */ -+ writel(SS_CR_READ_REG, base + CR_PROTOCOL_READ_REG); -+ -+ ret = wait_for_latch(base + CR_PROTOCOL_READ_REG); -+ if (ret) -+ goto err_wait; -+ -+ /* throwaway read */ -+ readl(base + CR_PROTOCOL_DATA_OUT_REG); -+ -+ writel(SS_CR_READ_REG, base + CR_PROTOCOL_READ_REG); -+ -+ ret = wait_for_latch(base + CR_PROTOCOL_READ_REG); -+ if (ret) -+ goto err_wait; -+ -+ *val = readl(base + CR_PROTOCOL_DATA_OUT_REG); -+ -+err_wait: -+ return ret; -+} -+ -+static int qcom_dwc3_hs_phy_init(struct phy *phy) -+{ -+ struct qcom_dwc3_usb_phy *phy_dwc3 = phy_get_drvdata(phy); -+ int ret; -+ u32 val; -+ -+ ret = clk_prepare_enable(phy_dwc3->xo_clk); -+ if (ret) -+ return ret; -+ -+ ret = clk_prepare_enable(phy_dwc3->ref_clk); -+ if (ret) { -+ clk_disable_unprepare(phy_dwc3->xo_clk); -+ return ret; -+ } -+ -+ /* -+ * HSPHY Initialization: Enable UTMI clock, select 19.2MHz fsel -+ * enable clamping, and disable RETENTION (power-on default is ENABLED) -+ */ -+ val = HSUSB_CTRL_DPSEHV_CLAMP | HSUSB_CTRL_DMSEHV_CLAMP | -+ HSUSB_CTRL_RETENABLEN | HSUSB_CTRL_COMMONONN | -+ HSUSB_CTRL_OTGSESSVLD_CLAMP | HSUSB_CTRL_ID_HV_CLAMP | -+ HSUSB_CTRL_DPSEHV_CLAMP | HSUSB_CTRL_UTMI_OTG_VBUS_VALID | -+ HSUSB_CTRL_UTMI_CLK_EN | HSUSB_CTRL_CLAMP_EN | 0x70; -+ -+ /* use core clock if external reference is not present */ -+ if (!phy_dwc3->xo_clk) -+ val |= HSUSB_CTRL_USE_CLKCORE; -+ -+ writel(val, phy_dwc3->base + HSUSB_PHY_CTRL_REG); -+ usleep_range(2000, 2200); -+ -+ /* Disable (bypass) VBUS and ID filters */ -+ writel(HSUSB_GCFG_XHCI_REV, phy_dwc3->base + QSCRATCH_GENERAL_CFG); -+ -+ return 0; -+} -+ -+static int qcom_dwc3_hs_phy_exit(struct phy *phy) -+{ -+ struct qcom_dwc3_usb_phy *phy_dwc3 = phy_get_drvdata(phy); -+ -+ clk_disable_unprepare(phy_dwc3->ref_clk); -+ clk_disable_unprepare(phy_dwc3->xo_clk); -+ -+ return 0; -+} -+ -+static int qcom_dwc3_ss_phy_init(struct phy *phy) -+{ -+ struct qcom_dwc3_usb_phy *phy_dwc3 = phy_get_drvdata(phy); -+ int ret; -+ u32 data = 0; -+ -+ ret = clk_prepare_enable(phy_dwc3->xo_clk); -+ if (ret) -+ return ret; -+ -+ ret = clk_prepare_enable(phy_dwc3->ref_clk); -+ if (ret) { -+ clk_disable_unprepare(phy_dwc3->xo_clk); -+ return ret; -+ } -+ -+ /* reset phy */ -+ data = readl(phy_dwc3->base + SSUSB_PHY_CTRL_REG); -+ writel(data | SSUSB_CTRL_SS_PHY_RESET, -+ phy_dwc3->base + SSUSB_PHY_CTRL_REG); -+ usleep_range(2000, 2200); -+ writel(data, phy_dwc3->base + SSUSB_PHY_CTRL_REG); -+ -+ /* clear REF_PAD if we don't have XO clk */ -+ if (!phy_dwc3->xo_clk) -+ data &= ~SSUSB_CTRL_REF_USE_PAD; -+ else -+ data |= SSUSB_CTRL_REF_USE_PAD; -+ -+ writel(data, phy_dwc3->base + SSUSB_PHY_CTRL_REG); -+ -+ /* wait for ref clk to become stable, this can take up to 30ms */ -+ msleep(30); -+ -+ data |= SSUSB_CTRL_SS_PHY_EN | SSUSB_CTRL_LANE0_PWR_PRESENT; -+ writel(data, phy_dwc3->base + SSUSB_PHY_CTRL_REG); -+ -+ /* -+ * WORKAROUND: There is SSPHY suspend bug due to which USB enumerates -+ * in HS mode instead of SS mode. Workaround it by asserting -+ * LANE0.TX_ALT_BLOCK.EN_ALT_BUS to enable TX to use alt bus mode -+ */ -+ ret = qcom_dwc3_ss_read_phycreg(phy_dwc3->base, 0x102D, &data); -+ if (ret) -+ goto err_phy_trans; -+ -+ data |= (1 << 7); -+ ret = qcom_dwc3_ss_write_phycreg(phy_dwc3, 0x102D, data); -+ if (ret) -+ goto err_phy_trans; -+ -+ ret = qcom_dwc3_ss_read_phycreg(phy_dwc3->base, 0x1010, &data); -+ if (ret) -+ goto err_phy_trans; -+ -+ data &= ~0xff0; -+ data |= 0x20; -+ ret = qcom_dwc3_ss_write_phycreg(phy_dwc3, 0x1010, data); -+ if (ret) -+ goto err_phy_trans; -+ -+ /* -+ * Fix RX Equalization setting as follows -+ * LANE0.RX_OVRD_IN_HI. RX_EQ_EN set to 0 -+ * LANE0.RX_OVRD_IN_HI.RX_EQ_EN_OVRD set to 1 -+ * LANE0.RX_OVRD_IN_HI.RX_EQ set based on SoC version -+ * LANE0.RX_OVRD_IN_HI.RX_EQ_OVRD set to 1 -+ */ -+ ret = qcom_dwc3_ss_read_phycreg(phy_dwc3->base, -+ SSPHY_CTRL_RX_OVRD_IN_HI(0), &data); -+ if (ret) -+ goto err_phy_trans; -+ -+ data &= ~RX_OVRD_IN_HI_RX_EQ_EN; -+ data |= RX_OVRD_IN_HI_RX_EQ_EN_OVRD; -+ data &= ~RX_OVRD_IN_HI_RX_EQ_MASK; -+ data |= phy_dwc3->rx_eq << RX_OVRD_IN_HI_RX_EQ_SHIFT; -+ data |= RX_OVRD_IN_HI_RX_EQ_OVRD; -+ ret = qcom_dwc3_ss_write_phycreg(phy_dwc3, -+ SSPHY_CTRL_RX_OVRD_IN_HI(0), data); -+ if (ret) -+ goto err_phy_trans; -+ -+ /* -+ * Set EQ and TX launch amplitudes as follows -+ * LANE0.TX_OVRD_DRV_LO.PREEMPH set based on SoC version -+ * LANE0.TX_OVRD_DRV_LO.AMPLITUDE set to 110 -+ * LANE0.TX_OVRD_DRV_LO.EN set to 1. -+ */ -+ ret = qcom_dwc3_ss_read_phycreg(phy_dwc3->base, -+ SSPHY_CTRL_TX_OVRD_DRV_LO(0), &data); -+ if (ret) -+ goto err_phy_trans; -+ -+ data &= ~TX_OVRD_DRV_LO_PREEMPH_MASK; -+ data |= phy_dwc3->tx_deamp_3_5db << TX_OVRD_DRV_LO_PREEMPH_SHIFT; -+ data &= ~TX_OVRD_DRV_LO_AMPLITUDE_MASK; -+ data |= 0x6E; -+ data |= TX_OVRD_DRV_LO_EN; -+ ret = qcom_dwc3_ss_write_phycreg(phy_dwc3, -+ SSPHY_CTRL_TX_OVRD_DRV_LO(0), data); -+ if (ret) -+ goto err_phy_trans; -+ -+ qcom_dwc3_ss_write_phycreg(phy_dwc3, 0x30, phy_dwc3->mpll); -+ -+ /* -+ * Set the QSCRATCH PHY_PARAM_CTRL1 parameters as follows -+ * TX_FULL_SWING [26:20] amplitude to 110 -+ * TX_DEEMPH_6DB [19:14] to 32 -+ * TX_DEEMPH_3_5DB [13:8] set based on SoC version -+ * LOS_BIAS [7:3] to 9 -+ */ -+ data = readl(phy_dwc3->base + SSUSB_PHY_PARAM_CTRL_1); -+ -+ data &= ~PHY_PARAM_CTRL1_MASK; -+ -+ data |= PHY_PARAM_CTRL1_TX_FULL_SWING(0x6e) | -+ PHY_PARAM_CTRL1_TX_DEEMPH_6DB(0x20) | -+ PHY_PARAM_CTRL1_TX_DEEMPH_3_5DB(phy_dwc3->tx_deamp_3_5db) | -+ PHY_PARAM_CTRL1_LOS_BIAS(0x9); -+ -+ qcom_dwc3_phy_write_readback(phy_dwc3, SSUSB_PHY_PARAM_CTRL_1, -+ PHY_PARAM_CTRL1_MASK, data); -+ -+err_phy_trans: -+ return ret; -+} -+ -+static int qcom_dwc3_ss_phy_exit(struct phy *phy) -+{ -+ struct qcom_dwc3_usb_phy *phy_dwc3 = phy_get_drvdata(phy); -+ -+ /* Sequence to put SSPHY in low power state: -+ * 1. Clear REF_PHY_EN in PHY_CTRL_REG -+ * 2. Clear REF_USE_PAD in PHY_CTRL_REG -+ * 3. Set TEST_POWERED_DOWN in PHY_CTRL_REG to enable PHY retention -+ */ -+ qcom_dwc3_phy_write_readback(phy_dwc3, SSUSB_PHY_CTRL_REG, -+ SSUSB_CTRL_SS_PHY_EN, 0x0); -+ qcom_dwc3_phy_write_readback(phy_dwc3, SSUSB_PHY_CTRL_REG, -+ SSUSB_CTRL_REF_USE_PAD, 0x0); -+ qcom_dwc3_phy_write_readback(phy_dwc3, SSUSB_PHY_CTRL_REG, -+ SSUSB_CTRL_TEST_POWERDOWN, 0x0); -+ -+ clk_disable_unprepare(phy_dwc3->ref_clk); -+ clk_disable_unprepare(phy_dwc3->xo_clk); -+ -+ return 0; -+} -+ -+static const struct qcom_dwc3_phy_drvdata qcom_dwc3_hs_drvdata = { -+ .ops = { -+ .init = qcom_dwc3_hs_phy_init, -+ .exit = qcom_dwc3_hs_phy_exit, -+ .owner = THIS_MODULE, -+ }, -+ .clk_rate = 60000000, -+}; -+ -+static const struct qcom_dwc3_phy_drvdata qcom_dwc3_ss_drvdata = { -+ .ops = { -+ .init = qcom_dwc3_ss_phy_init, -+ .exit = qcom_dwc3_ss_phy_exit, -+ .owner = THIS_MODULE, -+ }, -+ .clk_rate = 125000000, -+}; -+ -+static const struct of_device_id qcom_dwc3_phy_table[] = { -+ { .compatible = "qcom,dwc3-hs-usb-phy", .data = &qcom_dwc3_hs_drvdata }, -+ { .compatible = "qcom,dwc3-ss-usb-phy", .data = &qcom_dwc3_ss_drvdata }, -+ { /* Sentinel */ } -+}; -+MODULE_DEVICE_TABLE(of, qcom_dwc3_phy_table); -+ -+static int qcom_dwc3_phy_probe(struct platform_device *pdev) -+{ -+ struct qcom_dwc3_usb_phy *phy_dwc3; -+ struct phy_provider *phy_provider; -+ struct phy *generic_phy; -+ struct resource *res; -+ const struct of_device_id *match; -+ const struct qcom_dwc3_phy_drvdata *data; -+ struct device_node *np; -+ -+ phy_dwc3 = devm_kzalloc(&pdev->dev, sizeof(*phy_dwc3), GFP_KERNEL); -+ if (!phy_dwc3) -+ return -ENOMEM; -+ -+ match = of_match_node(qcom_dwc3_phy_table, pdev->dev.of_node); -+ data = match->data; -+ -+ phy_dwc3->dev = &pdev->dev; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ phy_dwc3->base = devm_ioremap_resource(phy_dwc3->dev, res); -+ if (IS_ERR(phy_dwc3->base)) -+ return PTR_ERR(phy_dwc3->base); -+ -+ phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref"); -+ if (IS_ERR(phy_dwc3->ref_clk)) { -+ dev_dbg(phy_dwc3->dev, "cannot get reference clock\n"); -+ return PTR_ERR(phy_dwc3->ref_clk); -+ } -+ -+ clk_set_rate(phy_dwc3->ref_clk, data->clk_rate); -+ -+ phy_dwc3->xo_clk = devm_clk_get(phy_dwc3->dev, "xo"); -+ if (IS_ERR(phy_dwc3->xo_clk)) { -+ dev_dbg(phy_dwc3->dev, "cannot get TCXO clock\n"); -+ phy_dwc3->xo_clk = NULL; -+ } -+ -+ /* Parse device node to probe HSIO settings */ -+ np = of_node_get(pdev->dev.of_node); -+ if (!of_compat_cmp(match->compatible, "qcom,dwc3-ss-usb-phy", -+ strlen(match->compatible))) { -+ -+ if (of_property_read_u32(np, "rx_eq", &phy_dwc3->rx_eq) || -+ of_property_read_u32(np, "tx_deamp_3_5db", -+ &phy_dwc3->tx_deamp_3_5db) || -+ of_property_read_u32(np, "mpll", &phy_dwc3->mpll)) { -+ -+ dev_err(phy_dwc3->dev, "cannot get HSIO settings from device node, using default values\n"); -+ -+ /* Default HSIO settings */ -+ phy_dwc3->rx_eq = SSPHY_RX_EQ_VALUE; -+ phy_dwc3->tx_deamp_3_5db = SSPHY_TX_DEEMPH_3_5DB; -+ phy_dwc3->mpll = SSPHY_MPLL_VALUE; -+ } -+ } -+ -+ generic_phy = devm_phy_create(phy_dwc3->dev, pdev->dev.of_node, -+ &data->ops); -+ -+ if (IS_ERR(generic_phy)) -+ return PTR_ERR(generic_phy); -+ -+ phy_set_drvdata(generic_phy, phy_dwc3); -+ platform_set_drvdata(pdev, phy_dwc3); -+ -+ phy_provider = devm_of_phy_provider_register(phy_dwc3->dev, -+ of_phy_simple_xlate); -+ -+ if (IS_ERR(phy_provider)) -+ return PTR_ERR(phy_provider); -+ -+ return 0; -+} -+ -+static struct platform_driver qcom_dwc3_phy_driver = { -+ .probe = qcom_dwc3_phy_probe, -+ .driver = { -+ .name = "qcom-dwc3-usb-phy", -+ .owner = THIS_MODULE, -+ .of_match_table = qcom_dwc3_phy_table, -+ }, -+}; -+ -+module_platform_driver(qcom_dwc3_phy_driver); -+ -+MODULE_ALIAS("platform:phy-qcom-dwc3"); -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Andy Gross "); -+MODULE_AUTHOR("Ivan T. Ivanov "); -+MODULE_DESCRIPTION("DesignWare USB3 QCOM PHY driver"); diff --git a/target/linux/ipq806x/patches-4.9/0033-ARM-qcom-automatically-select-PCI_DOMAINS-if-PCI-is-.patch b/target/linux/ipq806x/patches-4.9/0033-ARM-qcom-automatically-select-PCI_DOMAINS-if-PCI-is-.patch deleted file mode 100644 index a6c7953aa..000000000 --- a/target/linux/ipq806x/patches-4.9/0033-ARM-qcom-automatically-select-PCI_DOMAINS-if-PCI-is-.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 48051ece78136e4235a2415a52797db56f8a4478 Mon Sep 17 00:00:00 2001 -From: Mathieu Olivari -Date: Tue, 21 Apr 2015 19:09:07 -0700 -Subject: [PATCH 33/69] ARM: qcom: automatically select PCI_DOMAINS if PCI is - enabled - -If multiple PCIe devices are present in the system, the kernel will -panic at boot time when trying to scan the PCI buses. This happens on -IPQ806x based platforms, which has 3 PCIe ports. - -Enabling this option allows the kernel to assign the pci-domains -according to the device-tree content. This allows multiple PCIe -controllers to coexist in the system. - -Signed-off-by: Mathieu Olivari ---- - arch/arm/mach-qcom/Kconfig | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/arm/mach-qcom/Kconfig -+++ b/arch/arm/mach-qcom/Kconfig -@@ -6,6 +6,7 @@ menuconfig ARCH_QCOM - select ARM_AMBA - select PINCTRL - select QCOM_SCM if SMP -+ select PCI_DOMAINS if PCI - help - Support for Qualcomm's devicetree based systems. - diff --git a/target/linux/ipq806x/patches-4.9/0034-ARM-Add-Krait-L2-register-accessor-functions.patch b/target/linux/ipq806x/patches-4.9/0034-ARM-Add-Krait-L2-register-accessor-functions.patch deleted file mode 100644 index 019170b6d..000000000 --- a/target/linux/ipq806x/patches-4.9/0034-ARM-Add-Krait-L2-register-accessor-functions.patch +++ /dev/null @@ -1,147 +0,0 @@ -From patchwork Fri Dec 8 09:42:19 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,01/12] ARM: Add Krait L2 register accessor functions -From: Sricharan R -X-Patchwork-Id: 10102101 -Message-Id: <1512726150-7204-2-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org, Mark Rutland , - Russell King , - Courtney Cavin -Date: Fri, 8 Dec 2017 15:12:19 +0530 - -From: Stephen Boyd - -Krait CPUs have a handful of L2 cache controller registers that -live behind a cp15 based indirection register. First you program -the indirection register (l2cpselr) to point the L2 'window' -register (l2cpdr) at what you want to read/write. Then you -read/write the 'window' register to do what you want. The -l2cpselr register is not banked per-cpu so we must lock around -accesses to it to prevent other CPUs from re-pointing l2cpdr -underneath us. - -Cc: Mark Rutland -Cc: Russell King -Cc: Courtney Cavin -Signed-off-by: Stephen Boyd ---- - arch/arm/common/Kconfig | 3 ++ - arch/arm/common/Makefile | 1 + - arch/arm/common/krait-l2-accessors.c | 58 +++++++++++++++++++++++++++++++ - arch/arm/include/asm/krait-l2-accessors.h | 20 +++++++++++ - 4 files changed, 82 insertions(+) - create mode 100644 arch/arm/common/krait-l2-accessors.c - create mode 100644 arch/arm/include/asm/krait-l2-accessors.h - ---- a/arch/arm/common/Kconfig -+++ b/arch/arm/common/Kconfig -@@ -9,6 +9,9 @@ config DMABOUNCE - bool - select ZONE_DMA - -+config KRAIT_L2_ACCESSORS -+ bool -+ - config SHARP_LOCOMO - bool - ---- a/arch/arm/common/Makefile -+++ b/arch/arm/common/Makefile -@@ -7,6 +7,7 @@ obj-y += firmware.o - obj-$(CONFIG_ICST) += icst.o - obj-$(CONFIG_SA1111) += sa1111.o - obj-$(CONFIG_DMABOUNCE) += dmabounce.o -+obj-$(CONFIG_KRAIT_L2_ACCESSORS) += krait-l2-accessors.o - obj-$(CONFIG_SHARP_LOCOMO) += locomo.o - obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o - obj-$(CONFIG_SHARP_SCOOP) += scoop.o ---- /dev/null -+++ b/arch/arm/common/krait-l2-accessors.c -@@ -0,0 +1,58 @@ -+/* -+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+ -+static DEFINE_RAW_SPINLOCK(krait_l2_lock); -+ -+void krait_set_l2_indirect_reg(u32 addr, u32 val) -+{ -+ unsigned long flags; -+ -+ raw_spin_lock_irqsave(&krait_l2_lock, flags); -+ /* -+ * Select the L2 window by poking l2cpselr, then write to the window -+ * via l2cpdr. -+ */ -+ asm volatile ("mcr p15, 3, %0, c15, c0, 6 @ l2cpselr" : : "r" (addr)); -+ isb(); -+ asm volatile ("mcr p15, 3, %0, c15, c0, 7 @ l2cpdr" : : "r" (val)); -+ isb(); -+ -+ raw_spin_unlock_irqrestore(&krait_l2_lock, flags); -+} -+EXPORT_SYMBOL(krait_set_l2_indirect_reg); -+ -+u32 krait_get_l2_indirect_reg(u32 addr) -+{ -+ u32 val; -+ unsigned long flags; -+ -+ raw_spin_lock_irqsave(&krait_l2_lock, flags); -+ /* -+ * Select the L2 window by poking l2cpselr, then read from the window -+ * via l2cpdr. -+ */ -+ asm volatile ("mcr p15, 3, %0, c15, c0, 6 @ l2cpselr" : : "r" (addr)); -+ isb(); -+ asm volatile ("mrc p15, 3, %0, c15, c0, 7 @ l2cpdr" : "=r" (val)); -+ -+ raw_spin_unlock_irqrestore(&krait_l2_lock, flags); -+ -+ return val; -+} -+EXPORT_SYMBOL(krait_get_l2_indirect_reg); ---- /dev/null -+++ b/arch/arm/include/asm/krait-l2-accessors.h -@@ -0,0 +1,20 @@ -+/* -+ * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef __ASMARM_KRAIT_L2_ACCESSORS_H -+#define __ASMARM_KRAIT_L2_ACCESSORS_H -+ -+extern void krait_set_l2_indirect_reg(u32 addr, u32 val); -+extern u32 krait_get_l2_indirect_reg(u32 addr); -+ -+#endif diff --git a/target/linux/ipq806x/patches-4.9/0035-clk-mux-Split-out-register-accessors-for-reuse.patch b/target/linux/ipq806x/patches-4.9/0035-clk-mux-Split-out-register-accessors-for-reuse.patch deleted file mode 100644 index 5a64e6c56..000000000 --- a/target/linux/ipq806x/patches-4.9/0035-clk-mux-Split-out-register-accessors-for-reuse.patch +++ /dev/null @@ -1,195 +0,0 @@ -From patchwork Fri Dec 8 09:42:20 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,02/12] clk: mux: Split out register accessors for reuse -From: Sricharan R -X-Patchwork-Id: 10102103 -Message-Id: <1512726150-7204-3-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:20 +0530 - -From: Stephen Boyd - -We want to reuse the logic in clk-mux.c for other clock drivers -that don't use readl as register accessors. Fortunately, there -really isn't much to the mux code besides the table indirection -and quirk flags if you assume any bit shifting and masking has -been done already. Pull that logic out into reusable functions -that operate on an optional table and some flags so that other -drivers can use the same logic. - -Signed-off-by: Stephen Boyd ---- - drivers/clk/clk-mux.c | 75 +++++++++++++++++++++++++++----------------- - include/linux/clk-provider.h | 9 ++++-- - 2 files changed, 54 insertions(+), 30 deletions(-) - ---- a/drivers/clk/clk-mux.c -+++ b/drivers/clk/clk-mux.c -@@ -26,35 +26,24 @@ - * parent - parent is adjustable through clk_set_parent - */ - --static u8 clk_mux_get_parent(struct clk_hw *hw) -+unsigned int clk_mux_get_parent(struct clk_hw *hw, unsigned int val, -+ unsigned int *table, unsigned long flags) - { -- struct clk_mux *mux = to_clk_mux(hw); - int num_parents = clk_hw_get_num_parents(hw); -- u32 val; -- -- /* -- * FIXME need a mux-specific flag to determine if val is bitwise or numeric -- * e.g. sys_clkin_ck's clksel field is 3 bits wide, but ranges from 0x1 -- * to 0x7 (index starts at one) -- * OTOH, pmd_trace_clk_mux_ck uses a separate bit for each clock, so -- * val = 0x4 really means "bit 2, index starts at bit 0" -- */ -- val = clk_readl(mux->reg) >> mux->shift; -- val &= mux->mask; - -- if (mux->table) { -+ if (table) { - int i; - - for (i = 0; i < num_parents; i++) -- if (mux->table[i] == val) -+ if (table[i] == val) - return i; - return -EINVAL; - } - -- if (val && (mux->flags & CLK_MUX_INDEX_BIT)) -+ if (val && (flags & CLK_MUX_INDEX_BIT)) - val = ffs(val) - 1; - -- if (val && (mux->flags & CLK_MUX_INDEX_ONE)) -+ if (val && (flags & CLK_MUX_INDEX_ONE)) - val--; - - if (val >= num_parents) -@@ -62,23 +51,53 @@ static u8 clk_mux_get_parent(struct clk_ - - return val; - } -+EXPORT_SYMBOL_GPL(clk_mux_get_parent); - --static int clk_mux_set_parent(struct clk_hw *hw, u8 index) -+static u8 _clk_mux_get_parent(struct clk_hw *hw) - { - struct clk_mux *mux = to_clk_mux(hw); - u32 val; -- unsigned long flags = 0; - -- if (mux->table) { -- index = mux->table[index]; -+ /* -+ * FIXME need a mux-specific flag to determine if val is bitwise or -+ * numeric e.g. sys_clkin_ck's clksel field is 3 bits wide, -+ * but ranges from 0x1 to 0x7 (index starts at one) -+ * OTOH, pmd_trace_clk_mux_ck uses a separate bit for each clock, so -+ * val = 0x4 really means "bit 2, index starts at bit 0" -+ */ -+ val = clk_readl(mux->reg) >> mux->shift; -+ val &= mux->mask; -+ -+ return clk_mux_get_parent(hw, val, mux->table, mux->flags); -+} -+ -+unsigned int clk_mux_reindex(u8 index, unsigned int *table, -+ unsigned long flags) -+{ -+ unsigned int val = index; -+ -+ if (table) { -+ val = table[val]; - } else { -- if (mux->flags & CLK_MUX_INDEX_BIT) -- index = 1 << index; -+ if (flags & CLK_MUX_INDEX_BIT) -+ val = 1 << index; - -- if (mux->flags & CLK_MUX_INDEX_ONE) -- index++; -+ if (flags & CLK_MUX_INDEX_ONE) -+ val++; - } - -+ return val; -+} -+EXPORT_SYMBOL_GPL(clk_mux_reindex); -+ -+static int clk_mux_set_parent(struct clk_hw *hw, u8 index) -+{ -+ struct clk_mux *mux = to_clk_mux(hw); -+ u32 val; -+ unsigned long flags = 0; -+ -+ index = clk_mux_reindex(index, mux->table, mux->flags); -+ - if (mux->lock) - spin_lock_irqsave(mux->lock, flags); - else -@@ -102,14 +121,14 @@ static int clk_mux_set_parent(struct clk - } - - const struct clk_ops clk_mux_ops = { -- .get_parent = clk_mux_get_parent, -+ .get_parent = _clk_mux_get_parent, - .set_parent = clk_mux_set_parent, - .determine_rate = __clk_mux_determine_rate, - }; - EXPORT_SYMBOL_GPL(clk_mux_ops); - - const struct clk_ops clk_mux_ro_ops = { -- .get_parent = clk_mux_get_parent, -+ .get_parent = _clk_mux_get_parent, - }; - EXPORT_SYMBOL_GPL(clk_mux_ro_ops); - -@@ -117,7 +136,7 @@ struct clk_hw *clk_hw_register_mux_table - const char * const *parent_names, u8 num_parents, - unsigned long flags, - void __iomem *reg, u8 shift, u32 mask, -- u8 clk_mux_flags, u32 *table, spinlock_t *lock) -+ u8 clk_mux_flags, unsigned int *table, spinlock_t *lock) - { - struct clk_mux *mux; - struct clk_hw *hw; ---- a/include/linux/clk-provider.h -+++ b/include/linux/clk-provider.h -@@ -466,7 +466,7 @@ void clk_hw_unregister_divider(struct cl - struct clk_mux { - struct clk_hw hw; - void __iomem *reg; -- u32 *table; -+ unsigned int *table; - u32 mask; - u8 shift; - u8 flags; -@@ -484,6 +484,11 @@ struct clk_mux { - extern const struct clk_ops clk_mux_ops; - extern const struct clk_ops clk_mux_ro_ops; - -+unsigned int clk_mux_get_parent(struct clk_hw *hw, unsigned int val, -+ unsigned int *table, unsigned long flags); -+unsigned int clk_mux_reindex(u8 index, unsigned int *table, -+ unsigned long flags); -+ - struct clk *clk_register_mux(struct device *dev, const char *name, - const char * const *parent_names, u8 num_parents, - unsigned long flags, -@@ -504,7 +509,7 @@ struct clk_hw *clk_hw_register_mux_table - const char * const *parent_names, u8 num_parents, - unsigned long flags, - void __iomem *reg, u8 shift, u32 mask, -- u8 clk_mux_flags, u32 *table, spinlock_t *lock); -+ u8 clk_mux_flags, unsigned int *table, spinlock_t *lock); - - void clk_unregister_mux(struct clk *clk); - void clk_hw_unregister_mux(struct clk_hw *hw); diff --git a/target/linux/ipq806x/patches-4.9/0038-clk-qcom-Add-support-for-High-Frequency-PLLs-HFPLLs.patch b/target/linux/ipq806x/patches-4.9/0038-clk-qcom-Add-support-for-High-Frequency-PLLs-HFPLLs.patch deleted file mode 100644 index 70926143e..000000000 --- a/target/linux/ipq806x/patches-4.9/0038-clk-qcom-Add-support-for-High-Frequency-PLLs-HFPLLs.patch +++ /dev/null @@ -1,352 +0,0 @@ -From patchwork Fri Dec 8 09:42:21 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,03/12] clk: qcom: Add support for High-Frequency PLLs (HFPLLs) -From: Sricharan R -X-Patchwork-Id: 10102083 -Message-Id: <1512726150-7204-4-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:21 +0530 - -From: Stephen Boyd - -HFPLLs are the main frequency source for Krait CPU clocks. Add -support for changing the rate of these PLLs. - -Signed-off-by: Stephen Boyd ---- - drivers/clk/qcom/Makefile | 1 + - drivers/clk/qcom/clk-hfpll.c | 253 +++++++++++++++++++++++++++++++++++++++++++ - drivers/clk/qcom/clk-hfpll.h | 54 +++++++++ - 3 files changed, 308 insertions(+) - create mode 100644 drivers/clk/qcom/clk-hfpll.c - create mode 100644 drivers/clk/qcom/clk-hfpll.h - ---- a/drivers/clk/qcom/Makefile -+++ b/drivers/clk/qcom/Makefile -@@ -9,6 +9,7 @@ clk-qcom-y += clk-rcg2.o - clk-qcom-y += clk-branch.o - clk-qcom-y += clk-regmap-divider.o - clk-qcom-y += clk-regmap-mux.o -+clk-qcom-y += clk-hfpll.o - clk-qcom-y += reset.o - clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o - ---- /dev/null -+++ b/drivers/clk/qcom/clk-hfpll.c -@@ -0,0 +1,253 @@ -+/* -+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "clk-regmap.h" -+#include "clk-hfpll.h" -+ -+#define PLL_OUTCTRL BIT(0) -+#define PLL_BYPASSNL BIT(1) -+#define PLL_RESET_N BIT(2) -+ -+/* Initialize a HFPLL at a given rate and enable it. */ -+static void __clk_hfpll_init_once(struct clk_hw *hw) -+{ -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ struct hfpll_data const *hd = h->d; -+ struct regmap *regmap = h->clkr.regmap; -+ -+ if (likely(h->init_done)) -+ return; -+ -+ /* Configure PLL parameters for integer mode. */ -+ if (hd->config_val) -+ regmap_write(regmap, hd->config_reg, hd->config_val); -+ regmap_write(regmap, hd->m_reg, 0); -+ regmap_write(regmap, hd->n_reg, 1); -+ -+ if (hd->user_reg) { -+ u32 regval = hd->user_val; -+ unsigned long rate; -+ -+ rate = clk_hw_get_rate(hw); -+ -+ /* Pick the right VCO. */ -+ if (hd->user_vco_mask && rate > hd->low_vco_max_rate) -+ regval |= hd->user_vco_mask; -+ regmap_write(regmap, hd->user_reg, regval); -+ } -+ -+ if (hd->droop_reg) -+ regmap_write(regmap, hd->droop_reg, hd->droop_val); -+ -+ h->init_done = true; -+} -+ -+static void __clk_hfpll_enable(struct clk_hw *hw) -+{ -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ struct hfpll_data const *hd = h->d; -+ struct regmap *regmap = h->clkr.regmap; -+ u32 val; -+ -+ __clk_hfpll_init_once(hw); -+ -+ /* Disable PLL bypass mode. */ -+ regmap_update_bits(regmap, hd->mode_reg, PLL_BYPASSNL, PLL_BYPASSNL); -+ -+ /* -+ * H/W requires a 5us delay between disabling the bypass and -+ * de-asserting the reset. Delay 10us just to be safe. -+ */ -+ usleep_range(10, 100); -+ -+ /* De-assert active-low PLL reset. */ -+ regmap_update_bits(regmap, hd->mode_reg, PLL_RESET_N, PLL_RESET_N); -+ -+ /* Wait for PLL to lock. */ -+ if (hd->status_reg) { -+ do { -+ regmap_read(regmap, hd->status_reg, &val); -+ } while (!(val & BIT(hd->lock_bit))); -+ } else { -+ usleep_range(60, 100); -+ } -+ -+ /* Enable PLL output. */ -+ regmap_update_bits(regmap, hd->mode_reg, PLL_OUTCTRL, PLL_OUTCTRL); -+} -+ -+/* Enable an already-configured HFPLL. */ -+static int clk_hfpll_enable(struct clk_hw *hw) -+{ -+ unsigned long flags; -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ struct hfpll_data const *hd = h->d; -+ struct regmap *regmap = h->clkr.regmap; -+ u32 mode; -+ -+ spin_lock_irqsave(&h->lock, flags); -+ regmap_read(regmap, hd->mode_reg, &mode); -+ if (!(mode & (PLL_BYPASSNL | PLL_RESET_N | PLL_OUTCTRL))) -+ __clk_hfpll_enable(hw); -+ spin_unlock_irqrestore(&h->lock, flags); -+ -+ return 0; -+} -+ -+static void __clk_hfpll_disable(struct clk_hfpll *h) -+{ -+ struct hfpll_data const *hd = h->d; -+ struct regmap *regmap = h->clkr.regmap; -+ -+ /* -+ * Disable the PLL output, disable test mode, enable the bypass mode, -+ * and assert the reset. -+ */ -+ regmap_update_bits(regmap, hd->mode_reg, -+ PLL_BYPASSNL | PLL_RESET_N | PLL_OUTCTRL, 0); -+} -+ -+static void clk_hfpll_disable(struct clk_hw *hw) -+{ -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&h->lock, flags); -+ __clk_hfpll_disable(h); -+ spin_unlock_irqrestore(&h->lock, flags); -+} -+ -+static long clk_hfpll_round_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long *parent_rate) -+{ -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ struct hfpll_data const *hd = h->d; -+ unsigned long rrate; -+ -+ rate = clamp(rate, hd->min_rate, hd->max_rate); -+ -+ rrate = DIV_ROUND_UP(rate, *parent_rate) * *parent_rate; -+ if (rrate > hd->max_rate) -+ rrate -= *parent_rate; -+ -+ return rrate; -+} -+ -+/* -+ * For optimization reasons, assumes no downstream clocks are actively using -+ * it. -+ */ -+static int clk_hfpll_set_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long parent_rate) -+{ -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ struct hfpll_data const *hd = h->d; -+ struct regmap *regmap = h->clkr.regmap; -+ unsigned long flags; -+ u32 l_val, val; -+ bool enabled; -+ -+ l_val = rate / parent_rate; -+ -+ spin_lock_irqsave(&h->lock, flags); -+ -+ enabled = __clk_is_enabled(hw->clk); -+ if (enabled) -+ __clk_hfpll_disable(h); -+ -+ /* Pick the right VCO. */ -+ if (hd->user_reg && hd->user_vco_mask) { -+ regmap_read(regmap, hd->user_reg, &val); -+ if (rate <= hd->low_vco_max_rate) -+ val &= ~hd->user_vco_mask; -+ else -+ val |= hd->user_vco_mask; -+ regmap_write(regmap, hd->user_reg, val); -+ } -+ -+ regmap_write(regmap, hd->l_reg, l_val); -+ -+ if (enabled) -+ __clk_hfpll_enable(hw); -+ -+ spin_unlock_irqrestore(&h->lock, flags); -+ -+ return 0; -+} -+ -+static unsigned long clk_hfpll_recalc_rate(struct clk_hw *hw, -+ unsigned long parent_rate) -+{ -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ struct hfpll_data const *hd = h->d; -+ struct regmap *regmap = h->clkr.regmap; -+ u32 l_val; -+ -+ regmap_read(regmap, hd->l_reg, &l_val); -+ -+ return l_val * parent_rate; -+} -+ -+static void clk_hfpll_init(struct clk_hw *hw) -+{ -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ struct hfpll_data const *hd = h->d; -+ struct regmap *regmap = h->clkr.regmap; -+ u32 mode, status; -+ -+ regmap_read(regmap, hd->mode_reg, &mode); -+ if (mode != (PLL_BYPASSNL | PLL_RESET_N | PLL_OUTCTRL)) { -+ __clk_hfpll_init_once(hw); -+ return; -+ } -+ -+ if (hd->status_reg) { -+ regmap_read(regmap, hd->status_reg, &status); -+ if (!(status & BIT(hd->lock_bit))) { -+ WARN(1, "HFPLL %s is ON, but not locked!\n", -+ __clk_get_name(hw->clk)); -+ clk_hfpll_disable(hw); -+ __clk_hfpll_init_once(hw); -+ } -+ } -+} -+ -+static int hfpll_is_enabled(struct clk_hw *hw) -+{ -+ struct clk_hfpll *h = to_clk_hfpll(hw); -+ struct hfpll_data const *hd = h->d; -+ struct regmap *regmap = h->clkr.regmap; -+ u32 mode; -+ -+ regmap_read(regmap, hd->mode_reg, &mode); -+ mode &= 0x7; -+ return mode == (PLL_BYPASSNL | PLL_RESET_N | PLL_OUTCTRL); -+} -+ -+const struct clk_ops clk_ops_hfpll = { -+ .enable = clk_hfpll_enable, -+ .disable = clk_hfpll_disable, -+ .is_enabled = hfpll_is_enabled, -+ .round_rate = clk_hfpll_round_rate, -+ .set_rate = clk_hfpll_set_rate, -+ .recalc_rate = clk_hfpll_recalc_rate, -+ .init = clk_hfpll_init, -+}; -+EXPORT_SYMBOL_GPL(clk_ops_hfpll); ---- /dev/null -+++ b/drivers/clk/qcom/clk-hfpll.h -@@ -0,0 +1,54 @@ -+/* -+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+#ifndef __QCOM_CLK_HFPLL_H__ -+#define __QCOM_CLK_HFPLL_H__ -+ -+#include -+#include -+#include "clk-regmap.h" -+ -+struct hfpll_data { -+ u32 mode_reg; -+ u32 l_reg; -+ u32 m_reg; -+ u32 n_reg; -+ u32 user_reg; -+ u32 droop_reg; -+ u32 config_reg; -+ u32 status_reg; -+ u8 lock_bit; -+ -+ u32 droop_val; -+ u32 config_val; -+ u32 user_val; -+ u32 user_vco_mask; -+ unsigned long low_vco_max_rate; -+ -+ unsigned long min_rate; -+ unsigned long max_rate; -+}; -+ -+struct clk_hfpll { -+ struct hfpll_data const *d; -+ int init_done; -+ -+ struct clk_regmap clkr; -+ spinlock_t lock; -+}; -+ -+#define to_clk_hfpll(_hw) \ -+ container_of(to_clk_regmap(_hw), struct clk_hfpll, clkr) -+ -+extern const struct clk_ops clk_ops_hfpll; -+ -+#endif diff --git a/target/linux/ipq806x/patches-4.9/0039-clk-qcom-Add-HFPLL-driver.patch b/target/linux/ipq806x/patches-4.9/0039-clk-qcom-Add-HFPLL-driver.patch deleted file mode 100644 index d9ad391d0..000000000 --- a/target/linux/ipq806x/patches-4.9/0039-clk-qcom-Add-HFPLL-driver.patch +++ /dev/null @@ -1,206 +0,0 @@ -From patchwork Fri Dec 8 09:42:22 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,04/12] clk: qcom: Add HFPLL driver -From: Sricharan R -X-Patchwork-Id: 10102079 -Message-Id: <1512726150-7204-5-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:22 +0530 - -From: Stephen Boyd - -On some devices (MSM8974 for example), the HFPLLs are -instantiated within the Krait processor subsystem as separate -register regions. Add a driver for these PLLs so that we can -provide HFPLL clocks for use by the system. - -Cc: -Signed-off-by: Stephen Boyd ---- - .../devicetree/bindings/clock/qcom,hfpll.txt | 40 ++++++++ - drivers/clk/qcom/Kconfig | 8 ++ - drivers/clk/qcom/Makefile | 1 + - drivers/clk/qcom/hfpll.c | 106 +++++++++++++++++++++ - 4 files changed, 155 insertions(+) - create mode 100644 Documentation/devicetree/bindings/clock/qcom,hfpll.txt - create mode 100644 drivers/clk/qcom/hfpll.c - ---- /dev/null -+++ b/Documentation/devicetree/bindings/clock/qcom,hfpll.txt -@@ -0,0 +1,40 @@ -+High-Frequency PLL (HFPLL) -+ -+PROPERTIES -+ -+- compatible: -+ Usage: required -+ Value type: -+ Definition: must be "qcom,hfpll" -+ -+- reg: -+ Usage: required -+ Value type: -+ Definition: address and size of HPLL registers. An optional second -+ element specifies the address and size of the alias -+ register region. -+ -+- clock-output-names: -+ Usage: required -+ Value type: -+ Definition: Name of the PLL. Typically hfpllX where X is a CPU number -+ starting at 0. Otherwise hfpll_Y where Y is more specific -+ such as "l2". -+ -+Example: -+ -+1) An HFPLL for the L2 cache. -+ -+ clock-controller@f9016000 { -+ compatible = "qcom,hfpll"; -+ reg = <0xf9016000 0x30>; -+ clock-output-names = "hfpll_l2"; -+ }; -+ -+2) An HFPLL for CPU0. This HFPLL has the alias register region. -+ -+ clock-controller@f908a000 { -+ compatible = "qcom,hfpll"; -+ reg = <0xf908a000 0x30>, <0xf900a000 0x30>; -+ clock-output-names = "hfpll0"; -+ }; ---- a/drivers/clk/qcom/Kconfig -+++ b/drivers/clk/qcom/Kconfig -@@ -179,3 +179,11 @@ config MSM_MMCC_8996 - Support for the multimedia clock controller on msm8996 devices. - Say Y if you want to support multimedia devices such as display, - graphics, video encode/decode, camera, etc. -+ -+config QCOM_HFPLL -+ tristate "High-Frequency PLL (HFPLL) Clock Controller" -+ depends on COMMON_CLK_QCOM -+ help -+ Support for the high-frequency PLLs present on Qualcomm devices. -+ Say Y if you want to support CPU frequency scaling on devices -+ such as MSM8974, APQ8084, etc. ---- a/drivers/clk/qcom/Makefile -+++ b/drivers/clk/qcom/Makefile -@@ -32,3 +32,4 @@ obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8 - obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o - obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o - obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o -+obj-$(CONFIG_QCOM_HFPLL) += hfpll.o ---- /dev/null -+++ b/drivers/clk/qcom/hfpll.c -@@ -0,0 +1,106 @@ -+/* -+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "clk-regmap.h" -+#include "clk-hfpll.h" -+ -+static const struct hfpll_data hdata = { -+ .mode_reg = 0x00, -+ .l_reg = 0x04, -+ .m_reg = 0x08, -+ .n_reg = 0x0c, -+ .user_reg = 0x10, -+ .config_reg = 0x14, -+ .config_val = 0x430405d, -+ .status_reg = 0x1c, -+ .lock_bit = 16, -+ -+ .user_val = 0x8, -+ .user_vco_mask = 0x100000, -+ .low_vco_max_rate = 1248000000, -+ .min_rate = 537600000UL, -+ .max_rate = 2900000000UL, -+}; -+ -+static const struct of_device_id qcom_hfpll_match_table[] = { -+ { .compatible = "qcom,hfpll" }, -+ { } -+}; -+MODULE_DEVICE_TABLE(of, qcom_hfpll_match_table); -+ -+static const struct regmap_config hfpll_regmap_config = { -+ .reg_bits = 32, -+ .reg_stride = 4, -+ .val_bits = 32, -+ .max_register = 0x30, -+ .fast_io = true, -+}; -+ -+static int qcom_hfpll_probe(struct platform_device *pdev) -+{ -+ struct resource *res; -+ struct device *dev = &pdev->dev; -+ void __iomem *base; -+ struct regmap *regmap; -+ struct clk_hfpll *h; -+ struct clk_init_data init = { -+ .parent_names = (const char *[]){ "xo" }, -+ .num_parents = 1, -+ .ops = &clk_ops_hfpll, -+ }; -+ -+ h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); -+ if (!h) -+ return -ENOMEM; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ base = devm_ioremap_resource(dev, res); -+ if (IS_ERR(base)) -+ return PTR_ERR(base); -+ -+ regmap = devm_regmap_init_mmio(&pdev->dev, base, &hfpll_regmap_config); -+ if (IS_ERR(regmap)) -+ return PTR_ERR(regmap); -+ -+ if (of_property_read_string_index(dev->of_node, "clock-output-names", -+ 0, &init.name)) -+ return -ENODEV; -+ -+ h->d = &hdata; -+ h->clkr.hw.init = &init; -+ spin_lock_init(&h->lock); -+ -+ return devm_clk_register_regmap(&pdev->dev, &h->clkr); -+} -+ -+static struct platform_driver qcom_hfpll_driver = { -+ .probe = qcom_hfpll_probe, -+ .driver = { -+ .name = "qcom-hfpll", -+ .of_match_table = qcom_hfpll_match_table, -+ }, -+}; -+module_platform_driver(qcom_hfpll_driver); -+ -+MODULE_DESCRIPTION("QCOM HFPLL Clock Driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:qcom-hfpll"); diff --git a/target/linux/ipq806x/patches-4.9/0040-clk-qcom-Add-IPQ806X-s-HFPLLs.patch b/target/linux/ipq806x/patches-4.9/0040-clk-qcom-Add-IPQ806X-s-HFPLLs.patch deleted file mode 100644 index c3af0fa55..000000000 --- a/target/linux/ipq806x/patches-4.9/0040-clk-qcom-Add-IPQ806X-s-HFPLLs.patch +++ /dev/null @@ -1,129 +0,0 @@ -From patchwork Fri Dec 8 09:42:24 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,06/12] clk: qcom: Add IPQ806X's HFPLLs -From: Sricharan R -X-Patchwork-Id: 10102047 -Message-Id: <1512726150-7204-7-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:24 +0530 - -From: Stephen Boyd - -Describe the HFPLLs present on IPQ806X devices. - -Signed-off-by: Stephen Boyd ---- - drivers/clk/qcom/gcc-ipq806x.c | 82 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 82 insertions(+) - ---- a/drivers/clk/qcom/gcc-ipq806x.c -+++ b/drivers/clk/qcom/gcc-ipq806x.c -@@ -30,6 +30,7 @@ - #include "clk-pll.h" - #include "clk-rcg.h" - #include "clk-branch.h" -+#include "clk-hfpll.h" - #include "reset.h" - - static struct clk_pll pll0 = { -@@ -113,6 +114,84 @@ static struct clk_regmap pll8_vote = { - }, - }; - -+static struct hfpll_data hfpll0_data = { -+ .mode_reg = 0x3200, -+ .l_reg = 0x3208, -+ .m_reg = 0x320c, -+ .n_reg = 0x3210, -+ .config_reg = 0x3204, -+ .status_reg = 0x321c, -+ .config_val = 0x7845c665, -+ .droop_reg = 0x3214, -+ .droop_val = 0x0108c000, -+ .min_rate = 600000000UL, -+ .max_rate = 1800000000UL, -+}; -+ -+static struct clk_hfpll hfpll0 = { -+ .d = &hfpll0_data, -+ .clkr.hw.init = &(struct clk_init_data){ -+ .parent_names = (const char *[]){ "pxo" }, -+ .num_parents = 1, -+ .name = "hfpll0", -+ .ops = &clk_ops_hfpll, -+ .flags = CLK_IGNORE_UNUSED, -+ }, -+ .lock = __SPIN_LOCK_UNLOCKED(hfpll0.lock), -+}; -+ -+static struct hfpll_data hfpll1_data = { -+ .mode_reg = 0x3240, -+ .l_reg = 0x3248, -+ .m_reg = 0x324c, -+ .n_reg = 0x3250, -+ .config_reg = 0x3244, -+ .status_reg = 0x325c, -+ .config_val = 0x7845c665, -+ .droop_reg = 0x3314, -+ .droop_val = 0x0108c000, -+ .min_rate = 600000000UL, -+ .max_rate = 1800000000UL, -+}; -+ -+static struct clk_hfpll hfpll1 = { -+ .d = &hfpll1_data, -+ .clkr.hw.init = &(struct clk_init_data){ -+ .parent_names = (const char *[]){ "pxo" }, -+ .num_parents = 1, -+ .name = "hfpll1", -+ .ops = &clk_ops_hfpll, -+ .flags = CLK_IGNORE_UNUSED, -+ }, -+ .lock = __SPIN_LOCK_UNLOCKED(hfpll1.lock), -+}; -+ -+static struct hfpll_data hfpll_l2_data = { -+ .mode_reg = 0x3300, -+ .l_reg = 0x3308, -+ .m_reg = 0x330c, -+ .n_reg = 0x3310, -+ .config_reg = 0x3304, -+ .status_reg = 0x331c, -+ .config_val = 0x7845c665, -+ .droop_reg = 0x3314, -+ .droop_val = 0x0108c000, -+ .min_rate = 600000000UL, -+ .max_rate = 1800000000UL, -+}; -+ -+static struct clk_hfpll hfpll_l2 = { -+ .d = &hfpll_l2_data, -+ .clkr.hw.init = &(struct clk_init_data){ -+ .parent_names = (const char *[]){ "pxo" }, -+ .num_parents = 1, -+ .name = "hfpll_l2", -+ .ops = &clk_ops_hfpll, -+ .flags = CLK_IGNORE_UNUSED, -+ }, -+ .lock = __SPIN_LOCK_UNLOCKED(hfpll_l2.lock), -+}; -+ - static struct clk_pll pll14 = { - .l_reg = 0x31c4, - .m_reg = 0x31c8, -@@ -2801,6 +2880,9 @@ static struct clk_regmap *gcc_ipq806x_cl - [UBI32_CORE2_CLK_SRC] = &ubi32_core2_src_clk.clkr, - [NSSTCM_CLK_SRC] = &nss_tcm_src.clkr, - [NSSTCM_CLK] = &nss_tcm_clk.clkr, -+ [PLL9] = &hfpll0.clkr, -+ [PLL10] = &hfpll1.clkr, -+ [PLL12] = &hfpll_l2.clkr, - }; - - static const struct qcom_reset_map gcc_ipq806x_resets[] = { diff --git a/target/linux/ipq806x/patches-4.9/0041-clk-qcom-Add-support-for-Krait-clocks.patch b/target/linux/ipq806x/patches-4.9/0041-clk-qcom-Add-support-for-Krait-clocks.patch deleted file mode 100644 index a6d0f0d7a..000000000 --- a/target/linux/ipq806x/patches-4.9/0041-clk-qcom-Add-support-for-Krait-clocks.patch +++ /dev/null @@ -1,241 +0,0 @@ -From patchwork Fri Dec 8 09:42:25 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,07/12] clk: qcom: Add support for Krait clocks -From: Sricharan R -X-Patchwork-Id: 10102051 -Message-Id: <1512726150-7204-8-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:25 +0530 - -From: Stephen Boyd - -The Krait clocks are made up of a series of muxes and a divider -that choose between a fixed rate clock and dedicated HFPLLs for -each CPU. Instead of using mmio accesses to remux parents, the -Krait implementation exposes the remux control via cp15 -registers. Support these clocks. - -Signed-off-by: Stephen Boyd ---- - drivers/clk/qcom/Kconfig | 4 ++ - drivers/clk/qcom/Makefile | 1 + - drivers/clk/qcom/clk-krait.c | 134 +++++++++++++++++++++++++++++++++++++++++++ - drivers/clk/qcom/clk-krait.h | 48 ++++++++++++++++ - 4 files changed, 187 insertions(+) - create mode 100644 drivers/clk/qcom/clk-krait.c - create mode 100644 drivers/clk/qcom/clk-krait.h - ---- a/drivers/clk/qcom/Kconfig -+++ b/drivers/clk/qcom/Kconfig -@@ -187,3 +187,7 @@ config QCOM_HFPLL - Support for the high-frequency PLLs present on Qualcomm devices. - Say Y if you want to support CPU frequency scaling on devices - such as MSM8974, APQ8084, etc. -+ -+config KRAIT_CLOCKS -+ bool -+ select KRAIT_L2_ACCESSORS ---- a/drivers/clk/qcom/Makefile -+++ b/drivers/clk/qcom/Makefile -@@ -9,6 +9,7 @@ clk-qcom-y += clk-rcg2.o - clk-qcom-y += clk-branch.o - clk-qcom-y += clk-regmap-divider.o - clk-qcom-y += clk-regmap-mux.o -+clk-qcom-$(CONFIG_KRAIT_CLOCKS) += clk-krait.o - clk-qcom-y += clk-hfpll.o - clk-qcom-y += reset.o - clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o ---- /dev/null -+++ b/drivers/clk/qcom/clk-krait.c -@@ -0,0 +1,134 @@ -+/* -+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include "clk-krait.h" -+ -+/* Secondary and primary muxes share the same cp15 register */ -+static DEFINE_SPINLOCK(krait_clock_reg_lock); -+ -+#define LPL_SHIFT 8 -+static void __krait_mux_set_sel(struct krait_mux_clk *mux, int sel) -+{ -+ unsigned long flags; -+ u32 regval; -+ -+ spin_lock_irqsave(&krait_clock_reg_lock, flags); -+ regval = krait_get_l2_indirect_reg(mux->offset); -+ regval &= ~(mux->mask << mux->shift); -+ regval |= (sel & mux->mask) << mux->shift; -+ if (mux->lpl) { -+ regval &= ~(mux->mask << (mux->shift + LPL_SHIFT)); -+ regval |= (sel & mux->mask) << (mux->shift + LPL_SHIFT); -+ } -+ krait_set_l2_indirect_reg(mux->offset, regval); -+ spin_unlock_irqrestore(&krait_clock_reg_lock, flags); -+ -+ /* Wait for switch to complete. */ -+ mb(); -+ udelay(1); -+} -+ -+static int krait_mux_set_parent(struct clk_hw *hw, u8 index) -+{ -+ struct krait_mux_clk *mux = to_krait_mux_clk(hw); -+ u32 sel; -+ -+ sel = clk_mux_reindex(index, mux->parent_map, 0); -+ mux->en_mask = sel; -+ /* Don't touch mux if CPU is off as it won't work */ -+ if (__clk_is_enabled(hw->clk)) -+ __krait_mux_set_sel(mux, sel); -+ -+ return 0; -+} -+ -+static u8 krait_mux_get_parent(struct clk_hw *hw) -+{ -+ struct krait_mux_clk *mux = to_krait_mux_clk(hw); -+ u32 sel; -+ -+ sel = krait_get_l2_indirect_reg(mux->offset); -+ sel >>= mux->shift; -+ sel &= mux->mask; -+ mux->en_mask = sel; -+ -+ return clk_mux_get_parent(hw, sel, mux->parent_map, 0); -+} -+ -+const struct clk_ops krait_mux_clk_ops = { -+ .set_parent = krait_mux_set_parent, -+ .get_parent = krait_mux_get_parent, -+ .determine_rate = __clk_mux_determine_rate_closest, -+}; -+EXPORT_SYMBOL_GPL(krait_mux_clk_ops); -+ -+/* The divider can divide by 2, 4, 6 and 8. But we only really need div-2. */ -+static long krait_div2_round_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long *parent_rate) -+{ -+ *parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), rate * 2); -+ return DIV_ROUND_UP(*parent_rate, 2); -+} -+ -+static int krait_div2_set_rate(struct clk_hw *hw, unsigned long rate, -+ unsigned long parent_rate) -+{ -+ struct krait_div2_clk *d = to_krait_div2_clk(hw); -+ unsigned long flags; -+ u32 val; -+ u32 mask = BIT(d->width) - 1; -+ -+ if (d->lpl) -+ mask = mask << (d->shift + LPL_SHIFT) | mask << d->shift; -+ -+ spin_lock_irqsave(&krait_clock_reg_lock, flags); -+ val = krait_get_l2_indirect_reg(d->offset); -+ val &= ~mask; -+ krait_set_l2_indirect_reg(d->offset, val); -+ spin_unlock_irqrestore(&krait_clock_reg_lock, flags); -+ -+ return 0; -+} -+ -+static unsigned long -+krait_div2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) -+{ -+ struct krait_div2_clk *d = to_krait_div2_clk(hw); -+ u32 mask = BIT(d->width) - 1; -+ u32 div; -+ -+ div = krait_get_l2_indirect_reg(d->offset); -+ div >>= d->shift; -+ div &= mask; -+ div = (div + 1) * 2; -+ -+ return DIV_ROUND_UP(parent_rate, div); -+} -+ -+const struct clk_ops krait_div2_clk_ops = { -+ .round_rate = krait_div2_round_rate, -+ .set_rate = krait_div2_set_rate, -+ .recalc_rate = krait_div2_recalc_rate, -+}; -+EXPORT_SYMBOL_GPL(krait_div2_clk_ops); ---- /dev/null -+++ b/drivers/clk/qcom/clk-krait.h -@@ -0,0 +1,48 @@ -+/* -+ * Copyright (c) 2013, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef __QCOM_CLK_KRAIT_H -+#define __QCOM_CLK_KRAIT_H -+ -+#include -+ -+struct krait_mux_clk { -+ unsigned int *parent_map; -+ u32 offset; -+ u32 mask; -+ u32 shift; -+ u32 en_mask; -+ bool lpl; -+ -+ struct clk_hw hw; -+ struct notifier_block clk_nb; -+}; -+ -+#define to_krait_mux_clk(_hw) container_of(_hw, struct krait_mux_clk, hw) -+ -+extern const struct clk_ops krait_mux_clk_ops; -+ -+struct krait_div2_clk { -+ u32 offset; -+ u8 width; -+ u32 shift; -+ bool lpl; -+ -+ struct clk_hw hw; -+}; -+ -+#define to_krait_div2_clk(_hw) container_of(_hw, struct krait_div2_clk, hw) -+ -+extern const struct clk_ops krait_div2_clk_ops; -+ -+#endif diff --git a/target/linux/ipq806x/patches-4.9/0042-clk-qcom-Add-KPSS-ACC-GCC-driver.patch b/target/linux/ipq806x/patches-4.9/0042-clk-qcom-Add-KPSS-ACC-GCC-driver.patch deleted file mode 100644 index 5a76fbc8b..000000000 --- a/target/linux/ipq806x/patches-4.9/0042-clk-qcom-Add-KPSS-ACC-GCC-driver.patch +++ /dev/null @@ -1,209 +0,0 @@ -From patchwork Fri Dec 8 09:42:26 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,08/12] clk: qcom: Add KPSS ACC/GCC driver -From: Sricharan R -X-Patchwork-Id: 10102023 -Message-Id: <1512726150-7204-9-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:26 +0530 - -From: Stephen Boyd - -The ACC and GCC regions present in KPSSv1 contain registers to -control clocks and power to each Krait CPU and L2. For CPUfreq -purposes probe these devices and expose a mux clock that chooses -between PXO and PLL8. - -Cc: -Signed-off-by: Stephen Boyd ---- - .../devicetree/bindings/arm/msm/qcom,kpss-acc.txt | 7 ++ - .../devicetree/bindings/arm/msm/qcom,kpss-gcc.txt | 28 +++++++ - drivers/clk/qcom/Kconfig | 8 ++ - drivers/clk/qcom/Makefile | 1 + - drivers/clk/qcom/kpss-xcc.c | 96 ++++++++++++++++++++++ - 5 files changed, 140 insertions(+) - create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt - create mode 100644 drivers/clk/qcom/kpss-xcc.c - ---- a/Documentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt -+++ b/Documentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt -@@ -21,10 +21,17 @@ PROPERTIES - the register region. An optional second element specifies - the base address and size of the alias register region. - -+- clock-output-names: -+ Usage: optional -+ Value type: -+ Definition: Name of the output clock. Typically acpuX_aux where X is a -+ CPU number starting at 0. -+ - Example: - - clock-controller@2088000 { - compatible = "qcom,kpss-acc-v2"; - reg = <0x02088000 0x1000>, - <0x02008000 0x1000>; -+ clock-output-names = "acpu0_aux"; - }; ---- /dev/null -+++ b/Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt -@@ -0,0 +1,28 @@ -+Krait Processor Sub-system (KPSS) Global Clock Controller (GCC) -+ -+PROPERTIES -+ -+- compatible: -+ Usage: required -+ Value type: -+ Definition: should be one of: -+ "qcom,kpss-gcc" -+ -+- reg: -+ Usage: required -+ Value type: -+ Definition: base address and size of the register region -+ -+- clock-output-names: -+ Usage: required -+ Value type: -+ Definition: Name of the output clock. Typically acpu_l2_aux indicating -+ an L2 cache auxiliary clock. -+ -+Example: -+ -+ l2cc: clock-controller@2011000 { -+ compatible = "qcom,kpss-gcc"; -+ reg = <0x2011000 0x1000>; -+ clock-output-names = "acpu_l2_aux"; -+ }; ---- a/drivers/clk/qcom/Kconfig -+++ b/drivers/clk/qcom/Kconfig -@@ -188,6 +188,14 @@ config QCOM_HFPLL - Say Y if you want to support CPU frequency scaling on devices - such as MSM8974, APQ8084, etc. - -+config KPSS_XCC -+ tristate "KPSS Clock Controller" -+ depends on COMMON_CLK_QCOM -+ help -+ Support for the Krait ACC and GCC clock controllers. Say Y -+ if you want to support CPU frequency scaling on devices such -+ as MSM8960, APQ8064, etc. -+ - config KRAIT_CLOCKS - bool - select KRAIT_L2_ACCESSORS ---- a/drivers/clk/qcom/Makefile -+++ b/drivers/clk/qcom/Makefile -@@ -33,4 +33,5 @@ obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8 - obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o - obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o - obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o -+obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o - obj-$(CONFIG_QCOM_HFPLL) += hfpll.o ---- /dev/null -+++ b/drivers/clk/qcom/kpss-xcc.c -@@ -0,0 +1,96 @@ -+/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static const char *aux_parents[] = { -+ "pll8_vote", -+ "pxo", -+}; -+ -+static unsigned int aux_parent_map[] = { -+ 3, -+ 0, -+}; -+ -+static const struct of_device_id kpss_xcc_match_table[] = { -+ { .compatible = "qcom,kpss-acc-v1", .data = (void *)1UL }, -+ { .compatible = "qcom,kpss-gcc" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, kpss_xcc_match_table); -+ -+static int kpss_xcc_driver_probe(struct platform_device *pdev) -+{ -+ const struct of_device_id *id; -+ struct clk *clk; -+ struct resource *res; -+ void __iomem *base; -+ const char *name; -+ -+ id = of_match_device(kpss_xcc_match_table, &pdev->dev); -+ if (!id) -+ return -ENODEV; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(base)) -+ return PTR_ERR(base); -+ -+ if (id->data) { -+ if (of_property_read_string_index(pdev->dev.of_node, -+ "clock-output-names", -+ 0, &name)) -+ return -ENODEV; -+ base += 0x14; -+ } else { -+ name = "acpu_l2_aux"; -+ base += 0x28; -+ } -+ -+ clk = clk_register_mux_table(&pdev->dev, name, aux_parents, -+ ARRAY_SIZE(aux_parents), 0, base, 0, 0x3, -+ 0, aux_parent_map, NULL); -+ -+ platform_set_drvdata(pdev, clk); -+ -+ return PTR_ERR_OR_ZERO(clk); -+} -+ -+static int kpss_xcc_driver_remove(struct platform_device *pdev) -+{ -+ clk_unregister_mux(platform_get_drvdata(pdev)); -+ return 0; -+} -+ -+static struct platform_driver kpss_xcc_driver = { -+ .probe = kpss_xcc_driver_probe, -+ .remove = kpss_xcc_driver_remove, -+ .driver = { -+ .name = "kpss-xcc", -+ .of_match_table = kpss_xcc_match_table, -+ }, -+}; -+module_platform_driver(kpss_xcc_driver); -+ -+MODULE_DESCRIPTION("Krait Processor Sub System (KPSS) Clock Driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:kpss-xcc"); diff --git a/target/linux/ipq806x/patches-4.9/0043-clk-qcom-Add-Krait-clock-controller-driver.patch b/target/linux/ipq806x/patches-4.9/0043-clk-qcom-Add-Krait-clock-controller-driver.patch deleted file mode 100644 index 1d32b2b05..000000000 --- a/target/linux/ipq806x/patches-4.9/0043-clk-qcom-Add-Krait-clock-controller-driver.patch +++ /dev/null @@ -1,436 +0,0 @@ -From patchwork Fri Dec 8 09:42:27 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,09/12] clk: qcom: Add Krait clock controller driver -From: Sricharan R -X-Patchwork-Id: 10102061 -Message-Id: <1512726150-7204-10-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:27 +0530 - -From: Stephen Boyd - -The Krait CPU clocks are made up of a primary mux and secondary -mux for each CPU and the L2, controlled via cp15 accessors. For -Kraits within KPSSv1 each secondary mux accepts a different aux -source, but on KPSSv2 each secondary mux accepts the same aux -source. - -Cc: -Signed-off-by: Stephen Boyd ---- - .../devicetree/bindings/clock/qcom,krait-cc.txt | 22 ++ - drivers/clk/qcom/Kconfig | 8 + - drivers/clk/qcom/Makefile | 1 + - drivers/clk/qcom/krait-cc.c | 350 +++++++++++++++++++++ - 4 files changed, 381 insertions(+) - create mode 100644 Documentation/devicetree/bindings/clock/qcom,krait-cc.txt - create mode 100644 drivers/clk/qcom/krait-cc.c - ---- /dev/null -+++ b/Documentation/devicetree/bindings/clock/qcom,krait-cc.txt -@@ -0,0 +1,22 @@ -+Krait Clock Controller -+ -+PROPERTIES -+ -+- compatible: -+ Usage: required -+ Value type: -+ Definition: must be one of: -+ "qcom,krait-cc-v1" -+ "qcom,krait-cc-v2" -+ -+- #clock-cells: -+ Usage: required -+ Value type: -+ Definition: must be 1 -+ -+Example: -+ -+ kraitcc: clock-controller { -+ compatible = "qcom,krait-cc-v1"; -+ #clock-cells = <1>; -+ }; ---- a/drivers/clk/qcom/Kconfig -+++ b/drivers/clk/qcom/Kconfig -@@ -196,6 +196,14 @@ config KPSS_XCC - if you want to support CPU frequency scaling on devices such - as MSM8960, APQ8064, etc. - -+config KRAITCC -+ tristate "Krait Clock Controller" -+ depends on COMMON_CLK_QCOM && ARM -+ select KRAIT_CLOCKS -+ help -+ Support for the Krait CPU clocks on Qualcomm devices. -+ Say Y if you want to support CPU frequency scaling. -+ - config KRAIT_CLOCKS - bool - select KRAIT_L2_ACCESSORS ---- a/drivers/clk/qcom/Makefile -+++ b/drivers/clk/qcom/Makefile -@@ -35,3 +35,4 @@ obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o - obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o - obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o - obj-$(CONFIG_QCOM_HFPLL) += hfpll.o -+obj-$(CONFIG_KRAITCC) += krait-cc.o ---- /dev/null -+++ b/drivers/clk/qcom/krait-cc.c -@@ -0,0 +1,350 @@ -+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "clk-krait.h" -+ -+static unsigned int sec_mux_map[] = { -+ 2, -+ 0, -+}; -+ -+static unsigned int pri_mux_map[] = { -+ 1, -+ 2, -+ 0, -+}; -+ -+static int -+krait_add_div(struct device *dev, int id, const char *s, unsigned int offset) -+{ -+ struct krait_div2_clk *div; -+ struct clk_init_data init = { -+ .num_parents = 1, -+ .ops = &krait_div2_clk_ops, -+ .flags = CLK_SET_RATE_PARENT, -+ }; -+ const char *p_names[1]; -+ struct clk *clk; -+ -+ div = devm_kzalloc(dev, sizeof(*div), GFP_KERNEL); -+ if (!div) -+ return -ENOMEM; -+ -+ div->width = 2; -+ div->shift = 6; -+ div->lpl = id >= 0; -+ div->offset = offset; -+ div->hw.init = &init; -+ -+ init.name = kasprintf(GFP_KERNEL, "hfpll%s_div", s); -+ if (!init.name) -+ return -ENOMEM; -+ -+ init.parent_names = p_names; -+ p_names[0] = kasprintf(GFP_KERNEL, "hfpll%s", s); -+ if (!p_names[0]) { -+ kfree(init.name); -+ return -ENOMEM; -+ } -+ -+ clk = devm_clk_register(dev, &div->hw); -+ kfree(p_names[0]); -+ kfree(init.name); -+ -+ return PTR_ERR_OR_ZERO(clk); -+} -+ -+static int -+krait_add_sec_mux(struct device *dev, int id, const char *s, -+ unsigned int offset, bool unique_aux) -+{ -+ struct krait_mux_clk *mux; -+ static const char *sec_mux_list[] = { -+ "acpu_aux", -+ "qsb", -+ }; -+ struct clk_init_data init = { -+ .parent_names = sec_mux_list, -+ .num_parents = ARRAY_SIZE(sec_mux_list), -+ .ops = &krait_mux_clk_ops, -+ .flags = CLK_SET_RATE_PARENT, -+ }; -+ struct clk *clk; -+ -+ mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); -+ if (!mux) -+ return -ENOMEM; -+ -+ mux->offset = offset; -+ mux->lpl = id >= 0; -+ mux->mask = 0x3; -+ mux->shift = 2; -+ mux->parent_map = sec_mux_map; -+ mux->hw.init = &init; -+ -+ init.name = kasprintf(GFP_KERNEL, "krait%s_sec_mux", s); -+ if (!init.name) -+ return -ENOMEM; -+ -+ if (unique_aux) { -+ sec_mux_list[0] = kasprintf(GFP_KERNEL, "acpu%s_aux", s); -+ if (!sec_mux_list[0]) { -+ clk = ERR_PTR(-ENOMEM); -+ goto err_aux; -+ } -+ } -+ -+ clk = devm_clk_register(dev, &mux->hw); -+ -+ if (unique_aux) -+ kfree(sec_mux_list[0]); -+err_aux: -+ kfree(init.name); -+ return PTR_ERR_OR_ZERO(clk); -+} -+ -+static struct clk * -+krait_add_pri_mux(struct device *dev, int id, const char *s, -+ unsigned int offset) -+{ -+ struct krait_mux_clk *mux; -+ const char *p_names[3]; -+ struct clk_init_data init = { -+ .parent_names = p_names, -+ .num_parents = ARRAY_SIZE(p_names), -+ .ops = &krait_mux_clk_ops, -+ .flags = CLK_SET_RATE_PARENT, -+ }; -+ struct clk *clk; -+ -+ mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); -+ if (!mux) -+ return ERR_PTR(-ENOMEM); -+ -+ mux->mask = 0x3; -+ mux->shift = 0; -+ mux->offset = offset; -+ mux->lpl = id >= 0; -+ mux->parent_map = pri_mux_map; -+ mux->hw.init = &init; -+ -+ init.name = kasprintf(GFP_KERNEL, "krait%s_pri_mux", s); -+ if (!init.name) -+ return ERR_PTR(-ENOMEM); -+ -+ p_names[0] = kasprintf(GFP_KERNEL, "hfpll%s", s); -+ if (!p_names[0]) { -+ clk = ERR_PTR(-ENOMEM); -+ goto err_p0; -+ } -+ -+ p_names[1] = kasprintf(GFP_KERNEL, "hfpll%s_div", s); -+ if (!p_names[1]) { -+ clk = ERR_PTR(-ENOMEM); -+ goto err_p1; -+ } -+ -+ p_names[2] = kasprintf(GFP_KERNEL, "krait%s_sec_mux", s); -+ if (!p_names[2]) { -+ clk = ERR_PTR(-ENOMEM); -+ goto err_p2; -+ } -+ -+ clk = devm_clk_register(dev, &mux->hw); -+ -+ kfree(p_names[2]); -+err_p2: -+ kfree(p_names[1]); -+err_p1: -+ kfree(p_names[0]); -+err_p0: -+ kfree(init.name); -+ return clk; -+} -+ -+/* id < 0 for L2, otherwise id == physical CPU number */ -+static struct clk *krait_add_clks(struct device *dev, int id, bool unique_aux) -+{ -+ int ret; -+ unsigned int offset; -+ void *p = NULL; -+ const char *s; -+ struct clk *clk; -+ -+ if (id >= 0) { -+ offset = 0x4501 + (0x1000 * id); -+ s = p = kasprintf(GFP_KERNEL, "%d", id); -+ if (!s) -+ return ERR_PTR(-ENOMEM); -+ } else { -+ offset = 0x500; -+ s = "_l2"; -+ } -+ -+ ret = krait_add_div(dev, id, s, offset); -+ if (ret) { -+ clk = ERR_PTR(ret); -+ goto err; -+ } -+ -+ ret = krait_add_sec_mux(dev, id, s, offset, unique_aux); -+ if (ret) { -+ clk = ERR_PTR(ret); -+ goto err; -+ } -+ -+ clk = krait_add_pri_mux(dev, id, s, offset); -+err: -+ kfree(p); -+ return clk; -+} -+ -+static struct clk *krait_of_get(struct of_phandle_args *clkspec, void *data) -+{ -+ unsigned int idx = clkspec->args[0]; -+ struct clk **clks = data; -+ -+ if (idx >= 5) { -+ pr_err("%s: invalid clock index %d\n", __func__, idx); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ return clks[idx] ? : ERR_PTR(-ENODEV); -+} -+ -+static const struct of_device_id krait_cc_match_table[] = { -+ { .compatible = "qcom,krait-cc-v1", (void *)1UL }, -+ { .compatible = "qcom,krait-cc-v2" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, krait_cc_match_table); -+ -+static int krait_cc_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ const struct of_device_id *id; -+ unsigned long cur_rate, aux_rate; -+ int cpu; -+ struct clk *clk; -+ struct clk **clks; -+ struct clk *l2_pri_mux_clk; -+ -+ id = of_match_device(krait_cc_match_table, dev); -+ if (!id) -+ return -ENODEV; -+ -+ /* Rate is 1 because 0 causes problems for __clk_mux_determine_rate */ -+ clk = clk_register_fixed_rate(dev, "qsb", NULL, 0, 1); -+ if (IS_ERR(clk)) -+ return PTR_ERR(clk); -+ -+ if (!id->data) { -+ clk = clk_register_fixed_factor(dev, "acpu_aux", -+ "gpll0_vote", 0, 1, 2); -+ if (IS_ERR(clk)) -+ return PTR_ERR(clk); -+ } -+ -+ /* Krait configurations have at most 4 CPUs and one L2 */ -+ clks = devm_kcalloc(dev, 5, sizeof(*clks), GFP_KERNEL); -+ if (!clks) -+ return -ENOMEM; -+ -+ for_each_possible_cpu(cpu) { -+ clk = krait_add_clks(dev, cpu, id->data); -+ if (IS_ERR(clk)) -+ return PTR_ERR(clk); -+ clks[cpu] = clk; -+ } -+ -+ l2_pri_mux_clk = krait_add_clks(dev, -1, id->data); -+ if (IS_ERR(l2_pri_mux_clk)) -+ return PTR_ERR(l2_pri_mux_clk); -+ clks[4] = l2_pri_mux_clk; -+ -+ /* -+ * We don't want the CPU or L2 clocks to be turned off at late init -+ * if CPUFREQ or HOTPLUG configs are disabled. So, bump up the -+ * refcount of these clocks. Any cpufreq/hotplug manager can assume -+ * that the clocks have already been prepared and enabled by the time -+ * they take over. -+ */ -+ for_each_online_cpu(cpu) { -+ clk_prepare_enable(l2_pri_mux_clk); -+ WARN(clk_prepare_enable(clks[cpu]), -+ "Unable to turn on CPU%d clock", cpu); -+ } -+ -+ /* -+ * Force reinit of HFPLLs and muxes to overwrite any potential -+ * incorrect configuration of HFPLLs and muxes by the bootloader. -+ * While at it, also make sure the cores are running at known rates -+ * and print the current rate. -+ * -+ * The clocks are set to aux clock rate first to make sure the -+ * secondary mux is not sourcing off of QSB. The rate is then set to -+ * two different rates to force a HFPLL reinit under all -+ * circumstances. -+ */ -+ cur_rate = clk_get_rate(l2_pri_mux_clk); -+ aux_rate = 384000000; -+ if (cur_rate == 1) { -+ pr_info("L2 @ QSB rate. Forcing new rate.\n"); -+ cur_rate = aux_rate; -+ } -+ clk_set_rate(l2_pri_mux_clk, aux_rate); -+ clk_set_rate(l2_pri_mux_clk, 2); -+ clk_set_rate(l2_pri_mux_clk, cur_rate); -+ pr_info("L2 @ %lu KHz\n", clk_get_rate(l2_pri_mux_clk) / 1000); -+ for_each_possible_cpu(cpu) { -+ clk = clks[cpu]; -+ cur_rate = clk_get_rate(clk); -+ if (cur_rate == 1) { -+ pr_info("CPU%d @ QSB rate. Forcing new rate.\n", cpu); -+ cur_rate = aux_rate; -+ } -+ -+ clk_set_rate(clk, aux_rate); -+ clk_set_rate(clk, 2); -+ clk_set_rate(clk, cur_rate); -+ pr_info("CPU%d @ %lu KHz\n", cpu, clk_get_rate(clk) / 1000); -+ } -+ -+ of_clk_add_provider(dev->of_node, krait_of_get, clks); -+ -+ return 0; -+} -+ -+static struct platform_driver krait_cc_driver = { -+ .probe = krait_cc_probe, -+ .driver = { -+ .name = "krait-cc", -+ .of_match_table = krait_cc_match_table, -+ }, -+}; -+module_platform_driver(krait_cc_driver); -+ -+MODULE_DESCRIPTION("Krait CPU Clock Driver"); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:krait-cc"); diff --git a/target/linux/ipq806x/patches-4.9/0044-clk-Add-safe-switch-hook.patch b/target/linux/ipq806x/patches-4.9/0044-clk-Add-safe-switch-hook.patch deleted file mode 100644 index d0eddc64c..000000000 --- a/target/linux/ipq806x/patches-4.9/0044-clk-Add-safe-switch-hook.patch +++ /dev/null @@ -1,160 +0,0 @@ -From patchwork Fri Dec 8 09:42:28 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,10/12] clk: qcom: Add safe switch hook for krait mux clocks -From: Sricharan R -X-Patchwork-Id: 10102057 -Message-Id: <1512726150-7204-11-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:28 +0530 - -When the Hfplls are reprogrammed during the rate change, -the primary muxes which are sourced from the same hfpll -for higher frequencies, needs to be switched to the 'safe -secondary mux' as the parent for that small window. This -is done by registering a clk notifier for the muxes and -switching to the safe parent in the PRE_RATE_CHANGE notifier -and back to the original parent in the POST_RATE_CHANGE notifier. - -Signed-off-by: Sricharan R ---- - drivers/clk/qcom/clk-krait.c | 2 ++ - drivers/clk/qcom/clk-krait.h | 3 +++ - drivers/clk/qcom/krait-cc.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 61 insertions(+) - ---- a/drivers/clk/qcom/clk-krait.c -+++ b/drivers/clk/qcom/clk-krait.c -@@ -60,6 +60,8 @@ static int krait_mux_set_parent(struct c - if (__clk_is_enabled(hw->clk)) - __krait_mux_set_sel(mux, sel); - -+ mux->reparent = true; -+ - return 0; - } - ---- a/drivers/clk/qcom/clk-krait.h -+++ b/drivers/clk/qcom/clk-krait.h -@@ -23,6 +23,9 @@ struct krait_mux_clk { - u32 shift; - u32 en_mask; - bool lpl; -+ u8 safe_sel; -+ u8 old_index; -+ bool reparent; - - struct clk_hw hw; - struct notifier_block clk_nb; ---- a/drivers/clk/qcom/krait-cc.c -+++ b/drivers/clk/qcom/krait-cc.c -@@ -35,6 +35,49 @@ static unsigned int pri_mux_map[] = { - 0, - }; - -+/* -+ * Notifier function for switching the muxes to safe parent -+ * while the hfpll is getting reprogrammed. -+ */ -+static int krait_notifier_cb(struct notifier_block *nb, -+ unsigned long event, -+ void *data) -+{ -+ int ret = 0; -+ struct krait_mux_clk *mux = container_of(nb, struct krait_mux_clk, -+ clk_nb); -+ /* Switch to safe parent */ -+ if (event == PRE_RATE_CHANGE) { -+ mux->old_index = krait_mux_clk_ops.get_parent(&mux->hw); -+ ret = krait_mux_clk_ops.set_parent(&mux->hw, mux->safe_sel); -+ mux->reparent = false; -+ /* -+ * By the time POST_RATE_CHANGE notifier is called, -+ * clk framework itself would have changed the parent for the new rate. -+ * Only otherwise, put back to the old parent. -+ */ -+ } else if (event == POST_RATE_CHANGE) { -+ if (!mux->reparent) -+ ret = krait_mux_clk_ops.set_parent(&mux->hw, -+ mux->old_index); -+ } -+ -+ return notifier_from_errno(ret); -+} -+ -+static int krait_notifier_register(struct device *dev, struct clk *clk, -+ struct krait_mux_clk *mux) -+{ -+ int ret = 0; -+ -+ mux->clk_nb.notifier_call = krait_notifier_cb; -+ ret = clk_notifier_register(clk, &mux->clk_nb); -+ if (ret) -+ dev_err(dev, "failed to register clock notifier: %d\n", ret); -+ -+ return ret; -+} -+ - static int - krait_add_div(struct device *dev, int id, const char *s, unsigned int offset) - { -@@ -79,6 +122,7 @@ static int - krait_add_sec_mux(struct device *dev, int id, const char *s, - unsigned int offset, bool unique_aux) - { -+ int ret; - struct krait_mux_clk *mux; - static const char *sec_mux_list[] = { - "acpu_aux", -@@ -102,6 +146,7 @@ krait_add_sec_mux(struct device *dev, in - mux->shift = 2; - mux->parent_map = sec_mux_map; - mux->hw.init = &init; -+ mux->safe_sel = 0; - - init.name = kasprintf(GFP_KERNEL, "krait%s_sec_mux", s); - if (!init.name) -@@ -117,6 +162,11 @@ krait_add_sec_mux(struct device *dev, in - - clk = devm_clk_register(dev, &mux->hw); - -+ ret = krait_notifier_register(dev, clk, mux); -+ if (ret) -+ goto unique_aux; -+ -+unique_aux: - if (unique_aux) - kfree(sec_mux_list[0]); - err_aux: -@@ -128,6 +178,7 @@ static struct clk * - krait_add_pri_mux(struct device *dev, int id, const char *s, - unsigned int offset) - { -+ int ret; - struct krait_mux_clk *mux; - const char *p_names[3]; - struct clk_init_data init = { -@@ -148,6 +199,7 @@ krait_add_pri_mux(struct device *dev, in - mux->lpl = id >= 0; - mux->parent_map = pri_mux_map; - mux->hw.init = &init; -+ mux->safe_sel = 2; - - init.name = kasprintf(GFP_KERNEL, "krait%s_pri_mux", s); - if (!init.name) -@@ -173,6 +225,10 @@ krait_add_pri_mux(struct device *dev, in - - clk = devm_clk_register(dev, &mux->hw); - -+ ret = krait_notifier_register(dev, clk, mux); -+ if (ret) -+ goto err_p3; -+err_p3: - kfree(p_names[2]); - err_p2: - kfree(p_names[1]); diff --git a/target/linux/ipq806x/patches-4.9/0045-cpufreq-Add-module-to-register-cpufreq-on-Krait-CPUs.patch b/target/linux/ipq806x/patches-4.9/0045-cpufreq-Add-module-to-register-cpufreq-on-Krait-CPUs.patch deleted file mode 100644 index 820d13f3c..000000000 --- a/target/linux/ipq806x/patches-4.9/0045-cpufreq-Add-module-to-register-cpufreq-on-Krait-CPUs.patch +++ /dev/null @@ -1,307 +0,0 @@ -From patchwork Fri Dec 8 09:42:29 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,11/12] cpufreq: Add module to register cpufreq on Krait CPUs -From: Sricharan R -X-Patchwork-Id: 10102075 -Message-Id: <1512726150-7204-12-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:29 +0530 - -From: Stephen Boyd - -Register a cpufreq-generic device whenever we detect that a -"qcom,krait" compatible CPU is present in DT. - -Cc: -Signed-off-by: Stephen Boyd ---- - .../devicetree/bindings/arm/msm/qcom,pvs.txt | 38 ++++ - drivers/cpufreq/Kconfig.arm | 9 + - drivers/cpufreq/Makefile | 1 + - drivers/cpufreq/qcom-cpufreq.c | 204 +++++++++++++++++++++ - 4 files changed, 252 insertions(+) - create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,pvs.txt - create mode 100644 drivers/cpufreq/qcom-cpufreq.c - ---- /dev/null -+++ b/Documentation/devicetree/bindings/arm/msm/qcom,pvs.txt -@@ -0,0 +1,38 @@ -+Qualcomm Process Voltage Scaling Tables -+ -+The node name is required to be "qcom,pvs". There shall only be one -+such node present in the root of the tree. -+ -+PROPERTIES -+ -+- qcom,pvs-format-a or qcom,pvs-format-b: -+ Usage: required -+ Value type: -+ Definition: Indicates the format of qcom,speedX-pvsY-bin-vZ properties. -+ If qcom,pvs-format-a is used the table is two columns -+ (frequency and voltage in that order). If qcom,pvs-format-b is used the table is three columns (frequency, voltage, -+ and current in that order). -+ -+- qcom,speedX-pvsY-bin-vZ: -+ Usage: required -+ Value type: -+ Definition: The PVS table corresponding to the speed bin X, pvs bin Y, -+ and version Z. -+Example: -+ -+ qcom,pvs { -+ qcom,pvs-format-a; -+ qcom,speed0-pvs0-bin-v0 = -+ < 384000000 950000 >, -+ < 486000000 975000 >, -+ < 594000000 1000000 >, -+ < 702000000 1025000 >, -+ < 810000000 1075000 >, -+ < 918000000 1100000 >, -+ < 1026000000 1125000 >, -+ < 1134000000 1175000 >, -+ < 1242000000 1200000 >, -+ < 1350000000 1225000 >, -+ < 1458000000 1237500 >, -+ < 1512000000 1250000 >; -+ }; ---- a/drivers/cpufreq/Kconfig.arm -+++ b/drivers/cpufreq/Kconfig.arm -@@ -88,6 +88,15 @@ config ARM_OMAP2PLUS_CPUFREQ - depends on ARCH_OMAP2PLUS - default ARCH_OMAP2PLUS - -+config ARM_QCOM_CPUFREQ -+ tristate "Qualcomm based" -+ depends on ARCH_QCOM -+ select PM_OPP -+ help -+ This adds the CPUFreq driver for Qualcomm SoC based boards. -+ -+ If in doubt, say N. -+ - config ARM_S3C_CPUFREQ - bool - help ---- a/drivers/cpufreq/Makefile -+++ b/drivers/cpufreq/Makefile -@@ -62,6 +62,7 @@ obj-$(CONFIG_ARM_MT8173_CPUFREQ) += mt81 - obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ) += omap-cpufreq.o - obj-$(CONFIG_ARM_PXA2xx_CPUFREQ) += pxa2xx-cpufreq.o - obj-$(CONFIG_PXA3xx) += pxa3xx-cpufreq.o -+obj-$(CONFIG_ARM_QCOM_CPUFREQ) += qcom-cpufreq.o - obj-$(CONFIG_ARM_S3C24XX_CPUFREQ) += s3c24xx-cpufreq.o - obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o - obj-$(CONFIG_ARM_S3C2410_CPUFREQ) += s3c2410-cpufreq.o ---- /dev/null -+++ b/drivers/cpufreq/qcom-cpufreq.c -@@ -0,0 +1,204 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "cpufreq-dt.h" -+ -+static void __init get_krait_bin_format_a(int *speed, int *pvs, int *pvs_ver) -+{ -+ void __iomem *base; -+ u32 pte_efuse; -+ -+ *speed = *pvs = *pvs_ver = 0; -+ -+ base = ioremap(0x007000c0, 4); -+ if (!base) { -+ pr_warn("Unable to read efuse data. Defaulting to 0!\n"); -+ return; -+ } -+ -+ pte_efuse = readl_relaxed(base); -+ iounmap(base); -+ -+ *speed = pte_efuse & 0xf; -+ if (*speed == 0xf) -+ *speed = (pte_efuse >> 4) & 0xf; -+ -+ if (*speed == 0xf) { -+ *speed = 0; -+ pr_warn("Speed bin: Defaulting to %d\n", *speed); -+ } else { -+ pr_info("Speed bin: %d\n", *speed); -+ } -+ -+ *pvs = (pte_efuse >> 10) & 0x7; -+ if (*pvs == 0x7) -+ *pvs = (pte_efuse >> 13) & 0x7; -+ -+ if (*pvs == 0x7) { -+ *pvs = 0; -+ pr_warn("PVS bin: Defaulting to %d\n", *pvs); -+ } else { -+ pr_info("PVS bin: %d\n", *pvs); -+ } -+} -+ -+static void __init get_krait_bin_format_b(int *speed, int *pvs, int *pvs_ver) -+{ -+ u32 pte_efuse, redundant_sel; -+ void __iomem *base; -+ -+ *speed = 0; -+ *pvs = 0; -+ *pvs_ver = 0; -+ -+ base = ioremap(0xfc4b80b0, 8); -+ if (!base) { -+ pr_warn("Unable to read efuse data. Defaulting to 0!\n"); -+ return; -+ } -+ -+ pte_efuse = readl_relaxed(base); -+ redundant_sel = (pte_efuse >> 24) & 0x7; -+ *speed = pte_efuse & 0x7; -+ /* 4 bits of PVS are in efuse register bits 31, 8-6. */ -+ *pvs = ((pte_efuse >> 28) & 0x8) | ((pte_efuse >> 6) & 0x7); -+ *pvs_ver = (pte_efuse >> 4) & 0x3; -+ -+ switch (redundant_sel) { -+ case 1: -+ *speed = (pte_efuse >> 27) & 0xf; -+ break; -+ case 2: -+ *pvs = (pte_efuse >> 27) & 0xf; -+ break; -+ } -+ -+ /* Check SPEED_BIN_BLOW_STATUS */ -+ if (pte_efuse & BIT(3)) { -+ pr_info("Speed bin: %d\n", *speed); -+ } else { -+ pr_warn("Speed bin not set. Defaulting to 0!\n"); -+ *speed = 0; -+ } -+ -+ /* Check PVS_BLOW_STATUS */ -+ pte_efuse = readl_relaxed(base + 0x4) & BIT(21); -+ if (pte_efuse) { -+ pr_info("PVS bin: %d\n", *pvs); -+ } else { -+ pr_warn("PVS bin not set. Defaulting to 0!\n"); -+ *pvs = 0; -+ } -+ -+ pr_info("PVS version: %d\n", *pvs_ver); -+ iounmap(base); -+} -+ -+static int __init qcom_cpufreq_populate_opps(void) -+{ -+ int len, rows, cols, i, k, speed, pvs, pvs_ver; -+ char table_name[] = "qcom,speedXX-pvsXX-bin-vXX"; -+ struct device_node *np; -+ struct device *dev; -+ int cpu = 0; -+ -+ np = of_find_node_by_name(NULL, "qcom,pvs"); -+ if (!np) -+ return -ENODEV; -+ -+ if (of_property_read_bool(np, "qcom,pvs-format-a")) { -+ get_krait_bin_format_a(&speed, &pvs, &pvs_ver); -+ cols = 2; -+ } else if (of_property_read_bool(np, "qcom,pvs-format-b")) { -+ get_krait_bin_format_b(&speed, &pvs, &pvs_ver); -+ cols = 3; -+ } else { -+ return -ENODEV; -+ } -+ -+ snprintf(table_name, sizeof(table_name), -+ "qcom,speed%d-pvs%d-bin-v%d", speed, pvs, pvs_ver); -+ -+ if (!of_find_property(np, table_name, &len)) -+ return -EINVAL; -+ -+ len /= sizeof(u32); -+ if (len % cols || len == 0) -+ return -EINVAL; -+ -+ rows = len / cols; -+ -+ for (i = 0, k = 0; i < rows; i++) { -+ u32 freq, volt; -+ -+ of_property_read_u32_index(np, table_name, k++, &freq); -+ of_property_read_u32_index(np, table_name, k++, &volt); -+ while (k % cols) -+ k++; /* Skip uA entries if present */ -+ for (cpu = 0; cpu < num_possible_cpus(); cpu++) { -+ dev = get_cpu_device(cpu); -+ if (!dev) -+ return -ENODEV; -+ if (dev_pm_opp_add(dev, freq, volt)) -+ pr_warn("failed to add OPP %u\n", freq); -+ } -+ } -+ -+ return 0; -+} -+ -+static int __init qcom_cpufreq_driver_init(void) -+{ -+ struct cpufreq_dt_platform_data pdata = { .independent_clocks = true }; -+ struct platform_device_info devinfo = { -+ .name = "cpufreq-dt", -+ .data = &pdata, -+ .size_data = sizeof(pdata), -+ }; -+ struct device *cpu_dev; -+ struct device_node *np; -+ int ret; -+ -+ cpu_dev = get_cpu_device(0); -+ if (!cpu_dev) -+ return -ENODEV; -+ -+ np = of_node_get(cpu_dev->of_node); -+ if (!np) -+ return -ENOENT; -+ -+ if (!of_device_is_compatible(np, "qcom,krait")) { -+ of_node_put(np); -+ return -ENODEV; -+ } -+ of_node_put(np); -+ -+ ret = qcom_cpufreq_populate_opps(); -+ if (ret) -+ return ret; -+ -+ return PTR_ERR_OR_ZERO(platform_device_register_full(&devinfo)); -+} -+module_init(qcom_cpufreq_driver_init); -+ -+MODULE_DESCRIPTION("Qualcomm CPUfreq driver"); -+MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-independent-core-clocks.patch b/target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-independent-core-clocks.patch deleted file mode 100644 index d767dbf5f..000000000 --- a/target/linux/ipq806x/patches-4.9/0046-cpufreq-qcom-independent-core-clocks.patch +++ /dev/null @@ -1,66 +0,0 @@ -From patchwork Fri Dec 8 09:42:30 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v4,12/12] cpufreq: dt: Reintroduce independent_clocks platform data -From: Sricharan R -X-Patchwork-Id: 10102073 -Message-Id: <1512726150-7204-13-git-send-email-sricharan@codeaurora.org> -To: mturquette@baylibre.com, sboyd@codeaurora.org, - devicetree@vger.kernel.org, linux-pm@vger.kernel.org, - linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, - viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org -Cc: sricharan@codeaurora.org -Date: Fri, 8 Dec 2017 15:12:30 +0530 - -The Platform data was removed earlier by, -'commit eb96924acddc ("cpufreq: dt: Kill platform-data")' -since there were no users at that time. -Now this is required when the each of the cpu clocks -can be scaled independently, which is the case -for krait cores. So reintroduce it. - -Signed-off-by: Sricharan R ---- - drivers/cpufreq/cpufreq-dt.c | 7 ++++++- - drivers/cpufreq/cpufreq-dt.h | 6 ++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - ---- a/drivers/cpufreq/cpufreq-dt.c -+++ b/drivers/cpufreq/cpufreq-dt.c -@@ -221,7 +221,10 @@ static int cpufreq_init(struct cpufreq_p - } - - if (fallback) { -- cpumask_setall(policy->cpus); -+ struct cpufreq_dt_platform_data *pd = cpufreq_get_driver_data(); -+ -+ if (!pd || !pd->independent_clocks) -+ cpumask_setall(policy->cpus); - - /* - * OPP tables are initialized only for policy->cpu, do it for -@@ -376,6 +379,8 @@ static int dt_cpufreq_probe(struct platf - if (data && data->have_governor_per_policy) - dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY; - -+ dt_cpufreq_driver.driver_data = data; -+ - ret = cpufreq_register_driver(&dt_cpufreq_driver); - if (ret) - dev_err(&pdev->dev, "failed register driver: %d\n", ret); ---- a/drivers/cpufreq/cpufreq-dt.h -+++ b/drivers/cpufreq/cpufreq-dt.h -@@ -13,6 +13,12 @@ - #include - - struct cpufreq_dt_platform_data { -+ /* -+ * True when each CPU has its own clock to control its -+ * frequency, false when all CPUs are controlled by a single -+ * clock. -+ */ -+ bool independent_clocks; - bool have_governor_per_policy; - }; - diff --git a/target/linux/ipq806x/patches-4.9/0047-mtd-nand-Create-a-BBT-flag-to-access-bad-block-marke.patch b/target/linux/ipq806x/patches-4.9/0047-mtd-nand-Create-a-BBT-flag-to-access-bad-block-marke.patch deleted file mode 100644 index be4a210f0..000000000 --- a/target/linux/ipq806x/patches-4.9/0047-mtd-nand-Create-a-BBT-flag-to-access-bad-block-marke.patch +++ /dev/null @@ -1,72 +0,0 @@ -From c7c6a0f50f9ac3620c611ce06ba1f9fafea0444e Mon Sep 17 00:00:00 2001 -From: Archit Taneja -Date: Mon, 3 Aug 2015 10:38:14 +0530 -Subject: [PATCH 47/69] mtd: nand: Create a BBT flag to access bad block - markers in raw mode - -Some controllers can access the factory bad block marker from OOB only -when they read it in raw mode. When ECC is enabled, these controllers -discard reading/writing bad block markers, preventing access to them -altogether. - -The bbt driver assumes MTD_OPS_PLACE_OOB when scanning for bad blocks. -This results in the nand driver's ecc->read_oob() op to be called, which -works with ECC enabled. - -Create a new BBT option flag that tells nand_bbt to force the mode to -MTD_OPS_RAW. This would result in the correct op being called for the -underlying nand controller driver. - -Reviewed-by: Andy Gross -Signed-off-by: Archit Taneja ---- - drivers/mtd/nand/nand_base.c | 6 +++++- - drivers/mtd/nand/nand_bbt.c | 6 +++++- - include/linux/mtd/bbm.h | 6 ++++++ - 3 files changed, 16 insertions(+), 2 deletions(-) - ---- a/drivers/mtd/nand/nand_base.c -+++ b/drivers/mtd/nand/nand_base.c -@@ -488,7 +488,11 @@ static int nand_default_block_markbad(st - } else { - ops.len = ops.ooblen = 1; - } -- ops.mode = MTD_OPS_PLACE_OOB; -+ -+ if (unlikely(chip->bbt_options & NAND_BBT_ACCESS_BBM_RAW)) -+ ops.mode = MTD_OPS_RAW; -+ else -+ ops.mode = MTD_OPS_PLACE_OOB; - - /* Write to first/last page(s) if necessary */ - if (chip->bbt_options & NAND_BBT_SCANLASTPAGE) ---- a/drivers/mtd/nand/nand_bbt.c -+++ b/drivers/mtd/nand/nand_bbt.c -@@ -420,7 +420,11 @@ static int scan_block_fast(struct mtd_in - ops.oobbuf = buf; - ops.ooboffs = 0; - ops.datbuf = NULL; -- ops.mode = MTD_OPS_PLACE_OOB; -+ -+ if (unlikely(bd->options & NAND_BBT_ACCESS_BBM_RAW)) -+ ops.mode = MTD_OPS_RAW; -+ else -+ ops.mode = MTD_OPS_PLACE_OOB; - - for (j = 0; j < numpages; j++) { - /* ---- a/include/linux/mtd/bbm.h -+++ b/include/linux/mtd/bbm.h -@@ -116,6 +116,12 @@ struct nand_bbt_descr { - #define NAND_BBT_NO_OOB_BBM 0x00080000 - - /* -+ * Force MTD_OPS_RAW mode when trying to access bad block markes from OOB. To -+ * be used by controllers which can access BBM only when ECC is disabled, i.e, -+ * when in RAW access mode -+ */ -+#define NAND_BBT_ACCESS_BBM_RAW 0x00100000 -+/* - * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr - * was allocated dynamicaly and must be freed in nand_release(). Has no meaning - * in nand_chip.bbt_options. diff --git a/target/linux/ipq806x/patches-4.9/0048-PM-OPP-HACK-Allow-to-set-regulator-without-opp_list.patch b/target/linux/ipq806x/patches-4.9/0048-PM-OPP-HACK-Allow-to-set-regulator-without-opp_list.patch deleted file mode 100644 index da9c0dbef..000000000 --- a/target/linux/ipq806x/patches-4.9/0048-PM-OPP-HACK-Allow-to-set-regulator-without-opp_list.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 5c294df1715d673f94f3b0a6e1ea3a426ca35e6e Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Thu, 28 Apr 2016 16:20:12 +0300 -Subject: [PATCH 48/69] PM / OPP: HACK: Allow to set regulator without opp_list - -Signed-off-by: Georgi Djakov ---- - drivers/base/power/opp/core.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/base/power/opp/core.c -+++ b/drivers/base/power/opp/core.c -@@ -1339,12 +1339,13 @@ struct opp_table *dev_pm_opp_set_regulat - ret = -ENOMEM; - goto unlock; - } -- -+#if 0 - /* This should be called before OPPs are initialized */ - if (WARN_ON(!list_empty(&opp_table->opp_list))) { - ret = -EBUSY; - goto err; - } -+#endif - - /* Already have a regulator set */ - if (WARN_ON(!IS_ERR(opp_table->regulator))) { diff --git a/target/linux/ipq806x/patches-4.9/0049-PM-OPP-Support-adjusting-OPP-voltages-at-runtime.patch b/target/linux/ipq806x/patches-4.9/0049-PM-OPP-Support-adjusting-OPP-voltages-at-runtime.patch deleted file mode 100644 index e2a4eede8..000000000 --- a/target/linux/ipq806x/patches-4.9/0049-PM-OPP-Support-adjusting-OPP-voltages-at-runtime.patch +++ /dev/null @@ -1,147 +0,0 @@ -From c949f08cf20fe82971fbdb4015daa38210da492e Mon Sep 17 00:00:00 2001 -From: Stephen Boyd -Date: Fri, 18 Sep 2015 17:52:06 -0700 -Subject: [PATCH 49/69] PM / OPP: Support adjusting OPP voltages at runtime - -On some SoCs the Adaptive Voltage Scaling (AVS) technique is -employed to optimize the operating voltage of a device. At a -given frequency, the hardware monitors dynamic factors and either -makes a suggestion for how much to adjust a voltage for the -current frequency, or it automatically adjusts the voltage -without software intervention. Add an API to the OPP library for -the former case, so that AVS type devices can update the voltages -for an OPP when the hardware determines the voltage should -change. The assumption is that drivers like CPUfreq or devfreq -will register for the OPP notifiers and adjust the voltage -according to suggestions that AVS makes. - -Cc: Nishanth Menon -Acked-by: Viresh Kumar -Signed-off-by: Stephen Boyd -Acked-by: Viresh Kumar -Signed-off-by: Georgi Djakov ---- - drivers/base/power/opp/core.c | 77 +++++++++++++++++++++++++++++++++++++++++++ - include/linux/pm_opp.h | 11 +++++++ - 2 files changed, 88 insertions(+) - ---- a/drivers/base/power/opp/core.c -+++ b/drivers/base/power/opp/core.c -@@ -1521,6 +1521,83 @@ unlock: - } - - /** -+ * dev_pm_opp_adjust_voltage() - helper to change the voltage of an OPP -+ * @dev: device for which we do this operation -+ * @freq: OPP frequency to adjust voltage of -+ * @u_volt: new OPP voltage -+ * -+ * Change the voltage of an OPP with an RCU operation. -+ * -+ * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the -+ * copy operation, returns 0 if no modifcation was done OR modification was -+ * successful. -+ * -+ * Locking: The internal device_opp and opp structures are RCU protected. -+ * Hence this function internally uses RCU updater strategy with mutex locks to -+ * keep the integrity of the internal data structures. Callers should ensure -+ * that this function is *NOT* called under RCU protection or in contexts where -+ * mutex locking or synchronize_rcu() blocking calls cannot be used. -+ */ -+int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq, -+ unsigned long u_volt) -+{ -+ struct opp_table *opp_table; -+ struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV); -+ int r = 0; -+ -+ /* keep the node allocated */ -+ new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL); -+ if (!new_opp) -+ return -ENOMEM; -+ -+ mutex_lock(&opp_table_lock); -+ -+ /* Find the opp_table */ -+ opp_table = _find_opp_table(dev); -+ if (IS_ERR(opp_table)) { -+ r = PTR_ERR(opp_table); -+ dev_warn(dev, "%s: Device OPP not found (%d)\n", __func__, r); -+ goto unlock; -+ } -+ -+ /* Do we have the frequency? */ -+ list_for_each_entry(tmp_opp, &opp_table->opp_list, node) { -+ if (tmp_opp->rate == freq) { -+ opp = tmp_opp; -+ break; -+ } -+ } -+ if (IS_ERR(opp)) { -+ r = PTR_ERR(opp); -+ goto unlock; -+ } -+ -+ /* Is update really needed? */ -+ if (opp->u_volt == u_volt) -+ goto unlock; -+ /* copy the old data over */ -+ *new_opp = *opp; -+ -+ /* plug in new node */ -+ new_opp->u_volt = u_volt; -+ -+ list_replace_rcu(&opp->node, &new_opp->node); -+ mutex_unlock(&opp_table_lock); -+ call_srcu(&opp_table->srcu_head.srcu, &opp->rcu_head, _kfree_opp_rcu); -+ -+ /* Notify the change of the OPP */ -+ srcu_notifier_call_chain(&opp_table->srcu_head, OPP_EVENT_ADJUST_VOLTAGE, -+ new_opp); -+ -+ return 0; -+ -+unlock: -+ mutex_unlock(&opp_table_lock); -+ kfree(new_opp); -+ return r; -+} -+ -+/** - * dev_pm_opp_enable() - Enable a specific OPP - * @dev: device for which we do this operation - * @freq: OPP frequency to enable ---- a/include/linux/pm_opp.h -+++ b/include/linux/pm_opp.h -@@ -23,6 +23,7 @@ struct opp_table; - - enum dev_pm_opp_event { - OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, -+ OPP_EVENT_ADJUST_VOLTAGE, - }; - - #if defined(CONFIG_PM_OPP) -@@ -53,6 +54,9 @@ int dev_pm_opp_add(struct device *dev, u - unsigned long u_volt); - void dev_pm_opp_remove(struct device *dev, unsigned long freq); - -+int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq, -+ unsigned long u_volt); -+ - int dev_pm_opp_enable(struct device *dev, unsigned long freq); - - int dev_pm_opp_disable(struct device *dev, unsigned long freq); -@@ -139,6 +143,13 @@ static inline void dev_pm_opp_remove(str - { - } - -+static inline int -+dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq, -+ unsigned long u_volt) -+{ -+ return 0; -+} -+ - static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) - { - return 0; diff --git a/target/linux/ipq806x/patches-4.9/0050-OPP-Allow-notifiers-to-call-dev_pm_opp_get_-voltage-.patch b/target/linux/ipq806x/patches-4.9/0050-OPP-Allow-notifiers-to-call-dev_pm_opp_get_-voltage-.patch deleted file mode 100644 index 7b41157fd..000000000 --- a/target/linux/ipq806x/patches-4.9/0050-OPP-Allow-notifiers-to-call-dev_pm_opp_get_-voltage-.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 4a17bbfcf72c94b37079e39a7c1e1e8653f7fe92 Mon Sep 17 00:00:00 2001 -From: Stephen Boyd -Date: Fri, 18 Sep 2015 17:52:07 -0700 -Subject: [PATCH 50/69] OPP: Allow notifiers to call dev_pm_opp_get_{voltage, - freq} RCU-free - -We pass the dev_pm_opp structure to OPP notifiers but the users -of the notifier need to surround calls to dev_pm_opp_get_*() with -RCU read locks to avoid lockdep warnings. The notifier is already -called with the dev_opp's srcu lock held, so it should be safe to -assume the devm_pm_opp structure is already protected inside the -notifier. Update the lockdep check for this. - -Cc: Krzysztof Kozlowski -Signed-off-by: Stephen Boyd -Acked-by: Viresh Kumar -Signed-off-by: Georgi Djakov ---- - drivers/base/power/opp/core.c | 19 ++++++++++--------- - 1 file changed, 10 insertions(+), 9 deletions(-) - ---- a/drivers/base/power/opp/core.c -+++ b/drivers/base/power/opp/core.c -@@ -32,9 +32,10 @@ LIST_HEAD(opp_tables); - /* Lock to allow exclusive modification to the device and opp lists */ - DEFINE_MUTEX(opp_table_lock); - --#define opp_rcu_lockdep_assert() \ -+#define opp_rcu_lockdep_assert(s) \ - do { \ - RCU_LOCKDEP_WARN(!rcu_read_lock_held() && \ -+ !(s && srcu_read_lock_held(s)) && \ - !lockdep_is_held(&opp_table_lock), \ - "Missing rcu_read_lock() or " \ - "opp_table_lock protection"); \ -@@ -72,7 +73,7 @@ struct opp_table *_find_opp_table(struct - { - struct opp_table *opp_table; - -- opp_rcu_lockdep_assert(); -+ opp_rcu_lockdep_assert(NULL); - - if (IS_ERR_OR_NULL(dev)) { - pr_err("%s: Invalid parameters\n", __func__); -@@ -106,7 +107,7 @@ unsigned long dev_pm_opp_get_voltage(str - struct dev_pm_opp *tmp_opp; - unsigned long v = 0; - -- opp_rcu_lockdep_assert(); -+ opp_rcu_lockdep_assert(NULL); - - tmp_opp = rcu_dereference(opp); - if (IS_ERR_OR_NULL(tmp_opp)) -@@ -138,7 +139,7 @@ unsigned long dev_pm_opp_get_freq(struct - struct dev_pm_opp *tmp_opp; - unsigned long f = 0; - -- opp_rcu_lockdep_assert(); -+ opp_rcu_lockdep_assert(NULL); - - tmp_opp = rcu_dereference(opp); - if (IS_ERR_OR_NULL(tmp_opp) || !tmp_opp->available) -@@ -172,7 +173,7 @@ bool dev_pm_opp_is_turbo(struct dev_pm_o - { - struct dev_pm_opp *tmp_opp; - -- opp_rcu_lockdep_assert(); -+ opp_rcu_lockdep_assert(NULL); - - tmp_opp = rcu_dereference(opp); - if (IS_ERR_OR_NULL(tmp_opp) || !tmp_opp->available) { -@@ -300,7 +301,7 @@ struct dev_pm_opp *dev_pm_opp_get_suspen - { - struct opp_table *opp_table; - -- opp_rcu_lockdep_assert(); -+ opp_rcu_lockdep_assert(NULL); - - opp_table = _find_opp_table(dev); - if (IS_ERR(opp_table) || !opp_table->suspend_opp || -@@ -380,7 +381,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ - struct opp_table *opp_table; - struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE); - -- opp_rcu_lockdep_assert(); -+ opp_rcu_lockdep_assert(NULL); - - opp_table = _find_opp_table(dev); - if (IS_ERR(opp_table)) { -@@ -444,7 +445,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ - { - struct opp_table *opp_table; - -- opp_rcu_lockdep_assert(); -+ opp_rcu_lockdep_assert(NULL); - - if (!dev || !freq) { - dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq); -@@ -486,7 +487,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ - struct opp_table *opp_table; - struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE); - -- opp_rcu_lockdep_assert(); -+ opp_rcu_lockdep_assert(NULL); - - if (!dev || !freq) { - dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq); diff --git a/target/linux/ipq806x/patches-4.9/0051-PM-OPP-Add-a-helper-to-get-an-opp-regulator-for-devi.patch b/target/linux/ipq806x/patches-4.9/0051-PM-OPP-Add-a-helper-to-get-an-opp-regulator-for-devi.patch deleted file mode 100644 index fc1a36efc..000000000 --- a/target/linux/ipq806x/patches-4.9/0051-PM-OPP-Add-a-helper-to-get-an-opp-regulator-for-devi.patch +++ /dev/null @@ -1,52 +0,0 @@ -From d06ca5e7a3cf726f5be5ffd96e93ccd798b8c09a Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Thu, 12 May 2016 14:41:33 +0300 -Subject: [PATCH 51/69] PM / OPP: Add a helper to get an opp regulator for - device - -Signed-off-by: Georgi Djakov ---- - drivers/base/power/opp/core.c | 21 +++++++++++++++++++++ - include/linux/pm_opp.h | 1 + - 2 files changed, 22 insertions(+) - ---- a/drivers/base/power/opp/core.c -+++ b/drivers/base/power/opp/core.c -@@ -151,6 +151,27 @@ unsigned long dev_pm_opp_get_freq(struct - } - EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq); - -+struct regulator *dev_pm_opp_get_regulator(struct device *dev) -+{ -+ struct opp_table *opp_table; -+ struct regulator *reg; -+ -+ rcu_read_lock(); -+ -+ opp_table = _find_opp_table(dev); -+ if (IS_ERR(opp_table)) { -+ rcu_read_unlock(); -+ return ERR_CAST(opp_table); -+ } -+ -+ reg = opp_table->regulator; -+ -+ rcu_read_unlock(); -+ -+ return reg; -+} -+EXPORT_SYMBOL_GPL(dev_pm_opp_get_regulator); -+ - /** - * dev_pm_opp_is_turbo() - Returns if opp is turbo OPP or not - * @opp: opp for which turbo mode is being verified ---- a/include/linux/pm_opp.h -+++ b/include/linux/pm_opp.h -@@ -31,6 +31,7 @@ enum dev_pm_opp_event { - unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp); - - unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp); -+struct regulator *dev_pm_opp_get_regulator(struct device *dev); - - bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp); - diff --git a/target/linux/ipq806x/patches-4.9/0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t.patch b/target/linux/ipq806x/patches-4.9/0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t.patch deleted file mode 100644 index 9065911d5..000000000 --- a/target/linux/ipq806x/patches-4.9/0052-PM-OPP-Update-the-voltage-tolerance-when-adjusting-t.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 4533c285c2aedce6d4434d7b877066de3b1ecb33 Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Thu, 25 Aug 2016 18:43:35 +0300 -Subject: [PATCH 52/69] PM / OPP: Update the voltage tolerance when adjusting - the OPP - -When the voltage is adjusted, the voltage tolerance is not updated. -This can lead to situations where the voltage min value is greater -than the voltage max value. The final result is triggering a BUG() -in the regulator core. -Fix this by updating the voltage tolerance values too. - -Signed-off-by: Georgi Djakov ---- - drivers/base/power/opp/core.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/base/power/opp/core.c -+++ b/drivers/base/power/opp/core.c -@@ -1566,6 +1566,7 @@ int dev_pm_opp_adjust_voltage(struct dev - struct opp_table *opp_table; - struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV); - int r = 0; -+ unsigned long tol; - - /* keep the node allocated */ - new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL); -@@ -1602,6 +1603,10 @@ int dev_pm_opp_adjust_voltage(struct dev - - /* plug in new node */ - new_opp->u_volt = u_volt; -+ tol = u_volt * opp_table->voltage_tolerance_v1 / 100; -+ new_opp->u_volt = u_volt; -+ new_opp->u_volt_min = u_volt - tol; -+ new_opp->u_volt_max = u_volt + tol; - - list_replace_rcu(&opp->node, &new_opp->node); - mutex_unlock(&opp_table_lock); diff --git a/target/linux/ipq806x/patches-4.9/0053-regulator-add-smb208-support.patch b/target/linux/ipq806x/patches-4.9/0053-regulator-add-smb208-support.patch deleted file mode 100644 index 0d2862c60..000000000 --- a/target/linux/ipq806x/patches-4.9/0053-regulator-add-smb208-support.patch +++ /dev/null @@ -1,55 +0,0 @@ -From ef10381ca4d01848ebedb4afb2c78feb8052f103 Mon Sep 17 00:00:00 2001 -From: Adrian Panella -Date: Thu, 9 Mar 2017 08:26:54 +0100 -Subject: [PATCH 53/69] regulator: add smb208 support - -Signed-off-by: Adrian Panella ---- - Documentation/devicetree/bindings/mfd/qcom-rpm.txt | 4 ++++ - drivers/regulator/qcom_rpm-regulator.c | 9 +++++++++ - 2 files changed, 13 insertions(+) - ---- a/Documentation/devicetree/bindings/mfd/qcom-rpm.txt -+++ b/Documentation/devicetree/bindings/mfd/qcom-rpm.txt -@@ -61,6 +61,7 @@ Regulator nodes are identified by their - "qcom,rpm-pm8901-regulators" - "qcom,rpm-pm8921-regulators" - "qcom,rpm-pm8018-regulators" -+ "qcom,rpm-smb208-regulators" - - - vdd_l0_l1_lvs-supply: - - vdd_l2_l11_l12-supply: -@@ -171,6 +172,9 @@ pm8018: - s1, s2, s3, s4, s5, , l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, - l12, l14, lvs1 - -+smb208: -+ s1a, s1b, s2a, s2b -+ - The content of each sub-node is defined by the standard binding for regulators - - see regulator.txt - with additional custom properties described below: - ---- a/drivers/regulator/qcom_rpm-regulator.c -+++ b/drivers/regulator/qcom_rpm-regulator.c -@@ -933,12 +933,21 @@ static const struct rpm_regulator_data r - { } - }; - -+static const struct rpm_regulator_data rpm_smb208_regulators[] = { -+ { "s1a", QCOM_RPM_SMB208_S1a, &smb208_smps, "vin_s1a" }, -+ { "s1b", QCOM_RPM_SMB208_S1b, &smb208_smps, "vin_s1b" }, -+ { "s2a", QCOM_RPM_SMB208_S2a, &smb208_smps, "vin_s2a" }, -+ { "s2b", QCOM_RPM_SMB208_S2b, &smb208_smps, "vin_s2b" }, -+ { } -+}; -+ - static const struct of_device_id rpm_of_match[] = { - { .compatible = "qcom,rpm-pm8018-regulators", - .data = &rpm_pm8018_regulators }, - { .compatible = "qcom,rpm-pm8058-regulators", .data = &rpm_pm8058_regulators }, - { .compatible = "qcom,rpm-pm8901-regulators", .data = &rpm_pm8901_regulators }, - { .compatible = "qcom,rpm-pm8921-regulators", .data = &rpm_pm8921_regulators }, -+ { .compatible = "qcom,rpm-smb208-regulators", .data = &rpm_smb208_regulators }, - { } - }; - MODULE_DEVICE_TABLE(of, rpm_of_match); diff --git a/target/linux/ipq806x/patches-4.9/0054-cpufreq-dt-Handle-OPP-voltage-adjust-events.patch b/target/linux/ipq806x/patches-4.9/0054-cpufreq-dt-Handle-OPP-voltage-adjust-events.patch deleted file mode 100644 index 7cd6c6b5a..000000000 --- a/target/linux/ipq806x/patches-4.9/0054-cpufreq-dt-Handle-OPP-voltage-adjust-events.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 10577f74c35bd395951d1b2382c8d821089b5745 Mon Sep 17 00:00:00 2001 -From: Stephen Boyd -Date: Fri, 18 Sep 2015 17:52:08 -0700 -Subject: [PATCH 54/69] cpufreq-dt: Handle OPP voltage adjust events - -On some SoCs the Adaptive Voltage Scaling (AVS) technique is -employed to optimize the operating voltage of a device. At a -given frequency, the hardware monitors dynamic factors and either -makes a suggestion for how much to adjust a voltage for the -current frequency, or it automatically adjusts the voltage -without software intervention. - -In the former case, an AVS driver will call -dev_pm_opp_modify_voltage() and update the voltage for the -particular OPP the CPUs are using. Add an OPP notifier to -cpufreq-dt so that we can adjust the voltage of the CPU when AVS -updates the OPP. - -Signed-off-by: Stephen Boyd -Acked-by: Viresh Kumar -Signed-off-by: Georgi Djakov ---- - drivers/cpufreq/cpufreq-dt.c | 68 ++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 65 insertions(+), 3 deletions(-) - ---- a/drivers/cpufreq/cpufreq-dt.c -+++ b/drivers/cpufreq/cpufreq-dt.c -@@ -32,6 +32,9 @@ struct private_data { - struct device *cpu_dev; - struct thermal_cooling_device *cdev; - const char *reg_name; -+ struct notifier_block opp_nb; -+ struct mutex lock; -+ unsigned long opp_freq; - }; - - static struct freq_attr *cpufreq_dt_attr[] = { -@@ -43,9 +46,16 @@ static struct freq_attr *cpufreq_dt_attr - static int set_target(struct cpufreq_policy *policy, unsigned int index) - { - struct private_data *priv = policy->driver_data; -+ int ret; -+ unsigned long target_freq = policy->freq_table[index].frequency * 1000; -+ -+ mutex_lock(&priv->lock); -+ ret = dev_pm_opp_set_rate(priv->cpu_dev, target_freq); -+ if (!ret) -+ priv->opp_freq = target_freq; -+ mutex_unlock(&priv->lock); - -- return dev_pm_opp_set_rate(priv->cpu_dev, -- policy->freq_table[index].frequency * 1000); -+ return ret; - } - - /* -@@ -86,6 +96,39 @@ node_put: - return name; - } - -+static int opp_notifier(struct notifier_block *nb, unsigned long event, -+ void *data) -+{ -+ struct dev_pm_opp *opp = data; -+ struct private_data *priv = container_of(nb, struct private_data, -+ opp_nb); -+ struct device *cpu_dev = priv->cpu_dev; -+ struct regulator *cpu_reg; -+ unsigned long volt, freq; -+ int ret = 0; -+ -+ if (event == OPP_EVENT_ADJUST_VOLTAGE) { -+ cpu_reg = dev_pm_opp_get_regulator(cpu_dev); -+ if (IS_ERR(cpu_reg)) { -+ ret = PTR_ERR(cpu_reg); -+ goto out; -+ } -+ volt = dev_pm_opp_get_voltage(opp); -+ freq = dev_pm_opp_get_freq(opp); -+ -+ mutex_lock(&priv->lock); -+ if (freq == priv->opp_freq) { -+ ret = regulator_set_voltage_triplet(cpu_reg, volt, volt, volt); -+ } -+ mutex_unlock(&priv->lock); -+ if (ret) -+ dev_err(cpu_dev, "failed to scale voltage: %d\n", ret); -+ } -+ -+out: -+ return notifier_from_errno(ret); -+} -+ - static int resources_available(void) - { - struct device *cpu_dev; -@@ -153,6 +196,7 @@ static int cpufreq_init(struct cpufreq_p - bool fallback = false; - const char *name; - int ret; -+ struct srcu_notifier_head *opp_srcu_head; - - cpu_dev = get_cpu_device(policy->cpu); - if (!cpu_dev) { -@@ -242,13 +286,29 @@ static int cpufreq_init(struct cpufreq_p - goto out_free_opp; - } - -+ mutex_init(&priv->lock); -+ -+ rcu_read_lock(); -+ opp_srcu_head = dev_pm_opp_get_notifier(cpu_dev); -+ if (IS_ERR(opp_srcu_head)) { -+ ret = PTR_ERR(opp_srcu_head); -+ rcu_read_unlock(); -+ goto out_free_priv; -+ } -+ -+ priv->opp_nb.notifier_call = opp_notifier; -+ ret = srcu_notifier_chain_register(opp_srcu_head, &priv->opp_nb); -+ rcu_read_unlock(); -+ if (ret) -+ goto out_free_priv; -+ - priv->reg_name = name; - priv->opp_table = opp_table; - - ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); - if (ret) { - dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); -- goto out_free_priv; -+ goto out_unregister_nb; - } - - priv->cpu_dev = cpu_dev; -@@ -287,6 +347,8 @@ static int cpufreq_init(struct cpufreq_p - - out_free_cpufreq_table: - dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); -+out_unregister_nb: -+ srcu_notifier_chain_unregister(opp_srcu_head, &priv->opp_nb); - out_free_priv: - kfree(priv); - out_free_opp: diff --git a/target/linux/ipq806x/patches-4.9/0055-cpufreq-dt-Add-L2-frequency-scaling-support.patch b/target/linux/ipq806x/patches-4.9/0055-cpufreq-dt-Add-L2-frequency-scaling-support.patch deleted file mode 100644 index e0ae1f058..000000000 --- a/target/linux/ipq806x/patches-4.9/0055-cpufreq-dt-Add-L2-frequency-scaling-support.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 0759cdff49f1cf361bf503c13f7bcb33da43ab95 Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Tue, 8 Sep 2015 11:24:41 +0300 -Subject: [PATCH 55/69] cpufreq-dt: Add L2 frequency scaling support - -Signed-off-by: Georgi Djakov ---- - drivers/cpufreq/cpufreq-dt.c | 41 ++++++++++++++++++++++++++++++++++++++++- - include/linux/cpufreq.h | 2 ++ - 2 files changed, 42 insertions(+), 1 deletion(-) - ---- a/drivers/cpufreq/cpufreq-dt.c -+++ b/drivers/cpufreq/cpufreq-dt.c -@@ -48,11 +48,41 @@ static int set_target(struct cpufreq_pol - struct private_data *priv = policy->driver_data; - int ret; - unsigned long target_freq = policy->freq_table[index].frequency * 1000; -+ struct clk *l2_clk = policy->l2_clk; -+ unsigned int l2_freq; -+ unsigned long new_l2_freq = 0; - - mutex_lock(&priv->lock); - ret = dev_pm_opp_set_rate(priv->cpu_dev, target_freq); -- if (!ret) -+ -+ if (!ret) { -+ if (!IS_ERR(l2_clk) && policy->l2_rate[0] && policy->l2_rate[1] && -+ policy->l2_rate[2]) { -+ static unsigned long krait_l2[CONFIG_NR_CPUS] = { }; -+ int cpu, ret = 0; -+ -+ if (target_freq >= policy->l2_rate[2]) -+ new_l2_freq = policy->l2_rate[2]; -+ else if (target_freq >= policy->l2_rate[1]) -+ new_l2_freq = policy->l2_rate[1]; -+ else -+ new_l2_freq = policy->l2_rate[0]; -+ -+ krait_l2[policy->cpu] = new_l2_freq; -+ for_each_present_cpu(cpu) -+ new_l2_freq = max(new_l2_freq, krait_l2[cpu]); -+ -+ l2_freq = clk_get_rate(l2_clk); -+ -+ if (l2_freq != new_l2_freq) { -+ /* scale l2 with the core */ -+ ret = clk_set_rate(l2_clk, new_l2_freq); -+ } -+ } -+ - priv->opp_freq = target_freq; -+ } -+ - mutex_unlock(&priv->lock); - - return ret; -@@ -197,6 +227,8 @@ static int cpufreq_init(struct cpufreq_p - const char *name; - int ret; - struct srcu_notifier_head *opp_srcu_head; -+ struct device_node *l2_np; -+ struct clk *l2_clk = NULL; - - cpu_dev = get_cpu_device(policy->cpu); - if (!cpu_dev) { -@@ -321,6 +353,13 @@ static int cpufreq_init(struct cpufreq_p - policy->suspend_freq = dev_pm_opp_get_freq(suspend_opp) / 1000; - rcu_read_unlock(); - -+ l2_clk = clk_get(cpu_dev, "l2"); -+ if (!IS_ERR(l2_clk)) -+ policy->l2_clk = l2_clk; -+ l2_np = of_find_node_by_name(NULL, "qcom,l2"); -+ if (l2_np) -+ of_property_read_u32_array(l2_np, "qcom,l2-rates", policy->l2_rate, 3); -+ - ret = cpufreq_table_validate_and_show(policy, freq_table); - if (ret) { - dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__, ---- a/include/linux/cpufreq.h -+++ b/include/linux/cpufreq.h -@@ -73,6 +73,8 @@ struct cpufreq_policy { - unsigned int cpu; /* cpu managing this policy, must be online */ - - struct clk *clk; -+ struct clk *l2_clk; /* L2 clock */ -+ unsigned int l2_rate[3]; /* L2 bus clock rate thresholds */ - struct cpufreq_cpuinfo cpuinfo;/* see above */ - - unsigned int min; /* in kHz */ diff --git a/target/linux/ipq806x/patches-4.9/0056-cpufreq-dt-Add-missing-rcu-locks.patch b/target/linux/ipq806x/patches-4.9/0056-cpufreq-dt-Add-missing-rcu-locks.patch deleted file mode 100644 index c0eb2eb3c..000000000 --- a/target/linux/ipq806x/patches-4.9/0056-cpufreq-dt-Add-missing-rcu-locks.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 001a8dcb56ced58c518aaa10a4f0ba5e878705b6 Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Tue, 17 May 2016 16:15:43 +0300 -Subject: [PATCH 56/69] cpufreq-dt: Add missing rcu locks - -Signed-off-by: Georgi Djakov ---- - drivers/cpufreq/cpufreq-dt.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/cpufreq/cpufreq-dt.c -+++ b/drivers/cpufreq/cpufreq-dt.c -@@ -143,8 +143,10 @@ static int opp_notifier(struct notifier_ - ret = PTR_ERR(cpu_reg); - goto out; - } -+ rcu_read_lock(); - volt = dev_pm_opp_get_voltage(opp); - freq = dev_pm_opp_get_freq(opp); -+ rcu_read_unlock(); - - mutex_lock(&priv->lock); - if (freq == priv->opp_freq) { diff --git a/target/linux/ipq806x/patches-4.9/0058-clk-qcom-Always-add-factor-clock-for-xo-clocks.patch b/target/linux/ipq806x/patches-4.9/0058-clk-qcom-Always-add-factor-clock-for-xo-clocks.patch deleted file mode 100644 index f679cf740..000000000 --- a/target/linux/ipq806x/patches-4.9/0058-clk-qcom-Always-add-factor-clock-for-xo-clocks.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6081776c1eef63e3083387bb9ec2bf7edf92428b Mon Sep 17 00:00:00 2001 -From: Georgi Djakov -Date: Wed, 2 Nov 2016 17:56:58 +0200 -Subject: [PATCH 58/69] clk: qcom: Always add factor clock for xo clocks - -Currently the RPM/RPM-SMD clock drivers do not register the xo clocks, -so we should always add factor clock. When we later add xo clocks support -into the drivers, we should update this function to skip registration. -By doing so we avoid any DT dependencies. - -Signed-off-by: Georgi Djakov ---- - drivers/clk/qcom/common.c | 15 ++++++--------- - 1 file changed, 6 insertions(+), 9 deletions(-) - ---- a/drivers/clk/qcom/common.c -+++ b/drivers/clk/qcom/common.c -@@ -153,15 +153,12 @@ int qcom_cc_register_board_clk(struct de - const char *name, unsigned long rate) - { - bool add_factor = true; -- struct device_node *node; - -- /* The RPM clock driver will add the factor clock if present */ -- if (IS_ENABLED(CONFIG_QCOM_RPMCC)) { -- node = of_find_compatible_node(NULL, NULL, "qcom,rpmcc"); -- if (of_device_is_available(node)) -- add_factor = false; -- of_node_put(node); -- } -+ /* -+ * TODO: The RPM clock driver currently does not support the xo clock. -+ * When xo is added to the RPM clock driver, we should change this -+ * function to skip registration of xo factor clocks. -+ */ - - return _qcom_cc_register_board_clk(dev, path, name, rate, add_factor); - } diff --git a/target/linux/ipq806x/patches-4.9/0059-ARM-cpuidle-Add-cpuidle-support-for-QCOM-cpus.patch b/target/linux/ipq806x/patches-4.9/0059-ARM-cpuidle-Add-cpuidle-support-for-QCOM-cpus.patch deleted file mode 100644 index b7349863f..000000000 --- a/target/linux/ipq806x/patches-4.9/0059-ARM-cpuidle-Add-cpuidle-support-for-QCOM-cpus.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 04ca10340f1b4d92e849724d322a7ca225d11539 Mon Sep 17 00:00:00 2001 -From: Lina Iyer -Date: Wed, 25 Mar 2015 14:25:29 -0600 -Subject: [PATCH 59/69] ARM: cpuidle: Add cpuidle support for QCOM cpus - -Define ARM_QCOM_CPUIDLE config item to enable cpuidle support. - -Cc: Stephen Boyd -Cc: Arnd Bergmann -Cc: Kevin Hilman -Cc: Daniel Lezcano -Signed-off-by: Lina Iyer ---- - drivers/cpuidle/Kconfig.arm | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/cpuidle/Kconfig.arm -+++ b/drivers/cpuidle/Kconfig.arm -@@ -74,3 +74,10 @@ config ARM_MVEBU_V7_CPUIDLE - depends on ARCH_MVEBU && !ARM64 - help - Select this to enable cpuidle on Armada 370, 38x and XP processors. -+ -+config ARM_QCOM_CPUIDLE -+ bool "CPU Idle Driver for QCOM processors" -+ depends on ARCH_QCOM -+ select ARM_CPUIDLE -+ help -+ Select this to enable cpuidle on QCOM processors. diff --git a/target/linux/ipq806x/patches-4.9/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch b/target/linux/ipq806x/patches-4.9/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch deleted file mode 100644 index c188d0da5..000000000 --- a/target/linux/ipq806x/patches-4.9/0060-HACK-arch-arm-force-ZRELADDR-on-arch-qcom.patch +++ /dev/null @@ -1,62 +0,0 @@ -From fa71139b55e114aa8c3c4823ff8ee7d49ee810d4 Mon Sep 17 00:00:00 2001 -From: Mathieu Olivari -Date: Wed, 29 Apr 2015 15:21:46 -0700 -Subject: [PATCH 60/69] HACK: arch: arm: force ZRELADDR on arch-qcom - -ARCH_QCOM is using the ARCH_MULTIPLATFORM option, as now recommended -on most ARM architectures. This automatically calculate ZRELADDR by -masking PHYS_OFFSET with 0xf8000000. - -However, on IPQ806x, the first ~20MB of RAM is reserved for the hardware -network accelerators, and the bootloader removes this section from the -layout passed from the ATAGS (when used). - -For newer bootloader, when DT is used, this is not a problem, we just -reserve this memory in the device tree. But if the bootloader doesn't -have DT support, then ATAGS have to be used. In this case, the ARM -decompressor will position the kernel in this low mem, which will not be -in the RAM section mapped by the bootloader, which means the kernel will -freeze in the middle of the boot process trying to map the memory. - -As a work around, this patch allows disabling AUTO_ZRELADDR when -ARCH_QCOM is selected. It makes the zImage usage possible on bootloaders -which don't support device-tree, which is the case on certain early -IPQ806x based designs. - -Signed-off-by: Mathieu Olivari ---- - arch/arm/Kconfig | 2 +- - arch/arm/Makefile | 2 ++ - arch/arm/mach-qcom/Makefile.boot | 1 + - 3 files changed, 4 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/mach-qcom/Makefile.boot - ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -331,7 +331,7 @@ config ARCH_MULTIPLATFORM - depends on MMU - select ARM_HAS_SG_CHAIN - select ARM_PATCH_PHYS_VIRT -- select AUTO_ZRELADDR -+ select AUTO_ZRELADDR if !ARCH_QCOM - select CLKSRC_OF - select COMMON_CLK - select GENERIC_CLOCKEVENTS ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -251,9 +251,11 @@ MACHINE := arch/arm/mach-$(word 1,$(mac - else - MACHINE := - endif -+ifeq ($(CONFIG_ARCH_QCOM),) - ifeq ($(CONFIG_ARCH_MULTIPLATFORM),y) - MACHINE := - endif -+endif - - machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) - platdirs := $(patsubst %,arch/arm/plat-%/,$(sort $(plat-y))) ---- /dev/null -+++ b/arch/arm/mach-qcom/Makefile.boot -@@ -0,0 +1 @@ -+zreladdr-y+= 0x42208000 diff --git a/target/linux/ipq806x/patches-4.9/0061-mtd-rootfs-conflicts-with-OpenWrt-auto-mounting.patch b/target/linux/ipq806x/patches-4.9/0061-mtd-rootfs-conflicts-with-OpenWrt-auto-mounting.patch deleted file mode 100644 index a4a957545..000000000 --- a/target/linux/ipq806x/patches-4.9/0061-mtd-rootfs-conflicts-with-OpenWrt-auto-mounting.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 5001f2e1a325b68dbf225bd17f69a4d3d975cca5 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 9 Mar 2017 09:31:44 +0100 -Subject: [PATCH 61/69] mtd: "rootfs" conflicts with OpenWrt auto mounting - -Signed-off-by: John Crispin ---- - drivers/mtd/qcom_smem_part.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/mtd/qcom_smem_part.c -+++ b/drivers/mtd/qcom_smem_part.c -@@ -189,6 +189,10 @@ static int parse_qcom_smem_partitions(st - m_part->size = le32_to_cpu(s_part->size) * (*smem_blksz); - m_part->offset = le32_to_cpu(s_part->start) * (*smem_blksz); - -+ /* "rootfs" conflicts with OpenWrt auto mounting */ -+ if (mtd_type_is_nand(master) && !strcmp(m_part->name, "rootfs")) -+ m_part->name = "ubi"; -+ - /* - * The last SMEM partition may have its size marked as - * something like 0xffffffff, which means "until the end of the diff --git a/target/linux/ipq806x/patches-4.9/0062-ipq806x-gcc-Added-the-enable-regs-and-mask-for-PRNG.patch b/target/linux/ipq806x/patches-4.9/0062-ipq806x-gcc-Added-the-enable-regs-and-mask-for-PRNG.patch deleted file mode 100644 index 717934315..000000000 --- a/target/linux/ipq806x/patches-4.9/0062-ipq806x-gcc-Added-the-enable-regs-and-mask-for-PRNG.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a16fcf911a020e46439a3bb3e702463fc3159831 Mon Sep 17 00:00:00 2001 -From: Abhishek Sahu -Date: Wed, 18 Nov 2015 12:38:56 +0530 -Subject: [PATCH 62/69] ipq806x: gcc: Added the enable regs and mask for PRNG - -kernel got hanged while reading from /dev/hwrng at the -time of PRNG clock enable - -Change-Id: I89856c7e19e6639508e6a2774304583a3ec91172 -Signed-off-by: Abhishek Sahu ---- - drivers/clk/qcom/gcc-ipq806x.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/clk/qcom/gcc-ipq806x.c -+++ b/drivers/clk/qcom/gcc-ipq806x.c -@@ -1233,6 +1233,8 @@ static struct clk_rcg prng_src = { - .parent_map = gcc_pxo_pll8_map, - }, - .clkr = { -+ .enable_reg = 0x2e80, -+ .enable_mask = BIT(11), - .hw.init = &(struct clk_init_data){ - .name = "prng_src", - .parent_names = gcc_pxo_pll8, diff --git a/target/linux/ipq806x/patches-4.9/0063-1-ipq806x-tsens-driver.patch b/target/linux/ipq806x/patches-4.9/0063-1-ipq806x-tsens-driver.patch deleted file mode 100644 index 685b0c3ce..000000000 --- a/target/linux/ipq806x/patches-4.9/0063-1-ipq806x-tsens-driver.patch +++ /dev/null @@ -1,627 +0,0 @@ -From 3302e1e1a3cfa4e67fda2a61d6f0c42205d40932 Mon Sep 17 00:00:00 2001 -From: Rajith Cherian -Date: Tue, 14 Feb 2017 18:30:43 +0530 -Subject: [PATCH] ipq8064: tsens: Base tsens driver for IPQ8064 - -Add TSENS driver template to support IPQ8064. -This is a base file copied from tsens-8960.c - -Change-Id: I47c573fdfa2d898243c6a6ba952d1632f91391f7 -Signed-off-by: Rajith Cherian - -ipq8064: tsens: TSENS driver support for IPQ8064 - -Support for IPQ8064 tsens driver. The driver works -with the thermal framework. The driver overrides the -following fucntionalities: - -1. Get current temperature. -2. Get/Set trip temperatures. -3. Enabled/Disable trip points. -4. ISR for threshold generated interrupt. -5. Notify userspace when trip points are hit. - -Change-Id: I8bc7204fd627d10875ab13fc1de8cb6c2ed7a918 -Signed-off-by: Rajith Cherian ---- - .../devicetree/bindings/thermal/qcom-tsens.txt | 1 + - drivers/thermal/qcom/Makefile | 3 +- - drivers/thermal/qcom/tsens-ipq8064.c | 551 +++++++++++++++++++++ - drivers/thermal/qcom/tsens.c | 3 + - drivers/thermal/qcom/tsens.h | 2 +- - 5 files changed, 558 insertions(+), 2 deletions(-) - create mode 100644 drivers/thermal/qcom/tsens-ipq8064.c - ---- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt -+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt -@@ -5,6 +5,7 @@ Required properties: - - "qcom,msm8916-tsens" : For 8916 Family of SoCs - - "qcom,msm8974-tsens" : For 8974 Family of SoCs - - "qcom,msm8996-tsens" : For 8996 Family of SoCs -+ - "qcom,ipq8064-tsens" : For IPQ8064 - - - reg: Address range of the thermal registers - - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description. ---- a/drivers/thermal/qcom/Makefile -+++ b/drivers/thermal/qcom/Makefile -@@ -1,2 +1,3 @@ - obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o --qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o -+qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o \ -+ tsens-ipq8064.o ---- /dev/null -+++ b/drivers/thermal/qcom/tsens-ipq8064.c -@@ -0,0 +1,551 @@ -+/* -+ * Copyright (c) 2015, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "tsens.h" -+ -+#define CAL_MDEGC 30000 -+ -+#define CONFIG_ADDR 0x3640 -+/* CONFIG_ADDR bitmasks */ -+#define CONFIG 0x9b -+#define CONFIG_MASK 0xf -+#define CONFIG_SHIFT 0 -+ -+#define STATUS_CNTL_8064 0x3660 -+#define CNTL_ADDR 0x3620 -+/* CNTL_ADDR bitmasks */ -+#define EN BIT(0) -+#define SW_RST BIT(1) -+#define SENSOR0_EN BIT(3) -+#define SLP_CLK_ENA BIT(26) -+#define MEASURE_PERIOD 1 -+#define SENSOR0_SHIFT 3 -+ -+/* INT_STATUS_ADDR bitmasks */ -+#define MIN_STATUS_MASK BIT(0) -+#define LOWER_STATUS_CLR BIT(1) -+#define UPPER_STATUS_CLR BIT(2) -+#define MAX_STATUS_MASK BIT(3) -+ -+#define THRESHOLD_ADDR 0x3624 -+/* THRESHOLD_ADDR bitmasks */ -+#define THRESHOLD_MAX_CODE 0x20000 -+#define THRESHOLD_MIN_CODE 0 -+#define THRESHOLD_MAX_LIMIT_SHIFT 24 -+#define THRESHOLD_MIN_LIMIT_SHIFT 16 -+#define THRESHOLD_UPPER_LIMIT_SHIFT 8 -+#define THRESHOLD_LOWER_LIMIT_SHIFT 0 -+#define THRESHOLD_MAX_LIMIT_MASK (THRESHOLD_MAX_CODE << \ -+ THRESHOLD_MAX_LIMIT_SHIFT) -+#define THRESHOLD_MIN_LIMIT_MASK (THRESHOLD_MAX_CODE << \ -+ THRESHOLD_MIN_LIMIT_SHIFT) -+#define THRESHOLD_UPPER_LIMIT_MASK (THRESHOLD_MAX_CODE << \ -+ THRESHOLD_UPPER_LIMIT_SHIFT) -+#define THRESHOLD_LOWER_LIMIT_MASK (THRESHOLD_MAX_CODE << \ -+ THRESHOLD_LOWER_LIMIT_SHIFT) -+ -+/* Initial temperature threshold values */ -+#define LOWER_LIMIT_TH 0x9d /* 95C */ -+#define UPPER_LIMIT_TH 0xa6 /* 105C */ -+#define MIN_LIMIT_TH 0x0 -+#define MAX_LIMIT_TH 0xff -+ -+#define S0_STATUS_ADDR 0x3628 -+#define STATUS_ADDR_OFFSET 2 -+#define SENSOR_STATUS_SIZE 4 -+#define INT_STATUS_ADDR 0x363c -+#define TRDY_MASK BIT(7) -+#define TIMEOUT_US 100 -+ -+#define TSENS_EN BIT(0) -+#define TSENS_SW_RST BIT(1) -+#define TSENS_ADC_CLK_SEL BIT(2) -+#define SENSOR0_EN BIT(3) -+#define SENSOR1_EN BIT(4) -+#define SENSOR2_EN BIT(5) -+#define SENSOR3_EN BIT(6) -+#define SENSOR4_EN BIT(7) -+#define SENSORS_EN (SENSOR0_EN | SENSOR1_EN | \ -+ SENSOR2_EN | SENSOR3_EN | SENSOR4_EN) -+#define TSENS_8064_SENSOR5_EN BIT(8) -+#define TSENS_8064_SENSOR6_EN BIT(9) -+#define TSENS_8064_SENSOR7_EN BIT(10) -+#define TSENS_8064_SENSOR8_EN BIT(11) -+#define TSENS_8064_SENSOR9_EN BIT(12) -+#define TSENS_8064_SENSOR10_EN BIT(13) -+#define TSENS_8064_SENSORS_EN (SENSORS_EN | \ -+ TSENS_8064_SENSOR5_EN | \ -+ TSENS_8064_SENSOR6_EN | \ -+ TSENS_8064_SENSOR7_EN | \ -+ TSENS_8064_SENSOR8_EN | \ -+ TSENS_8064_SENSOR9_EN | \ -+ TSENS_8064_SENSOR10_EN) -+ -+#define TSENS_8064_SEQ_SENSORS 5 -+#define TSENS_8064_S4_S5_OFFSET 40 -+#define TSENS_FACTOR 1 -+ -+/* Trips: from very hot to very cold */ -+enum tsens_trip_type { -+ TSENS_TRIP_STAGE3 = 0, -+ TSENS_TRIP_STAGE2, -+ TSENS_TRIP_STAGE1, -+ TSENS_TRIP_STAGE0, -+ TSENS_TRIP_NUM, -+}; -+ -+u32 tsens_8064_slope[] = { -+ 1176, 1176, 1154, 1176, -+ 1111, 1132, 1132, 1199, -+ 1132, 1199, 1132 -+ }; -+ -+/* Temperature on y axis and ADC-code on x-axis */ -+static inline int code_to_degC(u32 adc_code, const struct tsens_sensor *s) -+{ -+ int degcbeforefactor, degc; -+ -+ degcbeforefactor = (adc_code * s->slope) + s->offset; -+ -+ if (degcbeforefactor == 0) -+ degc = degcbeforefactor; -+ else if (degcbeforefactor > 0) -+ degc = (degcbeforefactor + TSENS_FACTOR/2) -+ / TSENS_FACTOR; -+ else -+ degc = (degcbeforefactor - TSENS_FACTOR/2) -+ / TSENS_FACTOR; -+ -+ return degc; -+} -+ -+static int degC_to_code(int degC, const struct tsens_sensor *s) -+{ -+ int code = ((degC * TSENS_FACTOR - s->offset) + (s->slope/2)) -+ / s->slope; -+ -+ if (code > THRESHOLD_MAX_CODE) -+ code = THRESHOLD_MAX_CODE; -+ else if (code < THRESHOLD_MIN_CODE) -+ code = THRESHOLD_MIN_CODE; -+ return code; -+} -+ -+static int suspend_ipq8064(struct tsens_device *tmdev) -+{ -+ int ret; -+ unsigned int mask; -+ struct regmap *map = tmdev->map; -+ -+ ret = regmap_read(map, THRESHOLD_ADDR, &tmdev->ctx.threshold); -+ if (ret) -+ return ret; -+ -+ ret = regmap_read(map, CNTL_ADDR, &tmdev->ctx.control); -+ if (ret) -+ return ret; -+ -+ mask = SLP_CLK_ENA | EN; -+ -+ ret = regmap_update_bits(map, CNTL_ADDR, mask, 0); -+ if (ret) -+ return ret; -+ -+ return 0; -+} -+ -+static int resume_ipq8064(struct tsens_device *tmdev) -+{ -+ int ret; -+ struct regmap *map = tmdev->map; -+ -+ ret = regmap_update_bits(map, CNTL_ADDR, SW_RST, SW_RST); -+ if (ret) -+ return ret; -+ -+ ret = regmap_update_bits(map, CONFIG_ADDR, CONFIG_MASK, CONFIG); -+ if (ret) -+ return ret; -+ -+ ret = regmap_write(map, THRESHOLD_ADDR, tmdev->ctx.threshold); -+ if (ret) -+ return ret; -+ -+ ret = regmap_write(map, CNTL_ADDR, tmdev->ctx.control); -+ if (ret) -+ return ret; -+ -+ return 0; -+} -+ -+static void notify_uspace_tsens_fn(struct work_struct *work) -+{ -+ struct tsens_sensor *s = container_of(work, struct tsens_sensor, -+ notify_work); -+ -+ sysfs_notify(&s->tzd->device.kobj, NULL, "type"); -+} -+ -+static void tsens_scheduler_fn(struct work_struct *work) -+{ -+ struct tsens_device *tmdev = container_of(work, struct tsens_device, -+ tsens_work); -+ unsigned int threshold, threshold_low, code, reg, sensor, mask; -+ unsigned int sensor_addr; -+ bool upper_th_x, lower_th_x; -+ int adc_code, ret; -+ -+ ret = regmap_read(tmdev->map, STATUS_CNTL_8064, ®); -+ if (ret) -+ return; -+ reg = reg | LOWER_STATUS_CLR | UPPER_STATUS_CLR; -+ ret = regmap_write(tmdev->map, STATUS_CNTL_8064, reg); -+ if (ret) -+ return; -+ -+ mask = ~(LOWER_STATUS_CLR | UPPER_STATUS_CLR); -+ ret = regmap_read(tmdev->map, THRESHOLD_ADDR, &threshold); -+ if (ret) -+ return; -+ threshold_low = (threshold & THRESHOLD_LOWER_LIMIT_MASK) -+ >> THRESHOLD_LOWER_LIMIT_SHIFT; -+ threshold = (threshold & THRESHOLD_UPPER_LIMIT_MASK) -+ >> THRESHOLD_UPPER_LIMIT_SHIFT; -+ -+ ret = regmap_read(tmdev->map, STATUS_CNTL_8064, ®); -+ if (ret) -+ return; -+ -+ ret = regmap_read(tmdev->map, CNTL_ADDR, &sensor); -+ if (ret) -+ return; -+ sensor &= (uint32_t) TSENS_8064_SENSORS_EN; -+ sensor >>= SENSOR0_SHIFT; -+ -+ /* Constraint: There is only 1 interrupt control register for all -+ * 11 temperature sensor. So monitoring more than 1 sensor based -+ * on interrupts will yield inconsistent result. To overcome this -+ * issue we will monitor only sensor 0 which is the master sensor. -+ */ -+ -+ /* Skip if the sensor is disabled */ -+ if (sensor & 1) { -+ ret = regmap_read(tmdev->map, tmdev->sensor[0].status, &code); -+ if (ret) -+ return; -+ upper_th_x = code >= threshold; -+ lower_th_x = code <= threshold_low; -+ if (upper_th_x) -+ mask |= UPPER_STATUS_CLR; -+ if (lower_th_x) -+ mask |= LOWER_STATUS_CLR; -+ if (upper_th_x || lower_th_x) { -+ /* Notify user space */ -+ schedule_work(&tmdev->sensor[0].notify_work); -+ regmap_read(tmdev->map, sensor_addr, &adc_code); -+ pr_debug("Trigger (%d degrees) for sensor %d\n", -+ code_to_degC(adc_code, &tmdev->sensor[0]), 0); -+ } -+ } -+ regmap_write(tmdev->map, STATUS_CNTL_8064, reg & mask); -+ -+ /* force memory to sync */ -+ mb(); -+} -+ -+static irqreturn_t tsens_isr(int irq, void *data) -+{ -+ struct tsens_device *tmdev = data; -+ -+ schedule_work(&tmdev->tsens_work); -+ return IRQ_HANDLED; -+} -+ -+static void hw_init(struct tsens_device *tmdev) -+{ -+ int ret; -+ unsigned int reg_cntl = 0, reg_cfg = 0, reg_thr = 0; -+ unsigned int reg_status_cntl = 0; -+ -+ regmap_read(tmdev->map, CNTL_ADDR, ®_cntl); -+ regmap_write(tmdev->map, CNTL_ADDR, reg_cntl | TSENS_SW_RST); -+ -+ reg_cntl |= SLP_CLK_ENA | (MEASURE_PERIOD << 18) -+ | (((1 << tmdev->num_sensors) - 1) << SENSOR0_SHIFT); -+ regmap_write(tmdev->map, CNTL_ADDR, reg_cntl); -+ regmap_read(tmdev->map, STATUS_CNTL_8064, ®_status_cntl); -+ reg_status_cntl |= LOWER_STATUS_CLR | UPPER_STATUS_CLR -+ | MIN_STATUS_MASK | MAX_STATUS_MASK; -+ regmap_write(tmdev->map, STATUS_CNTL_8064, reg_status_cntl); -+ reg_cntl |= TSENS_EN; -+ regmap_write(tmdev->map, CNTL_ADDR, reg_cntl); -+ -+ regmap_read(tmdev->map, CONFIG_ADDR, ®_cfg); -+ reg_cfg = (reg_cfg & ~CONFIG_MASK) | (CONFIG << CONFIG_SHIFT); -+ regmap_write(tmdev->map, CONFIG_ADDR, reg_cfg); -+ -+ reg_thr |= (LOWER_LIMIT_TH << THRESHOLD_LOWER_LIMIT_SHIFT) -+ | (UPPER_LIMIT_TH << THRESHOLD_UPPER_LIMIT_SHIFT) -+ | (MIN_LIMIT_TH << THRESHOLD_MIN_LIMIT_SHIFT) -+ | (MAX_LIMIT_TH << THRESHOLD_MAX_LIMIT_SHIFT); -+ -+ regmap_write(tmdev->map, THRESHOLD_ADDR, reg_thr); -+ -+ ret = devm_request_irq(tmdev->dev, tmdev->tsens_irq, tsens_isr, -+ IRQF_TRIGGER_RISING, "tsens_interrupt", tmdev); -+ if (ret < 0) { -+ pr_err("%s: request_irq FAIL: %d\n", __func__, ret); -+ return; -+ } -+ -+ INIT_WORK(&tmdev->tsens_work, tsens_scheduler_fn); -+} -+ -+static int init_ipq8064(struct tsens_device *tmdev) -+{ -+ int ret, i; -+ u32 reg_cntl, offset = 0; -+ -+ init_common(tmdev); -+ if (!tmdev->map) -+ return -ENODEV; -+ -+ /* -+ * The status registers for each sensor are discontiguous -+ * because some SoCs have 5 sensors while others have more -+ * but the control registers stay in the same place, i.e -+ * directly after the first 5 status registers. -+ */ -+ for (i = 0; i < tmdev->num_sensors; i++) { -+ if (i >= TSENS_8064_SEQ_SENSORS) -+ offset = TSENS_8064_S4_S5_OFFSET; -+ -+ tmdev->sensor[i].status = S0_STATUS_ADDR + offset -+ + (i << STATUS_ADDR_OFFSET); -+ tmdev->sensor[i].slope = tsens_8064_slope[i]; -+ INIT_WORK(&tmdev->sensor[i].notify_work, -+ notify_uspace_tsens_fn); -+ } -+ -+ reg_cntl = SW_RST; -+ ret = regmap_update_bits(tmdev->map, CNTL_ADDR, SW_RST, reg_cntl); -+ if (ret) -+ return ret; -+ -+ reg_cntl |= SLP_CLK_ENA | (MEASURE_PERIOD << 18); -+ reg_cntl &= ~SW_RST; -+ ret = regmap_update_bits(tmdev->map, CONFIG_ADDR, -+ CONFIG_MASK, CONFIG); -+ -+ reg_cntl |= GENMASK(tmdev->num_sensors - 1, 0) << SENSOR0_SHIFT; -+ ret = regmap_write(tmdev->map, CNTL_ADDR, reg_cntl); -+ if (ret) -+ return ret; -+ -+ reg_cntl |= EN; -+ ret = regmap_write(tmdev->map, CNTL_ADDR, reg_cntl); -+ if (ret) -+ return ret; -+ -+ return 0; -+} -+ -+static int calibrate_ipq8064(struct tsens_device *tmdev) -+{ -+ int i; -+ char *data, *data_backup; -+ -+ ssize_t num_read = tmdev->num_sensors; -+ struct tsens_sensor *s = tmdev->sensor; -+ -+ data = qfprom_read(tmdev->dev, "calib"); -+ if (IS_ERR(data)) { -+ pr_err("Calibration not found.\n"); -+ return PTR_ERR(data); -+ } -+ -+ data_backup = qfprom_read(tmdev->dev, "calib_backup"); -+ if (IS_ERR(data_backup)) { -+ pr_err("Backup calibration not found.\n"); -+ return PTR_ERR(data_backup); -+ } -+ -+ for (i = 0; i < num_read; i++) { -+ s[i].calib_data = readb_relaxed(data + i); -+ s[i].calib_data_backup = readb_relaxed(data_backup + i); -+ -+ if (s[i].calib_data_backup) -+ s[i].calib_data = s[i].calib_data_backup; -+ if (!s[i].calib_data) { -+ pr_err("QFPROM TSENS calibration data not present\n"); -+ return -ENODEV; -+ } -+ s[i].slope = tsens_8064_slope[i]; -+ s[i].offset = CAL_MDEGC - (s[i].calib_data * s[i].slope); -+ } -+ -+ hw_init(tmdev); -+ -+ return 0; -+} -+ -+static int get_temp_ipq8064(struct tsens_device *tmdev, int id, int *temp) -+{ -+ int ret; -+ u32 code, trdy; -+ const struct tsens_sensor *s = &tmdev->sensor[id]; -+ unsigned long timeout; -+ -+ timeout = jiffies + usecs_to_jiffies(TIMEOUT_US); -+ do { -+ ret = regmap_read(tmdev->map, INT_STATUS_ADDR, &trdy); -+ if (ret) -+ return ret; -+ if (!(trdy & TRDY_MASK)) -+ continue; -+ ret = regmap_read(tmdev->map, s->status, &code); -+ if (ret) -+ return ret; -+ *temp = code_to_degC(code, s); -+ return 0; -+ } while (time_before(jiffies, timeout)); -+ -+ return -ETIMEDOUT; -+} -+ -+static int set_trip_temp_ipq8064(void *data, int trip, int temp) -+{ -+ unsigned int reg_th, reg_cntl; -+ int ret, code, code_chk, hi_code, lo_code; -+ const struct tsens_sensor *s = data; -+ struct tsens_device *tmdev = s->tmdev; -+ -+ code_chk = code = degC_to_code(temp, s); -+ -+ if (code < THRESHOLD_MIN_CODE || code > THRESHOLD_MAX_CODE) -+ return -EINVAL; -+ -+ ret = regmap_read(tmdev->map, STATUS_CNTL_8064, ®_cntl); -+ if (ret) -+ return ret; -+ -+ ret = regmap_read(tmdev->map, THRESHOLD_ADDR, ®_th); -+ if (ret) -+ return ret; -+ -+ hi_code = (reg_th & THRESHOLD_UPPER_LIMIT_MASK) -+ >> THRESHOLD_UPPER_LIMIT_SHIFT; -+ lo_code = (reg_th & THRESHOLD_LOWER_LIMIT_MASK) -+ >> THRESHOLD_LOWER_LIMIT_SHIFT; -+ -+ switch (trip) { -+ case TSENS_TRIP_STAGE3: -+ code <<= THRESHOLD_MAX_LIMIT_SHIFT; -+ reg_th &= ~THRESHOLD_MAX_LIMIT_MASK; -+ break; -+ case TSENS_TRIP_STAGE2: -+ if (code_chk <= lo_code) -+ return -EINVAL; -+ code <<= THRESHOLD_UPPER_LIMIT_SHIFT; -+ reg_th &= ~THRESHOLD_UPPER_LIMIT_MASK; -+ break; -+ case TSENS_TRIP_STAGE1: -+ if (code_chk >= hi_code) -+ return -EINVAL; -+ code <<= THRESHOLD_LOWER_LIMIT_SHIFT; -+ reg_th &= ~THRESHOLD_LOWER_LIMIT_MASK; -+ break; -+ case TSENS_TRIP_STAGE0: -+ code <<= THRESHOLD_MIN_LIMIT_SHIFT; -+ reg_th &= ~THRESHOLD_MIN_LIMIT_MASK; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ ret = regmap_write(tmdev->map, THRESHOLD_ADDR, reg_th | code); -+ if (ret) -+ return ret; -+ -+ return 0; -+} -+ -+static int set_trip_activate_ipq8064(void *data, int trip, -+ enum thermal_trip_activation_mode mode) -+{ -+ unsigned int reg_cntl, mask, val; -+ const struct tsens_sensor *s = data; -+ struct tsens_device *tmdev = s->tmdev; -+ int ret; -+ -+ if (!tmdev || trip < 0) -+ return -EINVAL; -+ -+ ret = regmap_read(tmdev->map, STATUS_CNTL_8064, ®_cntl); -+ if (ret) -+ return ret; -+ -+ switch (trip) { -+ case TSENS_TRIP_STAGE3: -+ mask = MAX_STATUS_MASK; -+ break; -+ case TSENS_TRIP_STAGE2: -+ mask = UPPER_STATUS_CLR; -+ break; -+ case TSENS_TRIP_STAGE1: -+ mask = LOWER_STATUS_CLR; -+ break; -+ case TSENS_TRIP_STAGE0: -+ mask = MIN_STATUS_MASK; -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ if (mode == THERMAL_TRIP_ACTIVATION_DISABLED) -+ val = reg_cntl | mask; -+ else -+ val = reg_cntl & ~mask; -+ -+ ret = regmap_write(tmdev->map, STATUS_CNTL_8064, val); -+ if (ret) -+ return ret; -+ -+ /* force memory to sync */ -+ mb(); -+ return 0; -+} -+ -+const struct tsens_ops ops_ipq8064 = { -+ .init = init_ipq8064, -+ .calibrate = calibrate_ipq8064, -+ .get_temp = get_temp_ipq8064, -+ .suspend = suspend_ipq8064, -+ .resume = resume_ipq8064, -+ .set_trip_temp = set_trip_temp_ipq8064, -+ .set_trip_activate = set_trip_activate_ipq8064, -+}; -+ -+const struct tsens_data data_ipq8064 = { -+ .num_sensors = 11, -+ .ops = &ops_ipq8064, -+}; ---- a/drivers/thermal/qcom/tsens.c -+++ b/drivers/thermal/qcom/tsens.c -@@ -72,6 +72,9 @@ static const struct of_device_id tsens_t - }, { - .compatible = "qcom,msm8996-tsens", - .data = &data_8996, -+ }, { -+ .compatible = "qcom,ipq8064-tsens", -+ .data = &data_ipq8064, - }, - {} - }; ---- a/drivers/thermal/qcom/tsens.h -+++ b/drivers/thermal/qcom/tsens.h -@@ -89,6 +89,6 @@ void compute_intercept_slope(struct tsen - int init_common(struct tsens_device *); - int get_temp_common(struct tsens_device *, int, int *); - --extern const struct tsens_data data_8916, data_8974, data_8960, data_8996; -+extern const struct tsens_data data_8916, data_8974, data_8960, data_8996, data_ipq8064; - - #endif /* __QCOM_TSENS_H__ */ diff --git a/target/linux/ipq806x/patches-4.9/0063-2-tsens-support-configurable-interrupts.patch b/target/linux/ipq806x/patches-4.9/0063-2-tsens-support-configurable-interrupts.patch deleted file mode 100644 index ca9897049..000000000 --- a/target/linux/ipq806x/patches-4.9/0063-2-tsens-support-configurable-interrupts.patch +++ /dev/null @@ -1,462 +0,0 @@ -From 4e87400732c77765afae2ea89ed43837457aa604 Mon Sep 17 00:00:00 2001 -From: Rajith Cherian -Date: Wed, 1 Feb 2017 19:00:26 +0530 -Subject: [PATCH] ipq8064: tsens: Support for configurable interrupts - -Provide support for adding configurable high and -configurable low trip temperatures. An interrupts is -also triggerred when these trip points are hit. The -interrupts can be activated or deactivated from sysfs. -This functionality is made available only if -CONFIG_THERMAL_WRITABLE_TRIPS is defined. - -Change-Id: Ib73f3f9459de4fffce7bb985a0312a88291f4934 -Signed-off-by: Rajith Cherian ---- - .../devicetree/bindings/thermal/qcom-tsens.txt | 4 ++ - drivers/thermal/of-thermal.c | 63 ++++++++++++++++++---- - drivers/thermal/qcom/tsens.c | 43 ++++++++++++--- - drivers/thermal/qcom/tsens.h | 11 ++++ - drivers/thermal/thermal_core.c | 44 ++++++++++++++- - include/linux/thermal.h | 14 +++++ - 6 files changed, 162 insertions(+), 17 deletions(-) - ---- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt -+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt -@@ -12,11 +12,15 @@ Required properties: - - Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to specify - nvmem cells - -+Optional properties: -+- interrupts: Interrupt which gets triggered when threshold is hit -+ - Example: - tsens: thermal-sensor@900000 { - compatible = "qcom,msm8916-tsens"; - reg = <0x4a8000 0x2000>; - nvmem-cells = <&tsens_caldata>, <&tsens_calsel>; - nvmem-cell-names = "caldata", "calsel"; -+ interrupts = <0 178 0>; - #thermal-sensor-cells = <1>; - }; ---- a/drivers/thermal/of-thermal.c -+++ b/drivers/thermal/of-thermal.c -@@ -95,7 +95,7 @@ static int of_thermal_get_temp(struct th - { - struct __thermal_zone *data = tz->devdata; - -- if (!data->ops->get_temp) -+ if (!data->ops->get_temp || (data->mode == THERMAL_DEVICE_DISABLED)) - return -EINVAL; - - return data->ops->get_temp(data->sensor_data, temp); -@@ -106,7 +106,8 @@ static int of_thermal_set_trips(struct t - { - struct __thermal_zone *data = tz->devdata; - -- if (!data->ops || !data->ops->set_trips) -+ if (!data->ops || !data->ops->set_trips -+ || (data->mode == THERMAL_DEVICE_DISABLED)) - return -EINVAL; - - return data->ops->set_trips(data->sensor_data, low, high); -@@ -192,6 +193,9 @@ static int of_thermal_set_emul_temp(stru - { - struct __thermal_zone *data = tz->devdata; - -+ if (data->mode == THERMAL_DEVICE_DISABLED) -+ return -EINVAL; -+ - return data->ops->set_emul_temp(data->sensor_data, temp); - } - -@@ -200,7 +204,7 @@ static int of_thermal_get_trend(struct t - { - struct __thermal_zone *data = tz->devdata; - -- if (!data->ops->get_trend) -+ if (!data->ops->get_trend || (data->mode == THERMAL_DEVICE_DISABLED)) - return -EINVAL; - - return data->ops->get_trend(data->sensor_data, trip, trend); -@@ -286,7 +290,9 @@ static int of_thermal_set_mode(struct th - mutex_unlock(&tz->lock); - - data->mode = mode; -- thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); -+ -+ if (mode == THERMAL_DEVICE_ENABLED) -+ thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); - - return 0; - } -@@ -296,7 +302,8 @@ static int of_thermal_get_trip_type(stru - { - struct __thermal_zone *data = tz->devdata; - -- if (trip >= data->ntrips || trip < 0) -+ if (trip >= data->ntrips || trip < 0 -+ || (data->mode == THERMAL_DEVICE_DISABLED)) - return -EDOM; - - *type = data->trips[trip].type; -@@ -304,12 +311,39 @@ static int of_thermal_get_trip_type(stru - return 0; - } - -+static int of_thermal_activate_trip_type(struct thermal_zone_device *tz, -+ int trip, enum thermal_trip_activation_mode mode) -+{ -+ struct __thermal_zone *data = tz->devdata; -+ -+ if (trip >= data->ntrips || trip < 0 -+ || (data->mode == THERMAL_DEVICE_DISABLED)) -+ return -EDOM; -+ -+ /* -+ * The configurable_hi and configurable_lo trip points can be -+ * activated and deactivated. -+ */ -+ -+ if (data->ops->set_trip_activate) { -+ int ret; -+ -+ ret = data->ops->set_trip_activate(data->sensor_data, -+ trip, mode); -+ if (ret) -+ return ret; -+ } -+ -+ return 0; -+} -+ - static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip, - int *temp) - { - struct __thermal_zone *data = tz->devdata; - -- if (trip >= data->ntrips || trip < 0) -+ if (trip >= data->ntrips || trip < 0 -+ || (data->mode == THERMAL_DEVICE_DISABLED)) - return -EDOM; - - *temp = data->trips[trip].temperature; -@@ -322,7 +356,8 @@ static int of_thermal_set_trip_temp(stru - { - struct __thermal_zone *data = tz->devdata; - -- if (trip >= data->ntrips || trip < 0) -+ if (trip >= data->ntrips || trip < 0 -+ || (data->mode == THERMAL_DEVICE_DISABLED)) - return -EDOM; - - if (data->ops->set_trip_temp) { -@@ -344,7 +379,8 @@ static int of_thermal_get_trip_hyst(stru - { - struct __thermal_zone *data = tz->devdata; - -- if (trip >= data->ntrips || trip < 0) -+ if (trip >= data->ntrips || trip < 0 -+ || (data->mode == THERMAL_DEVICE_DISABLED)) - return -EDOM; - - *hyst = data->trips[trip].hysteresis; -@@ -357,7 +393,8 @@ static int of_thermal_set_trip_hyst(stru - { - struct __thermal_zone *data = tz->devdata; - -- if (trip >= data->ntrips || trip < 0) -+ if (trip >= data->ntrips || trip < 0 -+ || (data->mode == THERMAL_DEVICE_DISABLED)) - return -EDOM; - - /* thermal framework should take care of data->mask & (1 << trip) */ -@@ -432,6 +469,9 @@ thermal_zone_of_add_sensor(struct device - if (ops->set_emul_temp) - tzd->ops->set_emul_temp = of_thermal_set_emul_temp; - -+ if (ops->set_trip_activate) -+ tzd->ops->set_trip_activate = of_thermal_activate_trip_type; -+ - mutex_unlock(&tzd->lock); - - return tzd; -@@ -726,7 +766,10 @@ static const char * const trip_types[] = - [THERMAL_TRIP_ACTIVE] = "active", - [THERMAL_TRIP_PASSIVE] = "passive", - [THERMAL_TRIP_HOT] = "hot", -- [THERMAL_TRIP_CRITICAL] = "critical", -+ [THERMAL_TRIP_CRITICAL] = "critical_high", -+ [THERMAL_TRIP_CONFIGURABLE_HI] = "configurable_hi", -+ [THERMAL_TRIP_CONFIGURABLE_LOW] = "configurable_lo", -+ [THERMAL_TRIP_CRITICAL_LOW] = "critical_low", - }; - - /** ---- a/drivers/thermal/qcom/tsens.c -+++ b/drivers/thermal/qcom/tsens.c -@@ -31,7 +31,7 @@ static int tsens_get_temp(void *data, in - - static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend) - { -- const struct tsens_sensor *s = p; -+ struct tsens_sensor *s = p; - struct tsens_device *tmdev = s->tmdev; - - if (tmdev->ops->get_trend) -@@ -40,9 +40,10 @@ static int tsens_get_trend(void *p, int - return -ENOTSUPP; - } - --static int __maybe_unused tsens_suspend(struct device *dev) -+static int __maybe_unused tsens_suspend(void *data) - { -- struct tsens_device *tmdev = dev_get_drvdata(dev); -+ struct tsens_sensor *s = data; -+ struct tsens_device *tmdev = s->tmdev; - - if (tmdev->ops && tmdev->ops->suspend) - return tmdev->ops->suspend(tmdev); -@@ -50,9 +51,10 @@ static int __maybe_unused tsens_suspend - return 0; - } - --static int __maybe_unused tsens_resume(struct device *dev) -+static int __maybe_unused tsens_resume(void *data) - { -- struct tsens_device *tmdev = dev_get_drvdata(dev); -+ struct tsens_sensor *s = data; -+ struct tsens_device *tmdev = s->tmdev; - - if (tmdev->ops && tmdev->ops->resume) - return tmdev->ops->resume(tmdev); -@@ -60,6 +62,30 @@ static int __maybe_unused tsens_resume(s - return 0; - } - -+static int __maybe_unused tsens_set_trip_temp(void *data, int trip, int temp) -+{ -+ struct tsens_sensor *s = data; -+ struct tsens_device *tmdev = s->tmdev; -+ -+ if (tmdev->ops && tmdev->ops->set_trip_temp) -+ return tmdev->ops->set_trip_temp(s, trip, temp); -+ -+ return 0; -+} -+ -+static int __maybe_unused tsens_activate_trip_type(void *data, int trip, -+ enum thermal_trip_activation_mode mode) -+{ -+ struct tsens_sensor *s = data; -+ struct tsens_device *tmdev = s->tmdev; -+ -+ if (tmdev->ops && tmdev->ops->set_trip_activate) -+ return tmdev->ops->set_trip_activate(s, trip, mode); -+ -+ return 0; -+} -+ -+ - static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume); - - static const struct of_device_id tsens_table[] = { -@@ -83,6 +109,8 @@ MODULE_DEVICE_TABLE(of, tsens_table); - static const struct thermal_zone_of_device_ops tsens_of_ops = { - .get_temp = tsens_get_temp, - .get_trend = tsens_get_trend, -+ .set_trip_temp = tsens_set_trip_temp, -+ .set_trip_activate = tsens_activate_trip_type, - }; - - static int tsens_register(struct tsens_device *tmdev) -@@ -131,7 +159,7 @@ static int tsens_probe(struct platform_d - if (id) - data = id->data; - else -- data = &data_8960; -+ return -EINVAL; - - if (data->num_sensors <= 0) { - dev_err(dev, "invalid number of sensors\n"); -@@ -146,6 +174,9 @@ static int tsens_probe(struct platform_d - tmdev->dev = dev; - tmdev->num_sensors = data->num_sensors; - tmdev->ops = data->ops; -+ -+ tmdev->tsens_irq = platform_get_irq(pdev, 0); -+ - for (i = 0; i < tmdev->num_sensors; i++) { - if (data->hw_ids) - tmdev->sensor[i].hw_id = data->hw_ids[i]; ---- a/drivers/thermal/qcom/tsens.h -+++ b/drivers/thermal/qcom/tsens.h -@@ -24,9 +24,12 @@ struct tsens_device; - struct tsens_sensor { - struct tsens_device *tmdev; - struct thermal_zone_device *tzd; -+ struct work_struct notify_work; - int offset; - int id; - int hw_id; -+ int calib_data; -+ int calib_data_backup; - int slope; - u32 status; - }; -@@ -41,6 +44,9 @@ struct tsens_sensor { - * @suspend: Function to suspend the tsens device - * @resume: Function to resume the tsens device - * @get_trend: Function to get the thermal/temp trend -+ * @set_trip_temp: Function to set trip temp -+ * @get_trip_temp: Function to get trip temp -+ * @set_trip_activate: Function to activate trip points - */ - struct tsens_ops { - /* mandatory callbacks */ -@@ -53,6 +59,9 @@ struct tsens_ops { - int (*suspend)(struct tsens_device *); - int (*resume)(struct tsens_device *); - int (*get_trend)(struct tsens_device *, int, enum thermal_trend *); -+ int (*set_trip_temp)(void *, int, int); -+ int (*set_trip_activate)(void *, int, -+ enum thermal_trip_activation_mode); - }; - - /** -@@ -76,11 +85,13 @@ struct tsens_context { - struct tsens_device { - struct device *dev; - u32 num_sensors; -+ u32 tsens_irq; - struct regmap *map; - struct regmap_field *status_field; - struct tsens_context ctx; - bool trdy; - const struct tsens_ops *ops; -+ struct work_struct tsens_work; - struct tsens_sensor sensor[0]; - }; - ---- a/drivers/thermal/thermal_core.c -+++ b/drivers/thermal/thermal_core.c -@@ -732,12 +732,48 @@ trip_point_type_show(struct device *dev, - return sprintf(buf, "passive\n"); - case THERMAL_TRIP_ACTIVE: - return sprintf(buf, "active\n"); -+ case THERMAL_TRIP_CONFIGURABLE_HI: -+ return sprintf(buf, "configurable_hi\n"); -+ case THERMAL_TRIP_CONFIGURABLE_LOW: -+ return sprintf(buf, "configurable_low\n"); -+ case THERMAL_TRIP_CRITICAL_LOW: -+ return sprintf(buf, "critical_low\n"); - default: - return sprintf(buf, "unknown\n"); - } - } - - static ssize_t -+trip_point_type_activate(struct device *dev, struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ struct thermal_zone_device *tz = to_thermal_zone(dev); -+ int trip, ret; -+ char *enabled = "enabled"; -+ char *disabled = "disabled"; -+ -+ if (!tz->ops->set_trip_activate) -+ return -EPERM; -+ -+ if (!sscanf(attr->attr.name, "trip_point_%d_type", &trip)) -+ return -EINVAL; -+ -+ if (!strncmp(buf, enabled, strlen(enabled))) -+ ret = tz->ops->set_trip_activate(tz, trip, -+ THERMAL_TRIP_ACTIVATION_ENABLED); -+ else if (!strncmp(buf, disabled, strlen(disabled))) -+ ret = tz->ops->set_trip_activate(tz, trip, -+ THERMAL_TRIP_ACTIVATION_DISABLED); -+ else -+ ret = -EINVAL; -+ -+ if (ret) -+ return ret; -+ -+ return count; -+} -+ -+static ssize_t - trip_point_temp_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) - { -@@ -1321,7 +1357,7 @@ thermal_cooling_device_weight_store(stru - */ - int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, - int trip, -- struct thermal_cooling_device *cdev, -+ struct thermal_cooling_device *cdev, - unsigned long upper, unsigned long lower, - unsigned int weight) - { -@@ -1772,6 +1808,12 @@ static int create_trip_attrs(struct ther - tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO; - tz->trip_type_attrs[indx].attr.show = trip_point_type_show; - -+ if (IS_ENABLED(CONFIG_THERMAL_WRITABLE_TRIPS)) { -+ tz->trip_type_attrs[indx].attr.store -+ = trip_point_type_activate; -+ tz->trip_type_attrs[indx].attr.attr.mode |= S_IWUSR; -+ } -+ - device_create_file(&tz->device, - &tz->trip_type_attrs[indx].attr); - ---- a/include/linux/thermal.h -+++ b/include/linux/thermal.h -@@ -77,11 +77,19 @@ enum thermal_device_mode { - THERMAL_DEVICE_ENABLED, - }; - -+enum thermal_trip_activation_mode { -+ THERMAL_TRIP_ACTIVATION_DISABLED = 0, -+ THERMAL_TRIP_ACTIVATION_ENABLED, -+}; -+ - enum thermal_trip_type { - THERMAL_TRIP_ACTIVE = 0, - THERMAL_TRIP_PASSIVE, - THERMAL_TRIP_HOT, - THERMAL_TRIP_CRITICAL, -+ THERMAL_TRIP_CONFIGURABLE_HI, -+ THERMAL_TRIP_CONFIGURABLE_LOW, -+ THERMAL_TRIP_CRITICAL_LOW, - }; - - enum thermal_trend { -@@ -118,6 +126,8 @@ struct thermal_zone_device_ops { - enum thermal_trip_type *); - int (*get_trip_temp) (struct thermal_zone_device *, int, int *); - int (*set_trip_temp) (struct thermal_zone_device *, int, int); -+ int (*set_trip_activate) (struct thermal_zone_device *, int, -+ enum thermal_trip_activation_mode); - int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); - int (*set_trip_hyst) (struct thermal_zone_device *, int, int); - int (*get_crit_temp) (struct thermal_zone_device *, int *); -@@ -360,6 +370,8 @@ struct thermal_genl_event { - * temperature. - * @set_trip_temp: a pointer to a function that sets the trip temperature on - * hardware. -+ * @activate_trip_type: a pointer to a function to enable/disable trip -+ * temperature interrupts - */ - struct thermal_zone_of_device_ops { - int (*get_temp)(void *, int *); -@@ -367,6 +379,8 @@ struct thermal_zone_of_device_ops { - int (*set_trips)(void *, int, int); - int (*set_emul_temp)(void *, int); - int (*set_trip_temp)(void *, int, int); -+ int (*set_trip_activate)(void *, int, -+ enum thermal_trip_activation_mode); - }; - - /** diff --git a/target/linux/ipq806x/patches-4.9/0064-clk-clk-rpm-fixes.patch b/target/linux/ipq806x/patches-4.9/0064-clk-clk-rpm-fixes.patch deleted file mode 100644 index b803488a1..000000000 --- a/target/linux/ipq806x/patches-4.9/0064-clk-clk-rpm-fixes.patch +++ /dev/null @@ -1,93 +0,0 @@ -From d30840e2b1cf79d90392e6051b0c0b6006d29d8b Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 9 Mar 2017 09:32:40 +0100 -Subject: [PATCH 64/69] clk: clk-rpm fixes - -Signed-off-by: John Crispin ---- - .../devicetree/bindings/clock/qcom,rpmcc.txt | 1 + - drivers/clk/qcom/clk-rpm.c | 35 ++++++++++++++++++++++ - include/dt-bindings/clock/qcom,rpmcc.h | 4 +++ - 3 files changed, 40 insertions(+) - ---- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt -+++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt -@@ -12,6 +12,7 @@ Required properties : - - "qcom,rpmcc-msm8916", "qcom,rpmcc" - "qcom,rpmcc-apq8064", "qcom,rpmcc" -+ "qcom,rpmcc-ipq806x", "qcom,rpmcc" - - - #clock-cells : shall contain 1 - ---- a/drivers/clk/qcom/clk-rpm.c -+++ b/drivers/clk/qcom/clk-rpm.c -@@ -359,6 +359,16 @@ DEFINE_CLK_RPM(apq8064, sfab_clk, sfab_a - DEFINE_CLK_RPM(apq8064, sfpb_clk, sfpb_a_clk, QCOM_RPM_SFPB_CLK); - DEFINE_CLK_RPM(apq8064, qdss_clk, qdss_a_clk, QCOM_RPM_QDSS_CLK); - -+/* ipq806x */ -+DEFINE_CLK_RPM(ipq806x, afab_clk, afab_a_clk, QCOM_RPM_APPS_FABRIC_CLK); -+DEFINE_CLK_RPM(ipq806x, cfpb_clk, cfpb_a_clk, QCOM_RPM_CFPB_CLK); -+DEFINE_CLK_RPM(ipq806x, daytona_clk, daytona_a_clk, QCOM_RPM_DAYTONA_FABRIC_CLK); -+DEFINE_CLK_RPM(ipq806x, ebi1_clk, ebi1_a_clk, QCOM_RPM_EBI1_CLK); -+DEFINE_CLK_RPM(ipq806x, sfab_clk, sfab_a_clk, QCOM_RPM_SYS_FABRIC_CLK); -+DEFINE_CLK_RPM(ipq806x, sfpb_clk, sfpb_a_clk, QCOM_RPM_SFPB_CLK); -+DEFINE_CLK_RPM(ipq806x, nss_fabric_0_clk, nss_fabric_0_a_clk, QCOM_RPM_NSS_FABRIC_0_CLK); -+DEFINE_CLK_RPM(ipq806x, nss_fabric_1_clk, nss_fabric_1_a_clk, QCOM_RPM_NSS_FABRIC_1_CLK); -+ - static struct clk_rpm *apq8064_clks[] = { - [RPM_APPS_FABRIC_CLK] = &apq8064_afab_clk, - [RPM_APPS_FABRIC_A_CLK] = &apq8064_afab_a_clk, -@@ -380,13 +390,38 @@ static struct clk_rpm *apq8064_clks[] = - [RPM_QDSS_A_CLK] = &apq8064_qdss_a_clk, - }; - -+static struct clk_rpm *ipq806x_clks[] = { -+ [RPM_APPS_FABRIC_CLK] = &ipq806x_afab_clk, -+ [RPM_APPS_FABRIC_A_CLK] = &ipq806x_afab_a_clk, -+ [RPM_CFPB_CLK] = &ipq806x_cfpb_clk, -+ [RPM_CFPB_A_CLK] = &ipq806x_cfpb_a_clk, -+ [RPM_DAYTONA_FABRIC_CLK] = &ipq806x_daytona_clk, -+ [RPM_DAYTONA_FABRIC_A_CLK] = &ipq806x_daytona_a_clk, -+ [RPM_EBI1_CLK] = &ipq806x_ebi1_clk, -+ [RPM_EBI1_A_CLK] = &ipq806x_ebi1_a_clk, -+ [RPM_SYS_FABRIC_CLK] = &ipq806x_sfab_clk, -+ [RPM_SYS_FABRIC_A_CLK] = &ipq806x_sfab_a_clk, -+ [RPM_SFPB_CLK] = &ipq806x_sfpb_clk, -+ [RPM_SFPB_A_CLK] = &ipq806x_sfpb_a_clk, -+ [RPM_NSS_FABRIC_0_CLK] = &ipq806x_nss_fabric_0_clk, -+ [RPM_NSS_FABRIC_0_A_CLK] = &ipq806x_nss_fabric_0_a_clk, -+ [RPM_NSS_FABRIC_1_CLK] = &ipq806x_nss_fabric_1_clk, -+ [RPM_NSS_FABRIC_1_A_CLK] = &ipq806x_nss_fabric_1_a_clk, -+}; -+ - static const struct rpm_clk_desc rpm_clk_apq8064 = { - .clks = apq8064_clks, - .num_clks = ARRAY_SIZE(apq8064_clks), - }; - -+static const struct rpm_clk_desc rpm_clk_ipq806x = { -+ .clks = ipq806x_clks, -+ .num_clks = ARRAY_SIZE(ipq806x_clks), -+}; -+ - static const struct of_device_id rpm_clk_match_table[] = { - { .compatible = "qcom,rpmcc-apq8064", .data = &rpm_clk_apq8064 }, -+ { .compatible = "qcom,rpmcc-ipq806x", .data = &rpm_clk_ipq806x }, - { } - }; - MODULE_DEVICE_TABLE(of, rpm_clk_match_table); ---- a/include/dt-bindings/clock/qcom,rpmcc.h -+++ b/include/dt-bindings/clock/qcom,rpmcc.h -@@ -37,6 +37,10 @@ - #define RPM_SYS_FABRIC_A_CLK 19 - #define RPM_SFPB_CLK 20 - #define RPM_SFPB_A_CLK 21 -+#define RPM_NSS_FABRIC_0_CLK 22 -+#define RPM_NSS_FABRIC_0_A_CLK 23 -+#define RPM_NSS_FABRIC_1_CLK 24 -+#define RPM_NSS_FABRIC_1_A_CLK 25 - - /* msm8916 */ - #define RPM_SMD_XO_CLK_SRC 0 diff --git a/target/linux/ipq806x/patches-4.9/0065-arm-override-compiler-flags.patch b/target/linux/ipq806x/patches-4.9/0065-arm-override-compiler-flags.patch deleted file mode 100644 index e5af7ffa2..000000000 --- a/target/linux/ipq806x/patches-4.9/0065-arm-override-compiler-flags.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 4d8e29642661397a339ac3485f212c6360445421 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 9 Mar 2017 09:33:32 +0100 -Subject: [PATCH 65/69] arm: override compiler flags - -Signed-off-by: John Crispin ---- - arch/arm/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -65,7 +65,7 @@ KBUILD_CFLAGS += $(call cc-option,-fno-i - # macro, but instead defines a whole series of macros which makes - # testing for a specific architecture or later rather impossible. - arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m --arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) -+arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 -mcpu=cortex-a15 - arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) - # Only override the compiler option if ARMv6. The ARMv6K extensions are - # always available in ARMv7 diff --git a/target/linux/ipq806x/patches-4.9/0067-generic-Mangle-bootloader-s-kernel-arguments.patch b/target/linux/ipq806x/patches-4.9/0067-generic-Mangle-bootloader-s-kernel-arguments.patch deleted file mode 100644 index be1a7e564..000000000 --- a/target/linux/ipq806x/patches-4.9/0067-generic-Mangle-bootloader-s-kernel-arguments.patch +++ /dev/null @@ -1,189 +0,0 @@ -From 71270226b14733a4b1f2cde58ea9265caa50b38d Mon Sep 17 00:00:00 2001 -From: Adrian Panella -Date: Thu, 9 Mar 2017 09:37:17 +0100 -Subject: [PATCH 67/69] generic: Mangle bootloader's kernel arguments - -The command-line arguments provided by the boot loader will be -appended to a new device tree property: bootloader-args. -If there is a property "append-rootblock" in DT under /chosen -and a root= option in bootloaders command line it will be parsed -and added to DT bootargs with the form: XX. -Only command line ATAG will be processed, the rest of the ATAGs -sent by bootloader will be ignored. -This is usefull in dual boot systems, to get the current root partition -without afecting the rest of the system. - -Signed-off-by: Adrian Panella ---- - arch/arm/Kconfig | 11 +++++ - arch/arm/boot/compressed/atags_to_fdt.c | 72 ++++++++++++++++++++++++++++++++- - init/main.c | 16 ++++++++ - 3 files changed, 98 insertions(+), 1 deletion(-) - ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -1948,6 +1948,17 @@ config ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEN - The command-line arguments provided by the boot loader will be - appended to the the device tree bootargs property. - -+config ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE -+ bool "Append rootblock parsing bootloader's kernel arguments" -+ help -+ The command-line arguments provided by the boot loader will be -+ appended to a new device tree property: bootloader-args. -+ If there is a property "append-rootblock" in DT under /chosen -+ and a root= option in bootloaders command line it will be parsed -+ and added to DT bootargs with the form: XX. -+ Only command line ATAG will be processed, the rest of the ATAGs -+ sent by bootloader will be ignored. -+ - endchoice - - config CMDLINE ---- a/arch/arm/boot/compressed/atags_to_fdt.c -+++ b/arch/arm/boot/compressed/atags_to_fdt.c -@@ -3,6 +3,8 @@ - - #if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND) - #define do_extend_cmdline 1 -+#elif defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE) -+#define do_extend_cmdline 1 - #else - #define do_extend_cmdline 0 - #endif -@@ -66,6 +68,59 @@ static uint32_t get_cell_size(const void - return cell_size; - } - -+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE) -+ -+static char *append_rootblock(char *dest, const char *str, int len, void *fdt) -+{ -+ char *ptr, *end; -+ char *root="root="; -+ int i, l; -+ const char *rootblock; -+ -+ //ARM doesn't have __HAVE_ARCH_STRSTR, so search manually -+ ptr = str - 1; -+ -+ do { -+ //first find an 'r' at the begining or after a space -+ do { -+ ptr++; -+ ptr = strchr(ptr, 'r'); -+ if(!ptr) return dest; -+ -+ } while (ptr != str && *(ptr-1) != ' '); -+ -+ //then check for the rest -+ for(i = 1; i <= 4; i++) -+ if(*(ptr+i) != *(root+i)) break; -+ -+ } while (i != 5); -+ -+ end = strchr(ptr, ' '); -+ end = end ? (end - 1) : (strchr(ptr, 0) - 1); -+ -+ //find partition number (assumes format root=/dev/mtdXX | /dev/mtdblockXX | yy:XX ) -+ for( i = 0; end >= ptr && *end >= '0' && *end <= '9'; end--, i++); -+ ptr = end + 1; -+ -+ /* if append-rootblock property is set use it to append to command line */ -+ rootblock = getprop(fdt, "/chosen", "append-rootblock", &l); -+ if(rootblock != NULL) { -+ if(*dest != ' ') { -+ *dest = ' '; -+ dest++; -+ len++; -+ } -+ if (len + l + i <= COMMAND_LINE_SIZE) { -+ memcpy(dest, rootblock, l); -+ dest += l - 1; -+ memcpy(dest, ptr, i); -+ dest += i; -+ } -+ } -+ return dest; -+} -+#endif -+ - static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline) - { - char cmdline[COMMAND_LINE_SIZE]; -@@ -85,12 +140,21 @@ static void merge_fdt_bootargs(void *fdt - - /* and append the ATAG_CMDLINE */ - if (fdt_cmdline) { -+ -+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE) -+ //save original bootloader args -+ //and append ubi.mtd with root partition number to current cmdline -+ setprop_string(fdt, "/chosen", "bootloader-args", fdt_cmdline); -+ ptr = append_rootblock(ptr, fdt_cmdline, len, fdt); -+ -+#else - len = strlen(fdt_cmdline); - if (ptr - cmdline + len + 2 < COMMAND_LINE_SIZE) { - *ptr++ = ' '; - memcpy(ptr, fdt_cmdline, len); - ptr += len; - } -+#endif - } - *ptr = '\0'; - -@@ -147,7 +211,9 @@ int atags_to_fdt(void *atag_list, void * - else - setprop_string(fdt, "/chosen", "bootargs", - atag->u.cmdline.cmdline); -- } else if (atag->hdr.tag == ATAG_MEM) { -+ } -+#ifndef CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE -+ else if (atag->hdr.tag == ATAG_MEM) { - if (memcount >= sizeof(mem_reg_property)/4) - continue; - if (!atag->u.mem.size) -@@ -186,6 +252,10 @@ int atags_to_fdt(void *atag_list, void * - setprop(fdt, "/memory", "reg", mem_reg_property, - 4 * memcount * memsize); - } -+#else -+ -+ } -+#endif - - return fdt_pack(fdt); - } ---- a/init/main.c -+++ b/init/main.c -@@ -89,6 +89,10 @@ - #include - #include - -+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE) -+#include -+#endif -+ - static int kernel_init(void *); - - extern void init_IRQ(void); -@@ -540,6 +544,18 @@ asmlinkage __visible void __init start_k - page_alloc_init(); - - pr_notice("Kernel command line: %s\n", boot_command_line); -+ -+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE) -+ //Show bootloader's original command line for reference -+ if(of_chosen) { -+ const char *prop = of_get_property(of_chosen, "bootloader-args", NULL); -+ if(prop) -+ pr_notice("Bootloader command line (ignored): %s\n", prop); -+ else -+ pr_notice("Bootloader command line not present\n"); -+ } -+#endif -+ - parse_early_param(); - after_dashes = parse_args("Booting kernel", - static_command_line, __start___param, diff --git a/target/linux/ipq806x/patches-4.9/0068-spi-add-gpio-cs-support.patch b/target/linux/ipq806x/patches-4.9/0068-spi-add-gpio-cs-support.patch deleted file mode 100644 index 0c03bc9f7..000000000 --- a/target/linux/ipq806x/patches-4.9/0068-spi-add-gpio-cs-support.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b9c998eb7735df8000cf48d77f9271823e8e73da Mon Sep 17 00:00:00 2001 -From: Ram Chandra Jangir -Date: Thu, 9 Mar 2017 09:39:05 +0100 -Subject: [PATCH 68/69] spi: add gpio cs support - -Signed-off-by: John Crispin ---- - drivers/spi/spi-qup.c | 38 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 38 insertions(+) - ---- a/drivers/spi/spi-qup.c -+++ b/drivers/spi/spi-qup.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - #define QUP_CONFIG 0x0000 - #define QUP_STATE 0x0004 -@@ -1019,6 +1020,38 @@ err_tx: - return ret; - } - -+static void spi_qup_set_cs(struct spi_device *spi, bool val) -+{ -+ struct spi_qup *controller; -+ u32 spi_ioc; -+ u32 spi_ioc_orig; -+ -+ controller = spi_master_get_devdata(spi->master); -+ spi_ioc = readl_relaxed(controller->base + SPI_IO_CONTROL); -+ spi_ioc_orig = spi_ioc; -+ if (!val) -+ spi_ioc |= SPI_IO_C_FORCE_CS; -+ else -+ spi_ioc &= ~SPI_IO_C_FORCE_CS; -+ -+ if (spi_ioc != spi_ioc_orig) -+ writel_relaxed(spi_ioc, controller->base + SPI_IO_CONTROL); -+} -+ -+static int spi_qup_setup(struct spi_device *spi) -+{ -+ if (spi->cs_gpio >= 0) { -+ if (spi->mode & SPI_CS_HIGH) -+ gpio_set_value(spi->cs_gpio, 0); -+ else -+ gpio_set_value(spi->cs_gpio, 1); -+ -+ udelay(10); -+ } -+ -+ return 0; -+} -+ - static int spi_qup_probe(struct platform_device *pdev) - { - struct spi_master *master; -@@ -1115,6 +1148,11 @@ static int spi_qup_probe(struct platform - if (of_device_is_compatible(dev->of_node, "qcom,spi-qup-v1.1.1")) - controller->qup_v1 = 1; - -+ if (!controller->qup_v1) -+ master->set_cs = spi_qup_set_cs; -+ else -+ master->setup = spi_qup_setup; -+ - spin_lock_init(&controller->lock); - init_completion(&controller->done); - init_completion(&controller->dma_tx_done); diff --git a/target/linux/ipq806x/patches-4.9/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-4.9/0069-arm-boot-add-dts-files.patch deleted file mode 100644 index 5b19c1d41..000000000 --- a/target/linux/ipq806x/patches-4.9/0069-arm-boot-add-dts-files.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 8f68331e14dff9a101f2d0e1d6bec84a031f27ee Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 9 Mar 2017 11:03:18 +0100 -Subject: [PATCH 69/69] arm: boot: add dts files - -Signed-off-by: John Crispin ---- - arch/arm/boot/dts/Makefile | 8 ++++++++ - 1 file changed, 8 insertions(+) - ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -618,6 +618,15 @@ dtb-$(CONFIG_ARCH_QCOM) += \ - qcom-apq8084-mtp.dtb \ - qcom-ipq4019-ap.dk01.1-c1.dtb \ - qcom-ipq8064-ap148.dtb \ -+ qcom-ipq8064-c2600.dtb \ -+ qcom-ipq8064-d7800.dtb \ -+ qcom-ipq8064-db149.dtb \ -+ qcom-ipq8064-ea8500.dtb \ -+ qcom-ipq8064-r7500.dtb \ -+ qcom-ipq8064-r7500v2.dtb \ -+ qcom-ipq8064-wpq864.dtb \ -+ qcom-ipq8065-nbg6817.dtb \ -+ qcom-ipq8065-r7800.dtb \ - qcom-msm8660-surf.dtb \ - qcom-msm8960-cdp.dtb \ - qcom-msm8974-lge-nexus5-hammerhead.dtb \ diff --git a/target/linux/ipq806x/patches-4.9/0070-qcom-spm-fix-probe-order.patch b/target/linux/ipq806x/patches-4.9/0070-qcom-spm-fix-probe-order.patch deleted file mode 100644 index b7e375dfb..000000000 --- a/target/linux/ipq806x/patches-4.9/0070-qcom-spm-fix-probe-order.patch +++ /dev/null @@ -1,16 +0,0 @@ -Check for SCM availability before attempting to use SPM - -Signed-off-by: Felix Fietkau - ---- a/drivers/soc/qcom/spm.c -+++ b/drivers/soc/qcom/spm.c -@@ -219,6 +219,9 @@ static int __init qcom_cpuidle_init(stru - cpumask_t mask; - bool use_scm_power_down = false; - -+ if (!qcom_scm_is_available()) -+ return -EPROBE_DEFER; -+ - for (i = 0; ; i++) { - state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); - if (!state_node) diff --git a/target/linux/ipq806x/patches-4.9/0071-1-PCI-qcom-Fixed-IPQ806x-specific-clocks.patch b/target/linux/ipq806x/patches-4.9/0071-1-PCI-qcom-Fixed-IPQ806x-specific-clocks.patch deleted file mode 100644 index 7a315627f..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-1-PCI-qcom-Fixed-IPQ806x-specific-clocks.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 86655aa14304ca88a8ce8847276147dbc1a83238 Mon Sep 17 00:00:00 2001 -From: Sham Muthayyan -Date: Tue, 19 Jul 2016 18:44:49 +0530 -Subject: PCI: qcom: Fixed IPQ806x specific clocks - -Change-Id: I488e1bc707d6a22b37a338f41935e3922009ba5e -Signed-off-by: Sham Muthayyan ---- - drivers/pci/host/pcie-qcom.c | 38 +++++++++++++++++++++++++++++++++----- - 1 file changed, 33 insertions(+), 5 deletions(-) - ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -53,6 +53,8 @@ struct qcom_pcie_resources_v0 { - struct clk *iface_clk; - struct clk *core_clk; - struct clk *phy_clk; -+ struct clk *aux_clk; -+ struct clk *ref_clk; - struct reset_control *pci_reset; - struct reset_control *axi_reset; - struct reset_control *ahb_reset; -@@ -160,6 +162,14 @@ static int qcom_pcie_get_resources_v0(st - if (IS_ERR(res->phy_clk)) - return PTR_ERR(res->phy_clk); - -+ res->aux_clk = devm_clk_get(dev, "aux"); -+ if (IS_ERR(res->aux_clk)) -+ return PTR_ERR(res->aux_clk); -+ -+ res->ref_clk = devm_clk_get(dev, "ref"); -+ if (IS_ERR(res->ref_clk)) -+ return PTR_ERR(res->ref_clk); -+ - res->pci_reset = devm_reset_control_get(dev, "pci"); - if (IS_ERR(res->pci_reset)) - return PTR_ERR(res->pci_reset); -@@ -227,6 +237,8 @@ static void qcom_pcie_deinit_v0(struct q - clk_disable_unprepare(res->iface_clk); - clk_disable_unprepare(res->core_clk); - clk_disable_unprepare(res->phy_clk); -+ clk_disable_unprepare(res->aux_clk); -+ clk_disable_unprepare(res->ref_clk); - regulator_disable(res->vdda); - regulator_disable(res->vdda_phy); - regulator_disable(res->vdda_refclk); -@@ -269,16 +281,28 @@ static int qcom_pcie_init_v0(struct qcom - goto err_assert_ahb; - } - -+ ret = clk_prepare_enable(res->core_clk); -+ if (ret) { -+ dev_err(dev, "cannot prepare/enable core clock\n"); -+ goto err_clk_core; -+ } -+ - ret = clk_prepare_enable(res->phy_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable phy clock\n"); - goto err_clk_phy; - } - -- ret = clk_prepare_enable(res->core_clk); -+ ret = clk_prepare_enable(res->aux_clk); - if (ret) { -- dev_err(dev, "cannot prepare/enable core clock\n"); -- goto err_clk_core; -+ dev_err(dev, "cannot prepare/enable aux clock\n"); -+ goto err_clk_aux; -+ } -+ -+ ret = clk_prepare_enable(res->ref_clk); -+ if (ret) { -+ dev_err(dev, "cannot prepare/enable ref clock\n"); -+ goto err_clk_ref; - } - - ret = reset_control_deassert(res->ahb_reset); -@@ -327,10 +351,14 @@ static int qcom_pcie_init_v0(struct qcom - return 0; - - err_deassert_ahb: -- clk_disable_unprepare(res->core_clk); --err_clk_core: -+ clk_disable_unprepare(res->ref_clk); -+err_clk_ref: -+ clk_disable_unprepare(res->aux_clk); -+err_clk_aux: - clk_disable_unprepare(res->phy_clk); - err_clk_phy: -+ clk_disable_unprepare(res->core_clk); -+err_clk_core: - clk_disable_unprepare(res->iface_clk); - err_assert_ahb: - regulator_disable(res->vdda_phy); diff --git a/target/linux/ipq806x/patches-4.9/0071-2-PCI-qcom-Fixed-IPQ806x-PCIE-reset-changes.patch b/target/linux/ipq806x/patches-4.9/0071-2-PCI-qcom-Fixed-IPQ806x-PCIE-reset-changes.patch deleted file mode 100644 index aab4f364e..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-2-PCI-qcom-Fixed-IPQ806x-PCIE-reset-changes.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 490d103232287eb51c92c49a4ef8865fd0a9d59e Mon Sep 17 00:00:00 2001 -From: Sham Muthayyan -Date: Tue, 19 Jul 2016 18:58:18 +0530 -Subject: PCI: qcom: Fixed IPQ806x PCIE reset changes - -Change-Id: Ia6590e960b9754b1e8b7a51f318788cd63e9e321 -Signed-off-by: Sham Muthayyan ---- - drivers/pci/host/pcie-qcom.c | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) - ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -60,6 +60,7 @@ struct qcom_pcie_resources_v0 { - struct reset_control *ahb_reset; - struct reset_control *por_reset; - struct reset_control *phy_reset; -+ struct reset_control *ext_reset; - struct regulator *vdda; - struct regulator *vdda_phy; - struct regulator *vdda_refclk; -@@ -190,6 +191,10 @@ static int qcom_pcie_get_resources_v0(st - if (IS_ERR(res->phy_reset)) - return PTR_ERR(res->phy_reset); - -+ res->ext_reset = devm_reset_control_get(dev, "ext"); -+ if (IS_ERR(res->ext_reset)) -+ return PTR_ERR(res->ext_reset); -+ - return 0; - } - -@@ -234,6 +239,7 @@ static void qcom_pcie_deinit_v0(struct q - reset_control_assert(res->ahb_reset); - reset_control_assert(res->por_reset); - reset_control_assert(res->pci_reset); -+ reset_control_assert(res->ext_reset); - clk_disable_unprepare(res->iface_clk); - clk_disable_unprepare(res->core_clk); - clk_disable_unprepare(res->phy_clk); -@@ -251,6 +257,12 @@ static int qcom_pcie_init_v0(struct qcom - u32 val; - int ret; - -+ ret = reset_control_assert(res->ahb_reset); -+ if (ret) { -+ dev_err(dev, "cannot assert ahb reset\n"); -+ return ret; -+ } -+ - ret = regulator_enable(res->vdda); - if (ret) { - dev_err(dev, "cannot enable vdda regulator\n"); -@@ -269,16 +281,16 @@ static int qcom_pcie_init_v0(struct qcom - goto err_vdda_phy; - } - -- ret = reset_control_assert(res->ahb_reset); -+ ret = reset_control_deassert(res->ext_reset); - if (ret) { -- dev_err(dev, "cannot assert ahb reset\n"); -- goto err_assert_ahb; -+ dev_err(dev, "cannot assert ext reset\n"); -+ goto err_reset_ext; - } - - ret = clk_prepare_enable(res->iface_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable iface clock\n"); -- goto err_assert_ahb; -+ goto err_iface; - } - - ret = clk_prepare_enable(res->core_clk); -@@ -360,7 +372,9 @@ err_clk_phy: - clk_disable_unprepare(res->core_clk); - err_clk_core: - clk_disable_unprepare(res->iface_clk); --err_assert_ahb: -+err_iface: -+ reset_control_assert(res->ext_reset); -+err_reset_ext: - regulator_disable(res->vdda_phy); - err_vdda_phy: - regulator_disable(res->vdda_refclk); diff --git a/target/linux/ipq806x/patches-4.9/0071-3-PCI-qcom-Fixed-IPQ806x-PCIE-init-changes.patch b/target/linux/ipq806x/patches-4.9/0071-3-PCI-qcom-Fixed-IPQ806x-PCIE-init-changes.patch deleted file mode 100644 index 6c68edfe9..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-3-PCI-qcom-Fixed-IPQ806x-PCIE-init-changes.patch +++ /dev/null @@ -1,127 +0,0 @@ -From eddd13215d0f2b549ebc5f0e8796d5b1231f90a0 Mon Sep 17 00:00:00 2001 -From: Sham Muthayyan -Date: Tue, 19 Jul 2016 19:58:22 +0530 -Subject: PCI: qcom: Fixed IPQ806x PCIE init changes - -Change-Id: Ic319b1aec27a47809284759f8fcb6a8815b7cf7e -Signed-off-by: Sham Muthayyan ---- - drivers/pci/host/pcie-qcom.c | 62 +++++++++++++++++++++++++++++++++++++------- - 1 file changed, 53 insertions(+), 9 deletions(-) - ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -37,7 +37,13 @@ - #include "pcie-designware.h" - - #define PCIE20_PARF_PHY_CTRL 0x40 -+#define PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK (0x1f << 16) -+#define PHY_CTRL_PHY_TX0_TERM_OFFSET(x) (x << 16) -+ - #define PCIE20_PARF_PHY_REFCLK 0x4C -+#define REF_SSP_EN BIT(16) -+#define REF_USE_PAD BIT(12) -+ - #define PCIE20_PARF_DBI_BASE_ADDR 0x168 - #define PCIE20_PARF_SLV_ADDR_SPACE_SIZE 0x16c - #define PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT 0x178 -@@ -48,6 +54,18 @@ - #define PCIE20_CAP 0x70 - - #define PERST_DELAY_US 1000 -+/* PARF registers */ -+#define PCIE20_PARF_PCS_DEEMPH 0x34 -+#define PCS_DEEMPH_TX_DEEMPH_GEN1(x) (x << 16) -+#define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x) (x << 8) -+#define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x) (x << 0) -+ -+#define PCIE20_PARF_PCS_SWING 0x38 -+#define PCS_SWING_TX_SWING_FULL(x) (x << 8) -+#define PCS_SWING_TX_SWING_LOW(x) (x << 0) -+ -+#define PCIE20_PARF_CONFIG_BITS 0x50 -+#define PHY_RX0_EQ(x) (x << 24) - - struct qcom_pcie_resources_v0 { - struct clk *iface_clk; -@@ -64,6 +82,7 @@ struct qcom_pcie_resources_v0 { - struct regulator *vdda; - struct regulator *vdda_phy; - struct regulator *vdda_refclk; -+ uint8_t phy_tx0_term_offset; - }; - - struct qcom_pcie_resources_v1 { -@@ -100,6 +119,16 @@ struct qcom_pcie { - - #define to_qcom_pcie(x) container_of(x, struct qcom_pcie, pp) - -+static inline void -+writel_masked(void __iomem *addr, u32 clear_mask, u32 set_mask) -+{ -+ u32 val = readl(addr); -+ -+ val &= ~clear_mask; -+ val |= set_mask; -+ writel(val, addr); -+} -+ - static void qcom_ep_reset_assert(struct qcom_pcie *pcie) - { - gpiod_set_value(pcie->reset, 1); -@@ -195,6 +224,10 @@ static int qcom_pcie_get_resources_v0(st - if (IS_ERR(res->ext_reset)) - return PTR_ERR(res->ext_reset); - -+ if (of_property_read_u8(dev->of_node, "phy-tx0-term-offset", -+ &res->phy_tx0_term_offset)) -+ res->phy_tx0_term_offset = 0; -+ - return 0; - } - -@@ -254,7 +287,6 @@ static int qcom_pcie_init_v0(struct qcom - { - struct qcom_pcie_resources_v0 *res = &pcie->res.v0; - struct device *dev = pcie->pp.dev; -- u32 val; - int ret; - - ret = reset_control_assert(res->ahb_reset); -@@ -323,15 +355,27 @@ static int qcom_pcie_init_v0(struct qcom - goto err_deassert_ahb; - } - -- /* enable PCIe clocks and resets */ -- val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); -- val &= ~BIT(0); -- writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); -- -- /* enable external reference clock */ -- val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK); -- val |= BIT(16); -- writel(val, pcie->parf + PCIE20_PARF_PHY_REFCLK); -+ writel_masked(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); -+ -+ /* Set Tx termination offset */ -+ writel_masked(pcie->parf + PCIE20_PARF_PHY_CTRL, -+ PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK, -+ PHY_CTRL_PHY_TX0_TERM_OFFSET(res->phy_tx0_term_offset)); -+ -+ /* PARF programming */ -+ writel(PCS_DEEMPH_TX_DEEMPH_GEN1(0x18) | -+ PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(0x18) | -+ PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(0x22), -+ pcie->parf + PCIE20_PARF_PCS_DEEMPH); -+ writel(PCS_SWING_TX_SWING_FULL(0x78) | -+ PCS_SWING_TX_SWING_LOW(0x78), -+ pcie->parf + PCIE20_PARF_PCS_SWING); -+ writel(PHY_RX0_EQ(0x4), pcie->parf + PCIE20_PARF_CONFIG_BITS); -+ -+ /* Enable reference clock */ -+ writel_masked(pcie->parf + PCIE20_PARF_PHY_REFCLK, -+ REF_USE_PAD, REF_SSP_EN); -+ - - ret = reset_control_deassert(res->phy_reset); - if (ret) { diff --git a/target/linux/ipq806x/patches-4.9/0071-4-PCIE-designware-Fixed-PCI-host-init.patch b/target/linux/ipq806x/patches-4.9/0071-4-PCIE-designware-Fixed-PCI-host-init.patch deleted file mode 100644 index af9e121f8..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-4-PCIE-designware-Fixed-PCI-host-init.patch +++ /dev/null @@ -1,68 +0,0 @@ -From e833cdb5c792912d459773cc23153e5d78875d34 Mon Sep 17 00:00:00 2001 -From: Sham Muthayyan -Date: Tue, 19 Jul 2016 20:05:25 +0530 -Subject: PCIE: designware: Fixed PCI host init - -Change-Id: I949b302d77199fc09342acf26b7bb45a7ec467ee -Signed-off-by: Sham Muthayyan ---- - drivers/pci/host/pcie-designware.c | 9 +++++++-- - drivers/pci/host/pcie-designware.h | 2 +- - drivers/pci/host/pcie-qcom.c | 5 +++-- - 3 files changed, 11 insertions(+), 5 deletions(-) - ---- a/drivers/pci/host/pcie-designware.c -+++ b/drivers/pci/host/pcie-designware.c -@@ -637,8 +637,13 @@ int dw_pcie_host_init(struct pcie_port * - } - } - -- if (pp->ops->host_init) -- pp->ops->host_init(pp); -+ if (pp->ops->host_init) { -+ ret = pp->ops->host_init(pp); -+ if (ret) { -+ dev_err(pp->dev, "hostinit failed\n"); -+ return 0; -+ } -+ } - - pp->root_bus_nr = pp->busn->start; - if (IS_ENABLED(CONFIG_PCI_MSI)) { ---- a/drivers/pci/host/pcie-designware.h -+++ b/drivers/pci/host/pcie-designware.h -@@ -63,7 +63,7 @@ struct pcie_host_ops { - int (*wr_other_conf)(struct pcie_port *pp, struct pci_bus *bus, - unsigned int devfn, int where, int size, u32 val); - int (*link_up)(struct pcie_port *pp); -- void (*host_init)(struct pcie_port *pp); -+ int (*host_init)(struct pcie_port *pp); - void (*msi_set_irq)(struct pcie_port *pp, int irq); - void (*msi_clear_irq)(struct pcie_port *pp, int irq); - phys_addr_t (*get_msi_addr)(struct pcie_port *pp); ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -515,7 +515,7 @@ static int qcom_pcie_link_up(struct pcie - return !!(val & PCI_EXP_LNKSTA_DLLLA); - } - --static void qcom_pcie_host_init(struct pcie_port *pp) -+static int qcom_pcie_host_init(struct pcie_port *pp) - { - struct qcom_pcie *pcie = to_qcom_pcie(pp); - int ret; -@@ -541,12 +541,13 @@ static void qcom_pcie_host_init(struct p - if (ret) - goto err; - -- return; -+ return 0; - err: - qcom_ep_reset_assert(pcie); - phy_power_off(pcie->phy); - err_deinit: - pcie->ops->deinit(pcie); -+ return ret; - } - - static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, diff --git a/target/linux/ipq806x/patches-4.9/0071-5-PCI-qcom-Programming-the-PCIE-iATU-for-IPQ806x.patch b/target/linux/ipq806x/patches-4.9/0071-5-PCI-qcom-Programming-the-PCIE-iATU-for-IPQ806x.patch deleted file mode 100644 index 98e2b54e3..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-5-PCI-qcom-Programming-the-PCIE-iATU-for-IPQ806x.patch +++ /dev/null @@ -1,113 +0,0 @@ -From d27c303e828d7e42f339a459d2abfe30c51698e9 Mon Sep 17 00:00:00 2001 -From: Sham Muthayyan -Date: Tue, 26 Jul 2016 12:28:31 +0530 -Subject: PCI: qcom: Programming the PCIE iATU for IPQ806x - -Resolved PCIE EP detection errors caused due to missing iATU programming. - -Change-Id: Ie95c0f8cb940abc0192a8a3c4e825ddba54b72fe -Signed-off-by: Sham Muthayyan ---- - drivers/pci/host/pcie-qcom.c | 77 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 77 insertions(+) - ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -52,6 +52,29 @@ - #define PCIE20_ELBI_SYS_CTRL_LT_ENABLE BIT(0) - - #define PCIE20_CAP 0x70 -+#define PCIE20_CAP_LINKCTRLSTATUS (PCIE20_CAP + 0x10) -+ -+#define PCIE20_AXI_MSTR_RESP_COMP_CTRL0 0x818 -+#define PCIE20_AXI_MSTR_RESP_COMP_CTRL1 0x81c -+ -+#define PCIE20_PLR_IATU_VIEWPORT 0x900 -+#define PCIE20_PLR_IATU_REGION_OUTBOUND (0x0 << 31) -+#define PCIE20_PLR_IATU_REGION_INDEX(x) (x << 0) -+ -+#define PCIE20_PLR_IATU_CTRL1 0x904 -+#define PCIE20_PLR_IATU_TYPE_CFG0 (0x4 << 0) -+#define PCIE20_PLR_IATU_TYPE_MEM (0x0 << 0) -+ -+#define PCIE20_PLR_IATU_CTRL2 0x908 -+#define PCIE20_PLR_IATU_ENABLE BIT(31) -+ -+#define PCIE20_PLR_IATU_LBAR 0x90C -+#define PCIE20_PLR_IATU_UBAR 0x910 -+#define PCIE20_PLR_IATU_LAR 0x914 -+#define PCIE20_PLR_IATU_LTAR 0x918 -+#define PCIE20_PLR_IATU_UTAR 0x91c -+ -+#define MSM_PCIE_DEV_CFG_ADDR 0x01000000 - - #define PERST_DELAY_US 1000 - /* PARF registers */ -@@ -163,6 +186,57 @@ static int qcom_pcie_establish_link(stru - return dw_pcie_wait_for_link(&pcie->pp); - } - -+static void qcom_pcie_prog_viewport_cfg0(struct qcom_pcie *pcie, u32 busdev) -+{ -+ struct pcie_port *pp = &pcie->pp; -+ -+ /* -+ * program and enable address translation region 0 (device config -+ * address space); region type config; -+ * axi config address range to device config address range -+ */ -+ writel(PCIE20_PLR_IATU_REGION_OUTBOUND | -+ PCIE20_PLR_IATU_REGION_INDEX(0), -+ pcie->pp.dbi_base + PCIE20_PLR_IATU_VIEWPORT); -+ -+ writel(PCIE20_PLR_IATU_TYPE_CFG0, pcie->pp.dbi_base + PCIE20_PLR_IATU_CTRL1); -+ writel(PCIE20_PLR_IATU_ENABLE, pcie->pp.dbi_base + PCIE20_PLR_IATU_CTRL2); -+ writel(pp->cfg0_base, pcie->pp.dbi_base + PCIE20_PLR_IATU_LBAR); -+ writel((pp->cfg0_base >> 32), pcie->pp.dbi_base + PCIE20_PLR_IATU_UBAR); -+ writel((pp->cfg0_base + pp->cfg0_size - 1), -+ pcie->pp.dbi_base + PCIE20_PLR_IATU_LAR); -+ writel(busdev, pcie->pp.dbi_base + PCIE20_PLR_IATU_LTAR); -+ writel(0, pcie->pp.dbi_base + PCIE20_PLR_IATU_UTAR); -+} -+ -+static void qcom_pcie_prog_viewport_mem2_outbound(struct qcom_pcie *pcie) -+{ -+ struct pcie_port *pp = &pcie->pp; -+ -+ /* -+ * program and enable address translation region 2 (device resource -+ * address space); region type memory; -+ * axi device bar address range to device bar address range -+ */ -+ writel(PCIE20_PLR_IATU_REGION_OUTBOUND | -+ PCIE20_PLR_IATU_REGION_INDEX(2), -+ pcie->pp.dbi_base + PCIE20_PLR_IATU_VIEWPORT); -+ -+ writel(PCIE20_PLR_IATU_TYPE_MEM, pcie->pp.dbi_base + PCIE20_PLR_IATU_CTRL1); -+ writel(PCIE20_PLR_IATU_ENABLE, pcie->pp.dbi_base + PCIE20_PLR_IATU_CTRL2); -+ writel(pp->mem_base, pcie->pp.dbi_base + PCIE20_PLR_IATU_LBAR); -+ writel((pp->mem_base >> 32), pcie->pp.dbi_base + PCIE20_PLR_IATU_UBAR); -+ writel(pp->mem_base + pp->mem_size - 1, -+ pcie->pp.dbi_base + PCIE20_PLR_IATU_LAR); -+ writel(pp->mem_bus_addr, pcie->pp.dbi_base + PCIE20_PLR_IATU_LTAR); -+ writel(upper_32_bits(pp->mem_bus_addr), -+ pcie->pp.dbi_base + PCIE20_PLR_IATU_UTAR); -+ -+ /* 256B PCIE buffer setting */ -+ writel(0x1, pcie->pp.dbi_base + PCIE20_AXI_MSTR_RESP_COMP_CTRL0); -+ writel(0x1, pcie->pp.dbi_base + PCIE20_AXI_MSTR_RESP_COMP_CTRL1); -+} -+ - static int qcom_pcie_get_resources_v0(struct qcom_pcie *pcie) - { - struct qcom_pcie_resources_v0 *res = &pcie->res.v0; -@@ -404,6 +478,9 @@ static int qcom_pcie_init_v0(struct qcom - /* wait for clock acquisition */ - usleep_range(1000, 1500); - -+ qcom_pcie_prog_viewport_cfg0(pcie, MSM_PCIE_DEV_CFG_ADDR); -+ qcom_pcie_prog_viewport_mem2_outbound(pcie); -+ - return 0; - - err_deassert_ahb: diff --git a/target/linux/ipq806x/patches-4.9/0071-6-PCI-qcom-Force-GEN1-support.patch b/target/linux/ipq806x/patches-4.9/0071-6-PCI-qcom-Force-GEN1-support.patch deleted file mode 100644 index 91891a5b2..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-6-PCI-qcom-Force-GEN1-support.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 4910cfd150342ec7b038892262923c725a9c4001 Mon Sep 17 00:00:00 2001 -From: Sham Muthayyan -Date: Wed, 7 Sep 2016 16:44:28 +0530 -Subject: PCI: qcom: Force GEN1 support - -Change-Id: Ica54ddb737d7b851469deab1745f54bf431bd3f0 -Signed-off-by: Sham Muthayyan ---- - drivers/pci/host/pcie-qcom.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -90,6 +90,8 @@ - #define PCIE20_PARF_CONFIG_BITS 0x50 - #define PHY_RX0_EQ(x) (x << 24) - -+#define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xA0 -+ - struct qcom_pcie_resources_v0 { - struct clk *iface_clk; - struct clk *core_clk; -@@ -138,6 +140,7 @@ struct qcom_pcie { - struct phy *phy; - struct gpio_desc *reset; - struct qcom_pcie_ops *ops; -+ uint32_t force_gen1; - }; - - #define to_qcom_pcie(x) container_of(x, struct qcom_pcie, pp) -@@ -477,6 +480,11 @@ static int qcom_pcie_init_v0(struct qcom - - /* wait for clock acquisition */ - usleep_range(1000, 1500); -+ if (pcie->force_gen1) { -+ writel_relaxed((readl_relaxed( -+ pcie->pp.dbi_base + PCIE20_LNK_CONTROL2_LINK_STATUS2) | 1), -+ pcie->pp.dbi_base + PCIE20_LNK_CONTROL2_LINK_STATUS2); -+ } - - qcom_pcie_prog_viewport_cfg0(pcie, MSM_PCIE_DEV_CFG_ADDR); - qcom_pcie_prog_viewport_mem2_outbound(pcie); -@@ -666,6 +674,8 @@ static int qcom_pcie_probe(struct platfo - struct qcom_pcie *pcie; - struct pcie_port *pp; - int ret; -+ uint32_t force_gen1 = 0; -+ struct device_node *np = pdev->dev.of_node; - - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); - if (!pcie) -@@ -678,6 +688,9 @@ static int qcom_pcie_probe(struct platfo - if (IS_ERR(pcie->reset)) - return PTR_ERR(pcie->reset); - -+ of_property_read_u32(np, "force_gen1", &force_gen1); -+ pcie->force_gen1 = force_gen1; -+ - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "parf"); - pcie->parf = devm_ioremap_resource(dev, res); - if (IS_ERR(pcie->parf)) diff --git a/target/linux/ipq806x/patches-4.9/0071-7-pcie-Set-PCIE-MRRS-and-MPS-to-256B.patch b/target/linux/ipq806x/patches-4.9/0071-7-pcie-Set-PCIE-MRRS-and-MPS-to-256B.patch deleted file mode 100644 index 157386458..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-7-pcie-Set-PCIE-MRRS-and-MPS-to-256B.patch +++ /dev/null @@ -1,69 +0,0 @@ -From edff8f777c6321ca89bb950a382f409c4a126e28 Mon Sep 17 00:00:00 2001 -From: Gokul Sriram Palanisamy -Date: Thu, 15 Dec 2016 17:38:18 +0530 -Subject: pcie: Set PCIE MRRS and MPS to 256B - -Set Max Read Request Size and Max Payload Size to 256 bytes, -per chip team recommendation. - -Change-Id: I097004be2ced1b3096ffc10c318aae0b2bb155e8 -Signed-off-by: Gokul Sriram Palanisamy ---- - drivers/pci/host/pcie-qcom.c | 37 +++++++++++++++++++++++++++++++++++++ - 1 file changed, 37 insertions(+) - -(limited to 'drivers/pci/host/pcie-qcom.c') - ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -92,6 +92,14 @@ - - #define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xA0 - -+#define __set(v, a, b) (((v) << (b)) & GENMASK(a, b)) -+#define __mask(a, b) (((1 << ((a) + 1)) - 1) & ~((1 << (b)) - 1)) -+#define PCIE20_DEV_CAS 0x78 -+#define PCIE20_MRRS_MASK __mask(14, 12) -+#define PCIE20_MRRS(x) __set(x, 14, 12) -+#define PCIE20_MPS_MASK __mask(7, 5) -+#define PCIE20_MPS(x) __set(x, 7, 5) -+ - struct qcom_pcie_resources_v0 { - struct clk *iface_clk; - struct clk *core_clk; -@@ -745,6 +753,35 @@ static int qcom_pcie_probe(struct platfo - return 0; - } - -+static void qcom_pcie_fixup_final(struct pci_dev *dev) -+{ -+ int cap, err; -+ u16 ctl, reg_val; -+ -+ cap = pci_pcie_cap(dev); -+ if (!cap) -+ return; -+ -+ err = pci_read_config_word(dev, cap + PCI_EXP_DEVCTL, &ctl); -+ -+ if (err) -+ return; -+ -+ reg_val = ctl; -+ -+ if (((reg_val & PCIE20_MRRS_MASK) >> 12) > 1) -+ reg_val = (reg_val & ~(PCIE20_MRRS_MASK)) | PCIE20_MRRS(0x1); -+ -+ if (((ctl & PCIE20_MPS_MASK) >> 5) > 1) -+ reg_val = (reg_val & ~(PCIE20_MPS_MASK)) | PCIE20_MPS(0x1); -+ -+ err = pci_write_config_word(dev, cap + PCI_EXP_DEVCTL, reg_val); -+ -+ if (err) -+ pr_err("pcie config write failed %d\n", err); -+} -+DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, qcom_pcie_fixup_final); -+ - static const struct of_device_id qcom_pcie_match[] = { - { .compatible = "qcom,pcie-ipq8064", .data = &ops_v0 }, - { .compatible = "qcom,pcie-apq8064", .data = &ops_v0 }, diff --git a/target/linux/ipq806x/patches-4.9/0071-8-pcie-qcom-Fixed-pcie_phy_clk-branch-issue.patch b/target/linux/ipq806x/patches-4.9/0071-8-pcie-qcom-Fixed-pcie_phy_clk-branch-issue.patch deleted file mode 100644 index 0f5050826..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-8-pcie-qcom-Fixed-pcie_phy_clk-branch-issue.patch +++ /dev/null @@ -1,91 +0,0 @@ -From b74bab6186131eea09459eedf5d737645a3559c9 Mon Sep 17 00:00:00 2001 -From: Abhishek Sahu -Date: Thu, 22 Dec 2016 11:18:45 +0530 -Subject: pcie: qcom: Fixed pcie_phy_clk branch issue - -Following backtraces are observed in PCIe deinit operation. - - Hardware name: Qualcomm (Flattened Device Tree) - (unwind_backtrace) from [] (show_stack+0x10/0x14) - (show_stack) from [] (dump_stack+0x84/0x98) - (dump_stack) from [] (warn_slowpath_common+0x9c/0xb8) - (warn_slowpath_common) from [] (warn_slowpath_fmt+0x30/0x40) - (warn_slowpath_fmt) from [] (clk_branch_wait+0x114/0x120) - (clk_branch_wait) from [] (clk_core_disable+0xd0/0x1f4) - (clk_core_disable) from [] (clk_disable+0x24/0x30) - (clk_disable) from [] (qcom_pcie_deinit_v0+0x6c/0xb8) - (qcom_pcie_deinit_v0) from [] (qcom_pcie_host_init+0xe0/0xe8) - (qcom_pcie_host_init) from [] (dw_pcie_host_init+0x3b0/0x538) - (dw_pcie_host_init) from [] (qcom_pcie_probe+0x20c/0x2e4) - -pcie_phy_clk is generated for PCIe controller itself and the -GCC controls its branch operation. This error is coming since -the assert operations turn off the parent clock before branch -clock. Now this patch moves clk_disable_unprepare before assert -operations. - -Similarly, during probe function, the clock branch operation -should be done after dessert operation. Currently, it does not -generate any error since bootloader enables the pcie_phy_clk -but the same error is coming during probe, if bootloader -disables pcie_phy_clk. - -Change-Id: Ib29c154d10eb64363d9cc982ce5fd8107af5627d -Signed-off-by: Abhishek Sahu ---- - drivers/pci/host/pcie-qcom.c | 16 +++++++--------- - 1 file changed, 7 insertions(+), 9 deletions(-) - ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -352,6 +352,7 @@ static void qcom_pcie_deinit_v0(struct q - { - struct qcom_pcie_resources_v0 *res = &pcie->res.v0; - -+ clk_disable_unprepare(res->phy_clk); - reset_control_assert(res->pci_reset); - reset_control_assert(res->axi_reset); - reset_control_assert(res->ahb_reset); -@@ -360,7 +361,6 @@ static void qcom_pcie_deinit_v0(struct q - reset_control_assert(res->ext_reset); - clk_disable_unprepare(res->iface_clk); - clk_disable_unprepare(res->core_clk); -- clk_disable_unprepare(res->phy_clk); - clk_disable_unprepare(res->aux_clk); - clk_disable_unprepare(res->ref_clk); - regulator_disable(res->vdda); -@@ -416,12 +416,6 @@ static int qcom_pcie_init_v0(struct qcom - goto err_clk_core; - } - -- ret = clk_prepare_enable(res->phy_clk); -- if (ret) { -- dev_err(dev, "cannot prepare/enable phy clock\n"); -- goto err_clk_phy; -- } -- - ret = clk_prepare_enable(res->aux_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable aux clock\n"); -@@ -486,6 +480,12 @@ static int qcom_pcie_init_v0(struct qcom - return ret; - } - -+ ret = clk_prepare_enable(res->phy_clk); -+ if (ret) { -+ dev_err(dev, "cannot prepare/enable phy clock\n"); -+ goto err_deassert_ahb; -+ } -+ - /* wait for clock acquisition */ - usleep_range(1000, 1500); - if (pcie->force_gen1) { -@@ -504,8 +504,6 @@ err_deassert_ahb: - err_clk_ref: - clk_disable_unprepare(res->aux_clk); - err_clk_aux: -- clk_disable_unprepare(res->phy_clk); --err_clk_phy: - clk_disable_unprepare(res->core_clk); - err_clk_core: - clk_disable_unprepare(res->iface_clk); diff --git a/target/linux/ipq806x/patches-4.9/0071-9-pcie-qcom-change-duplicate-pci-reset-to-phy-reset.patch b/target/linux/ipq806x/patches-4.9/0071-9-pcie-qcom-change-duplicate-pci-reset-to-phy-reset.patch deleted file mode 100644 index a60add93c..000000000 --- a/target/linux/ipq806x/patches-4.9/0071-9-pcie-qcom-change-duplicate-pci-reset-to-phy-reset.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 1a9c48123bd09f75562b6a2ee0f0a7b2d533cd45 Mon Sep 17 00:00:00 2001 -From: Abhishek Sahu -Date: Thu, 22 Dec 2016 11:50:49 +0530 -Subject: pcie: qcom: change duplicate pci reset to phy reset - -The deinit issues reset_control_assert for pci twice and -does not contain phy reset. - -Change-Id: Iba849963c7e5f9a2a1063f0e2e89635df70b8a99 -Signed-off-by: Abhishek Sahu ---- - drivers/pci/host/pcie-qcom.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/pci/host/pcie-qcom.c -+++ b/drivers/pci/host/pcie-qcom.c -@@ -353,7 +353,7 @@ static void qcom_pcie_deinit_v0(struct q - struct qcom_pcie_resources_v0 *res = &pcie->res.v0; - - clk_disable_unprepare(res->phy_clk); -- reset_control_assert(res->pci_reset); -+ reset_control_assert(res->phy_reset); - reset_control_assert(res->axi_reset); - reset_control_assert(res->ahb_reset); - reset_control_assert(res->por_reset); diff --git a/target/linux/ipq806x/patches-4.9/0072-ipq-scm-TZ-don-t-need-clock-to-be-enabled-disabled-for-ipq.patch b/target/linux/ipq806x/patches-4.9/0072-ipq-scm-TZ-don-t-need-clock-to-be-enabled-disabled-for-ipq.patch deleted file mode 100644 index 4f0e544ab..000000000 --- a/target/linux/ipq806x/patches-4.9/0072-ipq-scm-TZ-don-t-need-clock-to-be-enabled-disabled-for-ipq.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 0fb08a02baf5114fd3bdbc5aa92d6a6cd6d5ef3f Mon Sep 17 00:00:00 2001 -From: Manoharan Vijaya Raghavan -Date: Tue, 24 Jan 2017 20:58:46 +0530 -Subject: ipq: scm: TZ don't need clock to be enabled/disabled for ipq - -When SCM was made as a platform driver, clock management was -addedfor firmware calls. This is not required for IPQ. - -Change-Id: I3d29fafe0266e51f708f2718bab03907078b0f4d -Signed-off-by: Manoharan Vijaya Raghavan ---- - drivers/firmware/qcom_scm.c | 87 +++++++++++++++++++++++++++++---------------- - 1 file changed, 57 insertions(+), 30 deletions(-) - -(limited to 'drivers/firmware/qcom_scm.c') - ---- a/drivers/firmware/qcom_scm.c -+++ b/drivers/firmware/qcom_scm.c -@@ -28,12 +28,15 @@ - - #include "qcom_scm.h" - -+#define SCM_NOCLK 1 -+ - struct qcom_scm { - struct device *dev; - struct clk *core_clk; - struct clk *iface_clk; - struct clk *bus_clk; - struct reset_controller_dev reset; -+ int is_clkdisabled; - }; - - static struct qcom_scm *__scm; -@@ -42,6 +45,9 @@ static int qcom_scm_clk_enable(void) - { - int ret; - -+ if (__scm->is_clkdisabled) -+ return 0; -+ - ret = clk_prepare_enable(__scm->core_clk); - if (ret) - goto bail; -@@ -66,6 +72,9 @@ bail: - - static void qcom_scm_clk_disable(void) - { -+ if (__scm->is_clkdisabled) -+ return; -+ - clk_disable_unprepare(__scm->core_clk); - clk_disable_unprepare(__scm->iface_clk); - clk_disable_unprepare(__scm->bus_clk); -@@ -320,37 +329,61 @@ bool qcom_scm_is_available(void) - } - EXPORT_SYMBOL(qcom_scm_is_available); - -+static const struct of_device_id qcom_scm_dt_match[] = { -+ { .compatible = "qcom,scm-apq8064",}, -+ { .compatible = "qcom,scm-msm8660",}, -+ { .compatible = "qcom,scm-msm8960",}, -+ { .compatible = "qcom,scm-ipq807x", .data = (void *)SCM_NOCLK }, -+ { .compatible = "qcom,scm-ipq806x", .data = (void *)SCM_NOCLK }, -+ { .compatible = "qcom,scm-ipq40xx", .data = (void *)SCM_NOCLK }, -+ { .compatible = "qcom,scm-msm8960",}, -+ { .compatible = "qcom,scm-msm8960",}, -+ { .compatible = "qcom,scm",}, -+ {} -+}; -+ - static int qcom_scm_probe(struct platform_device *pdev) - { - struct qcom_scm *scm; -+ const struct of_device_id *id; - int ret; - - scm = devm_kzalloc(&pdev->dev, sizeof(*scm), GFP_KERNEL); - if (!scm) - return -ENOMEM; - -- scm->core_clk = devm_clk_get(&pdev->dev, "core"); -- if (IS_ERR(scm->core_clk)) { -- if (PTR_ERR(scm->core_clk) == -EPROBE_DEFER) -- return PTR_ERR(scm->core_clk); -+ id = of_match_device(qcom_scm_dt_match, &pdev->dev); -+ if (id) -+ scm->is_clkdisabled = (unsigned int)id->data; -+ else -+ scm->is_clkdisabled = 0; -+ -+ if (!(scm->is_clkdisabled)) { -+ -+ scm->core_clk = devm_clk_get(&pdev->dev, "core"); -+ if (IS_ERR(scm->core_clk)) { -+ if (PTR_ERR(scm->core_clk) == -EPROBE_DEFER) -+ return PTR_ERR(scm->core_clk); - -- scm->core_clk = NULL; -- } -- -- if (of_device_is_compatible(pdev->dev.of_node, "qcom,scm")) { -- scm->iface_clk = devm_clk_get(&pdev->dev, "iface"); -- if (IS_ERR(scm->iface_clk)) { -- if (PTR_ERR(scm->iface_clk) != -EPROBE_DEFER) -- dev_err(&pdev->dev, "failed to acquire iface clk\n"); -- return PTR_ERR(scm->iface_clk); -+ scm->core_clk = NULL; - } - -- scm->bus_clk = devm_clk_get(&pdev->dev, "bus"); -- if (IS_ERR(scm->bus_clk)) { -- if (PTR_ERR(scm->bus_clk) != -EPROBE_DEFER) -- dev_err(&pdev->dev, "failed to acquire bus clk\n"); -- return PTR_ERR(scm->bus_clk); -+ if (of_device_is_compatible(pdev->dev.of_node, "qcom,scm")) { -+ scm->iface_clk = devm_clk_get(&pdev->dev, "iface"); -+ if (IS_ERR(scm->iface_clk)) { -+ if (PTR_ERR(scm->iface_clk) != -EPROBE_DEFER) -+ dev_err(&pdev->dev, "failed to acquire iface clk\n"); -+ return PTR_ERR(scm->iface_clk); -+ } -+ -+ scm->bus_clk = devm_clk_get(&pdev->dev, "bus"); -+ if (IS_ERR(scm->bus_clk)) { -+ if (PTR_ERR(scm->bus_clk) != -EPROBE_DEFER) -+ dev_err(&pdev->dev, "failed to acquire bus clk\n"); -+ return PTR_ERR(scm->bus_clk); -+ } - } -+ - } - - scm->reset.ops = &qcom_scm_pas_reset_ops; -@@ -358,10 +391,12 @@ static int qcom_scm_probe(struct platfor - scm->reset.of_node = pdev->dev.of_node; - reset_controller_register(&scm->reset); - -- /* vote for max clk rate for highest performance */ -- ret = clk_set_rate(scm->core_clk, INT_MAX); -- if (ret) -- return ret; -+ if (!(scm->is_clkdisabled)) { -+ /* vote for max clk rate for highest performance */ -+ ret = clk_set_rate(scm->core_clk, INT_MAX); -+ if (ret) -+ return ret; -+ } - - __scm = scm; - __scm->dev = &pdev->dev; -@@ -371,14 +406,6 @@ static int qcom_scm_probe(struct platfor - return 0; - } - --static const struct of_device_id qcom_scm_dt_match[] = { -- { .compatible = "qcom,scm-apq8064",}, -- { .compatible = "qcom,scm-msm8660",}, -- { .compatible = "qcom,scm-msm8960",}, -- { .compatible = "qcom,scm",}, -- {} --}; -- - static struct platform_driver qcom_scm_driver = { - .driver = { - .name = "qcom_scm", diff --git a/target/linux/ipq806x/patches-4.9/0073-pinctrl-qom-use-scm_call-to-route-GPIO-irq-to-Apps.patch b/target/linux/ipq806x/patches-4.9/0073-pinctrl-qom-use-scm_call-to-route-GPIO-irq-to-Apps.patch deleted file mode 100644 index c6a0470ea..000000000 --- a/target/linux/ipq806x/patches-4.9/0073-pinctrl-qom-use-scm_call-to-route-GPIO-irq-to-Apps.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 2034addc7e193dc81d7ca60d8884832751b76758 Mon Sep 17 00:00:00 2001 -From: Ajay Kishore -Date: Tue, 24 Jan 2017 14:14:16 +0530 -Subject: pinctrl: qcom: use scm_call to route GPIO irq to Apps - -For IPQ806x targets, TZ protects the registers that are used to -configure the routing of interrupts to a target processor. -To resolve this, this patch uses scm call to route GPIO interrupts -to application processor. Also the scm call interface is changed. - -Change-Id: Ib6c06829d04bc8c20483c36e63da92e26cdef9ce -Signed-off-by: Ajay Kishore ---- - drivers/firmware/qcom_scm-32.c | 17 +++++++++++++++++ - drivers/firmware/qcom_scm-64.c | 9 +++++++++ - drivers/firmware/qcom_scm.c | 13 +++++++++++++ - drivers/firmware/qcom_scm.h | 8 ++++++++ - drivers/pinctrl/qcom/pinctrl-msm.c | 34 ++++++++++++++++++++++++++++------ - include/linux/qcom_scm.h | 3 ++- - 6 files changed, 77 insertions(+), 7 deletions(-) - ---- a/drivers/firmware/qcom_scm-32.c -+++ b/drivers/firmware/qcom_scm-32.c -@@ -560,3 +560,21 @@ int __qcom_scm_pas_mss_reset(struct devi - - return ret ? : le32_to_cpu(out); - } -+ -+int __qcom_scm_pinmux_read(u32 svc_id, u32 cmd_id, u32 arg1) -+{ -+ s32 ret; -+ -+ ret = qcom_scm_call_atomic1(svc_id, cmd_id, arg1); -+ -+ return ret; -+} -+ -+int __qcom_scm_pinmux_write(u32 svc_id, u32 cmd_id, u32 arg1, u32 arg2) -+{ -+ s32 ret; -+ -+ ret = qcom_scm_call_atomic2(svc_id, cmd_id, arg1, arg2); -+ -+ return ret; -+ } ---- a/drivers/firmware/qcom_scm-64.c -+++ b/drivers/firmware/qcom_scm-64.c -@@ -365,3 +365,12 @@ int __qcom_scm_pas_mss_reset(struct devi - - return ret ? : res.a1; - } -+int __qcom_scm_pinmux_read(u32 svc_id, u32 cmd_id, u32 arg1) -+{ -+ return -ENOTSUPP; -+} -+ -+int __qcom_scm_pinmux_write(u32 svc_id, u32 cmd_id, u32 arg1, u32 arg2) -+{ -+ return -ENOTSUPP; -+} ---- a/drivers/firmware/qcom_scm.c -+++ b/drivers/firmware/qcom_scm.c -@@ -443,3 +443,16 @@ static int __init qcom_scm_init(void) - return platform_driver_register(&qcom_scm_driver); - } - subsys_initcall(qcom_scm_init); -+ -+int qcom_scm_pinmux_read(u32 arg1) -+{ -+ return __qcom_scm_pinmux_read(SCM_SVC_IO_ACCESS, SCM_IO_READ, arg1); -+} -+EXPORT_SYMBOL(qcom_scm_pinmux_read); -+ -+int qcom_scm_pinmux_write(u32 arg1, u32 arg2) -+{ -+ return __qcom_scm_pinmux_write(SCM_SVC_IO_ACCESS, SCM_IO_WRITE, -+ arg1, arg2); -+} -+EXPORT_SYMBOL(qcom_scm_pinmux_write); ---- a/drivers/firmware/qcom_scm.h -+++ b/drivers/firmware/qcom_scm.h -@@ -56,6 +56,13 @@ extern int __qcom_scm_pas_auth_and_rese - extern int __qcom_scm_pas_shutdown(struct device *dev, u32 peripheral); - extern int __qcom_scm_pas_mss_reset(struct device *dev, bool reset); - -+#define SCM_IO_READ 1 -+#define SCM_IO_WRITE 2 -+#define SCM_SVC_IO_ACCESS 0x5 -+ -+s32 __qcom_scm_pinmux_read(u32 svc_id, u32 cmd_id, u32 arg1); -+s32 __qcom_scm_pinmux_write(u32 svc_id, u32 cmd_id, u32 arg1, u32 arg2); -+ - /* common error codes */ - #define QCOM_SCM_V2_EBUSY -12 - #define QCOM_SCM_ENOMEM -5 ---- a/drivers/pinctrl/qcom/pinctrl-msm.c -+++ b/drivers/pinctrl/qcom/pinctrl-msm.c -@@ -30,7 +30,8 @@ - #include - #include - #include -- -+#include -+#include - #include "../core.h" - #include "../pinconf.h" - #include "pinctrl-msm.h" -@@ -635,6 +636,9 @@ static int msm_gpio_irq_set_type(struct - const struct msm_pingroup *g; - unsigned long flags; - u32 val; -+ u32 addr; -+ int ret; -+ const __be32 *reg; - - g = &pctrl->soc->groups[d->hwirq]; - -@@ -648,11 +652,30 @@ static int msm_gpio_irq_set_type(struct - else - clear_bit(d->hwirq, pctrl->dual_edge_irqs); - -+ ret = of_device_is_compatible(pctrl->dev->of_node, -+ "qcom,ipq8064-pinctrl"); - /* Route interrupts to application cpu */ -- val = readl(pctrl->regs + g->intr_target_reg); -- val &= ~(7 << g->intr_target_bit); -- val |= g->intr_target_kpss_val << g->intr_target_bit; -- writel(val, pctrl->regs + g->intr_target_reg); -+ if (!ret) { -+ val = readl(pctrl->regs + g->intr_target_reg); -+ val &= ~(7 << g->intr_target_bit); -+ val |= g->intr_target_kpss_val << g->intr_target_bit; -+ writel(val, pctrl->regs + g->intr_target_reg); -+ } else { -+ reg = of_get_property(pctrl->dev->of_node, "reg", NULL); -+ if (reg) { -+ addr = be32_to_cpup(reg) + g->intr_target_reg; -+ val = qcom_scm_pinmux_read(addr); -+ __iormb(); -+ -+ val &= ~(7 << g->intr_target_bit); -+ val |= g->intr_target_kpss_val << g->intr_target_bit; -+ -+ __iowmb(); -+ ret = qcom_scm_pinmux_write(addr, val); -+ if (ret) -+ pr_err("\n Routing interrupts to Apps proc failed"); -+ } -+ } - - /* Update configuration for gpio. - * RAW_STATUS_EN is left on for all gpio irqs. Due to the -@@ -926,4 +949,3 @@ int msm_pinctrl_remove(struct platform_d - return 0; - } - EXPORT_SYMBOL(msm_pinctrl_remove); -- ---- a/include/linux/qcom_scm.h -+++ b/include/linux/qcom_scm.h -@@ -46,4 +46,6 @@ extern void qcom_scm_cpu_power_down(u32 - - extern u32 qcom_scm_get_version(void); - -+extern s32 qcom_scm_pinmux_read(u32 arg1); -+extern s32 qcom_scm_pinmux_write(u32 arg1, u32 arg2); - #endif diff --git a/target/linux/ipq806x/patches-4.9/0074-ipq806x-usb-Control-USB-master-reset.patch b/target/linux/ipq806x/patches-4.9/0074-ipq806x-usb-Control-USB-master-reset.patch deleted file mode 100644 index 9e0135b49..000000000 --- a/target/linux/ipq806x/patches-4.9/0074-ipq806x-usb-Control-USB-master-reset.patch +++ /dev/null @@ -1,71 +0,0 @@ -From a86bda9f8a7965f0cedd347a9c04800eb9f41ea3 Mon Sep 17 00:00:00 2001 -From: Vasudevan Murugesan -Date: Tue, 21 Jul 2015 10:22:38 +0530 -Subject: ipq806x: usb: Control USB master reset - -During removal of the glue layer(dwc3-of-simple), -USB master reset is set to active and during insertion -it is de-activated. - -Change-Id: I537dc810f6cb2a46664ee674840145066432b957 -Signed-off-by: Vasudevan Murugesan -(cherry picked from commit 4611e13580a216812f85f0801b95442d02eeb836) ---- - drivers/usb/dwc3/dwc3-of-simple.c | 22 ++++++++++++++++++++++ - 1 file changed, 12 insertions(+) - -(limited to 'drivers/usb/dwc3/dwc3-of-simple.c') - ---- a/drivers/usb/dwc3/dwc3-of-simple.c -+++ b/drivers/usb/dwc3/dwc3-of-simple.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -34,6 +35,8 @@ struct dwc3_of_simple { - struct device *dev; - struct clk **clks; - int num_clocks; -+ struct reset_control *mstr_rst_30_0; -+ struct reset_control *mstr_rst_30_1; - }; - - static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count) -@@ -102,6 +105,20 @@ static int dwc3_of_simple_probe(struct p - if (ret) - return ret; - -+ simple->mstr_rst_30_0 = devm_reset_control_get(dev, "usb30_0_mstr_rst"); -+ -+ if (!IS_ERR(simple->mstr_rst_30_0)) -+ reset_control_deassert(simple->mstr_rst_30_0); -+ else -+ dev_dbg(simple->dev, "cannot get handle for USB PHY 0 master reset control\n"); -+ -+ simple->mstr_rst_30_1 = devm_reset_control_get(dev, "usb30_1_mstr_rst"); -+ -+ if (!IS_ERR(simple->mstr_rst_30_1)) -+ reset_control_deassert(simple->mstr_rst_30_1); -+ else -+ dev_dbg(simple->dev, "cannot get handle for USB PHY 1 master reset control\n"); -+ - ret = of_platform_populate(np, NULL, NULL, dev); - if (ret) { - for (i = 0; i < simple->num_clocks; i++) { -@@ -130,6 +147,12 @@ static int dwc3_of_simple_remove(struct - clk_put(simple->clks[i]); - } - -+ if (!IS_ERR(simple->mstr_rst_30_0)) -+ reset_control_assert(simple->mstr_rst_30_0); -+ -+ if (!IS_ERR(simple->mstr_rst_30_1)) -+ reset_control_assert(simple->mstr_rst_30_1); -+ - of_platform_depopulate(dev); - - pm_runtime_put_sync(dev); diff --git a/target/linux/ipq806x/patches-4.9/104-mtd-nand-add-Winbond-manufacturer-and-chip.patch b/target/linux/ipq806x/patches-4.9/104-mtd-nand-add-Winbond-manufacturer-and-chip.patch deleted file mode 100644 index d2b58a466..000000000 --- a/target/linux/ipq806x/patches-4.9/104-mtd-nand-add-Winbond-manufacturer-and-chip.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 07b6d0cdbbda8c917480eceaec668f09e4cf24a5 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Mon, 14 Nov 2016 23:49:22 +0100 -Subject: [PATCH] mtd: nand: add Winbond manufacturer and chip - -This patch adds the W25N01GV NAND to the table of -known devices. Without this patch the device gets detected: - -nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa -nand: Unknown NAND 256MiB 1,8V 8-bit -nand: 256 MiB, SLC, erase size: 64 KiB, page size: 1024, OOB size : 16 - -Whereas the u-boot identifies it as: -spi_nand: spi_nand_flash_probe SF NAND ID 00:ef:aa:21 -SF: Detected W25N01GV with page size 2 KiB, total 128 MiB - -Due to the page size discrepancy, it's impossible to attach -ubi volumes on the device. - -Signed-off-by: Christian Lamparter ---- - drivers/mtd/nand/nand_ids.c | 4 ++++ - include/linux/mtd/nand.h | 1 + - 2 files changed, 5 insertions(+) - ---- a/drivers/mtd/nand/nand_ids.c -+++ b/drivers/mtd/nand/nand_ids.c -@@ -52,6 +52,10 @@ struct nand_flash_dev nand_flash_ids[] = - { .id = {0xad, 0xde, 0x94, 0xda, 0x74, 0xc4} }, - SZ_8K, SZ_8K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640, - NAND_ECC_INFO(40, SZ_1K), 4 }, -+ {"W25N01GV 1G 3.3V 8-bit", -+ { .id = {0xef, 0xaa} }, -+ SZ_2K, SZ_128, SZ_128K, NAND_NO_SUBPAGE_WRITE, -+ 2, 64, NAND_ECC_INFO(1, SZ_512) }, - - LEGACY_ID_NAND("NAND 4MiB 5V 8-bit", 0x6B, 4, SZ_8K, SP_OPTIONS), - LEGACY_ID_NAND("NAND 4MiB 3,3V 8-bit", 0xE3, 4, SZ_8K, SP_OPTIONS), diff --git a/target/linux/ipq806x/patches-4.9/105-mtd-nor-add-mx25l25635f.patch b/target/linux/ipq806x/patches-4.9/105-mtd-nor-add-mx25l25635f.patch deleted file mode 100644 index edfafda48..000000000 --- a/target/linux/ipq806x/patches-4.9/105-mtd-nor-add-mx25l25635f.patch +++ /dev/null @@ -1,22 +0,0 @@ -Subject: mtd: spi-nor: add mx25l25635f with SECT_4K - -This patch fixes an issue with the creation of the -ubi volume on the AVM FRITZ!Box 4040. The mx25l25635f -and mx25l25635e support SECT_4K which will set the -erase size to 4K. This is used by ubi to calculate -VID header offsets. Without this, uboot and linux -disagrees about the layout and refuse to attach -the ubi volume created by the other. - ---- ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1018,7 +1018,7 @@ static const struct flash_info spi_nor_i - { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, -- { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, -+ { "mx25l25635f", INFO(0xc22019, 0, 64 * 1024, 512, SECT_4K) }, - { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) }, - { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, - { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, diff --git a/target/linux/ipq806x/patches-4.9/310-msm-adhoc-bus-support.patch b/target/linux/ipq806x/patches-4.9/310-msm-adhoc-bus-support.patch deleted file mode 100644 index ff0e1e0fe..000000000 --- a/target/linux/ipq806x/patches-4.9/310-msm-adhoc-bus-support.patch +++ /dev/null @@ -1,11026 +0,0 @@ -From: Christian Lamparter -Subject: BUS: add MSM_BUS ---- a/drivers/bus/Makefile -+++ b/drivers/bus/Makefile -@@ -10,6 +10,7 @@ obj-$(CONFIG_BRCMSTB_GISB_ARB) += brcmst - obj-$(CONFIG_IMX_WEIM) += imx-weim.o - obj-$(CONFIG_MIPS_CDMM) += mips_cdmm.o - obj-$(CONFIG_MVEBU_MBUS) += mvebu-mbus.o -+obj-$(CONFIG_BUS_TOPOLOGY_ADHOC)+= msm_bus/ - - # Interconnect bus driver for OMAP SoCs. - obj-$(CONFIG_OMAP_INTERCONNECT) += omap_l3_smx.o omap_l3_noc.o ---- a/drivers/bus/Kconfig -+++ b/drivers/bus/Kconfig -@@ -92,6 +92,8 @@ config MVEBU_MBUS - Driver needed for the MBus configuration on Marvell EBU SoCs - (Kirkwood, Dove, Orion5x, MV78XX0 and Armada 370/XP). - -+source "drivers/bus/msm_bus/Kconfig" -+ - config OMAP_INTERCONNECT - tristate "OMAP INTERCONNECT DRIVER" - depends on ARCH_OMAP2PLUS ---- /dev/null -+++ b/include/dt-bindings/msm/msm-bus-ids.h -@@ -0,0 +1,869 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef __MSM_BUS_IDS_H -+#define __MSM_BUS_IDS_H -+ -+/* Topology related enums */ -+#define MSM_BUS_FAB_DEFAULT 0 -+#define MSM_BUS_FAB_APPSS 0 -+#define MSM_BUS_FAB_SYSTEM 1024 -+#define MSM_BUS_FAB_MMSS 2048 -+#define MSM_BUS_FAB_SYSTEM_FPB 3072 -+#define MSM_BUS_FAB_CPSS_FPB 4096 -+ -+#define MSM_BUS_FAB_BIMC 0 -+#define MSM_BUS_FAB_SYS_NOC 1024 -+#define MSM_BUS_FAB_MMSS_NOC 2048 -+#define MSM_BUS_FAB_OCMEM_NOC 3072 -+#define MSM_BUS_FAB_PERIPH_NOC 4096 -+#define MSM_BUS_FAB_CONFIG_NOC 5120 -+#define MSM_BUS_FAB_OCMEM_VNOC 6144 -+#define MSM_BUS_FAB_MMSS_AHB 2049 -+#define MSM_BUS_FAB_A0_NOC 6145 -+#define MSM_BUS_FAB_A1_NOC 6146 -+#define MSM_BUS_FAB_A2_NOC 6147 -+ -+#define MSM_BUS_MASTER_FIRST 1 -+#define MSM_BUS_MASTER_AMPSS_M0 1 -+#define MSM_BUS_MASTER_AMPSS_M1 2 -+#define MSM_BUS_APPSS_MASTER_FAB_MMSS 3 -+#define MSM_BUS_APPSS_MASTER_FAB_SYSTEM 4 -+#define MSM_BUS_SYSTEM_MASTER_FAB_APPSS 5 -+#define MSM_BUS_MASTER_SPS 6 -+#define MSM_BUS_MASTER_ADM_PORT0 7 -+#define MSM_BUS_MASTER_ADM_PORT1 8 -+#define MSM_BUS_SYSTEM_MASTER_ADM1_PORT0 9 -+#define MSM_BUS_MASTER_ADM1_PORT1 10 -+#define MSM_BUS_MASTER_LPASS_PROC 11 -+#define MSM_BUS_MASTER_MSS_PROCI 12 -+#define MSM_BUS_MASTER_MSS_PROCD 13 -+#define MSM_BUS_MASTER_MSS_MDM_PORT0 14 -+#define MSM_BUS_MASTER_LPASS 15 -+#define MSM_BUS_SYSTEM_MASTER_CPSS_FPB 16 -+#define MSM_BUS_SYSTEM_MASTER_SYSTEM_FPB 17 -+#define MSM_BUS_SYSTEM_MASTER_MMSS_FPB 18 -+#define MSM_BUS_MASTER_ADM1_CI 19 -+#define MSM_BUS_MASTER_ADM0_CI 20 -+#define MSM_BUS_MASTER_MSS_MDM_PORT1 21 -+#define MSM_BUS_MASTER_MDP_PORT0 22 -+#define MSM_BUS_MASTER_MDP_PORT1 23 -+#define MSM_BUS_MMSS_MASTER_ADM1_PORT0 24 -+#define MSM_BUS_MASTER_ROTATOR 25 -+#define MSM_BUS_MASTER_GRAPHICS_3D 26 -+#define MSM_BUS_MASTER_JPEG_DEC 27 -+#define MSM_BUS_MASTER_GRAPHICS_2D_CORE0 28 -+#define MSM_BUS_MASTER_VFE 29 -+#define MSM_BUS_MASTER_VPE 30 -+#define MSM_BUS_MASTER_JPEG_ENC 31 -+#define MSM_BUS_MASTER_GRAPHICS_2D_CORE1 32 -+#define MSM_BUS_MMSS_MASTER_APPS_FAB 33 -+#define MSM_BUS_MASTER_HD_CODEC_PORT0 34 -+#define MSM_BUS_MASTER_HD_CODEC_PORT1 35 -+#define MSM_BUS_MASTER_SPDM 36 -+#define MSM_BUS_MASTER_RPM 37 -+#define MSM_BUS_MASTER_MSS 38 -+#define MSM_BUS_MASTER_RIVA 39 -+#define MSM_BUS_MASTER_SNOC_VMEM 40 -+#define MSM_BUS_MASTER_MSS_SW_PROC 41 -+#define MSM_BUS_MASTER_MSS_FW_PROC 42 -+#define MSM_BUS_MASTER_HMSS 43 -+#define MSM_BUS_MASTER_GSS_NAV 44 -+#define MSM_BUS_MASTER_PCIE 45 -+#define MSM_BUS_MASTER_SATA 46 -+#define MSM_BUS_MASTER_CRYPTO 47 -+#define MSM_BUS_MASTER_VIDEO_CAP 48 -+#define MSM_BUS_MASTER_GRAPHICS_3D_PORT1 49 -+#define MSM_BUS_MASTER_VIDEO_ENC 50 -+#define MSM_BUS_MASTER_VIDEO_DEC 51 -+#define MSM_BUS_MASTER_LPASS_AHB 52 -+#define MSM_BUS_MASTER_QDSS_BAM 53 -+#define MSM_BUS_MASTER_SNOC_CFG 54 -+#define MSM_BUS_MASTER_CRYPTO_CORE0 55 -+#define MSM_BUS_MASTER_CRYPTO_CORE1 56 -+#define MSM_BUS_MASTER_MSS_NAV 57 -+#define MSM_BUS_MASTER_OCMEM_DMA 58 -+#define MSM_BUS_MASTER_WCSS 59 -+#define MSM_BUS_MASTER_QDSS_ETR 60 -+#define MSM_BUS_MASTER_USB3 61 -+#define MSM_BUS_MASTER_JPEG 62 -+#define MSM_BUS_MASTER_VIDEO_P0 63 -+#define MSM_BUS_MASTER_VIDEO_P1 64 -+#define MSM_BUS_MASTER_MSS_PROC 65 -+#define MSM_BUS_MASTER_JPEG_OCMEM 66 -+#define MSM_BUS_MASTER_MDP_OCMEM 67 -+#define MSM_BUS_MASTER_VIDEO_P0_OCMEM 68 -+#define MSM_BUS_MASTER_VIDEO_P1_OCMEM 69 -+#define MSM_BUS_MASTER_VFE_OCMEM 70 -+#define MSM_BUS_MASTER_CNOC_ONOC_CFG 71 -+#define MSM_BUS_MASTER_RPM_INST 72 -+#define MSM_BUS_MASTER_RPM_DATA 73 -+#define MSM_BUS_MASTER_RPM_SYS 74 -+#define MSM_BUS_MASTER_DEHR 75 -+#define MSM_BUS_MASTER_QDSS_DAP 76 -+#define MSM_BUS_MASTER_TIC 77 -+#define MSM_BUS_MASTER_SDCC_1 78 -+#define MSM_BUS_MASTER_SDCC_3 79 -+#define MSM_BUS_MASTER_SDCC_4 80 -+#define MSM_BUS_MASTER_SDCC_2 81 -+#define MSM_BUS_MASTER_TSIF 82 -+#define MSM_BUS_MASTER_BAM_DMA 83 -+#define MSM_BUS_MASTER_BLSP_2 84 -+#define MSM_BUS_MASTER_USB_HSIC 85 -+#define MSM_BUS_MASTER_BLSP_1 86 -+#define MSM_BUS_MASTER_USB_HS 87 -+#define MSM_BUS_MASTER_PNOC_CFG 88 -+#define MSM_BUS_MASTER_V_OCMEM_GFX3D 89 -+#define MSM_BUS_MASTER_IPA 90 -+#define MSM_BUS_MASTER_QPIC 91 -+#define MSM_BUS_MASTER_MDPE 92 -+#define MSM_BUS_MASTER_USB_HS2 93 -+#define MSM_BUS_MASTER_VPU 94 -+#define MSM_BUS_MASTER_UFS 95 -+#define MSM_BUS_MASTER_BCAST 96 -+#define MSM_BUS_MASTER_CRYPTO_CORE2 97 -+#define MSM_BUS_MASTER_EMAC 98 -+#define MSM_BUS_MASTER_VPU_1 99 -+#define MSM_BUS_MASTER_PCIE_1 100 -+#define MSM_BUS_MASTER_USB3_1 101 -+#define MSM_BUS_MASTER_CNOC_MNOC_MMSS_CFG 102 -+#define MSM_BUS_MASTER_CNOC_MNOC_CFG 103 -+#define MSM_BUS_MASTER_TCU_0 104 -+#define MSM_BUS_MASTER_TCU_1 105 -+#define MSM_BUS_MASTER_CPP 106 -+#define MSM_BUS_MASTER_AUDIO 107 -+#define MSM_BUS_MASTER_PCIE_2 108 -+#define MSM_BUS_MASTER_BLSP_BAM 109 -+#define MSM_BUS_MASTER_USB2_BAM 110 -+#define MSM_BUS_MASTER_ADDS_DMA0 111 -+#define MSM_BUS_MASTER_ADDS_DMA1 112 -+#define MSM_BUS_MASTER_ADDS_DMA2 113 -+#define MSM_BUS_MASTER_ADDS_DMA3 114 -+#define MSM_BUS_MASTER_QPIC_BAM 115 -+#define MSM_BUS_MASTER_SDCC_BAM 116 -+#define MSM_BUS_MASTER_DDRC_SNOC 117 -+#define MSM_BUS_MASTER_WSS_0 118 -+#define MSM_BUS_MASTER_WSS_1 119 -+#define MSM_BUS_MASTER_ESS 120 -+#define MSM_BUS_MASTER_QDSS_BAMNDP 121 -+#define MSM_BUS_MASTER_QDSS_SNOC_CFG 122 -+#define MSM_BUS_MASTER_LAST 130 -+ -+#define MSM_BUS_SYSTEM_FPB_MASTER_SYSTEM MSM_BUS_SYSTEM_MASTER_SYSTEM_FPB -+#define MSM_BUS_CPSS_FPB_MASTER_SYSTEM MSM_BUS_SYSTEM_MASTER_CPSS_FPB -+ -+#define MSM_BUS_SNOC_MM_INT_0 10000 -+#define MSM_BUS_SNOC_MM_INT_1 10001 -+#define MSM_BUS_SNOC_MM_INT_2 10002 -+#define MSM_BUS_SNOC_MM_INT_BIMC 10003 -+#define MSM_BUS_SNOC_INT_0 10004 -+#define MSM_BUS_SNOC_INT_1 10005 -+#define MSM_BUS_SNOC_INT_BIMC 10006 -+#define MSM_BUS_SNOC_BIMC_0_MAS 10007 -+#define MSM_BUS_SNOC_BIMC_1_MAS 10008 -+#define MSM_BUS_SNOC_QDSS_INT 10009 -+#define MSM_BUS_PNOC_SNOC_MAS 10010 -+#define MSM_BUS_PNOC_SNOC_SLV 10011 -+#define MSM_BUS_PNOC_INT_0 10012 -+#define MSM_BUS_PNOC_INT_1 10013 -+#define MSM_BUS_PNOC_M_0 10014 -+#define MSM_BUS_PNOC_M_1 10015 -+#define MSM_BUS_BIMC_SNOC_MAS 10016 -+#define MSM_BUS_BIMC_SNOC_SLV 10017 -+#define MSM_BUS_PNOC_SLV_0 10018 -+#define MSM_BUS_PNOC_SLV_1 10019 -+#define MSM_BUS_PNOC_SLV_2 10020 -+#define MSM_BUS_PNOC_SLV_3 10021 -+#define MSM_BUS_PNOC_SLV_4 10022 -+#define MSM_BUS_PNOC_SLV_8 10023 -+#define MSM_BUS_PNOC_SLV_9 10024 -+#define MSM_BUS_SNOC_BIMC_0_SLV 10025 -+#define MSM_BUS_SNOC_BIMC_1_SLV 10026 -+#define MSM_BUS_MNOC_BIMC_MAS 10027 -+#define MSM_BUS_MNOC_BIMC_SLV 10028 -+#define MSM_BUS_BIMC_MNOC_MAS 10029 -+#define MSM_BUS_BIMC_MNOC_SLV 10030 -+#define MSM_BUS_SNOC_BIMC_MAS 10031 -+#define MSM_BUS_SNOC_BIMC_SLV 10032 -+#define MSM_BUS_CNOC_SNOC_MAS 10033 -+#define MSM_BUS_CNOC_SNOC_SLV 10034 -+#define MSM_BUS_SNOC_CNOC_MAS 10035 -+#define MSM_BUS_SNOC_CNOC_SLV 10036 -+#define MSM_BUS_OVNOC_SNOC_MAS 10037 -+#define MSM_BUS_OVNOC_SNOC_SLV 10038 -+#define MSM_BUS_SNOC_OVNOC_MAS 10039 -+#define MSM_BUS_SNOC_OVNOC_SLV 10040 -+#define MSM_BUS_SNOC_PNOC_MAS 10041 -+#define MSM_BUS_SNOC_PNOC_SLV 10042 -+#define MSM_BUS_BIMC_INT_APPS_EBI 10043 -+#define MSM_BUS_BIMC_INT_APPS_SNOC 10044 -+#define MSM_BUS_SNOC_BIMC_2_MAS 10045 -+#define MSM_BUS_SNOC_BIMC_2_SLV 10046 -+#define MSM_BUS_PNOC_SLV_5 10047 -+#define MSM_BUS_PNOC_SLV_6 10048 -+#define MSM_BUS_PNOC_INT_2 10049 -+#define MSM_BUS_PNOC_INT_3 10050 -+#define MSM_BUS_PNOC_INT_4 10051 -+#define MSM_BUS_PNOC_INT_5 10052 -+#define MSM_BUS_PNOC_INT_6 10053 -+#define MSM_BUS_PNOC_INT_7 10054 -+#define MSM_BUS_BIMC_SNOC_1_MAS 10055 -+#define MSM_BUS_BIMC_SNOC_1_SLV 10056 -+#define MSM_BUS_PNOC_A1NOC_MAS 10057 -+#define MSM_BUS_PNOC_A1NOC_SLV 10058 -+#define MSM_BUS_CNOC_A1NOC_MAS 10059 -+#define MSM_BUS_A0NOC_SNOC_MAS 10060 -+#define MSM_BUS_A0NOC_SNOC_SLV 10061 -+#define MSM_BUS_A1NOC_SNOC_SLV 10062 -+#define MSM_BUS_A1NOC_SNOC_MAS 10063 -+#define MSM_BUS_A2NOC_SNOC_MAS 10064 -+#define MSM_BUS_A2NOC_SNOC_SLV 10065 -+#define MSM_BUS_PNOC_SLV_7 10066 -+#define MSM_BUS_INT_LAST 10067 -+ -+#define MSM_BUS_SLAVE_FIRST 512 -+#define MSM_BUS_SLAVE_EBI_CH0 512 -+#define MSM_BUS_SLAVE_EBI_CH1 513 -+#define MSM_BUS_SLAVE_AMPSS_L2 514 -+#define MSM_BUS_APPSS_SLAVE_FAB_MMSS 515 -+#define MSM_BUS_APPSS_SLAVE_FAB_SYSTEM 516 -+#define MSM_BUS_SYSTEM_SLAVE_FAB_APPS 517 -+#define MSM_BUS_SLAVE_SPS 518 -+#define MSM_BUS_SLAVE_SYSTEM_IMEM 519 -+#define MSM_BUS_SLAVE_AMPSS 520 -+#define MSM_BUS_SLAVE_MSS 521 -+#define MSM_BUS_SLAVE_LPASS 522 -+#define MSM_BUS_SYSTEM_SLAVE_CPSS_FPB 523 -+#define MSM_BUS_SYSTEM_SLAVE_SYSTEM_FPB 524 -+#define MSM_BUS_SYSTEM_SLAVE_MMSS_FPB 525 -+#define MSM_BUS_SLAVE_CORESIGHT 526 -+#define MSM_BUS_SLAVE_RIVA 527 -+#define MSM_BUS_SLAVE_SMI 528 -+#define MSM_BUS_MMSS_SLAVE_FAB_APPS 529 -+#define MSM_BUS_MMSS_SLAVE_FAB_APPS_1 530 -+#define MSM_BUS_SLAVE_MM_IMEM 531 -+#define MSM_BUS_SLAVE_CRYPTO 532 -+#define MSM_BUS_SLAVE_SPDM 533 -+#define MSM_BUS_SLAVE_RPM 534 -+#define MSM_BUS_SLAVE_RPM_MSG_RAM 535 -+#define MSM_BUS_SLAVE_MPM 536 -+#define MSM_BUS_SLAVE_PMIC1_SSBI1_A 537 -+#define MSM_BUS_SLAVE_PMIC1_SSBI1_B 538 -+#define MSM_BUS_SLAVE_PMIC1_SSBI1_C 539 -+#define MSM_BUS_SLAVE_PMIC2_SSBI2_A 540 -+#define MSM_BUS_SLAVE_PMIC2_SSBI2_B 541 -+#define MSM_BUS_SLAVE_GSBI1_UART 542 -+#define MSM_BUS_SLAVE_GSBI2_UART 543 -+#define MSM_BUS_SLAVE_GSBI3_UART 544 -+#define MSM_BUS_SLAVE_GSBI4_UART 545 -+#define MSM_BUS_SLAVE_GSBI5_UART 546 -+#define MSM_BUS_SLAVE_GSBI6_UART 547 -+#define MSM_BUS_SLAVE_GSBI7_UART 548 -+#define MSM_BUS_SLAVE_GSBI8_UART 549 -+#define MSM_BUS_SLAVE_GSBI9_UART 550 -+#define MSM_BUS_SLAVE_GSBI10_UART 551 -+#define MSM_BUS_SLAVE_GSBI11_UART 552 -+#define MSM_BUS_SLAVE_GSBI12_UART 553 -+#define MSM_BUS_SLAVE_GSBI1_QUP 554 -+#define MSM_BUS_SLAVE_GSBI2_QUP 555 -+#define MSM_BUS_SLAVE_GSBI3_QUP 556 -+#define MSM_BUS_SLAVE_GSBI4_QUP 557 -+#define MSM_BUS_SLAVE_GSBI5_QUP 558 -+#define MSM_BUS_SLAVE_GSBI6_QUP 559 -+#define MSM_BUS_SLAVE_GSBI7_QUP 560 -+#define MSM_BUS_SLAVE_GSBI8_QUP 561 -+#define MSM_BUS_SLAVE_GSBI9_QUP 562 -+#define MSM_BUS_SLAVE_GSBI10_QUP 563 -+#define MSM_BUS_SLAVE_GSBI11_QUP 564 -+#define MSM_BUS_SLAVE_GSBI12_QUP 565 -+#define MSM_BUS_SLAVE_EBI2_NAND 566 -+#define MSM_BUS_SLAVE_EBI2_CS0 567 -+#define MSM_BUS_SLAVE_EBI2_CS1 568 -+#define MSM_BUS_SLAVE_EBI2_CS2 569 -+#define MSM_BUS_SLAVE_EBI2_CS3 570 -+#define MSM_BUS_SLAVE_EBI2_CS4 571 -+#define MSM_BUS_SLAVE_EBI2_CS5 572 -+#define MSM_BUS_SLAVE_USB_FS1 573 -+#define MSM_BUS_SLAVE_USB_FS2 574 -+#define MSM_BUS_SLAVE_TSIF 575 -+#define MSM_BUS_SLAVE_MSM_TSSC 576 -+#define MSM_BUS_SLAVE_MSM_PDM 577 -+#define MSM_BUS_SLAVE_MSM_DIMEM 578 -+#define MSM_BUS_SLAVE_MSM_TCSR 579 -+#define MSM_BUS_SLAVE_MSM_PRNG 580 -+#define MSM_BUS_SLAVE_GSS 581 -+#define MSM_BUS_SLAVE_SATA 582 -+#define MSM_BUS_SLAVE_USB3 583 -+#define MSM_BUS_SLAVE_WCSS 584 -+#define MSM_BUS_SLAVE_OCIMEM 585 -+#define MSM_BUS_SLAVE_SNOC_OCMEM 586 -+#define MSM_BUS_SLAVE_SERVICE_SNOC 587 -+#define MSM_BUS_SLAVE_QDSS_STM 588 -+#define MSM_BUS_SLAVE_CAMERA_CFG 589 -+#define MSM_BUS_SLAVE_DISPLAY_CFG 590 -+#define MSM_BUS_SLAVE_OCMEM_CFG 591 -+#define MSM_BUS_SLAVE_CPR_CFG 592 -+#define MSM_BUS_SLAVE_CPR_XPU_CFG 593 -+#define MSM_BUS_SLAVE_MISC_CFG 594 -+#define MSM_BUS_SLAVE_MISC_XPU_CFG 595 -+#define MSM_BUS_SLAVE_VENUS_CFG 596 -+#define MSM_BUS_SLAVE_MISC_VENUS_CFG 597 -+#define MSM_BUS_SLAVE_GRAPHICS_3D_CFG 598 -+#define MSM_BUS_SLAVE_MMSS_CLK_CFG 599 -+#define MSM_BUS_SLAVE_MMSS_CLK_XPU_CFG 600 -+#define MSM_BUS_SLAVE_MNOC_MPU_CFG 601 -+#define MSM_BUS_SLAVE_ONOC_MPU_CFG 602 -+#define MSM_BUS_SLAVE_SERVICE_MNOC 603 -+#define MSM_BUS_SLAVE_OCMEM 604 -+#define MSM_BUS_SLAVE_SERVICE_ONOC 605 -+#define MSM_BUS_SLAVE_SDCC_1 606 -+#define MSM_BUS_SLAVE_SDCC_3 607 -+#define MSM_BUS_SLAVE_SDCC_2 608 -+#define MSM_BUS_SLAVE_SDCC_4 609 -+#define MSM_BUS_SLAVE_BAM_DMA 610 -+#define MSM_BUS_SLAVE_BLSP_2 611 -+#define MSM_BUS_SLAVE_USB_HSIC 612 -+#define MSM_BUS_SLAVE_BLSP_1 613 -+#define MSM_BUS_SLAVE_USB_HS 614 -+#define MSM_BUS_SLAVE_PDM 615 -+#define MSM_BUS_SLAVE_PERIPH_APU_CFG 616 -+#define MSM_BUS_SLAVE_PNOC_MPU_CFG 617 -+#define MSM_BUS_SLAVE_PRNG 618 -+#define MSM_BUS_SLAVE_SERVICE_PNOC 619 -+#define MSM_BUS_SLAVE_CLK_CTL 620 -+#define MSM_BUS_SLAVE_CNOC_MSS 621 -+#define MSM_BUS_SLAVE_SECURITY 622 -+#define MSM_BUS_SLAVE_TCSR 623 -+#define MSM_BUS_SLAVE_TLMM 624 -+#define MSM_BUS_SLAVE_CRYPTO_0_CFG 625 -+#define MSM_BUS_SLAVE_CRYPTO_1_CFG 626 -+#define MSM_BUS_SLAVE_IMEM_CFG 627 -+#define MSM_BUS_SLAVE_MESSAGE_RAM 628 -+#define MSM_BUS_SLAVE_BIMC_CFG 629 -+#define MSM_BUS_SLAVE_BOOT_ROM 630 -+#define MSM_BUS_SLAVE_CNOC_MNOC_MMSS_CFG 631 -+#define MSM_BUS_SLAVE_PMIC_ARB 632 -+#define MSM_BUS_SLAVE_SPDM_WRAPPER 633 -+#define MSM_BUS_SLAVE_DEHR_CFG 634 -+#define MSM_BUS_SLAVE_QDSS_CFG 635 -+#define MSM_BUS_SLAVE_RBCPR_CFG 636 -+#define MSM_BUS_SLAVE_RBCPR_QDSS_APU_CFG 637 -+#define MSM_BUS_SLAVE_SNOC_MPU_CFG 638 -+#define MSM_BUS_SLAVE_CNOC_ONOC_CFG 639 -+#define MSM_BUS_SLAVE_CNOC_MNOC_CFG 640 -+#define MSM_BUS_SLAVE_PNOC_CFG 641 -+#define MSM_BUS_SLAVE_SNOC_CFG 642 -+#define MSM_BUS_SLAVE_EBI1_DLL_CFG 643 -+#define MSM_BUS_SLAVE_PHY_APU_CFG 644 -+#define MSM_BUS_SLAVE_EBI1_PHY_CFG 645 -+#define MSM_BUS_SLAVE_SERVICE_CNOC 646 -+#define MSM_BUS_SLAVE_IPS_CFG 647 -+#define MSM_BUS_SLAVE_QPIC 648 -+#define MSM_BUS_SLAVE_DSI_CFG 649 -+#define MSM_BUS_SLAVE_UFS_CFG 650 -+#define MSM_BUS_SLAVE_RBCPR_CX_CFG 651 -+#define MSM_BUS_SLAVE_RBCPR_MX_CFG 652 -+#define MSM_BUS_SLAVE_PCIE_CFG 653 -+#define MSM_BUS_SLAVE_USB_PHYS_CFG 654 -+#define MSM_BUS_SLAVE_VIDEO_CAP_CFG 655 -+#define MSM_BUS_SLAVE_AVSYNC_CFG 656 -+#define MSM_BUS_SLAVE_CRYPTO_2_CFG 657 -+#define MSM_BUS_SLAVE_VPU_CFG 658 -+#define MSM_BUS_SLAVE_BCAST_CFG 659 -+#define MSM_BUS_SLAVE_KLM_CFG 660 -+#define MSM_BUS_SLAVE_GENI_IR_CFG 661 -+#define MSM_BUS_SLAVE_OCMEM_GFX 662 -+#define MSM_BUS_SLAVE_CATS_128 663 -+#define MSM_BUS_SLAVE_OCMEM_64 664 -+#define MSM_BUS_SLAVE_PCIE_0 665 -+#define MSM_BUS_SLAVE_PCIE_1 666 -+#define MSM_BUS_SLAVE_PCIE_0_CFG 667 -+#define MSM_BUS_SLAVE_PCIE_1_CFG 668 -+#define MSM_BUS_SLAVE_SRVC_MNOC 669 -+#define MSM_BUS_SLAVE_USB_HS2 670 -+#define MSM_BUS_SLAVE_AUDIO 671 -+#define MSM_BUS_SLAVE_TCU 672 -+#define MSM_BUS_SLAVE_APPSS 673 -+#define MSM_BUS_SLAVE_PCIE_PARF 674 -+#define MSM_BUS_SLAVE_USB3_PHY_CFG 675 -+#define MSM_BUS_SLAVE_IPA_CFG 676 -+#define MSM_BUS_SLAVE_A0NOC_SNOC 677 -+#define MSM_BUS_SLAVE_A1NOC_SNOC 678 -+#define MSM_BUS_SLAVE_A2NOC_SNOC 679 -+#define MSM_BUS_SLAVE_HMSS_L3 680 -+#define MSM_BUS_SLAVE_PIMEM_CFG 681 -+#define MSM_BUS_SLAVE_DCC_CFG 682 -+#define MSM_BUS_SLAVE_QDSS_RBCPR_APU_CFG 683 -+#define MSM_BUS_SLAVE_PCIE_2_CFG 684 -+#define MSM_BUS_SLAVE_PCIE20_AHB2PHY 685 -+#define MSM_BUS_SLAVE_A0NOC_CFG 686 -+#define MSM_BUS_SLAVE_A1NOC_CFG 687 -+#define MSM_BUS_SLAVE_A2NOC_CFG 688 -+#define MSM_BUS_SLAVE_A1NOC_MPU_CFG 689 -+#define MSM_BUS_SLAVE_A2NOC_MPU_CFG 690 -+#define MSM_BUS_SLAVE_A0NOC_SMMU_CFG 691 -+#define MSM_BUS_SLAVE_A1NOC_SMMU_CFG 692 -+#define MSM_BUS_SLAVE_A2NOC_SMMU_CFG 693 -+#define MSM_BUS_SLAVE_LPASS_SMMU_CFG 694 -+#define MSM_BUS_SLAVE_MMAGIC_CFG 695 -+#define MSM_BUS_SLAVE_VENUS_THROTTLE_CFG 696 -+#define MSM_BUS_SLAVE_SSC_CFG 697 -+#define MSM_BUS_SLAVE_DSA_CFG 698 -+#define MSM_BUS_SLAVE_DSA_MPU_CFG 699 -+#define MSM_BUS_SLAVE_DISPLAY_THROTTLE_CFG 700 -+#define MSM_BUS_SLAVE_SMMU_CPP_CFG 701 -+#define MSM_BUS_SLAVE_SMMU_JPEG_CFG 702 -+#define MSM_BUS_SLAVE_SMMU_MDP_CFG 703 -+#define MSM_BUS_SLAVE_SMMU_ROTATOR_CFG 704 -+#define MSM_BUS_SLAVE_SMMU_VENUS_CFG 705 -+#define MSM_BUS_SLAVE_SMMU_VFE_CFG 706 -+#define MSM_BUS_SLAVE_A0NOC_MPU_CFG 707 -+#define MSM_BUS_SLAVE_VMEM_CFG 708 -+#define MSM_BUS_SLAVE_CAMERA_THROTTLE_CFG 700 -+#define MSM_BUS_SLAVE_VMEM 709 -+#define MSM_BUS_SLAVE_AHB2PHY 710 -+#define MSM_BUS_SLAVE_PIMEM 711 -+#define MSM_BUS_SLAVE_SNOC_VMEM 712 -+#define MSM_BUS_SLAVE_PCIE_2 713 -+#define MSM_BUS_SLAVE_RBCPR_MX 714 -+#define MSM_BUS_SLAVE_RBCPR_CX 715 -+#define MSM_BUS_SLAVE_PRNG_APU_CFG 716 -+#define MSM_BUS_SLAVE_PERIPH_MPU_CFG 717 -+#define MSM_BUS_SLAVE_GCNT 718 -+#define MSM_BUS_SLAVE_ADSS_CFG 719 -+#define MSM_BUS_SLAVE_ADSS_VMIDMT_CFG 720 -+#define MSM_BUS_SLAVE_QHSS_APU_CFG 721 -+#define MSM_BUS_SLAVE_MDIO 722 -+#define MSM_BUS_SLAVE_FEPHY_CFG 723 -+#define MSM_BUS_SLAVE_SRIF 724 -+#define MSM_BUS_SLAVE_LAST 730 -+#define MSM_BUS_SLAVE_DDRC_CFG 731 -+#define MSM_BUS_SLAVE_DDRC_APU_CFG 732 -+#define MSM_BUS_SLAVE_MPU0_CFG 733 -+#define MSM_BUS_SLAVE_MPU1_CFG 734 -+#define MSM_BUS_SLAVE_MPU2_CFG 734 -+#define MSM_BUS_SLAVE_ESS_VMIDMT_CFG 735 -+#define MSM_BUS_SLAVE_ESS_APU_CFG 736 -+#define MSM_BUS_SLAVE_USB2_CFG 737 -+#define MSM_BUS_SLAVE_BLSP_CFG 738 -+#define MSM_BUS_SLAVE_QPIC_CFG 739 -+#define MSM_BUS_SLAVE_SDCC_CFG 740 -+#define MSM_BUS_SLAVE_WSS0_VMIDMT_CFG 741 -+#define MSM_BUS_SLAVE_WSS0_APU_CFG 742 -+#define MSM_BUS_SLAVE_WSS1_VMIDMT_CFG 743 -+#define MSM_BUS_SLAVE_WSS1_APU_CFG 744 -+#define MSM_BUS_SLAVE_SRVC_PCNOC 745 -+#define MSM_BUS_SLAVE_SNOC_DDRC 746 -+#define MSM_BUS_SLAVE_A7SS 747 -+#define MSM_BUS_SLAVE_WSS0_CFG 748 -+#define MSM_BUS_SLAVE_WSS1_CFG 749 -+#define MSM_BUS_SLAVE_PCIE 750 -+#define MSM_BUS_SLAVE_USB3_CFG 751 -+#define MSM_BUS_SLAVE_CRYPTO_CFG 752 -+#define MSM_BUS_SLAVE_ESS_CFG 753 -+#define MSM_BUS_SLAVE_SRVC_SNOC 754 -+ -+#define MSM_BUS_SYSTEM_FPB_SLAVE_SYSTEM MSM_BUS_SYSTEM_SLAVE_SYSTEM_FPB -+#define MSM_BUS_CPSS_FPB_SLAVE_SYSTEM MSM_BUS_SYSTEM_SLAVE_CPSS_FPB -+ -+/* -+ * ID's used in RPM messages -+ */ -+#define ICBID_MASTER_APPSS_PROC 0 -+#define ICBID_MASTER_MSS_PROC 1 -+#define ICBID_MASTER_MNOC_BIMC 2 -+#define ICBID_MASTER_SNOC_BIMC 3 -+#define ICBID_MASTER_SNOC_BIMC_0 ICBID_MASTER_SNOC_BIMC -+#define ICBID_MASTER_CNOC_MNOC_MMSS_CFG 4 -+#define ICBID_MASTER_CNOC_MNOC_CFG 5 -+#define ICBID_MASTER_GFX3D 6 -+#define ICBID_MASTER_JPEG 7 -+#define ICBID_MASTER_MDP 8 -+#define ICBID_MASTER_MDP0 ICBID_MASTER_MDP -+#define ICBID_MASTER_MDPS ICBID_MASTER_MDP -+#define ICBID_MASTER_VIDEO 9 -+#define ICBID_MASTER_VIDEO_P0 ICBID_MASTER_VIDEO -+#define ICBID_MASTER_VIDEO_P1 10 -+#define ICBID_MASTER_VFE 11 -+#define ICBID_MASTER_CNOC_ONOC_CFG 12 -+#define ICBID_MASTER_JPEG_OCMEM 13 -+#define ICBID_MASTER_MDP_OCMEM 14 -+#define ICBID_MASTER_VIDEO_P0_OCMEM 15 -+#define ICBID_MASTER_VIDEO_P1_OCMEM 16 -+#define ICBID_MASTER_VFE_OCMEM 17 -+#define ICBID_MASTER_LPASS_AHB 18 -+#define ICBID_MASTER_QDSS_BAM 19 -+#define ICBID_MASTER_SNOC_CFG 20 -+#define ICBID_MASTER_BIMC_SNOC 21 -+#define ICBID_MASTER_CNOC_SNOC 22 -+#define ICBID_MASTER_CRYPTO 23 -+#define ICBID_MASTER_CRYPTO_CORE0 ICBID_MASTER_CRYPTO -+#define ICBID_MASTER_CRYPTO_CORE1 24 -+#define ICBID_MASTER_LPASS_PROC 25 -+#define ICBID_MASTER_MSS 26 -+#define ICBID_MASTER_MSS_NAV 27 -+#define ICBID_MASTER_OCMEM_DMA 28 -+#define ICBID_MASTER_PNOC_SNOC 29 -+#define ICBID_MASTER_WCSS 30 -+#define ICBID_MASTER_QDSS_ETR 31 -+#define ICBID_MASTER_USB3 32 -+#define ICBID_MASTER_USB3_0 ICBID_MASTER_USB3 -+#define ICBID_MASTER_SDCC_1 33 -+#define ICBID_MASTER_SDCC_3 34 -+#define ICBID_MASTER_SDCC_2 35 -+#define ICBID_MASTER_SDCC_4 36 -+#define ICBID_MASTER_TSIF 37 -+#define ICBID_MASTER_BAM_DMA 38 -+#define ICBID_MASTER_BLSP_2 39 -+#define ICBID_MASTER_USB_HSIC 40 -+#define ICBID_MASTER_BLSP_1 41 -+#define ICBID_MASTER_USB_HS 42 -+#define ICBID_MASTER_USB_HS1 ICBID_MASTER_USB_HS -+#define ICBID_MASTER_PNOC_CFG 43 -+#define ICBID_MASTER_SNOC_PNOC 44 -+#define ICBID_MASTER_RPM_INST 45 -+#define ICBID_MASTER_RPM_DATA 46 -+#define ICBID_MASTER_RPM_SYS 47 -+#define ICBID_MASTER_DEHR 48 -+#define ICBID_MASTER_QDSS_DAP 49 -+#define ICBID_MASTER_SPDM 50 -+#define ICBID_MASTER_TIC 51 -+#define ICBID_MASTER_SNOC_CNOC 52 -+#define ICBID_MASTER_GFX3D_OCMEM 53 -+#define ICBID_MASTER_GFX3D_GMEM ICBID_MASTER_GFX3D_OCMEM -+#define ICBID_MASTER_OVIRT_SNOC 54 -+#define ICBID_MASTER_SNOC_OVIRT 55 -+#define ICBID_MASTER_SNOC_GVIRT ICBID_MASTER_SNOC_OVIRT -+#define ICBID_MASTER_ONOC_OVIRT 56 -+#define ICBID_MASTER_USB_HS2 57 -+#define ICBID_MASTER_QPIC 58 -+#define ICBID_MASTER_IPA 59 -+#define ICBID_MASTER_DSI 60 -+#define ICBID_MASTER_MDP1 61 -+#define ICBID_MASTER_MDPE ICBID_MASTER_MDP1 -+#define ICBID_MASTER_VPU_PROC 62 -+#define ICBID_MASTER_VPU 63 -+#define ICBID_MASTER_VPU0 ICBID_MASTER_VPU -+#define ICBID_MASTER_CRYPTO_CORE2 64 -+#define ICBID_MASTER_PCIE_0 65 -+#define ICBID_MASTER_PCIE_1 66 -+#define ICBID_MASTER_SATA 67 -+#define ICBID_MASTER_UFS 68 -+#define ICBID_MASTER_USB3_1 69 -+#define ICBID_MASTER_VIDEO_OCMEM 70 -+#define ICBID_MASTER_VPU1 71 -+#define ICBID_MASTER_VCAP 72 -+#define ICBID_MASTER_EMAC 73 -+#define ICBID_MASTER_BCAST 74 -+#define ICBID_MASTER_MMSS_PROC 75 -+#define ICBID_MASTER_SNOC_BIMC_1 76 -+#define ICBID_MASTER_SNOC_PCNOC 77 -+#define ICBID_MASTER_AUDIO 78 -+#define ICBID_MASTER_MM_INT_0 79 -+#define ICBID_MASTER_MM_INT_1 80 -+#define ICBID_MASTER_MM_INT_2 81 -+#define ICBID_MASTER_MM_INT_BIMC 82 -+#define ICBID_MASTER_MSS_INT 83 -+#define ICBID_MASTER_PCNOC_CFG 84 -+#define ICBID_MASTER_PCNOC_INT_0 85 -+#define ICBID_MASTER_PCNOC_INT_1 86 -+#define ICBID_MASTER_PCNOC_M_0 87 -+#define ICBID_MASTER_PCNOC_M_1 88 -+#define ICBID_MASTER_PCNOC_S_0 89 -+#define ICBID_MASTER_PCNOC_S_1 90 -+#define ICBID_MASTER_PCNOC_S_2 91 -+#define ICBID_MASTER_PCNOC_S_3 92 -+#define ICBID_MASTER_PCNOC_S_4 93 -+#define ICBID_MASTER_PCNOC_S_6 94 -+#define ICBID_MASTER_PCNOC_S_7 95 -+#define ICBID_MASTER_PCNOC_S_8 96 -+#define ICBID_MASTER_PCNOC_S_9 97 -+#define ICBID_MASTER_QDSS_INT 98 -+#define ICBID_MASTER_SNOC_INT_0 99 -+#define ICBID_MASTER_SNOC_INT_1 100 -+#define ICBID_MASTER_SNOC_INT_BIMC 101 -+#define ICBID_MASTER_TCU_0 102 -+#define ICBID_MASTER_TCU_1 103 -+#define ICBID_MASTER_BIMC_INT_0 104 -+#define ICBID_MASTER_BIMC_INT_1 105 -+#define ICBID_MASTER_CAMERA 106 -+#define ICBID_MASTER_RICA 107 -+#define ICBID_MASTER_PCNOC_S_5 129 -+#define ICBID_MASTER_PCNOC_INT_2 124 -+#define ICBID_MASTER_PCNOC_INT_3 125 -+#define ICBID_MASTER_PCNOC_INT_4 126 -+#define ICBID_MASTER_PCNOC_INT_5 127 -+#define ICBID_MASTER_PCNOC_INT_6 128 -+#define ICBID_MASTER_PCIE_2 119 -+#define ICBID_MASTER_MASTER_CNOC_A1NOC 116 -+#define ICBID_MASTER_A0NOC_SNOC 110 -+#define ICBID_MASTER_A1NOC_SNOC 111 -+#define ICBID_MASTER_A2NOC_SNOC 112 -+#define ICBID_MASTER_PNOC_A1NOC 117 -+#define ICBID_MASTER_ROTATOR 120 -+#define ICBID_MASTER_SNOC_VMEM 114 -+#define ICBID_MASTER_VENUS_VMEM 121 -+#define ICBID_MASTER_HMSS 118 -+#define ICBID_MASTER_BIMC_SNOC_1 109 -+#define ICBID_MASTER_CNOC_A1NOC 116 -+#define ICBID_MASTER_CPP 115 -+#define ICBID_MASTER_BLSP_BAM 130 -+#define ICBID_MASTER_USB2_BAM 131 -+#define ICBID_MASTER_ADSS_DMA0 132 -+#define ICBID_MASTER_ADSS_DMA1 133 -+#define ICBID_MASTER_ADSS_DMA2 134 -+#define ICBID_MASTER_ADSS_DMA3 135 -+#define ICBID_MASTER_QPIC_BAM 136 -+#define ICBID_MASTER_SDCC_BAM 137 -+#define ICBID_MASTER_DDRC_SNOC 138 -+#define ICBID_MASTER_WSS_0 139 -+#define ICBID_MASTER_WSS_1 140 -+#define ICBID_MASTER_ESS 141 -+#define ICBID_MASTER_PCIE 142 -+#define ICBID_MASTER_QDSS_BAMNDP 143 -+#define ICBID_MASTER_QDSS_SNOC_CFG 144 -+ -+#define ICBID_SLAVE_EBI1 0 -+#define ICBID_SLAVE_APPSS_L2 1 -+#define ICBID_SLAVE_BIMC_SNOC 2 -+#define ICBID_SLAVE_CAMERA_CFG 3 -+#define ICBID_SLAVE_DISPLAY_CFG 4 -+#define ICBID_SLAVE_OCMEM_CFG 5 -+#define ICBID_SLAVE_CPR_CFG 6 -+#define ICBID_SLAVE_CPR_XPU_CFG 7 -+#define ICBID_SLAVE_MISC_CFG 8 -+#define ICBID_SLAVE_MISC_XPU_CFG 9 -+#define ICBID_SLAVE_VENUS_CFG 10 -+#define ICBID_SLAVE_GFX3D_CFG 11 -+#define ICBID_SLAVE_MMSS_CLK_CFG 12 -+#define ICBID_SLAVE_MMSS_CLK_XPU_CFG 13 -+#define ICBID_SLAVE_MNOC_MPU_CFG 14 -+#define ICBID_SLAVE_ONOC_MPU_CFG 15 -+#define ICBID_SLAVE_MNOC_BIMC 16 -+#define ICBID_SLAVE_SERVICE_MNOC 17 -+#define ICBID_SLAVE_OCMEM 18 -+#define ICBID_SLAVE_GMEM ICBID_SLAVE_OCMEM -+#define ICBID_SLAVE_SERVICE_ONOC 19 -+#define ICBID_SLAVE_APPSS 20 -+#define ICBID_SLAVE_LPASS 21 -+#define ICBID_SLAVE_USB3 22 -+#define ICBID_SLAVE_USB3_0 ICBID_SLAVE_USB3 -+#define ICBID_SLAVE_WCSS 23 -+#define ICBID_SLAVE_SNOC_BIMC 24 -+#define ICBID_SLAVE_SNOC_BIMC_0 ICBID_SLAVE_SNOC_BIMC -+#define ICBID_SLAVE_SNOC_CNOC 25 -+#define ICBID_SLAVE_IMEM 26 -+#define ICBID_SLAVE_OCIMEM ICBID_SLAVE_IMEM -+#define ICBID_SLAVE_SNOC_OVIRT 27 -+#define ICBID_SLAVE_SNOC_GVIRT ICBID_SLAVE_SNOC_OVIRT -+#define ICBID_SLAVE_SNOC_PNOC 28 -+#define ICBID_SLAVE_SNOC_PCNOC ICBID_SLAVE_SNOC_PNOC -+#define ICBID_SLAVE_SERVICE_SNOC 29 -+#define ICBID_SLAVE_QDSS_STM 30 -+#define ICBID_SLAVE_SDCC_1 31 -+#define ICBID_SLAVE_SDCC_3 32 -+#define ICBID_SLAVE_SDCC_2 33 -+#define ICBID_SLAVE_SDCC_4 34 -+#define ICBID_SLAVE_TSIF 35 -+#define ICBID_SLAVE_BAM_DMA 36 -+#define ICBID_SLAVE_BLSP_2 37 -+#define ICBID_SLAVE_USB_HSIC 38 -+#define ICBID_SLAVE_BLSP_1 39 -+#define ICBID_SLAVE_USB_HS 40 -+#define ICBID_SLAVE_USB_HS1 ICBID_SLAVE_USB_HS -+#define ICBID_SLAVE_PDM 41 -+#define ICBID_SLAVE_PERIPH_APU_CFG 42 -+#define ICBID_SLAVE_PNOC_MPU_CFG 43 -+#define ICBID_SLAVE_PRNG 44 -+#define ICBID_SLAVE_PNOC_SNOC 45 -+#define ICBID_SLAVE_PCNOC_SNOC ICBID_SLAVE_PNOC_SNOC -+#define ICBID_SLAVE_SERVICE_PNOC 46 -+#define ICBID_SLAVE_CLK_CTL 47 -+#define ICBID_SLAVE_CNOC_MSS 48 -+#define ICBID_SLAVE_PCNOC_MSS ICBID_SLAVE_CNOC_MSS -+#define ICBID_SLAVE_SECURITY 49 -+#define ICBID_SLAVE_TCSR 50 -+#define ICBID_SLAVE_TLMM 51 -+#define ICBID_SLAVE_CRYPTO_0_CFG 52 -+#define ICBID_SLAVE_CRYPTO_1_CFG 53 -+#define ICBID_SLAVE_IMEM_CFG 54 -+#define ICBID_SLAVE_MESSAGE_RAM 55 -+#define ICBID_SLAVE_BIMC_CFG 56 -+#define ICBID_SLAVE_BOOT_ROM 57 -+#define ICBID_SLAVE_CNOC_MNOC_MMSS_CFG 58 -+#define ICBID_SLAVE_PMIC_ARB 59 -+#define ICBID_SLAVE_SPDM_WRAPPER 60 -+#define ICBID_SLAVE_DEHR_CFG 61 -+#define ICBID_SLAVE_MPM 62 -+#define ICBID_SLAVE_QDSS_CFG 63 -+#define ICBID_SLAVE_RBCPR_CFG 64 -+#define ICBID_SLAVE_RBCPR_CX_CFG ICBID_SLAVE_RBCPR_CFG -+#define ICBID_SLAVE_RBCPR_QDSS_APU_CFG 65 -+#define ICBID_SLAVE_CNOC_MNOC_CFG 66 -+#define ICBID_SLAVE_SNOC_MPU_CFG 67 -+#define ICBID_SLAVE_CNOC_ONOC_CFG 68 -+#define ICBID_SLAVE_PNOC_CFG 69 -+#define ICBID_SLAVE_SNOC_CFG 70 -+#define ICBID_SLAVE_EBI1_DLL_CFG 71 -+#define ICBID_SLAVE_PHY_APU_CFG 72 -+#define ICBID_SLAVE_EBI1_PHY_CFG 73 -+#define ICBID_SLAVE_RPM 74 -+#define ICBID_SLAVE_CNOC_SNOC 75 -+#define ICBID_SLAVE_SERVICE_CNOC 76 -+#define ICBID_SLAVE_OVIRT_SNOC 77 -+#define ICBID_SLAVE_OVIRT_OCMEM 78 -+#define ICBID_SLAVE_USB_HS2 79 -+#define ICBID_SLAVE_QPIC 80 -+#define ICBID_SLAVE_IPS_CFG 81 -+#define ICBID_SLAVE_DSI_CFG 82 -+#define ICBID_SLAVE_USB3_1 83 -+#define ICBID_SLAVE_PCIE_0 84 -+#define ICBID_SLAVE_PCIE_1 85 -+#define ICBID_SLAVE_PSS_SMMU_CFG 86 -+#define ICBID_SLAVE_CRYPTO_2_CFG 87 -+#define ICBID_SLAVE_PCIE_0_CFG 88 -+#define ICBID_SLAVE_PCIE_1_CFG 89 -+#define ICBID_SLAVE_SATA_CFG 90 -+#define ICBID_SLAVE_SPSS_GENI_IR 91 -+#define ICBID_SLAVE_UFS_CFG 92 -+#define ICBID_SLAVE_AVSYNC_CFG 93 -+#define ICBID_SLAVE_VPU_CFG 94 -+#define ICBID_SLAVE_USB_PHY_CFG 95 -+#define ICBID_SLAVE_RBCPR_MX_CFG 96 -+#define ICBID_SLAVE_PCIE_PARF 97 -+#define ICBID_SLAVE_VCAP_CFG 98 -+#define ICBID_SLAVE_EMAC_CFG 99 -+#define ICBID_SLAVE_BCAST_CFG 100 -+#define ICBID_SLAVE_KLM_CFG 101 -+#define ICBID_SLAVE_DISPLAY_PWM 102 -+#define ICBID_SLAVE_GENI 103 -+#define ICBID_SLAVE_SNOC_BIMC_1 104 -+#define ICBID_SLAVE_AUDIO 105 -+#define ICBID_SLAVE_CATS_0 106 -+#define ICBID_SLAVE_CATS_1 107 -+#define ICBID_SLAVE_MM_INT_0 108 -+#define ICBID_SLAVE_MM_INT_1 109 -+#define ICBID_SLAVE_MM_INT_2 110 -+#define ICBID_SLAVE_MM_INT_BIMC 111 -+#define ICBID_SLAVE_MMU_MODEM_XPU_CFG 112 -+#define ICBID_SLAVE_MSS_INT 113 -+#define ICBID_SLAVE_PCNOC_INT_0 114 -+#define ICBID_SLAVE_PCNOC_INT_1 115 -+#define ICBID_SLAVE_PCNOC_M_0 116 -+#define ICBID_SLAVE_PCNOC_M_1 117 -+#define ICBID_SLAVE_PCNOC_S_0 118 -+#define ICBID_SLAVE_PCNOC_S_1 119 -+#define ICBID_SLAVE_PCNOC_S_2 120 -+#define ICBID_SLAVE_PCNOC_S_3 121 -+#define ICBID_SLAVE_PCNOC_S_4 122 -+#define ICBID_SLAVE_PCNOC_S_6 123 -+#define ICBID_SLAVE_PCNOC_S_7 124 -+#define ICBID_SLAVE_PCNOC_S_8 125 -+#define ICBID_SLAVE_PCNOC_S_9 126 -+#define ICBID_SLAVE_PRNG_XPU_CFG 127 -+#define ICBID_SLAVE_QDSS_INT 128 -+#define ICBID_SLAVE_RPM_XPU_CFG 129 -+#define ICBID_SLAVE_SNOC_INT_0 130 -+#define ICBID_SLAVE_SNOC_INT_1 131 -+#define ICBID_SLAVE_SNOC_INT_BIMC 132 -+#define ICBID_SLAVE_TCU 133 -+#define ICBID_SLAVE_BIMC_INT_0 134 -+#define ICBID_SLAVE_BIMC_INT_1 135 -+#define ICBID_SLAVE_RICA_CFG 136 -+#define ICBID_SLAVE_PCNOC_S_5 189 -+#define ICBID_SLAVE_PCNOC_S_7 124 -+#define ICBID_SLAVE_PCNOC_INT_2 184 -+#define ICBID_SLAVE_PCNOC_INT_3 185 -+#define ICBID_SLAVE_PCNOC_INT_4 186 -+#define ICBID_SLAVE_PCNOC_INT_5 187 -+#define ICBID_SLAVE_PCNOC_INT_6 188 -+#define ICBID_SLAVE_USB3_PHY_CFG 182 -+#define ICBID_SLAVE_IPA_CFG 183 -+ -+#define ICBID_SLAVE_A0NOC_SNOC 141 -+#define ICBID_SLAVE_A1NOC_SNOC 142 -+#define ICBID_SLAVE_A2NOC_SNOC 143 -+#define ICBID_SLAVE_BIMC_SNOC_1 138 -+#define ICBID_SLAVE_PIMEM 167 -+#define ICBID_SLAVE_PIMEM_CFG 168 -+#define ICBID_SLAVE_DCC_CFG 155 -+#define ICBID_SLAVE_QDSS_RBCPR_APU_CFG 168 -+#define ICBID_SLAVE_A0NOC_CFG 144 -+#define ICBID_SLAVE_PCIE_2_CFG 165 -+#define ICBID_SLAVE_PCIE20_AHB2PHY 163 -+#define ICBID_SLAVE_PCIE_2 164 -+#define ICBID_SLAVE_A1NOC_CFG 147 -+#define ICBID_SLAVE_A1NOC_MPU_CFG 148 -+#define ICBID_SLAVE_A1NOC_SMMU_CFG 149 -+#define ICBID_SLAVE_A2NOC_CFG 150 -+#define ICBID_SLAVE_A2NOC_MPU_CFG 151 -+#define ICBID_SLAVE_A2NOC_SMMU_CFG 152 -+#define ICBID_SLAVE_AHB2PHY 153 -+#define ICBID_SLAVE_HMSS_L3 161 -+#define ICBID_SLAVE_LPASS_SMMU_CFG 161 -+#define ICBID_SLAVE_MMAGIC_CFG 162 -+#define ICBID_SLAVE_SSC_CFG 177 -+#define ICBID_SLAVE_VENUS_THROTTLE_CFG 178 -+#define ICBID_SLAVE_DISPLAY_THROTTLE_CFG 156 -+#define ICBID_SLAVE_CAMERA_THROTTLE_CFG 154 -+#define ICBID_SLAVE_DSA_CFG 157 -+#define ICBID_SLAVE_DSA_MPU_CFG 158 -+#define ICBID_SLAVE_SMMU_CPP_CFG 171 -+#define ICBID_SLAVE_SMMU_JPEG_CFG 172 -+#define ICBID_SLAVE_SMMU_MDP_CFG 173 -+#define ICBID_SLAVE_SMMU_ROTATOR_CFG 174 -+#define ICBID_SLAVE_SMMU_VENUS_CFG 175 -+#define ICBID_SLAVE_SMMU_VFE_CFG 176 -+#define ICBID_SLAVE_A0NOC_MPU_CFG 145 -+#define ICBID_SLAVE_A0NOC_SMMU_CFG 146 -+#define ICBID_SLAVE_VMEM_CFG 180 -+#define ICBID_SLAVE_VMEM 179 -+#define ICBID_SLAVE_PNOC_A1NOC 139 -+#define ICBID_SLAVE_SNOC_VMEM 140 -+#define ICBID_SLAVE_RBCPR_MX 170 -+#define ICBID_SLAVE_RBCPR_CX 169 -+#define ICBID_SLAVE_PRNG_APU_CFG 190 -+#define ICBID_SLAVE_PERIPH_MPU_CFG 191 -+#define ICBID_SLAVE_GCNT 192 -+#define ICBID_SLAVE_ADSS_CFG 193 -+#define ICBID_SLAVE_ADSS_APU 194 -+#define ICBID_SLAVE_ADSS_VMIDMT_CFG 195 -+#define ICBID_SLAVE_QHSS_APU_CFG 196 -+#define ICBID_SLAVE_MDIO 197 -+#define ICBID_SLAVE_FEPHY_CFG 198 -+#define ICBID_SLAVE_SRIF 199 -+#define ICBID_SLAVE_DDRC_CFG 200 -+#define ICBID_SLAVE_DDRC_APU_CFG 201 -+#define ICBID_SLAVE_DDRC_MPU0_CFG 202 -+#define ICBID_SLAVE_DDRC_MPU1_CFG 203 -+#define ICBID_SLAVE_DDRC_MPU2_CFG 210 -+#define ICBID_SLAVE_ESS_VMIDMT_CFG 211 -+#define ICBID_SLAVE_ESS_APU_CFG 212 -+#define ICBID_SLAVE_USB2_CFG 213 -+#define ICBID_SLAVE_BLSP_CFG 214 -+#define ICBID_SLAVE_QPIC_CFG 215 -+#define ICBID_SLAVE_SDCC_CFG 216 -+#define ICBID_SLAVE_WSS0_VMIDMT_CFG 217 -+#define ICBID_SLAVE_WSS0_APU_CFG 218 -+#define ICBID_SLAVE_WSS1_VMIDMT_CFG 219 -+#define ICBID_SLAVE_WSS1_APU_CFG 220 -+#define ICBID_SLAVE_SRVC_PCNOC 221 -+#define ICBID_SLAVE_SNOC_DDRC 222 -+#define ICBID_SLAVE_A7SS 223 -+#define ICBID_SLAVE_WSS0_CFG 224 -+#define ICBID_SLAVE_WSS1_CFG 225 -+#define ICBID_SLAVE_PCIE 226 -+#define ICBID_SLAVE_USB3_CFG 227 -+#define ICBID_SLAVE_CRYPTO_CFG 228 -+#define ICBID_SLAVE_ESS_CFG 229 -+#define ICBID_SLAVE_SRVC_SNOC 230 -+#endif ---- /dev/null -+++ b/include/dt-bindings/msm/msm-bus-rule-ops.h -@@ -0,0 +1,32 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef __MSM_BUS_RULE_OPS_H -+#define __MSM_BUS_RULE_OPS_H -+ -+#define FLD_IB 0 -+#define FLD_AB 1 -+#define FLD_CLK 2 -+ -+#define OP_LE 0 -+#define OP_LT 1 -+#define OP_GE 2 -+#define OP_GT 3 -+#define OP_NOOP 4 -+ -+#define RULE_STATE_NOT_APPLIED 0 -+#define RULE_STATE_APPLIED 1 -+ -+#define THROTTLE_ON 0 -+#define THROTTLE_OFF 1 -+ -+#endif ---- /dev/null -+++ b/drivers/bus/msm_bus/Kconfig -@@ -0,0 +1,19 @@ -+config BUS_TOPOLOGY_ADHOC -+ bool "ad-hoc bus scaling topology" -+ depends on ARCH_QCOM -+ default n -+ help -+ This option enables a driver that can handle adhoc bus topologies. -+ Adhoc bus topology driver allows one to many connections and maintains -+ directionality of connections by explicitly listing device connections -+ thus avoiding illegal routes. -+ -+config MSM_BUS_SCALING -+ bool "Bus scaling driver" -+ depends on BUS_TOPOLOGY_ADHOC -+ default n -+ help -+ This option enables bus scaling on MSM devices. Bus scaling -+ allows devices to request the clocks be set to rates sufficient -+ for the active devices needs without keeping the clocks at max -+ frequency when a slower speed is sufficient. ---- /dev/null -+++ b/drivers/bus/msm_bus/Makefile -@@ -0,0 +1,12 @@ -+# -+# Makefile for msm-bus driver specific files -+# -+obj-y += msm_bus_bimc.o msm_bus_noc.o msm_bus_core.o msm_bus_client_api.o \ -+ msm_bus_id.o -+obj-$(CONFIG_OF) += msm_bus_of.o -+ -+obj-y += msm_bus_fabric_adhoc.o msm_bus_arb_adhoc.o msm_bus_rules.o -+obj-$(CONFIG_OF) += msm_bus_of_adhoc.o -+obj-$(CONFIG_CORESIGHT) += msm_buspm_coresight_adhoc.o -+ -+obj-$(CONFIG_DEBUG_FS) += msm_bus_dbg.o ---- /dev/null -+++ b/drivers/bus/msm_bus/msm-bus-board.h -@@ -0,0 +1,198 @@ -+/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef __ASM_ARCH_MSM_BUS_BOARD_H -+#define __ASM_ARCH_MSM_BUS_BOARD_H -+ -+#include -+#include -+ -+enum context { -+ DUAL_CTX, -+ ACTIVE_CTX, -+ NUM_CTX -+}; -+ -+struct msm_bus_fabric_registration { -+ unsigned int id; -+ const char *name; -+ struct msm_bus_node_info *info; -+ unsigned int len; -+ int ahb; -+ const char *fabclk[NUM_CTX]; -+ const char *iface_clk; -+ unsigned int offset; -+ unsigned int haltid; -+ unsigned int rpm_enabled; -+ unsigned int nmasters; -+ unsigned int nslaves; -+ unsigned int ntieredslaves; -+ bool il_flag; -+ const struct msm_bus_board_algorithm *board_algo; -+ int hw_sel; -+ void *hw_data; -+ uint32_t qos_freq; -+ uint32_t qos_baseoffset; -+ u64 nr_lim_thresh; -+ uint32_t eff_fact; -+ uint32_t qos_delta; -+ bool virt; -+}; -+ -+struct msm_bus_device_node_registration { -+ struct msm_bus_node_device_type *info; -+ unsigned int num_devices; -+ bool virt; -+}; -+ -+enum msm_bus_bw_tier_type { -+ MSM_BUS_BW_TIER1 = 1, -+ MSM_BUS_BW_TIER2, -+ MSM_BUS_BW_COUNT, -+ MSM_BUS_BW_SIZE = 0x7FFFFFFF, -+}; -+ -+struct msm_bus_halt_vector { -+ uint32_t haltval; -+ uint32_t haltmask; -+}; -+ -+extern struct msm_bus_fabric_registration msm_bus_apps_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_sys_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_mm_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_sys_fpb_pdata; -+extern struct msm_bus_fabric_registration msm_bus_cpss_fpb_pdata; -+extern struct msm_bus_fabric_registration msm_bus_def_fab_pdata; -+ -+extern struct msm_bus_fabric_registration msm_bus_8960_apps_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8960_sys_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8960_mm_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8960_sg_mm_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8960_sys_fpb_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8960_cpss_fpb_pdata; -+ -+extern struct msm_bus_fabric_registration msm_bus_8064_apps_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8064_sys_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8064_mm_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8064_sys_fpb_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8064_cpss_fpb_pdata; -+ -+extern struct msm_bus_fabric_registration msm_bus_9615_sys_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_9615_def_fab_pdata; -+ -+extern struct msm_bus_fabric_registration msm_bus_8930_apps_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8930_sys_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8930_mm_fabric_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8930_sys_fpb_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8930_cpss_fpb_pdata; -+ -+extern struct msm_bus_fabric_registration msm_bus_8974_sys_noc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8974_mmss_noc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8974_bimc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8974_ocmem_noc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8974_periph_noc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8974_config_noc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_8974_ocmem_vnoc_pdata; -+ -+extern struct msm_bus_fabric_registration msm_bus_9625_sys_noc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_9625_bimc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_9625_periph_noc_pdata; -+extern struct msm_bus_fabric_registration msm_bus_9625_config_noc_pdata; -+ -+extern int msm_bus_device_match_adhoc(struct device *dev, void *id); -+ -+void msm_bus_rpm_set_mt_mask(void); -+int msm_bus_board_rpm_get_il_ids(uint16_t *id); -+int msm_bus_board_get_iid(int id); -+ -+#define NFAB_MSM8226 6 -+#define NFAB_MSM8610 5 -+ -+/* -+ * These macros specify the convention followed for allocating -+ * ids to fabrics, masters and slaves for 8x60. -+ * -+ * A node can be identified as a master/slave/fabric by using -+ * these ids. -+ */ -+#define FABRIC_ID_KEY 1024 -+#define SLAVE_ID_KEY ((FABRIC_ID_KEY) >> 1) -+#define MAX_FAB_KEY 7168 /* OR(All fabric ids) */ -+#define INT_NODE_START 10000 -+ -+#define GET_FABID(id) ((id) & MAX_FAB_KEY) -+ -+#define NODE_ID(id) ((id) & (FABRIC_ID_KEY - 1)) -+#define IS_SLAVE(id) ((NODE_ID(id)) >= SLAVE_ID_KEY ? 1 : 0) -+#define CHECK_ID(iid, id) (((iid & id) != id) ? -ENXIO : iid) -+ -+/* -+ * The following macros are used to format the data for port halt -+ * and unhalt requests. -+ */ -+#define MSM_BUS_CLK_HALT 0x1 -+#define MSM_BUS_CLK_HALT_MASK 0x1 -+#define MSM_BUS_CLK_HALT_FIELDSIZE 0x1 -+#define MSM_BUS_CLK_UNHALT 0x0 -+ -+#define MSM_BUS_MASTER_SHIFT(master, fieldsize) \ -+ ((master) * (fieldsize)) -+ -+#define MSM_BUS_SET_BITFIELD(word, fieldmask, fieldvalue) \ -+ { \ -+ (word) &= ~(fieldmask); \ -+ (word) |= (fieldvalue); \ -+ } -+ -+ -+#define MSM_BUS_MASTER_HALT(u32haltmask, u32haltval, master) \ -+ MSM_BUS_SET_BITFIELD(u32haltmask, \ -+ MSM_BUS_CLK_HALT_MASK< -+ -+ -+#endif /*__ASM_ARCH_MSM_BUS_BOARD_H */ ---- /dev/null -+++ b/drivers/bus/msm_bus/msm-bus.h -@@ -0,0 +1,139 @@ -+/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef _ARCH_ARM_MACH_MSM_BUS_H -+#define _ARCH_ARM_MACH_MSM_BUS_H -+ -+#include -+#include -+#include -+ -+/* -+ * Macros for clients to convert their data to ib and ab -+ * Ws : Time window over which to transfer the data in SECONDS -+ * Bs : Size of the data block in bytes -+ * Per : Recurrence period -+ * Tb : Throughput bandwidth to prevent stalling -+ * R : Ratio of actual bandwidth used to Tb -+ * Ib : Instantaneous bandwidth -+ * Ab : Arbitrated bandwidth -+ * -+ * IB_RECURRBLOCK and AB_RECURRBLOCK: -+ * These are used if the requirement is to transfer a -+ * recurring block of data over a known time window. -+ * -+ * IB_THROUGHPUTBW and AB_THROUGHPUTBW: -+ * These are used for CPU style masters. Here the requirement -+ * is to have minimum throughput bandwidth available to avoid -+ * stalling. -+ */ -+#define IB_RECURRBLOCK(Ws, Bs) ((Ws) == 0 ? 0 : ((Bs)/(Ws))) -+#define AB_RECURRBLOCK(Ws, Per) ((Ws) == 0 ? 0 : ((Bs)/(Per))) -+#define IB_THROUGHPUTBW(Tb) (Tb) -+#define AB_THROUGHPUTBW(Tb, R) ((Tb) * (R)) -+ -+struct msm_bus_vectors { -+ int src; /* Master */ -+ int dst; /* Slave */ -+ uint64_t ab; /* Arbitrated bandwidth */ -+ uint64_t ib; /* Instantaneous bandwidth */ -+}; -+ -+struct msm_bus_paths { -+ int num_paths; -+ struct msm_bus_vectors *vectors; -+}; -+ -+struct msm_bus_scale_pdata { -+ struct msm_bus_paths *usecase; -+ int num_usecases; -+ const char *name; -+ /* -+ * If the active_only flag is set to 1, the BW request is applied -+ * only when at least one CPU is active (powered on). If the flag -+ * is set to 0, then the BW request is always applied irrespective -+ * of the CPU state. -+ */ -+ unsigned int active_only; -+}; -+ -+/* Scaling APIs */ -+ -+/* -+ * This function returns a handle to the client. This should be used to -+ * call msm_bus_scale_client_update_request. -+ * The function returns 0 if bus driver is unable to register a client -+ */ -+ -+#if (defined(CONFIG_MSM_BUS_SCALING) || defined(CONFIG_BUS_TOPOLOGY_ADHOC)) -+int __init msm_bus_fabric_init_driver(void); -+uint32_t msm_bus_scale_register_client(struct msm_bus_scale_pdata *pdata); -+int msm_bus_scale_client_update_request(uint32_t cl, unsigned int index); -+void msm_bus_scale_unregister_client(uint32_t cl); -+/* AXI Port configuration APIs */ -+int msm_bus_axi_porthalt(int master_port); -+int msm_bus_axi_portunhalt(int master_port); -+ -+#else -+static inline int __init msm_bus_fabric_init_driver(void) { return 0; } -+ -+static inline uint32_t -+msm_bus_scale_register_client(struct msm_bus_scale_pdata *pdata) -+{ -+ return 1; -+} -+ -+static inline int -+msm_bus_scale_client_update_request(uint32_t cl, unsigned int index) -+{ -+ return 0; -+} -+ -+static inline void -+msm_bus_scale_unregister_client(uint32_t cl) -+{ -+} -+ -+static inline int msm_bus_axi_porthalt(int master_port) -+{ -+ return 0; -+} -+ -+static inline int msm_bus_axi_portunhalt(int master_port) -+{ -+ return 0; -+} -+#endif -+ -+#if defined(CONFIG_OF) && defined(CONFIG_MSM_BUS_SCALING) -+struct msm_bus_scale_pdata *msm_bus_pdata_from_node( -+ struct platform_device *pdev, struct device_node *of_node); -+struct msm_bus_scale_pdata *msm_bus_cl_get_pdata(struct platform_device *pdev); -+void msm_bus_cl_clear_pdata(struct msm_bus_scale_pdata *pdata); -+#else -+static inline struct msm_bus_scale_pdata -+*msm_bus_cl_get_pdata(struct platform_device *pdev) -+{ -+ return NULL; -+} -+ -+static inline struct msm_bus_scale_pdata *msm_bus_pdata_from_node( -+ struct platform_device *pdev, struct device_node *of_node) -+{ -+ return NULL; -+} -+ -+static inline void msm_bus_cl_clear_pdata(struct msm_bus_scale_pdata *pdata) -+{ -+} -+#endif -+#endif /*_ARCH_ARM_MACH_MSM_BUS_H*/ ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_adhoc.h -@@ -0,0 +1,141 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef _ARCH_ARM_MACH_MSM_BUS_ADHOC_H -+#define _ARCH_ARM_MACH_MSM_BUS_ADHOC_H -+ -+#include -+#include -+#include "msm-bus-board.h" -+#include "msm-bus.h" -+#include "msm_bus_rules.h" -+#include "msm_bus_core.h" -+ -+struct msm_bus_node_device_type; -+struct link_node { -+ uint64_t lnode_ib[NUM_CTX]; -+ uint64_t lnode_ab[NUM_CTX]; -+ int next; -+ struct device *next_dev; -+ struct list_head link; -+ uint32_t in_use; -+}; -+ -+/* New types introduced for adhoc topology */ -+struct msm_bus_noc_ops { -+ int (*qos_init)(struct msm_bus_node_device_type *dev, -+ void __iomem *qos_base, uint32_t qos_off, -+ uint32_t qos_delta, uint32_t qos_freq); -+ int (*set_bw)(struct msm_bus_node_device_type *dev, -+ void __iomem *qos_base, uint32_t qos_off, -+ uint32_t qos_delta, uint32_t qos_freq); -+ int (*limit_mport)(struct msm_bus_node_device_type *dev, -+ void __iomem *qos_base, uint32_t qos_off, -+ uint32_t qos_delta, uint32_t qos_freq, bool enable_lim, -+ uint64_t lim_bw); -+ bool (*update_bw_reg)(int mode); -+}; -+ -+struct nodebw { -+ uint64_t ab[NUM_CTX]; -+ bool dirty; -+}; -+ -+struct msm_bus_fab_device_type { -+ void __iomem *qos_base; -+ phys_addr_t pqos_base; -+ size_t qos_range; -+ uint32_t base_offset; -+ uint32_t qos_freq; -+ uint32_t qos_off; -+ uint32_t util_fact; -+ uint32_t vrail_comp; -+ struct msm_bus_noc_ops noc_ops; -+ enum msm_bus_hw_sel bus_type; -+ bool bypass_qos_prg; -+}; -+ -+struct qos_params_type { -+ int mode; -+ unsigned int prio_lvl; -+ unsigned int prio_rd; -+ unsigned int prio_wr; -+ unsigned int prio1; -+ unsigned int prio0; -+ unsigned int gp; -+ unsigned int thmp; -+ unsigned int ws; -+ int cur_mode; -+ u64 bw_buffer; -+}; -+ -+struct msm_bus_node_info_type { -+ const char *name; -+ unsigned int id; -+ int mas_rpm_id; -+ int slv_rpm_id; -+ int num_ports; -+ int num_qports; -+ int *qport; -+ struct qos_params_type qos_params; -+ unsigned int num_connections; -+ unsigned int num_blist; -+ bool is_fab_dev; -+ bool virt_dev; -+ bool is_traversed; -+ unsigned int *connections; -+ unsigned int *black_listed_connections; -+ struct device **dev_connections; -+ struct device **black_connections; -+ unsigned int bus_device_id; -+ struct device *bus_device; -+ unsigned int buswidth; -+ struct rule_update_path_info rule; -+ uint64_t lim_bw; -+ uint32_t util_fact; -+ uint32_t vrail_comp; -+}; -+ -+struct msm_bus_node_device_type { -+ struct msm_bus_node_info_type *node_info; -+ struct msm_bus_fab_device_type *fabdev; -+ int num_lnodes; -+ struct link_node *lnode_list; -+ uint64_t cur_clk_hz[NUM_CTX]; -+ struct nodebw node_ab; -+ struct list_head link; -+ unsigned int ap_owned; -+ struct nodeclk clk[NUM_CTX]; -+ struct nodeclk qos_clk; -+}; -+ -+int msm_bus_enable_limiter(struct msm_bus_node_device_type *nodedev, -+ bool throttle_en, uint64_t lim_bw); -+int msm_bus_update_clks(struct msm_bus_node_device_type *nodedev, -+ int ctx, int **dirty_nodes, int *num_dirty); -+int msm_bus_commit_data(int *dirty_nodes, int ctx, int num_dirty); -+int msm_bus_update_bw(struct msm_bus_node_device_type *nodedev, int ctx, -+ int64_t add_bw, int **dirty_nodes, int *num_dirty); -+void *msm_bus_realloc_devmem(struct device *dev, void *p, size_t old_size, -+ size_t new_size, gfp_t flags); -+ -+extern struct msm_bus_device_node_registration -+ *msm_bus_of_to_pdata(struct platform_device *pdev); -+extern void msm_bus_arb_setops_adhoc(struct msm_bus_arb_ops *arb_ops); -+extern int msm_bus_bimc_set_ops(struct msm_bus_node_device_type *bus_dev); -+extern int msm_bus_noc_set_ops(struct msm_bus_node_device_type *bus_dev); -+extern int msm_bus_of_get_static_rules(struct platform_device *pdev, -+ struct bus_rule_type **static_rule); -+extern int msm_rules_update_path(struct list_head *input_list, -+ struct list_head *output_list); -+extern void print_all_rules(void); -+#endif /* _ARCH_ARM_MACH_MSM_BUS_ADHOC_H */ ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_arb_adhoc.c -@@ -0,0 +1,998 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is Mree software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "msm-bus.h" -+#include "msm_bus_core.h" -+#include "msm_bus_adhoc.h" -+ -+#define NUM_CL_HANDLES 50 -+#define NUM_LNODES 3 -+ -+struct bus_search_type { -+ struct list_head link; -+ struct list_head node_list; -+}; -+ -+struct handle_type { -+ int num_entries; -+ struct msm_bus_client **cl_list; -+}; -+ -+static struct handle_type handle_list; -+struct list_head input_list; -+struct list_head apply_list; -+ -+DEFINE_MUTEX(msm_bus_adhoc_lock); -+ -+static bool chk_bl_list(struct list_head *black_list, unsigned int id) -+{ -+ struct msm_bus_node_device_type *bus_node = NULL; -+ -+ list_for_each_entry(bus_node, black_list, link) { -+ if (bus_node->node_info->id == id) -+ return true; -+ } -+ return false; -+} -+ -+static void copy_remaining_nodes(struct list_head *edge_list, struct list_head -+ *traverse_list, struct list_head *route_list) -+{ -+ struct bus_search_type *search_node; -+ -+ if (list_empty(edge_list) && list_empty(traverse_list)) -+ return; -+ -+ search_node = kzalloc(sizeof(struct bus_search_type), GFP_KERNEL); -+ INIT_LIST_HEAD(&search_node->node_list); -+ list_splice_init(edge_list, traverse_list); -+ list_splice_init(traverse_list, &search_node->node_list); -+ list_add_tail(&search_node->link, route_list); -+} -+ -+/* -+ * Duplicate instantiaion from msm_bus_arb.c. Todo there needs to be a -+ * "util" file for these common func/macros. -+ * -+ * */ -+uint64_t msm_bus_div64(unsigned int w, uint64_t bw) -+{ -+ uint64_t *b = &bw; -+ -+ if ((bw > 0) && (bw < w)) -+ return 1; -+ -+ switch (w) { -+ case 0: -+ WARN(1, "AXI: Divide by 0 attempted\n"); -+ case 1: return bw; -+ case 2: return (bw >> 1); -+ case 4: return (bw >> 2); -+ case 8: return (bw >> 3); -+ case 16: return (bw >> 4); -+ case 32: return (bw >> 5); -+ } -+ -+ do_div(*b, w); -+ return *b; -+} -+ -+int msm_bus_device_match_adhoc(struct device *dev, void *id) -+{ -+ int ret = 0; -+ struct msm_bus_node_device_type *bnode = dev->platform_data; -+ -+ if (bnode) -+ ret = (bnode->node_info->id == *(unsigned int *)id); -+ else -+ ret = 0; -+ -+ return ret; -+} -+ -+static int gen_lnode(struct device *dev, -+ int next_hop, int prev_idx) -+{ -+ struct link_node *lnode; -+ struct msm_bus_node_device_type *cur_dev = NULL; -+ int lnode_idx = -1; -+ -+ if (!dev) -+ goto exit_gen_lnode; -+ -+ cur_dev = dev->platform_data; -+ if (!cur_dev) { -+ MSM_BUS_ERR("%s: Null device ptr", __func__); -+ goto exit_gen_lnode; -+ } -+ -+ if (!cur_dev->num_lnodes) { -+ cur_dev->lnode_list = devm_kzalloc(dev, -+ sizeof(struct link_node) * NUM_LNODES, -+ GFP_KERNEL); -+ if (!cur_dev->lnode_list) -+ goto exit_gen_lnode; -+ -+ lnode = cur_dev->lnode_list; -+ cur_dev->num_lnodes = NUM_LNODES; -+ lnode_idx = 0; -+ } else { -+ int i; -+ for (i = 0; i < cur_dev->num_lnodes; i++) { -+ if (!cur_dev->lnode_list[i].in_use) -+ break; -+ } -+ -+ if (i < cur_dev->num_lnodes) { -+ lnode = &cur_dev->lnode_list[i]; -+ lnode_idx = i; -+ } else { -+ struct link_node *realloc_list; -+ size_t cur_size = sizeof(struct link_node) * -+ cur_dev->num_lnodes; -+ -+ cur_dev->num_lnodes += NUM_LNODES; -+ realloc_list = msm_bus_realloc_devmem( -+ dev, -+ cur_dev->lnode_list, -+ cur_size, -+ sizeof(struct link_node) * -+ cur_dev->num_lnodes, GFP_KERNEL); -+ -+ if (!realloc_list) -+ goto exit_gen_lnode; -+ -+ cur_dev->lnode_list = realloc_list; -+ lnode = &cur_dev->lnode_list[i]; -+ lnode_idx = i; -+ } -+ } -+ -+ lnode->in_use = 1; -+ if (next_hop == cur_dev->node_info->id) { -+ lnode->next = -1; -+ lnode->next_dev = NULL; -+ } else { -+ lnode->next = prev_idx; -+ lnode->next_dev = bus_find_device(&msm_bus_type, NULL, -+ (void *) &next_hop, -+ msm_bus_device_match_adhoc); -+ } -+ -+ memset(lnode->lnode_ib, 0, sizeof(uint64_t) * NUM_CTX); -+ memset(lnode->lnode_ab, 0, sizeof(uint64_t) * NUM_CTX); -+ -+exit_gen_lnode: -+ return lnode_idx; -+} -+ -+static int remove_lnode(struct msm_bus_node_device_type *cur_dev, -+ int lnode_idx) -+{ -+ int ret = 0; -+ -+ if (!cur_dev) { -+ MSM_BUS_ERR("%s: Null device ptr", __func__); -+ ret = -ENODEV; -+ goto exit_remove_lnode; -+ } -+ -+ if (lnode_idx != -1) { -+ if (!cur_dev->num_lnodes || -+ (lnode_idx > (cur_dev->num_lnodes - 1))) { -+ MSM_BUS_ERR("%s: Invalid Idx %d, num_lnodes %d", -+ __func__, lnode_idx, cur_dev->num_lnodes); -+ ret = -ENODEV; -+ goto exit_remove_lnode; -+ } -+ -+ cur_dev->lnode_list[lnode_idx].next = -1; -+ cur_dev->lnode_list[lnode_idx].next_dev = NULL; -+ cur_dev->lnode_list[lnode_idx].in_use = 0; -+ } -+ -+exit_remove_lnode: -+ return ret; -+} -+ -+static int prune_path(struct list_head *route_list, int dest, int src, -+ struct list_head *black_list, int found) -+{ -+ struct bus_search_type *search_node, *temp_search_node; -+ struct msm_bus_node_device_type *bus_node; -+ struct list_head *bl_list; -+ struct list_head *temp_bl_list; -+ int search_dev_id = dest; -+ struct device *dest_dev = bus_find_device(&msm_bus_type, NULL, -+ (void *) &dest, -+ msm_bus_device_match_adhoc); -+ int lnode_hop = -1; -+ -+ if (!found) -+ goto reset_links; -+ -+ if (!dest_dev) { -+ MSM_BUS_ERR("%s: Can't find dest dev %d", __func__, dest); -+ goto exit_prune_path; -+ } -+ -+ lnode_hop = gen_lnode(dest_dev, search_dev_id, lnode_hop); -+ -+ list_for_each_entry_reverse(search_node, route_list, link) { -+ list_for_each_entry(bus_node, &search_node->node_list, link) { -+ unsigned int i; -+ for (i = 0; i < bus_node->node_info->num_connections; -+ i++) { -+ if (bus_node->node_info->connections[i] == -+ search_dev_id) { -+ dest_dev = bus_find_device( -+ &msm_bus_type, -+ NULL, -+ (void *) -+ &bus_node->node_info-> -+ id, -+ msm_bus_device_match_adhoc); -+ -+ if (!dest_dev) { -+ lnode_hop = -1; -+ goto reset_links; -+ } -+ -+ lnode_hop = gen_lnode(dest_dev, -+ search_dev_id, -+ lnode_hop); -+ search_dev_id = -+ bus_node->node_info->id; -+ break; -+ } -+ } -+ } -+ } -+reset_links: -+ list_for_each_entry_safe(search_node, temp_search_node, route_list, -+ link) { -+ list_for_each_entry(bus_node, &search_node->node_list, -+ link) -+ bus_node->node_info->is_traversed = false; -+ -+ list_del(&search_node->link); -+ kfree(search_node); -+ } -+ -+ list_for_each_safe(bl_list, temp_bl_list, black_list) -+ list_del(bl_list); -+ -+exit_prune_path: -+ return lnode_hop; -+} -+ -+static void setup_bl_list(struct msm_bus_node_device_type *node, -+ struct list_head *black_list) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < node->node_info->num_blist; i++) { -+ struct msm_bus_node_device_type *bdev; -+ bdev = node->node_info->black_connections[i]->platform_data; -+ list_add_tail(&bdev->link, black_list); -+ } -+} -+ -+static int getpath(int src, int dest) -+{ -+ struct list_head traverse_list; -+ struct list_head edge_list; -+ struct list_head route_list; -+ struct list_head black_list; -+ struct device *src_dev = bus_find_device(&msm_bus_type, NULL, -+ (void *) &src, -+ msm_bus_device_match_adhoc); -+ struct msm_bus_node_device_type *src_node; -+ struct bus_search_type *search_node; -+ int found = 0; -+ int depth_index = 0; -+ int first_hop = -1; -+ -+ INIT_LIST_HEAD(&traverse_list); -+ INIT_LIST_HEAD(&edge_list); -+ INIT_LIST_HEAD(&route_list); -+ INIT_LIST_HEAD(&black_list); -+ -+ if (!src_dev) { -+ MSM_BUS_ERR("%s: Cannot locate src dev %d", __func__, src); -+ goto exit_getpath; -+ } -+ -+ src_node = src_dev->platform_data; -+ if (!src_node) { -+ MSM_BUS_ERR("%s:Fatal, Source dev %d not found", __func__, src); -+ goto exit_getpath; -+ } -+ list_add_tail(&src_node->link, &traverse_list); -+ -+ while ((!found && !list_empty(&traverse_list))) { -+ struct msm_bus_node_device_type *bus_node = NULL; -+ /* Locate dest_id in the traverse list */ -+ list_for_each_entry(bus_node, &traverse_list, link) { -+ if (bus_node->node_info->id == dest) { -+ found = 1; -+ break; -+ } -+ } -+ -+ if (!found) { -+ unsigned int i; -+ /* Setup the new edge list */ -+ list_for_each_entry(bus_node, &traverse_list, link) { -+ /* Setup list of black-listed nodes */ -+ setup_bl_list(bus_node, &black_list); -+ -+ for (i = 0; i < bus_node->node_info-> -+ num_connections; i++) { -+ bool skip; -+ struct msm_bus_node_device_type -+ *node_conn; -+ node_conn = bus_node->node_info-> -+ dev_connections[i]-> -+ platform_data; -+ if (node_conn->node_info-> -+ is_traversed) { -+ MSM_BUS_ERR("Circ Path %d\n", -+ node_conn->node_info->id); -+ goto reset_traversed; -+ } -+ skip = chk_bl_list(&black_list, -+ bus_node->node_info-> -+ connections[i]); -+ if (!skip) { -+ list_add_tail(&node_conn->link, -+ &edge_list); -+ node_conn->node_info-> -+ is_traversed = true; -+ } -+ } -+ } -+ -+ /* Keep tabs of the previous search list */ -+ search_node = kzalloc(sizeof(struct bus_search_type), -+ GFP_KERNEL); -+ INIT_LIST_HEAD(&search_node->node_list); -+ list_splice_init(&traverse_list, -+ &search_node->node_list); -+ /* Add the previous search list to a route list */ -+ list_add_tail(&search_node->link, &route_list); -+ /* Advancing the list depth */ -+ depth_index++; -+ list_splice_init(&edge_list, &traverse_list); -+ } -+ } -+reset_traversed: -+ copy_remaining_nodes(&edge_list, &traverse_list, &route_list); -+ first_hop = prune_path(&route_list, dest, src, &black_list, found); -+ -+exit_getpath: -+ return first_hop; -+} -+ -+static uint64_t arbitrate_bus_req(struct msm_bus_node_device_type *bus_dev, -+ int ctx) -+{ -+ int i; -+ uint64_t max_ib = 0; -+ uint64_t sum_ab = 0; -+ uint64_t bw_max_hz; -+ struct msm_bus_node_device_type *fab_dev = NULL; -+ uint32_t util_fact = 0; -+ uint32_t vrail_comp = 0; -+ -+ /* Find max ib */ -+ for (i = 0; i < bus_dev->num_lnodes; i++) { -+ max_ib = max(max_ib, bus_dev->lnode_list[i].lnode_ib[ctx]); -+ sum_ab += bus_dev->lnode_list[i].lnode_ab[ctx]; -+ } -+ /* -+ * Account for Util factor and vrail comp. The new aggregation -+ * formula is: -+ * Freq_hz = max((sum(ab) * util_fact)/num_chan, max(ib)/vrail_comp) -+ * / bus-width -+ * util_fact and vrail comp are obtained from fabric/Node's dts -+ * properties. -+ * They default to 100 if absent. -+ */ -+ fab_dev = bus_dev->node_info->bus_device->platform_data; -+ /* Don't do this for virtual fabrics */ -+ if (fab_dev && fab_dev->fabdev) { -+ util_fact = bus_dev->node_info->util_fact ? -+ bus_dev->node_info->util_fact : -+ fab_dev->fabdev->util_fact; -+ vrail_comp = bus_dev->node_info->vrail_comp ? -+ bus_dev->node_info->vrail_comp : -+ fab_dev->fabdev->vrail_comp; -+ sum_ab *= util_fact; -+ sum_ab = msm_bus_div64(100, sum_ab); -+ max_ib *= 100; -+ max_ib = msm_bus_div64(vrail_comp, max_ib); -+ } -+ -+ /* Account for multiple channels if any */ -+ if (bus_dev->node_info->num_qports > 1) -+ sum_ab = msm_bus_div64(bus_dev->node_info->num_qports, -+ sum_ab); -+ -+ if (!bus_dev->node_info->buswidth) { -+ MSM_BUS_WARN("No bus width found for %d. Using default\n", -+ bus_dev->node_info->id); -+ bus_dev->node_info->buswidth = 8; -+ } -+ -+ bw_max_hz = max(max_ib, sum_ab); -+ bw_max_hz = msm_bus_div64(bus_dev->node_info->buswidth, -+ bw_max_hz); -+ -+ return bw_max_hz; -+} -+ -+static void del_inp_list(struct list_head *list) -+{ -+ struct rule_update_path_info *rule_node; -+ struct rule_update_path_info *rule_node_tmp; -+ -+ list_for_each_entry_safe(rule_node, rule_node_tmp, list, link) -+ list_del(&rule_node->link); -+} -+ -+static void del_op_list(struct list_head *list) -+{ -+ struct rule_apply_rcm_info *rule; -+ struct rule_apply_rcm_info *rule_tmp; -+ -+ list_for_each_entry_safe(rule, rule_tmp, list, link) -+ list_del(&rule->link); -+} -+ -+static int msm_bus_apply_rules(struct list_head *list, bool after_clk_commit) -+{ -+ struct rule_apply_rcm_info *rule; -+ struct device *dev = NULL; -+ struct msm_bus_node_device_type *dev_info = NULL; -+ int ret = 0; -+ bool throttle_en = false; -+ -+ list_for_each_entry(rule, list, link) { -+ if (!rule) -+ break; -+ -+ if (rule && (rule->after_clk_commit != after_clk_commit)) -+ continue; -+ -+ dev = bus_find_device(&msm_bus_type, NULL, -+ (void *) &rule->id, -+ msm_bus_device_match_adhoc); -+ -+ if (!dev) { -+ MSM_BUS_ERR("Can't find dev node for %d", rule->id); -+ continue; -+ } -+ dev_info = dev->platform_data; -+ -+ throttle_en = ((rule->throttle == THROTTLE_ON) ? true : false); -+ ret = msm_bus_enable_limiter(dev_info, throttle_en, -+ rule->lim_bw); -+ if (ret) -+ MSM_BUS_ERR("Failed to set limiter for %d", rule->id); -+ } -+ -+ return ret; -+} -+ -+static uint64_t get_node_aggab(struct msm_bus_node_device_type *bus_dev) -+{ -+ int i; -+ int ctx; -+ uint64_t max_agg_ab = 0; -+ uint64_t agg_ab = 0; -+ -+ for (ctx = 0; ctx < NUM_CTX; ctx++) { -+ for (i = 0; i < bus_dev->num_lnodes; i++) -+ agg_ab += bus_dev->lnode_list[i].lnode_ab[ctx]; -+ -+ if (bus_dev->node_info->num_qports > 1) -+ agg_ab = msm_bus_div64(bus_dev->node_info->num_qports, -+ agg_ab); -+ -+ max_agg_ab = max(max_agg_ab, agg_ab); -+ } -+ -+ return max_agg_ab; -+} -+ -+static uint64_t get_node_ib(struct msm_bus_node_device_type *bus_dev) -+{ -+ int i; -+ int ctx; -+ uint64_t max_ib = 0; -+ -+ for (ctx = 0; ctx < NUM_CTX; ctx++) { -+ for (i = 0; i < bus_dev->num_lnodes; i++) -+ max_ib = max(max_ib, -+ bus_dev->lnode_list[i].lnode_ib[ctx]); -+ } -+ return max_ib; -+} -+ -+static int update_path(int src, int dest, uint64_t req_ib, uint64_t req_bw, -+ uint64_t cur_ib, uint64_t cur_bw, int src_idx, int ctx) -+{ -+ struct device *src_dev = NULL; -+ struct device *next_dev = NULL; -+ struct link_node *lnode = NULL; -+ struct msm_bus_node_device_type *dev_info = NULL; -+ int curr_idx; -+ int ret = 0; -+ int *dirty_nodes = NULL; -+ int num_dirty = 0; -+ struct rule_update_path_info *rule_node; -+ bool rules_registered = msm_rule_are_rules_registered(); -+ -+ src_dev = bus_find_device(&msm_bus_type, NULL, -+ (void *) &src, -+ msm_bus_device_match_adhoc); -+ -+ if (!src_dev) { -+ MSM_BUS_ERR("%s: Can't find source device %d", __func__, src); -+ ret = -ENODEV; -+ goto exit_update_path; -+ } -+ -+ next_dev = src_dev; -+ -+ if (src_idx < 0) { -+ MSM_BUS_ERR("%s: Invalid lnode idx %d", __func__, src_idx); -+ ret = -ENXIO; -+ goto exit_update_path; -+ } -+ curr_idx = src_idx; -+ -+ INIT_LIST_HEAD(&input_list); -+ INIT_LIST_HEAD(&apply_list); -+ -+ while (next_dev) { -+ dev_info = next_dev->platform_data; -+ -+ if (curr_idx >= dev_info->num_lnodes) { -+ MSM_BUS_ERR("%s: Invalid lnode Idx %d num lnodes %d", -+ __func__, curr_idx, dev_info->num_lnodes); -+ ret = -ENXIO; -+ goto exit_update_path; -+ } -+ -+ lnode = &dev_info->lnode_list[curr_idx]; -+ lnode->lnode_ib[ctx] = req_ib; -+ lnode->lnode_ab[ctx] = req_bw; -+ -+ dev_info->cur_clk_hz[ctx] = arbitrate_bus_req(dev_info, ctx); -+ -+ /* Start updating the clocks at the first hop. -+ * Its ok to figure out the aggregated -+ * request at this node. -+ */ -+ if (src_dev != next_dev) { -+ ret = msm_bus_update_clks(dev_info, ctx, &dirty_nodes, -+ &num_dirty); -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to update clks dev %d", -+ __func__, dev_info->node_info->id); -+ goto exit_update_path; -+ } -+ } -+ -+ ret = msm_bus_update_bw(dev_info, ctx, req_bw, &dirty_nodes, -+ &num_dirty); -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to update bw dev %d", -+ __func__, dev_info->node_info->id); -+ goto exit_update_path; -+ } -+ -+ if (rules_registered) { -+ rule_node = &dev_info->node_info->rule; -+ rule_node->id = dev_info->node_info->id; -+ rule_node->ib = get_node_ib(dev_info); -+ rule_node->ab = get_node_aggab(dev_info); -+ rule_node->clk = max(dev_info->cur_clk_hz[ACTIVE_CTX], -+ dev_info->cur_clk_hz[DUAL_CTX]); -+ list_add_tail(&rule_node->link, &input_list); -+ } -+ -+ next_dev = lnode->next_dev; -+ curr_idx = lnode->next; -+ } -+ -+ if (rules_registered) { -+ msm_rules_update_path(&input_list, &apply_list); -+ msm_bus_apply_rules(&apply_list, false); -+ } -+ -+ msm_bus_commit_data(dirty_nodes, ctx, num_dirty); -+ -+ if (rules_registered) { -+ msm_bus_apply_rules(&apply_list, true); -+ del_inp_list(&input_list); -+ del_op_list(&apply_list); -+ } -+exit_update_path: -+ return ret; -+} -+ -+static int remove_path(int src, int dst, uint64_t cur_ib, uint64_t cur_ab, -+ int src_idx, int active_only) -+{ -+ struct device *src_dev = NULL; -+ struct device *next_dev = NULL; -+ struct link_node *lnode = NULL; -+ struct msm_bus_node_device_type *dev_info = NULL; -+ int ret = 0; -+ int cur_idx = src_idx; -+ int next_idx; -+ -+ /* Update the current path to zero out all request from -+ * this cient on all paths -+ */ -+ -+ ret = update_path(src, dst, 0, 0, cur_ib, cur_ab, src_idx, -+ active_only); -+ if (ret) { -+ MSM_BUS_ERR("%s: Error zeroing out path ctx %d", -+ __func__, ACTIVE_CTX); -+ goto exit_remove_path; -+ } -+ -+ src_dev = bus_find_device(&msm_bus_type, NULL, -+ (void *) &src, -+ msm_bus_device_match_adhoc); -+ if (!src_dev) { -+ MSM_BUS_ERR("%s: Can't find source device %d", __func__, src); -+ ret = -ENODEV; -+ goto exit_remove_path; -+ } -+ -+ next_dev = src_dev; -+ -+ while (next_dev) { -+ dev_info = next_dev->platform_data; -+ lnode = &dev_info->lnode_list[cur_idx]; -+ next_idx = lnode->next; -+ next_dev = lnode->next_dev; -+ remove_lnode(dev_info, cur_idx); -+ cur_idx = next_idx; -+ } -+ -+exit_remove_path: -+ return ret; -+} -+ -+static void getpath_debug(int src, int curr, int active_only) -+{ -+ struct device *dev_node; -+ struct device *dev_it; -+ unsigned int hop = 1; -+ int idx; -+ struct msm_bus_node_device_type *devinfo; -+ int i; -+ -+ dev_node = bus_find_device(&msm_bus_type, NULL, -+ (void *) &src, -+ msm_bus_device_match_adhoc); -+ -+ if (!dev_node) { -+ MSM_BUS_ERR("SRC NOT FOUND %d", src); -+ return; -+ } -+ -+ idx = curr; -+ devinfo = dev_node->platform_data; -+ dev_it = dev_node; -+ -+ MSM_BUS_ERR("Route list Src %d", src); -+ while (dev_it) { -+ struct msm_bus_node_device_type *busdev = -+ devinfo->node_info->bus_device->platform_data; -+ -+ MSM_BUS_ERR("Hop[%d] at Device %d ctx %d", hop, -+ devinfo->node_info->id, active_only); -+ -+ for (i = 0; i < NUM_CTX; i++) { -+ MSM_BUS_ERR("dev info sel ib %llu", -+ devinfo->cur_clk_hz[i]); -+ MSM_BUS_ERR("dev info sel ab %llu", -+ devinfo->node_ab.ab[i]); -+ } -+ -+ dev_it = devinfo->lnode_list[idx].next_dev; -+ idx = devinfo->lnode_list[idx].next; -+ if (dev_it) -+ devinfo = dev_it->platform_data; -+ -+ MSM_BUS_ERR("Bus Device %d", busdev->node_info->id); -+ MSM_BUS_ERR("Bus Clock %llu", busdev->clk[active_only].rate); -+ -+ if (idx < 0) -+ break; -+ hop++; -+ } -+} -+ -+static void unregister_client_adhoc(uint32_t cl) -+{ -+ int i; -+ struct msm_bus_scale_pdata *pdata; -+ int lnode, src, curr, dest; -+ uint64_t cur_clk, cur_bw; -+ struct msm_bus_client *client; -+ -+ mutex_lock(&msm_bus_adhoc_lock); -+ if (!cl) { -+ MSM_BUS_ERR("%s: Null cl handle passed unregister\n", -+ __func__); -+ goto exit_unregister_client; -+ } -+ client = handle_list.cl_list[cl]; -+ pdata = client->pdata; -+ if (!pdata) { -+ MSM_BUS_ERR("%s: Null pdata passed to unregister\n", -+ __func__); -+ goto exit_unregister_client; -+ } -+ -+ curr = client->curr; -+ if (curr >= pdata->num_usecases) { -+ MSM_BUS_ERR("Invalid index Defaulting curr to 0"); -+ curr = 0; -+ } -+ -+ MSM_BUS_DBG("%s: Unregistering client %p", __func__, client); -+ -+ for (i = 0; i < pdata->usecase->num_paths; i++) { -+ src = client->pdata->usecase[curr].vectors[i].src; -+ dest = client->pdata->usecase[curr].vectors[i].dst; -+ -+ lnode = client->src_pnode[i]; -+ cur_clk = client->pdata->usecase[curr].vectors[i].ib; -+ cur_bw = client->pdata->usecase[curr].vectors[i].ab; -+ remove_path(src, dest, cur_clk, cur_bw, lnode, -+ pdata->active_only); -+ } -+ msm_bus_dbg_client_data(client->pdata, MSM_BUS_DBG_UNREGISTER, cl); -+ kfree(client->src_pnode); -+ kfree(client); -+ handle_list.cl_list[cl] = NULL; -+exit_unregister_client: -+ mutex_unlock(&msm_bus_adhoc_lock); -+ return; -+} -+ -+static int alloc_handle_lst(int size) -+{ -+ int ret = 0; -+ struct msm_bus_client **t_cl_list; -+ -+ if (!handle_list.num_entries) { -+ t_cl_list = kzalloc(sizeof(struct msm_bus_client *) -+ * NUM_CL_HANDLES, GFP_KERNEL); -+ if (ZERO_OR_NULL_PTR(t_cl_list)) { -+ ret = -ENOMEM; -+ MSM_BUS_ERR("%s: Failed to allocate handles list", -+ __func__); -+ goto exit_alloc_handle_lst; -+ } -+ handle_list.cl_list = t_cl_list; -+ handle_list.num_entries += NUM_CL_HANDLES; -+ } else { -+ t_cl_list = krealloc(handle_list.cl_list, -+ sizeof(struct msm_bus_client *) * -+ handle_list.num_entries + NUM_CL_HANDLES, -+ GFP_KERNEL); -+ if (ZERO_OR_NULL_PTR(t_cl_list)) { -+ ret = -ENOMEM; -+ MSM_BUS_ERR("%s: Failed to allocate handles list", -+ __func__); -+ goto exit_alloc_handle_lst; -+ } -+ -+ memset(&handle_list.cl_list[handle_list.num_entries], 0, -+ NUM_CL_HANDLES * sizeof(struct msm_bus_client *)); -+ handle_list.num_entries += NUM_CL_HANDLES; -+ handle_list.cl_list = t_cl_list; -+ } -+exit_alloc_handle_lst: -+ return ret; -+} -+ -+static uint32_t gen_handle(struct msm_bus_client *client) -+{ -+ uint32_t handle = 0; -+ int i; -+ int ret = 0; -+ -+ for (i = 0; i < handle_list.num_entries; i++) { -+ if (i && !handle_list.cl_list[i]) { -+ handle = i; -+ break; -+ } -+ } -+ -+ if (!handle) { -+ ret = alloc_handle_lst(NUM_CL_HANDLES); -+ -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to allocate handle list", -+ __func__); -+ goto exit_gen_handle; -+ } -+ handle = i + 1; -+ } -+ handle_list.cl_list[handle] = client; -+exit_gen_handle: -+ return handle; -+} -+ -+static uint32_t register_client_adhoc(struct msm_bus_scale_pdata *pdata) -+{ -+ int src, dest; -+ int i; -+ struct msm_bus_client *client = NULL; -+ int *lnode; -+ uint32_t handle = 0; -+ -+ mutex_lock(&msm_bus_adhoc_lock); -+ client = kzalloc(sizeof(struct msm_bus_client), GFP_KERNEL); -+ if (!client) { -+ MSM_BUS_ERR("%s: Error allocating client data", __func__); -+ goto exit_register_client; -+ } -+ client->pdata = pdata; -+ -+ lnode = kzalloc(pdata->usecase->num_paths * sizeof(int), GFP_KERNEL); -+ if (ZERO_OR_NULL_PTR(lnode)) { -+ MSM_BUS_ERR("%s: Error allocating pathnode ptr!", __func__); -+ goto exit_register_client; -+ } -+ client->src_pnode = lnode; -+ -+ for (i = 0; i < pdata->usecase->num_paths; i++) { -+ src = pdata->usecase->vectors[i].src; -+ dest = pdata->usecase->vectors[i].dst; -+ -+ if ((src < 0) || (dest < 0)) { -+ MSM_BUS_ERR("%s:Invalid src/dst.src %d dest %d", -+ __func__, src, dest); -+ goto exit_register_client; -+ } -+ -+ lnode[i] = getpath(src, dest); -+ if (lnode[i] < 0) { -+ MSM_BUS_ERR("%s:Failed to find path.src %d dest %d", -+ __func__, src, dest); -+ goto exit_register_client; -+ } -+ } -+ -+ handle = gen_handle(client); -+ msm_bus_dbg_client_data(client->pdata, MSM_BUS_DBG_REGISTER, -+ handle); -+ MSM_BUS_DBG("%s:Client handle %d %s", __func__, handle, -+ client->pdata->name); -+exit_register_client: -+ mutex_unlock(&msm_bus_adhoc_lock); -+ return handle; -+} -+ -+static int update_request_adhoc(uint32_t cl, unsigned int index) -+{ -+ int i, ret = 0; -+ struct msm_bus_scale_pdata *pdata; -+ int lnode, src, curr, dest; -+ uint64_t req_clk, req_bw, curr_clk, curr_bw; -+ struct msm_bus_client *client; -+ const char *test_cl = "Null"; -+ bool log_transaction = false; -+ -+ mutex_lock(&msm_bus_adhoc_lock); -+ -+ if (!cl) { -+ MSM_BUS_ERR("%s: Invalid client handle %d", __func__, cl); -+ ret = -ENXIO; -+ goto exit_update_request; -+ } -+ -+ client = handle_list.cl_list[cl]; -+ pdata = client->pdata; -+ if (!pdata) { -+ MSM_BUS_ERR("%s: Client data Null.[client didn't register]", -+ __func__); -+ ret = -ENXIO; -+ goto exit_update_request; -+ } -+ -+ if (index >= pdata->num_usecases) { -+ MSM_BUS_ERR("Client %u passed invalid index: %d\n", -+ cl, index); -+ ret = -ENXIO; -+ goto exit_update_request; -+ } -+ -+ if (client->curr == index) { -+ MSM_BUS_DBG("%s: Not updating client request idx %d unchanged", -+ __func__, index); -+ goto exit_update_request; -+ } -+ -+ curr = client->curr; -+ client->curr = index; -+ -+ if (!strcmp(test_cl, pdata->name)) -+ log_transaction = true; -+ -+ MSM_BUS_DBG("%s: cl: %u index: %d curr: %d num_paths: %d\n", __func__, -+ cl, index, client->curr, client->pdata->usecase->num_paths); -+ -+ for (i = 0; i < pdata->usecase->num_paths; i++) { -+ src = client->pdata->usecase[index].vectors[i].src; -+ dest = client->pdata->usecase[index].vectors[i].dst; -+ -+ lnode = client->src_pnode[i]; -+ req_clk = client->pdata->usecase[index].vectors[i].ib; -+ req_bw = client->pdata->usecase[index].vectors[i].ab; -+ if (curr < 0) { -+ curr_clk = 0; -+ curr_bw = 0; -+ } else { -+ curr_clk = client->pdata->usecase[curr].vectors[i].ib; -+ curr_bw = client->pdata->usecase[curr].vectors[i].ab; -+ MSM_BUS_DBG("%s:ab: %llu ib: %llu\n", __func__, -+ curr_bw, curr_clk); -+ } -+ -+ ret = update_path(src, dest, req_clk, req_bw, -+ curr_clk, curr_bw, lnode, pdata->active_only); -+ -+ if (ret) { -+ MSM_BUS_ERR("%s: Update path failed! %d ctx %d\n", -+ __func__, ret, ACTIVE_CTX); -+ goto exit_update_request; -+ } -+ -+ if (log_transaction) -+ getpath_debug(src, lnode, pdata->active_only); -+ } -+ msm_bus_dbg_client_data(client->pdata, index , cl); -+exit_update_request: -+ mutex_unlock(&msm_bus_adhoc_lock); -+ return ret; -+} -+ -+/** -+ * msm_bus_arb_setops_adhoc() : Setup the bus arbitration ops -+ * @ arb_ops: pointer to the arb ops. -+ */ -+void msm_bus_arb_setops_adhoc(struct msm_bus_arb_ops *arb_ops) -+{ -+ arb_ops->register_client = register_client_adhoc; -+ arb_ops->update_request = update_request_adhoc; -+ arb_ops->unregister_client = unregister_client_adhoc; -+} ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_bimc.c -@@ -0,0 +1,2112 @@ -+/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#define pr_fmt(fmt) "AXI: BIMC: %s(): " fmt, __func__ -+ -+#include -+#include -+#include "msm-bus-board.h" -+#include "msm_bus_core.h" -+#include "msm_bus_bimc.h" -+#include "msm_bus_adhoc.h" -+#include -+ -+enum msm_bus_bimc_slave_block { -+ SLAVE_BLOCK_RESERVED = 0, -+ SLAVE_BLOCK_SLAVE_WAY, -+ SLAVE_BLOCK_XPU, -+ SLAVE_BLOCK_ARBITER, -+ SLAVE_BLOCK_SCMO, -+}; -+ -+enum bke_sw { -+ BKE_OFF = 0, -+ BKE_ON = 1, -+}; -+ -+/* M_Generic */ -+ -+#define M_REG_BASE(b) ((b) + 0x00008000) -+ -+#define M_COMPONENT_INFO_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000000) -+enum bimc_m_component_info { -+ M_COMPONENT_INFO_RMSK = 0xffffff, -+ M_COMPONENT_INFO_INSTANCE_BMSK = 0xff0000, -+ M_COMPONENT_INFO_INSTANCE_SHFT = 0x10, -+ M_COMPONENT_INFO_SUB_TYPE_BMSK = 0xff00, -+ M_COMPONENT_INFO_SUB_TYPE_SHFT = 0x8, -+ M_COMPONENT_INFO_TYPE_BMSK = 0xff, -+ M_COMPONENT_INFO_TYPE_SHFT = 0x0, -+}; -+ -+#define M_CONFIG_INFO_0_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000020) -+enum bimc_m_config_info_0 { -+ M_CONFIG_INFO_0_RMSK = 0xff00ffff, -+ M_CONFIG_INFO_0_SYNC_MODE_BMSK = 0xff000000, -+ M_CONFIG_INFO_0_SYNC_MODE_SHFT = 0x18, -+ M_CONFIG_INFO_0_CONNECTION_TYPE_BMSK = 0xff00, -+ M_CONFIG_INFO_0_CONNECTION_TYPE_SHFT = 0x8, -+ M_CONFIG_INFO_0_FUNC_BMSK = 0xff, -+ M_CONFIG_INFO_0_FUNC_SHFT = 0x0, -+}; -+ -+#define M_CONFIG_INFO_1_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000030) -+enum bimc_m_config_info_1 { -+ M_CONFIG_INFO_1_RMSK = 0xffffffff, -+ M_CONFIG_INFO_1_SWAY_CONNECTIVITY_BMSK = 0xffffffff, -+ M_CONFIG_INFO_1_SWAY_CONNECTIVITY_SHFT = 0x0, -+}; -+ -+#define M_CONFIG_INFO_2_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000040) -+enum bimc_m_config_info_2 { -+ M_CONFIG_INFO_2_RMSK = 0xffffffff, -+ M_CONFIG_INFO_2_M_DATA_WIDTH_BMSK = 0xffff0000, -+ M_CONFIG_INFO_2_M_DATA_WIDTH_SHFT = 0x10, -+ M_CONFIG_INFO_2_M_TID_WIDTH_BMSK = 0xff00, -+ M_CONFIG_INFO_2_M_TID_WIDTH_SHFT = 0x8, -+ M_CONFIG_INFO_2_M_MID_WIDTH_BMSK = 0xff, -+ M_CONFIG_INFO_2_M_MID_WIDTH_SHFT = 0x0, -+}; -+ -+#define M_CONFIG_INFO_3_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000050) -+enum bimc_m_config_info_3 { -+ M_CONFIG_INFO_3_RMSK = 0xffffffff, -+ M_CONFIG_INFO_3_RCH_DEPTH_BMSK = 0xff000000, -+ M_CONFIG_INFO_3_RCH_DEPTH_SHFT = 0x18, -+ M_CONFIG_INFO_3_BCH_DEPTH_BMSK = 0xff0000, -+ M_CONFIG_INFO_3_BCH_DEPTH_SHFT = 0x10, -+ M_CONFIG_INFO_3_WCH_DEPTH_BMSK = 0xff00, -+ M_CONFIG_INFO_3_WCH_DEPTH_SHFT = 0x8, -+ M_CONFIG_INFO_3_ACH_DEPTH_BMSK = 0xff, -+ M_CONFIG_INFO_3_ACH_DEPTH_SHFT = 0x0, -+}; -+ -+#define M_CONFIG_INFO_4_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000060) -+enum bimc_m_config_info_4 { -+ M_CONFIG_INFO_4_RMSK = 0xffff, -+ M_CONFIG_INFO_4_REORDER_BUF_DEPTH_BMSK = 0xff00, -+ M_CONFIG_INFO_4_REORDER_BUF_DEPTH_SHFT = 0x8, -+ M_CONFIG_INFO_4_REORDER_TABLE_DEPTH_BMSK = 0xff, -+ M_CONFIG_INFO_4_REORDER_TABLE_DEPTH_SHFT = 0x0, -+}; -+ -+#define M_CONFIG_INFO_5_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000070) -+enum bimc_m_config_info_5 { -+ M_CONFIG_INFO_5_RMSK = 0x111, -+ M_CONFIG_INFO_5_MP2ARB_PIPELINE_EN_BMSK = 0x100, -+ M_CONFIG_INFO_5_MP2ARB_PIPELINE_EN_SHFT = 0x8, -+ M_CONFIG_INFO_5_MPBUF_PIPELINE_EN_BMSK = 0x10, -+ M_CONFIG_INFO_5_MPBUF_PIPELINE_EN_SHFT = 0x4, -+ M_CONFIG_INFO_5_M2MP_PIPELINE_EN_BMSK = 0x1, -+ M_CONFIG_INFO_5_M2MP_PIPELINE_EN_SHFT = 0x0, -+}; -+ -+#define M_INT_STATUS_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000100) -+enum bimc_m_int_status { -+ M_INT_STATUS_RMSK = 0x3, -+}; -+ -+#define M_INT_CLR_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000108) -+enum bimc_m_int_clr { -+ M_INT_CLR_RMSK = 0x3, -+}; -+ -+#define M_INT_EN_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x0000010c) -+enum bimc_m_int_en { -+ M_INT_EN_RMSK = 0x3, -+}; -+ -+#define M_CLK_CTRL_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000200) -+enum bimc_m_clk_ctrl { -+ M_CLK_CTRL_RMSK = 0x3, -+ M_CLK_CTRL_MAS_CLK_GATING_EN_BMSK = 0x2, -+ M_CLK_CTRL_MAS_CLK_GATING_EN_SHFT = 0x1, -+ M_CLK_CTRL_CORE_CLK_GATING_EN_BMSK = 0x1, -+ M_CLK_CTRL_CORE_CLK_GATING_EN_SHFT = 0x0, -+}; -+ -+#define M_MODE_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000210) -+enum bimc_m_mode { -+ M_MODE_RMSK = 0xf0000011, -+ M_MODE_WR_GATHER_BEATS_BMSK = 0xf0000000, -+ M_MODE_WR_GATHER_BEATS_SHFT = 0x1c, -+ M_MODE_NARROW_WR_BMSK = 0x10, -+ M_MODE_NARROW_WR_SHFT = 0x4, -+ M_MODE_ORDERING_MODEL_BMSK = 0x1, -+ M_MODE_ORDERING_MODEL_SHFT = 0x0, -+}; -+ -+#define M_PRIOLVL_OVERRIDE_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000230) -+enum bimc_m_priolvl_override { -+ M_PRIOLVL_OVERRIDE_RMSK = 0x301, -+ M_PRIOLVL_OVERRIDE_BMSK = 0x300, -+ M_PRIOLVL_OVERRIDE_SHFT = 0x8, -+ M_PRIOLVL_OVERRIDE_OVERRIDE_PRIOLVL_BMSK = 0x1, -+ M_PRIOLVL_OVERRIDE_OVERRIDE_PRIOLVL_SHFT = 0x0, -+}; -+ -+#define M_RD_CMD_OVERRIDE_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000240) -+enum bimc_m_read_command_override { -+ M_RD_CMD_OVERRIDE_RMSK = 0x3071f7f, -+ M_RD_CMD_OVERRIDE_AREQPRIO_BMSK = 0x3000000, -+ M_RD_CMD_OVERRIDE_AREQPRIO_SHFT = 0x18, -+ M_RD_CMD_OVERRIDE_AMEMTYPE_BMSK = 0x70000, -+ M_RD_CMD_OVERRIDE_AMEMTYPE_SHFT = 0x10, -+ M_RD_CMD_OVERRIDE_ATRANSIENT_BMSK = 0x1000, -+ M_RD_CMD_OVERRIDE_ATRANSIENT_SHFT = 0xc, -+ M_RD_CMD_OVERRIDE_ASHARED_BMSK = 0x800, -+ M_RD_CMD_OVERRIDE_ASHARED_SHFT = 0xb, -+ M_RD_CMD_OVERRIDE_AREDIRECT_BMSK = 0x400, -+ M_RD_CMD_OVERRIDE_AREDIRECT_SHFT = 0xa, -+ M_RD_CMD_OVERRIDE_AOOO_BMSK = 0x200, -+ M_RD_CMD_OVERRIDE_AOOO_SHFT = 0x9, -+ M_RD_CMD_OVERRIDE_AINNERSHARED_BMSK = 0x100, -+ M_RD_CMD_OVERRIDE_AINNERSHARED_SHFT = 0x8, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AREQPRIO_BMSK = 0x40, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AREQPRIO_SHFT = 0x6, -+ M_RD_CMD_OVERRIDE_OVERRIDE_ATRANSIENT_BMSK = 0x20, -+ M_RD_CMD_OVERRIDE_OVERRIDE_ATRANSIENT_SHFT = 0x5, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AMEMTYPE_BMSK = 0x10, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AMEMTYPE_SHFT = 0x4, -+ M_RD_CMD_OVERRIDE_OVERRIDE_ASHARED_BMSK = 0x8, -+ M_RD_CMD_OVERRIDE_OVERRIDE_ASHARED_SHFT = 0x3, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AREDIRECT_BMSK = 0x4, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AREDIRECT_SHFT = 0x2, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AOOO_BMSK = 0x2, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AOOO_SHFT = 0x1, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AINNERSHARED_BMSK = 0x1, -+ M_RD_CMD_OVERRIDE_OVERRIDE_AINNERSHARED_SHFT = 0x0, -+}; -+ -+#define M_WR_CMD_OVERRIDE_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000250) -+enum bimc_m_write_command_override { -+ M_WR_CMD_OVERRIDE_RMSK = 0x3071f7f, -+ M_WR_CMD_OVERRIDE_AREQPRIO_BMSK = 0x3000000, -+ M_WR_CMD_OVERRIDE_AREQPRIO_SHFT = 0x18, -+ M_WR_CMD_OVERRIDE_AMEMTYPE_BMSK = 0x70000, -+ M_WR_CMD_OVERRIDE_AMEMTYPE_SHFT = 0x10, -+ M_WR_CMD_OVERRIDE_ATRANSIENT_BMSK = 0x1000, -+ M_WR_CMD_OVERRIDE_ATRANSIENT_SHFT = 0xc, -+ M_WR_CMD_OVERRIDE_ASHARED_BMSK = 0x800, -+ M_WR_CMD_OVERRIDE_ASHARED_SHFT = 0xb, -+ M_WR_CMD_OVERRIDE_AREDIRECT_BMSK = 0x400, -+ M_WR_CMD_OVERRIDE_AREDIRECT_SHFT = 0xa, -+ M_WR_CMD_OVERRIDE_AOOO_BMSK = 0x200, -+ M_WR_CMD_OVERRIDE_AOOO_SHFT = 0x9, -+ M_WR_CMD_OVERRIDE_AINNERSHARED_BMSK = 0x100, -+ M_WR_CMD_OVERRIDE_AINNERSHARED_SHFT = 0x8, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AREQPRIO_BMSK = 0x40, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AREQPRIO_SHFT = 0x6, -+ M_WR_CMD_OVERRIDE_OVERRIDE_ATRANSIENT_BMSK = 0x20, -+ M_WR_CMD_OVERRIDE_OVERRIDE_ATRANSIENT_SHFT = 0x5, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AMEMTYPE_BMSK = 0x10, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AMEMTYPE_SHFT = 0x4, -+ M_WR_CMD_OVERRIDE_OVERRIDE_ASHARED_BMSK = 0x8, -+ M_WR_CMD_OVERRIDE_OVERRIDE_ASHARED_SHFT = 0x3, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AREDIRECT_BMSK = 0x4, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AREDIRECT_SHFT = 0x2, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AOOO_BMSK = 0x2, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AOOO_SHFT = 0x1, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AINNERSHARED_BMSK = 0x1, -+ M_WR_CMD_OVERRIDE_OVERRIDE_AINNERSHARED_SHFT = 0x0, -+}; -+ -+#define M_BKE_EN_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000300) -+enum bimc_m_bke_en { -+ M_BKE_EN_RMSK = 0x1, -+ M_BKE_EN_EN_BMSK = 0x1, -+ M_BKE_EN_EN_SHFT = 0x0, -+}; -+ -+/* Grant Period registers */ -+#define M_BKE_GP_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000304) -+enum bimc_m_bke_grant_period { -+ M_BKE_GP_RMSK = 0x3ff, -+ M_BKE_GP_GP_BMSK = 0x3ff, -+ M_BKE_GP_GP_SHFT = 0x0, -+}; -+ -+/* Grant count register. -+ * The Grant count register represents a signed 16 bit -+ * value, range 0-0x7fff -+ */ -+#define M_BKE_GC_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000308) -+enum bimc_m_bke_grant_count { -+ M_BKE_GC_RMSK = 0xffff, -+ M_BKE_GC_GC_BMSK = 0xffff, -+ M_BKE_GC_GC_SHFT = 0x0, -+}; -+ -+/* Threshold High Registers */ -+#define M_BKE_THH_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000320) -+enum bimc_m_bke_thresh_high { -+ M_BKE_THH_RMSK = 0xffff, -+ M_BKE_THH_THRESH_BMSK = 0xffff, -+ M_BKE_THH_THRESH_SHFT = 0x0, -+}; -+ -+/* Threshold Medium Registers */ -+#define M_BKE_THM_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000324) -+enum bimc_m_bke_thresh_medium { -+ M_BKE_THM_RMSK = 0xffff, -+ M_BKE_THM_THRESH_BMSK = 0xffff, -+ M_BKE_THM_THRESH_SHFT = 0x0, -+}; -+ -+/* Threshold Low Registers */ -+#define M_BKE_THL_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000328) -+enum bimc_m_bke_thresh_low { -+ M_BKE_THL_RMSK = 0xffff, -+ M_BKE_THL_THRESH_BMSK = 0xffff, -+ M_BKE_THL_THRESH_SHFT = 0x0, -+}; -+ -+#define M_BKE_HEALTH_0_CONFIG_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000340) -+enum bimc_m_bke_health_0 { -+ M_BKE_HEALTH_0_CONFIG_RMSK = 0x80000303, -+ M_BKE_HEALTH_0_CONFIG_LIMIT_CMDS_BMSK = 0x80000000, -+ M_BKE_HEALTH_0_CONFIG_LIMIT_CMDS_SHFT = 0x1f, -+ M_BKE_HEALTH_0_CONFIG_AREQPRIO_BMSK = 0x300, -+ M_BKE_HEALTH_0_CONFIG_AREQPRIO_SHFT = 0x8, -+ M_BKE_HEALTH_0_CONFIG_PRIOLVL_BMSK = 0x3, -+ M_BKE_HEALTH_0_CONFIG_PRIOLVL_SHFT = 0x0, -+}; -+ -+#define M_BKE_HEALTH_1_CONFIG_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000344) -+enum bimc_m_bke_health_1 { -+ M_BKE_HEALTH_1_CONFIG_RMSK = 0x80000303, -+ M_BKE_HEALTH_1_CONFIG_LIMIT_CMDS_BMSK = 0x80000000, -+ M_BKE_HEALTH_1_CONFIG_LIMIT_CMDS_SHFT = 0x1f, -+ M_BKE_HEALTH_1_CONFIG_AREQPRIO_BMSK = 0x300, -+ M_BKE_HEALTH_1_CONFIG_AREQPRIO_SHFT = 0x8, -+ M_BKE_HEALTH_1_CONFIG_PRIOLVL_BMSK = 0x3, -+ M_BKE_HEALTH_1_CONFIG_PRIOLVL_SHFT = 0x0, -+}; -+ -+#define M_BKE_HEALTH_2_CONFIG_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000348) -+enum bimc_m_bke_health_2 { -+ M_BKE_HEALTH_2_CONFIG_RMSK = 0x80000303, -+ M_BKE_HEALTH_2_CONFIG_LIMIT_CMDS_BMSK = 0x80000000, -+ M_BKE_HEALTH_2_CONFIG_LIMIT_CMDS_SHFT = 0x1f, -+ M_BKE_HEALTH_2_CONFIG_AREQPRIO_BMSK = 0x300, -+ M_BKE_HEALTH_2_CONFIG_AREQPRIO_SHFT = 0x8, -+ M_BKE_HEALTH_2_CONFIG_PRIOLVL_BMSK = 0x3, -+ M_BKE_HEALTH_2_CONFIG_PRIOLVL_SHFT = 0x0, -+}; -+ -+#define M_BKE_HEALTH_3_CONFIG_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x0000034c) -+enum bimc_m_bke_health_3 { -+ M_BKE_HEALTH_3_CONFIG_RMSK = 0x303, -+ M_BKE_HEALTH_3_CONFIG_AREQPRIO_BMSK = 0x300, -+ M_BKE_HEALTH_3_CONFIG_AREQPRIO_SHFT = 0x8, -+ M_BKE_HEALTH_3_CONFIG_PRIOLVL_BMSK = 0x3, -+ M_BKE_HEALTH_3_CONFIG_PRIOLVL_SHFT = 0x0, -+}; -+ -+#define M_BUF_STATUS_ADDR(b, n) \ -+ (M_REG_BASE(b) + (0x4000 * (n)) + 0x00000400) -+enum bimc_m_buf_status { -+ M_BUF_STATUS_RMSK = 0xf03f030, -+ M_BUF_STATUS_RCH_DATA_WR_FULL_BMSK = 0x8000000, -+ M_BUF_STATUS_RCH_DATA_WR_FULL_SHFT = 0x1b, -+ M_BUF_STATUS_RCH_DATA_WR_EMPTY_BMSK = 0x4000000, -+ M_BUF_STATUS_RCH_DATA_WR_EMPTY_SHFT = 0x1a, -+ M_BUF_STATUS_RCH_CTRL_WR_FULL_BMSK = 0x2000000, -+ M_BUF_STATUS_RCH_CTRL_WR_FULL_SHFT = 0x19, -+ M_BUF_STATUS_RCH_CTRL_WR_EMPTY_BMSK = 0x1000000, -+ M_BUF_STATUS_RCH_CTRL_WR_EMPTY_SHFT = 0x18, -+ M_BUF_STATUS_BCH_WR_FULL_BMSK = 0x20000, -+ M_BUF_STATUS_BCH_WR_FULL_SHFT = 0x11, -+ M_BUF_STATUS_BCH_WR_EMPTY_BMSK = 0x10000, -+ M_BUF_STATUS_BCH_WR_EMPTY_SHFT = 0x10, -+ M_BUF_STATUS_WCH_DATA_RD_FULL_BMSK = 0x8000, -+ M_BUF_STATUS_WCH_DATA_RD_FULL_SHFT = 0xf, -+ M_BUF_STATUS_WCH_DATA_RD_EMPTY_BMSK = 0x4000, -+ M_BUF_STATUS_WCH_DATA_RD_EMPTY_SHFT = 0xe, -+ M_BUF_STATUS_WCH_CTRL_RD_FULL_BMSK = 0x2000, -+ M_BUF_STATUS_WCH_CTRL_RD_FULL_SHFT = 0xd, -+ M_BUF_STATUS_WCH_CTRL_RD_EMPTY_BMSK = 0x1000, -+ M_BUF_STATUS_WCH_CTRL_RD_EMPTY_SHFT = 0xc, -+ M_BUF_STATUS_ACH_RD_FULL_BMSK = 0x20, -+ M_BUF_STATUS_ACH_RD_FULL_SHFT = 0x5, -+ M_BUF_STATUS_ACH_RD_EMPTY_BMSK = 0x10, -+ M_BUF_STATUS_ACH_RD_EMPTY_SHFT = 0x4, -+}; -+/*BIMC Generic */ -+ -+#define S_REG_BASE(b) ((b) + 0x00048000) -+ -+#define S_COMPONENT_INFO_ADDR(b, n) \ -+ (S_REG_BASE(b) + (0x8000 * (n)) + 0x00000000) -+enum bimc_s_component_info { -+ S_COMPONENT_INFO_RMSK = 0xffffff, -+ S_COMPONENT_INFO_INSTANCE_BMSK = 0xff0000, -+ S_COMPONENT_INFO_INSTANCE_SHFT = 0x10, -+ S_COMPONENT_INFO_SUB_TYPE_BMSK = 0xff00, -+ S_COMPONENT_INFO_SUB_TYPE_SHFT = 0x8, -+ S_COMPONENT_INFO_TYPE_BMSK = 0xff, -+ S_COMPONENT_INFO_TYPE_SHFT = 0x0, -+}; -+ -+#define S_HW_INFO_ADDR(b, n) \ -+ (S_REG_BASE(b) + (0x80000 * (n)) + 0x00000010) -+enum bimc_s_hw_info { -+ S_HW_INFO_RMSK = 0xffffffff, -+ S_HW_INFO_MAJOR_BMSK = 0xff000000, -+ S_HW_INFO_MAJOR_SHFT = 0x18, -+ S_HW_INFO_BRANCH_BMSK = 0xff0000, -+ S_HW_INFO_BRANCH_SHFT = 0x10, -+ S_HW_INFO_MINOR_BMSK = 0xff00, -+ S_HW_INFO_MINOR_SHFT = 0x8, -+ S_HW_INFO_ECO_BMSK = 0xff, -+ S_HW_INFO_ECO_SHFT = 0x0, -+}; -+ -+ -+/* S_SCMO_GENERIC */ -+ -+#define S_SCMO_REG_BASE(b) ((b) + 0x00048000) -+ -+#define S_SCMO_CONFIG_INFO_0_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000020) -+enum bimc_s_scmo_config_info_0 { -+ S_SCMO_CONFIG_INFO_0_RMSK = 0xffffffff, -+ S_SCMO_CONFIG_INFO_0_DATA_WIDTH_BMSK = 0xffff0000, -+ S_SCMO_CONFIG_INFO_0_DATA_WIDTH_SHFT = 0x10, -+ S_SCMO_CONFIG_INFO_0_TID_WIDTH_BMSK = 0xff00, -+ S_SCMO_CONFIG_INFO_0_TID_WIDTH_SHFT = 0x8, -+ S_SCMO_CONFIG_INFO_0_MID_WIDTH_BMSK = 0xff, -+ S_SCMO_CONFIG_INFO_0_MID_WIDTH_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CONFIG_INFO_1_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000030) -+enum bimc_s_scmo_config_info_1 { -+ S_SCMO_CONFIG_INFO_1_RMSK = 0xffffffff, -+ S_SCMO_CONFIG_INFO_1_MPORT_CONNECTIVITY_BMSK = 0xffffffff, -+ S_SCMO_CONFIG_INFO_1_MPORT_CONNECTIVITY_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CONFIG_INFO_2_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000040) -+enum bimc_s_scmo_config_info_2 { -+ S_SCMO_CONFIG_INFO_2_RMSK = 0xff00ff, -+ S_SCMO_CONFIG_INFO_2_NUM_GLOBAL_MONS_BMSK = 0xff0000, -+ S_SCMO_CONFIG_INFO_2_NUM_GLOBAL_MONS_SHFT = 0x10, -+ S_SCMO_CONFIG_INFO_2_VMID_WIDTH_BMSK = 0xff, -+ S_SCMO_CONFIG_INFO_2_VMID_WIDTH_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CONFIG_INFO_3_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000050) -+enum bimc_s_scmo_config_info_3 { -+ S_SCMO_CONFIG_INFO_3_RMSK = 0xffffffff, -+ S_SCMO_CONFIG_INFO_3_RCH0_CTRL_DEPTH_BMSK = 0xff000000, -+ S_SCMO_CONFIG_INFO_3_RCH0_CTRL_DEPTH_SHFT = 0x18, -+ S_SCMO_CONFIG_INFO_3_RCH0_DEPTH_BMSK = 0xff0000, -+ S_SCMO_CONFIG_INFO_3_RCH0_DEPTH_SHFT = 0x10, -+ S_SCMO_CONFIG_INFO_3_BCH_DEPTH_BMSK = 0xff00, -+ S_SCMO_CONFIG_INFO_3_BCH_DEPTH_SHFT = 0x8, -+ S_SCMO_CONFIG_INFO_3_WCH_DEPTH_BMSK = 0xff, -+ S_SCMO_CONFIG_INFO_3_WCH_DEPTH_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CONFIG_INFO_4_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000060) -+enum bimc_s_scmo_config_info_4 { -+ S_SCMO_CONFIG_INFO_4_RMSK = 0xffff, -+ S_SCMO_CONFIG_INFO_4_RCH1_CTRL_DEPTH_BMSK = 0xff00, -+ S_SCMO_CONFIG_INFO_4_RCH1_CTRL_DEPTH_SHFT = 0x8, -+ S_SCMO_CONFIG_INFO_4_RCH1_DEPTH_BMSK = 0xff, -+ S_SCMO_CONFIG_INFO_4_RCH1_DEPTH_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CONFIG_INFO_5_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000070) -+enum bimc_s_scmo_config_info_5 { -+ S_SCMO_CONFIG_INFO_5_RMSK = 0xffff, -+ S_SCMO_CONFIG_INFO_5_DPE_CQ_DEPTH_BMSK = 0xff00, -+ S_SCMO_CONFIG_INFO_5_DPE_CQ_DEPTH_SHFT = 0x8, -+ S_SCMO_CONFIG_INFO_5_DDR_BUS_WIDTH_BMSK = 0xff, -+ S_SCMO_CONFIG_INFO_5_DDR_BUS_WIDTH_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CONFIG_INFO_6_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000080) -+enum bimc_s_scmo_config_info_6 { -+ S_SCMO_CONFIG_INFO_6_RMSK = 0x1111, -+ S_SCMO_CONFIG_INFO_6_WBUFC_PIPE_BMSK = 0x1000, -+ S_SCMO_CONFIG_INFO_6_WBUFC_PIPE_SHFT = 0xc, -+ S_SCMO_CONFIG_INFO_6_RDOPT_PIPE_BMSK = 0x100, -+ S_SCMO_CONFIG_INFO_6_RDOPT_PIPE_SHFT = 0x8, -+ S_SCMO_CONFIG_INFO_6_ACHAN_INTF_PIPE_BMSK = 0x10, -+ S_SCMO_CONFIG_INFO_6_ACHAN_INTF_PIPE_SHFT = 0x4, -+ S_SCMO_CONFIG_INFO_6_ADDR_DECODE_HT_BMSK = 0x1, -+ S_SCMO_CONFIG_INFO_6_ADDR_DECODE_HT_SHFT = 0x0, -+}; -+ -+#define S_SCMO_INT_STATUS_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000100) -+enum bimc_s_scmo_int_status { -+ S_SCMO_INT_STATUS_RMSK = 0x1, -+ S_SCMO_INT_STATUS_ERR_OCCURED_BMSK = 0x1, -+ S_SCMO_INT_STATUS_ERR_OCCURED_SHFT = 0x0, -+}; -+ -+#define S_SCMO_INT_CLR_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000108) -+enum bimc_s_scmo_int_clr { -+ S_SCMO_INT_CLR_RMSK = 0x1, -+ S_SCMO_INT_CLR_IRQ_CLR_BMSK = 0x1, -+ S_SCMO_INT_CLR_IRQ_CLR_SHFT = 0x0, -+}; -+ -+#define S_SCMO_INT_EN_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x0000010c) -+enum bimc_s_scmo_int_en { -+ S_SCMO_INT_EN_RMSK = 0x1, -+ S_SCMO_INT_EN_IRQ_EN_BMSK = 0x1, -+ S_SCMO_INT_EN_IRQ_EN_SHFT = 0x0, -+}; -+ -+#define S_SCMO_ESYN_ADDR_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000120) -+enum bimc_s_scmo_esyn_addr { -+ S_SCMO_ESYN_ADDR_RMSK = 0xffffffff, -+ S_SCMO_ESYN_ADDR_ESYN_ADDR_ERR_ADDR_BMSK = 0xffffffff, -+ S_SCMO_ESYN_ADDR_ESYN_ADDR_ERR_ADDR_SHFT = 0x0, -+}; -+ -+#define S_SCMO_ESYN_APACKET_0_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000128) -+enum bimc_s_scmo_esyn_apacket_0 { -+ S_SCMO_ESYN_APACKET_0_RMSK = 0xff1fffff, -+ S_SCMO_ESYN_APACKET_0_ERR_ATID_BMSK = 0xff000000, -+ S_SCMO_ESYN_APACKET_0_ERR_ATID_SHFT = 0x18, -+ S_SCMO_ESYN_APACKET_0_ERR_AVMID_BMSK = 0x1f0000, -+ S_SCMO_ESYN_APACKET_0_ERR_AVMID_SHFT = 0x10, -+ S_SCMO_ESYN_APACKET_0_ERR_AMID_BMSK = 0xffff, -+ S_SCMO_ESYN_APACKET_0_ERR_AMID_SHFT = 0x0, -+}; -+ -+#define S_SCMO_ESYN_APACKET_1_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x0000012c) -+enum bimc_s_scmo_esyn_apacket_1 { -+ S_SCMO_ESYN_APACKET_1_RMSK = 0x10ff117, -+ S_SCMO_ESYN_APACKET_1_ERR_CODE_BMSK = 0x1000000, -+ S_SCMO_ESYN_APACKET_1_ERR_CODE_SHFT = 0x18, -+ S_SCMO_ESYN_APACKET_1_ERR_ALEN_BMSK = 0xf0000, -+ S_SCMO_ESYN_APACKET_1_ERR_ALEN_SHFT = 0x10, -+ S_SCMO_ESYN_APACKET_1_ERR_ASIZE_BMSK = 0xe000, -+ S_SCMO_ESYN_APACKET_1_ERR_ASIZE_SHFT = 0xd, -+ S_SCMO_ESYN_APACKET_1_ERR_ABURST_BMSK = 0x1000, -+ S_SCMO_ESYN_APACKET_1_ERR_ABURST_SHFT = 0xc, -+ S_SCMO_ESYN_APACKET_1_ERR_AEXCLUSIVE_BMSK = 0x100, -+ S_SCMO_ESYN_APACKET_1_ERR_AEXCLUSIVE_SHFT = 0x8, -+ S_SCMO_ESYN_APACKET_1_ERR_APRONTS_BMSK = 0x10, -+ S_SCMO_ESYN_APACKET_1_ERR_APRONTS_SHFT = 0x4, -+ S_SCMO_ESYN_APACKET_1_ERR_AOOORD_BMSK = 0x4, -+ S_SCMO_ESYN_APACKET_1_ERR_AOOORD_SHFT = 0x2, -+ S_SCMO_ESYN_APACKET_1_ERR_AOOOWR_BMSK = 0x2, -+ S_SCMO_ESYN_APACKET_1_ERR_AOOOWR_SHFT = 0x1, -+ S_SCMO_ESYN_APACKET_1_ERR_AWRITE_BMSK = 0x1, -+ S_SCMO_ESYN_APACKET_1_ERR_AWRITE_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CLK_CTRL_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000200) -+enum bimc_s_scmo_clk_ctrl { -+ S_SCMO_CLK_CTRL_RMSK = 0xffff1111, -+ S_SCMO_CLK_CTRL_PEN_CMD_CG_EN_BMSK = 0x10000, -+ S_SCMO_CLK_CTRL_PEN_CMD_CG_EN_SHFT = 0x10, -+ S_SCMO_CLK_CTRL_RCH_CG_EN_BMSK = 0x1000, -+ S_SCMO_CLK_CTRL_RCH_CG_EN_SHFT = 0xc, -+ S_SCMO_CLK_CTRL_FLUSH_CG_EN_BMSK = 0x100, -+ S_SCMO_CLK_CTRL_FLUSH_CG_EN_SHFT = 0x8, -+ S_SCMO_CLK_CTRL_WCH_CG_EN_BMSK = 0x10, -+ S_SCMO_CLK_CTRL_WCH_CG_EN_SHFT = 0x4, -+ S_SCMO_CLK_CTRL_ACH_CG_EN_BMSK = 0x1, -+ S_SCMO_CLK_CTRL_ACH_CG_EN_SHFT = 0x0, -+}; -+ -+#define S_SCMO_SLV_INTERLEAVE_CFG_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000400) -+enum bimc_s_scmo_slv_interleave_cfg { -+ S_SCMO_SLV_INTERLEAVE_CFG_RMSK = 0xff, -+ S_SCMO_SLV_INTERLEAVE_CFG_INTERLEAVE_CS1_BMSK = 0x10, -+ S_SCMO_SLV_INTERLEAVE_CFG_INTERLEAVE_CS1_SHFT = 0x4, -+ S_SCMO_SLV_INTERLEAVE_CFG_INTERLEAVE_CS0_BMSK = 0x1, -+ S_SCMO_SLV_INTERLEAVE_CFG_INTERLEAVE_CS0_SHFT = 0x0, -+}; -+ -+#define S_SCMO_ADDR_BASE_CSn_ADDR(b, n, o) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000410 + 0x4 * (o)) -+enum bimc_s_scmo_addr_base_csn { -+ S_SCMO_ADDR_BASE_CSn_RMSK = 0xffff, -+ S_SCMO_ADDR_BASE_CSn_MAXn = 1, -+ S_SCMO_ADDR_BASE_CSn_ADDR_BASE_BMSK = 0xfc, -+ S_SCMO_ADDR_BASE_CSn_ADDR_BASE_SHFT = 0x2, -+}; -+ -+#define S_SCMO_ADDR_MAP_CSn_ADDR(b, n, o) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000420 + 0x4 * (o)) -+enum bimc_s_scmo_addr_map_csn { -+ S_SCMO_ADDR_MAP_CSn_RMSK = 0xffff, -+ S_SCMO_ADDR_MAP_CSn_MAXn = 1, -+ S_SCMO_ADDR_MAP_CSn_RANK_EN_BMSK = 0x8000, -+ S_SCMO_ADDR_MAP_CSn_RANK_EN_SHFT = 0xf, -+ S_SCMO_ADDR_MAP_CSn_ADDR_MODE_BMSK = 0x1000, -+ S_SCMO_ADDR_MAP_CSn_ADDR_MODE_SHFT = 0xc, -+ S_SCMO_ADDR_MAP_CSn_BANK_SIZE_BMSK = 0x100, -+ S_SCMO_ADDR_MAP_CSn_BANK_SIZE_SHFT = 0x8, -+ S_SCMO_ADDR_MAP_CSn_ROW_SIZE_BMSK = 0x30, -+ S_SCMO_ADDR_MAP_CSn_ROW_SIZE_SHFT = 0x4, -+ S_SCMO_ADDR_MAP_CSn_COL_SIZE_BMSK = 0x3, -+ S_SCMO_ADDR_MAP_CSn_COL_SIZE_SHFT = 0x0, -+}; -+ -+#define S_SCMO_ADDR_MASK_CSn_ADDR(b, n, o) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000430 + 0x4 * (0)) -+enum bimc_s_scmo_addr_mask_csn { -+ S_SCMO_ADDR_MASK_CSn_RMSK = 0xffff, -+ S_SCMO_ADDR_MASK_CSn_MAXn = 1, -+ S_SCMO_ADDR_MASK_CSn_ADDR_MASK_BMSK = 0xfc, -+ S_SCMO_ADDR_MASK_CSn_ADDR_MASK_SHFT = 0x2, -+}; -+ -+#define S_SCMO_SLV_STATUS_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000450) -+enum bimc_s_scmo_slv_status { -+ S_SCMO_SLV_STATUS_RMSK = 0xff3, -+ S_SCMO_SLV_STATUS_GLOBAL_MONS_IN_USE_BMSK = 0xff0, -+ S_SCMO_SLV_STATUS_GLOBAL_MONS_IN_USE_SHFT = 0x4, -+ S_SCMO_SLV_STATUS_SLAVE_IDLE_BMSK = 0x3, -+ S_SCMO_SLV_STATUS_SLAVE_IDLE_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CMD_BUF_CFG_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000500) -+enum bimc_s_scmo_cmd_buf_cfg { -+ S_SCMO_CMD_BUF_CFG_RMSK = 0xf1f, -+ S_SCMO_CMD_BUF_CFG_CMD_ORDERING_BMSK = 0x300, -+ S_SCMO_CMD_BUF_CFG_CMD_ORDERING_SHFT = 0x8, -+ S_SCMO_CMD_BUF_CFG_HP_CMD_AREQPRIO_MAP_BMSK = 0x10, -+ S_SCMO_CMD_BUF_CFG_HP_CMD_AREQPRIO_MAP_SHFT = 0x4, -+ S_SCMO_CMD_BUF_CFG_HP_CMD_Q_DEPTH_BMSK = 0x7, -+ S_SCMO_CMD_BUF_CFG_HP_CMD_Q_DEPTH_SHFT = 0x0, -+}; -+ -+#define S_SCM_CMD_BUF_STATUS_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000520) -+enum bimc_s_scm_cmd_buf_status { -+ S_SCMO_CMD_BUF_STATUS_RMSK = 0x77, -+ S_SCMO_CMD_BUF_STATUS_HP_CMD_BUF_ENTRIES_IN_USE_BMSK = 0x70, -+ S_SCMO_CMD_BUF_STATUS_HP_CMD_BUF_ENTRIES_IN_USE_SHFT = 0x4, -+ S_SCMO_CMD_BUF_STATUS_LP_CMD_BUF_ENTRIES_IN_USE_BMSK = 0x7, -+ S_SCMO_CMD_BUF_STATUS_LP_CMD_BUF_ENTRIES_IN_USE_SHFT = 0x0, -+}; -+ -+#define S_SCMO_RCH_SEL_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000540) -+enum bimc_s_scmo_rch_sel { -+ S_SCMO_RCH_SEL_RMSK = 0xffffffff, -+ S_SCMO_CMD_BUF_STATUS_RCH_PORTS_BMSK = 0xffffffff, -+ S_SCMO_CMD_BUF_STATUS_RCH_PORTS_SHFT = 0x0, -+}; -+ -+#define S_SCMO_RCH_BKPR_CFG_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000544) -+enum bimc_s_scmo_rch_bkpr_cfg { -+ S_SCMO_RCH_BKPR_CFG_RMSK = 0xffffffff, -+ S_SCMO_RCH_BKPR_CFG_RCH1_FIFO_BKPR_HI_TH_BMSK = 0x3f000000, -+ S_SCMO_RCH_BKPR_CFG_RCH1_FIFO_BKPR_HI_TH_SHFT = 0x18, -+ S_SCMO_RCH_BKPR_CFG_RCH1_FIFO_BKPR_LO_TH_BMSK = 0x3f0000, -+ S_SCMO_RCH_BKPR_CFG_RCH1_FIFO_BKPR_LO_TH_SHFT = 0x10, -+ S_SCMO_RCH_BKPR_CFG_RCH0_FIFO_BKPR_HI_TH_BMSK = 0x3f00, -+ S_SCMO_RCH_BKPR_CFG_RCH0_FIFO_BKPR_HI_TH_SHFT = 0x8, -+ S_SCMO_RCH_BKPR_CFG_RCH0_FIFO_BKPR_LO_TH_BMSK = 0x3f, -+ S_SCMO_RCH_BKPR_CFG_RCH0_FIFO_BKPR_LO_TH_SHFT = 0x0, -+}; -+ -+#define S_SCMO_RCH_STATUS_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000560) -+enum bimc_s_scmo_rch_status { -+ S_SCMO_RCH_STATUS_RMSK = 0x33333, -+ S_SCMO_RCH_STATUS_PRQ_FIFO_FULL_BMSK = 0x20000, -+ S_SCMO_RCH_STATUS_PRQ_FIFO_FULL_SHFT = 0x11, -+ S_SCMO_RCH_STATUS_PRQ_FIFO_EMPTY_BMSK = 0x10000, -+ S_SCMO_RCH_STATUS_PRQ_FIFO_EMPTY_SHFT = 0x10, -+ S_SCMO_RCH_STATUS_RCH1_QUAL_FIFO_FULL_BMSK = 0x2000, -+ S_SCMO_RCH_STATUS_RCH1_QUAL_FIFO_FULL_SHFT = 0xd, -+ S_SCMO_RCH_STATUS_RCH1_QUAL_FIFO_EMPTY_BMSK = 0x1000, -+ S_SCMO_RCH_STATUS_RCH1_QUAL_FIFO_EMPTY_SHFT = 0xc, -+ S_SCMO_RCH_STATUS_RCH1_DATA_FIFO_FULL_BMSK = 0x200, -+ S_SCMO_RCH_STATUS_RCH1_DATA_FIFO_FULL_SHFT = 0x9, -+ S_SCMO_RCH_STATUS_RCH1_DATA_FIFO_EMPTY_BMSK = 0x100, -+ S_SCMO_RCH_STATUS_RCH1_DATA_FIFO_EMPTY_SHFT = 0x8, -+ S_SCMO_RCH_STATUS_RCH0_QUAL_FIFO_FULL_BMSK = 0x20, -+ S_SCMO_RCH_STATUS_RCH0_QUAL_FIFO_FULL_SHFT = 0x5, -+ S_SCMO_RCH_STATUS_RCH0_QUAL_FIFO_EMPTY_BMSK = 0x10, -+ S_SCMO_RCH_STATUS_RCH0_QUAL_FIFO_EMPTY_SHFT = 0x4, -+ S_SCMO_RCH_STATUS_RCH0_DATA_FIFO_FULL_BMSK = 0x2, -+ S_SCMO_RCH_STATUS_RCH0_DATA_FIFO_FULL_SHFT = 0x1, -+ S_SCMO_RCH_STATUS_RCH0_DATA_FIFO_EMPTY_BMSK = 0x1, -+ S_SCMO_RCH_STATUS_RCH0_DATA_FIFO_EMPTY_SHFT = 0x0, -+}; -+ -+#define S_SCMO_WCH_BUF_CFG_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000580) -+enum bimc_s_scmo_wch_buf_cfg { -+ S_SCMO_WCH_BUF_CFG_RMSK = 0xff, -+ S_SCMO_WCH_BUF_CFG_WRITE_BLOCK_READ_BMSK = 0x10, -+ S_SCMO_WCH_BUF_CFG_WRITE_BLOCK_READ_SHFT = 0x4, -+ S_SCMO_WCH_BUF_CFG_COALESCE_EN_BMSK = 0x1, -+ S_SCMO_WCH_BUF_CFG_COALESCE_EN_SHFT = 0x0, -+}; -+ -+#define S_SCMO_WCH_STATUS_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x000005a0) -+enum bimc_s_scmo_wch_status { -+ S_SCMO_WCH_STATUS_RMSK = 0x333, -+ S_SCMO_WCH_STATUS_BRESP_FIFO_FULL_BMSK = 0x200, -+ S_SCMO_WCH_STATUS_BRESP_FIFO_FULL_SHFT = 0x9, -+ S_SCMO_WCH_STATUS_BRESP_FIFO_EMPTY_BMSK = 0x100, -+ S_SCMO_WCH_STATUS_BRESP_FIFO_EMPTY_SHFT = 0x8, -+ S_SCMO_WCH_STATUS_WDATA_FIFO_FULL_BMSK = 0x20, -+ S_SCMO_WCH_STATUS_WDATA_FIFO_FULL_SHFT = 0x5, -+ S_SCMO_WCH_STATUS_WDATA_FIFO_EMPTY_BMSK = 0x10, -+ S_SCMO_WCH_STATUS_WDATA_FIFO_EMPTY_SHFT = 0x4, -+ S_SCMO_WCH_STATUS_WBUF_FULL_BMSK = 0x2, -+ S_SCMO_WCH_STATUS_WBUF_FULL_SHFT = 0x1, -+ S_SCMO_WCH_STATUS_WBUF_EMPTY_BMSK = 0x1, -+ S_SCMO_WCH_STATUS_WBUF_EMPTY_SHFT = 0x0, -+}; -+ -+#define S_SCMO_FLUSH_CFG_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x000005c0) -+enum bimc_s_scmo_flush_cfg { -+ S_SCMO_FLUSH_CFG_RMSK = 0xffffffff, -+ S_SCMO_FLUSH_CFG_FLUSH_IN_ORDER_BMSK = 0x10000000, -+ S_SCMO_FLUSH_CFG_FLUSH_IN_ORDER_SHFT = 0x1c, -+ S_SCMO_FLUSH_CFG_FLUSH_IDLE_DELAY_BMSK = 0x3ff0000, -+ S_SCMO_FLUSH_CFG_FLUSH_IDLE_DELAY_SHFT = 0x10, -+ S_SCMO_FLUSH_CFG_FLUSH_UPPER_LIMIT_BMSK = 0xf00, -+ S_SCMO_FLUSH_CFG_FLUSH_UPPER_LIMIT_SHFT = 0x8, -+ S_SCMO_FLUSH_CFG_FLUSH_LOWER_LIMIT_BMSK = 0xf, -+ S_SCMO_FLUSH_CFG_FLUSH_LOWER_LIMIT_SHFT = 0x0, -+}; -+ -+#define S_SCMO_FLUSH_CMD_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x000005c4) -+enum bimc_s_scmo_flush_cmd { -+ S_SCMO_FLUSH_CMD_RMSK = 0xf, -+ S_SCMO_FLUSH_CMD_FLUSH_ALL_BUF_BMSK = 0x3, -+ S_SCMO_FLUSH_CMD_FLUSH_ALL_BUF_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CMD_OPT_CFG0_ADDR(b, n) \ -+ (S_SCM0_REG_BASE(b) + (0x8000 * (n)) + 0x00000700) -+enum bimc_s_scmo_cmd_opt_cfg0 { -+ S_SCMO_CMD_OPT_CFG0_RMSK = 0xffffff, -+ S_SCMO_CMD_OPT_CFG0_IGNORE_BANK_UNAVL_BMSK = 0x100000, -+ S_SCMO_CMD_OPT_CFG0_IGNORE_BANK_UNAVL_SHFT = 0x14, -+ S_SCMO_CMD_OPT_CFG0_MASK_CMDOUT_PRI_BMSK = 0x10000, -+ S_SCMO_CMD_OPT_CFG0_MASK_CMDOUT_PRI_SHFT = 0x10, -+ S_SCMO_CMD_OPT_CFG0_DPE_CMD_REORDERING_BMSK = 0x1000, -+ S_SCMO_CMD_OPT_CFG0_DPE_CMD_REORDERING_SHFT = 0xc, -+ S_SCMO_CMD_OPT_CFG0_WR_OPT_EN_BMSK = 0x100, -+ S_SCMO_CMD_OPT_CFG0_WR_OPT_EN_SHFT = 0x8, -+ S_SCMO_CMD_OPT_CFG0_RD_OPT_EN_BMSK = 0x10, -+ S_SCMO_CMD_OPT_CFG0_RD_OPT_EN_SHFT = 0x4, -+ S_SCMO_CMD_OPT_CFG0_PAGE_MGMT_POLICY_BMSK = 0x1, -+ S_SCMO_CMD_OPT_CFG0_PAGE_MGMT_POLICY_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CMD_OPT_CFG1_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000704) -+enum bimc_s_scmo_cmd_opt_cfg1 { -+ S_SCMO_CMD_OPT_CFG1_RMSK = 0xffffffff, -+ S_SCMO_CMD_OPT_CFG1_HSTP_CMD_TIMEOUT_BMSK = 0x1f000000, -+ S_SCMO_CMD_OPT_CFG1_HSTP_CMD_TIMEOUT_SHFT = 0x18, -+ S_SCMO_CMD_OPT_CFG1_HP_CMD_TIMEOUT_BMSK = 0x1f0000, -+ S_SCMO_CMD_OPT_CFG1_HP_CMD_TIMEOUT_SHFT = 0x10, -+ S_SCMO_CMD_OPT_CFG1_MP_CMD_TIMEOUT_BMSK = 0x1f00, -+ S_SCMO_CMD_OPT_CFG1_MP_CMD_TIMEOUT_SHFT = 0x8, -+ S_SCMO_CMD_OPT_CFG1_LP_CMD_TIMEOUT_BMSK = 0x1f, -+ S_SCMO_CMD_OPT_CFG1_LP_CMD_TIMEOUT_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CMD_OPT_CFG2_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x00000708) -+enum bimc_s_scmo_cmd_opt_cfg2 { -+ S_SCMO_CMD_OPT_CFG2_RMSK = 0xff, -+ S_SCMO_CMD_OPT_CFG2_RWOPT_CMD_TIMEOUT_BMSK = 0xf, -+ S_SCMO_CMD_OPT_CFG2_RWOPT_CMD_TIMEOUT_SHFT = 0x0, -+}; -+ -+#define S_SCMO_CMD_OPT_CFG3_ADDR(b, n) \ -+ (S_SCMO_REG_BASE(b) + (0x8000 * (n)) + 0x0000070c) -+enum bimc_s_scmo_cmd_opt_cfg3 { -+ S_SCMO_CMD_OPT_CFG3_RMSK = 0xff, -+ S_SCMO_CMD_OPT_CFG3_FLUSH_CMD_TIMEOUT_BMSK = 0xf, -+ S_SCMO_CMD_OPT_CFG3_FLUSH_CMD_TIMEOUT_SHFT = 0x0, -+}; -+ -+/* S_SWAY_GENERIC */ -+#define S_SWAY_REG_BASE(b) ((b) + 0x00048000) -+ -+#define S_SWAY_CONFIG_INFO_0_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000020) -+enum bimc_s_sway_config_info_0 { -+ S_SWAY_CONFIG_INFO_0_RMSK = 0xff0000ff, -+ S_SWAY_CONFIG_INFO_0_SYNC_MODE_BMSK = 0xff000000, -+ S_SWAY_CONFIG_INFO_0_SYNC_MODE_SHFT = 0x18, -+ S_SWAY_CONFIG_INFO_0_FUNC_BMSK = 0xff, -+ S_SWAY_CONFIG_INFO_0_FUNC_SHFT = 0x0, -+}; -+ -+#define S_SWAY_CONFIG_INFO_1_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000030) -+enum bimc_s_sway_config_info_1 { -+ S_SWAY_CONFIG_INFO_1_RMSK = 0xffffffff, -+ S_SWAY_CONFIG_INFO_1_MPORT_CONNECTIVITY_BMSK = 0xffffffff, -+ S_SWAY_CONFIG_INFO_1_MPORT_CONNECTIVITY_SHFT = 0x0, -+}; -+ -+#define S_SWAY_CONFIG_INFO_2_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000040) -+enum bimc_s_sway_config_info_2 { -+ S_SWAY_CONFIG_INFO_2_RMSK = 0xffff0000, -+ S_SWAY_CONFIG_INFO_2_MPORT_CONNECTIVITY_BMSK = 0xffff0000, -+ S_SWAY_CONFIG_INFO_2_MPORT_CONNECTIVITY_SHFT = 0x10, -+}; -+ -+#define S_SWAY_CONFIG_INFO_3_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000050) -+enum bimc_s_sway_config_info_3 { -+ S_SWAY_CONFIG_INFO_3_RMSK = 0xffffffff, -+ S_SWAY_CONFIG_INFO_3_RCH0_DEPTH_BMSK = 0xff000000, -+ S_SWAY_CONFIG_INFO_3_RCH0_DEPTH_SHFT = 0x18, -+ S_SWAY_CONFIG_INFO_3_BCH_DEPTH_BMSK = 0xff0000, -+ S_SWAY_CONFIG_INFO_3_BCH_DEPTH_SHFT = 0x10, -+ S_SWAY_CONFIG_INFO_3_WCH_DEPTH_BMSK = 0xff, -+ S_SWAY_CONFIG_INFO_3_WCH_DEPTH_SHFT = 0x0, -+}; -+ -+#define S_SWAY_CONFIG_INFO_4_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000060) -+enum bimc_s_sway_config_info_4 { -+ S_SWAY_CONFIG_INFO_4_RMSK = 0x800000ff, -+ S_SWAY_CONFIG_INFO_4_DUAL_RCH_EN_BMSK = 0x80000000, -+ S_SWAY_CONFIG_INFO_4_DUAL_RCH_EN_SHFT = 0x1f, -+ S_SWAY_CONFIG_INFO_4_RCH1_DEPTH_BMSK = 0xff, -+ S_SWAY_CONFIG_INFO_4_RCH1_DEPTH_SHFT = 0x0, -+}; -+ -+#define S_SWAY_CONFIG_INFO_5_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000070) -+enum bimc_s_sway_config_info_5 { -+ S_SWAY_CONFIG_INFO_5_RMSK = 0x800000ff, -+ S_SWAY_CONFIG_INFO_5_QCH_EN_BMSK = 0x80000000, -+ S_SWAY_CONFIG_INFO_5_QCH_EN_SHFT = 0x1f, -+ S_SWAY_CONFIG_INFO_5_QCH_DEPTH_BMSK = 0xff, -+ S_SWAY_CONFIG_INFO_5_QCH_DEPTH_SHFT = 0x0, -+}; -+ -+#define S_SWAY_CONFIG_INFO_6_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000080) -+enum bimc_s_sway_config_info_6 { -+ S_SWAY_CONFIG_INFO_6_RMSK = 0x1, -+ S_SWAY_CONFIG_INFO_6_S2SW_PIPELINE_EN_BMSK = 0x1, -+ S_SWAY_CONFIG_INFO_6_S2SW_PIPELINE_EN_SHFT = 0x0, -+}; -+ -+#define S_SWAY_INT_STATUS_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000100) -+enum bimc_s_sway_int_status { -+ S_SWAY_INT_STATUS_RMSK = 0x3, -+ S_SWAY_INT_STATUS_RFU_BMSK = 0x3, -+ S_SWAY_INT_STATUS_RFU_SHFT = 0x0, -+}; -+ -+#define S_SWAY_INT_CLR_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000108) -+enum bimc_s_sway_int_clr { -+ S_SWAY_INT_CLR_RMSK = 0x3, -+ S_SWAY_INT_CLR_RFU_BMSK = 0x3, -+ S_SWAY_INT_CLR_RFU_SHFT = 0x0, -+}; -+ -+ -+#define S_SWAY_INT_EN_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x0000010c) -+enum bimc_s_sway_int_en { -+ S_SWAY_INT_EN_RMSK = 0x3, -+ S_SWAY_INT_EN_RFU_BMSK = 0x3, -+ S_SWAY_INT_EN_RFU_SHFT = 0x0, -+}; -+ -+#define S_SWAY_CLK_CTRL_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000200) -+enum bimc_s_sway_clk_ctrl { -+ S_SWAY_CLK_CTRL_RMSK = 0x3, -+ S_SWAY_CLK_CTRL_SLAVE_CLK_GATING_EN_BMSK = 0x2, -+ S_SWAY_CLK_CTRL_SLAVE_CLK_GATING_EN_SHFT = 0x1, -+ S_SWAY_CLK_CTRL_CORE_CLK_GATING_EN_BMSK = 0x1, -+ S_SWAY_CLK_CTRL_CORE_CLK_GATING_EN_SHFT = 0x0, -+}; -+ -+#define S_SWAY_RCH_SEL_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000210) -+enum bimc_s_sway_rch_sel { -+ S_SWAY_RCH_SEL_RMSK = 0x7f, -+ S_SWAY_RCH_SEL_UNUSED_BMSK = 0x7f, -+ S_SWAY_RCH_SEL_UNUSED_SHFT = 0x0, -+}; -+ -+ -+#define S_SWAY_MAX_OUTSTANDING_REQS_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000220) -+enum bimc_s_sway_max_outstanding_reqs { -+ S_SWAY_MAX_OUTSTANDING_REQS_RMSK = 0xffff, -+ S_SWAY_MAX_OUTSTANDING_REQS_WRITE_BMSK = 0xff00, -+ S_SWAY_MAX_OUTSTANDING_REQS_WRITE_SHFT = 0x8, -+ S_SWAY_MAX_OUTSTANDING_REQS_READ_BMSK = 0xff, -+ S_SWAY_MAX_OUTSTANDING_REQS_READ_SHFT = 0x0, -+}; -+ -+ -+#define S_SWAY_BUF_STATUS_0_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000400) -+enum bimc_s_sway_buf_status_0 { -+ S_SWAY_BUF_STATUS_0_RMSK = 0xf0300f03, -+ S_SWAY_BUF_STATUS_0_RCH0_DATA_RD_FULL_BMSK = 0x80000000, -+ S_SWAY_BUF_STATUS_0_RCH0_DATA_RD_FULL_SHFT = 0x1f, -+ S_SWAY_BUF_STATUS_0_RCH0_DATA_RD_EMPTY_BMSK = 0x40000000, -+ S_SWAY_BUF_STATUS_0_RCH0_DATA_RD_EMPTY_SHFT = 0x1e, -+ S_SWAY_BUF_STATUS_0_RCH0_CTRL_RD_FULL_BMSK = 0x20000000, -+ S_SWAY_BUF_STATUS_0_RCH0_CTRL_RD_FULL_SHFT = 0x1d, -+ S_SWAY_BUF_STATUS_0_RCH0_CTRL_RD_EMPTY_BMSK = 0x10000000, -+ S_SWAY_BUF_STATUS_0_RCH0_CTRL_RD_EMPTY_SHFT = 0x1c, -+ S_SWAY_BUF_STATUS_0_BCH_RD_FULL_BMSK = 0x200000, -+ S_SWAY_BUF_STATUS_0_BCH_RD_FULL_SHFT = 0x15, -+ S_SWAY_BUF_STATUS_0_BCH_RD_EMPTY_BMSK = 0x100000, -+ S_SWAY_BUF_STATUS_0_BCH_RD_EMPTY_SHFT = 0x14, -+ S_SWAY_BUF_STATUS_0_WCH_DATA_WR_FULL_BMSK = 0x800, -+ S_SWAY_BUF_STATUS_0_WCH_DATA_WR_FULL_SHFT = 0xb, -+ S_SWAY_BUF_STATUS_0_WCH_DATA_WR_EMPTY_BMSK = 0x400, -+ S_SWAY_BUF_STATUS_0_WCH_DATA_WR_EMPTY_SHFT = 0xa, -+ S_SWAY_BUF_STATUS_0_WCH_CTRL_WR_FULL_BMSK = 0x200, -+ S_SWAY_BUF_STATUS_0_WCH_CTRL_WR_FULL_SHFT = 0x9, -+ S_SWAY_BUF_STATUS_0_WCH_CTRL_WR_EMPTY_BMSK = 0x100, -+ S_SWAY_BUF_STATUS_0_WCH_CTRL_WR_EMPTY_SHFT = 0x8, -+ S_SWAY_BUF_STATUS_0_ACH_WR_FULL_BMSK = 0x2, -+ S_SWAY_BUF_STATUS_0_ACH_WR_FULL_SHFT = 0x1, -+ S_SWAY_BUF_STATUS_0_ACH_WR_EMPTY_BMSK = 0x1, -+ S_SWAY_BUF_STATUS_0_ACH_WR_EMPTY_SHFT = 0x0, -+}; -+ -+#define S_SWAY_BUF_STATUS_1_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000410) -+enum bimc_s_sway_buf_status_1 { -+ S_SWAY_BUF_STATUS_1_RMSK = 0xf0, -+ S_SWAY_BUF_STATUS_1_RCH1_DATA_RD_FULL_BMSK = 0x80, -+ S_SWAY_BUF_STATUS_1_RCH1_DATA_RD_FULL_SHFT = 0x7, -+ S_SWAY_BUF_STATUS_1_RCH1_DATA_RD_EMPTY_BMSK = 0x40, -+ S_SWAY_BUF_STATUS_1_RCH1_DATA_RD_EMPTY_SHFT = 0x6, -+ S_SWAY_BUF_STATUS_1_RCH1_CTRL_RD_FULL_BMSK = 0x20, -+ S_SWAY_BUF_STATUS_1_RCH1_CTRL_RD_FULL_SHFT = 0x5, -+ S_SWAY_BUF_STATUS_1_RCH1_CTRL_RD_EMPTY_BMSK = 0x10, -+ S_SWAY_BUF_STATUS_1_RCH1_CTRL_RD_EMPTY_SHFT = 0x4, -+}; -+ -+#define S_SWAY_BUF_STATUS_2_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000420) -+enum bimc_s_sway_buf_status_2 { -+ S_SWAY_BUF_STATUS_2_RMSK = 0x30, -+ S_SWAY_BUF_STATUS_2_QCH_RD_FULL_BMSK = 0x20, -+ S_SWAY_BUF_STATUS_2_QCH_RD_FULL_SHFT = 0x5, -+ S_SWAY_BUF_STATUS_2_QCH_RD_EMPTY_BMSK = 0x10, -+ S_SWAY_BUF_STATUS_2_QCH_RD_EMPTY_SHFT = 0x4, -+}; -+ -+/* S_ARB_GENERIC */ -+ -+#define S_ARB_REG_BASE(b) ((b) + 0x00049000) -+ -+#define S_ARB_COMPONENT_INFO_ADDR(b, n) \ -+ (S_SWAY_REG_BASE(b) + (0x8000 * (n)) + 0x00000000) -+enum bimc_s_arb_component_info { -+ S_ARB_COMPONENT_INFO_RMSK = 0xffffff, -+ S_ARB_COMPONENT_INFO_INSTANCE_BMSK = 0xff0000, -+ S_ARB_COMPONENT_INFO_INSTANCE_SHFT = 0x10, -+ S_ARB_COMPONENT_INFO_SUB_TYPE_BMSK = 0xff00, -+ S_ARB_COMPONENT_INFO_SUB_TYPE_SHFT = 0x8, -+ S_ARB_COMPONENT_INFO_TYPE_BMSK = 0xff, -+ S_ARB_COMPONENT_INFO_TYPE_SHFT = 0x0, -+}; -+ -+#define S_ARB_CONFIG_INFO_0_ADDR(b, n) \ -+ (S_ARB_REG_BASE(b) + (0x8000 * (n)) + 0x00000020) -+enum bimc_s_arb_config_info_0 { -+ S_ARB_CONFIG_INFO_0_RMSK = 0x800000ff, -+ S_ARB_CONFIG_INFO_0_ARB2SW_PIPELINE_EN_BMSK = 0x80000000, -+ S_ARB_CONFIG_INFO_0_ARB2SW_PIPELINE_EN_SHFT = 0x1f, -+ S_ARB_CONFIG_INFO_0_FUNC_BMSK = 0xff, -+ S_ARB_CONFIG_INFO_0_FUNC_SHFT = 0x0, -+}; -+ -+#define S_ARB_CONFIG_INFO_1_ADDR(b, n) \ -+ (S_ARB_REG_BASE(b) + (0x8000 * (n)) + 0x00000030) -+enum bimc_s_arb_config_info_1 { -+ S_ARB_CONFIG_INFO_1_RMSK = 0xffffffff, -+ S_ARB_CONFIG_INFO_1_MPORT_CONNECTIVITY_BMSK = 0xffffffff, -+ S_ARB_CONFIG_INFO_1_MPORT_CONNECTIVITY_SHFT = 0x0, -+}; -+ -+#define S_ARB_CLK_CTRL_ADDR(b) \ -+ (S_ARB_REG_BASE(b) + (0x8000 * (n)) + 0x00000200) -+enum bimc_s_arb_clk_ctrl { -+ S_ARB_CLK_CTRL_RMSK = 0x1, -+ S_ARB_CLK_CTRL_SLAVE_CLK_GATING_EN_BMSK = 0x2, -+ S_ARB_CLK_CTRL_SLAVE_CLK_GATING_EN_SHFT = 0x1, -+ S_ARB_CLK_CTRL_CORE_CLK_GATING_EN_BMSK = 0x1, -+ S_ARB_CLK_CTRL_CORE_CLK_GATING_EN_SHFT = 0x0, -+ S_ARB_CLK_CTRL_CLK_GATING_EN_BMSK = 0x1, -+ S_ARB_CLK_CTRL_CLK_GATING_EN_SHFT = 0x0, -+}; -+ -+#define S_ARB_MODE_ADDR(b, n) \ -+ (S_ARB_REG_BASE(b) + (0x8000 * (n)) + 0x00000210) -+enum bimc_s_arb_mode { -+ S_ARB_MODE_RMSK = 0xf0000001, -+ S_ARB_MODE_WR_GRANTS_AHEAD_BMSK = 0xf0000000, -+ S_ARB_MODE_WR_GRANTS_AHEAD_SHFT = 0x1c, -+ S_ARB_MODE_PRIO_RR_EN_BMSK = 0x1, -+ S_ARB_MODE_PRIO_RR_EN_SHFT = 0x0, -+}; -+ -+#define BKE_HEALTH_MASK \ -+ (M_BKE_HEALTH_0_CONFIG_LIMIT_CMDS_BMSK |\ -+ M_BKE_HEALTH_0_CONFIG_AREQPRIO_BMSK |\ -+ M_BKE_HEALTH_0_CONFIG_PRIOLVL_BMSK) -+ -+#define BKE_HEALTH_VAL(limit, areq, plvl) \ -+ ((((limit) << M_BKE_HEALTH_0_CONFIG_LIMIT_CMDS_SHFT) & \ -+ M_BKE_HEALTH_0_CONFIG_LIMIT_CMDS_BMSK) | \ -+ (((areq) << M_BKE_HEALTH_0_CONFIG_AREQPRIO_SHFT) & \ -+ M_BKE_HEALTH_0_CONFIG_AREQPRIO_BMSK) | \ -+ (((plvl) << M_BKE_HEALTH_0_CONFIG_PRIOLVL_SHFT) & \ -+ M_BKE_HEALTH_0_CONFIG_PRIOLVL_BMSK)) -+ -+#define MAX_GRANT_PERIOD \ -+ (M_BKE_GP_GP_BMSK >> \ -+ M_BKE_GP_GP_SHFT) -+ -+#define MAX_GC \ -+ (M_BKE_GC_GC_BMSK >> \ -+ (M_BKE_GC_GC_SHFT + 1)) -+ -+static int bimc_div(int64_t *a, uint32_t b) -+{ -+ if ((*a > 0) && (*a < b)) { -+ *a = 0; -+ return 1; -+ } else { -+ return do_div(*a, b); -+ } -+} -+ -+#define ENABLE(val) ((val) == 1 ? 1 : 0) -+void msm_bus_bimc_set_mas_clk_gate(struct msm_bus_bimc_info *binfo, -+ uint32_t mas_index, struct msm_bus_bimc_clk_gate *bgate) -+{ -+ uint32_t val, mask, reg_val; -+ void __iomem *addr; -+ -+ reg_val = readl_relaxed(M_CLK_CTRL_ADDR(binfo->base, -+ mas_index)) & M_CLK_CTRL_RMSK; -+ addr = M_CLK_CTRL_ADDR(binfo->base, mas_index); -+ mask = (M_CLK_CTRL_MAS_CLK_GATING_EN_BMSK | -+ M_CLK_CTRL_CORE_CLK_GATING_EN_BMSK); -+ val = (bgate->core_clk_gate_en << -+ M_CLK_CTRL_MAS_CLK_GATING_EN_SHFT) | -+ bgate->port_clk_gate_en; -+ writel_relaxed(((reg_val & (~mask)) | (val & mask)), addr); -+ /* Ensure clock gating enable mask is set before exiting */ -+ wmb(); -+} -+ -+void msm_bus_bimc_arb_en(struct msm_bus_bimc_info *binfo, -+ uint32_t slv_index, bool en) -+{ -+ uint32_t reg_val, reg_mask_val, enable, val; -+ -+ reg_mask_val = (readl_relaxed(S_ARB_CONFIG_INFO_0_ADDR(binfo-> -+ base, slv_index)) & S_ARB_CONFIG_INFO_0_FUNC_BMSK) -+ >> S_ARB_CONFIG_INFO_0_FUNC_SHFT; -+ enable = ENABLE(en); -+ val = enable << S_ARB_MODE_PRIO_RR_EN_SHFT; -+ if (reg_mask_val == BIMC_ARB_MODE_PRIORITY_RR) { -+ reg_val = readl_relaxed(S_ARB_CONFIG_INFO_0_ADDR(binfo-> -+ base, slv_index)) & S_ARB_MODE_RMSK; -+ writel_relaxed(((reg_val & (~(S_ARB_MODE_PRIO_RR_EN_BMSK))) | -+ (val & S_ARB_MODE_PRIO_RR_EN_BMSK)), -+ S_ARB_MODE_ADDR(binfo->base, slv_index)); -+ /* Ensure arbitration mode is set before returning */ -+ wmb(); -+ } -+} -+ -+static void set_qos_mode(void __iomem *baddr, uint32_t index, uint32_t val0, -+ uint32_t val1, uint32_t val2) -+{ -+ uint32_t reg_val, val; -+ -+ reg_val = readl_relaxed(M_PRIOLVL_OVERRIDE_ADDR(baddr, -+ index)) & M_PRIOLVL_OVERRIDE_RMSK; -+ val = val0 << M_PRIOLVL_OVERRIDE_OVERRIDE_PRIOLVL_SHFT; -+ writel_relaxed(((reg_val & ~(M_PRIOLVL_OVERRIDE_OVERRIDE_PRIOLVL_BMSK)) -+ | (val & M_PRIOLVL_OVERRIDE_OVERRIDE_PRIOLVL_BMSK)), -+ M_PRIOLVL_OVERRIDE_ADDR(baddr, index)); -+ reg_val = readl_relaxed(M_RD_CMD_OVERRIDE_ADDR(baddr, index)) & -+ M_RD_CMD_OVERRIDE_RMSK; -+ val = val1 << M_RD_CMD_OVERRIDE_OVERRIDE_AREQPRIO_SHFT; -+ writel_relaxed(((reg_val & ~(M_RD_CMD_OVERRIDE_OVERRIDE_AREQPRIO_BMSK -+ )) | (val & M_RD_CMD_OVERRIDE_OVERRIDE_AREQPRIO_BMSK)), -+ M_RD_CMD_OVERRIDE_ADDR(baddr, index)); -+ reg_val = readl_relaxed(M_WR_CMD_OVERRIDE_ADDR(baddr, index)) & -+ M_WR_CMD_OVERRIDE_RMSK; -+ val = val2 << M_WR_CMD_OVERRIDE_OVERRIDE_AREQPRIO_SHFT; -+ writel_relaxed(((reg_val & ~(M_WR_CMD_OVERRIDE_OVERRIDE_AREQPRIO_BMSK -+ )) | (val & M_WR_CMD_OVERRIDE_OVERRIDE_AREQPRIO_BMSK)), -+ M_WR_CMD_OVERRIDE_ADDR(baddr, index)); -+ /* Ensure the priority register writes go through */ -+ wmb(); -+} -+ -+static void msm_bus_bimc_set_qos_mode(void __iomem *base, -+ uint32_t mas_index, uint8_t qmode_sel) -+{ -+ uint32_t reg_val, val; -+ -+ switch (qmode_sel) { -+ case BIMC_QOS_MODE_FIXED: -+ reg_val = readl_relaxed(M_BKE_EN_ADDR(base, -+ mas_index)); -+ writel_relaxed((reg_val & (~M_BKE_EN_EN_BMSK)), -+ M_BKE_EN_ADDR(base, mas_index)); -+ /* Ensure that the book-keeping register writes -+ * go through before setting QoS mode. -+ * QoS mode registers might write beyond 1K -+ * boundary in future -+ */ -+ wmb(); -+ set_qos_mode(base, mas_index, 1, 1, 1); -+ break; -+ -+ case BIMC_QOS_MODE_BYPASS: -+ reg_val = readl_relaxed(M_BKE_EN_ADDR(base, -+ mas_index)); -+ writel_relaxed((reg_val & (~M_BKE_EN_EN_BMSK)), -+ M_BKE_EN_ADDR(base, mas_index)); -+ /* Ensure that the book-keeping register writes -+ * go through before setting QoS mode. -+ * QoS mode registers might write beyond 1K -+ * boundary in future -+ */ -+ wmb(); -+ set_qos_mode(base, mas_index, 0, 0, 0); -+ break; -+ -+ case BIMC_QOS_MODE_REGULATOR: -+ case BIMC_QOS_MODE_LIMITER: -+ set_qos_mode(base, mas_index, 0, 0, 0); -+ reg_val = readl_relaxed(M_BKE_EN_ADDR(base, -+ mas_index)); -+ val = 1 << M_BKE_EN_EN_SHFT; -+ /* Ensure that the book-keeping register writes -+ * go through before setting QoS mode. -+ * QoS mode registers might write beyond 1K -+ * boundary in future -+ */ -+ wmb(); -+ writel_relaxed(((reg_val & (~M_BKE_EN_EN_BMSK)) | (val & -+ M_BKE_EN_EN_BMSK)), M_BKE_EN_ADDR(base, -+ mas_index)); -+ break; -+ default: -+ break; -+ } -+} -+ -+static void set_qos_prio_rl(void __iomem *addr, uint32_t rmsk, -+ uint8_t index, struct msm_bus_bimc_qos_mode *qmode) -+{ -+ uint32_t reg_val, val0, val; -+ -+ /* Note, addr is already passed with right mas_index */ -+ reg_val = readl_relaxed(addr) & rmsk; -+ val0 = BKE_HEALTH_VAL(qmode->rl.qhealth[index].limit_commands, -+ qmode->rl.qhealth[index].areq_prio, -+ qmode->rl.qhealth[index].prio_level); -+ val = ((reg_val & (~(BKE_HEALTH_MASK))) | (val0 & BKE_HEALTH_MASK)); -+ writel_relaxed(val, addr); -+ /* Ensure that priority for regulator/limiter modes are -+ * set before returning -+ */ -+ wmb(); -+ -+} -+ -+static void msm_bus_bimc_set_qos_prio(void __iomem *base, -+ uint32_t mas_index, uint8_t qmode_sel, -+ struct msm_bus_bimc_qos_mode *qmode) -+{ -+ uint32_t reg_val, val; -+ -+ switch (qmode_sel) { -+ case BIMC_QOS_MODE_FIXED: -+ reg_val = readl_relaxed(M_PRIOLVL_OVERRIDE_ADDR( -+ base, mas_index)) & M_PRIOLVL_OVERRIDE_RMSK; -+ val = qmode->fixed.prio_level << -+ M_PRIOLVL_OVERRIDE_SHFT; -+ writel_relaxed(((reg_val & -+ ~(M_PRIOLVL_OVERRIDE_BMSK)) | (val -+ & M_PRIOLVL_OVERRIDE_BMSK)), -+ M_PRIOLVL_OVERRIDE_ADDR(base, mas_index)); -+ -+ reg_val = readl_relaxed(M_RD_CMD_OVERRIDE_ADDR( -+ base, mas_index)) & M_RD_CMD_OVERRIDE_RMSK; -+ val = qmode->fixed.areq_prio_rd << -+ M_RD_CMD_OVERRIDE_AREQPRIO_SHFT; -+ writel_relaxed(((reg_val & ~(M_RD_CMD_OVERRIDE_AREQPRIO_BMSK)) -+ | (val & M_RD_CMD_OVERRIDE_AREQPRIO_BMSK)), -+ M_RD_CMD_OVERRIDE_ADDR(base, mas_index)); -+ -+ reg_val = readl_relaxed(M_WR_CMD_OVERRIDE_ADDR( -+ base, mas_index)) & M_WR_CMD_OVERRIDE_RMSK; -+ val = qmode->fixed.areq_prio_wr << -+ M_WR_CMD_OVERRIDE_AREQPRIO_SHFT; -+ writel_relaxed(((reg_val & ~(M_WR_CMD_OVERRIDE_AREQPRIO_BMSK)) -+ | (val & M_WR_CMD_OVERRIDE_AREQPRIO_BMSK)), -+ M_WR_CMD_OVERRIDE_ADDR(base, mas_index)); -+ /* Ensure that fixed mode register writes go through -+ * before returning -+ */ -+ wmb(); -+ break; -+ -+ case BIMC_QOS_MODE_REGULATOR: -+ case BIMC_QOS_MODE_LIMITER: -+ set_qos_prio_rl(M_BKE_HEALTH_3_CONFIG_ADDR(base, -+ mas_index), M_BKE_HEALTH_3_CONFIG_RMSK, 3, qmode); -+ set_qos_prio_rl(M_BKE_HEALTH_2_CONFIG_ADDR(base, -+ mas_index), M_BKE_HEALTH_2_CONFIG_RMSK, 2, qmode); -+ set_qos_prio_rl(M_BKE_HEALTH_1_CONFIG_ADDR(base, -+ mas_index), M_BKE_HEALTH_1_CONFIG_RMSK, 1, qmode); -+ set_qos_prio_rl(M_BKE_HEALTH_0_CONFIG_ADDR(base, -+ mas_index), M_BKE_HEALTH_0_CONFIG_RMSK, 0 , qmode); -+ break; -+ case BIMC_QOS_MODE_BYPASS: -+ default: -+ break; -+ } -+} -+ -+static void set_qos_bw_regs(void __iomem *baddr, uint32_t mas_index, -+ int32_t th, int32_t tm, int32_t tl, uint32_t gp, -+ uint32_t gc) -+{ -+ int32_t reg_val, val; -+ int32_t bke_reg_val; -+ int16_t val2; -+ -+ /* Disable BKE before writing to registers as per spec */ -+ bke_reg_val = readl_relaxed(M_BKE_EN_ADDR(baddr, mas_index)); -+ writel_relaxed((bke_reg_val & ~(M_BKE_EN_EN_BMSK)), -+ M_BKE_EN_ADDR(baddr, mas_index)); -+ -+ /* Write values of registers calculated */ -+ reg_val = readl_relaxed(M_BKE_GP_ADDR(baddr, mas_index)) -+ & M_BKE_GP_RMSK; -+ val = gp << M_BKE_GP_GP_SHFT; -+ writel_relaxed(((reg_val & ~(M_BKE_GP_GP_BMSK)) | (val & -+ M_BKE_GP_GP_BMSK)), M_BKE_GP_ADDR(baddr, mas_index)); -+ -+ reg_val = readl_relaxed(M_BKE_GC_ADDR(baddr, mas_index)) & -+ M_BKE_GC_RMSK; -+ val = gc << M_BKE_GC_GC_SHFT; -+ writel_relaxed(((reg_val & ~(M_BKE_GC_GC_BMSK)) | (val & -+ M_BKE_GC_GC_BMSK)), M_BKE_GC_ADDR(baddr, mas_index)); -+ -+ reg_val = readl_relaxed(M_BKE_THH_ADDR(baddr, mas_index)) & -+ M_BKE_THH_RMSK; -+ val = th << M_BKE_THH_THRESH_SHFT; -+ writel_relaxed(((reg_val & ~(M_BKE_THH_THRESH_BMSK)) | (val & -+ M_BKE_THH_THRESH_BMSK)), M_BKE_THH_ADDR(baddr, mas_index)); -+ -+ reg_val = readl_relaxed(M_BKE_THM_ADDR(baddr, mas_index)) & -+ M_BKE_THM_RMSK; -+ val2 = tm << M_BKE_THM_THRESH_SHFT; -+ writel_relaxed(((reg_val & ~(M_BKE_THM_THRESH_BMSK)) | (val2 & -+ M_BKE_THM_THRESH_BMSK)), M_BKE_THM_ADDR(baddr, mas_index)); -+ -+ reg_val = readl_relaxed(M_BKE_THL_ADDR(baddr, mas_index)) & -+ M_BKE_THL_RMSK; -+ val2 = tl << M_BKE_THL_THRESH_SHFT; -+ writel_relaxed(((reg_val & ~(M_BKE_THL_THRESH_BMSK)) | -+ (val2 & M_BKE_THL_THRESH_BMSK)), M_BKE_THL_ADDR(baddr, -+ mas_index)); -+ -+ /* Ensure that all bandwidth register writes have completed -+ * before returning -+ */ -+ wmb(); -+} -+ -+static void msm_bus_bimc_set_qos_bw(void __iomem *base, uint32_t qos_freq, -+ uint32_t mas_index, struct msm_bus_bimc_qos_bw *qbw) -+{ -+ uint32_t bke_en; -+ -+ /* Validate QOS Frequency */ -+ if (qos_freq == 0) { -+ MSM_BUS_DBG("Zero frequency\n"); -+ return; -+ } -+ -+ /* Get enable bit for BKE before programming the period */ -+ bke_en = (readl_relaxed(M_BKE_EN_ADDR(base, mas_index)) & -+ M_BKE_EN_EN_BMSK) >> M_BKE_EN_EN_SHFT; -+ -+ /* Only calculate if there's a requested bandwidth and window */ -+ if (qbw->bw && qbw->ws) { -+ int64_t th, tm, tl; -+ uint32_t gp, gc; -+ int64_t gp_nominal, gp_required, gp_calc, data, temp; -+ int64_t win = qbw->ws * qos_freq; -+ temp = win; -+ /* -+ * Calculate nominal grant period defined by requested -+ * window size. -+ * Ceil this value to max grant period. -+ */ -+ bimc_div(&temp, 1000000); -+ gp_nominal = min_t(uint64_t, MAX_GRANT_PERIOD, temp); -+ /* -+ * Calculate max window size, defined by bw request. -+ * Units: (KHz, MB/s) -+ */ -+ gp_calc = MAX_GC * qos_freq * 1000; -+ gp_required = gp_calc; -+ bimc_div(&gp_required, qbw->bw); -+ -+ /* User min of two grant periods */ -+ gp = min_t(int64_t, gp_nominal, gp_required); -+ -+ /* Calculate bandwith in grants and ceil. */ -+ temp = qbw->bw * gp; -+ data = qos_freq * 1000; -+ bimc_div(&temp, data); -+ gc = min_t(int64_t, MAX_GC, temp); -+ -+ /* Calculate thresholds */ -+ th = qbw->bw - qbw->thh; -+ tm = qbw->bw - qbw->thm; -+ tl = qbw->bw - qbw->thl; -+ -+ th = th * gp; -+ bimc_div(&th, data); -+ tm = tm * gp; -+ bimc_div(&tm, data); -+ tl = tl * gp; -+ bimc_div(&tl, data); -+ -+ MSM_BUS_DBG("BIMC: BW: mas_index: %d, th: %llu tm: %llu\n", -+ mas_index, th, tm); -+ MSM_BUS_DBG("BIMC: tl: %llu gp:%u gc: %u bke_en: %u\n", -+ tl, gp, gc, bke_en); -+ set_qos_bw_regs(base, mas_index, th, tm, tl, gp, gc); -+ } else -+ /* Clear bandwidth registers */ -+ set_qos_bw_regs(base, mas_index, 0, 0, 0, 0, 0); -+} -+ -+static int msm_bus_bimc_allocate_commit_data(struct msm_bus_fabric_registration -+ *fab_pdata, void **cdata, int ctx) -+{ -+ struct msm_bus_bimc_commit **cd = (struct msm_bus_bimc_commit **)cdata; -+ struct msm_bus_bimc_info *binfo = -+ (struct msm_bus_bimc_info *)fab_pdata->hw_data; -+ -+ MSM_BUS_DBG("Allocating BIMC commit data\n"); -+ *cd = kzalloc(sizeof(struct msm_bus_bimc_commit), GFP_KERNEL); -+ if (!*cd) { -+ MSM_BUS_DBG("Couldn't alloc mem for cdata\n"); -+ return -ENOMEM; -+ } -+ -+ (*cd)->mas = binfo->cdata[ctx].mas; -+ (*cd)->slv = binfo->cdata[ctx].slv; -+ -+ return 0; -+} -+ -+static void *msm_bus_bimc_allocate_bimc_data(struct platform_device *pdev, -+ struct msm_bus_fabric_registration *fab_pdata) -+{ -+ struct resource *bimc_mem; -+ struct resource *bimc_io; -+ struct msm_bus_bimc_info *binfo; -+ int i; -+ -+ MSM_BUS_DBG("Allocating BIMC data\n"); -+ binfo = kzalloc(sizeof(struct msm_bus_bimc_info), GFP_KERNEL); -+ if (!binfo) { -+ WARN(!binfo, "Couldn't alloc mem for bimc_info\n"); -+ return NULL; -+ } -+ -+ binfo->qos_freq = fab_pdata->qos_freq; -+ -+ binfo->params.nmasters = fab_pdata->nmasters; -+ binfo->params.nslaves = fab_pdata->nslaves; -+ binfo->params.bus_id = fab_pdata->id; -+ -+ for (i = 0; i < NUM_CTX; i++) { -+ binfo->cdata[i].mas = kzalloc(sizeof(struct -+ msm_bus_node_hw_info) * fab_pdata->nmasters * 2, -+ GFP_KERNEL); -+ if (!binfo->cdata[i].mas) { -+ MSM_BUS_ERR("Couldn't alloc mem for bimc master hw\n"); -+ kfree(binfo); -+ return NULL; -+ } -+ -+ binfo->cdata[i].slv = kzalloc(sizeof(struct -+ msm_bus_node_hw_info) * fab_pdata->nslaves * 2, -+ GFP_KERNEL); -+ if (!binfo->cdata[i].slv) { -+ MSM_BUS_DBG("Couldn't alloc mem for bimc slave hw\n"); -+ kfree(binfo->cdata[i].mas); -+ kfree(binfo); -+ return NULL; -+ } -+ } -+ -+ if (fab_pdata->virt) { -+ MSM_BUS_DBG("Don't get memory regions for virtual fabric\n"); -+ goto skip_mem; -+ } -+ -+ bimc_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!bimc_mem) { -+ MSM_BUS_ERR("Cannot get BIMC Base address\n"); -+ kfree(binfo); -+ return NULL; -+ } -+ -+ bimc_io = request_mem_region(bimc_mem->start, -+ resource_size(bimc_mem), pdev->name); -+ if (!bimc_io) { -+ MSM_BUS_ERR("BIMC memory unavailable\n"); -+ kfree(binfo); -+ return NULL; -+ } -+ -+ binfo->base = ioremap(bimc_mem->start, resource_size(bimc_mem)); -+ if (!binfo->base) { -+ MSM_BUS_ERR("IOremap failed for BIMC!\n"); -+ release_mem_region(bimc_mem->start, resource_size(bimc_mem)); -+ kfree(binfo); -+ return NULL; -+ } -+ -+skip_mem: -+ fab_pdata->hw_data = (void *)binfo; -+ return (void *)binfo; -+} -+ -+static void free_commit_data(void *cdata) -+{ -+ struct msm_bus_bimc_commit *cd = (struct msm_bus_bimc_commit *)cdata; -+ -+ kfree(cd->mas); -+ kfree(cd->slv); -+ kfree(cd); -+} -+ -+static void bke_switch( -+ void __iomem *baddr, uint32_t mas_index, bool req, int mode) -+{ -+ uint32_t reg_val, val, cur_val; -+ -+ val = req << M_BKE_EN_EN_SHFT; -+ reg_val = readl_relaxed(M_BKE_EN_ADDR(baddr, mas_index)); -+ cur_val = reg_val & M_BKE_EN_RMSK; -+ if (val == cur_val) -+ return; -+ -+ if (!req && mode == BIMC_QOS_MODE_FIXED) -+ set_qos_mode(baddr, mas_index, 1, 1, 1); -+ -+ writel_relaxed(((reg_val & ~(M_BKE_EN_EN_BMSK)) | (val & -+ M_BKE_EN_EN_BMSK)), M_BKE_EN_ADDR(baddr, mas_index)); -+ /* Make sure BKE on/off goes through before changing priorities */ -+ wmb(); -+ -+ if (req) -+ set_qos_mode(baddr, mas_index, 0, 0, 0); -+} -+ -+static void bimc_set_static_qos_bw(void __iomem *base, unsigned int qos_freq, -+ int mport, struct msm_bus_bimc_qos_bw *qbw) -+{ -+ int32_t bw_mbps, thh = 0, thm, thl, gc; -+ int32_t gp; -+ u64 temp; -+ -+ if (qos_freq == 0) { -+ MSM_BUS_DBG("No QoS Frequency.\n"); -+ return; -+ } -+ -+ if (!(qbw->bw && qbw->gp)) { -+ MSM_BUS_DBG("No QoS Bandwidth or Window size\n"); -+ return; -+ } -+ -+ /* Convert bandwidth to MBPS */ -+ temp = qbw->bw; -+ bimc_div(&temp, 1000000); -+ bw_mbps = temp; -+ -+ /* Grant period in clock cycles -+ * Grant period from bandwidth structure -+ * is in nano seconds, QoS freq is in KHz. -+ * Divide by 1000 to get clock cycles. -+ */ -+ gp = (qos_freq * qbw->gp) / (1000 * NSEC_PER_USEC); -+ -+ /* Grant count = BW in MBps * Grant period -+ * in micro seconds -+ */ -+ gc = bw_mbps * (qbw->gp / NSEC_PER_USEC); -+ gc = min(gc, MAX_GC); -+ -+ /* Medium threshold = -((Medium Threshold percentage * -+ * Grant count) / 100) -+ */ -+ thm = -((qbw->thmp * gc) / 100); -+ qbw->thm = thm; -+ -+ /* Low threshold = -(Grant count) */ -+ thl = -gc; -+ qbw->thl = thl; -+ -+ MSM_BUS_DBG("%s: BKE parameters: gp %d, gc %d, thm %d thl %d thh %d", -+ __func__, gp, gc, thm, thl, thh); -+ -+ trace_bus_bke_params(gc, gp, thl, thm, thl); -+ set_qos_bw_regs(base, mport, thh, thm, thl, gp, gc); -+} -+ -+static void msm_bus_bimc_config_master( -+ struct msm_bus_fabric_registration *fab_pdata, -+ struct msm_bus_inode_info *info, -+ uint64_t req_clk, uint64_t req_bw) -+{ -+ int mode, i, ports; -+ struct msm_bus_bimc_info *binfo; -+ uint64_t bw = 0; -+ -+ binfo = (struct msm_bus_bimc_info *)fab_pdata->hw_data; -+ ports = info->node_info->num_mports; -+ -+ /** -+ * Here check the details of dual configuration. -+ * Take actions based on different modes. -+ * Check for threshold if limiter mode, etc. -+ */ -+ -+ if (req_clk <= info->node_info->th[0]) { -+ mode = info->node_info->mode; -+ bw = info->node_info->bimc_bw[0]; -+ } else if ((info->node_info->num_thresh > 1) && -+ (req_clk <= info->node_info->th[1])) { -+ mode = info->node_info->mode; -+ bw = info->node_info->bimc_bw[1]; -+ } else -+ mode = info->node_info->mode_thresh; -+ -+ switch (mode) { -+ case BIMC_QOS_MODE_BYPASS: -+ case BIMC_QOS_MODE_FIXED: -+ for (i = 0; i < ports; i++) -+ bke_switch(binfo->base, info->node_info->qport[i], -+ BKE_OFF, mode); -+ break; -+ case BIMC_QOS_MODE_REGULATOR: -+ case BIMC_QOS_MODE_LIMITER: -+ for (i = 0; i < ports; i++) { -+ /* If not in fixed mode, update bandwidth */ -+ if ((info->node_info->cur_lim_bw != bw) -+ && (mode != BIMC_QOS_MODE_FIXED)) { -+ struct msm_bus_bimc_qos_bw qbw; -+ qbw.ws = info->node_info->ws; -+ qbw.bw = bw; -+ qbw.gp = info->node_info->bimc_gp; -+ qbw.thmp = info->node_info->bimc_thmp; -+ bimc_set_static_qos_bw(binfo->base, -+ binfo->qos_freq, -+ info->node_info->qport[i], &qbw); -+ info->node_info->cur_lim_bw = bw; -+ MSM_BUS_DBG("%s: Qos is %d reqclk %llu bw %llu", -+ __func__, mode, req_clk, bw); -+ } -+ bke_switch(binfo->base, info->node_info->qport[i], -+ BKE_ON, mode); -+ } -+ break; -+ default: -+ break; -+ } -+} -+ -+static void msm_bus_bimc_update_bw(struct msm_bus_inode_info *hop, -+ struct msm_bus_inode_info *info, -+ struct msm_bus_fabric_registration *fab_pdata, -+ void *sel_cdata, int *master_tiers, -+ int64_t add_bw) -+{ -+ struct msm_bus_bimc_info *binfo; -+ struct msm_bus_bimc_qos_bw qbw; -+ int i; -+ int64_t bw; -+ int ports = info->node_info->num_mports; -+ struct msm_bus_bimc_commit *sel_cd = -+ (struct msm_bus_bimc_commit *)sel_cdata; -+ -+ MSM_BUS_DBG("BIMC: Update bw for ID %d, with IID: %d: %lld\n", -+ info->node_info->id, info->node_info->priv_id, add_bw); -+ -+ binfo = (struct msm_bus_bimc_info *)fab_pdata->hw_data; -+ -+ if (info->node_info->num_mports == 0) { -+ MSM_BUS_DBG("BIMC: Skip Master BW\n"); -+ goto skip_mas_bw; -+ } -+ -+ ports = info->node_info->num_mports; -+ bw = INTERLEAVED_BW(fab_pdata, add_bw, ports); -+ -+ for (i = 0; i < ports; i++) { -+ sel_cd->mas[info->node_info->masterp[i]].bw += bw; -+ sel_cd->mas[info->node_info->masterp[i]].hw_id = -+ info->node_info->mas_hw_id; -+ MSM_BUS_DBG("BIMC: Update mas_bw for ID: %d -> %llu\n", -+ info->node_info->priv_id, -+ sel_cd->mas[info->node_info->masterp[i]].bw); -+ if (info->node_info->hw_sel == MSM_BUS_RPM) -+ sel_cd->mas[info->node_info->masterp[i]].dirty = 1; -+ else { -+ if (!info->node_info->qport) { -+ MSM_BUS_DBG("No qos ports to update!\n"); -+ break; -+ } -+ if (!(info->node_info->mode == BIMC_QOS_MODE_REGULATOR) -+ || (info->node_info->mode == -+ BIMC_QOS_MODE_LIMITER)) { -+ MSM_BUS_DBG("Skip QoS reg programming\n"); -+ break; -+ } -+ -+ MSM_BUS_DBG("qport: %d\n", info->node_info->qport[i]); -+ qbw.bw = sel_cd->mas[info->node_info->masterp[i]].bw; -+ qbw.ws = info->node_info->ws; -+ /* Threshold low = 90% of bw */ -+ qbw.thl = div_s64((90 * bw), 100); -+ /* Threshold medium = bw */ -+ qbw.thm = bw; -+ /* Threshold high = 10% more than bw */ -+ qbw.thh = div_s64((110 * bw), 100); -+ /* Check if info is a shared master. -+ * If it is, mark it dirty -+ * If it isn't, then set QOS Bandwidth. -+ * Also if dual-conf is set, don't program bw regs. -+ **/ -+ if (!info->node_info->dual_conf && -+ ((info->node_info->mode == BIMC_QOS_MODE_LIMITER) || -+ (info->node_info->mode == BIMC_QOS_MODE_REGULATOR))) -+ msm_bus_bimc_set_qos_bw(binfo->base, -+ binfo->qos_freq, -+ info->node_info->qport[i], &qbw); -+ } -+ } -+ -+skip_mas_bw: -+ ports = hop->node_info->num_sports; -+ MSM_BUS_DBG("BIMC: ID: %d, Sports: %d\n", hop->node_info->priv_id, -+ ports); -+ -+ for (i = 0; i < ports; i++) { -+ sel_cd->slv[hop->node_info->slavep[i]].bw += add_bw; -+ sel_cd->slv[hop->node_info->slavep[i]].hw_id = -+ hop->node_info->slv_hw_id; -+ MSM_BUS_DBG("BIMC: Update slave_bw: ID: %d -> %llu\n", -+ hop->node_info->priv_id, -+ sel_cd->slv[hop->node_info->slavep[i]].bw); -+ MSM_BUS_DBG("BIMC: Update slave_bw: index: %d\n", -+ hop->node_info->slavep[i]); -+ /* Check if hop is a shared slave. -+ * If it is, mark it dirty -+ * If it isn't, then nothing to be done as the -+ * slaves are in bypass mode. -+ **/ -+ if (hop->node_info->hw_sel == MSM_BUS_RPM) { -+ MSM_BUS_DBG("Slave dirty: %d, slavep: %d\n", -+ hop->node_info->priv_id, -+ hop->node_info->slavep[i]); -+ sel_cd->slv[hop->node_info->slavep[i]].dirty = 1; -+ } -+ } -+} -+ -+static int msm_bus_bimc_commit(struct msm_bus_fabric_registration -+ *fab_pdata, void *hw_data, void **cdata) -+{ -+ MSM_BUS_DBG("\nReached BIMC Commit\n"); -+ msm_bus_remote_hw_commit(fab_pdata, hw_data, cdata); -+ return 0; -+} -+ -+static void msm_bus_bimc_config_limiter( -+ struct msm_bus_fabric_registration *fab_pdata, -+ struct msm_bus_inode_info *info) -+{ -+ struct msm_bus_bimc_info *binfo; -+ int mode, i, ports; -+ -+ binfo = (struct msm_bus_bimc_info *)fab_pdata->hw_data; -+ ports = info->node_info->num_mports; -+ -+ if (!info->node_info->qport) { -+ MSM_BUS_DBG("No QoS Ports to init\n"); -+ return; -+ } -+ -+ if (info->cur_lim_bw) -+ mode = BIMC_QOS_MODE_LIMITER; -+ else -+ mode = info->node_info->mode; -+ -+ switch (mode) { -+ case BIMC_QOS_MODE_BYPASS: -+ case BIMC_QOS_MODE_FIXED: -+ for (i = 0; i < ports; i++) -+ bke_switch(binfo->base, info->node_info->qport[i], -+ BKE_OFF, mode); -+ break; -+ case BIMC_QOS_MODE_REGULATOR: -+ case BIMC_QOS_MODE_LIMITER: -+ if (info->cur_lim_bw != info->cur_prg_bw) { -+ MSM_BUS_DBG("Enabled BKE throttling node %d to %llu\n", -+ info->node_info->id, info->cur_lim_bw); -+ trace_bus_bimc_config_limiter(info->node_info->id, -+ info->cur_lim_bw); -+ for (i = 0; i < ports; i++) { -+ /* If not in fixed mode, update bandwidth */ -+ struct msm_bus_bimc_qos_bw qbw; -+ -+ qbw.ws = info->node_info->ws; -+ qbw.bw = info->cur_lim_bw; -+ qbw.gp = info->node_info->bimc_gp; -+ qbw.thmp = info->node_info->bimc_thmp; -+ bimc_set_static_qos_bw(binfo->base, -+ binfo->qos_freq, -+ info->node_info->qport[i], &qbw); -+ bke_switch(binfo->base, -+ info->node_info->qport[i], -+ BKE_ON, mode); -+ info->cur_prg_bw = qbw.bw; -+ } -+ } -+ break; -+ default: -+ break; -+ } -+} -+ -+static void bimc_init_mas_reg(struct msm_bus_bimc_info *binfo, -+ struct msm_bus_inode_info *info, -+ struct msm_bus_bimc_qos_mode *qmode, int mode) -+{ -+ int i; -+ -+ switch (mode) { -+ case BIMC_QOS_MODE_FIXED: -+ qmode->fixed.prio_level = info->node_info->prio_lvl; -+ qmode->fixed.areq_prio_rd = info->node_info->prio_rd; -+ qmode->fixed.areq_prio_wr = info->node_info->prio_wr; -+ break; -+ case BIMC_QOS_MODE_LIMITER: -+ qmode->rl.qhealth[0].limit_commands = 1; -+ qmode->rl.qhealth[1].limit_commands = 0; -+ qmode->rl.qhealth[2].limit_commands = 0; -+ qmode->rl.qhealth[3].limit_commands = 0; -+ break; -+ default: -+ break; -+ } -+ -+ if (!info->node_info->qport) { -+ MSM_BUS_DBG("No QoS Ports to init\n"); -+ return; -+ } -+ -+ for (i = 0; i < info->node_info->num_mports; i++) { -+ /* If not in bypass mode, update priority */ -+ if (mode != BIMC_QOS_MODE_BYPASS) { -+ msm_bus_bimc_set_qos_prio(binfo->base, -+ info->node_info-> -+ qport[i], mode, qmode); -+ -+ /* If not in fixed mode, update bandwidth */ -+ if (mode != BIMC_QOS_MODE_FIXED) { -+ struct msm_bus_bimc_qos_bw qbw; -+ qbw.ws = info->node_info->ws; -+ qbw.bw = info->node_info->bimc_bw[0]; -+ qbw.gp = info->node_info->bimc_gp; -+ qbw.thmp = info->node_info->bimc_thmp; -+ bimc_set_static_qos_bw(binfo->base, -+ binfo->qos_freq, -+ info->node_info->qport[i], &qbw); -+ } -+ } -+ -+ /* set mode */ -+ msm_bus_bimc_set_qos_mode(binfo->base, -+ info->node_info->qport[i], -+ mode); -+ } -+} -+ -+static void init_health_regs(struct msm_bus_bimc_info *binfo, -+ struct msm_bus_inode_info *info, -+ struct msm_bus_bimc_qos_mode *qmode, -+ int mode) -+{ -+ int i; -+ -+ if (mode == BIMC_QOS_MODE_LIMITER) { -+ qmode->rl.qhealth[0].limit_commands = 1; -+ qmode->rl.qhealth[1].limit_commands = 0; -+ qmode->rl.qhealth[2].limit_commands = 0; -+ qmode->rl.qhealth[3].limit_commands = 0; -+ -+ if (!info->node_info->qport) { -+ MSM_BUS_DBG("No QoS Ports to init\n"); -+ return; -+ } -+ -+ for (i = 0; i < info->node_info->num_mports; i++) { -+ /* If not in bypass mode, update priority */ -+ if (mode != BIMC_QOS_MODE_BYPASS) -+ msm_bus_bimc_set_qos_prio(binfo->base, -+ info->node_info->qport[i], mode, qmode); -+ } -+ } -+} -+ -+ -+static int msm_bus_bimc_mas_init(struct msm_bus_bimc_info *binfo, -+ struct msm_bus_inode_info *info) -+{ -+ struct msm_bus_bimc_qos_mode *qmode; -+ qmode = kzalloc(sizeof(struct msm_bus_bimc_qos_mode), -+ GFP_KERNEL); -+ if (!qmode) { -+ MSM_BUS_WARN("Couldn't alloc prio data for node: %d\n", -+ info->node_info->id); -+ return -ENOMEM; -+ } -+ -+ info->hw_data = (void *)qmode; -+ -+ /** -+ * If the master supports dual configuration, -+ * configure registers for both modes -+ */ -+ if (info->node_info->dual_conf) -+ bimc_init_mas_reg(binfo, info, qmode, -+ info->node_info->mode_thresh); -+ else if (info->node_info->nr_lim) -+ init_health_regs(binfo, info, qmode, BIMC_QOS_MODE_LIMITER); -+ -+ bimc_init_mas_reg(binfo, info, qmode, info->node_info->mode); -+ return 0; -+} -+ -+static void msm_bus_bimc_node_init(void *hw_data, -+ struct msm_bus_inode_info *info) -+{ -+ struct msm_bus_bimc_info *binfo = -+ (struct msm_bus_bimc_info *)hw_data; -+ -+ if (!IS_SLAVE(info->node_info->priv_id) && -+ (info->node_info->hw_sel != MSM_BUS_RPM)) -+ msm_bus_bimc_mas_init(binfo, info); -+} -+ -+static int msm_bus_bimc_port_halt(uint32_t haltid, uint8_t mport) -+{ -+ return 0; -+} -+ -+static int msm_bus_bimc_port_unhalt(uint32_t haltid, uint8_t mport) -+{ -+ return 0; -+} -+ -+static int msm_bus_bimc_limit_mport(struct msm_bus_node_device_type *info, -+ void __iomem *qos_base, uint32_t qos_off, -+ uint32_t qos_delta, uint32_t qos_freq, -+ bool enable_lim, u64 lim_bw) -+{ -+ int mode; -+ int i; -+ -+ if (ZERO_OR_NULL_PTR(info->node_info->qport)) { -+ MSM_BUS_DBG("No QoS Ports to limit\n"); -+ return 0; -+ } -+ -+ if (enable_lim && lim_bw) { -+ mode = BIMC_QOS_MODE_LIMITER; -+ -+ if (!info->node_info->lim_bw) { -+ struct msm_bus_bimc_qos_mode qmode; -+ qmode.rl.qhealth[0].limit_commands = 1; -+ qmode.rl.qhealth[1].limit_commands = 0; -+ qmode.rl.qhealth[2].limit_commands = 0; -+ qmode.rl.qhealth[3].limit_commands = 0; -+ -+ for (i = 0; i < info->node_info->num_qports; i++) { -+ /* If not in bypass mode, update priority */ -+ if (mode != BIMC_QOS_MODE_BYPASS) -+ msm_bus_bimc_set_qos_prio(qos_base, -+ info->node_info->qport[i], mode, -+ &qmode); -+ } -+ } -+ -+ for (i = 0; i < info->node_info->num_qports; i++) { -+ struct msm_bus_bimc_qos_bw qbw; -+ /* If not in fixed mode, update bandwidth */ -+ if ((info->node_info->lim_bw != lim_bw)) { -+ qbw.ws = info->node_info->qos_params.ws; -+ qbw.bw = lim_bw; -+ qbw.gp = info->node_info->qos_params.gp; -+ qbw.thmp = info->node_info->qos_params.thmp; -+ bimc_set_static_qos_bw(qos_base, qos_freq, -+ info->node_info->qport[i], &qbw); -+ } -+ bke_switch(qos_base, info->node_info->qport[i], -+ BKE_ON, mode); -+ } -+ info->node_info->lim_bw = lim_bw; -+ } else { -+ mode = info->node_info->qos_params.mode; -+ for (i = 0; i < info->node_info->num_qports; i++) { -+ bke_switch(qos_base, info->node_info->qport[i], -+ BKE_OFF, mode); -+ } -+ } -+ info->node_info->qos_params.cur_mode = mode; -+ return 0; -+} -+ -+static bool msm_bus_bimc_update_bw_reg(int mode) -+{ -+ bool ret = false; -+ -+ if ((mode == BIMC_QOS_MODE_LIMITER) -+ || (mode == BIMC_QOS_MODE_REGULATOR)) -+ ret = true; -+ -+ return ret; -+} -+ -+static int msm_bus_bimc_qos_init(struct msm_bus_node_device_type *info, -+ void __iomem *qos_base, -+ uint32_t qos_off, uint32_t qos_delta, -+ uint32_t qos_freq) -+{ -+ int i; -+ struct msm_bus_bimc_qos_mode qmode; -+ -+ switch (info->node_info->qos_params.mode) { -+ case BIMC_QOS_MODE_FIXED: -+ qmode.fixed.prio_level = info->node_info->qos_params.prio_lvl; -+ qmode.fixed.areq_prio_rd = info->node_info->qos_params.prio_rd; -+ qmode.fixed.areq_prio_wr = info->node_info->qos_params.prio_wr; -+ break; -+ case BIMC_QOS_MODE_LIMITER: -+ qmode.rl.qhealth[0].limit_commands = 1; -+ qmode.rl.qhealth[1].limit_commands = 0; -+ qmode.rl.qhealth[2].limit_commands = 0; -+ qmode.rl.qhealth[3].limit_commands = 0; -+ break; -+ default: -+ break; -+ } -+ -+ if (ZERO_OR_NULL_PTR(info->node_info->qport)) { -+ MSM_BUS_DBG("No QoS Ports to init\n"); -+ return 0; -+ } -+ -+ for (i = 0; i < info->node_info->num_qports; i++) { -+ /* If not in bypass mode, update priority */ -+ if (info->node_info->qos_params.mode != BIMC_QOS_MODE_BYPASS) -+ msm_bus_bimc_set_qos_prio(qos_base, info->node_info-> -+ qport[i], info->node_info->qos_params.mode, -+ &qmode); -+ -+ /* set mode */ -+ if (info->node_info->qos_params.mode == BIMC_QOS_MODE_LIMITER) -+ bke_switch(qos_base, info->node_info->qport[i], -+ BKE_OFF, BIMC_QOS_MODE_FIXED); -+ else -+ msm_bus_bimc_set_qos_mode(qos_base, -+ info->node_info->qport[i], -+ info->node_info->qos_params.mode); -+ } -+ -+ return 0; -+} -+ -+static int msm_bus_bimc_set_bw(struct msm_bus_node_device_type *dev, -+ void __iomem *qos_base, uint32_t qos_off, -+ uint32_t qos_delta, uint32_t qos_freq) -+{ -+ struct msm_bus_bimc_qos_bw qbw; -+ int i; -+ int64_t bw = 0; -+ int ret = 0; -+ struct msm_bus_node_info_type *info = dev->node_info; -+ -+ if (info && info->num_qports && -+ ((info->qos_params.mode == BIMC_QOS_MODE_LIMITER) || -+ (info->qos_params.mode == BIMC_QOS_MODE_REGULATOR))) { -+ bw = msm_bus_div64(info->num_qports, -+ dev->node_ab.ab[DUAL_CTX]); -+ -+ for (i = 0; i < info->num_qports; i++) { -+ MSM_BUS_DBG("BIMC: Update mas_bw for ID: %d -> %llu\n", -+ info->id, bw); -+ -+ if (!info->qport) { -+ MSM_BUS_DBG("No qos ports to update!\n"); -+ break; -+ } -+ -+ qbw.bw = bw + info->qos_params.bw_buffer; -+ trace_bus_bimc_config_limiter(info->id, bw); -+ -+ /* Default to gp of 5us */ -+ qbw.gp = (info->qos_params.gp ? -+ info->qos_params.gp : 5000); -+ /* Default to thmp of 50% */ -+ qbw.thmp = (info->qos_params.thmp ? -+ info->qos_params.thmp : 50); -+ /* -+ * If the BW vote is 0 then set the QoS mode to -+ * Fixed. -+ */ -+ if (bw) { -+ bimc_set_static_qos_bw(qos_base, qos_freq, -+ info->qport[i], &qbw); -+ bke_switch(qos_base, info->qport[i], -+ BKE_ON, info->qos_params.mode); -+ } else { -+ bke_switch(qos_base, info->qport[i], -+ BKE_OFF, BIMC_QOS_MODE_FIXED); -+ } -+ } -+ } -+ return ret; -+} -+ -+int msm_bus_bimc_hw_init(struct msm_bus_fabric_registration *pdata, -+ struct msm_bus_hw_algorithm *hw_algo) -+{ -+ /* Set interleaving to true by default */ -+ MSM_BUS_DBG("\nInitializing BIMC...\n"); -+ pdata->il_flag = true; -+ hw_algo->allocate_commit_data = msm_bus_bimc_allocate_commit_data; -+ hw_algo->allocate_hw_data = msm_bus_bimc_allocate_bimc_data; -+ hw_algo->node_init = msm_bus_bimc_node_init; -+ hw_algo->free_commit_data = free_commit_data; -+ hw_algo->update_bw = msm_bus_bimc_update_bw; -+ hw_algo->commit = msm_bus_bimc_commit; -+ hw_algo->port_halt = msm_bus_bimc_port_halt; -+ hw_algo->port_unhalt = msm_bus_bimc_port_unhalt; -+ hw_algo->config_master = msm_bus_bimc_config_master; -+ hw_algo->config_limiter = msm_bus_bimc_config_limiter; -+ hw_algo->update_bw_reg = msm_bus_bimc_update_bw_reg; -+ /* BIMC slaves are shared. Slave registers are set through RPM */ -+ if (!pdata->ahb) -+ pdata->rpm_enabled = 1; -+ return 0; -+} -+ -+int msm_bus_bimc_set_ops(struct msm_bus_node_device_type *bus_dev) -+{ -+ if (!bus_dev) -+ return -ENODEV; -+ else { -+ bus_dev->fabdev->noc_ops.qos_init = msm_bus_bimc_qos_init; -+ bus_dev->fabdev->noc_ops.set_bw = msm_bus_bimc_set_bw; -+ bus_dev->fabdev->noc_ops.limit_mport = msm_bus_bimc_limit_mport; -+ bus_dev->fabdev->noc_ops.update_bw_reg = -+ msm_bus_bimc_update_bw_reg; -+ } -+ return 0; -+} -+EXPORT_SYMBOL(msm_bus_bimc_set_ops); ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_bimc.h -@@ -0,0 +1,127 @@ -+/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef _ARCH_ARM_MACH_MSM_BUS_BIMC_H -+#define _ARCH_ARM_MACH_MSM_BUS_BIMC_H -+ -+struct msm_bus_bimc_params { -+ uint32_t bus_id; -+ uint32_t addr_width; -+ uint32_t data_width; -+ uint32_t nmasters; -+ uint32_t nslaves; -+}; -+ -+struct msm_bus_bimc_commit { -+ struct msm_bus_node_hw_info *mas; -+ struct msm_bus_node_hw_info *slv; -+}; -+ -+struct msm_bus_bimc_info { -+ void __iomem *base; -+ uint32_t base_addr; -+ uint32_t qos_freq; -+ struct msm_bus_bimc_params params; -+ struct msm_bus_bimc_commit cdata[NUM_CTX]; -+}; -+ -+struct msm_bus_bimc_node { -+ uint32_t conn_mask; -+ uint32_t data_width; -+ uint8_t slv_arb_mode; -+}; -+ -+enum msm_bus_bimc_arb_mode { -+ BIMC_ARB_MODE_RR = 0, -+ BIMC_ARB_MODE_PRIORITY_RR, -+ BIMC_ARB_MODE_TIERED_RR, -+}; -+ -+ -+enum msm_bus_bimc_interleave { -+ BIMC_INTERLEAVE_NONE = 0, -+ BIMC_INTERLEAVE_ODD, -+ BIMC_INTERLEAVE_EVEN, -+}; -+ -+struct msm_bus_bimc_slave_seg { -+ bool enable; -+ uint64_t start_addr; -+ uint64_t seg_size; -+ uint8_t interleave; -+}; -+ -+enum msm_bus_bimc_qos_mode_type { -+ BIMC_QOS_MODE_FIXED = 0, -+ BIMC_QOS_MODE_LIMITER, -+ BIMC_QOS_MODE_BYPASS, -+ BIMC_QOS_MODE_REGULATOR, -+}; -+ -+struct msm_bus_bimc_qos_health { -+ bool limit_commands; -+ uint32_t areq_prio; -+ uint32_t prio_level; -+}; -+ -+struct msm_bus_bimc_mode_fixed { -+ uint32_t prio_level; -+ uint32_t areq_prio_rd; -+ uint32_t areq_prio_wr; -+}; -+ -+struct msm_bus_bimc_mode_rl { -+ uint8_t qhealthnum; -+ struct msm_bus_bimc_qos_health qhealth[4]; -+}; -+ -+struct msm_bus_bimc_qos_mode { -+ uint8_t mode; -+ struct msm_bus_bimc_mode_fixed fixed; -+ struct msm_bus_bimc_mode_rl rl; -+}; -+ -+struct msm_bus_bimc_qos_bw { -+ uint64_t bw; /* bw is in Bytes/sec */ -+ uint32_t ws; /* Window size in nano seconds*/ -+ int64_t thh; /* Threshold high, bytes per second */ -+ int64_t thm; /* Threshold medium, bytes per second */ -+ int64_t thl; /* Threshold low, bytes per second */ -+ u32 gp; /* Grant Period in micro seconds */ -+ u32 thmp; /* Threshold medium in percentage */ -+}; -+ -+struct msm_bus_bimc_clk_gate { -+ bool core_clk_gate_en; -+ bool arb_clk_gate_en; /* For arbiter */ -+ bool port_clk_gate_en; /* For regs on BIMC core clock */ -+}; -+ -+void msm_bus_bimc_set_slave_seg(struct msm_bus_bimc_info *binfo, -+ uint32_t slv_index, uint32_t seg_index, -+ struct msm_bus_bimc_slave_seg *bsseg); -+void msm_bus_bimc_set_slave_clk_gate(struct msm_bus_bimc_info *binfo, -+ uint32_t slv_index, struct msm_bus_bimc_clk_gate *bgate); -+void msm_bus_bimc_set_mas_clk_gate(struct msm_bus_bimc_info *binfo, -+ uint32_t mas_index, struct msm_bus_bimc_clk_gate *bgate); -+void msm_bus_bimc_arb_en(struct msm_bus_bimc_info *binfo, -+ uint32_t slv_index, bool en); -+void msm_bus_bimc_get_params(struct msm_bus_bimc_info *binfo, -+ struct msm_bus_bimc_params *params); -+void msm_bus_bimc_get_mas_params(struct msm_bus_bimc_info *binfo, -+ uint32_t mas_index, struct msm_bus_bimc_node *mparams); -+void msm_bus_bimc_get_slv_params(struct msm_bus_bimc_info *binfo, -+ uint32_t slv_index, struct msm_bus_bimc_node *sparams); -+bool msm_bus_bimc_get_arb_en(struct msm_bus_bimc_info *binfo, -+ uint32_t slv_index); -+ -+#endif /*_ARCH_ARM_MACH_MSM_BUS_BIMC_H*/ ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_client_api.c -@@ -0,0 +1,83 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#define pr_fmt(fmt) "AXI: %s(): " fmt, __func__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "msm-bus.h" -+#include "msm_bus_core.h" -+ -+struct msm_bus_arb_ops arb_ops; -+ -+/** -+ * msm_bus_scale_register_client() - Register the clients with the msm bus -+ * driver -+ * @pdata: Platform data of the client, containing src, dest, ab, ib. -+ * Return non-zero value in case of success, 0 in case of failure. -+ * -+ * Client data contains the vectors specifying arbitrated bandwidth (ab) -+ * and instantaneous bandwidth (ib) requested between a particular -+ * src and dest. -+ */ -+uint32_t msm_bus_scale_register_client(struct msm_bus_scale_pdata *pdata) -+{ -+ if (arb_ops.register_client) -+ return arb_ops.register_client(pdata); -+ else { -+ pr_err("%s: Bus driver not ready.", -+ __func__); -+ return 0; -+ } -+} -+EXPORT_SYMBOL(msm_bus_scale_register_client); -+ -+/** -+ * msm_bus_scale_client_update_request() - Update the request for bandwidth -+ * from a particular client -+ * -+ * cl: Handle to the client -+ * index: Index into the vector, to which the bw and clock values need to be -+ * updated -+ */ -+int msm_bus_scale_client_update_request(uint32_t cl, unsigned int index) -+{ -+ if (arb_ops.update_request) -+ return arb_ops.update_request(cl, index); -+ else { -+ pr_err("%s: Bus driver not ready.", -+ __func__); -+ return -EPROBE_DEFER; -+ } -+} -+EXPORT_SYMBOL(msm_bus_scale_client_update_request); -+ -+/** -+ * msm_bus_scale_unregister_client() - Unregister the client from the bus driver -+ * @cl: Handle to the client -+ */ -+void msm_bus_scale_unregister_client(uint32_t cl) -+{ -+ if (arb_ops.unregister_client) -+ arb_ops.unregister_client(cl); -+ else { -+ pr_err("%s: Bus driver not ready.", -+ __func__); -+ } -+} -+EXPORT_SYMBOL(msm_bus_scale_unregister_client); ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_core.c -@@ -0,0 +1,125 @@ -+/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#define pr_fmt(fmt) "AXI: %s(): " fmt, __func__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "msm-bus-board.h" -+#include "msm-bus.h" -+#include "msm_bus_core.h" -+ -+static atomic_t num_fab = ATOMIC_INIT(0); -+ -+int msm_bus_get_num_fab(void) -+{ -+ return atomic_read(&num_fab); -+} -+ -+int msm_bus_device_match(struct device *dev, void *id) -+{ -+ struct msm_bus_fabric_device *fabdev = to_msm_bus_fabric_device(dev); -+ -+ if (!fabdev) { -+ MSM_BUS_WARN("Fabric %p returning 0\n", fabdev); -+ return 0; -+ } -+ return fabdev->id == *(int *)id; -+} -+ -+static void msm_bus_release(struct device *device) -+{ -+} -+ -+struct bus_type msm_bus_type = { -+ .name = "msm-bus-type", -+}; -+EXPORT_SYMBOL(msm_bus_type); -+ -+/** -+ * msm_bus_get_fabric_device() - This function is used to search for -+ * the fabric device on the bus -+ * @fabid: Fabric id -+ * Function returns: Pointer to the fabric device -+ */ -+struct msm_bus_fabric_device *msm_bus_get_fabric_device(int fabid) -+{ -+ struct device *dev; -+ struct msm_bus_fabric_device *fabric; -+ dev = bus_find_device(&msm_bus_type, NULL, (void *)&fabid, -+ msm_bus_device_match); -+ if (!dev) -+ return NULL; -+ fabric = to_msm_bus_fabric_device(dev); -+ return fabric; -+} -+ -+/** -+ * msm_bus_fabric_device_register() - Registers a fabric on msm bus -+ * @fabdev: Fabric device to be registered -+ */ -+int msm_bus_fabric_device_register(struct msm_bus_fabric_device *fabdev) -+{ -+ int ret = 0; -+ fabdev->dev.bus = &msm_bus_type; -+ fabdev->dev.release = msm_bus_release; -+ ret = dev_set_name(&fabdev->dev, fabdev->name); -+ if (ret) { -+ MSM_BUS_ERR("error setting dev name\n"); -+ goto err; -+ } -+ -+ ret = device_register(&fabdev->dev); -+ if (ret < 0) { -+ MSM_BUS_ERR("error registering device%d %s\n", -+ ret, fabdev->name); -+ goto err; -+ } -+ atomic_inc(&num_fab); -+err: -+ return ret; -+} -+ -+/** -+ * msm_bus_fabric_device_unregister() - Unregisters the fabric -+ * devices from the msm bus -+ */ -+void msm_bus_fabric_device_unregister(struct msm_bus_fabric_device *fabdev) -+{ -+ device_unregister(&fabdev->dev); -+ atomic_dec(&num_fab); -+} -+ -+static void __exit msm_bus_exit(void) -+{ -+ bus_unregister(&msm_bus_type); -+} -+ -+static int __init msm_bus_init(void) -+{ -+ int retval = 0; -+ retval = bus_register(&msm_bus_type); -+ if (retval) -+ MSM_BUS_ERR("bus_register error! %d\n", -+ retval); -+ return retval; -+} -+postcore_initcall(msm_bus_init); -+module_exit(msm_bus_exit); -+MODULE_LICENSE("GPL v2"); -+MODULE_VERSION("0.2"); -+MODULE_ALIAS("platform:msm_bus"); ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_core.h -@@ -0,0 +1,375 @@ -+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef _ARCH_ARM_MACH_MSM_BUS_CORE_H -+#define _ARCH_ARM_MACH_MSM_BUS_CORE_H -+ -+#include -+#include -+#include -+#include -+#include "msm-bus-board.h" -+#include "msm-bus.h" -+ -+#define MSM_BUS_DBG(msg, ...) \ -+ pr_debug(msg, ## __VA_ARGS__) -+#define MSM_BUS_ERR(msg, ...) \ -+ pr_err(msg, ## __VA_ARGS__) -+#define MSM_BUS_WARN(msg, ...) \ -+ pr_warn(msg, ## __VA_ARGS__) -+#define MSM_FAB_ERR(msg, ...) \ -+ dev_err(&fabric->fabdev.dev, msg, ## __VA_ARGS__) -+ -+#define IS_MASTER_VALID(mas) \ -+ (((mas >= MSM_BUS_MASTER_FIRST) && (mas <= MSM_BUS_MASTER_LAST)) \ -+ ? 1 : 0) -+#define IS_SLAVE_VALID(slv) \ -+ (((slv >= MSM_BUS_SLAVE_FIRST) && (slv <= MSM_BUS_SLAVE_LAST)) ? 1 : 0) -+ -+#define INTERLEAVED_BW(fab_pdata, bw, ports) \ -+ ((fab_pdata->il_flag) ? ((bw < 0) \ -+ ? -msm_bus_div64((ports), (-bw)) : msm_bus_div64((ports), (bw))) : (bw)) -+#define INTERLEAVED_VAL(fab_pdata, n) \ -+ ((fab_pdata->il_flag) ? (n) : 1) -+#define KBTOB(a) (a * 1000ULL) -+ -+enum msm_bus_dbg_op_type { -+ MSM_BUS_DBG_UNREGISTER = -2, -+ MSM_BUS_DBG_REGISTER, -+ MSM_BUS_DBG_OP = 1, -+}; -+ -+enum msm_bus_hw_sel { -+ MSM_BUS_RPM = 0, -+ MSM_BUS_NOC, -+ MSM_BUS_BIMC, -+}; -+ -+struct msm_bus_arb_ops { -+ uint32_t (*register_client)(struct msm_bus_scale_pdata *pdata); -+ int (*update_request)(uint32_t cl, unsigned int index); -+ void (*unregister_client)(uint32_t cl); -+}; -+ -+enum { -+ SLAVE_NODE, -+ MASTER_NODE, -+ CLK_NODE, -+ NR_LIM_NODE, -+}; -+ -+ -+extern struct bus_type msm_bus_type; -+extern struct msm_bus_arb_ops arb_ops; -+extern void msm_bus_arb_setops_legacy(struct msm_bus_arb_ops *arb_ops); -+ -+struct msm_bus_node_info { -+ unsigned int id; -+ unsigned int priv_id; -+ unsigned int mas_hw_id; -+ unsigned int slv_hw_id; -+ int gateway; -+ int *masterp; -+ int *qport; -+ int num_mports; -+ int *slavep; -+ int num_sports; -+ int *tier; -+ int num_tiers; -+ int ahb; -+ int hw_sel; -+ const char *slaveclk[NUM_CTX]; -+ const char *memclk[NUM_CTX]; -+ const char *iface_clk_node; -+ unsigned int buswidth; -+ unsigned int ws; -+ unsigned int mode; -+ unsigned int perm_mode; -+ unsigned int prio_lvl; -+ unsigned int prio_rd; -+ unsigned int prio_wr; -+ unsigned int prio1; -+ unsigned int prio0; -+ unsigned int num_thresh; -+ u64 *th; -+ u64 cur_lim_bw; -+ unsigned int mode_thresh; -+ bool dual_conf; -+ u64 *bimc_bw; -+ bool nr_lim; -+ u32 ff; -+ bool rt_mas; -+ u32 bimc_gp; -+ u32 bimc_thmp; -+ u64 floor_bw; -+ const char *name; -+}; -+ -+struct path_node { -+ uint64_t clk[NUM_CTX]; -+ uint64_t bw[NUM_CTX]; -+ uint64_t *sel_clk; -+ uint64_t *sel_bw; -+ int next; -+}; -+ -+struct msm_bus_link_info { -+ uint64_t clk[NUM_CTX]; -+ uint64_t *sel_clk; -+ uint64_t memclk; -+ int64_t bw[NUM_CTX]; -+ int64_t *sel_bw; -+ int *tier; -+ int num_tiers; -+}; -+ -+struct nodeclk { -+ struct clk *clk; -+ uint64_t rate; -+ bool dirty; -+ bool enable; -+}; -+ -+struct msm_bus_inode_info { -+ struct msm_bus_node_info *node_info; -+ uint64_t max_bw; -+ uint64_t max_clk; -+ uint64_t cur_lim_bw; -+ uint64_t cur_prg_bw; -+ struct msm_bus_link_info link_info; -+ int num_pnodes; -+ struct path_node *pnode; -+ int commit_index; -+ struct nodeclk nodeclk[NUM_CTX]; -+ struct nodeclk memclk[NUM_CTX]; -+ struct nodeclk iface_clk; -+ void *hw_data; -+}; -+ -+struct msm_bus_node_hw_info { -+ bool dirty; -+ unsigned int hw_id; -+ uint64_t bw; -+}; -+ -+struct msm_bus_hw_algorithm { -+ int (*allocate_commit_data)(struct msm_bus_fabric_registration -+ *fab_pdata, void **cdata, int ctx); -+ void *(*allocate_hw_data)(struct platform_device *pdev, -+ struct msm_bus_fabric_registration *fab_pdata); -+ void (*node_init)(void *hw_data, struct msm_bus_inode_info *info); -+ void (*free_commit_data)(void *cdata); -+ void (*update_bw)(struct msm_bus_inode_info *hop, -+ struct msm_bus_inode_info *info, -+ struct msm_bus_fabric_registration *fab_pdata, -+ void *sel_cdata, int *master_tiers, -+ int64_t add_bw); -+ void (*fill_cdata_buffer)(int *curr, char *buf, const int max_size, -+ void *cdata, int nmasters, int nslaves, int ntslaves); -+ int (*commit)(struct msm_bus_fabric_registration -+ *fab_pdata, void *hw_data, void **cdata); -+ int (*port_unhalt)(uint32_t haltid, uint8_t mport); -+ int (*port_halt)(uint32_t haltid, uint8_t mport); -+ void (*config_master)(struct msm_bus_fabric_registration *fab_pdata, -+ struct msm_bus_inode_info *info, -+ uint64_t req_clk, uint64_t req_bw); -+ void (*config_limiter)(struct msm_bus_fabric_registration *fab_pdata, -+ struct msm_bus_inode_info *info); -+ bool (*update_bw_reg)(int mode); -+}; -+ -+struct msm_bus_fabric_device { -+ int id; -+ const char *name; -+ struct device dev; -+ const struct msm_bus_fab_algorithm *algo; -+ const struct msm_bus_board_algorithm *board_algo; -+ struct msm_bus_hw_algorithm hw_algo; -+ int visited; -+ int num_nr_lim; -+ u64 nr_lim_thresh; -+ u32 eff_fact; -+}; -+#define to_msm_bus_fabric_device(d) container_of(d, \ -+ struct msm_bus_fabric_device, d) -+ -+struct msm_bus_fabric { -+ struct msm_bus_fabric_device fabdev; -+ int ahb; -+ void *cdata[NUM_CTX]; -+ bool arb_dirty; -+ bool clk_dirty; -+ struct radix_tree_root fab_tree; -+ int num_nodes; -+ struct list_head gateways; -+ struct msm_bus_inode_info info; -+ struct msm_bus_fabric_registration *pdata; -+ void *hw_data; -+}; -+#define to_msm_bus_fabric(d) container_of(d, \ -+ struct msm_bus_fabric, d) -+ -+ -+struct msm_bus_fab_algorithm { -+ int (*update_clks)(struct msm_bus_fabric_device *fabdev, -+ struct msm_bus_inode_info *pme, int index, -+ uint64_t curr_clk, uint64_t req_clk, -+ uint64_t bwsum, int flag, int ctx, -+ unsigned int cl_active_flag); -+ int (*port_halt)(struct msm_bus_fabric_device *fabdev, int portid); -+ int (*port_unhalt)(struct msm_bus_fabric_device *fabdev, int portid); -+ int (*commit)(struct msm_bus_fabric_device *fabdev); -+ struct msm_bus_inode_info *(*find_node)(struct msm_bus_fabric_device -+ *fabdev, int id); -+ struct msm_bus_inode_info *(*find_gw_node)(struct msm_bus_fabric_device -+ *fabdev, int id); -+ struct list_head *(*get_gw_list)(struct msm_bus_fabric_device *fabdev); -+ void (*update_bw)(struct msm_bus_fabric_device *fabdev, struct -+ msm_bus_inode_info * hop, struct msm_bus_inode_info *info, -+ int64_t add_bw, int *master_tiers, int ctx); -+ void (*config_master)(struct msm_bus_fabric_device *fabdev, -+ struct msm_bus_inode_info *info, uint64_t req_clk, -+ uint64_t req_bw); -+ void (*config_limiter)(struct msm_bus_fabric_device *fabdev, -+ struct msm_bus_inode_info *info); -+}; -+ -+struct msm_bus_board_algorithm { -+ int board_nfab; -+ void (*assign_iids)(struct msm_bus_fabric_registration *fabreg, -+ int fabid); -+ int (*get_iid)(int id); -+}; -+ -+/** -+ * Used to store the list of fabrics and other info to be -+ * maintained outside the fabric structure. -+ * Used while calculating path, and to find fabric ptrs -+ */ -+struct msm_bus_fabnodeinfo { -+ struct list_head list; -+ struct msm_bus_inode_info *info; -+}; -+ -+struct msm_bus_client { -+ int id; -+ struct msm_bus_scale_pdata *pdata; -+ int *src_pnode; -+ int curr; -+}; -+ -+uint64_t msm_bus_div64(unsigned int width, uint64_t bw); -+int msm_bus_fabric_device_register(struct msm_bus_fabric_device *fabric); -+void msm_bus_fabric_device_unregister(struct msm_bus_fabric_device *fabric); -+struct msm_bus_fabric_device *msm_bus_get_fabric_device(int fabid); -+int msm_bus_get_num_fab(void); -+ -+ -+int msm_bus_hw_fab_init(struct msm_bus_fabric_registration *pdata, -+ struct msm_bus_hw_algorithm *hw_algo); -+void msm_bus_board_init(struct msm_bus_fabric_registration *pdata); -+void msm_bus_board_set_nfab(struct msm_bus_fabric_registration *pdata, -+ int nfab); -+#if defined(CONFIG_MSM_RPM_SMD) -+int msm_bus_rpm_hw_init(struct msm_bus_fabric_registration *pdata, -+ struct msm_bus_hw_algorithm *hw_algo); -+int msm_bus_remote_hw_commit(struct msm_bus_fabric_registration -+ *fab_pdata, void *hw_data, void **cdata); -+void msm_bus_rpm_fill_cdata_buffer(int *curr, char *buf, const int max_size, -+ void *cdata, int nmasters, int nslaves, int ntslaves); -+#else -+static inline int msm_bus_rpm_hw_init(struct msm_bus_fabric_registration *pdata, -+ struct msm_bus_hw_algorithm *hw_algo) -+{ -+ return 0; -+} -+static inline int msm_bus_remote_hw_commit(struct msm_bus_fabric_registration -+ *fab_pdata, void *hw_data, void **cdata) -+{ -+ return 0; -+} -+static inline void msm_bus_rpm_fill_cdata_buffer(int *curr, char *buf, -+ const int max_size, void *cdata, int nmasters, int nslaves, -+ int ntslaves) -+{ -+} -+#endif -+ -+int msm_bus_noc_hw_init(struct msm_bus_fabric_registration *pdata, -+ struct msm_bus_hw_algorithm *hw_algo); -+int msm_bus_bimc_hw_init(struct msm_bus_fabric_registration *pdata, -+ struct msm_bus_hw_algorithm *hw_algo); -+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_MSM_BUS_SCALING) -+void msm_bus_dbg_client_data(struct msm_bus_scale_pdata *pdata, int index, -+ uint32_t cl); -+void msm_bus_dbg_commit_data(const char *fabname, void *cdata, -+ int nmasters, int nslaves, int ntslaves, int op); -+#else -+static inline void msm_bus_dbg_client_data(struct msm_bus_scale_pdata *pdata, -+ int index, uint32_t cl) -+{ -+} -+static inline void msm_bus_dbg_commit_data(const char *fabname, -+ void *cdata, int nmasters, int nslaves, int ntslaves, -+ int op) -+{ -+} -+#endif -+ -+#ifdef CONFIG_CORESIGHT -+int msmbus_coresight_init(struct platform_device *pdev); -+void msmbus_coresight_remove(struct platform_device *pdev); -+int msmbus_coresight_init_adhoc(struct platform_device *pdev, -+ struct device_node *of_node); -+void msmbus_coresight_remove_adhoc(struct platform_device *pdev); -+#else -+static inline int msmbus_coresight_init(struct platform_device *pdev) -+{ -+ return 0; -+} -+ -+static inline void msmbus_coresight_remove(struct platform_device *pdev) -+{ -+} -+ -+static inline int msmbus_coresight_init_adhoc(struct platform_device *pdev, -+ struct device_node *of_node) -+{ -+ return 0; -+} -+ -+static inline void msmbus_coresight_remove_adhoc(struct platform_device *pdev) -+{ -+} -+#endif -+ -+ -+#ifdef CONFIG_OF -+void msm_bus_of_get_nfab(struct platform_device *pdev, -+ struct msm_bus_fabric_registration *pdata); -+struct msm_bus_fabric_registration -+ *msm_bus_of_get_fab_data(struct platform_device *pdev); -+#else -+static inline void msm_bus_of_get_nfab(struct platform_device *pdev, -+ struct msm_bus_fabric_registration *pdata) -+{ -+ return; -+} -+ -+static inline struct msm_bus_fabric_registration -+ *msm_bus_of_get_fab_data(struct platform_device *pdev) -+{ -+ return NULL; -+} -+#endif -+ -+#endif /*_ARCH_ARM_MACH_MSM_BUS_CORE_H*/ ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_dbg.c -@@ -0,0 +1,810 @@ -+/* Copyright (c) 2010-2012, 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ * -+ */ -+ -+#define pr_fmt(fmt) "AXI: %s(): " fmt, __func__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "msm-bus-board.h" -+#include "msm-bus.h" -+#include "msm_bus_rules.h" -+#include "msm_bus_core.h" -+#include "msm_bus_adhoc.h" -+ -+#define CREATE_TRACE_POINTS -+#include -+ -+#define MAX_BUFF_SIZE 4096 -+#define FILL_LIMIT 128 -+ -+static struct dentry *clients; -+static struct dentry *dir; -+static DEFINE_MUTEX(msm_bus_dbg_fablist_lock); -+struct msm_bus_dbg_state { -+ uint32_t cl; -+ uint8_t enable; -+ uint8_t current_index; -+} clstate; -+ -+struct msm_bus_cldata { -+ const struct msm_bus_scale_pdata *pdata; -+ int index; -+ uint32_t clid; -+ int size; -+ struct dentry *file; -+ struct list_head list; -+ char buffer[MAX_BUFF_SIZE]; -+}; -+ -+struct msm_bus_fab_list { -+ const char *name; -+ int size; -+ struct dentry *file; -+ struct list_head list; -+ char buffer[MAX_BUFF_SIZE]; -+}; -+ -+static char *rules_buf; -+ -+LIST_HEAD(fabdata_list); -+LIST_HEAD(cl_list); -+ -+/** -+ * The following structures and funtions are used for -+ * the test-client which can be created at run-time. -+ */ -+ -+static struct msm_bus_vectors init_vectors[1]; -+static struct msm_bus_vectors current_vectors[1]; -+static struct msm_bus_vectors requested_vectors[1]; -+ -+static struct msm_bus_paths shell_client_usecases[] = { -+ { -+ .num_paths = ARRAY_SIZE(init_vectors), -+ .vectors = init_vectors, -+ }, -+ { -+ .num_paths = ARRAY_SIZE(current_vectors), -+ .vectors = current_vectors, -+ }, -+ { -+ .num_paths = ARRAY_SIZE(requested_vectors), -+ .vectors = requested_vectors, -+ }, -+}; -+ -+static struct msm_bus_scale_pdata shell_client = { -+ .usecase = shell_client_usecases, -+ .num_usecases = ARRAY_SIZE(shell_client_usecases), -+ .name = "test-client", -+}; -+ -+static void msm_bus_dbg_init_vectors(void) -+{ -+ init_vectors[0].src = -1; -+ init_vectors[0].dst = -1; -+ init_vectors[0].ab = 0; -+ init_vectors[0].ib = 0; -+ current_vectors[0].src = -1; -+ current_vectors[0].dst = -1; -+ current_vectors[0].ab = 0; -+ current_vectors[0].ib = 0; -+ requested_vectors[0].src = -1; -+ requested_vectors[0].dst = -1; -+ requested_vectors[0].ab = 0; -+ requested_vectors[0].ib = 0; -+ clstate.enable = 0; -+ clstate.current_index = 0; -+} -+ -+static int msm_bus_dbg_update_cl_request(uint32_t cl) -+{ -+ int ret = 0; -+ -+ if (clstate.current_index < 2) -+ clstate.current_index = 2; -+ else { -+ clstate.current_index = 1; -+ current_vectors[0].ab = requested_vectors[0].ab; -+ current_vectors[0].ib = requested_vectors[0].ib; -+ } -+ -+ if (clstate.enable) { -+ MSM_BUS_DBG("Updating request for shell client, index: %d\n", -+ clstate.current_index); -+ ret = msm_bus_scale_client_update_request(clstate.cl, -+ clstate.current_index); -+ } else -+ MSM_BUS_DBG("Enable bit not set. Skipping update request\n"); -+ -+ return ret; -+} -+ -+static void msm_bus_dbg_unregister_client(uint32_t cl) -+{ -+ MSM_BUS_DBG("Unregistering shell client\n"); -+ msm_bus_scale_unregister_client(clstate.cl); -+ clstate.cl = 0; -+} -+ -+static uint32_t msm_bus_dbg_register_client(void) -+{ -+ int ret = 0; -+ -+ if (init_vectors[0].src != requested_vectors[0].src) { -+ MSM_BUS_DBG("Shell client master changed. Unregistering\n"); -+ msm_bus_dbg_unregister_client(clstate.cl); -+ } -+ if (init_vectors[0].dst != requested_vectors[0].dst) { -+ MSM_BUS_DBG("Shell client slave changed. Unregistering\n"); -+ msm_bus_dbg_unregister_client(clstate.cl); -+ } -+ -+ current_vectors[0].src = init_vectors[0].src; -+ requested_vectors[0].src = init_vectors[0].src; -+ current_vectors[0].dst = init_vectors[0].dst; -+ requested_vectors[0].dst = init_vectors[0].dst; -+ -+ if (!clstate.enable) { -+ MSM_BUS_DBG("Enable bit not set, skipping registration: cl " -+ "%d\n", clstate.cl); -+ return 0; -+ } -+ -+ if (clstate.cl) { -+ MSM_BUS_DBG("Client registered, skipping registration\n"); -+ return clstate.cl; -+ } -+ -+ MSM_BUS_DBG("Registering shell client\n"); -+ ret = msm_bus_scale_register_client(&shell_client); -+ return ret; -+} -+ -+static int msm_bus_dbg_mas_get(void *data, u64 *val) -+{ -+ *val = init_vectors[0].src; -+ MSM_BUS_DBG("Get master: %llu\n", *val); -+ return 0; -+} -+ -+static int msm_bus_dbg_mas_set(void *data, u64 val) -+{ -+ init_vectors[0].src = val; -+ MSM_BUS_DBG("Set master: %llu\n", val); -+ clstate.cl = msm_bus_dbg_register_client(); -+ return 0; -+} -+DEFINE_SIMPLE_ATTRIBUTE(shell_client_mas_fops, msm_bus_dbg_mas_get, -+ msm_bus_dbg_mas_set, "%llu\n"); -+ -+static int msm_bus_dbg_slv_get(void *data, u64 *val) -+{ -+ *val = init_vectors[0].dst; -+ MSM_BUS_DBG("Get slave: %llu\n", *val); -+ return 0; -+} -+ -+static int msm_bus_dbg_slv_set(void *data, u64 val) -+{ -+ init_vectors[0].dst = val; -+ MSM_BUS_DBG("Set slave: %llu\n", val); -+ clstate.cl = msm_bus_dbg_register_client(); -+ return 0; -+} -+DEFINE_SIMPLE_ATTRIBUTE(shell_client_slv_fops, msm_bus_dbg_slv_get, -+ msm_bus_dbg_slv_set, "%llu\n"); -+ -+static int msm_bus_dbg_ab_get(void *data, u64 *val) -+{ -+ *val = requested_vectors[0].ab; -+ MSM_BUS_DBG("Get ab: %llu\n", *val); -+ return 0; -+} -+ -+static int msm_bus_dbg_ab_set(void *data, u64 val) -+{ -+ requested_vectors[0].ab = val; -+ MSM_BUS_DBG("Set ab: %llu\n", val); -+ return 0; -+} -+DEFINE_SIMPLE_ATTRIBUTE(shell_client_ab_fops, msm_bus_dbg_ab_get, -+ msm_bus_dbg_ab_set, "%llu\n"); -+ -+static int msm_bus_dbg_ib_get(void *data, u64 *val) -+{ -+ *val = requested_vectors[0].ib; -+ MSM_BUS_DBG("Get ib: %llu\n", *val); -+ return 0; -+} -+ -+static int msm_bus_dbg_ib_set(void *data, u64 val) -+{ -+ requested_vectors[0].ib = val; -+ MSM_BUS_DBG("Set ib: %llu\n", val); -+ return 0; -+} -+DEFINE_SIMPLE_ATTRIBUTE(shell_client_ib_fops, msm_bus_dbg_ib_get, -+ msm_bus_dbg_ib_set, "%llu\n"); -+ -+static int msm_bus_dbg_en_get(void *data, u64 *val) -+{ -+ *val = clstate.enable; -+ MSM_BUS_DBG("Get enable: %llu\n", *val); -+ return 0; -+} -+ -+static int msm_bus_dbg_en_set(void *data, u64 val) -+{ -+ int ret = 0; -+ -+ clstate.enable = val; -+ if (clstate.enable) { -+ if (!clstate.cl) { -+ MSM_BUS_DBG("client: %u\n", clstate.cl); -+ clstate.cl = msm_bus_dbg_register_client(); -+ if (clstate.cl) -+ ret = msm_bus_dbg_update_cl_request(clstate.cl); -+ } else { -+ MSM_BUS_DBG("update request for cl: %u\n", clstate.cl); -+ ret = msm_bus_dbg_update_cl_request(clstate.cl); -+ } -+ } -+ -+ MSM_BUS_DBG("Set enable: %llu\n", val); -+ return ret; -+} -+DEFINE_SIMPLE_ATTRIBUTE(shell_client_en_fops, msm_bus_dbg_en_get, -+ msm_bus_dbg_en_set, "%llu\n"); -+ -+/** -+ * The following funtions are used for viewing the client data -+ * and changing the client request at run-time -+ */ -+ -+static ssize_t client_data_read(struct file *file, char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ int bsize = 0; -+ uint32_t cl = (uint32_t)(uintptr_t)file->private_data; -+ struct msm_bus_cldata *cldata = NULL; -+ int found = 0; -+ -+ list_for_each_entry(cldata, &cl_list, list) { -+ if (cldata->clid == cl) { -+ found = 1; -+ break; -+ } -+ } -+ if (!found) -+ return 0; -+ -+ bsize = cldata->size; -+ return simple_read_from_buffer(buf, count, ppos, -+ cldata->buffer, bsize); -+} -+ -+static int client_data_open(struct inode *inode, struct file *file) -+{ -+ file->private_data = inode->i_private; -+ return 0; -+} -+ -+static const struct file_operations client_data_fops = { -+ .open = client_data_open, -+ .read = client_data_read, -+}; -+ -+struct dentry *msm_bus_dbg_create(const char *name, mode_t mode, -+ struct dentry *dent, uint32_t clid) -+{ -+ if (dent == NULL) { -+ MSM_BUS_DBG("debugfs not ready yet\n"); -+ return NULL; -+ } -+ return debugfs_create_file(name, mode, dent, (void *)(uintptr_t)clid, -+ &client_data_fops); -+} -+ -+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_MSM_BUS_SCALING) -+static int msm_bus_dbg_record_client(const struct msm_bus_scale_pdata *pdata, -+ int index, uint32_t clid, struct dentry *file) -+{ -+ struct msm_bus_cldata *cldata; -+ -+ cldata = kmalloc(sizeof(struct msm_bus_cldata), GFP_KERNEL); -+ if (!cldata) { -+ MSM_BUS_DBG("Failed to allocate memory for client data\n"); -+ return -ENOMEM; -+ } -+ cldata->pdata = pdata; -+ cldata->index = index; -+ cldata->clid = clid; -+ cldata->file = file; -+ cldata->size = 0; -+ list_add_tail(&cldata->list, &cl_list); -+ return 0; -+} -+ -+static void msm_bus_dbg_free_client(uint32_t clid) -+{ -+ struct msm_bus_cldata *cldata = NULL; -+ -+ list_for_each_entry(cldata, &cl_list, list) { -+ if (cldata->clid == clid) { -+ debugfs_remove(cldata->file); -+ list_del(&cldata->list); -+ kfree(cldata); -+ break; -+ } -+ } -+} -+ -+static int msm_bus_dbg_fill_cl_buffer(const struct msm_bus_scale_pdata *pdata, -+ int index, uint32_t clid) -+{ -+ int i = 0, j; -+ char *buf = NULL; -+ struct msm_bus_cldata *cldata = NULL; -+ struct timespec ts; -+ int found = 0; -+ -+ list_for_each_entry(cldata, &cl_list, list) { -+ if (cldata->clid == clid) { -+ found = 1; -+ break; -+ } -+ } -+ -+ if (!found) -+ return -ENOENT; -+ -+ if (cldata->file == NULL) { -+ if (pdata->name == NULL) { -+ MSM_BUS_DBG("Client doesn't have a name\n"); -+ return -EINVAL; -+ } -+ cldata->file = msm_bus_dbg_create(pdata->name, S_IRUGO, -+ clients, clid); -+ } -+ -+ if (cldata->size < (MAX_BUFF_SIZE - FILL_LIMIT)) -+ i = cldata->size; -+ else { -+ i = 0; -+ cldata->size = 0; -+ } -+ buf = cldata->buffer; -+ ts = ktime_to_timespec(ktime_get()); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\n%d.%d\n", -+ (int)ts.tv_sec, (int)ts.tv_nsec); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "curr : %d\n", index); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "masters: "); -+ -+ for (j = 0; j < pdata->usecase->num_paths; j++) -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "%d ", -+ pdata->usecase[index].vectors[j].src); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\nslaves : "); -+ for (j = 0; j < pdata->usecase->num_paths; j++) -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "%d ", -+ pdata->usecase[index].vectors[j].dst); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\nab : "); -+ for (j = 0; j < pdata->usecase->num_paths; j++) -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "%llu ", -+ pdata->usecase[index].vectors[j].ab); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\nib : "); -+ for (j = 0; j < pdata->usecase->num_paths; j++) -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "%llu ", -+ pdata->usecase[index].vectors[j].ib); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\n"); -+ -+ for (j = 0; j < pdata->usecase->num_paths; j++) -+ trace_bus_update_request((int)ts.tv_sec, (int)ts.tv_nsec, -+ pdata->name, index, -+ pdata->usecase[index].vectors[j].src, -+ pdata->usecase[index].vectors[j].dst, -+ pdata->usecase[index].vectors[j].ab, -+ pdata->usecase[index].vectors[j].ib); -+ -+ cldata->size = i; -+ return i; -+} -+#endif -+ -+static int msm_bus_dbg_update_request(struct msm_bus_cldata *cldata, int index) -+{ -+ int ret = 0; -+ -+ if ((index < 0) || (index > cldata->pdata->num_usecases)) { -+ MSM_BUS_DBG("Invalid index!\n"); -+ return -EINVAL; -+ } -+ ret = msm_bus_scale_client_update_request(cldata->clid, index); -+ return ret; -+} -+ -+static ssize_t msm_bus_dbg_update_request_write(struct file *file, -+ const char __user *ubuf, size_t cnt, loff_t *ppos) -+{ -+ struct msm_bus_cldata *cldata; -+ unsigned long index = 0; -+ int ret = 0; -+ char *chid; -+ char *buf = kmalloc((sizeof(char) * (cnt + 1)), GFP_KERNEL); -+ int found = 0; -+ -+ if (!buf || IS_ERR(buf)) { -+ MSM_BUS_ERR("Memory allocation for buffer failed\n"); -+ return -ENOMEM; -+ } -+ if (cnt == 0) { -+ kfree(buf); -+ return 0; -+ } -+ if (copy_from_user(buf, ubuf, cnt)) { -+ kfree(buf); -+ return -EFAULT; -+ } -+ buf[cnt] = '\0'; -+ chid = buf; -+ MSM_BUS_DBG("buffer: %s\n size: %zu\n", buf, sizeof(ubuf)); -+ -+ list_for_each_entry(cldata, &cl_list, list) { -+ if (strnstr(chid, cldata->pdata->name, cnt)) { -+ found = 1; -+ cldata = cldata; -+ strsep(&chid, " "); -+ if (chid) { -+ ret = kstrtoul(chid, 10, &index); -+ if (ret) { -+ MSM_BUS_DBG("Index conversion" -+ " failed\n"); -+ return -EFAULT; -+ } -+ } else { -+ MSM_BUS_DBG("Error parsing input. Index not" -+ " found\n"); -+ found = 0; -+ } -+ break; -+ } -+ } -+ -+ if (found) -+ msm_bus_dbg_update_request(cldata, index); -+ kfree(buf); -+ return cnt; -+} -+ -+/** -+ * The following funtions are used for viewing the commit data -+ * for each fabric -+ */ -+static ssize_t fabric_data_read(struct file *file, char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ struct msm_bus_fab_list *fablist = NULL; -+ int bsize = 0; -+ ssize_t ret; -+ const char *name = file->private_data; -+ int found = 0; -+ -+ mutex_lock(&msm_bus_dbg_fablist_lock); -+ list_for_each_entry(fablist, &fabdata_list, list) { -+ if (strcmp(fablist->name, name) == 0) { -+ found = 1; -+ break; -+ } -+ } -+ if (!found) -+ return -ENOENT; -+ bsize = fablist->size; -+ ret = simple_read_from_buffer(buf, count, ppos, -+ fablist->buffer, bsize); -+ mutex_unlock(&msm_bus_dbg_fablist_lock); -+ return ret; -+} -+ -+static const struct file_operations fabric_data_fops = { -+ .open = client_data_open, -+ .read = fabric_data_read, -+}; -+ -+static ssize_t rules_dbg_read(struct file *file, char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ ssize_t ret; -+ memset(rules_buf, 0, MAX_BUFF_SIZE); -+ print_rules_buf(rules_buf, MAX_BUFF_SIZE); -+ ret = simple_read_from_buffer(buf, count, ppos, -+ rules_buf, MAX_BUFF_SIZE); -+ return ret; -+} -+ -+static int rules_dbg_open(struct inode *inode, struct file *file) -+{ -+ file->private_data = inode->i_private; -+ return 0; -+} -+ -+static const struct file_operations rules_dbg_fops = { -+ .open = rules_dbg_open, -+ .read = rules_dbg_read, -+}; -+ -+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_MSM_BUS_SCALING) -+static int msm_bus_dbg_record_fabric(const char *fabname, struct dentry *file) -+{ -+ struct msm_bus_fab_list *fablist; -+ int ret = 0; -+ -+ mutex_lock(&msm_bus_dbg_fablist_lock); -+ fablist = kmalloc(sizeof(struct msm_bus_fab_list), GFP_KERNEL); -+ if (!fablist) { -+ MSM_BUS_DBG("Failed to allocate memory for commit data\n"); -+ ret = -ENOMEM; -+ goto err; -+ } -+ -+ fablist->name = fabname; -+ fablist->size = 0; -+ list_add_tail(&fablist->list, &fabdata_list); -+err: -+ mutex_unlock(&msm_bus_dbg_fablist_lock); -+ return ret; -+} -+ -+static void msm_bus_dbg_free_fabric(const char *fabname) -+{ -+ struct msm_bus_fab_list *fablist = NULL; -+ -+ mutex_lock(&msm_bus_dbg_fablist_lock); -+ list_for_each_entry(fablist, &fabdata_list, list) { -+ if (strcmp(fablist->name, fabname) == 0) { -+ debugfs_remove(fablist->file); -+ list_del(&fablist->list); -+ kfree(fablist); -+ break; -+ } -+ } -+ mutex_unlock(&msm_bus_dbg_fablist_lock); -+} -+ -+static int msm_bus_dbg_fill_fab_buffer(const char *fabname, -+ void *cdata, int nmasters, int nslaves, -+ int ntslaves) -+{ -+ int i; -+ char *buf = NULL; -+ struct msm_bus_fab_list *fablist = NULL; -+ struct timespec ts; -+ int found = 0; -+ -+ mutex_lock(&msm_bus_dbg_fablist_lock); -+ list_for_each_entry(fablist, &fabdata_list, list) { -+ if (strcmp(fablist->name, fabname) == 0) { -+ found = 1; -+ break; -+ } -+ } -+ if (!found) -+ return -ENOENT; -+ -+ if (fablist->file == NULL) { -+ MSM_BUS_DBG("Fabric dbg entry does not exist\n"); -+ mutex_unlock(&msm_bus_dbg_fablist_lock); -+ return -EFAULT; -+ } -+ -+ if (fablist->size < MAX_BUFF_SIZE - 256) -+ i = fablist->size; -+ else { -+ i = 0; -+ fablist->size = 0; -+ } -+ buf = fablist->buffer; -+ mutex_unlock(&msm_bus_dbg_fablist_lock); -+ ts = ktime_to_timespec(ktime_get()); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\n%d.%d\n", -+ (int)ts.tv_sec, (int)ts.tv_nsec); -+ -+ msm_bus_rpm_fill_cdata_buffer(&i, buf, MAX_BUFF_SIZE, cdata, -+ nmasters, nslaves, ntslaves); -+ i += scnprintf(buf + i, MAX_BUFF_SIZE - i, "\n"); -+ mutex_lock(&msm_bus_dbg_fablist_lock); -+ fablist->size = i; -+ mutex_unlock(&msm_bus_dbg_fablist_lock); -+ return 0; -+} -+#endif -+ -+static const struct file_operations msm_bus_dbg_update_request_fops = { -+ .open = client_data_open, -+ .write = msm_bus_dbg_update_request_write, -+}; -+ -+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_MSM_BUS_SCALING) -+/** -+ * msm_bus_dbg_client_data() - Add debug data for clients -+ * @pdata: Platform data of the client -+ * @index: The current index or operation to be performed -+ * @clid: Client handle obtained during registration -+ */ -+void msm_bus_dbg_client_data(struct msm_bus_scale_pdata *pdata, int index, -+ uint32_t clid) -+{ -+ struct dentry *file = NULL; -+ -+ if (index == MSM_BUS_DBG_REGISTER) { -+ msm_bus_dbg_record_client(pdata, index, clid, file); -+ if (!pdata->name) { -+ MSM_BUS_DBG("Cannot create debugfs entry. Null name\n"); -+ return; -+ } -+ } else if (index == MSM_BUS_DBG_UNREGISTER) { -+ msm_bus_dbg_free_client(clid); -+ MSM_BUS_DBG("Client %d unregistered\n", clid); -+ } else -+ msm_bus_dbg_fill_cl_buffer(pdata, index, clid); -+} -+EXPORT_SYMBOL(msm_bus_dbg_client_data); -+ -+/** -+ * msm_bus_dbg_commit_data() - Add commit data from fabrics -+ * @fabname: Fabric name specified in platform data -+ * @cdata: Commit Data -+ * @nmasters: Number of masters attached to fabric -+ * @nslaves: Number of slaves attached to fabric -+ * @ntslaves: Number of tiered slaves attached to fabric -+ * @op: Operation to be performed -+ */ -+void msm_bus_dbg_commit_data(const char *fabname, void *cdata, -+ int nmasters, int nslaves, int ntslaves, int op) -+{ -+ struct dentry *file = NULL; -+ -+ if (op == MSM_BUS_DBG_REGISTER) -+ msm_bus_dbg_record_fabric(fabname, file); -+ else if (op == MSM_BUS_DBG_UNREGISTER) -+ msm_bus_dbg_free_fabric(fabname); -+ else -+ msm_bus_dbg_fill_fab_buffer(fabname, cdata, nmasters, -+ nslaves, ntslaves); -+} -+EXPORT_SYMBOL(msm_bus_dbg_commit_data); -+#endif -+ -+static int __init msm_bus_debugfs_init(void) -+{ -+ struct dentry *commit, *shell_client, *rules_dbg; -+ struct msm_bus_fab_list *fablist; -+ struct msm_bus_cldata *cldata = NULL; -+ uint64_t val = 0; -+ -+ dir = debugfs_create_dir("msm-bus-dbg", NULL); -+ if ((!dir) || IS_ERR(dir)) { -+ MSM_BUS_ERR("Couldn't create msm-bus-dbg\n"); -+ goto err; -+ } -+ -+ clients = debugfs_create_dir("client-data", dir); -+ if ((!dir) || IS_ERR(dir)) { -+ MSM_BUS_ERR("Couldn't create clients\n"); -+ goto err; -+ } -+ -+ shell_client = debugfs_create_dir("shell-client", dir); -+ if ((!dir) || IS_ERR(dir)) { -+ MSM_BUS_ERR("Couldn't create clients\n"); -+ goto err; -+ } -+ -+ commit = debugfs_create_dir("commit-data", dir); -+ if ((!dir) || IS_ERR(dir)) { -+ MSM_BUS_ERR("Couldn't create commit\n"); -+ goto err; -+ } -+ -+ rules_dbg = debugfs_create_dir("rules-dbg", dir); -+ if ((!rules_dbg) || IS_ERR(rules_dbg)) { -+ MSM_BUS_ERR("Couldn't create rules-dbg\n"); -+ goto err; -+ } -+ -+ if (debugfs_create_file("print_rules", S_IRUGO | S_IWUSR, -+ rules_dbg, &val, &rules_dbg_fops) == NULL) -+ goto err; -+ -+ if (debugfs_create_file("update_request", S_IRUGO | S_IWUSR, -+ shell_client, &val, &shell_client_en_fops) == NULL) -+ goto err; -+ if (debugfs_create_file("ib", S_IRUGO | S_IWUSR, shell_client, &val, -+ &shell_client_ib_fops) == NULL) -+ goto err; -+ if (debugfs_create_file("ab", S_IRUGO | S_IWUSR, shell_client, &val, -+ &shell_client_ab_fops) == NULL) -+ goto err; -+ if (debugfs_create_file("slv", S_IRUGO | S_IWUSR, shell_client, -+ &val, &shell_client_slv_fops) == NULL) -+ goto err; -+ if (debugfs_create_file("mas", S_IRUGO | S_IWUSR, shell_client, -+ &val, &shell_client_mas_fops) == NULL) -+ goto err; -+ if (debugfs_create_file("update-request", S_IRUGO | S_IWUSR, -+ clients, NULL, &msm_bus_dbg_update_request_fops) == NULL) -+ goto err; -+ -+ rules_buf = kzalloc(MAX_BUFF_SIZE, GFP_KERNEL); -+ if (!rules_buf) { -+ MSM_BUS_ERR("Failed to alloc rules_buf"); -+ goto err; -+ } -+ -+ list_for_each_entry(cldata, &cl_list, list) { -+ if (cldata->pdata->name == NULL) { -+ MSM_BUS_DBG("Client name not found\n"); -+ continue; -+ } -+ cldata->file = msm_bus_dbg_create(cldata-> -+ pdata->name, S_IRUGO, clients, cldata->clid); -+ } -+ -+ mutex_lock(&msm_bus_dbg_fablist_lock); -+ list_for_each_entry(fablist, &fabdata_list, list) { -+ fablist->file = debugfs_create_file(fablist->name, S_IRUGO, -+ commit, (void *)fablist->name, &fabric_data_fops); -+ if (fablist->file == NULL) { -+ MSM_BUS_DBG("Cannot create files for commit data\n"); -+ kfree(rules_buf); -+ goto err; -+ } -+ } -+ mutex_unlock(&msm_bus_dbg_fablist_lock); -+ -+ msm_bus_dbg_init_vectors(); -+ return 0; -+err: -+ debugfs_remove_recursive(dir); -+ return -ENODEV; -+} -+late_initcall(msm_bus_debugfs_init); -+ -+static void __exit msm_bus_dbg_teardown(void) -+{ -+ struct msm_bus_fab_list *fablist = NULL, *fablist_temp; -+ struct msm_bus_cldata *cldata = NULL, *cldata_temp; -+ -+ debugfs_remove_recursive(dir); -+ list_for_each_entry_safe(cldata, cldata_temp, &cl_list, list) { -+ list_del(&cldata->list); -+ kfree(cldata); -+ } -+ mutex_lock(&msm_bus_dbg_fablist_lock); -+ list_for_each_entry_safe(fablist, fablist_temp, &fabdata_list, list) { -+ list_del(&fablist->list); -+ kfree(fablist); -+ } -+ kfree(rules_buf); -+ mutex_unlock(&msm_bus_dbg_fablist_lock); -+} -+module_exit(msm_bus_dbg_teardown); -+MODULE_DESCRIPTION("Debugfs for msm bus scaling client"); -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Gagan Mac "); ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_fabric_adhoc.c -@@ -0,0 +1,1281 @@ -+/* Copyright (c) 2014, Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "rpm-smd.h" -+#include "msm_bus_core.h" -+#include "msm_bus_adhoc.h" -+#include "msm_bus_noc.h" -+#include "msm_bus_bimc.h" -+ -+ssize_t vrail_show(struct device *dev, struct device_attribute *attr, -+ char *buf) -+{ -+ struct msm_bus_node_info_type *node_info = NULL; -+ struct msm_bus_node_device_type *bus_node = NULL; -+ -+ bus_node = dev->platform_data; -+ if (!bus_node) -+ return -EINVAL; -+ node_info = bus_node->node_info; -+ -+ return snprintf(buf, PAGE_SIZE, "%u", node_info->vrail_comp); -+} -+ -+ssize_t vrail_store(struct device *dev, struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ struct msm_bus_node_info_type *node_info = NULL; -+ struct msm_bus_node_device_type *bus_node = NULL; -+ int ret = 0; -+ -+ bus_node = dev->platform_data; -+ if (!bus_node) -+ return -EINVAL; -+ node_info = bus_node->node_info; -+ -+ ret = sscanf(buf, "%u", &node_info->vrail_comp); -+ if (ret != 1) -+ return -EINVAL; -+ return count; -+} -+ -+DEVICE_ATTR(vrail, 0600, vrail_show, vrail_store); -+ -+struct static_rules_type { -+ int num_rules; -+ struct bus_rule_type *rules; -+}; -+ -+static struct static_rules_type static_rules; -+ -+static int enable_nodeclk(struct nodeclk *nclk) -+{ -+ int ret = 0; -+ -+ if (!nclk->enable) { -+ ret = clk_prepare_enable(nclk->clk); -+ -+ if (ret) { -+ MSM_BUS_ERR("%s: failed to enable clk ", __func__); -+ nclk->enable = false; -+ } else -+ nclk->enable = true; -+ } -+ return ret; -+} -+ -+static int disable_nodeclk(struct nodeclk *nclk) -+{ -+ int ret = 0; -+ -+ if (nclk->enable) { -+ clk_disable_unprepare(nclk->clk); -+ nclk->enable = false; -+ } -+ return ret; -+} -+ -+static int setrate_nodeclk(struct nodeclk *nclk, long rate) -+{ -+ int ret = 0; -+ -+ ret = clk_set_rate(nclk->clk, rate); -+ -+ if (ret) -+ MSM_BUS_ERR("%s: failed to setrate clk", __func__); -+ return ret; -+} -+ -+static int msm_bus_agg_fab_clks(struct device *bus_dev, void *data) -+{ -+ struct msm_bus_node_device_type *node = NULL; -+ int ret = 0; -+ int ctx = *(int *)data; -+ -+ if (ctx >= NUM_CTX) { -+ MSM_BUS_ERR("%s: Invalid Context %d", __func__, ctx); -+ goto exit_agg_fab_clks; -+ } -+ -+ node = bus_dev->platform_data; -+ if (!node) { -+ MSM_BUS_ERR("%s: Can't get device info", __func__); -+ goto exit_agg_fab_clks; -+ } -+ -+ if (!node->node_info->is_fab_dev) { -+ struct msm_bus_node_device_type *bus_dev = NULL; -+ -+ bus_dev = node->node_info->bus_device->platform_data; -+ -+ if (node->cur_clk_hz[ctx] >= bus_dev->cur_clk_hz[ctx]) -+ bus_dev->cur_clk_hz[ctx] = node->cur_clk_hz[ctx]; -+ } -+ -+exit_agg_fab_clks: -+ return ret; -+} -+ -+static int msm_bus_reset_fab_clks(struct device *bus_dev, void *data) -+{ -+ struct msm_bus_node_device_type *node = NULL; -+ int ret = 0; -+ int ctx = *(int *)data; -+ -+ if (ctx >= NUM_CTX) { -+ MSM_BUS_ERR("%s: Invalid Context %d", __func__, ctx); -+ goto exit_reset_fab_clks; -+ } -+ -+ node = bus_dev->platform_data; -+ if (!node) { -+ MSM_BUS_ERR("%s: Can't get device info", __func__); -+ goto exit_reset_fab_clks; -+ } -+ -+ if (node->node_info->is_fab_dev) { -+ node->cur_clk_hz[ctx] = 0; -+ MSM_BUS_DBG("Resetting for node %d", node->node_info->id); -+ } -+exit_reset_fab_clks: -+ return ret; -+} -+ -+ -+static int send_rpm_msg(struct device *device) -+{ -+ int ret = 0; -+ int ctx; -+ int rsc_type; -+ struct msm_bus_node_device_type *ndev = -+ device->platform_data; -+ struct msm_rpm_kvp rpm_kvp; -+ -+ if (!ndev) { -+ MSM_BUS_ERR("%s: Error getting node info.", __func__); -+ ret = -ENODEV; -+ goto exit_send_rpm_msg; -+ } -+ -+ rpm_kvp.length = sizeof(uint64_t); -+ rpm_kvp.key = RPM_MASTER_FIELD_BW; -+ -+ for (ctx = MSM_RPM_CTX_ACTIVE_SET; ctx <= MSM_RPM_CTX_SLEEP_SET; -+ ctx++) { -+ if (ctx == MSM_RPM_CTX_ACTIVE_SET) -+ rpm_kvp.data = -+ (uint8_t *)&ndev->node_ab.ab[MSM_RPM_CTX_ACTIVE_SET]; -+ else { -+ rpm_kvp.data = -+ (uint8_t *) &ndev->node_ab.ab[MSM_RPM_CTX_SLEEP_SET]; -+ } -+ -+ if (ndev->node_info->mas_rpm_id != -1) { -+ rsc_type = RPM_BUS_MASTER_REQ; -+ ret = msm_rpm_send_message(ctx, rsc_type, -+ ndev->node_info->mas_rpm_id, &rpm_kvp, 1); -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to send RPM message:", -+ __func__); -+ MSM_BUS_ERR("%s:Node Id %d RPM id %d", -+ __func__, ndev->node_info->id, -+ ndev->node_info->mas_rpm_id); -+ goto exit_send_rpm_msg; -+ } -+ } -+ -+ if (ndev->node_info->slv_rpm_id != -1) { -+ rsc_type = RPM_BUS_SLAVE_REQ; -+ ret = msm_rpm_send_message(ctx, rsc_type, -+ ndev->node_info->slv_rpm_id, &rpm_kvp, 1); -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to send RPM message:", -+ __func__); -+ MSM_BUS_ERR("%s: Node Id %d RPM id %d", -+ __func__, ndev->node_info->id, -+ ndev->node_info->slv_rpm_id); -+ goto exit_send_rpm_msg; -+ } -+ } -+ } -+exit_send_rpm_msg: -+ return ret; -+} -+ -+static int flush_bw_data(struct device *node_device, int ctx) -+{ -+ struct msm_bus_node_device_type *node_info; -+ int ret = 0; -+ -+ node_info = node_device->platform_data; -+ if (!node_info) { -+ MSM_BUS_ERR("%s: Unable to find bus device for device", -+ __func__); -+ ret = -ENODEV; -+ goto exit_flush_bw_data; -+ } -+ -+ if (node_info->node_ab.dirty) { -+ if (node_info->ap_owned) { -+ struct msm_bus_node_device_type *bus_device = -+ node_info->node_info->bus_device->platform_data; -+ struct msm_bus_fab_device_type *fabdev = -+ bus_device->fabdev; -+ -+ if (fabdev && fabdev->noc_ops.update_bw_reg && -+ fabdev->noc_ops.update_bw_reg -+ (node_info->node_info->qos_params.mode)) -+ ret = fabdev->noc_ops.set_bw(node_info, -+ fabdev->qos_base, -+ fabdev->base_offset, -+ fabdev->qos_off, -+ fabdev->qos_freq); -+ } else { -+ ret = send_rpm_msg(node_device); -+ -+ if (ret) -+ MSM_BUS_ERR("%s: Failed to send RPM msg for%d", -+ __func__, node_info->node_info->id); -+ } -+ node_info->node_ab.dirty = false; -+ } -+ -+exit_flush_bw_data: -+ return ret; -+ -+} -+ -+static int flush_clk_data(struct device *node_device, int ctx) -+{ -+ struct msm_bus_node_device_type *node; -+ struct nodeclk *nodeclk = NULL; -+ int ret = 0; -+ -+ node = node_device->platform_data; -+ if (!node) { -+ MSM_BUS_ERR("Unable to find bus device"); -+ ret = -ENODEV; -+ goto exit_flush_clk_data; -+ } -+ -+ nodeclk = &node->clk[ctx]; -+ if (node->node_info->is_fab_dev) { -+ if (nodeclk->rate != node->cur_clk_hz[ctx]) { -+ nodeclk->rate = node->cur_clk_hz[ctx]; -+ nodeclk->dirty = true; -+ } -+ } -+ -+ if (nodeclk && nodeclk->clk && nodeclk->dirty) { -+ long rounded_rate; -+ -+ if (nodeclk->rate) { -+ rounded_rate = clk_round_rate(nodeclk->clk, -+ nodeclk->rate); -+ ret = setrate_nodeclk(nodeclk, rounded_rate); -+ -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to set_rate %lu for %d", -+ __func__, rounded_rate, -+ node->node_info->id); -+ ret = -ENODEV; -+ goto exit_flush_clk_data; -+ } -+ -+ ret = enable_nodeclk(nodeclk); -+ } else -+ ret = disable_nodeclk(nodeclk); -+ -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to enable for %d", __func__, -+ node->node_info->id); -+ ret = -ENODEV; -+ goto exit_flush_clk_data; -+ } -+ MSM_BUS_DBG("%s: Updated %d clk to %llu", __func__, -+ node->node_info->id, nodeclk->rate); -+ -+ } -+exit_flush_clk_data: -+ /* Reset the aggregated clock rate for fab devices*/ -+ if (node && node->node_info->is_fab_dev) -+ node->cur_clk_hz[ctx] = 0; -+ -+ if (nodeclk) -+ nodeclk->dirty = 0; -+ return ret; -+} -+ -+int msm_bus_commit_data(int *dirty_nodes, int ctx, int num_dirty) -+{ -+ int ret = 0; -+ int i = 0; -+ -+ /* Aggregate the bus clocks */ -+ bus_for_each_dev(&msm_bus_type, NULL, (void *)&ctx, -+ msm_bus_agg_fab_clks); -+ -+ for (i = 0; i < num_dirty; i++) { -+ struct device *node_device = -+ bus_find_device(&msm_bus_type, NULL, -+ (void *)&dirty_nodes[i], -+ msm_bus_device_match_adhoc); -+ -+ if (!node_device) { -+ MSM_BUS_ERR("Can't find device for %d", dirty_nodes[i]); -+ continue; -+ } -+ -+ ret = flush_bw_data(node_device, ctx); -+ if (ret) -+ MSM_BUS_ERR("%s: Error flushing bw data for node %d", -+ __func__, dirty_nodes[i]); -+ -+ ret = flush_clk_data(node_device, ctx); -+ if (ret) -+ MSM_BUS_ERR("%s: Error flushing clk data for node %d", -+ __func__, dirty_nodes[i]); -+ } -+ kfree(dirty_nodes); -+ /* Aggregate the bus clocks */ -+ bus_for_each_dev(&msm_bus_type, NULL, (void *)&ctx, -+ msm_bus_reset_fab_clks); -+ return ret; -+} -+ -+void *msm_bus_realloc_devmem(struct device *dev, void *p, size_t old_size, -+ size_t new_size, gfp_t flags) -+{ -+ void *ret; -+ size_t copy_size = old_size; -+ -+ if (!new_size) { -+ devm_kfree(dev, p); -+ return ZERO_SIZE_PTR; -+ } -+ -+ if (new_size < old_size) -+ copy_size = new_size; -+ -+ ret = devm_kzalloc(dev, new_size, flags); -+ if (!ret) { -+ MSM_BUS_ERR("%s: Error Reallocating memory", __func__); -+ goto exit_realloc_devmem; -+ } -+ -+ memcpy(ret, p, copy_size); -+ devm_kfree(dev, p); -+exit_realloc_devmem: -+ return ret; -+} -+ -+ -+static int add_dirty_node(int **dirty_nodes, int id, int *num_dirty) -+{ -+ int i; -+ int found = 0; -+ int ret = 0; -+ int *dnode = NULL; -+ -+ for (i = 0; i < *num_dirty; i++) { -+ if ((*dirty_nodes)[i] == id) { -+ found = 1; -+ break; -+ } -+ } -+ -+ if (!found) { -+ (*num_dirty)++; -+ dnode = -+ krealloc(*dirty_nodes, sizeof(int) * (*num_dirty), -+ GFP_KERNEL); -+ -+ if (ZERO_OR_NULL_PTR(dnode)) { -+ MSM_BUS_ERR("%s: Failure allocating dirty nodes array", -+ __func__); -+ ret = -ENOMEM; -+ } else { -+ *dirty_nodes = dnode; -+ (*dirty_nodes)[(*num_dirty) - 1] = id; -+ } -+ } -+ -+ return ret; -+} -+ -+int msm_bus_update_bw(struct msm_bus_node_device_type *nodedev, int ctx, -+ int64_t add_bw, int **dirty_nodes, int *num_dirty) -+{ -+ int ret = 0; -+ int i, j; -+ uint64_t cur_ab_slp = 0; -+ uint64_t cur_ab_act = 0; -+ -+ if (nodedev->node_info->virt_dev) -+ goto exit_update_bw; -+ -+ for (i = 0; i < NUM_CTX; i++) { -+ for (j = 0; j < nodedev->num_lnodes; j++) { -+ if (i == DUAL_CTX) { -+ cur_ab_act += -+ nodedev->lnode_list[j].lnode_ab[i]; -+ cur_ab_slp += -+ nodedev->lnode_list[j].lnode_ab[i]; -+ } else -+ cur_ab_act += -+ nodedev->lnode_list[j].lnode_ab[i]; -+ } -+ } -+ -+ if (nodedev->node_ab.ab[MSM_RPM_CTX_ACTIVE_SET] != cur_ab_act) { -+ nodedev->node_ab.ab[MSM_RPM_CTX_ACTIVE_SET] = cur_ab_act; -+ nodedev->node_ab.ab[MSM_RPM_CTX_SLEEP_SET] = cur_ab_slp; -+ nodedev->node_ab.dirty = true; -+ ret = add_dirty_node(dirty_nodes, nodedev->node_info->id, -+ num_dirty); -+ -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to add dirty node %d", __func__, -+ nodedev->node_info->id); -+ goto exit_update_bw; -+ } -+ } -+ -+exit_update_bw: -+ return ret; -+} -+ -+int msm_bus_update_clks(struct msm_bus_node_device_type *nodedev, -+ int ctx, int **dirty_nodes, int *num_dirty) -+{ -+ int status = 0; -+ struct nodeclk *nodeclk; -+ struct nodeclk *busclk; -+ struct msm_bus_node_device_type *bus_info = NULL; -+ uint64_t req_clk; -+ -+ bus_info = nodedev->node_info->bus_device->platform_data; -+ -+ if (!bus_info) { -+ MSM_BUS_ERR("%s: Unable to find bus device for device %d", -+ __func__, nodedev->node_info->id); -+ status = -ENODEV; -+ goto exit_set_clks; -+ } -+ -+ req_clk = nodedev->cur_clk_hz[ctx]; -+ busclk = &bus_info->clk[ctx]; -+ -+ if (busclk->rate != req_clk) { -+ busclk->rate = req_clk; -+ busclk->dirty = 1; -+ MSM_BUS_DBG("%s: Modifying bus clk %d Rate %llu", __func__, -+ bus_info->node_info->id, req_clk); -+ status = add_dirty_node(dirty_nodes, bus_info->node_info->id, -+ num_dirty); -+ -+ if (status) { -+ MSM_BUS_ERR("%s: Failed to add dirty node %d", __func__, -+ bus_info->node_info->id); -+ goto exit_set_clks; -+ } -+ } -+ -+ req_clk = nodedev->cur_clk_hz[ctx]; -+ nodeclk = &nodedev->clk[ctx]; -+ -+ if (IS_ERR_OR_NULL(nodeclk)) -+ goto exit_set_clks; -+ -+ if (!nodeclk->dirty || (nodeclk->dirty && (nodeclk->rate < req_clk))) { -+ nodeclk->rate = req_clk; -+ nodeclk->dirty = 1; -+ MSM_BUS_DBG("%s: Modifying node clk %d Rate %llu", __func__, -+ nodedev->node_info->id, req_clk); -+ status = add_dirty_node(dirty_nodes, nodedev->node_info->id, -+ num_dirty); -+ if (status) { -+ MSM_BUS_ERR("%s: Failed to add dirty node %d", __func__, -+ nodedev->node_info->id); -+ goto exit_set_clks; -+ } -+ } -+ -+exit_set_clks: -+ return status; -+} -+ -+static void msm_bus_fab_init_noc_ops(struct msm_bus_node_device_type *bus_dev) -+{ -+ switch (bus_dev->fabdev->bus_type) { -+ case MSM_BUS_NOC: -+ msm_bus_noc_set_ops(bus_dev); -+ break; -+ case MSM_BUS_BIMC: -+ msm_bus_bimc_set_ops(bus_dev); -+ break; -+ default: -+ MSM_BUS_ERR("%s: Invalid Bus type", __func__); -+ } -+} -+ -+static int msm_bus_qos_disable_clk(struct msm_bus_node_device_type *node, -+ int disable_bus_qos_clk) -+{ -+ struct msm_bus_node_device_type *bus_node = NULL; -+ int ret = 0; -+ -+ if (!node) { -+ ret = -ENXIO; -+ goto exit_disable_qos_clk; -+ } -+ -+ bus_node = node->node_info->bus_device->platform_data; -+ -+ if (!bus_node) { -+ ret = -ENXIO; -+ goto exit_disable_qos_clk; -+ } -+ -+ if (disable_bus_qos_clk) -+ ret = disable_nodeclk(&bus_node->clk[DUAL_CTX]); -+ -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to disable bus clk, node %d", -+ __func__, node->node_info->id); -+ goto exit_disable_qos_clk; -+ } -+ -+ if (!IS_ERR_OR_NULL(node->qos_clk.clk)) { -+ ret = disable_nodeclk(&node->qos_clk); -+ -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to disable mas qos clk,node %d", -+ __func__, node->node_info->id); -+ goto exit_disable_qos_clk; -+ } -+ } -+ -+exit_disable_qos_clk: -+ return ret; -+} -+ -+static int msm_bus_qos_enable_clk(struct msm_bus_node_device_type *node) -+{ -+ struct msm_bus_node_device_type *bus_node = NULL; -+ long rounded_rate; -+ int ret = 0; -+ int bus_qos_enabled = 0; -+ -+ if (!node) { -+ ret = -ENXIO; -+ goto exit_enable_qos_clk; -+ } -+ -+ bus_node = node->node_info->bus_device->platform_data; -+ -+ if (!bus_node) { -+ ret = -ENXIO; -+ goto exit_enable_qos_clk; -+ } -+ -+ /* Check if the bus clk is already set before trying to set it -+ * Do this only during -+ * a. Bootup -+ * b. Only for bus clks -+ **/ -+ if (!clk_get_rate(bus_node->clk[DUAL_CTX].clk)) { -+ rounded_rate = clk_round_rate(bus_node->clk[DUAL_CTX].clk, 1); -+ ret = setrate_nodeclk(&bus_node->clk[DUAL_CTX], rounded_rate); -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to set bus clk, node %d", -+ __func__, node->node_info->id); -+ goto exit_enable_qos_clk; -+ } -+ -+ ret = enable_nodeclk(&bus_node->clk[DUAL_CTX]); -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to enable bus clk, node %d", -+ __func__, node->node_info->id); -+ goto exit_enable_qos_clk; -+ } -+ bus_qos_enabled = 1; -+ } -+ -+ if (!IS_ERR_OR_NULL(node->qos_clk.clk)) { -+ rounded_rate = clk_round_rate(node->qos_clk.clk, 1); -+ ret = setrate_nodeclk(&node->qos_clk, rounded_rate); -+ if (ret) { -+ MSM_BUS_ERR("%s: Failed to enable mas qos clk, node %d", -+ __func__, node->node_info->id); -+ goto exit_enable_qos_clk; -+ } -+ -+ ret = enable_nodeclk(&node->qos_clk); -+ if (ret) { -+ MSM_BUS_ERR("Err enable mas qos clk, node %d ret %d", -+ node->node_info->id, ret); -+ goto exit_enable_qos_clk; -+ } -+ } -+ ret = bus_qos_enabled; -+ -+exit_enable_qos_clk: -+ return ret; -+} -+ -+int msm_bus_enable_limiter(struct msm_bus_node_device_type *node_dev, -+ bool enable, uint64_t lim_bw) -+{ -+ int ret = 0; -+ struct msm_bus_node_device_type *bus_node_dev; -+ -+ if (!node_dev) { -+ MSM_BUS_ERR("No device specified"); -+ ret = -ENXIO; -+ goto exit_enable_limiter; -+ } -+ -+ if (!node_dev->ap_owned) { -+ MSM_BUS_ERR("Device is not AP owned %d.", -+ node_dev->node_info->id); -+ ret = -ENXIO; -+ goto exit_enable_limiter; -+ } -+ -+ bus_node_dev = node_dev->node_info->bus_device->platform_data; -+ if (!bus_node_dev) { -+ MSM_BUS_ERR("Unable to get bus device infofor %d", -+ node_dev->node_info->id); -+ ret = -ENXIO; -+ goto exit_enable_limiter; -+ } -+ if (bus_node_dev->fabdev && -+ bus_node_dev->fabdev->noc_ops.limit_mport) { -+ ret = msm_bus_qos_enable_clk(node_dev); -+ if (ret < 0) { -+ MSM_BUS_ERR("Can't Enable QoS clk %d", -+ node_dev->node_info->id); -+ goto exit_enable_limiter; -+ } -+ bus_node_dev->fabdev->noc_ops.limit_mport( -+ node_dev, -+ bus_node_dev->fabdev->qos_base, -+ bus_node_dev->fabdev->base_offset, -+ bus_node_dev->fabdev->qos_off, -+ bus_node_dev->fabdev->qos_freq, -+ enable, lim_bw); -+ msm_bus_qos_disable_clk(node_dev, ret); -+ } -+ -+exit_enable_limiter: -+ return ret; -+} -+ -+static int msm_bus_dev_init_qos(struct device *dev, void *data) -+{ -+ int ret = 0; -+ struct msm_bus_node_device_type *node_dev = NULL; -+ -+ node_dev = dev->platform_data; -+ -+ if (!node_dev) { -+ MSM_BUS_ERR("%s: Unable to get node device info" , __func__); -+ ret = -ENXIO; -+ goto exit_init_qos; -+ } -+ -+ MSM_BUS_DBG("Device = %d", node_dev->node_info->id); -+ -+ if (node_dev->ap_owned) { -+ struct msm_bus_node_device_type *bus_node_info; -+ -+ bus_node_info = node_dev->node_info->bus_device->platform_data; -+ -+ if (!bus_node_info) { -+ MSM_BUS_ERR("%s: Unable to get bus device infofor %d", -+ __func__, -+ node_dev->node_info->id); -+ ret = -ENXIO; -+ goto exit_init_qos; -+ } -+ -+ if (bus_node_info->fabdev && -+ bus_node_info->fabdev->noc_ops.qos_init) { -+ int ret = 0; -+ -+ if (node_dev->ap_owned && -+ (node_dev->node_info->qos_params.mode) != -1) { -+ -+ if (bus_node_info->fabdev->bypass_qos_prg) -+ goto exit_init_qos; -+ -+ ret = msm_bus_qos_enable_clk(node_dev); -+ if (ret < 0) { -+ MSM_BUS_ERR("Can't Enable QoS clk %d", -+ node_dev->node_info->id); -+ goto exit_init_qos; -+ } -+ -+ bus_node_info->fabdev->noc_ops.qos_init( -+ node_dev, -+ bus_node_info->fabdev->qos_base, -+ bus_node_info->fabdev->base_offset, -+ bus_node_info->fabdev->qos_off, -+ bus_node_info->fabdev->qos_freq); -+ msm_bus_qos_disable_clk(node_dev, ret); -+ } -+ } else -+ MSM_BUS_ERR("%s: Skipping QOS init for %d", -+ __func__, node_dev->node_info->id); -+ } -+exit_init_qos: -+ return ret; -+} -+ -+static int msm_bus_fabric_init(struct device *dev, -+ struct msm_bus_node_device_type *pdata) -+{ -+ struct msm_bus_fab_device_type *fabdev; -+ struct msm_bus_node_device_type *node_dev = NULL; -+ int ret = 0; -+ -+ node_dev = dev->platform_data; -+ if (!node_dev) { -+ MSM_BUS_ERR("%s: Unable to get bus device info" , __func__); -+ ret = -ENXIO; -+ goto exit_fabric_init; -+ } -+ -+ if (node_dev->node_info->virt_dev) { -+ MSM_BUS_ERR("%s: Skip Fab init for virtual device %d", __func__, -+ node_dev->node_info->id); -+ goto exit_fabric_init; -+ } -+ -+ fabdev = devm_kzalloc(dev, sizeof(struct msm_bus_fab_device_type), -+ GFP_KERNEL); -+ if (!fabdev) { -+ MSM_BUS_ERR("Fabric alloc failed\n"); -+ ret = -ENOMEM; -+ goto exit_fabric_init; -+ } -+ -+ node_dev->fabdev = fabdev; -+ fabdev->pqos_base = pdata->fabdev->pqos_base; -+ fabdev->qos_range = pdata->fabdev->qos_range; -+ fabdev->base_offset = pdata->fabdev->base_offset; -+ fabdev->qos_off = pdata->fabdev->qos_off; -+ fabdev->qos_freq = pdata->fabdev->qos_freq; -+ fabdev->bus_type = pdata->fabdev->bus_type; -+ fabdev->bypass_qos_prg = pdata->fabdev->bypass_qos_prg; -+ fabdev->util_fact = pdata->fabdev->util_fact; -+ fabdev->vrail_comp = pdata->fabdev->vrail_comp; -+ msm_bus_fab_init_noc_ops(node_dev); -+ -+ fabdev->qos_base = devm_ioremap(dev, -+ fabdev->pqos_base, fabdev->qos_range); -+ if (!fabdev->qos_base) { -+ MSM_BUS_ERR("%s: Error remapping address 0x%zx :bus device %d", -+ __func__, -+ (size_t)fabdev->pqos_base, node_dev->node_info->id); -+ ret = -ENOMEM; -+ goto exit_fabric_init; -+ } -+ -+ /*if (msmbus_coresight_init(pdev)) -+ pr_warn("Coresight support absent for bus: %d\n", pdata->id);*/ -+exit_fabric_init: -+ return ret; -+} -+ -+static int msm_bus_init_clk(struct device *bus_dev, -+ struct msm_bus_node_device_type *pdata) -+{ -+ unsigned int ctx; -+ int ret = 0; -+ struct msm_bus_node_device_type *node_dev = bus_dev->platform_data; -+ -+ for (ctx = 0; ctx < NUM_CTX; ctx++) { -+ if (!IS_ERR_OR_NULL(pdata->clk[ctx].clk)) { -+ node_dev->clk[ctx].clk = pdata->clk[ctx].clk; -+ node_dev->clk[ctx].enable = false; -+ node_dev->clk[ctx].dirty = false; -+ MSM_BUS_ERR("%s: Valid node clk node %d ctx %d", -+ __func__, node_dev->node_info->id, ctx); -+ } -+ } -+ -+ if (!IS_ERR_OR_NULL(pdata->qos_clk.clk)) { -+ node_dev->qos_clk.clk = pdata->qos_clk.clk; -+ node_dev->qos_clk.enable = false; -+ MSM_BUS_ERR("%s: Valid Iface clk node %d", __func__, -+ node_dev->node_info->id); -+ } -+ -+ return ret; -+} -+ -+static int msm_bus_copy_node_info(struct msm_bus_node_device_type *pdata, -+ struct device *bus_dev) -+{ -+ int ret = 0; -+ struct msm_bus_node_info_type *node_info = NULL; -+ struct msm_bus_node_info_type *pdata_node_info = NULL; -+ struct msm_bus_node_device_type *bus_node = NULL; -+ -+ bus_node = bus_dev->platform_data; -+ -+ if (!bus_node || !pdata) { -+ ret = -ENXIO; -+ MSM_BUS_ERR("%s: Invalid pointers pdata %p, bus_node %p", -+ __func__, pdata, bus_node); -+ goto exit_copy_node_info; -+ } -+ -+ node_info = bus_node->node_info; -+ pdata_node_info = pdata->node_info; -+ -+ node_info->name = pdata_node_info->name; -+ node_info->id = pdata_node_info->id; -+ node_info->bus_device_id = pdata_node_info->bus_device_id; -+ node_info->mas_rpm_id = pdata_node_info->mas_rpm_id; -+ node_info->slv_rpm_id = pdata_node_info->slv_rpm_id; -+ node_info->num_connections = pdata_node_info->num_connections; -+ node_info->num_blist = pdata_node_info->num_blist; -+ node_info->num_qports = pdata_node_info->num_qports; -+ node_info->buswidth = pdata_node_info->buswidth; -+ node_info->virt_dev = pdata_node_info->virt_dev; -+ node_info->is_fab_dev = pdata_node_info->is_fab_dev; -+ node_info->qos_params.mode = pdata_node_info->qos_params.mode; -+ node_info->qos_params.prio1 = pdata_node_info->qos_params.prio1; -+ node_info->qos_params.prio0 = pdata_node_info->qos_params.prio0; -+ node_info->qos_params.prio_lvl = pdata_node_info->qos_params.prio_lvl; -+ node_info->qos_params.prio_rd = pdata_node_info->qos_params.prio_rd; -+ node_info->qos_params.prio_wr = pdata_node_info->qos_params.prio_wr; -+ node_info->qos_params.gp = pdata_node_info->qos_params.gp; -+ node_info->qos_params.thmp = pdata_node_info->qos_params.thmp; -+ node_info->qos_params.ws = pdata_node_info->qos_params.ws; -+ node_info->qos_params.bw_buffer = pdata_node_info->qos_params.bw_buffer; -+ node_info->util_fact = pdata_node_info->util_fact; -+ node_info->vrail_comp = pdata_node_info->vrail_comp; -+ -+ node_info->dev_connections = devm_kzalloc(bus_dev, -+ sizeof(struct device *) * -+ pdata_node_info->num_connections, -+ GFP_KERNEL); -+ if (!node_info->dev_connections) { -+ MSM_BUS_ERR("%s:Bus dev connections alloc failed\n", __func__); -+ ret = -ENOMEM; -+ goto exit_copy_node_info; -+ } -+ -+ node_info->connections = devm_kzalloc(bus_dev, -+ sizeof(int) * pdata_node_info->num_connections, -+ GFP_KERNEL); -+ if (!node_info->connections) { -+ MSM_BUS_ERR("%s:Bus connections alloc failed\n", __func__); -+ devm_kfree(bus_dev, node_info->dev_connections); -+ ret = -ENOMEM; -+ goto exit_copy_node_info; -+ } -+ -+ memcpy(node_info->connections, -+ pdata_node_info->connections, -+ sizeof(int) * pdata_node_info->num_connections); -+ -+ node_info->black_connections = devm_kzalloc(bus_dev, -+ sizeof(struct device *) * -+ pdata_node_info->num_blist, -+ GFP_KERNEL); -+ if (!node_info->black_connections) { -+ MSM_BUS_ERR("%s: Bus black connections alloc failed\n", -+ __func__); -+ devm_kfree(bus_dev, node_info->dev_connections); -+ devm_kfree(bus_dev, node_info->connections); -+ ret = -ENOMEM; -+ goto exit_copy_node_info; -+ } -+ -+ node_info->black_listed_connections = devm_kzalloc(bus_dev, -+ pdata_node_info->num_blist * sizeof(int), -+ GFP_KERNEL); -+ if (!node_info->black_listed_connections) { -+ MSM_BUS_ERR("%s:Bus black list connections alloc failed\n", -+ __func__); -+ devm_kfree(bus_dev, node_info->black_connections); -+ devm_kfree(bus_dev, node_info->dev_connections); -+ devm_kfree(bus_dev, node_info->connections); -+ ret = -ENOMEM; -+ goto exit_copy_node_info; -+ } -+ -+ memcpy(node_info->black_listed_connections, -+ pdata_node_info->black_listed_connections, -+ sizeof(int) * pdata_node_info->num_blist); -+ -+ node_info->qport = devm_kzalloc(bus_dev, -+ sizeof(int) * pdata_node_info->num_qports, -+ GFP_KERNEL); -+ if (!node_info->qport) { -+ MSM_BUS_ERR("%s:Bus qport allocation failed\n", __func__); -+ devm_kfree(bus_dev, node_info->dev_connections); -+ devm_kfree(bus_dev, node_info->connections); -+ devm_kfree(bus_dev, node_info->black_listed_connections); -+ ret = -ENOMEM; -+ goto exit_copy_node_info; -+ } -+ -+ memcpy(node_info->qport, -+ pdata_node_info->qport, -+ sizeof(int) * pdata_node_info->num_qports); -+ -+exit_copy_node_info: -+ return ret; -+} -+ -+static struct device *msm_bus_device_init( -+ struct msm_bus_node_device_type *pdata) -+{ -+ struct device *bus_dev = NULL; -+ struct msm_bus_node_device_type *bus_node = NULL; -+ struct msm_bus_node_info_type *node_info = NULL; -+ int ret = 0; -+ -+ bus_dev = kzalloc(sizeof(struct device), GFP_KERNEL); -+ if (!bus_dev) { -+ MSM_BUS_ERR("%s:Device alloc failed\n", __func__); -+ bus_dev = NULL; -+ goto exit_device_init; -+ } -+ /** -+ * Init here so we can use devm calls -+ */ -+ device_initialize(bus_dev); -+ -+ bus_node = devm_kzalloc(bus_dev, -+ sizeof(struct msm_bus_node_device_type), GFP_KERNEL); -+ if (!bus_node) { -+ MSM_BUS_ERR("%s:Bus node alloc failed\n", __func__); -+ kfree(bus_dev); -+ bus_dev = NULL; -+ goto exit_device_init; -+ } -+ -+ node_info = devm_kzalloc(bus_dev, -+ sizeof(struct msm_bus_node_info_type), GFP_KERNEL); -+ if (!node_info) { -+ MSM_BUS_ERR("%s:Bus node info alloc failed\n", __func__); -+ devm_kfree(bus_dev, bus_node); -+ kfree(bus_dev); -+ bus_dev = NULL; -+ goto exit_device_init; -+ } -+ -+ bus_node->node_info = node_info; -+ bus_node->ap_owned = pdata->ap_owned; -+ bus_dev->platform_data = bus_node; -+ -+ if (msm_bus_copy_node_info(pdata, bus_dev) < 0) { -+ devm_kfree(bus_dev, bus_node); -+ devm_kfree(bus_dev, node_info); -+ kfree(bus_dev); -+ bus_dev = NULL; -+ goto exit_device_init; -+ } -+ -+ bus_dev->bus = &msm_bus_type; -+ dev_set_name(bus_dev, bus_node->node_info->name); -+ -+ ret = device_add(bus_dev); -+ if (ret < 0) { -+ MSM_BUS_ERR("%s: Error registering device %d", -+ __func__, pdata->node_info->id); -+ devm_kfree(bus_dev, bus_node); -+ devm_kfree(bus_dev, node_info->dev_connections); -+ devm_kfree(bus_dev, node_info->connections); -+ devm_kfree(bus_dev, node_info->black_connections); -+ devm_kfree(bus_dev, node_info->black_listed_connections); -+ devm_kfree(bus_dev, node_info); -+ kfree(bus_dev); -+ bus_dev = NULL; -+ goto exit_device_init; -+ } -+ device_create_file(bus_dev, &dev_attr_vrail); -+ -+exit_device_init: -+ return bus_dev; -+} -+ -+static int msm_bus_setup_dev_conn(struct device *bus_dev, void *data) -+{ -+ struct msm_bus_node_device_type *bus_node = NULL; -+ int ret = 0; -+ int j; -+ -+ bus_node = bus_dev->platform_data; -+ if (!bus_node) { -+ MSM_BUS_ERR("%s: Can't get device info", __func__); -+ ret = -ENODEV; -+ goto exit_setup_dev_conn; -+ } -+ -+ /* Setup parent bus device for this node */ -+ if (!bus_node->node_info->is_fab_dev) { -+ struct device *bus_parent_device = -+ bus_find_device(&msm_bus_type, NULL, -+ (void *)&bus_node->node_info->bus_device_id, -+ msm_bus_device_match_adhoc); -+ -+ if (!bus_parent_device) { -+ MSM_BUS_ERR("%s: Error finding parentdev %d parent %d", -+ __func__, -+ bus_node->node_info->id, -+ bus_node->node_info->bus_device_id); -+ ret = -ENXIO; -+ goto exit_setup_dev_conn; -+ } -+ bus_node->node_info->bus_device = bus_parent_device; -+ } -+ -+ bus_node->node_info->is_traversed = false; -+ -+ for (j = 0; j < bus_node->node_info->num_connections; j++) { -+ bus_node->node_info->dev_connections[j] = -+ bus_find_device(&msm_bus_type, NULL, -+ (void *)&bus_node->node_info->connections[j], -+ msm_bus_device_match_adhoc); -+ -+ if (!bus_node->node_info->dev_connections[j]) { -+ MSM_BUS_ERR("%s: Error finding conn %d for device %d", -+ __func__, bus_node->node_info->connections[j], -+ bus_node->node_info->id); -+ ret = -ENODEV; -+ goto exit_setup_dev_conn; -+ } -+ } -+ -+ for (j = 0; j < bus_node->node_info->num_blist; j++) { -+ bus_node->node_info->black_connections[j] = -+ bus_find_device(&msm_bus_type, NULL, -+ (void *)&bus_node->node_info-> -+ black_listed_connections[j], -+ msm_bus_device_match_adhoc); -+ -+ if (!bus_node->node_info->black_connections[j]) { -+ MSM_BUS_ERR("%s: Error finding conn %d for device %d\n", -+ __func__, bus_node->node_info-> -+ black_listed_connections[j], -+ bus_node->node_info->id); -+ ret = -ENODEV; -+ goto exit_setup_dev_conn; -+ } -+ } -+ -+exit_setup_dev_conn: -+ return ret; -+} -+ -+static int msm_bus_node_debug(struct device *bus_dev, void *data) -+{ -+ int j; -+ int ret = 0; -+ struct msm_bus_node_device_type *bus_node = NULL; -+ -+ bus_node = bus_dev->platform_data; -+ if (!bus_node) { -+ MSM_BUS_ERR("%s: Can't get device info", __func__); -+ ret = -ENODEV; -+ goto exit_node_debug; -+ } -+ -+ MSM_BUS_DBG("Device = %d buswidth %u", bus_node->node_info->id, -+ bus_node->node_info->buswidth); -+ for (j = 0; j < bus_node->node_info->num_connections; j++) { -+ struct msm_bus_node_device_type *bdev = -+ (struct msm_bus_node_device_type *) -+ bus_node->node_info->dev_connections[j]->platform_data; -+ MSM_BUS_DBG("\n\t Connection[%d] %d", j, bdev->node_info->id); -+ } -+ -+exit_node_debug: -+ return ret; -+} -+ -+static int msm_bus_device_probe(struct platform_device *pdev) -+{ -+ unsigned int i, ret; -+ struct msm_bus_device_node_registration *pdata; -+ -+ /* If possible, get pdata from device-tree */ -+ if (pdev->dev.of_node) -+ pdata = msm_bus_of_to_pdata(pdev); -+ else { -+ pdata = (struct msm_bus_device_node_registration *)pdev-> -+ dev.platform_data; -+ } -+ -+ if (IS_ERR_OR_NULL(pdata)) { -+ MSM_BUS_ERR("No platform data found"); -+ ret = -ENODATA; -+ goto exit_device_probe; -+ } -+ -+ for (i = 0; i < pdata->num_devices; i++) { -+ struct device *node_dev = NULL; -+ -+ node_dev = msm_bus_device_init(&pdata->info[i]); -+ -+ if (!node_dev) { -+ MSM_BUS_ERR("%s: Error during dev init for %d", -+ __func__, pdata->info[i].node_info->id); -+ ret = -ENXIO; -+ goto exit_device_probe; -+ } -+ -+ ret = msm_bus_init_clk(node_dev, &pdata->info[i]); -+ /*Is this a fabric device ?*/ -+ if (pdata->info[i].node_info->is_fab_dev) { -+ MSM_BUS_DBG("%s: %d is a fab", __func__, -+ pdata->info[i].node_info->id); -+ ret = msm_bus_fabric_init(node_dev, &pdata->info[i]); -+ if (ret) { -+ MSM_BUS_ERR("%s: Error intializing fab %d", -+ __func__, pdata->info[i].node_info->id); -+ goto exit_device_probe; -+ } -+ } -+ } -+ -+ ret = bus_for_each_dev(&msm_bus_type, NULL, NULL, -+ msm_bus_setup_dev_conn); -+ if (ret) { -+ MSM_BUS_ERR("%s: Error setting up dev connections", __func__); -+ goto exit_device_probe; -+ } -+ -+ ret = bus_for_each_dev(&msm_bus_type, NULL, NULL, msm_bus_dev_init_qos); -+ if (ret) { -+ MSM_BUS_ERR("%s: Error during qos init", __func__); -+ goto exit_device_probe; -+ } -+ -+ bus_for_each_dev(&msm_bus_type, NULL, NULL, msm_bus_node_debug); -+ -+ /* Register the arb layer ops */ -+ msm_bus_arb_setops_adhoc(&arb_ops); -+ devm_kfree(&pdev->dev, pdata->info); -+ devm_kfree(&pdev->dev, pdata); -+exit_device_probe: -+ return ret; -+} -+ -+static int msm_bus_device_rules_probe(struct platform_device *pdev) -+{ -+ struct bus_rule_type *rule_data = NULL; -+ int num_rules = 0; -+ -+ num_rules = msm_bus_of_get_static_rules(pdev, &rule_data); -+ -+ if (!rule_data) -+ goto exit_rules_probe; -+ -+ msm_rule_register(num_rules, rule_data, NULL); -+ static_rules.num_rules = num_rules; -+ static_rules.rules = rule_data; -+ pdev->dev.platform_data = &static_rules; -+ -+exit_rules_probe: -+ return 0; -+} -+ -+int msm_bus_device_rules_remove(struct platform_device *pdev) -+{ -+ struct static_rules_type *static_rules = NULL; -+ -+ static_rules = pdev->dev.platform_data; -+ if (static_rules) -+ msm_rule_unregister(static_rules->num_rules, -+ static_rules->rules, NULL); -+ return 0; -+} -+ -+static int msm_bus_free_dev(struct device *dev, void *data) -+{ -+ struct msm_bus_node_device_type *bus_node = NULL; -+ -+ bus_node = dev->platform_data; -+ -+ if (bus_node) -+ MSM_BUS_ERR("\n%s: Removing device %d", __func__, -+ bus_node->node_info->id); -+ device_unregister(dev); -+ return 0; -+} -+ -+int msm_bus_device_remove(struct platform_device *pdev) -+{ -+ bus_for_each_dev(&msm_bus_type, NULL, NULL, msm_bus_free_dev); -+ return 0; -+} -+ -+static struct of_device_id rules_match[] = { -+ {.compatible = "qcom,msm-bus-static-bw-rules"}, -+ {} -+}; -+ -+static struct platform_driver msm_bus_rules_driver = { -+ .probe = msm_bus_device_rules_probe, -+ .remove = msm_bus_device_rules_remove, -+ .driver = { -+ .name = "msm_bus_rules_device", -+ .owner = THIS_MODULE, -+ .of_match_table = rules_match, -+ }, -+}; -+ -+static struct of_device_id fabric_match[] = { -+ {.compatible = "qcom,msm-bus-device"}, -+ {} -+}; -+ -+static struct platform_driver msm_bus_device_driver = { -+ .probe = msm_bus_device_probe, -+ .remove = msm_bus_device_remove, -+ .driver = { -+ .name = "msm_bus_device", -+ .owner = THIS_MODULE, -+ .of_match_table = fabric_match, -+ }, -+}; -+ -+int __init msm_bus_device_init_driver(void) -+{ -+ int rc; -+ -+ MSM_BUS_ERR("msm_bus_fabric_init_driver\n"); -+ rc = platform_driver_register(&msm_bus_device_driver); -+ -+ if (rc) { -+ MSM_BUS_ERR("Failed to register bus device driver"); -+ return rc; -+ } -+ return platform_driver_register(&msm_bus_rules_driver); -+} -+subsys_initcall(msm_bus_device_init_driver); ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_id.c -@@ -0,0 +1,94 @@ -+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include "msm-bus.h" -+#include "msm-bus-board.h" -+#include "msm_bus_core.h" -+#include "msm_bus_noc.h" -+#include "msm_bus_bimc.h" -+ -+static uint32_t master_iids[MSM_BUS_MASTER_LAST]; -+static uint32_t slave_iids[MSM_BUS_SLAVE_LAST - SLAVE_ID_KEY]; -+ -+static void msm_bus_assign_iids(struct msm_bus_fabric_registration -+ *fabreg, int fabid) -+{ -+ int i; -+ for (i = 0; i < fabreg->len; i++) { -+ if (!fabreg->info[i].gateway) { -+ fabreg->info[i].priv_id = fabid + fabreg->info[i].id; -+ if (fabreg->info[i].id < SLAVE_ID_KEY) { -+ if (fabreg->info[i].id >= MSM_BUS_MASTER_LAST) { -+ WARN(1, "id %d exceeds array size!\n", -+ fabreg->info[i].id); -+ continue; -+ } -+ -+ master_iids[fabreg->info[i].id] = -+ fabreg->info[i].priv_id; -+ } else { -+ if ((fabreg->info[i].id - SLAVE_ID_KEY) >= -+ (MSM_BUS_SLAVE_LAST - SLAVE_ID_KEY)) { -+ WARN(1, "id %d exceeds array size!\n", -+ fabreg->info[i].id); -+ continue; -+ } -+ -+ slave_iids[fabreg->info[i].id - (SLAVE_ID_KEY)] -+ = fabreg->info[i].priv_id; -+ } -+ } else { -+ fabreg->info[i].priv_id = fabreg->info[i].id; -+ } -+ } -+} -+ -+static int msm_bus_get_iid(int id) -+{ -+ if ((id < SLAVE_ID_KEY && id >= MSM_BUS_MASTER_LAST) || -+ id >= MSM_BUS_SLAVE_LAST) { -+ MSM_BUS_ERR("Cannot get iid. Invalid id %d passed\n", id); -+ return -EINVAL; -+ } -+ -+ return CHECK_ID(((id < SLAVE_ID_KEY) ? master_iids[id] : -+ slave_iids[id - SLAVE_ID_KEY]), id); -+} -+ -+static struct msm_bus_board_algorithm msm_bus_id_algo = { -+ .get_iid = msm_bus_get_iid, -+ .assign_iids = msm_bus_assign_iids, -+}; -+ -+int msm_bus_board_rpm_get_il_ids(uint16_t *id) -+{ -+ return -ENXIO; -+} -+ -+void msm_bus_board_init(struct msm_bus_fabric_registration *pdata) -+{ -+ pdata->board_algo = &msm_bus_id_algo; -+} -+ -+void msm_bus_board_set_nfab(struct msm_bus_fabric_registration *pdata, -+ int nfab) -+{ -+ if (nfab <= 0) -+ return; -+ -+ msm_bus_id_algo.board_nfab = nfab; -+} ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_noc.c -@@ -0,0 +1,770 @@ -+/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#define pr_fmt(fmt) "AXI: NOC: %s(): " fmt, __func__ -+ -+#include -+#include -+#include "msm-bus-board.h" -+#include "msm_bus_core.h" -+#include "msm_bus_noc.h" -+#include "msm_bus_adhoc.h" -+ -+/* NOC_QOS generic */ -+#define __CLZ(x) ((8 * sizeof(uint32_t)) - 1 - __fls(x)) -+#define SAT_SCALE 16 /* 16 bytes minimum for saturation */ -+#define BW_SCALE 256 /* 1/256 byte per cycle unit */ -+#define QOS_DEFAULT_BASEOFFSET 0x00003000 -+#define QOS_DEFAULT_DELTA 0x80 -+#define MAX_BW_FIELD (NOC_QOS_BWn_BW_BMSK >> NOC_QOS_BWn_BW_SHFT) -+#define MAX_SAT_FIELD (NOC_QOS_SATn_SAT_BMSK >> NOC_QOS_SATn_SAT_SHFT) -+ -+#define NOC_QOS_REG_BASE(b, o) ((b) + (o)) -+ -+#define NOC_QOS_ID_COREIDn_ADDR(b, o, n, d) \ -+ (NOC_QOS_REG_BASE(b, o) + (d) * (n)) -+enum noc_qos_id_coreidn { -+ NOC_QOS_ID_COREIDn_RMSK = 0xffffffff, -+ NOC_QOS_ID_COREIDn_MAXn = 32, -+ NOC_QOS_ID_COREIDn_CORECHSUM_BMSK = 0xffffff00, -+ NOC_QOS_ID_COREIDn_CORECHSUM_SHFT = 0x8, -+ NOC_QOS_ID_COREIDn_CORETYPEID_BMSK = 0xff, -+ NOC_QOS_ID_COREIDn_CORETYPEID_SHFT = 0x0, -+}; -+ -+#define NOC_QOS_ID_REVISIONIDn_ADDR(b, o, n, d) \ -+ (NOC_QOS_REG_BASE(b, o) + 0x4 + (d) * (n)) -+enum noc_qos_id_revisionidn { -+ NOC_QOS_ID_REVISIONIDn_RMSK = 0xffffffff, -+ NOC_QOS_ID_REVISIONIDn_MAXn = 32, -+ NOC_QOS_ID_REVISIONIDn_FLEXNOCID_BMSK = 0xffffff00, -+ NOC_QOS_ID_REVISIONIDn_FLEXNOCID_SHFT = 0x8, -+ NOC_QOS_ID_REVISIONIDn_USERID_BMSK = 0xff, -+ NOC_QOS_ID_REVISIONIDn_USERID_SHFT = 0x0, -+}; -+ -+#define NOC_QOS_PRIORITYn_ADDR(b, o, n, d) \ -+ (NOC_QOS_REG_BASE(b, o) + 0x8 + (d) * (n)) -+enum noc_qos_id_priorityn { -+ NOC_QOS_PRIORITYn_RMSK = 0x0000000f, -+ NOC_QOS_PRIORITYn_MAXn = 32, -+ NOC_QOS_PRIORITYn_P1_BMSK = 0xc, -+ NOC_QOS_PRIORITYn_P1_SHFT = 0x2, -+ NOC_QOS_PRIORITYn_P0_BMSK = 0x3, -+ NOC_QOS_PRIORITYn_P0_SHFT = 0x0, -+}; -+ -+#define NOC_QOS_MODEn_ADDR(b, o, n, d) \ -+ (NOC_QOS_REG_BASE(b, o) + 0xC + (d) * (n)) -+enum noc_qos_id_moden_rmsk { -+ NOC_QOS_MODEn_RMSK = 0x00000003, -+ NOC_QOS_MODEn_MAXn = 32, -+ NOC_QOS_MODEn_MODE_BMSK = 0x3, -+ NOC_QOS_MODEn_MODE_SHFT = 0x0, -+}; -+ -+#define NOC_QOS_BWn_ADDR(b, o, n, d) \ -+ (NOC_QOS_REG_BASE(b, o) + 0x10 + (d) * (n)) -+enum noc_qos_id_bwn { -+ NOC_QOS_BWn_RMSK = 0x0000ffff, -+ NOC_QOS_BWn_MAXn = 32, -+ NOC_QOS_BWn_BW_BMSK = 0xffff, -+ NOC_QOS_BWn_BW_SHFT = 0x0, -+}; -+ -+/* QOS Saturation registers */ -+#define NOC_QOS_SATn_ADDR(b, o, n, d) \ -+ (NOC_QOS_REG_BASE(b, o) + 0x14 + (d) * (n)) -+enum noc_qos_id_saturationn { -+ NOC_QOS_SATn_RMSK = 0x000003ff, -+ NOC_QOS_SATn_MAXn = 32, -+ NOC_QOS_SATn_SAT_BMSK = 0x3ff, -+ NOC_QOS_SATn_SAT_SHFT = 0x0, -+}; -+ -+static int noc_div(uint64_t *a, uint32_t b) -+{ -+ if ((*a > 0) && (*a < b)) -+ return 1; -+ else -+ return do_div(*a, b); -+} -+ -+/** -+ * Calculates bw hardware is using from register values -+ * bw returned is in bytes/sec -+ */ -+static uint64_t noc_bw(uint32_t bw_field, uint32_t qos_freq) -+{ -+ uint64_t res; -+ uint32_t rem, scale; -+ -+ res = 2 * qos_freq * bw_field; -+ scale = BW_SCALE * 1000; -+ rem = noc_div(&res, scale); -+ MSM_BUS_DBG("NOC: Calculated bw: %llu\n", res * 1000000ULL); -+ return res * 1000000ULL; -+} -+ -+static uint32_t noc_bw_ceil(long int bw_field, uint32_t qos_freq) -+{ -+ uint64_t bw_temp = 2 * qos_freq * bw_field; -+ uint32_t scale = 1000 * BW_SCALE; -+ noc_div(&bw_temp, scale); -+ return bw_temp * 1000000; -+} -+#define MAX_BW(timebase) noc_bw_ceil(MAX_BW_FIELD, (timebase)) -+ -+/** -+ * Calculates ws hardware is using from register values -+ * ws returned is in nanoseconds -+ */ -+static uint32_t noc_ws(uint64_t bw, uint32_t sat, uint32_t qos_freq) -+{ -+ if (bw && qos_freq) { -+ uint32_t bwf = bw * qos_freq; -+ uint64_t scale = 1000000000000LL * BW_SCALE * -+ SAT_SCALE * sat; -+ noc_div(&scale, bwf); -+ MSM_BUS_DBG("NOC: Calculated ws: %llu\n", scale); -+ return scale; -+ } -+ -+ return 0; -+} -+#define MAX_WS(bw, timebase) noc_ws((bw), MAX_SAT_FIELD, (timebase)) -+ -+/* Calculate bandwidth field value for requested bandwidth */ -+static uint32_t noc_bw_field(uint64_t bw, uint32_t qos_freq) -+{ -+ uint32_t bw_field = 0; -+ -+ if (bw) { -+ uint32_t rem; -+ uint64_t bw_capped = min_t(uint64_t, bw, MAX_BW(qos_freq)); -+ uint64_t bwc = bw_capped * BW_SCALE; -+ uint64_t qf = 2 * qos_freq * 1000; -+ -+ rem = noc_div(&bwc, qf); -+ bw_field = (uint32_t)min_t(uint64_t, bwc, MAX_BW_FIELD); -+ } -+ -+ MSM_BUS_DBG("NOC: bw_field: %u\n", bw_field); -+ return bw_field; -+} -+ -+static uint32_t noc_sat_field(uint64_t bw, uint32_t ws, uint32_t qos_freq) -+{ -+ uint32_t sat_field = 0, win; -+ -+ if (bw) { -+ /* Limit to max bw and scale bw to 100 KB increments */ -+ uint64_t tbw, tscale; -+ uint64_t bw_scaled = min_t(uint64_t, bw, MAX_BW(qos_freq)); -+ uint32_t rem = noc_div(&bw_scaled, 100000); -+ -+ /** -+ * Calculate saturation from windows size. -+ * WS must be at least one arb period. -+ * Saturation must not exceed max field size -+ * -+ * Bandwidth is in 100KB increments -+ * Window size is in ns -+ * qos_freq is in KHz -+ */ -+ win = max(ws, 1000000 / qos_freq); -+ tbw = bw_scaled * win * qos_freq; -+ tscale = 10000000ULL * BW_SCALE * SAT_SCALE; -+ rem = noc_div(&tbw, tscale); -+ sat_field = (uint32_t)min_t(uint64_t, tbw, MAX_SAT_FIELD); -+ } -+ -+ MSM_BUS_DBG("NOC: sat_field: %d\n", sat_field); -+ return sat_field; -+} -+ -+static void noc_set_qos_mode(void __iomem *base, uint32_t qos_off, -+ uint32_t mport, uint32_t qos_delta, uint8_t mode, -+ uint8_t perm_mode) -+{ -+ if (mode < NOC_QOS_MODE_MAX && -+ ((1 << mode) & perm_mode)) { -+ uint32_t reg_val; -+ -+ reg_val = readl_relaxed(NOC_QOS_MODEn_ADDR(base, qos_off, -+ mport, qos_delta)) & NOC_QOS_MODEn_RMSK; -+ writel_relaxed(((reg_val & (~(NOC_QOS_MODEn_MODE_BMSK))) | -+ (mode & NOC_QOS_MODEn_MODE_BMSK)), -+ NOC_QOS_MODEn_ADDR(base, qos_off, mport, qos_delta)); -+ } -+ /* Ensure qos mode is set before exiting */ -+ wmb(); -+} -+ -+static void noc_set_qos_priority(void __iomem *base, uint32_t qos_off, -+ uint32_t mport, uint32_t qos_delta, -+ struct msm_bus_noc_qos_priority *priority) -+{ -+ uint32_t reg_val, val; -+ -+ reg_val = readl_relaxed(NOC_QOS_PRIORITYn_ADDR(base, qos_off, mport, -+ qos_delta)) & NOC_QOS_PRIORITYn_RMSK; -+ val = priority->p1 << NOC_QOS_PRIORITYn_P1_SHFT; -+ writel_relaxed(((reg_val & (~(NOC_QOS_PRIORITYn_P1_BMSK))) | -+ (val & NOC_QOS_PRIORITYn_P1_BMSK)), -+ NOC_QOS_PRIORITYn_ADDR(base, qos_off, mport, qos_delta)); -+ -+ reg_val = readl_relaxed(NOC_QOS_PRIORITYn_ADDR(base, qos_off, mport, -+ qos_delta)) -+ & NOC_QOS_PRIORITYn_RMSK; -+ writel_relaxed(((reg_val & (~(NOC_QOS_PRIORITYn_P0_BMSK))) | -+ (priority->p0 & NOC_QOS_PRIORITYn_P0_BMSK)), -+ NOC_QOS_PRIORITYn_ADDR(base, qos_off, mport, qos_delta)); -+ /* Ensure qos priority is set before exiting */ -+ wmb(); -+} -+ -+static void msm_bus_noc_set_qos_bw(void __iomem *base, uint32_t qos_off, -+ uint32_t qos_freq, uint32_t mport, uint32_t qos_delta, -+ uint8_t perm_mode, struct msm_bus_noc_qos_bw *qbw) -+{ -+ uint32_t reg_val, val, mode; -+ -+ if (!qos_freq) { -+ MSM_BUS_DBG("Zero QoS Freq\n"); -+ return; -+ } -+ -+ -+ /* If Limiter or Regulator modes are not supported, bw not available*/ -+ if (perm_mode & (NOC_QOS_PERM_MODE_LIMITER | -+ NOC_QOS_PERM_MODE_REGULATOR)) { -+ uint32_t bw_val = noc_bw_field(qbw->bw, qos_freq); -+ uint32_t sat_val = noc_sat_field(qbw->bw, qbw->ws, -+ qos_freq); -+ -+ MSM_BUS_DBG("NOC: BW: perm_mode: %d bw_val: %d, sat_val: %d\n", -+ perm_mode, bw_val, sat_val); -+ /* -+ * If in Limiter/Regulator mode, first go to fixed mode. -+ * Clear QoS accumulator -+ **/ -+ mode = readl_relaxed(NOC_QOS_MODEn_ADDR(base, qos_off, -+ mport, qos_delta)) & NOC_QOS_MODEn_MODE_BMSK; -+ if (mode == NOC_QOS_MODE_REGULATOR || mode == -+ NOC_QOS_MODE_LIMITER) { -+ reg_val = readl_relaxed(NOC_QOS_MODEn_ADDR( -+ base, qos_off, mport, qos_delta)); -+ val = NOC_QOS_MODE_FIXED; -+ writel_relaxed((reg_val & (~(NOC_QOS_MODEn_MODE_BMSK))) -+ | (val & NOC_QOS_MODEn_MODE_BMSK), -+ NOC_QOS_MODEn_ADDR(base, qos_off, mport, -+ qos_delta)); -+ } -+ -+ reg_val = readl_relaxed(NOC_QOS_BWn_ADDR(base, qos_off, mport, -+ qos_delta)); -+ val = bw_val << NOC_QOS_BWn_BW_SHFT; -+ writel_relaxed(((reg_val & (~(NOC_QOS_BWn_BW_BMSK))) | -+ (val & NOC_QOS_BWn_BW_BMSK)), -+ NOC_QOS_BWn_ADDR(base, qos_off, mport, qos_delta)); -+ -+ MSM_BUS_DBG("NOC: BW: Wrote value: 0x%x\n", ((reg_val & -+ (~NOC_QOS_BWn_BW_BMSK)) | (val & -+ NOC_QOS_BWn_BW_BMSK))); -+ -+ reg_val = readl_relaxed(NOC_QOS_SATn_ADDR(base, qos_off, -+ mport, qos_delta)); -+ val = sat_val << NOC_QOS_SATn_SAT_SHFT; -+ writel_relaxed(((reg_val & (~(NOC_QOS_SATn_SAT_BMSK))) | -+ (val & NOC_QOS_SATn_SAT_BMSK)), -+ NOC_QOS_SATn_ADDR(base, qos_off, mport, qos_delta)); -+ -+ MSM_BUS_DBG("NOC: SAT: Wrote value: 0x%x\n", ((reg_val & -+ (~NOC_QOS_SATn_SAT_BMSK)) | (val & -+ NOC_QOS_SATn_SAT_BMSK))); -+ -+ /* Set mode back to what it was initially */ -+ reg_val = readl_relaxed(NOC_QOS_MODEn_ADDR(base, qos_off, -+ mport, qos_delta)); -+ writel_relaxed((reg_val & (~(NOC_QOS_MODEn_MODE_BMSK))) -+ | (mode & NOC_QOS_MODEn_MODE_BMSK), -+ NOC_QOS_MODEn_ADDR(base, qos_off, mport, qos_delta)); -+ /* Ensure that all writes for bandwidth registers have -+ * completed before returning -+ */ -+ wmb(); -+ } -+} -+ -+uint8_t msm_bus_noc_get_qos_mode(void __iomem *base, uint32_t qos_off, -+ uint32_t mport, uint32_t qos_delta, uint32_t mode, uint32_t perm_mode) -+{ -+ if (NOC_QOS_MODES_ALL_PERM == perm_mode) -+ return readl_relaxed(NOC_QOS_MODEn_ADDR(base, qos_off, -+ mport, qos_delta)) & NOC_QOS_MODEn_MODE_BMSK; -+ else -+ return 31 - __CLZ(mode & -+ NOC_QOS_MODES_ALL_PERM); -+} -+ -+void msm_bus_noc_get_qos_priority(void __iomem *base, uint32_t qos_off, -+ uint32_t mport, uint32_t qos_delta, -+ struct msm_bus_noc_qos_priority *priority) -+{ -+ priority->p1 = (readl_relaxed(NOC_QOS_PRIORITYn_ADDR(base, qos_off, -+ mport, qos_delta)) & NOC_QOS_PRIORITYn_P1_BMSK) >> -+ NOC_QOS_PRIORITYn_P1_SHFT; -+ -+ priority->p0 = (readl_relaxed(NOC_QOS_PRIORITYn_ADDR(base, qos_off, -+ mport, qos_delta)) & NOC_QOS_PRIORITYn_P0_BMSK) >> -+ NOC_QOS_PRIORITYn_P0_SHFT; -+} -+ -+void msm_bus_noc_get_qos_bw(void __iomem *base, uint32_t qos_off, -+ uint32_t qos_freq, -+ uint32_t mport, uint32_t qos_delta, uint8_t perm_mode, -+ struct msm_bus_noc_qos_bw *qbw) -+{ -+ if (perm_mode & (NOC_QOS_PERM_MODE_LIMITER | -+ NOC_QOS_PERM_MODE_REGULATOR)) { -+ uint32_t bw_val = readl_relaxed(NOC_QOS_BWn_ADDR( -+ base, qos_off, mport, qos_delta)) & NOC_QOS_BWn_BW_BMSK; -+ uint32_t sat = readl_relaxed(NOC_QOS_SATn_ADDR( -+ base, qos_off, mport, qos_delta)) -+ & NOC_QOS_SATn_SAT_BMSK; -+ -+ qbw->bw = noc_bw(bw_val, qos_freq); -+ qbw->ws = noc_ws(qbw->bw, sat, qos_freq); -+ } else { -+ qbw->bw = 0; -+ qbw->ws = 0; -+ } -+} -+ -+static int msm_bus_noc_mas_init(struct msm_bus_noc_info *ninfo, -+ struct msm_bus_inode_info *info) -+{ -+ int i; -+ struct msm_bus_noc_qos_priority *prio; -+ prio = kzalloc(sizeof(struct msm_bus_noc_qos_priority), -+ GFP_KERNEL); -+ if (!prio) { -+ MSM_BUS_WARN("Couldn't alloc prio data for node: %d\n", -+ info->node_info->id); -+ return -ENOMEM; -+ } -+ -+ prio->read_prio = info->node_info->prio_rd; -+ prio->write_prio = info->node_info->prio_wr; -+ prio->p1 = info->node_info->prio1; -+ prio->p0 = info->node_info->prio0; -+ info->hw_data = (void *)prio; -+ -+ if (!info->node_info->qport) { -+ MSM_BUS_DBG("No QoS Ports to init\n"); -+ return 0; -+ } -+ -+ for (i = 0; i < info->node_info->num_mports; i++) { -+ if (info->node_info->mode != NOC_QOS_MODE_BYPASS) { -+ noc_set_qos_priority(ninfo->base, ninfo->qos_baseoffset, -+ info->node_info->qport[i], ninfo->qos_delta, -+ prio); -+ -+ if (info->node_info->mode != NOC_QOS_MODE_FIXED) { -+ struct msm_bus_noc_qos_bw qbw; -+ qbw.ws = info->node_info->ws; -+ qbw.bw = 0; -+ msm_bus_noc_set_qos_bw(ninfo->base, -+ ninfo->qos_baseoffset, -+ ninfo->qos_freq, info->node_info-> -+ qport[i], ninfo->qos_delta, -+ info->node_info->perm_mode, -+ &qbw); -+ } -+ } -+ -+ noc_set_qos_mode(ninfo->base, ninfo->qos_baseoffset, -+ info->node_info->qport[i], ninfo->qos_delta, -+ info->node_info->mode, -+ info->node_info->perm_mode); -+ } -+ -+ return 0; -+} -+ -+static void msm_bus_noc_node_init(void *hw_data, -+ struct msm_bus_inode_info *info) -+{ -+ struct msm_bus_noc_info *ninfo = -+ (struct msm_bus_noc_info *)hw_data; -+ -+ if (!IS_SLAVE(info->node_info->priv_id)) -+ if (info->node_info->hw_sel != MSM_BUS_RPM) -+ msm_bus_noc_mas_init(ninfo, info); -+} -+ -+static int msm_bus_noc_allocate_commit_data(struct msm_bus_fabric_registration -+ *fab_pdata, void **cdata, int ctx) -+{ -+ struct msm_bus_noc_commit **cd = (struct msm_bus_noc_commit **)cdata; -+ struct msm_bus_noc_info *ninfo = -+ (struct msm_bus_noc_info *)fab_pdata->hw_data; -+ -+ *cd = kzalloc(sizeof(struct msm_bus_noc_commit), GFP_KERNEL); -+ if (!*cd) { -+ MSM_BUS_DBG("Couldn't alloc mem for cdata\n"); -+ return -ENOMEM; -+ } -+ -+ (*cd)->mas = ninfo->cdata[ctx].mas; -+ (*cd)->slv = ninfo->cdata[ctx].slv; -+ -+ return 0; -+} -+ -+static void *msm_bus_noc_allocate_noc_data(struct platform_device *pdev, -+ struct msm_bus_fabric_registration *fab_pdata) -+{ -+ struct resource *noc_mem; -+ struct resource *noc_io; -+ struct msm_bus_noc_info *ninfo; -+ int i; -+ -+ ninfo = kzalloc(sizeof(struct msm_bus_noc_info), GFP_KERNEL); -+ if (!ninfo) { -+ MSM_BUS_DBG("Couldn't alloc mem for noc info\n"); -+ return NULL; -+ } -+ -+ ninfo->nmasters = fab_pdata->nmasters; -+ ninfo->nqos_masters = fab_pdata->nmasters; -+ ninfo->nslaves = fab_pdata->nslaves; -+ ninfo->qos_freq = fab_pdata->qos_freq; -+ -+ if (!fab_pdata->qos_baseoffset) -+ ninfo->qos_baseoffset = QOS_DEFAULT_BASEOFFSET; -+ else -+ ninfo->qos_baseoffset = fab_pdata->qos_baseoffset; -+ -+ if (!fab_pdata->qos_delta) -+ ninfo->qos_delta = QOS_DEFAULT_DELTA; -+ else -+ ninfo->qos_delta = fab_pdata->qos_delta; -+ -+ ninfo->mas_modes = kzalloc(sizeof(uint32_t) * fab_pdata->nmasters, -+ GFP_KERNEL); -+ if (!ninfo->mas_modes) { -+ MSM_BUS_DBG("Couldn't alloc mem for noc master-modes\n"); -+ kfree(ninfo); -+ return NULL; -+ } -+ -+ for (i = 0; i < NUM_CTX; i++) { -+ ninfo->cdata[i].mas = kzalloc(sizeof(struct -+ msm_bus_node_hw_info) * fab_pdata->nmasters * 2, -+ GFP_KERNEL); -+ if (!ninfo->cdata[i].mas) { -+ MSM_BUS_DBG("Couldn't alloc mem for noc master-bw\n"); -+ kfree(ninfo->mas_modes); -+ kfree(ninfo); -+ return NULL; -+ } -+ -+ ninfo->cdata[i].slv = kzalloc(sizeof(struct -+ msm_bus_node_hw_info) * fab_pdata->nslaves * 2, -+ GFP_KERNEL); -+ if (!ninfo->cdata[i].slv) { -+ MSM_BUS_DBG("Couldn't alloc mem for noc master-bw\n"); -+ kfree(ninfo->cdata[i].mas); -+ goto err; -+ } -+ } -+ -+ /* If it's a virtual fabric, don't get memory info */ -+ if (fab_pdata->virt) -+ goto skip_mem; -+ -+ noc_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!noc_mem && !fab_pdata->virt) { -+ MSM_BUS_ERR("Cannot get NoC Base address\n"); -+ goto err; -+ } -+ -+ noc_io = request_mem_region(noc_mem->start, -+ resource_size(noc_mem), pdev->name); -+ if (!noc_io) { -+ MSM_BUS_ERR("NoC memory unavailable\n"); -+ goto err; -+ } -+ -+ ninfo->base = ioremap(noc_mem->start, resource_size(noc_mem)); -+ if (!ninfo->base) { -+ MSM_BUS_ERR("IOremap failed for NoC!\n"); -+ release_mem_region(noc_mem->start, resource_size(noc_mem)); -+ goto err; -+ } -+ -+skip_mem: -+ fab_pdata->hw_data = (void *)ninfo; -+ return (void *)ninfo; -+ -+err: -+ kfree(ninfo->mas_modes); -+ kfree(ninfo); -+ return NULL; -+} -+ -+static void free_commit_data(void *cdata) -+{ -+ struct msm_bus_noc_commit *cd = (struct msm_bus_noc_commit *)cdata; -+ -+ kfree(cd->mas); -+ kfree(cd->slv); -+ kfree(cd); -+} -+ -+static bool msm_bus_noc_update_bw_reg(int mode) -+{ -+ bool ret = false; -+ -+ if ((mode == NOC_QOS_MODE_LIMITER) || -+ (mode == NOC_QOS_MODE_REGULATOR)) -+ ret = true; -+ -+ return ret; -+} -+ -+static void msm_bus_noc_update_bw(struct msm_bus_inode_info *hop, -+ struct msm_bus_inode_info *info, -+ struct msm_bus_fabric_registration *fab_pdata, -+ void *sel_cdata, int *master_tiers, -+ int64_t add_bw) -+{ -+ struct msm_bus_noc_info *ninfo; -+ struct msm_bus_noc_qos_bw qos_bw; -+ int i, ports; -+ int64_t bw; -+ struct msm_bus_noc_commit *sel_cd = -+ (struct msm_bus_noc_commit *)sel_cdata; -+ -+ ninfo = (struct msm_bus_noc_info *)fab_pdata->hw_data; -+ if (!ninfo->qos_freq) { -+ MSM_BUS_DBG("NOC: No qos frequency to update bw\n"); -+ return; -+ } -+ -+ if (info->node_info->num_mports == 0) { -+ MSM_BUS_DBG("NOC: Skip Master BW\n"); -+ goto skip_mas_bw; -+ } -+ -+ ports = info->node_info->num_mports; -+ bw = INTERLEAVED_BW(fab_pdata, add_bw, ports); -+ -+ MSM_BUS_DBG("NOC: Update bw for: %d: %lld\n", -+ info->node_info->priv_id, add_bw); -+ for (i = 0; i < ports; i++) { -+ sel_cd->mas[info->node_info->masterp[i]].bw += bw; -+ sel_cd->mas[info->node_info->masterp[i]].hw_id = -+ info->node_info->mas_hw_id; -+ MSM_BUS_DBG("NOC: Update mas_bw: ID: %d, BW: %llu ports:%d\n", -+ info->node_info->priv_id, -+ sel_cd->mas[info->node_info->masterp[i]].bw, -+ ports); -+ /* Check if info is a shared master. -+ * If it is, mark it dirty -+ * If it isn't, then set QOS Bandwidth -+ **/ -+ if (info->node_info->hw_sel == MSM_BUS_RPM) -+ sel_cd->mas[info->node_info->masterp[i]].dirty = 1; -+ else { -+ if (!info->node_info->qport) { -+ MSM_BUS_DBG("No qos ports to update!\n"); -+ break; -+ } -+ -+ if (!(info->node_info->mode == NOC_QOS_MODE_REGULATOR) -+ || (info->node_info->mode == -+ NOC_QOS_MODE_LIMITER)) { -+ MSM_BUS_DBG("Skip QoS reg programming\n"); -+ break; -+ } -+ qos_bw.bw = sel_cd->mas[info->node_info->masterp[i]]. -+ bw; -+ qos_bw.ws = info->node_info->ws; -+ msm_bus_noc_set_qos_bw(ninfo->base, -+ ninfo->qos_baseoffset, -+ ninfo->qos_freq, -+ info->node_info->qport[i], ninfo->qos_delta, -+ info->node_info->perm_mode, &qos_bw); -+ MSM_BUS_DBG("NOC: QoS: Update mas_bw: ws: %u\n", -+ qos_bw.ws); -+ } -+ } -+ -+skip_mas_bw: -+ ports = hop->node_info->num_sports; -+ for (i = 0; i < ports; i++) { -+ sel_cd->slv[hop->node_info->slavep[i]].bw += add_bw; -+ sel_cd->slv[hop->node_info->slavep[i]].hw_id = -+ hop->node_info->slv_hw_id; -+ MSM_BUS_DBG("NOC: Update slave_bw for ID: %d -> %llu\n", -+ hop->node_info->priv_id, -+ sel_cd->slv[hop->node_info->slavep[i]].bw); -+ MSM_BUS_DBG("NOC: Update slave_bw for hw_id: %d, index: %d\n", -+ hop->node_info->slv_hw_id, hop->node_info->slavep[i]); -+ /* Check if hop is a shared slave. -+ * If it is, mark it dirty -+ * If it isn't, then nothing to be done as the -+ * slaves are in bypass mode. -+ **/ -+ if (hop->node_info->hw_sel == MSM_BUS_RPM) -+ sel_cd->slv[hop->node_info->slavep[i]].dirty = 1; -+ } -+} -+ -+static int msm_bus_noc_commit(struct msm_bus_fabric_registration -+ *fab_pdata, void *hw_data, void **cdata) -+{ -+ MSM_BUS_DBG("\nReached NOC Commit\n"); -+ msm_bus_remote_hw_commit(fab_pdata, hw_data, cdata); -+ return 0; -+} -+ -+static int msm_bus_noc_port_halt(uint32_t haltid, uint8_t mport) -+{ -+ return 0; -+} -+ -+static int msm_bus_noc_port_unhalt(uint32_t haltid, uint8_t mport) -+{ -+ return 0; -+} -+ -+static int msm_bus_noc_qos_init(struct msm_bus_node_device_type *info, -+ void __iomem *qos_base, -+ uint32_t qos_off, uint32_t qos_delta, -+ uint32_t qos_freq) -+{ -+ struct msm_bus_noc_qos_priority prio; -+ int ret = 0; -+ int i; -+ -+ prio.p1 = info->node_info->qos_params.prio1; -+ prio.p0 = info->node_info->qos_params.prio0; -+ -+ if (!info->node_info->qport) { -+ MSM_BUS_DBG("No QoS Ports to init\n"); -+ ret = 0; -+ goto err_qos_init; -+ } -+ -+ for (i = 0; i < info->node_info->num_qports; i++) { -+ if (info->node_info->qos_params.mode != NOC_QOS_MODE_BYPASS) { -+ noc_set_qos_priority(qos_base, qos_off, -+ info->node_info->qport[i], qos_delta, -+ &prio); -+ -+ if (info->node_info->qos_params.mode != -+ NOC_QOS_MODE_FIXED) { -+ struct msm_bus_noc_qos_bw qbw; -+ qbw.ws = info->node_info->qos_params.ws; -+ qbw.bw = 0; -+ msm_bus_noc_set_qos_bw(qos_base, qos_off, -+ qos_freq, -+ info->node_info->qport[i], -+ qos_delta, -+ info->node_info->qos_params.mode, -+ &qbw); -+ } -+ } -+ -+ noc_set_qos_mode(qos_base, qos_off, info->node_info->qport[i], -+ qos_delta, info->node_info->qos_params.mode, -+ (1 << info->node_info->qos_params.mode)); -+ } -+err_qos_init: -+ return ret; -+} -+ -+static int msm_bus_noc_set_bw(struct msm_bus_node_device_type *dev, -+ void __iomem *qos_base, -+ uint32_t qos_off, uint32_t qos_delta, -+ uint32_t qos_freq) -+{ -+ int ret = 0; -+ uint64_t bw = 0; -+ int i; -+ struct msm_bus_node_info_type *info = dev->node_info; -+ -+ if (info && info->num_qports && -+ ((info->qos_params.mode == NOC_QOS_MODE_REGULATOR) || -+ (info->qos_params.mode == -+ NOC_QOS_MODE_LIMITER))) { -+ struct msm_bus_noc_qos_bw qos_bw; -+ -+ bw = msm_bus_div64(info->num_qports, -+ dev->node_ab.ab[DUAL_CTX]); -+ -+ for (i = 0; i < info->num_qports; i++) { -+ if (!info->qport) { -+ MSM_BUS_DBG("No qos ports to update!\n"); -+ break; -+ } -+ -+ qos_bw.bw = bw; -+ qos_bw.ws = info->qos_params.ws; -+ msm_bus_noc_set_qos_bw(qos_base, qos_off, qos_freq, -+ info->qport[i], qos_delta, -+ info->qos_params.mode, &qos_bw); -+ MSM_BUS_DBG("NOC: QoS: Update mas_bw: ws: %u\n", -+ qos_bw.ws); -+ } -+ } -+ return ret; -+} -+int msm_bus_noc_hw_init(struct msm_bus_fabric_registration *pdata, -+ struct msm_bus_hw_algorithm *hw_algo) -+{ -+ /* Set interleaving to true by default */ -+ pdata->il_flag = true; -+ hw_algo->allocate_commit_data = msm_bus_noc_allocate_commit_data; -+ hw_algo->allocate_hw_data = msm_bus_noc_allocate_noc_data; -+ hw_algo->node_init = msm_bus_noc_node_init; -+ hw_algo->free_commit_data = free_commit_data; -+ hw_algo->update_bw = msm_bus_noc_update_bw; -+ hw_algo->commit = msm_bus_noc_commit; -+ hw_algo->port_halt = msm_bus_noc_port_halt; -+ hw_algo->port_unhalt = msm_bus_noc_port_unhalt; -+ hw_algo->update_bw_reg = msm_bus_noc_update_bw_reg; -+ hw_algo->config_master = NULL; -+ hw_algo->config_limiter = NULL; -+ -+ return 0; -+} -+ -+int msm_bus_noc_set_ops(struct msm_bus_node_device_type *bus_dev) -+{ -+ if (!bus_dev) -+ return -ENODEV; -+ else { -+ bus_dev->fabdev->noc_ops.qos_init = msm_bus_noc_qos_init; -+ bus_dev->fabdev->noc_ops.set_bw = msm_bus_noc_set_bw; -+ bus_dev->fabdev->noc_ops.limit_mport = NULL; -+ bus_dev->fabdev->noc_ops.update_bw_reg = -+ msm_bus_noc_update_bw_reg; -+ } -+ return 0; -+} -+EXPORT_SYMBOL(msm_bus_noc_set_ops); ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_noc.h -@@ -0,0 +1,76 @@ -+/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef _ARCH_ARM_MACH_MSM_BUS_BIMC_H -+#define _ARCH_ARM_MACH_MSM_BUS_BIMC_H -+ -+enum msm_bus_noc_qos_mode_type { -+ NOC_QOS_MODE_FIXED = 0, -+ NOC_QOS_MODE_LIMITER, -+ NOC_QOS_MODE_BYPASS, -+ NOC_QOS_MODE_REGULATOR, -+ NOC_QOS_MODE_MAX, -+}; -+ -+enum msm_bus_noc_qos_mode_perm { -+ NOC_QOS_PERM_MODE_FIXED = (1 << NOC_QOS_MODE_FIXED), -+ NOC_QOS_PERM_MODE_LIMITER = (1 << NOC_QOS_MODE_LIMITER), -+ NOC_QOS_PERM_MODE_BYPASS = (1 << NOC_QOS_MODE_BYPASS), -+ NOC_QOS_PERM_MODE_REGULATOR = (1 << NOC_QOS_MODE_REGULATOR), -+}; -+ -+#define NOC_QOS_MODES_ALL_PERM (NOC_QOS_PERM_MODE_FIXED | \ -+ NOC_QOS_PERM_MODE_LIMITER | NOC_QOS_PERM_MODE_BYPASS | \ -+ NOC_QOS_PERM_MODE_REGULATOR) -+ -+struct msm_bus_noc_commit { -+ struct msm_bus_node_hw_info *mas; -+ struct msm_bus_node_hw_info *slv; -+}; -+ -+struct msm_bus_noc_info { -+ void __iomem *base; -+ uint32_t base_addr; -+ uint32_t nmasters; -+ uint32_t nqos_masters; -+ uint32_t nslaves; -+ uint32_t qos_freq; /* QOS Clock in KHz */ -+ uint32_t qos_baseoffset; -+ uint32_t qos_delta; -+ uint32_t *mas_modes; -+ struct msm_bus_noc_commit cdata[NUM_CTX]; -+}; -+ -+struct msm_bus_noc_qos_priority { -+ uint32_t high_prio; -+ uint32_t low_prio; -+ uint32_t read_prio; -+ uint32_t write_prio; -+ uint32_t p1; -+ uint32_t p0; -+}; -+ -+struct msm_bus_noc_qos_bw { -+ uint64_t bw; /* Bandwidth in bytes per second */ -+ uint32_t ws; /* Window size in nano seconds */ -+}; -+ -+void msm_bus_noc_init(struct msm_bus_noc_info *ninfo); -+uint8_t msm_bus_noc_get_qos_mode(void __iomem *base, uint32_t qos_off, -+ uint32_t mport, uint32_t qos_delta, uint32_t mode, uint32_t perm_mode); -+void msm_bus_noc_get_qos_priority(void __iomem *base, uint32_t qos_off, -+ uint32_t mport, uint32_t qos_delta, -+ struct msm_bus_noc_qos_priority *qprio); -+void msm_bus_noc_get_qos_bw(void __iomem *base, uint32_t qos_off, -+ uint32_t qos_freq, uint32_t mport, uint32_t qos_delta, -+ uint8_t perm_mode, struct msm_bus_noc_qos_bw *qbw); -+#endif /*_ARCH_ARM_MACH_MSM_BUS_NOC_H */ ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_of.c -@@ -0,0 +1,705 @@ -+/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#define pr_fmt(fmt) "AXI: %s(): " fmt, __func__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include "msm-bus.h" -+#include "msm-bus-board.h" -+#include "msm_bus_core.h" -+ -+static const char * const hw_sel_name[] = {"RPM", "NoC", "BIMC", NULL}; -+static const char * const mode_sel_name[] = {"Fixed", "Limiter", "Bypass", -+ "Regulator", NULL}; -+ -+static int get_num(const char *const str[], const char *name) -+{ -+ int i = 0; -+ -+ do { -+ if (!strcmp(name, str[i])) -+ return i; -+ -+ i++; -+ } while (str[i] != NULL); -+ -+ pr_err("Error: string %s not found\n", name); -+ return -EINVAL; -+} -+ -+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_MSM_BUS_SCALING) -+static struct msm_bus_scale_pdata *get_pdata(struct platform_device *pdev, -+ struct device_node *of_node) -+{ -+ struct msm_bus_scale_pdata *pdata = NULL; -+ struct msm_bus_paths *usecase = NULL; -+ int i = 0, j, ret, num_usecases = 0, num_paths, len; -+ const uint32_t *vec_arr = NULL; -+ bool mem_err = false; -+ -+ if (!pdev) { -+ pr_err("Error: Null Platform device\n"); -+ return NULL; -+ } -+ -+ pdata = devm_kzalloc(&pdev->dev, sizeof(struct msm_bus_scale_pdata), -+ GFP_KERNEL); -+ if (!pdata) { -+ pr_err("Error: Memory allocation for pdata failed\n"); -+ mem_err = true; -+ goto err; -+ } -+ -+ ret = of_property_read_string(of_node, "qcom,msm-bus,name", -+ &pdata->name); -+ if (ret) { -+ pr_err("Error: Client name not found\n"); -+ goto err; -+ } -+ -+ ret = of_property_read_u32(of_node, "qcom,msm-bus,num-cases", -+ &num_usecases); -+ if (ret) { -+ pr_err("Error: num-usecases not found\n"); -+ goto err; -+ } -+ -+ pdata->num_usecases = num_usecases; -+ -+ if (of_property_read_bool(of_node, "qcom,msm-bus,active-only")) -+ pdata->active_only = 1; -+ else { -+ pr_debug("active_only flag absent.\n"); -+ pr_debug("Using dual context by default\n"); -+ } -+ -+ usecase = devm_kzalloc(&pdev->dev, (sizeof(struct msm_bus_paths) * -+ pdata->num_usecases), GFP_KERNEL); -+ if (!usecase) { -+ pr_err("Error: Memory allocation for paths failed\n"); -+ mem_err = true; -+ goto err; -+ } -+ -+ ret = of_property_read_u32(of_node, "qcom,msm-bus,num-paths", -+ &num_paths); -+ if (ret) { -+ pr_err("Error: num_paths not found\n"); -+ goto err; -+ } -+ -+ vec_arr = of_get_property(of_node, "qcom,msm-bus,vectors-KBps", &len); -+ if (vec_arr == NULL) { -+ pr_err("Error: Vector array not found\n"); -+ goto err; -+ } -+ -+ if (len != num_usecases * num_paths * sizeof(uint32_t) * 4) { -+ pr_err("Error: Length-error on getting vectors\n"); -+ goto err; -+ } -+ -+ for (i = 0; i < num_usecases; i++) { -+ usecase[i].num_paths = num_paths; -+ usecase[i].vectors = devm_kzalloc(&pdev->dev, num_paths * -+ sizeof(struct msm_bus_vectors), GFP_KERNEL); -+ if (!usecase[i].vectors) { -+ mem_err = true; -+ pr_err("Error: Mem alloc failure in vectors\n"); -+ goto err; -+ } -+ -+ for (j = 0; j < num_paths; j++) { -+ int index = ((i * num_paths) + j) * 4; -+ usecase[i].vectors[j].src = be32_to_cpu(vec_arr[index]); -+ usecase[i].vectors[j].dst = -+ be32_to_cpu(vec_arr[index + 1]); -+ usecase[i].vectors[j].ab = (uint64_t) -+ KBTOB(be32_to_cpu(vec_arr[index + 2])); -+ usecase[i].vectors[j].ib = (uint64_t) -+ KBTOB(be32_to_cpu(vec_arr[index + 3])); -+ } -+ } -+ -+ pdata->usecase = usecase; -+ return pdata; -+err: -+ if (mem_err) { -+ for (; i > 0; i--) -+ kfree(usecase[i-1].vectors); -+ -+ kfree(usecase); -+ kfree(pdata); -+ } -+ -+ return NULL; -+} -+ -+/** -+ * msm_bus_cl_get_pdata() - Generate bus client data from device tree -+ * provided by clients. -+ * -+ * of_node: Device tree node to extract information from -+ * -+ * The function returns a valid pointer to the allocated bus-scale-pdata -+ * if the vectors were correctly read from the client's device node. -+ * Any error in reading or parsing the device node will return NULL -+ * to the caller. -+ */ -+struct msm_bus_scale_pdata *msm_bus_cl_get_pdata(struct platform_device *pdev) -+{ -+ struct device_node *of_node; -+ struct msm_bus_scale_pdata *pdata = NULL; -+ -+ if (!pdev) { -+ pr_err("Error: Null Platform device\n"); -+ return NULL; -+ } -+ -+ of_node = pdev->dev.of_node; -+ pdata = get_pdata(pdev, of_node); -+ if (!pdata) { -+ pr_err("client has to provide missing entry for successful registration\n"); -+ return NULL; -+ } -+ -+ return pdata; -+} -+EXPORT_SYMBOL(msm_bus_cl_get_pdata); -+ -+/** -+ * msm_bus_cl_pdata_from_node() - Generate bus client data from device tree -+ * node provided by clients. This function should be used when a client -+ * driver needs to register multiple bus-clients from a single device-tree -+ * node associated with the platform-device. -+ * -+ * of_node: The subnode containing information about the bus scaling -+ * data -+ * -+ * pdev: Platform device associated with the device-tree node -+ * -+ * The function returns a valid pointer to the allocated bus-scale-pdata -+ * if the vectors were correctly read from the client's device node. -+ * Any error in reading or parsing the device node will return NULL -+ * to the caller. -+ */ -+struct msm_bus_scale_pdata *msm_bus_pdata_from_node( -+ struct platform_device *pdev, struct device_node *of_node) -+{ -+ struct msm_bus_scale_pdata *pdata = NULL; -+ -+ if (!pdev) { -+ pr_err("Error: Null Platform device\n"); -+ return NULL; -+ } -+ -+ if (!of_node) { -+ pr_err("Error: Null of_node passed to bus driver\n"); -+ return NULL; -+ } -+ -+ pdata = get_pdata(pdev, of_node); -+ if (!pdata) { -+ pr_err("client has to provide missing entry for successful registration\n"); -+ return NULL; -+ } -+ -+ return pdata; -+} -+EXPORT_SYMBOL(msm_bus_pdata_from_node); -+ -+/** -+ * msm_bus_cl_clear_pdata() - Clear pdata allocated from device-tree -+ * of_node: Device tree node to extract information from -+ */ -+void msm_bus_cl_clear_pdata(struct msm_bus_scale_pdata *pdata) -+{ -+ int i; -+ -+ for (i = 0; i < pdata->num_usecases; i++) -+ kfree(pdata->usecase[i].vectors); -+ -+ kfree(pdata->usecase); -+ kfree(pdata); -+} -+EXPORT_SYMBOL(msm_bus_cl_clear_pdata); -+#endif -+ -+static int *get_arr(struct platform_device *pdev, -+ const struct device_node *node, const char *prop, -+ int *nports) -+{ -+ int size = 0, ret; -+ int *arr = NULL; -+ -+ if (of_get_property(node, prop, &size)) { -+ *nports = size / sizeof(int); -+ } else { -+ pr_debug("Property %s not available\n", prop); -+ *nports = 0; -+ return NULL; -+ } -+ -+ if (!size) { -+ *nports = 0; -+ return NULL; -+ } -+ -+ arr = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); -+ if (ZERO_OR_NULL_PTR(arr)) { -+ pr_err("Error: Failed to alloc mem for %s\n", prop); -+ return NULL; -+ } -+ -+ ret = of_property_read_u32_array(node, prop, (u32 *)arr, *nports); -+ if (ret) { -+ pr_err("Error in reading property: %s\n", prop); -+ goto err; -+ } -+ -+ return arr; -+err: -+ devm_kfree(&pdev->dev, arr); -+ return NULL; -+} -+ -+static u64 *get_th_params(struct platform_device *pdev, -+ const struct device_node *node, const char *prop, -+ int *nports) -+{ -+ int size = 0, ret; -+ u64 *ret_arr = NULL; -+ int *arr = NULL; -+ int i; -+ -+ if (of_get_property(node, prop, &size)) { -+ *nports = size / sizeof(int); -+ } else { -+ pr_debug("Property %s not available\n", prop); -+ *nports = 0; -+ return NULL; -+ } -+ -+ if (!size) { -+ *nports = 0; -+ return NULL; -+ } -+ -+ ret_arr = devm_kzalloc(&pdev->dev, (*nports * sizeof(u64)), -+ GFP_KERNEL); -+ if (ZERO_OR_NULL_PTR(ret_arr)) { -+ pr_err("Error: Failed to alloc mem for ret arr %s\n", prop); -+ return NULL; -+ } -+ -+ arr = kzalloc(size, GFP_KERNEL); -+ if ((ZERO_OR_NULL_PTR(arr))) { -+ pr_err("Error: Failed to alloc temp mem for %s\n", prop); -+ return NULL; -+ } -+ -+ ret = of_property_read_u32_array(node, prop, (u32 *)arr, *nports); -+ if (ret) { -+ pr_err("Error in reading property: %s\n", prop); -+ goto err; -+ } -+ -+ for (i = 0; i < *nports; i++) -+ ret_arr[i] = (uint64_t)KBTOB(arr[i]); -+ -+ MSM_BUS_DBG("%s: num entries %d prop %s", __func__, *nports, prop); -+ -+ for (i = 0; i < *nports; i++) -+ MSM_BUS_DBG("Th %d val %llu", i, ret_arr[i]); -+ -+ kfree(arr); -+ return ret_arr; -+err: -+ kfree(arr); -+ devm_kfree(&pdev->dev, ret_arr); -+ return NULL; -+} -+ -+static struct msm_bus_node_info *get_nodes(struct device_node *of_node, -+ struct platform_device *pdev, -+ struct msm_bus_fabric_registration *pdata) -+{ -+ struct msm_bus_node_info *info; -+ struct device_node *child_node = NULL; -+ int i = 0, ret; -+ int num_bw = 0; -+ u32 temp; -+ -+ for_each_child_of_node(of_node, child_node) { -+ i++; -+ } -+ -+ pdata->len = i; -+ info = (struct msm_bus_node_info *) -+ devm_kzalloc(&pdev->dev, sizeof(struct msm_bus_node_info) * -+ pdata->len, GFP_KERNEL); -+ if (ZERO_OR_NULL_PTR(info)) { -+ pr_err("Failed to alloc memory for nodes: %d\n", pdata->len); -+ goto err; -+ } -+ -+ i = 0; -+ child_node = NULL; -+ for_each_child_of_node(of_node, child_node) { -+ const char *sel_str; -+ -+ ret = of_property_read_string(child_node, "label", -+ &info[i].name); -+ if (ret) -+ pr_err("Error reading node label\n"); -+ -+ ret = of_property_read_u32(child_node, "cell-id", &info[i].id); -+ if (ret) { -+ pr_err("Error reading node id\n"); -+ goto err; -+ } -+ -+ if (of_property_read_bool(child_node, "qcom,gateway")) -+ info[i].gateway = 1; -+ -+ of_property_read_u32(child_node, "qcom,mas-hw-id", -+ &info[i].mas_hw_id); -+ -+ of_property_read_u32(child_node, "qcom,slv-hw-id", -+ &info[i].slv_hw_id); -+ info[i].masterp = get_arr(pdev, child_node, -+ "qcom,masterp", &info[i].num_mports); -+ /* No need to store number of qports */ -+ info[i].qport = get_arr(pdev, child_node, -+ "qcom,qport", &ret); -+ pdata->nmasters += info[i].num_mports; -+ -+ -+ info[i].slavep = get_arr(pdev, child_node, -+ "qcom,slavep", &info[i].num_sports); -+ pdata->nslaves += info[i].num_sports; -+ -+ -+ info[i].tier = get_arr(pdev, child_node, -+ "qcom,tier", &info[i].num_tiers); -+ -+ if (of_property_read_bool(child_node, "qcom,ahb")) -+ info[i].ahb = 1; -+ -+ ret = of_property_read_string(child_node, "qcom,hw-sel", -+ &sel_str); -+ if (ret) -+ info[i].hw_sel = 0; -+ else { -+ ret = get_num(hw_sel_name, sel_str); -+ if (ret < 0) { -+ pr_err("Invalid hw-sel\n"); -+ goto err; -+ } -+ -+ info[i].hw_sel = ret; -+ } -+ -+ of_property_read_u32(child_node, "qcom,buswidth", -+ &info[i].buswidth); -+ of_property_read_u32(child_node, "qcom,ws", &info[i].ws); -+ -+ info[i].dual_conf = -+ of_property_read_bool(child_node, "qcom,dual-conf"); -+ -+ -+ info[i].th = get_th_params(pdev, child_node, "qcom,thresh", -+ &info[i].num_thresh); -+ -+ info[i].bimc_bw = get_th_params(pdev, child_node, -+ "qcom,bimc,bw", &num_bw); -+ -+ if (num_bw != info[i].num_thresh) { -+ pr_err("%s:num_bw %d must equal num_thresh %d", -+ __func__, num_bw, info[i].num_thresh); -+ pr_err("%s:Err setting up dual conf for %s", -+ __func__, info[i].name); -+ goto err; -+ } -+ -+ of_property_read_u32(child_node, "qcom,bimc,gp", -+ &info[i].bimc_gp); -+ of_property_read_u32(child_node, "qcom,bimc,thmp", -+ &info[i].bimc_thmp); -+ -+ ret = of_property_read_string(child_node, "qcom,mode-thresh", -+ &sel_str); -+ if (ret) -+ info[i].mode_thresh = 0; -+ else { -+ ret = get_num(mode_sel_name, sel_str); -+ if (ret < 0) { -+ pr_err("Unknown mode :%s\n", sel_str); -+ goto err; -+ } -+ -+ info[i].mode_thresh = ret; -+ MSM_BUS_DBG("AXI: THreshold mode set: %d\n", -+ info[i].mode_thresh); -+ } -+ -+ ret = of_property_read_string(child_node, "qcom,mode", -+ &sel_str); -+ -+ if (ret) -+ info[i].mode = 0; -+ else { -+ ret = get_num(mode_sel_name, sel_str); -+ if (ret < 0) { -+ pr_err("Unknown mode :%s\n", sel_str); -+ goto err; -+ } -+ -+ info[i].mode = ret; -+ } -+ -+ info[i].nr_lim = -+ of_property_read_bool(child_node, "qcom,nr-lim"); -+ -+ ret = of_property_read_u32(child_node, "qcom,ff", -+ &info[i].ff); -+ if (ret) { -+ pr_debug("fudge factor not present %d", info[i].id); -+ info[i].ff = 0; -+ } -+ -+ ret = of_property_read_u32(child_node, "qcom,floor-bw", -+ &temp); -+ if (ret) { -+ pr_debug("fabdev floor bw not present %d", info[i].id); -+ info[i].floor_bw = 0; -+ } else { -+ info[i].floor_bw = KBTOB(temp); -+ } -+ -+ info[i].rt_mas = -+ of_property_read_bool(child_node, "qcom,rt-mas"); -+ -+ ret = of_property_read_string(child_node, "qcom,perm-mode", -+ &sel_str); -+ if (ret) -+ info[i].perm_mode = 0; -+ else { -+ ret = get_num(mode_sel_name, sel_str); -+ if (ret < 0) -+ goto err; -+ -+ info[i].perm_mode = 1 << ret; -+ } -+ -+ of_property_read_u32(child_node, "qcom,prio-lvl", -+ &info[i].prio_lvl); -+ of_property_read_u32(child_node, "qcom,prio-rd", -+ &info[i].prio_rd); -+ of_property_read_u32(child_node, "qcom,prio-wr", -+ &info[i].prio_wr); -+ of_property_read_u32(child_node, "qcom,prio0", &info[i].prio0); -+ of_property_read_u32(child_node, "qcom,prio1", &info[i].prio1); -+ ret = of_property_read_string(child_node, "qcom,slaveclk-dual", -+ &info[i].slaveclk[DUAL_CTX]); -+ if (!ret) -+ pr_debug("Got slaveclk_dual: %s\n", -+ info[i].slaveclk[DUAL_CTX]); -+ else -+ info[i].slaveclk[DUAL_CTX] = NULL; -+ -+ ret = of_property_read_string(child_node, -+ "qcom,slaveclk-active", &info[i].slaveclk[ACTIVE_CTX]); -+ if (!ret) -+ pr_debug("Got slaveclk_active\n"); -+ else -+ info[i].slaveclk[ACTIVE_CTX] = NULL; -+ -+ ret = of_property_read_string(child_node, "qcom,memclk-dual", -+ &info[i].memclk[DUAL_CTX]); -+ if (!ret) -+ pr_debug("Got memclk_dual\n"); -+ else -+ info[i].memclk[DUAL_CTX] = NULL; -+ -+ ret = of_property_read_string(child_node, "qcom,memclk-active", -+ &info[i].memclk[ACTIVE_CTX]); -+ if (!ret) -+ pr_debug("Got memclk_active\n"); -+ else -+ info[i].memclk[ACTIVE_CTX] = NULL; -+ -+ ret = of_property_read_string(child_node, "qcom,iface-clk-node", -+ &info[i].iface_clk_node); -+ if (!ret) -+ pr_debug("Got iface_clk_node\n"); -+ else -+ info[i].iface_clk_node = NULL; -+ -+ pr_debug("Node name: %s\n", info[i].name); -+ of_node_put(child_node); -+ i++; -+ } -+ -+ pr_debug("Bus %d added: %d masters\n", pdata->id, pdata->nmasters); -+ pr_debug("Bus %d added: %d slaves\n", pdata->id, pdata->nslaves); -+ return info; -+err: -+ return NULL; -+} -+ -+void msm_bus_of_get_nfab(struct platform_device *pdev, -+ struct msm_bus_fabric_registration *pdata) -+{ -+ struct device_node *of_node; -+ int ret, nfab = 0; -+ -+ if (!pdev) { -+ pr_err("Error: Null platform device\n"); -+ return; -+ } -+ -+ of_node = pdev->dev.of_node; -+ ret = of_property_read_u32(of_node, "qcom,nfab", -+ &nfab); -+ if (!ret) -+ pr_debug("Fab_of: Read number of buses: %u\n", nfab); -+ -+ msm_bus_board_set_nfab(pdata, nfab); -+} -+ -+struct msm_bus_fabric_registration -+ *msm_bus_of_get_fab_data(struct platform_device *pdev) -+{ -+ struct device_node *of_node; -+ struct msm_bus_fabric_registration *pdata; -+ bool mem_err = false; -+ int ret = 0; -+ const char *sel_str; -+ u32 temp; -+ -+ if (!pdev) { -+ pr_err("Error: Null platform device\n"); -+ return NULL; -+ } -+ -+ of_node = pdev->dev.of_node; -+ pdata = devm_kzalloc(&pdev->dev, -+ sizeof(struct msm_bus_fabric_registration), GFP_KERNEL); -+ if (!pdata) { -+ pr_err("Error: Memory allocation for pdata failed\n"); -+ mem_err = true; -+ goto err; -+ } -+ -+ ret = of_property_read_string(of_node, "label", &pdata->name); -+ if (ret) { -+ pr_err("Error: label not found\n"); -+ goto err; -+ } -+ pr_debug("Fab_of: Read name: %s\n", pdata->name); -+ -+ ret = of_property_read_u32(of_node, "cell-id", -+ &pdata->id); -+ if (ret) { -+ pr_err("Error: num-usecases not found\n"); -+ goto err; -+ } -+ pr_debug("Fab_of: Read id: %u\n", pdata->id); -+ -+ if (of_property_read_bool(of_node, "qcom,ahb")) -+ pdata->ahb = 1; -+ -+ ret = of_property_read_string(of_node, "qcom,fabclk-dual", -+ &pdata->fabclk[DUAL_CTX]); -+ if (ret) { -+ pr_debug("fabclk_dual not available\n"); -+ pdata->fabclk[DUAL_CTX] = NULL; -+ } else -+ pr_debug("Fab_of: Read clk dual ctx: %s\n", -+ pdata->fabclk[DUAL_CTX]); -+ ret = of_property_read_string(of_node, "qcom,fabclk-active", -+ &pdata->fabclk[ACTIVE_CTX]); -+ if (ret) { -+ pr_debug("Error: fabclk_active not available\n"); -+ pdata->fabclk[ACTIVE_CTX] = NULL; -+ } else -+ pr_debug("Fab_of: Read clk act ctx: %s\n", -+ pdata->fabclk[ACTIVE_CTX]); -+ -+ ret = of_property_read_u32(of_node, "qcom,ntieredslaves", -+ &pdata->ntieredslaves); -+ if (ret) { -+ pr_err("Error: ntieredslaves not found\n"); -+ goto err; -+ } -+ -+ ret = of_property_read_u32(of_node, "qcom,qos-freq", &pdata->qos_freq); -+ if (ret) -+ pr_debug("qos_freq not available\n"); -+ -+ ret = of_property_read_string(of_node, "qcom,hw-sel", &sel_str); -+ if (ret) { -+ pr_err("Error: hw_sel not found\n"); -+ goto err; -+ } else { -+ ret = get_num(hw_sel_name, sel_str); -+ if (ret < 0) -+ goto err; -+ -+ pdata->hw_sel = ret; -+ } -+ -+ if (of_property_read_bool(of_node, "qcom,virt")) -+ pdata->virt = true; -+ -+ ret = of_property_read_u32(of_node, "qcom,qos-baseoffset", -+ &pdata->qos_baseoffset); -+ if (ret) -+ pr_debug("%s:qos_baseoffset not available\n", __func__); -+ -+ ret = of_property_read_u32(of_node, "qcom,qos-delta", -+ &pdata->qos_delta); -+ if (ret) -+ pr_debug("%s:qos_delta not available\n", __func__); -+ -+ if (of_property_read_bool(of_node, "qcom,rpm-en")) -+ pdata->rpm_enabled = 1; -+ -+ ret = of_property_read_u32(of_node, "qcom,nr-lim-thresh", -+ &temp); -+ -+ if (ret) { -+ pr_err("nr-lim threshold not specified"); -+ pdata->nr_lim_thresh = 0; -+ } else { -+ pdata->nr_lim_thresh = KBTOB(temp); -+ } -+ -+ ret = of_property_read_u32(of_node, "qcom,eff-fact", -+ &pdata->eff_fact); -+ if (ret) { -+ pr_err("Fab eff-factor not present"); -+ pdata->eff_fact = 0; -+ } -+ -+ pdata->info = get_nodes(of_node, pdev, pdata); -+ return pdata; -+err: -+ return NULL; -+} -+EXPORT_SYMBOL(msm_bus_of_get_fab_data); ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_of_adhoc.c -@@ -0,0 +1,641 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#define pr_fmt(fmt) "AXI: %s(): " fmt, __func__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "msm-bus.h" -+#include "msm-bus-board.h" -+#include "msm_bus_rules.h" -+#include "msm_bus_core.h" -+#include "msm_bus_adhoc.h" -+ -+#define DEFAULT_QOS_FREQ 19200 -+#define DEFAULT_UTIL_FACT 100 -+#define DEFAULT_VRAIL_COMP 100 -+ -+static int get_qos_mode(struct platform_device *pdev, -+ struct device_node *node, const char *qos_mode) -+{ -+ const char *qos_names[] = {"fixed", "limiter", "bypass", "regulator"}; -+ int i = 0; -+ int ret = -1; -+ -+ if (!qos_mode) -+ goto exit_get_qos_mode; -+ -+ for (i = 0; i < ARRAY_SIZE(qos_names); i++) { -+ if (!strcmp(qos_mode, qos_names[i])) -+ break; -+ } -+ if (i == ARRAY_SIZE(qos_names)) -+ dev_err(&pdev->dev, "Cannot match mode qos %s using Bypass", -+ qos_mode); -+ else -+ ret = i; -+ -+exit_get_qos_mode: -+ return ret; -+} -+ -+static int *get_arr(struct platform_device *pdev, -+ struct device_node *node, const char *prop, -+ int *nports) -+{ -+ int size = 0, ret; -+ int *arr = NULL; -+ -+ if (of_get_property(node, prop, &size)) { -+ *nports = size / sizeof(int); -+ } else { -+ dev_dbg(&pdev->dev, "Property %s not available\n", prop); -+ *nports = 0; -+ return NULL; -+ } -+ -+ arr = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); -+ if ((size > 0) && ZERO_OR_NULL_PTR(arr)) { -+ dev_err(&pdev->dev, "Error: Failed to alloc mem for %s\n", -+ prop); -+ return NULL; -+ } -+ -+ ret = of_property_read_u32_array(node, prop, (u32 *)arr, *nports); -+ if (ret) { -+ dev_err(&pdev->dev, "Error in reading property: %s\n", prop); -+ goto arr_err; -+ } -+ -+ return arr; -+arr_err: -+ devm_kfree(&pdev->dev, arr); -+ return NULL; -+} -+ -+static struct msm_bus_fab_device_type *get_fab_device_info( -+ struct device_node *dev_node, -+ struct platform_device *pdev) -+{ -+ struct msm_bus_fab_device_type *fab_dev; -+ unsigned int ret; -+ struct resource *res; -+ const char *base_name; -+ -+ fab_dev = devm_kzalloc(&pdev->dev, -+ sizeof(struct msm_bus_fab_device_type), -+ GFP_KERNEL); -+ if (!fab_dev) { -+ dev_err(&pdev->dev, -+ "Error: Unable to allocate memory for fab_dev\n"); -+ return NULL; -+ } -+ -+ ret = of_property_read_string(dev_node, "qcom,base-name", &base_name); -+ if (ret) { -+ dev_err(&pdev->dev, "Error: Unable to get base address name\n"); -+ goto fab_dev_err; -+ } -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, base_name); -+ if (!res) { -+ dev_err(&pdev->dev, "Error getting qos base addr %s\n", -+ base_name); -+ goto fab_dev_err; -+ } -+ fab_dev->pqos_base = res->start; -+ fab_dev->qos_range = resource_size(res); -+ fab_dev->bypass_qos_prg = of_property_read_bool(dev_node, -+ "qcom,bypass-qos-prg"); -+ -+ ret = of_property_read_u32(dev_node, "qcom,base-offset", -+ &fab_dev->base_offset); -+ if (ret) -+ dev_dbg(&pdev->dev, "Bus base offset is missing\n"); -+ -+ ret = of_property_read_u32(dev_node, "qcom,qos-off", -+ &fab_dev->qos_off); -+ if (ret) -+ dev_dbg(&pdev->dev, "Bus qos off is missing\n"); -+ -+ -+ ret = of_property_read_u32(dev_node, "qcom,bus-type", -+ &fab_dev->bus_type); -+ if (ret) { -+ dev_warn(&pdev->dev, "Bus type is missing\n"); -+ goto fab_dev_err; -+ } -+ -+ ret = of_property_read_u32(dev_node, "qcom,qos-freq", -+ &fab_dev->qos_freq); -+ if (ret) { -+ dev_dbg(&pdev->dev, "Bus qos freq is missing\n"); -+ fab_dev->qos_freq = DEFAULT_QOS_FREQ; -+ } -+ -+ ret = of_property_read_u32(dev_node, "qcom,util-fact", -+ &fab_dev->util_fact); -+ if (ret) { -+ dev_info(&pdev->dev, "Util-fact is missing, default to %d\n", -+ DEFAULT_UTIL_FACT); -+ fab_dev->util_fact = DEFAULT_UTIL_FACT; -+ } -+ -+ ret = of_property_read_u32(dev_node, "qcom,vrail-comp", -+ &fab_dev->vrail_comp); -+ if (ret) { -+ dev_info(&pdev->dev, "Vrail-comp is missing, default to %d\n", -+ DEFAULT_VRAIL_COMP); -+ fab_dev->vrail_comp = DEFAULT_VRAIL_COMP; -+ } -+ -+ return fab_dev; -+ -+fab_dev_err: -+ devm_kfree(&pdev->dev, fab_dev); -+ fab_dev = 0; -+ return NULL; -+} -+ -+static void get_qos_params( -+ struct device_node * const dev_node, -+ struct platform_device * const pdev, -+ struct msm_bus_node_info_type *node_info) -+{ -+ const char *qos_mode = NULL; -+ unsigned int ret; -+ unsigned int temp; -+ -+ ret = of_property_read_string(dev_node, "qcom,qos-mode", &qos_mode); -+ -+ if (ret) -+ node_info->qos_params.mode = -1; -+ else -+ node_info->qos_params.mode = get_qos_mode(pdev, dev_node, -+ qos_mode); -+ -+ of_property_read_u32(dev_node, "qcom,prio-lvl", -+ &node_info->qos_params.prio_lvl); -+ -+ of_property_read_u32(dev_node, "qcom,prio1", -+ &node_info->qos_params.prio1); -+ -+ of_property_read_u32(dev_node, "qcom,prio0", -+ &node_info->qos_params.prio0); -+ -+ of_property_read_u32(dev_node, "qcom,prio-rd", -+ &node_info->qos_params.prio_rd); -+ -+ of_property_read_u32(dev_node, "qcom,prio-wr", -+ &node_info->qos_params.prio_wr); -+ -+ of_property_read_u32(dev_node, "qcom,gp", -+ &node_info->qos_params.gp); -+ -+ of_property_read_u32(dev_node, "qcom,thmp", -+ &node_info->qos_params.thmp); -+ -+ of_property_read_u32(dev_node, "qcom,ws", -+ &node_info->qos_params.ws); -+ -+ ret = of_property_read_u32(dev_node, "qcom,bw_buffer", &temp); -+ -+ if (ret) -+ node_info->qos_params.bw_buffer = 0; -+ else -+ node_info->qos_params.bw_buffer = KBTOB(temp); -+ -+} -+ -+ -+static struct msm_bus_node_info_type *get_node_info_data( -+ struct device_node * const dev_node, -+ struct platform_device * const pdev) -+{ -+ struct msm_bus_node_info_type *node_info; -+ unsigned int ret; -+ int size; -+ int i; -+ struct device_node *con_node; -+ struct device_node *bus_dev; -+ -+ node_info = devm_kzalloc(&pdev->dev, -+ sizeof(struct msm_bus_node_info_type), -+ GFP_KERNEL); -+ if (!node_info) { -+ dev_err(&pdev->dev, -+ "Error: Unable to allocate memory for node_info\n"); -+ return NULL; -+ } -+ -+ ret = of_property_read_u32(dev_node, "cell-id", &node_info->id); -+ if (ret) { -+ dev_warn(&pdev->dev, "Bus node is missing cell-id\n"); -+ goto node_info_err; -+ } -+ ret = of_property_read_string(dev_node, "label", &node_info->name); -+ if (ret) { -+ dev_warn(&pdev->dev, "Bus node is missing name\n"); -+ goto node_info_err; -+ } -+ node_info->qport = get_arr(pdev, dev_node, "qcom,qport", -+ &node_info->num_qports); -+ -+ if (of_get_property(dev_node, "qcom,connections", &size)) { -+ node_info->num_connections = size / sizeof(int); -+ node_info->connections = devm_kzalloc(&pdev->dev, size, -+ GFP_KERNEL); -+ } else { -+ node_info->num_connections = 0; -+ node_info->connections = 0; -+ } -+ -+ for (i = 0; i < node_info->num_connections; i++) { -+ con_node = of_parse_phandle(dev_node, "qcom,connections", i); -+ if (IS_ERR_OR_NULL(con_node)) -+ goto node_info_err; -+ -+ if (of_property_read_u32(con_node, "cell-id", -+ &node_info->connections[i])) -+ goto node_info_err; -+ of_node_put(con_node); -+ } -+ -+ if (of_get_property(dev_node, "qcom,blacklist", &size)) { -+ node_info->num_blist = size/sizeof(u32); -+ node_info->black_listed_connections = devm_kzalloc(&pdev->dev, -+ size, GFP_KERNEL); -+ } else { -+ node_info->num_blist = 0; -+ node_info->black_listed_connections = 0; -+ } -+ -+ for (i = 0; i < node_info->num_blist; i++) { -+ con_node = of_parse_phandle(dev_node, "qcom,blacklist", i); -+ if (IS_ERR_OR_NULL(con_node)) -+ goto node_info_err; -+ -+ if (of_property_read_u32(con_node, "cell-id", -+ &node_info->black_listed_connections[i])) -+ goto node_info_err; -+ of_node_put(con_node); -+ } -+ -+ bus_dev = of_parse_phandle(dev_node, "qcom,bus-dev", 0); -+ if (!IS_ERR_OR_NULL(bus_dev)) { -+ if (of_property_read_u32(bus_dev, "cell-id", -+ &node_info->bus_device_id)) { -+ dev_err(&pdev->dev, "Can't find bus device. Node %d", -+ node_info->id); -+ goto node_info_err; -+ } -+ -+ of_node_put(bus_dev); -+ } else -+ dev_dbg(&pdev->dev, "Can't find bdev phandle for %d", -+ node_info->id); -+ -+ node_info->is_fab_dev = of_property_read_bool(dev_node, "qcom,fab-dev"); -+ node_info->virt_dev = of_property_read_bool(dev_node, "qcom,virt-dev"); -+ -+ ret = of_property_read_u32(dev_node, "qcom,buswidth", -+ &node_info->buswidth); -+ if (ret) { -+ dev_dbg(&pdev->dev, "Using default 8 bytes %d", node_info->id); -+ node_info->buswidth = 8; -+ } -+ -+ ret = of_property_read_u32(dev_node, "qcom,mas-rpm-id", -+ &node_info->mas_rpm_id); -+ if (ret) { -+ dev_dbg(&pdev->dev, "mas rpm id is missing\n"); -+ node_info->mas_rpm_id = -1; -+ } -+ -+ ret = of_property_read_u32(dev_node, "qcom,slv-rpm-id", -+ &node_info->slv_rpm_id); -+ if (ret) { -+ dev_dbg(&pdev->dev, "slv rpm id is missing\n"); -+ node_info->slv_rpm_id = -1; -+ } -+ ret = of_property_read_u32(dev_node, "qcom,util-fact", -+ &node_info->util_fact); -+ if (ret) -+ node_info->util_fact = 0; -+ ret = of_property_read_u32(dev_node, "qcom,vrail-comp", -+ &node_info->vrail_comp); -+ if (ret) -+ node_info->vrail_comp = 0; -+ get_qos_params(dev_node, pdev, node_info); -+ -+ return node_info; -+ -+node_info_err: -+ devm_kfree(&pdev->dev, node_info); -+ node_info = 0; -+ return NULL; -+} -+ -+static unsigned int get_bus_node_device_data( -+ struct device_node * const dev_node, -+ struct platform_device * const pdev, -+ struct msm_bus_node_device_type * const node_device) -+{ -+ node_device->node_info = get_node_info_data(dev_node, pdev); -+ if (IS_ERR_OR_NULL(node_device->node_info)) { -+ dev_err(&pdev->dev, "Error: Node info missing\n"); -+ return -ENODATA; -+ } -+ node_device->ap_owned = of_property_read_bool(dev_node, -+ "qcom,ap-owned"); -+ -+ if (node_device->node_info->is_fab_dev) { -+ dev_dbg(&pdev->dev, "Dev %d\n", node_device->node_info->id); -+ -+ if (!node_device->node_info->virt_dev) { -+ node_device->fabdev = -+ get_fab_device_info(dev_node, pdev); -+ if (IS_ERR_OR_NULL(node_device->fabdev)) { -+ dev_err(&pdev->dev, -+ "Error: Fabric device info missing\n"); -+ devm_kfree(&pdev->dev, node_device->node_info); -+ return -ENODATA; -+ } -+ } -+ node_device->clk[DUAL_CTX].clk = of_clk_get_by_name(dev_node, -+ "bus_clk"); -+ -+ if (IS_ERR_OR_NULL(node_device->clk[DUAL_CTX].clk)) -+ dev_dbg(&pdev->dev, -+ "%s:Failed to get bus clk for bus%d ctx%d", -+ __func__, node_device->node_info->id, -+ DUAL_CTX); -+ -+ node_device->clk[ACTIVE_CTX].clk = of_clk_get_by_name(dev_node, -+ "bus_a_clk"); -+ if (IS_ERR_OR_NULL(node_device->clk[ACTIVE_CTX].clk)) -+ dev_err(&pdev->dev, -+ "Failed to get bus clk for bus%d ctx%d", -+ node_device->node_info->id, ACTIVE_CTX); -+ if (msmbus_coresight_init_adhoc(pdev, dev_node)) -+ dev_warn(&pdev->dev, -+ "Coresight support absent for bus: %d\n", -+ node_device->node_info->id); -+ } else { -+ node_device->qos_clk.clk = of_clk_get_by_name(dev_node, -+ "bus_qos_clk"); -+ -+ if (IS_ERR_OR_NULL(node_device->qos_clk.clk)) -+ dev_dbg(&pdev->dev, -+ "%s:Failed to get bus qos clk for mas%d", -+ __func__, node_device->node_info->id); -+ -+ node_device->clk[DUAL_CTX].clk = of_clk_get_by_name(dev_node, -+ "node_clk"); -+ -+ if (IS_ERR_OR_NULL(node_device->clk[DUAL_CTX].clk)) -+ dev_dbg(&pdev->dev, -+ "%s:Failed to get bus clk for bus%d ctx%d", -+ __func__, node_device->node_info->id, -+ DUAL_CTX); -+ -+ } -+ return 0; -+} -+ -+struct msm_bus_device_node_registration -+ *msm_bus_of_to_pdata(struct platform_device *pdev) -+{ -+ struct device_node *of_node, *child_node; -+ struct msm_bus_device_node_registration *pdata; -+ unsigned int i = 0, j; -+ unsigned int ret; -+ -+ if (!pdev) { -+ pr_err("Error: Null platform device\n"); -+ return NULL; -+ } -+ -+ of_node = pdev->dev.of_node; -+ -+ pdata = devm_kzalloc(&pdev->dev, -+ sizeof(struct msm_bus_device_node_registration), -+ GFP_KERNEL); -+ if (!pdata) { -+ dev_err(&pdev->dev, -+ "Error: Memory allocation for pdata failed\n"); -+ return NULL; -+ } -+ -+ pdata->num_devices = of_get_child_count(of_node); -+ -+ pdata->info = devm_kzalloc(&pdev->dev, -+ sizeof(struct msm_bus_node_device_type) * -+ pdata->num_devices, GFP_KERNEL); -+ -+ if (!pdata->info) { -+ dev_err(&pdev->dev, -+ "Error: Memory allocation for pdata->info failed\n"); -+ goto node_reg_err; -+ } -+ -+ ret = 0; -+ for_each_child_of_node(of_node, child_node) { -+ ret = get_bus_node_device_data(child_node, pdev, -+ &pdata->info[i]); -+ if (ret) { -+ dev_err(&pdev->dev, "Error: unable to initialize bus nodes\n"); -+ goto node_reg_err_1; -+ } -+ i++; -+ } -+ -+ dev_dbg(&pdev->dev, "bus topology:\n"); -+ for (i = 0; i < pdata->num_devices; i++) { -+ dev_dbg(&pdev->dev, "id %d\nnum_qports %d\nnum_connections %d", -+ pdata->info[i].node_info->id, -+ pdata->info[i].node_info->num_qports, -+ pdata->info[i].node_info->num_connections); -+ dev_dbg(&pdev->dev, "\nbus_device_id %d\n buswidth %d\n", -+ pdata->info[i].node_info->bus_device_id, -+ pdata->info[i].node_info->buswidth); -+ for (j = 0; j < pdata->info[i].node_info->num_connections; -+ j++) { -+ dev_dbg(&pdev->dev, "connection[%d]: %d\n", j, -+ pdata->info[i].node_info->connections[j]); -+ } -+ for (j = 0; j < pdata->info[i].node_info->num_blist; -+ j++) { -+ dev_dbg(&pdev->dev, "black_listed_node[%d]: %d\n", j, -+ pdata->info[i].node_info-> -+ black_listed_connections[j]); -+ } -+ if (pdata->info[i].fabdev) -+ dev_dbg(&pdev->dev, "base_addr %zu\nbus_type %d\n", -+ (size_t)pdata->info[i]. -+ fabdev->pqos_base, -+ pdata->info[i].fabdev->bus_type); -+ } -+ return pdata; -+ -+node_reg_err_1: -+ devm_kfree(&pdev->dev, pdata->info); -+node_reg_err: -+ devm_kfree(&pdev->dev, pdata); -+ pdata = NULL; -+ return NULL; -+} -+ -+static int msm_bus_of_get_ids(struct platform_device *pdev, -+ struct device_node *dev_node, int **dev_ids, -+ int *num_ids, char *prop_name) -+{ -+ int ret = 0; -+ int size, i; -+ struct device_node *rule_node; -+ int *ids = NULL; -+ -+ if (of_get_property(dev_node, prop_name, &size)) { -+ *num_ids = size / sizeof(int); -+ ids = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); -+ } else { -+ dev_err(&pdev->dev, "No rule nodes, skipping node"); -+ ret = -ENXIO; -+ goto exit_get_ids; -+ } -+ -+ *dev_ids = ids; -+ for (i = 0; i < *num_ids; i++) { -+ rule_node = of_parse_phandle(dev_node, prop_name, i); -+ if (IS_ERR_OR_NULL(rule_node)) { -+ dev_err(&pdev->dev, "Can't get rule node id"); -+ ret = -ENXIO; -+ goto err_get_ids; -+ } -+ -+ if (of_property_read_u32(rule_node, "cell-id", -+ &ids[i])) { -+ dev_err(&pdev->dev, "Can't get rule node id"); -+ ret = -ENXIO; -+ goto err_get_ids; -+ } -+ of_node_put(rule_node); -+ } -+exit_get_ids: -+ return ret; -+err_get_ids: -+ devm_kfree(&pdev->dev, ids); -+ of_node_put(rule_node); -+ ids = NULL; -+ return ret; -+} -+ -+int msm_bus_of_get_static_rules(struct platform_device *pdev, -+ struct bus_rule_type **static_rules) -+{ -+ int ret = 0; -+ struct device_node *of_node, *child_node; -+ int num_rules = 0; -+ int rule_idx = 0; -+ int bw_fld = 0; -+ int i; -+ struct bus_rule_type *static_rule = NULL; -+ -+ of_node = pdev->dev.of_node; -+ num_rules = of_get_child_count(of_node); -+ static_rule = devm_kzalloc(&pdev->dev, -+ sizeof(struct bus_rule_type) * num_rules, -+ GFP_KERNEL); -+ -+ if (IS_ERR_OR_NULL(static_rule)) { -+ ret = -ENOMEM; -+ goto exit_static_rules; -+ } -+ -+ *static_rules = static_rule; -+ for_each_child_of_node(of_node, child_node) { -+ ret = msm_bus_of_get_ids(pdev, child_node, -+ &static_rule[rule_idx].src_id, -+ &static_rule[rule_idx].num_src, -+ "qcom,src-nodes"); -+ -+ ret = msm_bus_of_get_ids(pdev, child_node, -+ &static_rule[rule_idx].dst_node, -+ &static_rule[rule_idx].num_dst, -+ "qcom,dest-node"); -+ -+ ret = of_property_read_u32(child_node, "qcom,src-field", -+ &static_rule[rule_idx].src_field); -+ if (ret) { -+ dev_err(&pdev->dev, "src-field missing"); -+ ret = -ENXIO; -+ goto err_static_rules; -+ } -+ -+ ret = of_property_read_u32(child_node, "qcom,src-op", -+ &static_rule[rule_idx].op); -+ if (ret) { -+ dev_err(&pdev->dev, "src-op missing"); -+ ret = -ENXIO; -+ goto err_static_rules; -+ } -+ -+ ret = of_property_read_u32(child_node, "qcom,mode", -+ &static_rule[rule_idx].mode); -+ if (ret) { -+ dev_err(&pdev->dev, "mode missing"); -+ ret = -ENXIO; -+ goto err_static_rules; -+ } -+ -+ ret = of_property_read_u32(child_node, "qcom,thresh", &bw_fld); -+ if (ret) { -+ dev_err(&pdev->dev, "thresh missing"); -+ ret = -ENXIO; -+ goto err_static_rules; -+ } else -+ static_rule[rule_idx].thresh = KBTOB(bw_fld); -+ -+ ret = of_property_read_u32(child_node, "qcom,dest-bw", -+ &bw_fld); -+ if (ret) -+ static_rule[rule_idx].dst_bw = 0; -+ else -+ static_rule[rule_idx].dst_bw = KBTOB(bw_fld); -+ -+ rule_idx++; -+ } -+ ret = rule_idx; -+exit_static_rules: -+ return ret; -+err_static_rules: -+ for (i = 0; i < num_rules; i++) { -+ if (!IS_ERR_OR_NULL(static_rule)) { -+ if (!IS_ERR_OR_NULL(static_rule[i].src_id)) -+ devm_kfree(&pdev->dev, -+ static_rule[i].src_id); -+ if (!IS_ERR_OR_NULL(static_rule[i].dst_node)) -+ devm_kfree(&pdev->dev, -+ static_rule[i].dst_node); -+ devm_kfree(&pdev->dev, static_rule); -+ } -+ } -+ devm_kfree(&pdev->dev, *static_rules); -+ static_rules = NULL; -+ return ret; -+} ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_rules.c -@@ -0,0 +1,624 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+#include "msm-bus-board.h" -+#include "msm_bus_rules.h" -+#include -+ -+struct node_vote_info { -+ int id; -+ u64 ib; -+ u64 ab; -+ u64 clk; -+}; -+ -+struct rules_def { -+ int rule_id; -+ int num_src; -+ int state; -+ struct node_vote_info *src_info; -+ struct bus_rule_type rule_ops; -+ bool state_change; -+ struct list_head link; -+}; -+ -+struct rule_node_info { -+ int id; -+ void *data; -+ struct raw_notifier_head rule_notify_list; -+ int cur_rule; -+ int num_rules; -+ struct list_head node_rules; -+ struct list_head link; -+ struct rule_apply_rcm_info apply; -+}; -+ -+DEFINE_MUTEX(msm_bus_rules_lock); -+static LIST_HEAD(node_list); -+static struct rule_node_info *get_node(u32 id, void *data); -+ -+#define LE(op1, op2) (op1 <= op2) -+#define LT(op1, op2) (op1 < op2) -+#define GE(op1, op2) (op1 >= op2) -+#define GT(op1, op2) (op1 > op2) -+#define NB_ID (0x201) -+ -+static struct rule_node_info *get_node(u32 id, void *data) -+{ -+ struct rule_node_info *node_it = NULL; -+ struct rule_node_info *node_match = NULL; -+ -+ list_for_each_entry(node_it, &node_list, link) { -+ if (node_it->id == id) { -+ if ((id == NB_ID)) { -+ if ((node_it->data == data)) { -+ node_match = node_it; -+ break; -+ } -+ } else { -+ node_match = node_it; -+ break; -+ } -+ } -+ } -+ return node_match; -+} -+ -+static struct rule_node_info *gen_node(u32 id, void *data) -+{ -+ struct rule_node_info *node_it = NULL; -+ struct rule_node_info *node_match = NULL; -+ -+ list_for_each_entry(node_it, &node_list, link) { -+ if (node_it->id == id) { -+ node_match = node_it; -+ break; -+ } -+ } -+ -+ if (!node_match) { -+ node_match = kzalloc(sizeof(struct rule_node_info), GFP_KERNEL); -+ if (!node_match) { -+ pr_err("%s: Cannot allocate memory", __func__); -+ goto exit_node_match; -+ } -+ -+ node_match->id = id; -+ node_match->cur_rule = -1; -+ node_match->num_rules = 0; -+ node_match->data = data; -+ list_add_tail(&node_match->link, &node_list); -+ INIT_LIST_HEAD(&node_match->node_rules); -+ RAW_INIT_NOTIFIER_HEAD(&node_match->rule_notify_list); -+ pr_debug("Added new node %d to list\n", id); -+ } -+exit_node_match: -+ return node_match; -+} -+ -+static bool do_compare_op(u64 op1, u64 op2, int op) -+{ -+ bool ret = false; -+ -+ switch (op) { -+ case OP_LE: -+ ret = LE(op1, op2); -+ break; -+ case OP_LT: -+ ret = LT(op1, op2); -+ break; -+ case OP_GT: -+ ret = GT(op1, op2); -+ break; -+ case OP_GE: -+ ret = GE(op1, op2); -+ break; -+ case OP_NOOP: -+ ret = true; -+ break; -+ default: -+ pr_info("Invalid OP %d", op); -+ break; -+ } -+ return ret; -+} -+ -+static void update_src_id_vote(struct rule_update_path_info *inp_node, -+ struct rule_node_info *rule_node) -+{ -+ struct rules_def *rule; -+ int i; -+ -+ list_for_each_entry(rule, &rule_node->node_rules, link) { -+ for (i = 0; i < rule->num_src; i++) { -+ if (rule->src_info[i].id == inp_node->id) { -+ rule->src_info[i].ib = inp_node->ib; -+ rule->src_info[i].ab = inp_node->ab; -+ rule->src_info[i].clk = inp_node->clk; -+ } -+ } -+ } -+} -+ -+static u64 get_field(struct rules_def *rule, int src_id) -+{ -+ u64 field = 0; -+ int i; -+ -+ for (i = 0; i < rule->num_src; i++) { -+ switch (rule->rule_ops.src_field) { -+ case FLD_IB: -+ field += rule->src_info[i].ib; -+ break; -+ case FLD_AB: -+ field += rule->src_info[i].ab; -+ break; -+ case FLD_CLK: -+ field += rule->src_info[i].clk; -+ break; -+ } -+ } -+ -+ return field; -+} -+ -+static bool check_rule(struct rules_def *rule, -+ struct rule_update_path_info *inp) -+{ -+ bool ret = false; -+ -+ if (!rule) -+ return ret; -+ -+ switch (rule->rule_ops.op) { -+ case OP_LE: -+ case OP_LT: -+ case OP_GT: -+ case OP_GE: -+ { -+ u64 src_field = get_field(rule, inp->id); -+ if (!src_field) -+ ret = false; -+ else -+ ret = do_compare_op(src_field, rule->rule_ops.thresh, -+ rule->rule_ops.op); -+ break; -+ } -+ default: -+ pr_err("Unsupported op %d", rule->rule_ops.op); -+ break; -+ } -+ return ret; -+} -+ -+static void match_rule(struct rule_update_path_info *inp_node, -+ struct rule_node_info *node) -+{ -+ struct rules_def *rule; -+ int i; -+ -+ list_for_each_entry(rule, &node->node_rules, link) { -+ for (i = 0; i < rule->num_src; i++) { -+ if (rule->src_info[i].id == inp_node->id) { -+ if (check_rule(rule, inp_node)) { -+ trace_bus_rules_matches(node->cur_rule, -+ inp_node->id, inp_node->ab, -+ inp_node->ib, inp_node->clk); -+ if (rule->state == -+ RULE_STATE_NOT_APPLIED) -+ rule->state_change = true; -+ rule->state = RULE_STATE_APPLIED; -+ } else { -+ if (rule->state == -+ RULE_STATE_APPLIED) -+ rule->state_change = true; -+ rule->state = RULE_STATE_NOT_APPLIED; -+ } -+ } -+ } -+ } -+} -+ -+static void apply_rule(struct rule_node_info *node, -+ struct list_head *output_list) -+{ -+ struct rules_def *rule; -+ -+ node->cur_rule = -1; -+ list_for_each_entry(rule, &node->node_rules, link) { -+ if ((rule->state == RULE_STATE_APPLIED) && -+ (node->cur_rule == -1)) -+ node->cur_rule = rule->rule_id; -+ -+ if (node->id == NB_ID) { -+ if (rule->state_change) { -+ rule->state_change = false; -+ raw_notifier_call_chain(&node->rule_notify_list, -+ rule->state, (void *)&rule->rule_ops); -+ } -+ } else { -+ if ((rule->state == RULE_STATE_APPLIED) && -+ (node->cur_rule == rule->rule_id)) { -+ node->apply.id = rule->rule_ops.dst_node[0]; -+ node->apply.throttle = rule->rule_ops.mode; -+ node->apply.lim_bw = rule->rule_ops.dst_bw; -+ list_add_tail(&node->apply.link, output_list); -+ } -+ rule->state_change = false; -+ } -+ } -+ -+} -+ -+int msm_rules_update_path(struct list_head *input_list, -+ struct list_head *output_list) -+{ -+ int ret = 0; -+ struct rule_update_path_info *inp_node; -+ struct rule_node_info *node_it = NULL; -+ -+ mutex_lock(&msm_bus_rules_lock); -+ list_for_each_entry(inp_node, input_list, link) { -+ list_for_each_entry(node_it, &node_list, link) { -+ update_src_id_vote(inp_node, node_it); -+ match_rule(inp_node, node_it); -+ } -+ } -+ -+ list_for_each_entry(node_it, &node_list, link) -+ apply_rule(node_it, output_list); -+ -+ mutex_unlock(&msm_bus_rules_lock); -+ return ret; -+} -+ -+static bool ops_equal(int op1, int op2) -+{ -+ bool ret = false; -+ -+ switch (op1) { -+ case OP_GT: -+ case OP_GE: -+ case OP_LT: -+ case OP_LE: -+ if (abs(op1 - op2) <= 1) -+ ret = true; -+ break; -+ default: -+ ret = (op1 == op2); -+ } -+ -+ return ret; -+} -+ -+static int node_rules_compare(void *priv, struct list_head *a, -+ struct list_head *b) -+{ -+ struct rules_def *ra = container_of(a, struct rules_def, link); -+ struct rules_def *rb = container_of(b, struct rules_def, link); -+ int ret = -1; -+ int64_t th_diff = 0; -+ -+ -+ if (ra->rule_ops.mode == rb->rule_ops.mode) { -+ if (ops_equal(ra->rule_ops.op, rb->rule_ops.op)) { -+ if ((ra->rule_ops.op == OP_LT) || -+ (ra->rule_ops.op == OP_LE)) { -+ th_diff = ra->rule_ops.thresh - -+ rb->rule_ops.thresh; -+ if (th_diff > 0) -+ ret = 1; -+ else -+ ret = -1; -+ } else if ((ra->rule_ops.op == OP_GT) || -+ (ra->rule_ops.op == OP_GE)) { -+ th_diff = rb->rule_ops.thresh - -+ ra->rule_ops.thresh; -+ if (th_diff > 0) -+ ret = 1; -+ else -+ ret = -1; -+ } -+ } else -+ ret = ra->rule_ops.op - rb->rule_ops.op; -+ } else if ((ra->rule_ops.mode == THROTTLE_OFF) && -+ (rb->rule_ops.mode == THROTTLE_ON)) { -+ ret = 1; -+ } else if ((ra->rule_ops.mode == THROTTLE_ON) && -+ (rb->rule_ops.mode == THROTTLE_OFF)) { -+ ret = -1; -+ } -+ -+ return ret; -+} -+ -+static void print_rules(struct rule_node_info *node_it) -+{ -+ struct rules_def *node_rule = NULL; -+ int i; -+ -+ if (!node_it) { -+ pr_err("%s: no node for found", __func__); -+ return; -+ } -+ -+ pr_info("\n Now printing rules for Node %d cur rule %d\n", -+ node_it->id, node_it->cur_rule); -+ list_for_each_entry(node_rule, &node_it->node_rules, link) { -+ pr_info("\n num Rules %d rule Id %d\n", -+ node_it->num_rules, node_rule->rule_id); -+ pr_info("Rule: src_field %d\n", node_rule->rule_ops.src_field); -+ for (i = 0; i < node_rule->rule_ops.num_src; i++) -+ pr_info("Rule: src %d\n", -+ node_rule->rule_ops.src_id[i]); -+ for (i = 0; i < node_rule->rule_ops.num_dst; i++) -+ pr_info("Rule: dst %d dst_bw %llu\n", -+ node_rule->rule_ops.dst_node[i], -+ node_rule->rule_ops.dst_bw); -+ pr_info("Rule: thresh %llu op %d mode %d State %d\n", -+ node_rule->rule_ops.thresh, -+ node_rule->rule_ops.op, -+ node_rule->rule_ops.mode, -+ node_rule->state); -+ } -+} -+ -+void print_all_rules(void) -+{ -+ struct rule_node_info *node_it = NULL; -+ -+ list_for_each_entry(node_it, &node_list, link) -+ print_rules(node_it); -+} -+ -+void print_rules_buf(char *buf, int max_buf) -+{ -+ struct rule_node_info *node_it = NULL; -+ struct rules_def *node_rule = NULL; -+ int i; -+ int cnt = 0; -+ -+ list_for_each_entry(node_it, &node_list, link) { -+ cnt += scnprintf(buf + cnt, max_buf - cnt, -+ "\n Now printing rules for Node %d cur_rule %d\n", -+ node_it->id, node_it->cur_rule); -+ list_for_each_entry(node_rule, &node_it->node_rules, link) { -+ cnt += scnprintf(buf + cnt, max_buf - cnt, -+ "\nNum Rules:%d ruleId %d STATE:%d change:%d\n", -+ node_it->num_rules, node_rule->rule_id, -+ node_rule->state, node_rule->state_change); -+ cnt += scnprintf(buf + cnt, max_buf - cnt, -+ "Src_field %d\n", -+ node_rule->rule_ops.src_field); -+ for (i = 0; i < node_rule->rule_ops.num_src; i++) -+ cnt += scnprintf(buf + cnt, max_buf - cnt, -+ "Src %d Cur Ib %llu Ab %llu\n", -+ node_rule->rule_ops.src_id[i], -+ node_rule->src_info[i].ib, -+ node_rule->src_info[i].ab); -+ for (i = 0; i < node_rule->rule_ops.num_dst; i++) -+ cnt += scnprintf(buf + cnt, max_buf - cnt, -+ "Dst %d dst_bw %llu\n", -+ node_rule->rule_ops.dst_node[0], -+ node_rule->rule_ops.dst_bw); -+ cnt += scnprintf(buf + cnt, max_buf - cnt, -+ "Thresh %llu op %d mode %d\n", -+ node_rule->rule_ops.thresh, -+ node_rule->rule_ops.op, -+ node_rule->rule_ops.mode); -+ } -+ } -+} -+ -+static int copy_rule(struct bus_rule_type *src, struct rules_def *node_rule, -+ struct notifier_block *nb) -+{ -+ int i; -+ int ret = 0; -+ -+ memcpy(&node_rule->rule_ops, src, -+ sizeof(struct bus_rule_type)); -+ node_rule->rule_ops.src_id = kzalloc( -+ (sizeof(int) * node_rule->rule_ops.num_src), -+ GFP_KERNEL); -+ if (!node_rule->rule_ops.src_id) { -+ pr_err("%s:Failed to allocate for src_id", -+ __func__); -+ return -ENOMEM; -+ } -+ memcpy(node_rule->rule_ops.src_id, src->src_id, -+ sizeof(int) * src->num_src); -+ -+ -+ if (!nb) { -+ node_rule->rule_ops.dst_node = kzalloc( -+ (sizeof(int) * node_rule->rule_ops.num_dst), -+ GFP_KERNEL); -+ if (!node_rule->rule_ops.dst_node) { -+ pr_err("%s:Failed to allocate for src_id", -+ __func__); -+ return -ENOMEM; -+ } -+ memcpy(node_rule->rule_ops.dst_node, src->dst_node, -+ sizeof(int) * src->num_dst); -+ } -+ -+ node_rule->num_src = src->num_src; -+ node_rule->src_info = kzalloc( -+ (sizeof(struct node_vote_info) * node_rule->rule_ops.num_src), -+ GFP_KERNEL); -+ if (!node_rule->src_info) { -+ pr_err("%s:Failed to allocate for src_id", -+ __func__); -+ return -ENOMEM; -+ } -+ for (i = 0; i < src->num_src; i++) -+ node_rule->src_info[i].id = src->src_id[i]; -+ -+ return ret; -+} -+ -+void msm_rule_register(int num_rules, struct bus_rule_type *rule, -+ struct notifier_block *nb) -+{ -+ struct rule_node_info *node = NULL; -+ int i, j; -+ struct rules_def *node_rule = NULL; -+ int num_dst = 0; -+ -+ if (!rule) -+ return; -+ -+ mutex_lock(&msm_bus_rules_lock); -+ for (i = 0; i < num_rules; i++) { -+ if (nb) -+ num_dst = 1; -+ else -+ num_dst = rule[i].num_dst; -+ -+ for (j = 0; j < num_dst; j++) { -+ int id = 0; -+ -+ if (nb) -+ id = NB_ID; -+ else -+ id = rule[i].dst_node[j]; -+ -+ node = gen_node(id, nb); -+ if (!node) { -+ pr_info("Error getting rule"); -+ goto exit_rule_register; -+ } -+ node_rule = kzalloc(sizeof(struct rules_def), -+ GFP_KERNEL); -+ if (!node_rule) { -+ pr_err("%s: Failed to allocate for rule", -+ __func__); -+ goto exit_rule_register; -+ } -+ -+ if (copy_rule(&rule[i], node_rule, nb)) { -+ pr_err("Error copying rule"); -+ goto exit_rule_register; -+ } -+ -+ node_rule->rule_id = node->num_rules++; -+ if (nb) -+ node->data = nb; -+ -+ list_add_tail(&node_rule->link, &node->node_rules); -+ } -+ } -+ list_sort(NULL, &node->node_rules, node_rules_compare); -+ -+ if (nb) -+ raw_notifier_chain_register(&node->rule_notify_list, nb); -+exit_rule_register: -+ mutex_unlock(&msm_bus_rules_lock); -+ return; -+} -+ -+static int comp_rules(struct bus_rule_type *rulea, struct bus_rule_type *ruleb) -+{ -+ int ret = 1; -+ -+ if (rulea->num_src == ruleb->num_src) -+ ret = memcmp(rulea->src_id, ruleb->src_id, -+ (sizeof(int) * rulea->num_src)); -+ if (!ret && (rulea->num_dst == ruleb->num_dst)) -+ ret = memcmp(rulea->dst_node, ruleb->dst_node, -+ (sizeof(int) * rulea->num_dst)); -+ if (!ret && (rulea->dst_bw == ruleb->dst_bw) && -+ (rulea->op == ruleb->op) && (rulea->thresh == ruleb->thresh)) -+ ret = 0; -+ -+ return ret; -+} -+ -+void msm_rule_unregister(int num_rules, struct bus_rule_type *rule, -+ struct notifier_block *nb) -+{ -+ int i; -+ struct rule_node_info *node = NULL; -+ struct rule_node_info *node_tmp = NULL; -+ struct rules_def *node_rule; -+ struct rules_def *node_rule_tmp; -+ bool match_found = false; -+ -+ if (!rule) -+ return; -+ -+ mutex_lock(&msm_bus_rules_lock); -+ if (nb) { -+ node = get_node(NB_ID, nb); -+ if (!node) { -+ pr_err("%s: Can't find node", __func__); -+ goto exit_unregister_rule; -+ } -+ -+ list_for_each_entry_safe(node_rule, node_rule_tmp, -+ &node->node_rules, link) { -+ list_del(&node_rule->link); -+ kfree(node_rule); -+ node->num_rules--; -+ } -+ raw_notifier_chain_unregister(&node->rule_notify_list, nb); -+ } else { -+ for (i = 0; i < num_rules; i++) { -+ match_found = false; -+ -+ list_for_each_entry(node, &node_list, link) { -+ list_for_each_entry_safe(node_rule, -+ node_rule_tmp, &node->node_rules, link) { -+ if (comp_rules(&node_rule->rule_ops, -+ &rule[i]) == 0) { -+ list_del(&node_rule->link); -+ kfree(node_rule); -+ match_found = true; -+ node->num_rules--; -+ list_sort(NULL, -+ &node->node_rules, -+ node_rules_compare); -+ break; -+ } -+ } -+ } -+ } -+ } -+ -+ list_for_each_entry_safe(node, node_tmp, -+ &node_list, link) { -+ if (!node->num_rules) { -+ pr_debug("Deleting Rule node %d", node->id); -+ list_del(&node->link); -+ kfree(node); -+ } -+ } -+exit_unregister_rule: -+ mutex_unlock(&msm_bus_rules_lock); -+} -+ -+bool msm_rule_are_rules_registered(void) -+{ -+ bool ret = false; -+ -+ if (list_empty(&node_list)) -+ ret = false; -+ else -+ ret = true; -+ -+ return ret; -+} -+ ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_bus_rules.h -@@ -0,0 +1,77 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#ifndef _ARCH_ARM_MACH_MSM_BUS_RULES_H -+#define _ARCH_ARM_MACH_MSM_BUS_RULES_H -+ -+#include -+#include -+#include -+#include -+ -+#define MAX_NODES (5) -+ -+struct rule_update_path_info { -+ u32 id; -+ u64 ab; -+ u64 ib; -+ u64 clk; -+ struct list_head link; -+}; -+ -+struct rule_apply_rcm_info { -+ u32 id; -+ u64 lim_bw; -+ int throttle; -+ bool after_clk_commit; -+ struct list_head link; -+}; -+ -+struct bus_rule_type { -+ int num_src; -+ int *src_id; -+ int src_field; -+ int op; -+ u64 thresh; -+ int num_dst; -+ int *dst_node; -+ u64 dst_bw; -+ int mode; -+ void *client_data; -+}; -+ -+#if (defined(CONFIG_BUS_TOPOLOGY_ADHOC)) -+void msm_rule_register(int num_rules, struct bus_rule_type *rule, -+ struct notifier_block *nb); -+void msm_rule_unregister(int num_rules, struct bus_rule_type *rule, -+ struct notifier_block *nb); -+void print_rules_buf(char *buf, int count); -+bool msm_rule_are_rules_registered(void); -+#else -+static inline void msm_rule_register(int num_rules, struct bus_rule_type *rule, -+ struct notifier_block *nb) -+{ -+} -+static inline void msm_rule_unregister(int num_rules, -+ struct bus_rule_type *rule, -+ struct notifier_block *nb) -+{ -+} -+static inline void print_rules_buf(char *buf, int count) -+{ -+} -+static inline bool msm_rule_are_rules_registered(void) -+{ -+ return false; -+} -+#endif /* defined(CONFIG_BUS_TOPOLOGY_ADHOC) */ -+#endif /* _ARCH_ARM_MACH_MSM_BUS_RULES_H */ ---- /dev/null -+++ b/drivers/bus/msm_bus/msm_buspm_coresight_adhoc.c -@@ -0,0 +1,189 @@ -+/* Copyright (c) 2014 The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct msmbus_coresight_adhoc_clock_drvdata { -+ int id; -+ struct clk *clk; -+ struct list_head list; -+}; -+ -+struct msmbus_coresight_adhoc_drvdata { -+ struct device *dev; -+ struct coresight_device *csdev; -+ struct coresight_desc *desc; -+ struct list_head clocks; -+}; -+ -+static int msmbus_coresight_enable_adhoc(struct coresight_device *csdev) -+{ -+ struct msmbus_coresight_adhoc_clock_drvdata *clk; -+ struct msmbus_coresight_adhoc_drvdata *drvdata = -+ dev_get_drvdata(csdev->dev.parent); -+ long rate; -+ -+ list_for_each_entry(clk, &drvdata->clocks, list) { -+ if (clk->id == csdev->id) { -+ rate = clk_round_rate(clk->clk, 1L); -+ clk_set_rate(clk->clk, rate); -+ return clk_prepare_enable(clk->clk); -+ } -+ } -+ -+ return -ENOENT; -+} -+ -+static void msmbus_coresight_disable_adhoc(struct coresight_device *csdev) -+{ -+ struct msmbus_coresight_adhoc_clock_drvdata *clk; -+ struct msmbus_coresight_adhoc_drvdata *drvdata = -+ dev_get_drvdata(csdev->dev.parent); -+ -+ list_for_each_entry(clk, &drvdata->clocks, list) { -+ if (clk->id == csdev->id) -+ clk_disable_unprepare(clk->clk); -+ } -+} -+ -+static const struct coresight_ops_source msmbus_coresight_adhoc_source_ops = { -+ .enable = msmbus_coresight_enable_adhoc, -+ .disable = msmbus_coresight_disable_adhoc, -+}; -+ -+static const struct coresight_ops msmbus_coresight_cs_ops = { -+ .source_ops = &msmbus_coresight_adhoc_source_ops, -+}; -+ -+void msmbus_coresight_remove_adhoc(struct platform_device *pdev) -+{ -+ struct msmbus_coresight_adhoc_clock_drvdata *clk, *next_clk; -+ struct msmbus_coresight_adhoc_drvdata *drvdata = -+ platform_get_drvdata(pdev); -+ -+ msmbus_coresight_disable_adhoc(drvdata->csdev); -+ coresight_unregister(drvdata->csdev); -+ list_for_each_entry_safe(clk, next_clk, &drvdata->clocks, list) { -+ list_del(&clk->list); -+ devm_kfree(&pdev->dev, clk); -+ } -+ devm_kfree(&pdev->dev, drvdata->desc); -+ devm_kfree(&pdev->dev, drvdata); -+ platform_set_drvdata(pdev, NULL); -+} -+EXPORT_SYMBOL(msmbus_coresight_remove_adhoc); -+ -+static int buspm_of_get_clk_adhoc(struct device_node *of_node, -+ struct msmbus_coresight_adhoc_drvdata *drvdata, int id) -+{ -+ struct msmbus_coresight_adhoc_clock_drvdata *clk; -+ clk = devm_kzalloc(drvdata->dev, sizeof(*clk), GFP_KERNEL); -+ -+ if (!clk) -+ return -ENOMEM; -+ -+ clk->id = id; -+ -+ clk->clk = of_clk_get_by_name(of_node, "bus_clk"); -+ if (IS_ERR(clk->clk)) { -+ pr_err("Error: unable to get clock for coresight node %d\n", -+ id); -+ goto err; -+ } -+ -+ list_add(&clk->list, &drvdata->clocks); -+ return 0; -+ -+err: -+ devm_kfree(drvdata->dev, clk); -+ return -EINVAL; -+} -+ -+int msmbus_coresight_init_adhoc(struct platform_device *pdev, -+ struct device_node *of_node) -+{ -+ int ret; -+ struct device *dev = &pdev->dev; -+ struct coresight_platform_data *pdata; -+ struct msmbus_coresight_adhoc_drvdata *drvdata; -+ struct coresight_desc *desc; -+ -+ pdata = of_get_coresight_platform_data(dev, of_node); -+ if (IS_ERR(pdata)) -+ return PTR_ERR(pdata); -+ -+ drvdata = platform_get_drvdata(pdev); -+ if (IS_ERR_OR_NULL(drvdata)) { -+ drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); -+ if (!drvdata) { -+ pr_err("coresight: Alloc for drvdata failed\n"); -+ return -ENOMEM; -+ } -+ INIT_LIST_HEAD(&drvdata->clocks); -+ drvdata->dev = &pdev->dev; -+ platform_set_drvdata(pdev, drvdata); -+ } -+ ret = buspm_of_get_clk_adhoc(of_node, drvdata, pdata->id); -+ if (ret) { -+ pr_err("Error getting clocks\n"); -+ ret = -ENXIO; -+ goto err1; -+ } -+ -+ desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); -+ if (!desc) { -+ pr_err("coresight: Error allocating memory\n"); -+ ret = -ENOMEM; -+ goto err1; -+ } -+ -+ desc->type = CORESIGHT_DEV_TYPE_SOURCE; -+ desc->subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_BUS; -+ desc->ops = &msmbus_coresight_cs_ops; -+ desc->pdata = pdata; -+ desc->dev = &pdev->dev; -+ desc->owner = THIS_MODULE; -+ drvdata->desc = desc; -+ drvdata->csdev = coresight_register(desc); -+ if (IS_ERR(drvdata->csdev)) { -+ pr_err("coresight: Coresight register failed\n"); -+ ret = PTR_ERR(drvdata->csdev); -+ goto err0; -+ } -+ -+ dev_info(dev, "msmbus_coresight initialized\n"); -+ -+ return 0; -+err0: -+ devm_kfree(dev, desc); -+err1: -+ devm_kfree(dev, drvdata); -+ platform_set_drvdata(pdev, NULL); -+ return ret; -+} -+EXPORT_SYMBOL(msmbus_coresight_init_adhoc); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("MSM BusPM Adhoc CoreSight Driver"); ---- /dev/null -+++ b/drivers/bus/msm_bus/rpm-smd.h -@@ -0,0 +1,268 @@ -+/* Copyright (c) 2012, 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ * -+ */ -+ -+#ifndef __ARCH_ARM_MACH_MSM_RPM_SMD_H -+#define __ARCH_ARM_MACH_MSM_RPM_SMD_H -+ -+/** -+ * enum msm_rpm_set - RPM enumerations for sleep/active set -+ * %MSM_RPM_CTX_SET_0: Set resource parameters for active mode. -+ * %MSM_RPM_CTX_SET_SLEEP: Set resource parameters for sleep. -+ */ -+enum msm_rpm_set { -+ MSM_RPM_CTX_ACTIVE_SET, -+ MSM_RPM_CTX_SLEEP_SET, -+}; -+ -+struct msm_rpm_request; -+ -+struct msm_rpm_kvp { -+ uint32_t key; -+ uint32_t length; -+ uint8_t *data; -+}; -+#ifdef CONFIG_MSM_RPM_SMD -+/** -+ * msm_rpm_request() - Creates a parent element to identify the -+ * resource on the RPM, that stores the KVPs for different fields modified -+ * for a hardware resource -+ * -+ * @set: if the device is setting the active/sleep set parameter -+ * for the resource -+ * @rsc_type: unsigned 32 bit integer that identifies the type of the resource -+ * @rsc_id: unsigned 32 bit that uniquely identifies a resource within a type -+ * @num_elements: number of KVPs pairs associated with the resource -+ * -+ * returns pointer to a msm_rpm_request on success, NULL on error -+ */ -+struct msm_rpm_request *msm_rpm_create_request( -+ enum msm_rpm_set set, uint32_t rsc_type, -+ uint32_t rsc_id, int num_elements); -+ -+/** -+ * msm_rpm_request_noirq() - Creates a parent element to identify the -+ * resource on the RPM, that stores the KVPs for different fields modified -+ * for a hardware resource. This function is similar to msm_rpm_create_request -+ * except that it has to be called with interrupts masked. -+ * -+ * @set: if the device is setting the active/sleep set parameter -+ * for the resource -+ * @rsc_type: unsigned 32 bit integer that identifies the type of the resource -+ * @rsc_id: unsigned 32 bit that uniquely identifies a resource within a type -+ * @num_elements: number of KVPs pairs associated with the resource -+ * -+ * returns pointer to a msm_rpm_request on success, NULL on error -+ */ -+struct msm_rpm_request *msm_rpm_create_request_noirq( -+ enum msm_rpm_set set, uint32_t rsc_type, -+ uint32_t rsc_id, int num_elements); -+ -+/** -+ * msm_rpm_add_kvp_data() - Adds a Key value pair to a existing RPM resource. -+ * -+ * @handle: RPM resource handle to which the data should be appended -+ * @key: unsigned integer identify the parameter modified -+ * @data: byte array that contains the value corresponding to key. -+ * @size: size of data in bytes. -+ * -+ * returns 0 on success or errno -+ */ -+int msm_rpm_add_kvp_data(struct msm_rpm_request *handle, -+ uint32_t key, const uint8_t *data, int size); -+ -+/** -+ * msm_rpm_add_kvp_data_noirq() - Adds a Key value pair to a existing RPM -+ * resource. This function is similar to msm_rpm_add_kvp_data except that it -+ * has to be called with interrupts masked. -+ * -+ * @handle: RPM resource handle to which the data should be appended -+ * @key: unsigned integer identify the parameter modified -+ * @data: byte array that contains the value corresponding to key. -+ * @size: size of data in bytes. -+ * -+ * returns 0 on success or errno -+ */ -+int msm_rpm_add_kvp_data_noirq(struct msm_rpm_request *handle, -+ uint32_t key, const uint8_t *data, int size); -+ -+/** msm_rpm_free_request() - clean up the RPM request handle created with -+ * msm_rpm_create_request -+ * -+ * @handle: RPM resource handle to be cleared. -+ */ -+ -+void msm_rpm_free_request(struct msm_rpm_request *handle); -+ -+/** -+ * msm_rpm_send_request() - Send the RPM messages using SMD. The function -+ * assigns a message id before sending the data out to the RPM. RPM hardware -+ * uses the message id to acknowledge the messages. -+ * -+ * @handle: pointer to the msm_rpm_request for the resource being modified. -+ * -+ * returns non-zero message id on success and zero on a failed transaction. -+ * The drivers use message id to wait for ACK from RPM. -+ */ -+int msm_rpm_send_request(struct msm_rpm_request *handle); -+ -+/** -+ * msm_rpm_send_request_noirq() - Send the RPM messages using SMD. The -+ * function assigns a message id before sending the data out to the RPM. -+ * RPM hardware uses the message id to acknowledge the messages. This function -+ * is similar to msm_rpm_send_request except that it has to be called with -+ * interrupts masked. -+ * -+ * @handle: pointer to the msm_rpm_request for the resource being modified. -+ * -+ * returns non-zero message id on success and zero on a failed transaction. -+ * The drivers use message id to wait for ACK from RPM. -+ */ -+int msm_rpm_send_request_noirq(struct msm_rpm_request *handle); -+ -+/** -+ * msm_rpm_wait_for_ack() - A blocking call that waits for acknowledgment of -+ * a message from RPM. -+ * -+ * @msg_id: the return from msm_rpm_send_requests -+ * -+ * returns 0 on success or errno -+ */ -+int msm_rpm_wait_for_ack(uint32_t msg_id); -+ -+/** -+ * msm_rpm_wait_for_ack_noirq() - A blocking call that waits for acknowledgment -+ * of a message from RPM. This function is similar to msm_rpm_wait_for_ack -+ * except that it has to be called with interrupts masked. -+ * -+ * @msg_id: the return from msm_rpm_send_request -+ * -+ * returns 0 on success or errno -+ */ -+int msm_rpm_wait_for_ack_noirq(uint32_t msg_id); -+ -+/** -+ * msm_rpm_send_message() -Wrapper function for clients to send data given an -+ * array of key value pairs. -+ * -+ * @set: if the device is setting the active/sleep set parameter -+ * for the resource -+ * @rsc_type: unsigned 32 bit integer that identifies the type of the resource -+ * @rsc_id: unsigned 32 bit that uniquely identifies a resource within a type -+ * @kvp: array of KVP data. -+ * @nelem: number of KVPs pairs associated with the message. -+ * -+ * returns 0 on success and errno on failure. -+ */ -+int msm_rpm_send_message(enum msm_rpm_set set, uint32_t rsc_type, -+ uint32_t rsc_id, struct msm_rpm_kvp *kvp, int nelems); -+ -+/** -+ * msm_rpm_send_message_noirq() -Wrapper function for clients to send data -+ * given an array of key value pairs. This function is similar to the -+ * msm_rpm_send_message() except that it has to be called with interrupts -+ * disabled. Clients should choose the irq version when possible for system -+ * performance. -+ * -+ * @set: if the device is setting the active/sleep set parameter -+ * for the resource -+ * @rsc_type: unsigned 32 bit integer that identifies the type of the resource -+ * @rsc_id: unsigned 32 bit that uniquely identifies a resource within a type -+ * @kvp: array of KVP data. -+ * @nelem: number of KVPs pairs associated with the message. -+ * -+ * returns 0 on success and errno on failure. -+ */ -+int msm_rpm_send_message_noirq(enum msm_rpm_set set, uint32_t rsc_type, -+ uint32_t rsc_id, struct msm_rpm_kvp *kvp, int nelems); -+ -+/** -+ * msm_rpm_driver_init() - Initialization function that registers for a -+ * rpm platform driver. -+ * -+ * returns 0 on success. -+ */ -+int __init msm_rpm_driver_init(void); -+ -+#else -+ -+static inline struct msm_rpm_request *msm_rpm_create_request( -+ enum msm_rpm_set set, uint32_t rsc_type, -+ uint32_t rsc_id, int num_elements) -+{ -+ return NULL; -+} -+ -+static inline struct msm_rpm_request *msm_rpm_create_request_noirq( -+ enum msm_rpm_set set, uint32_t rsc_type, -+ uint32_t rsc_id, int num_elements) -+{ -+ return NULL; -+ -+} -+static inline uint32_t msm_rpm_add_kvp_data(struct msm_rpm_request *handle, -+ uint32_t key, const uint8_t *data, int count) -+{ -+ return 0; -+} -+static inline uint32_t msm_rpm_add_kvp_data_noirq( -+ struct msm_rpm_request *handle, uint32_t key, -+ const uint8_t *data, int count) -+{ -+ return 0; -+} -+ -+static inline void msm_rpm_free_request(struct msm_rpm_request *handle) -+{ -+ return; -+} -+ -+static inline int msm_rpm_send_request(struct msm_rpm_request *handle) -+{ -+ return 0; -+} -+ -+static inline int msm_rpm_send_request_noirq(struct msm_rpm_request *handle) -+{ -+ return 0; -+ -+} -+ -+static inline int msm_rpm_send_message(enum msm_rpm_set set, uint32_t rsc_type, -+ uint32_t rsc_id, struct msm_rpm_kvp *kvp, int nelems) -+{ -+ return 0; -+} -+ -+static inline int msm_rpm_send_message_noirq(enum msm_rpm_set set, -+ uint32_t rsc_type, uint32_t rsc_id, struct msm_rpm_kvp *kvp, -+ int nelems) -+{ -+ return 0; -+} -+ -+static inline int msm_rpm_wait_for_ack(uint32_t msg_id) -+{ -+ return 0; -+ -+} -+static inline int msm_rpm_wait_for_ack_noirq(uint32_t msg_id) -+{ -+ return 0; -+} -+ -+static inline int __init msm_rpm_driver_init(void) -+{ -+ return 0; -+} -+#endif -+#endif /*__ARCH_ARM_MACH_MSM_RPM_SMD_H*/ ---- /dev/null -+++ b/include/trace/events/trace_msm_bus.h -@@ -0,0 +1,163 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+ -+#undef TRACE_SYSTEM -+#define TRACE_SYSTEM msm_bus -+ -+#if !defined(_TRACE_MSM_BUS_H) || defined(TRACE_HEADER_MULTI_READ) -+#define _TRACE_MSM_BUS_H -+ -+#include -+ -+TRACE_EVENT(bus_update_request, -+ -+ TP_PROTO(int sec, int nsec, const char *name, unsigned int index, -+ int src, int dest, unsigned long long ab, -+ unsigned long long ib), -+ -+ TP_ARGS(sec, nsec, name, index, src, dest, ab, ib), -+ -+ TP_STRUCT__entry( -+ __field(int, sec) -+ __field(int, nsec) -+ __string(name, name) -+ __field(u32, index) -+ __field(int, src) -+ __field(int, dest) -+ __field(u64, ab) -+ __field(u64, ib) -+ ), -+ -+ TP_fast_assign( -+ __entry->sec = sec; -+ __entry->nsec = nsec; -+ __assign_str(name, name); -+ __entry->index = index; -+ __entry->src = src; -+ __entry->dest = dest; -+ __entry->ab = ab; -+ __entry->ib = ib; -+ ), -+ -+ TP_printk("time= %d.%d name=%s index=%u src=%d dest=%d ab=%llu ib=%llu", -+ __entry->sec, -+ __entry->nsec, -+ __get_str(name), -+ (unsigned int)__entry->index, -+ __entry->src, -+ __entry->dest, -+ (unsigned long long)__entry->ab, -+ (unsigned long long)__entry->ib) -+); -+ -+TRACE_EVENT(bus_bimc_config_limiter, -+ -+ TP_PROTO(int mas_id, unsigned long long cur_lim_bw), -+ -+ TP_ARGS(mas_id, cur_lim_bw), -+ -+ TP_STRUCT__entry( -+ __field(int, mas_id) -+ __field(u64, cur_lim_bw) -+ ), -+ -+ TP_fast_assign( -+ __entry->mas_id = mas_id; -+ __entry->cur_lim_bw = cur_lim_bw; -+ ), -+ -+ TP_printk("Master=%d cur_lim_bw=%llu", -+ __entry->mas_id, -+ (unsigned long long)__entry->cur_lim_bw) -+); -+ -+TRACE_EVENT(bus_avail_bw, -+ -+ TP_PROTO(unsigned long long cur_bimc_bw, unsigned long long cur_mdp_bw), -+ -+ TP_ARGS(cur_bimc_bw, cur_mdp_bw), -+ -+ TP_STRUCT__entry( -+ __field(u64, cur_bimc_bw) -+ __field(u64, cur_mdp_bw) -+ ), -+ -+ TP_fast_assign( -+ __entry->cur_bimc_bw = cur_bimc_bw; -+ __entry->cur_mdp_bw = cur_mdp_bw; -+ ), -+ -+ TP_printk("cur_bimc_bw = %llu cur_mdp_bw = %llu", -+ (unsigned long long)__entry->cur_bimc_bw, -+ (unsigned long long)__entry->cur_mdp_bw) -+); -+ -+TRACE_EVENT(bus_rules_matches, -+ -+ TP_PROTO(int node_id, int rule_id, unsigned long long node_ab, -+ unsigned long long node_ib, unsigned long long node_clk), -+ -+ TP_ARGS(node_id, rule_id, node_ab, node_ib, node_clk), -+ -+ TP_STRUCT__entry( -+ __field(int, node_id) -+ __field(int, rule_id) -+ __field(u64, node_ab) -+ __field(u64, node_ib) -+ __field(u64, node_clk) -+ ), -+ -+ TP_fast_assign( -+ __entry->node_id = node_id; -+ __entry->rule_id = rule_id; -+ __entry->node_ab = node_ab; -+ __entry->node_ib = node_ib; -+ __entry->node_clk = node_clk; -+ ), -+ -+ TP_printk("Rule match node%d rule%d node-ab%llu:ib%llu:clk%llu", -+ __entry->node_id, __entry->rule_id, -+ (unsigned long long)__entry->node_ab, -+ (unsigned long long)__entry->node_ib, -+ (unsigned long long)__entry->node_clk) -+); -+ -+TRACE_EVENT(bus_bke_params, -+ -+ TP_PROTO(u32 gc, u32 gp, u32 thl, u32 thm, u32 thh), -+ -+ TP_ARGS(gc, gp, thl, thm, thh), -+ -+ TP_STRUCT__entry( -+ __field(u32, gc) -+ __field(u32, gp) -+ __field(u32, thl) -+ __field(u32, thm) -+ __field(u32, thh) -+ ), -+ -+ TP_fast_assign( -+ __entry->gc = gc; -+ __entry->gp = gp; -+ __entry->thl = thl; -+ __entry->thm = thm; -+ __entry->thh = thh; -+ ), -+ -+ TP_printk("BKE Params GC=0x%x GP=0x%x THL=0x%x THM=0x%x THH=0x%x", -+ __entry->gc, __entry->gp, __entry->thl, __entry->thm, -+ __entry->thh) -+); -+ -+#endif -+#define TRACE_INCLUDE_FILE trace_msm_bus -+#include diff --git a/target/linux/ipq806x/patches-4.9/850-soc-add-qualcomm-syscon.patch b/target/linux/ipq806x/patches-4.9/850-soc-add-qualcomm-syscon.patch deleted file mode 100644 index beb85e7ef..000000000 --- a/target/linux/ipq806x/patches-4.9/850-soc-add-qualcomm-syscon.patch +++ /dev/null @@ -1,177 +0,0 @@ -From: Christian Lamparter -Subject: SoC: add qualcomm syscon ---- a/drivers/soc/qcom/Makefile -+++ b/drivers/soc/qcom/Makefile -@@ -7,3 +7,4 @@ obj-$(CONFIG_QCOM_SMEM_STATE) += smem_st - obj-$(CONFIG_QCOM_SMP2P) += smp2p.o - obj-$(CONFIG_QCOM_SMSM) += smsm.o - obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o -+obj-$(CONFIG_QCOM_TCSR) += qcom_tcsr.o ---- a/drivers/soc/qcom/Kconfig -+++ b/drivers/soc/qcom/Kconfig -@@ -70,6 +70,13 @@ config QCOM_SMSM - Say yes here to support the Qualcomm Shared Memory State Machine. - The state machine is represented by bits in shared memory. - -+config QCOM_TCSR -+ tristate "QCOM Top Control and Status Registers" -+ depends on ARCH_QCOM -+ help -+ Say y here to enable TCSR support. The TCSR provides control -+ functions for various peripherals. -+ - config QCOM_WCNSS_CTRL - tristate "Qualcomm WCNSS control driver" - depends on QCOM_SMD ---- /dev/null -+++ b/drivers/soc/qcom/qcom_tcsr.c -@@ -0,0 +1,98 @@ -+/* -+ * Copyright (c) 2014, The Linux foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License rev 2 and -+ * only rev 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. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define TCSR_USB_PORT_SEL 0xb0 -+#define TCSR_USB_HSPHY_CONFIG 0xC -+ -+#define TCSR_ESS_INTERFACE_SEL_OFFSET 0x0 -+#define TCSR_ESS_INTERFACE_SEL_MASK 0xf -+ -+#define TCSR_WIFI0_GLB_CFG_OFFSET 0x0 -+#define TCSR_WIFI1_GLB_CFG_OFFSET 0x4 -+#define TCSR_PNOC_SNOC_MEMTYPE_M0_M2 0x4 -+ -+static int tcsr_probe(struct platform_device *pdev) -+{ -+ struct resource *res; -+ const struct device_node *node = pdev->dev.of_node; -+ void __iomem *base; -+ u32 val; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(base)) -+ return PTR_ERR(base); -+ -+ if (!of_property_read_u32(node, "qcom,usb-ctrl-select", &val)) { -+ dev_err(&pdev->dev, "setting usb port select = %d\n", val); -+ writel(val, base + TCSR_USB_PORT_SEL); -+ } -+ -+ if (!of_property_read_u32(node, "qcom,usb-hsphy-mode-select", &val)) { -+ dev_info(&pdev->dev, "setting usb hs phy mode select = %x\n", val); -+ writel(val, base + TCSR_USB_HSPHY_CONFIG); -+ } -+ -+ if (!of_property_read_u32(node, "qcom,ess-interface-select", &val)) { -+ u32 tmp = 0; -+ dev_info(&pdev->dev, "setting ess interface select = %x\n", val); -+ tmp = readl(base + TCSR_ESS_INTERFACE_SEL_OFFSET); -+ tmp = tmp & (~TCSR_ESS_INTERFACE_SEL_MASK); -+ tmp = tmp | (val&TCSR_ESS_INTERFACE_SEL_MASK); -+ writel(tmp, base + TCSR_ESS_INTERFACE_SEL_OFFSET); -+ } -+ -+ if (!of_property_read_u32(node, "qcom,wifi_glb_cfg", &val)) { -+ dev_info(&pdev->dev, "setting wifi_glb_cfg = %x\n", val); -+ writel(val, base + TCSR_WIFI0_GLB_CFG_OFFSET); -+ writel(val, base + TCSR_WIFI1_GLB_CFG_OFFSET); -+ } -+ -+ if (!of_property_read_u32(node, "qcom,wifi_noc_memtype_m0_m2", &val)) { -+ dev_info(&pdev->dev, -+ "setting wifi_noc_memtype_m0_m2 = %x\n", val); -+ writel(val, base + TCSR_PNOC_SNOC_MEMTYPE_M0_M2); -+ } -+ -+ return 0; -+} -+ -+static const struct of_device_id tcsr_dt_match[] = { -+ { .compatible = "qcom,tcsr", }, -+ { }, -+}; -+ -+MODULE_DEVICE_TABLE(of, tcsr_dt_match); -+ -+static struct platform_driver tcsr_driver = { -+ .driver = { -+ .name = "tcsr", -+ .owner = THIS_MODULE, -+ .of_match_table = tcsr_dt_match, -+ }, -+ .probe = tcsr_probe, -+}; -+ -+module_platform_driver(tcsr_driver); -+ -+MODULE_AUTHOR("Andy Gross "); -+MODULE_DESCRIPTION("QCOM TCSR driver"); -+MODULE_LICENSE("GPL v2"); ---- /dev/null -+++ b/include/dt-bindings/soc/qcom,tcsr.h -@@ -0,0 +1,48 @@ -+/* Copyright (c) 2014, The Linux Foundation. All rights reserved. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 and -+ * only 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. -+ */ -+#ifndef __DT_BINDINGS_QCOM_TCSR_H -+#define __DT_BINDINGS_QCOM_TCSR_H -+ -+#define TCSR_USB_SELECT_USB3_P0 0x1 -+#define TCSR_USB_SELECT_USB3_P1 0x2 -+#define TCSR_USB_SELECT_USB3_DUAL 0x3 -+ -+/* IPQ40xx HS PHY Mode Select */ -+#define TCSR_USB_HSPHY_HOST_MODE 0x00E700E7 -+#define TCSR_USB_HSPHY_DEVICE_MODE 0x00C700E7 -+ -+/* IPQ40xx ess interface mode select */ -+#define TCSR_ESS_PSGMII 0 -+#define TCSR_ESS_PSGMII_RGMII5 1 -+#define TCSR_ESS_PSGMII_RMII0 2 -+#define TCSR_ESS_PSGMII_RMII1 4 -+#define TCSR_ESS_PSGMII_RMII0_RMII1 6 -+#define TCSR_ESS_PSGMII_RGMII4 9 -+ -+/* -+ * IPQ40xx WiFi Global Config -+ * Bit 30:AXID_EN -+ * Enable AXI master bus Axid translating to confirm all txn submitted by order -+ * Bit 24: Use locally generated socslv_wxi_bvalid -+ * 1: use locally generate socslv_wxi_bvalid for performance. -+ * 0: use SNOC socslv_wxi_bvalid. -+ */ -+#define TCSR_WIFI_GLB_CFG 0x41000000 -+ -+/* IPQ40xx MEM_TYPE_SEL_M0_M2 Select Bit 26:24 - 2 NORMAL */ -+#define TCSR_WIFI_NOC_MEMTYPE_M0_M2 0x02222222 -+ -+/* TCSR A/B REG */ -+#define IPQ806X_TCSR_REG_A_ADM_CRCI_MUX_SEL 0 -+#define IPQ806X_TCSR_REG_B_ADM_CRCI_MUX_SEL 1 -+ -+#endif diff --git a/target/linux/ixp4xx/patches-4.9/160-delayed_uart_io.patch b/target/linux/ixp4xx/patches-4.9/160-delayed_uart_io.patch index 40e830dbc..c510e42bb 100644 --- a/target/linux/ixp4xx/patches-4.9/160-delayed_uart_io.patch +++ b/target/linux/ixp4xx/patches-4.9/160-delayed_uart_io.patch @@ -64,7 +64,7 @@ unsigned int custom_divisor; --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c -@@ -384,6 +384,20 @@ static unsigned int mem16_serial_in(stru +@@ -383,6 +383,20 @@ static unsigned int mem16_serial_in(stru return readw(p->membase + offset); } @@ -85,7 +85,7 @@ static void mem32_serial_out(struct uart_port *p, int offset, int value) { offset = offset << p->regshift; -@@ -456,6 +470,11 @@ static void set_io_from_upio(struct uart +@@ -455,6 +469,11 @@ static void set_io_from_upio(struct uart p->serial_out = mem32be_serial_out; break; @@ -97,7 +97,7 @@ #ifdef CONFIG_SERIAL_8250_RT288X case UPIO_AU: p->serial_in = au_serial_in; -@@ -483,6 +502,7 @@ serial_port_out_sync(struct uart_port *p +@@ -482,6 +501,7 @@ serial_port_out_sync(struct uart_port *p case UPIO_MEM16: case UPIO_MEM32: case UPIO_MEM32BE: @@ -105,7 +105,7 @@ case UPIO_AU: p->serial_out(p, offset, value); p->serial_in(p, UART_LCR); /* safe, no side-effects */ -@@ -2760,6 +2780,7 @@ static int serial8250_request_std_resour +@@ -2759,6 +2779,7 @@ static int serial8250_request_std_resour case UPIO_MEM32BE: case UPIO_MEM16: case UPIO_MEM: @@ -113,7 +113,7 @@ if (!port->mapbase) break; -@@ -2798,6 +2819,7 @@ static void serial8250_release_std_resou +@@ -2797,6 +2818,7 @@ static void serial8250_release_std_resou case UPIO_MEM32BE: case UPIO_MEM16: case UPIO_MEM: diff --git a/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch b/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch index 80688a4c0..046ec4e8f 100644 --- a/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch +++ b/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch @@ -10,7 +10,7 @@ /* Get the HEAD */ skb = kmem_cache_alloc_node(cache, gfp_mask & ~__GFP_DMA, node); -@@ -1223,6 +1226,10 @@ int pskb_expand_head(struct sk_buff *skb +@@ -1224,6 +1227,10 @@ int pskb_expand_head(struct sk_buff *skb if (skb_shared(skb)) BUG(); diff --git a/target/linux/kirkwood/config-4.14 b/target/linux/kirkwood/config-4.14 index 3ea1a9b41..95c01d750 100644 --- a/target/linux/kirkwood/config-4.14 +++ b/target/linux/kirkwood/config-4.14 @@ -28,7 +28,6 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARCH_WANT_LIBATA_LEDS=y @@ -103,21 +102,16 @@ CONFIG_DEBUG_UART_VIRT=0xfed12000 CONFIG_DEBUG_UNCOMPRESS=y # CONFIG_DEBUG_USER is not set # CONFIG_DLCI is not set -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set CONFIG_DNOTIFY=y -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y # CONFIG_EARLY_PRINTK is not set CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y -CONFIG_EXPORTFS=y CONFIG_EXT4_FS=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FRAME_POINTER=y CONFIG_FS_MBCACHE=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_BUG=y @@ -323,7 +317,6 @@ CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_GOV_STEP_WISE=y CONFIG_THERMAL_OF=y -CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index 39d93275f..fdf86099b 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -64,7 +64,7 @@ TARGET_DEVICES += iom_iconnect-1.1 define Device/linksys_audi DEVICE_TITLE := Linksys EA3500 (Audi) - DEVICE_PACKAGES := kmod-mwl8k swconfig wpad-mini + DEVICE_PACKAGES := kmod-mwl8k swconfig wpad-mini kmod-gpio-button-hotplug DEVICE_DTS := kirkwood-linksys-audi KERNEL_SIZE := 2624k KERNEL_IN_UBI := 0 @@ -77,7 +77,7 @@ TARGET_DEVICES += linksys_audi define Device/linksys_viper DEVICE_TITLE := Linksys E4200v2 / EA4500 (Viper) - DEVICE_PACKAGES := kmod-mwl8k swconfig wpad-mini + DEVICE_PACKAGES := kmod-mwl8k swconfig wpad-mini kmod-gpio-button-hotplug DEVICE_DTS := kirkwood-linksys-viper KERNEL_SIZE := 2688k KERNEL_IN_UBI := 0 diff --git a/target/linux/lantiq/Makefile b/target/linux/lantiq/Makefile index 2180b8394..4ae3a9ab0 100644 --- a/target/linux/lantiq/Makefile +++ b/target/linux/lantiq/Makefile @@ -12,7 +12,7 @@ FEATURES:=squashfs SUBTARGETS:=xrx200 xway xway_legacy falcon ase MAINTAINER:=John Crispin -KERNEL_PATCHVER:=4.14 +KERNEL_PATCHVER:=4.9 define Target/Description Build firmware images for Lantiq SoC diff --git a/target/linux/lantiq/ase/config-4.9 b/target/linux/lantiq/ase/config-4.9 new file mode 100644 index 000000000..0dfd21436 --- /dev/null +++ b/target/linux/lantiq/ase/config-4.9 @@ -0,0 +1,24 @@ +CONFIG_ADM6996_PHY=y +CONFIG_CPU_MIPS32_R1=y +# CONFIG_CPU_MIPS32_R2 is not set +CONFIG_CPU_MIPSR1=y +CONFIG_CRC16=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_FIRMWARE_MEMMAP=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_ISDN is not set +# CONFIG_LBDAF is not set +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_NLS=y +# CONFIG_PSB6970_PHY is not set +# CONFIG_RTL8366_SMI is not set +CONFIG_SOC_AMAZON_SE=y +# CONFIG_SOC_XWAY is not set +CONFIG_USB=y +CONFIG_USB_COMMON=y +# CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_SUPPORT=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/lantiq/base-files/etc/board.d/01_leds b/target/linux/lantiq/base-files/etc/board.d/01_leds index 4476a7eb4..0426fb18e 100755 --- a/target/linux/lantiq/base-files/etc/board.d/01_leds +++ b/target/linux/lantiq/base-files/etc/board.d/01_leds @@ -53,10 +53,6 @@ bt,homehub-v5a) netgear,dm200) ucidef_set_led_netdev "lan" "lan" "dm200:green:lan" "eth0" ;; -avm,fritz3370-rev2-hynix|\ -avm,fritz3370-rev2-micron) - ucidef_set_led_switch "lan" "LAN" "fritz3370:green:lan" "switch0" "0x17" - ;; avm,fritz7320) ucidef_set_led_netdev "wifi" "wifi" "fritz7320:green:wlan" "wlan0" ;; diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network b/target/linux/lantiq/base-files/etc/board.d/02_network index 9da01d14c..31eec377e 100755 --- a/target/linux/lantiq/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/base-files/etc/board.d/02_network @@ -135,13 +135,10 @@ lantiq,easy80920-nand|lantiq,easy80920-nor) "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" ;; -avm,fritz3370-rev2-hynix|\ -avm,fritz3370-rev2-micron) +avm,fritz3370) annex="b" - lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) - wan_mac=$(macaddr_add "$lan_mac" 3) - ucidef_add_switch "switch0" \ - "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" + wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 2439)" 1) + ucidef_set_interface_lan 'eth0' ;; avm,fritz7320) @@ -191,7 +188,7 @@ arcadyan,vg3503j) lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) wan_mac=$(macaddr_add "$lan_mac" 1) ucidef_add_switch "switch0" \ - "2:lan:1" "4:lan:2" "6t@eth0" + "2:lan:2" "4:lan:1" "6t@eth0" ;; tplink,vr200v) diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index 75b763076..498a50901 100644 --- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -47,24 +47,6 @@ ath9k_eeprom_extract_raw() { ath9k_eeprom_die "failed to extract from $mtd" } -ath9k_eeprom_extract_reverse() { - local part=$1 - local offset=$2 - local count=$3 - local mtd - local reversed - local caldata - - mtd=$(find_mtd_chardev "$part") - reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd) - - for byte in $reversed; do - caldata="\x${byte}${caldata}" - done - - printf "%b" "$caldata" > /lib/firmware/$FIRMWARE -} - ath9k_eeprom_extract() { local part=$1 local offset=$2 @@ -156,11 +138,7 @@ case "$FIRMWARE" in ath9k_eeprom_extract "calibration" 61440 0 ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 524 ;; - avm,fritz3370-rev2-hynix|\ - avm,fritz3370-rev2-micron) - ath9k_eeprom_extract_reverse "urlader" 5441 1088 - ;; - avm,fritz7320|avm,fritz7360sl) + avm,fritz3370|avm,fritz7320|avm,fritz7360sl) ath9k_eeprom_extract "urlader" 2437 0 ;; tplink,tdw8970|tplink,tdw8980) diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/base-files/lib/upgrade/platform.sh index ecbb939e3..2e58cb799 100755 --- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh +++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh @@ -9,13 +9,7 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in - avm,fritz3370-rev2-hynix|\ - avm,fritz3370-rev2-micron|\ - bt,homehub-v2b|\ - bt,homehub-v3a|\ - bt,homehub-v5a|\ - zyxel,p-2812hnu-f1|\ - zyxel,p-2812hnu-f3) + bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3) nand_do_upgrade $1 ;; *) diff --git a/target/linux/ath79/config-4.14 b/target/linux/lantiq/config-4.9 similarity index 66% rename from target/linux/ath79/config-4.14 rename to target/linux/lantiq/config-4.9 index 0e24582cc..a98509e5d 100644 --- a/target/linux/ath79/config-4.14 +++ b/target/linux/lantiq/config-4.9 @@ -1,8 +1,3 @@ -CONFIG_AG71XX=y -# CONFIG_AG71XX_DEBUG is not set -CONFIG_AG71XX_DEBUG_FS=y -CONFIG_AR8216_PHY=y -CONFIG_AR8216_PHY_LEDS=y CONFIG_ARCH_BINFMT_ELF_STATE=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_ARCH_DISCARD_MEMBLOCK=y @@ -10,38 +5,23 @@ 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_HAS_STRICT_KERNEL_RWX is not set -# CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not set CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_MMAP_RND_BITS_MAX=15 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 -# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set -# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_AT803X_PHY=y -CONFIG_ATH79=y -CONFIG_ATH79_WDT=y CONFIG_CEVT_R4K=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -CONFIG_COMMON_CLK=y -# CONFIG_COMMON_CLK_BOSTON is not set CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_GENERIC_DUMP_TLB=y CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_RIXI=y CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_MIPS32=y +# CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y CONFIG_CPU_MIPSR2=y CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y @@ -50,37 +30,31 @@ CONFIG_CPU_R4K_FPU=y CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CPU_SUPPORTS_MSA=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_WORKQUEUE=y CONFIG_CSRC_R4K=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y +# CONFIG_DT_EASY50712 is not set CONFIG_EARLY_PRINTK=y CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_FIXED_PHY=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_IO=y CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_PINCTRL_GROUPS=y -CONFIG_GENERIC_PINMUX_FUNCTIONS=y CONFIG_GENERIC_SCHED_CLOCK=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_74X164=y -CONFIG_GPIO_ATH79=y -CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_MM_LANTIQ=y +CONFIG_GPIO_STP_XWAY=y CONFIG_GPIO_SYSFS=y -# CONFIG_GRO_CELLS is not set CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y @@ -96,9 +70,7 @@ CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_CBPF_JIT=y CONFIG_HAVE_CC_STACKPROTECTOR=y CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_HAVE_C_RECORDMCOUNT=y CONFIG_HAVE_DEBUG_KMEMLEAK=y CONFIG_HAVE_DEBUG_STACKOVERFLOW=y @@ -124,30 +96,29 @@ CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HW_HAS_PCI=y +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y CONFIG_HZ_PERIODIC=y -CONFIG_IMAGE_CMDLINE_HACK=y CONFIG_INITRAMFS_SOURCE="" -CONFIG_IP17XX_PHY=y CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_WORK=y +CONFIG_LANTIQ=y +CONFIG_LANTIQ_DT_NONE=y +CONFIG_LANTIQ_ETOP=y +CONFIG_LANTIQ_WDT=y +# CONFIG_LANTIQ_XRX200 is not set CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_RESET is not set CONFIG_LIBFDT=y -CONFIG_MARVELL_PHY=y -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_GPIO=y -CONFIG_MFD_SYSCON=y -CONFIG_MICREL_PHY=y +CONFIG_MDIO_BOARDINFO=y CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 CONFIG_MIPS_CLOCK_VSYSCALL=y -# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set # CONFIG_MIPS_CMDLINE_DTB_EXTEND is not set # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set CONFIG_MIPS_CMDLINE_FROM_DTB=y @@ -155,27 +126,24 @@ CONFIG_MIPS_CMDLINE_FROM_DTB=y # CONFIG_MIPS_HUGE_TLB_SUPPORT is not set CONFIG_MIPS_L1_CACHE_SHIFT=5 # CONFIG_MIPS_MACHINE is not set +# CONFIG_MIPS_MT_SMP is not set # CONFIG_MIPS_NO_APPENDED_DTB is not set CONFIG_MIPS_RAW_APPENDED_DTB=y CONFIG_MIPS_SPRAM=y +# CONFIG_MIPS_VPE_LOADER is not set CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_GEOMETRY=y -# CONFIG_MTD_CFI_I2 is not set -# CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_JEDECPROBE=y +CONFIG_MTD_LANTIQ=y CONFIG_MTD_M25P80=y -# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set -CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPLIT_BRNIMAGE_FW=y +CONFIG_MTD_SPLIT_EVA_FW=y CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_LZMA_FW=y -CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y -CONFIG_MTD_SPLIT_WRGG_FW=y -CONFIG_MTD_TPLINK_PARTS=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y @@ -192,48 +160,40 @@ CONFIG_PCI_DRIVERS_LEGACY=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y -# CONFIG_PHY_AR7100_USB is not set -# CONFIG_PHY_AR7200_USB is not set CONFIG_PINCTRL=y -CONFIG_RATIONAL=y -# CONFIG_RCU_NEED_SEGCBLIST is not set +CONFIG_PINCTRL_LANTIQ=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_PINCTRL_XWAY=y +CONFIG_PSB6970_PHY=y # CONFIG_RCU_STALL_COMMON is not set -CONFIG_REGMAP=y -CONFIG_REGMAP_MMIO=y -CONFIG_RESET_ATH79=y CONFIG_RESET_CONTROLLER=y CONFIG_RTL8366RB_PHY=y -CONFIG_RTL8366S_PHY=y CONFIG_RTL8366_SMI=y # CONFIG_SCHED_INFO is not set # CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250_FSL is not set -CONFIG_SERIAL_8250_NR_UARTS=1 -CONFIG_SERIAL_8250_RUNTIME_UARTS=1 -CONFIG_SERIAL_AR933X=y -CONFIG_SERIAL_AR933X_CONSOLE=y -CONFIG_SERIAL_AR933X_NR_UARTS=2 -CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SENSORS_LTQ_CPUTEMP is not set +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_LANTIQ=y +# CONFIG_SOC_AMAZON_SE is not set +# CONFIG_SOC_FALCON is not set +CONFIG_SOC_TYPE_XWAY=y +CONFIG_SOC_XWAY=y CONFIG_SPI=y -CONFIG_SPI_ATH79=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y +CONFIG_SPI_LANTIQ_SSC=y CONFIG_SPI_MASTER=y -# CONFIG_SPI_RB4XX is not set CONFIG_SRCU=y +CONFIG_SWAP_IO_SPACE=y CONFIG_SWCONFIG=y -CONFIG_SWCONFIG_LEDS=y CONFIG_SWPHY=y CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_HAS_CPU_MIPS32_R2=y CONFIG_SYS_HAS_EARLY_PRINTK=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y CONFIG_SYS_SUPPORTS_MIPS16=y -CONFIG_SYS_SUPPORTS_ZBOOT=y -CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM=y +CONFIG_SYS_SUPPORTS_MULTITHREADING=y CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TINY_SRCU=y -CONFIG_USB_SUPPORT=y CONFIG_USE_OF=y +# CONFIG_XRX200_PHY_FW is not set diff --git a/target/linux/lantiq/falcon/config-4.9 b/target/linux/lantiq/falcon/config-4.9 new file mode 100644 index 000000000..de4fa3686 --- /dev/null +++ b/target/linux/lantiq/falcon/config-4.9 @@ -0,0 +1,10 @@ +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_SPLIT_FIRMWARE_NAME="linux" +CONFIG_PINCTRL_FALCON=y +# CONFIG_PSB6970_PHY is not set +# CONFIG_RTL8366_SMI is not set +CONFIG_SOC_FALCON=y +# CONFIG_SOC_TYPE_XWAY is not set +# CONFIG_SOC_XWAY is not set +CONFIG_SPI_FALCON=y diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ACMP252.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ACMP252.dts index 5a2d86719..5e1f27160 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ACMP252.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ACMP252.dts @@ -101,11 +101,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4518PWR01.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4518PWR01.dtsi index e95c40368..458a38753 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4518PWR01.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4518PWR01.dtsi @@ -192,11 +192,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4519PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4519PW.dts index 690c12f42..5733d2ce1 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4519PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4519PW.dts @@ -189,11 +189,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4520PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4520PW.dts index 68d6dc3e7..aa4269305 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4520PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV4520PW.dts @@ -213,11 +213,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV452CQW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV452CQW.dts index 3854ac2db..1e1183d1b 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV452CQW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV452CQW.dts @@ -231,11 +231,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7510PW22.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7510PW22.dts index 2c52ec62b..337f969b3 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7510PW22.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7510PW22.dts @@ -195,11 +195,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts index a033b0de7..1d6f404ee 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7518PW.dts @@ -227,11 +227,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519RW22.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519RW22.dts index 2d557f473..40607aebd 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519RW22.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV7519RW22.dts @@ -236,18 +236,18 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW.dts index 911e71a2c..7b337b4f5 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW.dts @@ -232,11 +232,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW22.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW22.dts index 88d9d7fdc..feb92d4d9 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW22.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV752DPW22.dts @@ -254,11 +254,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV8539PW22.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV8539PW22.dts index 7b201ff8d..1e39380f6 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV8539PW22.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/ARV8539PW22.dts @@ -178,11 +178,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV3A.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV3A.dts index d3e2bf761..6bba7e420 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV3A.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV3A.dts @@ -207,9 +207,9 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV5A.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV5A.dts index 90228667f..a3be0a5c9 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV5A.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/BTHOMEHUBV5A.dts @@ -291,9 +291,9 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY80920.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY80920.dtsi index b7cfc03a1..464ab5bd4 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY80920.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/EASY80920.dtsi @@ -304,9 +304,9 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-HYNIX.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-HYNIX.dts deleted file mode 100644 index 225a4f3e8..000000000 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-HYNIX.dts +++ /dev/null @@ -1,55 +0,0 @@ -/dts-v1/; - -#include "FRITZ3370-REV2.dtsi" - -/ { - compatible = "avm,fritz3370-rev2-hynix", "avm,fritz3370-rev2", "lantiq,xway", "lantiq,vr9"; - model = "AVM Fritz!Box WLAN 3370 Rev. 2 (Hynix NAND)"; -}; - -&localbus { - nand@1 { - compatible = "lantiq,nand-xway"; - bank-width = <2>; - reg = <1 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - nand-ecc-mode = "soft"; - nand-ecc-strength = <3>; - nand-ecc-step-size = <256>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "kernel"; - reg = <0x0 0x400000>; - }; - - partition@400000 { - label = "ubi"; - reg = <0x400000 0x3000000>; - }; - - partition@3400000 { - label = "reserved-kernel"; - reg = <0x3400000 0x400000>; - }; - partition@3800000 { - label = "reserved-filesystem"; - reg = <0x3800000 0x3000000>; - }; - partition@6800000 { - label = "config"; - reg = <0x6800000 0x200000>; - }; - partition@6a00000 { - label = "nand-filesystem"; - reg = <0x6a00000 0x1600000>; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-MICRON.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-MICRON.dts deleted file mode 100644 index 3346310b1..000000000 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2-MICRON.dts +++ /dev/null @@ -1,53 +0,0 @@ -/dts-v1/; - -#include "FRITZ3370-REV2.dtsi" - -/ { - compatible = "avm,fritz3370-rev2-micron", "avm,fritz3370-rev2", "lantiq,xway", "lantiq,vr9"; - model = "AVM Fritz!Box WLAN 3370 Rev. 2 (Micron NAND)"; -}; - -&localbus { - nand@1 { - compatible = "lantiq,nand-xway"; - bank-width = <2>; - reg = <1 0x0 0x2000000>; - #address-cells = <1>; - #size-cells = <1>; - - nand-ecc-mode = "on-die"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "kernel"; - reg = <0x0 0x400000>; - }; - - partition@400000 { - label = "ubi"; - reg = <0x400000 0x3000000>; - }; - - partition@3400000 { - label = "reserved-kernel"; - reg = <0x3400000 0x400000>; - }; - partition@3800000 { - label = "reserved-filesystem"; - reg = <0x3800000 0x3000000>; - }; - partition@6800000 { - label = "config"; - reg = <0x6800000 0x200000>; - }; - partition@6a00000 { - label = "nand-filesystem"; - reg = <0x6a00000 0x1600000>; - }; - }; - }; -}; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370.dts similarity index 78% rename from target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2.dtsi rename to target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370.dts index 815c01f89..a958fc67a 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370-REV2.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ3370.dts @@ -1,14 +1,16 @@ +/dts-v1/; + #include "vr9.dtsi" #include #include / { - compatible = "avm,fritz3370-rev2", "lantiq,xway", "lantiq,vr9"; - model = "AVM Fritz!Box WLAN 3370 Rev. 2"; + compatible = "avm,fritz3370", "lantiq,xway", "lantiq,vr9"; + model = "Fritz!Box WLAN 3370"; chosen { - bootargs = "console=ttyLTQ0,115200"; + bootargs = "console=ttyLTQ0,115200 ubi.mtd=1,512 root=/dev/mtdblock9"; }; aliases { @@ -25,28 +27,21 @@ reg = <0x0 0x8000000>; }; - gpio-poweroff { - compatible = "gpio-poweroff"; - gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; - }; - gpio-keys-polled { compatible = "gpio-keys-polled"; #address-cells = <1>; #size-cells = <0>; poll-interval = <100>; - power { label = "power"; gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; linux,code = ; }; - - wifi { - label = "wlan"; +/* wifi { + label = "wifi"; gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; - linux,code = ; - }; + linux,code = ; + };*/ }; gpio-leds { @@ -57,61 +52,31 @@ gpios = <&gpio 32 GPIO_ACTIVE_LOW>; default-state = "keep"; }; - power_red: power2 { label = "fritz3370:red:power"; gpios = <&gpio 33 GPIO_ACTIVE_LOW>; }; - info_red { label = "fritz3370:red:info"; gpios = <&gpio 34 GPIO_ACTIVE_LOW>; }; - wifi: wifi { label = "fritz3370:green:wlan"; gpios = <&gpio 35 GPIO_ACTIVE_LOW>; }; - dsl: dsl { label = "fritz3370:green:dsl"; gpios = <&gpio 36 GPIO_ACTIVE_LOW>; }; - lan { label = "fritz3370:green:lan"; gpios = <&gpio 38 GPIO_ACTIVE_LOW>; }; - info_green: info_green { label = "fritz3370:green:info"; gpios = <&gpio 47 GPIO_ACTIVE_LOW>; }; }; - - usb0_vbus: regulator-usb0-vbus { - compatible = "regulator-fixed"; - - regulator-name = "USB0_VBUS"; - - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - - gpio = <&gpio 14 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; - - usb1_vbus: regulator-usb1-vbus { - compatible = "regulator-fixed"; - - regulator-name = "USB1_VBUS"; - - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - - gpio = <&gpio 5 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; }; ð0 { @@ -120,6 +85,8 @@ #address-cells = <1>; #size-cells = <0>; reg = <0>; + mtd-mac-address = <&urlader 0x987>; + mtd-mac-address-increment = <(-2)>; lantiq,switch; ethernet@0 { @@ -129,7 +96,6 @@ phy-handle = <&phy0>; gpios = <&gpio 37 GPIO_ACTIVE_HIGH>; }; - ethernet@1 { compatible = "lantiq,xrx200-pdi-port"; reg = <1>; @@ -137,15 +103,13 @@ phy-handle = <&phy1>; gpios = <&gpio 44 GPIO_ACTIVE_HIGH>; }; - ethernet@2 { compatible = "lantiq,xrx200-pdi-port"; reg = <2>; phy-mode = "gmii"; phy-handle = <&phy11>; }; - - ethernet@4 { + ethernet@3 { compatible = "lantiq,xrx200-pdi-port"; reg = <4>; phy-mode = "gmii"; @@ -163,17 +127,14 @@ reg = <0x0>; compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; }; - phy1: ethernet-phy@1 { reg = <0x1>; compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; }; - phy11: ethernet-phy@11 { reg = <0x11>; compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; }; - phy13: ethernet-phy@13 { reg = <0x13>; compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; @@ -198,34 +159,29 @@ lantiq,groups = "mdio"; lantiq,function = "mdio"; }; - nand { lantiq,groups = "nand cle", "nand ale", "nand rd", "nand cs1", "nand rdy"; lantiq,function = "ebu"; lantiq,pull = <1>; }; - phy-rst { lantiq,pins = "io37", "io44"; lantiq,pull = <0>; lantiq,open-drain = <0>; lantiq,output = <1>; }; - pcie-rst { - lantiq,pins = "io21"; + lantiq,pins = "io38"; lantiq,pull = <0>; lantiq,output = <1>; }; }; - pins_spi_default: pins_spi_default { spi_in { lantiq,groups = "spi_di"; lantiq,function = "spi"; }; - spi_out { lantiq,groups = "spi_do", "spi_clk", "spi_cs4"; @@ -235,9 +191,50 @@ }; }; -&pcie0 { - gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; +&localbus { + nand@1 { + compatible = "lantiq,nand-xway"; + bank-width = <2>; + reg = <1 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "rootfs_ubi"; + reg = <0x400000 0x3000000>; + }; + + partition@3400000 { + label = "vr9_firmware"; + reg = <0x3400000 0x400000>; + }; + partition@3800000 { + label = "reserved"; + reg = <0x3800000 0x3000000>; + }; + partition@6800000 { + label = "config"; + reg = <0x6800000 0x200000>; + }; + partition@6a00000 { + label = "nand-filesystem"; + reg = <0x6a00000 0x1600000>; + }; + }; + }; +}; + +&pcie0 { pcie@0 { reg = <0 0 0 0 0>; #interrupt-cells = <1>; @@ -286,20 +283,14 @@ }; }; +/* + * TODO: add phy-supply, gpio 5 GPIO_ACTIVE_HIGH and gpio 14 GPIO_ACTIVE_HIGH are + * related + */ &usb_phy0 { status = "okay"; }; -&usb_phy1 { - status = "okay"; -}; - &usb0 { status = "okay"; - vbus-supply = <&usb0_vbus>; -}; - -&usb1 { - status = "okay"; - vbus-supply = <&usb1_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/GIGASX76X.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/GIGASX76X.dts index 36b82515d..fc028bb5f 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/GIGASX76X.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/GIGASX76X.dts @@ -117,11 +117,11 @@ &usb_phy { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/H201L.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/H201L.dts index 90f74bb38..43a4b42d8 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/H201L.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/H201L.dts @@ -165,10 +165,10 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2601HNFX.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2601HNFX.dts index 444dc563b..267a4f3a7 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2601HNFX.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2601HNFX.dts @@ -186,9 +186,9 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUFX.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUFX.dtsi index 579e562c3..03858afef 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUFX.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUFX.dtsi @@ -280,18 +280,18 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/TDW89X0.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/TDW89X0.dtsi index 233b7e333..e176bca30 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/TDW89X0.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/TDW89X0.dtsi @@ -281,18 +281,18 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7510KW22.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7510KW22.dtsi index ab558372e..8f22380cc 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7510KW22.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7510KW22.dtsi @@ -253,11 +253,11 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7519.dtsi b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7519.dtsi index b9276025b..297f5f7f4 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7519.dtsi +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VGV7519.dtsi @@ -288,20 +288,20 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; - vbus-supply = <&usb_vbus>; }; &vmmc { diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VR200v.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VR200v.dts index 331f08ed5..d0fcd6fcd 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VR200v.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/VR200v.dts @@ -288,18 +288,18 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR.dts index 02c118230..6bee3308a 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR.dts @@ -191,9 +191,9 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR300.dts b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR300.dts index df7bc9fce..4092b6b6e 100644 --- a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR300.dts +++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/WBMR300.dts @@ -312,18 +312,18 @@ &usb_phy0 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb_phy1 { status = "okay"; + phy-supply = <&usb_vbus>; }; &usb0 { status = "okay"; - vbus-supply = <&usb_vbus>; }; &usb1 { status = "okay"; - vbus-supply = <&usb_vbus>; }; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ACMP252.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ACMP252.dts new file mode 100644 index 000000000..729472011 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ACMP252.dts @@ -0,0 +1,102 @@ +/dts-v1/; + +#include "danube.dtsi" + +/ { + compatible = "audiocodes,mp-252", "lantiq,xway", "lantiq,danube"; + model = "AudioCodes MediaPack MP-252"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "uboot_env"; + reg = <0x20000 0x20000>; + }; + + partition@40000 { + label = "boardconfig"; + reg = <0x40000 0x60000>; + read-only; + }; + + partition@a0000 { + label = "firmware"; + reg = <0xa0000 0xf20000>; + }; + + partition@fc0000 { + label = "sysconfig"; + reg = <0xfc0000 0x40000>; + }; + + partition@0x1000000 { + label = "rootfs_data"; + reg = <0x1000000 0x1000000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + }; + pci { + lantiq,groups = "gnt1", "req1"; + lantiq,function = "pci"; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + + etop@E180000 { + phy-mode = "rmii"; + }; + + pci@E105400 { + status = "okay"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ALL0333CJ.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ALL0333CJ.dts new file mode 100644 index 000000000..16c5facb3 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ALL0333CJ.dts @@ -0,0 +1,120 @@ +/dts-v1/; + +#include "amazonse.dtsi" + +/ { + compatible = "allnet,all0333cj", "lantiq,xway", "lantiq,ase"; + model = "Allnet ALL0333CJ DSL Modem"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + + led-dsl = &dsl; + led-internet = &online_green; + }; + + }; + + memory@0 { + reg = <0x0 0x1000000>; + }; + + fpi@b0000000 { + etop@E180000 { + phy-mode = "mii"; + }; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + asc { + lantiq,groups = "asc"; + lantiq,function = "asc"; + }; + keys_in { + lantiq,pins = "io0",/* "io25", */"io29"; + lantiq,pull = <2>; + lantiq,open-drain = <1>; + }; + }; + }; + + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x400000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; + read-only; + }; + + partition@10000 { + label = "firmware"; + reg = <0x10000 0x3ef200>; + }; + + partition@3ff200 { + label = "uboot_env"; + reg = <0x3ff200 0xc00>; + read-only; + }; + + partition@3ffe00 { + label = "dummy_bits"; + reg = <0x3ffe00 0x200>; + read-only; + }; + }; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + /* power led: red=off, green=on */ + power: power { + label = "all0333cj:green:power"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + + lan: lan { + label = "all0333cj:green:lan"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + dsl: dsl { + label = "all0333cj:green:dsl"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + }; + + online_green: online { + label = "all0333cj:green:online"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + online_red { + label = "all0333cj:red:online"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4510PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4510PW.dts new file mode 100644 index 000000000..4720b57dd --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4510PW.dts @@ -0,0 +1,232 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv4510pw", "lantiq,xway", "lantiq,danube"; + model = "Wippies, Elisa"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power2; + led-running = &power; + + led-dsl = &adsl; + led-internet = &internet; + led-usb = &usb; + led-usb2 = &usb2; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x1000000>; + #address-cells = <1>; + #size-cells = <1>; + + lantiq,noxip; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "uboot_env"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "firmware"; + reg = <0x60000 0xfa0000>; + }; + }; + }; + }; + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu a23"; + lantiq,function = "ebu"; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + stp { + lantiq,groups = "stp"; + lantiq,function = "stp"; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + exin { + lantiq,groups = "exin1", "exin2"; + lantiq,function = "exin"; + lantiq,output = <0>; + }; + pci_in { + lantiq,groups = "req1", "req2"; + lantiq,function = "pci"; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1", "gnt2"; + lantiq,function = "pci"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + buttons { + lantiq,pins = "io3", "io14"; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + }; + }; + + gpios: stp@E100BB0 { + status = "okay"; + lantiq,groups = <0x7>; + }; + + etop@E180000 { + phy-mode = "rmii"; + }; + + pci@E105400 { + status = "okay"; + lantiq,external-clock; + interrupt-map = < + 0x6000 0 0 1 &icu0 135 + 0x7800 0 0 1 &icu0 66 + 0x7800 0 0 2 &icu0 66 + 0x7800 0 0 3 &icu0 66 + >; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + req-mask = <0x7>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power: power { + label = "power"; + gpios = <&gpios 21 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + power2: power2 { + label = "power2"; + gpios = <&gpios 20 GPIO_ACTIVE_HIGH>; + }; + lan1 { + label = "lan1"; + gpios = <&gpios 19 GPIO_ACTIVE_HIGH>; + }; + lan2 { + label = "lan2"; + gpios = <&gpios 18 GPIO_ACTIVE_HIGH>; + }; + lan3 { + label = "lan3"; + gpios = <&gpios 17 GPIO_ACTIVE_HIGH>; + }; + lan4 { + label = "lan4"; + gpios = <&gpios 16 GPIO_ACTIVE_HIGH>; + }; + wifi: wifi { + label = "wifi"; + gpios = <&gpios 15 GPIO_ACTIVE_HIGH>; + }; + adsl: adsl { + label = "adsl"; + gpios = <&gpios 14 GPIO_ACTIVE_HIGH>; + }; + internet: internet { + label = "internet"; + gpios = <&gpios 13 GPIO_ACTIVE_HIGH>; + }; + internet2 { + label = "internet2"; + gpios = <&gpios 12 GPIO_ACTIVE_HIGH>; + }; + voip { + label = "voip"; + gpios = <&gpios 11 GPIO_ACTIVE_HIGH>; + }; + phone { + label = "phone"; + gpios = <&gpios 10 GPIO_ACTIVE_HIGH>; + }; + phone2 { + label = "phone2"; + gpios = <&gpios 9 GPIO_ACTIVE_HIGH>; + }; + usb: usb { + label = "usb"; + gpios = <&gpios 8 GPIO_ACTIVE_HIGH>; + }; + usb2: usb2 { + label = "usb2"; + gpios = <&gpios 7 GPIO_ACTIVE_HIGH>; + }; + usb3 { + label = "usb3"; + gpios = <&gpios 6 GPIO_ACTIVE_HIGH>; + }; + unlabeled { + label = "unlabeled"; + gpios = <&gpios 5 GPIO_ACTIVE_HIGH>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dts new file mode 100644 index 000000000..34f868f48 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dts @@ -0,0 +1,8 @@ +/dts-v1/; + +#include "ARV4518PWR01.dtsi" + +/ { + compatible = "arcadyan,arv4518pwr01", "lantiq,xway", "lantiq,danube"; + model = "SMC7908A-ISP"; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dtsi new file mode 100644 index 000000000..8e712bfec --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01.dtsi @@ -0,0 +1,198 @@ +#include "danube.dtsi" + +#include + +/ { + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + + led-dsl = &dsl; + led-internet = &online; + led-usb = &usb; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; /* 64 KB */ + read-only; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; /* 64 KB */ + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x3d0000>; + }; + + boardconfig: partition@400000 { + label = "boardconfig"; + reg = <0x3f0000 0x10000>; + read-only; + }; + }; + }; + + gpiomm: gpiomm@4000000 { + compatible = "lantiq,gpio-mm"; + reg = <1 0x0 0x10 >; + #address-cells = <1>; + #size-cells = <1>; + #gpio-cells = <2>; + gpio-controller; + lantiq,shadow = <0x0>; + }; + + ath5k_eep { + compatible = "ath5k,eeprom"; + ath,eep-flash = <&boardconfig 0x400>; + ath,mac-offset = <0x16>; + ath,mac-increment = <1>; + ath,eep-swap; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu cs1"; + lantiq,function = "ebu"; + }; + pci_in { + lantiq,groups = "req1", "req2"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1", "gnt2"; + lantiq,function = "pci"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + + pci@E105400 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + req-mask = <0xf>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power: power { + label = "power"; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + dsl: dsl { + label = "dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + online: online { + label = "online"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "wifi"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + wps { + label = "wps"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + dsl2 { + label = "dsl2"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + usb: usb { + label = "usb"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + voice { + label = "voice"; + gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; + }; + fxs1 { + label = "fxs1"; + gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; + }; + fxs2 { + label = "fxs2"; + gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; + }; + fxo { + label = "fxo"; + gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01A.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01A.dts new file mode 100644 index 000000000..771d0146d --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4518PWR01A.dts @@ -0,0 +1,14 @@ +/dts-v1/; + +#include "ARV4518PWR01.dtsi" + +/ { + compatible = "arcadyan,arv4518pwr01a", "lantiq,xway", "lantiq,danube"; + model = "SMC7908A-ISP, Airties WAV-221"; + + fpi@10000000 { + pci@E105400 { + lantiq,external-clock; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4519PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4519PW.dts new file mode 100644 index 000000000..8f781760f --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4519PW.dts @@ -0,0 +1,195 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv4519pw", "lantiq,xway", "lantiq,danube"; + model = "Vodafone Netfaster IAD 2, Pirelli P.RG A4201G"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + led-internet = &internet_green; + led-usb = &usb; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; + read-only; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x3d0000>; + }; + + boardconfig: partition@3f0000 { + label = "boardconfig"; + reg = <0x3f0000 0x10000>; + read-only; + }; + }; + }; + + gpiomm: gpiomm@4000000 { + compatible = "lantiq,gpio-mm"; + reg = <1 0x0 0x10 >; + #address-cells = <1>; + #size-cells = <1>; + #gpio-cells = <2>; + gpio-controller; + lantiq,shadow = <0x400>; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu cs1"; + lantiq,function = "ebu"; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + + pci@E105400 { + status = "okay"; + lantiq,external-clock; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + req-mask = <0xf>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_green: power { + label = "arv4519pw:green:power"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power2 { + label = "arv4519pw:red:power"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "arv4519pw:green:wlan"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "arv4519pw:green:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + internet_green: online { + label = "arv4519pw:green:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + online2 { + label = "arv4519pw:red:internet"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + usb: usb { + label = "arv4519pw:green:usb"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + voip { + label = "arv4519pw:green:voip"; + gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; + }; + fxs1 { + label = "arv4519pw:green:phone1"; + gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; + }; + fxs2 { + label = "arv4519pw:green:phone2"; + gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; + }; + fxo { + label = "arv4519pw:green:line"; + gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; + }; + wps2 { + label = "arv4519pw:green:wps"; + gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; + }; + wps { + label = "arv4519pw:orange:wps"; + gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; + }; + wps3 { + label = "arv4519pw:red:wps"; + gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4520PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4520PW.dts new file mode 100644 index 000000000..05e0dfe04 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4520PW.dts @@ -0,0 +1,221 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv4520pw", "lantiq,xway", "lantiq,danube"; + model = "Easybox 800, WAV-281"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_blue; + led-failsafe = &power_red; + led-running = &power_blue; + + led-dsl = &dsl; + led-internet = &internet_blue; + led-usb = &usb; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH + &gpiomm 7 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x800000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x20000>; + read-only; + }; + + partition@20000 { + label = "uboot_env"; + reg = <0x20000 0x10000>; + read-only; + }; + + partition@30000 { + label = "firmware"; + reg = <0x30000 0x3c0000>; + }; + + boardconfig: partition@7f0000 { + label = "boardconfig"; + reg = <0x3f0000 0x10000>; + read-only; + }; + }; + }; + + gpiomm: gpiomm@4000000 { + compatible = "lantiq,gpio-mm"; + reg = <1 0x0 0x10 >; + #address-cells = <1>; + #size-cells = <1>; + #gpio-cells = <2>; + gpio-controller; + lantiq,shadow = <0x400>; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu cs1"; + lantiq,function = "ebu"; + }; + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + }; + }; + + etop@E180000 { + phy-mode = "rmii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; + }; + + pci@E105400 { + status = "okay"; + lantiq,external-clock; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + }; + +// gpiomm 10 - switch + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "wps"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_blue: power { + label = "arv4520pw:blue:power"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + dsl: dsl { + label = "arv4520pw:blue:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + internet_blue: internet { + label = "arv4520pw:blue:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + power_red: power2 { + label = "arv4520pw:red:power"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + wps { + label = "arv4520pw:yellow:wps"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + wps2 { + label = "arv4520pw:red:wps"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + }; + /* + wps green is missing + */ + fxs1 { + label = "arv4520pw:blue:telefon1"; + gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; + }; + fxs2 { + label = "arv4520pw:blue:telefon2"; + gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; + }; + isdn { + label = "arv4520pw:blue:isdn"; + gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; + }; + fxo { + label = "arv4520pw:blue:line"; + gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; + }; + voice { + label = "arv4520pw:blue:sprache"; + gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; + }; + usb: usb { + label = "arv4520pw:blue:usb"; + gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "arv4520pw:blue:wifi"; + gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; + }; + internet2 { + label = "arv4520pw:red:internet"; + gpios = <&gpiomm 9 GPIO_ACTIVE_LOW>; + }; + /* + info is missing + */ + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4525PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4525PW.dts new file mode 100644 index 000000000..61548c793 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV4525PW.dts @@ -0,0 +1,169 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv4525pw", "lantiq,xway", "lantiq,danube"; + model = "Speedport W501V Typ A"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + /* we dont have a power led, lets use the online led */ + led-boot = &online; + led-failsafe = &online; + + led-dsl = &dsl; + led-internet = &online; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; + read-only; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x3d0000>; + }; + + boardconfig: partition@400000 { + label = "boardconfig"; + reg = <0x3f0000 0x10000>; + read-only; + }; + }; + }; + + ath5k_eep { + compatible = "ath5k,eeprom"; + ath,eep-flash = <&boardconfig 0x400>; + ath,mac-offset = <0x0>; + ath,eep-swap; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + relay { + lantiq,pins = "io31"; + lantiq,output = <1>; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + + pci@E105400 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + }; + +/* +#define ARV4525PW_PHYRESET 13 +#define ARV4525PW_RELAY 31 +*/ + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + fxo { + label = "arv4525pw:green:festnetz"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + fxs { + label = "arv4525pw:green:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "arv4525pw:green:t-dsl"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "arv4525pw:green:wlan"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + online: online { + label = "arv4525pw:green:online"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV452CQW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV452CQW.dts new file mode 100644 index 000000000..d996e8b66 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV452CQW.dts @@ -0,0 +1,237 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv452cqw", "lantiq,xway", "lantiq,danube"; + model = "Arcor 801"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_blue; + led-failsafe = &power_red; + led-running = &power_blue; + + led-dsl = &dsl_blue; + led-usb = &usb; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH + &gpiomm 7 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x400000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; + read-only; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x3d0000>; + }; + + boardconfig: partition@3f0000 { + label = "boardconfig"; + reg = <0x3f0000 0x10000>; + read-only; + }; + }; + }; + + ath5k_eep { + compatible = "ath5k,eeprom"; + ath,eep-flash = <&boardconfig 0x400>; + ath,mac-offset = <0x0>; + ath,eep-swap; + }; + gpiomm: gpiomm@4000000 { + compatible = "lantiq,gpio-mm"; + reg = <1 0x0 0x10>; + #address-cells = <1>; + #size-cells = <1>; + #gpio-cells = <2>; + gpio-controller; + lantiq,shadow = <0x77f>; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu cs1"; + lantiq,function = "ebu"; + }; + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + leds { + lantiq,pins = "io3", "io5", "io6", "io7", "io9"; + lantiq,output = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; + }; + + etop@E180000 { + phy-mode = "rmii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + + pci@E105400 { + status = "okay"; + lantiq,external-clock; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + }; + +/* +#define ARV452CPW_SWITCH_RESET 110 +*/ + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power_blue: power0 { + label = "arv452cqw:blue:power"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + dsl_blue: dsl { + label = "arv452cqw:blue:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + isdn { + label = "arv452cqw:blue:isdn"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + power_red: power1 { + label = "arv452cqw:red:power"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + wps { + label = "arv452cqw:blue:wps"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + wps1 { + label = "arv452cqw:yellow:wps"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + }; + fxs1 { + label = "arv452cqw:blue:telefon1"; + gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; + }; + fxs2 { + label = "arv452cqw:blue:telefon2"; + gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; + }; + wps2 { + label = "arv452cqw:red:wps"; + gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; + }; + fxo { + label = "arv452cqw:blue:line"; + gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; + }; + voice { + label = "arv452cqw:blue:sprache"; + gpios = <&gpiomm 4 1>; + }; + usb: usb { + label = "arv452cqw:blue:usb"; + gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "arv452cqw:blue:wlan"; + gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; + }; + /* + internet blue and internet red are missing + dsl2 and dsl3 are not referenced in manual + */ + dsl2 { + label = "arv452cqw:yellow:dsl"; + gpios = <&gpiomm 8 GPIO_ACTIVE_LOW>; + }; + dsl3 { + label = "arv452cqw:red:dsl"; + gpios = <&gpiomm 9 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7506PW11.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7506PW11.dts new file mode 100644 index 000000000..3ec4bf41a --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7506PW11.dts @@ -0,0 +1,165 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv7506pw11", "lantiq,xway", "lantiq,danube"; + model = "Alice/O2 IAD 4421"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power_red; + led-running = &power; + + led-dsl = &dsl; + led-internet = &internet; + led-wifi = &wlan; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x800000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "uboot_env"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x7a0000>; + }; + + boardconfig: partition@7f0000 { + label = "board_config"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pci { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + }; + }; + + /* GPIO 19: switch reset */ + etop@E180000 { + phy-mode = "rmii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + wlan: wlan { + label = "arv7506pw11:green:wlan"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + power: power { + label = "arv7506pw11:green:power"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + dsl: dsl { + label = "arv7506pw11:green:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + internet: internet { + label = "arv7506pw11:green:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + power_red: power_red { + label = "arv7506pw11:red:power"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + internet_red { + label = "arv7506pw11:red:internet"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + info { + label = "arv7506pw11:green:info"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + telefon { + label = "arv7506pw11:green:telefon"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + }; + info_red { + label = "arv7506pw11:red:info"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + lantiq,external-clock; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + wifi@1814,3592 { + compatible = "pci1814,3592"; + reg = <0x7000 0 0 0 0>; + ralink,mtd-eeprom = <&boardconfig 0x410>; + ralink,mtd-eeprom-swap; + mtd-mac-address = <&boardconfig 0x16>; + mtd-mac-address-increment = <1>; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7510PW22.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7510PW22.dts new file mode 100644 index 000000000..dc3f614b9 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7510PW22.dts @@ -0,0 +1,196 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv7510pw22", "lantiq,xway", "lantiq,danube"; + model = "Astoria Networks ARV7510PW22"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + + led-dsl = &internet; + led-usb = &umts; + led-wifi = &wlan; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x1000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "uboot_env"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "firmware"; + reg = <0x60000 0xf80000>; + }; + + boardconfig: partition@fe0000 { + label = "board_config"; + reg = <0xfe0000 0x20000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_in { + lantiq,groups = "req1", "req2"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + pins_out { + lantiq,pins = "io2", "io4", "io8", "io9", "io10", "io15", "io20"; + lantiq,output = <1>; + }; + pins_in { + lantiq,pins = "io11", "io12", "io28"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + }; + + etop@E180000 { + /* Switch reset 19 */ + phy-mode = "mii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + restart { + label = "restart"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power: power { + label = "power"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + internet: internet { + label = "internet"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + wlan: wlan { + label = "wlan"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + }; + umts: 3g { + label = "3g"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + message { + label = "message"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + lantiq,external-clock; + interrupt-map = < + 0x7000 0 0 1 &icu0 30 + 0x7800 0 0 1 &icu0 135 + 0x7800 0 0 2 &icu0 135 + 0x7800 0 0 3 &icu0 135 + >; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + req-mask = <0x3>; + + wifi@1814,3592 { + compatible = "pci1814,3592"; + reg = <0x7000 0 0 0 0>; + ralink,mtd-eeprom = <&boardconfig 0x410>; + ralink,mtd-eeprom-swap; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7518PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7518PW.dts new file mode 100644 index 000000000..41b124932 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7518PW.dts @@ -0,0 +1,232 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv7518pw", "lantiq,xway", "lantiq,danube"; + model = "Astoria Networks ARV7518PW"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + led-internet = &online_green; + led-usb = &usb; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; + read-only; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7d0000>; + }; + + boardconfig: partition@400000 { + label = "boardconfig"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; + }; + + gpiomm: gpiomm@4000000 { + compatible = "lantiq,gpio-mm"; + reg = <1 0x0 0x10 >; + #address-cells = <1>; + #size-cells = <1>; + #gpio-cells = <2>; + gpio-controller; + lantiq,shadow = <0x0>; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu cs1"; + lantiq,function = "ebu"; + }; + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + leds { + lantiq,pins = "io2", "io4", "io5", "io6", "io7", "io8", "io19"; + lantiq,output = <1>; + }; + keys { + lantiq,pins = "io28", "io30"; + lantiq,output = <0>; + lantiq,pull = <2>; + lantiq,open-drain = <1>; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; + +/* +#define SWITCH_RESET 13 +*/ + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power_green: power { + label = "arv7518pw:green:power"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + dsl: dsl { + label = "arv7518pw:green:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + online_green: online { + label = "arv7518pw:green:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "arv7518pw:green:wlan"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + power_red: power2 { + label = "arv7518pw:red:power"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + online2 { + label = "arv7518pw:red:internet"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + usb: usb { + label = "arv7518pw:green:usb"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + voice { + label = "arv7518pw:green:voip"; + gpios = <&gpiomm 0 GPIO_ACTIVE_LOW>; + }; + fxs1 { + label = "arv7518pw:green:phone1"; + gpios = <&gpiomm 1 GPIO_ACTIVE_LOW>; + }; + fxs2 { + label = "arv7518pw:green:phone2"; + gpios = <&gpiomm 2 GPIO_ACTIVE_LOW>; + }; + unlabeled { + label = "arv7518pw:amber:unlabeled"; + gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; + }; + wps { + label = "arv7518pw:amber:wps"; + gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; + }; + wps2 { + label = "arv7518pw:green:wps"; + gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; + }; + wps3 { + label = "arv7518pw:red:wps"; + gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + lantiq,external-clock; + req-mask = <0xf>; + + wifi@168c,0029 { + compatible = "pci168c,0029"; + reg = <0x7000 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + mtd-mac-address = <&boardconfig 0x16>; + mtd-mac-address-increment = <1>; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519PW.dts new file mode 100644 index 000000000..9983a7906 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519PW.dts @@ -0,0 +1,229 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv7519pw", "lantiq,xway", "lantiq,danube"; + model = "Astoria Networks ARV7519PW"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power2; + led-running = &power; + + led-dsl = &dsl; + led-internet = &online; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "uboot_env"; + reg = <0x40000 0x20000>; + }; + + partition@60000 { + label = "firmware"; + reg = <0x60000 0xf80000>; + }; + + boardconfig: partition@fe0000 { + label = "board_config"; + reg = <0xfe0000 0x20000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu cs1"; + lantiq,function = "ebu"; + }; + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + switch_rst { + lantiq,pins = "io19"; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + + /* warning: passive port + only works with active devices */ + ifxhcd@E101000 { + status = "okay"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power: power { + label = "power"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power2: power2 { + label = "power2"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + online: online { + label = "online"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + online2 { + label = "online2"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "wifi"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + wifi2 { + label = "wifi2"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + }; + wifi3 { + label = "wifi3"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + voice { + label = "voice"; + gpios = <&gpio 31 GPIO_ACTIVE_LOW>; + }; + wps { + label = "wps"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + wps2 { + label = "wps2"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + wps3 { + label = "wps3"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + lan { + label = "lan"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + }; + tv { + label = "tv"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + upgrade { + label = "upgrade"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + }; + }; + + /* is there another way to "reserve" the GPIO? */ + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + switch { + gpio-export,name = "switch"; + gpio-export,output = <1>; + gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pci0 { + status = "okay"; + lantiq,external-clock; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + req-mask = <0xf>; + + wifi@0,0 { + compatible = "pci0,0"; + reg = <0x7000 0 0 0 0>; + ralink,mtd-eeprom = <&boardconfig 0x410>; + ralink,mtd-eeprom-swap; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519RW22.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519RW22.dts new file mode 100644 index 000000000..0bdc150a1 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7519RW22.dts @@ -0,0 +1,231 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "arcadyan,arv7519rw22", "lantiq,xway", "lantiq,vr9"; + model = "Orange Livebox 2.1"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_green; + led-running = &power_green; + + led-dsl = &internet_green; + }; + + memory@0 { + reg = <0x0 0x8000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x60000>; + read-only; + }; + + partition@60000 { + label = "uboot-env"; + reg = <0x60000 0x20000>; + read-only; + }; + + partition@80000 { + label = "firmware"; + reg = <0x80000 0x1f00000>; + }; + + boardconfig: partition@1f80000 { + label = "boardconfig"; + reg = <0x1f80000 0x80000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + pcie-rst { + lantiq,pins = "io21"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; + }; + + ifxhcd@E106000 { + status = "okay"; + gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; + }; + + pcie@d900000 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware1 = "lantiq/xrx200_phy22f_a14.bin"; /*VR9 1.1*/ + firmware2 = "lantiq/xrx200_phy22f_a22.bin"; /*VR9 1.2*/ + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + rfkill { + label = "rfkill"; + gpios = <&gpio 33 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + lan_green { + label = "arv7519rw22:green:lan"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + internet_red { + label = "arv7519rw22:red:internet"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + }; + power_green: power_green { + label = "arv7519rw22:green:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + alarm_blue { + label = "arv7519rw22:blue:alarm"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + internet_orange { + label = "arv7519rw22:orange:internet"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + internet_green: internet_green { + label = "arv7519rw22:green:internet"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + }; + voice_green { + label = "arv7519rw22:green:voice"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + mtd-mac-address = <&boardconfig 0x16>; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + }; + ethernet@1 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "mii"; + phy-handle = <&phy13>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "mii"; + phy-handle = <&phy14>; + }; + ethernet@3 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "mii"; + phy-handle = <&phy11>; + }; + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <3>; + phy-mode = "mii"; + phy-handle = <&phy12>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy0: ethernet-phy@0 { + reg = <0x0>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy12: ethernet-phy@12 { + reg = <0x12>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy14: ethernet-phy@14 { + reg = <0x14>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7525PW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7525PW.dts new file mode 100644 index 000000000..000753589 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV7525PW.dts @@ -0,0 +1,155 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv7525pw", "lantiq,xway", "lantiq,danube"; + model = "Speedport W303V Typ A"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &power_green; + led-internet = &online; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; + read-only; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x3d0000>; + }; + + boardconfig: partition@400000 { + label = "board_config"; + reg = <0x3f0000 0x10000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + }; + pci { + lantiq,groups = "gnt1", "req1"; + lantiq,function = "pci"; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power_green: power { + label = "arv7525pw:green:power"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power1 { + label = "arv7525pw:red:power"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + online: online { + label = "arv7525pw:green:online"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + voice { + label = "arv7525pw:green:telefonie"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + voice2 { + label = "arv7525pw:red:telefonie"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "arv7525pw:green:wlan"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + interrupt-map = <0x7000 0 0 1 &icu0 135 1>; + + wifi@0,0 { + compatible = "pci0,0"; + reg = <0x7000 0 0 0 0>; + ralink,mtd-eeprom = <&boardconfig 0x410>; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW.dts new file mode 100644 index 000000000..3591b4367 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW.dts @@ -0,0 +1,238 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv752dpw", "lantiq,xway", "lantiq,danube"; + model = "Arcor 802"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_red; + led-failsafe = &power_blue; + led-running = &power_red; + + led-dsl = &internet_red; + led-usb = &umts; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpiomm 1 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x800000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; + read-only; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7d0000>; + }; + + boardconfig: partition@7f0000 { + label = "board_config"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; + }; + + gpiomm: gpiomm@4000000 { + compatible = "lantiq,gpio-mm"; + reg = <1 0x0 0x10 >; + #address-cells = <1>; + #size-cells = <1>; + #gpio-cells = <2>; + gpio-controller; + lantiq,shadow = <0x3>; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu cs1"; + lantiq,function = "ebu"; + }; + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_in { + lantiq,groups = "req2", "req1"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + leds { + lantiq,pins = "io3", "io5", "io6", "io8"; + lantiq,output = <1>; + lantiq,pull = <0>; + }; + keys { + lantiq,pins = "io11", "io12", "io13", "io28"; + lantiq,output = <0>; + lantiq,pull = <2>; + lantiq,open-drain = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpiomm 0 GPIO_ACTIVE_HIGH>; + }; + + etop@E180000 { + phy-mode = "rmii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + restart { + label = "restart"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + dsl { + label = "dsl"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power_blue: power1 { + label = "arv752dpw:blue:power"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + internet_red: internet { + label = "arv752dpw:red:internet"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + message { + label = "arv752dpw:red:message"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + power_red: power { + label = "arv752dpw:red:power"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + voice1 { + label = "arv752dpw:red:voice"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + umts: umts { + label = "arv752dpw:red:umts"; + gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "arv752dpw:red:wifi"; + gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; + }; + fxs1 { + label = "arv752dpw:green:tae-n"; + gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; + }; + fxs2 { + label = "arv752dpw:green:tae-u"; + gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; + }; + fxo { + label = "arv752dpw:green:isdn"; + gpios = <&gpiomm 7 GPIO_ACTIVE_LOW>; + }; + internet2 { + label = "arv752dpw:blue:internet"; + gpios = <&gpiomm 8 GPIO_ACTIVE_LOW>; + }; + voice2 { + label = "arv752dpw:blue:voice"; + gpios = <&gpiomm 9 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + lantiq,external-clock; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + interrupt-map = <0x7000 0 0 1 &icu0 135>; + req-mask = <0x3>; + + wifi@1814,0601 { + compatible = "pci1814,0601"; + reg = <0x7000 0 0 0 0>; + ralink,mtd-eeprom = <&boardconfig 0x410>; + ralink,mtd-eeprom-swap; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW22.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW22.dts new file mode 100644 index 000000000..8b5be8b76 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV752DPW22.dts @@ -0,0 +1,259 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv752dpw22", "lantiq,xway", "lantiq,danube"; + model = "Arcor 803"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_red; + led-failsafe = &power_blue; + led-running = &power_red; + + led-dsl = &internet_red; + led-usb = &umts; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpiomm 1 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x800000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x30000>; + read-only; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x40000 0x7b0000>; + }; + + boardconfig: partition@7f0000 { + label = "board_config"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; + }; + + gpiomm: gpiomm@4000000 { + compatible = "lantiq,gpio-mm"; + reg = <1 0x0 0x10 >; + #address-cells = <1>; + #size-cells = <1>; + #gpio-cells = <2>; + gpio-controller; + lantiq,shadow = <3>; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + ebu { + lantiq,groups = "ebu cs1"; + lantiq,function = "ebu"; + }; + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,open-drain = <1>; + lantiq,output = <1>; + }; + leds { + lantiq,pins = "io3", "io5", "io6", "io8"; + lantiq,open-drain = <1>; + lantiq,output = <1>; + }; + buttons { + lantiq,pins = "io11", "io12", "io13", "io28"; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpiomm 0 GPIO_ACTIVE_HIGH>; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&boardconfig 0x16>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + restart { + label = "restart"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + dsl { + label = "dsl"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power_blue: power1 { + label = "arv752dpw22:blue:power"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + internet_red: internet { + label = "arv752dpw22:red:internet"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + message { + label = "arv752dpw22:red:message"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + power_red: power { + label = "arv752dpw22:red:power"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + voice1 { + label = "arv752dpw22:red:voice"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + umts: umts { + label = "arv752dpw22:red:umts"; + gpios = <&gpiomm 3 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "arv752dpw22:red:wifi"; + gpios = <&gpiomm 4 GPIO_ACTIVE_LOW>; + }; + fxs1 { + label = "arv752dpw22:green:tae-n"; + gpios = <&gpiomm 5 GPIO_ACTIVE_LOW>; + }; + fxs2 { + label = "arv752dpw22:green:tae-u"; + gpios = <&gpiomm 6 GPIO_ACTIVE_LOW>; + }; + fxo { + label = "arv752dpw22:green:isdn"; + gpios = <&gpiomm 7 GPIO_ACTIVE_LOW>; + }; + internet2 { + label = "arv752dpw22:blue:internet"; + gpios = <&gpiomm 8 GPIO_ACTIVE_LOW>; + }; + voice2 { + label = "arv752dpw22:blue:voice"; + gpios = <&gpiomm 9 GPIO_ACTIVE_LOW>; + }; + eth1 { + label = "arv752dpw22:green:lan1"; + gpios = <&gpiomm 11 GPIO_ACTIVE_LOW>; + }; + eth2 { + label = "arv752dpw22:green:lan2"; + gpios = <&gpiomm 12 GPIO_ACTIVE_LOW>; + }; + eth3 { + label = "arv752dpw22:green:lan3"; + gpios = <&gpiomm 13 GPIO_ACTIVE_LOW>; + }; + eth4 { + label = "arv752dpw22:green:lan4"; + gpios = <&gpiomm 14 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + lantiq,external-clock; + interrupt-map = < + 0x7000 0 0 1 &icu0 30 + 0x7800 0 0 1 &icu0 135 + 0x7800 0 0 2 &icu0 135 + 0x7800 0 0 3 &icu0 135 + >; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + req-mask = <0x3>; + + wifi@1814,3592 { + compatible = "pci1814,3592"; + reg = <0x7000 0 0 0 0>; + ralink,mtd-eeprom = <&boardconfig 0x410>; + ralink,mtd-eeprom-swap; + mtd-mac-address = <&boardconfig 0x16>; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV8539PW22.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV8539PW22.dts new file mode 100644 index 000000000..4edcde976 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ARV8539PW22.dts @@ -0,0 +1,180 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "arcadyan,arv8539pw22", "lantiq,xway", "lantiq,danube"; + model = "Speedport W 504V Typ A"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl_green; + led-internet = &online_green; + led-wifi = &wireless_green; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x800000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x30000>; /* 192 KiB */ + read-only; + }; + + partition@30000 { + label = "uboot"; + reg = <0x30000 0x10000>; /* 64 KiB */ + read-only; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x7B0000>; /* 7872 KiB */ + }; + + art: partition@7F0000 { + label = "art"; + reg = <0x7F0000 0x10000>; /* 64 KiB*/ + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + lantiq,output = <0>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + relay { + lantiq,pins = "io31"; + lantiq,output = <1>; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&art 0x16>; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + lantiq,portmask = <0x3>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wlan { + label = "wlan"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + /* key DECT is missing */ + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_green: power-green { + label = "arv8539pw22:green:power"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power-red { + label = "arv8539pw22:red:power"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + dsl_green: dsl-green { + label = "arv8539pw22:green:dsl"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + online_green: online-green { + label = "arv8539pw22:green:online"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + + wireless_green: wireless-green { + label = "arv8539pw22:green:wlan"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + /* + telefonie green is missing + */ + }; +}; + +&pci0 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + wifi@168c,0029 { + compatible = "pci168c,0029"; + reg = <0x7000 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + mtd-mac-address = <&art 0x16>; + mtd-mac-address-increment = <1>; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ASL56026.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ASL56026.dts new file mode 100644 index 000000000..2037f40f0 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ASL56026.dts @@ -0,0 +1,171 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "alphanetworks,asl56026", "lantiq,xway", "lantiq,vr9"; + model = "BT OpenReach VDSL Modem"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x0800000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + }; + + partition@30000 { + label = "uboot_env"; + reg = <0x30000 0x10000>; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x750000>; + }; + + partition@790000 { + label = "ddrconfig"; + reg = <0x790000 0x70000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + }; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware1 = "lantiq/xrx200_phy22f_a14.bin"; /*VR9 1.1*/ + firmware2 = "lantiq/xrx200_phy22f_a22.bin"; /*VR9 1.2*/ + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 40 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + dsl: dsl { + label = "asl56026:green:dsl"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + + /* power-* is a bicolour led */ + power_green: power_green { + label = "asl56026:green:power"; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + + power_red: power_red { + label = "asl56026:red:power"; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + power_led_blink { + gpio-export,name = "power_led_blink"; + gpio-export,output = <0>; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + lantiq,switch; + + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "mii"; + phy-handle = <&phy11>; + }; + + ethernet@3 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <3>; + phy-mode = "mii"; + phy-handle = <&phy14>; + }; + + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + + phy14: ethernet-phy@14 { + reg = <0x14>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV2B.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV2B.dts new file mode 100644 index 000000000..961fd9b92 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV2B.dts @@ -0,0 +1,262 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "bt,homehub-v2b", "lantiq,xway", "lantiq,danube"; + model = "BT Home Hub 2B"; /* SoC: Lantiq Danube-S PSB 50712 @ 333MHz V1.3/1.5 */ + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_orange; + led-failsafe = &power_red; + led-running = &power_blue; + + led-dsl = &broadband_blue; + led-wifi = &wireless_blue; + }; + + memory@0 { /* RAM: Samsung K4H511638F-LC 64MB */ + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { /* NOR Flash: Spansion S29AL004D 512KB */ + compatible = "lantiq,nor"; /* "AMD AM29LV400BB" compatible on 3.3.8 */ + lantiq,cs = <0>; + bank-width = <2>; + reg = <0 0x0 0x80000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; /* 256KB */ + }; + + partition@40000 { + label = "uboot_env"; + reg = <0x40000 0x10000>; /* 64KB */ + }; + + partition@50000 { + label = "rg_conf_1"; + reg = <0x50000 0x10000>; + }; + + partition@60000 { + label = "rg_conf_2"; + reg = <0x60000 0x10000>; + }; + + partition@70000 { + label = "rg_conf_factory"; + reg = <0x70000 0x10000>; + }; + }; + }; + + nand-parts@0 { /* NAND Flash: Samsung K9F5608U0D-JIB0 32MB */ + compatible = "lantiq,nand-xway"; + lantiq,cs = <1>; + bank-width = <2>; + reg = <1 0x0 0x2000000 >; + #address-cells = <1>; + #size-cells = <1>; + req-mask = <0x1>; /* PCI request lines to mask during NAND access */ + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + ath9k_cal: partition@0 { + label = "art"; /* Atheros 9160 wifi b/g/n radio EEPROM */ + reg = <0x00000 0x4000>; + read-only; + }; + + partition@4000 { + label = "kernel"; + reg = <0x4000 0x200000>; + }; + + partition@164000 { + label = "ubi"; + reg = <0x204000 0x1DFC000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + nand_out { + lantiq,groups = "nand cle", "nand ale"; + lantiq,function = "ebu"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + nand_cs1 { + lantiq,groups = "nand cs1"; + lantiq,function = "ebu"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + }; + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,output = <0>; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + + pci_rst { + lantiq,pins = "io21"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + }; + + btn_in { + lantiq,pins = "io2", "io15", "io22"; + lantiq,output = <0>; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + }; + }; + }; + + etop@E180000 { + phy-mode = "rmii"; + }; + + ifxhcd@E101000 { + status = "okay"; + }; + + gpios: stp@E100BB0 { + status = "okay"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + findhandset { + label = "findhandset"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + upgrading-orange { + label = "bthomehubv2b:orange:upgrading"; + gpios = <&gpios 5 GPIO_ACTIVE_HIGH>; + }; + + phone-orange { + label = "bthomehubv2b:orange:phone"; + gpios = <&gpios 6 GPIO_ACTIVE_HIGH>; + }; + phone-blue { + label = "bthomehubv2b:blue:phone"; + gpios = <&gpios 7 GPIO_ACTIVE_HIGH>; + }; + + wireless-orange { + label = "bthomehubv2b:orange:wireless"; + gpios = <&gpios 8 GPIO_ACTIVE_HIGH>; + }; + wireless_blue: wireless-blue { + label = "bthomehubv2b:blue:wireless"; + gpios = <&gpios 9 GPIO_ACTIVE_HIGH>; + }; + + broadband-red { + label = "bthomehubv2b:red:broadband"; + gpios = <&gpios 10 GPIO_ACTIVE_HIGH>; + }; + broadband-orange { + label = "bthomehubv2b:orange:broadband"; + gpios = <&gpios 11 GPIO_ACTIVE_HIGH>; + }; + broadband_blue: broadband-blue { + label = "bthomehubv2b:blue:broadband"; + gpios = <&gpios 12 GPIO_ACTIVE_HIGH>; + }; + + power_red: power-red { + label = "bthomehubv2b:red:power"; + gpios = <&gpios 13 GPIO_ACTIVE_HIGH>; + }; + power_orange: power-orange { + label = "bthomehubv2b:orange:power"; + gpios = <&gpios 14 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + power_blue: power-blue { + label = "bthomehubv2b:blue:power"; + gpios = <&gpios 15 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pci0 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + wifi@168c,0027 { + compatible = "pci168c,0027"; + reg = <0x7000 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV3A.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV3A.dts new file mode 100644 index 000000000..d37b9728d --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV3A.dts @@ -0,0 +1,208 @@ +/dts-v1/; + +#include "ar9.dtsi" + +#include + +/ { + compatible = "bt,homehub-v3a", "lantiq,xway", "lantiq,ar9"; + model = "BT Home Hub 3A"; /* SoC: Lantiq ar9 @ 333MHz */ + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_orange; + led-failsafe = &power_red; + led-running = &power_blue; + + led-dsl = &broadband_blue; + led-wifi = &wireless_blue; + }; + + memory@0 { /* RAM: Samsung K4H511638F-LC 64MB */ + reg = <0x0 0x4000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nand-parts@0 { /* NAND Flash: Samsung K9F5608U0D-JIB0 32MB */ + compatible = "lantiq,nand-xway"; + lantiq,cs = <1>; + bank-width = <2>; + reg = <1 0x0 0x2000000 >; + #address-cells = <1>; + #size-cells = <1>; + req-mask = <0x1>; /* PCI request lines to mask during NAND access */ + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "preboot"; + reg = <0x00000 0x8000>; + read-only; + }; + partition@8000 { + label = "u-boot"; + reg = <0x8000 0x05c000>; + read-only; + }; + partition@64000 { + label = "uboot_env"; + reg = <0x64000 0x004000>; + }; + ath9k_cal: partition@68000 { + label = "art-copy"; + reg = <0x68000 0x004000>; + }; + partition@6c000 { + label = "kernel"; + reg = <0x6c000 0x200000>; + }; + partition@26c000 { + label = "ubi"; + reg = <0x26c000 0x1d94000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + nand_out { + lantiq,groups = "nand cle", "nand ale"; + lantiq,function = "ebu"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + nand_cs1 { + lantiq,groups = "nand cs1"; + lantiq,function = "ebu"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + + pci_in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,output = <0>; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + }; + pci_out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + + pci_rst { + lantiq,pins = "io21"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + }; + }; + }; + + etop@E180000 { + phy-mode = "rgmii"; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + reset { + label = "reset"; + gpios = <&gpio 54 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + restart { + label = "restart"; + gpios = <&gpio 52 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio 53 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wireless-red { + label = "bthomehubv3a:red:wireless"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + wireless-orange { + label = "bthomehubv3a:orange:wireless"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + wireless_blue: wireless-blue { + label = "bthomehubv3a:blue:wireless"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + }; + + broadband-red { + label = "bthomehubv3a:red:broadband"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + broadband-orange { + label = "bthomehubv3a:orange:broadband"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + broadband_blue: broadband-blue { + label = "bthomehubv3a:blue:broadband"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + power_red: power-red { + label = "bthomehubv3a:red:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + power_orange: power-orange { + label = "bthomehubv3a:orange:power"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_blue: power-blue { + label = "bthomehubv3a:blue:power"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + ath9k@7000 { + reg = <0x7000 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV5A.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV5A.dts new file mode 100644 index 000000000..2f7507469 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/BTHOMEHUBV5A.dts @@ -0,0 +1,282 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "bt,homehub-v5a", "lantiq,xway", "lantiq,vr9"; + model = "BT Home Hub 5A"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_blue; + + led-dsl = &broadband_blue; + led-wifi = &wireless_blue; + }; + + memory@0 { + reg = <0x0 0x8000000>; + }; + + fpi@10000000 { + localbus@0 { + nand-parts@0 { + compatible = "lantiq,nand-xway"; + lantiq,cs = <1>; + bank-width = <2>; + reg = <0x1 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + nand-on-flash-bbt; + nand-ecc-strength = <3>; + nand-ecc-step-size = <256>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0xa0000>; + read-only; + }; + partition@a0000 { + label = "uboot-env"; + reg = <0xa0000 0x20000>; + read-only; + }; + partition@c0000 { + label = "unused"; + reg = <0xc0000 0x40000>; + }; + partition@100000 { + label = "ubi"; + reg = <0x100000 0x7e80000>; + }; + /* + * last 512 KiB are for the bad block table, not writable + */ + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,output = <1>; + lantiq,open-drain; + }; + pcie_rst { + lantiq,pins = "io38"; + lantiq,pull = <0>; + lantiq,output = <1>; + lantiq,open-drain; + }; + usb_vbus { + lantiq,pins = "io33"; + lantiq,pull = <0>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + nand_out { + lantiq,groups = "nand cle", "nand ale"; + lantiq,function = "ebu"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + nand_cs1 { + lantiq,groups = "nand cs1"; + lantiq,function = "ebu"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware1 = "lantiq/xrx200_phy11g_a14.bin"; /*VR9 1.1*/ + firmware2 = "lantiq/xrx200_phy11g_a22.bin"; /*VR9 1.2*/ + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + restart { + label = "restart"; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + /* broadband-* is a single RGB led */ + broadband-red { + label = "bthomehubv5a:red:broadband"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + broadband-green { + label = "bthomehubv5a:green:broadband"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + broadband_blue: broadband-blue { + label = "bthomehubv5a:blue:broadband"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + + /* wireless-* is a single RGB led */ + wireless-red { + label = "bthomehubv5a:red:wireless"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + }; + wireless-green { + label = "bthomehubv5a:green:wireless"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + }; + wireless_blue: wireless-blue { + label = "bthomehubv5a:blue:wireless"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + /* power-* is a single RGB led */ + power_red: power-red { + label = "bthomehubv5a:red:power"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + power_green: power-green { + label = "bthomehubv5a:green:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_blue: power-blue { + label = "bthomehubv5a:blue:power"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + dimmed { + label = "dimmed"; + gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pci0 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + wifi@168c,002d { + compatible = "pci168c,002d"; + reg = <0x7000 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + qca,disable-5ghz; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + }; + ethernet@1 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <1>; + phy-mode = "rgmii"; + phy-handle = <&phy1>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "gmii"; + phy-handle = <&phy11>; + }; + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "gmii"; + phy-handle = <&phy13>; + }; + ethernet@5 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "rgmii"; + phy-handle = <&phy5>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + + phy0: ethernet-phy@0 { + reg = <0x0>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy1: ethernet-phy@1 { + reg = <0x1>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy5: ethernet-phy@5 { + reg = <0x5>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN1000B.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN1000B.dts new file mode 100644 index 000000000..e5637efca --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN1000B.dts @@ -0,0 +1,171 @@ +/dts-v1/; + +#include "amazonse.dtsi" + +#include + +/ { + compatible = "netgear,dgn1000b", "lantiq,xway", "lantiq,ase"; + model = "Netgear DGN1000B"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + + led-dsl = &dsl; + led-internet = &online_green; + }; + + memory@0 { + reg = <0x0 0x1000000>; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + asc { + lantiq,groups = "asc"; + lantiq,function = "asc"; + }; + keys_in { + lantiq,pins = "io0",/* "io25", */"io29"; + lantiq,pull = <2>; + lantiq,open-drain = <1>; + }; + }; + pins_spi_default: pins_spi_default { + spi_in { + lantiq,groups = "spi_di"; + lantiq,function = "spi"; + }; + spi_out { + lantiq,groups = "spi_do", "spi_clk", + "spi_cs1"; + lantiq,function = "spi"; + lantiq,output = <1>; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mac-address = [ 00 11 22 33 44 55 ]; + }; + + spi@E100800 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pins_spi_default>; + + m25p80@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <1 0>; + spi-max-frequency = <5000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x20000>; + label = "SPI (RO) U-Boot Image"; + read-only; + }; + + partition@20000 { + reg = <0x20000 0x10000>; + label = "ENV_MAC"; + read-only; + }; + + partition@30000 { + reg = <0x30000 0x10000>; + label = "DPF"; + read-only; + }; + + partition@40000 { + reg = <0x40000 0x10000>; + label = "NVRAM"; + read-only; + }; + + partition@500000 { + reg = <0x50000 0x003a0000>; + label = "kernel"; + }; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + rfkill { + label = "rfkill"; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + dsl: dsl { + label = "dgn1000b:green:dsl"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + online_green: online { + label = "dgn1000b:green:online"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + online2 { + label = "dgn1000b:red:online"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + wps { + label = "dgn1000b:green:wps"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + power: power { + label = "dgn1000b:green:power"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + /* + power red is missing + */ + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dts new file mode 100644 index 000000000..98a2ebd98 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dts @@ -0,0 +1,8 @@ +/dts-v1/; + +#include "DGN3500.dtsi" + +/ { + compatible = "netgear,dgn3500", "lantiq,xway", "lantiq,ar9"; + model = "Netgear DGN3500"; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dtsi new file mode 100644 index 000000000..d58d71753 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500.dtsi @@ -0,0 +1,213 @@ +#include "ar9.dtsi" + +#include + +/ { + chosen { + bootargs = "root= console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + led-internet = &internet; + led-usb = &usb; + led-wifi = &wifi_green; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + }; + pci { + lantiq,groups = "gnt1", "req1"; + lantiq,function = "pci"; + }; + pci-in { + lantiq,groups = "req1"; + lantiq,output = <0>; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + }; + pci-out { + lantiq,groups = "gnt1"; + lantiq,output = <1>; + lantiq,pull = <0>; + }; + }; + pins_spi_default: pins_spi_default { + spi_in { + lantiq,groups = "spi_di"; + lantiq,function = "spi"; + }; + spi_out { + lantiq,groups = "spi_do", "spi_clk", + "spi_cs4"; + lantiq,function = "spi"; + lantiq,output = <1>; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + }; + + ifxhcd@E101000 { + status = "okay"; + }; + }; + + rtl8366rb { + compatible = "realtek,rtl8366rb"; + gpio-sda = <&gpio 35 GPIO_ACTIVE_HIGH>; + gpio-sck = <&gpio 37 GPIO_ACTIVE_HIGH>; + + realtek,initvals = < + 0x0000 0x0830 + 0x0400 0x8130 + 0x000A 0x83ED + 0x0F51 0x0017 + 0x02F5 0x0048 + 0x02FA 0xFFDF + 0x02FB 0xFFE0 + 0x0450 0x0000 + 0x0401 0x0000 + 0x0431 0x0960 + >; + }; + + + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 36 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio 54 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 53 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + internet: internet { + label = "dgn3500:green:internet"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + internet2 { + label = "dgn3500:red:internet"; + gpios = <&gpio 30 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "dgn3500:green:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + usb: usb { + label = "dgn3500:green:usb"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + power_green: power { + label = "dgn3500:green:power"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power2 { + label = "dgn3500:red:power"; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + }; + wifi_green: wifi { + label = "dgn3500:green:wireless"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + wifi2 { + label = "dgn3500:amber:wireless"; + gpios = <&gpio 51 GPIO_ACTIVE_LOW>; + }; + wps { + label = "dgn3500:green:wps"; + gpios = <&gpio 52 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + wifi@168c,0029 { + compatible = "pci168c,0029"; + reg = <0x7000 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pins_spi_default>; + + status = "ok"; + + m25p80@4 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <4 0>; + spi-max-frequency = <20000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x10000>; + label = "uboot"; + read-only; + }; + + partition@10000 { + reg = <0x10000 0x10000>; + label = "uboot-env"; + read-only; + }; + + ath9k_cal: partition@20000 { + reg = <0x20000 0x10000>; + label = "calibration"; + read-only; + }; + + partition@50000 { + reg = <0x50000 0xfa0000>; + label = "firmware"; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500B.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500B.dts new file mode 100644 index 000000000..d1d788cc7 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DGN3500B.dts @@ -0,0 +1,8 @@ +/dts-v1/; + +#include "DGN3500.dtsi" + +/ { + compatible = "netgear,dgn3500b", "lantiq,xway", "lantiq,ar9"; + model = "Netgear DGN3500B"; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DM200.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DM200.dts new file mode 100644 index 000000000..3c8a2a1fa --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/DM200.dts @@ -0,0 +1,215 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "netgear,dm200", "lantiq,xway", "lantiq,vr9"; + model = "Netgear DM200"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_amber; + led-running = &power_green; + + led-dsl = &dsl_green; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + }; + + pins_spi_default: pins_spi_default { + spi_in { + lantiq,groups = "spi_di"; + lantiq,function = "spi"; + }; + spi_out { + lantiq,groups = "spi_do", "spi_clk", "spi_cs4"; + lantiq,function = "spi"; + lantiq,output = <1>; + }; + }; + }; + + pcie@d900000 { + status = "disabled"; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware = "lantiq/xrx200_phy22f_a22.bin"; + phys = [ 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + reset { + label = "reset"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + annexa { + gpio-export,name = "annexa"; + gpio-export,output = <0>; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + }; + annexb { + gpio-export,name = "annexb"; + gpio-export,output = <0>; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_amber: power_amber { + label = "dm200:amber:power"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + power_green: power_green { + label = "dm200:green:power"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; + + lan_amber { + label = "dm200:amber:lan"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + }; + lan_green { + label = "dm200:green:lan"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + }; + + dsl_amber { + label = "dm200:amber:dsl"; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + }; + dsl_green: dsl_green { + label = "dm200:green:dsl"; + gpios = <&gpio 36 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pins_spi_default>; + + status = "ok"; + + m25p80@4 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <4 0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x20000>; + label = "uboot"; + read-only; + }; + + partition@20000 { + reg = <0x20000 0x10000>; + label = "gphyfirmware"; + read-only; + }; + + partition@30000 { + reg = <0x30000 0x7b0000>; + label = "firmware"; + }; + + partition@7e0000 { + reg = <0x7e0000 0x10000>; + label = "sysconfig"; + read-only; + }; + + partition@7f0000 { + reg = <0x7f0000 0x2000>; + label = "ubootconfig"; + read-only; + }; + + partition@7f2000 { + reg = <0x7f2000 0x1000>; + label = "ART"; + read-only; + }; + + partition@7f3000 { + reg = <0x7f3000 0x1000>; + label = "pot"; + read-only; + }; + + partition@7f4000 { + reg = <0x7f4000 0xc000>; + label = "ret"; + read-only; + }; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "mii"; + phy-handle = <&phy13>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50712.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50712.dts new file mode 100644 index 000000000..ebd30a7c0 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50712.dts @@ -0,0 +1,83 @@ +/dts-v1/; + +#include "danube.dtsi" + +/ { + compatible = "lantiq,easy50712", "lantiq,xway", "lantiq,danube"; + model = "Intel EASY50712 Nand"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; /* 64 KB */ + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; /* 64 KB */ + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x3d0000>; + }; + + partition@400000 { + label = "rootfs"; + reg = <0x400000 0x400000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + stp { + lantiq,groups = "stp"; + lantiq,function = "stp"; + }; + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + }; + pci { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + }; + conf_out { + lantiq,pins = "io4", "io5", "io6"; /* stp */ + lantiq,open-drain; + lantiq,pull = <0>; + }; + }; + }; + + etop@E180000 { + phy-mode = "rmii"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50810.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50810.dts new file mode 100644 index 000000000..605eb826a --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY50810.dts @@ -0,0 +1,93 @@ +/dts-v1/; + +#include "ar9.dtsi" + +/ { + compatible = "lantiq,easy50810", "lantiq,xway", "lantiq,ar9"; + model = "Lantiq EASY50810"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; /* 64 KB */ + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; /* 64 KB */ + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x3d0000>; + }; + + partition@400000 { + label = "rootfs"; + reg = <0x400000 0x400000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + stp { + lantiq,groups = "stp"; + lantiq,function = "stp"; + }; + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + }; + pci { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + }; + conf_out { + lantiq,pins = "io4", "io5", "io6"; /* stp */ + lantiq,open-drain; + lantiq,pull = <0>; + }; + }; + }; + + etop@E180000 { + phy-mode = "rmii"; + }; + + stp0: stp@E100BB0 { + #gpio-cells = <2>; + compatible = "lantiq,gpio-stp-xway"; + gpio-controller; + reg = <0xE100BB0 0x40>; + + lantiq,shadow = <0xfff>; + lantiq,groups = <0x3>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920.dtsi new file mode 100644 index 000000000..b19b9713f --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920.dtsi @@ -0,0 +1,298 @@ +#include "vr9.dtsi" + +#include + +/ { + compatible = "lantiq,easy80920", "lantiq,xway", "lantiq,vr9"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + + led-usb = &usb1; + led-usb2 = &usb2; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + exin3 { + lantiq,groups = "exin3"; + lantiq,function = "exin"; + }; + stp { + lantiq,groups = "stp"; + lantiq,function = "stp"; + }; + nand { + lantiq,groups = "nand cle", "nand ale", + "nand rd", "nand rdy"; + lantiq,function = "ebu"; + }; + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + pci { + lantiq,groups = "gnt1", "req1"; + lantiq,function = "pci"; + }; + conf_out { + lantiq,pins = "io24", "io13", "io49", /* nand cle, ale and rd */ + "io4", "io5", "io6", /* stp */ + "io21", + "io33"; + lantiq,open-drain; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + pcie-rst { + lantiq,pins = "io38"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + conf_in { + lantiq,pins = "io39", /* exin3 */ + "io48"; /* nand rdy */ + lantiq,pull = <2>; + }; + }; + pins_spi_default: pins_spi_default { + spi_in { + lantiq,groups = "spi_di"; + lantiq,function = "spi"; + }; + spi_out { + lantiq,groups = "spi_do", "spi_clk", + "spi_cs4"; + lantiq,function = "spi"; + lantiq,output = <1>; + }; + }; + }; + + stp: stp@E100BB0 { + compatible = "lantiq,gpio-stp-xway"; + reg = <0xE100BB0 0x40>; + #gpio-cells = <2>; + gpio-controller; + + lantiq,shadow = <0xffff>; + lantiq,groups = <0x7>; + lantiq,dsl = <0x3>; + lantiq,phy1 = <0x7>; + lantiq,phy2 = <0x7>; + /* lantiq,rising; */ + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + lantiq,portmask = <0x3>; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware1 = "lantiq/xrx200_phy11g_a14.bin"; + firmware2 = "lantiq/xrx200_phy11g_a22.bin"; + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; +/* reset { + label = "reset"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + };*/ + paging { + label = "paging"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power: power { + label = "easy80920:green:power"; + gpios = <&stp 9 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + warning { + label = "easy80920:green:warning"; + gpios = <&stp 22 GPIO_ACTIVE_HIGH>; + }; + fxs1 { + label = "easy80920:green:fxs1"; + gpios = <&stp 21 GPIO_ACTIVE_HIGH>; + }; + fxs2 { + label = "easy80920:green:fxs2"; + gpios = <&stp 20 GPIO_ACTIVE_HIGH>; + }; + fxo { + label = "easy80920:green:fxo"; + gpios = <&stp 19 GPIO_ACTIVE_HIGH>; + }; + usb1: usb1 { + label = "easy80920:green:usb1"; + gpios = <&stp 18 GPIO_ACTIVE_HIGH>; + }; + usb2: usb2 { + label = "easy80920:green:usb2"; + gpios = <&stp 15 GPIO_ACTIVE_HIGH>; + }; + sd { + label = "easy80920:green:sd"; + gpios = <&stp 14 GPIO_ACTIVE_HIGH>; + }; + wps { + label = "easy80920:green:wps"; + gpios = <&stp 12 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pins_spi_default>; + + status = "ok"; + + m25p80@4 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <4 0>; + spi-max-frequency = <1000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x20000>; + label = "SPI (RO) U-Boot Image"; + read-only; + }; + + partition@20000 { + reg = <0x20000 0x10000>; + label = "ENV_MAC"; + read-only; + }; + + partition@30000 { + reg = <0x30000 0x10000>; + label = "DPF"; + read-only; + }; + + partition@40000 { + reg = <0x40000 0x10000>; + label = "NVRAM"; + read-only; + }; + + partition@500000 { + reg = <0x50000 0x003a0000>; + label = "kernel"; + }; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + lantiq,switch; + + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "gmii"; + phy-handle = <&phy13>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "gmii"; + phy-handle = <&phy11>; + }; + ethernet@1 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <1>; + phy-mode = "rgmii"; + phy-handle = <&phy1>; + }; + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + }; + }; + + wan: interface@1 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + lantiq,wan; + + ethernet@5 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "rgmii"; + phy-handle = <&phy5>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy0: ethernet-phy@0 { + reg = <0x0>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy1: ethernet-phy@1 { + reg = <0x1>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy5: ethernet-phy@5 { + reg = <0x5>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NAND.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NAND.dts new file mode 100644 index 000000000..095bd564d --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NAND.dts @@ -0,0 +1,68 @@ +/dts-v1/; + + +#include "EASY80920.dtsi" + +/ { + compatible = "lantiq,easy80920-nand", "lantiq,easy80920", "lantiq,xway", "lantiq,vr9"; + model = "Intel EASY80920 Nand"; + + chosen { + bootargs = "ubi.mtd=ubi ubi.block=0,rootfsA root=/dev/ubiblock0_1"; + }; + + fpi@10000000 { + localbus@0 { + ranges = <0 0 0x4000000 0x3ffffff>; + nand-parts@0 { + compatible = "lantiq,nand-xway"; + lantiq,cs = <1>; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x100000>; /* 1024 KB */ + }; + + partition@100000 { + label = "uboot_env"; + reg = <0x100000 0x40000>; /* 256 KB */ + }; + + partition@140000 { + label = "ubootconfigB"; + reg = <0x140000 0x40000>; /* 256 KB */ + }; + + partition@180000 { + label = "gphyfirmware"; + reg = <0x180000 0x40000>; /* 256 KB */ + }; + + partition@1c0000 { + label = "ubi"; + reg = <0x1c0000 0xc800000>; + }; + + partition@c9c0000 { + label = "calibration"; + reg = <0xc9c0000 0x100000>; + }; + + partition@cac0000 { + label = "res"; + reg = <0xcac0000 0x13540000>; + }; + }; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NOR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NOR.dts new file mode 100644 index 000000000..e273138d8 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY80920NOR.dts @@ -0,0 +1,43 @@ +/dts-v1/; + + +#include "EASY80920.dtsi" + +/ { + compatible = "lantiq,easy80920-nor", "lantiq,easy80920", "lantiq,xway", "lantiq,vr9"; + model = "Intel EASY80920 Nor"; + + fpi@10000000 { + localbus@0 { + ranges = <0 0 0x0 0x3ffffff>; + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x10000>; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x10000 0x10000>; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7e0000>; + }; + }; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88388.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88388.dts new file mode 100644 index 000000000..a9c5b3c24 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88388.dts @@ -0,0 +1,106 @@ +/dts-v1/; + +#include +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon FTTDP8 Reference Board"; + compatible = "lantiq,easy88388", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + gpio-keys { + compatible = "gpio-keys"; + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = <0x198>; + }; + }; + + pinctrl { + led_pins: led-pins { + lantiq,pins = "io34", "io35", "io36", "io37", "io38", + "io39", "io40", "io41"; + lantiq,function = "gpio"; + }; + }; + + easy88388-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins &bootled_pins>; + + GPON { + label = "easy88388:green:gpon"; + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + TEST { + label = "easy88388:green:test"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + STATUS { + label = "easy88388:green:status"; + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + ERROR { + label = "easy88388:red:error"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + DSL1 { + label = "easy88388:dsl:1"; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + DSL2 { + label = "easy88388:dsl:2"; + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + DSL3 { + label = "easy88388:dsl:3"; + gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + DSL4 { + label = "easy88388:dsl:4"; + gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + DSL5 { + label = "easy88388:dsl:5"; + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + DSL6 { + label = "easy88388:dsl:6"; + gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + DSL7 { + label = "easy88388:dsl:7"; + gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + DSL8 { + label = "easy88388:dsl:8"; + gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + }; +}; + diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88444.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88444.dts new file mode 100644 index 000000000..ceb81ea13 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY88444.dts @@ -0,0 +1,80 @@ +/dts-v1/; + +#include +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon FTTdp G.FAST Reference Board"; + compatible = "lantiq,easy88444", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + gpio-keys { + compatible = "gpio-keys"; + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = <0x198>; + }; + }; + + pinctrl { + led_pins: led-pins { + lantiq,pins = "io34", "io35", "io37"; + lantiq,function = "gpio"; + }; + }; + + easy88444-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins &bootled_pins>; + + GPON { + label = "easy88444:green:gpon"; + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + TEST { + label = "easy88444:green:test"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + STATUS { + label = "easy88444:green:status"; + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + GFAST1 { + label = "easy88444:gfast:1"; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + GFAST2 { + label = "easy88444:gfast:2"; + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + GFAST3 { + label = "easy88444:gfast:3"; + gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + GFAST4 { + label = "easy88444:gfast:4"; + gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + }; +}; + diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000-base.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000-base.dtsi new file mode 100644 index 000000000..cfe1140ac --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000-base.dtsi @@ -0,0 +1,110 @@ + +#include +#include + +/ { + compatible = "lantiq,easy98000", "lantiq,falcon"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + easy98000-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&bootled_pins>; + + LED_0 { + label = "easy98000:green:gpon"; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_1 { + label = "easy98000:red:gpon"; + gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_2 { + label = "easy98000:green:gpon_tx"; + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_3 { + label = "easy98000:green:gpon_rx"; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_4 { + label = "easy98000:green:voice"; + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_5 { + label = "easy98000:green:status"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + }; +}; + +&ebu_cs1 { + eth0: ethernet@0000000 { + compatible = "davicom,dm9000"; + device_type = "network"; + reg = <0x0000003 0x1>, <0x0000001 0x1>; + reg-names = "addr", "data"; + interrupt-parent = <&gpio1>; + #interrupt-cells = <2>; + interrupts = <10 IRQ_TYPE_LEVEL_LOW>; + local-mac-address = [ 00 00 00 00 00 00 ]; + }; + + cpld@3c00000 { + compatible = "lantiq,easy98000_addon"; + reg = <0x3c00000 0x2>; + }; + + cpld@3c0000c { + compatible = "lantiq,easy98000_cpld_led"; + reg = <0x3c0000c 0x2>, <0x3c00012 0x2>; + }; +}; + +/* // enable this for second uart: +&serial1 { + status = "okay"; +};*/ + +&spi { + status = "okay"; + + eeprom@1 { + compatible = "atmel,at25", "atmel,at25160n"; + reg = <2>; + spi-max-frequency = <1000000>; + spi-cpha; + spi-cpol; + + pagesize = <32>; + size = <2048>; + address-width = <16>; + }; +}; + +&i2c { + status = "okay"; + + clock-frequency = <100000>; + + /* eeprom-emulation by OMU */ + eeprom@50 { + compatible = "at,24c02"; + reg = <0x50>; + }; + eeprom@51 { + compatible = "at,24c02"; + reg = <0x51>; + }; +}; + diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NAND.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NAND.dts new file mode 100644 index 000000000..a40cef393 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NAND.dts @@ -0,0 +1,40 @@ +/dts-v1/; + +#include "falcon.dtsi" +#include "EASY98000-base.dtsi" + +/ { + model = "Lantiq Falcon (NAND)"; + compatible = "lantiq,easy98000-nand", "lantiq,easy98000", "lantiq,falcon"; + + aliases { + spi0 = &spi; + }; +}; + +&ebu_cs0 { + gen_nand@0 { + compatible = "gen_nand", "lantiq,nand-falcon"; + bank-width = <1>; + reg = <0x0 0x40000>; + #address-cells = <1>; + #size-cells = <1>; + linux,mtd-name = "gen_nand"; + bbt-use-flash; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x40000 0x40000>; + }; + + partition@20000 { + label = "linux"; + reg = <0x80000 0x3d0000>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NOR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NOR.dts new file mode 100644 index 000000000..ad53bf96e --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000NOR.dts @@ -0,0 +1,38 @@ +/dts-v1/; + +#include "falcon.dtsi" +#include "EASY98000-base.dtsi" + +/ { + model = "Lantiq Falcon (NOR)"; + compatible = "lantiq,easy98000-nor", "lantiq,easy98000", "lantiq,falcon"; + + aliases { + spi0 = &spi; + }; +}; + +&ebu_cs0 { + cfi@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0x0 0x4000000>; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x40000 0x40000>; + }; + + partition@20000 { + label = "linux"; + reg = <0x80000 0x3d0000>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000SFLASH.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000SFLASH.dts new file mode 100644 index 000000000..bbe524e94 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98000SFLASH.dts @@ -0,0 +1,16 @@ +/dts-v1/; + +#include "falcon.dtsi" +#include "EASY98000-base.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon (SFLASH)"; + compatible = "lantiq,easy98000-sflash", "lantiq,easy98000", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + spi1 = &spi; + }; +}; + diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020.dts new file mode 100644 index 000000000..c0970ef48 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020.dts @@ -0,0 +1,95 @@ +/dts-v1/; + +#include + +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon Reference Board"; + compatible = "lantiq,easy98020", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + gpio-keys { + compatible = "gpio-keys"; + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = <0x198>; + }; + }; + + pinctrl { + led_pins: phy-led-pins { + lantiq,pins = "io42", "io41", "io38", "io37"; + lantiq,function = "gpio"; + }; + }; + + easy98020-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&bootled_pins>; + + GPON { + label = "easy98020:green:gpon"; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + TEST { + label = "easy98020:green:test"; + gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + ETH { + label = "easy98020:green:status"; + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + VOICE { + label = "easy98020:green:voice"; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + VIDEO { + label = "easy98020:green:video"; + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + }; + + easy98020-phy-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins>; + + GE0_ACT { + label = "easy98020:ge0_act"; + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + GE0_LINK { + label = "easy98020:ge0_link"; + gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + GE1_ACT { + label = "easy98020:ge1_act"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + GE1_LINK { + label = "easy98020:ge1_link"; + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020V18.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020V18.dts new file mode 100644 index 000000000..9aa1be91e --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98020V18.dts @@ -0,0 +1,68 @@ +/dts-v1/; + +#include + +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon Reference Board V1.8"; + compatible = "lantiq,easy98020-v18", "lantiq,easy98020", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + gpio-keys { + compatible = "gpio-keys"; + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = <0x198>; + }; + }; + + pinctrl { + led_pins: led-pins { + lantiq,pins = "io11", "io14", "io36", "io37", "io38"; + lantiq,function = "gpio"; + }; + }; + + easy98020-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins &bootled_pins>; + + GPON { + label = "easy98020:green:gpon"; + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + TEST { + label = "easy98020:green:test"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + ETH { + label = "easy98020:green:status"; + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + VOICE { + label = "easy98020:green:voice"; + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + VIDEO { + label = "easy98020:green:video"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98021.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98021.dts new file mode 100644 index 000000000..7b2e490fc --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98021.dts @@ -0,0 +1,81 @@ +/dts-v1/; + +#include + +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon HGU Reference Board"; + compatible = "lantiq,easy98021", "lantiq,easy98020", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + gpio-keys { + compatible = "gpio-keys"; + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = <0x198>; + }; + }; + + gpio-mmc { + /* Place-holder for SIM-Card connector, + to list the used GPIOs, no official binding */ + compatible = "gpio-mmc"; + gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>, + <&gpio0 3 GPIO_ACTIVE_HIGH>, + <&gpio0 2 GPIO_ACTIVE_HIGH>, + <0>; /* no CS */ + gpio-names = "di", "do", "clk", "cs"; + reset-gpio = <&gpio3 24 GPIO_ACTIVE_HIGH>; + }; + + pinctrl { + led_pins: led-pins { + lantiq,pins = "io11", "io14", "io36", "io37", "io38"; + lantiq,function = "gpio"; + }; + }; + + easy98021-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins &bootled_pins>; + + GPON { + label = "easy98021:green:gpon"; + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + TEST { + label = "easy98021:red:test"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + ETH { + label = "easy98021:green:status"; + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + VOICE { + label = "easy98021:green:voice"; + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + SIMCARD { + label = "easy98021:green:simcard"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + }; +}; + diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE.dts new file mode 100644 index 000000000..df941cdb6 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE.dts @@ -0,0 +1,76 @@ +/dts-v1/; + +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon SFP Stick with SyncE"; + compatible = "lantiq,easy98035synce", "lantiq,falcon-sfp", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + pinctrl { + compatible = "lantiq,pinctrl-falcon"; + + asc0_func1: func1 { + func1_tx { + lantiq,pins = "io32"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + func1_rx { + lantiq,pins = "io33"; + lantiq,mux = <0>; + }; + }; + asc0_func2: func2 { + func2_tx { + lantiq,pins = "io32"; + lantiq,mux = <0>; + }; + func2_rx { + lantiq,pins = "io33"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + }; + asc0_func3: func3 { + func3_tx { + lantiq,pins = "io32"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + func3_rx { + lantiq,pins = "io33"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + }; + }; + + pinselect-asc0 { + compatible = "lantiq,pinselect-asc0"; + pinctrl-names = "asc0", "func1", "func2", "func3"; + pinctrl-0 = <&asc0_pins>; + pinctrl-1 = <&asc0_func1>; + pinctrl-2 = <&asc0_func2>; + pinctrl-3 = <&asc0_func3>; + }; +}; + +&serial0 { + pinctrl-names = "default"; + /* use "empty" pinctrl to leave setting from u-boot enabled */ + pinctrl-0 = < >; +}; + +&i2c { + status = "okay"; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE1588.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE1588.dts new file mode 100644 index 000000000..a3abc6e70 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/EASY98035SYNCE1588.dts @@ -0,0 +1,76 @@ +/dts-v1/; + +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon SFP Stick with SyncE/1588"; + compatible = "lantiq,easy98035synce1588", "lantiq,falcon-sfp", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + pinctrl { + compatible = "lantiq,pinctrl-falcon"; + + asc0_func1: func1 { + func1_tx { + lantiq,pins = "io32"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + func1_rx { + lantiq,pins = "io33"; + lantiq,mux = <0>; + }; + }; + asc0_func2: func2 { + func2_tx { + lantiq,pins = "io32"; + lantiq,mux = <0>; + }; + func2_rx { + lantiq,pins = "io33"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + }; + asc0_func3: func3 { + func3_tx { + lantiq,pins = "io32"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + func3_rx { + lantiq,pins = "io33"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + }; + }; + + pinselect-asc0 { + compatible = "lantiq,pinselect-asc0"; + pinctrl-names = "asc0", "func1", "func2", "func3"; + pinctrl-0 = <&asc0_pins>; + pinctrl-1 = <&asc0_func1>; + pinctrl-2 = <&asc0_func2>; + pinctrl-3 = <&asc0_func3>; + }; +}; + +&serial0 { + pinctrl-names = "default"; + /* use "empty" pinctrl to leave setting from u-boot enabled */ + pinctrl-0 = < >; +}; + +&i2c { + status = "okay"; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-MDU.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-MDU.dts new file mode 100644 index 000000000..6710bbe98 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-MDU.dts @@ -0,0 +1,53 @@ +/dts-v1/; + +#include + +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon / Vinax MDU Board"; + compatible = "lantiq,falcon-mdu", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + mdu-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&bootled_pins>; + + LED_0 { + label = "mdu:green:gpon"; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_1 { + label = "mdu:green:status"; + gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_2 { + label = "mdu:green:2"; + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_3 { + label = "mdu:green:3"; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + LED_4 { + label = "mdu:green:4"; + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + }; +}; + diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-SFP.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-SFP.dts new file mode 100644 index 000000000..8d45de4eb --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FALCON-SFP.dts @@ -0,0 +1,76 @@ +/dts-v1/; + +#include "falcon.dtsi" +#include "falcon-sflash-16M.dtsi" + +/ { + model = "Lantiq Falcon SFP Stick"; + compatible = "lantiq,falcon-sfp", "lantiq,falcon"; + + aliases { + spi0 = &ebu_cs0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + pinctrl { + compatible = "lantiq,pinctrl-falcon"; + + asc0_func1: func1 { + func1_tx { + lantiq,pins = "io32"; + lantiq,mux = <1>; + lantiq,output = <0>; + }; + func1_rx { + lantiq,pins = "io33"; + lantiq,mux = <0>; + }; + }; + asc0_func2: func2 { + func2_tx { + lantiq,pins = "io32"; + lantiq,mux = <0>; + }; + func2_rx { + lantiq,pins = "io33"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + }; + asc0_func3: func3 { + func3_tx { + lantiq,pins = "io32"; + lantiq,mux = <1>; + lantiq,output = <0>; + }; + func3_rx { + lantiq,pins = "io33"; + lantiq,mux = <1>; + lantiq,input = <0>; + }; + }; + }; + + pinselect-asc0 { + compatible = "lantiq,pinselect-asc0"; + pinctrl-names = "asc0", "func1", "func2", "func3"; + pinctrl-0 = <&asc0_pins>; + pinctrl-1 = <&asc0_func1>; + pinctrl-2 = <&asc0_func2>; + pinctrl-3 = <&asc0_func3>; + }; +}; + +&serial0 { + pinctrl-names = "default"; + /* use "empty" pinctrl to leave setting from u-boot enabled */ + pinctrl-0 = < >; +}; + +&i2c { + status = "okay"; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ3370.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ3370.dts new file mode 100644 index 000000000..ef3655de6 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ3370.dts @@ -0,0 +1,288 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "avm,fritz3370", "lantiq,xway", "lantiq,vr9"; + model = "Fritz!Box WLAN 3370"; + + chosen { + bootargs = "console=ttyLTQ0,115200 ubi.mtd=1,512 root=/dev/mtdblock9"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + led-internet = &info_green; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x8000000>; + }; + + fpi@10000000 { + localbus@0 { + nand-parts@0 { + compatible = "lantiq,nand-xway"; + bank-width = <2>; + reg = <1 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "rootfs_ubi"; + reg = <0x400000 0x3000000>; + }; + + partition@3400000 { + label = "vr9_firmware"; + reg = <0x3400000 0x400000>; + }; + partition@3800000 { + label = "reserved"; + reg = <0x3800000 0x3000000>; + }; + partition@6800000 { + label = "config"; + reg = <0x6800000 0x200000>; + }; + partition@6a00000 { + label = "nand-filesystem"; + reg = <0x6a00000 0x1600000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + nand { + lantiq,groups = "nand cle", "nand ale", + "nand rd", "nand cs1", "nand rdy"; + lantiq,function = "ebu"; + lantiq,pull = <1>; + }; + phy-rst { + lantiq,pins = "io37", "io44"; + lantiq,pull = <0>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + pcie-rst { + lantiq,pins = "io38"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + pins_spi_default: pins_spi_default { + spi_in { + lantiq,groups = "spi_di"; + lantiq,function = "spi"; + }; + spi_out { + lantiq,groups = "spi_do", "spi_clk", + "spi_cs4"; + lantiq,function = "spi"; + lantiq,output = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH + &gpio 14 GPIO_ACTIVE_HIGH>; + lantiq,portmask = <0x3>; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware = "lantiq/xrx200_phy11g_a14.bin"; + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + power { + label = "power"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; +/* wifi { + label = "wifi"; + gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; + linux,code = ; + };*/ + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_green: power { + label = "fritz3370:green:power"; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power2 { + label = "fritz3370:red:power"; + gpios = <&gpio 33 GPIO_ACTIVE_LOW>; + }; + info_red { + label = "fritz3370:red:info"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "fritz3370:green:wlan"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "fritz3370:green:dsl"; + gpios = <&gpio 36 GPIO_ACTIVE_LOW>; + }; + lan { + label = "fritz3370:green:lan"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + info_green: info_green { + label = "fritz3370:green:info"; + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pins_spi_default>; + + status = "ok"; + + m25p80@4 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <4 0>; + spi-max-frequency = <1000000>; + + urlader: partition@0 { + reg = <0x0 0x20000>; + label = "urlader"; + read-only; + }; + + partition@20000 { + reg = <0x20000 0x10000>; + label = "tffs (1)"; + read-only; + }; + + partition@30000 { + reg = <0x30000 0x10000>; + label = "tffs (2)"; + read-only; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + mtd-mac-address = <&urlader 0x987>; + mtd-mac-address-increment = <(-2)>; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + gpios = <&gpio 37 GPIO_ACTIVE_HIGH>; + }; + ethernet@1 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <1>; + phy-mode = "rgmii"; + phy-handle = <&phy1>; + gpios = <&gpio 44 GPIO_ACTIVE_HIGH>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "gmii"; + phy-handle = <&phy11>; + }; + ethernet@3 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "gmii"; + phy-handle = <&phy13>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy0: ethernet-phy@0 { + reg = <0x0>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy1: ethernet-phy@1 { + reg = <0x1>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; + +&pcie0 { + pcie@0 { + reg = <0 0 0 0 0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + device_type = "pci"; + + wifi@0,0 { + compatible = "pci0,0"; + reg = <0 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */ + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7320.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7320.dts new file mode 100644 index 000000000..34d0df9b3 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7320.dts @@ -0,0 +1,161 @@ +/dts-v1/; + +#include "ar9.dtsi" + +#include + +/ { + compatible = "avm,fritz7320", "lantiq,xway", "lantiq,ar9"; + model = "1&1 HomeServer"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + + led-internet = &info_green; + led-dsl = &power; + led-wifi = &wlan; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x1000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + ath9k_cal: partition@0 { + label = "urlader"; + reg = <0x00000 0x20000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0xf60000>; + }; + + partition@f80000 { + label = "tffs (1)"; + reg = <0xf80000 0x40000>; + read-only; + }; + + partition@fc0000 { + label = "tffs (2)"; + reg = <0xfc0000 0x40000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pci { + lantiq,groups = "gnt1", "req1", "req2", "req3", "req4", "gnt2", "gnt3", "gnt4"; + lantiq,function = "pci"; + }; + pci-in { + lantiq,groups = "req1", "req2", "req3", "req4"; + lantiq,output = <0>; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + }; + pci-out { + lantiq,groups = "gnt1", "gnt2", "gnt3", "gnt4"; + lantiq,output = <1>; + lantiq,pull = <0>; + }; + }; + }; + + etop@E180000 { + phy-mode = "mii"; + mtd-mac-address = <&ath9k_cal 0xa91>; + mtd-mac-address-increment = <(-2)>; + }; + + ifxhcd@E101000 { + status = "okay"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + rfkill { + label = "rfkill"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + dect { + label = "dect"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power: power { + label = "fritz7320:green:power"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + voice { + label = "fritz7320:green:fon"; + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; + }; + dect { + label = "fritz7320:green:dect"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + wlan: wlan { + label = "fritz7320:green:wlan"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + info_green: info_green { + label = "fritz7320:green:info"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + }; + info_red { + label = "fritz7320:red:info"; + gpios = <&gpio 45 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + req-mask = <0xf>; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + wifi@0,0 { + compatible = "pci0,0"; + reg = <0x7000 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */ + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7360SL.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7360SL.dts new file mode 100644 index 000000000..b16487110 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7360SL.dts @@ -0,0 +1,228 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "avm,fritz7360sl", "lantiq,xway", "lantiq,vr9"; + model = "1&1 HomeServer"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &info_green; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x8000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x1000000>; + #address-cells = <1>; + #size-cells = <1>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + urlader: partition@0 { + label = "urlader"; + reg = <0x00000 0x20000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0xf60000>; + }; + + partition@f80000 { + label = "tffs (1)"; + reg = <0xf80000 0x40000>; + read-only; + }; + + partition@fc0000 { + label = "tffs (2)"; + reg = <0xfc0000 0x40000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + phy-rst { + lantiq,pins = "io37", "io44"; + lantiq,pull = <0>; + lantiq,open-drain; + lantiq,output = <1>; + }; + pcie-rst { + lantiq,pins = "io38"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + lantiq,portmask = <0x3>; + }; + + ifxhcd@E106000 { + status = "okay"; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware = "lantiq/xrx200_phy11g_a22.bin"; + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + dect { + label = "dect"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + wifi { + label = "wifi"; + gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_green: power { + label = "fritz7360sl:green:power"; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power2 { + label = "fritz7360sl:red:power"; + gpios = <&gpio 33 GPIO_ACTIVE_LOW>; + }; + info_red { + label = "fritz7360sl:red:info"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + }; + info_green: info_green { + label = "fritz7360sl:green:info"; + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "fritz7360sl:green:wlan"; + gpios = <&gpio 36 GPIO_ACTIVE_LOW>; + }; + dect { + label = "fritz7360sl:green:dect"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + mtd-mac-address = <&urlader 0xa91>; + mtd-mac-address-increment = <(-2)>; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rmii"; + phy-handle = <&phy0>; + }; + ethernet@1 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <1>; + phy-mode = "rmii"; + phy-handle = <&phy1>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "gmii"; + phy-handle = <&phy11>; + }; + ethernet@3 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "gmii"; + phy-handle = <&phy13>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy0: ethernet-phy@0 { + reg = <0x00>; + compatible = "ethernet-phy-ieee802.3-c22"; + reset-gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + phy1: ethernet-phy@1 { + reg = <0x01>; + compatible = "ethernet-phy-ieee802.3-c22"; + reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; + +&pcie0 { + pcie@0 { + reg = <0 0 0 0 0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + device_type = "pci"; + + wifi@168c,002e { + compatible = "pci168c,002e"; + reg = <0 0 0 0 0>; + qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:01:00.0.bin */ + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/GIGASX76X.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/GIGASX76X.dts new file mode 100644 index 000000000..99ccbce29 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/GIGASX76X.dts @@ -0,0 +1,122 @@ +/dts-v1/; + +#include "danube.dtsi" + +#include + +/ { + compatible = "siemens,gigaset-sx76x", "lantiq,xway", "lantiq,danube"; + model = "Gigaset SX761,SX762,SX763"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpiomm 1 GPIO_ACTIVE_HIGH>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + }; + + partition@10000 { + label = "uboot_env"; + reg = <0x30000 0x10000>; + }; + + partition@40000 { + label = "firmware"; + reg = <0x40000 0x7c0000>; + }; + }; + }; + + gpiomm: gpiomm@4000000 { + compatible = "lantiq,gpio-mm"; + reg = <1 0x0 0x10 >; + #address-cells = <1>; + #size-cells = <1>; + #gpio-cells = <2>; + gpio-controller; + lantiq,shadow = <0x3>; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + stp { + lantiq,groups = "stp"; + lantiq,function = "stp"; + }; + }; + }; + + gpios: stp@E100BB0 { + status = "okay"; + }; + + etop@E180000 { + phy-mode = "rmii"; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; + }; + + pci@E105400 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + switch { + gpio-export,name = "switch"; + gpio-export,output = <1>; + gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/H201L.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/H201L.dts new file mode 100644 index 000000000..01016f45c --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/H201L.dts @@ -0,0 +1,159 @@ +/dts-v1/; + +#include "ar9.dtsi" + +#include + +/ { + compatible = "zte,h201l", "lantiq,xway", "lantiq,ar9"; + model = "ZTE H210L"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_green; + led-running = &power_green; + + led-dsl = &dsl; + led-internet = &online; + led-usb = &usb; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x20000>; + read-only; + }; + + partition@20000 { + label = "uboot_env"; + reg = <0x20000 0x10000>; + read-only; + }; + + partition@30000 { + label = "firmware"; + reg = <0x30000 0x7d0000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + }; + }; + + etop@E180000 { + phy-mode = "rgmii"; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 36 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 53 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio 54 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + rfkill { + label = "rfkill"; + gpios = <&gpio 55 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_green: power { + label = "h201l:green:power"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + online: online { + label = "h201l:green:internet"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "h201l:green:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + phone { + label = "h201l:green:phone"; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + }; + wps { + label = "h201l:green:wps"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "h201l:green:wlan"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + usb: usb { + label = "h201l:green:usb"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + switch { + gpio-export,name = "switch"; + gpio-export,output = <1>; + gpios = <&gpio 38 GPIO_ACTIVE_HIGH>; + }; + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; + }; + wifi { + gpio-export,name = "wifi"; + gpio-export,output = <1>; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2601HNFX.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2601HNFX.dts new file mode 100644 index 000000000..1b885ad84 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2601HNFX.dts @@ -0,0 +1,190 @@ +/dts-v1/; + +#include "ar9.dtsi" + +#include + +/ { + compatible = "zyxel,p-2601hn", "lantiq,xway", "lantiq,ar9"; + model = "ZyXEL P-2601HN-Fx"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + led-internet = &online; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "uboot_env"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "firmware"; + reg = <0x60000 0xfa0000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + stp { + lantiq,groups = "stp"; + lantiq,function = "stp"; + lantiq,pull = <2>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + exin { + lantiq,groups = "exin1"; + lantiq,function = "exin"; + }; + pci { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + }; + conf_out { + lantiq,pins = "io4", "io5", "io6"; + lantiq,open-drain; + lantiq,pull = <0>; + }; + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + }; + }; + + etop@E180000 { + phy-mode = "rmii"; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + }; + + stp: stp@E100BB0 { + #gpio-cells = <2>; + compatible = "lantiq,gpio-stp-xway"; + gpio-controller; + reg = <0xE100BB0 0x40>; + + lantiq,shadow = <0xfff>; + lantiq,groups = <0x3>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 53 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + rfkill { + label = "rfkill"; + gpios = <&gpio 54 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_green: power { + label = "p2601hnfx:green:power"; + gpios = <&stp 11 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power2 { + label = "p2601hnfx:red:power"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + }; + online: online { + label = "p2601hnfx:green:internet"; + gpios = <&stp 13 GPIO_ACTIVE_LOW>; + }; + online2 { + label = "p2601hnfx:red:internet"; + gpios = <&stp 12 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "p2601hnfx:green:dsl"; + gpios = <&stp 14 GPIO_ACTIVE_LOW>; + }; + phone { + label = "p2601hnfx:green:phone"; + gpios = <&stp 9 GPIO_ACTIVE_LOW>; + }; + phone2 { + label = "p2601hnfx:orange:phone"; + gpios = <&stp 8 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "p2601hnfx:green:wireless"; + gpios = <&stp 15 GPIO_ACTIVE_LOW>; + }; + wifi2 { + label = "p2601hnfx:orange:wireless"; + gpios = <&stp 10 GPIO_ACTIVE_LOW>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + switch { + gpio-export,name = "switch"; + gpio-export,output = <1>; + gpios = <&gpio 50 GPIO_ACTIVE_HIGH>; + }; + usb { + gpio-export,name = "wifi"; + gpio-export,output = <1>; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts new file mode 100644 index 000000000..4a29cd929 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts @@ -0,0 +1,72 @@ +/dts-v1/; + +#include "P2812HNUFX.dtsi" + +/ { + compatible = "zyxel,p-2812hnu-f1", "zyxel,p-2812hnu", "lantiq,xway", "lantiq,vr9"; + model = "ZyXEL P-2812HNU-F1"; + + aliases { + led-usb = &usb1; + led-usb2 = &usb2; + }; + + fpi@10000000 { + localbus@0 { + nand-parts@0 { + compatible = "lantiq,nand-xway"; + lantiq,cs = <1>; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + }; + partition@40000 { + label = "uboot-env"; + reg = <0x40000 0x20000>; + }; + partition@60000 { + label = "kernel"; + reg = <0x60000 0x200000>; + }; + partition@260000 { + label = "ubi"; + reg = <0x260000 0x7da0000>; + }; + }; + }; + }; + + pcie@d900000 { + status = "disabled"; + }; + }; + + gpio-leds { + usb1: usb1 { + label = "p2812hnuf1:green:usb1"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + usb2: usb2 { + label = "p2812hnuf1:green:usb2"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + wifi@1814,3062 { + compatible = "pci1814,3062"; + reg = <0x7000 0 0 0 0>; + ralink,eeprom = "RT3062.eeprom"; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF3.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF3.dts new file mode 100644 index 000000000..d37ad0a8e --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF3.dts @@ -0,0 +1,66 @@ +/dts-v1/; + +#include "P2812HNUFX.dtsi" + +/ { + compatible = "zyxel,p-2812hnu-f3", "zyxel,p-2812hnu", "lantiq,xway", "lantiq,vr9"; + model = "ZyXEL P-2812HNU-F3"; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x800000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x50000>; + read-only; + }; + partition@50000 { + label = "uboot-env"; + reg = <0x50000 0x10000>; + }; + partition@60000 { + label = "unused"; + reg = <0x60000 0x7a0000>; + }; + }; + }; + + nand-parts@0 { + compatible = "lantiq,nand-xway"; + lantiq,cs = <1>; + bank-width = <2>; + reg = <1 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x200000>; + }; + partition@200000 { + label = "ubi"; + reg = <0x200000 0x7e00000>; + }; + }; + }; + }; +}; + +&pci0 { + wifi@1814,3092 { + compatible = "pci1814,3092"; + reg = <0x7000 0 0 0 0>; + ralink,eeprom = "RT3092.eeprom"; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUFX.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUFX.dtsi new file mode 100644 index 000000000..ec3bd1033 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUFX.dtsi @@ -0,0 +1,280 @@ +#include "vr9.dtsi" + +#include + +/ { + compatible = "zyxel,p-2812hnu", "lantiq,xway", "lantiq,vr9"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl_green; + led-internet = &internet_green; + led-wifi = &wireless_green; + }; + + memory@0 { + reg = <0x0 0x8000000>; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + exin3 { + lantiq,groups = "exin3"; + lantiq,function = "exin"; + }; + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + gphy-leds { + lantiq,groups = "gphy0 led1", "gphy1 led1", + "gphy0 led2", "gphy1 led2"; + lantiq,function = "gphy"; + lantiq,pull = <2>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + stp { + lantiq,groups = "stp"; + lantiq,function = "stp"; + lantiq,pull = <2>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + pci-in { + lantiq,groups = "req1"; + lantiq,function = "pci"; + lantiq,output = <0>; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + }; + pci-out { + lantiq,groups = "gnt1"; + lantiq,function = "pci"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + lantiq,pull = <2>; + }; + pcie-rst { + lantiq,pins = "io38"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + ifxhcd-rst { + lantiq,pins = "io33"; + lantiq,pull = <0>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + nand_out { + lantiq,groups = "nand cle", "nand ale"; + lantiq,function = "ebu"; + lantiq,output = <1>; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + nand_cs1 { + lantiq,groups = "nand cs1"; + lantiq,function = "ebu"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + }; + }; + }; + + stp: stp@E100BB0 { + compatible = "lantiq,gpio-stp-xway"; + reg = <0xE100BB0 0x40>; + #gpio-cells = <2>; + gpio-controller; + + lantiq,shadow = <0xffffff>; + lantiq,groups = <0x7>; + lantiq,dsl = <0x0>; + lantiq,phy1 = <0x0>; + lantiq,phy2 = <0x0>; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + lantiq,portmask = <0x3>; + }; + + ifxhcd@E106000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + }; + + pci@E105400 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware1 = "lantiq/xrx200_phy11g_a14.bin"; /*VR9 1.1*/ + firmware2 = "lantiq/xrx200_phy11g_a22.bin"; /*VR9 1.2*/ + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + internet_red { + label = "p2812hnufx:red:internet"; + gpios = <&stp 16 GPIO_ACTIVE_LOW>; + }; + internet_green: internet_green { + label = "p2812hnufx:green:internet"; + gpios = <&stp 17 GPIO_ACTIVE_LOW>; + }; + dsl_green: dsl_green { + label = "p2812hnufx:green:dsl"; + gpios = <&stp 18 GPIO_ACTIVE_LOW>; + }; + dsl_orange { + label = "p2812hnufx:orange:dsl"; + gpios = <&stp 19 GPIO_ACTIVE_LOW>; + }; + wireless_orange { + label = "p2812hnufx:orange:wlan"; + gpios = <&stp 20 GPIO_ACTIVE_LOW>; + }; + wireless_green: wireless_green { + label = "p2812hnufx:green:wlan"; + gpios = <&stp 21 GPIO_ACTIVE_LOW>; + }; + power_red: power { + label = "p2812hnufx:red:power"; + gpios = <&stp 22 GPIO_ACTIVE_LOW>; + }; + power_green: power2 { + label = "p2812hnufx:green:power"; + gpios = <&stp 23 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + phone1 { + label = "p2812hnufx:green:phone"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + phone1warn { + label = "p2812hnufx:orange:phone"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + phone2warn { + label = "p2812hnufx:orange:phone2"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + }; + phone2 { + label = "p2812hnufx:green:phone2"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + mac-address = [ 00 11 22 33 44 55 ]; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + }; + ethernet@1 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <1>; + phy-mode = "rgmii"; + phy-handle = <&phy1>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "gmii"; + phy-handle = <&phy11>; + }; + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "gmii"; + phy-handle = <&phy13>; + }; + ethernet@5 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "rgmii"; + phy-handle = <&phy5>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + + phy0: ethernet-phy@0 { + reg = <0x0>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy1: ethernet-phy@1 { + reg = <0x1>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy5: ethernet-phy@5 { + reg = <0x5>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8970.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8970.dts new file mode 100644 index 000000000..25eb3dac6 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8970.dts @@ -0,0 +1,8 @@ +/dts-v1/; + +#include "TDW89X0.dtsi" + +/ { + compatible = "tplink,tdw8970", "tplink,tdw89x0", "lantiq,xway", "lantiq,vr9"; + model = "TP-LINK TD-W8970"; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8980.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8980.dts new file mode 100644 index 000000000..def34b55b --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW8980.dts @@ -0,0 +1,35 @@ +/dts-v1/; + +#include "TDW89X0.dtsi" + +/ { + compatible = "tplink,tdw8980", "tplink,tdw89x0", "lantiq,xway", "lantiq,vr9"; + model = "TP-LINK TD-W8980"; + + fpi@10000000 { + gpio: pinmux@E100B10 { + state_default: pinmux { + pci_rst { + lantiq,pins = "io21"; + lantiq,output = <1>; + lantiq,open-drain; + }; + }; + }; + + pci@E105400 { + status = "okay"; + lantiq,bus-clock = <33333333>; + interrupt-map-mask = <0xf800 0x0 0x0 0x7>; + interrupt-map = <0x7000 0 0 1 &icu0 30 1>; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-leds { + wifi2 { + label = "tdw8980:green:wlan5ghz"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW89X0.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW89X0.dtsi new file mode 100644 index 000000000..a629d92e4 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/TDW89X0.dtsi @@ -0,0 +1,274 @@ +#include "vr9.dtsi" + +#include + +/ { + compatible = "tplink,tdw89x0", "lantiq,xway", "lantiq,vr9"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + /* the power led can't be controlled, use the wps led instead */ + led-boot = &wps; + led-failsafe = &wps; + + led-dsl = &dsl; + led-internet = &internet; + led-wifi = &wifi; + led-usb = &usb0; + led-usb2 = &usb2; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + gphy-leds { + lantiq,groups = "gphy0 led1", "gphy1 led1"; + lantiq,function = "gphy"; + lantiq,pull = <2>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + phy-rst { + lantiq,pins = "io42"; + lantiq,pull = <0>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + pcie-rst { + lantiq,pins = "io38"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + pins_spi_default: pins_spi_default { + spi_in { + lantiq,groups = "spi_di"; + lantiq,function = "spi"; + }; + spi_out { + lantiq,groups = "spi_do", "spi_clk", + "spi_cs4"; + lantiq,function = "spi"; + lantiq,output = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + lantiq,portmask = <0x3>; + }; + + ifxhcd@E106000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware = "lantiq/xrx200_phy11g_a22.bin"; + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + reset { + label = "reset"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wifi { + label = "wifi"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + linux,code = ; + linux,input-type = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + /* + power is not controllable via gpio + */ + dsl: dsl { + label = "tdw89x0:green:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + internet: internet { + label = "tdw89x0:green:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + }; + usb0: usb0 { + label = "tdw89x0:green:usb"; + gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; + }; + usb2: usb2 { + label = "tdw89x0:green:usb2"; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + }; + wps: wps { + label = "tdw89x0:green:wps"; + gpios = <&gpio 37 GPIO_ACTIVE_HIGH>; + }; + }; + + wifi-leds { + compatible = "gpio-leds"; + + wifi: wifi { + label = "tdw89x0:green:wifi"; + gpios = <&ath9k 0 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pins_spi_default>; + + status = "ok"; + + m25p80@4 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <4 0>; + spi-max-frequency = <33250000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x20000>; + label = "u-boot"; + read-only; + }; + + partition@20000 { + reg = <0x20000 0x7a0000>; + label = "firmware"; + }; + + partition@7c0000 { + reg = <0x7c0000 0x10000>; + label = "config"; + read-only; + }; + + ath9k_cal: partition@7d0000 { + reg = <0x7d0000 0x30000>; + label = "boardconfig"; + read-only; + }; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + mtd-mac-address = <&ath9k_cal 0xf100>; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + // gpios = <&gpio 42 GPIO_ACTIVE_LOW>; + }; + ethernet@5 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "rgmii"; + phy-handle = <&phy5>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "gmii"; + phy-handle = <&phy11>; + }; + ethernet@3 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "gmii"; + phy-handle = <&phy13>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy0: ethernet-phy@0 { + reg = <0x0>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy5: ethernet-phy@5 { + reg = <0x5>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; + +&pcie0 { + pcie@0 { + reg = <0 0 0 0 0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + device_type = "pci"; + + ath9k: wifi@168c,002e { + compatible = "pci168c,002e"; + reg = <0 0 0 0 0>; + #gpio-cells = <2>; + gpio-controller; + qca,no-eeprom; + qca,disable-5ghz; + mtd-mac-address = <&ath9k_cal 0xf100>; + mtd-mac-address-increment = <2>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VG3503J.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VG3503J.dts new file mode 100644 index 000000000..8a73de9a2 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VG3503J.dts @@ -0,0 +1,163 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "arcadyan,vg3503j", "lantiq,xway", "lantiq,vr9"; + model = "BT OpenReach VDSL Modem"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + }; + + memory@0 { + reg = <0x0 0x2000000>; + }; + + fpi@10000000 { + localbus@0 { + ranges = <0 0 0x0 0x3ffffff>; + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x20000>; + }; + + partition@20000 { + label = "firmware"; + reg = <0x20000 0x7d0000>; + }; + + partition@7f0000 { + label = "uboot-env"; + reg = <0x7f0000 0x10000>; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + gphy-leds { + lantiq,groups = "gphy0 led0", "gphy0 led1", + "gphy0 led2", "gphy1 led0", + "gphy1 led1", "gphy1 led2"; + lantiq,function = "gphy"; + lantiq,pull = <2>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + }; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware1 = "lantiq/xrx200_phy11g_a14.bin"; /*VR9 1.1*/ + firmware2 = "lantiq/xrx200_phy11g_a22.bin"; /*VR9 1.2*/ + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + reset { + label = "reset"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_red: power2 { + label = "vg3503j:red:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "vg3503j:green:dsl"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + power_green: power { + label = "vg3503j:green:power"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + }; +}; + +ð0 { + interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + lantiq,switch; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "mii"; + phy-handle = <&phy11>; + }; + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "mii"; + phy-handle = <&phy13>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + lantiq,led1h = <0x70>; + lantiq,led1l = <0x00>; + lantiq,led2h = <0x00>; + lantiq,led2l = <0x03>; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + lantiq,led1h = <0x70>; + lantiq,led1l = <0x00>; + lantiq,led2h = <0x00>; + lantiq,led2l = <0x03>; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22.dtsi new file mode 100644 index 000000000..fb4486aca --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22.dtsi @@ -0,0 +1,253 @@ +#include "vr9.dtsi" + +#include + +/ { + compatible = "arcadyan,vgv7510kw22", "lantiq,xway", "lantiq,vr9"; + + chosen { + bootargs = "console=ttyLTQ0,115200 mem=62M vpe1_load_addr=0x83e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + led-internet = &internet_green; + led-wifi = &wifi; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 30 GPIO_ACTIVE_HIGH //fxs relay + &gpio 31 GPIO_ACTIVE_HIGH //still unknown + &gpio 3 GPIO_ACTIVE_HIGH>; //reset_slic? + }; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x1000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boardconfig: partition@fe0000 { + label = "board_config"; + reg = <0xfe0000 0x20000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + gphy-leds { + lantiq,groups = "gphy0 led0", "gphy0 led1", + "gphy1 led0", "gphy1 led1"; + lantiq,function = "gphy"; + lantiq,open-drain = <0>; + lantiq,pull = <2>; + lantiq,output = <1>; + }; + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + pci-rst { + lantiq,pins = "io21"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; + }; + + pcie@d900000 { + status = "disabled"; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware1 = "lantiq/xrx200_phy22f_a14.bin"; /*VR9 1.1*/ + firmware2 = "lantiq/xrx200_phy22f_a22.bin"; /*VR9 1.2*/ + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + dsl: dsl { + label = "vgv7510kw22:green:dsl"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + internet_red { + label = "vgv7510kw22:red:internet"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + }; + + info_red { + label = "vgv7510kw22:red:info"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + power_green: power { + label = "vgv7510kw22:green:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + + info_green { + label = "vgv7510kw22:green:info"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + internet_green: internet_green { + label = "vgv7510kw22:green:internet"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + wifi: wifi { + label = "vgv7510kw22:green:wlan"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + power_red: power2 { + label = "vgv7510kw22:red:power"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + }; + + phone { + label = "vgv7510kw22:green:telefon"; + gpios = <&gpio 29 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + wifi@1814,3592 { + compatible = "pci1814,3592"; + reg = <0x7000 0 0 0 0>; + ralink,mtd-eeprom = <&boardconfig 0x410>; + ralink,mtd-eeprom-swap; + mtd-mac-address = <&boardconfig 0x16>; + mtd-mac-address-increment = <1>; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + mtd-mac-address = <&boardconfig 0x16>; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "mii"; + phy-handle = <&phy1>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "mii"; + phy-handle = <&phy11>; + }; + ethernet@3 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <3>; + phy-mode = "mii"; + phy-handle = <&phy12>; + }; + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "mii"; + phy-handle = <&phy13>; + }; + ethernet@5 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "mii"; + phy-handle = <&phy14>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + + phy1: ethernet-phy@1 { + reg = <0x1>; + compatible = "ethernet-phy-ieee802.3-c22"; + }; + + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy12: ethernet-phy@12 { + reg = <0x12>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy14: ethernet-phy@14 { + reg = <0x14>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22BRN.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22BRN.dts new file mode 100644 index 000000000..d0be62f63 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22BRN.dts @@ -0,0 +1,67 @@ +/dts-v1/; + +#include "VGV7510KW22.dtsi" + +/ { + compatible = "arcadyan,vgv7510kw22-brn", "arcadyan,vgv7510kw22", "lantiq,xway", "lantiq,vr9"; + model = "o2 Box 6431"; + + sram@1F000000 { + cgu@103000 { + lantiq,phy-clk-src = <0x2>; + }; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + partitions { + partition@0 { + label = "Boot"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "Configuration"; + reg = <0x40000 0x40000>; + read-only; + }; + + partition@80000 { + label = "Certificate"; + reg = <0x80000 0x20000>; + read-only; + }; + + partition@a0000 { + label = "Special_Area"; + reg = <0xa0000 0x20000>; + read-only; + }; + + partition@c0000 { + compatible = "brnboot,root-selector"; + label = "Primary_Setting"; + reg = <0xc0000 0x20000>; + read-only; + }; + + partition@e0000 { + label = "Code_Image_0"; + reg = <0xe0000 0x780000>; + brnboot,root-id = <0x00>; + read-only; + }; + + partition@860000 { + label = "Code_Image_1"; + reg = <0x860000 0x780000>; + brnboot,root-id = <0x01>; + read-only; + }; + }; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22NOR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22NOR.dts new file mode 100644 index 000000000..1d21e14f0 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7510KW22NOR.dts @@ -0,0 +1,33 @@ +/dts-v1/; + +#include "VGV7510KW22.dtsi" + +/ { + compatible = "arcadyan,vgv7510kw22-nor", "arcadyan,vgv7510kw22", "lantiq,xway", "lantiq,vr9"; + model = "o2 Box 6431"; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + partitions { + partition@0 { + label = "uboot"; + reg = <0x0 0x60000>; /* 384 KiB */ + read-only; + }; + + partition@60000 { + label = "uboot-env"; + reg = <0x60000 0x20000>; /* 128 KiB */ + read-only; + }; + + partition@80000 { + label = "firmware"; + reg = <0x80000 0xf60000>; /* 15744 KiB */ + }; + }; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519.dtsi new file mode 100644 index 000000000..e807b5271 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519.dtsi @@ -0,0 +1,298 @@ +#include "vr9.dtsi" + +#include + +/ { + compatible = "arcadyan,vgv7519", "lantiq,xway", "lantiq,vr9"; + + chosen { + bootargs = "console=ttyLTQ0,115200 mem=62M vpe1_load_addr=0x83e00000 vpe1_mem=2M maxvpes=1 maxtcs=1 nosmp"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &broadband_green; + led-internet = &internet_green; + led-wifi = &wireless_green; + }; + + sram@1F000000 { + vmmc@107000 { + status = "okay"; + gpios = <&gpio 30 GPIO_ACTIVE_HIGH //fxs relay + &gpio 31 GPIO_ACTIVE_HIGH //still unknown + &gpio 3 GPIO_ACTIVE_HIGH>; //reset_slic? + }; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x800000>, <1 0x800000 0x800000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boardconfig: partition@40000 { + label = "board_config"; + reg = <0x40000 0x10000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + stp { + lantiq,groups = "stp"; + lantiq,function = "stp"; + lantiq,open-drain = <0>; + lantiq,output = <1>; + lantiq,pull = <0>; + }; + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + pci-rst { + lantiq,pins = "io21"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + gphy-leds { + lantiq,groups = "gphy0 led1", "gphy1 led0"; + lantiq,function = "gphy"; + lantiq,open-drain = <0>; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + }; + + stp: stp@E100BB0 { + compatible = "lantiq,gpio-stp-xway"; + reg = <0xE100BB0 0x40>; + #gpio-cells = <2>; + gpio-controller; + + lantiq,shadow = <0xffff>; + lantiq,groups = <0x3>; + lantiq,dsl = <0x0>; + lantiq,phy1 = <0x0>; + lantiq,phy2 = <0x0>; + /* lantiq,rising; */ + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; + lantiq,portmask = <0x3>; + }; + + ifxhcd@E106000 { + status = "okay"; + gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; + }; + + pcie@d900000 { + status = "disabled"; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware1 = "lantiq/xrx200_phy11g_a14.bin"; /*VR9 1.1*/ + firmware2 = "lantiq/xrx200_phy11g_a22.bin"; /*VR9 1.2*/ + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + reset { + label = "reset"; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + eco { + label = "eco"; + gpios = <&gpio 41 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + rfkill { + label = "rfkill"; + gpios = <&gpio 45 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + wps { + label = "wps"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + eco { + label = "vgv7519:blue:eco"; + gpios = <&stp 2 GPIO_ACTIVE_LOW>; + }; + wps_red { + label = "vgv7519:red:wps"; + gpios = <&stp 3 GPIO_ACTIVE_LOW>; + }; + wps_green { + label = "vgv7519:green:wps"; + gpios = <&stp 4 GPIO_ACTIVE_LOW>; + }; + upgrade { + label = "vgv7519:blue:upgrade"; + gpios = <&stp 5 GPIO_ACTIVE_LOW>; + }; + tv { + label = "vgv7519:green:tv"; + gpios = <&stp 6 GPIO_ACTIVE_LOW>; + }; + internet_green: internet_green { + label = "vgv7519:green:internet"; + gpios = <&stp 7 GPIO_ACTIVE_LOW>; + }; + internet_red { + label = "vgv7519:red:internet"; + gpios = <&stp 8 GPIO_ACTIVE_LOW>; + }; + broadband_red { + label = "vgv7519:red:broadband"; + gpios = <&stp 9 GPIO_ACTIVE_LOW>; + }; + broadband_green: broadband_green { + label = "vgv7519:green:broadband"; + gpios = <&stp 10 GPIO_ACTIVE_LOW>; + }; + voice { + label = "vgv7519:green:voice"; + gpios = <&stp 11 GPIO_ACTIVE_LOW>; + }; + wireless_red { + label = "vgv7519:red:wireless"; + gpios = <&stp 12 GPIO_ACTIVE_LOW>; + }; + wireless_green: wireless_green { + label = "vgv7519:green:wireless"; + gpios = <&stp 13 GPIO_ACTIVE_LOW>; + }; + power_green: power2 { + label = "vgv7519:green:power"; + gpios = <&stp 14 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power { + label = "vgv7519:red:power"; + gpios = <&stp 15 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pci0 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + + wifi@1814,3091 { + compatible = "pci1814,3091"; + reg = <0x7000 0 0 0 0>; + ralink,mtd-eeprom = <&boardconfig 0x410>; + ralink,mtd-eeprom-swap; + mtd-mac-address = <&boardconfig 0x16>; + mtd-mac-address-increment = <1>; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + mtd-mac-address = <&boardconfig 0x16>; + mtd-mac-address-increment = <1>; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + }; + ethernet@1 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <1>; + phy-mode = "rgmii"; + phy-handle = <&phy1>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "gmii"; + phy-handle = <&phy11>; + }; + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "gmii"; + phy-handle = <&phy13>; + }; + ethernet@5 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "rgmii"; + phy-handle = <&phy5>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy0: ethernet-phy@0 { + reg = <0x0>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy1: ethernet-phy@1 { + reg = <0x1>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy5: ethernet-phy@5 { + reg = <0x5>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519BRN.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519BRN.dts new file mode 100644 index 000000000..f30d2f920 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519BRN.dts @@ -0,0 +1,73 @@ +/dts-v1/; + + +#include "VGV7519.dtsi" + +/ { + compatible = "arcadyan,vgv7519-brn", "arcadyan,vgv7519", "lantiq,xway", "lantiq,vr9"; + model = "KPN Experiabox V8"; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + partitions { + partition@0 { + label = "Boot"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@50000 { + label = "Certificate"; + reg = <0x50000 0x10000>; + read-only; + }; + partition@60000 { + label = "Special_Area"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + label = " Reserve_0"; + reg = <0x70000 0x10000>; + read-only; + }; + + partition@80000 { + label = "Code_Image_0"; + reg = <0x80000 0x780000>; + brnboot,root-id = <0x00>; + read-only; + }; + + partition@4000000 { + compatible = "brnboot,root-selector"; + label = "Primary_Setting"; + reg = <0x4000000 0x10000>; + read-only; + }; + + partition@4010000 { + label = "Configuration"; + reg = <0x4010000 0x60000>; + read-only; + }; + + partition@4070000 { + label = " Reserve_1"; + reg = <0x4070000 0x10000>; + read-only; + }; + + partition@4080000 { + label = "Code_Image_1"; + reg = <0x4080000 0x780000>; + brnboot,root-id = <0x01>; + read-only; + }; + }; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519NOR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519NOR.dts new file mode 100644 index 000000000..ec548fbe7 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VGV7519NOR.dts @@ -0,0 +1,32 @@ +/dts-v1/; + + +#include "VGV7519.dtsi" + +/ { + compatible = "arcadyan,vgv7519-nor", "arcadyan,vgv7519", "lantiq,xway", "lantiq,vr9"; + model = "KPN Experiabox V8"; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + partitions { + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + read-only; + }; + partition@60000 { + label = "uboot_env"; + reg = <0x60000 0x10000>; + read-only; + }; + partition@80000 { + label = "firmware"; + reg = <0x80000 0xf80000>; + }; + }; + }; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VR200v.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VR200v.dts new file mode 100644 index 000000000..6eccc5bdd --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/VR200v.dts @@ -0,0 +1,283 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "tplink,vr200v", "lantiq,xway", "lantiq,vr9"; + model = "TP-LINK Archer VR200v"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + + led-dsl = &dsl; + led-internet = &internet; + led-usb = &usb; + led-usb2 = &usb; + }; + + memory@0 { + reg = <0x0 0x7f00000>; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + gphy-leds { + lantiq,groups = "gphy0 led1", "gphy1 led1"; + lantiq,function = "gphy"; + lantiq,pull = <2>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + phy-rst { + lantiq,pins = "io42"; + lantiq,pull = <0>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + pcie-rst { + lantiq,pins = "io38"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + pins_spi_default: pins_spi_default { + spi_in { + lantiq,groups = "spi_di"; + lantiq,function = "spi"; + }; + spi_out { + lantiq,groups = "spi_do", "spi_clk", + "spi_cs4"; + lantiq,function = "spi"; + lantiq,output = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + lantiq,portmask = <0x3>; + }; + + ifxhcd@E106000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + }; + + pci0: pci@E105400 { + status = "okay"; + gpio-reset = <&gpio 21 GPIO_ACTIVE_HIGH>; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware = "lantiq/xrx200_phy11g_a22.bin"; + phys = [ 00 01 ]; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + reset { + label = "reset"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wifi { + label = "wifi"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + linux,code = ; + linux,input-type = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + dect_paging { + label = "dect_paging"; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + power: power { + label = "vr200v:blue:power"; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "vr200v:blue:dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + internet: internet { + label = "vr200v:blue:internet"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + usb: usb { + label = "vr200v:blue:usb"; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + }; + eth { + label = "vr200v:blue:lan"; + gpios = <&gpio 40 GPIO_ACTIVE_LOW>; + }; + wlan { + label = "vr200v:blue:wlan"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + }; + wlan5g { + label = "vr200v:blue:wlan5g"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + phone { + label = "vr200v:blue:phone"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pins_spi_default>; + + status = "ok"; + + m25p80@4 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <4 0>; + spi-max-frequency = <33250000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x20000>; + label = "u-boot"; + read-only; + }; + + partition@20000 { + reg = <0x20000 0xf90000>; + label = "firmware"; + }; + + partition@fb0000 { + reg = <0xfb0000 0x10000>; + label = "radioDECT"; + read-only; + }; + + partition@fc0000 { + reg = <0xfc0000 0x10000>; + label = "config"; + read-only; + }; + + romfile: partition@fd0000 { + reg = <0xfd0000 0x10000>; + label = "romfile"; + read-only; + }; + + partition@fe0000 { + reg = <0xfe0000 0x10000>; + label = "rom"; + read-only; + }; + + partition@ff0000 { + reg = <0xff0000 0x10000>; + label = "radio"; + read-only; + }; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + mtd-mac-address = <&romfile 0xf100>; + lantiq,switch; + + ethernet@0 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <0>; + phy-mode = "rgmii"; + phy-handle = <&phy0>; + // gpios = <&gpio 42 GPIO_ACTIVE_LOW>; + }; + ethernet@5 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "rgmii"; + phy-handle = <&phy5>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "gmii"; + phy-handle = <&phy11>; + }; + ethernet@3 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "gmii"; + phy-handle = <&phy13>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy0: ethernet-phy@0 { + reg = <0x0>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy5: ethernet-phy@5 { + reg = <0x5>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR.dts new file mode 100644 index 000000000..fab99d00e --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR.dts @@ -0,0 +1,185 @@ +/dts-v1/; + +#include "ar9.dtsi" + +#include + +/ { + compatible = "buffalo,wbmr-hp-g300h", "lantiq,xway", "lantiq,ar9"; + model = "Buffalo WBMR-HP-G300H"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_green; + led-failsafe = &power_red; + led-running = &power_green; + + led-dsl = &dsl; + led-internet = &online_green; + led-usb = &usb; + led-wifi = &wifi; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + localbus@0 { + nor-boot@0 { + compatible = "lantiq,nor"; + bank-width = <2>; + reg = <0 0x0 0x2000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x00000 0x40000>; + read-only; + }; + + partition@40000 { + label = "uboot_env"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@20000 { + label = "firmware"; + reg = <0x60000 0x1f20000>; + }; + + boardconfig: partition@1fc0000 { + label = "board"; + reg = <0x1fc0000 0x20000>; + read-only; + }; + + partition@1fe0000 { + label = "calibration"; + reg = <0x1fe0000 0x20000>; + read-only; + }; + }; + }; + }; + + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + pci-in { + lantiq,groups = "req1"; + lantiq,output = <0>; + lantiq,open-drain = <1>; + lantiq,pull = <2>; + }; + pci-out { + lantiq,groups = "gnt1"; + lantiq,output = <1>; + lantiq,pull = <0>; + }; + pci_rst { + lantiq,pins = "io21"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + }; + + etop@E180000 { + phy-mode = "rgmii"; + mtd-mac-address = <&boardconfig 0x10024>; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 36 GPIO_ACTIVE_HIGH>; + }; + + pci@E105400 { + status = "okay"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + wps { + label = "wps"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + eject { + label = "eject"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + movie { + label = "movie"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_green: power { + label = "wbmr:green:power"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + power_red: power2 { + label = "wbmr:red:power"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + security { + label = "wbmr:yellow:security"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + wifi: wifi { + label = "wbmr:green:wireless"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + dsl: dsl { + label = "wbmr:green:dsl"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + online_green: online { + label = "wbmr:green:internet"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + online2 { + label = "wbmr:red:internet"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + movie { + label = "wbmr:blue:movie"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + usb: usb { + label = "wbmr:green:usb"; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR300.dts b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR300.dts new file mode 100644 index 000000000..2ecfe4bc9 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/WBMR300.dts @@ -0,0 +1,306 @@ +/dts-v1/; + +#include "vr9.dtsi" + +#include + +/ { + compatible = "buffalo,wbmr-300hpd", "lantiq,xway", "lantiq,vr9"; + model = "Buffalo WBMR-300HPD"; + + chosen { + bootargs = "console=ttyLTQ0,115200"; + }; + + aliases { + led-boot = &power_g; + led-failsafe = &diag_r; + led-running = &power_g; + + led-dsl = &dsl; + led-internet = &router_g; + led-wifi = &wifi_g; + }; + + memory@0 { + reg = <0x0 0x4000000>; + }; + + fpi@10000000 { + gpio: pinmux@E100B10 { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinmux { + mdio { + lantiq,groups = "mdio"; + lantiq,function = "mdio"; + }; + phy-rst { + lantiq,pins = "io42"; + lantiq,pull = <0>; + lantiq,open-drain = <0>; + lantiq,output = <1>; + }; + pcie-rst { + lantiq,pins = "io38"; + lantiq,pull = <0>; + lantiq,output = <1>; + }; + }; + pins_spi_default: pins_spi_default { + spi_in { + lantiq,groups = "spi_di"; + lantiq,function = "spi"; + }; + spi_out { + lantiq,groups = "spi_do", "spi_clk", + "spi_cs4"; + lantiq,function = "spi"; + lantiq,output = <1>; + }; + }; + }; + + ifxhcd@E101000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + lantiq,portmask = <0x3>; + }; + + ifxhcd@E106000 { + status = "okay"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + }; + }; + + gphy-xrx200 { + compatible = "lantiq,phy-xrx200"; + firmware = "lantiq/xrx200_phy22f_a22.bin"; + phys = [ 00 01 ]; + }; + + gpio_poweroff { + compatible = "gpio-poweroff"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <100>; + + power { + label = "power"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 31 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + auto { + label = "auto"; + gpios = <&gpio 48 GPIO_ACTIVE_HIGH>; + linux,code = ; + linux,input-type = ; + }; + + router { + label = "router"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + linux,code = ; + linux,input-type = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + diag_r: diag_r { + label = "wbmr300:red:diag"; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + default_state = "off"; + }; + + wifi_g: wifi_g { + label = "wbmr300:green:wifi"; + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + }; + + dsl: dsl { + label = "dsl"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + + router_y: router_y { + label = "wbmr300:yellow:router"; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + }; + + wifi_y: wifi_y { + label = "wbmr300:yellow:wifi"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + }; + + lan1: lan1 { + label = "wbmr300:green:lan1"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + }; + + wan: wan { + label = "wbmr300:green:wan"; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + }; + + lan3: lan3 { + label = "wbmr300:green:lan3"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + + lan2: lan2 { + label = "wbmr300:green:lan2"; + gpios = <&gpio 33 GPIO_ACTIVE_HIGH>; + }; + + internet_g: internet_g { + label = "wbmr300:green:internet"; + gpios = <&gpio 34 GPIO_ACTIVE_HIGH>; + }; + + internet_y: internet_y { + label = "wbmr300:yellow:internet"; + gpios = <&gpio 35 GPIO_ACTIVE_HIGH>; + }; + + router_g: router_g { + label = "wbmr300:green:router"; + gpios = <&gpio 36 GPIO_ACTIVE_HIGH>; + }; + + power_g: power_g { + label = "wbmr300:green:power"; + gpios = <&gpio 49 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pins_spi_default>; + + status = "ok"; + m25p80@4 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <4 0>; + spi-max-frequency = <20000000>; + + partition@0 { + reg = <0x0 0x10000>; + label = "u-boot"; + read-only; + }; + + partition@10000 { + reg = <0x10000 0x10000>; + label = "gphyfirmware"; + read-only; + }; + + partition@20000 { + reg = <0x20000 0x80000>; + label = "dsl_fw"; + }; + + partition@de0000 { + reg = <0xa0000 0xf40000>; + label = "firmware"; + }; + + partition@fe0000 { + reg = <0xfe0000 0x10000>; + label = "sysconfig"; + read-only; + }; + + partition@ff0000 { + reg = <0xff0000 0x2000>; + label = "ubootconfig"; + }; + + partition@ff3000 { + reg = <0xff3000 0x2000>; + label = "board_config"; + read-only; + }; + }; +}; + +ð0 { + lan: interface@0 { + compatible = "lantiq,xrx200-pdi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + lantiq,switch; + + ethernet@1 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <4>; + phy-mode = "mii"; + phy-handle = <&phy13>; + }; + ethernet@2 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <5>; + phy-mode = "mii"; + phy-handle = <&phy14>; + }; + ethernet@3 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <2>; + phy-mode = "mii"; + phy-handle = <&phy11>; + }; + ethernet@4 { + compatible = "lantiq,xrx200-pdi-port"; + reg = <3>; + phy-mode = "mii"; + phy-handle = <&phy12>; + }; + }; + + mdio@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-mdio"; + phy11: ethernet-phy@11 { + reg = <0x11>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy12: ethernet-phy@12 { + reg = <0x12>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy13: ethernet-phy@13 { + reg = <0x13>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + phy14: ethernet-phy@14 { + reg = <0x14>; + compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/amazonse.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/amazonse.dtsi new file mode 100644 index 000000000..e6925a3ad --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/amazonse.dtsi @@ -0,0 +1,174 @@ +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,xway", "lantiq,ase"; + + aliases { + serial0 = &asc1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + cpus { + cpu@0 { + compatible = "mips,mips4Kc"; + }; + }; + + memory@0 { + device_type = "memory"; + }; + + biu@1F800000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,biu", "simple-bus"; + reg = <0x1F800000 0x800000>; + ranges = <0x0 0x1F800000 0x7FFFFF>; + + icu0: icu@80200 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,icu"; + reg = <0x80200 0x28 + 0x80228 0x28 + 0x80250 0x28 + 0x80278 0x28 + 0x802a0 0x28>; + }; + + watchdog@803F0 { + compatible = "lantiq,wdt"; + reg = <0x803F0 0x10>; + }; + }; + + sram@1F000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,sram", "simple-bus"; + reg = <0x1F000000 0x800000>; + ranges = <0x0 0x1F000000 0x7FFFFF>; + + eiu0: eiu@101000 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,eiu-xway"; + reg = <0x101000 0x1000>; + interrupt-parent = <&icu0>; + lantiq,eiu-irqs = <29 30 31>; + }; + + pmu0: pmu@102000 { + compatible = "lantiq,pmu-xway"; + reg = <0x102000 0x1000>; + }; + + cgu0: cgu@103000 { + compatible = "lantiq,cgu-xway"; + reg = <0x103000 0x1000>; + #clock-cells = <1>; + }; + + rcu0: rcu@203000 { + compatible = "lantiq,rcu-xway"; + reg = <0x203000 0x1000>; + }; + }; + + fpi@10000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,fpi", "simple-bus"; + ranges = <0x0 0x10000000 0xEEFFFFF>; + reg = <0x10000000 0xEF00000>; + + localbus@0 { + #address-cells = <2>; + #size-cells = <1>; + ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ + 1 0 0x4000000 0x4000010>; /* addsel1 */ + compatible = "lantiq,localbus", "simple-bus"; + }; + + spi@E100800 { + compatible = "lantiq,ase-spi"; + reg = <0xE100800 0x100>; + interrupt-parent = <&icu0>; + interrupts = <24 25 26>; + interrupt-names = "spi_rx", "spi_tx", "spi_err", + "spi_frm"; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + }; + + gptu@E100A00 { + compatible = "lantiq,gptu-xway"; + reg = <0xE100A00 0x100>; + interrupt-parent = <&icu0>; + interrupts = <33 34 35 36 37 38>; + }; + + gpio: pinmux@E100B10 { + compatible = "lantiq,ase-pinctrl"; + #gpio-cells = <2>; + gpio-controller; + reg = <0xE100B10 0xA0>; + }; + + asc1: serial@E100C00 { + compatible = "lantiq,asc"; + reg = <0xE100C00 0x400>; + interrupt-parent = <&icu0>; + interrupts = <72 74 75>; + }; + + mei@E116000 { + compatible = "lantiq,mei-xway"; + interrupt-parent = <&icu0>; + interrupts = <81>; + }; + + ifxhcd@E101000 { + compatible = "lantiq,ase-usb", "lantiq,ifxhcd-ase"; + reg = <0xE101000 0x1000 + 0xE120000 0x3f000>; + interrupt-parent = <&icu0>; + interrupts = <39>; + dr_mode = "host"; + status = "disabled"; + }; + + dma0: dma@E104100 { + compatible = "lantiq,dma-xway"; + reg = <0xE104100 0x800>; + }; + + ebu0: ebu@E105300 { + compatible = "lantiq,ebu-xway"; + reg = <0xE105300 0x100>; + }; + + ppe@E234000 { + compatible = "lantiq,ppe-ase"; + interrupt-parent = <&icu0>; + interrupts = <85>; + }; + + etop@E180000 { + compatible = "lantiq,etop-xway"; + reg = <0xE180000 0x40000>; + interrupt-parent = <&icu0>; + interrupts = <105 109>; + }; + }; + + adsl { + compatible = "lantiq,adsl-ase"; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ar9.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ar9.dtsi new file mode 100644 index 000000000..2638a4b26 --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/ar9.dtsi @@ -0,0 +1,216 @@ +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,xway", "lantiq,ar9"; + + aliases { + serial0 = &asc1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + cpus { + cpu@0 { + compatible = "mips,mips34K"; + }; + }; + + memory@0 { + device_type = "memory"; + }; + + biu@1F800000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,biu", "simple-bus"; + reg = <0x1F800000 0x800000>; + ranges = <0x0 0x1F800000 0x7FFFFF>; + + icu0: icu@80200 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,icu"; + reg = <0x80200 0x28 + 0x80228 0x28 + 0x80250 0x28 + 0x80278 0x28 + 0x802a0 0x28>; + }; + + watchdog@803F0 { + compatible = "lantiq,wdt"; + reg = <0x803F0 0x10>; + }; + }; + + sram@1F000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,sram", "simple-bus"; + reg = <0x1F000000 0x800000>; + ranges = <0x0 0x1F000000 0x7FFFFF>; + + eiu0: eiu@101000 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,eiu-xway"; + reg = <0x101000 0x1000>; + interrupt-parent = <&icu0>; + lantiq,eiu-irqs = <166 135 66 40 41 42>; + }; + + pmu0: pmu@102000 { + compatible = "lantiq,pmu-xway"; + reg = <0x102000 0x1000>; + }; + + cgu0: cgu@103000 { + compatible = "lantiq,cgu-xway"; + reg = <0x103000 0x1000>; + #clock-cells = <1>; + }; + + rcu0: rcu@203000 { + compatible = "lantiq,rcu-xway"; + reg = <0x203000 0x1000>; + }; + }; + + fpi@10000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,fpi", "simple-bus"; + ranges = <0x0 0x10000000 0xEEFFFFF>; + reg = <0x10000000 0xEF00000>; + + localbus@0 { + #address-cells = <2>; + #size-cells = <1>; + ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ + 1 0 0x4000000 0x4000010>; /* addsel1 */ + compatible = "lantiq,localbus", "simple-bus"; + }; + + gptu@E100A00 { + compatible = "lantiq,gptu-xway"; + reg = <0xE100A00 0x100>; + interrupt-parent = <&icu0>; + interrupts = <126 127 128 129 130 131>; + }; + + asc0: serial@E100400 { + compatible = "lantiq,asc"; + reg = <0xE100400 0x400>; + interrupt-parent = <&icu0>; + interrupts = <104 105 106>; + status = "disabled"; + }; + + spi: spi@E100800 { + compatible = "lantiq,xrx100-spi"; + reg = <0xE100800 0x100>; + interrupt-parent = <&icu0>; + interrupts = <22 23 24>; + interrupt-names = "spi_rx", "spi_tx", "spi_err", + "spi_frm"; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + }; + + gpio: pinmux@E100B10 { + compatible = "lantiq,xrx100-pinctrl"; + #gpio-cells = <2>; + gpio-controller; + reg = <0xE100B10 0xA0>; + }; + + asc1: serial@E100C00 { + compatible = "lantiq,asc"; + reg = <0xE100C00 0x400>; + interrupt-parent = <&icu0>; + interrupts = <112 113 114>; + }; + + ifxhcd@E101000 { + compatible = "lantiq,arx100-usb", "lantiq,ifxhcd-arx100"; + reg = <0xE101000 0x1000 + 0xE120000 0x3f000>; + interrupt-parent = <&icu0>; + interrupts = <62 91>; + dr_mode = "host"; + status = "disabled"; + }; + + ifxhcd@E106000 { + compatible = "lantiq,arx100-usb"; + reg = <0xE106000 0x1000 + 0xE1E0000 0x3f000>; + interrupt-parent = <&icu0>; + interrupts = <91>; + dr_mode = "host"; + status = "disabled"; + }; + + deu@E103100 { + compatible = "lantiq,deu-arx100"; + reg = <0xE103100 0xf00>; + }; + + dma0: dma@E104100 { + compatible = "lantiq,dma-xway"; + reg = <0xE104100 0x800>; + }; + + ebu0: ebu@E105300 { + compatible = "lantiq,ebu-xway"; + reg = <0xE105300 0x100>; + }; + + mei@E116000 { + compatible = "lantiq,mei-xway"; + interrupt-parent = <&icu0>; + interrupts = <63>; + }; + + etop@E180000 { + compatible = "lantiq,etop-xway"; + reg = <0xE180000 0x40000 + 0xE108000 0x200>; + interrupt-parent = <&icu0>; + interrupts = <73 72>; + mac-address = [ 00 11 22 33 44 55 ]; + }; + + ppe@E234000 { + compatible = "lantiq,ppe-arx100"; + interrupt-parent = <&icu0>; + interrupts = <96>; + }; + + pci0: pci@E105400 { + status = "disabled"; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + compatible = "lantiq,pci-xway"; + bus-range = <0x0 0x0>; + ranges = <0x2000000 0 0x8000000 0x8000000 0 0x2000000 /* pci memory */ + 0x1000000 0 0x00000000 0xAE00000 0 0x200000>; /* io space */ + reg = <0x7000000 0x8000 /* config space */ + 0xE105400 0x400>; /* pci bridge */ + lantiq,bus-clock = <33333333>; + interrupt-map-mask = <0xf800 0x0 0x0 0x7>; + interrupt-map = <0x7000 0 0 1 &icu0 30 1>; + req-mask = <0x1>; + }; + }; + + adsl { + compatible = "lantiq,adsl-arx100"; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/danube.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/danube.dtsi new file mode 100644 index 000000000..83e85c36a --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/danube.dtsi @@ -0,0 +1,212 @@ +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,xway", "lantiq,danube"; + + aliases { + serial0 = &asc1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + cpus { + cpu@0 { + compatible = "mips,mips24Kc"; + }; + }; + + memory@0 { + device_type = "memory"; + }; + + biu@1F800000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,biu", "simple-bus"; + reg = <0x1F800000 0x800000>; + ranges = <0x0 0x1F800000 0x7FFFFF>; + + icu0: icu@80200 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,icu"; + reg = <0x80200 0x28 + 0x80228 0x28 + 0x80250 0x28 + 0x80278 0x28 + 0x802a0 0x28>; + }; + + watchdog@803F0 { + compatible = "lantiq,wdt"; + reg = <0x803F0 0x10>; + }; + }; + + sram@1F000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,sram", "simple-bus"; + reg = <0x1F000000 0x800000>; + ranges = <0x0 0x1F000000 0x7FFFFF>; + + eiu0: eiu@101000 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,eiu-xway"; + reg = <0x101000 0x1000>; + interrupt-parent = <&icu0>; + lantiq,eiu-irqs = <166 135 66>; + }; + + pmu0: pmu@102000 { + compatible = "lantiq,pmu-xway"; + reg = <0x102000 0x1000>; + }; + + cgu0: cgu@103000 { + compatible = "lantiq,cgu-xway"; + reg = <0x103000 0x1000>; + #clock-cells = <1>; + }; + + vmmc@107000 { + status = "disabled"; + compatible = "lantiq,vmmc-xway"; + reg = <0x103000 0x400>; + interrupt-parent = <&icu0>; + interrupts = <150 151 152 153 154 155>; + }; + + rcu0: rcu@203000 { + compatible = "lantiq,rcu-xway"; + reg = <0x203000 0x1000>; + }; + }; + + fpi@10000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,fpi", "simple-bus"; + ranges = <0x0 0x10000000 0xEEFFFFF>; + reg = <0x10000000 0xEF00000>; + + localbus@0 { + #address-cells = <2>; + #size-cells = <1>; + ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ + 1 0 0x4000000 0x4000010>; /* addsel1 */ + compatible = "lantiq,localbus", "simple-bus"; + }; + + gptu@E100A00 { + compatible = "lantiq,gptu-xway"; + reg = <0xE100A00 0x100>; + interrupt-parent = <&icu0>; + interrupts = <126 127 128 129 130 131>; + }; + + gpios: stp@E100BB0 { + #gpio-cells = <2>; + compatible = "lantiq,gpio-stp-xway"; + gpio-controller; + reg = <0xE100BB0 0x40>; + lantiq,shadow = <0xfff>; + lantiq,groups = <0x3>; + status = "disabled"; + }; + + asc0: serial@E100400 { + compatible = "lantiq,asc"; + reg = <0xE100400 0x400>; + interrupt-parent = <&icu0>; + interrupts = <104 105 106>; + status = "disabled"; + }; + + gpio: pinmux@E100B10 { + compatible = "lantiq,danube-pinctrl"; + #gpio-cells = <2>; + gpio-controller; + reg = <0xE100B10 0xA0>; + }; + + asc1: serial@E100C00 { + compatible = "lantiq,asc"; + reg = <0xE100C00 0x400>; + interrupt-parent = <&icu0>; + interrupts = <112 113 114>; + }; + + ifxhcd@E101000 { + compatible = "lantiq,danube-usb", "lantiq,ifxhcd-danube"; + reg = <0xE101000 0x1000 + 0xE120000 0x3f000>; + interrupt-parent = <&icu0>; + interrupts = <62>; + dr_mode = "host"; + status = "disabled"; + }; + + deu@E103100 { + compatible = "lantiq,deu-danube"; + reg = <0xE103100 0xf00>; + }; + + dma0: dma@E104100 { + compatible = "lantiq,dma-xway"; + reg = <0xE104100 0x800>; + }; + + ebu0: ebu@E105300 { + compatible = "lantiq,ebu-xway"; + reg = <0xE105300 0x100>; + }; + + mei@E116000 { + compatible = "lantiq,mei-xway"; + interrupt-parent = <&icu0>; + interrupts = <63>; + }; + + etop@E180000 { + compatible = "lantiq,etop-xway"; + reg = <0xE180000 0x40000>; + interrupt-parent = <&icu0>; + interrupts = <73 78>; + mac-address = [ 00 11 22 33 44 55 ]; + }; + + ppe@E234000 { + compatible = "lantiq,ppe-danube"; + interrupt-parent = <&icu0>; + interrupts = <96>; + }; + + pci0: pci@E105400 { + status = "disabled"; + + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + compatible = "lantiq,pci-xway"; + bus-range = <0x0 0x0>; + ranges = <0x2000000 0 0x8000000 0x8000000 0 0x2000000 /* pci memory */ + 0x1000000 0 0x00000000 0xAE00000 0 0x200000>; /* io space */ + reg = <0x7000000 0x8000 /* config space */ + 0xE105400 0x400>; /* pci bridge */ + lantiq,bus-clock = <33333333>; + interrupt-map-mask = <0xf800 0x0 0x0 0x7>; + interrupt-map = <0x7000 0 0 1 &icu0 30 1>; /* slot 14, irq 30 */ + req-mask = <0x1>; /* GNT1 */ + }; + }; + + adsl { + compatible = "lantiq,adsl-danube"; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon-sflash-16M.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon-sflash-16M.dtsi new file mode 100644 index 000000000..d95acc21e --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon-sflash-16M.dtsi @@ -0,0 +1,37 @@ + +&ebu_cs0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,sflash-falcon", "simple-bus"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spansion,s25fl129p0", "spansion,s25fl129p1"; + reg = <0 0>; + linux,mtd-name = "sflash"; + spi-max-frequency = <80000000>; + m25p,fast-read; + + partition@0 { + reg = <0x0 0x40000>; + label = "uboot"; + read-only; + }; + + partition@40000 { + reg = <0x40000 0x80000>; + label = "uboot_env"; + }; + + partition@C0000 { + reg = <0xC0000 0x740000>; + label = "image0"; + }; + + partition@800000 { + reg = <0x800000 0x800000>; + label = "image1"; + }; + }; +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon.dtsi new file mode 100644 index 000000000..98f71819a --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/falcon.dtsi @@ -0,0 +1,392 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,falcon"; + + cpus { + cpu@0 { + compatible = "mips,mips34kc"; + }; + }; + + aliases { + serial0 = &serial0; + serial1 = &serial1; + gpio0 = &gpio0; + gpio1 = &gpio1; + gpio2 = &gpio2; + gpio3 = &gpio3; + gpio4 = &gpio4; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + clocks { + compatible = "simple-bus"; + + cpu_clk: cpu { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <400000000>; + clock-output-names = "cpu"; + }; + + io_clk: io { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <200000000>; + clock-output-names = "io"; + }; + + fpi_clk: fpi { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + clock-output-names = "fpi"; + }; + }; + + ebu_cs0: localbus@10000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,localbus", "simple-bus"; + reg = <0x10000000 0x4000000>; + ranges = <0x0 0x10000000 0x4000000>; + }; + ebu_cs1: localbus@14000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,localbus", "simple-bus"; + reg = <0x14000000 0x4000000>; + ranges = <0x0 0x14000000 0x4000000>; + }; + + ebu@18000000 { + compatible = "lantiq,ebu-falcon"; + reg = <0x18000000 0x100>; + }; + + sbs2@1D000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,sysb2", "simple-bus"; + reg = <0x1D000000 0x1000000>; + ranges = <0x0 0x1D000000 0x1000000>; + + clock_sysgpe: clock-controller@700000 { + compatible = "lantiq,sysgpe-falcon"; + reg = <0x700000 0x100>; + #clock-cells = <1>; + }; + + mps@4000 { + compatible = "lantiq,mps-falcon", "lantiq,mps-xrx100"; + reg = <0x4000 0x1000>; + interrupt-parent = <&icu0>; + interrupts = <154 155>; + lantiq,mbx = <&mpsmbx>; + }; + + gpio0: gpio@810000 { + compatible = "lantiq,falcon-gpio"; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&icu0>; + interrupts = <44>; + reg = <0x810000 0x80>; + clocks = <&clock_syseth 16>; + }; + + gpio2: gpio@810100 { + compatible = "lantiq,falcon-gpio"; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&icu0>; + interrupts = <46>; + reg = <0x810100 0x80>; + clocks = <&clock_syseth 17>; + }; + + clock_syseth: clock-controller@B00000 { + compatible = "lantiq,syseth-falcon"; + reg = <0xB00000 0x100>; + #clock-cells = <1>; + }; + + pad@B01000 { + compatible = "lantiq,pad-falcon"; + reg = <0xB01000 0x100>; + lantiq,bank = <0>; + clocks = <&clock_syseth 20>; + }; + + pad@B02000 { + compatible = "lantiq,pad-falcon"; + reg = <0xB02000 0x100>; + lantiq,bank = <2>; + clocks = <&clock_syseth 21>; + }; + }; + + fpi@1E000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,fpi", "simple-bus"; + reg = <0x1E000000 0x1000000>; + ranges = <0x0 0x1E000000 0x1000000>; + + serial1: serial@100B00 { + status = "disabled"; + compatible = "lantiq,asc"; + reg = <0x100B00 0x100>; + interrupt-parent = <&icu0>; + interrupts = <112 113 114>; + line = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&asc1_pins>; + clocks = <&clock_sys1 11>; + }; + + serial0: serial@100C00 { + compatible = "lantiq,asc"; + reg = <0x100C00 0x100>; + interrupt-parent = <&icu0>; + interrupts = <104 105 106>; + line = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&asc0_pins>; + clocks = <&clock_sys1 12>; + }; + + spi: spi@100D00 { + status = "disabled"; + compatible = "lantiq,falcon-spi", "lantiq,xrx100-spi", "lantiq,spi-lantiq-ssc"; + interrupts = <22 23 24 25>; + interrupt-names = "spi_tx", "spi_rx", "spi_err", "spi_frm"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x100D00 0x100>; + interrupt-parent = <&icu0>; + clocks = <&clock_sys1 13>; + base_cs = <1>; + num_cs = <2>; + }; + + gptc@100E00 { + compatible = "lantiq,gptc-falcon"; + reg = <0x100E00 0x100>; + }; + + i2c: i2c@200000 { + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,lantiq-i2c"; + reg = <0x200000 0x10000>; + interrupt-parent = <&icu0>; + interrupts = <18 19 20 21>; + gpios = <&gpio1 7 0 &gpio1 8 0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + clocks = <&clock_sys1 14>; + }; + + gpio1: gpio@800100 { + compatible = "lantiq,falcon-gpio"; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&icu0>; + interrupts = <45>; + reg = <0x800100 0x100>; + clocks = <&clock_sys1 16>; + }; + + gpio3: gpio@800200 { + compatible = "lantiq,falcon-gpio"; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&icu0>; + interrupts = <47>; + reg = <0x800200 0x100>; + clocks = <&clock_sys1 17>; + }; + + gpio4: gpio@800300 { + compatible = "lantiq,falcon-gpio"; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&icu0>; + interrupts = <48>; + reg = <0x800300 0x100>; + clocks = <&clock_sys1 18>; + }; + + pad@800400 { + compatible = "lantiq,pad-falcon"; + reg = <0x800400 0x100>; + lantiq,bank = <1>; + clocks = <&clock_sys1 20>; + }; + + pad@800500 { + compatible = "lantiq,pad-falcon"; + reg = <0x800500 0x100>; + lantiq,bank = <3>; + clocks = <&clock_sys1 21>; + }; + + pad@800600 { + compatible = "lantiq,pad-falcon"; + reg = <0x800600 0x100>; + lantiq,bank = <4>; + clocks = <&clock_sys1 22>; + }; + + status@802000 { + compatible = "lantiq,status-falcon"; + reg = <0x802000 0x80>; + }; + + clock_sys1: clock-controller@F00000 { + compatible = "lantiq,sys1-falcon"; + reg = <0xF00000 0x100>; + #clock-cells = <1>; + }; + }; + + sbs0@1F000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + reg = <0x1F000000 0x400000>; + ranges = <0x0 0x1F000000 0x400000>; + + mpsmbx: mpsmbx@200000 { + reg = <0x200000 0x200>; + }; + }; + + sbs1@1F700000 { + + }; + + biu@1F800000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,biu", "simple-bus"; + reg = <0x1F800000 0x800000>; + ranges = <0x0 0x1F800000 0x800000>; + + icu0: icu@80200 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,icu"; + reg = <0x80200 0x28 + 0x80228 0x28 + 0x80250 0x28 + 0x80278 0x28 + 0x802a0 0x28>; + }; + + watchdog@803F0 { + compatible = "lantiq,wdt"; + reg = <0x803F0 0x10>; + clocks = <&io_clk>; /* currently no effect */ + }; + }; + + pinctrl { + compatible = "lantiq,pinctrl-falcon"; + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: pinctrl0 { + /*ntr { + lantiq,groups = "ntr8k"; + lantiq,function = "ntr"; + };*/ + hrst { + lantiq,groups = "hrst"; + lantiq,function = "rst"; + }; + }; + + asc0_pins: asc0 { + asc0 { + lantiq,groups = "asc0"; + lantiq,function = "asc"; + }; + }; + asc1_pins: asc1 { + asc1 { + lantiq,groups = "asc1"; + lantiq,function = "asc"; + }; + }; + i2c_pins: i2c { + i2c { + lantiq,groups = "i2c"; + lantiq,function = "i2c"; + }; + }; + bootled_pins: bootled { + bootled { + lantiq,groups = "bootled"; + lantiq,function = "led"; + }; + }; + ntr_ntr8k: ntr8k { + ntr8k { + lantiq,groups = "ntr8k"; + lantiq,function = "ntr"; + }; + }; + ntr_pps: pps { + pps { + lantiq,groups = "pps"; + lantiq,function = "ntr"; + }; + }; + ntr_gpio: gpio { + gpio { + lantiq,pins = "io5"; + lantiq,mux = <1>; + lantiq,output = <0>; + }; + }; + slic_pins: slic { + slic { + lantiq,groups = "slic"; + lantiq,function = "slic"; + }; + }; + }; + + pinselect-ntr { + compatible = "lantiq,onu-ntr","lantiq,pinselect-ntr"; + pinctrl-names = "ntr8k", "pps", "gpio"; + pinctrl-0 = <&ntr_ntr8k>; + pinctrl-1 = <&ntr_pps>; + pinctrl-2 = <&ntr_gpio>; + }; + + pinselect-asc1 { + compatible = "lantiq,onu-asc1","lantiq,pinselect-asc1"; + pinctrl-names = "default", "asc1"; + pinctrl-0 = <&slic_pins>; + pinctrl-1 = <&asc1_pins>; + }; + +}; diff --git a/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi new file mode 100644 index 000000000..dbcbb3dce --- /dev/null +++ b/target/linux/lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi @@ -0,0 +1,260 @@ +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,xway", "lantiq,vr9"; + + aliases { + serial0 = &asc1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + cpus { + cpu@0 { + compatible = "mips,mips34Kc"; + }; + }; + + memory@0 { + device_type = "memory"; + }; + + cputemp@0 { + compatible = "lantiq,cputemp"; + }; + + biu@1F800000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,biu", "simple-bus"; + reg = <0x1F800000 0x800000>; + ranges = <0x0 0x1F800000 0x7FFFFF>; + + icu0: icu@80200 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,icu"; + reg = <0x80200 0x28 + 0x80228 0x28 + 0x80250 0x28 + 0x80278 0x28 + 0x802a0 0x28>; + }; + + watchdog@803F0 { + compatible = "lantiq,wdt"; + reg = <0x803F0 0x10>; + }; + }; + + sram@1F000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,sram", "simple-bus"; + reg = <0x1F000000 0x800000>; + ranges = <0x0 0x1F000000 0x7FFFFF>; + + eiu0: eiu@101000 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "lantiq,eiu-xway"; + reg = <0x101000 0x1000>; + interrupt-parent = <&icu0>; + lantiq,eiu-irqs = <166 135 66 40 41 42>; + }; + + pmu0: pmu@102000 { + compatible = "lantiq,pmu-xway"; + reg = <0x102000 0x1000>; + }; + + cgu0: cgu@103000 { + compatible = "lantiq,cgu-xway"; + reg = <0x103000 0x1000>; + }; + + dcdc@106a00 { + compatible = "lantiq,dcdc-xrx200"; + reg = <0x106a00 0x200>; + }; + + vmmc@107000 { + status = "disabled"; + compatible = "lantiq,vmmc-xway"; + reg = <0x103000 0x400>; + interrupt-parent = <&icu0>; + interrupts = <150 151 152 153 154 155>; + }; + + rcu0: rcu@203000 { + compatible = "lantiq,rcu-xrx200"; + reg = <0x203000 0x1000>; + /* irq for thermal sensor */ + interrupt-parent = <&icu0>; + interrupts = <115>; + }; + + xbar0: xbar@400000 { + compatible = "lantiq,xbar-xway"; + reg = <0x400000 0x1000>; + }; + }; + + fpi@10000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "lantiq,fpi", "simple-bus"; + ranges = <0x0 0x10000000 0xEEFFFFF>; + reg = <0x10000000 0xEF00000>; + + localbus@0 { + #address-cells = <2>; + #size-cells = <1>; + ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ + 1 0 0x4000000 0x4000010>; /* addsel1 */ + compatible = "lantiq,localbus", "simple-bus"; + }; + + gptu@E100A00 { + compatible = "lantiq,gptu-xway"; + reg = <0xE100A00 0x100>; + interrupt-parent = <&icu0>; + interrupts = <126 127 128 129 130 131>; + }; + + usif: usif@da00000 { + compatible = "lantiq,usif"; + reg = <0xda00000 0x1000000>; + interrupt-parent = <&icu0>; + interrupts = <29 125 107 108 109 110>; + status = "disabled"; + }; + + spi: spi@E100800 { + compatible = "lantiq,xrx200-spi", "lantiq,xrx100-spi"; + reg = <0xE100800 0x100>; + interrupt-parent = <&icu0>; + interrupts = <22 23 24>; + interrupt-names = "spi_rx", "spi_tx", "spi_err", + "spi_frm"; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + }; + + gpio: pinmux@E100B10 { + compatible = "lantiq,xrx200-pinctrl"; + #gpio-cells = <2>; + gpio-controller; + reg = <0xE100B10 0xA0>; + }; + + asc1: serial@E100C00 { + compatible = "lantiq,asc"; + reg = <0xE100C00 0x400>; + interrupt-parent = <&icu0>; + interrupts = <112 113 114>; + }; + + deu@E103100 { + compatible = "lantiq,deu-xrx200"; + reg = <0xE103100 0xf00>; + }; + + dma0: dma@E104100 { + compatible = "lantiq,dma-xway"; + reg = <0xE104100 0x800>; + }; + + ebu0: ebu@E105300 { + compatible = "lantiq,ebu-xway"; + reg = <0xE105300 0x100>; + }; + + ifxhcd@E101000 { + status = "disabled"; + compatible = "lantiq,xrx200-usb", "lantiq,ifxhcd-xrx200"; + reg = <0xE101000 0x1000 + 0xE120000 0x3f000>; + interrupt-parent = <&icu0>; + interrupts = <62 91>; + dr_mode = "host"; + }; + + ifxhcd@E106000 { + status = "disabled"; + compatible = "lantiq,xrx200-usb"; + reg = <0xE106000 0x1000>; + interrupt-parent = <&icu0>; + interrupts = <91>; + dr_mode = "host"; + }; + + eth0: eth@E108000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "lantiq,xrx200-net"; + reg = < 0xE108000 0x3000 /* switch */ + 0xE10B100 0x70 /* mdio */ + 0xE10B1D8 0x30 /* mii */ + 0xE10B308 0x30 /* pmac */ + >; + interrupt-parent = <&icu0>; + interrupts = <75 73 72>; + }; + + mei@E116000 { + compatible = "lantiq,mei-xrx200"; + reg = <0xE116000 0x9c>; + interrupt-parent = <&icu0>; + interrupts = <63>; + }; + + ppe@E234000 { + compatible = "lantiq,ppe-xrx200"; + interrupt-parent = <&icu0>; + interrupts = <96>; + }; + + pcie0: pcie@d900000 { + compatible = "lantiq,pcie-xrx200"; + + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + + interrupt-parent = <&icu0>; + interrupts = <161 144>; + + device_type = "pci"; + + gpio-reset = <&gpio 38 GPIO_ACTIVE_HIGH>; + }; + + pci0: pci@E105400 { + status = "disabled"; + + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + compatible = "lantiq,pci-xway"; + bus-range = <0x0 0x0>; + ranges = <0x2000000 0 0x8000000 0x8000000 0 0x2000000 /* pci memory */ + 0x1000000 0 0x00000000 0xAE00000 0 0x200000>; /* io space */ + reg = <0x7000000 0x8000 /* config space */ + 0xE105400 0x400>; /* pci bridge */ + lantiq,bus-clock = <33333333>; + interrupt-map-mask = <0xf800 0x0 0x0 0x7>; + interrupt-map = <0x7000 0 0 1 &icu0 30 1>; /* slot 14, irq 30 */ + req-mask = <0x1>; /* GNT1 */ + }; + }; + + vdsl { + compatible = "lantiq,vdsl-vrx200"; + }; +}; diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile index c4419ce62..031c3fcb8 100644 --- a/target/linux/lantiq/image/Makefile +++ b/target/linux/lantiq/image/Makefile @@ -617,29 +617,13 @@ TARGET_DEVICES += lantiq_easy80920-nor define Device/avm_fritz3370 $(Device/AVM) $(Device/NAND) + BOARD_NAME := FRITZ3370 DEVICE_DTS := FRITZ3370 - DEVICE_TITLE := AVM Fritz!Box WLan 3370 Rev. 2 - KERNEL_SIZE := 4096k - UBINIZE_OPTS := -E 5 - IMAGES += eva-kernel.bin eva-filesystem.bin - IMAGE/eva-kernel.bin := append-kernel - IMAGE/eva-filesystem.bin := append-ubi - DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2 fritz-tffs + DEVICE_TITLE := Fritz!Box WLan - FRITZ3370 + DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-usb-dwc2 + SUPPORTED_DEVICES += FRITZ3370 endef - -define Device/avm_fritz3370-rev2-hynix - $(Device/avm_fritz3370) - DEVICE_DTS := FRITZ3370-REV2-HYNIX - DEVICE_TITLE := AVM Fritz!Box WLan 3370 Rev. 2 (Hynix NAND) -endef -TARGET_DEVICES += avm_fritz3370-rev2-hynix - -define Device/avm_fritz3370-rev2-micron - $(Device/avm_fritz3370) - DEVICE_DTS := FRITZ3370-REV2-MICRON - DEVICE_TITLE := AVM Fritz!Box WLan 3370 Rev. 2 (Micron NAND) -endef -TARGET_DEVICES += avm_fritz3370-rev2-micron +TARGET_DEVICES += avm_fritz3370 define Device/avm_fritz7360sl $(Device/AVM) diff --git a/target/linux/lantiq/patches-4.14/0002-gpio-stp-xway-Implement-get-callback.patch b/target/linux/lantiq/patches-4.14/0002-gpio-stp-xway-Implement-get-callback.patch new file mode 100644 index 000000000..c32b3d6bb --- /dev/null +++ b/target/linux/lantiq/patches-4.14/0002-gpio-stp-xway-Implement-get-callback.patch @@ -0,0 +1,47 @@ +From 5b9b2b5284f81941972105b13337c58489ea8fca Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Thu, 28 Jun 2018 21:57:40 +0200 +Subject: [PATCH] gpio: stp-xway: Implement get callback + +Add an implementation to get the current GPIO state. + +The callback is used by the leds-gpio driver for example, in case the +current LED/GPIO state should be kept during driver load. + +Signed-off-by: Mathias Kresin +Signed-off-by: Linus Walleij +--- + drivers/gpio/gpio-stp-xway.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/gpio/gpio-stp-xway.c ++++ b/drivers/gpio/gpio-stp-xway.c +@@ -91,6 +91,20 @@ struct xway_stp { + }; + + /** ++ * xway_stp_get() - gpio_chip->get - get gpios. ++ * @gc: Pointer to gpio_chip device structure. ++ * @gpio: GPIO signal number. ++ * ++ * Gets the shadow value. ++ */ ++static int xway_stp_get(struct gpio_chip *gc, unsigned int gpio) ++{ ++ struct xway_stp *chip = gpiochip_get_data(gc); ++ ++ return (xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio)); ++} ++ ++/** + * xway_stp_set() - gpio_chip->set - set gpios. + * @gc: Pointer to gpio_chip device structure. + * @gpio: GPIO signal number. +@@ -215,6 +229,7 @@ static int xway_stp_probe(struct platfor + chip->gc.parent = &pdev->dev; + chip->gc.label = "stp-xway"; + chip->gc.direction_output = xway_stp_dir_out; ++ chip->gc.get = xway_stp_get; + chip->gc.set = xway_stp_set; + chip->gc.request = xway_stp_request; + chip->gc.base = -1; diff --git a/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch b/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch new file mode 100644 index 000000000..91a6acce3 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0001-MIPS-lantiq-add-pcie-driver.patch @@ -0,0 +1,5520 @@ +From 6f933347d0b4ed02d9534f5fa07f7b99f13eeaa1 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 7 Aug 2014 18:12:28 +0200 +Subject: [PATCH 01/36] MIPS: lantiq: add pcie driver + +Signed-off-by: John Crispin +--- + arch/mips/lantiq/Kconfig | 10 + + arch/mips/lantiq/xway/sysctrl.c | 2 + + arch/mips/pci/Makefile | 2 + + arch/mips/pci/fixup-lantiq-pcie.c | 82 +++ + arch/mips/pci/fixup-lantiq.c | 5 +- + arch/mips/pci/ifxmips_pci_common.h | 57 ++ + arch/mips/pci/ifxmips_pcie.c | 1099 ++++++++++++++++++++++++++++++ + arch/mips/pci/ifxmips_pcie.h | 135 ++++ + arch/mips/pci/ifxmips_pcie_ar10.h | 290 ++++++++ + arch/mips/pci/ifxmips_pcie_msi.c | 392 +++++++++++ + arch/mips/pci/ifxmips_pcie_phy.c | 478 +++++++++++++ + arch/mips/pci/ifxmips_pcie_pm.c | 176 +++++ + arch/mips/pci/ifxmips_pcie_pm.h | 36 + + arch/mips/pci/ifxmips_pcie_reg.h | 1001 +++++++++++++++++++++++++++ + arch/mips/pci/ifxmips_pcie_vr9.h | 271 ++++++++ + arch/mips/pci/pci.c | 25 + + arch/mips/pci/pcie-lantiq.h | 1305 ++++++++++++++++++++++++++++++++++++ + drivers/pci/pcie/aer/Kconfig | 2 +- + include/linux/pci.h | 2 + + include/linux/pci_ids.h | 6 + + 20 files changed, 5374 insertions(+), 2 deletions(-) + create mode 100644 arch/mips/pci/fixup-lantiq-pcie.c + create mode 100644 arch/mips/pci/ifxmips_pci_common.h + create mode 100644 arch/mips/pci/ifxmips_pcie.c + create mode 100644 arch/mips/pci/ifxmips_pcie.h + create mode 100644 arch/mips/pci/ifxmips_pcie_ar10.h + create mode 100644 arch/mips/pci/ifxmips_pcie_msi.c + create mode 100644 arch/mips/pci/ifxmips_pcie_phy.c + create mode 100644 arch/mips/pci/ifxmips_pcie_pm.c + create mode 100644 arch/mips/pci/ifxmips_pcie_pm.h + create mode 100644 arch/mips/pci/ifxmips_pcie_reg.h + create mode 100644 arch/mips/pci/ifxmips_pcie_vr9.h + create mode 100644 arch/mips/pci/pcie-lantiq.h + +--- a/arch/mips/lantiq/Kconfig ++++ b/arch/mips/lantiq/Kconfig +@@ -17,6 +17,7 @@ config SOC_XWAY + bool "XWAY" + select SOC_TYPE_XWAY + select HW_HAS_PCI ++ select ARCH_SUPPORTS_MSI + + config SOC_FALCON + bool "FALCON" +@@ -47,6 +48,15 @@ config PCI_LANTIQ + bool "PCI Support" + depends on SOC_XWAY && PCI + ++config PCIE_LANTIQ ++ bool "PCIE Support" ++ depends on SOC_XWAY && PCI ++ ++config PCIE_LANTIQ_MSI ++ bool ++ depends on PCIE_LANTIQ && PCI_MSI ++ default y ++ + config XRX200_PHY_FW + bool "XRX200 PHY firmware loader" + depends on SOC_XWAY +--- a/arch/mips/pci/Makefile ++++ b/arch/mips/pci/Makefile +@@ -48,6 +48,8 @@ obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o + obj-$(CONFIG_SOC_MT7620) += pci-mt7620.o + obj-$(CONFIG_SOC_RT288X) += pci-rt2880.o + obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o ++obj-$(CONFIG_PCIE_LANTIQ) += ifxmips_pcie_phy.o ifxmips_pcie.o fixup-lantiq-pcie.o ++obj-$(CONFIG_PCIE_LANTIQ_MSI) += pcie-lantiq-msi.o + obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o + obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o + obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o +--- /dev/null ++++ b/arch/mips/pci/fixup-lantiq-pcie.c +@@ -0,0 +1,74 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_fixup_pcie.c ++** PROJECT : IFX UEIP for VRX200 ++** MODULES : PCIe ++** ++** DATE : 02 Mar 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIe Root Complex Driver ++** COPYRIGHT : Copyright (c) 2009 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** HISTORY ++** $Version $Date $Author $Comment ++** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version ++*******************************************************************************/ ++/*! ++ \file ifxmips_fixup_pcie.c ++ \ingroup IFX_PCIE ++ \brief PCIe Fixup functions source file ++*/ ++#include ++#include ++#include ++ ++#include ++ ++#include "pcie-lantiq.h" ++ ++static void ++ifx_pcie_fixup_resource(struct pci_dev *dev) ++{ ++ u32 reg; ++ ++ IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: enter\n", __func__, pci_name(dev)); ++ ++ printk("%s: fixup host controller %s (%04x:%04x)\n", ++ __func__, pci_name(dev), dev->vendor, dev->device); ++ ++ /* Setup COMMAND register */ ++ reg = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER /* | ++ PCI_COMMAND_INTX_DISABLE */| PCI_COMMAND_SERR; ++ pci_write_config_word(dev, PCI_COMMAND, reg); ++ IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: exit\n", __func__, pci_name(dev)); ++} ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INFINEON, PCI_DEVICE_ID_INFINEON_PCIE, ifx_pcie_fixup_resource); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LANTIQ, PCI_VENDOR_ID_LANTIQ, ifx_pcie_fixup_resource); ++ ++static void ++ifx_pcie_rc_class_early_fixup(struct pci_dev *dev) ++{ ++ IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: enter\n", __func__, pci_name(dev)); ++ ++ if (dev->devfn == PCI_DEVFN(0, 0) && ++ (dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) { ++ ++ dev->class = (PCI_CLASS_BRIDGE_PCI << 8) | (dev->class & 0xff); ++ ++ printk(KERN_INFO "%s: fixed pcie host bridge to pci-pci bridge\n", __func__); ++ } ++ IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: exit\n", __func__, pci_name(dev)); ++ mdelay(10); ++} ++ ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INFINEON, PCI_DEVICE_ID_INFINEON_PCIE, ++ ifx_pcie_rc_class_early_fixup); ++ ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LANTIQ, PCI_DEVICE_ID_LANTIQ_PCIE, ++ ifx_pcie_rc_class_early_fixup); +--- a/arch/mips/pci/fixup-lantiq.c ++++ b/arch/mips/pci/fixup-lantiq.c +@@ -8,12 +8,18 @@ + + #include + #include ++#include "ifxmips_pci_common.h" + + int (*ltq_pci_plat_arch_init)(struct pci_dev *dev) = NULL; + int (*ltq_pci_plat_dev_init)(struct pci_dev *dev) = NULL; + + int pcibios_plat_dev_init(struct pci_dev *dev) + { ++#ifdef CONFIG_PCIE_LANTIQ ++ if (pci_find_capability(dev, PCI_CAP_ID_EXP)) ++ ifx_pcie_bios_plat_dev_init(dev); ++#endif ++ + if (ltq_pci_plat_arch_init) + return ltq_pci_plat_arch_init(dev); + +@@ -25,5 +31,10 @@ int pcibios_plat_dev_init(struct pci_dev + + int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) + { ++#ifdef CONFIG_PCIE_LANTIQ ++ if (pci_find_capability(dev, PCI_CAP_ID_EXP)) ++ return ifx_pcie_bios_map_irq(dev, slot, pin); ++#endif ++ + return of_irq_parse_and_map_pci(dev, slot, pin); + } +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pci_common.h +@@ -0,0 +1,57 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_pci_common.h ++** PROJECT : IFX UEIP ++** MODULES : PCI subsystem ++** ++** DATE : 30 June 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIe Root Complex Driver ++** COPYRIGHT : Copyright (c) 2009 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** HISTORY ++** $Version $Date $Author $Comment ++** 0.0.1 30 June,2009 Lei Chuanhua Initial version ++*******************************************************************************/ ++ ++#ifndef IFXMIPS_PCI_COMMON_H ++#define IFXMIPS_PCI_COMMON_H ++#include ++/*! ++ \defgroup IFX_PCI_COM IFX PCI/PCIe common parts for OS integration ++ \brief PCI/PCIe common parts ++*/ ++ ++/*! ++ \defgroup IFX_PCI_COM_OS OS APIs ++ \ingroup IFX_PCI_COM ++ \brief PCI/PCIe bus driver OS interface functions ++*/ ++/*! ++ \file ifxmips_pci_common.h ++ \ingroup IFX_PCI_COM ++ \brief PCI/PCIe bus driver common OS header file ++*/ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) ++#define IFX_PCI_CONST ++#else ++#define IFX_PCI_CONST const ++#endif ++#ifdef CONFIG_IFX_PCI ++extern int ifx_pci_bios_map_irq(IFX_PCI_CONST struct pci_dev *dev, u8 slot, u8 pin); ++extern int ifx_pci_bios_plat_dev_init(struct pci_dev *dev); ++#endif /* COFNIG_IFX_PCI */ ++ ++#ifdef CONFIG_PCIE_LANTIQ ++extern int ifx_pcie_bios_map_irq(IFX_PCI_CONST struct pci_dev *dev, u8 slot, u8 pin); ++extern int ifx_pcie_bios_plat_dev_init(struct pci_dev *dev); ++#endif ++ ++#endif /* IFXMIPS_PCI_COMMON_H */ ++ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie.c +@@ -0,0 +1,1092 @@ ++/* ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ * ++ * Copyright (C) 2009 Lei Chuanhua ++ * Copyright (C) 2013 John Crispin ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "ifxmips_pcie.h" ++#include "ifxmips_pcie_reg.h" ++ ++/* Enable 32bit io due to its mem mapped io nature */ ++#define IFX_PCIE_ERROR_INT ++#define IFX_PCIE_IO_32BIT ++ ++#define IFX_PCIE_IR (INT_NUM_IM4_IRL0 + 25) ++#define IFX_PCIE_INTA (INT_NUM_IM4_IRL0 + 8) ++#define IFX_PCIE_INTB (INT_NUM_IM4_IRL0 + 9) ++#define IFX_PCIE_INTC (INT_NUM_IM4_IRL0 + 10) ++#define IFX_PCIE_INTD (INT_NUM_IM4_IRL0 + 11) ++#define MS(_v, _f) (((_v) & (_f)) >> _f##_S) ++#define SM(_v, _f) (((_v) << _f##_S) & (_f)) ++#define IFX_REG_SET_BIT(_f, _r) \ ++ IFX_REG_W32((IFX_REG_R32((_r)) &~ (_f)) | (_f), (_r)) ++ ++#define IFX_PCIE_LTSSM_ENABLE_TIMEOUT 10 ++ ++static DEFINE_SPINLOCK(ifx_pcie_lock); ++ ++u32 g_pcie_debug_flag = PCIE_MSG_ANY & (~PCIE_MSG_CFG); ++ ++static ifx_pcie_irq_t pcie_irqs[IFX_PCIE_CORE_NR] = { ++ { ++ .ir_irq = { ++ .irq = IFX_PCIE_IR, ++ .name = "ifx_pcie_rc0", ++ }, ++ ++ .legacy_irq = { ++ { ++ .irq_bit = PCIE_IRN_INTA, ++ .irq = IFX_PCIE_INTA, ++ }, ++ { ++ .irq_bit = PCIE_IRN_INTB, ++ .irq = IFX_PCIE_INTB, ++ }, ++ { ++ .irq_bit = PCIE_IRN_INTC, ++ .irq = IFX_PCIE_INTC, ++ }, ++ { ++ .irq_bit = PCIE_IRN_INTD, ++ .irq = IFX_PCIE_INTD, ++ }, ++ }, ++ }, ++ ++}; ++ ++void ifx_pcie_debug(const char *fmt, ...) ++{ ++ static char buf[256] = {0}; /* XXX */ ++ va_list ap; ++ ++ va_start(ap, fmt); ++ vsnprintf(buf, sizeof(buf), fmt, ap); ++ va_end(ap); ++ ++ printk("%s", buf); ++} ++ ++ ++static inline int pcie_ltssm_enable(int pcie_port) ++{ ++ int i; ++ ++ /* Enable LTSSM */ ++ IFX_REG_W32(PCIE_RC_CCR_LTSSM_ENABLE, PCIE_RC_CCR(pcie_port)); ++ ++ /* Wait for the link to come up */ ++ for (i = 0; i < IFX_PCIE_LTSSM_ENABLE_TIMEOUT; i++) { ++ if (!(IFX_REG_R32(PCIE_LCTLSTS(pcie_port)) & PCIE_LCTLSTS_RETRAIN_PENDING)) ++ return 0; ++ udelay(10); ++ } ++ ++ printk("%s link timeout!!!!!\n", __func__); ++ return -1; ++} ++ ++static inline void pcie_status_register_clear(int pcie_port) ++{ ++ IFX_REG_W32(0, PCIE_RC_DR(pcie_port)); ++ IFX_REG_W32(0, PCIE_PCICMDSTS(pcie_port)); ++ IFX_REG_W32(0, PCIE_DCTLSTS(pcie_port)); ++ IFX_REG_W32(0, PCIE_LCTLSTS(pcie_port)); ++ IFX_REG_W32(0, PCIE_SLCTLSTS(pcie_port)); ++ IFX_REG_W32(0, PCIE_RSTS(pcie_port)); ++ IFX_REG_W32(0, PCIE_UES_R(pcie_port)); ++ IFX_REG_W32(0, PCIE_UEMR(pcie_port)); ++ IFX_REG_W32(0, PCIE_UESR(pcie_port)); ++ IFX_REG_W32(0, PCIE_CESR(pcie_port)); ++ IFX_REG_W32(0, PCIE_CEMR(pcie_port)); ++ IFX_REG_W32(0, PCIE_RESR(pcie_port)); ++ IFX_REG_W32(0, PCIE_PVCCRSR(pcie_port)); ++ IFX_REG_W32(0, PCIE_VC0_RSR0(pcie_port)); ++ IFX_REG_W32(0, PCIE_TPFCS(pcie_port)); ++ IFX_REG_W32(0, PCIE_TNPFCS(pcie_port)); ++ IFX_REG_W32(0, PCIE_TCFCS(pcie_port)); ++ IFX_REG_W32(0, PCIE_QSR(pcie_port)); ++ IFX_REG_W32(0, PCIE_IOBLSECS(pcie_port)); ++} ++ ++static inline int ifx_pcie_link_up(int pcie_port) ++{ ++ return (IFX_REG_R32(PCIE_PHY_SR(pcie_port)) & PCIE_PHY_SR_PHY_LINK_UP) ? 1 : 0; ++} ++ ++ ++static inline void pcie_mem_io_setup(int pcie_port) ++{ ++ u32 reg; ++ /* ++ * BAR[0:1] readonly register ++ * RC contains only minimal BARs for packets mapped to this device ++ * Mem/IO filters defines a range of memory occupied by memory mapped IO devices that ++ * reside on the downstream side fo the bridge. ++ */ ++ reg = SM((PCIE_MEM_PHY_PORT_TO_END(pcie_port) >> 20), PCIE_MBML_MEM_LIMIT_ADDR) ++ | SM((PCIE_MEM_PHY_PORT_TO_BASE(pcie_port) >> 20), PCIE_MBML_MEM_BASE_ADDR); ++ ++ IFX_REG_W32(reg, PCIE_MBML(pcie_port)); ++ ++ ++#ifdef IFX_PCIE_PREFETCH_MEM_64BIT ++ reg = SM((PCIE_MEM_PHY_PORT_TO_END(pcie_port) >> 20), PCIE_PMBL_END_ADDR) ++ | SM((PCIE_MEM_PHY_PORT_TO_BASE(pcie_port) >> 20), PCIE_PMBL_UPPER_12BIT) ++ | PCIE_PMBL_64BIT_ADDR; ++ IFX_REG_W32(reg, PCIE_PMBL(pcie_port)); ++ ++ /* Must configure upper 32bit */ ++ IFX_REG_W32(0, PCIE_PMBU32(pcie_port)); ++ IFX_REG_W32(0, PCIE_PMLU32(pcie_port)); ++#else ++ /* PCIe_PBML, same as MBML */ ++ IFX_REG_W32(IFX_REG_R32(PCIE_MBML(pcie_port)), PCIE_PMBL(pcie_port)); ++#endif ++ ++ /* IO Address Range */ ++ reg = SM((PCIE_IO_PHY_PORT_TO_END(pcie_port) >> 12), PCIE_IOBLSECS_IO_LIMIT_ADDR) ++ | SM((PCIE_IO_PHY_PORT_TO_BASE(pcie_port) >> 12), PCIE_IOBLSECS_IO_BASE_ADDR); ++#ifdef IFX_PCIE_IO_32BIT ++ reg |= PCIE_IOBLSECS_32BIT_IO_ADDR; ++#endif /* IFX_PCIE_IO_32BIT */ ++ IFX_REG_W32(reg, PCIE_IOBLSECS(pcie_port)); ++ ++#ifdef IFX_PCIE_IO_32BIT ++ reg = SM((PCIE_IO_PHY_PORT_TO_END(pcie_port) >> 16), PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT) ++ | SM((PCIE_IO_PHY_PORT_TO_BASE(pcie_port) >> 16), PCIE_IO_BANDL_UPPER_16BIT_IO_BASE); ++ IFX_REG_W32(reg, PCIE_IO_BANDL(pcie_port)); ++ ++#endif /* IFX_PCIE_IO_32BIT */ ++} ++ ++static inline void ++pcie_device_setup(int pcie_port) ++{ ++ u32 reg; ++ ++ /* Device capability register, set up Maximum payload size */ ++ reg = IFX_REG_R32(PCIE_DCAP(pcie_port)); ++ reg |= PCIE_DCAP_ROLE_BASE_ERR_REPORT; ++ reg |= SM(PCIE_MAX_PAYLOAD_128, PCIE_DCAP_MAX_PAYLOAD_SIZE); ++ ++ /* Only available for EP */ ++ reg &= ~(PCIE_DCAP_EP_L0S_LATENCY | PCIE_DCAP_EP_L1_LATENCY); ++ IFX_REG_W32(reg, PCIE_DCAP(pcie_port)); ++ ++ /* Device control and status register */ ++ /* Set Maximum Read Request size for the device as a Requestor */ ++ reg = IFX_REG_R32(PCIE_DCTLSTS(pcie_port)); ++ ++ /* ++ * Request size can be larger than the MPS used, but the completions returned ++ * for the read will be bounded by the MPS size. ++ * In our system, Max request size depends on AHB burst size. It is 64 bytes. ++ * but we set it as 128 as minimum one. ++ */ ++ reg |= SM(PCIE_MAX_PAYLOAD_128, PCIE_DCTLSTS_MAX_READ_SIZE) ++ | SM(PCIE_MAX_PAYLOAD_128, PCIE_DCTLSTS_MAX_PAYLOAD_SIZE); ++ ++ /* Enable relaxed ordering, no snoop, and all kinds of errors */ ++ reg |= PCIE_DCTLSTS_RELAXED_ORDERING_EN | PCIE_DCTLSTS_ERR_EN | PCIE_DCTLSTS_NO_SNOOP_EN; ++ ++ IFX_REG_W32(reg, PCIE_DCTLSTS(pcie_port)); ++} ++ ++static inline void ++pcie_link_setup(int pcie_port) ++{ ++ u32 reg; ++ ++ /* ++ * XXX, Link capability register, bit 18 for EP CLKREQ# dynamic clock management for L1, L2/3 CPM ++ * L0s is reported during link training via TS1 order set by N_FTS ++ */ ++ reg = IFX_REG_R32(PCIE_LCAP(pcie_port)); ++ reg &= ~PCIE_LCAP_L0S_EIXT_LATENCY; ++ reg |= SM(3, PCIE_LCAP_L0S_EIXT_LATENCY); ++ IFX_REG_W32(reg, PCIE_LCAP(pcie_port)); ++ ++ /* Link control and status register */ ++ reg = IFX_REG_R32(PCIE_LCTLSTS(pcie_port)); ++ ++ /* Link Enable, ASPM enabled */ ++ reg &= ~PCIE_LCTLSTS_LINK_DISABLE; ++ ++#ifdef CONFIG_PCIEASPM ++ /* ++ * We use the same physical reference clock that the platform provides on the connector ++ * It paved the way for ASPM to calculate the new exit Latency ++ */ ++ reg |= PCIE_LCTLSTS_SLOT_CLK_CFG; ++ reg |= PCIE_LCTLSTS_COM_CLK_CFG; ++ /* ++ * We should disable ASPM by default except that we have dedicated power management support ++ * Enable ASPM will cause the system hangup/instability, performance degration ++ */ ++ reg |= PCIE_LCTLSTS_ASPM_ENABLE; ++#else ++ reg &= ~PCIE_LCTLSTS_ASPM_ENABLE; ++#endif /* CONFIG_PCIEASPM */ ++ ++ /* ++ * The maximum size of any completion with data packet is bounded by the MPS setting ++ * in device control register ++ */ ++ ++ /* RCB may cause multiple split transactions, two options available, we use 64 byte RCB */ ++ reg &= ~ PCIE_LCTLSTS_RCB128; ++ ++ IFX_REG_W32(reg, PCIE_LCTLSTS(pcie_port)); ++} ++ ++static inline void pcie_error_setup(int pcie_port) ++{ ++ u32 reg; ++ ++ /* ++ * Forward ERR_COR, ERR_NONFATAL, ERR_FATAL to the backbone ++ * Poisoned write TLPs and completions indicating poisoned TLPs will set the PCIe_PCICMDSTS.MDPE ++ */ ++ reg = IFX_REG_R32(PCIE_INTRBCTRL(pcie_port)); ++ reg |= PCIE_INTRBCTRL_SERR_ENABLE | PCIE_INTRBCTRL_PARITY_ERR_RESP_ENABLE; ++ ++ IFX_REG_W32(reg, PCIE_INTRBCTRL(pcie_port)); ++ ++ /* Uncorrectable Error Mask Register, Unmask all bits in PCIE_UESR */ ++ reg = IFX_REG_R32(PCIE_UEMR(pcie_port)); ++ reg &= ~PCIE_ALL_UNCORRECTABLE_ERR; ++ IFX_REG_W32(reg, PCIE_UEMR(pcie_port)); ++ ++ /* Uncorrectable Error Severity Register, ALL errors are FATAL */ ++ IFX_REG_W32(PCIE_ALL_UNCORRECTABLE_ERR, PCIE_UESR(pcie_port)); ++ ++ /* Correctable Error Mask Register, unmask all bits */ ++ reg = IFX_REG_R32(PCIE_CEMR(pcie_port)); ++ reg &= ~PCIE_CORRECTABLE_ERR; ++ IFX_REG_W32(reg, PCIE_CEMR(pcie_port)); ++ ++ /* Advanced Error Capabilities and Control Registr */ ++ reg = IFX_REG_R32(PCIE_AECCR(pcie_port)); ++ reg |= PCIE_AECCR_ECRC_CHECK_EN | PCIE_AECCR_ECRC_GEN_EN; ++ IFX_REG_W32(reg, PCIE_AECCR(pcie_port)); ++ ++ /* Root Error Command Register, Report all types of errors */ ++ reg = IFX_REG_R32(PCIE_RECR(pcie_port)); ++ reg |= PCIE_RECR_ERR_REPORT_EN; ++ IFX_REG_W32(reg, PCIE_RECR(pcie_port)); ++ ++ /* Clear the Root status register */ ++ reg = IFX_REG_R32(PCIE_RESR(pcie_port)); ++ IFX_REG_W32(reg, PCIE_RESR(pcie_port)); ++} ++ ++static inline void pcie_port_logic_setup(int pcie_port) ++{ ++ u32 reg; ++ ++ /* FTS number, default 12, increase to 63, may increase time from/to L0s to L0 */ ++ reg = IFX_REG_R32(PCIE_AFR(pcie_port)); ++ reg &= ~(PCIE_AFR_FTS_NUM | PCIE_AFR_COM_FTS_NUM); ++ reg |= SM(PCIE_AFR_FTS_NUM_DEFAULT, PCIE_AFR_FTS_NUM) ++ | SM(PCIE_AFR_FTS_NUM_DEFAULT, PCIE_AFR_COM_FTS_NUM); ++ /* L0s and L1 entry latency */ ++ reg &= ~(PCIE_AFR_L0S_ENTRY_LATENCY | PCIE_AFR_L1_ENTRY_LATENCY); ++ reg |= SM(PCIE_AFR_L0S_ENTRY_LATENCY_DEFAULT, PCIE_AFR_L0S_ENTRY_LATENCY) ++ | SM(PCIE_AFR_L1_ENTRY_LATENCY_DEFAULT, PCIE_AFR_L1_ENTRY_LATENCY); ++ IFX_REG_W32(reg, PCIE_AFR(pcie_port)); ++ ++ ++ /* Port Link Control Register */ ++ reg = IFX_REG_R32(PCIE_PLCR(pcie_port)); ++ reg |= PCIE_PLCR_DLL_LINK_EN; /* Enable the DLL link */ ++ IFX_REG_W32(reg, PCIE_PLCR(pcie_port)); ++ ++ /* Lane Skew Register */ ++ reg = IFX_REG_R32(PCIE_LSR(pcie_port)); ++ /* Enable ACK/NACK and FC */ ++ reg &= ~(PCIE_LSR_ACKNAK_DISABLE | PCIE_LSR_FC_DISABLE); ++ IFX_REG_W32(reg, PCIE_LSR(pcie_port)); ++ ++ /* Symbol Timer Register and Filter Mask Register 1 */ ++ reg = IFX_REG_R32(PCIE_STRFMR(pcie_port)); ++ ++ /* Default SKP interval is very accurate already, 5us */ ++ /* Enable IO/CFG transaction */ ++ reg |= PCIE_STRFMR_RX_CFG_TRANS_ENABLE | PCIE_STRFMR_RX_IO_TRANS_ENABLE; ++ /* Disable FC WDT */ ++ reg &= ~PCIE_STRFMR_FC_WDT_DISABLE; ++ IFX_REG_W32(reg, PCIE_STRFMR(pcie_port)); ++ ++ /* Filter Masker Register 2 */ ++ reg = IFX_REG_R32(PCIE_FMR2(pcie_port)); ++ reg |= PCIE_FMR2_VENDOR_MSG1_PASSED_TO_TRGT1 | PCIE_FMR2_VENDOR_MSG0_PASSED_TO_TRGT1; ++ IFX_REG_W32(reg, PCIE_FMR2(pcie_port)); ++ ++ /* VC0 Completion Receive Queue Control Register */ ++ reg = IFX_REG_R32(PCIE_VC0_CRQCR(pcie_port)); ++ reg &= ~PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE; ++ reg |= SM(PCIE_VC0_TLP_QUEUE_MODE_BYPASS, PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE); ++ IFX_REG_W32(reg, PCIE_VC0_CRQCR(pcie_port)); ++} ++ ++static inline void pcie_rc_cfg_reg_setup(int pcie_port) ++{ ++ u32 reg; ++ ++ /* Disable LTSSM */ ++ IFX_REG_W32(0, PCIE_RC_CCR(pcie_port)); /* Disable LTSSM */ ++ ++ pcie_mem_io_setup(pcie_port); ++ ++ /* XXX, MSI stuff should only apply to EP */ ++ /* MSI Capability: Only enable 32-bit addresses */ ++ reg = IFX_REG_R32(PCIE_MCAPR(pcie_port)); ++ reg &= ~PCIE_MCAPR_ADDR64_CAP; ++ ++ reg |= PCIE_MCAPR_MSI_ENABLE; ++ ++ /* Disable multiple message */ ++ reg &= ~(PCIE_MCAPR_MULTI_MSG_CAP | PCIE_MCAPR_MULTI_MSG_ENABLE); ++ IFX_REG_W32(reg, PCIE_MCAPR(pcie_port)); ++ ++ ++ /* Enable PME, Soft reset enabled */ ++ reg = IFX_REG_R32(PCIE_PM_CSR(pcie_port)); ++ reg |= PCIE_PM_CSR_PME_ENABLE | PCIE_PM_CSR_SW_RST; ++ IFX_REG_W32(reg, PCIE_PM_CSR(pcie_port)); ++ ++ /* setup the bus */ ++ reg = SM(0, PCIE_BNR_PRIMARY_BUS_NUM) | SM(1, PCIE_PNR_SECONDARY_BUS_NUM) | SM(0xFF, PCIE_PNR_SUB_BUS_NUM); ++ IFX_REG_W32(reg, PCIE_BNR(pcie_port)); ++ ++ ++ pcie_device_setup(pcie_port); ++ pcie_link_setup(pcie_port); ++ pcie_error_setup(pcie_port); ++ ++ /* Root control and capabilities register */ ++ reg = IFX_REG_R32(PCIE_RCTLCAP(pcie_port)); ++ reg |= PCIE_RCTLCAP_SERR_ENABLE | PCIE_RCTLCAP_PME_INT_EN; ++ IFX_REG_W32(reg, PCIE_RCTLCAP(pcie_port)); ++ ++ /* Port VC Capability Register 2 */ ++ reg = IFX_REG_R32(PCIE_PVC2(pcie_port)); ++ reg &= ~PCIE_PVC2_VC_ARB_WRR; ++ reg |= PCIE_PVC2_VC_ARB_16P_FIXED_WRR; ++ IFX_REG_W32(reg, PCIE_PVC2(pcie_port)); ++ ++ /* VC0 Resource Capability Register */ ++ reg = IFX_REG_R32(PCIE_VC0_RC(pcie_port)); ++ reg &= ~PCIE_VC0_RC_REJECT_SNOOP; ++ IFX_REG_W32(reg, PCIE_VC0_RC(pcie_port)); ++ ++ pcie_port_logic_setup(pcie_port); ++} ++ ++static int ifx_pcie_wait_phy_link_up(int pcie_port) ++{ ++#define IFX_PCIE_PHY_LINK_UP_TIMEOUT 1000 /* XXX, tunable */ ++ int i; ++ ++ /* Wait for PHY link is up */ ++ for (i = 0; i < IFX_PCIE_PHY_LINK_UP_TIMEOUT; i++) { ++ if (ifx_pcie_link_up(pcie_port)) { ++ break; ++ } ++ udelay(100); ++ } ++ if (i >= IFX_PCIE_PHY_LINK_UP_TIMEOUT) { ++ printk(KERN_ERR "%s timeout\n", __func__); ++ return -1; ++ } ++ ++ /* Check data link up or not */ ++ if (!(IFX_REG_R32(PCIE_RC_DR(pcie_port)) & PCIE_RC_DR_DLL_UP)) { ++ printk(KERN_ERR "%s DLL link is still down\n", __func__); ++ return -1; ++ } ++ ++ /* Check Data link active or not */ ++ if (!(IFX_REG_R32(PCIE_LCTLSTS(pcie_port)) & PCIE_LCTLSTS_DLL_ACTIVE)) { ++ printk(KERN_ERR "%s DLL is not active\n", __func__); ++ return -1; ++ } ++ return 0; ++} ++ ++static inline int pcie_app_loigc_setup(int pcie_port) ++{ ++ /* supress ahb bus errrors */ ++ IFX_REG_W32(PCIE_AHB_CTRL_BUS_ERROR_SUPPRESS, PCIE_AHB_CTRL(pcie_port)); ++ ++ /* Pull PCIe EP out of reset */ ++ pcie_device_rst_deassert(pcie_port); ++ ++ /* Start LTSSM training between RC and EP */ ++ pcie_ltssm_enable(pcie_port); ++ ++ /* Check PHY status after enabling LTSSM */ ++ if (ifx_pcie_wait_phy_link_up(pcie_port) != 0) ++ return -1; ++ ++ return 0; ++} ++ ++/* ++ * The numbers below are directly from the PCIe spec table 3-4/5. ++ */ ++static inline void pcie_replay_time_update(int pcie_port) ++{ ++ u32 reg; ++ int nlw; ++ int rtl; ++ ++ reg = IFX_REG_R32(PCIE_LCTLSTS(pcie_port)); ++ ++ nlw = MS(reg, PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH); ++ switch (nlw) { ++ case PCIE_MAX_LENGTH_WIDTH_X1: ++ rtl = 1677; ++ break; ++ case PCIE_MAX_LENGTH_WIDTH_X2: ++ rtl = 867; ++ break; ++ case PCIE_MAX_LENGTH_WIDTH_X4: ++ rtl = 462; ++ break; ++ case PCIE_MAX_LENGTH_WIDTH_X8: ++ rtl = 258; ++ break; ++ default: ++ rtl = 1677; ++ break; ++ } ++ reg = IFX_REG_R32(PCIE_ALTRT(pcie_port)); ++ reg &= ~PCIE_ALTRT_REPLAY_TIME_LIMIT; ++ reg |= SM(rtl, PCIE_ALTRT_REPLAY_TIME_LIMIT); ++ IFX_REG_W32(reg, PCIE_ALTRT(pcie_port)); ++} ++ ++/* ++ * Table 359 Enhanced Configuration Address Mapping1) ++ * 1) This table is defined in Table 7-1, page 341, PCI Express Base Specification v1.1 ++ * Memory Address PCI Express Configuration Space ++ * A[(20+n-1):20] Bus Number 1 < n < 8 ++ * A[19:15] Device Number ++ * A[14:12] Function Number ++ * A[11:8] Extended Register Number ++ * A[7:2] Register Number ++ * A[1:0] Along with size of the access, used to generate Byte Enables ++ * For VR9, only the address bits [22:0] are mapped to the configuration space: ++ * . Address bits [22:20] select the target bus (1-of-8)1) ++ * . Address bits [19:15] select the target device (1-of-32) on the bus ++ * . Address bits [14:12] select the target function (1-of-8) within the device. ++ * . Address bits [11:2] selects the target dword (1-of-1024) within the selected function.s configuration space ++ * . Address bits [1:0] define the start byte location within the selected dword. ++ */ ++static inline u32 pcie_bus_addr(u8 bus_num, u16 devfn, int where) ++{ ++ u32 addr; ++ u8 bus; ++ ++ if (!bus_num) { ++ /* type 0 */ ++ addr = ((PCI_SLOT(devfn) & 0x1F) << 15) | ((PCI_FUNC(devfn) & 0x7) << 12) | ((where & 0xFFF)& ~3); ++ } else { ++ bus = bus_num; ++ /* type 1, only support 8 buses */ ++ addr = ((bus & 0x7) << 20) | ((PCI_SLOT(devfn) & 0x1F) << 15) | ++ ((PCI_FUNC(devfn) & 0x7) << 12) | ((where & 0xFFF) & ~3); ++ } ++ return addr; ++} ++ ++static int pcie_valid_config(int pcie_port, int bus, int dev) ++{ ++ /* RC itself */ ++ if ((bus == 0) && (dev == 0)) { ++ return 1; ++ } ++ ++ /* No physical link */ ++ if (!ifx_pcie_link_up(pcie_port)) { ++ return 0; ++ } ++ ++ /* Bus zero only has RC itself ++ * XXX, check if EP will be integrated ++ */ ++ if ((bus == 0) && (dev != 0)) { ++ return 0; ++ } ++ ++ /* Maximum 8 buses supported for VRX */ ++ if (bus > 9) { ++ return 0; ++ } ++ ++ /* ++ * PCIe is PtP link, one bus only supports only one device ++ * except bus zero and PCIe switch which is virtual bus device ++ * The following two conditions really depends on the system design ++ * and attached the device. ++ * XXX, how about more new switch ++ */ ++ if ((bus == 1) && (dev != 0)) { ++ return 0; ++ } ++ ++ if ((bus >= 3) && (dev != 0)) { ++ return 0; ++ } ++ return 1; ++} ++ ++static inline u32 ifx_pcie_cfg_rd(int pcie_port, u32 reg) ++{ ++ return IFX_REG_R32((volatile u32 *)(PCIE_CFG_PORT_TO_BASE(pcie_port) + reg)); ++} ++ ++static inline void ifx_pcie_cfg_wr(int pcie_port, unsigned int reg, u32 val) ++{ ++ IFX_REG_W32( val, (volatile u32 *)(PCIE_CFG_PORT_TO_BASE(pcie_port) + reg)); ++} ++ ++static inline u32 ifx_pcie_rc_cfg_rd(int pcie_port, u32 reg) ++{ ++ return IFX_REG_R32((volatile u32 *)(PCIE_RC_PORT_TO_BASE(pcie_port) + reg)); ++} ++ ++static inline void ifx_pcie_rc_cfg_wr(int pcie_port, unsigned int reg, u32 val) ++{ ++ IFX_REG_W32(val, (volatile u32 *)(PCIE_RC_PORT_TO_BASE(pcie_port) + reg)); ++} ++ ++u32 ifx_pcie_bus_enum_read_hack(int where, u32 value) ++{ ++ u32 tvalue = value; ++ ++ if (where == PCI_PRIMARY_BUS) { ++ u8 primary, secondary, subordinate; ++ ++ primary = tvalue & 0xFF; ++ secondary = (tvalue >> 8) & 0xFF; ++ subordinate = (tvalue >> 16) & 0xFF; ++ primary += pcibios_1st_host_bus_nr(); ++ secondary += pcibios_1st_host_bus_nr(); ++ subordinate += pcibios_1st_host_bus_nr(); ++ tvalue = (tvalue & 0xFF000000) | (u32)primary | (u32)(secondary << 8) | (u32)(subordinate << 16); ++ } ++ return tvalue; ++} ++ ++u32 ifx_pcie_bus_enum_write_hack(int where, u32 value) ++{ ++ u32 tvalue = value; ++ ++ if (where == PCI_PRIMARY_BUS) { ++ u8 primary, secondary, subordinate; ++ ++ primary = tvalue & 0xFF; ++ secondary = (tvalue >> 8) & 0xFF; ++ subordinate = (tvalue >> 16) & 0xFF; ++ if (primary > 0 && primary != 0xFF) { ++ primary -= pcibios_1st_host_bus_nr(); ++ } ++ ++ if (secondary > 0 && secondary != 0xFF) { ++ secondary -= pcibios_1st_host_bus_nr(); ++ } ++ if (subordinate > 0 && subordinate != 0xFF) { ++ subordinate -= pcibios_1st_host_bus_nr(); ++ } ++ tvalue = (tvalue & 0xFF000000) | (u32)primary | (u32)(secondary << 8) | (u32)(subordinate << 16); ++ } ++ else if (where == PCI_SUBORDINATE_BUS) { ++ u8 subordinate = tvalue & 0xFF; ++ ++ subordinate = subordinate > 0 ? subordinate - pcibios_1st_host_bus_nr() : 0; ++ tvalue = subordinate; ++ } ++ return tvalue; ++} ++ ++static int ifx_pcie_read_config(struct pci_bus *bus, u32 devfn, ++ int where, int size, u32 *value) ++{ ++ u32 data = 0; ++ int bus_number = bus->number; ++ static const u32 mask[8] = {0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0}; ++ int ret = PCIBIOS_SUCCESSFUL; ++ struct ifx_pci_controller *ctrl = bus->sysdata; ++ int pcie_port = ctrl->port; ++ ++ if (unlikely(size != 1 && size != 2 && size != 4)){ ++ ret = PCIBIOS_BAD_REGISTER_NUMBER; ++ goto out; ++ } ++ ++ /* Make sure the address is aligned to natural boundary */ ++ if (unlikely(((size - 1) & where))) { ++ ret = PCIBIOS_BAD_REGISTER_NUMBER; ++ goto out; ++ } ++ ++ /* ++ * If we are second controller, we have to cheat OS so that it assume ++ * its bus number starts from 0 in host controller ++ */ ++ bus_number = ifx_pcie_bus_nr_deduct(bus_number, pcie_port); ++ ++ /* ++ * We need to force the bus number to be zero on the root ++ * bus. Linux numbers the 2nd root bus to start after all ++ * busses on root 0. ++ */ ++ if (bus->parent == NULL) { ++ bus_number = 0; ++ } ++ ++ /* ++ * PCIe only has a single device connected to it. It is ++ * always device ID 0. Don't bother doing reads for other ++ * device IDs on the first segment. ++ */ ++ if ((bus_number == 0) && (PCI_SLOT(devfn) != 0)) { ++ ret = PCIBIOS_FUNC_NOT_SUPPORTED; ++ goto out; ++ } ++ ++ if (pcie_valid_config(pcie_port, bus_number, PCI_SLOT(devfn)) == 0) { ++ *value = 0xffffffff; ++ ret = PCIBIOS_DEVICE_NOT_FOUND; ++ goto out; ++ } ++ ++ PCIE_IRQ_LOCK(ifx_pcie_lock); ++ if (bus_number == 0) { /* RC itself */ ++ u32 t; ++ ++ t = (where & ~3); ++ data = ifx_pcie_rc_cfg_rd(pcie_port, t); ++ } else { ++ u32 addr = pcie_bus_addr(bus_number, devfn, where); ++ ++ data = ifx_pcie_cfg_rd(pcie_port, addr); ++ #ifdef CONFIG_IFX_PCIE_HW_SWAP ++ data = le32_to_cpu(data); ++ #endif /* CONFIG_IFX_PCIE_HW_SWAP */ ++ } ++ /* To get a correct PCI topology, we have to restore the bus number to OS */ ++ data = ifx_pcie_bus_enum_hack(bus, devfn, where, data, pcie_port, 1); ++ ++ PCIE_IRQ_UNLOCK(ifx_pcie_lock); ++ ++ *value = (data >> (8 * (where & 3))) & mask[size & 7]; ++out: ++ return ret; ++} ++ ++static u32 ifx_pcie_size_to_value(int where, int size, u32 data, u32 value) ++{ ++ u32 shift; ++ u32 tdata = data; ++ ++ switch (size) { ++ case 1: ++ shift = (where & 0x3) << 3; ++ tdata &= ~(0xffU << shift); ++ tdata |= ((value & 0xffU) << shift); ++ break; ++ case 2: ++ shift = (where & 3) << 3; ++ tdata &= ~(0xffffU << shift); ++ tdata |= ((value & 0xffffU) << shift); ++ break; ++ case 4: ++ tdata = value; ++ break; ++ } ++ return tdata; ++} ++ ++static int ifx_pcie_write_config(struct pci_bus *bus, u32 devfn, ++ int where, int size, u32 value) ++{ ++ int bus_number = bus->number; ++ int ret = PCIBIOS_SUCCESSFUL; ++ struct ifx_pci_controller *ctrl = bus->sysdata; ++ int pcie_port = ctrl->port; ++ u32 tvalue = value; ++ u32 data; ++ ++ /* Make sure the address is aligned to natural boundary */ ++ if (unlikely(((size - 1) & where))) { ++ ret = PCIBIOS_BAD_REGISTER_NUMBER; ++ goto out; ++ } ++ /* ++ * If we are second controller, we have to cheat OS so that it assume ++ * its bus number starts from 0 in host controller ++ */ ++ bus_number = ifx_pcie_bus_nr_deduct(bus_number, pcie_port); ++ ++ /* ++ * We need to force the bus number to be zero on the root ++ * bus. Linux numbers the 2nd root bus to start after all ++ * busses on root 0. ++ */ ++ if (bus->parent == NULL) { ++ bus_number = 0; ++ } ++ ++ if (pcie_valid_config(pcie_port, bus_number, PCI_SLOT(devfn)) == 0) { ++ ret = PCIBIOS_DEVICE_NOT_FOUND; ++ goto out; ++ } ++ ++ /* XXX, some PCIe device may need some delay */ ++ PCIE_IRQ_LOCK(ifx_pcie_lock); ++ ++ /* ++ * To configure the correct bus topology using native way, we have to cheat Os so that ++ * it can configure the PCIe hardware correctly. ++ */ ++ tvalue = ifx_pcie_bus_enum_hack(bus, devfn, where, value, pcie_port, 0); ++ ++ if (bus_number == 0) { /* RC itself */ ++ u32 t; ++ ++ t = (where & ~3); ++ data = ifx_pcie_rc_cfg_rd(pcie_port, t); ++ ++ data = ifx_pcie_size_to_value(where, size, data, tvalue); ++ ++ ifx_pcie_rc_cfg_wr(pcie_port, t, data); ++ } else { ++ u32 addr = pcie_bus_addr(bus_number, devfn, where); ++ ++ data = ifx_pcie_cfg_rd(pcie_port, addr); ++#ifdef CONFIG_IFX_PCIE_HW_SWAP ++ data = le32_to_cpu(data); ++#endif ++ ++ data = ifx_pcie_size_to_value(where, size, data, tvalue); ++#ifdef CONFIG_IFX_PCIE_HW_SWAP ++ data = cpu_to_le32(data); ++#endif ++ ifx_pcie_cfg_wr(pcie_port, addr, data); ++ } ++ PCIE_IRQ_UNLOCK(ifx_pcie_lock); ++out: ++ return ret; ++} ++ ++static struct resource ifx_pcie_io_resource = { ++ .name = "PCIe0 I/O space", ++ .start = PCIE_IO_PHY_BASE, ++ .end = PCIE_IO_PHY_END, ++ .flags = IORESOURCE_IO, ++}; ++ ++static struct resource ifx_pcie_mem_resource = { ++ .name = "PCIe0 Memory space", ++ .start = PCIE_MEM_PHY_BASE, ++ .end = PCIE_MEM_PHY_END, ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct pci_ops ifx_pcie_ops = { ++ .read = ifx_pcie_read_config, ++ .write = ifx_pcie_write_config, ++}; ++ ++static struct ifx_pci_controller ifx_pcie_controller[IFX_PCIE_CORE_NR] = { ++ { ++ .pcic = { ++ .pci_ops = &ifx_pcie_ops, ++ .mem_resource = &ifx_pcie_mem_resource, ++ .io_resource = &ifx_pcie_io_resource, ++ }, ++ .port = IFX_PCIE_PORT0, ++ }, ++}; ++ ++#ifdef IFX_PCIE_ERROR_INT ++ ++static irqreturn_t pcie_rc_core_isr(int irq, void *dev_id) ++{ ++ struct ifx_pci_controller *ctrl = (struct ifx_pci_controller *)dev_id; ++ int pcie_port = ctrl->port; ++ u32 reg; ++ ++ pr_debug("PCIe RC error intr %d\n", irq); ++ reg = IFX_REG_R32(PCIE_IRNCR(pcie_port)); ++ reg &= PCIE_RC_CORE_COMBINED_INT; ++ IFX_REG_W32(reg, PCIE_IRNCR(pcie_port)); ++ ++ return IRQ_HANDLED; ++} ++ ++static int ++pcie_rc_core_int_init(int pcie_port) ++{ ++ int ret; ++ ++ /* Enable core interrupt */ ++ IFX_REG_SET_BIT(PCIE_RC_CORE_COMBINED_INT, PCIE_IRNEN(pcie_port)); ++ ++ /* Clear it first */ ++ IFX_REG_SET_BIT(PCIE_RC_CORE_COMBINED_INT, PCIE_IRNCR(pcie_port)); ++ ret = request_irq(pcie_irqs[pcie_port].ir_irq.irq, pcie_rc_core_isr, 0, ++ pcie_irqs[pcie_port].ir_irq.name, &ifx_pcie_controller[pcie_port]); ++ if (ret) ++ printk(KERN_ERR "%s request irq %d failed\n", __func__, IFX_PCIE_IR); ++ ++ return ret; ++} ++#endif ++ ++int ifx_pcie_bios_map_irq(IFX_PCI_CONST struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ u32 irq_bit = 0; ++ int irq = 0; ++ struct ifx_pci_controller *ctrl = dev->bus->sysdata; ++ int pcie_port = ctrl->port; ++ ++ printk("%s port %d dev %s slot %d pin %d \n", __func__, pcie_port, pci_name(dev), slot, pin); ++ ++ if ((pin == PCIE_LEGACY_DISABLE) || (pin > PCIE_LEGACY_INT_MAX)) { ++ printk(KERN_WARNING "WARNING: dev %s: invalid interrupt pin %d\n", pci_name(dev), pin); ++ return -1; ++ } ++ ++ /* Pin index so minus one */ ++ irq_bit = pcie_irqs[pcie_port].legacy_irq[pin - 1].irq_bit; ++ irq = pcie_irqs[pcie_port].legacy_irq[pin - 1].irq; ++ IFX_REG_SET_BIT(irq_bit, PCIE_IRNEN(pcie_port)); ++ IFX_REG_SET_BIT(irq_bit, PCIE_IRNCR(pcie_port)); ++ printk("%s dev %s irq %d assigned\n", __func__, pci_name(dev), irq); ++ return irq; ++} ++ ++int ifx_pcie_bios_plat_dev_init(struct pci_dev *dev) ++{ ++ u16 config; ++#ifdef IFX_PCIE_ERROR_INT ++ u32 dconfig; ++ int pos; ++#endif ++ ++ /* Enable reporting System errors and parity errors on all devices */ ++ /* Enable parity checking and error reporting */ ++ pci_read_config_word(dev, PCI_COMMAND, &config); ++ config |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR /*| PCI_COMMAND_INVALIDATE | ++ PCI_COMMAND_FAST_BACK*/; ++ pci_write_config_word(dev, PCI_COMMAND, config); ++ ++ if (dev->subordinate) { ++ /* Set latency timers on sub bridges */ ++ pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, 0x40); /* XXX, */ ++ /* More bridge error detection */ ++ pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &config); ++ config |= PCI_BRIDGE_CTL_PARITY | PCI_BRIDGE_CTL_SERR; ++ pci_write_config_word(dev, PCI_BRIDGE_CONTROL, config); ++ } ++#ifdef IFX_PCIE_ERROR_INT ++ /* Enable the PCIe normal error reporting */ ++ pos = pci_find_capability(dev, PCI_CAP_ID_EXP); ++ if (pos) { ++ ++ /* Disable system error generation in response to error messages */ ++ pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &config); ++ config &= ~(PCI_EXP_RTCTL_SECEE | PCI_EXP_RTCTL_SENFEE | PCI_EXP_RTCTL_SEFEE); ++ pci_write_config_word(dev, pos + PCI_EXP_RTCTL, config); ++ ++ /* Clear PCIE Capability's Device Status */ ++ pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &config); ++ pci_write_config_word(dev, pos + PCI_EXP_DEVSTA, config); ++ ++ /* Update Device Control */ ++ pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &config); ++ /* Correctable Error Reporting */ ++ config |= PCI_EXP_DEVCTL_CERE; ++ /* Non-Fatal Error Reporting */ ++ config |= PCI_EXP_DEVCTL_NFERE; ++ /* Fatal Error Reporting */ ++ config |= PCI_EXP_DEVCTL_FERE; ++ /* Unsupported Request */ ++ config |= PCI_EXP_DEVCTL_URRE; ++ pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, config); ++ } ++ ++ /* Find the Advanced Error Reporting capability */ ++ pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR); ++ if (pos) { ++ /* Clear Uncorrectable Error Status */ ++ pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &dconfig); ++ pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, dconfig); ++ /* Enable reporting of all uncorrectable errors */ ++ /* Uncorrectable Error Mask - turned on bits disable errors */ ++ pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_MASK, 0); ++ /* ++ * Leave severity at HW default. This only controls if ++ * errors are reported as uncorrectable or ++ * correctable, not if the error is reported. ++ */ ++ /* PCI_ERR_UNCOR_SEVER - Uncorrectable Error Severity */ ++ /* Clear Correctable Error Status */ ++ pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, &dconfig); ++ pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS, dconfig); ++ /* Enable reporting of all correctable errors */ ++ /* Correctable Error Mask - turned on bits disable errors */ ++ pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, 0); ++ /* Advanced Error Capabilities */ ++ pci_read_config_dword(dev, pos + PCI_ERR_CAP, &dconfig); ++ /* ECRC Generation Enable */ ++ if (dconfig & PCI_ERR_CAP_ECRC_GENC) { ++ dconfig |= PCI_ERR_CAP_ECRC_GENE; ++ } ++ /* ECRC Check Enable */ ++ if (dconfig & PCI_ERR_CAP_ECRC_CHKC) { ++ dconfig |= PCI_ERR_CAP_ECRC_CHKE; ++ } ++ pci_write_config_dword(dev, pos + PCI_ERR_CAP, dconfig); ++ ++ /* PCI_ERR_HEADER_LOG - Header Log Register (16 bytes) */ ++ /* Enable Root Port's interrupt in response to error messages */ ++ pci_write_config_dword(dev, pos + PCI_ERR_ROOT_COMMAND, ++ PCI_ERR_ROOT_CMD_COR_EN | ++ PCI_ERR_ROOT_CMD_NONFATAL_EN | ++ PCI_ERR_ROOT_CMD_FATAL_EN); ++ /* Clear the Root status register */ ++ pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &dconfig); ++ pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, dconfig); ++ } ++#endif /* IFX_PCIE_ERROR_INT */ ++ /* WAR, only 128 MRRS is supported, force all EPs to support this value */ ++ pcie_set_readrq(dev, 128); ++ return 0; ++} ++ ++static int ++pcie_rc_initialize(int pcie_port) ++{ ++ int i; ++#define IFX_PCIE_PHY_LOOP_CNT 5 ++ ++ pcie_rcu_endian_setup(pcie_port); ++ ++ pcie_ep_gpio_rst_init(pcie_port); ++ ++ /* ++ * XXX, PCIe elastic buffer bug will cause not to be detected. One more ++ * reset PCIe PHY will solve this issue ++ */ ++ for (i = 0; i < IFX_PCIE_PHY_LOOP_CNT; i++) { ++ /* Disable PCIe PHY Analog part for sanity check */ ++ pcie_phy_pmu_disable(pcie_port); ++ ++ pcie_phy_rst_assert(pcie_port); ++ pcie_phy_rst_deassert(pcie_port); ++ ++ /* Make sure PHY PLL is stable */ ++ udelay(20); ++ ++ /* PCIe Core reset enabled, low active, sw programmed */ ++ pcie_core_rst_assert(pcie_port); ++ ++ /* Put PCIe EP in reset status */ ++ pcie_device_rst_assert(pcie_port); ++ ++ /* PCI PHY & Core reset disabled, high active, sw programmed */ ++ pcie_core_rst_deassert(pcie_port); ++ ++ /* Already in a quiet state, program PLL, enable PHY, check ready bit */ ++ pcie_phy_clock_mode_setup(pcie_port); ++ ++ /* Enable PCIe PHY and Clock */ ++ pcie_core_pmu_setup(pcie_port); ++ ++ /* Clear status registers */ ++ pcie_status_register_clear(pcie_port); ++ ++#ifdef CONFIG_PCI_MSI ++ pcie_msi_init(pcie_port); ++#endif /* CONFIG_PCI_MSI */ ++ pcie_rc_cfg_reg_setup(pcie_port); ++ ++ /* Once link is up, break out */ ++ if (pcie_app_loigc_setup(pcie_port) == 0) ++ break; ++ } ++ if (i >= IFX_PCIE_PHY_LOOP_CNT) { ++ printk(KERN_ERR "%s link up failed!!!!!\n", __func__); ++ return -EIO; ++ } ++ /* NB, don't increase ACK/NACK timer timeout value, which will cause a lot of COR errors */ ++ pcie_replay_time_update(pcie_port); ++ return 0; ++} ++ ++static int __init ifx_pcie_bios_init(void) ++{ ++ void __iomem *io_map_base; ++ int pcie_port; ++ int startup_port; ++ ++ /* Enable AHB Master/ Slave */ ++ pcie_ahb_pmu_setup(); ++ ++ startup_port = IFX_PCIE_PORT0; ++ ++ for (pcie_port = startup_port; pcie_port < IFX_PCIE_CORE_NR; pcie_port++){ ++ if (pcie_rc_initialize(pcie_port) == 0) { ++ IFX_PCIE_PRINT(PCIE_MSG_INIT, "%s: ifx_pcie_cfg_base 0x%p\n", ++ __func__, PCIE_CFG_PORT_TO_BASE(pcie_port)); ++ /* Otherwise, warning will pop up */ ++ io_map_base = ioremap(PCIE_IO_PHY_PORT_TO_BASE(pcie_port), PCIE_IO_SIZE); ++ if (io_map_base == NULL) { ++ IFX_PCIE_PRINT(PCIE_MSG_ERR, "%s io space ioremap failed\n", __func__); ++ return -ENOMEM; ++ } ++ ifx_pcie_controller[pcie_port].pcic.io_map_base = (unsigned long)io_map_base; ++ ++ register_pci_controller(&ifx_pcie_controller[pcie_port].pcic); ++ /* XXX, clear error status */ ++ ++ IFX_PCIE_PRINT(PCIE_MSG_INIT, "%s: mem_resource 0x%p, io_resource 0x%p\n", ++ __func__, &ifx_pcie_controller[pcie_port].pcic.mem_resource, ++ &ifx_pcie_controller[pcie_port].pcic.io_resource); ++ ++ #ifdef IFX_PCIE_ERROR_INT ++ pcie_rc_core_int_init(pcie_port); ++ #endif /* IFX_PCIE_ERROR_INT */ ++ } ++ } ++ ++ return 0; ++} ++arch_initcall(ifx_pcie_bios_init); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Chuanhua.Lei@infineon.com"); ++MODULE_SUPPORTED_DEVICE("Infineon builtin PCIe RC module"); ++MODULE_DESCRIPTION("Infineon builtin PCIe RC driver"); ++ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie.h +@@ -0,0 +1,135 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_pcie.h ++** PROJECT : IFX UEIP for VRX200 ++** MODULES : PCIe module ++** ++** DATE : 02 Mar 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIe Root Complex Driver ++** COPYRIGHT : Copyright (c) 2009 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** HISTORY ++** $Version $Date $Author $Comment ++** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version ++*******************************************************************************/ ++#ifndef IFXMIPS_PCIE_H ++#define IFXMIPS_PCIE_H ++#include ++#include ++#include ++#include ++#include "ifxmips_pci_common.h" ++#include "ifxmips_pcie_reg.h" ++ ++/*! ++ \defgroup IFX_PCIE PCI Express bus driver module ++ \brief PCI Express IP module support VRX200 ++*/ ++ ++/*! ++ \defgroup IFX_PCIE_OS OS APIs ++ \ingroup IFX_PCIE ++ \brief PCIe bus driver OS interface functions ++*/ ++ ++/*! ++ \file ifxmips_pcie.h ++ \ingroup IFX_PCIE ++ \brief header file for PCIe module common header file ++*/ ++#define PCIE_IRQ_LOCK(lock) do { \ ++ unsigned long flags; \ ++ spin_lock_irqsave(&(lock), flags); ++#define PCIE_IRQ_UNLOCK(lock) \ ++ spin_unlock_irqrestore(&(lock), flags); \ ++} while (0) ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) ++#define IRQF_SHARED SA_SHIRQ ++#endif ++ ++#define PCIE_MSG_MSI 0x00000001 ++#define PCIE_MSG_ISR 0x00000002 ++#define PCIE_MSG_FIXUP 0x00000004 ++#define PCIE_MSG_READ_CFG 0x00000008 ++#define PCIE_MSG_WRITE_CFG 0x00000010 ++#define PCIE_MSG_CFG (PCIE_MSG_READ_CFG | PCIE_MSG_WRITE_CFG) ++#define PCIE_MSG_REG 0x00000020 ++#define PCIE_MSG_INIT 0x00000040 ++#define PCIE_MSG_ERR 0x00000080 ++#define PCIE_MSG_PHY 0x00000100 ++#define PCIE_MSG_ANY 0x000001ff ++ ++#define IFX_PCIE_PORT0 0 ++#define IFX_PCIE_PORT1 1 ++ ++#ifdef CONFIG_IFX_PCIE_2ND_CORE ++#define IFX_PCIE_CORE_NR 2 ++#else ++#define IFX_PCIE_CORE_NR 1 ++#endif ++ ++#define IFX_PCIE_ERROR_INT ++ ++//#define IFX_PCIE_DBG ++ ++#if defined(IFX_PCIE_DBG) ++#define IFX_PCIE_PRINT(_m, _fmt, args...) do { \ ++ ifx_pcie_debug((_fmt), ##args); \ ++} while (0) ++ ++#define INLINE ++#else ++#define IFX_PCIE_PRINT(_m, _fmt, args...) \ ++ do {} while(0) ++#define INLINE inline ++#endif ++ ++struct ifx_pci_controller { ++ struct pci_controller pcic; ++ ++ /* RC specific, per host bus information */ ++ u32 port; /* Port index, 0 -- 1st core, 1 -- 2nd core */ ++}; ++ ++typedef struct ifx_pcie_ir_irq { ++ const unsigned int irq; ++ const char name[16]; ++}ifx_pcie_ir_irq_t; ++ ++typedef struct ifx_pcie_legacy_irq{ ++ const u32 irq_bit; ++ const int irq; ++}ifx_pcie_legacy_irq_t; ++ ++typedef struct ifx_pcie_irq { ++ ifx_pcie_ir_irq_t ir_irq; ++ ifx_pcie_legacy_irq_t legacy_irq[PCIE_LEGACY_INT_MAX]; ++}ifx_pcie_irq_t; ++ ++extern u32 g_pcie_debug_flag; ++extern void ifx_pcie_debug(const char *fmt, ...); ++extern void pcie_phy_clock_mode_setup(int pcie_port); ++extern void pcie_msi_pic_init(int pcie_port); ++extern u32 ifx_pcie_bus_enum_read_hack(int where, u32 value); ++extern u32 ifx_pcie_bus_enum_write_hack(int where, u32 value); ++ ++#define CONFIG_VR9 ++ ++#ifdef CONFIG_VR9 ++#include "ifxmips_pcie_vr9.h" ++#elif defined (CONFIG_AR10) ++#include "ifxmips_pcie_ar10.h" ++#else ++#error "PCIE: platform not defined" ++#endif /* CONFIG_VR9 */ ++ ++#endif /* IFXMIPS_PCIE_H */ ++ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie_ar10.h +@@ -0,0 +1,290 @@ ++/**************************************************************************** ++ Copyright (c) 2010 ++ Lantiq Deutschland GmbH ++ Am Campeon 3; 85579 Neubiberg, Germany ++ ++ For licensing information, see the file 'LICENSE' in the root folder of ++ this software module. ++ ++ *****************************************************************************/ ++/*! ++ \file ifxmips_pcie_ar10.h ++ \ingroup IFX_PCIE ++ \brief PCIe RC driver ar10 specific file ++*/ ++ ++#ifndef IFXMIPS_PCIE_AR10_H ++#define IFXMIPS_PCIE_AR10_H ++#ifndef AUTOCONF_INCLUDED ++#include ++#endif /* AUTOCONF_INCLUDED */ ++#include ++#include ++ ++/* Project header file */ ++#include ++#include ++#include ++#include ++ ++static inline void pcie_ep_gpio_rst_init(int pcie_port) ++{ ++ ifx_ebu_led_enable(); ++ if (pcie_port == 0) { ++ ifx_ebu_led_set_data(11, 1); ++ } ++ else { ++ ifx_ebu_led_set_data(12, 1); ++ } ++} ++ ++static inline void pcie_ahb_pmu_setup(void) ++{ ++ /* XXX, moved to CGU to control AHBM */ ++} ++ ++static inline void pcie_rcu_endian_setup(int pcie_port) ++{ ++ u32 reg; ++ ++ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); ++ /* Inbound, big endian */ ++ reg |= IFX_RCU_BE_AHB4S; ++ if (pcie_port == 0) { ++ reg |= IFX_RCU_BE_PCIE0M; ++ ++ #ifdef CONFIG_IFX_PCIE_HW_SWAP ++ /* Outbound, software swap needed */ ++ reg |= IFX_RCU_BE_AHB3M; ++ reg &= ~IFX_RCU_BE_PCIE0S; ++ #else ++ /* Outbound little endian */ ++ reg &= ~IFX_RCU_BE_AHB3M; ++ reg &= ~IFX_RCU_BE_PCIE0S; ++ #endif ++ } ++ else { ++ reg |= IFX_RCU_BE_PCIE1M; ++ #ifdef CONFIG_IFX_PCIE1_HW_SWAP ++ /* Outbound, software swap needed */ ++ reg |= IFX_RCU_BE_AHB3M; ++ reg &= ~IFX_RCU_BE_PCIE1S; ++ #else ++ /* Outbound little endian */ ++ reg &= ~IFX_RCU_BE_AHB3M; ++ reg &= ~IFX_RCU_BE_PCIE1S; ++ #endif ++ } ++ ++ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); ++ IFX_PCIE_PRINT(PCIE_MSG_REG, "%s IFX_RCU_AHB_ENDIAN: 0x%08x\n", __func__, IFX_REG_R32(IFX_RCU_AHB_ENDIAN)); ++} ++ ++static inline void pcie_phy_pmu_enable(int pcie_port) ++{ ++ if (pcie_port == 0) { /* XXX, should use macro*/ ++ PCIE0_PHY_PMU_SETUP(IFX_PMU_ENABLE); ++ } ++ else { ++ PCIE1_PHY_PMU_SETUP(IFX_PMU_ENABLE); ++ } ++} ++ ++static inline void pcie_phy_pmu_disable(int pcie_port) ++{ ++ if (pcie_port == 0) { /* XXX, should use macro*/ ++ PCIE0_PHY_PMU_SETUP(IFX_PMU_DISABLE); ++ } ++ else { ++ PCIE1_PHY_PMU_SETUP(IFX_PMU_DISABLE); ++ } ++} ++ ++static inline void pcie_pdi_big_endian(int pcie_port) ++{ ++ u32 reg; ++ ++ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); ++ if (pcie_port == 0) { ++ /* Config AHB->PCIe and PDI endianness */ ++ reg |= IFX_RCU_BE_PCIE0_PDI; ++ } ++ else { ++ /* Config AHB->PCIe and PDI endianness */ ++ reg |= IFX_RCU_BE_PCIE1_PDI; ++ } ++ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); ++} ++ ++static inline void pcie_pdi_pmu_enable(int pcie_port) ++{ ++ if (pcie_port == 0) { ++ /* Enable PDI to access PCIe PHY register */ ++ PDI0_PMU_SETUP(IFX_PMU_ENABLE); ++ } ++ else { ++ PDI1_PMU_SETUP(IFX_PMU_ENABLE); ++ } ++} ++ ++static inline void pcie_core_rst_assert(int pcie_port) ++{ ++ u32 reg; ++ ++ reg = IFX_REG_R32(IFX_RCU_RST_REQ); ++ ++ /* Reset Core, bit 22 */ ++ if (pcie_port == 0) { ++ reg |= 0x00400000; ++ } ++ else { ++ reg |= 0x08000000; /* Bit 27 */ ++ } ++ IFX_REG_W32(reg, IFX_RCU_RST_REQ); ++} ++ ++static inline void pcie_core_rst_deassert(int pcie_port) ++{ ++ u32 reg; ++ ++ /* Make sure one micro-second delay */ ++ udelay(1); ++ ++ reg = IFX_REG_R32(IFX_RCU_RST_REQ); ++ if (pcie_port == 0) { ++ reg &= ~0x00400000; /* bit 22 */ ++ } ++ else { ++ reg &= ~0x08000000; /* Bit 27 */ ++ } ++ IFX_REG_W32(reg, IFX_RCU_RST_REQ); ++} ++ ++static inline void pcie_phy_rst_assert(int pcie_port) ++{ ++ u32 reg; ++ ++ reg = IFX_REG_R32(IFX_RCU_RST_REQ); ++ if (pcie_port == 0) { ++ reg |= 0x00001000; /* Bit 12 */ ++ } ++ else { ++ reg |= 0x00002000; /* Bit 13 */ ++ } ++ IFX_REG_W32(reg, IFX_RCU_RST_REQ); ++} ++ ++static inline void pcie_phy_rst_deassert(int pcie_port) ++{ ++ u32 reg; ++ ++ /* Make sure one micro-second delay */ ++ udelay(1); ++ ++ reg = IFX_REG_R32(IFX_RCU_RST_REQ); ++ if (pcie_port == 0) { ++ reg &= ~0x00001000; /* Bit 12 */ ++ } ++ else { ++ reg &= ~0x00002000; /* Bit 13 */ ++ } ++ IFX_REG_W32(reg, IFX_RCU_RST_REQ); ++} ++ ++static inline void pcie_device_rst_assert(int pcie_port) ++{ ++ if (pcie_port == 0) { ++ ifx_ebu_led_set_data(11, 0); ++ } ++ else { ++ ifx_ebu_led_set_data(12, 0); ++ } ++} ++ ++static inline void pcie_device_rst_deassert(int pcie_port) ++{ ++ mdelay(100); ++ if (pcie_port == 0) { ++ ifx_ebu_led_set_data(11, 1); ++ } ++ else { ++ ifx_ebu_led_set_data(12, 1); ++ } ++ ifx_ebu_led_disable(); ++} ++ ++static inline void pcie_core_pmu_setup(int pcie_port) ++{ ++ if (pcie_port == 0) { ++ PCIE0_CTRL_PMU_SETUP(IFX_PMU_ENABLE); ++ } ++ else { ++ PCIE1_CTRL_PMU_SETUP(IFX_PMU_ENABLE); ++ } ++} ++ ++static inline void pcie_msi_init(int pcie_port) ++{ ++ pcie_msi_pic_init(pcie_port); ++ if (pcie_port == 0) { ++ MSI0_PMU_SETUP(IFX_PMU_ENABLE); ++ } ++ else { ++ MSI1_PMU_SETUP(IFX_PMU_ENABLE); ++ } ++} ++ ++static inline u32 ++ifx_pcie_bus_nr_deduct(u32 bus_number, int pcie_port) ++{ ++ u32 tbus_number = bus_number; ++ ++#ifdef CONFIG_IFX_PCIE_2ND_CORE ++ if (pcie_port == IFX_PCIE_PORT1) { /* Port 1 must check if there are two cores enabled */ ++ if (pcibios_host_nr() > 1) { ++ tbus_number -= pcibios_1st_host_bus_nr(); ++ } ++ } ++#endif /* CONFIG_IFX_PCI */ ++ return tbus_number; ++} ++ ++static inline u32 ++ifx_pcie_bus_enum_hack(struct pci_bus *bus, u32 devfn, int where, u32 value, int pcie_port, int read) ++{ ++ struct pci_dev *pdev; ++ u32 tvalue = value; ++ ++ /* Sanity check */ ++ pdev = pci_get_slot(bus, devfn); ++ if (pdev == NULL) { ++ return tvalue; ++ } ++ ++ /* Only care about PCI bridge */ ++ if (pdev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { ++ return tvalue; ++ } ++ ++ if (read) { /* Read hack */ ++ #ifdef CONFIG_IFX_PCIE_2ND_CORE ++ if (pcie_port == IFX_PCIE_PORT1) { /* Port 1 must check if there are two cores enabled */ ++ if (pcibios_host_nr() > 1) { ++ tvalue = ifx_pcie_bus_enum_read_hack(where, tvalue); ++ } ++ } ++ #endif /* CONFIG_IFX_PCIE_2ND_CORE */ ++ } ++ else { /* Write hack */ ++ #ifdef CONFIG_IFX_PCIE_2ND_CORE ++ if (pcie_port == IFX_PCIE_PORT1) { /* Port 1 must check if there are two cores enabled */ ++ if (pcibios_host_nr() > 1) { ++ tvalue = ifx_pcie_bus_enum_write_hack(where, tvalue); ++ } ++ } ++ #endif ++ } ++ return tvalue; ++} ++ ++#endif /* IFXMIPS_PCIE_AR10_H */ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie_msi.c +@@ -0,0 +1,392 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_pcie_msi.c ++** PROJECT : IFX UEIP for VRX200 ++** MODULES : PCI MSI sub module ++** ++** DATE : 02 Mar 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIe MSI Driver ++** COPYRIGHT : Copyright (c) 2009 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** HISTORY ++** $Date $Author $Comment ++** 02 Mar,2009 Lei Chuanhua Initial version ++*******************************************************************************/ ++/*! ++ \defgroup IFX_PCIE_MSI MSI OS APIs ++ \ingroup IFX_PCIE ++ \brief PCIe bus driver OS interface functions ++*/ ++ ++/*! ++ \file ifxmips_pcie_msi.c ++ \ingroup IFX_PCIE ++ \brief PCIe MSI OS interface file ++*/ ++ ++#ifndef AUTOCONF_INCLUDED ++#include ++#endif /* AUTOCONF_INCLUDED */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include "ifxmips_pcie_reg.h" ++#include "ifxmips_pcie.h" ++ ++#define IFX_MSI_IRQ_NUM 16 ++ ++enum { ++ IFX_PCIE_MSI_IDX0 = 0, ++ IFX_PCIE_MSI_IDX1, ++ IFX_PCIE_MSI_IDX2, ++ IFX_PCIE_MSI_IDX3, ++}; ++ ++typedef struct ifx_msi_irq_idx { ++ const int irq; ++ const int idx; ++}ifx_msi_irq_idx_t; ++ ++struct ifx_msi_pic { ++ volatile u32 pic_table[IFX_MSI_IRQ_NUM]; ++ volatile u32 pic_endian; /* 0x40 */ ++}; ++typedef struct ifx_msi_pic *ifx_msi_pic_t; ++ ++typedef struct ifx_msi_irq { ++ const volatile ifx_msi_pic_t msi_pic_p; ++ const u32 msi_phy_base; ++ const ifx_msi_irq_idx_t msi_irq_idx[IFX_MSI_IRQ_NUM]; ++ /* ++ * Each bit in msi_free_irq_bitmask represents a MSI interrupt that is ++ * in use. ++ */ ++ u16 msi_free_irq_bitmask; ++ ++ /* ++ * Each bit in msi_multiple_irq_bitmask tells that the device using ++ * this bit in msi_free_irq_bitmask is also using the next bit. This ++ * is used so we can disable all of the MSI interrupts when a device ++ * uses multiple. ++ */ ++ u16 msi_multiple_irq_bitmask; ++}ifx_msi_irq_t; ++ ++static ifx_msi_irq_t msi_irqs[IFX_PCIE_CORE_NR] = { ++ { ++ .msi_pic_p = (const volatile ifx_msi_pic_t)IFX_MSI_PIC_REG_BASE, ++ .msi_phy_base = PCIE_MSI_PHY_BASE, ++ .msi_irq_idx = { ++ {IFX_PCIE_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE_MSI_IR1, IFX_PCIE_MSI_IDX1}, ++ {IFX_PCIE_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE_MSI_IR3, IFX_PCIE_MSI_IDX3}, ++ {IFX_PCIE_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE_MSI_IR1, IFX_PCIE_MSI_IDX1}, ++ {IFX_PCIE_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE_MSI_IR3, IFX_PCIE_MSI_IDX3}, ++ {IFX_PCIE_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE_MSI_IR1, IFX_PCIE_MSI_IDX1}, ++ {IFX_PCIE_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE_MSI_IR3, IFX_PCIE_MSI_IDX3}, ++ {IFX_PCIE_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE_MSI_IR1, IFX_PCIE_MSI_IDX1}, ++ {IFX_PCIE_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE_MSI_IR3, IFX_PCIE_MSI_IDX3}, ++ }, ++ .msi_free_irq_bitmask = 0, ++ .msi_multiple_irq_bitmask= 0, ++ }, ++#ifdef CONFIG_IFX_PCIE_2ND_CORE ++ { ++ .msi_pic_p = (const volatile ifx_msi_pic_t)IFX_MSI1_PIC_REG_BASE, ++ .msi_phy_base = PCIE1_MSI_PHY_BASE, ++ .msi_irq_idx = { ++ {IFX_PCIE1_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE1_MSI_IR1, IFX_PCIE_MSI_IDX1}, ++ {IFX_PCIE1_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE1_MSI_IR3, IFX_PCIE_MSI_IDX3}, ++ {IFX_PCIE1_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE1_MSI_IR1, IFX_PCIE_MSI_IDX1}, ++ {IFX_PCIE1_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE1_MSI_IR3, IFX_PCIE_MSI_IDX3}, ++ {IFX_PCIE1_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE1_MSI_IR1, IFX_PCIE_MSI_IDX1}, ++ {IFX_PCIE1_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE1_MSI_IR3, IFX_PCIE_MSI_IDX3}, ++ {IFX_PCIE1_MSI_IR0, IFX_PCIE_MSI_IDX0}, {IFX_PCIE1_MSI_IR1, IFX_PCIE_MSI_IDX1}, ++ {IFX_PCIE1_MSI_IR2, IFX_PCIE_MSI_IDX2}, {IFX_PCIE1_MSI_IR3, IFX_PCIE_MSI_IDX3}, ++ }, ++ .msi_free_irq_bitmask = 0, ++ .msi_multiple_irq_bitmask= 0, ++ ++ }, ++#endif /* CONFIG_IFX_PCIE_2ND_CORE */ ++}; ++ ++/* ++ * This lock controls updates to msi_free_irq_bitmask, ++ * msi_multiple_irq_bitmask and pic register settting ++ */ ++static DEFINE_SPINLOCK(ifx_pcie_msi_lock); ++ ++void pcie_msi_pic_init(int pcie_port) ++{ ++ spin_lock(&ifx_pcie_msi_lock); ++ msi_irqs[pcie_port].msi_pic_p->pic_endian = IFX_MSI_PIC_BIG_ENDIAN; ++ spin_unlock(&ifx_pcie_msi_lock); ++} ++ ++/** ++ * \fn int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) ++ * \brief Called when a driver request MSI interrupts instead of the ++ * legacy INT A-D. This routine will allocate multiple interrupts ++ * for MSI devices that support them. A device can override this by ++ * programming the MSI control bits [6:4] before calling ++ * pci_enable_msi(). ++ * ++ * \param[in] pdev Device requesting MSI interrupts ++ * \param[in] desc MSI descriptor ++ * ++ * \return -EINVAL Invalid pcie root port or invalid msi bit ++ * \return 0 OK ++ * \ingroup IFX_PCIE_MSI ++ */ ++int ++arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) ++{ ++ int irq, pos; ++ u16 control; ++ int irq_idx; ++ int irq_step; ++ int configured_private_bits; ++ int request_private_bits; ++ struct msi_msg msg; ++ u16 search_mask; ++ struct ifx_pci_controller *ctrl = pdev->bus->sysdata; ++ int pcie_port = ctrl->port; ++ ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s %s enter\n", __func__, pci_name(pdev)); ++ ++ /* XXX, skip RC MSI itself */ ++ if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT) { ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s RC itself doesn't use MSI interrupt\n", __func__); ++ return -EINVAL; ++ } ++ ++ /* ++ * Read the MSI config to figure out how many IRQs this device ++ * wants. Most devices only want 1, which will give ++ * configured_private_bits and request_private_bits equal 0. ++ */ ++ pci_read_config_word(pdev, desc->msi_attrib.pos + PCI_MSI_FLAGS, &control); ++ ++ /* ++ * If the number of private bits has been configured then use ++ * that value instead of the requested number. This gives the ++ * driver the chance to override the number of interrupts ++ * before calling pci_enable_msi(). ++ */ ++ configured_private_bits = (control & PCI_MSI_FLAGS_QSIZE) >> 4; ++ if (configured_private_bits == 0) { ++ /* Nothing is configured, so use the hardware requested size */ ++ request_private_bits = (control & PCI_MSI_FLAGS_QMASK) >> 1; ++ } ++ else { ++ /* ++ * Use the number of configured bits, assuming the ++ * driver wanted to override the hardware request ++ * value. ++ */ ++ request_private_bits = configured_private_bits; ++ } ++ ++ /* ++ * The PCI 2.3 spec mandates that there are at most 32 ++ * interrupts. If this device asks for more, only give it one. ++ */ ++ if (request_private_bits > 5) { ++ request_private_bits = 0; ++ } ++again: ++ /* ++ * The IRQs have to be aligned on a power of two based on the ++ * number being requested. ++ */ ++ irq_step = (1 << request_private_bits); ++ ++ /* Mask with one bit for each IRQ */ ++ search_mask = (1 << irq_step) - 1; ++ ++ /* ++ * We're going to search msi_free_irq_bitmask_lock for zero ++ * bits. This represents an MSI interrupt number that isn't in ++ * use. ++ */ ++ spin_lock(&ifx_pcie_msi_lock); ++ for (pos = 0; pos < IFX_MSI_IRQ_NUM; pos += irq_step) { ++ if ((msi_irqs[pcie_port].msi_free_irq_bitmask & (search_mask << pos)) == 0) { ++ msi_irqs[pcie_port].msi_free_irq_bitmask |= search_mask << pos; ++ msi_irqs[pcie_port].msi_multiple_irq_bitmask |= (search_mask >> 1) << pos; ++ break; ++ } ++ } ++ spin_unlock(&ifx_pcie_msi_lock); ++ ++ /* Make sure the search for available interrupts didn't fail */ ++ if (pos >= IFX_MSI_IRQ_NUM) { ++ if (request_private_bits) { ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s: Unable to find %d free " ++ "interrupts, trying just one", __func__, 1 << request_private_bits); ++ request_private_bits = 0; ++ goto again; ++ } ++ else { ++ printk(KERN_ERR "%s: Unable to find a free MSI interrupt\n", __func__); ++ return -EINVAL; ++ } ++ } ++ irq = msi_irqs[pcie_port].msi_irq_idx[pos].irq; ++ irq_idx = msi_irqs[pcie_port].msi_irq_idx[pos].idx; ++ ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "pos %d, irq %d irq_idx %d\n", pos, irq, irq_idx); ++ ++ /* ++ * Initialize MSI. This has to match the memory-write endianess from the device ++ * Address bits [23:12] ++ */ ++ spin_lock(&ifx_pcie_msi_lock); ++ msi_irqs[pcie_port].msi_pic_p->pic_table[pos] = SM(irq_idx, IFX_MSI_PIC_INT_LINE) | ++ SM((msi_irqs[pcie_port].msi_phy_base >> 12), IFX_MSI_PIC_MSG_ADDR) | ++ SM((1 << pos), IFX_MSI_PIC_MSG_DATA); ++ ++ /* Enable this entry */ ++ msi_irqs[pcie_port].msi_pic_p->pic_table[pos] &= ~IFX_MSI_PCI_INT_DISABLE; ++ spin_unlock(&ifx_pcie_msi_lock); ++ ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "pic_table[%d]: 0x%08x\n", ++ pos, msi_irqs[pcie_port].msi_pic_p->pic_table[pos]); ++ ++ /* Update the number of IRQs the device has available to it */ ++ control &= ~PCI_MSI_FLAGS_QSIZE; ++ control |= (request_private_bits << 4); ++ pci_write_config_word(pdev, desc->msi_attrib.pos + PCI_MSI_FLAGS, control); ++ ++ set_irq_msi(irq, desc); ++ msg.address_hi = 0x0; ++ msg.address_lo = msi_irqs[pcie_port].msi_phy_base; ++ msg.data = SM((1 << pos), IFX_MSI_PIC_MSG_DATA); ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "msi_data: pos %d 0x%08x\n", pos, msg.data); ++ ++ write_msi_msg(irq, &msg); ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s exit\n", __func__); ++ return 0; ++} ++ ++static int ++pcie_msi_irq_to_port(unsigned int irq, int *port) ++{ ++ int ret = 0; ++ ++ if (irq == IFX_PCIE_MSI_IR0 || irq == IFX_PCIE_MSI_IR1 || ++ irq == IFX_PCIE_MSI_IR2 || irq == IFX_PCIE_MSI_IR3) { ++ *port = IFX_PCIE_PORT0; ++ } ++#ifdef CONFIG_IFX_PCIE_2ND_CORE ++ else if (irq == IFX_PCIE1_MSI_IR0 || irq == IFX_PCIE1_MSI_IR1 || ++ irq == IFX_PCIE1_MSI_IR2 || irq == IFX_PCIE1_MSI_IR3) { ++ *port = IFX_PCIE_PORT1; ++ } ++#endif /* CONFIG_IFX_PCIE_2ND_CORE */ ++ else { ++ printk(KERN_ERR "%s: Attempted to teardown illegal " ++ "MSI interrupt (%d)\n", __func__, irq); ++ ret = -EINVAL; ++ } ++ return ret; ++} ++ ++/** ++ * \fn void arch_teardown_msi_irq(unsigned int irq) ++ * \brief Called when a device no longer needs its MSI interrupts. All ++ * MSI interrupts for the device are freed. ++ * ++ * \param irq The devices first irq number. There may be multple in sequence. ++ * \return none ++ * \ingroup IFX_PCIE_MSI ++ */ ++void ++arch_teardown_msi_irq(unsigned int irq) ++{ ++ int pos; ++ int number_irqs; ++ u16 bitmask; ++ int pcie_port; ++ ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s enter\n", __func__); ++ ++ BUG_ON(irq > INT_NUM_IM4_IRL31); ++ ++ if (pcie_msi_irq_to_port(irq, &pcie_port) != 0) { ++ return; ++ } ++ ++ /* Shift the mask to the correct bit location, not always correct ++ * Probally, the first match will be chosen. ++ */ ++ for (pos = 0; pos < IFX_MSI_IRQ_NUM; pos++) { ++ if ((msi_irqs[pcie_port].msi_irq_idx[pos].irq == irq) ++ && (msi_irqs[pcie_port].msi_free_irq_bitmask & ( 1 << pos))) { ++ break; ++ } ++ } ++ if (pos >= IFX_MSI_IRQ_NUM) { ++ printk(KERN_ERR "%s: Unable to find a matched MSI interrupt\n", __func__); ++ return; ++ } ++ spin_lock(&ifx_pcie_msi_lock); ++ /* Disable this entry */ ++ msi_irqs[pcie_port].msi_pic_p->pic_table[pos] |= IFX_MSI_PCI_INT_DISABLE; ++ msi_irqs[pcie_port].msi_pic_p->pic_table[pos] &= ~(IFX_MSI_PIC_INT_LINE | IFX_MSI_PIC_MSG_ADDR | IFX_MSI_PIC_MSG_DATA); ++ spin_unlock(&ifx_pcie_msi_lock); ++ /* ++ * Count the number of IRQs we need to free by looking at the ++ * msi_multiple_irq_bitmask. Each bit set means that the next ++ * IRQ is also owned by this device. ++ */ ++ number_irqs = 0; ++ while (((pos + number_irqs) < IFX_MSI_IRQ_NUM) && ++ (msi_irqs[pcie_port].msi_multiple_irq_bitmask & (1 << (pos + number_irqs)))) { ++ number_irqs++; ++ } ++ number_irqs++; ++ ++ /* Mask with one bit for each IRQ */ ++ bitmask = (1 << number_irqs) - 1; ++ ++ bitmask <<= pos; ++ if ((msi_irqs[pcie_port].msi_free_irq_bitmask & bitmask) != bitmask) { ++ printk(KERN_ERR "%s: Attempted to teardown MSI " ++ "interrupt (%d) not in use\n", __func__, irq); ++ return; ++ } ++ /* Checks are done, update the in use bitmask */ ++ spin_lock(&ifx_pcie_msi_lock); ++ msi_irqs[pcie_port].msi_free_irq_bitmask &= ~bitmask; ++ msi_irqs[pcie_port].msi_multiple_irq_bitmask &= ~(bitmask >> 1); ++ spin_unlock(&ifx_pcie_msi_lock); ++ IFX_PCIE_PRINT(PCIE_MSG_MSI, "%s exit\n", __func__); ++} ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Chuanhua.Lei@infineon.com"); ++MODULE_SUPPORTED_DEVICE("Infineon PCIe IP builtin MSI PIC module"); ++MODULE_DESCRIPTION("Infineon PCIe IP builtin MSI PIC driver"); ++ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie_phy.c +@@ -0,0 +1,478 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_pcie_phy.c ++** PROJECT : IFX UEIP for VRX200 ++** MODULES : PCIe PHY sub module ++** ++** DATE : 14 May 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIe Root Complex Driver ++** COPYRIGHT : Copyright (c) 2009 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** HISTORY ++** $Version $Date $Author $Comment ++** 0.0.1 14 May,2009 Lei Chuanhua Initial version ++*******************************************************************************/ ++/*! ++ \file ifxmips_pcie_phy.c ++ \ingroup IFX_PCIE ++ \brief PCIe PHY PLL register programming source file ++*/ ++#include ++#include ++#include ++#include ++ ++#include "ifxmips_pcie_reg.h" ++#include "ifxmips_pcie.h" ++ ++/* PCIe PDI only supports 16 bit operation */ ++ ++#define IFX_PCIE_PHY_REG_WRITE16(__addr, __data) \ ++ ((*(volatile u16 *) (__addr)) = (__data)) ++ ++#define IFX_PCIE_PHY_REG_READ16(__addr) \ ++ (*(volatile u16 *) (__addr)) ++ ++#define IFX_PCIE_PHY_REG16(__addr) \ ++ (*(volatile u16 *) (__addr)) ++ ++#define IFX_PCIE_PHY_REG(__reg, __value, __mask) do { \ ++ u16 read_data; \ ++ u16 write_data; \ ++ read_data = IFX_PCIE_PHY_REG_READ16((__reg)); \ ++ write_data = (read_data & ((u16)~(__mask))) | (((u16)(__value)) & ((u16)(__mask)));\ ++ IFX_PCIE_PHY_REG_WRITE16((__reg), write_data); \ ++} while (0) ++ ++#define IFX_PCIE_PLL_TIMEOUT 1000 /* Tunnable */ ++ ++//#define IFX_PCI_PHY_REG_DUMP ++ ++#ifdef IFX_PCI_PHY_REG_DUMP ++static void ++pcie_phy_reg_dump(int pcie_port) ++{ ++ printk("PLL REGFILE\n"); ++ printk("PCIE_PHY_PLL_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL1(pcie_port))); ++ printk("PCIE_PHY_PLL_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL2(pcie_port))); ++ printk("PCIE_PHY_PLL_CTRL3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL3(pcie_port))); ++ printk("PCIE_PHY_PLL_CTRL4 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL4(pcie_port))); ++ printk("PCIE_PHY_PLL_CTRL5 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL5(pcie_port))); ++ printk("PCIE_PHY_PLL_CTRL6 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL6(pcie_port))); ++ printk("PCIE_PHY_PLL_CTRL7 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_CTRL7(pcie_port))); ++ printk("PCIE_PHY_PLL_A_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_A_CTRL1(pcie_port))); ++ printk("PCIE_PHY_PLL_A_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_A_CTRL2(pcie_port))); ++ printk("PCIE_PHY_PLL_A_CTRL3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_A_CTRL3(pcie_port))); ++ printk("PCIE_PHY_PLL_STATUS 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_STATUS(pcie_port))); ++ ++ printk("TX1 REGFILE\n"); ++ printk("PCIE_PHY_TX1_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_CTRL1(pcie_port))); ++ printk("PCIE_PHY_TX1_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_CTRL2(pcie_port))); ++ printk("PCIE_PHY_TX1_CTRL3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_CTRL3(pcie_port))); ++ printk("PCIE_PHY_TX1_A_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_A_CTRL1(pcie_port))); ++ printk("PCIE_PHY_TX1_A_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_A_CTRL2(pcie_port))); ++ printk("PCIE_PHY_TX1_MOD1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_MOD1(pcie_port))); ++ printk("PCIE_PHY_TX1_MOD2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_MOD2(pcie_port))); ++ printk("PCIE_PHY_TX1_MOD3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX1_MOD3(pcie_port))); ++ ++ printk("TX2 REGFILE\n"); ++ printk("PCIE_PHY_TX2_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_CTRL1(pcie_port))); ++ printk("PCIE_PHY_TX2_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_CTRL2(pcie_port))); ++ printk("PCIE_PHY_TX2_A_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_A_CTRL1(pcie_port))); ++ printk("PCIE_PHY_TX2_A_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_A_CTRL2(pcie_port))); ++ printk("PCIE_PHY_TX2_MOD1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_MOD1(pcie_port))); ++ printk("PCIE_PHY_TX2_MOD2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_MOD2(pcie_port))); ++ printk("PCIE_PHY_TX2_MOD3 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_TX2_MOD3(pcie_port))); ++ ++ printk("RX1 REGFILE\n"); ++ printk("PCIE_PHY_RX1_CTRL1 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_CTRL1(pcie_port))); ++ printk("PCIE_PHY_RX1_CTRL2 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_CTRL2(pcie_port))); ++ printk("PCIE_PHY_RX1_CDR 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_CDR(pcie_port))); ++ printk("PCIE_PHY_RX1_EI 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_EI(pcie_port))); ++ printk("PCIE_PHY_RX1_A_CTRL 0x%04x\n", IFX_PCIE_PHY_REG16(PCIE_PHY_RX1_A_CTRL(pcie_port))); ++} ++#endif /* IFX_PCI_PHY_REG_DUMP */ ++ ++static void ++pcie_phy_comm_setup(int pcie_port) ++{ ++ /* PLL Setting */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL1(pcie_port), 0x120e, 0xFFFF); ++ ++ /* increase the bias reference voltage */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x39D7, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x0900, 0xFFFF); ++ ++ /* Endcnt */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_EI(pcie_port), 0x0004, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_A_CTRL(pcie_port), 0x6803, 0xFFFF); ++ ++ /* force */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL1(pcie_port), 0x0008, 0x0008); ++ ++ /* predrv_ser_en */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_A_CTRL2(pcie_port), 0x0706, 0xFFFF); ++ ++ /* ctrl_lim */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL3(pcie_port), 0x1FFF, 0xFFFF); ++ ++ /* ctrl */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_A_CTRL1(pcie_port), 0x0800, 0xFF00); ++ ++ /* predrv_ser_en */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_A_CTRL2(pcie_port), 0x4702, 0x7F00); ++ ++ /* RTERM*/ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL2(pcie_port), 0x2e00, 0xFFFF); ++ ++ /* Improved 100MHz clock output */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_CTRL2(pcie_port), 0x3096, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_A_CTRL2(pcie_port), 0x4707, 0xFFFF); ++ ++ /* Reduced CDR BW to avoid glitches */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_CDR(pcie_port), 0x0235, 0xFFFF); ++} ++ ++#ifdef CONFIG_IFX_PCIE_PHY_36MHZ_MODE ++static void ++pcie_phy_36mhz_mode_setup(int pcie_port) ++{ ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d enter\n", __func__, pcie_port); ++#ifdef IFX_PCI_PHY_REG_DUMP ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Initial PHY register dump\n"); ++ pcie_phy_reg_dump(pcie_port); ++#endif ++ ++ /* en_ext_mmd_div_ratio */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0002); ++ ++ /* ext_mmd_div_ratio*/ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0070); ++ ++ /* pll_ensdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0200, 0x0200); ++ ++ /* en_const_sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0100, 0x0100); ++ ++ /* mmd */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x2000, 0xe000); ++ ++ /* lf_mode */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x0000, 0x4000); ++ ++ /* const_sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL1(pcie_port), 0x38e4, 0xFFFF); ++ ++ /* const sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x00ee, 0x00FF); ++ ++ /* pllmod */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL7(pcie_port), 0x0002, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL6(pcie_port), 0x3a04, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL5(pcie_port), 0xfae3, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL4(pcie_port), 0x1b72, 0xFFFF); ++ ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d exit\n", __func__, pcie_port); ++} ++#endif /* CONFIG_IFX_PCIE_PHY_36MHZ_MODE */ ++ ++#ifdef CONFIG_IFX_PCIE_PHY_36MHZ_SSC_MODE ++static void ++pcie_phy_36mhz_ssc_mode_setup(int pcie_port) ++{ ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d enter\n", __func__, pcie_port); ++#ifdef IFX_PCI_PHY_REG_DUMP ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Initial PHY register dump\n"); ++ pcie_phy_reg_dump(pcie_port); ++#endif ++ ++ /* PLL Setting */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL1(pcie_port), 0x120e, 0xFFFF); ++ ++ /* Increase the bias reference voltage */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x39D7, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x0900, 0xFFFF); ++ ++ /* Endcnt */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_EI(pcie_port), 0x0004, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_A_CTRL(pcie_port), 0x6803, 0xFFFF); ++ ++ /* Force */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL1(pcie_port), 0x0008, 0x0008); ++ ++ /* Predrv_ser_en */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_A_CTRL2(pcie_port), 0x0706, 0xFFFF); ++ ++ /* ctrl_lim */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL3(pcie_port), 0x1FFF, 0xFFFF); ++ ++ /* ctrl */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_A_CTRL1(pcie_port), 0x0800, 0xFF00); ++ ++ /* predrv_ser_en */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_A_CTRL2(pcie_port), 0x4702, 0x7F00); ++ ++ /* RTERM*/ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL2(pcie_port), 0x2e00, 0xFFFF); ++ ++ /* en_ext_mmd_div_ratio */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0002); ++ ++ /* ext_mmd_div_ratio*/ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0070); ++ ++ /* pll_ensdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0400, 0x0400); ++ ++ /* en_const_sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0200, 0x0200); ++ ++ /* mmd */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x2000, 0xe000); ++ ++ /* lf_mode */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x0000, 0x4000); ++ ++ /* const_sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL1(pcie_port), 0x38e4, 0xFFFF); ++ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0000, 0x0100); ++ /* const sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x00ee, 0x00FF); ++ ++ /* pllmod */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL7(pcie_port), 0x0002, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL6(pcie_port), 0x3a04, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL5(pcie_port), 0xfae3, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL4(pcie_port), 0x1c72, 0xFFFF); ++ ++ /* improved 100MHz clock output */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_CTRL2(pcie_port), 0x3096, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_A_CTRL2(pcie_port), 0x4707, 0xFFFF); ++ ++ /* reduced CDR BW to avoid glitches */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_CDR(pcie_port), 0x0235, 0xFFFF); ++ ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d exit\n", __func__, pcie_port); ++} ++#endif /* CONFIG_IFX_PCIE_PHY_36MHZ_SSC_MODE */ ++ ++#ifdef CONFIG_IFX_PCIE_PHY_25MHZ_MODE ++static void ++pcie_phy_25mhz_mode_setup(int pcie_port) ++{ ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d enter\n", __func__, pcie_port); ++#ifdef IFX_PCI_PHY_REG_DUMP ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Initial PHY register dump\n"); ++ pcie_phy_reg_dump(pcie_port); ++#endif ++ /* en_const_sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0100, 0x0100); ++ ++ /* pll_ensdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0000, 0x0200); ++ ++ /* en_ext_mmd_div_ratio*/ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0002, 0x0002); ++ ++ /* ext_mmd_div_ratio*/ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0040, 0x0070); ++ ++ /* mmd */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x6000, 0xe000); ++ ++ /* lf_mode */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x4000, 0x4000); ++ ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d exit\n", __func__, pcie_port); ++} ++#endif /* CONFIG_IFX_PCIE_PHY_25MHZ_MODE */ ++ ++#ifdef CONFIG_IFX_PCIE_PHY_100MHZ_MODE ++static void ++pcie_phy_100mhz_mode_setup(int pcie_port) ++{ ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d enter\n", __func__, pcie_port); ++#ifdef IFX_PCI_PHY_REG_DUMP ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Initial PHY register dump\n"); ++ pcie_phy_reg_dump(pcie_port); ++#endif ++ /* en_ext_mmd_div_ratio */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0002); ++ ++ /* ext_mmd_div_ratio*/ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL3(pcie_port), 0x0000, 0x0070); ++ ++ /* pll_ensdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0200, 0x0200); ++ ++ /* en_const_sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x0100, 0x0100); ++ ++ /* mmd */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL3(pcie_port), 0x2000, 0xe000); ++ ++ /* lf_mode */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_A_CTRL2(pcie_port), 0x0000, 0x4000); ++ ++ /* const_sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL1(pcie_port), 0x38e4, 0xFFFF); ++ ++ /* const sdm */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL2(pcie_port), 0x00ee, 0x00FF); ++ ++ /* pllmod */ ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL7(pcie_port), 0x0002, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL6(pcie_port), 0x3a04, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL5(pcie_port), 0xfae3, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_PLL_CTRL4(pcie_port), 0x1b72, 0xFFFF); ++ ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "%s pcie_port %d exit\n", __func__, pcie_port); ++} ++#endif /* CONFIG_IFX_PCIE_PHY_100MHZ_MODE */ ++ ++static int ++pcie_phy_wait_startup_ready(int pcie_port) ++{ ++ int i; ++ ++ for (i = 0; i < IFX_PCIE_PLL_TIMEOUT; i++) { ++ if ((IFX_PCIE_PHY_REG16(PCIE_PHY_PLL_STATUS(pcie_port)) & 0x0040) != 0) { ++ break; ++ } ++ udelay(10); ++ } ++ if (i >= IFX_PCIE_PLL_TIMEOUT) { ++ printk(KERN_ERR "%s PLL Link timeout\n", __func__); ++ return -1; ++ } ++ return 0; ++} ++ ++static void ++pcie_phy_load_enable(int pcie_port, int slice) ++{ ++ /* Set the load_en of tx/rx slice to '1' */ ++ switch (slice) { ++ case 1: ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL1(pcie_port), 0x0010, 0x0010); ++ break; ++ case 2: ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_CTRL1(pcie_port), 0x0010, 0x0010); ++ break; ++ case 3: ++ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_CTRL1(pcie_port), 0x0002, 0x0002); ++ break; ++ } ++} ++ ++static void ++pcie_phy_load_disable(int pcie_port, int slice) ++{ ++ /* set the load_en of tx/rx slice to '0' */ ++ switch (slice) { ++ case 1: ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_CTRL1(pcie_port), 0x0000, 0x0010); ++ break; ++ case 2: ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_CTRL1(pcie_port), 0x0000, 0x0010); ++ break; ++ case 3: ++ IFX_PCIE_PHY_REG(PCIE_PHY_RX1_CTRL1(pcie_port), 0x0000, 0x0002); ++ break; ++ } ++} ++ ++static void ++pcie_phy_load_war(int pcie_port) ++{ ++ int slice; ++ ++ for (slice = 1; slice < 4; slice++) { ++ pcie_phy_load_enable(pcie_port, slice); ++ udelay(1); ++ pcie_phy_load_disable(pcie_port, slice); ++ } ++} ++ ++static void ++pcie_phy_tx2_modulation(int pcie_port) ++{ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_MOD1(pcie_port), 0x1FFE, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_MOD2(pcie_port), 0xFFFE, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_MOD3(pcie_port), 0x0601, 0xFFFF); ++ mdelay(1); ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX2_MOD3(pcie_port), 0x0001, 0xFFFF); ++} ++ ++static void ++pcie_phy_tx1_modulation(int pcie_port) ++{ ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_MOD1(pcie_port), 0x1FFE, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_MOD2(pcie_port), 0xFFFE, 0xFFFF); ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_MOD3(pcie_port), 0x0601, 0xFFFF); ++ mdelay(1); ++ IFX_PCIE_PHY_REG(PCIE_PHY_TX1_MOD3(pcie_port), 0x0001, 0xFFFF); ++} ++ ++static void ++pcie_phy_tx_modulation_war(int pcie_port) ++{ ++ int i; ++ ++#define PCIE_PHY_MODULATION_NUM 5 ++ for (i = 0; i < PCIE_PHY_MODULATION_NUM; i++) { ++ pcie_phy_tx2_modulation(pcie_port); ++ pcie_phy_tx1_modulation(pcie_port); ++ } ++#undef PCIE_PHY_MODULATION_NUM ++} ++ ++void ++pcie_phy_clock_mode_setup(int pcie_port) ++{ ++ pcie_pdi_big_endian(pcie_port); ++ ++ /* Enable PDI to access PCIe PHY register */ ++ pcie_pdi_pmu_enable(pcie_port); ++ ++ /* Configure PLL and PHY clock */ ++ pcie_phy_comm_setup(pcie_port); ++ ++#ifdef CONFIG_IFX_PCIE_PHY_36MHZ_MODE ++ pcie_phy_36mhz_mode_setup(pcie_port); ++#elif defined(CONFIG_IFX_PCIE_PHY_36MHZ_SSC_MODE) ++ pcie_phy_36mhz_ssc_mode_setup(pcie_port); ++#elif defined(CONFIG_IFX_PCIE_PHY_25MHZ_MODE) ++ pcie_phy_25mhz_mode_setup(pcie_port); ++#elif defined (CONFIG_IFX_PCIE_PHY_100MHZ_MODE) ++ pcie_phy_100mhz_mode_setup(pcie_port); ++#else ++ #error "PCIE PHY Clock Mode must be chosen first!!!!" ++#endif /* CONFIG_IFX_PCIE_PHY_36MHZ_MODE */ ++ ++ /* Enable PCIe PHY and make PLL setting take effect */ ++ pcie_phy_pmu_enable(pcie_port); ++ ++ /* Check if we are in startup_ready status */ ++ pcie_phy_wait_startup_ready(pcie_port); ++ ++ pcie_phy_load_war(pcie_port); ++ ++ /* Apply TX modulation workarounds */ ++ pcie_phy_tx_modulation_war(pcie_port); ++ ++#ifdef IFX_PCI_PHY_REG_DUMP ++ IFX_PCIE_PRINT(PCIE_MSG_PHY, "Modified PHY register dump\n"); ++ pcie_phy_reg_dump(pcie_port); ++#endif ++} ++ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie_pm.c +@@ -0,0 +1,176 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_pcie_pm.c ++** PROJECT : IFX UEIP ++** MODULES : PCIE Root Complex Driver ++** ++** DATE : 21 Dec 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIE Root Complex Driver Power Managment ++** COPYRIGHT : Copyright (c) 2009 ++** Lantiq Deutschland GmbH ++** Am Campeon 3, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** ++** HISTORY ++** $Date $Author $Comment ++** 21 Dec,2009 Lei Chuanhua First UEIP release ++*******************************************************************************/ ++/*! ++ \defgroup IFX_PCIE_PM Power Management functions ++ \ingroup IFX_PCIE ++ \brief IFX PCIE Root Complex Driver power management functions ++*/ ++ ++/*! ++ \file ifxmips_pcie_pm.c ++ \ingroup IFX_PCIE ++ \brief source file for PCIE Root Complex Driver Power Management ++*/ ++ ++#ifndef EXPORT_SYMTAB ++#define EXPORT_SYMTAB ++#endif ++#ifndef AUTOCONF_INCLUDED ++#include ++#endif /* AUTOCONF_INCLUDED */ ++#include ++#include ++#include ++#include ++#include ++ ++/* Project header */ ++#include ++#include ++#include ++#include ++#include "ifxmips_pcie_pm.h" ++ ++/** ++ * \fn static IFX_PMCU_RETURN_t ifx_pcie_pmcu_state_change(IFX_PMCU_STATE_t pmcuState) ++ * \brief the callback function to request pmcu state in the power management hardware-dependent module ++ * ++ * \param pmcuState This parameter is a PMCU state. ++ * ++ * \return IFX_PMCU_RETURN_SUCCESS Set Power State successfully ++ * \return IFX_PMCU_RETURN_ERROR Failed to set power state. ++ * \return IFX_PMCU_RETURN_DENIED Not allowed to operate power state ++ * \ingroup IFX_PCIE_PM ++ */ ++static IFX_PMCU_RETURN_t ++ifx_pcie_pmcu_state_change(IFX_PMCU_STATE_t pmcuState) ++{ ++ switch(pmcuState) ++ { ++ case IFX_PMCU_STATE_D0: ++ return IFX_PMCU_RETURN_SUCCESS; ++ case IFX_PMCU_STATE_D1: // Not Applicable ++ return IFX_PMCU_RETURN_DENIED; ++ case IFX_PMCU_STATE_D2: // Not Applicable ++ return IFX_PMCU_RETURN_DENIED; ++ case IFX_PMCU_STATE_D3: // Module clock gating and Power gating ++ return IFX_PMCU_RETURN_SUCCESS; ++ default: ++ return IFX_PMCU_RETURN_DENIED; ++ } ++} ++ ++/** ++ * \fn static IFX_PMCU_RETURN_t ifx_pcie_pmcu_state_get(IFX_PMCU_STATE_t *pmcuState) ++ * \brief the callback function to get pmcu state in the power management hardware-dependent module ++ ++ * \param pmcuState Pointer to return power state. ++ * ++ * \return IFX_PMCU_RETURN_SUCCESS Set Power State successfully ++ * \return IFX_PMCU_RETURN_ERROR Failed to set power state. ++ * \return IFX_PMCU_RETURN_DENIED Not allowed to operate power state ++ * \ingroup IFX_PCIE_PM ++ */ ++static IFX_PMCU_RETURN_t ++ifx_pcie_pmcu_state_get(IFX_PMCU_STATE_t *pmcuState) ++{ ++ return IFX_PMCU_RETURN_SUCCESS; ++} ++ ++/** ++ * \fn IFX_PMCU_RETURN_t ifx_pcie_pmcu_prechange(IFX_PMCU_MODULE_t pmcuModule, IFX_PMCU_STATE_t newState, IFX_PMCU_STATE_t oldState) ++ * \brief Apply all callbacks registered to be executed before a state change for pmcuModule ++ * ++ * \param pmcuModule Module ++ * \param newState New state ++ * \param oldState Old state ++ * \return IFX_PMCU_RETURN_SUCCESS Set Power State successfully ++ * \return IFX_PMCU_RETURN_ERROR Failed to set power state. ++ * \ingroup IFX_PCIE_PM ++ */ ++static IFX_PMCU_RETURN_t ++ifx_pcie_pmcu_prechange(IFX_PMCU_MODULE_t pmcuModule, IFX_PMCU_STATE_t newState, IFX_PMCU_STATE_t oldState) ++{ ++ return IFX_PMCU_RETURN_SUCCESS; ++} ++ ++/** ++ * \fn IFX_PMCU_RETURN_t ifx_pcie_pmcu_postchange(IFX_PMCU_MODULE_t pmcuModule, IFX_PMCU_STATE_t newState, IFX_PMCU_STATE_t oldState) ++ * \brief Apply all callbacks registered to be executed before a state change for pmcuModule ++ * ++ * \param pmcuModule Module ++ * \param newState New state ++ * \param oldState Old state ++ * \return IFX_PMCU_RETURN_SUCCESS Set Power State successfully ++ * \return IFX_PMCU_RETURN_ERROR Failed to set power state. ++ * \ingroup IFX_PCIE_PM ++ */ ++static IFX_PMCU_RETURN_t ++ifx_pcie_pmcu_postchange(IFX_PMCU_MODULE_t pmcuModule, IFX_PMCU_STATE_t newState, IFX_PMCU_STATE_t oldState) ++{ ++ return IFX_PMCU_RETURN_SUCCESS; ++} ++ ++/** ++ * \fn static void ifx_pcie_pmcu_init(void) ++ * \brief Register with central PMCU module ++ * \return none ++ * \ingroup IFX_PCIE_PM ++ */ ++void ++ifx_pcie_pmcu_init(void) ++{ ++ IFX_PMCU_REGISTER_t pmcuRegister; ++ ++ /* XXX, hook driver context */ ++ ++ /* State function register */ ++ memset(&pmcuRegister, 0, sizeof(IFX_PMCU_REGISTER_t)); ++ pmcuRegister.pmcuModule = IFX_PMCU_MODULE_PCIE; ++ pmcuRegister.pmcuModuleNr = 0; ++ pmcuRegister.ifx_pmcu_state_change = ifx_pcie_pmcu_state_change; ++ pmcuRegister.ifx_pmcu_state_get = ifx_pcie_pmcu_state_get; ++ pmcuRegister.pre = ifx_pcie_pmcu_prechange; ++ pmcuRegister.post= ifx_pcie_pmcu_postchange; ++ ifx_pmcu_register(&pmcuRegister); ++} ++ ++/** ++ * \fn static void ifx_pcie_pmcu_exit(void) ++ * \brief Unregister with central PMCU module ++ * ++ * \return none ++ * \ingroup IFX_PCIE_PM ++ */ ++void ++ifx_pcie_pmcu_exit(void) ++{ ++ IFX_PMCU_REGISTER_t pmcuUnRegister; ++ ++ /* XXX, hook driver context */ ++ ++ pmcuUnRegister.pmcuModule = IFX_PMCU_MODULE_PCIE; ++ pmcuUnRegister.pmcuModuleNr = 0; ++ ifx_pmcu_unregister(&pmcuUnRegister); ++} ++ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie_pm.h +@@ -0,0 +1,36 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_pcie_pm.h ++** PROJECT : IFX UEIP ++** MODULES : PCIe Root Complex Driver ++** ++** DATE : 21 Dec 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIe Root Complex Driver Power Managment ++** COPYRIGHT : Copyright (c) 2009 ++** Lantiq Deutschland GmbH ++** Am Campeon 3, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** ++** HISTORY ++** $Date $Author $Comment ++** 21 Dec,2009 Lei Chuanhua First UEIP release ++*******************************************************************************/ ++/*! ++ \file ifxmips_pcie_pm.h ++ \ingroup IFX_PCIE ++ \brief header file for PCIe Root Complex Driver Power Management ++*/ ++ ++#ifndef IFXMIPS_PCIE_PM_H ++#define IFXMIPS_PCIE_PM_H ++ ++void ifx_pcie_pmcu_init(void); ++void ifx_pcie_pmcu_exit(void); ++ ++#endif /* IFXMIPS_PCIE_PM_H */ ++ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie_reg.h +@@ -0,0 +1,1001 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_pcie_reg.h ++** PROJECT : IFX UEIP for VRX200 ++** MODULES : PCIe module ++** ++** DATE : 02 Mar 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIe Root Complex Driver ++** COPYRIGHT : Copyright (c) 2009 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** HISTORY ++** $Version $Date $Author $Comment ++** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version ++*******************************************************************************/ ++#ifndef IFXMIPS_PCIE_REG_H ++#define IFXMIPS_PCIE_REG_H ++/*! ++ \file ifxmips_pcie_reg.h ++ \ingroup IFX_PCIE ++ \brief header file for PCIe module register definition ++*/ ++/* PCIe Address Mapping Base */ ++#define PCIE_CFG_PHY_BASE 0x1D000000UL ++#define PCIE_CFG_BASE (KSEG1 + PCIE_CFG_PHY_BASE) ++#define PCIE_CFG_SIZE (8 * 1024 * 1024) ++ ++#define PCIE_MEM_PHY_BASE 0x1C000000UL ++#define PCIE_MEM_BASE (KSEG1 + PCIE_MEM_PHY_BASE) ++#define PCIE_MEM_SIZE (16 * 1024 * 1024) ++#define PCIE_MEM_PHY_END (PCIE_MEM_PHY_BASE + PCIE_MEM_SIZE - 1) ++ ++#define PCIE_IO_PHY_BASE 0x1D800000UL ++#define PCIE_IO_BASE (KSEG1 + PCIE_IO_PHY_BASE) ++#define PCIE_IO_SIZE (1 * 1024 * 1024) ++#define PCIE_IO_PHY_END (PCIE_IO_PHY_BASE + PCIE_IO_SIZE - 1) ++ ++#define PCIE_RC_CFG_BASE (KSEG1 + 0x1D900000) ++#define PCIE_APP_LOGIC_REG (KSEG1 + 0x1E100900) ++#define PCIE_MSI_PHY_BASE 0x1F600000UL ++ ++#define PCIE_PDI_PHY_BASE 0x1F106800UL ++#define PCIE_PDI_BASE (KSEG1 + PCIE_PDI_PHY_BASE) ++#define PCIE_PDI_SIZE 0x400 ++ ++#define PCIE1_CFG_PHY_BASE 0x19000000UL ++#define PCIE1_CFG_BASE (KSEG1 + PCIE1_CFG_PHY_BASE) ++#define PCIE1_CFG_SIZE (8 * 1024 * 1024) ++ ++#define PCIE1_MEM_PHY_BASE 0x18000000UL ++#define PCIE1_MEM_BASE (KSEG1 + PCIE1_MEM_PHY_BASE) ++#define PCIE1_MEM_SIZE (16 * 1024 * 1024) ++#define PCIE1_MEM_PHY_END (PCIE1_MEM_PHY_BASE + PCIE1_MEM_SIZE - 1) ++ ++#define PCIE1_IO_PHY_BASE 0x19800000UL ++#define PCIE1_IO_BASE (KSEG1 + PCIE1_IO_PHY_BASE) ++#define PCIE1_IO_SIZE (1 * 1024 * 1024) ++#define PCIE1_IO_PHY_END (PCIE1_IO_PHY_BASE + PCIE1_IO_SIZE - 1) ++ ++#define PCIE1_RC_CFG_BASE (KSEG1 + 0x19900000) ++#define PCIE1_APP_LOGIC_REG (KSEG1 + 0x1E100700) ++#define PCIE1_MSI_PHY_BASE 0x1F400000UL ++ ++#define PCIE1_PDI_PHY_BASE 0x1F700400UL ++#define PCIE1_PDI_BASE (KSEG1 + PCIE1_PDI_PHY_BASE) ++#define PCIE1_PDI_SIZE 0x400 ++ ++#define PCIE_CFG_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_CFG_BASE) : (PCIE_CFG_BASE)) ++#define PCIE_MEM_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_MEM_BASE) : (PCIE_MEM_BASE)) ++#define PCIE_IO_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_IO_BASE) : (PCIE_IO_BASE)) ++#define PCIE_MEM_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_MEM_PHY_BASE) : (PCIE_MEM_PHY_BASE)) ++#define PCIE_MEM_PHY_PORT_TO_END(X) ((X) > 0 ? (PCIE1_MEM_PHY_END) : (PCIE_MEM_PHY_END)) ++#define PCIE_IO_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_IO_PHY_BASE) : (PCIE_IO_PHY_BASE)) ++#define PCIE_IO_PHY_PORT_TO_END(X) ((X) > 0 ? (PCIE1_IO_PHY_END) : (PCIE_IO_PHY_END)) ++#define PCIE_APP_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_APP_LOGIC_REG) : (PCIE_APP_LOGIC_REG)) ++#define PCIE_RC_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_RC_CFG_BASE) : (PCIE_RC_CFG_BASE)) ++#define PCIE_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_PDI_BASE) : (PCIE_PDI_BASE)) ++ ++/* PCIe Application Logic Register */ ++/* RC Core Control Register */ ++#define PCIE_RC_CCR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x10) ++/* This should be enabled after initializing configuratin registers ++ * Also should check link status retraining bit ++ */ ++#define PCIE_RC_CCR_LTSSM_ENABLE 0x00000001 /* Enable LTSSM to continue link establishment */ ++ ++/* RC Core Debug Register */ ++#define PCIE_RC_DR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x14) ++#define PCIE_RC_DR_DLL_UP 0x00000001 /* Data Link Layer Up */ ++#define PCIE_RC_DR_CURRENT_POWER_STATE 0x0000000E /* Current Power State */ ++#define PCIE_RC_DR_CURRENT_POWER_STATE_S 1 ++#define PCIE_RC_DR_CURRENT_LTSSM_STATE 0x000001F0 /* Current LTSSM State */ ++#define PCIE_RC_DR_CURRENT_LTSSM_STATE_S 4 ++ ++#define PCIE_RC_DR_PM_DEV_STATE 0x00000E00 /* Power Management D-State */ ++#define PCIE_RC_DR_PM_DEV_STATE_S 9 ++ ++#define PCIE_RC_DR_PM_ENABLED 0x00001000 /* Power Management State from PMU */ ++#define PCIE_RC_DR_PME_EVENT_ENABLED 0x00002000 /* Power Management Event Enable State */ ++#define PCIE_RC_DR_AUX_POWER_ENABLED 0x00004000 /* Auxiliary Power Enable */ ++ ++/* Current Power State Definition */ ++enum { ++ PCIE_RC_DR_D0 = 0, ++ PCIE_RC_DR_D1, /* Not supported */ ++ PCIE_RC_DR_D2, /* Not supported */ ++ PCIE_RC_DR_D3, ++ PCIE_RC_DR_UN, ++}; ++ ++/* PHY Link Status Register */ ++#define PCIE_PHY_SR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x18) ++#define PCIE_PHY_SR_PHY_LINK_UP 0x00000001 /* PHY Link Up/Down Indicator */ ++ ++/* Electromechanical Control Register */ ++#define PCIE_EM_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x1C) ++#define PCIE_EM_CR_CARD_IS_PRESENT 0x00000001 /* Card Presence Detect State */ ++#define PCIE_EM_CR_MRL_OPEN 0x00000002 /* MRL Sensor State */ ++#define PCIE_EM_CR_POWER_FAULT_SET 0x00000004 /* Power Fault Detected */ ++#define PCIE_EM_CR_MRL_SENSOR_SET 0x00000008 /* MRL Sensor Changed */ ++#define PCIE_EM_CR_PRESENT_DETECT_SET 0x00000010 /* Card Presense Detect Changed */ ++#define PCIE_EM_CR_CMD_CPL_INT_SET 0x00000020 /* Command Complete Interrupt */ ++#define PCIE_EM_CR_SYS_INTERLOCK_SET 0x00000040 /* System Electromechanical IterLock Engaged */ ++#define PCIE_EM_CR_ATTENTION_BUTTON_SET 0x00000080 /* Attention Button Pressed */ ++ ++/* Interrupt Status Register */ ++#define PCIE_IR_SR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x20) ++#define PCIE_IR_SR_PME_CAUSE_MSI 0x00000002 /* MSI caused by PME */ ++#define PCIE_IR_SR_HP_PME_WAKE_GEN 0x00000004 /* Hotplug PME Wake Generation */ ++#define PCIE_IR_SR_HP_MSI 0x00000008 /* Hotplug MSI */ ++#define PCIE_IR_SR_AHB_LU_ERR 0x00000030 /* AHB Bridge Lookup Error Signals */ ++#define PCIE_IR_SR_AHB_LU_ERR_S 4 ++#define PCIE_IR_SR_INT_MSG_NUM 0x00003E00 /* Interrupt Message Number */ ++#define PCIE_IR_SR_INT_MSG_NUM_S 9 ++#define PCIE_IR_SR_AER_INT_MSG_NUM 0xF8000000 /* Advanced Error Interrupt Message Number */ ++#define PCIE_IR_SR_AER_INT_MSG_NUM_S 27 ++ ++/* Message Control Register */ ++#define PCIE_MSG_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x30) ++#define PCIE_MSG_CR_GEN_PME_TURN_OFF_MSG 0x00000001 /* Generate PME Turn Off Message */ ++#define PCIE_MSG_CR_GEN_UNLOCK_MSG 0x00000002 /* Generate Unlock Message */ ++ ++#define PCIE_VDM_DR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x34) ++ ++/* Vendor-Defined Message Requester ID Register */ ++#define PCIE_VDM_RID(X) (PCIE_APP_PORT_TO_BASE (X) + 0x38) ++#define PCIE_VDM_RID_VENROR_MSG_REQ_ID 0x0000FFFF ++#define PCIE_VDM_RID_VDMRID_S 0 ++ ++/* ASPM Control Register */ ++#define PCIE_ASPM_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x40) ++#define PCIE_ASPM_CR_HOT_RST 0x00000001 /* Hot Reset Request to the downstream device */ ++#define PCIE_ASPM_CR_REQ_EXIT_L1 0x00000002 /* Request to Exit L1 */ ++#define PCIE_ASPM_CR_REQ_ENTER_L1 0x00000004 /* Request to Enter L1 */ ++ ++/* Vendor Message DW0 Register */ ++#define PCIE_VM_MSG_DW0(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x50) ++#define PCIE_VM_MSG_DW0_TYPE 0x0000001F /* Message type */ ++#define PCIE_VM_MSG_DW0_TYPE_S 0 ++#define PCIE_VM_MSG_DW0_FORMAT 0x00000060 /* Format */ ++#define PCIE_VM_MSG_DW0_FORMAT_S 5 ++#define PCIE_VM_MSG_DW0_TC 0x00007000 /* Traffic Class */ ++#define PCIE_VM_MSG_DW0_TC_S 12 ++#define PCIE_VM_MSG_DW0_ATTR 0x000C0000 /* Atrributes */ ++#define PCIE_VM_MSG_DW0_ATTR_S 18 ++#define PCIE_VM_MSG_DW0_EP_TLP 0x00100000 /* Poisoned TLP */ ++#define PCIE_VM_MSG_DW0_TD 0x00200000 /* TLP Digest */ ++#define PCIE_VM_MSG_DW0_LEN 0xFFC00000 /* Length */ ++#define PCIE_VM_MSG_DW0_LEN_S 22 ++ ++/* Format Definition */ ++enum { ++ PCIE_VM_MSG_FORMAT_00 = 0, /* 3DW Hdr, no data*/ ++ PCIE_VM_MSG_FORMAT_01, /* 4DW Hdr, no data */ ++ PCIE_VM_MSG_FORMAT_10, /* 3DW Hdr, with data */ ++ PCIE_VM_MSG_FORMAT_11, /* 4DW Hdr, with data */ ++}; ++ ++/* Traffic Class Definition */ ++enum { ++ PCIE_VM_MSG_TC0 = 0, ++ PCIE_VM_MSG_TC1, ++ PCIE_VM_MSG_TC2, ++ PCIE_VM_MSG_TC3, ++ PCIE_VM_MSG_TC4, ++ PCIE_VM_MSG_TC5, ++ PCIE_VM_MSG_TC6, ++ PCIE_VM_MSG_TC7, ++}; ++ ++/* Attributes Definition */ ++enum { ++ PCIE_VM_MSG_ATTR_00 = 0, /* RO and No Snoop cleared */ ++ PCIE_VM_MSG_ATTR_01, /* RO cleared , No Snoop set */ ++ PCIE_VM_MSG_ATTR_10, /* RO set, No Snoop cleared*/ ++ PCIE_VM_MSG_ATTR_11, /* RO and No Snoop set */ ++}; ++ ++/* Payload Size Definition */ ++#define PCIE_VM_MSG_LEN_MIN 0 ++#define PCIE_VM_MSG_LEN_MAX 1024 ++ ++/* Vendor Message DW1 Register */ ++#define PCIE_VM_MSG_DW1(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x54) ++#define PCIE_VM_MSG_DW1_FUNC_NUM 0x00000070 /* Function Number */ ++#define PCIE_VM_MSG_DW1_FUNC_NUM_S 8 ++#define PCIE_VM_MSG_DW1_CODE 0x00FF0000 /* Message Code */ ++#define PCIE_VM_MSG_DW1_CODE_S 16 ++#define PCIE_VM_MSG_DW1_TAG 0xFF000000 /* Tag */ ++#define PCIE_VM_MSG_DW1_TAG_S 24 ++ ++#define PCIE_VM_MSG_DW2(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x58) ++#define PCIE_VM_MSG_DW3(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x5C) ++ ++/* Vendor Message Request Register */ ++#define PCIE_VM_MSG_REQR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x60) ++#define PCIE_VM_MSG_REQR_REQ 0x00000001 /* Vendor Message Request */ ++ ++ ++/* AHB Slave Side Band Control Register */ ++#define PCIE_AHB_SSB(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x70) ++#define PCIE_AHB_SSB_REQ_BCM 0x00000001 /* Slave Reques BCM filed */ ++#define PCIE_AHB_SSB_REQ_EP 0x00000002 /* Slave Reques EP filed */ ++#define PCIE_AHB_SSB_REQ_TD 0x00000004 /* Slave Reques TD filed */ ++#define PCIE_AHB_SSB_REQ_ATTR 0x00000018 /* Slave Reques Attribute number */ ++#define PCIE_AHB_SSB_REQ_ATTR_S 3 ++#define PCIE_AHB_SSB_REQ_TC 0x000000E0 /* Slave Request TC Field */ ++#define PCIE_AHB_SSB_REQ_TC_S 5 ++ ++/* AHB Master SideBand Ctrl Register */ ++#define PCIE_AHB_MSB(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x74) ++#define PCIE_AHB_MSB_RESP_ATTR 0x00000003 /* Master Response Attribute number */ ++#define PCIE_AHB_MSB_RESP_ATTR_S 0 ++#define PCIE_AHB_MSB_RESP_BAD_EOT 0x00000004 /* Master Response Badeot filed */ ++#define PCIE_AHB_MSB_RESP_BCM 0x00000008 /* Master Response BCM filed */ ++#define PCIE_AHB_MSB_RESP_EP 0x00000010 /* Master Response EP filed */ ++#define PCIE_AHB_MSB_RESP_TD 0x00000020 /* Master Response TD filed */ ++#define PCIE_AHB_MSB_RESP_FUN_NUM 0x000003C0 /* Master Response Function number */ ++#define PCIE_AHB_MSB_RESP_FUN_NUM_S 6 ++ ++/* AHB Control Register, fixed bus enumeration exception */ ++#define PCIE_AHB_CTRL(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x78) ++#define PCIE_AHB_CTRL_BUS_ERROR_SUPPRESS 0x00000001 ++ ++/* Interrupt Enalbe Register */ ++#define PCIE_IRNEN(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xF4) ++#define PCIE_IRNCR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xF8) ++#define PCIE_IRNICR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xFC) ++ ++/* PCIe interrupt enable/control/capture register definition */ ++#define PCIE_IRN_AER_REPORT 0x00000001 /* AER Interrupt */ ++#define PCIE_IRN_AER_MSIX 0x00000002 /* Advanced Error MSI-X Interrupt */ ++#define PCIE_IRN_PME 0x00000004 /* PME Interrupt */ ++#define PCIE_IRN_HOTPLUG 0x00000008 /* Hotplug Interrupt */ ++#define PCIE_IRN_RX_VDM_MSG 0x00000010 /* Vendor-Defined Message Interrupt */ ++#define PCIE_IRN_RX_CORRECTABLE_ERR_MSG 0x00000020 /* Correctable Error Message Interrupt */ ++#define PCIE_IRN_RX_NON_FATAL_ERR_MSG 0x00000040 /* Non-fatal Error Message */ ++#define PCIE_IRN_RX_FATAL_ERR_MSG 0x00000080 /* Fatal Error Message */ ++#define PCIE_IRN_RX_PME_MSG 0x00000100 /* PME Message Interrupt */ ++#define PCIE_IRN_RX_PME_TURNOFF_ACK 0x00000200 /* PME Turnoff Ack Message Interrupt */ ++#define PCIE_IRN_AHB_BR_FATAL_ERR 0x00000400 /* AHB Fatal Error Interrupt */ ++#define PCIE_IRN_LINK_AUTO_BW_STATUS 0x00000800 /* Link Auto Bandwidth Status Interrupt */ ++#define PCIE_IRN_BW_MGT 0x00001000 /* Bandwidth Managment Interrupt */ ++#define PCIE_IRN_INTA 0x00002000 /* INTA */ ++#define PCIE_IRN_INTB 0x00004000 /* INTB */ ++#define PCIE_IRN_INTC 0x00008000 /* INTC */ ++#define PCIE_IRN_INTD 0x00010000 /* INTD */ ++#define PCIE_IRN_WAKEUP 0x00020000 /* Wake up Interrupt */ ++ ++#define PCIE_RC_CORE_COMBINED_INT (PCIE_IRN_AER_REPORT | PCIE_IRN_AER_MSIX | PCIE_IRN_PME | \ ++ PCIE_IRN_HOTPLUG | PCIE_IRN_RX_VDM_MSG | PCIE_IRN_RX_CORRECTABLE_ERR_MSG |\ ++ PCIE_IRN_RX_NON_FATAL_ERR_MSG | PCIE_IRN_RX_FATAL_ERR_MSG | \ ++ PCIE_IRN_RX_PME_MSG | PCIE_IRN_RX_PME_TURNOFF_ACK | PCIE_IRN_AHB_BR_FATAL_ERR | \ ++ PCIE_IRN_LINK_AUTO_BW_STATUS | PCIE_IRN_BW_MGT) ++/* PCIe RC Configuration Register */ ++#define PCIE_VDID(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x00) ++ ++/* Bit definition from pci_reg.h */ ++#define PCIE_PCICMDSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x04) ++#define PCIE_CCRID(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x08) ++#define PCIE_CLSLTHTBR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x0C) /* EP only */ ++/* BAR0, BAR1,Only necessary if the bridges implements a device-specific register set or memory buffer */ ++#define PCIE_BAR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x10) /* Not used*/ ++#define PCIE_BAR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x14) /* Not used */ ++ ++#define PCIE_BNR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x18) /* Mandatory */ ++/* Bus Number Register bits */ ++#define PCIE_BNR_PRIMARY_BUS_NUM 0x000000FF ++#define PCIE_BNR_PRIMARY_BUS_NUM_S 0 ++#define PCIE_PNR_SECONDARY_BUS_NUM 0x0000FF00 ++#define PCIE_PNR_SECONDARY_BUS_NUM_S 8 ++#define PCIE_PNR_SUB_BUS_NUM 0x00FF0000 ++#define PCIE_PNR_SUB_BUS_NUM_S 16 ++ ++/* IO Base/Limit Register bits */ ++#define PCIE_IOBLSECS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x1C) /* RC only */ ++#define PCIE_IOBLSECS_32BIT_IO_ADDR 0x00000001 ++#define PCIE_IOBLSECS_IO_BASE_ADDR 0x000000F0 ++#define PCIE_IOBLSECS_IO_BASE_ADDR_S 4 ++#define PCIE_IOBLSECS_32BIT_IOLIMT 0x00000100 ++#define PCIE_IOBLSECS_IO_LIMIT_ADDR 0x0000F000 ++#define PCIE_IOBLSECS_IO_LIMIT_ADDR_S 12 ++ ++/* Non-prefetchable Memory Base/Limit Register bit */ ++#define PCIE_MBML(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x20) /* RC only */ ++#define PCIE_MBML_MEM_BASE_ADDR 0x0000FFF0 ++#define PCIE_MBML_MEM_BASE_ADDR_S 4 ++#define PCIE_MBML_MEM_LIMIT_ADDR 0xFFF00000 ++#define PCIE_MBML_MEM_LIMIT_ADDR_S 20 ++ ++/* Prefetchable Memory Base/Limit Register bit */ ++#define PCIE_PMBL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x24) /* RC only */ ++#define PCIE_PMBL_64BIT_ADDR 0x00000001 ++#define PCIE_PMBL_UPPER_12BIT 0x0000FFF0 ++#define PCIE_PMBL_UPPER_12BIT_S 4 ++#define PCIE_PMBL_E64MA 0x00010000 ++#define PCIE_PMBL_END_ADDR 0xFFF00000 ++#define PCIE_PMBL_END_ADDR_S 20 ++#define PCIE_PMBU32(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x28) /* RC only */ ++#define PCIE_PMLU32(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x2C) /* RC only */ ++ ++/* I/O Base/Limit Upper 16 bits register */ ++#define PCIE_IO_BANDL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x30) /* RC only */ ++#define PCIE_IO_BANDL_UPPER_16BIT_IO_BASE 0x0000FFFF ++#define PCIE_IO_BANDL_UPPER_16BIT_IO_BASE_S 0 ++#define PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT 0xFFFF0000 ++#define PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT_S 16 ++ ++#define PCIE_CPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x34) ++#define PCIE_EBBAR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x38) ++ ++/* Interrupt and Secondary Bridge Control Register */ ++#define PCIE_INTRBCTRL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x3C) ++ ++#define PCIE_INTRBCTRL_INT_LINE 0x000000FF ++#define PCIE_INTRBCTRL_INT_LINE_S 0 ++#define PCIE_INTRBCTRL_INT_PIN 0x0000FF00 ++#define PCIE_INTRBCTRL_INT_PIN_S 8 ++#define PCIE_INTRBCTRL_PARITY_ERR_RESP_ENABLE 0x00010000 /* #PERR */ ++#define PCIE_INTRBCTRL_SERR_ENABLE 0x00020000 /* #SERR */ ++#define PCIE_INTRBCTRL_ISA_ENABLE 0x00040000 /* ISA enable, IO 64KB only */ ++#define PCIE_INTRBCTRL_VGA_ENABLE 0x00080000 /* VGA enable */ ++#define PCIE_INTRBCTRL_VGA_16BIT_DECODE 0x00100000 /* VGA 16bit decode */ ++#define PCIE_INTRBCTRL_RST_SECONDARY_BUS 0x00400000 /* Secondary bus rest, hot rest, 1ms */ ++/* Others are read only */ ++enum { ++ PCIE_INTRBCTRL_INT_NON = 0, ++ PCIE_INTRBCTRL_INTA, ++ PCIE_INTRBCTRL_INTB, ++ PCIE_INTRBCTRL_INTC, ++ PCIE_INTRBCTRL_INTD, ++}; ++ ++#define PCIE_PM_CAPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x40) ++ ++/* Power Management Control and Status Register */ ++#define PCIE_PM_CSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x44) ++ ++#define PCIE_PM_CSR_POWER_STATE 0x00000003 /* Power State */ ++#define PCIE_PM_CSR_POWER_STATE_S 0 ++#define PCIE_PM_CSR_SW_RST 0x00000008 /* Soft Reset Enabled */ ++#define PCIE_PM_CSR_PME_ENABLE 0x00000100 /* PME Enable */ ++#define PCIE_PM_CSR_PME_STATUS 0x00008000 /* PME status */ ++ ++/* MSI Capability Register for EP */ ++#define PCIE_MCAPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x50) ++ ++#define PCIE_MCAPR_MSI_CAP_ID 0x000000FF /* MSI Capability ID */ ++#define PCIE_MCAPR_MSI_CAP_ID_S 0 ++#define PCIE_MCAPR_MSI_NEXT_CAP_PTR 0x0000FF00 /* Next Capability Pointer */ ++#define PCIE_MCAPR_MSI_NEXT_CAP_PTR_S 8 ++#define PCIE_MCAPR_MSI_ENABLE 0x00010000 /* MSI Enable */ ++#define PCIE_MCAPR_MULTI_MSG_CAP 0x000E0000 /* Multiple Message Capable */ ++#define PCIE_MCAPR_MULTI_MSG_CAP_S 17 ++#define PCIE_MCAPR_MULTI_MSG_ENABLE 0x00700000 /* Multiple Message Enable */ ++#define PCIE_MCAPR_MULTI_MSG_ENABLE_S 20 ++#define PCIE_MCAPR_ADDR64_CAP 0X00800000 /* 64-bit Address Capable */ ++ ++/* MSI Message Address Register */ ++#define PCIE_MA(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x54) ++ ++#define PCIE_MA_ADDR_MASK 0xFFFFFFFC /* Message Address */ ++ ++/* MSI Message Upper Address Register */ ++#define PCIE_MUA(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x58) ++ ++/* MSI Message Data Register */ ++#define PCIE_MD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x5C) ++ ++#define PCIE_MD_DATA 0x0000FFFF /* Message Data */ ++#define PCIE_MD_DATA_S 0 ++ ++/* PCI Express Capability Register */ ++#define PCIE_XCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x70) ++ ++#define PCIE_XCAP_ID 0x000000FF /* PCI Express Capability ID */ ++#define PCIE_XCAP_ID_S 0 ++#define PCIE_XCAP_NEXT_CAP 0x0000FF00 /* Next Capability Pointer */ ++#define PCIE_XCAP_NEXT_CAP_S 8 ++#define PCIE_XCAP_VER 0x000F0000 /* PCI Express Capability Version */ ++#define PCIE_XCAP_VER_S 16 ++#define PCIE_XCAP_DEV_PORT_TYPE 0x00F00000 /* Device Port Type */ ++#define PCIE_XCAP_DEV_PORT_TYPE_S 20 ++#define PCIE_XCAP_SLOT_IMPLEMENTED 0x01000000 /* Slot Implemented */ ++#define PCIE_XCAP_MSG_INT_NUM 0x3E000000 /* Interrupt Message Number */ ++#define PCIE_XCAP_MSG_INT_NUM_S 25 ++ ++/* Device Capability Register */ ++#define PCIE_DCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x74) ++ ++#define PCIE_DCAP_MAX_PAYLOAD_SIZE 0x00000007 /* Max Payload size */ ++#define PCIE_DCAP_MAX_PAYLOAD_SIZE_S 0 ++#define PCIE_DCAP_PHANTOM_FUNC 0x00000018 /* Phanton Function, not supported */ ++#define PCIE_DCAP_PHANTOM_FUNC_S 3 ++#define PCIE_DCAP_EXT_TAG 0x00000020 /* Extended Tag Field */ ++#define PCIE_DCAP_EP_L0S_LATENCY 0x000001C0 /* EP L0s latency only */ ++#define PCIE_DCAP_EP_L0S_LATENCY_S 6 ++#define PCIE_DCAP_EP_L1_LATENCY 0x00000E00 /* EP L1 latency only */ ++#define PCIE_DCAP_EP_L1_LATENCY_S 9 ++#define PCIE_DCAP_ROLE_BASE_ERR_REPORT 0x00008000 /* Role Based ERR */ ++ ++/* Maximum payload size supported */ ++enum { ++ PCIE_MAX_PAYLOAD_128 = 0, ++ PCIE_MAX_PAYLOAD_256, ++ PCIE_MAX_PAYLOAD_512, ++ PCIE_MAX_PAYLOAD_1024, ++ PCIE_MAX_PAYLOAD_2048, ++ PCIE_MAX_PAYLOAD_4096, ++}; ++ ++/* Device Control and Status Register */ ++#define PCIE_DCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x78) ++ ++#define PCIE_DCTLSTS_CORRECTABLE_ERR_EN 0x00000001 /* COR-ERR */ ++#define PCIE_DCTLSTS_NONFATAL_ERR_EN 0x00000002 /* Non-fatal ERR */ ++#define PCIE_DCTLSTS_FATAL_ERR_EN 0x00000004 /* Fatal ERR */ ++#define PCIE_DCTLSYS_UR_REQ_EN 0x00000008 /* UR ERR */ ++#define PCIE_DCTLSTS_RELAXED_ORDERING_EN 0x00000010 /* Enable relaxing ordering */ ++#define PCIE_DCTLSTS_MAX_PAYLOAD_SIZE 0x000000E0 /* Max payload mask */ ++#define PCIE_DCTLSTS_MAX_PAYLOAD_SIZE_S 5 ++#define PCIE_DCTLSTS_EXT_TAG_EN 0x00000100 /* Extended tag field */ ++#define PCIE_DCTLSTS_PHANTOM_FUNC_EN 0x00000200 /* Phantom Function Enable */ ++#define PCIE_DCTLSTS_AUX_PM_EN 0x00000400 /* AUX Power PM Enable */ ++#define PCIE_DCTLSTS_NO_SNOOP_EN 0x00000800 /* Enable no snoop, except root port*/ ++#define PCIE_DCTLSTS_MAX_READ_SIZE 0x00007000 /* Max Read Request size*/ ++#define PCIE_DCTLSTS_MAX_READ_SIZE_S 12 ++#define PCIE_DCTLSTS_CORRECTABLE_ERR 0x00010000 /* COR-ERR Detected */ ++#define PCIE_DCTLSTS_NONFATAL_ERR 0x00020000 /* Non-Fatal ERR Detected */ ++#define PCIE_DCTLSTS_FATAL_ER 0x00040000 /* Fatal ERR Detected */ ++#define PCIE_DCTLSTS_UNSUPPORTED_REQ 0x00080000 /* UR Detected */ ++#define PCIE_DCTLSTS_AUX_POWER 0x00100000 /* Aux Power Detected */ ++#define PCIE_DCTLSTS_TRANSACT_PENDING 0x00200000 /* Transaction pending */ ++ ++#define PCIE_DCTLSTS_ERR_EN (PCIE_DCTLSTS_CORRECTABLE_ERR_EN | \ ++ PCIE_DCTLSTS_NONFATAL_ERR_EN | PCIE_DCTLSTS_FATAL_ERR_EN | \ ++ PCIE_DCTLSYS_UR_REQ_EN) ++ ++/* Link Capability Register */ ++#define PCIE_LCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7C) ++#define PCIE_LCAP_MAX_LINK_SPEED 0x0000000F /* Max link speed, 0x1 by default */ ++#define PCIE_LCAP_MAX_LINK_SPEED_S 0 ++#define PCIE_LCAP_MAX_LENGTH_WIDTH 0x000003F0 /* Maxium Length Width */ ++#define PCIE_LCAP_MAX_LENGTH_WIDTH_S 4 ++#define PCIE_LCAP_ASPM_LEVEL 0x00000C00 /* Active State Link PM Support */ ++#define PCIE_LCAP_ASPM_LEVEL_S 10 ++#define PCIE_LCAP_L0S_EIXT_LATENCY 0x00007000 /* L0s Exit Latency */ ++#define PCIE_LCAP_L0S_EIXT_LATENCY_S 12 ++#define PCIE_LCAP_L1_EXIT_LATENCY 0x00038000 /* L1 Exit Latency */ ++#define PCIE_LCAP_L1_EXIT_LATENCY_S 15 ++#define PCIE_LCAP_CLK_PM 0x00040000 /* Clock Power Management */ ++#define PCIE_LCAP_SDER 0x00080000 /* Surprise Down Error Reporting */ ++#define PCIE_LCAP_DLL_ACTIVE_REPROT 0x00100000 /* Data Link Layer Active Reporting Capable */ ++#define PCIE_LCAP_PORT_NUM 0xFF0000000 /* Port number */ ++#define PCIE_LCAP_PORT_NUM_S 24 ++ ++/* Maximum Length width definition */ ++#define PCIE_MAX_LENGTH_WIDTH_RES 0x00 ++#define PCIE_MAX_LENGTH_WIDTH_X1 0x01 /* Default */ ++#define PCIE_MAX_LENGTH_WIDTH_X2 0x02 ++#define PCIE_MAX_LENGTH_WIDTH_X4 0x04 ++#define PCIE_MAX_LENGTH_WIDTH_X8 0x08 ++#define PCIE_MAX_LENGTH_WIDTH_X12 0x0C ++#define PCIE_MAX_LENGTH_WIDTH_X16 0x10 ++#define PCIE_MAX_LENGTH_WIDTH_X32 0x20 ++ ++/* Active State Link PM definition */ ++enum { ++ PCIE_ASPM_RES0 = 0, ++ PCIE_ASPM_L0S_ENTRY_SUPPORT, /* L0s */ ++ PCIE_ASPM_RES1, ++ PCIE_ASPM_L0S_L1_ENTRY_SUPPORT, /* L0s and L1, default */ ++}; ++ ++/* L0s Exit Latency definition */ ++enum { ++ PCIE_L0S_EIXT_LATENCY_L64NS = 0, /* < 64 ns */ ++ PCIE_L0S_EIXT_LATENCY_B64A128, /* > 64 ns < 128 ns */ ++ PCIE_L0S_EIXT_LATENCY_B128A256, /* > 128 ns < 256 ns */ ++ PCIE_L0S_EIXT_LATENCY_B256A512, /* > 256 ns < 512 ns */ ++ PCIE_L0S_EIXT_LATENCY_B512TO1U, /* > 512 ns < 1 us */ ++ PCIE_L0S_EIXT_LATENCY_B1A2U, /* > 1 us < 2 us */ ++ PCIE_L0S_EIXT_LATENCY_B2A4U, /* > 2 us < 4 us */ ++ PCIE_L0S_EIXT_LATENCY_M4US, /* > 4 us */ ++}; ++ ++/* L1 Exit Latency definition */ ++enum { ++ PCIE_L1_EXIT_LATENCY_L1US = 0, /* < 1 us */ ++ PCIE_L1_EXIT_LATENCY_B1A2, /* > 1 us < 2 us */ ++ PCIE_L1_EXIT_LATENCY_B2A4, /* > 2 us < 4 us */ ++ PCIE_L1_EXIT_LATENCY_B4A8, /* > 4 us < 8 us */ ++ PCIE_L1_EXIT_LATENCY_B8A16, /* > 8 us < 16 us */ ++ PCIE_L1_EXIT_LATENCY_B16A32, /* > 16 us < 32 us */ ++ PCIE_L1_EXIT_LATENCY_B32A64, /* > 32 us < 64 us */ ++ PCIE_L1_EXIT_LATENCY_M64US, /* > 64 us */ ++}; ++ ++/* Link Control and Status Register */ ++#define PCIE_LCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x80) ++#define PCIE_LCTLSTS_ASPM_ENABLE 0x00000003 /* Active State Link PM Control */ ++#define PCIE_LCTLSTS_ASPM_ENABLE_S 0 ++#define PCIE_LCTLSTS_RCB128 0x00000008 /* Read Completion Boundary 128*/ ++#define PCIE_LCTLSTS_LINK_DISABLE 0x00000010 /* Link Disable */ ++#define PCIE_LCTLSTS_RETRIAN_LINK 0x00000020 /* Retrain Link */ ++#define PCIE_LCTLSTS_COM_CLK_CFG 0x00000040 /* Common Clock Configuration */ ++#define PCIE_LCTLSTS_EXT_SYNC 0x00000080 /* Extended Synch */ ++#define PCIE_LCTLSTS_CLK_PM_EN 0x00000100 /* Enable Clock Powerm Management */ ++#define PCIE_LCTLSTS_LINK_SPEED 0x000F0000 /* Link Speed */ ++#define PCIE_LCTLSTS_LINK_SPEED_S 16 ++#define PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH 0x03F00000 /* Negotiated Link Width */ ++#define PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH_S 20 ++#define PCIE_LCTLSTS_RETRAIN_PENDING 0x08000000 /* Link training is ongoing */ ++#define PCIE_LCTLSTS_SLOT_CLK_CFG 0x10000000 /* Slot Clock Configuration */ ++#define PCIE_LCTLSTS_DLL_ACTIVE 0x20000000 /* Data Link Layer Active */ ++ ++/* Slot Capabilities Register */ ++#define PCIE_SLCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x84) ++ ++/* Slot Capabilities */ ++#define PCIE_SLCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x88) ++ ++/* Root Control and Capability Register */ ++#define PCIE_RCTLCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x8C) ++#define PCIE_RCTLCAP_SERR_ON_CORRECTABLE_ERR 0x00000001 /* #SERR on COR-ERR */ ++#define PCIE_RCTLCAP_SERR_ON_NONFATAL_ERR 0x00000002 /* #SERR on Non-Fatal ERR */ ++#define PCIE_RCTLCAP_SERR_ON_FATAL_ERR 0x00000004 /* #SERR on Fatal ERR */ ++#define PCIE_RCTLCAP_PME_INT_EN 0x00000008 /* PME Interrupt Enable */ ++#define PCIE_RCTLCAP_SERR_ENABLE (PCIE_RCTLCAP_SERR_ON_CORRECTABLE_ERR | \ ++ PCIE_RCTLCAP_SERR_ON_NONFATAL_ERR | PCIE_RCTLCAP_SERR_ON_FATAL_ERR) ++/* Root Status Register */ ++#define PCIE_RSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x90) ++#define PCIE_RSTS_PME_REQ_ID 0x0000FFFF /* PME Request ID */ ++#define PCIE_RSTS_PME_REQ_ID_S 0 ++#define PCIE_RSTS_PME_STATUS 0x00010000 /* PME Status */ ++#define PCIE_RSTS_PME_PENDING 0x00020000 /* PME Pending */ ++ ++/* PCI Express Enhanced Capability Header */ ++#define PCIE_ENHANCED_CAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x100) ++#define PCIE_ENHANCED_CAP_ID 0x0000FFFF /* PCI Express Extended Capability ID */ ++#define PCIE_ENHANCED_CAP_ID_S 0 ++#define PCIE_ENHANCED_CAP_VER 0x000F0000 /* Capability Version */ ++#define PCIE_ENHANCED_CAP_VER_S 16 ++#define PCIE_ENHANCED_CAP_NEXT_OFFSET 0xFFF00000 /* Next Capability Offset */ ++#define PCIE_ENHANCED_CAP_NEXT_OFFSET_S 20 ++ ++/* Uncorrectable Error Status Register */ ++#define PCIE_UES_R(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x104) ++#define PCIE_DATA_LINK_PROTOCOL_ERR 0x00000010 /* Data Link Protocol Error Status */ ++#define PCIE_SURPRISE_DOWN_ERROR 0x00000020 /* Surprise Down Error Status */ ++#define PCIE_POISONED_TLP 0x00001000 /* Poisoned TLP Status */ ++#define PCIE_FC_PROTOCOL_ERR 0x00002000 /* Flow Control Protocol Error Status */ ++#define PCIE_COMPLETION_TIMEOUT 0x00004000 /* Completion Timeout Status */ ++#define PCIE_COMPLETOR_ABORT 0x00008000 /* Completer Abort Error */ ++#define PCIE_UNEXPECTED_COMPLETION 0x00010000 /* Unexpected Completion Status */ ++#define PCIE_RECEIVER_OVERFLOW 0x00020000 /* Receive Overflow Status */ ++#define PCIE_MALFORNED_TLP 0x00040000 /* Malformed TLP Stauts */ ++#define PCIE_ECRC_ERR 0x00080000 /* ECRC Error Stauts */ ++#define PCIE_UR_REQ 0x00100000 /* Unsupported Request Error Status */ ++#define PCIE_ALL_UNCORRECTABLE_ERR (PCIE_DATA_LINK_PROTOCOL_ERR | PCIE_SURPRISE_DOWN_ERROR | \ ++ PCIE_POISONED_TLP | PCIE_FC_PROTOCOL_ERR | PCIE_COMPLETION_TIMEOUT | \ ++ PCIE_COMPLETOR_ABORT | PCIE_UNEXPECTED_COMPLETION | PCIE_RECEIVER_OVERFLOW |\ ++ PCIE_MALFORNED_TLP | PCIE_ECRC_ERR | PCIE_UR_REQ) ++ ++/* Uncorrectable Error Mask Register, Mask means no report */ ++#define PCIE_UEMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x108) ++ ++/* Uncorrectable Error Severity Register */ ++#define PCIE_UESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x10C) ++ ++/* Correctable Error Status Register */ ++#define PCIE_CESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x110) ++#define PCIE_RX_ERR 0x00000001 /* Receive Error Status */ ++#define PCIE_BAD_TLP 0x00000040 /* Bad TLP Status */ ++#define PCIE_BAD_DLLP 0x00000080 /* Bad DLLP Status */ ++#define PCIE_REPLAY_NUM_ROLLOVER 0x00000100 /* Replay Number Rollover Status */ ++#define PCIE_REPLAY_TIMER_TIMEOUT_ERR 0x00001000 /* Reply Timer Timeout Status */ ++#define PCIE_ADVISORY_NONFTAL_ERR 0x00002000 /* Advisory Non-Fatal Error Status */ ++#define PCIE_CORRECTABLE_ERR (PCIE_RX_ERR | PCIE_BAD_TLP | PCIE_BAD_DLLP | PCIE_REPLAY_NUM_ROLLOVER |\ ++ PCIE_REPLAY_TIMER_TIMEOUT_ERR | PCIE_ADVISORY_NONFTAL_ERR) ++ ++/* Correctable Error Mask Register */ ++#define PCIE_CEMR(X) (volatile u32*)(PCIE_RC_CFG_BASE + 0x114) ++ ++/* Advanced Error Capabilities and Control Register */ ++#define PCIE_AECCR(X) (volatile u32*)(PCIE_RC_CFG_BASE + 0x118) ++#define PCIE_AECCR_FIRST_ERR_PTR 0x0000001F /* First Error Pointer */ ++#define PCIE_AECCR_FIRST_ERR_PTR_S 0 ++#define PCIE_AECCR_ECRC_GEN_CAP 0x00000020 /* ECRC Generation Capable */ ++#define PCIE_AECCR_ECRC_GEN_EN 0x00000040 /* ECRC Generation Enable */ ++#define PCIE_AECCR_ECRC_CHECK_CAP 0x00000080 /* ECRC Check Capable */ ++#define PCIE_AECCR_ECRC_CHECK_EN 0x00000100 /* ECRC Check Enable */ ++ ++/* Header Log Register 1 */ ++#define PCIE_HLR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x11C) ++ ++/* Header Log Register 2 */ ++#define PCIE_HLR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x120) ++ ++/* Header Log Register 3 */ ++#define PCIE_HLR3(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x124) ++ ++/* Header Log Register 4 */ ++#define PCIE_HLR4(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x128) ++ ++/* Root Error Command Register */ ++#define PCIE_RECR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x12C) ++#define PCIE_RECR_CORRECTABLE_ERR_REPORT_EN 0x00000001 /* COR-ERR */ ++#define PCIE_RECR_NONFATAL_ERR_REPORT_EN 0x00000002 /* Non-Fatal ERR */ ++#define PCIE_RECR_FATAL_ERR_REPORT_EN 0x00000004 /* Fatal ERR */ ++#define PCIE_RECR_ERR_REPORT_EN (PCIE_RECR_CORRECTABLE_ERR_REPORT_EN | \ ++ PCIE_RECR_NONFATAL_ERR_REPORT_EN | PCIE_RECR_FATAL_ERR_REPORT_EN) ++ ++/* Root Error Status Register */ ++#define PCIE_RESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x130) ++#define PCIE_RESR_CORRECTABLE_ERR 0x00000001 /* COR-ERR Receveid */ ++#define PCIE_RESR_MULTI_CORRECTABLE_ERR 0x00000002 /* Multiple COR-ERR Received */ ++#define PCIE_RESR_FATAL_NOFATAL_ERR 0x00000004 /* ERR Fatal/Non-Fatal Received */ ++#define PCIE_RESR_MULTI_FATAL_NOFATAL_ERR 0x00000008 /* Multiple ERR Fatal/Non-Fatal Received */ ++#define PCIE_RESR_FIRST_UNCORRECTABLE_FATAL_ERR 0x00000010 /* First UN-COR Fatal */ ++#define PCIR_RESR_NON_FATAL_ERR 0x00000020 /* Non-Fatal Error Message Received */ ++#define PCIE_RESR_FATAL_ERR 0x00000040 /* Fatal Message Received */ ++#define PCIE_RESR_AER_INT_MSG_NUM 0xF8000000 /* Advanced Error Interrupt Message Number */ ++#define PCIE_RESR_AER_INT_MSG_NUM_S 27 ++ ++/* Error Source Indentification Register */ ++#define PCIE_ESIR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x134) ++#define PCIE_ESIR_CORRECTABLE_ERR_SRC_ID 0x0000FFFF ++#define PCIE_ESIR_CORRECTABLE_ERR_SRC_ID_S 0 ++#define PCIE_ESIR_FATAL_NON_FATAL_SRC_ID 0xFFFF0000 ++#define PCIE_ESIR_FATAL_NON_FATAL_SRC_ID_S 16 ++ ++/* VC Enhanced Capability Header */ ++#define PCIE_VC_ECH(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x140) ++ ++/* Port VC Capability Register */ ++#define PCIE_PVC1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x144) ++#define PCIE_PVC1_EXT_VC_CNT 0x00000007 /* Extended VC Count */ ++#define PCIE_PVC1_EXT_VC_CNT_S 0 ++#define PCIE_PVC1_LOW_PRI_EXT_VC_CNT 0x00000070 /* Low Priority Extended VC Count */ ++#define PCIE_PVC1_LOW_PRI_EXT_VC_CNT_S 4 ++#define PCIE_PVC1_REF_CLK 0x00000300 /* Reference Clock */ ++#define PCIE_PVC1_REF_CLK_S 8 ++#define PCIE_PVC1_PORT_ARB_TAB_ENTRY_SIZE 0x00000C00 /* Port Arbitration Table Entry Size */ ++#define PCIE_PVC1_PORT_ARB_TAB_ENTRY_SIZE_S 10 ++ ++/* Extended Virtual Channel Count Defintion */ ++#define PCIE_EXT_VC_CNT_MIN 0 ++#define PCIE_EXT_VC_CNT_MAX 7 ++ ++/* Port Arbitration Table Entry Size Definition */ ++enum { ++ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S1BIT = 0, ++ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S2BIT, ++ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S4BIT, ++ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S8BIT, ++}; ++ ++/* Port VC Capability Register 2 */ ++#define PCIE_PVC2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x148) ++#define PCIE_PVC2_VC_ARB_16P_FIXED_WRR 0x00000001 /* HW Fixed arbitration, 16 phase WRR */ ++#define PCIE_PVC2_VC_ARB_32P_WRR 0x00000002 /* 32 phase WRR */ ++#define PCIE_PVC2_VC_ARB_64P_WRR 0x00000004 /* 64 phase WRR */ ++#define PCIE_PVC2_VC_ARB_128P_WRR 0x00000008 /* 128 phase WRR */ ++#define PCIE_PVC2_VC_ARB_WRR 0x0000000F ++#define PCIE_PVC2_VC_ARB_TAB_OFFSET 0xFF000000 /* VC arbitration table offset, not support */ ++#define PCIE_PVC2_VC_ARB_TAB_OFFSET_S 24 ++ ++/* Port VC Control and Status Register */ ++#define PCIE_PVCCRSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x14C) ++#define PCIE_PVCCRSR_LOAD_VC_ARB_TAB 0x00000001 /* Load VC Arbitration Table */ ++#define PCIE_PVCCRSR_VC_ARB_SEL 0x0000000E /* VC Arbitration Select */ ++#define PCIE_PVCCRSR_VC_ARB_SEL_S 1 ++#define PCIE_PVCCRSR_VC_ARB_TAB_STATUS 0x00010000 /* Arbitration Status */ ++ ++/* VC0 Resource Capability Register */ ++#define PCIE_VC0_RC(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x150) ++#define PCIE_VC0_RC_PORT_ARB_HW_FIXED 0x00000001 /* HW Fixed arbitration */ ++#define PCIE_VC0_RC_PORT_ARB_32P_WRR 0x00000002 /* 32 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB_64P_WRR 0x00000004 /* 64 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB_128P_WRR 0x00000008 /* 128 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB_TM_128P_WRR 0x00000010 /* Time-based 128 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB_TM_256P_WRR 0x00000020 /* Time-based 256 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB (PCIE_VC0_RC_PORT_ARB_HW_FIXED | PCIE_VC0_RC_PORT_ARB_32P_WRR |\ ++ PCIE_VC0_RC_PORT_ARB_64P_WRR | PCIE_VC0_RC_PORT_ARB_128P_WRR | \ ++ PCIE_VC0_RC_PORT_ARB_TM_128P_WRR | PCIE_VC0_RC_PORT_ARB_TM_256P_WRR) ++ ++#define PCIE_VC0_RC_REJECT_SNOOP 0x00008000 /* Reject Snoop Transactioin */ ++#define PCIE_VC0_RC_MAX_TIMESLOTS 0x007F0000 /* Maximum time Slots */ ++#define PCIE_VC0_RC_MAX_TIMESLOTS_S 16 ++#define PCIE_VC0_RC_PORT_ARB_TAB_OFFSET 0xFF000000 /* Port Arbitration Table Offset */ ++#define PCIE_VC0_RC_PORT_ARB_TAB_OFFSET_S 24 ++ ++/* VC0 Resource Control Register */ ++#define PCIE_VC0_RC0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x154) ++#define PCIE_VC0_RC0_TVM0 0x00000001 /* TC0 and VC0 */ ++#define PCIE_VC0_RC0_TVM1 0x00000002 /* TC1 and VC1 */ ++#define PCIE_VC0_RC0_TVM2 0x00000004 /* TC2 and VC2 */ ++#define PCIE_VC0_RC0_TVM3 0x00000008 /* TC3 and VC3 */ ++#define PCIE_VC0_RC0_TVM4 0x00000010 /* TC4 and VC4 */ ++#define PCIE_VC0_RC0_TVM5 0x00000020 /* TC5 and VC5 */ ++#define PCIE_VC0_RC0_TVM6 0x00000040 /* TC6 and VC6 */ ++#define PCIE_VC0_RC0_TVM7 0x00000080 /* TC7 and VC7 */ ++#define PCIE_VC0_RC0_TC_VC 0x000000FF /* TC/VC mask */ ++ ++#define PCIE_VC0_RC0_LOAD_PORT_ARB_TAB 0x00010000 /* Load Port Arbitration Table */ ++#define PCIE_VC0_RC0_PORT_ARB_SEL 0x000E0000 /* Port Arbitration Select */ ++#define PCIE_VC0_RC0_PORT_ARB_SEL_S 17 ++#define PCIE_VC0_RC0_VC_ID 0x07000000 /* VC ID */ ++#define PCIE_VC0_RC0_VC_ID_S 24 ++#define PCIE_VC0_RC0_VC_EN 0x80000000 /* VC Enable */ ++ ++/* VC0 Resource Status Register */ ++#define PCIE_VC0_RSR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x158) ++#define PCIE_VC0_RSR0_PORT_ARB_TAB_STATUS 0x00010000 /* Port Arbitration Table Status,not used */ ++#define PCIE_VC0_RSR0_VC_NEG_PENDING 0x00020000 /* VC Negotiation Pending */ ++ ++/* Ack Latency Timer and Replay Timer Register */ ++#define PCIE_ALTRT(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x700) ++#define PCIE_ALTRT_ROUND_TRIP_LATENCY_LIMIT 0x0000FFFF /* Round Trip Latency Time Limit */ ++#define PCIE_ALTRT_ROUND_TRIP_LATENCY_LIMIT_S 0 ++#define PCIE_ALTRT_REPLAY_TIME_LIMIT 0xFFFF0000 /* Replay Time Limit */ ++#define PCIE_ALTRT_REPLAY_TIME_LIMIT_S 16 ++ ++/* Other Message Register */ ++#define PCIE_OMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x704) ++ ++/* Port Force Link Register */ ++#define PCIE_PFLR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x708) ++#define PCIE_PFLR_LINK_NUM 0x000000FF /* Link Number */ ++#define PCIE_PFLR_LINK_NUM_S 0 ++#define PCIE_PFLR_FORCE_LINK 0x00008000 /* Force link */ ++#define PCIE_PFLR_LINK_STATE 0x003F0000 /* Link State */ ++#define PCIE_PFLR_LINK_STATE_S 16 ++#define PCIE_PFLR_LOW_POWER_ENTRY_CNT 0xFF000000 /* Low Power Entrance Count, only for EP */ ++#define PCIE_PFLR_LOW_POWER_ENTRY_CNT_S 24 ++ ++/* Ack Frequency Register */ ++#define PCIE_AFR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x70C) ++#define PCIE_AFR_AF 0x000000FF /* Ack Frequency */ ++#define PCIE_AFR_AF_S 0 ++#define PCIE_AFR_FTS_NUM 0x0000FF00 /* The number of Fast Training Sequence from L0S to L0 */ ++#define PCIE_AFR_FTS_NUM_S 8 ++#define PCIE_AFR_COM_FTS_NUM 0x00FF0000 /* N_FTS; when common clock is used*/ ++#define PCIE_AFR_COM_FTS_NUM_S 16 ++#define PCIE_AFR_L0S_ENTRY_LATENCY 0x07000000 /* L0s Entrance Latency */ ++#define PCIE_AFR_L0S_ENTRY_LATENCY_S 24 ++#define PCIE_AFR_L1_ENTRY_LATENCY 0x38000000 /* L1 Entrance Latency */ ++#define PCIE_AFR_L1_ENTRY_LATENCY_S 27 ++#define PCIE_AFR_FTS_NUM_DEFAULT 32 ++#define PCIE_AFR_L0S_ENTRY_LATENCY_DEFAULT 7 ++#define PCIE_AFR_L1_ENTRY_LATENCY_DEFAULT 5 ++ ++/* Port Link Control Register */ ++#define PCIE_PLCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x710) ++#define PCIE_PLCR_OTHER_MSG_REQ 0x00000001 /* Other Message Request */ ++#define PCIE_PLCR_SCRAMBLE_DISABLE 0x00000002 /* Scramble Disable */ ++#define PCIE_PLCR_LOOPBACK_EN 0x00000004 /* Loopback Enable */ ++#define PCIE_PLCR_LTSSM_HOT_RST 0x00000008 /* Force LTSSM to the hot reset */ ++#define PCIE_PLCR_DLL_LINK_EN 0x00000020 /* Enable Link initialization */ ++#define PCIE_PLCR_FAST_LINK_SIM_EN 0x00000080 /* Sets all internal timers to fast mode for simulation purposes */ ++#define PCIE_PLCR_LINK_MODE 0x003F0000 /* Link Mode Enable Mask */ ++#define PCIE_PLCR_LINK_MODE_S 16 ++#define PCIE_PLCR_CORRUPTED_CRC_EN 0x02000000 /* Enabled Corrupt CRC */ ++ ++/* Lane Skew Register */ ++#define PCIE_LSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x714) ++#define PCIE_LSR_LANE_SKEW_NUM 0x00FFFFFF /* Insert Lane Skew for Transmit, not applicable */ ++#define PCIE_LSR_LANE_SKEW_NUM_S 0 ++#define PCIE_LSR_FC_DISABLE 0x01000000 /* Disable of Flow Control */ ++#define PCIE_LSR_ACKNAK_DISABLE 0x02000000 /* Disable of Ack/Nak */ ++#define PCIE_LSR_LANE_DESKEW_DISABLE 0x80000000 /* Disable of Lane-to-Lane Skew */ ++ ++/* Symbol Number Register */ ++#define PCIE_SNR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x718) ++#define PCIE_SNR_TS 0x0000000F /* Number of TS Symbol */ ++#define PCIE_SNR_TS_S 0 ++#define PCIE_SNR_SKP 0x00000700 /* Number of SKP Symbol */ ++#define PCIE_SNR_SKP_S 8 ++#define PCIE_SNR_REPLAY_TIMER 0x0007C000 /* Timer Modifier for Replay Timer */ ++#define PCIE_SNR_REPLAY_TIMER_S 14 ++#define PCIE_SNR_ACKNAK_LATENCY_TIMER 0x00F80000 /* Timer Modifier for Ack/Nak Latency Timer */ ++#define PCIE_SNR_ACKNAK_LATENCY_TIMER_S 19 ++#define PCIE_SNR_FC_TIMER 0x1F000000 /* Timer Modifier for Flow Control Watchdog Timer */ ++#define PCIE_SNR_FC_TIMER_S 28 ++ ++/* Symbol Timer Register and Filter Mask Register 1 */ ++#define PCIE_STRFMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x71C) ++#define PCIE_STRFMR_SKP_INTERVAL 0x000007FF /* SKP lnterval Value */ ++#define PCIE_STRFMR_SKP_INTERVAL_S 0 ++#define PCIE_STRFMR_FC_WDT_DISABLE 0x00008000 /* Disable of FC Watchdog Timer */ ++#define PCIE_STRFMR_TLP_FUNC_MISMATCH_OK 0x00010000 /* Mask Function Mismatch Filtering for Incoming Requests */ ++#define PCIE_STRFMR_POISONED_TLP_OK 0x00020000 /* Mask Poisoned TLP Filtering */ ++#define PCIE_STRFMR_BAR_MATCH_OK 0x00040000 /* Mask BAR Match Filtering */ ++#define PCIE_STRFMR_TYPE1_CFG_REQ_OK 0x00080000 /* Mask Type 1 Configuration Request Filtering */ ++#define PCIE_STRFMR_LOCKED_REQ_OK 0x00100000 /* Mask Locked Request Filtering */ ++#define PCIE_STRFMR_CPL_TAG_ERR_RULES_OK 0x00200000 /* Mask Tag Error Rules for Received Completions */ ++#define PCIE_STRFMR_CPL_REQUESTOR_ID_MISMATCH_OK 0x00400000 /* Mask Requester ID Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_CPL_FUNC_MISMATCH_OK 0x00800000 /* Mask Function Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_CPL_TC_MISMATCH_OK 0x01000000 /* Mask Traffic Class Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_CPL_ATTR_MISMATCH_OK 0x02000000 /* Mask Attribute Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_CPL_LENGTH_MISMATCH_OK 0x04000000 /* Mask Length Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_TLP_ECRC_ERR_OK 0x08000000 /* Mask ECRC Error Filtering */ ++#define PCIE_STRFMR_CPL_TLP_ECRC_OK 0x10000000 /* Mask ECRC Error Filtering for Completions */ ++#define PCIE_STRFMR_RX_TLP_MSG_NO_DROP 0x20000000 /* Send Message TLPs */ ++#define PCIE_STRFMR_RX_IO_TRANS_ENABLE 0x40000000 /* Mask Filtering of received I/O Requests */ ++#define PCIE_STRFMR_RX_CFG_TRANS_ENABLE 0x80000000 /* Mask Filtering of Received Configuration Requests */ ++ ++#define PCIE_DEF_SKP_INTERVAL 700 /* 1180 ~1538 , 125MHz * 2, 250MHz * 1 */ ++ ++/* Filter Masker Register 2 */ ++#define PCIE_FMR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x720) ++#define PCIE_FMR2_VENDOR_MSG0_PASSED_TO_TRGT1 0x00000001 /* Mask RADM Filtering and Error Handling Rules */ ++#define PCIE_FMR2_VENDOR_MSG1_PASSED_TO_TRGT1 0x00000002 /* Mask RADM Filtering and Error Handling Rules */ ++ ++/* Debug Register 0 */ ++#define PCIE_DBR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x728) ++ ++/* Debug Register 1 */ ++#define PCIE_DBR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x72C) ++ ++/* Transmit Posted FC Credit Status Register */ ++#define PCIE_TPFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x730) ++#define PCIE_TPFCS_TX_P_DATA_FC_CREDITS 0x00000FFF /* Transmit Posted Data FC Credits */ ++#define PCIE_TPFCS_TX_P_DATA_FC_CREDITS_S 0 ++#define PCIE_TPFCS_TX_P_HDR_FC_CREDITS 0x000FF000 /* Transmit Posted Header FC Credits */ ++#define PCIE_TPFCS_TX_P_HDR_FC_CREDITS_S 12 ++ ++/* Transmit Non-Posted FC Credit Status */ ++#define PCIE_TNPFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x734) ++#define PCIE_TNPFCS_TX_NP_DATA_FC_CREDITS 0x00000FFF /* Transmit Non-Posted Data FC Credits */ ++#define PCIE_TNPFCS_TX_NP_DATA_FC_CREDITS_S 0 ++#define PCIE_TNPFCS_TX_NP_HDR_FC_CREDITS 0x000FF000 /* Transmit Non-Posted Header FC Credits */ ++#define PCIE_TNPFCS_TX_NP_HDR_FC_CREDITS_S 12 ++ ++/* Transmit Complete FC Credit Status Register */ ++#define PCIE_TCFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x738) ++#define PCIE_TCFCS_TX_CPL_DATA_FC_CREDITS 0x00000FFF /* Transmit Completion Data FC Credits */ ++#define PCIE_TCFCS_TX_CPL_DATA_FC_CREDITS_S 0 ++#define PCIE_TCFCS_TX_CPL_HDR_FC_CREDITS 0x000FF000 /* Transmit Completion Header FC Credits */ ++#define PCIE_TCFCS_TX_CPL_HDR_FC_CREDITS_S 12 ++ ++/* Queue Status Register */ ++#define PCIE_QSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x73C) ++#define PCIE_QSR_WAIT_UPDATE_FC_DLL 0x00000001 /* Received TLP FC Credits Not Returned */ ++#define PCIE_QSR_TX_RETRY_BUF_NOT_EMPTY 0x00000002 /* Transmit Retry Buffer Not Empty */ ++#define PCIE_QSR_RX_QUEUE_NOT_EMPTY 0x00000004 /* Received Queue Not Empty */ ++ ++/* VC Transmit Arbitration Register 1 */ ++#define PCIE_VCTAR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x740) ++#define PCIE_VCTAR1_WRR_WEIGHT_VC0 0x000000FF /* WRR Weight for VC0 */ ++#define PCIE_VCTAR1_WRR_WEIGHT_VC1 0x0000FF00 /* WRR Weight for VC1 */ ++#define PCIE_VCTAR1_WRR_WEIGHT_VC2 0x00FF0000 /* WRR Weight for VC2 */ ++#define PCIE_VCTAR1_WRR_WEIGHT_VC3 0xFF000000 /* WRR Weight for VC3 */ ++ ++/* VC Transmit Arbitration Register 2 */ ++#define PCIE_VCTAR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x744) ++#define PCIE_VCTAR2_WRR_WEIGHT_VC4 0x000000FF /* WRR Weight for VC4 */ ++#define PCIE_VCTAR2_WRR_WEIGHT_VC5 0x0000FF00 /* WRR Weight for VC5 */ ++#define PCIE_VCTAR2_WRR_WEIGHT_VC6 0x00FF0000 /* WRR Weight for VC6 */ ++#define PCIE_VCTAR2_WRR_WEIGHT_VC7 0xFF000000 /* WRR Weight for VC7 */ ++ ++/* VC0 Posted Receive Queue Control Register */ ++#define PCIE_VC0_PRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x748) ++#define PCIE_VC0_PRQCR_P_DATA_CREDITS 0x00000FFF /* VC0 Posted Data Credits */ ++#define PCIE_VC0_PRQCR_P_DATA_CREDITS_S 0 ++#define PCIE_VC0_PRQCR_P_HDR_CREDITS 0x000FF000 /* VC0 Posted Header Credits */ ++#define PCIE_VC0_PRQCR_P_HDR_CREDITS_S 12 ++#define PCIE_VC0_PRQCR_P_TLP_QUEUE_MODE 0x00E00000 /* VC0 Posted TLP Queue Mode */ ++#define PCIE_VC0_PRQCR_P_TLP_QUEUE_MODE_S 20 ++#define PCIE_VC0_PRQCR_TLP_RELAX_ORDER 0x40000000 /* TLP Type Ordering for VC0 */ ++#define PCIE_VC0_PRQCR_VC_STRICT_ORDER 0x80000000 /* VC0 Ordering for Receive Queues */ ++ ++/* VC0 Non-Posted Receive Queue Control */ ++#define PCIE_VC0_NPRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x74C) ++#define PCIE_VC0_NPRQCR_NP_DATA_CREDITS 0x00000FFF /* VC0 Non-Posted Data Credits */ ++#define PCIE_VC0_NPRQCR_NP_DATA_CREDITS_S 0 ++#define PCIE_VC0_NPRQCR_NP_HDR_CREDITS 0x000FF000 /* VC0 Non-Posted Header Credits */ ++#define PCIE_VC0_NPRQCR_NP_HDR_CREDITS_S 12 ++#define PCIE_VC0_NPRQCR_NP_TLP_QUEUE_MODE 0x00E00000 /* VC0 Non-Posted TLP Queue Mode */ ++#define PCIE_VC0_NPRQCR_NP_TLP_QUEUE_MODE_S 20 ++ ++/* VC0 Completion Receive Queue Control */ ++#define PCIE_VC0_CRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x750) ++#define PCIE_VC0_CRQCR_CPL_DATA_CREDITS 0x00000FFF /* VC0 Completion TLP Queue Mode */ ++#define PCIE_VC0_CRQCR_CPL_DATA_CREDITS_S 0 ++#define PCIE_VC0_CRQCR_CPL_HDR_CREDITS 0x000FF000 /* VC0 Completion Header Credits */ ++#define PCIE_VC0_CRQCR_CPL_HDR_CREDITS_S 12 ++#define PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE 0x00E00000 /* VC0 Completion Data Credits */ ++#define PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE_S 21 ++ ++/* Applicable to the above three registers */ ++enum { ++ PCIE_VC0_TLP_QUEUE_MODE_STORE_FORWARD = 1, ++ PCIE_VC0_TLP_QUEUE_MODE_CUT_THROUGH = 2, ++ PCIE_VC0_TLP_QUEUE_MODE_BYPASS = 4, ++}; ++ ++/* VC0 Posted Buffer Depth Register */ ++#define PCIE_VC0_PBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7A8) ++#define PCIE_VC0_PBD_P_DATA_QUEUE_ENTRIES 0x00003FFF /* VC0 Posted Data Queue Depth */ ++#define PCIE_VC0_PBD_P_DATA_QUEUE_ENTRIES_S 0 ++#define PCIE_VC0_PBD_P_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Posted Header Queue Depth */ ++#define PCIE_VC0_PBD_P_HDR_QUEUE_ENTRIES_S 16 ++ ++/* VC0 Non-Posted Buffer Depth Register */ ++#define PCIE_VC0_NPBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7AC) ++#define PCIE_VC0_NPBD_NP_DATA_QUEUE_ENTRIES 0x00003FFF /* VC0 Non-Posted Data Queue Depth */ ++#define PCIE_VC0_NPBD_NP_DATA_QUEUE_ENTRIES_S 0 ++#define PCIE_VC0_NPBD_NP_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Non-Posted Header Queue Depth */ ++#define PCIE_VC0_NPBD_NP_HDR_QUEUE_ENTRIES_S 16 ++ ++/* VC0 Completion Buffer Depth Register */ ++#define PCIE_VC0_CBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7B0) ++#define PCIE_VC0_CBD_CPL_DATA_QUEUE_ENTRIES 0x00003FFF /* C0 Completion Data Queue Depth */ ++#define PCIE_VC0_CBD_CPL_DATA_QUEUE_ENTRIES_S 0 ++#define PCIE_VC0_CBD_CPL_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Completion Header Queue Depth */ ++#define PCIE_VC0_CBD_CPL_HDR_QUEUE_ENTRIES_S 16 ++ ++/* PHY Status Register, all zeros in VR9 */ ++#define PCIE_PHYSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x810) ++ ++/* PHY Control Register, all zeros in VR9 */ ++#define PCIE_PHYCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x814) ++ ++/* ++ * PCIe PDI PHY register definition, suppose all the following ++ * stuff is confidential. ++ * XXX, detailed bit definition ++ */ ++#define PCIE_PHY_PLL_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x22 << 1)) ++#define PCIE_PHY_PLL_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x23 << 1)) ++#define PCIE_PHY_PLL_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x24 << 1)) ++#define PCIE_PHY_PLL_CTRL4(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x25 << 1)) ++#define PCIE_PHY_PLL_CTRL5(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x26 << 1)) ++#define PCIE_PHY_PLL_CTRL6(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x27 << 1)) ++#define PCIE_PHY_PLL_CTRL7(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x28 << 1)) ++#define PCIE_PHY_PLL_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x29 << 1)) ++#define PCIE_PHY_PLL_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2A << 1)) ++#define PCIE_PHY_PLL_A_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2B << 1)) ++#define PCIE_PHY_PLL_STATUS(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2C << 1)) ++ ++#define PCIE_PHY_TX1_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x30 << 1)) ++#define PCIE_PHY_TX1_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x31 << 1)) ++#define PCIE_PHY_TX1_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x32 << 1)) ++#define PCIE_PHY_TX1_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x33 << 1)) ++#define PCIE_PHY_TX1_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x34 << 1)) ++#define PCIE_PHY_TX1_MOD1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x35 << 1)) ++#define PCIE_PHY_TX1_MOD2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x36 << 1)) ++#define PCIE_PHY_TX1_MOD3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x37 << 1)) ++ ++#define PCIE_PHY_TX2_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x38 << 1)) ++#define PCIE_PHY_TX2_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x39 << 1)) ++#define PCIE_PHY_TX2_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3B << 1)) ++#define PCIE_PHY_TX2_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3C << 1)) ++#define PCIE_PHY_TX2_MOD1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3D << 1)) ++#define PCIE_PHY_TX2_MOD2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3E << 1)) ++#define PCIE_PHY_TX2_MOD3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3F << 1)) ++ ++#define PCIE_PHY_RX1_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x50 << 1)) ++#define PCIE_PHY_RX1_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x51 << 1)) ++#define PCIE_PHY_RX1_CDR(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x52 << 1)) ++#define PCIE_PHY_RX1_EI(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x53 << 1)) ++#define PCIE_PHY_RX1_A_CTRL(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x55 << 1)) ++ ++/* Interrupt related stuff */ ++#define PCIE_LEGACY_DISABLE 0 ++#define PCIE_LEGACY_INTA 1 ++#define PCIE_LEGACY_INTB 2 ++#define PCIE_LEGACY_INTC 3 ++#define PCIE_LEGACY_INTD 4 ++#define PCIE_LEGACY_INT_MAX PCIE_LEGACY_INTD ++ ++#endif /* IFXMIPS_PCIE_REG_H */ ++ +--- /dev/null ++++ b/arch/mips/pci/ifxmips_pcie_vr9.h +@@ -0,0 +1,269 @@ ++/**************************************************************************** ++ Copyright (c) 2010 ++ Lantiq Deutschland GmbH ++ Am Campeon 3; 85579 Neubiberg, Germany ++ ++ For licensing information, see the file 'LICENSE' in the root folder of ++ this software module. ++ ++ *****************************************************************************/ ++/*! ++ \file ifxmips_pcie_vr9.h ++ \ingroup IFX_PCIE ++ \brief PCIe RC driver vr9 specific file ++*/ ++ ++#ifndef IFXMIPS_PCIE_VR9_H ++#define IFXMIPS_PCIE_VR9_H ++ ++#include ++#include ++ ++#include ++#include ++ ++#define IFX_PCIE_GPIO_RESET 494 ++ ++#define IFX_REG_R32 ltq_r32 ++#define IFX_REG_W32 ltq_w32 ++#define CONFIG_IFX_PCIE_HW_SWAP ++#define IFX_RCU_AHB_ENDIAN ((volatile u32*)(IFX_RCU + 0x004C)) ++#define IFX_RCU_RST_REQ ((volatile u32*)(IFX_RCU + 0x0010)) ++#define IFX_RCU_AHB_BE_PCIE_PDI 0x00000080 /* Configure PCIE PDI module in big endian*/ ++ ++#define IFX_RCU (KSEG1 | 0x1F203000) ++#define IFX_RCU_AHB_BE_PCIE_M 0x00000001 /* Configure AHB master port that connects to PCIe RC in big endian */ ++#define IFX_RCU_AHB_BE_PCIE_S 0x00000010 /* Configure AHB slave port that connects to PCIe RC in little endian */ ++#define IFX_RCU_AHB_BE_XBAR_M 0x00000002 /* Configure AHB master port that connects to XBAR in big endian */ ++#define CONFIG_IFX_PCIE_PHY_36MHZ_MODE ++ ++#define IFX_PMU1_MODULE_PCIE_PHY (0) ++#define IFX_PMU1_MODULE_PCIE_CTRL (1) ++#define IFX_PMU1_MODULE_PDI (4) ++#define IFX_PMU1_MODULE_MSI (5) ++ ++#define IFX_PMU_MODULE_PCIE_L0_CLK (31) ++ ++ ++#define IFX_GPIO (KSEG1 | 0x1E100B00) ++#define ALT0 ((volatile u32*)(IFX_GPIO + 0x007c)) ++#define ALT1 ((volatile u32*)(IFX_GPIO + 0x0080)) ++#define OD ((volatile u32*)(IFX_GPIO + 0x0084)) ++#define DIR ((volatile u32*)(IFX_GPIO + 0x0078)) ++#define OUT ((volatile u32*)(IFX_GPIO + 0x0070)) ++ ++ ++static inline void pcie_ep_gpio_rst_init(int pcie_port) ++{ ++ ++ gpio_request(IFX_PCIE_GPIO_RESET, "pcie-reset"); ++ gpio_direction_output(IFX_PCIE_GPIO_RESET, 1); ++ gpio_set_value(IFX_PCIE_GPIO_RESET, 1); ++ ++/* ifx_gpio_pin_reserve(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); ++ ifx_gpio_output_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); ++ ifx_gpio_dir_out_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); ++ ifx_gpio_altsel0_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); ++ ifx_gpio_altsel1_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); ++ ifx_gpio_open_drain_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id);*/ ++} ++ ++static inline void pcie_ahb_pmu_setup(void) ++{ ++ /* Enable AHB bus master/slave */ ++ struct clk *clk; ++ clk = clk_get_sys("1d900000.pcie", "ahb"); ++ clk_enable(clk); ++ ++ //AHBM_PMU_SETUP(IFX_PMU_ENABLE); ++ //AHBS_PMU_SETUP(IFX_PMU_ENABLE); ++} ++ ++static inline void pcie_rcu_endian_setup(int pcie_port) ++{ ++ u32 reg; ++ ++ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); ++#ifdef CONFIG_IFX_PCIE_HW_SWAP ++ reg |= IFX_RCU_AHB_BE_PCIE_M; ++ reg |= IFX_RCU_AHB_BE_PCIE_S; ++ reg &= ~IFX_RCU_AHB_BE_XBAR_M; ++#else ++ reg |= IFX_RCU_AHB_BE_PCIE_M; ++ reg &= ~IFX_RCU_AHB_BE_PCIE_S; ++ reg &= ~IFX_RCU_AHB_BE_XBAR_M; ++#endif /* CONFIG_IFX_PCIE_HW_SWAP */ ++ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); ++ IFX_PCIE_PRINT(PCIE_MSG_REG, "%s IFX_RCU_AHB_ENDIAN: 0x%08x\n", __func__, IFX_REG_R32(IFX_RCU_AHB_ENDIAN)); ++} ++ ++static inline void pcie_phy_pmu_enable(int pcie_port) ++{ ++ struct clk *clk; ++ clk = clk_get_sys("1d900000.pcie", "phy"); ++ clk_enable(clk); ++ ++ //PCIE_PHY_PMU_SETUP(IFX_PMU_ENABLE); ++} ++ ++static inline void pcie_phy_pmu_disable(int pcie_port) ++{ ++ struct clk *clk; ++ clk = clk_get_sys("1d900000.pcie", "phy"); ++ clk_disable(clk); ++ ++// PCIE_PHY_PMU_SETUP(IFX_PMU_DISABLE); ++} ++ ++static inline void pcie_pdi_big_endian(int pcie_port) ++{ ++ u32 reg; ++ ++ /* SRAM2PDI endianness control. */ ++ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); ++ /* Config AHB->PCIe and PDI endianness */ ++ reg |= IFX_RCU_AHB_BE_PCIE_PDI; ++ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); ++} ++ ++static inline void pcie_pdi_pmu_enable(int pcie_port) ++{ ++ /* Enable PDI to access PCIe PHY register */ ++ struct clk *clk; ++ clk = clk_get_sys("1d900000.pcie", "pdi"); ++ clk_enable(clk); ++ //PDI_PMU_SETUP(IFX_PMU_ENABLE); ++} ++ ++static inline void pcie_core_rst_assert(int pcie_port) ++{ ++ u32 reg; ++ ++ reg = IFX_REG_R32(IFX_RCU_RST_REQ); ++ ++ /* Reset PCIe PHY & Core, bit 22, bit 26 may be affected if write it directly */ ++ reg |= 0x00400000; ++ IFX_REG_W32(reg, IFX_RCU_RST_REQ); ++} ++ ++static inline void pcie_core_rst_deassert(int pcie_port) ++{ ++ u32 reg; ++ ++ /* Make sure one micro-second delay */ ++ udelay(1); ++ ++ /* Reset PCIe PHY & Core, bit 22 */ ++ reg = IFX_REG_R32(IFX_RCU_RST_REQ); ++ reg &= ~0x00400000; ++ IFX_REG_W32(reg, IFX_RCU_RST_REQ); ++} ++ ++static inline void pcie_phy_rst_assert(int pcie_port) ++{ ++ u32 reg; ++ ++ reg = IFX_REG_R32(IFX_RCU_RST_REQ); ++ reg |= 0x00001000; /* Bit 12 */ ++ IFX_REG_W32(reg, IFX_RCU_RST_REQ); ++} ++ ++static inline void pcie_phy_rst_deassert(int pcie_port) ++{ ++ u32 reg; ++ ++ /* Make sure one micro-second delay */ ++ udelay(1); ++ ++ reg = IFX_REG_R32(IFX_RCU_RST_REQ); ++ reg &= ~0x00001000; /* Bit 12 */ ++ IFX_REG_W32(reg, IFX_RCU_RST_REQ); ++} ++ ++static inline void pcie_device_rst_assert(int pcie_port) ++{ ++ gpio_set_value(IFX_PCIE_GPIO_RESET, 0); ++// ifx_gpio_output_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); ++} ++ ++static inline void pcie_device_rst_deassert(int pcie_port) ++{ ++ mdelay(100); ++ gpio_direction_output(IFX_PCIE_GPIO_RESET, 1); ++// gpio_set_value(IFX_PCIE_GPIO_RESET, 1); ++ //ifx_gpio_output_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); ++} ++ ++static inline void pcie_core_pmu_setup(int pcie_port) ++{ ++ struct clk *clk; ++ clk = clk_get_sys("1d900000.pcie", "ctl"); ++ clk_enable(clk); ++ clk = clk_get_sys("1d900000.pcie", "bus"); ++ clk_enable(clk); ++ ++ /* PCIe Core controller enabled */ ++// PCIE_CTRL_PMU_SETUP(IFX_PMU_ENABLE); ++ ++ /* Enable PCIe L0 Clock */ ++// PCIE_L0_CLK_PMU_SETUP(IFX_PMU_ENABLE); ++} ++ ++static inline void pcie_msi_init(int pcie_port) ++{ ++ struct clk *clk; ++ pcie_msi_pic_init(pcie_port); ++ clk = clk_get_sys("ltq_pcie", "msi"); ++ clk_enable(clk); ++// MSI_PMU_SETUP(IFX_PMU_ENABLE); ++} ++ ++static inline u32 ++ifx_pcie_bus_nr_deduct(u32 bus_number, int pcie_port) ++{ ++ u32 tbus_number = bus_number; ++ ++#ifdef CONFIG_PCI_LANTIQ ++ if (pcibios_host_nr() > 1) { ++ tbus_number -= pcibios_1st_host_bus_nr(); ++ } ++#endif /* CONFIG_PCI_LANTIQ */ ++ return tbus_number; ++} ++ ++static inline u32 ++ifx_pcie_bus_enum_hack(struct pci_bus *bus, u32 devfn, int where, u32 value, int pcie_port, int read) ++{ ++ struct pci_dev *pdev; ++ u32 tvalue = value; ++ ++ /* Sanity check */ ++ pdev = pci_get_slot(bus, devfn); ++ if (pdev == NULL) { ++ return tvalue; ++ } ++ ++ /* Only care about PCI bridge */ ++ if (pdev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { ++ return tvalue; ++ } ++ ++ if (read) { /* Read hack */ ++ #ifdef CONFIG_PCI_LANTIQ ++ if (pcibios_host_nr() > 1) { ++ tvalue = ifx_pcie_bus_enum_read_hack(where, tvalue); ++ } ++ #endif /* CONFIG_PCI_LANTIQ */ ++ } ++ else { /* Write hack */ ++ #ifdef CONFIG_PCI_LANTIQ ++ if (pcibios_host_nr() > 1) { ++ tvalue = ifx_pcie_bus_enum_write_hack(where, tvalue); ++ } ++ #endif ++ } ++ return tvalue; ++} ++ ++#endif /* IFXMIPS_PCIE_VR9_H */ ++ +--- a/arch/mips/pci/pci-legacy.c ++++ b/arch/mips/pci/pci-legacy.c +@@ -300,3 +300,30 @@ char *__init pcibios_setup(char *str) + return pcibios_plat_setup(str); + return str; + } ++ ++int pcibios_host_nr(void) ++{ ++ int count = 0; ++ struct pci_controller *hose; ++ list_for_each_entry(hose, &controllers, list) { ++ count++; ++ } ++ return count; ++} ++EXPORT_SYMBOL(pcibios_host_nr); ++ ++int pcibios_1st_host_bus_nr(void) ++{ ++ int bus_nr = 0; ++ struct pci_controller *hose; ++ ++ hose = list_first_entry_or_null(&controllers, struct pci_controller, list); ++ ++ if (hose != NULL) { ++ if (hose->bus != NULL) { ++ bus_nr = hose->bus->number + 1; ++ } ++ } ++ return bus_nr; ++} ++EXPORT_SYMBOL(pcibios_1st_host_bus_nr); +--- /dev/null ++++ b/arch/mips/pci/pcie-lantiq.h +@@ -0,0 +1,1305 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifxmips_pcie_reg.h ++** PROJECT : IFX UEIP for VRX200 ++** MODULES : PCIe module ++** ++** DATE : 02 Mar 2009 ++** AUTHOR : Lei Chuanhua ++** DESCRIPTION : PCIe Root Complex Driver ++** COPYRIGHT : Copyright (c) 2009 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** HISTORY ++** $Version $Date $Author $Comment ++** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version ++*******************************************************************************/ ++#ifndef IFXMIPS_PCIE_REG_H ++#define IFXMIPS_PCIE_REG_H ++#include ++#include ++#include ++#include ++/*! ++ \file ifxmips_pcie_reg.h ++ \ingroup IFX_PCIE ++ \brief header file for PCIe module register definition ++*/ ++/* PCIe Address Mapping Base */ ++#define PCIE_CFG_PHY_BASE 0x1D000000UL ++#define PCIE_CFG_BASE (KSEG1 + PCIE_CFG_PHY_BASE) ++#define PCIE_CFG_SIZE (8 * 1024 * 1024) ++ ++#define PCIE_MEM_PHY_BASE 0x1C000000UL ++#define PCIE_MEM_BASE (KSEG1 + PCIE_MEM_PHY_BASE) ++#define PCIE_MEM_SIZE (16 * 1024 * 1024) ++#define PCIE_MEM_PHY_END (PCIE_MEM_PHY_BASE + PCIE_MEM_SIZE - 1) ++ ++#define PCIE_IO_PHY_BASE 0x1D800000UL ++#define PCIE_IO_BASE (KSEG1 + PCIE_IO_PHY_BASE) ++#define PCIE_IO_SIZE (1 * 1024 * 1024) ++#define PCIE_IO_PHY_END (PCIE_IO_PHY_BASE + PCIE_IO_SIZE - 1) ++ ++#define PCIE_RC_CFG_BASE (KSEG1 + 0x1D900000) ++#define PCIE_APP_LOGIC_REG (KSEG1 + 0x1E100900) ++#define PCIE_MSI_PHY_BASE 0x1F600000UL ++ ++#define PCIE_PDI_PHY_BASE 0x1F106800UL ++#define PCIE_PDI_BASE (KSEG1 + PCIE_PDI_PHY_BASE) ++#define PCIE_PDI_SIZE 0x400 ++ ++#define PCIE1_CFG_PHY_BASE 0x19000000UL ++#define PCIE1_CFG_BASE (KSEG1 + PCIE1_CFG_PHY_BASE) ++#define PCIE1_CFG_SIZE (8 * 1024 * 1024) ++ ++#define PCIE1_MEM_PHY_BASE 0x18000000UL ++#define PCIE1_MEM_BASE (KSEG1 + PCIE1_MEM_PHY_BASE) ++#define PCIE1_MEM_SIZE (16 * 1024 * 1024) ++#define PCIE1_MEM_PHY_END (PCIE1_MEM_PHY_BASE + PCIE1_MEM_SIZE - 1) ++ ++#define PCIE1_IO_PHY_BASE 0x19800000UL ++#define PCIE1_IO_BASE (KSEG1 + PCIE1_IO_PHY_BASE) ++#define PCIE1_IO_SIZE (1 * 1024 * 1024) ++#define PCIE1_IO_PHY_END (PCIE1_IO_PHY_BASE + PCIE1_IO_SIZE - 1) ++ ++#define PCIE1_RC_CFG_BASE (KSEG1 + 0x19900000) ++#define PCIE1_APP_LOGIC_REG (KSEG1 + 0x1E100700) ++#define PCIE1_MSI_PHY_BASE 0x1F400000UL ++ ++#define PCIE1_PDI_PHY_BASE 0x1F700400UL ++#define PCIE1_PDI_BASE (KSEG1 + PCIE1_PDI_PHY_BASE) ++#define PCIE1_PDI_SIZE 0x400 ++ ++#define PCIE_CFG_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_CFG_BASE) : (PCIE_CFG_BASE)) ++#define PCIE_MEM_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_MEM_BASE) : (PCIE_MEM_BASE)) ++#define PCIE_IO_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_IO_BASE) : (PCIE_IO_BASE)) ++#define PCIE_MEM_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_MEM_PHY_BASE) : (PCIE_MEM_PHY_BASE)) ++#define PCIE_MEM_PHY_PORT_TO_END(X) ((X) > 0 ? (PCIE1_MEM_PHY_END) : (PCIE_MEM_PHY_END)) ++#define PCIE_IO_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_IO_PHY_BASE) : (PCIE_IO_PHY_BASE)) ++#define PCIE_IO_PHY_PORT_TO_END(X) ((X) > 0 ? (PCIE1_IO_PHY_END) : (PCIE_IO_PHY_END)) ++#define PCIE_APP_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_APP_LOGIC_REG) : (PCIE_APP_LOGIC_REG)) ++#define PCIE_RC_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_RC_CFG_BASE) : (PCIE_RC_CFG_BASE)) ++#define PCIE_PHY_PORT_TO_BASE(X) ((X) > 0 ? (PCIE1_PDI_BASE) : (PCIE_PDI_BASE)) ++ ++/* PCIe Application Logic Register */ ++/* RC Core Control Register */ ++#define PCIE_RC_CCR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x10) ++/* This should be enabled after initializing configuratin registers ++ * Also should check link status retraining bit ++ */ ++#define PCIE_RC_CCR_LTSSM_ENABLE 0x00000001 /* Enable LTSSM to continue link establishment */ ++ ++/* RC Core Debug Register */ ++#define PCIE_RC_DR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x14) ++#define PCIE_RC_DR_DLL_UP 0x00000001 /* Data Link Layer Up */ ++#define PCIE_RC_DR_CURRENT_POWER_STATE 0x0000000E /* Current Power State */ ++#define PCIE_RC_DR_CURRENT_POWER_STATE_S 1 ++#define PCIE_RC_DR_CURRENT_LTSSM_STATE 0x000001F0 /* Current LTSSM State */ ++#define PCIE_RC_DR_CURRENT_LTSSM_STATE_S 4 ++ ++#define PCIE_RC_DR_PM_DEV_STATE 0x00000E00 /* Power Management D-State */ ++#define PCIE_RC_DR_PM_DEV_STATE_S 9 ++ ++#define PCIE_RC_DR_PM_ENABLED 0x00001000 /* Power Management State from PMU */ ++#define PCIE_RC_DR_PME_EVENT_ENABLED 0x00002000 /* Power Management Event Enable State */ ++#define PCIE_RC_DR_AUX_POWER_ENABLED 0x00004000 /* Auxiliary Power Enable */ ++ ++/* Current Power State Definition */ ++enum { ++ PCIE_RC_DR_D0 = 0, ++ PCIE_RC_DR_D1, /* Not supported */ ++ PCIE_RC_DR_D2, /* Not supported */ ++ PCIE_RC_DR_D3, ++ PCIE_RC_DR_UN, ++}; ++ ++/* PHY Link Status Register */ ++#define PCIE_PHY_SR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x18) ++#define PCIE_PHY_SR_PHY_LINK_UP 0x00000001 /* PHY Link Up/Down Indicator */ ++ ++/* Electromechanical Control Register */ ++#define PCIE_EM_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x1C) ++#define PCIE_EM_CR_CARD_IS_PRESENT 0x00000001 /* Card Presence Detect State */ ++#define PCIE_EM_CR_MRL_OPEN 0x00000002 /* MRL Sensor State */ ++#define PCIE_EM_CR_POWER_FAULT_SET 0x00000004 /* Power Fault Detected */ ++#define PCIE_EM_CR_MRL_SENSOR_SET 0x00000008 /* MRL Sensor Changed */ ++#define PCIE_EM_CR_PRESENT_DETECT_SET 0x00000010 /* Card Presense Detect Changed */ ++#define PCIE_EM_CR_CMD_CPL_INT_SET 0x00000020 /* Command Complete Interrupt */ ++#define PCIE_EM_CR_SYS_INTERLOCK_SET 0x00000040 /* System Electromechanical IterLock Engaged */ ++#define PCIE_EM_CR_ATTENTION_BUTTON_SET 0x00000080 /* Attention Button Pressed */ ++ ++/* Interrupt Status Register */ ++#define PCIE_IR_SR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x20) ++#define PCIE_IR_SR_PME_CAUSE_MSI 0x00000002 /* MSI caused by PME */ ++#define PCIE_IR_SR_HP_PME_WAKE_GEN 0x00000004 /* Hotplug PME Wake Generation */ ++#define PCIE_IR_SR_HP_MSI 0x00000008 /* Hotplug MSI */ ++#define PCIE_IR_SR_AHB_LU_ERR 0x00000030 /* AHB Bridge Lookup Error Signals */ ++#define PCIE_IR_SR_AHB_LU_ERR_S 4 ++#define PCIE_IR_SR_INT_MSG_NUM 0x00003E00 /* Interrupt Message Number */ ++#define PCIE_IR_SR_INT_MSG_NUM_S 9 ++#define PCIE_IR_SR_AER_INT_MSG_NUM 0xF8000000 /* Advanced Error Interrupt Message Number */ ++#define PCIE_IR_SR_AER_INT_MSG_NUM_S 27 ++ ++/* Message Control Register */ ++#define PCIE_MSG_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x30) ++#define PCIE_MSG_CR_GEN_PME_TURN_OFF_MSG 0x00000001 /* Generate PME Turn Off Message */ ++#define PCIE_MSG_CR_GEN_UNLOCK_MSG 0x00000002 /* Generate Unlock Message */ ++ ++#define PCIE_VDM_DR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x34) ++ ++/* Vendor-Defined Message Requester ID Register */ ++#define PCIE_VDM_RID(X) (PCIE_APP_PORT_TO_BASE (X) + 0x38) ++#define PCIE_VDM_RID_VENROR_MSG_REQ_ID 0x0000FFFF ++#define PCIE_VDM_RID_VDMRID_S 0 ++ ++/* ASPM Control Register */ ++#define PCIE_ASPM_CR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x40) ++#define PCIE_ASPM_CR_HOT_RST 0x00000001 /* Hot Reset Request to the downstream device */ ++#define PCIE_ASPM_CR_REQ_EXIT_L1 0x00000002 /* Request to Exit L1 */ ++#define PCIE_ASPM_CR_REQ_ENTER_L1 0x00000004 /* Request to Enter L1 */ ++ ++/* Vendor Message DW0 Register */ ++#define PCIE_VM_MSG_DW0(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x50) ++#define PCIE_VM_MSG_DW0_TYPE 0x0000001F /* Message type */ ++#define PCIE_VM_MSG_DW0_TYPE_S 0 ++#define PCIE_VM_MSG_DW0_FORMAT 0x00000060 /* Format */ ++#define PCIE_VM_MSG_DW0_FORMAT_S 5 ++#define PCIE_VM_MSG_DW0_TC 0x00007000 /* Traffic Class */ ++#define PCIE_VM_MSG_DW0_TC_S 12 ++#define PCIE_VM_MSG_DW0_ATTR 0x000C0000 /* Atrributes */ ++#define PCIE_VM_MSG_DW0_ATTR_S 18 ++#define PCIE_VM_MSG_DW0_EP_TLP 0x00100000 /* Poisoned TLP */ ++#define PCIE_VM_MSG_DW0_TD 0x00200000 /* TLP Digest */ ++#define PCIE_VM_MSG_DW0_LEN 0xFFC00000 /* Length */ ++#define PCIE_VM_MSG_DW0_LEN_S 22 ++ ++/* Format Definition */ ++enum { ++ PCIE_VM_MSG_FORMAT_00 = 0, /* 3DW Hdr, no data*/ ++ PCIE_VM_MSG_FORMAT_01, /* 4DW Hdr, no data */ ++ PCIE_VM_MSG_FORMAT_10, /* 3DW Hdr, with data */ ++ PCIE_VM_MSG_FORMAT_11, /* 4DW Hdr, with data */ ++}; ++ ++/* Traffic Class Definition */ ++enum { ++ PCIE_VM_MSG_TC0 = 0, ++ PCIE_VM_MSG_TC1, ++ PCIE_VM_MSG_TC2, ++ PCIE_VM_MSG_TC3, ++ PCIE_VM_MSG_TC4, ++ PCIE_VM_MSG_TC5, ++ PCIE_VM_MSG_TC6, ++ PCIE_VM_MSG_TC7, ++}; ++ ++/* Attributes Definition */ ++enum { ++ PCIE_VM_MSG_ATTR_00 = 0, /* RO and No Snoop cleared */ ++ PCIE_VM_MSG_ATTR_01, /* RO cleared , No Snoop set */ ++ PCIE_VM_MSG_ATTR_10, /* RO set, No Snoop cleared*/ ++ PCIE_VM_MSG_ATTR_11, /* RO and No Snoop set */ ++}; ++ ++/* Payload Size Definition */ ++#define PCIE_VM_MSG_LEN_MIN 0 ++#define PCIE_VM_MSG_LEN_MAX 1024 ++ ++/* Vendor Message DW1 Register */ ++#define PCIE_VM_MSG_DW1(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x54) ++#define PCIE_VM_MSG_DW1_FUNC_NUM 0x00000070 /* Function Number */ ++#define PCIE_VM_MSG_DW1_FUNC_NUM_S 8 ++#define PCIE_VM_MSG_DW1_CODE 0x00FF0000 /* Message Code */ ++#define PCIE_VM_MSG_DW1_CODE_S 16 ++#define PCIE_VM_MSG_DW1_TAG 0xFF000000 /* Tag */ ++#define PCIE_VM_MSG_DW1_TAG_S 24 ++ ++#define PCIE_VM_MSG_DW2(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x58) ++#define PCIE_VM_MSG_DW3(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x5C) ++ ++/* Vendor Message Request Register */ ++#define PCIE_VM_MSG_REQR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x60) ++#define PCIE_VM_MSG_REQR_REQ 0x00000001 /* Vendor Message Request */ ++ ++ ++/* AHB Slave Side Band Control Register */ ++#define PCIE_AHB_SSB(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x70) ++#define PCIE_AHB_SSB_REQ_BCM 0x00000001 /* Slave Reques BCM filed */ ++#define PCIE_AHB_SSB_REQ_EP 0x00000002 /* Slave Reques EP filed */ ++#define PCIE_AHB_SSB_REQ_TD 0x00000004 /* Slave Reques TD filed */ ++#define PCIE_AHB_SSB_REQ_ATTR 0x00000018 /* Slave Reques Attribute number */ ++#define PCIE_AHB_SSB_REQ_ATTR_S 3 ++#define PCIE_AHB_SSB_REQ_TC 0x000000E0 /* Slave Request TC Field */ ++#define PCIE_AHB_SSB_REQ_TC_S 5 ++ ++/* AHB Master SideBand Ctrl Register */ ++#define PCIE_AHB_MSB(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x74) ++#define PCIE_AHB_MSB_RESP_ATTR 0x00000003 /* Master Response Attribute number */ ++#define PCIE_AHB_MSB_RESP_ATTR_S 0 ++#define PCIE_AHB_MSB_RESP_BAD_EOT 0x00000004 /* Master Response Badeot filed */ ++#define PCIE_AHB_MSB_RESP_BCM 0x00000008 /* Master Response BCM filed */ ++#define PCIE_AHB_MSB_RESP_EP 0x00000010 /* Master Response EP filed */ ++#define PCIE_AHB_MSB_RESP_TD 0x00000020 /* Master Response TD filed */ ++#define PCIE_AHB_MSB_RESP_FUN_NUM 0x000003C0 /* Master Response Function number */ ++#define PCIE_AHB_MSB_RESP_FUN_NUM_S 6 ++ ++/* AHB Control Register, fixed bus enumeration exception */ ++#define PCIE_AHB_CTRL(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0x78) ++#define PCIE_AHB_CTRL_BUS_ERROR_SUPPRESS 0x00000001 ++ ++/* Interrupt Enalbe Register */ ++#define PCIE_IRNEN(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xF4) ++#define PCIE_IRNCR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xF8) ++#define PCIE_IRNICR(X) (volatile u32*)(PCIE_APP_PORT_TO_BASE(X) + 0xFC) ++ ++/* PCIe interrupt enable/control/capture register definition */ ++#define PCIE_IRN_AER_REPORT 0x00000001 /* AER Interrupt */ ++#define PCIE_IRN_AER_MSIX 0x00000002 /* Advanced Error MSI-X Interrupt */ ++#define PCIE_IRN_PME 0x00000004 /* PME Interrupt */ ++#define PCIE_IRN_HOTPLUG 0x00000008 /* Hotplug Interrupt */ ++#define PCIE_IRN_RX_VDM_MSG 0x00000010 /* Vendor-Defined Message Interrupt */ ++#define PCIE_IRN_RX_CORRECTABLE_ERR_MSG 0x00000020 /* Correctable Error Message Interrupt */ ++#define PCIE_IRN_RX_NON_FATAL_ERR_MSG 0x00000040 /* Non-fatal Error Message */ ++#define PCIE_IRN_RX_FATAL_ERR_MSG 0x00000080 /* Fatal Error Message */ ++#define PCIE_IRN_RX_PME_MSG 0x00000100 /* PME Message Interrupt */ ++#define PCIE_IRN_RX_PME_TURNOFF_ACK 0x00000200 /* PME Turnoff Ack Message Interrupt */ ++#define PCIE_IRN_AHB_BR_FATAL_ERR 0x00000400 /* AHB Fatal Error Interrupt */ ++#define PCIE_IRN_LINK_AUTO_BW_STATUS 0x00000800 /* Link Auto Bandwidth Status Interrupt */ ++#define PCIE_IRN_BW_MGT 0x00001000 /* Bandwidth Managment Interrupt */ ++#define PCIE_IRN_INTA 0x00002000 /* INTA */ ++#define PCIE_IRN_INTB 0x00004000 /* INTB */ ++#define PCIE_IRN_INTC 0x00008000 /* INTC */ ++#define PCIE_IRN_INTD 0x00010000 /* INTD */ ++#define PCIE_IRN_WAKEUP 0x00020000 /* Wake up Interrupt */ ++ ++#define PCIE_RC_CORE_COMBINED_INT (PCIE_IRN_AER_REPORT | PCIE_IRN_AER_MSIX | PCIE_IRN_PME | \ ++ PCIE_IRN_HOTPLUG | PCIE_IRN_RX_VDM_MSG | PCIE_IRN_RX_CORRECTABLE_ERR_MSG |\ ++ PCIE_IRN_RX_NON_FATAL_ERR_MSG | PCIE_IRN_RX_FATAL_ERR_MSG | \ ++ PCIE_IRN_RX_PME_MSG | PCIE_IRN_RX_PME_TURNOFF_ACK | PCIE_IRN_AHB_BR_FATAL_ERR | \ ++ PCIE_IRN_LINK_AUTO_BW_STATUS | PCIE_IRN_BW_MGT) ++/* PCIe RC Configuration Register */ ++#define PCIE_VDID(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x00) ++ ++/* Bit definition from pci_reg.h */ ++#define PCIE_PCICMDSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x04) ++#define PCIE_CCRID(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x08) ++#define PCIE_CLSLTHTBR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x0C) /* EP only */ ++/* BAR0, BAR1,Only necessary if the bridges implements a device-specific register set or memory buffer */ ++#define PCIE_BAR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x10) /* Not used*/ ++#define PCIE_BAR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x14) /* Not used */ ++ ++#define PCIE_BNR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x18) /* Mandatory */ ++/* Bus Number Register bits */ ++#define PCIE_BNR_PRIMARY_BUS_NUM 0x000000FF ++#define PCIE_BNR_PRIMARY_BUS_NUM_S 0 ++#define PCIE_PNR_SECONDARY_BUS_NUM 0x0000FF00 ++#define PCIE_PNR_SECONDARY_BUS_NUM_S 8 ++#define PCIE_PNR_SUB_BUS_NUM 0x00FF0000 ++#define PCIE_PNR_SUB_BUS_NUM_S 16 ++ ++/* IO Base/Limit Register bits */ ++#define PCIE_IOBLSECS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x1C) /* RC only */ ++#define PCIE_IOBLSECS_32BIT_IO_ADDR 0x00000001 ++#define PCIE_IOBLSECS_IO_BASE_ADDR 0x000000F0 ++#define PCIE_IOBLSECS_IO_BASE_ADDR_S 4 ++#define PCIE_IOBLSECS_32BIT_IOLIMT 0x00000100 ++#define PCIE_IOBLSECS_IO_LIMIT_ADDR 0x0000F000 ++#define PCIE_IOBLSECS_IO_LIMIT_ADDR_S 12 ++ ++/* Non-prefetchable Memory Base/Limit Register bit */ ++#define PCIE_MBML(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x20) /* RC only */ ++#define PCIE_MBML_MEM_BASE_ADDR 0x0000FFF0 ++#define PCIE_MBML_MEM_BASE_ADDR_S 4 ++#define PCIE_MBML_MEM_LIMIT_ADDR 0xFFF00000 ++#define PCIE_MBML_MEM_LIMIT_ADDR_S 20 ++ ++/* Prefetchable Memory Base/Limit Register bit */ ++#define PCIE_PMBL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x24) /* RC only */ ++#define PCIE_PMBL_64BIT_ADDR 0x00000001 ++#define PCIE_PMBL_UPPER_12BIT 0x0000FFF0 ++#define PCIE_PMBL_UPPER_12BIT_S 4 ++#define PCIE_PMBL_E64MA 0x00010000 ++#define PCIE_PMBL_END_ADDR 0xFFF00000 ++#define PCIE_PMBL_END_ADDR_S 20 ++#define PCIE_PMBU32(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x28) /* RC only */ ++#define PCIE_PMLU32(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x2C) /* RC only */ ++ ++/* I/O Base/Limit Upper 16 bits register */ ++#define PCIE_IO_BANDL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x30) /* RC only */ ++#define PCIE_IO_BANDL_UPPER_16BIT_IO_BASE 0x0000FFFF ++#define PCIE_IO_BANDL_UPPER_16BIT_IO_BASE_S 0 ++#define PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT 0xFFFF0000 ++#define PCIE_IO_BANDL_UPPER_16BIT_IO_LIMIT_S 16 ++ ++#define PCIE_CPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x34) ++#define PCIE_EBBAR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x38) ++ ++/* Interrupt and Secondary Bridge Control Register */ ++#define PCIE_INTRBCTRL(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x3C) ++ ++#define PCIE_INTRBCTRL_INT_LINE 0x000000FF ++#define PCIE_INTRBCTRL_INT_LINE_S 0 ++#define PCIE_INTRBCTRL_INT_PIN 0x0000FF00 ++#define PCIE_INTRBCTRL_INT_PIN_S 8 ++#define PCIE_INTRBCTRL_PARITY_ERR_RESP_ENABLE 0x00010000 /* #PERR */ ++#define PCIE_INTRBCTRL_SERR_ENABLE 0x00020000 /* #SERR */ ++#define PCIE_INTRBCTRL_ISA_ENABLE 0x00040000 /* ISA enable, IO 64KB only */ ++#define PCIE_INTRBCTRL_VGA_ENABLE 0x00080000 /* VGA enable */ ++#define PCIE_INTRBCTRL_VGA_16BIT_DECODE 0x00100000 /* VGA 16bit decode */ ++#define PCIE_INTRBCTRL_RST_SECONDARY_BUS 0x00400000 /* Secondary bus rest, hot rest, 1ms */ ++/* Others are read only */ ++enum { ++ PCIE_INTRBCTRL_INT_NON = 0, ++ PCIE_INTRBCTRL_INTA, ++ PCIE_INTRBCTRL_INTB, ++ PCIE_INTRBCTRL_INTC, ++ PCIE_INTRBCTRL_INTD, ++}; ++ ++#define PCIE_PM_CAPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x40) ++ ++/* Power Management Control and Status Register */ ++#define PCIE_PM_CSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x44) ++ ++#define PCIE_PM_CSR_POWER_STATE 0x00000003 /* Power State */ ++#define PCIE_PM_CSR_POWER_STATE_S 0 ++#define PCIE_PM_CSR_SW_RST 0x00000008 /* Soft Reset Enabled */ ++#define PCIE_PM_CSR_PME_ENABLE 0x00000100 /* PME Enable */ ++#define PCIE_PM_CSR_PME_STATUS 0x00008000 /* PME status */ ++ ++/* MSI Capability Register for EP */ ++#define PCIE_MCAPR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x50) ++ ++#define PCIE_MCAPR_MSI_CAP_ID 0x000000FF /* MSI Capability ID */ ++#define PCIE_MCAPR_MSI_CAP_ID_S 0 ++#define PCIE_MCAPR_MSI_NEXT_CAP_PTR 0x0000FF00 /* Next Capability Pointer */ ++#define PCIE_MCAPR_MSI_NEXT_CAP_PTR_S 8 ++#define PCIE_MCAPR_MSI_ENABLE 0x00010000 /* MSI Enable */ ++#define PCIE_MCAPR_MULTI_MSG_CAP 0x000E0000 /* Multiple Message Capable */ ++#define PCIE_MCAPR_MULTI_MSG_CAP_S 17 ++#define PCIE_MCAPR_MULTI_MSG_ENABLE 0x00700000 /* Multiple Message Enable */ ++#define PCIE_MCAPR_MULTI_MSG_ENABLE_S 20 ++#define PCIE_MCAPR_ADDR64_CAP 0X00800000 /* 64-bit Address Capable */ ++ ++/* MSI Message Address Register */ ++#define PCIE_MA(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x54) ++ ++#define PCIE_MA_ADDR_MASK 0xFFFFFFFC /* Message Address */ ++ ++/* MSI Message Upper Address Register */ ++#define PCIE_MUA(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x58) ++ ++/* MSI Message Data Register */ ++#define PCIE_MD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x5C) ++ ++#define PCIE_MD_DATA 0x0000FFFF /* Message Data */ ++#define PCIE_MD_DATA_S 0 ++ ++/* PCI Express Capability Register */ ++#define PCIE_XCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x70) ++ ++#define PCIE_XCAP_ID 0x000000FF /* PCI Express Capability ID */ ++#define PCIE_XCAP_ID_S 0 ++#define PCIE_XCAP_NEXT_CAP 0x0000FF00 /* Next Capability Pointer */ ++#define PCIE_XCAP_NEXT_CAP_S 8 ++#define PCIE_XCAP_VER 0x000F0000 /* PCI Express Capability Version */ ++#define PCIE_XCAP_VER_S 16 ++#define PCIE_XCAP_DEV_PORT_TYPE 0x00F00000 /* Device Port Type */ ++#define PCIE_XCAP_DEV_PORT_TYPE_S 20 ++#define PCIE_XCAP_SLOT_IMPLEMENTED 0x01000000 /* Slot Implemented */ ++#define PCIE_XCAP_MSG_INT_NUM 0x3E000000 /* Interrupt Message Number */ ++#define PCIE_XCAP_MSG_INT_NUM_S 25 ++ ++/* Device Capability Register */ ++#define PCIE_DCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x74) ++ ++#define PCIE_DCAP_MAX_PAYLOAD_SIZE 0x00000007 /* Max Payload size */ ++#define PCIE_DCAP_MAX_PAYLOAD_SIZE_S 0 ++#define PCIE_DCAP_PHANTOM_FUNC 0x00000018 /* Phanton Function, not supported */ ++#define PCIE_DCAP_PHANTOM_FUNC_S 3 ++#define PCIE_DCAP_EXT_TAG 0x00000020 /* Extended Tag Field */ ++#define PCIE_DCAP_EP_L0S_LATENCY 0x000001C0 /* EP L0s latency only */ ++#define PCIE_DCAP_EP_L0S_LATENCY_S 6 ++#define PCIE_DCAP_EP_L1_LATENCY 0x00000E00 /* EP L1 latency only */ ++#define PCIE_DCAP_EP_L1_LATENCY_S 9 ++#define PCIE_DCAP_ROLE_BASE_ERR_REPORT 0x00008000 /* Role Based ERR */ ++ ++/* Maximum payload size supported */ ++enum { ++ PCIE_MAX_PAYLOAD_128 = 0, ++ PCIE_MAX_PAYLOAD_256, ++ PCIE_MAX_PAYLOAD_512, ++ PCIE_MAX_PAYLOAD_1024, ++ PCIE_MAX_PAYLOAD_2048, ++ PCIE_MAX_PAYLOAD_4096, ++}; ++ ++/* Device Control and Status Register */ ++#define PCIE_DCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x78) ++ ++#define PCIE_DCTLSTS_CORRECTABLE_ERR_EN 0x00000001 /* COR-ERR */ ++#define PCIE_DCTLSTS_NONFATAL_ERR_EN 0x00000002 /* Non-fatal ERR */ ++#define PCIE_DCTLSTS_FATAL_ERR_EN 0x00000004 /* Fatal ERR */ ++#define PCIE_DCTLSYS_UR_REQ_EN 0x00000008 /* UR ERR */ ++#define PCIE_DCTLSTS_RELAXED_ORDERING_EN 0x00000010 /* Enable relaxing ordering */ ++#define PCIE_DCTLSTS_MAX_PAYLOAD_SIZE 0x000000E0 /* Max payload mask */ ++#define PCIE_DCTLSTS_MAX_PAYLOAD_SIZE_S 5 ++#define PCIE_DCTLSTS_EXT_TAG_EN 0x00000100 /* Extended tag field */ ++#define PCIE_DCTLSTS_PHANTOM_FUNC_EN 0x00000200 /* Phantom Function Enable */ ++#define PCIE_DCTLSTS_AUX_PM_EN 0x00000400 /* AUX Power PM Enable */ ++#define PCIE_DCTLSTS_NO_SNOOP_EN 0x00000800 /* Enable no snoop, except root port*/ ++#define PCIE_DCTLSTS_MAX_READ_SIZE 0x00007000 /* Max Read Request size*/ ++#define PCIE_DCTLSTS_MAX_READ_SIZE_S 12 ++#define PCIE_DCTLSTS_CORRECTABLE_ERR 0x00010000 /* COR-ERR Detected */ ++#define PCIE_DCTLSTS_NONFATAL_ERR 0x00020000 /* Non-Fatal ERR Detected */ ++#define PCIE_DCTLSTS_FATAL_ER 0x00040000 /* Fatal ERR Detected */ ++#define PCIE_DCTLSTS_UNSUPPORTED_REQ 0x00080000 /* UR Detected */ ++#define PCIE_DCTLSTS_AUX_POWER 0x00100000 /* Aux Power Detected */ ++#define PCIE_DCTLSTS_TRANSACT_PENDING 0x00200000 /* Transaction pending */ ++ ++#define PCIE_DCTLSTS_ERR_EN (PCIE_DCTLSTS_CORRECTABLE_ERR_EN | \ ++ PCIE_DCTLSTS_NONFATAL_ERR_EN | PCIE_DCTLSTS_FATAL_ERR_EN | \ ++ PCIE_DCTLSYS_UR_REQ_EN) ++ ++/* Link Capability Register */ ++#define PCIE_LCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7C) ++#define PCIE_LCAP_MAX_LINK_SPEED 0x0000000F /* Max link speed, 0x1 by default */ ++#define PCIE_LCAP_MAX_LINK_SPEED_S 0 ++#define PCIE_LCAP_MAX_LENGTH_WIDTH 0x000003F0 /* Maxium Length Width */ ++#define PCIE_LCAP_MAX_LENGTH_WIDTH_S 4 ++#define PCIE_LCAP_ASPM_LEVEL 0x00000C00 /* Active State Link PM Support */ ++#define PCIE_LCAP_ASPM_LEVEL_S 10 ++#define PCIE_LCAP_L0S_EIXT_LATENCY 0x00007000 /* L0s Exit Latency */ ++#define PCIE_LCAP_L0S_EIXT_LATENCY_S 12 ++#define PCIE_LCAP_L1_EXIT_LATENCY 0x00038000 /* L1 Exit Latency */ ++#define PCIE_LCAP_L1_EXIT_LATENCY_S 15 ++#define PCIE_LCAP_CLK_PM 0x00040000 /* Clock Power Management */ ++#define PCIE_LCAP_SDER 0x00080000 /* Surprise Down Error Reporting */ ++#define PCIE_LCAP_DLL_ACTIVE_REPROT 0x00100000 /* Data Link Layer Active Reporting Capable */ ++#define PCIE_LCAP_PORT_NUM 0xFF0000000 /* Port number */ ++#define PCIE_LCAP_PORT_NUM_S 24 ++ ++/* Maximum Length width definition */ ++#define PCIE_MAX_LENGTH_WIDTH_RES 0x00 ++#define PCIE_MAX_LENGTH_WIDTH_X1 0x01 /* Default */ ++#define PCIE_MAX_LENGTH_WIDTH_X2 0x02 ++#define PCIE_MAX_LENGTH_WIDTH_X4 0x04 ++#define PCIE_MAX_LENGTH_WIDTH_X8 0x08 ++#define PCIE_MAX_LENGTH_WIDTH_X12 0x0C ++#define PCIE_MAX_LENGTH_WIDTH_X16 0x10 ++#define PCIE_MAX_LENGTH_WIDTH_X32 0x20 ++ ++/* Active State Link PM definition */ ++enum { ++ PCIE_ASPM_RES0 = 0, ++ PCIE_ASPM_L0S_ENTRY_SUPPORT, /* L0s */ ++ PCIE_ASPM_RES1, ++ PCIE_ASPM_L0S_L1_ENTRY_SUPPORT, /* L0s and L1, default */ ++}; ++ ++/* L0s Exit Latency definition */ ++enum { ++ PCIE_L0S_EIXT_LATENCY_L64NS = 0, /* < 64 ns */ ++ PCIE_L0S_EIXT_LATENCY_B64A128, /* > 64 ns < 128 ns */ ++ PCIE_L0S_EIXT_LATENCY_B128A256, /* > 128 ns < 256 ns */ ++ PCIE_L0S_EIXT_LATENCY_B256A512, /* > 256 ns < 512 ns */ ++ PCIE_L0S_EIXT_LATENCY_B512TO1U, /* > 512 ns < 1 us */ ++ PCIE_L0S_EIXT_LATENCY_B1A2U, /* > 1 us < 2 us */ ++ PCIE_L0S_EIXT_LATENCY_B2A4U, /* > 2 us < 4 us */ ++ PCIE_L0S_EIXT_LATENCY_M4US, /* > 4 us */ ++}; ++ ++/* L1 Exit Latency definition */ ++enum { ++ PCIE_L1_EXIT_LATENCY_L1US = 0, /* < 1 us */ ++ PCIE_L1_EXIT_LATENCY_B1A2, /* > 1 us < 2 us */ ++ PCIE_L1_EXIT_LATENCY_B2A4, /* > 2 us < 4 us */ ++ PCIE_L1_EXIT_LATENCY_B4A8, /* > 4 us < 8 us */ ++ PCIE_L1_EXIT_LATENCY_B8A16, /* > 8 us < 16 us */ ++ PCIE_L1_EXIT_LATENCY_B16A32, /* > 16 us < 32 us */ ++ PCIE_L1_EXIT_LATENCY_B32A64, /* > 32 us < 64 us */ ++ PCIE_L1_EXIT_LATENCY_M64US, /* > 64 us */ ++}; ++ ++/* Link Control and Status Register */ ++#define PCIE_LCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x80) ++#define PCIE_LCTLSTS_ASPM_ENABLE 0x00000003 /* Active State Link PM Control */ ++#define PCIE_LCTLSTS_ASPM_ENABLE_S 0 ++#define PCIE_LCTLSTS_RCB128 0x00000008 /* Read Completion Boundary 128*/ ++#define PCIE_LCTLSTS_LINK_DISABLE 0x00000010 /* Link Disable */ ++#define PCIE_LCTLSTS_RETRIAN_LINK 0x00000020 /* Retrain Link */ ++#define PCIE_LCTLSTS_COM_CLK_CFG 0x00000040 /* Common Clock Configuration */ ++#define PCIE_LCTLSTS_EXT_SYNC 0x00000080 /* Extended Synch */ ++#define PCIE_LCTLSTS_CLK_PM_EN 0x00000100 /* Enable Clock Powerm Management */ ++#define PCIE_LCTLSTS_LINK_SPEED 0x000F0000 /* Link Speed */ ++#define PCIE_LCTLSTS_LINK_SPEED_S 16 ++#define PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH 0x03F00000 /* Negotiated Link Width */ ++#define PCIE_LCTLSTS_NEGOTIATED_LINK_WIDTH_S 20 ++#define PCIE_LCTLSTS_RETRAIN_PENDING 0x08000000 /* Link training is ongoing */ ++#define PCIE_LCTLSTS_SLOT_CLK_CFG 0x10000000 /* Slot Clock Configuration */ ++#define PCIE_LCTLSTS_DLL_ACTIVE 0x20000000 /* Data Link Layer Active */ ++ ++/* Slot Capabilities Register */ ++#define PCIE_SLCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x84) ++ ++/* Slot Capabilities */ ++#define PCIE_SLCTLSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x88) ++ ++/* Root Control and Capability Register */ ++#define PCIE_RCTLCAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x8C) ++#define PCIE_RCTLCAP_SERR_ON_CORRECTABLE_ERR 0x00000001 /* #SERR on COR-ERR */ ++#define PCIE_RCTLCAP_SERR_ON_NONFATAL_ERR 0x00000002 /* #SERR on Non-Fatal ERR */ ++#define PCIE_RCTLCAP_SERR_ON_FATAL_ERR 0x00000004 /* #SERR on Fatal ERR */ ++#define PCIE_RCTLCAP_PME_INT_EN 0x00000008 /* PME Interrupt Enable */ ++#define PCIE_RCTLCAP_SERR_ENABLE (PCIE_RCTLCAP_SERR_ON_CORRECTABLE_ERR | \ ++ PCIE_RCTLCAP_SERR_ON_NONFATAL_ERR | PCIE_RCTLCAP_SERR_ON_FATAL_ERR) ++/* Root Status Register */ ++#define PCIE_RSTS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x90) ++#define PCIE_RSTS_PME_REQ_ID 0x0000FFFF /* PME Request ID */ ++#define PCIE_RSTS_PME_REQ_ID_S 0 ++#define PCIE_RSTS_PME_STATUS 0x00010000 /* PME Status */ ++#define PCIE_RSTS_PME_PENDING 0x00020000 /* PME Pending */ ++ ++/* PCI Express Enhanced Capability Header */ ++#define PCIE_ENHANCED_CAP(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x100) ++#define PCIE_ENHANCED_CAP_ID 0x0000FFFF /* PCI Express Extended Capability ID */ ++#define PCIE_ENHANCED_CAP_ID_S 0 ++#define PCIE_ENHANCED_CAP_VER 0x000F0000 /* Capability Version */ ++#define PCIE_ENHANCED_CAP_VER_S 16 ++#define PCIE_ENHANCED_CAP_NEXT_OFFSET 0xFFF00000 /* Next Capability Offset */ ++#define PCIE_ENHANCED_CAP_NEXT_OFFSET_S 20 ++ ++/* Uncorrectable Error Status Register */ ++#define PCIE_UES_R(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x104) ++#define PCIE_DATA_LINK_PROTOCOL_ERR 0x00000010 /* Data Link Protocol Error Status */ ++#define PCIE_SURPRISE_DOWN_ERROR 0x00000020 /* Surprise Down Error Status */ ++#define PCIE_POISONED_TLP 0x00001000 /* Poisoned TLP Status */ ++#define PCIE_FC_PROTOCOL_ERR 0x00002000 /* Flow Control Protocol Error Status */ ++#define PCIE_COMPLETION_TIMEOUT 0x00004000 /* Completion Timeout Status */ ++#define PCIE_COMPLETOR_ABORT 0x00008000 /* Completer Abort Error */ ++#define PCIE_UNEXPECTED_COMPLETION 0x00010000 /* Unexpected Completion Status */ ++#define PCIE_RECEIVER_OVERFLOW 0x00020000 /* Receive Overflow Status */ ++#define PCIE_MALFORNED_TLP 0x00040000 /* Malformed TLP Stauts */ ++#define PCIE_ECRC_ERR 0x00080000 /* ECRC Error Stauts */ ++#define PCIE_UR_REQ 0x00100000 /* Unsupported Request Error Status */ ++#define PCIE_ALL_UNCORRECTABLE_ERR (PCIE_DATA_LINK_PROTOCOL_ERR | PCIE_SURPRISE_DOWN_ERROR | \ ++ PCIE_POISONED_TLP | PCIE_FC_PROTOCOL_ERR | PCIE_COMPLETION_TIMEOUT | \ ++ PCIE_COMPLETOR_ABORT | PCIE_UNEXPECTED_COMPLETION | PCIE_RECEIVER_OVERFLOW |\ ++ PCIE_MALFORNED_TLP | PCIE_ECRC_ERR | PCIE_UR_REQ) ++ ++/* Uncorrectable Error Mask Register, Mask means no report */ ++#define PCIE_UEMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x108) ++ ++/* Uncorrectable Error Severity Register */ ++#define PCIE_UESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x10C) ++ ++/* Correctable Error Status Register */ ++#define PCIE_CESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x110) ++#define PCIE_RX_ERR 0x00000001 /* Receive Error Status */ ++#define PCIE_BAD_TLP 0x00000040 /* Bad TLP Status */ ++#define PCIE_BAD_DLLP 0x00000080 /* Bad DLLP Status */ ++#define PCIE_REPLAY_NUM_ROLLOVER 0x00000100 /* Replay Number Rollover Status */ ++#define PCIE_REPLAY_TIMER_TIMEOUT_ERR 0x00001000 /* Reply Timer Timeout Status */ ++#define PCIE_ADVISORY_NONFTAL_ERR 0x00002000 /* Advisory Non-Fatal Error Status */ ++#define PCIE_CORRECTABLE_ERR (PCIE_RX_ERR | PCIE_BAD_TLP | PCIE_BAD_DLLP | PCIE_REPLAY_NUM_ROLLOVER |\ ++ PCIE_REPLAY_TIMER_TIMEOUT_ERR | PCIE_ADVISORY_NONFTAL_ERR) ++ ++/* Correctable Error Mask Register */ ++#define PCIE_CEMR(X) (volatile u32*)(PCIE_RC_CFG_BASE + 0x114) ++ ++/* Advanced Error Capabilities and Control Register */ ++#define PCIE_AECCR(X) (volatile u32*)(PCIE_RC_CFG_BASE + 0x118) ++#define PCIE_AECCR_FIRST_ERR_PTR 0x0000001F /* First Error Pointer */ ++#define PCIE_AECCR_FIRST_ERR_PTR_S 0 ++#define PCIE_AECCR_ECRC_GEN_CAP 0x00000020 /* ECRC Generation Capable */ ++#define PCIE_AECCR_ECRC_GEN_EN 0x00000040 /* ECRC Generation Enable */ ++#define PCIE_AECCR_ECRC_CHECK_CAP 0x00000080 /* ECRC Check Capable */ ++#define PCIE_AECCR_ECRC_CHECK_EN 0x00000100 /* ECRC Check Enable */ ++ ++/* Header Log Register 1 */ ++#define PCIE_HLR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x11C) ++ ++/* Header Log Register 2 */ ++#define PCIE_HLR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x120) ++ ++/* Header Log Register 3 */ ++#define PCIE_HLR3(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x124) ++ ++/* Header Log Register 4 */ ++#define PCIE_HLR4(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x128) ++ ++/* Root Error Command Register */ ++#define PCIE_RECR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x12C) ++#define PCIE_RECR_CORRECTABLE_ERR_REPORT_EN 0x00000001 /* COR-ERR */ ++#define PCIE_RECR_NONFATAL_ERR_REPORT_EN 0x00000002 /* Non-Fatal ERR */ ++#define PCIE_RECR_FATAL_ERR_REPORT_EN 0x00000004 /* Fatal ERR */ ++#define PCIE_RECR_ERR_REPORT_EN (PCIE_RECR_CORRECTABLE_ERR_REPORT_EN | \ ++ PCIE_RECR_NONFATAL_ERR_REPORT_EN | PCIE_RECR_FATAL_ERR_REPORT_EN) ++ ++/* Root Error Status Register */ ++#define PCIE_RESR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x130) ++#define PCIE_RESR_CORRECTABLE_ERR 0x00000001 /* COR-ERR Receveid */ ++#define PCIE_RESR_MULTI_CORRECTABLE_ERR 0x00000002 /* Multiple COR-ERR Received */ ++#define PCIE_RESR_FATAL_NOFATAL_ERR 0x00000004 /* ERR Fatal/Non-Fatal Received */ ++#define PCIE_RESR_MULTI_FATAL_NOFATAL_ERR 0x00000008 /* Multiple ERR Fatal/Non-Fatal Received */ ++#define PCIE_RESR_FIRST_UNCORRECTABLE_FATAL_ERR 0x00000010 /* First UN-COR Fatal */ ++#define PCIR_RESR_NON_FATAL_ERR 0x00000020 /* Non-Fatal Error Message Received */ ++#define PCIE_RESR_FATAL_ERR 0x00000040 /* Fatal Message Received */ ++#define PCIE_RESR_AER_INT_MSG_NUM 0xF8000000 /* Advanced Error Interrupt Message Number */ ++#define PCIE_RESR_AER_INT_MSG_NUM_S 27 ++ ++/* Error Source Indentification Register */ ++#define PCIE_ESIR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x134) ++#define PCIE_ESIR_CORRECTABLE_ERR_SRC_ID 0x0000FFFF ++#define PCIE_ESIR_CORRECTABLE_ERR_SRC_ID_S 0 ++#define PCIE_ESIR_FATAL_NON_FATAL_SRC_ID 0xFFFF0000 ++#define PCIE_ESIR_FATAL_NON_FATAL_SRC_ID_S 16 ++ ++/* VC Enhanced Capability Header */ ++#define PCIE_VC_ECH(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x140) ++ ++/* Port VC Capability Register */ ++#define PCIE_PVC1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x144) ++#define PCIE_PVC1_EXT_VC_CNT 0x00000007 /* Extended VC Count */ ++#define PCIE_PVC1_EXT_VC_CNT_S 0 ++#define PCIE_PVC1_LOW_PRI_EXT_VC_CNT 0x00000070 /* Low Priority Extended VC Count */ ++#define PCIE_PVC1_LOW_PRI_EXT_VC_CNT_S 4 ++#define PCIE_PVC1_REF_CLK 0x00000300 /* Reference Clock */ ++#define PCIE_PVC1_REF_CLK_S 8 ++#define PCIE_PVC1_PORT_ARB_TAB_ENTRY_SIZE 0x00000C00 /* Port Arbitration Table Entry Size */ ++#define PCIE_PVC1_PORT_ARB_TAB_ENTRY_SIZE_S 10 ++ ++/* Extended Virtual Channel Count Defintion */ ++#define PCIE_EXT_VC_CNT_MIN 0 ++#define PCIE_EXT_VC_CNT_MAX 7 ++ ++/* Port Arbitration Table Entry Size Definition */ ++enum { ++ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S1BIT = 0, ++ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S2BIT, ++ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S4BIT, ++ PCIE_PORT_ARB_TAB_ENTRY_SIZE_S8BIT, ++}; ++ ++/* Port VC Capability Register 2 */ ++#define PCIE_PVC2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x148) ++#define PCIE_PVC2_VC_ARB_16P_FIXED_WRR 0x00000001 /* HW Fixed arbitration, 16 phase WRR */ ++#define PCIE_PVC2_VC_ARB_32P_WRR 0x00000002 /* 32 phase WRR */ ++#define PCIE_PVC2_VC_ARB_64P_WRR 0x00000004 /* 64 phase WRR */ ++#define PCIE_PVC2_VC_ARB_128P_WRR 0x00000008 /* 128 phase WRR */ ++#define PCIE_PVC2_VC_ARB_WRR 0x0000000F ++#define PCIE_PVC2_VC_ARB_TAB_OFFSET 0xFF000000 /* VC arbitration table offset, not support */ ++#define PCIE_PVC2_VC_ARB_TAB_OFFSET_S 24 ++ ++/* Port VC Control and Status Register */ ++#define PCIE_PVCCRSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x14C) ++#define PCIE_PVCCRSR_LOAD_VC_ARB_TAB 0x00000001 /* Load VC Arbitration Table */ ++#define PCIE_PVCCRSR_VC_ARB_SEL 0x0000000E /* VC Arbitration Select */ ++#define PCIE_PVCCRSR_VC_ARB_SEL_S 1 ++#define PCIE_PVCCRSR_VC_ARB_TAB_STATUS 0x00010000 /* Arbitration Status */ ++ ++/* VC0 Resource Capability Register */ ++#define PCIE_VC0_RC(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x150) ++#define PCIE_VC0_RC_PORT_ARB_HW_FIXED 0x00000001 /* HW Fixed arbitration */ ++#define PCIE_VC0_RC_PORT_ARB_32P_WRR 0x00000002 /* 32 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB_64P_WRR 0x00000004 /* 64 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB_128P_WRR 0x00000008 /* 128 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB_TM_128P_WRR 0x00000010 /* Time-based 128 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB_TM_256P_WRR 0x00000020 /* Time-based 256 phase WRR */ ++#define PCIE_VC0_RC_PORT_ARB (PCIE_VC0_RC_PORT_ARB_HW_FIXED | PCIE_VC0_RC_PORT_ARB_32P_WRR |\ ++ PCIE_VC0_RC_PORT_ARB_64P_WRR | PCIE_VC0_RC_PORT_ARB_128P_WRR | \ ++ PCIE_VC0_RC_PORT_ARB_TM_128P_WRR | PCIE_VC0_RC_PORT_ARB_TM_256P_WRR) ++ ++#define PCIE_VC0_RC_REJECT_SNOOP 0x00008000 /* Reject Snoop Transactioin */ ++#define PCIE_VC0_RC_MAX_TIMESLOTS 0x007F0000 /* Maximum time Slots */ ++#define PCIE_VC0_RC_MAX_TIMESLOTS_S 16 ++#define PCIE_VC0_RC_PORT_ARB_TAB_OFFSET 0xFF000000 /* Port Arbitration Table Offset */ ++#define PCIE_VC0_RC_PORT_ARB_TAB_OFFSET_S 24 ++ ++/* VC0 Resource Control Register */ ++#define PCIE_VC0_RC0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x154) ++#define PCIE_VC0_RC0_TVM0 0x00000001 /* TC0 and VC0 */ ++#define PCIE_VC0_RC0_TVM1 0x00000002 /* TC1 and VC1 */ ++#define PCIE_VC0_RC0_TVM2 0x00000004 /* TC2 and VC2 */ ++#define PCIE_VC0_RC0_TVM3 0x00000008 /* TC3 and VC3 */ ++#define PCIE_VC0_RC0_TVM4 0x00000010 /* TC4 and VC4 */ ++#define PCIE_VC0_RC0_TVM5 0x00000020 /* TC5 and VC5 */ ++#define PCIE_VC0_RC0_TVM6 0x00000040 /* TC6 and VC6 */ ++#define PCIE_VC0_RC0_TVM7 0x00000080 /* TC7 and VC7 */ ++#define PCIE_VC0_RC0_TC_VC 0x000000FF /* TC/VC mask */ ++ ++#define PCIE_VC0_RC0_LOAD_PORT_ARB_TAB 0x00010000 /* Load Port Arbitration Table */ ++#define PCIE_VC0_RC0_PORT_ARB_SEL 0x000E0000 /* Port Arbitration Select */ ++#define PCIE_VC0_RC0_PORT_ARB_SEL_S 17 ++#define PCIE_VC0_RC0_VC_ID 0x07000000 /* VC ID */ ++#define PCIE_VC0_RC0_VC_ID_S 24 ++#define PCIE_VC0_RC0_VC_EN 0x80000000 /* VC Enable */ ++ ++/* VC0 Resource Status Register */ ++#define PCIE_VC0_RSR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x158) ++#define PCIE_VC0_RSR0_PORT_ARB_TAB_STATUS 0x00010000 /* Port Arbitration Table Status,not used */ ++#define PCIE_VC0_RSR0_VC_NEG_PENDING 0x00020000 /* VC Negotiation Pending */ ++ ++/* Ack Latency Timer and Replay Timer Register */ ++#define PCIE_ALTRT(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x700) ++#define PCIE_ALTRT_ROUND_TRIP_LATENCY_LIMIT 0x0000FFFF /* Round Trip Latency Time Limit */ ++#define PCIE_ALTRT_ROUND_TRIP_LATENCY_LIMIT_S 0 ++#define PCIE_ALTRT_REPLAY_TIME_LIMIT 0xFFFF0000 /* Replay Time Limit */ ++#define PCIE_ALTRT_REPLAY_TIME_LIMIT_S 16 ++ ++/* Other Message Register */ ++#define PCIE_OMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x704) ++ ++/* Port Force Link Register */ ++#define PCIE_PFLR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x708) ++#define PCIE_PFLR_LINK_NUM 0x000000FF /* Link Number */ ++#define PCIE_PFLR_LINK_NUM_S 0 ++#define PCIE_PFLR_FORCE_LINK 0x00008000 /* Force link */ ++#define PCIE_PFLR_LINK_STATE 0x003F0000 /* Link State */ ++#define PCIE_PFLR_LINK_STATE_S 16 ++#define PCIE_PFLR_LOW_POWER_ENTRY_CNT 0xFF000000 /* Low Power Entrance Count, only for EP */ ++#define PCIE_PFLR_LOW_POWER_ENTRY_CNT_S 24 ++ ++/* Ack Frequency Register */ ++#define PCIE_AFR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x70C) ++#define PCIE_AFR_AF 0x000000FF /* Ack Frequency */ ++#define PCIE_AFR_AF_S 0 ++#define PCIE_AFR_FTS_NUM 0x0000FF00 /* The number of Fast Training Sequence from L0S to L0 */ ++#define PCIE_AFR_FTS_NUM_S 8 ++#define PCIE_AFR_COM_FTS_NUM 0x00FF0000 /* N_FTS; when common clock is used*/ ++#define PCIE_AFR_COM_FTS_NUM_S 16 ++#define PCIE_AFR_L0S_ENTRY_LATENCY 0x07000000 /* L0s Entrance Latency */ ++#define PCIE_AFR_L0S_ENTRY_LATENCY_S 24 ++#define PCIE_AFR_L1_ENTRY_LATENCY 0x38000000 /* L1 Entrance Latency */ ++#define PCIE_AFR_L1_ENTRY_LATENCY_S 27 ++#define PCIE_AFR_FTS_NUM_DEFAULT 32 ++#define PCIE_AFR_L0S_ENTRY_LATENCY_DEFAULT 7 ++#define PCIE_AFR_L1_ENTRY_LATENCY_DEFAULT 5 ++ ++/* Port Link Control Register */ ++#define PCIE_PLCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x710) ++#define PCIE_PLCR_OTHER_MSG_REQ 0x00000001 /* Other Message Request */ ++#define PCIE_PLCR_SCRAMBLE_DISABLE 0x00000002 /* Scramble Disable */ ++#define PCIE_PLCR_LOOPBACK_EN 0x00000004 /* Loopback Enable */ ++#define PCIE_PLCR_LTSSM_HOT_RST 0x00000008 /* Force LTSSM to the hot reset */ ++#define PCIE_PLCR_DLL_LINK_EN 0x00000020 /* Enable Link initialization */ ++#define PCIE_PLCR_FAST_LINK_SIM_EN 0x00000080 /* Sets all internal timers to fast mode for simulation purposes */ ++#define PCIE_PLCR_LINK_MODE 0x003F0000 /* Link Mode Enable Mask */ ++#define PCIE_PLCR_LINK_MODE_S 16 ++#define PCIE_PLCR_CORRUPTED_CRC_EN 0x02000000 /* Enabled Corrupt CRC */ ++ ++/* Lane Skew Register */ ++#define PCIE_LSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x714) ++#define PCIE_LSR_LANE_SKEW_NUM 0x00FFFFFF /* Insert Lane Skew for Transmit, not applicable */ ++#define PCIE_LSR_LANE_SKEW_NUM_S 0 ++#define PCIE_LSR_FC_DISABLE 0x01000000 /* Disable of Flow Control */ ++#define PCIE_LSR_ACKNAK_DISABLE 0x02000000 /* Disable of Ack/Nak */ ++#define PCIE_LSR_LANE_DESKEW_DISABLE 0x80000000 /* Disable of Lane-to-Lane Skew */ ++ ++/* Symbol Number Register */ ++#define PCIE_SNR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x718) ++#define PCIE_SNR_TS 0x0000000F /* Number of TS Symbol */ ++#define PCIE_SNR_TS_S 0 ++#define PCIE_SNR_SKP 0x00000700 /* Number of SKP Symbol */ ++#define PCIE_SNR_SKP_S 8 ++#define PCIE_SNR_REPLAY_TIMER 0x0007C000 /* Timer Modifier for Replay Timer */ ++#define PCIE_SNR_REPLAY_TIMER_S 14 ++#define PCIE_SNR_ACKNAK_LATENCY_TIMER 0x00F80000 /* Timer Modifier for Ack/Nak Latency Timer */ ++#define PCIE_SNR_ACKNAK_LATENCY_TIMER_S 19 ++#define PCIE_SNR_FC_TIMER 0x1F000000 /* Timer Modifier for Flow Control Watchdog Timer */ ++#define PCIE_SNR_FC_TIMER_S 28 ++ ++/* Symbol Timer Register and Filter Mask Register 1 */ ++#define PCIE_STRFMR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x71C) ++#define PCIE_STRFMR_SKP_INTERVAL 0x000007FF /* SKP lnterval Value */ ++#define PCIE_STRFMR_SKP_INTERVAL_S 0 ++#define PCIE_STRFMR_FC_WDT_DISABLE 0x00008000 /* Disable of FC Watchdog Timer */ ++#define PCIE_STRFMR_TLP_FUNC_MISMATCH_OK 0x00010000 /* Mask Function Mismatch Filtering for Incoming Requests */ ++#define PCIE_STRFMR_POISONED_TLP_OK 0x00020000 /* Mask Poisoned TLP Filtering */ ++#define PCIE_STRFMR_BAR_MATCH_OK 0x00040000 /* Mask BAR Match Filtering */ ++#define PCIE_STRFMR_TYPE1_CFG_REQ_OK 0x00080000 /* Mask Type 1 Configuration Request Filtering */ ++#define PCIE_STRFMR_LOCKED_REQ_OK 0x00100000 /* Mask Locked Request Filtering */ ++#define PCIE_STRFMR_CPL_TAG_ERR_RULES_OK 0x00200000 /* Mask Tag Error Rules for Received Completions */ ++#define PCIE_STRFMR_CPL_REQUESTOR_ID_MISMATCH_OK 0x00400000 /* Mask Requester ID Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_CPL_FUNC_MISMATCH_OK 0x00800000 /* Mask Function Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_CPL_TC_MISMATCH_OK 0x01000000 /* Mask Traffic Class Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_CPL_ATTR_MISMATCH_OK 0x02000000 /* Mask Attribute Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_CPL_LENGTH_MISMATCH_OK 0x04000000 /* Mask Length Mismatch Error for Received Completions */ ++#define PCIE_STRFMR_TLP_ECRC_ERR_OK 0x08000000 /* Mask ECRC Error Filtering */ ++#define PCIE_STRFMR_CPL_TLP_ECRC_OK 0x10000000 /* Mask ECRC Error Filtering for Completions */ ++#define PCIE_STRFMR_RX_TLP_MSG_NO_DROP 0x20000000 /* Send Message TLPs */ ++#define PCIE_STRFMR_RX_IO_TRANS_ENABLE 0x40000000 /* Mask Filtering of received I/O Requests */ ++#define PCIE_STRFMR_RX_CFG_TRANS_ENABLE 0x80000000 /* Mask Filtering of Received Configuration Requests */ ++ ++#define PCIE_DEF_SKP_INTERVAL 700 /* 1180 ~1538 , 125MHz * 2, 250MHz * 1 */ ++ ++/* Filter Masker Register 2 */ ++#define PCIE_FMR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x720) ++#define PCIE_FMR2_VENDOR_MSG0_PASSED_TO_TRGT1 0x00000001 /* Mask RADM Filtering and Error Handling Rules */ ++#define PCIE_FMR2_VENDOR_MSG1_PASSED_TO_TRGT1 0x00000002 /* Mask RADM Filtering and Error Handling Rules */ ++ ++/* Debug Register 0 */ ++#define PCIE_DBR0(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x728) ++ ++/* Debug Register 1 */ ++#define PCIE_DBR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x72C) ++ ++/* Transmit Posted FC Credit Status Register */ ++#define PCIE_TPFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x730) ++#define PCIE_TPFCS_TX_P_DATA_FC_CREDITS 0x00000FFF /* Transmit Posted Data FC Credits */ ++#define PCIE_TPFCS_TX_P_DATA_FC_CREDITS_S 0 ++#define PCIE_TPFCS_TX_P_HDR_FC_CREDITS 0x000FF000 /* Transmit Posted Header FC Credits */ ++#define PCIE_TPFCS_TX_P_HDR_FC_CREDITS_S 12 ++ ++/* Transmit Non-Posted FC Credit Status */ ++#define PCIE_TNPFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x734) ++#define PCIE_TNPFCS_TX_NP_DATA_FC_CREDITS 0x00000FFF /* Transmit Non-Posted Data FC Credits */ ++#define PCIE_TNPFCS_TX_NP_DATA_FC_CREDITS_S 0 ++#define PCIE_TNPFCS_TX_NP_HDR_FC_CREDITS 0x000FF000 /* Transmit Non-Posted Header FC Credits */ ++#define PCIE_TNPFCS_TX_NP_HDR_FC_CREDITS_S 12 ++ ++/* Transmit Complete FC Credit Status Register */ ++#define PCIE_TCFCS(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x738) ++#define PCIE_TCFCS_TX_CPL_DATA_FC_CREDITS 0x00000FFF /* Transmit Completion Data FC Credits */ ++#define PCIE_TCFCS_TX_CPL_DATA_FC_CREDITS_S 0 ++#define PCIE_TCFCS_TX_CPL_HDR_FC_CREDITS 0x000FF000 /* Transmit Completion Header FC Credits */ ++#define PCIE_TCFCS_TX_CPL_HDR_FC_CREDITS_S 12 ++ ++/* Queue Status Register */ ++#define PCIE_QSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x73C) ++#define PCIE_QSR_WAIT_UPDATE_FC_DLL 0x00000001 /* Received TLP FC Credits Not Returned */ ++#define PCIE_QSR_TX_RETRY_BUF_NOT_EMPTY 0x00000002 /* Transmit Retry Buffer Not Empty */ ++#define PCIE_QSR_RX_QUEUE_NOT_EMPTY 0x00000004 /* Received Queue Not Empty */ ++ ++/* VC Transmit Arbitration Register 1 */ ++#define PCIE_VCTAR1(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x740) ++#define PCIE_VCTAR1_WRR_WEIGHT_VC0 0x000000FF /* WRR Weight for VC0 */ ++#define PCIE_VCTAR1_WRR_WEIGHT_VC1 0x0000FF00 /* WRR Weight for VC1 */ ++#define PCIE_VCTAR1_WRR_WEIGHT_VC2 0x00FF0000 /* WRR Weight for VC2 */ ++#define PCIE_VCTAR1_WRR_WEIGHT_VC3 0xFF000000 /* WRR Weight for VC3 */ ++ ++/* VC Transmit Arbitration Register 2 */ ++#define PCIE_VCTAR2(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x744) ++#define PCIE_VCTAR2_WRR_WEIGHT_VC4 0x000000FF /* WRR Weight for VC4 */ ++#define PCIE_VCTAR2_WRR_WEIGHT_VC5 0x0000FF00 /* WRR Weight for VC5 */ ++#define PCIE_VCTAR2_WRR_WEIGHT_VC6 0x00FF0000 /* WRR Weight for VC6 */ ++#define PCIE_VCTAR2_WRR_WEIGHT_VC7 0xFF000000 /* WRR Weight for VC7 */ ++ ++/* VC0 Posted Receive Queue Control Register */ ++#define PCIE_VC0_PRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x748) ++#define PCIE_VC0_PRQCR_P_DATA_CREDITS 0x00000FFF /* VC0 Posted Data Credits */ ++#define PCIE_VC0_PRQCR_P_DATA_CREDITS_S 0 ++#define PCIE_VC0_PRQCR_P_HDR_CREDITS 0x000FF000 /* VC0 Posted Header Credits */ ++#define PCIE_VC0_PRQCR_P_HDR_CREDITS_S 12 ++#define PCIE_VC0_PRQCR_P_TLP_QUEUE_MODE 0x00E00000 /* VC0 Posted TLP Queue Mode */ ++#define PCIE_VC0_PRQCR_P_TLP_QUEUE_MODE_S 20 ++#define PCIE_VC0_PRQCR_TLP_RELAX_ORDER 0x40000000 /* TLP Type Ordering for VC0 */ ++#define PCIE_VC0_PRQCR_VC_STRICT_ORDER 0x80000000 /* VC0 Ordering for Receive Queues */ ++ ++/* VC0 Non-Posted Receive Queue Control */ ++#define PCIE_VC0_NPRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x74C) ++#define PCIE_VC0_NPRQCR_NP_DATA_CREDITS 0x00000FFF /* VC0 Non-Posted Data Credits */ ++#define PCIE_VC0_NPRQCR_NP_DATA_CREDITS_S 0 ++#define PCIE_VC0_NPRQCR_NP_HDR_CREDITS 0x000FF000 /* VC0 Non-Posted Header Credits */ ++#define PCIE_VC0_NPRQCR_NP_HDR_CREDITS_S 12 ++#define PCIE_VC0_NPRQCR_NP_TLP_QUEUE_MODE 0x00E00000 /* VC0 Non-Posted TLP Queue Mode */ ++#define PCIE_VC0_NPRQCR_NP_TLP_QUEUE_MODE_S 20 ++ ++/* VC0 Completion Receive Queue Control */ ++#define PCIE_VC0_CRQCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x750) ++#define PCIE_VC0_CRQCR_CPL_DATA_CREDITS 0x00000FFF /* VC0 Completion TLP Queue Mode */ ++#define PCIE_VC0_CRQCR_CPL_DATA_CREDITS_S 0 ++#define PCIE_VC0_CRQCR_CPL_HDR_CREDITS 0x000FF000 /* VC0 Completion Header Credits */ ++#define PCIE_VC0_CRQCR_CPL_HDR_CREDITS_S 12 ++#define PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE 0x00E00000 /* VC0 Completion Data Credits */ ++#define PCIE_VC0_CRQCR_CPL_TLP_QUEUE_MODE_S 21 ++ ++/* Applicable to the above three registers */ ++enum { ++ PCIE_VC0_TLP_QUEUE_MODE_STORE_FORWARD = 1, ++ PCIE_VC0_TLP_QUEUE_MODE_CUT_THROUGH = 2, ++ PCIE_VC0_TLP_QUEUE_MODE_BYPASS = 4, ++}; ++ ++/* VC0 Posted Buffer Depth Register */ ++#define PCIE_VC0_PBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7A8) ++#define PCIE_VC0_PBD_P_DATA_QUEUE_ENTRIES 0x00003FFF /* VC0 Posted Data Queue Depth */ ++#define PCIE_VC0_PBD_P_DATA_QUEUE_ENTRIES_S 0 ++#define PCIE_VC0_PBD_P_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Posted Header Queue Depth */ ++#define PCIE_VC0_PBD_P_HDR_QUEUE_ENTRIES_S 16 ++ ++/* VC0 Non-Posted Buffer Depth Register */ ++#define PCIE_VC0_NPBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7AC) ++#define PCIE_VC0_NPBD_NP_DATA_QUEUE_ENTRIES 0x00003FFF /* VC0 Non-Posted Data Queue Depth */ ++#define PCIE_VC0_NPBD_NP_DATA_QUEUE_ENTRIES_S 0 ++#define PCIE_VC0_NPBD_NP_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Non-Posted Header Queue Depth */ ++#define PCIE_VC0_NPBD_NP_HDR_QUEUE_ENTRIES_S 16 ++ ++/* VC0 Completion Buffer Depth Register */ ++#define PCIE_VC0_CBD(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x7B0) ++#define PCIE_VC0_CBD_CPL_DATA_QUEUE_ENTRIES 0x00003FFF /* C0 Completion Data Queue Depth */ ++#define PCIE_VC0_CBD_CPL_DATA_QUEUE_ENTRIES_S 0 ++#define PCIE_VC0_CBD_CPL_HDR_QUEUE_ENTRIES 0x03FF0000 /* VC0 Completion Header Queue Depth */ ++#define PCIE_VC0_CBD_CPL_HDR_QUEUE_ENTRIES_S 16 ++ ++/* PHY Status Register, all zeros in VR9 */ ++#define PCIE_PHYSR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x810) ++ ++/* PHY Control Register, all zeros in VR9 */ ++#define PCIE_PHYCR(X) (volatile u32*)(PCIE_RC_PORT_TO_BASE(X) + 0x814) ++ ++/* ++ * PCIe PDI PHY register definition, suppose all the following ++ * stuff is confidential. ++ * XXX, detailed bit definition ++ */ ++#define PCIE_PHY_PLL_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x22 << 1)) ++#define PCIE_PHY_PLL_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x23 << 1)) ++#define PCIE_PHY_PLL_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x24 << 1)) ++#define PCIE_PHY_PLL_CTRL4(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x25 << 1)) ++#define PCIE_PHY_PLL_CTRL5(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x26 << 1)) ++#define PCIE_PHY_PLL_CTRL6(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x27 << 1)) ++#define PCIE_PHY_PLL_CTRL7(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x28 << 1)) ++#define PCIE_PHY_PLL_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x29 << 1)) ++#define PCIE_PHY_PLL_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2A << 1)) ++#define PCIE_PHY_PLL_A_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2B << 1)) ++#define PCIE_PHY_PLL_STATUS(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x2C << 1)) ++ ++#define PCIE_PHY_TX1_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x30 << 1)) ++#define PCIE_PHY_TX1_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x31 << 1)) ++#define PCIE_PHY_TX1_CTRL3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x32 << 1)) ++#define PCIE_PHY_TX1_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x33 << 1)) ++#define PCIE_PHY_TX1_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x34 << 1)) ++#define PCIE_PHY_TX1_MOD1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x35 << 1)) ++#define PCIE_PHY_TX1_MOD2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x36 << 1)) ++#define PCIE_PHY_TX1_MOD3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x37 << 1)) ++ ++#define PCIE_PHY_TX2_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x38 << 1)) ++#define PCIE_PHY_TX2_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x39 << 1)) ++#define PCIE_PHY_TX2_A_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3B << 1)) ++#define PCIE_PHY_TX2_A_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3C << 1)) ++#define PCIE_PHY_TX2_MOD1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3D << 1)) ++#define PCIE_PHY_TX2_MOD2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3E << 1)) ++#define PCIE_PHY_TX2_MOD3(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x3F << 1)) ++ ++#define PCIE_PHY_RX1_CTRL1(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x50 << 1)) ++#define PCIE_PHY_RX1_CTRL2(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x51 << 1)) ++#define PCIE_PHY_RX1_CDR(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x52 << 1)) ++#define PCIE_PHY_RX1_EI(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x53 << 1)) ++#define PCIE_PHY_RX1_A_CTRL(X) (PCIE_PHY_PORT_TO_BASE(X) + (0x55 << 1)) ++ ++/* Interrupt related stuff */ ++#define PCIE_LEGACY_DISABLE 0 ++#define PCIE_LEGACY_INTA 1 ++#define PCIE_LEGACY_INTB 2 ++#define PCIE_LEGACY_INTC 3 ++#define PCIE_LEGACY_INTD 4 ++#define PCIE_LEGACY_INT_MAX PCIE_LEGACY_INTD ++ ++#define PCIE_IRQ_LOCK(lock) do { \ ++ unsigned long flags; \ ++ spin_lock_irqsave(&(lock), flags); ++#define PCIE_IRQ_UNLOCK(lock) \ ++ spin_unlock_irqrestore(&(lock), flags); \ ++} while (0) ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) ++#define IRQF_SHARED SA_SHIRQ ++#endif ++ ++#define PCIE_MSG_MSI 0x00000001 ++#define PCIE_MSG_ISR 0x00000002 ++#define PCIE_MSG_FIXUP 0x00000004 ++#define PCIE_MSG_READ_CFG 0x00000008 ++#define PCIE_MSG_WRITE_CFG 0x00000010 ++#define PCIE_MSG_CFG (PCIE_MSG_READ_CFG | PCIE_MSG_WRITE_CFG) ++#define PCIE_MSG_REG 0x00000020 ++#define PCIE_MSG_INIT 0x00000040 ++#define PCIE_MSG_ERR 0x00000080 ++#define PCIE_MSG_PHY 0x00000100 ++#define PCIE_MSG_ANY 0x000001ff ++ ++#define IFX_PCIE_PORT0 0 ++#define IFX_PCIE_PORT1 1 ++ ++#ifdef CONFIG_IFX_PCIE_2ND_CORE ++#define IFX_PCIE_CORE_NR 2 ++#else ++#define IFX_PCIE_CORE_NR 1 ++#endif ++ ++//#define IFX_PCIE_ERROR_INT ++ ++//#define IFX_PCIE_DBG ++ ++#if defined(IFX_PCIE_DBG) ++#define IFX_PCIE_PRINT(_m, _fmt, args...) do { \ ++ if (g_pcie_debug_flag & (_m)) { \ ++ ifx_pcie_debug((_fmt), ##args); \ ++ } \ ++} while (0) ++ ++#define INLINE ++#else ++#define IFX_PCIE_PRINT(_m, _fmt, args...) \ ++ do {} while(0) ++#define INLINE inline ++#endif ++ ++struct ifx_pci_controller { ++ struct pci_controller pcic; ++ ++ /* RC specific, per host bus information */ ++ u32 port; /* Port index, 0 -- 1st core, 1 -- 2nd core */ ++}; ++ ++typedef struct ifx_pcie_ir_irq { ++ const unsigned int irq; ++ const char name[16]; ++}ifx_pcie_ir_irq_t; ++ ++typedef struct ifx_pcie_legacy_irq{ ++ const u32 irq_bit; ++ const int irq; ++}ifx_pcie_legacy_irq_t; ++ ++typedef struct ifx_pcie_irq { ++ ifx_pcie_ir_irq_t ir_irq; ++ ifx_pcie_legacy_irq_t legacy_irq[PCIE_LEGACY_INT_MAX]; ++}ifx_pcie_irq_t; ++ ++extern u32 g_pcie_debug_flag; ++extern void ifx_pcie_debug(const char *fmt, ...); ++extern void pcie_phy_clock_mode_setup(int pcie_port); ++extern void pcie_msi_pic_init(int pcie_port); ++extern u32 ifx_pcie_bus_enum_read_hack(int where, u32 value); ++extern u32 ifx_pcie_bus_enum_write_hack(int where, u32 value); ++ ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++#define IFX_PCIE_GPIO_RESET 38 ++#define IFX_REG_R32 ltq_r32 ++#define IFX_REG_W32 ltq_w32 ++#define CONFIG_IFX_PCIE_HW_SWAP ++#define IFX_RCU_AHB_ENDIAN ((volatile u32*)(IFX_RCU + 0x004C)) ++#define IFX_RCU_RST_REQ ((volatile u32*)(IFX_RCU + 0x0010)) ++#define IFX_RCU_AHB_BE_PCIE_PDI 0x00000080 /* Configure PCIE PDI module in big endian*/ ++ ++#define IFX_RCU (KSEG1 | 0x1F203000) ++#define IFX_RCU_AHB_BE_PCIE_M 0x00000001 /* Configure AHB master port that connects to PCIe RC in big endian */ ++#define IFX_RCU_AHB_BE_PCIE_S 0x00000010 /* Configure AHB slave port that connects to PCIe RC in little endian */ ++#define IFX_RCU_AHB_BE_XBAR_M 0x00000002 /* Configure AHB master port that connects to XBAR in big endian */ ++#define CONFIG_IFX_PCIE_PHY_36MHZ_MODE ++ ++#define IFX_PMU1_MODULE_PCIE_PHY (0) ++#define IFX_PMU1_MODULE_PCIE_CTRL (1) ++#define IFX_PMU1_MODULE_PDI (4) ++#define IFX_PMU1_MODULE_MSI (5) ++ ++#define IFX_PMU_MODULE_PCIE_L0_CLK (31) ++ ++ ++static inline void pcie_ep_gpio_rst_init(int pcie_port) ++{ ++} ++ ++static inline void pcie_ahb_pmu_setup(void) ++{ ++ struct clk *clk; ++ clk = clk_get_sys("ltq_pcie", "ahb"); ++ clk_enable(clk); ++ //ltq_pmu_enable(PMU_AHBM | PMU_AHBS); ++} ++ ++static inline void pcie_rcu_endian_setup(int pcie_port) ++{ ++ u32 reg; ++ ++ reg = IFX_REG_R32(IFX_RCU_AHB_ENDIAN); ++#ifdef CONFIG_IFX_PCIE_HW_SWAP ++ reg |= IFX_RCU_AHB_BE_PCIE_M; ++ reg |= IFX_RCU_AHB_BE_PCIE_S; ++ reg &= ~IFX_RCU_AHB_BE_XBAR_M; ++#else ++ reg |= IFX_RCU_AHB_BE_PCIE_M; ++ reg &= ~IFX_RCU_AHB_BE_PCIE_S; ++ reg &= ~IFX_RCU_AHB_BE_XBAR_M; ++#endif /* CONFIG_IFX_PCIE_HW_SWAP */ ++ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); ++ IFX_PCIE_PRINT(PCIE_MSG_REG, "%s IFX_RCU_AHB_ENDIAN: 0x%08x\n", __func__, IFX_REG_R32(IFX_RCU_AHB_ENDIAN)); ++} ++ ++static inline void pcie_phy_pmu_enable(int pcie_port) ++{ ++ struct clk *clk; ++ clk = clk_get_sys("ltq_pcie", "phy"); ++ clk_enable(clk); ++ //ltq_pmu1_enable(1<PCIe and PDI endianness */ ++ reg |= IFX_RCU_AHB_BE_PCIE_PDI; ++ IFX_REG_W32(reg, IFX_RCU_AHB_ENDIAN); ++} ++ ++static inline void pcie_pdi_pmu_enable(int pcie_port) ++{ ++ struct clk *clk; ++ clk = clk_get_sys("ltq_pcie", "pdi"); ++ clk_enable(clk); ++ //ltq_pmu1_enable(1< 1) { ++ tbus_number -= pcibios_1st_host_bus_nr(); ++ } ++#endif /* CONFIG_PCI_LANTIQ */ ++ return tbus_number; ++} ++ ++static inline u32 ++ifx_pcie_bus_enum_hack(struct pci_bus *bus, u32 devfn, int where, u32 value, int pcie_port, int read) ++{ ++ struct pci_dev *pdev; ++ u32 tvalue = value; ++ ++ /* Sanity check */ ++ pdev = pci_get_slot(bus, devfn); ++ if (pdev == NULL) { ++ return tvalue; ++ } ++ ++ /* Only care about PCI bridge */ ++ if (pdev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { ++ return tvalue; ++ } ++ ++ if (read) { /* Read hack */ ++ #ifdef CONFIG_PCI_LANTIQ ++ if (pcibios_host_nr() > 1) { ++ tvalue = ifx_pcie_bus_enum_read_hack(where, tvalue); ++ } ++ #endif /* CONFIG_PCI_LANTIQ */ ++ } ++ else { /* Write hack */ ++ #ifdef CONFIG_PCI_LANTIQ ++ if (pcibios_host_nr() > 1) { ++ tvalue = ifx_pcie_bus_enum_write_hack(where, tvalue); ++ } ++ #endif ++ } ++ return tvalue; ++} ++ ++#endif /* IFXMIPS_PCIE_VR9_H */ ++ +--- a/drivers/pci/pcie/aer/Kconfig ++++ b/drivers/pci/pcie/aer/Kconfig +@@ -19,6 +19,7 @@ config PCIEAER + config PCIE_ECRC + bool "PCI Express ECRC settings control" + depends on PCIEAER ++ default n + help + Used to override firmware/bios settings for PCI Express ECRC + (transaction layer end-to-end CRC checking). +--- a/include/linux/pci.h ++++ b/include/linux/pci.h +@@ -1250,6 +1250,8 @@ void pci_walk_bus(struct pci_bus *top, i + void *userdata); + int pci_cfg_space_size(struct pci_dev *dev); + unsigned char pci_bus_max_busnr(struct pci_bus *bus); ++int pcibios_host_nr(void); ++int pcibios_1st_host_bus_nr(void); + void pci_setup_bridge(struct pci_bus *bus); + resource_size_t pcibios_window_alignment(struct pci_bus *bus, + unsigned long type); +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -1056,6 +1056,12 @@ + #define PCI_DEVICE_ID_SGI_LITHIUM 0x1002 + #define PCI_DEVICE_ID_SGI_IOC4 0x100a + ++#define PCI_VENDOR_ID_INFINEON 0x15D1 ++#define PCI_DEVICE_ID_INFINEON_DANUBE 0x000F ++#define PCI_DEVICE_ID_INFINEON_PCIE 0x0011 ++#define PCI_VENDOR_ID_LANTIQ 0x1BEF ++#define PCI_DEVICE_ID_LANTIQ_PCIE 0x0011 ++ + #define PCI_VENDOR_ID_WINBOND 0x10ad + #define PCI_DEVICE_ID_WINBOND_82C105 0x0105 + #define PCI_DEVICE_ID_WINBOND_83C553 0x0565 diff --git a/target/linux/lantiq/patches-4.9/0002-gpio-stp-xway-Implement-get-callback.patch b/target/linux/lantiq/patches-4.9/0002-gpio-stp-xway-Implement-get-callback.patch new file mode 100644 index 000000000..c32b3d6bb --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0002-gpio-stp-xway-Implement-get-callback.patch @@ -0,0 +1,47 @@ +From 5b9b2b5284f81941972105b13337c58489ea8fca Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Thu, 28 Jun 2018 21:57:40 +0200 +Subject: [PATCH] gpio: stp-xway: Implement get callback + +Add an implementation to get the current GPIO state. + +The callback is used by the leds-gpio driver for example, in case the +current LED/GPIO state should be kept during driver load. + +Signed-off-by: Mathias Kresin +Signed-off-by: Linus Walleij +--- + drivers/gpio/gpio-stp-xway.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/gpio/gpio-stp-xway.c ++++ b/drivers/gpio/gpio-stp-xway.c +@@ -91,6 +91,20 @@ struct xway_stp { + }; + + /** ++ * xway_stp_get() - gpio_chip->get - get gpios. ++ * @gc: Pointer to gpio_chip device structure. ++ * @gpio: GPIO signal number. ++ * ++ * Gets the shadow value. ++ */ ++static int xway_stp_get(struct gpio_chip *gc, unsigned int gpio) ++{ ++ struct xway_stp *chip = gpiochip_get_data(gc); ++ ++ return (xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio)); ++} ++ ++/** + * xway_stp_set() - gpio_chip->set - set gpios. + * @gc: Pointer to gpio_chip device structure. + * @gpio: GPIO signal number. +@@ -215,6 +229,7 @@ static int xway_stp_probe(struct platfor + chip->gc.parent = &pdev->dev; + chip->gc.label = "stp-xway"; + chip->gc.direction_output = xway_stp_dir_out; ++ chip->gc.get = xway_stp_get; + chip->gc.set = xway_stp_set; + chip->gc.request = xway_stp_request; + chip->gc.base = -1; diff --git a/target/linux/lantiq/patches-4.9/0004-MIPS-lantiq-add-atm-hack.patch b/target/linux/lantiq/patches-4.9/0004-MIPS-lantiq-add-atm-hack.patch new file mode 100644 index 000000000..479decd6a --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0004-MIPS-lantiq-add-atm-hack.patch @@ -0,0 +1,500 @@ +From 9afadf01b1be371ee88491819aa67364684461f9 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Fri, 3 Aug 2012 10:27:25 +0200 +Subject: [PATCH 04/36] MIPS: lantiq: add atm hack + +Signed-off-by: John Crispin +--- + arch/mips/include/asm/mach-lantiq/lantiq_atm.h | 196 +++++++++++++++++++++++ + arch/mips/include/asm/mach-lantiq/lantiq_ptm.h | 203 ++++++++++++++++++++++++ + arch/mips/lantiq/irq.c | 2 + + arch/mips/mm/cache.c | 2 + + include/uapi/linux/atm.h | 6 + + net/atm/common.c | 6 + + net/atm/proc.c | 2 +- + 7 files changed, 416 insertions(+), 1 deletion(-) + create mode 100644 arch/mips/include/asm/mach-lantiq/lantiq_atm.h + create mode 100644 arch/mips/include/asm/mach-lantiq/lantiq_ptm.h + +--- /dev/null ++++ b/arch/mips/include/asm/mach-lantiq/lantiq_atm.h +@@ -0,0 +1,196 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifx_atm.h ++** PROJECT : UEIP ++** MODULES : ATM ++** ++** DATE : 17 Jun 2009 ++** AUTHOR : Xu Liang ++** DESCRIPTION : Global ATM driver header file ++** COPYRIGHT : Copyright (c) 2006 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** ++** HISTORY ++** $Date $Author $Comment ++** 07 JUL 2009 Xu Liang Init Version ++*******************************************************************************/ ++ ++#ifndef IFX_ATM_H ++#define IFX_ATM_H ++ ++ ++ ++/*! ++ \defgroup IFX_ATM UEIP Project - ATM driver module ++ \brief UEIP Project - ATM driver module, support Danube, Amazon-SE, AR9, VR9. ++ */ ++ ++/*! ++ \defgroup IFX_ATM_IOCTL IOCTL Commands ++ \ingroup IFX_ATM ++ \brief IOCTL Commands used by user application. ++ */ ++ ++/*! ++ \defgroup IFX_ATM_STRUCT Structures ++ \ingroup IFX_ATM ++ \brief Structures used by user application. ++ */ ++ ++/*! ++ \file ifx_atm.h ++ \ingroup IFX_ATM ++ \brief ATM driver header file ++ */ ++ ++ ++ ++/* ++ * #################################### ++ * Definition ++ * #################################### ++ */ ++ ++/*! ++ \addtogroup IFX_ATM_STRUCT ++ */ ++/*@{*/ ++ ++/* ++ * ATM MIB ++ */ ++ ++/*! ++ \struct atm_cell_ifEntry_t ++ \brief Structure used for Cell Level MIB Counters. ++ ++ User application use this structure to call IOCTL command "PPE_ATM_MIB_CELL". ++ */ ++typedef struct { ++ __u32 ifHCInOctets_h; /*!< byte counter of ingress cells (upper 32 bits, total 64 bits) */ ++ __u32 ifHCInOctets_l; /*!< byte counter of ingress cells (lower 32 bits, total 64 bits) */ ++ __u32 ifHCOutOctets_h; /*!< byte counter of egress cells (upper 32 bits, total 64 bits) */ ++ __u32 ifHCOutOctets_l; /*!< byte counter of egress cells (lower 32 bits, total 64 bits) */ ++ __u32 ifInErrors; /*!< counter of error ingress cells */ ++ __u32 ifInUnknownProtos; /*!< counter of unknown ingress cells */ ++ __u32 ifOutErrors; /*!< counter of error egress cells */ ++} atm_cell_ifEntry_t; ++ ++/*! ++ \struct atm_aal5_ifEntry_t ++ \brief Structure used for AAL5 Frame Level MIB Counters. ++ ++ User application use this structure to call IOCTL command "PPE_ATM_MIB_AAL5". ++ */ ++typedef struct { ++ __u32 ifHCInOctets_h; /*!< byte counter of ingress packets (upper 32 bits, total 64 bits) */ ++ __u32 ifHCInOctets_l; /*!< byte counter of ingress packets (lower 32 bits, total 64 bits) */ ++ __u32 ifHCOutOctets_h; /*!< byte counter of egress packets (upper 32 bits, total 64 bits) */ ++ __u32 ifHCOutOctets_l; /*!< byte counter of egress packets (lower 32 bits, total 64 bits) */ ++ __u32 ifInUcastPkts; /*!< counter of ingress packets */ ++ __u32 ifOutUcastPkts; /*!< counter of egress packets */ ++ __u32 ifInErrors; /*!< counter of error ingress packets */ ++ __u32 ifInDiscards; /*!< counter of dropped ingress packets */ ++ __u32 ifOutErros; /*!< counter of error egress packets */ ++ __u32 ifOutDiscards; /*!< counter of dropped egress packets */ ++} atm_aal5_ifEntry_t; ++ ++/*! ++ \struct atm_aal5_vcc_t ++ \brief Structure used for per PVC AAL5 Frame Level MIB Counters. ++ ++ This structure is a part of structure "atm_aal5_vcc_x_t". ++ */ ++typedef struct { ++ __u32 aal5VccCrcErrors; /*!< counter of ingress packets with CRC error */ ++ __u32 aal5VccSarTimeOuts; /*!< counter of ingress packets with Re-assemble timeout */ //no timer support yet ++ __u32 aal5VccOverSizedSDUs; /*!< counter of oversized ingress packets */ ++} atm_aal5_vcc_t; ++ ++/*! ++ \struct atm_aal5_vcc_x_t ++ \brief Structure used for per PVC AAL5 Frame Level MIB Counters. ++ ++ User application use this structure to call IOCTL command "PPE_ATM_MIB_VCC". ++ */ ++typedef struct { ++ int vpi; /*!< VPI of the VCC to get MIB counters */ ++ int vci; /*!< VCI of the VCC to get MIB counters */ ++ atm_aal5_vcc_t mib_vcc; /*!< structure to get MIB counters */ ++} atm_aal5_vcc_x_t; ++ ++/*@}*/ ++ ++ ++ ++/* ++ * #################################### ++ * IOCTL ++ * #################################### ++ */ ++ ++/*! ++ \addtogroup IFX_ATM_IOCTL ++ */ ++/*@{*/ ++ ++/* ++ * ioctl Command ++ */ ++/*! ++ \brief ATM IOCTL Magic Number ++ */ ++#define PPE_ATM_IOC_MAGIC 'o' ++/*! ++ \brief ATM IOCTL Command - Get Cell Level MIB Counters ++ ++ This command is obsolete. User can get cell level MIB from DSL API. ++ This command uses structure "atm_cell_ifEntry_t" as parameter for output of MIB counters. ++ */ ++#define PPE_ATM_MIB_CELL _IOW(PPE_ATM_IOC_MAGIC, 0, atm_cell_ifEntry_t) ++/*! ++ \brief ATM IOCTL Command - Get AAL5 Level MIB Counters ++ ++ Get AAL5 packet counters. ++ This command uses structure "atm_aal5_ifEntry_t" as parameter for output of MIB counters. ++ */ ++#define PPE_ATM_MIB_AAL5 _IOW(PPE_ATM_IOC_MAGIC, 1, atm_aal5_ifEntry_t) ++/*! ++ \brief ATM IOCTL Command - Get Per PVC MIB Counters ++ ++ Get AAL5 packet counters for each PVC. ++ This command uses structure "atm_aal5_vcc_x_t" as parameter for input of VPI/VCI information and output of MIB counters. ++ */ ++#define PPE_ATM_MIB_VCC _IOWR(PPE_ATM_IOC_MAGIC, 2, atm_aal5_vcc_x_t) ++/*! ++ \brief Total Number of ATM IOCTL Commands ++ */ ++#define PPE_ATM_IOC_MAXNR 3 ++ ++/*@}*/ ++ ++ ++ ++/* ++ * #################################### ++ * API ++ * #################################### ++ */ ++ ++#ifdef __KERNEL__ ++struct port_cell_info { ++ unsigned int port_num; ++ unsigned int tx_link_rate[2]; ++}; ++#endif ++ ++ ++ ++#endif // IFX_ATM_H ++ +--- /dev/null ++++ b/arch/mips/include/asm/mach-lantiq/lantiq_ptm.h +@@ -0,0 +1,203 @@ ++/****************************************************************************** ++** ++** FILE NAME : ifx_ptm.h ++** PROJECT : UEIP ++** MODULES : PTM ++** ++** DATE : 17 Jun 2009 ++** AUTHOR : Xu Liang ++** DESCRIPTION : Global PTM driver header file ++** COPYRIGHT : Copyright (c) 2006 ++** Infineon Technologies AG ++** Am Campeon 1-12, 85579 Neubiberg, Germany ++** ++** This program is free software; you can redistribute it and/or modify ++** it under the terms of the GNU General Public License as published by ++** the Free Software Foundation; either version 2 of the License, or ++** (at your option) any later version. ++** ++** HISTORY ++** $Date $Author $Comment ++** 07 JUL 2009 Xu Liang Init Version ++*******************************************************************************/ ++ ++#ifndef IFX_PTM_H ++#define IFX_PTM_H ++ ++ ++ ++/*! ++ \defgroup IFX_PTM UEIP Project - PTM driver module ++ \brief UEIP Project - PTM driver module, support Danube, Amazon-SE, AR9, VR9. ++ */ ++ ++/*! ++ \defgroup IFX_PTM_IOCTL IOCTL Commands ++ \ingroup IFX_PTM ++ \brief IOCTL Commands used by user application. ++ */ ++ ++/*! ++ \defgroup IFX_PTM_STRUCT Structures ++ \ingroup IFX_PTM ++ \brief Structures used by user application. ++ */ ++ ++/*! ++ \file ifx_ptm.h ++ \ingroup IFX_PTM ++ \brief PTM driver header file ++ */ ++ ++ ++ ++/* ++ * #################################### ++ * Definition ++ * #################################### ++ */ ++ ++ ++ ++/* ++ * #################################### ++ * IOCTL ++ * #################################### ++ */ ++ ++/*! ++ \addtogroup IFX_PTM_IOCTL ++ */ ++/*@{*/ ++ ++/* ++ * ioctl Command ++ */ ++/*! ++ \brief PTM IOCTL Command - Get codeword MIB counters. ++ ++ This command uses structure "PTM_CW_IF_ENTRY_T" to get codeword level MIB counters. ++ */ ++#define IFX_PTM_MIB_CW_GET SIOCDEVPRIVATE + 1 ++/*! ++ \brief PTM IOCTL Command - Get packet MIB counters. ++ ++ This command uses structure "PTM_FRAME_MIB_T" to get packet level MIB counters. ++ */ ++#define IFX_PTM_MIB_FRAME_GET SIOCDEVPRIVATE + 2 ++/*! ++ \brief PTM IOCTL Command - Get firmware configuration (CRC). ++ ++ This command uses structure "IFX_PTM_CFG_T" to get firmware configuration (CRC). ++ */ ++#define IFX_PTM_CFG_GET SIOCDEVPRIVATE + 3 ++/*! ++ \brief PTM IOCTL Command - Set firmware configuration (CRC). ++ ++ This command uses structure "IFX_PTM_CFG_T" to set firmware configuration (CRC). ++ */ ++#define IFX_PTM_CFG_SET SIOCDEVPRIVATE + 4 ++/*! ++ \brief PTM IOCTL Command - Program priority value to TX queue mapping. ++ ++ This command uses structure "IFX_PTM_PRIO_Q_MAP_T" to program priority value to TX queue mapping. ++ */ ++#define IFX_PTM_MAP_PKT_PRIO_TO_Q SIOCDEVPRIVATE + 14 ++ ++/*@}*/ ++ ++ ++/*! ++ \addtogroup IFX_PTM_STRUCT ++ */ ++/*@{*/ ++ ++/* ++ * ioctl Data Type ++ */ ++ ++/*! ++ \typedef PTM_CW_IF_ENTRY_T ++ \brief Wrapping of structure "ptm_cw_ifEntry_t". ++ */ ++/*! ++ \struct ptm_cw_ifEntry_t ++ \brief Structure used for CodeWord level MIB counters. ++ */ ++typedef struct ptm_cw_ifEntry_t { ++ uint32_t ifRxNoIdleCodewords; /*!< output, number of ingress user codeword */ ++ uint32_t ifRxIdleCodewords; /*!< output, number of ingress idle codeword */ ++ uint32_t ifRxCodingViolation; /*!< output, number of error ingress codeword */ ++ uint32_t ifTxNoIdleCodewords; /*!< output, number of egress user codeword */ ++ uint32_t ifTxIdleCodewords; /*!< output, number of egress idle codeword */ ++} PTM_CW_IF_ENTRY_T; ++ ++/*! ++ \typedef PTM_FRAME_MIB_T ++ \brief Wrapping of structure "ptm_frame_mib_t". ++ */ ++/*! ++ \struct ptm_frame_mib_t ++ \brief Structure used for packet level MIB counters. ++ */ ++typedef struct ptm_frame_mib_t { ++ uint32_t RxCorrect; /*!< output, number of ingress packet */ ++ uint32_t TC_CrcError; /*!< output, number of egress packet with CRC error */ ++ uint32_t RxDropped; /*!< output, number of dropped ingress packet */ ++ uint32_t TxSend; /*!< output, number of egress packet */ ++} PTM_FRAME_MIB_T; ++ ++/*! ++ \typedef IFX_PTM_CFG_T ++ \brief Wrapping of structure "ptm_cfg_t". ++ */ ++/*! ++ \struct ptm_cfg_t ++ \brief Structure used for ETH/TC CRC configuration. ++ */ ++typedef struct ptm_cfg_t { ++ uint32_t RxEthCrcPresent; /*!< input/output, ingress packet has ETH CRC */ ++ uint32_t RxEthCrcCheck; /*!< input/output, check ETH CRC of ingress packet */ ++ uint32_t RxTcCrcCheck; /*!< input/output, check TC CRC of ingress codeword */ ++ uint32_t RxTcCrcLen; /*!< input/output, length of TC CRC of ingress codeword */ ++ uint32_t TxEthCrcGen; /*!< input/output, generate ETH CRC for egress packet */ ++ uint32_t TxTcCrcGen; /*!< input/output, generate TC CRC for egress codeword */ ++ uint32_t TxTcCrcLen; /*!< input/output, length of TC CRC of egress codeword */ ++} IFX_PTM_CFG_T; ++ ++/*! ++ \typedef IFX_PTM_PRIO_Q_MAP_T ++ \brief Wrapping of structure "ppe_prio_q_map". ++ */ ++/*! ++ \struct ppe_prio_q_map ++ \brief Structure used for Priority Value to TX Queue mapping. ++ */ ++typedef struct ppe_prio_q_map { ++ int pkt_prio; ++ int qid; ++ int vpi; // ignored in eth interface ++ int vci; // ignored in eth interface ++} IFX_PTM_PRIO_Q_MAP_T; ++ ++/*@}*/ ++ ++ ++ ++/* ++ * #################################### ++ * API ++ * #################################### ++ */ ++ ++#ifdef __KERNEL__ ++struct port_cell_info { ++ unsigned int port_num; ++ unsigned int tx_link_rate[2]; ++}; ++#endif ++ ++ ++ ++#endif // IFX_PTM_H ++ +--- a/arch/mips/lantiq/irq.c ++++ b/arch/mips/lantiq/irq.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -100,6 +101,7 @@ void ltq_mask_and_ack_irq(struct irq_dat + ltq_icu_w32(im, ltq_icu_r32(im, ier) & ~BIT(offset), ier); + ltq_icu_w32(im, BIT(offset), isr); + } ++EXPORT_SYMBOL(ltq_mask_and_ack_irq); + + static void ltq_ack_irq(struct irq_data *d) + { +--- a/arch/mips/mm/cache.c ++++ b/arch/mips/mm/cache.c +@@ -63,6 +63,8 @@ void (*_dma_cache_wback)(unsigned long s + void (*_dma_cache_inv)(unsigned long start, unsigned long size); + + EXPORT_SYMBOL(_dma_cache_wback_inv); ++EXPORT_SYMBOL(_dma_cache_wback); ++EXPORT_SYMBOL(_dma_cache_inv); + + #endif /* CONFIG_DMA_NONCOHERENT || CONFIG_DMA_MAYBE_COHERENT */ + +--- a/include/uapi/linux/atm.h ++++ b/include/uapi/linux/atm.h +@@ -130,8 +130,14 @@ + #define ATM_ABR 4 + #define ATM_ANYCLASS 5 /* compatible with everything */ + ++#define ATM_VBR_NRT ATM_VBR ++#define ATM_VBR_RT 6 ++#define ATM_UBR_PLUS 7 ++#define ATM_GFR 8 ++ + #define ATM_MAX_PCR -1 /* maximum available PCR */ + ++ + struct atm_trafprm { + unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ + int max_pcr; /* maximum PCR in cells per second */ +--- a/net/atm/common.c ++++ b/net/atm/common.c +@@ -62,11 +62,17 @@ static void vcc_remove_socket(struct soc + write_unlock_irq(&vcc_sklist_lock); + } + ++struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL; ++EXPORT_SYMBOL(ifx_atm_alloc_tx); ++ + static struct sk_buff *alloc_tx(struct atm_vcc *vcc, unsigned int size) + { + struct sk_buff *skb; + struct sock *sk = sk_atm(vcc); + ++ if (ifx_atm_alloc_tx != NULL) ++ return ifx_atm_alloc_tx(vcc, size); ++ + if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) { + pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n", + sk_wmem_alloc_get(sk), size, sk->sk_sndbuf); +--- a/net/atm/proc.c ++++ b/net/atm/proc.c +@@ -154,7 +154,7 @@ static void *vcc_seq_next(struct seq_fil + static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc) + { + static const char *const class_name[] = { +- "off", "UBR", "CBR", "VBR", "ABR"}; ++ "off","UBR","CBR","NTR-VBR","ABR","ANY","RT-VBR","UBR+","GFR"}; + static const char *const aal_name[] = { + "---", "1", "2", "3/4", /* 0- 3 */ + "???", "5", "???", "???", /* 4- 7 */ diff --git a/target/linux/lantiq/patches-4.9/0008-MIPS-lantiq-backport-old-timer-code.patch b/target/linux/lantiq/patches-4.9/0008-MIPS-lantiq-backport-old-timer-code.patch new file mode 100644 index 000000000..335a1e261 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0008-MIPS-lantiq-backport-old-timer-code.patch @@ -0,0 +1,1034 @@ +From 94800350cb8d2f29dda2206b5e9a3772024ee168 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 7 Aug 2014 18:30:56 +0200 +Subject: [PATCH 08/36] MIPS: lantiq: backport old timer code + +Signed-off-by: John Crispin +--- + arch/mips/include/asm/mach-lantiq/lantiq_timer.h | 155 ++++ + arch/mips/lantiq/xway/Makefile | 2 +- + arch/mips/lantiq/xway/timer.c | 845 ++++++++++++++++++++++ + 3 files changed, 1001 insertions(+), 1 deletion(-) + create mode 100644 arch/mips/include/asm/mach-lantiq/lantiq_timer.h + create mode 100644 arch/mips/lantiq/xway/timer.c + +--- /dev/null ++++ b/arch/mips/include/asm/mach-lantiq/lantiq_timer.h +@@ -0,0 +1,155 @@ ++#ifndef __DANUBE_GPTU_DEV_H__2005_07_26__10_19__ ++#define __DANUBE_GPTU_DEV_H__2005_07_26__10_19__ ++ ++ ++/****************************************************************************** ++ Copyright (c) 2002, Infineon Technologies. All rights reserved. ++ ++ No Warranty ++ Because the program is licensed free of charge, there is no warranty for ++ the program, to the extent permitted by applicable law. Except when ++ otherwise stated in writing the copyright holders and/or other parties ++ provide the program "as is" without warranty of any kind, either ++ expressed or implied, including, but not limited to, the implied ++ warranties of merchantability and fitness for a particular purpose. The ++ entire risk as to the quality and performance of the program is with ++ you. should the program prove defective, you assume the cost of all ++ necessary servicing, repair or correction. ++ ++ In no event unless required by applicable law or agreed to in writing ++ will any copyright holder, or any other party who may modify and/or ++ redistribute the program as permitted above, be liable to you for ++ damages, including any general, special, incidental or consequential ++ damages arising out of the use or inability to use the program ++ (including but not limited to loss of data or data being rendered ++ inaccurate or losses sustained by you or third parties or a failure of ++ the program to operate with any other programs), even if such holder or ++ other party has been advised of the possibility of such damages. ++******************************************************************************/ ++ ++ ++/* ++ * #################################### ++ * Definition ++ * #################################### ++ */ ++ ++/* ++ * Available Timer/Counter Index ++ */ ++#define TIMER(n, X) (n * 2 + (X ? 1 : 0)) ++#define TIMER_ANY 0x00 ++#define TIMER1A TIMER(1, 0) ++#define TIMER1B TIMER(1, 1) ++#define TIMER2A TIMER(2, 0) ++#define TIMER2B TIMER(2, 1) ++#define TIMER3A TIMER(3, 0) ++#define TIMER3B TIMER(3, 1) ++ ++/* ++ * Flag of Timer/Counter ++ * These flags specify the way in which timer is configured. ++ */ ++/* Bit size of timer/counter. */ ++#define TIMER_FLAG_16BIT 0x0000 ++#define TIMER_FLAG_32BIT 0x0001 ++/* Switch between timer and counter. */ ++#define TIMER_FLAG_TIMER 0x0000 ++#define TIMER_FLAG_COUNTER 0x0002 ++/* Stop or continue when overflowing/underflowing. */ ++#define TIMER_FLAG_ONCE 0x0000 ++#define TIMER_FLAG_CYCLIC 0x0004 ++/* Count up or counter down. */ ++#define TIMER_FLAG_UP 0x0000 ++#define TIMER_FLAG_DOWN 0x0008 ++/* Count on specific level or edge. */ ++#define TIMER_FLAG_HIGH_LEVEL_SENSITIVE 0x0000 ++#define TIMER_FLAG_LOW_LEVEL_SENSITIVE 0x0040 ++#define TIMER_FLAG_RISE_EDGE 0x0010 ++#define TIMER_FLAG_FALL_EDGE 0x0020 ++#define TIMER_FLAG_ANY_EDGE 0x0030 ++/* Signal is syncronous to module clock or not. */ ++#define TIMER_FLAG_UNSYNC 0x0000 ++#define TIMER_FLAG_SYNC 0x0080 ++/* Different interrupt handle type. */ ++#define TIMER_FLAG_NO_HANDLE 0x0000 ++#if defined(__KERNEL__) ++ #define TIMER_FLAG_CALLBACK_IN_IRQ 0x0100 ++#endif // defined(__KERNEL__) ++#define TIMER_FLAG_SIGNAL 0x0300 ++/* Internal clock source or external clock source */ ++#define TIMER_FLAG_INT_SRC 0x0000 ++#define TIMER_FLAG_EXT_SRC 0x1000 ++ ++ ++/* ++ * ioctl Command ++ */ ++#define GPTU_REQUEST_TIMER 0x01 /* General method to setup timer/counter. */ ++#define GPTU_FREE_TIMER 0x02 /* Free timer/counter. */ ++#define GPTU_START_TIMER 0x03 /* Start or resume timer/counter. */ ++#define GPTU_STOP_TIMER 0x04 /* Suspend timer/counter. */ ++#define GPTU_GET_COUNT_VALUE 0x05 /* Get current count value. */ ++#define GPTU_CALCULATE_DIVIDER 0x06 /* Calculate timer divider from given freq.*/ ++#define GPTU_SET_TIMER 0x07 /* Simplified method to setup timer. */ ++#define GPTU_SET_COUNTER 0x08 /* Simplified method to setup counter. */ ++ ++/* ++ * Data Type Used to Call ioctl ++ */ ++struct gptu_ioctl_param { ++ unsigned int timer; /* In command GPTU_REQUEST_TIMER, GPTU_SET_TIMER, and * ++ * GPTU_SET_COUNTER, this field is ID of expected * ++ * timer/counter. If it's zero, a timer/counter would * ++ * be dynamically allocated and ID would be stored in * ++ * this field. * ++ * In command GPTU_GET_COUNT_VALUE, this field is * ++ * ignored. * ++ * In other command, this field is ID of timer/counter * ++ * allocated. */ ++ unsigned int flag; /* In command GPTU_REQUEST_TIMER, GPTU_SET_TIMER, and * ++ * GPTU_SET_COUNTER, this field contains flags to * ++ * specify how to configure timer/counter. * ++ * In command GPTU_START_TIMER, zero indicate start * ++ * and non-zero indicate resume timer/counter. * ++ * In other command, this field is ignored. */ ++ unsigned long value; /* In command GPTU_REQUEST_TIMER, this field contains * ++ * init/reload value. * ++ * In command GPTU_SET_TIMER, this field contains * ++ * frequency (0.001Hz) of timer. * ++ * In command GPTU_GET_COUNT_VALUE, current count * ++ * value would be stored in this field. * ++ * In command GPTU_CALCULATE_DIVIDER, this field * ++ * contains frequency wanted, and after calculation, * ++ * divider would be stored in this field to overwrite * ++ * the frequency. * ++ * In other command, this field is ignored. */ ++ int pid; /* In command GPTU_REQUEST_TIMER and GPTU_SET_TIMER, * ++ * if signal is required, this field contains process * ++ * ID to which signal would be sent. * ++ * In other command, this field is ignored. */ ++ int sig; /* In command GPTU_REQUEST_TIMER and GPTU_SET_TIMER, * ++ * if signal is required, this field contains signal * ++ * number which would be sent. * ++ * In other command, this field is ignored. */ ++}; ++ ++/* ++ * #################################### ++ * Data Type ++ * #################################### ++ */ ++typedef void (*timer_callback)(unsigned long arg); ++ ++extern int lq_request_timer(unsigned int, unsigned int, unsigned long, unsigned long, unsigned long); ++extern int lq_free_timer(unsigned int); ++extern int lq_start_timer(unsigned int, int); ++extern int lq_stop_timer(unsigned int); ++extern int lq_reset_counter_flags(u32 timer, u32 flags); ++extern int lq_get_count_value(unsigned int, unsigned long *); ++extern u32 lq_cal_divider(unsigned long); ++extern int lq_set_timer(unsigned int, unsigned int, int, int, unsigned int, unsigned long, unsigned long); ++extern int lq_set_counter(unsigned int timer, unsigned int flag, ++ u32 reload, unsigned long arg1, unsigned long arg2); ++ ++#endif /* __DANUBE_GPTU_DEV_H__2005_07_26__10_19__ */ +--- a/arch/mips/lantiq/xway/Makefile ++++ b/arch/mips/lantiq/xway/Makefile +@@ -1,4 +1,10 @@ +-obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o ++obj-y := prom.o sysctrl.o clk.o reset.o dma.o dcdc.o ++ ++ifdef CONFIG_SOC_AMAZON_SE ++obj-y += gptu.o ++else ++obj-y += timer.o ++endif + + obj-y += vmmc.o + +--- /dev/null ++++ b/arch/mips/lantiq/xway/timer.c +@@ -0,0 +1,845 @@ ++#ifndef CONFIG_SOC_AMAZON_SE ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include "../clk.h" ++ ++#include ++#include ++#include ++ ++#define MAX_NUM_OF_32BIT_TIMER_BLOCKS 6 ++ ++#ifdef TIMER1A ++#define FIRST_TIMER TIMER1A ++#else ++#define FIRST_TIMER 2 ++#endif ++ ++/* ++ * GPTC divider is set or not. ++ */ ++#define GPTU_CLC_RMC_IS_SET 0 ++ ++/* ++ * Timer Interrupt (IRQ) ++ */ ++/* Must be adjusted when ICU driver is available */ ++#define TIMER_INTERRUPT (INT_NUM_IM3_IRL0 + 22) ++ ++/* ++ * Bits Operation ++ */ ++#define GET_BITS(x, msb, lsb) \ ++ (((x) & ((1 << ((msb) + 1)) - 1)) >> (lsb)) ++#define SET_BITS(x, msb, lsb, value) \ ++ (((x) & ~(((1 << ((msb) + 1)) - 1) ^ ((1 << (lsb)) - 1))) | \ ++ (((value) & ((1 << (1 + (msb) - (lsb))) - 1)) << (lsb))) ++ ++/* ++ * GPTU Register Mapping ++ */ ++#define LQ_GPTU (KSEG1 + 0x1E100A00) ++#define LQ_GPTU_CLC ((volatile u32 *)(LQ_GPTU + 0x0000)) ++#define LQ_GPTU_ID ((volatile u32 *)(LQ_GPTU + 0x0008)) ++#define LQ_GPTU_CON(n, X) ((volatile u32 *)(LQ_GPTU + 0x0010 + ((X) * 4) + ((n) - 1) * 0x0020)) /* X must be either A or B */ ++#define LQ_GPTU_RUN(n, X) ((volatile u32 *)(LQ_GPTU + 0x0018 + ((X) * 4) + ((n) - 1) * 0x0020)) /* X must be either A or B */ ++#define LQ_GPTU_RELOAD(n, X) ((volatile u32 *)(LQ_GPTU + 0x0020 + ((X) * 4) + ((n) - 1) * 0x0020)) /* X must be either A or B */ ++#define LQ_GPTU_COUNT(n, X) ((volatile u32 *)(LQ_GPTU + 0x0028 + ((X) * 4) + ((n) - 1) * 0x0020)) /* X must be either A or B */ ++#define LQ_GPTU_IRNEN ((volatile u32 *)(LQ_GPTU + 0x00F4)) ++#define LQ_GPTU_IRNICR ((volatile u32 *)(LQ_GPTU + 0x00F8)) ++#define LQ_GPTU_IRNCR ((volatile u32 *)(LQ_GPTU + 0x00FC)) ++ ++/* ++ * Clock Control Register ++ */ ++#define GPTU_CLC_SMC GET_BITS(*LQ_GPTU_CLC, 23, 16) ++#define GPTU_CLC_RMC GET_BITS(*LQ_GPTU_CLC, 15, 8) ++#define GPTU_CLC_FSOE (*LQ_GPTU_CLC & (1 << 5)) ++#define GPTU_CLC_EDIS (*LQ_GPTU_CLC & (1 << 3)) ++#define GPTU_CLC_SPEN (*LQ_GPTU_CLC & (1 << 2)) ++#define GPTU_CLC_DISS (*LQ_GPTU_CLC & (1 << 1)) ++#define GPTU_CLC_DISR (*LQ_GPTU_CLC & (1 << 0)) ++ ++#define GPTU_CLC_SMC_SET(value) SET_BITS(0, 23, 16, (value)) ++#define GPTU_CLC_RMC_SET(value) SET_BITS(0, 15, 8, (value)) ++#define GPTU_CLC_FSOE_SET(value) ((value) ? (1 << 5) : 0) ++#define GPTU_CLC_SBWE_SET(value) ((value) ? (1 << 4) : 0) ++#define GPTU_CLC_EDIS_SET(value) ((value) ? (1 << 3) : 0) ++#define GPTU_CLC_SPEN_SET(value) ((value) ? (1 << 2) : 0) ++#define GPTU_CLC_DISR_SET(value) ((value) ? (1 << 0) : 0) ++ ++/* ++ * ID Register ++ */ ++#define GPTU_ID_ID GET_BITS(*LQ_GPTU_ID, 15, 8) ++#define GPTU_ID_CFG GET_BITS(*LQ_GPTU_ID, 7, 5) ++#define GPTU_ID_REV GET_BITS(*LQ_GPTU_ID, 4, 0) ++ ++/* ++ * Control Register of Timer/Counter nX ++ * n is the index of block (1 based index) ++ * X is either A or B ++ */ ++#define GPTU_CON_SRC_EG(n, X) (*LQ_GPTU_CON(n, X) & (1 << 10)) ++#define GPTU_CON_SRC_EXT(n, X) (*LQ_GPTU_CON(n, X) & (1 << 9)) ++#define GPTU_CON_SYNC(n, X) (*LQ_GPTU_CON(n, X) & (1 << 8)) ++#define GPTU_CON_EDGE(n, X) GET_BITS(*LQ_GPTU_CON(n, X), 7, 6) ++#define GPTU_CON_INV(n, X) (*LQ_GPTU_CON(n, X) & (1 << 5)) ++#define GPTU_CON_EXT(n, X) (*LQ_GPTU_CON(n, A) & (1 << 4)) /* Timer/Counter B does not have this bit */ ++#define GPTU_CON_STP(n, X) (*LQ_GPTU_CON(n, X) & (1 << 3)) ++#define GPTU_CON_CNT(n, X) (*LQ_GPTU_CON(n, X) & (1 << 2)) ++#define GPTU_CON_DIR(n, X) (*LQ_GPTU_CON(n, X) & (1 << 1)) ++#define GPTU_CON_EN(n, X) (*LQ_GPTU_CON(n, X) & (1 << 0)) ++ ++#define GPTU_CON_SRC_EG_SET(value) ((value) ? 0 : (1 << 10)) ++#define GPTU_CON_SRC_EXT_SET(value) ((value) ? (1 << 9) : 0) ++#define GPTU_CON_SYNC_SET(value) ((value) ? (1 << 8) : 0) ++#define GPTU_CON_EDGE_SET(value) SET_BITS(0, 7, 6, (value)) ++#define GPTU_CON_INV_SET(value) ((value) ? (1 << 5) : 0) ++#define GPTU_CON_EXT_SET(value) ((value) ? (1 << 4) : 0) ++#define GPTU_CON_STP_SET(value) ((value) ? (1 << 3) : 0) ++#define GPTU_CON_CNT_SET(value) ((value) ? (1 << 2) : 0) ++#define GPTU_CON_DIR_SET(value) ((value) ? (1 << 1) : 0) ++ ++#define GPTU_RUN_RL_SET(value) ((value) ? (1 << 2) : 0) ++#define GPTU_RUN_CEN_SET(value) ((value) ? (1 << 1) : 0) ++#define GPTU_RUN_SEN_SET(value) ((value) ? (1 << 0) : 0) ++ ++#define GPTU_IRNEN_TC_SET(n, X, value) ((value) ? (1 << (((n) - 1) * 2 + (X))) : 0) ++#define GPTU_IRNCR_TC_SET(n, X, value) ((value) ? (1 << (((n) - 1) * 2 + (X))) : 0) ++ ++#define TIMER_FLAG_MASK_SIZE(x) (x & 0x0001) ++#define TIMER_FLAG_MASK_TYPE(x) (x & 0x0002) ++#define TIMER_FLAG_MASK_STOP(x) (x & 0x0004) ++#define TIMER_FLAG_MASK_DIR(x) (x & 0x0008) ++#define TIMER_FLAG_NONE_EDGE 0x0000 ++#define TIMER_FLAG_MASK_EDGE(x) (x & 0x0030) ++#define TIMER_FLAG_REAL 0x0000 ++#define TIMER_FLAG_INVERT 0x0040 ++#define TIMER_FLAG_MASK_INVERT(x) (x & 0x0040) ++#define TIMER_FLAG_MASK_TRIGGER(x) (x & 0x0070) ++#define TIMER_FLAG_MASK_SYNC(x) (x & 0x0080) ++#define TIMER_FLAG_CALLBACK_IN_HB 0x0200 ++#define TIMER_FLAG_MASK_HANDLE(x) (x & 0x0300) ++#define TIMER_FLAG_MASK_SRC(x) (x & 0x1000) ++ ++struct timer_dev_timer { ++ unsigned int f_irq_on; ++ unsigned int irq; ++ unsigned int flag; ++ unsigned long arg1; ++ unsigned long arg2; ++}; ++ ++struct timer_dev { ++ struct mutex gptu_mutex; ++ unsigned int number_of_timers; ++ unsigned int occupation; ++ unsigned int f_gptu_on; ++ struct timer_dev_timer timer[MAX_NUM_OF_32BIT_TIMER_BLOCKS * 2]; ++}; ++ ++ ++unsigned int ltq_get_fpi_bus_clock(int fpi) { ++ struct clk *clk = clk_get_fpi(); ++ return clk_get_rate(clk); ++} ++ ++ ++static long gptu_ioctl(struct file *, unsigned int, unsigned long); ++static int gptu_open(struct inode *, struct file *); ++static int gptu_release(struct inode *, struct file *); ++ ++static struct file_operations gptu_fops = { ++ .owner = THIS_MODULE, ++ .unlocked_ioctl = gptu_ioctl, ++ .open = gptu_open, ++ .release = gptu_release ++}; ++ ++static struct miscdevice gptu_miscdev = { ++ .minor = MISC_DYNAMIC_MINOR, ++ .name = "gptu", ++ .fops = &gptu_fops, ++}; ++ ++static struct timer_dev timer_dev; ++ ++static irqreturn_t timer_irq_handler(int irq, void *p) ++{ ++ unsigned int timer; ++ unsigned int flag; ++ struct timer_dev_timer *dev_timer = (struct timer_dev_timer *)p; ++ ++ timer = irq - TIMER_INTERRUPT; ++ if (timer < timer_dev.number_of_timers ++ && dev_timer == &timer_dev.timer[timer]) { ++ /* Clear interrupt. */ ++ ltq_w32(1 << timer, LQ_GPTU_IRNCR); ++ ++ /* Call user hanler or signal. */ ++ flag = dev_timer->flag; ++ if (!(timer & 0x01) ++ || TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT) { ++ /* 16-bit timer or timer A of 32-bit timer */ ++ switch (TIMER_FLAG_MASK_HANDLE(flag)) { ++ case TIMER_FLAG_CALLBACK_IN_IRQ: ++ case TIMER_FLAG_CALLBACK_IN_HB: ++ if (dev_timer->arg1) ++ (*(timer_callback)dev_timer->arg1)(dev_timer->arg2); ++ break; ++ case TIMER_FLAG_SIGNAL: ++ send_sig((int)dev_timer->arg2, (struct task_struct *)dev_timer->arg1, 0); ++ break; ++ } ++ } ++ } ++ return IRQ_HANDLED; ++} ++ ++static inline void lq_enable_gptu(void) ++{ ++ struct clk *clk = clk_get_sys("1e100a00.gptu", NULL); ++ clk_enable(clk); ++ ++ //ltq_pmu_enable(PMU_GPT); ++ ++ /* Set divider as 1, disable write protection for SPEN, enable module. */ ++ *LQ_GPTU_CLC = ++ GPTU_CLC_SMC_SET(0x00) | ++ GPTU_CLC_RMC_SET(0x01) | ++ GPTU_CLC_FSOE_SET(0) | ++ GPTU_CLC_SBWE_SET(1) | ++ GPTU_CLC_EDIS_SET(0) | ++ GPTU_CLC_SPEN_SET(0) | ++ GPTU_CLC_DISR_SET(0); ++} ++ ++static inline void lq_disable_gptu(void) ++{ ++ struct clk *clk = clk_get_sys("1e100a00.gptu", NULL); ++ ltq_w32(0x00, LQ_GPTU_IRNEN); ++ ltq_w32(0xfff, LQ_GPTU_IRNCR); ++ ++ /* Set divider as 0, enable write protection for SPEN, disable module. */ ++ *LQ_GPTU_CLC = ++ GPTU_CLC_SMC_SET(0x00) | ++ GPTU_CLC_RMC_SET(0x00) | ++ GPTU_CLC_FSOE_SET(0) | ++ GPTU_CLC_SBWE_SET(0) | ++ GPTU_CLC_EDIS_SET(0) | ++ GPTU_CLC_SPEN_SET(0) | ++ GPTU_CLC_DISR_SET(1); ++ ++ clk_enable(clk); ++} ++ ++int lq_request_timer(unsigned int timer, unsigned int flag, ++ unsigned long value, unsigned long arg1, unsigned long arg2) ++{ ++ int ret = 0; ++ unsigned int con_reg, irnen_reg; ++ int n, X; ++ ++ if (timer >= FIRST_TIMER + timer_dev.number_of_timers) ++ return -EINVAL; ++ ++ printk(KERN_INFO "request_timer(%d, 0x%08X, %lu)...", ++ timer, flag, value); ++ ++ if (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT) ++ value &= 0xFFFF; ++ else ++ timer &= ~0x01; ++ ++ mutex_lock(&timer_dev.gptu_mutex); ++ ++ /* ++ * Allocate timer. ++ */ ++ if (timer < FIRST_TIMER) { ++ unsigned int mask; ++ unsigned int shift; ++ /* This takes care of TIMER1B which is the only choice for Voice TAPI system */ ++ unsigned int offset = TIMER2A; ++ ++ /* ++ * Pick up a free timer. ++ */ ++ if (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT) { ++ mask = 1 << offset; ++ shift = 1; ++ } else { ++ mask = 3 << offset; ++ shift = 2; ++ } ++ for (timer = offset; ++ timer < offset + timer_dev.number_of_timers; ++ timer += shift, mask <<= shift) ++ if (!(timer_dev.occupation & mask)) { ++ timer_dev.occupation |= mask; ++ break; ++ } ++ if (timer >= offset + timer_dev.number_of_timers) { ++ printk("failed![%d]\n", __LINE__); ++ mutex_unlock(&timer_dev.gptu_mutex); ++ return -EINVAL; ++ } else ++ ret = timer; ++ } else { ++ register unsigned int mask; ++ ++ /* ++ * Check if the requested timer is free. ++ */ ++ mask = (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; ++ if ((timer_dev.occupation & mask)) { ++ printk("failed![%d] mask %#x, timer_dev.occupation %#x\n", ++ __LINE__, mask, timer_dev.occupation); ++ mutex_unlock(&timer_dev.gptu_mutex); ++ return -EBUSY; ++ } else { ++ timer_dev.occupation |= mask; ++ ret = 0; ++ } ++ } ++ ++ /* ++ * Prepare control register value. ++ */ ++ switch (TIMER_FLAG_MASK_EDGE(flag)) { ++ default: ++ case TIMER_FLAG_NONE_EDGE: ++ con_reg = GPTU_CON_EDGE_SET(0x00); ++ break; ++ case TIMER_FLAG_RISE_EDGE: ++ con_reg = GPTU_CON_EDGE_SET(0x01); ++ break; ++ case TIMER_FLAG_FALL_EDGE: ++ con_reg = GPTU_CON_EDGE_SET(0x02); ++ break; ++ case TIMER_FLAG_ANY_EDGE: ++ con_reg = GPTU_CON_EDGE_SET(0x03); ++ break; ++ } ++ if (TIMER_FLAG_MASK_TYPE(flag) == TIMER_FLAG_TIMER) ++ con_reg |= ++ TIMER_FLAG_MASK_SRC(flag) == ++ TIMER_FLAG_EXT_SRC ? GPTU_CON_SRC_EXT_SET(1) : ++ GPTU_CON_SRC_EXT_SET(0); ++ else ++ con_reg |= ++ TIMER_FLAG_MASK_SRC(flag) == ++ TIMER_FLAG_EXT_SRC ? GPTU_CON_SRC_EG_SET(1) : ++ GPTU_CON_SRC_EG_SET(0); ++ con_reg |= ++ TIMER_FLAG_MASK_SYNC(flag) == ++ TIMER_FLAG_UNSYNC ? GPTU_CON_SYNC_SET(0) : ++ GPTU_CON_SYNC_SET(1); ++ con_reg |= ++ TIMER_FLAG_MASK_INVERT(flag) == ++ TIMER_FLAG_REAL ? GPTU_CON_INV_SET(0) : GPTU_CON_INV_SET(1); ++ con_reg |= ++ TIMER_FLAG_MASK_SIZE(flag) == ++ TIMER_FLAG_16BIT ? GPTU_CON_EXT_SET(0) : ++ GPTU_CON_EXT_SET(1); ++ con_reg |= ++ TIMER_FLAG_MASK_STOP(flag) == ++ TIMER_FLAG_ONCE ? GPTU_CON_STP_SET(1) : GPTU_CON_STP_SET(0); ++ con_reg |= ++ TIMER_FLAG_MASK_TYPE(flag) == ++ TIMER_FLAG_TIMER ? GPTU_CON_CNT_SET(0) : ++ GPTU_CON_CNT_SET(1); ++ con_reg |= ++ TIMER_FLAG_MASK_DIR(flag) == ++ TIMER_FLAG_UP ? GPTU_CON_DIR_SET(1) : GPTU_CON_DIR_SET(0); ++ ++ /* ++ * Fill up running data. ++ */ ++ timer_dev.timer[timer - FIRST_TIMER].flag = flag; ++ timer_dev.timer[timer - FIRST_TIMER].arg1 = arg1; ++ timer_dev.timer[timer - FIRST_TIMER].arg2 = arg2; ++ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) ++ timer_dev.timer[timer - FIRST_TIMER + 1].flag = flag; ++ ++ /* ++ * Enable GPTU module. ++ */ ++ if (!timer_dev.f_gptu_on) { ++ lq_enable_gptu(); ++ timer_dev.f_gptu_on = 1; ++ } ++ ++ /* ++ * Enable IRQ. ++ */ ++ if (TIMER_FLAG_MASK_HANDLE(flag) != TIMER_FLAG_NO_HANDLE) { ++ if (TIMER_FLAG_MASK_HANDLE(flag) == TIMER_FLAG_SIGNAL) ++ timer_dev.timer[timer - FIRST_TIMER].arg1 = ++ (unsigned long) find_task_by_vpid((int) arg1); ++ ++ irnen_reg = 1 << (timer - FIRST_TIMER); ++ ++ if (TIMER_FLAG_MASK_HANDLE(flag) == TIMER_FLAG_SIGNAL ++ || (TIMER_FLAG_MASK_HANDLE(flag) == ++ TIMER_FLAG_CALLBACK_IN_IRQ ++ && timer_dev.timer[timer - FIRST_TIMER].arg1)) { ++ enable_irq(timer_dev.timer[timer - FIRST_TIMER].irq); ++ timer_dev.timer[timer - FIRST_TIMER].f_irq_on = 1; ++ } ++ } else ++ irnen_reg = 0; ++ ++ /* ++ * Write config register, reload value and enable interrupt. ++ */ ++ n = timer >> 1; ++ X = timer & 0x01; ++ *LQ_GPTU_CON(n, X) = con_reg; ++ *LQ_GPTU_RELOAD(n, X) = value; ++ /* printk("reload value = %d\n", (u32)value); */ ++ *LQ_GPTU_IRNEN |= irnen_reg; ++ ++ mutex_unlock(&timer_dev.gptu_mutex); ++ printk("successful!\n"); ++ return ret; ++} ++EXPORT_SYMBOL(lq_request_timer); ++ ++int lq_free_timer(unsigned int timer) ++{ ++ unsigned int flag; ++ unsigned int mask; ++ int n, X; ++ ++ if (!timer_dev.f_gptu_on) ++ return -EINVAL; ++ ++ if (timer < FIRST_TIMER || timer >= FIRST_TIMER + timer_dev.number_of_timers) ++ return -EINVAL; ++ ++ mutex_lock(&timer_dev.gptu_mutex); ++ ++ flag = timer_dev.timer[timer - FIRST_TIMER].flag; ++ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) ++ timer &= ~0x01; ++ ++ mask = (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; ++ if (((timer_dev.occupation & mask) ^ mask)) { ++ mutex_unlock(&timer_dev.gptu_mutex); ++ return -EINVAL; ++ } ++ ++ n = timer >> 1; ++ X = timer & 0x01; ++ ++ if (GPTU_CON_EN(n, X)) ++ *LQ_GPTU_RUN(n, X) = GPTU_RUN_CEN_SET(1); ++ ++ *LQ_GPTU_IRNEN &= ~GPTU_IRNEN_TC_SET(n, X, 1); ++ *LQ_GPTU_IRNCR |= GPTU_IRNCR_TC_SET(n, X, 1); ++ ++ if (timer_dev.timer[timer - FIRST_TIMER].f_irq_on) { ++ disable_irq(timer_dev.timer[timer - FIRST_TIMER].irq); ++ timer_dev.timer[timer - FIRST_TIMER].f_irq_on = 0; ++ } ++ ++ timer_dev.occupation &= ~mask; ++ if (!timer_dev.occupation && timer_dev.f_gptu_on) { ++ lq_disable_gptu(); ++ timer_dev.f_gptu_on = 0; ++ } ++ ++ mutex_unlock(&timer_dev.gptu_mutex); ++ ++ return 0; ++} ++EXPORT_SYMBOL(lq_free_timer); ++ ++int lq_start_timer(unsigned int timer, int is_resume) ++{ ++ unsigned int flag; ++ unsigned int mask; ++ int n, X; ++ ++ if (!timer_dev.f_gptu_on) ++ return -EINVAL; ++ ++ if (timer < FIRST_TIMER || timer >= FIRST_TIMER + timer_dev.number_of_timers) ++ return -EINVAL; ++ ++ mutex_lock(&timer_dev.gptu_mutex); ++ ++ flag = timer_dev.timer[timer - FIRST_TIMER].flag; ++ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) ++ timer &= ~0x01; ++ ++ mask = (TIMER_FLAG_MASK_SIZE(flag) == ++ TIMER_FLAG_16BIT ? 1 : 3) << timer; ++ if (((timer_dev.occupation & mask) ^ mask)) { ++ mutex_unlock(&timer_dev.gptu_mutex); ++ return -EINVAL; ++ } ++ ++ n = timer >> 1; ++ X = timer & 0x01; ++ ++ *LQ_GPTU_RUN(n, X) = GPTU_RUN_RL_SET(!is_resume) | GPTU_RUN_SEN_SET(1); ++ ++ ++ mutex_unlock(&timer_dev.gptu_mutex); ++ ++ return 0; ++} ++EXPORT_SYMBOL(lq_start_timer); ++ ++int lq_stop_timer(unsigned int timer) ++{ ++ unsigned int flag; ++ unsigned int mask; ++ int n, X; ++ ++ if (!timer_dev.f_gptu_on) ++ return -EINVAL; ++ ++ if (timer < FIRST_TIMER ++ || timer >= FIRST_TIMER + timer_dev.number_of_timers) ++ return -EINVAL; ++ ++ mutex_lock(&timer_dev.gptu_mutex); ++ ++ flag = timer_dev.timer[timer - FIRST_TIMER].flag; ++ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) ++ timer &= ~0x01; ++ ++ mask = (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; ++ if (((timer_dev.occupation & mask) ^ mask)) { ++ mutex_unlock(&timer_dev.gptu_mutex); ++ return -EINVAL; ++ } ++ ++ n = timer >> 1; ++ X = timer & 0x01; ++ ++ *LQ_GPTU_RUN(n, X) = GPTU_RUN_CEN_SET(1); ++ ++ mutex_unlock(&timer_dev.gptu_mutex); ++ ++ return 0; ++} ++EXPORT_SYMBOL(lq_stop_timer); ++ ++int lq_reset_counter_flags(u32 timer, u32 flags) ++{ ++ unsigned int oflag; ++ unsigned int mask, con_reg; ++ int n, X; ++ ++ if (!timer_dev.f_gptu_on) ++ return -EINVAL; ++ ++ if (timer < FIRST_TIMER || timer >= FIRST_TIMER + timer_dev.number_of_timers) ++ return -EINVAL; ++ ++ mutex_lock(&timer_dev.gptu_mutex); ++ ++ oflag = timer_dev.timer[timer - FIRST_TIMER].flag; ++ if (TIMER_FLAG_MASK_SIZE(oflag) != TIMER_FLAG_16BIT) ++ timer &= ~0x01; ++ ++ mask = (TIMER_FLAG_MASK_SIZE(oflag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; ++ if (((timer_dev.occupation & mask) ^ mask)) { ++ mutex_unlock(&timer_dev.gptu_mutex); ++ return -EINVAL; ++ } ++ ++ switch (TIMER_FLAG_MASK_EDGE(flags)) { ++ default: ++ case TIMER_FLAG_NONE_EDGE: ++ con_reg = GPTU_CON_EDGE_SET(0x00); ++ break; ++ case TIMER_FLAG_RISE_EDGE: ++ con_reg = GPTU_CON_EDGE_SET(0x01); ++ break; ++ case TIMER_FLAG_FALL_EDGE: ++ con_reg = GPTU_CON_EDGE_SET(0x02); ++ break; ++ case TIMER_FLAG_ANY_EDGE: ++ con_reg = GPTU_CON_EDGE_SET(0x03); ++ break; ++ } ++ if (TIMER_FLAG_MASK_TYPE(flags) == TIMER_FLAG_TIMER) ++ con_reg |= TIMER_FLAG_MASK_SRC(flags) == TIMER_FLAG_EXT_SRC ? GPTU_CON_SRC_EXT_SET(1) : GPTU_CON_SRC_EXT_SET(0); ++ else ++ con_reg |= TIMER_FLAG_MASK_SRC(flags) == TIMER_FLAG_EXT_SRC ? GPTU_CON_SRC_EG_SET(1) : GPTU_CON_SRC_EG_SET(0); ++ con_reg |= TIMER_FLAG_MASK_SYNC(flags) == TIMER_FLAG_UNSYNC ? GPTU_CON_SYNC_SET(0) : GPTU_CON_SYNC_SET(1); ++ con_reg |= TIMER_FLAG_MASK_INVERT(flags) == TIMER_FLAG_REAL ? GPTU_CON_INV_SET(0) : GPTU_CON_INV_SET(1); ++ con_reg |= TIMER_FLAG_MASK_SIZE(flags) == TIMER_FLAG_16BIT ? GPTU_CON_EXT_SET(0) : GPTU_CON_EXT_SET(1); ++ con_reg |= TIMER_FLAG_MASK_STOP(flags) == TIMER_FLAG_ONCE ? GPTU_CON_STP_SET(1) : GPTU_CON_STP_SET(0); ++ con_reg |= TIMER_FLAG_MASK_TYPE(flags) == TIMER_FLAG_TIMER ? GPTU_CON_CNT_SET(0) : GPTU_CON_CNT_SET(1); ++ con_reg |= TIMER_FLAG_MASK_DIR(flags) == TIMER_FLAG_UP ? GPTU_CON_DIR_SET(1) : GPTU_CON_DIR_SET(0); ++ ++ timer_dev.timer[timer - FIRST_TIMER].flag = flags; ++ if (TIMER_FLAG_MASK_SIZE(flags) != TIMER_FLAG_16BIT) ++ timer_dev.timer[timer - FIRST_TIMER + 1].flag = flags; ++ ++ n = timer >> 1; ++ X = timer & 0x01; ++ ++ *LQ_GPTU_CON(n, X) = con_reg; ++ smp_wmb(); ++ mutex_unlock(&timer_dev.gptu_mutex); ++ return 0; ++} ++EXPORT_SYMBOL(lq_reset_counter_flags); ++ ++int lq_get_count_value(unsigned int timer, unsigned long *value) ++{ ++ unsigned int flag; ++ unsigned int mask; ++ int n, X; ++ ++ if (!timer_dev.f_gptu_on) ++ return -EINVAL; ++ ++ if (timer < FIRST_TIMER ++ || timer >= FIRST_TIMER + timer_dev.number_of_timers) ++ return -EINVAL; ++ ++ mutex_lock(&timer_dev.gptu_mutex); ++ ++ flag = timer_dev.timer[timer - FIRST_TIMER].flag; ++ if (TIMER_FLAG_MASK_SIZE(flag) != TIMER_FLAG_16BIT) ++ timer &= ~0x01; ++ ++ mask = (TIMER_FLAG_MASK_SIZE(flag) == TIMER_FLAG_16BIT ? 1 : 3) << timer; ++ if (((timer_dev.occupation & mask) ^ mask)) { ++ mutex_unlock(&timer_dev.gptu_mutex); ++ return -EINVAL; ++ } ++ ++ n = timer >> 1; ++ X = timer & 0x01; ++ ++ *value = *LQ_GPTU_COUNT(n, X); ++ ++ ++ mutex_unlock(&timer_dev.gptu_mutex); ++ ++ return 0; ++} ++EXPORT_SYMBOL(lq_get_count_value); ++ ++u32 lq_cal_divider(unsigned long freq) ++{ ++ u64 module_freq, fpi = ltq_get_fpi_bus_clock(2); ++ u32 clock_divider = 1; ++ module_freq = fpi * 1000; ++ do_div(module_freq, clock_divider * freq); ++ return module_freq; ++} ++EXPORT_SYMBOL(lq_cal_divider); ++ ++int lq_set_timer(unsigned int timer, unsigned int freq, int is_cyclic, ++ int is_ext_src, unsigned int handle_flag, unsigned long arg1, ++ unsigned long arg2) ++{ ++ unsigned long divider; ++ unsigned int flag; ++ ++ divider = lq_cal_divider(freq); ++ if (divider == 0) ++ return -EINVAL; ++ flag = ((divider & ~0xFFFF) ? TIMER_FLAG_32BIT : TIMER_FLAG_16BIT) ++ | (is_cyclic ? TIMER_FLAG_CYCLIC : TIMER_FLAG_ONCE) ++ | (is_ext_src ? TIMER_FLAG_EXT_SRC : TIMER_FLAG_INT_SRC) ++ | TIMER_FLAG_TIMER | TIMER_FLAG_DOWN ++ | TIMER_FLAG_MASK_HANDLE(handle_flag); ++ ++ printk(KERN_INFO "lq_set_timer(%d, %d), divider = %lu\n", ++ timer, freq, divider); ++ return lq_request_timer(timer, flag, divider, arg1, arg2); ++} ++EXPORT_SYMBOL(lq_set_timer); ++ ++int lq_set_counter(unsigned int timer, unsigned int flag, u32 reload, ++ unsigned long arg1, unsigned long arg2) ++{ ++ printk(KERN_INFO "lq_set_counter(%d, %#x, %d)\n", timer, flag, reload); ++ return lq_request_timer(timer, flag, reload, arg1, arg2); ++} ++EXPORT_SYMBOL(lq_set_counter); ++ ++static long gptu_ioctl(struct file *file, unsigned int cmd, ++ unsigned long arg) ++{ ++ int ret; ++ struct gptu_ioctl_param param; ++ ++ if (!access_ok(VERIFY_READ, arg, sizeof(struct gptu_ioctl_param))) ++ return -EFAULT; ++ copy_from_user(¶m, (void *) arg, sizeof(param)); ++ ++ if ((((cmd == GPTU_REQUEST_TIMER || cmd == GPTU_SET_TIMER ++ || GPTU_SET_COUNTER) && param.timer < 2) ++ || cmd == GPTU_GET_COUNT_VALUE || cmd == GPTU_CALCULATE_DIVIDER) ++ && !access_ok(VERIFY_WRITE, arg, ++ sizeof(struct gptu_ioctl_param))) ++ return -EFAULT; ++ ++ switch (cmd) { ++ case GPTU_REQUEST_TIMER: ++ ret = lq_request_timer(param.timer, param.flag, param.value, ++ (unsigned long) param.pid, ++ (unsigned long) param.sig); ++ if (ret > 0) { ++ copy_to_user(&((struct gptu_ioctl_param *) arg)-> ++ timer, &ret, sizeof(&ret)); ++ ret = 0; ++ } ++ break; ++ case GPTU_FREE_TIMER: ++ ret = lq_free_timer(param.timer); ++ break; ++ case GPTU_START_TIMER: ++ ret = lq_start_timer(param.timer, param.flag); ++ break; ++ case GPTU_STOP_TIMER: ++ ret = lq_stop_timer(param.timer); ++ break; ++ case GPTU_GET_COUNT_VALUE: ++ ret = lq_get_count_value(param.timer, ¶m.value); ++ if (!ret) ++ copy_to_user(&((struct gptu_ioctl_param *) arg)-> ++ value, ¶m.value, ++ sizeof(param.value)); ++ break; ++ case GPTU_CALCULATE_DIVIDER: ++ param.value = lq_cal_divider(param.value); ++ if (param.value == 0) ++ ret = -EINVAL; ++ else { ++ copy_to_user(&((struct gptu_ioctl_param *) arg)-> ++ value, ¶m.value, ++ sizeof(param.value)); ++ ret = 0; ++ } ++ break; ++ case GPTU_SET_TIMER: ++ ret = lq_set_timer(param.timer, param.value, ++ TIMER_FLAG_MASK_STOP(param.flag) != ++ TIMER_FLAG_ONCE ? 1 : 0, ++ TIMER_FLAG_MASK_SRC(param.flag) == ++ TIMER_FLAG_EXT_SRC ? 1 : 0, ++ TIMER_FLAG_MASK_HANDLE(param.flag) == ++ TIMER_FLAG_SIGNAL ? TIMER_FLAG_SIGNAL : ++ TIMER_FLAG_NO_HANDLE, ++ (unsigned long) param.pid, ++ (unsigned long) param.sig); ++ if (ret > 0) { ++ copy_to_user(&((struct gptu_ioctl_param *) arg)-> ++ timer, &ret, sizeof(&ret)); ++ ret = 0; ++ } ++ break; ++ case GPTU_SET_COUNTER: ++ lq_set_counter(param.timer, param.flag, param.value, 0, 0); ++ if (ret > 0) { ++ copy_to_user(&((struct gptu_ioctl_param *) arg)-> ++ timer, &ret, sizeof(&ret)); ++ ret = 0; ++ } ++ break; ++ default: ++ ret = -ENOTTY; ++ } ++ ++ return ret; ++} ++ ++static int gptu_open(struct inode *inode, struct file *file) ++{ ++ return 0; ++} ++ ++static int gptu_release(struct inode *inode, struct file *file) ++{ ++ return 0; ++} ++ ++int __init lq_gptu_init(void) ++{ ++ int ret; ++ unsigned int i; ++ ++ ltq_w32(0, LQ_GPTU_IRNEN); ++ ltq_w32(0xfff, LQ_GPTU_IRNCR); ++ ++ memset(&timer_dev, 0, sizeof(timer_dev)); ++ mutex_init(&timer_dev.gptu_mutex); ++ ++ lq_enable_gptu(); ++ timer_dev.number_of_timers = GPTU_ID_CFG * 2; ++ lq_disable_gptu(); ++ if (timer_dev.number_of_timers > MAX_NUM_OF_32BIT_TIMER_BLOCKS * 2) ++ timer_dev.number_of_timers = MAX_NUM_OF_32BIT_TIMER_BLOCKS * 2; ++ printk(KERN_INFO "gptu: totally %d 16-bit timers/counters\n", timer_dev.number_of_timers); ++ ++ ret = misc_register(&gptu_miscdev); ++ if (ret) { ++ printk(KERN_ERR "gptu: can't misc_register, get error %d\n", -ret); ++ return ret; ++ } else { ++ printk(KERN_INFO "gptu: misc_register on minor %d\n", gptu_miscdev.minor); ++ } ++ ++ for (i = 0; i < timer_dev.number_of_timers; i++) { ++ ret = request_irq(TIMER_INTERRUPT + i, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]); ++ if (ret) { ++ for (; i >= 0; i--) ++ free_irq(TIMER_INTERRUPT + i, &timer_dev.timer[i]); ++ misc_deregister(&gptu_miscdev); ++ printk(KERN_ERR "gptu: failed in requesting irq (%d), get error %d\n", i, -ret); ++ return ret; ++ } else { ++ timer_dev.timer[i].irq = TIMER_INTERRUPT + i; ++ disable_irq(timer_dev.timer[i].irq); ++ printk(KERN_INFO "gptu: succeeded to request irq %d\n", timer_dev.timer[i].irq); ++ } ++ } ++ ++ return 0; ++} ++ ++void __exit lq_gptu_exit(void) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < timer_dev.number_of_timers; i++) { ++ if (timer_dev.timer[i].f_irq_on) ++ disable_irq(timer_dev.timer[i].irq); ++ free_irq(timer_dev.timer[i].irq, &timer_dev.timer[i]); ++ } ++ lq_disable_gptu(); ++ misc_deregister(&gptu_miscdev); ++} ++ ++module_init(lq_gptu_init); ++module_exit(lq_gptu_exit); ++ ++#endif diff --git a/target/linux/lantiq/patches-4.9/0018-MTD-nand-lots-of-xrx200-fixes.patch b/target/linux/lantiq/patches-4.9/0018-MTD-nand-lots-of-xrx200-fixes.patch new file mode 100644 index 000000000..b97967d20 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0018-MTD-nand-lots-of-xrx200-fixes.patch @@ -0,0 +1,122 @@ +From 997a8965db8417266bea3fbdcfa3e5655a1b52fa Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 9 Sep 2014 23:12:15 +0200 +Subject: [PATCH 18/36] MTD: nand: lots of xrx200 fixes + +Signed-off-by: John Crispin +--- + drivers/mtd/nand/xway_nand.c | 63 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 63 insertions(+) + +--- a/drivers/mtd/nand/xway_nand.c ++++ b/drivers/mtd/nand/xway_nand.c +@@ -63,6 +63,24 @@ + #define NAND_CON_CSMUX (1 << 1) + #define NAND_CON_NANDM 1 + ++#define DANUBE_PCI_REG32( addr ) (*(volatile u32 *)(addr)) ++#define PCI_CR_PR_OFFSET (KSEG1+0x1E105400) ++#define PCI_CR_PC_ARB (PCI_CR_PR_OFFSET + 0x0080) ++ ++/* ++ * req_mask provides a mechanism to prevent interference between ++ * nand and pci (probably only relevant for the BT Home Hub 2B). ++ * Setting it causes the corresponding pci req pins to be masked ++ * during nand access, and also moves ebu locking from the read/write ++ * functions to the chip select function to ensure that the whole ++ * operation runs with interrupts disabled. ++ * In addition it switches on some extra waiting in xway_cmd_ctrl(). ++ * This seems to be necessary if the ebu_cs1 pin has open-drain disabled, ++ * which in turn seems to be necessary for the nor chip to be recognised ++ * reliably, on a board (Home Hub 2B again) which has both nor and nand. ++ */ ++static __be32 req_mask = 0; ++ + struct xway_nand_data { + struct nand_chip chip; + unsigned long csflags; +@@ -94,10 +112,22 @@ static void xway_select_chip(struct mtd_ + case -1: + ltq_ebu_w32_mask(NAND_CON_CE, 0, EBU_NAND_CON); + ltq_ebu_w32_mask(NAND_CON_NANDM, 0, EBU_NAND_CON); ++ ++ if (req_mask) { ++ /* Unmask all external PCI request */ ++ DANUBE_PCI_REG32(PCI_CR_PC_ARB) &= ~(req_mask << 16); ++ } ++ + spin_unlock_irqrestore(&ebu_lock, data->csflags); + break; + case 0: + spin_lock_irqsave(&ebu_lock, data->csflags); ++ ++ if (req_mask) { ++ /* Mask all external PCI request */ ++ DANUBE_PCI_REG32(PCI_CR_PC_ARB) |= (req_mask << 16); ++ } ++ + ltq_ebu_w32_mask(0, NAND_CON_NANDM, EBU_NAND_CON); + ltq_ebu_w32_mask(0, NAND_CON_CE, EBU_NAND_CON); + break; +@@ -108,6 +138,12 @@ static void xway_select_chip(struct mtd_ + + static void xway_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) + { ++ ++ if (req_mask) { ++ if (cmd != NAND_CMD_STATUS) ++ ltq_ebu_w32(0, EBU_NAND_WAIT); /* Clear nand ready */ ++ } ++ + if (cmd == NAND_CMD_NONE) + return; + +@@ -118,6 +154,24 @@ static void xway_cmd_ctrl(struct mtd_inf + + while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_WR_C) == 0) + ; ++ ++ if (req_mask) { ++ /* ++ * program and erase have their own busy handlers ++ * status and sequential in needs no delay ++ */ ++ switch (cmd) { ++ case NAND_CMD_ERASE1: ++ case NAND_CMD_SEQIN: ++ case NAND_CMD_STATUS: ++ case NAND_CMD_READID: ++ return; ++ } ++ ++ /* wait until command is processed */ ++ while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_RD) == 0) ++ ; ++ } + } + + static int xway_dev_ready(struct mtd_info *mtd) +@@ -157,6 +211,7 @@ static int xway_nand_probe(struct platfo + int err; + u32 cs; + u32 cs_flag = 0; ++ const __be32 *req_mask_ptr; + + /* Allocate memory for the device structure (and zero it) */ + data = devm_kzalloc(&pdev->dev, sizeof(struct xway_nand_data), +@@ -192,6 +247,15 @@ static int xway_nand_probe(struct platfo + if (!err && cs == 1) + cs_flag = NAND_CON_IN_CS1 | NAND_CON_OUT_CS1; + ++ req_mask_ptr = of_get_property(pdev->dev.of_node, ++ "req-mask", NULL); ++ ++ /* ++ * Load the PCI req lines to mask from the device tree. If the ++ * property is not present, setting req_mask to 0 disables masking. ++ */ ++ req_mask = (req_mask_ptr ? *req_mask_ptr : 0); ++ + /* setup the EBU to run in NAND mode on our base addr */ + ltq_ebu_w32(CPHYSADDR(data->nandaddr) + | ADDSEL1_MASK(3) | ADDSEL1_REGEN, EBU_ADDSEL1); diff --git a/target/linux/lantiq/patches-4.9/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch b/target/linux/lantiq/patches-4.9/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch new file mode 100644 index 000000000..64bf2aaca --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch @@ -0,0 +1,25 @@ +From e3b20f04e9f9cae1babe091fdc1d08d7703ae344 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 7 Aug 2014 18:18:00 +0200 +Subject: [PATCH 20/36] MTD: lantiq: handle NO_XIP on cfi0001 flash + +Signed-off-by: John Crispin +--- + drivers/mtd/maps/lantiq-flash.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/maps/lantiq-flash.c ++++ b/drivers/mtd/maps/lantiq-flash.c +@@ -137,7 +137,11 @@ ltq_mtd_probe(struct platform_device *pd + if (!ltq_mtd->map) + return -ENOMEM; + +- ltq_mtd->map->phys = ltq_mtd->res->start; ++ if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) ++ ltq_mtd->map->phys = NO_XIP; ++ else ++ ltq_mtd->map->phys = ltq_mtd->res->start; ++ ltq_mtd->res->start; + ltq_mtd->map->size = resource_size(ltq_mtd->res); + ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res); + if (IS_ERR(ltq_mtd->map->virt)) diff --git a/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch b/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch new file mode 100644 index 000000000..cfeded1eb --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch @@ -0,0 +1,44 @@ +From 4400e1f593ea40a51912128adb4f53d59e62cad8 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Wed, 10 Sep 2014 22:40:18 +0200 +Subject: [PATCH 22/36] MTD: m25p80: allow loading mtd name from OF + +In accordance with the physmap flash we should honour the linux,mtd-name +property when deciding what name the mtd device has. + +Signed-off-by: Thomas Langer +Signed-off-by: John Crispin +--- + drivers/mtd/devices/m25p80.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/mtd/devices/m25p80.c ++++ b/drivers/mtd/devices/m25p80.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -201,6 +202,10 @@ static int m25p_probe(struct spi_device + enum read_mode mode = SPI_NOR_NORMAL; + char *flash_name; + int ret; ++ const char __maybe_unused *of_mtd_name = NULL; ++ ++ of_property_read_string(spi->dev.of_node, ++ "linux,mtd-name", &of_mtd_name); + + data = dev_get_platdata(&spi->dev); + +@@ -230,6 +235,8 @@ static int m25p_probe(struct spi_device + + if (data && data->name) + nor->mtd.name = data->name; ++ else if (of_mtd_name) ++ nor->mtd.name = of_mtd_name; + + /* For some (historical?) reason many platforms provide two different + * names in flash_platform_data: "name" and "type". Quite often name is diff --git a/target/linux/lantiq/patches-4.9/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch b/target/linux/lantiq/patches-4.9/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch new file mode 100644 index 000000000..e91527759 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch @@ -0,0 +1,294 @@ +From 0a63ab263725c427051a8bbaa0732b749627da27 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 7 Aug 2014 18:15:36 +0200 +Subject: [PATCH 23/36] NET: PHY: adds driver for lantiq PHY11G + +Signed-off-by: John Crispin +--- + drivers/net/phy/Kconfig | 5 + + drivers/net/phy/Makefile | 1 + + drivers/net/phy/lantiq.c | 231 ++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 237 insertions(+) + create mode 100644 drivers/net/phy/lantiq.c + +--- a/drivers/net/phy/intel-xway.c ++++ b/drivers/net/phy/intel-xway.c +@@ -152,6 +152,51 @@ + #define PHY_ID_PHY11G_VR9 0xD565A409 + #define PHY_ID_PHY22F_VR9 0xD565A419 + ++#if IS_ENABLED(CONFIG_OF_MDIO) ++static int vr9_gphy_of_reg_init(struct phy_device *phydev) ++{ ++ u32 tmp; ++ ++ /* store the led values if one was passed by the devicetree */ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,ledch", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LEDCH, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,ledcl", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LEDCL, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led0h", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LED0H, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led0l", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LED0L, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led1h", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LED1H, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led1l", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LED1L, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led2h", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LED3H, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led2l", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LED3L, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led3h", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LED3H, MDIO_MMD_VEND2, tmp); ++ ++ if (!of_property_read_u32(phydev->mdio.dev.of_node, "lantiq,led3l", &tmp)) ++ phy_write_mmd_indirect(phydev, XWAY_MMD_LED3L, MDIO_MMD_VEND2, tmp); ++ ++ return 0; ++} ++#else ++static int vr9_gphy_of_reg_init(struct phy_device *phydev) ++{ ++ return 0; ++} ++#endif /* CONFIG_OF_MDIO */ ++ + static int xway_gphy_config_init(struct phy_device *phydev) + { + int err; +@@ -190,6 +235,7 @@ static int xway_gphy_config_init(struct + phy_write_mmd_indirect(phydev, XWAY_MMD_LED2H, MDIO_MMD_VEND2, ledxh); + phy_write_mmd_indirect(phydev, XWAY_MMD_LED2L, MDIO_MMD_VEND2, ledxl); + ++ vr9_gphy_of_reg_init(phydev); + return 0; + } + +--- /dev/null ++++ b/Documentation/devicetree/bindings/phy/phy-lanitq.txt +@@ -0,0 +1,216 @@ ++Lanitq PHY binding ++============================================ ++ ++This devicetree binding controls the lantiq ethernet phys led functionality. ++ ++Example: ++ mdio@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "lantiq,xrx200-mdio"; ++ phy5: ethernet-phy@5 { ++ reg = <0x1>; ++ compatible = "lantiq,phy11g", "ethernet-phy-ieee802.3-c22"; ++ }; ++ phy11: ethernet-phy@11 { ++ reg = <0x11>; ++ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; ++ lantiq,led2h = <0x00>; ++ lantiq,led2l = <0x03>; ++ }; ++ phy12: ethernet-phy@12 { ++ reg = <0x12>; ++ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; ++ lantiq,led1h = <0x00>; ++ lantiq,led1l = <0x03>; ++ }; ++ phy13: ethernet-phy@13 { ++ reg = <0x13>; ++ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; ++ lantiq,led2h = <0x00>; ++ lantiq,led2l = <0x03>; ++ }; ++ phy14: ethernet-phy@14 { ++ reg = <0x14>; ++ compatible = "lantiq,phy22f", "ethernet-phy-ieee802.3-c22"; ++ lantiq,led1h = <0x00>; ++ lantiq,led1l = <0x03>; ++ }; ++ }; ++ ++Register Description ++============================================ ++ ++LEDCH: ++ ++Name Hardware Reset Value ++LEDCH 0x00C5 ++ ++| 15 | | | | | | | 8 | ++========================================= ++| RES | ++========================================= ++ ++| 7 | | | | | | | 0 | ++========================================= ++| FBF | SBF |RES | NACS | ++========================================= ++ ++Field Bits Type Description ++FBF 7:6 RW Fast Blink Frequency ++ --- ++ 0x0 (00b) F02HZ 2 Hz blinking frequency ++ 0x1 (01b) F04HZ 4 Hz blinking frequency ++ 0x2 (10b) F08HZ 8 Hz blinking frequency ++ 0x3 (11b) F16HZ 16 Hz blinking frequency ++ ++SBF 5:4 RW Slow Blink Frequency ++ --- ++ 0x0 (00b) F02HZ 2 Hz blinking frequency ++ 0x1 (01b) F04HZ 4 Hz blinking frequency ++ 0x2 (10b) F08HZ 8 Hz blinking frequency ++ 0x3 (11b) F16HZ 16 Hz blinking frequency ++ ++NACS 2:0 RW Inverse of Scan Function ++ --- ++ 0x0 (000b) NONE No Function ++ 0x1 (001b) LINK Complex function enabled when link is up ++ 0x2 (010b) PDOWN Complex function enabled when device is powered-down ++ 0x3 (011b) EEE Complex function enabled when device is in EEE mode ++ 0x4 (100b) ANEG Complex function enabled when auto-negotiation is running ++ 0x5 (101b) ABIST Complex function enabled when analog self-test is running ++ 0x6 (110b) CDIAG Complex function enabled when cable diagnostics are running ++ 0x7 (111b) TEST Complex function enabled when test mode is running ++ ++LEDCL: ++ ++Name Hardware Reset Value ++LEDCL 0x0067 ++ ++| 15 | | | | | | | 8 | ++========================================= ++| RES | ++========================================= ++ ++| 7 | | | | | | | 0 | ++========================================= ++|RES | SCAN |RES | CBLINK | ++========================================= ++ ++Field Bits Type Description ++SCAN 6:4 RW Complex Scan Configuration ++ --- ++ 000 B NONE No Function ++ 001 B LINK Complex function enabled when link is up ++ 010 B PDOWN Complex function enabled when device is powered-down ++ 011 B EEE Complex function enabled when device is in EEE mode ++ 100 B ANEG Complex function enabled when auto-negotiation is running ++ 101 B ABIST Complex function enabled when analog self-test is running ++ 110 B CDIAG Complex function enabled when cable diagnostics are running ++ 111 B TEST Complex function enabled when test mode is running ++ ++CBLINK 2:0 RW Complex Blinking Configuration ++ --- ++ 000 B NONE No Function ++ 001 B LINK Complex function enabled when link is up ++ 010 B PDOWN Complex function enabled when device is powered-down ++ 011 B EEE Complex function enabled when device is in EEE mode ++ 100 B ANEG Complex function enabled when auto-negotiation is running ++ 101 B ABIST Complex function enabled when analog self-test is running ++ 110 B CDIAG Complex function enabled when cable diagnostics are running ++ 111 B TEST Complex function enabled when test mode is running ++ ++LEDxH: ++ ++Name Hardware Reset Value ++LED0H 0x0070 ++LED1H 0x0020 ++LED2H 0x0040 ++LED3H 0x0040 ++ ++| 15 | | | | | | | 8 | ++========================================= ++| RES | ++========================================= ++ ++| 7 | | | | | | | 0 | ++========================================= ++| CON | BLINKF | ++========================================= ++ ++Field Bits Type Description ++CON 7:4 RW Constant On Configuration ++ --- ++ 0x0 (0000b) NONE LED does not light up constantly ++ 0x1 (0001b) LINK10 LED is on when link is 10 Mbit/s ++ 0x2 (0010b) LINK100 LED is on when link is 100 Mbit/s ++ 0x3 (0011b) LINK10X LED is on when link is 10/100 Mbit/s ++ 0x4 (0100b) LINK1000 LED is on when link is 1000 Mbit/s ++ 0x5 (0101b) LINK10_0 LED is on when link is 10/1000 Mbit/s ++ 0x6 (0110b) LINK100X LED is on when link is 100/1000 Mbit/s ++ 0x7 (0111b) LINK10XX LED is on when link is 10/100/1000 Mbit/s ++ 0x8 (1000b) PDOWN LED is on when device is powered-down ++ 0x9 (1001b) EEE LED is on when device is in EEE mode ++ 0xA (1010b) ANEG LED is on when auto-negotiation is running ++ 0xB (1011b) ABIST LED is on when analog self-test is running ++ 0xC (1100b) CDIAG LED is on when cable diagnostics are running ++ ++BLINKF 3:0 RW Fast Blinking Configuration ++ --- ++ 0x0 (0000b) NONE No Blinking ++ 0x1 (0001b) LINK10 Blink when link is 10 Mbit/s ++ 0x2 (0010b) LINK100 Blink when link is 100 Mbit/s ++ 0x3 (0011b) LINK10X Blink when link is 10/100 Mbit/s ++ 0x4 (0100b) LINK1000 Blink when link is 1000 Mbit/s ++ 0x5 (0101b) LINK10_0 Blink when link is 10/1000 Mbit/s ++ 0x6 (0110b) LINK100X Blink when link is 100/1000 Mbit/s ++ 0x7 (0111b) LINK10XX Blink when link is 10/100/1000 Mbit/s ++ 0x8 (1000b) PDOWN Blink when device is powered-down ++ 0x9 (1001b) EEE Blink when device is in EEE mode ++ 0xA (1010b) ANEG Blink when auto-negotiation is running ++ 0xB (1011b) ABIST Blink when analog self-test is running ++ 0xC (1100b) CDIAG Blink when cable diagnostics are running ++ ++LEDxL: ++ ++Name Hardware Reset Value ++LED0L 0x0003 ++LED1L 0x0000 ++LED2L 0x0000 ++LED3L 0x0020 ++ ++| 15 | | | | | | | 8 | ++========================================= ++| RES | ++========================================= ++ ++| 7 | | | | | | | 0 | ++========================================= ++| BLINKS | PULSE | ++========================================= ++ ++Field Bits Type Description ++BLINKS 7:4 RW Slow Blinkin Configuration ++ --- ++ 0x0 (0000b) NONE No Blinking ++ 0x1 (0001b) LINK10 Blink when link is 10 Mbit/s ++ 0x2 (0010b) LINK100 Blink when link is 100 Mbit/s ++ 0x3 (0011b) LINK10X Blink when link is 10/100 Mbit/s ++ 0x4 (0100b) LINK1000 Blink when link is 1000 Mbit/s ++ 0x5 (0101b) LINK10_0 Blink when link is 10/1000 Mbit/s ++ 0x6 (0110b) LINK100X Blink when link is 100/1000 Mbit/s ++ 0x7 (0111b) LINK10XX Blink when link is 10/100/1000 Mbit/s ++ 0x8 (1000b) PDOWN Blink when device is powered-down ++ 0x9 (1001b) EEE Blink when device is in EEE mode ++ 0xA (1010b) ANEG Blink when auto-negotiation is running ++ 0xB (1011b) ABIST Blink when analog self-test is running ++ 0xC (1100b) CDIAG Blink when cable diagnostics are runningning ++ ++PULSE 3:0 RW Pulsing Configuration ++ The pulse field is a mask field by which certain events can be combined ++ --- ++ 0x0 (0000b) NONE No pulsing ++ 0x1 (0001b) TXACT Transmit activity ++ 0x2 (0010b) RXACT Receive activity ++ 0x4 (0100b) COL Collision ++ 0x8 (1000b) RES Reserved diff --git a/target/linux/lantiq/patches-4.9/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch b/target/linux/lantiq/patches-4.9/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch new file mode 100644 index 000000000..e62ff2f69 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch @@ -0,0 +1,364 @@ +From 77e89d5a28be35058041c79e9874ab26f222c603 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 22 Oct 2012 09:26:24 +0200 +Subject: [PATCH 24/36] NET: lantiq: adds PHY11G firmware blobs + +Signed-off-by: John Crispin +--- + firmware/Makefile | 4 + + firmware/lantiq/COPYING | 286 +++++++++++++++++++++++++++++++++++++++++++++++ + firmware/lantiq/README | 45 ++++++++ + 3 files changed, 335 insertions(+) + create mode 100644 firmware/lantiq/COPYING + create mode 100644 firmware/lantiq/README + +--- a/firmware/Makefile ++++ b/firmware/Makefile +@@ -134,6 +134,10 @@ fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_P + fw-shipped-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda/xircom_pgs.fw + fw-shipped-$(CONFIG_USB_VICAM) += vicam/firmware.fw + fw-shipped-$(CONFIG_VIDEO_CPIA2) += cpia2/stv0672_vp4.bin ++fw-shipped-$(CONFIG_LANTIQ_XRX200) += lantiq/xrx200_phy11g_a14.bin ++fw-shipped-$(CONFIG_LANTIQ_XRX200) += lantiq/xrx200_phy11g_a22.bin ++fw-shipped-$(CONFIG_LANTIQ_XRX200) += lantiq/xrx200_phy22f_a14.bin ++fw-shipped-$(CONFIG_LANTIQ_XRX200) += lantiq/xrx200_phy22f_a22.bin + fw-shipped-$(CONFIG_YAM) += yam/1200.bin yam/9600.bin + + fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-) +--- /dev/null ++++ b/firmware/lantiq/COPYING +@@ -0,0 +1,286 @@ ++All firmware files are copyrighted by Lantiq Deutschland GmbH. ++The files have been extracted from header files found in Lantiq BSPs. ++If not stated otherwise all files are licensed under GPL. ++ ++======================================================================= ++ ++ GNU GENERAL PUBLIC LICENSE ++ Version 2, June 1991 ++ ++ Copyright (C) 1989, 1991 Free Software Foundation, Inc. ++ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ Everyone is permitted to copy and distribute verbatim copies ++ of this license document, but changing it is not allowed. ++ ++ Preamble ++ ++ The licenses for most software are designed to take away your ++freedom to share and change it. By contrast, the GNU General Public ++License is intended to guarantee your freedom to share and change free ++software--to make sure the software is free for all its users. This ++General Public License applies to most of the Free Software ++Foundation's software and to any other program whose authors commit to ++using it. (Some other Free Software Foundation software is covered by ++the GNU Library General Public License instead.) You can apply it to ++your programs, too. ++ ++ When we speak of free software, we are referring to freedom, not ++price. Our General Public Licenses are designed to make sure that you ++have the freedom to distribute copies of free software (and charge for ++this service if you wish), that you receive source code or can get it ++if you want it, that you can change the software or use pieces of it ++in new free programs; and that you know you can do these things. ++ ++ To protect your rights, we need to make restrictions that forbid ++anyone to deny you these rights or to ask you to surrender the rights. ++These restrictions translate to certain responsibilities for you if you ++distribute copies of the software, or if you modify it. ++ ++ For example, if you distribute copies of such a program, whether ++gratis or for a fee, you must give the recipients all the rights that ++you have. You must make sure that they, too, receive or can get the ++source code. And you must show them these terms so they know their ++rights. ++ ++ We protect your rights with two steps: (1) copyright the software, and ++(2) offer you this license which gives you legal permission to copy, ++distribute and/or modify the software. ++ ++ Also, for each author's protection and ours, we want to make certain ++that everyone understands that there is no warranty for this free ++software. If the software is modified by someone else and passed on, we ++want its recipients to know that what they have is not the original, so ++that any problems introduced by others will not reflect on the original ++authors' reputations. ++ ++ Finally, any free program is threatened constantly by software ++patents. We wish to avoid the danger that redistributors of a free ++program will individually obtain patent licenses, in effect making the ++program proprietary. To prevent this, we have made it clear that any ++patent must be licensed for everyone's free use or not licensed at all. ++ ++ The precise terms and conditions for copying, distribution and ++modification follow. ++ ++ GNU GENERAL PUBLIC LICENSE ++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ++ ++ 0. This License applies to any program or other work which contains ++a notice placed by the copyright holder saying it may be distributed ++under the terms of this General Public License. The "Program", below, ++refers to any such program or work, and a "work based on the Program" ++means either the Program or any derivative work under copyright law: ++that is to say, a work containing the Program or a portion of it, ++either verbatim or with modifications and/or translated into another ++language. (Hereinafter, translation is included without limitation in ++the term "modification".) Each licensee is addressed as "you". ++ ++Activities other than copying, distribution and modification are not ++covered by this License; they are outside its scope. The act of ++running the Program is not restricted, and the output from the Program ++is covered only if its contents constitute a work based on the ++Program (independent of having been made by running the Program). ++Whether that is true depends on what the Program does. ++ ++ 1. You may copy and distribute verbatim copies of the Program's ++source code as you receive it, in any medium, provided that you ++conspicuously and appropriately publish on each copy an appropriate ++copyright notice and disclaimer of warranty; keep intact all the ++notices that refer to this License and to the absence of any warranty; ++and give any other recipients of the Program a copy of this License ++along with the Program. ++ ++You may charge a fee for the physical act of transferring a copy, and ++you may at your option offer warranty protection in exchange for a fee. ++ ++ 2. You may modify your copy or copies of the Program or any portion ++of it, thus forming a work based on the Program, and copy and ++distribute such modifications or work under the terms of Section 1 ++above, provided that you also meet all of these conditions: ++ ++ a) You must cause the modified files to carry prominent notices ++ stating that you changed the files and the date of any change. ++ ++ b) You must cause any work that you distribute or publish, that in ++ whole or in part contains or is derived from the Program or any ++ part thereof, to be licensed as a whole at no charge to all third ++ parties under the terms of this License. ++ ++ c) If the modified program normally reads commands interactively ++ when run, you must cause it, when started running for such ++ interactive use in the most ordinary way, to print or display an ++ announcement including an appropriate copyright notice and a ++ notice that there is no warranty (or else, saying that you provide ++ a warranty) and that users may redistribute the program under ++ these conditions, and telling the user how to view a copy of this ++ License. (Exception: if the Program itself is interactive but ++ does not normally print such an announcement, your work based on ++ the Program is not required to print an announcement.) ++ ++These requirements apply to the modified work as a whole. If ++identifiable sections of that work are not derived from the Program, ++and can be reasonably considered independent and separate works in ++themselves, then this License, and its terms, do not apply to those ++sections when you distribute them as separate works. But when you ++distribute the same sections as part of a whole which is a work based ++on the Program, the distribution of the whole must be on the terms of ++this License, whose permissions for other licensees extend to the ++entire whole, and thus to each and every part regardless of who wrote it. ++ ++Thus, it is not the intent of this section to claim rights or contest ++your rights to work written entirely by you; rather, the intent is to ++exercise the right to control the distribution of derivative or ++collective works based on the Program. ++ ++In addition, mere aggregation of another work not based on the Program ++with the Program (or with a work based on the Program) on a volume of ++a storage or distribution medium does not bring the other work under ++the scope of this License. ++ ++ 3. You may copy and distribute the Program (or a work based on it, ++under Section 2) in object code or executable form under the terms of ++Sections 1 and 2 above provided that you also do one of the following: ++ ++ a) Accompany it with the complete corresponding machine-readable ++ source code, which must be distributed under the terms of Sections ++ 1 and 2 above on a medium customarily used for software interchange; or, ++ ++ b) Accompany it with a written offer, valid for at least three ++ years, to give any third party, for a charge no more than your ++ cost of physically performing source distribution, a complete ++ machine-readable copy of the corresponding source code, to be ++ distributed under the terms of Sections 1 and 2 above on a medium ++ customarily used for software interchange; or, ++ ++ c) Accompany it with the information you received as to the offer ++ to distribute corresponding source code. (This alternative is ++ allowed only for noncommercial distribution and only if you ++ received the program in object code or executable form with such ++ an offer, in accord with Subsection b above.) ++ ++The source code for a work means the preferred form of the work for ++making modifications to it. For an executable work, complete source ++code means all the source code for all modules it contains, plus any ++associated interface definition files, plus the scripts used to ++control compilation and installation of the executable. However, as a ++special exception, the source code distributed need not include ++anything that is normally distributed (in either source or binary ++form) with the major components (compiler, kernel, and so on) of the ++operating system on which the executable runs, unless that component ++itself accompanies the executable. ++ ++If distribution of executable or object code is made by offering ++access to copy from a designated place, then offering equivalent ++access to copy the source code from the same place counts as ++distribution of the source code, even though third parties are not ++compelled to copy the source along with the object code. ++ ++ 4. You may not copy, modify, sublicense, or distribute the Program ++except as expressly provided under this License. Any attempt ++otherwise to copy, modify, sublicense or distribute the Program is ++void, and will automatically terminate your rights under this License. ++However, parties who have received copies, or rights, from you under ++this License will not have their licenses terminated so long as such ++parties remain in full compliance. ++ ++ 5. You are not required to accept this License, since you have not ++signed it. However, nothing else grants you permission to modify or ++distribute the Program or its derivative works. These actions are ++prohibited by law if you do not accept this License. Therefore, by ++modifying or distributing the Program (or any work based on the ++Program), you indicate your acceptance of this License to do so, and ++all its terms and conditions for copying, distributing or modifying ++the Program or works based on it. ++ ++ 6. Each time you redistribute the Program (or any work based on the ++Program), the recipient automatically receives a license from the ++original licensor to copy, distribute or modify the Program subject to ++these terms and conditions. You may not impose any further ++restrictions on the recipients' exercise of the rights granted herein. ++You are not responsible for enforcing compliance by third parties to ++this License. ++ ++ 7. If, as a consequence of a court judgment or allegation of patent ++infringement or for any other reason (not limited to patent issues), ++conditions are imposed on you (whether by court order, agreement or ++otherwise) that contradict the conditions of this License, they do not ++excuse you from the conditions of this License. If you cannot ++distribute so as to satisfy simultaneously your obligations under this ++License and any other pertinent obligations, then as a consequence you ++may not distribute the Program at all. For example, if a patent ++license would not permit royalty-free redistribution of the Program by ++all those who receive copies directly or indirectly through you, then ++the only way you could satisfy both it and this License would be to ++refrain entirely from distribution of the Program. ++ ++If any portion of this section is held invalid or unenforceable under ++any particular circumstance, the balance of the section is intended to ++apply and the section as a whole is intended to apply in other ++circumstances. ++ ++It is not the purpose of this section to induce you to infringe any ++patents or other property right claims or to contest validity of any ++such claims; this section has the sole purpose of protecting the ++integrity of the free software distribution system, which is ++implemented by public license practices. Many people have made ++generous contributions to the wide range of software distributed ++through that system in reliance on consistent application of that ++system; it is up to the author/donor to decide if he or she is willing ++to distribute software through any other system and a licensee cannot ++impose that choice. ++ ++This section is intended to make thoroughly clear what is believed to ++be a consequence of the rest of this License. ++ ++ 8. If the distribution and/or use of the Program is restricted in ++certain countries either by patents or by copyrighted interfaces, the ++original copyright holder who places the Program under this License ++may add an explicit geographical distribution limitation excluding ++those countries, so that distribution is permitted only in or among ++countries not thus excluded. In such case, this License incorporates ++the limitation as if written in the body of this License. ++ ++ 9. The Free Software Foundation may publish revised and/or new versions ++of the General Public License from time to time. Such new versions will ++be similar in spirit to the present version, but may differ in detail to ++address new problems or concerns. ++ ++Each version is given a distinguishing version number. If the Program ++specifies a version number of this License which applies to it and "any ++later version", you have the option of following the terms and conditions ++either of that version or of any later version published by the Free ++Software Foundation. If the Program does not specify a version number of ++this License, you may choose any version ever published by the Free Software ++Foundation. ++ ++ 10. If you wish to incorporate parts of the Program into other free ++programs whose distribution conditions are different, write to the author ++to ask for permission. For software which is copyrighted by the Free ++Software Foundation, write to the Free Software Foundation; we sometimes ++make exceptions for this. Our decision will be guided by the two goals ++of preserving the free status of all derivatives of our free software and ++of promoting the sharing and reuse of software generally. ++ ++ NO WARRANTY ++ ++ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY ++FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN ++OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES ++PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED ++OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ++MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS ++TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE ++PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, ++REPAIR OR CORRECTION. ++ ++ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING ++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR ++REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, ++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING ++OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED ++TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY ++YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER ++PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE ++POSSIBILITY OF SUCH DAMAGES. ++ ++ END OF TERMS AND CONDITIONS +--- /dev/null ++++ b/firmware/lantiq/README +@@ -0,0 +1,45 @@ ++# ++# This program is free software; you can redistribute it and/or ++# modify it under the terms of the GNU General Public License as ++# published by the Free Software Foundation; either version 2 of ++# the License, or (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, ++# MA 02111-1307 USA ++# ++# (C) Copyright 2007 - 2012 ++# Lantiq Deutschland GmbH ++# ++# (C) Copyright 2012 ++# Daniel Schwierzeck ++# ++ ++# ++# How to use ++# ++Configure kernel with: ++CONFIG_FW_LOADER=y ++CONFIG_EXTRA_FIRMWARE_DIR="FIRMWARE_DIR" ++CONFIG_EXTRA_FIRMWARE="FIRMWARE_FILES" ++ ++where FIRMWARE_DIR should point to this git tree and FIRMWARE_FILES is a list ++of space separated files from list below. ++ ++# ++# Firmware files ++# ++ ++# GPHY core on Lantiq XWAY VR9 v1.1 ++lantiq/xrx200_phy11g_a14.bin ++lantiq/xrx200_phy22f_a14.bin ++ ++# GPHY core on Lantiq XWAY VR9 v1.2 ++lantiq/xrx200_phy11g_a22.bin ++lantiq/xrx200_phy22f_a22.bin diff --git a/target/linux/lantiq/patches-4.9/0025-NET-MIPS-lantiq-adds-xrx200-net.patch b/target/linux/lantiq/patches-4.9/0025-NET-MIPS-lantiq-adds-xrx200-net.patch new file mode 100644 index 000000000..5224e7a00 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0025-NET-MIPS-lantiq-adds-xrx200-net.patch @@ -0,0 +1,3394 @@ +From fb0c9601f4414c39ff68e26b88681bef0bb04954 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Mon, 22 Oct 2012 12:22:23 +0200 +Subject: [PATCH 25/36] NET: MIPS: lantiq: adds xrx200-net + +--- + drivers/net/ethernet/Kconfig | 8 +- + drivers/net/ethernet/Makefile | 1 + + drivers/net/ethernet/lantiq_pce.h | 163 +++ + drivers/net/ethernet/lantiq_xrx200.c | 1798 +++++++++++++++++++++++++++++++ + drivers/net/ethernet/lantiq_xrx200_sw.h | 1328 +++++++++++++++++++++++ + 5 files changed, 3297 insertions(+), 1 deletion(-) + create mode 100644 drivers/net/ethernet/lantiq_pce.h + create mode 100644 drivers/net/ethernet/lantiq_xrx200.c + create mode 100644 drivers/net/ethernet/lantiq_xrx200_sw.h + +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -104,7 +104,13 @@ config LANTIQ_ETOP + tristate "Lantiq SoC ETOP driver" + depends on SOC_TYPE_XWAY + ---help--- +- Support for the MII0 inside the Lantiq SoC ++ Support for the MII0 inside the Lantiq ADSL SoC ++ ++config LANTIQ_XRX200 ++ tristate "Lantiq SoC XRX200 driver" ++ depends on SOC_TYPE_XWAY ++ ---help--- ++ Support for the MII0 inside the Lantiq VDSL SoC + + source "drivers/net/ethernet/marvell/Kconfig" + source "drivers/net/ethernet/mediatek/Kconfig" +--- a/drivers/net/ethernet/Makefile ++++ b/drivers/net/ethernet/Makefile +@@ -46,6 +46,7 @@ obj-$(CONFIG_NET_VENDOR_XSCALE) += xscal + obj-$(CONFIG_JME) += jme.o + obj-$(CONFIG_KORINA) += korina.o + obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o ++obj-$(CONFIG_LANTIQ_XRX200) += lantiq_xrx200.o + obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/ + obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/ + obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/ +--- /dev/null ++++ b/drivers/net/ethernet/lantiq_pce.h +@@ -0,0 +1,163 @@ ++/* ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * Copyright (C) 2010 Lantiq Deutschland GmbH ++ * Copyright (C) 2012 John Crispin ++ * ++ * PCE microcode extracted from UGW5.2 switch api ++ */ ++ ++/* Switch API Micro Code V0.3 */ ++enum { ++ OUT_MAC0 = 0, ++ OUT_MAC1, ++ OUT_MAC2, ++ OUT_MAC3, ++ OUT_MAC4, ++ OUT_MAC5, ++ OUT_ETHTYP, ++ OUT_VTAG0, ++ OUT_VTAG1, ++ OUT_ITAG0, ++ OUT_ITAG1, /*10 */ ++ OUT_ITAG2, ++ OUT_ITAG3, ++ OUT_IP0, ++ OUT_IP1, ++ OUT_IP2, ++ OUT_IP3, ++ OUT_SIP0, ++ OUT_SIP1, ++ OUT_SIP2, ++ OUT_SIP3, /*20*/ ++ OUT_SIP4, ++ OUT_SIP5, ++ OUT_SIP6, ++ OUT_SIP7, ++ OUT_DIP0, ++ OUT_DIP1, ++ OUT_DIP2, ++ OUT_DIP3, ++ OUT_DIP4, ++ OUT_DIP5, /*30*/ ++ OUT_DIP6, ++ OUT_DIP7, ++ OUT_SESID, ++ OUT_PROT, ++ OUT_APP0, ++ OUT_APP1, ++ OUT_IGMP0, ++ OUT_IGMP1, ++ OUT_IPOFF, /*39*/ ++ OUT_NONE = 63 ++}; ++ ++/* parser's microcode length type */ ++#define INSTR 0 ++#define IPV6 1 ++#define LENACCU 2 ++ ++/* parser's microcode flag type */ ++enum { ++ FLAG_ITAG = 0, ++ FLAG_VLAN, ++ FLAG_SNAP, ++ FLAG_PPPOE, ++ FLAG_IPV6, ++ FLAG_IPV6FL, ++ FLAG_IPV4, ++ FLAG_IGMP, ++ FLAG_TU, ++ FLAG_HOP, ++ FLAG_NN1, /*10 */ ++ FLAG_NN2, ++ FLAG_END, ++ FLAG_NO, /*13*/ ++}; ++ ++/* Micro code version V2_11 (extension for parsing IPv6 in PPPoE) */ ++#define MC_ENTRY(val, msk, ns, out, len, type, flags, ipv4_len) \ ++ { {val, msk, (ns<<10 | out<<4 | len>>1), (len&1)<<15 | type<<13 | flags<<9 | ipv4_len<<8 }} ++struct pce_microcode { ++ unsigned short val[4]; ++/* unsigned short val_2; ++ unsigned short val_1; ++ unsigned short val_0;*/ ++} pce_microcode[] = { ++ /* value mask ns fields L type flags ipv4_len */ ++ MC_ENTRY(0x88c3, 0xFFFF, 1, OUT_ITAG0, 4, INSTR, FLAG_ITAG, 0), ++ MC_ENTRY(0x8100, 0xFFFF, 2, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), ++ MC_ENTRY(0x88A8, 0xFFFF, 1, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), ++ MC_ENTRY(0x8100, 0xFFFF, 1, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), ++ MC_ENTRY(0x8864, 0xFFFF, 17, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0800, 0xFFFF, 21, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x86DD, 0xFFFF, 22, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x8863, 0xFFFF, 16, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0xF800, 10, OUT_NONE, 0, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 38, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0600, 0x0600, 38, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 12, OUT_NONE, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0xAAAA, 0xFFFF, 14, OUT_NONE, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0300, 0xFF00, 39, OUT_NONE, 0, INSTR, FLAG_SNAP, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_DIP7, 3, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 18, OUT_DIP7, 3, INSTR, FLAG_PPPOE, 0), ++ MC_ENTRY(0x0021, 0xFFFF, 21, OUT_NONE, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0057, 0xFFFF, 22, OUT_NONE, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x4000, 0xF000, 24, OUT_IP0, 4, INSTR, FLAG_IPV4, 1), ++ MC_ENTRY(0x6000, 0xF000, 27, OUT_IP0, 3, INSTR, FLAG_IPV6, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 25, OUT_IP3, 2, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 26, OUT_SIP0, 4, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 38, OUT_NONE, 0, LENACCU, FLAG_NO, 0), ++ MC_ENTRY(0x1100, 0xFF00, 37, OUT_PROT, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0600, 0xFF00, 37, OUT_PROT, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_HOP, 0), ++ MC_ENTRY(0x2B00, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_NN1, 0), ++ MC_ENTRY(0x3C00, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_NN2, 0), ++ MC_ENTRY(0x0000, 0x0000, 37, OUT_PROT, 1, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_HOP, 0), ++ MC_ENTRY(0x2B00, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_NN1, 0), ++ MC_ENTRY(0x3C00, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_NN2, 0), ++ MC_ENTRY(0x0000, 0x0000, 38, OUT_PROT, 1, IPV6, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 38, OUT_SIP0, 16, INSTR, FLAG_NO, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_APP0, 4, INSTR, FLAG_IGMP, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++ MC_ENTRY(0x0000, 0x0000, 39, OUT_NONE, 0, INSTR, FLAG_END, 0), ++}; +--- /dev/null ++++ b/drivers/net/ethernet/lantiq_xrx200.c +@@ -0,0 +1,1851 @@ ++/* ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * Copyright (C) 2010 Lantiq Deutschland ++ * Copyright (C) 2012 John Crispin ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "lantiq_pce.h" ++#include "lantiq_xrx200_sw.h" ++ ++#define SW_POLLING ++#define SW_ROUTING ++ ++#ifdef SW_ROUTING ++#define XRX200_MAX_DEV 2 ++#else ++#define XRX200_MAX_DEV 1 ++#endif ++ ++#define XRX200_MAX_VLAN 64 ++#define XRX200_PCE_ACTVLAN_IDX 0x01 ++#define XRX200_PCE_VLANMAP_IDX 0x02 ++ ++#define XRX200_MAX_PORT 7 ++#define XRX200_MAX_DMA 8 ++ ++#define XRX200_HEADROOM 4 ++ ++#define XRX200_TX_TIMEOUT (10 * HZ) ++ ++/* port type */ ++#define XRX200_PORT_TYPE_PHY 1 ++#define XRX200_PORT_TYPE_MAC 2 ++ ++/* DMA */ ++#define XRX200_DMA_DATA_LEN 0x600 ++#define XRX200_DMA_IRQ INT_NUM_IM2_IRL0 ++#define XRX200_DMA_RX 0 ++#define XRX200_DMA_TX 1 ++#define XRX200_DMA_TX_2 3 ++#define XRX200_DMA_IS_TX(x) (x%2) ++#define XRX200_DMA_IS_RX(x) (!XRX200_DMA_IS_TX(x)) ++ ++/* fetch / store dma */ ++#define FDMA_PCTRL0 0x2A00 ++#define FDMA_PCTRLx(x) (FDMA_PCTRL0 + (x * 0x18)) ++#define SDMA_PCTRL0 0x2F00 ++#define SDMA_PCTRLx(x) (SDMA_PCTRL0 + (x * 0x18)) ++ ++/* buffer management */ ++#define BM_PCFG0 0x200 ++#define BM_PCFGx(x) (BM_PCFG0 + (x * 8)) ++ ++/* MDIO */ ++#define MDIO_GLOB 0x0000 ++#define MDIO_CTRL 0x0020 ++#define MDIO_READ 0x0024 ++#define MDIO_WRITE 0x0028 ++#define MDIO_PHY0 0x0054 ++#define MDIO_PHY(x) (0x0054 - (x * sizeof(unsigned))) ++#define MDIO_CLK_CFG0 0x002C ++#define MDIO_CLK_CFG1 0x0030 ++ ++#define MDIO_GLOB_ENABLE 0x8000 ++#define MDIO_BUSY BIT(12) ++#define MDIO_RD BIT(11) ++#define MDIO_WR BIT(10) ++#define MDIO_MASK 0x1f ++#define MDIO_ADDRSHIFT 5 ++#define MDIO1_25MHZ 9 ++ ++#define MDIO_PHY_LINK_DOWN 0x4000 ++#define MDIO_PHY_LINK_UP 0x2000 ++ ++#define MDIO_PHY_SPEED_M10 0x0000 ++#define MDIO_PHY_SPEED_M100 0x0800 ++#define MDIO_PHY_SPEED_G1 0x1000 ++ ++#define MDIO_PHY_FDUP_EN 0x0200 ++#define MDIO_PHY_FDUP_DIS 0x0600 ++ ++#define MDIO_PHY_LINK_MASK 0x6000 ++#define MDIO_PHY_SPEED_MASK 0x1800 ++#define MDIO_PHY_FDUP_MASK 0x0600 ++#define MDIO_PHY_ADDR_MASK 0x001f ++#define MDIO_UPDATE_MASK MDIO_PHY_ADDR_MASK | MDIO_PHY_LINK_MASK | \ ++ MDIO_PHY_SPEED_MASK | MDIO_PHY_FDUP_MASK ++ ++/* MII */ ++#define MII_CFG(p) (p * 8) ++ ++#define MII_CFG_EN BIT(14) ++ ++#define MII_CFG_MODE_MIIP 0x0 ++#define MII_CFG_MODE_MIIM 0x1 ++#define MII_CFG_MODE_RMIIP 0x2 ++#define MII_CFG_MODE_RMIIM 0x3 ++#define MII_CFG_MODE_RGMII 0x4 ++#define MII_CFG_MODE_MASK 0xf ++ ++#define MII_CFG_RATE_M2P5 0x00 ++#define MII_CFG_RATE_M25 0x10 ++#define MII_CFG_RATE_M125 0x20 ++#define MII_CFG_RATE_M50 0x30 ++#define MII_CFG_RATE_AUTO 0x40 ++#define MII_CFG_RATE_MASK 0x70 ++ ++/* cpu port mac */ ++#define PMAC_HD_CTL 0x0000 ++#define PMAC_RX_IPG 0x0024 ++#define PMAC_EWAN 0x002c ++ ++#define PMAC_IPG_MASK 0xf ++#define PMAC_HD_CTL_AS 0x0008 ++#define PMAC_HD_CTL_AC 0x0004 ++#define PMAC_HD_CTL_RC 0x0010 ++#define PMAC_HD_CTL_RXSH 0x0040 ++#define PMAC_HD_CTL_AST 0x0080 ++#define PMAC_HD_CTL_RST 0x0100 ++ ++/* PCE */ ++#define PCE_TBL_KEY(x) (0x1100 + ((7 - x) * 4)) ++#define PCE_TBL_MASK 0x1120 ++#define PCE_TBL_VAL(x) (0x1124 + ((4 - x) * 4)) ++#define PCE_TBL_ADDR 0x1138 ++#define PCE_TBL_CTRL 0x113c ++#define PCE_PMAP1 0x114c ++#define PCE_PMAP2 0x1150 ++#define PCE_PMAP3 0x1154 ++#define PCE_GCTRL_REG(x) (0x1158 + (x * 4)) ++#define PCE_PCTRL_REG(p, x) (0x1200 + (((p * 0xa) + x) * 4)) ++ ++#define PCE_TBL_BUSY BIT(15) ++#define PCE_TBL_CFG_ADDR_MASK 0x1f ++#define PCE_TBL_CFG_ADWR 0x20 ++#define PCE_TBL_CFG_ADWR_MASK 0x60 ++#define PCE_INGRESS BIT(11) ++ ++/* MAC */ ++#define MAC_FLEN_REG (0x2314) ++#define MAC_CTRL_REG(p, x) (0x240c + (((p * 0xc) + x) * 4)) ++ ++/* buffer management */ ++#define BM_PCFG(p) (0x200 + (p * 8)) ++ ++/* special tag in TX path header */ ++#define SPID_SHIFT 24 ++#define DPID_SHIFT 16 ++#define DPID_ENABLE 1 ++#define SPID_CPU_PORT 2 ++#define PORT_MAP_SEL BIT(15) ++#define PORT_MAP_EN BIT(14) ++#define PORT_MAP_SHIFT 1 ++#define PORT_MAP_MASK 0x3f ++ ++#define SPPID_MASK 0x7 ++#define SPPID_SHIFT 4 ++ ++/* MII regs not yet in linux */ ++#define MDIO_DEVAD_NONE (-1) ++#define ADVERTIZE_MPD (1 << 10) ++ ++struct xrx200_port { ++ u8 num; ++ u8 phy_addr; ++ u16 flags; ++ phy_interface_t phy_if; ++ ++ int link; ++ int gpio; ++ enum of_gpio_flags gpio_flags; ++ ++ struct phy_device *phydev; ++ struct device_node *phy_node; ++}; ++ ++struct xrx200_chan { ++ int idx; ++ int refcount; ++ int tx_free; ++ ++ struct net_device dummy_dev; ++ struct net_device *devs[XRX200_MAX_DEV]; ++ ++ struct tasklet_struct tasklet; ++ struct napi_struct napi; ++ struct ltq_dma_channel dma; ++ struct sk_buff *skb[LTQ_DESC_NUM]; ++ ++ spinlock_t lock; ++}; ++ ++struct xrx200_hw { ++ struct clk *clk; ++ struct mii_bus *mii_bus; ++ ++ struct xrx200_chan chan[XRX200_MAX_DMA]; ++ u16 vlan_vid[XRX200_MAX_VLAN]; ++ u16 vlan_port_map[XRX200_MAX_VLAN]; ++ ++ struct net_device *devs[XRX200_MAX_DEV]; ++ int num_devs; ++ ++ int port_map[XRX200_MAX_PORT]; ++ unsigned short wan_map; ++ ++ struct switch_dev swdev; ++}; ++ ++struct xrx200_priv { ++ struct net_device_stats stats; ++ int id; ++ ++ struct xrx200_port port[XRX200_MAX_PORT]; ++ int num_port; ++ bool wan; ++ bool sw; ++ unsigned short port_map; ++ unsigned char mac[6]; ++ ++ struct xrx200_hw *hw; ++}; ++ ++static __iomem void *xrx200_switch_membase; ++static __iomem void *xrx200_mii_membase; ++static __iomem void *xrx200_mdio_membase; ++static __iomem void *xrx200_pmac_membase; ++ ++#define ltq_switch_r32(x) ltq_r32(xrx200_switch_membase + (x)) ++#define ltq_switch_w32(x, y) ltq_w32(x, xrx200_switch_membase + (y)) ++#define ltq_switch_w32_mask(x, y, z) \ ++ ltq_w32_mask(x, y, xrx200_switch_membase + (z)) ++ ++#define ltq_mdio_r32(x) ltq_r32(xrx200_mdio_membase + (x)) ++#define ltq_mdio_w32(x, y) ltq_w32(x, xrx200_mdio_membase + (y)) ++#define ltq_mdio_w32_mask(x, y, z) \ ++ ltq_w32_mask(x, y, xrx200_mdio_membase + (z)) ++ ++#define ltq_mii_r32(x) ltq_r32(xrx200_mii_membase + (x)) ++#define ltq_mii_w32(x, y) ltq_w32(x, xrx200_mii_membase + (y)) ++#define ltq_mii_w32_mask(x, y, z) \ ++ ltq_w32_mask(x, y, xrx200_mii_membase + (z)) ++ ++#define ltq_pmac_r32(x) ltq_r32(xrx200_pmac_membase + (x)) ++#define ltq_pmac_w32(x, y) ltq_w32(x, xrx200_pmac_membase + (y)) ++#define ltq_pmac_w32_mask(x, y, z) \ ++ ltq_w32_mask(x, y, xrx200_pmac_membase + (z)) ++ ++#define XRX200_GLOBAL_REGATTR(reg) \ ++ .id = reg, \ ++ .type = SWITCH_TYPE_INT, \ ++ .set = xrx200_set_global_attr, \ ++ .get = xrx200_get_global_attr ++ ++#define XRX200_PORT_REGATTR(reg) \ ++ .id = reg, \ ++ .type = SWITCH_TYPE_INT, \ ++ .set = xrx200_set_port_attr, \ ++ .get = xrx200_get_port_attr ++ ++static int xrx200sw_read_x(int reg, int x) ++{ ++ int value, mask, addr; ++ ++ addr = xrx200sw_reg[reg].offset + (xrx200sw_reg[reg].mult * x); ++ value = ltq_switch_r32(addr); ++ mask = (1 << xrx200sw_reg[reg].size) - 1; ++ value = (value >> xrx200sw_reg[reg].shift); ++ ++ return (value & mask); ++} ++ ++static int xrx200sw_read(int reg) ++{ ++ return xrx200sw_read_x(reg, 0); ++} ++ ++static void xrx200sw_write_x(int value, int reg, int x) ++{ ++ int mask, addr; ++ ++ addr = xrx200sw_reg[reg].offset + (xrx200sw_reg[reg].mult * x); ++ mask = (1 << xrx200sw_reg[reg].size) - 1; ++ mask = (mask << xrx200sw_reg[reg].shift); ++ value = (value << xrx200sw_reg[reg].shift) & mask; ++ ++ ltq_switch_w32_mask(mask, value, addr); ++} ++ ++static void xrx200sw_write(int value, int reg) ++{ ++ xrx200sw_write_x(value, reg, 0); ++} ++ ++struct xrx200_pce_table_entry { ++ int index; // PCE_TBL_ADDR.ADDR = pData->table_index ++ int table; // PCE_TBL_CTRL.ADDR = pData->table ++ unsigned short key[8]; ++ unsigned short val[5]; ++ unsigned short mask; ++ unsigned short type; ++ unsigned short valid; ++ unsigned short gmap; ++}; ++ ++static int xrx200_pce_table_entry_read(struct xrx200_pce_table_entry *tbl) ++{ ++ // wait until hardware is ready ++ while (xrx200sw_read(XRX200_PCE_TBL_CTRL_BAS)) {}; ++ ++ // prepare the table access: ++ // PCE_TBL_ADDR.ADDR = pData->table_index ++ xrx200sw_write(tbl->index, XRX200_PCE_TBL_ADDR_ADDR); ++ // PCE_TBL_CTRL.ADDR = pData->table ++ xrx200sw_write(tbl->table, XRX200_PCE_TBL_CTRL_ADDR); ++ ++ //(address-based read) ++ xrx200sw_write(0, XRX200_PCE_TBL_CTRL_OPMOD); // OPMOD_ADRD ++ ++ xrx200sw_write(1, XRX200_PCE_TBL_CTRL_BAS); // start access ++ ++ // wait until hardware is ready ++ while (xrx200sw_read(XRX200_PCE_TBL_CTRL_BAS)) {}; ++ ++ // read the keys ++ tbl->key[7] = xrx200sw_read(XRX200_PCE_TBL_KEY_7); ++ tbl->key[6] = xrx200sw_read(XRX200_PCE_TBL_KEY_6); ++ tbl->key[5] = xrx200sw_read(XRX200_PCE_TBL_KEY_5); ++ tbl->key[4] = xrx200sw_read(XRX200_PCE_TBL_KEY_4); ++ tbl->key[3] = xrx200sw_read(XRX200_PCE_TBL_KEY_3); ++ tbl->key[2] = xrx200sw_read(XRX200_PCE_TBL_KEY_2); ++ tbl->key[1] = xrx200sw_read(XRX200_PCE_TBL_KEY_1); ++ tbl->key[0] = xrx200sw_read(XRX200_PCE_TBL_KEY_0); ++ ++ // read the values ++ tbl->val[4] = xrx200sw_read(XRX200_PCE_TBL_VAL_4); ++ tbl->val[3] = xrx200sw_read(XRX200_PCE_TBL_VAL_3); ++ tbl->val[2] = xrx200sw_read(XRX200_PCE_TBL_VAL_2); ++ tbl->val[1] = xrx200sw_read(XRX200_PCE_TBL_VAL_1); ++ tbl->val[0] = xrx200sw_read(XRX200_PCE_TBL_VAL_0); ++ ++ // read the mask ++ tbl->mask = xrx200sw_read(XRX200_PCE_TBL_MASK_0); ++ // read the type ++ tbl->type = xrx200sw_read(XRX200_PCE_TBL_CTRL_TYPE); ++ // read the valid flag ++ tbl->valid = xrx200sw_read(XRX200_PCE_TBL_CTRL_VLD); ++ // read the group map ++ tbl->gmap = xrx200sw_read(XRX200_PCE_TBL_CTRL_GMAP); ++ ++ return 0; ++} ++ ++static int xrx200_pce_table_entry_write(struct xrx200_pce_table_entry *tbl) ++{ ++ // wait until hardware is ready ++ while (xrx200sw_read(XRX200_PCE_TBL_CTRL_BAS)) {}; ++ ++ // prepare the table access: ++ // PCE_TBL_ADDR.ADDR = pData->table_index ++ xrx200sw_write(tbl->index, XRX200_PCE_TBL_ADDR_ADDR); ++ // PCE_TBL_CTRL.ADDR = pData->table ++ xrx200sw_write(tbl->table, XRX200_PCE_TBL_CTRL_ADDR); ++ ++ //(address-based write) ++ xrx200sw_write(1, XRX200_PCE_TBL_CTRL_OPMOD); // OPMOD_ADRD ++ ++ // read the keys ++ xrx200sw_write(tbl->key[7], XRX200_PCE_TBL_KEY_7); ++ xrx200sw_write(tbl->key[6], XRX200_PCE_TBL_KEY_6); ++ xrx200sw_write(tbl->key[5], XRX200_PCE_TBL_KEY_5); ++ xrx200sw_write(tbl->key[4], XRX200_PCE_TBL_KEY_4); ++ xrx200sw_write(tbl->key[3], XRX200_PCE_TBL_KEY_3); ++ xrx200sw_write(tbl->key[2], XRX200_PCE_TBL_KEY_2); ++ xrx200sw_write(tbl->key[1], XRX200_PCE_TBL_KEY_1); ++ xrx200sw_write(tbl->key[0], XRX200_PCE_TBL_KEY_0); ++ ++ // read the values ++ xrx200sw_write(tbl->val[4], XRX200_PCE_TBL_VAL_4); ++ xrx200sw_write(tbl->val[3], XRX200_PCE_TBL_VAL_3); ++ xrx200sw_write(tbl->val[2], XRX200_PCE_TBL_VAL_2); ++ xrx200sw_write(tbl->val[1], XRX200_PCE_TBL_VAL_1); ++ xrx200sw_write(tbl->val[0], XRX200_PCE_TBL_VAL_0); ++ ++ // read the mask ++ xrx200sw_write(tbl->mask, XRX200_PCE_TBL_MASK_0); ++ // read the type ++ xrx200sw_write(tbl->type, XRX200_PCE_TBL_CTRL_TYPE); ++ // read the valid flag ++ xrx200sw_write(tbl->valid, XRX200_PCE_TBL_CTRL_VLD); ++ // read the group map ++ xrx200sw_write(tbl->gmap, XRX200_PCE_TBL_CTRL_GMAP); ++ ++ xrx200sw_write(1, XRX200_PCE_TBL_CTRL_BAS); // start access ++ ++ // wait until hardware is ready ++ while (xrx200sw_read(XRX200_PCE_TBL_CTRL_BAS)) {}; ++ ++ return 0; ++} ++ ++static void xrx200sw_fixup_pvids(void) ++{ ++ int index, p, portmap, untagged; ++ struct xrx200_pce_table_entry tem; ++ struct xrx200_pce_table_entry tev; ++ ++ portmap = 0; ++ for (p = 0; p < XRX200_MAX_PORT; p++) ++ portmap |= BIT(p); ++ ++ tem.table = XRX200_PCE_VLANMAP_IDX; ++ tev.table = XRX200_PCE_ACTVLAN_IDX; ++ ++ for (index = XRX200_MAX_VLAN; index-- > 0;) ++ { ++ tev.index = index; ++ xrx200_pce_table_entry_read(&tev); ++ ++ if (tev.valid == 0) ++ continue; ++ ++ tem.index = index; ++ xrx200_pce_table_entry_read(&tem); ++ ++ if (tem.val[0] == 0) ++ continue; ++ ++ untagged = portmap & (tem.val[1] ^ tem.val[2]); ++ ++ for (p = 0; p < XRX200_MAX_PORT; p++) ++ if (untagged & BIT(p)) ++ { ++ portmap &= ~BIT(p); ++ xrx200sw_write_x(index, XRX200_PCE_DEFPVID_PVID, p); ++ } ++ ++ for (p = 0; p < XRX200_MAX_PORT; p++) ++ if (portmap & BIT(p)) ++ xrx200sw_write_x(index, XRX200_PCE_DEFPVID_PVID, p); ++ } ++} ++ ++// swconfig interface ++static void xrx200_hw_init(struct xrx200_hw *hw); ++ ++// global ++static int xrx200sw_reset_switch(struct switch_dev *dev) ++{ ++ struct xrx200_hw *hw = container_of(dev, struct xrx200_hw, swdev); ++ ++ xrx200_hw_init(hw); ++ ++ return 0; ++} ++ ++static int xrx200_set_vlan_mode_enable(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) ++{ ++ int p; ++ ++ if ((attr->max > 0) && (val->value.i > attr->max)) ++ return -EINVAL; ++ ++ for (p = 0; p < XRX200_MAX_PORT; p++) { ++ xrx200sw_write_x(val->value.i, XRX200_PCE_VCTRL_VEMR, p); ++ xrx200sw_write_x(val->value.i, XRX200_PCE_VCTRL_VIMR, p); ++ } ++ ++ xrx200sw_write(val->value.i, XRX200_PCE_GCTRL_0_VLAN); ++ return 0; ++} ++ ++static int xrx200_get_vlan_mode_enable(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) ++{ ++ val->value.i = xrx200sw_read(attr->id); ++ return 0; ++} ++ ++static int xrx200_set_global_attr(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) ++{ ++ if ((attr->max > 0) && (val->value.i > attr->max)) ++ return -EINVAL; ++ ++ xrx200sw_write(val->value.i, attr->id); ++ return 0; ++} ++ ++static int xrx200_get_global_attr(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) ++{ ++ val->value.i = xrx200sw_read(attr->id); ++ return 0; ++} ++ ++// vlan ++static int xrx200sw_set_vlan_vid(struct switch_dev *dev, const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct xrx200_hw *hw = container_of(dev, struct xrx200_hw, swdev); ++ int i; ++ struct xrx200_pce_table_entry tev; ++ struct xrx200_pce_table_entry tem; ++ ++ tev.table = XRX200_PCE_ACTVLAN_IDX; ++ ++ for (i = 0; i < XRX200_MAX_VLAN; i++) ++ { ++ tev.index = i; ++ xrx200_pce_table_entry_read(&tev); ++ if (tev.key[0] == val->value.i && i != val->port_vlan) ++ return -EINVAL; ++ } ++ ++ hw->vlan_vid[val->port_vlan] = val->value.i; ++ ++ tev.index = val->port_vlan; ++ xrx200_pce_table_entry_read(&tev); ++ tev.key[0] = val->value.i; ++ tev.valid = val->value.i > 0; ++ xrx200_pce_table_entry_write(&tev); ++ ++ tem.table = XRX200_PCE_VLANMAP_IDX; ++ tem.index = val->port_vlan; ++ xrx200_pce_table_entry_read(&tem); ++ tem.val[0] = val->value.i; ++ xrx200_pce_table_entry_write(&tem); ++ ++ xrx200sw_fixup_pvids(); ++ return 0; ++} ++ ++static int xrx200sw_get_vlan_vid(struct switch_dev *dev, const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct xrx200_pce_table_entry te; ++ ++ te.table = XRX200_PCE_ACTVLAN_IDX; ++ te.index = val->port_vlan; ++ xrx200_pce_table_entry_read(&te); ++ val->value.i = te.key[0]; ++ ++ return 0; ++} ++ ++static int xrx200sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val) ++{ ++ struct xrx200_hw *hw = container_of(dev, struct xrx200_hw, swdev); ++ int i, portmap, tagmap, untagged; ++ struct xrx200_pce_table_entry tem; ++ ++ portmap = 0; ++ tagmap = 0; ++ for (i = 0; i < val->len; i++) ++ { ++ struct switch_port *p = &val->value.ports[i]; ++ ++ portmap |= (1 << p->id); ++ if (p->flags & (1 << SWITCH_PORT_FLAG_TAGGED)) ++ tagmap |= (1 << p->id); ++ } ++ ++ tem.table = XRX200_PCE_VLANMAP_IDX; ++ ++ untagged = portmap ^ tagmap; ++ for (i = 0; i < XRX200_MAX_VLAN; i++) ++ { ++ tem.index = i; ++ xrx200_pce_table_entry_read(&tem); ++ ++ if (tem.val[0] == 0) ++ continue; ++ ++ if ((untagged & (tem.val[1] ^ tem.val[2])) && (val->port_vlan != i)) ++ return -EINVAL; ++ } ++ ++ tem.index = val->port_vlan; ++ xrx200_pce_table_entry_read(&tem); ++ ++ // auto-enable this vlan if not enabled already ++ if (tem.val[0] == 0) ++ { ++ struct switch_val v; ++ v.port_vlan = val->port_vlan; ++ v.value.i = val->port_vlan; ++ if(xrx200sw_set_vlan_vid(dev, NULL, &v)) ++ return -EINVAL; ++ ++ //read updated tem ++ tem.index = val->port_vlan; ++ xrx200_pce_table_entry_read(&tem); ++ } ++ ++ tem.val[1] = portmap; ++ tem.val[2] = tagmap; ++ xrx200_pce_table_entry_write(&tem); ++ ++ ltq_switch_w32_mask(0, portmap, PCE_PMAP2); ++ ltq_switch_w32_mask(0, portmap, PCE_PMAP3); ++ hw->vlan_port_map[val->port_vlan] = portmap; ++ ++ xrx200sw_fixup_pvids(); ++ ++ return 0; ++} ++ ++static int xrx200sw_get_vlan_ports(struct switch_dev *dev, struct switch_val *val) ++{ ++ int i; ++ unsigned short ports, tags; ++ struct xrx200_pce_table_entry tem; ++ ++ tem.table = XRX200_PCE_VLANMAP_IDX; ++ tem.index = val->port_vlan; ++ xrx200_pce_table_entry_read(&tem); ++ ++ ports = tem.val[1]; ++ tags = tem.val[2]; ++ ++ for (i = 0; i < XRX200_MAX_PORT; i++) { ++ struct switch_port *p; ++ ++ if (!(ports & (1 << i))) ++ continue; ++ ++ p = &val->value.ports[val->len++]; ++ p->id = i; ++ if (tags & (1 << i)) ++ p->flags = (1 << SWITCH_PORT_FLAG_TAGGED); ++ else ++ p->flags = 0; ++ } ++ ++ return 0; ++} ++ ++static int xrx200sw_set_vlan_enable(struct switch_dev *dev, const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct xrx200_pce_table_entry tev; ++ ++ tev.table = XRX200_PCE_ACTVLAN_IDX; ++ tev.index = val->port_vlan; ++ xrx200_pce_table_entry_read(&tev); ++ ++ if (tev.key[0] == 0) ++ return -EINVAL; ++ ++ tev.valid = val->value.i; ++ xrx200_pce_table_entry_write(&tev); ++ ++ xrx200sw_fixup_pvids(); ++ return 0; ++} ++ ++static int xrx200sw_get_vlan_enable(struct switch_dev *dev, const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ struct xrx200_pce_table_entry tev; ++ ++ tev.table = XRX200_PCE_ACTVLAN_IDX; ++ tev.index = val->port_vlan; ++ xrx200_pce_table_entry_read(&tev); ++ val->value.i = tev.valid; ++ ++ return 0; ++} ++ ++// port ++static int xrx200sw_get_port_pvid(struct switch_dev *dev, int port, int *val) ++{ ++ struct xrx200_pce_table_entry tev; ++ ++ if (port >= XRX200_MAX_PORT) ++ return -EINVAL; ++ ++ tev.table = XRX200_PCE_ACTVLAN_IDX; ++ tev.index = xrx200sw_read_x(XRX200_PCE_DEFPVID_PVID, port); ++ xrx200_pce_table_entry_read(&tev); ++ ++ *val = tev.key[0]; ++ return 0; ++} ++ ++static int xrx200sw_get_port_link(struct switch_dev *dev, ++ int port, ++ struct switch_port_link *link) ++{ ++ if (port >= XRX200_MAX_PORT) ++ return -EINVAL; ++ ++ link->link = xrx200sw_read_x(XRX200_MAC_PSTAT_LSTAT, port); ++ if (!link->link) ++ return 0; ++ ++ link->duplex = xrx200sw_read_x(XRX200_MAC_PSTAT_FDUP, port); ++ ++ link->rx_flow = !!(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port) && 0x0010); ++ link->tx_flow = !!(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port) && 0x0020); ++ link->aneg = !(xrx200sw_read_x(XRX200_MAC_CTRL_0_FCON, port)); ++ ++ link->speed = SWITCH_PORT_SPEED_10; ++ if (xrx200sw_read_x(XRX200_MAC_PSTAT_MBIT, port)) ++ link->speed = SWITCH_PORT_SPEED_100; ++ if (xrx200sw_read_x(XRX200_MAC_PSTAT_GBIT, port)) ++ link->speed = SWITCH_PORT_SPEED_1000; ++ ++ return 0; ++} ++ ++static int xrx200_set_port_attr(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) ++{ ++ if (val->port_vlan >= XRX200_MAX_PORT) ++ return -EINVAL; ++ ++ if ((attr->max > 0) && (val->value.i > attr->max)) ++ return -EINVAL; ++ ++ xrx200sw_write_x(val->value.i, attr->id, val->port_vlan); ++ return 0; ++} ++ ++static int xrx200_get_port_attr(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) ++{ ++ if (val->port_vlan >= XRX200_MAX_PORT) ++ return -EINVAL; ++ ++ val->value.i = xrx200sw_read_x(attr->id, val->port_vlan); ++ return 0; ++} ++ ++// attributes ++static struct switch_attr xrx200sw_globals[] = { ++ { ++ .type = SWITCH_TYPE_INT, ++ .set = xrx200_set_vlan_mode_enable, ++ .get = xrx200_get_vlan_mode_enable, ++ .name = "enable_vlan", ++ .description = "Enable VLAN mode", ++ .max = 1}, ++}; ++ ++static struct switch_attr xrx200sw_port[] = { ++ { ++ XRX200_PORT_REGATTR(XRX200_PCE_VCTRL_UVR), ++ .name = "uvr", ++ .description = "Unknown VLAN Rule", ++ .max = 1, ++ }, ++ { ++ XRX200_PORT_REGATTR(XRX200_PCE_VCTRL_VSR), ++ .name = "vsr", ++ .description = "VLAN Security Rule", ++ .max = 1, ++ }, ++ { ++ XRX200_PORT_REGATTR(XRX200_PCE_VCTRL_VINR), ++ .name = "vinr", ++ .description = "VLAN Ingress Tag Rule", ++ .max = 2, ++ }, ++ { ++ XRX200_PORT_REGATTR(XRX200_PCE_PCTRL_0_TVM), ++ .name = "tvm", ++ .description = "Transparent VLAN Mode", ++ .max = 1, ++ }, ++}; ++ ++static struct switch_attr xrx200sw_vlan[] = { ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "vid", ++ .description = "VLAN ID (0-4094)", ++ .set = xrx200sw_set_vlan_vid, ++ .get = xrx200sw_get_vlan_vid, ++ .max = 4094, ++ }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "enable", ++ .description = "Enable VLAN", ++ .set = xrx200sw_set_vlan_enable, ++ .get = xrx200sw_get_vlan_enable, ++ .max = 1, ++ }, ++}; ++ ++static const struct switch_dev_ops xrx200sw_ops = { ++ .attr_global = { ++ .attr = xrx200sw_globals, ++ .n_attr = ARRAY_SIZE(xrx200sw_globals), ++ }, ++ .attr_port = { ++ .attr = xrx200sw_port, ++ .n_attr = ARRAY_SIZE(xrx200sw_port), ++ }, ++ .attr_vlan = { ++ .attr = xrx200sw_vlan, ++ .n_attr = ARRAY_SIZE(xrx200sw_vlan), ++ }, ++ .get_vlan_ports = xrx200sw_get_vlan_ports, ++ .set_vlan_ports = xrx200sw_set_vlan_ports, ++ .get_port_pvid = xrx200sw_get_port_pvid, ++ .reset_switch = xrx200sw_reset_switch, ++ .get_port_link = xrx200sw_get_port_link, ++// .get_port_stats = xrx200sw_get_port_stats, //TODO ++}; ++ ++static int xrx200sw_init(struct xrx200_hw *hw) ++{ ++ int netdev_num; ++ ++ for (netdev_num = 0; netdev_num < hw->num_devs; netdev_num++) ++ { ++ struct switch_dev *swdev; ++ struct net_device *dev = hw->devs[netdev_num]; ++ struct xrx200_priv *priv = netdev_priv(dev); ++ if (!priv->sw) ++ continue; ++ ++ swdev = &hw->swdev; ++ ++ swdev->name = "Lantiq XRX200 Switch"; ++ swdev->vlans = XRX200_MAX_VLAN; ++ swdev->ports = XRX200_MAX_PORT; ++ swdev->cpu_port = 6; ++ swdev->ops = &xrx200sw_ops; ++ ++ register_switch(swdev, dev); ++ return 0; // enough switches ++ } ++ return 0; ++} ++ ++static int xrx200_open(struct net_device *dev) ++{ ++ struct xrx200_priv *priv = netdev_priv(dev); ++ int i; ++ ++ for (i = 0; i < XRX200_MAX_DMA; i++) { ++ if (!priv->hw->chan[i].dma.irq) ++ continue; ++ spin_lock_bh(&priv->hw->chan[i].lock); ++ if (!priv->hw->chan[i].refcount) { ++ if (XRX200_DMA_IS_RX(i)) ++ napi_enable(&priv->hw->chan[i].napi); ++ ltq_dma_open(&priv->hw->chan[i].dma); ++ } ++ priv->hw->chan[i].refcount++; ++ spin_unlock_bh(&priv->hw->chan[i].lock); ++ } ++ for (i = 0; i < priv->num_port; i++) ++ if (priv->port[i].phydev) ++ phy_start(priv->port[i].phydev); ++ netif_wake_queue(dev); ++ ++ return 0; ++} ++ ++static int xrx200_close(struct net_device *dev) ++{ ++ struct xrx200_priv *priv = netdev_priv(dev); ++ int i; ++ ++ netif_stop_queue(dev); ++ ++ for (i = 0; i < priv->num_port; i++) ++ if (priv->port[i].phydev) ++ phy_stop(priv->port[i].phydev); ++ ++ for (i = 0; i < XRX200_MAX_DMA; i++) { ++ if (!priv->hw->chan[i].dma.irq) ++ continue; ++ ++ priv->hw->chan[i].refcount--; ++ if (!priv->hw->chan[i].refcount) { ++ if (XRX200_DMA_IS_RX(i)) ++ napi_disable(&priv->hw->chan[i].napi); ++ spin_lock_bh(&priv->hw->chan[i].lock); ++ ltq_dma_close(&priv->hw->chan[XRX200_DMA_RX].dma); ++ spin_unlock_bh(&priv->hw->chan[i].lock); ++ } ++ } ++ ++ return 0; ++} ++ ++static int xrx200_alloc_skb(struct xrx200_chan *ch) ++{ ++#define DMA_PAD (NET_IP_ALIGN + NET_SKB_PAD) ++ ch->skb[ch->dma.desc] = dev_alloc_skb(XRX200_DMA_DATA_LEN + DMA_PAD); ++ if (!ch->skb[ch->dma.desc]) ++ goto skip; ++ ++ skb_reserve(ch->skb[ch->dma.desc], NET_SKB_PAD); ++ ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL, ++ ch->skb[ch->dma.desc]->data, XRX200_DMA_DATA_LEN, ++ DMA_FROM_DEVICE); ++ ch->dma.desc_base[ch->dma.desc].addr = ++ CPHYSADDR(ch->skb[ch->dma.desc]->data); ++ skb_reserve(ch->skb[ch->dma.desc], NET_IP_ALIGN); ++ ++skip: ++ ch->dma.desc_base[ch->dma.desc].ctl = ++ LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) | ++ XRX200_DMA_DATA_LEN; ++ ++ return 0; ++} ++ ++static void xrx200_hw_receive(struct xrx200_chan *ch, int id) ++{ ++ struct net_device *dev = ch->devs[id]; ++ struct xrx200_priv *priv = netdev_priv(dev); ++ struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; ++ struct sk_buff *skb = ch->skb[ch->dma.desc]; ++ int len = (desc->ctl & LTQ_DMA_SIZE_MASK); ++ int ret; ++ ++ ret = xrx200_alloc_skb(ch); ++ ++ ch->dma.desc++; ++ ch->dma.desc %= LTQ_DESC_NUM; ++ ++ if (ret) { ++ netdev_err(dev, ++ "failed to allocate new rx buffer\n"); ++ return; ++ } ++ ++ skb_put(skb, len); ++#ifdef SW_ROUTING ++ skb_pull(skb, 8); ++#endif ++ skb->dev = dev; ++ skb->protocol = eth_type_trans(skb, dev); ++ netif_receive_skb(skb); ++ priv->stats.rx_packets++; ++ priv->stats.rx_bytes+=len; ++} ++ ++static int xrx200_poll_rx(struct napi_struct *napi, int budget) ++{ ++ struct xrx200_chan *ch = container_of(napi, ++ struct xrx200_chan, napi); ++ struct xrx200_priv *priv = netdev_priv(ch->devs[0]); ++ int rx = 0; ++ int complete = 0; ++ ++ while ((rx < budget) && !complete) { ++ struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; ++ if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) { ++#ifdef SW_ROUTING ++ struct sk_buff *skb = ch->skb[ch->dma.desc]; ++ u8 *special_tag = (u8*)skb->data; ++ int port = (special_tag[7] >> SPPID_SHIFT) & SPPID_MASK; ++ xrx200_hw_receive(ch, priv->hw->port_map[port]); ++#else ++ xrx200_hw_receive(ch, 0); ++#endif ++ rx++; ++ } else { ++ complete = 1; ++ } ++ } ++ ++ if (complete || !rx) { ++ napi_complete(&ch->napi); ++ ltq_dma_enable_irq(&ch->dma); ++ } ++ ++ return rx; ++} ++ ++static void xrx200_tx_housekeeping(unsigned long ptr) ++{ ++ struct xrx200_chan *ch = (struct xrx200_chan *) ptr; ++ int pkts = 0; ++ int i; ++ ++ spin_lock_bh(&ch->lock); ++ ltq_dma_ack_irq(&ch->dma); ++ while ((ch->dma.desc_base[ch->tx_free].ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) { ++ struct sk_buff *skb = ch->skb[ch->tx_free]; ++ ++ pkts++; ++ ch->skb[ch->tx_free] = NULL; ++ dev_kfree_skb(skb); ++ memset(&ch->dma.desc_base[ch->tx_free], 0, ++ sizeof(struct ltq_dma_desc)); ++ ch->tx_free++; ++ ch->tx_free %= LTQ_DESC_NUM; ++ } ++ ltq_dma_enable_irq(&ch->dma); ++ spin_unlock_bh(&ch->lock); ++ ++ if (!pkts) ++ return; ++ ++ for (i = 0; i < XRX200_MAX_DEV && ch->devs[i]; i++) ++ netif_wake_queue(ch->devs[i]); ++} ++ ++static struct net_device_stats *xrx200_get_stats (struct net_device *dev) ++{ ++ struct xrx200_priv *priv = netdev_priv(dev); ++ ++ return &priv->stats; ++} ++ ++static void xrx200_tx_timeout(struct net_device *dev) ++{ ++ struct xrx200_priv *priv = netdev_priv(dev); ++ ++ printk(KERN_ERR "%s: transmit timed out, disable the dma channel irq\n", dev->name); ++ ++ priv->stats.tx_errors++; ++ netif_wake_queue(dev); ++} ++ ++static int xrx200_start_xmit(struct sk_buff *skb, struct net_device *dev) ++{ ++ struct xrx200_priv *priv = netdev_priv(dev); ++ struct xrx200_chan *ch; ++ struct ltq_dma_desc *desc; ++ u32 byte_offset; ++ int ret = NETDEV_TX_OK; ++ int len; ++#ifdef SW_ROUTING ++ u32 special_tag = (SPID_CPU_PORT << SPID_SHIFT) | DPID_ENABLE; ++#endif ++ if(priv->id) ++ ch = &priv->hw->chan[XRX200_DMA_TX_2]; ++ else ++ ch = &priv->hw->chan[XRX200_DMA_TX]; ++ ++ desc = &ch->dma.desc_base[ch->dma.desc]; ++ ++ skb->dev = dev; ++ len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; ++ ++#ifdef SW_ROUTING ++ if (is_multicast_ether_addr(eth_hdr(skb)->h_dest)) { ++ u16 port_map = priv->port_map; ++ ++ if (priv->sw && skb->protocol == htons(ETH_P_8021Q)) { ++ u16 vid; ++ int i; ++ ++ port_map = 0; ++ if (!__vlan_get_tag(skb, &vid)) { ++ for (i = 0; i < XRX200_MAX_VLAN; i++) { ++ if (priv->hw->vlan_vid[i] != vid) ++ continue; ++ port_map = priv->hw->vlan_port_map[i]; ++ break; ++ } ++ } ++ } ++ ++ special_tag |= (port_map << PORT_MAP_SHIFT) | ++ PORT_MAP_SEL | PORT_MAP_EN; ++ } ++ if(priv->wan) ++ special_tag |= (1 << DPID_SHIFT); ++ if(skb_headroom(skb) < 4) { ++ struct sk_buff *tmp = skb_realloc_headroom(skb, 4); ++ dev_kfree_skb_any(skb); ++ skb = tmp; ++ } ++ skb_push(skb, 4); ++ memcpy(skb->data, &special_tag, sizeof(u32)); ++ len += 4; ++#endif ++ ++ /* dma needs to start on a 16 byte aligned address */ ++ byte_offset = CPHYSADDR(skb->data) % 16; ++ ++ spin_lock_bh(&ch->lock); ++ if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { ++ netdev_err(dev, "tx ring full\n"); ++ netif_stop_queue(dev); ++ ret = NETDEV_TX_BUSY; ++ goto out; ++ } ++ ++ ch->skb[ch->dma.desc] = skb; ++ ++ netif_trans_update(dev); ++ ++ desc->addr = ((unsigned int) dma_map_single(NULL, skb->data, len, ++ DMA_TO_DEVICE)) - byte_offset; ++ wmb(); ++ desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP | ++ LTQ_DMA_TX_OFFSET(byte_offset) | (len & LTQ_DMA_SIZE_MASK); ++ ch->dma.desc++; ++ ch->dma.desc %= LTQ_DESC_NUM; ++ if (ch->dma.desc == ch->tx_free) ++ netif_stop_queue(dev); ++ ++ ++ priv->stats.tx_packets++; ++ priv->stats.tx_bytes+=len; ++ ++out: ++ spin_unlock_bh(&ch->lock); ++ ++ return ret; ++} ++ ++static irqreturn_t xrx200_dma_irq(int irq, void *priv) ++{ ++ struct xrx200_hw *hw = priv; ++ int chnr = irq - XRX200_DMA_IRQ; ++ struct xrx200_chan *ch = &hw->chan[chnr]; ++ ++ ltq_dma_disable_irq(&ch->dma); ++ ltq_dma_ack_irq(&ch->dma); ++ ++ if (chnr % 2) ++ tasklet_schedule(&ch->tasklet); ++ else ++ napi_schedule(&ch->napi); ++ ++ return IRQ_HANDLED; ++} ++ ++static int xrx200_dma_init(struct xrx200_hw *hw) ++{ ++ int i, err = 0; ++ ++ ltq_dma_init_port(DMA_PORT_ETOP); ++ ++ for (i = 0; i < 8 && !err; i++) { ++ int irq = XRX200_DMA_IRQ + i; ++ struct xrx200_chan *ch = &hw->chan[i]; ++ ++ spin_lock_init(&ch->lock); ++ ++ ch->idx = ch->dma.nr = i; ++ ++ if (i == XRX200_DMA_TX) { ++ ltq_dma_alloc_tx(&ch->dma); ++ err = request_irq(irq, xrx200_dma_irq, 0, "vrx200_tx", hw); ++ } else if (i == XRX200_DMA_TX_2) { ++ ltq_dma_alloc_tx(&ch->dma); ++ err = request_irq(irq, xrx200_dma_irq, 0, "vrx200_tx_2", hw); ++ } else if (i == XRX200_DMA_RX) { ++ ltq_dma_alloc_rx(&ch->dma); ++ for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; ++ ch->dma.desc++) ++ if (xrx200_alloc_skb(ch)) ++ err = -ENOMEM; ++ ch->dma.desc = 0; ++ err = request_irq(irq, xrx200_dma_irq, 0, "vrx200_rx", hw); ++ } else ++ continue; ++ ++ if (!err) ++ ch->dma.irq = irq; ++ else ++ pr_err("net-xrx200: failed to request irq %d\n", irq); ++ } ++ ++ return err; ++} ++ ++#ifdef SW_POLLING ++static void xrx200_gmac_update(struct xrx200_port *port) ++{ ++ u16 phyaddr = port->phydev->mdio.addr & MDIO_PHY_ADDR_MASK; ++ u16 miimode = ltq_mii_r32(MII_CFG(port->num)) & MII_CFG_MODE_MASK; ++ u16 miirate = 0; ++ ++ switch (port->phydev->speed) { ++ case SPEED_1000: ++ phyaddr |= MDIO_PHY_SPEED_G1; ++ miirate = MII_CFG_RATE_M125; ++ break; ++ ++ case SPEED_100: ++ phyaddr |= MDIO_PHY_SPEED_M100; ++ switch (miimode) { ++ case MII_CFG_MODE_RMIIM: ++ case MII_CFG_MODE_RMIIP: ++ miirate = MII_CFG_RATE_M50; ++ break; ++ default: ++ miirate = MII_CFG_RATE_M25; ++ break; ++ } ++ break; ++ ++ default: ++ phyaddr |= MDIO_PHY_SPEED_M10; ++ miirate = MII_CFG_RATE_M2P5; ++ break; ++ } ++ ++ if (port->phydev->link) ++ phyaddr |= MDIO_PHY_LINK_UP; ++ else ++ phyaddr |= MDIO_PHY_LINK_DOWN; ++ ++ if (port->phydev->duplex == DUPLEX_FULL) ++ phyaddr |= MDIO_PHY_FDUP_EN; ++ else ++ phyaddr |= MDIO_PHY_FDUP_DIS; ++ ++ ltq_mdio_w32_mask(MDIO_UPDATE_MASK, phyaddr, MDIO_PHY(port->num)); ++ ltq_mii_w32_mask(MII_CFG_RATE_MASK, miirate, MII_CFG(port->num)); ++ udelay(1); ++} ++#else ++static void xrx200_gmac_update(struct xrx200_port *port) ++{ ++ ++} ++#endif ++ ++static void xrx200_mdio_link(struct net_device *dev) ++{ ++ struct xrx200_priv *priv = netdev_priv(dev); ++ bool link = false; ++ int i; ++ ++ for (i = 0; i < priv->num_port; i++) { ++ if (!priv->port[i].phydev) ++ continue; ++ ++ if (priv->port[i].phydev->link) ++ link = true; ++ ++ if (priv->port[i].link != priv->port[i].phydev->link) { ++ xrx200_gmac_update(&priv->port[i]); ++ priv->port[i].link = priv->port[i].phydev->link; ++ netdev_info(dev, "port %d %s link\n", ++ priv->port[i].num, ++ (priv->port[i].link)?("got"):("lost")); ++ } ++ } ++ if (netif_carrier_ok(dev) && !link) ++ netif_carrier_off(dev); ++} ++ ++static inline int xrx200_mdio_poll(struct mii_bus *bus) ++{ ++ unsigned cnt = 10000; ++ ++ while (likely(cnt--)) { ++ unsigned ctrl = ltq_mdio_r32(MDIO_CTRL); ++ if ((ctrl & MDIO_BUSY) == 0) ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static int xrx200_mdio_wr(struct mii_bus *bus, int addr, int reg, u16 val) ++{ ++ if (xrx200_mdio_poll(bus)) ++ return 1; ++ ++ ltq_mdio_w32(val, MDIO_WRITE); ++ ltq_mdio_w32(MDIO_BUSY | MDIO_WR | ++ ((addr & MDIO_MASK) << MDIO_ADDRSHIFT) | ++ (reg & MDIO_MASK), ++ MDIO_CTRL); ++ ++ return 0; ++} ++ ++static int xrx200_mdio_rd(struct mii_bus *bus, int addr, int reg) ++{ ++ if (xrx200_mdio_poll(bus)) ++ return -1; ++ ++ ltq_mdio_w32(MDIO_BUSY | MDIO_RD | ++ ((addr & MDIO_MASK) << MDIO_ADDRSHIFT) | ++ (reg & MDIO_MASK), ++ MDIO_CTRL); ++ ++ if (xrx200_mdio_poll(bus)) ++ return -1; ++ ++ return ltq_mdio_r32(MDIO_READ); ++} ++ ++static int xrx200_mdio_probe(struct net_device *dev, struct xrx200_port *port) ++{ ++ struct xrx200_priv *priv = netdev_priv(dev); ++ struct phy_device *phydev = NULL; ++ unsigned val; ++ ++ phydev = mdiobus_get_phy(priv->hw->mii_bus, port->phy_addr); ++ ++ if (!phydev) { ++ netdev_err(dev, "no PHY found\n"); ++ return -ENODEV; ++ } ++ ++ phydev = phy_connect(dev, phydev_name(phydev), &xrx200_mdio_link, ++ port->phy_if); ++ ++ if (IS_ERR(phydev)) { ++ netdev_err(dev, "Could not attach to PHY\n"); ++ return PTR_ERR(phydev); ++ } ++ ++ phydev->supported &= (SUPPORTED_10baseT_Half ++ | SUPPORTED_10baseT_Full ++ | SUPPORTED_100baseT_Half ++ | SUPPORTED_100baseT_Full ++ | SUPPORTED_1000baseT_Half ++ | SUPPORTED_1000baseT_Full ++ | SUPPORTED_Autoneg ++ | SUPPORTED_MII ++ | SUPPORTED_TP); ++ phydev->advertising = phydev->supported; ++ port->phydev = phydev; ++ phydev->no_auto_carrier_off = true; ++ ++ phy_attached_info(phydev); ++ ++#ifdef SW_POLLING ++ phy_read_status(phydev); ++ ++ val = xrx200_mdio_rd(priv->hw->mii_bus, MDIO_DEVAD_NONE, MII_CTRL1000); ++ val |= ADVERTIZE_MPD; ++ xrx200_mdio_wr(priv->hw->mii_bus, MDIO_DEVAD_NONE, MII_CTRL1000, val); ++ xrx200_mdio_wr(priv->hw->mii_bus, 0, 0, 0x1040); ++ ++ phy_start_aneg(phydev); ++#endif ++ return 0; ++} ++ ++static void xrx200_port_config(struct xrx200_priv *priv, ++ const struct xrx200_port *port) ++{ ++ u16 miimode = 0; ++ ++ switch (port->num) { ++ case 0: /* xMII0 */ ++ case 1: /* xMII1 */ ++ switch (port->phy_if) { ++ case PHY_INTERFACE_MODE_MII: ++ if (port->flags & XRX200_PORT_TYPE_PHY) ++ /* MII MAC mode, connected to external PHY */ ++ miimode = MII_CFG_MODE_MIIM; ++ else ++ /* MII PHY mode, connected to external MAC */ ++ miimode = MII_CFG_MODE_MIIP; ++ break; ++ case PHY_INTERFACE_MODE_RMII: ++ if (port->flags & XRX200_PORT_TYPE_PHY) ++ /* RMII MAC mode, connected to external PHY */ ++ miimode = MII_CFG_MODE_RMIIM; ++ else ++ /* RMII PHY mode, connected to external MAC */ ++ miimode = MII_CFG_MODE_RMIIP; ++ break; ++ case PHY_INTERFACE_MODE_RGMII: ++ /* RGMII MAC mode, connected to external PHY */ ++ miimode = MII_CFG_MODE_RGMII; ++ break; ++ default: ++ break; ++ } ++ break; ++ case 2: /* internal GPHY0 */ ++ case 3: /* internal GPHY0 */ ++ case 4: /* internal GPHY1 */ ++ switch (port->phy_if) { ++ case PHY_INTERFACE_MODE_MII: ++ case PHY_INTERFACE_MODE_GMII: ++ /* MII MAC mode, connected to internal GPHY */ ++ miimode = MII_CFG_MODE_MIIM; ++ break; ++ default: ++ break; ++ } ++ break; ++ case 5: /* internal GPHY1 or xMII2 */ ++ switch (port->phy_if) { ++ case PHY_INTERFACE_MODE_MII: ++ /* MII MAC mode, connected to internal GPHY */ ++ miimode = MII_CFG_MODE_MIIM; ++ break; ++ case PHY_INTERFACE_MODE_RGMII: ++ /* RGMII MAC mode, connected to external PHY */ ++ miimode = MII_CFG_MODE_RGMII; ++ break; ++ default: ++ break; ++ } ++ break; ++ default: ++ break; ++ } ++ ++ ltq_mii_w32_mask(MII_CFG_MODE_MASK, miimode | MII_CFG_EN, ++ MII_CFG(port->num)); ++} ++ ++static int xrx200_init(struct net_device *dev) ++{ ++ struct xrx200_priv *priv = netdev_priv(dev); ++ struct sockaddr mac; ++ int err, i; ++ ++#ifndef SW_POLLING ++ unsigned int reg = 0; ++ ++ /* enable auto polling */ ++ for (i = 0; i < priv->num_port; i++) ++ reg |= BIT(priv->port[i].num); ++ ltq_mdio_w32(reg, MDIO_CLK_CFG0); ++ ltq_mdio_w32(MDIO1_25MHZ, MDIO_CLK_CFG1); ++#endif ++ ++ /* setup each port */ ++ for (i = 0; i < priv->num_port; i++) ++ xrx200_port_config(priv, &priv->port[i]); ++ ++ memcpy(&mac.sa_data, priv->mac, ETH_ALEN); ++ if (!is_valid_ether_addr(mac.sa_data)) { ++ pr_warn("net-xrx200: invalid MAC, using random\n"); ++ eth_random_addr(mac.sa_data); ++ dev->addr_assign_type |= NET_ADDR_RANDOM; ++ } ++ ++ err = eth_mac_addr(dev, &mac); ++ if (err) ++ goto err_netdev; ++ ++ for (i = 0; i < priv->num_port; i++) ++ if (xrx200_mdio_probe(dev, &priv->port[i])) ++ pr_warn("xrx200-mdio: probing phy of port %d failed\n", ++ priv->port[i].num); ++ ++ return 0; ++ ++err_netdev: ++ unregister_netdev(dev); ++ free_netdev(dev); ++ return err; ++} ++ ++static void xrx200_pci_microcode(void) ++{ ++ int i; ++ ++ ltq_switch_w32_mask(PCE_TBL_CFG_ADDR_MASK | PCE_TBL_CFG_ADWR_MASK, ++ PCE_TBL_CFG_ADWR, PCE_TBL_CTRL); ++ ltq_switch_w32(0, PCE_TBL_MASK); ++ ++ for (i = 0; i < ARRAY_SIZE(pce_microcode); i++) { ++ ltq_switch_w32(i, PCE_TBL_ADDR); ++ ltq_switch_w32(pce_microcode[i].val[3], PCE_TBL_VAL(0)); ++ ltq_switch_w32(pce_microcode[i].val[2], PCE_TBL_VAL(1)); ++ ltq_switch_w32(pce_microcode[i].val[1], PCE_TBL_VAL(2)); ++ ltq_switch_w32(pce_microcode[i].val[0], PCE_TBL_VAL(3)); ++ ++ // start the table access: ++ ltq_switch_w32_mask(0, PCE_TBL_BUSY, PCE_TBL_CTRL); ++ while (ltq_switch_r32(PCE_TBL_CTRL) & PCE_TBL_BUSY); ++ } ++ ++ /* tell the switch that the microcode is loaded */ ++ ltq_switch_w32_mask(0, BIT(3), PCE_GCTRL_REG(0)); ++} ++ ++static void xrx200_hw_init(struct xrx200_hw *hw) ++{ ++ int i; ++ ++ /* enable clock gate */ ++ clk_enable(hw->clk); ++ ++ ltq_switch_w32(1, 0); ++ mdelay(100); ++ ltq_switch_w32(0, 0); ++ /* ++ * TODO: we should really disbale all phys/miis here and explicitly ++ * enable them in the device secific init function ++ */ ++ ++ /* disable port fetch/store dma */ ++ for (i = 0; i < 7; i++ ) { ++ ltq_switch_w32(0, FDMA_PCTRLx(i)); ++ ltq_switch_w32(0, SDMA_PCTRLx(i)); ++ } ++ ++ /* enable Switch */ ++ ltq_mdio_w32_mask(0, MDIO_GLOB_ENABLE, MDIO_GLOB); ++ ++ /* load the pce microcode */ ++ xrx200_pci_microcode(); ++ ++ /* Default unknown Broadcat/Multicast/Unicast port maps */ ++ ltq_switch_w32(0x40, PCE_PMAP1); ++ ltq_switch_w32(0x40, PCE_PMAP2); ++ ltq_switch_w32(0x40, PCE_PMAP3); ++ ++ /* RMON Counter Enable for all physical ports */ ++ for (i = 0; i < 7; i++) ++ ltq_switch_w32(0x1, BM_PCFG(i)); ++ ++ /* disable auto polling */ ++ ltq_mdio_w32(0x0, MDIO_CLK_CFG0); ++ ++ /* enable port statistic counters */ ++ for (i = 0; i < 7; i++) ++ ltq_switch_w32(0x1, BM_PCFGx(i)); ++ ++ /* set IPG to 12 */ ++ ltq_pmac_w32_mask(PMAC_IPG_MASK, 0xb, PMAC_RX_IPG); ++ ++#ifdef SW_ROUTING ++ /* enable status header, enable CRC */ ++ ltq_pmac_w32_mask(0, ++ PMAC_HD_CTL_RST | PMAC_HD_CTL_AST | PMAC_HD_CTL_RXSH | PMAC_HD_CTL_AS | PMAC_HD_CTL_AC | PMAC_HD_CTL_RC, ++ PMAC_HD_CTL); ++#else ++ /* disable status header, enable CRC */ ++ ltq_pmac_w32_mask(PMAC_HD_CTL_AST | PMAC_HD_CTL_RXSH | PMAC_HD_CTL_AS, ++ PMAC_HD_CTL_AC | PMAC_HD_CTL_RC, ++ PMAC_HD_CTL); ++#endif ++ ++ /* enable port fetch/store dma & VLAN Modification */ ++ for (i = 0; i < 7; i++ ) { ++ ltq_switch_w32_mask(0, 0x19, FDMA_PCTRLx(i)); ++ ltq_switch_w32_mask(0, 0x01, SDMA_PCTRLx(i)); ++ ltq_switch_w32_mask(0, PCE_INGRESS, PCE_PCTRL_REG(i, 0)); ++ } ++ ++ /* enable special tag insertion on cpu port */ ++ ltq_switch_w32_mask(0, 0x02, FDMA_PCTRLx(6)); ++ ltq_switch_w32_mask(0, PCE_INGRESS, PCE_PCTRL_REG(6, 0)); ++ ltq_switch_w32_mask(0, BIT(3), MAC_CTRL_REG(6, 2)); ++ ltq_switch_w32(1518 + 8 + 4 * 2, MAC_FLEN_REG); ++ xrx200sw_write_x(1, XRX200_BM_QUEUE_GCTRL_GL_MOD, 0); ++ ++ for (i = 0; i < XRX200_MAX_VLAN; i++) ++ hw->vlan_vid[i] = i; ++} ++ ++static void xrx200_hw_cleanup(struct xrx200_hw *hw) ++{ ++ int i; ++ ++ /* disable the switch */ ++ ltq_mdio_w32_mask(MDIO_GLOB_ENABLE, 0, MDIO_GLOB); ++ ++ /* free the channels and IRQs */ ++ for (i = 0; i < 2; i++) { ++ ltq_dma_free(&hw->chan[i].dma); ++ if (hw->chan[i].dma.irq) ++ free_irq(hw->chan[i].dma.irq, hw); ++ } ++ ++ /* free the allocated RX ring */ ++ for (i = 0; i < LTQ_DESC_NUM; i++) ++ dev_kfree_skb_any(hw->chan[XRX200_DMA_RX].skb[i]); ++ ++ /* clear the mdio bus */ ++ mdiobus_unregister(hw->mii_bus); ++ mdiobus_free(hw->mii_bus); ++ ++ /* release the clock */ ++ clk_disable(hw->clk); ++ clk_put(hw->clk); ++} ++ ++static int xrx200_of_mdio(struct xrx200_hw *hw, struct device_node *np) ++{ ++ hw->mii_bus = mdiobus_alloc(); ++ if (!hw->mii_bus) ++ return -ENOMEM; ++ ++ hw->mii_bus->read = xrx200_mdio_rd; ++ hw->mii_bus->write = xrx200_mdio_wr; ++ hw->mii_bus->name = "lantiq,xrx200-mdio"; ++ snprintf(hw->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0); ++ ++ if (of_mdiobus_register(hw->mii_bus, np)) { ++ mdiobus_free(hw->mii_bus); ++ return -ENXIO; ++ } ++ ++ return 0; ++} ++ ++static void xrx200_of_port(struct xrx200_priv *priv, struct device_node *port) ++{ ++ const __be32 *addr, *id = of_get_property(port, "reg", NULL); ++ struct xrx200_port *p = &priv->port[priv->num_port]; ++ ++ if (!id) ++ return; ++ ++ memset(p, 0, sizeof(struct xrx200_port)); ++ p->phy_node = of_parse_phandle(port, "phy-handle", 0); ++ addr = of_get_property(p->phy_node, "reg", NULL); ++ if (!addr) ++ return; ++ ++ p->num = *id; ++ p->phy_addr = *addr; ++ p->phy_if = of_get_phy_mode(port); ++ if (p->phy_addr > 0x10) ++ p->flags = XRX200_PORT_TYPE_MAC; ++ else ++ p->flags = XRX200_PORT_TYPE_PHY; ++ priv->num_port++; ++ ++ p->gpio = of_get_gpio_flags(port, 0, &p->gpio_flags); ++ if (gpio_is_valid(p->gpio)) ++ if (!gpio_request(p->gpio, "phy-reset")) { ++ gpio_direction_output(p->gpio, ++ (p->gpio_flags & OF_GPIO_ACTIVE_LOW) ? (1) : (0)); ++ udelay(100); ++ gpio_set_value(p->gpio, (p->gpio_flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1)); ++ } ++ /* is this port a wan port ? */ ++ if (priv->wan) ++ priv->hw->wan_map |= BIT(p->num); ++ ++ priv->port_map |= BIT(p->num); ++ ++ /* store the port id in the hw struct so we can map ports -> devices */ ++ priv->hw->port_map[p->num] = priv->hw->num_devs; ++} ++ ++static const struct net_device_ops xrx200_netdev_ops = { ++ .ndo_init = xrx200_init, ++ .ndo_open = xrx200_open, ++ .ndo_stop = xrx200_close, ++ .ndo_start_xmit = xrx200_start_xmit, ++ .ndo_set_mac_address = eth_mac_addr, ++ .ndo_validate_addr = eth_validate_addr, ++ .ndo_change_mtu = eth_change_mtu, ++ .ndo_get_stats = xrx200_get_stats, ++ .ndo_tx_timeout = xrx200_tx_timeout, ++}; ++ ++static void xrx200_of_iface(struct xrx200_hw *hw, struct device_node *iface, struct device *dev) ++{ ++ struct xrx200_priv *priv; ++ struct device_node *port; ++ const __be32 *wan; ++ const u8 *mac; ++ ++ /* alloc the network device */ ++ hw->devs[hw->num_devs] = alloc_etherdev(sizeof(struct xrx200_priv)); ++ if (!hw->devs[hw->num_devs]) ++ return; ++ ++ /* setup the network device */ ++ strcpy(hw->devs[hw->num_devs]->name, "eth%d"); ++ hw->devs[hw->num_devs]->netdev_ops = &xrx200_netdev_ops; ++ hw->devs[hw->num_devs]->watchdog_timeo = XRX200_TX_TIMEOUT; ++ hw->devs[hw->num_devs]->needed_headroom = XRX200_HEADROOM; ++ SET_NETDEV_DEV(hw->devs[hw->num_devs], dev); ++ ++ /* setup our private data */ ++ priv = netdev_priv(hw->devs[hw->num_devs]); ++ priv->hw = hw; ++ priv->id = hw->num_devs; ++ ++ mac = of_get_mac_address(iface); ++ if (mac) ++ memcpy(priv->mac, mac, ETH_ALEN); ++ ++ /* is this the wan interface ? */ ++ wan = of_get_property(iface, "lantiq,wan", NULL); ++ if (wan && (*wan == 1)) ++ priv->wan = 1; ++ ++ /* should the switch be enabled on this interface ? */ ++ if (of_find_property(iface, "lantiq,switch", NULL)) ++ priv->sw = 1; ++ ++ /* load the ports that are part of the interface */ ++ for_each_child_of_node(iface, port) ++ if (of_device_is_compatible(port, "lantiq,xrx200-pdi-port")) ++ xrx200_of_port(priv, port); ++ ++ /* register the actual device */ ++ if (!register_netdev(hw->devs[hw->num_devs])) ++ hw->num_devs++; ++} ++ ++static struct xrx200_hw xrx200_hw; ++ ++static int xrx200_probe(struct platform_device *pdev) ++{ ++ struct resource *res[4]; ++ struct device_node *mdio_np, *iface_np; ++ int i; ++ ++ /* load the memory ranges */ ++ for (i = 0; i < 4; i++) { ++ res[i] = platform_get_resource(pdev, IORESOURCE_MEM, i); ++ if (!res[i]) { ++ dev_err(&pdev->dev, "failed to get resources\n"); ++ return -ENOENT; ++ } ++ } ++ xrx200_switch_membase = devm_ioremap_resource(&pdev->dev, res[0]); ++ xrx200_mdio_membase = devm_ioremap_resource(&pdev->dev, res[1]); ++ xrx200_mii_membase = devm_ioremap_resource(&pdev->dev, res[2]); ++ xrx200_pmac_membase = devm_ioremap_resource(&pdev->dev, res[3]); ++ if (!xrx200_switch_membase || !xrx200_mdio_membase || ++ !xrx200_mii_membase || !xrx200_pmac_membase) { ++ dev_err(&pdev->dev, "failed to request and remap io ranges \n"); ++ return -ENOMEM; ++ } ++ ++ /* get the clock */ ++ xrx200_hw.clk = clk_get(&pdev->dev, NULL); ++ if (IS_ERR(xrx200_hw.clk)) { ++ dev_err(&pdev->dev, "failed to get clock\n"); ++ return PTR_ERR(xrx200_hw.clk); ++ } ++ ++ /* bring up the dma engine and IP core */ ++ xrx200_dma_init(&xrx200_hw); ++ xrx200_hw_init(&xrx200_hw); ++ tasklet_init(&xrx200_hw.chan[XRX200_DMA_TX].tasklet, xrx200_tx_housekeeping, (u32) &xrx200_hw.chan[XRX200_DMA_TX]); ++ tasklet_init(&xrx200_hw.chan[XRX200_DMA_TX_2].tasklet, xrx200_tx_housekeeping, (u32) &xrx200_hw.chan[XRX200_DMA_TX_2]); ++ ++ /* bring up the mdio bus */ ++ mdio_np = of_find_compatible_node(pdev->dev.of_node, NULL, ++ "lantiq,xrx200-mdio"); ++ if (mdio_np) ++ if (xrx200_of_mdio(&xrx200_hw, mdio_np)) ++ dev_err(&pdev->dev, "mdio probe failed\n"); ++ ++ /* load the interfaces */ ++ for_each_child_of_node(pdev->dev.of_node, iface_np) ++ if (of_device_is_compatible(iface_np, "lantiq,xrx200-pdi")) { ++ if (xrx200_hw.num_devs < XRX200_MAX_DEV) ++ xrx200_of_iface(&xrx200_hw, iface_np, &pdev->dev); ++ else ++ dev_err(&pdev->dev, ++ "only %d interfaces allowed\n", ++ XRX200_MAX_DEV); ++ } ++ ++ if (!xrx200_hw.num_devs) { ++ xrx200_hw_cleanup(&xrx200_hw); ++ dev_err(&pdev->dev, "failed to load interfaces\n"); ++ return -ENOENT; ++ } ++ ++ xrx200sw_init(&xrx200_hw); ++ ++ /* set wan port mask */ ++ ltq_pmac_w32(xrx200_hw.wan_map, PMAC_EWAN); ++ ++ for (i = 0; i < xrx200_hw.num_devs; i++) { ++ xrx200_hw.chan[XRX200_DMA_RX].devs[i] = xrx200_hw.devs[i]; ++ xrx200_hw.chan[XRX200_DMA_TX].devs[i] = xrx200_hw.devs[i]; ++ xrx200_hw.chan[XRX200_DMA_TX_2].devs[i] = xrx200_hw.devs[i]; ++ } ++ ++ /* setup NAPI */ ++ init_dummy_netdev(&xrx200_hw.chan[XRX200_DMA_RX].dummy_dev); ++ netif_napi_add(&xrx200_hw.chan[XRX200_DMA_RX].dummy_dev, ++ &xrx200_hw.chan[XRX200_DMA_RX].napi, xrx200_poll_rx, 32); ++ ++ platform_set_drvdata(pdev, &xrx200_hw); ++ ++ return 0; ++} ++ ++static int xrx200_remove(struct platform_device *pdev) ++{ ++ struct net_device *dev = platform_get_drvdata(pdev); ++ struct xrx200_priv *priv; ++ ++ if (!dev) ++ return 0; ++ ++ priv = netdev_priv(dev); ++ ++ /* free stack related instances */ ++ netif_stop_queue(dev); ++ netif_napi_del(&xrx200_hw.chan[XRX200_DMA_RX].napi); ++ ++ /* shut down hardware */ ++ xrx200_hw_cleanup(&xrx200_hw); ++ ++ /* remove the actual device */ ++ unregister_netdev(dev); ++ free_netdev(dev); ++ ++ return 0; ++} ++ ++static const struct of_device_id xrx200_match[] = { ++ { .compatible = "lantiq,xrx200-net" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, xrx200_match); ++ ++static struct platform_driver xrx200_driver = { ++ .probe = xrx200_probe, ++ .remove = xrx200_remove, ++ .driver = { ++ .name = "lantiq,xrx200-net", ++ .of_match_table = xrx200_match, ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(xrx200_driver); ++ ++MODULE_AUTHOR("John Crispin "); ++MODULE_DESCRIPTION("Lantiq SoC XRX200 ethernet"); ++MODULE_LICENSE("GPL"); +--- /dev/null ++++ b/drivers/net/ethernet/lantiq_xrx200_sw.h +@@ -0,0 +1,1328 @@ ++/* ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * Copyright (C) 2010 Lantiq Deutschland GmbH ++ * Copyright (C) 2013 Antonios Vamporakis ++ * ++ * VR9 switch registers extracted from 310TUJ0 switch api ++ * WARNING mult values of 0x00 may not be correct ++ * ++ */ ++ ++enum { ++// XRX200_ETHSW_SWRES, /* Ethernet Switch ResetControl Register */ ++// XRX200_ETHSW_SWRES_R1, /* Hardware Reset */ ++// XRX200_ETHSW_SWRES_R0, /* Register Configuration */ ++// XRX200_ETHSW_CLK_MAC_GAT, /* Ethernet Switch Clock ControlRegister */ ++// XRX200_ETHSW_CLK_EXP_SLEEP, /* Exponent to put system into sleep */ ++// XRX200_ETHSW_CLK_EXP_WAKE, /* Exponent to wake up system */ ++// XRX200_ETHSW_CLK_CLK2_EN, /* CLK2 Input for MAC */ ++// XRX200_ETHSW_CLK_EXT_DIV_EN, /* External Clock Divider Enable */ ++// XRX200_ETHSW_CLK_RAM_DBG_EN, /* Clock Gating Enable */ ++// XRX200_ETHSW_CLK_REG_GAT_EN, /* Clock Gating Enable */ ++// XRX200_ETHSW_CLK_GAT_EN, /* Clock Gating Enable */ ++// XRX200_ETHSW_CLK_MAC_GAT_EN, /* Clock Gating Enable */ ++// XRX200_ETHSW_DBG_STEP, /* Ethernet Switch Debug ControlRegister */ ++// XRX200_ETHSW_DBG_CLK_SEL, /* Trigger Enable */ ++// XRX200_ETHSW_DBG_MON_EN, /* Monitoring Enable */ ++// XRX200_ETHSW_DBG_TRIG_EN, /* Trigger Enable */ ++// XRX200_ETHSW_DBG_MODE, /* Debug Mode */ ++// XRX200_ETHSW_DBG_STEP_TIME, /* Clock Step Size */ ++// XRX200_ETHSW_SSB_MODE, /* Ethernet Switch SharedSegment Buffer Mode Register */ ++// XRX200_ETHSW_SSB_MODE_ADDE, /* Memory Address */ ++// XRX200_ETHSW_SSB_MODE_MODE, /* Memory Access Mode */ ++// XRX200_ETHSW_SSB_ADDR, /* Ethernet Switch SharedSegment Buffer Address Register */ ++// XRX200_ETHSW_SSB_ADDR_ADDE, /* Memory Address */ ++// XRX200_ETHSW_SSB_DATA, /* Ethernet Switch SharedSegment Buffer Data Register */ ++// XRX200_ETHSW_SSB_DATA_DATA, /* Data Value */ ++// XRX200_ETHSW_CAP_0, /* Ethernet Switch CapabilityRegister 0 */ ++// XRX200_ETHSW_CAP_0_SPEED, /* Clock frequency */ ++// XRX200_ETHSW_CAP_1, /* Ethernet Switch CapabilityRegister 1 */ ++// XRX200_ETHSW_CAP_1_GMAC, /* MAC operation mode */ ++// XRX200_ETHSW_CAP_1_QUEUE, /* Number of queues */ ++// XRX200_ETHSW_CAP_1_VPORTS, /* Number of virtual ports */ ++// XRX200_ETHSW_CAP_1_PPORTS, /* Number of physical ports */ ++// XRX200_ETHSW_CAP_2, /* Ethernet Switch CapabilityRegister 2 */ ++// XRX200_ETHSW_CAP_2_PACKETS, /* Number of packets */ ++// XRX200_ETHSW_CAP_3, /* Ethernet Switch CapabilityRegister 3 */ ++// XRX200_ETHSW_CAP_3_METERS, /* Number of traffic meters */ ++// XRX200_ETHSW_CAP_3_SHAPERS, /* Number of traffic shapers */ ++// XRX200_ETHSW_CAP_4, /* Ethernet Switch CapabilityRegister 4 */ ++// XRX200_ETHSW_CAP_4_PPPOE, /* PPPoE table size */ ++// XRX200_ETHSW_CAP_4_VLAN, /* Active VLAN table size */ ++// XRX200_ETHSW_CAP_5, /* Ethernet Switch CapabilityRegister 5 */ ++// XRX200_ETHSW_CAP_5_IPPLEN, /* IP packet length table size */ ++// XRX200_ETHSW_CAP_5_PROT, /* Protocol table size */ ++// XRX200_ETHSW_CAP_6, /* Ethernet Switch CapabilityRegister 6 */ ++// XRX200_ETHSW_CAP_6_MACDASA, /* MAC DA/SA table size */ ++// XRX200_ETHSW_CAP_6_APPL, /* Application table size */ ++// XRX200_ETHSW_CAP_7, /* Ethernet Switch CapabilityRegister 7 */ ++// XRX200_ETHSW_CAP_7_IPDASAM, /* IP DA/SA MSB table size */ ++// XRX200_ETHSW_CAP_7_IPDASAL, /* IP DA/SA LSB table size */ ++// XRX200_ETHSW_CAP_8, /* Ethernet Switch CapabilityRegister 8 */ ++// XRX200_ETHSW_CAP_8_MCAST, /* Multicast table size */ ++// XRX200_ETHSW_CAP_9, /* Ethernet Switch CapabilityRegister 9 */ ++// XRX200_ETHSW_CAP_9_FLAGG, /* Flow Aggregation table size */ ++// XRX200_ETHSW_CAP_10, /* Ethernet Switch CapabilityRegister 10 */ ++// XRX200_ETHSW_CAP_10_MACBT, /* MAC bridging table size */ ++// XRX200_ETHSW_CAP_11, /* Ethernet Switch CapabilityRegister 11 */ ++// XRX200_ETHSW_CAP_11_BSIZEL, /* Packet buffer size (lower part, in byte) */ ++// XRX200_ETHSW_CAP_12, /* Ethernet Switch CapabilityRegister 12 */ ++// XRX200_ETHSW_CAP_12_BSIZEH, /* Packet buffer size (higher part, in byte) */ ++// XRX200_ETHSW_VERSION_REV, /* Ethernet Switch VersionRegister */ ++// XRX200_ETHSW_VERSION_MOD_ID, /* Module Identification */ ++// XRX200_ETHSW_VERSION_REV_ID, /* Hardware Revision Identification */ ++// XRX200_ETHSW_IER, /* Interrupt Enable Register */ ++// XRX200_ETHSW_IER_FDMAIE, /* Fetch DMA Interrupt Enable */ ++// XRX200_ETHSW_IER_SDMAIE, /* Store DMA Interrupt Enable */ ++// XRX200_ETHSW_IER_MACIE, /* Ethernet MAC Interrupt Enable */ ++// XRX200_ETHSW_IER_PCEIE, /* Parser and Classification Engine Interrupt Enable */ ++// XRX200_ETHSW_IER_BMIE, /* Buffer Manager Interrupt Enable */ ++// XRX200_ETHSW_ISR, /* Interrupt Status Register */ ++// XRX200_ETHSW_ISR_FDMAINT, /* Fetch DMA Interrupt */ ++// XRX200_ETHSW_ISR_SDMAINT, /* Store DMA Interrupt */ ++// XRX200_ETHSW_ISR_MACINT, /* Ethernet MAC Interrupt */ ++// XRX200_ETHSW_ISR_PCEINT, /* Parser and Classification Engine Interrupt */ ++// XRX200_ETHSW_ISR_BMINT, /* Buffer Manager Interrupt */ ++// XRX200_ETHSW_SPARE_0, /* Ethernet Switch SpareCells 0 */ ++// XRX200_ETHSW_SPARE_0_SPARE, /* SPARE0 */ ++// XRX200_ETHSW_SPARE_1, /* Ethernet Switch SpareCells 1 */ ++// XRX200_ETHSW_SPARE_1_SPARE, /* SPARE1 */ ++// XRX200_ETHSW_SPARE_2, /* Ethernet Switch SpareCells 2 */ ++// XRX200_ETHSW_SPARE_2_SPARE, /* SPARE2 */ ++// XRX200_ETHSW_SPARE_3, /* Ethernet Switch SpareCells 3 */ ++// XRX200_ETHSW_SPARE_3_SPARE, /* SPARE3 */ ++// XRX200_ETHSW_SPARE_4, /* Ethernet Switch SpareCells 4 */ ++// XRX200_ETHSW_SPARE_4_SPARE, /* SPARE4 */ ++// XRX200_ETHSW_SPARE_5, /* Ethernet Switch SpareCells 5 */ ++// XRX200_ETHSW_SPARE_5_SPARE, /* SPARE5 */ ++// XRX200_ETHSW_SPARE_6, /* Ethernet Switch SpareCells 6 */ ++// XRX200_ETHSW_SPARE_6_SPARE, /* SPARE6 */ ++// XRX200_ETHSW_SPARE_7, /* Ethernet Switch SpareCells 7 */ ++// XRX200_ETHSW_SPARE_7_SPARE, /* SPARE7 */ ++// XRX200_ETHSW_SPARE_8, /* Ethernet Switch SpareCells 8 */ ++// XRX200_ETHSW_SPARE_8_SPARE, /* SPARE8 */ ++// XRX200_ETHSW_SPARE_9, /* Ethernet Switch SpareCells 9 */ ++// XRX200_ETHSW_SPARE_9_SPARE, /* SPARE9 */ ++// XRX200_ETHSW_SPARE_10, /* Ethernet Switch SpareCells 10 */ ++// XRX200_ETHSW_SPARE_10_SPARE, /* SPARE10 */ ++// XRX200_ETHSW_SPARE_11, /* Ethernet Switch SpareCells 11 */ ++// XRX200_ETHSW_SPARE_11_SPARE, /* SPARE11 */ ++// XRX200_ETHSW_SPARE_12, /* Ethernet Switch SpareCells 12 */ ++// XRX200_ETHSW_SPARE_12_SPARE, /* SPARE12 */ ++// XRX200_ETHSW_SPARE_13, /* Ethernet Switch SpareCells 13 */ ++// XRX200_ETHSW_SPARE_13_SPARE, /* SPARE13 */ ++// XRX200_ETHSW_SPARE_14, /* Ethernet Switch SpareCells 14 */ ++// XRX200_ETHSW_SPARE_14_SPARE, /* SPARE14 */ ++// XRX200_ETHSW_SPARE_15, /* Ethernet Switch SpareCells 15 */ ++// XRX200_ETHSW_SPARE_15_SPARE, /* SPARE15 */ ++// XRX200_BM_RAM_VAL_3, /* RAM Value Register 3 */ ++// XRX200_BM_RAM_VAL_3_VAL3, /* Data value [15:0] */ ++// XRX200_BM_RAM_VAL_2, /* RAM Value Register 2 */ ++// XRX200_BM_RAM_VAL_2_VAL2, /* Data value [15:0] */ ++// XRX200_BM_RAM_VAL_1, /* RAM Value Register 1 */ ++// XRX200_BM_RAM_VAL_1_VAL1, /* Data value [15:0] */ ++// XRX200_BM_RAM_VAL_0, /* RAM Value Register 0 */ ++// XRX200_BM_RAM_VAL_0_VAL0, /* Data value [15:0] */ ++// XRX200_BM_RAM_ADDR, /* RAM Address Register */ ++// XRX200_BM_RAM_ADDR_ADDR, /* RAM Address */ ++// XRX200_BM_RAM_CTRL, /* RAM Access Control Register */ ++// XRX200_BM_RAM_CTRL_BAS, /* Access Busy/Access Start */ ++// XRX200_BM_RAM_CTRL_OPMOD, /* Lookup Table Access Operation Mode */ ++// XRX200_BM_RAM_CTRL_ADDR, /* Address for RAM selection */ ++// XRX200_BM_FSQM_GCTRL, /* Free Segment Queue ManagerGlobal Control Register */ ++// XRX200_BM_FSQM_GCTRL_SEGNUM, /* Maximum Segment Number */ ++// XRX200_BM_CONS_SEG, /* Number of Consumed SegmentsRegister */ ++// XRX200_BM_CONS_SEG_FSEG, /* Number of Consumed Segments */ ++// XRX200_BM_CONS_PKT, /* Number of Consumed PacketPointers Register */ ++// XRX200_BM_CONS_PKT_FQP, /* Number of Consumed Packet Pointers */ ++// XRX200_BM_GCTRL_F, /* Buffer Manager Global ControlRegister 0 */ ++// XRX200_BM_GCTRL_BM_STA, /* Buffer Manager Initialization Status Bit */ ++// XRX200_BM_GCTRL_SAT, /* RMON Counter Update Mode */ ++// XRX200_BM_GCTRL_FR_RBC, /* Freeze RMON RX Bad Byte 64 Bit Counter */ ++// XRX200_BM_GCTRL_FR_RGC, /* Freeze RMON RX Good Byte 64 Bit Counter */ ++// XRX200_BM_GCTRL_FR_TGC, /* Freeze RMON TX Good Byte 64 Bit Counter */ ++// XRX200_BM_GCTRL_I_FIN, /* RAM initialization finished */ ++// XRX200_BM_GCTRL_CX_INI, /* PQM Context RAM initialization */ ++// XRX200_BM_GCTRL_FP_INI, /* FPQM RAM initialization */ ++// XRX200_BM_GCTRL_FS_INI, /* FSQM RAM initialization */ ++// XRX200_BM_GCTRL_R_SRES, /* Software Reset for RMON */ ++// XRX200_BM_GCTRL_S_SRES, /* Software Reset for Scheduler */ ++// XRX200_BM_GCTRL_A_SRES, /* Software Reset for AVG */ ++// XRX200_BM_GCTRL_P_SRES, /* Software Reset for PQM */ ++// XRX200_BM_GCTRL_F_SRES, /* Software Reset for FSQM */ ++// XRX200_BM_QUEUE_GCTRL, /* Queue Manager GlobalControl Register 0 */ ++ XRX200_BM_QUEUE_GCTRL_GL_MOD, /* WRED Mode Signal */ ++// XRX200_BM_QUEUE_GCTRL_AQUI, /* Average Queue Update Interval */ ++// XRX200_BM_QUEUE_GCTRL_AQWF, /* Average Queue Weight Factor */ ++// XRX200_BM_QUEUE_GCTRL_QAVGEN, /* Queue Average Calculation Enable */ ++// XRX200_BM_QUEUE_GCTRL_DPROB, /* Drop Probability Profile */ ++// XRX200_BM_WRED_RTH_0, /* WRED Red Threshold Register0 */ ++// XRX200_BM_WRED_RTH_0_MINTH, /* Minimum Threshold */ ++// XRX200_BM_WRED_RTH_1, /* WRED Red Threshold Register1 */ ++// XRX200_BM_WRED_RTH_1_MAXTH, /* Maximum Threshold */ ++// XRX200_BM_WRED_YTH_0, /* WRED Yellow ThresholdRegister 0 */ ++// XRX200_BM_WRED_YTH_0_MINTH, /* Minimum Threshold */ ++// XRX200_BM_WRED_YTH_1, /* WRED Yellow ThresholdRegister 1 */ ++// XRX200_BM_WRED_YTH_1_MAXTH, /* Maximum Threshold */ ++// XRX200_BM_WRED_GTH_0, /* WRED Green ThresholdRegister 0 */ ++// XRX200_BM_WRED_GTH_0_MINTH, /* Minimum Threshold */ ++// XRX200_BM_WRED_GTH_1, /* WRED Green ThresholdRegister 1 */ ++// XRX200_BM_WRED_GTH_1_MAXTH, /* Maximum Threshold */ ++// XRX200_BM_DROP_GTH_0_THR, /* Drop Threshold ConfigurationRegister 0 */ ++// XRX200_BM_DROP_GTH_0_THR_FQ, /* Threshold for frames marked red */ ++// XRX200_BM_DROP_GTH_1_THY, /* Drop Threshold ConfigurationRegister 1 */ ++// XRX200_BM_DROP_GTH_1_THY_FQ, /* Threshold for frames marked yellow */ ++// XRX200_BM_DROP_GTH_2_THG, /* Drop Threshold ConfigurationRegister 2 */ ++// XRX200_BM_DROP_GTH_2_THG_FQ, /* Threshold for frames marked green */ ++// XRX200_BM_IER, /* Buffer Manager Global InterruptEnable Register */ ++// XRX200_BM_IER_CNT4, /* Counter Group 4 (RMON-CLASSIFICATION) Interrupt Enable */ ++// XRX200_BM_IER_CNT3, /* Counter Group 3 (RMON-PQM) Interrupt Enable */ ++// XRX200_BM_IER_CNT2, /* Counter Group 2 (RMON-SCHEDULER) Interrupt Enable */ ++// XRX200_BM_IER_CNT1, /* Counter Group 1 (RMON-QFETCH) Interrupt Enable */ ++// XRX200_BM_IER_CNT0, /* Counter Group 0 (RMON-QSTOR) Interrupt Enable */ ++// XRX200_BM_IER_DEQ, /* PQM dequeue Interrupt Enable */ ++// XRX200_BM_IER_ENQ, /* PQM Enqueue Interrupt Enable */ ++// XRX200_BM_IER_FSQM, /* Buffer Empty Interrupt Enable */ ++// XRX200_BM_ISR, /* Buffer Manager Global InterruptStatus Register */ ++// XRX200_BM_ISR_CNT4, /* Counter Group 4 Interrupt */ ++// XRX200_BM_ISR_CNT3, /* Counter Group 3 Interrupt */ ++// XRX200_BM_ISR_CNT2, /* Counter Group 2 Interrupt */ ++// XRX200_BM_ISR_CNT1, /* Counter Group 1 Interrupt */ ++// XRX200_BM_ISR_CNT0, /* Counter Group 0 Interrupt */ ++// XRX200_BM_ISR_DEQ, /* PQM dequeue Interrupt Enable */ ++// XRX200_BM_ISR_ENQ, /* PQM Enqueue Interrupt */ ++// XRX200_BM_ISR_FSQM, /* Buffer Empty Interrupt */ ++// XRX200_BM_CISEL, /* Buffer Manager RMON CounterInterrupt Select Register */ ++// XRX200_BM_CISEL_PORT, /* Port Number */ ++// XRX200_BM_DEBUG_CTRL_DBG, /* Debug Control Register */ ++// XRX200_BM_DEBUG_CTRL_DBG_SEL, /* Select Signal for Debug Multiplexer */ ++// XRX200_BM_DEBUG_VAL_DBG, /* Debug Value Register */ ++// XRX200_BM_DEBUG_VAL_DBG_DAT, /* Debug Data Value */ ++// XRX200_BM_PCFG, /* Buffer Manager PortConfiguration Register */ ++// XRX200_BM_PCFG_CNTEN, /* RMON Counter Enable */ ++// XRX200_BM_RMON_CTRL_RAM1, /* Buffer ManagerRMON Control Register */ ++// XRX200_BM_RMON_CTRL_RAM2_RES, /* Software Reset for RMON RAM2 */ ++// XRX200_BM_RMON_CTRL_RAM1_RES, /* Software Reset for RMON RAM1 */ ++// XRX200_PQM_DP, /* Packet Queue ManagerDrop Probability Register */ ++// XRX200_PQM_DP_DPROB, /* Drop Probability Profile */ ++// XRX200_PQM_RS, /* Packet Queue ManagerRate Shaper Assignment Register */ ++// XRX200_PQM_RS_EN2, /* Rate Shaper 2 Enable */ ++// XRX200_PQM_RS_RS2, /* Rate Shaper 2 */ ++// XRX200_PQM_RS_EN1, /* Rate Shaper 1 Enable */ ++// XRX200_PQM_RS_RS1, /* Rate Shaper 1 */ ++// XRX200_RS_CTRL, /* Rate Shaper ControlRegister */ ++// XRX200_RS_CTRL_RSEN, /* Rate Shaper Enable */ ++// XRX200_RS_CBS, /* Rate Shaper CommittedBurst Size Register */ ++// XRX200_RS_CBS_CBS, /* Committed Burst Size */ ++// XRX200_RS_IBS, /* Rate Shaper InstantaneousBurst Size Register */ ++// XRX200_RS_IBS_IBS, /* Instantaneous Burst Size */ ++// XRX200_RS_CIR_EXP, /* Rate Shaper RateExponent Register */ ++// XRX200_RS_CIR_EXP_EXP, /* Exponent */ ++// XRX200_RS_CIR_MANT, /* Rate Shaper RateMantissa Register */ ++// XRX200_RS_CIR_MANT_MANT, /* Mantissa */ ++ XRX200_PCE_TBL_KEY_7, /* Table Key Data 7 */ ++// XRX200_PCE_TBL_KEY_7_KEY7, /* Key Value[15:0] */ ++ XRX200_PCE_TBL_KEY_6, /* Table Key Data 6 */ ++// XRX200_PCE_TBL_KEY_6_KEY6, /* Key Value[15:0] */ ++ XRX200_PCE_TBL_KEY_5, /* Table Key Data 5 */ ++// XRX200_PCE_TBL_KEY_5_KEY5, /* Key Value[15:0] */ ++ XRX200_PCE_TBL_KEY_4, /* Table Key Data 4 */ ++// XRX200_PCE_TBL_KEY_4_KEY4, /* Key Value[15:0] */ ++ XRX200_PCE_TBL_KEY_3, /* Table Key Data 3 */ ++// XRX200_PCE_TBL_KEY_3_KEY3, /* Key Value[15:0] */ ++ XRX200_PCE_TBL_KEY_2, /* Table Key Data 2 */ ++// XRX200_PCE_TBL_KEY_2_KEY2, /* Key Value[15:0] */ ++ XRX200_PCE_TBL_KEY_1, /* Table Key Data 1 */ ++// XRX200_PCE_TBL_KEY_1_KEY1, /* Key Value[31:16] */ ++ XRX200_PCE_TBL_KEY_0, /* Table Key Data 0 */ ++// XRX200_PCE_TBL_KEY_0_KEY0, /* Key Value[15:0] */ ++ XRX200_PCE_TBL_MASK_0, /* Table Mask Write Register0 */ ++// XRX200_PCE_TBL_MASK_0_MASK0, /* Mask Pattern [15:0] */ ++ XRX200_PCE_TBL_VAL_4, /* Table Value Register4 */ ++// XRX200_PCE_TBL_VAL_4_VAL4, /* Data value [15:0] */ ++ XRX200_PCE_TBL_VAL_3, /* Table Value Register3 */ ++// XRX200_PCE_TBL_VAL_3_VAL3, /* Data value [15:0] */ ++ XRX200_PCE_TBL_VAL_2, /* Table Value Register2 */ ++// XRX200_PCE_TBL_VAL_2_VAL2, /* Data value [15:0] */ ++ XRX200_PCE_TBL_VAL_1, /* Table Value Register1 */ ++// XRX200_PCE_TBL_VAL_1_VAL1, /* Data value [15:0] */ ++ XRX200_PCE_TBL_VAL_0, /* Table Value Register0 */ ++// XRX200_PCE_TBL_VAL_0_VAL0, /* Data value [15:0] */ ++// XRX200_PCE_TBL_ADDR, /* Table Entry AddressRegister */ ++ XRX200_PCE_TBL_ADDR_ADDR, /* Table Address */ ++// XRX200_PCE_TBL_CTRL, /* Table Access ControlRegister */ ++ XRX200_PCE_TBL_CTRL_BAS, /* Access Busy/Access Start */ ++ XRX200_PCE_TBL_CTRL_TYPE, /* Lookup Entry Type */ ++ XRX200_PCE_TBL_CTRL_VLD, /* Lookup Entry Valid */ ++ XRX200_PCE_TBL_CTRL_GMAP, /* Group Map */ ++ XRX200_PCE_TBL_CTRL_OPMOD, /* Lookup Table Access Operation Mode */ ++ XRX200_PCE_TBL_CTRL_ADDR, /* Lookup Table Address */ ++// XRX200_PCE_TBL_STAT, /* Table General StatusRegister */ ++// XRX200_PCE_TBL_STAT_TBUSY, /* Table Access Busy */ ++// XRX200_PCE_TBL_STAT_TEMPT, /* Table Empty */ ++// XRX200_PCE_TBL_STAT_TFUL, /* Table Full */ ++// XRX200_PCE_AGE_0, /* Aging Counter ConfigurationRegister 0 */ ++// XRX200_PCE_AGE_0_EXP, /* Aging Counter Exponent Value */ ++// XRX200_PCE_AGE_1, /* Aging Counter ConfigurationRegister 1 */ ++// XRX200_PCE_AGE_1_MANT, /* Aging Counter Mantissa Value */ ++// XRX200_PCE_PMAP_1, /* Port Map Register 1 */ ++// XRX200_PCE_PMAP_1_MPMAP, /* Monitoring Port Map */ ++// XRX200_PCE_PMAP_2, /* Port Map Register 2 */ ++// XRX200_PCE_PMAP_2_DMCPMAP, /* Default Multicast Port Map */ ++// XRX200_PCE_PMAP_3, /* Port Map Register 3 */ ++// XRX200_PCE_PMAP_3_UUCMAP, /* Default Unknown Unicast Port Map */ ++// XRX200_PCE_GCTRL_0, /* PCE Global Control Register0 */ ++// XRX200_PCE_GCTRL_0_IGMP, /* IGMP Mode Selection */ ++ XRX200_PCE_GCTRL_0_VLAN, /* VLAN-aware Switching */ ++// XRX200_PCE_GCTRL_0_NOPM, /* No Port Map Forwarding */ ++// XRX200_PCE_GCTRL_0_SCONUC, /* Unknown Unicast Storm Control */ ++// XRX200_PCE_GCTRL_0_SCONMC, /* Multicast Storm Control */ ++// XRX200_PCE_GCTRL_0_SCONBC, /* Broadcast Storm Control */ ++// XRX200_PCE_GCTRL_0_SCONMOD, /* Storm Control Mode */ ++// XRX200_PCE_GCTRL_0_SCONMET, /* Storm Control Metering Instance */ ++// XRX200_PCE_GCTRL_0_MC_VALID, /* Access Request */ ++// XRX200_PCE_GCTRL_0_PLCKMOD, /* Port Lock Mode */ ++// XRX200_PCE_GCTRL_0_PLIMMOD, /* MAC Address Learning Limitation Mode */ ++// XRX200_PCE_GCTRL_0_MTFL, /* MAC Table Flushing */ ++// XRX200_PCE_GCTRL_1, /* PCE Global Control Register1 */ ++// XRX200_PCE_GCTRL_1_PCE_DIS, /* PCE Disable after currently processed packet */ ++// XRX200_PCE_GCTRL_1_LRNMOD, /* MAC Address Learning Mode */ ++// XRX200_PCE_TCM_GLOB_CTRL, /* Three-color MarkerGlobal Control Register */ ++// XRX200_PCE_TCM_GLOB_CTRL_DPRED, /* Re-marking Drop Precedence Red Encoding */ ++// XRX200_PCE_TCM_GLOB_CTRL_DPYEL, /* Re-marking Drop Precedence Yellow Encoding */ ++// XRX200_PCE_TCM_GLOB_CTRL_DPGRN, /* Re-marking Drop Precedence Green Encoding */ ++// XRX200_PCE_IGMP_CTRL, /* IGMP Control Register */ ++// XRX200_PCE_IGMP_CTRL_FAGEEN, /* Force Aging of Table Entries Enable */ ++// XRX200_PCE_IGMP_CTRL_FLEAVE, /* Fast Leave Enable */ ++// XRX200_PCE_IGMP_CTRL_DMRTEN, /* Default Maximum Response Time Enable */ ++// XRX200_PCE_IGMP_CTRL_JASUP, /* Join Aggregation Suppression Enable */ ++// XRX200_PCE_IGMP_CTRL_REPSUP, /* Report Suppression Enable */ ++// XRX200_PCE_IGMP_CTRL_SRPEN, /* Snooping of Router Port Enable */ ++// XRX200_PCE_IGMP_CTRL_ROB, /* Robustness Variable */ ++// XRX200_PCE_IGMP_CTRL_DMRT, /* IGMP Default Maximum Response Time */ ++// XRX200_PCE_IGMP_DRPM, /* IGMP Default RouterPort Map Register */ ++// XRX200_PCE_IGMP_DRPM_DRPM, /* IGMP Default Router Port Map */ ++// XRX200_PCE_IGMP_AGE_0, /* IGMP Aging Register0 */ ++// XRX200_PCE_IGMP_AGE_0_MANT, /* IGMP Group Aging Time Mantissa */ ++// XRX200_PCE_IGMP_AGE_0_EXP, /* IGMP Group Aging Time Exponent */ ++// XRX200_PCE_IGMP_AGE_1, /* IGMP Aging Register1 */ ++// XRX200_PCE_IGMP_AGE_1_MANT, /* IGMP Router Port Aging Time Mantissa */ ++// XRX200_PCE_IGMP_STAT, /* IGMP Status Register */ ++// XRX200_PCE_IGMP_STAT_IGPM, /* IGMP Port Map */ ++// XRX200_WOL_GLB_CTRL, /* Wake-on-LAN ControlRegister */ ++// XRX200_WOL_GLB_CTRL_PASSEN, /* WoL Password Enable */ ++// XRX200_WOL_DA_0, /* Wake-on-LAN DestinationAddress Register 0 */ ++// XRX200_WOL_DA_0_DA0, /* WoL Destination Address [15:0] */ ++// XRX200_WOL_DA_1, /* Wake-on-LAN DestinationAddress Register 1 */ ++// XRX200_WOL_DA_1_DA1, /* WoL Destination Address [31:16] */ ++// XRX200_WOL_DA_2, /* Wake-on-LAN DestinationAddress Register 2 */ ++// XRX200_WOL_DA_2_DA2, /* WoL Destination Address [47:32] */ ++// XRX200_WOL_PW_0, /* Wake-on-LAN Password Register0 */ ++// XRX200_WOL_PW_0_PW0, /* WoL Password [15:0] */ ++// XRX200_WOL_PW_1, /* Wake-on-LAN Password Register1 */ ++// XRX200_WOL_PW_1_PW1, /* WoL Password [31:16] */ ++// XRX200_WOL_PW_2, /* Wake-on-LAN Password Register2 */ ++// XRX200_WOL_PW_2_PW2, /* WoL Password [47:32] */ ++// XRX200_PCE_IER_0_PINT, /* Parser and ClassificationEngine Global Interrupt Enable Register 0 */ ++// XRX200_PCE_IER_0_PINT_15, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_14, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_13, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_12, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_11, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_10, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_9, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_8, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_7, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_6, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_5, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_4, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_3, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_2, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_1, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_0_PINT_0, /* Port Interrupt Enable */ ++// XRX200_PCE_IER_1, /* Parser and ClassificationEngine Global Interrupt Enable Register 1 */ ++// XRX200_PCE_IER_1_FLOWINT, /* Traffic Flow Table Interrupt Rule matched Interrupt Enable */ ++// XRX200_PCE_IER_1_CPH2, /* Classification Phase 2 Ready Interrupt Enable */ ++// XRX200_PCE_IER_1_CPH1, /* Classification Phase 1 Ready Interrupt Enable */ ++// XRX200_PCE_IER_1_CPH0, /* Classification Phase 0 Ready Interrupt Enable */ ++// XRX200_PCE_IER_1_PRDY, /* Parser Ready Interrupt Enable */ ++// XRX200_PCE_IER_1_IGTF, /* IGMP Table Full Interrupt Enable */ ++// XRX200_PCE_IER_1_MTF, /* MAC Table Full Interrupt Enable */ ++// XRX200_PCE_ISR_0_PINT, /* Parser and ClassificationEngine Global Interrupt Status Register 0 */ ++// XRX200_PCE_ISR_0_PINT_15, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_14, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_13, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_12, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_11, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_10, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_9, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_8, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_7, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_6, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_5, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_4, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_3, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_2, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_1, /* Port Interrupt */ ++// XRX200_PCE_ISR_0_PINT_0, /* Port Interrupt */ ++// XRX200_PCE_ISR_1, /* Parser and ClassificationEngine Global Interrupt Status Register 1 */ ++// XRX200_PCE_ISR_1_FLOWINT, /* Traffic Flow Table Interrupt Rule matched */ ++// XRX200_PCE_ISR_1_CPH2, /* Classification Phase 2 Ready Interrupt */ ++// XRX200_PCE_ISR_1_CPH1, /* Classification Phase 1 Ready Interrupt */ ++// XRX200_PCE_ISR_1_CPH0, /* Classification Phase 0 Ready Interrupt */ ++// XRX200_PCE_ISR_1_PRDY, /* Parser Ready Interrupt */ ++// XRX200_PCE_ISR_1_IGTF, /* IGMP Table Full Interrupt */ ++// XRX200_PCE_ISR_1_MTF, /* MAC Table Full Interrupt */ ++// XRX200_PARSER_STAT_FIFO, /* Parser Status Register */ ++// XRX200_PARSER_STAT_FSM_DAT_CNT, /* Parser FSM Data Counter */ ++// XRX200_PARSER_STAT_FSM_STATE, /* Parser FSM State */ ++// XRX200_PARSER_STAT_PKT_ERR, /* Packet error detected */ ++// XRX200_PARSER_STAT_FSM_FIN, /* Parser FSM finished */ ++// XRX200_PARSER_STAT_FSM_START, /* Parser FSM start */ ++// XRX200_PARSER_STAT_FIFO_RDY, /* Parser FIFO ready for read. */ ++// XRX200_PARSER_STAT_FIFO_FULL, /* Parser */ ++// XRX200_PCE_PCTRL_0, /* PCE Port ControlRegister 0 */ ++// XRX200_PCE_PCTRL_0_MCST, /* Multicast Forwarding Mode Selection */ ++// XRX200_PCE_PCTRL_0_EGSTEN, /* Table-based Egress Special Tag Enable */ ++// XRX200_PCE_PCTRL_0_IGSTEN, /* Ingress Special Tag Enable */ ++// XRX200_PCE_PCTRL_0_PCPEN, /* PCP Remarking Mode */ ++// XRX200_PCE_PCTRL_0_CLPEN, /* Class Remarking Mode */ ++// XRX200_PCE_PCTRL_0_DPEN, /* Drop Precedence Remarking Mode */ ++// XRX200_PCE_PCTRL_0_CMOD, /* Three-color Marker Color Mode */ ++// XRX200_PCE_PCTRL_0_VREP, /* VLAN Replacement Mode */ ++ XRX200_PCE_PCTRL_0_TVM, /* Transparent VLAN Mode */ ++// XRX200_PCE_PCTRL_0_PLOCK, /* Port Locking Enable */ ++// XRX200_PCE_PCTRL_0_AGEDIS, /* Aging Disable */ ++// XRX200_PCE_PCTRL_0_PSTATE, /* Port State */ ++// XRX200_PCE_PCTRL_1, /* PCE Port ControlRegister 1 */ ++// XRX200_PCE_PCTRL_1_LRNLIM, /* MAC Address Learning Limit */ ++// XRX200_PCE_PCTRL_2, /* PCE Port ControlRegister 2 */ ++// XRX200_PCE_PCTRL_2_DSCPMOD, /* DSCP Mode Selection */ ++// XRX200_PCE_PCTRL_2_DSCP, /* Enable DSCP to select the Class of Service */ ++// XRX200_PCE_PCTRL_2_PCP, /* Enable VLAN PCP to select the Class of Service */ ++// XRX200_PCE_PCTRL_2_PCLASS, /* Port-based Traffic Class */ ++// XRX200_PCE_PCTRL_3_VIO, /* PCE Port ControlRegister 3 */ ++// XRX200_PCE_PCTRL_3_EDIR, /* Egress Redirection Mode */ ++// XRX200_PCE_PCTRL_3_RXDMIR, /* Receive Mirroring Enable for dropped frames */ ++// XRX200_PCE_PCTRL_3_RXVMIR, /* Receive Mirroring Enable for valid frames */ ++// XRX200_PCE_PCTRL_3_TXMIR, /* Transmit Mirroring Enable */ ++// XRX200_PCE_PCTRL_3_VIO_7, /* Violation Type 7 Mirroring Enable */ ++// XRX200_PCE_PCTRL_3_VIO_6, /* Violation Type 6 Mirroring Enable */ ++// XRX200_PCE_PCTRL_3_VIO_5, /* Violation Type 5 Mirroring Enable */ ++// XRX200_PCE_PCTRL_3_VIO_4, /* Violation Type 4 Mirroring Enable */ ++// XRX200_PCE_PCTRL_3_VIO_3, /* Violation Type 3 Mirroring Enable */ ++// XRX200_PCE_PCTRL_3_VIO_2, /* Violation Type 2 Mirroring Enable */ ++// XRX200_PCE_PCTRL_3_VIO_1, /* Violation Type 1 Mirroring Enable */ ++// XRX200_PCE_PCTRL_3_VIO_0, /* Violation Type 0 Mirroring Enable */ ++// XRX200_WOL_CTRL, /* Wake-on-LAN ControlRegister */ ++// XRX200_WOL_CTRL_PORT, /* WoL Enable */ ++// XRX200_PCE_VCTRL, /* PCE VLAN ControlRegister */ ++ XRX200_PCE_VCTRL_VSR, /* VLAN Security Rule */ ++ XRX200_PCE_VCTRL_VEMR, /* VLAN Egress Member Violation Rule */ ++ XRX200_PCE_VCTRL_VIMR, /* VLAN Ingress Member Violation Rule */ ++ XRX200_PCE_VCTRL_VINR, /* VLAN Ingress Tag Rule */ ++ XRX200_PCE_VCTRL_UVR, /* Unknown VLAN Rule */ ++// XRX200_PCE_DEFPVID, /* PCE Default PortVID Register */ ++ XRX200_PCE_DEFPVID_PVID, /* Default Port VID Index */ ++// XRX200_PCE_PSTAT, /* PCE Port StatusRegister */ ++// XRX200_PCE_PSTAT_LRNCNT, /* Learning Count */ ++// XRX200_PCE_PIER, /* Parser and ClassificationEngine Port Interrupt Enable Register */ ++// XRX200_PCE_PIER_CLDRP, /* Classification Drop Interrupt Enable */ ++// XRX200_PCE_PIER_PTDRP, /* Port Drop Interrupt Enable */ ++// XRX200_PCE_PIER_VLAN, /* VLAN Violation Interrupt Enable */ ++// XRX200_PCE_PIER_WOL, /* Wake-on-LAN Interrupt Enable */ ++// XRX200_PCE_PIER_LOCK, /* Port Limit Alert Interrupt Enable */ ++// XRX200_PCE_PIER_LIM, /* Port Lock Alert Interrupt Enable */ ++// XRX200_PCE_PISR, /* Parser and ClassificationEngine Port Interrupt Status Register */ ++// XRX200_PCE_PISR_CLDRP, /* Classification Drop Interrupt */ ++// XRX200_PCE_PISR_PTDRP, /* Port Drop Interrupt */ ++// XRX200_PCE_PISR_VLAN, /* VLAN Violation Interrupt */ ++// XRX200_PCE_PISR_WOL, /* Wake-on-LAN Interrupt */ ++// XRX200_PCE_PISR_LOCK, /* Port Lock Alert Interrupt */ ++// XRX200_PCE_PISR_LIMIT, /* Port Limitation Alert Interrupt */ ++// XRX200_PCE_TCM_CTRL, /* Three-colorMarker Control Register */ ++// XRX200_PCE_TCM_CTRL_TCMEN, /* Three-color Marker metering instance enable */ ++// XRX200_PCE_TCM_STAT, /* Three-colorMarker Status Register */ ++// XRX200_PCE_TCM_STAT_AL1, /* Three-color Marker Alert 1 Status */ ++// XRX200_PCE_TCM_STAT_AL0, /* Three-color Marker Alert 0 Status */ ++// XRX200_PCE_TCM_CBS, /* Three-color MarkerCommitted Burst Size Register */ ++// XRX200_PCE_TCM_CBS_CBS, /* Committed Burst Size */ ++// XRX200_PCE_TCM_EBS, /* Three-color MarkerExcess Burst Size Register */ ++// XRX200_PCE_TCM_EBS_EBS, /* Excess Burst Size */ ++// XRX200_PCE_TCM_IBS, /* Three-color MarkerInstantaneous Burst Size Register */ ++// XRX200_PCE_TCM_IBS_IBS, /* Instantaneous Burst Size */ ++// XRX200_PCE_TCM_CIR_MANT, /* Three-colorMarker Constant Information Rate Mantissa Register */ ++// XRX200_PCE_TCM_CIR_MANT_MANT, /* Rate Counter Mantissa */ ++// XRX200_PCE_TCM_CIR_EXP, /* Three-colorMarker Constant Information Rate Exponent Register */ ++// XRX200_PCE_TCM_CIR_EXP_EXP, /* Rate Counter Exponent */ ++// XRX200_MAC_TEST, /* MAC Test Register */ ++// XRX200_MAC_TEST_JTP, /* Jitter Test Pattern */ ++// XRX200_MAC_PFAD_CFG, /* MAC Pause FrameSource Address Configuration Register */ ++// XRX200_MAC_PFAD_CFG_SAMOD, /* Source Address Mode */ ++// XRX200_MAC_PFSA_0, /* Pause Frame SourceAddress Part 0 */ ++// XRX200_MAC_PFSA_0_PFAD, /* Pause Frame Source Address Part 0 */ ++// XRX200_MAC_PFSA_1, /* Pause Frame SourceAddress Part 1 */ ++// XRX200_MAC_PFSA_1_PFAD, /* Pause Frame Source Address Part 1 */ ++// XRX200_MAC_PFSA_2, /* Pause Frame SourceAddress Part 2 */ ++// XRX200_MAC_PFSA_2_PFAD, /* Pause Frame Source Address Part 2 */ ++// XRX200_MAC_FLEN, /* MAC Frame Length Register */ ++// XRX200_MAC_FLEN_LEN, /* Maximum Frame Length */ ++// XRX200_MAC_VLAN_ETYPE_0, /* MAC VLAN EthertypeRegister 0 */ ++// XRX200_MAC_VLAN_ETYPE_0_OUTER, /* Ethertype */ ++// XRX200_MAC_VLAN_ETYPE_1, /* MAC VLAN EthertypeRegister 1 */ ++// XRX200_MAC_VLAN_ETYPE_1_INNER, /* Ethertype */ ++// XRX200_MAC_IER, /* MAC Interrupt EnableRegister */ ++// XRX200_MAC_IER_MACIEN, /* MAC Interrupt Enable */ ++// XRX200_MAC_ISR, /* MAC Interrupt StatusRegister */ ++// XRX200_MAC_ISR_MACINT, /* MAC Interrupt */ ++// XRX200_MAC_PSTAT, /* MAC Port Status Register */ ++// XRX200_MAC_PSTAT_PACT, /* PHY Active Status */ ++ XRX200_MAC_PSTAT_GBIT, /* Gigabit Speed Status */ ++ XRX200_MAC_PSTAT_MBIT, /* Megabit Speed Status */ ++ XRX200_MAC_PSTAT_FDUP, /* Full Duplex Status */ ++// XRX200_MAC_PSTAT_RXPAU, /* Receive Pause Status */ ++// XRX200_MAC_PSTAT_TXPAU, /* Transmit Pause Status */ ++// XRX200_MAC_PSTAT_RXPAUEN, /* Receive Pause Enable Status */ ++// XRX200_MAC_PSTAT_TXPAUEN, /* Transmit Pause Enable Status */ ++ XRX200_MAC_PSTAT_LSTAT, /* Link Status */ ++// XRX200_MAC_PSTAT_CRS, /* Carrier Sense Status */ ++// XRX200_MAC_PSTAT_TXLPI, /* Transmit Low-power Idle Status */ ++// XRX200_MAC_PSTAT_RXLPI, /* Receive Low-power Idle Status */ ++// XRX200_MAC_PISR, /* MAC Interrupt Status Register */ ++// XRX200_MAC_PISR_PACT, /* PHY Active Status */ ++// XRX200_MAC_PISR_SPEED, /* Megabit Speed Status */ ++// XRX200_MAC_PISR_FDUP, /* Full Duplex Status */ ++// XRX200_MAC_PISR_RXPAUEN, /* Receive Pause Enable Status */ ++// XRX200_MAC_PISR_TXPAUEN, /* Transmit Pause Enable Status */ ++// XRX200_MAC_PISR_LPIOFF, /* Receive Low-power Idle Mode is left */ ++// XRX200_MAC_PISR_LPION, /* Receive Low-power Idle Mode is entered */ ++// XRX200_MAC_PISR_JAM, /* Jam Status Detected */ ++// XRX200_MAC_PISR_TOOSHORT, /* Too Short Frame Error Detected */ ++// XRX200_MAC_PISR_TOOLONG, /* Too Long Frame Error Detected */ ++// XRX200_MAC_PISR_LENERR, /* Length Mismatch Error Detected */ ++// XRX200_MAC_PISR_FCSERR, /* Frame Checksum Error Detected */ ++// XRX200_MAC_PISR_TXPAUSE, /* Pause Frame Transmitted */ ++// XRX200_MAC_PISR_RXPAUSE, /* Pause Frame Received */ ++// XRX200_MAC_PIER, /* MAC Interrupt Enable Register */ ++// XRX200_MAC_PIER_PACT, /* PHY Active Status */ ++// XRX200_MAC_PIER_SPEED, /* Megabit Speed Status */ ++// XRX200_MAC_PIER_FDUP, /* Full Duplex Status */ ++// XRX200_MAC_PIER_RXPAUEN, /* Receive Pause Enable Status */ ++// XRX200_MAC_PIER_TXPAUEN, /* Transmit Pause Enable Status */ ++// XRX200_MAC_PIER_LPIOFF, /* Low-power Idle Off Interrupt Mask */ ++// XRX200_MAC_PIER_LPION, /* Low-power Idle On Interrupt Mask */ ++// XRX200_MAC_PIER_JAM, /* Jam Status Interrupt Mask */ ++// XRX200_MAC_PIER_TOOSHORT, /* Too Short Frame Error Interrupt Mask */ ++// XRX200_MAC_PIER_TOOLONG, /* Too Long Frame Error Interrupt Mask */ ++// XRX200_MAC_PIER_LENERR, /* Length Mismatch Error Interrupt Mask */ ++// XRX200_MAC_PIER_FCSERR, /* Frame Checksum Error Interrupt Mask */ ++// XRX200_MAC_PIER_TXPAUSE, /* Transmit Pause Frame Interrupt Mask */ ++// XRX200_MAC_PIER_RXPAUSE, /* Receive Pause Frame Interrupt Mask */ ++// XRX200_MAC_CTRL_0, /* MAC Control Register0 */ ++// XRX200_MAC_CTRL_0_LCOL, /* Late Collision Control */ ++// XRX200_MAC_CTRL_0_BM, /* Burst Mode Control */ ++// XRX200_MAC_CTRL_0_APADEN, /* Automatic VLAN Padding Enable */ ++// XRX200_MAC_CTRL_0_VPAD2EN, /* Stacked VLAN Padding Enable */ ++// XRX200_MAC_CTRL_0_VPADEN, /* VLAN Padding Enable */ ++// XRX200_MAC_CTRL_0_PADEN, /* Padding Enable */ ++// XRX200_MAC_CTRL_0_FCS, /* Transmit FCS Control */ ++ XRX200_MAC_CTRL_0_FCON, /* Flow Control Mode */ ++// XRX200_MAC_CTRL_0_FDUP, /* Full Duplex Control */ ++// XRX200_MAC_CTRL_0_GMII, /* GMII/MII interface mode selection */ ++// XRX200_MAC_CTRL_1, /* MAC Control Register1 */ ++// XRX200_MAC_CTRL_1_SHORTPRE, /* Short Preamble Control */ ++// XRX200_MAC_CTRL_1_IPG, /* Minimum Inter Packet Gap Size */ ++// XRX200_MAC_CTRL_2, /* MAC Control Register2 */ ++// XRX200_MAC_CTRL_2_MLEN, /* Maximum Untagged Frame Length */ ++// XRX200_MAC_CTRL_2_LCHKL, /* Frame Length Check Long Enable */ ++// XRX200_MAC_CTRL_2_LCHKS, /* Frame Length Check Short Enable */ ++// XRX200_MAC_CTRL_3, /* MAC Control Register3 */ ++// XRX200_MAC_CTRL_3_RCNT, /* Retry Count */ ++// XRX200_MAC_CTRL_4, /* MAC Control Register4 */ ++// XRX200_MAC_CTRL_4_LPIEN, /* LPI Mode Enable */ ++// XRX200_MAC_CTRL_4_WAIT, /* LPI Wait Time */ ++// XRX200_MAC_CTRL_5_PJPS, /* MAC Control Register5 */ ++// XRX200_MAC_CTRL_5_PJPS_NOBP, /* Prolonged Jam pattern size during no-backpressure state */ ++// XRX200_MAC_CTRL_5_PJPS_BP, /* Prolonged Jam pattern size during backpressure state */ ++// XRX200_MAC_CTRL_6_XBUF, /* Transmit and ReceiveBuffer Control Register */ ++// XRX200_MAC_CTRL_6_RBUF_DLY_WP, /* Delay */ ++// XRX200_MAC_CTRL_6_RBUF_INIT, /* Receive Buffer Initialization */ ++// XRX200_MAC_CTRL_6_RBUF_BYPASS, /* Bypass the Receive Buffer */ ++// XRX200_MAC_CTRL_6_XBUF_DLY_WP, /* Delay */ ++// XRX200_MAC_CTRL_6_XBUF_INIT, /* Initialize the Transmit Buffer */ ++// XRX200_MAC_CTRL_6_XBUF_BYPASS, /* Bypass the Transmit Buffer */ ++// XRX200_MAC_BUFST_XBUF, /* MAC Receive and TransmitBuffer Status Register */ ++// XRX200_MAC_BUFST_RBUF_UFL, /* Receive Buffer Underflow Indicator */ ++// XRX200_MAC_BUFST_RBUF_OFL, /* Receive Buffer Overflow Indicator */ ++// XRX200_MAC_BUFST_XBUF_UFL, /* Transmit Buffer Underflow Indicator */ ++// XRX200_MAC_BUFST_XBUF_OFL, /* Transmit Buffer Overflow Indicator */ ++// XRX200_MAC_TESTEN, /* MAC Test Enable Register */ ++// XRX200_MAC_TESTEN_JTEN, /* Jitter Test Enable */ ++// XRX200_MAC_TESTEN_TXER, /* Transmit Error Insertion */ ++// XRX200_MAC_TESTEN_LOOP, /* MAC Loopback Enable */ ++// XRX200_FDMA_CTRL, /* Ethernet Switch FetchDMA Control Register */ ++// XRX200_FDMA_CTRL_LPI_THRESHOLD, /* Low Power Idle Threshold */ ++// XRX200_FDMA_CTRL_LPI_MODE, /* Low Power Idle Mode */ ++// XRX200_FDMA_CTRL_EGSTAG, /* Egress Special Tag Size */ ++// XRX200_FDMA_CTRL_IGSTAG, /* Ingress Special Tag Size */ ++// XRX200_FDMA_CTRL_EXCOL, /* Excessive Collision Handling */ ++// XRX200_FDMA_STETYPE, /* Special Tag EthertypeControl Register */ ++// XRX200_FDMA_STETYPE_ETYPE, /* Special Tag Ethertype */ ++// XRX200_FDMA_VTETYPE, /* VLAN Tag EthertypeControl Register */ ++// XRX200_FDMA_VTETYPE_ETYPE, /* VLAN Tag Ethertype */ ++// XRX200_FDMA_STAT_0, /* FDMA Status Register0 */ ++// XRX200_FDMA_STAT_0_FSMS, /* FSM states status */ ++// XRX200_FDMA_IER, /* Fetch DMA Global InterruptEnable Register */ ++// XRX200_FDMA_IER_PCKD, /* Packet Drop Interrupt Enable */ ++// XRX200_FDMA_IER_PCKR, /* Packet Ready Interrupt Enable */ ++// XRX200_FDMA_IER_PCKT, /* Packet Sent Interrupt Enable */ ++// XRX200_FDMA_ISR, /* Fetch DMA Global InterruptStatus Register */ ++// XRX200_FDMA_ISR_PCKTD, /* Packet Drop */ ++// XRX200_FDMA_ISR_PCKR, /* Packet is Ready for Transmission */ ++// XRX200_FDMA_ISR_PCKT, /* Packet Sent Event */ ++// XRX200_FDMA_PCTRL, /* Ethernet SwitchFetch DMA Port Control Register */ ++// XRX200_FDMA_PCTRL_VLANMOD, /* VLAN Modification Enable */ ++// XRX200_FDMA_PCTRL_DSCPRM, /* DSCP Re-marking Enable */ ++// XRX200_FDMA_PCTRL_STEN, /* Special Tag Insertion Enable */ ++// XRX200_FDMA_PCTRL_EN, /* FDMA Port Enable */ ++// XRX200_FDMA_PRIO, /* Ethernet SwitchFetch DMA Port Priority Register */ ++// XRX200_FDMA_PRIO_PRIO, /* FDMA PRIO */ ++// XRX200_FDMA_PSTAT0, /* Ethernet SwitchFetch DMA Port Status Register 0 */ ++// XRX200_FDMA_PSTAT0_PKT_AVAIL, /* Port Egress Packet Available */ ++// XRX200_FDMA_PSTAT0_POK, /* Port Status OK */ ++// XRX200_FDMA_PSTAT0_PSEG, /* Port Egress Segment Count */ ++// XRX200_FDMA_PSTAT1_HDR, /* Ethernet SwitchFetch DMA Port Status Register 1 */ ++// XRX200_FDMA_PSTAT1_HDR_PTR, /* Header Pointer */ ++// XRX200_FDMA_TSTAMP0, /* Egress TimeStamp Register 0 */ ++// XRX200_FDMA_TSTAMP0_TSTL, /* Time Stamp [15:0] */ ++// XRX200_FDMA_TSTAMP1, /* Egress TimeStamp Register 1 */ ++// XRX200_FDMA_TSTAMP1_TSTH, /* Time Stamp [31:16] */ ++// XRX200_SDMA_CTRL, /* Ethernet Switch StoreDMA Control Register */ ++// XRX200_SDMA_CTRL_TSTEN, /* Time Stamp Enable */ ++// XRX200_SDMA_FCTHR1, /* SDMA Flow Control Threshold1 Register */ ++// XRX200_SDMA_FCTHR1_THR1, /* Threshold 1 */ ++// XRX200_SDMA_FCTHR2, /* SDMA Flow Control Threshold2 Register */ ++// XRX200_SDMA_FCTHR2_THR2, /* Threshold 2 */ ++// XRX200_SDMA_FCTHR3, /* SDMA Flow Control Threshold3 Register */ ++// XRX200_SDMA_FCTHR3_THR3, /* Threshold 3 */ ++// XRX200_SDMA_FCTHR4, /* SDMA Flow Control Threshold4 Register */ ++// XRX200_SDMA_FCTHR4_THR4, /* Threshold 4 */ ++// XRX200_SDMA_FCTHR5, /* SDMA Flow Control Threshold5 Register */ ++// XRX200_SDMA_FCTHR5_THR5, /* Threshold 5 */ ++// XRX200_SDMA_FCTHR6, /* SDMA Flow Control Threshold6 Register */ ++// XRX200_SDMA_FCTHR6_THR6, /* Threshold 6 */ ++// XRX200_SDMA_FCTHR7, /* SDMA Flow Control Threshold7 Register */ ++// XRX200_SDMA_FCTHR7_THR7, /* Threshold 7 */ ++// XRX200_SDMA_STAT_0, /* SDMA Status Register0 */ ++// XRX200_SDMA_STAT_0_BPS_FILL, /* Back Pressure Status */ ++// XRX200_SDMA_STAT_0_BPS_PNT, /* Back Pressure Status */ ++// XRX200_SDMA_STAT_0_DROP, /* Back Pressure Status */ ++// XRX200_SDMA_STAT_1, /* SDMA Status Register1 */ ++// XRX200_SDMA_STAT_1_FILL, /* Buffer Filling Level */ ++// XRX200_SDMA_STAT_2, /* SDMA Status Register2 */ ++// XRX200_SDMA_STAT_2_FSMS, /* FSM states status */ ++// XRX200_SDMA_IER, /* SDMA Interrupt Enable Register */ ++// XRX200_SDMA_IER_BPEX, /* Buffer Pointers Exceeded */ ++// XRX200_SDMA_IER_BFULL, /* Buffer Full */ ++// XRX200_SDMA_IER_FERR, /* Frame Error */ ++// XRX200_SDMA_IER_FRX, /* Frame Received Successfully */ ++// XRX200_SDMA_ISR, /* SDMA Interrupt Status Register */ ++// XRX200_SDMA_ISR_BPEX, /* Packet Descriptors Exceeded */ ++// XRX200_SDMA_ISR_BFULL, /* Buffer Full */ ++// XRX200_SDMA_ISR_FERR, /* Frame Error */ ++// XRX200_SDMA_ISR_FRX, /* Frame Received Successfully */ ++// XRX200_SDMA_PCTRL, /* Ethernet SwitchStore DMA Port Control Register */ ++// XRX200_SDMA_PCTRL_DTHR, /* Drop Threshold Selection */ ++// XRX200_SDMA_PCTRL_PTHR, /* Pause Threshold Selection */ ++// XRX200_SDMA_PCTRL_PHYEFWD, /* Forward PHY Error Frames */ ++// XRX200_SDMA_PCTRL_ALGFWD, /* Forward Alignment Error Frames */ ++// XRX200_SDMA_PCTRL_LENFWD, /* Forward Length Errored Frames */ ++// XRX200_SDMA_PCTRL_OSFWD, /* Forward Oversized Frames */ ++// XRX200_SDMA_PCTRL_USFWD, /* Forward Undersized Frames */ ++// XRX200_SDMA_PCTRL_FCSIGN, /* Ignore FCS Errors */ ++// XRX200_SDMA_PCTRL_FCSFWD, /* Forward FCS Errored Frames */ ++// XRX200_SDMA_PCTRL_PAUFWD, /* Pause Frame Forwarding */ ++// XRX200_SDMA_PCTRL_MFCEN, /* Metering Flow Control Enable */ ++// XRX200_SDMA_PCTRL_FCEN, /* Flow Control Enable */ ++// XRX200_SDMA_PCTRL_PEN, /* Port Enable */ ++// XRX200_SDMA_PRIO, /* Ethernet SwitchStore DMA Port Priority Register */ ++// XRX200_SDMA_PRIO_PRIO, /* SDMA PRIO */ ++// XRX200_SDMA_PSTAT0_HDR, /* Ethernet SwitchStore DMA Port Status Register 0 */ ++// XRX200_SDMA_PSTAT0_HDR_PTR, /* Port Ingress Queue Header Pointer */ ++// XRX200_SDMA_PSTAT1, /* Ethernet SwitchStore DMA Port Status Register 1 */ ++// XRX200_SDMA_PSTAT1_PPKT, /* Port Ingress Packet Count */ ++// XRX200_SDMA_TSTAMP0, /* Ingress TimeStamp Register 0 */ ++// XRX200_SDMA_TSTAMP0_TSTL, /* Time Stamp [15:0] */ ++// XRX200_SDMA_TSTAMP1, /* Ingress TimeStamp Register 1 */ ++// XRX200_SDMA_TSTAMP1_TSTH, /* Time Stamp [31:16] */ ++}; ++ ++ ++struct xrx200sw_reg { ++ int offset; ++ int shift; ++ int size; ++ int mult; ++} xrx200sw_reg[] = { ++// offeset shift size mult ++// {0x0000, 0, 16, 0x00}, /* XRX200_ETHSW_SWRES Ethernet Switch ResetControl Register */ ++// {0x0000, 1, 1, 0x00}, /* XRX200_ETHSW_SWRES_R1 Hardware Reset */ ++// {0x0000, 0, 1, 0x00}, /* XRX200_ETHSW_SWRES_R0 Register Configuration */ ++// {0x0004, 0, 16, 0x00}, /* XRX200_ETHSW_CLK_MAC_GAT Ethernet Switch Clock ControlRegister */ ++// {0x0004, 12, 4, 0x00}, /* XRX200_ETHSW_CLK_EXP_SLEEP Exponent to put system into sleep */ ++// {0x0004, 8, 4, 0x00}, /* XRX200_ETHSW_CLK_EXP_WAKE Exponent to wake up system */ ++// {0x0004, 7, 1, 0x00}, /* XRX200_ETHSW_CLK_CLK2_EN CLK2 Input for MAC */ ++// {0x0004, 6, 1, 0x00}, /* XRX200_ETHSW_CLK_EXT_DIV_EN External Clock Divider Enable */ ++// {0x0004, 5, 1, 0x00}, /* XRX200_ETHSW_CLK_RAM_DBG_EN Clock Gating Enable */ ++// {0x0004, 4, 1, 0x00}, /* XRX200_ETHSW_CLK_REG_GAT_EN Clock Gating Enable */ ++// {0x0004, 3, 1, 0x00}, /* XRX200_ETHSW_CLK_GAT_EN Clock Gating Enable */ ++// {0x0004, 2, 1, 0x00}, /* XRX200_ETHSW_CLK_MAC_GAT_EN Clock Gating Enable */ ++// {0x0008, 0, 16, 0x00}, /* XRX200_ETHSW_DBG_STEP Ethernet Switch Debug ControlRegister */ ++// {0x0008, 12, 4, 0x00}, /* XRX200_ETHSW_DBG_CLK_SEL Trigger Enable */ ++// {0x0008, 11, 1, 0x00}, /* XRX200_ETHSW_DBG_MON_EN Monitoring Enable */ ++// {0x0008, 9, 2, 0x00}, /* XRX200_ETHSW_DBG_TRIG_EN Trigger Enable */ ++// {0x0008, 8, 1, 0x00}, /* XRX200_ETHSW_DBG_MODE Debug Mode */ ++// {0x0008, 0, 8, 0x00}, /* XRX200_ETHSW_DBG_STEP_TIME Clock Step Size */ ++// {0x000C, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_MODE Ethernet Switch SharedSegment Buffer Mode Register */ ++// {0x000C, 2, 4, 0x00}, /* XRX200_ETHSW_SSB_MODE_ADDE Memory Address */ ++// {0x000C, 0, 2, 0x00}, /* XRX200_ETHSW_SSB_MODE_MODE Memory Access Mode */ ++// {0x0010, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_ADDR Ethernet Switch SharedSegment Buffer Address Register */ ++// {0x0010, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_ADDR_ADDE Memory Address */ ++// {0x0014, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_DATA Ethernet Switch SharedSegment Buffer Data Register */ ++// {0x0014, 0, 16, 0x00}, /* XRX200_ETHSW_SSB_DATA_DATA Data Value */ ++// {0x0018, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_0 Ethernet Switch CapabilityRegister 0 */ ++// {0x0018, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_0_SPEED Clock frequency */ ++// {0x001C, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_1 Ethernet Switch CapabilityRegister 1 */ ++// {0x001C, 15, 1, 0x00}, /* XRX200_ETHSW_CAP_1_GMAC MAC operation mode */ ++// {0x001C, 8, 7, 0x00}, /* XRX200_ETHSW_CAP_1_QUEUE Number of queues */ ++// {0x001C, 4, 4, 0x00}, /* XRX200_ETHSW_CAP_1_VPORTS Number of virtual ports */ ++// {0x001C, 0, 4, 0x00}, /* XRX200_ETHSW_CAP_1_PPORTS Number of physical ports */ ++// {0x0020, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_2 Ethernet Switch CapabilityRegister 2 */ ++// {0x0020, 0, 11, 0x00}, /* XRX200_ETHSW_CAP_2_PACKETS Number of packets */ ++// {0x0024, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_3 Ethernet Switch CapabilityRegister 3 */ ++// {0x0024, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_3_METERS Number of traffic meters */ ++// {0x0024, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_3_SHAPERS Number of traffic shapers */ ++// {0x0028, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_4 Ethernet Switch CapabilityRegister 4 */ ++// {0x0028, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_4_PPPOE PPPoE table size */ ++// {0x0028, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_4_VLAN Active VLAN table size */ ++// {0x002C, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_5 Ethernet Switch CapabilityRegister 5 */ ++// {0x002C, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_5_IPPLEN IP packet length table size */ ++// {0x002C, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_5_PROT Protocol table size */ ++// {0x0030, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_6 Ethernet Switch CapabilityRegister 6 */ ++// {0x0030, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_6_MACDASA MAC DA/SA table size */ ++// {0x0030, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_6_APPL Application table size */ ++// {0x0034, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_7 Ethernet Switch CapabilityRegister 7 */ ++// {0x0034, 8, 8, 0x00}, /* XRX200_ETHSW_CAP_7_IPDASAM IP DA/SA MSB table size */ ++// {0x0034, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_7_IPDASAL IP DA/SA LSB table size */ ++// {0x0038, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_8 Ethernet Switch CapabilityRegister 8 */ ++// {0x0038, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_8_MCAST Multicast table size */ ++// {0x003C, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_9 Ethernet Switch CapabilityRegister 9 */ ++// {0x003C, 0, 8, 0x00}, /* XRX200_ETHSW_CAP_9_FLAGG Flow Aggregation table size */ ++// {0x0040, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_10 Ethernet Switch CapabilityRegister 10 */ ++// {0x0040, 0, 13, 0x00}, /* XRX200_ETHSW_CAP_10_MACBT MAC bridging table size */ ++// {0x0044, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_11 Ethernet Switch CapabilityRegister 11 */ ++// {0x0044, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_11_BSIZEL Packet buffer size (lower part, in byte) */ ++// {0x0048, 0, 16, 0x00}, /* XRX200_ETHSW_CAP_12 Ethernet Switch CapabilityRegister 12 */ ++// {0x0048, 0, 3, 0x00}, /* XRX200_ETHSW_CAP_12_BSIZEH Packet buffer size (higher part, in byte) */ ++// {0x004C, 0, 16, 0x00}, /* XRX200_ETHSW_VERSION_REV Ethernet Switch VersionRegister */ ++// {0x004C, 8, 8, 0x00}, /* XRX200_ETHSW_VERSION_MOD_ID Module Identification */ ++// {0x004C, 0, 8, 0x00}, /* XRX200_ETHSW_VERSION_REV_ID Hardware Revision Identification */ ++// {0x0050, 0, 16, 0x00}, /* XRX200_ETHSW_IER Interrupt Enable Register */ ++// {0x0050, 4, 1, 0x00}, /* XRX200_ETHSW_IER_FDMAIE Fetch DMA Interrupt Enable */ ++// {0x0050, 3, 1, 0x00}, /* XRX200_ETHSW_IER_SDMAIE Store DMA Interrupt Enable */ ++// {0x0050, 2, 1, 0x00}, /* XRX200_ETHSW_IER_MACIE Ethernet MAC Interrupt Enable */ ++// {0x0050, 1, 1, 0x00}, /* XRX200_ETHSW_IER_PCEIE Parser and Classification Engine Interrupt Enable */ ++// {0x0050, 0, 1, 0x00}, /* XRX200_ETHSW_IER_BMIE Buffer Manager Interrupt Enable */ ++// {0x0054, 0, 16, 0x00}, /* XRX200_ETHSW_ISR Interrupt Status Register */ ++// {0x0054, 4, 1, 0x00}, /* XRX200_ETHSW_ISR_FDMAINT Fetch DMA Interrupt */ ++// {0x0054, 3, 1, 0x00}, /* XRX200_ETHSW_ISR_SDMAINT Store DMA Interrupt */ ++// {0x0054, 2, 1, 0x00}, /* XRX200_ETHSW_ISR_MACINT Ethernet MAC Interrupt */ ++// {0x0054, 1, 1, 0x00}, /* XRX200_ETHSW_ISR_PCEINT Parser and Classification Engine Interrupt */ ++// {0x0054, 0, 1, 0x00}, /* XRX200_ETHSW_ISR_BMINT Buffer Manager Interrupt */ ++// {0x0058, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_0 Ethernet Switch SpareCells 0 */ ++// {0x0058, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_0_SPARE SPARE0 */ ++// {0x005C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_1 Ethernet Switch SpareCells 1 */ ++// {0x005C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_1_SPARE SPARE1 */ ++// {0x0060, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_2 Ethernet Switch SpareCells 2 */ ++// {0x0060, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_2_SPARE SPARE2 */ ++// {0x0064, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_3 Ethernet Switch SpareCells 3 */ ++// {0x0064, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_3_SPARE SPARE3 */ ++// {0x0068, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_4 Ethernet Switch SpareCells 4 */ ++// {0x0068, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_4_SPARE SPARE4 */ ++// {0x006C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_5 Ethernet Switch SpareCells 5 */ ++// {0x006C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_5_SPARE SPARE5 */ ++// {0x0070, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_6 Ethernet Switch SpareCells 6 */ ++// {0x0070, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_6_SPARE SPARE6 */ ++// {0x0074, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_7 Ethernet Switch SpareCells 7 */ ++// {0x0074, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_7_SPARE SPARE7 */ ++// {0x0078, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_8 Ethernet Switch SpareCells 8 */ ++// {0x0078, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_8_SPARE SPARE8 */ ++// {0x007C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_9 Ethernet Switch SpareCells 9 */ ++// {0x007C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_9_SPARE SPARE9 */ ++// {0x0080, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_10 Ethernet Switch SpareCells 10 */ ++// {0x0080, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_10_SPARE SPARE10 */ ++// {0x0084, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_11 Ethernet Switch SpareCells 11 */ ++// {0x0084, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_11_SPARE SPARE11 */ ++// {0x0088, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_12 Ethernet Switch SpareCells 12 */ ++// {0x0088, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_12_SPARE SPARE12 */ ++// {0x008C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_13 Ethernet Switch SpareCells 13 */ ++// {0x008C, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_13_SPARE SPARE13 */ ++// {0x0090, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_14 Ethernet Switch SpareCells 14 */ ++// {0x0090, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_14_SPARE SPARE14 */ ++// {0x0094, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_15 Ethernet Switch SpareCells 15 */ ++// {0x0094, 0, 16, 0x00}, /* XRX200_ETHSW_SPARE_15_SPARE SPARE15 */ ++// {0x0100, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_3 RAM Value Register 3 */ ++// {0x0100, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_3_VAL3 Data value [15:0] */ ++// {0x0104, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_2 RAM Value Register 2 */ ++// {0x0104, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_2_VAL2 Data value [15:0] */ ++// {0x0108, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_1 RAM Value Register 1 */ ++// {0x0108, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_1_VAL1 Data value [15:0] */ ++// {0x010C, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_0 RAM Value Register 0 */ ++// {0x010C, 0, 16, 0x00}, /* XRX200_BM_RAM_VAL_0_VAL0 Data value [15:0] */ ++// {0x0110, 0, 16, 0x00}, /* XRX200_BM_RAM_ADDR RAM Address Register */ ++// {0x0110, 0, 11, 0x00}, /* XRX200_BM_RAM_ADDR_ADDR RAM Address */ ++// {0x0114, 0, 16, 0x00}, /* XRX200_BM_RAM_CTRL RAM Access Control Register */ ++// {0x0114, 15, 1, 0x00}, /* XRX200_BM_RAM_CTRL_BAS Access Busy/Access Start */ ++// {0x0114, 5, 1, 0x00}, /* XRX200_BM_RAM_CTRL_OPMOD Lookup Table Access Operation Mode */ ++// {0x0114, 0, 5, 0x00}, /* XRX200_BM_RAM_CTRL_ADDR Address for RAM selection */ ++// {0x0118, 0, 16, 0x00}, /* XRX200_BM_FSQM_GCTRL Free Segment Queue ManagerGlobal Control Register */ ++// {0x0118, 0, 10, 0x00}, /* XRX200_BM_FSQM_GCTRL_SEGNUM Maximum Segment Number */ ++// {0x011C, 0, 16, 0x00}, /* XRX200_BM_CONS_SEG Number of Consumed SegmentsRegister */ ++// {0x011C, 0, 10, 0x00}, /* XRX200_BM_CONS_SEG_FSEG Number of Consumed Segments */ ++// {0x0120, 0, 16, 0x00}, /* XRX200_BM_CONS_PKT Number of Consumed PacketPointers Register */ ++// {0x0120, 0, 11, 0x00}, /* XRX200_BM_CONS_PKT_FQP Number of Consumed Packet Pointers */ ++// {0x0124, 0, 16, 0x00}, /* XRX200_BM_GCTRL_F Buffer Manager Global ControlRegister 0 */ ++// {0x0124, 13, 1, 0x00}, /* XRX200_BM_GCTRL_BM_STA Buffer Manager Initialization Status Bit */ ++// {0x0124, 12, 1, 0x00}, /* XRX200_BM_GCTRL_SAT RMON Counter Update Mode */ ++// {0x0124, 11, 1, 0x00}, /* XRX200_BM_GCTRL_FR_RBC Freeze RMON RX Bad Byte 64 Bit Counter */ ++// {0x0124, 10, 1, 0x00}, /* XRX200_BM_GCTRL_FR_RGC Freeze RMON RX Good Byte 64 Bit Counter */ ++// {0x0124, 9, 1, 0x00}, /* XRX200_BM_GCTRL_FR_TGC Freeze RMON TX Good Byte 64 Bit Counter */ ++// {0x0124, 8, 1, 0x00}, /* XRX200_BM_GCTRL_I_FIN RAM initialization finished */ ++// {0x0124, 7, 1, 0x00}, /* XRX200_BM_GCTRL_CX_INI PQM Context RAM initialization */ ++// {0x0124, 6, 1, 0x00}, /* XRX200_BM_GCTRL_FP_INI FPQM RAM initialization */ ++// {0x0124, 5, 1, 0x00}, /* XRX200_BM_GCTRL_FS_INI FSQM RAM initialization */ ++// {0x0124, 4, 1, 0x00}, /* XRX200_BM_GCTRL_R_SRES Software Reset for RMON */ ++// {0x0124, 3, 1, 0x00}, /* XRX200_BM_GCTRL_S_SRES Software Reset for Scheduler */ ++// {0x0124, 2, 1, 0x00}, /* XRX200_BM_GCTRL_A_SRES Software Reset for AVG */ ++// {0x0124, 1, 1, 0x00}, /* XRX200_BM_GCTRL_P_SRES Software Reset for PQM */ ++// {0x0124, 0, 1, 0x00}, /* XRX200_BM_GCTRL_F_SRES Software Reset for FSQM */ ++// {0x0128, 0, 16, 0x00}, /* XRX200_BM_QUEUE_GCTRL Queue Manager GlobalControl Register 0 */ ++ {0x0128, 10, 1, 0x00}, /* XRX200_BM_QUEUE_GCTRL_GL_MOD WRED Mode Signal */ ++// {0x0128, 7, 3, 0x00}, /* XRX200_BM_QUEUE_GCTRL_AQUI Average Queue Update Interval */ ++// {0x0128, 3, 4, 0x00}, /* XRX200_BM_QUEUE_GCTRL_AQWF Average Queue Weight Factor */ ++// {0x0128, 2, 1, 0x00}, /* XRX200_BM_QUEUE_GCTRL_QAVGEN Queue Average Calculation Enable */ ++// {0x0128, 0, 2, 0x00}, /* XRX200_BM_QUEUE_GCTRL_DPROB Drop Probability Profile */ ++// {0x012C, 0, 16, 0x00}, /* XRX200_BM_WRED_RTH_0 WRED Red Threshold Register0 */ ++// {0x012C, 0, 10, 0x00}, /* XRX200_BM_WRED_RTH_0_MINTH Minimum Threshold */ ++// {0x0130, 0, 16, 0x00}, /* XRX200_BM_WRED_RTH_1 WRED Red Threshold Register1 */ ++// {0x0130, 0, 10, 0x00}, /* XRX200_BM_WRED_RTH_1_MAXTH Maximum Threshold */ ++// {0x0134, 0, 16, 0x00}, /* XRX200_BM_WRED_YTH_0 WRED Yellow ThresholdRegister 0 */ ++// {0x0134, 0, 10, 0x00}, /* XRX200_BM_WRED_YTH_0_MINTH Minimum Threshold */ ++// {0x0138, 0, 16, 0x00}, /* XRX200_BM_WRED_YTH_1 WRED Yellow ThresholdRegister 1 */ ++// {0x0138, 0, 10, 0x00}, /* XRX200_BM_WRED_YTH_1_MAXTH Maximum Threshold */ ++// {0x013C, 0, 16, 0x00}, /* XRX200_BM_WRED_GTH_0 WRED Green ThresholdRegister 0 */ ++// {0x013C, 0, 10, 0x00}, /* XRX200_BM_WRED_GTH_0_MINTH Minimum Threshold */ ++// {0x0140, 0, 16, 0x00}, /* XRX200_BM_WRED_GTH_1 WRED Green ThresholdRegister 1 */ ++// {0x0140, 0, 10, 0x00}, /* XRX200_BM_WRED_GTH_1_MAXTH Maximum Threshold */ ++// {0x0144, 0, 16, 0x00}, /* XRX200_BM_DROP_GTH_0_THR Drop Threshold ConfigurationRegister 0 */ ++// {0x0144, 0, 11, 0x00}, /* XRX200_BM_DROP_GTH_0_THR_FQ Threshold for frames marked red */ ++// {0x0148, 0, 16, 0x00}, /* XRX200_BM_DROP_GTH_1_THY Drop Threshold ConfigurationRegister 1 */ ++// {0x0148, 0, 11, 0x00}, /* XRX200_BM_DROP_GTH_1_THY_FQ Threshold for frames marked yellow */ ++// {0x014C, 0, 16, 0x00}, /* XRX200_BM_DROP_GTH_2_THG Drop Threshold ConfigurationRegister 2 */ ++// {0x014C, 0, 11, 0x00}, /* XRX200_BM_DROP_GTH_2_THG_FQ Threshold for frames marked green */ ++// {0x0150, 0, 16, 0x00}, /* XRX200_BM_IER Buffer Manager Global InterruptEnable Register */ ++// {0x0150, 7, 1, 0x00}, /* XRX200_BM_IER_CNT4 Counter Group 4 (RMON-CLASSIFICATION) Interrupt Enable */ ++// {0x0150, 6, 1, 0x00}, /* XRX200_BM_IER_CNT3 Counter Group 3 (RMON-PQM) Interrupt Enable */ ++// {0x0150, 5, 1, 0x00}, /* XRX200_BM_IER_CNT2 Counter Group 2 (RMON-SCHEDULER) Interrupt Enable */ ++// {0x0150, 4, 1, 0x00}, /* XRX200_BM_IER_CNT1 Counter Group 1 (RMON-QFETCH) Interrupt Enable */ ++// {0x0150, 3, 1, 0x00}, /* XRX200_BM_IER_CNT0 Counter Group 0 (RMON-QSTOR) Interrupt Enable */ ++// {0x0150, 2, 1, 0x00}, /* XRX200_BM_IER_DEQ PQM dequeue Interrupt Enable */ ++// {0x0150, 1, 1, 0x00}, /* XRX200_BM_IER_ENQ PQM Enqueue Interrupt Enable */ ++// {0x0150, 0, 1, 0x00}, /* XRX200_BM_IER_FSQM Buffer Empty Interrupt Enable */ ++// {0x0154, 0, 16, 0x00}, /* XRX200_BM_ISR Buffer Manager Global InterruptStatus Register */ ++// {0x0154, 7, 1, 0x00}, /* XRX200_BM_ISR_CNT4 Counter Group 4 Interrupt */ ++// {0x0154, 6, 1, 0x00}, /* XRX200_BM_ISR_CNT3 Counter Group 3 Interrupt */ ++// {0x0154, 5, 1, 0x00}, /* XRX200_BM_ISR_CNT2 Counter Group 2 Interrupt */ ++// {0x0154, 4, 1, 0x00}, /* XRX200_BM_ISR_CNT1 Counter Group 1 Interrupt */ ++// {0x0154, 3, 1, 0x00}, /* XRX200_BM_ISR_CNT0 Counter Group 0 Interrupt */ ++// {0x0154, 2, 1, 0x00}, /* XRX200_BM_ISR_DEQ PQM dequeue Interrupt Enable */ ++// {0x0154, 1, 1, 0x00}, /* XRX200_BM_ISR_ENQ PQM Enqueue Interrupt */ ++// {0x0154, 0, 1, 0x00}, /* XRX200_BM_ISR_FSQM Buffer Empty Interrupt */ ++// {0x0158, 0, 16, 0x00}, /* XRX200_BM_CISEL Buffer Manager RMON CounterInterrupt Select Register */ ++// {0x0158, 0, 3, 0x00}, /* XRX200_BM_CISEL_PORT Port Number */ ++// {0x015C, 0, 16, 0x00}, /* XRX200_BM_DEBUG_CTRL_DBG Debug Control Register */ ++// {0x015C, 0, 8, 0x00}, /* XRX200_BM_DEBUG_CTRL_DBG_SEL Select Signal for Debug Multiplexer */ ++// {0x0160, 0, 16, 0x00}, /* XRX200_BM_DEBUG_VAL_DBG Debug Value Register */ ++// {0x0160, 0, 16, 0x00}, /* XRX200_BM_DEBUG_VAL_DBG_DAT Debug Data Value */ ++// {0x0200, 0, 16, 0x08}, /* XRX200_BM_PCFG Buffer Manager PortConfiguration Register */ ++// {0x0200, 0, 1, 0x08}, /* XRX200_BM_PCFG_CNTEN RMON Counter Enable */ ++// {0x0204, 0, 16, 0x08}, /* XRX200_BM_RMON_CTRL_RAM1 Buffer ManagerRMON Control Register */ ++// {0x0204, 1, 1, 0x08}, /* XRX200_BM_RMON_CTRL_RAM2_RES Software Reset for RMON RAM2 */ ++// {0x0204, 0, 1, 0x08}, /* XRX200_BM_RMON_CTRL_RAM1_RES Software Reset for RMON RAM1 */ ++// {0x0400, 0, 16, 0x08}, /* XRX200_PQM_DP Packet Queue ManagerDrop Probability Register */ ++// {0x0400, 0, 2, 0x08}, /* XRX200_PQM_DP_DPROB Drop Probability Profile */ ++// {0x0404, 0, 16, 0x08}, /* XRX200_PQM_RS Packet Queue ManagerRate Shaper Assignment Register */ ++// {0x0404, 15, 1, 0x08}, /* XRX200_PQM_RS_EN2 Rate Shaper 2 Enable */ ++// {0x0404, 8, 6, 0x08}, /* XRX200_PQM_RS_RS2 Rate Shaper 2 */ ++// {0x0404, 7, 1, 0x08}, /* XRX200_PQM_RS_EN1 Rate Shaper 1 Enable */ ++// {0x0404, 0, 6, 0x08}, /* XRX200_PQM_RS_RS1 Rate Shaper 1 */ ++// {0x0500, 0, 16, 0x14}, /* XRX200_RS_CTRL Rate Shaper ControlRegister */ ++// {0x0500, 0, 1, 0x14}, /* XRX200_RS_CTRL_RSEN Rate Shaper Enable */ ++// {0x0504, 0, 16, 0x14}, /* XRX200_RS_CBS Rate Shaper CommittedBurst Size Register */ ++// {0x0504, 0, 10, 0x14}, /* XRX200_RS_CBS_CBS Committed Burst Size */ ++// {0x0508, 0, 16, 0x14}, /* XRX200_RS_IBS Rate Shaper InstantaneousBurst Size Register */ ++// {0x0508, 0, 2, 0x14}, /* XRX200_RS_IBS_IBS Instantaneous Burst Size */ ++// {0x050C, 0, 16, 0x14}, /* XRX200_RS_CIR_EXP Rate Shaper RateExponent Register */ ++// {0x050C, 0, 4, 0x14}, /* XRX200_RS_CIR_EXP_EXP Exponent */ ++// {0x0510, 0, 16, 0x14}, /* XRX200_RS_CIR_MANT Rate Shaper RateMantissa Register */ ++// {0x0510, 0, 10, 0x14}, /* XRX200_RS_CIR_MANT_MANT Mantissa */ ++ {0x1100, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_7 Table Key Data 7 */ ++// {0x1100, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_7_KEY7 Key Value[15:0] */ ++ {0x1104, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_6 Table Key Data 6 */ ++// {0x1104, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_6_KEY6 Key Value[15:0] */ ++ {0x1108, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_5 Table Key Data 5 */ ++// {0x1108, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_5_KEY5 Key Value[15:0] */ ++ {0x110C, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_4 Table Key Data 4 */ ++// {0x110C, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_4_KEY4 Key Value[15:0] */ ++ {0x1110, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_3 Table Key Data 3 */ ++// {0x1110, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_3_KEY3 Key Value[15:0] */ ++ {0x1114, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_2 Table Key Data 2 */ ++// {0x1114, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_2_KEY2 Key Value[15:0] */ ++ {0x1118, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_1 Table Key Data 1 */ ++// {0x1118, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_1_KEY1 Key Value[31:16] */ ++ {0x111C, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_0 Table Key Data 0 */ ++// {0x111C, 0, 16, 0x00}, /* XRX200_PCE_TBL_KEY_0_KEY0 Key Value[15:0] */ ++ {0x1120, 0, 16, 0x00}, /* XRX200_PCE_TBL_MASK_0 Table Mask Write Register0 */ ++// {0x1120, 0, 16, 0x00}, /* XRX200_PCE_TBL_MASK_0_MASK0 Mask Pattern [15:0] */ ++ {0x1124, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_4 Table Value Register4 */ ++// {0x1124, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_4_VAL4 Data value [15:0] */ ++ {0x1128, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_3 Table Value Register3 */ ++// {0x1128, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_3_VAL3 Data value [15:0] */ ++ {0x112C, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_2 Table Value Register2 */ ++// {0x112C, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_2_VAL2 Data value [15:0] */ ++ {0x1130, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_1 Table Value Register1 */ ++// {0x1130, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_1_VAL1 Data value [15:0] */ ++ {0x1134, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_0 Table Value Register0 */ ++// {0x1134, 0, 16, 0x00}, /* XRX200_PCE_TBL_VAL_0_VAL0 Data value [15:0] */ ++// {0x1138, 0, 16, 0x00}, /* XRX200_PCE_TBL_ADDR Table Entry AddressRegister */ ++ {0x1138, 0, 11, 0x00}, /* XRX200_PCE_TBL_ADDR_ADDR Table Address */ ++// {0x113C, 0, 16, 0x00}, /* XRX200_PCE_TBL_CTRL Table Access ControlRegister */ ++ {0x113C, 15, 1, 0x00}, /* XRX200_PCE_TBL_CTRL_BAS Access Busy/Access Start */ ++ {0x113C, 13, 1, 0x00}, /* XRX200_PCE_TBL_CTRL_TYPE Lookup Entry Type */ ++ {0x113C, 12, 1, 0x00}, /* XRX200_PCE_TBL_CTRL_VLD Lookup Entry Valid */ ++ {0x113C, 7, 4, 0x00}, /* XRX200_PCE_TBL_CTRL_GMAP Group Map */ ++ {0x113C, 5, 2, 0x00}, /* XRX200_PCE_TBL_CTRL_OPMOD Lookup Table Access Operation Mode */ ++ {0x113C, 0, 5, 0x00}, /* XRX200_PCE_TBL_CTRL_ADDR Lookup Table Address */ ++// {0x1140, 0, 16, 0x00}, /* XRX200_PCE_TBL_STAT Table General StatusRegister */ ++// {0x1140, 2, 1, 0x00}, /* XRX200_PCE_TBL_STAT_TBUSY Table Access Busy */ ++// {0x1140, 1, 1, 0x00}, /* XRX200_PCE_TBL_STAT_TEMPT Table Empty */ ++// {0x1140, 0, 1, 0x00}, /* XRX200_PCE_TBL_STAT_TFUL Table Full */ ++// {0x1144, 0, 16, 0x00}, /* XRX200_PCE_AGE_0 Aging Counter ConfigurationRegister 0 */ ++// {0x1144, 0, 4, 0x00}, /* XRX200_PCE_AGE_0_EXP Aging Counter Exponent Value */ ++// {0x1148, 0, 16, 0x00}, /* XRX200_PCE_AGE_1 Aging Counter ConfigurationRegister 1 */ ++// {0x1148, 0, 16, 0x00}, /* XRX200_PCE_AGE_1_MANT Aging Counter Mantissa Value */ ++// {0x114C, 0, 16, 0x00}, /* XRX200_PCE_PMAP_1 Port Map Register 1 */ ++// {0x114C, 0, 16, 0x00}, /* XRX200_PCE_PMAP_1_MPMAP Monitoring Port Map */ ++// {0x1150, 0, 16, 0x00}, /* XRX200_PCE_PMAP_2 Port Map Register 2 */ ++// {0x1150, 0, 16, 0x00}, /* XRX200_PCE_PMAP_2_DMCPMAP Default Multicast Port Map */ ++// {0x1154, 0, 16, 0x00}, /* XRX200_PCE_PMAP_3 Port Map Register 3 */ ++// {0x1154, 0, 16, 0x00}, /* XRX200_PCE_PMAP_3_UUCMAP Default Unknown Unicast Port Map */ ++// {0x1158, 0, 16, 0x00}, /* XRX200_PCE_GCTRL_0 PCE Global Control Register0 */ ++// {0x1158, 15, 1, 0x00}, /* XRX200_PCE_GCTRL_0_IGMP IGMP Mode Selection */ ++ {0x1158, 14, 1, 0x00}, /* XRX200_PCE_GCTRL_0_VLAN VLAN-aware Switching */ ++// {0x1158, 13, 1, 0x00}, /* XRX200_PCE_GCTRL_0_NOPM No Port Map Forwarding */ ++// {0x1158, 12, 1, 0x00}, /* XRX200_PCE_GCTRL_0_SCONUC Unknown Unicast Storm Control */ ++// {0x1158, 11, 1, 0x00}, /* XRX200_PCE_GCTRL_0_SCONMC Multicast Storm Control */ ++// {0x1158, 10, 1, 0x00}, /* XRX200_PCE_GCTRL_0_SCONBC Broadcast Storm Control */ ++// {0x1158, 8, 2, 0x00}, /* XRX200_PCE_GCTRL_0_SCONMOD Storm Control Mode */ ++// {0x1158, 4, 4, 0x00}, /* XRX200_PCE_GCTRL_0_SCONMET Storm Control Metering Instance */ ++// {0x1158, 3, 1, 0x00}, /* XRX200_PCE_GCTRL_0_MC_VALID Access Request */ ++// {0x1158, 2, 1, 0x00}, /* XRX200_PCE_GCTRL_0_PLCKMOD Port Lock Mode */ ++// {0x1158, 1, 1, 0x00}, /* XRX200_PCE_GCTRL_0_PLIMMOD MAC Address Learning Limitation Mode */ ++// {0x1158, 0, 1, 0x00}, /* XRX200_PCE_GCTRL_0_MTFL MAC Table Flushing */ ++// {0x115C, 0, 16, 0x00}, /* XRX200_PCE_GCTRL_1 PCE Global Control Register1 */ ++// {0x115C, 1, 1, 0x00}, /* XRX200_PCE_GCTRL_1_PCE_DIS PCE Disable after currently processed packet */ ++// {0x115C, 0, 1, 0x00}, /* XRX200_PCE_GCTRL_1_LRNMOD MAC Address Learning Mode */ ++// {0x1160, 0, 16, 0x00}, /* XRX200_PCE_TCM_GLOB_CTRL Three-color MarkerGlobal Control Register */ ++// {0x1160, 6, 3, 0x00}, /* XRX200_PCE_TCM_GLOB_CTRL_DPRED Re-marking Drop Precedence Red Encoding */ ++// {0x1160, 3, 3, 0x00}, /* XRX200_PCE_TCM_GLOB_CTRL_DPYEL Re-marking Drop Precedence Yellow Encoding */ ++// {0x1160, 0, 3, 0x00}, /* XRX200_PCE_TCM_GLOB_CTRL_DPGRN Re-marking Drop Precedence Green Encoding */ ++// {0x1164, 0, 16, 0x00}, /* XRX200_PCE_IGMP_CTRL IGMP Control Register */ ++// {0x1164, 15, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_FAGEEN Force Aging of Table Entries Enable */ ++// {0x1164, 14, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_FLEAVE Fast Leave Enable */ ++// {0x1164, 13, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_DMRTEN Default Maximum Response Time Enable */ ++// {0x1164, 12, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_JASUP Join Aggregation Suppression Enable */ ++// {0x1164, 11, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_REPSUP Report Suppression Enable */ ++// {0x1164, 10, 1, 0x00}, /* XRX200_PCE_IGMP_CTRL_SRPEN Snooping of Router Port Enable */ ++// {0x1164, 8, 2, 0x00}, /* XRX200_PCE_IGMP_CTRL_ROB Robustness Variable */ ++// {0x1164, 0, 8, 0x00}, /* XRX200_PCE_IGMP_CTRL_DMRT IGMP Default Maximum Response Time */ ++// {0x1168, 0, 16, 0x00}, /* XRX200_PCE_IGMP_DRPM IGMP Default RouterPort Map Register */ ++// {0x1168, 0, 16, 0x00}, /* XRX200_PCE_IGMP_DRPM_DRPM IGMP Default Router Port Map */ ++// {0x116C, 0, 16, 0x00}, /* XRX200_PCE_IGMP_AGE_0 IGMP Aging Register0 */ ++// {0x116C, 3, 8, 0x00}, /* XRX200_PCE_IGMP_AGE_0_MANT IGMP Group Aging Time Mantissa */ ++// {0x116C, 0, 3, 0x00}, /* XRX200_PCE_IGMP_AGE_0_EXP IGMP Group Aging Time Exponent */ ++// {0x1170, 0, 16, 0x00}, /* XRX200_PCE_IGMP_AGE_1 IGMP Aging Register1 */ ++// {0x1170, 0, 12, 0x00}, /* XRX200_PCE_IGMP_AGE_1_MANT IGMP Router Port Aging Time Mantissa */ ++// {0x1174, 0, 16, 0x00}, /* XRX200_PCE_IGMP_STAT IGMP Status Register */ ++// {0x1174, 0, 16, 0x00}, /* XRX200_PCE_IGMP_STAT_IGPM IGMP Port Map */ ++// {0x1178, 0, 16, 0x00}, /* XRX200_WOL_GLB_CTRL Wake-on-LAN ControlRegister */ ++// {0x1178, 0, 1, 0x00}, /* XRX200_WOL_GLB_CTRL_PASSEN WoL Password Enable */ ++// {0x117C, 0, 16, 0x00}, /* XRX200_WOL_DA_0 Wake-on-LAN DestinationAddress Register 0 */ ++// {0x117C, 0, 16, 0x00}, /* XRX200_WOL_DA_0_DA0 WoL Destination Address [15:0] */ ++// {0x1180, 0, 16, 0x00}, /* XRX200_WOL_DA_1 Wake-on-LAN DestinationAddress Register 1 */ ++// {0x1180, 0, 16, 0x00}, /* XRX200_WOL_DA_1_DA1 WoL Destination Address [31:16] */ ++// {0x1184, 0, 16, 0x00}, /* XRX200_WOL_DA_2 Wake-on-LAN DestinationAddress Register 2 */ ++// {0x1184, 0, 16, 0x00}, /* XRX200_WOL_DA_2_DA2 WoL Destination Address [47:32] */ ++// {0x1188, 0, 16, 0x00}, /* XRX200_WOL_PW_0 Wake-on-LAN Password Register0 */ ++// {0x1188, 0, 16, 0x00}, /* XRX200_WOL_PW_0_PW0 WoL Password [15:0] */ ++// {0x118C, 0, 16, 0x00}, /* XRX200_WOL_PW_1 Wake-on-LAN Password Register1 */ ++// {0x118C, 0, 16, 0x00}, /* XRX200_WOL_PW_1_PW1 WoL Password [31:16] */ ++// {0x1190, 0, 16, 0x00}, /* XRX200_WOL_PW_2 Wake-on-LAN Password Register2 */ ++// {0x1190, 0, 16, 0x00}, /* XRX200_WOL_PW_2_PW2 WoL Password [47:32] */ ++// {0x1194, 0, 16, 0x00}, /* XRX200_PCE_IER_0_PINT Parser and ClassificationEngine Global Interrupt Enable Register 0 */ ++// {0x1194, 15, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_15 Port Interrupt Enable */ ++// {0x1194, 14, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_14 Port Interrupt Enable */ ++// {0x1194, 13, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_13 Port Interrupt Enable */ ++// {0x1194, 12, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_12 Port Interrupt Enable */ ++// {0x1194, 11, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_11 Port Interrupt Enable */ ++// {0x1194, 10, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_10 Port Interrupt Enable */ ++// {0x1194, 9, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_9 Port Interrupt Enable */ ++// {0x1194, 8, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_8 Port Interrupt Enable */ ++// {0x1194, 7, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_7 Port Interrupt Enable */ ++// {0x1194, 6, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_6 Port Interrupt Enable */ ++// {0x1194, 5, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_5 Port Interrupt Enable */ ++// {0x1194, 4, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_4 Port Interrupt Enable */ ++// {0x1194, 3, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_3 Port Interrupt Enable */ ++// {0x1194, 2, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_2 Port Interrupt Enable */ ++// {0x1194, 1, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_1 Port Interrupt Enable */ ++// {0x1194, 0, 1, 0x00}, /* XRX200_PCE_IER_0_PINT_0 Port Interrupt Enable */ ++// {0x1198, 0, 16, 0x00}, /* XRX200_PCE_IER_1 Parser and ClassificationEngine Global Interrupt Enable Register 1 */ ++// {0x1198, 6, 1, 0x00}, /* XRX200_PCE_IER_1_FLOWINT Traffic Flow Table Interrupt Rule matched Interrupt Enable */ ++// {0x1198, 5, 1, 0x00}, /* XRX200_PCE_IER_1_CPH2 Classification Phase 2 Ready Interrupt Enable */ ++// {0x1198, 4, 1, 0x00}, /* XRX200_PCE_IER_1_CPH1 Classification Phase 1 Ready Interrupt Enable */ ++// {0x1198, 3, 1, 0x00}, /* XRX200_PCE_IER_1_CPH0 Classification Phase 0 Ready Interrupt Enable */ ++// {0x1198, 2, 1, 0x00}, /* XRX200_PCE_IER_1_PRDY Parser Ready Interrupt Enable */ ++// {0x1198, 1, 1, 0x00}, /* XRX200_PCE_IER_1_IGTF IGMP Table Full Interrupt Enable */ ++// {0x1198, 0, 1, 0x00}, /* XRX200_PCE_IER_1_MTF MAC Table Full Interrupt Enable */ ++// {0x119C, 0, 16, 0x00}, /* XRX200_PCE_ISR_0_PINT Parser and ClassificationEngine Global Interrupt Status Register 0 */ ++// {0x119C, 15, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_15 Port Interrupt */ ++// {0x119C, 14, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_14 Port Interrupt */ ++// {0x119C, 13, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_13 Port Interrupt */ ++// {0x119C, 12, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_12 Port Interrupt */ ++// {0x119C, 11, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_11 Port Interrupt */ ++// {0x119C, 10, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_10 Port Interrupt */ ++// {0x119C, 9, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_9 Port Interrupt */ ++// {0x119C, 8, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_8 Port Interrupt */ ++// {0x119C, 7, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_7 Port Interrupt */ ++// {0x119C, 6, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_6 Port Interrupt */ ++// {0x119C, 5, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_5 Port Interrupt */ ++// {0x119C, 4, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_4 Port Interrupt */ ++// {0x119C, 3, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_3 Port Interrupt */ ++// {0x119C, 2, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_2 Port Interrupt */ ++// {0x119C, 1, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_1 Port Interrupt */ ++// {0x119C, 0, 1, 0x00}, /* XRX200_PCE_ISR_0_PINT_0 Port Interrupt */ ++// {0x11A0, 0, 16, 0x00}, /* XRX200_PCE_ISR_1 Parser and ClassificationEngine Global Interrupt Status Register 1 */ ++// {0x11A0, 6, 1, 0x00}, /* XRX200_PCE_ISR_1_FLOWINT Traffic Flow Table Interrupt Rule matched */ ++// {0x11A0, 5, 1, 0x00}, /* XRX200_PCE_ISR_1_CPH2 Classification Phase 2 Ready Interrupt */ ++// {0x11A0, 4, 1, 0x00}, /* XRX200_PCE_ISR_1_CPH1 Classification Phase 1 Ready Interrupt */ ++// {0x11A0, 3, 1, 0x00}, /* XRX200_PCE_ISR_1_CPH0 Classification Phase 0 Ready Interrupt */ ++// {0x11A0, 2, 1, 0x00}, /* XRX200_PCE_ISR_1_PRDY Parser Ready Interrupt */ ++// {0x11A0, 1, 1, 0x00}, /* XRX200_PCE_ISR_1_IGTF IGMP Table Full Interrupt */ ++// {0x11A0, 0, 1, 0x00}, /* XRX200_PCE_ISR_1_MTF MAC Table Full Interrupt */ ++// {0x11A4, 0, 16, 0x00}, /* XRX200_PARSER_STAT_FIFO Parser Status Register */ ++// {0x11A4, 8, 8, 0x00}, /* XRX200_PARSER_STAT_FSM_DAT_CNT Parser FSM Data Counter */ ++// {0x11A4, 5, 3, 0x00}, /* XRX200_PARSER_STAT_FSM_STATE Parser FSM State */ ++// {0x11A4, 4, 1, 0x00}, /* XRX200_PARSER_STAT_PKT_ERR Packet error detected */ ++// {0x11A4, 3, 1, 0x00}, /* XRX200_PARSER_STAT_FSM_FIN Parser FSM finished */ ++// {0x11A4, 2, 1, 0x00}, /* XRX200_PARSER_STAT_FSM_START Parser FSM start */ ++// {0x11A4, 1, 1, 0x00}, /* XRX200_PARSER_STAT_FIFO_RDY Parser FIFO ready for read. */ ++// {0x11A4, 0, 1, 0x00}, /* XRX200_PARSER_STAT_FIFO_FULL Parser */ ++// {0x1200, 0, 16, 0x28}, /* XRX200_PCE_PCTRL_0 PCE Port ControlRegister 0 */ ++// {0x1200, 13, 1, 0x28}, /* XRX200_PCE_PCTRL_0_MCST Multicast Forwarding Mode Selection */ ++// {0x1200, 12, 1, 0x28}, /* XRX200_PCE_PCTRL_0_EGSTEN Table-based Egress Special Tag Enable */ ++// {0x1200, 11, 1, 0x28}, /* XRX200_PCE_PCTRL_0_IGSTEN Ingress Special Tag Enable */ ++// {0x1200, 10, 1, 0x28}, /* XRX200_PCE_PCTRL_0_PCPEN PCP Remarking Mode */ ++// {0x1200, 9, 1, 0x28}, /* XRX200_PCE_PCTRL_0_CLPEN Class Remarking Mode */ ++// {0x1200, 8, 1, 0x28}, /* XRX200_PCE_PCTRL_0_DPEN Drop Precedence Remarking Mode */ ++// {0x1200, 7, 1, 0x28}, /* XRX200_PCE_PCTRL_0_CMOD Three-color Marker Color Mode */ ++// {0x1200, 6, 1, 0x28}, /* XRX200_PCE_PCTRL_0_VREP VLAN Replacement Mode */ ++ {0x1200, 5, 1, 0x28}, /* XRX200_PCE_PCTRL_0_TVM Transparent VLAN Mode */ ++// {0x1200, 4, 1, 0x28}, /* XRX200_PCE_PCTRL_0_PLOCK Port Locking Enable */ ++// {0x1200, 3, 1, 0x28}, /* XRX200_PCE_PCTRL_0_AGEDIS Aging Disable */ ++// {0x1200, 0, 3, 0x28}, /* XRX200_PCE_PCTRL_0_PSTATE Port State */ ++// {0x1204, 0, 16, 0x28}, /* XRX200_PCE_PCTRL_1 PCE Port ControlRegister 1 */ ++// {0x1204, 0, 8, 0x28}, /* XRX200_PCE_PCTRL_1_LRNLIM MAC Address Learning Limit */ ++// {0x1208, 0, 16, 0x28}, /* XRX200_PCE_PCTRL_2 PCE Port ControlRegister 2 */ ++// {0x1208, 7, 1, 0x28}, /* XRX200_PCE_PCTRL_2_DSCPMOD DSCP Mode Selection */ ++// {0x1208, 5, 2, 0x28}, /* XRX200_PCE_PCTRL_2_DSCP Enable DSCP to select the Class of Service */ ++// {0x1208, 4, 1, 0x28}, /* XRX200_PCE_PCTRL_2_PCP Enable VLAN PCP to select the Class of Service */ ++// {0x1208, 0, 4, 0x28}, /* XRX200_PCE_PCTRL_2_PCLASS Port-based Traffic Class */ ++// {0x120C, 0, 16, 0x28}, /* XRX200_PCE_PCTRL_3_VIO PCE Port ControlRegister 3 */ ++// {0x120C, 11, 1, 0x28}, /* XRX200_PCE_PCTRL_3_EDIR Egress Redirection Mode */ ++// {0x120C, 10, 1, 0x28}, /* XRX200_PCE_PCTRL_3_RXDMIR Receive Mirroring Enable for dropped frames */ ++// {0x120C, 9, 1, 0x28}, /* XRX200_PCE_PCTRL_3_RXVMIR Receive Mirroring Enable for valid frames */ ++// {0x120C, 8, 1, 0x28}, /* XRX200_PCE_PCTRL_3_TXMIR Transmit Mirroring Enable */ ++// {0x120C, 7, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_7 Violation Type 7 Mirroring Enable */ ++// {0x120C, 6, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_6 Violation Type 6 Mirroring Enable */ ++// {0x120C, 5, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_5 Violation Type 5 Mirroring Enable */ ++// {0x120C, 4, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_4 Violation Type 4 Mirroring Enable */ ++// {0x120C, 3, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_3 Violation Type 3 Mirroring Enable */ ++// {0x120C, 2, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_2 Violation Type 2 Mirroring Enable */ ++// {0x120C, 1, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_1 Violation Type 1 Mirroring Enable */ ++// {0x120C, 0, 1, 0x28}, /* XRX200_PCE_PCTRL_3_VIO_0 Violation Type 0 Mirroring Enable */ ++// {0x1210, 0, 16, 0x28}, /* XRX200_WOL_CTRL Wake-on-LAN ControlRegister */ ++// {0x1210, 0, 1, 0x28}, /* XRX200_WOL_CTRL_PORT WoL Enable */ ++// {0x1214, 0, 16, 0x28}, /* XRX200_PCE_VCTRL PCE VLAN ControlRegister */ ++ {0x1214, 5, 1, 0x28}, /* XRX200_PCE_VCTRL_VSR VLAN Security Rule */ ++ {0x1214, 4, 1, 0x28}, /* XRX200_PCE_VCTRL_VEMR VLAN Egress Member Violation Rule */ ++ {0x1214, 3, 1, 0x28}, /* XRX200_PCE_VCTRL_VIMR VLAN Ingress Member Violation Rule */ ++ {0x1214, 1, 2, 0x28}, /* XRX200_PCE_VCTRL_VINR VLAN Ingress Tag Rule */ ++ {0x1214, 0, 1, 0x28}, /* XRX200_PCE_VCTRL_UVR Unknown VLAN Rule */ ++// {0x1218, 0, 16, 0x28}, /* XRX200_PCE_DEFPVID PCE Default PortVID Register */ ++ {0x1218, 0, 6, 0x28}, /* XRX200_PCE_DEFPVID_PVID Default Port VID Index */ ++// {0x121C, 0, 16, 0x28}, /* XRX200_PCE_PSTAT PCE Port StatusRegister */ ++// {0x121C, 0, 16, 0x28}, /* XRX200_PCE_PSTAT_LRNCNT Learning Count */ ++// {0x1220, 0, 16, 0x28}, /* XRX200_PCE_PIER Parser and ClassificationEngine Port Interrupt Enable Register */ ++// {0x1220, 5, 1, 0x28}, /* XRX200_PCE_PIER_CLDRP Classification Drop Interrupt Enable */ ++// {0x1220, 4, 1, 0x28}, /* XRX200_PCE_PIER_PTDRP Port Drop Interrupt Enable */ ++// {0x1220, 3, 1, 0x28}, /* XRX200_PCE_PIER_VLAN VLAN Violation Interrupt Enable */ ++// {0x1220, 2, 1, 0x28}, /* XRX200_PCE_PIER_WOL Wake-on-LAN Interrupt Enable */ ++// {0x1220, 1, 1, 0x28}, /* XRX200_PCE_PIER_LOCK Port Limit Alert Interrupt Enable */ ++// {0x1220, 0, 1, 0x28}, /* XRX200_PCE_PIER_LIM Port Lock Alert Interrupt Enable */ ++// {0x1224, 0, 16, 0x28}, /* XRX200_PCE_PISR Parser and ClassificationEngine Port Interrupt Status Register */ ++// {0x1224, 5, 1, 0x28}, /* XRX200_PCE_PISR_CLDRP Classification Drop Interrupt */ ++// {0x1224, 4, 1, 0x28}, /* XRX200_PCE_PISR_PTDRP Port Drop Interrupt */ ++// {0x1224, 3, 1, 0x28}, /* XRX200_PCE_PISR_VLAN VLAN Violation Interrupt */ ++// {0x1224, 2, 1, 0x28}, /* XRX200_PCE_PISR_WOL Wake-on-LAN Interrupt */ ++// {0x1224, 1, 1, 0x28}, /* XRX200_PCE_PISR_LOCK Port Lock Alert Interrupt */ ++// {0x1224, 0, 1, 0x28}, /* XRX200_PCE_PISR_LIMIT Port Limitation Alert Interrupt */ ++// {0x1600, 0, 16, 0x1c}, /* XRX200_PCE_TCM_CTRL Three-colorMarker Control Register */ ++// {0x1600, 0, 1, 0x1c}, /* XRX200_PCE_TCM_CTRL_TCMEN Three-color Marker metering instance enable */ ++// {0x1604, 0, 16, 0x1c}, /* XRX200_PCE_TCM_STAT Three-colorMarker Status Register */ ++// {0x1604, 1, 1, 0x1c}, /* XRX200_PCE_TCM_STAT_AL1 Three-color Marker Alert 1 Status */ ++// {0x1604, 0, 1, 0x1c}, /* XRX200_PCE_TCM_STAT_AL0 Three-color Marker Alert 0 Status */ ++// {0x1608, 0, 16, 0x1c}, /* XRX200_PCE_TCM_CBS Three-color MarkerCommitted Burst Size Register */ ++// {0x1608, 0, 10, 0x1c}, /* XRX200_PCE_TCM_CBS_CBS Committed Burst Size */ ++// {0x160C, 0, 16, 0x1c}, /* XRX200_PCE_TCM_EBS Three-color MarkerExcess Burst Size Register */ ++// {0x160C, 0, 10, 0x1c}, /* XRX200_PCE_TCM_EBS_EBS Excess Burst Size */ ++// {0x1610, 0, 16, 0x1c}, /* XRX200_PCE_TCM_IBS Three-color MarkerInstantaneous Burst Size Register */ ++// {0x1610, 0, 2, 0x1c}, /* XRX200_PCE_TCM_IBS_IBS Instantaneous Burst Size */ ++// {0x1614, 0, 16, 0x1c}, /* XRX200_PCE_TCM_CIR_MANT Three-colorMarker Constant Information Rate Mantissa Register */ ++// {0x1614, 0, 10, 0x1c}, /* XRX200_PCE_TCM_CIR_MANT_MANT Rate Counter Mantissa */ ++// {0x1618, 0, 16, 0x1c}, /* XRX200_PCE_TCM_CIR_EXP Three-colorMarker Constant Information Rate Exponent Register */ ++// {0x1618, 0, 4, 0x1c}, /* XRX200_PCE_TCM_CIR_EXP_EXP Rate Counter Exponent */ ++// {0x2300, 0, 16, 0x00}, /* XRX200_MAC_TEST MAC Test Register */ ++// {0x2300, 0, 16, 0x00}, /* XRX200_MAC_TEST_JTP Jitter Test Pattern */ ++// {0x2304, 0, 16, 0x00}, /* XRX200_MAC_PFAD_CFG MAC Pause FrameSource Address Configuration Register */ ++// {0x2304, 0, 1, 0x00}, /* XRX200_MAC_PFAD_CFG_SAMOD Source Address Mode */ ++// {0x2308, 0, 16, 0x00}, /* XRX200_MAC_PFSA_0 Pause Frame SourceAddress Part 0 */ ++// {0x2308, 0, 16, 0x00}, /* XRX200_MAC_PFSA_0_PFAD Pause Frame Source Address Part 0 */ ++// {0x230C, 0, 16, 0x00}, /* XRX200_MAC_PFSA_1 Pause Frame SourceAddress Part 1 */ ++// {0x230C, 0, 16, 0x00}, /* XRX200_MAC_PFSA_1_PFAD Pause Frame Source Address Part 1 */ ++// {0x2310, 0, 16, 0x00}, /* XRX200_MAC_PFSA_2 Pause Frame SourceAddress Part 2 */ ++// {0x2310, 0, 16, 0x00}, /* XRX200_MAC_PFSA_2_PFAD Pause Frame Source Address Part 2 */ ++// {0x2314, 0, 16, 0x00}, /* XRX200_MAC_FLEN MAC Frame Length Register */ ++// {0x2314, 0, 14, 0x00}, /* XRX200_MAC_FLEN_LEN Maximum Frame Length */ ++// {0x2318, 0, 16, 0x00}, /* XRX200_MAC_VLAN_ETYPE_0 MAC VLAN EthertypeRegister 0 */ ++// {0x2318, 0, 16, 0x00}, /* XRX200_MAC_VLAN_ETYPE_0_OUTER Ethertype */ ++// {0x231C, 0, 16, 0x00}, /* XRX200_MAC_VLAN_ETYPE_1 MAC VLAN EthertypeRegister 1 */ ++// {0x231C, 0, 16, 0x00}, /* XRX200_MAC_VLAN_ETYPE_1_INNER Ethertype */ ++// {0x2320, 0, 16, 0x00}, /* XRX200_MAC_IER MAC Interrupt EnableRegister */ ++// {0x2320, 0, 8, 0x00}, /* XRX200_MAC_IER_MACIEN MAC Interrupt Enable */ ++// {0x2324, 0, 16, 0x00}, /* XRX200_MAC_ISR MAC Interrupt StatusRegister */ ++// {0x2324, 0, 8, 0x00}, /* XRX200_MAC_ISR_MACINT MAC Interrupt */ ++// {0x2400, 0, 16, 0x30}, /* XRX200_MAC_PSTAT MAC Port Status Register */ ++// {0x2400, 11, 1, 0x30}, /* XRX200_MAC_PSTAT_PACT PHY Active Status */ ++ {0x2400, 10, 1, 0x30}, /* XRX200_MAC_PSTAT_GBIT Gigabit Speed Status */ ++ {0x2400, 9, 1, 0x30}, /* XRX200_MAC_PSTAT_MBIT Megabit Speed Status */ ++ {0x2400, 8, 1, 0x30}, /* XRX200_MAC_PSTAT_FDUP Full Duplex Status */ ++// {0x2400, 7, 1, 0x30}, /* XRX200_MAC_PSTAT_RXPAU Receive Pause Status */ ++// {0x2400, 6, 1, 0x30}, /* XRX200_MAC_PSTAT_TXPAU Transmit Pause Status */ ++// {0x2400, 5, 1, 0x30}, /* XRX200_MAC_PSTAT_RXPAUEN Receive Pause Enable Status */ ++// {0x2400, 4, 1, 0x30}, /* XRX200_MAC_PSTAT_TXPAUEN Transmit Pause Enable Status */ ++ {0x2400, 3, 1, 0x30}, /* XRX200_MAC_PSTAT_LSTAT Link Status */ ++// {0x2400, 2, 1, 0x30}, /* XRX200_MAC_PSTAT_CRS Carrier Sense Status */ ++// {0x2400, 1, 1, 0x30}, /* XRX200_MAC_PSTAT_TXLPI Transmit Low-power Idle Status */ ++// {0x2400, 0, 1, 0x30}, /* XRX200_MAC_PSTAT_RXLPI Receive Low-power Idle Status */ ++// {0x2404, 0, 16, 0x30}, /* XRX200_MAC_PISR MAC Interrupt Status Register */ ++// {0x2404, 13, 1, 0x30}, /* XRX200_MAC_PISR_PACT PHY Active Status */ ++// {0x2404, 12, 1, 0x30}, /* XRX200_MAC_PISR_SPEED Megabit Speed Status */ ++// {0x2404, 11, 1, 0x30}, /* XRX200_MAC_PISR_FDUP Full Duplex Status */ ++// {0x2404, 10, 1, 0x30}, /* XRX200_MAC_PISR_RXPAUEN Receive Pause Enable Status */ ++// {0x2404, 9, 1, 0x30}, /* XRX200_MAC_PISR_TXPAUEN Transmit Pause Enable Status */ ++// {0x2404, 8, 1, 0x30}, /* XRX200_MAC_PISR_LPIOFF Receive Low-power Idle Mode is left */ ++// {0x2404, 7, 1, 0x30}, /* XRX200_MAC_PISR_LPION Receive Low-power Idle Mode is entered */ ++// {0x2404, 6, 1, 0x30}, /* XRX200_MAC_PISR_JAM Jam Status Detected */ ++// {0x2404, 5, 1, 0x30}, /* XRX200_MAC_PISR_TOOSHORT Too Short Frame Error Detected */ ++// {0x2404, 4, 1, 0x30}, /* XRX200_MAC_PISR_TOOLONG Too Long Frame Error Detected */ ++// {0x2404, 3, 1, 0x30}, /* XRX200_MAC_PISR_LENERR Length Mismatch Error Detected */ ++// {0x2404, 2, 1, 0x30}, /* XRX200_MAC_PISR_FCSERR Frame Checksum Error Detected */ ++// {0x2404, 1, 1, 0x30}, /* XRX200_MAC_PISR_TXPAUSE Pause Frame Transmitted */ ++// {0x2404, 0, 1, 0x30}, /* XRX200_MAC_PISR_RXPAUSE Pause Frame Received */ ++// {0x2408, 0, 16, 0x30}, /* XRX200_MAC_PIER MAC Interrupt Enable Register */ ++// {0x2408, 13, 1, 0x30}, /* XRX200_MAC_PIER_PACT PHY Active Status */ ++// {0x2408, 12, 1, 0x30}, /* XRX200_MAC_PIER_SPEED Megabit Speed Status */ ++// {0x2408, 11, 1, 0x30}, /* XRX200_MAC_PIER_FDUP Full Duplex Status */ ++// {0x2408, 10, 1, 0x30}, /* XRX200_MAC_PIER_RXPAUEN Receive Pause Enable Status */ ++// {0x2408, 9, 1, 0x30}, /* XRX200_MAC_PIER_TXPAUEN Transmit Pause Enable Status */ ++// {0x2408, 8, 1, 0x30}, /* XRX200_MAC_PIER_LPIOFF Low-power Idle Off Interrupt Mask */ ++// {0x2408, 7, 1, 0x30}, /* XRX200_MAC_PIER_LPION Low-power Idle On Interrupt Mask */ ++// {0x2408, 6, 1, 0x30}, /* XRX200_MAC_PIER_JAM Jam Status Interrupt Mask */ ++// {0x2408, 5, 1, 0x30}, /* XRX200_MAC_PIER_TOOSHORT Too Short Frame Error Interrupt Mask */ ++// {0x2408, 4, 1, 0x30}, /* XRX200_MAC_PIER_TOOLONG Too Long Frame Error Interrupt Mask */ ++// {0x2408, 3, 1, 0x30}, /* XRX200_MAC_PIER_LENERR Length Mismatch Error Interrupt Mask */ ++// {0x2408, 2, 1, 0x30}, /* XRX200_MAC_PIER_FCSERR Frame Checksum Error Interrupt Mask */ ++// {0x2408, 1, 1, 0x30}, /* XRX200_MAC_PIER_TXPAUSE Transmit Pause Frame Interrupt Mask */ ++// {0x2408, 0, 1, 0x30}, /* XRX200_MAC_PIER_RXPAUSE Receive Pause Frame Interrupt Mask */ ++// {0x240C, 0, 16, 0x30}, /* XRX200_MAC_CTRL_0 MAC Control Register0 */ ++// {0x240C, 13, 2, 0x30}, /* XRX200_MAC_CTRL_0_LCOL Late Collision Control */ ++// {0x240C, 12, 1, 0x30}, /* XRX200_MAC_CTRL_0_BM Burst Mode Control */ ++// {0x240C, 11, 1, 0x30}, /* XRX200_MAC_CTRL_0_APADEN Automatic VLAN Padding Enable */ ++// {0x240C, 10, 1, 0x30}, /* XRX200_MAC_CTRL_0_VPAD2EN Stacked VLAN Padding Enable */ ++// {0x240C, 9, 1, 0x30}, /* XRX200_MAC_CTRL_0_VPADEN VLAN Padding Enable */ ++// {0x240C, 8, 1, 0x30}, /* XRX200_MAC_CTRL_0_PADEN Padding Enable */ ++// {0x240C, 7, 1, 0x30}, /* XRX200_MAC_CTRL_0_FCS Transmit FCS Control */ ++ {0x240C, 4, 3, 0x30}, /* XRX200_MAC_CTRL_0_FCON Flow Control Mode */ ++// {0x240C, 2, 2, 0x30}, /* XRX200_MAC_CTRL_0_FDUP Full Duplex Control */ ++// {0x240C, 0, 2, 0x30}, /* XRX200_MAC_CTRL_0_GMII GMII/MII interface mode selection */ ++// {0x2410, 0, 16, 0x30}, /* XRX200_MAC_CTRL_1 MAC Control Register1 */ ++// {0x2410, 8, 1, 0x30}, /* XRX200_MAC_CTRL_1_SHORTPRE Short Preamble Control */ ++// {0x2410, 0, 4, 0x30}, /* XRX200_MAC_CTRL_1_IPG Minimum Inter Packet Gap Size */ ++// {0x2414, 0, 16, 0x30}, /* XRX200_MAC_CTRL_2 MAC Control Register2 */ ++// {0x2414, 3, 1, 0x30}, /* XRX200_MAC_CTRL_2_MLEN Maximum Untagged Frame Length */ ++// {0x2414, 2, 1, 0x30}, /* XRX200_MAC_CTRL_2_LCHKL Frame Length Check Long Enable */ ++// {0x2414, 0, 2, 0x30}, /* XRX200_MAC_CTRL_2_LCHKS Frame Length Check Short Enable */ ++// {0x2418, 0, 16, 0x30}, /* XRX200_MAC_CTRL_3 MAC Control Register3 */ ++// {0x2418, 0, 4, 0x30}, /* XRX200_MAC_CTRL_3_RCNT Retry Count */ ++// {0x241C, 0, 16, 0x30}, /* XRX200_MAC_CTRL_4 MAC Control Register4 */ ++// {0x241C, 7, 1, 0x30}, /* XRX200_MAC_CTRL_4_LPIEN LPI Mode Enable */ ++// {0x241C, 0, 7, 0x30}, /* XRX200_MAC_CTRL_4_WAIT LPI Wait Time */ ++// {0x2420, 0, 16, 0x30}, /* XRX200_MAC_CTRL_5_PJPS MAC Control Register5 */ ++// {0x2420, 1, 1, 0x30}, /* XRX200_MAC_CTRL_5_PJPS_NOBP Prolonged Jam pattern size during no-backpressure state */ ++// {0x2420, 0, 1, 0x30}, /* XRX200_MAC_CTRL_5_PJPS_BP Prolonged Jam pattern size during backpressure state */ ++// {0x2424, 0, 16, 0x30}, /* XRX200_MAC_CTRL_6_XBUF Transmit and ReceiveBuffer Control Register */ ++// {0x2424, 9, 3, 0x30}, /* XRX200_MAC_CTRL_6_RBUF_DLY_WP Delay */ ++// {0x2424, 8, 1, 0x30}, /* XRX200_MAC_CTRL_6_RBUF_INIT Receive Buffer Initialization */ ++// {0x2424, 6, 1, 0x30}, /* XRX200_MAC_CTRL_6_RBUF_BYPASS Bypass the Receive Buffer */ ++// {0x2424, 3, 3, 0x30}, /* XRX200_MAC_CTRL_6_XBUF_DLY_WP Delay */ ++// {0x2424, 2, 1, 0x30}, /* XRX200_MAC_CTRL_6_XBUF_INIT Initialize the Transmit Buffer */ ++// {0x2424, 0, 1, 0x30}, /* XRX200_MAC_CTRL_6_XBUF_BYPASS Bypass the Transmit Buffer */ ++// {0x2428, 0, 16, 0x30}, /* XRX200_MAC_BUFST_XBUF MAC Receive and TransmitBuffer Status Register */ ++// {0x2428, 3, 1, 0x30}, /* XRX200_MAC_BUFST_RBUF_UFL Receive Buffer Underflow Indicator */ ++// {0x2428, 2, 1, 0x30}, /* XRX200_MAC_BUFST_RBUF_OFL Receive Buffer Overflow Indicator */ ++// {0x2428, 1, 1, 0x30}, /* XRX200_MAC_BUFST_XBUF_UFL Transmit Buffer Underflow Indicator */ ++// {0x2428, 0, 1, 0x30}, /* XRX200_MAC_BUFST_XBUF_OFL Transmit Buffer Overflow Indicator */ ++// {0x242C, 0, 16, 0x30}, /* XRX200_MAC_TESTEN MAC Test Enable Register */ ++// {0x242C, 2, 1, 0x30}, /* XRX200_MAC_TESTEN_JTEN Jitter Test Enable */ ++// {0x242C, 1, 1, 0x30}, /* XRX200_MAC_TESTEN_TXER Transmit Error Insertion */ ++// {0x242C, 0, 1, 0x30}, /* XRX200_MAC_TESTEN_LOOP MAC Loopback Enable */ ++// {0x2900, 0, 16, 0x00}, /* XRX200_FDMA_CTRL Ethernet Switch FetchDMA Control Register */ ++// {0x2900, 7, 5, 0x00}, /* XRX200_FDMA_CTRL_LPI_THRESHOLD Low Power Idle Threshold */ ++// {0x2900, 4, 3, 0x00}, /* XRX200_FDMA_CTRL_LPI_MODE Low Power Idle Mode */ ++// {0x2900, 2, 2, 0x00}, /* XRX200_FDMA_CTRL_EGSTAG Egress Special Tag Size */ ++// {0x2900, 1, 1, 0x00}, /* XRX200_FDMA_CTRL_IGSTAG Ingress Special Tag Size */ ++// {0x2900, 0, 1, 0x00}, /* XRX200_FDMA_CTRL_EXCOL Excessive Collision Handling */ ++// {0x2904, 0, 16, 0x00}, /* XRX200_FDMA_STETYPE Special Tag EthertypeControl Register */ ++// {0x2904, 0, 16, 0x00}, /* XRX200_FDMA_STETYPE_ETYPE Special Tag Ethertype */ ++// {0x2908, 0, 16, 0x00}, /* XRX200_FDMA_VTETYPE VLAN Tag EthertypeControl Register */ ++// {0x2908, 0, 16, 0x00}, /* XRX200_FDMA_VTETYPE_ETYPE VLAN Tag Ethertype */ ++// {0x290C, 0, 16, 0x00}, /* XRX200_FDMA_STAT_0 FDMA Status Register0 */ ++// {0x290C, 0, 16, 0x00}, /* XRX200_FDMA_STAT_0_FSMS FSM states status */ ++// {0x2910, 0, 16, 0x00}, /* XRX200_FDMA_IER Fetch DMA Global InterruptEnable Register */ ++// {0x2910, 14, 1, 0x00}, /* XRX200_FDMA_IER_PCKD Packet Drop Interrupt Enable */ ++// {0x2910, 13, 1, 0x00}, /* XRX200_FDMA_IER_PCKR Packet Ready Interrupt Enable */ ++// {0x2910, 0, 8, 0x00}, /* XRX200_FDMA_IER_PCKT Packet Sent Interrupt Enable */ ++// {0x2914, 0, 16, 0x00}, /* XRX200_FDMA_ISR Fetch DMA Global InterruptStatus Register */ ++// {0x2914, 14, 1, 0x00}, /* XRX200_FDMA_ISR_PCKTD Packet Drop */ ++// {0x2914, 13, 1, 0x00}, /* XRX200_FDMA_ISR_PCKR Packet is Ready for Transmission */ ++// {0x2914, 0, 8, 0x00}, /* XRX200_FDMA_ISR_PCKT Packet Sent Event */ ++// {0x2A00, 0, 16, 0x18}, /* XRX200_FDMA_PCTRL Ethernet SwitchFetch DMA Port Control Register */ ++// {0x2A00, 3, 2, 0x18}, /* XRX200_FDMA_PCTRL_VLANMOD VLAN Modification Enable */ ++// {0x2A00, 2, 1, 0x18}, /* XRX200_FDMA_PCTRL_DSCPRM DSCP Re-marking Enable */ ++// {0x2A00, 1, 1, 0x18}, /* XRX200_FDMA_PCTRL_STEN Special Tag Insertion Enable */ ++// {0x2A00, 0, 1, 0x18}, /* XRX200_FDMA_PCTRL_EN FDMA Port Enable */ ++// {0x2A04, 0, 16, 0x18}, /* XRX200_FDMA_PRIO Ethernet SwitchFetch DMA Port Priority Register */ ++// {0x2A04, 0, 2, 0x18}, /* XRX200_FDMA_PRIO_PRIO FDMA PRIO */ ++// {0x2A08, 0, 16, 0x18}, /* XRX200_FDMA_PSTAT0 Ethernet SwitchFetch DMA Port Status Register 0 */ ++// {0x2A08, 15, 1, 0x18}, /* XRX200_FDMA_PSTAT0_PKT_AVAIL Port Egress Packet Available */ ++// {0x2A08, 14, 1, 0x18}, /* XRX200_FDMA_PSTAT0_POK Port Status OK */ ++// {0x2A08, 0, 6, 0x18}, /* XRX200_FDMA_PSTAT0_PSEG Port Egress Segment Count */ ++// {0x2A0C, 0, 16, 0x18}, /* XRX200_FDMA_PSTAT1_HDR Ethernet SwitchFetch DMA Port Status Register 1 */ ++// {0x2A0C, 0, 10, 0x18}, /* XRX200_FDMA_PSTAT1_HDR_PTR Header Pointer */ ++// {0x2A10, 0, 16, 0x18}, /* XRX200_FDMA_TSTAMP0 Egress TimeStamp Register 0 */ ++// {0x2A10, 0, 16, 0x18}, /* XRX200_FDMA_TSTAMP0_TSTL Time Stamp [15:0] */ ++// {0x2A14, 0, 16, 0x18}, /* XRX200_FDMA_TSTAMP1 Egress TimeStamp Register 1 */ ++// {0x2A14, 0, 16, 0x18}, /* XRX200_FDMA_TSTAMP1_TSTH Time Stamp [31:16] */ ++// {0x2D00, 0, 16, 0x00}, /* XRX200_SDMA_CTRL Ethernet Switch StoreDMA Control Register */ ++// {0x2D00, 0, 1, 0x00}, /* XRX200_SDMA_CTRL_TSTEN Time Stamp Enable */ ++// {0x2D04, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR1 SDMA Flow Control Threshold1 Register */ ++// {0x2D04, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR1_THR1 Threshold 1 */ ++// {0x2D08, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR2 SDMA Flow Control Threshold2 Register */ ++// {0x2D08, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR2_THR2 Threshold 2 */ ++// {0x2D0C, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR3 SDMA Flow Control Threshold3 Register */ ++// {0x2D0C, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR3_THR3 Threshold 3 */ ++// {0x2D10, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR4 SDMA Flow Control Threshold4 Register */ ++// {0x2D10, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR4_THR4 Threshold 4 */ ++// {0x2D14, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR5 SDMA Flow Control Threshold5 Register */ ++// {0x2D14, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR5_THR5 Threshold 5 */ ++// {0x2D18, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR6 SDMA Flow Control Threshold6 Register */ ++// {0x2D18, 0, 10, 0x00}, /* XRX200_SDMA_FCTHR6_THR6 Threshold 6 */ ++// {0x2D1C, 0, 16, 0x00}, /* XRX200_SDMA_FCTHR7 SDMA Flow Control Threshold7 Register */ ++// {0x2D1C, 0, 11, 0x00}, /* XRX200_SDMA_FCTHR7_THR7 Threshold 7 */ ++// {0x2D20, 0, 16, 0x00}, /* XRX200_SDMA_STAT_0 SDMA Status Register0 */ ++// {0x2D20, 4, 3, 0x00}, /* XRX200_SDMA_STAT_0_BPS_FILL Back Pressure Status */ ++// {0x2D20, 2, 2, 0x00}, /* XRX200_SDMA_STAT_0_BPS_PNT Back Pressure Status */ ++// {0x2D20, 0, 2, 0x00}, /* XRX200_SDMA_STAT_0_DROP Back Pressure Status */ ++// {0x2D24, 0, 16, 0x00}, /* XRX200_SDMA_STAT_1 SDMA Status Register1 */ ++// {0x2D24, 0, 10, 0x00}, /* XRX200_SDMA_STAT_1_FILL Buffer Filling Level */ ++// {0x2D28, 0, 16, 0x00}, /* XRX200_SDMA_STAT_2 SDMA Status Register2 */ ++// {0x2D28, 0, 16, 0x00}, /* XRX200_SDMA_STAT_2_FSMS FSM states status */ ++// {0x2D2C, 0, 16, 0x00}, /* XRX200_SDMA_IER SDMA Interrupt Enable Register */ ++// {0x2D2C, 15, 1, 0x00}, /* XRX200_SDMA_IER_BPEX Buffer Pointers Exceeded */ ++// {0x2D2C, 14, 1, 0x00}, /* XRX200_SDMA_IER_BFULL Buffer Full */ ++// {0x2D2C, 13, 1, 0x00}, /* XRX200_SDMA_IER_FERR Frame Error */ ++// {0x2D2C, 0, 8, 0x00}, /* XRX200_SDMA_IER_FRX Frame Received Successfully */ ++// {0x2D30, 0, 16, 0x00}, /* XRX200_SDMA_ISR SDMA Interrupt Status Register */ ++// {0x2D30, 15, 1, 0x00}, /* XRX200_SDMA_ISR_BPEX Packet Descriptors Exceeded */ ++// {0x2D30, 14, 1, 0x00}, /* XRX200_SDMA_ISR_BFULL Buffer Full */ ++// {0x2D30, 13, 1, 0x00}, /* XRX200_SDMA_ISR_FERR Frame Error */ ++// {0x2D30, 0, 8, 0x00}, /* XRX200_SDMA_ISR_FRX Frame Received Successfully */ ++// {0x2F00, 0, 16, 0x18}, /* XRX200_SDMA_PCTRL Ethernet SwitchStore DMA Port Control Register */ ++// {0x2F00, 13, 2, 0x18}, /* XRX200_SDMA_PCTRL_DTHR Drop Threshold Selection */ ++// {0x2F00, 11, 2, 0x18}, /* XRX200_SDMA_PCTRL_PTHR Pause Threshold Selection */ ++// {0x2F00, 10, 1, 0x18}, /* XRX200_SDMA_PCTRL_PHYEFWD Forward PHY Error Frames */ ++// {0x2F00, 9, 1, 0x18}, /* XRX200_SDMA_PCTRL_ALGFWD Forward Alignment Error Frames */ ++// {0x2F00, 8, 1, 0x18}, /* XRX200_SDMA_PCTRL_LENFWD Forward Length Errored Frames */ ++// {0x2F00, 7, 1, 0x18}, /* XRX200_SDMA_PCTRL_OSFWD Forward Oversized Frames */ ++// {0x2F00, 6, 1, 0x18}, /* XRX200_SDMA_PCTRL_USFWD Forward Undersized Frames */ ++// {0x2F00, 5, 1, 0x18}, /* XRX200_SDMA_PCTRL_FCSIGN Ignore FCS Errors */ ++// {0x2F00, 4, 1, 0x18}, /* XRX200_SDMA_PCTRL_FCSFWD Forward FCS Errored Frames */ ++// {0x2F00, 3, 1, 0x18}, /* XRX200_SDMA_PCTRL_PAUFWD Pause Frame Forwarding */ ++// {0x2F00, 2, 1, 0x18}, /* XRX200_SDMA_PCTRL_MFCEN Metering Flow Control Enable */ ++// {0x2F00, 1, 1, 0x18}, /* XRX200_SDMA_PCTRL_FCEN Flow Control Enable */ ++// {0x2F00, 0, 1, 0x18}, /* XRX200_SDMA_PCTRL_PEN Port Enable */ ++// {0x2F04, 0, 16, 0x18}, /* XRX200_SDMA_PRIO Ethernet SwitchStore DMA Port Priority Register */ ++// {0x2F04, 0, 2, 0x18}, /* XRX200_SDMA_PRIO_PRIO SDMA PRIO */ ++// {0x2F08, 0, 16, 0x18}, /* XRX200_SDMA_PSTAT0_HDR Ethernet SwitchStore DMA Port Status Register 0 */ ++// {0x2F08, 0, 10, 0x18}, /* XRX200_SDMA_PSTAT0_HDR_PTR Port Ingress Queue Header Pointer */ ++// {0x2F0C, 0, 16, 0x18}, /* XRX200_SDMA_PSTAT1 Ethernet SwitchStore DMA Port Status Register 1 */ ++// {0x2F0C, 0, 10, 0x18}, /* XRX200_SDMA_PSTAT1_PPKT Port Ingress Packet Count */ ++// {0x2F10, 0, 16, 0x18}, /* XRX200_SDMA_TSTAMP0 Ingress TimeStamp Register 0 */ ++// {0x2F10, 0, 16, 0x18}, /* XRX200_SDMA_TSTAMP0_TSTL Time Stamp [15:0] */ ++// {0x2F14, 0, 16, 0x18}, /* XRX200_SDMA_TSTAMP1 Ingress TimeStamp Register 1 */ ++// {0x2F14, 0, 16, 0x18}, /* XRX200_SDMA_TSTAMP1_TSTH Time Stamp [31:16] */ ++}; ++ ++ diff --git a/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch b/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch new file mode 100644 index 000000000..eb6acdb2f --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0026-NET-multi-phy-support.patch @@ -0,0 +1,53 @@ +From c6feeeb407a3b8a6597ae377ba4dd138e185e3dd Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 27 Jul 2014 09:38:50 +0100 +Subject: [PATCH 26/36] NET: multi phy support + +Signed-off-by: John Crispin +--- + drivers/net/phy/phy.c | 9 ++++++--- + include/linux/phy.h | 1 + + 2 files changed, 7 insertions(+), 3 deletions(-) + +--- a/drivers/net/phy/phy.c ++++ b/drivers/net/phy/phy.c +@@ -1038,7 +1038,8 @@ void phy_state_machine(struct work_struc + /* If the link is down, give up on negotiation for now */ + if (!phydev->link) { + phydev->state = PHY_NOLINK; +- netif_carrier_off(phydev->attached_dev); ++ if (!phydev->no_auto_carrier_off) ++ netif_carrier_off(phydev->attached_dev); + phydev->adjust_link(phydev->attached_dev); + break; + } +@@ -1130,7 +1131,8 @@ void phy_state_machine(struct work_struc + netif_carrier_on(phydev->attached_dev); + } else { + phydev->state = PHY_NOLINK; +- netif_carrier_off(phydev->attached_dev); ++ if (!phydev->no_auto_carrier_off) ++ netif_carrier_off(phydev->attached_dev); + } + + phydev->adjust_link(phydev->attached_dev); +@@ -1142,7 +1144,8 @@ void phy_state_machine(struct work_struc + case PHY_HALTED: + if (phydev->link) { + phydev->link = 0; +- netif_carrier_off(phydev->attached_dev); ++ if (!phydev->no_auto_carrier_off) ++ netif_carrier_off(phydev->attached_dev); + phydev->adjust_link(phydev->attached_dev); + do_suspend = true; + } +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -369,6 +369,7 @@ struct phy_device { + bool is_pseudo_fixed_link; + bool has_fixups; + bool suspended; ++ bool no_auto_carrier_off; + + enum phy_state state; + diff --git a/target/linux/lantiq/patches-4.9/0027-01-net-phy-intel-xway-add-VR9-version-number.patch b/target/linux/lantiq/patches-4.9/0027-01-net-phy-intel-xway-add-VR9-version-number.patch new file mode 100644 index 000000000..21261b459 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0027-01-net-phy-intel-xway-add-VR9-version-number.patch @@ -0,0 +1,62 @@ +From 5b73d9955fb4b0e3c37f8f6c71910293246c89dc Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Thu, 22 Mar 2018 23:31:38 +0100 +Subject: [PATCH 1/2] net: phy: intel-xway: add VR9 version number + +The VR9 phy ids are matching only for the SoC version 1.2. Rename the +macros and change the names to take this into account. + +Signed-off-by: Mathias Kresin +Signed-off-by: David S. Miller +--- + drivers/net/phy/intel-xway.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/net/phy/intel-xway.c ++++ b/drivers/net/phy/intel-xway.c +@@ -149,8 +149,8 @@ + #define PHY_ID_PHY22F_1_4 0xD565A410 + #define PHY_ID_PHY11G_1_5 0xD565A401 + #define PHY_ID_PHY22F_1_5 0xD565A411 +-#define PHY_ID_PHY11G_VR9 0xD565A409 +-#define PHY_ID_PHY22F_VR9 0xD565A419 ++#define PHY_ID_PHY11G_VR9_1_2 0xD565A409 ++#define PHY_ID_PHY22F_VR9_1_2 0xD565A419 + + #if IS_ENABLED(CONFIG_OF_MDIO) + static int vr9_gphy_of_reg_init(struct phy_device *phydev) +@@ -372,9 +372,9 @@ static struct phy_driver xway_gphy[] = { + .suspend = genphy_suspend, + .resume = genphy_resume, + }, { +- .phy_id = PHY_ID_PHY11G_VR9, ++ .phy_id = PHY_ID_PHY11G_VR9_1_2, + .phy_id_mask = 0xffffffff, +- .name = "Intel XWAY PHY11G (xRX integrated)", ++ .name = "Intel XWAY PHY11G (xRX v1.2 integrated)", + .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | + SUPPORTED_Asym_Pause), + .flags = PHY_HAS_INTERRUPT, +@@ -387,9 +387,9 @@ static struct phy_driver xway_gphy[] = { + .suspend = genphy_suspend, + .resume = genphy_resume, + }, { +- .phy_id = PHY_ID_PHY22F_VR9, ++ .phy_id = PHY_ID_PHY22F_VR9_1_2, + .phy_id_mask = 0xffffffff, +- .name = "Intel XWAY PHY22F (xRX integrated)", ++ .name = "Intel XWAY PHY22F (xRX v1.2 integrated)", + .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | + SUPPORTED_Asym_Pause), + .flags = PHY_HAS_INTERRUPT, +@@ -412,8 +412,8 @@ static struct mdio_device_id __maybe_unu + { PHY_ID_PHY22F_1_4, 0xffffffff }, + { PHY_ID_PHY11G_1_5, 0xffffffff }, + { PHY_ID_PHY22F_1_5, 0xffffffff }, +- { PHY_ID_PHY11G_VR9, 0xffffffff }, +- { PHY_ID_PHY22F_VR9, 0xffffffff }, ++ { PHY_ID_PHY11G_VR9_1_2, 0xffffffff }, ++ { PHY_ID_PHY22F_VR9_1_2, 0xffffffff }, + { } + }; + MODULE_DEVICE_TABLE(mdio, xway_gphy_tbl); diff --git a/target/linux/lantiq/patches-4.9/0027-02-net-phy-intel-xway-add-VR9-v1.1-phy-ids.patch b/target/linux/lantiq/patches-4.9/0027-02-net-phy-intel-xway-add-VR9-v1.1-phy-ids.patch new file mode 100644 index 000000000..9a9253290 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0027-02-net-phy-intel-xway-add-VR9-v1.1-phy-ids.patch @@ -0,0 +1,71 @@ +From f452518c982e57538e6d49da0a2c80eef22087ab Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Thu, 22 Mar 2018 23:31:39 +0100 +Subject: [PATCH 2/2] net: phy: intel-xway: add VR9 v1.1 phy ids + +The phys embedded into the v1.1 of the VR9 SoC are using different phy +ids. Add the phy ids to use the driver for this VR9 version as well. + +Signed-off-by: Mathias Kresin +Signed-off-by: David S. Miller +--- + drivers/net/phy/intel-xway.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +--- a/drivers/net/phy/intel-xway.c ++++ b/drivers/net/phy/intel-xway.c +@@ -149,6 +149,8 @@ + #define PHY_ID_PHY22F_1_4 0xD565A410 + #define PHY_ID_PHY11G_1_5 0xD565A401 + #define PHY_ID_PHY22F_1_5 0xD565A411 ++#define PHY_ID_PHY11G_VR9_1_1 0xD565A408 ++#define PHY_ID_PHY22F_VR9_1_1 0xD565A418 + #define PHY_ID_PHY11G_VR9_1_2 0xD565A409 + #define PHY_ID_PHY22F_VR9_1_2 0xD565A419 + +@@ -372,6 +374,36 @@ static struct phy_driver xway_gphy[] = { + .suspend = genphy_suspend, + .resume = genphy_resume, + }, { ++ .phy_id = PHY_ID_PHY11G_VR9_1_1, ++ .phy_id_mask = 0xffffffff, ++ .name = "Intel XWAY PHY11G (xRX v1.1 integrated)", ++ .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | ++ SUPPORTED_Asym_Pause), ++ .flags = PHY_HAS_INTERRUPT, ++ .config_init = xway_gphy_config_init, ++ .config_aneg = genphy_config_aneg, ++ .read_status = genphy_read_status, ++ .ack_interrupt = xway_gphy_ack_interrupt, ++ .did_interrupt = xway_gphy_did_interrupt, ++ .config_intr = xway_gphy_config_intr, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ }, { ++ .phy_id = PHY_ID_PHY22F_VR9_1_1, ++ .phy_id_mask = 0xffffffff, ++ .name = "Intel XWAY PHY22F (xRX v1.1 integrated)", ++ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | ++ SUPPORTED_Asym_Pause), ++ .flags = PHY_HAS_INTERRUPT, ++ .config_init = xway_gphy_config_init, ++ .config_aneg = genphy_config_aneg, ++ .read_status = genphy_read_status, ++ .ack_interrupt = xway_gphy_ack_interrupt, ++ .did_interrupt = xway_gphy_did_interrupt, ++ .config_intr = xway_gphy_config_intr, ++ .suspend = genphy_suspend, ++ .resume = genphy_resume, ++ }, { + .phy_id = PHY_ID_PHY11G_VR9_1_2, + .phy_id_mask = 0xffffffff, + .name = "Intel XWAY PHY11G (xRX v1.2 integrated)", +@@ -412,6 +444,8 @@ static struct mdio_device_id __maybe_unu + { PHY_ID_PHY22F_1_4, 0xffffffff }, + { PHY_ID_PHY11G_1_5, 0xffffffff }, + { PHY_ID_PHY22F_1_5, 0xffffffff }, ++ { PHY_ID_PHY11G_VR9_1_1, 0xffffffff }, ++ { PHY_ID_PHY22F_VR9_1_1, 0xffffffff }, + { PHY_ID_PHY11G_VR9_1_2, 0xffffffff }, + { PHY_ID_PHY22F_VR9_1_2, 0xffffffff }, + { } diff --git a/target/linux/lantiq/patches-4.9/0028-NET-lantiq-various-etop-fixes.patch b/target/linux/lantiq/patches-4.9/0028-NET-lantiq-various-etop-fixes.patch new file mode 100644 index 000000000..dc99f48ea --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0028-NET-lantiq-various-etop-fixes.patch @@ -0,0 +1,880 @@ +From 870ed9cae083ff8a60a739ef7e74c5a1800533be Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Tue, 9 Sep 2014 22:45:34 +0200 +Subject: [PATCH 28/36] NET: lantiq: various etop fixes + +Signed-off-by: John Crispin +--- + drivers/net/ethernet/lantiq_etop.c | 555 +++++++++++++++++++++++++----------- + 1 file changed, 389 insertions(+), 166 deletions(-) + +--- a/drivers/net/ethernet/lantiq_etop.c ++++ b/drivers/net/ethernet/lantiq_etop.c +@@ -11,7 +11,7 @@ + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * +- * Copyright (C) 2011 John Crispin ++ * Copyright (C) 2011-12 John Crispin + */ + + #include +@@ -30,11 +30,16 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include ++#include ++#include ++#include ++#include + + #include + +@@ -42,7 +47,7 @@ + #include + #include + +-#define LTQ_ETOP_MDIO 0x11804 ++#define LTQ_ETOP_MDIO_ACC 0x11804 + #define MDIO_REQUEST 0x80000000 + #define MDIO_READ 0x40000000 + #define MDIO_ADDR_MASK 0x1f +@@ -51,44 +56,91 @@ + #define MDIO_REG_OFFSET 0x10 + #define MDIO_VAL_MASK 0xffff + +-#define PPE32_CGEN 0x800 +-#define LQ_PPE32_ENET_MAC_CFG 0x1840 ++#define LTQ_ETOP_MDIO_CFG 0x11800 ++#define MDIO_CFG_MASK 0x6 ++ ++#define LTQ_ETOP_CFG 0x11808 ++#define LTQ_ETOP_IGPLEN 0x11820 ++#define LTQ_ETOP_MAC_CFG 0x11840 + + #define LTQ_ETOP_ENETS0 0x11850 + #define LTQ_ETOP_MAC_DA0 0x1186C + #define LTQ_ETOP_MAC_DA1 0x11870 +-#define LTQ_ETOP_CFG 0x16020 +-#define LTQ_ETOP_IGPLEN 0x16080 ++ ++#define MAC_CFG_MASK 0xfff ++#define MAC_CFG_CGEN (1 << 11) ++#define MAC_CFG_DUPLEX (1 << 2) ++#define MAC_CFG_SPEED (1 << 1) ++#define MAC_CFG_LINK (1 << 0) + + #define MAX_DMA_CHAN 0x8 + #define MAX_DMA_CRC_LEN 0x4 + #define MAX_DMA_DATA_LEN 0x600 + + #define ETOP_FTCU BIT(28) +-#define ETOP_MII_MASK 0xf +-#define ETOP_MII_NORMAL 0xd +-#define ETOP_MII_REVERSE 0xe + #define ETOP_PLEN_UNDER 0x40 +-#define ETOP_CGEN 0x800 ++#define ETOP_CFG_MII0 0x01 + +-/* use 2 static channels for TX/RX */ +-#define LTQ_ETOP_TX_CHANNEL 1 +-#define LTQ_ETOP_RX_CHANNEL 6 +-#define IS_TX(x) (x == LTQ_ETOP_TX_CHANNEL) +-#define IS_RX(x) (x == LTQ_ETOP_RX_CHANNEL) ++#define ETOP_CFG_MASK 0xfff ++#define ETOP_CFG_FEN0 (1 << 8) ++#define ETOP_CFG_SEN0 (1 << 6) ++#define ETOP_CFG_OFF1 (1 << 3) ++#define ETOP_CFG_REMII0 (1 << 1) ++#define ETOP_CFG_OFF0 (1 << 0) ++ ++#define LTQ_GBIT_MDIO_CTL 0xCC ++#define LTQ_GBIT_MDIO_DATA 0xd0 ++#define LTQ_GBIT_GCTL0 0x68 ++#define LTQ_GBIT_PMAC_HD_CTL 0x8c ++#define LTQ_GBIT_P0_CTL 0x4 ++#define LTQ_GBIT_PMAC_RX_IPG 0xa8 ++#define LTQ_GBIT_RGMII_CTL 0x78 ++ ++#define PMAC_HD_CTL_AS (1 << 19) ++#define PMAC_HD_CTL_RXSH (1 << 22) ++ ++/* Switch Enable (0=disable, 1=enable) */ ++#define GCTL0_SE 0x80000000 ++/* Disable MDIO auto polling (0=disable, 1=enable) */ ++#define PX_CTL_DMDIO 0x00400000 ++ ++/* MDC clock divider, clock = 25MHz/((MDC_CLOCK + 1) * 2) */ ++#define MDC_CLOCK_MASK 0xff000000 ++#define MDC_CLOCK_OFFSET 24 ++ ++/* register information for the gbit's MDIO bus */ ++#define MDIO_XR9_REQUEST 0x00008000 ++#define MDIO_XR9_READ 0x00000800 ++#define MDIO_XR9_WRITE 0x00000400 ++#define MDIO_XR9_REG_MASK 0x1f ++#define MDIO_XR9_ADDR_MASK 0x1f ++#define MDIO_XR9_RD_MASK 0xffff ++#define MDIO_XR9_REG_OFFSET 0 ++#define MDIO_XR9_ADDR_OFFSET 5 ++#define MDIO_XR9_WR_OFFSET 16 + ++#define LTQ_DMA_ETOP ((of_machine_is_compatible("lantiq,ase")) ? \ ++ (INT_NUM_IM3_IRL0) : (INT_NUM_IM2_IRL0)) ++ ++/* the newer xway socks have a embedded 3/7 port gbit multiplexer */ + #define ltq_etop_r32(x) ltq_r32(ltq_etop_membase + (x)) + #define ltq_etop_w32(x, y) ltq_w32(x, ltq_etop_membase + (y)) + #define ltq_etop_w32_mask(x, y, z) \ + ltq_w32_mask(x, y, ltq_etop_membase + (z)) + +-#define DRV_VERSION "1.0" ++#define ltq_gbit_r32(x) ltq_r32(ltq_gbit_membase + (x)) ++#define ltq_gbit_w32(x, y) ltq_w32(x, ltq_gbit_membase + (y)) ++#define ltq_gbit_w32_mask(x, y, z) \ ++ ltq_w32_mask(x, y, ltq_gbit_membase + (z)) ++ ++#define DRV_VERSION "1.2" + + static void __iomem *ltq_etop_membase; ++static void __iomem *ltq_gbit_membase; + + struct ltq_etop_chan { +- int idx; + int tx_free; ++ int irq; + struct net_device *netdev; + struct napi_struct napi; + struct ltq_dma_channel dma; +@@ -98,21 +150,34 @@ struct ltq_etop_chan { + struct ltq_etop_priv { + struct net_device *netdev; + struct platform_device *pdev; +- struct ltq_eth_data *pldata; + struct resource *res; + + struct mii_bus *mii_bus; + +- struct ltq_etop_chan ch[MAX_DMA_CHAN]; +- int tx_free[MAX_DMA_CHAN >> 1]; ++ struct ltq_etop_chan txch; ++ struct ltq_etop_chan rxch; ++ ++ int tx_irq; ++ int rx_irq; ++ ++ unsigned char mac[6]; ++ int mii_mode; + + spinlock_t lock; ++ ++ struct clk *clk_ppe; ++ struct clk *clk_switch; ++ struct clk *clk_ephy; ++ struct clk *clk_ephycgu; + }; + ++static int ltq_etop_mdio_wr(struct mii_bus *bus, int phy_addr, ++ int phy_reg, u16 phy_data); ++ + static int + ltq_etop_alloc_skb(struct ltq_etop_chan *ch) + { +- ch->skb[ch->dma.desc] = netdev_alloc_skb(ch->netdev, MAX_DMA_DATA_LEN); ++ ch->skb[ch->dma.desc] = dev_alloc_skb(MAX_DMA_DATA_LEN); + if (!ch->skb[ch->dma.desc]) + return -ENOMEM; + ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL, +@@ -147,8 +212,11 @@ ltq_etop_hw_receive(struct ltq_etop_chan + spin_unlock_irqrestore(&priv->lock, flags); + + skb_put(skb, len); ++ skb->dev = ch->netdev; + skb->protocol = eth_type_trans(skb, ch->netdev); + netif_receive_skb(skb); ++ ch->netdev->stats.rx_packets++; ++ ch->netdev->stats.rx_bytes += len; + } + + static int +@@ -156,7 +224,9 @@ ltq_etop_poll_rx(struct napi_struct *nap + { + struct ltq_etop_chan *ch = container_of(napi, + struct ltq_etop_chan, napi); ++ struct ltq_etop_priv *priv = netdev_priv(ch->netdev); + int work_done = 0; ++ unsigned long flags; + + while (work_done < budget) { + struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; +@@ -168,7 +238,9 @@ ltq_etop_poll_rx(struct napi_struct *nap + } + if (work_done < budget) { + napi_complete_done(&ch->napi, work_done); ++ spin_lock_irqsave(&priv->lock, flags); + ltq_dma_ack_irq(&ch->dma); ++ spin_unlock_irqrestore(&priv->lock, flags); + } + return work_done; + } +@@ -180,12 +252,14 @@ ltq_etop_poll_tx(struct napi_struct *nap + container_of(napi, struct ltq_etop_chan, napi); + struct ltq_etop_priv *priv = netdev_priv(ch->netdev); + struct netdev_queue *txq = +- netdev_get_tx_queue(ch->netdev, ch->idx >> 1); ++ netdev_get_tx_queue(ch->netdev, ch->dma.nr >> 1); + unsigned long flags; + + spin_lock_irqsave(&priv->lock, flags); + while ((ch->dma.desc_base[ch->tx_free].ctl & + (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) { ++ ch->netdev->stats.tx_packets++; ++ ch->netdev->stats.tx_bytes += ch->skb[ch->tx_free]->len; + dev_kfree_skb_any(ch->skb[ch->tx_free]); + ch->skb[ch->tx_free] = NULL; + memset(&ch->dma.desc_base[ch->tx_free], 0, +@@ -198,7 +272,9 @@ ltq_etop_poll_tx(struct napi_struct *nap + if (netif_tx_queue_stopped(txq)) + netif_tx_start_queue(txq); + napi_complete(&ch->napi); ++ spin_lock_irqsave(&priv->lock, flags); + ltq_dma_ack_irq(&ch->dma); ++ spin_unlock_irqrestore(&priv->lock, flags); + return 1; + } + +@@ -206,9 +282,10 @@ static irqreturn_t + ltq_etop_dma_irq(int irq, void *_priv) + { + struct ltq_etop_priv *priv = _priv; +- int ch = irq - LTQ_DMA_CH0_INT; +- +- napi_schedule(&priv->ch[ch].napi); ++ if (irq == priv->txch.dma.irq) ++ napi_schedule(&priv->txch.napi); ++ else ++ napi_schedule(&priv->rxch.napi); + return IRQ_HANDLED; + } + +@@ -220,7 +297,7 @@ ltq_etop_free_channel(struct net_device + ltq_dma_free(&ch->dma); + if (ch->dma.irq) + free_irq(ch->dma.irq, priv); +- if (IS_RX(ch->idx)) { ++ if (ch == &priv->txch) { + int desc; + for (desc = 0; desc < LTQ_DESC_NUM; desc++) + dev_kfree_skb_any(ch->skb[ch->dma.desc]); +@@ -231,65 +308,133 @@ static void + ltq_etop_hw_exit(struct net_device *dev) + { + struct ltq_etop_priv *priv = netdev_priv(dev); +- int i; + +- ltq_pmu_disable(PMU_PPE); +- for (i = 0; i < MAX_DMA_CHAN; i++) +- if (IS_TX(i) || IS_RX(i)) +- ltq_etop_free_channel(dev, &priv->ch[i]); ++ clk_disable(priv->clk_ppe); ++ ++ if (of_machine_is_compatible("lantiq,ar9")) ++ clk_disable(priv->clk_switch); ++ ++ if (of_machine_is_compatible("lantiq,ase")) { ++ clk_disable(priv->clk_ephy); ++ clk_disable(priv->clk_ephycgu); ++ } ++ ++ ltq_etop_free_channel(dev, &priv->txch); ++ ltq_etop_free_channel(dev, &priv->rxch); ++} ++ ++static void ++ltq_etop_gbit_init(struct net_device *dev) ++{ ++ struct ltq_etop_priv *priv = netdev_priv(dev); ++ ++ clk_enable(priv->clk_switch); ++ ++ /* enable gbit port0 on the SoC */ ++ ltq_gbit_w32_mask((1 << 17), (1 << 18), LTQ_GBIT_P0_CTL); ++ ++ ltq_gbit_w32_mask(0, GCTL0_SE, LTQ_GBIT_GCTL0); ++ /* disable MDIO auto polling mode */ ++ ltq_gbit_w32_mask(0, PX_CTL_DMDIO, LTQ_GBIT_P0_CTL); ++ /* set 1522 packet size */ ++ ltq_gbit_w32_mask(0x300, 0, LTQ_GBIT_GCTL0); ++ /* disable pmac & dmac headers */ ++ ltq_gbit_w32_mask(PMAC_HD_CTL_AS | PMAC_HD_CTL_RXSH, 0, ++ LTQ_GBIT_PMAC_HD_CTL); ++ /* Due to traffic halt when burst length 8, ++ replace default IPG value with 0x3B */ ++ ltq_gbit_w32(0x3B, LTQ_GBIT_PMAC_RX_IPG); ++ /* set mdc clock to 2.5 MHz */ ++ ltq_gbit_w32_mask(MDC_CLOCK_MASK, 4 << MDC_CLOCK_OFFSET, ++ LTQ_GBIT_RGMII_CTL); + } + + static int + ltq_etop_hw_init(struct net_device *dev) + { + struct ltq_etop_priv *priv = netdev_priv(dev); +- int i; ++ int mii_mode = priv->mii_mode; ++ ++ clk_enable(priv->clk_ppe); + +- ltq_pmu_enable(PMU_PPE); ++ if (of_machine_is_compatible("lantiq,ar9")) { ++ ltq_etop_gbit_init(dev); ++ /* force the etops link to the gbit to MII */ ++ mii_mode = PHY_INTERFACE_MODE_MII; ++ } ++ ltq_etop_w32_mask(MDIO_CFG_MASK, 0, LTQ_ETOP_MDIO_CFG); ++ ltq_etop_w32_mask(MAC_CFG_MASK, MAC_CFG_CGEN | MAC_CFG_DUPLEX | ++ MAC_CFG_SPEED | MAC_CFG_LINK, LTQ_ETOP_MAC_CFG); + +- switch (priv->pldata->mii_mode) { ++ switch (mii_mode) { + case PHY_INTERFACE_MODE_RMII: +- ltq_etop_w32_mask(ETOP_MII_MASK, +- ETOP_MII_REVERSE, LTQ_ETOP_CFG); ++ ltq_etop_w32_mask(ETOP_CFG_MASK, ETOP_CFG_REMII0 | ETOP_CFG_OFF1 | ++ ETOP_CFG_SEN0 | ETOP_CFG_FEN0, LTQ_ETOP_CFG); + break; + + case PHY_INTERFACE_MODE_MII: +- ltq_etop_w32_mask(ETOP_MII_MASK, +- ETOP_MII_NORMAL, LTQ_ETOP_CFG); ++ ltq_etop_w32_mask(ETOP_CFG_MASK, ETOP_CFG_OFF1 | ++ ETOP_CFG_SEN0 | ETOP_CFG_FEN0, LTQ_ETOP_CFG); + break; + + default: ++ if (of_machine_is_compatible("lantiq,ase")) { ++ clk_enable(priv->clk_ephy); ++ /* disable external MII */ ++ ltq_etop_w32_mask(0, ETOP_CFG_MII0, LTQ_ETOP_CFG); ++ /* enable clock for internal PHY */ ++ clk_enable(priv->clk_ephycgu); ++ /* we need to write this magic to the internal phy to ++ make it work */ ++ ltq_etop_mdio_wr(NULL, 0x8, 0x12, 0xC020); ++ pr_info("Selected EPHY mode\n"); ++ break; ++ } + netdev_err(dev, "unknown mii mode %d\n", +- priv->pldata->mii_mode); ++ mii_mode); + return -ENOTSUPP; + } + +- /* enable crc generation */ +- ltq_etop_w32(PPE32_CGEN, LQ_PPE32_ENET_MAC_CFG); ++ return 0; ++} ++ ++static int ++ltq_etop_dma_init(struct net_device *dev) ++{ ++ struct ltq_etop_priv *priv = netdev_priv(dev); ++ int tx = priv->tx_irq - LTQ_DMA_ETOP; ++ int rx = priv->rx_irq - LTQ_DMA_ETOP; ++ int err; + + ltq_dma_init_port(DMA_PORT_ETOP); + +- for (i = 0; i < MAX_DMA_CHAN; i++) { +- int irq = LTQ_DMA_CH0_INT + i; +- struct ltq_etop_chan *ch = &priv->ch[i]; +- +- ch->idx = ch->dma.nr = i; +- +- if (IS_TX(i)) { +- ltq_dma_alloc_tx(&ch->dma); +- request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv); +- } else if (IS_RX(i)) { +- ltq_dma_alloc_rx(&ch->dma); +- for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; +- ch->dma.desc++) +- if (ltq_etop_alloc_skb(ch)) +- return -ENOMEM; +- ch->dma.desc = 0; +- request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv); ++ priv->txch.dma.nr = tx; ++ ltq_dma_alloc_tx(&priv->txch.dma); ++ err = request_irq(priv->tx_irq, ltq_etop_dma_irq, 0, "eth_tx", priv); ++ if (err) { ++ netdev_err(dev, "failed to allocate tx irq\n"); ++ goto err_out; ++ } ++ priv->txch.dma.irq = priv->tx_irq; ++ ++ priv->rxch.dma.nr = rx; ++ ltq_dma_alloc_rx(&priv->rxch.dma); ++ for (priv->rxch.dma.desc = 0; priv->rxch.dma.desc < LTQ_DESC_NUM; ++ priv->rxch.dma.desc++) { ++ if (ltq_etop_alloc_skb(&priv->rxch)) { ++ netdev_err(dev, "failed to allocate skbs\n"); ++ err = -ENOMEM; ++ goto err_out; + } +- ch->dma.irq = irq; + } +- return 0; ++ priv->rxch.dma.desc = 0; ++ err = request_irq(priv->rx_irq, ltq_etop_dma_irq, 0, "eth_rx", priv); ++ if (err) ++ netdev_err(dev, "failed to allocate rx irq\n"); ++ else ++ priv->rxch.dma.irq = priv->rx_irq; ++err_out: ++ return err; + } + + static void +@@ -303,7 +448,10 @@ ltq_etop_get_drvinfo(struct net_device * + static int + ltq_etop_nway_reset(struct net_device *dev) + { +- return phy_start_aneg(dev->phydev); ++ if (dev->phydev) ++ return phy_start_aneg(dev->phydev); ++ else ++ return 0; + } + + static const struct ethtool_ops ltq_etop_ethtool_ops = { +@@ -314,6 +462,39 @@ static const struct ethtool_ops ltq_etop + }; + + static int ++ltq_etop_mdio_wr_xr9(struct mii_bus *bus, int phy_addr, ++ int phy_reg, u16 phy_data) ++{ ++ u32 val = MDIO_XR9_REQUEST | MDIO_XR9_WRITE | ++ (phy_data << MDIO_XR9_WR_OFFSET) | ++ ((phy_addr & MDIO_XR9_ADDR_MASK) << MDIO_XR9_ADDR_OFFSET) | ++ ((phy_reg & MDIO_XR9_REG_MASK) << MDIO_XR9_REG_OFFSET); ++ ++ while (ltq_gbit_r32(LTQ_GBIT_MDIO_CTL) & MDIO_XR9_REQUEST) ++ ; ++ ltq_gbit_w32(val, LTQ_GBIT_MDIO_CTL); ++ while (ltq_gbit_r32(LTQ_GBIT_MDIO_CTL) & MDIO_XR9_REQUEST) ++ ; ++ return 0; ++} ++ ++static int ++ltq_etop_mdio_rd_xr9(struct mii_bus *bus, int phy_addr, int phy_reg) ++{ ++ u32 val = MDIO_XR9_REQUEST | MDIO_XR9_READ | ++ ((phy_addr & MDIO_XR9_ADDR_MASK) << MDIO_XR9_ADDR_OFFSET) | ++ ((phy_reg & MDIO_XR9_REG_MASK) << MDIO_XR9_REG_OFFSET); ++ ++ while (ltq_gbit_r32(LTQ_GBIT_MDIO_CTL) & MDIO_XR9_REQUEST) ++ ; ++ ltq_gbit_w32(val, LTQ_GBIT_MDIO_CTL); ++ while (ltq_gbit_r32(LTQ_GBIT_MDIO_CTL) & MDIO_XR9_REQUEST) ++ ; ++ val = ltq_gbit_r32(LTQ_GBIT_MDIO_DATA) & MDIO_XR9_RD_MASK; ++ return val; ++} ++ ++static int + ltq_etop_mdio_wr(struct mii_bus *bus, int phy_addr, int phy_reg, u16 phy_data) + { + u32 val = MDIO_REQUEST | +@@ -321,9 +502,9 @@ ltq_etop_mdio_wr(struct mii_bus *bus, in + ((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET) | + phy_data; + +- while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST) ++ while (ltq_etop_r32(LTQ_ETOP_MDIO_ACC) & MDIO_REQUEST) + ; +- ltq_etop_w32(val, LTQ_ETOP_MDIO); ++ ltq_etop_w32(val, LTQ_ETOP_MDIO_ACC); + return 0; + } + +@@ -334,12 +515,12 @@ ltq_etop_mdio_rd(struct mii_bus *bus, in + ((phy_addr & MDIO_ADDR_MASK) << MDIO_ADDR_OFFSET) | + ((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET); + +- while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST) ++ while (ltq_etop_r32(LTQ_ETOP_MDIO_ACC) & MDIO_REQUEST) + ; +- ltq_etop_w32(val, LTQ_ETOP_MDIO); +- while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST) ++ ltq_etop_w32(val, LTQ_ETOP_MDIO_ACC); ++ while (ltq_etop_r32(LTQ_ETOP_MDIO_ACC) & MDIO_REQUEST) + ; +- val = ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_VAL_MASK; ++ val = ltq_etop_r32(LTQ_ETOP_MDIO_ACC) & MDIO_VAL_MASK; + return val; + } + +@@ -354,8 +535,18 @@ ltq_etop_mdio_probe(struct net_device *d + { + struct ltq_etop_priv *priv = netdev_priv(dev); + struct phy_device *phydev; ++ u32 phy_supported = (SUPPORTED_10baseT_Half ++ | SUPPORTED_10baseT_Full ++ | SUPPORTED_100baseT_Half ++ | SUPPORTED_100baseT_Full ++ | SUPPORTED_Autoneg ++ | SUPPORTED_MII ++ | SUPPORTED_TP); + +- phydev = phy_find_first(priv->mii_bus); ++ if (of_machine_is_compatible("lantiq,ase")) ++ phydev = mdiobus_get_phy(priv->mii_bus, 8); ++ else ++ phydev = mdiobus_get_phy(priv->mii_bus, 0); + + if (!phydev) { + netdev_err(dev, "no PHY found\n"); +@@ -363,21 +554,18 @@ ltq_etop_mdio_probe(struct net_device *d + } + + phydev = phy_connect(dev, phydev_name(phydev), +- <q_etop_mdio_link, priv->pldata->mii_mode); ++ <q_etop_mdio_link, priv->mii_mode); + + if (IS_ERR(phydev)) { + netdev_err(dev, "Could not attach to PHY\n"); + return PTR_ERR(phydev); + } + +- phydev->supported &= (SUPPORTED_10baseT_Half +- | SUPPORTED_10baseT_Full +- | SUPPORTED_100baseT_Half +- | SUPPORTED_100baseT_Full +- | SUPPORTED_Autoneg +- | SUPPORTED_MII +- | SUPPORTED_TP); ++ if (of_machine_is_compatible("lantiq,ar9")) ++ phy_supported |= SUPPORTED_1000baseT_Half ++ | SUPPORTED_1000baseT_Full; + ++ phydev->supported &= phy_supported; + phydev->advertising = phydev->supported; + phy_attached_info(phydev); + +@@ -398,8 +586,13 @@ ltq_etop_mdio_init(struct net_device *de + } + + priv->mii_bus->priv = dev; +- priv->mii_bus->read = ltq_etop_mdio_rd; +- priv->mii_bus->write = ltq_etop_mdio_wr; ++ if (of_machine_is_compatible("lantiq,ar9")) { ++ priv->mii_bus->read = ltq_etop_mdio_rd_xr9; ++ priv->mii_bus->write = ltq_etop_mdio_wr_xr9; ++ } else { ++ priv->mii_bus->read = ltq_etop_mdio_rd; ++ priv->mii_bus->write = ltq_etop_mdio_wr; ++ } + priv->mii_bus->name = "ltq_mii"; + snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", + priv->pdev->name, priv->pdev->id); +@@ -436,17 +629,19 @@ static int + ltq_etop_open(struct net_device *dev) + { + struct ltq_etop_priv *priv = netdev_priv(dev); +- int i; ++ unsigned long flags; + +- for (i = 0; i < MAX_DMA_CHAN; i++) { +- struct ltq_etop_chan *ch = &priv->ch[i]; ++ napi_enable(&priv->txch.napi); ++ napi_enable(&priv->rxch.napi); ++ ++ spin_lock_irqsave(&priv->lock, flags); ++ ltq_dma_open(&priv->txch.dma); ++ ltq_dma_open(&priv->rxch.dma); ++ spin_unlock_irqrestore(&priv->lock, flags); ++ ++ if (dev->phydev) ++ phy_start(dev->phydev); + +- if (!IS_TX(i) && (!IS_RX(i))) +- continue; +- ltq_dma_open(&ch->dma); +- napi_enable(&ch->napi); +- } +- phy_start(dev->phydev); + netif_tx_start_all_queues(dev); + return 0; + } +@@ -455,18 +650,19 @@ static int + ltq_etop_stop(struct net_device *dev) + { + struct ltq_etop_priv *priv = netdev_priv(dev); +- int i; ++ unsigned long flags; + + netif_tx_stop_all_queues(dev); +- phy_stop(dev->phydev); +- for (i = 0; i < MAX_DMA_CHAN; i++) { +- struct ltq_etop_chan *ch = &priv->ch[i]; +- +- if (!IS_RX(i) && !IS_TX(i)) +- continue; +- napi_disable(&ch->napi); +- ltq_dma_close(&ch->dma); +- } ++ if (dev->phydev) ++ phy_stop(dev->phydev); ++ napi_disable(&priv->txch.napi); ++ napi_disable(&priv->rxch.napi); ++ ++ spin_lock_irqsave(&priv->lock, flags); ++ ltq_dma_close(&priv->txch.dma); ++ ltq_dma_close(&priv->rxch.dma); ++ spin_unlock_irqrestore(&priv->lock, flags); ++ + return 0; + } + +@@ -476,16 +672,16 @@ ltq_etop_tx(struct sk_buff *skb, struct + int queue = skb_get_queue_mapping(skb); + struct netdev_queue *txq = netdev_get_tx_queue(dev, queue); + struct ltq_etop_priv *priv = netdev_priv(dev); +- struct ltq_etop_chan *ch = &priv->ch[(queue << 1) | 1]; +- struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; +- int len; ++ struct ltq_dma_desc *desc = ++ &priv->txch.dma.desc_base[priv->txch.dma.desc]; + unsigned long flags; + u32 byte_offset; ++ int len; + + len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; + +- if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { +- dev_kfree_skb_any(skb); ++ if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ++ priv->txch.skb[priv->txch.dma.desc]) { + netdev_err(dev, "tx ring full\n"); + netif_tx_stop_queue(txq); + return NETDEV_TX_BUSY; +@@ -493,7 +689,7 @@ ltq_etop_tx(struct sk_buff *skb, struct + + /* dma needs to start on a 16 byte aligned address */ + byte_offset = CPHYSADDR(skb->data) % 16; +- ch->skb[ch->dma.desc] = skb; ++ priv->txch.skb[priv->txch.dma.desc] = skb; + + netif_trans_update(dev); + +@@ -503,11 +699,11 @@ ltq_etop_tx(struct sk_buff *skb, struct + wmb(); + desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP | + LTQ_DMA_TX_OFFSET(byte_offset) | (len & LTQ_DMA_SIZE_MASK); +- ch->dma.desc++; +- ch->dma.desc %= LTQ_DESC_NUM; ++ priv->txch.dma.desc++; ++ priv->txch.dma.desc %= LTQ_DESC_NUM; + spin_unlock_irqrestore(&priv->lock, flags); + +- if (ch->dma.desc_base[ch->dma.desc].ctl & LTQ_DMA_OWN) ++ if (priv->txch.dma.desc_base[priv->txch.dma.desc].ctl & LTQ_DMA_OWN) + netif_tx_stop_queue(txq); + + return NETDEV_TX_OK; +@@ -522,8 +718,10 @@ ltq_etop_change_mtu(struct net_device *d + struct ltq_etop_priv *priv = netdev_priv(dev); + unsigned long flags; + ++ int max = ETH_HLEN + VLAN_HLEN + new_mtu + ETH_FCS_LEN; ++ + spin_lock_irqsave(&priv->lock, flags); +- ltq_etop_w32((ETOP_PLEN_UNDER << 16) | new_mtu, ++ ltq_etop_w32((ETOP_PLEN_UNDER << 16) | max, + LTQ_ETOP_IGPLEN); + spin_unlock_irqrestore(&priv->lock, flags); + } +@@ -592,6 +790,9 @@ ltq_etop_init(struct net_device *dev) + if (err) + goto err_hw; + ltq_etop_change_mtu(dev, 1500); ++ err = ltq_etop_dma_init(dev); ++ if (err) ++ goto err_hw; + + memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr)); + if (!is_valid_ether_addr(mac.sa_data)) { +@@ -609,9 +810,10 @@ ltq_etop_init(struct net_device *dev) + dev->addr_assign_type = NET_ADDR_RANDOM; + + ltq_etop_set_multicast_list(dev); +- err = ltq_etop_mdio_init(dev); +- if (err) +- goto err_netdev; ++ if (!ltq_etop_mdio_init(dev)) ++ dev->ethtool_ops = <q_etop_ethtool_ops; ++ else ++ pr_warn("etop: mdio probe failed\n");; + return 0; + + err_netdev: +@@ -631,6 +833,9 @@ ltq_etop_tx_timeout(struct net_device *d + err = ltq_etop_hw_init(dev); + if (err) + goto err_hw; ++ err = ltq_etop_dma_init(dev); ++ if (err) ++ goto err_hw; + netif_trans_update(dev); + netif_wake_queue(dev); + return; +@@ -654,14 +859,19 @@ static const struct net_device_ops ltq_e + .ndo_tx_timeout = ltq_etop_tx_timeout, + }; + +-static int __init +-ltq_etop_probe(struct platform_device *pdev) ++static int ltq_etop_probe(struct platform_device *pdev) + { + struct net_device *dev; + struct ltq_etop_priv *priv; +- struct resource *res; ++ struct resource *res, *gbit_res, irqres[2]; ++ const u8 *mac; + int err; +- int i; ++ ++ err = of_irq_to_resource_table(pdev->dev.of_node, irqres, 2); ++ if (err != 2) { ++ dev_err(&pdev->dev, "failed to get etop irqs\n"); ++ return -EINVAL; ++ } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { +@@ -687,31 +897,62 @@ ltq_etop_probe(struct platform_device *p + goto err_out; + } + +- dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4); +- if (!dev) { +- err = -ENOMEM; +- goto err_out; ++ if (of_machine_is_compatible("lantiq,ar9")) { ++ gbit_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ++ if (!gbit_res) { ++ dev_err(&pdev->dev, "failed to get gbit resource\n"); ++ err = -ENOENT; ++ goto err_out; ++ } ++ ltq_gbit_membase = devm_ioremap_nocache(&pdev->dev, ++ gbit_res->start, resource_size(gbit_res)); ++ if (!ltq_gbit_membase) { ++ dev_err(&pdev->dev, "failed to remap gigabit switch %d\n", ++ pdev->id); ++ err = -ENOMEM; ++ goto err_out; ++ } + } ++ ++ dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4); + strcpy(dev->name, "eth%d"); + dev->netdev_ops = <q_eth_netdev_ops; +- dev->ethtool_ops = <q_etop_ethtool_ops; + priv = netdev_priv(dev); + priv->res = res; + priv->pdev = pdev; +- priv->pldata = dev_get_platdata(&pdev->dev); + priv->netdev = dev; ++ priv->tx_irq = irqres[0].start; ++ priv->rx_irq = irqres[1].start; ++ priv->mii_mode = of_get_phy_mode(pdev->dev.of_node); ++ ++ mac = of_get_mac_address(pdev->dev.of_node); ++ if (mac) ++ memcpy(priv->mac, mac, ETH_ALEN); ++ ++ priv->clk_ppe = clk_get(&pdev->dev, NULL); ++ if (IS_ERR(priv->clk_ppe)) ++ return PTR_ERR(priv->clk_ppe); ++ if (of_machine_is_compatible("lantiq,ar9")) { ++ priv->clk_switch = clk_get(&pdev->dev, "switch"); ++ if (IS_ERR(priv->clk_switch)) ++ return PTR_ERR(priv->clk_switch); ++ } ++ if (of_machine_is_compatible("lantiq,ase")) { ++ priv->clk_ephy = clk_get(&pdev->dev, "ephy"); ++ if (IS_ERR(priv->clk_ephy)) ++ return PTR_ERR(priv->clk_ephy); ++ priv->clk_ephycgu = clk_get(&pdev->dev, "ephycgu"); ++ if (IS_ERR(priv->clk_ephycgu)) ++ return PTR_ERR(priv->clk_ephycgu); ++ } ++ + spin_lock_init(&priv->lock); + SET_NETDEV_DEV(dev, &pdev->dev); + +- for (i = 0; i < MAX_DMA_CHAN; i++) { +- if (IS_TX(i)) +- netif_napi_add(dev, &priv->ch[i].napi, +- ltq_etop_poll_tx, 8); +- else if (IS_RX(i)) +- netif_napi_add(dev, &priv->ch[i].napi, +- ltq_etop_poll_rx, 32); +- priv->ch[i].netdev = dev; +- } ++ netif_napi_add(dev, &priv->txch.napi, ltq_etop_poll_tx, 8); ++ netif_napi_add(dev, &priv->rxch.napi, ltq_etop_poll_rx, 32); ++ priv->txch.netdev = dev; ++ priv->rxch.netdev = dev; + + err = register_netdev(dev); + if (err) +@@ -740,31 +981,22 @@ ltq_etop_remove(struct platform_device * + return 0; + } + ++static const struct of_device_id ltq_etop_match[] = { ++ { .compatible = "lantiq,etop-xway" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ltq_etop_match); ++ + static struct platform_driver ltq_mii_driver = { ++ .probe = ltq_etop_probe, + .remove = ltq_etop_remove, + .driver = { + .name = "ltq_etop", ++ .of_match_table = ltq_etop_match, + }, + }; + +-int __init +-init_ltq_etop(void) +-{ +- int ret = platform_driver_probe(<q_mii_driver, ltq_etop_probe); +- +- if (ret) +- pr_err("ltq_etop: Error registering platform driver!"); +- return ret; +-} +- +-static void __exit +-exit_ltq_etop(void) +-{ +- platform_driver_unregister(<q_mii_driver); +-} +- +-module_init(init_ltq_etop); +-module_exit(exit_ltq_etop); ++module_platform_driver(ltq_mii_driver); + + MODULE_AUTHOR("John Crispin "); + MODULE_DESCRIPTION("Lantiq SoC ETOP"); diff --git a/target/linux/ipq806x/patches-4.9/0066-GPIO-add-named-gpio-exports.patch b/target/linux/lantiq/patches-4.9/0030-GPIO-add-named-gpio-exports.patch similarity index 90% rename from target/linux/ipq806x/patches-4.9/0066-GPIO-add-named-gpio-exports.patch rename to target/linux/lantiq/patches-4.9/0030-GPIO-add-named-gpio-exports.patch index 4aa80007d..e2a421b27 100644 --- a/target/linux/ipq806x/patches-4.9/0066-GPIO-add-named-gpio-exports.patch +++ b/target/linux/lantiq/patches-4.9/0030-GPIO-add-named-gpio-exports.patch @@ -1,15 +1,15 @@ -From a37b0c9113647b2120cf1a18cfc46afdb3f1fccc Mon Sep 17 00:00:00 2001 +From cc809a441d8f2924f785eb863dfa6aef47a25b0b Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 12 Aug 2014 20:49:27 +0200 -Subject: [PATCH 66/69] GPIO: add named gpio exports +Subject: [PATCH 30/36] 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(-) + drivers/gpio/gpiolib-of.c | 68 +++++++++++++++++++++++++++++++++++++++++ + drivers/gpio/gpiolib.c | 11 +++++-- + include/asm-generic/gpio.h | 5 +++ + include/linux/gpio/consumer.h | 8 +++++ + 4 files changed, 90 insertions(+), 2 deletions(-) --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -22,11 +22,13 @@ Signed-off-by: John Crispin #include "gpiolib.h" -@@ -538,3 +540,69 @@ void of_gpiochip_remove(struct gpio_chip +@@ -538,3 +540,73 @@ void of_gpiochip_remove(struct gpio_chip gpiochip_remove_pin_ranges(chip); of_node_put(chip->of_node); } + ++#ifdef CONFIG_GPIO_SYSFS ++ +static struct of_device_id gpio_export_ids[] = { + { .compatible = "gpio-export" }, + { /* sentinel */ } @@ -92,39 +94,8 @@ Signed-off-by: John Crispin + 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 gpio_device *gdev; -@@ -606,6 +606,8 @@ int gpiod_export(struct gpio_desc *desc, - offset = gpio_chip_hwgpio(desc); - if (chip->names && chip->names[offset]) - ioname = chip->names[offset]; -+ if (name) -+ ioname = name; - - dev = device_create_with_groups(&gpio_class, &gdev->dev, - MKDEV(0, 0), data, gpio_groups, -@@ -627,6 +629,12 @@ err_unlock: - gpiod_dbg(desc, "%s: status %d\n", __func__, status); - return status; - } -+EXPORT_SYMBOL_GPL(__gpiod_export); + -+int gpiod_export(struct gpio_desc *desc, bool direction_may_change) -+{ -+ return __gpiod_export(desc, direction_may_change, NULL); -+} - EXPORT_SYMBOL_GPL(gpiod_export); - - static int match_export(struct device *dev, const void *desc) ++#endif --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -126,6 +126,12 @@ static inline int gpio_export(unsigned g @@ -164,3 +135,36 @@ Signed-off-by: John Crispin static inline int gpiod_export(struct gpio_desc *desc, bool direction_may_change) { +--- a/drivers/gpio/gpiolib-sysfs.c ++++ b/drivers/gpio/gpiolib-sysfs.c +@@ -544,7 +544,7 @@ static struct class gpio_class = { + * + * Returns zero on success, else an error. + */ +-int gpiod_export(struct gpio_desc *desc, bool direction_may_change) ++int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name) + { + struct gpio_chip *chip; + struct gpio_device *gdev; +@@ -606,6 +606,8 @@ int gpiod_export(struct gpio_desc *desc, + offset = gpio_chip_hwgpio(desc); + if (chip->names && chip->names[offset]) + ioname = chip->names[offset]; ++ if (name) ++ ioname = name; + + dev = device_create_with_groups(&gpio_class, &gdev->dev, + MKDEV(0, 0), data, gpio_groups, +@@ -627,6 +629,12 @@ err_unlock: + gpiod_dbg(desc, "%s: status %d\n", __func__, status); + return status; + } ++EXPORT_SYMBOL_GPL(__gpiod_export); ++ ++int gpiod_export(struct gpio_desc *desc, bool direction_may_change) ++{ ++ return __gpiod_export(desc, direction_may_change, NULL); ++} + EXPORT_SYMBOL_GPL(gpiod_export); + + static int match_export(struct device *dev, const void *desc) diff --git a/target/linux/lantiq/patches-4.9/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-4.9/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch new file mode 100644 index 000000000..c275b55ef --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch @@ -0,0 +1,1034 @@ +From f17e50f67fa3c77624edf2ca03fae0d50f0ce39b Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 7 Aug 2014 18:26:42 +0200 +Subject: [PATCH 31/36] I2C: MIPS: lantiq: add FALC-ON i2c bus master + +This patch adds the driver needed to make the I2C bus work on FALC-ON SoCs. + +Signed-off-by: Thomas Langer +Signed-off-by: John Crispin +--- + drivers/i2c/busses/Kconfig | 10 + + drivers/i2c/busses/Makefile | 1 + + drivers/i2c/busses/i2c-lantiq.c | 747 +++++++++++++++++++++++++++++++++++++++ + drivers/i2c/busses/i2c-lantiq.h | 234 ++++++++++++ + 4 files changed, 992 insertions(+) + create mode 100644 drivers/i2c/busses/i2c-lantiq.c + create mode 100644 drivers/i2c/busses/i2c-lantiq.h + +--- a/drivers/i2c/busses/Kconfig ++++ b/drivers/i2c/busses/Kconfig +@@ -643,6 +643,16 @@ config I2C_MESON + If you say yes to this option, support will be included for the + I2C interface on the Amlogic Meson family of SoCs. + ++config I2C_LANTIQ ++ tristate "Lantiq I2C interface" ++ depends on LANTIQ && SOC_FALCON ++ help ++ If you say yes to this option, support will be included for the ++ Lantiq I2C core. ++ ++ This driver can also be built as a module. If so, the module ++ will be called i2c-lantiq. ++ + config I2C_MPC + tristate "MPC107/824x/85xx/512x/52xx/83xx/86xx" + depends on PPC +--- a/drivers/i2c/busses/Makefile ++++ b/drivers/i2c/busses/Makefile +@@ -59,6 +59,7 @@ obj-$(CONFIG_I2C_IMX) += i2c-imx.o + obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o + obj-$(CONFIG_I2C_JZ4780) += i2c-jz4780.o + obj-$(CONFIG_I2C_KEMPLD) += i2c-kempld.o ++obj-$(CONFIG_I2C_LANTIQ) += i2c-lantiq.o + obj-$(CONFIG_I2C_LPC2K) += i2c-lpc2k.o + obj-$(CONFIG_I2C_MESON) += i2c-meson.o + obj-$(CONFIG_I2C_MPC) += i2c-mpc.o +--- /dev/null ++++ b/drivers/i2c/busses/i2c-lantiq.c +@@ -0,0 +1,747 @@ ++ ++/* ++ * Lantiq I2C bus adapter ++ * ++ * Parts based on i2c-designware.c and other i2c drivers from Linux 2.6.33 ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ * Copyright (C) 2012 Thomas Langer ++ */ ++ ++#include ++#include ++#include ++#include /* for kzalloc, kfree */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "i2c-lantiq.h" ++ ++/* ++ * CURRENT ISSUES: ++ * - no high speed support ++ * - ten bit mode is not tested (no slave devices) ++ */ ++ ++/* access macros */ ++#define i2c_r32(reg) \ ++ __raw_readl(&(priv->membase)->reg) ++#define i2c_w32(val, reg) \ ++ __raw_writel(val, &(priv->membase)->reg) ++#define i2c_w32_mask(clear, set, reg) \ ++ i2c_w32((i2c_r32(reg) & ~(clear)) | (set), reg) ++ ++#define DRV_NAME "i2c-lantiq" ++#define DRV_VERSION "1.00" ++ ++#define LTQ_I2C_BUSY_TIMEOUT 20 /* ms */ ++ ++#ifdef DEBUG ++#define LTQ_I2C_XFER_TIMEOUT (25*HZ) ++#else ++#define LTQ_I2C_XFER_TIMEOUT HZ ++#endif ++ ++#define LTQ_I2C_IMSC_DEFAULT_MASK (I2C_IMSC_I2C_P_INT_EN | \ ++ I2C_IMSC_I2C_ERR_INT_EN) ++ ++#define LTQ_I2C_ARB_LOST (1 << 0) ++#define LTQ_I2C_NACK (1 << 1) ++#define LTQ_I2C_RX_UFL (1 << 2) ++#define LTQ_I2C_RX_OFL (1 << 3) ++#define LTQ_I2C_TX_UFL (1 << 4) ++#define LTQ_I2C_TX_OFL (1 << 5) ++ ++struct ltq_i2c { ++ struct mutex mutex; ++ ++ ++ /* active clock settings */ ++ unsigned int input_clock; /* clock input for i2c hardware block */ ++ unsigned int i2c_clock; /* approximated bus clock in kHz */ ++ ++ struct clk *clk_gate; ++ struct clk *clk_input; ++ ++ ++ /* resources (memory and interrupts) */ ++ int irq_lb; /* last burst irq */ ++ ++ struct lantiq_reg_i2c __iomem *membase; /* base of mapped registers */ ++ ++ struct i2c_adapter adap; ++ struct device *dev; ++ ++ struct completion cmd_complete; ++ ++ ++ /* message transfer data */ ++ struct i2c_msg *current_msg; /* current message */ ++ int msgs_num; /* number of messages to handle */ ++ u8 *msg_buf; /* current buffer */ ++ u32 msg_buf_len; /* remaining length of current buffer */ ++ int msg_err; /* error status of the current transfer */ ++ ++ ++ /* master status codes */ ++ enum { ++ STATUS_IDLE, ++ STATUS_ADDR, /* address phase */ ++ STATUS_WRITE, ++ STATUS_READ, ++ STATUS_READ_END, ++ STATUS_STOP ++ } status; ++}; ++ ++static irqreturn_t ltq_i2c_isr(int irq, void *dev_id); ++ ++static inline void enable_burst_irq(struct ltq_i2c *priv) ++{ ++ i2c_w32_mask(0, I2C_IMSC_LBREQ_INT_EN | I2C_IMSC_BREQ_INT_EN, imsc); ++} ++static inline void disable_burst_irq(struct ltq_i2c *priv) ++{ ++ i2c_w32_mask(I2C_IMSC_LBREQ_INT_EN | I2C_IMSC_BREQ_INT_EN, 0, imsc); ++} ++ ++static void prepare_msg_send_addr(struct ltq_i2c *priv) ++{ ++ struct i2c_msg *msg = priv->current_msg; ++ int rd = !!(msg->flags & I2C_M_RD); /* extends to 0 or 1 */ ++ u16 addr = msg->addr; ++ ++ /* new i2c_msg */ ++ priv->msg_buf = msg->buf; ++ priv->msg_buf_len = msg->len; ++ if (rd) ++ priv->status = STATUS_READ; ++ else ++ priv->status = STATUS_WRITE; ++ ++ /* send slave address */ ++ if (msg->flags & I2C_M_TEN) { ++ i2c_w32(0xf0 | ((addr & 0x300) >> 7) | rd, txd); ++ i2c_w32(addr & 0xff, txd); ++ } else { ++ i2c_w32((addr & 0x7f) << 1 | rd, txd); ++ } ++} ++ ++static void ltq_i2c_set_tx_len(struct ltq_i2c *priv) ++{ ++ struct i2c_msg *msg = priv->current_msg; ++ int len = (msg->flags & I2C_M_TEN) ? 2 : 1; ++ ++ pr_debug("set_tx_len %cX\n", (msg->flags & I2C_M_RD) ? 'R' : 'T'); ++ ++ priv->status = STATUS_ADDR; ++ ++ if (!(msg->flags & I2C_M_RD)) ++ len += msg->len; ++ else ++ /* set maximum received packet size (before rx int!) */ ++ i2c_w32(msg->len, mrps_ctrl); ++ i2c_w32(len, tps_ctrl); ++ enable_burst_irq(priv); ++} ++ ++static int ltq_i2c_hw_set_clock(struct i2c_adapter *adap) ++{ ++ struct ltq_i2c *priv = i2c_get_adapdata(adap); ++ unsigned int input_clock = clk_get_rate(priv->clk_input); ++ u32 dec, inc = 1; ++ ++ /* clock changed? */ ++ if (priv->input_clock == input_clock) ++ return 0; ++ ++ /* ++ * this formula is only an approximation, found by the recommended ++ * values in the "I2C Architecture Specification 1.7.1" ++ */ ++ dec = input_clock / (priv->i2c_clock * 2); ++ if (dec <= 6) ++ return -ENXIO; ++ ++ i2c_w32(0, fdiv_high_cfg); ++ i2c_w32((inc << I2C_FDIV_CFG_INC_OFFSET) | ++ (dec << I2C_FDIV_CFG_DEC_OFFSET), ++ fdiv_cfg); ++ ++ dev_info(priv->dev, "setup clocks (in %d kHz, bus %d kHz, dec=%d)\n", ++ input_clock, priv->i2c_clock, dec); ++ ++ priv->input_clock = input_clock; ++ return 0; ++} ++ ++static int ltq_i2c_hw_init(struct i2c_adapter *adap) ++{ ++ int ret = 0; ++ struct ltq_i2c *priv = i2c_get_adapdata(adap); ++ ++ /* disable bus */ ++ i2c_w32_mask(I2C_RUN_CTRL_RUN_EN, 0, run_ctrl); ++ ++#ifndef DEBUG ++ /* set normal operation clock divider */ ++ i2c_w32(1 << I2C_CLC_RMC_OFFSET, clc); ++#else ++ /* for debugging a higher divider value! */ ++ i2c_w32(0xF0 << I2C_CLC_RMC_OFFSET, clc); ++#endif ++ ++ /* setup clock */ ++ ret = ltq_i2c_hw_set_clock(adap); ++ if (ret != 0) { ++ dev_warn(priv->dev, "invalid clock settings\n"); ++ return ret; ++ } ++ ++ /* configure fifo */ ++ i2c_w32(I2C_FIFO_CFG_TXFC | /* tx fifo as flow controller */ ++ I2C_FIFO_CFG_RXFC | /* rx fifo as flow controller */ ++ I2C_FIFO_CFG_TXFA_TXFA2 | /* tx fifo 4-byte aligned */ ++ I2C_FIFO_CFG_RXFA_RXFA2 | /* rx fifo 4-byte aligned */ ++ I2C_FIFO_CFG_TXBS_TXBS0 | /* tx fifo burst size is 1 word */ ++ I2C_FIFO_CFG_RXBS_RXBS0, /* rx fifo burst size is 1 word */ ++ fifo_cfg); ++ ++ /* configure address */ ++ i2c_w32(I2C_ADDR_CFG_SOPE_EN | /* generate stop when no more data in ++ the fifo */ ++ I2C_ADDR_CFG_SONA_EN | /* generate stop when NA received */ ++ I2C_ADDR_CFG_MnS_EN | /* we are master device */ ++ 0, /* our slave address (not used!) */ ++ addr_cfg); ++ ++ /* enable bus */ ++ i2c_w32_mask(0, I2C_RUN_CTRL_RUN_EN, run_ctrl); ++ ++ return 0; ++} ++ ++static int ltq_i2c_wait_bus_not_busy(struct ltq_i2c *priv) ++{ ++ unsigned long timeout; ++ ++ timeout = jiffies + msecs_to_jiffies(LTQ_I2C_BUSY_TIMEOUT); ++ ++ do { ++ u32 stat = i2c_r32(bus_stat); ++ ++ if ((stat & I2C_BUS_STAT_BS_MASK) == I2C_BUS_STAT_BS_FREE) ++ return 0; ++ ++ cond_resched(); ++ } while (!time_after_eq(jiffies, timeout)); ++ ++ dev_err(priv->dev, "timeout waiting for bus ready\n"); ++ return -ETIMEDOUT; ++} ++ ++static void ltq_i2c_tx(struct ltq_i2c *priv, int last) ++{ ++ if (priv->msg_buf_len && priv->msg_buf) { ++ i2c_w32(*priv->msg_buf, txd); ++ ++ if (--priv->msg_buf_len) ++ priv->msg_buf++; ++ else ++ priv->msg_buf = NULL; ++ } else { ++ last = 1; ++ } ++ ++ if (last) ++ disable_burst_irq(priv); ++} ++ ++static void ltq_i2c_rx(struct ltq_i2c *priv, int last) ++{ ++ u32 fifo_stat, timeout; ++ if (priv->msg_buf_len && priv->msg_buf) { ++ timeout = 5000000; ++ do { ++ fifo_stat = i2c_r32(ffs_stat); ++ } while (!fifo_stat && --timeout); ++ if (!timeout) { ++ last = 1; ++ pr_debug("\nrx timeout\n"); ++ goto err; ++ } ++ while (fifo_stat) { ++ *priv->msg_buf = i2c_r32(rxd); ++ if (--priv->msg_buf_len) { ++ priv->msg_buf++; ++ } else { ++ priv->msg_buf = NULL; ++ last = 1; ++ break; ++ } ++ /* ++ * do not read more than burst size, otherwise no "last ++ * burst" is generated and the transaction is blocked! ++ */ ++ fifo_stat = 0; ++ } ++ } else { ++ last = 1; ++ } ++err: ++ if (last) { ++ disable_burst_irq(priv); ++ ++ if (priv->status == STATUS_READ_END) { ++ /* ++ * do the STATUS_STOP and complete() here, as sometimes ++ * the tx_end is already seen before this is finished ++ */ ++ priv->status = STATUS_STOP; ++ complete(&priv->cmd_complete); ++ } else { ++ i2c_w32(I2C_ENDD_CTRL_SETEND, endd_ctrl); ++ priv->status = STATUS_READ_END; ++ } ++ } ++} ++ ++static void ltq_i2c_xfer_init(struct ltq_i2c *priv) ++{ ++ /* enable interrupts */ ++ i2c_w32(LTQ_I2C_IMSC_DEFAULT_MASK, imsc); ++ ++ /* trigger transfer of first msg */ ++ ltq_i2c_set_tx_len(priv); ++} ++ ++static void dump_msgs(struct i2c_msg msgs[], int num, int rx) ++{ ++#if defined(DEBUG) ++ int i, j; ++ pr_debug("Messages %d %s\n", num, rx ? "out" : "in"); ++ for (i = 0; i < num; i++) { ++ pr_debug("%2d %cX Msg(%d) addr=0x%X: ", i, ++ (msgs[i].flags & I2C_M_RD) ? 'R' : 'T', ++ msgs[i].len, msgs[i].addr); ++ if (!(msgs[i].flags & I2C_M_RD) || rx) { ++ for (j = 0; j < msgs[i].len; j++) ++ pr_debug("%02X ", msgs[i].buf[j]); ++ } ++ pr_debug("\n"); ++ } ++#endif ++} ++ ++static void ltq_i2c_release_bus(struct ltq_i2c *priv) ++{ ++ if ((i2c_r32(bus_stat) & I2C_BUS_STAT_BS_MASK) == I2C_BUS_STAT_BS_BM) ++ i2c_w32(I2C_ENDD_CTRL_SETEND, endd_ctrl); ++} ++ ++static int ltq_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], ++ int num) ++{ ++ struct ltq_i2c *priv = i2c_get_adapdata(adap); ++ int ret; ++ ++ dev_dbg(priv->dev, "xfer %u messages\n", num); ++ dump_msgs(msgs, num, 0); ++ ++ mutex_lock(&priv->mutex); ++ ++ init_completion(&priv->cmd_complete); ++ priv->current_msg = msgs; ++ priv->msgs_num = num; ++ priv->msg_err = 0; ++ priv->status = STATUS_IDLE; ++ ++ /* wait for the bus to become ready */ ++ ret = ltq_i2c_wait_bus_not_busy(priv); ++ if (ret) ++ goto done; ++ ++ while (priv->msgs_num) { ++ /* start the transfers */ ++ ltq_i2c_xfer_init(priv); ++ ++ /* wait for transfers to complete */ ++ ret = wait_for_completion_interruptible_timeout( ++ &priv->cmd_complete, LTQ_I2C_XFER_TIMEOUT); ++ if (ret == 0) { ++ dev_err(priv->dev, "controller timed out\n"); ++ ltq_i2c_hw_init(adap); ++ ret = -ETIMEDOUT; ++ goto done; ++ } else if (ret < 0) ++ goto done; ++ ++ if (priv->msg_err) { ++ if (priv->msg_err & LTQ_I2C_NACK) ++ ret = -ENXIO; ++ else ++ ret = -EREMOTEIO; ++ goto done; ++ } ++ if (--priv->msgs_num) ++ priv->current_msg++; ++ } ++ /* no error? */ ++ ret = num; ++ ++done: ++ ltq_i2c_release_bus(priv); ++ ++ mutex_unlock(&priv->mutex); ++ ++ if (ret >= 0) ++ dump_msgs(msgs, num, 1); ++ ++ pr_debug("XFER ret %d\n", ret); ++ return ret; ++} ++ ++static irqreturn_t ltq_i2c_isr_burst(int irq, void *dev_id) ++{ ++ struct ltq_i2c *priv = dev_id; ++ struct i2c_msg *msg = priv->current_msg; ++ int last = (irq == priv->irq_lb); ++ ++ if (last) ++ pr_debug("LB "); ++ else ++ pr_debug("B "); ++ ++ if (msg->flags & I2C_M_RD) { ++ switch (priv->status) { ++ case STATUS_ADDR: ++ pr_debug("X"); ++ prepare_msg_send_addr(priv); ++ disable_burst_irq(priv); ++ break; ++ case STATUS_READ: ++ case STATUS_READ_END: ++ pr_debug("R"); ++ ltq_i2c_rx(priv, last); ++ break; ++ default: ++ disable_burst_irq(priv); ++ pr_warn("Status R %d\n", priv->status); ++ break; ++ } ++ } else { ++ switch (priv->status) { ++ case STATUS_ADDR: ++ pr_debug("x"); ++ prepare_msg_send_addr(priv); ++ break; ++ case STATUS_WRITE: ++ pr_debug("w"); ++ ltq_i2c_tx(priv, last); ++ break; ++ default: ++ disable_burst_irq(priv); ++ pr_warn("Status W %d\n", priv->status); ++ break; ++ } ++ } ++ ++ i2c_w32(I2C_ICR_BREQ_INT_CLR | I2C_ICR_LBREQ_INT_CLR, icr); ++ return IRQ_HANDLED; ++} ++ ++static void ltq_i2c_isr_prot(struct ltq_i2c *priv) ++{ ++ u32 i_pro = i2c_r32(p_irqss); ++ ++ pr_debug("i2c-p"); ++ ++ /* not acknowledge */ ++ if (i_pro & I2C_P_IRQSS_NACK) { ++ priv->msg_err |= LTQ_I2C_NACK; ++ pr_debug(" nack"); ++ } ++ ++ /* arbitration lost */ ++ if (i_pro & I2C_P_IRQSS_AL) { ++ priv->msg_err |= LTQ_I2C_ARB_LOST; ++ pr_debug(" arb-lost"); ++ } ++ /* tx -> rx switch */ ++ if (i_pro & I2C_P_IRQSS_RX) ++ pr_debug(" rx"); ++ ++ /* tx end */ ++ if (i_pro & I2C_P_IRQSS_TX_END) ++ pr_debug(" txend"); ++ pr_debug("\n"); ++ ++ if (!priv->msg_err) { ++ /* tx -> rx switch */ ++ if (i_pro & I2C_P_IRQSS_RX) { ++ priv->status = STATUS_READ; ++ enable_burst_irq(priv); ++ } ++ if (i_pro & I2C_P_IRQSS_TX_END) { ++ if (priv->status == STATUS_READ) ++ priv->status = STATUS_READ_END; ++ else { ++ disable_burst_irq(priv); ++ priv->status = STATUS_STOP; ++ } ++ } ++ } ++ ++ i2c_w32(i_pro, p_irqsc); ++} ++ ++static irqreturn_t ltq_i2c_isr(int irq, void *dev_id) ++{ ++ u32 i_raw, i_err = 0; ++ struct ltq_i2c *priv = dev_id; ++ ++ i_raw = i2c_r32(mis); ++ pr_debug("i_raw 0x%08X\n", i_raw); ++ ++ /* error interrupt */ ++ if (i_raw & I2C_RIS_I2C_ERR_INT_INTOCC) { ++ i_err = i2c_r32(err_irqss); ++ pr_debug("i_err 0x%08X bus_stat 0x%04X\n", ++ i_err, i2c_r32(bus_stat)); ++ ++ /* tx fifo overflow (8) */ ++ if (i_err & I2C_ERR_IRQSS_TXF_OFL) ++ priv->msg_err |= LTQ_I2C_TX_OFL; ++ ++ /* tx fifo underflow (4) */ ++ if (i_err & I2C_ERR_IRQSS_TXF_UFL) ++ priv->msg_err |= LTQ_I2C_TX_UFL; ++ ++ /* rx fifo overflow (2) */ ++ if (i_err & I2C_ERR_IRQSS_RXF_OFL) ++ priv->msg_err |= LTQ_I2C_RX_OFL; ++ ++ /* rx fifo underflow (1) */ ++ if (i_err & I2C_ERR_IRQSS_RXF_UFL) ++ priv->msg_err |= LTQ_I2C_RX_UFL; ++ ++ i2c_w32(i_err, err_irqsc); ++ } ++ ++ /* protocol interrupt */ ++ if (i_raw & I2C_RIS_I2C_P_INT_INTOCC) ++ ltq_i2c_isr_prot(priv); ++ ++ if ((priv->msg_err) || (priv->status == STATUS_STOP)) ++ complete(&priv->cmd_complete); ++ ++ return IRQ_HANDLED; ++} ++ ++static u32 ltq_i2c_functionality(struct i2c_adapter *adap) ++{ ++ return I2C_FUNC_I2C | ++ I2C_FUNC_10BIT_ADDR | ++ I2C_FUNC_SMBUS_EMUL; ++} ++ ++static struct i2c_algorithm ltq_i2c_algorithm = { ++ .master_xfer = ltq_i2c_xfer, ++ .functionality = ltq_i2c_functionality, ++}; ++ ++static int ltq_i2c_probe(struct platform_device *pdev) ++{ ++ struct device_node *node = pdev->dev.of_node; ++ struct ltq_i2c *priv; ++ struct i2c_adapter *adap; ++ struct resource *mmres, irqres[4]; ++ int ret = 0; ++ ++ dev_dbg(&pdev->dev, "probing\n"); ++ ++ mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ ret = of_irq_to_resource_table(node, irqres, 4); ++ if (!mmres || (ret != 4)) { ++ dev_err(&pdev->dev, "no resources\n"); ++ return -ENODEV; ++ } ++ ++ /* allocate private data */ ++ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) { ++ dev_err(&pdev->dev, "can't allocate private data\n"); ++ return -ENOMEM; ++ } ++ ++ adap = &priv->adap; ++ i2c_set_adapdata(adap, priv); ++ adap->owner = THIS_MODULE; ++ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; ++ strlcpy(adap->name, DRV_NAME "-adapter", sizeof(adap->name)); ++ adap->algo = <q_i2c_algorithm; ++ adap->dev.parent = &pdev->dev; ++ adap->dev.of_node = pdev->dev.of_node; ++ ++ if (of_property_read_u32(node, "clock-frequency", &priv->i2c_clock)) { ++ dev_warn(&pdev->dev, "No I2C speed selected, using 100kHz\n"); ++ priv->i2c_clock = 100000; ++ } ++ ++ init_completion(&priv->cmd_complete); ++ mutex_init(&priv->mutex); ++ ++ priv->membase = devm_ioremap_resource(&pdev->dev, mmres); ++ if (IS_ERR(priv->membase)) ++ return PTR_ERR(priv->membase); ++ ++ priv->dev = &pdev->dev; ++ priv->irq_lb = irqres[0].start; ++ ++ ret = devm_request_irq(&pdev->dev, irqres[0].start, ltq_i2c_isr_burst, ++ 0x0, "i2c lb", priv); ++ if (ret) { ++ dev_err(&pdev->dev, "can't get last burst IRQ %d\n", ++ irqres[0].start); ++ return -ENODEV; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, irqres[1].start, ltq_i2c_isr_burst, ++ 0x0, "i2c b", priv); ++ if (ret) { ++ dev_err(&pdev->dev, "can't get burst IRQ %d\n", ++ irqres[1].start); ++ return -ENODEV; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, irqres[2].start, ltq_i2c_isr, ++ 0x0, "i2c err", priv); ++ if (ret) { ++ dev_err(&pdev->dev, "can't get error IRQ %d\n", ++ irqres[2].start); ++ return -ENODEV; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, irqres[3].start, ltq_i2c_isr, ++ 0x0, "i2c p", priv); ++ if (ret) { ++ dev_err(&pdev->dev, "can't get protocol IRQ %d\n", ++ irqres[3].start); ++ return -ENODEV; ++ } ++ ++ dev_dbg(&pdev->dev, "mapped io-space to %p\n", priv->membase); ++ dev_dbg(&pdev->dev, "use IRQs %d, %d, %d, %d\n", irqres[0].start, ++ irqres[1].start, irqres[2].start, irqres[3].start); ++ ++ priv->clk_gate = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(priv->clk_gate)) { ++ dev_err(&pdev->dev, "failed to get i2c clk\n"); ++ return -ENOENT; ++ } ++ ++ /* this is a static clock, which has no refcounting */ ++ priv->clk_input = clk_get_fpi(); ++ if (IS_ERR(priv->clk_input)) { ++ dev_err(&pdev->dev, "failed to get fpi clk\n"); ++ return -ENOENT; ++ } ++ ++ clk_activate(priv->clk_gate); ++ ++ /* add our adapter to the i2c stack */ ++ ret = i2c_add_numbered_adapter(adap); ++ if (ret) { ++ dev_err(&pdev->dev, "can't register I2C adapter\n"); ++ goto out; ++ } ++ ++ platform_set_drvdata(pdev, priv); ++ i2c_set_adapdata(adap, priv); ++ ++ /* print module version information */ ++ dev_dbg(&pdev->dev, "module id=%u revision=%u\n", ++ (i2c_r32(id) & I2C_ID_ID_MASK) >> I2C_ID_ID_OFFSET, ++ (i2c_r32(id) & I2C_ID_REV_MASK) >> I2C_ID_REV_OFFSET); ++ ++ /* initialize HW */ ++ ret = ltq_i2c_hw_init(adap); ++ if (ret) { ++ dev_err(&pdev->dev, "can't configure adapter\n"); ++ i2c_del_adapter(adap); ++ platform_set_drvdata(pdev, NULL); ++ goto out; ++ } else { ++ dev_info(&pdev->dev, "version %s\n", DRV_VERSION); ++ } ++ ++out: ++ /* if init failed, we need to deactivate the clock gate */ ++ if (ret) ++ clk_deactivate(priv->clk_gate); ++ ++ return ret; ++} ++ ++static int ltq_i2c_remove(struct platform_device *pdev) ++{ ++ struct ltq_i2c *priv = platform_get_drvdata(pdev); ++ ++ /* disable bus */ ++ i2c_w32_mask(I2C_RUN_CTRL_RUN_EN, 0, run_ctrl); ++ ++ /* power down the core */ ++ clk_deactivate(priv->clk_gate); ++ ++ /* remove driver */ ++ i2c_del_adapter(&priv->adap); ++ kfree(priv); ++ ++ dev_dbg(&pdev->dev, "removed\n"); ++ platform_set_drvdata(pdev, NULL); ++ ++ return 0; ++} ++static const struct of_device_id ltq_i2c_match[] = { ++ { .compatible = "lantiq,lantiq-i2c" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ltq_i2c_match); ++ ++static struct platform_driver ltq_i2c_driver = { ++ .probe = ltq_i2c_probe, ++ .remove = ltq_i2c_remove, ++ .driver = { ++ .name = DRV_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = ltq_i2c_match, ++ }, ++}; ++ ++module_platform_driver(ltq_i2c_driver); ++ ++MODULE_DESCRIPTION("Lantiq I2C bus adapter"); ++MODULE_AUTHOR("Thomas Langer "); ++MODULE_ALIAS("platform:" DRV_NAME); ++MODULE_LICENSE("GPL"); ++MODULE_VERSION(DRV_VERSION); +--- /dev/null ++++ b/drivers/i2c/busses/i2c-lantiq.h +@@ -0,0 +1,234 @@ ++#ifndef I2C_LANTIQ_H ++#define I2C_LANTIQ_H ++ ++/* I2C register structure */ ++struct lantiq_reg_i2c { ++ /* I2C Kernel Clock Control Register */ ++ unsigned int clc; /* 0x00000000 */ ++ /* Reserved */ ++ unsigned int res_0; /* 0x00000004 */ ++ /* I2C Identification Register */ ++ unsigned int id; /* 0x00000008 */ ++ /* Reserved */ ++ unsigned int res_1; /* 0x0000000C */ ++ /* ++ * I2C RUN Control Register ++ * This register enables and disables the I2C peripheral. Before ++ * enabling, the I2C has to be configured properly. After enabling ++ * no configuration is possible ++ */ ++ unsigned int run_ctrl; /* 0x00000010 */ ++ /* ++ * I2C End Data Control Register ++ * This register is used to either turn around the data transmission ++ * direction or to address another slave without sending a stop ++ * condition. Also the software can stop the slave-transmitter by ++ * sending a not-accolade when working as master-receiver or even ++ * stop data transmission immediately when operating as ++ * master-transmitter. The writing to the bits of this control ++ * register is only effective when in MASTER RECEIVES BYTES, MASTER ++ * TRANSMITS BYTES, MASTER RESTART or SLAVE RECEIVE BYTES state ++ */ ++ unsigned int endd_ctrl; /* 0x00000014 */ ++ /* ++ * I2C Fractional Divider Configuration Register ++ * These register is used to program the fractional divider of the I2C ++ * bus. Before the peripheral is switched on by setting the RUN-bit the ++ * two (fixed) values for the two operating frequencies are programmed ++ * into these (configuration) registers. The Register FDIV_HIGH_CFG has ++ * the same layout as I2C_FDIV_CFG. ++ */ ++ unsigned int fdiv_cfg; /* 0x00000018 */ ++ /* ++ * I2C Fractional Divider (highspeed mode) Configuration Register ++ * These register is used to program the fractional divider of the I2C ++ * bus. Before the peripheral is switched on by setting the RUN-bit the ++ * two (fixed) values for the two operating frequencies are programmed ++ * into these (configuration) registers. The Register FDIV_CFG has the ++ * same layout as I2C_FDIV_CFG. ++ */ ++ unsigned int fdiv_high_cfg; /* 0x0000001C */ ++ /* I2C Address Configuration Register */ ++ unsigned int addr_cfg; /* 0x00000020 */ ++ /* I2C Bus Status Register ++ * This register gives a status information of the I2C. This additional ++ * information can be used by the software to start proper actions. ++ */ ++ unsigned int bus_stat; /* 0x00000024 */ ++ /* I2C FIFO Configuration Register */ ++ unsigned int fifo_cfg; /* 0x00000028 */ ++ /* I2C Maximum Received Packet Size Register */ ++ unsigned int mrps_ctrl; /* 0x0000002C */ ++ /* I2C Received Packet Size Status Register */ ++ unsigned int rps_stat; /* 0x00000030 */ ++ /* I2C Transmit Packet Size Register */ ++ unsigned int tps_ctrl; /* 0x00000034 */ ++ /* I2C Filled FIFO Stages Status Register */ ++ unsigned int ffs_stat; /* 0x00000038 */ ++ /* Reserved */ ++ unsigned int res_2; /* 0x0000003C */ ++ /* I2C Timing Configuration Register */ ++ unsigned int tim_cfg; /* 0x00000040 */ ++ /* Reserved */ ++ unsigned int res_3[7]; /* 0x00000044 */ ++ /* I2C Error Interrupt Request Source Mask Register */ ++ unsigned int err_irqsm; /* 0x00000060 */ ++ /* I2C Error Interrupt Request Source Status Register */ ++ unsigned int err_irqss; /* 0x00000064 */ ++ /* I2C Error Interrupt Request Source Clear Register */ ++ unsigned int err_irqsc; /* 0x00000068 */ ++ /* Reserved */ ++ unsigned int res_4; /* 0x0000006C */ ++ /* I2C Protocol Interrupt Request Source Mask Register */ ++ unsigned int p_irqsm; /* 0x00000070 */ ++ /* I2C Protocol Interrupt Request Source Status Register */ ++ unsigned int p_irqss; /* 0x00000074 */ ++ /* I2C Protocol Interrupt Request Source Clear Register */ ++ unsigned int p_irqsc; /* 0x00000078 */ ++ /* Reserved */ ++ unsigned int res_5; /* 0x0000007C */ ++ /* I2C Raw Interrupt Status Register */ ++ unsigned int ris; /* 0x00000080 */ ++ /* I2C Interrupt Mask Control Register */ ++ unsigned int imsc; /* 0x00000084 */ ++ /* I2C Masked Interrupt Status Register */ ++ unsigned int mis; /* 0x00000088 */ ++ /* I2C Interrupt Clear Register */ ++ unsigned int icr; /* 0x0000008C */ ++ /* I2C Interrupt Set Register */ ++ unsigned int isr; /* 0x00000090 */ ++ /* I2C DMA Enable Register */ ++ unsigned int dmae; /* 0x00000094 */ ++ /* Reserved */ ++ unsigned int res_6[8154]; /* 0x00000098 */ ++ /* I2C Transmit Data Register */ ++ unsigned int txd; /* 0x00008000 */ ++ /* Reserved */ ++ unsigned int res_7[4095]; /* 0x00008004 */ ++ /* I2C Receive Data Register */ ++ unsigned int rxd; /* 0x0000C000 */ ++ /* Reserved */ ++ unsigned int res_8[4095]; /* 0x0000C004 */ ++}; ++ ++/* ++ * Clock Divider for Normal Run Mode ++ * Max 8-bit divider value. IF RMC is 0 the module is disabled. Note: As long ++ * as the new divider value RMC is not valid, the register returns 0x0000 00xx ++ * on reading. ++ */ ++#define I2C_CLC_RMC_MASK 0x0000FF00 ++/* field offset */ ++#define I2C_CLC_RMC_OFFSET 8 ++ ++/* Fields of "I2C Identification Register" */ ++/* Module ID */ ++#define I2C_ID_ID_MASK 0x0000FF00 ++/* field offset */ ++#define I2C_ID_ID_OFFSET 8 ++/* Revision */ ++#define I2C_ID_REV_MASK 0x000000FF ++/* field offset */ ++#define I2C_ID_REV_OFFSET 0 ++ ++/* Fields of "I2C Interrupt Mask Control Register" */ ++/* Enable */ ++#define I2C_IMSC_BREQ_INT_EN 0x00000008 ++/* Enable */ ++#define I2C_IMSC_LBREQ_INT_EN 0x00000004 ++ ++/* Fields of "I2C Fractional Divider Configuration Register" */ ++/* field offset */ ++#define I2C_FDIV_CFG_INC_OFFSET 16 ++ ++/* Fields of "I2C Interrupt Mask Control Register" */ ++/* Enable */ ++#define I2C_IMSC_I2C_P_INT_EN 0x00000020 ++/* Enable */ ++#define I2C_IMSC_I2C_ERR_INT_EN 0x00000010 ++ ++/* Fields of "I2C Error Interrupt Request Source Status Register" */ ++/* TXF_OFL */ ++#define I2C_ERR_IRQSS_TXF_OFL 0x00000008 ++/* TXF_UFL */ ++#define I2C_ERR_IRQSS_TXF_UFL 0x00000004 ++/* RXF_OFL */ ++#define I2C_ERR_IRQSS_RXF_OFL 0x00000002 ++/* RXF_UFL */ ++#define I2C_ERR_IRQSS_RXF_UFL 0x00000001 ++ ++/* Fields of "I2C Raw Interrupt Status Register" */ ++/* Read: Interrupt occurred. */ ++#define I2C_RIS_I2C_ERR_INT_INTOCC 0x00000010 ++/* Read: Interrupt occurred. */ ++#define I2C_RIS_I2C_P_INT_INTOCC 0x00000020 ++ ++/* Fields of "I2C FIFO Configuration Register" */ ++/* TX FIFO Flow Control */ ++#define I2C_FIFO_CFG_TXFC 0x00020000 ++/* RX FIFO Flow Control */ ++#define I2C_FIFO_CFG_RXFC 0x00010000 ++/* Word aligned (character alignment of four characters) */ ++#define I2C_FIFO_CFG_TXFA_TXFA2 0x00002000 ++/* Word aligned (character alignment of four characters) */ ++#define I2C_FIFO_CFG_RXFA_RXFA2 0x00000200 ++/* 1 word */ ++#define I2C_FIFO_CFG_TXBS_TXBS0 0x00000000 ++ ++/* Fields of "I2C FIFO Configuration Register" */ ++/* 1 word */ ++#define I2C_FIFO_CFG_RXBS_RXBS0 0x00000000 ++/* Stop on Packet End Enable */ ++#define I2C_ADDR_CFG_SOPE_EN 0x00200000 ++/* Stop on Not Acknowledge Enable */ ++#define I2C_ADDR_CFG_SONA_EN 0x00100000 ++/* Enable */ ++#define I2C_ADDR_CFG_MnS_EN 0x00080000 ++ ++/* Fields of "I2C Interrupt Clear Register" */ ++/* Clear */ ++#define I2C_ICR_BREQ_INT_CLR 0x00000008 ++/* Clear */ ++#define I2C_ICR_LBREQ_INT_CLR 0x00000004 ++ ++/* Fields of "I2C Fractional Divider Configuration Register" */ ++/* field offset */ ++#define I2C_FDIV_CFG_DEC_OFFSET 0 ++ ++/* Fields of "I2C Bus Status Register" */ ++/* Bus Status */ ++#define I2C_BUS_STAT_BS_MASK 0x00000003 ++/* Read from I2C Bus. */ ++#define I2C_BUS_STAT_RNW_READ 0x00000004 ++/* I2C Bus is free. */ ++#define I2C_BUS_STAT_BS_FREE 0x00000000 ++/* ++ * The device is working as master and has claimed the control on the ++ * I2C-bus (busy master). ++ */ ++#define I2C_BUS_STAT_BS_BM 0x00000002 ++ ++/* Fields of "I2C RUN Control Register" */ ++/* Enable */ ++#define I2C_RUN_CTRL_RUN_EN 0x00000001 ++ ++/* Fields of "I2C End Data Control Register" */ ++/* ++ * Set End of Transmission ++ * Note:Do not write '1' to this bit when bus is free. This will cause an ++ * abort after the first byte when a new transfer is started. ++ */ ++#define I2C_ENDD_CTRL_SETEND 0x00000002 ++ ++/* Fields of "I2C Protocol Interrupt Request Source Status Register" */ ++/* NACK */ ++#define I2C_P_IRQSS_NACK 0x00000010 ++/* AL */ ++#define I2C_P_IRQSS_AL 0x00000008 ++/* RX */ ++#define I2C_P_IRQSS_RX 0x00000040 ++/* TX_END */ ++#define I2C_P_IRQSS_TX_END 0x00000020 ++ ++ ++#endif /* I2C_LANTIQ_H */ diff --git a/target/linux/lantiq/patches-4.9/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch b/target/linux/lantiq/patches-4.9/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch new file mode 100644 index 000000000..a5ecd94c4 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch @@ -0,0 +1,219 @@ +From f8c5db89e793a4bc6c1e87bd7b3a5cec16b75bc3 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Wed, 10 Sep 2014 22:42:14 +0200 +Subject: [PATCH 35/36] owrt: lantiq: wifi and ethernet eeprom handling + +Signed-off-by: John Crispin +--- + .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 3 + + arch/mips/lantiq/xway/Makefile | 3 + + arch/mips/lantiq/xway/ath5k_eep.c | 136 +++++++++++++++++++++ + arch/mips/lantiq/xway/eth_mac.c | 25 ++++ + drivers/net/ethernet/lantiq_etop.c | 6 +- + 5 files changed, 172 insertions(+), 1 deletion(-) + create mode 100644 arch/mips/lantiq/xway/ath5k_eep.c + create mode 100644 arch/mips/lantiq/xway/eth_mac.c + +--- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h ++++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h +@@ -104,5 +104,8 @@ int xrx200_gphy_boot(struct device *dev, + extern void ltq_pmu_enable(unsigned int module); + extern void ltq_pmu_disable(unsigned int module); + ++/* allow the ethernet driver to load a flash mapped mac addr */ ++const u8* ltq_get_eth_mac(void); ++ + #endif /* CONFIG_SOC_TYPE_XWAY */ + #endif /* _LTQ_XWAY_H__ */ +--- a/arch/mips/lantiq/xway/Makefile ++++ b/arch/mips/lantiq/xway/Makefile +@@ -8,4 +8,7 @@ endif + + obj-y += vmmc.o + ++obj-y += eth_mac.o ++obj-$(CONFIG_PCI) += ath5k_eep.o ++ + obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o +--- /dev/null ++++ b/arch/mips/lantiq/xway/ath5k_eep.c +@@ -0,0 +1,136 @@ ++/* ++ * Copyright (C) 2011 Luca Olivetti ++ * Copyright (C) 2011 John Crispin ++ * Copyright (C) 2011 Andrej Vlašić ++ * Copyright (C) 2013 Álvaro Fernández Rojas ++ * Copyright (C) 2013 Daniel Gimpelevich ++ * Copyright (C) 2015 Vittorio Gambaletta ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++extern int (*ltq_pci_plat_dev_init)(struct pci_dev *dev); ++struct ath5k_platform_data ath5k_pdata; ++static u8 athxk_eeprom_mac[6]; ++ ++static int ath5k_pci_plat_dev_init(struct pci_dev *dev) ++{ ++ dev->dev.platform_data = &ath5k_pdata; ++ return 0; ++} ++ ++static int ath5k_eep_load; ++int __init of_ath5k_eeprom_probe(struct platform_device *pdev) ++{ ++ struct device_node *np = pdev->dev.of_node, *mtd_np = NULL; ++ int mac_offset; ++ u32 mac_inc = 0; ++ int i; ++ struct mtd_info *the_mtd; ++ size_t flash_readlen; ++ const __be32 *list; ++ const char *part; ++ phandle phandle; ++ ++ list = of_get_property(np, "ath,eep-flash", &i); ++ if (!list || (i != (2 * sizeof(*list)))) ++ return -ENODEV; ++ ++ phandle = be32_to_cpup(list++); ++ if (phandle) ++ mtd_np = of_find_node_by_phandle(phandle); ++ ++ if (!mtd_np) ++ return -ENODEV; ++ ++ part = of_get_property(mtd_np, "label", NULL); ++ if (!part) ++ part = mtd_np->name; ++ ++ the_mtd = get_mtd_device_nm(part); ++ if (IS_ERR(the_mtd)) ++ return -ENODEV; ++ ++ ath5k_pdata.eeprom_data = kmalloc(ATH5K_PLAT_EEP_MAX_WORDS<<1, GFP_KERNEL); ++ ++ i = mtd_read(the_mtd, be32_to_cpup(list), ATH5K_PLAT_EEP_MAX_WORDS << 1, ++ &flash_readlen, (void *) ath5k_pdata.eeprom_data); ++ ++ if (!of_property_read_u32(np, "ath,mac-offset", &mac_offset)) { ++ size_t mac_readlen; ++ mtd_read(the_mtd, mac_offset, 6, &mac_readlen, ++ (void *) athxk_eeprom_mac); ++ } ++ put_mtd_device(the_mtd); ++ ++ if (((ATH5K_PLAT_EEP_MAX_WORDS<<1) != flash_readlen) || i) { ++ dev_err(&pdev->dev, "failed to load eeprom from mtd\n"); ++ return -ENODEV; ++ } ++ ++ if (of_find_property(np, "ath,eep-swap", NULL)) ++ for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS; i++) ++ ath5k_pdata.eeprom_data[i] = swab16(ath5k_pdata.eeprom_data[i]); ++ ++ if (!is_valid_ether_addr(athxk_eeprom_mac) && ltq_get_eth_mac()) ++ ether_addr_copy(athxk_eeprom_mac, ltq_get_eth_mac()); ++ ++ if (!is_valid_ether_addr(athxk_eeprom_mac)) { ++ dev_warn(&pdev->dev, "using random mac\n"); ++ random_ether_addr(athxk_eeprom_mac); ++ } ++ ++ if (!of_property_read_u32(np, "ath,mac-increment", &mac_inc)) ++ athxk_eeprom_mac[5] += mac_inc; ++ ++ ath5k_pdata.macaddr = athxk_eeprom_mac; ++ ltq_pci_plat_dev_init = ath5k_pci_plat_dev_init; ++ ++ dev_info(&pdev->dev, "loaded ath5k eeprom\n"); ++ ++ return 0; ++} ++ ++static struct of_device_id ath5k_eeprom_ids[] = { ++ { .compatible = "ath5k,eeprom" }, ++ { } ++}; ++ ++static struct platform_driver ath5k_eeprom_driver = { ++ .driver = { ++ .name = "ath5k,eeprom", ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(ath5k_eeprom_ids), ++ }, ++}; ++ ++static int __init of_ath5k_eeprom_init(void) ++{ ++ int ret = platform_driver_probe(&ath5k_eeprom_driver, of_ath5k_eeprom_probe); ++ ++ if (ret) ++ ath5k_eep_load = 1; ++ ++ return ret; ++} ++ ++static int __init of_ath5k_eeprom_init_late(void) ++{ ++ if (!ath5k_eep_load) ++ return 0; ++ ++ return platform_driver_probe(&ath5k_eeprom_driver, of_ath5k_eeprom_probe); ++} ++late_initcall(of_ath5k_eeprom_init_late); ++subsys_initcall(of_ath5k_eeprom_init); +--- /dev/null ++++ b/arch/mips/lantiq/xway/eth_mac.c +@@ -0,0 +1,25 @@ ++/* ++ * Copyright (C) 2012 John Crispin ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation. ++ */ ++ ++#include ++#include ++ ++static u8 eth_mac[6]; ++static int eth_mac_set; ++ ++const u8* ltq_get_eth_mac(void) ++{ ++ return eth_mac; ++} ++ ++static int __init setup_ethaddr(char *str) ++{ ++ eth_mac_set = mac_pton(str, eth_mac); ++ return !eth_mac_set; ++} ++early_param("ethaddr", setup_ethaddr); +--- a/drivers/net/ethernet/lantiq_etop.c ++++ b/drivers/net/ethernet/lantiq_etop.c +@@ -794,7 +794,11 @@ ltq_etop_init(struct net_device *dev) + if (err) + goto err_hw; + +- memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr)); ++ memcpy(&mac.sa_data, ltq_get_eth_mac(), ETH_ALEN); ++ ++ if (priv->mac && !is_valid_ether_addr(mac.sa_data)) ++ memcpy(&mac.sa_data, priv->mac, ETH_ALEN); ++ + if (!is_valid_ether_addr(mac.sa_data)) { + pr_warn("etop: invalid MAC, using random\n"); + eth_random_addr(mac.sa_data); diff --git a/target/linux/lantiq/patches-4.9/0040-USB-DWC2-enable-usb-power-gpio.patch b/target/linux/lantiq/patches-4.9/0040-USB-DWC2-enable-usb-power-gpio.patch new file mode 100644 index 000000000..fc6312310 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0040-USB-DWC2-enable-usb-power-gpio.patch @@ -0,0 +1,35 @@ +--- a/drivers/usb/dwc2/platform.c ++++ b/drivers/usb/dwc2/platform.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -544,6 +545,7 @@ static int dwc2_driver_probe(struct plat + struct dwc2_hsotg *hsotg; + struct resource *res; + int retval; ++ int gpio_count; + + match = of_match_device(dwc2_of_match_table, &dev->dev); + if (match && match->data) { +@@ -562,6 +564,16 @@ static int dwc2_driver_probe(struct plat + defparams.dma_desc_fs_enable = 0; + } + ++ gpio_count = of_gpio_count(dev->dev.of_node); ++ while (gpio_count > 0) { ++ enum of_gpio_flags flags; ++ int gpio = of_get_gpio_flags(dev->dev.of_node, --gpio_count, &flags); ++ if (gpio_request(gpio, "usb")) ++ continue; ++ dev_info(&dev->dev, "requested GPIO %d\n", gpio); ++ gpio_direction_output(gpio, (flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1)); ++ } ++ + hsotg = devm_kzalloc(&dev->dev, sizeof(*hsotg), GFP_KERNEL); + if (!hsotg) + return -ENOMEM; diff --git a/target/linux/lantiq/patches-4.9/0042-arch-mips-increase-io_space_limit.patch b/target/linux/lantiq/patches-4.9/0042-arch-mips-increase-io_space_limit.patch new file mode 100644 index 000000000..14b417e69 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0042-arch-mips-increase-io_space_limit.patch @@ -0,0 +1,23 @@ +From 9807eb80a1b3bad7a4a89aa6566497bb1cadd6ef Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Fri, 3 Jun 2016 13:12:20 +0200 +Subject: [PATCH] arch: mips: increase io_space_limit + +this value comes from x86 and breaks some pci devices + +Signed-off-by: John Crispin +--- + arch/mips/include/asm/io.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/include/asm/io.h ++++ b/arch/mips/include/asm/io.h +@@ -50,7 +50,7 @@ + + /* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */ + +-#define IO_SPACE_LIMIT 0xffff ++#define IO_SPACE_LIMIT 0xffffffff + + /* + * On MIPS I/O ports are memory mapped, so we access them using normal diff --git a/target/linux/lantiq/patches-4.9/0044-pinctrl-xway-fix-copy-paste-error-in-xrx200_grps.patch b/target/linux/lantiq/patches-4.9/0044-pinctrl-xway-fix-copy-paste-error-in-xrx200_grps.patch new file mode 100644 index 000000000..a2fc9d955 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0044-pinctrl-xway-fix-copy-paste-error-in-xrx200_grps.patch @@ -0,0 +1,11 @@ +--- a/drivers/pinctrl/pinctrl-xway.c ++++ b/drivers/pinctrl/pinctrl-xway.c +@@ -1028,7 +1028,7 @@ static const struct ltq_pin_group xrx200 + GRP_MUX("spi_cs5", SPI, xrx200_pins_spi_cs5), + GRP_MUX("spi_cs6", SPI, xrx200_pins_spi_cs6), + GRP_MUX("usif uart_rx", USIF, xrx200_pins_usif_uart_rx), +- GRP_MUX("usif uart_rx", USIF, xrx200_pins_usif_uart_tx), ++ GRP_MUX("usif uart_tx", USIF, xrx200_pins_usif_uart_tx), + GRP_MUX("usif uart_rts", USIF, xrx200_pins_usif_uart_rts), + GRP_MUX("usif uart_cts", USIF, xrx200_pins_usif_uart_cts), + GRP_MUX("usif uart_dtr", USIF, xrx200_pins_usif_uart_dtr), diff --git a/target/linux/lantiq/patches-4.9/0047-poweroff.patch b/target/linux/lantiq/patches-4.9/0047-poweroff.patch new file mode 100644 index 000000000..54249bba5 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0047-poweroff.patch @@ -0,0 +1,23 @@ +--- a/arch/mips/lantiq/xway/reset.c ++++ b/arch/mips/lantiq/xway/reset.c +@@ -301,12 +301,6 @@ static void ltq_machine_halt(void) + unreachable(); + } + +-static void ltq_machine_power_off(void) +-{ +- local_irq_disable(); +- unreachable(); +-} +- + static void ltq_usb_init(void) + { + /* Power for USB cores 1 & 2 */ +@@ -379,7 +373,6 @@ static int __init mips_reboot_setup(void + + _machine_restart = ltq_machine_restart; + _machine_halt = ltq_machine_halt; +- pm_power_off = ltq_machine_power_off; + + return 0; + } diff --git a/target/linux/lantiq/patches-4.9/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch b/target/linux/lantiq/patches-4.9/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch new file mode 100644 index 000000000..c0d7afc54 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup.patch @@ -0,0 +1,87 @@ +From: Felix Fietkau +Date: Thu, 19 Jan 2017 12:14:44 +0100 +Subject: [PATCH] MIPS: Lantiq: Fix cascaded IRQ setup + +With the IRQ stack changes integrated, the XRX200 devices started +emitting a constant stream of kernel messages like this: + +[ 565.415310] Spurious IRQ: CAUSE=0x1100c300 + +This appears to be caused by IP0 firing for some reason without being +handled. Fix this by setting up IP2-6 as a proper chained IRQ handler and +calling do_IRQ for all MIPS CPU interrupts. + +Cc: john@phrozen.org +Cc: stable@vger.kernel.org +Signed-off-by: Felix Fietkau +--- + +--- a/arch/mips/lantiq/irq.c ++++ b/arch/mips/lantiq/irq.c +@@ -271,6 +271,11 @@ static void ltq_hw5_irqdispatch(void) + DEFINE_HWx_IRQDISPATCH(5) + #endif + ++static void ltq_hw_irq_handler(struct irq_desc *desc) ++{ ++ ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2); ++} ++ + #ifdef CONFIG_MIPS_MT_SMP + void __init arch_init_ipiirq(int irq, struct irqaction *action) + { +@@ -315,23 +320,19 @@ static struct irqaction irq_call = { + asmlinkage void plat_irq_dispatch(void) + { + unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; +- unsigned int i; ++ int irq; + +- if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) { +- do_IRQ(MIPS_CPU_TIMER_IRQ); +- goto out; +- } else { +- for (i = 0; i < MAX_IM; i++) { +- if (pending & (CAUSEF_IP2 << i)) { +- ltq_hw_irqdispatch(i); +- goto out; +- } +- } ++ if (!pending) { ++ spurious_interrupt(); ++ return; + } +- pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status()); + +-out: +- return; ++ pending >>= CAUSEB_IP; ++ while (pending) { ++ irq = fls(pending) - 1; ++ do_IRQ(MIPS_CPU_IRQ_BASE + irq); ++ pending &= ~BIT(irq); ++ } + } + + static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) +@@ -356,11 +357,6 @@ static const struct irq_domain_ops irq_d + .map = icu_map, + }; + +-static struct irqaction cascade = { +- .handler = no_action, +- .name = "cascade", +-}; +- + int __init icu_of_init(struct device_node *node, struct device_node *parent) + { + struct device_node *eiu_node; +@@ -392,7 +388,7 @@ int __init icu_of_init(struct device_nod + mips_cpu_irq_init(); + + for (i = 0; i < MAX_IM; i++) +- setup_irq(i + 2, &cascade); ++ irq_set_chained_handler(i + 2, ltq_hw_irq_handler); + + if (cpu_has_vint) { + pr_info("Setting up vectored interrupts\n"); diff --git a/target/linux/lantiq/patches-4.9/0061-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch b/target/linux/lantiq/patches-4.9/0061-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch new file mode 100644 index 000000000..4d1844394 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0061-USB-DWC2-make-the-lantiq-settings-match-vendor-drive.patch @@ -0,0 +1,130 @@ +From de2cad82c4d0872066f83ce59462603852b47f03 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Fri, 6 Jan 2017 17:55:24 +0100 +Subject: [PATCH 2/2] usb: dwc2: add support for other Lantiq SoCs + +The size of the internal RAM of the DesignWare USB controller changed +between the different Lantiq SoCs. We have the following sizes: + +Amazon + Danube: 8 KByte +Amazon SE + arx100: 2 KByte +xrx200 + xrx300: 2.5 KByte + +For Danube SoC we do not provide the params and let the driver decide +to use sane defaults, for the Amazon SE and arx100 we use small fifos +and for the xrx200 and xrx300 SCs a little bit bigger periodic fifo. +The auto detection of max_transfer_size and max_packet_count should +work, so remove it. + +Signed-off-by: Hauke Mehrtens +--- + drivers/usb/dwc2/platform.c | 46 ++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 39 insertions(+), 7 deletions(-) + +--- a/drivers/usb/dwc2/platform.c ++++ b/drivers/usb/dwc2/platform.c +@@ -151,7 +151,38 @@ static const struct dwc2_core_params par + .hibernation = -1, + }; + +-static const struct dwc2_core_params params_ltq = { ++static const struct dwc2_core_params params_danube = { ++ .otg_cap = 2, /* non-HNP/non-SRP */ ++ .otg_ver = -1, ++ .dma_enable = -1, ++ .dma_desc_enable = -1, ++ .dma_desc_fs_enable = -1, ++ .speed = -1, ++ .enable_dynamic_fifo = -1, ++ .en_multiple_tx_fifo = -1, ++ .host_rx_fifo_size = -1, ++ .host_nperio_tx_fifo_size = -1, ++ .host_perio_tx_fifo_size = -1, ++ .max_transfer_size = -1, ++ .max_packet_count = -1, ++ .host_channels = -1, ++ .phy_type = -1, ++ .phy_utmi_width = -1, ++ .phy_ulpi_ddr = -1, ++ .phy_ulpi_ext_vbus = -1, ++ .i2c_enable = -1, ++ .ulpi_fs_ls = -1, ++ .host_support_fs_ls_low_power = -1, ++ .host_ls_low_power_phy_clk = -1, ++ .ts_dline = -1, ++ .reload_ctl = -1, ++ .ahbcfg = -1, ++ .uframe_sched = -1, ++ .external_id_pin_ctl = -1, ++ .hibernation = -1, ++}; ++ ++static const struct dwc2_core_params params_ase = { + .otg_cap = 2, /* non-HNP/non-SRP */ + .otg_ver = -1, + .dma_enable = -1, +@@ -163,8 +194,8 @@ static const struct dwc2_core_params par + .host_rx_fifo_size = 288, /* 288 DWORDs */ + .host_nperio_tx_fifo_size = 128, /* 128 DWORDs */ + .host_perio_tx_fifo_size = 96, /* 96 DWORDs */ +- .max_transfer_size = 65535, +- .max_packet_count = 511, ++ .max_transfer_size = -1, ++ .max_packet_count = -1, + .host_channels = -1, + .phy_type = -1, + .phy_utmi_width = -1, +@@ -176,8 +207,37 @@ static const struct dwc2_core_params par + .host_ls_low_power_phy_clk = -1, + .ts_dline = -1, + .reload_ctl = -1, +- .ahbcfg = GAHBCFG_HBSTLEN_INCR16 << +- GAHBCFG_HBSTLEN_SHIFT, ++ .ahbcfg = -1, ++ .uframe_sched = -1, ++ .external_id_pin_ctl = -1, ++ .hibernation = -1, ++}; ++ ++static const struct dwc2_core_params params_xrx200 = { ++ .otg_cap = 2, /* non-HNP/non-SRP */ ++ .otg_ver = -1, ++ .dma_enable = -1, ++ .dma_desc_enable = -1, ++ .speed = -1, ++ .enable_dynamic_fifo = -1, ++ .en_multiple_tx_fifo = -1, ++ .host_rx_fifo_size = 288, /* 288 DWORDs */ ++ .host_nperio_tx_fifo_size = 128, /* 128 DWORDs */ ++ .host_perio_tx_fifo_size = 136, /* 136 DWORDs */ ++ .max_transfer_size = -1, ++ .max_packet_count = -1, ++ .host_channels = -1, ++ .phy_type = -1, ++ .phy_utmi_width = -1, ++ .phy_ulpi_ddr = -1, ++ .phy_ulpi_ext_vbus = -1, ++ .i2c_enable = -1, ++ .ulpi_fs_ls = -1, ++ .host_support_fs_ls_low_power = -1, ++ .host_ls_low_power_phy_clk = -1, ++ .ts_dline = -1, ++ .reload_ctl = -1, ++ .ahbcfg = -1, + .uframe_sched = -1, + .external_id_pin_ctl = -1, + .hibernation = -1, +@@ -515,8 +575,11 @@ static const struct of_device_id dwc2_of + { .compatible = "brcm,bcm2835-usb", .data = ¶ms_bcm2835 }, + { .compatible = "hisilicon,hi6220-usb", .data = ¶ms_hi6220 }, + { .compatible = "rockchip,rk3066-usb", .data = ¶ms_rk3066 }, +- { .compatible = "lantiq,arx100-usb", .data = ¶ms_ltq }, +- { .compatible = "lantiq,xrx200-usb", .data = ¶ms_ltq }, ++ { .compatible = "lantiq,danube-usb", .data = ¶ms_danube }, ++ { .compatible = "lantiq,ase-usb", .data = ¶ms_ase }, ++ { .compatible = "lantiq,arx100-usb", .data = ¶ms_ase }, ++ { .compatible = "lantiq,xrx200-usb", .data = ¶ms_xrx200 }, ++ { .compatible = "lantiq,xrx300-usb", .data = ¶ms_xrx200 }, + { .compatible = "snps,dwc2", .data = NULL }, + { .compatible = "samsung,s3c6400-hsotg", .data = NULL}, + { .compatible = "amlogic,meson8b-usb", .data = ¶ms_amlogic }, diff --git a/target/linux/lantiq/patches-4.9/0065-MIPS-lantiq-improve-USB-initialization.patch b/target/linux/lantiq/patches-4.9/0065-MIPS-lantiq-improve-USB-initialization.patch new file mode 100644 index 000000000..acc23080f --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0065-MIPS-lantiq-improve-USB-initialization.patch @@ -0,0 +1,202 @@ +From 14909c4e4e836925668e74fc6e0e85ba0283cbf9 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Fri, 6 Jan 2017 17:40:12 +0100 +Subject: [PATCH 2/2] MIPS: lantiq: improve USB initialization + +This adds code to initialize the USB controller and PHY also on Danube, +Amazon SE and AR10. This code is based on the Vendor driver from +different UGW versions and compared to the hardware documentation. + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/lantiq/xway/reset.c | 120 ++++++++++++++++++++++++++++++---------- + arch/mips/lantiq/xway/sysctrl.c | 20 +++++++ + 2 files changed, 110 insertions(+), 30 deletions(-) + +--- a/arch/mips/lantiq/xway/reset.c ++++ b/arch/mips/lantiq/xway/reset.c +@@ -72,6 +72,8 @@ + #define RCU_USBCFG_HDSEL_BIT BIT(11) + #define RCU_USBCFG_HOST_END_BIT BIT(10) + #define RCU_USBCFG_SLV_END_BIT BIT(9) ++#define RCU_USBCFG_SLV_END_BIT_AR9 BIT(17) ++ + + /* USB reset bits */ + #define RCU_USBRESET 0x0010 +@@ -85,6 +87,8 @@ + + #define RCU_CFG1A 0x0038 + #define RCU_CFG1B 0x003C ++#define RCU_CFG1_TX_PEE BIT(0) ++#define RCU_CFG1_DIS_THR_SHIFT 15 /* Disconnect Threshold */ + + /* USB PMU devices */ + #define PMU_AHBM BIT(15) +@@ -306,38 +310,91 @@ static void ltq_usb_init(void) + /* Power for USB cores 1 & 2 */ + ltq_pmu_enable(PMU_AHBM); + ltq_pmu_enable(PMU_USB0); +- ltq_pmu_enable(PMU_USB1); + +- ltq_rcu_w32(ltq_rcu_r32(RCU_CFG1A) | BIT(0), RCU_CFG1A); +- ltq_rcu_w32(ltq_rcu_r32(RCU_CFG1B) | BIT(0), RCU_CFG1B); ++ if (of_machine_is_compatible("lantiq,ar10") || ++ of_machine_is_compatible("lantiq,grx390") || ++ of_machine_is_compatible("lantiq,ar9") || ++ of_machine_is_compatible("lantiq,vr9")) ++ ltq_pmu_enable(PMU_USB1); ++ ++ if (of_machine_is_compatible("lantiq,vr9") || ++ of_machine_is_compatible("lantiq,ar10")) { ++ ltq_rcu_w32(ltq_rcu_r32(RCU_CFG1A) | RCU_CFG1_TX_PEE | ++ 7 << RCU_CFG1_DIS_THR_SHIFT, RCU_CFG1A); ++ ltq_rcu_w32(ltq_rcu_r32(RCU_CFG1B) | RCU_CFG1_TX_PEE | ++ 7 << RCU_CFG1_DIS_THR_SHIFT, RCU_CFG1B); ++ } + + /* Enable USB PHY power for cores 1 & 2 */ + ltq_pmu_enable(PMU_USB0_P); +- ltq_pmu_enable(PMU_USB1_P); ++ if (of_machine_is_compatible("lantiq,ar10") || ++ of_machine_is_compatible("lantiq,grx390") || ++ of_machine_is_compatible("lantiq,ar9") || ++ of_machine_is_compatible("lantiq,vr9")) ++ ltq_pmu_enable(PMU_USB1_P); ++ ++ if (of_machine_is_compatible("lantiq,ase") || ++ of_machine_is_compatible("lantiq,danube")) { ++ /* Configure cores to host mode */ ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_HDSEL_BIT, ++ RCU_USB1CFG); ++ ++ /* Select DMA endianness (Host-endian: big-endian) */ ++ ltq_rcu_w32((ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_SLV_END_BIT) ++ | RCU_USBCFG_HOST_END_BIT, RCU_USB1CFG); ++ } ++ ++ if (of_machine_is_compatible("lantiq,ar9")) { ++ /* Configure cores to host mode */ ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_HDSEL_BIT, ++ RCU_USB1CFG); ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USB2CFG) & ~RCU_USBCFG_HDSEL_BIT, ++ RCU_USB2CFG); ++ ++ /* Select DMA endianness (Host-endian: big-endian) */ ++ ltq_rcu_w32((ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_SLV_END_BIT_AR9) ++ | RCU_USBCFG_HOST_END_BIT, RCU_USB1CFG); ++ ltq_rcu_w32(ltq_rcu_r32((RCU_USB2CFG) & ~RCU_USBCFG_SLV_END_BIT_AR9) ++ | RCU_USBCFG_HOST_END_BIT, RCU_USB2CFG); ++ } ++ ++ if (of_machine_is_compatible("lantiq,vr9") || ++ of_machine_is_compatible("lantiq,ar10")) { ++ /* Configure cores to host mode */ ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_HDSEL_BIT, ++ RCU_USB1CFG); ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USB2CFG) & ~RCU_USBCFG_HDSEL_BIT, ++ RCU_USB2CFG); ++ ++ /* Select DMA endianness (Host-endian: big-endian) */ ++ ltq_rcu_w32((ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_SLV_END_BIT) ++ | RCU_USBCFG_HOST_END_BIT, RCU_USB1CFG); ++ ltq_rcu_w32(ltq_rcu_r32((RCU_USB2CFG) & ~RCU_USBCFG_SLV_END_BIT) ++ | RCU_USBCFG_HOST_END_BIT, RCU_USB2CFG); ++ } ++ ++ if (of_machine_is_compatible("lantiq,ar9")) { ++ /* Hard reset USB state machines */ ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) ++ | USBRESET_BIT | BIT(28), RCU_USBRESET); ++ udelay(50 * 1000); ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) ++ & ~(USBRESET_BIT | BIT(28)), RCU_USBRESET); ++ } else { ++ /* Hard reset USB state machines */ ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) | USBRESET_BIT, RCU_USBRESET); ++ udelay(50 * 1000); ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) & ~USBRESET_BIT, RCU_USBRESET); ++ } + +- /* Configure cores to host mode */ +- ltq_rcu_w32(ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_HDSEL_BIT, +- RCU_USB1CFG); +- ltq_rcu_w32(ltq_rcu_r32(RCU_USB2CFG) & ~RCU_USBCFG_HDSEL_BIT, +- RCU_USB2CFG); +- +- /* Select DMA endianness (Host-endian: big-endian) */ +- ltq_rcu_w32((ltq_rcu_r32(RCU_USB1CFG) & ~RCU_USBCFG_SLV_END_BIT) +- | RCU_USBCFG_HOST_END_BIT, RCU_USB1CFG); +- ltq_rcu_w32(ltq_rcu_r32((RCU_USB2CFG) & ~RCU_USBCFG_SLV_END_BIT) +- | RCU_USBCFG_HOST_END_BIT, RCU_USB2CFG); +- +- /* Hard reset USB state machines */ +- ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) | USBRESET_BIT, RCU_USBRESET); +- udelay(50 * 1000); +- ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET) & ~USBRESET_BIT, RCU_USBRESET); +- +- /* Soft reset USB state machines */ +- ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET2) +- | USB1RESET_BIT | USB2RESET_BIT, RCU_USBRESET2); +- udelay(50 * 1000); +- ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET2) +- & ~(USB1RESET_BIT | USB2RESET_BIT), RCU_USBRESET2); ++ if (of_machine_is_compatible("lantiq,vr9")) { ++ /* Soft reset USB state machines */ ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET2) ++ | USB1RESET_BIT | USB2RESET_BIT, RCU_USBRESET2); ++ udelay(50 * 1000); ++ ltq_rcu_w32(ltq_rcu_r32(RCU_USBRESET2) ++ & ~(USB1RESET_BIT | USB2RESET_BIT), RCU_USBRESET2); ++ } + } + + static int __init mips_reboot_setup(void) +@@ -363,8 +420,11 @@ static int __init mips_reboot_setup(void + if (!ltq_rcu_membase) + panic("Failed to remap core memory"); + +- if (of_machine_is_compatible("lantiq,ar9") || +- of_machine_is_compatible("lantiq,vr9")) ++ if (of_machine_is_compatible("lantiq,danube") || ++ of_machine_is_compatible("lantiq,ase") || ++ of_machine_is_compatible("lantiq,ar9") || ++ of_machine_is_compatible("lantiq,vr9") || ++ of_machine_is_compatible("lantiq,ar10")) + ltq_usb_init(); + + if (of_machine_is_compatible("lantiq,vr9")) +--- a/arch/mips/lantiq/xway/sysctrl.c ++++ b/arch/mips/lantiq/xway/sysctrl.c +@@ -254,6 +254,25 @@ static void pmu_disable(struct clk *clk) + pr_warn("deactivating PMU module failed!"); + } + ++static void usb_set_clock(void) ++{ ++ unsigned int val = ltq_cgu_r32(ifccr); ++ ++ if (of_machine_is_compatible("lantiq,ar10") || ++ of_machine_is_compatible("lantiq,grx390")) { ++ val &= ~0x03; /* XTAL divided by 3 */ ++ } else if (of_machine_is_compatible("lantiq,ar9") || ++ of_machine_is_compatible("lantiq,vr9")) { ++ /* TODO: this depends on the XTAL frequency */ ++ val |= 0x03; /* XTAL divided by 3 */ ++ } else if (of_machine_is_compatible("lantiq,ase")) { ++ val |= 0x20; /* from XTAL */ ++ } else if (of_machine_is_compatible("lantiq,danube")) { ++ val |= 0x30; /* 12 MHz, generated from 36 MHz */ ++ } ++ ltq_cgu_w32(val, ifccr); ++} ++ + /* the pci enable helper */ + static int pci_enable(struct clk *clk) + { +@@ -608,4 +627,5 @@ void __init ltq_soc_init(void) + + if (of_machine_is_compatible("lantiq,vr9")) + xbar_fpi_burst_disable(); ++ usb_set_clock(); + } diff --git a/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch b/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch new file mode 100644 index 000000000..da48ae3a1 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0090-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-contro.patch @@ -0,0 +1,1078 @@ +From 941ab0bc001fe24e5f8ce88eed27f2a1b89f3e20 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Tue, 14 Feb 2017 00:31:11 +0100 +Subject: spi: lantiq-ssc: add support for Lantiq SSC SPI controller + +This driver supports the Lantiq SSC SPI controller in master +mode. This controller is found on Intel (former Lantiq) SoCs like +the Danube, Falcon, xRX200, xRX300. + +The hardware uses two hardware FIFOs one for received and one for +transferred bytes. When the driver writes data into the transmit FIFO +the complete word is taken from the FIFO into a shift register. The +data from this shift register is then written to the wire. This driver +uses the interrupts signaling the status of the FIFOs and not the shift +register. It is also possible to use the interrupts for the shift +register, but they will send a signal after every word. When using the +interrupts for the shift register we get a signal when the last word is +written into the shift register and not when it is written to the wire. +After all FIFOs are empty the driver busy waits till the hardware is +not busy any more and returns the transfer status. + +Signed-off-by: Daniel Schwierzeck +Signed-off-by: Hauke Mehrtens +Signed-off-by: Mark Brown +--- + .../devicetree/bindings/spi/spi-lantiq-ssc.txt | 29 + + drivers/spi/Kconfig | 8 + + drivers/spi/Makefile | 1 + + drivers/spi/spi-lantiq-ssc.c | 983 +++++++++++++++++++++ + 4 files changed, 1021 insertions(+) + create mode 100644 Documentation/devicetree/bindings/spi/spi-lantiq-ssc.txt + create mode 100644 drivers/spi/spi-lantiq-ssc.c + +--- /dev/null ++++ b/Documentation/devicetree/bindings/spi/spi-lantiq-ssc.txt +@@ -0,0 +1,29 @@ ++Lantiq Synchronous Serial Controller (SSC) SPI master driver ++ ++Required properties: ++- compatible: "lantiq,ase-spi", "lantiq,falcon-spi", "lantiq,xrx100-spi" ++- #address-cells: see spi-bus.txt ++- #size-cells: see spi-bus.txt ++- reg: address and length of the spi master registers ++- interrupts: should contain the "spi_rx", "spi_tx" and "spi_err" interrupt. ++ ++ ++Optional properties: ++- clocks: spi clock phandle ++- num-cs: see spi-bus.txt, set to 8 if unset ++- base-cs: the number of the first chip select, set to 1 if unset. ++ ++Example: ++ ++ ++spi: spi@E100800 { ++ compatible = "lantiq,xrx200-spi", "lantiq,xrx100-spi"; ++ reg = <0xE100800 0x100>; ++ interrupt-parent = <&icu0>; ++ interrupts = <22 23 24>; ++ interrupt-names = "spi_rx", "spi_tx", "spi_err"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ num-cs = <6>; ++ base-cs = <1>; ++}; +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -403,6 +403,14 @@ config SPI_NUC900 + help + SPI driver for Nuvoton NUC900 series ARM SoCs + ++config SPI_LANTIQ_SSC ++ tristate "Lantiq SSC SPI controller" ++ depends on LANTIQ ++ help ++ This driver supports the Lantiq SSC SPI controller in master ++ mode. This controller is found on Intel (former Lantiq) SoCs like ++ the Danube, Falcon, xRX200, xRX300. ++ + config SPI_OC_TINY + tristate "OpenCores tiny SPI" + depends on GPIOLIB || COMPILE_TEST +--- a/drivers/spi/Makefile ++++ b/drivers/spi/Makefile +@@ -47,6 +47,7 @@ obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-sp + obj-$(CONFIG_SPI_GPIO) += spi-gpio.o + obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o + obj-$(CONFIG_SPI_IMX) += spi-imx.o ++obj-$(CONFIG_SPI_LANTIQ_SSC) += spi-lantiq-ssc.o + obj-$(CONFIG_SPI_JCORE) += spi-jcore.o + obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o + obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o +--- /dev/null ++++ b/drivers/spi/spi-lantiq-ssc.c +@@ -0,0 +1,983 @@ ++/* ++ * Copyright (C) 2011-2015 Daniel Schwierzeck ++ * Copyright (C) 2016 Hauke Mehrtens ++ * ++ * This program is free software; you can distribute it and/or modify it ++ * under the terms of the GNU General Public License (Version 2) as ++ * published by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef CONFIG_LANTIQ ++#include ++#endif ++ ++#define SPI_RX_IRQ_NAME "spi_rx" ++#define SPI_TX_IRQ_NAME "spi_tx" ++#define SPI_ERR_IRQ_NAME "spi_err" ++#define SPI_FRM_IRQ_NAME "spi_frm" ++ ++#define SPI_CLC 0x00 ++#define SPI_PISEL 0x04 ++#define SPI_ID 0x08 ++#define SPI_CON 0x10 ++#define SPI_STAT 0x14 ++#define SPI_WHBSTATE 0x18 ++#define SPI_TB 0x20 ++#define SPI_RB 0x24 ++#define SPI_RXFCON 0x30 ++#define SPI_TXFCON 0x34 ++#define SPI_FSTAT 0x38 ++#define SPI_BRT 0x40 ++#define SPI_BRSTAT 0x44 ++#define SPI_SFCON 0x60 ++#define SPI_SFSTAT 0x64 ++#define SPI_GPOCON 0x70 ++#define SPI_GPOSTAT 0x74 ++#define SPI_FPGO 0x78 ++#define SPI_RXREQ 0x80 ++#define SPI_RXCNT 0x84 ++#define SPI_DMACON 0xec ++#define SPI_IRNEN 0xf4 ++#define SPI_IRNICR 0xf8 ++#define SPI_IRNCR 0xfc ++ ++#define SPI_CLC_SMC_S 16 /* Clock divider for sleep mode */ ++#define SPI_CLC_SMC_M (0xFF << SPI_CLC_SMC_S) ++#define SPI_CLC_RMC_S 8 /* Clock divider for normal run mode */ ++#define SPI_CLC_RMC_M (0xFF << SPI_CLC_RMC_S) ++#define SPI_CLC_DISS BIT(1) /* Disable status bit */ ++#define SPI_CLC_DISR BIT(0) /* Disable request bit */ ++ ++#define SPI_ID_TXFS_S 24 /* Implemented TX FIFO size */ ++#define SPI_ID_TXFS_M (0x3F << SPI_ID_TXFS_S) ++#define SPI_ID_RXFS_S 16 /* Implemented RX FIFO size */ ++#define SPI_ID_RXFS_M (0x3F << SPI_ID_RXFS_S) ++#define SPI_ID_MOD_S 8 /* Module ID */ ++#define SPI_ID_MOD_M (0xff << SPI_ID_MOD_S) ++#define SPI_ID_CFG_S 5 /* DMA interface support */ ++#define SPI_ID_CFG_M (1 << SPI_ID_CFG_S) ++#define SPI_ID_REV_M 0x1F /* Hardware revision number */ ++ ++#define SPI_CON_BM_S 16 /* Data width selection */ ++#define SPI_CON_BM_M (0x1F << SPI_CON_BM_S) ++#define SPI_CON_EM BIT(24) /* Echo mode */ ++#define SPI_CON_IDLE BIT(23) /* Idle bit value */ ++#define SPI_CON_ENBV BIT(22) /* Enable byte valid control */ ++#define SPI_CON_RUEN BIT(12) /* Receive underflow error enable */ ++#define SPI_CON_TUEN BIT(11) /* Transmit underflow error enable */ ++#define SPI_CON_AEN BIT(10) /* Abort error enable */ ++#define SPI_CON_REN BIT(9) /* Receive overflow error enable */ ++#define SPI_CON_TEN BIT(8) /* Transmit overflow error enable */ ++#define SPI_CON_LB BIT(7) /* Loopback control */ ++#define SPI_CON_PO BIT(6) /* Clock polarity control */ ++#define SPI_CON_PH BIT(5) /* Clock phase control */ ++#define SPI_CON_HB BIT(4) /* Heading control */ ++#define SPI_CON_RXOFF BIT(1) /* Switch receiver off */ ++#define SPI_CON_TXOFF BIT(0) /* Switch transmitter off */ ++ ++#define SPI_STAT_RXBV_S 28 ++#define SPI_STAT_RXBV_M (0x7 << SPI_STAT_RXBV_S) ++#define SPI_STAT_BSY BIT(13) /* Busy flag */ ++#define SPI_STAT_RUE BIT(12) /* Receive underflow error flag */ ++#define SPI_STAT_TUE BIT(11) /* Transmit underflow error flag */ ++#define SPI_STAT_AE BIT(10) /* Abort error flag */ ++#define SPI_STAT_RE BIT(9) /* Receive error flag */ ++#define SPI_STAT_TE BIT(8) /* Transmit error flag */ ++#define SPI_STAT_ME BIT(7) /* Mode error flag */ ++#define SPI_STAT_MS BIT(1) /* Master/slave select bit */ ++#define SPI_STAT_EN BIT(0) /* Enable bit */ ++#define SPI_STAT_ERRORS (SPI_STAT_ME | SPI_STAT_TE | SPI_STAT_RE | \ ++ SPI_STAT_AE | SPI_STAT_TUE | SPI_STAT_RUE) ++ ++#define SPI_WHBSTATE_SETTUE BIT(15) /* Set transmit underflow error flag */ ++#define SPI_WHBSTATE_SETAE BIT(14) /* Set abort error flag */ ++#define SPI_WHBSTATE_SETRE BIT(13) /* Set receive error flag */ ++#define SPI_WHBSTATE_SETTE BIT(12) /* Set transmit error flag */ ++#define SPI_WHBSTATE_CLRTUE BIT(11) /* Clear transmit underflow error flag */ ++#define SPI_WHBSTATE_CLRAE BIT(10) /* Clear abort error flag */ ++#define SPI_WHBSTATE_CLRRE BIT(9) /* Clear receive error flag */ ++#define SPI_WHBSTATE_CLRTE BIT(8) /* Clear transmit error flag */ ++#define SPI_WHBSTATE_SETME BIT(7) /* Set mode error flag */ ++#define SPI_WHBSTATE_CLRME BIT(6) /* Clear mode error flag */ ++#define SPI_WHBSTATE_SETRUE BIT(5) /* Set receive underflow error flag */ ++#define SPI_WHBSTATE_CLRRUE BIT(4) /* Clear receive underflow error flag */ ++#define SPI_WHBSTATE_SETMS BIT(3) /* Set master select bit */ ++#define SPI_WHBSTATE_CLRMS BIT(2) /* Clear master select bit */ ++#define SPI_WHBSTATE_SETEN BIT(1) /* Set enable bit (operational mode) */ ++#define SPI_WHBSTATE_CLREN BIT(0) /* Clear enable bit (config mode */ ++#define SPI_WHBSTATE_CLR_ERRORS (SPI_WHBSTATE_CLRRUE | SPI_WHBSTATE_CLRME | \ ++ SPI_WHBSTATE_CLRTE | SPI_WHBSTATE_CLRRE | \ ++ SPI_WHBSTATE_CLRAE | SPI_WHBSTATE_CLRTUE) ++ ++#define SPI_RXFCON_RXFITL_S 8 /* FIFO interrupt trigger level */ ++#define SPI_RXFCON_RXFITL_M (0x3F << SPI_RXFCON_RXFITL_S) ++#define SPI_RXFCON_RXFLU BIT(1) /* FIFO flush */ ++#define SPI_RXFCON_RXFEN BIT(0) /* FIFO enable */ ++ ++#define SPI_TXFCON_TXFITL_S 8 /* FIFO interrupt trigger level */ ++#define SPI_TXFCON_TXFITL_M (0x3F << SPI_TXFCON_TXFITL_S) ++#define SPI_TXFCON_TXFLU BIT(1) /* FIFO flush */ ++#define SPI_TXFCON_TXFEN BIT(0) /* FIFO enable */ ++ ++#define SPI_FSTAT_RXFFL_S 0 ++#define SPI_FSTAT_RXFFL_M (0x3f << SPI_FSTAT_RXFFL_S) ++#define SPI_FSTAT_TXFFL_S 8 ++#define SPI_FSTAT_TXFFL_M (0x3f << SPI_FSTAT_TXFFL_S) ++ ++#define SPI_GPOCON_ISCSBN_S 8 ++#define SPI_GPOCON_INVOUTN_S 0 ++ ++#define SPI_FGPO_SETOUTN_S 8 ++#define SPI_FGPO_CLROUTN_S 0 ++ ++#define SPI_RXREQ_RXCNT_M 0xFFFF /* Receive count value */ ++#define SPI_RXCNT_TODO_M 0xFFFF /* Recevie to-do value */ ++ ++#define SPI_IRNEN_TFI BIT(4) /* TX finished interrupt */ ++#define SPI_IRNEN_F BIT(3) /* Frame end interrupt request */ ++#define SPI_IRNEN_E BIT(2) /* Error end interrupt request */ ++#define SPI_IRNEN_T_XWAY BIT(1) /* Transmit end interrupt request */ ++#define SPI_IRNEN_R_XWAY BIT(0) /* Receive end interrupt request */ ++#define SPI_IRNEN_R_XRX BIT(1) /* Transmit end interrupt request */ ++#define SPI_IRNEN_T_XRX BIT(0) /* Receive end interrupt request */ ++#define SPI_IRNEN_ALL 0x1F ++ ++struct lantiq_ssc_hwcfg { ++ unsigned int irnen_r; ++ unsigned int irnen_t; ++}; ++ ++struct lantiq_ssc_spi { ++ struct spi_master *master; ++ struct device *dev; ++ void __iomem *regbase; ++ struct clk *spi_clk; ++ struct clk *fpi_clk; ++ const struct lantiq_ssc_hwcfg *hwcfg; ++ ++ spinlock_t lock; ++ struct workqueue_struct *wq; ++ struct work_struct work; ++ ++ const u8 *tx; ++ u8 *rx; ++ unsigned int tx_todo; ++ unsigned int rx_todo; ++ unsigned int bits_per_word; ++ unsigned int speed_hz; ++ unsigned int tx_fifo_size; ++ unsigned int rx_fifo_size; ++ unsigned int base_cs; ++}; ++ ++static u32 lantiq_ssc_readl(const struct lantiq_ssc_spi *spi, u32 reg) ++{ ++ return __raw_readl(spi->regbase + reg); ++} ++ ++static void lantiq_ssc_writel(const struct lantiq_ssc_spi *spi, u32 val, ++ u32 reg) ++{ ++ __raw_writel(val, spi->regbase + reg); ++} ++ ++static void lantiq_ssc_maskl(const struct lantiq_ssc_spi *spi, u32 clr, ++ u32 set, u32 reg) ++{ ++ u32 val = __raw_readl(spi->regbase + reg); ++ ++ val &= ~clr; ++ val |= set; ++ __raw_writel(val, spi->regbase + reg); ++} ++ ++static unsigned int tx_fifo_level(const struct lantiq_ssc_spi *spi) ++{ ++ u32 fstat = lantiq_ssc_readl(spi, SPI_FSTAT); ++ ++ return (fstat & SPI_FSTAT_TXFFL_M) >> SPI_FSTAT_TXFFL_S; ++} ++ ++static unsigned int rx_fifo_level(const struct lantiq_ssc_spi *spi) ++{ ++ u32 fstat = lantiq_ssc_readl(spi, SPI_FSTAT); ++ ++ return fstat & SPI_FSTAT_RXFFL_M; ++} ++ ++static unsigned int tx_fifo_free(const struct lantiq_ssc_spi *spi) ++{ ++ return spi->tx_fifo_size - tx_fifo_level(spi); ++} ++ ++static void rx_fifo_reset(const struct lantiq_ssc_spi *spi) ++{ ++ u32 val = spi->rx_fifo_size << SPI_RXFCON_RXFITL_S; ++ ++ val |= SPI_RXFCON_RXFEN | SPI_RXFCON_RXFLU; ++ lantiq_ssc_writel(spi, val, SPI_RXFCON); ++} ++ ++static void tx_fifo_reset(const struct lantiq_ssc_spi *spi) ++{ ++ u32 val = 1 << SPI_TXFCON_TXFITL_S; ++ ++ val |= SPI_TXFCON_TXFEN | SPI_TXFCON_TXFLU; ++ lantiq_ssc_writel(spi, val, SPI_TXFCON); ++} ++ ++static void rx_fifo_flush(const struct lantiq_ssc_spi *spi) ++{ ++ lantiq_ssc_maskl(spi, 0, SPI_RXFCON_RXFLU, SPI_RXFCON); ++} ++ ++static void tx_fifo_flush(const struct lantiq_ssc_spi *spi) ++{ ++ lantiq_ssc_maskl(spi, 0, SPI_TXFCON_TXFLU, SPI_TXFCON); ++} ++ ++static void hw_enter_config_mode(const struct lantiq_ssc_spi *spi) ++{ ++ lantiq_ssc_writel(spi, SPI_WHBSTATE_CLREN, SPI_WHBSTATE); ++} ++ ++static void hw_enter_active_mode(const struct lantiq_ssc_spi *spi) ++{ ++ lantiq_ssc_writel(spi, SPI_WHBSTATE_SETEN, SPI_WHBSTATE); ++} ++ ++static void hw_setup_speed_hz(const struct lantiq_ssc_spi *spi, ++ unsigned int max_speed_hz) ++{ ++ u32 spi_clk, brt; ++ ++ /* ++ * SPI module clock is derived from FPI bus clock dependent on ++ * divider value in CLC.RMS which is always set to 1. ++ * ++ * f_SPI ++ * baudrate = -------------- ++ * 2 * (BR + 1) ++ */ ++ spi_clk = clk_get_rate(spi->fpi_clk) / 2; ++ ++ if (max_speed_hz > spi_clk) ++ brt = 0; ++ else ++ brt = spi_clk / max_speed_hz - 1; ++ ++ if (brt > 0xFFFF) ++ brt = 0xFFFF; ++ ++ dev_dbg(spi->dev, "spi_clk %u, max_speed_hz %u, brt %u\n", ++ spi_clk, max_speed_hz, brt); ++ ++ lantiq_ssc_writel(spi, brt, SPI_BRT); ++} ++ ++static void hw_setup_bits_per_word(const struct lantiq_ssc_spi *spi, ++ unsigned int bits_per_word) ++{ ++ u32 bm; ++ ++ /* CON.BM value = bits_per_word - 1 */ ++ bm = (bits_per_word - 1) << SPI_CON_BM_S; ++ ++ lantiq_ssc_maskl(spi, SPI_CON_BM_M, bm, SPI_CON); ++} ++ ++static void hw_setup_clock_mode(const struct lantiq_ssc_spi *spi, ++ unsigned int mode) ++{ ++ u32 con_set = 0, con_clr = 0; ++ ++ /* ++ * SPI mode mapping in CON register: ++ * Mode CPOL CPHA CON.PO CON.PH ++ * 0 0 0 0 1 ++ * 1 0 1 0 0 ++ * 2 1 0 1 1 ++ * 3 1 1 1 0 ++ */ ++ if (mode & SPI_CPHA) ++ con_clr |= SPI_CON_PH; ++ else ++ con_set |= SPI_CON_PH; ++ ++ if (mode & SPI_CPOL) ++ con_set |= SPI_CON_PO | SPI_CON_IDLE; ++ else ++ con_clr |= SPI_CON_PO | SPI_CON_IDLE; ++ ++ /* Set heading control */ ++ if (mode & SPI_LSB_FIRST) ++ con_clr |= SPI_CON_HB; ++ else ++ con_set |= SPI_CON_HB; ++ ++ /* Set loopback mode */ ++ if (mode & SPI_LOOP) ++ con_set |= SPI_CON_LB; ++ else ++ con_clr |= SPI_CON_LB; ++ ++ lantiq_ssc_maskl(spi, con_clr, con_set, SPI_CON); ++} ++ ++static void lantiq_ssc_hw_init(const struct lantiq_ssc_spi *spi) ++{ ++ const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg; ++ ++ /* ++ * Set clock divider for run mode to 1 to ++ * run at same frequency as FPI bus ++ */ ++ lantiq_ssc_writel(spi, 1 << SPI_CLC_RMC_S, SPI_CLC); ++ ++ /* Put controller into config mode */ ++ hw_enter_config_mode(spi); ++ ++ /* Clear error flags */ ++ lantiq_ssc_maskl(spi, 0, SPI_WHBSTATE_CLR_ERRORS, SPI_WHBSTATE); ++ ++ /* Enable error checking, disable TX/RX */ ++ lantiq_ssc_writel(spi, SPI_CON_RUEN | SPI_CON_AEN | SPI_CON_TEN | ++ SPI_CON_REN | SPI_CON_TXOFF | SPI_CON_RXOFF, SPI_CON); ++ ++ /* Setup default SPI mode */ ++ hw_setup_bits_per_word(spi, spi->bits_per_word); ++ hw_setup_clock_mode(spi, SPI_MODE_0); ++ ++ /* Enable master mode and clear error flags */ ++ lantiq_ssc_writel(spi, SPI_WHBSTATE_SETMS | SPI_WHBSTATE_CLR_ERRORS, ++ SPI_WHBSTATE); ++ ++ /* Reset GPIO/CS registers */ ++ lantiq_ssc_writel(spi, 0, SPI_GPOCON); ++ lantiq_ssc_writel(spi, 0xFF00, SPI_FPGO); ++ ++ /* Enable and flush FIFOs */ ++ rx_fifo_reset(spi); ++ tx_fifo_reset(spi); ++ ++ /* Enable interrupts */ ++ lantiq_ssc_writel(spi, hwcfg->irnen_t | hwcfg->irnen_r | SPI_IRNEN_E, ++ SPI_IRNEN); ++} ++ ++static int lantiq_ssc_setup(struct spi_device *spidev) ++{ ++ struct spi_master *master = spidev->master; ++ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); ++ unsigned int cs = spidev->chip_select; ++ u32 gpocon; ++ ++ /* GPIOs are used for CS */ ++ if (gpio_is_valid(spidev->cs_gpio)) ++ return 0; ++ ++ dev_dbg(spi->dev, "using internal chipselect %u\n", cs); ++ ++ if (cs < spi->base_cs) { ++ dev_err(spi->dev, ++ "chipselect %i too small (min %i)\n", cs, spi->base_cs); ++ return -EINVAL; ++ } ++ ++ /* set GPO pin to CS mode */ ++ gpocon = 1 << ((cs - spi->base_cs) + SPI_GPOCON_ISCSBN_S); ++ ++ /* invert GPO pin */ ++ if (spidev->mode & SPI_CS_HIGH) ++ gpocon |= 1 << (cs - spi->base_cs); ++ ++ lantiq_ssc_maskl(spi, 0, gpocon, SPI_GPOCON); ++ ++ return 0; ++} ++ ++static int lantiq_ssc_prepare_message(struct spi_master *master, ++ struct spi_message *message) ++{ ++ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); ++ ++ hw_enter_config_mode(spi); ++ hw_setup_clock_mode(spi, message->spi->mode); ++ hw_enter_active_mode(spi); ++ ++ return 0; ++} ++ ++static void hw_setup_transfer(struct lantiq_ssc_spi *spi, ++ struct spi_device *spidev, struct spi_transfer *t) ++{ ++ unsigned int speed_hz = t->speed_hz; ++ unsigned int bits_per_word = t->bits_per_word; ++ u32 con; ++ ++ if (bits_per_word != spi->bits_per_word || ++ speed_hz != spi->speed_hz) { ++ hw_enter_config_mode(spi); ++ hw_setup_speed_hz(spi, speed_hz); ++ hw_setup_bits_per_word(spi, bits_per_word); ++ hw_enter_active_mode(spi); ++ ++ spi->speed_hz = speed_hz; ++ spi->bits_per_word = bits_per_word; ++ } ++ ++ /* Configure transmitter and receiver */ ++ con = lantiq_ssc_readl(spi, SPI_CON); ++ if (t->tx_buf) ++ con &= ~SPI_CON_TXOFF; ++ else ++ con |= SPI_CON_TXOFF; ++ ++ if (t->rx_buf) ++ con &= ~SPI_CON_RXOFF; ++ else ++ con |= SPI_CON_RXOFF; ++ ++ lantiq_ssc_writel(spi, con, SPI_CON); ++} ++ ++static int lantiq_ssc_unprepare_message(struct spi_master *master, ++ struct spi_message *message) ++{ ++ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); ++ ++ flush_workqueue(spi->wq); ++ ++ /* Disable transmitter and receiver while idle */ ++ lantiq_ssc_maskl(spi, 0, SPI_CON_TXOFF | SPI_CON_RXOFF, SPI_CON); ++ ++ return 0; ++} ++ ++static void tx_fifo_write(struct lantiq_ssc_spi *spi) ++{ ++ const u8 *tx8; ++ const u16 *tx16; ++ const u32 *tx32; ++ u32 data; ++ unsigned int tx_free = tx_fifo_free(spi); ++ ++ while (spi->tx_todo && tx_free) { ++ switch (spi->bits_per_word) { ++ case 2 ... 8: ++ tx8 = spi->tx; ++ data = *tx8; ++ spi->tx_todo--; ++ spi->tx++; ++ break; ++ case 16: ++ tx16 = (u16 *) spi->tx; ++ data = *tx16; ++ spi->tx_todo -= 2; ++ spi->tx += 2; ++ break; ++ case 32: ++ tx32 = (u32 *) spi->tx; ++ data = *tx32; ++ spi->tx_todo -= 4; ++ spi->tx += 4; ++ break; ++ default: ++ WARN_ON(1); ++ data = 0; ++ break; ++ } ++ ++ lantiq_ssc_writel(spi, data, SPI_TB); ++ tx_free--; ++ } ++} ++ ++static void rx_fifo_read_full_duplex(struct lantiq_ssc_spi *spi) ++{ ++ u8 *rx8; ++ u16 *rx16; ++ u32 *rx32; ++ u32 data; ++ unsigned int rx_fill = rx_fifo_level(spi); ++ ++ while (rx_fill) { ++ data = lantiq_ssc_readl(spi, SPI_RB); ++ ++ switch (spi->bits_per_word) { ++ case 2 ... 8: ++ rx8 = spi->rx; ++ *rx8 = data; ++ spi->rx_todo--; ++ spi->rx++; ++ break; ++ case 16: ++ rx16 = (u16 *) spi->rx; ++ *rx16 = data; ++ spi->rx_todo -= 2; ++ spi->rx += 2; ++ break; ++ case 32: ++ rx32 = (u32 *) spi->rx; ++ *rx32 = data; ++ spi->rx_todo -= 4; ++ spi->rx += 4; ++ break; ++ default: ++ WARN_ON(1); ++ break; ++ } ++ ++ rx_fill--; ++ } ++} ++ ++static void rx_fifo_read_half_duplex(struct lantiq_ssc_spi *spi) ++{ ++ u32 data, *rx32; ++ u8 *rx8; ++ unsigned int rxbv, shift; ++ unsigned int rx_fill = rx_fifo_level(spi); ++ ++ /* ++ * In RX-only mode the bits per word value is ignored by HW. A value ++ * of 32 is used instead. Thus all 4 bytes per FIFO must be read. ++ * If remaining RX bytes are less than 4, the FIFO must be read ++ * differently. The amount of received and valid bytes is indicated ++ * by STAT.RXBV register value. ++ */ ++ while (rx_fill) { ++ if (spi->rx_todo < 4) { ++ rxbv = (lantiq_ssc_readl(spi, SPI_STAT) & ++ SPI_STAT_RXBV_M) >> SPI_STAT_RXBV_S; ++ data = lantiq_ssc_readl(spi, SPI_RB); ++ ++ shift = (rxbv - 1) * 8; ++ rx8 = spi->rx; ++ ++ while (rxbv) { ++ *rx8++ = (data >> shift) & 0xFF; ++ rxbv--; ++ shift -= 8; ++ spi->rx_todo--; ++ spi->rx++; ++ } ++ } else { ++ data = lantiq_ssc_readl(spi, SPI_RB); ++ rx32 = (u32 *) spi->rx; ++ ++ *rx32++ = data; ++ spi->rx_todo -= 4; ++ spi->rx += 4; ++ } ++ rx_fill--; ++ } ++} ++ ++static void rx_request(struct lantiq_ssc_spi *spi) ++{ ++ unsigned int rxreq, rxreq_max; ++ ++ /* ++ * To avoid receive overflows at high clocks it is better to request ++ * only the amount of bytes that fits into all FIFOs. This value ++ * depends on the FIFO size implemented in hardware. ++ */ ++ rxreq = spi->rx_todo; ++ rxreq_max = spi->rx_fifo_size * 4; ++ if (rxreq > rxreq_max) ++ rxreq = rxreq_max; ++ ++ lantiq_ssc_writel(spi, rxreq, SPI_RXREQ); ++} ++ ++static irqreturn_t lantiq_ssc_xmit_interrupt(int irq, void *data) ++{ ++ struct lantiq_ssc_spi *spi = data; ++ ++ if (spi->tx) { ++ if (spi->rx && spi->rx_todo) ++ rx_fifo_read_full_duplex(spi); ++ ++ if (spi->tx_todo) ++ tx_fifo_write(spi); ++ else if (!tx_fifo_level(spi)) ++ goto completed; ++ } else if (spi->rx) { ++ if (spi->rx_todo) { ++ rx_fifo_read_half_duplex(spi); ++ ++ if (spi->rx_todo) ++ rx_request(spi); ++ else ++ goto completed; ++ } else { ++ goto completed; ++ } ++ } ++ ++ return IRQ_HANDLED; ++ ++completed: ++ queue_work(spi->wq, &spi->work); ++ ++ return IRQ_HANDLED; ++} ++ ++static irqreturn_t lantiq_ssc_err_interrupt(int irq, void *data) ++{ ++ struct lantiq_ssc_spi *spi = data; ++ u32 stat = lantiq_ssc_readl(spi, SPI_STAT); ++ ++ if (!(stat & SPI_STAT_ERRORS)) ++ return IRQ_NONE; ++ ++ if (stat & SPI_STAT_RUE) ++ dev_err(spi->dev, "receive underflow error\n"); ++ if (stat & SPI_STAT_TUE) ++ dev_err(spi->dev, "transmit underflow error\n"); ++ if (stat & SPI_STAT_AE) ++ dev_err(spi->dev, "abort error\n"); ++ if (stat & SPI_STAT_RE) ++ dev_err(spi->dev, "receive overflow error\n"); ++ if (stat & SPI_STAT_TE) ++ dev_err(spi->dev, "transmit overflow error\n"); ++ if (stat & SPI_STAT_ME) ++ dev_err(spi->dev, "mode error\n"); ++ ++ /* Clear error flags */ ++ lantiq_ssc_maskl(spi, 0, SPI_WHBSTATE_CLR_ERRORS, SPI_WHBSTATE); ++ ++ /* set bad status so it can be retried */ ++ if (spi->master->cur_msg) ++ spi->master->cur_msg->status = -EIO; ++ queue_work(spi->wq, &spi->work); ++ ++ return IRQ_HANDLED; ++} ++ ++static int transfer_start(struct lantiq_ssc_spi *spi, struct spi_device *spidev, ++ struct spi_transfer *t) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&spi->lock, flags); ++ ++ spi->tx = t->tx_buf; ++ spi->rx = t->rx_buf; ++ ++ if (t->tx_buf) { ++ spi->tx_todo = t->len; ++ ++ /* initially fill TX FIFO */ ++ tx_fifo_write(spi); ++ } ++ ++ if (spi->rx) { ++ spi->rx_todo = t->len; ++ ++ /* start shift clock in RX-only mode */ ++ if (!spi->tx) ++ rx_request(spi); ++ } ++ ++ spin_unlock_irqrestore(&spi->lock, flags); ++ ++ return t->len; ++} ++ ++/* ++ * The driver only gets an interrupt when the FIFO is empty, but there ++ * is an additional shift register from which the data is written to ++ * the wire. We get the last interrupt when the controller starts to ++ * write the last word to the wire, not when it is finished. Do busy ++ * waiting till it finishes. ++ */ ++static void lantiq_ssc_bussy_work(struct work_struct *work) ++{ ++ struct lantiq_ssc_spi *spi; ++ unsigned long long timeout = 8LL * 1000LL; ++ unsigned long end; ++ ++ spi = container_of(work, typeof(*spi), work); ++ ++ do_div(timeout, spi->speed_hz); ++ timeout += timeout + 100; /* some tolerance */ ++ ++ end = jiffies + msecs_to_jiffies(timeout); ++ do { ++ u32 stat = lantiq_ssc_readl(spi, SPI_STAT); ++ ++ if (!(stat & SPI_STAT_BSY)) { ++ spi_finalize_current_transfer(spi->master); ++ return; ++ } ++ ++ cond_resched(); ++ } while (!time_after_eq(jiffies, end)); ++ ++ if (spi->master->cur_msg) ++ spi->master->cur_msg->status = -EIO; ++ spi_finalize_current_transfer(spi->master); ++} ++ ++static void lantiq_ssc_handle_err(struct spi_master *master, ++ struct spi_message *message) ++{ ++ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); ++ ++ /* flush FIFOs on timeout */ ++ rx_fifo_flush(spi); ++ tx_fifo_flush(spi); ++} ++ ++static void lantiq_ssc_set_cs(struct spi_device *spidev, bool enable) ++{ ++ struct lantiq_ssc_spi *spi = spi_master_get_devdata(spidev->master); ++ unsigned int cs = spidev->chip_select; ++ u32 fgpo; ++ ++ if (!!(spidev->mode & SPI_CS_HIGH) == enable) ++ fgpo = (1 << (cs - spi->base_cs)); ++ else ++ fgpo = (1 << (cs - spi->base_cs + SPI_FGPO_SETOUTN_S)); ++ ++ lantiq_ssc_writel(spi, fgpo, SPI_FPGO); ++} ++ ++static int lantiq_ssc_transfer_one(struct spi_master *master, ++ struct spi_device *spidev, ++ struct spi_transfer *t) ++{ ++ struct lantiq_ssc_spi *spi = spi_master_get_devdata(master); ++ ++ hw_setup_transfer(spi, spidev, t); ++ ++ return transfer_start(spi, spidev, t); ++} ++ ++static const struct lantiq_ssc_hwcfg lantiq_ssc_xway = { ++ .irnen_r = SPI_IRNEN_R_XWAY, ++ .irnen_t = SPI_IRNEN_T_XWAY, ++}; ++ ++static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = { ++ .irnen_r = SPI_IRNEN_R_XRX, ++ .irnen_t = SPI_IRNEN_T_XRX, ++}; ++ ++static const struct of_device_id lantiq_ssc_match[] = { ++ { .compatible = "lantiq,ase-spi", .data = &lantiq_ssc_xway, }, ++ { .compatible = "lantiq,falcon-spi", .data = &lantiq_ssc_xrx, }, ++ { .compatible = "lantiq,xrx100-spi", .data = &lantiq_ssc_xrx, }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, lantiq_ssc_match); ++ ++static int lantiq_ssc_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct spi_master *master; ++ struct resource *res; ++ struct lantiq_ssc_spi *spi; ++ const struct lantiq_ssc_hwcfg *hwcfg; ++ const struct of_device_id *match; ++ int err, rx_irq, tx_irq, err_irq; ++ u32 id, supports_dma, revision; ++ unsigned int num_cs; ++ ++ match = of_match_device(lantiq_ssc_match, dev); ++ if (!match) { ++ dev_err(dev, "no device match\n"); ++ return -EINVAL; ++ } ++ hwcfg = match->data; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ dev_err(dev, "failed to get resources\n"); ++ return -ENXIO; ++ } ++ ++ rx_irq = platform_get_irq_byname(pdev, SPI_RX_IRQ_NAME); ++ if (rx_irq < 0) { ++ dev_err(dev, "failed to get %s\n", SPI_RX_IRQ_NAME); ++ return -ENXIO; ++ } ++ ++ tx_irq = platform_get_irq_byname(pdev, SPI_TX_IRQ_NAME); ++ if (tx_irq < 0) { ++ dev_err(dev, "failed to get %s\n", SPI_TX_IRQ_NAME); ++ return -ENXIO; ++ } ++ ++ err_irq = platform_get_irq_byname(pdev, SPI_ERR_IRQ_NAME); ++ if (err_irq < 0) { ++ dev_err(dev, "failed to get %s\n", SPI_ERR_IRQ_NAME); ++ return -ENXIO; ++ } ++ ++ master = spi_alloc_master(dev, sizeof(struct lantiq_ssc_spi)); ++ if (!master) ++ return -ENOMEM; ++ ++ spi = spi_master_get_devdata(master); ++ spi->master = master; ++ spi->dev = dev; ++ spi->hwcfg = hwcfg; ++ platform_set_drvdata(pdev, spi); ++ ++ spi->regbase = devm_ioremap_resource(dev, res); ++ if (IS_ERR(spi->regbase)) { ++ err = PTR_ERR(spi->regbase); ++ goto err_master_put; ++ } ++ ++ err = devm_request_irq(dev, rx_irq, lantiq_ssc_xmit_interrupt, ++ 0, SPI_RX_IRQ_NAME, spi); ++ if (err) ++ goto err_master_put; ++ ++ err = devm_request_irq(dev, tx_irq, lantiq_ssc_xmit_interrupt, ++ 0, SPI_TX_IRQ_NAME, spi); ++ if (err) ++ goto err_master_put; ++ ++ err = devm_request_irq(dev, err_irq, lantiq_ssc_err_interrupt, ++ 0, SPI_ERR_IRQ_NAME, spi); ++ if (err) ++ goto err_master_put; ++ ++ spi->spi_clk = devm_clk_get(dev, "gate"); ++ if (IS_ERR(spi->spi_clk)) { ++ err = PTR_ERR(spi->spi_clk); ++ goto err_master_put; ++ } ++ err = clk_prepare_enable(spi->spi_clk); ++ if (err) ++ goto err_master_put; ++ ++ /* ++ * Use the old clk_get_fpi() function on Lantiq platform, till it ++ * supports common clk. ++ */ ++#if defined(CONFIG_LANTIQ) && !defined(CONFIG_COMMON_CLK) ++ spi->fpi_clk = clk_get_fpi(); ++#else ++ spi->fpi_clk = clk_get(dev, "freq"); ++#endif ++ if (IS_ERR(spi->fpi_clk)) { ++ err = PTR_ERR(spi->fpi_clk); ++ goto err_clk_disable; ++ } ++ ++ num_cs = 8; ++ of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); ++ ++ spi->base_cs = 1; ++ of_property_read_u32(pdev->dev.of_node, "base-cs", &spi->base_cs); ++ ++ spin_lock_init(&spi->lock); ++ spi->bits_per_word = 8; ++ spi->speed_hz = 0; ++ ++ master->dev.of_node = pdev->dev.of_node; ++ master->num_chipselect = num_cs; ++ master->setup = lantiq_ssc_setup; ++ master->set_cs = lantiq_ssc_set_cs; ++ master->handle_err = lantiq_ssc_handle_err; ++ master->prepare_message = lantiq_ssc_prepare_message; ++ master->unprepare_message = lantiq_ssc_unprepare_message; ++ master->transfer_one = lantiq_ssc_transfer_one; ++ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_CS_HIGH | ++ SPI_LOOP; ++ master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) | ++ SPI_BPW_MASK(16) | SPI_BPW_MASK(32); ++ ++ spi->wq = alloc_ordered_workqueue(dev_name(dev), 0); ++ if (!spi->wq) { ++ err = -ENOMEM; ++ goto err_clk_put; ++ } ++ INIT_WORK(&spi->work, lantiq_ssc_bussy_work); ++ ++ id = lantiq_ssc_readl(spi, SPI_ID); ++ spi->tx_fifo_size = (id & SPI_ID_TXFS_M) >> SPI_ID_TXFS_S; ++ spi->rx_fifo_size = (id & SPI_ID_RXFS_M) >> SPI_ID_RXFS_S; ++ supports_dma = (id & SPI_ID_CFG_M) >> SPI_ID_CFG_S; ++ revision = id & SPI_ID_REV_M; ++ ++ lantiq_ssc_hw_init(spi); ++ ++ dev_info(dev, ++ "Lantiq SSC SPI controller (Rev %i, TXFS %u, RXFS %u, DMA %u)\n", ++ revision, spi->tx_fifo_size, spi->rx_fifo_size, supports_dma); ++ ++ err = devm_spi_register_master(dev, master); ++ if (err) { ++ dev_err(dev, "failed to register spi_master\n"); ++ goto err_wq_destroy; ++ } ++ ++ return 0; ++ ++err_wq_destroy: ++ destroy_workqueue(spi->wq); ++err_clk_put: ++ clk_put(spi->fpi_clk); ++err_clk_disable: ++ clk_disable_unprepare(spi->spi_clk); ++err_master_put: ++ spi_master_put(master); ++ ++ return err; ++} ++ ++static int lantiq_ssc_remove(struct platform_device *pdev) ++{ ++ struct lantiq_ssc_spi *spi = platform_get_drvdata(pdev); ++ ++ lantiq_ssc_writel(spi, 0, SPI_IRNEN); ++ lantiq_ssc_writel(spi, 0, SPI_CLC); ++ rx_fifo_flush(spi); ++ tx_fifo_flush(spi); ++ hw_enter_config_mode(spi); ++ ++ destroy_workqueue(spi->wq); ++ clk_disable_unprepare(spi->spi_clk); ++ clk_put(spi->fpi_clk); ++ ++ return 0; ++} ++ ++static struct platform_driver lantiq_ssc_driver = { ++ .probe = lantiq_ssc_probe, ++ .remove = lantiq_ssc_remove, ++ .driver = { ++ .name = "spi-lantiq-ssc", ++ .owner = THIS_MODULE, ++ .of_match_table = lantiq_ssc_match, ++ }, ++}; ++module_platform_driver(lantiq_ssc_driver); ++ ++MODULE_DESCRIPTION("Lantiq SSC SPI controller driver"); ++MODULE_AUTHOR("Daniel Schwierzeck "); ++MODULE_AUTHOR("Hauke Mehrtens "); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:spi-lantiq-ssc"); diff --git a/target/linux/lantiq/patches-4.9/0091-spi-lantiq-ssc-fix-platform_no_drv_owner.cocci-warni.patch b/target/linux/lantiq/patches-4.9/0091-spi-lantiq-ssc-fix-platform_no_drv_owner.cocci-warni.patch new file mode 100644 index 000000000..e81f97f9d --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0091-spi-lantiq-ssc-fix-platform_no_drv_owner.cocci-warni.patch @@ -0,0 +1,28 @@ +From ba6e1e39969fa5435127a632757e2906caca7730 Mon Sep 17 00:00:00 2001 +From: kbuild test robot +Date: Mon, 20 Feb 2017 01:33:10 +0800 +Subject: spi: lantiq-ssc: fix platform_no_drv_owner.cocci warnings + +drivers/spi/spi-lantiq-ssc.c:973:3-8: No need to set .owner here. The core will do it. + + Remove .owner field if calls are used which set it automatically + +Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci + +Signed-off-by: Fengguang Wu +Acked-by: Hauke Mehrtens +Signed-off-by: Mark Brown +--- + drivers/spi/spi-lantiq-ssc.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/spi/spi-lantiq-ssc.c ++++ b/drivers/spi/spi-lantiq-ssc.c +@@ -970,7 +970,6 @@ static struct platform_driver lantiq_ssc + .remove = lantiq_ssc_remove, + .driver = { + .name = "spi-lantiq-ssc", +- .owner = THIS_MODULE, + .of_match_table = lantiq_ssc_match, + }, + }; diff --git a/target/linux/lantiq/patches-4.9/0092-spi-lantiq-ssc-add-LTQ_-prefix-to-defines.patch b/target/linux/lantiq/patches-4.9/0092-spi-lantiq-ssc-add-LTQ_-prefix-to-defines.patch new file mode 100644 index 000000000..9bcde3c08 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0092-spi-lantiq-ssc-add-LTQ_-prefix-to-defines.patch @@ -0,0 +1,723 @@ +From 1aa83e0a2821cd7f4e8f3ddb367859f52e468bf1 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Mon, 27 Feb 2017 23:21:25 +0100 +Subject: spi: lantiq-ssc: add LTQ_ prefix to defines + +The blackfin architecture has a SPI_STAT define which conflicts with +the define from the spi-lantiq-ssc driver in compile test mode. Fix +this by adding a prefix in front of every define. + +Reported-by: kbuild test robot +Signed-off-by: Hauke Mehrtens +Signed-off-by: Mark Brown +--- + drivers/spi/spi-lantiq-ssc.c | 437 ++++++++++++++++++++++--------------------- + 1 file changed, 222 insertions(+), 215 deletions(-) + +--- a/drivers/spi/spi-lantiq-ssc.c ++++ b/drivers/spi/spi-lantiq-ssc.c +@@ -26,136 +26,140 @@ + #include + #endif + +-#define SPI_RX_IRQ_NAME "spi_rx" +-#define SPI_TX_IRQ_NAME "spi_tx" +-#define SPI_ERR_IRQ_NAME "spi_err" +-#define SPI_FRM_IRQ_NAME "spi_frm" +- +-#define SPI_CLC 0x00 +-#define SPI_PISEL 0x04 +-#define SPI_ID 0x08 +-#define SPI_CON 0x10 +-#define SPI_STAT 0x14 +-#define SPI_WHBSTATE 0x18 +-#define SPI_TB 0x20 +-#define SPI_RB 0x24 +-#define SPI_RXFCON 0x30 +-#define SPI_TXFCON 0x34 +-#define SPI_FSTAT 0x38 +-#define SPI_BRT 0x40 +-#define SPI_BRSTAT 0x44 +-#define SPI_SFCON 0x60 +-#define SPI_SFSTAT 0x64 +-#define SPI_GPOCON 0x70 +-#define SPI_GPOSTAT 0x74 +-#define SPI_FPGO 0x78 +-#define SPI_RXREQ 0x80 +-#define SPI_RXCNT 0x84 +-#define SPI_DMACON 0xec +-#define SPI_IRNEN 0xf4 +-#define SPI_IRNICR 0xf8 +-#define SPI_IRNCR 0xfc +- +-#define SPI_CLC_SMC_S 16 /* Clock divider for sleep mode */ +-#define SPI_CLC_SMC_M (0xFF << SPI_CLC_SMC_S) +-#define SPI_CLC_RMC_S 8 /* Clock divider for normal run mode */ +-#define SPI_CLC_RMC_M (0xFF << SPI_CLC_RMC_S) +-#define SPI_CLC_DISS BIT(1) /* Disable status bit */ +-#define SPI_CLC_DISR BIT(0) /* Disable request bit */ +- +-#define SPI_ID_TXFS_S 24 /* Implemented TX FIFO size */ +-#define SPI_ID_TXFS_M (0x3F << SPI_ID_TXFS_S) +-#define SPI_ID_RXFS_S 16 /* Implemented RX FIFO size */ +-#define SPI_ID_RXFS_M (0x3F << SPI_ID_RXFS_S) +-#define SPI_ID_MOD_S 8 /* Module ID */ +-#define SPI_ID_MOD_M (0xff << SPI_ID_MOD_S) +-#define SPI_ID_CFG_S 5 /* DMA interface support */ +-#define SPI_ID_CFG_M (1 << SPI_ID_CFG_S) +-#define SPI_ID_REV_M 0x1F /* Hardware revision number */ +- +-#define SPI_CON_BM_S 16 /* Data width selection */ +-#define SPI_CON_BM_M (0x1F << SPI_CON_BM_S) +-#define SPI_CON_EM BIT(24) /* Echo mode */ +-#define SPI_CON_IDLE BIT(23) /* Idle bit value */ +-#define SPI_CON_ENBV BIT(22) /* Enable byte valid control */ +-#define SPI_CON_RUEN BIT(12) /* Receive underflow error enable */ +-#define SPI_CON_TUEN BIT(11) /* Transmit underflow error enable */ +-#define SPI_CON_AEN BIT(10) /* Abort error enable */ +-#define SPI_CON_REN BIT(9) /* Receive overflow error enable */ +-#define SPI_CON_TEN BIT(8) /* Transmit overflow error enable */ +-#define SPI_CON_LB BIT(7) /* Loopback control */ +-#define SPI_CON_PO BIT(6) /* Clock polarity control */ +-#define SPI_CON_PH BIT(5) /* Clock phase control */ +-#define SPI_CON_HB BIT(4) /* Heading control */ +-#define SPI_CON_RXOFF BIT(1) /* Switch receiver off */ +-#define SPI_CON_TXOFF BIT(0) /* Switch transmitter off */ +- +-#define SPI_STAT_RXBV_S 28 +-#define SPI_STAT_RXBV_M (0x7 << SPI_STAT_RXBV_S) +-#define SPI_STAT_BSY BIT(13) /* Busy flag */ +-#define SPI_STAT_RUE BIT(12) /* Receive underflow error flag */ +-#define SPI_STAT_TUE BIT(11) /* Transmit underflow error flag */ +-#define SPI_STAT_AE BIT(10) /* Abort error flag */ +-#define SPI_STAT_RE BIT(9) /* Receive error flag */ +-#define SPI_STAT_TE BIT(8) /* Transmit error flag */ +-#define SPI_STAT_ME BIT(7) /* Mode error flag */ +-#define SPI_STAT_MS BIT(1) /* Master/slave select bit */ +-#define SPI_STAT_EN BIT(0) /* Enable bit */ +-#define SPI_STAT_ERRORS (SPI_STAT_ME | SPI_STAT_TE | SPI_STAT_RE | \ +- SPI_STAT_AE | SPI_STAT_TUE | SPI_STAT_RUE) +- +-#define SPI_WHBSTATE_SETTUE BIT(15) /* Set transmit underflow error flag */ +-#define SPI_WHBSTATE_SETAE BIT(14) /* Set abort error flag */ +-#define SPI_WHBSTATE_SETRE BIT(13) /* Set receive error flag */ +-#define SPI_WHBSTATE_SETTE BIT(12) /* Set transmit error flag */ +-#define SPI_WHBSTATE_CLRTUE BIT(11) /* Clear transmit underflow error flag */ +-#define SPI_WHBSTATE_CLRAE BIT(10) /* Clear abort error flag */ +-#define SPI_WHBSTATE_CLRRE BIT(9) /* Clear receive error flag */ +-#define SPI_WHBSTATE_CLRTE BIT(8) /* Clear transmit error flag */ +-#define SPI_WHBSTATE_SETME BIT(7) /* Set mode error flag */ +-#define SPI_WHBSTATE_CLRME BIT(6) /* Clear mode error flag */ +-#define SPI_WHBSTATE_SETRUE BIT(5) /* Set receive underflow error flag */ +-#define SPI_WHBSTATE_CLRRUE BIT(4) /* Clear receive underflow error flag */ +-#define SPI_WHBSTATE_SETMS BIT(3) /* Set master select bit */ +-#define SPI_WHBSTATE_CLRMS BIT(2) /* Clear master select bit */ +-#define SPI_WHBSTATE_SETEN BIT(1) /* Set enable bit (operational mode) */ +-#define SPI_WHBSTATE_CLREN BIT(0) /* Clear enable bit (config mode */ +-#define SPI_WHBSTATE_CLR_ERRORS (SPI_WHBSTATE_CLRRUE | SPI_WHBSTATE_CLRME | \ +- SPI_WHBSTATE_CLRTE | SPI_WHBSTATE_CLRRE | \ +- SPI_WHBSTATE_CLRAE | SPI_WHBSTATE_CLRTUE) +- +-#define SPI_RXFCON_RXFITL_S 8 /* FIFO interrupt trigger level */ +-#define SPI_RXFCON_RXFITL_M (0x3F << SPI_RXFCON_RXFITL_S) +-#define SPI_RXFCON_RXFLU BIT(1) /* FIFO flush */ +-#define SPI_RXFCON_RXFEN BIT(0) /* FIFO enable */ +- +-#define SPI_TXFCON_TXFITL_S 8 /* FIFO interrupt trigger level */ +-#define SPI_TXFCON_TXFITL_M (0x3F << SPI_TXFCON_TXFITL_S) +-#define SPI_TXFCON_TXFLU BIT(1) /* FIFO flush */ +-#define SPI_TXFCON_TXFEN BIT(0) /* FIFO enable */ +- +-#define SPI_FSTAT_RXFFL_S 0 +-#define SPI_FSTAT_RXFFL_M (0x3f << SPI_FSTAT_RXFFL_S) +-#define SPI_FSTAT_TXFFL_S 8 +-#define SPI_FSTAT_TXFFL_M (0x3f << SPI_FSTAT_TXFFL_S) +- +-#define SPI_GPOCON_ISCSBN_S 8 +-#define SPI_GPOCON_INVOUTN_S 0 +- +-#define SPI_FGPO_SETOUTN_S 8 +-#define SPI_FGPO_CLROUTN_S 0 +- +-#define SPI_RXREQ_RXCNT_M 0xFFFF /* Receive count value */ +-#define SPI_RXCNT_TODO_M 0xFFFF /* Recevie to-do value */ +- +-#define SPI_IRNEN_TFI BIT(4) /* TX finished interrupt */ +-#define SPI_IRNEN_F BIT(3) /* Frame end interrupt request */ +-#define SPI_IRNEN_E BIT(2) /* Error end interrupt request */ +-#define SPI_IRNEN_T_XWAY BIT(1) /* Transmit end interrupt request */ +-#define SPI_IRNEN_R_XWAY BIT(0) /* Receive end interrupt request */ +-#define SPI_IRNEN_R_XRX BIT(1) /* Transmit end interrupt request */ +-#define SPI_IRNEN_T_XRX BIT(0) /* Receive end interrupt request */ +-#define SPI_IRNEN_ALL 0x1F ++#define LTQ_SPI_RX_IRQ_NAME "spi_rx" ++#define LTQ_SPI_TX_IRQ_NAME "spi_tx" ++#define LTQ_SPI_ERR_IRQ_NAME "spi_err" ++#define LTQ_SPI_FRM_IRQ_NAME "spi_frm" ++ ++#define LTQ_SPI_CLC 0x00 ++#define LTQ_SPI_PISEL 0x04 ++#define LTQ_SPI_ID 0x08 ++#define LTQ_SPI_CON 0x10 ++#define LTQ_SPI_STAT 0x14 ++#define LTQ_SPI_WHBSTATE 0x18 ++#define LTQ_SPI_TB 0x20 ++#define LTQ_SPI_RB 0x24 ++#define LTQ_SPI_RXFCON 0x30 ++#define LTQ_SPI_TXFCON 0x34 ++#define LTQ_SPI_FSTAT 0x38 ++#define LTQ_SPI_BRT 0x40 ++#define LTQ_SPI_BRSTAT 0x44 ++#define LTQ_SPI_SFCON 0x60 ++#define LTQ_SPI_SFSTAT 0x64 ++#define LTQ_SPI_GPOCON 0x70 ++#define LTQ_SPI_GPOSTAT 0x74 ++#define LTQ_SPI_FPGO 0x78 ++#define LTQ_SPI_RXREQ 0x80 ++#define LTQ_SPI_RXCNT 0x84 ++#define LTQ_SPI_DMACON 0xec ++#define LTQ_SPI_IRNEN 0xf4 ++#define LTQ_SPI_IRNICR 0xf8 ++#define LTQ_SPI_IRNCR 0xfc ++ ++#define LTQ_SPI_CLC_SMC_S 16 /* Clock divider for sleep mode */ ++#define LTQ_SPI_CLC_SMC_M (0xFF << LTQ_SPI_CLC_SMC_S) ++#define LTQ_SPI_CLC_RMC_S 8 /* Clock divider for normal run mode */ ++#define LTQ_SPI_CLC_RMC_M (0xFF << LTQ_SPI_CLC_RMC_S) ++#define LTQ_SPI_CLC_DISS BIT(1) /* Disable status bit */ ++#define LTQ_SPI_CLC_DISR BIT(0) /* Disable request bit */ ++ ++#define LTQ_SPI_ID_TXFS_S 24 /* Implemented TX FIFO size */ ++#define LTQ_SPI_ID_TXFS_M (0x3F << LTQ_SPI_ID_TXFS_S) ++#define LTQ_SPI_ID_RXFS_S 16 /* Implemented RX FIFO size */ ++#define LTQ_SPI_ID_RXFS_M (0x3F << LTQ_SPI_ID_RXFS_S) ++#define LTQ_SPI_ID_MOD_S 8 /* Module ID */ ++#define LTQ_SPI_ID_MOD_M (0xff << LTQ_SPI_ID_MOD_S) ++#define LTQ_SPI_ID_CFG_S 5 /* DMA interface support */ ++#define LTQ_SPI_ID_CFG_M (1 << LTQ_SPI_ID_CFG_S) ++#define LTQ_SPI_ID_REV_M 0x1F /* Hardware revision number */ ++ ++#define LTQ_SPI_CON_BM_S 16 /* Data width selection */ ++#define LTQ_SPI_CON_BM_M (0x1F << LTQ_SPI_CON_BM_S) ++#define LTQ_SPI_CON_EM BIT(24) /* Echo mode */ ++#define LTQ_SPI_CON_IDLE BIT(23) /* Idle bit value */ ++#define LTQ_SPI_CON_ENBV BIT(22) /* Enable byte valid control */ ++#define LTQ_SPI_CON_RUEN BIT(12) /* Receive underflow error enable */ ++#define LTQ_SPI_CON_TUEN BIT(11) /* Transmit underflow error enable */ ++#define LTQ_SPI_CON_AEN BIT(10) /* Abort error enable */ ++#define LTQ_SPI_CON_REN BIT(9) /* Receive overflow error enable */ ++#define LTQ_SPI_CON_TEN BIT(8) /* Transmit overflow error enable */ ++#define LTQ_SPI_CON_LB BIT(7) /* Loopback control */ ++#define LTQ_SPI_CON_PO BIT(6) /* Clock polarity control */ ++#define LTQ_SPI_CON_PH BIT(5) /* Clock phase control */ ++#define LTQ_SPI_CON_HB BIT(4) /* Heading control */ ++#define LTQ_SPI_CON_RXOFF BIT(1) /* Switch receiver off */ ++#define LTQ_SPI_CON_TXOFF BIT(0) /* Switch transmitter off */ ++ ++#define LTQ_SPI_STAT_RXBV_S 28 ++#define LTQ_SPI_STAT_RXBV_M (0x7 << LTQ_SPI_STAT_RXBV_S) ++#define LTQ_SPI_STAT_BSY BIT(13) /* Busy flag */ ++#define LTQ_SPI_STAT_RUE BIT(12) /* Receive underflow error flag */ ++#define LTQ_SPI_STAT_TUE BIT(11) /* Transmit underflow error flag */ ++#define LTQ_SPI_STAT_AE BIT(10) /* Abort error flag */ ++#define LTQ_SPI_STAT_RE BIT(9) /* Receive error flag */ ++#define LTQ_SPI_STAT_TE BIT(8) /* Transmit error flag */ ++#define LTQ_SPI_STAT_ME BIT(7) /* Mode error flag */ ++#define LTQ_SPI_STAT_MS BIT(1) /* Master/slave select bit */ ++#define LTQ_SPI_STAT_EN BIT(0) /* Enable bit */ ++#define LTQ_SPI_STAT_ERRORS (LTQ_SPI_STAT_ME | LTQ_SPI_STAT_TE | \ ++ LTQ_SPI_STAT_RE | LTQ_SPI_STAT_AE | \ ++ LTQ_SPI_STAT_TUE | LTQ_SPI_STAT_RUE) ++ ++#define LTQ_SPI_WHBSTATE_SETTUE BIT(15) /* Set transmit underflow error flag */ ++#define LTQ_SPI_WHBSTATE_SETAE BIT(14) /* Set abort error flag */ ++#define LTQ_SPI_WHBSTATE_SETRE BIT(13) /* Set receive error flag */ ++#define LTQ_SPI_WHBSTATE_SETTE BIT(12) /* Set transmit error flag */ ++#define LTQ_SPI_WHBSTATE_CLRTUE BIT(11) /* Clear transmit underflow error flag */ ++#define LTQ_SPI_WHBSTATE_CLRAE BIT(10) /* Clear abort error flag */ ++#define LTQ_SPI_WHBSTATE_CLRRE BIT(9) /* Clear receive error flag */ ++#define LTQ_SPI_WHBSTATE_CLRTE BIT(8) /* Clear transmit error flag */ ++#define LTQ_SPI_WHBSTATE_SETME BIT(7) /* Set mode error flag */ ++#define LTQ_SPI_WHBSTATE_CLRME BIT(6) /* Clear mode error flag */ ++#define LTQ_SPI_WHBSTATE_SETRUE BIT(5) /* Set receive underflow error flag */ ++#define LTQ_SPI_WHBSTATE_CLRRUE BIT(4) /* Clear receive underflow error flag */ ++#define LTQ_SPI_WHBSTATE_SETMS BIT(3) /* Set master select bit */ ++#define LTQ_SPI_WHBSTATE_CLRMS BIT(2) /* Clear master select bit */ ++#define LTQ_SPI_WHBSTATE_SETEN BIT(1) /* Set enable bit (operational mode) */ ++#define LTQ_SPI_WHBSTATE_CLREN BIT(0) /* Clear enable bit (config mode */ ++#define LTQ_SPI_WHBSTATE_CLR_ERRORS (LTQ_SPI_WHBSTATE_CLRRUE | \ ++ LTQ_SPI_WHBSTATE_CLRME | \ ++ LTQ_SPI_WHBSTATE_CLRTE | \ ++ LTQ_SPI_WHBSTATE_CLRRE | \ ++ LTQ_SPI_WHBSTATE_CLRAE | \ ++ LTQ_SPI_WHBSTATE_CLRTUE) ++ ++#define LTQ_SPI_RXFCON_RXFITL_S 8 /* FIFO interrupt trigger level */ ++#define LTQ_SPI_RXFCON_RXFITL_M (0x3F << LTQ_SPI_RXFCON_RXFITL_S) ++#define LTQ_SPI_RXFCON_RXFLU BIT(1) /* FIFO flush */ ++#define LTQ_SPI_RXFCON_RXFEN BIT(0) /* FIFO enable */ ++ ++#define LTQ_SPI_TXFCON_TXFITL_S 8 /* FIFO interrupt trigger level */ ++#define LTQ_SPI_TXFCON_TXFITL_M (0x3F << LTQ_SPI_TXFCON_TXFITL_S) ++#define LTQ_SPI_TXFCON_TXFLU BIT(1) /* FIFO flush */ ++#define LTQ_SPI_TXFCON_TXFEN BIT(0) /* FIFO enable */ ++ ++#define LTQ_SPI_FSTAT_RXFFL_S 0 ++#define LTQ_SPI_FSTAT_RXFFL_M (0x3f << LTQ_SPI_FSTAT_RXFFL_S) ++#define LTQ_SPI_FSTAT_TXFFL_S 8 ++#define LTQ_SPI_FSTAT_TXFFL_M (0x3f << LTQ_SPI_FSTAT_TXFFL_S) ++ ++#define LTQ_SPI_GPOCON_ISCSBN_S 8 ++#define LTQ_SPI_GPOCON_INVOUTN_S 0 ++ ++#define LTQ_SPI_FGPO_SETOUTN_S 8 ++#define LTQ_SPI_FGPO_CLROUTN_S 0 ++ ++#define LTQ_SPI_RXREQ_RXCNT_M 0xFFFF /* Receive count value */ ++#define LTQ_SPI_RXCNT_TODO_M 0xFFFF /* Recevie to-do value */ ++ ++#define LTQ_SPI_IRNEN_TFI BIT(4) /* TX finished interrupt */ ++#define LTQ_SPI_IRNEN_F BIT(3) /* Frame end interrupt request */ ++#define LTQ_SPI_IRNEN_E BIT(2) /* Error end interrupt request */ ++#define LTQ_SPI_IRNEN_T_XWAY BIT(1) /* Transmit end interrupt request */ ++#define LTQ_SPI_IRNEN_R_XWAY BIT(0) /* Receive end interrupt request */ ++#define LTQ_SPI_IRNEN_R_XRX BIT(1) /* Transmit end interrupt request */ ++#define LTQ_SPI_IRNEN_T_XRX BIT(0) /* Receive end interrupt request */ ++#define LTQ_SPI_IRNEN_ALL 0x1F + + struct lantiq_ssc_hwcfg { + unsigned int irnen_r; +@@ -208,16 +212,16 @@ static void lantiq_ssc_maskl(const struc + + static unsigned int tx_fifo_level(const struct lantiq_ssc_spi *spi) + { +- u32 fstat = lantiq_ssc_readl(spi, SPI_FSTAT); ++ u32 fstat = lantiq_ssc_readl(spi, LTQ_SPI_FSTAT); + +- return (fstat & SPI_FSTAT_TXFFL_M) >> SPI_FSTAT_TXFFL_S; ++ return (fstat & LTQ_SPI_FSTAT_TXFFL_M) >> LTQ_SPI_FSTAT_TXFFL_S; + } + + static unsigned int rx_fifo_level(const struct lantiq_ssc_spi *spi) + { +- u32 fstat = lantiq_ssc_readl(spi, SPI_FSTAT); ++ u32 fstat = lantiq_ssc_readl(spi, LTQ_SPI_FSTAT); + +- return fstat & SPI_FSTAT_RXFFL_M; ++ return fstat & LTQ_SPI_FSTAT_RXFFL_M; + } + + static unsigned int tx_fifo_free(const struct lantiq_ssc_spi *spi) +@@ -227,38 +231,38 @@ static unsigned int tx_fifo_free(const s + + static void rx_fifo_reset(const struct lantiq_ssc_spi *spi) + { +- u32 val = spi->rx_fifo_size << SPI_RXFCON_RXFITL_S; ++ u32 val = spi->rx_fifo_size << LTQ_SPI_RXFCON_RXFITL_S; + +- val |= SPI_RXFCON_RXFEN | SPI_RXFCON_RXFLU; +- lantiq_ssc_writel(spi, val, SPI_RXFCON); ++ val |= LTQ_SPI_RXFCON_RXFEN | LTQ_SPI_RXFCON_RXFLU; ++ lantiq_ssc_writel(spi, val, LTQ_SPI_RXFCON); + } + + static void tx_fifo_reset(const struct lantiq_ssc_spi *spi) + { +- u32 val = 1 << SPI_TXFCON_TXFITL_S; ++ u32 val = 1 << LTQ_SPI_TXFCON_TXFITL_S; + +- val |= SPI_TXFCON_TXFEN | SPI_TXFCON_TXFLU; +- lantiq_ssc_writel(spi, val, SPI_TXFCON); ++ val |= LTQ_SPI_TXFCON_TXFEN | LTQ_SPI_TXFCON_TXFLU; ++ lantiq_ssc_writel(spi, val, LTQ_SPI_TXFCON); + } + + static void rx_fifo_flush(const struct lantiq_ssc_spi *spi) + { +- lantiq_ssc_maskl(spi, 0, SPI_RXFCON_RXFLU, SPI_RXFCON); ++ lantiq_ssc_maskl(spi, 0, LTQ_SPI_RXFCON_RXFLU, LTQ_SPI_RXFCON); + } + + static void tx_fifo_flush(const struct lantiq_ssc_spi *spi) + { +- lantiq_ssc_maskl(spi, 0, SPI_TXFCON_TXFLU, SPI_TXFCON); ++ lantiq_ssc_maskl(spi, 0, LTQ_SPI_TXFCON_TXFLU, LTQ_SPI_TXFCON); + } + + static void hw_enter_config_mode(const struct lantiq_ssc_spi *spi) + { +- lantiq_ssc_writel(spi, SPI_WHBSTATE_CLREN, SPI_WHBSTATE); ++ lantiq_ssc_writel(spi, LTQ_SPI_WHBSTATE_CLREN, LTQ_SPI_WHBSTATE); + } + + static void hw_enter_active_mode(const struct lantiq_ssc_spi *spi) + { +- lantiq_ssc_writel(spi, SPI_WHBSTATE_SETEN, SPI_WHBSTATE); ++ lantiq_ssc_writel(spi, LTQ_SPI_WHBSTATE_SETEN, LTQ_SPI_WHBSTATE); + } + + static void hw_setup_speed_hz(const struct lantiq_ssc_spi *spi, +@@ -287,7 +291,7 @@ static void hw_setup_speed_hz(const stru + dev_dbg(spi->dev, "spi_clk %u, max_speed_hz %u, brt %u\n", + spi_clk, max_speed_hz, brt); + +- lantiq_ssc_writel(spi, brt, SPI_BRT); ++ lantiq_ssc_writel(spi, brt, LTQ_SPI_BRT); + } + + static void hw_setup_bits_per_word(const struct lantiq_ssc_spi *spi, +@@ -296,9 +300,9 @@ static void hw_setup_bits_per_word(const + u32 bm; + + /* CON.BM value = bits_per_word - 1 */ +- bm = (bits_per_word - 1) << SPI_CON_BM_S; ++ bm = (bits_per_word - 1) << LTQ_SPI_CON_BM_S; + +- lantiq_ssc_maskl(spi, SPI_CON_BM_M, bm, SPI_CON); ++ lantiq_ssc_maskl(spi, LTQ_SPI_CON_BM_M, bm, LTQ_SPI_CON); + } + + static void hw_setup_clock_mode(const struct lantiq_ssc_spi *spi, +@@ -315,28 +319,28 @@ static void hw_setup_clock_mode(const st + * 3 1 1 1 0 + */ + if (mode & SPI_CPHA) +- con_clr |= SPI_CON_PH; ++ con_clr |= LTQ_SPI_CON_PH; + else +- con_set |= SPI_CON_PH; ++ con_set |= LTQ_SPI_CON_PH; + + if (mode & SPI_CPOL) +- con_set |= SPI_CON_PO | SPI_CON_IDLE; ++ con_set |= LTQ_SPI_CON_PO | LTQ_SPI_CON_IDLE; + else +- con_clr |= SPI_CON_PO | SPI_CON_IDLE; ++ con_clr |= LTQ_SPI_CON_PO | LTQ_SPI_CON_IDLE; + + /* Set heading control */ + if (mode & SPI_LSB_FIRST) +- con_clr |= SPI_CON_HB; ++ con_clr |= LTQ_SPI_CON_HB; + else +- con_set |= SPI_CON_HB; ++ con_set |= LTQ_SPI_CON_HB; + + /* Set loopback mode */ + if (mode & SPI_LOOP) +- con_set |= SPI_CON_LB; ++ con_set |= LTQ_SPI_CON_LB; + else +- con_clr |= SPI_CON_LB; ++ con_clr |= LTQ_SPI_CON_LB; + +- lantiq_ssc_maskl(spi, con_clr, con_set, SPI_CON); ++ lantiq_ssc_maskl(spi, con_clr, con_set, LTQ_SPI_CON); + } + + static void lantiq_ssc_hw_init(const struct lantiq_ssc_spi *spi) +@@ -347,37 +351,39 @@ static void lantiq_ssc_hw_init(const str + * Set clock divider for run mode to 1 to + * run at same frequency as FPI bus + */ +- lantiq_ssc_writel(spi, 1 << SPI_CLC_RMC_S, SPI_CLC); ++ lantiq_ssc_writel(spi, 1 << LTQ_SPI_CLC_RMC_S, LTQ_SPI_CLC); + + /* Put controller into config mode */ + hw_enter_config_mode(spi); + + /* Clear error flags */ +- lantiq_ssc_maskl(spi, 0, SPI_WHBSTATE_CLR_ERRORS, SPI_WHBSTATE); ++ lantiq_ssc_maskl(spi, 0, LTQ_SPI_WHBSTATE_CLR_ERRORS, LTQ_SPI_WHBSTATE); + + /* Enable error checking, disable TX/RX */ +- lantiq_ssc_writel(spi, SPI_CON_RUEN | SPI_CON_AEN | SPI_CON_TEN | +- SPI_CON_REN | SPI_CON_TXOFF | SPI_CON_RXOFF, SPI_CON); ++ lantiq_ssc_writel(spi, LTQ_SPI_CON_RUEN | LTQ_SPI_CON_AEN | ++ LTQ_SPI_CON_TEN | LTQ_SPI_CON_REN | LTQ_SPI_CON_TXOFF | ++ LTQ_SPI_CON_RXOFF, LTQ_SPI_CON); + + /* Setup default SPI mode */ + hw_setup_bits_per_word(spi, spi->bits_per_word); + hw_setup_clock_mode(spi, SPI_MODE_0); + + /* Enable master mode and clear error flags */ +- lantiq_ssc_writel(spi, SPI_WHBSTATE_SETMS | SPI_WHBSTATE_CLR_ERRORS, +- SPI_WHBSTATE); ++ lantiq_ssc_writel(spi, LTQ_SPI_WHBSTATE_SETMS | ++ LTQ_SPI_WHBSTATE_CLR_ERRORS, ++ LTQ_SPI_WHBSTATE); + + /* Reset GPIO/CS registers */ +- lantiq_ssc_writel(spi, 0, SPI_GPOCON); +- lantiq_ssc_writel(spi, 0xFF00, SPI_FPGO); ++ lantiq_ssc_writel(spi, 0, LTQ_SPI_GPOCON); ++ lantiq_ssc_writel(spi, 0xFF00, LTQ_SPI_FPGO); + + /* Enable and flush FIFOs */ + rx_fifo_reset(spi); + tx_fifo_reset(spi); + + /* Enable interrupts */ +- lantiq_ssc_writel(spi, hwcfg->irnen_t | hwcfg->irnen_r | SPI_IRNEN_E, +- SPI_IRNEN); ++ lantiq_ssc_writel(spi, hwcfg->irnen_t | hwcfg->irnen_r | ++ LTQ_SPI_IRNEN_E, LTQ_SPI_IRNEN); + } + + static int lantiq_ssc_setup(struct spi_device *spidev) +@@ -400,13 +406,13 @@ static int lantiq_ssc_setup(struct spi_d + } + + /* set GPO pin to CS mode */ +- gpocon = 1 << ((cs - spi->base_cs) + SPI_GPOCON_ISCSBN_S); ++ gpocon = 1 << ((cs - spi->base_cs) + LTQ_SPI_GPOCON_ISCSBN_S); + + /* invert GPO pin */ + if (spidev->mode & SPI_CS_HIGH) + gpocon |= 1 << (cs - spi->base_cs); + +- lantiq_ssc_maskl(spi, 0, gpocon, SPI_GPOCON); ++ lantiq_ssc_maskl(spi, 0, gpocon, LTQ_SPI_GPOCON); + + return 0; + } +@@ -442,18 +448,18 @@ static void hw_setup_transfer(struct lan + } + + /* Configure transmitter and receiver */ +- con = lantiq_ssc_readl(spi, SPI_CON); ++ con = lantiq_ssc_readl(spi, LTQ_SPI_CON); + if (t->tx_buf) +- con &= ~SPI_CON_TXOFF; ++ con &= ~LTQ_SPI_CON_TXOFF; + else +- con |= SPI_CON_TXOFF; ++ con |= LTQ_SPI_CON_TXOFF; + + if (t->rx_buf) +- con &= ~SPI_CON_RXOFF; ++ con &= ~LTQ_SPI_CON_RXOFF; + else +- con |= SPI_CON_RXOFF; ++ con |= LTQ_SPI_CON_RXOFF; + +- lantiq_ssc_writel(spi, con, SPI_CON); ++ lantiq_ssc_writel(spi, con, LTQ_SPI_CON); + } + + static int lantiq_ssc_unprepare_message(struct spi_master *master, +@@ -464,7 +470,8 @@ static int lantiq_ssc_unprepare_message( + flush_workqueue(spi->wq); + + /* Disable transmitter and receiver while idle */ +- lantiq_ssc_maskl(spi, 0, SPI_CON_TXOFF | SPI_CON_RXOFF, SPI_CON); ++ lantiq_ssc_maskl(spi, 0, LTQ_SPI_CON_TXOFF | LTQ_SPI_CON_RXOFF, ++ LTQ_SPI_CON); + + return 0; + } +@@ -503,7 +510,7 @@ static void tx_fifo_write(struct lantiq_ + break; + } + +- lantiq_ssc_writel(spi, data, SPI_TB); ++ lantiq_ssc_writel(spi, data, LTQ_SPI_TB); + tx_free--; + } + } +@@ -517,7 +524,7 @@ static void rx_fifo_read_full_duplex(str + unsigned int rx_fill = rx_fifo_level(spi); + + while (rx_fill) { +- data = lantiq_ssc_readl(spi, SPI_RB); ++ data = lantiq_ssc_readl(spi, LTQ_SPI_RB); + + switch (spi->bits_per_word) { + case 2 ... 8: +@@ -563,9 +570,9 @@ static void rx_fifo_read_half_duplex(str + */ + while (rx_fill) { + if (spi->rx_todo < 4) { +- rxbv = (lantiq_ssc_readl(spi, SPI_STAT) & +- SPI_STAT_RXBV_M) >> SPI_STAT_RXBV_S; +- data = lantiq_ssc_readl(spi, SPI_RB); ++ rxbv = (lantiq_ssc_readl(spi, LTQ_SPI_STAT) & ++ LTQ_SPI_STAT_RXBV_M) >> LTQ_SPI_STAT_RXBV_S; ++ data = lantiq_ssc_readl(spi, LTQ_SPI_RB); + + shift = (rxbv - 1) * 8; + rx8 = spi->rx; +@@ -578,7 +585,7 @@ static void rx_fifo_read_half_duplex(str + spi->rx++; + } + } else { +- data = lantiq_ssc_readl(spi, SPI_RB); ++ data = lantiq_ssc_readl(spi, LTQ_SPI_RB); + rx32 = (u32 *) spi->rx; + + *rx32++ = data; +@@ -603,7 +610,7 @@ static void rx_request(struct lantiq_ssc + if (rxreq > rxreq_max) + rxreq = rxreq_max; + +- lantiq_ssc_writel(spi, rxreq, SPI_RXREQ); ++ lantiq_ssc_writel(spi, rxreq, LTQ_SPI_RXREQ); + } + + static irqreturn_t lantiq_ssc_xmit_interrupt(int irq, void *data) +@@ -642,26 +649,26 @@ completed: + static irqreturn_t lantiq_ssc_err_interrupt(int irq, void *data) + { + struct lantiq_ssc_spi *spi = data; +- u32 stat = lantiq_ssc_readl(spi, SPI_STAT); ++ u32 stat = lantiq_ssc_readl(spi, LTQ_SPI_STAT); + +- if (!(stat & SPI_STAT_ERRORS)) ++ if (!(stat & LTQ_SPI_STAT_ERRORS)) + return IRQ_NONE; + +- if (stat & SPI_STAT_RUE) ++ if (stat & LTQ_SPI_STAT_RUE) + dev_err(spi->dev, "receive underflow error\n"); +- if (stat & SPI_STAT_TUE) ++ if (stat & LTQ_SPI_STAT_TUE) + dev_err(spi->dev, "transmit underflow error\n"); +- if (stat & SPI_STAT_AE) ++ if (stat & LTQ_SPI_STAT_AE) + dev_err(spi->dev, "abort error\n"); +- if (stat & SPI_STAT_RE) ++ if (stat & LTQ_SPI_STAT_RE) + dev_err(spi->dev, "receive overflow error\n"); +- if (stat & SPI_STAT_TE) ++ if (stat & LTQ_SPI_STAT_TE) + dev_err(spi->dev, "transmit overflow error\n"); +- if (stat & SPI_STAT_ME) ++ if (stat & LTQ_SPI_STAT_ME) + dev_err(spi->dev, "mode error\n"); + + /* Clear error flags */ +- lantiq_ssc_maskl(spi, 0, SPI_WHBSTATE_CLR_ERRORS, SPI_WHBSTATE); ++ lantiq_ssc_maskl(spi, 0, LTQ_SPI_WHBSTATE_CLR_ERRORS, LTQ_SPI_WHBSTATE); + + /* set bad status so it can be retried */ + if (spi->master->cur_msg) +@@ -721,9 +728,9 @@ static void lantiq_ssc_bussy_work(struct + + end = jiffies + msecs_to_jiffies(timeout); + do { +- u32 stat = lantiq_ssc_readl(spi, SPI_STAT); ++ u32 stat = lantiq_ssc_readl(spi, LTQ_SPI_STAT); + +- if (!(stat & SPI_STAT_BSY)) { ++ if (!(stat & LTQ_SPI_STAT_BSY)) { + spi_finalize_current_transfer(spi->master); + return; + } +@@ -755,9 +762,9 @@ static void lantiq_ssc_set_cs(struct spi + if (!!(spidev->mode & SPI_CS_HIGH) == enable) + fgpo = (1 << (cs - spi->base_cs)); + else +- fgpo = (1 << (cs - spi->base_cs + SPI_FGPO_SETOUTN_S)); ++ fgpo = (1 << (cs - spi->base_cs + LTQ_SPI_FGPO_SETOUTN_S)); + +- lantiq_ssc_writel(spi, fgpo, SPI_FPGO); ++ lantiq_ssc_writel(spi, fgpo, LTQ_SPI_FPGO); + } + + static int lantiq_ssc_transfer_one(struct spi_master *master, +@@ -772,13 +779,13 @@ static int lantiq_ssc_transfer_one(struc + } + + static const struct lantiq_ssc_hwcfg lantiq_ssc_xway = { +- .irnen_r = SPI_IRNEN_R_XWAY, +- .irnen_t = SPI_IRNEN_T_XWAY, ++ .irnen_r = LTQ_SPI_IRNEN_R_XWAY, ++ .irnen_t = LTQ_SPI_IRNEN_T_XWAY, + }; + + static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = { +- .irnen_r = SPI_IRNEN_R_XRX, +- .irnen_t = SPI_IRNEN_T_XRX, ++ .irnen_r = LTQ_SPI_IRNEN_R_XRX, ++ .irnen_t = LTQ_SPI_IRNEN_T_XRX, + }; + + static const struct of_device_id lantiq_ssc_match[] = { +@@ -814,21 +821,21 @@ static int lantiq_ssc_probe(struct platf + return -ENXIO; + } + +- rx_irq = platform_get_irq_byname(pdev, SPI_RX_IRQ_NAME); ++ rx_irq = platform_get_irq_byname(pdev, LTQ_SPI_RX_IRQ_NAME); + if (rx_irq < 0) { +- dev_err(dev, "failed to get %s\n", SPI_RX_IRQ_NAME); ++ dev_err(dev, "failed to get %s\n", LTQ_SPI_RX_IRQ_NAME); + return -ENXIO; + } + +- tx_irq = platform_get_irq_byname(pdev, SPI_TX_IRQ_NAME); ++ tx_irq = platform_get_irq_byname(pdev, LTQ_SPI_TX_IRQ_NAME); + if (tx_irq < 0) { +- dev_err(dev, "failed to get %s\n", SPI_TX_IRQ_NAME); ++ dev_err(dev, "failed to get %s\n", LTQ_SPI_TX_IRQ_NAME); + return -ENXIO; + } + +- err_irq = platform_get_irq_byname(pdev, SPI_ERR_IRQ_NAME); ++ err_irq = platform_get_irq_byname(pdev, LTQ_SPI_ERR_IRQ_NAME); + if (err_irq < 0) { +- dev_err(dev, "failed to get %s\n", SPI_ERR_IRQ_NAME); ++ dev_err(dev, "failed to get %s\n", LTQ_SPI_ERR_IRQ_NAME); + return -ENXIO; + } + +@@ -849,17 +856,17 @@ static int lantiq_ssc_probe(struct platf + } + + err = devm_request_irq(dev, rx_irq, lantiq_ssc_xmit_interrupt, +- 0, SPI_RX_IRQ_NAME, spi); ++ 0, LTQ_SPI_RX_IRQ_NAME, spi); + if (err) + goto err_master_put; + + err = devm_request_irq(dev, tx_irq, lantiq_ssc_xmit_interrupt, +- 0, SPI_TX_IRQ_NAME, spi); ++ 0, LTQ_SPI_TX_IRQ_NAME, spi); + if (err) + goto err_master_put; + + err = devm_request_irq(dev, err_irq, lantiq_ssc_err_interrupt, +- 0, SPI_ERR_IRQ_NAME, spi); ++ 0, LTQ_SPI_ERR_IRQ_NAME, spi); + if (err) + goto err_master_put; + +@@ -916,11 +923,11 @@ static int lantiq_ssc_probe(struct platf + } + INIT_WORK(&spi->work, lantiq_ssc_bussy_work); + +- id = lantiq_ssc_readl(spi, SPI_ID); +- spi->tx_fifo_size = (id & SPI_ID_TXFS_M) >> SPI_ID_TXFS_S; +- spi->rx_fifo_size = (id & SPI_ID_RXFS_M) >> SPI_ID_RXFS_S; +- supports_dma = (id & SPI_ID_CFG_M) >> SPI_ID_CFG_S; +- revision = id & SPI_ID_REV_M; ++ id = lantiq_ssc_readl(spi, LTQ_SPI_ID); ++ spi->tx_fifo_size = (id & LTQ_SPI_ID_TXFS_M) >> LTQ_SPI_ID_TXFS_S; ++ spi->rx_fifo_size = (id & LTQ_SPI_ID_RXFS_M) >> LTQ_SPI_ID_RXFS_S; ++ supports_dma = (id & LTQ_SPI_ID_CFG_M) >> LTQ_SPI_ID_CFG_S; ++ revision = id & LTQ_SPI_ID_REV_M; + + lantiq_ssc_hw_init(spi); + +@@ -952,8 +959,8 @@ static int lantiq_ssc_remove(struct plat + { + struct lantiq_ssc_spi *spi = platform_get_drvdata(pdev); + +- lantiq_ssc_writel(spi, 0, SPI_IRNEN); +- lantiq_ssc_writel(spi, 0, SPI_CLC); ++ lantiq_ssc_writel(spi, 0, LTQ_SPI_IRNEN); ++ lantiq_ssc_writel(spi, 0, LTQ_SPI_CLC); + rx_fifo_flush(spi); + tx_fifo_flush(spi); + hw_enter_config_mode(spi); diff --git a/target/linux/lantiq/patches-4.9/0101-find_active_root.patch b/target/linux/lantiq/patches-4.9/0101-find_active_root.patch new file mode 100644 index 000000000..73361c87f --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0101-find_active_root.patch @@ -0,0 +1,93 @@ +--- a/drivers/mtd/ofpart.c ++++ b/drivers/mtd/ofpart.c +@@ -25,6 +25,38 @@ static bool node_has_compatible(struct d + return of_get_property(pp, "compatible", NULL); + } + ++static uint8_t * brnboot_get_selected_root_part(struct mtd_info *master, ++ loff_t offset) ++{ ++ static uint8_t root_id; ++ int err, len; ++ ++ err = mtd_read(master, offset, 0x01, &len, &root_id); ++ ++ if (mtd_is_bitflip(err) || !err) ++ return &root_id; ++ ++ return NULL; ++} ++ ++static void brnboot_set_active_root_part(struct mtd_partition *pparts, ++ struct device_node **part_nodes, ++ int nr_parts, ++ uint8_t *root_id) ++{ ++ int i; ++ ++ for (i = 0; i < nr_parts; i++) { ++ int part_root_id; ++ ++ if (!of_property_read_u32(part_nodes[i], "brnboot,root-id", &part_root_id) ++ && part_root_id == *root_id) { ++ pparts[i].name = "firmware"; ++ break; ++ } ++ } ++} ++ + static int parse_fixed_partitions(struct mtd_info *master, + const struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +@@ -36,7 +68,8 @@ static int parse_fixed_partitions(struct + struct device_node *pp; + int nr_parts, i, ret = 0; + bool dedicated = true; +- ++ uint8_t *proot_id = NULL; ++ struct device_node **part_nodes; + + /* Pull of_node from the master device node */ + mtd_node = mtd_get_of_node(master); +@@ -72,7 +105,9 @@ static int parse_fixed_partitions(struct + return 0; + + parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL); +- if (!parts) ++ part_nodes = kzalloc(nr_parts * sizeof(*part_nodes), GFP_KERNEL); ++ ++ if (!parts || !part_nodes) + return -ENOMEM; + + i = 0; +@@ -121,12 +156,22 @@ static int parse_fixed_partitions(struct + if (of_get_property(pp, "lock", &len)) + parts[i].mask_flags |= MTD_POWERUP_LOCK; + ++ if (!proot_id && of_device_is_compatible(pp, "brnboot,root-selector")) ++ proot_id = brnboot_get_selected_root_part(master, parts[i].offset); ++ ++ part_nodes[i] = pp; ++ + i++; + } + + if (!nr_parts) + goto ofpart_none; + ++ if (proot_id) ++ brnboot_set_active_root_part(parts, part_nodes, nr_parts, proot_id); ++ ++ kfree(part_nodes); ++ + *pparts = parts; + return nr_parts; + +@@ -137,6 +182,7 @@ ofpart_fail: + ofpart_none: + of_node_put(pp); + kfree(parts); ++ kfree(part_nodes); + return ret; + } + diff --git a/target/linux/lantiq/patches-4.9/0151-lantiq-ifxmips_pcie-use-of.patch b/target/linux/lantiq/patches-4.9/0151-lantiq-ifxmips_pcie-use-of.patch new file mode 100644 index 000000000..03d43c241 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0151-lantiq-ifxmips_pcie-use-of.patch @@ -0,0 +1,166 @@ +--- a/arch/mips/pci/ifxmips_pcie.c ++++ b/arch/mips/pci/ifxmips_pcie.c +@@ -18,6 +18,9 @@ + #include + #include + ++#include ++#include ++ + #include "ifxmips_pcie.h" + #include "ifxmips_pcie_reg.h" + +@@ -40,6 +43,7 @@ + static DEFINE_SPINLOCK(ifx_pcie_lock); + + u32 g_pcie_debug_flag = PCIE_MSG_ANY & (~PCIE_MSG_CFG); ++static int pcie_reset_gpio; + + static ifx_pcie_irq_t pcie_irqs[IFX_PCIE_CORE_NR] = { + { +@@ -82,6 +86,22 @@ void ifx_pcie_debug(const char *fmt, ... + printk("%s", buf); + } + ++static inline void pcie_ep_gpio_rst_init(int pcie_port) ++{ ++ gpio_direction_output(pcie_reset_gpio, 1); ++ gpio_set_value(pcie_reset_gpio, 1); ++} ++ ++static inline void pcie_device_rst_assert(int pcie_port) ++{ ++ gpio_set_value(pcie_reset_gpio, 0); ++} ++ ++static inline void pcie_device_rst_deassert(int pcie_port) ++{ ++ mdelay(100); ++ gpio_direction_output(pcie_reset_gpio, 1); ++} + + static inline int pcie_ltssm_enable(int pcie_port) + { +@@ -1045,8 +1065,9 @@ pcie_rc_initialize(int pcie_port) + return 0; + } + +-static int __init ifx_pcie_bios_init(void) ++static int ifx_pcie_bios_probe(struct platform_device *pdev) + { ++ struct device_node *node = pdev->dev.of_node; + void __iomem *io_map_base; + int pcie_port; + int startup_port; +@@ -1055,7 +1076,17 @@ static int __init ifx_pcie_bios_init(voi + pcie_ahb_pmu_setup(); + + startup_port = IFX_PCIE_PORT0; +- ++ ++ pcie_reset_gpio = of_get_named_gpio(node, "gpio-reset", 0); ++ if (gpio_is_valid(pcie_reset_gpio)) { ++ int ret = devm_gpio_request(&pdev->dev, pcie_reset_gpio, "pcie-reset"); ++ if (ret) { ++ dev_err(&pdev->dev, "failed to request gpio %d\n", pcie_reset_gpio); ++ return ret; ++ } ++ gpio_direction_output(pcie_reset_gpio, 1); ++ } ++ + for (pcie_port = startup_port; pcie_port < IFX_PCIE_CORE_NR; pcie_port++){ + if (pcie_rc_initialize(pcie_port) == 0) { + IFX_PCIE_PRINT(PCIE_MSG_INIT, "%s: ifx_pcie_cfg_base 0x%p\n", +@@ -1067,6 +1098,7 @@ static int __init ifx_pcie_bios_init(voi + return -ENOMEM; + } + ifx_pcie_controller[pcie_port].pcic.io_map_base = (unsigned long)io_map_base; ++ pci_load_of_ranges(&ifx_pcie_controller[pcie_port].pcic, node); + + register_pci_controller(&ifx_pcie_controller[pcie_port].pcic); + /* XXX, clear error status */ +@@ -1083,6 +1115,30 @@ static int __init ifx_pcie_bios_init(voi + + return 0; + } ++ ++static const struct of_device_id ifxmips_pcie_match[] = { ++ { .compatible = "lantiq,pcie-xrx200" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ifxmips_pcie_match); ++ ++static struct platform_driver ltq_pci_driver = { ++ .probe = ifx_pcie_bios_probe, ++ .driver = { ++ .name = "pcie-xrx200", ++ .owner = THIS_MODULE, ++ .of_match_table = ifxmips_pcie_match, ++ }, ++}; ++ ++int __init ifx_pcie_bios_init(void) ++{ ++ int ret = platform_driver_register(<q_pci_driver); ++ if (ret) ++ pr_info("pcie-xrx200: Error registering platform driver!"); ++ return ret; ++} ++ + arch_initcall(ifx_pcie_bios_init); + + MODULE_LICENSE("GPL"); +--- a/arch/mips/pci/ifxmips_pcie_vr9.h ++++ b/arch/mips/pci/ifxmips_pcie_vr9.h +@@ -22,8 +22,6 @@ + #include + #include + +-#define IFX_PCIE_GPIO_RESET 494 +- + #define IFX_REG_R32 ltq_r32 + #define IFX_REG_W32 ltq_w32 + #define CONFIG_IFX_PCIE_HW_SWAP +@@ -53,21 +51,6 @@ + #define OUT ((volatile u32*)(IFX_GPIO + 0x0070)) + + +-static inline void pcie_ep_gpio_rst_init(int pcie_port) +-{ +- +- gpio_request(IFX_PCIE_GPIO_RESET, "pcie-reset"); +- gpio_direction_output(IFX_PCIE_GPIO_RESET, 1); +- gpio_set_value(IFX_PCIE_GPIO_RESET, 1); +- +-/* ifx_gpio_pin_reserve(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); +- ifx_gpio_output_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); +- ifx_gpio_dir_out_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); +- ifx_gpio_altsel0_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); +- ifx_gpio_altsel1_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); +- ifx_gpio_open_drain_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id);*/ +-} +- + static inline void pcie_ahb_pmu_setup(void) + { + /* Enable AHB bus master/slave */ +@@ -180,20 +163,6 @@ static inline void pcie_phy_rst_deassert + IFX_REG_W32(reg, IFX_RCU_RST_REQ); + } + +-static inline void pcie_device_rst_assert(int pcie_port) +-{ +- gpio_set_value(IFX_PCIE_GPIO_RESET, 0); +-// ifx_gpio_output_clear(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); +-} +- +-static inline void pcie_device_rst_deassert(int pcie_port) +-{ +- mdelay(100); +- gpio_direction_output(IFX_PCIE_GPIO_RESET, 1); +-// gpio_set_value(IFX_PCIE_GPIO_RESET, 1); +- //ifx_gpio_output_set(IFX_PCIE_GPIO_RESET, ifx_pcie_gpio_module_id); +-} +- + static inline void pcie_core_pmu_setup(int pcie_port) + { + struct clk *clk; diff --git a/target/linux/lantiq/patches-4.9/0152-lantiq-VPE.patch b/target/linux/lantiq/patches-4.9/0152-lantiq-VPE.patch new file mode 100644 index 000000000..7d6e4b808 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0152-lantiq-VPE.patch @@ -0,0 +1,180 @@ +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -2321,6 +2321,12 @@ config MIPS_VPE_LOADER + Includes a loader for loading an elf relocatable object + onto another VPE and running it. + ++config IFX_VPE_EXT ++ bool "IFX APRP Extensions" ++ depends on MIPS_VPE_LOADER ++ help ++ IFX included extensions in APRP ++ + config MIPS_VPE_LOADER_CMP + bool + default "y" +--- a/arch/mips/include/asm/vpe.h ++++ b/arch/mips/include/asm/vpe.h +@@ -127,4 +127,13 @@ void cleanup_tc(struct tc *tc); + + int __init vpe_module_init(void); + void __exit vpe_module_exit(void); ++ ++/* For the explanation of the APIs please refer the section "MT APRP Kernel ++ * Programming" in AR9 SW Architecture Specification ++ */ ++int32_t vpe1_sw_start(void *sw_start_addr, uint32_t tcmask, uint32_t flags); ++int32_t vpe1_sw_stop(uint32_t flags); ++uint32_t vpe1_get_load_addr(uint32_t flags); ++uint32_t vpe1_get_max_mem(uint32_t flags); ++ + #endif /* _ASM_VPE_H */ +--- a/arch/mips/kernel/vpe-mt.c ++++ b/arch/mips/kernel/vpe-mt.c +@@ -29,6 +29,7 @@ int vpe_run(struct vpe *v) + struct vpe_notifications *notifier; + unsigned int vpeflags; + struct tc *t; ++ unsigned long physical_memsize = 0L; + + /* check we are the Master VPE */ + local_irq_save(flags); +@@ -417,6 +418,8 @@ int __init vpe_module_init(void) + } + + v->ntcs = hw_tcs - aprp_cpu_index(); ++ write_tc_c0_tcbind((read_tc_c0_tcbind() & ++ ~TCBIND_CURVPE) | 1); + + /* add the tc to the list of this vpe's tc's. */ + list_add(&t->tc, &v->tc); +@@ -519,3 +522,47 @@ void __exit vpe_module_exit(void) + release_vpe(v); + } + } ++ ++#ifdef CONFIG_IFX_VPE_EXT ++int32_t vpe1_sw_start(void *sw_start_addr, uint32_t tcmask, uint32_t flags) ++{ ++ enum vpe_state state; ++ struct vpe *v = get_vpe(tclimit); ++ struct vpe_notifications *not; ++ ++ if (tcmask || flags) { ++ pr_warn("Currently tcmask and flags should be 0. Other values are not supported\n"); ++ return -1; ++ } ++ ++ state = xchg(&v->state, VPE_STATE_INUSE); ++ if (state != VPE_STATE_UNUSED) { ++ vpe_stop(v); ++ ++ list_for_each_entry(not, &v->notify, list) { ++ not->stop(tclimit); ++ } ++ } ++ ++ v->__start = (unsigned long)sw_start_addr; ++ ++ if (!vpe_run(v)) { ++ pr_debug("VPE loader: VPE1 running successfully\n"); ++ return 0; ++ } ++ return -1; ++} ++EXPORT_SYMBOL(vpe1_sw_start); ++ ++int32_t vpe1_sw_stop(uint32_t flags) ++{ ++ struct vpe *v = get_vpe(tclimit); ++ ++ if (!vpe_free(v)) { ++ pr_debug("RP Stopped\n"); ++ return 0; ++ } else ++ return -1; ++} ++EXPORT_SYMBOL(vpe1_sw_stop); ++#endif +--- a/arch/mips/kernel/vpe.c ++++ b/arch/mips/kernel/vpe.c +@@ -49,6 +49,41 @@ struct vpe_control vpecontrol = { + .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list) + }; + ++#ifdef CONFIG_IFX_VPE_EXT ++unsigned int vpe1_load_addr; ++ ++static int __init load_address(char *str) ++{ ++ get_option(&str, &vpe1_load_addr); ++ return 1; ++} ++__setup("vpe1_load_addr=", load_address); ++ ++static unsigned int vpe1_mem; ++static int __init vpe1mem(char *str) ++{ ++ vpe1_mem = memparse(str, &str); ++ return 1; ++} ++__setup("vpe1_mem=", vpe1mem); ++ ++uint32_t vpe1_get_load_addr(uint32_t flags) ++{ ++ return vpe1_load_addr; ++} ++EXPORT_SYMBOL(vpe1_get_load_addr); ++ ++uint32_t vpe1_get_max_mem(uint32_t flags) ++{ ++ if (!vpe1_mem) ++ return P_SIZE; ++ else ++ return vpe1_mem; ++} ++EXPORT_SYMBOL(vpe1_get_max_mem); ++ ++#endif ++ + /* get the vpe associated with this minor */ + struct vpe *get_vpe(int minor) + { +--- a/arch/mips/lantiq/prom.c ++++ b/arch/mips/lantiq/prom.c +@@ -31,10 +31,14 @@ EXPORT_SYMBOL_GPL(ebu_lock); + */ + static struct ltq_soc_info soc_info; + ++/* for Multithreading (APRP), vpe.c will use it */ ++unsigned long cp0_memsize; ++ + const char *get_system_type(void) + { + return soc_info.sys_type; + } ++EXPORT_SYMBOL(ltq_soc_type); + + int ltq_soc_type(void) + { +--- a/arch/mips/include/asm/mipsmtregs.h ++++ b/arch/mips/include/asm/mipsmtregs.h +@@ -31,6 +31,9 @@ + #define read_c0_vpeconf1() __read_32bit_c0_register($1, 3) + #define write_c0_vpeconf1(val) __write_32bit_c0_register($1, 3, val) + ++#define read_c0_vpeopt() __read_32bit_c0_register($1, 7) ++#define write_c0_vpeopt(val) __write_32bit_c0_register($1, 7, val) ++ + #define read_c0_tcstatus() __read_32bit_c0_register($2, 1) + #define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val) + +@@ -376,6 +379,8 @@ do { \ + #define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val) + #define read_vpe_c0_vpeconf1() mftc0(1, 3) + #define write_vpe_c0_vpeconf1(val) mttc0(1, 3, val) ++#define read_vpe_c0_vpeopt() mftc0(1, 7) ++#define write_vpe_c0_vpeopt(val) mttc0(1, 7, val) + #define read_vpe_c0_count() mftc0(9, 0) + #define write_vpe_c0_count(val) mttc0(9, 0, val) + #define read_vpe_c0_status() mftc0(12, 0) diff --git a/target/linux/lantiq/patches-4.9/0154-lantiq-pci-bar11mask-fix.patch b/target/linux/lantiq/patches-4.9/0154-lantiq-pci-bar11mask-fix.patch new file mode 100644 index 000000000..d0acd4bb1 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0154-lantiq-pci-bar11mask-fix.patch @@ -0,0 +1,22 @@ +--- a/arch/mips/pci/pci-lantiq.c ++++ b/arch/mips/pci/pci-lantiq.c +@@ -61,6 +61,8 @@ + #define ltq_pci_cfg_w32(x, y) ltq_w32((x), ltq_pci_mapped_cfg + (y)) + #define ltq_pci_cfg_r32(x) ltq_r32(ltq_pci_mapped_cfg + (x)) + ++extern u32 max_low_pfn; ++ + __iomem void *ltq_pci_mapped_cfg; + static __iomem void *ltq_pci_membase; + +@@ -86,8 +88,8 @@ static inline u32 ltq_calc_bar11mask(voi + u32 mem, bar11mask; + + /* BAR11MASK value depends on available memory on system. */ +- mem = get_num_physpages() * PAGE_SIZE; +- bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) - 1)) - 1)) | 8; ++ mem = max_low_pfn << PAGE_SHIFT; ++ bar11mask = ((-roundup_pow_of_two(mem)) & 0x0F000000) | 8; + + return bar11mask; + } diff --git a/target/linux/lantiq/patches-4.9/0155-lantiq-VPE-nosmp.patch b/target/linux/lantiq/patches-4.9/0155-lantiq-VPE-nosmp.patch new file mode 100644 index 000000000..898c2d482 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0155-lantiq-VPE-nosmp.patch @@ -0,0 +1,14 @@ +--- a/arch/mips/kernel/vpe-mt.c ++++ b/arch/mips/kernel/vpe-mt.c +@@ -132,7 +132,10 @@ int vpe_run(struct vpe *v) + * kernels need to turn it on, even if that wasn't the pre-dvpe() state. + */ + #ifdef CONFIG_SMP +- evpe(vpeflags); ++ if (!setup_max_cpus) /* nosmp is set */ ++ evpe(EVPE_ENABLE); ++ else ++ evpe(vpeflags); + #else + evpe(EVPE_ENABLE); + #endif diff --git a/target/linux/lantiq/patches-4.9/0160-owrt-lantiq-multiple-flash.patch b/target/linux/lantiq/patches-4.9/0160-owrt-lantiq-multiple-flash.patch new file mode 100644 index 000000000..fd8b7b892 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0160-owrt-lantiq-multiple-flash.patch @@ -0,0 +1,221 @@ +--- a/drivers/mtd/maps/lantiq-flash.c ++++ b/drivers/mtd/maps/lantiq-flash.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -38,13 +39,16 @@ enum { + LTQ_NOR_NORMAL + }; + ++#define MAX_RESOURCES 4 ++ + struct ltq_mtd { +- struct resource *res; +- struct mtd_info *mtd; +- struct map_info *map; ++ struct mtd_info *mtd[MAX_RESOURCES]; ++ struct mtd_info *cmtd; ++ struct map_info map[MAX_RESOURCES]; + }; + + static const char ltq_map_name[] = "ltq_nor"; ++static const char * const ltq_probe_types[] = { "cmdlinepart", "ofpart", NULL }; + + static map_word + ltq_read16(struct map_info *map, unsigned long adr) +@@ -108,11 +112,43 @@ ltq_copy_to(struct map_info *map, unsign + } + + static int ++ltq_mtd_remove(struct platform_device *pdev) ++{ ++ struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev); ++ int i; ++ ++ if (ltq_mtd == NULL) ++ return 0; ++ ++ if (ltq_mtd->cmtd) { ++ mtd_device_unregister(ltq_mtd->cmtd); ++ if (ltq_mtd->cmtd != ltq_mtd->mtd[0]) ++ mtd_concat_destroy(ltq_mtd->cmtd); ++ } ++ ++ for (i = 0; i < MAX_RESOURCES; i++) { ++ if (ltq_mtd->mtd[i] != NULL) ++ map_destroy(ltq_mtd->mtd[i]); ++ } ++ ++ kfree(ltq_mtd); ++ ++ return 0; ++} ++ ++static int + ltq_mtd_probe(struct platform_device *pdev) + { + struct ltq_mtd *ltq_mtd; + struct cfi_private *cfi; +- int err; ++ int err = 0; ++ int i; ++ int devices_found = 0; ++ ++ static const char *rom_probe_types[] = { ++ "cfi_probe", "jedec_probe", NULL ++ }; ++ const char **type; + + if (of_machine_is_compatible("lantiq,falcon") && + (ltq_boot_select() != BS_FLASH)) { +@@ -126,75 +162,89 @@ ltq_mtd_probe(struct platform_device *pd + + platform_set_drvdata(pdev, ltq_mtd); + +- ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (!ltq_mtd->res) { +- dev_err(&pdev->dev, "failed to get memory resource\n"); +- return -ENOENT; ++ for (i = 0; i < pdev->num_resources; i++) { ++ printk(KERN_NOTICE "lantiq nor flash device: %.8llx at %.8llx\n", ++ (unsigned long long)resource_size(&pdev->resource[i]), ++ (unsigned long long)pdev->resource[i].start); ++ ++ if (!devm_request_mem_region(&pdev->dev, ++ pdev->resource[i].start, ++ resource_size(&pdev->resource[i]), ++ dev_name(&pdev->dev))) { ++ dev_err(&pdev->dev, "Could not reserve memory region\n"); ++ return -ENOMEM; ++ } ++ ++ ltq_mtd->map[i].name = ltq_map_name; ++ ltq_mtd->map[i].bankwidth = 2; ++ ltq_mtd->map[i].read = ltq_read16; ++ ltq_mtd->map[i].write = ltq_write16; ++ ltq_mtd->map[i].copy_from = ltq_copy_from; ++ ltq_mtd->map[i].copy_to = ltq_copy_to; ++ ++ if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) ++ ltq_mtd->map[i].phys = NO_XIP; ++ else ++ ltq_mtd->map[i].phys = pdev->resource[i].start; ++ ltq_mtd->map[i].size = resource_size(&pdev->resource[i]); ++ ltq_mtd->map[i].virt = devm_ioremap(&pdev->dev, pdev->resource[i].start, ++ ltq_mtd->map[i].size); ++ if (IS_ERR(ltq_mtd->map[i].virt)) ++ return PTR_ERR(ltq_mtd->map[i].virt); ++ ++ if (ltq_mtd->map[i].virt == NULL) { ++ dev_err(&pdev->dev, "Failed to ioremap flash region\n"); ++ err = PTR_ERR(ltq_mtd->map[i].virt); ++ goto err_out; ++ } ++ ++ ltq_mtd->map[i].map_priv_1 = LTQ_NOR_PROBING; ++ for (type = rom_probe_types; !ltq_mtd->mtd[i] && *type; type++) ++ ltq_mtd->mtd[i] = do_map_probe(*type, <q_mtd->map[i]); ++ ltq_mtd->map[i].map_priv_1 = LTQ_NOR_NORMAL; ++ ++ if (!ltq_mtd->mtd[i]) { ++ dev_err(&pdev->dev, "probing failed\n"); ++ return -ENXIO; ++ } else { ++ devices_found++; ++ } ++ ++ ltq_mtd->mtd[i]->owner = THIS_MODULE; ++ ltq_mtd->mtd[i]->dev.parent = &pdev->dev; ++ ++ cfi = ltq_mtd->map[i].fldrv_priv; ++ cfi->addr_unlock1 ^= 1; ++ cfi->addr_unlock2 ^= 1; + } + +- ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info), +- GFP_KERNEL); +- if (!ltq_mtd->map) +- return -ENOMEM; ++ if (devices_found == 1) { ++ ltq_mtd->cmtd = ltq_mtd->mtd[0]; ++ } else if (devices_found > 1) { ++ /* ++ * We detected multiple devices. Concatenate them together. ++ */ ++ ltq_mtd->cmtd = mtd_concat_create(ltq_mtd->mtd, devices_found, dev_name(&pdev->dev)); ++ if (ltq_mtd->cmtd == NULL) ++ err = -ENXIO; ++ } + +- if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) +- ltq_mtd->map->phys = NO_XIP; +- else +- ltq_mtd->map->phys = ltq_mtd->res->start; +- ltq_mtd->res->start; +- ltq_mtd->map->size = resource_size(ltq_mtd->res); +- ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res); +- if (IS_ERR(ltq_mtd->map->virt)) +- return PTR_ERR(ltq_mtd->map->virt); +- +- ltq_mtd->map->name = ltq_map_name; +- ltq_mtd->map->bankwidth = 2; +- ltq_mtd->map->read = ltq_read16; +- ltq_mtd->map->write = ltq_write16; +- ltq_mtd->map->copy_from = ltq_copy_from; +- ltq_mtd->map->copy_to = ltq_copy_to; +- +- ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING; +- ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map); +- ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL; +- +- if (!ltq_mtd->mtd) { +- dev_err(&pdev->dev, "probing failed\n"); +- return -ENXIO; +- } +- +- ltq_mtd->mtd->dev.parent = &pdev->dev; +- mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); +- +- cfi = ltq_mtd->map->fldrv_priv; +- cfi->addr_unlock1 ^= 1; +- cfi->addr_unlock2 ^= 1; ++ ltq_mtd->cmtd->dev.parent = &pdev->dev; ++ mtd_set_of_node(ltq_mtd->cmtd, pdev->dev.of_node); + +- err = mtd_device_register(ltq_mtd->mtd, NULL, 0); ++ err = mtd_device_register(ltq_mtd->cmtd, NULL, 0); + if (err) { + dev_err(&pdev->dev, "failed to add partitions\n"); +- goto err_destroy; ++ goto err_out; + } + + return 0; + +-err_destroy: +- map_destroy(ltq_mtd->mtd); ++err_out: ++ ltq_mtd_remove(pdev); + return err; + } + +-static int +-ltq_mtd_remove(struct platform_device *pdev) +-{ +- struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev); +- +- if (ltq_mtd && ltq_mtd->mtd) { +- mtd_device_unregister(ltq_mtd->mtd); +- map_destroy(ltq_mtd->mtd); +- } +- return 0; +-} +- + static const struct of_device_id ltq_mtd_match[] = { + { .compatible = "lantiq,nor" }, + {}, diff --git a/target/linux/lantiq/patches-4.9/0170-MIPS-lantiq-lock-DMA-register-accesses-for-SMP.patch b/target/linux/lantiq/patches-4.9/0170-MIPS-lantiq-lock-DMA-register-accesses-for-SMP.patch new file mode 100644 index 000000000..234a2527f --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0170-MIPS-lantiq-lock-DMA-register-accesses-for-SMP.patch @@ -0,0 +1,152 @@ +From 58078a30038b578c26c532545448fe3746648390 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Thu, 29 Dec 2016 21:02:57 +0100 +Subject: [PATCH] MIPS: lantiq: lock DMA register accesses for SMP + +The DMA controller channel and port configuration is changed by +selecting the port or channel in one register and then update the +configuration in other registers. This has to be done in an atomic +operation. Previously only the local interrupts were deactivated which +works for single CPU systems. If the system supports SMP a better +locking is needed, use spinlocks instead. +On more recent SoCs (at least xrx200 and later) there are two memory +regions to change the configuration, there we could use one area for +each CPU and do not have to synchronize between the CPUs and more. + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/lantiq/xway/dma.c | 38 ++++++++++++++++++++------------------ + 1 file changed, 20 insertions(+), 18 deletions(-) + +--- a/arch/mips/lantiq/xway/dma.c ++++ b/arch/mips/lantiq/xway/dma.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -59,16 +60,17 @@ + ltq_dma_membase + (z)) + + static void __iomem *ltq_dma_membase; ++static DEFINE_SPINLOCK(ltq_dma_lock); + + void + ltq_dma_enable_irq(struct ltq_dma_channel *ch) + { + unsigned long flags; + +- local_irq_save(flags); ++ spin_lock_irqsave(<q_dma_lock, flags); + ltq_dma_w32(ch->nr, LTQ_DMA_CS); + ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); +- local_irq_restore(flags); ++ spin_unlock_irqrestore(<q_dma_lock, flags); + } + EXPORT_SYMBOL_GPL(ltq_dma_enable_irq); + +@@ -77,10 +79,10 @@ ltq_dma_disable_irq(struct ltq_dma_chann + { + unsigned long flags; + +- local_irq_save(flags); ++ spin_lock_irqsave(<q_dma_lock, flags); + ltq_dma_w32(ch->nr, LTQ_DMA_CS); + ltq_dma_w32_mask(1 << ch->nr, 0, LTQ_DMA_IRNEN); +- local_irq_restore(flags); ++ spin_unlock_irqrestore(<q_dma_lock, flags); + } + EXPORT_SYMBOL_GPL(ltq_dma_disable_irq); + +@@ -89,10 +91,10 @@ ltq_dma_ack_irq(struct ltq_dma_channel * + { + unsigned long flags; + +- local_irq_save(flags); ++ spin_lock_irqsave(<q_dma_lock, flags); + ltq_dma_w32(ch->nr, LTQ_DMA_CS); + ltq_dma_w32(DMA_IRQ_ACK, LTQ_DMA_CIS); +- local_irq_restore(flags); ++ spin_unlock_irqrestore(<q_dma_lock, flags); + } + EXPORT_SYMBOL_GPL(ltq_dma_ack_irq); + +@@ -101,11 +103,11 @@ ltq_dma_open(struct ltq_dma_channel *ch) + { + unsigned long flag; + +- local_irq_save(flag); ++ spin_lock_irqsave(<q_dma_lock, flag); + ltq_dma_w32(ch->nr, LTQ_DMA_CS); + ltq_dma_w32_mask(0, DMA_CHAN_ON, LTQ_DMA_CCTRL); +- ltq_dma_enable_irq(ch); +- local_irq_restore(flag); ++ ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); ++ spin_unlock_irqrestore(<q_dma_lock, flag); + } + EXPORT_SYMBOL_GPL(ltq_dma_open); + +@@ -114,11 +116,11 @@ ltq_dma_close(struct ltq_dma_channel *ch + { + unsigned long flag; + +- local_irq_save(flag); ++ spin_lock_irqsave(<q_dma_lock, flag); + ltq_dma_w32(ch->nr, LTQ_DMA_CS); + ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL); +- ltq_dma_disable_irq(ch); +- local_irq_restore(flag); ++ ltq_dma_w32_mask(1 << ch->nr, 0, LTQ_DMA_IRNEN); ++ spin_unlock_irqrestore(<q_dma_lock, flag); + } + EXPORT_SYMBOL_GPL(ltq_dma_close); + +@@ -133,7 +135,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch + &ch->phys, GFP_ATOMIC); + memset(ch->desc_base, 0, LTQ_DESC_NUM * LTQ_DESC_SIZE); + +- local_irq_save(flags); ++ spin_lock_irqsave(<q_dma_lock, flags); + ltq_dma_w32(ch->nr, LTQ_DMA_CS); + ltq_dma_w32(ch->phys, LTQ_DMA_CDBA); + ltq_dma_w32(LTQ_DESC_NUM, LTQ_DMA_CDLEN); +@@ -142,7 +144,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch + ltq_dma_w32_mask(0, DMA_CHAN_RST, LTQ_DMA_CCTRL); + while (ltq_dma_r32(LTQ_DMA_CCTRL) & DMA_CHAN_RST) + ; +- local_irq_restore(flags); ++ spin_unlock_irqrestore(<q_dma_lock, flags); + } + + void +@@ -152,11 +154,11 @@ ltq_dma_alloc_tx(struct ltq_dma_channel + + ltq_dma_alloc(ch); + +- local_irq_save(flags); ++ spin_lock_irqsave(<q_dma_lock, flags); + ltq_dma_w32(DMA_DESCPT, LTQ_DMA_CIE); + ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); + ltq_dma_w32(DMA_WEIGHT | DMA_TX, LTQ_DMA_CCTRL); +- local_irq_restore(flags); ++ spin_unlock_irqrestore(<q_dma_lock, flags); + } + EXPORT_SYMBOL_GPL(ltq_dma_alloc_tx); + +@@ -167,11 +169,11 @@ ltq_dma_alloc_rx(struct ltq_dma_channel + + ltq_dma_alloc(ch); + +- local_irq_save(flags); ++ spin_lock_irqsave(<q_dma_lock, flags); + ltq_dma_w32(DMA_DESCPT, LTQ_DMA_CIE); + ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN); + ltq_dma_w32(DMA_WEIGHT, LTQ_DMA_CCTRL); +- local_irq_restore(flags); ++ spin_unlock_irqrestore(<q_dma_lock, flags); + } + EXPORT_SYMBOL_GPL(ltq_dma_alloc_rx); + diff --git a/target/linux/lantiq/patches-4.9/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch b/target/linux/lantiq/patches-4.9/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch new file mode 100644 index 000000000..d153c521d --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0300-MTD-cfi-cmdset-0001-disable-buffered-writes.patch @@ -0,0 +1,11 @@ +--- a/drivers/mtd/chips/cfi_cmdset_0001.c ++++ b/drivers/mtd/chips/cfi_cmdset_0001.c +@@ -39,7 +39,7 @@ + /* #define CMDSET0001_DISABLE_WRITE_SUSPEND */ + + // debugging, turns off buffer write mode if set to 1 +-#define FORCE_WORD_WRITE 0 ++#define FORCE_WORD_WRITE 1 + + /* Intel chips */ + #define I82802AB 0x00ad diff --git a/target/linux/lantiq/patches-4.9/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch b/target/linux/lantiq/patches-4.9/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch new file mode 100644 index 000000000..e42aaf9c0 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch @@ -0,0 +1,30 @@ +--- a/arch/mips/lantiq/xway/sysctrl.c ++++ b/arch/mips/lantiq/xway/sysctrl.c +@@ -442,6 +442,20 @@ static void clkdev_add_clkout(void) + } + } + ++static void set_phy_clock_source(struct device_node *np_cgu) ++{ ++ u32 phy_clk_src, ifcc; ++ ++ if (!np_cgu) ++ return; ++ ++ if (of_property_read_u32(np_cgu, "lantiq,phy-clk-src", &phy_clk_src)) ++ return; ++ ++ ifcc = ltq_cgu_r32(ifccr) & ~(0x1c); ++ ltq_cgu_w32(ifcc | (phy_clk_src << 2), ifccr); ++} ++ + /* bring up all register ranges that we need for basic system control */ + void __init ltq_soc_init(void) + { +@@ -628,4 +642,6 @@ void __init ltq_soc_init(void) + if (of_machine_is_compatible("lantiq,vr9")) + xbar_fpi_burst_disable(); + usb_set_clock(); ++ ++ set_phy_clock_source(np_cgu); + } diff --git a/target/linux/lantiq/patches-4.9/0302-xrx200-add-sensors-driver.patch b/target/linux/lantiq/patches-4.9/0302-xrx200-add-sensors-driver.patch new file mode 100644 index 000000000..7e0051e66 --- /dev/null +++ b/target/linux/lantiq/patches-4.9/0302-xrx200-add-sensors-driver.patch @@ -0,0 +1,184 @@ +--- a/drivers/hwmon/Makefile ++++ b/drivers/hwmon/Makefile +@@ -109,6 +109,7 @@ obj-$(CONFIG_SENSORS_LTC4222) += ltc4222 + obj-$(CONFIG_SENSORS_LTC4245) += ltc4245.o + obj-$(CONFIG_SENSORS_LTC4260) += ltc4260.o + obj-$(CONFIG_SENSORS_LTC4261) += ltc4261.o ++obj-$(CONFIG_SENSORS_LTQ_CPUTEMP) += ltq-cputemp.o + obj-$(CONFIG_SENSORS_MAX1111) += max1111.o + obj-$(CONFIG_SENSORS_MAX16065) += max16065.o + obj-$(CONFIG_SENSORS_MAX1619) += max1619.o +--- a/drivers/hwmon/Kconfig ++++ b/drivers/hwmon/Kconfig +@@ -780,6 +780,14 @@ config SENSORS_LTC4261 + This driver can also be built as a module. If so, the module will + be called ltc4261. + ++config SENSORS_LTQ_CPUTEMP ++ bool "Lantiq CPU temperature sensor" ++ depends on LANTIQ ++ default n ++ help ++ If you say yes here you get support for the temperature ++ sensor inside your CPU. ++ + config SENSORS_MAX1111 + tristate "Maxim MAX1111 Serial 8-bit ADC chip and compatibles" + depends on SPI_MASTER +--- /dev/null ++++ b/drivers/hwmon/ltq-cputemp.c +@@ -0,0 +1,154 @@ ++/* Lantiq CPU Temperatur sensor driver for xrx200 ++ * ++ * Copyright (C) 2016 Florian Eckert ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version ++ * ++ * This program is distributed in the hope that it will be useful ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, see ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++/* gphy1 configuration register contains cpu temperature */ ++#define CGU_GPHY1_CR 0x0040 ++#define CGU_TEMP_PD BIT(19) ++ ++static void ltq_cputemp_enable(void) ++{ ++ ltq_cgu_w32(ltq_cgu_r32(CGU_GPHY1_CR) | CGU_TEMP_PD, CGU_GPHY1_CR); ++ ++ /* wait a short moment to let the SoC get the first temperatur value */ ++ mdelay(100); ++} ++ ++static void ltq_cputemp_disable(void) ++{ ++ ltq_cgu_w32(ltq_cgu_r32(CGU_GPHY1_CR) & ~CGU_TEMP_PD, CGU_GPHY1_CR); ++} ++ ++static int ltq_cputemp_read(void) ++{ ++ int value; ++ ++ /* get the temperature including one decimal place */ ++ value = (ltq_cgu_r32(CGU_GPHY1_CR) >> 9) & 0x01FF; ++ value = (value << 2 ) + value; ++ ++ /* range -38 to +154 °C, register value zero is -38.0 °C */ ++ value -= 380; ++ ++ return value; ++} ++ ++static ssize_t show_cputemp(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ int value; ++ ++ value = ltq_cputemp_read(); ++ /* scale temp to millidegree */ ++ value = value * 100; ++ ++ return sprintf(buf, "%d\n", value); ++} ++ ++static DEVICE_ATTR(temp1_input, S_IRUGO, show_cputemp, NULL); ++ ++static struct attribute *ltq_cputemp_attrs[] = { ++ &dev_attr_temp1_input.attr, ++ NULL ++}; ++ ++ATTRIBUTE_GROUPS(ltq_cputemp); ++ ++static int ltq_cputemp_probe(struct platform_device *pdev) ++{ ++ int value = 0; ++ int ret; ++ struct device *hwmon_dev; ++ ++ /* available on vr9 v1.2 SoCs only */ ++ if (ltq_soc_type() != SOC_TYPE_VR9_2) ++ return -ENODEV; ++ ++ hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev, ++ "CPU0", ++ NULL, ++ ltq_cputemp_groups); ++ ++ if (IS_ERR(hwmon_dev)) { ++ dev_err(&pdev->dev, "Failed to register as hwmon device"); ++ ret = PTR_ERR(hwmon_dev); ++ goto error_hwmon; ++ } ++ ++ ltq_cputemp_enable(); ++ value = ltq_cputemp_read(); ++ dev_info(&pdev->dev, "Current CPU die temperature: %d.%d °C", value / 10, value % 10); ++ ++ return 0; ++ ++error_hwmon: ++ return ret; ++} ++ ++static int ltq_cputemp_release(struct platform_device *pdev) ++{ ++ hwmon_device_unregister(&pdev->dev); ++ ltq_cputemp_disable(); ++ return 0; ++} ++ ++const struct of_device_id ltq_cputemp_match[] = { ++ { .compatible = "lantiq,cputemp" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ltq_cputemp_match); ++ ++static struct platform_driver ltq_cputemp_driver = { ++ .probe = ltq_cputemp_probe, ++ .remove = ltq_cputemp_release, ++ .driver = { ++ .name = "ltq-cputemp", ++ .owner = THIS_MODULE, ++ .of_match_table = ltq_cputemp_match, ++ }, ++}; ++ ++int __init init_ltq_cputemp(void) ++{ ++ int ret; ++ ++ ret = platform_driver_register(<q_cputemp_driver); ++ return ret; ++} ++ ++void clean_ltq_cputemp(void) ++{ ++ platform_driver_unregister(<q_cputemp_driver); ++ return; ++} ++ ++module_init(init_ltq_cputemp); ++module_exit(clean_ltq_cputemp); ++ ++MODULE_AUTHOR("Florian Eckert "); ++ ++MODULE_DESCRIPTION("Lantiq Temperature Sensor"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/lantiq/xrx200/config-4.9 b/target/linux/lantiq/xrx200/config-4.9 new file mode 100644 index 000000000..73ccaf34a --- /dev/null +++ b/target/linux/lantiq/xrx200/config-4.9 @@ -0,0 +1,90 @@ +CONFIG_ADM6996_PHY=y +CONFIG_AR8216_PHY=y +CONFIG_AT803X_PHY=y +CONFIG_BLK_MQ_PCI=y +CONFIG_CPU_MIPSR2_IRQ_EI=y +CONFIG_CPU_MIPSR2_IRQ_VI=y +CONFIG_CPU_RMAP=y +CONFIG_CRC16=y +CONFIG_CRYPTO_AEAD=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +CONFIG_CRYPTO_NULL2=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_HWMON=y +CONFIG_ICPLUS_PHY=y +CONFIG_IFX_VPE_EXT=y +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_POLLDEV=y +CONFIG_INTEL_XWAY_PHY=y +# CONFIG_ISDN is not set +CONFIG_LANTIQ_XRX200=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MIPS_MT=y +# CONFIG_MIPS_MT_FPAFF is not set +CONFIG_MIPS_MT_SMP=y +CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y +CONFIG_MIPS_VPE_APSP_API=y +CONFIG_MIPS_VPE_APSP_API_MT=y +CONFIG_MIPS_VPE_LOADER=y +CONFIG_MIPS_VPE_LOADER_MT=y +CONFIG_MIPS_VPE_LOADER_TOM=y +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_PLATFORM=y +CONFIG_MTD_NAND_XWAY=y +# CONFIG_MTD_PHYSMAP_OF is not set +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +CONFIG_MTD_UBI_BLOCK=y +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NLS=y +CONFIG_NR_CPUS=2 +CONFIG_OF_ADDRESS_PCI=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_PADATA=y +CONFIG_PCI=y +CONFIG_PCIE_LANTIQ=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_LANTIQ=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO=y +CONFIG_POWER_SUPPLY=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_RFS_ACCEL=y +CONFIG_RPS=y +CONFIG_RTL8306_PHY=y +CONFIG_RTL8366S_PHY=y +CONFIG_RTL8367B_PHY=y +CONFIG_RTL8367_PHY=y +CONFIG_SENSORS_LTQ_CPUTEMP=y +CONFIG_SMP=y +CONFIG_SMP_UP=y +CONFIG_SWCONFIG_LEDS=y +CONFIG_SYNC_R4K=y +CONFIG_SYS_SUPPORTS_SCHED_SMT=y +CONFIG_SYS_SUPPORTS_SMP=y +CONFIG_TREE_RCU=y +CONFIG_UBIFS_FS=y +CONFIG_UBIFS_FS_ADVANCED_COMPR=y +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y +CONFIG_USB=y +CONFIG_USB_COMMON=y +# CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_SUPPORT=y +# CONFIG_USB_UHCI_HCD is not set +CONFIG_XPS=y +CONFIG_XRX200_PHY_FW=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/lantiq/xway/config-4.9 b/target/linux/lantiq/xway/config-4.9 new file mode 100644 index 000000000..79064ccc0 --- /dev/null +++ b/target/linux/lantiq/xway/config-4.9 @@ -0,0 +1,48 @@ +CONFIG_ADM6996_PHY=y +CONFIG_AR8216_PHY=y +CONFIG_BLK_MQ_PCI=y +CONFIG_CRC16=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LZO=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_POLLDEV=y +# CONFIG_ISDN is not set +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_PLATFORM=y +CONFIG_MTD_NAND_XWAY=y +# CONFIG_MTD_PHYSMAP_OF is not set +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +CONFIG_MTD_UBI_BLOCK=y +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_NLS=y +CONFIG_OF_ADDRESS_PCI=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_PCI=y +# CONFIG_PCIE_LANTIQ is not set +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_LANTIQ=y +CONFIG_RTL8306_PHY=y +CONFIG_RTL8366S_PHY=y +CONFIG_RTL8367B_PHY=y +CONFIG_RTL8367_PHY=y +CONFIG_UBIFS_FS=y +CONFIG_UBIFS_FS_ADVANCED_COMPR=y +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y +CONFIG_USB=y +CONFIG_USB_COMMON=y +# CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_SUPPORT=y +# CONFIG_USB_UHCI_HCD is not set +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/lantiq/xway_legacy/config-4.9 b/target/linux/lantiq/xway_legacy/config-4.9 new file mode 100644 index 000000000..c8aa63178 --- /dev/null +++ b/target/linux/lantiq/xway_legacy/config-4.9 @@ -0,0 +1,37 @@ +CONFIG_ADM6996_PHY=y +CONFIG_AR8216_PHY=y +CONFIG_BLK_MQ_PCI=y +CONFIG_CRC16=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_LZO=y +CONFIG_FIRMWARE_IN_KERNEL=y +# CONFIG_GPIO_SYSFS is not set +# CONFIG_HW_RANDOM is not set +CONFIG_INPUT=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_POLLDEV=y +# CONFIG_ISDN is not set +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +# CONFIG_LEDS_TRIGGER_TIMER is not set +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +# CONFIG_MTD_PHYSMAP_OF is not set +CONFIG_NLS=y +CONFIG_OF_ADDRESS_PCI=y +CONFIG_OF_PCI=y +CONFIG_OF_PCI_IRQ=y +CONFIG_PCI=y +# CONFIG_PCIE_LANTIQ is not set +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_LANTIQ=y +CONFIG_RTL8306_PHY=y +CONFIG_RTL8366S_PHY=y +CONFIG_RTL8367B_PHY=y +CONFIG_RTL8367_PHY=y +CONFIG_USB=y +CONFIG_USB_COMMON=y +# CONFIG_USB_EHCI_HCD is not set +CONFIG_USB_SUPPORT=y +# CONFIG_USB_UHCI_HCD is not set +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/layerscape/armv8_64b/config-4.9 b/target/linux/layerscape/armv8_64b/config-4.9 index 976006ca4..20758d41e 100644 --- a/target/linux/layerscape/armv8_64b/config-4.9 +++ b/target/linux/layerscape/armv8_64b/config-4.9 @@ -81,6 +81,7 @@ CONFIG_ARM64_PAGE_SHIFT=12 CONFIG_ARM64_PAN=y # CONFIG_ARM64_PTDUMP is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_ARM64_SSBD=y CONFIG_ARM64_UAO=y CONFIG_ARM64_VA_BITS=48 # CONFIG_ARM64_VA_BITS_39 is not set @@ -530,6 +531,7 @@ CONFIG_GPIO_PL061=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_XGENE=y CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y @@ -1154,6 +1156,7 @@ CONFIG_UIO_PDRV_GENIRQ=y CONFIG_UIO_SERCOS3=y CONFIG_UNINLINE_SPIN_UNLOCK=y CONFIG_UNIX_DIAG=y +CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_USB_SUPPORT=y # CONFIG_USERIO is not set CONFIG_USER_NS=y diff --git a/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch b/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch index dd71b826f..3484fc398 100644 --- a/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/202-core-linux-support-layerscape.patch @@ -384,7 +384,7 @@ Signed-off-by: Yangbo Lu void __kfree_skb(struct sk_buff *skb); extern struct kmem_cache *skbuff_head_cache; -@@ -3057,6 +3058,7 @@ static inline void skb_free_datagram_loc +@@ -3059,6 +3060,7 @@ static inline void skb_free_datagram_loc } int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags); int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len); @@ -477,7 +477,7 @@ Signed-off-by: Yangbo Lu /* Make sure a field is enclosed inside headers_start/headers_end section */ #define CHECK_SKB_FIELD(field) \ BUILD_BUG_ON(offsetof(struct sk_buff, field) < \ -@@ -1074,7 +1100,7 @@ static void skb_headers_offset_update(st +@@ -1075,7 +1101,7 @@ static void skb_headers_offset_update(st skb->inner_mac_header += off; } @@ -486,7 +486,7 @@ Signed-off-by: Yangbo Lu { __copy_skb_header(new, old); -@@ -1082,6 +1108,7 @@ static void copy_skb_header(struct sk_bu +@@ -1083,6 +1109,7 @@ static void copy_skb_header(struct sk_bu skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type; } diff --git a/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch b/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch index e8fc1ec2b..9d8496860 100644 --- a/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/401-mtd-spi-nor-support-layerscape.patch @@ -705,7 +705,7 @@ Signed-off-by: Yangbo Lu case SPI_NOR_NORMAL: return 0; } -@@ -962,6 +974,8 @@ static const struct flash_info spi_nor_i +@@ -961,6 +973,8 @@ static const struct flash_info spi_nor_i /* ESMT */ { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, @@ -714,7 +714,7 @@ Signed-off-by: Yangbo Lu /* Everspin */ { "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, -@@ -1015,12 +1029,15 @@ static const struct flash_info spi_nor_i +@@ -1014,12 +1028,15 @@ static const struct flash_info spi_nor_i { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) }, { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, @@ -731,7 +731,7 @@ Signed-off-by: Yangbo Lu { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) }, { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, -@@ -1034,10 +1051,11 @@ static const struct flash_info spi_nor_i +@@ -1033,10 +1050,11 @@ static const struct flash_info spi_nor_i { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, @@ -745,7 +745,7 @@ Signed-off-by: Yangbo Lu /* PMC */ { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) }, -@@ -1055,8 +1073,11 @@ static const struct flash_info spi_nor_i +@@ -1054,8 +1072,11 @@ static const struct flash_info spi_nor_i { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, @@ -758,7 +758,7 @@ Signed-off-by: Yangbo Lu { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) }, { "s25sl008a", INFO(0x010213, 0, 64 * 1024, 16, 0) }, -@@ -1131,6 +1152,9 @@ static const struct flash_info spi_nor_i +@@ -1130,6 +1151,9 @@ static const struct flash_info spi_nor_i { "w25x80", INFO(0xef3014, 0, 64 * 1024, 16, SECT_4K) }, { "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) }, { "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) }, @@ -768,7 +768,7 @@ Signed-off-by: Yangbo Lu { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) }, { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, -@@ -1197,6 +1221,53 @@ static const struct flash_info *spi_nor_ +@@ -1196,6 +1220,53 @@ static const struct flash_info *spi_nor_ id[0], id[1], id[2]); return ERR_PTR(-ENODEV); } @@ -822,7 +822,7 @@ Signed-off-by: Yangbo Lu static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) -@@ -1416,7 +1487,7 @@ static int macronix_quad_enable(struct s +@@ -1415,7 +1486,7 @@ static int macronix_quad_enable(struct s * Write status Register and configuration register with 2 bytes * The first byte will be written to the status register, while the * second byte will be written to the configuration register. @@ -831,7 +831,7 @@ Signed-off-by: Yangbo Lu */ static int write_sr_cr(struct spi_nor *nor, u16 val) { -@@ -1464,6 +1535,24 @@ static int spansion_quad_enable(struct s +@@ -1463,6 +1534,24 @@ static int spansion_quad_enable(struct s return 0; } @@ -856,7 +856,7 @@ Signed-off-by: Yangbo Lu static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info) { int status; -@@ -1610,9 +1699,25 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1609,9 +1698,25 @@ int spi_nor_scan(struct spi_nor *nor, co write_sr(nor, 0); spi_nor_wait_till_ready(nor); } @@ -882,7 +882,7 @@ Signed-off-by: Yangbo Lu mtd->priv = nor; mtd->type = MTD_NORFLASH; mtd->writesize = 1; -@@ -1646,6 +1751,8 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1645,6 +1750,8 @@ int spi_nor_scan(struct spi_nor *nor, co nor->flags |= SNOR_F_USE_FSR; if (info->flags & SPI_NOR_HAS_TB) nor->flags |= SNOR_F_HAS_SR_TB; @@ -891,7 +891,7 @@ Signed-off-by: Yangbo Lu #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS /* prefer "small sector" erase if possible */ -@@ -1685,9 +1792,15 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1684,9 +1791,15 @@ int spi_nor_scan(struct spi_nor *nor, co /* Some devices cannot do fast-read, no matter what DT tells us */ if (info->flags & SPI_NOR_NO_FR) nor->flash_read = SPI_NOR_NORMAL; @@ -910,7 +910,7 @@ Signed-off-by: Yangbo Lu ret = set_quad_mode(nor, info); if (ret) { dev_err(dev, "quad mode not supported\n"); -@@ -1700,6 +1813,9 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1699,6 +1812,9 @@ int spi_nor_scan(struct spi_nor *nor, co /* Default commands */ switch (nor->flash_read) { diff --git a/target/linux/layerscape/patches-4.9/402-mtd-support-layerscape.patch b/target/linux/layerscape/patches-4.9/402-mtd-support-layerscape.patch index 6b3485700..9f44e9e72 100644 --- a/target/linux/layerscape/patches-4.9/402-mtd-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/402-mtd-support-layerscape.patch @@ -358,7 +358,7 @@ Signed-off-by: Yangbo Lu help --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c -@@ -898,7 +898,7 @@ static int fsl_ifc_chip_init(struct fsl_ +@@ -901,7 +901,7 @@ static int fsl_ifc_chip_init(struct fsl_ chip->ecc.algo = NAND_ECC_HAMMING; } diff --git a/target/linux/layerscape/patches-4.9/702-pci-support-layerscape.patch b/target/linux/layerscape/patches-4.9/702-pci-support-layerscape.patch index 37eb5410d..724c6841f 100644 --- a/target/linux/layerscape/patches-4.9/702-pci-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/702-pci-support-layerscape.patch @@ -2060,7 +2060,7 @@ Signed-off-by: Yangbo Lu } --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c -@@ -4659,3 +4659,11 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IN +@@ -4679,3 +4679,11 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IN DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2031, quirk_no_aersid); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032, quirk_no_aersid); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid); diff --git a/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch b/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch index acc75cdc2..4327a2664 100644 --- a/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/703-phy-support-layerscape.patch @@ -1724,7 +1724,7 @@ Signed-off-by: Yangbo Lu ret = phydrv->resume(phydev); if (ret) -@@ -1726,7 +1726,7 @@ static int phy_remove(struct device *dev +@@ -1723,7 +1723,7 @@ static int phy_remove(struct device *dev phydev->state = PHY_DOWN; mutex_unlock(&phydev->lock); diff --git a/target/linux/layerscape/patches-4.9/809-i2c-support-layerscape.patch b/target/linux/layerscape/patches-4.9/809-i2c-support-layerscape.patch index 0b5f5837f..ffb95cc34 100644 --- a/target/linux/layerscape/patches-4.9/809-i2c-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/809-i2c-support-layerscape.patch @@ -95,7 +95,7 @@ Signed-off-by: Yangbo Lu }; static const struct imx_i2c_hwdata imx1_i2c_hwdata = { -@@ -879,6 +938,78 @@ static int i2c_imx_read(struct imx_i2c_s +@@ -878,6 +937,78 @@ static int i2c_imx_read(struct imx_i2c_s return 0; } @@ -174,7 +174,7 @@ Signed-off-by: Yangbo Lu static int i2c_imx_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num) { -@@ -889,6 +1020,19 @@ static int i2c_imx_xfer(struct i2c_adapt +@@ -888,6 +1019,19 @@ static int i2c_imx_xfer(struct i2c_adapt dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); @@ -194,7 +194,7 @@ Signed-off-by: Yangbo Lu result = pm_runtime_get_sync(i2c_imx->adapter.dev.parent); if (result < 0) goto out; -@@ -1031,6 +1175,50 @@ static int i2c_imx_init_recovery_info(st +@@ -1030,6 +1174,50 @@ static int i2c_imx_init_recovery_info(st return 0; } @@ -245,7 +245,7 @@ Signed-off-by: Yangbo Lu static u32 i2c_imx_func(struct i2c_adapter *adapter) { return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL -@@ -1086,6 +1274,11 @@ static int i2c_imx_probe(struct platform +@@ -1085,6 +1273,11 @@ static int i2c_imx_probe(struct platform i2c_imx->adapter.dev.of_node = pdev->dev.of_node; i2c_imx->base = base; @@ -257,7 +257,7 @@ Signed-off-by: Yangbo Lu /* Get I2C clock */ i2c_imx->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(i2c_imx->clk)) { -@@ -1100,7 +1293,7 @@ static int i2c_imx_probe(struct platform +@@ -1099,7 +1292,7 @@ static int i2c_imx_probe(struct platform } /* Request IRQ */ diff --git a/target/linux/layerscape/patches-4.9/810-iommu-support-layerscape.patch b/target/linux/layerscape/patches-4.9/810-iommu-support-layerscape.patch index b9faa504b..050092905 100644 --- a/target/linux/layerscape/patches-4.9/810-iommu-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/810-iommu-support-layerscape.patch @@ -1472,7 +1472,7 @@ Signed-off-by: Yangbo Lu } --- a/include/linux/dma-iommu.h +++ b/include/linux/dma-iommu.h -@@ -27,6 +27,7 @@ int iommu_dma_init(void); +@@ -28,6 +28,7 @@ int iommu_dma_init(void); /* Domain management interface for IOMMU drivers */ int iommu_get_dma_cookie(struct iommu_domain *domain); @@ -1480,7 +1480,7 @@ Signed-off-by: Yangbo Lu void iommu_put_dma_cookie(struct iommu_domain *domain); /* Setup call for arch DMA mapping code */ -@@ -66,6 +67,7 @@ int iommu_dma_mapping_error(struct devic +@@ -67,6 +68,7 @@ int iommu_dma_mapping_error(struct devic /* The DMA API isn't _quite_ the whole story, though... */ void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg); @@ -1488,7 +1488,7 @@ Signed-off-by: Yangbo Lu #else -@@ -82,6 +84,11 @@ static inline int iommu_get_dma_cookie(s +@@ -83,6 +85,11 @@ static inline int iommu_get_dma_cookie(s return -ENODEV; } @@ -1500,7 +1500,7 @@ Signed-off-by: Yangbo Lu static inline void iommu_put_dma_cookie(struct iommu_domain *domain) { } -@@ -90,6 +97,10 @@ static inline void iommu_dma_map_msi_msg +@@ -91,6 +98,10 @@ static inline void iommu_dma_map_msi_msg { } diff --git a/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch b/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch index 3ec91b498..5af0b088a 100644 --- a/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/817-usb-support-layerscape.patch @@ -87,7 +87,7 @@ Signed-off-by: Yangbo Lu pkt_len = le32_to_cpu(rx_desc->opts1) & RX_LEN_MASK; if (pkt_len < ETH_ZLEN) break; -@@ -4509,6 +4514,7 @@ static struct usb_device_id rtl8152_tabl +@@ -4510,6 +4515,7 @@ static struct usb_device_id rtl8152_tabl {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)}, {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)}, {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, @@ -156,7 +156,7 @@ Signed-off-by: Yangbo Lu int ret; --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -4423,6 +4423,14 @@ hub_port_init(struct usb_hub *hub, struc +@@ -4431,6 +4431,14 @@ hub_port_init(struct usb_hub *hub, struc else speed = usb_speed_string(udev->speed); @@ -1494,7 +1494,7 @@ Signed-off-by: Yangbo Lu while (ep_ring->dequeue != td->last_trb) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1570,14 +1570,38 @@ int xhci_urb_dequeue(struct usb_hcd *hcd +@@ -1604,14 +1604,38 @@ int xhci_urb_dequeue(struct usb_hcd *hcd ret = -ENOMEM; goto done; } @@ -1542,7 +1542,7 @@ Signed-off-by: Yangbo Lu spin_unlock_irqrestore(&xhci->lock, flags); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1621,7 +1621,7 @@ struct xhci_hcd { +@@ -1625,7 +1625,7 @@ struct xhci_hcd { #define XHCI_STATE_REMOVING (1 << 2) /* Statistics */ int error_bitmask; @@ -1551,7 +1551,7 @@ Signed-off-by: Yangbo Lu #define XHCI_LINK_TRB_QUIRK (1 << 0) #define XHCI_RESET_EP_QUIRK (1 << 1) #define XHCI_NEC_HOST (1 << 2) -@@ -1657,6 +1657,9 @@ struct xhci_hcd { +@@ -1661,6 +1661,9 @@ struct xhci_hcd { #define XHCI_SSIC_PORT_UNUSED (1 << 22) #define XHCI_NO_64BIT_SUPPORT (1 << 23) #define XHCI_MISSING_CAS (1 << 24) diff --git a/target/linux/mcs814x/Makefile b/target/linux/mcs814x/Makefile deleted file mode 100644 index 8ba58886e..000000000 --- a/target/linux/mcs814x/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=arm -BOARD:=mcs814x -BOARDNAME:=Moschip MCS814x -FEATURES:=usb squashfs low_mem -CPU_TYPE:=arm926ej-s -MAINTAINER:=Florian Fainelli - -KERNEL_PATCHVER:=3.18 - -DEVICE_TYPE:=other - -include $(INCLUDE_DIR)/target.mk - -DEFAULT_PACKAGES := $(filter-out ppp%,$(DEFAULT_PACKAGES)) \ - kmod-usb-core kmod-usb2 kmod-usb-ohci \ - kmod-usb-storage kmod-fs-vfat \ - kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-iso8859-15 \ - kmod-nls-utf8 \ - kmod-mcs814x-wdt kmod-usb-ledtrig-usbport - -KERNELNAME:=zImage dtbs - -$(eval $(call BuildTarget)) diff --git a/target/linux/mcs814x/base-files/etc/board.d/01_leds b/target/linux/mcs814x/base-files/etc/board.d/01_leds deleted file mode 100755 index 65d738f0a..000000000 --- a/target/linux/mcs814x/base-files/etc/board.d/01_leds +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012-2015 OpenWrt.org -# - -. /lib/functions/uci-defaults.sh - -board_config_update - -board=$(board_name) - -case "$board" in -dlan-usb-extender) - ucidef_set_led_usbdev "usb" "USB" "dlan-usb-extender:green:usb" "2-1" - ;; -rbt-832) - ucidef_set_led_usbdev "usb1" "USB1" "rbt-832:red:usb0" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "rbt-832:red:usb1" "1-2" - ucidef_set_led_usbdev "usb3" "USB3" "rbt-832:red:usb2" "1-3" - ucidef_set_led_usbdev "usb4" "USB4" "rbt-832:red:usb3" "1-4" - ucidef_set_led_netdev "eth" "eth" "rbt-832:red:ethernet" "eth0" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/mcs814x/base-files/etc/board.d/02_network b/target/linux/mcs814x/base-files/etc/board.d/02_network deleted file mode 100755 index d3f2e653f..000000000 --- a/target/linux/mcs814x/base-files/etc/board.d/02_network +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2015 OpenWrt.org -# - -. /lib/functions/uci-defaults.sh - -board_config_update -ucidef_set_interface_lan "eth0" -board_config_flush - -exit 0 diff --git a/target/linux/mcs814x/base-files/lib/mcs814x.sh b/target/linux/mcs814x/base-files/lib/mcs814x.sh deleted file mode 100644 index 3c16c9c12..000000000 --- a/target/linux/mcs814x/base-files/lib/mcs814x.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012 OpenWrt.org -# - -MCS814X_BOARD_NAME= -MCS814X_MODEL= - -mcs814x_board_detect() { - local machine - local name - - machine=$(cat /proc/device-tree/model) - - case "$machine" in - *"Devolo dLAN USB Extender") - name="dlan-usb-extender" - ;; - *"Tigal RBT-832") - name="rbt-832" - ;; - esac - - [ -z "$name" ] && name="unknown" - - [ -z "$MCS814X_BOARD_NAME" ] && MCS814X_BOARD_NAME="$name" - [ -z "$MCS814X_MODEL" ] && MCS814X_MODEL="$machine" - - [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" - - echo "$MCS814X_BOARD_NAME" > /tmp/sysinfo/board_name - echo "$MCS814X_MODEL" > /tmp/sysinfo/model -} diff --git a/target/linux/mcs814x/base-files/lib/preinit/01_preinit_do_mcs814x.sh b/target/linux/mcs814x/base-files/lib/preinit/01_preinit_do_mcs814x.sh deleted file mode 100755 index d509770c5..000000000 --- a/target/linux/mcs814x/base-files/lib/preinit/01_preinit_do_mcs814x.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -do_mcs814x() { - . /lib/mcs814x.sh - - mcs814x_board_detect -} - -boot_hook_add preinit_main do_mcs814x diff --git a/target/linux/mcs814x/config-3.18 b/target/linux/mcs814x/config-3.18 deleted file mode 100644 index 7f1c5705f..000000000 --- a/target/linux/mcs814x/config-3.18 +++ /dev/null @@ -1,236 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -# CONFIG_ARCH_HAS_SG_CHAIN is not set -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MCS814X=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_NR_GPIO=0 -CONFIG_ARCH_REQUIRE_GPIOLIB=y -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USES_GETTIMEOFFSET=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARM=y -CONFIG_ARM_APPENDED_DTB=y -# CONFIG_ARM_ATAG_DTB_COMPAT is not set -# CONFIG_ARM_CPU_SUSPEND is not set -CONFIG_ARM_L1_CACHE_SHIFT=5 -# CONFIG_ARM_THUMB is not set -CONFIG_BINFMT_MISC=y -# CONFIG_CACHE_L2X0 is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="earlyprintk" -CONFIG_CPU_32v5=y -CONFIG_CPU_ABRT_EV5TJ=y -CONFIG_CPU_ARM926T=y -# CONFIG_CPU_CACHE_ROUND_ROBIN is not set -CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_COPY_V4WB=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -# CONFIG_CPU_DCACHE_WRITETHROUGH is not set -# CONFIG_CPU_ICACHE_DISABLE is not set -CONFIG_CPU_PABRT_LEGACY=y -CONFIG_CPU_TLB_V4WBI=y -CONFIG_CPU_USE_DOMAINS=y -CONFIG_CRC_CCITT=y -CONFIG_CRC_ITU_T=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_DEBUG_LL=y -CONFIG_DEBUG_LL_INCLUDE="debug/8250.S" -CONFIG_DEBUG_LL_UART_NONE=y -CONFIG_DEBUG_UART_8250=y -# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set -CONFIG_DEBUG_UART_8250_SHIFT=2 -# CONFIG_DEBUG_UART_8250_WORD is not set -CONFIG_DEBUG_UART_PHYS=0x400dc000 -# CONFIG_DEBUG_UART_PL01X is not set -CONFIG_DEBUG_UART_VIRT=0xf00dc000 -# CONFIG_DEBUG_USER is not set -CONFIG_DTC=y -CONFIG_EARLY_PRINTK=y -# CONFIG_ENABLE_WARN_DEPRECATED is not set -CONFIG_FIQ=y -CONFIG_FRAME_POINTER=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_GPIO_MCS814X=y -CONFIG_GPIO_SYSFS=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_BPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_MCS814X=y -CONFIG_HZ_FIXED=0 -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IOMMU_HELPER=y -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -# CONFIG_ISDN is not set -CONFIG_JFFS2_LZO=y -CONFIG_JFFS2_RUBIN=y -# CONFIG_JFFS2_SUMMARY is not set -CONFIG_JFFS2_ZLIB=y -CONFIG_KALLSYMS=y -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set -# CONFIG_LEDS_TRIGGER_NETDEV is not set -# CONFIG_LEDS_TRIGGER_TIMER is not set -CONFIG_LIBCRC32C=y -CONFIG_LIBFDT=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MACH_DLAN_USB_EXT=y -CONFIG_MACH_RBT_832=y -CONFIG_MCS8140=y -CONFIG_MCS814X_PHY=y -# CONFIG_MCS814X_WATCHDOG is not set -CONFIG_MDIO_BOARDINFO=y -CONFIG_MODULES_USE_ELF_REL=y -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_IMPA7 is not set -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_PHYSMAP=y -# CONFIG_MTD_ROOTFS_SPLIT is not set -CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_FIRMWARE_NAME="linux" -CONFIG_MTD_SPLIT_UIMAGE_FW=y -CONFIG_MULTI_IRQ_HANDLER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_KUSER_HELPERS=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_KEY=y -# CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_VENDOR_FARADAY is not set -# CONFIG_NET_VENDOR_INTEL is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SMSC is not set -# CONFIG_NET_VENDOR_STMICRO is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="iso8859-15" -CONFIG_NO_BOOTMEM=y -CONFIG_NUPORT_ETHERNET_DRIVER=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_MDIO=y -CONFIG_OF_MTD=y -CONFIG_OF_NET=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARTITION_ADVANCED is not set -# CONFIG_PCI_SYSCALL is not set -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PHYLIB=y -CONFIG_PHYS_OFFSET=0x00000000 -# CONFIG_PREEMPT_RCU is not set -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -# CONFIG_RCU_STALL_COMMON is not set -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SCHED_HRTICK is not set -# CONFIG_SCSI_DMA is not set -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SPLIT_PTLOCK_CPUS=999999 -# CONFIG_SWAP is not set -CONFIG_SWIOTLB=y -# CONFIG_SYN_COOKIES is not set -CONFIG_SYSCTL_SYSCALL=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_UID16=y -CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h" -CONFIG_USB_SUPPORT=y -CONFIG_USE_OF=y -CONFIG_VECTORS_BASE=0xffff0000 -# CONFIG_VFP is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WATCHDOG_CORE=y -CONFIG_WATCHDOG_NOWAYOUT=y -# CONFIG_WEXT_PRIV is not set -# CONFIG_WEXT_SPY is not set -# CONFIG_WIRELESS_EXT is not set -CONFIG_XFRM_ALGO=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZBOOT_ROM_BSS=0 -CONFIG_ZBOOT_ROM_TEXT=0 -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/dlan-usb-extender.dts b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/dlan-usb-extender.dts deleted file mode 100644 index ea75a255e..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/dlan-usb-extender.dts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * dlan-usb-extender.dts - Device Tree file for Devolo dLAN USB Extender - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under GPLv2 - */ - -/dts-v1/; -#include "mcs8140.dtsi" - -/ { - model = "Devolo dLAN USB Extender"; - compatible = "devolo,dlan-usb-extender", "moschip,mcs8140", "moschip,mcs814x"; - - chosen { - bootargs = "mem=16M console=ttyS0,57600 earlyprintk"; - }; - - ahb { - vci { - eth0: ethernet@40084000 { - phy = <&phy0>; - phy-mode = "mii"; - - phy0: ethernet-phy@0 { - reg = <8>; - }; - }; - - adc { - sdram: memory@0,0 { - reg = <0 0 0x1000000>; - }; - - nor: flash@7,0 { - - partition@0 { - label = "ArmBoot"; - reg = <0 0x30000>; - }; - partition@30000 { - label = "Config1"; - reg = <0x30000 0x10000>; - }; - partition@40000 { - label = "Config2"; - reg = <0x40000 0x10000>; - }; - partition@50000 { - label = "linux"; - reg = <0x50000 0x4C0000>; - }; - }; - }; - - leds { - compatible = "gpio-leds"; - - usb { - label = "dlan-usb-extender:green:usb"; - gpios = <&gpio 19 0>; // gpio 19 active high - }; - }; - }; - }; -}; - diff --git a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/mcs8140.dtsi b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/mcs8140.dtsi deleted file mode 100644 index e30dc550b..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/mcs8140.dtsi +++ /dev/null @@ -1,189 +0,0 @@ -/* - * mcs8140.dtsi - Device Tree Include file for Moschip MCS8140 family SoC - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under GPLv2. - */ - -#include "skeleton.dtsi" - -/ { - model = "Moschip MCS8140 family SoC"; - compatible = "moschip,mcs8140"; - interrupt-parent = <&intc>; - - aliases { - serial0 = &uart0; - eth0 = ð0; - }; - - cpus { - cpu@0 { - compatible = "arm,arm926ejs"; - }; - }; - - ahb { - compatible = "simple-bus"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - - vci { - compatible = "simple-bus"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - - eth0: ethernet@40084000 { - #address-cells = <1>; - #size-cells = <0>; - - compatible = "moschip,nuport-mac"; - reg = <0x40084000 0xd8 // mac - 0x40080000 0x58>; // dma channels - interrupts = <4 5 29>; /* tx, rx, link */ - nuport-mac,buffer-shifting; - nuport-mac,link-activity = <0>; - }; - - tso@40088000 { - reg = <0x40088000 0x1c>; - interrupts = <7>; - }; - - i2s@4008c000 { - compatible = "moschip,mcs814x-i2s"; - reg = <0x4008c000 0x18>; - interrupts = <8>; - }; - - ipsec@40094000 { - compatible = "moschip,mcs814x-ipsec"; - reg = <0x40094000 0x1d8>; - interrupts = <16>; - }; - - rng@4009c000 { - compatible = "moschip,mcs814x-rng"; - reg = <0x4009c000 0x8>; - }; - - memc@400a8000 { - reg = <0x400a8000 0x58>; - }; - - list-proc@400ac0c0 { - reg = <0x400ac0c0 0x38>; - interrupts = <19 27>; // done, error - }; - - gpio: gpio@400d0000 { - compatible = "moschip,mcs814x-gpio"; - reg = <0x400d0000 0x670>; - interrupts = <10>; - #gpio-cells = <2>; - gpio-controller; - num-gpios = <20>; - }; - - eepio: gpio@400d4000 { - compatible = "moschip,mcs814x-gpio"; - reg = <0x400d4000 0x470>; - #gpio-cells = <2>; - gpio-controller; - num-gpios = <4>; - }; - - uart0: serial@400dc000 { - compatible = "ns16550"; - reg = <0x400dc000 0x20>; - clock-frequency = <50000000>; - reg-shift = <2>; - interrupts = <21>; - status = "okay"; - }; - - intc: interrupt-controller@400e4000 { - #interrupt-cells = <1>; - compatible = "moschip,mcs814x-intc"; - interrupt-controller; - interrupt-parent; - reg = <0x400e4000 0x48>; - }; - - m2m@400e8000 { - reg = <0x400e8000 0x24>; - interrupts = <17>; - }; - - eth-filters@400ec000 { - reg = <0x400ec000 0x80>; - }; - - timer: timer@400f800c { - compatible = "moschip,mcs814x-timer"; - interrupts = <0>; - reg = <0x400f800c 0x8>; - }; - - watchdog@400f8014 { - compatible = "moschip,mcs814x-wdt"; - reg = <0x400f8014 0x8>; - }; - - adc { - compatible = "simple-bus"; - #address-cells = <2>; - #size-cells = <1>; - // 8 64MB chip-selects - ranges = <0 0 0x00000000 0x4000000 // sdram - 1 0 0x04000000 0x4000000 // sdram - 2 0 0x08000000 0x4000000 // reserved - 3 0 0x0c000000 0x4000000 // flash/localbus - 4 0 0x10000000 0x4000000 // flash/localbus - 5 0 0x14000000 0x4000000 // flash/localbus - 6 0 0x18000000 0x4000000 // flash/localbus - 7 0 0x1c000000 0x4000000>; // flash/localbus - - sdram: memory@0,0 { - reg = <0 0 0>; - }; - - nor: flash@7,0 { - reg = <7 0 0x4000000>; - compatible = "cfi-flash"; - bank-width = <1>; // 8-bit external flash - #address-cells = <1>; - #size-cells = <1>; - }; - }; - - usb0: ehci@400fc000 { - compatible = "moschip,mcs814x-ehci", "usb-ehci"; - reg = <0x400fc000 0x74>; - interrupts = <2>; - }; - - usb1: ohci@400fd000 { - compatible = "moschip,mcs814x-ohci", "ohci-le"; - reg = <0x400fd000 0x74>; - interrupts = <11>; - }; - - usb2: ohci@400fe000 { - compatible = "moschip,mcs814x-ohci", "ohci-le"; - reg = <0x400fe000 0x74>; - interrupts = <12>; - }; - - usb3: otg@400ff000 { - compatible = "moschip,msc814x-otg", "usb-otg"; - reg = <0x400ff000 0x1000>; - interrupts = <13>; - }; - }; - - }; -}; diff --git a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/rbt-832.dts b/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/rbt-832.dts deleted file mode 100644 index 997de7d13..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/boot/dts/rbt-832.dts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * rbt-832.dts - Device Tree file for Tigal RBT-832 - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under GPLv2 - */ - -/dts-v1/; -#include "mcs8140.dtsi" - -/ { - model = "Tigal RBT-832"; - compatible = "tigal,rbt-832", "moschip,mcs8140", "moschip,mcs814x"; - - chosen { - bootargs = "mem=32M console=ttyS0,115200 earlyprintk"; - }; - - ahb { - vci { - eth0: ethernet@40084000 { - nuport-mac,link-activity = <0x01>; - phy = <&phy0>; - phy-mode = "mii"; - - phy0: ethernet-phy@0 { - reg = <1>; - }; - }; - - adc { - sdram: memory@0,0 { - reg = <0 0 0x2000000>; - }; - - nor: flash@7,0 { - - partition@0 { - label = "ArmBoot"; - reg = <0 0x40000>; - }; - partition@30000 { - label = "Enviroment"; - reg = <0x40000 0x20000>; - }; - partition@50000 { - label = "bZimage"; - reg = <0x60000 0x1a0000>; - }; - partition@150000 { - label = "UserFS"; - reg = <0x200000 0x600000>; - }; - }; - }; - - leds { - compatible = "gpio-leds"; - - ethernet { - label = "rbt-832:red:ethernet"; - gpios = <&gpio 0 0>; // gpio 0 active high - }; - - usb0 { - label = "rbt-832:red:usb0"; - gpios = <&gpio 4 0>; // gpio 4 active high - }; - - usb1 { - label = "rbt-832:red:usb1"; - gpios = <&gpio 3 0>; // gpio 3 active high - }; - - usb2 { - label = "rbt-832:red:usb2"; - gpios = <&gpio 2 0>; // gpio 2 active high - }; - - usb3 { - label = "rbt-832:red:usb3"; - gpios = <&gpio 1 0>; // gpio 1 active high - }; - }; - }; - }; -}; - diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Kconfig b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Kconfig deleted file mode 100644 index 372c9b87b..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Kconfig +++ /dev/null @@ -1,29 +0,0 @@ -if ARCH_MCS814X - -config MCS8140 - bool - select CPU_ARM926T - -menu "Moschip MCS8140 boards" - -config MACH_DLAN_USB_EXT - bool "Devolo dLAN USB Extender" - select MCS8140 - select NEW_LEDS - select LEDS_CLASS - select LEDS_GPIO - help - Machine support for the Devolo dLAN USB Extender - -config MACH_RBT_832 - bool "Tigal RBT-832" - select MCS8140 - select NEW_LEDS - select LEDS_CLASS - select LEDS_GPIO - help - Machine support for the Tigal RBT-832 board - -endmenu - -endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile deleted file mode 100644 index 68c5f4a9f..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -obj-y += clock.o -obj-y += common.o -obj-y += irq.o -obj-y += timer.o -obj-y += board-mcs8140-dt.o diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile.boot b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile.boot deleted file mode 100644 index b5725078d..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/Makefile.boot +++ /dev/null @@ -1,4 +0,0 @@ - zreladdr-y := 0x00008000 - -dtb-$(CONFIG_MACH_DLAN_USB_EXT) += dlan-usb-extender.dtb -dtb-$(CONFIG_MACH_RBT_832) += rbt-832.dtb diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/board-mcs8140-dt.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/board-mcs8140-dt.c deleted file mode 100644 index 0d11450c7..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/board-mcs8140-dt.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Setup code for Moschip MCS8140-based board using Device Tree - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under GPLv2. - */ -#include -#include -#include -#include -#include -#include - -#include "common.h" - -#include -#include -#include -#include -#include - -static void __init mcs814x_dt_device_init(void) -{ - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - mcs814x_init_machine(); -} - -static const char *mcs8140_dt_board_compat[] __initdata = { - "moschip,mcs8140", - NULL, /* sentinel */ -}; - -DT_MACHINE_START(mcs8140_dt, "Moschip MCS8140 board") - /* Maintainer: Florian Fainelli */ - .map_io = mcs814x_map_io, - .init_early = mcs814x_clk_init, - .init_irq = mcs814x_of_irq_init, - .init_time = mcs814x_timer_init, - .init_machine = mcs814x_dt_device_init, - .restart = mcs814x_restart, - .dt_compat = mcs8140_dt_board_compat, - .handle_irq = mcs814x_handle_irq, -MACHINE_END - diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/clock.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/clock.c deleted file mode 100644 index 413bfecaa..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/clock.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Moschip MCS814x clock routines - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under GPLv2 - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "common.h" - -#define KHZ 1000 -#define MHZ (KHZ * KHZ) - -struct clk_ops { - unsigned long (*get_rate)(struct clk *clk); - int (*set_rate)(struct clk *clk, unsigned long rate); - struct clk *(*get_parent)(struct clk *clk); - int (*enable)(struct clk *clk, int enable); -}; - -struct clk { - struct clk *parent; /* parent clk */ - unsigned long rate; /* clock rate in Hz */ - unsigned long divider; /* clock divider */ - u32 usecount; /* reference count */ - struct clk_ops *ops; /* clock operation */ - u32 enable_reg; /* clock enable register */ - u32 enable_mask; /* clock enable mask */ -}; - -static unsigned long clk_divide_parent(struct clk *clk) -{ - if (clk->parent && clk->divider) - return clk_get_rate(clk->parent) / clk->divider; - else - return 0; -} - -static int clk_local_onoff_enable(struct clk *clk, int enable) -{ - u32 tmp; - - /* no enable_reg means the clock is always enabled */ - if (!clk->enable_reg) - return 0; - - tmp = readl_relaxed(mcs814x_sysdbg_base + clk->enable_reg); - if (!enable) - tmp &= ~clk->enable_mask; - else - tmp |= clk->enable_mask; - - writel_relaxed(tmp, mcs814x_sysdbg_base + clk->enable_reg); - - return 0; -} - -static struct clk_ops default_clk_ops = { - .get_rate = clk_divide_parent, - .enable = clk_local_onoff_enable, -}; - -static DEFINE_SPINLOCK(clocks_lock); - -static const unsigned long cpu_freq_table[] = { - 175000, - 300000, - 125000, - 137500, - 212500, - 250000, - 162500, - 187500, - 162500, - 150000, - 225000, - 237500, - 200000, - 262500, - 275000, - 287500 -}; - -static struct clk clk_cpu; - -/* System clock is fixed at 50Mhz */ -static struct clk clk_sys = { - .rate = 50 * MHZ, -}; - -static struct clk clk_sdram; - -static struct clk clk_timer0 = { - .parent = &clk_sdram, - .divider = 2, - .ops = &default_clk_ops, -}; - -static struct clk clk_timer1_2 = { - .parent = &clk_sys, -}; - -/* Watchdog clock is system clock / 128 */ -static struct clk clk_wdt = { - .parent = &clk_sys, - .divider = 128, - .ops = &default_clk_ops, -}; - -static struct clk clk_emac = { - .ops = &default_clk_ops, - .enable_reg = SYSDBG_SYSCTL, - .enable_mask = SYSCTL_EMAC, -}; - -static struct clk clk_ephy = { - .ops = &default_clk_ops, - .enable_reg = SYSDBG_PLL_CTL, - .enable_mask = ~SYSCTL_EPHY, /* active low */ -}; - -static struct clk clk_cipher = { - .ops = &default_clk_ops, - .enable_reg = SYSDBG_SYSCTL, - .enable_mask = SYSCTL_CIPHER, -}; - -#define CLK(_dev, _con, _clk) \ -{ .dev_id = (_dev), .con_id = (_con), .clk = (_clk) }, - -static struct clk_lookup mcs814x_chip_clks[] = { - CLK("cpu", NULL, &clk_cpu) - CLK("sys", NULL, &clk_sys) - CLK("sdram", NULL, &clk_sdram) - /* 32-bits timer0 */ - CLK("timer0", NULL, &clk_timer0) - /* 16-bits timer1 */ - CLK("timer1", NULL, &clk_timer1_2) - /* 64-bits timer2, same as timer 1 */ - CLK("timer2", NULL, &clk_timer1_2) - CLK(NULL, "wdt", &clk_wdt) - CLK(NULL, "emac", &clk_emac) - CLK(NULL, "ephy", &clk_ephy) - CLK(NULL, "cipher", &clk_cipher) -}; - -static void local_clk_disable(struct clk *clk) -{ - WARN_ON(!clk->usecount); - - if (clk->usecount > 0) { - clk->usecount--; - - if ((clk->usecount == 0) && (clk->ops->enable)) - clk->ops->enable(clk, 0); - - if (clk->parent) - local_clk_disable(clk->parent); - } -} - -static int local_clk_enable(struct clk *clk) -{ - int ret = 0; - - if (clk->parent) - ret = local_clk_enable(clk->parent); - - if (ret) - return ret; - - if ((clk->usecount == 0) && (clk->ops->enable)) - ret = clk->ops->enable(clk, 1); - - if (!ret) - clk->usecount++; - else if (clk->parent && clk->parent->ops->enable) - local_clk_disable(clk->parent); - - return ret; -} - -int clk_enable(struct clk *clk) -{ - int ret; - unsigned long flags; - - spin_lock_irqsave(&clocks_lock, flags); - ret = local_clk_enable(clk); - spin_unlock_irqrestore(&clocks_lock, flags); - - return ret; -} -EXPORT_SYMBOL(clk_enable); - -void clk_disable(struct clk *clk) -{ - unsigned long flags; - - spin_lock_irqsave(&clocks_lock, flags); - local_clk_disable(clk); - spin_unlock_irqrestore(&clocks_lock, flags); -} -EXPORT_SYMBOL(clk_disable); - -unsigned long clk_get_rate(struct clk *clk) -{ - if (unlikely(IS_ERR_OR_NULL(clk))) - return 0; - - if (clk->rate) - return clk->rate; - - if (clk->ops && clk->ops->get_rate) - return clk->ops->get_rate(clk); - - return clk_get_rate(clk->parent); -} -EXPORT_SYMBOL(clk_get_rate); - -struct clk *clk_get_parent(struct clk *clk) -{ - unsigned long flags; - - if (unlikely(IS_ERR_OR_NULL(clk))) - return NULL; - - if (!clk->ops || !clk->ops->get_parent) - return clk->parent; - - spin_lock_irqsave(&clocks_lock, flags); - clk->parent = clk->ops->get_parent(clk); - spin_unlock_irqrestore(&clocks_lock, flags); - - return clk->parent; -} -EXPORT_SYMBOL(clk_get_parent); - -void __init mcs814x_clk_init(void) -{ - u32 bs1; - u8 cpu_freq; - - clkdev_add_table(mcs814x_chip_clks, ARRAY_SIZE(mcs814x_chip_clks)); - - /* read the bootstrap registers to know the exact clocking scheme */ - bs1 = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS1); - cpu_freq = (bs1 >> CPU_FREQ_SHIFT) & CPU_FREQ_MASK; - - pr_info("CPU frequency: %lu (kHz)\n", cpu_freq_table[cpu_freq]); - clk_cpu.rate = cpu_freq * KHZ; - - /* read SDRAM frequency */ - if (bs1 & SDRAM_FREQ_BIT) - clk_sdram.rate = 100 * MHZ; - else - clk_sdram.rate = 133 * MHZ; - - pr_info("SDRAM frequency: %lu (MHz)\n", clk_sdram.rate / MHZ); -} - diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.c deleted file mode 100644 index 3f1be1fe2..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * arch/arm/mach-mcs814x/common.c - * - * Core functions for Moschip MCS814x SoCs - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -void __iomem *mcs814x_sysdbg_base; - -static struct map_desc mcs814x_io_desc[] __initdata = { - { - .virtual = MCS814X_IO_BASE, - .pfn = __phys_to_pfn(MCS814X_IO_START), - .length = MCS814X_IO_SIZE, - .type = MT_DEVICE - }, -}; - -struct cpu_mode { - const char *name; - int gpio_start; - int gpio_end; -}; - -static const struct cpu_mode cpu_modes[] = { - { - .name = "I2S", - .gpio_start = 4, - .gpio_end = 8, - }, - { - .name = "UART", - .gpio_start = 4, - .gpio_end = 9, - }, - { - .name = "External MII", - .gpio_start = 0, - .gpio_end = 16, - }, - { - .name = "Normal", - .gpio_start = -1, - .gpio_end = -1, - }, -}; - -static void mcs814x_eth_hardware_filter_set(u8 value) -{ - u32 reg; - - reg = readl_relaxed(MCS814X_VIRT_BASE + MCS814X_DBGLED); - if (value) - reg |= 0x80; - else - reg &= ~0x80; - writel_relaxed(reg, MCS814X_VIRT_BASE + MCS814X_DBGLED); -} - -static void mcs814x_eth_led_cfg_set(u8 cfg) -{ - u32 reg; - - reg = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS2); - reg &= ~LED_CFG_MASK; - reg |= cfg; - writel_relaxed(reg, mcs814x_sysdbg_base + SYSDBG_BS2); -} - -static void mcs814x_eth_buffer_shifting_set(u8 value) -{ - u8 reg; - - reg = readb_relaxed(mcs814x_sysdbg_base + SYSDBG_SYSCTL_MAC); - if (value) - reg |= BUF_SHIFT_BIT; - else - reg &= ~BUF_SHIFT_BIT; - writeb_relaxed(reg, mcs814x_sysdbg_base + SYSDBG_SYSCTL_MAC); -} - -static struct of_device_id mcs814x_eth_ids[] __initdata = { - { .compatible = "moschip,nuport-mac", }, - { /* sentinel */ }, -}; - -/* Configure platform specific knobs based on ethernet device node - * properties */ -static void mcs814x_eth_init(void) -{ - struct device_node *np; - const unsigned int *intspec; - - np = of_find_matching_node(NULL, mcs814x_eth_ids); - if (!np) - return; - - /* hardware filter must always be enabled */ - mcs814x_eth_hardware_filter_set(1); - - intspec = of_get_property(np, "nuport-mac,buffer-shifting", NULL); - if (!intspec) - mcs814x_eth_buffer_shifting_set(0); - else - mcs814x_eth_buffer_shifting_set(1); - - intspec = of_get_property(np, "nuport-mac,link-activity", NULL); - if (intspec) - mcs814x_eth_led_cfg_set(be32_to_cpup(intspec)); - - of_node_put(np); -} - -void __init mcs814x_init_machine(void) -{ - u32 bs2, cpu_mode; - int gpio; - - bs2 = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS2); - cpu_mode = (bs2 >> CPU_MODE_SHIFT) & CPU_MODE_MASK; - - pr_info("CPU mode: %s\n", cpu_modes[cpu_mode].name); - - /* request the gpios since the pins are muxed for functionnality */ - for (gpio = cpu_modes[cpu_mode].gpio_start; - gpio == cpu_modes[cpu_mode].gpio_end; gpio++) { - if (gpio != -1) - gpio_request(gpio, cpu_modes[cpu_mode].name); - } - - mcs814x_eth_init(); -} - -void __init mcs814x_map_io(void) -{ - iotable_init(mcs814x_io_desc, ARRAY_SIZE(mcs814x_io_desc)); - - mcs814x_sysdbg_base = ioremap(MCS814X_IO_START + MCS814X_SYSDBG, - MCS814X_SYSDBG_SIZE); - if (!mcs814x_sysdbg_base) - panic("unable to remap sysdbg base"); -} - -void mcs814x_restart(enum reboot_mode mode, const char *cmd) -{ - writel_relaxed(~(1 << 31), mcs814x_sysdbg_base); -} diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.h deleted file mode 100644 index 4a6c9ad2a..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/common.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __ARCH_MCS814X_COMMON_H -#define __ARCH_MCS814X_COMMON_H - -#include -#include - -void mcs814x_map_io(void); -void mcs814x_clk_init(void); -void mcs814x_of_irq_init(void); -void mcs814x_init_machine(void); -void mcs814x_handle_irq(struct pt_regs *regs); -void mcs814x_restart(enum reboot_mode mode, const char *cmd); -void mcs814x_timer_init(void); -extern void __iomem *mcs814x_sysdbg_base; - -#endif /* __ARCH_MCS814X_COMMON_H */ diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/cpu.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/cpu.h deleted file mode 100644 index 1ef3c4a03..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/cpu.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __ASM_ARCH_CPU_H__ -#define __ASM_ARCH_CPU_H__ - -#include - -#define MCS8140_ID 0x41069260 /* ARM926EJ-S */ -#define MCS814X_MASK 0xff0ffff0 - -#ifdef CONFIG_MCS8140 -/* Moschip MCS8140 is based on an ARM926EJ-S core */ -#define soc_is_mcs8140() ((read_cpuid_id() & MCS814X_MASK) == MCS8140_ID) -#else -#define soc_is_mcs8140() (0) -#endif /* !CONFIG_MCS8140 */ - -#endif /* __ASM_ARCH_CPU_H__ */ diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/debug-macro.S b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/debug-macro.S deleted file mode 100644 index 93ecea4ed..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/debug-macro.S +++ /dev/null @@ -1,11 +0,0 @@ -#include - - .macro addruart, rp, rv, tmp - ldr \rp, =MCS814X_PHYS_BASE - ldr \rv, =MCS814X_VIRT_BASE - orr \rp, \rp, #MCS814X_UART - orr \rv, \rv, #MCS814X_UART - .endm - -#define UART_SHIFT 2 -#include diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/entry-macro.S b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/entry-macro.S deleted file mode 100644 index 16d2d6d1a..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/entry-macro.S +++ /dev/null @@ -1,6 +0,0 @@ -#include - .macro disable_fiq - .endm - - .macro arch_ret_to_user, tmp1, tmp2 - .endm diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/gpio.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/gpio.h deleted file mode 100644 index 20240c2ea..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/gpio.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __ASM_ARCH_GPIO_H -#define __ASM_ARCH_GPIO_H - -/* new generic GPIO API */ -#include - -#define gpio_get_value __gpio_get_value -#define gpio_set_value __gpio_set_value -#define gpio_cansleep __gpio_cansleep - -static inline int gpio_to_irq(unsigned gpio) -{ - return -EINVAL; -} - -static inline int irq_to_gpio(unsigned irq) -{ - return -EINVAL; -} - -#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/hardware.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/hardware.h deleted file mode 100644 index 529f648ae..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/hardware.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2003 Artec Design Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef __ASM_ARCH_HARDWARE_H -#define __ASM_ARCH_HARDWARE_H - -#include "mcs814x.h" - -#endif - diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/io.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/io.h deleted file mode 100644 index 80e56f6ca..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/io.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2003 Artec Design Ltd. - * Copyright (C) 2012, Florian Fainelli - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef __ASM_ARM_ARCH_IO_H -#define __ASM_ARM_ARCH_IO_H - -#define IO_SPACE_LIMIT 0xffffffff - -/* - * We don't support ins[lb]/outs[lb]. Make them fault. - */ -#define __raw_readsb(p, d, l) do { *(int *)0 = 0; } while (0) -#define __raw_readsl(p, d, l) do { *(int *)0 = 0; } while (0) -#define __raw_writesb(p, d, l) do { *(int *)0 = 0; } while (0) -#define __raw_writesl(p, d, l) do { *(int *)0 = 0; } while (0) - -#define __io(a) __typesafe_io(a) -#define __mem_pci(a) (a) - -#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/irqs.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/irqs.h deleted file mode 100644 index 7b9e07c1a..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/irqs.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2003 Artec Design Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef __ASM_ARCH_IRQS_H -#define __ASM_ARCH_IRQS_H - -#define FIQ_START 0 - -#define NR_IRQS 32 - -#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/mcs814x.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/mcs814x.h deleted file mode 100644 index 8252d33a7..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/mcs814x.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2003 Artec Design Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef __ASM_ARCH_MCS814X_H -#define __ASM_ARCH_MCS814X_H - -#define MCS814X_IO_BASE 0xF0000000 -#define MCS814X_IO_START 0x40000000 -#define MCS814X_IO_SIZE 0x00100000 - -/* IRQ controller register offset */ -#define MCS814X_IRQ_ICR 0x00 -#define MCS814X_IRQ_ISR 0x04 -#define MCS814X_IRQ_MASK 0x20 -#define MCS814X_IRQ_STS0 0x40 - -#define MCS814X_PHYS_BASE 0x40000000 -#define MCS814X_VIRT_BASE MCS814X_IO_BASE - -#define MCS814X_UART 0x000DC000 -#define MCS814X_DBGLED 0x000EC000 -#define MCS814X_SYSDBG 0x000F8000 -#define MCS814X_SYSDBG_SIZE 0x50 - -/* System configuration and bootstrap registers */ -#define SYSDBG_BS1 0x00 -#define CPU_FREQ_SHIFT 27 -#define CPU_FREQ_MASK 0x0F -#define SDRAM_FREQ_BIT (1 << 22) - -#define SYSDBG_BS2 0x04 -#define LED_CFG_MASK 0x03 -#define CPU_MODE_SHIFT 23 -#define CPU_MODE_MASK 0x03 - -#define SYSDBG_SYSCTL_MAC 0x1d -#define BUF_SHIFT_BIT (1 << 0) - -#define SYSDBG_SYSCTL 0x08 -#define SYSCTL_EMAC (1 << 0) -#define SYSCTL_EPHY (1 << 0) /* active low */ -#define SYSCTL_CIPHER (1 << 16) - -#define SYSDBG_PLL_CTL 0x3C - -#endif /* __ASM_ARCH_MCS814X_H */ - diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/param.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/param.h deleted file mode 100644 index 7ffe70b7d..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/param.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (C) 2003 Artec Design Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef __ASM_ARCH_PARAM_H -#define __ASM_ARCH_PARAM_H - -#define HZ 100 - -#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/system.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/system.h deleted file mode 100644 index cf5453df2..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/system.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2003 Artec Design Ltd. - * Copyright (C) 2012 Florian Fainelli - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef __ASM_ARCH_SYSTEM_H -#define __ASM_ARCH_SYSTEM_H - -static inline void arch_idle(void) -{ - cpu_do_idle(); -} -#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/timex.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/timex.h deleted file mode 100644 index f05c8eeb6..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/timex.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2003 Artec Design Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#ifndef __ASM_ARCH_TIMEX_H -#define __ASM_ARCH_TIMEX_H - -/* - * Timex specification for MCS814X - */ -#define CLOCK_TICK_RATE 100 - -#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/uncompress.h b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/uncompress.h deleted file mode 100644 index cf3ed9a1a..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/include/mach/uncompress.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2012, Florian Fainelli - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef __ASM_ARCH_UNCOMPRESS_H -#define __ASM_ARCH_UNCOMPRESS_H - -#include -#include -#include -#include - -#define UART_SHIFT (2) - -/* cannot be static because the code will be inlined */ -void __iomem *uart_base; - -static inline void putc(int c) -{ - while (!(__raw_readb(uart_base + (UART_LSR << UART_SHIFT)) & UART_LSR_TEMT)); - __raw_writeb(c, uart_base + (UART_TX << UART_SHIFT)); -} - -static inline void flush(void) -{ -} - -static inline void arch_decomp_setup(void) -{ - if (soc_is_mcs8140()) - uart_base = (void __iomem *)(MCS814X_PHYS_BASE +MCS814X_UART); -} - -#define arch_decomp_wdog() - -#endif diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c deleted file mode 100644 index d1cab682e..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/irq.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Moschip MCS814x generic interrupt controller routines - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under the GPLv2 - */ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -static void __iomem *mcs814x_intc_base; -static struct irq_domain *domain; - -static void __init mcs814x_alloc_gc(void __iomem *base, unsigned int irq_start, - unsigned int num) -{ - struct irq_chip_generic *gc; - struct irq_chip_type *ct; - - if (irq_alloc_domain_generic_chips(domain, num, 1, "mcs814x-intc", handle_level_irq, - IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, 0)) - panic("unable to allocate domain generic irq chip"); - - gc = irq_get_domain_generic_chip(domain, irq_start); - if (!gc) - panic("unable to get generic irq chip"); - - gc->reg_base = base; - ct = gc->chip_types; - ct->chip.irq_ack = irq_gc_unmask_enable_reg; - ct->chip.irq_mask = irq_gc_mask_clr_bit; - ct->chip.irq_unmask = irq_gc_mask_set_bit; - ct->regs.mask = MCS814X_IRQ_MASK; - ct->regs.enable = MCS814X_IRQ_ICR; - - /* Clear all interrupts */ - writel_relaxed(0xffffffff, base + MCS814X_IRQ_ICR); -} - -asmlinkage void __exception_irq_entry mcs814x_handle_irq(struct pt_regs *regs) -{ - u32 status, irq; - - do { - /* read the status register */ - status = __raw_readl(mcs814x_intc_base + MCS814X_IRQ_STS0); - if (!status) - break; - - irq = ffs(status) - 1; - status |= (1 << irq); - /* clear the interrupt */ - __raw_writel(status, mcs814x_intc_base + MCS814X_IRQ_STS0); - /* call the generic handler */ - handle_domain_irq(domain, irq, regs); - - } while (1); -} - -static const struct of_device_id mcs814x_intc_ids[] = { - { .compatible = "moschip,mcs814x-intc" }, - { /* sentinel */ }, -}; - -void __init mcs814x_of_irq_init(void) -{ - struct device_node *np; - - np = of_find_matching_node(NULL, mcs814x_intc_ids); - if (!np) - panic("unable to find compatible intc node in dtb\n"); - - mcs814x_intc_base = of_iomap(np, 0); - if (!mcs814x_intc_base) - panic("unable to map intc cpu registers\n"); - - domain = irq_domain_add_linear(np, 32, &irq_generic_chip_ops, NULL); - if (!domain) - panic("unable to add irq domain\n"); - irq_set_default_host(domain); - - of_node_put(np); - - mcs814x_alloc_gc(mcs814x_intc_base, 0, 32); -} - diff --git a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/timer.c b/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/timer.c deleted file mode 100644 index 31d0ba65a..000000000 --- a/target/linux/mcs814x/files-3.18/arch/arm/mach-mcs814x/timer.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Moschip MCS814x timer routines - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under GPLv2 - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* Timer block registers */ -#define TIMER_VAL 0x00 -#define TIMER_CTL 0x04 -#define TIMER_CTL_EN 0x01 -#define TIMER_CTL_DBG 0x02 - -static u32 last_reload; -static u32 timer_correct; -static u32 clock_rate; -static u32 timer_reload_value; -static void __iomem *mcs814x_timer_base; - -static inline u32 ticks2usecs(u32 x) -{ - return x / (clock_rate / 1000000); -} - -/* - * Returns number of ms since last clock interrupt. Note that interrupts - * will have been disabled by do_gettimeoffset() - */ -static u32 mcs814x_gettimeoffset(void) -{ - u32 ticks = readl_relaxed(mcs814x_timer_base + TIMER_VAL); - - if (ticks < last_reload) - return ticks2usecs(ticks + (u32)(0xffffffff - last_reload)); - else - return ticks2usecs(ticks - last_reload); -} - - -static irqreturn_t mcs814x_timer_interrupt(int irq, void *dev_id) -{ - u32 count = readl_relaxed(mcs814x_timer_base + TIMER_VAL); - - /* take into account delay up to this moment */ - last_reload = count + timer_correct + timer_reload_value; - - if (last_reload < timer_reload_value) { - last_reload = timer_reload_value; - } else { - if (timer_correct == 0) - timer_correct = readl_relaxed(mcs814x_timer_base + TIMER_VAL) - count; - } - writel_relaxed(last_reload, mcs814x_timer_base + TIMER_VAL); - - timer_tick(); - - return IRQ_HANDLED; -} - -static struct of_device_id mcs814x_timer_ids[] = { - { .compatible = "moschip,mcs814x-timer" }, - { /* sentinel */ }, -}; - -static int __init mcs814x_of_timer_init(void) -{ - struct device_node *np; - int irq; - - np = of_find_matching_node(NULL, mcs814x_timer_ids); - if (!np) - panic("unable to find compatible timer node in dtb"); - - mcs814x_timer_base = of_iomap(np, 0); - if (!mcs814x_timer_base) - panic("unable to remap timer cpu registers"); - - irq = irq_of_parse_and_map(np, 0); - if (!irq) - panic("no interrupts property/mapping failed for timer"); - - return irq; -} - -void __init mcs814x_timer_init(void) -{ - struct clk *clk; - int irq; - - arch_gettimeoffset = mcs814x_gettimeoffset; - - clk = clk_get_sys("timer0", NULL); - if (IS_ERR_OR_NULL(clk)) - panic("unable to get timer0 clock"); - - clock_rate = clk_get_rate(clk); - - irq = mcs814x_of_timer_init(); - - pr_info("Timer frequency: %d (kHz)\n", clock_rate / 1000); - - timer_reload_value = 0xffffffff - (clock_rate / HZ); - - /* disable timer */ - writel_relaxed(~TIMER_CTL_EN, mcs814x_timer_base + TIMER_CTL); - writel_relaxed(timer_reload_value, mcs814x_timer_base + TIMER_VAL); - last_reload = timer_reload_value; - - if (request_irq(irq, mcs814x_timer_interrupt, - IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, - "mcs814x-timer", NULL)) - panic("unable to request timer0 irq %d", irq); - - /* enable timer, stop timer in debug mode */ - writel_relaxed(TIMER_CTL_EN | TIMER_CTL_DBG, - mcs814x_timer_base + TIMER_CTL); -} diff --git a/target/linux/mcs814x/files-3.18/drivers/char/hw_random/mcs814x-rng.c b/target/linux/mcs814x/files-3.18/drivers/char/hw_random/mcs814x-rng.c deleted file mode 100644 index cb3f339e3..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/char/hw_random/mcs814x-rng.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * RNG driver for Moschip MCS814x SoC - * - * Copyright 2012 (C), Florian Fainelli - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define STAT 0x00 -#define RND 0x04 - -struct mcs814x_rng_priv { - void __iomem *regs; -}; - -static int mcs814x_rng_data_read(struct hwrng *rng, u32 *buffer) -{ - struct mcs814x_rng_priv *priv = (struct mcs814x_rng_priv *)rng->priv; - - *buffer = readl_relaxed(priv->regs + RND); - - return 4; -} - -static int mcs814x_rng_probe(struct platform_device *pdev) -{ - struct resource *res; - struct mcs814x_rng_priv *priv; - struct hwrng *rng; - int ret; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { - ret = -ENOMEM; - goto out; - } - - rng = kzalloc(sizeof(*rng), GFP_KERNEL); - if (!rng) { - ret = -ENOMEM; - goto out_priv; - } - - platform_set_drvdata(pdev, rng); - rng->priv = (unsigned long)priv; - rng->name = pdev->name; - rng->data_read = mcs814x_rng_data_read; - - priv->regs = devm_ioremap_resource(&pdev->dev, res); - if (!priv->regs) { - ret = -ENOMEM; - goto out_rng; - } - - ret = hwrng_register(rng); - if (ret) { - dev_err(&pdev->dev, "failed to register hwrng driver\n"); - goto out; - } - - dev_info(&pdev->dev, "registered\n"); - - return ret; - -out_rng: - platform_set_drvdata(pdev, NULL); - kfree(rng); -out_priv: - kfree(priv); -out: - return ret; -} - -static int mcs814x_rng_remove(struct platform_device *pdev) -{ - struct hwrng *rng = platform_get_drvdata(pdev); - struct mcs814x_rng_priv *priv = (struct mcs814x_rng_priv *)rng->priv; - - hwrng_unregister(rng); - kfree(priv); - kfree(rng); - platform_set_drvdata(pdev, NULL); - - return 0; -} - -static const struct of_device_id mcs814x_rng_ids[] = { - { .compatible = "moschip,mcs814x-rng", }, - { /* sentinel */ }, -}; - -static struct platform_driver mcs814x_rng_driver = { - .driver = { - .name = "mcs814x-rng", - .owner = THIS_MODULE, - .of_match_table = mcs814x_rng_ids, - }, - .probe = mcs814x_rng_probe, - .remove = mcs814x_rng_remove, -}; - -module_platform_driver(mcs814x_rng_driver); - -MODULE_AUTHOR("Florian Fainelli "); -MODULE_DESCRIPTION("H/W Random Number Generator (RNG) for Moschip MCS814x"); -MODULE_LICENSE("GPL"); diff --git a/target/linux/mcs814x/files-3.18/drivers/gpio/gpio-mcs814x.c b/target/linux/mcs814x/files-3.18/drivers/gpio/gpio-mcs814x.c deleted file mode 100644 index c8a6509cf..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/gpio/gpio-mcs814x.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Moschip MCS814x GPIO support - * - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under the GPLv2 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct mcs814x_gpio_chip { - void __iomem *regs; - struct gpio_chip chip; -}; - -#define GPIO_PIN 0x00 -#define GPIO_DIR 0x04 - -#define to_mcs814x_gpio_chip(x) container_of(x, struct mcs814x_gpio_chip, chip) - -static int mcs814x_gpio_get(struct gpio_chip *chip, unsigned offset) -{ - struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip); - - return readl_relaxed(mcs814x->regs + GPIO_PIN) & (1 << offset); -} - -static void mcs814x_gpio_set(struct gpio_chip *chip, - unsigned offset, int value) -{ - struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip); - u32 mask; - - mask = readl_relaxed(mcs814x->regs + GPIO_PIN); - if (value) - mask |= (1 << offset); - else - mask &= ~(1 << offset); - writel_relaxed(mask, mcs814x->regs + GPIO_PIN); -} - -static int mcs814x_gpio_direction_output(struct gpio_chip *chip, - unsigned offset, int value) -{ - struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip); - u32 mask; - - mask = readl_relaxed(mcs814x->regs + GPIO_DIR); - mask &= ~(1 << offset); - writel_relaxed(mask, mcs814x->regs + GPIO_DIR); - - return 0; -} - -static int mcs814x_gpio_direction_input(struct gpio_chip *chip, - unsigned offset) -{ - struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip); - u32 mask; - - mask = readl_relaxed(mcs814x->regs + GPIO_DIR); - mask |= (1 << offset); - writel_relaxed(mask, mcs814x->regs + GPIO_DIR); - - return 0; -} - -static int mcs814x_gpio_probe(struct platform_device *pdev) -{ - struct resource *res; - struct mcs814x_gpio_chip *mcs814x_chip; - int ret; - const unsigned int *num_gpios; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - - num_gpios = of_get_property(pdev->dev.of_node, "num-gpios", NULL); - if (!num_gpios) - dev_err(&pdev->dev, "FIXME: no num-gpios property\n"); - - mcs814x_chip = kzalloc(sizeof(*mcs814x_chip), GFP_KERNEL); - if (!mcs814x_chip) - return -ENOMEM; - - mcs814x_chip->regs = devm_ioremap_resource(&pdev->dev, res); - if (!mcs814x_chip->regs) { - ret = -ENOMEM; - goto out; - } - - platform_set_drvdata(pdev, mcs814x_chip); - -#ifdef CONFIG_OF_GPIO - mcs814x_chip->chip.of_node = pdev->dev.of_node; -#endif - - mcs814x_chip->chip.label = pdev->name; - mcs814x_chip->chip.get = mcs814x_gpio_get; - mcs814x_chip->chip.set = mcs814x_gpio_set; - mcs814x_chip->chip.direction_input = mcs814x_gpio_direction_input; - mcs814x_chip->chip.direction_output = mcs814x_gpio_direction_output; - mcs814x_chip->chip.ngpio = be32_to_cpup(num_gpios); - /* we want dynamic base allocation */ - mcs814x_chip->chip.base = -1; - - ret = gpiochip_add(&mcs814x_chip->chip); - if (ret) { - dev_err(&pdev->dev, "failed to register gpiochip\n"); - goto out; - } - - return 0; - -out: - platform_set_drvdata(pdev, NULL); - kfree(mcs814x_chip); - return ret; -} - -static struct of_device_id mcs814x_gpio_ids[] = { - { .compatible = "moschip,mcs814x-gpio" }, - { /* sentinel */ }, -}; - -static struct platform_driver mcs814x_gpio_driver = { - .driver = { - .name = "mcs814x-gpio", - .owner = THIS_MODULE, - .of_match_table = mcs814x_gpio_ids, - }, - .probe = mcs814x_gpio_probe, -}; - -int __init mcs814x_gpio_init(void) -{ - return platform_driver_register(&mcs814x_gpio_driver); -} -postcore_initcall(mcs814x_gpio_init); diff --git a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Kconfig b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Kconfig deleted file mode 100644 index 8fa38a409..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Kconfig +++ /dev/null @@ -1,4 +0,0 @@ -config NUPORT_ETHERNET_DRIVER - tristate "MCS8140 Ethernet driver" - depends on ETHERNET && ARCH_MCS814X - help diff --git a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Makefile b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Makefile deleted file mode 100644 index 9719c51b7..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -obj-$(CONFIG_NUPORT_ETHERNET_DRIVER) += mcs8140.o - -mcs8140-objs := nuport_mac.o diff --git a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/nuport_mac.c b/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/nuport_mac.c deleted file mode 100644 index a02144e28..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/net/ethernet/mcs8140/nuport_mac.c +++ /dev/null @@ -1,1206 +0,0 @@ -/* - * Moschip MCS8140 Ethernet MAC driver - * - * Copyright (C) 2003, Moschip Semiconductors - * Copyright (C) 2012, Florian Fainelli - * - * Licensed under GPLv2 - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* Hardware registers */ -#define MAC_BASE_ADDR ((priv->mac_base)) - -#define CTRL_REG (MAC_BASE_ADDR) -#define MII_BUSY (1 << 0) -#define MII_WRITE (1 << 1) -#define RX_ENABLE (1 << 2) -#define TX_ENABLE (1 << 3) -#define DEFER_CHECK (1 << 5) -#define STRIP_PAD (1 << 8) -#define DRTRY_DISABLE (1 << 10) -#define FULL_DUPLEX (1 << 20) -#define HBD_DISABLE (1 << 28) -#define MAC_ADDR_HIGH_REG (MAC_BASE_ADDR + 0x04) -#define MAC_ADDR_LOW_REG (MAC_BASE_ADDR + 0x08) -#define MII_ADDR_REG (MAC_BASE_ADDR + 0x14) -#define MII_ADDR_SHIFT (11) -#define MII_REG_SHIFT (6) -#define MII_DATA_REG (MAC_BASE_ADDR + 0x18) -/* Link interrupt registers */ -#define LINK_INT_CSR (MAC_BASE_ADDR + 0xD0) -#define LINK_INT_EN (1 << 0) -#define LINK_PHY_ADDR_SHIFT (1) -#define LINK_PHY_REG_SHIFT (6) -#define LINK_BIT_UP_SHIFT (11) -#define LINK_UP (1 << 16) -#define LINK_INT_POLL_TIME (MAC_BASE_ADDR + 0xD4) -#define LINK_POLL_MASK ((1 << 20) - 1) - -#define DMA_CHAN_WIDTH 32 -#define DMA_RX_CHAN 0 -#define DMA_TX_CHAN 2 - -/* Receive DMA registers */ -#define RX_DMA_BASE ((priv->dma_base) + \ - (DMA_CHAN_WIDTH * DMA_RX_CHAN)) -#define RX_BUFFER_ADDR (RX_DMA_BASE + 0x00) -#define RX_MAX_BYTES (RX_DMA_BASE + 0x04) -#define RX_ACT_BYTES (RX_DMA_BASE + 0x08) -#define RX_START_DMA (RX_DMA_BASE + 0x0C) -#define RX_DMA_ENABLE (1 << 0) -#define RX_DMA_RESET (1 << 1) -#define RX_DMA_STATUS_FIFO (1 << 12) -#define RX_DMA_ENH (RX_DMA_BASE + 0x14) -#define RX_DMA_INT_ENABLE (1 << 1) - -/* Transmit DMA registers */ -#define TX_DMA_BASE ((priv->dma_base) + \ - (DMA_CHAN_WIDTH * DMA_TX_CHAN)) -#define TX_BUFFER_ADDR (TX_DMA_BASE + 0x00) -#define TX_PKT_BYTES (TX_DMA_BASE + 0x04) -#define TX_BYTES_SENT (TX_DMA_BASE + 0x08) -#define TX_START_DMA (TX_DMA_BASE + 0x0C) -#define TX_DMA_ENABLE (1 << 0) -#define TX_DMA_START_FRAME (1 << 2) -#define TX_DMA_END_FRAME (1 << 3) -#define TX_DMA_PAD_DISABLE (1 << 8) -#define TX_DMA_CRC_DISABLE (1 << 9) -#define TX_DMA_FIFO_FULL (1 << 16) -#define TX_DMA_FIFO_EMPTY (1 << 17) -#define TX_DMA_STATUS_AVAIL (1 << 18) -#define TX_DMA_RESET (1 << 24) -#define TX_DMA_STATUS (TX_DMA_BASE + 0x10) -#define TX_DMA_ENH (TX_DMA_BASE + 0x14) -#define TX_DMA_ENH_ENABLE (1 << 0) -#define TX_DMA_INT_FIFO (1 << 1) - -#define RX_ALLOC_SIZE SZ_2K -#define MAX_ETH_FRAME_SIZE 1536 -#define RX_SKB_TAILROOM 128 -#define RX_SKB_HEADROOM (RX_ALLOC_SIZE - \ - (MAX_ETH_FRAME_SIZE + RX_SKB_TAILROOM) + 0) - - /* WDT Late COL Lenght COL Type */ -#define ERROR_FILTER_MASK ((1<<14) | (1<<15) | (1<<16) | (1<<17) | (0<<18) | \ - /* MII Dribbling CRC Len/type Control */\ - (1<<19) | (1<<20) | (1<<21) | (0<<24) | (1<<25) | \ - /* Unsup Missed */\ - (1<<26) | (0<<31)) -#define TX_RING_SIZE 30 -#define RX_RING_SIZE 30 - -static inline u32 nuport_mac_readl(void __iomem *reg) -{ - return readl_relaxed(reg); -} - -static inline u8 nuport_mac_readb(void __iomem *reg) -{ - return readb_relaxed(reg); -} - -static inline void nuport_mac_writel(u32 value, void __iomem *reg) -{ - writel_relaxed(value, reg); -} - -static inline void nuport_mac_writeb(u8 value, void __iomem *reg) -{ - writel_relaxed(value, reg); -} - -/* MAC private data */ -struct nuport_mac_priv { - spinlock_t lock; - - void __iomem *mac_base; - void __iomem *dma_base; - - int rx_irq; - int tx_irq; - int link_irq; - struct clk *emac_clk; - struct clk *ephy_clk; - - /* Transmit buffers */ - struct sk_buff *tx_skb[TX_RING_SIZE]; - dma_addr_t tx_addr; - unsigned int valid_txskb[TX_RING_SIZE]; - unsigned int cur_tx; - unsigned int dma_tx; - unsigned int tx_full; - - /* Receive buffers */ - struct sk_buff *rx_skb[RX_RING_SIZE]; - dma_addr_t rx_addr; - unsigned int irq_rxskb[RX_RING_SIZE]; - int pkt_len[RX_RING_SIZE]; - unsigned int cur_rx; - unsigned int dma_rx; - unsigned int rx_full; - - unsigned int first_pkt; - - /* Private data */ - struct napi_struct napi; - struct net_device *dev; - struct platform_device *pdev; - struct mii_bus *mii_bus; - struct phy_device *phydev; - struct device_node *phy_node; - phy_interface_t phy_interface; - int old_link; - int old_duplex; - u32 msg_level; - unsigned int buffer_shifting_len; -}; - -static inline int nuport_mac_mii_busy_wait(struct nuport_mac_priv *priv) -{ - unsigned long curr; - unsigned long finish = jiffies + 3 * HZ; - - do { - curr = jiffies; - if (!(nuport_mac_readl(MII_ADDR_REG) & MII_BUSY)) - return 0; - cpu_relax(); - } while (!time_after_eq(curr, finish)); - - return -EBUSY; -} - -/* Read from PHY registers */ -static int nuport_mac_mii_read(struct mii_bus *bus, - int mii_id, int regnum) -{ - struct net_device *dev = bus->priv; - struct nuport_mac_priv *priv = netdev_priv(dev); - int ret; - u32 val = 0; - - ret = nuport_mac_mii_busy_wait(priv); - if (ret) - return ret; - - val |= (mii_id << MII_ADDR_SHIFT) | (regnum << MII_REG_SHIFT) | MII_BUSY; - nuport_mac_writel(val, MII_ADDR_REG); - ret = nuport_mac_mii_busy_wait(priv); - if (ret) - return ret; - - return nuport_mac_readl(MII_DATA_REG); -} - -static int nuport_mac_mii_write(struct mii_bus *bus, int mii_id, - int regnum, u16 value) -{ - struct net_device *dev = bus->priv; - struct nuport_mac_priv *priv = netdev_priv(dev); - int ret; - u32 val = 0; - - ret = nuport_mac_mii_busy_wait(priv); - if (ret) - return ret; - - val |= (mii_id << MII_ADDR_SHIFT) | (regnum << MII_REG_SHIFT); - val |= MII_BUSY | MII_WRITE; - nuport_mac_writel(value, MII_DATA_REG); - nuport_mac_writel(val, MII_ADDR_REG); - - return nuport_mac_mii_busy_wait(priv); -} - -static int nuport_mac_mii_reset(struct mii_bus *bus) -{ - return 0; -} - -static int nuport_mac_start_tx_dma(struct nuport_mac_priv *priv, - struct sk_buff *skb) -{ - u32 reg; - unsigned int timeout = 2048; - - while (timeout--) { - reg = nuport_mac_readl(TX_START_DMA); - if (!(reg & TX_DMA_ENABLE)) { - netdev_dbg(priv->dev, "dma ready\n"); - break; - } - cpu_relax(); - } - - if (!timeout) - return -EBUSY; - - priv->tx_addr = dma_map_single(&priv->pdev->dev, skb->data, - skb->len, DMA_TO_DEVICE); - if (dma_mapping_error(&priv->pdev->dev, priv->tx_addr)) - return -ENOMEM; - - /* enable enhanced mode */ - nuport_mac_writel(TX_DMA_ENH_ENABLE, TX_DMA_ENH); - nuport_mac_writel(priv->tx_addr, TX_BUFFER_ADDR); - nuport_mac_writel((skb->len) - 1, TX_PKT_BYTES); - wmb(); - reg = TX_DMA_ENABLE | TX_DMA_START_FRAME | TX_DMA_END_FRAME; - nuport_mac_writel(reg, TX_START_DMA); - - return 0; -} - -static void nuport_mac_reset_tx_dma(struct nuport_mac_priv *priv) -{ - u32 reg; - - reg = nuport_mac_readl(TX_START_DMA); - reg |= TX_DMA_RESET; - nuport_mac_writel(reg, TX_START_DMA); -} - -static int nuport_mac_start_rx_dma(struct nuport_mac_priv *priv, - struct sk_buff *skb) -{ - u32 reg; - unsigned int timeout = 2048; - - while (timeout--) { - reg = nuport_mac_readl(RX_START_DMA); - if (!(reg & RX_DMA_ENABLE)) { - netdev_dbg(priv->dev, "dma ready\n"); - break; - } - cpu_relax(); - } - - if (!timeout) - return -EBUSY; - - priv->rx_addr = dma_map_single(&priv->pdev->dev, skb->data, - RX_ALLOC_SIZE, DMA_FROM_DEVICE); - if (dma_mapping_error(&priv->pdev->dev, priv->rx_addr)) - return -ENOMEM; - - nuport_mac_writel(priv->rx_addr, RX_BUFFER_ADDR); - wmb(); - nuport_mac_writel(RX_DMA_ENABLE, RX_START_DMA); - - return 0; -} - -static void nuport_mac_reset_rx_dma(struct nuport_mac_priv *priv) -{ - u32 reg; - - reg = nuport_mac_readl(RX_START_DMA); - reg |= RX_DMA_RESET; - nuport_mac_writel(reg, RX_START_DMA); -} - -/* I suppose this might do something, but I am not sure actually */ -static void nuport_mac_disable_rx_dma(struct nuport_mac_priv *priv) -{ - u32 reg; - - reg = nuport_mac_readl(RX_DMA_ENH); - reg &= ~RX_DMA_INT_ENABLE; - nuport_mac_writel(reg, RX_DMA_ENH); -} - -static void nuport_mac_enable_rx_dma(struct nuport_mac_priv *priv) -{ - u32 reg; - - reg = nuport_mac_readl(RX_DMA_ENH); - reg |= RX_DMA_INT_ENABLE; - nuport_mac_writel(reg, RX_DMA_ENH); -} - -/* Add packets to the transmit queue */ -static int nuport_mac_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - unsigned long flags; - struct nuport_mac_priv *priv = netdev_priv(dev); - int ret; - - if (netif_queue_stopped(dev)) { - netdev_warn(dev, "netif queue was stopped, restarting\n"); - netif_start_queue(dev); - } - - spin_lock_irqsave(&priv->lock, flags); - if (priv->first_pkt) { - ret = nuport_mac_start_tx_dma(priv, skb); - if (ret) { - netif_stop_queue(dev); - spin_unlock_irqrestore(&priv->lock, flags); - netdev_err(dev, "transmit path busy\n"); - return NETDEV_TX_BUSY; - } - priv->first_pkt = 0; - } - - priv->tx_skb[priv->cur_tx] = skb; - dev->stats.tx_bytes += skb->len; - dev->stats.tx_packets++; - priv->valid_txskb[priv->cur_tx] = 1; - priv->cur_tx++; - dev->trans_start = jiffies; - - if (priv->cur_tx >= TX_RING_SIZE) - priv->cur_tx = 0; - - spin_unlock_irqrestore(&priv->lock, flags); - - if (priv->valid_txskb[priv->cur_tx]) { - priv->tx_full = 1; - netdev_err(dev, "stopping queue\n"); - netif_stop_queue(dev); - } - - return NETDEV_TX_OK; -} - -static void nuport_mac_adjust_link(struct net_device *dev) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - struct phy_device *phydev = priv->phydev; - unsigned int status_changed = 0; - u32 reg; - - BUG_ON(!phydev); - - if (priv->old_link != phydev->link) { - status_changed = 1; - priv->old_link = phydev->link; - } - - if (phydev->link && (priv->old_duplex != phydev->duplex)) { - reg = nuport_mac_readl(CTRL_REG); - if (phydev->duplex == DUPLEX_FULL) - reg |= DUPLEX_FULL; - else - reg &= ~DUPLEX_FULL; - nuport_mac_writel(reg, CTRL_REG); - - status_changed = 1; - priv->old_duplex = phydev->duplex; - } - - if (!status_changed) - return; - - pr_info("%s: link %s", dev->name, phydev->link ? - "UP" : "DOWN"); - if (phydev->link) { - pr_cont(" - %d/%s", phydev->speed, - phydev->duplex == DUPLEX_FULL ? "full" : "half"); - } - pr_cont("\n"); -} - -static irqreturn_t nuport_mac_link_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = dev_id; - struct nuport_mac_priv *priv = netdev_priv(dev); - u32 reg; - u8 phy_addr; - unsigned long flags; - irqreturn_t ret = IRQ_HANDLED; - - spin_lock_irqsave(&priv->lock, flags); - reg = nuport_mac_readl(LINK_INT_CSR); - phy_addr = (reg >> LINK_PHY_ADDR_SHIFT) & (PHY_MAX_ADDR - 1); - - if (phy_addr != priv->phydev->addr) { - netdev_err(dev, "spurious PHY irq (phy: %d)\n", phy_addr); - ret = IRQ_NONE; - goto out; - } - - priv->phydev->link = (reg & LINK_UP); - nuport_mac_adjust_link(dev); - -out: - spin_unlock_irqrestore(&priv->lock, flags); - return ret; -} - -static irqreturn_t nuport_mac_tx_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = (struct net_device *)dev_id; - struct nuport_mac_priv *priv = netdev_priv(dev); - struct sk_buff *skb; - unsigned long flags; - int ret; - u32 reg; - - spin_lock_irqsave(&priv->lock, flags); - /* clear status word available if ready */ - reg = nuport_mac_readl(TX_START_DMA); - if (reg & TX_DMA_STATUS_AVAIL) { - nuport_mac_writel(reg, TX_START_DMA); - reg = nuport_mac_readl(TX_DMA_STATUS); - - if (reg & 1) - dev->stats.tx_errors++; - } else - netdev_dbg(dev, "no status word: %08x\n", reg); - - skb = priv->tx_skb[priv->dma_tx]; - priv->tx_skb[priv->dma_tx] = NULL; - priv->valid_txskb[priv->dma_tx] = 0; - dma_unmap_single(&priv->pdev->dev, priv->rx_addr, skb->len, - DMA_TO_DEVICE); - dev_kfree_skb_irq(skb); - - priv->dma_tx++; - if (priv->dma_tx >= TX_RING_SIZE) - priv->dma_tx = 0; - - if (!priv->valid_txskb[priv->dma_tx]) - priv->first_pkt = 1; - else { - ret = nuport_mac_start_tx_dma(priv, priv->tx_skb[priv->dma_tx]); - if (ret) - netdev_err(dev, "failed to restart TX dma\n"); - } - - if (priv->tx_full) { - netdev_dbg(dev, "restarting transmit queue\n"); - netif_wake_queue(dev); - priv->tx_full = 0; - } - - spin_unlock_irqrestore(&priv->lock, flags); - - return IRQ_HANDLED; -} - -static unsigned int nuport_mac_has_work(struct nuport_mac_priv *priv) -{ - unsigned int i; - - for (i = 0; i < RX_RING_SIZE; i++) - if (priv->rx_skb[i]) - return 1; - - return 0; -} - -static irqreturn_t nuport_mac_rx_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = (struct net_device *)dev_id; - struct nuport_mac_priv *priv = netdev_priv(dev); - unsigned long flags; - int ret; - - spin_lock_irqsave(&priv->lock, flags); - if (!priv->rx_full) { - priv->pkt_len[priv->dma_rx] = nuport_mac_readl(RX_ACT_BYTES) - 4; - priv->irq_rxskb[priv->dma_rx] = 0; - priv->dma_rx++; - - if (priv->dma_rx >= RX_RING_SIZE) - priv->dma_rx = 0; - } else - priv->rx_full = 0; - - if (priv->irq_rxskb[priv->dma_rx] == 1) { - ret = nuport_mac_start_rx_dma(priv, priv->rx_skb[priv->dma_rx]); - if (ret) - netdev_err(dev, "failed to start rx dma\n"); - } else { - priv->rx_full = 1; - netdev_dbg(dev, "RX ring full\n"); - } - - if (likely(nuport_mac_has_work(priv))) { - /* find a way to disable DMA rx irq */ - nuport_mac_disable_rx_dma(priv); - napi_schedule(&priv->napi); - } - spin_unlock_irqrestore(&priv->lock, flags); - - return IRQ_HANDLED; -} - -/* Process received packets in tasklet */ -static int nuport_mac_rx(struct net_device *dev, int limit) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - struct sk_buff *skb; - int len, status; - int count = 0; - - while (count < limit && !priv->irq_rxskb[priv->cur_rx]) { - skb = priv->rx_skb[priv->cur_rx]; - len = priv->pkt_len[priv->cur_rx]; - - /* Remove 2 bytes added by RX buffer shifting */ - len = len - priv->buffer_shifting_len; - skb->data = skb->data + priv->buffer_shifting_len; - - /* Get packet status */ - status = get_unaligned((u32 *) (skb->data + len)); - - dma_unmap_single(&priv->pdev->dev, priv->rx_addr, skb->len, - DMA_FROM_DEVICE); - - /* packet filter failed */ - if (!(status & (1 << 30))) { - dev_kfree_skb_irq(skb); - goto exit; - } - - /* missed frame */ - if (status & (1 << 31)) { - dev->stats.rx_missed_errors++; - dev_kfree_skb_irq(skb); - goto exit; - } - - /* Not ethernet type */ - if ((!(status & (1 << 18))) || (status & ERROR_FILTER_MASK)) - dev->stats.rx_errors++; - - if (len > MAX_ETH_FRAME_SIZE) { - dev_kfree_skb_irq(skb); - goto exit; - } else - skb_put(skb, len); - - skb->protocol = eth_type_trans(skb, dev); - dev->stats.rx_packets++; - - if (status & (1 << 29)) - skb->pkt_type = PACKET_OTHERHOST; - if (status & (1 << 27)) - skb->pkt_type = PACKET_MULTICAST; - if (status & (1 << 28)) - skb->pkt_type = PACKET_BROADCAST; - - skb->ip_summed = CHECKSUM_UNNECESSARY; - - /* Pass the received packet to network layer */ - status = netif_receive_skb(skb); - if (status != NET_RX_DROP) - dev->stats.rx_bytes += len - 4; /* Without CRC */ - else - dev->stats.rx_dropped++; - - dev->last_rx = jiffies; - -exit: - skb = netdev_alloc_skb(dev, RX_ALLOC_SIZE); - if (!skb) - goto out; - - skb_reserve(skb, RX_SKB_HEADROOM); - priv->rx_skb[priv->cur_rx] = skb; - priv->irq_rxskb[priv->cur_rx] = 1; - priv->cur_rx++; - - if (priv->cur_rx >= RX_RING_SIZE) - priv->cur_rx = 0; - count++; - } -out: - return count; -} - -static int nuport_mac_poll(struct napi_struct *napi, int budget) -{ - struct nuport_mac_priv *priv = - container_of(napi, struct nuport_mac_priv, napi); - struct net_device *dev = priv->dev; - int work_done; - - work_done = nuport_mac_rx(dev, budget); - - if (work_done < budget) { - napi_complete(napi); - nuport_mac_enable_rx_dma(priv); - } - - return work_done; -} - -static void nuport_mac_init_tx_ring(struct nuport_mac_priv *priv) -{ - int i; - - priv->cur_tx = priv->dma_tx = priv->tx_full = 0; - for (i = 0; i < TX_RING_SIZE; i++) { - priv->tx_skb[i] = NULL; - priv->valid_txskb[i] = 0; - } - priv->first_pkt = 1; -} - -static int nuport_mac_init_rx_ring(struct net_device *dev) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - struct sk_buff *skb; - int i; - - priv->cur_rx = priv->dma_rx = priv->rx_full = 0; - - for (i = 0; i < RX_RING_SIZE; i++) { - skb = netdev_alloc_skb(dev, RX_ALLOC_SIZE); - if (!skb) - return -ENOMEM; - skb_reserve(skb, RX_SKB_HEADROOM); - priv->rx_skb[i] = skb; - priv->irq_rxskb[i] = 1; - } - - return 0; -} - -static void nuport_mac_free_rx_ring(struct nuport_mac_priv *priv) -{ - int i; - - for (i = 0; i < RX_RING_SIZE; i++) { - if (!priv->rx_skb[i]) - continue; - - dev_kfree_skb(priv->rx_skb[i]); - priv->rx_skb[i] = NULL; - } - - if (priv->rx_addr) - dma_unmap_single(&priv->pdev->dev, priv->rx_addr, RX_ALLOC_SIZE, - DMA_TO_DEVICE); -} - -static void nuport_mac_read_mac_address(struct net_device *dev) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - int i; - - for (i = 0; i < 4; i++) - dev->dev_addr[i] = nuport_mac_readb(MAC_ADDR_LOW_REG + i); - dev->dev_addr[4] = nuport_mac_readb(MAC_ADDR_HIGH_REG); - dev->dev_addr[5] = nuport_mac_readb(MAC_ADDR_HIGH_REG + 1); - - if (!is_valid_ether_addr(dev->dev_addr)) { - dev_info(&priv->pdev->dev, "using random address\n"); - random_ether_addr(dev->dev_addr); - } -} - -static int nuport_mac_change_mac_address(struct net_device *dev, void *mac_addr) -{ - struct sockaddr *addr = mac_addr; - struct nuport_mac_priv *priv = netdev_priv(dev); - unsigned long *temp = (unsigned long *)dev->dev_addr; - u32 high, low; - - if (netif_running(dev)) - return -EBUSY; - - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); - - spin_lock_irq(&priv->lock); - - nuport_mac_writel(*temp, MAC_ADDR_LOW_REG); - temp = (unsigned long *)(dev->dev_addr + 4); - nuport_mac_writel(*temp, MAC_ADDR_HIGH_REG); - - low = nuport_mac_readl(MAC_ADDR_LOW_REG); - high = nuport_mac_readl(MAC_ADDR_HIGH_REG); - - spin_unlock_irq(&priv->lock); - - return 0; -} - -static int nuport_mac_open(struct net_device *dev) -{ - int ret; - struct nuport_mac_priv *priv = netdev_priv(dev); - unsigned long flags; - u32 reg = 0; - - ret = clk_enable(priv->emac_clk); - if (ret) { - netdev_err(dev, "failed to enable EMAC clock\n"); - return ret; - } - - /* Set MAC into full duplex mode by default */ - reg |= RX_ENABLE | TX_ENABLE; - reg |= DEFER_CHECK | STRIP_PAD | DRTRY_DISABLE; - reg |= FULL_DUPLEX | HBD_DISABLE; - nuport_mac_writel(reg, CTRL_REG); - - /* set mac address in hardware in case it was not already */ - nuport_mac_change_mac_address(dev, dev->dev_addr); - - ret = request_irq(priv->link_irq, &nuport_mac_link_interrupt, - 0, dev->name, dev); - if (ret) { - netdev_err(dev, "unable to request link interrupt\n"); - goto out_emac_clk; - } - - ret = request_irq(priv->tx_irq, &nuport_mac_tx_interrupt, - 0, dev->name, dev); - if (ret) { - netdev_err(dev, "unable to request rx interrupt\n"); - goto out_link_irq; - } - - /* Enable link interrupt monitoring for our PHY address */ - reg = LINK_INT_EN | (priv->phydev->addr << LINK_PHY_ADDR_SHIFT); - /* MII_BMSR register to be watched */ - reg |= (1 << LINK_PHY_REG_SHIFT); - /* BMSR_STATUS to be watched in particular */ - reg |= (2 << LINK_BIT_UP_SHIFT); - - spin_lock_irqsave(&priv->lock, flags); - nuport_mac_writel(reg, LINK_INT_CSR); - nuport_mac_writel(LINK_POLL_MASK, LINK_INT_POLL_TIME); - spin_unlock_irqrestore(&priv->lock, flags); - - phy_start(priv->phydev); - - ret = request_irq(priv->rx_irq, &nuport_mac_rx_interrupt, - 0, dev->name, dev); - if (ret) { - netdev_err(dev, "unable to request tx interrupt\n"); - goto out_tx_irq; - } - - netif_start_queue(dev); - - nuport_mac_init_tx_ring(priv); - - ret = nuport_mac_init_rx_ring(dev); - if (ret) { - netdev_err(dev, "rx ring init failed\n"); - goto out_rx_skb; - } - - nuport_mac_reset_tx_dma(priv); - nuport_mac_reset_rx_dma(priv); - - /* Start RX DMA */ - spin_lock_irqsave(&priv->lock, flags); - ret = nuport_mac_start_rx_dma(priv, priv->rx_skb[0]); - spin_unlock_irqrestore(&priv->lock, flags); - - napi_enable(&priv->napi); - - return ret; - -out_rx_skb: - nuport_mac_free_rx_ring(priv); - free_irq(priv->rx_irq, dev); -out_tx_irq: - free_irq(priv->tx_irq, dev); -out_link_irq: - free_irq(priv->link_irq, dev); -out_emac_clk: - clk_disable(priv->emac_clk); - return ret; -} - -static int nuport_mac_close(struct net_device *dev) -{ - u32 reg; - struct nuport_mac_priv *priv = netdev_priv(dev); - - spin_lock_irq(&priv->lock); - reg = nuport_mac_readl(CTRL_REG); - reg &= ~(RX_ENABLE | TX_ENABLE); - nuport_mac_writel(reg, CTRL_REG); - - napi_disable(&priv->napi); - netif_stop_queue(dev); - - free_irq(priv->link_irq, dev); - /* disable PHY polling */ - nuport_mac_writel(0, LINK_INT_CSR); - nuport_mac_writel(0, LINK_INT_POLL_TIME); - phy_stop(priv->phydev); - - free_irq(priv->tx_irq, dev); - free_irq(priv->rx_irq, dev); - spin_unlock_irq(&priv->lock); - - nuport_mac_free_rx_ring(priv); - - clk_disable(priv->emac_clk); - - return 0; -} - -static void nuport_mac_tx_timeout(struct net_device *dev) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - unsigned int i; - - netdev_warn(dev, "transmit timeout, attempting recovery\n"); - - netdev_info(dev, "TX DMA regs\n"); - for (i = 0; i < DMA_CHAN_WIDTH; i += 4) - netdev_info(dev, "[%02x]: 0x%08x\n", i, nuport_mac_readl(TX_DMA_BASE + i)); - netdev_info(dev, "RX DMA regs\n"); - for (i = 0; i < DMA_CHAN_WIDTH; i += 4) - netdev_info(dev, "[%02x]: 0x%08x\n", i, nuport_mac_readl(RX_DMA_BASE + i)); - - nuport_mac_init_tx_ring(priv); - nuport_mac_reset_tx_dma(priv); - - netif_wake_queue(dev); -} - -static int nuport_mac_mii_probe(struct net_device *dev) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - struct phy_device *phydev = NULL; - int ret; - - ret = clk_enable(priv->ephy_clk); - if (ret) { - netdev_err(dev, "unable to enable ePHY clk\n"); - return ret; - } - - phydev = phy_find_first(priv->mii_bus); - if (!phydev) { - netdev_err(dev, "no PHYs found\n"); - ret = -ENODEV; - goto out; - } - - phydev = of_phy_connect(dev, priv->phy_node, - nuport_mac_adjust_link, 0, - priv->phy_interface); - if (IS_ERR(phydev)) { - netdev_err(dev, "could not attach PHY\n"); - ret = PTR_ERR(phydev); - goto out; - } - - phydev->supported &= PHY_BASIC_FEATURES; - phydev->advertising = phydev->supported; - priv->phydev = phydev; - priv->old_link = 1; - priv->old_duplex = DUPLEX_FULL; - - dev_info(&priv->pdev->dev, "attached PHY driver [%s] " - "(mii_bus:phy_addr=%d)\n", - phydev->drv->name, phydev->addr); - - return 0; - -out: - /* disable the Ethernet PHY clock for the moment */ - clk_disable(priv->ephy_clk); - - return ret; -} - -static void nuport_mac_ethtool_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - strncpy(info->driver, "nuport-mac", sizeof(info->driver)); - strncpy(info->version, "0.1", sizeof(info->version)); - strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); - strncpy(info->bus_info, "internal", sizeof(info->bus_info)); - info->n_stats = 0; - info->testinfo_len = 0; - info->regdump_len = 0; - info->eedump_len = 0; -} - -static int nuport_mac_ethtool_get_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - - if (priv->phydev) - return phy_ethtool_gset(priv->phydev, cmd); - - return -EINVAL; -} - -static int nuport_mac_ethtool_set_settings(struct net_device *dev, - struct ethtool_cmd *cmd) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - - if (priv->phydev) - return phy_ethtool_sset(priv->phydev, cmd); - - return -EINVAL; -} - -static void nuport_mac_set_msglevel(struct net_device *dev, u32 msg_level) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - - priv->msg_level = msg_level; -} - -static u32 nuport_mac_get_msglevel(struct net_device *dev) -{ - struct nuport_mac_priv *priv = netdev_priv(dev); - - return priv->msg_level; -} - -static const struct ethtool_ops nuport_mac_ethtool_ops = { - .get_drvinfo = nuport_mac_ethtool_drvinfo, - .get_link = ethtool_op_get_link, - .get_settings = nuport_mac_ethtool_get_settings, - .set_settings = nuport_mac_ethtool_set_settings, - .set_msglevel = nuport_mac_set_msglevel, - .get_msglevel = nuport_mac_get_msglevel, -}; - -static const struct net_device_ops nuport_mac_ops = { - .ndo_open = nuport_mac_open, - .ndo_stop = nuport_mac_close, - .ndo_start_xmit = nuport_mac_start_xmit, - .ndo_change_mtu = eth_change_mtu, - .ndo_validate_addr = eth_validate_addr, - .ndo_set_mac_address = nuport_mac_change_mac_address, - .ndo_tx_timeout = nuport_mac_tx_timeout, -}; - -static int __init nuport_mac_probe(struct platform_device *pdev) -{ - struct net_device *dev; - struct nuport_mac_priv *priv = NULL; - struct resource *regs, *dma; - int ret = 0; - int rx_irq, tx_irq, link_irq; - int i; - const unsigned int *intspec; - - dev = alloc_etherdev(sizeof(struct nuport_mac_priv)); - if (!dev) { - dev_err(&pdev->dev, "no memory for net_device\n"); - return -ENOMEM; - } - - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dma = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (!regs || !dma) { - dev_err(&pdev->dev, "failed to get regs resources\n"); - ret = -ENODEV; - goto out; - } - - rx_irq = platform_get_irq(pdev, 0); - tx_irq = platform_get_irq(pdev, 1); - link_irq = platform_get_irq(pdev, 2); - if (rx_irq < 0 || tx_irq < 0 || link_irq < 0) { - ret = -ENODEV; - goto out; - } - - platform_set_drvdata(pdev, dev); - SET_NETDEV_DEV(dev, &pdev->dev); - priv = netdev_priv(dev); - priv->pdev = pdev; - priv->dev = dev; - spin_lock_init(&priv->lock); - - intspec = of_get_property(pdev->dev.of_node, - "nuport-mac,buffer-shifting", NULL); - if (!intspec) - priv->buffer_shifting_len = 0; - else - priv->buffer_shifting_len = 2; - - priv->mac_base = devm_ioremap_resource(&pdev->dev, regs); - if (!priv->mac_base) { - dev_err(&pdev->dev, "failed to remap regs\n"); - ret = -ENOMEM; - goto out_platform; - } - - priv->dma_base = devm_ioremap_resource(&pdev->dev, dma); - if (!priv->dma_base) { - dev_err(&pdev->dev, "failed to remap dma-regs\n"); - ret = -ENOMEM; - goto out_platform; - } - - priv->emac_clk = clk_get(&pdev->dev, "emac"); - if (IS_ERR_OR_NULL(priv->emac_clk)) { - dev_err(&pdev->dev, "failed to get emac clk\n"); - ret = PTR_ERR(priv->emac_clk); - goto out_platform; - } - - priv->ephy_clk = clk_get(&pdev->dev, "ephy"); - if (IS_ERR_OR_NULL(priv->ephy_clk)) { - dev_err(&pdev->dev, "failed to get ephy clk\n"); - ret = PTR_ERR(priv->ephy_clk); - goto out_platform; - } - - priv->link_irq = link_irq; - priv->rx_irq = rx_irq; - priv->tx_irq = tx_irq; - priv->msg_level = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK; - dev->netdev_ops = &nuport_mac_ops; - dev->ethtool_ops = &nuport_mac_ethtool_ops; - dev->watchdog_timeo = HZ; - dev->flags = IFF_BROADCAST; /* Supports Broadcast */ - dev->tx_queue_len = TX_RING_SIZE / 2; - - netif_napi_add(dev, &priv->napi, nuport_mac_poll, 64); - - priv->phy_node = of_parse_phandle(pdev->dev.of_node, "phy", 0); - if (!priv->phy_node) { - dev_err(&pdev->dev, "no associated PHY\n"); - ret = -ENODEV; - goto out; - } - - priv->phy_interface = of_get_phy_mode(pdev->dev.of_node); - if (priv->phy_interface < 0) { - dev_err(&pdev->dev, "invalid PHY mode\n"); - ret = -EINVAL; - goto out; - } - - priv->mii_bus = mdiobus_alloc(); - if (!priv->mii_bus) { - dev_err(&pdev->dev, "mii bus allocation failed\n"); - goto out; - } - - priv->mii_bus->priv = dev; - priv->mii_bus->read = nuport_mac_mii_read; - priv->mii_bus->write = nuport_mac_mii_write; - priv->mii_bus->reset = nuport_mac_mii_reset; - priv->mii_bus->name = "nuport-mac-mii"; - priv->mii_bus->phy_mask = (1 << 0); - snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s", pdev->name); - priv->mii_bus->irq = kzalloc(PHY_MAX_ADDR * sizeof(int), GFP_KERNEL); - if (!priv->mii_bus->irq) { - dev_err(&pdev->dev, "failed to allocate mii_bus irqs\n"); - ret = -ENOMEM; - goto out_mdio; - } - - /* We support PHY interrupts routed back to the MAC */ - for (i = 0; i < PHY_MAX_ADDR; i++) - priv->mii_bus->irq[i] = PHY_IGNORE_INTERRUPT; - - ret = of_mdiobus_register(priv->mii_bus, pdev->dev.of_node); - if (ret) { - dev_err(&pdev->dev, "failed to register mii_bus\n"); - goto out_mdio_irq; - } - - ret = nuport_mac_mii_probe(dev); - if (ret) { - dev_err(&pdev->dev, "failed to probe MII bus\n"); - goto out_mdio_unregister; - } - - ret = register_netdev(dev); - if (ret) { - dev_err(&pdev->dev, "failed to register net_device\n"); - goto out_mdio_probe; - } - - /* read existing mac address */ - nuport_mac_read_mac_address(dev); - - dev_info(&pdev->dev, "registered (MAC: %pM)\n", dev->dev_addr); - - return ret; - -out_mdio_probe: - phy_disconnect(priv->phydev); -out_mdio_unregister: - mdiobus_unregister(priv->mii_bus); -out_mdio_irq: - kfree(priv->mii_bus->irq); -out_mdio: - mdiobus_free(priv->mii_bus); -out_platform: - platform_set_drvdata(pdev, NULL); -out: - clk_put(priv->ephy_clk); - clk_put(priv->emac_clk); - free_netdev(dev); - platform_set_drvdata(pdev, NULL); - return ret; -} - -static int nuport_mac_remove(struct platform_device *pdev) -{ - struct net_device *dev = platform_get_drvdata(pdev); - struct nuport_mac_priv *priv = netdev_priv(dev); - - unregister_netdev(dev); - phy_disconnect(priv->phydev); - mdiobus_unregister(priv->mii_bus); - kfree(priv->mii_bus->irq); - mdiobus_free(priv->mii_bus); - clk_put(priv->ephy_clk); - clk_put(priv->emac_clk); - free_netdev(dev); - - platform_set_drvdata(pdev, NULL); - - return 0; -} - -static struct of_device_id nuport_eth_ids[] __initdata = { - {.compatible = "moschip,nuport-mac",}, - { /* sentinel */ }, -}; - -static struct platform_driver nuport_eth_driver = { - .driver = { - .name = "nuport-mac", - .owner = THIS_MODULE, - .of_match_table = nuport_eth_ids, - }, - .probe = nuport_mac_probe, - .remove = nuport_mac_remove, -}; - -module_platform_driver(nuport_eth_driver); - -MODULE_AUTHOR("Moschip Semiconductors Ltd."); -MODULE_DESCRIPTION("Moschip MCS8140 Ethernet MAC driver"); -MODULE_LICENSE("GPL"); diff --git a/target/linux/mcs814x/files-3.18/drivers/net/phy/mcs814x.c b/target/linux/mcs814x/files-3.18/drivers/net/phy/mcs814x.c deleted file mode 100644 index e92176e3b..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/net/phy/mcs814x.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Driver for Moschip MCS814x internal PHY - * - * Copyright (c) 2012 Florian Fainelli - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -MODULE_DESCRIPTION("Moschip MCS814x PHY driver"); -MODULE_AUTHOR("Florian Fainelli "); -MODULE_LICENSE("GPL"); - -/* Nothing special about this PHY but its OUI (O) */ -static struct phy_driver mcs8140_driver = { - .phy_id = 0, - .name = "Moschip MCS8140", - .phy_id_mask = 0x02, - .features = PHY_BASIC_FEATURES, - .config_aneg = &genphy_config_aneg, - .read_status = &genphy_read_status, - .suspend = genphy_suspend, - .resume = genphy_resume, - .driver = { .owner = THIS_MODULE,}, -}; - -static int __init mcs814x_phy_init(void) -{ - return phy_driver_register(&mcs8140_driver); -} - -static void __exit mcs814x_phy_exit(void) -{ - phy_driver_unregister(&mcs8140_driver); -} - -module_init(mcs814x_phy_init); -module_exit(mcs814x_phy_exit); - -static struct mdio_device_id __maybe_unused mcs814x_phy_tbl[] = { - { 0x0, 0x0ffffff0 }, - { } -}; - -MODULE_DEVICE_TABLE(mdio, mcs814x_phy_tbl); diff --git a/target/linux/mcs814x/files-3.18/drivers/usb/host/ehci-mcs814x.c b/target/linux/mcs814x/files-3.18/drivers/usb/host/ehci-mcs814x.c deleted file mode 100644 index 23928f2c4..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/usb/host/ehci-mcs814x.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * MCS814X EHCI Host Controller Driver - * - * Based on "ehci-fsl.c" by Randy Vinson - * - * 2007 (c) MontaVista Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ - -#include -#include - -#define MCS814X_EHCI_CAPS_OFFSET 0x68 - -static int mcs814x_ehci_init(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - int retval = 0; - - ehci->caps = hcd->regs + MCS814X_EHCI_CAPS_OFFSET; - ehci->regs = hcd->regs - + HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); - ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); - ehci_reset(ehci); - - retval = ehci_init(hcd); - if (retval) { - pr_err("ehci_init failed\n"); - return retval; - } - - return retval; -} - -static const struct hc_driver mcs814x_ehci_hc_driver = { - .description = hcd_name, - .product_desc = "MCS814X EHCI Host Controller", - .hcd_priv_size = sizeof(struct ehci_hcd), - .irq = ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, - .reset = mcs814x_ehci_init, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, - .urb_enqueue = ehci_urb_enqueue, - .urb_dequeue = ehci_urb_dequeue, - .endpoint_disable = ehci_endpoint_disable, - .get_frame_number = ehci_get_frame, - .hub_status_data = ehci_hub_status_data, - .hub_control = ehci_hub_control, -#if defined(CONFIG_PM) - .bus_suspend = ehci_bus_suspend, - .bus_resume = ehci_bus_resume, -#endif - .relinquish_port = ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; - -static int mcs814x_ehci_probe(struct platform_device *pdev) -{ - struct usb_hcd *hcd; - const struct hc_driver *driver = &mcs814x_ehci_hc_driver; - struct resource *res; - int irq; - int retval; - - if (usb_disabled()) - return -ENODEV; - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res) { - dev_err(&pdev->dev, - "Found HC with no IRQ. Check %s setup!\n", - dev_name(&pdev->dev)); - return -ENODEV; - } - irq = res->start; - - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; - - hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); - if (!hcd) { - retval = -ENOMEM; - goto fail_create_hcd; - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, - "Found HC with no register addr. Check %s setup!\n", - dev_name(&pdev->dev)); - retval = -ENODEV; - goto fail_request_resource; - } - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - - if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, - driver->description)) { - dev_dbg(&pdev->dev, "controller already in use\n"); - retval = -EBUSY; - goto fail_request_resource; - } - - hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); - if (hcd->regs == NULL) { - dev_dbg(&pdev->dev, "error mapping memory\n"); - retval = -EFAULT; - goto fail_ioremap; - } - - retval = usb_add_hcd(hcd, irq, IRQF_SHARED); - if (retval) - goto fail_add_hcd; - - dev_info(&pdev->dev, "added MCS814X EHCI driver\n"); - - return retval; - -fail_add_hcd: - iounmap(hcd->regs); -fail_ioremap: - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); -fail_request_resource: - usb_put_hcd(hcd); -fail_create_hcd: - dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval); - return retval; -} - -static int mcs814x_ehci_remove(struct platform_device *pdev) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); - - usb_remove_hcd(hcd); - iounmap(hcd->regs); - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); - usb_put_hcd(hcd); - - return 0; -} - -MODULE_ALIAS("platform:mcs814x-ehci"); - -static const struct of_device_id mcs814x_ehci_id[] = { - { .compatible = "moschip,mcs814x-ehci" }, - { .compatible = "usb-ehci" }, - { /* sentinel */ }, -}; - -static struct platform_driver mcs814x_ehci_driver = { - .probe = mcs814x_ehci_probe, - .remove = mcs814x_ehci_remove, - .driver = { - .name = "mcs814x-ehci", - .of_match_table = mcs814x_ehci_id, - }, -}; diff --git a/target/linux/mcs814x/files-3.18/drivers/usb/host/ohci-mcs814x.c b/target/linux/mcs814x/files-3.18/drivers/usb/host/ohci-mcs814x.c deleted file mode 100644 index 161176b0e..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/usb/host/ohci-mcs814x.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * OHCI HCD (Host Controller Driver) for USB. - * - * (C) Copyright 1999 Roman Weissgaerber - * (C) Copyright 2000-2002 David Brownell - * (C) Copyright 2002 Hewlett-Packard Company - * - * Bus Glue for Moschip MCS814x. - * - * Written by Christopher Hoover - * Based on fragments of previous driver by Russell King et al. - * - * Modified for LH7A404 from ohci-sa1111.c - * by Durgesh Pattamatta - * - * Modified for pxa27x from ohci-lh7a404.c - * by Nick Bane 26-8-2004 - * - * Modified for mcs814x from ohci-mcs814x.c - * by Lennert Buytenhek 28-2-2006 - * Based on an earlier driver by Ray Lehtiniemi - * - * This file is licenced under the GPL. - */ - -#include -#include -#include -#include - -static int usb_hcd_mcs814x_probe(const struct hc_driver *driver, - struct platform_device *pdev) -{ - int retval; - struct usb_hcd *hcd; - - if (pdev->resource[1].flags != IORESOURCE_IRQ) { - pr_debug("resource[1] is not IORESOURCE_IRQ"); - return -ENOMEM; - } - - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; - - hcd = usb_create_hcd(driver, &pdev->dev, "mcs814x"); - if (hcd == NULL) - return -ENOMEM; - - hcd->rsrc_start = pdev->resource[0].start; - hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; - if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { - usb_put_hcd(hcd); - retval = -EBUSY; - goto err1; - } - - hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); - if (hcd->regs == NULL) { - pr_debug("ioremap failed"); - retval = -ENOMEM; - goto err2; - } - - ohci_hcd_init(hcd_to_ohci(hcd)); - - retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED); - if (retval == 0) - return retval; - - iounmap(hcd->regs); -err2: - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); -err1: - usb_put_hcd(hcd); - - return retval; -} - -static void usb_hcd_mcs814x_remove(struct usb_hcd *hcd, - struct platform_device *pdev) -{ - usb_remove_hcd(hcd); - iounmap(hcd->regs); - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); - usb_put_hcd(hcd); -} - -static int ohci_mcs814x_start(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int ret; - - ret = ohci_init(ohci); - if (ret < 0) - return ret; - - ret = ohci_run(ohci); - if (ret < 0) { - ohci_err(ohci, "can't start %s", hcd->self.bus_name); - ohci_stop(hcd); - return ret; - } - - return 0; -} - -static struct hc_driver ohci_mcs814x_hc_driver = { - .description = hcd_name, - .product_desc = "MCS814X OHCI", - .hcd_priv_size = sizeof(struct ohci_hcd), - .irq = ohci_irq, - .flags = HCD_USB11 | HCD_MEMORY, - .start = ohci_mcs814x_start, - .stop = ohci_stop, - .shutdown = ohci_shutdown, - .urb_enqueue = ohci_urb_enqueue, - .urb_dequeue = ohci_urb_dequeue, - .endpoint_disable = ohci_endpoint_disable, - .get_frame_number = ohci_get_frame, - .hub_status_data = ohci_hub_status_data, - .hub_control = ohci_hub_control, -#ifdef CONFIG_PM - .bus_suspend = ohci_bus_suspend, - .bus_resume = ohci_bus_resume, -#endif - .start_port_reset = ohci_start_port_reset, -}; - -extern int usb_disabled(void); - -static int ohci_hcd_mcs814x_drv_probe(struct platform_device *pdev) -{ - int ret; - - ret = -ENODEV; - if (!usb_disabled()) - ret = usb_hcd_mcs814x_probe(&ohci_mcs814x_hc_driver, pdev); - - return ret; -} - -static int ohci_hcd_mcs814x_drv_remove(struct platform_device *pdev) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); - - usb_hcd_mcs814x_remove(hcd, pdev); - - return 0; -} - -#ifdef CONFIG_PM -static int ohci_hcd_mcs814x_drv_suspend(struct platform_device *pdev, pm_message_t state) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - - if (time_before(jiffies, ohci->next_statechange)) - msleep(5); - ohci->next_statechange = jiffies; - - hcd->state = HC_STATE_SUSPENDED; - - return 0; -} - -static int ohci_hcd_mcs814x_drv_resume(struct platform_device *pdev) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int status; - - if (time_before(jiffies, ohci->next_statechange)) - msleep(5); - ohci->next_statechange = jiffies; - - ohci_finish_controller_resume(hcd); - return 0; -} -#endif - -static const struct of_device_id mcs814x_ohci_id[] = { - { .compatible = "moschip,mcs814x-ohci" }, - { .compatible = "ohci-le" }, - { /* sentinel */ }, -}; - -static struct platform_driver ohci_hcd_mcs814x_driver = { - .probe = ohci_hcd_mcs814x_drv_probe, - .remove = ohci_hcd_mcs814x_drv_remove, - .shutdown = usb_hcd_platform_shutdown, -#ifdef CONFIG_PM - .suspend = ohci_hcd_mcs814x_drv_suspend, - .resume = ohci_hcd_mcs814x_drv_resume, -#endif - .driver = { - .name = "mcs814x-ohci", - .owner = THIS_MODULE, - .of_match_table = mcs814x_ohci_id, - }, -}; - -MODULE_ALIAS("platform:mcs814x-ohci"); diff --git a/target/linux/mcs814x/files-3.18/drivers/watchdog/mcs814x_wdt.c b/target/linux/mcs814x/files-3.18/drivers/watchdog/mcs814x_wdt.c deleted file mode 100644 index 7bcded505..000000000 --- a/target/linux/mcs814x/files-3.18/drivers/watchdog/mcs814x_wdt.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Moschip MCS814x Watchdog driver - * - * Copyright (C) 2012, Florian Fainelli - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define WDT_COUNT 0x00 -#define WDT_CTRL 0x04 -#define WDT_CTRL_EN 0x1 - -/* watchdog frequency */ -#define WDT_MAX_VALUE (0xffffffff) - -struct mcs814x_wdt { - void __iomem *regs; - spinlock_t lock; - struct watchdog_device wdt_dev; - struct clk *clk; -}; - -static int mcs814x_wdt_start(struct watchdog_device *dev) -{ - struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev); - u32 reg; - - spin_lock(&wdt->lock); - reg = readl_relaxed(wdt->regs + WDT_CTRL); - reg |= WDT_CTRL_EN; - writel_relaxed(reg, wdt->regs + WDT_CTRL); - spin_unlock(&wdt->lock); - - return 0; -} - -static int mcs814x_wdt_stop(struct watchdog_device *dev) -{ - struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev); - u32 reg; - - spin_lock(&wdt->lock); - reg = readl_relaxed(wdt->regs + WDT_CTRL); - reg &= ~WDT_CTRL_EN; - writel_relaxed(reg, wdt->regs + WDT_CTRL); - spin_unlock(&wdt->lock); - - return 0; -} - -static int mcs814x_wdt_set_timeout(struct watchdog_device *dev, - unsigned int new_timeout) -{ - struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev); - - spin_lock(&wdt->lock); - /* watchdog counts upward and rollover (0xfffffff -> 0) - * triggers the reboot - */ - writel_relaxed(WDT_MAX_VALUE - (new_timeout * clk_get_rate(wdt->clk)), - wdt->regs + WDT_COUNT); - spin_unlock(&wdt->lock); - - return 0; -} - -static int mcs814x_wdt_ping(struct watchdog_device *dev) -{ - /* restart the watchdog */ - mcs814x_wdt_stop(dev); - mcs814x_wdt_set_timeout(dev, dev->timeout); - mcs814x_wdt_start(dev); - - return 0; -} - -static const struct watchdog_info mcs814x_wdt_ident = { - .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | - WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, - .identity = "MCS814x Watchdog", -}; - -static struct watchdog_ops mcs814x_wdt_ops = { - .owner = THIS_MODULE, - .start = mcs814x_wdt_start, - .stop = mcs814x_wdt_stop, - .set_timeout = mcs814x_wdt_set_timeout, - .ping = mcs814x_wdt_ping, -}; - -static int mcs814x_wdt_probe(struct platform_device *pdev) -{ - struct resource *res; - struct mcs814x_wdt *wdt; - int ret; - struct clk *clk; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - - clk = clk_get(NULL, "wdt"); - if (IS_ERR_OR_NULL(clk)) { - dev_err(&pdev->dev, "failed to get watchdog clock\n"); - return PTR_ERR(clk); - } - - wdt = kzalloc(sizeof(*wdt), GFP_KERNEL); - if (!wdt) { - ret = -ENOMEM; - goto out_clk; - } - - spin_lock_init(&wdt->lock); - wdt->clk = clk; - wdt->wdt_dev.info = &mcs814x_wdt_ident; - wdt->wdt_dev.ops = &mcs814x_wdt_ops; - wdt->wdt_dev.min_timeout = 1; - /* approximately 10995 secs */ - wdt->wdt_dev.max_timeout = (WDT_MAX_VALUE / clk_get_rate(clk)); - - platform_set_drvdata(pdev, wdt); - - /* only ioremap registers, because the register is shared */ - wdt->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); - if (!wdt->regs) { - ret = -ENOMEM; - goto out; - } - - watchdog_set_drvdata(&wdt->wdt_dev, wdt); - - ret = watchdog_register_device(&wdt->wdt_dev); - if (ret) { - dev_err(&pdev->dev, "cannot register watchdog: %d\n", ret); - goto out; - } - - dev_info(&pdev->dev, "registered\n"); - return 0; - -out: - platform_set_drvdata(pdev, NULL); - kfree(wdt); -out_clk: - clk_put(clk); - return ret; -} - -static int mcs814x_wdt_remove(struct platform_device *pdev) -{ - struct mcs814x_wdt *wdt = platform_get_drvdata(pdev); - - clk_put(wdt->clk); - watchdog_unregister_device(&wdt->wdt_dev); - watchdog_set_drvdata(&wdt->wdt_dev, NULL); - kfree(wdt); - platform_set_drvdata(pdev, NULL); - - return 0; -} - -static const struct of_device_id mcs814x_wdt_ids[] = { - { .compatible = "moschip,mcs814x-wdt", }, - { /* sentinel */ }, -}; - -static struct platform_driver mcs814x_wdt_driver = { - .driver = { - .name = "mcs814x-wdt", - .owner = THIS_MODULE, - .of_match_table = mcs814x_wdt_ids, - }, - .probe = mcs814x_wdt_probe, - .remove = mcs814x_wdt_remove, -}; - -module_platform_driver(mcs814x_wdt_driver); - -MODULE_AUTHOR("Florian Fainelli "); -MODULE_DESCRIPTION("Moschip MCS814x Watchdog driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); -MODULE_ALIAS("platform:mcs814x-wdt"); diff --git a/target/linux/mcs814x/image/Makefile b/target/linux/mcs814x/image/Makefile deleted file mode 100644 index ff905b308..000000000 --- a/target/linux/mcs814x/image/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright (C) 2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -JFFS2_BLOCKSIZE = 128k - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -TARGET_DTBS := rbt-832 dlan-usb-extender - -DTBS_DIR:=dts/ - -LOADADDR:=0x00008000 - -UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage - -define Image/Build/MkuImage - mkimage -A arm -O linux -T kernel -a $(LOADADDR) -C none -e $(LOADADDR) \ - -n 'ARM $(VERSION_DIST) Linux-$(LINUX_VERSION)' -d $(1) $(2); -endef - -define Image/Build/DTB - cp $(KDIR)/zImage$(2) $(KDIR)/zImage-$(1); - cat $(LINUX_DIR)/arch/$(ARCH)/boot/$(DTBS_DIR)$(1).dtb >> $(KDIR)/zImage$(2)-$(1); - $(call Image/Build/MkuImage,$(KDIR)/zImage$(2)-$(1),$(KDIR)/uImage$(2)-$(1)) - cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1); -endef - -define Image/Build/Profile/dLAN_USB_Extender - dd if=$(KDIR)/uImage-dlan-usb-extender bs=64k conv=sync of=$(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin - cat $(KDIR)/root.$(1) >> $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin - cp $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin $(BIN_DIR)/ -endef - -define Image/BuildKernel - $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb))) -endef - -define Image/Build/Initramfs - $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs)) -endef - -define Image/Build/squashfs - $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs 128 -endef - -define Image/Build - $(call Image/Build/$(1)) - dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync - $(call Image/Build/Profile/$(PROFILE),$(1)) -ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) - $(call Image/Build/Initramfs) -endif -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/mcs814x/modules.mk b/target/linux/mcs814x/modules.mk deleted file mode 100644 index c29ca860d..000000000 --- a/target/linux/mcs814x/modules.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (C) 2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. - -define KernelPackage/mcs814x-wdt - SUBMENU:=$(OTHER_MENU) - DEPENDS:=@TARGET_mcs814x - TITLE:=MCS814x watchdog driver - KCONFIG:=CONFIG_MCS814X_WATCHDOG - FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/mcs814x_wdt.ko - AUTOLOAD:=$(call AutoLoad,50,mcs814x_wdt) -endef - -define KernelPackage/mcs814x-wdt/description - Kernel module for the Moschip MCS814x watchdog timer. -endef - -$(eval $(call KernelPackage,mcs814x-wdt)) diff --git a/target/linux/mcs814x/patches-3.18/001-platform.patch b/target/linux/mcs814x/patches-3.18/001-platform.patch deleted file mode 100644 index 83f1683b0..000000000 --- a/target/linux/mcs814x/patches-3.18/001-platform.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -267,7 +267,8 @@ config PHYS_OFFSET - ARCH_INTEGRATOR || \ - ARCH_IOP13XX || \ - ARCH_KS8695 || \ -- (ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET) -+ (ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET) || \ -+ ARCH_MCS814X - default 0x10000000 if ARCH_OMAP1 || ARCH_RPC - default 0x20000000 if ARCH_S5PV210 - default 0x70000000 if REALVIEW_HIGH_PHYS_OFFSET -@@ -786,6 +787,21 @@ config ARCH_OMAP1 - help - Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx) - -+config ARCH_MCS814X -+ bool "Moschip MCS814x" -+ select FIQ -+ select GENERIC_IRQ_CHIP -+ select GENERIC_GPIO -+ select ARCH_REQUIRE_GPIOLIB -+ select CLKDEV_LOOKUP -+ select ARCH_USES_GETTIMEOFFSET -+ select USB_ARCH_HAS_OHCI -+ select USB_ARCH_HAS_EHCI -+ select MULTI_IRQ_HANDLER -+ help -+ Support for Moschip MCS814x SoCs (MCS8140). -+ -+ - endchoice - - menu "Multiple platform selection" -@@ -927,6 +943,8 @@ source "arch/arm/mach-picoxcell/Kconfig" - source "arch/arm/mach-pxa/Kconfig" - source "arch/arm/plat-pxa/Kconfig" - -+source "arch/arm/mach-mcs814x/Kconfig" -+ - source "arch/arm/mach-mmp/Kconfig" - - source "arch/arm/mach-qcom/Kconfig" ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -180,6 +180,7 @@ machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx - machine-$(CONFIG_ARCH_KEYSTONE) += keystone - machine-$(CONFIG_ARCH_KS8695) += ks8695 - machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx -+machine-$(CONFIG_ARCH_MCS814X) += mcs814x - machine-$(CONFIG_ARCH_MESON) += meson - machine-$(CONFIG_ARCH_MMP) += mmp - machine-$(CONFIG_ARCH_MOXART) += moxart ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -163,6 +163,8 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += kirkwood- - kirkwood-ts419-6282.dtb - dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb - dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb -+dtb-$(CONFIG_ARCH_MCS814X) += dlan-usb-extender.dtb \ -+ rbt-832.dtb - dtb-$(CONFIG_MACH_MESON6) += meson6-atv1200.dtb - dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb - dtb-$(CONFIG_ARCH_MXC) += \ diff --git a/target/linux/mcs814x/patches-3.18/003-ethernet.patch b/target/linux/mcs814x/patches-3.18/003-ethernet.patch deleted file mode 100644 index 3ee8cd6b3..000000000 --- a/target/linux/mcs814x/patches-3.18/003-ethernet.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/drivers/net/ethernet/Kconfig -+++ b/drivers/net/ethernet/Kconfig -@@ -186,4 +186,6 @@ source "drivers/net/ethernet/wiznet/Kcon - source "drivers/net/ethernet/xilinx/Kconfig" - source "drivers/net/ethernet/xircom/Kconfig" - -+source "drivers/net/ethernet/mcs8140/Kconfig" -+ - endif # ETHERNET ---- a/drivers/net/ethernet/Makefile -+++ b/drivers/net/ethernet/Makefile -@@ -84,3 +84,4 @@ obj-$(CONFIG_NET_VENDOR_VIA) += via/ - obj-$(CONFIG_NET_VENDOR_WIZNET) += wiznet/ - obj-$(CONFIG_NET_VENDOR_XILINX) += xilinx/ - obj-$(CONFIG_NET_VENDOR_XIRCOM) += xircom/ -+obj-$(CONFIG_NUPORT_ETHERNET_DRIVER) += mcs8140/ diff --git a/target/linux/mcs814x/patches-3.18/004-usb.patch b/target/linux/mcs814x/patches-3.18/004-usb.patch deleted file mode 100644 index d69ec211a..000000000 --- a/target/linux/mcs814x/patches-3.18/004-usb.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -1298,6 +1298,11 @@ MODULE_LICENSE ("GPL"); - #define PLATFORM_DRIVER ehci_hcd_sead3_driver - #endif - -+#ifdef CONFIG_ARCH_MCS814X -+#include "ehci-mcs814x.c" -+#define PLATFORM_DRIVER mcs814x_ehci_driver -+#endif -+ - static int __init ehci_hcd_init(void) - { - int retval = 0; ---- a/drivers/usb/host/ohci-hcd.c -+++ b/drivers/usb/host/ohci-hcd.c -@@ -1259,6 +1259,11 @@ MODULE_LICENSE ("GPL"); - #define PLATFORM_DRIVER ohci_hcd_tilegx_driver - #endif - -+#ifdef CONFIG_ARCH_MCS814X -+#include "ohci-mcs814x.c" -+#define PLATFORM_DRIVER ohci_hcd_mcs814x_driver -+#endif -+ - static int __init ohci_hcd_mod_init(void) - { - int retval = 0; diff --git a/target/linux/mcs814x/patches-3.18/005-mcs814x_rng.patch b/target/linux/mcs814x/patches-3.18/005-mcs814x_rng.patch deleted file mode 100644 index 4af3d8683..000000000 --- a/target/linux/mcs814x/patches-3.18/005-mcs814x_rng.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/drivers/char/hw_random/Kconfig -+++ b/drivers/char/hw_random/Kconfig -@@ -229,6 +229,18 @@ config HW_RANDOM_TX4939 - - If unsure, say Y. - -+config HW_RANDOM_MCS814X -+ tristate "Moschip MCS814x Random Number Generator" -+ depends on HW_RANDOM && ARCH_MCS814X -+ ---help--- -+ This driver provides kernel-side support for the Random Number -+ Generator hardware found on Moschip MCS814x processors. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called mcs814x-rng. -+ -+ If unusure, say Y. -+ - config HW_RANDOM_MXC_RNGA - tristate "Freescale i.MX RNGA Random Number Generator" - depends on ARCH_HAS_RNGA ---- a/drivers/char/hw_random/Makefile -+++ b/drivers/char/hw_random/Makefile -@@ -19,6 +19,7 @@ obj-$(CONFIG_HW_RANDOM_OMAP3_ROM) += oma - obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o - obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o - obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939-rng.o -+obj-$(CONFIG_HW_RANDOM_MCS814X) += mcs814x-rng.o - obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o - obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o - obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o diff --git a/target/linux/mcs814x/patches-3.18/006-mcs814x_wdt.patch b/target/linux/mcs814x/patches-3.18/006-mcs814x_wdt.patch deleted file mode 100644 index 72481f6b8..000000000 --- a/target/linux/mcs814x/patches-3.18/006-mcs814x_wdt.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -505,6 +505,12 @@ config MESON_WATCHDOG - To compile this driver as a module, choose M here: the - module will be called meson_wdt. - -+config MCS814X_WATCHDOG -+ tristate "Moschip MCS814x watchdog" -+ depends on WATCHDOG_CORE && ARCH_MCS814X -+ help -+ Support for the Moschip MCS814x SoCs on-chip watchdog timer. -+ - # AVR32 Architecture - - config AT32AP700X_WDT ---- a/drivers/watchdog/Makefile -+++ b/drivers/watchdog/Makefile -@@ -63,6 +63,7 @@ obj-$(CONFIG_QCOM_WDT) += qcom-wdt.o - obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o - obj-$(CONFIG_TEGRA_WATCHDOG) += tegra_wdt.o - obj-$(CONFIG_MESON_WATCHDOG) += meson_wdt.o -+obj-$(CONFIG_MCS814X_WATCHDOG) += mcs814x_wdt.o - - # AVR32 Architecture - obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o diff --git a/target/linux/mcs814x/patches-3.18/008-mcs814x_gpio.patch b/target/linux/mcs814x/patches-3.18/008-mcs814x_gpio.patch deleted file mode 100644 index f0944bffd..000000000 --- a/target/linux/mcs814x/patches-3.18/008-mcs814x_gpio.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -820,6 +820,12 @@ config GPIO_MC33880 - SPI driver for Freescale MC33880 high-side/low-side switch. - This provides GPIO interface supporting inputs and outputs. - -+config GPIO_MCS814X -+ tristate "Moschip MCS814x GPIO support" -+ depends on ARCH_MCS814X -+ help -+ GPIO driver for Moschip MCS814x SoC gpio controllers. -+ - config GPIO_74X164 - tristate "74x164 serial-in/parallel-out 8-bits shift register" - depends on SPI_MASTER && OF ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -49,6 +49,7 @@ obj-$(CONFIG_GPIO_MAX732X) += gpio-max73 - obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o - obj-$(CONFIG_GPIO_MC9S08DZ60) += gpio-mc9s08dz60.o - obj-$(CONFIG_GPIO_MCP23S08) += gpio-mcp23s08.o -+obj-$(CONFIG_GPIO_MCS814X) += gpio-mcs814x.o - obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o - obj-$(CONFIG_GPIO_MM_LANTIQ) += gpio-mm-lantiq.o - obj-$(CONFIG_GPIO_MOXART) += gpio-moxart.o diff --git a/target/linux/mcs814x/patches-3.18/011-mcs814x_internal_phy.patch b/target/linux/mcs814x/patches-3.18/011-mcs814x_internal_phy.patch deleted file mode 100644 index 20d5add20..000000000 --- a/target/linux/mcs814x/patches-3.18/011-mcs814x_internal_phy.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -164,6 +164,10 @@ config RTL8306_PHY - tristate "Driver for Realtek RTL8306S switches" - select SWCONFIG - -+config MCS814X_PHY -+ tristate "Driver for the Moschip MCS814x internal PHY" -+ depends on ARCH_MCS814X -+ - config FIXED_PHY - bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" - depends on PHYLIB=y ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -51,3 +51,4 @@ obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o - obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o - obj-$(CONFIG_AMD_XGBE_PHY) += amd-xgbe-phy.o - obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o -+obj-$(CONFIG_MCS814X_PHY) += mcs814x.o diff --git a/target/linux/mcs814x/patches-3.18/012-mtd-cfi_cmdset_0002-force-word-write.patch b/target/linux/mcs814x/patches-3.18/012-mtd-cfi_cmdset_0002-force-word-write.patch deleted file mode 100644 index 10593ce70..000000000 --- a/target/linux/mcs814x/patches-3.18/012-mtd-cfi_cmdset_0002-force-word-write.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/drivers/mtd/chips/cfi_cmdset_0002.c -+++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -40,9 +40,9 @@ - #include - - #define AMD_BOOTLOC_BUG --#define FORCE_WORD_WRITE 0 -+#define FORCE_WORD_WRITE 1 - --#define MAX_WORD_RETRIES 3 -+#define MAX_WORD_RETRIES 10 - - #define SST49LF004B 0x0060 - #define SST49LF040B 0x0050 diff --git a/target/linux/mcs814x/patches-3.18/013-ohci_workarounds.patch b/target/linux/mcs814x/patches-3.18/013-ohci_workarounds.patch deleted file mode 100644 index 8697f0338..000000000 --- a/target/linux/mcs814x/patches-3.18/013-ohci_workarounds.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- a/drivers/usb/host/ohci.h -+++ b/drivers/usb/host/ohci.h -@@ -122,7 +122,7 @@ struct td { - /* PSW is only for ISO. Only 1 PSW entry is used, but on - * big-endian PPC hardware that's the second entry. - */ --#define MAXPSW 2 -+#define MAXPSW 8 - __hc16 hwPSW [MAXPSW]; - - /* rest are purely for the driver's use */ ---- a/drivers/usb/host/ohci-hcd.c -+++ b/drivers/usb/host/ohci-hcd.c -@@ -441,6 +441,7 @@ static int ohci_init (struct ohci_hcd *o - { - int ret; - struct usb_hcd *hcd = ohci_to_hcd(ohci); -+ u32 hcca_area; - - /* Accept arbitrarily long scatter-gather lists */ - hcd->self.sg_tablesize = ~0; -@@ -501,11 +502,13 @@ static int ohci_init (struct ohci_hcd *o - (unsigned long) ohci); - set_timer_slack(&ohci->io_watchdog, msecs_to_jiffies(20)); - -- ohci->hcca = dma_alloc_coherent (hcd->self.controller, -- sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL); -+ hcca_area = ohci_readl(ohci, &ohci->regs->hcca); -+ ohci->hcca = ioremap_nocache(hcca_area, sizeof *ohci->hcca); - if (!ohci->hcca) - return -ENOMEM; - -+ ohci->hcca_dma = hcca_area; -+ - if ((ret = ohci_mem_init (ohci)) < 0) - ohci_stop (hcd); - else { -@@ -523,6 +526,7 @@ static int ohci_init (struct ohci_hcd *o - */ - static int ohci_run (struct ohci_hcd *ohci) - { -+ int i = 0; - u32 mask, val; - int first = ohci->fminterval == 0; - struct usb_hcd *hcd = ohci_to_hcd(ohci); -@@ -573,6 +577,8 @@ static int ohci_run (struct ohci_hcd *oh - msleep(val); - - memset (ohci->hcca, 0, sizeof (struct ohci_hcca)); -+ for (i = 0; i < NUM_INTS; i++) -+ ohci->hcca->int_table[i] = 0; - - /* 2msec timelimit here means no irqs/preempt */ - spin_lock_irq (&ohci->lock); -@@ -984,9 +990,6 @@ static void ohci_stop (struct usb_hcd *h - remove_debug_files (ohci); - ohci_mem_cleanup (ohci); - if (ohci->hcca) { -- dma_free_coherent (hcd->self.controller, -- sizeof *ohci->hcca, -- ohci->hcca, ohci->hcca_dma); - ohci->hcca = NULL; - ohci->hcca_dma = 0; - } diff --git a/target/linux/mcs814x/patches-3.18/014-debuguart.patch b/target/linux/mcs814x/patches-3.18/014-debuguart.patch deleted file mode 100644 index 5f1b67f30..000000000 --- a/target/linux/mcs814x/patches-3.18/014-debuguart.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/arch/arm/mach-mcs814x/include/mach/debug-macro.S -+++ /dev/null -@@ -1,11 +0,0 @@ --#include -- -- .macro addruart, rp, rv, tmp -- ldr \rp, =MCS814X_PHYS_BASE -- ldr \rv, =MCS814X_VIRT_BASE -- orr \rp, \rp, #MCS814X_UART -- orr \rv, \rv, #MCS814X_UART -- .endm -- --#define UART_SHIFT 2 --#include ---- a/arch/arm/Kconfig.debug -+++ b/arch/arm/Kconfig.debug -@@ -1089,7 +1089,7 @@ config DEBUG_UART_8250 - (FOOTBRIDGE && !DEBUG_DC21285_PORT) || \ - ARCH_GEMINI || ARCH_IOP13XX || ARCH_IOP32X || \ - ARCH_IOP33X || ARCH_IXP4XX || \ -- ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC -+ ARCH_LPC32XX || ARCH_MCS814X || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC - - # Compatibility options for BCM63xx - config DEBUG_UART_BCM63XX -@@ -1124,6 +1124,7 @@ config DEBUG_UART_PHYS - default 0x3e000000 if DEBUG_BCM_KONA_UART - default 0x4000e400 if DEBUG_LL_UART_EFM32 - default 0x40090000 if ARCH_LPC32XX -+ default 0x400dc000 if ARCH_MCS814X - default 0x40100000 if DEBUG_PXA_UART1 - default 0x42000000 if ARCH_GEMINI - default 0x50000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \ -@@ -1178,6 +1179,7 @@ config DEBUG_UART_VIRT - default 0xe0010fe0 if ARCH_RPC - default 0xe1000000 if DEBUG_MSM_UART - default 0xf0000be0 if ARCH_EBSA110 -+ default 0xf00dc000 if ARCH_MCS814X - default 0xf01fb000 if DEBUG_NOMADIK_UART - default 0xf0201000 if DEBUG_BCM2835 - default 0xf1000300 if DEBUG_BCM_5301X diff --git a/target/linux/mcs814x/profiles/000-Generic.mk b/target/linux/mcs814x/profiles/000-Generic.mk deleted file mode 100644 index a6d0f30ec..000000000 --- a/target/linux/mcs814x/profiles/000-Generic.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (C) 2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/Generic - NAME:=Generic profile -endef - -define Profile/Generic/Description - Default profile for Moschip MCS814x targets -endef -$(eval $(call Profile,Generic)) - diff --git a/target/linux/mcs814x/profiles/100-dLAN-USB-Extender.mk b/target/linux/mcs814x/profiles/100-dLAN-USB-Extender.mk deleted file mode 100644 index 168bfa143..000000000 --- a/target/linux/mcs814x/profiles/100-dLAN-USB-Extender.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (C) 2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/dLAN_USB_Extender - NAME:=Devolo dLAN USB Extender - PACKAGES:=kmod-usb-serial kmod-usb-serial-ftdi -endef - -define Profile/dLAN_USB_Extender/Description - Package set specifically tuned for the Devolo dLAN USB Extender device. - - Binary packages are required to enable the power line portion of the - device, these packages can be found in the following package feed: - - src-git dlan https://github.com/ffainelli/dlan-usb-extender-3rd-party.git - - Instructions are available here: - http://ffainelli.github.io/dlan-usb-extender-3rd-party/ -endef -$(eval $(call Profile,dLAN_USB_Extender)) - diff --git a/target/linux/mediatek/image/Makefile b/target/linux/mediatek/image/Makefile index 6659d446d..41ad6e051 100644 --- a/target/linux/mediatek/image/Makefile +++ b/target/linux/mediatek/image/Makefile @@ -16,12 +16,6 @@ ifeq ($(SUBTARGET),mt7622) KERNEL_LOADADDR = 0x41080000 endif -# build dtb -define Build/dtb - $(call Image/BuildDTB,$(DEVICE_DTS_DIR)/$(DEVICE_DTS).dts,$(DEVICE_DTS_DIR)/$(DEVICE_DTS).dtb) - $(CP) $(DEVICE_DTS_DIR)/$(DEVICE_DTS).dtb $(BIN_DIR)/ -endef - # default all platform image(fit) build define Device/Default PROFILES = Default $$(DEVICE_NAME) @@ -32,13 +26,13 @@ define Device/Default IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata ifeq ($(SUBTARGET),mt7623) KERNEL_NAME := zImage - KERNEL := dtb | kernel-bin | append-dtb | uImage none - KERNEL_INITRAMFS := dtb | kernel-bin | append-dtb | uImage none + KERNEL := kernel-bin | append-dtb | uImage none + KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none endif ifeq ($(SUBTARGET),mt7622) KERNEL_NAME := Image - KERNEL = dtb | kernel-bin | lzma | fit lzma $$(DEVICE_DTS_DIR)/$$(DEVICE_DTS).dtb - KERNEL_INITRAMFS = dtb | kernel-bin | lzma | fit lzma $$(DEVICE_DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb endif endef diff --git a/target/linux/mediatek/mt7622/config-4.14 b/target/linux/mediatek/mt7622/config-4.14 index 5d43b224f..fdfb68d08 100644 --- a/target/linux/mediatek/mt7622/config-4.14 +++ b/target/linux/mediatek/mt7622/config-4.14 @@ -52,6 +52,7 @@ CONFIG_ARM64_PAN=y # CONFIG_ARM64_PTDUMP_CORE is not set # CONFIG_ARM64_PTDUMP_DEBUGFS is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_ARM64_SSBD=y # CONFIG_ARM64_SW_TTBR0_PAN is not set CONFIG_ARM64_UAO=y CONFIG_ARM64_VA_BITS=39 @@ -72,7 +73,6 @@ CONFIG_ARM_PSCI_FW=y # CONFIG_ARM_SP805_WATCHDOG is not set CONFIG_ATA=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -# CONFIG_BLK_DEV is not set CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_SCSI_REQUEST=y diff --git a/target/linux/mediatek/mt7622/target.mk b/target/linux/mediatek/mt7622/target.mk index 1fc33b8af..b27186911 100644 --- a/target/linux/mediatek/mt7622/target.mk +++ b/target/linux/mediatek/mt7622/target.mk @@ -2,7 +2,6 @@ ARCH:=aarch64 SUBTARGET:=mt7622 BOARDNAME:=MT7622 CPU_TYPE:=cortex-a53 -CPU_SUBTYPE:=neon-vfpv4 KERNELNAME:=Image dtbs diff --git a/target/linux/mediatek/patches-4.14/0012-clk-dont-disable-unused-clocks.patch b/target/linux/mediatek/patches-4.14/0012-clk-dont-disable-unused-clocks.patch index ed4111dce..33ede7d3a 100644 --- a/target/linux/mediatek/patches-4.14/0012-clk-dont-disable-unused-clocks.patch +++ b/target/linux/mediatek/patches-4.14/0012-clk-dont-disable-unused-clocks.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c -@@ -796,7 +796,7 @@ unlock_out: +@@ -797,7 +797,7 @@ unlock_out: clk_core_disable_unprepare(core->parent); } diff --git a/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch b/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch index 5c4edec07..926e0d842 100644 --- a/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch +++ b/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch @@ -249,7 +249,7 @@ --- a/net/dsa/slave.c +++ b/net/dsa/slave.c -@@ -1257,7 +1257,7 @@ int dsa_slave_create(struct dsa_port *po +@@ -1263,7 +1263,7 @@ int dsa_slave_create(struct dsa_port *po int ret; cpu_dp = ds->dst->cpu_dp; @@ -258,7 +258,7 @@ if (!ds->num_tx_queues) ds->num_tx_queues = 1; -@@ -1295,6 +1295,7 @@ int dsa_slave_create(struct dsa_port *po +@@ -1301,6 +1301,7 @@ int dsa_slave_create(struct dsa_port *po p->dp = port; INIT_LIST_HEAD(&p->mall_tc_list); p->xmit = dst->tag_ops->xmit; diff --git a/target/linux/mediatek/patches-4.14/0052-net-phy-add-FC.patch b/target/linux/mediatek/patches-4.14/0052-net-phy-add-FC.patch index 3c4fc5a7c..134d95d99 100644 --- a/target/linux/mediatek/patches-4.14/0052-net-phy-add-FC.patch +++ b/target/linux/mediatek/patches-4.14/0052-net-phy-add-FC.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1929,7 +1929,7 @@ static struct phy_driver genphy_driver = +@@ -1926,7 +1926,7 @@ static struct phy_driver genphy_driver = .config_init = genphy_config_init, .features = PHY_GBIT_FEATURES | SUPPORTED_MII | SUPPORTED_AUI | SUPPORTED_FIBRE | diff --git a/target/linux/mediatek/patches-4.14/0064-dts.patch b/target/linux/mediatek/patches-4.14/0064-dts.patch index cfae4fee6..08feb8d73 100644 --- a/target/linux/mediatek/patches-4.14/0064-dts.patch +++ b/target/linux/mediatek/patches-4.14/0064-dts.patch @@ -11,8 +11,8 @@ cpus { cpu@0 { proc-supply = <&mt6323_vproc_reg>; -@@ -102,6 +106,10 @@ - memory@80000000 { +@@ -103,6 +107,10 @@ + device_type = "memory"; reg = <0 0x80000000 0 0x40000000>; }; + @@ -22,7 +22,7 @@ }; &cir { -@@ -129,11 +137,24 @@ +@@ -130,11 +138,24 @@ }; }; @@ -49,7 +49,7 @@ compatible = "mediatek,mt7530"; #address-cells = <1>; #size-cells = <0>; -@@ -143,6 +164,8 @@ +@@ -144,6 +165,8 @@ core-supply = <&mt6323_vpa_reg>; io-supply = <&mt6323_vemc3v3_reg>; @@ -58,7 +58,7 @@ ports { #address-cells = <1>; #size-cells = <0>; -@@ -151,29 +174,46 @@ +@@ -152,29 +175,46 @@ port@0 { reg = <0>; label = "wan"; @@ -106,7 +106,7 @@ reg = <6>; label = "cpu"; ethernet = <&gmac0>; -@@ -186,8 +226,6 @@ +@@ -187,8 +227,6 @@ }; }; }; @@ -579,7 +579,7 @@ + --- a/arch/arm/boot/dts/mt7623.dtsi +++ b/arch/arm/boot/dts/mt7623.dtsi -@@ -322,6 +322,7 @@ +@@ -323,6 +323,7 @@ "syscon"; reg = <0 0x10209000 0 0x1000>; #clock-cells = <1>; diff --git a/target/linux/mediatek/patches-4.14/0125-phy-phy-mtk-tphy-add-set_mode-callback.patch b/target/linux/mediatek/patches-4.14/0125-phy-phy-mtk-tphy-add-set_mode-callback.patch index a9481f3d6..9b651925c 100644 --- a/target/linux/mediatek/patches-4.14/0125-phy-phy-mtk-tphy-add-set_mode-callback.patch +++ b/target/linux/mediatek/patches-4.14/0125-phy-phy-mtk-tphy-add-set_mode-callback.patch @@ -26,7 +26,7 @@ Signed-off-by: Kishon Vijay Abraham I #define U3P_U3_CHIP_GPIO_CTLD 0x0c #define P3C_REG_IP_SW_RST BIT(31) -@@ -585,6 +587,31 @@ static void u2_phy_instance_exit(struct +@@ -580,6 +582,31 @@ static void u2_phy_instance_exit(struct } } @@ -58,7 +58,7 @@ Signed-off-by: Kishon Vijay Abraham I static void pcie_phy_instance_init(struct mtk_tphy *tphy, struct mtk_phy_instance *instance) { -@@ -881,6 +908,17 @@ static int mtk_phy_exit(struct phy *phy) +@@ -876,6 +903,17 @@ static int mtk_phy_exit(struct phy *phy) return 0; } @@ -76,7 +76,7 @@ Signed-off-by: Kishon Vijay Abraham I static struct phy *mtk_phy_xlate(struct device *dev, struct of_phandle_args *args) { -@@ -931,6 +969,7 @@ static const struct phy_ops mtk_tphy_ops +@@ -926,6 +964,7 @@ static const struct phy_ops mtk_tphy_ops .exit = mtk_phy_exit, .power_on = mtk_phy_power_on, .power_off = mtk_phy_power_off, diff --git a/target/linux/mediatek/patches-4.14/0177-phy-phy-mtk-tphy-use-auto-instead-of-force-to-bypass.patch b/target/linux/mediatek/patches-4.14/0177-phy-phy-mtk-tphy-use-auto-instead-of-force-to-bypass.patch deleted file mode 100644 index fc993c326..000000000 --- a/target/linux/mediatek/patches-4.14/0177-phy-phy-mtk-tphy-use-auto-instead-of-force-to-bypass.patch +++ /dev/null @@ -1,75 +0,0 @@ -From dacdae142ffd909ed6718adb05af74ff800da668 Mon Sep 17 00:00:00 2001 -From: Chunfeng Yun -Date: Thu, 7 Dec 2017 19:53:34 +0800 -Subject: [PATCH 177/224] phy: phy-mtk-tphy: use auto instead of force to - bypass utmi signals - -When system is running, if usb2 phy is forced to bypass utmi signals, -all PLL will be turned off, and it can't detect device connection -anymore, so replace force mode with auto mode which can bypass utmi -signals automatically if no device attached for normal flow. -But keep the force mode to fix RX sensitivity degradation issue. - -Signed-off-by: Chunfeng Yun -Signed-off-by: Kishon Vijay Abraham I ---- - drivers/phy/mediatek/phy-mtk-tphy.c | 19 +++++++------------ - 1 file changed, 7 insertions(+), 12 deletions(-) - ---- a/drivers/phy/mediatek/phy-mtk-tphy.c -+++ b/drivers/phy/mediatek/phy-mtk-tphy.c -@@ -440,9 +440,9 @@ static void u2_phy_instance_init(struct - u32 index = instance->index; - u32 tmp; - -- /* switch to USB function. (system register, force ip into usb mode) */ -+ /* switch to USB function, and enable usb pll */ - tmp = readl(com + U3P_U2PHYDTM0); -- tmp &= ~P2C_FORCE_UART_EN; -+ tmp &= ~(P2C_FORCE_UART_EN | P2C_FORCE_SUSPENDM); - tmp |= P2C_RG_XCVRSEL_VAL(1) | P2C_RG_DATAIN_VAL(0); - writel(tmp, com + U3P_U2PHYDTM0); - -@@ -502,10 +502,8 @@ static void u2_phy_instance_power_on(str - u32 index = instance->index; - u32 tmp; - -- /* (force_suspendm=0) (let suspendm=1, enable usb 480MHz pll) */ - tmp = readl(com + U3P_U2PHYDTM0); -- tmp &= ~(P2C_FORCE_SUSPENDM | P2C_RG_XCVRSEL); -- tmp &= ~(P2C_RG_DATAIN | P2C_DTM0_PART_MASK); -+ tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN | P2C_DTM0_PART_MASK); - writel(tmp, com + U3P_U2PHYDTM0); - - /* OTG Enable */ -@@ -540,7 +538,6 @@ static void u2_phy_instance_power_off(st - - tmp = readl(com + U3P_U2PHYDTM0); - tmp &= ~(P2C_RG_XCVRSEL | P2C_RG_DATAIN); -- tmp |= P2C_FORCE_SUSPENDM; - writel(tmp, com + U3P_U2PHYDTM0); - - /* OTG Disable */ -@@ -548,18 +545,16 @@ static void u2_phy_instance_power_off(st - tmp &= ~PA6_RG_U2_OTG_VBUSCMP_EN; - writel(tmp, com + U3P_USBPHYACR6); - -- /* let suspendm=0, set utmi into analog power down */ -- tmp = readl(com + U3P_U2PHYDTM0); -- tmp &= ~P2C_RG_SUSPENDM; -- writel(tmp, com + U3P_U2PHYDTM0); -- udelay(1); -- - tmp = readl(com + U3P_U2PHYDTM1); - tmp &= ~(P2C_RG_VBUSVALID | P2C_RG_AVALID); - tmp |= P2C_RG_SESSEND; - writel(tmp, com + U3P_U2PHYDTM1); - - if (tphy->pdata->avoid_rx_sen_degradation && index) { -+ tmp = readl(com + U3P_U2PHYDTM0); -+ tmp &= ~(P2C_RG_SUSPENDM | P2C_FORCE_SUSPENDM); -+ writel(tmp, com + U3P_U2PHYDTM0); -+ - tmp = readl(com + U3D_U2PHYDCR0); - tmp &= ~P2C_RG_SIF_U2PLL_FORCE_ON; - writel(tmp, com + U3D_U2PHYDCR0); diff --git a/target/linux/mediatek/patches-4.14/0191-usb-xhci-allow-imod-interval-to-be-configurable.patch b/target/linux/mediatek/patches-4.14/0191-usb-xhci-allow-imod-interval-to-be-configurable.patch index c48db55d7..ee260d2aa 100644 --- a/target/linux/mediatek/patches-4.14/0191-usb-xhci-allow-imod-interval-to-be-configurable.patch +++ b/target/linux/mediatek/patches-4.14/0191-usb-xhci-allow-imod-interval-to-be-configurable.patch @@ -127,7 +127,7 @@ Signed-off-by: Greg Kroah-Hartman /* Set the HCD state before we enable the irqs */ --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1726,6 +1726,8 @@ struct xhci_hcd { +@@ -1730,6 +1730,8 @@ struct xhci_hcd { u8 max_interrupters; u8 max_ports; u8 isoc_threshold; diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts index c2444936b..bde5eb957 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts @@ -236,3 +236,27 @@ }; /include/ "fsl/p1010si-post.dtsi" + +/* + * The TL-WDR4900 v1 uses the NXP (Freescale) P1014 SoC which is closely + * related to the P1010. + * + * NXP QP1010FS.pdf "QorIQ P1010 and P1014 Communications Processors" + * datasheet states that the P1014 does not include the accelerated crypto + * module (CAAM/SEC4) which is present in the P1010. + * + * NXP Appliation Note AN4938 Rev. 2 implies that some P1014 may contain the + * SEC4 module, but states that SoCs with System Version Register values + * 0x80F10110 or 0x80F10120 do not have the security feature. + * + * All v1.3 TL-WDR4900 tested have SVR == 0x80F10110 which AN4938 describes + * as: core rev 1.0, "P1014 (without security)". + * + * The SVR value is reported by uboot on the serial console. + */ + +/ { + soc: soc@ffe00000 { + /delete-node/ crypto@30000; /* Pulled in by p1010si-post */ + }; +}; diff --git a/target/linux/mvebu/base-files/etc/board.d/02_network b/target/linux/mvebu/base-files/etc/board.d/02_network index 2c1015492..66d35dda7 100755 --- a/target/linux/mvebu/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/base-files/etc/board.d/02_network @@ -46,18 +46,9 @@ armada-xp-gp) globalscale,espressobin) ucidef_set_interfaces_lan_wan "lan0 lan1" "wan" ;; -marvell,armada-3720-db) - ucidef_set_interfaces_lan_wan "eth1" "eth0" - ;; marvell,armada8040-mcbin) ucidef_set_interfaces_lan_wan "eth0 eth1 eth3" "eth2" ;; -marvell,armada8040-db) - ucidef_set_interfaces_lan_wan "eth0 eth2 eth3" "eth1" - ;; -marvell,armada7040-db) - ucidef_set_interfaces_lan_wan "eth0 eth2" "eth1" - ;; *) ucidef_set_interface_lan "eth0" ;; diff --git a/target/linux/mvebu/base-files/lib/mvebu.sh b/target/linux/mvebu/base-files/lib/mvebu.sh index 5a0d7b293..33ac83239 100755 --- a/target/linux/mvebu/base-files/lib/mvebu.sh +++ b/target/linux/mvebu/base-files/lib/mvebu.sh @@ -20,18 +20,9 @@ mvebu_board_detect() { *"Globalscale Marvell ESPRESSOBin Board") name="globalscale,espressobin" ;; - *"Marvell Armada 3720 Development Board DB-88F3720-DDR3") - name="marvell,armada-3720-db" - ;; *"Marvell 8040 MACHIATOBin") name="marvell,armada8040-mcbin" ;; - *"Marvell Armada 8040 DB board") - name="marvell,armada8040-db" - ;; - *"Marvell Armada 7040 DB board") - name="marvell,armada7040-db" - ;; *"Globalscale Mirabox") name="mirabox" ;; diff --git a/target/linux/mvebu/config-4.14 b/target/linux/mvebu/config-4.14 index 694ecdfb8..aa6b0104b 100644 --- a/target/linux/mvebu/config-4.14 +++ b/target/linux/mvebu/config-4.14 @@ -422,6 +422,7 @@ CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_SATA_AHCI_PLATFORM=y CONFIG_SATA_MV=y +CONFIG_SATA_PMP=y # CONFIG_SCHED_INFO is not set CONFIG_SCSI=y CONFIG_SENSORS_PWM_FAN=y diff --git a/target/linux/mvebu/cortexa53/config-default b/target/linux/mvebu/cortexa53/config-default index 4c0ced320..b631c30f5 100644 --- a/target/linux/mvebu/cortexa53/config-default +++ b/target/linux/mvebu/cortexa53/config-default @@ -36,6 +36,7 @@ CONFIG_ARM64_PAGE_SHIFT=12 # CONFIG_ARM64_PTDUMP_CORE is not set # CONFIG_ARM64_PTDUMP_DEBUGFS is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_ARM64_SSBD=y # CONFIG_ARM64_SW_TTBR0_PAN is not set # CONFIG_ARM64_UAO is not set CONFIG_ARM64_VA_BITS=39 diff --git a/target/linux/mvebu/cortexa72/config-default b/target/linux/mvebu/cortexa72/config-default index 3c2b2b044..50b8d21c3 100644 --- a/target/linux/mvebu/cortexa72/config-default +++ b/target/linux/mvebu/cortexa72/config-default @@ -36,6 +36,7 @@ CONFIG_ARM64_PAGE_SHIFT=12 # CONFIG_ARM64_PTDUMP_CORE is not set # CONFIG_ARM64_PTDUMP_DEBUGFS is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_ARM64_SSBD=y # CONFIG_ARM64_SW_TTBR0_PAN is not set # CONFIG_ARM64_UAO is not set CONFIG_ARM64_VA_BITS=39 diff --git a/target/linux/mvebu/image/armada-3720-db.bootscript b/target/linux/mvebu/image/armada-3720-db.bootscript deleted file mode 100644 index 65e39a1af..000000000 --- a/target/linux/mvebu/image/armada-3720-db.bootscript +++ /dev/null @@ -1,10 +0,0 @@ -setenv bootargs "root=PARTUUID=@ROOT@-02 rw rootwait" - -if test -n "${console}"; then - setenv bootargs "${bootargs} ${console}" -fi - -load mmc 0:1 ${fdt_addr} armada-3720-db.dtb -load mmc 0:1 ${kernel_addr} Image - -booti ${kernel_addr} - ${fdt_addr} diff --git a/target/linux/mvebu/image/cortex-a53.mk b/target/linux/mvebu/image/cortex-a53.mk index 89c336344..711d2c0be 100644 --- a/target/linux/mvebu/image/cortex-a53.mk +++ b/target/linux/mvebu/image/cortex-a53.mk @@ -13,17 +13,4 @@ define Device/globalscale-espressobin endef TARGET_DEVICES += globalscale-espressobin -define Device/armada-3720-db - KERNEL_NAME := Image - KERNEL := kernel-bin - DEVICE_TITLE := Marvell Armada 3720 Development Board DB-88F3720-DDR3 - DEVICE_PACKAGES := e2fsprogs ethtool mkf2fs kmod-fs-vfat kmod-usb2 kmod-usb3 kmod-usb-storage - IMAGES := sdcard.img.gz - IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata - DEVICE_DTS := armada-3720-db - DTS_DIR := $(DTS_DIR)/marvell - SUPPORTED_DEVICES := marvell,armada-3720-db -endef -TARGET_DEVICES += armada-3720-db - endif diff --git a/target/linux/mvebu/image/cortex-a72.mk b/target/linux/mvebu/image/cortex-a72.mk index ac5b80233..ac9cb50a8 100644 --- a/target/linux/mvebu/image/cortex-a72.mk +++ b/target/linux/mvebu/image/cortex-a72.mk @@ -13,30 +13,4 @@ define Device/armada-macchiatobin endef TARGET_DEVICES += armada-macchiatobin -define Device/armada-8040-db - KERNEL_NAME := Image - KERNEL := kernel-bin - DEVICE_TITLE := Marvell Armada 8040 DB board - DEVICE_PACKAGES := e2fsprogs ethtool mkf2fs kmod-fs-vfat kmod-mmc - IMAGES := sdcard.img.gz - IMAGE/sdcard.img.gz := boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata - DEVICE_DTS := armada-8040-db - DTS_DIR := $(DTS_DIR)/marvell - SUPPORTED_DEVICES := marvell,armada8040-db -endef -TARGET_DEVICES += armada-8040-db - -define Device/armada-7040-db - KERNEL_NAME := Image - KERNEL := kernel-bin - DEVICE_TITLE := Marvell Armada 7040 DB board - DEVICE_PACKAGES := e2fsprogs ethtool mkf2fs kmod-fs-vfat kmod-mmc - IMAGES := sdcard.img.gz - IMAGE/sdcard.img.gz := boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata - DEVICE_DTS := armada-7040-db - DTS_DIR := $(DTS_DIR)/marvell - SUPPORTED_DEVICES := marvell,armada7040-db -endef -TARGET_DEVICES += armada-7040-db - endif diff --git a/target/linux/mvebu/patches-4.14/408-sfp-move-module-eeprom-ethtool-access-into-netdev-co.patch b/target/linux/mvebu/patches-4.14/408-sfp-move-module-eeprom-ethtool-access-into-netdev-co.patch index 3012fae3d..51b6a62ce 100644 --- a/target/linux/mvebu/patches-4.14/408-sfp-move-module-eeprom-ethtool-access-into-netdev-co.patch +++ b/target/linux/mvebu/patches-4.14/408-sfp-move-module-eeprom-ethtool-access-into-netdev-co.patch @@ -49,7 +49,7 @@ Signed-off-by: Russell King }; --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1040,34 +1040,6 @@ int phylink_ethtool_set_pauseparam(struc +@@ -1042,34 +1042,6 @@ int phylink_ethtool_set_pauseparam(struc } EXPORT_SYMBOL_GPL(phylink_ethtool_set_pauseparam); diff --git a/target/linux/mvebu/patches-4.14/409-sfp-use-netdev-sfp_bus-for-start-stop.patch b/target/linux/mvebu/patches-4.14/409-sfp-use-netdev-sfp_bus-for-start-stop.patch index 7023b57a5..d0b4480f3 100644 --- a/target/linux/mvebu/patches-4.14/409-sfp-use-netdev-sfp_bus-for-start-stop.patch +++ b/target/linux/mvebu/patches-4.14/409-sfp-use-netdev-sfp_bus-for-start-stop.patch @@ -10,7 +10,7 @@ Signed-off-by: Russell King --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -755,8 +755,8 @@ void phylink_start(struct phylink *pl) +@@ -757,8 +757,8 @@ void phylink_start(struct phylink *pl) clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); phylink_run_resolve(pl); @@ -21,7 +21,7 @@ Signed-off-by: Russell King if (pl->phydev) phy_start(pl->phydev); } -@@ -768,8 +768,8 @@ void phylink_stop(struct phylink *pl) +@@ -770,8 +770,8 @@ void phylink_stop(struct phylink *pl) if (pl->phydev) phy_stop(pl->phydev); diff --git a/target/linux/mvebu/patches-4.14/508-cpufreq-armada-37xx-Fix-clock-leak.patch b/target/linux/mvebu/patches-4.14/508-cpufreq-armada-37xx-Fix-clock-leak.patch new file mode 100644 index 000000000..7479c6db2 --- /dev/null +++ b/target/linux/mvebu/patches-4.14/508-cpufreq-armada-37xx-Fix-clock-leak.patch @@ -0,0 +1,35 @@ +From bbcc328561040292f7d6796954d478e4a2335e6f Mon Sep 17 00:00:00 2001 +From: Gregory CLEMENT +Date: Wed, 4 Apr 2018 16:44:44 +0200 +Subject: [PATCH] cpufreq: armada-37xx: Fix clock leak + +There was no clk_put() balancing the clk_get(). This commit fixes it. + +Fixes: 92ce45fb875d (cpufreq: Add DVFS support for Armada 37xx) +Cc: 4.16+ # 4.16+ +Reported-by: Thomas Petazzoni +Signed-off-by: Gregory CLEMENT +Acked-by: Viresh Kumar +Signed-off-by: Rafael J. Wysocki +--- + drivers/cpufreq/armada-37xx-cpufreq.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/cpufreq/armada-37xx-cpufreq.c ++++ b/drivers/cpufreq/armada-37xx-cpufreq.c +@@ -202,6 +202,7 @@ static int __init armada37xx_cpufreq_dri + cur_frequency = clk_get_rate(clk); + if (!cur_frequency) { + dev_err(cpu_dev, "Failed to get clock rate for CPU\n"); ++ clk_put(clk); + return -EINVAL; + } + +@@ -210,6 +211,7 @@ static int __init armada37xx_cpufreq_dri + return -EINVAL; + + armada37xx_cpufreq_dvfs_setup(nb_pm_base, clk, dvfs->divider); ++ clk_put(clk); + + for (load_lvl = ARMADA_37XX_DVFS_LOAD_0; load_lvl < LOAD_LEVEL_NR; + load_lvl++) { diff --git a/target/linux/mvebu/patches-4.14/527-PCI-aardvark-allow-to-specify-link-capability.patch b/target/linux/mvebu/patches-4.14/527-PCI-aardvark-allow-to-specify-link-capability.patch new file mode 100644 index 000000000..fb57f4112 --- /dev/null +++ b/target/linux/mvebu/patches-4.14/527-PCI-aardvark-allow-to-specify-link-capability.patch @@ -0,0 +1,43 @@ +From f70b629e488cc3f2a325ac35476f4f7ae502c5d0 Mon Sep 17 00:00:00 2001 +From: Tomasz Maciej Nowak +Date: Thu, 14 Jun 2018 14:24:40 +0200 +Subject: [PATCH 1/2] PCI: aardvark: allow to specify link capability + +Use DT of_pci_get_max_link_speed() facility to allow specifying link +capability. If none or unspecified value is given it falls back to gen2, +which is default for Armada 3700 SoC. + +Signed-off-by: Tomasz Maciej Nowak +--- + drivers/pci/host/pci-aardvark.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/pci/host/pci-aardvark.c ++++ b/drivers/pci/host/pci-aardvark.c +@@ -272,6 +272,8 @@ static void advk_pcie_set_ob_win(struct + + static void advk_pcie_setup_hw(struct advk_pcie *pcie) + { ++ struct device *dev = &pcie->pdev->dev; ++ struct device_node *node = dev->of_node; + u32 reg; + int i; + +@@ -311,10 +313,15 @@ static void advk_pcie_setup_hw(struct ad + PCIE_CORE_CTRL2_TD_ENABLE; + advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG); + +- /* Set GEN2 */ ++ /* Set GEN */ + reg = advk_readl(pcie, PCIE_CORE_CTRL0_REG); + reg &= ~PCIE_GEN_SEL_MSK; +- reg |= SPEED_GEN_2; ++ if (of_pci_get_max_link_speed(node) == 1) ++ reg |= SPEED_GEN_1; ++ else if (of_pci_get_max_link_speed(node) == 3) ++ reg |= SPEED_GEN_3; ++ else ++ reg |= SPEED_GEN_2; + advk_writel(pcie, reg, PCIE_CORE_CTRL0_REG); + + /* Set lane X1 */ diff --git a/target/linux/mvebu/patches-4.14/528-arm64-dts-armada-3720-espressobin-set-max-link-to-ge.patch b/target/linux/mvebu/patches-4.14/528-arm64-dts-armada-3720-espressobin-set-max-link-to-ge.patch new file mode 100644 index 000000000..5ff9b4726 --- /dev/null +++ b/target/linux/mvebu/patches-4.14/528-arm64-dts-armada-3720-espressobin-set-max-link-to-ge.patch @@ -0,0 +1,73 @@ +From 33f8fdcedb01680427328d710594facef7a0092c Mon Sep 17 00:00:00 2001 +From: Tomasz Maciej Nowak +Date: Thu, 14 Jun 2018 14:40:26 +0200 +Subject: [PATCH 2/2] arm64: dts: armada-3720-espressobin: set max link to gen1 + +Since the beginning there's been an issue with initializing the Atheros +based MiniPCIe wireless cards. Here's an example of kerenel log: + + OF: PCI: host bridge /soc/pcie@d0070000 ranges: + OF: PCI: MEM 0xe8000000..0xe8ffffff -> 0xe8000000 + OF: PCI: IO 0xe9000000..0xe900ffff -> 0xe9000000 + advk-pcie d0070000.pcie: link up + advk-pcie d0070000.pcie: PCI host bridge to bus 0000:00 + pci_bus 0000:00: root bus resource [bus 00-ff] + pci_bus 0000:00: root bus resource [mem0xe8000000-0xe8ffffff] + pci_bus 0000:00: root bus resource [io 0x0000-0xffff](bus address [0xe9000000-0xe900ffff]) + pci 0000:00:00.0: BAR 0: assigned [mem0xe8000000-0xe801ffff 64bit] + pci 0000:00:00.0: BAR 6: assigned [mem0xe8020000-0xe802ffff pref] + [...] + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x3c + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x44 + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 + ath9k 0000:00:00.0: enabling device (0000 -> 0002) + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x3c + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0xc + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x40 + ath9k 0000:00:00.0: request_irq failed + advk-pcie d0070000.pcie: Posted PIO Response Status: CA,0xe00 @ 0x4 + ath9k: probe of 0000:00:00.0 failed with error -22 + +The same happens for ath5k cards, while ath10k card didn't appear at +all (not detected): + + OF: PCI: host bridge /soc/pcie@d0070000 ranges: + OF: PCI: MEM 0xe8000000..0xe8ffffff -> 0xe8000000 + OF: PCI: IO 0xe9000000..0xe900ffff -> 0xe9000000 + advk-pcie d0070000.pcie: link never came up + advk-pcie d0070000.pcie: PCI host bridge to bus 0000:00 + pci_bus 0000:00: root bus resource [bus 00-ff] + pci_bus 0000:00: root bus resource [mem0xe8000000-0xe8ffffff] + pci_bus 0000:00: root bus resource [io 0x0000-0xffff](bus address [0xe9000000-0xe900ffff]) + advk-pcie d0070000.pcie: config read/write timed out + +Following the issue on esppressobin.net forum [1] the workaround seems +to be limiting the speed of PCIe bridge to 1st generation. This fixed +the initialisation of all tested Atheros wireless cards. +The patch in the forum thread swaped registers which would limit speed +for all Armada 3700 based boards. The approach in this patch, in +conjunction with "PCI: aardvark: allow to specify link capability" patch +is less invasive, it only touches the affected board. + +For the record, the iwlwifi and mt76 cards were not affected by this +issue. + +1. http://espressobin.net/forums/topic/which-pcie-wlan-cards-are-supported + +Signed-off-by: Tomasz Maciej Nowak +--- + arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts ++++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts +@@ -79,6 +79,8 @@ + /* J9 */ + &pcie0 { + status = "okay"; ++ ++ max-link-speed = <1>; + }; + + /* J6 */ diff --git a/target/linux/mxs/config-4.14 b/target/linux/mxs/config-4.14 index 6e01aea42..43d6a59ba 100644 --- a/target/linux/mxs/config-4.14 +++ b/target/linux/mxs/config-4.14 @@ -27,7 +27,6 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARM=y @@ -89,10 +88,7 @@ CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" # CONFIG_DEBUG_USER is not set CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y -# CONFIG_DMA_NOOP_OPS is not set CONFIG_DMA_OF=y -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y @@ -103,7 +99,6 @@ CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FRAME_POINTER=y CONFIG_FS_MBCACHE=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_BUG=y @@ -290,7 +285,6 @@ CONFIG_STMP_DEVICE=y CONFIG_SWIOTLB=y CONFIG_SWPHY=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y diff --git a/target/linux/octeon/config-4.14 b/target/linux/octeon/config-4.14 index 24cba2b80..b46295afb 100644 --- a/target/linux/octeon/config-4.14 +++ b/target/linux/octeon/config-4.14 @@ -26,7 +26,6 @@ CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y @@ -90,16 +89,12 @@ CONFIG_DEBUG_SPINLOCK=y CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 CONFIG_DETECT_HUNG_TASK=y CONFIG_DMA_COHERENT=y -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set CONFIG_DNOTIFY=y -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y CONFIG_EARLY_PRINTK=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_ENABLE_MUST_CHECK=y -CONFIG_EXPORTFS=y CONFIG_EXT4_FS=y # CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y @@ -110,7 +105,6 @@ CONFIG_FAT_FS=y CONFIG_FIXED_PHY=y CONFIG_FRAME_WARN=2048 CONFIG_FS_MBCACHE=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CPU_AUTOPROBE=y @@ -294,7 +288,6 @@ CONFIG_SYS_SUPPORTS_HUGETLBFS=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y CONFIG_SYS_SUPPORTS_RELOCATABLE=y CONFIG_SYS_SUPPORTS_SMP=y -CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y diff --git a/target/linux/octeontx/base-files/etc/board.d/02_network b/target/linux/octeontx/base-files/etc/board.d/02_network old mode 100644 new mode 100755 diff --git a/target/linux/octeontx/config-4.14 b/target/linux/octeontx/config-4.14 index 6e70c9d32..fd627d6a2 100644 --- a/target/linux/octeontx/config-4.14 +++ b/target/linux/octeontx/config-4.14 @@ -37,7 +37,6 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_THUNDER=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y CONFIG_ARCH_WANT_FRAME_POINTERS=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y @@ -55,6 +54,7 @@ CONFIG_ARM64_PAN=y # CONFIG_ARM64_PTDUMP_CORE is not set # CONFIG_ARM64_PTDUMP_DEBUGFS is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_ARM64_SSBD=y # CONFIG_ARM64_SW_TTBR0_PAN is not set CONFIG_ARM64_UAO=y CONFIG_ARM64_VA_BITS=48 @@ -189,11 +189,8 @@ CONFIG_DEFAULT_NOOP=y CONFIG_DMADEVICES=y CONFIG_DMA_CMA=y CONFIG_DMA_ENGINE=y -# CONFIG_DMA_NOOP_OPS is not set CONFIG_DMA_OF=y CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y CONFIG_DT_IDLE_STATES=y CONFIG_EDAC=y @@ -203,7 +200,6 @@ CONFIG_EDAC_SUPPORT=y CONFIG_EDAC_THUNDERX=y # CONFIG_EDAC_XGENE is not set CONFIG_EEPROM_AT24=y -CONFIG_EXPORTFS=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y # CONFIG_F2FS_CHECK_FS is not set @@ -220,7 +216,6 @@ CONFIG_FRAME_POINTER=y CONFIG_FREEZER=y CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y @@ -253,6 +248,7 @@ CONFIG_GPIO_PCA953X_IRQ=y CONFIG_GPIO_THUNDERX=y # CONFIG_GRO_CELLS is not set CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y @@ -511,8 +507,8 @@ CONFIG_TASK_DELAY_ACCT=y CONFIG_TASK_IO_ACCOUNTING=y CONFIG_TASK_XACCT=y CONFIG_TEE=y -CONFIG_THIN_ARCHIVES=y CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_THUNDER_NIC_BGX=y CONFIG_THUNDER_NIC_PF=y CONFIG_THUNDER_NIC_RGX=y diff --git a/target/linux/omap/config-4.14 b/target/linux/omap/config-4.14 index bfff0a76a..d5f817156 100644 --- a/target/linux/omap/config-4.14 +++ b/target/linux/omap/config-4.14 @@ -223,7 +223,6 @@ CONFIG_DTC=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_EEPROM_93CX6=y -CONFIG_EXPORTFS=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y # CONFIG_EXT3_FS_POSIX_ACL is not set diff --git a/target/linux/omap24xx/Makefile b/target/linux/omap24xx/Makefile deleted file mode 100644 index 5dd5938db..000000000 --- a/target/linux/omap24xx/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (C) 2010-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=arm -BOARD:=omap24xx -BOARDNAME:=TI OMAP24xx -MAINTAINER:=Michael Buesch -FEATURES:=targz squashfs jffs2_nand usb usbgadget display gpio audio broken -CPU_TYPE:=arm1136j-s - -KERNEL_PATCHVER:=4.1 - -KERNELNAME:=zImage dtbs - -define Target/Description - TI OMAP-24xx -endef - -include $(INCLUDE_DIR)/target.mk - -$(eval $(call BuildTarget)) diff --git a/target/linux/omap24xx/base-files/etc/config/fstab b/target/linux/omap24xx/base-files/etc/config/fstab deleted file mode 100644 index 0910277b2..000000000 --- a/target/linux/omap24xx/base-files/etc/config/fstab +++ /dev/null @@ -1,13 +0,0 @@ -config mount - option target /maemo/initfs - option device /dev/mtdblock3 - option fstype jffs2 - option options rw,noatime - option enabled 0 - -config mount - option target /maemo/rootfs - option device /dev/mtdblock4 - option fstype jffs2 - option options rw,noatime - option enabled 0 diff --git a/target/linux/omap24xx/base-files/etc/config/network b/target/linux/omap24xx/base-files/etc/config/network deleted file mode 100644 index 8207443f3..000000000 --- a/target/linux/omap24xx/base-files/etc/config/network +++ /dev/null @@ -1,15 +0,0 @@ -config interface loopback - option ifname lo - option proto static - option netmask 255.0.0.0 - -config interface lan - option proto dhcp - option netmask 255.255.255.0 - -config interface usb - option ifname usb0 - option proto static - option ipaddr 192.168.168.168 - option netmask 255.255.255.0 - option ip6addr fe80::810:1 diff --git a/target/linux/omap24xx/base-files/etc/config/wireless b/target/linux/omap24xx/base-files/etc/config/wireless deleted file mode 100644 index b640ce6c2..000000000 --- a/target/linux/omap24xx/base-files/etc/config/wireless +++ /dev/null @@ -1,20 +0,0 @@ -config wifi-device radio0 - option type mac80211 - option phy phy0 - option channel auto - # TODO: CHANGE THE MAC-ADDRESS: - option macaddr 00:11:22:33:44:55 - option hwmode 11g -# option country DE - - # REMOVE THIS LINE TO ENABLE WIFI: - option disabled 1 - -config wifi-iface - option device radio0 - option powersave 1 - option network lan - option mode sta - option ssid OpenWrt -# option encryption psk2 -# option key "foobar" diff --git a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image b/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image deleted file mode 100644 index 26d367d3c..000000000 --- a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/10-bme-pmm-image +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -n810_cal_bme_pmm_extract() { - [ -x /usr/bin/calvaria ] && { - /usr/bin/calvaria -p -n bme -i last /dev/mtdblock1 >/lib/firmware/n810-cal-bme-pmm.fw ||\ - echo "CAL-BME extract: Failed to extract blob" - } -} - -. /lib/functions.sh - -[ "$FIRMWARE" = "n810-cal-bme-pmm.fw" ] && { - [ "$(board_name)" != "nokia,n810" ] || { - [ -e /lib/firmware/n810-cal-bme-pmm.fw ] ||\ - n810_cal_bme_pmm_extract - } -} diff --git a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom b/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom deleted file mode 100644 index c53574723..000000000 --- a/target/linux/omap24xx/base-files/etc/hotplug.d/firmware/20-p54spi-eeprom +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -p54spi_eeprom_clean() { - rm -f /tmp/wlan-iq-align /tmp/wlan-tx-gen2 -} - -p54spi_eeprom_die() { - echo "$*" - p54spi_eeprom_clean - exit 1 -} - -p54spi_eeprom_extract() { - [ -x /usr/bin/calvaria -a -x /usr/bin/cal2p54 ] && { - /usr/bin/calvaria -p -n wlan-iq-align -i last /dev/mtdblock1 >/tmp/wlan-iq-align ||\ - p54spi_eeprom_die "p54spi EEPROM: Failed to extract wlan-iq-align" - /usr/bin/calvaria -p -n wlan-tx-gen2 -i last /dev/mtdblock1 >/tmp/wlan-tx-gen2 ||\ - p54spi_eeprom_die "p54spi EEPROM: Failed to extract wlan-tx-gen2" - /usr/bin/cal2p54 /tmp/wlan-tx-gen2 /tmp/wlan-iq-align >/lib/firmware/3826.eeprom ||\ - p54spi_eeprom_die "p54spi EEPROM: Failed to generate EEPROM" - p54spi_eeprom_clean - } -} - -. /lib/functions.sh - -[ "$FIRMWARE" = "3826.eeprom" ] && { - [ "$(board_name)" != "nokia,n810" ] || { - [ -e /lib/firmware/3826.eeprom ] ||\ - p54spi_eeprom_extract - } -} diff --git a/target/linux/omap24xx/base-files/etc/init.d/watchdog b/target/linux/omap24xx/base-files/etc/init.d/watchdog deleted file mode 100755 index 0d042c64e..000000000 --- a/target/linux/omap24xx/base-files/etc/init.d/watchdog +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008-2010 OpenWrt.org - -START=25 - -start() { - [ -c /dev/watchdog -a -x /sbin/watchdog ] || { - echo "WARNING: Watchdog not available. System will reboot soon!" - return 1 - } - /sbin/watchdog -T 63 -t 50 /dev/watchdog - [ -x /usr/bin/schedtool ] && /usr/bin/schedtool -R -p 60 -n -20 $(pidof watchdog) -} - -stop() { - killall -q watchdog -} diff --git a/target/linux/omap24xx/base-files/etc/inittab b/target/linux/omap24xx/base-files/etc/inittab deleted file mode 100644 index 192115826..000000000 --- a/target/linux/omap24xx/base-files/etc/inittab +++ /dev/null @@ -1,5 +0,0 @@ -::sysinit:/etc/init.d/rcS S boot -::shutdown:/etc/init.d/rcS K shutdown -tts/0::askfirst:/usr/libexec/login.sh -ttyO2::askfirst:/usr/libexec/login.sh -tty1::askfirst:/usr/libexec/login.sh diff --git a/target/linux/omap24xx/base-files/etc/pointercal b/target/linux/omap24xx/base-files/etc/pointercal deleted file mode 100644 index eba5ab6aa..000000000 --- a/target/linux/omap24xx/base-files/etc/pointercal +++ /dev/null @@ -1 +0,0 @@ -14706 -12 -3754952 36 -9898 35656000 65536 diff --git a/target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin b/target/linux/omap24xx/base-files/lib/firmware/bc4fw.bin deleted file mode 100644 index b7335db148c1a8dab37c44205f2feb22236764e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2034 zcmZWqZERCz6n@^@?=r@^-FtW2BCM^qWi-T1%06HQbO|wN{NY#}p+qoZVl){>qDF`m zQsIaESWF7)kBLTtq6Uys{77`s{va`$nCM^FT1a&f@!KJRnR zbIy6sX_GgI69RY~#{joa8paBNdiZ+@O#obb00B3xLe2+01a}jx5n#h#qJ?0ALl-jg zCg|5rpw&>UP_=d>@Cu1}iNy55$6`w8;!MQs>Il7f zw<5h21n1J$Ks_O3xAXQX?fkf1azAP@UsOaSRXEoos^#o#nf?@_P_ubacV(<(cEH^{ zSG88{#%tvEWpdjOKf8So-A-k3S^vq7%IriX{D$dO<7HtaA~5Q-|IgV+d0!3xLwmWT z7;W~RShwtm%X4=kE=uzem#^3nSFMdpFhP#LA;&uqV8<6QOpYb|_<<}t+CS8Ot|04$ zFMKoYj=&sLVY=vR2P7G7x0Zi&V8Uu%8)=d}s`O%M5u#gYz&0^?Oax$fgSKV^fs31-VfM zN*u=`=gS#b%?!Fw3yk|1SjWI3#tH_y=7Hy^D!ZsEU0BILH&)Sc8cx7QY{u_c%Bx55 zC+OdX-aQ6`MvT3B0wxl?dJ_L)HLpfcM}}9=@Y6o`Jk@hSSO>cqVE@TRAjZJ29OJOS zgCuMX2~!bg;8RyKS*%zddb+8NfF9JXUiw2BroHW>fs$a#X@^2r;w}Z$NWldP4PEC_ L(oot&=lJtKcoXFJ diff --git a/target/linux/omap24xx/config-4.1 b/target/linux/omap24xx/config-4.1 deleted file mode 100644 index 9daded60c..000000000 --- a/target/linux/omap24xx/config-4.1 +++ /dev/null @@ -1,290 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -# CONFIG_APM_EMULATION is not set -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_ARCH_HAS_BANDGAP=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MULTIPLATFORM=y -# CONFIG_ARCH_MULTI_CPU_AUTO is not set -CONFIG_ARCH_MULTI_V6=y -CONFIG_ARCH_MULTI_V6_V7=y -CONFIG_ARCH_NR_GPIO=0 -CONFIG_ARCH_OMAP=y -CONFIG_ARCH_OMAP2=y -CONFIG_ARCH_OMAP2PLUS=y -CONFIG_ARCH_OMAP2PLUS_TYPICAL=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -# CONFIG_ARCH_WM8750 is not set -CONFIG_ARM=y -CONFIG_ARM_APPENDED_DTB=y -CONFIG_ARM_ATAG_DTB_COMPAT=y -CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND=y -# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER is not set -# CONFIG_ARM_CPU_SUSPEND is not set -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_ARM_L1_CACHE_SHIFT=5 -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_ARM_THUMB=y -CONFIG_ATAGS=y -CONFIG_AUTO_ZRELADDR=y -CONFIG_BINFMT_MISC=y -CONFIG_BOUNCE=y -# CONFIG_CACHE_L2X0 is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_MMIO=y -CONFIG_CLKSRC_OF=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="root=/dev/mmcblk0p1 rootwait rootfstype=ext4,ext3,ext2,squashfs,jffs2 console=tty0 console=ttyO2,115200n8 earlyprintk" -CONFIG_CMDLINE_FORCE=y -CONFIG_COMMON_CLK=y -CONFIG_CPU_32v6=y -CONFIG_CPU_32v6K=y -CONFIG_CPU_ABRT_EV6=y -# CONFIG_CPU_BPREDICT_DISABLE is not set -CONFIG_CPU_CACHE_V6=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -CONFIG_CPU_HAS_ASID=y -# CONFIG_CPU_ICACHE_DISABLE is not set -CONFIG_CPU_PABRT_V6=y -CONFIG_CPU_TLB_V6=y -CONFIG_CPU_V6=y -CONFIG_CPU_V6K=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -# CONFIG_DEBUG_UART_8250 is not set -# CONFIG_DEBUG_USER is not set -# CONFIG_DISPLAY_ENCODER_OPA362 is not set -CONFIG_DTC=y -CONFIG_EXTCON=y -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set -# CONFIG_EXTCON_USB_GPIO is not set -CONFIG_FB=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_CMDLINE=y -CONFIG_FB_OMAP2=y -CONFIG_FB_OMAP2_DEBUG_SUPPORT=y -CONFIG_FB_OMAP2_NUM_FBS=3 -CONFIG_FRAME_POINTER=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_DEVRES=y -CONFIG_GPIO_OMAP=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -# CONFIG_HAVE_ARCH_BITREVERSE is not set -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_BPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HDMI=y -CONFIG_HIGHMEM=y -# CONFIG_HIGHPTE is not set -CONFIG_HZ_FIXED=0 -CONFIG_HZ_PERIODIC=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_OMAP=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y -CONFIG_INPUT_RETU_PWRBUTTON=y -CONFIG_IOMMU_HELPER=y -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_LIBFDT=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MACH_NOKIA_N810=y -CONFIG_MACH_NOKIA_N810_WIMAX=y -CONFIG_MACH_NOKIA_N8X0=y -CONFIG_MACH_OMAP2_TUSB6010=y -CONFIG_MACH_OMAP_GENERIC=y -CONFIG_MEMORY=y -CONFIG_MENELAUS=y -CONFIG_MFD_CORE=y -CONFIG_MFD_RETU=y -CONFIG_MFD_SYSCON=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MULTI_IRQ_HANDLER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NLS=y -CONFIG_NO_BOOTMEM=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_MTD=y -CONFIG_OF_NET=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OMAP2_DSS=y -CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS=y -CONFIG_OMAP2_DSS_DEBUG=y -CONFIG_OMAP2_DSS_DEBUGFS=y -# CONFIG_OMAP2_DSS_DPI is not set -# CONFIG_OMAP2_DSS_DSI is not set -CONFIG_OMAP2_DSS_INIT=y -CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK=0 -CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET=y -# CONFIG_OMAP2_DSS_VENC is not set -CONFIG_OMAP2_VRFB=y -# CONFIG_OMAP4_DSS_HDMI is not set -# CONFIG_OMAP5_DSS_HDMI is not set -CONFIG_OMAP_32K_TIMER=y -# CONFIG_OMAP_CONTROL_PHY is not set -CONFIG_OMAP_DM_TIMER=y -CONFIG_OMAP_GPMC=y -# CONFIG_OMAP_INTERCONNECT is not set -CONFIG_OMAP_IRQCHIP=y -CONFIG_OMAP_MUX=y -# CONFIG_OMAP_MUX_DEBUG is not set -CONFIG_OMAP_MUX_WARNINGS=y -CONFIG_OMAP_PM_NOOP=y -# CONFIG_OMAP_RESET_CLOCKS is not set -# CONFIG_OMAP_WATCHDOG is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PCI is not set -# CONFIG_PCI_DOMAINS_GENERIC is not set -# CONFIG_PCI_SYSCALL is not set -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -# CONFIG_PHY_DM816X_USB is not set -CONFIG_PINCTRL=y -CONFIG_PM=y -CONFIG_PM_CLK=y -# CONFIG_PM_DEBUG is not set -# CONFIG_RCU_STALL_COMMON is not set -CONFIG_REGMAP=y -CONFIG_REGMAP_IRQ=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGULATOR=y -# CONFIG_REGULATOR_PBIAS is not set -CONFIG_RETU_WATCHDOG=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_SCHED_HRTICK=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SERIAL_8250_OMAP is not set -# CONFIG_SERIAL_OMAP is not set -CONFIG_SOC_BUS=y -CONFIG_SOC_HAS_OMAP2_SDRC=y -CONFIG_SOC_OMAP2420=y -# CONFIG_SOC_OMAP2430 is not set -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -CONFIG_SPI_MASTER=y -# CONFIG_SPI_OMAP24XX is not set -CONFIG_SRCU=y -CONFIG_SWIOTLB=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TAHVO_USB=y -# CONFIG_TAHVO_USB_HOST_BY_DEFAULT is not set -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_TI_EMIF is not set -CONFIG_TI_PRIV_EDMA=y -CONFIG_UID16=y -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_USB=y -CONFIG_USB_COMMON=y -# CONFIG_USB_EHCI_HCD is not set -CONFIG_USB_MON=y -CONFIG_USB_OTG=y -CONFIG_USB_OTG_FSM=y -CONFIG_USB_PHY=y -CONFIG_USB_SUPPORT=y -CONFIG_USE_OF=y -CONFIG_VECTORS_BASE=0xffff0000 -CONFIG_VFP=y -CONFIG_VIDEOMODE_HELPERS=y -CONFIG_WATCHDOG_CORE=y -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/omap24xx/image/Makefile b/target/linux/omap24xx/image/Makefile deleted file mode 100644 index 316cce0f9..000000000 --- a/target/linux/omap24xx/image/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (C) 2010-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -NAND_BLOCKSIZE=2048-128k - -define Image/BuildKernel - cat $(KDIR)/zImage $(DTS_DIR)/omap2420-n810.dtb > $(BIN_DIR)/$(IMG_PREFIX)-zImage - chmod 0644 $(BIN_DIR)/$(IMG_PREFIX)-zImage -endef - -define Image/Build/squashfs - $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)) -endef - -define Image/Build - $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) - $(call Image/Build/$(1),$(1)) -endef - - -$(eval $(call BuildImage)) diff --git a/target/linux/omap24xx/modules.mk b/target/linux/omap24xx/modules.mk deleted file mode 100644 index 6b7e85d79..000000000 --- a/target/linux/omap24xx/modules.mk +++ /dev/null @@ -1,83 +0,0 @@ -# -# Copyright (C) 2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define KernelPackage/sound-soc-omap - TITLE:=OMAP SoC sound support - KCONFIG:= \ - CONFIG_SND_OMAP_SOC - FILES:=$(LINUX_DIR)/sound/soc/omap/snd-soc-omap.ko - AUTOLOAD:=$(call AutoLoad,60,snd-soc-omap) - DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-core - $(call AddDepends/sound) -endef - -$(eval $(call KernelPackage,sound-soc-omap)) - - -define KernelPackage/sound-soc-omap-mcbsp - TITLE:=OMAP SoC MCBSP support - KCONFIG:= \ - CONFIG_SND_OMAP_SOC_MCBSP - FILES:=$(LINUX_DIR)/sound/soc/omap/snd-soc-omap-mcbsp.ko - AUTOLOAD:=$(call AutoLoad,61,snd-soc-omap-mcbsp) - DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-omap - $(call AddDepends/sound) -endef - -$(eval $(call KernelPackage,sound-soc-omap-mcbsp)) - - -define KernelPackage/sound-soc-n810 - TITLE:=Nokia n810 SoC sound support - KCONFIG:= \ - CONFIG_SND_OMAP_SOC_N810 - FILES:= \ - $(LINUX_DIR)/sound/soc/codecs/snd-soc-tlv320aic3x.ko \ - $(LINUX_DIR)/sound/soc/omap/snd-soc-n810.ko - AUTOLOAD:=$(call AutoLoad,65,snd-soc-tlv320aic3x snd-soc-n810) - DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-omap +kmod-sound-soc-omap-mcbsp - $(call AddDepends/sound) -endef - -$(eval $(call KernelPackage,sound-soc-n810)) - - -define KernelPackage/n810bm - SUBMENU:=$(OTHER_MENU) - TITLE:=Nokia N810 battery management driver - DEPENDS:=@TARGET_omap24xx - KCONFIG:=CONFIG_N810BM - FILES:=$(LINUX_DIR)/drivers/cbus/n810bm.ko - AUTOLOAD:=$(call AutoLoad,01,n810bm) -endef - -define KernelPackage/n810bm/description - Nokia N810 battery management driver. - Controls battery power management and battery charging. -endef - -$(eval $(call KernelPackage,n810bm)) - - -define KernelPackage/usb-tahvo - TITLE:=Support for Tahvo (Nokia n810) USB - KCONFIG:= \ - CONFIG_TAHVO_USB \ - CONFIG_TAHVO_USB_HOST_BY_DEFAULT=n \ - CONFIG_USB_OHCI_HCD_OMAP1=y \ - CONFIG_USB_GADGET_DEBUG_FS=n - DEPENDS:=@TARGET_omap24xx - FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-tahvo.ko - AUTOLOAD:=$(call AutoLoad,45,phy-tahvo) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-tahvo/description - Kernel support for Nokia n810 USB OHCI controller. -endef - -$(eval $(call KernelPackage,usb-tahvo)) diff --git a/target/linux/omap24xx/profiles/100-n810.mk b/target/linux/omap24xx/profiles/100-n810.mk deleted file mode 100644 index bf2598c61..000000000 --- a/target/linux/omap24xx/profiles/100-n810.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2010-2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/n810-base - NAME:=Nokia n810 (base) - PACKAGES:= \ - block-mount \ - gpsd \ - ip iw kmod-p54-spi wpa-supplicant \ - dnsmasq dropbear \ - pwrtray-backend \ - kmod-fs-vfat kmod-fs-msdos \ - kmod-input-evdev \ - kmod-leds-gpio \ - kmod-usb-tahvo kmod-usb-gadget-eth \ - kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-pegasus kmod-usb-net-rndis \ - kmod-usb-storage kmod-usb-hid \ - kmod-bluetooth kmod-bluetooth-hci-h4p bluez-utils bluez-hcidump \ - kmod-n810bm maemo-kexec calvaria \ - schedtool -endef - -define Profile/n810-base/Description - Minimal package set for Nokia n810 hardware. -endef -$(eval $(call Profile,n810-base)) - diff --git a/target/linux/omap24xx/profiles/110-n810-gui.mk b/target/linux/omap24xx/profiles/110-n810-gui.mk deleted file mode 100644 index 9c3c5d025..000000000 --- a/target/linux/omap24xx/profiles/110-n810-gui.mk +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define Profile/n810-gui - $(call Profile/n810-base) - NAME:=Nokia n810 (GUI) - PACKAGES+= \ - xserver-xorg xinit xauth xkeyboard-config xkbdata xterm \ - xf86-video-omapfb xf86-input-tslib xf86-input-evdev \ - openbox tint2 matchbox-keyboard \ - pwrtray -endef - -define Profile/n810-gui/Description - Graphical user interface package set for Nokia n810 hardware. -endef -$(eval $(call Profile,n810-gui)) - diff --git a/target/linux/oxnas/patches-4.14/999-libata-hacks.patch b/target/linux/oxnas/patches-4.14/999-libata-hacks.patch index 6d0f23140..e490dbf7c 100644 --- a/target/linux/oxnas/patches-4.14/999-libata-hacks.patch +++ b/target/linux/oxnas/patches-4.14/999-libata-hacks.patch @@ -36,7 +36,7 @@ --- a/include/linux/libata.h +++ b/include/linux/libata.h -@@ -918,6 +918,8 @@ struct ata_port_operations { +@@ -919,6 +919,8 @@ struct ata_port_operations { void (*qc_prep)(struct ata_queued_cmd *qc); unsigned int (*qc_issue)(struct ata_queued_cmd *qc); bool (*qc_fill_rtf)(struct ata_queued_cmd *qc); @@ -45,7 +45,7 @@ /* * Configuration and exception handling -@@ -1008,6 +1010,9 @@ struct ata_port_operations { +@@ -1009,6 +1011,9 @@ struct ata_port_operations { void (*phy_reset)(struct ata_port *ap); void (*eng_timeout)(struct ata_port *ap); diff --git a/target/linux/pistachio/config-4.14 b/target/linux/pistachio/config-4.14 index 4c5cd579b..bcb9ff468 100644 --- a/target/linux/pistachio/config-4.14 +++ b/target/linux/pistachio/config-4.14 @@ -18,7 +18,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y @@ -80,24 +79,19 @@ CONFIG_CSRC_R4K=y CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y CONFIG_DMA_NONCOHERENT=y -# CONFIG_DMA_NOOP_OPS is not set CONFIG_DMA_OF=y CONFIG_DMA_VIRTUAL_CHANNELS=y -# CONFIG_DMA_VIRT_OPS is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y # CONFIG_DWMAC_DWC_QOS_ETH is not set CONFIG_DWMAC_GENERIC=y CONFIG_EARLY_PRINTK=y CONFIG_EARLY_PRINTK_8250=y -CONFIG_EXPORTFS=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_FIXED_PHY=y CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -328,7 +322,6 @@ CONFIG_SYS_SUPPORTS_RELOCATABLE=y CONFIG_SYS_SUPPORTS_SCHED_SMT=y CONFIG_SYS_SUPPORTS_SMP=y CONFIG_SYS_SUPPORTS_ZBOOT=y -CONFIG_THIN_ARCHIVES=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y CONFIG_TIMER_PROBE=y diff --git a/target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch index 60474ceae..eeb1e4dee 100644 --- a/target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-4.14/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -2651,6 +2651,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -2650,6 +2650,7 @@ int spi_nor_scan(struct spi_nor *nor, co struct device *dev = nor->dev; struct mtd_info *mtd = &nor->mtd; struct device_node *np = spi_nor_get_flash_node(nor); @@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma int ret; int i; -@@ -2726,7 +2727,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -2725,7 +2726,12 @@ int spi_nor_scan(struct spi_nor *nor, co spi_nor_wait_till_ready(nor); } diff --git a/target/linux/ppc40x/Makefile b/target/linux/ppc40x/Makefile deleted file mode 100644 index 3529bb3db..000000000 --- a/target/linux/ppc40x/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (C) 2008-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=powerpc -BOARD:=ppc40x -BOARDNAME:=AMCC/IBM PPC40x -FEATURES:=squashfs broken -CPU_TYPE:=405 -MAINTAINER:=Imre Kaloz - -KERNEL_PATCHVER:=3.18 - -define Target/Description - Build firmware images for AMCC/IBM PPC40x based boards. -endef - -include $(INCLUDE_DIR)/target.mk - -KERNELNAME:=uImage cuImage.magicbox cuImage.openrb - -$(eval $(call BuildTarget)) diff --git a/target/linux/ppc40x/base-files/lib/preinit/01_sysinfo b/target/linux/ppc40x/base-files/lib/preinit/01_sysinfo deleted file mode 100644 index 9f82c84b2..000000000 --- a/target/linux/ppc40x/base-files/lib/preinit/01_sysinfo +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -do_sysinfo_ppc40x() { - local name="$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)" - [ -z "$name" ] && name="unknown" - - [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" - echo "$name" > /tmp/sysinfo/board_name - echo "unknown" > /tmp/sysinfo/model -} - -boot_hook_add preinit_main do_sysinfo_ppc40x diff --git a/target/linux/ppc40x/base-files/lib/upgrade/platform.sh b/target/linux/ppc40x/base-files/lib/upgrade/platform.sh deleted file mode 100644 index 222a25a5c..000000000 --- a/target/linux/ppc40x/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# - -PART_NAME=firmware - -platform_check_image() { - local board=$(board_name) - local magic="$(get_magic_word "$1")" - - [ "$#" -gt 1 ] && return 1 - - case "$board" in - kilauea | openrb | magicbox) - [ "$magic" != "2705" ] && { - echo "Invalid image type." - return 1 - } - return 0 - ;; - esac - - echo "Sysupgrade is not yet supported on $board." - return 1 -} - -platform_do_upgrade() { - local board=$(board_name) - - case "$board" in - *) - default_do_upgrade "$ARGV" - ;; - esac -} diff --git a/target/linux/ppc40x/config-3.18 b/target/linux/ppc40x/config-3.18 deleted file mode 100644 index 85bbe0cb9..000000000 --- a/target/linux/ppc40x/config-3.18 +++ /dev/null @@ -1,236 +0,0 @@ -CONFIG_405EX=y -CONFIG_40x=y -# CONFIG_44x is not set -CONFIG_4xx=y -CONFIG_4xx_SOC=y -# CONFIG_ACADIA is not set -# CONFIG_ADVANCED_OPTIONS is not set -CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y -CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_ARCH_HAS_ILOG2_U32=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_ARCH_HAS_WALK_MEMORY=y -CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -# CONFIG_ARCH_RANDOM is not set -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_AUDIT_ARCH=y -CONFIG_BOOKE_WDT=y -CONFIG_BOUNCE=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd" -CONFIG_CMDLINE_BOOL=y -CONFIG_CONSISTENT_SIZE=0x00200000 -CONFIG_CPU_BIG_ENDIAN=y -# CONFIG_CPU_LITTLE_ENDIAN is not set -# CONFIG_CRYPTO_SHA1_PPC is not set -# CONFIG_DEFAULT_UIMAGE is not set -CONFIG_DTC=y -# CONFIG_E200 is not set -CONFIG_EARLY_PRINTK=y -# CONFIG_EP405 is not set -# CONFIG_EPAPR_BOOT is not set -CONFIG_EXTRA_TARGETS="uImage" -# CONFIG_FSL_ULI1575 is not set -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_CSUM is not set -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_ISA_DMA=y -CONFIG_GENERIC_NVRAM=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -# CONFIG_GENERIC_TBSYNC is not set -CONFIG_GENERIC_TIME_VSYSCALL_OLD=y -# CONFIG_GEN_RTC is not set -# CONFIG_GE_FPGA is not set -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_GPIO_SYSFS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAS_RAPIDIO is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -# CONFIG_HOTFOOT is not set -CONFIG_HW_RANDOM=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -CONFIG_HZ_PERIODIC=y -CONFIG_IBM_EMAC=y -CONFIG_IBM_EMAC_EMAC4=y -CONFIG_IBM_EMAC_POLL_WEIGHT=32 -CONFIG_IBM_EMAC_RGMII=y -CONFIG_IBM_EMAC_RXB=256 -CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256 -CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0 -CONFIG_IBM_EMAC_TXB=256 -CONFIG_INITRAMFS_SOURCE="" -# CONFIG_IOMMU_HELPER is not set -# CONFIG_IPIC is not set -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_ISA_DMA_API=y -CONFIG_KERNEL_START=0xc0000000 -CONFIG_KILAUEA=y -CONFIG_LIBFDT=y -CONFIG_LOWMEM_SIZE=0x30000000 -CONFIG_MAGICBOX=y -# CONFIG_MAKALU is not set -# CONFIG_MATH_EMULATION is not set -# CONFIG_MMIO_NVRAM is not set -CONFIG_MODULES_USE_ELF_RELA=y -# CONFIG_MPIC is not set -# CONFIG_MPIC_U3_HT_IRQS is not set -# CONFIG_MPIC_WEIRD is not set -CONFIG_MTD_CFI_ADV_OPTIONS=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_UIMAGE_FW=y -CONFIG_NEED_DMA_MAP_STATE=y -# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NEED_SG_DMA_LENGTH=y -# CONFIG_NONSTATIC_KERNEL is not set -CONFIG_NOT_COHERENT_CACHE=y -CONFIG_NR_IRQS=512 -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_MTD=y -CONFIG_OF_NET=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND=y -CONFIG_OPENRB=y -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xc0000000 -CONFIG_PCI=y -CONFIG_PCIEAER=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_MSI=y -CONFIG_PHYSICAL_START=0x00000000 -CONFIG_PPC=y -CONFIG_PPC32=y -CONFIG_PPC40x_SIMPLE=y -# CONFIG_PPC4xx_HSTA_MSI is not set -CONFIG_PPC4xx_MSI=y -# CONFIG_PPC4xx_OCM is not set -CONFIG_PPC4xx_PCI_EXPRESS=y -# CONFIG_PPC64 is not set -# CONFIG_PPC_85xx is not set -# CONFIG_PPC_8xx is not set -# CONFIG_PPC_970_NAP is not set -CONFIG_PPC_ADV_DEBUG_DACS=2 -CONFIG_PPC_ADV_DEBUG_DVCS=0 -CONFIG_PPC_ADV_DEBUG_IACS=2 -CONFIG_PPC_ADV_DEBUG_REGS=y -# CONFIG_PPC_BOOK3S_32 is not set -# CONFIG_PPC_CELL is not set -# CONFIG_PPC_CELL_NATIVE is not set -# CONFIG_PPC_COPRO_BASE is not set -CONFIG_PPC_DCR=y -# CONFIG_PPC_DCR_MMIO is not set -CONFIG_PPC_DCR_NATIVE=y -# CONFIG_PPC_DOORBELL is not set -# CONFIG_PPC_EARLY_DEBUG is not set -# CONFIG_PPC_EPAPR_HV_PIC is not set -# CONFIG_PPC_I8259 is not set -# CONFIG_PPC_ICP_HV is not set -# CONFIG_PPC_ICP_NATIVE is not set -# CONFIG_PPC_ICS_RTAS is not set -CONFIG_PPC_INDIRECT_PCI=y -CONFIG_PPC_MMU_NOHASH=y -# CONFIG_PPC_MM_SLICES is not set -# CONFIG_PPC_MPC106 is not set -CONFIG_PPC_MSI_BITMAP=y -CONFIG_PPC_OF=y -# CONFIG_PPC_P7_NAP is not set -CONFIG_PPC_PCI_CHOICE=y -# CONFIG_PPC_RTAS is not set -CONFIG_PPC_UDBG_16550=y -CONFIG_PPC_WERROR=y -# CONFIG_PPC_XICS is not set -# CONFIG_PQ2ADS is not set -# CONFIG_PREEMPT_RCU is not set -CONFIG_RAS=y -# CONFIG_RCU_STALL_COMMON is not set -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_SCHED_HRTICK=y -# CONFIG_SCSI_DMA is not set -CONFIG_SERIAL_8250_EXTENDED=y -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SERIAL_OF_PLATFORM=y -# CONFIG_SLAB is not set -CONFIG_SLUB=y -CONFIG_SPARSE_IRQ=y -# CONFIG_SWIOTLB is not set -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_TASK_SIZE=0xc0000000 -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_USB_SUPPORT=y -# CONFIG_WALNUT is not set -CONFIG_WORD_SIZE=32 -# CONFIG_XILINX_SYSACE is not set -# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set -CONFIG_XZ_DEC_BCJ=y -CONFIG_XZ_DEC_POWERPC=y diff --git a/target/linux/ppc40x/image/Makefile b/target/linux/ppc40x/image/Makefile deleted file mode 100644 index 407077429..000000000 --- a/target/linux/ppc40x/image/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# -# Copyright (C) 2008-2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -JFFS2_BLOCKSIZE=128k 64k - -define Image/Prepare - $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(DTS_DIR)/kilauea.dts > $(KDIR)/openwrt-kilauea.dtb -endef - -define Image/BuildKernel - cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage - $(call Image/Build/Initramfs) -endef - -define Image/Build - $(call Image/Build/$(1),$(1)) -endef - -define Image/Build/ext2 - cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img -endef - -define Image/Build/jffs2-128k - ( \ - dd if=$(KDIR)/uImage bs=1920k conv=sync; \ - dd if=$(KDIR)/openwrt-kilauea.dtb bs=128k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-kilauea-jffs2.img -endef - -define Image/Build/jffs2-64k - ( \ - dd if=$(KDIR)/cuImage.magicbox bs=1408k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-magicbox-jffs2.img - ( \ - dd if=$(KDIR)/cuImage.openrb bs=1408k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-openrb-jffs2.img -endef - -define Image/Build/squashfs - $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) - ( \ - dd if=$(KDIR)/uImage bs=1920k conv=sync; \ - dd if=$(KDIR)/openwrt-kilauea.dtb bs=128k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-kilauea-$(1).img - ( \ - dd if=$(KDIR)/cuImage.magicbox bs=64k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-magicbox-$(1).img - ( \ - dd if=$(KDIR)/cuImage.openrb bs=1408k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-openrb-$(1).img -endef - -ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) -define Image/Build/Initramfs - cp $(KDIR)/cuImage.magicbox-initramfs $(BIN_DIR)/openwrt-$(BOARD)-magicbox-initramfs.bin - cp $(KDIR)/cuImage.openrb-initramfs $(BIN_DIR)/openwrt-$(BOARD)-openrb-initramfs.bin -endef -endif - -$(eval $(call BuildImage)) diff --git a/target/linux/ppc40x/modules.mk b/target/linux/ppc40x/modules.mk deleted file mode 100644 index 4db39fac7..000000000 --- a/target/linux/ppc40x/modules.mk +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -define KernelPackage/ata-magicbox-cf - SUBMENU:=$(BLOCK_MENU) - TITLE:=Magicbox v2/OpenRB Compact flash support - DEPENDS:=@TARGET_ppc40x - KCONFIG:=CONFIG_PATA_MAGICBOX_CF - FILES:=$(LINUX_DIR)/drivers/ata/pata_magicbox_cf.ko - AUTOLOAD:=$(call AutoLoad,41,pata_magicbox_cf,1) - $(call AddDepends/ata) -endef - -define KernelPackage/ata-magicbox-cf/description - Support for Magicbox v2/OpenRB on-board CF slot. -endef - -$(eval $(call KernelPackage,ata-magicbox-cf)) - - -define KernelPackage/usb-isp116x-hcd - TITLE:=Support for the ISP116x USB Host Controller - DEPENDS:=@TARGET_ppc40x - KCONFIG:= \ - CONFIG_USB_ISP116X_HCD \ - CONFIG_USB_ISP116X_HCD_OF=y \ - CONFIG_USB_ISP116X_HCD_PLATFORM=n - FILES:=$(LINUX_DIR)/drivers/usb/host/isp116x-hcd.ko - AUTOLOAD:=$(call AutoLoad,50,isp116x-hcd) - $(call AddDepends/usb) -endef - -define KernelPackage/usb-isp116x-hcd/description - Kernel support for the ISP116X USB Host Controller -endef - -$(eval $(call KernelPackage,usb-isp116x-hcd)) diff --git a/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch b/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch deleted file mode 100644 index 5c7329dde..000000000 --- a/target/linux/ppc40x/patches-3.18/003-powerpc-add-EBC_BXCR-defines.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/arch/powerpc/boot/dcr.h -+++ b/arch/powerpc/boot/dcr.h -@@ -59,6 +59,14 @@ static const unsigned long sdram_bxcr[] - #define EBC_BXCR(n) (n) - #define EBC_BXCR_BAS 0xfff00000 - #define EBC_BXCR_BS 0x000e0000 -+#define EBC_BXCR_BS_1M 0x00000000 -+#define EBC_BXCR_BS_2M 0x00020000 -+#define EBC_BXCR_BS_4M 0x00040000 -+#define EBC_BXCR_BS_8M 0x00060000 -+#define EBC_BXCR_BS_16M 0x00080000 -+#define EBC_BXCR_BS_32M 0x000a0000 -+#define EBC_BXCR_BS_64M 0x000c0000 -+#define EBC_BXCR_BS_128M 0x000e0000 - #define EBC_BXCR_BANK_SIZE(reg) \ - (0x100000 << (((reg) & EBC_BXCR_BS) >> 17)) - #define EBC_BXCR_BU 0x00018000 -@@ -67,6 +75,9 @@ static const unsigned long sdram_bxcr[] - #define EBC_BXCR_BU_WO 0x00010000 - #define EBC_BXCR_BU_RW 0x00018000 - #define EBC_BXCR_BW 0x00006000 -+#define EBC_BXCR_BW_8 0x00000000 -+#define EBC_BXCR_BW_16 0x00002000 -+#define EBC_BXCR_BW_32 0x00006000 - #define EBC_B0AP 0x10 - #define EBC_B1AP 0x11 - #define EBC_B2AP 0x12 diff --git a/target/linux/ppc40x/patches-3.18/004-magicbox.patch b/target/linux/ppc40x/patches-3.18/004-magicbox.patch deleted file mode 100644 index 48f5912e4..000000000 --- a/target/linux/ppc40x/patches-3.18/004-magicbox.patch +++ /dev/null @@ -1,446 +0,0 @@ ---- /dev/null -+++ b/arch/powerpc/boot/cuboot-magicbox.c -@@ -0,0 +1,98 @@ -+/* -+ * Old U-boot compatibility for Magicbox boards -+ * -+ * Author: Imre Kaloz -+ * Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include "ops.h" -+#include "io.h" -+#include "dcr.h" -+#include "stdio.h" -+#include "4xx.h" -+#include "44x.h" -+#include "cuboot.h" -+ -+#define TARGET_4xx -+#define TARGET_405EP -+#include "ppcboot.h" -+ -+static bd_t bd; -+ -+static void fixup_perwe(void) -+{ -+ -+#define DCRN_CPC0_PCI_BASE 0xf9 -+ -+ /* Turn on PerWE instead of PCIINT */ -+ mtdcr(DCRN_CPC0_PCI_BASE, -+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27)); -+ -+#undef DCRN_CPC0_PCI_BASE -+} -+ -+static void fixup_cf_card(void) -+{ -+ -+#define CF_CS0_BASE 0xff100000 -+#define CF_CS1_BASE 0xff200000 -+ -+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BS_1M | -+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BS_1M | -+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+#undef CF_CS0_BASE -+#undef CF_CS1_BASE -+} -+ -+static void magicbox_fixups(void) -+{ -+ ibm405ep_fixup_clocks(bd.bi_procfreq / 8); -+ ibm4xx_sdram_fixup_memsize(); -+ -+ /* Magicbox v1 has only one ethernet, one serial and no -+ * CF slot -- detect it using it's fake enet1addr -+ */ -+ if ((bd.bi_enet1addr[2] == 0x02) && -+ (bd.bi_enet1addr[3] == 0xfa) && -+ (bd.bi_enet1addr[4] == 0xf0) && -+ (bd.bi_enet1addr[5] == 0x80)) { -+ void *devp; -+ devp = finddevice("/plb/opb/ethernet@ef600900"); -+ del_node(devp); -+ devp = finddevice("/plb/opb/serial@ef600400"); -+ del_node(devp); -+ devp = finddevice("/plb/ebc/cf_card@ff100000"); -+ del_node(devp); -+ -+ } else { -+ fixup_perwe(); -+ fixup_cf_card(); -+ } -+ -+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr); -+} -+ -+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, -+ unsigned long r6, unsigned long r7) -+{ -+ CUBOOT_INIT(); -+ platform_ops.fixups = magicbox_fixups; -+ platform_ops.exit = ibm40x_dbcr_reset; -+ fdt_init(_dtb_start); -+ serial_console_init(); -+} ---- /dev/null -+++ b/arch/powerpc/boot/dts/magicbox.dts -@@ -0,0 +1,285 @@ -+/* -+ * Device Tree Source for Magicbox boards -+ * -+ * Copyright 2008-2009 Imre Kaloz -+ * Copyright 2009 Gabor Juhos -+ * -+ * Based on walnut.dts -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without -+ * any warranty of any kind, whether express or implied. -+ */ -+ -+/dts-v1/; -+ -+/ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ model = "magicbox"; -+ compatible = "magicbox"; -+ dcr-parent = <&{/cpus/cpu@0}>; -+ -+ aliases { -+ ethernet0 = &EMAC0; -+ ethernet1 = &EMAC1; -+ serial0 = &UART0; -+ serial1 = &UART1; -+ }; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ device_type = "cpu"; -+ model = "PowerPC,405EP"; -+ reg = <0x00000000>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ timebase-frequency = <0>; /* Filled in by zImage */ -+ i-cache-line-size = <0x20>; -+ d-cache-line-size = <0x20>; -+ i-cache-size = <0x4000>; -+ d-cache-size = <0x4000>; -+ dcr-controller; -+ dcr-access-method = "native"; -+ }; -+ }; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */ -+ }; -+ -+ UIC0: interrupt-controller { -+ compatible = "ibm,uic"; -+ interrupt-controller; -+ cell-index = <0>; -+ dcr-reg = <0x0c0 0x009>; -+ #address-cells = <0>; -+ #size-cells = <0>; -+ #interrupt-cells = <2>; -+ }; -+ -+ plb { -+ compatible = "ibm,plb3"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ SDRAM0: memory-controller { -+ compatible = "ibm,sdram-405ep"; -+ dcr-reg = <0x010 0x002>; -+ }; -+ -+ MAL: mcmal { -+ compatible = "ibm,mcmal-405ep", "ibm,mcmal"; -+ dcr-reg = <0x180 0x062>; -+ num-tx-chans = <4>; -+ num-rx-chans = <2>; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xb 0x4 /* TXEOB */ -+ 0xc 0x4 /* RXEOB */ -+ 0xa 0x4 /* SERR */ -+ 0xd 0x4 /* TXDE */ -+ 0xe 0x4 /* RXDE */>; -+ }; -+ -+ POB0: opb { -+ compatible = "ibm,opb-405ep", "ibm,opb"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0xef600000 0xef600000 0x00a00000>; -+ dcr-reg = <0x0a0 0x005>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ UART0: serial@ef600300 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600300 0x00000008>; -+ virtual-reg = <0xef600300>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x0 0x4>; -+ }; -+ -+ UART1: serial@ef600400 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600400 0x00000008>; -+ virtual-reg = <0xef600400>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x1 0x4>; -+ }; -+ -+ IIC: i2c@ef600500 { -+ compatible = "ibm,iic-405ep", "ibm,iic"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0xef600500 0x00000011>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x2 0x4>; -+ -+ dtt@48 { -+ compatible = "national,lm75"; -+ reg = <0x48>; -+ }; -+ -+ eeprom@50 { -+ compatible = "at24,24c16"; -+ reg = <0x50>; -+ }; -+ }; -+ -+ GPIO0: gpio-controller@ef600700 { -+ compatible = "ibm,ppc4xx-gpio"; -+ reg = <0xef600700 0x00000020>; -+ #gpio-cells = <2>; -+ gpio-controller; -+ }; -+ -+ EMAC0: ethernet@ef600800 { -+ linux,network-index = <0x0>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xf 0x4 /* Ethernet */ -+ 0x9 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600800 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <0>; -+ mal-rx-channel = <0>; -+ cell-index = <0>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ phy-mode = "mii"; -+ phy-map = <0x00000000>; -+ }; -+ -+ EMAC1: ethernet@ef600900 { -+ linux,network-index = <0x1>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0x11 0x4 /* Ethernet */ -+ 0x09 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600900 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <2>; -+ mal-rx-channel = <1>; -+ cell-index = <1>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ mdio-device = <&EMAC0>; -+ phy-mode = "mii"; -+ phy-map = <0x00000001>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ user { -+ label = "magicbox:red:user"; -+ gpios = <&GPIO0 2 1>; -+ }; -+ }; -+ }; -+ -+ EBC0: ebc { -+ compatible = "ibm,ebc-405ep", "ibm,ebc"; -+ dcr-reg = <0x012 0x002>; -+ #address-cells = <2>; -+ #size-cells = <1>; -+ /* The ranges property is supplied by the bootwrapper -+ * and is based on the firmware's configuration of the -+ * EBC bridge -+ */ -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ cf_card@ff100000 { -+ compatible = "magicbox-cf", "pata-magicbox-cf"; -+ reg = <0x00000000 0xff100000 0x00001000 -+ 0x00000000 0xff200000 0x00001000>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >; -+ }; -+ -+ nor_flash@ffc00000 { -+ compatible = "cfi-flash"; -+ bank-width = <2>; -+ reg = <0x00000000 0xffc00000 0x00400000>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ partition0@0 { -+ label = "linux"; -+ reg = <0x0 0x160000>; -+ }; -+ partition1@120000 { -+ label = "rootfs"; -+ reg = <0x160000 0x260000>; -+ }; -+ partition2@3c0000 { -+ label = "u-boot"; -+ reg = <0x3c0000 0x30000>; -+ read-only; -+ }; -+ partition3@0 { -+ label = "firmware"; -+ reg = <0x0 0x3c0000>; -+ }; -+ }; -+ }; -+ -+ PCI0: pci@ec000000 { -+ device_type = "pci"; -+ #interrupt-cells = <1>; -+ #size-cells = <2>; -+ #address-cells = <3>; -+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci"; -+ primary; -+ reg = <0xeec00000 0x00000008 /* Config space access */ -+ 0xeed80000 0x00000004 /* IACK */ -+ 0xeed80000 0x00000004 /* Special cycle */ -+ 0xef480000 0x00000040>; /* Internal registers */ -+ -+ /* Outbound ranges, one memory and one IO, -+ * later cannot be changed. Chip supports a second -+ * IO range but we don't use it for now -+ */ -+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000 -+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; -+ -+ /* Inbound 2GB range starting at 0 */ -+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>; -+ -+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>; -+ interrupt-map = < -+ /* IDSEL 1 */ -+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 -+ -+ /* IDSEL 2 */ -+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8 -+ -+ /* IDSEL 3 */ -+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8 -+ -+ /* IDSEL 4 */ -+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8 -+ >; -+ }; -+ }; -+ -+ chosen { -+ linux,stdout-path = "/plb/opb/serial@ef600300"; -+ }; -+}; ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -50,6 +50,7 @@ $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += - - $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 - $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 - $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 -+$(obj)/cuboot-magicbox.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405 -@@ -86,7 +87,8 @@ src-plat-y := of.c epapr.c - src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \ - treeboot-walnut.c cuboot-acadia.c \ - cuboot-kilauea.c simpleboot.c \ -- virtex405-head.S virtex.c -+ virtex405-head.S virtex.c \ -+ cuboot-magicbox.c - src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \ - cuboot-bamboo.c cuboot-sam440ep.c \ - cuboot-sequoia.c cuboot-rainier.c \ -@@ -238,6 +240,7 @@ image-$(CONFIG_HOTFOOT) += cuImage.hot - image-$(CONFIG_WALNUT) += treeImage.walnut - image-$(CONFIG_ACADIA) += cuImage.acadia - image-$(CONFIG_OBS600) += uImage.obs600 -+image-$(CONFIG_MAGICBOX) += cuImage.magicbox - - # Board ports in arch/powerpc/platform/44x/Kconfig - image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony ---- a/arch/powerpc/platforms/40x/Kconfig -+++ b/arch/powerpc/platforms/40x/Kconfig -@@ -37,6 +37,16 @@ config KILAUEA - help - This option enables support for the AMCC PPC405EX evaluation board. - -+config MAGICBOX -+ bool "Magicbox" -+ depends on 40x -+ default n -+ select PPC40x_SIMPLE -+ select 405EP -+ select PCI -+ help -+ This option enables support for the Magicbox boards. -+ - config MAKALU - bool "Makalu" - depends on 40x ---- a/arch/powerpc/platforms/40x/ppc40x_simple.c -+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c -@@ -58,6 +58,7 @@ static const char * const board[] __init - "apm,klondike", - "est,hotfoot", - "plathome,obs600", -+ "magicbox", - NULL - }; - diff --git a/target/linux/ppc40x/patches-3.18/005-openrb.patch b/target/linux/ppc40x/patches-3.18/005-openrb.patch deleted file mode 100644 index a21d9fa72..000000000 --- a/target/linux/ppc40x/patches-3.18/005-openrb.patch +++ /dev/null @@ -1,447 +0,0 @@ ---- /dev/null -+++ b/arch/powerpc/boot/cuboot-openrb.c -@@ -0,0 +1,94 @@ -+/* -+ * Old U-boot compatibility for OpenRB boards -+ * -+ * Author: Gabor Juhos -+ * Imre Kaloz -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include "ops.h" -+#include "io.h" -+#include "dcr.h" -+#include "stdio.h" -+#include "4xx.h" -+#include "44x.h" -+#include "cuboot.h" -+ -+#define TARGET_4xx -+#define TARGET_405EP -+#include "ppcboot.h" -+ -+static bd_t bd; -+ -+static void fixup_perwe(void) -+{ -+#define DCRN_CPC0_PCI_BASE 0xf9 -+ -+ /* Turn on PerWE instead of PCIINT */ -+ mtdcr(DCRN_CPC0_PCI_BASE, -+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27)); -+ -+#undef DCRN_CPC0_PCI_BASE -+} -+ -+static void fixup_cf_card(void) -+{ -+#define CF_CS0_BASE 0xff100000 -+#define CF_CS1_BASE 0xff200000 -+ -+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BS_1M | -+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR); -+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BS_1M | -+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800); -+ -+#undef CF_CS0_BASE -+#undef CF_CS1_BASE -+} -+ -+static void fixup_isp116x(void) -+{ -+#define ISP116X_CS_BASE 0xf0000000 -+ -+ /* PerCS3 (ISP1160's CS): base 0xf0000000, size 32MB, 16-bit, rw */ -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B3CR); -+ mtdcr(DCRN_EBC0_CFGDATA, ISP116X_CS_BASE | EBC_BXCR_BS_32M | -+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16); -+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B3AP); -+ mtdcr(DCRN_EBC0_CFGDATA, 0x03016600); -+ -+#undef ISP116X_CS_BASE -+} -+ -+static void openrb_fixups(void) -+{ -+ ibm405ep_fixup_clocks(bd.bi_procfreq / 8); -+ ibm4xx_sdram_fixup_memsize(); -+ -+ fixup_perwe(); -+ fixup_cf_card(); -+ fixup_isp116x(); -+ -+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr); -+} -+ -+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, -+ unsigned long r6, unsigned long r7) -+{ -+ CUBOOT_INIT(); -+ platform_ops.fixups = openrb_fixups; -+ platform_ops.exit = ibm40x_dbcr_reset; -+ fdt_init(_dtb_start); -+ serial_console_init(); -+} ---- /dev/null -+++ b/arch/powerpc/boot/dts/openrb.dts -@@ -0,0 +1,291 @@ -+/* -+ * Device Tree Source for OpenRB boards -+ * -+ * Copyright 2009 Gabor Juhos -+ * Copyright 2009 Imre Kaloz -+ * -+ * Based on walnut.dts -+ * -+ * This file is licensed under the terms of the GNU General Public -+ * License version 2. This program is licensed "as is" without -+ * any warranty of any kind, whether express or implied. -+ */ -+ -+/dts-v1/; -+ -+/ { -+ #address-cells = <1>; -+ #size-cells = <1>; -+ model = "openrb"; -+ compatible = "openrb"; -+ dcr-parent = <&{/cpus/cpu@0}>; -+ -+ aliases { -+ ethernet0 = &EMAC0; -+ ethernet1 = &EMAC1; -+ serial0 = &UART0; -+ serial1 = &UART1; -+ }; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ device_type = "cpu"; -+ model = "PowerPC,405EP"; -+ reg = <0x00000000>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ timebase-frequency = <0>; /* Filled in by zImage */ -+ i-cache-line-size = <0x20>; -+ d-cache-line-size = <0x20>; -+ i-cache-size = <0x4000>; -+ d-cache-size = <0x4000>; -+ dcr-controller; -+ dcr-access-method = "native"; -+ }; -+ }; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */ -+ }; -+ -+ UIC0: interrupt-controller { -+ compatible = "ibm,uic"; -+ interrupt-controller; -+ cell-index = <0>; -+ dcr-reg = <0x0c0 0x009>; -+ #address-cells = <0>; -+ #size-cells = <0>; -+ #interrupt-cells = <2>; -+ }; -+ -+ plb { -+ compatible = "ibm,plb3"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ SDRAM0: memory-controller { -+ compatible = "ibm,sdram-405ep"; -+ dcr-reg = <0x010 0x002>; -+ }; -+ -+ MAL: mcmal { -+ compatible = "ibm,mcmal-405ep", "ibm,mcmal"; -+ dcr-reg = <0x180 0x062>; -+ num-tx-chans = <4>; -+ num-rx-chans = <2>; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xb 0x4 /* TXEOB */ -+ 0xc 0x4 /* RXEOB */ -+ 0xa 0x4 /* SERR */ -+ 0xd 0x4 /* TXDE */ -+ 0xe 0x4 /* RXDE */>; -+ }; -+ -+ POB0: opb { -+ compatible = "ibm,opb-405ep", "ibm,opb"; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ ranges = <0xef600000 0xef600000 0x00a00000>; -+ dcr-reg = <0x0a0 0x005>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ UART0: serial@ef600300 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600300 0x00000008>; -+ virtual-reg = <0xef600300>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x0 0x4>; -+ }; -+ -+ UART1: serial@ef600400 { -+ device_type = "serial"; -+ compatible = "ns16550"; -+ reg = <0xef600400 0x00000008>; -+ virtual-reg = <0xef600400>; -+ clock-frequency = <0>; /* Filled in by zImage */ -+ current-speed = <115200>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x1 0x4>; -+ }; -+ -+ IIC: i2c@ef600500 { -+ compatible = "ibm,iic-405ep", "ibm,iic"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <0xef600500 0x00000011>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x2 0x4>; -+ -+ eeprom@50 { -+ compatible = "at24,24c16"; -+ reg = <0x50>; -+ }; -+ }; -+ -+ GPIO0: gpio-controller@ef600700 { -+ compatible = "ibm,ppc4xx-gpio"; -+ reg = <0xef600700 0x00000020>; -+ #gpio-cells = <2>; -+ gpio-controller; -+ }; -+ -+ EMAC0: ethernet@ef600800 { -+ linux,network-index = <0x0>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0xf 0x4 /* Ethernet */ -+ 0x9 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600800 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <0>; -+ mal-rx-channel = <0>; -+ cell-index = <0>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ phy-mode = "mii"; -+ phy-map = <0x00000000>; -+ }; -+ -+ EMAC1: ethernet@ef600900 { -+ linux,network-index = <0x1>; -+ device_type = "network"; -+ compatible = "ibm,emac-405ep", "ibm,emac"; -+ interrupt-parent = <&UIC0>; -+ interrupts = < -+ 0x11 0x4 /* Ethernet */ -+ 0x09 0x4 /* Ethernet Wake Up */>; -+ local-mac-address = [000000000000]; /* Filled in by zImage */ -+ reg = <0xef600900 0x00000070>; -+ mal-device = <&MAL>; -+ mal-tx-channel = <2>; -+ mal-rx-channel = <1>; -+ cell-index = <1>; -+ max-frame-size = <0x5dc>; -+ rx-fifo-size = <0x1000>; -+ tx-fifo-size = <0x800>; -+ mdio-device = <&EMAC0>; -+ phy-mode = "mii"; -+ phy-map = <0x00000001>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ user { -+ label = "openrb:green:user"; -+ gpios = <&GPIO0 2 1>; -+ }; -+ }; -+ }; -+ -+ EBC0: ebc { -+ compatible = "ibm,ebc-405ep", "ibm,ebc"; -+ dcr-reg = <0x012 0x002>; -+ #address-cells = <2>; -+ #size-cells = <1>; -+ /* The ranges property is supplied by the bootwrapper -+ * and is based on the firmware's configuration of the -+ * EBC bridge -+ */ -+ clock-frequency = <0>; /* Filled in by zImage */ -+ -+ isp116x@f0000000 { -+ compatible = "isp116x-hcd"; -+ oc_enable; -+ int_act_high; -+ int_edge_triggered; -+ reg = <0x00000000 0xf0000000 0x00000002 /* data */ -+ 0x00000000 0xf1000000 0x00000002 /* addr */ >; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x1b 0x1 /* IRQ_TYPE_EDGE_RISING */ >; -+ }; -+ -+ cf_card@ff100000 { -+ compatible = "magicbox-cf", "pata-magicbox-cf"; -+ reg = <0x00000000 0xff100000 0x00001000 -+ 0x00000000 0xff200000 0x00001000>; -+ interrupt-parent = <&UIC0>; -+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >; -+ }; -+ -+ nor_flash@ff800000 { -+ compatible = "cfi-flash"; -+ bank-width = <2>; -+ reg = <0x00000000 0xff800000 0x00800000>; -+ #address-cells = <1>; -+ #size-cells = <1>; -+ partition0@0 { -+ label = "linux"; -+ reg = <0x0 0x160000>; -+ }; -+ partition1@120000 { -+ label = "rootfs"; -+ reg = <0x160000 0x660000>; -+ }; -+ partition2@7c0000 { -+ label = "u-boot"; -+ reg = <0x7c0000 0x30000>; -+ read-only; -+ }; -+ partition3@0 { -+ label = "firmware"; -+ reg = <0x0 0x7c0000>; -+ }; -+ }; -+ }; -+ -+ PCI0: pci@ec000000 { -+ device_type = "pci"; -+ #interrupt-cells = <1>; -+ #size-cells = <2>; -+ #address-cells = <3>; -+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci"; -+ primary; -+ reg = <0xeec00000 0x00000008 /* Config space access */ -+ 0xeed80000 0x00000004 /* IACK */ -+ 0xeed80000 0x00000004 /* Special cycle */ -+ 0xef480000 0x00000040>; /* Internal registers */ -+ -+ /* Outbound ranges, one memory and one IO, -+ * later cannot be changed. Chip supports a second -+ * IO range but we don't use it for now -+ */ -+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000 -+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>; -+ -+ /* Inbound 2GB range starting at 0 */ -+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>; -+ -+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>; -+ interrupt-map = < -+ /* IDSEL 1 */ -+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 -+ -+ /* IDSEL 2 */ -+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8 -+ -+ /* IDSEL 3 */ -+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8 -+ -+ /* IDSEL 4 */ -+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8 -+ >; -+ }; -+ }; -+ -+ chosen { -+ linux,stdout-path = "/plb/opb/serial@ef600300"; -+ }; -+}; ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -51,6 +51,7 @@ $(obj)/cuboot-taishan.o: BOOTCFLAGS += - - $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 - $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405 - $(obj)/cuboot-magicbox.o: BOOTCFLAGS += -mcpu=405 -+$(obj)/cuboot-openrb.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405 - $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405 -@@ -88,7 +89,7 @@ src-plat-$(CONFIG_40x) += fixed-head.S e - treeboot-walnut.c cuboot-acadia.c \ - cuboot-kilauea.c simpleboot.c \ - virtex405-head.S virtex.c \ -- cuboot-magicbox.c -+ cuboot-magicbox.c cuboot-openrb - src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \ - cuboot-bamboo.c cuboot-sam440ep.c \ - cuboot-sequoia.c cuboot-rainier.c \ -@@ -241,6 +242,7 @@ image-$(CONFIG_WALNUT) += treeImage.wa - image-$(CONFIG_ACADIA) += cuImage.acadia - image-$(CONFIG_OBS600) += uImage.obs600 - image-$(CONFIG_MAGICBOX) += cuImage.magicbox -+image-$(CONFIG_OPENRB) += cuImage.openrb - - # Board ports in arch/powerpc/platform/44x/Kconfig - image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony ---- a/arch/powerpc/platforms/40x/Kconfig -+++ b/arch/powerpc/platforms/40x/Kconfig -@@ -47,6 +47,16 @@ config MAGICBOX - help - This option enables support for the Magicbox boards. - -+config OPENRB -+ bool "OpenRB" -+ depends on 40x -+ default n -+ select PPC40x_SIMPLE -+ select 405EP -+ select PCI -+ help -+ This option enables support for the OpenRB boards. -+ - config MAKALU - bool "Makalu" - depends on 40x ---- a/arch/powerpc/platforms/40x/ppc40x_simple.c -+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c -@@ -59,6 +59,7 @@ static const char * const board[] __init - "est,hotfoot", - "plathome,obs600", - "magicbox", -+ "openrb", - NULL - }; - diff --git a/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch b/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch deleted file mode 100644 index d0e89b713..000000000 --- a/target/linux/ppc40x/patches-3.18/101-pata-magicbox-cf-driver.patch +++ /dev/null @@ -1,433 +0,0 @@ ---- a/drivers/ata/Kconfig -+++ b/drivers/ata/Kconfig -@@ -234,6 +234,16 @@ config PDC_ADMA - - If unsure, say N. - -+config PATA_MAGICBOX_CF -+ tristate "Magicbox/OpenRB Compact Flash support" -+ depends on MAGICBOX || OPENRB -+ help -+ This option enables support for a Compact Flash conected on -+ the ppc405ep expansion bus. This driver had been written for -+ the Magicbox v2 and OpenRB boards. -+ -+ If unsure, say N. -+ - config PATA_OCTEON_CF - tristate "OCTEON Boot Bus Compact Flash support" - depends on CAVIUM_OCTEON_SOC ---- a/drivers/ata/Makefile -+++ b/drivers/ata/Makefile -@@ -91,6 +91,7 @@ obj-$(CONFIG_PATA_AT91) += pata_at91.o - obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o - obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o - obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o -+obj-$(CONFIG_PATA_MAGICBOX_CF) += pata_magicbox_cf.o - obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o - obj-$(CONFIG_PATA_NS87410) += pata_ns87410.o - obj-$(CONFIG_PATA_OPTI) += pata_opti.o ---- /dev/null -+++ b/drivers/ata/pata_magicbox_cf.c -@@ -0,0 +1,401 @@ -+/* -+ * PATA/CompactFlash driver for the MagicBox v2/OpenRB boards. -+ * -+ * Copyright (C) 2009,2012 Gabor Juhos -+ * -+ * Based on the IDE driver by Wojtek Kaniewski -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+//#include -+//#include -+#include -+#include -+ -+#define DRV_DESC "PATA/CompactFlash driver for Magicbox/OpenRB boards" -+#define DRV_NAME "pata_magicbox_cf" -+#define DRV_VERSION "0.1.0" -+ -+#define MAGICBOX_CF_REG_CMD (2 * ATA_REG_CMD) -+#define MAGICBOX_CF_REG_DATA (2 * ATA_REG_DATA) -+#define MAGICBOX_CF_REG_ERR (2 * ATA_REG_ERR) -+#define MAGICBOX_CF_REG_FEATURE (2 * ATA_REG_FEATURE) -+#define MAGICBOX_CF_REG_NSECT (2 * ATA_REG_NSECT) -+#define MAGICBOX_CF_REG_LBAL (2 * ATA_REG_LBAL) -+#define MAGICBOX_CF_REG_LBAM (2 * ATA_REG_LBAM) -+#define MAGICBOX_CF_REG_LBAH (2 * ATA_REG_LBAH) -+#define MAGICBOX_CF_REG_DEVICE (2 * ATA_REG_DEVICE) -+#define MAGICBOX_CF_REG_STATUS (2 * ATA_REG_STATUS) -+#define MAGICBOX_CF_REG_ALTSTATUS (2 * 6) -+#define MAGICBOX_CF_REG_CTL (2 * 6) -+ -+#define MAGICBOX_CF_MAXPORTS 1 -+ -+struct magicbox_cf_info { -+ void __iomem *base; -+ void __iomem *ctrl; -+}; -+ -+static inline u8 magicbox_cf_inb(void __iomem *port) -+{ -+ return (u8) (readw(port) >> 8) & 0xff; -+} -+ -+static inline void magicbox_cf_outb(void __iomem *port, u8 value) -+{ -+ writew(value << 8, port); -+} -+ -+static int magicbox_cf_set_mode(struct ata_link *link, -+ struct ata_device **error) -+{ -+ struct ata_device *dev; -+ -+ ata_for_each_dev(dev, link, ENABLED) { -+ ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); -+ dev->pio_mode = XFER_PIO_0; -+ dev->xfer_mode = XFER_PIO_0; -+ dev->xfer_shift = ATA_SHIFT_PIO; -+ dev->flags |= ATA_DFLAG_PIO; -+ } -+ -+ return 0; -+} -+ -+static void magicbox_cf_exec_command(struct ata_port *ap, -+ const struct ata_taskfile *tf) -+{ -+ DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); -+ -+ magicbox_cf_outb(ap->ioaddr.command_addr, tf->command); -+ ata_sff_pause(ap); -+} -+ -+static u8 magicbox_cf_check_status(struct ata_port *ap) -+{ -+ u8 status; -+ -+ status = magicbox_cf_inb(ap->ioaddr.status_addr); -+ -+ DPRINTK("ata%u: status 0x%X, from %p\n", ap->print_id, status, -+ ap->ioaddr.status_addr); -+ -+ return status; -+} -+ -+static u8 magicbox_cf_check_altstatus(struct ata_port *ap) -+{ -+ u8 altstatus; -+ -+ altstatus = magicbox_cf_inb(ap->ioaddr.altstatus_addr); -+ -+ DPRINTK("ata%u: altstatus 0x%X, from %p\n", ap->print_id, -+ altstatus, ap->ioaddr.altstatus_addr); -+ -+ return altstatus; -+} -+ -+static void magicbox_cf_dev_select(struct ata_port *ap, unsigned int device) -+{ -+ /* Nothing to do. We are supporting one device only. */ -+} -+ -+static void magicbox_cf_tf_load(struct ata_port *ap, -+ const struct ata_taskfile *tf) -+{ -+ struct ata_ioports *ioaddr = &ap->ioaddr; -+ unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; -+ -+ if (tf->ctl != ap->last_ctl) { -+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl); -+ ap->last_ctl = tf->ctl; -+ ata_wait_idle(ap); -+ } -+ -+ if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { -+ magicbox_cf_outb(ioaddr->feature_addr, tf->hob_feature); -+ magicbox_cf_outb(ioaddr->nsect_addr, tf->hob_nsect); -+ magicbox_cf_outb(ioaddr->lbal_addr, tf->hob_lbal); -+ magicbox_cf_outb(ioaddr->lbam_addr, tf->hob_lbam); -+ magicbox_cf_outb(ioaddr->lbah_addr, tf->hob_lbah); -+ VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", -+ tf->hob_feature, -+ tf->hob_nsect, -+ tf->hob_lbal, -+ tf->hob_lbam, -+ tf->hob_lbah); -+ } -+ -+ if (is_addr) { -+ magicbox_cf_outb(ioaddr->feature_addr, tf->feature); -+ magicbox_cf_outb(ioaddr->nsect_addr, tf->nsect); -+ magicbox_cf_outb(ioaddr->lbal_addr, tf->lbal); -+ magicbox_cf_outb(ioaddr->lbam_addr, tf->lbam); -+ magicbox_cf_outb(ioaddr->lbah_addr, tf->lbah); -+ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", -+ tf->feature, -+ tf->nsect, -+ tf->lbal, -+ tf->lbam, -+ tf->lbah); -+ } -+ -+ if (tf->flags & ATA_TFLAG_DEVICE) { -+ magicbox_cf_outb(ioaddr->device_addr, tf->device); -+ VPRINTK("device 0x%X\n", tf->device); -+ } -+ -+ ata_wait_idle(ap); -+} -+ -+static void magicbox_cf_tf_read(struct ata_port *ap, struct ata_taskfile *tf) -+{ -+ struct ata_ioports *ioaddr = &ap->ioaddr; -+ -+ tf->command = magicbox_cf_inb(ap->ioaddr.status_addr); -+ tf->feature = magicbox_cf_inb(ioaddr->error_addr); -+ tf->nsect = magicbox_cf_inb(ioaddr->nsect_addr); -+ tf->lbal = magicbox_cf_inb(ioaddr->lbal_addr); -+ tf->lbam = magicbox_cf_inb(ioaddr->lbam_addr); -+ tf->lbah = magicbox_cf_inb(ioaddr->lbah_addr); -+ tf->device = magicbox_cf_inb(ioaddr->device_addr); -+ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", -+ tf->feature, -+ tf->nsect, -+ tf->lbal, -+ tf->lbam, -+ tf->lbah); -+ -+ if (tf->flags & ATA_TFLAG_LBA48) { -+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl | ATA_HOB); -+ tf->hob_feature = magicbox_cf_inb(ioaddr->error_addr); -+ tf->hob_nsect = magicbox_cf_inb(ioaddr->nsect_addr); -+ tf->hob_lbal = magicbox_cf_inb(ioaddr->lbal_addr); -+ tf->hob_lbam = magicbox_cf_inb(ioaddr->lbam_addr); -+ tf->hob_lbah = magicbox_cf_inb(ioaddr->lbah_addr); -+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl); -+ ap->last_ctl = tf->ctl; -+ VPRINTK("hob: feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", -+ tf->feature, -+ tf->nsect, -+ tf->lbal, -+ tf->lbam, -+ tf->lbah); -+ } -+} -+ -+static unsigned int magicbox_cf_data_xfer(struct ata_device *dev, -+ unsigned char *buf, -+ unsigned int buflen, int rw) -+{ -+ struct ata_port *ap = dev->link->ap; -+ unsigned int words = buflen >> 1; -+ unsigned int i; -+ u16 *buf16 = (u16 *) buf; -+ void __iomem *mmio = ap->ioaddr.data_addr; -+ -+ /* Transfer multiple of 2 bytes */ -+ if (rw == READ) -+ for (i = 0; i < words; i++) -+ buf16[i] = readw(mmio); -+ else -+ for (i = 0; i < words; i++) -+ writew(buf16[i], mmio); -+ -+ /* Transfer trailing 1 byte, if any. */ -+ if (unlikely(buflen & 0x01)) { -+ u16 align_buf[1] = { 0 }; -+ unsigned char *trailing_buf = buf + buflen - 1; -+ -+ if (rw == READ) { -+ align_buf[0] = readw(mmio); -+ memcpy(trailing_buf, align_buf, 1); -+ } else { -+ memcpy(align_buf, trailing_buf, 1); -+ writew(align_buf[0], mmio); -+ } -+ words++; -+ } -+ -+ return words << 1; -+} -+ -+static void magicbox_cf_irq_on(struct ata_port *ap) -+{ -+ /* Nothing to do. */ -+} -+ -+static void magicbox_cf_irq_clear(struct ata_port *ap) -+{ -+ /* Nothing to do. */ -+} -+ -+static struct ata_port_operations magicbox_cf_port_ops = { -+ .inherits = &ata_sff_port_ops, -+ -+ .cable_detect = ata_cable_40wire, -+ .set_mode = magicbox_cf_set_mode, -+ -+ .sff_exec_command = magicbox_cf_exec_command, -+ .sff_check_status = magicbox_cf_check_status, -+ .sff_check_altstatus = magicbox_cf_check_altstatus, -+ .sff_dev_select = magicbox_cf_dev_select, -+ .sff_tf_load = magicbox_cf_tf_load, -+ .sff_tf_read = magicbox_cf_tf_read, -+ .sff_data_xfer = magicbox_cf_data_xfer, -+ -+ .sff_irq_on = magicbox_cf_irq_on, -+ .sff_irq_clear = magicbox_cf_irq_clear, -+ -+ .port_start = ATA_OP_NULL, -+}; -+ -+static struct scsi_host_template magicbox_cf_sht = { -+ ATA_PIO_SHT(DRV_NAME), -+}; -+ -+static inline void magicbox_cf_setup_port(struct ata_host *host) -+{ -+ struct magicbox_cf_info *info = host->private_data; -+ struct ata_port *ap; -+ -+ ap = host->ports[0]; -+ -+ ap->ops = &magicbox_cf_port_ops; -+ ap->pio_mask = ATA_PIO4; -+ ap->flags |= ATA_FLAG_NO_ATAPI; -+ -+ ap->ioaddr.cmd_addr = info->base + MAGICBOX_CF_REG_CMD; -+ ap->ioaddr.data_addr = info->base + MAGICBOX_CF_REG_DATA; -+ ap->ioaddr.error_addr = info->base + MAGICBOX_CF_REG_ERR; -+ ap->ioaddr.feature_addr = info->base + MAGICBOX_CF_REG_FEATURE; -+ ap->ioaddr.nsect_addr = info->base + MAGICBOX_CF_REG_NSECT; -+ ap->ioaddr.lbal_addr = info->base + MAGICBOX_CF_REG_LBAL; -+ ap->ioaddr.lbam_addr = info->base + MAGICBOX_CF_REG_LBAM; -+ ap->ioaddr.lbah_addr = info->base + MAGICBOX_CF_REG_LBAH; -+ ap->ioaddr.device_addr = info->base + MAGICBOX_CF_REG_DEVICE; -+ ap->ioaddr.status_addr = info->base + MAGICBOX_CF_REG_STATUS; -+ ap->ioaddr.command_addr = info->base + MAGICBOX_CF_REG_CMD; -+ -+ ap->ioaddr.altstatus_addr = info->ctrl + MAGICBOX_CF_REG_ALTSTATUS; -+ ap->ioaddr.ctl_addr = info->ctrl + MAGICBOX_CF_REG_CTL; -+ -+ ata_port_desc(ap, "cmd 0x%p ctl 0x%p", ap->ioaddr.cmd_addr, -+ ap->ioaddr.ctl_addr); -+} -+ -+static int magicbox_cf_of_probe(struct platform_device *op) -+{ -+ struct magicbox_cf_info *info; -+ struct ata_host *host; -+ int irq; -+ int ret = 0; -+ -+ info = kzalloc(sizeof(struct magicbox_cf_info), GFP_KERNEL); -+ if (info == NULL) { -+ ret = -ENOMEM; -+ goto err_exit; -+ } -+ -+ irq = irq_of_parse_and_map(op->dev.of_node, 0); -+ if (irq < 0) { -+ dev_err(&op->dev, "invalid irq\n"); -+ ret = -EINVAL; -+ goto err_free_info; -+ } -+ -+ info->base = of_iomap(op->dev.of_node, 0); -+ if (info->base == NULL) { -+ ret = -ENOMEM; -+ goto err_free_info; -+ } -+ -+ info->ctrl = of_iomap(op->dev.of_node, 1); -+ if (info->ctrl == NULL) { -+ ret = -ENOMEM; -+ goto err_unmap_base; -+ } -+ -+ host = ata_host_alloc(&op->dev, MAGICBOX_CF_MAXPORTS); -+ if (host == NULL) { -+ ret = -ENOMEM; -+ goto err_unmap_ctrl; -+ } -+ -+ host->private_data = info; -+ magicbox_cf_setup_port(host); -+ -+ ret = ata_host_activate(host, irq, ata_sff_interrupt, -+ IRQF_TRIGGER_RISING, &magicbox_cf_sht); -+ if (ret) -+ goto err_unmap_ctrl; -+ -+ dev_set_drvdata(&op->dev, host); -+ return 0; -+ -+ err_unmap_ctrl: -+ iounmap(info->ctrl); -+ err_unmap_base: -+ iounmap(info->base); -+ err_free_info: -+ kfree(info); -+ err_exit: -+ return ret; -+} -+ -+static int magicbox_cf_of_remove(struct platform_device *op) -+{ -+ struct ata_host *host = dev_get_drvdata(&op->dev); -+ struct magicbox_cf_info *info = host->private_data; -+ -+ ata_host_detach(host); -+ iounmap(info->ctrl); -+ iounmap(info->base); -+ kfree(info); -+ -+ return 0; -+} -+ -+static struct of_device_id magicbox_cf_of_match[] = { -+ { .compatible = "pata-magicbox-cf", }, -+ {}, -+}; -+ -+static struct platform_driver magicbox_cf_of_platform_driver = { -+ .probe = magicbox_cf_of_probe, -+ .remove = magicbox_cf_of_remove, -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ .of_match_table = magicbox_cf_of_match, -+ }, -+}; -+ -+static int __init magicbox_cf_init(void) -+{ -+ return platform_driver_register(&magicbox_cf_of_platform_driver); -+} -+ -+static void __exit magicbox_cf_exit(void) -+{ -+ platform_driver_unregister(&magicbox_cf_of_platform_driver); -+} -+ -+module_init(magicbox_cf_init); -+module_exit(magicbox_cf_exit); -+ -+MODULE_DESCRIPTION(DRV_DESC); -+MODULE_AUTHOR("Gabor Juhos "); -+MODULE_LICENSE("GPL v2"); -+MODULE_VERSION(DRV_VERSION); -+MODULE_DEVICE_TABLE(of, magicbox_cf_of_match); diff --git a/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch b/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch deleted file mode 100644 index ab44a2d57..000000000 --- a/target/linux/ppc40x/patches-3.18/110-kilauea_openwrt_flashmap.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/arch/powerpc/boot/dts/kilauea.dts -+++ b/arch/powerpc/boot/dts/kilauea.dts -@@ -102,8 +102,8 @@ - compatible = "ibm,sdram-405ex", "ibm,sdram-4xx-ddr2"; - dcr-reg = <0x010 0x002>; - interrupt-parent = <&UIC2>; -- interrupts = <0x5 0x4 /* ECC DED Error */ -- 0x6 0x4>; /* ECC SEC Error */ -+ interrupts = <0x5 0x4 /* ECC DED Error */ -+ 0x6 0x4>; /* ECC SEC Error */ - }; - - CRYPTO: crypto@ef700000 { -@@ -157,30 +157,30 @@ - reg = <0x00000000 0x00000000 0x04000000>; - #address-cells = <1>; - #size-cells = <1>; -- partition@0 { -+ partition0@0 { - label = "kernel"; - reg = <0x00000000 0x001e0000>; - }; -- partition@1e0000 { -+ partition1@1e0000 { - label = "dtb"; - reg = <0x001e0000 0x00020000>; - }; -- partition@200000 { -- label = "root"; -- reg = <0x00200000 0x00200000>; -- }; -- partition@400000 { -- label = "user"; -- reg = <0x00400000 0x03b60000>; -+ partition2@200000 { -+ label = "rootfs"; -+ reg = <0x00200000 0x03d60000>; - }; -- partition@3f60000 { -+ partition3@3f60000 { - label = "env"; - reg = <0x03f60000 0x00040000>; - }; -- partition@3fa0000 { -+ partition4@3fa0000 { - label = "u-boot"; - reg = <0x03fa0000 0x00060000>; - }; -+ partition5@0 { -+ label = "firmware"; -+ reg = <0x00000000 0x03f60000>; -+ }; - }; - - ndfc@1,0 { diff --git a/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch b/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch deleted file mode 100644 index e7639d6b4..000000000 --- a/target/linux/ppc40x/patches-3.18/120-usb-isp116x-hcd-add-of-binding.patch +++ /dev/null @@ -1,290 +0,0 @@ ---- a/drivers/usb/host/isp116x-hcd.c -+++ b/drivers/usb/host/isp116x-hcd.c -@@ -1533,6 +1533,7 @@ static struct hc_driver isp116x_hc_drive - - /*----------------------------------------------------------------*/ - -+#ifdef CONFIG_USB_ISP116X_HCD_PLATFORM - static int isp116x_remove(struct platform_device *pdev) - { - struct usb_hcd *hcd = platform_get_drvdata(pdev); -@@ -1711,4 +1712,251 @@ static struct platform_driver isp116x_dr - }, - }; - --module_platform_driver(isp116x_driver); -+static inline int isp116x_platform_register(void) -+{ -+ return platform_driver_register(&isp116x_driver); -+} -+ -+static inline void isp116x_platform_unregister(void) -+{ -+ platform_driver_unregister(&isp116x_driver); -+} -+#else -+static inline int isp116x_platform_register(void) { return 0; }; -+static void isp116x_platform_unregister(void) {}; -+#endif /* CONFIG_USB_ISP116X_PLATFORM */ -+ -+/*-----------------------------------------------------------------*/ -+ -+#ifdef CONFIG_USB_ISP116X_HCD_OF -+ -+/* TODO: rework platform probe instead of using a separate probe */ -+ -+#include -+ -+#ifdef USE_PLATFORM_DELAY -+static void isp116x_of_delay(struct device *ddev, int delay) -+{ -+ ndelay(delay); -+} -+#else -+#define isp116x_of_delay NULL -+#endif -+ -+static int isp116x_of_probe(struct platform_device *op) -+{ -+ struct device_node *dn = op->dev.of_node; -+ struct usb_hcd *hcd; -+ struct isp116x *isp116x; -+ struct resource addr, data; -+ struct isp116x_platform_data *board; -+ void __iomem *addr_reg; -+ void __iomem *data_reg; -+ int irq; -+ int ret = 0; -+ unsigned long irqflags; -+ -+ ret = of_address_to_resource(dn, 0, &data); -+ if (ret) -+ return ret; -+ -+ ret = of_address_to_resource(dn, 1, &addr); -+ if (ret) -+ return ret; -+ -+ board = kzalloc(sizeof(struct isp116x_platform_data), GFP_KERNEL); -+ if (board == NULL) -+ return -ENOMEM; -+ -+ if (!request_mem_region(addr.start, resource_size(&addr), hcd_name)) { -+ ret = -EBUSY; -+ goto err_free_board; -+ } -+ -+ addr_reg = ioremap_nocache(addr.start, resource_size(&addr)); -+ if (addr_reg == NULL) { -+ ret = -ENOMEM; -+ goto err_release_addr; -+ } -+ -+ if (!request_mem_region(data.start, resource_size(&data), hcd_name)) { -+ ret = -EBUSY; -+ goto err_unmap_addr; -+ } -+ -+ data_reg = ioremap_nocache(data.start, resource_size(&data)); -+ if (data_reg == NULL) { -+ ret = -ENOMEM; -+ goto err_release_data; -+ } -+ -+ irq = irq_of_parse_and_map(dn, 0); -+ if (irq == NO_IRQ) { -+ ret = -EINVAL; -+ goto err_unmap_data; -+ } -+ -+ /* allocate and initialize hcd */ -+ hcd = usb_create_hcd(&isp116x_hc_driver, &op->dev, dev_name(&op->dev)); -+ if (!hcd) { -+ ret = -ENOMEM; -+ goto err_irq_dispose; -+ } -+ -+ /* this rsrc_start is bogus */ -+ hcd->rsrc_start = addr.start; -+ isp116x = hcd_to_isp116x(hcd); -+ isp116x->data_reg = data_reg; -+ isp116x->addr_reg = addr_reg; -+ isp116x->board = board; -+ spin_lock_init(&isp116x->lock); -+ INIT_LIST_HEAD(&isp116x->async); -+ -+ board->delay = isp116x_of_delay; -+ if (of_get_property(dn, "sel15Kres", NULL)) -+ board->sel15Kres = 1; -+ if (of_get_property(dn, "oc_enable", NULL)) -+ board->oc_enable = 1; -+ if (of_get_property(dn, "remote_wakeup_enable", NULL)) -+ board->remote_wakeup_enable = 1; -+ -+ if (of_get_property(dn, "int_act_high", NULL)) -+ board->int_act_high = 1; -+ if (of_get_property(dn, "int_edge_triggered", NULL)) -+ board->int_edge_triggered = 1; -+ -+ if (board->int_edge_triggered) -+ irqflags = board->int_act_high ? IRQF_TRIGGER_RISING : -+ IRQF_TRIGGER_FALLING; -+ else -+ irqflags = board->int_act_high ? IRQF_TRIGGER_HIGH : -+ IRQF_TRIGGER_LOW; -+ -+ ret = usb_add_hcd(hcd, irq, irqflags | IRQF_DISABLED); -+ if (ret) -+ goto err_put_hcd; -+ -+ ret = create_debug_file(isp116x); -+ if (ret) { -+ ERR("Couldn't create debugfs entry\n"); -+ goto err_remove_hcd; -+ } -+ -+ return 0; -+ -+ err_remove_hcd: -+ usb_remove_hcd(hcd); -+ err_put_hcd: -+ usb_put_hcd(hcd); -+ err_irq_dispose: -+ irq_dispose_mapping(irq); -+ err_unmap_data: -+ iounmap(data_reg); -+ err_release_data: -+ release_mem_region(data.start, resource_size(&data)); -+ err_unmap_addr: -+ iounmap(addr_reg); -+ err_release_addr: -+ release_mem_region(addr.start, resource_size(&addr)); -+ err_free_board: -+ kfree(board); -+ return ret; -+} -+ -+static int isp116x_of_remove(struct platform_device *op) -+{ -+ struct usb_hcd *hcd = dev_get_drvdata(&op->dev); -+ struct isp116x *isp116x; -+ struct resource res; -+ -+ if (!hcd) -+ return 0; -+ -+ dev_set_drvdata(&op->dev, NULL); -+ -+ isp116x = hcd_to_isp116x(hcd); -+ remove_debug_file(isp116x); -+ usb_remove_hcd(hcd); -+ -+ irq_dispose_mapping(hcd->irq); -+ -+ iounmap(isp116x->data_reg); -+ (void) of_address_to_resource(op->dev.of_node, 0, &res); -+ release_mem_region(res.start, resource_size(&res)); -+ -+ iounmap(isp116x->addr_reg); -+ (void) of_address_to_resource(op->dev.of_node, 1, &res); -+ release_mem_region(res.start, resource_size(&res)); -+ -+ kfree(isp116x->board); -+ usb_put_hcd(hcd); -+ -+ return 0; -+} -+ -+static struct of_device_id isp116x_of_match[] = { -+ { .compatible = "isp116x-hcd", }, -+ {}, -+}; -+ -+static struct platform_driver isp116x_of_platform_driver = { -+ .probe = isp116x_of_probe, -+ .remove = isp116x_of_remove, -+ .driver = { -+ .name = "isp116x-hcd-of", -+ .owner = THIS_MODULE, -+ .of_match_table = isp116x_of_match, -+ }, -+}; -+ -+static int __init isp116x_of_register(void) -+{ -+ return platform_driver_register(&isp116x_of_platform_driver); -+} -+ -+static void __exit isp116x_of_unregister(void) -+{ -+ platform_driver_unregister(&isp116x_of_platform_driver); -+} -+ -+MODULE_DEVICE_TABLE(of, isp116x_of_match); -+ -+#else -+static inline int isp116x_of_register(void) { return 0; }; -+static void isp116x_of_unregister(void) {}; -+#endif /* CONFIG_USB_ISP116X_HCD_OF */ -+ -+/*-----------------------------------------------------------------*/ -+ -+static int __init isp116x_init(void) -+{ -+ int ret; -+ -+ if (usb_disabled()) -+ return -ENODEV; -+ -+ INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); -+ ret = isp116x_platform_register(); -+ if (ret) -+ return ret; -+ -+ ret = isp116x_of_register(); -+ if (ret) -+ goto err_platform_unregister; -+ -+ return 0; -+ -+ err_platform_unregister: -+ isp116x_platform_unregister(); -+ return ret; -+} -+ -+module_init(isp116x_init); -+ -+static void __exit isp116x_cleanup(void) -+{ -+ isp116x_of_unregister(); -+ isp116x_platform_unregister(); -+} -+ -+module_exit(isp116x_cleanup); ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -327,6 +327,24 @@ config USB_ISP116X_HCD - To compile this driver as a module, choose M here: the - module will be called isp116x-hcd. - -+config USB_ISP116X_HCD_PLATFORM -+ bool "ISP116X support for controllers on platform bus" -+ depends on USB_ISP116X_HCD -+ default n if PPC_OF -+ default y -+ ---help--- -+ Enables support for the ISP116x USB controller present on the -+ platform bus. -+ -+config USB_ISP116X_HCD_OF -+ bool "ISP116X support for controllers on OF platform bus" -+ depends on USB_ISP116X_HCD && PPC_OF -+ default y if PPC_OF -+ default n -+ ---help--- -+ Enables support for the ISP116x USB controller present on the -+ OpenFirmware platform bus. -+ - config USB_ISP1760_HCD - tristate "ISP 1760 HCD support" - ---help--- diff --git a/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch b/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch deleted file mode 100644 index 4fb47181b..000000000 --- a/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- a/drivers/usb/host/isp116x.h -+++ b/drivers/usb/host/isp116x.h -@@ -354,21 +354,63 @@ struct isp116x_ep { - #define isp116x_check_platform_delay(h) 0 - #endif - -+#ifdef CONFIG_PPC -+static inline void isp116x_writew(u16 val, void __iomem *addr) -+{ -+ writew(cpu_to_le16(val), addr); -+} -+ -+static inline u16 isp116x_readw(void __iomem *addr) -+{ -+ return le16_to_cpu(readw(addr)); -+} -+ -+static inline void isp116x_raw_writew(u16 val, void __iomem *addr) -+{ -+ writew(cpu_to_le16(val), addr); -+} -+ -+static inline u16 isp116x_raw_readw(void __iomem *addr) -+{ -+ return le16_to_cpu(readw(addr)); -+} -+#else -+static inline void isp116x_writew(u16 val, void __iomem *addr) -+{ -+ writew(val, addr); -+} -+ -+static inline u16 isp116x_readw(void __iomem *addr) -+{ -+ return readw(addr); -+} -+ -+static inline void isp116x_raw_writew(u16 val, void __iomem *addr) -+{ -+ __raw_writew(val, addr); -+} -+ -+static inline u16 isp116x_raw_readw(void __iomem *addr) -+{ -+ return __raw_readw(addr); -+} -+#endif -+ - static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg) - { -- writew(reg & 0xff, isp116x->addr_reg); -+ isp116x_writew(reg & 0xff, isp116x->addr_reg); - isp116x_delay(isp116x, 300); - } - - static inline void isp116x_write_data16(struct isp116x *isp116x, u16 val) - { -- writew(val, isp116x->data_reg); -+ isp116x_writew(val, isp116x->data_reg); - isp116x_delay(isp116x, 150); - } - - static inline void isp116x_raw_write_data16(struct isp116x *isp116x, u16 val) - { -- __raw_writew(val, isp116x->data_reg); -+ isp116x_raw_writew(val, isp116x->data_reg); - isp116x_delay(isp116x, 150); - } - -@@ -376,7 +418,7 @@ static inline u16 isp116x_read_data16(st - { - u16 val; - -- val = readw(isp116x->data_reg); -+ val = isp116x_readw(isp116x->data_reg); - isp116x_delay(isp116x, 150); - return val; - } -@@ -385,16 +427,16 @@ static inline u16 isp116x_raw_read_data1 - { - u16 val; - -- val = __raw_readw(isp116x->data_reg); -+ val = isp116x_raw_readw(isp116x->data_reg); - isp116x_delay(isp116x, 150); - return val; - } - - static inline void isp116x_write_data32(struct isp116x *isp116x, u32 val) - { -- writew(val & 0xffff, isp116x->data_reg); -+ isp116x_writew(val & 0xffff, isp116x->data_reg); - isp116x_delay(isp116x, 150); -- writew(val >> 16, isp116x->data_reg); -+ isp116x_writew(val >> 16, isp116x->data_reg); - isp116x_delay(isp116x, 150); - } - -@@ -402,9 +444,9 @@ static inline u32 isp116x_read_data32(st - { - u32 val; - -- val = (u32) readw(isp116x->data_reg); -+ val = (u32) isp116x_readw(isp116x->data_reg); - isp116x_delay(isp116x, 150); -- val |= ((u32) readw(isp116x->data_reg)) << 16; -+ val |= ((u32) isp116x_readw(isp116x->data_reg)) << 16; - isp116x_delay(isp116x, 150); - return val; - } diff --git a/target/linux/ppc44x/Makefile b/target/linux/ppc44x/Makefile deleted file mode 100644 index 07404d5b4..000000000 --- a/target/linux/ppc44x/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (C) 2007-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=powerpc -BOARD:=ppc44x -BOARDNAME:=AMCC/IBM PPC44x -FEATURES:=squashfs broken -CPU_TYPE:=440 -MAINTAINER:=Imre Kaloz - -KERNEL_PATCHVER:=3.18 - -define Target/Description - Build firmware images for AMCC/IBM PPC44x based boards. -endef - -include $(INCLUDE_DIR)/target.mk - -KERNELNAME:=uImage cuImage.taishan - -$(eval $(call BuildTarget)) diff --git a/target/linux/ppc44x/base-files/etc/inittab b/target/linux/ppc44x/base-files/etc/inittab deleted file mode 100644 index c929c3dea..000000000 --- a/target/linux/ppc44x/base-files/etc/inittab +++ /dev/null @@ -1,4 +0,0 @@ -::sysinit:/etc/init.d/rcS S boot -::shutdown:/etc/init.d/rcS K shutdown -ttyS0::askfirst:/usr/libexec/login.sh -ttyS1::askfirst:/usr/libexec/login.sh diff --git a/target/linux/ppc44x/config-3.18 b/target/linux/ppc44x/config-3.18 deleted file mode 100644 index 842d898c7..000000000 --- a/target/linux/ppc44x/config-3.18 +++ /dev/null @@ -1,251 +0,0 @@ -# CONFIG_40x is not set -CONFIG_440GX=y -CONFIG_44x=y -CONFIG_460EX=y -CONFIG_4xx=y -CONFIG_4xx_SOC=y -# CONFIG_ADVANCED_OPTIONS is not set -# CONFIG_ARCHES is not set -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y -CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_ARCH_HAS_ILOG2_U32=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_ARCH_HAS_WALK_MEMORY=y -CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -# CONFIG_ARCH_RANDOM is not set -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_AUDIT_ARCH=y -# CONFIG_BAMBOO is not set -# CONFIG_BLUESTONE is not set -CONFIG_BOOKE=y -CONFIG_BOOKE_WDT=y -CONFIG_BOUNCE=y -CONFIG_CANYONLANDS=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd" -CONFIG_CMDLINE_BOOL=y -CONFIG_CONSISTENT_SIZE=0x00200000 -CONFIG_CPU_BIG_ENDIAN=y -# CONFIG_CPU_LITTLE_ENDIAN is not set -# CONFIG_CRYPTO_SHA1_PPC is not set -# CONFIG_DEFAULT_UIMAGE is not set -CONFIG_DTC=y -# CONFIG_E200 is not set -CONFIG_EARLY_PRINTK=y -# CONFIG_EBONY is not set -# CONFIG_EIGER is not set -# CONFIG_EPAPR_BOOT is not set -CONFIG_EXTRA_TARGETS="uImage" -# CONFIG_FSL_ULI1575 is not set -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -# CONFIG_GENERIC_CSUM is not set -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_ISA_DMA=y -CONFIG_GENERIC_NVRAM=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -# CONFIG_GENERIC_TBSYNC is not set -CONFIG_GENERIC_TIME_VSYSCALL_OLD=y -# CONFIG_GEN_RTC is not set -# CONFIG_GE_FPGA is not set -# CONFIG_GLACIER is not set -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAS_RAPIDIO is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y -CONFIG_HAVE_LATENCYTOP_SUPPORT=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HW_RANDOM=y -CONFIG_HZ=250 -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -CONFIG_HZ_PERIODIC=y -CONFIG_IBM_EMAC=y -CONFIG_IBM_EMAC_EMAC4=y -CONFIG_IBM_EMAC_POLL_WEIGHT=32 -CONFIG_IBM_EMAC_RGMII=y -CONFIG_IBM_EMAC_RXB=128 -CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256 -CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0 -CONFIG_IBM_EMAC_TAH=y -CONFIG_IBM_EMAC_TXB=128 -CONFIG_IBM_EMAC_ZMII=y -# CONFIG_ICON is not set -CONFIG_INITRAMFS_SOURCE="" -# CONFIG_IOMMU_HELPER is not set -# CONFIG_IPIC is not set -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_ISA_DMA_API=y -# CONFIG_KATMAI is not set -CONFIG_KERNEL_START=0xc0000000 -CONFIG_LIBFDT=y -CONFIG_LOWMEM_SIZE=0x30000000 -# CONFIG_MATH_EMULATION is not set -# CONFIG_MMIO_NVRAM is not set -CONFIG_MODULES_USE_ELF_RELA=y -# CONFIG_MPIC is not set -# CONFIG_MPIC_U3_HT_IRQS is not set -# CONFIG_MPIC_WEIRD is not set -CONFIG_MTD_CFI_ADV_OPTIONS=y -# CONFIG_MTD_CFI_GEOMETRY is not set -CONFIG_MTD_SPLIT_FIRMWARE=y -CONFIG_MTD_SPLIT_UIMAGE_FW=y -CONFIG_NEED_DMA_MAP_STATE=y -# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NEED_SG_DMA_LENGTH=y -# CONFIG_NONSTATIC_KERNEL is not set -CONFIG_NOT_COHERENT_CACHE=y -CONFIG_NR_IRQS=512 -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_MTD=y -CONFIG_OF_NET=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND=y -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PAGE_OFFSET=0xc0000000 -CONFIG_PCI=y -CONFIG_PCIEAER=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_MSI=y -CONFIG_PHYSICAL_START=0x00000000 -CONFIG_PHYS_64BIT=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_PPC=y -CONFIG_PPC32=y -CONFIG_PPC44x_SIMPLE=y -# CONFIG_PPC4xx_HSTA_MSI is not set -CONFIG_PPC4xx_MSI=y -# CONFIG_PPC4xx_OCM is not set -CONFIG_PPC4xx_PCI_EXPRESS=y -# CONFIG_PPC64 is not set -# CONFIG_PPC_47x is not set -# CONFIG_PPC_85xx is not set -# CONFIG_PPC_8xx is not set -# CONFIG_PPC_970_NAP is not set -CONFIG_PPC_ADV_DEBUG_DACS=2 -CONFIG_PPC_ADV_DEBUG_DAC_RANGE=y -CONFIG_PPC_ADV_DEBUG_DVCS=2 -CONFIG_PPC_ADV_DEBUG_IACS=4 -CONFIG_PPC_ADV_DEBUG_REGS=y -# CONFIG_PPC_BOOK3S_32 is not set -# CONFIG_PPC_CELL is not set -# CONFIG_PPC_CELL_NATIVE is not set -# CONFIG_PPC_COPRO_BASE is not set -CONFIG_PPC_DCR=y -# CONFIG_PPC_DCR_MMIO is not set -CONFIG_PPC_DCR_NATIVE=y -# CONFIG_PPC_DOORBELL is not set -# CONFIG_PPC_EARLY_DEBUG is not set -# CONFIG_PPC_EPAPR_HV_PIC is not set -CONFIG_PPC_FPU=y -# CONFIG_PPC_I8259 is not set -# CONFIG_PPC_ICP_HV is not set -# CONFIG_PPC_ICP_NATIVE is not set -# CONFIG_PPC_ICS_RTAS is not set -CONFIG_PPC_INDIRECT_PCI=y -CONFIG_PPC_MMU_NOHASH=y -# CONFIG_PPC_MM_SLICES is not set -# CONFIG_PPC_MPC106 is not set -CONFIG_PPC_MSI_BITMAP=y -CONFIG_PPC_OF=y -# CONFIG_PPC_P7_NAP is not set -CONFIG_PPC_PCI_CHOICE=y -# CONFIG_PPC_RTAS is not set -CONFIG_PPC_UDBG_16550=y -CONFIG_PPC_WERROR=y -# CONFIG_PPC_XICS is not set -# CONFIG_PQ2ADS is not set -# CONFIG_PREEMPT_RCU is not set -CONFIG_PTE_64BIT=y -# CONFIG_RAINIER is not set -CONFIG_RAS=y -# CONFIG_RCU_STALL_COMMON is not set -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SAM440EP is not set -CONFIG_SCHED_HRTICK=y -# CONFIG_SCSI_DMA is not set -# CONFIG_SEQUOIA is not set -CONFIG_SERIAL_8250_EXTENDED=y -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SPARSE_IRQ=y -# CONFIG_SWIOTLB is not set -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_TAISHAN=y -CONFIG_TASK_SIZE=0xc0000000 -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_USB_SUPPORT=y -# CONFIG_WARP is not set -CONFIG_WORD_SIZE=32 -# CONFIG_XILINX_SYSACE is not set -# CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set -CONFIG_XZ_DEC_BCJ=y -CONFIG_XZ_DEC_POWERPC=y -# CONFIG_YOSEMITE is not set diff --git a/target/linux/ppc44x/image/Makefile b/target/linux/ppc44x/image/Makefile deleted file mode 100644 index e2303f6e7..000000000 --- a/target/linux/ppc44x/image/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (C) 2007-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -JFFS2_BLOCKSIZE=256k - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - - -define Image/Prepare - $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(DTS_DIR)/canyonlands.dts > $(KDIR)/openwrt-canyonlands.dtb -endef - -define Image/BuildKernel - cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage -endef - -define Image/Build - $(call Image/Build/$(1),$(1)) -endef - -define Image/Build/jffs2-256k - ( \ - dd if=$(KDIR)/uImage bs=2048k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-jffs2.img -endef - -define Image/Build/squashfs - $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) - ( \ - dd if=$(KDIR)/cuImage.taishan bs=256k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-taishan-$(1).img - ( \ - dd if=$(KDIR)/uImage bs=1920k conv=sync; \ - dd if=$(KDIR)/openwrt-canyonlands.dtb bs=128k conv=sync; \ - dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-canyonlands-$(1).img -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/ppc44x/patches-3.18/001-crypto-amcc-remove-incorrect-__init-__exit-markups.patch b/target/linux/ppc44x/patches-3.18/001-crypto-amcc-remove-incorrect-__init-__exit-markups.patch deleted file mode 100644 index 09b6523dc..000000000 --- a/target/linux/ppc44x/patches-3.18/001-crypto-amcc-remove-incorrect-__init-__exit-markups.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 1eb8a1b340e2f0a562b4987683bbaee4d620bf0a Mon Sep 17 00:00:00 2001 -From: Dmitry Torokhov -Date: Mon, 9 Mar 2015 13:35:39 -0700 -Subject: [PATCH] crypto: amcc - remove incorrect __init/__exit markups - -Even if bus is not hot-pluggable, the devices can be bound and unbound -from the driver via sysfs, so we should not be using __init/__exit -annotations on probe() and remove() methods. The only exception is -drivers registered with platform_driver_probe() which specifically -disables sysfs bind/unbind attributes. - -Signed-off-by: Dmitry Torokhov -Signed-off-by: Herbert Xu ---- - drivers/crypto/amcc/crypto4xx_core.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/crypto/amcc/crypto4xx_core.c -+++ b/drivers/crypto/amcc/crypto4xx_core.c -@@ -1155,7 +1155,7 @@ struct crypto4xx_alg_common crypto4xx_al - /** - * Module Initialization Routine - */ --static int __init crypto4xx_probe(struct platform_device *ofdev) -+static int crypto4xx_probe(struct platform_device *ofdev) - { - int rc; - struct resource res; -@@ -1263,7 +1263,7 @@ err_alloc_dev: - return rc; - } - --static int __exit crypto4xx_remove(struct platform_device *ofdev) -+static int crypto4xx_remove(struct platform_device *ofdev) - { - struct device *dev = &ofdev->dev; - struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev); -@@ -1292,7 +1292,7 @@ static struct platform_driver crypto4xx_ - .of_match_table = crypto4xx_match, - }, - .probe = crypto4xx_probe, -- .remove = __exit_p(crypto4xx_remove), -+ .remove = crypto4xx_remove, - }; - - module_platform_driver(crypto4xx_driver); diff --git a/target/linux/ppc44x/patches-3.18/100-openwrt_flashmap.patch b/target/linux/ppc44x/patches-3.18/100-openwrt_flashmap.patch deleted file mode 100644 index 5a0295ea7..000000000 --- a/target/linux/ppc44x/patches-3.18/100-openwrt_flashmap.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/arch/powerpc/boot/dts/taishan.dts -+++ b/arch/powerpc/boot/dts/taishan.dts -@@ -194,16 +194,12 @@ - #address-cells = <1>; - #size-cells = <1>; - partition@0 { -- label = "kernel"; -- reg = <0x0 0x180000>; -+ label = "firmware"; -+ reg = <0x0 0x3e00000>; - }; -- partition@180000 { -- label = "root"; -- reg = <0x180000 0x200000>; -- }; -- partition@380000 { -- label = "user"; -- reg = <0x380000 0x3bc0000>; -+ partition@3e00000 { -+ label = "diagnostics"; -+ reg = <0x3e00000 0x140000>; - }; - partition@3f40000 { - label = "env"; ---- a/arch/powerpc/boot/dts/canyonlands.dts -+++ b/arch/powerpc/boot/dts/canyonlands.dts -@@ -222,24 +222,12 @@ - #address-cells = <1>; - #size-cells = <1>; - partition@0 { -- label = "kernel"; -- reg = <0x00000000 0x001e0000>; -- }; -- partition@1e0000 { -- label = "dtb"; -- reg = <0x001e0000 0x00020000>; -+ label = "kernel+dtb"; -+ reg = <0x00000000 0x00200000>; - }; - partition@200000 { -- label = "ramdisk"; -- reg = <0x00200000 0x01400000>; -- }; -- partition@1600000 { -- label = "jffs2"; -- reg = <0x01600000 0x00400000>; -- }; -- partition@1a00000 { -- label = "user"; -- reg = <0x01a00000 0x02560000>; -+ label = "rootfs"; -+ reg = <0x00200000 0x03d60000>; - }; - partition@3f60000 { - label = "env"; diff --git a/target/linux/ppc44x/patches-3.18/110-openwrt_dts_cmdline.patch b/target/linux/ppc44x/patches-3.18/110-openwrt_dts_cmdline.patch deleted file mode 100644 index bcf18718e..000000000 --- a/target/linux/ppc44x/patches-3.18/110-openwrt_dts_cmdline.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- a/arch/powerpc/boot/dts/taishan.dts -+++ b/arch/powerpc/boot/dts/taishan.dts -@@ -419,5 +419,6 @@ - - chosen { - linux,stdout-path = "/plb/opb/serial@40000300"; -+ bootargs = "rootfstype=squashfs noinitrd"; - }; - }; diff --git a/target/linux/ppc44x/patches-3.18/900-bootwrapper-parallel-make-fix.patch b/target/linux/ppc44x/patches-3.18/900-bootwrapper-parallel-make-fix.patch deleted file mode 100644 index 313347cea..000000000 --- a/target/linux/ppc44x/patches-3.18/900-bootwrapper-parallel-make-fix.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Jo-Philipp Wich -Date: Wed, 4 Jan 2017 10:35:00 +0100 -Subject: [PATCH] powerpc: boot: fix build with parallel make - -The powerpc boot wrapper Makefile is not parallel build safe, causing fixdep -to fail reading dependency files of the addnote, hack-coff and mktree -utilities when concurrently building different image targets. - -A typical failure looks like: - - Building modules, stage 2. - HOSTCC arch/powerpc/boot/addnote - HOSTCC arch/powerpc/boot/hack-coff - DTC arch/powerpc/boot/taishan.dtb - HOSTCC arch/powerpc/boot/addnote - HOSTCC arch/powerpc/boot/hack-coff - MODPOST 800 modules - fixdep: error opening depfile: arch/powerpc/boot/.hack-coff.d: No such file or directory - scripts/Makefile.host:91: recipe for target 'arch/powerpc/boot/hack-coff' failed - make[5]: *** [arch/powerpc/boot/hack-coff] Error 2 - make[5]: *** Waiting for unfinished jobs.... - fixdep: error opening depfile: arch/powerpc/boot/.addnote.d: No such file or directory - scripts/Makefile.host:91: recipe for target 'arch/powerpc/boot/addnote' failed - make[5]: *** [arch/powerpc/boot/addnote] Error 2 - rm arch/powerpc/boot/taishan.dtb - arch/powerpc/Makefile:263: recipe for target 'cuImage.taishan' failed - make[4]: *** [cuImage.taishan] Error 2 - make[4]: *** Waiting for unfinished jobs.... - -Add a GNU make specific .NOTPARALLEL pseudo rule to enforce sequential building -of the addnote, hack-coff and mktree executables. - -Signed-off-by: Jo-Philipp Wich - ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -194,6 +194,8 @@ wrapper :=$(srctree)/$(src)/wrapper - wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ - $(wrapper) FORCE - -+.NOTPARALLEL: $(addprefix $(obj)/,addnote hack-coff mktree) $(wrapper) -+ - ############# - # Bits for building various flavours of zImage - diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds index 183ab2904..54504c6ee 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -168,6 +168,7 @@ dlink,dwr-921-c1) ucidef_set_led_default "sigstrength" "Signal Strength" "$boardname:green:sigstrength" "0" ;; dir-810l|\ +elecom,wrc-1167ghbk2-s|\ iodata,wn-gx300gr|\ mzk-750dhp|\ mzk-dp150n|\ @@ -385,12 +386,12 @@ tiny-ac) set_usb_led "$boardname:green:usb" ;; tl-wr840n-v4) - set_wifi_led "$boardname:green:wlan" + ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt" ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e" ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" ;; tl-wr841n-v13) - set_wifi_led "$boardname:green:wlan" + ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt" ucidef_set_led_switch "lan1" "lan1" "$boardname:green:lan1" "switch0" "0x2" ucidef_set_led_switch "lan2" "lan2" "$boardname:green:lan2" "switch0" "0x4" ucidef_set_led_switch "lan3" "lan3" "$boardname:green:lan3" "switch0" "0x8" @@ -414,15 +415,16 @@ tplink,c50-v3) ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan2g" "phy0tpt" ucidef_set_led_wlan "wlan5g" "wlan5g" "$boardname:green:wlan5g" "phy1tpt" ;; -tplink,tl-mr3420-v5) +tplink,tl-mr3420-v5|\ +tplink,tl-wr842n-v5) set_usb_led "$boardname:green:usb" - set_wifi_led "$boardname:green:wlan" + ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt" ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e" ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" ;; tplink,tl-wr902ac-v3) set_usb_led "$boardname:green:usb" - ucidef_set_led_netdev "wlan2g" "wlan2g" "$boardname:green:wlan" "wlan0" + ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt" ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x10" ;; u25awf-h1) diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network index 7f732fed9..76b6fe9f5 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -195,16 +195,17 @@ ramips_setup_interfaces() gl-mt300n|\ gl-mt750|\ hg255d|\ - iodata,wn-gx300gr|\ jhr-n805r|\ jhr-n825r|\ jhr-n926r|\ + mikrotik,rbm33g|\ mzk-wdpr|\ rb750gr3|\ rt-n14u|\ tplink,c20-v4|\ tplink,c50-v3|\ tplink,tl-mr3420-v5|\ + tplink,tl-wr842n-v5|\ tl-wr840n-v4|\ tl-wr840n-v5|\ tl-wr841n-v13|\ @@ -225,7 +226,9 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan:3" "2:lan:4" "3:lan:1" "4:lan:2" "0:wan" "6@eth0" ;; - dir-860l-b1) + dir-860l-b1|\ + elecom,wrc-1167ghbk2-s|\ + iodata,wn-gx300gr) ucidef_add_switch "switch0" \ "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0" ;; @@ -306,6 +309,10 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan:2" "2:lan:1" "4:wan" "6@eth0" ;; + phicomm,k2g) + ucidef_add_switch "switch0" \ + "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5:wan" "6@eth0" + ;; re350-v1) ucidef_add_switch "switch0" \ "0:lan" "6@eth0" @@ -449,6 +456,10 @@ ramips_setup_macs() e1700) wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR) ;; + elecom,wrc-1167ghbk2-s|\ + sk-wb8) + wan_mac=$(mtd_get_mac_binary factory 57350) + ;; gl-mt300n-v2|\ whr-g300n) wan_mac=$(mtd_get_mac_binary factory 4) @@ -500,7 +511,8 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_binary factory 4) lan_mac=$(mtd_get_mac_binary factory 46) ;; - oy-0001) + oy-0001|\ + phicomm,k2g) lan_mac=$(mtd_get_mac_binary factory 40) wan_mac=$(mtd_get_mac_binary factory 46) ;; @@ -513,9 +525,6 @@ ramips_setup_macs() 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) ;; diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 965cc0788..2f51add33 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -22,6 +22,7 @@ get_status_led() { dch-m225|\ dir-860l-b1|\ e1700|\ + elecom,wrc-1167ghbk2-s|\ ex2700|\ ex3700|\ fonera20n|\ @@ -42,6 +43,7 @@ get_status_led() { tplink,c20-v4|\ tplink,c50-v3|\ tplink,tl-mr3420-v5|\ + tplink,tl-wr842n-v5|\ tplink,tl-wr902ac-v3|\ tl-wr840n-v4|\ tl-wr840n-v5|\ @@ -159,6 +161,7 @@ get_status_led() { status_led="$boardname:blue:power" ;; dlink,dap-1522-a1|\ + phicomm,k2g|\ k2p|\ m3|\ mir3g|\ @@ -205,6 +208,9 @@ get_status_led() { m4-8M) status_led="m4:blue:status" ;; + mikrotik,rbm33g) + status_led="rbm33g:green:usr" + ;; miwifi-mini|\ zte-q7) status_led="$boardname:red:status" diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 90159bcfa..ffdc5e73e 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -54,6 +54,7 @@ platform_check_image() { dir-810l|\ duzun-dm06|\ e1700|\ + elecom,wrc-1167ghbk2-s|\ esr-9753|\ ew1200|\ ex2700|\ @@ -121,6 +122,7 @@ platform_check_image() { oy-0001|\ pbr-d1|\ pbr-m1|\ + phicomm,k2g|\ psg1208|\ psg1218a|\ psg1218b|\ @@ -255,6 +257,7 @@ platform_check_image() { tplink,c20-v4|\ tplink,c50-v3|\ tplink,tl-mr3420-v5|\ + tplink,tl-wr842n-v5|\ tplink,tl-wr902ac-v3|\ tl-wr840n-v4|\ tl-wr840n-v5|\ @@ -293,6 +296,7 @@ platform_check_image() { nand_do_platform_check "$board" "$1" return $?; ;; + mikrotik,rbm33g|\ re350-v1) [ "$magic" != "01000000" ] && { echo "Invalid image type." @@ -314,6 +318,16 @@ platform_check_image() { return 1 } +platform_pre_upgrade() { + local board=$(board_name) + + case "$board" in + mikrotik,rbm33g) + [ -z "$(rootfs_type)" ] && mtd erase firmware + ;; + esac +} + platform_nand_pre_upgrade() { local board=$(board_name) diff --git a/target/linux/ramips/dts/GB-PC1.dts b/target/linux/ramips/dts/GB-PC1.dts index 609e05896..2ea6582e0 100644 --- a/target/linux/ramips/dts/GB-PC1.dts +++ b/target/linux/ramips/dts/GB-PC1.dts @@ -58,9 +58,6 @@ &sdhci { status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&sdhci_pins>; }; &spi0 { diff --git a/target/linux/ramips/dts/GB-PC2.dts b/target/linux/ramips/dts/GB-PC2.dts index f8f4361e2..ccaf54f3c 100644 --- a/target/linux/ramips/dts/GB-PC2.dts +++ b/target/linux/ramips/dts/GB-PC2.dts @@ -126,7 +126,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "jtag", "rgmii2", "uart3", "wdt"; + ralink,group = "jtag", "rgmii3", "uart3", "wdt"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/K2G.dts b/target/linux/ramips/dts/K2G.dts new file mode 100644 index 000000000..7aed533c3 --- /dev/null +++ b/target/linux/ramips/dts/K2G.dts @@ -0,0 +1,139 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "phicomm,k2g", "ralink,mt7620a-soc"; + model = "Phicomm K2G"; + + aliases { + serial0 = &uartlite; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_blue: blue { + label = "k2g:blue:status"; + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + }; + + yellow { + label = "k2g:yellow:status"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + red { + label = "k2g:red:status"; + gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 1 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 = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + u-boot@0 { + reg = <0x0 0x30000>; + read-only; + }; + + u-boot-env@30000 { + reg = <0x30000 0x10000>; + read-only; + }; + + factory: factory@40000 { + reg = <0x40000 0x10000>; + read-only; + }; + + permanent_config@50000 { + reg = <0x50000 0x50000>; + read-only; + }; + + firmware@a0000 { + reg = <0xa0000 0x760000>; + }; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uartf"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii2_pins &mdio_pins>; + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; + + port@5 { + status = "okay"; + phy-handle = <&phy5>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy5: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii"; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie-bridge { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; + pinctrl-names = "default"; + pinctrl-0 = <&pa_pins>; +}; diff --git a/target/linux/ramips/dts/MIR3G.dts b/target/linux/ramips/dts/MIR3G.dts index 44dfc1796..efe98b0e1 100644 --- a/target/linux/ramips/dts/MIR3G.dts +++ b/target/linux/ramips/dts/MIR3G.dts @@ -66,19 +66,16 @@ }; }; - reg_usb_vbus: reg_usb_vbus { - compatible = "regulator-fixed"; - regulator-name = "usb_vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>; - enable-active-high; + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usbpower { + gpio-export,name = "usbpower"; + gpio-export,output = <1>; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + }; }; - -}; - -&xhci { - vbus-supply = <®_usb_vbus>; }; &nand { diff --git a/target/linux/ramips/dts/Newifi-D1.dts b/target/linux/ramips/dts/Newifi-D1.dts index f5c7c9136..5368b19ea 100644 --- a/target/linux/ramips/dts/Newifi-D1.dts +++ b/target/linux/ramips/dts/Newifi-D1.dts @@ -106,7 +106,7 @@ partition@50000 { label = "firmware"; - reg = <0x50000 0x2000000>; + reg = <0x50000 0x1fb0000>; }; }; }; diff --git a/target/linux/ramips/dts/RBM33G.dts b/target/linux/ramips/dts/RBM33G.dts new file mode 100644 index 000000000..ed2cb841d --- /dev/null +++ b/target/linux/ramips/dts/RBM33G.dts @@ -0,0 +1,156 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "mikrotik,rbm33g", "mediatek,mt7621-soc"; + model = "MikroTik RBM33G"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usr { + label = "rbm33g:green:usr"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + }; + + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + res { + label = "res"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + pcie0_vcc_reg { + compatible = "regulator-fixed"; + regulator-name = "pcie0_vcc"; + + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + regulator-always-on; + }; + + pcie1_vcc_reg { + compatible = "regulator-fixed"; + regulator-name = "pcie1_vcc"; + + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio0 10 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + regulator-always-on; + }; + + pcie2_vcc_reg { + compatible = "regulator-fixed"; + regulator-name = "pcie2_vcc"; + + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + regulator-always-on; + }; + + usb_vcc_reg { + compatible = "regulator-fixed"; + regulator-name = "usb_vcc"; + + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; +}; + + +&spi0 { + status = "okay"; + + w25q40@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <3125000>; + + partition@0 { + label = "routerboot"; + reg = <0x0 0xf000>; + read-only; + }; + + factory: partition@f000 { + label = "factory"; + reg = <0xf000 0x71000>; + read-only; + }; + + }; + + w25q128@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <1>; + spi-max-frequency = <3125000>; + + partition@40000 { + label = "firmware"; + reg = <0x040000 0xFC0000>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x0010>; + mtd-mac-address-increment = <1>; +}; + + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uart2", "wdt"; + ralink,function = "gpio"; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&i2c { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/TL-WR842NV5.dts b/target/linux/ramips/dts/TL-WR842NV5.dts new file mode 100644 index 000000000..397c10637 --- /dev/null +++ b/target/linux/ramips/dts/TL-WR842NV5.dts @@ -0,0 +1,86 @@ +/dts-v1/; + +#include "TPLINK-8M.dtsi" + +#include +#include + +/ { + compatible = "tplink,tl-wr842n-v5", "mediatek,mt7628an-soc"; + model = "TP-Link TL-WR842N v5"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + lan { + label = "tl-wr842n-v5:green:lan"; + gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + }; + + power { + label = "tl-wr842n-v5:green:power"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "tl-wr842n-v5:green:usb"; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "tl-wr842n-v5:green:wan"; + gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; + }; + + wan_amber { + label = "tl-wr842n-v5:amber:wan"; + gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "tl-wr842n-v5:green:wlan"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "tl-wr842n-v5:green:wps"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "i2s", "p2led_an", "refclk", "uart1", "wdt", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/TL-WR902ACV3.dts b/target/linux/ramips/dts/TL-WR902ACV3.dts index 8ff357659..bfdc03b1b 100644 --- a/target/linux/ramips/dts/TL-WR902ACV3.dts +++ b/target/linux/ramips/dts/TL-WR902ACV3.dts @@ -32,6 +32,12 @@ gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; linux,code = ; }; + + wps { + label = "wps"; + gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; }; gpio-leds { @@ -72,7 +78,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "i2c", "i2s", "p0led_an", "p4led_an", "uart1", "wdt", "wled_an"; + ralink,group = "i2c", "i2s", "p0led_an", "p2led_an", "p4led_an", "uart1", "wdt", "wled_an"; ralink,function = "gpio"; }; }; diff --git a/target/linux/ramips/dts/WD03.dts b/target/linux/ramips/dts/WD03.dts index 1552ae825..454e757ce 100644 --- a/target/linux/ramips/dts/WD03.dts +++ b/target/linux/ramips/dts/WD03.dts @@ -6,7 +6,7 @@ #include / { - compatible = "ravpower,wd03", "ralink,mt7620n-soc"; + compatible = "ravpower,wd03", "ralink,mt7620a-soc"; model = "Ravpower WD03"; chosen { @@ -50,10 +50,6 @@ status = "okay"; }; -&i2c { - status = "okay"; -}; - &spi0 { status = "okay"; diff --git a/target/linux/ramips/dts/WRC-1167GHBK2-S.dts b/target/linux/ramips/dts/WRC-1167GHBK2-S.dts new file mode 100644 index 000000000..7b1cfd730 --- /dev/null +++ b/target/linux/ramips/dts/WRC-1167GHBK2-S.dts @@ -0,0 +1,144 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "elecom,wrc-1167ghbk2-s", "mediatek,mt7621-soc"; + model = "ELECOM WRC-1167GHBK2-S"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wlan2g { + label = "wrc-1167ghbk2-s:white:wlan2g"; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + }; + + wlan5g { + label = "wrc-1167ghbk2-s:white:wlan5g"; + gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + }; + + power_green { + label = "wrc-1167ghbk2-s:green:power"; + gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + }; + + power_blue { + label = "wrc-1167ghbk2-s:blue:power"; + gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; + }; + + wps { + label = "wrc-1167ghbk2-s:red:wps"; + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; + }; + + power_red { + label = "wrc-1167ghbk2-s:red:power"; + gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; + }; + }; + + 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 = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&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 0xf20000>; + }; + + partition@f70000 { + label = "user_data"; + reg = <0xf70000 0x80000>; + read-only; + }; + + partition@ff0000 { + label = "NVRAM"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "uart3", "jtag", "wdt"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; + // WRC-1167GHBK2-S has MT7615D for 2.4/5 GHz wifi, + // but it's not supported in OpenWrt. +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/mt7620n.dtsi b/target/linux/ramips/dts/mt7620n.dtsi index 91d124ca7..78d12a268 100644 --- a/target/linux/ramips/dts/mt7620n.dtsi +++ b/target/linux/ramips/dts/mt7620n.dtsi @@ -208,13 +208,6 @@ pinctrl-0 = <&spi_cs1>; }; - i2c_pins: i2c { - i2c { - ralink,group = "i2c"; - ralink,function = "i2c"; - }; - }; - uartlite: uartlite@c00 { compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a"; reg = <0xc00 0x100>; @@ -272,6 +265,13 @@ }; }; + i2c_pins: i2c { + i2c { + ralink,group = "i2c"; + ralink,function = "i2c"; + }; + }; + uartlite_pins: uartlite { uart { ralink,group = "uartlite"; diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index 0655e3530..daca857f6 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -6,23 +6,16 @@ compatible = "mediatek,mt7621-soc"; cpus { - #address-cells = <1>; - #size-cells = <0>; - cpu@0 { - device_type = "cpu"; compatible = "mips,mips1004Kc"; - reg = <0x0>; }; cpu@1 { - device_type = "cpu"; compatible = "mips,mips1004Kc"; - reg = <0x1>; }; }; - cpuintc: cpuintc { + cpuintc: cpuintc@0 { #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; @@ -33,7 +26,7 @@ serial0 = &uartlite; }; - cpuclock: cpuclock { + cpuclock: cpuclock@0 { #clock-cells = <0>; compatible = "fixed-clock"; @@ -41,7 +34,7 @@ clock-frequency = <880000000>; }; - sysclock: sysclock { + sysclock: sysclock@0 { #clock-cells = <0>; compatible = "fixed-clock"; @@ -464,6 +457,8 @@ #address-cells = <3>; #size-cells = <2>; + + device_type = "pci"; }; pcie1 { @@ -471,6 +466,8 @@ #address-cells = <3>; #size-cells = <2>; + + device_type = "pci"; }; pcie2 { @@ -478,6 +475,8 @@ #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 index df2ed37c9..0afd9e323 100644 --- a/target/linux/ramips/dts/mt7628an.dtsi +++ b/target/linux/ramips/dts/mt7628an.dtsi @@ -37,9 +37,9 @@ reg = <0x0 0x100>; }; - watchdog: watchdog@120 { + watchdog: watchdog@100 { compatible = "ralink,mt7628an-wdt", "mediatek,mt7621-wdt"; - reg = <0x120 0x10>; + reg = <0x100 0x30>; resets = <&rstctrl 8>; reset-names = "wdt"; diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/board.h b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/board.h index a7d82f321..33bfc7b95 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/board.h +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/board.h @@ -36,10 +36,27 @@ #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) @@ -50,14 +67,71 @@ #define MSDC_WP_PIN (3) #define MSDC_RST_PIN (4) -struct msdc_hw { - unsigned char clk_src; /* host clock source */ - unsigned long flags; /* hardware capability flags */ +enum { + MSDC_CLKSRC_48MHZ = 0, +// MSDC_CLKSRC_26MHZ = 0, +// MSDC_CLKSRC_197MHZ = 1, +// MSDC_CLKSRC_208MHZ = 2 +}; - /* config gpio pull mode */ - void (*config_gpio_pin)(int type, int pull); +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 */ + diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.c b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.c index d897b1216..ae4ef0fa5 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.c +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.c @@ -32,7 +32,7 @@ * have been modified by MediaTek Inc. All revisions are subject to any receiver's * applicable license agreements with MediaTek Inc. */ - + #include #include #include @@ -48,239 +48,276 @@ #include "mt6575_sd.h" #include +/* mode select */ +u32 dma_size[4]={ + 512, + 512, + 512, + 512 +}; +msdc_mode drv_mode[4]={ + MODE_SIZE_DEP, /* using DMA or not depend on the size */ + MODE_SIZE_DEP, + MODE_SIZE_DEP, + MODE_SIZE_DEP +}; + +#if defined (MT6575_SD_DEBUG) static char cmd_buf[256]; /* for debug zone */ -unsigned int sd_debug_zone[4] = { +static unsigned int sd_debug_zone[4]={ 0, 0, 0, 0 }; -#if defined(MT6575_SD_DEBUG) + /* for driver profile */ #define TICKS_ONE_MS (13000) -u32 gpt_enable; -u32 sdio_pro_enable; /* make sure gpt is enabled */ -u32 sdio_pro_time; /* no more than 30s */ -struct sdio_profile sdio_perfomance = {0}; +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); + 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; + 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); + } - 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; + return ret; } -void msdc_sdio_profile(struct sdio_profile *result) +void msdc_sdio_profile(struct sdio_profile* result) { - struct cmd_profile *cmd; - u32 i; + 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); - 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)); + } + } - /* 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"); + /* CMD53 Tx bytes + block mode */ + for (i=0; i<512; i++) { + cmd = &result->cmd53_tx_byte[i]; + if (cmd->count) { + printk("sdio<%6d><%3dB>_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } + for (i=0; i<100; i++) { + cmd = &result->cmd53_tx_blk[i]; + if (cmd->count) { + printk("sdio<%6d><%3d>B_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } + + printk("sdio === performance dump done ===\n"); } //========= sdio command table =========== void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) { - struct sdio_profile *result = &sdio_perfomance; - struct cmd_profile *cmd; - u32 block; + struct sdio_profile* result = &sdio_perfomance; + struct cmd_profile* cmd; + u32 block; - if (sdio_pro_enable == 0) - return; + if (sdio_pro_enable == 0) { + return; + } - if (opcode == 52) { - cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; - } else if (opcode == 53) { - if (sizes < 512) { - cmd = bRx ? &result->cmd53_rx_byte[sizes] : &result->cmd53_tx_byte[sizes]; - } else { - block = sizes / 512; - if (block >= 99) { - printk("cmd53 error blocks\n"); - while (1) - ; - } - cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; - } - } else { - return; - } - - /* update the members */ - if (ticks > cmd->max_tc) - cmd->max_tc = ticks; - if (cmd->min_tc == 0 || ticks < cmd->min_tc) - cmd->min_tc = ticks; - cmd->tot_tc += ticks; - cmd->tot_bytes += sizes; - cmd->count++; - - if (bRx) - result->total_rx_bytes += sizes; - else - result->total_tx_bytes += sizes; - result->total_tc += ticks; - - /* dump when total_tc > 30s */ - if (result->total_tc >= sdio_pro_time * TICKS_ONE_MS * 1000) { - msdc_sdio_profile(result); - memset(result, 0, sizeof(struct sdio_profile)); - } + if (opcode == 52) { + cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; + } else if (opcode == 53) { + if (sizes < 512) { + cmd = bRx ? &result->cmd53_rx_byte[sizes] : &result->cmd53_tx_byte[sizes]; + } else { + block = sizes / 512; + if (block >= 99) { + printk("cmd53 error blocks\n"); + while(1); + } + cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; + } + } else { + return; + } + + /* update the members */ + if (ticks > cmd->max_tc){ + cmd->max_tc = ticks; + } + if (cmd->min_tc == 0 || ticks < cmd->min_tc) { + cmd->min_tc = ticks; + } + cmd->tot_tc += ticks; + cmd->tot_bytes += sizes; + cmd->count ++; + + if (bRx) { + result->total_rx_bytes += sizes; + } else { + result->total_tx_bytes += sizes; + } + result->total_tc += ticks; + + /* dump when total_tc > 30s */ + if (result->total_tc >= sdio_pro_time * TICKS_ONE_MS * 1000) { + msdc_sdio_profile(result); + memset(result, 0 , sizeof(struct sdio_profile)); + } } //========== driver proc interface =========== static int msdc_debug_proc_read(struct seq_file *s, void *p) { - seq_puts(s, "\n=========================================\n"); - seq_puts(s, "Index<0> + Id + Zone\n"); - seq_puts(s, "-> PWR<9> WRN<8> | FIO<7> OPS<6> FUN<5> CFG<4> | INT<3> RSP<2> CMD<1> DMA<0>\n"); - seq_puts(s, "-> echo 0 3 0x3ff >msdc_bebug -> host[3] debug zone set to 0x3ff\n"); + seq_printf(s, "\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_puts(s, "Index<3> + SDIO_PROFILE + TIME\n"); - seq_puts(s, "-> echo 3 1 0x1E >msdc_bebug -> enable sdio_profile, 30s\n"); + seq_printf(s, "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_puts(s, "=========================================\n\n"); + 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) +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 cmd, p1, p2; int id, zone; - int mode, size; - - if (count == 0) - return -1; - if (count > 255) - count = 255; - - if (copy_from_user(cmd_buf, buf, count)) - return -EFAULT; + 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; + + if(cmd == SD_TOOL_ZONE) { + id = p1; zone = p2; zone &= 0x3ff; printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); - if (id >= 0 && id <= 3) { + if(id >=0 && id<=3){ sd_debug_zone[id] = zone; - } else if (id == 4) { + } + else if(id == 4){ sd_debug_zone[0] = sd_debug_zone[1] = zone; sd_debug_zone[2] = sd_debug_zone[3] = zone; - } else { + } + else{ printk("msdc host_id error when set debug zone\n"); } + } else if (cmd == SD_TOOL_DMA_SIZE) { + id = p1>>4; mode = (p1&0xf); size = p2; + if(id >=0 && id<=3){ + drv_mode[id] = mode; + dma_size[id] = p2; + } + else if(id == 4){ + drv_mode[0] = drv_mode[1] = mode; + drv_mode[2] = drv_mode[3] = mode; + dma_size[0] = dma_size[1] = p2; + dma_size[2] = dma_size[3] = p2; + } + else{ + printk("msdc host_id error when select mode\n"); + } } else if (cmd == SD_TOOL_SDIO_PROFILE) { if (p1 == 1) { /* enable profile */ if (gpt_enable == 0) { // msdc_init_gpt(); /* --- by chhung */ gpt_enable = 1; - } + } sdio_pro_enable = 1; - if (p2 == 0) - p2 = 1; - if (p2 >= 30) - p2 = 30; - sdio_pro_time = p2; - } else if (p1 == 0) { + if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; + sdio_pro_time = p2 ; + } else if (p1 == 0) { /* todo */ sdio_pro_enable = 0; - } + } } - + return count; } @@ -290,17 +327,22 @@ static int msdc_debug_show(struct inode *inode, struct file *file) } static const struct file_operations msdc_debug_fops = { - .owner = THIS_MODULE, - .open = msdc_debug_show, - .read = seq_read, - .write = msdc_debug_proc_write, - .llseek = seq_lseek, - .release = single_release, + .owner = THIS_MODULE, + .open = msdc_debug_show, + .read = seq_read, + .write = msdc_debug_proc_write, + .llseek = seq_lseek, + .release = single_release, }; -void msdc_debug_proc_init(void) -{ - proc_create("msdc_debug", 0660, NULL, &msdc_debug_fops); +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 diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.h b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.h index 5a25a69b0..e58c43129 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.h +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/dbg.h @@ -39,45 +39,47 @@ extern u32 sdio_pro_enable; /* for a type command, e.g. CMD53, 2 blocks */ struct cmd_profile { - u32 max_tc; /* Max tick count */ - u32 min_tc; - u32 tot_tc; /* total tick count */ - u32 tot_bytes; - u32 count; /* the counts of the command */ + u32 max_tc; /* Max tick count */ + u32 min_tc; + u32 tot_tc; /* total tick count */ + u32 tot_bytes; + u32 count; /* the counts of the command */ }; /* dump when total_tc and total_bytes */ struct sdio_profile { - u32 total_tc; /* total tick count of CMD52 and CMD53 */ - u32 total_tx_bytes; /* total bytes of CMD53 Tx */ - u32 total_rx_bytes; /* total bytes of CMD53 Rx */ + 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; - /*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]; + /*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]; }; //========================== -enum msdc_dbg { - SD_TOOL_ZONE = 0, - SD_TOOL_DMA_SIZE = 1, - SD_TOOL_PM_ENABLE = 2, - SD_TOOL_SDIO_PROFILE = 3, -}; +typedef enum { + SD_TOOL_ZONE = 0, + SD_TOOL_DMA_SIZE = 1, + SD_TOOL_PM_ENABLE = 2, + SD_TOOL_SDIO_PROFILE = 3, +} msdc_dbg; -enum msdc_mode { - MODE_PIO = 0, - MODE_DMA = 1, - MODE_SIZE_DEP = 2, -}; +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 */ @@ -102,10 +104,9 @@ extern unsigned int sd_debug_zone[4]; do { \ if (x) { \ printk("[BUG] %s LINE:%d FILE:%s\n", #x, __LINE__, __FILE__); \ - while (1) \ - ; \ + while(1); \ } \ -} while (0) +}while(0) #endif /* end of +++ */ #define N_MSG(evt, fmt, args...) @@ -120,36 +121,36 @@ do { \ #define ERR_MSG(fmt, args...) \ do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ - host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while (0); + printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ + host->id, ##args , __FUNCTION__, __LINE__, current->comm, current->pid); \ +} while(0); #if 1 -//defined CONFIG_MTK_MMC_CD_POLL +//defined CONFIG_MTK_MMC_CD_POLL #define INIT_MSG(fmt, args...) -#define IRQ_MSG(fmt, args...) +#define IRQ_MSG(fmt, args...) #else #define INIT_MSG(fmt, args...) \ do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ - host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while (0); + printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ + host->id, ##args , __FUNCTION__, __LINE__, current->comm, current->pid); \ +} while(0); /* PID in ISR in not corrent */ #define IRQ_MSG(fmt, args...) \ do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ - host->id, ##args, __FUNCTION__, __LINE__); \ -} while (0); + printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ + host->id, ##args , __FUNCTION__, __LINE__); \ +} while(0); #endif -void msdc_debug_proc_init(void); +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); +void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks); #endif diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/mt6575_sd.h b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/mt6575_sd.h index 33fa59a01..bb1f60ee5 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/mt6575_sd.h +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/mt6575_sd.h @@ -37,6 +37,7 @@ #define MT6575_SD_H #include +#include #include // #include /* --- by chhung */ @@ -44,7 +45,7 @@ /*--------------------------------------------------------------------------*/ /* Common Macro */ /*--------------------------------------------------------------------------*/ -#define REG_ADDR(x) (base + OFFSET_##x) +#define REG_ADDR(x) ((volatile u32*)(base + OFFSET_##x)) /*--------------------------------------------------------------------------*/ /* Common Definition */ @@ -88,15 +89,15 @@ #define MSDC_EMMC_BOOTMODE1 (1) /* Reset CMD mode */ enum { - RESP_NONE = 0, - RESP_R1, - RESP_R2, - RESP_R3, - RESP_R4, - RESP_R5, - RESP_R6, - RESP_R7, - RESP_R1B + RESP_NONE = 0, + RESP_R1, + RESP_R2, + RESP_R3, + RESP_R4, + RESP_R5, + RESP_R6, + RESP_R7, + RESP_R1B }; /*--------------------------------------------------------------------------*/ @@ -253,7 +254,7 @@ enum { #define MSDC_PS_CDDEBOUNCE (0xf << 12) /* RW */ #define MSDC_PS_DAT (0xff << 16) /* R */ #define MSDC_PS_CMD (0x1 << 24) /* R */ -#define MSDC_PS_WP (0x1UL << 31) /* R */ +#define MSDC_PS_WP (0x1UL<< 31) /* R */ /* MSDC_INT mask */ #define MSDC_INT_MMCIRQ (0x1 << 0) /* W1C */ @@ -294,14 +295,14 @@ enum { /* MSDC_FIFOCS mask */ #define MSDC_FIFOCS_RXCNT (0xff << 0) /* R */ #define MSDC_FIFOCS_TXCNT (0xff << 16) /* R */ -#define MSDC_FIFOCS_CLR (0x1UL << 31) /* RW */ +#define MSDC_FIFOCS_CLR (0x1UL<< 31) /* RW */ /* SDC_CFG mask */ #define SDC_CFG_SDIOINTWKUP (0x1 << 0) /* RW */ #define SDC_CFG_INSWKUP (0x1 << 1) /* RW */ #define SDC_CFG_BUSWIDTH (0x3 << 16) /* RW */ #define SDC_CFG_SDIO (0x1 << 19) /* RW */ -#define SDC_CFG_SDIOIDE (0x1 << 20) /* RW */ +#define SDC_CFG_SDIOIDE (0x1 << 20) /* RW */ #define SDC_CFG_INTATGAP (0x1 << 21) /* RW */ #define SDC_CFG_DTOC (0xffUL << 24) /* RW */ @@ -314,7 +315,7 @@ enum { #define SDC_CMD_RW (0x1 << 13) /* RW */ #define SDC_CMD_STOP (0x1 << 14) /* RW */ #define SDC_CMD_GOIRQ (0x1 << 15) /* RW */ -#define SDC_CMD_BLKLEN (0xfff << 16) /* RW */ +#define SDC_CMD_BLKLEN (0xfff<< 16) /* RW */ #define SDC_CMD_AUTOCMD (0x3 << 28) /* RW */ #define SDC_CMD_VOLSWTH (0x1 << 30) /* RW */ @@ -396,7 +397,7 @@ enum { #define MSDC_PAD_CTL0_CLKSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL0_CLKIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL0_CLKTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL0_CLKRDSEL (0xffUL << 24) /* RW */ +#define MSDC_PAD_CTL0_CLKRDSEL (0xffUL<< 24) /* RW */ /* MSDC_PAD_CTL1 mask */ #define MSDC_PAD_CTL1_CMDDRVN (0x7 << 0) /* RW */ @@ -407,7 +408,7 @@ enum { #define MSDC_PAD_CTL1_CMDSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL1_CMDIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL1_CMDTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL1_CMDRDSEL (0xffUL << 24) /* RW */ +#define MSDC_PAD_CTL1_CMDRDSEL (0xffUL<< 24) /* RW */ /* MSDC_PAD_CTL2 mask */ #define MSDC_PAD_CTL2_DATDRVN (0x7 << 0) /* RW */ @@ -418,7 +419,7 @@ enum { #define MSDC_PAD_CTL2_DATIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL2_DATSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL2_DATTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL2_DATRDSEL (0xffUL << 24) /* RW */ +#define MSDC_PAD_CTL2_DATRDSEL (0xffUL<< 24) /* RW */ /* MSDC_PAD_TUNE mask */ #define MSDC_PAD_TUNE_DATWRDLY (0x1F << 0) /* RW */ @@ -438,549 +439,564 @@ enum { #define MSDC_DAT_RDDLY1_D6 (0x1F << 16) /* RW */ #define MSDC_DAT_RDDLY1_D7 (0x1F << 24) /* RW */ -#define MSDC_CKGEN_MSDC_DLY_SEL (0x1F << 10) -#define MSDC_INT_DAT_LATCH_CK_SEL (0x7 << 7) -#define MSDC_CKGEN_MSDC_CK_SEL (0x1 << 6) -#define CARD_READY_FOR_DATA (1 << 8) -#define CARD_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) +#define MSDC_CKGEN_MSDC_DLY_SEL (0x1F<<10) +#define MSDC_INT_DAT_LATCH_CK_SEL (0x7<<7) +#define MSDC_CKGEN_MSDC_CK_SEL (0x1<<6) +#define CARD_READY_FOR_DATA (1<<8) +#define CARD_CURRENT_STATE(x) ((x&0x00001E00)>>9) /*--------------------------------------------------------------------------*/ /* Descriptor Structure */ /*--------------------------------------------------------------------------*/ -struct gpd { - u32 hwo:1; /* could be changed by hw */ - u32 bdp:1; - u32 rsv0:6; - u32 chksum:8; - u32 intr:1; - u32 rsv1:15; - void *next; - void *ptr; - u32 buflen:16; - u32 extlen:8; - u32 rsv2:8; - u32 arg; - u32 blknum; - u32 cmd; -}; +typedef struct { + u32 hwo:1; /* could be changed by hw */ + u32 bdp:1; + u32 rsv0:6; + u32 chksum:8; + u32 intr:1; + u32 rsv1:15; + void *next; + void *ptr; + u32 buflen:16; + u32 extlen:8; + u32 rsv2:8; + u32 arg; + u32 blknum; + u32 cmd; +} gpd_t; -struct bd { - u32 eol:1; - u32 rsv0:7; - u32 chksum:8; - u32 rsv1:1; - u32 blkpad:1; - u32 dwpad:1; - u32 rsv2:13; - void *next; - void *ptr; - u32 buflen:16; - u32 rsv3:16; -}; +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 */ /*--------------------------------------------------------------------------*/ -struct msdc_cfg_reg { - u32 msdc:1; - u32 ckpwn:1; - u32 rst:1; - u32 pio:1; - u32 ckdrven:1; - u32 start18v:1; - u32 pass18v:1; - u32 ckstb:1; - u32 ckdiv:8; - u32 ckmod:2; - u32 pad:14; -}; - -struct msdc_iocon_reg { - u32 sdr104cksel:1; - u32 rsmpl:1; - u32 dsmpl:1; - u32 ddlysel:1; - u32 ddr50ckd:1; - u32 dsplsel:1; - u32 pad1:10; - u32 d0spl:1; - u32 d1spl:1; - u32 d2spl:1; - u32 d3spl:1; - u32 d4spl:1; - u32 d5spl:1; - u32 d6spl:1; - u32 d7spl:1; - u32 riscsz:1; - u32 pad2:7; -}; - -struct msdc_ps_reg { - u32 cden:1; - u32 cdsts:1; - u32 pad1:10; - u32 cddebounce:4; - u32 dat:8; - u32 cmd:1; - u32 pad2:6; - u32 wp:1; -}; - -struct msdc_int_reg { - u32 mmcirq:1; - u32 cdsc:1; - u32 pad1:1; - u32 atocmdrdy:1; - u32 atocmdtmo:1; - u32 atocmdcrc:1; - u32 dmaqempty:1; - u32 sdioirq:1; - u32 cmdrdy:1; - u32 cmdtmo:1; - u32 rspcrc:1; - u32 csta:1; - u32 xfercomp:1; - u32 dxferdone:1; - u32 dattmo:1; - u32 datcrc:1; - u32 atocmd19done:1; - u32 pad2:15; -}; - -struct msdc_inten_reg { - u32 mmcirq:1; - u32 cdsc:1; - u32 pad1:1; - u32 atocmdrdy:1; - u32 atocmdtmo:1; - u32 atocmdcrc:1; - u32 dmaqempty:1; - u32 sdioirq:1; - u32 cmdrdy:1; - u32 cmdtmo:1; - u32 rspcrc:1; - u32 csta:1; - u32 xfercomp:1; - u32 dxferdone:1; - u32 dattmo:1; - u32 datcrc:1; - u32 atocmd19done:1; - u32 pad2:15; -}; - -struct msdc_fifocs_reg { - u32 rxcnt:8; - u32 pad1:8; - u32 txcnt:8; - u32 pad2:7; - u32 clr:1; -}; - -struct msdc_txdat_reg { - u32 val; -}; - -struct msdc_rxdat_reg { - u32 val; -}; - -struct sdc_cfg_reg { - u32 sdiowkup:1; - u32 inswkup:1; - u32 pad1:14; - u32 buswidth:2; - u32 pad2:1; - u32 sdio:1; - u32 sdioide:1; - u32 intblkgap:1; - u32 pad4:2; - u32 dtoc:8; -}; - -struct sdc_cmd_reg { - u32 cmd:6; - u32 brk:1; - u32 rsptyp:3; - u32 pad1:1; - u32 dtype:2; - u32 rw:1; - u32 stop:1; - u32 goirq:1; - u32 blklen:12; - u32 atocmd:2; - u32 volswth:1; - u32 pad2:1; -}; - -struct sdc_arg_reg { - u32 arg; -}; - -struct sdc_sts_reg { - u32 sdcbusy:1; - u32 cmdbusy:1; - u32 pad:29; - u32 swrcmpl:1; -}; - -struct sdc_resp0_reg { - u32 val; -}; - -struct sdc_resp1_reg { - u32 val; -}; - -struct sdc_resp2_reg { - u32 val; -}; - -struct sdc_resp3_reg { - u32 val; -}; - -struct sdc_blknum_reg { - u32 num; -}; - -struct sdc_csts_reg { - u32 sts; -}; - -struct sdc_cstsen_reg { - u32 sts; -}; - -struct sdc_datcrcsts_reg { - u32 datcrcsts:8; - u32 ddrcrcsts:4; - u32 pad:20; -}; - -struct emmc_cfg0_reg { - u32 bootstart:1; - u32 bootstop:1; - u32 bootmode:1; - u32 pad1:9; - u32 bootwaidly:3; - u32 bootsupp:1; - u32 pad2:16; -}; - -struct emmc_cfg1_reg { - u32 bootcrctmc:16; - u32 pad:4; - u32 bootacktmc:12; -}; - -struct emmc_sts_reg { - u32 bootcrcerr:1; - u32 bootackerr:1; - u32 bootdattmo:1; - u32 bootacktmo:1; - u32 bootupstate:1; - u32 bootackrcv:1; - u32 bootdatrcv:1; - u32 pad:25; -}; - -struct emmc_iocon_reg { - u32 bootrst:1; - u32 pad:31; -}; - -struct msdc_acmd_resp_reg { - u32 val; -}; - -struct msdc_acmd19_trg_reg { - u32 tunesel:4; - u32 pad:28; -}; - -struct msdc_acmd19_sts_reg { - u32 val; -}; - -struct msdc_dma_sa_reg { - u32 addr; -}; - -struct msdc_dma_ca_reg { - u32 addr; -}; - -struct msdc_dma_ctrl_reg { - u32 start:1; - u32 stop:1; - u32 resume:1; - u32 pad1:5; - u32 mode:1; - u32 pad2:1; - u32 lastbuf:1; - u32 pad3:1; - u32 brustsz:3; - u32 pad4:1; - u32 xfersz:16; -}; - -struct msdc_dma_cfg_reg { - u32 status:1; - u32 decsen:1; - u32 pad1:2; - u32 bdcsen:1; - u32 gpdcsen:1; - u32 pad2:26; -}; - -struct msdc_dbg_sel_reg { - u32 sel:16; - u32 pad2:16; -}; - -struct msdc_dbg_out_reg { - u32 val; -}; - -struct msdc_pad_ctl0_reg { - u32 clkdrvn:3; - u32 rsv0:1; - u32 clkdrvp:3; - u32 rsv1:1; - u32 clksr:1; - u32 rsv2:7; - u32 clkpd:1; - u32 clkpu:1; - u32 clksmt:1; - u32 clkies:1; - u32 clktdsel:4; - u32 clkrdsel:8; -}; - -struct msdc_pad_ctl1_reg { - u32 cmddrvn:3; - u32 rsv0:1; - u32 cmddrvp:3; - u32 rsv1:1; - u32 cmdsr:1; - u32 rsv2:7; - u32 cmdpd:1; - u32 cmdpu:1; - u32 cmdsmt:1; - u32 cmdies:1; - u32 cmdtdsel:4; - u32 cmdrdsel:8; -}; - -struct msdc_pad_ctl2_reg { - u32 datdrvn:3; - u32 rsv0:1; - u32 datdrvp:3; - u32 rsv1:1; - u32 datsr:1; - u32 rsv2:7; - u32 datpd:1; - u32 datpu:1; - u32 datsmt:1; - u32 daties:1; - u32 dattdsel:4; - u32 datrdsel:8; -}; - -struct msdc_pad_tune_reg { - u32 wrrxdly:3; - u32 pad1:5; - u32 rdrxdly:8; - u32 pad2:16; -}; - -struct msdc_dat_rddly0 { - u32 dat0:5; - u32 rsv0:3; - u32 dat1:5; - u32 rsv1:3; - u32 dat2:5; - u32 rsv2:3; - u32 dat3:5; - u32 rsv3:3; -}; - -struct msdc_dat_rddly1 { - u32 dat4:5; - u32 rsv4:3; - u32 dat5:5; - u32 rsv5:3; - u32 dat6:5; - u32 rsv6:3; - u32 dat7:5; - u32 rsv7:3; -}; - -struct msdc_hw_dbg_reg { - u32 dbg0sel:8; - u32 dbg1sel:6; - u32 pad1:2; - u32 dbg2sel:6; - u32 pad2:2; - u32 dbg3sel:6; - u32 pad3:2; -}; - -struct msdc_version_reg { - u32 val; -}; - -struct msdc_eco_ver_reg { - u32 val; -}; +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 { - struct msdc_cfg_reg msdc_cfg; /* base+0x00h */ - struct msdc_iocon_reg msdc_iocon; /* base+0x04h */ - struct msdc_ps_reg msdc_ps; /* base+0x08h */ - struct msdc_int_reg msdc_int; /* base+0x0ch */ - struct msdc_inten_reg msdc_inten; /* base+0x10h */ - struct msdc_fifocs_reg msdc_fifocs; /* base+0x14h */ - struct msdc_txdat_reg msdc_txdat; /* base+0x18h */ - struct msdc_rxdat_reg msdc_rxdat; /* base+0x1ch */ - u32 rsv1[4]; - struct sdc_cfg_reg sdc_cfg; /* base+0x30h */ - struct sdc_cmd_reg sdc_cmd; /* base+0x34h */ - struct sdc_arg_reg sdc_arg; /* base+0x38h */ - struct sdc_sts_reg sdc_sts; /* base+0x3ch */ - struct sdc_resp0_reg sdc_resp0; /* base+0x40h */ - struct sdc_resp1_reg sdc_resp1; /* base+0x44h */ - struct sdc_resp2_reg sdc_resp2; /* base+0x48h */ - struct sdc_resp3_reg sdc_resp3; /* base+0x4ch */ - struct sdc_blknum_reg sdc_blknum; /* base+0x50h */ - u32 rsv2[1]; - struct sdc_csts_reg sdc_csts; /* base+0x58h */ - struct sdc_cstsen_reg sdc_cstsen; /* base+0x5ch */ - struct sdc_datcrcsts_reg sdc_dcrcsta; /* base+0x60h */ - u32 rsv3[3]; - struct emmc_cfg0_reg emmc_cfg0; /* base+0x70h */ - struct emmc_cfg1_reg emmc_cfg1; /* base+0x74h */ - struct emmc_sts_reg emmc_sts; /* base+0x78h */ - struct emmc_iocon_reg emmc_iocon; /* base+0x7ch */ - struct msdc_acmd_resp_reg acmd_resp; /* base+0x80h */ - struct msdc_acmd19_trg_reg acmd19_trg; /* base+0x84h */ - struct msdc_acmd19_sts_reg acmd19_sts; /* base+0x88h */ - u32 rsv4[1]; - struct msdc_dma_sa_reg dma_sa; /* base+0x90h */ - struct msdc_dma_ca_reg dma_ca; /* base+0x94h */ - struct msdc_dma_ctrl_reg dma_ctrl; /* base+0x98h */ - struct msdc_dma_cfg_reg dma_cfg; /* base+0x9ch */ - struct msdc_dbg_sel_reg dbg_sel; /* base+0xa0h */ - struct msdc_dbg_out_reg dbg_out; /* base+0xa4h */ - u32 rsv5[2]; - u32 patch0; /* base+0xb0h */ - u32 patch1; /* base+0xb4h */ - u32 rsv6[10]; - struct msdc_pad_ctl0_reg pad_ctl0; /* base+0xe0h */ - struct msdc_pad_ctl1_reg pad_ctl1; /* base+0xe4h */ - struct msdc_pad_ctl2_reg pad_ctl2; /* base+0xe8h */ - struct msdc_pad_tune_reg pad_tune; /* base+0xech */ - struct msdc_dat_rddly0 dat_rddly0; /* base+0xf0h */ - struct msdc_dat_rddly1 dat_rddly1; /* base+0xf4h */ - struct msdc_hw_dbg_reg hw_dbg; /* base+0xf8h */ - u32 rsv7[1]; - struct msdc_version_reg version; /* base+0x100h */ - struct msdc_eco_ver_reg eco_ver; /* base+0x104h */ + 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 sglen; /* size of scatter list */ - struct scatterlist *sg; /* I/O scatter list */ - u8 mode; /* dma mode */ + 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 */ - struct gpd *gpd; /* pointer to gpd array */ - struct bd *bd; /* pointer to bd array */ - dma_addr_t gpd_addr; /* the physical address of gpd array */ - dma_addr_t bd_addr; /* the physical address of bd array */ + 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 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; + 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; + int error; + spinlock_t lock; /* mutex */ + struct semaphore sem; - u32 blksz; /* host block size */ - void __iomem *base; /* host base address */ - int id; /* host id */ - int pwr_ref; /* core power reference count */ + 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 */ + u32 xfer_size; /* total transferred size */ - struct msdc_dma dma; /* dma channel */ - u32 dma_xfer_size; /* dma transfer size in bytes */ + 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 */ + u32 timeout_ns; /* data timeout ns */ + u32 timeout_clks; /* data timeout clks */ - int irq; /* host interrupt */ + atomic_t abort; /* abort transfer */ - struct delayed_work card_delaywork; + int irq; /* host interrupt */ - struct completion cmd_done; - struct completion xfer_done; - struct pm_message pm_state; + struct tasklet_struct card_tasklet; +#if 0 + struct work_struct card_workqueue; +#else + struct delayed_work card_delaywork; +#endif - u32 mclk; /* mmc subsystem clock */ - u32 hclk; /* host clock speed */ - u32 sclk; /* SD/MS clock speed */ - u8 core_clkon; /* Host core clock on ? */ - u8 card_clkon; /* Card clock on ? */ - u8 core_power; /* core power */ - u8 power_mode; /* host power mode */ - u8 card_inserted; /* card inserted ? */ - u8 suspend; /* host suspended ? */ - u8 app_cmd; /* for app command */ - u32 app_cmd_arg; + 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; }; -#define sdr_read8(reg) readb(reg) -#define sdr_read32(reg) readl(reg) -#define sdr_write8(reg, val) writeb(val, reg) -#define sdr_write32(reg, val) writel(val, reg) - -static inline void sdr_set_bits(void __iomem *reg, u32 bs) +static inline unsigned int uffs(unsigned int x) { - u32 val = readl(reg); + unsigned int r = 1; - val |= bs; - writel(val, reg); + if (!x) + return 0; + if (!(x & 0xffff)) { + x >>= 16; + r += 16; + } + if (!(x & 0xff)) { + x >>= 8; + r += 8; + } + if (!(x & 0xf)) { + x >>= 4; + r += 4; + } + if (!(x & 3)) { + x >>= 2; + r += 2; + } + if (!(x & 1)) { + x >>= 1; + r += 1; + } + return r; } +#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) -static inline void sdr_clr_bits(void __iomem *reg, u32 bs) -{ - u32 val = readl(reg); +#define sdr_set_bits(reg,bs) ((*(volatile u32*)(reg)) |= (u32)(bs)) +#define sdr_clr_bits(reg,bs) ((*(volatile u32*)(reg)) &= ~((u32)(bs))) - val &= ~bs; - writel(val, reg); -} - -static inline void sdr_set_field(void __iomem *reg, u32 field, u32 val) -{ - unsigned int tv = readl(reg); - - tv &= ~field; - tv |= ((val) << (ffs((unsigned int)field) - 1)); - writel(tv, reg); -} - -static inline void sdr_get_field(void __iomem *reg, u32 field, u32 *val) -{ - unsigned int tv = readl(reg); - *val = ((tv & field) >> (ffs((unsigned int)field) - 1)); -} +#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 + diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c index 97ae927d2..d911e1a42 100644 --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c @@ -34,22 +34,38 @@ */ #include -#include -#include +#include +#include #include +#include +#include +#include #include #include - +#include +#include +#include #include +#include +#include #include #include #include +#include -#include +/* +++ by chhung */ +#include +#include +#include +#include +#include -#include "board.h" -#include "dbg.h" -#include "mt6575_sd.h" +#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 @@ -61,11 +77,46 @@ #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" -#if defined(CONFIG_SOC_MT7620) +#define HOST_MAX_NUM (1) /* +/- by chhung */ + +#if defined (CONFIG_SOC_MT7620) #define HOST_MAX_MCLK (48000000) /* +/- by chhung */ -#elif defined(CONFIG_SOC_MT7621) +#elif defined (CONFIG_SOC_MT7621) #define HOST_MAX_MCLK (50000000) /* +/- by chhung */ #endif #define HOST_MIN_MCLK (260000) @@ -79,14 +130,14 @@ #if 0 /* --- by chhung */ #define MSDC_CLKSRC_REG (0xf100000C) -#define PDN_REG (0xF1000010) +#define PDN_REG (0xF1000010) #endif /* end of --- */ #define DEFAULT_DEBOUNCE (8) /* 8 cycles */ #define DEFAULT_DTOC (40) /* data timeout counter. 65536x40 sclk. */ -#define CMD_TIMEOUT (HZ / 10) /* 100ms */ -#define DAT_TIMEOUT (HZ / 2 * 5) /* 500ms x5 */ +#define CMD_TIMEOUT (HZ/10) /* 100ms */ +#define DAT_TIMEOUT (HZ/2 * 5) /* 500ms x5 */ #define MAX_DMA_CNT (64 * 1024 - 512) /* a single transaction for WIFI may be 50K*/ @@ -97,7 +148,9 @@ #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) +#define MAX_REQ_SZ (MAX_SGMT_SZ * 8) + +static int mtk_sw_poll; static int cd_active_low = 1; @@ -109,147 +162,200 @@ static int cd_active_low = 1; #if 0 /* --- by chhung */ /* gate means clock power down */ -static int g_clk_gate = 0; +static int g_clk_gate = 0; #define msdc_gate_clock(id) \ - do { \ - g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ - } while (0) + do { \ + g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ + } while(0) /* not like power down register. 1 means clock on. */ #define msdc_ungate_clock(id) \ - do { \ - g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ - } while (0) + do { \ + g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ + } while(0) -// do we need sync object or not -void msdc_clk_status(int *status) +// do we need sync object or not +void msdc_clk_status(int * status) { - *status = g_clk_gate; + *status = g_clk_gate; } #endif /* end of --- */ /* +++ by chhung */ struct msdc_hw msdc0_hw = { .clk_src = 0, - .flags = MSDC_CD_PIN_EN | MSDC_REMOVABLE, -// .flags = MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE, + .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 */ + 0, /* RESP_NONE */ + 1, /* RESP_R1 */ + 2, /* RESP_R2 */ + 3, /* RESP_R3 */ + 4, /* RESP_R4 */ + 1, /* RESP_R5 */ + 1, /* RESP_R6 */ + 1, /* RESP_R7 */ + 7, /* RESP_R1b */ }; +/* For Inhanced DMA */ +#define msdc_init_gpd_ex(gpd,extlen,cmd,arg,blknum) \ + do { \ + ((gpd_t*)gpd)->extlen = extlen; \ + ((gpd_t*)gpd)->cmd = cmd; \ + ((gpd_t*)gpd)->arg = arg; \ + ((gpd_t*)gpd)->blknum = blknum; \ + }while(0) + +#define msdc_init_bd(bd, blkpad, dwpad, dptr, dlen) \ + do { \ + BUG_ON(dlen > 0xFFFFUL); \ + ((bd_t*)bd)->blkpad = blkpad; \ + ((bd_t*)bd)->dwpad = dwpad; \ + ((bd_t*)bd)->ptr = (void*)dptr; \ + ((bd_t*)bd)->buflen = dlen; \ + }while(0) + #define msdc_txfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_TXCNT) >> 16) #define msdc_rxfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_RXCNT) >> 0) #define msdc_fifo_write32(v) sdr_write32(MSDC_TXDATA, (v)) #define msdc_fifo_write8(v) sdr_write8(MSDC_TXDATA, (v)) #define msdc_fifo_read32() sdr_read32(MSDC_RXDATA) -#define msdc_fifo_read8() sdr_read8(MSDC_RXDATA) +#define msdc_fifo_read8() sdr_read8(MSDC_RXDATA) + #define msdc_dma_on() sdr_clr_bits(MSDC_CFG, MSDC_CFG_PIO) +#define msdc_dma_off() sdr_set_bits(MSDC_CFG, MSDC_CFG_PIO) -#define msdc_retry(expr, retry, cnt) \ - do { \ - int backup = cnt; \ - while (retry) { \ - if (!(expr)) \ - break; \ - if (cnt-- == 0) { \ - retry--; mdelay(1); cnt = backup; \ - } \ - } \ - WARN_ON(retry == 0); \ - } while (0) +#define msdc_retry(expr,retry,cnt) \ + do { \ + int backup = cnt; \ + while (retry) { \ + if (!(expr)) break; \ + if (cnt-- == 0) { \ + retry--; mdelay(1); cnt = backup; \ + } \ + } \ + WARN_ON(retry == 0); \ + } while(0) -static void msdc_reset_hw(struct msdc_host *host) -{ - void __iomem *base = host->base; - - sdr_set_bits(MSDC_CFG, MSDC_CFG_RST); - while (sdr_read32(MSDC_CFG) & MSDC_CFG_RST) - cpu_relax(); -} +#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) + do { \ + volatile u32 val = sdr_read32(MSDC_INT); \ + sdr_write32(MSDC_INT, val); \ + } while(0) #define msdc_clr_fifo() \ - do { \ - int retry = 3, cnt = 1000; \ - sdr_set_bits(MSDC_FIFOCS, MSDC_FIFOCS_CLR); \ - msdc_retry(sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_CLR, retry, cnt); \ - } while (0) + do { \ + int retry = 3, cnt = 1000; \ + sdr_set_bits(MSDC_FIFOCS, MSDC_FIFOCS_CLR); \ + msdc_retry(sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_CLR, retry, cnt); \ + } while(0) #define msdc_irq_save(val) \ - do { \ - val = sdr_read32(MSDC_INTEN); \ - sdr_clr_bits(MSDC_INTEN, val); \ - } while (0) - + do { \ + val = sdr_read32(MSDC_INTEN); \ + sdr_clr_bits(MSDC_INTEN, val); \ + } while(0) + #define msdc_irq_restore(val) \ - do { \ - sdr_set_bits(MSDC_INTEN, val); \ - } while (0) + do { \ + sdr_set_bits(MSDC_INTEN, val); \ + } while(0) /* clock source for host: global */ -#if defined(CONFIG_SOC_MT7620) +#if defined (CONFIG_SOC_MT7620) static u32 hclks[] = {48000000}; /* +/- by chhung */ -#elif defined(CONFIG_SOC_MT7621) +#elif defined (CONFIG_SOC_MT7621) static u32 hclks[] = {50000000}; /* +/- by chhung */ #endif //============================================ // the power for msdc host controller: global -// always keep the VMC on. +// always keep the VMC on. //============================================ #define msdc_vcore_on(host) \ - do { \ - INIT_MSG("[+]VMC ref. count<%d>", ++host->pwr_ref); \ - (void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD"); \ - } while (0) + do { \ + INIT_MSG("[+]VMC ref. count<%d>", ++host->pwr_ref); \ + (void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD"); \ + } while (0) #define msdc_vcore_off(host) \ - do { \ - INIT_MSG("[-]VMC ref. count<%d>", --host->pwr_ref); \ - (void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD"); \ - } while (0) + do { \ + INIT_MSG("[-]VMC ref. count<%d>", --host->pwr_ref); \ + (void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD"); \ + } while (0) //==================================== -// the vdd output for card: global -// always keep the VMCH on. -//==================================== +// the vdd output for card: global +// always keep the VMCH on. +//==================================== #define msdc_vdd_on(host) \ - do { \ - (void)hwPowerOn(MT65XX_POWER_LDO_VMCH, VOL_3300, "SD"); \ - } while (0) + do { \ + (void)hwPowerOn(MT65XX_POWER_LDO_VMCH, VOL_3300, "SD"); \ + } while (0) #define msdc_vdd_off(host) \ - do { \ - (void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"); \ - } while (0) + do { \ + (void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"); \ + } while (0) #define sdc_is_busy() (sdr_read32(SDC_STS) & SDC_STS_SDCBUSY) #define sdc_is_cmd_busy() (sdr_read32(SDC_STS) & SDC_STS_CMDBUSY) -#define sdc_send_cmd(cmd, arg) \ - do { \ - sdr_write32(SDC_ARG, (arg)); \ - sdr_write32(SDC_CMD, (cmd)); \ - } while (0) +#define sdc_send_cmd(cmd,arg) \ + do { \ + sdr_write32(SDC_ARG, (arg)); \ + sdr_write32(SDC_CMD, (cmd)); \ + } while(0) // can modify to read h/w register. //#define is_card_present(h) ((sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1); -#define is_card_present(h) (((struct msdc_host *)(h))->card_inserted) +#define is_card_present(h) (((struct msdc_host*)(h))->card_inserted) /* +++ by chhung */ #ifndef __ASSEMBLY__ @@ -258,1621 +364,2013 @@ static u32 hclks[] = {50000000}; /* +/- by chhung */ #define PHYSADDR(a) ((a) & 0x1fffffff) #endif /* end of +++ */ -static unsigned int msdc_do_command(struct msdc_host *host, - struct mmc_command *cmd, - int tune, - unsigned long timeout); - -static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd); +static unsigned int msdc_do_command(struct msdc_host *host, + struct mmc_command *cmd, + int tune, + unsigned long timeout); + +static int msdc_tune_cmdrsp(struct msdc_host*host,struct mmc_command *cmd); #ifdef MT6575_SD_DEBUG static void msdc_dump_card_status(struct msdc_host *host, u32 status) { -/* N_MSG is currently a no-op */ -#if 0 - static char *state[] = { - "Idle", /* 0 */ - "Ready", /* 1 */ - "Ident", /* 2 */ - "Stby", /* 3 */ - "Tran", /* 4 */ - "Data", /* 5 */ - "Rcv", /* 6 */ - "Prg", /* 7 */ - "Dis", /* 8 */ - "Reserved", /* 9 */ - "Reserved", /* 10 */ - "Reserved", /* 11 */ - "Reserved", /* 12 */ - "Reserved", /* 13 */ - "Reserved", /* 14 */ - "I/O mode", /* 15 */ - }; -#endif - if (status & R1_OUT_OF_RANGE) - N_MSG(RSP, "[CARD_STATUS] Out of Range"); - if (status & R1_ADDRESS_ERROR) - N_MSG(RSP, "[CARD_STATUS] Address Error"); - if (status & R1_BLOCK_LEN_ERROR) - N_MSG(RSP, "[CARD_STATUS] Block Len Error"); - if (status & R1_ERASE_SEQ_ERROR) - N_MSG(RSP, "[CARD_STATUS] Erase Seq Error"); - if (status & R1_ERASE_PARAM) - N_MSG(RSP, "[CARD_STATUS] Erase Param"); - if (status & R1_WP_VIOLATION) - N_MSG(RSP, "[CARD_STATUS] WP Violation"); - if (status & R1_CARD_IS_LOCKED) - N_MSG(RSP, "[CARD_STATUS] Card is Locked"); - if (status & R1_LOCK_UNLOCK_FAILED) - N_MSG(RSP, "[CARD_STATUS] Lock/Unlock Failed"); - if (status & R1_COM_CRC_ERROR) - N_MSG(RSP, "[CARD_STATUS] Command CRC Error"); - if (status & R1_ILLEGAL_COMMAND) - N_MSG(RSP, "[CARD_STATUS] Illegal Command"); - if (status & R1_CARD_ECC_FAILED) - N_MSG(RSP, "[CARD_STATUS] Card ECC Failed"); - if (status & R1_CC_ERROR) - N_MSG(RSP, "[CARD_STATUS] CC Error"); - if (status & R1_ERROR) - N_MSG(RSP, "[CARD_STATUS] Error"); - if (status & R1_UNDERRUN) - N_MSG(RSP, "[CARD_STATUS] Underrun"); - if (status & R1_OVERRUN) - N_MSG(RSP, "[CARD_STATUS] Overrun"); - if (status & R1_CID_CSD_OVERWRITE) - N_MSG(RSP, "[CARD_STATUS] CID/CSD Overwrite"); - if (status & R1_WP_ERASE_SKIP) - N_MSG(RSP, "[CARD_STATUS] WP Eraser Skip"); - if (status & R1_CARD_ECC_DISABLED) - N_MSG(RSP, "[CARD_STATUS] Card ECC Disabled"); - if (status & R1_ERASE_RESET) - N_MSG(RSP, "[CARD_STATUS] Erase Reset"); - if (status & R1_READY_FOR_DATA) - N_MSG(RSP, "[CARD_STATUS] Ready for Data"); - if (status & R1_SWITCH_ERROR) - N_MSG(RSP, "[CARD_STATUS] Switch error"); - if (status & R1_APP_CMD) - N_MSG(RSP, "[CARD_STATUS] App Command"); - - N_MSG(RSP, "[CARD_STATUS] '%s' State", state[R1_CURRENT_STATE(status)]); + static 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)"); + if (resp & (1 << 7)) + N_MSG(RSP, "[OCR] Low Voltage Range"); + if (resp & (1 << 15)) + N_MSG(RSP, "[OCR] 2.7-2.8 volt"); + if (resp & (1 << 16)) + N_MSG(RSP, "[OCR] 2.8-2.9 volt"); + if (resp & (1 << 17)) + N_MSG(RSP, "[OCR] 2.9-3.0 volt"); + if (resp & (1 << 18)) + N_MSG(RSP, "[OCR] 3.0-3.1 volt"); + if (resp & (1 << 19)) + N_MSG(RSP, "[OCR] 3.1-3.2 volt"); + if (resp & (1 << 20)) + N_MSG(RSP, "[OCR] 3.2-3.3 volt"); + if (resp & (1 << 21)) + N_MSG(RSP, "[OCR] 3.3-3.4 volt"); + if (resp & (1 << 22)) + N_MSG(RSP, "[OCR] 3.4-3.5 volt"); + if (resp & (1 << 23)) + N_MSG(RSP, "[OCR] 3.5-3.6 volt"); + if (resp & (1 << 24)) + N_MSG(RSP, "[OCR] Switching to 1.8V Accepted (S18A)"); + if (resp & (1 << 30)) + N_MSG(RSP, "[OCR] Card Capacity Status (CCS)"); + if (resp & (1 << 31)) + N_MSG(RSP, "[OCR] Card Power Up Status (Idle)"); + else + N_MSG(RSP, "[OCR] Card Power Up Status (Busy)"); } static void msdc_dump_rca_resp(struct msdc_host *host, u32 resp) { - u32 status = (((resp >> 15) & 0x1) << 23) | - (((resp >> 14) & 0x1) << 22) | - (((resp >> 13) & 0x1) << 19) | - (resp & 0x1fff); - - N_MSG(RSP, "[RCA] 0x%.4x", resp >> 16); - msdc_dump_card_status(host, status); + u32 status = (((resp >> 15) & 0x1) << 23) | + (((resp >> 14) & 0x1) << 22) | + (((resp >> 13) & 0x1) << 19) | + (resp & 0x1fff); + + N_MSG(RSP, "[RCA] 0x%.4x", resp >> 16); + msdc_dump_card_status(host, status); } static void msdc_dump_io_resp(struct msdc_host *host, u32 resp) { - u32 flags = (resp >> 8) & 0xFF; -#if 0 - char *state[] = {"DIS", "CMD", "TRN", "RFU"}; -#endif - if (flags & (1 << 7)) - N_MSG(RSP, "[IO] COM_CRC_ERR"); - if (flags & (1 << 6)) - N_MSG(RSP, "[IO] Illgal command"); - if (flags & (1 << 3)) - N_MSG(RSP, "[IO] Error"); - if (flags & (1 << 2)) - N_MSG(RSP, "[IO] RFU"); - if (flags & (1 << 1)) - N_MSG(RSP, "[IO] Function number error"); - if (flags & (1 << 0)) - N_MSG(RSP, "[IO] Out of range"); + 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); + 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) { - void __iomem *base = host->base; - u32 timeout, clk_ns; + u32 base = host->base; + u32 timeout, clk_ns; - host->timeout_ns = ns; - host->timeout_clks = clks; + host->timeout_ns = ns; + host->timeout_clks = clks; - clk_ns = 1000000000UL / host->sclk; - timeout = ns / clk_ns + clks; - timeout = timeout >> 16; /* in 65536 sclk cycle unit */ - timeout = timeout > 1 ? timeout - 1 : 0; - timeout = timeout > 255 ? 255 : timeout; + clk_ns = 1000000000UL / host->sclk; + timeout = ns / clk_ns + clks; + timeout = timeout >> 16; /* in 65536 sclk cycle unit */ + timeout = timeout > 1 ? timeout - 1 : 0; + timeout = timeout > 255 ? 255 : timeout; - sdr_set_field(SDC_CFG, SDC_CFG_DTOC, timeout); + sdr_set_field(SDC_CFG, SDC_CFG_DTOC, timeout); - N_MSG(OPS, "Set read data timeout: %dns %dclks -> %d x 65536 cycles", - ns, clks, timeout + 1); + N_MSG(OPS, "Set read data timeout: %dns %dclks -> %d x 65536 cycles", + ns, clks, timeout + 1); } -static void msdc_tasklet_card(struct work_struct *work) +/* msdc_eirq_sdio() will be called when EIRQ(for WIFI) */ +static void msdc_eirq_sdio(void *data) { - struct msdc_host *host = (struct msdc_host *)container_of(work, - struct msdc_host, card_delaywork.work); - void __iomem *base = host->base; - u32 inserted; - u32 status = 0; - //u32 change = 0; + struct msdc_host *host = (struct msdc_host *)data; - spin_lock(&host->lock); + N_MSG(INT, "SDIO EINT"); - status = sdr_read32(MSDC_PS); - if (cd_active_low) - inserted = (status & MSDC_PS_CDSTS) ? 0 : 1; - else - inserted = (status & MSDC_PS_CDSTS) ? 1 : 0; + 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 - change = host->card_inserted ^ inserted; - host->card_inserted = inserted; + tasklet_hi_schedule(&host->card_tasklet); +#else + schedule_delayed_work(&host->card_delaywork, HZ); +#endif +} - if (change && !host->suspend) { - if (inserted) - host->mmc->f_max = HOST_MAX_MCLK; // work around - mmc_detect_change(host->mmc, msecs_to_jiffies(20)); - } +#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 (host->mmc->caps & MMC_CAP_NEEDS_POLL) + inserted = 1; + +#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"); + host->card_inserted = inserted; + + if (!host->suspend) { + host->mmc->f_max = HOST_MAX_MCLK; + mmc_detect_change(host->mmc, msecs_to_jiffies(20)); + } + + IRQ_MSG("card found<%s>", inserted ? "inserted" : "removed"); #endif - spin_unlock(&host->lock); + spin_unlock(&host->lock); } #if 0 /* --- by chhung */ /* For E2 only */ static u8 clk_src_bit[4] = { - 0, 3, 5, 7 + 0, 3, 5, 7 }; -static void msdc_select_clksrc(struct msdc_host *host, unsigned char clksrc) +static void msdc_select_clksrc(struct msdc_host* host, unsigned char clksrc) { - u32 val; - void __iomem *base = host->base; + u32 val; + u32 base = host->base; + + BUG_ON(clksrc > 3); + INIT_MSG("set clock source to <%d>", clksrc); - BUG_ON(clksrc > 3); - INIT_MSG("set clock source to <%d>", clksrc); - - val = sdr_read32(MSDC_CLKSRC_REG); - if (sdr_read32(MSDC_ECO_VER) >= 4) { - val &= ~(0x3 << clk_src_bit[host->id]); - val |= clksrc << clk_src_bit[host->id]; - } else { - val &= ~0x3; val |= clksrc; - } - sdr_write32(MSDC_CLKSRC_REG, val); - - host->hclk = hclks[clksrc]; - host->hw->clk_src = clksrc; + 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; - void __iomem *base = host->base; - u32 mode; - u32 flags; - u32 div; - u32 sclk; - u32 hclk = host->hclk; - //u8 clksrc = hw->clk_src; + //struct msdc_hw *hw = host->hw; + 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_hw(host); - return; - } + if (!hz) { // set mmc system clock to 0 ? + //ERR_MSG("set mclk to 0!!!"); + msdc_reset(); + return; + } - msdc_irq_save(flags); + 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)); - 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; - } - } + 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("================"); - /* set clock mode and divisor */ - sdr_set_field(MSDC_CFG, MSDC_CFG_CKMOD, mode); - sdr_set_field(MSDC_CFG, MSDC_CFG_CKDIV, div); - - /* wait clock stable */ - while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)) - cpu_relax(); - - host->sclk = sclk; - host->mclk = hz; - msdc_set_timeout(host, host->timeout_ns, host->timeout_clks); // need? - - INIT_MSG("================"); - INIT_MSG("!!! Set<%dKHz> Source<%dKHz> -> sclk<%dKHz>", hz / 1000, hclk / 1000, sclk / 1000); - INIT_MSG("================"); - - msdc_irq_restore(flags); + msdc_irq_restore(flags); } /* Fix me. when need to abort */ static void msdc_abort_data(struct msdc_host *host) { - void __iomem *base = host->base; - struct mmc_command *stop = host->mrq->stop; + u32 base = host->base; + struct mmc_command *stop = host->mrq->stop; - ERR_MSG("Need to Abort."); + ERR_MSG("Need to Abort. dma<%d>", host->dma_xfer); + + msdc_reset(); + msdc_clr_fifo(); + msdc_clr_int(); - msdc_reset_hw(host); - msdc_clr_fifo(); - msdc_clr_int(); - - // need to check FIFO count 0 ? - - if (stop) { /* try to stop, but may not success */ - ERR_MSG("stop when abort CMD<%d>", stop->opcode); - (void)msdc_do_command(host, stop, 0, CMD_TIMEOUT); - } - - //if (host->mclk >= 25000000) { - // msdc_set_mclk(host, 0, host->mclk >> 1); - //} + // 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; - void __iomem *base = host->base; - int pull = (mode == MSDC_PIN_PULL_UP) ? GPIO_PULL_UP : GPIO_PULL_DOWN; + 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); - } + /* Config WP pin */ + if (hw->flags & MSDC_WP_PIN_EN) { + if (hw->config_gpio_pin) /* NULL */ + hw->config_gpio_pin(MSDC_WP_PIN, pull); + } - switch (mode) { - case MSDC_PIN_PULL_UP: - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 1); /* Check & FIXME */ - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 0); /* Check & FIXME */ - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 1); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 1); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 0); - break; - case MSDC_PIN_PULL_DOWN: - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 0); /* Check & FIXME */ - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 1); /* Check & FIXME */ - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 0); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 1); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 1); - break; - case MSDC_PIN_PULL_NONE: - default: - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 0); /* Check & FIXME */ - //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 0); /* Check & FIXME */ - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 0); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 0); - break; - } - - N_MSG(CFG, "Pins mode(%d), down(%d), up(%d)", - mode, MSDC_PIN_PULL_DOWN, MSDC_PIN_PULL_UP); + switch (mode) { + case MSDC_PIN_PULL_UP: + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 1); /* Check & FIXME */ + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 0); /* Check & FIXME */ + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 1); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 1); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 0); + break; + case MSDC_PIN_PULL_DOWN: + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 0); /* Check & FIXME */ + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 1); /* Check & FIXME */ + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 0); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 1); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 1); + break; + case MSDC_PIN_PULL_NONE: + default: + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPU, 0); /* Check & FIXME */ + //sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKPD, 0); /* Check & FIXME */ + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPU, 0); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDPD, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPU, 0); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATPD, 0); + break; + } + + N_MSG(CFG, "Pins mode(%d), down(%d), up(%d)", + mode, MSDC_PIN_PULL_DOWN, MSDC_PIN_PULL_UP); } void msdc_pin_reset(struct msdc_host *host, int mode) { - struct msdc_hw *hw = (struct msdc_hw *)host->hw; - void __iomem *base = host->base; - int pull = (mode == MSDC_PIN_PULL_UP) ? GPIO_PULL_UP : GPIO_PULL_DOWN; + struct msdc_hw *hw = (struct msdc_hw *)host->hw; + 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); + /* Config reset pin */ + if (hw->flags & MSDC_RST_PIN_EN) { + if (hw->config_gpio_pin) /* NULL */ + hw->config_gpio_pin(MSDC_RST_PIN, pull); - if (mode == MSDC_PIN_PULL_UP) - sdr_clr_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); - else - sdr_set_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); - } + if (mode == MSDC_PIN_PULL_UP) { + sdr_clr_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); + } else { + sdr_set_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); + } + } } static void msdc_core_power(struct msdc_host *host, int on) { - N_MSG(CFG, "Turn %s %s power (copower: %d -> %d)", - on ? "on" : "off", "core", host->core_power, on); + N_MSG(CFG, "Turn %s %s power (copower: %d -> %d)", + on ? "on" : "off", "core", host->core_power, on); - if (on && host->core_power == 0) { - msdc_vcore_on(host); - host->core_power = 1; - msleep(1); - } else if (!on && host->core_power == 1) { - msdc_vcore_off(host); - host->core_power = 0; - msleep(1); - } + if (on && host->core_power == 0) { + msdc_vcore_on(host); + host->core_power = 1; + msleep(1); + } else if (!on && host->core_power == 1) { + msdc_vcore_off(host); + host->core_power = 0; + msleep(1); + } } static void msdc_host_power(struct msdc_host *host, int on) { - N_MSG(CFG, "Turn %s %s power ", on ? "on" : "off", "host"); + N_MSG(CFG, "Turn %s %s power ", on ? "on" : "off", "host"); - if (on) { - //msdc_core_power(host, 1); // need do card detection. - msdc_pin_reset(host, MSDC_PIN_PULL_UP); - } else { - msdc_pin_reset(host, MSDC_PIN_PULL_DOWN); - //msdc_core_power(host, 0); - } + if (on) { + //msdc_core_power(host, 1); // need do card detection. + msdc_pin_reset(host, MSDC_PIN_PULL_UP); + } else { + msdc_pin_reset(host, MSDC_PIN_PULL_DOWN); + //msdc_core_power(host, 0); + } } static void msdc_card_power(struct msdc_host *host, int on) { - N_MSG(CFG, "Turn %s %s power ", on ? "on" : "off", "card"); + N_MSG(CFG, "Turn %s %s power ", on ? "on" : "off", "card"); - if (on) { - msdc_pin_config(host, MSDC_PIN_PULL_UP); - //msdc_vdd_on(host); // need todo card detection. - msleep(1); - } else { - //msdc_vdd_off(host); - msdc_pin_config(host, MSDC_PIN_PULL_DOWN); - msleep(1); - } + 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); + N_MSG(CFG, "Set power mode(%d)", mode); - if (host->power_mode == MMC_POWER_OFF && mode != MMC_POWER_OFF) { - msdc_host_power(host, 1); - msdc_card_power(host, 1); - } else if (host->power_mode != MMC_POWER_OFF && mode == MMC_POWER_OFF) { - msdc_card_power(host, 0); - msdc_host_power(host, 0); - } - host->power_mode = mode; + if (host->power_mode == MMC_POWER_OFF && mode != MMC_POWER_OFF) { + msdc_host_power(host, 1); + msdc_card_power(host, 1); + } else if (host->power_mode != MMC_POWER_OFF && mode == MMC_POWER_OFF) { + msdc_card_power(host, 0); + msdc_host_power(host, 0); + } + host->power_mode = mode; } #endif /* end of --- */ #ifdef CONFIG_PM /* - register as callback function of WIFI(combo_sdio_register_pm) . - can called by msdc_drv_suspend/resume too. + register as callback function of WIFI(combo_sdio_register_pm) . + can called by msdc_drv_suspend/resume too. */ static void msdc_pm(pm_message_t state, void *data) { - struct msdc_host *host = (struct msdc_host *)data; - int evt = state.event; + struct msdc_host *host = (struct msdc_host *)data; + int evt = state.event; - if (evt == PM_EVENT_USER_RESUME || evt == PM_EVENT_USER_SUSPEND) { - INIT_MSG("USR_%s: suspend<%d> power<%d>", - evt == PM_EVENT_USER_RESUME ? "EVENT_USER_RESUME" : "EVENT_USER_SUSPEND", - host->suspend, host->power_mode); - } + if (evt == PM_EVENT_USER_RESUME || evt == PM_EVENT_USER_SUSPEND) { + INIT_MSG("USR_%s: suspend<%d> power<%d>", + evt == PM_EVENT_USER_RESUME ? "EVENT_USER_RESUME" : "EVENT_USER_SUSPEND", + host->suspend, host->power_mode); + } - if (evt == PM_EVENT_SUSPEND || evt == PM_EVENT_USER_SUSPEND) { - if (host->suspend) /* already suspend */ /* default 0*/ - return; + if (evt == PM_EVENT_SUSPEND || evt == PM_EVENT_USER_SUSPEND) { + if (host->suspend) /* already suspend */ /* default 0*/ + return; - /* for memory card. already power off by mmc */ - if (evt == PM_EVENT_SUSPEND && host->power_mode == MMC_POWER_OFF) - return; + /* for memory card. already power off by mmc */ + if (evt == PM_EVENT_SUSPEND && host->power_mode == MMC_POWER_OFF) + return; - host->suspend = 1; - host->pm_state = state; /* default PMSG_RESUME */ + 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; + } - } 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; - - } + /* 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) +static unsigned int msdc_command_start(struct msdc_host *host, + struct mmc_command *cmd, + int tune, /* not used */ + unsigned long timeout) { - void __iomem *base = host->base; - u32 opcode = cmd->opcode; - u32 rawcmd; - u32 wints = MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | - MSDC_INT_ACMDRDY | MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | - MSDC_INT_ACMD19_DONE; + 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; - 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; + } + } - /* Protocol layer does not provide response type, but our hardware needs - * to know exact type, not just size! - */ - if (opcode == MMC_SEND_OP_COND || opcode == SD_APP_OP_COND) { - resp = RESP_R3; - } else if (opcode == MMC_SET_RELATIVE_ADDR) { - resp = (mmc_cmd_type(cmd) == MMC_CMD_BCR) ? RESP_R6 : RESP_R1; - } else if (opcode == MMC_FAST_IO) { - resp = RESP_R4; - } else if (opcode == MMC_GO_IRQ_STATE) { - resp = RESP_R5; - } else if (opcode == MMC_SELECT_CARD) { - resp = (cmd->arg != 0) ? RESP_R1B : RESP_NONE; - } else if (opcode == SD_IO_RW_DIRECT || opcode == SD_IO_RW_EXTENDED) { - resp = RESP_R1; /* SDIO workaround. */ - } else if (opcode == SD_SEND_IF_COND && (mmc_cmd_type(cmd) == MMC_CMD_BCR)) { - resp = RESP_R1; - } else { - switch (mmc_resp_type(cmd)) { - case MMC_RSP_R1: - resp = RESP_R1; - break; - case MMC_RSP_R1B: - resp = RESP_R1B; - break; - case MMC_RSP_R2: - resp = RESP_R2; - break; - case MMC_RSP_R3: - resp = RESP_R3; - break; - case MMC_RSP_NONE: - default: - resp = RESP_NONE; - break; - } - } + 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); + } - 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; + N_MSG(CMD, "CMD<%d><0x%.8x> Arg<0x%.8x>", opcode , rawcmd, cmd->arg); - 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); - } + tmo = jiffies + timeout; - N_MSG(CMD, "CMD<%d><0x%.8x> Arg<0x%.8x>", opcode, rawcmd, cmd->arg); + 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); - tmo = jiffies + timeout; - - if (opcode == MMC_SEND_STATUS) { - for (;;) { - if (!sdc_is_cmd_busy()) - break; - - if (time_after(jiffies, tmo)) { - ERR_MSG("XXX cmd_busy timeout: before CMD<%d>", opcode); - cmd->error = -ETIMEDOUT; - msdc_reset_hw(host); - goto end; - } - } - } else { - for (;;) { - if (!sdc_is_busy()) - break; - if (time_after(jiffies, tmo)) { - ERR_MSG("XXX sdc_busy timeout: before CMD<%d>", opcode); - cmd->error = -ETIMEDOUT; - msdc_reset_hw(host); - goto end; - } - } - } - - //BUG_ON(in_interrupt()); - host->cmd = cmd; - host->cmd_rsp = resp; - - init_completion(&host->cmd_done); - - sdr_set_bits(MSDC_INTEN, wints); - sdc_send_cmd(rawcmd, cmd->arg); - -end: - return cmd->error; + 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) - __must_hold(&host->lock) +static unsigned int msdc_command_resp(struct msdc_host *host, + struct mmc_command *cmd, + int tune, + unsigned long timeout) { - void __iomem *base = host->base; - u32 opcode = cmd->opcode; - //u32 rawcmd; - u32 resp; - u32 wints = MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | - MSDC_INT_ACMDRDY | MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | - MSDC_INT_ACMD19_DONE; + 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; - 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); - BUG_ON(in_interrupt()); - //init_completion(&host->cmd_done); - //sdr_set_bits(MSDC_INTEN, wints); - - spin_unlock(&host->lock); - if (!wait_for_completion_timeout(&host->cmd_done, 10 * timeout)) { - ERR_MSG("XXX CMD<%d> wait_for_completion timeout ARG<0x%.8x>", opcode, cmd->arg); - cmd->error = -ETIMEDOUT; - msdc_reset_hw(host); - } - spin_lock(&host->lock); - - sdr_clr_bits(MSDC_INTEN, wints); - host->cmd = NULL; + sdr_clr_bits(MSDC_INTEN, wints); + host->cmd = NULL; //end: #ifdef MT6575_SD_DEBUG - switch (resp) { - case RESP_NONE: - N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)", opcode, cmd->error, resp); - break; - case RESP_R2: - N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)= %.8x %.8x %.8x %.8x", - opcode, cmd->error, resp, cmd->resp[0], cmd->resp[1], - cmd->resp[2], cmd->resp[3]); - break; - default: /* Response types 1, 3, 4, 5, 6, 7(1b) */ - N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)= 0x%.8x", - opcode, cmd->error, resp, cmd->resp[0]); - if (cmd->error == 0) { - switch (resp) { - case RESP_R1: - case RESP_R1B: - msdc_dump_card_status(host, cmd->resp[0]); - break; - case RESP_R3: - msdc_dump_ocr_reg(host, cmd->resp[0]); - break; - case RESP_R5: - msdc_dump_io_resp(host, cmd->resp[0]); - break; - case RESP_R6: - msdc_dump_rca_resp(host, cmd->resp[0]); - break; - } - } - break; - } + switch (resp) { + case RESP_NONE: + N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)", opcode, cmd->error, resp); + break; + case RESP_R2: + N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)= %.8x %.8x %.8x %.8x", + opcode, cmd->error, resp, cmd->resp[0], cmd->resp[1], + cmd->resp[2], cmd->resp[3]); + break; + default: /* Response types 1, 3, 4, 5, 6, 7(1b) */ + N_MSG(RSP, "CMD_RSP(%d): %d RSP(%d)= 0x%.8x", + opcode, cmd->error, resp, cmd->resp[0]); + if (cmd->error == 0) { + switch (resp) { + case RESP_R1: + case RESP_R1B: + msdc_dump_card_status(host, cmd->resp[0]); + break; + case RESP_R3: + msdc_dump_ocr_reg(host, cmd->resp[0]); + break; + case RESP_R5: + msdc_dump_io_resp(host, cmd->resp[0]); + break; + case RESP_R6: + msdc_dump_rca_resp(host, cmd->resp[0]); + break; + } + } + break; + } #endif - /* do we need to save card's RCA when SD_SEND_RELATIVE_ADDR */ + /* do we need to save card's RCA when SD_SEND_RELATIVE_ADDR */ - if (!tune) - return cmd->error; + if (!tune) { + return cmd->error; + } - /* memory card CRC */ - if (host->hw->flags & MSDC_REMOVABLE && cmd->error == -EIO) { - if (sdr_read32(SDC_CMD) & 0x1800) { /* check if has data phase */ - msdc_abort_data(host); - } else { - /* do basic: reset*/ - msdc_reset_hw(host); - msdc_clr_fifo(); - msdc_clr_int(); - } - cmd->error = msdc_tune_cmdrsp(host, cmd); - } + /* 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 */ + // check DAT0 + /* if (resp == RESP_R1B) { + while ((sdr_read32(MSDC_PS) & 0x10000) != 0x10000); + } */ + /* CMD12 Error Handle */ + + return cmd->error; +} - 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; } -static unsigned int msdc_do_command(struct msdc_host *host, - struct mmc_command *cmd, - int tune, - unsigned long timeout) +/* + 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) { - if (msdc_command_start(host, cmd, tune, timeout)) - goto end; - - if (msdc_command_resp(host, cmd, tune, timeout)) - goto end; - + 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; +} - N_MSG(CMD, " return<%d> resp<0x%.8x>", cmd->error, cmd->resp[0]); - return cmd->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 +// DMA resume / start / stop static void msdc_dma_resume(struct msdc_host *host) { - void __iomem *base = host->base; + u32 base = host->base; - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_RESUME, 1); + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_RESUME, 1); - N_MSG(DMA, "DMA resume"); + N_MSG(DMA, "DMA resume"); } #endif /* end of --- */ static void msdc_dma_start(struct msdc_host *host) { - void __iomem *base = host->base; - u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; + 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); - 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"); + N_MSG(DMA, "DMA start"); } static void msdc_dma_stop(struct msdc_host *host) { - void __iomem *base = host->base; - //u32 retries=500; - u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; + 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); - 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); - 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 */ - //dsb(); /* --- by chhung */ - sdr_clr_bits(MSDC_INTEN, wints); /* Not just xfer_comp */ - - N_MSG(DMA, "DMA stop"); + N_MSG(DMA, "DMA stop"); } +#if 0 /* --- by chhung */ +/* dump a gpd list */ +static void msdc_dma_dump(struct msdc_host *host, struct msdc_dma *dma) +{ + gpd_t *gpd = dma->gpd; + bd_t *bd = dma->bd; + bd_t *ptr; + int i = 0; + int p_to_v; + + if (dma->mode != MSDC_MODE_DMA_DESC) { + return; + } + + ERR_MSG("try to dump gpd and bd"); + + /* dump gpd */ + ERR_MSG(".gpd<0x%.8x> gpd_phy<0x%.8x>", (int)gpd, (int)dma->gpd_addr); + ERR_MSG("...hwo <%d>", gpd->hwo ); + ERR_MSG("...bdp <%d>", gpd->bdp ); + ERR_MSG("...chksum<0x%.8x>", gpd->chksum ); + //ERR_MSG("...intr <0x%.8x>", gpd->intr ); + ERR_MSG("...next <0x%.8x>", (int)gpd->next ); + ERR_MSG("...ptr <0x%.8x>", (int)gpd->ptr ); + ERR_MSG("...buflen<0x%.8x>", gpd->buflen ); + //ERR_MSG("...extlen<0x%.8x>", gpd->extlen ); + //ERR_MSG("...arg <0x%.8x>", gpd->arg ); + //ERR_MSG("...blknum<0x%.8x>", gpd->blknum ); + //ERR_MSG("...cmd <0x%.8x>", gpd->cmd ); + + /* dump bd */ + ERR_MSG(".bd<0x%.8x> bd_phy<0x%.8x> gpd_ptr<0x%.8x>", (int)bd, (int)dma->bd_addr, (int)gpd->ptr); + ptr = bd; + p_to_v = ((u32)bd - (u32)dma->bd_addr); + while (1) { + ERR_MSG(".bd[%d]", i); i++; + ERR_MSG("...eol <%d>", ptr->eol ); + ERR_MSG("...chksum<0x%.8x>", ptr->chksum ); + //ERR_MSG("...blkpad<0x%.8x>", ptr->blkpad ); + //ERR_MSG("...dwpad <0x%.8x>", ptr->dwpad ); + ERR_MSG("...next <0x%.8x>", (int)ptr->next ); + ERR_MSG("...ptr <0x%.8x>", (int)ptr->ptr ); + ERR_MSG("...buflen<0x%.8x>", (int)ptr->buflen ); + + if (ptr->eol == 1) { + break; + } + + /* find the next bd, virtual address of ptr->next */ + /* don't need to enable when use malloc */ + //BUG_ON( (ptr->next + p_to_v)!=(ptr+1) ); + //ERR_MSG(".next bd<0x%.8x><0x%.8x>", (ptr->next + p_to_v), (ptr+1)); + ptr++; + } + + ERR_MSG("dump gpd and bd finished"); +} +#endif /* end of --- */ + /* calc checksum */ static u8 msdc_dma_calcs(u8 *buf, u32 len) { - u32 i, sum = 0; - - for (i = 0; i < len; i++) - sum += buf[i]; - return 0xFF - (u8)sum; + u32 i, sum = 0; + for (i = 0; i < len; i++) { + sum += buf[i]; + } + return 0xFF - (u8)sum; } /* gpd bd setup + dma registers */ -static void msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) +static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) { - void __iomem *base = host->base; - //u32 i, j, num, bdlen, arg, xfersz; - u32 j, num; - struct scatterlist *sg; - struct gpd *gpd; - struct bd *bd; + 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(host->xfer_size > 65535); - BUG_ON(dma->sglen != 1); - sdr_write32(MSDC_DMA_SA, PHYSADDR(sg_dma_address(sg))); - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_LASTBUF, 1); + 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)); + 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((void __iomem *)(RALINK_MSDC_BASE + 0xa8), sg_dma_len(sg)); + else + sdr_write32((volatile u32*)(RALINK_MSDC_BASE+0xa8), sg_dma_len(sg)); //#endif - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, - MSDC_BRUST_64B); - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 0); - break; - case MSDC_MODE_DMA_DESC: + 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 = (dma->sglen + MAX_BD_PER_GPD - 1) / MAX_BD_PER_GPD; - BUG_ON(num != 1); + /* 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; - gpd = dma->gpd; - bd = dma->bd; + /* 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; - /* modify gpd*/ - //gpd->intr = 0; - gpd->hwo = 1; /* hw will clear it */ - gpd->bdp = 1; - gpd->chksum = 0; /* need to clear first. */ - gpd->chksum = msdc_dma_calcs((u8 *)gpd, 16); + sdr_set_field(MSDC_DMA_CFG, MSDC_DMA_CFG_DECSEN, chksum); + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, dma->burstsz); + sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 1); - /* modify bd*/ - for_each_sg(dma->sg, sg, dma->sglen, j) { - bd[j].blkpad = 0; - bd[j].dwpad = 0; - bd[j].ptr = (void *)sg_dma_address(sg); - bd[j].buflen = sg_dma_len(sg); + sdr_write32(MSDC_DMA_SA, PHYSADDR((u32)dma->gpd_addr)); + break; - if (j == dma->sglen - 1) - bd[j].eol = 1; /* the last bd */ - else - bd[j].eol = 0; + 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)); - bd[j].chksum = 0; /* checksume need to clear first */ - bd[j].chksum = msdc_dma_calcs((u8 *)(&bd[j]), 16); - } + return 0; +} - sdr_set_field(MSDC_DMA_CFG, MSDC_DMA_CFG_DECSEN, 1); - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, - MSDC_BRUST_64B); - sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 1); +static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma, + struct scatterlist *sg, unsigned int sglen) +{ + BUG_ON(sglen > MAX_BD_NUM); /* not support currently */ - sdr_write32(MSDC_DMA_SA, PHYSADDR((u32)dma->gpd_addr)); - break; + 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; - 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)); + 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); + } */ } -static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma, - struct scatterlist *sg, unsigned int sglen) +/* set block number before send command */ +static void msdc_set_blknum(struct msdc_host *host, u32 blknum) { - BUG_ON(sglen > MAX_BD_NUM); /* not support currently */ + u32 base = host->base; - dma->sg = sg; - dma->sglen = sglen; - - dma->mode = MSDC_MODE_DMA_DESC; - - N_MSG(DMA, "DMA mode<%d> sglen<%d> xfersz<%d>", dma->mode, dma->sglen, - host->xfer_size); - - msdc_dma_config(host, dma); + sdr_write32(SDC_BLK_NUM, blknum); } -static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) - __must_hold(&host->lock) +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; - void __iomem *base = host->base; - //u32 intsts = 0; - int read = 1, send_type = 0; + 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 -#define SND_DAT 0 -#define SND_CMD 1 - - BUG_ON(mmc == NULL); - BUG_ON(mrq == NULL); - - host->error = 0; - - cmd = mrq->cmd; - data = mrq->cmd->data; + 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); - //} + //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; - 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; - 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); - } - } + 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 */ - sdr_write32(SDC_BLK_NUM, 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; - msdc_dma_on(); /* enable DMA mode first!! */ - init_completion(&host->xfer_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; - /* start the command first*/ - if (msdc_command_start(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; + } + } - data->sg_count = dma_map_sg(mmc_dev(mmc), data->sg, - data->sg_len, - mmc_get_dma_dir(data)); - msdc_dma_setup(host, &host->dma, data->sg, - data->sg_count); + /* For write case: 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 */ + } - /* then wait command done */ - if (msdc_command_resp(host, cmd, 1, CMD_TIMEOUT) != 0) - goto done; - - /* for read, the data coming too fast, then CRC error - start DMA no business with CRC. */ - //init_completion(&host->xfer_done); - msdc_dma_start(host); - - spin_unlock(&host->lock); - if (!wait_for_completion_timeout(&host->xfer_done, DAT_TIMEOUT)) { - ERR_MSG("XXX CMD<%d> wait xfer_done<%d> timeout!!", cmd->opcode, data->blocks * data->blksz); - ERR_MSG(" DMA_SA = 0x%x", sdr_read32(MSDC_DMA_SA)); - ERR_MSG(" DMA_CA = 0x%x", sdr_read32(MSDC_DMA_CA)); - ERR_MSG(" DMA_CTRL = 0x%x", sdr_read32(MSDC_DMA_CTRL)); - ERR_MSG(" DMA_CFG = 0x%x", sdr_read32(MSDC_DMA_CFG)); - data->error = -ETIMEDOUT; - - msdc_reset_hw(host); - msdc_clr_fifo(); - msdc_clr_int(); - } - spin_lock(&host->lock); - msdc_dma_stop(host); - - /* Last: stop transfer */ - if (data->stop) { - if (msdc_do_command(host, data->stop, 0, CMD_TIMEOUT) != 0) - goto done; - } - } + /* 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; - dma_unmap_sg(mmc_dev(mmc), data->sg, data->sg_len, - mmc_get_dma_dir(data)); - host->blksz = 0; - + if (data != NULL) { + host->data = NULL; + host->dma_xfer = 0; + if (dma != 0) { + msdc_dma_off(); + host->dma.used_bd = 0; + host->dma.used_gpd = 0; + dma_unmap_sg(mmc_dev(mmc), data->sg, data->sg_len, dir); + } + host->blksz = 0; + #if 0 // don't stop twice! - if (host->hw->flags & MSDC_REMOVABLE && data->error) { - msdc_abort_data(host); - /* reset in IRQ, stop command has issued. -> No need */ - } -#endif + if(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); - } + N_MSG(OPS, "CMD<%d> data<%s %s> blksz<%d> block<%d> error<%d>",cmd->opcode, (dma? "dma":"pio"), + (read ? "read ":"write") ,data->blksz, data->blocks, data->error); + } #if 0 /* --- by chhung */ -#if 1 - //if(host->id==1) { - if (send_type == SND_CMD) { - if (cmd->opcode == MMC_SEND_STATUS) { - if ((cmd->resp[0] & CARD_READY_FOR_DATA) || (CARD_CURRENT_STATE(cmd->resp[0]) != 7)) { - N_MSG(OPS, "disable clock, CMD13 IDLE"); - msdc_gate_clock(host->id); - } - } else { - N_MSG(OPS, "disable clock, CMD<%d>", cmd->opcode); - msdc_gate_clock(host->id); - } - } else { - if (read) { - N_MSG(OPS, "disable clock!!! Read CMD<%d>", cmd->opcode); - msdc_gate_clock(host->id); - } - } - //} +#if 1 + //if(host->id==1) { + if(send_type==SND_CMD) { + if(cmd->opcode == MMC_SEND_STATUS) { + if((cmd->resp[0] & CARD_READY_FOR_DATA) ||(CARD_CURRENT_STATE(cmd->resp[0]) != 7)){ + N_MSG(OPS,"disable clock, CMD13 IDLE"); + msdc_gate_clock(host->id); + } + } else { + N_MSG(OPS,"disable clock, CMD<%d>", cmd->opcode); + msdc_gate_clock(host->id); + } + } else { + if(read) { + N_MSG(OPS,"disable clock!!! Read CMD<%d>",cmd->opcode); + msdc_gate_clock(host->id); + } + } + //} #else - msdc_gate_clock(host->id); + msdc_gate_clock(host->id); #endif #endif /* end of --- */ + + if (mrq->cmd->error) host->error = 0x001; + if (mrq->data && mrq->data->error) host->error |= 0x010; + if (mrq->stop && mrq->stop->error) host->error |= 0x100; - if (mrq->cmd->error) - host->error = 0x001; - if (mrq->data && mrq->data->error) - host->error |= 0x010; - if (mrq->stop && mrq->stop->error) - host->error |= 0x100; + //if (host->error) ERR_MSG("host->error<%d>", host->error); - //if (host->error) ERR_MSG("host->error<%d>", host->error); - - return host->error; + return host->error; } static int msdc_app_cmd(struct mmc_host *mmc, struct msdc_host *host) { - struct mmc_command cmd; - struct mmc_request mrq; - u32 err; + struct mmc_command cmd; + struct mmc_request mrq; + u32 err; - memset(&cmd, 0, sizeof(struct mmc_command)); - cmd.opcode = MMC_APP_CMD; -#if 0 /* bug: we meet mmc->card is null when ACMD6 */ - cmd.arg = mmc->card->rca << 16; -#else - cmd.arg = host->app_cmd_arg; -#endif - cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; + memset(&cmd, 0, sizeof(struct mmc_command)); + cmd.opcode = MMC_APP_CMD; +#if 0 /* bug: we meet mmc->card is null when ACMD6 */ + cmd.arg = mmc->card->rca << 16; +#else + cmd.arg = host->app_cmd_arg; +#endif + cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; - memset(&mrq, 0, sizeof(struct mmc_request)); - mrq.cmd = &cmd; cmd.mrq = &mrq; - cmd.data = NULL; + memset(&mrq, 0, sizeof(struct mmc_request)); + mrq.cmd = &cmd; cmd.mrq = &mrq; + cmd.data = NULL; - err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT); - return err; + err = msdc_do_command(host, &cmd, 0, CMD_TIMEOUT); + return err; } -static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd) +static int msdc_tune_cmdrsp(struct msdc_host*host, struct mmc_command *cmd) { - int result = -1; - void __iomem *base = host->base; - u32 rsmpl, cur_rsmpl, orig_rsmpl; - u32 rrdly, cur_rrdly = 0xffffffff, orig_rrdly; - u32 skip = 1; + 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] + ==========================*/ - /* ==== 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); - // 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); - 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; + } - if (host->app_cmd) { - result = msdc_app_cmd(host->mmc, host); - if (result) { - ERR_MSG("TUNE_CMD app_cmd<%d> failed: RESP_RXDLY<%d>,R_SMPL<%d>", - host->mrq->cmd->opcode, cur_rrdly, cur_rsmpl); - continue; - } - } - result = msdc_do_command(host, cmd, 0, CMD_TIMEOUT); // not tune. - ERR_MSG("TUNE_CMD<%d> %s PAD_CMD_RESP_RXDLY[26:22]<%d> R_SMPL[1]<%d>", cmd->opcode, - (result == 0) ? "PASS" : "FAIL", cur_rrdly, cur_rsmpl); - - if (result == 0) - return 0; - if (result != -EIO) { - ERR_MSG("TUNE_CMD<%d> Error<%d> not -EIO", cmd->opcode, result); - return result; - } - - /* should be EIO */ - if (sdr_read32(SDC_CMD) & 0x1800) { /* check if has data phase */ - msdc_abort_data(host); - } - } - - /* Lv2: PAD_CMD_RESP_RXDLY[26:22] */ - cur_rrdly = (orig_rrdly + rrdly + 1) % 32; - sdr_set_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, cur_rrdly); - } while (++rrdly < 32); - - return result; + /* 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); - void __iomem *base = host->base; - u32 ddr = 0; - u32 dcrc = 0; - u32 rxdly, cur_rxdly0, cur_rxdly1; - u32 dsmpl, cur_dsmpl, orig_dsmpl; - u32 cur_dat0, cur_dat1, cur_dat2, cur_dat3; - u32 cur_dat4, cur_dat5, cur_dat6, cur_dat7; - u32 orig_dat0, orig_dat1, orig_dat2, orig_dat3; - u32 orig_dat4, orig_dat5, orig_dat6, orig_dat7; - int result = -1; - u32 skip = 1; + 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); + sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, orig_dsmpl); + + /* Tune Method 2. */ + sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); - /* 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); - 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); - 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); + /* 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; + } + } + } - 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); + cur_rxdly0 = sdr_read32(MSDC_DAT_RDDLY0); + cur_rxdly1 = sdr_read32(MSDC_DAT_RDDLY1); - /* Fix me: result is 0, but dcrc is still exist */ - if (result == 0 && dcrc == 0) { - goto done; - } else { - /* there is a case: command timeout, and data phase not processed */ - if (mrq->data->error != 0 && - mrq->data->error != -EIO) { - ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", - result, mrq->cmd->error, mrq->data->error); - goto done; - } - } - } + /* 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 = sdr_read32(MSDC_DAT_RDDLY0); - cur_rxdly1 = sdr_read32(MSDC_DAT_RDDLY1); + 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); - /* 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); + sdr_write32(MSDC_DAT_RDDLY0, cur_rxdly0); + sdr_write32(MSDC_DAT_RDDLY1, cur_rxdly1); + } while (++rxdly < 32); + done: - return result; + return result; } -static int msdc_tune_bwrite(struct mmc_host *mmc, struct mmc_request *mrq) +static int msdc_tune_bwrite(struct mmc_host *mmc,struct mmc_request *mrq) { - struct msdc_host *host = mmc_priv(mmc); - void __iomem *base = host->base; + 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; + 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] + // 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 ); - 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; + } - /* Tune Method 2. just DAT0 */ - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); - cur_rxdly0 = sdr_read32(MSDC_DAT_RDDLY0); - - /* E1 ECO. YD: Reverse */ - if (sdr_read32(MSDC_ECO_VER) >= 4) { - orig_dat0 = (cur_rxdly0 >> 24) & 0x1F; - orig_dat1 = (cur_rxdly0 >> 16) & 0x1F; - orig_dat2 = (cur_rxdly0 >> 8) & 0x1F; - orig_dat3 = (cur_rxdly0 >> 0) & 0x1F; - } else { - orig_dat0 = (cur_rxdly0 >> 0) & 0x1F; - orig_dat1 = (cur_rxdly0 >> 8) & 0x1F; - orig_dat2 = (cur_rxdly0 >> 16) & 0x1F; - orig_dat3 = (cur_rxdly0 >> 24) & 0x1F; - } - - rxdly = 0; - do { - wrrdly = 0; - do { - for (dsmpl = 0; dsmpl < 2; dsmpl++) { - cur_dsmpl = (orig_dsmpl + dsmpl) % 2; - if (skip == 1) { - skip = 0; - continue; - } - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, cur_dsmpl); - - if (host->app_cmd) { - result = msdc_app_cmd(host->mmc, host); - if (result) { - ERR_MSG("TUNE_BWRITE app_cmd<%d> failed", host->mrq->cmd->opcode); - continue; - } - } - result = msdc_do_request(mmc, mrq); - - ERR_MSG("TUNE_BWRITE<%s> DSPL<%d> DATWRDLY<%d> MSDC_DAT_RDDLY0<0x%x>", - result == 0 ? "PASS" : "FAIL", - cur_dsmpl, cur_wrrdly, cur_rxdly0); - - if (result == 0) { - goto done; - } else { - /* there is a case: command timeout, and data phase not processed */ - if (mrq->data->error != -EIO) { - ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", - result, mrq->cmd->error, mrq->data->error); - goto done; - } - } - } - cur_wrrdly = (orig_wrrdly + wrrdly + 1) % 32; - sdr_set_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, cur_wrrdly); - } while (++wrrdly < 32); - - cur_dat0 = (orig_dat0 + rxdly) % 32; /* only adjust bit-1 for crc */ - cur_dat1 = orig_dat1; - cur_dat2 = orig_dat2; - cur_dat3 = orig_dat3; - - cur_rxdly0 = (cur_dat0 << 24) | (cur_dat1 << 16) | (cur_dat2 << 8) | (cur_dat3 << 0); - sdr_write32(MSDC_DAT_RDDLY0, cur_rxdly0); - } while (++rxdly < 32); + 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; + return result; } static int msdc_get_card_status(struct mmc_host *mmc, struct msdc_host *host, u32 *status) { - struct mmc_command cmd; - struct mmc_request mrq; - u32 err; + struct mmc_command cmd; + struct mmc_request mrq; + u32 err; - memset(&cmd, 0, sizeof(struct mmc_command)); - cmd.opcode = MMC_SEND_STATUS; - if (mmc->card) { - cmd.arg = mmc->card->rca << 16; - } else { - ERR_MSG("cmd13 mmc card is null"); - cmd.arg = host->app_cmd_arg; - } - cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; + memset(&cmd, 0, sizeof(struct mmc_command)); + cmd.opcode = MMC_SEND_STATUS; + if (mmc->card) { + cmd.arg = mmc->card->rca << 16; + } else { + ERR_MSG("cmd13 mmc card is null"); + cmd.arg = host->app_cmd_arg; + } + cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; - memset(&mrq, 0, sizeof(struct mmc_request)); - mrq.cmd = &cmd; cmd.mrq = &mrq; - cmd.data = NULL; + memset(&mrq, 0, sizeof(struct mmc_request)); + mrq.cmd = &cmd; cmd.mrq = &mrq; + cmd.data = NULL; - err = msdc_do_command(host, &cmd, 1, CMD_TIMEOUT); - - if (status) - *status = cmd.resp[0]; - - return err; + err = msdc_do_command(host, &cmd, 1, CMD_TIMEOUT); + + if (status) { + *status = cmd.resp[0]; + } + + return err; } static int msdc_check_busy(struct mmc_host *mmc, struct msdc_host *host) { - u32 err = 0; - u32 status = 0; - - do { - err = msdc_get_card_status(mmc, host, &status); - if (err) - return err; - /* need cmd12? */ - ERR_MSG("cmd<13> resp<0x%x>", status); - } while (R1_CURRENT_STATE(status) == 7); - - return err; + u32 err = 0; + u32 status = 0; + + do { + err = msdc_get_card_status(mmc, host, &status); + if (err) return err; + /* need cmd12? */ + ERR_MSG("cmd<13> resp<0x%x>", status); + } while (R1_CURRENT_STATE(status) == 7); + + return err; } /* failed when msdc_do_request */ static int msdc_tune_request(struct mmc_host *mmc, struct mmc_request *mrq) { - struct msdc_host *host = mmc_priv(mmc); - struct mmc_command *cmd; - struct mmc_data *data; - //u32 base = host->base; - int ret = 0, read; + 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; - cmd = mrq->cmd; - data = mrq->cmd->data; + 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); + } - read = data->flags & MMC_DATA_READ ? 1 : 0; - - if (read) { - if (data->error == -EIO) - ret = msdc_tune_bread(mmc, mrq); - } else { - ret = msdc_check_busy(mmc, host); - if (ret) { - ERR_MSG("XXX cmd13 wait program done failed"); - return ret; - } - /* CRC and TO */ - /* Fix me: don't care card status? */ - ret = msdc_tune_bwrite(mmc, mrq); - } - - return ret; + return ret; } /* ops.request */ -static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq) -{ - struct msdc_host *host = mmc_priv(mmc); +static void msdc_ops_request(struct mmc_host *mmc,struct mmc_request *mrq) +{ + struct msdc_host *host = mmc_priv(mmc); - //=== for sdio profile === + //=== for sdio profile === #if 0 /* --- by chhung */ - u32 old_H32, old_L32, new_H32, new_L32; - u32 ticks = 0, opcode = 0, sizes = 0, bRx = 0; + u32 old_H32, old_L32, new_H32, new_L32; + u32 ticks = 0, opcode = 0, sizes = 0, bRx = 0; #endif /* end of --- */ + + if(host->mrq){ + ERR_MSG("XXX host->mrq<0x%.8x>", (int)host->mrq); + BUG(); + } + + if (!is_card_present(host) || host->power_mode == MMC_POWER_OFF) { + ERR_MSG("cmd<%d> card<%d> power<%d>", mrq->cmd->opcode, is_card_present(host), host->power_mode); + mrq->cmd->error = (unsigned int)-ENOMEDIUM; + +#if 1 + mrq->done(mrq); // call done directly. +#else + mrq->cmd->retries = 0; // please don't retry. + mmc_request_done(mmc, mrq); +#endif - WARN_ON(host->mrq); - - /* start to process */ - spin_lock(&host->lock); + 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); - } + 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; - 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); + } + } - 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; + /* ==== when request done, check if app_cmd ==== */ + if (mrq->cmd->opcode == MMC_APP_CMD) { + host->app_cmd = 1; + host->app_cmd_arg = mrq->cmd->arg; /* save the RCA */ + } else { + host->app_cmd = 0; + //host->app_cmd_arg = 0; + } + + host->mrq = NULL; #if 0 /* --- by chhung */ - //=== for sdio profile === - if (sdio_pro_enable) { - if (mrq->cmd->opcode == 52 || mrq->cmd->opcode == 53) { - GPT_GetCounter64(&new_L32, &new_H32); - ticks = msdc_time_calc(old_L32, old_H32, new_L32, new_H32); - - opcode = mrq->cmd->opcode; - if (mrq->cmd->data) { - sizes = mrq->cmd->data->blocks * mrq->cmd->data->blksz; - bRx = mrq->cmd->data->flags & MMC_DATA_READ ? 1 : 0; - } else { - bRx = mrq->cmd->arg & 0x80000000 ? 1 : 0; - } - - if (!mrq->cmd->error) - msdc_performance(opcode, sizes, bRx, ticks); - } - } + //=== for sdio profile === + if (sdio_pro_enable) { + if (mrq->cmd->opcode == 52 || mrq->cmd->opcode == 53) { + GPT_GetCounter64(&new_L32, &new_H32); + ticks = msdc_time_calc(old_L32, old_H32, new_L32, new_H32); + + opcode = mrq->cmd->opcode; + if (mrq->cmd->data) { + sizes = mrq->cmd->data->blocks * mrq->cmd->data->blksz; + bRx = mrq->cmd->data->flags & MMC_DATA_READ ? 1 : 0 ; + } else { + bRx = mrq->cmd->arg & 0x80000000 ? 1 : 0; + } + + if (!mrq->cmd->error) { + msdc_performance(opcode, sizes, bRx, ticks); + } + } + } #endif /* end of --- */ - spin_unlock(&host->lock); - - mmc_request_done(mmc, mrq); - - return; + spin_unlock(&host->lock); + + mmc_request_done(mmc, mrq); + + return; } /* called by ops.set_ios */ static void msdc_set_buswidth(struct msdc_host *host, u32 width) { - void __iomem *base = host->base; - u32 val = sdr_read32(SDC_CFG); + 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); - 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); + 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); - void __iomem *base = host->base; - u32 ddr = 0; + 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" - }; + static char *vdd[] = { + "1.50v", "1.55v", "1.60v", "1.65v", "1.70v", "1.80v", "1.90v", + "2.00v", "2.10v", "2.20v", "2.30v", "2.40v", "2.50v", "2.60v", + "2.70v", "2.80v", "2.90v", "3.00v", "3.10v", "3.20v", "3.30v", + "3.40v", "3.50v", "3.60v" + }; + static char *power_mode[] = { + "OFF", "UP", "ON" + }; + static char *bus_mode[] = { + "UNKNOWN", "OPENDRAIN", "PUSHPULL" + }; + static char *timing[] = { + "LEGACY", "MMC_HS", "SD_HS" + }; - printk("SET_IOS: CLK(%dkHz), BUS(%s), BW(%u), PWR(%s), VDD(%s), TIMING(%s)", - ios->clock / 1000, bus_mode[ios->bus_mode], - (ios->bus_width == MMC_BUS_WIDTH_4) ? 4 : 1, - power_mode[ios->power_mode], vdd[ios->vdd], timing[ios->timing]); + printk("SET_IOS: CLK(%dkHz), BUS(%s), BW(%u), PWR(%s), VDD(%s), TIMING(%s)", + ios->clock / 1000, bus_mode[ios->bus_mode], + (ios->bus_width == MMC_BUS_WIDTH_4) ? 4 : 1, + power_mode[ios->power_mode], vdd[ios->vdd], timing[ios->timing]); #endif - msdc_set_buswidth(host, ios->bus_width); + 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; + } - /* Power control ??? */ - switch (ios->power_mode) { - case MMC_POWER_OFF: - case MMC_POWER_UP: - // msdc_set_power_mode(host, ios->power_mode); /* --- by chhung */ - break; - case MMC_POWER_ON: - host->power_mode = MMC_POWER_ON; - break; - default: - break; - } - - /* Clock control */ - if (host->mclk != ios->clock) { - if (ios->clock > 25000000) { - //if (!(host->hw->flags & MSDC_REMOVABLE)) { - INIT_MSG("SD data latch edge<%d>", MSDC_SMPL_FALLING); - sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, - MSDC_SMPL_FALLING); - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, - MSDC_SMPL_FALLING); - //} /* for tuning debug */ - } else { /* default value */ - sdr_write32(MSDC_IOCON, 0x00000000); - // sdr_write32(MSDC_DAT_RDDLY0, 0x00000000); - sdr_write32(MSDC_DAT_RDDLY0, 0x10101010); // for MT7620 E2 and afterward - sdr_write32(MSDC_DAT_RDDLY1, 0x00000000); - // sdr_write32(MSDC_PAD_TUNE, 0x00000000); - sdr_write32(MSDC_PAD_TUNE, 0x84101010); // for MT7620 E2 and afterward - } - msdc_set_mclk(host, ddr, ios->clock); - } + /* 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); - void __iomem *base = host->base; - unsigned long flags; - int ro = 0; + 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; + 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); - void __iomem *base = host->base; - unsigned long flags; - int present = 1; + 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 */ + /* for sdio, MSDC_REMOVABLE not set, always return 1 */ + if (!(host->hw->flags & MSDC_REMOVABLE)) { + /* For sdio, read H/W always get<1>, but may timeout some times */ #if 1 - host->card_inserted = 1; - return 1; + host->card_inserted = 1; + return 1; #else - host->card_inserted = (host->pm_state.event == PM_EVENT_USER_RESUME) ? 1 : 0; - INIT_MSG("sdio ops_get_cd<%d>", host->card_inserted); - return host->card_inserted; + host->card_inserted = (host->pm_state.event == PM_EVENT_USER_RESUME) ? 1 : 0; + INIT_MSG("sdio ops_get_cd<%d>", host->card_inserted); + return host->card_inserted; #endif - } + } - /* MSDC_CD_PIN_EN set for card */ - if (host->hw->flags & MSDC_CD_PIN_EN) { - spin_lock_irqsave(&host->lock, flags); -#if 0 - present = host->card_inserted; /* why not read from H/W: Fix me*/ + /* MSDC_CD_PIN_EN set for card */ + if (host->hw->flags & MSDC_CD_PIN_EN) { + spin_lock_irqsave(&host->lock, flags); +#if 0 + present = host->card_inserted; /* why not read from H/W: Fix me*/ #else - // CD - if (cd_active_low) - present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1; - else - present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 1 : 0; - host->card_inserted = present; -#endif - spin_unlock_irqrestore(&host->lock, flags); - } else { - present = 0; /* TODO? Check DAT3 pins for card detection */ - } + // CD + if (cd_active_low) + present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1; + else + present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 1 : 0; + if (host->mmc->caps & MMC_CAP_NEEDS_POLL) + present = 1; + host->card_inserted = present; +#endif + spin_unlock_irqrestore(&host->lock, flags); + } else { + present = 0; /* TODO? Check DAT3 pins for card detection */ + } - INIT_MSG("ops_get_cd return<%d>", present); - return present; + 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, + .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, }; /*--------------------------------------------------------------------------*/ @@ -1880,135 +2378,150 @@ static struct mmc_host_ops mt_msdc_ops = { /*--------------------------------------------------------------------------*/ static irqreturn_t msdc_irq(int irq, void *dev_id) { - struct msdc_host *host = (struct msdc_host *)dev_id; - struct mmc_data *data = host->data; - struct mmc_command *cmd = host->cmd; - void __iomem *base = host->base; + 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 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; - 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 (host->mmc->caps & MMC_CAP_NEEDS_POLL) - return IRQ_HANDLED; - IRQ_MSG("MSDC_INT_CDSC irq<0x%.8x>", intsts); - schedule_delayed_work(&host->card_delaywork, HZ); - /* tuning when plug card ? */ - } - - /* sdio interrupt */ - if (intsts & MSDC_INT_SDIOIRQ) { - IRQ_MSG("XXX MSDC_INT_SDIOIRQ"); /* seems not sdio irq */ - //mmc_signal_sdio_irq(host->mmc); - } - - /* transfer complete interrupt */ - if (data != NULL) { - if (inten & MSDC_INT_XFER_COMPL) { - data->bytes_xfered = host->xfer_size; - complete(&host->xfer_done); - } - - if (intsts & datsts) { - /* do basic reset, or stop command will sdc_busy */ - msdc_reset_hw(host); - msdc_clr_fifo(); - msdc_clr_int(); - - if (intsts & MSDC_INT_DATTMO) { - IRQ_MSG("XXX CMD<%d> MSDC_INT_DATTMO", host->mrq->cmd->opcode); - data->error = -ETIMEDOUT; - } else if (intsts & MSDC_INT_DATCRCERR) { - IRQ_MSG("XXX CMD<%d> MSDC_INT_DATCRCERR, SDC_DCRC_STS<0x%x>", host->mrq->cmd->opcode, sdr_read32(SDC_DCRC_STS)); - data->error = -EIO; - } - - //if(sdr_read32(MSDC_INTEN) & MSDC_INT_XFER_COMPL) { - complete(&host->xfer_done); /* Read CRC come fast, XFER_COMPL not enabled */ - } - } - - /* command interrupts */ - if ((cmd != NULL) && (intsts & cmdsts)) { - if ((intsts & MSDC_INT_CMDRDY) || (intsts & MSDC_INT_ACMDRDY) || - (intsts & MSDC_INT_ACMD19_DONE)) { - u32 *rsp = &cmd->resp[0]; - - switch (host->cmd_rsp) { - case RESP_NONE: - break; - case RESP_R2: - *rsp++ = sdr_read32(SDC_RESP3); *rsp++ = sdr_read32(SDC_RESP2); - *rsp++ = sdr_read32(SDC_RESP1); *rsp++ = sdr_read32(SDC_RESP0); - break; - default: /* Response types 1, 3, 4, 5, 6, 7(1b) */ - if ((intsts & MSDC_INT_ACMDRDY) || (intsts & MSDC_INT_ACMD19_DONE)) - *rsp = sdr_read32(SDC_ACMD_RESP); - else - *rsp = sdr_read32(SDC_RESP0); - break; - } - } else if ((intsts & MSDC_INT_RSPCRCERR) || (intsts & MSDC_INT_ACMDCRCERR)) { - if (intsts & MSDC_INT_ACMDCRCERR) - IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDCRCERR", cmd->opcode); - else - IRQ_MSG("XXX CMD<%d> MSDC_INT_RSPCRCERR", cmd->opcode); - cmd->error = -EIO; - } else if ((intsts & MSDC_INT_CMDTMO) || (intsts & MSDC_INT_ACMDTMO)) { - if (intsts & MSDC_INT_ACMDTMO) - IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDTMO", cmd->opcode); - else - IRQ_MSG("XXX CMD<%d> MSDC_INT_CMDTMO", cmd->opcode); - cmd->error = -ETIMEDOUT; - msdc_reset_hw(host); - msdc_clr_fifo(); - msdc_clr_int(); - } - complete(&host->cmd_done); - } - - /* mmc irq interrupts */ - if (intsts & MSDC_INT_MMCIRQ) - printk(KERN_INFO "msdc[%d] MMCIRQ: SDC_CSTS=0x%.8x\r\n", host->id, sdr_read32(SDC_CSTS)); - -#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); - } + 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); + } - return IRQ_HANDLED; + /* 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; } /*--------------------------------------------------------------------------*/ @@ -2018,15 +2531,15 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) static void msdc_enable_cd_irq(struct msdc_host *host, int enable) { struct msdc_hw *hw = host->hw; - void __iomem *base = host->base; + 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); - */ + 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); @@ -2036,390 +2549,452 @@ static void msdc_enable_cd_irq(struct msdc_host *host, int enable) N_MSG(CFG, "CD IRQ Eanable(%d)", enable); if (enable) { - /* 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->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); + 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->config_gpio_pin) /* NULL */ - hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_DOWN); + sdr_set_field(MSDC_PS, MSDC_PS_CDDEBOUNCE, DEFAULT_DEBOUNCE); + sdr_set_bits(MSDC_PS, MSDC_PS_CDEN); + sdr_set_bits(MSDC_INTEN, MSDC_INTEN_CDSC); + sdr_set_bits(SDC_CFG, SDC_CFG_INSWKUP); /* not in document! Fix me */ + } + } else { + if (hw->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); + sdr_clr_bits(SDC_CFG, SDC_CFG_INSWKUP); + sdr_clr_bits(MSDC_PS, MSDC_PS_CDEN); + sdr_clr_bits(MSDC_INTEN, MSDC_INTEN_CDSC); - /* Here decreases a reference count to core power since card - * detection circuit is shutdown. - */ - //msdc_vcore_off(host); - } + /* Here decreases a reference count to core power since card + * detection circuit is shutdown. + */ + //msdc_vcore_off(host); + } + } } /* called by msdc_drv_probe */ static void msdc_init_hw(struct msdc_host *host) { - void __iomem *base = host->base; + u32 base = host->base; + struct msdc_hw *hw = host->hw; - /* Power on */ + /* Power on */ #if 0 /* --- by chhung */ - msdc_vcore_on(host); - msdc_pin_reset(host, MSDC_PIN_PULL_UP); - msdc_select_clksrc(host, hw->clk_src); - enable_clock(PERI_MSDC0_PDN + host->id, "SD"); - msdc_vdd_on(host); + msdc_vcore_on(host); + msdc_pin_reset(host, MSDC_PIN_PULL_UP); + msdc_select_clksrc(host, hw->clk_src); + enable_clock(PERI_MSDC0_PDN + host->id, "SD"); + msdc_vdd_on(host); #endif /* end of --- */ - /* Configure to MMC/SD mode */ - sdr_set_field(MSDC_CFG, MSDC_CFG_MODE, MSDC_SDMMC); + /* Configure to MMC/SD mode */ + sdr_set_field(MSDC_CFG, MSDC_CFG_MODE, MSDC_SDMMC); + + /* Reset */ + msdc_reset(); + msdc_clr_fifo(); - /* Reset */ - msdc_reset_hw(host); - msdc_clr_fifo(); - - /* Disable card detection */ - sdr_clr_bits(MSDC_PS, MSDC_PS_CDEN); - - /* Disable and clear all interrupts */ - sdr_clr_bits(MSDC_INTEN, sdr_read32(MSDC_INTEN)); - sdr_write32(MSDC_INT, sdr_read32(MSDC_INT)); + /* Disable 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); + sdr_write32(MSDC_PAD_CTL0, 0x00090000); + sdr_write32(MSDC_PAD_CTL1, 0x000A0000); + sdr_write32(MSDC_PAD_CTL2, 0x000A0000); + // sdr_write32(MSDC_PAD_TUNE, 0x00000000); + sdr_write32(MSDC_PAD_TUNE, 0x84101010); // for MT7620 E2 and afterward + // sdr_write32(MSDC_DAT_RDDLY0, 0x00000000); + sdr_write32(MSDC_DAT_RDDLY0, 0x10101010); // for MT7620 E2 and afterward + sdr_write32(MSDC_DAT_RDDLY1, 0x00000000); + sdr_write32(MSDC_IOCON, 0x00000000); #if 0 // use MT7620 default value: 0x403c004f - sdr_write32(MSDC_PATCH_BIT0, 0x003C000F); /* bit0 modified: Rx Data Clock Source: 1 -> 2.0*/ + sdr_write32(MSDC_PATCH_BIT0, 0x003C000F); /* bit0 modified: Rx Data Clock Source: 1 -> 2.0*/ #endif - if (sdr_read32(MSDC_ECO_VER) >= 4) { - if (host->id == 1) { - sdr_set_field(MSDC_PATCH_BIT1, MSDC_PATCH_BIT1_WRDAT_CRCS, 1); - sdr_set_field(MSDC_PATCH_BIT1, MSDC_PATCH_BIT1_CMD_RSP, 1); + 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 - /* 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); - /* 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); - /* 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); + /* 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, 4); - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, 4); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, 4); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, 4); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, 4); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, 4); -#else - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, 0); - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, 0); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, 0); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, 0); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, 0); + /* 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 */ + /* set sampling edge */ - /* write crc timeout detection */ - sdr_set_field(MSDC_PATCH_BIT0, 1 << 30, 1); + /* write crc timeout detection */ + sdr_set_field(MSDC_PATCH_BIT0, 1 << 30, 1); - /* Configure to default data timeout */ - sdr_set_field(SDC_CFG, SDC_CFG_DTOC, DEFAULT_DTOC); + /* Configure to default data timeout */ + sdr_set_field(SDC_CFG, SDC_CFG_DTOC, DEFAULT_DTOC); - msdc_set_buswidth(host, MMC_BUS_WIDTH_1); + msdc_set_buswidth(host, MMC_BUS_WIDTH_1); - N_MSG(FUC, "init hardware done!"); + N_MSG(FUC, "init hardware done!"); } /* called by msdc_drv_remove */ static void msdc_deinit_hw(struct msdc_host *host) { - void __iomem *base = host->base; + 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 and clear all interrupts */ + sdr_clr_bits(MSDC_INTEN, sdr_read32(MSDC_INTEN)); + sdr_write32(MSDC_INT, sdr_read32(MSDC_INT)); - /* Disable card detection */ - msdc_enable_cd_irq(host, 0); - // msdc_set_power_mode(host, MMC_POWER_OFF); /* make sure power down */ /* --- by chhung */ + /* Disable card detection */ + msdc_enable_cd_irq(host, 0); + // msdc_set_power_mode(host, MMC_POWER_OFF); /* make sure power down */ /* --- by chhung */ } /* init gpd and bd list in msdc_drv_probe */ static void msdc_init_gpd_bd(struct msdc_host *host, struct msdc_dma *dma) { - struct gpd *gpd = dma->gpd; - struct bd *bd = dma->bd; - int i; + 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; - /* we just support one gpd, but gpd->next must be set for desc - * DMA. That's why we alloc 2 gpd structurs. - */ + /* 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)); - memset(gpd, 0, sizeof(struct gpd) * 2); - - gpd->bdp = 1; /* hwo, cs, bd pointer */ - gpd->ptr = (void *)dma->bd_addr; /* physical address */ - gpd->next = (void *)((u32)dma->gpd_addr + sizeof(struct gpd)); - - memset(bd, 0, sizeof(struct bd) * MAX_BD_NUM); - for (i = 0; i < (MAX_BD_NUM - 1); i++) - bd[i].next = (void *)(dma->bd_addr + sizeof(*bd) * (i + 1)); + //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; - __iomem void *base; - struct mmc_host *mmc; - struct msdc_host *host; - struct msdc_hw *hw; - int ret; + 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; u32 reg; - // Set the pins for sdxc to sdxc mode - //FIXME: this should be done by pinctl and not by the sd driver - if (ralink_soc == MT762X_SOC_MT7620A || - ralink_soc == MT762X_SOC_MT7621AT) { - reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + - 0x60)) & ~(0x3 << 18); + 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; + reg |= 0x1<<18; + //#endif } else { - reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c)); + //#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((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c), reg); - reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + - 0x60)) & ~(0x3 << 10); -#if defined(CONFIG_MTK_MMC_EMMC_8BIT) - reg |= 0x3 << 26 | 0x3 << 28 | 0x3 << 30; + 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 +++ */ + + 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; - sdr_write32((void __iomem *)(RALINK_SYSCTL_BASE + 0x60), reg); + hw = (struct msdc_hw*)pdev->dev.platform_data; + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq = platform_get_irq(pdev, 0); - hw = &msdc0_hw; + //BUG_ON((!hw) || (!mem) || (irq < 0)); /* --- by chhung */ + + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); - if (of_property_read_bool(pdev->dev.of_node, "mtk,wp-en")) - msdc0_hw.flags |= MSDC_WP_PIN_EN; + /* Set host parameters to mmc */ + mmc->ops = &mt_msdc_ops; + mmc->f_min = HOST_MIN_MCLK; + mmc->f_max = HOST_MAX_MCLK; + mmc->ocr_avail = MSDC_OCR_AVAIL; + + /* For sd card: MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED, + For sdio : MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED */ + if (hw->flags & MSDC_HIGHSPEED) { + mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED; + } + if (hw->data_pins == 4) { /* current data_pins are all 4*/ + mmc->caps |= MMC_CAP_4_BIT_DATA; + } else if (hw->data_pins == 8) { + mmc->caps |= MMC_CAP_8_BIT_DATA; + } + if ((hw->flags & MSDC_SDIO_IRQ) || (hw->flags & MSDC_EXT_SDIO_IRQ)) + mmc->caps |= MMC_CAP_SDIO_IRQ; /* yes for sdio */ - /* Allocate MMC host for this device */ - mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); - if (!mmc) - return -ENOMEM; + cd_active_low = !of_property_read_bool(pdev->dev.of_node, "mediatek,cd-high"); + mtk_sw_poll = of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll"); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(base)) { - ret = PTR_ERR(base); - goto host_free; - } + if (mtk_sw_poll) + mmc->caps |= MMC_CAP_NEEDS_POLL; - /* Set host parameters to mmc */ - mmc->ops = &mt_msdc_ops; - mmc->f_min = HOST_MIN_MCLK; - mmc->f_max = HOST_MAX_MCLK; - mmc->ocr_avail = MSDC_OCR_AVAIL; + /* MMC core transfer sizes tunable parameters */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,10,0) + mmc->max_segs = MAX_HW_SGMTS; +#else + mmc->max_hw_segs = MAX_HW_SGMTS; + mmc->max_phys_segs = MAX_PHY_SGMTS; +#endif + mmc->max_seg_size = MAX_SGMT_SZ; + mmc->max_blk_size = HOST_MAX_BLKSZ; + mmc->max_req_size = MAX_REQ_SZ; + mmc->max_blk_count = mmc->max_req_size; - mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED; - - //TODO: read this as bus-width from dt (via mmc_of_parse) - mmc->caps |= MMC_CAP_4_BIT_DATA; - - cd_active_low = !of_property_read_bool(pdev->dev.of_node, "mediatek,cd-high"); - - if (of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll")) - mmc->caps |= MMC_CAP_NEEDS_POLL; - - /* MMC core transfer sizes tunable parameters */ - mmc->max_segs = MAX_HW_SGMTS; - - mmc->max_seg_size = MAX_SGMT_SZ; - mmc->max_blk_size = HOST_MAX_BLKSZ; - mmc->max_req_size = MAX_REQ_SZ; - mmc->max_blk_count = mmc->max_req_size; - - host = mmc_priv(mmc); - host->hw = hw; - host->mmc = mmc; - host->id = pdev->id; - if (host->id < 0 || host->id >= 4) - host->id = 0; - host->error = 0; - - host->irq = platform_get_irq(pdev, 0); - if (host->irq < 0) { - ret = -EINVAL; - goto host_free; - } - - host->base = base; - host->mclk = 0; /* mclk: the request clock of mmc sub-system */ - host->hclk = hclks[hw->clk_src]; /* hclk: clock of clock source to msdc controller */ - host->sclk = 0; /* sclk: the really clock after divition */ - host->pm_state = PMSG_RESUME; - host->suspend = 0; - host->core_clkon = 0; - host->card_clkon = 0; - host->core_power = 0; - host->power_mode = MMC_POWER_OFF; + host = mmc_priv(mmc); + host->hw = hw; + host->mmc = mmc; + host->id = 0; + host->error = 0; + host->irq = irq; + host->base = (unsigned long) base; + host->mclk = 0; /* mclk: the request clock of mmc sub-system */ + host->hclk = hclks[hw->clk_src]; /* hclk: clock of clock source to msdc controller */ + host->sclk = 0; /* sclk: the really clock after divition */ + host->pm_state = PMSG_RESUME; + host->suspend = 0; + host->core_clkon = 0; + host->card_clkon = 0; + host->core_power = 0; + host->power_mode = MMC_POWER_OFF; // host->card_inserted = hw->flags & MSDC_REMOVABLE ? 0 : 1; - host->timeout_ns = 0; - host->timeout_clks = DEFAULT_DTOC * 65536; + host->timeout_ns = 0; + host->timeout_clks = DEFAULT_DTOC * 65536; + + host->mrq = NULL; + //init_MUTEX(&host->sem); /* we don't need to support multiple threads access */ + + host->dma.used_gpd = 0; + host->dma.used_bd = 0; + mmc_dev(mmc)->dma_mask = NULL; - host->mrq = NULL; - //init_MUTEX(&host->sem); /* we don't need to support multiple threads access */ + /* using dma_alloc_coherent*/ /* todo: using 1, for all 4 slots */ + host->dma.gpd = dma_alloc_coherent(NULL, MAX_GPD_NUM * sizeof(gpd_t), &host->dma.gpd_addr, GFP_KERNEL); + host->dma.bd = dma_alloc_coherent(NULL, MAX_BD_NUM * sizeof(bd_t), &host->dma.bd_addr, GFP_KERNEL); + BUG_ON((!host->dma.gpd) || (!host->dma.bd)); + msdc_init_gpd_bd(host, &host->dma); + +#if 0 + tasklet_init(&host->card_tasklet, msdc_tasklet_card, (ulong)host); +#else + INIT_DELAYED_WORK(&host->card_delaywork, msdc_tasklet_card); +#endif + spin_lock_init(&host->lock); + msdc_init_hw(host); - mmc_dev(mmc)->dma_mask = NULL; + 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); - /* using dma_alloc_coherent*/ /* todo: using 1, for all 4 slots */ - host->dma.gpd = dma_alloc_coherent(&pdev->dev, - MAX_GPD_NUM * sizeof(struct gpd), - &host->dma.gpd_addr, GFP_KERNEL); - host->dma.bd = dma_alloc_coherent(&pdev->dev, - MAX_BD_NUM * sizeof(struct bd), - &host->dma.bd_addr, GFP_KERNEL); - if (!host->dma.gpd || !host->dma.bd) { - ret = -ENOMEM; - goto release_mem; - } - msdc_init_gpd_bd(host, &host->dma); + if (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! */ + } + } - INIT_DELAYED_WORK(&host->card_delaywork, msdc_tasklet_card); - spin_lock_init(&host->lock); - msdc_init_hw(host); + 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 */ - /* TODO check weather flags 0 is correct, the mtk-sd driver uses - * IRQF_TRIGGER_LOW | IRQF_ONESHOT for flags - * - * for flags 0 the trigger polarity is determined by the - * device tree, but not the oneshot flag, but maybe it is also - * not needed because the soc could be oneshot safe. - */ - ret = devm_request_irq(&pdev->dev, host->irq, msdc_irq, 0, pdev->name, - host); - if (ret) - goto release; + 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); - platform_set_drvdata(pdev, mmc); + ret = mmc_add_host(mmc); + if (ret) goto free_irq; - ret = mmc_add_host(mmc); - if (ret) - goto release; + /* 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); + } - /* 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; + return 0; +free_irq: + free_irq(irq, host); release: - platform_set_drvdata(pdev, NULL); - msdc_deinit_hw(host); - cancel_delayed_work_sync(&host->card_delaywork); + platform_set_drvdata(pdev, NULL); + msdc_deinit_hw(host); -release_mem: - if (host->dma.gpd) - dma_free_coherent(&pdev->dev, MAX_GPD_NUM * sizeof(struct gpd), - host->dma.gpd, host->dma.gpd_addr); - if (host->dma.bd) - dma_free_coherent(&pdev->dev, MAX_BD_NUM * sizeof(struct bd), - host->dma.bd, host->dma.bd_addr); -host_free: - mmc_free_host(mmc); +#if 0 + tasklet_kill(&host->card_tasklet); +#else + cancel_delayed_work_sync(&host->card_delaywork); +#endif - return ret; + 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 mmc_host *mmc; + struct msdc_host *host; + struct resource *mem; - mmc = platform_get_drvdata(pdev); - BUG_ON(!mmc); + mmc = platform_get_drvdata(pdev); + BUG_ON(!mmc); + + host = mmc_priv(mmc); + BUG_ON(!host); - host = mmc_priv(mmc); - BUG_ON(!host); + ERR_MSG("removed !!!"); - ERR_MSG("removed !!!"); + platform_set_drvdata(pdev, NULL); + mmc_remove_host(host->mmc); + msdc_deinit_hw(host); - 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); - cancel_delayed_work_sync(&host->card_delaywork); + 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); - dma_free_coherent(&pdev->dev, MAX_GPD_NUM * sizeof(struct gpd), - host->dma.gpd, host->dma.gpd_addr); - dma_free_coherent(&pdev->dev, MAX_BD_NUM * sizeof(struct bd), - host->dma.bd, host->dma.bd_addr); + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - mmc_free_host(host->mmc); + if (mem) + release_mem_region(mem->start, mem->end - mem->start + 1); - return 0; + mmc_free_host(host->mmc); + + return 0; } /* Fix me: Power Flow */ #ifdef CONFIG_PM - -static void msdc_drv_pm(struct platform_device *pdev, pm_message_t state) -{ - struct mmc_host *mmc = platform_get_drvdata(pdev); - if (mmc) { - struct msdc_host *host = mmc_priv(mmc); - msdc_pm(state, (void *)host); - } -} - static int msdc_drv_suspend(struct platform_device *pdev, pm_message_t state) { - if (state.event == PM_EVENT_SUSPEND) - msdc_drv_pm(pdev, state); - return 0; + 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) { - struct pm_message state; + 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; - msdc_drv_pm(pdev, state); - return 0; + 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 @@ -2430,16 +3005,16 @@ static const struct of_device_id mt7620_sdhci_match[] = { MODULE_DEVICE_TABLE(of, mt7620_sdhci_match); static struct platform_driver mt_msdc_driver = { - .probe = msdc_drv_probe, - .remove = msdc_drv_remove, + .probe = msdc_drv_probe, + .remove = msdc_drv_remove, #ifdef CONFIG_PM - .suspend = msdc_drv_suspend, - .resume = msdc_drv_resume, + .suspend = msdc_drv_suspend, + .resume = msdc_drv_resume, #endif - .driver = { - .name = DRV_NAME, - .of_match_table = mt7620_sdhci_match, - }, + .driver = { + .name = DRV_NAME, + .of_match_table = mt7620_sdhci_match, + }, }; /*--------------------------------------------------------------------------*/ @@ -2447,27 +3022,27 @@ static struct platform_driver mt_msdc_driver = { /*--------------------------------------------------------------------------*/ static int __init mt_msdc_init(void) { - int ret; + int ret; - ret = platform_driver_register(&mt_msdc_driver); - if (ret) { - printk(KERN_ERR DRV_NAME ": Can't register driver"); - return ret; - } + 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(); +#if defined (MT6575_SD_DEBUG) + msdc_debug_proc_init(); #endif - return 0; + return 0; } static void __exit mt_msdc_exit(void) { - platform_driver_unregister(&mt_msdc_driver); +// 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 "); diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Kconfig b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/Kconfig similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Kconfig rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/Kconfig diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Makefile b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/Makefile similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Makefile rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/Makefile diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/esw_rt3050.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/esw_rt3050.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/esw_rt3050.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/esw_rt3050.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/esw_rt3050.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/esw_rt3050.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/esw_rt3050.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/esw_rt3050.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/ethtool.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/ethtool.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/ethtool.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/ethtool.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7620.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7621.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7621.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/gsw_mt7621.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.c similarity index 98% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.c index bdfdf7a43..a1c115687 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.c @@ -110,7 +110,8 @@ static void phy_init(struct fe_priv *priv, struct phy_device *phy) phy->autoneg = AUTONEG_ENABLE; phy->speed = 0; phy->duplex = 0; - phy->supported &= PHY_BASIC_FEATURES; + phy->supported &= IS_ENABLED(CONFIG_NET_MEDIATEK_MDIO_MT7620) ? + PHY_GBIT_FEATURES : PHY_BASIC_FEATURES; phy->advertising = phy->supported | ADVERTISED_Autoneg; phy_start_aneg(phy); diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_mt7620.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_mt7620.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_mt7620.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_rt2880.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_rt2880.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_rt2880.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_rt2880.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_rt2880.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_rt2880.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mdio_rt2880.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mdio_rt2880.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mt7530.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mt7530.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mt7530.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mt7530.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mt7530.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mt7530.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mt7530.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mt7530.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_debugfs.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_debugfs.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_debugfs.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_debugfs.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c similarity index 98% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c index c806e289b..6eae661ec 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.c @@ -219,8 +219,9 @@ static inline void fe_set_txd(struct fe_tx_dma *txd, struct fe_tx_dma *dma_txd) static void fe_clean_rx(struct fe_priv *priv) { - int i; struct fe_rx_ring *ring = &priv->rx_ring; + struct page *page; + int i; if (ring->rx_data) { for (i = 0; i < ring->rx_ring_size; i++) @@ -230,7 +231,7 @@ static void fe_clean_rx(struct fe_priv *priv) ring->rx_dma[i].rxd1, ring->rx_buf_size, DMA_FROM_DEVICE); - put_page(virt_to_head_page(ring->rx_data[i])); + skb_free_frag(ring->rx_data[i]); } kfree(ring->rx_data); @@ -244,6 +245,13 @@ static void fe_clean_rx(struct fe_priv *priv) ring->rx_phys); ring->rx_dma = NULL; } + + if (!ring->frag_cache.va) + return; + + page = virt_to_page(ring->frag_cache.va); + __page_frag_cache_drain(page, ring->frag_cache.pagecnt_bias); + memset(&ring->frag_cache, 0, sizeof(ring->frag_cache)); } static int fe_alloc_rx(struct fe_priv *priv) @@ -258,7 +266,9 @@ static int fe_alloc_rx(struct fe_priv *priv) goto no_rx_mem; for (i = 0; i < ring->rx_ring_size; i++) { - ring->rx_data[i] = netdev_alloc_frag(ring->frag_size); + ring->rx_data[i] = page_frag_alloc(&ring->frag_cache, + ring->frag_size, + GFP_KERNEL); if (!ring->rx_data[i]) goto no_rx_mem; } @@ -846,7 +856,8 @@ static int fe_poll_rx(struct napi_struct *napi, int budget, break; /* alloc new buffer */ - new_data = netdev_alloc_frag(ring->frag_size); + new_data = page_frag_alloc(&ring->frag_cache, ring->frag_size, + GFP_ATOMIC); if (unlikely(!new_data)) { stats->rx_dropped++; goto release_desc; @@ -856,14 +867,14 @@ static int fe_poll_rx(struct napi_struct *napi, int budget, ring->rx_buf_size, DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(&netdev->dev, dma_addr))) { - put_page(virt_to_head_page(new_data)); + skb_free_frag(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)); + skb_free_frag(new_data); goto release_desc; } skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN); diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.h similarity index 99% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.h index dfaa5fd9e..5203f5cf5 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_eth_soc.h @@ -461,6 +461,7 @@ struct fe_tx_ring { }; struct fe_rx_ring { + struct page_frag_cache frag_cache; struct fe_rx_dma *rx_dma; u8 **rx_data; dma_addr_t rx_phys; diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_offload.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_offload.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_offload.h similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_offload.h rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/mtk_offload.h diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7620.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7620.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7621.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7621.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7621.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_mt7621.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt2880.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt2880.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt2880.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt2880.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt3050.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt3050.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt3050.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt3050.c diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt3883.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt3883.c similarity index 100% rename from target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_rt3883.c rename to target/linux/ramips/files-4.14/drivers/net/ethernet/mtk/soc_rt3883.c diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 13934c5b0..cd77ffe41 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -31,7 +31,7 @@ loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000 KERNEL_LOADADDR := $(loadaddr-y) -KERNEL_DTB = kernel-bin | patch-dtb | lzma +KERNEL_DTB = kernel-bin | patch-dtb | lzma -d21 define Device/Default PROFILES = Default $$(DTS) KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts) @@ -57,6 +57,22 @@ define Build/trx -a 4 -f $(IMAGE_ROOTFS) endef +define Build/loader-common + rm -rf $@.src + $(MAKE) -C lzma-loader \ + PKG_BUILD_DIR="$@.src" \ + TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \ + BOARD="$(BOARDNAME)" PLATFORM="$(PLATFORM)" \ + LZMA_TEXT_START=0x82000000 LOADADDR=$(KERNEL_LOADADDR) \ + $(1) compile loader.$(LOADER_TYPE) + mv "$@.$(LOADER_TYPE)" "$@" + rm -rf $@.src +endef + +define Build/loader-kernel + $(call Build/loader-common,LOADER_DATA="$@") +endef + define Build/relocate-kernel ( \ dd if=$(KDIR)/loader.bin bs=32 conv=sync && \ diff --git a/target/linux/ramips/image/lzma-loader/Makefile b/target/linux/ramips/image/lzma-loader/Makefile index 783301695..f22151c9d 100644 --- a/target/linux/ramips/image/lzma-loader/Makefile +++ b/target/linux/ramips/image/lzma-loader/Makefile @@ -16,6 +16,7 @@ TARGET_DIR := FLASH_OFFS := FLASH_MAX := BOARD := +PLATFORM := ifeq ($(TARGET_DIR),) TARGET_DIR := $(KDIR) @@ -42,7 +43,7 @@ loader-compile: $(PKG_BUILD_DIR)/.prepared FLASH_OFFS=$(FLASH_OFFS) \ FLASH_MAX=$(FLASH_MAX) \ BOARD="$(BOARD)" \ - PLATFORM="ralink" \ + PLATFORM="$(PLATFORM)" \ clean all loader.gz: $(PKG_BUILD_DIR)/loader.bin diff --git a/target/linux/ramips/image/lzma-loader/src/Makefile b/target/linux/ramips/image/lzma-loader/src/Makefile index f861666e6..d20cd7734 100644 --- a/target/linux/ramips/image/lzma-loader/src/Makefile +++ b/target/linux/ramips/image/lzma-loader/src/Makefile @@ -22,35 +22,39 @@ BOARD := FLASH_OFFS := FLASH_MAX := PLATFORM := +CACHE_FLAGS := 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 + +include $(PLATFORM).mk + +BIN_FLAGS := -O binary -R .reginfo -R .note -R .comment -R .mdebug \ + -R .MIPS.abiflags -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 \ + -fno-common -ffreestanding -fhonour-copts -nostartfiles \ -mabi=32 -march=mips32r2 \ -Wa,-32 -Wa,-march=mips32r2 -Wa,-mips32r2 -Wa,--trap -CFLAGS += -D_LZMA_PROB32 -DARCH=$(PLATFORM) +CFLAGS += -D_LZMA_PROB32 +CFLAGS += -flto +CFLAGS += $(CACHE_FLAGS) ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -LDFLAGS = -static --gc-sections -no-warn-mismatch -LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START) +LDFLAGS = -static -Wl,--gc-sections -Wl,-no-warn-mismatch +LDFLAGS += -Wl,-e,startup -T loader.lds -Wl,-Ttext,$(LZMA_TEXT_START) +LDFLAGS += -flto -fwhole-program -Wl,-z,max-page-size=4096 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) @@ -68,11 +72,6 @@ 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 @@ -90,7 +89,7 @@ data.o: $(LOADER_DATA) $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $< loader: $(OBJECTS) - $(LD) $(LDFLAGS) -o $@ $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) loader.bin: loader $(OBJCOPY) $(BIN_FLAGS) $< $@ @@ -99,7 +98,7 @@ 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 $@ $< + $(LD) -e startup -T loader2.lds -Ttext $(LOADADDR) -z max-page-size=4096 -o $@ $< mrproper: clean diff --git a/target/linux/ramips/image/lzma-loader/src/board-mt7621.c b/target/linux/ramips/image/lzma-loader/src/board-mt7621.c new file mode 100644 index 000000000..b90b2ed89 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/board-mt7621.c @@ -0,0 +1,39 @@ +/* + * Arch specific code for mt7621 based boards, based on code for Ralink boards + * + * Copyright (C) 2018 Tobias Schramm + * + * 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" + +#define READREG(r) *(volatile uint32_t *)(r) +#define WRITEREG(r,v) *(volatile uint32_t *)(r) = v + +#define KSEG1ADDR(_x) (((_x) & 0x1fffffff) | 0xa0000000) + +#define UART_BASE 0xBE000C00 + +#define UART_TBR_OFFSET 0x00 +#define UART_LSR_OFFSET 0x14 + +#define UART_LSR_TEMT (1 << 6) + +#define UART_READ(r) READREG(UART_BASE + (r)) +#define UART_WRITE(r,v) WRITEREG(UART_BASE + (r), (v)) + +void board_putc(int ch) +{ + while (((UART_READ(UART_LSR_OFFSET)) & UART_LSR_TEMT) == 0); + UART_WRITE(UART_TBR_OFFSET, ch); + while (((UART_READ(UART_LSR_OFFSET)) & UART_LSR_TEMT) == 0); +} + +void board_init(void) +{ +} diff --git a/target/linux/ramips/image/lzma-loader/src/loader.c b/target/linux/ramips/image/lzma-loader/src/loader.c index 1d42bfa2f..c73b60b35 100644 --- a/target/linux/ramips/image/lzma-loader/src/loader.c +++ b/target/linux/ramips/image/lzma-loader/src/loader.c @@ -21,6 +21,7 @@ #include #include +#include #include "config.h" #include "cache.h" @@ -73,9 +74,10 @@ static unsigned long lzma_outsize; static unsigned long kernel_la; #ifdef CONFIG_KERNEL_CMDLINE -#define kernel_argc 1 +#define kernel_argc 2 static const char kernel_cmdline[] = CONFIG_KERNEL_CMDLINE; static const char *kernel_argv[] = { + NULL, kernel_cmdline, NULL, }; diff --git a/target/linux/ramips/image/lzma-loader/src/mt7621.mk b/target/linux/ramips/image/lzma-loader/src/mt7621.mk new file mode 100644 index 000000000..3ff5fddf9 --- /dev/null +++ b/target/linux/ramips/image/lzma-loader/src/mt7621.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/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 8081d906f..b6499c880 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -431,6 +431,14 @@ define Device/psg1218b endef TARGET_DEVICES += psg1218b +define Device/phicomm_k2g + DTS := K2G + IMAGE_SIZE := 7552k + DEVICE_TITLE := Phicomm K2G + DEVICE_PACKAGES := kmod-mt76x2 +endef +TARGET_DEVICES += phicomm_k2g + define Device/rp-n53 DTS := RP-N53 DEVICE_TITLE := Asus RP-N53 diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 5bbdd2074..e9e2d3ece 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -4,6 +4,18 @@ DEVICE_VARS += TPLINK_BOARD_ID TPLINK_HEADER_VERSION TPLINK_HWID TPLINK_HWREV +define Build/elecom-wrc-factory + $(eval product=$(word 1,$(1))) + $(eval version=$(word 2,$(1))) + $(STAGING_DIR_HOST)/bin/mkhash md5 $@ >> $@ + ( \ + echo -n "ELECOM $(product) v$(version)" | \ + dd bs=32 count=1 conv=sync; \ + dd if=$@; \ + ) > $@.new + mv $@.new $@ +endef + define Build/ubnt-erx-factory-image if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \ echo '21001:6' > $(1).compat; \ @@ -65,6 +77,16 @@ define Device/mediatek_ap-mt7621a-v60 endef TARGET_DEVICES += mediatek_ap-mt7621a-v60 +define Device/elecom_wrc-1167ghbk2-s + DTS := WRC-1167GHBK2-S + IMAGE_SIZE := 15488k + DEVICE_TITLE := ELECOM WRC-1167GHBK2-S + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) |\ + elecom-wrc-factory WRC-1167GHBK2-S 0.00 +endef +TARGET_DEVICES += elecom_wrc-1167ghbk2-s + define Device/ew1200 DTS := EW1200 IMAGE_SIZE := $(ralink_default_fw_size_16M) @@ -171,7 +193,7 @@ define Device/d-team_newifi-d2 IMAGE_SIZE := $(ralink_default_fw_size_32M) DEVICE_TITLE := Newifi D2 DEVICE_PACKAGES := \ - kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport + kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-mini endef TARGET_DEVICES += d-team_newifi-d2 @@ -211,6 +233,20 @@ define Device/rb750gr3 endef TARGET_DEVICES += rb750gr3 +define Device/mikrotik_rbm33g + DTS := RBM33G + BLOCKSIZE := 64k + IMAGE_SIZE := 16128k + DEVICE_TITLE := MikroTik RBM33G + DEVICE_PACKAGES := kmod-usb3 + LOADER_TYPE := elf + PLATFORM := mt7621 + KERNEL := kernel-bin | patch-dtb | lzma | loader-kernel + IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) +endef +TARGET_DEVICES += mikrotik_rbm33g + define Device/re350-v1 DTS := RE350 DEVICE_TITLE := TP-LINK RE350 v1 @@ -299,8 +335,7 @@ define Device/w2914nsv2 IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := WeVO W2914NS v2 DEVICE_PACKAGES := \ - kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76 \ - wpad-mini + kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-mini endef TARGET_DEVICES += w2914nsv2 @@ -314,7 +349,7 @@ define Device/wf-2881 UBINIZE_OPTS := -E 5 IMAGE/sysupgrade.bin := append-kernel | append-ubi | append-metadata | check-size $$$$(IMAGE_SIZE) DEVICE_TITLE := NETIS WF-2881 - DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport + DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-mini endef TARGET_DEVICES += wf-2881 @@ -352,7 +387,7 @@ define Device/youhua_wr1200js IMAGE_SIZE := 16064k DEVICE_TITLE := YouHua WR1200JS DEVICE_PACKAGES := \ - kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport + kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-mini endef TARGET_DEVICES += youhua_wr1200js diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index aeb6faf0e..21c5357a0 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -196,6 +196,20 @@ define Device/tplink_tl-mr3420-v5 endef TARGET_DEVICES += tplink_tl-mr3420-v5 +define Device/tplink_tl-wr842n-v5 + $(Device/tplink) + DTS := TL-WR842NV5 + IMAGE_SIZE := 7808k + DEVICE_TITLE := TP-Link TL-WR842N v5 + TPLINK_FLASHLAYOUT := 8Mmtk + TPLINK_HWID := 0x08420005 + TPLINK_HWREV := 0x5 + TPLINK_HWREVADD := 0x5 + TPLINK_HVERSION := 3 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += tplink_tl-wr842n-v5 + define Device/tplink_tl-wr902ac-v3 $(Device/tplink) DTS := TL-WR902ACV3 @@ -206,7 +220,6 @@ define Device/tplink_tl-wr902ac-v3 TPLINK_HWREV := 0x89 TPLINK_HWREVADD := 0x1 TPLINK_HVERSION := 3 - IMAGES += factory.bin DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport endef TARGET_DEVICES += tplink_tl-wr902ac-v3 diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index bc1941f90..23a83f840 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -132,7 +132,7 @@ define Device/asl26555-16M IMAGE_SIZE := 15872k SUPPORTED_DEVICES += asl26555 DEVICE_TITLE := Alpha ASL26555 16M - DEVICE_PACKAGES := + DEVICE_PACKAGES := kmod-usb-core kmod-usb-dwc2 kmod-usb-ledtrig-usbport endef TARGET_DEVICES += asl26555-16M diff --git a/target/linux/ramips/mt7621/config-4.14 b/target/linux/ramips/mt7621/config-4.14 index c19d735e5..2ea80a3ab 100644 --- a/target/linux/ramips/mt7621/config-4.14 +++ b/target/linux/ramips/mt7621/config-4.14 @@ -172,6 +172,7 @@ CONFIG_MTD_NAND_ECC=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_MINOR_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_TRX_FW=y @@ -227,8 +228,6 @@ CONFIG_RCU_STALL_COMMON=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_SPI=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y CONFIG_RPS=y diff --git a/target/linux/ramips/mt7621/target.mk b/target/linux/ramips/mt7621/target.mk index 3c965abbe..c2eba1d0d 100644 --- a/target/linux/ramips/mt7621/target.mk +++ b/target/linux/ramips/mt7621/target.mk @@ -4,7 +4,7 @@ SUBTARGET:=mt7621 BOARDNAME:=MT7621 based boards -FEATURES+=nand ramdisk rtc usb +FEATURES+=nand ramdisk rtc usb minor CPU_TYPE:=24kc define Target/Description diff --git a/target/linux/ramips/patches-4.14/0032-USB-dwc2-add-device_reset.patch b/target/linux/ramips/patches-4.14/0032-USB-dwc2-add-device_reset.patch index 4241376cf..7e120c531 100644 --- a/target/linux/ramips/patches-4.14/0032-USB-dwc2-add-device_reset.patch +++ b/target/linux/ramips/patches-4.14/0032-USB-dwc2-add-device_reset.patch @@ -18,7 +18,7 @@ Signed-off-by: John Crispin #include #include -@@ -5134,6 +5135,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso +@@ -5107,6 +5108,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso retval = -ENOMEM; diff --git a/target/linux/ramips/patches-4.14/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch b/target/linux/ramips/patches-4.14/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch deleted file mode 100644 index 9226202b7..000000000 --- a/target/linux/ramips/patches-4.14/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch +++ /dev/null @@ -1,29 +0,0 @@ -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 -@@ -2295,7 +2295,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)) { -@@ -2385,7 +2385,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.14/0037-mtd-cfi-cmdset-0002-force-word-write.patch b/target/linux/ramips/patches-4.14/0037-mtd-cfi-cmdset-0002-force-word-write.patch index 7ee828453..1cadfcdb0 100644 --- a/target/linux/ramips/patches-4.14/0037-mtd-cfi-cmdset-0002-force-word-write.patch +++ b/target/linux/ramips/patches-4.14/0037-mtd-cfi-cmdset-0002-force-word-write.patch @@ -16,7 +16,7 @@ Subject: [PATCH 37/53] mtd: cfi cmdset 0002 force word write -#define FORCE_WORD_WRITE 0 +#define FORCE_WORD_WRITE 1 - #define MAX_WORD_RETRIES 3 + #define MAX_RETRIES 3 @@ -51,7 +51,9 @@ diff --git a/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch b/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch index f5cdfc9bc..d50e68911 100644 --- a/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch +++ b/target/linux/ramips/patches-4.14/0039-mtd-add-mt7621-nand-support.patch @@ -14,7 +14,6 @@ Signed-off-by: John Crispin drivers/mtd/nand/mtk_nand2.c | 2304 +++++++++++++++++++++++++++++++++++ drivers/mtd/nand/mtk_nand2.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 ++ @@ -1299,7 +1298,7 @@ Signed-off-by: John Crispin + --- /dev/null +++ b/drivers/mtd/nand/mtk_nand2.c -@@ -0,0 +1,2365 @@ +@@ -0,0 +1,2345 @@ +/****************************************************************************** +* mtk_nand2.c - MTK NAND Flash Device Driver + * @@ -1347,8 +1346,6 @@ Signed-off-by: John Crispin +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 }; @@ -1397,9 +1394,6 @@ Signed-off-by: John Crispin +BOOL g_bHwEcc = true; + + -+static u8 *local_buffer_16_align; // 16 byte aligned buffer, for HW issue -+static u8 local_buffer[4096 + 512]; -+ +extern void nand_release_device(struct mtd_info *mtd); +extern int nand_get_device(struct nand_chip *chip, struct mtd_info *mtd, int new_state); + @@ -1420,6 +1414,25 @@ Signed-off-by: John Crispin + +static u8 nand_badblock_offset = 0; + ++static 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); ++} ++ ++static 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; ++} ++ +void nand_enable_clock(void) +{ + //enable_clock(MT65XX_PDN_PERI_NFI, "NAND"); @@ -2164,10 +2177,7 @@ Signed-off-by: John Crispin + 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; ++ buf = pPageBuf; + if (mtk_nand_ready_for_read(nand, u4RowAddr, 0, true, buf)) { + int j; + for (j = 0 ; j < u4SecNum; j++) { @@ -2185,9 +2195,6 @@ Signed-off-by: John Crispin + mtk_nand_stop_read(); + } + -+ if (buf == local_buffer_16_align) -+ memcpy(pPageBuf, buf, u4PageSize); -+ + return bRet; +} + @@ -2201,12 +2208,7 @@ Signed-off-by: John Crispin + + 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; ++ buf = pPageBuf; + + if (mtk_nand_ready_for_write(chip, u4RowAddr, 0, true, buf)) { + mtk_nand_write_fdm_data(chip, pFDMBuf, u4SecNum); @@ -3390,9 +3392,6 @@ Signed-off-by: John Crispin + 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 */ @@ -3515,23 +3514,6 @@ Signed-off-by: John Crispin + nand_chip->chip_shift = ffs(nand_chip->chipsize) - 1;//0x1C;//ffs(nand_chip->chipsize) - 1; + nand_chip->cmd_ctrl = mtk_nfc_cmd_ctrl; + -+ /* 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; -+ + if (devinfo.pagesize == 4096) + layout = &nand_oob_128; + else if (devinfo.pagesize == 2048) @@ -3555,6 +3537,9 @@ Signed-off-by: John Crispin + mtd->oobsize = devinfo.sparesize; + hw->nfi_cs_num = 1; + ++ nand_chip->options |= NAND_USE_BOUNCE_BUFFER; ++ nand_chip->buf_align = 16; ++ + /* Scan to find existance of the device */ + if (nand_scan(mtd, hw->nfi_cs_num)) { + MSG(INIT, "%s : nand_scan fail.\n", MODULE_NAME); @@ -3607,9 +3592,6 @@ Signed-off-by: John Crispin + 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; @@ -3623,9 +3605,6 @@ Signed-off-by: John Crispin + 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(); + @@ -4149,34 +4128,6 @@ Signed-off-by: John Crispin nand_get_device(struct mtd_info *mtd, int new_state) { struct nand_chip *chip = mtd_to_nand(mtd); ---- a/drivers/mtd/nand/nand_bbt.c -+++ b/drivers/mtd/nand/nand_bbt.c -@@ -1215,6 +1215,25 @@ err: - return res; - } - -+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; -+} -+ - /** - * nand_update_bbt - update bad block table(s) - * @mtd: MTD device structure --- /dev/null +++ b/drivers/mtd/nand/nand_def.h @@ -0,0 +1,123 @@ diff --git a/target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch b/target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch index 6ae9226d3..2e7cc33c8 100644 --- a/target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch +++ b/target/linux/ramips/patches-4.14/0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch @@ -116,7 +116,7 @@ Signed-off-by: Felix Fietkau spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_LOCK); return ret; -@@ -1165,7 +1217,7 @@ static const struct flash_info spi_nor_i +@@ -1164,7 +1216,7 @@ static const struct flash_info spi_nor_i { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) }, { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, @@ -125,7 +125,7 @@ Signed-off-by: Felix Fietkau { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) }, -@@ -1225,6 +1277,9 @@ static int spi_nor_read(struct mtd_info +@@ -1224,6 +1276,9 @@ static int spi_nor_read(struct mtd_info if (ret) return ret; @@ -135,7 +135,7 @@ Signed-off-by: Felix Fietkau while (len) { loff_t addr = from; -@@ -1249,6 +1304,18 @@ static int spi_nor_read(struct mtd_info +@@ -1248,6 +1303,18 @@ static int spi_nor_read(struct mtd_info ret = 0; read_err: @@ -154,7 +154,7 @@ Signed-off-by: Felix Fietkau spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ); return ret; } -@@ -1350,6 +1417,10 @@ static int spi_nor_write(struct mtd_info +@@ -1349,6 +1416,10 @@ static int spi_nor_write(struct mtd_info if (ret) return ret; @@ -165,7 +165,7 @@ Signed-off-by: Felix Fietkau for (i = 0; i < len; ) { ssize_t written; loff_t addr = to + i; -@@ -1390,6 +1461,7 @@ static int spi_nor_write(struct mtd_info +@@ -1389,6 +1460,7 @@ static int spi_nor_write(struct mtd_info } write_err: @@ -173,7 +173,7 @@ Signed-off-by: Felix Fietkau spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); return ret; } -@@ -2806,8 +2878,10 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -2805,8 +2877,10 @@ int spi_nor_scan(struct spi_nor *nor, co } else if (mtd->size > 0x1000000) { /* enable 4-byte addressing if the device exceeds 16MiB */ nor->addr_width = 4; diff --git a/target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch b/target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch deleted file mode 100644 index 568d61db9..000000000 --- a/target/linux/ramips/patches-4.14/0054-mtd-spi-nor-w25q256-respect-default-mode.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- a/drivers/mtd/spi-nor/spi-nor.c -+++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -142,20 +142,29 @@ static int read_fsr(struct spi_nor *nor) - * location. Return the configuration register value. - * Returns negative if error occurred. - */ --static int read_cr(struct spi_nor *nor) -+static int _read_cr(struct spi_nor *nor, u8 reg) - { - int ret; - u8 val; - -- ret = nor->read_reg(nor, SPINOR_OP_RDCR, &val, 1); -+ ret = nor->read_reg(nor, reg, &val, 1); - if (ret < 0) { -- dev_err(nor->dev, "error %d reading CR\n", ret); -+ dev_err(nor->dev, "error %d reading %s\n", ret, -+ (reg==SPINOR_OP_RDCR)?"CR":"XCR"); - return ret; - } - - return val; - } - -+static inline int read_cr(struct spi_nor *nor) { -+ return _read_cr(nor, SPINOR_OP_RDCR); -+} -+ -+static inline int read_xcr(struct spi_nor *nor) { -+ return _read_cr(nor, SPINOR_OP_RDXCR); -+} -+ - /* - * Write status register 1 byte - * Returns negative if error occurred. -@@ -2878,9 +2887,16 @@ int spi_nor_scan(struct spi_nor *nor, co - } else if (mtd->size > 0x1000000) { - /* enable 4-byte addressing if the device exceeds 16MiB */ - nor->addr_width = 4; -- if (info->flags & SPI_NOR_4B_READ_OP) -- spi_nor_set_4byte_read(nor, info); -- else if (JEDEC_MFR(info) == SNOR_MFR_SPANSION || -+ if (info->flags & SPI_NOR_4B_READ_OP) { -+ if (JEDEC_MFR(info) == SNOR_MFR_WINBOND) { -+ ret = read_xcr(nor); -+ if (!(ret > 0 && (ret & XCR_DEF_4B_ADDR_MODE))) -+ spi_nor_set_4byte_read(nor, info); -+ else -+ set_4byte(nor, info, 1); -+ } else -+ spi_nor_set_4byte_read(nor, info); -+ } else if (JEDEC_MFR(info) == SNOR_MFR_SPANSION || - info->flags & SPI_NOR_4B_OPCODES) - spi_nor_set_4byte_opcodes(nor, info); - else ---- a/include/linux/mtd/spi-nor.h -+++ b/include/linux/mtd/spi-nor.h -@@ -103,6 +103,7 @@ - #define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */ - #define SPINOR_OP_EX4B 0xe9 /* Exit 4-byte mode */ - #define SPINOR_OP_WREAR 0xc5 /* Write extended address register */ -+#define SPINOR_OP_RDXCR 0x15 /* Read extended configuration register */ - - /* Used for Spansion flashes only. */ - #define SPINOR_OP_BRWR 0x17 /* Bank register write */ -@@ -135,6 +136,7 @@ - - /* Configuration Register bits. */ - #define CR_QUAD_EN_SPAN BIT(1) /* Spansion Quad I/O */ -+#define XCR_DEF_4B_ADDR_MODE BIT(1) /* Winbond 4B mode default */ - - /* Status Register 2 bits. */ - #define SR2_QUAD_EN_BIT7 BIT(7) diff --git a/target/linux/ramips/patches-4.14/0090-ethernet.patch b/target/linux/ramips/patches-4.14/0090-ethernet.patch new file mode 100644 index 000000000..20f69fcc0 --- /dev/null +++ b/target/linux/ramips/patches-4.14/0090-ethernet.patch @@ -0,0 +1,41 @@ +From b6f779ea9c329451b89404583b45b9eb00155b32 Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Wed, 18 Nov 2015 03:58:26 +0100 +Subject: [PATCH 510/513] net-next: mediatek: add Kconfig and Makefile + +This patch adds the Makefile and Kconfig required to make the driver build. + +Signed-off-by: John Crispin +Signed-off-by: Felix Fietkau +Signed-off-by: Michael Lee +--- + drivers/net/ethernet/Kconfig | 1 + + drivers/net/ethernet/Makefile | 1 + + drivers/net/ethernet/mtk/Kconfig | 62 ++++++++++++++++++++++++++++++++ + drivers/net/ethernet/mtk/Makefile | 20 +++++++++++ + 4 files changed, 84 insertions(+) + create mode 100644 drivers/net/ethernet/mtk/Kconfig + create mode 100644 drivers/net/ethernet/mtk/Makefile + +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -110,7 +110,7 @@ config LANTIQ_ETOP + Support for the MII0 inside the Lantiq SoC + + source "drivers/net/ethernet/marvell/Kconfig" +-source "drivers/net/ethernet/mediatek/Kconfig" ++source "drivers/net/ethernet/mtk/Kconfig" + source "drivers/net/ethernet/mellanox/Kconfig" + source "drivers/net/ethernet/micrel/Kconfig" + source "drivers/net/ethernet/microchip/Kconfig" +--- a/drivers/net/ethernet/Makefile ++++ b/drivers/net/ethernet/Makefile +@@ -51,7 +51,7 @@ obj-$(CONFIG_JME) += jme.o + obj-$(CONFIG_KORINA) += korina.o + obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o + obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/ +-obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/ ++obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mtk/ + obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/ + obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/ + obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/ diff --git a/target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch b/target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch index 93c7e928b..408fc13e7 100644 --- a/target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch +++ b/target/linux/ramips/patches-4.14/302-spi-nor-add-gd25q512.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1051,6 +1051,11 @@ static const struct flash_info spi_nor_i +@@ -1050,6 +1050,11 @@ static const struct flash_info spi_nor_i SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, diff --git a/target/linux/ramips/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch b/target/linux/ramips/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch index d0e68df03..ea8d83d98 100644 --- a/target/linux/ramips/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch +++ b/target/linux/ramips/patches-4.14/303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1084,7 +1084,7 @@ static const struct flash_info spi_nor_i +@@ -1083,7 +1083,7 @@ static const struct flash_info spi_nor_i { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) }, { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) }, diff --git a/target/linux/sunxi/config-4.14 b/target/linux/sunxi/config-4.14 index 94deb5a57..197e099ab 100644 --- a/target/linux/sunxi/config-4.14 +++ b/target/linux/sunxi/config-4.14 @@ -31,7 +31,6 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARM=y @@ -147,14 +146,11 @@ CONFIG_DEFAULT_CFQ=y CONFIG_DEFAULT_IOSCHED="cfq" CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y -# CONFIG_DMA_NOOP_OPS is not set CONFIG_DMA_OF=y CONFIG_DMA_SUN4I=y CONFIG_DMA_SUN6I=y CONFIG_DMA_VIRTUAL_CHANNELS=y -# CONFIG_DMA_VIRT_OPS is not set CONFIG_DNOTIFY=y -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DTC=y CONFIG_DUMMY_CONSOLE=y # CONFIG_DWMAC_DWC_QOS_ETH is not set @@ -168,7 +164,6 @@ CONFIG_ELF_CORE=y # CONFIG_EMBEDDED is not set CONFIG_ENABLE_MUST_CHECK=y # CONFIG_ENABLE_WARN_DEPRECATED is not set -CONFIG_EXPORTFS=y CONFIG_EXT4_FS=y CONFIG_EXTCON=y # CONFIG_F2FS_CHECK_FS is not set @@ -201,7 +196,6 @@ CONFIG_FRAME_WARN=2048 CONFIG_FREEZER=y CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ARCH_TOPOLOGY=y CONFIG_GENERIC_BUG=y @@ -555,7 +549,6 @@ CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_GOV_STEP_WISE=y CONFIG_THERMAL_HWMON=y CONFIG_THERMAL_OF=y -CONFIG_THIN_ARCHIVES=y # CONFIG_THUMB2_KERNEL is not set CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TIMER_OF=y diff --git a/target/linux/sunxi/cortexa53/config-default b/target/linux/sunxi/cortexa53/config-default index ef67c0ea1..b1702bc3c 100644 --- a/target/linux/sunxi/cortexa53/config-default +++ b/target/linux/sunxi/cortexa53/config-default @@ -35,6 +35,7 @@ CONFIG_ARM64_PAGE_SHIFT=12 # CONFIG_ARM64_PTDUMP_CORE is not set # CONFIG_ARM64_PTDUMP_DEBUGFS is not set # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set +CONFIG_ARM64_SSBD=y # CONFIG_ARM64_SW_TTBR0_PAN is not set # CONFIG_ARM64_UAO is not set CONFIG_ARM64_VA_BITS=39 @@ -55,6 +56,7 @@ CONFIG_FRAME_POINTER=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_CSUM=y CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_ARCH_HUGE_VMAP=y CONFIG_HAVE_ARCH_KASAN=y @@ -103,4 +105,5 @@ CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SUN50I_A64_CCU=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_UNMAP_KERNEL_AT_EL0=y CONFIG_VMAP_STACK=y diff --git a/target/linux/sunxi/patches-4.9/0053-stmmac-form-4-13.patch b/target/linux/sunxi/patches-4.9/0053-stmmac-form-4-13.patch index 4ee62321d..d71821ad7 100644 --- a/target/linux/sunxi/patches-4.9/0053-stmmac-form-4-13.patch +++ b/target/linux/sunxi/patches-4.9/0053-stmmac-form-4-13.patch @@ -1619,18 +1619,23 @@ int phy_addr; }; --struct stmmac_pci_info { ++struct stmmac_pci_dmi_data { ++ const struct stmmac_pci_func_data *func; ++ size_t nfuncs; ++}; ++ + struct stmmac_pci_info { - struct pci_dev *pdev; - int (*setup)(struct plat_stmmacenet_data *plat, - struct stmmac_pci_info *info); - struct stmmac_pci_dmi_data *dmi; -+struct stmmac_pci_dmi_data { -+ const struct stmmac_pci_func_data *func; -+ size_t nfuncs; ++ int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat); }; -static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info) --{ ++static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, ++ const struct dmi_system_id *dmi_list) + { - const char *name = dmi_get_system_info(DMI_BOARD_NAME); - const char *asset_tag = dmi_get_system_info(DMI_BOARD_ASSET_TAG); - unsigned int func = PCI_FUNC(info->pdev->devfn); @@ -1642,10 +1647,7 @@ - */ - if (!name) - return 1; -+struct stmmac_pci_info { -+ int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat); -+}; - +- - for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) { - if (!strcmp(dmi->name, name) && dmi->func == func) { - /* If asset tag is provided, match on it as well. */ @@ -1654,9 +1656,6 @@ - return dmi->phy_addr; - } - } -+static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, -+ const struct dmi_system_id *dmi_list) -+{ + const struct stmmac_pci_func_data *func_data; + const struct stmmac_pci_dmi_data *dmi_data; + const struct dmi_system_id *dmi_id; @@ -1852,9 +1851,9 @@ pci_enable_msi(pdev); -@@ -270,14 +304,21 @@ static void stmmac_pci_remove(struct pci +@@ -306,14 +340,21 @@ static int stmmac_pci_resume(struct devi - static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_suspend, stmmac_resume); + static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume); -#define STMMAC_VENDOR_ID 0x700 +/* synthetic ID, no official vendor */ diff --git a/target/linux/x86/64/config-default b/target/linux/x86/64/config-default index 920ecdc52..a9f5a5c56 100644 --- a/target/linux/x86/64/config-default +++ b/target/linux/x86/64/config-default @@ -113,7 +113,7 @@ CONFIG_EFI_RUNTIME_MAP=y CONFIG_EFI_RUNTIME_WRAPPERS=y CONFIG_EFI_STUB=y # CONFIG_EFI_TEST is not set -CONFIG_EFI_VARS=y +# CONFIG_EFI_VARS is not set CONFIG_FB=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_FILLRECT=y diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile index 52322fbf8..52af7c3ed 100644 --- a/target/linux/x86/Makefile +++ b/target/linux/x86/Makefile @@ -13,7 +13,7 @@ FEATURES:=squashfs ext4 vdi vmdk pcmcia targz fpu SUBTARGETS:=generic legacy geode 64 MAINTAINER:=Felix Fietkau -KERNEL_PATCHVER:=4.9 +KERNEL_PATCHVER:=4.14 KERNELNAME:=bzImage diff --git a/target/linux/x86/base-files/etc/board.d/01_leds b/target/linux/x86/base-files/etc/board.d/01_leds index 04e11705a..25dc4aeeb 100755 --- a/target/linux/x86/base-files/etc/board.d/01_leds +++ b/target/linux/x86/base-files/etc/board.d/01_leds @@ -8,7 +8,7 @@ board_config_update case "$(board_name)" in -pc-engines-apu|pc-engines-apu2) +pc-engines-apu|pc-engines-apu2|pc-engines-apu3) ucidef_set_led_netdev "wan" "WAN" "apu2:green:led3" "eth0" ucidef_set_led_netdev "lan" "LAN" "apu2:green:led2" "br-lan" ucidef_set_led_default "diag" "DIAG" "apu2:green:power" "1" diff --git a/target/linux/x86/base-files/etc/board.d/02_network b/target/linux/x86/base-files/etc/board.d/02_network index bea696d8f..c6e381b94 100755 --- a/target/linux/x86/base-files/etc/board.d/02_network +++ b/target/linux/x86/base-files/etc/board.d/02_network @@ -9,7 +9,7 @@ board_config_update case "$(board_name)" in -pc-engines-apu|pc-engines-apu2) +pc-engines-apu|pc-engines-apu2|pc-engines-apu3) ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0" ;; traverse-technologies-geos) diff --git a/target/linux/x86/config-4.14 b/target/linux/x86/config-4.14 index c16b836ca..bde549b1e 100644 --- a/target/linux/x86/config-4.14 +++ b/target/linux/x86/config-4.14 @@ -1,30 +1,6 @@ # CONFIG_60XX_WDT is not set # CONFIG_64BIT is not set -CONFIG_ACPI=y -CONFIG_ACPI_AC=y -CONFIG_ACPI_BATTERY=y -# CONFIG_ACPI_CMPC is not set -# CONFIG_ACPI_CONTAINER is not set -CONFIG_ACPI_CPU_FREQ_PSS=y -# CONFIG_ACPI_CUSTOM_DSDT is not set -# CONFIG_ACPI_DEBUG is not set -# CONFIG_ACPI_DEBUGGER is not set -# CONFIG_ACPI_DOCK is not set -# CONFIG_ACPI_EC_DEBUGFS is not set -CONFIG_ACPI_FAN=y -CONFIG_ACPI_HOTPLUG_IOAPIC=y -CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y -# CONFIG_ACPI_PCI_SLOT is not set -CONFIG_ACPI_PROCESSOR=y -# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set -CONFIG_ACPI_PROCESSOR_CSTATE=y -CONFIG_ACPI_PROCESSOR_IDLE=y -# CONFIG_ACPI_PROCFS_POWER is not set -CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y -# CONFIG_ACPI_SBS is not set -CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y -CONFIG_ACPI_THERMAL=y -# CONFIG_ACPI_WMI is not set +# CONFIG_ACPI is not set # CONFIG_ACQUIRE_WDT is not set # CONFIG_ADVANTECH_WDT is not set # CONFIG_ALIM1535_WDT is not set @@ -36,7 +12,6 @@ CONFIG_ARCH_DISCARD_MEMBLOCK=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y -CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_CPU_RELAX=y CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y @@ -53,7 +28,6 @@ CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y # CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set @@ -74,7 +48,6 @@ CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y -# CONFIG_ARCH_WANTS_THP_SWAP is not set CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y @@ -114,7 +87,6 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_CENTAUR=y CONFIG_CPU_SUP_CYRIX_32=y @@ -145,24 +117,18 @@ CONFIG_DECOMPRESS_BZIP2=y CONFIG_DECOMPRESS_GZIP=y CONFIG_DEFAULT_IO_DELAY_TYPE=0 # CONFIG_DELL_RBU is not set -# CONFIG_DMA_NOOP_OPS is not set -# CONFIG_DMA_VIRT_OPS is not set CONFIG_DMI=y CONFIG_DMIID=y CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y CONFIG_DMI_SYSFS=y CONFIG_DNOTIFY=y -# CONFIG_DPTF_POWER is not set -# CONFIG_DRM_LIB_RANDOM is not set CONFIG_DUMMY_CONSOLE=y CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y # CONFIG_EDD is not set -# CONFIG_EFI_DEV_PATH_PARSER is not set # CONFIG_EUROTECH_WDT is not set -CONFIG_EXPORTFS=y CONFIG_EXT4_FS=y # CONFIG_F2FS_CHECK_FS is not set CONFIG_F2FS_FS=y @@ -180,7 +146,6 @@ CONFIG_FUSION=y # CONFIG_FUSION_LOGGING is not set CONFIG_FUSION_MAX_SGE=128 CONFIG_FUSION_SPI=y -CONFIG_FUTEX_PI=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -210,8 +175,6 @@ CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y # CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ACPI_APEI=y -CONFIG_HAVE_ACPI_APEI_NMI=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_AOUT=y CONFIG_HAVE_ARCH_AUDITSYSCALL=y @@ -219,6 +182,7 @@ CONFIG_HAVE_ARCH_AUDITSYSCALL=y CONFIG_HAVE_ARCH_HUGE_VMAP=y CONFIG_HAVE_ARCH_JUMP_LABEL=y CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_KMEMCHECK=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y @@ -275,10 +239,8 @@ CONFIG_HIGHMEM=y # CONFIG_HIGHMEM4G is not set CONFIG_HIGHMEM64G=y # CONFIG_HIGHPTE is not set -# CONFIG_HPET is not set CONFIG_HPET_EMULATE_RTC=y CONFIG_HPET_TIMER=y -# CONFIG_HP_ACCEL is not set # CONFIG_HP_WATCHDOG is not set CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set @@ -299,10 +261,7 @@ CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y CONFIG_INPUT_KEYBOARD=y CONFIG_INSTRUCTION_DECODER=y -# CONFIG_INTEL_IPS is not set -# CONFIG_INTEL_MENLOW is not set # CONFIG_INTEL_PCH_THERMAL is not set -# CONFIG_INTEL_PMC_IPC is not set # CONFIG_INTEL_POWERCLAMP is not set # CONFIG_INTEL_RDT is not set # CONFIG_INTEL_SOC_DTS_THERMAL is not set @@ -323,7 +282,6 @@ CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y # CONFIG_ISA is not set CONFIG_ISA_DMA_API=y -# CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_IT8712F_WDT is not set # CONFIG_IT87_WDT is not set # CONFIG_ITCO_WDT is not set @@ -347,7 +305,6 @@ CONFIG_M586MMX=y # CONFIG_MDIO_BUS is not set # CONFIG_MEFFICEON is not set # CONFIG_MELAN is not set -# CONFIG_MFD_INTEL_LPSS_ACPI is not set # CONFIG_MFD_INTEL_LPSS_PCI is not set # CONFIG_MGEODEGX1 is not set # CONFIG_MGEODE_LX is not set @@ -410,7 +367,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GOMMCONFIG is not set CONFIG_PCI_LABEL=y CONFIG_PCI_LOCKLESS_CONFIG=y -CONFIG_PCI_MMCONFIG=y CONFIG_PCI_MSI=y CONFIG_PCI_MSI_IRQ_DOMAIN=y CONFIG_PCSPKR_PLATFORM=y @@ -423,16 +379,11 @@ CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x1000000 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PMC_ATOM=y -# CONFIG_PMIC_OPREGION is not set -CONFIG_PNP=y -CONFIG_PNPACPI=y -CONFIG_PNP_DEBUG_MESSAGES=y CONFIG_POWER_SUPPLY=y # CONFIG_PROCESSOR_SELECT is not set CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set # CONFIG_PUNIT_ATOM_DEBUG is not set -# CONFIG_PVPANIC is not set CONFIG_RATIONAL=y # CONFIG_RCU_NEED_SEGCBLIST is not set # CONFIG_RCU_STALL_COMMON is not set @@ -442,7 +393,6 @@ CONFIG_RETPOLINE=y CONFIG_RTC_CLASS=y CONFIG_RTC_MC146818_LIB=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SAMSUNG_Q10 is not set # CONFIG_SBC7240_WDT is not set # CONFIG_SBC8360_WDT is not set # CONFIG_SBC_EPX_C3_WATCHDOG is not set @@ -456,7 +406,6 @@ CONFIG_SCx200HR_TIMER=y # CONFIG_SCx200_WDT is not set # CONFIG_SERIAL_8250_FSL is not set CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_PNP=y CONFIG_SERIO=y CONFIG_SERIO_I8042=y CONFIG_SERIO_LIBPS2=y @@ -467,7 +416,6 @@ CONFIG_SG_POOL=y CONFIG_SPARSEMEM_STATIC=y CONFIG_SPARSE_IRQ=y CONFIG_SRCU=y -# CONFIG_SURFACE_PRO3_BUTTON is not set CONFIG_SWIOTLB=y CONFIG_SYSCTL_EXCEPTION_TRACE=y # CONFIG_TELCLOCK is not set @@ -475,12 +423,10 @@ CONFIG_THERMAL=y CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_GOV_STEP_WISE=y -CONFIG_THIN_ARCHIVES=y CONFIG_THREAD_INFO_IN_TASK=y CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TINY_SRCU=y # CONFIG_TOSHIBA is not set -# CONFIG_TOSHIBA_BT_RFKILL is not set CONFIG_UNWINDER_FRAME_POINTER=y # CONFIG_UNWINDER_GUESS is not set CONFIG_UP_LATE_INIT=y @@ -494,7 +440,6 @@ CONFIG_USB_HIDDEV=y CONFIG_USB_OHCI_HCD=y # CONFIG_USB_OHCI_HCD_PLATFORM is not set CONFIG_USB_PCI=y -CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y # CONFIG_USB_UHCI_HCD is not set # CONFIG_USERIO is not set @@ -514,11 +459,7 @@ CONFIG_X86=y CONFIG_X86_32=y # CONFIG_X86_32_IRIS is not set CONFIG_X86_32_LAZY_GS=y -CONFIG_X86_ACPI_CPUFREQ=y -CONFIG_X86_ACPI_CPUFREQ_CPB=y CONFIG_X86_ALIGNMENT_16=y -# CONFIG_X86_AMD_FREQ_SENSITIVITY is not set -# CONFIG_X86_AMD_PLATFORM_DEVICE is not set # CONFIG_X86_ANCIENT_MCE is not set # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_CMPXCHG64=y @@ -526,13 +467,11 @@ CONFIG_X86_CMPXCHG64=y # CONFIG_X86_CPUID is not set # CONFIG_X86_DEBUG_FPU is not set # CONFIG_X86_EXTENDED_PLATFORM is not set -# CONFIG_X86_E_POWERSAVER is not set CONFIG_X86_F00F_BUG=y CONFIG_X86_FAST_FEATURE_TESTS=y CONFIG_X86_FEATURE_NAMES=y CONFIG_X86_GENERIC=y # CONFIG_X86_GX_SUSPMOD is not set -# CONFIG_X86_INTEL_LPSS is not set # CONFIG_X86_INTEL_PSTATE is not set CONFIG_X86_INTEL_USERCOPY=y CONFIG_X86_INTERNODE_CACHE_SHIFT=6 @@ -540,7 +479,6 @@ CONFIG_X86_IO_APIC=y CONFIG_X86_L1_CACHE_SHIFT=6 # CONFIG_X86_LEGACY_VM86 is not set CONFIG_X86_LOCAL_APIC=y -# CONFIG_X86_LONGHAUL is not set # CONFIG_X86_LONGRUN is not set CONFIG_X86_MCE=y # CONFIG_X86_MCELOG_LEGACY is not set @@ -554,14 +492,11 @@ CONFIG_X86_MSR=y # CONFIG_X86_P4_CLOCKMOD is not set CONFIG_X86_PAE=y CONFIG_X86_PAT=y -# CONFIG_X86_PCC_CPUFREQ is not set CONFIG_X86_PLATFORM_DEVICES=y CONFIG_X86_PMEM_LEGACY=y CONFIG_X86_PMEM_LEGACY_DEVICE=y -CONFIG_X86_PM_TIMER=y # CONFIG_X86_POWERNOW_K6 is not set # CONFIG_X86_POWERNOW_K7 is not set -# CONFIG_X86_POWERNOW_K8 is not set CONFIG_X86_PPRO_FENCE=y # CONFIG_X86_PTDUMP is not set # CONFIG_X86_PTDUMP_CORE is not set diff --git a/target/linux/x86/config-4.9 b/target/linux/x86/config-4.9 index 3efd77e1d..af4c5e9e3 100644 --- a/target/linux/x86/config-4.9 +++ b/target/linux/x86/config-4.9 @@ -1,30 +1,6 @@ # CONFIG_60XX_WDT is not set # CONFIG_64BIT is not set -CONFIG_ACPI=y -CONFIG_ACPI_AC=y -CONFIG_ACPI_BATTERY=y -# CONFIG_ACPI_CMPC is not set -# CONFIG_ACPI_CONTAINER is not set -CONFIG_ACPI_CPU_FREQ_PSS=y -# CONFIG_ACPI_CUSTOM_DSDT is not set -# CONFIG_ACPI_DEBUG is not set -# CONFIG_ACPI_DEBUGGER is not set -# CONFIG_ACPI_DOCK is not set -# CONFIG_ACPI_EC_DEBUGFS is not set -CONFIG_ACPI_FAN=y -CONFIG_ACPI_HOTPLUG_IOAPIC=y -CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y -# CONFIG_ACPI_PCI_SLOT is not set -CONFIG_ACPI_PROCESSOR=y -# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set -CONFIG_ACPI_PROCESSOR_CSTATE=y -CONFIG_ACPI_PROCESSOR_IDLE=y -# CONFIG_ACPI_PROCFS_POWER is not set -CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y -# CONFIG_ACPI_SBS is not set -CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y -CONFIG_ACPI_THERMAL=y -# CONFIG_ACPI_WMI is not set +# CONFIG_ACPI is not set # CONFIG_ACQUIRE_WDT is not set # CONFIG_ADVANTECH_WDT is not set # CONFIG_ALIM1535_WDT is not set @@ -36,7 +12,6 @@ CONFIG_ARCH_DISCARD_MEMBLOCK=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y -CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_CPU_RELAX=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y @@ -47,7 +22,6 @@ CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y CONFIG_ARCH_PHYS_ADDR_T_64BIT=y @@ -72,7 +46,6 @@ CONFIG_ARCH_WANT_GENERAL_HUGETLB=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ATA=y -CONFIG_ATA_ACPI=y CONFIG_ATA_GENERIC=y CONFIG_ATA_PIIX=y CONFIG_BINFMT_MISC=y @@ -106,7 +79,6 @@ CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_STAT_DETAILS=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_RMAP=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_CENTAUR=y CONFIG_CPU_SUP_CYRIX_32=y @@ -115,17 +87,12 @@ CONFIG_CPU_SUP_TRANSMETA_32=y CONFIG_CPU_SUP_UMC_32=y # CONFIG_CRASHLOG is not set CONFIG_CRC16=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_AES_586=y CONFIG_CRYPTO_CRC32=y CONFIG_CRYPTO_CRC32C=y # CONFIG_CRYPTO_CRC32_PCLMUL is not set CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG2=y # CONFIG_CRYPTO_SERPENT_SSE2_586 is not set CONFIG_CRYPTO_WORKQUEUE=y @@ -148,7 +115,6 @@ CONFIG_DMIID=y CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y CONFIG_DMI_SYSFS=y CONFIG_DNOTIFY=y -# CONFIG_DPTF_POWER is not set CONFIG_DUMMY_CONSOLE=y CONFIG_EARLY_PRINTK=y # CONFIG_EARLY_PRINTK_DBGP is not set @@ -157,6 +123,11 @@ CONFIG_EDAC_SUPPORT=y # CONFIG_EDD is not set # CONFIG_EUROTECH_WDT is not set CONFIG_EXT4_FS=y +# CONFIG_F2FS_CHECK_FS is not set +CONFIG_F2FS_FS=y +# CONFIG_F2FS_FS_SECURITY is not set +CONFIG_F2FS_FS_XATTR=y +CONFIG_F2FS_STAT_FS=y # CONFIG_F71808E_WDT is not set CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_FIRMWARE_MEMMAP=y @@ -184,8 +155,6 @@ CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_MSI_IRQ=y CONFIG_GENERIC_MSI_IRQ_DOMAIN=y CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PENDING_IRQ=y -CONFIG_GENERIC_PHY=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y @@ -198,8 +167,6 @@ CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y # CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ACPI_APEI=y -CONFIG_HAVE_ACPI_APEI_NMI=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_AOUT=y CONFIG_HAVE_ARCH_AUDITSYSCALL=y @@ -258,15 +225,11 @@ CONFIG_HIGHMEM=y # CONFIG_HIGHMEM4G is not set CONFIG_HIGHMEM64G=y # CONFIG_HIGHPTE is not set -# CONFIG_HPET is not set CONFIG_HPET_EMULATE_RTC=y CONFIG_HPET_TIMER=y -# CONFIG_HP_ACCEL is not set # CONFIG_HP_WATCHDOG is not set CONFIG_HT_IRQ=y # CONFIG_HUGETLBFS is not set -CONFIG_HWMON=y -CONFIG_HWMON_VID=y CONFIG_HW_CONSOLE=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_GEODE=y @@ -284,10 +247,7 @@ CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y CONFIG_INPUT_KEYBOARD=y CONFIG_INSTRUCTION_DECODER=y -# CONFIG_INTEL_IPS is not set -# CONFIG_INTEL_MENLOW is not set # CONFIG_INTEL_PCH_THERMAL is not set -# CONFIG_INTEL_PMC_IPC is not set # CONFIG_INTEL_POWERCLAMP is not set # CONFIG_INTEL_SOC_DTS_THERMAL is not set CONFIG_IOMMU_HELPER=y @@ -307,7 +267,6 @@ CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y # CONFIG_ISA is not set CONFIG_ISA_DMA_API=y -# CONFIG_ISCSI_IBFT_FIND is not set # CONFIG_IT8712F_WDT is not set # CONFIG_IT87_WDT is not set # CONFIG_ITCO_WDT is not set @@ -318,7 +277,6 @@ CONFIG_KEXEC_CORE=y CONFIG_KEYBOARD_ATKBD=y # CONFIG_LEDS_CLEVO_MAIL is not set CONFIG_LIBNVDIMM=y -CONFIG_LOCK_SPIN_ON_OWNER=y # CONFIG_M486 is not set # CONFIG_M586 is not set CONFIG_M586MMX=y @@ -331,22 +289,16 @@ CONFIG_M586MMX=y # CONFIG_MCYRIXIII is not set # CONFIG_MEFFICEON is not set # CONFIG_MELAN is not set -# CONFIG_MFD_INTEL_LPSS_ACPI is not set # CONFIG_MFD_INTEL_LPSS_PCI is not set # CONFIG_MGEODEGX1 is not set # CONFIG_MGEODE_LX is not set -# CONFIG_MICROCODE is not set +CONFIG_MICROCODE=y +CONFIG_MICROCODE_AMD=y +CONFIG_MICROCODE_INTEL=y +CONFIG_MICROCODE_OLD_INTERFACE=y # CONFIG_MK6 is not set # CONFIG_MK7 is not set # CONFIG_MK8 is not set -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_SDHCI=y -# CONFIG_MMC_SDHCI_PCI is not set -# CONFIG_MMC_SDHCI_PLTFM is not set -# CONFIG_MMC_TIFM_SD is not set -CONFIG_MMC_USHC=y -# CONFIG_MMC_WBSD is not set # CONFIG_MODIFY_LDT_SYSCALL is not set CONFIG_MODULES_TREE_LOOKUP=y CONFIG_MODULES_USE_ELF_REL=y @@ -357,7 +309,6 @@ CONFIG_MODULES_USE_ELF_REL=y # CONFIG_MTD is not set CONFIG_MTRR=y # CONFIG_MTRR_SANITIZER is not set -CONFIG_MUTEX_SPIN_ON_OWNER=y # CONFIG_MVIAC3_2 is not set # CONFIG_MVIAC7 is not set # CONFIG_MWINCHIP3D is not set @@ -368,15 +319,15 @@ CONFIG_ND_BTT=y CONFIG_ND_CLAIM=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_PER_CPU_KM=y CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y CONFIG_NEED_SG_DMA_LENGTH=y # CONFIG_NET5501 is not set -CONFIG_NET_FLOW_LIMIT=y # CONFIG_NET_NS is not set CONFIG_NLS=y # CONFIG_NOHIGHMEM is not set CONFIG_NO_BOOTMEM=y -CONFIG_NR_CPUS=8 +CONFIG_NR_CPUS=1 # CONFIG_NSC_GPIO is not set CONFIG_NVME_CORE=y CONFIG_NVRAM=y @@ -386,13 +337,7 @@ CONFIG_OLD_SIGSUSPEND3=y CONFIG_OPROFILE_NMI_TIMER=y # CONFIG_OPTIMIZE_INLINING is not set CONFIG_OUTPUT_FORMAT="elf32-i386" -CONFIG_PADATA=y CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PATA_ACPI=y -CONFIG_PATA_ALI=y -CONFIG_PATA_AMD=y -CONFIG_PATA_MPIIX=y -CONFIG_PATA_SCH=y # CONFIG_PC8736x_GPIO is not set # CONFIG_PC87413_WDT is not set CONFIG_PCI=y @@ -405,7 +350,6 @@ CONFIG_PCI_GOANY=y # CONFIG_PCI_GODIRECT is not set # CONFIG_PCI_GOMMCONFIG is not set CONFIG_PCI_LABEL=y -CONFIG_PCI_MMCONFIG=y CONFIG_PCI_MSI=y CONFIG_PCI_MSI_IRQ_DOMAIN=y CONFIG_PCSPKR_PLATFORM=y @@ -418,34 +362,18 @@ CONFIG_PHYSICAL_ALIGN=0x100000 CONFIG_PHYSICAL_START=0x1000000 CONFIG_PHYS_ADDR_T_64BIT=y CONFIG_PMC_ATOM=y -# CONFIG_PMIC_OPREGION is not set -CONFIG_PNP=y -CONFIG_PNPACPI=y -CONFIG_PNP_DEBUG_MESSAGES=y CONFIG_POWER_SUPPLY=y # CONFIG_PROCESSOR_SELECT is not set CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set # CONFIG_PUNIT_ATOM_DEBUG is not set -# CONFIG_PVPANIC is not set -CONFIG_QUEUED_RWLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_RCU_STALL_COMMON=y +# CONFIG_RCU_STALL_COMMON is not set CONFIG_RD_BZIP2=y CONFIG_RD_GZIP=y -# CONFIG_RETPOLINE is not set -CONFIG_RFS_ACCEL=y -CONFIG_RPS=y +CONFIG_RETPOLINE=y CONFIG_RTC_CLASS=y CONFIG_RTC_MC146818_LIB=y -CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SAMSUNG_Q10 is not set -CONFIG_SATA_AHCI=y -CONFIG_SATA_AHCI_PLATFORM=y -CONFIG_SATA_MV=y -CONFIG_SATA_NV=y -CONFIG_SATA_VIA=y # CONFIG_SBC7240_WDT is not set # CONFIG_SBC8360_WDT is not set # CONFIG_SBC_EPX_C3_WATCHDOG is not set @@ -457,30 +385,20 @@ CONFIG_SCx200=y CONFIG_SCx200HR_TIMER=y # CONFIG_SCx200_GPIO is not set # CONFIG_SCx200_WDT is not set -CONFIG_SENSORS_CORETEMP=y -CONFIG_SENSORS_FAM15H_POWER=y -CONFIG_SENSORS_I5500=y -CONFIG_SENSORS_K10TEMP=y -CONFIG_SENSORS_K8TEMP=y -CONFIG_SENSORS_VIA_CPUTEMP=y # CONFIG_SERIAL_8250_FSL is not set CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_PNP=y CONFIG_SERIO=y # CONFIG_SERIO_CT82C710 is not set CONFIG_SERIO_I8042=y CONFIG_SERIO_LIBPS2=y CONFIG_SERIO_SERPORT=y CONFIG_SG_POOL=y -# CONFIG_SHORTCUT_FE is not set -CONFIG_SMP=y # CONFIG_SMSC37B787_WDT is not set # CONFIG_SMSC_SCH311X_WDT is not set CONFIG_SPARSEMEM_STATIC=y CONFIG_SPARSE_IRQ=y CONFIG_SRCU=y CONFIG_STRICT_DEVMEM=y -# CONFIG_SURFACE_PRO3_BUTTON is not set CONFIG_SWIOTLB=y CONFIG_SYSCTL_EXCEPTION_TRACE=y # CONFIG_TELCLOCK is not set @@ -490,8 +408,7 @@ CONFIG_THERMAL_GOV_STEP_WISE=y CONFIG_THREAD_INFO_IN_TASK=y CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_TOSHIBA is not set -# CONFIG_TOSHIBA_BT_RFKILL is not set -CONFIG_TREE_RCU=y +CONFIG_UP_LATE_INIT=y CONFIG_USB=y CONFIG_USB_COMMON=y CONFIG_USB_EHCI_HCD=y @@ -501,12 +418,8 @@ CONFIG_USB_HID=y CONFIG_USB_HIDDEV=y CONFIG_USB_OHCI_HCD=y # CONFIG_USB_OHCI_HCD_PLATFORM is not set -CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USB_UHCI_HCD=y -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_PCI=y -# CONFIG_USB_XHCI_PLATFORM is not set # CONFIG_USERIO is not set # CONFIG_USER_NS is not set CONFIG_USER_STACKTRACE_SUPPORT=y @@ -524,27 +437,19 @@ CONFIG_X86=y CONFIG_X86_32=y # CONFIG_X86_32_IRIS is not set CONFIG_X86_32_LAZY_GS=y -CONFIG_X86_32_SMP=y -CONFIG_X86_ACPI_CPUFREQ=y -CONFIG_X86_ACPI_CPUFREQ_CPB=y CONFIG_X86_ALIGNMENT_16=y -# CONFIG_X86_AMD_FREQ_SENSITIVITY is not set -# CONFIG_X86_AMD_PLATFORM_DEVICE is not set # CONFIG_X86_ANCIENT_MCE is not set -# CONFIG_X86_BIGSMP is not set # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_X86_CMPXCHG64=y # CONFIG_X86_CPUFREQ_NFORCE2 is not set # CONFIG_X86_CPUID is not set # CONFIG_X86_DEBUG_FPU is not set # CONFIG_X86_EXTENDED_PLATFORM is not set -# CONFIG_X86_E_POWERSAVER is not set CONFIG_X86_F00F_BUG=y CONFIG_X86_FAST_FEATURE_TESTS=y CONFIG_X86_FEATURE_NAMES=y CONFIG_X86_GENERIC=y # CONFIG_X86_GX_SUSPMOD is not set -# CONFIG_X86_INTEL_LPSS is not set # CONFIG_X86_INTEL_MPX is not set # CONFIG_X86_INTEL_PSTATE is not set CONFIG_X86_INTEL_USERCOPY=y @@ -553,7 +458,6 @@ CONFIG_X86_IO_APIC=y CONFIG_X86_L1_CACHE_SHIFT=6 # CONFIG_X86_LEGACY_VM86 is not set CONFIG_X86_LOCAL_APIC=y -# CONFIG_X86_LONGHAUL is not set # CONFIG_X86_LONGRUN is not set CONFIG_X86_MCE=y CONFIG_X86_MCE_AMD=y @@ -566,14 +470,11 @@ CONFIG_X86_MSR=y # CONFIG_X86_P4_CLOCKMOD is not set CONFIG_X86_PAE=y CONFIG_X86_PAT=y -# CONFIG_X86_PCC_CPUFREQ is not set CONFIG_X86_PLATFORM_DEVICES=y CONFIG_X86_PMEM_LEGACY=y CONFIG_X86_PMEM_LEGACY_DEVICE=y -CONFIG_X86_PM_TIMER=y # CONFIG_X86_POWERNOW_K6 is not set # CONFIG_X86_POWERNOW_K7 is not set -# CONFIG_X86_POWERNOW_K8 is not set CONFIG_X86_PPRO_FENCE=y # CONFIG_X86_PTDUMP is not set # CONFIG_X86_PTDUMP_CORE is not set @@ -588,9 +489,9 @@ CONFIG_X86_RESERVE_LOW=64 CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y CONFIG_X86_THERMAL_VECTOR=y CONFIG_X86_TSC=y +CONFIG_X86_UP_APIC=y +CONFIG_X86_UP_IOAPIC=y CONFIG_X86_VERBOSE_BOOTUP=y -CONFIG_XPS=y CONFIG_XZ_DEC_BCJ=y CONFIG_XZ_DEC_X86=y CONFIG_ZLIB_INFLATE=y -# CONFIG_SATA_ZPODD is not set diff --git a/target/linux/xburst/Makefile b/target/linux/xburst/Makefile deleted file mode 100644 index 2a64b7c46..000000000 --- a/target/linux/xburst/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (C) 2009-2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=mipsel -BOARD:=xburst -BOARDNAME:=Ingenic XBurst -FEATURES:=targz nand ubifs audio -SUBTARGETS:=qi_lb60 - -KERNEL_PATCHVER:=3.18 - -DEVICE_TYPE:=other - -define Target/Description - Build firmware images for XBurst JZ47x0 based boards. -endef - -include $(INCLUDE_DIR)/target.mk - -$(eval $(call BuildTarget)) diff --git a/target/linux/xburst/base-files/etc/board.d/01_system b/target/linux/xburst/base-files/etc/board.d/01_system deleted file mode 100755 index 16f4987aa..000000000 --- a/target/linux/xburst/base-files/etc/board.d/01_system +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -. /lib/functions/uci-defaults.sh - -board_config_update - -ucidef_set_hostname "BenNanoNote" -ucidef_set_ntpserver - -board_config_flush - -exit 0 diff --git a/target/linux/xburst/base-files/etc/config/fstab b/target/linux/xburst/base-files/etc/config/fstab deleted file mode 100644 index 522356112..000000000 --- a/target/linux/xburst/base-files/etc/config/fstab +++ /dev/null @@ -1,6 +0,0 @@ -config mount - option target /card - option device /dev/mmcblk0p1 - option fstype auto - option options rw,sync - option enabled 1 diff --git a/target/linux/xburst/base-files/etc/config/network b/target/linux/xburst/base-files/etc/config/network deleted file mode 100644 index a086003e3..000000000 --- a/target/linux/xburst/base-files/etc/config/network +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2006 OpenWrt.org - -config interface loopback - option ifname lo - option proto static - option ipaddr 127.0.0.1 - option netmask 255.0.0.0 - -config interface lan - option ifname usb0 - option proto static - option ipaddr 192.168.1.1 - option netmask 255.255.255.0 diff --git a/target/linux/xburst/config-3.18 b/target/linux/xburst/config-3.18 deleted file mode 100644 index 099f5b0ed..000000000 --- a/target/linux/xburst/config-3.18 +++ /dev/null @@ -1,346 +0,0 @@ -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_ARCH_DISCARD_MEMBLOCK=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -# CONFIG_ARCH_HAS_SG_CHAIN is not set -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -# CONFIG_BACKLIGHT_PWM is not set -CONFIG_BATTERY_JZ4740=y -# CONFIG_BLK_DEV_INITRD is not set -CONFIG_CHARGER_GPIO=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CONFIGFS_FS=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -CONFIG_CPU_MIPSR1=y -CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_R4K_FPU=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CRC16=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_DMADEVICES=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_JZ4740=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_DMA_VIRTUAL_CHANNELS=y -CONFIG_DUMMY_CONSOLE=y -# CONFIG_DW_DMAC_CORE is not set -CONFIG_EARLY_PRINTK=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_EXT4_FS=y -CONFIG_FAT_FS=y -CONFIG_FB=y -CONFIG_FB_CMDLINE=y -CONFIG_FB_JZ4740=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_IMAGEBLIT=y -CONFIG_FONTS=y -# CONFIG_FONT_10x18 is not set -# CONFIG_FONT_6x10 is not set -CONFIG_FONT_6x11=y -# CONFIG_FONT_7x14 is not set -# CONFIG_FONT_8x16 is not set -# CONFIG_FONT_8x8 is not set -# CONFIG_FONT_ACORN_8x8 is not set -# CONFIG_FONT_MINI_4x6 is not set -# CONFIG_FONT_PEARL_8x8 is not set -# CONFIG_FONT_SUN12x22 is not set -# CONFIG_FONT_SUN8x16 is not set -CONFIG_FONT_SUPPORT=y -CONFIG_FORCE_MAX_ZONEORDER=12 -CONFIG_FRAMEBUFFER_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -CONFIG_FREEZER=y -CONFIG_FS_MBCACHE=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_BPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DEBUG_STACKOVERFLOW=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HW_CONSOLE=y -CONFIG_HZ_PERIODIC=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_INPUT=y -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MATRIXKMAP=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y -# CONFIG_INPUT_MOUSEDEV_PSAUX is not set -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_PWM_BEEPER=y -CONFIG_INPUT_UINPUT=y -CONFIG_IRQ_CPU=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_JBD2=y -CONFIG_JZ4740_QI_LB60=y -CONFIG_KALLSYMS=y -CONFIG_KEXEC=y -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_MATRIX=y -# CONFIG_LCD_AMS369FG06 is not set -CONFIG_LCD_CLASS_DEVICE=y -CONFIG_LCD_ILI8960=y -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=2 -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MACH_JZ4740=y -CONFIG_MFD_CORE=y -CONFIG_MFD_JZ4740_ADC=y -CONFIG_MIPS=y -# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set -CONFIG_MIPS_L1_CACHE_SHIFT=5 -# CONFIG_MIPS_MACHINE is not set -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -# CONFIG_MMC_BLOCK_BOUNCE is not set -CONFIG_MMC_JZ4740=y -CONFIG_MODULES_USE_ELF_REL=y -# CONFIG_MOUSE_BCM5974 is not set -# CONFIG_MOUSE_CYAPA is not set -# CONFIG_MOUSE_PS2 is not set -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MTD_CFI is not set -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_NAND_JZ4740=y -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_BLOCK is not set -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MUSB_PIO_ONLY=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NLS=y -CONFIG_NLS_ASCII=y -CONFIG_NLS_CODEPAGE_1250=y -CONFIG_NLS_CODEPAGE_1251=y -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_CODEPAGE_737=y -CONFIG_NLS_CODEPAGE_775=y -CONFIG_NLS_CODEPAGE_850=y -CONFIG_NLS_CODEPAGE_852=y -CONFIG_NLS_CODEPAGE_855=y -CONFIG_NLS_CODEPAGE_857=y -CONFIG_NLS_CODEPAGE_860=y -CONFIG_NLS_CODEPAGE_861=y -CONFIG_NLS_CODEPAGE_862=y -CONFIG_NLS_CODEPAGE_863=y -CONFIG_NLS_CODEPAGE_864=y -CONFIG_NLS_CODEPAGE_865=y -CONFIG_NLS_CODEPAGE_866=y -CONFIG_NLS_CODEPAGE_869=y -CONFIG_NLS_CODEPAGE_874=y -CONFIG_NLS_CODEPAGE_932=y -CONFIG_NLS_CODEPAGE_936=y -CONFIG_NLS_CODEPAGE_949=y -CONFIG_NLS_CODEPAGE_950=y -CONFIG_NLS_ISO8859_1=y -CONFIG_NLS_ISO8859_13=y -CONFIG_NLS_ISO8859_14=y -CONFIG_NLS_ISO8859_15=y -CONFIG_NLS_ISO8859_2=y -CONFIG_NLS_ISO8859_3=y -CONFIG_NLS_ISO8859_4=y -CONFIG_NLS_ISO8859_5=y -CONFIG_NLS_ISO8859_6=y -CONFIG_NLS_ISO8859_7=y -CONFIG_NLS_ISO8859_8=y -CONFIG_NLS_ISO8859_9=y -CONFIG_NLS_KOI8_R=y -CONFIG_NLS_KOI8_U=y -CONFIG_NLS_UTF8=y -CONFIG_NOP_USB_XCEIV=y -# CONFIG_NO_IOPORT_MAP is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PM=y -CONFIG_PM_CLK=y -# CONFIG_PM_DEBUG is not set -CONFIG_PM_SLEEP=y -CONFIG_POWER_SUPPLY=y -CONFIG_PREEMPT=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_RCU=y -CONFIG_PRINTK_TIME=y -CONFIG_PWM=y -CONFIG_PWM_JZ4740=y -CONFIG_PWM_SYSFS=y -# CONFIG_RCU_BOOST is not set -CONFIG_RCU_CPU_STALL_VERBOSE=y -CONFIG_RCU_STALL_COMMON=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_SPI=y -CONFIG_RTC_CLASS=y -# CONFIG_RTC_DRV_CMOS is not set -CONFIG_RTC_DRV_JZ4740=y -# CONFIG_SCSI_DMA is not set -CONFIG_SERIO=y -CONFIG_SERIO_LIBPS2=y -CONFIG_SND=y -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_DMAENGINE_PCM=y -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_JACK=y -CONFIG_SND_JZ4740_SOC=y -CONFIG_SND_JZ4740_SOC_I2S=y -CONFIG_SND_JZ4740_SOC_QI_LB60=y -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -CONFIG_SND_PCM=y -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -CONFIG_SND_SOC=y -# CONFIG_SND_SOC_FSL_SSI is not set -CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y -CONFIG_SND_SOC_I2C_AND_SPI=y -# CONFIG_SND_SOC_IMX_AUDMUX is not set -CONFIG_SND_SOC_JZ4740_CODEC=y -CONFIG_SND_TIMER=y -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SPI=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -CONFIG_SPI_MASTER=y -# CONFIG_SQUASHFS is not set -# CONFIG_STAGING is not set -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SYN_COOKIES is not set -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y -CONFIG_SYS_SUPPORTS_ZBOOT=y -CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TREE_PREEMPT_RCU=y -CONFIG_UBIFS_FS=y -CONFIG_UBIFS_FS_ADVANCED_COMPR=y -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_USB=y -# CONFIG_USB_AUDIO is not set -CONFIG_USB_COMMON=y -# CONFIG_USB_EHCI_HCD is not set -CONFIG_USB_ETH=y -# CONFIG_USB_ETH_EEM is not set -# CONFIG_USB_ETH_RNDIS is not set -CONFIG_USB_F_ECM=y -CONFIG_USB_F_SUBSET=y -CONFIG_USB_GADGET=y -CONFIG_USB_LIBCOMPOSITE=y -# CONFIG_USB_MUSB_DUAL_ROLE is not set -CONFIG_USB_MUSB_GADGET=y -CONFIG_USB_MUSB_HDRC=y -# CONFIG_USB_MUSB_HOST is not set -CONFIG_USB_MUSB_JZ4740=y -# CONFIG_USB_MUSB_TUSB6010 is not set -# CONFIG_USB_MUSB_UX500 is not set -CONFIG_USB_OTG_BLACKLIST_HUB=y -CONFIG_USB_PHY=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_U_ETHER=y -CONFIG_VFAT_FS=y -# CONFIG_VGA_CONSOLE is not set -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_VT_HW_CONSOLE_BINDING=y -# CONFIG_WATCHDOG is not set -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/xburst/image/Makefile b/target/linux/xburst/image/Makefile deleted file mode 100644 index ff25fbebc..000000000 --- a/target/linux/xburst/image/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (C) 2009-2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -JFFS2_BLOCKSIZE=256k 512k - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -ifneq ($(CONFIG_TARGET_xburst_qi_lb60),) -UBI_OPTS = -m 4096 -p 512KiB -UBIFS_OPTS = -m 4096 -e 516096 -c 4095 -else -UBI_OPTS = -m 2048 -p 128KiB -s 512 -UBIFS_OPTS = -m 2048 -e 126KiB -c 4096 -endif - -UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage.bin - -define MkImageGzip - gzip -9n -c $(1) > $(1).gz - mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \ - -e 0x80010000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ - -d $(1).gz $(2) -endef - -define Image/Prepare - $(call MkImageGzip,$(KDIR)/vmlinux,$(KDIR)/uimage) -endef - -define Image/BuildKernel - cp $(KDIR)/uimage $(UIMAGE) -endef - -define Image/Build/squashfs - $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) -endef - -define Image/Build - dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/xburst/image/ubinize.cfg b/target/linux/xburst/image/ubinize.cfg deleted file mode 100644 index 49d55b984..000000000 --- a/target/linux/xburst/image/ubinize.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[rootfs] -# Volume mode (other option is static) -mode=ubi -# Source image -image=root.ubifs -# Volume ID in UBI image -vol_id=0 -# Allow for dynamic resize -vol_type=dynamic -# Volume name -vol_name=rootfs -# Autoresize volume at first mount -vol_flags=autoresize - diff --git a/target/linux/xburst/modules.mk b/target/linux/xburst/modules.mk deleted file mode 100644 index 95cebdad6..000000000 --- a/target/linux/xburst/modules.mk +++ /dev/null @@ -1,40 +0,0 @@ - - -SOUND_MENU:=Sound Support - -define KernelPackage/sound-soc-jz4740 - SUBMENU:=$(SOUND_MENU) - DEPENDS:=kmod-sound-soc-core @TARGET_xburst @BROKEN - TITLE:=JZ4740 SoC sound support - KCONFIG:=CONFIG_SND_JZ4740_SOC CONFIG_SND_JZ4740_SOC_I2S - FILES:= \ - $(LINUX_DIR)/sound/soc/jz4740/snd-soc-jz4740.ko \ - $(LINUX_DIR)/sound/soc/jz4740/snd-soc-jz4740-i2s.ko - AUTOLOAD:=$(call AutoLoad,60,snd-soc-jz4740 snd-soc-jz4740-i2s) -endef - -define KernelPackage/sound-soc-jz4740-codec - SUBMENU:=$(SOUND_MENU) - DEPENDS:=kmod-sound-soc-core @TARGET_xburst @BROKEN - TITLE:=JZ4740 SoC internal codec support - KCONFIG:=CONFIG_SND_SOC_JZ4740_CODEC - FILES:=$(LINUX_DIR)/sound/soc/codecs/snd-soc-jz4740-codec.ko - AUTOLOAD:=$(call AutoLoad,60,snd-soc-jz4740-codec) -endef - -define KernelPackage/sound-soc-xburst/default - SUBMENU:=$(SOUND_MENU) - DEPENDS:=kmod-sound-soc-jz4740 kmod-sound-soc-jz4740-codec @TARGET_xburst_$(if $(4),$(4),$(3)) @BROKEN - TITLE:=$(1) sound support - KCONFIG:=CONFIG_SND_JZ4740_SOC_$(2) - FILES:=$(LINUX_DIR)/sound/soc/jz4740/snd-soc-$(3).ko - AUTOLOAD:=$(call AutoLoad,65,snd-soc-$(3)) -endef - -define KernelPackage/sound-soc-qilb60 -$(call KernelPackage/sound-soc-xburst/default,QI NanoNote,QI_LB60,qi-lb60,qi_lb60) -endef - -$(eval $(call KernelPackage,sound-soc-jz4740)) -$(eval $(call KernelPackage,sound-soc-jz4740-codec)) -$(eval $(call KernelPackage,sound-soc-qilb60)) diff --git a/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch b/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch deleted file mode 100644 index 93851d728..000000000 --- a/target/linux/xburst/patches-3.18/001-ubi-Read-only-the-vid-header-instead-of-the-whole-pa.patch +++ /dev/null @@ -1,20 +0,0 @@ -From b0eb5175e0de3e5134a36a7da382d8811562af12 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Tue, 15 Mar 2011 12:49:15 +0100 -Subject: [PATCH 1/7] ubi: Read only the vid header instead of the whole page - ---- - drivers/mtd/ubi/io.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/mtd/ubi/io.c -+++ b/drivers/mtd/ubi/io.c -@@ -1014,7 +1014,7 @@ int ubi_io_read_vid_hdr(struct ubi_devic - - p = (char *)vid_hdr - ubi->vid_hdr_shift; - read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, -- ubi->vid_hdr_alsize); -+ UBI_VID_HDR_SIZE + ubi->vid_hdr_shift); - if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err)) - return read_err; - diff --git a/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch b/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch deleted file mode 100644 index 046da5191..000000000 --- a/target/linux/xburst/patches-3.18/002-NAND-Optimize-NAND_ECC_HW_OOB_FIRST-read.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 98d33db1c87e2447b9b203399d2f995e05ecdb52 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Sat, 26 Feb 2011 15:30:07 +0100 -Subject: [PATCH 2/7] NAND: Optimize NAND_ECC_HW_OOB_FIRST read - -Avoid sending unnecessary READ commands to the chip. ---- - drivers/mtd/nand/nand_base.c | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - ---- a/drivers/mtd/nand/nand_base.c -+++ b/drivers/mtd/nand/nand_base.c -@@ -1360,9 +1360,16 @@ static int nand_read_page_hwecc_oob_firs - unsigned int max_bitflips = 0; - - /* Read the OOB area first */ -- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); -- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -- chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); -+ /* Read the OOB area first */ -+ if (mtd->writesize > 512) { -+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); -+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1); -+ } else { -+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); -+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); -+ } - - for (i = 0; i < chip->ecc.total; i++) - ecc_code[i] = chip->oob_poi[eccpos[i]]; -@@ -1575,7 +1582,9 @@ static int nand_do_read_ops(struct mtd_i - __func__, buf); - - read_retry: -- chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); -+ if (chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) { -+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page); -+ } - - /* - * Now read the page into the buffer. Absent an error, diff --git a/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch b/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch deleted file mode 100644 index 974eb7a5d..000000000 --- a/target/linux/xburst/patches-3.18/003-NAND-Add-support-for-subpage-reads-for-NAND_ECC_HW_O.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 6031a240816d1c9a10f596d0648e586f6b878809 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Tue, 15 Mar 2011 12:33:41 +0100 -Subject: [PATCH 3/7] NAND: Add support for subpage reads for - NAND_ECC_HW_OOB_FIRST - ---- - drivers/mtd/nand/nand_base.c | 77 +++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 76 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/nand/nand_base.c -+++ b/drivers/mtd/nand/nand_base.c -@@ -1393,6 +1393,75 @@ static int nand_read_page_hwecc_oob_firs - } - - /** -+ * nand_read_subpage_hwecc_oob_first - [REPLACABLE] hw ecc based sub-page read function -+ * @mtd: mtd info structure -+ * @chip: nand chip info structure -+ * @data_offs: offset of requested data within the page -+ * @readlen: data length -+ * @bufpoi: buffer to store read data -+ * @page: page number to read -+ * -+ * Hardware ECC for large page chips, require OOB to be read first. -+ * For this ECC mode, the write_page method is re-used from ECC_HW. -+ * These methods read/write ECC from the OOB area, unlike the -+ * ECC_HW_SYNDROME support with multiple ECC steps, follows the -+ * "infix ECC" scheme and reads/writes ECC from the data area, by -+ * overwriting the NAND manufacturer bad block markings. -+ */ -+static int nand_read_subpage_hwecc_oob_first(struct mtd_info *mtd, struct nand_chip *chip, -+ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi, int page) -+{ -+ int start_step, end_step, num_steps; -+ uint32_t *eccpos = chip->ecc.layout->eccpos; -+ uint8_t *p; -+ int data_col_addr; -+ int eccsize = chip->ecc.size; -+ int eccbytes = chip->ecc.bytes; -+ uint8_t *ecc_code = chip->buffers->ecccode; -+ uint8_t *ecc_calc = chip->buffers->ecccalc; -+ int i; -+ -+ /* Column address wihin the page aligned to ECC size */ -+ start_step = data_offs / chip->ecc.size; -+ end_step = (data_offs + readlen - 1) / chip->ecc.size; -+ num_steps = end_step - start_step + 1; -+ -+ data_col_addr = start_step * chip->ecc.size; -+ -+ /* Read the OOB area first */ -+ if (mtd->writesize > 512) { -+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page); -+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1); -+ } else { -+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); -+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); -+ chip->cmdfunc(mtd, NAND_CMD_READ0, data_col_addr, page); -+ } -+ -+ for (i = 0; i < chip->ecc.total; i++) -+ ecc_code[i] = chip->oob_poi[eccpos[i]]; -+ -+ p = bufpoi + data_col_addr; -+ -+ for (i = eccbytes * start_step; num_steps; num_steps--, i += eccbytes, p += eccsize) { -+ int stat; -+ -+ chip->ecc.hwctl(mtd, NAND_ECC_READ); -+ chip->read_buf(mtd, p, eccsize); -+ chip->ecc.calculate(mtd, p, &ecc_calc[i]); -+ -+ stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL); -+ if (stat < 0) -+ mtd->ecc_stats.failed++; -+ else -+ mtd->ecc_stats.corrected += stat; -+ } -+ -+ return 0; -+} -+ -+/** - * nand_read_page_syndrome - [REPLACEABLE] hardware ECC syndrome based page read - * @mtd: mtd info structure - * @chip: nand chip info structure -@@ -3950,8 +4019,14 @@ int nand_scan_tail(struct mtd_info *mtd) - pr_warn("No ECC functions supplied; hardware ECC not possible\n"); - BUG(); - } -- if (!ecc->read_page) -+ -+ if (!ecc->read_page) { - ecc->read_page = nand_read_page_hwecc_oob_first; -+ if (!ecc->read_subpage) { -+ ecc->read_subpage = nand_read_subpage_hwecc_oob_first; -+ chip->options |= NAND_SUBPAGE_READ; -+ } -+ } - - case NAND_ECC_HW: - /* Use standard hwecc read page function? */ diff --git a/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch b/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch deleted file mode 100644 index f2c26ade0..000000000 --- a/target/linux/xburst/patches-3.18/004-ASoC-JZ4740-delay-activation-of-the-DAC-to-work-arou.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1a1095927d224403af8ad57c354cc64521bf3081 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Sat, 16 Jun 2012 19:36:31 +0200 -Subject: [PATCH 4/7] ASoC: JZ4740: delay activation of the DAC to work around - a sound bug. - -A proper fix of that bug would require a big rewrite of the driver, -which (I hope) will be done eventually. ---- - sound/soc/codecs/jz4740.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/sound/soc/codecs/jz4740.c -+++ b/sound/soc/codecs/jz4740.c -@@ -249,12 +249,15 @@ static int jz4740_codec_set_bias_level(s - case SND_SOC_BIAS_ON: - break; - case SND_SOC_BIAS_PREPARE: -- mask = JZ4740_CODEC_1_VREF_DISABLE | -- JZ4740_CODEC_1_VREF_AMP_DISABLE | -- JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; -+ mask = JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; - value = 0; - - regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, value); -+ -+ msleep(500); -+ mask = JZ4740_CODEC_1_VREF_DISABLE | -+ JZ4740_CODEC_1_VREF_AMP_DISABLE; -+ regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, 0); - break; - case SND_SOC_BIAS_STANDBY: - /* The only way to clear the suspend flag is to reset the codec */ diff --git a/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch b/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch deleted file mode 100644 index f38483ab5..000000000 --- a/target/linux/xburst/patches-3.18/005-RTC-JZ4740-Init-the-regulator-register-on-startup.patch +++ /dev/null @@ -1,55 +0,0 @@ -From f05b1ecd7e4fde7e69320a4b7be461636e982991 Mon Sep 17 00:00:00 2001 -From: Paul Cercueil -Date: Thu, 13 Sep 2012 00:09:20 +0200 -Subject: [PATCH 5/7] RTC: JZ4740: Init the "regulator" register on startup. - -This register controls the accuracy of the RTC. uC/OS-II use -the RTC as a 100Hz clock, and writes a completely wrong value -on that register, that we have to overwrite if we want a working -real-time clock. - -Signed-off-by: Paul Cercueil ---- - drivers/rtc/rtc-jz4740.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - ---- a/drivers/rtc/rtc-jz4740.c -+++ b/drivers/rtc/rtc-jz4740.c -@@ -15,6 +15,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -216,6 +217,7 @@ static int jz4740_rtc_probe(struct platf - struct jz4740_rtc *rtc; - uint32_t scratchpad; - struct resource *mem; -+ struct clk *rtc_clk; - - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); - if (!rtc) -@@ -263,6 +265,21 @@ static int jz4740_rtc_probe(struct platf - } - } - -+ rtc_clk = clk_get(&pdev->dev, "rtc"); -+ if (IS_ERR(rtc_clk)) { -+ dev_err(&pdev->dev, "Failed to get RTC clock\n"); -+ return PTR_ERR(rtc_clk); -+ } -+ -+ /* TODO: initialize the ADJC bits (25:16) to fine-tune -+ * the accuracy of the RTC */ -+ ret = jz4740_rtc_reg_write(rtc, JZ_REG_RTC_REGULATOR, -+ (clk_get_rate(rtc_clk) - 1) & 0xffff); -+ clk_put(rtc_clk); -+ -+ if (ret) -+ dev_warn(&pdev->dev, "Could not update RTC regulator register\n"); -+ - return 0; - } - diff --git a/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch b/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch deleted file mode 100644 index dc12d9340..000000000 --- a/target/linux/xburst/patches-3.18/006-Add-ili8960-lcd-driver.patch +++ /dev/null @@ -1,309 +0,0 @@ -From 8741ead92bc93e66740237e51b88b8690ebcbba3 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Sun, 1 Aug 2010 21:19:40 +0200 -Subject: [PATCH 6/7] Add ili8960 lcd driver - -Includes the following changes from the jz-3.5 branch: -- Use module_spi_driver -- Use devm_kzalloc -- Use kstrtoul - -Signed-off-by: Lars-Peter Clausen ---- - drivers/video/backlight/Kconfig | 7 + - drivers/video/backlight/Makefile | 1 + - drivers/video/backlight/ili8960.c | 262 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 270 insertions(+) - create mode 100644 drivers/video/backlight/ili8960.c - ---- a/drivers/video/backlight/Kconfig -+++ b/drivers/video/backlight/Kconfig -@@ -59,6 +59,13 @@ config LCD_LTV350QV - - The LTV350QV panel is present on all ATSTK1000 boards. - -+config LCD_ILI8960 -+ tristate "Ilitek ili8960 LCD driver" -+ depends on LCD_CLASS_DEVICE && SPI -+ default n -+ help -+ Driver for the Ilitek ili8960 LCD controller chip. -+ - config LCD_ILI922X - tristate "ILI Technology ILI9221/ILI9222 support" - depends on SPI ---- a/drivers/video/backlight/Makefile -+++ b/drivers/video/backlight/Makefile -@@ -5,6 +5,7 @@ obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o - obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o - obj-$(CONFIG_LCD_HP700) += jornada720_lcd.o - obj-$(CONFIG_LCD_HX8357) += hx8357.o -+obj-$(CONFIG_LCD_ILI8960) += ili8960.o - obj-$(CONFIG_LCD_ILI922X) += ili922x.o - obj-$(CONFIG_LCD_ILI9320) += ili9320.o - obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o ---- /dev/null -+++ b/drivers/video/backlight/ili8960.c -@@ -0,0 +1,262 @@ -+/* -+ * Copyright (C) 2009-2010, Lars-Peter Clausen -+ * Driver for Ilitek ili8960 LCD -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 675 Mass Ave, Cambridge, MA 02139, USA. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+ -+struct ili8960 { -+ struct spi_device *spi; -+ struct lcd_device *lcd; -+ bool enabled; -+ unsigned int brightness; -+}; -+ -+#define ILI8960_REG_BRIGHTNESS 0x03 -+#define ILI8960_REG_POWER 0x05 -+#define ILI8960_REG_CONTRAST 0x0d -+ -+static int ili8960_write_reg(struct spi_device *spi, uint8_t reg, -+ uint8_t data) -+{ -+ uint8_t buf[2]; -+ buf[0] = ((reg & 0x40) << 1) | (reg & 0x3f); -+ buf[1] = data; -+ -+ return spi_write(spi, buf, sizeof(buf)); -+} -+ -+static int ili8960_programm_power(struct spi_device *spi, bool enabled) -+{ -+ int ret; -+ -+ if (enabled) -+ mdelay(20); -+ -+ ret = ili8960_write_reg(spi, ILI8960_REG_POWER, enabled ? 0xc7 : 0xc6); -+ -+ if (!enabled) -+ mdelay(20); -+ -+ return ret; -+} -+ -+static int ili8960_set_power(struct lcd_device *lcd, int power) -+{ -+ struct ili8960 *ili8960 = lcd_get_data(lcd); -+ -+ switch (power) { -+ case FB_BLANK_UNBLANK: -+ ili8960->enabled = true; -+ break; -+ default: -+ return 0; -+ } -+ -+ return ili8960_programm_power(ili8960->spi, ili8960->enabled); -+} -+ -+static int ili8960_early_set_power(struct lcd_device *lcd, int power) -+{ -+ struct ili8960 *ili8960 = lcd_get_data(lcd); -+ -+ switch (power) { -+ case FB_BLANK_UNBLANK: -+ return 0; -+ default: -+ ili8960->enabled = false; -+ break; -+ } -+ -+ return ili8960_programm_power(ili8960->spi, ili8960->enabled); -+} -+ -+static int ili8960_get_power(struct lcd_device *lcd) -+{ -+ struct ili8960 *ili8960 = lcd_get_data(lcd); -+ return ili8960->enabled ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; -+} -+ -+static int ili8960_set_contrast(struct lcd_device *lcd, int contrast) -+{ -+ struct ili8960 *ili8960 = lcd_get_data(lcd); -+ -+ return ili8960_write_reg(ili8960->spi, ILI8960_REG_CONTRAST, contrast); -+} -+ -+static int ili8960_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) -+{ -+ if (mode->xres != 320 && mode->yres != 240) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+static int ili8960_set_brightness(struct ili8960 *ili8960, int brightness) -+{ -+ int ret; -+ -+ ret = ili8960_write_reg(ili8960->spi, ILI8960_REG_BRIGHTNESS, brightness); -+ -+ if (ret == 0) -+ ili8960->brightness = brightness; -+ -+ return ret; -+} -+ -+static ssize_t ili8960_show_brightness(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct lcd_device *ld = to_lcd_device(dev); -+ struct ili8960 *ili8960 = lcd_get_data(ld); -+ -+ return sprintf(buf, "%u\n", ili8960->brightness); -+} -+ -+static ssize_t ili8960_store_brightness(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t count) -+{ -+ struct lcd_device *ld = to_lcd_device(dev); -+ struct ili8960 *ili8960 = lcd_get_data(ld); -+ unsigned long brightness; -+ int ret; -+ -+ ret = kstrtoul(buf, 0, &brightness); -+ if (ret) -+ return ret; -+ -+ if (brightness > 255) -+ return -EINVAL; -+ -+ ili8960_set_brightness(ili8960, brightness); -+ -+ return count; -+} -+ -+ -+static DEVICE_ATTR(brightness, 0644, ili8960_show_brightness, -+ ili8960_store_brightness); -+ -+static struct lcd_ops ili8960_lcd_ops = { -+ .set_power = ili8960_set_power, -+ .early_set_power = ili8960_early_set_power, -+ .get_power = ili8960_get_power, -+ .set_contrast = ili8960_set_contrast, -+ .set_mode = ili8960_set_mode, -+}; -+ -+static int ili8960_probe(struct spi_device *spi) -+{ -+ int ret; -+ struct ili8960 *ili8960; -+ -+ ili8960 = devm_kzalloc(&spi->dev, sizeof(*ili8960), GFP_KERNEL); -+ if (!ili8960) -+ return -ENOMEM; -+ -+ spi->bits_per_word = 8; -+ spi->mode = SPI_MODE_3; -+ -+ ret = spi_setup(spi); -+ if (ret) { -+ dev_err(&spi->dev, "Failed to setup spi\n"); -+ return ret; -+ } -+ -+ ili8960->spi = spi; -+ -+ ili8960->lcd = lcd_device_register("ili8960-lcd", &spi->dev, ili8960, -+ &ili8960_lcd_ops); -+ -+ if (IS_ERR(ili8960->lcd)) { -+ ret = PTR_ERR(ili8960->lcd); -+ dev_err(&spi->dev, "Failed to register lcd device: %d\n", ret); -+ return ret; -+ } -+ -+ ili8960->lcd->props.max_contrast = 255; -+ -+ ret = device_create_file(&ili8960->lcd->dev, &dev_attr_brightness); -+ if (ret) -+ goto err_unregister_lcd; -+ -+ ili8960_programm_power(ili8960->spi, true); -+ ili8960->enabled = true; -+ -+ spi_set_drvdata(spi, ili8960); -+ -+ ili8960_write_reg(spi, 0x13, 0x01); -+ -+ return 0; -+err_unregister_lcd: -+ lcd_device_unregister(ili8960->lcd); -+ return ret; -+} -+ -+static int ili8960_remove(struct spi_device *spi) -+{ -+ struct ili8960 *ili8960 = spi_get_drvdata(spi); -+ -+ device_remove_file(&ili8960->lcd->dev, &dev_attr_brightness); -+ lcd_device_unregister(ili8960->lcd); -+ -+ spi_set_drvdata(spi, NULL); -+ return 0; -+} -+ -+#ifdef CONFIG_PM -+ -+static int ili8960_suspend(struct spi_device *spi, pm_message_t state) -+{ -+ struct ili8960 *ili8960 = spi_get_drvdata(spi); -+ -+ if (ili8960->enabled) -+ ili8960_programm_power(ili8960->spi, false); -+ -+ return 0; -+} -+ -+static int ili8960_resume(struct spi_device *spi) -+{ -+ struct ili8960 *ili8960 = spi_get_drvdata(spi); -+ -+ if (ili8960->enabled) -+ ili8960_programm_power(ili8960->spi, true); -+ -+ return 0; -+} -+ -+#else -+#define ili8960_suspend NULL -+#define ili8960_resume NULL -+#endif -+ -+static struct spi_driver ili8960_driver = { -+ .driver = { -+ .name = "ili8960", -+ .owner = THIS_MODULE, -+ }, -+ .probe = ili8960_probe, -+ .remove = ili8960_remove, -+ .suspend = ili8960_suspend, -+ .resume = ili8960_resume, -+}; -+module_spi_driver(ili8960_driver); -+ -+MODULE_AUTHOR("Lars-Peter Clausen"); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("LCD driver for Ilitek ili8960"); -+MODULE_ALIAS("spi:ili8960"); diff --git a/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch b/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch deleted file mode 100644 index b8aac66b3..000000000 --- a/target/linux/xburst/patches-3.18/007-qi_lb60-Don-t-use-3-wire-spi-mode-for-the-display-fo.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 4371d60ae342c76708c4317e06fb7dcf0159c2f1 Mon Sep 17 00:00:00 2001 -From: Lars-Peter Clausen -Date: Wed, 13 Oct 2010 01:17:24 +0200 -Subject: [PATCH 7/7] qi_lb60: Don't use 3-wire spi mode for the display for - now - -The spi_gpio driver does not support 3-wire mode. ---- - arch/mips/jz4740/board-qi_lb60.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/arch/mips/jz4740/board-qi_lb60.c -+++ b/arch/mips/jz4740/board-qi_lb60.c -@@ -312,7 +312,6 @@ static struct spi_board_info qi_lb60_spi - .chip_select = 0, - .bus_num = 1, - .max_speed_hz = 30 * 1000, -- .mode = SPI_3WIRE, - }, - }; - diff --git a/target/linux/xburst/qi_lb60/config-default b/target/linux/xburst/qi_lb60/config-default deleted file mode 100644 index 1fd421b5f..000000000 --- a/target/linux/xburst/qi_lb60/config-default +++ /dev/null @@ -1,33 +0,0 @@ -# CONFIG_BACKLIGHT_CLASS_DEVICE is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_INPUT_MATRIXKMAP=y -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_MATRIX=y -CONFIG_LCD_CLASS_DEVICE=y -CONFIG_LCD_ILI8960=y -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -CONFIG_LOGO=y -# CONFIG_LOGO_LINUX_CLUT224 is not set -# CONFIG_LOGO_LINUX_MONO is not set -# CONFIG_LOGO_LINUX_VGA16 is not set -CONFIG_REGMAP_SPI=y -CONFIG_SND_HWDEP=y -CONFIG_SND_MIXER_OSS=y -CONFIG_SND_PCM_OSS=y -CONFIG_SND_SEQUENCER=y -# CONFIG_SND_SEQUENCER_OSS is not set -CONFIG_SND_SEQ_DUMMY=y -# CONFIG_SND_VIRMIDI is not set -CONFIG_SOUND_OSS_CORE=y -CONFIG_SOUND_OSS_CORE_PRECLAIM=y -CONFIG_SPI=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -CONFIG_SPI_MASTER=y -# CONFIG_USB_FUSB300 is not set -CONFIG_USB_JZ4740=y diff --git a/target/linux/xburst/qi_lb60/target.mk b/target/linux/xburst/qi_lb60/target.mk deleted file mode 100644 index 8ae71bd9c..000000000 --- a/target/linux/xburst/qi_lb60/target.mk +++ /dev/null @@ -1 +0,0 @@ -BOARDNAME:=QI Ben Nanonote (qi_lb60) diff --git a/target/linux/zynq/Makefile b/target/linux/zynq/Makefile deleted file mode 100644 index 82b5d3694..000000000 --- a/target/linux/zynq/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk - -ARCH:=arm -BOARD:=zynq -BOARDNAME:=Xilinx Zynq 7000 SoCs -FEATURES:=fpu gpio rtc usb usbgadget targz -CPU_TYPE:=cortex-a9 -CPU_SUBTYPE:=neon -MAINTAINER:=Jason Wu - -# future support SUBTARGETS: for both zynq and zynqmp - -define Target/Description - Build firmware image for Zynq 7000 SoC devices. -endef - -KERNEL_PATCHVER:=4.4 - -include $(INCLUDE_DIR)/target.mk - -KERNELNAME:=zImage dtbs - -DEFAULT_PACKAGES += uboot-envtools - -$(eval $(call BuildTarget)) diff --git a/target/linux/zynq/base-files.mk b/target/linux/zynq/base-files.mk deleted file mode 100644 index fdd2c714b..000000000 --- a/target/linux/zynq/base-files.mk +++ /dev/null @@ -1,3 +0,0 @@ -define Package/base-files/install-target - rm -f $(1)/etc/config/network -endef diff --git a/target/linux/zynq/base-files/etc/board.d/02_network b/target/linux/zynq/base-files/etc/board.d/02_network deleted file mode 100755 index ff907637a..000000000 --- a/target/linux/zynq/base-files/etc/board.d/02_network +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Copyright (C) 2015 OpenWrt.org - -. /lib/functions/uci-defaults.sh - -board_config_update - -case "$(board_name)" in - xlnx,zynq-zc702|xlnx,zynq-zed|xlnx,zynq-zybo) - ucidef_set_interface_lan 'eth0' - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/zynq/base-files/etc/config/network b/target/linux/zynq/base-files/etc/config/network deleted file mode 100644 index 0d74bda44..000000000 --- a/target/linux/zynq/base-files/etc/config/network +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2015 OpenWrt.org - -config interface loopback - option ifname lo - option proto static - option ipaddr 127.0.0.1 - option netmask 255.0.0.0 - -config interface lan - option ifname eth0 - option proto static - option ipaddr 192.168.1.1 - option netmask 255.255.255.0 - option ip6assign 60 - -config globals globals - option ula_prefix auto diff --git a/target/linux/zynq/base-files/etc/inittab b/target/linux/zynq/base-files/etc/inittab deleted file mode 100644 index 9820e7144..000000000 --- a/target/linux/zynq/base-files/etc/inittab +++ /dev/null @@ -1,3 +0,0 @@ -::sysinit:/etc/init.d/rcS S boot -::shutdown:/etc/init.d/rcS K shutdown -::askconsole:/usr/libexec/login.sh diff --git a/target/linux/zynq/config-4.4 b/target/linux/zynq/config-4.4 deleted file mode 100644 index e22f2325a..000000000 --- a/target/linux/zynq/config-4.4 +++ /dev/null @@ -1,752 +0,0 @@ -CONFIG_ADVISE_SYSCALLS=y -CONFIG_ALIGNMENT_TRAP=y -# CONFIG_AMBA_PL08X is not set -# CONFIG_APM_EMULATION is not set -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_ARCH_HAS_SG_CHAIN=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MULTIPLATFORM=y -# CONFIG_ARCH_MULTI_CPU_AUTO is not set -CONFIG_ARCH_MULTI_V6_V7=y -CONFIG_ARCH_MULTI_V7=y -CONFIG_ARCH_NR_GPIO=1024 -CONFIG_ARCH_REQUIRE_GPIOLIB=y -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_VEXPRESS=y -CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y -# CONFIG_ARCH_VEXPRESS_SPC is not set -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_ARCH_ZYNQ=y -CONFIG_ARM=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_CCI=y -CONFIG_ARM_CCI400_COMMON=y -CONFIG_ARM_CCI400_PMU=y -CONFIG_ARM_CCI_PMU=y -# CONFIG_ARM_CHARLCD is not set -CONFIG_ARM_CPU_SUSPEND=y -CONFIG_ARM_ERRATA_643719=y -CONFIG_ARM_ERRATA_720789=y -CONFIG_ARM_ERRATA_754322=y -CONFIG_ARM_ERRATA_754327=y -CONFIG_ARM_ERRATA_764369=y -CONFIG_ARM_ERRATA_775420=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GLOBAL_TIMER=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_ARM_HEAVY_MB=y -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_L1_CACHE_SHIFT_6=y -# CONFIG_ARM_LPAE is not set -CONFIG_ARM_PATCH_PHYS_VIRT=y -# CONFIG_ARM_PL172_MPMC is not set -CONFIG_ARM_PMU=y -# CONFIG_ARM_SMMU is not set -# CONFIG_ARM_SP805_WATCHDOG is not set -CONFIG_ARM_THUMB=y -# CONFIG_ARM_THUMBEE is not set -CONFIG_ARM_TIMER_SP804=y -CONFIG_ARM_UNWIND=y -CONFIG_ARM_VIRT_EXT=y -CONFIG_ARM_ZYNQ_CPUIDLE=y -CONFIG_ATAGS=y -CONFIG_AUTO_ZRELADDR=y -# CONFIG_AXI_DMAC is not set -# CONFIG_BLK_CGROUP is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=16384 -CONFIG_BLK_DEV_SD=y -CONFIG_BOUNCE=y -CONFIG_BUILD_BIN2C=y -CONFIG_CACHE_L2X0=y -CONFIG_CADENCE_TTC_TIMER=y -CONFIG_CADENCE_WATCHDOG=y -CONFIG_CAN=y -# CONFIG_CAN_8DEV_USB is not set -CONFIG_CAN_BCM=y -CONFIG_CAN_CALC_BITTIMING=y -# CONFIG_CAN_CC770 is not set -# CONFIG_CAN_C_CAN is not set -CONFIG_CAN_DEV=y -# CONFIG_CAN_EMS_USB is not set -# CONFIG_CAN_ESD_USB2 is not set -# CONFIG_CAN_FLEXCAN is not set -# CONFIG_CAN_GRCAN is not set -CONFIG_CAN_GW=y -# CONFIG_CAN_KVASER_USB is not set -# CONFIG_CAN_LEDS is not set -# CONFIG_CAN_MCP251X is not set -# CONFIG_CAN_PEAK_USB is not set -CONFIG_CAN_RAW=y -# CONFIG_CAN_SJA1000 is not set -# CONFIG_CAN_SOFTING is not set -# CONFIG_CAN_TI_HECC is not set -CONFIG_CAN_XILINXCAN=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_CHR_DEV_SG=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y -CONFIG_CLKSRC_MMIO=y -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_PROBE=y -CONFIG_CLKSRC_VERSATILE=y -CONFIG_CLK_SP810=y -CONFIG_CLK_VEXPRESS_OSC=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMA=y -CONFIG_CMA_ALIGNMENT=8 -CONFIG_CMA_AREAS=7 -# CONFIG_CMA_DEBUG is not set -# CONFIG_CMA_DEBUGFS is not set -CONFIG_CMA_SIZE_MBYTES=16 -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -CONFIG_CMDLINE="console=ttyPS0,115200n8 root=/dev/ram rw initrd=0x00800000,16M earlyprintk" -CONFIG_CMDLINE_FROM_BOOTLOADER=y -CONFIG_COMMON_CLK=y -# CONFIG_COMMON_CLK_AXI_CLKGEN is not set -CONFIG_COMMON_CLK_SI570=y -CONFIG_COMMON_CLK_VERSATILE=y -CONFIG_COMPAT_BRK=y -CONFIG_CONNECTOR=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_COREDUMP=y -# CONFIG_CPUFREQ_DT is not set -# CONFIG_CPUSETS is not set -CONFIG_CPU_32v6K=y -CONFIG_CPU_32v7=y -CONFIG_CPU_ABRT_EV7=y -# CONFIG_CPU_BIG_ENDIAN is not set -# CONFIG_CPU_BPREDICT_DISABLE is not set -CONFIG_CPU_CACHE_V7=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -CONFIG_CPU_FREQ=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_STAT=y -CONFIG_CPU_FREQ_STAT_DETAILS=y -CONFIG_CPU_HAS_ASID=y -# CONFIG_CPU_ICACHE_DISABLE is not set -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_PM=y -CONFIG_CPU_RMAP=y -CONFIG_CPU_THERMAL=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_V7=y -CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_HW=y -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_DEBUG_FS is not set -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -# CONFIG_DEBUG_UART_8250 is not set -# CONFIG_DEBUG_USER is not set -CONFIG_DEFAULT_CFQ=y -# CONFIG_DEFAULT_DEADLINE is not set -CONFIG_DEFAULT_IOSCHED="cfq" -CONFIG_DMADEVICES=y -CONFIG_DMA_CMA=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DRM=y -# CONFIG_DRM_AMDGPU is not set -# CONFIG_DRM_ARMADA is not set -# CONFIG_DRM_AST is not set -# CONFIG_DRM_BOCHS is not set -CONFIG_DRM_BRIDGE=y -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_EXYNOS is not set -CONFIG_DRM_FBDEV_EMULATION=y -# CONFIG_DRM_FSL_DCU is not set -# CONFIG_DRM_I2C_ADV7511 is not set -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_NXP_TDA998X is not set -# CONFIG_DRM_I2C_SIL164 is not set -CONFIG_DRM_KMS_FB_HELPER=y -CONFIG_DRM_KMS_HELPER=y -# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set -# CONFIG_DRM_MGA is not set -# CONFIG_DRM_MGAG200 is not set -# CONFIG_DRM_NOUVEAU is not set -# CONFIG_DRM_NXP_PTN3460 is not set -# CONFIG_DRM_PARADE_PS8622 is not set -# CONFIG_DRM_QXL is not set -# CONFIG_DRM_R128 is not set -# CONFIG_DRM_RADEON is not set -# CONFIG_DRM_SAVAGE is not set -# CONFIG_DRM_STI is not set -# CONFIG_DRM_TDFX is not set -# CONFIG_DRM_TILCDC is not set -# CONFIG_DRM_UDL is not set -# CONFIG_DRM_VGEM is not set -# CONFIG_DRM_VIA is not set -CONFIG_DTC=y -CONFIG_DUMMY_CONSOLE=y -# CONFIG_DW_DMAC_PCI is not set -CONFIG_E1000E=y -CONFIG_EDAC=y -CONFIG_EDAC_ATOMIC_SCRUB=y -# CONFIG_EDAC_DEBUG is not set -CONFIG_EDAC_LEGACY_SYSFS=y -CONFIG_EDAC_MM_EDAC=y -CONFIG_EDAC_SUPPORT=y -# CONFIG_EDAC_SYNOPSYS is not set -CONFIG_EEPROM_AT24=y -CONFIG_EEPROM_AT25=y -CONFIG_ELF_CORE=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_EXPORTFS=y -CONFIG_EXT4_FS=y -CONFIG_EXTCON=y -# CONFIG_EXTCON_ADC_JACK is not set -CONFIG_FAT_FS=y -CONFIG_FB=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_CMDLINE=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_FOPS=y -CONFIG_FB_SYS_IMAGEBLIT=y -# CONFIG_FB_XILINX is not set -CONFIG_FHANDLE=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FREEZER=y -CONFIG_FS_MBCACHE=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IO=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GPIOLIB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_DEVRES=y -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_GENERIC_PLATFORM=y -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_ZYNQ=y -CONFIG_GRACE_PERIOD=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_ARM_SCU=y -CONFIG_HAVE_ARM_TWD=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_HAVE_BPF_JIT=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_IDE=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_HAVE_NET_DSA=y -CONFIG_HAVE_OPROFILE=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_PATA_PLATFORM=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_SMP=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_UID16=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HDMI=y -CONFIG_HID=y -CONFIG_HID_GENERIC=y -CONFIG_HID_MICROSOFT=y -CONFIG_HIGHMEM=y -# CONFIG_HIGHPTE is not set -CONFIG_HOTPLUG_CPU=y -CONFIG_HWMON=y -CONFIG_HW_CONSOLE=y -CONFIG_HZ_FIXED=0 -CONFIG_I2C=y -CONFIG_I2C_ALGOBIT=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CADENCE=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_MUX=y -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -CONFIG_I2C_MUX_PCA954x=y -CONFIG_ICST=y -CONFIG_IIO=y -CONFIG_IIO_BUFFER=y -CONFIG_IIO_KFIFO_BUF=y -CONFIG_IIO_TRIGGER=y -CONFIG_IIO_TRIGGERED_BUFFER=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_KEYBOARD=y -# CONFIG_INPUT_MISC is not set -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y -CONFIG_INPUT_MOUSEDEV_PSAUX=y -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_POLLDEV=y -CONFIG_INPUT_SPARSEKMAP=y -CONFIG_IOMMU_HELPER=y -# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set -CONFIG_IOMMU_SUPPORT=y -CONFIG_IOSCHED_CFQ=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_BOOTP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_RARP=y -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -# CONFIG_ISDN is not set -CONFIG_JBD2=y -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set -# CONFIG_JFFS2_FS_XATTR is not set -# CONFIG_JFFS2_LZMA is not set -CONFIG_JFFS2_ZLIB=y -CONFIG_KERNEL_GZIP=y -# CONFIG_KERNEL_MODE_NEON is not set -# CONFIG_KERNEL_XZ is not set -CONFIG_KEYBOARD_ATKBD=y -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_GPIO_POLLED=y -CONFIG_LEDS_GPIO=y -CONFIG_LEDS_TRIGGER_BACKLIGHT=y -CONFIG_LEDS_TRIGGER_CAMERA=y -CONFIG_LEDS_TRIGGER_CPU=y -CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_NETDEV is not set -CONFIG_LEDS_TRIGGER_ONESHOT=y -CONFIG_LEDS_TRIGGER_TRANSIENT=y -CONFIG_LIBFDT=y -CONFIG_LOCKD=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_MACB=y -CONFIG_MARVELL_PHY=y -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_BOARDINFO=y -# CONFIG_MDIO_GPIO is not set -CONFIG_MEDIA_CAMERA_SUPPORT=y -CONFIG_MEDIA_CONTROLLER=y -CONFIG_MEDIA_SUPPORT=y -# CONFIG_MEMCG is not set -CONFIG_MEMORY=y -CONFIG_MEMORY_ISOLATION=y -CONFIG_MFD_CORE=y -CONFIG_MFD_SYSCON=y -CONFIG_MFD_VEXPRESS_SYSREG=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_MIGRATION=y -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_OF_ARASAN=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -# CONFIG_MMC_TIFM_SD is not set -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MODULE_STRIPPED is not set -# CONFIG_MOUSE_BCM5974 is not set -# CONFIG_MOUSE_CYAPA is not set -# CONFIG_MOUSE_ELAN_I2C is not set -CONFIG_MOUSE_PS2=y -CONFIG_MOUSE_PS2_ALPS=y -CONFIG_MOUSE_PS2_CYPRESS=y -# CONFIG_MOUSE_PS2_ELANTECH is not set -CONFIG_MOUSE_PS2_FOCALTECH=y -CONFIG_MOUSE_PS2_LOGIPS2PP=y -CONFIG_MOUSE_PS2_SYNAPTICS=y -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -CONFIG_MOUSE_PS2_TRACKPOINT=y -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_VSXXXAA is not set -CONFIG_MSDOS_FS=y -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_M25P80=y -CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_PHYSMAP=y -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -# CONFIG_MTD_SPLIT is not set -CONFIG_MTD_SPLIT_FIRMWARE=y -# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set -CONFIG_MULTI_IRQ_HANDLER=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEON=y -# CONFIG_NET_CLS_CGROUP is not set -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_PACKET_ENGINE=y -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NET_VENDOR_CIRRUS is not set -# CONFIG_NET_VENDOR_FARADAY is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SMSC is not set -# CONFIG_NET_VENDOR_STMICRO is not set -# CONFIG_NET_VENDOR_VIA is not set -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NLS=y -CONFIG_NLS_ASCII=y -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_ISO8859_1=y -CONFIG_NOP_USB_XCEIV=y -CONFIG_NO_BOOTMEM=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -CONFIG_NO_IOPORT_MAP=y -CONFIG_NR_CPUS=4 -CONFIG_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_OF_RESERVED_MEM=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OUTER_CACHE=y -CONFIG_OUTER_CACHE_SYNC=y -# CONFIG_OVERLAY_FS is not set -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y -CONFIG_PCIE_XILINX=y -# CONFIG_PCI_DOMAINS_GENERIC is not set -CONFIG_PCI_MSI=y -CONFIG_PCI_REALLOC_ENABLE_AUTO=y -CONFIG_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PINCTRL=y -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PINCTRL_ZYNQ=y -CONFIG_PL310_ERRATA_588369=y -CONFIG_PL310_ERRATA_727915=y -CONFIG_PL310_ERRATA_753970=y -CONFIG_PL310_ERRATA_769419=y -CONFIG_PL330_DMA=y -CONFIG_PLAT_VERSATILE=y -CONFIG_PM=y -CONFIG_PMBUS=y -CONFIG_PM_CLK=y -# CONFIG_PM_DEBUG is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_VEXPRESS=y -CONFIG_POWER_SUPPLY=y -CONFIG_PPS=y -CONFIG_PREEMPT=y -CONFIG_PREEMPT_COUNT=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_RCU=y -CONFIG_PROC_EVENTS=y -# CONFIG_PROC_STRIPPED is not set -CONFIG_PTP_1588_CLOCK=y -CONFIG_R8169=y -CONFIG_RAS=y -CONFIG_RATIONAL=y -# CONFIG_RCU_BOOST is not set -CONFIG_RCU_STALL_COMMON=y -CONFIG_RD_BZIP2=y -CONFIG_RD_GZIP=y -CONFIG_RD_LZ4=y -CONFIG_RD_LZMA=y -CONFIG_RD_LZO=y -CONFIG_RD_XZ=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_SPI=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_VEXPRESS is not set -CONFIG_RFS_ACCEL=y -CONFIG_ROOT_NFS=y -CONFIG_RPS=y -CONFIG_RTC_CLASS=y -# CONFIG_RTC_DRV_CMOS is not set -CONFIG_RTC_DRV_PCF8563=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -# CONFIG_SCHED_INFO is not set -CONFIG_SCHED_MC=y -CONFIG_SCHED_SMT=y -CONFIG_SCSI=y -# CONFIG_SENSORS_ADM1275 is not set -# CONFIG_SENSORS_LM25066 is not set -# CONFIG_SENSORS_LTC2978 is not set -# CONFIG_SENSORS_MAX16064 is not set -# CONFIG_SENSORS_MAX20751 is not set -# CONFIG_SENSORS_MAX34440 is not set -# CONFIG_SENSORS_MAX8688 is not set -CONFIG_SENSORS_PMBUS=y -# CONFIG_SENSORS_TPS40422 is not set -CONFIG_SENSORS_UCD9000=y -CONFIG_SENSORS_UCD9200=y -# CONFIG_SENSORS_ZL6100 is not set -# CONFIG_SERIAL_8250 is not set -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_AMBA_PL011 is not set -CONFIG_SERIAL_XILINX_PS_UART=y -CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y -CONFIG_SERIO=y -CONFIG_SERIO_LIBPS2=y -CONFIG_SERIO_SERPORT=y -CONFIG_SMP=y -CONFIG_SMP_ON_UP=y -CONFIG_SND=y -CONFIG_SND_ARM=y -# CONFIG_SND_ARMAACI is not set -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_DMAENGINE_PCM=y -CONFIG_SND_JACK=y -CONFIG_SND_PCM=y -CONFIG_SND_SOC=y -CONFIG_SND_SOC_ADI=y -CONFIG_SND_SOC_ADI_AXI_I2S=y -CONFIG_SND_SOC_ADI_AXI_SPDIF=y -CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y -CONFIG_SND_SOC_I2C_AND_SPI=y -CONFIG_SND_SPI=y -CONFIG_SND_SUPPORT_OLD_API=y -CONFIG_SOC_BUS=y -CONFIG_SOUND=y -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_CADENCE=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_XILINX=y -CONFIG_SRAM=y -CONFIG_SRCU=y -# CONFIG_STAGING is not set -# CONFIG_STRIP_ASM_SYMS is not set -CONFIG_SUNRPC=y -# CONFIG_SUNXI_SRAM is not set -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -CONFIG_SWIOTLB=y -CONFIG_SWP_EMULATE=y -# CONFIG_SYN_COOKIES is not set -CONFIG_SYSCTL_SYSCALL=y -CONFIG_SYSFS_SYSCALL=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -# CONFIG_TCP_CONG_ADVANCED is not set -# CONFIG_TEXTSEARCH is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -CONFIG_THERMAL_GOV_STEP_WISE=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -# CONFIG_THUMB2_KERNEL is not set -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_STATS=y -# CONFIG_TMPFS_XATTR is not set -CONFIG_UIO=y -# CONFIG_UIO_AEC is not set -# CONFIG_UIO_CIF is not set -# CONFIG_UIO_DMEM_GENIRQ is not set -# CONFIG_UIO_MF624 is not set -# CONFIG_UIO_NETX is not set -# CONFIG_UIO_PCI_GENERIC is not set -CONFIG_UIO_PDRV_GENIRQ=y -# CONFIG_UIO_PRUSS is not set -# CONFIG_UIO_SERCOS3 is not set -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_USB=y -# CONFIG_USB_AUDIO is not set -CONFIG_USB_CHIPIDEA=y -# CONFIG_USB_CHIPIDEA_DEBUG is not set -CONFIG_USB_CHIPIDEA_HOST=y -CONFIG_USB_CHIPIDEA_OF=y -CONFIG_USB_CHIPIDEA_PCI=y -CONFIG_USB_CHIPIDEA_UDC=y -CONFIG_USB_COMMON=y -# CONFIG_USB_CONFIGFS_ACM is not set -# CONFIG_USB_CONFIGFS_ECM is not set -# CONFIG_USB_CONFIGFS_ECM_SUBSET is not set -# CONFIG_USB_CONFIGFS_EEM is not set -# CONFIG_USB_CONFIGFS_F_FS is not set -# CONFIG_USB_CONFIGFS_F_HID is not set -# CONFIG_USB_CONFIGFS_F_LB_SS is not set -# CONFIG_USB_CONFIGFS_F_MIDI is not set -# CONFIG_USB_CONFIGFS_F_PRINTER is not set -# CONFIG_USB_CONFIGFS_F_UAC1 is not set -# CONFIG_USB_CONFIGFS_F_UAC2 is not set -# CONFIG_USB_CONFIGFS_F_UVC is not set -CONFIG_USB_CONFIGFS_MASS_STORAGE=y -# CONFIG_USB_CONFIGFS_NCM is not set -# CONFIG_USB_CONFIGFS_OBEX is not set -# CONFIG_USB_CONFIGFS_RNDIS is not set -# CONFIG_USB_CONFIGFS_SERIAL is not set -CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -CONFIG_USB_EHCI_PCI=y -# CONFIG_USB_EHCI_TT_NEWSCHED is not set -# CONFIG_USB_ETH is not set -CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_XILINX=y -CONFIG_USB_HID=y -CONFIG_USB_NET_DRIVERS=y -CONFIG_USB_OTG=y -CONFIG_USB_OTG_FSM=y -CONFIG_USB_PHY=y -CONFIG_USB_STORAGE=y -CONFIG_USB_SUPPORT=y -# CONFIG_USB_UHCI_HCD is not set -CONFIG_USB_ULPI=y -CONFIG_USB_ULPI_VIEWPORT=y -# CONFIG_USB_ZERO_HNPTEST is not set -CONFIG_USELIB=y -# CONFIG_USERIO is not set -CONFIG_USE_OF=y -# CONFIG_V4L_PLATFORM_DRIVERS is not set -CONFIG_VECTORS_BASE=0xffff0000 -CONFIG_VEXPRESS_CONFIG=y -CONFIG_VEXPRESS_SYSCFG=y -CONFIG_VFAT_FS=y -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_VGA_ARB=y -CONFIG_VGA_ARB_MAX_GPUS=16 -# CONFIG_VIDEO_ADP1653 is not set -# CONFIG_VIDEO_AS3645A is not set -CONFIG_VIDEO_DEV=y -# CONFIG_VIDEO_LM3560 is not set -# CONFIG_VIDEO_LM3646 is not set -CONFIG_VIDEO_V4L2=y -# CONFIG_VIDEO_V4L2_SUBDEV_API is not set -CONFIG_VITESSE_PHY=y -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -# CONFIG_VT_HW_CONSOLE_BINDING is not set -CONFIG_WATCHDOG_CORE=y -# CONFIG_WEXT_PRIV is not set -# CONFIG_WEXT_SPY is not set -# CONFIG_WIRELESS_EXT is not set -# CONFIG_WL_TI is not set -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_XILINX_EMACLITE=y -CONFIG_XILINX_VDMA=y -CONFIG_XILINX_WATCHDOG=y -CONFIG_XILINX_XADC=y -CONFIG_XPS=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_ARMTHUMB=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_XZ_DEC_IA64=y -CONFIG_XZ_DEC_POWERPC=y -CONFIG_XZ_DEC_SPARC=y -CONFIG_XZ_DEC_X86=y -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/zynq/image/Makefile b/target/linux/zynq/image/Makefile deleted file mode 100644 index a4400c728..000000000 --- a/target/linux/zynq/image/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright (C) 2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -################################################# -# Images -################################################# - -# $(1): rootfs contents directory -define Image/mkfs/cpio - ( cd $(call mkfs_target_dir,$(1))/; find . | cpio -o -H newc | gzip -9n > $@ ) -endef - -# $(1): zynq board id -define Build/dtb - $(call Image/BuildDTB,$(DTS_DIR)/zynq-$(1).dts,$@.dtb) -endef - -define Build/uRamdisk - # Create uboot cpio.gz - mkimage -A arm -T ramdisk -C gzip -n "$(PROFILE) OpenWRT rootfs" \ - -d $(IMAGE_ROOTFS) $@.new - mv $@.new $@ -endef - -# $(1): FIT name/description -define Build/fit - # create FIT image with rootfs - ./mkits.sh \ - -D $(1) -o $@.its -k $(IMAGE_KERNEL) -d $(IMAGE_KERNEL).dtb \ - -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) \ - -A $(ARCH) -v $(LINUX_VERSION) -r $(IMAGE_ROOTFS) -z gzip - - PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@ -endef - -################################################# -# Devices -################################################# - -# default kernel load address -KERNEL_LOADADDR=0x8000 -KERNEL_ENTRY=0x8000 - -TARGET_FILESYSTEMS += cpio - -# $(1): canonical device name -# $(2): lowercase device id -define ZynqDevice - define Device/$(1) - DEVICE_TITLE := $(1) development board - KERNEL := dtb $(2) | kernel-bin | uImage none - KERNEL_NAME = zImage - IMAGES := uramdisk.image.gz fit.itb - IMAGE/uramdisk.image.gz := uRamdisk - IMAGE/fit.itb := fit $(2) - IMAGE_NAME = $$$$(IMG_PREFIX)-$(2)-$$$$(2) - endef - TARGET_DEVICES += $(1) -endef - -$(eval $(call ZynqDevice,ZC702,zc702)) -$(eval $(call ZynqDevice,ZedBoard,zed)) -$(eval $(call ZynqDevice,ZYBO,zybo)) - -$(eval $(call BuildImage)) diff --git a/target/linux/zynq/image/mkits.sh b/target/linux/zynq/image/mkits.sh deleted file mode 100755 index 2b00d0fc4..000000000 --- a/target/linux/zynq/image/mkits.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash -# -# Licensed under the terms of the GNU GPL License version 2 or later. -# -# Author: Peter Tyser -# -# U-Boot firmware supports the booting of images in the Flattened Image -# Tree (FIT) format. The FIT format uses a device tree structure to -# describe a kernel image, device tree blob, ramdisk, etc. This script -# creates an Image Tree Source (.its file) which can be passed to the -# 'mkimage' utility to generate an Image Tree Blob (.itb file). The .itb -# file can then be booted by U-Boot (or other bootloaders which support -# FIT images). See doc/uImage.FIT/howto.txt in U-Boot source code for -# additional information on FIT images. -# - -usage() { - echo "Usage: `basename $0` -A arch -C comp -a addr -e entry" \ - "-v version -k kernel [-D name -d dtb] -o its_file" - echo -e "\t-A ==> set architecture to 'arch'" - echo -e "\t-C ==> set compression type 'comp'" - echo -e "\t-a ==> set load address to 'addr' (hex)" - echo -e "\t-e ==> set entry point to 'entry' (hex)" - echo -e "\t-v ==> set kernel version to 'version'" - echo -e "\t-k ==> include kernel image 'kernel'" - echo -e "\t-D ==> human friendly Device Tree Blob 'name'" - echo -e "\t-d ==> include Device Tree Blob 'dtb'" - echo -e "\t-r ==> include ramdisk" - echo -e "\t-z ==> ramdisk compression type" - echo -e "\t-o ==> create output file 'its_file'" - exit 1 -} - -while getopts ":A:a:C:D:d:e:k:o:v:r:z:" OPTION -do - case $OPTION in - A ) ARCH=$OPTARG;; - a ) LOAD_ADDR=$OPTARG;; - C ) COMPRESS=$OPTARG;; - D ) DEVICE=$OPTARG;; - d ) DTB=$OPTARG;; - e ) ENTRY_ADDR=$OPTARG;; - k ) KERNEL=$OPTARG;; - o ) OUTPUT=$OPTARG;; - v ) VERSION=$OPTARG;; - r ) RAMDISK=$OPTARG;; - z ) RD_COMPRESS=$OPTARG;; - * ) echo "Invalid option passed to '$0' (options:$@)" - usage;; - esac -done - -# Make sure user entered all required parameters -if [ -z "${ARCH}" ] || [ -z "${COMPRESS}" ] || [ -z "${LOAD_ADDR}" ] || \ - [ -z "${ENTRY_ADDR}" ] || [ -z "${VERSION}" ] || [ -z "${KERNEL}" ] || \ - [ -z "${OUTPUT}" ]; then - usage -fi - -ARCH_UPPER=`echo $ARCH | tr '[:lower:]' '[:upper:]'` - -# Conditionally create fdt information -if [ -n "${DTB}" ]; then - FDT=" - fdt@1 { - description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\"; - data = /incbin/(\"${DTB}\"); - type = \"flat_dt\"; - arch = \"${ARCH}\"; - compression = \"none\"; - hash@1 { - algo = \"crc32\"; - }; - hash@2 { - algo = \"sha1\"; - }; - }; -" - CONF=" fdt = \"fdt@1\";" -fi - -# Conditionally create ramdisk node -if [ -n "${RAMDISK}" ]; then - RD_COMPRESS=${RD_COMPRESS:-none} - RD=" - ramdisk@1 { - description = \"${ARCH_UPPER} OpenWrt ${DEVICE} ramdisk\"; - data = /incbin/(\"${RAMDISK}\"); - type = \"ramdisk\"; - arch = \"${ARCH}\"; - os = \"linux\"; - compression = \"${RD_COMPRESS}\"; - hash@1 { - algo = \"crc32\"; - }; - hash@2 { - algo = \"sha1\"; - }; - }; -" - if [ -z "${CONF}" ]; then - CONF=" ramdisk = \"ramdisk@1\";" - else - CONF="$CONF - ramdisk = \"ramdisk@1\";" - fi -fi - -# Create a default, fully populated DTS file -DATA="/dts-v1/; - -/ { - description = \"${ARCH_UPPER} OpenWrt FIT (Flattened Image Tree)\"; - #address-cells = <1>; - - images { - kernel@1 { - description = \"${ARCH_UPPER} OpenWrt Linux-${VERSION}\"; - data = /incbin/(\"${KERNEL}\"); - type = \"kernel\"; - arch = \"${ARCH}\"; - os = \"linux\"; - compression = \"${COMPRESS}\"; - load = <${LOAD_ADDR}>; - entry = <${ENTRY_ADDR}>; - hash@1 { - algo = \"crc32\"; - }; - hash@2 { - algo = \"sha1\"; - }; - }; - -${RD} -${FDT} - - }; - - configurations { - default = \"config@1\"; - config@1 { - description = \"OpenWrt\"; - kernel = \"kernel@1\"; -${CONF} - }; - }; -};" - -# Write .its file to disk -echo "$DATA" > ${OUTPUT} diff --git a/target/sdk/Makefile b/target/sdk/Makefile index d3822a0df..a9df8be7d 100644 --- a/target/sdk/Makefile +++ b/target/sdk/Makefile @@ -49,6 +49,12 @@ BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C svn inf BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),src-git base $(PROJECT_GIT)/openwrt/openwrt.git$(if $(GIT_BRANCH),;$(GIT_BRANCH),$(if $(GIT_TAGNAME),;$(GIT_TAGNAME)))) KDIR_BASE = $(patsubst $(TOPDIR)/%,%,$(LINUX_DIR)) +KDIR_ARCHES = $(LINUX_KARCH) + +# arch/arm64/ includes reference files in arch/arm/, so we'll need both +ifeq ($(LINUX_KARCH),arm64) + KDIR_ARCHES += arm +endif KERNEL_FILES_ARCH = \ Makefile* \ @@ -67,7 +73,7 @@ KERNEL_FILES_BASE := \ include \ Module.symvers \ modules.builtin \ - $(addprefix arch/$(LINUX_KARCH)/,$(KERNEL_FILES_ARCH)) + $(foreach arch,$(KDIR_ARCHES),$(addprefix arch/$(arch)/,$(KERNEL_FILES_ARCH))) KERNEL_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(KERNEL_FILES_BASE)))) @@ -84,6 +90,10 @@ $(BIN_DIR)/$(SDK_NAME).tar.xz: clean $(SDK_DIRS) $(KERNEL_FILES) | \ $(TAR) -xf - -C $(SDK_BUILD_DIR) + # Copy usbip sources, this is required for the usbip userspace packages to be buildable by the SDK. + $(TAR) -cf - -C $(TOPDIR) $(KDIR_BASE)/tools/usb/usbip/ | \ + $(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)) diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index df80684e6..2922daed5 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -12,11 +12,6 @@ choice bool "Binutils 2.27" select BINUTILS_VERSION_2_27 - config BINUTILS_USE_VERSION_2_28 - depends on !arc - bool "Binutils 2.28" - select BINUTILS_VERSION_2_28 - config BINUTILS_USE_VERSION_2_29_ARC depends on arc bool "ARC binutils 2.29" diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index f6889cb0e..bb462cbf2 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -11,20 +11,21 @@ PKG_VERSION:=$(call qstrip,$(CONFIG_BINUTILS_VERSION)) BIN_VERSION:=$(PKG_VERSION) PKG_SOURCE_URL:=@GNU/binutils/ -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz TAR_OPTIONS += --exclude='*.rej' ifeq ($(PKG_VERSION),2.27) + PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88 endif ifeq ($(PKG_VERSION),2.29.1) - PKG_HASH:=1509dff41369fb70aed23682351b663b56db894034773e6dbf7d5d6071fc55cc + PKG_HASH:=e7010a46969f9d3e53b650a518663f98a5dde3c3ae21b7d71e5e6803bc36b577 endif ifeq ($(PKG_VERSION),2.30) - PKG_HASH:=efeade848067e9a03f1918b1da0d37aaffa0b0127a06b5e9236229851d9d0c09 + PKG_HASH:=6e46b8aeae2f727a36f0bd9505e405768a72218f1796f0d09757d45209871ae6 endif ifneq ($(CONFIG_BINUTILS_VERSION_2_29_ARC),) diff --git a/toolchain/binutils/patches/arc-2016.09-release/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/arc-2016.09-release/300-001_ld_makefile_patch.patch deleted file mode 100644 index e4cec7f69..000000000 --- a/toolchain/binutils/patches/arc-2016.09-release/300-001_ld_makefile_patch.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/ld/Makefile.am -+++ b/ld/Makefile.am -@@ -57,7 +57,7 @@ endif - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ ---- a/ld/Makefile.in -+++ b/ld/Makefile.in -@@ -451,7 +451,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/arc-2016.09-release/300-012_check_ldrunpath_length.patch b/toolchain/binutils/patches/arc-2016.09-release/300-012_check_ldrunpath_length.patch deleted file mode 100644 index 95d3f75b8..000000000 --- a/toolchain/binutils/patches/arc-2016.09-release/300-012_check_ldrunpath_length.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/ld/emultempl/elf32.em -+++ b/ld/emultempl/elf32.em -@@ -1244,6 +1244,8 @@ fragment <link.next) - if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) diff --git a/toolchain/gcc/patches/7.3.0/931-libffi-fix-MIPS-softfloat-build-issue.patch b/toolchain/gcc/patches/7.3.0/931-libffi-fix-MIPS-softfloat-build-issue.patch new file mode 100644 index 000000000..9d436efc1 --- /dev/null +++ b/toolchain/gcc/patches/7.3.0/931-libffi-fix-MIPS-softfloat-build-issue.patch @@ -0,0 +1,175 @@ +From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001 +From: BangLang Huang +Date: Wed, 9 Nov 2016 10:36:49 +0800 +Subject: [PATCH] libffi: fix MIPS softfloat build issue + +Backported from github.com/libffi/libffi#272 + +Signed-off-by: BangLang Huang +Signed-off-by: Yousong Zhou +--- + libffi/src/mips/n32.S | 17 +++++++++++++++++ + libffi/src/mips/o32.S | 17 +++++++++++++++++ + 2 files changed, 34 insertions(+) + +diff --git a/libffi/src/mips/n32.S b/libffi/src/mips/n32.S +index c6985d30a6f..8f25994773c 100644 +--- a/libffi/src/mips/n32.S ++++ b/libffi/src/mips/n32.S +@@ -107,6 +107,16 @@ loadregs: + + REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6. + ++#ifdef __mips_soft_float ++ REG_L a0, 0*FFI_SIZEOF_ARG(t9) ++ REG_L a1, 1*FFI_SIZEOF_ARG(t9) ++ REG_L a2, 2*FFI_SIZEOF_ARG(t9) ++ REG_L a3, 3*FFI_SIZEOF_ARG(t9) ++ REG_L a4, 4*FFI_SIZEOF_ARG(t9) ++ REG_L a5, 5*FFI_SIZEOF_ARG(t9) ++ REG_L a6, 6*FFI_SIZEOF_ARG(t9) ++ REG_L a7, 7*FFI_SIZEOF_ARG(t9) ++#else + and t4, t6, ((1< +Date: Fri, 4 May 2018 18:20:53 +0800 +Subject: [PATCH] gotools: fix compilation when making cross compiler + +libgo is "the runtime support library for the Go programming language. +This library is intended for use with the Go frontend." + +gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but +the linker will complain that it cannot find it. That's because shared libgcc +is not present in the install directory yet. libgo.so was made without problem +because gcc will emit -lgcc_s when compiled with -shared option. When gotools +were being made, it was supplied with -static-libgcc thus no link option was +provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec +for linking with libgo.so + +- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation +- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html + +When 3-pass GCC compilation is used, shared libgcc runtime libraries will be +available after gcc pass2 completed and will meet the gotools link requirement +at gcc pass3 +--- + gotools/Makefile.am | 4 +++- + gotools/Makefile.in | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/gotools/Makefile.am b/gotools/Makefile.am +index 5f3940a278b..9c22f5df103 100644 +--- a/gotools/Makefile.am ++++ b/gotools/Makefile.am +@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd} + STAMP = echo timestamp > + + libgodir = ../$(target_noncanonical)/libgo ++libgccdir = ../$(target_noncanonical)/libgcc + LIBGODEP = $(libgodir)/libgo.la + + if NATIVE +@@ -38,7 +39,8 @@ endif + GOCFLAGS = $(CFLAGS_FOR_TARGET) + GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS) + +-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs ++AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \ ++ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s + GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@ + + cmdsrcdir = $(srcdir)/../libgo/go/cmd +diff --git a/gotools/Makefile.in b/gotools/Makefile.in +index 4386576b011..0bdd9290e01 100644 +--- a/gotools/Makefile.in ++++ b/gotools/Makefile.in +@@ -252,13 +252,15 @@ mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs + PWD_COMMAND = $${PWDCMD-pwd} + STAMP = echo timestamp > + libgodir = ../$(target_noncanonical)/libgo ++libgccdir = ../$(target_noncanonical)/libgcc + LIBGODEP = $(libgodir)/libgo.la + @NATIVE_FALSE@GOCOMPILER = $(GOC) + + # Use the compiler we just built. + @NATIVE_TRUE@GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) + GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS) +-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs ++AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \ ++ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s + GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@ + cmdsrcdir = $(srcdir)/../libgo/go/cmd + go_cmd_go_files = \ +-- +2.16.3 + diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index e10c7b1bc..2de9596dc 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -11,9 +11,9 @@ PKG_VERSION:=2.26 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=d300041c533a3d837c9f37a099bcc95466860e98 -PKG_MIRROR_HASH:=31e90926a1d3093355aa85c04c68b3d109c3dc3d9f80afe50505e864b32ac784 -PKG_SOURCE_URL:=git://sourceware.org/git/glibc.git +PKG_SOURCE_VERSION:=af7519f7b35024224c163e32a89fb247b0c446fc +PKG_MIRROR_HASH:=7f4d0b9d55b5820b9e2feefed03206086b3d1ddef5f02358e587948f5bb9c516 +PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_SOURCE_SUBDIR) diff --git a/toolchain/musl/patches/010-sys-socket.h-fix-SO_PEERSEC-value-on-MIPS.patch b/toolchain/musl/patches/010-sys-socket.h-fix-SO_PEERSEC-value-on-MIPS.patch new file mode 100644 index 000000000..2319d9cb6 --- /dev/null +++ b/toolchain/musl/patches/010-sys-socket.h-fix-SO_PEERSEC-value-on-MIPS.patch @@ -0,0 +1,59 @@ +From 4e0877a604bad684be020f68e96a05156131fd44 Mon Sep 17 00:00:00 2001 +From: Matthias Schiffer +Date: Sun, 24 Jun 2018 17:05:31 +0200 +Subject: [PATCH] sys/socket.h: fix SO_PEERSEC value on MIPS + +Differing from all other archs supported by musl, MIPS defines SO_PEERSEC +to 30 instead of 31. + +Reported-by: Andrey Jr. Mlenikov +--- + arch/mips/bits/socket.h | 2 ++ + arch/mips64/bits/socket.h | 2 ++ + arch/mipsn32/bits/socket.h | 2 ++ + include/sys/socket.h | 3 +++ + 4 files changed, 9 insertions(+) + +--- a/arch/mips/bits/socket.h ++++ b/arch/mips/bits/socket.h +@@ -48,5 +48,7 @@ struct cmsghdr { + #define SO_SNDBUFFORCE 31 + #define SO_RCVBUFFORCE 33 + ++#define SO_PEERSEC 30 ++ + #define SOCK_NONBLOCK 0200 + #define SOCK_CLOEXEC 02000000 +--- a/arch/mips64/bits/socket.h ++++ b/arch/mips64/bits/socket.h +@@ -64,5 +64,7 @@ struct cmsghdr { + #define SO_SNDBUFFORCE 31 + #define SO_RCVBUFFORCE 33 + ++#define SO_PEERSEC 30 ++ + #define SOCK_NONBLOCK 0200 + #define SOCK_CLOEXEC 02000000 +--- a/arch/mipsn32/bits/socket.h ++++ b/arch/mipsn32/bits/socket.h +@@ -48,5 +48,7 @@ struct cmsghdr { + #define SO_SNDBUFFORCE 31 + #define SO_RCVBUFFORCE 33 + ++#define SO_PEERSEC 30 ++ + #define SOCK_NONBLOCK 0200 + #define SOCK_CLOEXEC 02000000 +--- a/include/sys/socket.h ++++ b/include/sys/socket.h +@@ -201,7 +201,10 @@ struct linger { + #define SO_TIMESTAMP 29 + #define SCM_TIMESTAMP SO_TIMESTAMP + ++#ifndef SO_PEERSEC + #define SO_PEERSEC 31 ++#endif ++ + #define SO_PASSSEC 34 + #define SO_TIMESTAMPNS 35 + #define SCM_TIMESTAMPNS SO_TIMESTAMPNS diff --git a/toolchain/uClibc/common.mk b/toolchain/uClibc/common.mk index 1600b790c..b561fa1b1 100644 --- a/toolchain/uClibc/common.mk +++ b/toolchain/uClibc/common.mk @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk -PKG_VERSION:=1.0.28 +PKG_VERSION:=1.0.30 PKG_NAME:=uClibc-ng PKG_SOURCE_URL = http://downloads.uclibc-ng.org/releases/$(PKG_VERSION)/ @@ -16,7 +16,7 @@ CONFIG_DIR:=$(PATH_PREFIX)/config PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz LIBC_SO_VERSION:=$(PKG_VERSION) -PKG_HASH:=a1504ddc34a29cc9bfd1f5a7419c4b63bb510d9e2faed81618d1b596ceb0a5a9 +PKG_HASH:=992bd9a2889ea385902b87e3d3d30603741eb16728288fbf537ff2027f770496 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/tools/Makefile b/tools/Makefile index 50bd552d7..d2b5daf18 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -22,7 +22,7 @@ ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar endif tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat -tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs +tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs zlib tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage tools-y += firmware-utils patch-image quilt padjffs2 tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf @@ -43,16 +43,16 @@ $(curdir)/bison/compile := $(curdir)/flex/compile $(curdir)/flex/compile := $(curdir)/libtool/compile $(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile -$(curdir)/squashfs4/compile := $(curdir)/xz/compile +$(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile $(curdir)/autoconf/compile := $(curdir)/m4/compile $(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkg-config/compile $(curdir)/xz/compile $(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile $(curdir)/mpfr/compile := $(curdir)/gmp/compile -$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile +$(curdir)/mtd-utils/compile := $(curdir)/libtool/compile $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile $(curdir)/mklibs/compile := $(curdir)/libtool/compile -$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile +$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile $(curdir)/upslug2/compile := $(curdir)/libtool/compile $(curdir)/mm-macros/compile := $(curdir)/libtool/compile $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile @@ -69,8 +69,12 @@ $(curdir)/patchelf/compile := $(curdir)/libtool/compile $(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/libressl/compile := $(curdir)/pkg-config/compile $(curdir)/mkimage/compile += $(curdir)/libressl/compile -$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile +$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile $(curdir)/zlib/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile +$(curdir)/zlib/compile := $(curdir)/cmake/compile +$(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile +$(curdir)/lzma-old/compile := $(curdir)/zlib/compile +$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile ifneq ($(HOST_OS),Linux) tools-y += coreutils diff --git a/tools/bison/Makefile b/tools/bison/Makefile index af5737c55..68e06ae33 100644 --- a/tools/bison/Makefile +++ b/tools/bison/Makefile @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2008-2015 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bison -PKG_VERSION:=3.0.4 +PKG_VERSION:=3.0.5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=a72428c7917bdf9fa93cb8181c971b6e22834125848cf1d03ce10b1bb0716fe1 +PKG_HASH:=075cef2e814642e30e10e8155e93022e4a91ca38a65aa1d5467d4e969f97f338 HOST_BUILD_PARALLEL:=1 diff --git a/tools/bison/patches/001-fix-macos-vasnprintf.patch b/tools/bison/patches/001-fix-macos-vasnprintf.patch deleted file mode 100644 index e41315d34..000000000 --- a/tools/bison/patches/001-fix-macos-vasnprintf.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/lib/vasnprintf.c -+++ b/lib/vasnprintf.c -@@ -4858,7 +4858,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - #endif - *fbp = dp->conversion; - #if USE_SNPRINTF --# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) -+# if ! (((__GLIBC__ > 2 \ -+ || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \ -+ && !defined __UCLIBC__) \ -+ || (defined __APPLE__ && defined __MACH__) \ -+ || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) - fbp[1] = '%'; - fbp[2] = 'n'; - fbp[3] = '\0'; -@@ -4872,6 +4876,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - in format strings in writable memory may crash the program - (if compiled with _FORTIFY_SOURCE=2), so we should avoid it - in this situation. */ -+ /* macOS 10.13 High Sierra behaves like glibc with -+ _FORTIFY_SOURCE=2, and older macOS releases -+ presumably do not need %n. */ - /* On native Windows systems (such as mingw), we can avoid using - %n because: - - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, diff --git a/tools/bison/patches/100-fix-gets-removal.patch b/tools/bison/patches/100-fix-gets-removal.patch index 20b18cf2e..563c12040 100644 --- a/tools/bison/patches/100-fix-gets-removal.patch +++ b/tools/bison/patches/100-fix-gets-removal.patch @@ -1,6 +1,8 @@ +diff --git a/lib/stdio.in.h b/lib/stdio.in.h +index ff7c9c8..f391832 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h -@@ -719,13 +719,6 @@ +@@ -739,14 +739,6 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " # endif #endif @@ -8,9 +10,10 @@ - so any use of gets warrants an unconditional warning; besides, C11 - removed it. */ -#undef gets --#if HAVE_RAW_DECL_GETS +-#if HAVE_RAW_DECL_GETS && !defined __cplusplus -_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); -#endif - - +- #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ + struct obstack; + /* Grow an obstack with formatted output. Return the number of diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 8211c8d44..b6d628715 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.11.0 +PKG_VERSION:=3.11.1 PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://cmake.org/files/v3.11/ \ https://fossies.org/linux/misc/ -PKG_HASH:=c313bee371d4d255be2b4e96fd59b11d58bc550a7c78c021444ae565709a656b +PKG_HASH:=57bebc6ca4d1d42c6385249d148d9216087e0fda57a47dc5c858790a70217d0c HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 diff --git a/tools/cmake/patches/120-curl-fix-libressl-linking.patch b/tools/cmake/patches/120-curl-fix-libressl-linking.patch index ad5b89750..a345a8c16 100644 --- a/tools/cmake/patches/120-curl-fix-libressl-linking.patch +++ b/tools/cmake/patches/120-curl-fix-libressl-linking.patch @@ -20,13 +20,17 @@ Signed-off-by: Jo-Philipp Wich --- --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt -@@ -461,6 +461,10 @@ if(CMAKE_USE_OPENSSL) +@@ -461,6 +461,14 @@ if(CMAKE_USE_OPENSSL) set(USE_OPENSSL ON) set(HAVE_LIBCRYPTO ON) set(HAVE_LIBSSL ON) + check_library_exists("rt" clock_gettime "" HAVE_LIBRT) + if(HAVE_LIBRT) + list(APPEND OPENSSL_LIBRARIES rt) ++ endif() ++ check_library_exists("pthread" pthread_once "" HAVE_PTHREAD) ++ if(HAVE_PTHREAD) ++ list(APPEND OPENSSL_LIBRARIES pthread) + endif() list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES}) include_directories(${OPENSSL_INCLUDE_DIR}) diff --git a/tools/cmake/patches/140-curl-fix-libressl.patch b/tools/cmake/patches/140-curl-fix-libressl.patch new file mode 100644 index 000000000..9caed96f5 --- /dev/null +++ b/tools/cmake/patches/140-curl-fix-libressl.patch @@ -0,0 +1,68 @@ +From 7c90c93c0b061da81f69fabdd57125b2783c15fb Mon Sep 17 00:00:00 2001 +From: Bernard Spil +Date: Mon, 2 Apr 2018 19:04:06 +0200 +Subject: [PATCH] openssl: fix build with LibreSSL 2.7 + + - LibreSSL 2.7 implements (most of) OpenSSL 1.1 API + +Fixes #2319 +Closes #2447 +Closes #2448 + +Signed-off-by: Bernard Spil +--- + lib/vtls/openssl.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +--- a/Utilities/cmcurl/lib/vtls/openssl.c ++++ b/Utilities/cmcurl/lib/vtls/openssl.c +@@ -104,7 +104,8 @@ + #endif + + #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && /* OpenSSL 1.1.0+ */ \ +- !defined(LIBRESSL_VERSION_NUMBER) ++ !(defined(LIBRESSL_VERSION_NUMBER) && \ ++ LIBRESSL_VERSION_NUMBER < 0x20700000L) + #define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER + #define HAVE_X509_GET0_EXTENSIONS 1 /* added in 1.1.0 -pre1 */ + #define HAVE_OPAQUE_EVP_PKEY 1 /* since 1.1.0 -pre3 */ +@@ -128,7 +129,8 @@ static unsigned long OpenSSL_version_num + #endif + + #if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && /* 1.0.2 or later */ \ +- !defined(LIBRESSL_VERSION_NUMBER) ++ !(defined(LIBRESSL_VERSION_NUMBER) && \ ++ LIBRESSL_VERSION_NUMBER < 0x20700000L) + #define HAVE_X509_GET0_SIGNATURE 1 + #endif + +@@ -147,7 +149,7 @@ static unsigned long OpenSSL_version_num + * Whether SSL_CTX_set_keylog_callback is available. + * OpenSSL: supported since 1.1.1 https://github.com/openssl/openssl/pull/2287 + * BoringSSL: supported since d28f59c27bac (committed 2015-11-19) +- * LibreSSL: unsupported in at least 2.5.1 (explicitly check for it since it ++ * LibreSSL: unsupported in at least 2.7.2 (explicitly check for it since it + * lies and pretends to be OpenSSL 2.0.0). + */ + #if (OPENSSL_VERSION_NUMBER >= 0x10101000L && \ +@@ -259,7 +261,9 @@ static void tap_ssl_key(const SSL *ssl, + if(!session || !keylog_file_fp) + return; + +-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ ++ !(defined(LIBRESSL_VERSION_NUMBER) && \ ++ LIBRESSL_VERSION_NUMBER < 0x20700000L) + /* ssl->s3 is not checked in openssl 1.1.0-pre6, but let's assume that + * we have a valid SSL context if we have a non-NULL session. */ + SSL_get_client_random(ssl, client_random, SSL3_RANDOM_SIZE); +@@ -2082,8 +2086,7 @@ static CURLcode ossl_connect_step1(struc + case CURL_SSLVERSION_TLSv1_2: + case CURL_SSLVERSION_TLSv1_3: + /* it will be handled later with the context options */ +-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \ +- !defined(LIBRESSL_VERSION_NUMBER) ++#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) + req_method = TLS_client_method(); + #else + req_method = SSLv23_client_method(); diff --git a/tools/cmake/patches/150-libarchive-fix-libressl.patch b/tools/cmake/patches/150-libarchive-fix-libressl.patch new file mode 100644 index 000000000..ad8a0969a --- /dev/null +++ b/tools/cmake/patches/150-libarchive-fix-libressl.patch @@ -0,0 +1,37 @@ +From 5da00ad75b09e262774ec3675bbe4d5a4502a852 Mon Sep 17 00:00:00 2001 +From: Bernard Spil +Date: Sun, 1 Apr 2018 23:01:44 +0200 +Subject: [PATCH] fix build with LibreSSL 2.7 + +LibreSSL 2.7 adds OpenSSL 1.1 API leading to conflicts on method names + +See also: https://bugs.freebsd.org/226853 +Signed-off-by: Bernard Spil +--- + libarchive/archive_openssl_hmac_private.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h ++++ b/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h +@@ -28,7 +28,8 @@ + #include + #include + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \ ++ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) + #include /* malloc, free */ + #include /* memset */ + static inline HMAC_CTX *HMAC_CTX_new(void) +--- a/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h ++++ b/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h +@@ -28,7 +28,8 @@ + #include + #include + +-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \ ++ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) + #include /* malloc, free */ + #include /* memset */ + static inline EVP_MD_CTX *EVP_MD_CTX_new(void) diff --git a/tools/findutils/patches/110-glibc-change-work-around.patch b/tools/findutils/patches/110-glibc-change-work-around.patch new file mode 100644 index 000000000..91b69274c --- /dev/null +++ b/tools/findutils/patches/110-glibc-change-work-around.patch @@ -0,0 +1,104 @@ +Subject: Workaround change in glibc + +Temporary workaround to compile with glibc 2.28, which +deprecated some constants + +Based on the workaround made for the tools/m4 package + +--- a/gl/lib/stdio-impl.h ++++ b/gl/lib/stdio-impl.h +@@ -18,6 +18,12 @@ + the same implementation of stdio extension API, except that some fields + have different naming conventions, or their access requires some casts. */ + ++/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this ++ problem by defining it ourselves. FIXME: Do not rely on glibc ++ internals. */ ++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN ++# define _IO_IN_BACKUP 0x100 ++#endif + + /* BSD stdio derived implementations. */ + +--- a/gl/lib/freadahead.c ++++ b/gl/lib/freadahead.c +@@ -25,7 +25,7 @@ + size_t + freadahead (FILE *fp) + { +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_write_ptr > fp->_IO_write_base) + return 0; + return (fp->_IO_read_end - fp->_IO_read_ptr) +--- a/gl/lib/fseeko.c ++++ b/gl/lib/fseeko.c +@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when + #endif + + /* These tests are based on fpurge.c. */ +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_read_end == fp->_IO_read_ptr + && fp->_IO_write_ptr == fp->_IO_write_base + && fp->_IO_save_base == NULL) +@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when + return -1; + } + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_flags &= ~_IO_EOF_SEEN; + fp->_offset = pos; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ +--- a/gl/lib/fflush.c ++++ b/gl/lib/fflush.c +@@ -33,7 +33,7 @@ + #undef fflush + + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ + static void +@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp) + + #endif + +-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) ++#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) + + # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ +@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream) + if (stream == NULL || ! freading (stream)) + return fflush (stream); + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + clear_ungetc_buffer_preserving_position (stream); + +--- a/gl/lib/freading.c ++++ b/gl/lib/freading.c +@@ -31,7 +31,7 @@ freading (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return ((fp->_flags & _IO_NO_WRITES) != 0 + || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 + && fp->_IO_read_base != NULL)); +--- a/gl/lib/fpurge.c ++++ b/gl/lib/fpurge.c +@@ -62,7 +62,7 @@ fpurge (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_IO_read_end = fp->_IO_read_ptr; + fp->_IO_write_ptr = fp->_IO_write_base; + /* Avoid memory leak when there is an active ungetc buffer. */ diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 7c0180ad4..4b4af9990 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -83,6 +83,7 @@ define Host/Compile $(call cc,zyimage, -Wall) $(call cc,mkdhpimg buffalo-lib, -Wall) $(call cc,mkdlinkfw mkdlinkfw-lib, -lz -Wall --std=gnu99) + $(call cc,dns313-header, -Wall) endef define Host/Install diff --git a/tools/firmware-utils/src/dns313-header.c b/tools/firmware-utils/src/dns313-header.c new file mode 100644 index 000000000..e69e57e7b --- /dev/null +++ b/tools/firmware-utils/src/dns313-header.c @@ -0,0 +1,239 @@ +/* + * dns313-header.c + * + * Program to add the modified U-Boot header to a binary used with + * the D-Link DNS-313 boot loader when booting directly from an + * EXT2 formatted hard drive. + * + * The DNS313 use the same header on zImage, ramdisk, rootfs. + * + * Written by Linus Walleij + * License terms: GPLv2 + */ +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * This is the U-Boot magic number, so the U-Boot header was used + * (obviously) as a template for this custom header. + */ +#define IH_MAGIC 0x27051956 +#define HEADER_SIZE 0x68 + +#define OFFSET_MAGIC 0x00 +#define OFFSET_HCRC 0x04 +#define OFFSET_TIME 0x08 +#define OFFSET_SIZE 0x0c +#define OFFSET_LOAD 0x10 +#define OFFSET_EP 0x14 +#define OFFSET_DCRC 0x18 +#define OFFSET_OS 0x1c +#define OFFSET_ARCH 0x1d +#define OFFSET_TYPE 0x1e +#define OFFSET_COMP 0x1f +#define OFFSET_NAME 0x20 +#define NAME_LEN 0x20 +#define OFFSET_MODEL 0x40 +#define MODEL_LEN 0x10 +#define OFFSET_VERSION 0x50 +#define VERSION_LEN 0x10 +#define OFFSET_MAC 0x60 +#define MAC_LEN 6 + +static const uint32_t crc32_table[256] = { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +}; + +static uint32_t crc32(uint32_t crc, + const unsigned char *buf, + unsigned int len) +{ + crc = crc ^ 0xffffffffUL; + do { + crc = crc32_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); + } while (--len); + return crc ^ 0xffffffffUL; +} + +static void be_wr(unsigned char *buf, uint32_t val) +{ + buf[0] = (val >> 24) & 0xFFU; + buf[1] = (val >> 16) & 0xFFU; + buf[2] = (val >> 8) & 0xFFU; + buf[3] = val & 0xFFU; +} + +int main(int argc, char **argv) +{ + int fdin; + int fdout; + struct stat sb; + uint32_t filesize; + uint32_t padding; + int ret = 0; + const char *pathin; + const char *pathout; + unsigned char *buffer; + unsigned char *infop; + uint32_t sum; + size_t bufsize; + size_t bytes; + int i; + + if (argc < 3) { + printf("Too few arguments.\n"); + printf("%s \n", argv[0]); + } + + pathin = argv[1]; + pathout = argv[2]; + + ret = stat(pathin, &sb); + if (ret < 0) + return ret; + + filesize = sb.st_size; + padding = filesize % 4; + printf("INFILE: %s, size: %08x bytes\n", pathin, filesize); + /* File + extended header size */ + bufsize = filesize + HEADER_SIZE; + + printf("Allocate %08x bytes\n", bufsize); + buffer = malloc(bufsize); + if (!buffer) { + printf("OOM: could not allocate buffer\n"); + return 0; + } + + memset(buffer, 0x00, bufsize); + + /* Read file to buffer */ + fdin = open(pathin, O_RDONLY); + if (!fdin) { + printf("ERROR: could not open input file\n"); + return 0; + } + bytes = read(fdin, buffer + HEADER_SIZE, filesize); + if (bytes < filesize) { + printf("ERROR: could not read entire file\n"); + return 0; + } + close(fdin); + + /* PREP HEADER AND FOOTER */ + infop = buffer; + + be_wr(buffer + OFFSET_MAGIC, IH_MAGIC); + + /* FIXME: use actual time */ + be_wr(buffer + OFFSET_TIME, 0x4c06738c); + be_wr(buffer + OFFSET_SIZE, filesize); + + /* Load address & entry point */ + be_wr(buffer + OFFSET_LOAD, 0x00008000); + be_wr(buffer + OFFSET_EP, 0x00008000); + + buffer[OFFSET_OS] = 0x05; /* Linux */ + buffer[OFFSET_ARCH] = 0x02; /* ARM */ + buffer[OFFSET_TYPE] = 0x02; /* OS kernel image */ + buffer[OFFSET_COMP] = 0x01; /* gzip */ + + /* The vendor firmware just hardcodes this */ + strncpy(buffer + OFFSET_NAME, "kernel.img", NAME_LEN); + buffer[OFFSET_NAME + NAME_LEN - 1] = '\0'; + strncpy(buffer + OFFSET_MODEL, "dns-313v3", MODEL_LEN); + buffer[OFFSET_MODEL + MODEL_LEN - 1] = '\0'; + strncpy(buffer + OFFSET_VERSION, "2.01b04", VERSION_LEN); + buffer[OFFSET_VERSION + VERSION_LEN - 1] = '\0'; + /* Just some MAC address from the example */ + buffer[OFFSET_MAC] = 0x00; + buffer[OFFSET_MAC + 1] = 0x80; + buffer[OFFSET_MAC + 2] = 0xc8; + buffer[OFFSET_MAC + 3] = 0x16; + buffer[OFFSET_MAC + 4] = 0x81; + buffer[OFFSET_MAC + 5] = 0x68; + + /* Checksum payload */ + sum = crc32(0, buffer + HEADER_SIZE, filesize); + be_wr(buffer + OFFSET_DCRC, sum); + printf("data checksum: 0x%08x\n", sum); + + /* Checksum header, then write that into the header checksum */ + sum = crc32(0, buffer, HEADER_SIZE); + be_wr(buffer + OFFSET_HCRC, sum); + printf("header checksum: 0x%08x\n", sum); + + printf("OUTFILE: %s, size: %08x bytes\n", pathout, bufsize); + fdout = open(pathout, O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP); + if (!fdout) { + printf("ERROR: could not open output file\n"); + return 0; + } + bytes = write(fdout, buffer, bufsize); + if (bytes < bufsize) { + printf("ERROR: could not write complete output file\n"); + return 0; + } + close(fdout); + + free(buffer); + + return 0; +} diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index 997ffcb09..b2cc96bc3 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -155,6 +155,48 @@ static struct device_info boards[] = { .last_sysupgrade_partition = "support-list", }, + /** Firmware layout for the CPE210 V2 */ + { + .id = "CPE210V2", + .vendor = "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n", + .support_list = + "SupportList:\r\n" + "CPE210(TP-LINK|EU|N300-2|00000000):2.0\r\n" + "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n" + "CPE210(TP-LINK|EU|N300-2|55530000):2.0\r\n" + "CPE210(TP-LINK|UN|N300-2|00000000):2.0\r\n" + "CPE210(TP-LINK|UN|N300-2|45550000):2.0\r\n" + "CPE210(TP-LINK|UN|N300-2|55530000):2.0\r\n" + "CPE210(TP-LINK|US|N300-2|55530000):2.0\r\n" + "CPE210(TP-LINK|UN|N300-2):2.0\r\n" + "CPE210(TP-LINK|EU|N300-2):2.0\r\n" + "CPE210(TP-LINK|US|N300-2):2.0\r\n", + .support_trail = '\xff', + .soft_ver = NULL, + + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"partition-table", 0x20000, 0x02000}, + {"default-mac", 0x30000, 0x00020}, + {"product-info", 0x31100, 0x00100}, + {"device-info", 0x31400, 0x00400}, + {"signature", 0x32000, 0x00400}, + {"device-id", 0x33000, 0x00100}, + {"os-image", 0x40000, 0x1c0000}, + {"file-system", 0x200000, 0x5b0000}, + {"soft-version", 0x7b0000, 0x00100}, + {"support-list", 0x7b1000, 0x01000}, + {"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 = "support-list", + }, + /** Firmware layout for the CPE510/520 */ { .id = "CPE510", @@ -267,6 +309,11 @@ static struct device_info boards[] = { .support_trail = '\x00', .soft_ver = NULL, + /** + We use a bigger os-image partition than the stock images (and thus + smaller file-system), as our kernel doesn't fit in the stock firmware's + 2 MB os-image since kernel 4.14. + */ .partitions = { {"SBL1", 0x00000, 0x20000}, {"MIBIB", 0x20000, 0x20000}, @@ -279,8 +326,8 @@ static struct device_info boards[] = { {"fs-uboot", 0x100000, 0x70000}, {"uboot-env", 0x170000, 0x40000}, {"radio", 0x1b0000, 0x40000}, - {"os-image", 0x1f0000, 0x200000}, - {"file-system", 0x3f0000, 0x1b00000}, + {"os-image", 0x1f0000, 0x400000}, /* Stock: base 0x1f0000 size 0x200000 */ + {"file-system", 0x5f0000, 0x1900000}, /* Stock: base 0x3f0000 size 0x1b00000 */ {"default-mac", 0x1ef0000, 0x00200}, {"pin", 0x1ef0200, 0x00200}, {"product-info", 0x1ef0400, 0x0fc00}, @@ -573,6 +620,52 @@ static struct device_info boards[] = { .last_sysupgrade_partition = "file-system", }, + /** Firmware layout for the C7 v5*/ + { + .id = "ARCHER-C7-V5", + .support_list = + "SupportList:\n" + "{product_name:Archer C7,product_ver:5.0.0,special_id:00000000}\n" + "{product_name:Archer C7,product_ver:5.0.0,special_id:55530000}\n", + + .support_trail = '\x00', + .soft_ver = "soft_ver:1.0.0\n", + + /** + 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 = { + {"factory-boot", 0x00000, 0x20000}, + {"fs-uboot", 0x20000, 0x20000}, + {"partition-table", 0x40000, 0x10000}, + {"radio", 0x50000, 0x10000}, + {"default-mac", 0x60000, 0x00200}, + {"pin", 0x60200, 0x00200}, + {"device-id", 0x60400, 0x00100}, + {"product-info", 0x60500, 0x0fb00}, + {"soft-version", 0x70000, 0x01000}, + {"extra-para", 0x71000, 0x01000}, + {"support-list", 0x72000, 0x0a000}, + {"profile", 0x7c000, 0x04000}, + {"user-config", 0x80000, 0x40000}, + + + {"os-image", 0xc0000, 0x180000}, /* Stock: base 0xc0000 size 0x120000 */ + {"file-system", 0x240000, 0xd80000}, /* Stock: base 0x1e0000 size 0xde0000 */ + + {"log", 0xfc0000, 0x20000}, + {"certificate", 0xfe0000, 0x10000}, + {"default-config", 0xff0000, 0x10000}, + {NULL, 0, 0} + + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system", + }, + /** Firmware layout for the C9 */ { .id = "ARCHERC9", @@ -886,12 +979,12 @@ static struct device_info boards[] = { /** The original os-image partition is too small, - so we enlarge it to 1.6M + so we enlarge it to 1.75M */ .partitions = { {"fs-uboot", 0x00000, 0x20000}, - {"os-image", 0x20000, 0x1a0000}, - {"file-system", 0x1c0000, 0x440000}, + {"os-image", 0x20000, 0x1c0000}, + {"file-system", 0x1e0000, 0x420000}, {"partition-table", 0x600000, 0x02000}, {"default-mac", 0x610000, 0x00020}, {"pin", 0x610100, 0x00020}, @@ -1384,7 +1477,7 @@ static void build_image(const char *output, strcasecmp(info->id, "TLWR1043NV5") == 0) { const char mdat[11] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}; parts[5] = put_data("extra-para", mdat, 11); - } else if (strcasecmp(info->id, "ARCHER-C7-V4") == 0) { + } else if (strcasecmp(info->id, "ARCHER-C7-V4") == 0 || strcasecmp(info->id, "ARCHER-C7-V5") == 0) { const char mdat[11] = {0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0xca, 0x00, 0x01, 0x00, 0x00}; parts[5] = put_data("extra-para", mdat, 11); } diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index a068a7c83..4c7e8a7b6 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libressl -PKG_VERSION:=2.6.4 -PKG_HASH:=638a20c2f9e99ee283a841cd787ab4d846d1880e180c4e96904fc327d419d11f +PKG_VERSION:=2.7.2 +PKG_HASH:=917a8779c342177ff3751a2bf955d0262d1d8916a4b408930c45cef326700995 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/tools/lzma-old/Makefile b/tools/lzma-old/Makefile index 5982eab5d..5204127a8 100644 --- a/tools/lzma-old/Makefile +++ b/tools/lzma-old/Makefile @@ -21,7 +21,9 @@ LIB_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Lib ALONE_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Alone define Host/Compile + +$(HOST_MAKE_VARS) \ $(MAKE) -C $(LIB_DIR) + +$(HOST_MAKE_VARS) \ $(MAKE) -f makefile.gcc -C $(ALONE_DIR) endef diff --git a/tools/lzma-old/patches/120-add-cflags.patch b/tools/lzma-old/patches/120-add-cflags.patch new file mode 100644 index 000000000..9022e7cd2 --- /dev/null +++ b/tools/lzma-old/patches/120-add-cflags.patch @@ -0,0 +1,11 @@ +--- a/C/7zip/Compress/LZMA_Lib/makefile ++++ b/C/7zip/Compress/LZMA_Lib/makefile +@@ -2,7 +2,7 @@ PROG = liblzma.a + CXX = g++ -O3 -Wall + AR = ar + RM = rm -f +-CFLAGS = -c -I ../../../ ++CFLAGS += -c -I ../../../ + + OBJS = \ + ZLib.o \ diff --git a/tools/m4/patches/010-glibc-change-work-around.patch b/tools/m4/patches/010-glibc-change-work-around.patch new file mode 100644 index 000000000..0ef621696 --- /dev/null +++ b/tools/m4/patches/010-glibc-change-work-around.patch @@ -0,0 +1,118 @@ +Subject: Workaround change in glibc + +Temporary workaround to compile with glibc 2.28, which +deprecated some constants + +Taken from the rpms/m4 Fedora repository, commit 814d5921 +(Work around change in glibc) + +Original filename: m4-1.4.18-glibc-change-work-around.patch + +--- a/lib/stdio-impl.h ++++ b/lib/stdio-impl.h +@@ -18,6 +18,12 @@ + the same implementation of stdio extension API, except that some fields + have different naming conventions, or their access requires some casts. */ + ++/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this ++ problem by defining it ourselves. FIXME: Do not rely on glibc ++ internals. */ ++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN ++# define _IO_IN_BACKUP 0x100 ++#endif + + /* BSD stdio derived implementations. */ + +--- a/lib/fflush.c ++++ b/lib/fflush.c +@@ -33,7 +33,7 @@ + #undef fflush + + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ + static void +@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp) + + #endif + +-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) ++#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) + + # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ +@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream) + if (stream == NULL || ! freading (stream)) + return fflush (stream); + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + clear_ungetc_buffer_preserving_position (stream); + +--- a/lib/fpending.c ++++ b/lib/fpending.c +@@ -32,7 +32,7 @@ __fpending (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return fp->_IO_write_ptr - fp->_IO_write_base; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ +--- a/lib/fpurge.c ++++ b/lib/fpurge.c +@@ -62,7 +62,7 @@ fpurge (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_IO_read_end = fp->_IO_read_ptr; + fp->_IO_write_ptr = fp->_IO_write_base; + /* Avoid memory leak when there is an active ungetc buffer. */ +--- a/lib/freadahead.c ++++ b/lib/freadahead.c +@@ -25,7 +25,7 @@ + size_t + freadahead (FILE *fp) + { +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_write_ptr > fp->_IO_write_base) + return 0; + return (fp->_IO_read_end - fp->_IO_read_ptr) +--- a/lib/freading.c ++++ b/lib/freading.c +@@ -31,7 +31,7 @@ freading (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return ((fp->_flags & _IO_NO_WRITES) != 0 + || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 + && fp->_IO_read_base != NULL)); +--- a/lib/fseeko.c ++++ b/lib/fseeko.c +@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when + #endif + + /* These tests are based on fpurge.c. */ +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_read_end == fp->_IO_read_ptr + && fp->_IO_write_ptr == fp->_IO_write_base + && fp->_IO_save_base == NULL) +@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when + return -1; + } + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_flags &= ~_IO_EOF_SEEN; + fp->_offset = pos; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile index f140101c8..f67ab6e5b 100644 --- a/tools/make-ext4fs/Makefile +++ b/tools/make-ext4fs/Makefile @@ -17,14 +17,6 @@ PKG_MIRROR_HASH:=d7ccd5e426b1d15331ff000a37dc15161f6eef594453e970fd584fcde5a2507 include $(INCLUDE_DIR)/host-build.mk -ifeq ($(HOST_OS),Linux) - MAKE_STATIC := STATIC=1 -endif - -define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR) make_ext4fs $(MAKE_STATIC) -endef - define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/make_ext4fs $(STAGING_DIR_HOST)/bin/ endef diff --git a/tools/make-ext4fs/patches/100-add-ldflags.patch b/tools/make-ext4fs/patches/100-add-ldflags.patch new file mode 100644 index 000000000..d9ce47bb8 --- /dev/null +++ b/tools/make-ext4fs/patches/100-add-ldflags.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -27,7 +27,7 @@ OBJ := \ + $(CC) $(CFLAGS) -c -o $@ $^ + + make_ext4fs: $(OBJ) libsparse/libsparse.a +- $(CC) -o $@ $^ $(ZLIB) ++ $(CC) $(LDFLAGS)-o $@ $^ $(ZLIB) + + libsparse/libsparse.a: + $(MAKE) -C libsparse/ libsparse.a diff --git a/tools/mm-macros/Makefile b/tools/mm-macros/Makefile index d8f4a520b..2d7991455 100644 --- a/tools/mm-macros/Makefile +++ b/tools/mm-macros/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mm-macros -PKG_VERSION:=0.9.11 +PKG_VERSION:=0.9.12 PKG_SOURCE_URL:=@GNOME/mm-common/0.9 PKG_SOURCE:=mm-common-$(PKG_VERSION).tar.xz -PKG_HASH:=20d1e7466ca4c83c92e29f9e8dfcc8e5721fdf1337f53157bed97be3b73b32a8 +PKG_HASH:=ceffdcce1e5b52742884c233ec604bf6fded12eea9da077ce7a62c02c87e7c0b HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/mm-common-$(PKG_VERSION) diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile index 7b4a91a73..ff000b99e 100644 --- a/tools/mtd-utils/Makefile +++ b/tools/mtd-utils/Makefile @@ -7,44 +7,42 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=1.5.2 +PKG_VERSION:=2.0.2 -PKG_SOURCE_VERSION:=aea36417067dade75192bafa03af70b6eb2677b1 -PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git -PKG_SOURCE_PROTO:=git -PKG_MIRROR_HASH:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/mtd-utils/ +PKG_HASH:=fb3de61be8e932abb424e8ea3c30298f553d5f970ad158a737bb303bbf9660b8 + +PKG_FIXUP:=autoreconf include $(INCLUDE_DIR)/host-build.mk -HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs -CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) -L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT ifneq ($(HOST_OS),Linux) -CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include endian.h -I$(CURDIR)/include -include fls.h -MTD_STATIC := 0 -else -MTD_STATIC := 1 + HOST_CFLAGS += \ + -I$(CURDIR)/include \ + -Dloff_t=off_t \ + -D__BYTE_ORDER=BYTE_ORDER \ + -include endian.h \ + -DNO_NATIVE_SUPPORT \ + -include fls.h endif -MTD_MAKEOPTS = \ - CFLAGS="$(CFLAGS)" \ - LDFLAGS="$(HOST_LDFLAGS)" \ - WITHOUT_LZO=1 WITHOUT_XATTR=1 \ - SUBDIRS="" \ - BUILDDIR="$(HOST_BUILD_DIR)" \ - STATIC=$(MTD_STATIC) \ - V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1) +HOST_CONFIGURE_VARS+= \ + UUID_CFLAGS="-I$(STAGING_DIR_HOST)/include/e2fsprogs/uuid" -define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR) \ - $(MTD_MAKEOPTS) \ - TARGETS="mkfs.jffs2 ubi-utils/ubinize mkfs.ubifs/mkfs.ubifs" -endef +HOST_CONFIGURE_ARGS+= \ + --disable-tests \ + --without-xattr \ + --without-lzo + +HOST_MAKE_FLAGS += \ + PROGRAMS="mkfs.jffs2 ubinize mkfs.ubifs" define Host/Install $(CP) \ $(HOST_BUILD_DIR)/mkfs.jffs2 \ - $(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \ - $(HOST_BUILD_DIR)/ubi-utils/ubinize \ + $(HOST_BUILD_DIR)/mkfs.ubifs \ + $(HOST_BUILD_DIR)/ubinize \ $(STAGING_DIR_HOST)/bin/ endef diff --git a/tools/mtd-utils/patches/100-sscanf_fix.patch b/tools/mtd-utils/patches/100-sscanf_fix.patch index 0af583f4c..ae6f86722 100644 --- a/tools/mtd-utils/patches/100-sscanf_fix.patch +++ b/tools/mtd-utils/patches/100-sscanf_fix.patch @@ -1,6 +1,6 @@ ---- a/mkfs.jffs2.c -+++ b/mkfs.jffs2.c -@@ -422,7 +422,7 @@ static int interpret_table_entry(struct +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -427,7 +427,7 @@ static int interpret_table_entry(struct if (sscanf (line, "%" SCANF_PREFIX "s %c %lo %lu %lu %lu %lu %lu %lu %lu", SCANF_STRING(name), &type, &mode, &uid, &gid, &major, &minor, diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch index c4cdab928..a2942270d 100644 --- a/tools/mtd-utils/patches/110-portability.patch +++ b/tools/mtd-utils/patches/110-portability.patch @@ -1,5 +1,5 @@ ---- a/compr_lzo.c -+++ b/compr_lzo.c +--- a/jffsX-utils/compr_lzo.c ++++ b/jffsX-utils/compr_lzo.c @@ -26,7 +26,6 @@ #include @@ -8,8 +8,8 @@ #include #include #include "compr.h" ---- a/compr_zlib.c -+++ b/compr_zlib.c +--- a/jffsX-utils/compr_zlib.c ++++ b/jffsX-utils/compr_zlib.c @@ -39,7 +39,6 @@ #include #undef crc32 @@ -18,8 +18,8 @@ #include #include "common.h" #include "compr.h" ---- a/rbtree.h -+++ b/rbtree.h +--- a/jffsX-utils/rbtree.h ++++ b/jffsX-utils/rbtree.h @@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa #ifndef _LINUX_RBTREE_H #define _LINUX_RBTREE_H @@ -48,8 +48,8 @@ /* The version of UBI images supported by this implementation */ #define UBI_VERSION 1 ---- a/mkfs.ubifs/mkfs.ubifs.h -+++ b/mkfs.ubifs/mkfs.ubifs.h +--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h ++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h @@ -32,7 +32,17 @@ #include #include @@ -68,9 +68,9 @@ #include #include ---- a/mkfs.ubifs/mkfs.ubifs.c -+++ b/mkfs.ubifs/mkfs.ubifs.c -@@ -1010,6 +1010,7 @@ static int add_inode_with_data(struct st +--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c ++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +@@ -1219,6 +1219,7 @@ static int add_inode(struct stat *st, in if (c->default_compr != UBIFS_COMPR_NONE) use_flags |= UBIFS_COMPR_FL; @@ -78,7 +78,7 @@ if (flags & FS_COMPR_FL) use_flags |= UBIFS_COMPR_FL; if (flags & FS_SYNC_FL) -@@ -1020,6 +1021,7 @@ static int add_inode_with_data(struct st +@@ -1229,6 +1230,7 @@ static int add_inode(struct stat *st, in use_flags |= UBIFS_APPEND_FL; if (flags & FS_DIRSYNC_FL && S_ISDIR(st->st_mode)) use_flags |= UBIFS_DIRSYNC_FL; @@ -86,7 +86,7 @@ memset(ino, 0, UBIFS_INO_NODE_SZ); -@@ -1089,7 +1091,9 @@ static int add_dir_inode(DIR *dir, ino_t +@@ -1293,7 +1295,9 @@ static int add_dir_inode(const char *pat fd = dirfd(dir); if (fd == -1) return sys_err_msg("dirfd failed"); @@ -96,20 +96,23 @@ flags = 0; } -@@ -1274,10 +1278,12 @@ static int add_file(const char *path_nam +@@ -1476,6 +1480,7 @@ static int add_file(const char *path_nam key_write(&key, &dn->key); dn->size = cpu_to_le32(bytes_read); out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ; +#ifndef NO_NATIVE_SUPPORT if (c->default_compr == UBIFS_COMPR_NONE && (flags & FS_COMPR_FL)) + #ifdef WITHOUT_LZO +@@ -1484,6 +1489,7 @@ static int add_file(const char *path_nam use_compr = UBIFS_COMPR_LZO; + #endif else +#endif use_compr = c->default_compr; compr_type = compress_data(buf, bytes_read, &dn->data, &out_len, use_compr); -@@ -1319,7 +1325,9 @@ static int add_non_dir(const char *path_ +@@ -1527,7 +1533,9 @@ static int add_non_dir(const char *path_ if (fd == -1) return sys_err_msg("failed to open file '%s'", path_name); @@ -119,9 +122,9 @@ flags = 0; if (close(fd) == -1) return sys_err_msg("failed to close file '%s'", ---- a/mkfs.ubifs/devtable.c -+++ b/mkfs.ubifs/devtable.c -@@ -134,6 +134,7 @@ static int interpret_table_entry(const c +--- a/ubifs-utils/mkfs.ubifs/devtable.c ++++ b/ubifs-utils/mkfs.ubifs/devtable.c +@@ -135,6 +135,7 @@ static int interpret_table_entry(const c unsigned int mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; unsigned int start = 0, increment = 0, count = 0; @@ -129,17 +132,19 @@ if (sscanf(line, "%1023s %c %o %u %u %u %u %u %u %u", buf, &type, &mode, &uid, &gid, &major, &minor, &start, &increment, &count) < 0) -@@ -144,8 +145,8 @@ static int interpret_table_entry(const c +@@ -145,10 +146,10 @@ static int interpret_table_entry(const c buf, type, mode, uid, gid, major, minor, start, increment, count); - len = strnlen(buf, 1024); -- if (len == 1024) + len = strlen(buf); + if (len == 0) + return err_msg("empty path"); +- if (len == 1024) + if (len == 1023) return err_msg("too long path"); - if (!strcmp(buf, "/")) + if (buf[0] != '/') --- a/include/common.h +++ b/include/common.h @@ -26,7 +26,6 @@ @@ -148,8 +153,8 @@ #include -#include #include - #include "version.h" - + #include + #include --- a/include/mtd/ubifs-media.h +++ b/include/mtd/ubifs-media.h @@ -33,7 +33,15 @@ diff --git a/tools/mtd-utils/patches/120-include_sysmacros.patch b/tools/mtd-utils/patches/120-include_sysmacros.patch deleted file mode 100644 index 81ba1cfb2..000000000 --- a/tools/mtd-utils/patches/120-include_sysmacros.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 9a06f45ec71116d76ee4b268ebe1b33d45b06fc0 Mon Sep 17 00:00:00 2001 -From: Mike Frysinger -Date: Sat, 16 Apr 2016 22:10:43 -0400 -Subject: [PATCH mtd-utils] include sys/sysmacros.h for major/minor/makedev - -These functions have always been defined in sys/sysmacros.h under -Linux C libraries. For some, including sys/types.h implicitly -includes that as well, but glibc wants to deprecate that, and some -others already have. Include the header explicitly for the funcs. - -Signed-off-by: Mike Frysinger ---- - include/common.h | 1 + - 1 file changed, 1 insertion(+) - ---- a/include/common.h -+++ b/include/common.h -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - #include "version.h" - - #ifndef PROGRAM_NAME diff --git a/tools/mtd-utils/patches/130-lzma_jffs2.patch b/tools/mtd-utils/patches/130-lzma_jffs2.patch index b04f01992..d9cbfeebe 100644 --- a/tools/mtd-utils/patches/130-lzma_jffs2.patch +++ b/tools/mtd-utils/patches/130-lzma_jffs2.patch @@ -1,32 +1,35 @@ ---- a/Makefile -+++ b/Makefile -@@ -4,6 +4,7 @@ - VERSION = 1.5.2 +--- a/jffsX-utils/Makemodule.am ++++ b/jffsX-utils/Makemodule.am +@@ -4,11 +4,19 @@ mkfs_jffs2_SOURCES = \ + jffsX-utils/compr_zlib.c \ + jffsX-utils/compr.h \ + jffsX-utils/rbtree.c \ +- jffsX-utils/compr_lzo.c \ ++ jffsX-utils/compr_lzma.c \ ++ jffsX-utils/lzma/LzFind.c \ ++ jffsX-utils/lzma/LzmaEnc.c \ ++ jffsX-utils/lzma/LzmaDec.c \ + jffsX-utils/compr.c \ + jffsX-utils/compr_rtime.c ++ ++if !WITHOUT_LZO ++mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c ++endif ++ + mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +-mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) ++mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) -I./include/linux/lzma - CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS) -+CPPFLAGS += -I./include/linux/lzma - - ifeq ($(WITHOUT_XATTR), 1) - CPPFLAGS += -DWITHOUT_XATTR -@@ -84,7 +85,9 @@ $(BUILDDIR)/include/version.h.tmp: - # - # Utils in top level - # --obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o -+obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o $(if $(WITHOUT_LZO),,compr_lzo.o)\ -+ compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o \ -+ compr.o rbtree.o - LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) - LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) - ---- a/compr.c -+++ b/compr.c + jffs2reader_SOURCES = jffsX-utils/jffs2reader.c + jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) +--- a/jffsX-utils/compr.c ++++ b/jffsX-utils/compr.c @@ -520,6 +520,9 @@ int jffs2_compressors_init(void) #ifdef CONFIG_JFFS2_LZO jffs2_lzo_init(); #endif +#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_init(); ++ jffs2_lzma_init(); +#endif return 0; } @@ -36,12 +39,12 @@ jffs2_lzo_exit(); #endif +#ifdef CONFIG_JFFS2_LZMA -+ jffs2_lzma_exit(); ++ jffs2_lzma_exit(); +#endif return 0; } ---- a/compr.h -+++ b/compr.h +--- a/jffsX-utils/compr.h ++++ b/jffsX-utils/compr.h @@ -18,13 +18,14 @@ #define CONFIG_JFFS2_ZLIB @@ -72,7 +75,7 @@ #endif /* __JFFS2_COMPR_H__ */ --- /dev/null -+++ b/compr_lzma.c ++++ b/jffsX-utils/compr_lzma.c @@ -0,0 +1,128 @@ +/* + * JFFS2 -- Journalling Flash File System, Version 2. @@ -119,7 +122,7 @@ + return -1; + } + -+ return 0; ++ return 0; +} + +STATIC int jffs2_lzma_compress(unsigned char *data_in, unsigned char *cpage_out, @@ -175,26 +178,26 @@ + +int INIT jffs2_lzma_init(void) +{ -+ int ret; ++ 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; ++ 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; ++ if (ret < 0) ++ return ret; + + ret = jffs2_register_compressor(&jffs2_lzma_comp); + if (ret) + lzma_free_workspace(); + -+ return ret; ++ return ret; +} + +void jffs2_lzma_exit(void) @@ -245,7 +248,7 @@ + #define LZMA_FREE free + #define PRINT_ERROR(msg) fprintf(stderr, msg) + #define INIT -+ #define STATIC ++ #define STATIC static +#endif + +#include "lzma/LzmaDec.h" @@ -261,16 +264,16 @@ + +static void *p_lzma_malloc(void *p, size_t size) +{ -+ if (size == 0) -+ return NULL; ++ if (size == 0) ++ return NULL; + -+ return LZMA_MALLOC(size); ++ return LZMA_MALLOC(size); +} + +static void p_lzma_free(void *p, void *address) +{ -+ if (address != NULL) -+ LZMA_FREE(address); ++ if (address != NULL) ++ LZMA_FREE(address); +} + +static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free}; @@ -900,7 +903,7 @@ + +#endif --- /dev/null -+++ b/lzma/LzFind.c ++++ b/jffsX-utils/lzma/LzFind.c @@ -0,0 +1,753 @@ +/* LzFind.c -- Match finder for LZ algorithms +2008-04-04 @@ -949,9 +952,9 @@ +} + +Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; } -+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; } ++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) +{ @@ -1656,7 +1659,7 @@ + } +} --- /dev/null -+++ b/lzma/LzmaDec.c ++++ b/jffsX-utils/lzma/LzmaDec.c @@ -0,0 +1,1014 @@ +/* LzmaDec.c -- LZMA Decoder +2008-04-29 @@ -2357,7 +2360,7 @@ + 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; @@ -2673,7 +2676,7 @@ + return res; +} --- /dev/null -+++ b/lzma/LzmaEnc.c ++++ b/jffsX-utils/lzma/LzmaEnc.c @@ -0,0 +1,2335 @@ +/* LzmaEnc.c -- LZMA Encoder +2008-04-28 @@ -2777,7 +2780,7 @@ +#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; @@ -3031,7 +3034,7 @@ + CSaveState saveState; +} CLzmaEnc; + -+void LzmaEnc_SaveState(CLzmaEncHandle pp) ++static void LzmaEnc_SaveState(CLzmaEncHandle pp) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; + CSaveState *dest = &p->saveState; @@ -3057,7 +3060,7 @@ + memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); +} + -+void LzmaEnc_RestoreState(CLzmaEncHandle pp) ++static void LzmaEnc_RestoreState(CLzmaEncHandle pp) +{ + CLzmaEnc *dest = (CLzmaEnc *)pp; + const CSaveState *p = &dest->saveState; @@ -3300,7 +3303,7 @@ + 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)) @@ -4426,7 +4429,7 @@ + p->matchPriceCount = 0; +} + -+void LzmaEnc_Construct(CLzmaEnc *p) ++static void LzmaEnc_Construct(CLzmaEnc *p) +{ + RangeEnc_Construct(&p->rc); + MatchFinder_Construct(&p->matchFinderBase); @@ -4459,7 +4462,7 @@ + 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); @@ -4467,7 +4470,7 @@ + p->saveState.litProbs = 0; +} + -+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) ++static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig) +{ + #ifdef COMPRESS_MF_MT + MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); @@ -4698,7 +4701,7 @@ + return SZ_OK; +} + -+void LzmaEnc_Init(CLzmaEnc *p) ++static void LzmaEnc_Init(CLzmaEnc *p) +{ + UInt32 i; + p->state = 0; @@ -4757,7 +4760,7 @@ + p->lpMask = (1 << p->lp) - 1; +} + -+void LzmaEnc_InitPrices(CLzmaEnc *p) ++static void LzmaEnc_InitPrices(CLzmaEnc *p) +{ + if (!p->fastMode) + { @@ -4798,7 +4801,7 @@ + return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); +} + -+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ++static SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, + ISeqInStream *inStream, UInt32 keepWindowSize, + ISzAlloc *alloc, ISzAlloc *allocBig) +{ @@ -4814,7 +4817,7 @@ + p->seqBufInStream.rem = 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; @@ -4823,7 +4826,7 @@ + return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); +} + -+void LzmaEnc_Finish(CLzmaEncHandle pp) ++static void LzmaEnc_Finish(CLzmaEncHandle pp) +{ + #ifdef COMPRESS_MF_MT + CLzmaEnc *p = (CLzmaEnc *)pp; @@ -4855,19 +4858,19 @@ +} + + -+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) ++static UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) +{ + const CLzmaEnc *p = (CLzmaEnc *)pp; + return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); +} + -+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) ++static 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, ++static SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, + Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) +{ + CLzmaEnc *p = (CLzmaEnc *)pp; @@ -5010,9 +5013,9 @@ + LzmaEnc_Destroy(p, alloc, allocBig); + return res; +} ---- a/mkfs.jffs2.c -+++ b/mkfs.jffs2.c -@@ -1659,11 +1659,11 @@ int main(int argc, char **argv) +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -1666,11 +1666,11 @@ int main(int argc, char **argv) } erase_block_size *= units; diff --git a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch b/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch deleted file mode 100644 index 90d4ef4c3..000000000 --- a/tools/mtd-utils/patches/135-mkubifs_optional_lzo.patch +++ /dev/null @@ -1,119 +0,0 @@ ---- a/mkfs.ubifs/compr.c -+++ b/mkfs.ubifs/compr.c -@@ -24,7 +24,6 @@ - #include - #include - #include --#include - #include - - #define crc32 __zlib_crc32 -@@ -34,7 +33,6 @@ - #include "compr.h" - #include "mkfs.ubifs.h" - --static void *lzo_mem; - static unsigned long long errcnt = 0; - static struct ubifs_info *c = &info_; - -@@ -85,6 +83,25 @@ static int zlib_deflate(void *in_buf, si - return 0; - } - -+#ifndef WITHOUT_LZO -+#include -+ -+static void *lzo_mem; -+ -+static int lzo_init(void) -+{ -+ lzo_mem = malloc(LZO1X_999_MEM_COMPRESS); -+ if (!lzo_mem) -+ return -1; -+ -+ return 0; -+} -+ -+static void lzo_fini(void) -+{ -+ free(lzo_mem); -+} -+ - static int lzo_compress(void *in_buf, size_t in_len, void *out_buf, - size_t *out_len) - { -@@ -102,6 +119,12 @@ static int lzo_compress(void *in_buf, si - - return 0; - } -+#else -+static inline int lzo_compress(void *in_buf, size_t in_len, void *out_buf, -+ size_t *out_len) { return -1; } -+static inline int lzo_init(void) { return 0; } -+static inline void lzo_fini(void) { } -+#endif - - static int no_compress(void *in_buf, size_t in_len, void *out_buf, - size_t *out_len) -@@ -122,7 +145,6 @@ static int favor_lzo_compress(void *in_b - lzo_len = zlib_len = *out_len; - lzo_ret = lzo_compress(in_buf, in_len, out_buf, &lzo_len); - zlib_ret = zlib_deflate(in_buf, in_len, zlib_buf, &zlib_len); -- - if (lzo_ret && zlib_ret) - /* Both compressors failed */ - return -1; -@@ -197,23 +219,28 @@ int compress_data(void *in_buf, size_t i - - int init_compression(void) - { -- lzo_mem = malloc(LZO1X_999_MEM_COMPRESS); -- if (!lzo_mem) -- return -1; -+ int ret; -+ -+ ret = lzo_init(); -+ if (ret) -+ goto err; - - zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR); -- if (!zlib_buf) { -- free(lzo_mem); -- return -1; -- } -+ if (!zlib_buf) -+ goto err_lzo; - - return 0; -+ -+err_lzo: -+ lzo_fini(); -+err: -+ return ret; - } - - void destroy_compression(void) - { - free(zlib_buf); -- free(lzo_mem); -+ lzo_fini(); - if (errcnt) - fprintf(stderr, "%llu compression errors occurred\n", errcnt); - } ---- a/Makefile -+++ b/Makefile -@@ -108,7 +108,13 @@ $(call _mkdep,lib/,libmtd.a) - obj-mkfs.ubifs = crc16.o lpt.o compr.o devtable.o \ - hashtable/hashtable.o hashtable/hashtable_itr.o - LDFLAGS_mkfs.ubifs = $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(UUIDLDFLAGS) --LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -+ifeq ($(WITHOUT_LZO), 1) -+ CPPFLAGS += -DWITHOUT_LZO -+else -+ LZOLDLIBS = -llzo2 -+endif -+ -+LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid - $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a) - - # diff --git a/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch b/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch index 95ce1e913..d95ece184 100644 --- a/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch +++ b/tools/mtd-utils/patches/200-libubigen-add-ubigen_write_terminator-function.patch @@ -1,5 +1,5 @@ ---- a/ubi-utils/libubigen.c -+++ b/ubi-utils/libubigen.c +--- a/lib/libubigen.c ++++ b/lib/libubigen.c @@ -122,8 +122,9 @@ int ubigen_add_volume(const struct ubige return 0; } @@ -75,8 +75,8 @@ return 0; out_free: ---- a/ubi-utils/include/libubigen.h -+++ b/ubi-utils/include/libubigen.h +--- a/include/libubigen.h ++++ b/include/libubigen.h @@ -188,6 +188,9 @@ int ubigen_write_layout_vol(const struct long long ec1, long long ec2, struct ubi_vtbl_record *vtbl, int fd); diff --git a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch index cbb2802c5..0da28b71f 100644 --- a/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch +++ b/tools/mtd-utils/patches/201-ubinize-add-terminator-support.patch @@ -1,6 +1,6 @@ --- a/ubi-utils/ubinize.c +++ b/ubi-utils/ubinize.c -@@ -70,6 +70,8 @@ static const char optionsstr[] = +@@ -60,6 +60,8 @@ static const char optionsstr[] = " (default is 1)\n" "-Q, --image-seq= 32-bit UBI image sequence number to use\n" " (by default a random number is picked)\n" @@ -8,17 +8,8 @@ +" output image\n" "-v, --verbose be verbose\n" "-h, --help print help message\n" - "-V, --version print program version"; -@@ -79,7 +81,7 @@ static const char usage[] = - "\t\t[-x ] [-Q ] [-v] [-h] [-V] [--output=] [--peb-size=]\n" - "\t\t[--min-io-size=] [--sub-page-size=] [--vid-hdr-offset=]\n" - "\t\t[--erase-counter=] [--ubi-ver=] [--image-seq=] [--verbose] [--help]\n" --"\t\t[--version] ini-file\n" -+"\t\t[--eof-markers=] [--version] ini-file\n" - "Example: " PROGRAM_NAME " -o ubi.img -p 16KiB -m 512 -s 256 cfg.ini - create UBI image\n" - " 'ubi.img' as described by configuration file 'cfg.ini'"; - -@@ -125,6 +127,7 @@ static const struct option long_options[ + "-V, --version print program version\n\n"; +@@ -79,6 +81,7 @@ static const struct option long_options[ { .name = "erase-counter", .has_arg = 1, .flag = NULL, .val = 'e' }, { .name = "ubi-ver", .has_arg = 1, .flag = NULL, .val = 'x' }, { .name = "image-seq", .has_arg = 1, .flag = NULL, .val = 'Q' }, @@ -26,7 +17,7 @@ { .name = "verbose", .has_arg = 0, .flag = NULL, .val = 'v' }, { .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' }, { .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' }, -@@ -144,6 +147,7 @@ struct args { +@@ -98,6 +101,7 @@ struct args { uint32_t image_seq; int verbose; dictionary *dict; @@ -34,7 +25,7 @@ }; static struct args args = { -@@ -162,7 +166,7 @@ static int parse_opt(int argc, char * co +@@ -116,7 +120,7 @@ static int parse_opt(int argc, char * co int key, error = 0; unsigned long int image_seq; @@ -43,7 +34,7 @@ if (key == -1) break; -@@ -222,6 +226,12 @@ static int parse_opt(int argc, char * co +@@ -176,6 +180,12 @@ static int parse_opt(int argc, char * co args.image_seq = image_seq; break; @@ -56,7 +47,7 @@ case 'v': args.verbose = 1; break; -@@ -599,6 +609,18 @@ int main(int argc, char * const argv[]) +@@ -559,6 +569,18 @@ int main(int argc, char * const argv[]) printf("\n"); } diff --git a/tools/mtd-utils/patches/310-add-static-linking-option.patch b/tools/mtd-utils/patches/310-add-static-linking-option.patch deleted file mode 100644 index 828d7751e..000000000 --- a/tools/mtd-utils/patches/310-add-static-linking-option.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/common.mk -+++ b/common.mk -@@ -2,6 +2,16 @@ CC := $(CROSS)gcc - AR := $(CROSS)ar - RANLIB := $(CROSS)ranlib - -+ifeq ($(STATIC),1) -+ define static_link -+ -Wl,-Bstatic $(1) -Wl,-Bdynamic -+ endef -+else -+ define static_link -+ $(1) -+ endef -+endif -+ - # Stolen from Linux build system - comma = , - try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)") ---- a/Makefile -+++ b/Makefile -@@ -89,10 +89,10 @@ obj-mkfs.jffs2 = compr_rtime.o compr_zli - compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o \ - compr.o rbtree.o - LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) --LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) -+LDLIBS_mkfs.jffs2 = $(call static_link,-lz $(LZOLDLIBS)) - - LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS) --LDLIBS_jffs2reader = -lz $(LZOLDLIBS) -+LDLIBS_jffs2reader = $(call static_link,-lz $(LZOLDLIBS)) - - $(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v)))) - -@@ -114,7 +114,7 @@ else - LZOLDLIBS = -llzo2 - endif - --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/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch b/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch index 70e6a7e36..8e5805957 100644 --- a/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch +++ b/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch @@ -1,6 +1,6 @@ ---- a/mkfs.jffs2.c -+++ b/mkfs.jffs2.c -@@ -108,7 +108,7 @@ static char *rootdir = default_rootdir; +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -109,7 +109,7 @@ static char *rootdir = default_rootdir; static int verbose = 0; static int squash_uids = 0; static int squash_perms = 0; @@ -8,8 +8,8 @@ +static time_t fixed_timestamp = -1; int target_endian = __BYTE_ORDER; - uint32_t find_hardlink(struct filesystem_entry *e) -@@ -249,8 +249,8 @@ static struct filesystem_entry *add_host + static uint32_t find_hardlink(struct filesystem_entry *e) +@@ -250,8 +250,8 @@ static struct filesystem_entry *add_host mode &= ~(S_ISUID | S_ISGID); } } @@ -20,7 +20,7 @@ } entry = xcalloc(1, sizeof(struct filesystem_entry)); -@@ -1554,6 +1554,20 @@ void parse_image(){ +@@ -1557,6 +1557,20 @@ static void parse_image(void){ close(in_fd); } @@ -41,7 +41,7 @@ int main(int argc, char **argv) { int c, opt; -@@ -1572,6 +1586,7 @@ int main(int argc, char **argv) +@@ -1575,6 +1589,7 @@ int main(int argc, char **argv) warn_page_size = 1; /* warn user if page size not 4096 */ jffs2_compressors_init(); @@ -49,7 +49,7 @@ while ((opt = getopt_long(argc, argv, "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) -@@ -1622,7 +1637,7 @@ int main(int argc, char **argv) +@@ -1625,7 +1640,7 @@ int main(int argc, char **argv) break; case 'f': diff --git a/tools/sed/Makefile b/tools/sed/Makefile index 5f47c6c4b..834519b73 100644 --- a/tools/sed/Makefile +++ b/tools/sed/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sed -PKG_VERSION:=4.4 +PKG_VERSION:=4.5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=cbd6ebc5aaf080ed60d0162d7f6aeae58211a1ee9ba9bb25623daa6cd942683b +PKG_HASH:=7aad73c8839c2bdadca9476f884d2953cdace9567ecd0d90f9959f229d146b40 export SED:= HOST_BUILD_PARALLEL:=1 diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile index e9e2b7ca9..409b1b5a2 100644 --- a/tools/squashfs4/Makefile +++ b/tools/squashfs4/Makefile @@ -20,8 +20,8 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION) include $(INCLUDE_DIR)/host-build.mk define Host/Compile + +$(HOST_MAKE_VARS) \ $(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \ - CC="$(HOSTCC)" \ XZ_SUPPORT=1 \ LZMA_XZ_SUPPORT=1 \ XATTR_SUPPORT= \ diff --git a/tools/xz/Makefile b/tools/xz/Makefile index b803d5c35..d6b619db4 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xz -PKG_VERSION:=5.2.3 +PKG_VERSION:=5.2.4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/lzmautils \ http://tukaani.org/xz -PKG_HASH:=fd9ca16de1052aac899ad3495ad20dfa906c27b4a5070102a2ec35ca3a4740c1 +PKG_HASH:=3313fd2a95f43d88e44264e6b015e7d03053e681860b0d5d3f9baca79c57b7bf HOST_BUILD_PARALLEL:=1 @@ -24,14 +24,7 @@ HOSTCXX := $(HOSTCXX_NOCACHE) HOST_CONFIGURE_ARGS += \ --enable-static=yes \ --enable-shared=no \ - -define Host/Prepare - $(call Host/Prepare/Default) - - # FreeBSD portability fix - sed -i -e 's|#if defined(HAVE_BYTESWAP_H)|& \&\& !defined(__FreeBSD__)|' \ - $(HOST_BUILD_DIR)/src/common/tuklib_integer.h -endef + --disable-doc define Host/Install +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) install xzlinks="unxz xzcat" diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile new file mode 100644 index 000000000..279851f75 --- /dev/null +++ b/tools/zlib/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2006-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:=zlib +PKG_VERSION:=1.2.11 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net +PKG_HASH:=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066 + +PKG_LICENSE:=Zlib +PKG_LICENSE_FILES:=README +PKG_CPE_ID:=cpe:/a:gnu:zlib + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +HOST_CFLAGS +=-fPIC + +define Host/Install + $(CP) $(HOST_BUILD_DIR)/libz.a $(STAGING_DIR_HOST)/lib/ + $(CP) $(HOST_BUILD_DIR)/zconf.h $(STAGING_DIR_HOST)/include/ + $(CP) $(HOST_BUILD_DIR)/zlib.h $(STAGING_DIR_HOST)/include/ + $(CP) $(HOST_BUILD_DIR)/zlib.pc $(STAGING_DIR_HOST)/lib/pkgconfig/ +endef + +define Host/Clean + rm -f $(STAGING_DIR_HOST)/lib/libz.a + rm -f $(STAGING_DIR_HOST)/include/zconf.h + rm -f $(STAGING_DIR_HOST)/include/zlib.h + rm -f $(STAGING_DIR_HOST)/lib/pkgconfig//zlib.pc +endef + +$(eval $(call HostBuild)) diff --git a/tools/zlib/patches/900-overridable-pc-exec-prefix.patch b/tools/zlib/patches/900-overridable-pc-exec-prefix.patch new file mode 100644 index 000000000..4f1e376c9 --- /dev/null +++ b/tools/zlib/patches/900-overridable-pc-exec-prefix.patch @@ -0,0 +1,14 @@ +--- a/zlib.pc.cmakein ++++ b/zlib.pc.cmakein +@@ -1,8 +1,8 @@ + prefix=@CMAKE_INSTALL_PREFIX@ + exec_prefix=@CMAKE_INSTALL_PREFIX@ +-libdir=@INSTALL_LIB_DIR@ +-sharedlibdir=@INSTALL_LIB_DIR@ +-includedir=@INSTALL_INC_DIR@ ++libdir=${prefix}/lib ++sharedlibdir=${prefix}/lib ++includedir=${prefix}/include + + Name: zlib + Description: zlib compression library